ereg를 모두 preg로 변경

git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3528 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
zero 2008-01-15 09:07:59 +00:00
parent 3a6cb4f7f2
commit 502b5a7a88
32 changed files with 75 additions and 75 deletions

View file

@ -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;
}

View file

@ -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;
}

View file

@ -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')) {

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -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

View file

@ -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;$i<count($matches);$i++) {
$src = $matches[$i][0];
if(ereg('\/(common|modules|widgets|addons|layouts)\/', $src)) continue;
if(preg_match('/\/(common|modules|widgets|addons|layouts)\//i', $src)) continue;
else {
$target_src = $src;
break;

View file

@ -18,7 +18,7 @@
function emoticon($editor_sequence, $component_path) {
$this->editor_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("<img %s style=\"border:0px\" />", implode(" ",$attr_output));

View file

@ -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.'"';

View file

@ -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 {

View file

@ -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;
}

View file

@ -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');

View file

@ -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;
}

View file

@ -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);

View file

@ -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;
}

View file

@ -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);

View file

@ -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;

View file

@ -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('&amp;','&quot;','&lt;','&gt;'),$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('&amp;','&quot;','&lt;','&gt;'),$node->href);
$url = str_replace(array('&','"','<','>'),array('&amp;','&quot;','&lt;','&gt;'),$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('&amp;','&quot;','&lt;','&gt;'),$node->normal_btn);

View file

@ -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;

View file

@ -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)<filemtime($path) ) {

View file

@ -34,7 +34,7 @@
$vars = Context::getRequestVars();
foreach($vars as $key => $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);

View file

@ -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();

View file

@ -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;
}

View file

@ -286,7 +286,7 @@
// 결과를 기다림 (특정 서버의 경우 EOF가 떨어지지 않을 수가 있음
while(!feof($fp)) {
$line = trim(fgets($fp, 4096));
if(eregi("^<error>",$line)) break;
if(preg_match("/^<error>/i",$line)) break;
}
// socket 닫음