|
From: <var...@us...> - 2021-02-21 18:15:39
|
Revision: 10246
http://sourceforge.net/p/phpwiki/code/10246
Author: vargenau
Date: 2021-02-21 18:15:37 +0000 (Sun, 21 Feb 2021)
Log Message:
-----------
Better test boolean argument "include_empty"
Modified Paths:
--------------
trunk/lib/plugin/AllUsers.php
trunk/lib/plugin/LinkDatabase.php
trunk/lib/plugin/OrphanedPages.php
Modified: trunk/lib/plugin/AllUsers.php
===================================================================
--- trunk/lib/plugin/AllUsers.php 2021-02-20 11:23:33 UTC (rev 10245)
+++ trunk/lib/plugin/AllUsers.php 2021-02-21 18:15:37 UTC (rev 10246)
@@ -78,6 +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"));
+ }
+
$group = $request->getGroup();
if (method_exists($group, '_allUsers')) {
$allusers = $group->_allUsers();
Modified: trunk/lib/plugin/LinkDatabase.php
===================================================================
--- trunk/lib/plugin/LinkDatabase.php 2021-02-20 11:23:33 UTC (rev 10245)
+++ trunk/lib/plugin/LinkDatabase.php 2021-02-21 18:15:37 UTC (rev 10246)
@@ -103,6 +103,15 @@
global $WikiTheme;
$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 (isset($args['limit']) && !is_limit($args['limit'])) {
return HTML::p(array('class' => "error"),
_("Illegal “limit” argument: must be an integer or two integers separated by comma"));
@@ -111,7 +120,7 @@
$caption = _("All pages with all links in this wiki (%d total):");
if (!empty($args['owner'])) {
- $pages = PageList::allPagesByOwner($args['owner'], $args['include_empty'],
+ $pages = PageList::allPagesByOwner($args['owner'], $include_empty,
$args['sortby'], $args['limit']);
if ($args['owner'])
$caption = fmt("List of pages owned by %s (%d total):",
@@ -118,7 +127,7 @@
WikiLink($args['owner'], 'if_known'),
count($pages));
} elseif (!empty($args['author'])) {
- $pages = PageList::allPagesByAuthor($args['author'], $args['include_empty'],
+ $pages = PageList::allPagesByAuthor($args['author'], $include_empty,
$args['sortby'], $args['limit']);
if ($args['author'])
$caption = fmt("List of pages last edited by %s (%d total):",
@@ -125,7 +134,7 @@
WikiLink($args['author'], 'if_known'),
count($pages));
} elseif (!empty($args['creator'])) {
- $pages = PageList::allPagesByCreator($args['creator'], $args['include_empty'],
+ $pages = PageList::allPagesByCreator($args['creator'], $include_empty,
$args['sortby'], $args['limit']);
if ($args['creator'])
$caption = fmt("List of pages created by %s (%d total):",
@@ -133,10 +142,10 @@
count($pages));
} else {
if (!$request->getArg('count'))
- $args['count'] = $dbi->numPages($args['include_empty'], $args['exclude_from']);
+ $args['count'] = $dbi->numPages($include_empty, $args['exclude_from']);
else
$args['count'] = $request->getArg('count');
- $pages = $dbi->getAllPages($args['include_empty'], $args['sortby'],
+ $pages = $dbi->getAllPages($include_empty, $args['sortby'],
$args['limit'], $args['exclude_from']);
}
if ($args['format'] == 'html') {
Modified: trunk/lib/plugin/OrphanedPages.php
===================================================================
--- trunk/lib/plugin/OrphanedPages.php 2021-02-20 11:23:33 UTC (rev 10245)
+++ trunk/lib/plugin/OrphanedPages.php 2021-02-21 18:15:37 UTC (rev 10246)
@@ -72,6 +72,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"));
+ }
+
// There's probably a more efficient way to do this (eg a
// tailored SQL query via the backend, but this does the job
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|