OSDN Git Service

Simplify. Check them at the beginning
authorhenoheno <henoheno>
Wed, 18 Aug 2004 13:36:45 +0000 (22:36 +0900)
committerhenoheno <henoheno>
Wed, 18 Aug 2004 13:36:45 +0000 (22:36 +0900)
plugin/ref.inc.php

index 7bd0e62..3d988dc 100644 (file)
@@ -2,7 +2,7 @@
 /////////////////////////////////////////////////
 // PukiWiki - Yet another WikiWikiWeb clone.
 //
-// $Id: ref.inc.php,v 1.25 2004/08/18 13:28:25 henoheno Exp $
+// $Id: ref.inc.php,v 1.26 2004/08/18 13:36:45 henoheno Exp $
 //
 
 /*
@@ -211,6 +211,12 @@ function plugin_ref_body($args)
                if (! is_dir(UPLOAD_DIR)) {
                        $params['_error'] = 'No UPLOAD_DIR';
                        return $params;
+               } else {
+                       $file = UPLOAD_DIR . encode($page) . '_' . encode($name);
+                       if (! is_file($file)) {
+                               $params['_error'] = 'File not found';
+                               return $params;
+                       }
                }
 
                // ¥Ú¡¼¥¸»ØÄê¤Î¥Á¥§¥Ã¥¯
@@ -218,16 +224,10 @@ function plugin_ref_body($args)
                        if ($matches[1] == '.' || $matches[1] == '..') {
                                $matches[1] .= '/';
                        }
-                       $page = get_fullname($matches[1],$page);
+                       $page = get_fullname($matches[1], $page);
                        $name = $matches[2];
                }
                $title = htmlspecialchars($name);
-               $file = UPLOAD_DIR . encode($page) . '_' . encode($name);
-
-               if (! is_file($file)) {
-                       $params['_error'] = 'File not found';
-                       return $params;
-               }
 
                $is_image = (! $params['noimg'] && preg_match('/\.(gif|png|jpe?g)$/i', $name));