SF.net SVN: phpwiki:[10720] trunk/lib/plugin/FileInfo.php

vargenau--- via phpwiki-checkins <[email protected]>
Newsgroups gmane.comp.web.wiki.phpwiki.checkins
Message-ID <[email protected]>
Revision: 10720
          http://sourceforge.net/p/phpwiki/code/10720
Author:   vargenau
Date:     2021-12-02 11:09:30 +0000 (Thu, 02 Dec 2021)
Log Message:
-----------
FileInfo plugin: test argument quiet is a boolean

Modified Paths:
--------------
    trunk/lib/plugin/FileInfo.php

Modified: trunk/lib/plugin/FileInfo.php
===================================================================
--- trunk/lib/plugin/FileInfo.php	2021-12-02 10:56:16 UTC (rev 10719)
+++ trunk/lib/plugin/FileInfo.php	2021-12-02 11:09:30 UTC (rev 10720)
@@ -82,12 +82,25 @@
     {
         $args = $this->getArgs($argstr, $request);
         extract($args);
-        if (!$file) {
+
+        if (empty($file)) {
             return $this->error(sprintf(_("A required argument “%s” is missing."), 'file'));
         }
-        if (!$display) {
+
+        if (empty($display)) {
             return $this->error(sprintf(_("A required argument “%s” is missing."), 'display'));
         }
+
+        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"));
+            }
+        }
+
         $is_Upload = false;
         if (string_starts_with($file, "Upload:")) {
             $file = preg_replace("/^Upload:(.*)$/", getUploadFilePath() . "\\1", $file);

This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.



_______________________________________________
phpwiki-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/phpwiki-checkins
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.