From: <var...@us...> - 2021-02-22 16:54:58
|
Revision: 10253 http://sourceforge.net/p/phpwiki/code/10253 Author: vargenau Date: 2021-02-22 16:54:52 +0000 (Mon, 22 Feb 2021) Log Message: ----------- plugin FullTextSearch: better test boolean arguments "hilight", "case_exact", "noheader" and "quiet" Modified Paths: -------------- trunk/lib/plugin/FullTextSearch.php Modified: trunk/lib/plugin/FullTextSearch.php =================================================================== --- trunk/lib/plugin/FullTextSearch.php 2021-02-22 14:14:10 UTC (rev 10252) +++ trunk/lib/plugin/FullTextSearch.php 2021-02-22 16:54:52 UTC (rev 10253) @@ -77,8 +77,37 @@ _("You must enter a search term.")); } extract($args); - if ($quiet === 'false') { + + 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 (($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")); } $query = new TextSearchQuery($s, $case_exact, $regex); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |