SF.net SVN: phpwiki:[10688] trunk/lib/plugin/PhotoAlbum.php

vargenau--- via phpwiki-checkins <[email protected]>
Newsgroups gmane.comp.web.wiki.phpwiki.checkins
Message-ID <[email protected]>
Revision: 10688
          http://sourceforge.net/p/phpwiki/code/10688
Author:   vargenau
Date:     2021-11-25 14:38:26 +0000 (Thu, 25 Nov 2021)
Log Message:
-----------
Check PHPWIKI_DIR is defined

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

Modified: trunk/lib/plugin/PhotoAlbum.php
===================================================================
--- trunk/lib/plugin/PhotoAlbum.php	2021-11-25 14:29:08 UTC (rev 10687)
+++ trunk/lib/plugin/PhotoAlbum.php	2021-11-25 14:38:26 UTC (rev 10688)
@@ -583,7 +583,9 @@
             if (string_ends_with($src, "/"))
                 $src = substr($src, 0, -1);
         }
-        if (!file_exists($src) and @file_exists(PHPWIKI_DIR . "/$src")) {
+        if (!file_exists($src) 
+            && defined('PHPWIKI_DIR')
+            && file_exists(PHPWIKI_DIR . "/$src")) {
             $src = PHPWIKI_DIR . "/$src";
         }
         // check if src is a directory
@@ -613,8 +615,11 @@
         // check if $src is an image
         foreach (array('jpeg', 'jpg', 'png', 'gif') as $ext) {
             if (preg_match("/\.$ext$/", $src)) {
-                if (!file_exists($src) and @file_exists(PHPWIKI_DIR . "/$src"))
+                if (!file_exists($src)
+                    && defined('PHPWIKI_DIR')
+                    && file_exists(PHPWIKI_DIR . "/$src")) {
                     $src = PHPWIKI_DIR . "/$src";
+                }
                 if ($web_location == 1 and !empty($contents)) {
                     $photos[] = array("src" => $src,
                         "name" => $src,
@@ -622,8 +627,9 @@
                         "desc" => "");
                     return '';
                 }
-                if (!file_exists($src))
+                if (!file_exists($src)) {
                     return $this->error(fmt("Unable to find src=“%s”", $src));
+                }
                 $photos[] = array("src" => $src,
                     "name" => "../" . $src,
                     "name_tile" => $src,

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.