------------------------------------------------------------
revno: 1216
committer: Roger Martin <[email protected]>
branch nick: aikiframework
timestamp: Sat 2012-07-07 00:10:37 +0200
message:
corrected global nogui,custom_output,noheaders
modified:
bootstrap.php
index.php
libs/Engine_aiki.php
libs/Output.php
libs/aiki.php
libs/input.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 'bootstrap.php'
--- bootstrap.php 2012-07-04 19:40:10 +0000
+++ bootstrap.php 2012-07-06 22:10:37 +0000
@@ -48,19 +48,6 @@
/** @see AikiException.php */
require_once("$AIKI_ROOT_DIR/libs/AikiException.php");
-/**
- * @todo these should be set in some class, and are scoped wrong
- */
-if (isset($_GET['nogui'])) {
- $nogui = true;
-}
-if (isset($_GET['noheaders'])) {
- $noheaders = true;
-}
-if (isset($_GET['custom_output'])){
- $custom_output = true;
- $noheaders = true;
-}
/**
* Set the configuration option defaults.
=== modified file 'index.php'
--- index.php 2012-05-09 19:23:44 +0000
+++ index.php 2012-07-06 22:10:37 +0000
@@ -57,7 +57,7 @@
$engine = new $engineClass();
$html_output = $engine->render($aiki->site->engine_parameters());
- $custom_output = isset($_REQUEST["noheaders"]) || $engine->widget_custom_output;
+ $aiki->custom_output ( $aiki->noheaders() || $engine->widget_custom_output);
} else {
// engine is no valid
@@ -65,7 +65,7 @@
"<p>".
__sprintf('Unkown engine %1$s. File /libs/Engine_%1$s.php doesn\'t exists.',$engineType).
"</p>";
- $custom_output = false;
+ $aiki->custom_output(false);
}
@@ -109,7 +109,7 @@
/**
* For ending the counter to see the page load time.
*/
-if ( !$custom_output && is_debug_on()){
+if ( !$aiki->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";
=== modified file 'libs/Engine_aiki.php'
--- libs/Engine_aiki.php 2012-07-06 21:15:15 +0000
+++ libs/Engine_aiki.php 2012-07-06 22:10:37 +0000
@@ -97,7 +97,7 @@
// corrections for old aiki engine
// @TODO, someday, this will be deleted.
- if (isset($_REQUEST["noheaders"]) || $this->widget_custom_output) {
+ if ($aiki->noheaders() || $this->widget_custom_output) {
$html_output = str_replace('[page_title]',
$aiki->Output->get_title(),
$html_output);
@@ -113,24 +113,21 @@
* @param integer $widget_id id of a widget
* @param string $widget_group the group of the widget
- * @global aiki $aiki globl aiki object
- * @global string $custom_output
+ * @global aiki $aiki globl aiki object
* @global array $config configs the old way
*
* @todo this all need to be broken down into helper functions, too big!
*/
function parseWidget($widget) {
- global $aiki, $custom_output ;
+ global $aiki;
// fix custome_.. to custom_..
if (!isset($widget->custom_output)) {
$widget->custom_output = $widget->custome_output;
}
- //if (isset($widget->custome_header)) {
- // $widget->custom_header = $widget->custome_header;
- //}
+
if ($widget->custom_output) {
- $custom_output = true;
+ $aiki->custom_output(true);
$this->widget_custom_output = true;
}
@@ -153,7 +150,7 @@
}
}
- if ($custom_output) {
+ if ($aiki->custom_output() ) {
return $content;
} else {
$start = $end = $tag = $endTag = "";
@@ -184,8 +181,6 @@
* normal_select.
* @global aiki $aiki global object
* @global array $db global db object
- * @global bool $nogui
- * @global string $custom_output
* @global array $config global array of config options
* @return mixed
*
@@ -194,12 +189,12 @@
*/
private function createWidgetContent($widget, $normal_select=false) {
- global $aiki, $db, $nogui, $custom_output, $config;
+ global $aiki, $db, $config;
$is_inline = ( $normal_select !== false ? true : false );
$stopcaching = false;
- $permission = $aiki->membership->permission; // shortcut to access this property.
+ $permissions = $aiki->membership->permissions; // shortcut to access this property.
if ( isset($config["widget_cache"]) &&
$config["widget_cache"] &&
@@ -260,7 +255,7 @@
$widget->pagetitle = '';
}
- if ( $widget->nogui_widget && isset($nogui) ) {
+ if ( $widget->nogui_widget && $aiki->nogui() ) {
$widget->widget = $widget->nogui_widget;
}
@@ -342,7 +337,7 @@
if ($widget_select && isset($num_results) && $num_results > 0) {
$widgetContents = '';
foreach ($widget_select as $widget_value) {
- if (!$custom_output and
+ if (!$aiki->custom_output() and
(isset($config["debug"]) and $config["debug"])) {
$widgetContents .=
"\n<!-- The Beginning of a Record -->\n";
@@ -351,7 +346,7 @@
$template,
$widget_value);
- if (!$custom_output and
+ if (!$aiki->custom_output() and
( isset($config["debug"]) and $config["debug"] ) )
{
$widgetContents .=
=== modified file 'libs/Output.php'
--- libs/Output.php 2012-07-06 20:51:21 +0000
+++ libs/Output.php 2012-07-06 22:10:37 +0000
@@ -298,8 +298,8 @@
public function render_output($engine){
-
- if (isset($_REQUEST['noheaders']) || $engine->widget_custom_output) {
+ global $aiki;
+ if ($aiki->noheaders() || $engine->widget_custom_output) {
return $this->custom_output($engine);
} else {
$header = $this->get_output($engine->target["header"]);
=== modified file 'libs/aiki.php'
--- libs/aiki.php 2012-04-04 20:03:00 +0000
+++ libs/aiki.php 2012-07-06 22:10:37 +0000
@@ -30,7 +30,10 @@
class aiki {
private $pretty_url; // aiki store the pretty_url because some lib, need access / modify this url
-
+ private $nogui; // use the field widget_nogui as content
+ private $noheaders; //
+ private $custom_output; // important for output.
+
/**
* return pretty url (path of url request)
* Example www.foo.com/bar/something bar/something is the pretty url.
@@ -42,10 +45,39 @@
public function __construct() {
- $this->pretty_url = isset($_GET["pretty"]) ? $_GET["pretty"] : "";
- }
-
-
+ $this->pretty_url = isset($_GET["pretty"]) ? $_GET["pretty"] : "";
+ $this->nogui = isset($_GET['nogui']);
+ $this->custom_output= isset($_GET['custom_output']);
+ $this->noheaders = isset($_GET['noheaders']) || $this->custom_output;
+ }
+
+ /**
+ * return true if engine must generate content using nogui.
+ * Used, for example, in engine_aiki and records.php.
+ */
+ public function nogui() {
+ return $this->nogui;
+ }
+
+ /**
+ * return true if no html header must be output
+ */
+ public function noheaders() {
+ return $this->noheaders;
+ }
+
+ /**
+ * return if content is not html generated by output.php
+ */
+ public function custom_output( $set=null) {
+ if ( !is_null($set) ) {
+ $this->custom_output= $set;
+ }
+ return $this->custom_output;
+ }
+
+
+
/**
* magic method that allowed on demand libs and extensions
*
=== modified file 'libs/input.php'
--- libs/input.php 2012-01-07 19:59:33 +0000
+++ libs/input.php 2012-07-06 22:10:37 +0000
@@ -96,17 +96,17 @@
*
* @param string $type type of form handler
* @param array $post post data
- * @global membership $membership global membership instance
+
*
* @todo this function does not look complete, need to investigate
*/
public function form_handler($type, $post) {
- global $membership;
-
+ global $aiki;
+
$post = $this->validate($post);
switch ($type) {
case "login":
- $membership->login($post['username'], $post['password']);
+ $aiki->membership->login($post['username'], $post['password']);
break;
}
@@ -180,4 +180,4 @@
return $text;
}
-} // end of Input class
\ No newline at end of file
+} // end of Input class
_______________________________________________
Mailing list: https://launchpad.net/~aikiframework-devel
Post to : [email protected]
Unsubscribe : https://launchpad.net/~aikiframework-devel
More help : https://help.launchpad.net/ListHelp