diff options
author | Dries Buytaert <dries@buytaert.net> | 2003-12-04 20:53:19 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2003-12-04 20:53:19 +0000 |
commit | d45bf0f1e7614e961ed45d85a99e126def3edf64 (patch) | |
tree | a8c02a2aac5aab0e1cd0a16a908befff18b3b5c9 | |
parent | a5f76cd53ea14ec9bc73a59b6a9d06845d849818 (diff) | |
download | brdo-d45bf0f1e7614e961ed45d85a99e126def3edf64.tar.gz brdo-d45bf0f1e7614e961ed45d85a99e126def3edf64.tar.bz2 |
- Patch 185 by Ax: fixed undefined variables, synchronized xtemplate with sf, etc.
-rw-r--r-- | includes/menu.inc | 4 | ||||
-rw-r--r-- | includes/theme.inc | 2 | ||||
-rw-r--r-- | modules/block.module | 2 | ||||
-rw-r--r-- | modules/block/block.module | 2 | ||||
-rw-r--r-- | modules/comment.module | 3 | ||||
-rw-r--r-- | modules/comment/comment.module | 3 | ||||
-rw-r--r-- | modules/queue.module | 4 | ||||
-rw-r--r-- | modules/statistics.module | 2 | ||||
-rw-r--r-- | modules/statistics/statistics.module | 2 | ||||
-rw-r--r-- | modules/user.module | 8 | ||||
-rw-r--r-- | modules/user/user.module | 8 | ||||
-rw-r--r-- | themes/xtemplate/xtemplate.inc | 88 |
12 files changed, 37 insertions, 91 deletions
diff --git a/includes/menu.inc b/includes/menu.inc index 12c4132e4..55bece1f3 100644 --- a/includes/menu.inc +++ b/includes/menu.inc @@ -137,13 +137,13 @@ function menu_in_active_trail($path) { function menu_tree($parent = "", $hidden = 0) { global $_list; static $trail; + $output = ""; if (empty($trail)) { $trail = menu_get_trail($_GET["q"]); } - if ($_list[$parent]["children"]) { - $output = ""; + if (isset($_list[$parent]) && $_list[$parent]["children"]) { usort($_list[$parent]["children"], "_menu_sort"); foreach ($_list[$parent]["children"] as $item) { diff --git a/includes/theme.inc b/includes/theme.inc index cbd632475..0a9fb1074 100644 --- a/includes/theme.inc +++ b/includes/theme.inc @@ -403,7 +403,7 @@ function theme_mark() { @return a string containing the \a list output. **/ function theme_item_list($items = array(), $title = NULL) { - $output .= "<div class=\"item-list\">"; + $output = "<div class=\"item-list\">"; if (isset($title)) { $output .= "<h3>$title</h3>"; } diff --git a/modules/block.module b/modules/block.module index 130f4e325..dc29b2c8b 100644 --- a/modules/block.module +++ b/modules/block.module @@ -384,7 +384,7 @@ function block_list($region) { if (!($block['throttle'] && (module_invoke("throttle", "status") >= 5))) { $block = array_merge($block, module_invoke($block['module'], 'block', 'view', $block['delta'])); } - if ($block['content']) { + if (isset($block['content']) && $block['content']) { $blocks[$region]["$block[module]_$block[delta]"] = (object) $block; } } diff --git a/modules/block/block.module b/modules/block/block.module index 130f4e325..dc29b2c8b 100644 --- a/modules/block/block.module +++ b/modules/block/block.module @@ -384,7 +384,7 @@ function block_list($region) { if (!($block['throttle'] && (module_invoke("throttle", "status") >= 5))) { $block = array_merge($block, module_invoke($block['module'], 'block', 'view', $block['delta'])); } - if ($block['content']) { + if (isset($block['content']) && $block['content']) { $blocks[$region]["$block[module]_$block[delta]"] = (object) $block; } } diff --git a/modules/comment.module b/modules/comment.module index 14a6223fe..6e7ab5471 100644 --- a/modules/comment.module +++ b/modules/comment.module @@ -777,6 +777,7 @@ function comment_perm() { } function comment_link($type, $node = 0, $main = 0) { + $links = array(); if ($type == "node" && $node->comment) { @@ -849,7 +850,7 @@ function comment_link($type, $node = 0, $main = 0) { menu("comment", t("comments"), "comment_page", 0, 1); } - return $links ? $links : array(); + return $links; } function comment_page() { diff --git a/modules/comment/comment.module b/modules/comment/comment.module index 14a6223fe..6e7ab5471 100644 --- a/modules/comment/comment.module +++ b/modules/comment/comment.module @@ -777,6 +777,7 @@ function comment_perm() { } function comment_link($type, $node = 0, $main = 0) { + $links = array(); if ($type == "node" && $node->comment) { @@ -849,7 +850,7 @@ function comment_link($type, $node = 0, $main = 0) { menu("comment", t("comments"), "comment_page", 0, 1); } - return $links ? $links : array(); + return $links; } function comment_page() { diff --git a/modules/queue.module b/modules/queue.module index 7c118c046..40f619660 100644 --- a/modules/queue.module +++ b/modules/queue.module @@ -33,13 +33,15 @@ function queue_perm() { } function queue_link($type) { + $links = array(); + if ($type == "system") { if (user_access("access submission queue")) { menu("queue", t("submission queue"), "queue_page", 1); } } - return $links ? $links : array(); + return $links; } function queue_count() { diff --git a/modules/statistics.module b/modules/statistics.module index fd7d1ed96..2579261d4 100644 --- a/modules/statistics.module +++ b/modules/statistics.module @@ -85,7 +85,7 @@ function statistics_link($type, $node = 0, $main = 0) { } if (user_access("access content")) { - menu("statistics", t("view most popular content"), statistics_page, 0, 1); + menu("statistics", t("view most popular content"), "statistics_page", 0, 1); } } diff --git a/modules/statistics/statistics.module b/modules/statistics/statistics.module index fd7d1ed96..2579261d4 100644 --- a/modules/statistics/statistics.module +++ b/modules/statistics/statistics.module @@ -85,7 +85,7 @@ function statistics_link($type, $node = 0, $main = 0) { } if (user_access("access content")) { - menu("statistics", t("view most popular content"), statistics_page, 0, 1); + menu("statistics", t("view most popular content"), "statistics_page", 0, 1); } } diff --git a/modules/user.module b/modules/user.module index 93d6d9570..2c2d23537 100644 --- a/modules/user.module +++ b/modules/user.module @@ -306,8 +306,11 @@ function user_block($op = "list", $delta = 0) { return $blocks; } else { + $block = array(); + switch ($delta) { case 0: + if (!$user->uid) { /* ** For usability's sake, avoid showing two login forms on one @@ -366,7 +369,6 @@ function user_block($op = "list", $delta = 0) { $block["subject"] = $user->uid ? $user->name : t("Navigation"); $block["content"] = "<div class=\"menu\">". $menu ."</div>"; } - return $block; case 2: if (user_access("access content")) { @@ -415,9 +417,9 @@ function user_block($op = "list", $delta = 0) { } } } + $block["subject"] = t("Who's online"); + $block["content"] = $output; } - $block["subject"] = t("Who's online"); - $block["content"] = $output; return $block; } } diff --git a/modules/user/user.module b/modules/user/user.module index 93d6d9570..2c2d23537 100644 --- a/modules/user/user.module +++ b/modules/user/user.module @@ -306,8 +306,11 @@ function user_block($op = "list", $delta = 0) { return $blocks; } else { + $block = array(); + switch ($delta) { case 0: + if (!$user->uid) { /* ** For usability's sake, avoid showing two login forms on one @@ -366,7 +369,6 @@ function user_block($op = "list", $delta = 0) { $block["subject"] = $user->uid ? $user->name : t("Navigation"); $block["content"] = "<div class=\"menu\">". $menu ."</div>"; } - return $block; case 2: if (user_access("access content")) { @@ -415,9 +417,9 @@ function user_block($op = "list", $delta = 0) { } } } + $block["subject"] = t("Who's online"); + $block["content"] = $output; } - $block["subject"] = t("Who's online"); - $block["content"] = $output; return $block; } } diff --git a/themes/xtemplate/xtemplate.inc b/themes/xtemplate/xtemplate.inc index cc31e9a00..e77836e07 100644 --- a/themes/xtemplate/xtemplate.inc +++ b/themes/xtemplate/xtemplate.inc @@ -39,16 +39,16 @@ class XTemplate { /***[ variables ]***********************************************************/ -var $filecontents=""; /* raw contents of template file */ +var $filecontents=""; /* raw contents of template file */ var $blocks=array(); /* unparsed blocks */ -var $parsed_blocks=array(); /* parsed blocks */ +var $parsed_blocks=array(); /* parsed blocks */ var $preparsed_blocks=array(); /* preparsed blocks, for file includes */ -var $block_parse_order=array(); /* block parsing order for recursive parsing (sometimes reverse:) */ +var $block_parse_order=array(); /* block parsing order for recursive parsing (sometimes reverse:) */ var $sub_blocks=array(); /* store sub-block names for fast resetting */ var $VARS=array(); /* variables array */ var $FILEVARS=array(); /* file variables array */ var $filevar_parent=array(); /* filevars' parent block */ -var $filecache=array(); /* file caching */ +var $filecache=array(); /* file caching */ var $tpldir=""; /* location of template files */ var $FILES=null; /* file names lookup table */ @@ -56,15 +56,15 @@ var $FILES=null; /* file names lookup table */ var $file_delim="/\{FILE\s*\"([^\"]+)\"\s*\}/m"; /* regexp for file includes */ var $filevar_delim="/\{FILE\s*\{([A-Za-z0-9\._]+?)\}\s*\}/m"; /* regexp for file includes */ var $filevar_delim_nl="/^\s*\{FILE\s*\{([A-Za-z0-9\._]+?)\}\s*\}\s*\n/m"; /* regexp for file includes w/ newlines */ -var $block_start_delim="<!-- "; /* block start delimiter */ -var $block_end_delim="-->"; /* block end delimiter */ -var $block_start_word="BEGIN:"; /* block start word */ -var $block_end_word="END:"; /* block end word */ +var $block_start_delim="<!-- "; /* block start delimiter */ +var $block_end_delim="-->"; /* block end delimiter */ +var $block_start_word="BEGIN:"; /* block start word */ +var $block_end_word="END:"; /* block end word */ /* this makes the delimiters look like: <!-- BEGIN: block_name --> if you use my syntax. */ -var $NULL_STRING=array(""=>""); /* null string for unassigned vars */ -var $NULL_BLOCK=array(""=>""); /* null string for unassigned blocks */ +var $NULL_STRING=array(""=>""); /* null string for unassigned vars */ +var $NULL_BLOCK=array(""=>""); /* null string for unassigned blocks */ var $mainblock="main"; var $ERROR=""; var $AUTORESET=1; /* auto-reset sub blocks */ @@ -184,6 +184,7 @@ function parse ($bname) { $copy=str_replace("\{$v}","$var",$copy); } } + if (empty($this->parsed_blocks[$bname])) $this->parsed_blocks[$bname] = null; // eliminates incremental assign error, when using E_ALL error reporting $this->parsed_blocks[$bname].=$copy; /* reset sub-blocks */ @@ -367,6 +368,7 @@ function maketree($con,$parentblock="") { $block_names[++$level]=$res[0][2]; /* add one level - array("main","table","row")*/ $cur_block_name=implode(".",$block_names); /* make block name (main.table.row) */ $this->block_parse_order[]=$cur_block_name; /* build block parsing order (reverse) */ + if (empty($blocks[$cur_block_name])) $blocks[$cur_block_name] = null; // eliminates incremental assign error, when using E_ALL error reporting $blocks[$cur_block_name].=$res[0][3]; /* add contents */ $blocks[$parent_name].="{_BLOCK_.$cur_block_name}"; /* add {_BLOCK_.blockname} string to parent block */ $this->sub_blocks[$parent_name][]=$cur_block_name; /* store sub block names for autoresetting and recursive parsing */ @@ -379,6 +381,7 @@ function maketree($con,$parentblock="") { } else { /* no block delimiters found */ if ($k) $blocks[implode(".",$block_names)].=$this->block_start_delim; + if (empty($blocks[implode(".",$block_names)])) $blocks[implode(".",$block_names)] = null; // eliminates incremental assign error, when using E_ALL error reporting $blocks[implode(".",$block_names)].=$v; } } @@ -474,69 +477,4 @@ function r_getfile($file) { } /* end of XTemplate class. */ - -/* - $Log$ - Revision 1.3 2003/04/04 06:08:53 dries - Patch by Ax: - - - Bugfix: xtemplate.inc removed "$xx" from content. - - - Improvement: changed a high ascii char to low ascii to be able to debug - xtemplate.inc. - - Revision 1.2 2003/02/01 19:54:19 dries - - Patch by Ax: - - - Bad usage of css ID's: they may be used for a single element only, - but were used as #node, #block, which can occur multiple times in a - single page. - - - Moved HTML from theme to template - thats what templates are all - about! - - - Added support for head() hook - - - Added support for diffentiating between boxes and blocks. - - - Typo: secundary -> secondary - - Revision 1.1 2003/01/20 21:00:31 dries - - - Added a template driven theme. - - Revision 1.1 2002/12/10 23:11:59 ax - [argh - cvs @*#! didn't add any files with the last commit ... now, then (we should really give subversion a try: "Directories, renames, and file meta-data are versioned"] - - - renamed from "ax" to "XTemplate_Tableless" to make people looking for ... this find it - - updated to CVS - - fixed some styles - - em/%'ized stylesheet (relative sizes) and "chaptered" into sections - - added 3 screenshots - - Revision 1.2 2001/09/19 14:11:25 cranx - fixed a bug in the whitespace-stripping block variable interpolating regexp. - - Revision 1.1 2001/07/11 10:42:39 cranx - added: - - filename substitution, no nested arrays for the moment, sorry - (including happens when assigning, so assign filevar in the outside blocks first!) - - Revision 1.5 2001/07/11 10:39:08 cranx - added: - - we can now specify base dir - - array_loop() - - trigger_error in set_error - - modified: - - newline bugs fixed (for XML) - - in out(): content-length header added - - whiles changed to foreach - - from now on, the class is php4 only :P - - -*/ - - ?> |