Revision 15789,
1.4 KB
checked in by nanasess, 15 years ago
(diff) |
CLASS_PATH を取得できるよう修正
|
-
Property svn:keywords set to
Id
-
Property svn:mime-type set to
text/x-httpd-php; charset=UTF-8
|
Line | |
---|
1 | <?php |
---|
2 | // FIXME クラスにする |
---|
3 | $include_dir = realpath(dirname( __FILE__)); |
---|
4 | require_once($include_dir . "/define.php"); |
---|
5 | if (!defined("CLASS_PATH")) { |
---|
6 | /** クラスパス */ |
---|
7 | define("CLASS_PATH", $include_dir . HTML2DATA_DIR . "class/"); |
---|
8 | } |
---|
9 | require_once($include_dir . HTML2DATA_DIR. "conf/conf.php"); |
---|
10 | require_once($include_dir . HTML2DATA_DIR. "module/gdthumb.php"); |
---|
11 | require_once($include_dir . HTML2DATA_DIR. "class/util_extends/GC_Utils_Ex.php"); |
---|
12 | |
---|
13 | |
---|
14 | $objThumb = new gdthumb(); |
---|
15 | |
---|
16 | $file = NO_IMAGE_DIR; |
---|
17 | |
---|
18 | // NO_IMAGE_DIR以外のファイル名が渡された場合、ファイル名のチェックを行う |
---|
19 | if ( isset($_GET['image']) && $_GET['image'] !== NO_IMAGE_DIR) { |
---|
20 | |
---|
21 | // ファイル名が正しい場合だけ、$fileを設定 |
---|
22 | if ( lfCheckFileName() === true ) { |
---|
23 | $file = IMAGE_SAVE_DIR . $_GET['image']; |
---|
24 | } else { |
---|
25 | GC_Utils_Ex::gfPrintLog('invalid access :resize_image.php $_GET["image"]=' . $_GET['image']); |
---|
26 | } |
---|
27 | } |
---|
28 | |
---|
29 | if(file_exists($file)){ |
---|
30 | $objThumb->Main($file, $_GET["width"], $_GET["height"], "", true); |
---|
31 | }else{ |
---|
32 | $objThumb->Main(NO_IMAGE_DIR, $_GET["width"], $_GET["height"], "", true); |
---|
33 | } |
---|
34 | |
---|
35 | // ファイル名の形式をチェック |
---|
36 | function lfCheckFileName() { |
---|
37 | //$pattern = '|^[0-9]+_[0-9a-z]+\.[a-z]{3}$|'; |
---|
38 | $pattern = '|\./|'; |
---|
39 | $file = trim($_GET["image"]); |
---|
40 | if ( preg_match_all($pattern, $file, $matches) ) { |
---|
41 | return false; |
---|
42 | } else { |
---|
43 | return true; |
---|
44 | } |
---|
45 | } |
---|
46 | |
---|
47 | ?> |
---|
Note: See
TracBrowser
for help on using the repository browser.