diff --git a/classes/context/Context.class.php b/classes/context/Context.class.php index 8b0e70682..aa591f72e 100644 --- a/classes/context/Context.class.php +++ b/classes/context/Context.class.php @@ -362,7 +362,8 @@ class Context { function checkSSO() { // pass if it's not GET request or XE is not yet installed if($this->db_info->use_sso != 'Y' || isCrawler()) return true; - if(Context::getRequestMethod()!='GET' || !Context::isInstalled() || in_array(Context::get('act'),array('rss','atom'))) return true; + $checkActList = array('rss'=>1, 'atom'=>1); + if(Context::getRequestMethod()!='GET' || !Context::isInstalled() || isset($checkActList[Context::get('act')])) return true; // pass if default URL is not set $default_url = trim($this->db_info->default_url); @@ -630,8 +631,8 @@ class Context { function setResponseMethod($method='HTML') { is_a($this,'Context')?$self=&$this:$self=&Context::getInstance(); - $methods = array('HTML','XMLRPC','JSON'); - $self->response_method = in_array($method, $methods)?$method:$methods[0]; + $methods = array('HTML'=>1, 'XMLRPC'=>1, 'JSON'=>1); + $self->response_method = isset($methods[$method]) ? $method : 'HTML'; } /* @@ -644,9 +645,9 @@ class Context { if($self->response_method) return $self->response_method; $method = $self->getRequestMethod(); - $methods = array('HTML','XMLRPC','JSON'); + $methods = array('HTML'=>1, 'XMLRPC'=>1, 'JSON'=>1); - return in_array($method, $methods)?$method:$methods[0]; + return isset($methods[$method]) ? $method : 'HTML'; } /** @@ -891,7 +892,8 @@ class Context { $key = $get_vars['key']; $srl = $get_vars['document_srl']; - $is_feed = in_array($act, array('rss', 'atom', 'api')); + $tmpArray = array('rss'=>1, 'atom'=>1, 'api'=>1); + $is_feed = isset($tmpArray[$act]); $target_map = array( 'vid'=>$vid, diff --git a/classes/db/DB.class.php b/classes/db/DB.class.php index 48fe547f2..d339947a1 100644 --- a/classes/db/DB.class.php +++ b/classes/db/DB.class.php @@ -422,7 +422,8 @@ $id = $id_args[1]; } elseif(count($id_args) == 3) { $target = $id_args[0]; - if(!in_array($target, array('addons','widgets'))){ + $typeList = array('addons'=>1, 'widgets'=>1); + if(!isset($typeList[$target])){ $this->actDBClassFinish(); return; } diff --git a/classes/db/DBMssql.class.php b/classes/db/DBMssql.class.php index eb943cf9a..fe709a177 100644 --- a/classes/db/DBMssql.class.php +++ b/classes/db/DBMssql.class.php @@ -440,6 +440,7 @@ $unique_list = array(); $index_list = array(); + $typeList = array('number'=>1, 'text'=>1); foreach($columns as $column) { $name = $column->attrs->name; $type = $column->attrs->type; @@ -454,7 +455,7 @@ $column_schema[] = sprintf('[%s] %s%s %s %s %s', $name, $this->column_type[$type], - !in_array($type,array('number','text'))&&$size?'('.$size.')':'', + !isset($typeList[$type])&&$size?'('.$size.')':'', isset($default)?"default '".$default."'":'', $notnull?'not null':'null', $auto_increment?'identity(1,1)':'' diff --git a/classes/db/queryparts/condition/Condition.class.php b/classes/db/queryparts/condition/Condition.class.php index 3f4c0a3a1..4e4a2c634 100644 --- a/classes/db/queryparts/condition/Condition.class.php +++ b/classes/db/queryparts/condition/Condition.class.php @@ -125,7 +125,11 @@ // if variable is not set or is not string or number, return if(!isset($this->_value)) { $this->_show = false; break;} if($this->_value === '') { $this->_show = false; break; } - if(!in_array(gettype($this->_value), array('string', 'integer'))) {$this->_show = false; break; } + $tmpArray = array('string'=>1, 'integer'=>1); + if(!isset($tmpArray[gettype($this->_value)])) + { + $this->_show = false; break; + } break; case 'between' : if(!is_array($this->_value)) { $this->_show = false; break;} diff --git a/classes/db/queryparts/condition/ConditionWithoutArgument.class.php b/classes/db/queryparts/condition/ConditionWithoutArgument.class.php index f8e75eef4..688b3e2df 100644 --- a/classes/db/queryparts/condition/ConditionWithoutArgument.class.php +++ b/classes/db/queryparts/condition/ConditionWithoutArgument.class.php @@ -15,7 +15,8 @@ */ function ConditionWithoutArgument($column_name, $argument, $operation, $pipe = ""){ parent::Condition($column_name, $argument, $operation, $pipe); - if(in_array($operation, array('in', 'notin', 'not_in'))){ + $tmpArray = array('in'=>1, 'notin'=>1, 'not_in'=>1); + if(isset($tmpArray[$operation])){ if(is_array($argument)) $argument = implode($argument, ','); $this->_value = '('. $argument .')'; } diff --git a/classes/db/queryparts/table/MssqlTableWithHint.class.php b/classes/db/queryparts/table/MssqlTableWithHint.class.php index 10f05035e..077456133 100644 --- a/classes/db/queryparts/table/MssqlTableWithHint.class.php +++ b/classes/db/queryparts/table/MssqlTableWithHint.class.php @@ -37,9 +37,10 @@ $result = parent::toString(); $index_hint_string = ''; + $indexTypeList = array('USE'=>1, 'FORCE'=>1); foreach($this->index_hints_list as $index_hint){ $index_hint_type = $index_hint->getIndexHintType(); - if(in_array($index_hint_type, array('USE', 'FORCE'))) + if(isset($indexTypeList[$index_hint_type])) $index_hint_string .= 'INDEX(' . $index_hint->getIndexName() . '), '; } if($index_hint_string != ''){ diff --git a/classes/frontendfile/FrontEndFileHandler.class.php b/classes/frontendfile/FrontEndFileHandler.class.php index 636564062..6e68b47c2 100644 --- a/classes/frontendfile/FrontEndFileHandler.class.php +++ b/classes/frontendfile/FrontEndFileHandler.class.php @@ -109,8 +109,8 @@ $file->cdnVersion = $cdnVersion; } - $availableExtension = array('css', 'js'); - if (!in_array($file->fileExtension, $availableExtension)) return; + $availableExtension = array('css'=>1, 'js'=>1); + if (!isset($availableExtension[$file->fileExtension])) return; $file->targetIe = $args[2]; $file->index = (int)$args[3]; diff --git a/classes/module/ModuleHandler.class.php b/classes/module/ModuleHandler.class.php index b62ce9179..0bf64f526 100644 --- a/classes/module/ModuleHandler.class.php +++ b/classes/module/ModuleHandler.class.php @@ -430,7 +430,8 @@ $procResult = $oModule->proc(); - if(!$oModule->stop_proc && !in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) + $methodList = array('XMLRPC'=>1, 'JSON'=>1); + if(!$oModule->stop_proc && !isset($methodList[Context::getRequestMethod()])) { $error = $oModule->getError(); $message = $oModule->getMessage(); @@ -522,7 +523,8 @@ if(!$output->toBool()) $this->error = $output->getMessage(); // Use message view object, if HTML call - if(!in_array(Context::getRequestMethod(),array('XMLRPC','JSON'))) { + $methodList = array('XMLRPC'=>1, 'JSON'=>1); + if(!isset($methodList[Context::getRequestMethod()])) { if($_SESSION['XE_VALIDATOR_RETURN_URL']) { @@ -634,8 +636,8 @@ $kind = strtolower($kind); $type = strtolower($type); - $kinds = explode(' ', 'svc admin'); - if(!in_array($kind, $kinds)) $kind = $kinds[0]; + $kinds = array('svc'=>1, 'admin'=>1); + if(!isset($kinds[$kind])) $kind = 'svc'; $key = $module.'.'.($kind!='admin'?'':'admin').'.'.$type; diff --git a/classes/module/ModuleObject.class.php b/classes/module/ModuleObject.class.php index 0b4104752..30949b318 100644 --- a/classes/module/ModuleObject.class.php +++ b/classes/module/ModuleObject.class.php @@ -104,7 +104,8 @@ **/ function getMessageType(){ $type = $this->get('message_type'); - if (!in_array($type, array('error', 'info', 'update'))){ + $typeList = array('error'=>1, 'info'=>1, 'update'=>1); + if (!isset($typeList[$type])){ $type = $this->getError()?'error':'info'; } return $type; diff --git a/classes/template/TemplateHandler.class.php b/classes/template/TemplateHandler.class.php index 372f54e2a..edcf8ef70 100644 --- a/classes/template/TemplateHandler.class.php +++ b/classes/template/TemplateHandler.class.php @@ -351,7 +351,7 @@ class TemplateHandler { $nodes = preg_split($split_regex, $buff, -1, PREG_SPLIT_DELIM_CAPTURE); // list of self closing tags - $self_closing = explode(',', 'area,base,basefont,br,hr,input,img,link,meta,param,frame,col'); + $self_closing = array('area'=>1,'base'=>1,'basefont'=>1,'br'=>1,'hr'=>1,'input'=>1,'img'=>1,'link'=>1,'meta'=>1,'param'=>1,'frame'=>1,'col'=>1); for($idx=1,$node_len=count($nodes); $idx < $node_len; $idx+=2) { if(!($node=$nodes[$idx])) continue; @@ -392,7 +392,7 @@ class TemplateHandler { // find closing tag $close_php = ''; - if($node{1} == '!' || substr($node,-2,1) == '/' || in_array($tag, $self_closing)) { // self closing tag + if($node{1} == '!' || substr($node,-2,1) == '/' || isset($self_closing[$tag])) { // self closing tag $nodes[$idx+1] = $close_php.$nodes[$idx+1]; } else { $depth = 1; diff --git a/classes/xml/XmlParser.class.php b/classes/xml/XmlParser.class.php index 9e3a6cbbe..366d40ba3 100644 --- a/classes/xml/XmlParser.class.php +++ b/classes/xml/XmlParser.class.php @@ -87,9 +87,10 @@ // extracts the supported lanuage when xml:lang is used if(count($matches[1]) && $supported_lang = array_unique($matches[1])) { + $tmpLangList = array_flip($supported_lang); // if lang of the first log-in user doesn't exist, apply en by default if exists. Otherwise apply the first lang. - if(!in_array($this->lang, $supported_lang)) { - if(in_array('en', $supported_lang)) { + if(!isset($tmpLangList[$this->lang])) { + if(isset($tmpLangList['en'])) { $this->lang = 'en'; } else { $this->lang = array_shift($supported_lang); diff --git a/classes/xml/XmlQueryParser.class.php b/classes/xml/XmlQueryParser.class.php index 48aea3ff5..0bc5c8a0f 100644 --- a/classes/xml/XmlQueryParser.class.php +++ b/classes/xml/XmlQueryParser.class.php @@ -35,7 +35,8 @@ $id = $id_args[1]; } elseif(count($id_args)==3) { $target = $id_args[0]; - if(!in_array($target, array('modules','addons','widgets'))) return; + $typeList = array('modules'=>1, 'addons'=>1, 'widgets'=>1); + if(!isset($typeList[$target])) return; $module = $id_args[1]; $id = $id_args[2]; } @@ -52,6 +53,7 @@ if(!$tables) return; if(!is_array($tables)) $tables = array($tables); + $joinList = array('left join'=>1, 'left outer join'=>1, 'right join'=>1, 'right outer join'=>1); foreach($tables as $key => $val) { // 테이블과 alias의 이름을 구함 @@ -61,7 +63,7 @@ $output->tables[$alias] = $table_name; - if(in_array($val->attrs->type,array('left join','left outer join','right join','right outer join')) && count($val->conditions)){ + if(isset($joinList[$val->attrs->type]) && count($val->conditions)){ $output->left_tables[$alias] = $val->attrs->type; $left_conditions[$alias] = $val->conditions; } diff --git a/classes/xml/xmlquery/QueryParser.class.php b/classes/xml/xmlquery/QueryParser.class.php index 056b123ec..ab1366a37 100644 --- a/classes/xml/xmlquery/QueryParser.class.php +++ b/classes/xml/xmlquery/QueryParser.class.php @@ -40,7 +40,8 @@ $id = $id_args[1]; } elseif (count($id_args) == 3) { $target = $id_args[0]; - if (!in_array($target, array('modules', 'addons', 'widgets'))) + $targetList = array('modules'=>1, 'addons'=>1, 'widgets'=>1); + if (!isset($targetList[$target])) return; $module = $id_args[1]; $id = $id_args[2]; diff --git a/classes/xml/xmlquery/argument/Argument.class.php b/classes/xml/xmlquery/argument/Argument.class.php index 146f097a7..7136f7d22 100644 --- a/classes/xml/xmlquery/argument/Argument.class.php +++ b/classes/xml/xmlquery/argument/Argument.class.php @@ -130,7 +130,8 @@ class Argument { if (!isset($value)) return null; - if (in_array($column_type, array('date', 'varchar', 'char', 'text', 'bigtext'))) { + $columnTypeList = array('date'=>1, 'varchar'=>1, 'char'=>1, 'text'=>1, 'bigtext'=>1); + if (isset($columnTypeList[$column_type])) { if (!is_array($value)) $value = $this->_escapeStringValue($value); else { diff --git a/classes/xml/xmlquery/argument/ConditionArgument.class.php b/classes/xml/xmlquery/argument/ConditionArgument.class.php index ce7f17934..e5471a79c 100644 --- a/classes/xml/xmlquery/argument/ConditionArgument.class.php +++ b/classes/xml/xmlquery/argument/ConditionArgument.class.php @@ -21,7 +21,8 @@ * @return void */ function ConditionArgument($name, $value, $operation){ - if(isset($value) && in_array($operation, array('in', 'notin','not_in', 'between')) && !is_array($value) && $value != ''){ + $operationList = array('in'=>1, 'notin'=>1, 'not_in'=>1, 'between'=>1); + if(isset($value) && isset($operationList[$operation]) && !is_array($value) && $value != ''){ $value = str_replace(' ', '', $value); $value = str_replace('\'', '', $value); $value = explode(',', $value); diff --git a/classes/xml/xmlquery/tags/condition/ConditionTag.class.php b/classes/xml/xmlquery/tags/condition/ConditionTag.class.php index ea82fdc25..dbb37c82a 100644 --- a/classes/xml/xmlquery/tags/condition/ConditionTag.class.php +++ b/classes/xml/xmlquery/tags/condition/ConditionTag.class.php @@ -70,7 +70,8 @@ } else { if(isset($condition->attrs->default)){ - if(in_array($this->operation, array('in', 'between', 'not in'))){ + $operationList = array('in'=>1, 'between'=>1, 'not in'=>1); + if(isset($operationList[$this->operation])){ $default_value = $condition->attrs->default; if(strpos($default_value, "'") !== false) $default_value = "\"" . $default_value . "\""; diff --git a/classes/xml/xmlquery/tags/navigation/IndexTag.class.php b/classes/xml/xmlquery/tags/navigation/IndexTag.class.php index d51505fd9..3f3a5bc7c 100644 --- a/classes/xml/xmlquery/tags/navigation/IndexTag.class.php +++ b/classes/xml/xmlquery/tags/navigation/IndexTag.class.php @@ -49,7 +49,8 @@ // Sort order - asc / desc $this->sort_order = $index->attrs->order; - if(!in_array($this->sort_order, array("asc", "desc"))){ + $sortList = array('asc'=>1, 'desc'=>1); + if(!isset($sortList[$this->sort_order])){ $arg = new Xml_Node_(); $arg->attrs = new Xml_Node_(); $arg->attrs->var = $this->sort_order; diff --git a/classes/xml/xmlquery/tags/table/TableTag.class.php b/classes/xml/xmlquery/tags/table/TableTag.class.php index 80fffac1f..1c4d066af 100644 --- a/classes/xml/xmlquery/tags/table/TableTag.class.php +++ b/classes/xml/xmlquery/tags/table/TableTag.class.php @@ -75,7 +75,8 @@ } function isJoinTable(){ - if(in_array($this->join_type,array('left join','left outer join','right join','right outer join')) + $joinList = array('left join'=>1, 'left outer join'=>1, 'right join'=>1, 'right outer join'=>1); + if(isset($joinList[$this->join_type]) && count($this->conditions)) return true; return false; }