diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index d3079e119..2722f77dd 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -80,7 +80,7 @@ list($lang_prefix, $lang_text) = explode(',',$val); $lang_text = trim($lang_text); $lang_supported[$lang_prefix] = $lang_text; - if(!$this->lang_type && ereg($lang_prefix, strtolower($_SERVER['HTTP_ACCEPT_LANGUAGE']))) { + if(!$this->lang_type && stripos($_SERVER['HTTP_ACCEPT_LANGUAGE'],$lang_prefix)!==false) { $this->lang_type = $lang_prefix; setcookie('lang_type', $this->lang_type, time()+60*60*24*365, '/'); } @@ -504,7 +504,7 @@ **/ function _setUploadedArgument() { if($this->_getRequestMethod() != 'POST') return; - if(!eregi("^multipart\/form-data", $_SERVER['CONTENT_TYPE'])) return; + if(stripos($_SERVER['CONTENT_TYPE'],"multipart/form-data")===false) return; if(!$_FILES) return; foreach($_FILES as $key => $val) { @@ -575,7 +575,7 @@ } elseif($var_count == 2) { asort($var_keys); $target = implode('.',$var_keys); - if($target=='act.mid' && !ereg('([A-Z]+)',$get_vars['act'])) return sprintf('%s%s/%s',$this->path,$get_vars['mid'],$get_vars['act']); + if($target=='act.mid' && !preg_match('/([A-Z]+)/',$get_vars['act'])) return sprintf('%s%s/%s',$this->path,$get_vars['mid'],$get_vars['act']); elseif($target=='document_srl.mid') return sprintf('%s%s/%s',$this->path,$get_vars['mid'],$get_vars['document_srl']); elseif($target=='act.document_srl') return sprintf('%s%s/%s',$this->path,$get_vars['document_srl'],$get_vars['act']); elseif($target=='mid.page') return sprintf('%s%s/page/%s',$this->path,$get_vars['mid'],$get_vars['page']); @@ -714,7 +714,7 @@ function _addJsFile($file) { if(in_array($file, $this->js_files)) return; - if(!eregi("^http:\/\/",$file)) $file = str_replace(realpath("."), ".", realpath($file)); + if(stripos($file,'http://')===false) $file = str_replace(realpath("."), ".", realpath($file)); $this->js_files[] = $file; } @@ -749,7 +749,7 @@ function _addCSSFile($file) { if(in_array($file, $this->css_files)) return; - if(!eregi("^http:\/\/",$file)) $file = str_replace(realpath("."), ".", realpath($file)); + if(stripos($file,'http://')===false) $file = str_replace(realpath("."), ".", realpath($file)); $this->css_files[] = $file; } @@ -890,8 +890,8 @@ * @brief 를 변경 **/ function transMeta($matches) { - if(eregi('\.css$', $matches[1])) $this->addCSSFile($matches[1]); - elseif(eregi('\.js$', $matches[1])) $this->addJSFile($matches[1]); + if(substr($matches[1],'-4')=='.css') $this->addCSSFile($matches[1]); + elseif(substr($matches[1],'-3')=='.js') $this->addJSFile($matches[1]); } /** diff --git a/classes/db/DB.class.php b/classes/db/DB.class.php index 7e8c79af1..753e48459 100644 --- a/classes/db/DB.class.php +++ b/classes/db/DB.class.php @@ -83,7 +83,7 @@ for($i=0;$ifilter->invalid_email, $lang->{$key}?$lang->{$key}:$key)); + if(!preg_match('/^[_0-9a-z-]+(\.[_0-9a-z-]+)*@[0-9a-z-]+(\.[0-9a-z-]+)*$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_email, $lang->{$key}?$lang->{$key}:$key)); break; case 'homepage' : - if(!eregi('^(http|https)+(:\/\/)+[0-9a-z_-]+\.[^ ]+$', $val)) return new Object(-1, sprintf($lang->filter->invalid_homepage, $lang->{$key}?$lang->{$key}:$key)); + if(!preg_match('/^(http|https)+(:\/\/)+[0-9a-z_-]+\.[^ ]+$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_homepage, $lang->{$key}?$lang->{$key}:$key)); break; case 'userid' : case 'user_id' : - if(!eregi('^[a-zA-Z]+([_0-9a-zA-Z]+)*$', $val)) return new Object(-1, sprintf($lang->filter->invalid_userid, $lang->{$key}?$lang->{$key}:$key)); + if(!preg_match('/^[a-zA-Z]+([_0-9a-zA-Z]+)*$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_userid, $lang->{$key}?$lang->{$key}:$key)); break; case 'number' : case 'numbers' : - if(!eregi('^[0-9,]+$', $val)) return new Object(-1, sprintf($lang->filter->invalid_number, $lang->{$key}?$lang->{$key}:$key)); + if(!preg_match('/^[0-9,]+$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_number, $lang->{$key}?$lang->{$key}:$key)); break; case 'alpha' : - if(!eregi('^[a-z]+$', $val)) return new Object(-1, sprintf($lang->filter->invalid_alpha, $lang->{$key}?$lang->{$key}:$key)); + if(!preg_match('/^[a-z]+$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_alpha, $lang->{$key}?$lang->{$key}:$key)); break; case 'alpha_number' : - if(!eregi('^[0-9a-z]+$', $val)) return new Object(-1, sprintf($lang->filter->invalid_alpha_number, $lang->{$key}?$lang->{$key}:$key)); + if(!preg_match('/^[0-9a-z]+$/is', $val)) return new Object(-1, sprintf($lang->filter->invalid_alpha_number, $lang->{$key}?$lang->{$key}:$key)); break; } diff --git a/classes/mail/Mail.class.php b/classes/mail/Mail.class.php index cbd3dcd3b..3fbf9c17e 100644 --- a/classes/mail/Mail.class.php +++ b/classes/mail/Mail.class.php @@ -106,7 +106,7 @@ } function isVaildMailAddress($email_address) { - if( eregi("([a-z0-9\_\-\.]+)@([a-z0-9\_\-\.]+)", $email_address) ) return $email_address; + if( preg_match("/([a-z0-9\_\-\.]+)@([a-z0-9\_\-\.]+)/i", $email_address) ) return $email_address; else return ''; } } diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index 7147b05bb..3f9fdd06b 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -57,9 +57,9 @@ else $this->module_srl = (int)$module_srl; // 기본 변수들의 검사 (XSS방지를 위한 기초적 검사) - if($this->module && !eregi("^([a-z0-9\_\-]+)$",$this->module)) die(Context::getLang("msg_invalid_request")); - if($this->mid && !eregi("^([a-z0-9\_\-]+)$",$this->mid)) die(Context::getLang("msg_invalid_request")); - if($this->act && !eregi("^([a-z0-9\_\-]+)$",$this->act)) die(Context::getLang("msg_invalid_request")); + if($this->module && !preg_match("/^([a-z0-9\_\-]+)$/i",$this->module)) die(Context::getLang("msg_invalid_request")); + if($this->mid && !preg_match("/^([a-z0-9\_\-]+)$/i",$this->mid)) die(Context::getLang("msg_invalid_request")); + if($this->act && !preg_match("/^([a-z0-9\_\-]+)$/i",$this->act)) die(Context::getLang("msg_invalid_request")); // 애드온 실행 (모듈 실행 전) $called_position = 'before_module_init'; diff --git a/classes/optimizer/Optimizer.class.php b/classes/optimizer/Optimizer.class.php index c63597cd5..3caaef681 100644 --- a/classes/optimizer/Optimizer.class.php +++ b/classes/optimizer/Optimizer.class.php @@ -42,7 +42,7 @@ foreach($source_files as $file) { if(!$file) continue; $file = str_replace("\\","/",$file); - if(eregi("^http:\/\/",$file) || $file == './common/css/button.css') $files[] = $file; + if(substr($file,7)=='http://' || $file == './common/css/button.css') $files[] = $file; else $targets[] = $file; } @@ -105,7 +105,7 @@ $content_buff .= $str."\n"; } if($type == "css") $content_buff = '@charset "utf-8";'."\n".$content_buff; - $content_file = eregi_replace("\.php$","",$filename); + $content_file = substr($filename, 0, -1); $content_filename = str_replace($this->cache_path, '', $content_file); FileHandler::writeFile($content_file, $content_buff); @@ -152,7 +152,7 @@ exit(); * @brief css의 경우 import/ background 등의 속성에서 사용되는 url내의 경로를 변경시켜줌 **/ function replaceCssPath($file, $str) { - $this->tmp_css_path = Context::getRequestUri().ereg_replace("^\.\/","",dirname($file))."/"; + $this->tmp_css_path = Context::getRequestUri().preg_replace("/^\.\//is","",dirname($file))."/"; $str = preg_replace_callback('!url\(("|\')?([^\)]+)("|\')?\)!is', array($this, '_replaceCssPath'), $str); $str = preg_replace('!\/([^\/]*)\/\.\.\/!is','/', $str); @@ -163,7 +163,7 @@ exit(); } function _replaceCssPath($matches) { - if(eregi("^(http|\/|\.\/common\/)",$matches[2])) return $matches[0]; + if(preg_match("/^(http|\/|\.\/common\/)/is",$matches[2])) return $matches[0]; return sprintf('url(%s%s)', $matches[1], $this->tmp_css_path.$matches[2]); } diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index 6807faed0..a1e220be8 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -38,7 +38,7 @@ if(__DEBUG__==3 ) $start = getMicroTime(); // 변수 체크 - $tpl_path = ereg_replace('(\/+)$', '', $tpl_path).'/'; + if(substr($tpl_path,-1)!='/') $tpl_path .= '/'; if(substr($tpl_filename,-5)!='.html') $tpl_filename .= '.html'; // tpl_file 변수 생성 @@ -145,7 +145,7 @@ $str1 = $matches[0]; $str2 = $path = $matches[3]; - if(!eregi("^([a-z0-9\_\.])",$path)) return $str1; + if(!preg_match('/^([a-z0-9\_\.])/i',$path)) return $str1; $path = preg_replace('/^(\.\/|\/)/','',$path); $path = 'tpl_path?>'.$path; @@ -205,7 +205,7 @@ $tmp_arr = explode("/", $arg); for($i=0;$itpl_path, $given_file); if(is_dir($lang_dir)) $output = sprintf('', $lang_dir); diff --git a/config/config.inc.php b/config/config.inc.php index 33c7fe0f8..3b38aeae4 100644 --- a/config/config.inc.php +++ b/config/config.inc.php @@ -23,7 +23,7 @@ * 2 : 1 + DB 쿼리 * 3 : 모든 로그 **/ - define('__DEBUG__', 0); + define('__DEBUG__', 3); /** * @brief 디버그 메세지의 출력 장소 diff --git a/modules/blog/blog.admin.controller.php b/modules/blog/blog.admin.controller.php index e63cab21b..fc37b7fda 100644 --- a/modules/blog/blog.admin.controller.php +++ b/modules/blog/blog.admin.controller.php @@ -87,7 +87,7 @@ } // 이미지 파일이 아니어도 무시 - if(!eregi("\.(jpg|jpeg|gif|png)$", $image_obj['name'])) { + if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) { unset($obj->{$vars->name}); continue; } diff --git a/modules/board/board.admin.controller.php b/modules/board/board.admin.controller.php index b6aacb503..ddb44761c 100644 --- a/modules/board/board.admin.controller.php +++ b/modules/board/board.admin.controller.php @@ -84,7 +84,7 @@ } // 이미지 파일이 아니어도 무시 - if(!eregi("\.(jpg|jpeg|gif|png)$", $image_obj['name'])) { + if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) { unset($obj->{$vars->name}); continue; } diff --git a/modules/comment/comment.controller.php b/modules/comment/comment.controller.php index 4242e6406..e9c6bf4ca 100644 --- a/modules/comment/comment.controller.php +++ b/modules/comment/comment.controller.php @@ -97,7 +97,7 @@ if($oDocument->isLocked()) return new Object(-1,'msg_invalid_request'); if($obj->password) $obj->password = md5($obj->password); - if($obj->homepage && !eregi('^http:\/\/',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; + if($obj->homepage && !preg_match('/^http:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; // 로그인 된 회원일 경우 회원의 정보를 입력 if(Context::get('is_logged')) { @@ -209,7 +209,7 @@ if(!$is_admin && !$source_obj->isGranted()) return new Object(-1, 'msg_not_permitted'); if($obj->password) $obj->password = md5($obj->password); - if($obj->homepage && !eregi('^http:\/\/',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; + if($obj->homepage && !preg_match('/^http:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; // 로그인 되어 있고 작성자와 수정자가 동일하면 수정자의 정보를 세팅 if(Context::get('is_logged')) { diff --git a/modules/comment/comment.item.php b/modules/comment/comment.item.php index 5b89f67cd..7b110791c 100644 --- a/modules/comment/comment.item.php +++ b/modules/comment/comment.item.php @@ -123,7 +123,7 @@ $url = trim($this->get('homepage')); if(!$url) return; - if(!eregi("^http:\/\/",$url)) $url = "http://".$url; + if(!preg_match("/^http:\/\//i",$url)) $url = "http://".$url; return $url; } diff --git a/modules/document/document.admin.controller.php b/modules/document/document.admin.controller.php index 86119db03..56c93d851 100644 --- a/modules/document/document.admin.controller.php +++ b/modules/document/document.admin.controller.php @@ -388,7 +388,7 @@ if (is_dir($path."/".$entry)) { $this->deleteThumbnailFile($path."/".$entry); } else { - if(!eregi('^thumbnail_([^\.]*)\.jpg$',$entry)) continue; + if(!preg_match('/^thumbnail_([^\.]*)\.jpg$/i',$entry)) continue; @unlink($path.'/'.$entry); } } diff --git a/modules/document/document.controller.php b/modules/document/document.controller.php index 8d5593245..83b032f7d 100644 --- a/modules/document/document.controller.php +++ b/modules/document/document.controller.php @@ -90,7 +90,7 @@ if($obj->allow_comment!='Y') $obj->allow_comment = 'N'; if($obj->lock_comment!='Y') $obj->lock_comment = 'N'; if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N'; - if($obj->homepage && !eregi('^http:\/\/',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; + if($obj->homepage && !preg_match('/^http:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; if($obj->notify_message != 'Y') $obj->notify_message = 'N'; // $extra_vars를 serialize @@ -182,7 +182,7 @@ if($obj->allow_comment!='Y') $obj->allow_comment = 'N'; if($obj->lock_comment!='Y') $obj->lock_comment = 'N'; if($obj->allow_trackback!='Y') $obj->allow_trackback = 'N'; - if($obj->homepage && !eregi('^http:\/\/',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; + if($obj->homepage && !preg_match('/^http:\/\//i',$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; if($obj->notify_message != 'Y') $obj->notify_message = 'N'; // $extra_vars를 serialize diff --git a/modules/document/document.item.php b/modules/document/document.item.php index cb71adde2..7770415ab 100644 --- a/modules/document/document.item.php +++ b/modules/document/document.item.php @@ -180,7 +180,7 @@ $url = trim($this->get('homepage')); if(!$url) return; - if(!eregi("^http:\/\/",$url)) $url = "http://".$url; + if(!preg_match("/^http:\/\//i",$url)) $url = "http://".$url; return $url; } @@ -441,7 +441,7 @@ if(count($file_list)) { foreach($file_list as $file) { if($file->direct_download!='Y') continue; - if(!eregi("(jpg|png|jpeg|gif)$",$file->source_filename)) continue; + if(!preg_match("/(jpg|png|jpeg|gif)$/i",$file->source_filename)) continue; $filename = $file->uploaded_filename; if(!file_exists($filename)) continue; @@ -458,7 +458,7 @@ preg_match_all("!http:\/\/([^ ^\"^']*?)\.(jpg|png|gif|jpeg)!is", $content, $matches, PREG_SET_ORDER); for($i=0;$ieditor_sequence = $editor_sequence; $this->component_path = $component_path; - $this->emoticon_path = sprintf('%s%s/images',eregi_replace('^\.\/','',$this->component_path),'tpl','images'); + $this->emoticon_path = sprintf('%s%s/images',preg_replace('/^\.\//i','',$this->component_path),'tpl','images'); } /** @@ -26,7 +26,7 @@ **/ function getEmoticonList() { $emoticon = Context::get('emoticon'); - if(!$emoticon || !eregi("^([a-z0-9\_]+)$",$emoticon)) return new Object(-1,'msg_invalid_request'); + if(!$emoticon || !preg_replace("/^([a-z0-9\_]+)$/i",$emoticon)) return new Object(-1,'msg_invalid_request'); $list = $this->getEmoticons($emoticon); @@ -43,7 +43,7 @@ $oDir = dir($emoticon_path); while($file = $oDir->read()) { if(substr($file,0,1)=='.') continue; - if(eregi('\.(jpg|jpeg|gif|png)$',$file)) $output[] = sprintf("%s/%s", $path, str_replace($this->emoticon_path,'',$file)); + if(preg_match('/\.(jpg|jpeg|gif|png)$/i',$file)) $output[] = sprintf("%s/%s", $path, str_replace($this->emoticon_path,'',$file)); } $oDir->close(); if(count($output)) asort($output); @@ -91,7 +91,7 @@ if($alt) { $attr_output[] = "alt=\"".$alt."\""; } - if(eregi("\.png$",$src)) $attr_output[] = "class=\"iePngFix\""; + if(preg_match("/\.png$/i",$src)) $attr_output[] = "class=\"iePngFix\""; $code = sprintf("", implode(" ",$attr_output)); diff --git a/modules/editor/components/image_link/image_link.class.php b/modules/editor/components/image_link/image_link.class.php index ddfaeb81a..996dde41e 100644 --- a/modules/editor/components/image_link/image_link.class.php +++ b/modules/editor/components/image_link/image_link.class.php @@ -66,7 +66,7 @@ } if($align) $attr_output[] = "align=\"".$align."\""; - if(eregi("\.png$",$src)) $attr_output[] = "class=\"iePngFix\""; + if(preg_match("/\.png$/i",$src)) $attr_output[] = "class=\"iePngFix\""; if($width) $attr_output[] = 'width="'.$width.'"'; if($height) $attr_output[] = 'height="'.$height.'"'; diff --git a/modules/file/file.controller.php b/modules/file/file.controller.php index f6936677f..98bbd92ad 100644 --- a/modules/file/file.controller.php +++ b/modules/file/file.controller.php @@ -339,7 +339,7 @@ } // 이미지인지 기타 파일인지 체크하여 upload path 지정 - if(eregi("\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp3|asaf|wav|asx|midi)$", $file_info['name'])) { + if(preg_match("/\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp3|asaf|wav|asx|midi)$/i", $file_info['name'])) { $path = sprintf("./files/attach/images/%s/%s/", $module_srl,$upload_target_srl); $filename = $path.$file_info['name']; $direct_download = 'Y'; @@ -474,7 +474,7 @@ $old_file = $file_info->uploaded_filename; // 이미지인지 기타 파일인지 체크하여 이동할 위치 정함 - if(eregi("\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp3|asaf|wav|asx|midi)$", $file_info->source_filename)) { + if(preg_match("/\.(jpg|jpeg|gif|png|wmv|wma|mpg|mpeg|avi|swf|flv|mp3|asaf|wav|asx|midi)$/i", $file_info->source_filename)) { $path = sprintf("./files/attach/images/%s/%s/", $target_module_srl,$target_srl); $new_file = $path.$file_info->source_filename; } else { diff --git a/modules/guestbook/guestbook.admin.controller.php b/modules/guestbook/guestbook.admin.controller.php index 780558fc7..c2e935401 100644 --- a/modules/guestbook/guestbook.admin.controller.php +++ b/modules/guestbook/guestbook.admin.controller.php @@ -202,7 +202,7 @@ } // 이미지 파일이 아니어도 무시 - if(!eregi("\.(jpg|jpeg|gif|png)$", $image_obj['name'])) { + if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) { unset($obj->{$vars->name}); continue; } diff --git a/modules/importer/importer.admin.controller.php b/modules/importer/importer.admin.controller.php index 725ba5c13..0978eceb2 100644 --- a/modules/importer/importer.admin.controller.php +++ b/modules/importer/importer.admin.controller.php @@ -55,7 +55,7 @@ if(!$xml_file) return new Object(-1, 'msg_no_xml_file'); // local 파일 지정인데 파일이 없으면 역시 에러~ - if(!eregi('^http:',$xml_file) && (!eregi("\.xml$", $xml_file) || !file_exists($xml_file)) ) return new Object(-1,'msg_no_xml_file'); + if(!preg_match('/^http:/i',$xml_file) && (!preg_match("/\.xml$/i", $xml_file) || !file_exists($xml_file)) ) return new Object(-1,'msg_no_xml_file'); // 이제부터 데이터를 가져오면서 처리 $fp = $this->getFilePoint($xml_file); @@ -163,8 +163,8 @@ **/ function importMember($obj) { // homepage, blog의 url을 정확히 만듬 - if($obj->homepage && !eregi("^http:\/\/",$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; - if($obj->blog && !eregi("^http:\/\/",$obj->blog)) $obj->blog = 'http://'.$obj->blog; + if($obj->homepage && !preg_match("/^http:\/\//i",$obj->homepage)) $obj->homepage = 'http://'.$obj->homepage; + if($obj->blog && !preg_match("/^http:\/\//i",$obj->blog)) $obj->blog = 'http://'.$obj->blog; $obj->email_address = $obj->email; list($obj->email_id, $obj->email_host) = explode('@', $obj->email); @@ -257,7 +257,7 @@ if(!$xml_file) return new Object(-1, 'msg_no_xml_file'); // local 파일 지정인데 파일이 없으면 역시 에러~ - if(!eregi('^http:',$xml_file) && (!eregi("\.xml$", $xml_file) || !file_exists($xml_file)) ) return new Object(-1,'msg_no_xml_file'); + if(!preg_match('/^http:/i',$xml_file) && (!preg_match("/\.xml$/i", $xml_file) || !file_exists($xml_file)) ) return new Object(-1,'msg_no_xml_file'); // 이제부터 데이터를 가져오면서 처리 $fp = $this->getFilePoint($xml_file); @@ -398,7 +398,7 @@ if(!$xml_file) return new Object(-1, 'msg_no_xml_file'); // local 파일 지정인데 파일이 없으면 역시 에러~ - if(!eregi('^http:',$xml_file) && (!eregi("\.xml$", $xml_file) || !file_exists($xml_file)) ) return new Object(-1,'msg_no_xml_file'); + if(!preg_match('/^http:/i',$xml_file) && (!preg_match("/\.xml$/i", $xml_file) || !file_exists($xml_file)) ) return new Object(-1,'msg_no_xml_file'); // 필요한 객체 미리 생성 $this->oDocumentController = &getController('document'); @@ -813,7 +813,7 @@ **/ function getFilePoint($filename) { $fp = null; - if(eregi('^http:', $filename)) { + if(preg_match('/^http:/i', $filename)) { $url_info = parse_url($filename); if(!$url_info['port']) $url_info['port'] = 80; if(!$url_info['path']) $url_info['path'] = '/'; @@ -902,7 +902,7 @@ if(!$xml_file) return new Object(-1, 'msg_no_xml_file'); // local 파일 지정인데 파일이 없으면 역시 에러~ - if(!eregi('^http:',$xml_file) && (!eregi("\.xml$", $xml_file) || !file_exists($xml_file)) ) return new Object(-1,'msg_no_xml_file'); + if(!preg_match('/^http:/i',$xml_file) && (!preg_match("/\.xml$/i", $xml_file) || !file_exists($xml_file)) ) return new Object(-1,'msg_no_xml_file'); // 필요한 객체 미리 생성 $this->oDocumentController = &getController('document'); diff --git a/modules/integration_search/integration_search.admin.controller.php b/modules/integration_search/integration_search.admin.controller.php index c7f074abd..e536ba756 100644 --- a/modules/integration_search/integration_search.admin.controller.php +++ b/modules/integration_search/integration_search.admin.controller.php @@ -78,7 +78,7 @@ } // 이미지 파일이 아니어도 무시 - if(!eregi("\.(jpg|jpeg|gif|png)$", $image_obj['name'])) { + if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) { unset($obj->{$vars->name}); continue; } diff --git a/modules/layout/layout.admin.controller.php b/modules/layout/layout.admin.controller.php index 7c4f5612a..d11bb5201 100644 --- a/modules/layout/layout.admin.controller.php +++ b/modules/layout/layout.admin.controller.php @@ -93,7 +93,7 @@ if(!$image_obj['tmp_name'] || !is_uploaded_file($image_obj['tmp_name'])) continue; // 이미지 파일이 아니어도 무시 (swf는 패스~) - if(!eregi("\.(jpg|jpeg|gif|png|swf)$", $image_obj['name'])) continue; + if(!preg_match("/\.(jpg|jpeg|gif|png|swf)$/i", $image_obj['name'])) continue; // 경로를 정해서 업로드 $path = sprintf("./files/attach/images/%s/", $args->layout_srl); diff --git a/modules/lifepod/lifepod.admin.controller.php b/modules/lifepod/lifepod.admin.controller.php index 1db9b73d7..40b9d2434 100644 --- a/modules/lifepod/lifepod.admin.controller.php +++ b/modules/lifepod/lifepod.admin.controller.php @@ -200,7 +200,7 @@ } // 이미지 파일이 아니어도 무시 - if(!eregi("\.(jpg|jpeg|gif|png)$", $image_obj['name'])) { + if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) { unset($obj->{$vars->name}); continue; } diff --git a/modules/member/member.controller.php b/modules/member/member.controller.php index 288e97e9d..e9d2d8048 100644 --- a/modules/member/member.controller.php +++ b/modules/member/member.controller.php @@ -1264,7 +1264,7 @@ if(!$member_info->member_srl) return; // 오픈아이디인지 체크 (일단 아이디 형식으로만 결정) - if(eregi("^([0-9a-z]+)$", $member_info->user_id)) $member_info->is_openid = false; + if(preg_match("/^([0-9a-z]+)$/is", $member_info->user_id)) $member_info->is_openid = false; else $member_info->is_openid = true; // 로그인 처리를 위한 세션 설정 @@ -1330,8 +1330,8 @@ list($args->email_id, $args->email_host) = explode('@', $args->email_address); // 홈페이지, 블로그의 주소 검사 - if($args->homepage && !eregi("^http:\/\/",$args->homepage)) $args->homepage = 'http://'.$args->homepage; - if($args->blog && !eregi("^http:\/\/",$args->blog)) $args->blog = 'http://'.$args->blog; + if($args->homepage && !preg_match("/^http:\/\//i",$args->homepage)) $args->homepage = 'http://'.$args->homepage; + if($args->blog && !preg_match("/^http:\/\//i",$args->blog)) $args->blog = 'http://'.$args->blog; // 모델 객체 생성 $oMemberModel = &getModel('member'); @@ -1433,8 +1433,8 @@ list($args->email_id, $args->email_host) = explode('@', $args->email_address); // 홈페이지, 블로그의 주소 검사 - if($args->homepage && !eregi("^http:\/\/",$args->homepage)) $args->homepage = 'http://'.$args->homepage; - if($args->blog && !eregi("^http:\/\/",$args->blog)) $args->blog = 'http://'.$args->blog; + if($args->homepage && !preg_match("/^http:\/\//is",$args->homepage)) $args->homepage = 'http://'.$args->homepage; + if($args->blog && !preg_match("/^http:\/\//is",$args->blog)) $args->blog = 'http://'.$args->blog; // 아이디, 닉네임, email address 의 중복 체크 $member_srl = $oMemberModel->getMemberSrlByUserID($args->user_id); diff --git a/modules/member/member.model.php b/modules/member/member.model.php index 66f4ee6de..789edce43 100644 --- a/modules/member/member.model.php +++ b/modules/member/member.model.php @@ -146,7 +146,7 @@ unset($info->extra_vars); if(!$extra_vars) return $info; foreach($extra_vars as $key => $val) { - if(eregi('\|\@\|', $val)) $val = explode('|@|', $val); + if(preg_match('/\|\@\|/i', $val)) $val = explode('|@|', $val); if(!$info->{$key}) $info->{$key} = $val; } return $info; diff --git a/modules/menu/menu.admin.controller.php b/modules/menu/menu.admin.controller.php index 2b236cab5..5700b0370 100644 --- a/modules/menu/menu.admin.controller.php +++ b/modules/menu/menu.admin.controller.php @@ -130,7 +130,7 @@ $xml_file = $this->makeXmlFile($args->menu_srl); // url이 mid일 경우 기록 남김 - if(eregi('^([a-zA-Z0-9\_\-]+)$', $args->url)) { + if(preg_match('/^([a-zA-Z0-9\_\-]+)$/', $args->url)) { $mid = $args->url; $mid_args->menu_srl = $args->menu_srl; @@ -337,7 +337,7 @@ $name_str = sprintf('$_names = array(%s); print $_names[$_SESSION["lang_type"]];', $name_arr_str); $url = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->url); - if(eregi('^([0-9a-zA-Z\_\-]+)$', $node->url)) $href = getUrl('','mid',$node->url); + if(preg_match('/^([0-9a-zA-Z\_\-]+)$/', $node->url)) $href = getUrl('','mid',$node->url); else $href = $url; $open_window = $node->open_window; $expand = $node->expand; @@ -407,7 +407,7 @@ // 변수 정리 $href = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->href); $url = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->url); - if(eregi('^([0-9a-zA-Z\_\-]+)$', $node->url)) $href = getUrl('','mid',$node->url); + if(preg_match('/^([0-9a-zA-Z\_\-]+)$/i', $node->url)) $href = getUrl('','mid',$node->url); else $href = $url; $open_window = $node->open_window; $normal_btn = str_replace(array('&','"','<','>'),array('&','"','<','>'),$node->normal_btn); diff --git a/modules/opage/opage.controller.php b/modules/opage/opage.controller.php index 6c6c4f64d..d23bb1528 100644 --- a/modules/opage/opage.controller.php +++ b/modules/opage/opage.controller.php @@ -85,7 +85,7 @@ function _replaceSrc($matches) { $href = $matches[4]; - if(eregi("^http", $href) || $href == '#' || eregi("javascript:",$href)) return $matches[0]; + if(preg_match("/^http/i", $href) || $href == '#' || preg_match("/javascript:/i",$href)) return $matches[0]; if(substr($href,0,1)=='/') $href = substr($href,1); $href = $this->target_path.$href; @@ -96,7 +96,7 @@ function _replaceBackgroundUrl($matches) { $href = $matches[1]; - if(eregi("^http",$href) || $href == '#' || eregi("javascript:",$href)) return $matches[0]; + if(preg_match("/^http/i",$href) || $href == '#' || preg_match("/javascript:/i",$href)) return $matches[0]; if(substr($href,0,1)=='/') $href = substr($href,1); $href = $this->target_path.$href; diff --git a/modules/opage/opage.view.php b/modules/opage/opage.view.php index a74349507..e14319737 100644 --- a/modules/opage/opage.view.php +++ b/modules/opage/opage.view.php @@ -35,7 +35,7 @@ $cache_file = sprintf("./files/cache/opage/%d.cache.php", $module_info->module_srl); // http 인지 내부 파일인지 점검 - if(eregi("^http:\/\/",$path)) $content = $this->getHtmlPage($path, $caching_interval, $cache_file); + if(preg_match("/^http:\/\//i",$path)) $content = $this->getHtmlPage($path, $caching_interval, $cache_file); else $content = $this->executeFile($path, $caching_interval, $cache_file); Context::set('opage_content', $content); @@ -97,7 +97,7 @@ // 경로와 파일이름을 구함 $tmp_path = explode('/',$cache_file); $filename = $tmp_path[count($tmp_path)-1]; - $filepath = ereg_replace($filename."$","",$cache_file); + $filepath = preg_replace('/'.$filename."$/i","",$cache_file); // 캐시 검사 if($caching_interval <1 || !file_exists($cache_file) || filemtime($cache_file) + $caching_interval*60 <= time() || filemtime($cache_file) $val) { if(strpos($key,'tidx')) continue; - if(!eregi("^(title|checkcount|item)_", $key)) continue; + if(!preg_match("/^(title|checkcount|item)_/i", $key)) continue; if(!trim($val)) continue; $tmp_arr = explode('_',$key); diff --git a/modules/spamfilter/spamfilter.model.php b/modules/spamfilter/spamfilter.model.php index 424e9045f..2686c977c 100644 --- a/modules/spamfilter/spamfilter.model.php +++ b/modules/spamfilter/spamfilter.model.php @@ -78,7 +78,7 @@ $count = count($word_list); for($i=0;$i<$count;$i++) { $word = $word_list[$i]->word; - if(eregi($word, $text)!==false) return new Object(-1,sprintf(Context::getLang('msg_alert_denied_word'), $word)); + if(preg_match('/'.$word.'/is', $text)) return new Object(-1,sprintf(Context::getLang('msg_alert_denied_word'), $word)); } return new Object(); diff --git a/modules/springnote/springnote.admin.controller.php b/modules/springnote/springnote.admin.controller.php index e0204cf33..f16764b5d 100644 --- a/modules/springnote/springnote.admin.controller.php +++ b/modules/springnote/springnote.admin.controller.php @@ -200,7 +200,7 @@ } // 이미지 파일이 아니어도 무시 - if(!eregi("\.(jpg|jpeg|gif|png)$", $image_obj['name'])) { + if(!preg_match("/\.(jpg|jpeg|gif|png)$/i", $image_obj['name'])) { unset($obj->{$vars->name}); continue; } diff --git a/modules/trackback/trackback.controller.php b/modules/trackback/trackback.controller.php index eee40ebf1..4649d5b04 100644 --- a/modules/trackback/trackback.controller.php +++ b/modules/trackback/trackback.controller.php @@ -286,7 +286,7 @@ // 결과를 기다림 (특정 서버의 경우 EOF가 떨어지지 않을 수가 있음 while(!feof($fp)) { $line = trim(fgets($fp, 4096)); - if(eregi("^",$line)) break; + if(preg_match("/^/i",$line)) break; } // socket 닫음 diff --git a/widgets/rss_reader/rss_reader.class.php b/widgets/rss_reader/rss_reader.class.php index 1e61bda13..695e5bcc2 100644 --- a/widgets/rss_reader/rss_reader.class.php +++ b/widgets/rss_reader/rss_reader.class.php @@ -49,7 +49,7 @@ fclose($fp); $encoding = preg_match("/<\?xml.*encoding=\"(.+)\".*\?>/i", $buff, $matches); - if($encoding && !eregi("UTF-8", $matches[1])) $buff = trim(iconv($matches[1]=="ks_c_5601-1987"?"EUC-KR":$matches[1], "UTF-8", $buff)); + if($encoding && !preg_match("/UTF-8/i", $matches[1])) $buff = trim(iconv($matches[1]=="ks_c_5601-1987"?"EUC-KR":$matches[1], "UTF-8", $buff)); $buff = preg_replace("/<\?xml.*\?>/i", "", $buff); @@ -99,4 +99,4 @@ return $output; } } -?> \ No newline at end of file +?>