From: <var...@us...> - 2014-12-02 15:51:32
|
Revision: 9406 http://sourceforge.net/p/phpwiki/code/9406 Author: vargenau Date: 2014-12-02 15:51:24 +0000 (Tue, 02 Dec 2014) Log Message: ----------- Test limit argument is numeric Modified Paths: -------------- trunk/lib/plugin/AllPages.php trunk/lib/plugin/AllUsers.php trunk/lib/plugin/BackLinks.php trunk/lib/plugin/IncludePages.php trunk/lib/plugin/LinkDatabase.php trunk/lib/plugin/ListSubpages.php trunk/lib/plugin/MostPopular.php trunk/lib/plugin/OrphanedPages.php trunk/lib/plugin/PageHistory.php trunk/lib/plugin/PopularNearby.php trunk/lib/plugin/TitleSearch.php trunk/lib/plugin/WantedPages.php trunk/lib/plugin/WantedPagesOld.php Modified: trunk/lib/plugin/AllPages.php =================================================================== --- trunk/lib/plugin/AllPages.php 2014-12-02 15:09:06 UTC (rev 9405) +++ trunk/lib/plugin/AllPages.php 2014-12-02 15:51:24 UTC (rev 9406) @@ -64,6 +64,11 @@ { $args = $this->getArgs($argstr, $request); + if (isset($args['limit']) && !is_numeric($args['limit'])) { + return HTML::p(array('class' => "error"), + _("Illegal 'limit' argument: must be numeric")); + } + if (empty($args['sortby'])) { $args['sortby'] = 'pagename'; } Modified: trunk/lib/plugin/AllUsers.php =================================================================== --- trunk/lib/plugin/AllUsers.php 2014-12-02 15:09:06 UTC (rev 9405) +++ trunk/lib/plugin/AllUsers.php 2014-12-02 15:51:24 UTC (rev 9406) @@ -68,6 +68,11 @@ { $args = $this->getArgs($argstr, $request); + if (isset($args['limit']) && !is_numeric($args['limit'])) { + return HTML::p(array('class' => "error"), + _("Illegal 'limit' argument: must be numeric")); + } + extract($args); $group = $request->getGroup(); Modified: trunk/lib/plugin/BackLinks.php =================================================================== --- trunk/lib/plugin/BackLinks.php 2014-12-02 15:09:06 UTC (rev 9405) +++ trunk/lib/plugin/BackLinks.php 2014-12-02 15:51:24 UTC (rev 9406) @@ -59,6 +59,11 @@ { $args = $this->getArgs($argstr, $request); + if (isset($args['limit']) && !is_numeric($args['limit'])) { + return HTML::p(array('class' => "error"), + _("Illegal 'limit' argument: must be numeric")); + } + extract($args); if (empty($page) and $page != '0') { return ''; Modified: trunk/lib/plugin/IncludePages.php =================================================================== --- trunk/lib/plugin/IncludePages.php 2014-12-02 15:09:06 UTC (rev 9405) +++ trunk/lib/plugin/IncludePages.php 2014-12-02 15:51:24 UTC (rev 9406) @@ -54,6 +54,12 @@ function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); + + if (isset($args['limit']) && !is_numeric($args['limit'])) { + return HTML::p(array('class' => "error"), + _("Illegal 'limit' argument: must be numeric")); + } + $html = HTML(); if (empty($args['pages'])) { return $html; Modified: trunk/lib/plugin/LinkDatabase.php =================================================================== --- trunk/lib/plugin/LinkDatabase.php 2014-12-02 15:09:06 UTC (rev 9405) +++ trunk/lib/plugin/LinkDatabase.php 2014-12-02 15:51:24 UTC (rev 9406) @@ -101,6 +101,11 @@ global $WikiTheme; $args = $this->getArgs($argstr, $request); + if (isset($args['limit']) && !is_numeric($args['limit'])) { + return HTML::p(array('class' => "error"), + _("Illegal 'limit' argument: must be numeric")); + } + $caption = _("All pages with all links in this wiki (%d total):"); if (!empty($args['owner'])) { Modified: trunk/lib/plugin/ListSubpages.php =================================================================== --- trunk/lib/plugin/ListSubpages.php 2014-12-02 15:09:06 UTC (rev 9405) +++ trunk/lib/plugin/ListSubpages.php 2014-12-02 15:51:24 UTC (rev 9406) @@ -63,6 +63,12 @@ function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); + + if (isset($args['limit']) && !is_numeric($args['limit'])) { + return HTML::p(array('class' => "error"), + _("Illegal 'limit' argument: must be numeric")); + } + if ($args['basepage']) $pagename = $args['basepage']; else Modified: trunk/lib/plugin/MostPopular.php =================================================================== --- trunk/lib/plugin/MostPopular.php 2014-12-02 15:09:06 UTC (rev 9405) +++ trunk/lib/plugin/MostPopular.php 2014-12-02 15:51:24 UTC (rev 9406) @@ -61,12 +61,18 @@ function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); + extract($args); + + if (isset($limit) && !is_numeric($limit)) { + return HTML::p(array('class' => "error"), + _("Illegal 'limit' argument: must be numeric")); + } if (strstr($sortby, 'mtime')) { - trigger_error(_("sortby=mtime not supported with MostPopular"), - E_USER_WARNING); - $sortby = ''; + return HTML::p(array('class' => "error"), + _("sortby=mtime not supported with MostPopular")); } + $columns = $info ? explode(",", $info) : array(); array_unshift($columns, 'hits'); @@ -77,7 +83,6 @@ } else { $args['count'] = $request->getArg('count'); } - //$dbi->touch(); $pages = $dbi->mostPopular($limit, $sortby); $pagelist = new PageList($columns, $exclude, $args); while ($page = $pages->next()) { Modified: trunk/lib/plugin/OrphanedPages.php =================================================================== --- trunk/lib/plugin/OrphanedPages.php 2014-12-02 15:09:06 UTC (rev 9405) +++ trunk/lib/plugin/OrphanedPages.php 2014-12-02 15:51:24 UTC (rev 9406) @@ -61,6 +61,12 @@ function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); + + if (isset($args['limit']) && !is_numeric($args['limit'])) { + return HTML::p(array('class' => "error"), + _("Illegal 'limit' argument: must be numeric")); + } + extract($args); // There's probably a more efficient way to do this (eg a Modified: trunk/lib/plugin/PageHistory.php =================================================================== --- trunk/lib/plugin/PageHistory.php 2014-12-02 15:09:06 UTC (rev 9405) +++ trunk/lib/plugin/PageHistory.php 2014-12-02 15:51:24 UTC (rev 9406) @@ -340,6 +340,12 @@ function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); + + if (isset($args['limit']) && !is_numeric($args['limit'])) { + return HTML::div(array('class' => "error"), + _("Illegal 'limit' argument: must be numeric")); + } + $pagename = $args['page']; if (empty($pagename)) return $this->makeForm("", $request); Modified: trunk/lib/plugin/PopularNearby.php =================================================================== --- trunk/lib/plugin/PopularNearby.php 2014-12-02 15:09:06 UTC (rev 9405) +++ trunk/lib/plugin/PopularNearby.php 2014-12-02 15:51:24 UTC (rev 9406) @@ -64,6 +64,12 @@ function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); + + if (isset($args['limit']) && !is_numeric($args['limit'])) { + return HTML::div(array('class' => "error"), + _("Illegal 'limit' argument: must be numeric")); + } + extract($args); $header = ''; $page = $dbi->getPage($pagename); Modified: trunk/lib/plugin/TitleSearch.php =================================================================== --- trunk/lib/plugin/TitleSearch.php 2014-12-02 15:09:06 UTC (rev 9405) +++ trunk/lib/plugin/TitleSearch.php 2014-12-02 15:51:24 UTC (rev 9406) @@ -78,6 +78,11 @@ { $args = $this->getArgs($argstr, $request); + if (isset($args['limit']) && !is_numeric($args['limit'])) { + return HTML::p(array('class' => "error"), + _("Illegal 'limit' argument: must be numeric")); + } + if (empty($args['s'])) { return HTML::p(array('class' => 'warning'), _("You must enter a search term.")); Modified: trunk/lib/plugin/WantedPages.php =================================================================== --- trunk/lib/plugin/WantedPages.php 2014-12-02 15:09:06 UTC (rev 9405) +++ trunk/lib/plugin/WantedPages.php 2014-12-02 15:51:24 UTC (rev 9406) @@ -68,10 +68,17 @@ function run($dbi, $argstr, &$request, $basepage) { $args = $this->getArgs($argstr, $request); + + if (isset($args['limit']) && !is_numeric($args['limit'])) { + return HTML::p(array('class' => "error"), + _("Illegal 'limit' argument: must be numeric")); + } + if (!empty($args['exclude_from'])) $args['exclude_from'] = is_string($args['exclude_from']) ? explodePageList($args['exclude_from']) : $args['exclude_from']; // <! plugin-list !> + extract($args); if ($page == _("WantedPages")) $page = ""; Modified: trunk/lib/plugin/WantedPagesOld.php =================================================================== --- trunk/lib/plugin/WantedPagesOld.php 2014-12-02 15:09:06 UTC (rev 9405) +++ trunk/lib/plugin/WantedPagesOld.php 2014-12-02 15:51:24 UTC (rev 9406) @@ -61,6 +61,11 @@ { extract($this->getArgs($argstr, $request)); + if (isset($limit) && !is_numeric($limit)) { + return HTML::p(array('class' => "error"), + _("Illegal 'limit' argument: must be numeric")); + } + if ($exclude) { if (!is_array($exclude)) $exclude = explode(',', $exclude); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |