|
From: <var...@us...> - 2021-09-14 16:59:21
|
Revision: 10554
http://sourceforge.net/p/phpwiki/code/10554
Author: vargenau
Date: 2021-09-14 16:59:19 +0000 (Tue, 14 Sep 2021)
Log Message:
-----------
Better check boolean arguments, default values might already be booleans, not strings
Modified Paths:
--------------
trunk/lib/plugin/AddComment.php
trunk/lib/plugin/AllPages.php
trunk/lib/plugin/AllUsers.php
trunk/lib/plugin/AppendText.php
trunk/lib/plugin/AtomFeed.php
trunk/lib/plugin/AuthorHistory.php
trunk/lib/plugin/BackLinks.php
trunk/lib/plugin/CreatePage.php
trunk/lib/plugin/CreateToc.php
trunk/lib/plugin/DebugBackendInfo.php
trunk/lib/plugin/ExternalSearch.php
trunk/lib/plugin/FullTextSearch.php
trunk/lib/plugin/IncludePage.php
trunk/lib/plugin/LinkDatabase.php
trunk/lib/plugin/LinkSearch.php
trunk/lib/plugin/ListSubpages.php
trunk/lib/plugin/MostPopular.php
trunk/lib/plugin/NewPagesPerUser.php
trunk/lib/plugin/OrphanedPages.php
trunk/lib/plugin/PopularNearby.php
trunk/lib/plugin/RandomPage.php
trunk/lib/plugin/RecentReferrers.php
trunk/lib/plugin/RssFeed.php
trunk/lib/plugin/SearchHighlight.php
trunk/lib/plugin/SemanticRelations.php
trunk/lib/plugin/SemanticSearch.php
trunk/lib/plugin/SemanticSearchAdvanced.php
trunk/lib/plugin/TitleSearch.php
trunk/lib/plugin/UserRatings.php
trunk/lib/plugin/Video.php
trunk/lib/plugin/WantedPages.php
trunk/lib/plugin/WikiForum.php
Modified: trunk/lib/plugin/AddComment.php
===================================================================
--- trunk/lib/plugin/AddComment.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/AddComment.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -82,21 +82,25 @@
}
$jshide = $args['jshide'];
- if (($jshide == '0') || ($jshide == 'false')) {
- $jshide = false;
- } elseif (($jshide == '1') || ($jshide == 'true')) {
- $jshide = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "jshide"));
+ if (!is_bool($jshide)) {
+ if (($jshide == '0') || ($jshide == 'false')) {
+ $jshide = false;
+ } elseif (($jshide == '1') || ($jshide == 'true')) {
+ $jshide = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "jshide"));
+ }
}
$noheader = $args['noheader'];
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
// Get our form args.
Modified: trunk/lib/plugin/AllPages.php
===================================================================
--- trunk/lib/plugin/AllPages.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/AllPages.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -68,30 +68,36 @@
$args = $this->getArgs($argstr, $request);
$include_empty = $args['include_empty'];
- if (($include_empty == '0') || ($include_empty == 'false')) {
- $include_empty = false;
- } elseif (($include_empty == '1') || ($include_empty == 'true')) {
- $include_empty = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "include_empty"));
+ if (!is_bool($include_empty)) {
+ if (($include_empty == '0') || ($include_empty == 'false')) {
+ $include_empty = false;
+ } elseif (($include_empty == '1') || ($include_empty == 'true')) {
+ $include_empty = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "include_empty"));
+ }
}
$noheader = $args['noheader'];
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
$userpages = $args['userpages'];
- if (($userpages == '0') || ($userpages == 'false')) {
- $userpages = false;
- } elseif (($userpages == '1') || ($userpages == 'true')) {
- $userpages = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "userpages"));
+ if (!is_bool($userpages)) {
+ if (($userpages == '0') || ($userpages == 'false')) {
+ $userpages = false;
+ } elseif (($userpages == '1') || ($userpages == 'true')) {
+ $userpages = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "userpages"));
+ }
}
if (isset($args['limit']) && !is_limit($args['limit'])) {
Modified: trunk/lib/plugin/AllUsers.php
===================================================================
--- trunk/lib/plugin/AllUsers.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/AllUsers.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -78,12 +78,14 @@
extract($args);
- if (($include_empty == '0') || ($include_empty == 'false')) {
- $include_empty = false;
- } elseif (($include_empty == '1') || ($include_empty == 'true')) {
- $include_empty = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "include_empty"));
+ if (!is_bool($include_empty)) {
+ if (($include_empty == '0') || ($include_empty == 'false')) {
+ $include_empty = false;
+ } elseif (($include_empty == '1') || ($include_empty == 'true')) {
+ $include_empty = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "include_empty"));
+ }
}
$group = $request->getGroup();
Modified: trunk/lib/plugin/AppendText.php
===================================================================
--- trunk/lib/plugin/AppendText.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/AppendText.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -72,12 +72,14 @@
$args = $this->getArgs($argstr, $request);
$redirect = $args['redirect'];
- if (($redirect == '0') || ($redirect == 'false')) {
- $redirect = false;
- } elseif (($redirect == '1') || ($redirect == 'true')) {
- $redirect = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "redirect"));
+ if (!is_bool($redirect)) {
+ if (($redirect == '0') || ($redirect == 'false')) {
+ $redirect = false;
+ } elseif (($redirect == '1') || ($redirect == 'true')) {
+ $redirect = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "redirect"));
+ }
}
if (!$args['pages'] or !$request->isPost()) {
Modified: trunk/lib/plugin/AtomFeed.php
===================================================================
--- trunk/lib/plugin/AtomFeed.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/AtomFeed.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -59,12 +59,14 @@
{
extract($this->getArgs($argstr, $request));
- if (($titleonly == '0') || ($titleonly == 'false')) {
- $titleonly = false;
- } elseif (($titleonly == '1') || ($titleonly == 'true')) {
- $titleonly = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "titleonly"));
+ if (!is_bool($titleonly)) {
+ if (($titleonly == '0') || ($titleonly == 'false')) {
+ $titleonly = false;
+ } elseif (($titleonly == '1') || ($titleonly == 'true')) {
+ $titleonly = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "titleonly"));
+ }
}
$parser = new AtomParser();
Modified: trunk/lib/plugin/AuthorHistory.php
===================================================================
--- trunk/lib/plugin/AuthorHistory.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/AuthorHistory.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -90,28 +90,34 @@
$this->_args = $this->getArgs($argstr, $request);
extract($this->_args);
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
- if (($includeminor == '0') || ($includeminor == 'false')) {
- $includeminor = false;
- } elseif (($includeminor == '1') || ($includeminor == 'true')) {
- $includeminor = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "includeminor"));
+ if (!is_bool($includeminor)) {
+ if (($includeminor == '0') || ($includeminor == 'false')) {
+ $includeminor = false;
+ } elseif (($includeminor == '1') || ($includeminor == 'true')) {
+ $includeminor = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "includeminor"));
+ }
}
- if (($includedeleted == '0') || ($includedeleted == 'false')) {
- $includedeleted = false;
- } elseif (($includedeleted == '1') || ($includedeleted == 'true')) {
- $includedeleted = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "includedeleted"));
+ if (!is_bool($includedeleted)) {
+ if (($includedeleted == '0') || ($includedeleted == 'false')) {
+ $includedeleted = false;
+ } elseif (($includedeleted == '1') || ($includedeleted == 'true')) {
+ $includedeleted = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "includedeleted"));
+ }
}
if (!$author) { // user not signed in and no author specified
Modified: trunk/lib/plugin/BackLinks.php
===================================================================
--- trunk/lib/plugin/BackLinks.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/BackLinks.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -68,20 +68,24 @@
extract($args);
- if (($include_self == '0') || ($include_self == 'false')) {
- $include_self = false;
- } elseif (($include_self == '1') || ($include_self == 'true')) {
- $include_self = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "include_self"));
+ if (!is_bool($include_self)) {
+ if (($include_self == '0') || ($include_self == 'false')) {
+ $include_self = false;
+ } elseif (($include_self == '1') || ($include_self == 'true')) {
+ $include_self = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "include_self"));
+ }
}
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
if (empty($page) and $page != '0') {
Modified: trunk/lib/plugin/CreatePage.php
===================================================================
--- trunk/lib/plugin/CreatePage.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/CreatePage.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -66,12 +66,14 @@
{
extract($this->getArgs($argstr, $request));
- if (($overwrite == '0') || ($overwrite == 'false')) {
- $overwrite = false;
- } elseif (($overwrite == '1') || ($overwrite == 'true')) {
- $overwrite = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "overwrite"));
+ if (!is_bool($overwrite)) {
+ if (($overwrite == '0') || ($overwrite == 'false')) {
+ $overwrite = false;
+ } elseif (($overwrite == '1') || ($overwrite == 'true')) {
+ $overwrite = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "overwrite"));
+ }
}
// Prevent spaces and slashes at the start and end of a page name
Modified: trunk/lib/plugin/CreateToc.php
===================================================================
--- trunk/lib/plugin/CreateToc.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/CreateToc.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -409,52 +409,64 @@
return $this->error(sprintf(_("A required argument “%s” is missing."), 'pagename'));
}
- if (($extracollapse == '0') || ($extracollapse == 'false')) {
- $extracollapse = false;
- } elseif (($extracollapse == '1') || ($extracollapse == 'true')) {
- $extracollapse = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "extracollapse"));
+ if (!is_bool($extracollapse)) {
+ if (($extracollapse == '0') || ($extracollapse == 'false')) {
+ $extracollapse = false;
+ } elseif (($extracollapse == '1') || ($extracollapse == 'true')) {
+ $extracollapse = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "extracollapse"));
+ }
}
- if (($jshide == '0') || ($jshide == 'false')) {
- $jshide = false;
- } elseif (($jshide == '1') || ($jshide == 'true')) {
- $jshide = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "jshide"));
+ if (!is_bool($jshide)) {
+ if (($jshide == '0') || ($jshide == 'false')) {
+ $jshide = false;
+ } elseif (($jshide == '1') || ($jshide == 'true')) {
+ $jshide = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "jshide"));
+ }
}
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
- if (($notoc == '0') || ($notoc == 'false')) {
- $notoc = false;
- } elseif (($notoc == '1') || ($notoc == 'true')) {
- $notoc = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "notoc"));
+ if (!is_bool($notoc)) {
+ if (($notoc == '0') || ($notoc == 'false')) {
+ $notoc = false;
+ } elseif (($notoc == '1') || ($notoc == 'true')) {
+ $notoc = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "notoc"));
+ }
}
- if (($with_counter == '0') || ($with_counter == 'false')) {
- $with_counter = false;
- } elseif (($with_counter == '1') || ($with_counter == 'true')) {
- $with_counter = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "with_counter"));
+ if (!is_bool($with_counter)) {
+ if (($with_counter == '0') || ($with_counter == 'false')) {
+ $with_counter = false;
+ } elseif (($with_counter == '1') || ($with_counter == 'true')) {
+ $with_counter = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "with_counter"));
+ }
}
- if (($with_toclink == '0') || ($with_toclink == 'false')) {
- $with_toclink = false;
- } elseif (($with_toclink == '1') || ($with_toclink == 'true')) {
- $with_toclink = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "with_toclink"));
+ if (!is_bool($with_toclink)) {
+ if (($with_toclink == '0') || ($with_toclink == 'false')) {
+ $with_toclink = false;
+ } elseif (($with_toclink == '1') || ($with_toclink == 'true')) {
+ $with_toclink = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "with_toclink"));
+ }
}
if (($notoc) or ($liststyle == 'ol')) {
Modified: trunk/lib/plugin/DebugBackendInfo.php
===================================================================
--- trunk/lib/plugin/DebugBackendInfo.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/DebugBackendInfo.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -53,24 +53,30 @@
{
$args = $this->getArgs($argstr, $request);
extract($args);
+
if (empty($userid) or $userid == $request->_user->UserName()) {
$user = $request->_user;
} else {
$user = WikiUser($userid);
}
+
if (!$user->isAdmin() and !(DEBUG && _DEBUG_LOGIN)) {
$request->_notAuthorized(WIKIAUTH_ADMIN);
$this->disabled("! user->isAdmin");
}
+
if (empty($page)) {
return $this->error("page missing");
}
- if (($notallversions == '0') || ($notallversions == 'false')) {
- $notallversions = false;
- } elseif (($notallversions == '1') || ($notallversions == 'true')) {
- $notallversions = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "notallversions"));
+
+ if (!is_bool($notallversions)) {
+ if (($notallversions == '0') || ($notallversions == 'false')) {
+ $notallversions = false;
+ } elseif (($notallversions == '1') || ($notallversions == 'true')) {
+ $notallversions = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "notallversions"));
+ }
}
$backend = &$dbi->_backend;
Modified: trunk/lib/plugin/ExternalSearch.php
===================================================================
--- trunk/lib/plugin/ExternalSearch.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/ExternalSearch.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -92,12 +92,14 @@
extract($args);
- if (($debug == '0') || ($debug == 'false')) {
- $debug = false;
- } elseif (($debug == '1') || ($debug == 'true')) {
- $debug = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "debug"));
+ if (!is_bool($debug)) {
+ if (($debug == '0') || ($debug == 'false')) {
+ $debug = false;
+ } elseif (($debug == '1') || ($debug == 'true')) {
+ $debug = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "debug"));
+ }
}
$posted = $GLOBALS['HTTP_POST_VARS'];
Modified: trunk/lib/plugin/FullTextSearch.php
===================================================================
--- trunk/lib/plugin/FullTextSearch.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/FullTextSearch.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -78,36 +78,44 @@
}
extract($args);
- if (($hilight == '0') || ($hilight == 'false')) {
- $hilight = false;
- } elseif (($hilight == '1') || ($hilight == 'true')) {
- $hilight = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "hilight"));
+ if (!is_bool($hilight)) {
+ if (($hilight == '0') || ($hilight == 'false')) {
+ $hilight = false;
+ } elseif (($hilight == '1') || ($hilight == 'true')) {
+ $hilight = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "hilight"));
+ }
}
- if (($case_exact == '0') || ($case_exact == 'false')) {
- $case_exact = false;
- } elseif (($case_exact == '1') || ($case_exact == 'true')) {
- $case_exact = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "case_exact"));
+ if (!is_bool($case_exact)) {
+ if (($case_exact == '0') || ($case_exact == 'false')) {
+ $case_exact = false;
+ } elseif (($case_exact == '1') || ($case_exact == 'true')) {
+ $case_exact = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "case_exact"));
+ }
}
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
- if (($quiet == '0') || ($quiet == 'false')) {
- $quiet = false;
- } elseif (($quiet == '1') || ($quiet == 'true')) {
- $quiet = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "quiet"));
+ if (!is_bool($quiet)) {
+ if (($quiet == '0') || ($quiet == 'false')) {
+ $quiet = false;
+ } elseif (($quiet == '1') || ($quiet == 'true')) {
+ $quiet = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "quiet"));
+ }
}
$query = new TextSearchQuery($s, $case_exact, $regex);
Modified: trunk/lib/plugin/IncludePage.php
===================================================================
--- trunk/lib/plugin/IncludePage.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/IncludePage.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -85,20 +85,24 @@
$args = $this->getArgs($argstr, $request);
extract($args);
- if (($quiet == '0') || ($quiet == 'false')) {
- $quiet = false;
- } elseif (($quiet == '1') || ($quiet == 'true')) {
- $quiet = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "quiet"));
+ if (!is_bool($quiet)) {
+ if (($quiet == '0') || ($quiet == 'false')) {
+ $quiet = false;
+ } elseif (($quiet == '1') || ($quiet == 'true')) {
+ $quiet = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "quiet"));
+ }
}
- if (($sectionhead == '0') || ($sectionhead == 'false')) {
- $sectionhead = false;
- } elseif (($sectionhead == '1') || ($sectionhead == 'true')) {
- $sectionhead = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "sectionhead"));
+ if (!is_bool($sectionhead)) {
+ if (($sectionhead == '0') || ($sectionhead == 'false')) {
+ $sectionhead = false;
+ } elseif (($sectionhead == '1') || ($sectionhead == 'true')) {
+ $sectionhead = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "sectionhead"));
+ }
}
if ($page) {
Modified: trunk/lib/plugin/LinkDatabase.php
===================================================================
--- trunk/lib/plugin/LinkDatabase.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/LinkDatabase.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -104,12 +104,14 @@
$args = $this->getArgs($argstr, $request);
$include_empty = $args['include_empty'];
- if (($include_empty == '0') || ($include_empty == 'false')) {
- $include_empty = false;
- } elseif (($include_empty == '1') || ($include_empty == 'true')) {
- $include_empty = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "include_empty"));
+ if (!is_bool($include_empty)) {
+ if (($include_empty == '0') || ($include_empty == 'false')) {
+ $include_empty = false;
+ } elseif (($include_empty == '1') || ($include_empty == 'true')) {
+ $include_empty = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "include_empty"));
+ }
}
if (isset($args['limit']) && !is_limit($args['limit'])) {
Modified: trunk/lib/plugin/LinkSearch.php
===================================================================
--- trunk/lib/plugin/LinkSearch.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/LinkSearch.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -138,20 +138,24 @@
$args = $this->getArgs($argstr, $request);
extract($args);
- if (($noform == '0') || ($noform == 'false')) {
- $noform = false;
- } elseif (($noform == '1') || ($noform == 'true')) {
- $noform = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noform"));
+ if (!is_bool($noform)) {
+ if (($noform == '0') || ($noform == 'false')) {
+ $noform = false;
+ } elseif (($noform == '1') || ($noform == 'true')) {
+ $noform = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noform"));
+ }
}
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
if (empty($args['page']))
Modified: trunk/lib/plugin/ListSubpages.php
===================================================================
--- trunk/lib/plugin/ListSubpages.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/ListSubpages.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -87,12 +87,14 @@
}
extract($args);
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
$content = HTML();
Modified: trunk/lib/plugin/MostPopular.php
===================================================================
--- trunk/lib/plugin/MostPopular.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/MostPopular.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -66,12 +66,14 @@
extract($args);
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
if (isset($limit) && !is_limit($limit)) {
Modified: trunk/lib/plugin/NewPagesPerUser.php
===================================================================
--- trunk/lib/plugin/NewPagesPerUser.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/NewPagesPerUser.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -68,19 +68,24 @@
$args = $this->getArgs($argstr, $request);
extract($args);
- if (($comments == '0') || ($comments == 'false')) {
- $comments = false;
- } elseif (($comments == '1') || ($comments == 'true')) {
- $comments = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "comments"));
+ if (!is_bool($comments)) {
+ if (($comments == '0') || ($comments == 'false')) {
+ $comments = false;
+ } elseif (($comments == '1') || ($comments == 'true')) {
+ $comments = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "comments"));
+ }
}
- if (($links == '0') || ($links == 'false')) {
- $links = false;
- } elseif (($links == '1') || ($links == 'true')) {
- $links = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "links"));
+
+ if (!is_bool($links)) {
+ if (($links == '0') || ($links == 'false')) {
+ $links = false;
+ } elseif (($links == '1') || ($links == 'true')) {
+ $links = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "links"));
+ }
}
if ($since)
Modified: trunk/lib/plugin/OrphanedPages.php
===================================================================
--- trunk/lib/plugin/OrphanedPages.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/OrphanedPages.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -72,20 +72,24 @@
extract($args);
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
- if (($include_empty == '0') || ($include_empty == 'false')) {
- $include_empty = false;
- } elseif (($include_empty == '1') || ($include_empty == 'true')) {
- $include_empty = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "include_empty"));
+ if (!is_bool($include_empty)) {
+ if (($include_empty == '0') || ($include_empty == 'false')) {
+ $include_empty = false;
+ } elseif (($include_empty == '1') || ($include_empty == 'true')) {
+ $include_empty = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "include_empty"));
+ }
}
// There's probably a more efficient way to do this (eg a
Modified: trunk/lib/plugin/PopularNearby.php
===================================================================
--- trunk/lib/plugin/PopularNearby.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/PopularNearby.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -74,12 +74,14 @@
extract($args);
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
$header = '';
Modified: trunk/lib/plugin/RandomPage.php
===================================================================
--- trunk/lib/plugin/RandomPage.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/RandomPage.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -63,20 +63,24 @@
$args = $this->getArgs($argstr, $request);
extract($args);
- if (($redirect == '0') || ($redirect == 'false')) {
- $redirect = false;
- } elseif (($redirect == '1') || ($redirect == 'true')) {
- $redirect = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "redirect"));
+ if (!is_bool($redirect)) {
+ if (($redirect == '0') || ($redirect == 'false')) {
+ $redirect = false;
+ } elseif (($redirect == '1') || ($redirect == 'true')) {
+ $redirect = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "redirect"));
+ }
}
- if (($hidename == '0') || ($hidename == 'false')) {
- $hidename = false;
- } elseif (($hidename == '1') || ($hidename == 'true')) {
- $hidename = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "hidename"));
+ if (!is_bool($hidename)) {
+ if (($hidename == '0') || ($hidename == 'false')) {
+ $hidename = false;
+ } elseif (($hidename == '1') || ($hidename == 'true')) {
+ $hidename = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "hidename"));
+ }
}
// Redirect would break HTML dump
Modified: trunk/lib/plugin/RecentReferrers.php
===================================================================
--- trunk/lib/plugin/RecentReferrers.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/RecentReferrers.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -63,12 +63,14 @@
$args = $this->getArgs($argstr, $request);
$noheader = $args['noheader'];
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
$table = HTML::table(array('class' => 'pagelist'));
Modified: trunk/lib/plugin/RssFeed.php
===================================================================
--- trunk/lib/plugin/RssFeed.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/RssFeed.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -63,12 +63,14 @@
{
extract($this->getArgs($argstr, $request));
- if (($titleonly == '0') || ($titleonly == 'false')) {
- $titleonly = false;
- } elseif (($titleonly == '1') || ($titleonly == 'true')) {
- $titleonly = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "titleonly"));
+ if (!is_bool($titleonly)) {
+ if (($titleonly == '0') || ($titleonly == 'false')) {
+ $titleonly = false;
+ } elseif (($titleonly == '1') || ($titleonly == 'true')) {
+ $titleonly = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "titleonly"));
+ }
}
$rss_parser = new RSSParser();
Modified: trunk/lib/plugin/SearchHighlight.php
===================================================================
--- trunk/lib/plugin/SearchHighlight.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/SearchHighlight.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -72,12 +72,14 @@
}
extract($args);
- if (($case_exact == '0') || ($case_exact == 'false')) {
- $case_exact = false;
- } elseif (($case_exact == '1') || ($case_exact == 'true')) {
- $case_exact = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "case_exact"));
+ if (!is_bool($case_exact)) {
+ if (($case_exact == '0') || ($case_exact == 'false')) {
+ $case_exact = false;
+ } elseif (($case_exact == '1') || ($case_exact == 'true')) {
+ $case_exact = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "case_exact"));
+ }
}
$html = HTML();
Modified: trunk/lib/plugin/SemanticRelations.php
===================================================================
--- trunk/lib/plugin/SemanticRelations.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/SemanticRelations.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -64,20 +64,24 @@
$args = $this->getArgs($argstr, $request);
extract($args);
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
- if (($nohelp == '0') || ($nohelp == 'false')) {
- $nohelp = false;
- } elseif (($nohelp == '1') || ($nohelp == 'true')) {
- $nohelp = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "nohelp"));
+ if (!is_bool($nohelp)) {
+ if (($nohelp == '0') || ($nohelp == 'false')) {
+ $nohelp = false;
+ } elseif (($nohelp == '1') || ($nohelp == 'true')) {
+ $nohelp = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "nohelp"));
+ }
}
if (empty($page))
Modified: trunk/lib/plugin/SemanticSearch.php
===================================================================
--- trunk/lib/plugin/SemanticSearch.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/SemanticSearch.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -295,28 +295,34 @@
, fmt("See %s", WikiLink(_("Help").":"._("SemanticRelations")))));
extract($args);
- if (($case_exact == '0') || ($case_exact == 'false')) {
- $case_exact = false;
- } elseif (($case_exact == '1') || ($case_exact == 'true')) {
- $case_exact = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "case_exact"));
+ if (!is_bool($case_exact)) {
+ if (($case_exact == '0') || ($case_exact == 'false')) {
+ $case_exact = false;
+ } elseif (($case_exact == '1') || ($case_exact == 'true')) {
+ $case_exact = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "case_exact"));
+ }
}
- if (($noform == '0') || ($noform == 'false')) {
- $noform = false;
- } elseif (($noform == '1') || ($noform == 'true')) {
- $noform = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noform"));
+ if (!is_bool($noform)) {
+ if (($noform == '0') || ($noform == 'false')) {
+ $noform = false;
+ } elseif (($noform == '1') || ($noform == 'true')) {
+ $noform = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noform"));
+ }
}
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
// for convenience and harmony we allow GET requests also.
Modified: trunk/lib/plugin/SemanticSearchAdvanced.php
===================================================================
--- trunk/lib/plugin/SemanticSearchAdvanced.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/SemanticSearchAdvanced.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -151,28 +151,34 @@
extract($args);
- if (($case_exact == '0') || ($case_exact == 'false')) {
- $case_exact = false;
- } elseif (($case_exact == '1') || ($case_exact == 'true')) {
- $case_exact = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "case_exact"));
+ if (!is_bool($case_exact)) {
+ if (($case_exact == '0') || ($case_exact == 'false')) {
+ $case_exact = false;
+ } elseif (($case_exact == '1') || ($case_exact == 'true')) {
+ $case_exact = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "case_exact"));
+ }
}
- if (($noform == '0') || ($noform == 'false')) {
- $noform = false;
- } elseif (($noform == '1') || ($noform == 'true')) {
- $noform = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noform"));
+ if (!is_bool($noform)) {
+ if (($noform == '0') || ($noform == 'false')) {
+ $noform = false;
+ } elseif (($noform == '1') || ($noform == 'true')) {
+ $noform = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noform"));
+ }
}
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
// For convenience, peace and harmony we allow GET requests also.
Modified: trunk/lib/plugin/TitleSearch.php
===================================================================
--- trunk/lib/plugin/TitleSearch.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/TitleSearch.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -82,30 +82,36 @@
$args = $this->getArgs($argstr, $request);
$auto_redirect = $args['auto_redirect'];
- if (($auto_redirect == '0') || ($auto_redirect == 'false')) {
- $auto_redirect = false;
- } elseif (($auto_redirect == '1') || ($auto_redirect == 'true')) {
- $auto_redirect = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "auto_redirect"));
+ if (!is_bool($auto_redirect)) {
+ if (($auto_redirect == '0') || ($auto_redirect == 'false')) {
+ $auto_redirect = false;
+ } elseif (($auto_redirect == '1') || ($auto_redirect == 'true')) {
+ $auto_redirect = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "auto_redirect"));
+ }
}
$noheader = $args['noheader'];
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
$case_exact = $args['case_exact'];
- if (($case_exact == '0') || ($case_exact == 'false')) {
- $case_exact = false;
- } elseif (($case_exact == '1') || ($case_exact == 'true')) {
- $case_exact = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "case_exact"));
+ if (!is_bool($case_exact)) {
+ if (($case_exact == '0') || ($case_exact == 'false')) {
+ $case_exact = false;
+ } elseif (($case_exact == '1') || ($case_exact == 'true')) {
+ $case_exact = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "case_exact"));
+ }
}
if (isset($args['limit']) && !is_limit($args['limit'])) {
Modified: trunk/lib/plugin/UserRatings.php
===================================================================
--- trunk/lib/plugin/UserRatings.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/UserRatings.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -82,28 +82,34 @@
{
extract($this->getArgs($argstr, $request));
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
- if (($userPage == '0') || ($userPage == 'false')) {
- $userPage = false;
- } elseif (($userPage == '1') || ($userPage == 'true')) {
- $userPage = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "userPage"));
+ if (!is_bool($userPage)) {
+ if (($userPage == '0') || ($userPage == 'false')) {
+ $userPage = false;
+ } elseif (($userPage == '1') || ($userPage == 'true')) {
+ $userPage = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "userPage"));
+ }
}
- if (($nobuds == '0') || ($nobuds == 'false')) {
- $nobuds = false;
- } elseif (($nobuds == '1') || ($nobuds == 'true')) {
- $nobuds = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "nobuds"));
+ if (!is_bool($nobuds)) {
+ if (($nobuds == '0') || ($nobuds == 'false')) {
+ $nobuds = false;
+ } elseif (($nobuds == '1') || ($nobuds == 'true')) {
+ $nobuds = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "nobuds"));
+ }
}
// XXX: fix to reflect multi-user ratings?
Modified: trunk/lib/plugin/Video.php
===================================================================
--- trunk/lib/plugin/Video.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/Video.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -80,12 +80,14 @@
$height = $args['height'];
$autoplay = $args['autoplay'];
- if (($autoplay == '0') || ($autoplay == 'false')) {
- $autoplay = false;
- } elseif (($autoplay == '1') || ($autoplay == 'true')) {
- $autoplay = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "autoplay"));
+ if (!is_bool($autoplay)) {
+ if (($autoplay == '0') || ($autoplay == 'false')) {
+ $autoplay = false;
+ } elseif (($autoplay == '1') || ($autoplay == 'true')) {
+ $autoplay = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "autoplay"));
+ }
}
if (!$url && !$file) {
Modified: trunk/lib/plugin/WantedPages.php
===================================================================
--- trunk/lib/plugin/WantedPages.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/WantedPages.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -84,12 +84,14 @@
extract($args);
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
if ($page == _("WantedPages")) $page = "";
Modified: trunk/lib/plugin/WikiForum.php
===================================================================
--- trunk/lib/plugin/WikiForum.php 2021-09-14 14:07:14 UTC (rev 10553)
+++ trunk/lib/plugin/WikiForum.php 2021-09-14 16:59:19 UTC (rev 10554)
@@ -81,12 +81,14 @@
}
$noheader = $args['noheader'];
- if (($noheader == '0') || ($noheader == 'false')) {
- $noheader = false;
- } elseif (($noheader == '1') || ($noheader == 'true')) {
- $noheader = true;
- } else {
- return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ if (!is_bool($noheader)) {
+ if (($noheader == '0') || ($noheader == 'false')) {
+ $noheader = false;
+ } elseif (($noheader == '1') || ($noheader == 'true')) {
+ $noheader = true;
+ } else {
+ return $this->error(sprintf(_("Argument '%s' must be a boolean"), "noheader"));
+ }
}
// Get our form args.
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|