Skip to content

Commit

Permalink
plugin WikiForum: better test boolean argument "noheader"
Browse files Browse the repository at this point in the history
  • Loading branch information
vargenau committed Feb 23, 2021
1 parent c7d50eb commit 8b33c72
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions lib/plugin/WikiForum.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,20 @@ function getDefaultArguments()
function run($dbi, $argstr, &$request, $basepage)
{
$args = $this->getArgs($argstr, $request);

if (!$args['pagename']) {
return $this->error(sprintf(_("A required argument “%s” is missing."), 'pagename'));
}

$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"));
}

// Get our form args.
$forum = $request->getArg('forum');
$request->setArg('forum', false);
Expand Down

0 comments on commit 8b33c72

Please sign in to comment.