mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-02 08:42:15 +09:00
ereg를 모두 preg로 변경
git-svn-id: http://xe-core.googlecode.com/svn/sandbox@3528 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
3a6cb4f7f2
commit
502b5a7a88
32 changed files with 75 additions and 75 deletions
|
|
@ -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 <!--Meta:파일이름.(css|js)-->를 변경
|
||||
**/
|
||||
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]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
for($i=0;$i<count($supported_list);$i++) {
|
||||
$db_type = $supported_list[$i];
|
||||
|
||||
if(version_compare(phpversion(), '5.0') < 0 && eregi('pdo',$db_type)) continue;
|
||||
if(version_compare(phpversion(), '5.0') < 0 && stripos($db_type, 'pdo') !== false) continue;
|
||||
|
||||
$class_name = sprintf("DB%s%s", strtoupper(substr($db_type,0,1)), strtolower(substr($db_type,1)));
|
||||
$class_file = sprintf("./classes/db/%s.class.php", $class_name);
|
||||
|
|
@ -278,24 +278,24 @@
|
|||
switch($filter_type) {
|
||||
case 'email' :
|
||||
case 'email_address' :
|
||||
if(!eregi('^[_0-9a-z-]+(\.[_0-9a-z-]+)*@[0-9a-z-]+(\.[0-9a-z-]+)*$', $val)) return new Object(-1, sprintf($lang->filter->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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 '';
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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';
|
||||
|
|
|
|||
|
|
@ -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]);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 = '<?php echo $this->tpl_path?>'.$path;
|
||||
|
|
@ -205,7 +205,7 @@
|
|||
$tmp_arr = explode("/", $arg);
|
||||
for($i=0;$i<count($tmp_arr);$i++) {
|
||||
$item1 = trim($tmp_arr[$i]);
|
||||
if($item1=='.'||eregi("\.html$",$item1)) continue;
|
||||
if($item1=='.'||substr($item1,-5)=='.html') continue;
|
||||
|
||||
$tmp2_arr = explode(".",$item1);
|
||||
for($j=0;$j<count($tmp2_arr);$j++) {
|
||||
|
|
@ -260,7 +260,7 @@
|
|||
if(!$given_file) return;
|
||||
|
||||
// given_file이 lang으로 끝나게 되면 언어팩을 읽도록 함
|
||||
if(ereg('lang$', $given_file)) {
|
||||
if(substr($given_file, -4)=='lang') {
|
||||
if(substr($given_file,0,2)=='./') $given_file = substr($given_file, 2);
|
||||
$lang_dir = sprintf('%s%s', $this->tpl_path, $given_file);
|
||||
if(is_dir($lang_dir)) $output = sprintf('<?php Context::loadLang("%s"); ?>', $lang_dir);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue