@@ -3,38 +3,38 @@ |
||
| 3 | 3 | |
| 4 | 4 | class UploadFileFilter |
| 5 | 5 | { |
| 6 | - private static $_block_list = array ('exec', 'system', 'passthru', 'show_source', 'phpinfo', 'fopen', 'file_get_contents', 'file_put_contents', 'fwrite', 'proc_open', 'popen'); |
|
| 6 | + private static $_block_list = array('exec', 'system', 'passthru', 'show_source', 'phpinfo', 'fopen', 'file_get_contents', 'file_put_contents', 'fwrite', 'proc_open', 'popen'); |
|
| 7 | 7 | |
| 8 | 8 | public function check($file) |
| 9 | 9 | { |
| 10 | 10 | // TODO: 기능개선후 enable |
| 11 | 11 | |
| 12 | 12 | return TRUE; // disable |
| 13 | - if (! $file || ! FileHandler::exists($file)) return TRUE; |
|
| 14 | - return self::_check ( $file ); |
|
| 13 | + if (!$file || !FileHandler::exists($file)) return TRUE; |
|
| 14 | + return self::_check($file); |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | private function _check($file) |
| 18 | 18 | { |
| 19 | - if (! ($fp = fopen ( $file, 'r' ))) return FALSE; |
|
| 19 | + if (!($fp = fopen($file, 'r'))) return FALSE; |
|
| 20 | 20 | |
| 21 | 21 | $has_php_tag = FALSE; |
| 22 | 22 | |
| 23 | - while ( ! feof ( $fp ) ) |
|
| 23 | + while (!feof($fp)) |
|
| 24 | 24 | { |
| 25 | - $content = fread ( $fp, 8192 ); |
|
| 26 | - if (FALSE === $has_php_tag) $has_php_tag = strpos ( $content, '<?' ); |
|
| 27 | - foreach ( self::$_block_list as $v ) |
|
| 25 | + $content = fread($fp, 8192); |
|
| 26 | + if (FALSE === $has_php_tag) $has_php_tag = strpos($content, '<?'); |
|
| 27 | + foreach (self::$_block_list as $v) |
|
| 28 | 28 | { |
| 29 | - if (FALSE !== $has_php_tag && FALSE !== strpos ( strtolower($content), $v )) |
|
| 29 | + if (FALSE !== $has_php_tag && FALSE !== strpos(strtolower($content), $v)) |
|
| 30 | 30 | { |
| 31 | - fclose ( $fp ); |
|
| 31 | + fclose($fp); |
|
| 32 | 32 | return FALSE; |
| 33 | 33 | } |
| 34 | 34 | } |
| 35 | 35 | } |
| 36 | 36 | |
| 37 | - fclose ( $fp ); |
|
| 37 | + fclose($fp); |
|
| 38 | 38 | |
| 39 | 39 | return TRUE; |
| 40 | 40 | } |