@@ -12,88 +12,63 @@ | |||||
function GetFieldMake($dtype, $fieldname, $dfvalue, $mxlen) | function GetFieldMake($dtype, $fieldname, $dfvalue, $mxlen) | ||||
{ | { | ||||
$fields = array(); | $fields = array(); | ||||
if ($dtype == "int" || $dtype == "datetime") | |||||
{ | |||||
if ($dfvalue == "" || preg_match("#[^0-9-]#", $dfvalue)) | |||||
{ | |||||
if ($dtype == "int" || $dtype == "datetime") { | |||||
if ($dfvalue == "" || preg_match("#[^0-9-]#", $dfvalue)) { | |||||
$dfvalue = 0; | $dfvalue = 0; | ||||
} | } | ||||
$fields[0] = " `$fieldname` int(11) NOT NULL default '$dfvalue';"; | $fields[0] = " `$fieldname` int(11) NOT NULL default '$dfvalue';"; | ||||
$fields[1] = "int(11)"; | $fields[1] = "int(11)"; | ||||
} | |||||
else if ($dtype == "stepselect") | |||||
{ | |||||
if ($dfvalue == "" || preg_match("#[^0-9\.-]#", $dfvalue)) | |||||
{ | |||||
} else if ($dtype == "stepselect") { | |||||
if ($dfvalue == "" || preg_match("#[^0-9\.-]#", $dfvalue)) { | |||||
$dfvalue = 0; | $dfvalue = 0; | ||||
} | } | ||||
$fields[0] = " `$fieldname` char(20) NOT NULL default '$dfvalue';"; | $fields[0] = " `$fieldname` char(20) NOT NULL default '$dfvalue';"; | ||||
$fields[1] = "char(20)"; | $fields[1] = "char(20)"; | ||||
} | |||||
else if ($dtype == "float") | |||||
{ | |||||
if ($dfvalue == "" || preg_match("#[^0-9\.-]#", $dfvalue)) | |||||
{ | |||||
} else if ($dtype == "float") { | |||||
if ($dfvalue == "" || preg_match("#[^0-9\.-]#", $dfvalue)) { | |||||
$dfvalue = 0; | $dfvalue = 0; | ||||
} | } | ||||
$fields[0] = " `$fieldname` float NOT NULL default '$dfvalue';"; | $fields[0] = " `$fieldname` float NOT NULL default '$dfvalue';"; | ||||
$fields[1] = "float"; | $fields[1] = "float"; | ||||
} | |||||
else if ($dtype == "img" || $dtype == "media" || $dtype == "addon" || $dtype == "imgfile") | |||||
{ | |||||
} else if ($dtype == "img" || $dtype == "media" || $dtype == "addon" || $dtype == "imgfile") { | |||||
if (empty($dfvalue)) $dfvalue = ''; | if (empty($dfvalue)) $dfvalue = ''; | ||||
if ($mxlen=="") $mxlen = 200; | if ($mxlen=="") $mxlen = 200; | ||||
if ($mxlen > 255) $mxlen = 100; | if ($mxlen > 255) $mxlen = 100; | ||||
$fields[0] = " `$fieldname` varchar($mxlen) NOT NULL default '$dfvalue';"; | $fields[0] = " `$fieldname` varchar($mxlen) NOT NULL default '$dfvalue';"; | ||||
$fields[1] = "varchar($mxlen)"; | $fields[1] = "varchar($mxlen)"; | ||||
} | |||||
else if ($dtype == "multitext" || $dtype == "htmltext") | |||||
{ | |||||
} else if ($dtype == "multitext" || $dtype == "htmltext") { | |||||
$fields[0] = " `$fieldname` mediumtext;"; | $fields[0] = " `$fieldname` mediumtext;"; | ||||
$fields[1] = "mediumtext"; | $fields[1] = "mediumtext"; | ||||
} | |||||
else if ($dtype=="textdata") | |||||
{ | |||||
} else if ($dtype=="textdata") { | |||||
if (empty($dfvalue)) $dfvalue = ''; | if (empty($dfvalue)) $dfvalue = ''; | ||||
$fields[0] = " `$fieldname` varchar(100) NOT NULL default '';"; | $fields[0] = " `$fieldname` varchar(100) NOT NULL default '';"; | ||||
$fields[1] = "varchar(100)"; | $fields[1] = "varchar(100)"; | ||||
} | |||||
else if ($dtype=="relation") { | |||||
} else if ($dtype=="relation") { | |||||
if (empty($dfvalue)) $dfvalue = ''; | if (empty($dfvalue)) $dfvalue = ''; | ||||
$fields[0] = " `$fieldname` TEXT NOT NULL default '$dfvalue';"; | $fields[0] = " `$fieldname` TEXT NOT NULL default '$dfvalue';"; | ||||
$fields[1] = "TEXT"; | $fields[1] = "TEXT"; | ||||
} | |||||
else if ($dtype=="textchar") | |||||
{ | |||||
} else if ($dtype=="textchar") { | |||||
if (empty($dfvalue)) $dfvalue = ''; | if (empty($dfvalue)) $dfvalue = ''; | ||||
$fields[0] = " `$fieldname` char(100) NOT NULL default '$dfvalue';"; | $fields[0] = " `$fieldname` char(100) NOT NULL default '$dfvalue';"; | ||||
$fields[1] = "char(100)"; | $fields[1] = "char(100)"; | ||||
} | |||||
else if ($dtype=="checkbox") | |||||
{ | |||||
} else if ($dtype=="checkbox") { | |||||
$dfvalue = str_replace(',',"','",$dfvalue); | $dfvalue = str_replace(',',"','",$dfvalue); | ||||
$dfvalue = "'".$dfvalue."'"; | $dfvalue = "'".$dfvalue."'"; | ||||
$fields[0] = " `$fieldname` SET($dfvalue) NULL;"; | $fields[0] = " `$fieldname` SET($dfvalue) NULL;"; | ||||
$fields[1] = "SET($dfvalue)"; | $fields[1] = "SET($dfvalue)"; | ||||
} | |||||
else if ($dtype=="select" || $dtype=="radio") | |||||
{ | |||||
} else if ($dtype=="select" || $dtype=="radio") { | |||||
$dfvalue = str_replace(',', "','", $dfvalue); | $dfvalue = str_replace(',', "','", $dfvalue); | ||||
$dfvalue = "'".$dfvalue."'"; | $dfvalue = "'".$dfvalue."'"; | ||||
$fields[0] = " `$fieldname` enum($dfvalue) NULL;"; | $fields[0] = " `$fieldname` enum($dfvalue) NULL;"; | ||||
$fields[1] = "enum($dfvalue)"; | $fields[1] = "enum($dfvalue)"; | ||||
} else { | } else { | ||||
if (empty($dfvalue)) | |||||
{ | |||||
if (empty($dfvalue)) { | |||||
$dfvalue = ''; | $dfvalue = ''; | ||||
} | } | ||||
if (empty($mxlen)) | |||||
{ | |||||
if (empty($mxlen)) { | |||||
$mxlen = 100; | $mxlen = 100; | ||||
} | } | ||||
if ($mxlen > 255) | |||||
{ | |||||
if ($mxlen > 255) { | |||||
$mxlen = 250; | $mxlen = 250; | ||||
} | } | ||||
$fields[0] = " `$fieldname` varchar($mxlen) NOT NULL default '$dfvalue';"; | $fields[0] = " `$fieldname` varchar($mxlen) NOT NULL default '$dfvalue';"; | ||||
@@ -114,12 +89,10 @@ function GetAddFieldList(&$dtp,&$oksetting) | |||||
$oklist = ''; | $oklist = ''; | ||||
$dtp->SetNameSpace("field","<",">"); | $dtp->SetNameSpace("field","<",">"); | ||||
$dtp->LoadSource($oksetting); | $dtp->LoadSource($oksetting); | ||||
if (is_array($dtp->CTags)) | |||||
{ | |||||
if (is_array($dtp->CTags)) { | |||||
foreach($dtp->CTags as $tagid=>$ctag) | foreach($dtp->CTags as $tagid=>$ctag) | ||||
{ | { | ||||
if ($ctag->GetAtt('islist')==1) | |||||
{ | |||||
if ($ctag->GetAtt('islist')==1) { | |||||
$oklist .= ($oklist=='' ? strtolower($ctag->GetName()) : ','.strtolower($ctag->GetName()) ); | $oklist .= ($oklist=='' ? strtolower($ctag->GetName()) : ','.strtolower($ctag->GetName()) ); | ||||
} | } | ||||
} | } | ||||
@@ -47,9 +47,7 @@ function GetCurContentAlbum($body, $rfurl, &$firstdd) | |||||
foreach ($img_array as $key => $value) { | foreach ($img_array as $key => $value) { | ||||
$value = trim($value); | $value = trim($value); | ||||
if ( | if ( | ||||
preg_match("#".$basehost."#i", $value) || !preg_match("#^http:\/\/#i", $value) | |||||
|| ($cfg_basehost != $basehost && preg_match("#".$cfg_basehost."#i", $value)) | |||||
) { | |||||
preg_match("#".$basehost."#i", $value) || !preg_match("#^http:\/\/#i", $value) || ($cfg_basehost != $basehost && preg_match("#".$cfg_basehost."#i", $value))) { | |||||
continue; | continue; | ||||
} | } | ||||
$itype = substr($value, -4, 4); | $itype = substr($value, -4, 4); | ||||
@@ -136,7 +136,7 @@ class FreeList | |||||
$addSql .= " AND FIND_IN_SET('c',flag) > 0 "; | $addSql .= " AND FIND_IN_SET('c',flag) > 0 "; | ||||
} | } | ||||
if (preg_match("#image#i", $listtype)) { | if (preg_match("#image#i", $listtype)) { | ||||
$addSql .= " AND litpic <> '' "; | |||||
$addSql .= " AND litpic <> '' "; | |||||
} | } | ||||
if (preg_match("#spec#i", $listtype) || $channelid == -1) { | if (preg_match("#spec#i", $listtype) || $channelid == -1) { | ||||
$addSql .= " AND channel = -1 "; | $addSql .= " AND channel = -1 "; | ||||
@@ -417,7 +417,7 @@ class FreeList | |||||
$orwhere .= " AND FIND_IN_SET('c',flag) > 0 "; | $orwhere .= " AND FIND_IN_SET('c',flag) > 0 "; | ||||
} | } | ||||
if (preg_match("#image#i", $listtype)) { | if (preg_match("#image#i", $listtype)) { | ||||
$orwhere .= " AND arc.litpic <> '' "; | |||||
$orwhere .= " AND arc.litpic <> '' "; | |||||
} | } | ||||
if (preg_match("#spec#i", $listtype) || $channelid == -1) { | if (preg_match("#spec#i", $listtype) || $channelid == -1) { | ||||
$orwhere .= " AND arc.channel = -1 "; | $orwhere .= " AND arc.channel = -1 "; | ||||
@@ -86,7 +86,7 @@ class ListView | |||||
if ($this->TypeLink->TypeInfos['cross'] > 0 && $this->TypeLink->TypeInfos['ispart'] == 0) { | if ($this->TypeLink->TypeInfos['cross'] > 0 && $this->TypeLink->TypeInfos['ispart'] == 0) { | ||||
$selquery = ''; | $selquery = ''; | ||||
if ($this->TypeLink->TypeInfos['cross'] == 1) { | if ($this->TypeLink->TypeInfos['cross'] == 1) { | ||||
$selquery = "SELECT id,topid FROM `#@__arctype` WHERE typename LIKE '{$this->Fields['typename']}' AND id<>'{$this->TypeID}' AND topid<>'{$this->TypeID}' "; | |||||
$selquery = "SELECT id,topid FROM `#@__arctype` WHERE typename LIKE '{$this->Fields['typename']}' AND id<>'{$this->TypeID}' AND topid<>'{$this->TypeID}' "; | |||||
} else { | } else { | ||||
$this->Fields['crossid'] = preg_replace('/[^0-9,]/', '', trim($this->Fields['crossid'])); | $this->Fields['crossid'] = preg_replace('/[^0-9,]/', '', trim($this->Fields['crossid'])); | ||||
if ($this->Fields['crossid'] != '') { | if ($this->Fields['crossid'] != '') { | ||||
@@ -82,7 +82,7 @@ class SgListView | |||||
if ($this->TypeLink->TypeInfos['cross'] > 0 && $this->TypeLink->TypeInfos['ispart'] == 0) { | if ($this->TypeLink->TypeInfos['cross'] > 0 && $this->TypeLink->TypeInfos['ispart'] == 0) { | ||||
$selquery = ''; | $selquery = ''; | ||||
if ($this->TypeLink->TypeInfos['cross'] == 1) { | if ($this->TypeLink->TypeInfos['cross'] == 1) { | ||||
$selquery = "SELECT id,topid FROM `#@__arctype` WHERE typename LIKE '{$this->Fields['typename']}' AND id<>'{$this->TypeID}' AND topid<>'{$this->TypeID}' "; | |||||
$selquery = "SELECT id,topid FROM `#@__arctype` WHERE typename LIKE '{$this->Fields['typename']}' AND id<>'{$this->TypeID}' AND topid<>'{$this->TypeID}' "; | |||||
} else { | } else { | ||||
$this->Fields['crossid'] = preg_replace("/[^0-9,]/", '', trim($this->Fields['crossid'])); | $this->Fields['crossid'] = preg_replace("/[^0-9,]/", '', trim($this->Fields['crossid'])); | ||||
if ($this->Fields['crossid'] != '') { | if ($this->Fields['crossid'] != '') { | ||||
@@ -192,10 +192,10 @@ function lib_arclistDone (&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlele | |||||
} else { | } else { | ||||
$selquery = ''; | $selquery = ''; | ||||
if ($arr['cross'] == 1) { | if ($arr['cross'] == 1) { | ||||
$selquery = "SELECT id,topid FROM `#@__arctype` WHERE typename LIKE '{$arr['typename']}' AND id<>'{$typeid}' AND topid<>'{$typeid}' "; | |||||
$selquery = "SELECT id,topid FROM `#@__arctype` WHERE typename LIKE '{$arr['typename']}' AND id<>'{$typeid}' AND topid<>'{$typeid}' "; | |||||
} else { | } else { | ||||
$arr['crossid'] = preg_replace('#[^0-9,]#', '', trim($arr['crossid'])); | $arr['crossid'] = preg_replace('#[^0-9,]#', '', trim($arr['crossid'])); | ||||
if ($arr['crossid'] != '') $selquery = "SELECT id,topid FROM `#@__arctype` WHERE id IN('{$arr['crossid']}') AND id<>'{$typeid}' AND topid<>'{$typeid}' "; | |||||
if ($arr['crossid'] != '') $selquery = "SELECT id,topid FROM `#@__arctype` WHERE id IN('{$arr['crossid']}') AND id<>'{$typeid}' AND topid<>'{$typeid}' "; | |||||
} | } | ||||
if ($selquery != '') { | if ($selquery != '') { | ||||
$dsql->SetQuery($selquery); | $dsql->SetQuery($selquery); | ||||
@@ -82,15 +82,14 @@ function lib_arclistsg(&$ctag, &$refObj) | |||||
$CrossID = ''; | $CrossID = ''; | ||||
if ((isset($envs['cross']) || $ctag->GetAtt('cross') == '1') && $ctag->GetAtt('nocross') != '1') { | if ((isset($envs['cross']) || $ctag->GetAtt('cross') == '1') && $ctag->GetAtt('nocross') != '1') { | ||||
$arr = $dsql->GetOne("SELECT `id`,`topid`,`cross`,`crossid`,`ispart`,`typename` FROM `#@__arctype` WHERE id='$typeid' "); | $arr = $dsql->GetOne("SELECT `id`,`topid`,`cross`,`crossid`,`ispart`,`typename` FROM `#@__arctype` WHERE id='$typeid' "); | ||||
if ($arr['cross'] == 0 || ($arr['cross'] == 2 && trim($arr['crossid'] == ''))) | |||||
$orwheres[] = ' typeid IN ('.GetSonIds($typeid).')'; | |||||
if ($arr['cross'] == 0 || ($arr['cross'] == 2 && trim($arr['crossid'] == ''))) $orwheres[] = ' typeid IN ('.GetSonIds($typeid).')'; | |||||
else { | else { | ||||
$selquery = ''; | $selquery = ''; | ||||
if ($arr['cross'] == 1) { | if ($arr['cross'] == 1) { | ||||
$selquery = "SELECT id,topid FROM `#@__arctype` WHERE typename like '{$arr['typename']}' AND id<>'{$typeid}' AND topid<>'{$typeid}' "; | |||||
$selquery = "SELECT id,topid FROM `#@__arctype` WHERE typename like '{$arr['typename']}' AND id<>'{$typeid}' AND topid<>'{$typeid}' "; | |||||
} else { | } else { | ||||
$arr['crossid'] = preg_replace('#[^0-9,]#', '', trim($arr['crossid'])); | $arr['crossid'] = preg_replace('#[^0-9,]#', '', trim($arr['crossid'])); | ||||
if ($arr['crossid'] != '') $selquery = "SELECT id,topid FROM `#@__arctype` WHERE id IN('{$arr['crossid']}') AND id<>'{$typeid}' AND topid<>'{$typeid}' "; | |||||
if ($arr['crossid'] != '') $selquery = "SELECT id,topid FROM `#@__arctype` WHERE id IN('{$arr['crossid']}') AND id<>'{$typeid}' AND topid<>'{$typeid}' "; | |||||
} | } | ||||
if ($selquery != '') { | if ($selquery != '') { | ||||
$dsql->SetQuery($selquery); | $dsql->SetQuery($selquery); | ||||
@@ -218,9 +218,7 @@ function PrintAutoFieldsEdit(&$fieldset, &$fieldValues, $loadtype = 'all') | |||||
if (is_array($dtp->CTags)) { | if (is_array($dtp->CTags)) { | ||||
foreach ($dtp->CTags as $tid => $ctag) { | foreach ($dtp->CTags as $tid => $ctag) { | ||||
if ( | if ( | ||||
$loadtype != 'autofield' | |||||
|| ($loadtype == 'autofield' && $ctag->GetAtt('autofield') == 1) | |||||
) { | |||||
$loadtype != 'autofield' || ($loadtype == 'autofield' && $ctag->GetAtt('autofield') == 1)) { | |||||
$dede_addonfields .= ($dede_addonfields == '' ? $ctag->GetName().",".$ctag->GetAtt('type') : ";".$ctag->GetName().",".$ctag->GetAtt('type')); | $dede_addonfields .= ($dede_addonfields == '' ? $ctag->GetName().",".$ctag->GetAtt('type') : ";".$ctag->GetName().",".$ctag->GetAtt('type')); | ||||
echo GetFormItemValueA($ctag, $fieldValues[$ctag->GetName()]); | echo GetFormItemValueA($ctag, $fieldValues[$ctag->GetName()]); | ||||
} | } | ||||