From: <var...@us...> - 2009-10-06 14:13:56
|
Revision: 7190 http://phpwiki.svn.sourceforge.net/phpwiki/?rev=7190&view=rev Author: vargenau Date: 2009-10-06 14:13:48 +0000 (Tue, 06 Oct 2009) Log Message: ----------- Allow "debug" argument only if DEBUG is true Modified Paths: -------------- trunk/lib/plugin/AllPages.php trunk/lib/plugin/AllUsers.php trunk/lib/plugin/ExternalSearch.php trunk/lib/plugin/FuzzyPages.php trunk/lib/plugin/NewPagesPerUser.php Modified: trunk/lib/plugin/AllPages.php =================================================================== --- trunk/lib/plugin/AllPages.php 2009-10-06 14:06:35 UTC (rev 7189) +++ trunk/lib/plugin/AllPages.php 2009-10-06 14:13:48 UTC (rev 7190) @@ -67,8 +67,9 @@ $args = $this->getArgs($argstr, $request); $pages = false; // Todo: extend given _GET args - if ($args['debug']) + if (defined('DEBUG') && DEBUG && $args['debug']) { $timer = new DebugTimer; + } $caption = _("All pages in this wiki ({total} total):"); if ( !empty($args['userpages']) ) { @@ -132,7 +133,7 @@ else $pagelist->addPages( $dbi->getAllPages($args['include_empty'], $args['sortby'], $args['limit']) ); - if ($args['debug']) { + if (defined('DEBUG') && DEBUG && $args['debug']) { return HTML($pagelist, HTML::p(fmt("Elapsed time: %s s", $timer->getStats()))); } else { Modified: trunk/lib/plugin/AllUsers.php =================================================================== --- trunk/lib/plugin/AllUsers.php 2009-10-06 14:06:35 UTC (rev 7189) +++ trunk/lib/plugin/AllUsers.php 2009-10-06 14:13:48 UTC (rev 7190) @@ -67,14 +67,15 @@ function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); extract($args); - if ($debug) + if (defined('DEBUG') && DEBUG && $debug) { $timer = new DebugTimer; + } $group = $request->getGroup(); if (method_exists($group,'_allUsers')) { $allusers = $group->_allUsers(); } else { - $allusers = array(); + $allusers = array(); } $args['count'] = count($allusers); // deleted pages show up as version 0. @@ -88,7 +89,7 @@ $pagelist->addPageList($allusers); } else { for ($i=$offset; $i < $offset + $pagesize - 1; $i++) { - if ($i >= $args['count']) break; + if ($i >= $args['count']) break; $pagelist->addPage(trim($allusers[$i])); } } @@ -100,7 +101,7 @@ } */ - if ($debug) { + if (defined('DEBUG') && DEBUG and $debug) { return HTML($pagelist, HTML::p(fmt("Elapsed time: %s s", $timer->getStats()))); } else { Modified: trunk/lib/plugin/ExternalSearch.php =================================================================== --- trunk/lib/plugin/ExternalSearch.php 2009-10-06 14:06:35 UTC (rev 7189) +++ trunk/lib/plugin/ExternalSearch.php 2009-10-06 14:13:48 UTC (rev 7190) @@ -93,7 +93,7 @@ $this->_url = sprintf($this->_url, $s); } else $this->_url .= $s; - if ($debug) { + if (defined('DEBUG') && DEBUG && $debug) { trigger_error("redirect url: " . $this->_url); } else { $request->redirect($this->_url); //no return! Modified: trunk/lib/plugin/FuzzyPages.php =================================================================== --- trunk/lib/plugin/FuzzyPages.php 2009-10-06 14:06:35 UTC (rev 7189) +++ trunk/lib/plugin/FuzzyPages.php 2009-10-06 14:13:48 UTC (rev 7190) @@ -105,8 +105,10 @@ function addTableHead(&$table) { $row = HTML::tr(HTML::th(_("Name")), HTML::th(array('align' => 'right'), _("Score"))); - if ($this->debug) + + if (defined('DEBUG') && DEBUG && $this->debug) { $this->_pushDebugHeadingTDinto($row); + } $table->pushContent(HTML::thead($row)); } @@ -124,8 +126,9 @@ HTML::td(array('align' => 'right'), round($score))); - if ($this->debug) + if (defined('DEBUG') && DEBUG && $this->debug) { $this->_pushDebugTDinto($row, $found_pagename); + } $tbody->pushContent($row); } @@ -151,8 +154,11 @@ if (empty($s)) { return HTML::div(array('class' => "error"), "Please provide 's' argument to the plugin."); } - $this->debug = $debug; + if (defined('DEBUG') && DEBUG) { + $this->debug = $debug; + } + $this->_searchterm = $s; $this->_list = array(); @@ -161,8 +167,6 @@ return $this->formatTable($this->_list, $dbi); } - - function _pushDebugHeadingTDinto(&$row) { $row->pushContent(HTML::td(_("Spelling Score")), HTML::td(_("Sound Score")), Modified: trunk/lib/plugin/NewPagesPerUser.php =================================================================== --- trunk/lib/plugin/NewPagesPerUser.php 2009-10-06 14:06:35 UTC (rev 7189) +++ trunk/lib/plugin/NewPagesPerUser.php 2009-10-06 14:13:48 UTC (rev 7190) @@ -62,7 +62,9 @@ $date = $rev->get('mtime'); //$author = $rev->get('author_id'); $author = $page->getOwner(); - if ($debug) echo "<i>$pagename, ",strftime("%Y-%m-%d %h:%m:%s", $date),", $author</i><br />\n"; + if (defined('DEBUG') && DEBUG && $debug) { + echo "<i>$pagename, ",strftime("%Y-%m-%d %h:%m:%s", $date),", $author</i><br />\n"; + } if ($userid and (!preg_match("/".$userid."/", $author))) continue; if ($since and $date < $since) continue; if ($until and $date > $until) continue; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |