From 2db2e07e2780e4a23305328109f193b40e5d84c4 Mon Sep 17 00:00:00 2001 From: henoheno Date: Wed, 1 Sep 2004 22:15:16 +0900 Subject: [PATCH] BugTrack/674 Set $file, or fail getimagesize() etc --- plugin/ref.inc.php | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/plugin/ref.inc.php b/plugin/ref.inc.php index 60d0f5b..d44408e 100644 --- a/plugin/ref.inc.php +++ b/plugin/ref.inc.php @@ -2,7 +2,7 @@ ///////////////////////////////////////////////// // PukiWiki - Yet another WikiWikiWeb clone. // -// $Id: ref.inc.php,v 1.37 2004/08/29 10:24:45 henoheno Exp $ +// $Id: ref.inc.php,v 1.38 2004/09/01 13:15:16 henoheno Exp $ // // UPLOAD_DIR ¤Î¥Ç¡¼¥¿(²èÁü¥Õ¥¡¥¤¥ë¤Î¤ß)¤ËľÀÜ¥¢¥¯¥»¥¹¤µ¤»¤ë @@ -152,9 +152,12 @@ function plugin_ref_body($args) // źÉÕ¥Õ¥¡¥¤¥ë¤Î¤¢¤ë¥Ú¡¼¥¸: default¤Ï¸½ºß¤Î¥Ú¡¼¥¸Ì¾ $page = isset($vars['page']) ? $vars['page'] : ''; - // źÉÕ¥Õ¥¡¥¤¥ë̾ + // źÉÕ¥Õ¥¡¥¤¥ë¤Î¥Õ¥¡¥¤¥ë̾ $name = ''; + // źÉÕ¥Õ¥¡¥¤¥ë¤Þ¤Ç¤Î¥Ñ¥¹¤ª¤è¤Ó(¼ÂºÝ¤Î)¥Õ¥¡¥¤¥ë̾ + $file = ''; + // Âè°ì°ú¿ô: "[¥Ú¡¼¥¸Ì¾¤ª¤è¤Ó/]źÉÕ¥Õ¥¡¥¤¥ë̾"¡¢¤¢¤ë¤¤¤Ï"URL"¤ò¼èÆÀ $name = array_shift($args); $is_url = is_url($name); @@ -175,7 +178,8 @@ function plugin_ref_body($args) } $name = $matches[2]; $page = get_fullname(strip_bracket($matches[1]), $page); // strip is a compat - $is_file = is_file(UPLOAD_DIR . encode($page) . '_' . encode($name)); + $file = UPLOAD_DIR . encode($page) . '_' . encode($name); + $is_file = is_file($file); // ÂèÆó°ú¿ô°Ê¹ß¤¬Â¸ºß¤·¡¢¤½¤ì¤Ïref¤Î¥ª¥×¥·¥ç¥ó̾¾Î¤Ê¤É¤È°ìÃפ·¤Ê¤¤ } else if (isset($args[0]) && $args[0] != '' && ! isset($params[$args[0]])) { @@ -183,7 +187,8 @@ function plugin_ref_body($args) // Try the second argument, as a page-name or a path-name $_arg = get_fullname(strip_bracket($args[0]), $page); // strip is a compat - $is_file_second = is_file(UPLOAD_DIR . encode($_arg) . '_' . $e_name); + $file = UPLOAD_DIR . encode($_arg) . '_' . $e_name; + $is_file_second = is_file($file); // If the second argument is WikiName, or double-bracket-inserted pagename (compat) $is_bracket_bracket = preg_match("/^($WikiName|\[\[$BracketName\]\])$/", $args[0]); @@ -213,7 +218,8 @@ function plugin_ref_body($args) } } else { // Simple single argument - $is_file = is_file(UPLOAD_DIR . encode($page) . '_' . encode($name)); + $file = UPLOAD_DIR . encode($page) . '_' . encode($name); + $is_file = is_file($file); } if (! $is_file) { $params['_error'] = htmlspecialchars('File not found: "' . @@ -237,7 +243,7 @@ function plugin_ref_body($args) źÉÕ¥Õ¥¡¥¤¥ë¤Î¤È¤­ : ¥Õ¥¡¥¤¥ë¤ÎºÇ½ª¹¹¿·Æü¤È¥µ¥¤¥º URL¤Î¤È¤­ : URL¤½¤Î¤â¤Î */ - $file = $title = $url = $url2 = $info = ''; + $title = $url = $url2 = $info = ''; $width = $height = 0; $matches = array(); -- 2.11.0