------------------------------------------------------------
revno: 1197
committer: Roger Martin <[email protected]>
branch nick: aikiframework
timestamp: Wed 2012-05-09 00:00:36 +0200
message:
  time and numbers of queries will be not added to custom output
modified:
  index.php


--
lp:aikiframework
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk

Your team Aiki Framework Developers is subscribed to branch lp:aikiframework.
To unsubscribe from this branch go to 
https://code.launchpad.net/~aikiframework-devel/aikiframework/trunk/+edit-subscription
=== modified file 'index.php'
--- index.php	2012-05-08 21:34:14 +0000
+++ index.php	2012-05-08 22:00:36 +0000
@@ -20,7 +20,10 @@
     function stripslashes_gpc(&$value)
     {
         $value = stripslashes($value);
-    }
+    } 
+    array_walk_recursive($_GET, 'stripslashes_gpc');
+    array_walk_recursive($_POST, 'stripslashes_gpc');
+    array_walk_recursive($_COOKIE, 'stripslashes_gpc');
     array_walk_recursive($_REQUEST, 'stripslashes_gpc');
 }
 
@@ -31,17 +34,10 @@
 $start_time = (float)array_sum(explode(' ',microtime()));
 
 /**
- * Creates a container for the total generated public HTML to display in browser
- * @global string $html_output the HTML
- */
-$html_output = '';
-
-/**
  * @see bootstrap.php
  */
 require_once("bootstrap.php");
 config_error_reporting();
-error_reporting(E_ALL); 
 
 /**
  * cache_file have tree result:
@@ -52,44 +48,34 @@
  */
 $html_cache_file = $aiki->Output->cache_file();
 
+
 $engineType = $aiki->site->engine();
 
-
-if ( $engineType =="aiki" ){
-	// Content is generated by old aiki engine
-	
-	require_once("libs/Engine_aiki.php");
-	$engine = new Engine_Aiki();
-	$engine->render();
-	
-	$noheaders =  isset($_REQUEST['noheaders']) ? true: false;
-
-	if ( $noheaders || $engine->widget_custom_output) {
-		$html_output = $aiki->Output->custom_output($engine);		
-	} else {   
-  
-		$html_output  = $aiki->Output->header($engine->target['css'], $engine->target['header']);
-		$html_output .= $aiki->Output->body($engine->target['body']);
-		$html_output .= $aiki->Output->end();
-									
-		$html_output = str_replace(	'[page_title]', $aiki->Output->get_title(),	$html_output);
-	} 
-
-	$html_output = $aiki->languages->L10n($html_output);
-
-} elseif  ( file_exists( "$AIKI_ROOT_DIR/libs/Engine_$engineType.php") ) {	
-	// content is generated by a engine 
+if  ( file_exists( "$AIKI_ROOT_DIR/libs/Engine_$engineType.php") ) {		
+	// load engine
     include "$AIKI_ROOT_DIR/libs/Engine_$engineType.php";
     $engineClass= "Engine_" . $engineType;       
     $engine = new $engineClass();
+
     $html_output = $engine->render($aiki->site->engine_parameters());    
+    
+    $custom_output = isset($_REQUEST["noheaders"]) || $engine->widget_custom_output;
+    // corrections for old aiki engine
+    // @TODO, someday, this will be deleted.
+    if ( $engineType == "aiki" ){
+		if ( !$custom_output ) {	
+			$html_output = str_replace(	'[page_title]', $aiki->Output->get_title(),	$html_output);
+		}
+		$html_output = $aiki->languages->L10n($html_output);	
+	}
 	
 } else {
-	// engine is no valid
+	// engine is no valid	
 	$html_output = 
 		"<p>".
 		__sprintf('Unkown engine %1$s. File /libs/Engine_%1$s.php doesn\'t exists.',$engineType).
 		"</p>";
+	$custom_output = false;	
 }
 
 // move from $aiki->Records->edit_in_place
@@ -126,10 +112,10 @@
 	}
 
 	if (!isset($_GET['no_output']))  {
-		$aiki->Plugins->doAction("output_html", $html_output);
-		// don't ucomment this stripslashes are handled in the beging of the
+		$aiki->Plugins->doAction("output_html", $html_output);		
+		// don't uncomment this. Stripslashes are handled in the begining of the
 		// script when magic_quotes_gpc are enabled
-		//$html_output = stripslashes($html_output);   
+		// $html_output = stripslashes($html_output); 
 		print $html_output;
 	}
 } // end of using tidy
@@ -143,7 +129,7 @@
 /**
  * For ending the counter to see the page load time.
  */
-if ( is_debug_on() ){
+if ( !$custom_output && is_debug_on()){
 	$end = (float)array_sum(explode(' ',microtime()));
 	$end_time = sprintf("%.4f", ($end-$start_time));
 	echo "\n <!-- Queries: ".$db->num_queries." -->\n";

_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help   : https://help.launchpad.net/ListHelp

Reply via email to