issue 2109 Fixed a problem in_array function

git-svn-id: http://xe-core.googlecode.com/svn/branches/1.5.0@10832 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
ovclas 2012-07-05 00:16:31 +00:00
parent e1ae5aab97
commit 1a7a68efea
18 changed files with 52 additions and 30 deletions

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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