diff --git a/src/data/admin/allowurl.txt b/src/data/admin/allowurl.txt index 1a42fe45..73f28e44 100755 --- a/src/data/admin/allowurl.txt +++ b/src/data/admin/allowurl.txt @@ -1,4 +1,2 @@ www.dedebiz.com -www.zhelixie.com -www.dedecms.com -bbs.dedecms.com \ No newline at end of file +www.zhelixie.com \ No newline at end of file diff --git a/src/data/admin/config_update.php b/src/data/admin/config_update.php index 04048973..b993c434 100755 --- a/src/data/admin/config_update.php +++ b/src/data/admin/config_update.php @@ -1,7 +1,8 @@ Search(); include DedeInclude('templets/action_search.htm'); diff --git a/src/dede/actionsearch_class.php b/src/dede/actionsearch_class.php index aa974728..fa96f8e4 100755 --- a/src/dede/actionsearch_class.php +++ b/src/dede/actionsearch_class.php @@ -1,12 +1,13 @@ asarray = $this->GetSearchstr(); $this->keyword = $keyword; } - + //初始化系统 - function ActionSearch($keyword){ + function ActionSearch($keyword) + { $this->__construct($keyword); } - + function GetSearchstr() { - require_once(dirname(__FILE__)."/inc/inc_action_info.php"); - return is_array($actionSearch)? $actionSearch : array(); + require_once(dirname(__FILE__) . "/inc/inc_action_info.php"); + return is_array($actionSearch) ? $actionSearch : array(); } - - function search(){ + + function search() + { $this->searchkeyword(); return $this->result; } - + /** * 遍历功能配置项进行关键词匹配 * * @return void */ - function searchkeyword(){ + function searchkeyword() + { $i = 0; //数组序列索引 - foreach ($this->asarray as $key=>$value) - { + foreach ($this->asarray as $key => $value) { //对二级项目进行匹配 - if(is_array($this->asarray[$key]['soniterm'])) - { - foreach ($this->asarray[$key]['soniterm'] as $k=> $val) - { + if (is_array($this->asarray[$key]['soniterm'])) { + foreach ($this->asarray[$key]['soniterm'] as $k => $val) { //进行权限判断 - if(TestPurview($val['purview'])) - { + if (TestPurview($val['purview'])) { //如果有操作权限 - if($this->_strpos($val['title'], $this->keyword) !== false || $this->_strpos($val['description'], $this->keyword)!== false) - { + if ($this->_strpos($val['title'], $this->keyword) !== false || $this->_strpos($val['description'], $this->keyword) !== false) { //一级项目匹配 $this->result[$i]['toptitle'] = $this->redColorKeyword($this->asarray[$key]['toptitle']); $this->result[$i]['title'] = $this->redColorKeyword($this->asarray[$key]['title']); @@ -75,25 +74,24 @@ class ActionSearch * @param string $text 关键词 * @return string */ - function redColorKeyword($text){ - if(is_array($text)) - { + function redColorKeyword($text) + { + if (is_array($text)) { foreach ($text as $key => $value) { - if($key == 'title' || $key == 'description') - { + if ($key == 'title' || $key == 'description') { //仅对title,description进行数组替换 - $text[$key] = str_replace($this->keyword,''.$this->keyword.'',$text[$key]); - } + $text[$key] = str_replace($this->keyword, '' . $this->keyword . '', $text[$key]); + } } } else { - $text = str_replace($this->keyword,''.$this->keyword.'',$text); + $text = str_replace($this->keyword, '' . $this->keyword . '', $text); } return $text; } - - function _strpos($string,$find) + + function _strpos($string, $find) { - if (function_exists('stripos')) return stripos($string,$find); - return strpos($string,$find); + if (function_exists('stripos')) return stripos($string, $find); + return strpos($string, $find); } -} \ No newline at end of file +} diff --git a/src/dede/ad_add.php b/src/dede/ad_add.php index 664b3659..54ce80d4 100755 --- a/src/dede/ad_add.php +++ b/src/dede/ad_add.php @@ -1,78 +1,58 @@ GetOne("SELECT typeid FROM #@__myad WHERE typeid='$typeid' AND tagname LIKE '$tagname'"); - if(is_array($row)) - { - ShowMsg("在相同栏目下已经存在同名的标记!","-1"); + if (is_array($row)) { + ShowMsg("在相同栏目下已经存在同名的标记!", "-1"); exit(); } $starttime = GetMkTime($starttime); $endtime = GetMkTime($endtime); $link = addslashes($normbody['link']); - if($normbody['style']=='code') - { + if ($normbody['style'] == 'code') { $normbody = addslashes($normbody['htmlcode']); - } - else if($normbody['style']=='txt') - { - + } else if ($normbody['style'] == 'txt') { + $normbody = "{$normbody['title']}"; - } - else if($normbody['style']=='img') - { - if(empty($normbody['width'])) - { + } else if ($normbody['style'] == 'img') { + if (empty($normbody['width'])) { $width = ""; - } - else - { + } else { $width = " width=\"{$normbody['width']}\""; } - if (empty($normbody['height'])) - { + if (empty($normbody['height'])) { $height = ""; - } - else - { + } else { $height = "height=\"{$normbody['height']}\""; } $normbody = ""; - } - else - { - if(empty($normbody['width'])) - { + } else { + if (empty($normbody['width'])) { $width = ""; - } - else - { + } else { $width = " width=\"{$normbody['width']}\""; } - if (empty($normbody['height'])) - { + if (empty($normbody['height'])) { $height = ""; - } - else - { + } else { $height = "height=\"{$normbody['height']}\""; } $normbody = ""; @@ -82,17 +62,16 @@ if($dopost=="save") VALUES('$clsid','$typeid','$tagname','$adname','$timeset','$starttime','$endtime','$normbody','$expbody'); "; $dsql->ExecuteNoneQuery($query); - ShowMsg("成功增加一个广告!","ad_main.php"); + ShowMsg("成功增加一个广告!", "ad_main.php"); exit(); } -$dsql->Execute('dd','SELECT * FROM `#@__myadtype` ORDER BY id DESC'); +$dsql->Execute('dd', 'SELECT * FROM `#@__myadtype` ORDER BY id DESC'); $option = ''; -while($arr = $dsql->GetArray('dd')) -{ +while ($arr = $dsql->GetArray('dd')) { $option .= "\n\r"; } $startDay = time(); -$endDay = AddDay($startDay,30); +$endDay = AddDay($startDay, 30); $startDay = GetDateTimeMk($startDay); $endDay = GetDateTimeMk($endDay); -include DedeInclude('templets/ad_add.htm'); \ No newline at end of file +include DedeInclude('templets/ad_add.htm'); diff --git a/src/dede/ad_edit.php b/src/dede/ad_edit.php index 1f8c4224..9be3fe30 100755 --- a/src/dede/ad_edit.php +++ b/src/dede/ad_edit.php @@ -1,35 +1,33 @@ ExecuteNoneQuery("DELETE FROM `#@__myad` WHERE aid='$aid' "); - ShowMsg("成功删除一则广告代码!",$ENV_GOBACK_URL); + ShowMsg("成功删除一则广告代码!", $ENV_GOBACK_URL); exit(); -} -else if($dopost=="gettag") -{ - require_once(DEDEINC.'/oxwindow.class.php'); +} else if ($dopost == "gettag") { + require_once(DEDEINC . '/oxwindow.class.php'); $jscode = ""; $showhtml = "\r\n\r\n$jscode\r\n\r\n"; $showhtml .= "预览:"; $row = $dsql->GetOne("SELECT tagname from `#@__myad` WHERE aid='$aid' "); - - $showtag = '{'."dede:myad name='{$row['tagname']}'/".'}'; + + $showtag = '{' . "dede:myad name='{$row['tagname']}'/" . '}'; $info = "说明:如果嵌入的是织梦CMS广告标签,那么将会解析成标签中的内容到页面,广告更改后需要重新生成。
如果不希望重新生成所有页面,则直接调用JS代码即可。 "; @@ -37,22 +35,18 @@ else if($dopost=="gettag") $wecome_info = "广告管理::获取JS"; $win = new OxWindow(); $win->Init(); - $winform = $win->GetWindow("hand",$info); + $winform = $win->GetWindow("hand", $info); $win->AddTitle("织梦CMS标签调用代码:"); - $winform = $win->GetWindow("hand",$showtag); + $winform = $win->GetWindow("hand", $showtag); $win->myWinItem = ''; $win->AddTitle("以下为选定广告的JS调用代码:"); - $winform = $win->GetWindow("hand",$showhtml); + $winform = $win->GetWindow("hand", $showhtml); $win->Display(); exit(); -} -else if($dopost=='testjs') -{ +} else if ($dopost == 'testjs') { echo ""; exit(); -} -else if($dopost=='saveedit') -{ +} else if ($dopost == 'saveedit') { CheckCSRF(); $starttime = GetMkTime($starttime); $endtime = GetMkTime($endtime); @@ -69,20 +63,18 @@ else if($dopost=='saveedit') WHERE aid='$aid' "; $dsql->ExecuteNoneQuery($query); - ShowMsg("成功更改一则广告代码!",$ENV_GOBACK_URL); + ShowMsg("成功更改一则广告代码!", $ENV_GOBACK_URL); exit(); } $row = $dsql->GetOne("SELECT * FROM `#@__myad` WHERE aid='$aid'"); -$dsql->Execute('dd','SELECT * FROM `#@__myadtype` ORDER BY id DESC'); +$dsql->Execute('dd', 'SELECT * FROM `#@__myadtype` ORDER BY id DESC'); $option = ''; -while($arr = $dsql->GetArray('dd')) -{ - if ($arr['id'] == $row['clsid']) - { +while ($arr = $dsql->GetArray('dd')) { + if ($arr['id'] == $row['clsid']) { $option .= "\n\r"; } else { $option .= "\n\r"; } } -include DedeInclude('templets/ad_edit.htm'); \ No newline at end of file +include DedeInclude('templets/ad_edit.htm'); diff --git a/src/dede/ad_main.php b/src/dede/ad_main.php index 623887f6..2782eeae 100755 --- a/src/dede/ad_main.php +++ b/src/dede/ad_main.php @@ -1,35 +1,34 @@ Execute('dd','SELECT * FROM `#@__myadtype` ORDER BY id DESC'); +$dsql->Execute('dd', 'SELECT * FROM `#@__myadtype` ORDER BY id DESC'); $option = ''; -while($arr = $dsql->GetArray('dd')) -{ - if ($arr['id'] == $clsid) - { +while ($arr = $dsql->GetArray('dd')) { + if ($arr['id'] == $clsid) { $option .= "\n\r"; } else { $option .= "\n\r"; } } $where_sql = ' 1=1'; -if($clsid!=0) $where_sql .= " AND clsid = $clsid"; -if($keyword!='') $where_sql .= " AND (ad.adname like '%$keyword%') "; +if ($clsid != 0) $where_sql .= " AND clsid = $clsid"; +if ($keyword != '') $where_sql .= " AND (ad.adname like '%$keyword%') "; $sql = "SELECT ad.aid,ad.clsid,ad.tagname,tp.typename as typename,ad.adname,ad.timeset,ad.endtime,ap.typename as clsname FROM `#@__myad` ad @@ -38,30 +37,24 @@ LEFT JOIN `#@__myadtype` ap on ap.id=ad.clsid WHERE $where_sql ORDER BY ad.aid desc"; $dlist = new DataListCP(); -$dlist->SetTemplet(DEDEADMIN."/templets/ad_main.htm"); +$dlist->SetTemplet(DEDEADMIN . "/templets/ad_main.htm"); $dlist->SetSource($sql); $dlist->display(); -function TestType($tname, $type="") +function TestType($tname, $type = "") { - if($tname=="") - { - return ($type == 1)? "默认分类" : "所有栏目"; - } - else - { + if ($tname == "") { + return ($type == 1) ? "默认分类" : "所有栏目"; + } else { return $tname; } } function TimeSetValue($ts) { - if($ts==0) - { + if ($ts == 0) { return "不限时间"; - } - else - { + } else { return "限时标记"; } -} \ No newline at end of file +} diff --git a/src/dede/adtype_main.php b/src/dede/adtype_main.php index 4e6ff080..322f3dc0 100755 --- a/src/dede/adtype_main.php +++ b/src/dede/adtype_main.php @@ -1,43 +1,37 @@ ExecuteNoneQuery($query); } - } - else - { + } else { $query = "DELETE FROM `#@__myadtype` WHERE id='$tid' "; $dsql->ExecuteNoneQuery($query); } } //增加新记录 - if(isset($check_new) && $pname_new!='') - { + if (isset($check_new) && $pname_new != '') { $query = "INSERT INTO `#@__myadtype`(typename) VALUES('{$pname_new}');"; $dsql->ExecuteNoneQuery($query); } @@ -46,4 +40,4 @@ if($dopost=="save") exit; } -include DedeInclude('templets/adtype_main.htm'); \ No newline at end of file +include DedeInclude('templets/adtype_main.htm'); diff --git a/src/dede/album_add.php b/src/dede/album_add.php index e8c34e98..6566bd6c 100755 --- a/src/dede/album_add.php +++ b/src/dede/album_add.php @@ -1,43 +1,40 @@ 0 && $channelid==0) - { + if ($cid > 0 && $channelid == 0) { $row = $dsql->GetOne("SELECT channeltype FROM `#@__arctype` WHERE id='$cid'; "); $channelid = $row['channeltype']; - } - else - { - if($channelid==0) $channelid = 2; + } else { + if ($channelid == 0) $channelid = 2; } //获得频道模型信息 $cInfos = $dsql->GetOne(" SELECT * FROM `#@__channeltype` WHERE id='$channelid' "); $channelid = $cInfos['id']; - + //获取文章最大id以确定当前权重 $maxWright = $dsql->GetOne("SELECT COUNT(*) AS cc FROM #@__archives"); include DedeInclude("templets/album_add.htm"); @@ -45,122 +42,112 @@ if($dopost != 'save') } /*-------------------------------- function __save(){ } --------------------------------*/ -else if($dopost=='save') -{ - require_once(DEDEINC.'/image.func.php'); - require_once(DEDEINC.'/oxwindow.class.php'); - - $flag = isset($flags) ? join(',',$flags) : ''; - $notpost = isset($notpost) && $notpost == 1 ? 1: 0; - if(empty($click)) $click = ($cfg_arc_click=='-1' ? mt_rand(50, 200) : $cfg_arc_click); - - if(!isset($typeid2)) $typeid2 = 0; - if(!isset($autokey)) $autokey = 0; - if(!isset($remote)) $remote = 0; - if(!isset($dellink)) $dellink = 0; - if(!isset($autolitpic)) $autolitpic = 0; - if(!isset($formhtml)) $formhtml = 0; - if(!isset($formzip)) $formzip = 0; - if(!isset($ddisfirst)) $ddisfirst = 0; - if(!isset($albums)) $albums = ""; - if(!isset($delzip)) $delzip = 0; - if(empty($click)) $click = ($cfg_arc_click=='-1' ? mt_rand(50, 200) : $cfg_arc_click); - - if($typeid==0) - { +-------------------------------*/ else if ($dopost == 'save') { + require_once(DEDEINC . '/image.func.php'); + require_once(DEDEINC . '/oxwindow.class.php'); + + $flag = isset($flags) ? join(',', $flags) : ''; + $notpost = isset($notpost) && $notpost == 1 ? 1 : 0; + if (empty($click)) $click = ($cfg_arc_click == '-1' ? mt_rand(50, 200) : $cfg_arc_click); + + if (!isset($typeid2)) $typeid2 = 0; + if (!isset($autokey)) $autokey = 0; + if (!isset($remote)) $remote = 0; + if (!isset($dellink)) $dellink = 0; + if (!isset($autolitpic)) $autolitpic = 0; + if (!isset($formhtml)) $formhtml = 0; + if (!isset($formzip)) $formzip = 0; + if (!isset($ddisfirst)) $ddisfirst = 0; + if (!isset($albums)) $albums = ""; + if (!isset($delzip)) $delzip = 0; + if (empty($click)) $click = ($cfg_arc_click == '-1' ? mt_rand(50, 200) : $cfg_arc_click); + + if ($typeid == 0) { ShowMsg("请指定文档的栏目!", "-1"); exit(); } - if(empty($channelid)) - { - ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1"); + if (empty($channelid)) { + ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1"); exit(); } - if(!CheckChannel($typeid,$channelid) ) - { - ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1"); + if (!CheckChannel($typeid, $channelid)) { + ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1"); exit(); } - if(!TestPurview('a_New')) - { - CheckCatalog($typeid,"对不起,你没有操作栏目 {$typeid} 的权限!"); + if (!TestPurview('a_New')) { + CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的权限!"); } //对保存的内容进行处理 - if(empty($writer))$writer=$cuserLogin->getUserName(); - if(empty($source))$source='未知'; + if (empty($writer)) $writer = $cuserLogin->getUserName(); + if (empty($source)) $source = '未知'; $pubdate = GetMkTime($pubdate); $senddate = time(); - $sortrank = AddDay($pubdate,$sortup); - $ismake = $ishtml==0 ? -1 : 0; + $sortrank = AddDay($pubdate, $sortup); + $ismake = $ishtml == 0 ? -1 : 0; $title = preg_replace("#\"#", '"', $title); - $title = cn_substrR($title,$cfg_title_maxlen); - $shorttitle = cn_substrR($shorttitle,36); - $color = cn_substrR($color,7); - $writer = cn_substrR($writer,20); - $source = cn_substrR($source,30); - $description = cn_substrR($description,$cfg_auot_description); - $keywords = cn_substrR($keywords,60); - $filename = trim(cn_substrR($filename,40)); + $title = cn_substrR($title, $cfg_title_maxlen); + $shorttitle = cn_substrR($shorttitle, 36); + $color = cn_substrR($color, 7); + $writer = cn_substrR($writer, 20); + $source = cn_substrR($source, 30); + $description = cn_substrR($description, $cfg_auot_description); + $keywords = cn_substrR($keywords, 60); + $filename = trim(cn_substrR($filename, 40)); $userip = GetIP(); $isremote = 0; - $serviterm=empty($serviterm)? "" : $serviterm; - if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) - { + $serviterm = empty($serviterm) ? "" : $serviterm; + if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) { $arcrank = -1; } $adminid = $cuserLogin->getUserID(); //处理上传的缩略图 - if(empty($ddisremote)) $ddisremote = 0; - $litpic = GetDDImage('none',$picname,$ddisremote); + if (empty($ddisremote)) $ddisremote = 0; + $litpic = GetDDImage('none', $picname, $ddisremote); // 处理新的缩略图上传 if ($litpic_b64 != "") { - $data = explode( ',', $litpic_b64 ); + $data = explode(',', $litpic_b64); $ntime = time(); - $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime); + $savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime); CreateDir($savepath); - $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999)); - $fullUrl = $fullUrl.".png"; - - file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] )); + $fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999)); + $fullUrl = $fullUrl . ".png"; + + file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1])); // 加水印 - WaterImg($cfg_basedir.$fullUrl, 'up'); + WaterImg($cfg_basedir . $fullUrl, 'up'); $litpic = $fullUrl; } // 处理新的缩略图上传 if ($litpic_b64 != "") { - $data = explode( ',', $litpic_b64 ); + $data = explode(',', $litpic_b64); $ntime = time(); - $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime); + $savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime); CreateDir($savepath); - $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999)); - $fullUrl = $fullUrl.".png"; - - file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] )); + $fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999)); + $fullUrl = $fullUrl . ".png"; + + file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1])); // 加水印 - WaterImg($cfg_basedir.$fullUrl, 'up'); + WaterImg($cfg_basedir . $fullUrl, 'up'); $litpic = $fullUrl; } //使用第一张图作为缩略图 - if($ddisfirst==1 && $litpic=='') - { - if(isset($imgurl1)) - { + if ($ddisfirst == 1 && $litpic == '') { + if (isset($imgurl1)) { $litpic = GetDDImage('ddfirst', $imgurl1, $isrm); } } //生成文档ID - $arcID = GetIndexKey($arcrank,$typeid,$sortrank,$channelid,$senddate,$adminid); - if(empty($arcID)) - { - ShowMsg("无法获得主键,因此无法进行后续操作!","-1"); + $arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $adminid); + if (empty($arcID)) { + ShowMsg("无法获得主键,因此无法进行后续操作!", "-1"); exit(); } @@ -171,12 +158,10 @@ else if($dopost=='save') /*--------------------- function _getformhtml() ------------------*/ - if($formhtml==1) - { + if ($formhtml == 1) { $imagebody = stripslashes($imagebody); - $imgurls .= GetCurContentAlbum($imagebody,$copysource,$litpicname); - if($ddisfirst==1 && $litpic=='' && !empty($litpicname)) - { + $imgurls .= GetCurContentAlbum($imagebody, $copysource, $litpicname); + if ($ddisfirst == 1 && $litpic == '' && !empty($litpicname)) { $litpic = $litpicname; $hasone = TRUE; } @@ -185,64 +170,56 @@ else if($dopost=='save') function _getformzip() 处理从ZIP中解压的图片 ---------------------*/ - if($formzip==1) - { - include_once(DEDEINC."/zip.class.php"); - include_once(DEDEADMIN."/file_class.php"); - $zipfile = $cfg_basedir.str_replace($cfg_mainsite,'',$zipfile); - $tmpzipdir = DEDEDATA.'/ziptmp/'.cn_substr(md5(ExecTime()),16); + if ($formzip == 1) { + include_once(DEDEINC . "/zip.class.php"); + include_once(DEDEADMIN . "/file_class.php"); + $zipfile = $cfg_basedir . str_replace($cfg_mainsite, '', $zipfile); + $tmpzipdir = DEDEDATA . '/ziptmp/' . cn_substr(md5(ExecTime()), 16); $ntime = time(); - if(file_exists($zipfile)) - { - @mkdir($tmpzipdir,$GLOBALS['cfg_dir_purview']); - @chmod($tmpzipdir,$GLOBALS['cfg_dir_purview']); + if (file_exists($zipfile)) { + @mkdir($tmpzipdir, $GLOBALS['cfg_dir_purview']); + @chmod($tmpzipdir, $GLOBALS['cfg_dir_purview']); $z = new zip(); - $z->ExtractAll($zipfile,$tmpzipdir); + $z->ExtractAll($zipfile, $tmpzipdir); $fm = new FileManagement(); $imgs = array(); - $fm->GetMatchFiles($tmpzipdir,"jpg|png|gif",$imgs); + $fm->GetMatchFiles($tmpzipdir, "jpg|png|gif", $imgs); $i = 0; - foreach($imgs as $imgold) - { + foreach ($imgs as $imgold) { $i++; - $savepath = $cfg_image_dir."/".MyDate("Y-m",$ntime); + $savepath = $cfg_image_dir . "/" . MyDate("Y-m", $ntime); CreateDir($savepath); - $iurl = $savepath."/".MyDate("d",$ntime).dd2char(MyDate("His",$ntime).'-'.$adminid."-{$i}".mt_rand(1000,9999)); - $iurl = $iurl.substr($imgold,-4,4); - $imgfile = $cfg_basedir.$iurl; - copy($imgold,$imgfile); + $iurl = $savepath . "/" . MyDate("d", $ntime) . dd2char(MyDate("His", $ntime) . '-' . $adminid . "-{$i}" . mt_rand(1000, 9999)); + $iurl = $iurl . substr($imgold, -4, 4); + $imgfile = $cfg_basedir . $iurl; + copy($imgold, $imgfile); unlink($imgold); - if(is_file($imgfile)) - { - $litpicname = $pagestyle > 2 ? GetImageMapDD($iurl,$cfg_ddimg_width) : $iurl; + if (is_file($imgfile)) { + $litpicname = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl; //指定了提取第一张为缩略图的情况强制使用第一张缩略图 - if($i=='1') - { - if(!$hasone && $ddisfirst==1 && $litpic=='' && empty($litpicname)) - { - $litpicname = GetImageMapDD($iurl,$cfg_ddimg_width); + if ($i == '1') { + if (!$hasone && $ddisfirst == 1 && $litpic == '' && empty($litpicname)) { + $litpicname = GetImageMapDD($iurl, $cfg_ddimg_width); } } $info = ''; - $imginfos = GetImageSize($imgfile,$info); - $imgurls .= "{dede:img ddimg='$litpicname' text='' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n"; + $imginfos = GetImageSize($imgfile, $info); + $imgurls .= "{dede:img ddimg='$litpicname' text='' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $iurl {/dede:img}\r\n"; //把图片信息保存到媒体文档管理档案中 $inquery = " INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,mid) - VALUES ('{$title}','{$iurl}','1','".$imginfos[0]."','".$imginfos[1]."','0','".filesize($imgfile)."','".$ntime."','$adminid'); + VALUES ('{$title}','{$iurl}','1','" . $imginfos[0] . "','" . $imginfos[1] . "','0','" . filesize($imgfile) . "','" . $ntime . "','$adminid'); "; $dsql->ExecuteNoneQuery($inquery); $fid = $dsql->GetLastID(); AddMyAddon($fid, $iurl); - + WaterImg($imgfile, 'up'); - if(!$hasone && $ddisfirst==1 && $litpic=='') - { - if(empty($litpicname)) - { + if (!$hasone && $ddisfirst == 1 && $litpic == '') { + if (empty($litpicname)) { $litpicname = $iurl; $litpicname = GetImageMapDD($iurl, $cfg_ddimg_width); } @@ -251,140 +228,123 @@ else if($dopost=='save') } } } - if($delzip==1) unlink($zipfile); + if ($delzip == 1) unlink($zipfile); $fm->RmDirFiles($tmpzipdir); } } if ($albums !== "") { - $albumsArr = json_decode(stripslashes( $albums), true); + $albumsArr = json_decode(stripslashes($albums), true); - for ($i=0; $i <= count($albumsArr) - 1; $i++) { + for ($i = 0; $i <= count($albumsArr) - 1; $i++) { $album = $albumsArr[$i]; - $data = explode( ',', $album['img'] ); + $data = explode(',', $album['img']); $ntime = time(); - $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime); + $savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime); CreateDir($savepath); - $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999)); - $fullUrl = $fullUrl.".png"; - - file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] )); + $fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999)); + $fullUrl = $fullUrl . ".png"; + + file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1])); $info = ''; - $imginfos = GetImageSize($cfg_basedir.$fullUrl, $info); + $imginfos = GetImageSize($cfg_basedir . $fullUrl, $info); $v = $fullUrl; $imginfo = !empty($album['txt']) ? $album['txt'] : ''; - $imgurls .= "{dede:img ddimg='$v' text='$imginfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $v {/dede:img}\r\n"; + $imgurls .= "{dede:img ddimg='$v' text='$imginfo' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $v {/dede:img}\r\n"; } - } $imgurls = addslashes($imgurls); - + //处理body字段自动摘要、自动提取缩略图等 - $body = AnalyseHtmlBody($body,$description,$litpic,$keywords,'htmltext'); + $body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext'); //分析处理附加表数据 $inadd_f = ''; $inadd_v = ''; - if(!empty($dede_addonfields)) - { - $addonfields = explode(';',$dede_addonfields); + if (!empty($dede_addonfields)) { + $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if(!isset(${$vs[0]})) - { + $vs = explode(',', $v); + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; - } - else if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理 - { - ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]); - } - else + } else if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理 { - if(!isset(${$vs[0]})) - { + ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]); + } else { + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$arcID); + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID); } - $inadd_f .= ','.$vs[0]; - $inadd_v .= " ,'".${$vs[0]}."' "; + $inadd_f .= ',' . $vs[0]; + $inadd_v .= " ,'" . ${$vs[0]} . "' "; } } } //处理图片文档的自定义属性 - if($litpic!='' && !preg_match("#p#", $flag)) - { - $flag = ($flag=='' ? 'p' : $flag.',p'); + if ($litpic != '' && !preg_match("#p#", $flag)) { + $flag = ($flag == '' ? 'p' : $flag . ',p'); } - if($redirecturl!='' && !preg_match("#j#", $flag)) - { - $flag = ($flag=='' ? 'j' : $flag.',j'); + if ($redirecturl != '' && !preg_match("#j#", $flag)) { + $flag = ($flag == '' ? 'j' : $flag . ',j'); } //跳转网址的文档强制为动态 - if(preg_match("#j#", $flag)) $ismake = -1; + if (preg_match("#j#", $flag)) $ismake = -1; //加入主档案表 $query = "INSERT INTO `#@__archives`(id,typeid,typeid2,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle, color,writer,source,litpic,pubdate,senddate,mid,notpost,description,keywords,filename,dutyadmin,weight) VALUES ('$arcID','$typeid','$typeid2','$sortrank','$flag','$ismake','$channelid','$arcrank','$click','$money','$title','$shorttitle', '$color','$writer','$source','$litpic','$pubdate','$senddate','$adminid','$notpost','$description','$keywords','$filename','$adminid','$weight'); "; - if(!$dsql->ExecuteNoneQuery($query)) - { + if (!$dsql->ExecuteNoneQuery($query)) { $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery(" DELETE FROM `#@__arctiny` WHERE id='$arcID' "); - ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeCMS官方。".str_replace('"','',$gerr),"javascript:;"); + ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeCMS官方。" . str_replace('"', '', $gerr), "javascript:;"); exit(); } //加入附加表 $cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' "); $addtable = trim($cts['addtable']); - if(empty($addtable)) - { + if (empty($addtable)) { $dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'"); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作!。","javascript:;"); + ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作!。", "javascript:;"); exit(); } $useip = GetIP(); $query = "INSERT INTO `$addtable`(aid,typeid,redirecturl,userip,pagestyle,maxwidth,imgurls,`row`,col,isrm,ddmaxwidth,pagepicnum,body{$inadd_f}) Values('$arcID','$typeid','$redirecturl','$useip','$pagestyle','$maxwidth','$imgurls','$row','$col','$isrm','$ddmaxwidth','$pagepicnum','$body'{$inadd_v}); "; - if(!$dsql->ExecuteNoneQuery($query)) - { + if (!$dsql->ExecuteNoneQuery($query)) { $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'"); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCMS官方。".str_replace('"','',$gerr),"javascript:;"); + ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCMS官方。" . str_replace('"', '', $gerr), "javascript:;"); exit(); } //生成HTML - InsertTags($tags,$arcID); - if($cfg_remote_site=='Y' && $isremote=="1") - { - if($serviterm!=""){ - list($servurl,$servuser,$servpwd) = explode(',',$serviterm); - $config=array( 'hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd,'debug' => 'TRUE'); - }else{ - $config=array(); + InsertTags($tags, $arcID); + if ($cfg_remote_site == 'Y' && $isremote == "1") { + if ($serviterm != "") { + list($servurl, $servuser, $servpwd) = explode(',', $serviterm); + $config = array('hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd, 'debug' => 'TRUE'); + } else { + $config = array(); } - if(!$ftp->connect($config)) exit('Error:None FTP Connection!'); + if (!$ftp->connect($config)) exit('Error:None FTP Connection!'); } $artUrl = MakeArt($arcID, TRUE, TRUE, $isremote); - if($artUrl=='') - { - $artUrl = $cfg_phpurl."/view.php?aid=$arcID"; + if ($artUrl == '') { + $artUrl = $cfg_phpurl . "/view.php?aid=$arcID"; } ClearMyAddon($arcID, $title); @@ -394,7 +354,7 @@ else if($dopost=='save') if (isset(${$key}) && !empty(${$key})) { $ids = explode(",", ${$key}); foreach ($ids as $id) { - MakeArt($id,true,true,$isremote); + MakeArt($id, true, true, $isremote); } } } @@ -405,7 +365,7 @@ else if($dopost=='save')   请选择你的后续操作: 继续发布图片    - 更改图集 + 更改图集    预览文档    @@ -413,13 +373,13 @@ else if($dopost=='save')    $backurl "; - $msg = "
{$msg}
".GetUpdateTest(); - + $msg = "
{$msg}
" . GetUpdateTest(); + $wintitle = "成功发布一个图集!"; $wecome_info = "文章管理::发布图集"; $win = new OxWindow(); $win->AddTitle("成功发布一个图集:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",FALSE); + $winform = $win->GetWindow("hand", " ", FALSE); $win->Display(); -} \ No newline at end of file +} diff --git a/src/dede/album_edit.php b/src/dede/album_edit.php index 6bf3a076..822fc0c3 100755 --- a/src/dede/album_edit.php +++ b/src/dede/album_edit.php @@ -1,24 +1,24 @@ GetOne($arcQuery); - if(!is_array($arcRow)) - { - ShowMsg("读取档案基本信息出错!","-1"); + if (!is_array($arcRow)) { + ShowMsg("读取档案基本信息出错!", "-1"); exit(); } - $query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'"; + $query = "SELECT * FROM `#@__channeltype` WHERE id='" . $arcRow['channel'] . "'"; $cInfos = $dsql->GetOne($query); - if(!is_array($cInfos)) - { - ShowMsg("读取频道配置信息出错!","javascript:;"); + if (!is_array($cInfos)) { + ShowMsg("读取频道配置信息出错!", "javascript:;"); exit(); } $addtable = $cInfos['addtable']; @@ -53,116 +51,104 @@ if($dopost!='save') $ddmaxwidth = $addRow["ddmaxwidth"]; $pagepicnum = $addRow["pagepicnum"]; $tags = GetTags($aid); - $arcRow=XSSClean($arcRow);$addRow=XSSClean($addRow); + $arcRow = XSSClean($arcRow); + $addRow = XSSClean($addRow); include DedeInclude("templets/album_edit.htm"); exit(); } /*-------------------------------- function __save(){ } --------------------------------*/ -else if($dopost=='save') -{ - require_once(DEDEINC.'/image.func.php'); - require_once(DEDEINC.'/oxwindow.class.php'); +-------------------------------*/ else if ($dopost == 'save') { + require_once(DEDEINC . '/image.func.php'); + require_once(DEDEINC . '/oxwindow.class.php'); $flag = isset($flags) ? join(',', $flags) : ''; - $notpost = isset($notpost) && $notpost == 1 ? 1: 0; - if(empty($typeid2)) $typeid2 = 0; - if(!isset($autokey)) $autokey = 0; - if(!isset($remote)) $remote = 0; - if(!isset($dellink)) $dellink = 0; - if(!isset($autolitpic)) $autolitpic = 0; - if(!isset($formhtml)) $formhtml = 0; - if(!isset($albums)) $albums = ""; - if(!isset($formzip)) $formzip = 0; - if(!isset($ddisfirst)) $ddisfirst = 0; - if(!isset($delzip)) $delzip = 0; + $notpost = isset($notpost) && $notpost == 1 ? 1 : 0; + if (empty($typeid2)) $typeid2 = 0; + if (!isset($autokey)) $autokey = 0; + if (!isset($remote)) $remote = 0; + if (!isset($dellink)) $dellink = 0; + if (!isset($autolitpic)) $autolitpic = 0; + if (!isset($formhtml)) $formhtml = 0; + if (!isset($albums)) $albums = ""; + if (!isset($formzip)) $formzip = 0; + if (!isset($ddisfirst)) $ddisfirst = 0; + if (!isset($delzip)) $delzip = 0; - if($typeid==0) - { - ShowMsg("请指定文档的栏目!","-1"); + if ($typeid == 0) { + ShowMsg("请指定文档的栏目!", "-1"); exit(); } - if(empty($channelid)) - { - ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1"); + if (empty($channelid)) { + ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1"); exit(); } - if(!CheckChannel($typeid,$channelid)) - { - ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1"); + if (!CheckChannel($typeid, $channelid)) { + ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1"); exit(); } - if(!TestPurview('a_Edit')) - { - if(TestPurview('a_AccEdit')) - { - CheckCatalog($typeid,"对不起,你没有操作栏目 {$typeid} 的文档权限!"); - } - else - { - CheckArcAdmin($id,$cuserLogin->getUserID()); + if (!TestPurview('a_Edit')) { + if (TestPurview('a_AccEdit')) { + CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的文档权限!"); + } else { + CheckArcAdmin($id, $cuserLogin->getUserID()); } } //对保存的内容进行处理 $pubdate = GetMkTime($pubdate); - $sortrank = AddDay($pubdate,$sortup); - $ismake = $ishtml==0 ? -1 : 0; - $title = cn_substrR($title,$cfg_title_maxlen); - $shorttitle = cn_substrR($shorttitle,36); - $color = cn_substrR($color,7); - $writer = cn_substrR($writer,20); - $source = cn_substrR($source,30); - $description = cn_substrR($description,250); - $keywords = trim(cn_substrR($keywords,60)); - $filename = trim(cn_substrR($filename,40)); + $sortrank = AddDay($pubdate, $sortup); + $ismake = $ishtml == 0 ? -1 : 0; + $title = cn_substrR($title, $cfg_title_maxlen); + $shorttitle = cn_substrR($shorttitle, 36); + $color = cn_substrR($color, 7); + $writer = cn_substrR($writer, 20); + $source = cn_substrR($source, 30); + $description = cn_substrR($description, 250); + $keywords = trim(cn_substrR($keywords, 60)); + $filename = trim(cn_substrR($filename, 40)); $isremote = 0; - $serviterm=empty($serviterm)? "" : $serviterm; - if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) - { + $serviterm = empty($serviterm) ? "" : $serviterm; + if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) { $arcrank = -1; } $adminid = $cuserLogin->getUserID(); //处理上传的缩略图 - if(empty($ddisremote)) - { + if (empty($ddisremote)) { $ddisremote = 0; } $litpic = GetDDImage('none', $picname, $ddisremote); // 处理新的缩略图上传 if ($litpic_b64 != "") { - $data = explode( ',', $litpic_b64 ); + $data = explode(',', $litpic_b64); $ntime = time(); - $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime); + $savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime); CreateDir($savepath); - $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999)); - $fullUrl = $fullUrl.".png"; - - file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] )); + $fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999)); + $fullUrl = $fullUrl . ".png"; + + file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1])); // 加水印 - WaterImg($cfg_basedir.$fullUrl, 'up'); + WaterImg($cfg_basedir . $fullUrl, 'up'); $litpic = $fullUrl; } - + //分析body里的内容 $body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext'); //处理图片文档的自定义属性 - if($litpic!='' && !preg_match("#p#", $flag)) - { - $flag = ($flag=='' ? 'p' : $flag.',p'); + if ($litpic != '' && !preg_match("#p#", $flag)) { + $flag = ($flag == '' ? 'p' : $flag . ',p'); } - if($redirecturl!='' && !preg_match("#j#", $flag)) - { - $flag = ($flag=='' ? 'j' : $flag.',j'); + if ($redirecturl != '' && !preg_match("#j#", $flag)) { + $flag = ($flag == '' ? 'j' : $flag . ',j'); } //跳转网址的文档强制为动态 - if(preg_match("#j#", $flag)) $ismake = -1; - + if (preg_match("#j#", $flag)) $ismake = -1; + //更新数据库的SQL语句 $query = " UPDATE `#@__archives` SET @@ -188,9 +174,8 @@ else if($dopost=='save') dutyadmin='$adminid' WHERE id='$id'; "; - if(!$dsql->ExecuteNoneQuery($query)) - { - ShowMsg("更新数据库archives表时出错,请检查!".$dsql->GetError(),"javascript:;"); + if (!$dsql->ExecuteNoneQuery($query)) { + ShowMsg("更新数据库archives表时出错,请检查!" . $dsql->GetError(), "javascript:;"); exit(); } @@ -200,67 +185,57 @@ else if($dopost=='save') //---------------------------------------- //检查旧的图片是否有更新,并保存 //----------------------------------------- - for($i=1; $i<=120; $i++) - { - if( !isset(${'imgurl'.$i}) ) continue; + for ($i = 1; $i <= 120; $i++) { + if (!isset(${'imgurl' . $i})) continue; $info = ''; - $iinfo = str_replace("'", "`", stripslashes(${'imgmsg'.$i})); - $iurl = stripslashes(${'imgurl'.$i}); - $ddurl = stripslashes(${'imgddurl'.$i}); - if(preg_match("#swfupload#i", $ddurl)) $ddurl = ''; - $imgfile = $cfg_basedir.$iurl; - $litimgfile = $cfg_basedir.$ddurl; + $iinfo = str_replace("'", "`", stripslashes(${'imgmsg' . $i})); + $iurl = stripslashes(${'imgurl' . $i}); + $ddurl = stripslashes(${'imgddurl' . $i}); + if (preg_match("#swfupload#i", $ddurl)) $ddurl = ''; + $imgfile = $cfg_basedir . $iurl; + $litimgfile = $cfg_basedir . $ddurl; //有上传文件的情况 - if( isset(${'imgfile'.$i}) && is_uploaded_file(${'imgfile'.$i}) ) - { - $tmpFile = ${'imgfile'.$i}; + if (isset(${'imgfile' . $i}) && is_uploaded_file(${'imgfile' . $i})) { + $tmpFile = ${'imgfile' . $i}; //检测上传的图片, 如果类型不对,保留原来图片 $imginfos = @GetImageSize($tmpFile, $info); - if(!is_array($imginfos)) - { + if (!is_array($imginfos)) { $imginfos = @GetImageSize($imgfile, $info); - $imgurls .= "{dede:img ddimg='$ddurl' text='$iinfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n"; + $imgurls .= "{dede:img ddimg='$ddurl' text='$iinfo' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $iurl {/dede:img}\r\n"; continue; } move_uploaded_file($tmpFile, $imgfile); $imginfos = @GetImageSize($imgfile, $info); - if($ddurl==$iurl) - { + if ($ddurl == $iurl) { $litpicname = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl; - $litimgfile = $cfg_basedir.$litpicname; - } - else - { - if($cfg_ddimg_full=='Y') ImageResizeNew($imgfile, $cfg_ddimg_width, $cfg_ddimg_height, $litimgfile); + $litimgfile = $cfg_basedir . $litpicname; + } else { + if ($cfg_ddimg_full == 'Y') ImageResizeNew($imgfile, $cfg_ddimg_width, $cfg_ddimg_height, $litimgfile); else ImageResize($imgfile, $cfg_ddimg_width, $cfg_ddimg_height, $litimgfile); $litpicname = $ddurl; } - $imgurls .= "{dede:img ddimg='$litpicname' text='$iinfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n"; + $imgurls .= "{dede:img ddimg='$litpicname' text='$iinfo' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $iurl {/dede:img}\r\n"; } //没上传图片(只修改msg信息) - else - { - $iinfo = str_replace("'", "`", stripslashes(${'imgmsg'.$i})); - $iurl = stripslashes(${'imgurl'.$i}); - $ddurl = stripslashes(${'imgddurl'.$i}); - if(preg_match("#swfupload#i", $ddurl)) - { + else { + $iinfo = str_replace("'", "`", stripslashes(${'imgmsg' . $i})); + $iurl = stripslashes(${'imgurl' . $i}); + $ddurl = stripslashes(${'imgddurl' . $i}); + if (preg_match("#swfupload#i", $ddurl)) { $ddurl = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl; } $imginfos = @GetImageSize($imgfile, $info); - $imgurls .= "{dede:img ddimg='$ddurl' text='$iinfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n"; + $imgurls .= "{dede:img ddimg='$ddurl' text='$iinfo' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $iurl {/dede:img}\r\n"; } } //---------------------------- //从HTML中获取新图片 //---------------------------- - if($formhtml==1 && !empty($imagebody)) - { + if ($formhtml == 1 && !empty($imagebody)) { $imagebody = stripslashes($imagebody); - $imgurls .= GetCurContentAlbum($imagebody,$copysource,$litpicname); - if($ddisfirst==1 && $litpic=="" && !empty($litpicname)) - { + $imgurls .= GetCurContentAlbum($imagebody, $copysource, $litpicname); + if ($ddisfirst == 1 && $litpic == "" && !empty($litpicname)) { $litpic = $litpicname; $hasone = true; } @@ -269,60 +244,55 @@ else if($dopost=='save') function _getformzip() 从ZIP文件中获取新图片 ---------------------*/ - if($formzip==1) - { - include_once(DEDEINC."/zip.class.php"); - include_once(DEDEADMIN."/file_class.php"); - $zipfile = $cfg_basedir.str_replace($cfg_mainsite,'',$zipfile); - $tmpzipdir = DEDEDATA.'/ziptmp/'.cn_substr(md5(ExecTime()),16); + if ($formzip == 1) { + include_once(DEDEINC . "/zip.class.php"); + include_once(DEDEADMIN . "/file_class.php"); + $zipfile = $cfg_basedir . str_replace($cfg_mainsite, '', $zipfile); + $tmpzipdir = DEDEDATA . '/ziptmp/' . cn_substr(md5(ExecTime()), 16); $ntime = time(); - if(file_exists($zipfile)) - { + if (file_exists($zipfile)) { - @mkdir($tmpzipdir,$GLOBALS['cfg_dir_purview']); - @chmod($tmpzipdir,$GLOBALS['cfg_dir_purview']); + @mkdir($tmpzipdir, $GLOBALS['cfg_dir_purview']); + @chmod($tmpzipdir, $GLOBALS['cfg_dir_purview']); $z = new zip(); - $z->ExtractAll($zipfile,$tmpzipdir); + $z->ExtractAll($zipfile, $tmpzipdir); $fm = new FileManagement(); $imgs = array(); - $fm->GetMatchFiles($tmpzipdir,"jpg|png|gif",$imgs); + $fm->GetMatchFiles($tmpzipdir, "jpg|png|gif", $imgs); $i = 0; - foreach($imgs as $imgold) - { + foreach ($imgs as $imgold) { $i++; - $savepath = $cfg_image_dir."/".MyDate("Y-m",$ntime); + $savepath = $cfg_image_dir . "/" . MyDate("Y-m", $ntime); CreateDir($savepath); - $iurl = $savepath."/".MyDate("d",$ntime).dd2char(MyDate("His",$ntime).'-'.$adminid."-{$i}".mt_rand(1000,9999)); - $iurl = $iurl.substr($imgold,-4,4); - $imgfile = $cfg_basedir.$iurl; - copy($imgold,$imgfile); + $iurl = $savepath . "/" . MyDate("d", $ntime) . dd2char(MyDate("His", $ntime) . '-' . $adminid . "-{$i}" . mt_rand(1000, 9999)); + $iurl = $iurl . substr($imgold, -4, 4); + $imgfile = $cfg_basedir . $iurl; + copy($imgold, $imgfile); unlink($imgold); - if(is_file($imgfile)) - { - $litpicname = $pagestyle > 2 ? GetImageMapDD($iurl,$cfg_ddimg_width) : $iurl; + if (is_file($imgfile)) { + $litpicname = $pagestyle > 2 ? GetImageMapDD($iurl, $cfg_ddimg_width) : $iurl; $info = ''; - $imginfos = GetImageSize($imgfile,$info); - $imgurls .= "{dede:img ddimg='$litpicname' text='' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}\r\n"; + $imginfos = GetImageSize($imgfile, $info); + $imgurls .= "{dede:img ddimg='$litpicname' text='' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $iurl {/dede:img}\r\n"; //把图片信息保存到媒体文档管理档案中 $inquery = " INSERT INTO #@__uploads(title,url,mediatype,width,height,playtime,filesize,uptime,mid) - VALUES ('{$title}','{$iurl}','1','".$imginfos[0]."','".$imginfos[1]."','0','".filesize($imgfile)."','".$ntime."','$adminid'); + VALUES ('{$title}','{$iurl}','1','" . $imginfos[0] . "','" . $imginfos[1] . "','0','" . filesize($imgfile) . "','" . $ntime . "','$adminid'); "; $dsql->ExecuteNoneQuery($inquery); - if(!$hasone && $ddisfirst==1 - && $litpic=="" && !empty($litpicname)) - { - if( file_exists($cfg_basedir.$litpicname) ) - { + if ( + !$hasone && $ddisfirst == 1 + && $litpic == "" && !empty($litpicname) + ) { + if (file_exists($cfg_basedir . $litpicname)) { $litpic = $litpicname; $hasone = true; } } } } - if($delzip==1) - { + if ($delzip == 1) { unlink($zipfile); } $fm->RmDirFiles($tmpzipdir); @@ -330,59 +300,53 @@ else if($dopost=='save') } if ($albums !== "") { - $albumsArr = json_decode(stripslashes( $albums), true); + $albumsArr = json_decode(stripslashes($albums), true); // var_dump($albumsArr);exit; - for ($i=0; $i <= count($albumsArr) - 1; $i++) { + for ($i = 0; $i <= count($albumsArr) - 1; $i++) { $album = $albumsArr[$i]; - $data = explode( ',', $album['img'] ); + $data = explode(',', $album['img']); $ntime = time(); - $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime); + $savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime); CreateDir($savepath); - $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999)); - $fullUrl = $fullUrl.".png"; - - file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] )); + $fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999)); + $fullUrl = $fullUrl . ".png"; + + file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1])); $info = ''; - $imginfos = GetImageSize($cfg_basedir.$fullUrl, $info); + $imginfos = GetImageSize($cfg_basedir . $fullUrl, $info); $v = $fullUrl; $imginfo = !empty($album['txt']) ? $album['txt'] : ''; - $imgurls .= "{dede:img ddimg='$v' text='$imginfo' width='".$imginfos[0]."' height='".$imginfos[1]."'} $v {/dede:img}\r\n"; + $imgurls .= "{dede:img ddimg='$v' text='$imginfo' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $v {/dede:img}\r\n"; } - } - + $imgurls = addslashes($imgurls); //分析处理附加表数据 $inadd_f = ''; $inadd_v = ''; - if(!empty($dede_addonfields)) - { + if (!empty($dede_addonfields)) { $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理 + $vs = explode(',', $v); + if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理 { - ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]); - }else{ - if(!isset(${$vs[0]})) - { + ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]); + } else { + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$id); + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id); } - $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'"; + $inadd_f .= ",`{$vs[0]}` = '" . ${$vs[0]} . "'"; } } } @@ -390,8 +354,7 @@ else if($dopost=='save') //更新附加表 $cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' "); $addtable = trim($cts['addtable']); - if($addtable!='') - { + if ($addtable != '') { $useip = GetIP(); $query = "Update `$addtable` set typeid='$typeid', @@ -407,39 +370,36 @@ else if($dopost=='save') redirecturl='$redirecturl', userip = '$useip' WHERE aid='$id'; "; - if(!$dsql->ExecuteNoneQuery($query)) - { - ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!".$dsql->GetError(),"javascript:;"); + if (!$dsql->ExecuteNoneQuery($query)) { + ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!" . $dsql->GetError(), "javascript:;"); exit(); } } //生成HTML - UpIndexKey($id,$arcrank,$typeid,$sortrank,$tags); - if($cfg_remote_site=='Y' && $isremote=="1") - { - if($serviterm!=""){ - list($servurl,$servuser,$servpwd) = explode(',',$serviterm); - $config=array( 'hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd,'debug' => 'TRUE'); - }else{ - $config=array(); + UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags); + if ($cfg_remote_site == 'Y' && $isremote == "1") { + if ($serviterm != "") { + list($servurl, $servuser, $servpwd) = explode(',', $serviterm); + $config = array('hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd, 'debug' => 'TRUE'); + } else { + $config = array(); } - if(!$ftp->connect($config)) exit('Error:None FTP Connection!'); + if (!$ftp->connect($config)) exit('Error:None FTP Connection!'); } - $arcUrl = MakeArt($id,true,true,$isremote); - if($arcUrl=='') - { - $arcUrl = $cfg_phpurl."/view.php?aid=$id"; + $arcUrl = MakeArt($id, true, true, $isremote); + if ($arcUrl == '') { + $arcUrl = $cfg_phpurl . "/view.php?aid=$id"; } ClearMyAddon($id, $title); - + // 自动更新关联内容 if (is_array($automake)) { foreach ($automake as $key => $value) { if (isset(${$key}) && !empty(${$key})) { $ids = explode(",", ${$key}); foreach ($ids as $id) { - MakeArt($id,true,true,$isremote); + MakeArt($id, true, true, $isremote); } } } @@ -447,10 +407,10 @@ else if($dopost=='save') //返回成功信息 $msg = - "   请选择你的后续操作: + "   请选择你的后续操作: 继续发布图片    - 查看更改 + 查看更改    预览文档    @@ -464,6 +424,6 @@ else if($dopost=='save') $win = new OxWindow(); $win->AddTitle("成功更改一个图集:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",false); + $winform = $win->GetWindow("hand", " ", false); $win->Display(); -} \ No newline at end of file +} diff --git a/src/dede/album_testhtml.php b/src/dede/album_testhtml.php index 2b9ccd2a..315f02a3 100755 --- a/src/dede/album_testhtml.php +++ b/src/dede/album_testhtml.php @@ -1,15 +1,16 @@ [关闭]\r\n"; @@ -18,4 +19,4 @@ $img_array = array_unique($img_array[2]); echo "
"; echo "捕获的图片:\r\n"; print_r($img_array); -echo "
\r\n"; \ No newline at end of file +echo "\r\n"; diff --git a/src/dede/archives_add.php b/src/dede/archives_add.php index e8246f18..491a7c05 100755 --- a/src/dede/archives_add.php +++ b/src/dede/archives_add.php @@ -1,38 +1,34 @@ 0 && $channelid == 0) - { + if ($cid > 0 && $channelid == 0) { $row = $dsql->GetOne("SELECT channeltype FROM `#@__arctype` WHERE id='$cid'; "); $channelid = $row['channeltype']; - } - else - { - if($channelid==0) - { + } else { + if ($channelid == 0) { ShowMsg('无法识别模型信息,因此无法操作!', '-1'); exit(); } @@ -48,188 +44,167 @@ if($dopost != 'save') } /*-------------------------------- function __save(){ } --------------------------------*/ -else if($dopost=='save') -{ - require_once(DEDEINC.'/image.func.php'); - require_once(DEDEINC.'/oxwindow.class.php'); - - $flag = isset($flags) ? join(',',$flags) : ''; - $notpost = isset($notpost) && $notpost == 1 ? 1: 0; - if(empty($click)) $click = ($cfg_arc_click=='-1' ? mt_rand(50, 200) : $cfg_arc_click); - if(empty($litpic_b64)) $litpic_b64 = ''; - - if(empty($typeid2)) $typeid2 = 0; - if(!isset($autokey)) $autokey = 0; - if(!isset($remote)) $remote = 0; - if(!isset($dellink)) $dellink = 0; - if(!isset($autolitpic)) $autolitpic = 0; - if(empty($click)) $click = ($cfg_arc_click=='-1' ? mt_rand(50, 200) : $cfg_arc_click); - - if($typeid==0) - { +-------------------------------*/ else if ($dopost == 'save') { + require_once(DEDEINC . '/image.func.php'); + require_once(DEDEINC . '/oxwindow.class.php'); + + $flag = isset($flags) ? join(',', $flags) : ''; + $notpost = isset($notpost) && $notpost == 1 ? 1 : 0; + if (empty($click)) $click = ($cfg_arc_click == '-1' ? mt_rand(50, 200) : $cfg_arc_click); + if (empty($litpic_b64)) $litpic_b64 = ''; + + if (empty($typeid2)) $typeid2 = 0; + if (!isset($autokey)) $autokey = 0; + if (!isset($remote)) $remote = 0; + if (!isset($dellink)) $dellink = 0; + if (!isset($autolitpic)) $autolitpic = 0; + if (empty($click)) $click = ($cfg_arc_click == '-1' ? mt_rand(50, 200) : $cfg_arc_click); + + if ($typeid == 0) { ShowMsg('请指定文档的栏目!', '-1'); exit(); } - if(empty($channelid)) - { + if (empty($channelid)) { ShowMsg('文档为非指定的类型,请检查你发布内容的表单是否合法!', '-1'); exit(); } - if(!CheckChannel($typeid,$channelid) ) - { + if (!CheckChannel($typeid, $channelid)) { ShowMsg('你所选择的栏目与当前模型不相符,请选择白色的选项!', '-1'); exit(); } - if(!TestPurview('a_New')) - { + if (!TestPurview('a_New')) { CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的权限!"); } //对保存的内容进行处理 - if(empty($writer)) $writer = $cuserLogin->getUserName(); - if(empty($source)) $source = '未知'; + if (empty($writer)) $writer = $cuserLogin->getUserName(); + if (empty($source)) $source = '未知'; $pubdate = GetMkTime($pubdate); $senddate = time(); - $sortrank = AddDay($pubdate,$sortup); + $sortrank = AddDay($pubdate, $sortup); $ismake = $ishtml == 0 ? -1 : 0; $title = preg_replace("#\"#", '"', $title); - $title = cn_substrR($title,$cfg_title_maxlen); - $shorttitle = cn_substrR($shorttitle,36); - $color = cn_substrR($color,7); - $writer = cn_substrR($writer,20); - $source = cn_substrR($source,30); - $description = cn_substrR($description,$cfg_auot_description); - $keywords = cn_substrR($keywords,60); - $filename = trim(cn_substrR($filename,40)); + $title = cn_substrR($title, $cfg_title_maxlen); + $shorttitle = cn_substrR($shorttitle, 36); + $color = cn_substrR($color, 7); + $writer = cn_substrR($writer, 20); + $source = cn_substrR($source, 30); + $description = cn_substrR($description, $cfg_auot_description); + $keywords = cn_substrR($keywords, 60); + $filename = trim(cn_substrR($filename, 40)); $userip = GetIP(); $isremote = 0; - $voteid = (empty($voteid)? 0 : $voteid); - $serviterm=empty($serviterm)? "" : $serviterm; - if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) - { + $voteid = (empty($voteid) ? 0 : $voteid); + $serviterm = empty($serviterm) ? "" : $serviterm; + if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) { $arcrank = -1; } $adminid = $cuserLogin->getUserID(); //处理上传的缩略图 - if(empty($ddisremote)) - { + if (empty($ddisremote)) { $ddisremote = 0; } - $litpic = GetDDImage('none',$picname,$ddisremote); + $litpic = GetDDImage('none', $picname, $ddisremote); // 处理新的缩略图上传 if ($litpic_b64 != "") { - $data = explode( ',', $litpic_b64 ); + $data = explode(',', $litpic_b64); $ntime = time(); - $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime); + $savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime); CreateDir($savepath); - $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999)); - $fullUrl = $fullUrl.".png"; - - file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] )); + $fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999)); + $fullUrl = $fullUrl . ".png"; + + file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1])); // 加水印 - WaterImg($cfg_basedir.$fullUrl, 'up'); + WaterImg($cfg_basedir . $fullUrl, 'up'); $litpic = $fullUrl; } //生成文档ID - $arcID = GetIndexKey($arcrank,$typeid,$sortrank,$channelid,$senddate,$adminid); + $arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $adminid); - if(empty($arcID)) - { - ShowMsg("无法获得主键,因此无法进行后续操作!","-1"); + if (empty($arcID)) { + ShowMsg("无法获得主键,因此无法进行后续操作!", "-1"); exit(); } //分析处理附加表数据 $inadd_f = $inadd_v = ''; - if(!empty($dede_addonfields)) - { + if (!empty($dede_addonfields)) { $addonfields = explode(';', $dede_addonfields); - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') continue; + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') continue; $vs = explode(',', $v); - if($vs[1]=='htmltext' || $vs[1]=='textdata') - { + if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') { ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]); - } - else - { - if(!isset(${$vs[0]})) ${$vs[0]} = ''; + } else { + if (!isset(${$vs[0]})) ${$vs[0]} = ''; ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID); } - $inadd_f .= ','.$vs[0]; - $inadd_v .= " ,'".${$vs[0]}."' "; + $inadd_f .= ',' . $vs[0]; + $inadd_v .= " ,'" . ${$vs[0]} . "' "; } } } //处理图片文档的自定义属性 - if($litpic!='' && !preg_match("#p#", $flag)) - { - $flag = ($flag=='' ? 'p' : $flag.',p'); + if ($litpic != '' && !preg_match("#p#", $flag)) { + $flag = ($flag == '' ? 'p' : $flag . ',p'); } - if($redirecturl!='' && !preg_match("#j#", $flag)) - { - $flag = ($flag=='' ? 'j' : $flag.',j'); + if ($redirecturl != '' && !preg_match("#j#", $flag)) { + $flag = ($flag == '' ? 'j' : $flag . ',j'); } //跳转网址的文档强制为动态 - if(preg_match("#j#", $flag)) $ismake = -1; + if (preg_match("#j#", $flag)) $ismake = -1; //保存到主表 $query = "INSERT INTO `#@__archives`(id,typeid,typeid2,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle, color,writer,source,litpic,pubdate,senddate,mid,voteid,notpost,description,keywords,filename,dutyadmin,weight) VALUES ('$arcID','$typeid','$typeid2','$sortrank','$flag','$ismake','$channelid','$arcrank','$click','$money','$title','$shorttitle', '$color','$writer','$source','$litpic','$pubdate','$senddate','$adminid','$voteid','$notpost','$description','$keywords','$filename','$adminid','$weight');"; - if(!$dsql->ExecuteNoneQuery($query)) - { + if (!$dsql->ExecuteNoneQuery($query)) { $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeCMS官方。".str_replace('"','',$gerr),"javascript:;"); + ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeCMS官方。" . str_replace('"', '', $gerr), "javascript:;"); exit(); } //保存到附加表 $cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' "); $addtable = trim($cts['addtable']); - if(!empty($addtable)) - { + if (!empty($addtable)) { $useip = GetIP(); $query = "INSERT INTO `{$addtable}`(aid,typeid,redirecturl,userip{$inadd_f}) Values('$arcID','$typeid','$redirecturl','$useip'{$inadd_v})"; - if(!$dsql->ExecuteNoneQuery($query)) - { + if (!$dsql->ExecuteNoneQuery($query)) { $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'"); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCMS官方。".str_replace('"','',$gerr),"javascript:;"); + ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCMS官方。" . str_replace('"', '', $gerr), "javascript:;"); exit(); } } //生成HTML InsertTags($tags, $arcID); - if($cfg_remote_site=='Y' && $isremote=="1") - { - if($serviterm!="") - { - list($servurl,$servuser,$servpwd) = explode(',',$serviterm); - $config=array( 'hostname' => $servurl, 'username' => $servuser, - 'password' => $servpwd,'debug' => 'TRUE'); + if ($cfg_remote_site == 'Y' && $isremote == "1") { + if ($serviterm != "") { + list($servurl, $servuser, $servpwd) = explode(',', $serviterm); + $config = array( + 'hostname' => $servurl, 'username' => $servuser, + 'password' => $servpwd, 'debug' => 'TRUE' + ); } else { - $config=array(); + $config = array(); } - if(!$ftp->connect($config)) exit('Error:None FTP Connection!'); + if (!$ftp->connect($config)) exit('Error:None FTP Connection!'); } - $artUrl = MakeArt($arcID, true, true,$isremote); - if($artUrl=='') - { - $artUrl = $cfg_phpurl."/view.php?aid=$arcID"; + $artUrl = MakeArt($arcID, true, true, $isremote); + if ($artUrl == '') { + $artUrl = $cfg_phpurl . "/view.php?aid=$arcID"; } ClearMyAddon($arcID, $title); @@ -239,7 +214,7 @@ color,writer,source,litpic,pubdate,senddate,mid,voteid,notpost,description,keywo if (isset(${$key}) && !empty(${$key})) { $ids = explode(",", ${$key}); foreach ($ids as $id) { - MakeArt($id,true,true,$isremote); + MakeArt($id, true, true, $isremote); } } } @@ -251,13 +226,13 @@ color,writer,source,litpic,pubdate,senddate,mid,voteid,notpost,description,keywo    查看文档    - 更改文档 + 更改文档    已发布文档管理    $backurl "; - $msg = "
{$msg}
".GetUpdateTest(); + $msg = "
{$msg}
" . GetUpdateTest(); $wintitle = '成功发布文档!'; $wecome_info = '文档管理::发布文档'; @@ -266,4 +241,4 @@ color,writer,source,litpic,pubdate,senddate,mid,voteid,notpost,description,keywo $win->AddMsgItem($msg); $winform = $win->GetWindow('hand', ' ', false); $win->Display(); -} \ No newline at end of file +} diff --git a/src/dede/archives_do.php b/src/dede/archives_do.php index 378f0fac..98f5905c 100755 --- a/src/dede/archives_do.php +++ b/src/dede/archives_do.php @@ -1,23 +1,23 @@ GetOne($query); $gurl = $row['editcon']; - if($gurl=='') $gurl='article_edit.php'; + if ($gurl == '') $gurl = 'article_edit.php'; header("location:{$gurl}?aid=$aid"); exit(); } /*-------------------------- //浏览文档 function viewArchives(){ } ----------------------------*/ -else if($dopost=="viewArchives") -{ +---------------------------*/ else if ($dopost == "viewArchives") { $aid = preg_replace("#[^0-9]#", '', $aid); //获取主表信息 @@ -55,23 +52,19 @@ else if($dopost=="viewArchives") LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE arc.id='$aid' "; $trow = $dsql->GetOne($query); - $trow['maintable'] = ( trim($trow['maintable'])=='' ? '#@__archives' : trim($trow['maintable']) ); - if($trow['issystem'] != -1) - { + $trow['maintable'] = (trim($trow['maintable']) == '' ? '#@__archives' : trim($trow['maintable'])); + if ($trow['issystem'] != -1) { $arcQuery = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.sitepath,tp.siteurl FROM `{$trow['maintable']}` arc LEFT JOIN `#@__arctype` tp on arc.typeid=tp.id LEFT JOIN `#@__channeltype` ch on ch.id=arc.channel WHERE arc.id='$aid' "; $arcRow = $dsql->GetOne($arcQuery); - PutCookie('DedeUserID',$arcRow['mid'],1800); - PutCookie('DedeLoginTime',time(),1800); - if($arcRow['ismake']==-1 || $arcRow['corank']!=0 || $arcRow['arcrank']!=0 || ($arcRow['typeid']==0 && $arcRow['channel']!=-1) || $arcRow['money']>0) - { + PutCookie('DedeUserID', $arcRow['mid'], 1800); + PutCookie('DedeLoginTime', time(), 1800); + if ($arcRow['ismake'] == -1 || $arcRow['corank'] != 0 || $arcRow['arcrank'] != 0 || ($arcRow['typeid'] == 0 && $arcRow['channel'] != -1) || $arcRow['money'] > 0) { echo ""; exit(); } - } - else - { + } else { $arcRow['id'] = $aid; $arcRow['typeid'] = $trow['typeid']; $arcRow['senddate'] = $trow['senddate']; @@ -86,55 +79,66 @@ else if($dopost=="viewArchives") $arcRow['siteurl'] = $trow['siteurl']; $arcRow['sitepath'] = $trow['sitepath']; } - $arcurl = GetFileUrl($arcRow['id'],$arcRow['typeid'],$arcRow['senddate'],$arcRow['title'],$arcRow['ismake'],$arcRow['arcrank'], - $arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename'],$arcRow['moresite'],$arcRow['siteurl'],$arcRow['sitepath']); - $arcfile = GetFileUrl($arcRow['id'],$arcRow['typeid'],$arcRow['senddate'],$arcRow['title'], - $arcRow['ismake'],$arcRow['arcrank'],$arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename']); - if(preg_match("#^http:#", $arcfile)) - { + $arcurl = GetFileUrl( + $arcRow['id'], + $arcRow['typeid'], + $arcRow['senddate'], + $arcRow['title'], + $arcRow['ismake'], + $arcRow['arcrank'], + $arcRow['namerule'], + $arcRow['typedir'], + $arcRow['money'], + $arcRow['filename'], + $arcRow['moresite'], + $arcRow['siteurl'], + $arcRow['sitepath'] + ); + $arcfile = GetFileUrl( + $arcRow['id'], + $arcRow['typeid'], + $arcRow['senddate'], + $arcRow['title'], + $arcRow['ismake'], + $arcRow['arcrank'], + $arcRow['namerule'], + $arcRow['typedir'], + $arcRow['money'], + $arcRow['filename'] + ); + if (preg_match("#^http:#", $arcfile)) { $arcfile = preg_replace("#^http:\/\/([^\/]*)\/#i", '/', $arcfile); } - $truefile = GetTruePath().$arcfile; - if(!file_exists($truefile)) - { - MakeArt($aid,TRUE); + $truefile = GetTruePath() . $arcfile; + if (!file_exists($truefile)) { + MakeArt($aid, TRUE); } - echo ""; + echo ""; exit(); } /*-------------------------- //异步上传缩略图 function uploadLitpic(){ } ----------------------------*/ -else if($dopost=="uploadLitpic") -{ - $upfile = AdminUpload('litpic', 'imagelit', 0, false ); - if($upfile=='-1') - { +---------------------------*/ else if ($dopost == "uploadLitpic") { + $upfile = AdminUpload('litpic', 'imagelit', 0, false); + if ($upfile == '-1') { $msg = ""; - } - else if($upfile=='-2') - { + } else if ($upfile == '-2') { $msg = ""; - } - else if($upfile=='0') - { + } else if ($upfile == '0') { $msg = ""; - } - else - { - if(!empty($cfg_uplitpic_cut) && $cfg_uplitpic_cut=='N') - { - $msg = ""; - } - else - { - $msg = ""; - } + } } echo $msg; exit(); @@ -158,17 +160,13 @@ else if($dopost=="uploadLitpic") /*-------------------------- //推荐文档 function commendArchives(){ } ----------------------------*/ -else if($dopost=="commendArchives") -{ +---------------------------*/ else if ($dopost == "commendArchives") { CheckPurview('a_Commend,sys_ArcBatch'); - if( !empty($aid) && empty($qstr) ) - { + if (!empty($aid) && empty($qstr)) { $qstr = $aid; } - if($qstr=='') - { - ShowMsg("参数无效!",$ENV_GOBACK_URL); + if ($qstr == '') { + ShowMsg("参数无效!", $ENV_GOBACK_URL); exit(); } $arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr)); @@ -178,65 +176,54 @@ else if($dopost=="commendArchives") WHERE arc.id in($arcids) "; $dsql->SetQuery($query); $dsql->Execute(); - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $aid = $row['id']; - if($row['issystem']!=-1) - { - $maintable = ( trim($row['maintable'])=='' ? '#@__archives' : trim($row['maintable']) ); + if ($row['issystem'] != -1) { + $maintable = (trim($row['maintable']) == '' ? '#@__archives' : trim($row['maintable'])); $arr = $dsql->GetOne("SELECT flag FROM `{$maintable}` WHERE id='$aid' "); - $flag = ($arr['flag']=='' ? 'c' : $arr['flag'].',c'); + $flag = ($arr['flag'] == '' ? 'c' : $arr['flag'] . ',c'); $dsql->ExecuteNoneQuery(" UPDATE `{$maintable}` SET `flag`='$flag' WHERE id='{$aid}' "); - } - else - { + } else { $maintable = trim($row['addtable']); $arr = $dsql->GetOne("SELECT flag From `{$maintable}` where aid='$aid' "); - $flag = ($arr['flag']=='' ? 'c' : $arr['flag'].',c'); + $flag = ($arr['flag'] == '' ? 'c' : $arr['flag'] . ',c'); $dsql->ExecuteNoneQuery(" UPDATE `{$maintable}` SET `flag`='$flag' WHERE aid='{$aid}' "); } } - ShowMsg("成功把所选的文档设为推荐!",$ENV_GOBACK_URL); + ShowMsg("成功把所选的文档设为推荐!", $ENV_GOBACK_URL); exit(); } /*-------------------------- //生成HTML function makeArchives(); ----------------------------*/ -else if($dopost=="makeArchives") -{ +---------------------------*/ else if ($dopost == "makeArchives") { CheckPurview('sys_MakeHtml,sys_ArcBatch'); - if( !empty($aid) && empty($qstr) ) $qstr = $aid; - - if($qstr=='') - { - ShowMsg('参数无效!',$ENV_GOBACK_URL); + if (!empty($aid) && empty($qstr)) $qstr = $aid; + + if ($qstr == '') { + ShowMsg('参数无效!', $ENV_GOBACK_URL); exit(); } - require_once(DEDEADMIN.'/inc/inc_archives_functions.php'); - $qstrs = explode('`',$qstr); + require_once(DEDEADMIN . '/inc/inc_archives_functions.php'); + $qstrs = explode('`', $qstr); $i = 0; - foreach($qstrs as $aid) - { + foreach ($qstrs as $aid) { $i++; - $pageurl = MakeArt($aid,false); + $pageurl = MakeArt($aid, false); } - ShowMsg("成功更新指定 $i 个文件...",$ENV_GOBACK_URL); + ShowMsg("成功更新指定 $i 个文件...", $ENV_GOBACK_URL); exit(); } /*-------------------------- //审核文档 function checkArchives() { } ----------------------------*/ -else if($dopost=="checkArchives") -{ +---------------------------*/ else if ($dopost == "checkArchives") { CheckPurview('a_Check,a_AccCheck,sys_ArcBatch'); - require_once(DEDEADMIN."/inc/inc_archives_functions.php"); - if( !empty($aid) && empty($qstr) ) $qstr = $aid; - if($qstr=='') - { - ShowMsg("参数无效!",$ENV_GOBACK_URL); + require_once(DEDEADMIN . "/inc/inc_archives_functions.php"); + if (!empty($aid) && empty($qstr)) $qstr = $aid; + if ($qstr == '') { + ShowMsg("参数无效!", $ENV_GOBACK_URL); exit(); } $arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr)); @@ -246,74 +233,58 @@ else if($dopost=="checkArchives") WHERE arc.id in($arcids) "; $dsql->SetQuery($query); $dsql->Execute('ckall'); - while($row = $dsql->GetArray('ckall')) - { + while ($row = $dsql->GetArray('ckall')) { $aid = $row['id']; - $maintable = ( trim($row['maintable'])=='' ? '#@__archives' : trim($row['maintable']) ); + $maintable = (trim($row['maintable']) == '' ? '#@__archives' : trim($row['maintable'])); $dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET arcrank='0' WHERE id='$aid' "); - if($row['issystem']==-1) - { - $dsql->ExecuteNoneQuery("UPDATE `".trim($row['addtable'])."` SET arcrank='0' WHERE aid='$aid' "); - } - else - { - $dsql->ExecuteNoneQuery("UPDATE `$maintable` SET arcrank='0', dutyadmin='".$cuserLogin->getUserID()."' WHERE id='$aid' "); + if ($row['issystem'] == -1) { + $dsql->ExecuteNoneQuery("UPDATE `" . trim($row['addtable']) . "` SET arcrank='0' WHERE aid='$aid' "); + } else { + $dsql->ExecuteNoneQuery("UPDATE `$maintable` SET arcrank='0', dutyadmin='" . $cuserLogin->getUserID() . "' WHERE id='$aid' "); } - $dsql->ExecuteNoneQuery("UPDATE `#@__taglist` SET arcrank='0' WHERE aid='$aid' "); - $pageurl = MakeArt($aid,false); + $dsql->ExecuteNoneQuery("UPDATE `#@__taglist` SET arcrank='0' WHERE aid='$aid' "); + $pageurl = MakeArt($aid, false); } - ShowMsg("成功审核指定的文档!",$ENV_GOBACK_URL); + ShowMsg("成功审核指定的文档!", $ENV_GOBACK_URL); exit(); } /*-------------------------- //删除文档 function delArchives(){ } ----------------------------*/ -else if($dopost=="delArchives") -{ +---------------------------*/ else if ($dopost == "delArchives") { CheckPurview('a_Del,a_AccDel,a_MyDel,sys_ArcBatch'); - require_once(DEDEINC."/oxwindow.class.php"); - if(empty($fmdo)) $fmdo = ''; + require_once(DEDEINC . "/oxwindow.class.php"); + if (empty($fmdo)) $fmdo = ''; - if($fmdo=='yes') - { - if( !empty($aid) && empty($qstr) ) - { + if ($fmdo == 'yes') { + if (!empty($aid) && empty($qstr)) { $qstr = $aid; } - if($qstr=='') - { - ShowMsg("参数无效!",$ENV_GOBACK_URL); + if ($qstr == '') { + ShowMsg("参数无效!", $ENV_GOBACK_URL); exit(); } - $qstrs = explode("`",$qstr); - $okaids = Array(); + $qstrs = explode("`", $qstr); + $okaids = array(); - foreach($qstrs as $aid) - { - if(!isset($okaids[$aid])) - { + foreach ($qstrs as $aid) { + if (!isset($okaids[$aid])) { DelArc($aid); - } - else - { + } else { $okaids[$aid] = 1; } } - ShowMsg("成功删除指定的文档!",$ENV_GOBACK_URL); + ShowMsg("成功删除指定的文档!", $ENV_GOBACK_URL); exit(); - } - - else - { + } else { $wintitle = "文档管理-删除文档"; - $wecome_info = "文档管理::删除文档"; + $wecome_info = "文档管理::删除文档"; $win = new OxWindow(); - $win->Init("archives_do.php","js/blank.js","POST"); - $win->AddHidden("fmdo","yes"); - $win->AddHidden("dopost",$dopost); - $win->AddHidden("qstr",$qstr); - $win->AddHidden("aid",$aid); + $win->Init("archives_do.php", "js/blank.js", "POST"); + $win->AddHidden("fmdo", "yes"); + $win->AddHidden("dopost", $dopost); + $win->AddHidden("qstr", $qstr); + $win->AddHidden("aid", $aid); $win->AddTitle("你确实要删除“ $qstr 和 $aid ”这些文档?"); $winform = $win->GetWindow("ok"); $win->Display(); @@ -321,15 +292,12 @@ else if($dopost=="delArchives") } /*----------------------------- function moveArchives(){ } -------------------------------*/ -else if($dopost=='moveArchives') -{ +------------------------------*/ else if ($dopost == 'moveArchives') { CheckPurview('sys_ArcBatch'); - if(empty($totype)) - { - require_once(DEDEINC.'/typelink.class.php'); - if( !empty($aid) && empty($qstr) ) $qstr = $aid; - + if (empty($totype)) { + require_once(DEDEINC . '/typelink.class.php'); + if (!empty($aid) && empty($qstr)) $qstr = $aid; + AjaxHead(); $channelid = empty($channelid) ? 0 : $channelid; $tl = new TypeLink($aid); @@ -338,7 +306,7 @@ else if($dopost=='moveArchives') \r\n $typeOptions "; - + //输出AJAX可移动窗体 $divname = 'moveArchives'; echo "
\r\n"; @@ -350,55 +318,49 @@ else if($dopost=='moveArchives') echo "\r\n"; echo "\r\n"; ?> - - - - - - - - - - - - -
 目标栏目: - -
 文档ID: - -
- 移动到的目标栏目必须和选定的文档频道类型一致,否则程序会自动勿略不符合的文档。 -
- -    - -
- - +  目标栏目: + + + + + +  文档ID: + + +
+ 移动到的目标栏目必须和选定的文档频道类型一致,否则程序会自动勿略不符合的文档。 + + + + + +    + + + + + + + GetOne("SELECT tp.channeltype,tp.ispart,tp.channeltype,ch.maintable,ch.addtable,ch.issystem FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch on ch.id=tp.channeltype WHERE tp.id='$totype' "); $idtype = "id"; - if(!is_array($typeInfos)) - { - ShowMsg('参数错误!','-1'); + if (!is_array($typeInfos)) { + ShowMsg('参数错误!', '-1'); exit(); } - if($typeInfos['ispart']!=0) - { - ShowMsg('文档保存的栏目必须为最终列表栏目!','-1'); + if ($typeInfos['ispart'] != 0) { + ShowMsg('文档保存的栏目必须为最终列表栏目!', '-1'); exit(); } - if(empty($typeInfos['addtable'])) - { + if (empty($typeInfos['addtable'])) { $typeInfos['maintable'] = '#@__archives'; } //增加单表模型判断 - if($typeInfos['issystem'] == -1) - { + if ($typeInfos['issystem'] == -1) { $typeInfos['maintable'] = $typeInfos['addtable']; $idtype = "aid"; } @@ -408,10 +370,8 @@ else if($dopost=='moveArchives') $okids = array(); $dsql->SetQuery("SELECT {$idtype},typeid FROM `{$typeInfos['maintable']}` WHERE {$idtype} in($arcids) AND channel='{$typeInfos['channeltype']}' "); $dsql->Execute(); - while($row = $dsql->GetArray()) - { - if($row['typeid']!=$totype) - { + while ($row = $dsql->GetArray()) { + if ($row['typeid'] != $totype) { $dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET typeid='$totype' WHERE id='{$row[$idtype]}' "); $dsql->ExecuteNoneQuery("UPDATE `{$typeInfos['maintable']}` SET typeid='$totype' WHERE id='{$row[$idtype]}' "); $dsql->ExecuteNoneQuery("UPDATE `{$typeInfos['addtable']}` SET typeid='$totype' WHERE aid='{$row[$idtype]}' "); @@ -420,8 +380,7 @@ else if($dopost=='moveArchives') } } //更新HTML - foreach($okids as $aid) - { + foreach ($okids as $aid) { $arc = new Archives($aid); $arc->MakeHtml(); } @@ -432,89 +391,73 @@ else if($dopost=='moveArchives') /*----------------------------- //还原文档 function RbReturnArchives(){ } -------------------------------*/ -else if($dopost=='return') -{ +------------------------------*/ else if ($dopost == 'return') { CheckPurview('a_Del,a_AccDel,a_MyDel,sys_ArcBatch'); - require_once(DEDEINC."/oxwindow.class.php"); + require_once(DEDEINC . "/oxwindow.class.php"); - if( !empty($aid) && empty($qstr) ) $qstr = $aid; + if (!empty($aid) && empty($qstr)) $qstr = $aid; - if($qstr=='') - { - ShowMsg("参数无效!","recycling.php"); + if ($qstr == '') { + ShowMsg("参数无效!", "recycling.php"); exit(); } $qstrs = explode("`", $qstr); - foreach($qstrs as $aid) - { + foreach ($qstrs as $aid) { $dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET arcrank='-1',ismake='0' WHERE id='$aid'"); $dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET `arcrank` = '-1' WHERE id = '$aid'; "); } - ShowMsg("成功还原指定的文档!","recycling.php"); + ShowMsg("成功还原指定的文档!", "recycling.php"); exit(); } /*----------------------------- //清空文档 function RbClearArchives(){ } -------------------------------*/ -else if($dopost=='clear') -{ +------------------------------*/ else if ($dopost == 'clear') { CheckPurview('a_Del,a_AccDel,a_MyDel,sys_ArcBatch'); - require_once(DEDEINC."/oxwindow.class.php"); - if(empty($fmdo)) $fmdo = ''; - $recycle = empty($recycle)? "" : $recycle; + require_once(DEDEINC . "/oxwindow.class.php"); + if (empty($fmdo)) $fmdo = ''; + $recycle = empty($recycle) ? "" : $recycle; - if($fmdo=='yes') - { - if( !empty($aid) && empty($qstr) ) $qstr = $aid; - if($qstr=='') - { - ShowMsg("参数无效!","recycling.php"); + if ($fmdo == 'yes') { + if (!empty($aid) && empty($qstr)) $qstr = $aid; + if ($qstr == '') { + ShowMsg("参数无效!", "recycling.php"); exit(); } $qstrs = explode(",", $qstr); - $okaids = Array(); - foreach($qstrs as $qstr) - { - if(!isset($okaids[$qstr])) - { + $okaids = array(); + foreach ($qstrs as $qstr) { + if (!isset($okaids[$qstr])) { DelArc($qstr, "OK", FALSE, $recycle); $okaids[$qstr] = $qstr; - } - else - { + } else { $okaids[$qstr] = 1; } } - ShowMsg("成功删除指定的文档!","recycling.php"); + ShowMsg("成功删除指定的文档!", "recycling.php"); exit(); - } - else - { + } else { $dsql->SetQuery("SELECT id FROM `#@__archives` WHERE `arcrank` = '-2'"); $dsql->Execute(); $qstr = ''; - while($row = $dsql->GetArray()) - { - $qstr .= $row['id'].","; + while ($row = $dsql->GetArray()) { + $qstr .= $row['id'] . ","; $aid = $row['id']; } $num = $dsql->GetTotalRow(); - if(empty($num)) - { - ShowMsg("对不起,未发现相关文档!","recycling.php"); + if (empty($num)) { + ShowMsg("对不起,未发现相关文档!", "recycling.php"); exit(); } $wintitle = "文档管理-清空所有文档"; $wecome_info = "文档回收站::清空所有文档"; $win = new OxWindow(); - $win->Init("archives_do.php","js/blank.js","POST"); - $win->AddHidden("fmdo","yes"); - $win->AddHidden("dopost",$dopost); - $win->AddHidden("qstr",$qstr); - $win->AddHidden("aid",$aid); - $win->AddHidden("recycle",$recycle); + $win->Init("archives_do.php", "js/blank.js", "POST"); + $win->AddHidden("fmdo", "yes"); + $win->AddHidden("dopost", $dopost); + $win->AddHidden("qstr", $qstr); + $win->AddHidden("aid", $aid); + $win->AddHidden("recycle", $recycle); $win->AddTitle("本次操作将清空回收站所有共 $num 篇文档
你确实要永久删除“ $qstr ”这些文档?"); $winform = $win->GetWindow("ok"); $win->Display(); @@ -523,51 +466,40 @@ else if($dopost=='clear') /*----------------------------- //清除文档 function RbDelArchives(){ } -------------------------------*/ -else if($dopost=='del') -{ +------------------------------*/ else if ($dopost == 'del') { CheckPurview('a_Del,a_AccDel,a_MyDel,sys_ArcBatch'); - require_once(DEDEINC."/oxwindow.class.php"); - if(empty($fmdo)) $fmdo = ''; - $recycle = empty($recycle)? "" : $recycle; + require_once(DEDEINC . "/oxwindow.class.php"); + if (empty($fmdo)) $fmdo = ''; + $recycle = empty($recycle) ? "" : $recycle; - if($fmdo=='yes') - { - if( !empty($aid) && empty($qstr) ) $qstr = $aid; - if($qstr=='') - { - ShowMsg("参数无效!","recycling.php"); + if ($fmdo == 'yes') { + if (!empty($aid) && empty($qstr)) $qstr = $aid; + if ($qstr == '') { + ShowMsg("参数无效!", "recycling.php"); exit(); } $qstrs = explode("`", $qstr); - $okaids = Array(); + $okaids = array(); - foreach($qstrs as $aid) - { - if(!isset($okaids[$aid])) - { - DelArc($aid,"OK","",$recycle); - } - else - { + foreach ($qstrs as $aid) { + if (!isset($okaids[$aid])) { + DelArc($aid, "OK", "", $recycle); + } else { $okaids[$aid] = 1; } } - ShowMsg("成功删除指定的文档!","recycling.php"); + ShowMsg("成功删除指定的文档!", "recycling.php"); exit(); - } - - else - { + } else { $wintitle = "文档管理-删除文档"; $wecome_info = "文档管理::删除文档"; $win = new OxWindow(); - $win->Init("archives_do.php","js/blank.js","POST"); - $win->AddHidden("fmdo","yes"); - $win->AddHidden("dopost",$dopost); - $win->AddHidden("qstr",$qstr); - $win->AddHidden("aid",$aid); - $win->AddHidden("recycle",$recycle); + $win->Init("archives_do.php", "js/blank.js", "POST"); + $win->AddHidden("fmdo", "yes"); + $win->AddHidden("dopost", $dopost); + $win->AddHidden("qstr", $qstr); + $win->AddHidden("aid", $aid); + $win->AddHidden("recycle", $recycle); $win->AddTitle("你确实要永久删除“ $qstr 和 $aid ”这些文档?"); $winform = $win->GetWindow("ok"); $win->Display(); @@ -576,10 +508,8 @@ else if($dopost=='del') /*----------------------------- //快速编辑 function quickEdit(){ } -------------------------------*/ -else if($dopost=='quickEdit') -{ - require_once(DEDEADMIN."/inc/inc_catalog_options.php"); +------------------------------*/ else if ($dopost == 'quickEdit') { + require_once(DEDEADMIN . "/inc/inc_catalog_options.php"); AjaxHead(); $query = "SELECT ch.typename as channelname,ch.addtable,ar.membername as rankname,arc.* FROM `#@__archives` arc @@ -595,127 +525,119 @@ else if($dopost=='quickEdit') echo "\r\n"; echo "\r\n"; echo "\r\n"; -?> - - - + + - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + - - - - - - - - - -
 所属栏目: - getUserChannel(), $arcRow['channel']); + ?> +
 所属栏目: + getUserChannel(), $arcRow['channel']); echo ""; - ?> -
 属 性: - ' /> - SetQuery("SELECT * FROM `#@__arcatt` ORDER BY sortid ASC"); - $dsql->Execute(); - while($trow = $dsql->GetObject()) - { - if($trow->att=='j' || $trow->att=='p') continue; - if(preg_match("#".$trow->att."#", $arcRow['flag'])) - echo " "; - else - echo " "; - } - ?> -
 标 题: - -
 简略标题: - -
 阅读权限: -
 属 性: + ' /> + SetQuery("SELECT * FROM `#@__arcatt` ORDER BY sortid ASC"); + $dsql->Execute(); + while ($trow = $dsql->GetObject()) { + if ($trow->att == 'j' || $trow->att == 'p') continue; + if (preg_match("#" . $trow->att . "#", $arcRow['flag'])) + echo " "; + else + echo " "; + } + ?> +
 标 题: + +
 简略标题: + +
 阅读权限: + - 需要金币:" style="width:80px" /> -
 关键字: - -
- -    - -
- + $dsql->SetQuery("SELECT * FROM `#@__arcrank` WHERE adminrank<='$urank'"); + $dsql->Execute(); + while ($row = $dsql->GetObject()) { + echo " \r\n"; + } + ?> + + 需要金币:" style="width:80px" /> + + + +  关键字: + + + + + + + +    + + + + + + getUserID()); } } $title = dede_htmlspecialchars(cn_substrR($title, $cfg_title_maxlen)); $shorttitle = cn_substrR($shorttitle, 36); $keywords = trim(cn_substrR($keywords, 60)); - if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1; + if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1; $adminid = $cuserLogin->getUserID(); - + //属性处理 $flag = isset($flags) ? join(',', $flags) : ''; - if(!empty($flag)) - { - if(preg_match("#p#", $oldflag)) $flag .= ',p'; - if(preg_match("#j#", $oldflag)) $flag .= ',j'; + if (!empty($flag)) { + if (preg_match("#p#", $oldflag)) $flag .= ',p'; + if (preg_match("#j#", $oldflag)) $flag .= ',j'; } - /* + /* else { $flag = $oldflag; } */ - + $query = "UPDATE `#@__archives` SET typeid = '$typeid', flag = '$flag', @@ -731,31 +653,27 @@ else if($dopost=='quickEditSave') //更新微表 $dsql->ExecuteNoneQuery(" UPDATE `#@__arctiny` SET typeid='$typeid',arcrank='$arcrank' WHERE id='$aid' "); //更新附加表 - if($typeid != $oldtypeid) - { + if ($typeid != $oldtypeid) { $addtable = trim($addtable); - if(empty($addtable)) $addtable = '#@__addonarticle'; + if (empty($addtable)) $addtable = '#@__addonarticle'; else $addtable = preg_replace("#[^a-z0-9__#@-]#i", "", $addtable); - $dsql->ExecuteNoneQuery(" UPDATE `$addtable` SET typeid='$typeid' WHERE aid='$aid' "); - } + $dsql->ExecuteNoneQuery(" UPDATE `$addtable` SET typeid='$typeid' WHERE aid='$aid' "); + } //更新HTML $artUrl = MakeArt($aid, TRUE, TRUE); - $backurl = !empty($_COOKIE['ENV_GOBACK_URL']) ? $_COOKIE['ENV_GOBACK_URL'] : '-1'; - ShowMsg('成功更新一篇文档的基本信息!', $backurl); - exit(); + $backurl = !empty($_COOKIE['ENV_GOBACK_URL']) ? $_COOKIE['ENV_GOBACK_URL'] : '-1'; + ShowMsg('成功更新一篇文档的基本信息!', $backurl); + exit(); } /*-------------------------- 分析并自动获取文档关键词 function makekw(){ } ---------------------------*/ -else if($dopost=="makekw") -{ +--------------------------*/ else if ($dopost == "makekw") { CheckPurview('a_Commend,sys_ArcBatch'); - if( !empty($aid) && empty($qstr) ) $qstr = $aid; + if (!empty($aid) && empty($qstr)) $qstr = $aid; - if($qstr=='') - { + if ($qstr == '') { ShowMsg("参数无效!", $ENV_GOBACK_URL); exit(); } @@ -769,16 +687,15 @@ else if($dopost=="makekw") $client = new DedeBizClient($cfg_bizcore_hostname, $cfg_bizcore_port); $client->appid = $cfg_bizcore_appid; $client->key = $cfg_bizcore_key; - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { //跳过已经有关键字的内容 - if(trim($row['keywords']) !='' ) continue; + if (trim($row['keywords']) != '') continue; $aid = $row['id']; $keywords = ''; $title = $row['title']; $description = $row['description']; $body = cn_substr($row['body'], 5000); - $data = $client->Spliteword($title.Html2Text($body)); + $data = $client->Spliteword($title . Html2Text($body)); $keywords = $data->data; $description = str_replace(' ', ' ', trim($description)); $description = str_replace('[', ' ', $description); @@ -791,13 +708,12 @@ else if($dopost=="makekw") } $client->Close(); } else { - include_once(DEDEINC.'/splitword.class.php'); + include_once(DEDEINC . '/splitword.class.php'); $sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang); - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { //跳过已经有关键字的内容 - if(trim($row['keywords']) !='' ) continue; - + if (trim($row['keywords']) != '') continue; + $aid = $row['id']; $keywords = ''; $title = $row['title']; @@ -805,39 +721,30 @@ else if($dopost=="makekw") $body = cn_substr($row['body'], 5000); $sp->SetSource($title, $cfg_soft_lang, $cfg_soft_lang); $sp->StartAnalysis(); - $titleindexs = preg_replace("/#p#|#e#/",'',$sp->GetFinallyIndex()); + $titleindexs = preg_replace("/#p#|#e#/", '', $sp->GetFinallyIndex()); $sp->SetSource(Html2Text($body), $cfg_soft_lang, $cfg_soft_lang); $sp->StartAnalysis(); - $allindexs = preg_replace("/#p#|#e#/",'',$sp->GetFinallyIndex()); - - if(is_array($allindexs) && is_array($titleindexs)) - { - foreach($titleindexs as $k => $v) - { - if(strlen($keywords.$k)>=60) - { + $allindexs = preg_replace("/#p#|#e#/", '', $sp->GetFinallyIndex()); + + if (is_array($allindexs) && is_array($titleindexs)) { + foreach ($titleindexs as $k => $v) { + if (strlen($keywords . $k) >= 60) { break; - } - else - { - if(strlen($k) <= 2) continue; - $keywords .= $k.','; + } else { + if (strlen($k) <= 2) continue; + $keywords .= $k . ','; } } - foreach($allindexs as $k => $v) - { - if(strlen($keywords.$k)>=60) - { + foreach ($allindexs as $k => $v) { + if (strlen($keywords . $k) >= 60) { break; - } - else if(!in_array($k,$titleindexs)) - { - if(strlen($k) <= 2) continue; - $keywords .= $k.','; + } else if (!in_array($k, $titleindexs)) { + if (strlen($k) <= 2) continue; + $keywords .= $k . ','; } } } - + $description = str_replace(' ', ' ', trim($description)); $description = str_replace('[', ' ', $description); $description = str_replace(']', ' ', $description); @@ -857,20 +764,16 @@ else if($dopost=="makekw") /*-------------------------- //批量增加属性 function attsAdd(){ } ----------------------------*/ -else if($dopost=='attsAdd') -{ +---------------------------*/ else if ($dopost == 'attsAdd') { CheckPurview('a_Commend,sys_ArcBatch'); - if( !empty($aid) && empty($qstr) ) $qstr = $aid; + if (!empty($aid) && empty($qstr)) $qstr = $aid; - if($qstr=='') - { - ShowMsg("参数无效!",$ENV_GOBACK_URL); + if ($qstr == '') { + ShowMsg("参数无效!", $ENV_GOBACK_URL); exit(); } - if(empty($flagname)) - { - ShowMsg("必须指定要添加的属性!",$ENV_GOBACK_URL); + if (empty($flagname)) { + ShowMsg("必须指定要添加的属性!", $ENV_GOBACK_URL); exit(); } $arcids = preg_replace("#[^0-9,]#", '', preg_replace("#`#", ',', $qstr)); @@ -880,42 +783,34 @@ else if($dopost=='attsAdd') WHERE arc.id in($arcids) "; $dsql->SetQuery($query); $dsql->Execute(); - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $aid = $row['id']; - if($row['issystem'] != -1) - { - $maintable = ( trim($row['maintable'])=='' ? '#@__archives' : trim($row['maintable']) ); + if ($row['issystem'] != -1) { + $maintable = (trim($row['maintable']) == '' ? '#@__archives' : trim($row['maintable'])); $arr = $dsql->GetOne("SELECT flag FROM `{$maintable}` WHERE id='$aid' "); - $flag = ($arr['flag']=='' ? $flagname : $arr['flag'].','.$flagname); + $flag = ($arr['flag'] == '' ? $flagname : $arr['flag'] . ',' . $flagname); $dsql->ExecuteNoneQuery(" UPDATE `{$maintable}` SET `flag`='$flag' WHERE id='{$aid}' "); - } - else - { + } else { $maintable = trim($row['addtable']); $arr = $dsql->GetOne("SELECT flag FROM `{$maintable}` WHERE aid='$aid' "); - $flag = ($arr['flag']=='' ? $flagname : $arr['flag'].','.$flagname); + $flag = ($arr['flag'] == '' ? $flagname : $arr['flag'] . ',' . $flagname); $dsql->ExecuteNoneQuery(" UPDATE `{$maintable}` SET `flag`='$flag' WHERE aid='{$aid}' "); } } - ShowMsg("成功对选中文档增加指定的属性!",$ENV_GOBACK_URL); + ShowMsg("成功对选中文档增加指定的属性!", $ENV_GOBACK_URL); exit(); } /*-------------------------- //批量删除属性 function attsDel(){ } ----------------------------*/ -else if($dopost=='attsDel') -{ +---------------------------*/ else if ($dopost == 'attsDel') { CheckPurview('a_Commend,sys_ArcBatch'); - if( !empty($aid) && empty($qstr) ) $qstr = $aid; - if($qstr=='') - { + if (!empty($aid) && empty($qstr)) $qstr = $aid; + if ($qstr == '') { ShowMsg("参数无效!", $ENV_GOBACK_URL); exit(); } - if(empty($flagname)) - { + if (empty($flagname)) { ShowMsg("必须指定要删除的属性!", $ENV_GOBACK_URL); exit(); } @@ -926,33 +821,25 @@ else if($dopost=='attsDel') WHERE arc.id in($arcids) "; $dsql->SetQuery($query); $dsql->Execute(); - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $aid = $row['id']; - if($row['issystem'] != -1) - { + if ($row['issystem'] != -1) { $idname = 'id'; - $maintable = ( trim($row['maintable'])=='' ? '#@__archives' : trim($row['maintable']) ); + $maintable = (trim($row['maintable']) == '' ? '#@__archives' : trim($row['maintable'])); $arr = $dsql->GetOne("SELECT flag FROM `{$maintable}` WHERE id='$aid' "); - } - else - { + } else { $idname = 'aid'; $maintable = trim($row['addtable']); $arr = $dsql->GetOne("SELECT flag FROM `{$maintable}` WHERE aid='$aid' "); } $flag = $arr['flag']; - if(trim($flag)=='' || !preg_match("#".$flagname."#", $flag) ) - { + if (trim($flag) == '' || !preg_match("#" . $flagname . "#", $flag)) { continue; - } - else - { + } else { $flags = explode(',', $flag); $okflags = array(); - foreach($flags as $f) - { - if($f != $flagname) $okflags[] = $f; + foreach ($flags as $f) { + if ($f != $flagname) $okflags[] = $f; } } $flag = trim(join(',', $okflags)); @@ -964,12 +851,10 @@ else if($dopost=='attsDel') /*-------------------------- //获得批量属性处理的AJAX窗体 function attsDlg(){ } ----------------------------*/ -else if($dopost=='attsDlg') -{ - if( !empty($aid) && empty($qstr) ) $qstr = $aid; +---------------------------*/ else if ($dopost == 'attsDlg') { + if (!empty($aid) && empty($qstr)) $qstr = $aid; - $dojobname = ($dojob=='attsDel' ? '批量删除属性' : '批量增加属性'); + $dojobname = ($dojob == 'attsDel' ? '批量删除属性' : '批量增加属性'); AjaxHead(); //输出AJAX可移动窗体 $divname = 'attsDlg'; @@ -982,46 +867,43 @@ else if($dopost=='attsDlg') echo "\r\n"; echo "\r\n"; ?> - - - - - - - - - - - - -
 属 性: - ' /> - SetQuery("SELECT * FROM `#@__arcatt` ORDER BY sortid ASC"); - $dsql->Execute(); - while($trow = $dsql->GetObject()) - { - if($trow->att=='j' || $trow->att=='p') continue; - echo ""; - } - ?> -
 文档ID: - -
- -    - -
- + +  属 性: + + ' /> + SetQuery("SELECT * FROM `#@__arcatt` ORDER BY sortid ASC"); + $dsql->Execute(); + while ($trow = $dsql->GetObject()) { + if ($trow->att == 'j' || $trow->att == 'p') continue; + echo ""; + } + ?> + + + +  文档ID: + + + + + + + +    + + + + + + \r\n"; $tus = new TypeUnitSelector(); ?> -
-
- ListAllType($channelid); ?> -
-
- -    - -
-
+
+
+ ListAllType($channelid); ?> +
+
+ +    + +
+
\ No newline at end of file diff --git a/src/dede/archives_edit.php b/src/dede/archives_edit.php index b0d66758..05436369 100755 --- a/src/dede/archives_edit.php +++ b/src/dede/archives_edit.php @@ -1,24 +1,24 @@ GetOne($arcQuery); - if(!is_array($arcRow)) - { - ShowMsg("读取档案基本信息出错!","-1"); + if (!is_array($arcRow)) { + ShowMsg("读取档案基本信息出错!", "-1"); exit(); } - $query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'"; + $query = "SELECT * FROM `#@__channeltype` WHERE id='" . $arcRow['channel'] . "'"; $cInfos = $dsql->GetOne($query); - if(!is_array($cInfos)) - { - ShowMsg("读取频道配置信息出错!","javascript:;"); + if (!is_array($cInfos)) { + ShowMsg("读取频道配置信息出错!", "javascript:;"); exit(); } $addtable = $cInfos['addtable']; @@ -52,53 +50,44 @@ if($dopost!='save') } /*-------------------------------- function __save(){ } --------------------------------*/ -else if($dopost=='save') -{ - require_once(DEDEINC.'/image.func.php'); - require_once(DEDEINC.'/oxwindow.class.php'); - $flag = isset($flags) ? join(',',$flags) : ''; - $notpost = isset($notpost) && $notpost == 1 ? 1: 0; - if(empty($litpic_b64)) $litpic_b64 = ''; - - if(empty($typeid2)) $typeid2 = 0; - if(!isset($autokey)) $autokey = 0; - if(!isset($remote)) $remote = 0; - if(!isset($dellink)) $dellink = 0; - if(!isset($autolitpic)) $autolitpic = 0; - if(!isset($writer)) $writer = ''; - - if($typeid==0) - { - ShowMsg("请指定文档的栏目!","-1"); +-------------------------------*/ else if ($dopost == 'save') { + require_once(DEDEINC . '/image.func.php'); + require_once(DEDEINC . '/oxwindow.class.php'); + $flag = isset($flags) ? join(',', $flags) : ''; + $notpost = isset($notpost) && $notpost == 1 ? 1 : 0; + if (empty($litpic_b64)) $litpic_b64 = ''; + + if (empty($typeid2)) $typeid2 = 0; + if (!isset($autokey)) $autokey = 0; + if (!isset($remote)) $remote = 0; + if (!isset($dellink)) $dellink = 0; + if (!isset($autolitpic)) $autolitpic = 0; + if (!isset($writer)) $writer = ''; + + if ($typeid == 0) { + ShowMsg("请指定文档的栏目!", "-1"); exit(); } - if(empty($channelid)) - { - ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1"); + if (empty($channelid)) { + ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1"); exit(); } - if(!CheckChannel($typeid,$channelid)) - { - ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1"); + if (!CheckChannel($typeid, $channelid)) { + ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1"); exit(); } - if(!TestPurview('a_Edit')) - { - if(TestPurview('a_AccEdit')) - { - CheckCatalog($typeid,"对不起,你没有操作栏目 {$typeid} 的文档权限!"); - } - else - { - CheckArcAdmin($id,$cuserLogin->getUserID()); + if (!TestPurview('a_Edit')) { + if (TestPurview('a_AccEdit')) { + CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的文档权限!"); + } else { + CheckArcAdmin($id, $cuserLogin->getUserID()); } } //对保存的内容进行处理 $pubdate = GetMkTime($pubdate); $sortrank = AddDay($pubdate, $sortup); - $ismake = $ishtml==0 ? -1 : 0; + $ismake = $ishtml == 0 ? -1 : 0; $title = cn_substrR($title, $cfg_title_maxlen); $shorttitle = cn_substrR($shorttitle, 36); $color = cn_substrR($color, 7); @@ -108,77 +97,69 @@ else if($dopost=='save') $keywords = trim(cn_substrR($keywords, 60)); $filename = trim(cn_substrR($filename, 40)); $isremote = 0; - $serviterm=empty($serviterm)? "" : $serviterm; - if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1; + $serviterm = empty($serviterm) ? "" : $serviterm; + if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1; $adminid = $cuserLogin->getUserID(); //处理上传的缩略图 - if(empty($ddisremote)) $ddisremote = 0; + if (empty($ddisremote)) $ddisremote = 0; $litpic = GetDDImage('none', $picname, $ddisremote); // 处理新的缩略图上传 if ($litpic_b64 != "") { - $data = explode( ',', $litpic_b64 ); + $data = explode(',', $litpic_b64); $ntime = time(); - $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime); + $savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime); CreateDir($savepath); - $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999)); - $fullUrl = $fullUrl.".png"; - - file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] )); + $fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999)); + $fullUrl = $fullUrl . ".png"; + + file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1])); // 加水印 - WaterImg($cfg_basedir.$fullUrl, 'up'); + WaterImg($cfg_basedir . $fullUrl, 'up'); $litpic = $fullUrl; } //分析处理附加表数据 $inadd_f = ''; $inadd_v = ''; - if(!empty($dede_addonfields)) - { - $addonfields = explode(';',$dede_addonfields); + if (!empty($dede_addonfields)) { + $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理 - { - ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]); - }else + $vs = explode(',', $v); + if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理 { - if(!isset(${$vs[0]})) - { + ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]); + } else { + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$id); + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id); } - $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'"; + $inadd_f .= ",`{$vs[0]}` = '" . ${$vs[0]} . "'"; } } } //处理图片文档的自定义属性 - if($litpic!='' && !preg_match("#p#", $flag)) - { - $flag = ($flag=='' ? 'p' : $flag.',p'); + if ($litpic != '' && !preg_match("#p#", $flag)) { + $flag = ($flag == '' ? 'p' : $flag . ',p'); } - if($redirecturl!='' && !preg_match("#j#", $flag)) - { - $flag = ($flag=='' ? 'j' : $flag.',j'); + if ($redirecturl != '' && !preg_match("#j#", $flag)) { + $flag = ($flag == '' ? 'j' : $flag . ',j'); } //跳转网址的文档强制为动态 - if(preg_match("#j#", $flag)) $ismake = -1; + if (preg_match("#j#", $flag)) $ismake = -1; //更新数据库的SQL语句 $inQuery = "UPDATE `#@__archives` SET typeid='$typeid', @@ -203,52 +184,46 @@ else if($dopost=='save') dutyadmin='$adminid', weight='$weight' WHERE id='$id'; "; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { - ShowMsg("更新数据库archives表时出错,请检查!","-1"); + if (!$dsql->ExecuteNoneQuery($inQuery)) { + ShowMsg("更新数据库archives表时出错,请检查!", "-1"); exit(); } $cts = $dsql->GetOne("SELECT addtable From `#@__channeltype` WHERE id='$channelid' "); $addtable = trim($cts['addtable']); - if($addtable!='') - { + if ($addtable != '') { $useip = GetIP(); $iquery = "UPDATE `$addtable` SET typeid='$typeid'{$inadd_f},redirecturl='$redirecturl',userip='$useip' WHERE aid='$id' "; - if(!$dsql->ExecuteNoneQuery($iquery)) - { - ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!","javascript:;"); + if (!$dsql->ExecuteNoneQuery($iquery)) { + ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!", "javascript:;"); exit(); } } //生成HTML UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags); - if($cfg_remote_site=='Y' && $isremote=="1") - { - if($serviterm!="") - { + if ($cfg_remote_site == 'Y' && $isremote == "1") { + if ($serviterm != "") { list($servurl, $servuser, $servpwd) = explode(',', $serviterm); - $config=array( 'hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd,'debug' => 'TRUE'); + $config = array('hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd, 'debug' => 'TRUE'); } else { - $config=array(); + $config = array(); } - if(!$ftp->connect($config)) exit('Error:None FTP Connection!'); + if (!$ftp->connect($config)) exit('Error:None FTP Connection!'); } $artUrl = MakeArt($id, TRUE, TRUE, $isremote); - if($artUrl=='') - { - $artUrl = $cfg_phpurl."/view.php?aid=$id"; + if ($artUrl == '') { + $artUrl = $cfg_phpurl . "/view.php?aid=$id"; } ClearMyAddon($id, $title); - + // 自动更新关联内容 if (is_array($automake)) { foreach ($automake as $key => $value) { if (isset(${$key}) && !empty(${$key})) { $ids = explode(",", ${$key}); foreach ($ids as $id) { - MakeArt($id,true,true,$isremote); + MakeArt($id, true, true, $isremote); } } } @@ -259,7 +234,7 @@ else if($dopost=='save')   请选择你的后续操作: 发布新文档    - 查看更改 + 查看更改    查看文档    @@ -273,6 +248,6 @@ else if($dopost=='save') $win = new OxWindow(); $win->AddTitle("成功更改文档:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",false); + $winform = $win->GetWindow("hand", " ", false); $win->Display(); -} \ No newline at end of file +} diff --git a/src/dede/archives_sg_add.php b/src/dede/archives_sg_add.php index f33aabbf..dd55a811 100755 --- a/src/dede/archives_sg_add.php +++ b/src/dede/archives_sg_add.php @@ -1,39 +1,35 @@ 0 && $channelid == 0) - { + if ($cid > 0 && $channelid == 0) { $row = $dsql->GetOne("SELECT channeltype FROM `#@__arctype` WHERE id='$cid'; "); $channelid = $row['channeltype']; - } - else - { - if($channelid==0) - { - ShowMsg("无法识别模型信息,因此无法操作!","-1"); + } else { + if ($channelid == 0) { + ShowMsg("无法识别模型信息,因此无法操作!", "-1"); exit(); } } @@ -46,146 +42,126 @@ if($dopost!='save') } /*-------------------------------- function __save(){ } --------------------------------*/ -else if($dopost=='save') -{ - require_once(DEDEINC.'/image.func.php'); - require_once(DEDEINC.'/oxwindow.class.php'); - - if($typeid==0) - { - ShowMsg("请指定文档的栏目!","-1"); +-------------------------------*/ else if ($dopost == 'save') { + require_once(DEDEINC . '/image.func.php'); + require_once(DEDEINC . '/oxwindow.class.php'); + + if ($typeid == 0) { + ShowMsg("请指定文档的栏目!", "-1"); exit(); } - if(empty($channelid)) - { - ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1"); + if (empty($channelid)) { + ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1"); exit(); } - if(!CheckChannel($typeid,$channelid) ) - { - ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1"); + if (!CheckChannel($typeid, $channelid)) { + ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1"); exit(); } - if(!TestPurview('a_New')) - { - CheckCatalog($typeid,"对不起,你没有操作栏目 {$typeid} 的权限!"); + if (!TestPurview('a_New')) { + CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的权限!"); } //对保存的内容进行处理 - if(empty($writer))$writer=$cuserLogin->getUserName(); - if(empty($source))$source='未知'; - if(empty($flags)) $flag = ''; + if (empty($writer)) $writer = $cuserLogin->getUserName(); + if (empty($source)) $source = '未知'; + if (empty($flags)) $flag = ''; else $flag = join(',', $flags); $senddate = time(); - if(empty($litpic_b64)) $litpic_b64 = ''; - $title = cn_substrR($title,$cfg_title_maxlen); + if (empty($litpic_b64)) $litpic_b64 = ''; + $title = cn_substrR($title, $cfg_title_maxlen); $isremote = 0; - $serviterm=empty($serviterm)? "" : $serviterm; - if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1; + $serviterm = empty($serviterm) ? "" : $serviterm; + if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1; $adminid = $cuserLogin->getUserID(); $userip = GetIP(); - if(empty($ddisremote)) $ddisremote = 0; + if (empty($ddisremote)) $ddisremote = 0; $litpic = GetDDImage('none', $picname, $ddisremote); // 处理新的缩略图上传 if ($litpic_b64 != "") { - $data = explode( ',', $litpic_b64 ); + $data = explode(',', $litpic_b64); $ntime = time(); - $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime); + $savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime); CreateDir($savepath); - $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999)); - $fullUrl = $fullUrl.".png"; - - file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] )); + $fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999)); + $fullUrl = $fullUrl . ".png"; + + file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1])); // 加水印 - WaterImg($cfg_basedir.$fullUrl, 'up'); + WaterImg($cfg_basedir . $fullUrl, 'up'); $litpic = $fullUrl; } //生成文档ID $arcID = GetIndexKey($arcrank, $typeid, $senddate, $channelid, $senddate, $adminid); - if(empty($arcID)) - { - ShowMsg("无法获得主键,因此无法进行后续操作!","-1"); + if (empty($arcID)) { + ShowMsg("无法获得主键,因此无法进行后续操作!", "-1"); exit(); } //分析处理附加表数据 $inadd_f = ''; $inadd_v = ''; - if(!empty($dede_addonfields)) - { - $addonfields = explode(';',$dede_addonfields); + if (!empty($dede_addonfields)) { + $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理 - { - ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]); - } - else + $vs = explode(',', $v); + if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理 { - if(!isset(${$vs[0]})) - { + ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]); + } else { + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$arcID); + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID); } - $inadd_f .= ','.$vs[0]; - $inadd_v .= " ,'".${$vs[0]}."' "; + $inadd_f .= ',' . $vs[0]; + $inadd_v .= " ,'" . ${$vs[0]} . "' "; } } } //处理图片文档的自定义属性 - if($litpic!='' && !preg_match("#p#", $flag)) - { - $flag = ($flag=='' ? 'p' : $flag.',p'); + if ($litpic != '' && !preg_match("#p#", $flag)) { + $flag = ($flag == '' ? 'p' : $flag . ',p'); } //保存到附加表 $cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' "); $addtable = trim($cts['addtable']); - if(!empty($addtable)) - { + if (!empty($addtable)) { $query = "INSERT INTO `{$addtable}`(aid,typeid,channel,arcrank,mid,click,title,senddate,flag,litpic,userip{$inadd_f}) VALUES('$arcID','$typeid','$channelid','$arcrank','$adminid','0','$title','$senddate','$flag','$litpic','$userip'{$inadd_v})"; - if(!$dsql->ExecuteNoneQuery($query)) - { + if (!$dsql->ExecuteNoneQuery($query)) { $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCMS官方。".str_replace('"','',$gerr),"javascript:;"); + ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCMS官方。" . str_replace('"', '', $gerr), "javascript:;"); exit(); } } //生成HTML - if($cfg_remote_site=='Y' && $isremote=="1") - { - if($serviterm!="") - { + if ($cfg_remote_site == 'Y' && $isremote == "1") { + if ($serviterm != "") { list($servurl, $servuser, $servpwd) = explode(',', $serviterm); - $config=array( 'hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd,'debug' => 'TRUE'); + $config = array('hostname' => $servurl, 'username' => $servuser, 'password' => $servpwd, 'debug' => 'TRUE'); } else { - $config=array(); + $config = array(); } - if(!$ftp->connect($config)) exit('Error:None FTP Connection!'); + if (!$ftp->connect($config)) exit('Error:None FTP Connection!'); } $artUrl = MakeArt($arcID, TRUE, TRUE, $isremote); - if($artUrl=='') - { - $artUrl = $cfg_phpurl."/view.php?aid=$arcID"; + if ($artUrl == '') { + $artUrl = $cfg_phpurl . "/view.php?aid=$arcID"; } ClearMyAddon($arcID, $title); //返回成功信息 @@ -195,7 +171,7 @@ else if($dopost=='save')    查看文档    - 更改文档 + 更改文档    已发布文档管理    @@ -207,6 +183,6 @@ else if($dopost=='save') $win = new OxWindow(); $win->AddTitle("成功发布文档:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",false); + $winform = $win->GetWindow("hand", " ", false); $win->Display(); -} \ No newline at end of file +} diff --git a/src/dede/archives_sg_edit.php b/src/dede/archives_sg_edit.php index ef6b1078..9788c3b3 100755 --- a/src/dede/archives_sg_edit.php +++ b/src/dede/archives_sg_edit.php @@ -1,24 +1,24 @@ GetOne($arcQuery); - if(!is_array($cInfos)) - { - ShowMsg("读频道模型信息出错!","-1"); + if (!is_array($cInfos)) { + ShowMsg("读频道模型信息出错!", "-1"); exit(); } @@ -42,134 +41,116 @@ if($dopost!='save') } /*-------------------------------- function __save(){ } --------------------------------*/ -else if($dopost=='save') -{ - require_once(DEDEINC.'/image.func.php'); - require_once(DEDEINC.'/oxwindow.class.php'); - if($typeid==0) - { - ShowMsg("请指定文档的栏目!","-1"); +-------------------------------*/ else if ($dopost == 'save') { + require_once(DEDEINC . '/image.func.php'); + require_once(DEDEINC . '/oxwindow.class.php'); + if ($typeid == 0) { + ShowMsg("请指定文档的栏目!", "-1"); exit(); } - if(empty($channelid)) - { - ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1"); + if (empty($channelid)) { + ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1"); exit(); } - if(!CheckChannel($typeid,$channelid)) - { - ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1"); + if (!CheckChannel($typeid, $channelid)) { + ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1"); exit(); } - if(!TestPurview('a_Edit')) - { - if(TestPurview('a_AccEdit')) - { + if (!TestPurview('a_Edit')) { + if (TestPurview('a_AccEdit')) { CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的文档权限!"); - } - else - { - CheckArcAdmin($id,$cuserLogin->getUserID()); + } else { + CheckArcAdmin($id, $cuserLogin->getUserID()); } } //对保存的内容进行处理 - if(empty($flags)) $flag = ''; + if (empty($flags)) $flag = ''; else $flag = join(',', $flags); $title = cn_substrR($title, $cfg_title_maxlen); $isremote = 0; - $serviterm=empty($serviterm)? "" : $serviterm; - if(empty($litpic_b64)) $litpic_b64 = ''; - if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1; + $serviterm = empty($serviterm) ? "" : $serviterm; + if (empty($litpic_b64)) $litpic_b64 = ''; + if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1; $adminid = $cuserLogin->getUserID(); - + //处理上传的缩略图 - if(empty($ddisremote)) $ddisremote = 0; + if (empty($ddisremote)) $ddisremote = 0; $litpic = GetDDImage('none', $picname, $ddisremote); // 处理新的缩略图上传 if ($litpic_b64 != "") { - $data = explode( ',', $litpic_b64 ); + $data = explode(',', $litpic_b64); $ntime = time(); - $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime); + $savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime); CreateDir($savepath); - $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999)); - $fullUrl = $fullUrl.".png"; - - file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] )); + $fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999)); + $fullUrl = $fullUrl . ".png"; + + file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1])); // 加水印 - WaterImg($cfg_basedir.$fullUrl, 'up'); + WaterImg($cfg_basedir . $fullUrl, 'up'); $litpic = $fullUrl; } //分析处理附加表数据 $inadd_f = ''; $inadd_v = ''; - if(!empty($dede_addonfields)) - { + if (!empty($dede_addonfields)) { $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理 - { - ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]); - }else + $vs = explode(',', $v); + if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理 { - if(!isset(${$vs[0]})) - { + ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]); + } else { + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$id); + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id); } - $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'"; + $inadd_f .= ",`{$vs[0]}` = '" . ${$vs[0]} . "'"; } } } - + //处理图片文档的自定义属性 - if($litpic!='' && !preg_match("#p#", $flag)) - { - $flag = ($flag=='' ? 'p' : $flag.',p'); + if ($litpic != '' && !preg_match("#p#", $flag)) { + $flag = ($flag == '' ? 'p' : $flag . ',p'); } $cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' "); $addtable = trim($cts['addtable']); - if($addtable!='') - { + if ($addtable != '') { $iquery = "UPDATE `$addtable` SET typeid='$typeid',arcrank='$arcrank',title='$title',flag='$flag',litpic='$litpic'{$inadd_f} WHERE aid='$id' "; - if(!$dsql->ExecuteNoneQuery($iquery)) - { - ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!","javascript:;"); + if (!$dsql->ExecuteNoneQuery($iquery)) { + ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!", "javascript:;"); exit(); } } //生成HTML UpIndexKey($id, $arcrank, $typeid, $sortrank, ''); - if($cfg_remote_site=='Y' && $isremote=="1") - { - if($serviterm!="") - { + if ($cfg_remote_site == 'Y' && $isremote == "1") { + if ($serviterm != "") { list($servurl, $servuser, $servpwd) = explode(',', $serviterm); - $config = array( 'hostname' => $servurl, 'username' => $servuser, - 'password' => $servpwd,'debug' => 'TRUE'); + $config = array( + 'hostname' => $servurl, 'username' => $servuser, + 'password' => $servpwd, 'debug' => 'TRUE' + ); } else { $config = array(); } - if(!$ftp->connect($config)) exit('Error:None FTP Connection!'); + if (!$ftp->connect($config)) exit('Error:None FTP Connection!'); } $artUrl = MakeArt($id, TRUE, TRUE, $isremote); - if($artUrl=='') $artUrl = $cfg_phpurl."/view.php?aid=$id"; + if ($artUrl == '') $artUrl = $cfg_phpurl . "/view.php?aid=$id"; ClearMyAddon($id, $title); //返回成功信息 @@ -177,7 +158,7 @@ else if($dopost=='save')   请选择你的后续操作: 发布新文档    - 查看更改 + 查看更改    查看文档    @@ -191,6 +172,6 @@ else if($dopost=='save') $win = new OxWindow(); $win->AddTitle("成功更改文档:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",false); + $winform = $win->GetWindow("hand", " ", false); $win->Display(); -} \ No newline at end of file +} diff --git a/src/dede/article_add.php b/src/dede/article_add.php index 38faf927..2e906985 100755 --- a/src/dede/article_add.php +++ b/src/dede/article_add.php @@ -3,7 +3,7 @@ * 文档发布 * * @version $Id: article_add.php 2020年9月14日 tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -317,5 +317,3 @@ else if($dopost=='save') $winform = $win->GetWindow("hand"," ",false); $win->Display(); } - -?> \ No newline at end of file diff --git a/src/dede/article_allowurl_edit.php b/src/dede/article_allowurl_edit.php index 85d8fec8..f06335bd 100755 --- a/src/dede/article_allowurl_edit.php +++ b/src/dede/article_allowurl_edit.php @@ -1,44 +1,43 @@ alert('Save OK!');"; } //读出 -if(empty($allurls) && filesize($m_file)>0) -{ - $fp = fopen($m_file,'r'); - $allurls = fread($fp,filesize($m_file)); +if (empty($allurls) && filesize($m_file) > 0) { + $fp = fopen($m_file, 'r'); + $allurls = fread($fp, filesize($m_file)); fclose($fp); } $wintitle = ""; $wecome_info = "允许的超链接"; $win = new OxWindow(); -$win->Init('article_allowurl_edit.php','js/blank.js','POST'); -$win->AddHidden('dopost','save'); +$win->Init('article_allowurl_edit.php', 'js/blank.js', 'POST'); +$win->AddHidden('dopost', 'save'); $win->AddTitle("每行保存一个超链接:"); $win->AddMsgItem(""); $winform = $win->GetWindow('ok'); -$win->Display(); \ No newline at end of file +$win->Display(); diff --git a/src/dede/article_coonepage_rule.php b/src/dede/article_coonepage_rule.php index e6e30a9e..0b3143dc 100755 --- a/src/dede/article_coonepage_rule.php +++ b/src/dede/article_coonepage_rule.php @@ -1,123 +1,113 @@ GetOne("SELECT * FROM `#@__co_onepage` WHERE url LIKE '$url' "); - if(is_array($row)) - { - echo "系统已经存在这个网址的条目!"; - } else { - $query = " INSERT INTO `#@__co_onepage`(`url`,`title`,`issource`,`lang`,`rule`) Values('$url','$title','$issource','$lang','$rule'); "; - $dsql->ExecuteNonequery($query); - echo $dsql->GetError(); - } +if ($action == 'add') { + $row = $dsql->GetOne("SELECT * FROM `#@__co_onepage` WHERE url LIKE '$url' "); + if (is_array($row)) { + echo "系统已经存在这个网址的条目!"; + } else { + $query = " INSERT INTO `#@__co_onepage`(`url`,`title`,`issource`,`lang`,`rule`) Values('$url','$title','$issource','$lang','$rule'); "; + $dsql->ExecuteNonequery($query); + echo $dsql->GetError(); + } } /*------ function _DelNote(){ } --------*/ -else if($action == 'del') -{ - if(!preg_match("#,#", $ids)) - { - $query = "DELETE FROM `#@__co_onepage` WHERE id='$ids' "; - } - else - { - $query = "DELETE FROM `#@__co_onepage` WHERE id IN($ids) "; - } - $dsql->ExecuteNonequery($query); +-------*/ else if ($action == 'del') { + if (!preg_match("#,#", $ids)) { + $query = "DELETE FROM `#@__co_onepage` WHERE id='$ids' "; + } else { + $query = "DELETE FROM `#@__co_onepage` WHERE id IN($ids) "; + } + $dsql->ExecuteNonequery($query); } /*------ function _EditNote(){ } --------*/ -else if($action == 'editsave') -{ - $query = "UPDATE `#@__co_onepage` SET `url`='$url',`title`='$title',`issource`='$issource',`lang`='$lang',`rule`='$rule' WHERE id='$id' "; - $dsql->ExecuteNonequery($query); - echo $dsql->GetError(); +-------*/ else if ($action == 'editsave') { + $query = "UPDATE `#@__co_onepage` SET `url`='$url',`title`='$title',`issource`='$issource',`lang`='$lang',`rule`='$rule' WHERE id='$id' "; + $dsql->ExecuteNonequery($query); + echo $dsql->GetError(); } /*------ function _EditNoteLoad(){ } --------*/ -else if($action == 'editload') -{ - $row = $dsql->GetOne("SELECT * FROM `#@__co_onepage` WHERE id='$id' "); - AjaxHead(); +-------*/ else if ($action == 'editload') { + $row = $dsql->GetOne("SELECT * FROM `#@__co_onepage` WHERE id='$id' "); + AjaxHead(); ?> -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
网站名称:
原内容编码: - - -
用作文章来源: - - -
网站网址: - -
  - 使用不带http及任何附加目录的网址
- 如:news.dedecms.com -
采集规则:仅针对文章内容,格式:前面HTML{@body}后面HMTL
 
  -
-
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
网站名称:
原内容编码: + + +
用作文章来源: + + +
网站网址: + +
  + 使用不带http及任何附加目录的网址
+ 如:news.dedebiz.com +
采集规则:仅针对文章内容,格式:前面HTML{@body}后面HMTL
 
  +
+
SetTemplate(DEDEADMIN."/templets/article_coonepage_rule.htm"); +$dlist->SetTemplate(DEDEADMIN . "/templets/article_coonepage_rule.htm"); $dlist->SetSource($sql); $dlist->Display(); diff --git a/src/dede/article_description_main.php b/src/dede/article_description_main.php index e3629153..7a7542cb 100755 --- a/src/dede/article_description_main.php +++ b/src/dede/article_description_main.php @@ -1,65 +1,56 @@ 250) $dsize = 250; + if ($dsize > 250) $dsize = 250; $tjnum = 0; //获取自动摘要 - if($dojob=='des') - { - if(empty($totalnum)) - { + if ($dojob == 'des') { + if (empty($totalnum)) { $addquery = ""; - if($sid!=0) - { + if ($sid != 0) { $addquery .= " AND id>='$sid' "; } - if($eid!=0) - { + if ($eid != 0) { $addquery .= " AND id<='$eid' "; } $tjQuery = "SELECT COUNT(*) AS dd FROM #@__archives WHERE channel='{$channel}' $addquery"; $row = $dsql->GetOne($tjQuery); $totalnum = $row['dd']; } - if($totalnum > 0) - { + if ($totalnum > 0) { $addquery = ""; - if($sid!=0) - { + if ($sid != 0) { $addquery .= " AND #@__archives.id>='$sid' "; } - if($eid!=0) - { + if ($eid != 0) { $addquery .= " AND #@__archives.id<='$eid' "; } $fquery = "SELECT #@__archives.id,#@__archives.title,#@__archives.description,{$table}.{$field} @@ -67,22 +58,18 @@ else WHERE #@__archives.channel='{$channel}' $addquery LIMIT $startdd,$pagesize ; "; $dsql->SetQuery($fquery); $dsql->Execute(); - while($row=$dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $body = $row[$field]; $description = $row['description']; - if(strlen($description)>10 || $description=='-') - { + if (strlen($description) > 10 || $description == '-') { continue; } - $bodytext = preg_replace("/#p#|#e#|副标题|分页标题/isU","",Html2Text($body)); - if(strlen($bodytext) < $msize) - { + $bodytext = preg_replace("/#p#|#e#|副标题|分页标题/isU", "", Html2Text($body)); + if (strlen($bodytext) < $msize) { continue; } - $des = trim(addslashes(cn_substr($bodytext,$dsize))); - if(strlen($des)<3) - { + $des = trim(addslashes(cn_substr($bodytext, $dsize))); + if (strlen($des) < 3) { $des = "-"; } $dsql->ExecuteNoneQuery("UPDATE #@__archives SET description='{$des}' WHERE id='{$row['id']}';"); @@ -90,11 +77,10 @@ else //返回进度信息 $startdd = $startdd + $pagesize; - if($totalnum > $startdd) - { - $tjlen = ceil( ($startdd/$totalnum) * 100 ); + if ($totalnum > $startdd) { + $tjlen = ceil(($startdd / $totalnum) * 100); } else { - $tjlen=100; + $tjlen = 100; ShowMsg('完成所有任务', 'javascript:;'); exit(); } @@ -102,84 +88,66 @@ else $tjsta = "
"; $tjsta .= "
完成处理文档总数的:$tjlen %,继续执行任务..."; $nurl = "article_description_main.php?totalnum=$totalnum&startdd={$startdd}&pagesize=$pagesize&table={$table}&field={$field}&dsize={$dsize}&msize={$msize}&channel={$channel}&dojob={$dojob}"; - ShowMsg($tjsta,$nurl,0,500); + ShowMsg($tjsta, $nurl, 0, 500); exit(); - } - else - { + } else { ShowMsg('完成所有任务', 'javascript:;'); exit(); } - }//获取自动摘要代码结束 + } //获取自动摘要代码结束 //更新自动分页 - if($dojob=='page') - { - require_once(DEDEADMIN."/inc/inc_archives_functions.php"); + if ($dojob == 'page') { + require_once(DEDEADMIN . "/inc/inc_archives_functions.php"); $addquery = ""; - if($sid!=0) - { + if ($sid != 0) { $addquery .= " and aid>='$sid' "; } - if($eid!=0) - { + if ($eid != 0) { $addquery .= " and aid<='$eid' "; } //统计记录总数 - if($totalnum==0) - { + if ($totalnum == 0) { $sql = "SELECT COUNT(*) AS dd FROM $table WHERE 1 $addquery"; $row = $dsql->GetOne($sql); $totalnum = $row['dd']; } //获取记录,并分析 - if($totalnum > $startdd+$pagesize) - { + if ($totalnum > $startdd + $pagesize) { $limitSql = " LIMIT $startdd,$pagesize"; - } - else if(($totalnum-$startdd)>0) - { - $limitSql = " LIMIT $startdd,".($totalnum - $startdd); - } - else - { + } else if (($totalnum - $startdd) > 0) { + $limitSql = " LIMIT $startdd," . ($totalnum - $startdd); + } else { $limitSql = ""; } $tjnum = $startdd; - if($limitSql!="") - { + if ($limitSql != "") { $fquery = "SELECT aid,$field FROM $table WHERE 1 $addquery $limitSql ;"; $dsql->SetQuery($fquery); $dsql->Execute(); - while($row=$dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $tjnum++; $body = $row[$field]; $aid = $row['aid']; - if(strlen($body) < $msize) - { + if (strlen($body) < $msize) { continue; } - if(!preg_match("/#p#/iU",$body)) - { - $body = SpLongBody($body,$cfg_arcautosp_size*1024,"#p#分页标题#e#"); + if (!preg_match("/#p#/iU", $body)) { + $body = SpLongBody($body, $cfg_arcautosp_size * 1024, "#p#分页标题#e#"); $body = addslashes($body); $dsql->ExecuteNoneQuery("UPDATE $table SET $field='$body' WHERE aid='$aid' ; "); } } - }//end if limit + } //end if limit //返回进度提示 - if($totalnum>0) - { - $tjlen = ceil( ($tjnum/$totalnum) * 100 ); - } - else - { - $tjlen=100; + if ($totalnum > 0) { + $tjlen = ceil(($tjnum / $totalnum) * 100); + } else { + $tjlen = 100; } $dvlen = $tjlen * 2; @@ -187,16 +155,13 @@ else $tjsta = "
"; $tjsta .= "
完成处理文档总数的:$tjlen %,继续执行任务..."; - if($tjnum < $totalnum) - { - $nurl = "article_description_main.php?totalnum=$totalnum&startdd=".($startdd+$pagesize)."&pagesize=$pagesize&table={$table}&field={$field}&dsize={$dsize}&msize={$msize}&channel={$channel}&dojob={$dojob}"; - ShowMsg($tjsta,$nurl,0,500); + if ($tjnum < $totalnum) { + $nurl = "article_description_main.php?totalnum=$totalnum&startdd=" . ($startdd + $pagesize) . "&pagesize=$pagesize&table={$table}&field={$field}&dsize={$dsize}&msize={$msize}&channel={$channel}&dojob={$dojob}"; + ShowMsg($tjsta, $nurl, 0, 500); exit(); - } - else - { + } else { ShowMsg('完成所有任务', 'javascript:;'); exit(); } - }//更新自动分页处理代码结束 -} \ No newline at end of file + } //更新自动分页处理代码结束 +} diff --git a/src/dede/article_edit.php b/src/dede/article_edit.php index b87c6b36..c66d8b3d 100755 --- a/src/dede/article_edit.php +++ b/src/dede/article_edit.php @@ -1,29 +1,28 @@ GetOne($query); - if(!is_array($arcRow)) - { - ShowMsg("读取档案基本信息出错!","-1"); + if (!is_array($arcRow)) { + ShowMsg("读取档案基本信息出错!", "-1"); exit(); } - $query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'"; + $query = "SELECT * FROM `#@__channeltype` WHERE id='" . $arcRow['channel'] . "'"; $cInfos = $dsql->GetOne($query); - if(!is_array($cInfos)) - { - ShowMsg("读取频道配置信息出错!","javascript:;"); + if (!is_array($cInfos)) { + ShowMsg("读取频道配置信息出错!", "javascript:;"); exit(); } $addtable = $cInfos['addtable']; $addRow = $dsql->GetOne("SELECT * FROM `$addtable` WHERE aid='$aid'"); - if(!is_array($addRow)) - { - ShowMsg("读取附加信息出错!","javascript:;"); + if (!is_array($addRow)) { + ShowMsg("读取附加信息出错!", "javascript:;"); exit(); } $channelid = $arcRow['channel']; @@ -58,44 +54,35 @@ if($dopost!='save') } /*-------------------------------- function __save(){ } --------------------------------*/ -else if($dopost=='save') -{ - require_once(DEDEINC.'/image.func.php'); - require_once(DEDEINC.'/oxwindow.class.php'); - $flag = isset($flags) ? join(',',$flags) : ''; - $notpost = isset($notpost) && $notpost == 1 ? 1: 0; - - if(empty($typeid2)) $typeid2 = 0; - if(!isset($autokey)) $autokey = 0; - if(!isset($remote)) $remote = 0; - if(!isset($dellink)) $dellink = 0; - if(!isset($autolitpic)) $autolitpic = 0; - if(empty($litpic_b64)) $litpic_b64 = ''; - - if(empty($typeid)) - { +-------------------------------*/ else if ($dopost == 'save') { + require_once(DEDEINC . '/image.func.php'); + require_once(DEDEINC . '/oxwindow.class.php'); + $flag = isset($flags) ? join(',', $flags) : ''; + $notpost = isset($notpost) && $notpost == 1 ? 1 : 0; + + if (empty($typeid2)) $typeid2 = 0; + if (!isset($autokey)) $autokey = 0; + if (!isset($remote)) $remote = 0; + if (!isset($dellink)) $dellink = 0; + if (!isset($autolitpic)) $autolitpic = 0; + if (empty($litpic_b64)) $litpic_b64 = ''; + + if (empty($typeid)) { ShowMsg("请指定文档的栏目!", "-1"); exit(); } - if(empty($channelid)) - { + if (empty($channelid)) { ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1"); exit(); } - if(!CheckChannel($typeid, $channelid)) - { + if (!CheckChannel($typeid, $channelid)) { ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1"); exit(); } - if(!TestPurview('a_Edit')) - { - if(TestPurview('a_AccEdit')) - { + if (!TestPurview('a_Edit')) { + if (TestPurview('a_AccEdit')) { CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的文档权限!"); - } - else - { + } else { CheckArcAdmin($id, $cuserLogin->getUserID()); } } @@ -103,96 +90,86 @@ else if($dopost=='save') //对保存的内容进行处理 $pubdate = GetMkTime($pubdate); - $sortrank = AddDay($pubdate,$sortup); - $ismake = $ishtml==0 ? -1 : 0; + $sortrank = AddDay($pubdate, $sortup); + $ismake = $ishtml == 0 ? -1 : 0; $autokey = 1; - $title = dede_htmlspecialchars(cn_substrR($title,$cfg_title_maxlen)); - $shorttitle = cn_substrR($shorttitle,36); - $color = cn_substrR($color,7); - $writer = cn_substrR($writer,20); - $source = cn_substrR($source,30); - $description = cn_substrR($description,250); - $keywords = trim(cn_substrR($keywords,60)); - $filename = trim(cn_substrR($filename,40)); + $title = dede_htmlspecialchars(cn_substrR($title, $cfg_title_maxlen)); + $shorttitle = cn_substrR($shorttitle, 36); + $color = cn_substrR($color, 7); + $writer = cn_substrR($writer, 20); + $source = cn_substrR($source, 30); + $description = cn_substrR($description, 250); + $keywords = trim(cn_substrR($keywords, 60)); + $filename = trim(cn_substrR($filename, 40)); $isremote = 0; - $serviterm=empty($serviterm)? "" : $serviterm; - if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) - { + $serviterm = empty($serviterm) ? "" : $serviterm; + if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) { $arcrank = -1; } $adminid = $cuserLogin->getUserID(); //处理上传的缩略图 - if(empty($ddisremote)) - { + if (empty($ddisremote)) { $ddisremote = 0; } - $litpic = GetDDImage('none',$picname,$ddisremote); + $litpic = GetDDImage('none', $picname, $ddisremote); //分析body里的内容 - $body = AnalyseHtmlBody($body,$description,$litpic,$keywords,'htmltext'); + $body = AnalyseHtmlBody($body, $description, $litpic, $keywords, 'htmltext'); //分析处理附加表数据 $inadd_f = ''; $inadd_v = ''; - if(!empty($dede_addonfields)) - { - $addonfields = explode(';',$dede_addonfields); + if (!empty($dede_addonfields)) { + $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理 + $vs = explode(',', $v); + if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理 { - ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]); - }else - { - if(!isset(${$vs[0]})) - { + ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]); + } else { + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$id); + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id); } - $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'"; + $inadd_f .= ",`{$vs[0]}` = '" . ${$vs[0]} . "'"; } } } // 处理新的缩略图上传 if ($litpic_b64 != "") { - $data = explode( ',', $litpic_b64 ); + $data = explode(',', $litpic_b64); $ntime = time(); - $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime); + $savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime); CreateDir($savepath); - $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999)); - $fullUrl = $fullUrl.".png"; - - file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] )); + $fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999)); + $fullUrl = $fullUrl . ".png"; + + file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1])); // 加水印 - WaterImg($cfg_basedir.$fullUrl, 'up'); + WaterImg($cfg_basedir . $fullUrl, 'up'); $litpic = $fullUrl; } //处理图片文档的自定义属性 - if($litpic!='' && !preg_match("#p#", $flag)) - { - $flag = ($flag=='' ? 'p' : $flag.',p'); + if ($litpic != '' && !preg_match("#p#", $flag)) { + $flag = ($flag == '' ? 'p' : $flag . ',p'); } - if($redirecturl!='' && !preg_match("#j#", $flag)) - { - $flag = ($flag=='' ? 'j' : $flag.',j'); + if ($redirecturl != '' && !preg_match("#j#", $flag)) { + $flag = ($flag == '' ? 'j' : $flag . ',j'); } //跳转网址的文档强制为动态 - if(preg_match("#j#", $flag)) $ismake = -1; + if (preg_match("#j#", $flag)) $ismake = -1; //更新数据库的SQL语句 $query = "UPDATE #@__archives SET typeid='$typeid', @@ -218,43 +195,40 @@ else if($dopost=='save') weight='$weight' WHERE id='$id'; "; - if(!$dsql->ExecuteNoneQuery($query)) - { - ShowMsg('更新数据库archives表时出错,请检查',-1); + if (!$dsql->ExecuteNoneQuery($query)) { + ShowMsg('更新数据库archives表时出错,请检查', -1); exit(); } - + $cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' "); $addtable = trim($cts['addtable']); - if($addtable!='') - { + if ($addtable != '') { $useip = GetIP(); $templet = empty($templet) ? '' : $templet; $iquery = "UPDATE `$addtable` SET typeid='$typeid',body='$body'{$inadd_f},redirecturl='$redirecturl',templet='$templet',userip='$useip' WHERE aid='$id'"; - if(!$dsql->ExecuteNoneQuery($iquery)) - { - ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!","javascript:;"); + if (!$dsql->ExecuteNoneQuery($iquery)) { + ShowMsg("更新附加表 `$addtable` 时出错,请检查原因!", "javascript:;"); exit(); } } //生成HTML UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags); - if($cfg_remote_site=='Y' && $isremote=="1") - { - if($serviterm!=""){ + if ($cfg_remote_site == 'Y' && $isremote == "1") { + if ($serviterm != "") { list($servurl, $servuser, $servpwd) = explode(',', $serviterm); - $config=array( 'hostname' => $servurl, 'username' => $servuser, - 'password' => $servpwd,'debug' => 'TRUE'); + $config = array( + 'hostname' => $servurl, 'username' => $servuser, + 'password' => $servpwd, 'debug' => 'TRUE' + ); } else { - $config=array(); + $config = array(); } - if(!$ftp->connect($config)) exit('Error:None FTP Connection!'); + if (!$ftp->connect($config)) exit('Error:None FTP Connection!'); } - $artUrl = MakeArt($id,true,true,$isremote); - if($artUrl=='') - { - $artUrl = $cfg_phpurl."/view.php?aid=$id"; + $artUrl = MakeArt($id, true, true, $isremote); + if ($artUrl == '') { + $artUrl = $cfg_phpurl . "/view.php?aid=$id"; } ClearMyAddon($id, $title); @@ -264,18 +238,18 @@ else if($dopost=='save') if (isset(${$key}) && !empty(${$key})) { $ids = explode(",", ${$key}); foreach ($ids as $id) { - MakeArt($id,true,true,$isremote); + MakeArt($id, true, true, $isremote); } } } } - + //返回成功信息 $msg = "   请选择你的后续操作: 发布新文章    - 查看更改 + 查看更改    查看文章    @@ -289,6 +263,6 @@ else if($dopost=='save') $win = new OxWindow(); $win->AddTitle("成功更改文章:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",false); + $winform = $win->GetWindow("hand", " ", false); $win->Display(); -} \ No newline at end of file +} diff --git a/src/dede/article_keywords_main.php b/src/dede/article_keywords_main.php index 832b38d9..33734451 100755 --- a/src/dede/article_keywords_main.php +++ b/src/dede/article_keywords_main.php @@ -1,104 +1,93 @@ ExecuteNoneQuery("DELETE FROM `#@__keywords` WHERE aid='$aid'"); continue; } //禁用项目 - $staold = ${'staold_'.$aid}; - $sta = empty(${'isnouse_'.$aid}) ? 1 : 0; - if($staold!=$sta) - { + $staold = ${'staold_' . $aid}; + $sta = empty(${'isnouse_' . $aid}) ? 1 : 0; + if ($staold != $sta) { $query1 = "UPDATE `#@__keywords` SET sta='$sta',rpurl='$rpurl' WHERE aid='$aid' "; $dsql->ExecuteNoneQuery($query1); continue; } //更新链接网址 - if($rpurl!=$rpurlold) - { + if ($rpurl != $rpurlold) { $query1 = "UPDATE `#@__keywords` SET rpurl='$rpurl' WHERE aid='$aid' "; $dsql->ExecuteNoneQuery($query1); } } - ShowMsg("完成指定的更改!",$ENV_GOBACK_URL); + ShowMsg("完成指定的更改!", $ENV_GOBACK_URL); exit(); } //增加关键字 -else if($dopost=='add') -{ +else if ($dopost == 'add') { $ENV_GOBACK_URL = empty($_COOKIE['ENV_GOBACK_URL']) ? "-1" : $_COOKIE['ENV_GOBACK_URL']; $keyword = trim($keyword); $rank = preg_replace("#[^0-9]#", '', $rank); - if($keyword=='') - { - ShowMsg("关键字不能为空!",-1); + if ($keyword == '') { + ShowMsg("关键字不能为空!", -1); exit(); } $row = $dsql->GetOne("SELECT * FROM `#@__keywords` WHERE keyword LIKE '$keyword'"); - if(is_array($row)) - { - ShowMsg("关键字已存在库中!","-1"); + if (is_array($row)) { + ShowMsg("关键字已存在库中!", "-1"); exit(); } $inquery = "INSERT INTO `#@__keywords`(keyword,rank,sta,rpurl) VALUES ('$keyword','$rank','1','$rpurl');"; $dsql->ExecuteNoneQuery($inquery); - ShowMsg("成功增加一个关键字!",$ENV_GOBACK_URL); + ShowMsg("成功增加一个关键字!", $ENV_GOBACK_URL); exit(); } -if(empty($keyword)) -{ +if (empty($keyword)) { $keyword = ''; $addquery = ''; -} -else -{ +} else { $addquery = " WHERE keyword LIKE '%$keyword%' "; } $sql = "SELECT * FROM `#@__keywords` $addquery ORDER BY rank DESC"; $dlist = new DataListCP(); $dlist->pageSize = 20; -$dlist->SetParameter("keyword",$keyword); -$dlist->SetTemplate(DEDEADMIN."/templets/article_keywords_main.htm"); +$dlist->SetParameter("keyword", $keyword); +$dlist->SetTemplate(DEDEADMIN . "/templets/article_keywords_main.htm"); $dlist->SetSource($sql); $dlist->Display(); function GetSta($sta) { - if($sta==1) return ''; + if ($sta == 1) return ''; else return ' checked="1" '; -} \ No newline at end of file +} diff --git a/src/dede/article_keywords_make.php b/src/dede/article_keywords_make.php index 9dbc3045..4acb5ddd 100755 --- a/src/dede/article_keywords_make.php +++ b/src/dede/article_keywords_make.php @@ -1,30 +1,29 @@ \r\n"; flush(); $ws = $wserr = $wsnew = ""; $dsql->SetQuery("SELECT * FROM `#@__keywords`"); $dsql->Execute(); - while($row = $dsql->GetObject()) - { - if($row->sta==1) $ws[$row->keyword] = 1; + while ($row = $dsql->GetObject()) { + if ($row->sta == 1) $ws[$row->keyword] = 1; else $wserr[$row->keyword] = 1; } echo "完成关键字数据库的载入!
\r\n"; @@ -33,36 +32,25 @@ if($dopost=='analyse') flush(); $dsql->SetQuery("SELECT id,keywords FROM `#@__archives`"); $dsql->Execute(); - while($row = $dsql->GetObject()) - { - $keywords = explode(',',trim($row->keywords)); + while ($row = $dsql->GetObject()) { + $keywords = explode(',', trim($row->keywords)); $nerr = false; $mykey = ''; - if(is_array($keywords)) - { - foreach($keywords as $v) - { + if (is_array($keywords)) { + foreach ($keywords as $v) { $v = trim($v); - if($v=='') - { + if ($v == '') { continue; } - if(isset($ws[$v])) - { - $mykey .= $v." "; - } - else if(isset($wsnew[$v])) - { - $mykey .= $v.' '; + if (isset($ws[$v])) { + $mykey .= $v . " "; + } else if (isset($wsnew[$v])) { + $mykey .= $v . ' '; $wsnew[$v]++; - } - else if(isset($wserr[$v])) - { + } else if (isset($wserr[$v])) { $nerr = true; - } - else - { - $mykey .= $v." "; + } else { + $mykey .= $v . " "; $wsnew[$v] = 1; } } @@ -70,75 +58,59 @@ if($dopost=='analyse') } echo "完成档案数据库的处理!
\r\n"; flush(); - if(is_array($wsnew)) - { + if (is_array($wsnew)) { echo "对关键字进行排序...
\r\n"; flush(); arsort($wsnew); echo "把关键字保存到数据库...
\r\n"; flush(); - foreach($wsnew as $k=>$v) - { - if(strlen($k)>20) - { + foreach ($wsnew as $k => $v) { + if (strlen($k) > 20) { continue; } - $dsql->SetQuery("INSERT INTO `#@__keywords`(keyword,rank,sta,rpurl) VALUES('".addslashes($k)."','$v','1','')"); + $dsql->SetQuery("INSERT INTO `#@__keywords`(keyword,rank,sta,rpurl) VALUES('" . addslashes($k) . "','$v','1','')"); $dsql->Execute(); } echo "完成关键字的导入!
\r\n"; flush(); sleep(1); - } - else - { + } else { echo "没发现任何新的关键字!
\r\n"; flush(); sleep(1); } - ShowMsg('完成所有操作,现在转到关键字列表页!','article_keywords_main.php'); + ShowMsg('完成所有操作,现在转到关键字列表页!', 'article_keywords_main.php'); exit(); } //自动获取关键字(适用于默认的文章模型) -else if($dopost=='fetch') -{ - require_once(DEDEINC."/splitword.class.php"); - if(empty($startdd)) - { +else if ($dopost == 'fetch') { + require_once(DEDEINC . "/splitword.class.php"); + if (empty($startdd)) { $startdd = 0; } - if(empty($pagesize)) - { + if (empty($pagesize)) { $pagesize = 20; } - if(empty($totalnum)) - { + if (empty($totalnum)) { $totalnum = 0; } //统计记录总数 - if($totalnum==0) - { + if ($totalnum == 0) { $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__archives` WHERE channel='1' "); $totalnum = $row['dd']; } //获取记录,并分析关键字 - if($totalnum > $startdd+$pagesize) - { + if ($totalnum > $startdd + $pagesize) { $limitSql = " LIMIT $startdd,$pagesize"; - } - else if(($totalnum-$startdd)>0) - { - $limitSql = " LIMIT $startdd,".($totalnum - $startdd); - } - else - { + } else if (($totalnum - $startdd) > 0) { + $limitSql = " LIMIT $startdd," . ($totalnum - $startdd); + } else { $limitSql = ''; } $tjnum = $startdd; - if($limitSql!='') - { + if ($limitSql != '') { $fquery = "SELECT arc.id,arc.title,arc.keywords,addon.body FROM `#@__archives` arc LEFT JOIN `#@__addonarticle` addon ON addon.aid=arc.id WHERE arc.channel='1' $limitSql "; $dsql->SetQuery($fquery); @@ -148,104 +120,84 @@ else if($dopost=='fetch') $client = new DedeBizClient($cfg_bizcore_hostname, $cfg_bizcore_port); $client->appid = $cfg_bizcore_appid; $client->key = $cfg_bizcore_key; - while($row=$dsql->GetObject()) - { - if($row->keywords!='') - { + while ($row = $dsql->GetObject()) { + if ($row->keywords != '') { continue; } $tjnum++; $id = $row->id; $keywords = ""; - $data = $client->Spliteword($row->title.Html2Text($row->body)); + $data = $client->Spliteword($row->title . Html2Text($row->body)); $keywords = $data->data; $keywords = addslashes($keywords); - if($keywords=='') - { + if ($keywords == '') { $keywords = ','; } $dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET keywords='$keywords' WHERE id='$id'"); } $client->Close(); } else { - $sp = new SplitWord($cfg_soft_lang , $cfg_soft_lang ); - while($row=$dsql->GetObject()) - { - if($row->keywords!='') - { + $sp = new SplitWord($cfg_soft_lang, $cfg_soft_lang); + while ($row = $dsql->GetObject()) { + if ($row->keywords != '') { continue; } $tjnum++; $id = $row->id; $keywords = ""; - - $sp->SetSource($row->title, $cfg_soft_lang , $cfg_soft_lang ); + + $sp->SetSource($row->title, $cfg_soft_lang, $cfg_soft_lang); $sp->SetResultType(2); $sp->StartAnalysis(TRUE); - + $titleindexs = $sp->GetFinallyIndex(); - - $sp->SetSource(Html2Text($row->body), $cfg_soft_lang , $cfg_soft_lang ); + + $sp->SetSource(Html2Text($row->body), $cfg_soft_lang, $cfg_soft_lang); $sp->SetResultType(2); $sp->StartAnalysis(TRUE); $allindexs = $sp->GetFinallyIndex(); - if(is_array($allindexs) && is_array($titleindexs)) - { - foreach($titleindexs as $k => $v) - { - if(strlen($keywords)>=30) - { + if (is_array($allindexs) && is_array($titleindexs)) { + foreach ($titleindexs as $k => $v) { + if (strlen($keywords) >= 30) { break; - } - else - { - if(strlen($k) <= 2) continue; - $keywords .= $k.","; + } else { + if (strlen($k) <= 2) continue; + $keywords .= $k . ","; } } - foreach($allindexs as $k => $v) - { - if(strlen($keywords)>=30) - { + foreach ($allindexs as $k => $v) { + if (strlen($keywords) >= 30) { break; - } - else if(!in_array($k,$titleindexs)) - { - if(strlen($k) <= 2) continue; - $keywords .= $k.","; + } else if (!in_array($k, $titleindexs)) { + if (strlen($k) <= 2) continue; + $keywords .= $k . ","; } } } $keywords = addslashes($keywords); - if($keywords=='') - { + if ($keywords == '') { $keywords = ','; } $dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET keywords='$keywords' WHERE id='$id'"); } unset($sp); } - - - }//end if limit + } //end if limit //返回提示信息 - if($totalnum>0) $tjlen = ceil( ($tjnum/$totalnum) * 100 ); - else $tjlen=100; + if ($totalnum > 0) $tjlen = ceil(($tjnum / $totalnum) * 100); + else $tjlen = 100; $dvlen = $tjlen * 2; $tjsta = "
"; $tjsta .= "
完成处理文档总数的:$tjlen %,位置:{$startdd},继续执行任务..."; - if($tjnum < $totalnum) - { - $nurl = "article_keywords_make.php?dopost=fetch&totalnum=$totalnum&startdd=".($startdd+$pagesize)."&pagesize=$pagesize"; - ShowMsg($tjsta,$nurl,0,500); - } - else - { - ShowMsg("完成所有任务!","javascript:;"); + if ($tjnum < $totalnum) { + $nurl = "article_keywords_make.php?dopost=fetch&totalnum=$totalnum&startdd=" . ($startdd + $pagesize) . "&pagesize=$pagesize"; + ShowMsg($tjsta, $nurl, 0, 500); + } else { + ShowMsg("完成所有任务!", "javascript:;"); } exit(); } diff --git a/src/dede/article_keywords_select.php b/src/dede/article_keywords_select.php index 4360cd1f..3012ee53 100755 --- a/src/dede/article_keywords_select.php +++ b/src/dede/article_keywords_select.php @@ -1,37 +1,38 @@ SetTemplate(DEDEADMIN."/templets/article_keywords_select.htm"); +$dlist->SetTemplate(DEDEADMIN . "/templets/article_keywords_select.htm"); $dlist->pageSize = 300; -$dlist->SetParameter("f",$f); +$dlist->SetParameter("f", $f); $dlist->SetSource($sql); $dlist->Display(); function GetSta($sta) { - if($sta==1) return "正常"; + if ($sta == 1) return "正常"; else return "禁用"; } function GetMan($sta) { - if($sta==1) return "禁用"; + if ($sta == 1) return "禁用"; else return "启用"; -} \ No newline at end of file +} diff --git a/src/dede/article_select_sw.php b/src/dede/article_select_sw.php index 67560420..5337df4f 100755 --- a/src/dede/article_select_sw.php +++ b/src/dede/article_select_sw.php @@ -1,53 +1,46 @@ [设置] "; echo "[关闭]
\r\n
\r\n"; - foreach($allsources as $v) - { + foreach ($allsources as $v) { $v = trim($v); - if($v!="") - { + if ($v != "") { echo "$v | \r\n"; } } echo "
 
"; -} -else -{ +} else { //作者列表 - $m_file = DEDEDATA."/admin/writer.txt"; + $m_file = DEDEDATA . "/admin/writer.txt"; echo "
[设置] "; echo "[关闭]
\r\n
\r\n"; - if(filesize($m_file)>0) - { - $fp = fopen($m_file,'r'); - $str = fread($fp,filesize($m_file)); + if (filesize($m_file) > 0) { + $fp = fopen($m_file, 'r'); + $str = fread($fp, filesize($m_file)); fclose($fp); - $strs = explode(',',$str); - foreach($strs as $str) - { + $strs = explode(',', $str); + foreach ($strs as $str) { $str = trim($str); - if($str!="") - { + if ($str != "") { echo "$str | "; } } } echo "
 
\r\n"; -} \ No newline at end of file +} diff --git a/src/dede/article_source_edit.php b/src/dede/article_source_edit.php index 402e5dec..28122a2e 100755 --- a/src/dede/article_source_edit.php +++ b/src/dede/article_source_edit.php @@ -1,44 +1,43 @@ alert('Save OK!');"; } //读出 -if(empty($allsource) && filesize($m_file)>0) -{ - $fp = fopen($m_file,'r'); - $allsource = fread($fp,filesize($m_file)); +if (empty($allsource) && filesize($m_file) > 0) { + $fp = fopen($m_file, 'r'); + $allsource = fread($fp, filesize($m_file)); fclose($fp); } $wintitle = "文章来源管理"; $wecome_info = "文章来源管理"; $win = new OxWindow(); -$win->Init('article_source_edit.php','js/blank.js','POST'); -$win->AddHidden('dopost','save'); +$win->Init('article_source_edit.php', 'js/blank.js', 'POST'); +$win->AddHidden('dopost', 'save'); $win->AddTitle("每行保存一个来源:"); $win->AddMsgItem(""); $winform = $win->GetWindow('ok'); -$win->Display(); \ No newline at end of file +$win->Display(); diff --git a/src/dede/article_string_mix.php b/src/dede/article_string_mix.php index 3aeabeb7..767df26c 100755 --- a/src/dede/article_string_mix.php +++ b/src/dede/article_string_mix.php @@ -1,49 +1,48 @@ alert('Save OK!');"; } //读出 -if(empty($allsource) && filesize($m_file)>0) -{ - $fp = fopen($m_file,'r'); - $allsource = fread($fp,filesize($m_file)); +if (empty($allsource) && filesize($m_file) > 0) { + $fp = fopen($m_file, 'r'); + $allsource = fread($fp, filesize($m_file)); fclose($fp); } make_hash(); $wintitle = "防采集混淆字符串管理"; $wecome_info = "防采集混淆字符串管理"; $win = new OxWindow(); -$win->Init('article_string_mix.php','js/blank.js','POST'); -$win->AddHidden('dopost','save'); -$win->AddHidden('token',$_SESSION['token']); +$win->Init('article_string_mix.php', 'js/blank.js', 'POST'); +$win->AddHidden('dopost', 'save'); +$win->AddHidden('token', $_SESSION['token']); $win->AddTitle("如果你要启用字符串混淆来防采集,请在文档模板需要的字段加上 function='RndString(@me)' 属性,如:{dede:field name='body' function='RndString(@me)'/}。"); $win->AddMsgItem(""); $winform = $win->GetWindow('ok'); -$win->Display(); \ No newline at end of file +$win->Display(); diff --git a/src/dede/article_template_rand.php b/src/dede/article_template_rand.php index fd520317..c5262d0d 100755 --- a/src/dede/article_template_rand.php +++ b/src/dede/article_template_rand.php @@ -1,59 +1,54 @@ ExecuteNoneQuery(" Update `#@__addonarticle` set templet='$temp' where RIGHT(aid, 1)='$i' "); } @@ -62,8 +57,7 @@ else if($dopost=='makeold') exit(); } //清除全部的指定模板 -else if($dopost=='clearold') -{ +else if ($dopost == 'clearold') { CheckCSRF(); $dsql->ExecuteNoneQuery(" Update `#@__addonarticle` set templet='' "); $dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `#@__addonarticle` "); @@ -74,10 +68,9 @@ else if($dopost=='clearold') //-------------------------read //读出 -if(empty($templates) && filesize($m_file)>0) -{ - $fp = fopen($m_file,'r'); - $templates = fread($fp,filesize($m_file)); +if (empty($templates) && filesize($m_file) > 0) { + $fp = fopen($m_file, 'r'); + $templates = fread($fp, filesize($m_file)); fclose($fp); } $wintitle = "随机模板防采集设置"; @@ -119,10 +112,10 @@ function DoRand(jobname) "; $win = new OxWindow(); -$win->Init('article_template_rand.php','js/blank.js','POST'); -$win->AddHidden('dopost','save'); -$win->AddHidden('token',$_SESSION['token']); +$win->Init('article_template_rand.php', 'js/blank.js', 'POST'); +$win->AddHidden('dopost', 'save'); +$win->AddHidden('token', $_SESSION['token']); $win->AddTitle("本设置仅适用于系统默认的文章模型,设置后发布文章时会自动按指定的模板随机获取一个,如果不想使用此功能,把它设置为空即可!"); $win->AddMsgItem($msg); $winform = $win->GetWindow('ok'); -$win->Display(); \ No newline at end of file +$win->Display(); diff --git a/src/dede/article_test_same.php b/src/dede/article_test_same.php index 6ad9e813..f027c034 100755 --- a/src/dede/article_test_same.php +++ b/src/dede/article_test_same.php @@ -1,24 +1,24 @@ getone("SELECT maintable FROM `#@__channeltype` WHERE id='$channelid' "); - if(is_array($arr)) { + if (is_array($arr)) { $maintable = $arr['maintable']; } else { - showmsg('频道id不正确,无法处理!','javascript:;'); + showmsg('频道id不正确,无法处理!', 'javascript:;'); exit(); } $dsql->SetQuery("SELECT COUNT(title) AS dd,title FROM `$maintable` WHERE channel='$channelid' GROUP BY title ORDER BY dd DESC LIMIT 0, $pagesize"); @@ -28,56 +28,51 @@ if($dopost=='analyse') exit(); } //删除选中的内容(只保留一条) -else if($dopost=='delsel') -{ - require_once(dirname(__FILE__)."/../include/typelink.class.php"); - require_once(dirname(__FILE__)."/inc/inc_batchup.php"); - - if(empty($titles)) - { +else if ($dopost == 'delsel') { + require_once(dirname(__FILE__) . "/../include/typelink.class.php"); + require_once(dirname(__FILE__) . "/inc/inc_batchup.php"); + + if (empty($titles)) { header("Content-Type: text/html; charset={$cfg_ver_lang}"); - echo "\r\n"; + echo "\r\n"; echo "没有指定删除的文档!"; exit(); } - - $titless = split('`',$titles); - if($channelid < -1) { - $orderby = ($deltype=='delnew' ? " ORDER BY aid DESC " : " ORDER BY aid ASC "); + $titless = split('`', $titles); + + if ($channelid < -1) { + $orderby = ($deltype == 'delnew' ? " ORDER BY aid DESC " : " ORDER BY aid ASC "); } else { - $orderby = ($deltype=='delnew' ? " ORDER BY id DESC " : " ORDER BY id ASC "); + $orderby = ($deltype == 'delnew' ? " ORDER BY id DESC " : " ORDER BY id ASC "); } - + $totalarc = 0; - - foreach($titless as $title) - { - $title = trim($title); - $title = addslashes( $title=='' ? '' : urldecode($title) ); - if($channelid < -1) { - $q1 = "SELECT aid as id,title FROM `$maintable` WHERE channel='$channelid' AND title='$title' $orderby "; - } - else { - $q1 = "SELECT id,title FROM `$maintable` WHERE channel='$channelid' AND title='$title' $orderby "; - } - $dsql->SetQuery($q1); - $dsql->Execute(); - $rownum = $dsql->GetTotalRow(); - if($rownum < 2) continue; - $i = 1; - while($row = $dsql->GetObject()) - { - $i++; - $naid = $row->id; - $ntitle = $row->title; - if($i > $rownum) continue; - $totalarc++; - DelArc($naid, 'OFF'); - } + + foreach ($titless as $title) { + $title = trim($title); + $title = addslashes($title == '' ? '' : urldecode($title)); + if ($channelid < -1) { + $q1 = "SELECT aid as id,title FROM `$maintable` WHERE channel='$channelid' AND title='$title' $orderby "; + } else { + $q1 = "SELECT id,title FROM `$maintable` WHERE channel='$channelid' AND title='$title' $orderby "; + } + $dsql->SetQuery($q1); + $dsql->Execute(); + $rownum = $dsql->GetTotalRow(); + if ($rownum < 2) continue; + $i = 1; + while ($row = $dsql->GetObject()) { + $i++; + $naid = $row->id; + $ntitle = $row->title; + if ($i > $rownum) continue; + $totalarc++; + DelArc($naid, 'OFF'); + } } $dsql->ExecuteNoneQuery(" OPTIMIZE TABLE `$maintable`; "); - ShowMsg("一共删除了[{$totalarc}]篇重复的文档!","javascript:;"); + ShowMsg("一共删除了[{$totalarc}]篇重复的文档!", "javascript:;"); exit(); } @@ -85,5 +80,5 @@ else if($dopost=='delsel') $channelinfos = array(); $dsql->setquery("SELECT id,typename,maintable,addtable FROM `#@__channeltype` "); $dsql->execute(); -while($row = $dsql->getarray()) $channelinfos[] = $row; -include DedeInclude('templets/article_test_same.htm'); \ No newline at end of file +while ($row = $dsql->getarray()) $channelinfos[] = $row; +include DedeInclude('templets/article_test_same.htm'); diff --git a/src/dede/article_test_title.php b/src/dede/article_test_title.php index 689e223a..a1de756a 100755 --- a/src/dede/article_test_title.php +++ b/src/dede/article_test_title.php @@ -1,19 +1,19 @@ GetOne("SELECT id FROM `#@__archives` WHERE title LIKE '$t' "); -if(is_array($row)) -{ +if (is_array($row)) { echo "提示:系统已经存在标题为 '$t' 的文档。[关闭]"; -} \ No newline at end of file +} diff --git a/src/dede/article_writer_edit.php b/src/dede/article_writer_edit.php index aef14a88..bd3c46dd 100755 --- a/src/dede/article_writer_edit.php +++ b/src/dede/article_writer_edit.php @@ -1,46 +1,45 @@ alert('Save OK!');"; } //读出 -if(empty($allwriter) && filesize($m_file)>0) -{ - $fp = fopen($m_file,'r'); - $allwriter = fread($fp,filesize($m_file)); +if (empty($allwriter) && filesize($m_file) > 0) { + $fp = fopen($m_file, 'r'); + $allwriter = fread($fp, filesize($m_file)); fclose($fp); } $wintitle = "文章作者管理"; $wecome_info = "文章作者管理"; $win = new OxWindow(); -$win->Init('article_writer_edit.php','js/blank.js','POST'); -$win->AddHidden('dopost','save'); +$win->Init('article_writer_edit.php', 'js/blank.js', 'POST'); +$win->AddHidden('dopost', 'save'); $win->AddTitle("把作者姓名用半角逗号“,”分开:"); $win->AddMsgItem(""); $winform = $win->GetWindow('ok'); -$win->Display(); \ No newline at end of file +$win->Display(); diff --git a/src/dede/baidunews.php b/src/dede/baidunews.php index 84d0941e..958c4328 100755 --- a/src/dede/baidunews.php +++ b/src/dede/baidunews.php @@ -1,28 +1,27 @@ \n"; + $baidunews = "\n"; $baidunews .= "\n"; $baidunews .= "$cfg_webname \n"; $baidunews .= "$cfg_adminemail \n"; $baidunews .= "$cfg_updateperi \n"; $limit = $cfg_baidunews_limit; - if($limit > 100 || $limit < 1) - { + if ($limit > 100 || $limit < 1) { $limit = 100; } @@ -34,32 +33,27 @@ if(empty($do)) "; $dsql->SetQuery($query); $dsql->Execute(); - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $title = dede_htmlspecialchars($row['title']); $row1 = GetOneArchive($row['id']); - if(strpos($row1['arcurl'],'http://') === false) - { - $link = ($cfg_basehost=='' ? 'http://'.$_SERVER["HTTP_HOST"].$cfg_cmspath : $cfg_basehost).$row1['arcurl']; - }else - { + if (strpos($row1['arcurl'], 'http://') === false) { + $link = ($cfg_basehost == '' ? 'http://' . $_SERVER["HTTP_HOST"] . $cfg_cmspath : $cfg_basehost) . $row1['arcurl']; + } else { $link = $row1['arcurl']; } $link = dede_htmlspecialchars($link); $description = dede_htmlspecialchars(strip_tags($row['description'])); $text = dede_htmlspecialchars(strip_tags($row['body'])); - $image = $row['litpic'] =='' ? '' :$row['litpic']; - if($image != '' && strpos($image, 'http://') === false) - { - $image = ($cfg_basehost=='' ? 'http://'.$_SERVER["HTTP_HOST"].$cfg_cmspath : $cfg_basehost).$image; - + $image = $row['litpic'] == '' ? '' : $row['litpic']; + if ($image != '' && strpos($image, 'http://') === false) { + $image = ($cfg_basehost == '' ? 'http://' . $_SERVER["HTTP_HOST"] . $cfg_cmspath : $cfg_basehost) . $image; } //$headlineimg = ''; $keywords = dede_htmlspecialchars($row['keywords']); $category = dede_htmlspecialchars($row['typename']); $author = dede_htmlspecialchars($row['writer']); $source = dede_htmlspecialchars($row['source']); - $pubdate = dede_htmlspecialchars(gmdate('Y-m-d H:i',$row['pubdate'] + $cfg_cli_time * 3600)); + $pubdate = dede_htmlspecialchars(gmdate('Y-m-d H:i', $row['pubdate'] + $cfg_cli_time * 3600)); $baidunews .= "\n"; $baidunews .= "$title \n"; @@ -77,8 +71,8 @@ if(empty($do)) } $baidunews .= "\n"; - $fp = fopen(dirname(__FILE__).'/'.$filename,'w'); - fwrite($fp,$baidunews); + $fp = fopen(dirname(__FILE__) . '/' . $filename, 'w'); + fwrite($fp, $baidunews); fclose($fp); - showmsg("{$filename} make success",'javascript:;'); -} \ No newline at end of file + showmsg("{$filename} make success", 'javascript:;'); +} diff --git a/src/dede/cards_make.php b/src/dede/cards_make.php index 312f77a6..75ea9909 100755 --- a/src/dede/cards_make.php +++ b/src/dede/cards_make.php @@ -1,23 +1,23 @@ GetOne("SELECT * FROM #@__moneycard_record ORDER BY aid DESC"); - !is_array($row) ? $startid=100000 : $startid=$row['aid']+100000; + !is_array($row) ? $startid = 100000 : $startid = $row['aid'] + 100000; $row = $dsql->GetOne("SELECT * FROM #@__moneycard_type WHERE tid='$cardtype'"); $money = $row['money']; $num = $row['num']; @@ -29,33 +29,24 @@ elseif($dopost == 'make') header("Content-Type: text/html; charset={$cfg_soft_lang}"); - for(;$startid<$endid;$startid++) - { - $cardid = $snprefix.$startid.'-'; - for($p=0;$p<$pwdgr;$p++) - { - for($i=0; $i < $pwdlen; $i++) - { - if($ctype==1) - { - $c = mt_rand(49,57); $c = chr($c); - } - else - { - $c = mt_rand(65,90); - if($c==79) - { + for (; $startid < $endid; $startid++) { + $cardid = $snprefix . $startid . '-'; + for ($p = 0; $p < $pwdgr; $p++) { + for ($i = 0; $i < $pwdlen; $i++) { + if ($ctype == 1) { + $c = mt_rand(49, 57); + $c = chr($c); + } else { + $c = mt_rand(65, 90); + if ($c == 79) { $c = 'M'; - } - else - { + } else { $c = chr($c); } } $cardid .= $c; } - if($p<$pwdgr-1) - { + if ($p < $pwdgr - 1) { $cardid .= '-'; } } @@ -65,4 +56,4 @@ elseif($dopost == 'make') echo "成功生成点卡:{$cardid}
"; } echo "成功生成 {$mnum} 个点卡!"; -} \ No newline at end of file +} diff --git a/src/dede/cards_manage.php b/src/dede/cards_manage.php index 2105eb80..009e7d7e 100755 --- a/src/dede/cards_manage.php +++ b/src/dede/cards_manage.php @@ -1,44 +1,44 @@ ExecuteNoneQuery("DELETE FROM #@__moneycard_record $dquery"); - ShowMsg("成功删除指定的记录!","cards_manage.php"); - exit(); -}else{ + ShowMsg("成功删除指定的记录!", "cards_manage.php"); + exit(); +} else { $addsql = ''; - if(isset($isexp)) $addsql = " WHERE isexp='$isexp' "; - + if (isset($isexp)) $addsql = " WHERE isexp='$isexp' "; + $sql = "SELECT * FROM #@__moneycard_record $addsql ORDER BY aid DESC"; $dlist = new DataListCP(); $dlist->pageSize = 25; //设定每页显示记录数(默认25条) - if(isset($isexp)) $dlist->SetParameter("isexp",$isexp); + if (isset($isexp)) $dlist->SetParameter("isexp", $isexp); $dlist->dsql->SetQuery("SELECT * FROM #@__moneycard_type "); $dlist->dsql->Execute('ts'); - while($rw = $dlist->dsql->GetArray('ts')) - { + while ($rw = $dlist->dsql->GetArray('ts')) { $TypeNames[$rw['tid']] = $rw['pname']; } - $tplfile = DEDEADMIN."/templets/cards_manmage.htm"; - + $tplfile = DEDEADMIN . "/templets/cards_manmage.htm"; + //这两句的顺序不能更换 $dlist->SetTemplate($tplfile); //载入模板 $dlist->SetSource($sql); //设定查询SQL @@ -48,20 +48,20 @@ if($dopost=="delete"){ function GetMemberID($mid) { global $dsql; - if($mid==0) return '0'; + if ($mid == 0) return '0'; $row = $dsql->GetOne("SELECT userid FROM #@__member WHERE mid='$mid' "); - if(is_array($row)) return "".$row['userid'].""; + if (is_array($row)) return "" . $row['userid'] . ""; else return '0'; } -function GetUseDate($time=0) +function GetUseDate($time = 0) { - if(!empty($time)) return GetDateMk($time); + if (!empty($time)) return GetDateMk($time); else return '未使用'; } function GetSta($sta) { - if($sta==1) return '已售出'; - else if($sta==-1) return '已使用'; + if ($sta == 1) return '已售出'; + else if ($sta == -1) return '已使用'; else return '未使用'; -} \ No newline at end of file +} diff --git a/src/dede/cards_type.php b/src/dede/cards_type.php index 707c406d..1b4067cd 100755 --- a/src/dede/cards_type.php +++ b/src/dede/cards_type.php @@ -1,41 +1,36 @@ ExecuteNoneQuery($query); $query = "UPDATE #@__moneycard_record SET money='$money',num='$num' WHERE ctid='$tid' ; "; $dsql->ExecuteNoneQuery($query); } - } - else - { + } else { $query = "DELETE FROM #@__moneycard_type WHERE tid='$tid' "; $dsql->ExecuteNoneQuery($query); $query = "DELETE FROM #@__moneycard_record WHERE ctid='$tid' AND isexp<>-1 ; "; @@ -44,12 +39,11 @@ if($dopost=="save") } //增加新记录 - if(isset($check_new) && $pname_new!='') - { + if (isset($check_new) && $pname_new != '') { $query = "INSERT INTO #@__moneycard_type(num,pname,money) VALUES('{$num_new}','{$pname_new}','{$money_new}');"; $dsql->ExecuteNoneQuery($query); } header("Content-Type: text/html; charset={$cfg_soft_lang}"); echo ""; } -require_once(DEDEADMIN."/templets/cards_type.htm"); \ No newline at end of file +require_once(DEDEADMIN . "/templets/cards_type.htm"); diff --git a/src/dede/catalog_add.php b/src/dede/catalog_add.php index 3454c1ca..5f6663c8 100755 --- a/src/dede/catalog_add.php +++ b/src/dede/catalog_add.php @@ -1,64 +1,57 @@ SetQuery("SELECT id,typename,nid FROM `#@__channeltype` WHERE id<>-1 AND isshow=1 ORDER BY id"); $dsql->Execute(); -while($row=$dsql->GetObject()) -{ +while ($row = $dsql->GetObject()) { $channelArray[$row->id]['typename'] = $row->typename; $channelArray[$row->id]['nid'] = $row->nid; - if($row->id==$channelid) - { + if ($row->id == $channelid) { $nid = $row->nid; } } -if($dopost=='quick') -{ +if ($dopost == 'quick') { $tl = new TypeLink(0); - $typeOptions = $tl->GetOptionArray(0,0,$channelid); + $typeOptions = $tl->GetOptionArray(0, 0, $channelid); include DedeInclude('templets/catalog_add_quick.htm'); exit(); } /*--------------------- function action_savequick(){ } ----------------------*/ -else if($dopost=='savequick') -{ - if(!isset($savetype)) $savetype = ''; - $isdefault = isset($isdefault)? $isdefault : 0; +---------------------*/ else if ($dopost == 'savequick') { + if (!isset($savetype)) $savetype = ''; + $isdefault = isset($isdefault) ? $isdefault : 0; $tempindex = "{style}/index_{$nid}.htm"; $templist = "{style}/list_{$nid}.htm"; $temparticle = "{style}/article_{$nid}.htm"; @@ -66,86 +59,72 @@ else if($dopost=='savequick') tempindex,templist,temparticle,modname,namerule,namerule2,ispart,corank,description,keywords,seotitle,moresite,siteurl,sitepath,ishidden,`cross`,`crossid`,`content`,`smalltypes`) VALUES('~reid~','~topid~','~rank~','~typename~','~typedir~','$isdefault','$defaultname','$issend','$channeltype', '$tempindex','$templist','$temparticle','default','$namerule','$namerule2','0','0','','','~typename~','0','','','0','0','0','','')"; - - if (empty($savetype)) - { - foreach($_POST as $k=>$v) - { - if(preg_match("#^posttype#", $k)) - { + + if (empty($savetype)) { + foreach ($_POST as $k => $v) { + if (preg_match("#^posttype#", $k)) { $k = str_replace('posttype', '', $k); - } - else - { + } else { continue; } - $rank = ${'rank'.$k}; - $toptypename = trim(${'toptype'.$k}); - $sontype = trim(${'sontype'.$k}); + $rank = ${'rank' . $k}; + $toptypename = trim(${'toptype' . $k}); + $sontype = trim(${'sontype' . $k}); $toptypedir = GetPinyin(stripslashes($toptypename)); - $toptypedir = $referpath=='parent' ? $nextdir.'/'.$toptypedir : '/'.$toptypedir; - if(empty($toptypename)) - { + $toptypedir = $referpath == 'parent' ? $nextdir . '/' . $toptypedir : '/' . $toptypedir; + if (empty($toptypename)) { continue; } - $sql = str_replace('~reid~','0',$queryTemplate); - $sql = str_replace('~topid~','0',$sql); - $sql = str_replace('~rank~',$rank,$sql); - $sql = str_replace('~typename~',$toptypename,$sql); - $sql = str_replace('~typedir~',$toptypedir,$sql); + $sql = str_replace('~reid~', '0', $queryTemplate); + $sql = str_replace('~topid~', '0', $sql); + $sql = str_replace('~rank~', $rank, $sql); + $sql = str_replace('~typename~', $toptypename, $sql); + $sql = str_replace('~typedir~', $toptypedir, $sql); $dsql->ExecuteNoneQuery($sql); $tid = $dsql->GetLastID(); - if($tid>0 && $sontype!='') - { - $sontypes = explode(',',$sontype); - foreach($sontypes as $k=>$v) - { + if ($tid > 0 && $sontype != '') { + $sontypes = explode(',', $sontype); + foreach ($sontypes as $k => $v) { $v = trim($v); - if($v=='') - { + if ($v == '') { continue; } - $typedir = $toptypedir.'/'.GetPinyin(stripslashes($v)); - $sql = str_replace('~reid~',$tid,$queryTemplate); - $sql = str_replace('~topid~',$tid,$sql); - $sql = str_replace('~rank~',$k,$sql); - $sql = str_replace('~typename~',$v,$sql); - $sql = str_replace('~typedir~',$typedir,$sql); + $typedir = $toptypedir . '/' . GetPinyin(stripslashes($v)); + $sql = str_replace('~reid~', $tid, $queryTemplate); + $sql = str_replace('~topid~', $tid, $sql); + $sql = str_replace('~rank~', $k, $sql); + $sql = str_replace('~typename~', $v, $sql); + $sql = str_replace('~typedir~', $typedir, $sql); $dsql->ExecuteNoneQuery($sql); } } } } else { - + $row = $dsql->GetOne("SELECT `typedir` FROM `#@__arctype` WHERE `id`={$reid}"); - foreach($_POST as $k=>$v) - { - if(preg_match("#^posttype#", $k)) - { + foreach ($_POST as $k => $v) { + if (preg_match("#^posttype#", $k)) { $k = str_replace('posttype', '', $k); - } - else - { + } else { continue; } - $rank = ${'rank'.$k}; - $toptypename = trim(${'reltype'.$k}); + $rank = ${'rank' . $k}; + $toptypename = trim(${'reltype' . $k}); $toptypedir = GetPinyin(stripslashes($toptypename)); switch ($referpath) { case 'parent': - $toptypedir = $nextdir.'/'.$toptypedir; + $toptypedir = $nextdir . '/' . $toptypedir; break; case 'typepath': - $toptypedir = isset($row['typedir'])? $row['typedir'].'/'.$toptypedir : '/'.$toptypedir; - break; + $toptypedir = isset($row['typedir']) ? $row['typedir'] . '/' . $toptypedir : '/' . $toptypedir; + break; default: - $toptypedir = '/'.$toptypedir; + $toptypedir = '/' . $toptypedir; break; } - - if(empty($toptypename)) - { + + if (empty($toptypename)) { continue; } $sql = str_replace('~reid~', $reid, $queryTemplate); @@ -157,73 +136,63 @@ else if($dopost=='savequick') } } UpDateCatCache(); - ShowMsg('成功增加指定栏目!','catalog_main.php'); + ShowMsg('成功增加指定栏目!', 'catalog_main.php'); exit(); } /*--------------------- function action_save(){ } ----------------------*/ -else if($dopost=='save') -{ +---------------------*/ else if ($dopost == 'save') { $smalltypes = ''; - if(empty($smalltype)) $smalltype = ''; - if(is_array($smalltype)) $smalltypes = join(',',$smalltype); - - if(!isset($sitepath)) $sitepath = ''; - if($topid==0 && $reid>0) $topid = $reid; - if($ispart!=0) $cross = 0; - - $description = Html2Text($description,1); - $keywords = Html2Text($keywords,1); - - if($ispart != 2 ) - { + if (empty($smalltype)) $smalltype = ''; + if (is_array($smalltype)) $smalltypes = join(',', $smalltype); + + if (!isset($sitepath)) $sitepath = ''; + if ($topid == 0 && $reid > 0) $topid = $reid; + if ($ispart != 0) $cross = 0; + + $description = Html2Text($description, 1); + $keywords = Html2Text($keywords, 1); + + if ($ispart != 2) { //栏目的参照目录 - if($referpath=='cmspath') $nextdir = '{cmspath}'; - if($referpath=='basepath') $nextdir = ''; + if ($referpath == 'cmspath') $nextdir = '{cmspath}'; + if ($referpath == 'basepath') $nextdir = ''; //用拼音命名 - if($upinyin==1 || $typedir=='') - { + if ($upinyin == 1 || $typedir == '') { $typedir = GetPinyin(stripslashes($typename)); } - $typedir = $nextdir.'/'.$typedir; + $typedir = $nextdir . '/' . $typedir; $typedir = preg_replace("#\/{1,}#", "/", $typedir); } //开启多站点时的设置(仅针对顶级栏目) - if($reid==0 && $moresite==1) - { + if ($reid == 0 && $moresite == 1) { $sitepath = $typedir; //检测二级网址 - if($siteurl!='') - { + if ($siteurl != '') { $siteurl = preg_replace("#\/$#", "", $siteurl); - if(!preg_match("#http:\/\/#i", $siteurl)) - { - ShowMsg("你绑定的二级域名无效,请用(http://host)的形式!","-1"); + if (!preg_match("#http:\/\/#i", $siteurl)) { + ShowMsg("你绑定的二级域名无效,请用(http://host)的形式!", "-1"); exit(); } - if(preg_match("#".$cfg_basehost."#i", $siteurl)) - { - ShowMsg("你绑定的二级域名与当前站点是同一个域,不需要绑定!","-1"); + if (preg_match("#" . $cfg_basehost . "#i", $siteurl)) { + ShowMsg("你绑定的二级域名与当前站点是同一个域,不需要绑定!", "-1"); exit(); } } } //创建目录 - if($ispart != 2) - { + if ($ispart != 2) { $true_typedir = str_replace("{cmspath}", $cfg_cmspath, $typedir); $true_typedir = preg_replace("#\/{1,}#", "/", $true_typedir); - if(!CreateDir($true_typedir)) - { - ShowMsg("创建目录 {$true_typedir} 失败,请检查你的路径是否存在问题!","-1"); + if (!CreateDir($true_typedir)) { + ShowMsg("创建目录 {$true_typedir} 失败,请检查你的路径是否存在问题!", "-1"); exit(); } } - + $in_query = "INSERT INTO `#@__arctype`(reid,topid,sortrank,typename,typedir,isdefault,defaultname,issend,channeltype, tempindex,templist,temparticle,modname,namerule,namerule2, ispart,corank,description,keywords,seotitle,moresite,siteurl,sitepath,ishidden,`cross`,`crossid`,`content`,`smalltypes`) @@ -231,24 +200,20 @@ else if($dopost=='save') '$tempindex','$templist','$temparticle','default','$namerule','$namerule2', '$ispart','$corank','$description','$keywords','$seotitle','$moresite','$siteurl','$sitepath','$ishidden','$cross','$crossid','$content','$smalltypes')"; - if(!$dsql->ExecuteNoneQuery($in_query)) - { - ShowMsg("保存目录数据时失败,请检查你的输入资料是否存在问题!","-1"); + if (!$dsql->ExecuteNoneQuery($in_query)) { + ShowMsg("保存目录数据时失败,请检查你的输入资料是否存在问题!", "-1"); exit(); } UpDateCatCache(); - if($reid>0) - { - PutCookie('lastCid',GetTopid($reid),3600*24,'/'); + if ($reid > 0) { + PutCookie('lastCid', GetTopid($reid), 3600 * 24, '/'); } - ShowMsg("成功创建一个分类!","catalog_main.php"); + ShowMsg("成功创建一个分类!", "catalog_main.php"); exit(); - -}//End dopost==save +} //End dopost==save //获取从父目录继承的默认参数 -if($dopost=='') -{ +if ($dopost == '') { $channelid = 1; $issend = 1; $corank = 0; @@ -256,8 +221,7 @@ if($dopost=='') $topid = 0; $typedir = ''; $moresite = 0; - if($id>0) - { + if ($id > 0) { $myrow = $dsql->GetOne(" SELECT tp.*,ch.typename AS ctypename FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.id=$id "); $channelid = $myrow['channeltype']; $issennd = $myrow['issend']; @@ -270,4 +234,4 @@ if($dopost=='') $moresite = empty($myrow['moresite']) ? 0 : $myrow['moresite']; } -include DedeInclude('templets/catalog_add.htm'); \ No newline at end of file +include DedeInclude('templets/catalog_add.htm'); diff --git a/src/dede/catalog_del.php b/src/dede/catalog_del.php index 70263ad0..b680ea20 100755 --- a/src/dede/catalog_del.php +++ b/src/dede/catalog_del.php @@ -1,42 +1,42 @@ DelType($id,$delfile); + $ut->DelType($id, $delfile); UpDateCatCache(); - ShowMsg("成功删除一个栏目!","catalog_main.php"); + ShowMsg("成功删除一个栏目!", "catalog_main.php"); exit(); } -$dsql->SetQuery("SELECT typename,typedir FROM #@__arctype WHERE id=".$id); +$dsql->SetQuery("SELECT typename,typedir FROM #@__arctype WHERE id=" . $id); $row = $dsql->GetOne(); $wintitle = "删除栏目确认"; $wecome_info = "栏目管理 >> 删除栏目确认"; $win = new OxWindow(); -$win->Init('catalog_del.php','js/blank.js','POST'); -$win->AddHidden('id',$id); -$win->AddHidden('dopost','ok'); +$win->Init('catalog_del.php', 'js/blank.js', 'POST'); +$win->AddHidden('id', $id); +$win->AddHidden('dopost', 'ok'); $win->AddTitle("你要确实要删除栏目: [{$row['typename']}] 吗?"); -$win->AddItem('栏目的文件保存目录:',$row['typedir']); -$win->AddItem('是否删除文件:'," "); +$win->AddItem('栏目的文件保存目录:', $row['typedir']); +$win->AddItem('是否删除文件:', " "); $winform = $win->GetWindow('ok'); -$win->Display(); \ No newline at end of file +$win->Display(); diff --git a/src/dede/catalog_do.php b/src/dede/catalog_do.php index 3e9f5aaf..503d3677 100755 --- a/src/dede/catalog_do.php +++ b/src/dede/catalog_do.php @@ -4,7 +4,7 @@ * 栏目操作 * * @version $Id: catalog_do.php 1 14:31 2010年7月12日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/dede/catalog_edit.php b/src/dede/catalog_edit.php index a8efbc0f..3b152d92 100755 --- a/src/dede/catalog_edit.php +++ b/src/dede/catalog_edit.php @@ -1,16 +1,17 @@ ExecuteNoneQuery($upquery)) - { - ShowMsg("保存当前栏目更改时失败,请检查你的输入资料是否存在问题!","-1"); + if (!$dsql->ExecuteNoneQuery($upquery)) { + ShowMsg("保存当前栏目更改时失败,请检查你的输入资料是否存在问题!", "-1"); exit(); } //如果选择子栏目可投稿,更新顶级栏目为可投稿 - if($topid>0 && $issend==1) - { + if ($topid > 0 && $issend == 1) { $dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET issend='$issend' WHERE id='$topid'; "); } - $slinks = " id IN (".GetSonIds($id).")"; + $slinks = " id IN (" . GetSonIds($id) . ")"; //修改顶级栏目时强制修改下级的多站点支持属性 - if($topid==0 && preg_match("#,#", $slinks)) - { + if ($topid == 0 && preg_match("#,#", $slinks)) { $upquery = "UPDATE `#@__arctype` SET moresite='$moresite', siteurl='$siteurl',sitepath='$sitepath',ishidden='$ishidden' WHERE 1=1 AND $slinks"; $dsql->ExecuteNoneQuery($upquery); } //更改子栏目属性 - if(!empty($upnext)) - { + if (!empty($upnext)) { $upquery = "UPDATE `#@__arctype` SET issend='$issend', defaultname='$defaultname', @@ -97,38 +92,33 @@ if($dopost=="save") namerule2='$namerule2', ishidden='$ishidden' WHERE 1=1 AND $slinks"; - if(!$dsql->ExecuteNoneQuery($upquery)) - { - ShowMsg("更改当前栏目成功,但更改下级栏目属性时失败!","-1"); + if (!$dsql->ExecuteNoneQuery($upquery)) { + ShowMsg("更改当前栏目成功,但更改下级栏目属性时失败!", "-1"); exit(); } } UpDateCatCache(); - ShowMsg("成功更改一个分类!","catalog_main.php"); + ShowMsg("成功更改一个分类!", "catalog_main.php"); exit(); -}//End Save Action -else if ($dopost=="savetime") -{ +} //End Save Action +else if ($dopost == "savetime") { $uptopsql = ''; - $slinks = " id IN (".GetSonIds($id).")"; - + $slinks = " id IN (" . GetSonIds($id) . ")"; + //顶级栏目二级域名根目录处理 - if($topid==0 && $moresite==1) - { + if ($topid == 0 && $moresite == 1) { $sitepath = $typedir; $uptopsql = " ,sitepath='$sitepath' "; - if(preg_match("#,#", $slinks)) - { + if (preg_match("#,#", $slinks)) { $upquery = "UPDATE `#@__arctype` SET sitepath='$sitepath' WHERE $slinks"; $dsql->ExecuteNoneQuery($upquery); } } //如果选择子栏目可投稿,更新顶级栏目为可投稿 - if($topid > 0 && $issend==1) - { + if ($topid > 0 && $issend == 1) { $dsql->ExecuteNoneQuery("UPDATE `#@__arctype` SET issend='$issend' WHERE id='$topid'; "); } - + $upquery = "UPDATE `#@__arctype` SET issend='$issend', sortrank='$sortrank', @@ -139,14 +129,13 @@ else if ($dopost=="savetime") ispart='$ispart', corank='$corank' $uptopsql WHERE id='$id' "; - - if(!$dsql->ExecuteNoneQuery($upquery)) - { - ShowMsg("保存当前栏目更改时失败,请检查你的输入资料是否存在问题!","-1"); + + if (!$dsql->ExecuteNoneQuery($upquery)) { + ShowMsg("保存当前栏目更改时失败,请检查你的输入资料是否存在问题!", "-1"); exit(); } UpDateCatCache(); - ShowMsg("成功更改一个分类!","catalog_main.php"); + ShowMsg("成功更改一个分类!", "catalog_main.php"); exit(); } @@ -154,137 +143,131 @@ else if ($dopost=="savetime") $dsql->SetQuery("SELECT tp.*,ch.typename as ctypename FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.id=$id"); $myrow = $dsql->GetOne(); $topid = $myrow['topid']; -if($topid>0) -{ +if ($topid > 0) { $toprow = $dsql->GetOne("SELECT moresite,siteurl,sitepath FROM `#@__arctype` WHERE id=$topid"); - foreach($toprow as $k=>$v) - { - if(!preg_match("#[0-9]#", $k)) - { + foreach ($toprow as $k => $v) { + if (!preg_match("#[0-9]#", $k)) { $myrow[$k] = $v; } } } -$myrow['content']=empty($myrow['content'])? " " : $myrow['content']; +$myrow['content'] = empty($myrow['content']) ? " " : $myrow['content']; //读取频道模型信息 $channelid = $myrow['channeltype']; $dsql->SetQuery("SELECT id,typename,nid FROM `#@__channeltype` WHERE id<>-1 AND isshow=1 ORDER BY id"); $dsql->Execute(); -while($row = $dsql->GetObject()) -{ +while ($row = $dsql->GetObject()) { $channelArray[$row->id]['typename'] = $row->typename; $channelArray[$row->id]['nid'] = $row->nid; - if($row->id==$channelid) - { + if ($row->id == $channelid) { $nid = $row->nid; } } -PutCookie('lastCid',GetTopid($id),3600*24,"/"); -if($dopost == 'time') -{ - ?> -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + +
- 当前是快捷编辑模式,如果您要修改更详细的参数,请使用高级模式>> -
是否支持投稿: -   -
内容模型: - $arr) - { - if($k==$channelid) echo "{$arr['typename']} | {$arr['nid']}"; - } - ?> - [修改] -
栏目名称:
排列顺序: - (由低 -> 高)
浏览权限: - (仅限制栏目里的文档浏览权限)
文件保存目录:
栏目列表选项: - - -
默认页的名称:
栏目属性: -
-
+ +     + +
+ + \ No newline at end of file diff --git a/src/dede/catalog_main.php b/src/dede/catalog_main.php index a5038106..29261295 100755 --- a/src/dede/catalog_main.php +++ b/src/dede/catalog_main.php @@ -1,14 +1,15 @@ getUserChannel(); -include DedeInclude('templets/catalog_main.htm'); \ No newline at end of file +include DedeInclude('templets/catalog_main.htm'); diff --git a/src/dede/catalog_menu.php b/src/dede/catalog_menu.php index 37783cdf..c99cd9bf 100755 --- a/src/dede/catalog_menu.php +++ b/src/dede/catalog_menu.php @@ -1,26 +1,24 @@ getUserChannel(); -if(empty($opendir)) $opendir=-1; -if($userChannel>0) $opendir=$userChannel; +if (empty($opendir)) $opendir = -1; +if ($userChannel > 0) $opendir = $userChannel; -if($cuserLogin->adminStyle=='dedecms') -{ +if ($cuserLogin->adminStyle == 'dedecms') { include DedeInclude('templets/catalog_menu.htm'); exit(); -} -else -{ +} else { include DedeInclude('templets/catalog_menu2.htm'); exit(); -} \ No newline at end of file +} diff --git a/src/dede/co_add.php b/src/dede/co_add.php index 6ac2853b..4371caaf 100755 --- a/src/dede/co_add.php +++ b/src/dede/co_add.php @@ -1,42 +1,37 @@ LoadListConfig($tmplistconfig); $listurl = ''; $links = $dc->Testlists($listurl); $errmsg = $dc->errString; - } - else - { + } else { $demopage = '没有匹配到适合的列表页!'; } } - require_once(DEDEADMIN."/templets/co_add_step1_test.htm"); + require_once(DEDEADMIN . "/templets/co_add_step1_test.htm"); exit(); } //从预览并提示进入下一步 - else - { + else { $row = $dsql->GetOne("SELECT nid,channelid FROM `#@__co_note` WHERE isok=0 AND notename LIKE '$notename' "); - if(!is_array($row)) - { + if (!is_array($row)) { $uptime = time(); $listconfig = urldecode($listconfig); $inquery = " INSERT INTO `#@__co_note`(`channelid`,`notename`,`sourcelang`,`uptime`,`cotime`,`pnum`,`isok`,`usemore`,`listconfig`,`itemconfig`) VALUES ('$channelid','$notename','$sourcelang','$uptime','0','0','0','$usemore','$listconfig',''); "; $rs = $dsql->ExecuteNoneQuery($inquery); - if(!$rs) - { - ShowMsg("保存信息时出现错误!".$dsql->GetError(),"-1"); + if (!$rs) { + ShowMsg("保存信息时出现错误!" . $dsql->GetError(), "-1"); exit(); } $nid = $dsql->GetLastID(); - } - else - { - $channelid=$row['channelid']; + } else { + $channelid = $row['channelid']; $uptime = time(); - if(empty($freq)) $freq = 1; - if(empty($extypeid)) $extypeid = 0; - if(empty($islisten)) $islisten = 0; + if (empty($freq)) $freq = 1; + if (empty($extypeid)) $extypeid = 0; + if (empty($islisten)) $islisten = 0; $usemore = (!isset($usemore) ? 0 : 1); - + $query = " UPDATE `#@__co_note` SET `channelid`='$channelid', `notename`='$notename', @@ -127,9 +110,9 @@ startid=\\\"$startid\\\" endid=\\\"$endid\\\" addv=\\\"$addv\\\" urlrule=\\\"$ur $dsql->ExecuteNoneQuery($query); $nid = $row['nid']; } - if(!isset($previewurl)) $previewurl = ''; - require_once(DEDEINC.'/dedetag.class.php'); - require_once(DEDEADMIN."/templets/co_add_step2.htm"); + if (!isset($previewurl)) $previewurl = ''; + require_once(DEDEINC . '/dedetag.class.php'); + require_once(DEDEADMIN . "/templets/co_add_step2.htm"); exit(); } } @@ -137,9 +120,7 @@ startid=\\\"$startid\\\" endid=\\\"$endid\\\" addv=\\\"$addv\\\" urlrule=\\\"$ur //保存文章规则 /*---------------------- function Save_Art(){ } -----------------------*/ -else if($step==5) -{ +----------------------*/ else if ($step == 5) { /* [previewurl] => '' */ @@ -147,42 +128,35 @@ else if($step==5) $itemconfig .= "{dede:previewurl}$previewurl{/dede:previewurl}\r\n"; $itemconfig .= "{dede:keywordtrim}$keywordtrim{/dede:keywordtrim}\r\n"; $itemconfig .= "{dede:descriptiontrim}$descriptiontrim{/dede:descriptiontrim}\r\n"; - $fs = explode(',','value,match,isunit,isdown,trim,function'); - foreach($fields as $field) - { - foreach($fs as $f) - { - $GLOBALS[$f.'_'.$field] = (!isset($GLOBALS[$f.'_'.$field]) ? '' : $GLOBALS[$f.'_'.$field]); + $fs = explode(',', 'value,match,isunit,isdown,trim,function'); + foreach ($fields as $field) { + foreach ($fs as $f) { + $GLOBALS[$f . '_' . $field] = (!isset($GLOBALS[$f . '_' . $field]) ? '' : $GLOBALS[$f . '_' . $field]); } - $matchstr = $GLOBALS["match_".$field]; - $trimstr = $GLOBALS["trim_".$field]; - $trimstr = trim(str_replace(' ','#n#',$trimstr)); - $matchstr = trim(str_replace(' ','#n#',$matchstr)); - if($trimstr!='' && !preg_match("#{dede:trim#i", $trimstr)) - { + $matchstr = $GLOBALS["match_" . $field]; + $trimstr = $GLOBALS["trim_" . $field]; + $trimstr = trim(str_replace(' ', '#n#', $trimstr)); + $matchstr = trim(str_replace(' ', '#n#', $matchstr)); + if ($trimstr != '' && !preg_match("#{dede:trim#i", $trimstr)) { $trimstr = " {dede:trim}$trimstr{/dede:trim}\r\n"; } - $itemconfig .= "{dede:item field=\\'".$field."\\' value=\\'".$GLOBALS["value_".$field]."\\' isunit=\\'".$GLOBALS["isunit_".$field]."\\' isdown=\\'".$GLOBALS["isdown_".$field]."\\'} - {dede:match}".$matchstr."{/dede:match} + $itemconfig .= "{dede:item field=\\'" . $field . "\\' value=\\'" . $GLOBALS["value_" . $field] . "\\' isunit=\\'" . $GLOBALS["isunit_" . $field] . "\\' isdown=\\'" . $GLOBALS["isdown_" . $field] . "\\'} + {dede:match}" . $matchstr . "{/dede:match} $trimstr - {dede:function}".$GLOBALS["function_".$field]."{/dede:function} + {dede:function}" . $GLOBALS["function_" . $field] . "{/dede:function} {/dede:item}\r\n"; } $dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET itemconfig='$itemconfig' WHERE nid='$nid' "); //echo $dsql->GetError(); - require_once(DEDEINC.'/dedecollection.class.php'); - require_once(DEDEADMIN."/templets/co_add_step2_test.htm"); + require_once(DEDEINC . '/dedecollection.class.php'); + require_once(DEDEADMIN . "/templets/co_add_step2_test.htm"); exit(); -} -else if($step==6) -{ +} else if ($step == 6) { $dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET isok='1' WHERE nid='$nid' "); - ShowMsg("成功设置一个规则!","co_main.php"); + ShowMsg("成功设置一个规则!", "co_main.php"); exit(); -} -else if($step==7) -{ +} else if ($step == 7) { $dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET isok='1' WHERE nid='$nid' "); - ShowMsg("成功设置一个规则,现在转向采集页面!","co_gather_start.php?nid=$nid"); + ShowMsg("成功设置一个规则,现在转向采集页面!", "co_gather_start.php?nid=$nid"); exit(); -} \ No newline at end of file +} diff --git a/src/dede/co_do.php b/src/dede/co_do.php index c12bf8b8..46f71a35 100755 --- a/src/dede/co_do.php +++ b/src/dede/co_do.php @@ -1,16 +1,17 @@ ExecuteNoneQuery("DELETE FROM `#@__co_htmls` WHERE nid='$nid'"); $dsql->ExecuteNoneQuery("DELETE FROM `#@__co_note` WHERE nid='$nid'"); $dsql->ExecuteNoneQuery("DELETE FROM `#@__co_urls` WHERE nid='$nid'"); - ShowMsg("成功删除一个节点!","co_main.php"); + ShowMsg("成功删除一个节点!", "co_main.php"); exit(); } @@ -33,185 +33,149 @@ if($dopost=="delete") //清空采集内容时仍会保留旧的网址索引,在监控模式下始终采集新的内容 /* function url_clear() -*/ -else if($dopost=="clear") -{ +*/ else if ($dopost == "clear") { CheckPurview('co_Del'); - if(!isset($ids)) $ids=''; - if(empty($ids)) - { - if(!empty($nid)) - { + if (!isset($ids)) $ids = ''; + if (empty($ids)) { + if (!empty($nid)) { $nid = intval($nid); $dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` WHERE nid='$nid'"); } - ShowMsg("成功清空一个节点采集的内容!","co_main.php"); + ShowMsg("成功清空一个节点采集的内容!", "co_main.php"); exit(); - } - else - { - if(!empty($clshash)) - { + } else { + if (!empty($clshash)) { $dsql->SetQuery("SELECT nid,url FROM `#@__co_htmls` WHERE aid IN($ids) "); $dsql->Execute(); - while($arr = $dsql->GetArray()) - { + while ($arr = $dsql->GetArray()) { $nhash = md5($arr['url']); $nid = $row['nid']; $dsql->ExecuteNoneQuery("DELETE FROM `#@__co_urls ` WHERE nid='$nid' AND hash='$nhash' "); } } $dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` WHERE aid IN($ids) "); - ShowMsg("成功删除指定的网址内容!",$ENV_GOBACK_URL); + ShowMsg("成功删除指定的网址内容!", $ENV_GOBACK_URL); exit(); } -} -else if($dopost=="clearct") -{ +} else if ($dopost == "clearct") { CheckPurview('co_Del'); - if(!empty($ids)) - { + if (!empty($ids)) { $dsql->ExecuteNoneQuery("UPDATE `#@__co_htmls` SET isdown=0,result='' WHERE aid IN($ids) "); } - ShowMsg("成功清除所有内容!",$ENV_GOBACK_URL); + ShowMsg("成功清除所有内容!", $ENV_GOBACK_URL); exit(); } /* function url_clearall() -*/ -else if($dopost=="clearall") -{ +*/ else if ($dopost == "clearall") { CheckPurview('co_Del'); $dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` "); - ShowMsg("成功清空所有采集的临时内容!","co_main.php"); + ShowMsg("成功清空所有采集的临时内容!", "co_main.php"); exit(); } //内容替换 /* function co_replace() { } -*/ -else if($dopost=="replace") -{ +*/ else if ($dopost == "replace") { //if() //$nid $aid $regtype $fdstring $rpstring $rpstring = trim($rpstring); - if($regtype=='string') - { + if ($regtype == 'string') { $dsql->ExecuteNoneQuery("UPDATE `#@__co_htmls` SET `result`=REPLACE(`result`,'$fdstring','$rpstring') WHERE nid='$nid' "); - } - else - { + } else { //返回一条测试结果,并要求用户确认操作 - if(empty($rpok)) - { + if (empty($rpok)) { $fdstring = stripslashes($fdstring); $rpstring = stripslashes($rpstring); $hiddenrpvalue = "\r\n\r\n"; - $fdstring = str_replace("\\/","#ASZZ#",$fdstring); - $fdstring = str_replace('/',"\\/",$fdstring); - $fdstring = str_replace('#ASZZ#',"\\/",$fdstring); + $fdstring = str_replace("\\/", "#ASZZ#", $fdstring); + $fdstring = str_replace('/', "\\/", $fdstring); + $fdstring = str_replace('#ASZZ#', "\\/", $fdstring); $result = $rs = stripslashes($rs); - if($fdstring!='') - { - $result = trim(preg_replace("/$fdstring/isU",$rpstring,$rs)); + if ($fdstring != '') { + $result = trim(preg_replace("/$fdstring/isU", $rpstring, $rs)); } $wintitle = "采集管理-内容替换"; $wecome_info = "采集管理::内容替换"; $win = new OxWindow(); - $win->Init("co_do.php","js/blank.js","POST"); - $win->AddHidden('dopost',$dopost); - $win->AddHidden('nid',$nid); - $win->AddHidden('regtype','regex'); - $win->AddHidden('aid',$aid); - $win->AddHidden('rpok','ok'); + $win->Init("co_do.php", "js/blank.js", "POST"); + $win->AddHidden('dopost', $dopost); + $win->AddHidden('nid', $nid); + $win->AddHidden('regtype', 'regex'); + $win->AddHidden('aid', $aid); + $win->AddHidden('rpok', 'ok'); $win->AddTitle("内容替换操作确认:如果下面结果正确,点击确认,系统将替换当前节点所有内容!{$hiddenrpvalue}"); - $win->AddItem("原来的内容:","\r\n"); - $win->AddItem("按规则替换后的内容:","\r\n"); + $win->AddItem("原来的内容:", "\r\n"); + $win->AddItem("按规则替换后的内容:", "\r\n"); $winform = $win->GetWindow("ok"); $win->Display(); exit(); - } - else - { - if($fdstring!='') - { + } else { + if ($fdstring != '') { $dsql->SetQuery("SELECT `aid`,`result` FROM `#@__co_htmls` WHERE nid='$nid' "); $dsql->Execute(); - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $fdstring = stripslashes($fdstring); $rpstring = stripslashes($rpstring); - $fdstring = str_replace("\\/","#ASZZ#",$fdstring); - $fdstring = str_replace('/',"\\/",$fdstring); - $fdstring = str_replace('#ASZZ#',"\\/",$fdstring); - $result = trim(preg_replace("/$fdstring/isU",$rpstring,$row['result'])); + $fdstring = str_replace("\\/", "#ASZZ#", $fdstring); + $fdstring = str_replace('/', "\\/", $fdstring); + $fdstring = str_replace('#ASZZ#', "\\/", $fdstring); + $result = trim(preg_replace("/$fdstring/isU", $rpstring, $row['result'])); $result = addslashes($result); $dsql->ExecuteNoneQuery("UPDATE `#@__co_htmls` SET `result`='$result' WHERE aid='{$row['aid']}' "); } } } } - ShowMsg("成功替换当前节点所有数据!","co_view.php?aid=$aid"); + ShowMsg("成功替换当前节点所有数据!", "co_view.php?aid=$aid"); exit(); } //复制节点 /* function co_copy() -*/ -else if($dopost=="copy") -{ +*/ else if ($dopost == "copy") { CheckPurview('co_AddNote'); - if(empty($mynotename)) - { + if (empty($mynotename)) { $wintitle = "采集管理-复制节点"; $wecome_info = "采集管理::复制节点"; $win = new OxWindow(); - $win->Init("co_do.php","js/blank.js","POST"); - $win->AddHidden("dopost",$dopost); - $win->AddHidden("nid",$nid); + $win->Init("co_do.php", "js/blank.js", "POST"); + $win->AddHidden("dopost", $dopost); + $win->AddHidden("nid", $nid); $win->AddTitle("请输入新节点名称:"); - $win->AddItem("新节点名称:",""); + $win->AddItem("新节点名称:", ""); $winform = $win->GetWindow("ok"); $win->Display(); exit(); } $row = $dsql->GetOne("SELECT * FROM `#@__co_note` WHERE nid='$nid'"); - foreach($row as $k=>$v) - { - if(!isset($$k)) - { + foreach ($row as $k => $v) { + if (!isset($$k)) { $$k = addslashes($v); } } $usemore = (empty($usemore) ? '0' : $usemore); $inQuery = " INSERT INTO `#@__co_note`(`channelid`,`notename`,`sourcelang`,`uptime`,`cotime`,`pnum`,`isok`,`listconfig`,`itemconfig`,`usemore`) - VALUES ('$channelid','$mynotename','$sourcelang','".time()."','0','0','0','$listconfig','$itemconfig','$usemore'); "; + VALUES ('$channelid','$mynotename','$sourcelang','" . time() . "','0','0','0','$listconfig','$itemconfig','$usemore'); "; $dsql->ExecuteNoneQuery($inQuery); - ShowMsg("成功复制一个节点!",$ENV_GOBACK_URL); + ShowMsg("成功复制一个节点!", $ENV_GOBACK_URL); exit(); } //测试Rss源是否正确 /*----------------------- function co_testrss() --------------------------*/ -else if($dopost=="testrss") -{ +-------------------------*/ else if ($dopost == "testrss") { CheckPurview('co_AddNote'); $msg = ''; - if($rssurl=='') - { + if ($rssurl == '') { $msg = '你没有指定RSS地址!'; - } - else - { - include(DEDEINC."/dedecollection.func.php"); + } else { + include(DEDEINC . "/dedecollection.func.php"); $arr = GetRssLinks($rssurl); $msg = "从 {$rssurl} 发现的网址:
"; - $i=1; - if(is_array($arr)) - { - foreach($arr as $ar) - { + $i = 1; + if (is_array($arr)) { + foreach ($arr as $ar) { $msg .= "
\r\n"; $msg .= "link: {$ar['link']}
title: {$ar['title']}
image: {$ar['image']}\r\n"; $i++; @@ -229,23 +193,17 @@ else if($dopost=="testrss") //测试批量网址是否正确 /*----------------------- function co_testregx() --------------------------*/ -else if($dopost=="testregx") -{ +-------------------------*/ else if ($dopost == "testregx") { CheckPurview('co_AddNote'); $msg = ''; - if($regxurl=='') - { + if ($regxurl == '') { $msg = '你没有指定匹配的网址!'; - } - else - { - include(DEDEINC."/dedecollection.func.php"); + } else { + include(DEDEINC . "/dedecollection.func.php"); $msg = "匹配的网址:
"; $lists = GetUrlFromListRule($regxurl, '', $startid, $endid, $addv); - foreach($lists as $surl) - { - $msg .= $surl[0]."
\r\n"; + foreach ($lists as $surl) { + $msg .= $surl[0] . "
\r\n"; } } $wintitle = "采集管理-测试匹配规则"; @@ -260,28 +218,25 @@ else if($dopost=="testregx") //采集未下载内容 /*-------------------- function co_all() ----------------------*/ -else if($dopost=="coall") -{ +---------------------*/ else if ($dopost == "coall") { CheckPurview('co_PlayNote'); $mrow = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` "); $totalnum = $mrow['dd']; - if($totalnum==0) - { - ShowMsg("没发现可下载的内容!","-1"); + if ($totalnum == 0) { + ShowMsg("没发现可下载的内容!", "-1"); exit(); } $wintitle = "采集管理-采集未下载内容"; $wecome_info = "采集管理::采集未下载内容"; $win = new OxWindow(); - $win->Init("co_gather_start_action.php","js/blank.js","GET"); - $win->AddHidden('startdd','0'); - $win->AddHidden('pagesize','5'); - $win->AddHidden('sptime','0'); - $win->AddHidden('nid','0'); - $win->AddHidden('totalnum',$totalnum); + $win->Init("co_gather_start_action.php", "js/blank.js", "GET"); + $win->AddHidden('startdd', '0'); + $win->AddHidden('pagesize', '5'); + $win->AddHidden('sptime', '0'); + $win->AddHidden('nid', '0'); + $win->AddHidden('totalnum', $totalnum); $win->AddMsgItem("本操作会检测并下载‘临时内容’中所有未下载的内容,是否继续?"); $winform = $win->GetWindow("ok"); $win->Display(); exit(); -} \ No newline at end of file +} diff --git a/src/dede/co_edit.php b/src/dede/co_edit.php index 0975fba5..456521e6 100755 --- a/src/dede/co_edit.php +++ b/src/dede/co_edit.php @@ -1,29 +1,28 @@ ExecuteNoneQuery($query); echo $dsql->GetError(); - if($donext=='save') - { - ShowMsg("成功保存配置!","co_main.php"); - } - else - { - require_once(dirname(__FILE__)."/co_test_rule.php"); + if ($donext == 'save') { + ShowMsg("成功保存配置!", "co_main.php"); + } else { + require_once(dirname(__FILE__) . "/co_test_rule.php"); } exit(); } $arr = $dsql->GetOne("SELECT * FROM `#@__co_note` WHERE nid='$nid'"); //如果内容规则未设置,转到设置内容规则的表单 -if(trim($arr['itemconfig'])=='') -{ +if (trim($arr['itemconfig']) == '') { $channelid = $arr['channelid']; $nid = $arr['nid']; - if(!isset($previewurl)) $previewurl = ''; + if (!isset($previewurl)) $previewurl = ''; - require_once(DEDEINC.'/dedetag.class.php'); - require_once(DEDEADMIN."/templets/co_add_step2.htm"); + require_once(DEDEINC . '/dedetag.class.php'); + require_once(DEDEADMIN . "/templets/co_add_step2.htm"); exit(); } $usemore = $arr['usemore']; @@ -109,48 +101,32 @@ $notes = array(); $dsql->FreeResult(); $dtp = new DedeTagParse(); $dtp2 = new DedeTagParse(); -$dtp->LoadString($arr['listconfig'].$arr['itemconfig']); +$dtp->LoadString($arr['listconfig'] . $arr['itemconfig']); $channelid = $arr['channelid']; $notes['keywordtrim'] = ''; $notes['descriptiontrim'] = ''; -foreach($dtp->CTags as $tid => $ctag) -{ - if($ctag->GetName()=='item') - { +foreach ($dtp->CTags as $tid => $ctag) { + if ($ctag->GetName() == 'item') { $f = $ctag->GetAtt('field'); $notes[$f]['item'] = $ctag; $dtp2->LoadString($ctag->GetInnerText()); $notes[$f]['trim'] = ''; - foreach($dtp2->CTags as $ctag2) - { - if($ctag2->GetName()=='trim') - { - $notes[$f]['trim'] .= "{dede:trim replace=\"".$ctag2->GetAtt('replace')."\"}".$ctag2->GetInnerText()."{/dede:trim}\r\n"; - } - else if($ctag2->GetName()=='match') - { - $notes[$f]['match'] = $ctag2->GetInnerText()."\r\n"; - } - else if($ctag2->GetName()=='function') - { - $notes[$f]['function'] = $ctag2->GetInnerText()."\r\n"; + foreach ($dtp2->CTags as $ctag2) { + if ($ctag2->GetName() == 'trim') { + $notes[$f]['trim'] .= "{dede:trim replace=\"" . $ctag2->GetAtt('replace') . "\"}" . $ctag2->GetInnerText() . "{/dede:trim}\r\n"; + } else if ($ctag2->GetName() == 'match') { + $notes[$f]['match'] = $ctag2->GetInnerText() . "\r\n"; + } else if ($ctag2->GetName() == 'function') { + $notes[$f]['function'] = $ctag2->GetInnerText() . "\r\n"; } } - } - else if($ctag->GetName()=='keywordtrim') - { + } else if ($ctag->GetName() == 'keywordtrim') { $notes['keywordtrim'] = $ctag->GetInnerText(); - } - else if($ctag->GetName()=='descriptiontrim') - { + } else if ($ctag->GetName() == 'descriptiontrim') { $notes['descriptiontrim'] = $ctag->GetInnerText(); - } - else if($ctag->GetName()=='noteinfo') - { + } else if ($ctag->GetName() == 'noteinfo') { $noteinfo = $ctag; - } - else if($ctag->GetName()=='listrule') - { + } else if ($ctag->GetName() == 'listrule') { $listrule = $ctag; $dtp2->LoadString($ctag->GetInnerText()); $addurls = $dtp2->GetTagByName('addurls'); @@ -158,15 +134,11 @@ foreach($dtp->CTags as $tid => $ctag) $areastart = $dtp2->GetTagByName('areastart'); $areaend = $dtp2->GetTagByName('areaend'); $batchrule = $dtp2->GetTagByName('batchrule'); - } - else if($ctag->GetName()=='sppage') - { + } else if ($ctag->GetName() == 'sppage') { $sppage = $ctag; - } - else if($ctag->GetName()=='previewurl') - { + } else if ($ctag->GetName() == 'previewurl') { $previewurl = trim($ctag->GetInnerText()); } } -if(!isset($previewurl)) $previewurl = ''; -require_once(DEDEADMIN.'/templets/co_edit.htm'); \ No newline at end of file +if (!isset($previewurl)) $previewurl = ''; +require_once(DEDEADMIN . '/templets/co_edit.htm'); diff --git a/src/dede/co_edit_text.php b/src/dede/co_edit_text.php index 72b6cad4..a745b65b 100755 --- a/src/dede/co_edit_text.php +++ b/src/dede/co_edit_text.php @@ -1,20 +1,20 @@ 采集点管理::更改采集规则 - 专家更改模式"; $win = new OxWindow(); @@ -29,12 +29,10 @@ if($job=='') $winform = $win->GetWindow("ok"); $win->Display(); exit(); -} -else -{ +} else { CheckPurview('co_EditNote'); $query = "UPDATE `#@__co_note` SET listconfig='$listconfig',itemconfig='$itemconfig' WHERE nid='$nid' "; $rs = $dsql->ExecuteNoneQuery($query); - ShowMsg("成功修改一个规则!","co_main.php"); + ShowMsg("成功修改一个规则!", "co_main.php"); exit(); -} \ No newline at end of file +} diff --git a/src/dede/co_export.php b/src/dede/co_export.php index 1650c3e0..b8533ed6 100755 --- a/src/dede/co_export.php +++ b/src/dede/co_export.php @@ -1,69 +1,59 @@ GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` WHERE nid='$nid' AND isdown='1' "); $totalcc = $mrow['dd']; $rrow = $dsql->GetOne("SELECT channelid,usemore FROM `#@__co_note` WHERE nid='$nid' "); $channelid = $rrow['channelid']; $usemore = $rrow['usemore']; - } - else - { + } else { $mrow = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` WHERE isdown='1' "); $totalcc = $mrow['dd']; } include DedeInclude("templets/co_export.htm"); exit(); -} -else -{ - require_once(DEDEINC.'/dedecollection.class.php'); +} else { + require_once(DEDEINC . '/dedecollection.class.php'); $channelid = isset($channelid) && is_numeric($channelid) ? $channelid : 0; $typeid = isset($typeid) && is_numeric($typeid) ? $typeid : 0; $pageno = isset($pageno) && is_numeric($pageno) ? $pageno : 1; $startid = isset($startid) && is_numeric($startid) ? $startid : 0; $endid = isset($endid) && is_numeric($endid) ? $endid : 0; - - if(!isset($makehtml)) $makehtml = 0; - if(!isset($onlytitle)) $onlytitle = 0; - if(!isset($usetitle)) $usetitle = 0; - if(!isset($autotype)) $autotype = 0; + + if (!isset($makehtml)) $makehtml = 0; + if (!isset($onlytitle)) $onlytitle = 0; + if (!isset($usetitle)) $usetitle = 0; + if (!isset($autotype)) $autotype = 0; $co = new DedeCollection(); $co->LoadNote($nid); - $orderway = (($co->noteInfos['cosort']=='desc' || $co->noteInfos['cosort']=='asc') ? $co->noteInfos['cosort'] : 'desc'); - if($channelid==0 && $typeid==0) - { - ShowMsg('请指定默认导出栏目或频道ID!','javascript:;'); + $orderway = (($co->noteInfos['cosort'] == 'desc' || $co->noteInfos['cosort'] == 'asc') ? $co->noteInfos['cosort'] : 'desc'); + if ($channelid == 0 && $typeid == 0) { + ShowMsg('请指定默认导出栏目或频道ID!', 'javascript:;'); exit(); } - if($channelid==0) - { + if ($channelid == 0) { $row = $dsql->GetOne("SELECT ch.* FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE tp.id='$typeid'; "); - } - else - { + } else { $row = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='$channelid'; "); } - if(!is_array($row)) - { + if (!is_array($row)) { echo "找不到频道内容模型信息,无法完成操作!"; exit(); } @@ -72,9 +62,8 @@ else $channelid = $row['id']; $maintable = $row['maintable']; $addtable = $row['addtable']; - if(empty($maintable)) $maintable = '#@__archives'; - if(empty($addtable)) - { + if (empty($maintable)) $maintable = '#@__archives'; + if (empty($addtable)) { echo "找不主表配置信息,无法完成操作!"; exit(); } @@ -90,37 +79,26 @@ else //生成附加表插入的SQL语句 $inadd_f = $inadd_v = ''; $dtp = new DedeTagParse(); - $dtp->SetNameSpace('field','<','>'); + $dtp->SetNameSpace('field', '<', '>'); $dtp->LoadString($row['fieldset']); - foreach($dtp->CTags as $ctag) - { + foreach ($dtp->CTags as $ctag) { $tname = $ctag->GetTagName(); $inadd_f .= ",`$tname`"; $notsend = $ctag->GetAtt('notsend'); $fieldtype = $ctag->GetAtt('type'); - if($notsend==1) - { + if ($notsend == 1) { //对不同类型设置默认值 - if($ctag->GetAtt('default')!='') - { + if ($ctag->GetAtt('default') != '') { $dfvalue = $ctag->GetAtt('default'); - } - else if($fieldtype=='int' || $fieldtype=='float' || $fieldtype=='number') - { + } else if ($fieldtype == 'int' || $fieldtype == 'float' || $fieldtype == 'number') { $dfvalue = '0'; - } - else if($fieldtype=='dtime') - { + } else if ($fieldtype == 'dtime') { $dfvalue = time(); - } - else - { + } else { $dfvalue = ''; } $inadd_v .= ",'$dfvalue'"; - } - else - { + } else { $inadd_v .= ",'@$tname@'"; } } @@ -129,69 +107,53 @@ else //导出数据的SQL操作 $dtp = new DedeTagParse(); $totalpage = $totalcc / $pagesize; - $startdd = ($pageno-1) * $pagesize; - if(!empty($nid)) - { + $startdd = ($pageno - 1) * $pagesize; + if (!empty($nid)) { $dsql->SetQuery("SELECT * FROM `#@__co_htmls` WHERE nid='$nid' AND isdown='1' ORDER BY aid $orderway LIMIT $startdd,$pagesize"); - } - else - { + } else { $dsql->SetQuery("SELECT * FROM `#@__co_htmls` WHERE isdown='1' ORDER BY aid $orderway LIMIT $startdd,$pagesize"); } $dsql->Execute(); - while($row = $dsql->GetObject()) - { - if(trim($row->result=='')) continue; + while ($row = $dsql->GetObject()) { + if (trim($row->result == '')) continue; //$addSqlTemplate,$mainSqlTemplate,$indexSqlTemplate - $ntypeid = ($autotype==1 && $row->typeid != 0) ? $row->typeid : $typeid; + $ntypeid = ($autotype == 1 && $row->typeid != 0) ? $row->typeid : $typeid; $indexSql = str_replace('@typeid@', $ntypeid, $indexSqlTemplate); $mainSql = str_replace('@typeid@', $ntypeid, $mainSqlTemplate); $addSql = str_replace('@typeid@', $ntypeid, $addSqlTemplate); $dtp->LoadString($row->result); $exid = $row->aid; - if(!is_array($dtp->CTags)) continue; + if (!is_array($dtp->CTags)) continue; //获取时间和标题 $pubdate = $sortrank = time(); $title = $row->title; $litpic = ''; - foreach ($dtp->CTags as $ctag) - { + foreach ($dtp->CTags as $ctag) { $itemName = $ctag->GetAtt('name'); - if($itemName == 'title' && $usetitle==0) - { + if ($itemName == 'title' && $usetitle == 0) { $title = trim($ctag->GetInnerText()); - if($title=='') - { + if ($title == '') { $title = $row->title; } - } - else if($itemName == 'pubdate') - { + } else if ($itemName == 'pubdate') { $pubdate = trim($ctag->GetInnerText()); - if(preg_match("#[^0-9]#", $pubdate)) - { + if (preg_match("#[^0-9]#", $pubdate)) { $pubdate = $sortrank = GetMkTime($pubdate); - } - else - { + } else { $pubdate = $sortrank = time(); } - } - else if($itemName == 'litpic') - { + } else if ($itemName == 'litpic') { $litpic = trim($ctag->GetInnerText()); } } //检测重复标题 $title = addslashes($title); - if($onlytitle) - { + if ($onlytitle) { $testrow = $dsql->GetOne("SELECT COUNT(ID) AS dd FROM `$maintable` WHERE title LIKE '$title'"); - if($testrow['dd']>0) - { + if ($testrow['dd'] > 0) { echo "数据库已存在标题为: {$title} 的文档,程序阻止了此本条内容导入
\r\n"; continue; } @@ -200,15 +162,13 @@ else //替换固定的项目 $senddate = time(); $flag = ''; - if($litpic!='') $flag = 'p'; + if ($litpic != '') $flag = 'p'; //随机推荐 - if($randcc>0) - { + if ($randcc > 0) { $rflag = mt_rand(1, $randcc); - if($rflag==$randcc) - { - $flag = ($flag=='' ? 'c' : $flag.',c'); + if ($rflag == $randcc) { + $flag = ($flag == '' ? 'c' : $flag . ',c'); } } $indexSql = str_replace('@senddate@', $senddate, $indexSql); @@ -218,15 +178,13 @@ else $mainSql = str_replace('@pubdate@', $pubdate, $mainSql); $mainSql = str_replace('@senddate@', $senddate, $mainSql); $mainSql = str_replace('@title@', cn_substr($title, $cfg_title_maxlen), $mainSql); - //$mainSql = str_replace('@title@', cn_substr($title, 60), $mainSql); 原来的语句,采集的文章导出到栏目后标题不全 + //$mainSql = str_replace('@title@', cn_substr($title, 60), $mainSql); 原来的语句,采集的文章导出到栏目后标题不全 $addSql = str_replace('@sortrank@', $sortrank, $addSql); $addSql = str_replace('@senddate@', $senddate, $addSql); //替换模型里的其它字段 - foreach($dtp->CTags as $ctag) - { - if($ctag->GetName()!='field') - { + foreach ($dtp->CTags as $ctag) { + if ($ctag->GetName() != 'field') { continue; } $itemname = $ctag->GetAtt('name'); @@ -237,25 +195,20 @@ else //插入数据库 $rs = $dsql->ExecuteNoneQuery($indexSql); - if($rs) - { + if ($rs) { $aid = $dsql->GetLastID(); $mainSql = str_replace('@aid@', $aid, $mainSql); $addSql = str_replace('@aid@', $aid, $addSql); $mainSql = preg_replace("#@([a-z0-9]{1,})@#", '', $mainSql); $addSql = preg_replace("#@([a-z0-9]{1,})@#", '', $addSql); $rs = $dsql->ExecuteNoneQuery($mainSql); - if(!$rs) - { - echo "导入 '$title' 时错误:".$dsql->GetError()."
"; + if (!$rs) { + echo "导入 '$title' 时错误:" . $dsql->GetError() . "
"; $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$aid' "); - } - else - { + } else { $rs = $dsql->ExecuteNoneQuery($addSql); - if(!$rs) - { - echo "导入 '$title' 时错误:".$dsql->GetError()."
"; + if (!$rs) { + echo "导入 '$title' 时错误:" . $dsql->GetError() . "
"; $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$aid' "); $dsql->ExecuteNoneQuery("DELETE FROM `$maintable` WHERE id='$aid' "); } @@ -265,43 +218,31 @@ else } //检测是否完成或后续操作 - if($totalpage <= $pageno) - { - if($channelid>0 && $makehtml==1) - { - if( $autotype==0 && !empty($nid) ) - { + if ($totalpage <= $pageno) { + if ($channelid > 0 && $makehtml == 1) { + if ($autotype == 0 && !empty($nid)) { $mhtml = "makehtml_archives_action.php?typeid=$typeid&startid=$startid&endid=$endid&pagesize=20"; - ShowMsg("完成数据导入,准备生成文档HTML...",$mhtml); + ShowMsg("完成数据导入,准备生成文档HTML...", $mhtml); exit(); - } - else - { - ShowMsg("完成所有数据导入,请手工更新HTML!","javascript:;"); + } else { + ShowMsg("完成所有数据导入,请手工更新HTML!", "javascript:;"); exit(); } - } - else - { - ShowMsg("完成所有数据导入!","javascript:;"); + } else { + ShowMsg("完成所有数据导入!", "javascript:;"); exit(); } - } - else - { - if($totalpage>0) - { + } else { + if ($totalpage > 0) { $rs = substr(($pageno / $totalpage * 100), 0, 2); - } - else - { + } else { $rs = 100; } $pageno++; $gourl = "co_export.php?dopost=done&nid=$nid&totalcc=$totalcc&channelid=$channelid&pageno=$pageno"; $gourl .= "&nid=$nid&typeid=$typeid&autotype=$autotype&arcrank=$arcrank&pagesize=$pagesize&randcc=$randcc"; $gourl .= "&startid=$startid&endid=$endid&onlytitle=$onlytitle&usetitle=$usetitle&makehtml=$makehtml"; - ShowMsg("完成 {$rs}% 导入,继续执行操作...",$gourl,'',500); + ShowMsg("完成 {$rs}% 导入,继续执行操作...", $gourl, '', 500); exit(); } -} \ No newline at end of file +} diff --git a/src/dede/co_export_corule.php b/src/dede/co_export_corule.php index 1e34d38d..610de853 100755 --- a/src/dede/co_export_corule.php +++ b/src/dede/co_export_corule.php @@ -4,7 +4,7 @@ * 统一转换为unicode编码然后再base64加密 * * @version $Id: co_export_corule.php 1 14:31 2010年7月12日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -32,5 +32,3 @@ $win->Init(); $win->AddTitle("以下为规则 [{$row['notename']}] 的文本配置,你可以共享给你的朋友:"); $winform = $win->GetWindow("hand",""); $win->Display(); - -?> \ No newline at end of file diff --git a/src/dede/co_gather_start.php b/src/dede/co_gather_start.php index 45083432..195da17f 100755 --- a/src/dede/co_gather_start.php +++ b/src/dede/co_gather_start.php @@ -1,28 +1,25 @@ LoadNote($nid); $row = $dsql->GetOne("SELECT COUNT(aid) AS dd FROM `#@__co_htmls` WHERE nid='$nid'; "); - if($row['dd']==0) - { + if ($row['dd'] == 0) { $unum = "没有记录或从来没有采集过这个节点!"; - } - else - { + } else { $unum = "共有 {$row['dd']} 个历史种子网址![更新种子网址,并采集]"; } } else { @@ -31,4 +28,4 @@ if(!empty($nid)) $ntitle = '监控式采集:'; $unum = "没指定采集节点,将使用检测新内容采集模式!"; } -include DedeInclude('templets/co_gather_start.htm'); \ No newline at end of file +include DedeInclude('templets/co_gather_start.htm'); diff --git a/src/dede/co_gather_start_action.php b/src/dede/co_gather_start_action.php index 85a3b130..f2adb999 100755 --- a/src/dede/co_gather_start_action.php +++ b/src/dede/co_gather_start_action.php @@ -1,87 +1,71 @@ $startdd+$pagesize) $limitSql = " LIMIT $startdd,$pagesize "; -else $limitSql = " LIMIT $startdd,".($totalnum - $startdd); +if ($totalnum > $startdd + $pagesize) $limitSql = " LIMIT $startdd,$pagesize "; +else $limitSql = " LIMIT $startdd," . ($totalnum - $startdd); -if($totalnum - $startdd < 1) -{ - if(empty($nid)) - { - $dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='".time()."'; "); - } - else - { - $dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='".time()."' WHERE nid='$nid'; "); +if ($totalnum - $startdd < 1) { + if (empty($nid)) { + $dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='" . time() . "'; "); + } else { + $dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='" . time() . "' WHERE nid='$nid'; "); } - ShowMsg('完成当前下载任务!','javascript:;'); + ShowMsg('完成当前下载任务!', 'javascript:;'); exit(); } $co = new DedeCollection(); -if(!empty($nid)) $co->LoadNote($nid); +if (!empty($nid)) $co->LoadNote($nid); //没指定采集ID时下载所有内容 -if(!empty($nid)) -{ +if (!empty($nid)) { $dsql->SetQuery("SELECT aid,nid,url,isdown,litpic FROM `#@__co_htmls` WHERE nid=$nid $limitSql "); -} -else -{ +} else { $dsql->SetQuery("SELECT aid,nid,url,isdown,litpic FROM `#@__co_htmls` $limitSql "); } $dsql->Execute(99); $tjnum = $startdd; -while($row = $dsql->GetObject(99)) -{ - if($row->isdown==0) - { - if(empty($nid)) $co->LoadNote($row->nid); - $co->DownUrl($row->aid,$row->url,$row->litpic); +while ($row = $dsql->GetObject(99)) { + if ($row->isdown == 0) { + if (empty($nid)) $co->LoadNote($row->nid); + $co->DownUrl($row->aid, $row->url, $row->litpic); } $tjnum++; - if($sptime>0) sleep($sptime); + if ($sptime > 0) sleep($sptime); } -if($totalnum-$oldstart!=0) -{ - $tjlen = ceil( (($tjnum-$oldstart)/($totalnum-$oldstart)) * 100 ); +if ($totalnum - $oldstart != 0) { + $tjlen = ceil((($tjnum - $oldstart) / ($totalnum - $oldstart)) * 100); $dvlen = $tjlen * 2; $tjsta = "
"; $tjsta .= "
完成当前任务的:$tjlen %,继续执行任务..."; } -if($tjnum < $totalnum) -{ - ShowMsg($tjsta, "co_gather_start_action.php?notckpic=$notckpic&sptime=$sptime&nid=$nid&oldstart=$oldstart&totalnum=$totalnum&startdd=".($startdd+$pagesize)."&pagesize=$pagesize","",0); +if ($tjnum < $totalnum) { + ShowMsg($tjsta, "co_gather_start_action.php?notckpic=$notckpic&sptime=$sptime&nid=$nid&oldstart=$oldstart&totalnum=$totalnum&startdd=" . ($startdd + $pagesize) . "&pagesize=$pagesize", "", 0); exit(); -} -else -{ - if(empty($nid)) - { - $dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='".time()."'; "); - } - else - { - $dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='".time()."' WHERE nid='$nid'; "); +} else { + if (empty($nid)) { + $dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='" . time() . "'; "); + } else { + $dsql->ExecuteNoneQuery("UPDATE `#@__co_note` SET cotime='" . time() . "' WHERE nid='$nid'; "); } - ShowMsg("完成当前下载任务!","javascript:;"); + ShowMsg("完成当前下载任务!", "javascript:;"); exit(); -} \ No newline at end of file +} diff --git a/src/dede/co_get_corule.php b/src/dede/co_get_corule.php index 9169ea49..540748a6 100755 --- a/src/dede/co_get_corule.php +++ b/src/dede/co_get_corule.php @@ -3,7 +3,7 @@ * 导入采集规则 * * @version $Id: co_get_corule.php 1 17:13 2010年7月12日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -97,5 +97,3 @@ else ShowMsg("成功导入一个规则!","co_main.php"); exit(); } - -?> \ No newline at end of file diff --git a/src/dede/co_getsource_url_action.php b/src/dede/co_getsource_url_action.php index afaf3934..a182f36c 100755 --- a/src/dede/co_getsource_url_action.php +++ b/src/dede/co_getsource_url_action.php @@ -1,21 +1,22 @@ GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` WHERE nid='$nid' "); $totalnum = $mrow['dd']; $gurl = "co_gather_start_action.php?notckpic=$notckpic&islisten=$islisten&nid=$nid&startdd=$startdd&pagesize=$pagesize&sptime=$sptime"; - if($totalnum <= 0) - { - ShowMsg("你指定的模式为:[下载种子网址中未下载内容]
使用这个模式节点必须已经有种子网址,否则请使用其它模式!","javascript:;"); + if ($totalnum <= 0) { + ShowMsg("你指定的模式为:[下载种子网址中未下载内容]
使用这个模式节点必须已经有种子网址,否则请使用其它模式!", "javascript:;"); exit(); - } - else - { - ShowMsg("检测节点正常,现转向网页采集...",$gurl."&totalnum=$totalnum"); + } else { + ShowMsg("检测节点正常,现转向网页采集...", $gurl . "&totalnum=$totalnum"); exit(); } } @@ -43,48 +40,38 @@ if($islisten==0) //监控式采集(检测新内容) /*----------------------------- function Download_new() { } -------------------------------*/ -else if($islisten==1) -{ +------------------------------*/ else if ($islisten == 1) { $gurl = "co_gather_start_action.php?notckpic=$notckpic&islisten=1&nid=$nid&startdd=$startdd&pagesize=$pagesize&sptime=$sptime"; $gurlList = "co_getsource_url_action.php?islisten=1&nid=0&pagesize=$pagesize&sptime=$sptime"; //针对专门节点 - if(!empty($nid)) - { + if (!empty($nid)) { $co = new DedeCollection(); $co->LoadNote($nid); - $limitList = $co->GetSourceUrl(1,0,100); + $limitList = $co->GetSourceUrl(1, 0, 100); $row = $co->dsql->GetOne("SELECT COUNT(aid) AS dd FROM `#@__co_htmls` WHERE nid='$nid' "); $totalnum = $row['dd']; - if($totalnum==0) - { - ShowMsg("在这节点中没发现有新内容....","javascript:;"); + if ($totalnum == 0) { + ShowMsg("在这节点中没发现有新内容....", "javascript:;"); exit(); - } - else - { - ShowMsg("已获得所有种子网址,转向网页采集...",$gurl."&totalnum=$totalnum"); + } else { + ShowMsg("已获得所有种子网址,转向网页采集...", $gurl . "&totalnum=$totalnum"); exit(); } } //针对所有节点 - else - { + else { $curpos = (isset($curpos) ? intval($curpos) : 0); $row = $dsql->GetOne("SELECT nid FROM `#@__co_note` ORDER BY nid ASC LIMIT $curpos,1"); $nnid = $row['nid']; - if(!is_array($row)) - { - ShowMsg("完成所有节点检测....","co_gather_start_action.php?notckpic=0&sptime=0&nid=0&startdd=0&pagesize=5&totalnum=".$totalnum); + if (!is_array($row)) { + ShowMsg("完成所有节点检测....", "co_gather_start_action.php?notckpic=0&sptime=0&nid=0&startdd=0&pagesize=5&totalnum=" . $totalnum); exit(); - } - else - { + } else { $co = new DedeCollection(); $co->LoadNote($nnid); - $limitList = $co->GetSourceUrl(1,0,100); + $limitList = $co->GetSourceUrl(1, 0, 100); $curpos++; - ShowMsg("已检测节点( {$nnid} ),继续下一个节点...",$gurlList."&curpos=$curpos"); + ShowMsg("已检测节点( {$nnid} ),继续下一个节点...", $gurlList . "&curpos=$curpos"); exit(); } } @@ -92,24 +79,20 @@ else if($islisten==1) //重新下载所有内容模式 /*----------------------------- function Download_all() { } -------------------------------*/ -else -{ +------------------------------*/ else { $gurl = "co_gather_start_action.php?notckpic=$notckpic&islisten=$islisten&nid=$nid&startdd=$startdd&pagesize=$pagesize&sptime=$sptime"; $gurlList = "co_getsource_url_action.php?islisten=$islisten&nid=$nid&startdd=$startdd&pagesize=$pagesize&sptime=$sptime"; $co = new DedeCollection(); $co->LoadNote($nid); $limitList = $co->GetSourceUrl($islisten, $glstart, $pagesize); - if($limitList==0) - { + if ($limitList == 0) { $row = $co->dsql->GetOne("SELECT COUNT(aid) AS dd FROM `#@__co_htmls` WHERE nid='$nid'"); $totalnum = $row['dd']; - ShowMsg("已获得所有种子网址,转向网页采集...",$gurl."&totalnum=$totalnum"); + ShowMsg("已获得所有种子网址,转向网页采集...", $gurl . "&totalnum=$totalnum"); exit(); } - if($limitList>0) - { - ShowMsg("采集列表剩余:{$limitList} 个页面,继续采集...",$gurlList."&glstart=".($glstart+$pagesize),0,100); + if ($limitList > 0) { + ShowMsg("采集列表剩余:{$limitList} 个页面,继续采集...", $gurlList . "&glstart=" . ($glstart + $pagesize), 0, 100); exit(); } -} \ No newline at end of file +} diff --git a/src/dede/co_main.php b/src/dede/co_main.php index 0d703cdd..b3240b3b 100755 --- a/src/dede/co_main.php +++ b/src/dede/co_main.php @@ -1,26 +1,27 @@ SetTemplet(DEDEADMIN."/templets/co_main.htm"); +$dlist->SetTemplet(DEDEADMIN . "/templets/co_main.htm"); $dlist->SetSource($sql); $dlist->display(); function GetDatePage($mktime) { - return $mktime=='0' ? '从未采集过' : MyDate('Y-m-d',$mktime); + return $mktime == '0' ? '从未采集过' : MyDate('Y-m-d', $mktime); } function TjUrlNum($nid) @@ -28,4 +29,4 @@ function TjUrlNum($nid) global $dsql; $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__co_htmls` WHERE nid='$nid' "); return $row['dd']; -} \ No newline at end of file +} diff --git a/src/dede/co_test_rule.php b/src/dede/co_test_rule.php index acf33e4d..ea4bee0f 100755 --- a/src/dede/co_test_rule.php +++ b/src/dede/co_test_rule.php @@ -1,17 +1,18 @@ LoadNote($nid); include DedeInclude('templets/co_test_rule.htm'); -exit(); \ No newline at end of file +exit(); diff --git a/src/dede/co_url.php b/src/dede/co_url.php index 32b5398e..6f382c56 100755 --- a/src/dede/co_url.php +++ b/src/dede/co_url.php @@ -1,33 +1,31 @@ "; -} -else -{ +} else { $exportbt = ""; } @@ -38,25 +36,22 @@ $where ORDER BY cu.aid DESC"; $dlist = new DataListCP(); $dlist->SetParameter("nid", $nid); $dlist->SetParameter("small", $small); -if($small==0) -{ - $dlist->SetTemplate(DEDEADMIN."/templets/co_url.htm"); -} -else -{ - $dlist->SetTemplate(DEDEADMIN."/templets/co_url_2.htm"); +if ($small == 0) { + $dlist->SetTemplate(DEDEADMIN . "/templets/co_url.htm"); +} else { + $dlist->SetTemplate(DEDEADMIN . "/templets/co_url_2.htm"); } $dlist->SetSource($sql); $dlist->display(); function IsDownLoad($isd) { - if($isd=="0") return "未下载"; + if ($isd == "0") return "未下载"; else return "已下载"; } function IsExData($isex) { - if($isex==0) return "未导出"; + if ($isex == 0) return "未导出"; else return "已导出"; -} \ No newline at end of file +} diff --git a/src/dede/co_view.php b/src/dede/co_view.php index 31d2ddc9..4c989000 100755 --- a/src/dede/co_view.php +++ b/src/dede/co_view.php @@ -1,31 +1,29 @@ ExecuteNoneQuery("UPDATE `#@__co_htmls` SET result='$result' WHERE aid='$aid'; "); - ShowMsg("成功保存一条记录!",$backurl); + ShowMsg("成功保存一条记录!", $backurl); exit(); } $dsql->SetSql("SELECT * FROM `#@__co_htmls` WHERE aid='$aid'"); @@ -38,8 +36,7 @@ $dtime = $row->dtime; $body = $row->result; $litpic = $row->litpic; $fields = array(); -if($isdown == 0) -{ +if ($isdown == 0) { $co = new DedeCollection(); $co->LoadNote($nid); $co->DownUrl($aid, $url, $litpic); @@ -56,4 +53,4 @@ if($isdown == 0) $dtp = new DedeTagParse(); $dtp->SetNameSpace("dede", "{", "}"); $dtp->LoadString($body); -include DedeInclude('templets/co_view.htm'); \ No newline at end of file +include DedeInclude('templets/co_view.htm'); diff --git a/src/dede/config.php b/src/dede/config.php index d6f90c17..13214b13 100755 --- a/src/dede/config.php +++ b/src/dede/config.php @@ -1,25 +1,25 @@ safeCheck = FALSE; $dsql->SetLongLink(); $cfg_admin_skin = 1; // 后台管理风格 -if(file_exists(DEDEDATA.'/admin/skin.txt')) -{ - $skin = file_get_contents(DEDEDATA.'/admin/skin.txt'); - $cfg_admin_skin = !in_array($skin, array(1,2,3,4))? 1 : $skin; +if (file_exists(DEDEDATA . '/admin/skin.txt')) { + $skin = file_get_contents(DEDEDATA . '/admin/skin.txt'); + $cfg_admin_skin = !in_array($skin, array(1, 2, 3, 4)) ? 1 : $skin; } // 检查CSRF @@ -28,21 +28,22 @@ function CheckCSRF() $cc_csrf_token_check = GetCookie("dede_csrf_token"); if ( !(isset($_POST['_csrf_token'], $cc_csrf_token_check) - && is_string($_POST['_csrf_token']) && is_string($cc_csrf_token_check) - && hash_equals($_POST['_csrf_token'], $cc_csrf_token_check)) + && is_string($_POST['_csrf_token']) && is_string($cc_csrf_token_check) + && hash_equals($_POST['_csrf_token'], $cc_csrf_token_check)) ) { ShowMsg('CSRF校验失败,请刷新页面重新提交', '-1'); exit(); } - + DropCookie("dede_csrf_token"); } // 生成CSRF校验token,在比较重要的表单中应该要加上这个token校验 $cc_csrf_token = GetCookie("dede_csrf_token"); if (!isset($GLOBALS['csrf_token']) || $GLOBALS['csrf_token'] === null) { - if (isset($cc_csrf_token) && is_string($cc_csrf_token) - && preg_match('#^[0-9a-f]{32}$#iS',$cc_csrf_token) === 1 + if ( + isset($cc_csrf_token) && is_string($cc_csrf_token) + && preg_match('#^[0-9a-f]{32}$#iS', $cc_csrf_token) === 1 ) { $GLOBALS['csrf_token'] = $cc_csrf_token; } else { @@ -61,29 +62,26 @@ $isUrlOpen = @ini_get('allow_url_fopen'); $dedeNowurl = GetCurUrl(); $dedeNowurls = explode('?', $dedeNowurl); $s_scriptName = $dedeNowurls[0]; -$cfg_remote_site = empty($cfg_remote_site)? 'N' : $cfg_remote_site; +$cfg_remote_site = empty($cfg_remote_site) ? 'N' : $cfg_remote_site; //检验用户登录状态 $cuserLogin = new userLogin(); -if($cuserLogin->getUserID()==-1) -{ - if ( preg_match("#PHP (.*) Development Server#",$_SERVER['SERVER_SOFTWARE']) ) - { +if ($cuserLogin->getUserID() == -1) { + if (preg_match("#PHP (.*) Development Server#", $_SERVER['SERVER_SOFTWARE'])) { $dirname = dirname($_SERVER['SCRIPT_NAME']); - header("location:{$dirname}/login.php?gotopage=".urlencode($dedeNowurl)); + header("location:{$dirname}/login.php?gotopage=" . urlencode($dedeNowurl)); } else { - header("location:login.php?gotopage=".urlencode($dedeNowurl)); + header("location:login.php?gotopage=" . urlencode($dedeNowurl)); } exit(); } function XSSClean($val) { - if (is_array($val)) - { + if (is_array($val)) { foreach ($val as $key => $v) { - if(in_array($key,array('tags','body','dede_fields','dede_addonfields','dopost','introduce'))) continue; + if (in_array($key, array('tags', 'body', 'dede_fields', 'dede_addonfields', 'dopost', 'introduce'))) continue; $val[$key] = XSSClean($val[$key]); } return $val; @@ -91,66 +89,58 @@ function XSSClean($val) return RemoveXss($val); } -if($cfg_dede_log=='Y') -{ +if ($cfg_dede_log == 'Y') { $s_nologfile = '_main|_list'; $s_needlogfile = 'sys_|file_'; $s_method = isset($_SERVER['REQUEST_METHOD']) ? $_SERVER['REQUEST_METHOD'] : ''; $s_query = isset($dedeNowurls[1]) ? $dedeNowurls[1] : ''; $s_scriptNames = explode('/', $s_scriptName); - $s_scriptNames = $s_scriptNames[count($s_scriptNames)-1]; + $s_scriptNames = $s_scriptNames[count($s_scriptNames) - 1]; $s_userip = GetIP(); - if( $s_method=='POST' || (!preg_match("#".$s_nologfile."#i", $s_scriptNames) && $s_query!='') || preg_match("#".$s_needlogfile."#i",$s_scriptNames) ) - { + if ($s_method == 'POST' || (!preg_match("#" . $s_nologfile . "#i", $s_scriptNames) && $s_query != '') || preg_match("#" . $s_needlogfile . "#i", $s_scriptNames)) { $inquery = "INSERT INTO `#@__log`(adminid,filename,method,query,cip,dtime) - VALUES ('".$cuserLogin->getUserID()."','{$s_scriptNames}','{$s_method}','".addslashes($s_query)."','{$s_userip}','".time()."');"; + VALUES ('" . $cuserLogin->getUserID() . "','{$s_scriptNames}','{$s_method}','" . addslashes($s_query) . "','{$s_userip}','" . time() . "');"; $dsql->ExecuteNoneQuery($inquery); } } //管理缓存、管理员频道缓存 -$cache1 = DEDEDATA.'/cache/inc_catalog_base.inc'; -if(!file_exists($cache1)) UpDateCatCache(); -$cacheFile = DEDEDATA.'/cache/admincat_'.$cuserLogin->userID.'.inc'; -if(file_exists($cacheFile)) require_once($cacheFile); +$cache1 = DEDEDATA . '/cache/inc_catalog_base.inc'; +if (!file_exists($cache1)) UpDateCatCache(); +$cacheFile = DEDEDATA . '/cache/admincat_' . $cuserLogin->userID . '.inc'; +if (file_exists($cacheFile)) require_once($cacheFile); //更新服务器 -require_once (DEDEDATA.'/admin/config_update.php'); +require_once(DEDEDATA . '/admin/config_update.php'); -if(strlen($cfg_cookie_encode)<=10) -{ - $chars='abcdefghigklmnopqrstuvwxwyABCDEFGHIGKLMNOPQRSTUVWXWY0123456789'; - $hash=''; - $length = rand(28,32); +if (strlen($cfg_cookie_encode) <= 10) { + $chars = 'abcdefghigklmnopqrstuvwxwyABCDEFGHIGKLMNOPQRSTUVWXWY0123456789'; + $hash = ''; + $length = rand(28, 32); $max = strlen($chars) - 1; - for($i = 0; $i < $length; $i++) { + for ($i = 0; $i < $length; $i++) { $hash .= $chars[mt_rand(0, $max)]; } - $dsql->ExecuteNoneQuery("UPDATE `#@__sysconfig` SET `value`='{$hash}' WHERE varname='cfg_cookie_encode' "); - $configfile = DEDEDATA.'/config.cache.inc.php'; - if(!is_writeable($configfile)) - { + $dsql->ExecuteNoneQuery("UPDATE `#@__sysconfig` SET `value`='{$hash}' WHERE varname='cfg_cookie_encode' "); + $configfile = DEDEDATA . '/config.cache.inc.php'; + if (!is_writeable($configfile)) { echo "配置文件'{$configfile}'不支持写入,无法修改系统配置参数!"; exit(); } - $fp = fopen($configfile,'w'); - flock($fp,3); - fwrite($fp,"<"."?php\r\n"); + $fp = fopen($configfile, 'w'); + flock($fp, 3); + fwrite($fp, "<" . "?php\r\n"); $dsql->SetQuery("SELECT `varname`,`type`,`value`,`groupid` FROM `#@__sysconfig` ORDER BY aid ASC "); $dsql->Execute(); - while($row = $dsql->GetArray()) - { - if($row['type']=='number') - { - if($row['value']=='') $row['value'] = 0; - fwrite($fp,"\${$row['varname']} = ".$row['value'].";\r\n"); - } - else - { - fwrite($fp,"\${$row['varname']} = '".str_replace("'",'',$row['value'])."';\r\n"); + while ($row = $dsql->GetArray()) { + if ($row['type'] == 'number') { + if ($row['value'] == '') $row['value'] = 0; + fwrite($fp, "\${$row['varname']} = " . $row['value'] . ";\r\n"); + } else { + fwrite($fp, "\${$row['varname']} = '" . str_replace("'", '', $row['value']) . "';\r\n"); } } - fwrite($fp,"?".">"); + fwrite($fp, "?" . ">"); fclose($fp); } @@ -163,19 +153,18 @@ if(strlen($cfg_cookie_encode)<=10) function UpDateCatCache() { global $dsql, $cache1, $cuserLogin; - $cache2 = DEDEDATA.'/cache/channelsonlist.inc'; - $cache3 = DEDEDATA.'/cache/channeltoplist.inc'; + $cache2 = DEDEDATA . '/cache/channelsonlist.inc'; + $cache3 = DEDEDATA . '/cache/channeltoplist.inc'; $dsql->SetQuery("SELECT id,reid,channeltype,issend,typename FROM `#@__arctype`"); $dsql->Execute(); - $fp1 = fopen($cache1,'w'); + $fp1 = fopen($cache1, 'w'); $phph = '?'; $fp1Header = "<{$phph}php\r\nglobal \$cfg_Cs;\r\n\$cfg_Cs=array();\r\n"; - fwrite($fp1,$fp1Header); - while($row=$dsql->GetObject()) - { + fwrite($fp1, $fp1Header); + while ($row = $dsql->GetObject()) { // 将typename缓存起来 $row->typename = base64_encode($row->typename); - fwrite($fp1,"\$cfg_Cs[{$row->id}]=array({$row->reid},{$row->channeltype},{$row->issend},'{$row->typename}');\r\n"); + fwrite($fp1, "\$cfg_Cs[{$row->id}]=array({$row->reid},{$row->channeltype},{$row->issend},'{$row->typename}');\r\n"); } fwrite($fp1, "{$phph}>"); fclose($fp1); @@ -187,12 +176,10 @@ function UpDateCatCache() // 清空选项缓存 function ClearOptCache() { - $tplCache = DEDEDATA.'/tplcache/'; - $fileArray = glob($tplCache."inc_option_*.inc"); - if (count($fileArray) > 1) - { - foreach ($fileArray as $key => $value) - { + $tplCache = DEDEDATA . '/tplcache/'; + $fileArray = glob($tplCache . "inc_option_*.inc"); + if (count($fileArray) > 1) { + foreach ($fileArray as $key => $value) { if (file_exists($value)) unlink($value); else continue; } @@ -209,9 +196,9 @@ function ClearOptCache() * @param bool $isabs 是否为管理目录 * @return string */ -function DedeInclude($filename, $isabs=FALSE) +function DedeInclude($filename, $isabs = FALSE) { - return $isabs ? $filename : DEDEADMIN.'/'.$filename; + return $isabs ? $filename : DEDEADMIN . '/' . $filename; } /** @@ -221,14 +208,14 @@ function DedeInclude($filename, $isabs=FALSE) * @param int $mid 用户ID * @return string */ -if(!function_exists('GetMemberName')){ - function GetMemberName($mid=0) - { +if (!function_exists('GetMemberName')) { + function GetMemberName($mid = 0) + { global $dsql; if (empty($mid)) { return "管理员"; } $rs = $dsql->GetOne("SELECT * FROM `#@__member` WHERE mid='{$mid}' "); - return $rs['uname']; - } + return $rs['uname']; + } } diff --git a/src/dede/content_att.php b/src/dede/content_att.php index e91e21d0..d8a9ab08 100755 --- a/src/dede/content_att.php +++ b/src/dede/content_att.php @@ -1,31 +1,30 @@ ExecuteNoneQuery($query); } echo ""; } -include DedeInclude('templets/content_att.htm'); \ No newline at end of file +include DedeInclude('templets/content_att.htm'); diff --git a/src/dede/content_batch_up.php b/src/dede/content_batch_up.php index e82c85f2..4bf35c67 100755 --- a/src/dede/content_batch_up.php +++ b/src/dede/content_batch_up.php @@ -1,13 +1,14 @@ 0 ) $gwhere .= " AND id>= $startid "; -if($endid > $startid) $gwhere .= " AND id<= $endid "; +if ($startid > 0) $gwhere .= " AND id>= $startid "; +if ($endid > $startid) $gwhere .= " AND id<= $endid "; $idsql = ''; -if($typeid!=0) -{ +if ($typeid != 0) { $ids = GetSonIds($typeid); $gwhere .= " AND typeid IN($ids) "; } -if($seltime==1) -{ +if ($seltime == 1) { $t1 = GetMkTime($starttime); $t2 = GetMkTime($endtime); $gwhere .= " AND (senddate >= $t1 AND senddate <= $t2) "; } -if(!empty($userid)) -{ - $row = $dsql->GetOne("SELECT `mid` FROM #@__member WHERE `userid` LIKE '$userid'"); - if(is_array($row)) - { - $gwhere .= " AND mid = {$row['mid']} "; - } +if (!empty($userid)) { + $row = $dsql->GetOne("SELECT `mid` FROM #@__member WHERE `userid` LIKE '$userid'"); + if (is_array($row)) { + $gwhere .= " AND mid = {$row['mid']} "; + } } //特殊操作 -if(!empty($heightdone)) $action=$heightdone; +if (!empty($heightdone)) $action = $heightdone; //指量审核 -if($action=='check') -{ - if(empty($startid) || empty($endid) || $endid < $startid) - { - ShowMsg('该操作必须指定起始ID!','javascript:;'); +if ($action == 'check') { + if (empty($startid) || empty($endid) || $endid < $startid) { + ShowMsg('该操作必须指定起始ID!', 'javascript:;'); exit(); } $jumpurl = "makehtml_archives_action.php?endid=$endid&startid=$startid"; $jumpurl .= "&typeid=$typeid&pagesize=20&seltime=$seltime"; - $jumpurl .= "&stime=".urlencode($starttime)."&etime=".urlencode($endtime); + $jumpurl .= "&stime=" . urlencode($starttime) . "&etime=" . urlencode($endtime); $dsql->SetQuery("SELECT id,arcrank FROM `#@__arctiny` $gwhere"); $dsql->Execute('c'); - while($row = $dsql->GetObject('c')) - { - if($row->arcrank==-1) - { + while ($row = $dsql->GetObject('c')) { + if ($row->arcrank == -1) { $dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET arcrank=0 WHERE id='{$row->id}'"); $dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET arcrank=0 WHERE id='{$row->id}'"); } } - ShowMsg("完成数据库的审核处理,准备更新HTML...",$jumpurl); + ShowMsg("完成数据库的审核处理,准备更新HTML...", $jumpurl); exit(); } //批量删除 -else if($action=='del') -{ - if(empty($startid) || empty($endid) || $endid < $startid) - { - ShowMsg('该操作必须指定起始ID!','javascript:;'); +else if ($action == 'del') { + if (empty($startid) || empty($endid) || $endid < $startid) { + ShowMsg('该操作必须指定起始ID!', 'javascript:;'); exit(); } $dsql->SetQuery("SELECT id FROM `#@__archives` $gwhere"); $dsql->Execute('x'); $tdd = 0; - while($row = $dsql->GetObject('x')) - { - if(DelArc($row->id)) $tdd++; + while ($row = $dsql->GetObject('x')) { + if (DelArc($row->id)) $tdd++; } - ShowMsg("成功删除 $tdd 条记录!","javascript:;"); + ShowMsg("成功删除 $tdd 条记录!", "javascript:;"); exit(); } //删除空标题文档 -else if($action=='delnulltitle') -{ +else if ($action == 'delnulltitle') { $dsql->SetQuery("SELECT id FROM `#@__archives` WHERE trim(title)='' "); $dsql->Execute('x'); $tdd = 0; - while($row = $dsql->GetObject('x')) - { - if(DelArc($row->id)) $tdd++; + while ($row = $dsql->GetObject('x')) { + if (DelArc($row->id)) $tdd++; } - ShowMsg("成功删除 $tdd 条记录!","javascript:;"); + ShowMsg("成功删除 $tdd 条记录!", "javascript:;"); exit(); } //删除空内容文章 -else if($action=='delnullbody') -{ +else if ($action == 'delnullbody') { $dsql->SetQuery("SELECT aid FROM `#@__addonarticle` WHERE LENGTH(body) < 10 "); $dsql->Execute('x'); $tdd = 0; - while($row = $dsql->GetObject('x')) - { - if(DelArc($row->aid)) $tdd++; + while ($row = $dsql->GetObject('x')) { + if (DelArc($row->aid)) $tdd++; } - ShowMsg("成功删除 $tdd 条记录!","javascript:;"); + ShowMsg("成功删除 $tdd 条记录!", "javascript:;"); exit(); } //修正缩略图错误 -else if($action=='modddpic') -{ +else if ($action == 'modddpic') { $dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET litpic='' WHERE trim(litpic)='litpic' "); - ShowMsg("成功修正缩略图错误!","javascript:;"); + ShowMsg("成功修正缩略图错误!", "javascript:;"); exit(); } //批量移动 -else if($action=='move') -{ - if(empty($typeid)) - { - ShowMsg('该操作必须指定栏目!','javascript:;'); +else if ($action == 'move') { + if (empty($typeid)) { + ShowMsg('该操作必须指定栏目!', 'javascript:;'); exit(); } $typeold = $dsql->GetOne("SELECT * FROM #@__arctype WHERE id='$typeid'; "); $typenew = $dsql->GetOne("SELECT * FROM #@__arctype WHERE id='$newtypeid'; "); - if(!is_array($typenew)) - { + if (!is_array($typenew)) { ShowMsg("无法检测移动到的新栏目的信息,不能完成操作!", "javascript:;"); exit(); } - if($typenew['ispart']!=0) - { + if ($typenew['ispart'] != 0) { ShowMsg("你不能把数据移动到非最终列表的栏目!", "javascript:;"); exit(); } - if($typenew['channeltype']!=$typeold['channeltype']) - { - ShowMsg("不能把数据移动到内容类型不同的栏目!","javascript:;"); + if ($typenew['channeltype'] != $typeold['channeltype']) { + ShowMsg("不能把数据移动到内容类型不同的栏目!", "javascript:;"); exit(); } - $gwhere .= " And channel='".$typenew['channeltype']."' And title like '%$keyword%'"; + $gwhere .= " And channel='" . $typenew['channeltype'] . "' And title like '%$keyword%'"; $ch = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id={$typenew['channeltype']} "); $addtable = $ch['addtable']; @@ -169,47 +148,39 @@ else if($action=='move') $dsql->SetQuery("SELECT id FROM `#@__archives` $gwhere"); $dsql->Execute('m'); $tdd = 0; - while($row = $dsql->GetObject('m')) - { + while ($row = $dsql->GetObject('m')) { $rs = $dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET typeid='$newtypeid' WHERE id='{$row->id}'"); $rs = $dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET typeid='$newtypeid' WHERE id='{$row->id}'"); - if($addtable!='') - { + if ($addtable != '') { $dsql->ExecuteNoneQuery("UPDATE `$addtable` SET typeid='$newtypeid' WHERE aid='{$row->id}' "); } - if($rs) $tdd++; + if ($rs) $tdd++; //DelArc($row->id,true); } - if($tdd>0) - { + if ($tdd > 0) { $jumpurl = "makehtml_archives_action.php?endid=$endid&startid=$startid"; $jumpurl .= "&typeid=$newtypeid&pagesize=20&seltime=$seltime"; - $jumpurl .= "&stime=".urlencode($starttime)."&etime=".urlencode($endtime); - ShowMsg("成功移动 $tdd 条记录,准备重新生成HTML...",$jumpurl); - } - else - { - ShowMsg("完成操作,没移动任何数据...","javascript:;"); + $jumpurl .= "&stime=" . urlencode($starttime) . "&etime=" . urlencode($endtime); + ShowMsg("成功移动 $tdd 条记录,准备重新生成HTML...", $jumpurl); + } else { + ShowMsg("完成操作,没移动任何数据...", "javascript:;"); } } //删除空标题内容 -else if($action=='delnulltitle') -{ +else if ($action == 'delnulltitle') { $dsql->SetQuery("SELECT id FROM #@__archives WHERE trim(title)='' "); $dsql->Execute('x'); $tdd = 0; - while($row = $dsql->GetObject('x')) - { - if(DelArc($row->id)) $tdd++; + while ($row = $dsql->GetObject('x')) { + if (DelArc($row->id)) $tdd++; } - ShowMsg("成功删除 $tdd 条记录!","javascript:;"); + ShowMsg("成功删除 $tdd 条记录!", "javascript:;"); exit(); } //修正缩略图错误 -else if($action=='modddpic') -{ +else if ($action == 'modddpic') { $dsql->ExecuteNoneQuery("UPDATE #@__archives SET litpic='' WHERE trim(litpic)='litpic' "); - ShowMsg("成功修正缩略图错误!","javascript:;"); + ShowMsg("成功修正缩略图错误!", "javascript:;"); exit(); } diff --git a/src/dede/content_i_list.php b/src/dede/content_i_list.php index 6fbd90b3..3c2c7ab4 100755 --- a/src/dede/content_i_list.php +++ b/src/dede/content_i_list.php @@ -1,12 +1,13 @@ getUserID(); - + if (TestPurview('a_MyList')) $mid = $cuserLogin->getUserID(); } $adminid = $cuserLogin->getUserID(); $maintable = '#@__archives'; -setcookie('ENV_GOBACK_URL', $dedeNowurl, time()+3600, '/'); +setcookie('ENV_GOBACK_URL', $dedeNowurl, time() + 3600, '/'); $tl = new TypeLink($cid); //---------------------------------------- //在不指定排序条件和关键字的情况下直接统计微表 //---------------------------------------- -if(empty($totalresult) && empty($keyword) && empty($orderby) && empty($flag)) -{ +if (empty($totalresult) && empty($keyword) && empty($orderby) && empty($flag)) { $tinyQuerys = array(); - if(!empty($userCatalogSql)) - { + if (!empty($userCatalogSql)) { $tinyQuerys[] = str_replace('arc.', '', $userCatalogSql); } - if(!empty($channelid) && empty($cid)) - { + if (!empty($channelid) && empty($cid)) { $tinyQuerys[] = " channel = '$channelid' "; - } - else - { + } else { $tinyQuerys[] = " channel>0 "; } - if(!empty($arcrank)) - { + if (!empty($arcrank)) { $tinyQuerys[] = " arcrank='$arcrank' "; - } - else - { + } else { $tinyQuerys[] = " arcrank > -2 "; } - if(!empty($mid)) - { + if (!empty($mid)) { $tinyQuerys[] = " mid='$mid' "; } - if(!empty($cid)) - { - $tinyQuerys[] = " typeid in(".GetSonIds($cid).") "; + if (!empty($cid)) { + $tinyQuerys[] = " typeid in(" . GetSonIds($cid) . ") "; } - if(count($tinyQuerys)>0) - { - $tinyQuery = "WHERE ".join(' AND ',$tinyQuerys); + if (count($tinyQuerys) > 0) { + $tinyQuery = "WHERE " . join(' AND ', $tinyQuerys); } // 缓存处理 $sql = "SELECT COUNT(*) AS dd FROM `#@__arctiny` $tinyQuery "; @@ -106,50 +88,42 @@ if(empty($totalresult) && empty($keyword) && empty($orderby) && empty($flag)) $totalresult = $arr['dd']; } -if($cid==0) -{ - if($channelid==0) - { +if ($cid == 0) { + if ($channelid == 0) { $positionname = '所有栏目>'; - } - else - { + } else { $row = $tl->dsql->GetOne("SELECT id,typename,maintable FROM `#@__channeltype` WHERE id='$channelid'"); - $positionname = $row['typename']." > "; + $positionname = $row['typename'] . " > "; $maintable = $row['maintable']; $channelid = $row['id']; } -} -else -{ - $positionname = str_replace($cfg_list_symbol," > ",$tl->GetPositionName())." > "; +} else { + $positionname = str_replace($cfg_list_symbol, " > ", $tl->GetPositionName()) . " > "; } //当选择的是单表模型栏目时,直接跳转到单表模型管理区 -if(empty($channelid) - && isset($tl->TypeInfos['channeltype'])) -{ +if ( + empty($channelid) + && isset($tl->TypeInfos['channeltype']) +) { $channelid = $tl->TypeInfos['channeltype']; } -if($channelid < -1 ) -{ +if ($channelid < -1) { header("location:content_sg_list.php?f=$f&cid=$cid&channelid=$channelid&keyword=$keyword"); exit(); } // 栏目大于800则需要缓存数据 -$optHash = md5($cid. serialize($admin_catalogs).$channelid); -$optCache = DEDEDATA."/tplcache/inc_option_$optHash.inc"; +$optHash = md5($cid . serialize($admin_catalogs) . $channelid); +$optCache = DEDEDATA . "/tplcache/inc_option_$optHash.inc"; $typeCount = 0; if (file_exists($cache1)) require_once($cache1); else $cfg_Cs = array(); $typeCount = count($cfg_Cs); -if ( $typeCount > 800) -{ - if (file_exists($optCache)) - { +if ($typeCount > 800) { + if (file_exists($optCache)) { $optionarr = file_get_contents($optCache); } else { $optionarr = $tl->GetOptionArray($cid, $admin_catalogs, $channelid); @@ -163,44 +137,35 @@ $whereSql = empty($channelid) ? " WHERE arc.channel > 0 AND arc.arcrank > -2 " $flagsArr = ''; $dsql->Execute('f', 'SELECT * FROM `#@__arcatt` ORDER BY sortid ASC'); -while($frow = $dsql->GetArray('f')) -{ - $flagsArr .= ($frow['att']==$flag ? "\r\n" : "\r\n"); +while ($frow = $dsql->GetArray('f')) { + $flagsArr .= ($frow['att'] == $flag ? "\r\n" : "\r\n"); } -if(!empty($userCatalogSql)) -{ - $whereSql .= " AND ".$userCatalogSql; +if (!empty($userCatalogSql)) { + $whereSql .= " AND " . $userCatalogSql; } -if(!empty($mid)) -{ +if (!empty($mid)) { $whereSql .= " AND arc.mid = '$mid' "; } -if($keyword != '') -{ +if ($keyword != '') { $whereSql .= " AND ( CONCAT(arc.title,arc.writer) LIKE '%$keyword%') "; } -if($flag != '') -{ +if ($flag != '') { $whereSql .= " AND FIND_IN_SET('$flag', arc.flag) "; } -if($cid != 0) -{ - $whereSql .= ' AND arc.typeid IN ('.GetSonIds($cid).')'; +if ($cid != 0) { + $whereSql .= ' AND arc.typeid IN (' . GetSonIds($cid) . ')'; } -if($arcrank != '') -{ +if ($arcrank != '') { $whereSql .= " AND arc.arcrank = '$arcrank' "; - $CheckUserSend = ""; -} -else -{ - $CheckUserSend = ""; + $CheckUserSend = ""; +} else { + $CheckUserSend = ""; } $orderby = empty($orderby) ? 'id' : preg_replace("#[^a-z0-9]#", "", $orderby); -$orderbyField = 'arc.'.$orderby; +$orderbyField = 'arc.' . $orderby; $query = "SELECT arc.id,arc.typeid,arc.senddate,arc.flag,arc.ismake, arc.channel,arc.arcrank,arc.click,arc.title,arc.color,arc.litpic,arc.pubdate,arc.mid @@ -208,7 +173,7 @@ FROM `$maintable` arc $whereSql ORDER BY $orderbyField DESC"; -if(empty($f) || !preg_match("#form#", $f)) $f = 'form1.arcid1'; +if (empty($f) || !preg_match("#form#", $f)) $f = 'form1.arcid1'; //初始化 $dlist = new DataListCP(); @@ -217,7 +182,7 @@ $dlist->pageSize = 30; //GET参数 $dlist->SetParameter('dopost', 'listArchives'); $dlist->SetParameter('keyword', $keyword); -if(!empty($mid)) $dlist->SetParameter('mid', $mid); +if (!empty($mid)) $dlist->SetParameter('mid', $mid); $dlist->SetParameter('cid', $cid); $dlist->SetParameter('flag', $flag); $dlist->SetParameter('orderby', $orderby); @@ -226,8 +191,8 @@ $dlist->SetParameter('channelid', $channelid); $dlist->SetParameter('f', $f); //模板 -if(empty($s_tmplets)) $s_tmplets = 'templets/content_list.htm'; -$dlist->SetTemplate(DEDEADMIN.'/'.$s_tmplets); +if (empty($s_tmplets)) $s_tmplets = 'templets/content_list.htm'; +$dlist->SetTemplate(DEDEADMIN . '/' . $s_tmplets); //查询 $dlist->SetSource($query); diff --git a/src/dede/content_s_list.php b/src/dede/content_s_list.php index 1a937f00..bb9c9205 100755 --- a/src/dede/content_s_list.php +++ b/src/dede/content_s_list.php @@ -1,15 +1,16 @@ getUserChannel(); - } - else - { - CheckCatalog($cid,"你无权浏览非指定栏目的内容!"); + } else { + CheckCatalog($cid, "你无权浏览非指定栏目的内容!"); } } $adminid = $cuserLogin->getUserID(); $maintable = '#@__archives'; -require_once(DEDEINC."/typelink.class.php"); -require_once(DEDEINC."/datalistcp.class.php"); -require_once(DEDEADMIN."/inc/inc_list_functions.php"); -setcookie("ENV_GOBACK_URL",$dedeNowurl,time()+3600,"/"); +require_once(DEDEINC . "/typelink.class.php"); +require_once(DEDEINC . "/datalistcp.class.php"); +require_once(DEDEADMIN . "/inc/inc_list_functions.php"); +setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/"); $tl = new TypeLink($cid); $listtable = @trim($tl->TypeInfos['addtable']); -if( !empty($channelid) && !empty($ucid) && $tl->TypeInfos['channeltype'] != $channelid) -{ - ShowMsg('你没权限访问此页!','javascript:;'); - exit(); +if (!empty($channelid) && !empty($ucid) && $tl->TypeInfos['channeltype'] != $channelid) { + ShowMsg('你没权限访问此页!', 'javascript:;'); + exit(); } -if($cid==0) -{ +if ($cid == 0) { $row = $tl->dsql->GetOne("SELECT typename,addtable FROM `#@__channeltype` WHERE id='$channelid'"); - $positionname = $row['typename']." > "; + $positionname = $row['typename'] . " > "; $listtable = $row['addtable']; -} -else -{ - $positionname = str_replace($cfg_list_symbol, " > ", $tl->GetPositionName())." > "; +} else { + $positionname = str_replace($cfg_list_symbol, " > ", $tl->GetPositionName()) . " > "; } $optionarr = $tl->GetOptionArray($cid, $admin_catalogs, $channelid); -$whereSql = $channelid==0 ? " WHERE arc.channel < -1 " : " WHERE arc.channel = '$channelid' "; +$whereSql = $channelid == 0 ? " WHERE arc.channel < -1 " : " WHERE arc.channel = '$channelid' "; -if(!empty($mid)) $whereSql .= " AND arc.mid = '$mid' "; -if($keyword!='') $whereSql .= " AND (arc.title like '%$keyword%') "; -if($cid!=0) $whereSql .= " AND arc.typeid in (".GetSonIds($cid).")"; +if (!empty($mid)) $whereSql .= " AND arc.mid = '$mid' "; +if ($keyword != '') $whereSql .= " AND (arc.title like '%$keyword%') "; +if ($cid != 0) $whereSql .= " AND arc.typeid in (" . GetSonIds($cid) . ")"; -if($arcrank!='') -{ +if ($arcrank != '') { $whereSql .= " AND arc.arcrank = '$arcrank' "; $CheckUserSend = ""; -} -else -{ +} else { $CheckUserSend = ""; } @@ -95,7 +81,7 @@ $dlist->SetParameter("dopost", "listArchives"); $dlist->SetParameter("keyword", $keyword); $dlist->SetParameter("cid", $cid); $dlist->SetParameter("channelid", $channelid); -$dlist->SetTemplate(DEDEADMIN."/templets/content_sg_list.htm"); +$dlist->SetTemplate(DEDEADMIN . "/templets/content_sg_list.htm"); $dlist->SetSource($query); $dlist->Display(); -$dlist->Close(); \ No newline at end of file +$dlist->Close(); diff --git a/src/dede/content_tj.php b/src/dede/content_tj.php index 3f8a4171..62042f83 100755 --- a/src/dede/content_tj.php +++ b/src/dede/content_tj.php @@ -1,14 +1,15 @@ GetOne("SELECT COUNT(*) AS dd FROM `#@__arctiny` "); $row2 = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__feedback` "); @@ -23,38 +24,28 @@ $row3 = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__member` "); */ function GetArchives($dsql, $ordertype) { - $starttime = time() - (24*3600*30); - if($ordertype=='monthFeedback' ||$ordertype=='monthHot') - { + $starttime = time() - (24 * 3600 * 30); + if ($ordertype == 'monthFeedback' || $ordertype == 'monthHot') { $swhere = " where senddate>$starttime "; - } - else - { + } else { $swhere = ""; } - if(preg_match("#feedback#", $ordertype)) - { + if (preg_match("#feedback#", $ordertype)) { $ordersql = " ORDER BY scores DESC "; - } - else - { + } else { $ordersql = " ORDER BY click DESC "; } $query = "SELECT id,title,click,scores FROM #@__archives $swhere $ordersql LIMIT 0,20 "; $dsql->SetQuery($query); $dsql->Execute('ga'); - while($row = $dsql->GetObject('ga')) - { - if(preg_match("#feedback#i", $ordertype)) - { - $moreinfo = "[id}'>评论:{$row->scores}]"; - } - else - { + while ($row = $dsql->GetObject('ga')) { + if (preg_match("#feedback#i", $ordertype)) { + $moreinfo = "[id}'>评论:{$row->scores}]"; + } else { $moreinfo = "[点击:{$row->click}]"; } echo "·"; - echo cn_substr($row->title, 30)."{$moreinfo}
\r\n"; + echo cn_substr($row->title, 30) . "{$moreinfo}
\r\n"; } } -include DedeInclude('templets/content_tj.htm'); \ No newline at end of file +include DedeInclude('templets/content_tj.htm'); diff --git a/src/dede/dialog/config.php b/src/dede/dialog/config.php index fed0c2df..baa097e5 100755 --- a/src/dede/dialog/config.php +++ b/src/dede/dialog/config.php @@ -1,15 +1,16 @@ getUserID() <=0 ) -{ - if(empty($adminDirHand)) - { - ShowMsg("提示:需输入后台管理目录才能登录
请输入后台管理目录名:
", "javascript:;"); +if ($cuserLogin->getUserID() <= 0) { + if (empty($adminDirHand)) { + ShowMsg("提示:需输入后台管理目录才能登录
请输入后台管理目录名:
", "javascript:;"); exit(); } - $adminDirHand = HtmlReplace($adminDirHand, 1); - $gurl = "../../{$adminDirHand}/login.php?gotopage=".urlencode($dedeNowurl); + $adminDirHand = HtmlReplace($adminDirHand, 1); + $gurl = "../../{$adminDirHand}/login.php?gotopage=" . urlencode($dedeNowurl); echo ""; exit(); } //启用远程站点则创建FTP类 -if($cfg_remote_site=='Y') -{ - require_once(DEDEINC.'/ftp.class.php'); - if(file_exists(DEDEDATA."/cache/inc_remote_config.php")) - { - require_once DEDEDATA."/cache/inc_remote_config.php"; +if ($cfg_remote_site == 'Y') { + require_once(DEDEINC . '/ftp.class.php'); + if (file_exists(DEDEDATA . "/cache/inc_remote_config.php")) { + require_once DEDEDATA . "/cache/inc_remote_config.php"; } - if(empty($remoteuploads)) $remoteuploads = 0; - if(empty($remoteupUrl)) $remoteupUrl = ''; + if (empty($remoteuploads)) $remoteuploads = 0; + if (empty($remoteupUrl)) $remoteupUrl = ''; //初始化FTP配置 $ftpconfig = array( - 'hostname'=>$rmhost, - 'port'=>$rmport, - 'username'=>$rmname, - 'password'=>$rmpwd + 'hostname' => $rmhost, + 'port' => $rmport, + 'username' => $rmname, + 'password' => $rmpwd ); - $ftp = new FTP; + $ftp = new FTP; $ftp->connect($ftpconfig); -} \ No newline at end of file +} diff --git a/src/dede/dialog/select_images.php b/src/dede/dialog/select_images.php index 1ede957f..7f2ea329 100755 --- a/src/dede/dialog/select_images.php +++ b/src/dede/dialog/select_images.php @@ -4,7 +4,7 @@ * 图片选择框 * * @version $Id: select_images.php 1 9:43 2010年7月8日Z tianya $ - * @package DedeCMS.Dialog + * @package DedeBIZ.Dialog * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -141,77 +141,77 @@ if (!empty($noeditor)) { window.close(); } - - - + +
- - - - - - - - - - - read()) { +
预览点击名称选择图片文件大小最后修改时间
- 点击“V”预览图片,点击图片名选择图片,显示图片后点击该图片关闭预览。 -
+ + - -
+ + + + + + + + + + + read()) { - //-----计算文件大小和创建时间 - if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) { - $filesize = filesize("$inpath/$file"); - $filesize = $filesize / 1024; - if ($filesize != "") - if ($filesize < 0.1) { - @list($ty1, $ty2) = split("\.", $filesize); - $filesize = $ty1 . "." . substr($ty2, 0, 2); - } else { - @list($ty1, $ty2) = split("\.", $filesize); - $filesize = $ty1 . "." . substr($ty2, 0, 1); - } - $filetime = filemtime("$inpath/$file"); - $filetime = MyDate("Y-m-d H:i:s", $filetime); - } + //-----计算文件大小和创建时间 + if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) { + $filesize = filesize("$inpath/$file"); + $filesize = $filesize / 1024; + if ($filesize != "") + if ($filesize < 0.1) { + @list($ty1, $ty2) = split("\.", $filesize); + $filesize = $ty1 . "." . substr($ty2, 0, 2); + } else { + @list($ty1, $ty2) = split("\.", $filesize); + $filesize = $ty1 . "." . substr($ty2, 0, 1); + } + $filetime = filemtime("$inpath/$file"); + $filetime = MyDate("Y-m-d H:i:s", $filetime); + } - if ($file == ".") continue; - else if ($file == "..") { - if ($activepath == "") continue; - $tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath); - $line = "\n + if ($file == ".") continue; + else if ($file == "..") { + if ($activepath == "") continue; + $tmp = preg_replace("#[\/][^\/]*$#i", "", $activepath); + $line = "\n "; - echo $line; - } else if (is_dir("$inpath/$file")) { - if (preg_match("#^_(.*)$#i", $file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录 - if (preg_match("#^\.(.*)$#i", $file)) continue; - $line = "\n + echo $line; + } else if (is_dir("$inpath/$file")) { + if (preg_match("#^_(.*)$#i", $file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录 + if (preg_match("#^\.(.*)$#i", $file)) continue; + $line = "\n"; - echo "$line"; - } else if (preg_match("#\.(" . $cfg_imgtype . ")#i", $file)) { - $reurl = "$activeurl/$file"; - $reurl = preg_replace("#^\.\.#", "", $reurl); - if ($cfg_remote_site == 'Y' && $remoteuploads == 1) { - $reurl = $remoteupUrl . $reurl; - } else { - $reurl = $reurl; - } + echo "$line"; + } else if (preg_match("#\.(" . $cfg_imgtype . ")#i", $file)) { + $reurl = "$activeurl/$file"; + $reurl = preg_replace("#^\.\.#", "", $reurl); + if ($cfg_remote_site == 'Y' && $remoteuploads == 1) { + $reurl = $remoteupUrl . $reurl; + } else { + $reurl = $reurl; + } - if ($file == $comeback) $lstyle = " style='color:red' "; - else $lstyle = ""; + if ($file == $comeback) $lstyle = " style='color:red' "; + else $lstyle = ""; - $line = "\n + $line = "\n @@ -220,20 +220,20 @@ if (!empty($noeditor)) { "; - echo "$line"; - } else if (preg_match("#\.(jpg)#i", $file)) { - $reurl = "$activeurl/$file"; - $reurl = preg_replace("#^\.\.#", "", $reurl); - if ($cfg_remote_site == 'Y' && $remoteuploads == 1) { - $reurl = $remoteupUrl . $reurl; - } else { - $reurl = $reurl; - } + echo "$line"; + } else if (preg_match("#\.(jpg)#i", $file)) { + $reurl = "$activeurl/$file"; + $reurl = preg_replace("#^\.\.#", "", $reurl); + if ($cfg_remote_site == 'Y' && $remoteuploads == 1) { + $reurl = $remoteupUrl . $reurl; + } else { + $reurl = $reurl; + } - if ($file == $comeback) $lstyle = " style='color:red' "; - else $lstyle = ""; + if ($file == $comeback) $lstyle = " style='color:red' "; + else $lstyle = ""; - $line = "\n + $line = "\n @@ -243,42 +243,42 @@ if (!empty($noeditor)) { "; - echo "$line"; - } - } //End Loop - $dh->close(); - ?> - - + - -
预览点击名称选择图片文件大小最后修改时间
+ 点击“V”预览图片,点击图片名选择图片,显示图片后点击该图片关闭预览。 +
上级目录 当前目录:$activepath
$file    
$filesize KB $filetime
$filesize KB $filetime
- - - " : ''; - echo $noeditor; ?> - - - - - - - - - - -
-  上 传: - - - 宽: - 高: - -
+ echo "$line"; + } + } //End Loop + $dh->close(); + ?> +
+ + + " : ''; + echo $noeditor; ?> + + + + + + + + + + +
+  上 传: + + + 宽: + 高: + +
-
-
+
+ + + \ No newline at end of file diff --git a/src/dede/dialog/select_images_post.php b/src/dede/dialog/select_images_post.php index b6dae17e..d6c11792 100755 --- a/src/dede/dialog/select_images_post.php +++ b/src/dede/dialog/select_images_post.php @@ -1,121 +1,108 @@ <\|\":]{1,}#", '', $imgfile_name)); -if(!preg_match("#\.(".$cfg_imgtype.")#i", $imgfile_name)) -{ +if (!preg_match("#\.(" . $cfg_imgtype . ")#i", $imgfile_name)) { ShowMsg("你所上传的图片类型不在许可列表,请更改系统对扩展名限定的配置!", "-1"); exit(); } $nowtme = time(); -$sparr = Array("image/pjpeg", "image/jpeg", "image/gif", "image/png", "image/xpng", "image/wbmp"); +$sparr = array("image/pjpeg", "image/jpeg", "image/gif", "image/png", "image/xpng", "image/wbmp"); $imgfile_type = strtolower(trim($imgfile_type)); -if(!in_array($imgfile_type, $sparr)) -{ - ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG、WBMP格式的其中一种!","-1"); +if (!in_array($imgfile_type, $sparr)) { + ShowMsg("上传的图片格式错误,请使用JPEG、GIF、PNG、WBMP格式的其中一种!", "-1"); exit(); } $mdir = MyDate($cfg_addon_savetype, $nowtme); -if(!is_dir($cfg_basedir.$activepath."/$mdir")) -{ - MkdirAll($cfg_basedir.$activepath."/$mdir",$cfg_dir_purview); +if (!is_dir($cfg_basedir . $activepath . "/$mdir")) { + MkdirAll($cfg_basedir . $activepath . "/$mdir", $cfg_dir_purview); CloseFtp(); } -$filename_name = $cuserLogin->getUserID().'-'.dd2char(MyDate("ymdHis", $nowtme).mt_rand(100,999)); -$filename = $mdir.'/'.$filename_name; +$filename_name = $cuserLogin->getUserID() . '-' . dd2char(MyDate("ymdHis", $nowtme) . mt_rand(100, 999)); +$filename = $mdir . '/' . $filename_name; $fs = explode('.', $imgfile_name); -$filename = $filename.'.'.$fs[count($fs)-1]; -$filename_name = $filename_name.'.'.$fs[count($fs)-1]; -$fullfilename = $cfg_basedir.$activepath."/".$filename; +$filename = $filename . '.' . $fs[count($fs) - 1]; +$filename_name = $filename_name . '.' . $fs[count($fs) - 1]; +$fullfilename = $cfg_basedir . $activepath . "/" . $filename; move_uploaded_file($imgfile, $fullfilename) or die("上传文件到 $fullfilename 失败!"); -if($cfg_remote_site=='Y' && $remoteuploads == 1) -{ +if ($cfg_remote_site == 'Y' && $remoteuploads == 1) { //分析远程文件路径 $remotefile = str_replace(DEDEROOT, '', $fullfilename); - $localfile = '../..'.$remotefile; + $localfile = '../..' . $remotefile; //创建远程文件夹 $remotedir = preg_replace('/[^\/]*\.(jpg|gif|bmp|png)/', '', $remotefile); $ftp->rmkdir($remotedir); $ftp->upload($localfile, $remotefile); } @unlink($imgfile); -if(empty($resize)) -{ +if (empty($resize)) { $resize = 0; } -if($resize==1) -{ - if(in_array($imgfile_type, $cfg_photo_typenames)) - { +if ($resize == 1) { + if (in_array($imgfile_type, $cfg_photo_typenames)) { ImageResize($fullfilename, $iwidth, $iheight); } -} -else -{ - if(in_array($imgfile_type, $cfg_photo_typenames)) - { +} else { + if (in_array($imgfile_type, $cfg_photo_typenames)) { WaterImg($fullfilename, 'up'); } } $info = ''; -$sizes[0] = 0; $sizes[1] = 0; +$sizes[0] = 0; +$sizes[1] = 0; $sizes = getimagesize($fullfilename, $info); $imgwidthValue = $sizes[0]; $imgheightValue = $sizes[1]; $imgsize = filesize($fullfilename); $inquery = "INSERT INTO `#@__uploads`(arcid,title,url,mediatype,width,height,playtime,filesize,uptime,mid) - VALUES ('0','$filename','".$activepath."/".$filename."','1','$imgwidthValue','$imgheightValue','0','{$imgsize}','{$nowtme}','".$cuserLogin->getUserID()."'); "; + VALUES ('0','$filename','" . $activepath . "/" . $filename . "','1','$imgwidthValue','$imgheightValue','0','{$imgsize}','{$nowtme}','" . $cuserLogin->getUserID() . "'); "; $dsql->ExecuteNoneQuery($inquery); $fid = $dsql->GetLastID(); -AddMyAddon($fid, $activepath.'/'.$filename); -$CKUpload = isset($CKUpload)? $CKUpload : FALSE; -if ($GLOBALS['cfg_html_editor']=='ckeditor' && $CKUpload) -{ - $fileurl = $activepath.'/'.$filename; - $result = array('url' => $fileurl,"uploaded"=>1,'fileName'=>$filename); +AddMyAddon($fid, $activepath . '/' . $filename); +$CKUpload = isset($CKUpload) ? $CKUpload : FALSE; +if ($GLOBALS['cfg_html_editor'] == 'ckeditor' && $CKUpload) { + $fileurl = $activepath . '/' . $filename; + $result = array('url' => $fileurl, "uploaded" => 1, 'fileName' => $filename); echo json_encode($result); exit; } -if(!empty($noeditor)){ - ShowMsg("成功上传一幅图片!","select_images.php?imgstick=$imgstick&comeback=".urlencode($filename_name)."&v=$v&f=$f&CKEditorFuncNum=$CKEditorFuncNum&noeditor=yes&activepath=".urlencode($activepath)."/$mdir&d=".time()); -}else{ - ShowMsg("成功上传一幅图片!","select_images.php?imgstick=$imgstick&comeback=".urlencode($filename_name)."&v=$v&f=$f&CKEditorFuncNum=$CKEditorFuncNum&activepath=".urlencode($activepath)."/$mdir&d=".time()); +if (!empty($noeditor)) { + ShowMsg("成功上传一幅图片!", "select_images.php?imgstick=$imgstick&comeback=" . urlencode($filename_name) . "&v=$v&f=$f&CKEditorFuncNum=$CKEditorFuncNum&noeditor=yes&activepath=" . urlencode($activepath) . "/$mdir&d=" . time()); +} else { + ShowMsg("成功上传一幅图片!", "select_images.php?imgstick=$imgstick&comeback=" . urlencode($filename_name) . "&v=$v&f=$f&CKEditorFuncNum=$CKEditorFuncNum&activepath=" . urlencode($activepath) . "/$mdir&d=" . time()); } -exit(); \ No newline at end of file +exit(); diff --git a/src/dede/dialog/select_media.php b/src/dede/dialog/select_media.php index 026741ad..772ec78b 100755 --- a/src/dede/dialog/select_media.php +++ b/src/dede/dialog/select_media.php @@ -4,7 +4,7 @@ * 多媒体选择框 * * @version $Id: select_media.php 1 9:43 2010年7月8日Z tianya $ - * @package DedeCMS.Dialog + * @package DedeBIZ.Dialog * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/dede/dialog/select_media_post.php b/src/dede/dialog/select_media_post.php index 3fa7252e..468a2678 100755 --- a/src/dede/dialog/select_media_post.php +++ b/src/dede/dialog/select_media_post.php @@ -4,7 +4,7 @@ * 多媒体发送 * * @version $Id: select_media_post.php 1 9:43 2010年7月8日Z tianya $ - * @package DedeCMS.Dialog + * @package DedeBIZ.Dialog * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/dede/dialog/select_soft.php b/src/dede/dialog/select_soft.php index c9a60826..001a37f3 100755 --- a/src/dede/dialog/select_soft.php +++ b/src/dede/dialog/select_soft.php @@ -4,7 +4,7 @@ * 软件选择框 * * @version $Id: select_soft.php 1 9:43 2010年7月8日Z tianya $ - * @package DedeCMS.Dialog + * @package DedeBIZ.Dialog * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/dede/dialog/select_soft_post.php b/src/dede/dialog/select_soft_post.php index 12c6c5f4..93c312c5 100755 --- a/src/dede/dialog/select_soft_post.php +++ b/src/dede/dialog/select_soft_post.php @@ -4,7 +4,7 @@ * 软件发送 * * @version $Id: select_soft_post.php 1 9:43 2010年7月8日Z tianya $ - * @package DedeCMS.Dialog + * @package DedeBIZ.Dialog * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/dede/dialog/select_templets.php b/src/dede/dialog/select_templets.php index 3ba44af6..68ce88b2 100755 --- a/src/dede/dialog/select_templets.php +++ b/src/dede/dialog/select_templets.php @@ -4,7 +4,7 @@ * 模板选择框 * * @version $Id: select_templets.php 1 9:43 2010年7月8日Z tianya $ - * @package DedeCMS.Dialog + * @package DedeBIZ.Dialog * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -59,187 +59,187 @@ if (empty($comeback)) { window.close(); } - - - - - - - - read()) { - //-----计算文件大小和创建时间 - if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) { - $filesize = filesize("$inpath/$file"); - $filesize = $filesize / 1024; - if ($filesize != "") - if ($filesize < 0.1) { - @list($ty1, $ty2) = split("\.", $filesize); - $filesize = $ty1 . "." . substr($ty2, 0, 2); - } else { - @list($ty1, $ty2) = split("\.", $filesize); - $filesize = $ty1 . "." . substr($ty2, 0, 1); - } - $filetime = filemtime("$inpath/$file"); - $filetime = MyDate("Y-m-d H:i:s", $filetime); - } - - //------判断文件类型并作处理 - if ($file == ".") continue; - else if ($file == "..") { - if ($activepath == "") continue; - $tmp = preg_replace("#[\/][^\/]*$#", "", $activepath); - $line = "\n + +
点击名称选择文件文件大小最后修改时间
+ + + + + + read()) { + //-----计算文件大小和创建时间 + if ($file != "." && $file != ".." && !is_dir("$inpath/$file")) { + $filesize = filesize("$inpath/$file"); + $filesize = $filesize / 1024; + if ($filesize != "") + if ($filesize < 0.1) { + @list($ty1, $ty2) = split("\.", $filesize); + $filesize = $ty1 . "." . substr($ty2, 0, 2); + } else { + @list($ty1, $ty2) = split("\.", $filesize); + $filesize = $ty1 . "." . substr($ty2, 0, 1); + } + $filetime = filemtime("$inpath/$file"); + $filetime = MyDate("Y-m-d H:i:s", $filetime); + } + + //------判断文件类型并作处理 + if ($file == ".") continue; + else if ($file == "..") { + if ($activepath == "") continue; + $tmp = preg_replace("#[\/][^\/]*$#", "", $activepath); + $line = "\n\r\n"; - echo $line; - } else if (is_dir("$inpath/$file")) { - if (preg_match("#^_(.*)$#i", $file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录 - if (preg_match("#^\.(.*)$#i", $file)) continue; - $line = "\n + echo $line; + } else if (is_dir("$inpath/$file")) { + if (preg_match("#^_(.*)$#i", $file)) continue; #屏蔽FrontPage扩展目录和linux隐蔽目录 + if (preg_match("#^\.(.*)$#i", $file)) continue; + $line = "\n"; - echo "$line"; - } else if (preg_match("#\.(htm|html)#i", $file)) { + echo "$line"; + } else if (preg_match("#\.(htm|html)#i", $file)) { - if ($file == $comeback) $lstyle = " style='color:red' "; - else $lstyle = ""; + if ($file == $comeback) $lstyle = " style='color:red' "; + else $lstyle = ""; - $reurl = "$activeurl/$file"; + $reurl = "$activeurl/$file"; - $reurl = preg_replace("#\.\.#", "", $reurl); - $reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl); + $reurl = preg_replace("#\.\.#", "", $reurl); + $reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl); - $line = "\n + $line = "\n"; - echo "$line"; - } else if (preg_match("#\.(css)#i", $file)) { - if ($file == $comeback) $lstyle = " style='color:red' "; - else $lstyle = ""; + echo "$line"; + } else if (preg_match("#\.(css)#i", $file)) { + if ($file == $comeback) $lstyle = " style='color:red' "; + else $lstyle = ""; - $reurl = "$activeurl/$file"; + $reurl = "$activeurl/$file"; - $reurl = preg_replace("#\.\.#", "", $reurl); - $reurl = preg_replace("#" . $templetdir . "/#", "", $reurl); + $reurl = preg_replace("#\.\.#", "", $reurl); + $reurl = preg_replace("#" . $templetdir . "/#", "", $reurl); - $line = "\n + $line = "\n"; - echo "$line"; - } else if (preg_match("#\.(js)#i", $file)) { - if ($file == $comeback) $lstyle = " style='color:red' "; - else $lstyle = ""; + echo "$line"; + } else if (preg_match("#\.(js)#i", $file)) { + if ($file == $comeback) $lstyle = " style='color:red' "; + else $lstyle = ""; - $reurl = "$activeurl/$file"; + $reurl = "$activeurl/$file"; - $reurl = preg_replace("#\.\.#", "", $reurl); - $reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl); + $reurl = preg_replace("#\.\.#", "", $reurl); + $reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl); - $line = "\n + $line = "\n"; - echo "$line"; - } else if (preg_match("#\.(jpg)#i", $file)) { - if ($file == $comeback) $lstyle = " style='color:red' "; - else $lstyle = ""; + echo "$line"; + } else if (preg_match("#\.(jpg)#i", $file)) { + if ($file == $comeback) $lstyle = " style='color:red' "; + else $lstyle = ""; - $reurl = "$activeurl/$file"; + $reurl = "$activeurl/$file"; - $reurl = preg_replace("#\.\.#", "", $reurl); - $reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl); + $reurl = preg_replace("#\.\.#", "", $reurl); + $reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl); - $line = "\n + $line = "\n"; - echo "$line"; - } else if (preg_match("#\.(gif|png)#i", $file)) { + echo "$line"; + } else if (preg_match("#\.(gif|png)#i", $file)) { - if ($file == $comeback) $lstyle = " style='color:red' "; - else $lstyle = ""; + if ($file == $comeback) $lstyle = " style='color:red' "; + else $lstyle = ""; - $reurl = "$activeurl/$file"; + $reurl = "$activeurl/$file"; - $reurl = preg_replace("#\.\.#", "", $reurl); - $reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl); + $reurl = preg_replace("#\.\.#", "", $reurl); + $reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl); - $line = "\n + $line = "\n"; - echo "$line"; - } else if (preg_match("#\.(txt)#i", $file)) { + echo "$line"; + } else if (preg_match("#\.(txt)#i", $file)) { - if ($file == $comeback) $lstyle = " style='color:red' "; - else $lstyle = ""; + if ($file == $comeback) $lstyle = " style='color:red' "; + else $lstyle = ""; - $reurl = "$activeurl/$file"; + $reurl = "$activeurl/$file"; - $reurl = preg_replace("#\.\.#", "", $reurl); - $reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl); + $reurl = preg_replace("#\.\.#", "", $reurl); + $reurl = preg_replace("#" . $templetdir . "\/#", "", $reurl); - $line = "\n + $line = "\n"; - echo "$line"; - } - } //End Loop - $dh->close(); - ?> - - - - + echo "$line"; + } + } //End Loop + $dh->close(); + ?> + + + + +
点击名称选择文件文件大小最后修改时间
上级目录 当前目录:$activepath
$file - -
$file $filesize KB $filetime
$file $filesize KB $filetime
$file $filesize KB $filetime
$file $filesize KB $filetime
$file $filesize KB $filetime
$file $filesize KB $filetime
- - - - - - - - - - -
-  上 传: - 改名: - -
- -
+ + + + + + + + + +
+  上 传: + 改名: + +
+
+ \ No newline at end of file diff --git a/src/dede/dialog/select_templets_post.php b/src/dede/dialog/select_templets_post.php index 22db685d..9fdec0e2 100755 --- a/src/dede/dialog/select_templets_post.php +++ b/src/dede/dialog/select_templets_post.php @@ -1,51 +1,44 @@ <\|\":]{1,}#", '', $filename)); -} -else -{ +} else { $uploadfile_name = trim(preg_replace("#[ \r\n\t\*\%\\\/\?><\|\":]{1,}#", '', $uploadfile_name)); $filename = $uploadfile_name; - if($filename=='' || !preg_match("#\.(".$cfg_txttype.")#i", $filename)) - { - ShowMsg("你所上传的文件存在问题,请检查文件类型是否适合!","-1"); + if ($filename == '' || !preg_match("#\.(" . $cfg_txttype . ")#i", $filename)) { + ShowMsg("你所上传的文件存在问题,请检查文件类型是否适合!", "-1"); exit(); } } -$fullfilename = $cfg_basedir.$activepath."/".$filename; -move_uploaded_file($uploadfile,$fullfilename) or die("上传文件到 $fullfilename 失败!"); +$fullfilename = $cfg_basedir . $activepath . "/" . $filename; +move_uploaded_file($uploadfile, $fullfilename) or die("上传文件到 $fullfilename 失败!"); @unlink($uploadfile); -ShowMsg("成功上传文件!","select_templets.php?comeback=".urlencode($filename)."&f=$f&activepath=".urlencode($activepath)."&d=".time()); -exit(); \ No newline at end of file +ShowMsg("成功上传文件!", "select_templets.php?comeback=" . urlencode($filename) . "&f=$f&activepath=" . urlencode($activepath) . "&d=" . time()); +exit(); diff --git a/src/dede/diy_add.php b/src/dede/diy_add.php index b3bdf35e..ebd0c265 100755 --- a/src/dede/diy_add.php +++ b/src/dede/diy_add.php @@ -1,53 +1,46 @@ GetVersion(); -$mysql_versions = explode(".",trim($mysql_version)); -$mysql_version = $mysql_versions[0].".".$mysql_versions[1]; -if(empty($action)) -{ +$mysql_versions = explode(".", trim($mysql_version)); +$mysql_version = $mysql_versions[0] . "." . $mysql_versions[1]; +if (empty($action)) { $row = $dsql->GetOne("SELECT diyid FROM #@__diyforms ORDER BY diyid DESC LIMIT 0,1 "); - if(is_array($row)) $newdiyid = $row['diyid']+1; + if (is_array($row)) $newdiyid = $row['diyid'] + 1; else $newdiyid = 1; - include(DEDEADMIN."/templets/diy_add.htm"); -} -else -{ - if(preg_match("#[^0-9-]#", $diyid) || empty($diyid)) - { - ShowMsg("'自定义表单diyid'必须为数字!","-1"); + include(DEDEADMIN . "/templets/diy_add.htm"); +} else { + if (preg_match("#[^0-9-]#", $diyid) || empty($diyid)) { + ShowMsg("'自定义表单diyid'必须为数字!", "-1"); exit(); } - if($table=="") - { + if ($table == "") { ShowMsg("表名不能为空!", "-1"); exit(); } $public = isset($public) && is_numeric($public) ? $public : 0; $name = dede_htmlspecialchars($name); $row = $dsql->GetOne("SELECT * FROM #@__diyforms WHERE diyid='$diyid' OR `table` LIKE '$table' OR name LIKE '$name' "); - if(is_array($row)) - { - ShowMsg("可能自定义表单的‘diyid’、‘名称’在数据库中已存在,不能重复使用!","-1"); + if (is_array($row)) { + ShowMsg("可能自定义表单的‘diyid’、‘名称’在数据库中已存在,不能重复使用!", "-1"); exit(); } $query = "SHOW TABLES FROM {$dsql->dbName} "; $dsql->SetQuery($query); $dsql->Execute(); - while($row = $dsql->getarray()) - { - if(empty($row[0])) $row[0] = ''; - if($table == $row[0]) - { + while ($row = $dsql->getarray()) { + if (empty($row[0])) $row[0] = ''; + if ($table == $row[0]) { showmsg('指定的表在数据库中重复', '-1'); exit(); } @@ -56,22 +49,16 @@ else `id` int(10) unsigned NOT NULL auto_increment, `ifcheck` tinyint(1) NOT NULL default '0', "; - if($mysql_version < 4.1) - { + if ($mysql_version < 4.1) { $sql .= " PRIMARY KEY (`id`)\r\n) TYPE=MyISAM; "; + } else { + $sql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=" . $cfg_db_language . "; "; } - else - { - $sql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; "; - } - if($dsql->ExecuteNoneQuery($sql)) - { + if ($dsql->ExecuteNoneQuery($sql)) { $query = "INSERT INTO #@__diyforms (`diyid`, `name`, `table`, `info`, `listtemplate`, `viewtemplate`, `posttemplate`, `public` ) VALUES ('$diyid', '$name', '$table', '', '$listtemplate', '$viewtemplate', '$posttemplate', '$public')"; $dsql->ExecuteNoneQuery($query); showmsg('自定义表单创建成功,请自行添加字段', 'diy_main.php'); - } - else - { + } else { showmsg('自定义表单创建失败', '-1'); } -} \ No newline at end of file +} diff --git a/src/dede/diy_edit.php b/src/dede/diy_edit.php index 78a0633b..5aaffbde 100755 --- a/src/dede/diy_edit.php +++ b/src/dede/diy_edit.php @@ -1,46 +1,43 @@ ExecuteNoneQuery($query); - ShowMsg("成功更改一个自定义表单!","diy_main.php"); + ShowMsg("成功更改一个自定义表单!", "diy_main.php"); exit(); } /*---------------- function __Delete() ------------------*/ -else if($dopost=="delete") -{ +-----------------*/ else if ($dopost == "delete") { @set_time_limit(0); CheckPurview('c_Del'); $row = $dsql->GetOne("SELECT * FROM #@__diyforms WHERE diyid='$diyid'"); - if(empty($job)) $job = ""; + if (empty($job)) $job = ""; //确认提示 - if($job=="") - { + if ($job == "") { $wintitle = "自定义表单管理-删除自定义表单"; $wecome_info = "自定义表单管理::删除自定义表单"; $win = new OxWindow(); @@ -48,19 +45,17 @@ else if($dopost=="delete") $win->AddHidden("job", "yes"); $win->AddHidden("dopost", $dopost); $win->AddHidden("diyid", $diyid); - $win->AddTitle("!将删除所有与该自定义表单相关的文件和数据
你确实要删除 \"".$row['name']."\" 这个自定义表单?"); + $win->AddTitle("!将删除所有与该自定义表单相关的文件和数据
你确实要删除 \"" . $row['name'] . "\" 这个自定义表单?"); $winform = $win->GetWindow("ok"); $win->Display(); exit(); } //操作 - else if($job=="yes") - { - $row = $dsql->GetOne("SELECT `table` FROM `#@__diyforms` WHERE diyid='$diyid'",MYSQL_ASSOC); - if(!is_array($row)) - { - ShowMsg("你所指定的自定义表单信息不存在!","-1"); + else if ($job == "yes") { + $row = $dsql->GetOne("SELECT `table` FROM `#@__diyforms` WHERE diyid='$diyid'", MYSQL_ASSOC); + if (!is_array($row)) { + ShowMsg("你所指定的自定义表单信息不存在!", "-1"); exit(); } @@ -69,7 +64,7 @@ else if($dopost=="delete") //删除频道配置信息 $dsql->ExecuteNoneQuery("DELETE FROM `#@__diyforms` WHERE diyid='$diyid'"); - ShowMsg("成功删除一个自定义表单!","diy_main.php"); + ShowMsg("成功删除一个自定义表单!", "diy_main.php"); exit(); } } @@ -78,4 +73,4 @@ else if($dopost=="delete") function edit() -----------------*/ $row = $dsql->GetOne("Select * From #@__diyforms where diyid='$diyid'"); -include DEDEADMIN."/templets/diy_edit.htm"; \ No newline at end of file +include DEDEADMIN . "/templets/diy_edit.htm"; diff --git a/src/dede/diy_field_add.php b/src/dede/diy_field_add.php index b65582ed..25271b2d 100755 --- a/src/dede/diy_field_add.php +++ b/src/dede/diy_field_add.php @@ -1,87 +1,80 @@ GetVersion(); -$mysql_versions = explode(".",trim($mysql_version)); -$mysql_version = $mysql_versions[0].".".$mysql_versions[1]; +$mysql_versions = explode(".", trim($mysql_version)); +$mysql_version = $mysql_versions[0] . "." . $mysql_versions[1]; /*---------------------- function Save() ---------------------*/ -if($action=='save') -{ +if ($action == 'save') { //模型信息 $fieldname = strtolower($fieldname); $row = $dsql->GetOne("SELECT `table`,`info` FROM #@__diyforms WHERE diyid='$diyid'"); $fieldset = $row['info']; - require_once(DEDEINC."/dedetag.class.php"); + require_once(DEDEINC . "/dedetag.class.php"); $dtp = new DedeTagParse(); - $dtp->SetNameSpace("field","<",">"); + $dtp->SetNameSpace("field", "<", ">"); $dtp->LoadSource($fieldset); $trueTable = $row['table']; //修改字段配置信息 $dfvalue = trim($vdefault); - $isnull = ($isnull==1 ? "true" : "false"); + $isnull = ($isnull == 1 ? "true" : "false"); $mxlen = $maxlength; //检测被修改的字段类型 - $fieldinfos = GetFieldMake($dtype,$fieldname,$dfvalue,$mxlen); + $fieldinfos = GetFieldMake($dtype, $fieldname, $dfvalue, $mxlen); $ntabsql = $fieldinfos[0]; $buideType = $fieldinfos[1]; $rs = $dsql->ExecuteNoneQuery(" ALTER TABLE `$trueTable` ADD $ntabsql "); - if(!$rs) - { + if (!$rs) { $gerr = $dsql->GetError(); - ShowMsg("增加字段失败,错误提示为:".$gerr,"javascript:;"); + ShowMsg("增加字段失败,错误提示为:" . $gerr, "javascript:;"); exit(); } $ok = FALSE; //检测旧配置信息,并替换为新配置 - if(is_array($dtp->CTags)) - { + if (is_array($dtp->CTags)) { //遍历旧配置 - foreach($dtp->CTags as $tagid=>$ctag) - { - if($fieldname == strtolower($ctag->GetName())) - { - $dtp->Assign($tagid,stripslashes($fieldstring), FALSE); + foreach ($dtp->CTags as $tagid => $ctag) { + if ($fieldname == strtolower($ctag->GetName())) { + $dtp->Assign($tagid, stripslashes($fieldstring), FALSE); $ok = TRUE; break; } } - $oksetting = $ok ? $dtp->GetResultNP() : $fieldset."\n".stripslashes($fieldstring); - } - else - { + $oksetting = $ok ? $dtp->GetResultNP() : $fieldset . "\n" . stripslashes($fieldstring); + } else { //原来的配置为空 - $oksetting = $fieldset."\n".stripslashes($fieldstring); + $oksetting = $fieldset . "\n" . stripslashes($fieldstring); } - $addlist = GetAddFieldList($dtp,$oksetting); + $addlist = GetAddFieldList($dtp, $oksetting); $oksetting = addslashes($oksetting); $rs = $dsql->ExecuteNoneQuery("Update #@__diyforms set `info`='$oksetting' where diyid='$diyid' "); - if(!$rs) - { + if (!$rs) { $grr = $dsql->GetError(); - ShowMsg("保存节点配置出错!".$grr,"javascript:;"); + ShowMsg("保存节点配置出错!" . $grr, "javascript:;"); exit(); } - ShowMsg("成功增加一个字段!","diy_edit.php?diyid=$diyid"); + ShowMsg("成功增加一个字段!", "diy_edit.php?diyid=$diyid"); exit(); } @@ -95,13 +88,10 @@ $tabsql = "CREATE TABLE IF NOT EXISTS `$trueTable`( `id` int(10) unsigned NOT NULL auto_increment, `ifcheck` tinyint(1) NOT NULL default '0', "; -if($mysql_version < 4.1) -{ +if ($mysql_version < 4.1) { $tabsql .= " PRIMARY KEY (`id`)\r\n) TYPE=MyISAM; "; -} -else -{ - $tabsql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; "; +} else { + $tabsql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=" . $cfg_db_language . "; "; } $dsql->ExecuteNoneQuery($tabsql); @@ -109,13 +99,11 @@ $dsql->ExecuteNoneQuery($tabsql); $fields = array(); $rs = $dsql->SetQuery("show fields from `$trueTable`"); $dsql->Execute('a'); -while($nrow = $dsql->GetArray('a',MYSQL_ASSOC)) -{ +while ($nrow = $dsql->GetArray('a', MYSQL_ASSOC)) { $fields[strtolower($nrow['Field'])] = 1; } $f = ''; -foreach($fields as $k=>$v) -{ - $f .= ($f=='' ? $k : ' '.$k); +foreach ($fields as $k => $v) { + $f .= ($f == '' ? $k : ' ' . $k); } -require_once(DEDEADMIN."/templets/diy_field_add.htm"); \ No newline at end of file +require_once(DEDEADMIN . "/templets/diy_field_add.htm"); diff --git a/src/dede/diy_field_edit.php b/src/dede/diy_field_edit.php index 4840d6c5..923588f0 100755 --- a/src/dede/diy_field_edit.php +++ b/src/dede/diy_field_edit.php @@ -1,41 +1,40 @@ GetVersion(); -$mysql_versions = explode(".",trim($mysql_version)); -$mysql_version = $mysql_versions[0].".".$mysql_versions[1]; +$mysql_versions = explode(".", trim($mysql_version)); +$mysql_version = $mysql_versions[0] . "." . $mysql_versions[1]; $row = $dsql->GetOne("SELECT `table`,`info` FROM #@__diyforms WHERE diyid='$diyid'"); $fieldset = $row['info']; $trueTable = $row['table']; $dtp = new DedeTagParse(); -$dtp->SetNameSpace("field","<",">"); +$dtp->SetNameSpace("field", "<", ">"); $dtp->LoadSource($fieldset); -foreach($dtp->CTags as $ctag) -{ - if(strtolower($ctag->GetName())==strtolower($fname)) break; +foreach ($dtp->CTags as $ctag) { + if (strtolower($ctag->GetName()) == strtolower($fname)) break; } //字段类型信息 -$ds = file(DEDEADMIN."/inc/fieldtype.txt"); -foreach($ds as $d) -{ - $dds = explode(',',trim($d)); +$ds = file(DEDEADMIN . "/inc/fieldtype.txt"); +foreach ($ds as $d) { + $dds = explode(',', trim($d)); $fieldtypes[$dds[0]] = $dds[1]; } @@ -43,12 +42,10 @@ foreach($ds as $d) /*-------------------- function _SAVE() ----------------------*/ -if($action=='save') -{ +if ($action == 'save') { - if(!isset($fieldtypes[$dtype])) - { - ShowMsg("你修改的是系统专用类型的数据,禁止操作!","-1"); + if (!isset($fieldtypes[$dtype])) { + ShowMsg("你修改的是系统专用类型的数据,禁止操作!", "-1"); exit(); } @@ -57,13 +54,10 @@ if($action=='save') `id` int(10) unsigned NOT NULL auto_increment, `ifcheck` tinyint(1) NOT NULL default '0', "; - if($mysql_version < 4.1) - { + if ($mysql_version < 4.1) { $tabsql .= " PRIMARY KEY (`id`)\r\n) TYPE=MyISAM; "; - } - else - { - $tabsql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; "; + } else { + $tabsql .= " PRIMARY KEY (`id`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=" . $cfg_db_language . "; "; } $dsql->ExecuteNoneQuery($tabsql); @@ -71,71 +65,59 @@ if($action=='save') $fields = array(); $rs = $dsql->SetQuery("show fields from `$trueTable`"); $dsql->Execute('a'); - while($nrow = $dsql->GetArray('a',MYSQL_ASSOC)) - { - $fields[ strtolower($nrow['Field']) ] = $nrow['Type']; + while ($nrow = $dsql->GetArray('a', MYSQL_ASSOC)) { + $fields[strtolower($nrow['Field'])] = $nrow['Type']; } //修改字段配置信息 $dfvalue = $vdefault; - $isnull = ($isnull==1 ? "true" : "false"); + $isnull = ($isnull == 1 ? "true" : "false"); $mxlen = $maxlength; $fieldname = strtolower($fname); //检测被修改的字段类型,并更新数据表 - $fieldinfos = GetFieldMake($dtype,$fieldname,$dfvalue,$mxlen); + $fieldinfos = GetFieldMake($dtype, $fieldname, $dfvalue, $mxlen); $ntabsql = $fieldinfos[0]; $buideType = $fieldinfos[1]; $tabsql = ''; //检测旧数据类型,并替换为新配置 - foreach($dtp->CTags as $tagid=>$ctag) - { - if(trim($fieldname)==trim(strtolower($ctag->GetName()))) - { + foreach ($dtp->CTags as $tagid => $ctag) { + if (trim($fieldname) == trim(strtolower($ctag->GetName()))) { - if(isset($fields[$fieldname]) && $fields[$fieldname]!=$buideType) - { - $tabsql = "ALTER TABLE `$trueTable` CHANGE `$fieldname` ".$ntabsql; + if (isset($fields[$fieldname]) && $fields[$fieldname] != $buideType) { + $tabsql = "ALTER TABLE `$trueTable` CHANGE `$fieldname` " . $ntabsql; $dsql->ExecuteNoneQuery($tabsql); - } - else if(!isset($fields[$fieldname])) - { - $tabsql = "ALTER TABLE `$trueTable` ADD ".$ntabsql; + } else if (!isset($fields[$fieldname])) { + $tabsql = "ALTER TABLE `$trueTable` ADD " . $ntabsql; $dsql->ExecuteNoneQuery($tabsql); - } - else - { + } else { $tabsql = ''; } - $dtp->Assign($tagid,stripslashes($fieldstring), FALSE); + $dtp->Assign($tagid, stripslashes($fieldstring), FALSE); break; } } $oksetting = $dtp->GetResultNP(); $oksetting = addslashes($oksetting); $dsql->ExecuteNoneQuery("UPDATE #@__diyforms SET info='$oksetting' WHERE diyid='$diyid' "); - ShowMsg("成功更改一个字段的配置!","diy_edit.php?diyid={$diyid}"); + ShowMsg("成功更改一个字段的配置!", "diy_edit.php?diyid={$diyid}"); exit(); } /*------------------ 删除字段 function _DELETE() --------------------*/ -else if($action=="delete") -{ +-------------------*/ else if ($action == "delete") { //检测旧数据类型,并替换为新配置 - foreach($dtp->CTags as $tagid=>$ctag) - { - if(strtolower($ctag->GetName())==strtolower($fname)) - { - $dtp->Assign($tagid,"#@Delete@#"); + foreach ($dtp->CTags as $tagid => $ctag) { + if (strtolower($ctag->GetName()) == strtolower($fname)) { + $dtp->Assign($tagid, "#@Delete@#"); } } $oksetting = addslashes($dtp->GetResultNP()); $dsql->ExecuteNoneQuery("UPDATE #@__diyforms SET info='$oksetting' WHERE diyid='$diyid' "); $dsql->ExecuteNoneQuery("ALTER TABLE `$trueTable` DROP `$fname` "); - ShowMsg("成功删除一个字段!","diy_edit.php?diyid=$diyid"); + ShowMsg("成功删除一个字段!", "diy_edit.php?diyid=$diyid"); exit(); } -require_once(DEDEADMIN."/templets/diy_field_edit.htm"); \ No newline at end of file +require_once(DEDEADMIN . "/templets/diy_field_edit.htm"); diff --git a/src/dede/diy_list.php b/src/dede/diy_list.php index 62bf4eb2..401cfb8f 100755 --- a/src/dede/diy_list.php +++ b/src/dede/diy_list.php @@ -1,114 +1,92 @@ getForm('post','','admin'); - include DEDEADMIN.'/templets/diy_post.htm'; - } - else if($do == 2) - { +if ($action == 'post') { + if (empty($do)) { + $postform = $diy->getForm('post', '', 'admin'); + include DEDEADMIN . '/templets/diy_post.htm'; + } else if ($do == 2) { $dede_fields = empty($dede_fields) ? '' : trim($dede_fields); $dede_fieldshash = empty($dede_fieldshash) ? '' : trim($dede_fieldshash); - if(!empty($dede_fields)) - { - if($dede_fieldshash != md5($dede_fields.$cfg_cookie_encode)) - { + if (!empty($dede_fields)) { + if ($dede_fieldshash != md5($dede_fields . $cfg_cookie_encode)) { showMsg("数据校验不对,程序返回", '-1'); exit(); } } $diyform = $dsql->getOne("SELECT * FROM #@__diyforms WHERE diyid=$diyid"); - if(!is_array($diyform)) - { + if (!is_array($diyform)) { showmsg("自定义表单不存在", '-1'); exit(); } $addvar = $addvalue = ''; - if(!empty($dede_fields)) - { + if (!empty($dede_fields)) { $fieldarr = explode(';', $dede_fields); - if(is_array($fieldarr)) - { - foreach($fieldarr as $field) - { - if($field == '') - { + if (is_array($fieldarr)) { + foreach ($fieldarr as $field) { + if ($field == '') { continue; } $fieldinfo = explode(',', $field); - if($fieldinfo[1] == 'htmltext' || $fieldinfo[1] == 'textdata') - { + if ($fieldinfo[1] == 'htmltext' || $fieldinfo[1] == 'textdata') { ${$fieldinfo[0]} = filterscript(stripslashes(${$fieldinfo[0]})); ${$fieldinfo[0]} = addslashes(${$fieldinfo[0]}); - ${$fieldinfo[0]} = getFieldValue(${$fieldinfo[0]}, $fieldinfo[1],0,'add','','member'); - } - else - { - ${$fieldinfo[0]} = getFieldValue(${$fieldinfo[0]}, $fieldinfo[1],0,'add','','member'); + ${$fieldinfo[0]} = getFieldValue(${$fieldinfo[0]}, $fieldinfo[1], 0, 'add', '', 'member'); + } else { + ${$fieldinfo[0]} = getFieldValue(${$fieldinfo[0]}, $fieldinfo[1], 0, 'add', '', 'member'); } - $addvar .= ', `'.$fieldinfo[0].'`'; - $addvalue .= ", '".${$fieldinfo[0]}."'"; + $addvar .= ', `' . $fieldinfo[0] . '`'; + $addvalue .= ", '" . ${$fieldinfo[0]} . "'"; } } } $query = "INSERT INTO `{$diy->table}` (`id`, `ifcheck` $addvar) VALUES (NULL, 0 $addvalue)"; - if($dsql->ExecuteNoneQuery($query)) - { + if ($dsql->ExecuteNoneQuery($query)) { $goto = "diy_list.php?action=list&diyid={$diy->diyid}"; showmsg('发布成功', $goto); - } - else - { + } else { showmsg('对不起,发布不成功', '-1'); } } -} else if ($action == 'list') -{ - include_once DEDEINC.'/datalistcp.class.php'; +} else if ($action == 'list') { + include_once DEDEINC . '/datalistcp.class.php'; $query = "SELECT * FROM {$diy->table} ORDER BY id DESC"; $datalist = new DataListCP(); $datalist->pageSize = 10; $datalist->SetParameter('action', 'list'); $datalist->SetParameter('diyid', $diyid); - $datalist->SetTemplate(DEDEADMIN.'/templets/diy_list.htm'); + $datalist->SetTemplate(DEDEADMIN . '/templets/diy_list.htm'); $datalist->SetSource($query); $fieldlist = $diy->getFieldList(); $datalist->Display(); -} else if ($action == 'edit') -{ - if(empty($do)) - { +} else if ($action == 'edit') { + if (empty($do)) { $id = isset($id) && is_numeric($id) ? $id : 0; - if(empty($id)) - { + if (empty($id)) { showMsg('非法操作!未指定id', 'javascript:;'); exit(); } $query = "SELECT * FROM {$diy->table} WHERE id=$id"; $row = $dsql->GetOne($query); - if(!is_array($row)) - { + if (!is_array($row)) { showmsg("你访问的记录不存在或未经审核", '-1'); exit(); } @@ -116,111 +94,83 @@ if($action == 'post') $fieldlist = $diy->getFieldList(); $c1 = $row['ifcheck'] == 1 ? 'checked' : ''; $c2 = $row['ifcheck'] == 0 ? 'checked' : ''; - include DEDEADMIN.'/templets/diy_edit_content.htm'; - } - else if($do == 2) - { + include DEDEADMIN . '/templets/diy_edit_content.htm'; + } else if ($do == 2) { $dede_fields = empty($dede_fields) ? '' : trim($dede_fields); $diyform = $dsql->GetOne("SELECT * FROM #@__diyforms WHERE diyid=$diyid"); $diyco = $dsql->GetOne("SELECT * FROM `$diy->table` WHERE id='$id'"); - if(!is_array($diyform)) - { + if (!is_array($diyform)) { showmsg("自定义表单不存在", '-1'); exit(); } $addsql = ''; - if(!empty($dede_fields)) - { + if (!empty($dede_fields)) { $fieldarr = explode(';', $dede_fields); - if(is_array($fieldarr)) - { - foreach($fieldarr as $field) - { - if($field == '') - { + if (is_array($fieldarr)) { + foreach ($fieldarr as $field) { + if ($field == '') { continue; } $fieldinfo = explode(',', $field); - if($fieldinfo[1] == 'htmltext' || $fieldinfo[1] == 'textdata') - { + if ($fieldinfo[1] == 'htmltext' || $fieldinfo[1] == 'textdata') { ${$fieldinfo[0]} = filterscript(stripslashes(${$fieldinfo[0]})); ${$fieldinfo[0]} = addslashes(${$fieldinfo[0]}); - ${$fieldinfo[0]} = GetFieldValue(${$fieldinfo[0]}, $fieldinfo[1],0,'add','','member'); + ${$fieldinfo[0]} = GetFieldValue(${$fieldinfo[0]}, $fieldinfo[1], 0, 'add', '', 'member'); ${$fieldinfo[0]} = empty(${$fieldinfo[0]}) ? $diyco[$fieldinfo[0]] : ${$fieldinfo[0]}; - } - else - { + } else { - ${$fieldinfo[0]} = GetFieldValue(${$fieldinfo[0]}, $fieldinfo[1],0,'add','','diy', $fieldinfo[0]); + ${$fieldinfo[0]} = GetFieldValue(${$fieldinfo[0]}, $fieldinfo[1], 0, 'add', '', 'diy', $fieldinfo[0]); ${$fieldinfo[0]} = empty(${$fieldinfo[0]}) ? $diyco[$fieldinfo[0]] : ${$fieldinfo[0]}; } - $addsql .= !empty($addsql)?',`'.$fieldinfo[0]."`='".${$fieldinfo[0]}."'" : '`'.$fieldinfo[0]."`='".${$fieldinfo[0]}."'"; + $addsql .= !empty($addsql) ? ',`' . $fieldinfo[0] . "`='" . ${$fieldinfo[0]} . "'" : '`' . $fieldinfo[0] . "`='" . ${$fieldinfo[0]} . "'"; } } } $query = "UPDATE `$diy->table` SET $addsql WHERE id=$id"; - if($dsql->ExecuteNoneQuery($query)) - { + if ($dsql->ExecuteNoneQuery($query)) { $goto = "diy_list.php?action=list&diyid={$diy->diyid}"; showmsg('编辑成功', $goto); - } - else - { + } else { showmsg('编辑成功', '-1'); } } -}elseif($action == 'check') -{ - if(is_array($id)) - { +} elseif ($action == 'check') { + if (is_array($id)) { $ids = implode(',', $id); - } - else - { + } else { showmsg('未选中要操作的内容', '-1'); exit(); } $query = "UPDATE `$diy->table` SET ifcheck=1 WHERE id IN ($ids)"; - if($dsql->ExecuteNoneQuery($query)) - { + if ($dsql->ExecuteNoneQuery($query)) { showmsg('审核成功', "diy_list.php?action=list&diyid={$diy->diyid}"); - } - else - { + } else { showmsg('审核失败', "diy_list.php?action=list&diyid={$diy->diyid}"); } -}elseif($action == 'delete') -{ - if(empty($do)) - { - if(is_array($id)) - { +} elseif ($action == 'delete') { + if (empty($do)) { + if (is_array($id)) { $ids = implode(',', $id); - }else - { + } else { showmsg('未选中要操作的内容', '-1'); exit(); } $query = "DELETE FROM `$diy->table` WHERE id IN ($ids)"; - if($dsql->ExecuteNoneQuery($query)) - { + if ($dsql->ExecuteNoneQuery($query)) { showmsg('删除成功', "diy_list.php?action=list&diyid={$diy->diyid}"); - } - else - { + } else { showmsg('删除失败', "diy_list.php?action=list&diyid={$diy->diyid}"); } - } else if($do=1){ + } else if ($do = 1) { $row = $dsql->GetOne("SELECT * FROM `$diy->table` WHERE id='$id'"); - if(file_exists($cfg_basedir.$row[$name])){ - unlink($cfg_basedir.$row[$name]); + if (file_exists($cfg_basedir . $row[$name])) { + unlink($cfg_basedir . $row[$name]); $dsql->ExecuteNoneQuery("UPDATE `$diy->table` SET $name='' WHERE id='$id'"); - showmsg('文件删除成功',"diy_list.php?action=list&diyid={$diy->diyid}"); - }else{ - showmsg('文件不存在','-1'); + showmsg('文件删除成功', "diy_list.php?action=list&diyid={$diy->diyid}"); + } else { + showmsg('文件不存在', '-1'); } } -}else -{ +} else { showmsg('未定义操作', "-1"); -} \ No newline at end of file +} diff --git a/src/dede/diy_main.php b/src/dede/diy_main.php index 4cf7f1be..e11b8a1e 100755 --- a/src/dede/diy_main.php +++ b/src/dede/diy_main.php @@ -1,21 +1,22 @@ SetTemplet(DEDEADMIN."/templets/diy_main.htm"); +$dlist->SetTemplet(DEDEADMIN . "/templets/diy_main.htm"); $dlist->SetSource($sql); $dlist->display(); -$dlist->Close(); \ No newline at end of file +$dlist->Close(); diff --git a/src/dede/erraddsave.php b/src/dede/erraddsave.php index 89db9bc3..5e3cf53b 100755 --- a/src/dede/erraddsave.php +++ b/src/dede/erraddsave.php @@ -1,30 +1,28 @@ GetOne($sql); return $row['uname']; @@ -35,8 +33,7 @@ function username($mid) function typename($me) { - switch ($me) - { + switch ($me) { case $me == 1: return $me = "错别字"; break; @@ -64,36 +61,30 @@ function typename($me) } } -if($dopost == "delete") -{ - if($id=='') - { - ShowMsg("参数无效!","-1"); +if ($dopost == "delete") { + if ($id == '') { + ShowMsg("参数无效!", "-1"); exit(); } - - - if($fmdo=='yes') - { + + + if ($fmdo == 'yes') { $id = explode("`", $id); - foreach ($id as $var) - { + foreach ($id as $var) { $query = "DELETE FROM `#@__erradd` WHERE `id` = '$var'"; $dsql->ExecuteNoneQuery($query); } - ShowMsg("成功删除指定的文档!","erraddsave.php"); + ShowMsg("成功删除指定的文档!", "erraddsave.php"); exit(); - } - else - { - require_once(DEDEINC."/oxwindow.class.php"); + } else { + require_once(DEDEINC . "/oxwindow.class.php"); $wintitle = "删除"; $wecome_info = "错误管理::删除错误"; $win = new OxWindow(); - $win->Init("erraddsave.php","js/blank.js","POST"); - $win->AddHidden("fmdo","yes"); - $win->AddHidden("dopost",$dopost); - $win->AddHidden("id",$id); + $win->Init("erraddsave.php", "js/blank.js", "POST"); + $win->AddHidden("fmdo", "yes"); + $win->AddHidden("dopost", $dopost); + $win->AddHidden("id", $id); $win->AddTitle("你确实要删除“ $id ”这些错误提示?"); $winform = $win->GetWindow("ok"); $win->Display(); @@ -104,6 +95,6 @@ if($dopost == "delete") $sql = "SELECT * FROM `#@__erradd` ORDER BY id desc"; $dlist = new DataListCP(); -$dlist->SetTemplet(DEDEADMIN."/templets/erradd.htm"); +$dlist->SetTemplet(DEDEADMIN . "/templets/erradd.htm"); $dlist->SetSource($sql); -$dlist->display(); \ No newline at end of file +$dlist->display(); diff --git a/src/dede/exit.php b/src/dede/exit.php index db6c7265..d6edb4e0 100755 --- a/src/dede/exit.php +++ b/src/dede/exit.php @@ -1,26 +1,24 @@ exitUser(); -if(empty($needclose)) -{ +if (empty($needclose)) { header('location:index.php'); -} -else -{ +} else { $msg = ""; echo $msg; -} \ No newline at end of file +} diff --git a/src/dede/feedback_edit.php b/src/dede/feedback_edit.php index 6c710229..843b4826 100755 --- a/src/dede/feedback_edit.php +++ b/src/dede/feedback_edit.php @@ -1,44 +1,43 @@ ",">", $adminmsg); - $adminmsg = str_replace(" ","  ", $adminmsg); - $adminmsg = str_replace("\r\n","
\n", $adminmsg); - $msg = $msg."
\n"."管理员回复: $adminmsg\n"; + $adminmsg = str_replace("<", "<", $adminmsg); + $adminmsg = str_replace(">", ">", $adminmsg); + $adminmsg = str_replace(" ", "  ", $adminmsg); + $adminmsg = str_replace("\r\n", "
\n", $adminmsg); + $msg = $msg . "
\n" . "管理员回复: $adminmsg\n"; } $query = "UPDATE `#@__feedback` SET username='$username',msg='$msg',ischeck=1 WHERE id=$id"; $dsql->ExecuteNoneQuery($query); - ShowMsg("成功回复一则留言!",$ENV_GOBACK_URL); + ShowMsg("成功回复一则留言!", $ENV_GOBACK_URL); exit(); } elseif ($dopost === 'makehtml') { - require_once(DEDEADMIN.'/inc/inc_archives_functions.php'); + require_once(DEDEADMIN . '/inc/inc_archives_functions.php'); $query = "SELECT * FROM `#@__feedback` WHERE id=$id"; $row = $dsql->GetOne($query); MakeArt($row['aid']); - ShowMsg("成功更新评论所在的文档内容",$ENV_GOBACK_URL); + ShowMsg("成功更新评论所在的文档内容", $ENV_GOBACK_URL); exit(); } $query = "SELECT * FROM `#@__feedback` WHERE id=$id"; $row = $dsql->GetOne($query); -include DedeInclude('templets/feedback_edit.htm'); \ No newline at end of file +include DedeInclude('templets/feedback_edit.htm'); diff --git a/src/dede/feedback_main.php b/src/dede/feedback_main.php index 453cba6d..e1e0bac4 100755 --- a/src/dede/feedback_main.php +++ b/src/dede/feedback_main.php @@ -4,7 +4,7 @@ * 评论管理 * * @version $Id: feedback_main.php 1 19:09 2010年7月12日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -44,7 +44,8 @@ if (!empty($job)) { } // 更新回复统计 -function UpdateReplycount($id){ +function UpdateReplycount($id) +{ global $dsql; $row = $dsql->GetOne("SELECT COUNT(*) as dd FROM `#@__feedback` WHERE fid = $id AND ischeck=1"); $dsql->ExecNoneQuery("UPDATE `#@__feedback` SET `replycount`='{$row['dd']}' WHERE `id`=$id;"); @@ -74,7 +75,7 @@ else if ($job == 'delall') { } //审核评论 else if ($job == 'check') { - + $query = "UPDATE `#@__feedback` SET ischeck=1 WHERE id IN($ids) "; $dsql->ExecuteNoneQuery($query); diff --git a/src/dede/file_class.php b/src/dede/file_class.php index b7075975..9d9145a6 100755 --- a/src/dede/file_class.php +++ b/src/dede/file_class.php @@ -1,9 +1,9 @@ -Init(); /*--------------- function __rename(); ----------------*/ -if($fmdo=="rename") -{ - $fmm->RenameFile($oldfilename,$newfilename); +if ($fmdo == "rename") { + $fmm->RenameFile($oldfilename, $newfilename); } //新建目录 /*--------------- function __newdir(); -----------------*/ -else if($fmdo=="newdir") -{ +----------------*/ else if ($fmdo == "newdir") { CheckCSRF(); $fmm->NewDir($newpath); } @@ -45,19 +43,15 @@ else if($fmdo=="newdir") /*--------------- function __move(); -----------------*/ -else if($fmdo=="move") -{ - $fmm->MoveFile($filename,$newpath); +----------------*/ else if ($fmdo == "move") { + $fmm->MoveFile($filename, $newpath); } //删除文件 /*--------------- function __delfile(); -----------------*/ -else if($fmdo=="del") -{ +----------------*/ else if ($fmdo == "del") { $fmm->DeleteFile($filename); } @@ -65,9 +59,7 @@ else if($fmdo=="del") /*--------------- function __saveEdit(); -----------------*/ -else if($fmdo=="edit") -{ +----------------*/ else if ($fmdo == "edit") { CheckCSRF(); $filename = str_replace("..", "", $filename); $file = "$cfg_basedir$activepath/$filename"; @@ -75,13 +67,10 @@ else if($fmdo=="edit") $fp = fopen($file, "w"); fputs($fp, $str); fclose($fp); - if(empty($backurl)) - { - ShowMsg("成功保存一个文件!","file_manage_main.php?activepath=$activepath"); - } - else - { - ShowMsg("成功保存文件!",$backurl); + if (empty($backurl)) { + ShowMsg("成功保存一个文件!", "file_manage_main.php?activepath=$activepath"); + } else { + ShowMsg("成功保存文件!", $backurl); } exit(); } @@ -108,58 +97,48 @@ else if($fmdo=="editview") //文件上传 /*--------------- function __upload(); -----------------*/ -else if($fmdo=="upload") -{ - $j=0; - for($i=1; $i<=50; $i++) - { - $upfile = "upfile".$i; - $upfile_name = "upfile".$i."_name"; - if(!isset(${$upfile}) || !isset(${$upfile_name})) - { +----------------*/ else if ($fmdo == "upload") { + $j = 0; + for ($i = 1; $i <= 50; $i++) { + $upfile = "upfile" . $i; + $upfile_name = "upfile" . $i . "_name"; + if (!isset(${$upfile}) || !isset(${$upfile_name})) { continue; } $upfile = ${$upfile}; $upfile_name = ${$upfile_name}; - if(is_uploaded_file($upfile)) - { - if(!file_exists($cfg_basedir.$activepath."/".$upfile_name)) - { - move_uploaded_file($upfile, $cfg_basedir.$activepath."/".$upfile_name); + if (is_uploaded_file($upfile)) { + if (!file_exists($cfg_basedir . $activepath . "/" . $upfile_name)) { + move_uploaded_file($upfile, $cfg_basedir . $activepath . "/" . $upfile_name); } @unlink($upfile); $j++; } } - ShowMsg("成功上传 $j 个文件到: $activepath","file_manage_main.php?activepath=$activepath"); + ShowMsg("成功上传 $j 个文件到: $activepath", "file_manage_main.php?activepath=$activepath"); exit(); } //空间检查 -else if($fmdo=="space") -{ - if($activepath=="") - { +else if ($fmdo == "space") { + if ($activepath == "") { $ecpath = "所有目录"; - } - else - { + } else { $ecpath = $activepath; } $titleinfo = "目录 $ecpath 空间使用状况:
"; $wintitle = "文件管理"; $wecome_info = "文件管理::空间大小检查 [文件浏览器]"; - $activepath=$cfg_basedir.$activepath; + $activepath = $cfg_basedir . $activepath; $space = new SpaceUse; $space->checksize($activepath); - $total=$space->totalsize; - $totalkb=$space->setkb($total); - $totalmb=$space->setmb($total); + $total = $space->totalsize; + $totalkb = $space->setkb($total); + $totalmb = $space->setmb($total); $win = new OxWindow(); - $win->Init("","js/blank.js","POST"); + $win->Init("", "js/blank.js", "POST"); $win->AddTitle($titleinfo); $win->AddMsgItem("  $totalmb M
  $totalkb KB
  $total 字节"); $winform = $win->GetWindow(""); $win->Display(); -} \ No newline at end of file +} diff --git a/src/dede/file_manage_main.php b/src/dede/file_manage_main.php index 0fc0ae16..40a38517 100755 --- a/src/dede/file_manage_main.php +++ b/src/dede/file_manage_main.php @@ -1,32 +1,30 @@ 文件浏览器]"; $win = new OxWindow(); - $win->Init("file_manage_control.php","js/blank.js","POST"); - $win->AddHidden("fmdo",$fmdo); - $win->AddHidden("activepath",$activepath); - $win->AddHidden("filename",$filename); + $win->Init("file_manage_control.php", "js/blank.js", "POST"); + $win->AddHidden("fmdo", $fmdo); + $win->AddHidden("activepath", $activepath); + $win->AddHidden("filename", $filename); $win->AddTitle("更改文件名,当前路径:$ndirstring"); - $win->AddItem("旧名称:",""); - $win->AddItem("新名称:",""); + $win->AddItem("旧名称:", ""); + $win->AddItem("新名称:", ""); $winform = $win->GetWindow("ok"); $win->Display(); } //新建目录 -else if($fmdo=="newdir") -{ - if($activepath=="") $activepathname="根目录"; - else $activepathname=$activepath; +else if ($fmdo == "newdir") { + if ($activepath == "") $activepathname = "根目录"; + else $activepathname = $activepath; $wintitle = " 文件管理"; $wecome_info = " 文件管理::新建目录 [文件浏览器]"; $win = new OxWindow(); - $win->Init("file_manage_control.php","js/blank.js","POST"); - $win->AddHidden("fmdo",$fmdo); - $win->AddHidden("activepath",$activepath); - $win->AddHidden("token",make_hash()); + $win->Init("file_manage_control.php", "js/blank.js", "POST"); + $win->AddHidden("fmdo", $fmdo); + $win->AddHidden("activepath", $activepath); + $win->AddHidden("token", make_hash()); $win->AddTitle("当前目录 $activepathname "); - $win->AddItem("新目录:",""); + $win->AddItem("新目录:", ""); $winform = $win->GetWindow("ok"); $win->Display(); } //移动文件 -else if($fmdo=="move") -{ +else if ($fmdo == "move") { $wintitle = " 文件管理"; $wecome_info = " 文件管理::移动文件 [文件浏览器]"; $win = new OxWindow(); - $win->Init("file_manage_control.php","js/blank.js","POST"); - $win->AddHidden("fmdo",$fmdo); - $win->AddHidden("activepath",$activepath); - $win->AddHidden("filename",$filename); + $win->Init("file_manage_control.php", "js/blank.js", "POST"); + $win->AddHidden("fmdo", $fmdo); + $win->AddHidden("activepath", $activepath); + $win->AddHidden("filename", $filename); $win->AddTitle("新位置前面不加'/'表示相对于当前位置,加'/'表示相对于根目录。"); - $win->AddItem("被移动文件:",$filename); - $win->AddItem("当前位置:",$activepath); - $win->AddItem("新位置:",""); + $win->AddItem("被移动文件:", $filename); + $win->AddItem("当前位置:", $activepath); + $win->AddItem("新位置:", ""); $winform = $win->GetWindow("ok"); $win->Display(); } //删除文件 -else if($fmdo=="del") -{ +else if ($fmdo == "del") { $wintitle = " 文件管理"; $wecome_info = " 文件管理::删除文件 [文件浏览器]"; $win = new OxWindow(); - $win->Init("file_manage_control.php","js/blank.js","POST"); - $win->AddHidden("fmdo",$fmdo); - $win->AddHidden("activepath",$activepath); - $win->AddHidden("filename",$filename); - if(@is_dir($cfg_basedir.$activepath."/$filename")) - { + $win->Init("file_manage_control.php", "js/blank.js", "POST"); + $win->AddHidden("fmdo", $fmdo); + $win->AddHidden("activepath", $activepath); + $win->AddHidden("filename", $filename); + if (@is_dir($cfg_basedir . $activepath . "/$filename")) { $wmsg = "你确信要删除目录:$filename 吗?"; - } - else - { + } else { $wmsg = "你确信要删除文件:$filename 吗?"; } $win->AddTitle("删除文件确认"); - $win->AddMsgItem($wmsg,"50"); + $win->AddMsgItem($wmsg, "50"); $winform = $win->GetWindow("ok"); $win->Display(); } //编辑文件 -else if($fmdo=="edit") -{ - if(!isset($backurl)) - { +else if ($fmdo == "edit") { + if (!isset($backurl)) { $backurl = ""; } - $activepath = str_replace("..","",$activepath); - $filename = str_replace("..","",$filename); + $activepath = str_replace("..", "", $activepath); + $filename = str_replace("..", "", $filename); $file = "$cfg_basedir$activepath/$filename"; $content = ""; - if(is_file($file)) - { - $fp = fopen($file,"r"); - $content = fread($fp,filesize($file)); + if (is_file($file)) { + $fp = fopen($file, "r"); + $content = fread($fp, filesize($file)); fclose($fp); $content = dede_htmlspecialchars($content); } $contentView = "\r\n"; $GLOBALS['filename'] = $filename; $path_parts = pathinfo($filename); - if ( $path_parts['extension'] == 'php' ) - { + if ($path_parts['extension'] == 'php') { $GLOBALS['extension'] = 'text/x-php'; - } else if($path_parts['extension'] == 'js'){ + } else if ($path_parts['extension'] == 'js') { $GLOBALS['extension'] = 'text/javascript'; - } else if($path_parts['extension'] == 'css'){ + } else if ($path_parts['extension'] == 'css') { $GLOBALS['extension'] = 'text/css'; } else { $GLOBALS['extension'] = 'text/html'; } $ctp = new DedeTagParse(); - $ctp->LoadTemplate(DEDEADMIN."/templets/file_edit.htm"); + $ctp->LoadTemplate(DEDEADMIN . "/templets/file_edit.htm"); $ctp->display(); } /*编辑文件,可视化模式 @@ -165,22 +155,20 @@ else if($fmdo=="editview") } */ //新建文件 -else if($fmdo=="newfile") -{ +else if ($fmdo == "newfile") { $content = ""; $GLOBALS['filename'] = "newfile.txt"; $GLOBALS['extension'] = 'text/html'; $contentView = "\r\n"; $GLOBALS['token'] = make_hash(); $ctp = new DedeTagParse(); - $ctp->LoadTemplate(DEDEADMIN."/templets/file_edit.htm"); + $ctp->LoadTemplate(DEDEADMIN . "/templets/file_edit.htm"); $ctp->display(); } //上传文件 -else if($fmdo=="upload") -{ +else if ($fmdo == "upload") { $ctp = new DedeTagParse(); - $ctp->LoadTemplate(DEDEADMIN."/templets/file_upload.htm"); + $ctp->LoadTemplate(DEDEADMIN . "/templets/file_upload.htm"); $ctp->display(); -} \ No newline at end of file +} diff --git a/src/dede/freelist_add.php b/src/dede/freelist_add.php index 27ac1e20..df692311 100755 --- a/src/dede/freelist_add.php +++ b/src/dede/freelist_add.php @@ -1,48 +1,44 @@ ExecuteNoneQuery($inquery); ShowMsg("成功增加一个自由列表!", "freelist_main.php"); exit(); -} \ No newline at end of file +} diff --git a/src/dede/freelist_edit.php b/src/dede/freelist_edit.php index 6772efc3..cce246c3 100755 --- a/src/dede/freelist_edit.php +++ b/src/dede/freelist_edit.php @@ -1,49 +1,46 @@ GetOne("Select * From `#@__freelist` where aid='$aid' "); $dtp = new DedeTagParse(); - $dtp->SetNameSpace("dede","{","}"); - $dtp->LoadSource("--".$row['listtag']."--"); + $dtp->SetNameSpace("dede", "{", "}"); + $dtp->LoadSource("--" . $row['listtag'] . "--"); $ctag = $dtp->GetTag('list'); include DedeInclude('templets/freelist_edit.htm'); exit(); -} -else if( $dopost=='save' ) -{ - if(!isset($types)) $types = ''; - if(!isset($nodefault)) $nodefault = '0'; +} else if ($dopost == 'save') { + if (!isset($types)) $types = ''; + if (!isset($nodefault)) $nodefault = '0'; $atts = " pagesize='$pagesize' col='$col' titlelen='$titlelen' orderby='$orderby' orderway='$order' \r\n"; $ntype = ''; $edtime = time(); - if(is_array($types)) - { - foreach($types as $v) $ntype .= $v.' '; + if (is_array($types)) { + foreach ($types as $v) $ntype .= $v . ' '; } - - if($ntype!='') $atts .= " type='".trim($ntype)."' "; - if(!empty($typeid)) $atts .= " typeid='$typeid' "; - if(!empty($channel)) $atts .= " channel='$channel' "; - if(!empty($subday)) $atts .= " subday='$subday' "; - if(!empty($keywordarc)) $atts .= " keyword='$keywordarc' "; - if(!empty($att)) $atts .= " att='$att' "; - + + if ($ntype != '') $atts .= " type='" . trim($ntype) . "' "; + if (!empty($typeid)) $atts .= " typeid='$typeid' "; + if (!empty($channel)) $atts .= " channel='$channel' "; + if (!empty($subday)) $atts .= " subday='$subday' "; + if (!empty($keywordarc)) $atts .= " keyword='$keywordarc' "; + if (!empty($att)) $atts .= " att='$att' "; + $innertext = trim($innertext); - if(!empty($innertext)) $innertext = stripslashes($innertext); - + if (!empty($innertext)) $innertext = stripslashes($innertext); + $listTag = "{dede:list $atts}$innertext{/dede:list}"; $listTag = addslashes($listTag); $inquery = " @@ -55,6 +52,6 @@ else if( $dopost=='save' ) description='$description' WHERE aid='$aid'; "; $dsql->ExecuteNoneQuery($inquery); - ShowMsg("成功更改一个自由列表!","freelist_main.php"); + ShowMsg("成功更改一个自由列表!", "freelist_main.php"); exit(); -} \ No newline at end of file +} diff --git a/src/dede/freelist_main.php b/src/dede/freelist_main.php index c92a7e06..475a6fbb 100755 --- a/src/dede/freelist_main.php +++ b/src/dede/freelist_main.php @@ -3,7 +3,7 @@ * 自由列表管理 * * @version $Id: freelist_main.php 1 8:48 2010年7月13日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -97,5 +97,3 @@ function GetTagList($dsql,$pageno,$pagesize,$orderby='aid') } echo "\r\n"; } - -?> \ No newline at end of file diff --git a/src/dede/friendlink_add.php b/src/dede/friendlink_add.php index e2efeedd..771a024b 100755 --- a/src/dede/friendlink_add.php +++ b/src/dede/friendlink_add.php @@ -1,64 +1,55 @@ ExecuteNoneQuery("ALTER TABLE `#@__flinktype` CHANGE `ID` `id` MEDIUMINT( 8 ) UNSIGNED DEFAULT NULL AUTO_INCREMENT; "); } - + $query = "INSERT INTO `#@__flink`(sortrank,url,webname,logo,msg,email,typeid,dtime,ischeck) VALUES('$sortrank','$url','$webname','$imgurl','$msg','$email','$typeid','$dtime','$ischeck'); "; $rs = $dsql->ExecuteNoneQuery($query); $burl = empty($_COOKIE['ENV_GOBACK_URL']) ? "friendlink_main.php" : $_COOKIE['ENV_GOBACK_URL']; - if($rs) - { - ShowMsg("成功增加一个链接!",$burl,0,500); + if ($rs) { + ShowMsg("成功增加一个链接!", $burl, 0, 500); exit(); - } - else - { - ShowMsg("增加链接时出错,请向官方反馈,原因:".$dsql->GetError(),"javascript:;"); + } else { + ShowMsg("增加链接时出错,请向官方反馈,原因:" . $dsql->GetError(), "javascript:;"); exit(); } } -include DedeInclude('templets/friendlink_add.htm'); \ No newline at end of file +include DedeInclude('templets/friendlink_add.htm'); diff --git a/src/dede/friendlink_edit.php b/src/dede/friendlink_edit.php index cfd5e321..9cd4b481 100755 --- a/src/dede/friendlink_edit.php +++ b/src/dede/friendlink_edit.php @@ -1,79 +1,68 @@ ExecuteNoneQuery("DELETE FROM `#@__flink` WHERE id='$id'"); - ShowMsg("成功删除一个链接!",$ENV_GOBACK_URL); + ShowMsg("成功删除一个链接!", $ENV_GOBACK_URL); exit(); -} -else if($dopost=="delall") -{ - $aids = explode(',',$aids); - if(isset($aids) && is_array($aids)) - { - foreach($aids as $aid) - { +} else if ($dopost == "delall") { + $aids = explode(',', $aids); + if (isset($aids) && is_array($aids)) { + foreach ($aids as $aid) { $aid = preg_replace("#[^0-9]#", "", $aid); $dsql->ExecuteNoneQuery("DELETE FROM `#@__flink` WHERE id='$aid'"); } - ShowMsg("成功删除指定链接!",$ENV_GOBACK_URL); + ShowMsg("成功删除指定链接!", $ENV_GOBACK_URL); exit(); - } - else - { - ShowMsg("你没选定任何链接!",$ENV_GOBACK_URL); + } else { + ShowMsg("你没选定任何链接!", $ENV_GOBACK_URL); exit(); } -} -else if($dopost=="saveedit") -{ - require_once DEDEINC.'/request.class.php'; - $request = new Request(); - $request->Init(); +} else if ($dopost == "saveedit") { + require_once DEDEINC . '/request.class.php'; + $request = new Request(); + $request->Init(); $id = preg_replace("#[^0-9]#", "", $request->Item('id', 0)); - $logo = $request->Item('logo', ''); - $logoimg = $request->Upfile('logoimg', ''); - if(!empty($logoimg)) - { - $request->MoveUploadFile('logoimg', DEDEROOT.'/uploads/flink/'.$request->GetFileInfo('logoimg', 'name')); - $logo = $cfg_cmspath.'/uploads/flink/'.$request->GetFileInfo('logoimg', 'name'); - } - $sortrank = $request->Item('sortrank', 1); - $url = $request->Item('url', ''); - $webname = $request->Item('webname', ''); - $msg = $request->Item('msg', ''); - $email = $request->Item('email', ''); - $typeid = $request->Item('typeid', 0); - $ischeck = $request->Item('ischeck', 0); - + $logo = $request->Item('logo', ''); + $logoimg = $request->Upfile('logoimg', ''); + if (!empty($logoimg)) { + $request->MoveUploadFile('logoimg', DEDEROOT . '/uploads/flink/' . $request->GetFileInfo('logoimg', 'name')); + $logo = $cfg_cmspath . '/uploads/flink/' . $request->GetFileInfo('logoimg', 'name'); + } + $sortrank = $request->Item('sortrank', 1); + $url = $request->Item('url', ''); + $webname = $request->Item('webname', ''); + $msg = $request->Item('msg', ''); + $email = $request->Item('email', ''); + $typeid = $request->Item('typeid', 0); + $ischeck = $request->Item('ischeck', 0); + $query = "UPDATE `#@__flink` SET sortrank='$sortrank',url='$url',webname='$webname',logo='$logo',msg='$msg', email='$email',typeid='$typeid',ischeck='$ischeck' WHERE id='$id' "; $dsql->ExecuteNoneQuery($query); - ShowMsg("成功更改一个链接!",$ENV_GOBACK_URL); + ShowMsg("成功更改一个链接!", $ENV_GOBACK_URL); exit(); } $myLink = $dsql->GetOne("SELECT #@__flink.*,#@__flinktype.typename FROM #@__flink LEFT JOIN #@__flinktype ON #@__flink.typeid=#@__flinktype.id WHERE #@__flink.id=$id"); -include DedeInclude('templets/friendlink_edit.htm'); \ No newline at end of file +include DedeInclude('templets/friendlink_edit.htm'); diff --git a/src/dede/friendlink_main.php b/src/dede/friendlink_main.php index 1843e2be..acacc590 100755 --- a/src/dede/friendlink_main.php +++ b/src/dede/friendlink_main.php @@ -1,46 +1,47 @@ '不限类型', -1=>'未审核', 1=>'内页', 2=>'首页'); +$selCheckArr = array(0 => '不限类型', -1 => '未审核', 1 => '内页', 2 => '首页'); $sql = "SELECT * FROM `#@__flink` WHERE CONCAT(`url`,`webname`,`email`) LIKE '%$keyword%' $ischeckSql ORDER BY dtime desc"; $dlist = new DataListCP(); $dlist->SetParameter('keyword', $keyword); $dlist->SetParameter('ischeck', $ischeck); -$dlist->SetTemplet(DEDEADMIN.'/templets/friendlink_main.htm'); +$dlist->SetTemplet(DEDEADMIN . '/templets/friendlink_main.htm'); $dlist->SetSource($sql); $dlist->display(); function GetPic($pic) { - if($pic=='') return '无图标'; + if ($pic == '') return '无图标'; else return ""; } function GetSta($sta) { - if($sta==1) return '内页'; - if($sta==2) return '首页'; + if ($sta == 1) return '内页'; + if ($sta == 2) return '首页'; else return '未审核'; -} \ No newline at end of file +} diff --git a/src/dede/friendlink_type.php b/src/dede/friendlink_type.php index 24068c14..61891d13 100755 --- a/src/dede/friendlink_type.php +++ b/src/dede/friendlink_type.php @@ -1,43 +1,37 @@ ExecuteNoneQuery($query); } - } - else - { + } else { $query = "DELETE FROM `#@__flinktype` WHERE id='$tid' "; $dsql->ExecuteNoneQuery($query); } } //增加新记录 - if(isset($check_new) && $pname_new!='') - { + if (isset($check_new) && $pname_new != '') { $query = "INSERT INTO `#@__flinktype`(typename) VALUES('{$pname_new}');"; $dsql->ExecuteNoneQuery($query); } @@ -45,4 +39,4 @@ if($dopost=="save") echo ""; } -include DedeInclude('templets/friendlink_type.htm'); \ No newline at end of file +include DedeInclude('templets/friendlink_type.htm'); diff --git a/src/dede/getdedesysmsg.php b/src/dede/getdedesysmsg.php deleted file mode 100755 index 6462d4d8..00000000 --- a/src/dede/getdedesysmsg.php +++ /dev/null @@ -1,19 +0,0 @@ -OpenUrl('http://www.dedecms.com/officialinfo.html'); -$str = trim($dhd->GetHtml()); -$dhd->Close(); -if($cfg_soft_lang=='utf-8') $str = gb2utf8($str); -echo $str; diff --git a/src/dede/imagecut.php b/src/dede/imagecut.php index e884e1c0..8fefb806 100755 --- a/src/dede/imagecut.php +++ b/src/dede/imagecut.php @@ -1,56 +1,49 @@ 点击'站内选择', 上传或选择一个图片,然后才能进行裁剪!", "./dialog/select_images.php?f=form1.picname&imgstick=small", 0 , 10000); +if (empty($action)) { + if (!@is_file($cfg_basedir . $file)) { + ShowMsg("对不起,必须选择站内的图片才能进行裁剪!
点击'站内选择', 上传或选择一个图片,然后才能进行裁剪!", "./dialog/select_images.php?f=form1.picname&imgstick=small", 0, 10000); exit(); } - include DEDEADMIN.'/templets/imagecut.htm'; + include DEDEADMIN . '/templets/imagecut.htm'; exit(); -} -elseif($action == 'cut') -{ - require_once(DEDEINC.'/image.func.php'); +} elseif ($action == 'cut') { + require_once(DEDEINC . '/image.func.php'); - if(!@is_file($cfg_basedir.$file)) - { + if (!@is_file($cfg_basedir . $file)) { ShowMsg('对不起,请重新选择裁剪图片!', '-1'); exit(); } - if(empty($width)) - { + if (empty($width)) { ShowMsg('对不起,请选择裁剪图片的尺寸!', '-1'); exit(); } - if(empty($height)) - { + if (empty($height)) { ShowMsg('对不起,请选择裁剪图片的尺寸!', '-1'); exit(); } - $imginfo = getimagesize($cfg_basedir.$file); + $imginfo = getimagesize($cfg_basedir . $file); $imgw = $imginfo[0]; $imgh = $imginfo[1]; - $temp = 400/$imgw; + $temp = 400 / $imgw; $newwidth = 400; $newheight = $imgh * $temp; - $srcFile = $cfg_basedir.$file; + $srcFile = $cfg_basedir . $file; $thumb = imagecreatetruecolor($newwidth, $newheight); $thumba = imagecreatetruecolor($width, $height); - switch($imginfo['mime']) - { + switch ($imginfo['mime']) { case 'image/jpeg': $source = imagecreatefromjpeg($srcFile); break; @@ -65,29 +58,25 @@ elseif($action == 'cut') break; } - imagecopyresized($thumb, $source, 0, 0, 0, 0 , $newwidth, $newheight, $imgw, $imgh); + imagecopyresized($thumb, $source, 0, 0, 0, 0, $newwidth, $newheight, $imgw, $imgh); imagecopy($thumba, $thumb, 0, 0, $left, $top, $newwidth, $newheight); $ddn = substr($srcFile, -3); - + $ddpicok = $reObjJs = ''; - if( empty($isupload) ) - { - $ddpicok = preg_replace("#\.".$ddn."$#", '-lp.'.$ddn, $file); + if (empty($isupload)) { + $ddpicok = preg_replace("#\." . $ddn . "$#", '-lp.' . $ddn, $file); $reObjJs = " var backObj = window.opener.document.form1.picname; var prvObj = window.opener.document.getElementById('divpicview');\r\n"; - } - else - { + } else { $ddpicok = $file; $reObjJs = " var backObj = window.opener.parent.document.form1.picname; var prvObj = window.opener.parent.document.getElementById('divpicview');\r\n"; } - - $ddpicokurl = $cfg_basedir.$ddpicok; - switch($imginfo['mime']) - { + $ddpicokurl = $cfg_basedir . $ddpicok; + + switch ($imginfo['mime']) { case 'image/jpeg': imagejpeg($thumba, $ddpicokurl, 85); break; @@ -101,41 +90,37 @@ elseif($action == 'cut') ShowMsg("对不起,裁剪图片类型不支持请选择其他类型图片!", "-1"); break; } - + //对任意裁剪方式再次缩小图片至限定大小 - if($newwidth > $cfg_ddimg_width || $newheight > $cfg_ddimg_height) - { + if ($newwidth > $cfg_ddimg_width || $newheight > $cfg_ddimg_height) { ImageResize($ddpicokurl, $cfg_ddimg_width, $cfg_ddimg_height); } - + //如果从其它图中剪出, 保存附件信息 - if( empty($isupload) ) - { - $inquery = "INSERT INTO `#@__uploads`(title,url,mediatype,width,height,playtime,filesize,uptime,mid) - VALUES ('$ddpicok','$ddpicok','1','0','0','0','".filesize($ddpicokurl)."','".time()."','".$cuserLogin->getUserID()."'); "; - $dsql->ExecuteNoneQuery($inquery); - $fid = $dsql->GetLastID(); - AddMyAddon($fid, $ddpicok); + if (empty($isupload)) { + $inquery = "INSERT INTO `#@__uploads`(title,url,mediatype,width,height,playtime,filesize,uptime,mid) + VALUES ('$ddpicok','$ddpicok','1','0','0','0','" . filesize($ddpicokurl) . "','" . time() . "','" . $cuserLogin->getUserID() . "'); "; + $dsql->ExecuteNoneQuery($inquery); + $fid = $dsql->GetLastID(); + AddMyAddon($fid, $ddpicok); } - + ?> - + \ No newline at end of file diff --git a/src/dede/inc/inc_action_info.php b/src/dede/inc/inc_action_info.php index 1b1d38e2..abc90b86 100755 --- a/src/dede/inc/inc_action_info.php +++ b/src/dede/inc/inc_action_info.php @@ -1,505 +1,506 @@ '核心', 'title' => '常规操作', - 'description' =>'站点档案常规功能操作', + 'description' => '站点档案常规功能操作', 'soniterm' => array( 0 => array( - 'title' =>'网站栏目管理', - 'description' =>'站点所有栏目管理', - 'purview' =>'t_List,t_AccList', - 'linkurl' =>'catalog_main.php' + 'title' => '网站栏目管理', + 'description' => '站点所有栏目管理', + 'purview' => 't_List,t_AccList', + 'linkurl' => 'catalog_main.php' ), 1 => array( - 'title' =>'等审核的档案', - 'description' =>'所有内容模型发表的未经审核内容列表', - 'purview' =>'a_Check,a_AccCheck', - 'linkurl' =>'content_list.php?arcrank=-1' + 'title' => '等审核的档案', + 'description' => '所有内容模型发表的未经审核内容列表', + 'purview' => 'a_Check,a_AccCheck', + 'linkurl' => 'content_list.php?arcrank=-1' ), 2 => array( - 'title' =>'我发布的文档', - 'description' =>'现在登录的管理员所发表的所有内容模型中的文档', - 'purview' =>'a_List,a_AccList,a_MyList', - 'linkurl' =>'content_list.php?mid='.$cuserLogin->userID + 'title' => '我发布的文档', + 'description' => '现在登录的管理员所发表的所有内容模型中的文档', + 'purview' => 'a_List,a_AccList,a_MyList', + 'linkurl' => 'content_list.php?mid=' . $cuserLogin->userID ), 3 => array( - 'title' =>'评论管理', - 'description' =>'网站所有评论管理', - 'purview' =>'sys_Feedback', - 'linkurl' =>'feedback_main.php' + 'title' => '评论管理', + 'description' => '网站所有评论管理', + 'purview' => 'sys_Feedback', + 'linkurl' => 'feedback_main.php' ), 4 => array( - 'title' =>'内容回收站', - 'description' =>'如果在"系统基本参数"的"核心设置"中开启了"文章回收站(是/否)开启功能",后台删除的文档将会存放在此处', - 'purview' =>'a_List,a_AccList,a_MyList', - 'linkurl' =>'recycling.php' + 'title' => '内容回收站', + 'description' => '如果在"系统基本参数"的"核心设置"中开启了"文章回收站(是/否)开启功能",后台删除的文档将会存放在此处', + 'purview' => 'a_List,a_AccList,a_MyList', + 'linkurl' => 'recycling.php' ) ) ); $actionSearch[1] = array( - 'toptitle' => '核心', + 'toptitle' => '核心', 'title' => '内容管理', 'description' => '网站对应内容模型的文档管理', 'soniterm' => array( 0 => array( - 'title' =>'专题管理', - 'description' =>'所有专题内容的管理', - 'purview' =>'spec_New', - 'linkurl' =>'content_s_list.php' + 'title' => '专题管理', + 'description' => '所有专题内容的管理', + 'purview' => 'spec_New', + 'linkurl' => 'content_s_list.php' ), ) ); $actionSearch[2] = array( - 'toptitle' => '核心', + 'toptitle' => '核心', 'title' => '附件管理', 'description' => '所有上传的附件管理', 'soniterm' => array( 0 => array( - 'title' =>'上传新文件 ', - 'description' =>'通过这可以上传图片、FLASH、视频/音频、附件/其它等附件 ', - 'purview' =>'', - 'linkurl' =>'media_add.php' + 'title' => '上传新文件 ', + 'description' => '通过这可以上传图片、FLASH、视频/音频、附件/其它等附件 ', + 'purview' => '', + 'linkurl' => 'media_add.php' ), 1 => array( - 'title' =>'附件数据管理 ', - 'description' =>'列出所有上传的附件', - 'purview' =>'sys_Upload,sys_MyUpload', - 'linkurl' =>'media_main.php' + 'title' => '附件数据管理 ', + 'description' => '列出所有上传的附件', + 'purview' => 'sys_Upload,sys_MyUpload', + 'linkurl' => 'media_main.php' ), 2 => array( - 'title' =>'文件式管理器 ', - 'description' =>'应用文件浏览的模式进行附件的管理', - 'purview' =>'plus_文件管理器', - 'linkurl' =>'media_main.php?dopost=filemanager' + 'title' => '文件式管理器 ', + 'description' => '应用文件浏览的模式进行附件的管理', + 'purview' => 'plus_文件管理器', + 'linkurl' => 'media_main.php?dopost=filemanager' ), ) ); $actionSearch[3] = array( - 'toptitle' => '核心', + 'toptitle' => '核心', 'title' => '频道模型', 'description' => '所有上传的附件管理', 'soniterm' => array( 0 => array( - 'title' =>'内容模型管理 ', - 'description' =>'可以对现有商品、软件、图片集、普通文章、专题、分类信息等模型就行管理,也可以创建新的内容模型', - 'purview' =>'c_List', - 'linkurl' =>'mychannel_main.php' + 'title' => '内容模型管理 ', + 'description' => '可以对现有商品、软件、图片集、普通文章、专题、分类信息等模型就行管理,也可以创建新的内容模型', + 'purview' => 'c_List', + 'linkurl' => 'mychannel_main.php' ), 1 => array( - 'title' =>'单页文档管理 ', - 'description' =>'创建和管理单页面', - 'purview' =>'temp_One', - 'linkurl' =>'templets_one.php' + 'title' => '单页文档管理 ', + 'description' => '创建和管理单页面', + 'purview' => 'temp_One', + 'linkurl' => 'templets_one.php' ), 2 => array( - 'title' =>'联动类别管理 ', - 'description' =>'创建和管理所有的联动', - 'purview' =>'c_Stepseclect', - 'linkurl' =>'stepselect_main.php?dopost=filemanager' + 'title' => '联动类别管理 ', + 'description' => '创建和管理所有的联动', + 'purview' => 'c_Stepseclect', + 'linkurl' => 'stepselect_main.php?dopost=filemanager' ), 3 => array( - 'title' =>'自由列表管理 ', - 'description' =>'创建不同的列表形式', - 'purview' =>'c_List', - 'linkurl' =>'freelist_main.php' + 'title' => '自由列表管理 ', + 'description' => '创建不同的列表形式', + 'purview' => 'c_List', + 'linkurl' => 'freelist_main.php' ), 4 => array( - 'title' =>'自定义表单 ', - 'description' =>'创建和管理自定义表单', - 'purview' =>'c_List', - 'linkurl' =>'diy_main.php' + 'title' => '自定义表单 ', + 'description' => '创建和管理自定义表单', + 'purview' => 'c_List', + 'linkurl' => 'diy_main.php' ), ) ); $actionSearch[4] = array( - 'toptitle' => '核心', + 'toptitle' => '核心', 'title' => '批量维护', 'description' => '对一些东西进行批量的删除,添加等等', 'soniterm' => array( 0 => array( - 'title' =>'更新系统缓存 ', - 'description' =>'更新栏目缓存、更新枚举缓存 、清理arclist调用缓存 、清理过期会员访问历史 、删除过期短信', - 'purview' =>'sys_ArcBatch', - 'linkurl' =>'sys_cache_up.php' + 'title' => '更新系统缓存 ', + 'description' => '更新栏目缓存、更新枚举缓存 、清理arclist调用缓存 、清理过期会员访问历史 、删除过期短信', + 'purview' => 'sys_ArcBatch', + 'linkurl' => 'sys_cache_up.php' ), 1 => array( - 'title' =>'文档批量维护 ', - 'description' =>'批量的对某个栏目或者全部栏目的内容进行审核文档、更新HTML、移动文档、删除文档', - 'purview' =>'sys_ArcBatch', - 'linkurl' =>'content_batch_up.php' + 'title' => '文档批量维护 ', + 'description' => '批量的对某个栏目或者全部栏目的内容进行审核文档、更新HTML、移动文档、删除文档', + 'purview' => 'sys_ArcBatch', + 'linkurl' => 'content_batch_up.php' ), 2 => array( - 'title' =>'搜索关键词维护 ', - 'description' =>'对已经进行的所有所搜的关键词进行管理', - 'purview' =>'sys_Keyword', - 'linkurl' =>'search_keywords_main.php?dopost=filemanager' + 'title' => '搜索关键词维护 ', + 'description' => '对已经进行的所有所搜的关键词进行管理', + 'purview' => 'sys_Keyword', + 'linkurl' => 'search_keywords_main.php?dopost=filemanager' ), 3 => array( - 'title' =>'文档关键词维护 ', - 'description' =>'对文档中的关键词进行批量的维护', - 'purview' =>'sys_Keyword', - 'linkurl' =>'article_keywords_main.php' + 'title' => '文档关键词维护 ', + 'description' => '对文档中的关键词进行批量的维护', + 'purview' => 'sys_Keyword', + 'linkurl' => 'article_keywords_main.php' ), 4 => array( - 'title' =>'重复文档检测 ', - 'description' =>'可以对网站中出现的重复标题的文档进行处理', - 'purview' =>'sys_ArcBatch', - 'linkurl' =>'article_test_same.php' + 'title' => '重复文档检测 ', + 'description' => '可以对网站中出现的重复标题的文档进行处理', + 'purview' => 'sys_ArcBatch', + 'linkurl' => 'article_test_same.php' ), 5 => array( - 'title' =>'自动摘要|分页 ', - 'description' =>'用于自动更新您系统没有填写摘要的文档的摘要信息或更新没分页的文档的自动分页标识', - 'purview' =>'sys_Keyword', - 'linkurl' =>'article_description_main.php' + 'title' => '自动摘要|分页 ', + 'description' => '用于自动更新您系统没有填写摘要的文档的摘要信息或更新没分页的文档的自动分页标识', + 'purview' => 'sys_Keyword', + 'linkurl' => 'article_description_main.php' ), 6 => array( - 'title' =>'Tag标签管理 ', - 'description' =>'对整个网站的tag进行批量的维护', - 'purview' =>'sys_Keyword', - 'linkurl' =>'tags_main.php' + 'title' => 'Tag标签管理 ', + 'description' => '对整个网站的tag进行批量的维护', + 'purview' => 'sys_Keyword', + 'linkurl' => 'tags_main.php' ), 7 => array( - 'title' =>'数据库内容替换 ', - 'description' =>'可以对数据库中的某张表中的字段进行内容的批量替换', - 'purview' =>'sys_ArcBatch', - 'linkurl' =>'sys_data_replace.php' + 'title' => '数据库内容替换 ', + 'description' => '可以对数据库中的某张表中的字段进行内容的批量替换', + 'purview' => 'sys_ArcBatch', + 'linkurl' => 'sys_data_replace.php' ), ) ); $actionSearch[5] = array( - 'toptitle' => '会员', + 'toptitle' => '会员', 'title' => '会员管理', 'description' => '注册会员及积分等配置管理', 'soniterm' => array( 0 => array( - 'title' =>'注册会员列表', - 'description' =>'所有注册会员的管理项,其中包含修改,删除,查看会员文档以及提升管理员等操作', - 'purview' =>'member_List', - 'linkurl' =>'member_main.php' + 'title' => '注册会员列表', + 'description' => '所有注册会员的管理项,其中包含修改,删除,查看会员文档以及提升管理员等操作', + 'purview' => 'member_List', + 'linkurl' => 'member_main.php' ), 1 => array( - 'title' =>'会员级别设置', - 'description' =>'设置会员的级别,可以通过设计不同会员的访问权限来对会员级别进行一个扩展', - 'purview' =>'member_Type', - 'linkurl' =>'member_rank.php' + 'title' => '会员级别设置', + 'description' => '设置会员的级别,可以通过设计不同会员的访问权限来对会员级别进行一个扩展', + 'purview' => 'member_Type', + 'linkurl' => 'member_rank.php' ), 2 => array( - 'title' =>'积分头衔设置', - 'description' =>'会员积分等级设置,根据会员活动积分对会员进行头衔划分', - 'purview' =>'member_Type', - 'linkurl' =>'member_scores.php' + 'title' => '积分头衔设置', + 'description' => '会员积分等级设置,根据会员活动积分对会员进行头衔划分', + 'purview' => 'member_Type', + 'linkurl' => 'member_scores.php' ), 4 => array( - 'title' =>'会员短信管理', - 'description' =>'会员之间发送的短消息管理,其中包含群发短消息和对单个会员发送短消息两种', - 'purview' =>'member_Type', - 'linkurl' =>'member_pm.php' + 'title' => '会员短信管理', + 'description' => '会员之间发送的短消息管理,其中包含群发短消息和对单个会员发送短消息两种', + 'purview' => 'member_Type', + 'linkurl' => 'member_pm.php' ), ) ); $actionSearch[6] = array( - 'toptitle' => '会员', + 'toptitle' => '会员', 'title' => '支付工具', 'description' => '站点财务相关设置,包含点卡,商店订单等操作', 'soniterm' => array( 0 => array( - 'title' =>'点卡产品分类', - 'description' =>'网站点卡产品分类,可以添加不同点数的点卡产品类型', - 'purview' =>'sys_Data', - 'linkurl' =>'cards_type.php' + 'title' => '点卡产品分类', + 'description' => '网站点卡产品分类,可以添加不同点数的点卡产品类型', + 'purview' => 'sys_Data', + 'linkurl' => 'cards_type.php' ), 1 => array( - 'title' =>'点卡产品管理', - 'description' =>'管理网站点卡,可以在这里生成点卡以及查看点卡的当前状态', - 'purview' =>'sys_Data', - 'linkurl' =>'cards_manage.php' + 'title' => '点卡产品管理', + 'description' => '管理网站点卡,可以在这里生成点卡以及查看点卡的当前状态', + 'purview' => 'sys_Data', + 'linkurl' => 'cards_manage.php' ), 2 => array( - 'title' =>'会员产品分类', - 'description' =>'可以将会员类型进行产品划分,比如出售高级会员1年这种,在这里可以对会员产品进行定义', - 'purview' =>'sys_Data', - 'linkurl' =>'member_type.php' + 'title' => '会员产品分类', + 'description' => '可以将会员类型进行产品划分,比如出售高级会员1年这种,在这里可以对会员产品进行定义', + 'purview' => 'sys_Data', + 'linkurl' => 'member_type.php' ), 3 => array( - 'title' =>'会员消费记录', - 'description' =>'会员在前台进行操作、消费积分的消费记录,同时可以查看消费充值订单的付款情况', - 'purview' =>'sys_Data', - 'linkurl' =>'member_operations.php' + 'title' => '会员消费记录', + 'description' => '会员在前台进行操作、消费积分的消费记录,同时可以查看消费充值订单的付款情况', + 'purview' => 'sys_Data', + 'linkurl' => 'member_operations.php' ), 4 => array( - 'title' =>'商店订单记录', - 'description' =>'前台会员商店提交的订单记录,这里可以对这些订单进行一个统一的管理', - 'purview' =>'sys_Data', - 'linkurl' =>'shops_operations.php' + 'title' => '商店订单记录', + 'description' => '前台会员商店提交的订单记录,这里可以对这些订单进行一个统一的管理', + 'purview' => 'sys_Data', + 'linkurl' => 'shops_operations.php' ), 5 => array( - 'title' =>'支付接口设置', - 'description' =>'商店以及会员产品付款用到的在线付款方式需要设置的支付接口,这里含有常用的接口,例如:支付宝,易宝等', - 'purview' =>'sys_Data', - 'linkurl' =>'sys_payment.php' + 'title' => '支付接口设置', + 'description' => '商店以及会员产品付款用到的在线付款方式需要设置的支付接口,这里含有常用的接口,例如:支付宝,易宝等', + 'purview' => 'sys_Data', + 'linkurl' => 'sys_payment.php' ), 6 => array( - 'title' =>'配货方式设置', - 'description' =>'网站在线商城的送货方式,这里可以对其进行编辑管理', - 'purview' =>'sys_Data', - 'linkurl' =>'shops_delivery.php' + 'title' => '配货方式设置', + 'description' => '网站在线商城的送货方式,这里可以对其进行编辑管理', + 'purview' => 'sys_Data', + 'linkurl' => 'shops_delivery.php' ), 7 => array( - 'title' =>'汇款账号设置', - 'description' =>'银行付款的账号设置,用户可以查看到你的银行付款账号方便支付', - 'purview' =>'sys_Data', - 'linkurl' =>'shops_bank.php' + 'title' => '汇款账号设置', + 'description' => '银行付款的账号设置,用户可以查看到你的银行付款账号方便支付', + 'purview' => 'sys_Data', + 'linkurl' => 'shops_bank.php' ), ) ); $actionSearch[7] = array( - 'toptitle' => '生成', + 'toptitle' => '生成', 'title' => '自动任务', 'description' => '一键生成静态管理', 'soniterm' => array( 0 => array( - 'title' =>'一键更新网站', - 'description' =>'可以一键生成所有静态页面', - 'purview' =>'sys_MakeHtml', - 'linkurl' =>'makehtml_all.php' + 'title' => '一键更新网站', + 'description' => '可以一键生成所有静态页面', + 'purview' => 'sys_MakeHtml', + 'linkurl' => 'makehtml_all.php' ), 1 => array( - 'title' =>'更新系统缓存', - 'description' =>'更新栏目缓存、更新枚举缓存、清理arclist调用缓存、清理过期会员访问历史、删除过期短信 ', - 'purview' =>'sys_ArcBatch', - 'linkurl' =>'sys_cache_up.php' + 'title' => '更新系统缓存', + 'description' => '更新栏目缓存、更新枚举缓存、清理arclist调用缓存、清理过期会员访问历史、删除过期短信 ', + 'purview' => 'sys_ArcBatch', + 'linkurl' => 'sys_cache_up.php' ), ) ); $actionSearch[8] = array( - 'toptitle' => '生成', + 'toptitle' => '生成', 'title' => 'HTML更新', 'description' => '针对主页、栏目、文档、专题等等进行更新', 'soniterm' => array( 0 => array( - 'title' =>'更新主页HTML', - 'description' =>'生成网站主页面的HTML', - 'purview' =>'sys_MakeHtml', - 'linkurl' =>'makehtml_homepage.php' + 'title' => '更新主页HTML', + 'description' => '生成网站主页面的HTML', + 'purview' => 'sys_MakeHtml', + 'linkurl' => 'makehtml_homepage.php' ), 1 => array( - 'title' =>'更新栏目 HTML', - 'description' =>'对每个栏目进行静态HTML页面的生成', - 'purview' =>'sys_MakeHtml', - 'linkurl' =>'makehtml_list.php' + 'title' => '更新栏目 HTML', + 'description' => '对每个栏目进行静态HTML页面的生成', + 'purview' => 'sys_MakeHtml', + 'linkurl' => 'makehtml_list.php' ), 2 => array( - 'title' =>'更新文档HTML', - 'description' =>'对每个栏目下的文档进行静态HTML页面的生成', - 'purview' =>'sys_MakeHtml', - 'linkurl' =>'makehtml_archives.php' - ), + 'title' => '更新文档HTML', + 'description' => '对每个栏目下的文档进行静态HTML页面的生成', + 'purview' => 'sys_MakeHtml', + 'linkurl' => 'makehtml_archives.php' + ), 3 => array( - 'title' =>'更新网站地图', - 'description' =>'生成网站地图的静态HTML页面', - 'purview' =>'sys_MakeHtml', - 'linkurl' =>'makehtml_map_guide.php' + 'title' => '更新网站地图', + 'description' => '生成网站地图的静态HTML页面', + 'purview' => 'sys_MakeHtml', + 'linkurl' => 'makehtml_map_guide.php' ), 4 => array( - 'title' =>'更新RSS文件 HTML', - 'description' =>'对全站的RSS进行更新', - 'purview' =>'sys_MakeHtml', - 'linkurl' =>'makehtml_rss.php' + 'title' => '更新RSS文件 HTML', + 'description' => '对全站的RSS进行更新', + 'purview' => 'sys_MakeHtml', + 'linkurl' => 'makehtml_rss.php' ), 5 => array( - 'title' =>'获取JS文件', - 'description' =>'可以获取某个栏目的js连接', - 'purview' =>'sys_MakeHtml', - 'linkurl' =>'makehtml_js.php' + 'title' => '获取JS文件', + 'description' => '可以获取某个栏目的js连接', + 'purview' => 'sys_MakeHtml', + 'linkurl' => 'makehtml_js.php' ), 6 => array( - 'title' =>'更新专题 HTML', - 'description' =>'对专题进行静态HTML页面的生成', - 'purview' =>'sys_MakeHtml', - 'linkurl' =>'makehtml_spec.php' + 'title' => '更新专题 HTML', + 'description' => '对专题进行静态HTML页面的生成', + 'purview' => 'sys_MakeHtml', + 'linkurl' => 'makehtml_spec.php' ), ) ); $actionSearch[9] = array( - 'toptitle' => '模板', + 'toptitle' => '模板', 'title' => '模板管理', 'description' => '针对主页、栏目、文档、专题等等进行更新', 'soniterm' => array( 0 => array( - 'title' =>'默认模板管理 ', - 'description' =>'对网站正在采用的模板文件进行管理', - 'purview' =>'temp_All', - 'linkurl' =>'templets_main.php' + 'title' => '默认模板管理 ', + 'description' => '对网站正在采用的模板文件进行管理', + 'purview' => 'temp_All', + 'linkurl' => 'templets_main.php' ), 1 => array( - 'title' =>'标签源码管理 ', - 'description' =>'对现有的标签文件进行修改、添加', - 'purview' =>'temp_All', - 'linkurl' =>'templets_tagsource.php' + 'title' => '标签源码管理 ', + 'description' => '对现有的标签文件进行修改、添加', + 'purview' => 'temp_All', + 'linkurl' => 'templets_tagsource.php' ), 2 => array( - 'title' =>'自定义宏标记', - 'description' =>'管理自定义标记', - 'purview' =>'temp_MyTag', - 'linkurl' =>'mytag_main.php' - ), + 'title' => '自定义宏标记', + 'description' => '管理自定义标记', + 'purview' => 'temp_MyTag', + 'linkurl' => 'mytag_main.php' + ), 3 => array( - 'title' =>'智能标记向导', - 'description' =>'可以根据需要生成相应的调用标签', - 'purview' =>'temp_Other', - 'linkurl' =>'mytag_tag_guide.php' + 'title' => '智能标记向导', + 'description' => '可以根据需要生成相应的调用标签', + 'purview' => 'temp_Other', + 'linkurl' => 'mytag_tag_guide.php' ), 4 => array( - 'title' =>'全局标记测试 ', - 'description' =>'可以对全局的标签调用进行测试', - 'purview' =>'temp_Test', - 'linkurl' =>'tag_test.php' + 'title' => '全局标记测试 ', + 'description' => '可以对全局的标签调用进行测试', + 'purview' => 'temp_Test', + 'linkurl' => 'tag_test.php' ), ) ); $actionSearch[10] = array( - 'toptitle' => '系统', + 'toptitle' => '系统', 'title' => '系统设置', 'description' => '对网站的一些基本信息和配置进行管理', 'soniterm' => array( 0 => array( - 'title' =>'系统基本参数', - 'description' =>'包含站点设置、核心设置 、附件设置、会员设置、互动设置、性能选项、其它选项、模块设置、添加新变量等分类,其中有网站基本信息和网站的基本设置选项', - 'purview' =>'sys_Edit', - 'linkurl' =>'sys_info.php' + 'title' => '系统基本参数', + 'description' => '包含站点设置、核心设置 、附件设置、会员设置、互动设置、性能选项、其它选项、模块设置、添加新变量等分类,其中有网站基本信息和网站的基本设置选项', + 'purview' => 'sys_Edit', + 'linkurl' => 'sys_info.php' ), 1 => array( - 'title' =>'系统用户管理', - 'description' =>'对现有的网站管理员进行管理', - 'purview' =>'sys_User', - 'linkurl' =>'sys_admin_user.php' + 'title' => '系统用户管理', + 'description' => '对现有的网站管理员进行管理', + 'purview' => 'sys_User', + 'linkurl' => 'sys_admin_user.php' ), 2 => array( - 'title' =>'用户组设定', - 'description' =>'对网站管理员进行用户组别的划分', - 'purview' =>'sys_Group', - 'linkurl' =>'sys_group.php' + 'title' => '用户组设定', + 'description' => '对网站管理员进行用户组别的划分', + 'purview' => 'sys_Group', + 'linkurl' => 'sys_group.php' ), 3 => array( - 'title' =>'系统日志管理', - 'description' =>'对每个登录后台的管理员进行的操作进行记录', - 'purview' =>'sys_Log', - 'linkurl' =>'log_list.php' + 'title' => '系统日志管理', + 'description' => '对每个登录后台的管理员进行的操作进行记录', + 'purview' => 'sys_Log', + 'linkurl' => 'log_list.php' ), 5 => array( - 'title' =>'图片水印设置', - 'description' =>'对于上传的图片添加的水印进行配置', - 'purview' =>'sys_Edit', - 'linkurl' =>'sys_info_mark.php' + 'title' => '图片水印设置', + 'description' => '对于上传的图片添加的水印进行配置', + 'purview' => 'sys_Edit', + 'linkurl' => 'sys_info_mark.php' ), 6 => array( - 'title' =>'自定义文档属性', - 'description' =>'在以往的版本中,网站主页、频道封面的设计,都只能单调的用 arclist 标记把某栏目最新或按特定排序方式的文档无选择的读出来,这样做法存在很大的不足,在发布的时候对适合的文档选择专门的属性,那么使用arclist的地方就会按您的意愿显示指定的文档。', - 'purview' =>'sys_Att', - 'linkurl' =>'content_att.php' + 'title' => '自定义文档属性', + 'description' => '在以往的版本中,网站主页、频道封面的设计,都只能单调的用 arclist 标记把某栏目最新或按特定排序方式的文档无选择的读出来,这样做法存在很大的不足,在发布的时候对适合的文档选择专门的属性,那么使用arclist的地方就会按您的意愿显示指定的文档。', + 'purview' => 'sys_Att', + 'linkurl' => 'content_att.php' ), 7 => array( - 'title' =>'软件频道设置', - 'description' =>'可以对软件下载时的连接显示方式,下载方式,镜像服务器等等进行配置', - 'purview' =>'sys_SoftConfig', - 'linkurl' =>'soft_config.php' + 'title' => '软件频道设置', + 'description' => '可以对软件下载时的连接显示方式,下载方式,镜像服务器等等进行配置', + 'purview' => 'sys_SoftConfig', + 'linkurl' => 'soft_config.php' ), 8 => array( - 'title' =>'防采集串混淆', - 'description' =>'防采集混淆字符串管理', - 'purview' =>'sys_StringMix', - 'linkurl' =>'article_string_mix.php' + 'title' => '防采集串混淆', + 'description' => '防采集混淆字符串管理', + 'purview' => 'sys_StringMix', + 'linkurl' => 'article_string_mix.php' ), 9 => array( - 'title' =>'随机模板设置', - 'description' =>'本设置仅适用于系统默认的文章模型,设置后发布文章时会自动按指定的模板随机获取一个,如果不想使用此功能,把它设置为空即可!', - 'purview' =>'sys_StringMix', - 'linkurl' =>'article_template_rand.php' + 'title' => '随机模板设置', + 'description' => '本设置仅适用于系统默认的文章模型,设置后发布文章时会自动按指定的模板随机获取一个,如果不想使用此功能,把它设置为空即可!', + 'purview' => 'sys_StringMix', + 'linkurl' => 'article_template_rand.php' ), 10 => array( - 'title' =>'计划任务管理', - 'description' =>'可以添加一个指定时间运行的程序', - 'purview' =>'sys_task', - 'linkurl' =>'sys_task.php' + 'title' => '计划任务管理', + 'description' => '可以添加一个指定时间运行的程序', + 'purview' => 'sys_task', + 'linkurl' => 'sys_task.php' ), 11 => array( - 'title' =>'数据库备份/还原', - 'description' =>'对数据库进行备份和还原', - 'purview' =>'sys_data', - 'linkurl' =>'sys_data.php' + 'title' => '数据库备份/还原', + 'description' => '对数据库进行备份和还原', + 'purview' => 'sys_data', + 'linkurl' => 'sys_data.php' ), 12 => array( - 'title' =>'SQL命令行工具', - 'description' =>'可以在针对每张数据表执行单行或者多行的SQL语句', - 'purview' =>'sys_data', - 'linkurl' =>'sys_sql_query.php' + 'title' => 'SQL命令行工具', + 'description' => '可以在针对每张数据表执行单行或者多行的SQL语句', + 'purview' => 'sys_data', + 'linkurl' => 'sys_sql_query.php' ), 14 => array( - 'title' =>'病毒扫描[S]', - 'description' =>'以DedeCMS开发模式为标准对现有的文件进行扫描并进行判断', - 'purview' =>'sys_verifies', - 'linkurl' =>'sys_safetest.php' + 'title' => '病毒扫描[S]', + 'description' => '以DedeCMSV6开发模式为标准对现有的文件进行扫描并进行判断', + 'purview' => 'sys_verifies', + 'linkurl' => 'sys_safetest.php' ), 15 => array( - 'title' =>'系统错误修复[S]', - 'description' =>'由于手动升级时用户没运行指定的SQL语句,或自动升级的遗漏处理或处理出错,可能会导致一些错误,使用本工具会自动检测并处理。', - 'purview' =>'sys_verifies', - 'linkurl' =>'sys_repair.php' + 'title' => '系统错误修复[S]', + 'description' => '由于手动升级时用户没运行指定的SQL语句,或自动升级的遗漏处理或处理出错,可能会导致一些错误,使用本工具会自动检测并处理。', + 'purview' => 'sys_verifies', + 'linkurl' => 'sys_repair.php' ), ) ); $actionSearch[11] = array( - 'toptitle' => '采集', + 'toptitle' => '采集', 'title' => '采集管理', 'description' => '内容采集管理操作', 'soniterm' => array( 0 => array( - 'title' =>'采集节点管理 ', - 'description' =>'单个采集节点的管理页面,可以添加采集,导入,导出采集节点等', - 'purview' =>'co_ListNote', - 'linkurl' =>'co_main.php' + 'title' => '采集节点管理 ', + 'description' => '单个采集节点的管理页面,可以添加采集,导入,导出采集节点等', + 'purview' => 'co_ListNote', + 'linkurl' => 'co_main.php' ), 1 => array( - 'title' =>'临时内容管理 ', - 'description' =>'采集的临时内容存放处', - 'purview' =>'co_ViewNote', - 'linkurl' =>'co_url.php' + 'title' => '临时内容管理 ', + 'description' => '采集的临时内容存放处', + 'purview' => 'co_ViewNote', + 'linkurl' => 'co_url.php' ), 2 => array( - 'title' =>'导入采集规则', - 'description' =>'导入采集的规则', - 'purview' =>'co_GetOut', - 'linkurl' =>'co_get_corule.php' - ), + 'title' => '导入采集规则', + 'description' => '导入采集的规则', + 'purview' => 'co_GetOut', + 'linkurl' => 'co_get_corule.php' + ), 3 => array( - 'title' =>'智能标记向导', - 'description' =>'可以根据需要生成相应的调用标签', - 'purview' =>'temp_Other', - 'linkurl' =>'mytag_tag_guide.php' + 'title' => '智能标记向导', + 'description' => '可以根据需要生成相应的调用标签', + 'purview' => 'temp_Other', + 'linkurl' => 'mytag_tag_guide.php' ), 4 => array( - 'title' =>'监控采集模式 ', - 'description' =>'监控采集模式', - 'purview' =>'co_GetOut', - 'linkurl' =>'co_gather_start.php' + 'title' => '监控采集模式 ', + 'description' => '监控采集模式', + 'purview' => 'co_GetOut', + 'linkurl' => 'co_gather_start.php' ), 5 => array( - 'title' =>'采集未下载内容 ', - 'description' =>'采集没有下载完成的内容', - 'purview' =>'co_GetOut', - 'linkurl' =>'co_do.php?dopost=coall' + 'title' => '采集未下载内容 ', + 'description' => '采集没有下载完成的内容', + 'purview' => 'co_GetOut', + 'linkurl' => 'co_do.php?dopost=coall' ), ) -); \ No newline at end of file +); diff --git a/src/dede/inc/inc_archives_all.php b/src/dede/inc/inc_archives_all.php index aed58d30..80c5517e 100755 --- a/src/dede/inc/inc_archives_all.php +++ b/src/dede/inc/inc_archives_all.php @@ -1,14 +1,15 @@ \r\n"; $innertext = trim($ctag->GetInnerText()); - if($innertext != "") - { - if($ctag->GetAtt("type") == 'select') - { + if ($innertext != "") { + if ($ctag->GetAtt("type") == 'select') { $myformItem = ''; $items = explode(',', $innertext); $myformItem = "\r\n"; $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); - $formitem = str_replace("~form~", $myformItem,$formitem); + $formitem = str_replace("~form~", $myformItem, $formitem); return $formitem; - } - else if($ctag->GetAtt("type") == 'radio') - { + } else if ($ctag->GetAtt("type") == 'radio') { $myformItem = ''; $items = explode(',', $innertext); - foreach($items as $v) - { + foreach ($items as $v) { $v = trim($v); $i = 0; - if($v!='') - { - if($i==0) - { + if ($v != '') { + if ($i == 0) { $myformItem .= "\r\n"; - } - else - { + } else { $myformItem .= "\r\n"; } } } $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); - $formitem = str_replace("~form~", $myformItem,$formitem); + $formitem = str_replace("~form~", $myformItem, $formitem); return $formitem; - } - else - { + } else { $formitem = str_replace('~name~', $ctag->GetAtt('itemname'), $formitem); - $formitem = str_replace('~form~', $innertext,$formitem); + $formitem = str_replace('~form~', $innertext, $formitem); $formitem = str_replace('@value', '', $formitem); return $formitem; } } - if($ctag->GetAtt("type")=="htmltext"||$ctag->GetAtt("type")=="textdata") - { + if ($ctag->GetAtt("type") == "htmltext" || $ctag->GetAtt("type") == "textdata") { $formitem = ""; - $formitem .= "
".$ctag->GetAtt('itemname').""; - $formitem .= GetEditor($fieldname,'',350,'Basic','string'); + $formitem .= "
" . $ctag->GetAtt('itemname') . ""; + $formitem .= GetEditor($fieldname, '', 350, 'Basic', 'string'); $formitem .= "
\r\n"; return $formitem; - } - else if($ctag->GetAtt("type")=="multitext") - { + } else if ($ctag->GetAtt("type") == "multitext") { $innertext = "\r\n"; - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; - } - else if($ctag->GetAtt("type")=="datetime") - { + } else if ($ctag->GetAtt("type") == "datetime") { $nowtime = GetDateTimeMk(time()); $innertext = ""; $innertext .= ""; - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; - } - else if($ctag->GetAtt("type")=="img") - { - $innertext = "\r\n"; - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + } else if ($ctag->GetAtt("type") == "img") { + $innertext = "\r\n"; + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; - } - else if($ctag->GetAtt("type")=="media") - { - $innertext = "\r\n"; - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + } else if ($ctag->GetAtt("type") == "media") { + $innertext = "\r\n"; + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; - } - else if($ctag->GetAtt("type")=="addon") - { - $innertext = "\r\n"; - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + } else if ($ctag->GetAtt("type") == "addon") { + $innertext = "\r\n"; + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; - } - else if($ctag->GetAtt("type")=="media") - { - $innertext = "\r\n"; - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + } else if ($ctag->GetAtt("type") == "media") { + $innertext = "\r\n"; + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; - } - else if ($ctag->GetAtt("type")=="relation") { + } else if ($ctag->GetAtt("type") == "relation") { $innertext = "\r\n"; - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; - } - else - { - if($ctag->GetAtt('default')!="") $dfvalue = $ctag->GetAtt('default'); + } else { + if ($ctag->GetAtt('default') != "") $dfvalue = $ctag->GetAtt('default'); else $dfvalue = ""; $innertext = "\r\n"; - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; } } @@ -159,103 +131,77 @@ function GetFormItem($ctag) * @param string $addvar 增加值 * @return string */ -function GetFieldValue($dvalue,$dtype,$aid=0,$job='add',$addvar='') +function GetFieldValue($dvalue, $dtype, $aid = 0, $job = 'add', $addvar = '') { - global $cfg_cookie_encode,$cfg_dir_purview,$isUrlOpen; - if($dtype=="int") - { + global $cfg_cookie_encode, $cfg_dir_purview, $isUrlOpen; + if ($dtype == "int") { $dvalue = trim(preg_replace("#[^0-9]#", "", $dvalue)); - if($dvalue=="") $dvalue = 0; + if ($dvalue == "") $dvalue = 0; return $dvalue; - } - else if($dtype=="float") - { + } else if ($dtype == "float") { $dvalue = trim(preg_replace("#[^0-9\.]#", "", $dvalue)); - if($dvalue=="") $dvalue = 0; + if ($dvalue == "") $dvalue = 0; return $dvalue; - } - else if($dtype=="datetime") - { + } else if ($dtype == "datetime") { return GetMkTime($dvalue); - } - else if($dtype=="textdata") - { - if($job=='edit') - { + } else if ($dtype == "textdata") { + if ($job == 'edit') { $addvarDirs = explode('/', $addvar); - $addvarDir = preg_replace("#\/".$addvarDirs[count($addvarDirs)-1]."$#", "", $addvar); - $mdir = $GLOBALS['cfg_basedir'].$addvarDir; - if(!is_dir($mdir)) - { + $addvarDir = preg_replace("#\/" . $addvarDirs[count($addvarDirs) - 1] . "$#", "", $addvar); + $mdir = $GLOBALS['cfg_basedir'] . $addvarDir; + if (!is_dir($mdir)) { MkdirAll($mdir, $GLOBALS['cfg_dir_purview']); } - $fp = fopen($GLOBALS['cfg_basedir'].$addvar, "w"); + $fp = fopen($GLOBALS['cfg_basedir'] . $addvar, "w"); fwrite($fp, stripslashes($dvalue)); fclose($fp); CloseFtp(); return $addvar; - } - else - { - $ipath = $GLOBALS['cfg_cmspath']."/data/textdata"; - $tpath = ceil($aid/5000); - if(!is_dir($GLOBALS['cfg_basedir'].$ipath)) - { - MkdirAll($GLOBALS['cfg_basedir'].$ipath,$cfg_dir_purview); + } else { + $ipath = $GLOBALS['cfg_cmspath'] . "/data/textdata"; + $tpath = ceil($aid / 5000); + if (!is_dir($GLOBALS['cfg_basedir'] . $ipath)) { + MkdirAll($GLOBALS['cfg_basedir'] . $ipath, $cfg_dir_purview); } - if(!is_dir($GLOBALS['cfg_basedir'].$ipath.'/'.$tpath)) - { - MkdirAll($GLOBALS['cfg_basedir'].$ipath.'/'.$tpath,$cfg_dir_purview); + if (!is_dir($GLOBALS['cfg_basedir'] . $ipath . '/' . $tpath)) { + MkdirAll($GLOBALS['cfg_basedir'] . $ipath . '/' . $tpath, $cfg_dir_purview); } - $ipath = $ipath.'/'.$tpath; - $filename = "{$ipath}/{$aid}-".cn_substr(md5($cfg_cookie_encode), 0, 16).".txt"; - $fp = fopen($GLOBALS['cfg_basedir'].$filename,"w"); + $ipath = $ipath . '/' . $tpath; + $filename = "{$ipath}/{$aid}-" . cn_substr(md5($cfg_cookie_encode), 0, 16) . ".txt"; + $fp = fopen($GLOBALS['cfg_basedir'] . $filename, "w"); fwrite($fp, stripslashes($dvalue)); fclose($fp); CloseFtp(); return $filename; } - } - else if($dtype=="img") - { + } else if ($dtype == "img") { $iurl = stripslashes($dvalue); - if(trim($iurl)=="") - { + if (trim($iurl) == "") { return ""; } - $iurl = trim(str_replace($GLOBALS['cfg_basehost'],"",$iurl)); - $imgurl = "{dede:img text='' width='' height=''} ".$iurl." {/dede:img}"; - if(preg_match("#^http:\/\/#i", $iurl) && $GLOBALS['isUrlOpen']) - { + $iurl = trim(str_replace($GLOBALS['cfg_basehost'], "", $iurl)); + $imgurl = "{dede:img text='' width='' height=''} " . $iurl . " {/dede:img}"; + if (preg_match("#^http:\/\/#i", $iurl) && $GLOBALS['isUrlOpen']) { //远程图片 $reimgs = ""; - if($isUrlOpen) - { - $reimgs = GetRemoteImage($iurl,$GLOBALS['adminid']); - if(is_array($reimgs)) - { - $imgurl = "{dede:img text='' width='".$reimgs[1]."' height='".$reimgs[2]."'} ".$reimgs[0]." {/dede:img}"; + if ($isUrlOpen) { + $reimgs = GetRemoteImage($iurl, $GLOBALS['adminid']); + if (is_array($reimgs)) { + $imgurl = "{dede:img text='' width='" . $reimgs[1] . "' height='" . $reimgs[2] . "'} " . $reimgs[0] . " {/dede:img}"; } + } else { + $imgurl = "{dede:img text='' width='' height=''} " . $iurl . " {/dede:img}"; } - else - { - $imgurl = "{dede:img text='' width='' height=''} ".$iurl." {/dede:img}"; - } - } - else if($iurl!="") - { + } else if ($iurl != "") { //站内图片 - $imgfile = $GLOBALS['cfg_basedir'].$iurl; - if(is_file($imgfile)) - { + $imgfile = $GLOBALS['cfg_basedir'] . $iurl; + if (is_file($imgfile)) { $imginfos = GetImageSize($imgfile); - $imgurl = "{dede:img text='' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}"; + $imgurl = "{dede:img text='' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $iurl {/dede:img}"; } } return addslashes($imgurl); - } - else - { + } else { return $dvalue; } } @@ -280,58 +226,42 @@ function GetFormItemValue($ctag, $fvalue)
\r\n"; $innertext = trim($ctag->GetInnerText()); - if($innertext != "") - { - if($ctag->GetAtt("type") == 'select') - { + if ($innertext != "") { + if ($ctag->GetAtt("type") == 'select') { $myformItem = ''; $items = explode(',', $innertext); $myformItem = "\r\n"; $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); - $formitem = str_replace("~form~", $myformItem,$formitem); + $formitem = str_replace("~form~", $myformItem, $formitem); return $formitem; - } - else if($ctag->GetAtt("type")=='radio') - { + } else if ($ctag->GetAtt("type") == 'radio') { $myformItem = ''; $items = explode(',', $innertext); - foreach($items as $v) - { + foreach ($items as $v) { $v = trim($v); - if($v!='') - { - if($fvalue==$v) - { - $myformItem.= "\r\n"; - } - else - { - $myformItem.= "\r\n"; + if ($v != '') { + if ($fvalue == $v) { + $myformItem .= "\r\n"; + } else { + $myformItem .= "\r\n"; } } } $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); - $formitem = str_replace("~form~", $myformItem,$formitem); + $formitem = str_replace("~form~", $myformItem, $formitem); return $formitem; - } - else - { + } else { $formitem = str_replace('~name~', $ctag->GetAtt('itemname'), $formitem); $formitem = str_replace('~form~', $innertext, $formitem); $formitem = str_replace('@value', $fvalue, $formitem); @@ -340,86 +270,66 @@ function GetFormItemValue($ctag, $fvalue) } //文本数据的特殊处理 - if($ctag->GetAtt("type")=="textdata") - { - if(is_file($GLOBALS['cfg_basedir'].$fvalue)) - { - $fp = fopen($GLOBALS['cfg_basedir'].$fvalue, 'r'); + if ($ctag->GetAtt("type") == "textdata") { + if (is_file($GLOBALS['cfg_basedir'] . $fvalue)) { + $fp = fopen($GLOBALS['cfg_basedir'] . $fvalue, 'r'); $okfvalue = ""; - while(!feof($fp)) - { - $okfvalue .= fgets($fp,1024); + while (!feof($fp)) { + $okfvalue .= fgets($fp, 1024); } fclose($fp); + } else { + $okfvalue = ""; } - else - { - $okfvalue=""; - } - $formitem = "\r\n"; - $formitem .= "\r\n"; + $formitem = "
".$ctag->GetAtt('itemname')."\r\n".GetEditor($fieldname,$okfvalue,350,'Basic','string')."
\r\n"; + $formitem .= "\r\n"; $formitem .= "
" . $ctag->GetAtt('itemname') . "\r\n" . GetEditor($fieldname, $okfvalue, 350, 'Basic', 'string') . "
\r\n"; $formitem .= "\r\n"; return $formitem; - } - else if($ctag->GetAtt("type")=="htmltext") - { - $formitem = "\r\n"; - $formitem .= "\r\n"; + } else if ($ctag->GetAtt("type") == "htmltext") { + $formitem = "
".$ctag->GetAtt('itemname')."\r\n".GetEditor($fieldname,$fvalue,350,'Basic','string')."
\r\n"; + $formitem .= "\r\n"; $formitem .= "
" . $ctag->GetAtt('itemname') . "\r\n" . GetEditor($fieldname, $fvalue, 350, 'Basic', 'string') . "
\r\n"; return $formitem; - } - else if($ctag->GetAtt("type")=="multitext") - { + } else if ($ctag->GetAtt("type") == "multitext") { $innertext = "\r\n"; - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; - } - else if($ctag->GetAtt("type")=="datetime") - { + } else if ($ctag->GetAtt("type") == "datetime") { $nowtime = GetDateTimeMk($fvalue); $innertext = ""; $innertext .= ""; - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; - } - else if($ctag->GetAtt("type")=="img") - { + } else if ($ctag->GetAtt("type") == "img") { $ndtp = new DedeTagParse(); $ndtp->LoadSource($fvalue); - if(!is_array($ndtp->CTags)) - { + if (!is_array($ndtp->CTags)) { $ndtp->Clear(); $fvalue = ""; } $ntag = $ndtp->GetTag("img"); $fvalue = trim($ntag->GetInnerText()); - $innertext = "\r\n"; - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + $innertext = "\r\n"; + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; - } - else if($ctag->GetAtt("type")=="media") - { - $innertext = "\r\n"; - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + } else if ($ctag->GetAtt("type") == "media") { + $innertext = "\r\n"; + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; - } - else if($ctag->GetAtt("type")=="addon") - { - $innertext = "\r\n"; - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + } else if ($ctag->GetAtt("type") == "addon") { + $innertext = "\r\n"; + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; - } - else - { + } else { $innertext = "\r\n"; - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; } -} \ No newline at end of file +} diff --git a/src/dede/inc/inc_archives_functions.php b/src/dede/inc/inc_archives_functions.php index 4c6b3898..3f30a3e8 100755 --- a/src/dede/inc/inc_archives_functions.php +++ b/src/dede/inc/inc_archives_functions.php @@ -4,7 +4,7 @@ * 文档操作相关函数 * * @version $Id: inc_archives_functions.php 1 9:56 2010年7月21日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/dede/inc/inc_batchup.php b/src/dede/inc/inc_batchup.php index e12bb5dc..e8247970 100755 --- a/src/dede/inc/inc_batchup.php +++ b/src/dede/inc/inc_batchup.php @@ -1,14 +1,15 @@ GetOne($query); $nid = $row['nid']; - $maintable = (trim($row['maintable'])=='' ? '#@__archives' : trim($row['maintable'])); + $maintable = (trim($row['maintable']) == '' ? '#@__archives' : trim($row['maintable'])); $addtable = trim($row['addtable']); $issystem = $row['issystem']; //查询档案信息 - if($issystem==-1) - { + if ($issystem == -1) { $arcQuery = "SELECT arc.*,tp.* from `$addtable` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id WHERE arc.aid='$aid' "; - } - else - { + } else { $arcQuery = "SELECT arc.*,tp.*,arc.id AS aid FROM `$maintable` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id WHERE arc.id='$aid' "; } $arcRow = $dsql->GetOne($arcQuery); //检测权限 - if(!TestPurview('a_Del,sys_ArcBatch')) - { - if(TestPurview('a_AccDel')) - { - if( !in_array($arcRow['typeid'], $admin_catalogs) && (count($admin_catalogs) != 0 || $cfg_admin_channel != 'all') ) - { + if (!TestPurview('a_Del,sys_ArcBatch')) { + if (TestPurview('a_AccDel')) { + if (!in_array($arcRow['typeid'], $admin_catalogs) && (count($admin_catalogs) != 0 || $cfg_admin_channel != 'all')) { return FALSE; } - } - else if(TestPurview('a_MyDel')) - { - if($arcRow['mid'] != $cuserLogin->getUserID()) - { + } else if (TestPurview('a_MyDel')) { + if ($arcRow['mid'] != $cuserLogin->getUserID()) { return FALSE; } - } - else - { + } else { return FALSE; } } //$issystem==-1 是单表模型,不使用回收站 - if($issystem == -1) $type = 'OK'; - if(!is_array($arcRow)) return FALSE; - + if ($issystem == -1) $type = 'OK'; + if (!is_array($arcRow)) return FALSE; + /** 删除到回收站 **/ - if($cfg_delete == 'Y' && $type == 'ON') - { + if ($cfg_delete == 'Y' && $type == 'ON') { $dsql->ExecuteNoneQuery("UPDATE `$maintable` SET arcrank='-2' WHERE id='$aid' "); $dsql->ExecuteNoneQuery("UPDATE `#@__arctiny` SET `arcrank` = '-2' WHERE id = '$aid'; "); - } - else - { + } else { //删除数据库记录 - if(!$onlyfile) - { + if (!$onlyfile) { $query = "Delete From `#@__arctiny` where id='$aid' $whererecycle"; - if($dsql->ExecuteNoneQuery($query)) - { + if ($dsql->ExecuteNoneQuery($query)) { $dsql->ExecuteNoneQuery("Delete From `#@__feedback` where aid='$aid' "); $dsql->ExecuteNoneQuery("Delete From `#@__member_stow` where aid='$aid' "); $dsql->ExecuteNoneQuery("Delete From `#@__taglist` where aid='$aid' "); $dsql->ExecuteNoneQuery("Delete From `#@__erradd` where aid='$aid' "); - if($addtable != '') - { + if ($addtable != '') { $dsql->ExecuteNoneQuery("Delete From `$addtable` where aid='$aid'"); } - if($issystem != -1) - { + if ($issystem != -1) { $dsql->ExecuteNoneQuery("Delete From `#@__archives` where id='$aid' $whererecycle"); } //删除相关附件 - if($cfg_upload_switch == 'Y') - { + if ($cfg_upload_switch == 'Y') { $dsql->Execute("me", "SELECT * FROM `#@__uploads` WHERE arcid = '$aid'"); - while($row = $dsql->GetArray('me')) - { + while ($row = $dsql->GetArray('me')) { $addfile = $row['url']; $aid = $row['aid']; $dsql->ExecuteNoneQuery("Delete From `#@__uploads` where aid = '$aid' "); - $upfile = $cfg_basedir.$addfile; - if(@file_exists($upfile)) @unlink($upfile); + $upfile = $cfg_basedir . $addfile; + if (@file_exists($upfile)) @unlink($upfile); } } } } //删除文本数据 - $filenameh = DEDEDATA."/textdata/".(ceil($aid/5000))."/{$aid}-".substr(md5($cfg_cookie_encode),0,16).".txt"; - if(@is_file($filenameh)) @unlink($filenameh); - + $filenameh = DEDEDATA . "/textdata/" . (ceil($aid / 5000)) . "/{$aid}-" . substr(md5($cfg_cookie_encode), 0, 16) . ".txt"; + if (@is_file($filenameh)) @unlink($filenameh); } - - if(empty($arcRow['money'])) $arcRow['money'] = 0; - if(empty($arcRow['ismake'])) $arcRow['ismake'] = 1; - if(empty($arcRow['arcrank'])) $arcRow['arcrank'] = 0; - if(empty($arcRow['filename'])) $arcRow['filename'] = ''; + + if (empty($arcRow['money'])) $arcRow['money'] = 0; + if (empty($arcRow['ismake'])) $arcRow['ismake'] = 1; + if (empty($arcRow['arcrank'])) $arcRow['arcrank'] = 0; + if (empty($arcRow['filename'])) $arcRow['filename'] = ''; //删除HTML - if($arcRow['ismake']==-1 || $arcRow['arcrank']!=0 || $arcRow['typeid']==0 || $arcRow['money']>0) - { + if ($arcRow['ismake'] == -1 || $arcRow['arcrank'] != 0 || $arcRow['typeid'] == 0 || $arcRow['money'] > 0) { return TRUE; } //强制转换非多站点模式,以便统一方式获得实际HTML文件 $GLOBALS['cfg_multi_site'] = 'N'; - $arcurl = GetFileUrl($arcRow['aid'],$arcRow['typeid'],$arcRow['senddate'],$arcRow['title'],$arcRow['ismake'], - $arcRow['arcrank'],$arcRow['namerule'],$arcRow['typedir'],$arcRow['money'],$arcRow['filename']); - if(!preg_match("#\?#", $arcurl)) - { - $htmlfile = GetTruePath().str_replace($GLOBALS['cfg_basehost'],'',$arcurl); - if(file_exists($htmlfile) && !is_dir($htmlfile)) - { + $arcurl = GetFileUrl( + $arcRow['aid'], + $arcRow['typeid'], + $arcRow['senddate'], + $arcRow['title'], + $arcRow['ismake'], + $arcRow['arcrank'], + $arcRow['namerule'], + $arcRow['typedir'], + $arcRow['money'], + $arcRow['filename'] + ); + if (!preg_match("#\?#", $arcurl)) { + $htmlfile = GetTruePath() . str_replace($GLOBALS['cfg_basehost'], '', $arcurl); + if (file_exists($htmlfile) && !is_dir($htmlfile)) { @unlink($htmlfile); $arcurls = explode(".", $htmlfile); - $sname = $arcurls[count($arcurls)-1]; + $sname = $arcurls[count($arcurls) - 1]; $fname = preg_replace("#(\.$sname)$#", "", $htmlfile); - for($i=2; $i<=100; $i++) - { - $htmlfile = $fname."_{$i}.".$sname; - if( @file_exists($htmlfile) ) @unlink($htmlfile); + for ($i = 2; $i <= 100; $i++) { + $htmlfile = $fname . "_{$i}." . $sname; + if (@file_exists($htmlfile)) @unlink($htmlfile); else break; } } @@ -164,8 +150,8 @@ function DelArc($aid, $type='ON', $onlyfile=FALSE,$recycle=0) } //获取真实路径 -function GetTruePath($siterefer='', $sitepath='') +function GetTruePath($siterefer = '', $sitepath = '') { $truepath = $GLOBALS['cfg_basedir']; return $truepath; -} \ No newline at end of file +} diff --git a/src/dede/inc/inc_catalog_options.php b/src/dede/inc/inc_catalog_options.php index f8255ccb..9e0904e9 100755 --- a/src/dede/inc/inc_catalog_options.php +++ b/src/dede/inc/inc_catalog_options.php @@ -1,14 +1,15 @@ SetQuery("SELECT id,typename FROM `#@__channeltype` "); $dsql->Execute('dd'); - $channels = Array(); - while($row = $dsql->GetObject('dd')) $channels[$row->id] = $row->typename; + $channels = array(); + while ($row = $dsql->GetObject('dd')) $channels[$row->id] = $row->typename; $OptionArrayList = ''; //当前选中的栏目 - if($selid > 0) - { + if ($selid > 0) { $row = $dsql->GetOne("SELECT id,typename,ispart,channeltype FROM `#@__arctype` WHERE id='$selid'"); - if($row['ispart']==1) $OptionArrayList .= "\r\n"; - else $OptionArrayList .= "\r\n"; + if ($row['ispart'] == 1) $OptionArrayList .= "\r\n"; + else $OptionArrayList .= "\r\n"; } //是否限定用户管理的栏目 - if( $cfg_admin_channel=='array' ) - { - if(count($admin_catalogs)==0) - { + if ($cfg_admin_channel == 'array') { + if (count($admin_catalogs) == 0) { $query = "SELECT id,typename,ispart,channeltype FROM `#@__arctype` WHERE 1=2 "; - } - else - { + } else { $admin_catalog = join(',', $admin_catalogs); $dsql->SetQuery("SELECT reid FROM `#@__arctype` WHERE id IN($admin_catalog) GROUP BY reid "); $dsql->Execute('qq'); $topidstr = ''; - while($row = $dsql->GetObject('qq')) - { - if($row->reid==0) continue; - $topidstr .= ($topidstr=='' ? $row->reid : ','.$row->reid); + while ($row = $dsql->GetObject('qq')) { + if ($row->reid == 0) continue; + $topidstr .= ($topidstr == '' ? $row->reid : ',' . $row->reid); } - $admin_catalog .= ','.$topidstr; + $admin_catalog .= ',' . $topidstr; $admin_catalogs = explode(',', $admin_catalog); $admin_catalogs = array_unique($admin_catalogs); $admin_catalog = join(',', $admin_catalogs); $admin_catalog = preg_replace("#,$#", '', $admin_catalog); $query = "SELECT id,typename,ispart,channeltype FROM `#@__arctype` WHERE id IN($admin_catalog) AND reid=0 AND ispart<>2 "; } - } - else - { + } else { $query = "SELECT id,typename,ispart,channeltype FROM `#@__arctype` WHERE ispart<>2 AND reid=0 ORDER BY sortrank ASC "; } $dsql->SetQuery($query); $dsql->Execute('cc'); - while($row=$dsql->GetObject('cc')) - { + while ($row = $dsql->GetObject('cc')) { $sonCats = ''; LogicGetOptionArray($row->id, '─', $channeltype, $dsql, $sonCats); - if($sonCats != '') - { - if($row->ispart==1) $OptionArrayList .= "\r\n"; - else if($row->ispart==2) $OptionArrayList .= ''; - else if( empty($channeltype) && $row->ispart != 0 ) $OptionArrayList .= "\r\n"; - else $OptionArrayList .= "\r\n"; + if ($sonCats != '') { + if ($row->ispart == 1) $OptionArrayList .= "\r\n"; + else if ($row->ispart == 2) $OptionArrayList .= ''; + else if (empty($channeltype) && $row->ispart != 0) $OptionArrayList .= "\r\n"; + else $OptionArrayList .= "\r\n"; $OptionArrayList .= $sonCats; - } - else - { - if($row->ispart==0 && (!empty($channeltype) && $row->channeltype == $channeltype) ) - { - $OptionArrayList .= "\r\n"; - } else if($row->ispart==0 && empty($channeltype) ) - { + } else { + if ($row->ispart == 0 && (!empty($channeltype) && $row->channeltype == $channeltype)) { + $OptionArrayList .= "\r\n"; + } else if ($row->ispart == 0 && empty($channeltype)) { // 专题 - $OptionArrayList .= "\r\n"; + $OptionArrayList .= "\r\n"; } } } return $OptionArrayList; } -function LogicGetOptionArray($id,$step,$channeltype,&$dsql, &$sonCats) +function LogicGetOptionArray($id, $step, $channeltype, &$dsql, &$sonCats) { global $OptionArrayList, $channels, $cfg_admin_channel, $admin_catalogs; - $dsql->SetQuery("Select id,typename,ispart,channeltype From `#@__arctype` where reid='".$id."' And ispart<>2 order by sortrank asc"); + $dsql->SetQuery("Select id,typename,ispart,channeltype From `#@__arctype` where reid='" . $id . "' And ispart<>2 order by sortrank asc"); $dsql->Execute($id); - while($row=$dsql->GetObject($id)) - { - if($cfg_admin_channel != 'all' && !in_array($row->id, $admin_catalogs)) - { + while ($row = $dsql->GetObject($id)) { + if ($cfg_admin_channel != 'all' && !in_array($row->id, $admin_catalogs)) { continue; } - if($row->channeltype==$channeltype && $row->ispart==1) - { - $sonCats .= "\r\n"; - } - else if( ($row->channeltype==$channeltype && $row->ispart==0) || empty($channeltype) ) - { - $sonCats .= "\r\n"; + if ($row->channeltype == $channeltype && $row->ispart == 1) { + $sonCats .= "\r\n"; + } else if (($row->channeltype == $channeltype && $row->ispart == 0) || empty($channeltype)) { + $sonCats .= "\r\n"; } - LogicGetOptionArray($row->id,$step.'─',$channeltype,$dsql, $sonCats); + LogicGetOptionArray($row->id, $step . '─', $channeltype, $dsql, $sonCats); } -} \ No newline at end of file +} diff --git a/src/dede/inc/inc_coonepage.php b/src/dede/inc/inc_coonepage.php index c301af81..96f1727a 100755 --- a/src/dede/inc/inc_coonepage.php +++ b/src/dede/inc/inc_coonepage.php @@ -1,14 +1,15 @@ '','body' => '','source' => '','writer' => '','description' => '','keywords' => ''); - $redatas['source'] = preg_replace("/http:\/\//i","",$gurl); - $redatas['source'] = preg_replace("/\/(.*)$/i","",$redatas['source']); - $row = $dsql->GetOne("SELECT * FROM `#@__co_onepage` WHERE url LIKE '".$redatas['source']."' "); + global $dsql, $cfg_auot_description, $cfg_soft_lang; + $redatas = array('title' => '', 'body' => '', 'source' => '', 'writer' => '', 'description' => '', 'keywords' => ''); + $redatas['source'] = preg_replace("/http:\/\//i", "", $gurl); + $redatas['source'] = preg_replace("/\/(.*)$/i", "", $redatas['source']); + $row = $dsql->GetOne("SELECT * FROM `#@__co_onepage` WHERE url LIKE '" . $redatas['source'] . "' "); $s = $e = ''; - if(is_array($row)) - { - list($s,$e) = explode('{@body}',$row['rule']); + if (is_array($row)) { + list($s, $e) = explode('{@body}', $row['rule']); $s = trim($s); $e = trim($e); - if($row['issource']==1) - { + if ($row['issource'] == 1) { $redatas['source'] = $row['title']; } } $htd = new DedeHttpDown(); $htd->OpenUrl($gurl); $body = $htd->GetHtml(); - if($body!='') - { + if ($body != '') { //编码自动转换 - if($cfg_soft_lang=='utf-8') - { - if($row['lang']=='gb2312') - { + if ($cfg_soft_lang == 'utf-8') { + if ($row['lang'] == 'gb2312') { $body = gb2utf8($body); } - } - else if($cfg_soft_lang=='gb2312') - { - if($row['lang']=='utf-8') - { + } else if ($cfg_soft_lang == 'gb2312') { + if ($row['lang'] == 'utf-8') { $body = utf82gb($body); } } //获取标题 $inarr = array(); - preg_match("/(.*)<\/title>/isU",$body,$inarr); - if(isset($inarr[1])) - { + preg_match("/<title>(.*)<\/title>/isU", $body, $inarr); + if (isset($inarr[1])) { $redatas['title'] = $inarr[1]; } //获取关键词 $inarr = array(); - preg_match("/<meta[\s]+name=['\"]keywords['\"] content=['\"](.*)['\"]/isU",$body,$inarr); - if(isset($inarr[1])) - { - $redatas['keywords'] = cn_substr(html2text($inarr[1]),30); + preg_match("/<meta[\s]+name=['\"]keywords['\"] content=['\"](.*)['\"]/isU", $body, $inarr); + if (isset($inarr[1])) { + $redatas['keywords'] = cn_substr(html2text($inarr[1]), 30); } //获取摘要 $inarr = array(); - preg_match("/<meta[\s]+name=['\"]description['\"] content=['\"](.*)['\"]/isU",$body,$inarr); - if(isset($inarr[1])) - { - $redatas['description'] = cn_substr(html2text($inarr[1]),$cfg_auot_description); + preg_match("/<meta[\s]+name=['\"]description['\"] content=['\"](.*)['\"]/isU", $body, $inarr); + if (isset($inarr[1])) { + $redatas['description'] = cn_substr(html2text($inarr[1]), $cfg_auot_description); } //获取内容 - if($s!='' && $e!='') - { - $redatas['body'] = GetHtmlAreaA($s,$e,$body); - if($redatas['body']!='' && $redatas['description']=='') - { - $redatas['description'] = cn_substr(html2text($redatas['body']),$GLOBALS['cfg_auot_description']); + if ($s != '' && $e != '') { + $redatas['body'] = GetHtmlAreaA($s, $e, $body); + if ($redatas['body'] != '' && $redatas['description'] == '') { + $redatas['description'] = cn_substr(html2text($redatas['body']), $GLOBALS['cfg_auot_description']); } } } @@ -104,21 +92,17 @@ function CoOnePage($gurl) */ function GetHtmlAreaA($s, $e, &$html) { - if($html==""||$s=="") - { + if ($html == "" || $s == "") { return ""; } - $posstart = @strpos($html,$s); - if($posstart === FALSE) - { + $posstart = @strpos($html, $s); + if ($posstart === FALSE) { return ""; } $posend = strpos($html, $e, $posstart); - if($posend > $posstart && $posend !== FALSE) - { - return substr($html, $posstart+strlen($s), $posend-$posstart-strlen($s)); - }else - { + if ($posend > $posstart && $posend !== FALSE) { + return substr($html, $posstart + strlen($s), $posend - $posstart - strlen($s)); + } else { return ''; } -} \ No newline at end of file +} diff --git a/src/dede/inc/inc_list_functions.php b/src/dede/inc/inc_list_functions.php index c76473cc..3899cccb 100755 --- a/src/dede/inc/inc_list_functions.php +++ b/src/dede/inc/inc_list_functions.php @@ -1,16 +1,16 @@ <?php + /** * 列表对应函数 * * @version $Id: inc_list_functions.php 1 10:32 2010年7月21日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ -if(!isset($registerGlobals)) -{ - require_once(dirname(__FILE__)."/../../include/common.inc.php"); +if (!isset($registerGlobals)) { + require_once(dirname(__FILE__) . "/../../include/common.inc.php"); } // 获取栏目名称 @@ -18,19 +18,17 @@ function GetTypename($tid) { global $dsql; if (empty($tid)) return ''; - if (file_exists(DEDEDATA.'/cache/inc_catalog_base.inc')) - { - require_once(DEDEDATA.'/cache/inc_catalog_base.inc'); + if (file_exists(DEDEDATA . '/cache/inc_catalog_base.inc')) { + require_once(DEDEDATA . '/cache/inc_catalog_base.inc'); global $cfg_Cs; - if (isset($cfg_Cs[$tid])) - { + if (isset($cfg_Cs[$tid])) { return base64_decode($cfg_Cs[$tid][3]); } - } else { + } else { $row = $dsql->GetOne("SELECT typename FROM #@__arctype WHERE id = '{$tid}'"); unset($dsql); unset($cfg_Cs); - return isset($row['typename'])? $row['typename'] : ''; + return isset($row['typename']) ? $row['typename'] : ''; } return ''; } @@ -38,8 +36,7 @@ function GetTypename($tid) //获得是否推荐的表述 $arcatts = array(); $dsql->Execute('n', 'SELECT * FROM `#@__arcatt` '); -while($arr = $dsql->GetArray('n')) -{ +while ($arr = $dsql->GetArray('n')) { $arcatts[$arr['att']] = $arr['attname']; } @@ -47,18 +44,17 @@ function IsCommendArchives($iscommend) { global $arcatts; $sn = ''; - foreach($arcatts as $k=>$v) - { + foreach ($arcatts as $k => $v) { $v = cn_substr($v, 2); - $sn .= (preg_match("#".$k."#", $iscommend) ? ' '.$v : ''); + $sn .= (preg_match("#" . $k . "#", $iscommend) ? ' ' . $v : ''); } $sn = trim($sn); - if($sn=='') return ''; + if ($sn == '') return ''; else return "[<font color='red'>$sn</font>]"; } //获得推荐的标题 -function GetCommendTitle($title,$iscommend) +function GetCommendTitle($title, $iscommend) { /*if(preg_match('#c#i',$iscommend)) { @@ -69,15 +65,12 @@ function GetCommendTitle($title,$iscommend) //更换颜色 $GLOBALS['RndTrunID'] = 1; -function GetColor($color1,$color2) +function GetColor($color1, $color2) { $GLOBALS['RndTrunID']++; - if($GLOBALS['RndTrunID']%2==0) - { + if ($GLOBALS['RndTrunID'] % 2 == 0) { return $color1; - } - else - { + } else { return $color2; } } @@ -85,12 +78,9 @@ function GetColor($color1,$color2) //检查图片是否存在 function CheckPic($picname) { - if($picname!="") - { + if ($picname != "") { return $picname; - } - else - { + } else { return "images/dfpic.gif"; } } @@ -98,16 +88,11 @@ function CheckPic($picname) //判断内容是否生成HTML function IsHtmlArchives($ismake) { - if($ismake==1) - { + if ($ismake == 1) { return "已生成"; - } - else if($ismake==-1) - { + } else if ($ismake == -1) { return "仅动态"; - } - else - { + } else { return "<font color='red'>未生成</font>"; } } @@ -115,22 +100,17 @@ function IsHtmlArchives($ismake) //获得内容的限定级别名称 function GetRankName($arcrank) { - global $arcArray,$dsql; - if(!is_array($arcArray)) - { + global $arcArray, $dsql; + if (!is_array($arcArray)) { $dsql->SetQuery("SELECT * FROM `#@__arcrank` "); $dsql->Execute(); - while($row = $dsql->GetObject()) - { - $arcArray[$row->rank]=$row->membername; + while ($row = $dsql->GetObject()) { + $arcArray[$row->rank] = $row->membername; } } - if(isset($arcArray[$arcrank])) - { + if (isset($arcArray[$arcrank])) { return $arcArray[$arcrank]; - } - else - { + } else { return "不限"; } } @@ -138,12 +118,9 @@ function GetRankName($arcrank) //判断内容是否为图片文章 function IsPicArchives($picname) { - if($picname != '') - { + if ($picname != '') { return '<font color=\'red\'>(图)</font>'; - } - else - { + } else { return ''; } -} \ No newline at end of file +} diff --git a/src/dede/inc/inc_menu.php b/src/dede/inc/inc_menu.php index cec1585c..59b0449e 100755 --- a/src/dede/inc/inc_menu.php +++ b/src/dede/inc/inc_menu.php @@ -1,49 +1,44 @@ <?php + /** * 后台管理菜单项 * * @version $Id: inc_menu.php 1 10:32 2010年7月21日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ -require_once(dirname(__FILE__)."/../config.php"); +require_once(dirname(__FILE__) . "/../config.php"); //载入可发布频道 $addset = ''; //检测可用的内容模型 -if($cfg_admin_channel = 'array' && count($admin_catalogs) > 0) -{ - $admin_catalog = join(',', $admin_catalogs); - $dsql->SetQuery(" SELECT channeltype FROM `#@__arctype` WHERE id IN({$admin_catalog}) GROUP BY channeltype "); -} -else -{ - $dsql->SetQuery(" SELECT channeltype FROM `#@__arctype` GROUP BY channeltype "); +if ($cfg_admin_channel = 'array' && count($admin_catalogs) > 0) { + $admin_catalog = join(',', $admin_catalogs); + $dsql->SetQuery(" SELECT channeltype FROM `#@__arctype` WHERE id IN({$admin_catalog}) GROUP BY channeltype "); +} else { + $dsql->SetQuery(" SELECT channeltype FROM `#@__arctype` GROUP BY channeltype "); } $dsql->Execute(); $candoChannel = ''; -while($row = $dsql->GetObject()) -{ - $candoChannel .= ($candoChannel=='' ? $row->channeltype : ','.$row->channeltype); +while ($row = $dsql->GetObject()) { + $candoChannel .= ($candoChannel == '' ? $row->channeltype : ',' . $row->channeltype); } -if(empty($candoChannel)) $candoChannel = 1; +if (empty($candoChannel)) $candoChannel = 1; $dsql->SetQuery("SELECT id,typename,addcon,mancon FROM `#@__channeltype` WHERE id IN({$candoChannel}) AND id<>-1 AND isshow=1 ORDER BY id ASC"); $dsql->Execute('mm'); -while($row = $dsql->GetObject('mm')) -{ - $addset .= " <m:item name='{$row->typename}' ischannel='1' link='{$row->mancon}?channelid={$row->id}' linkadd='{$row->addcon}?channelid={$row->id}' channelid='{$row->id}' rank='' target='main' />\r\n"; +while ($row = $dsql->GetObject('mm')) { + $addset .= " <m:item name='{$row->typename}' ischannel='1' link='{$row->mancon}?channelid={$row->id}' linkadd='{$row->addcon}?channelid={$row->id}' channelid='{$row->id}' rank='' target='main' />\r\n"; } ////////////////////////// -$helpUrl = DEDEBIZURL."/help"; -$gitUrl = DEDEBIZURL."/git"; +$helpUrl = DEDEBIZURL . "/help"; +$gitUrl = DEDEBIZURL . "/git"; $dedebizUrl = DEDEBIZURL; $adminMenu1 = $adminMenu2 = ''; -if($cuserLogin->getUserType() >= 10) -{ - $adminMenu1 = "<m:top item='1_' name='频道模型' display='block' rank='t_List,t_AccList,c_List,temp_One'> +if ($cuserLogin->getUserType() >= 10) { + $adminMenu1 = "<m:top item='1_' name='频道模型' display='block' rank='t_List,t_AccList,c_List,temp_One'> <m:item name='内容模型管理' link='mychannel_main.php' rank='c_List' target='main' /> <m:item name='单页文档管理' link='templets_one.php' rank='temp_One' target='main'/> <m:item name='联动类别管理' link='stepselect_main.php' rank='c_Stepseclect' target='main' /> @@ -51,7 +46,7 @@ if($cuserLogin->getUserType() >= 10) <m:item name='自定义表单' link='diy_main.php' rank='c_List' target='main' /> </m:top> "; -$adminMenu2 = "<m:top item='7_' name='模板管理' display='none' rank='temp_One,temp_Other,temp_MyTag,temp_test,temp_All'> + $adminMenu2 = "<m:top item='7_' name='模板管理' display='none' rank='temp_One,temp_Other,temp_MyTag,temp_test,temp_All'> <m:item name='默认模板管理' link='templets_main.php' rank='temp_All' target='main'/> <m:item name='标签源码管理' link='templets_tagsource.php' rank='temp_All' target='main'/> <m:item name='自定义宏标记' link='mytag_main.php' rank='temp_MyTag' target='main'/> @@ -87,7 +82,7 @@ $adminMenu2 = "<m:top item='7_' name='模板管理' display='none' rank='temp_On </m:top> "; } -$remoteMenu = ($cfg_remote_site=='Y')? "<m:item name='远程服务器同步' link='makeremote_all.php' rank='sys_ArcBatch' target='main' />" : ""; +$remoteMenu = ($cfg_remote_site == 'Y') ? "<m:item name='远程服务器同步' link='makeremote_all.php' rank='sys_ArcBatch' target='main' />" : ""; $menusMain = " ----------------------------------------------- @@ -95,7 +90,7 @@ $menusMain = " <m:item name='网站栏目管理' link='catalog_main.php' ischannel='1' addalt='创建栏目' linkadd='catalog_add.php?listtype=all' rank='t_List,t_AccList' target='main' /> <m:item name='所有档案列表' link='content_list.php' rank='a_List,a_AccList' target='main' /> <m:item name='等审核的档案' link='content_list.php?arcrank=-1' rank='a_Check,a_AccCheck' target='main' /> - <m:item name='我发布的文档' link='content_list.php?mid=".$cuserLogin->getUserID()."' rank='a_List,a_AccList,a_MyList' target='main' /> + <m:item name='我发布的文档' link='content_list.php?mid=" . $cuserLogin->getUserID() . "' rank='a_List,a_AccList,a_MyList' target='main' /> <m:item name='评论管理' link='feedback_main.php' rank='sys_Feedback' target='main' /> <m:item name='内容回收站' link='recycling.php' ischannel='1' addalt='清空回收站' addico='images/gtk-del.png' linkadd='archives_do.php?dopost=clear&aid=no&recycle=1' rank='a_List,a_AccList,a_MyList' target='main' /> </m:top> @@ -165,4 +160,4 @@ $adminMenu2 </m:top> ----------------------------------------------- -"; \ No newline at end of file +"; diff --git a/src/dede/inc/inc_menu_func.php b/src/dede/inc/inc_menu_func.php index e65a3730..d5b2cfcd 100755 --- a/src/dede/inc/inc_menu_func.php +++ b/src/dede/inc/inc_menu_func.php @@ -1,15 +1,16 @@ <?php + /** * 管理菜单函数 * * @version $Id: inc_menu_func.php 1 10:32 2010年7月21日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ -require_once(dirname(__FILE__)."/../config.php"); -require_once(DEDEINC."/dedetag.class.php"); +require_once(dirname(__FILE__) . "/../config.php"); +require_once(DEDEINC . "/dedetag.class.php"); $headTemplet = "<dl class='bitem' id='sunitems~cc~'><dt onClick='showHide(\"items~cc~\")'><b>~channelname~</b></dt> <dd style='display:~display~' class='sitem' id='items~cc~'> @@ -19,89 +20,73 @@ $footTemplet = "</ul>\r\n</dd>\r\n</dl>\r\n"; $itemTemplet = "<li>~link~</li>\r\n"; -function GetMenus($userrank,$topos='main') +function GetMenus($userrank, $topos = 'main') { - global $openitem,$headTemplet,$footTemplet,$itemTemplet; - if($topos=='main') - { + global $openitem, $headTemplet, $footTemplet, $itemTemplet; + if ($topos == 'main') { $openitem = (empty($openitem) ? 1 : $openitem); $menus = $GLOBALS['menusMain']; - } - else if($topos=='module') - { + } else if ($topos == 'module') { $openitem = 100; $menus = $GLOBALS['menusMoudle']; } $dtp = new DedeTagParse(); - $dtp->SetNameSpace('m','<','>'); + $dtp->SetNameSpace('m', '<', '>'); $dtp->LoadSource($menus); $dtp2 = new DedeTagParse(); - $dtp2->SetNameSpace('m','<','>'); + $dtp2->SetNameSpace('m', '<', '>'); $m = 0; - foreach($dtp->CTags as $i=>$ctag) - { - if($ctag->GetName()=='top' && ($ctag->GetAtt('rank')=='' || TestPurview($ctag->GetAtt('rank')) )) - { - if($openitem!=999 && !preg_match("#".$openitem.'_'."#", $ctag->GetAtt('item')) && $openitem!=100) continue; + foreach ($dtp->CTags as $i => $ctag) { + if ($ctag->GetName() == 'top' && ($ctag->GetAtt('rank') == '' || TestPurview($ctag->GetAtt('rank')))) { + if ($openitem != 999 && !preg_match("#" . $openitem . '_' . "#", $ctag->GetAtt('item')) && $openitem != 100) continue; $m++; - echo "<!-- Item ".($m+1)." Strat -->\r\n"; - $htmp = str_replace("~channelname~",$ctag->GetAtt("name"),$headTemplet); - if(empty($openitem) || $openitem==100) - { - if($ctag->GetAtt('notshowall')=='1') continue; - $htmp = str_replace('~display~',$ctag->GetAtt('display'),$htmp); - } - else - { - if($openitem==$ctag->GetAtt('item') || preg_match("#".$openitem.'_'."#", $ctag->GetAtt('item')) || $openitem=='-1') - $htmp = str_replace('~display~','block',$htmp); + echo "<!-- Item " . ($m + 1) . " Strat -->\r\n"; + $htmp = str_replace("~channelname~", $ctag->GetAtt("name"), $headTemplet); + if (empty($openitem) || $openitem == 100) { + if ($ctag->GetAtt('notshowall') == '1') continue; + $htmp = str_replace('~display~', $ctag->GetAtt('display'), $htmp); + } else { + if ($openitem == $ctag->GetAtt('item') || preg_match("#" . $openitem . '_' . "#", $ctag->GetAtt('item')) || $openitem == '-1') + $htmp = str_replace('~display~', 'block', $htmp); else - $htmp = str_replace('~display~','none',$htmp); + $htmp = str_replace('~display~', 'none', $htmp); } - $htmp = str_replace('~cc~',$m.'_'.$openitem,$htmp); + $htmp = str_replace('~cc~', $m . '_' . $openitem, $htmp); echo $htmp; $dtp2->LoadSource($ctag->InnerText); - foreach($dtp2->CTags as $j=>$ctag2) - { + foreach ($dtp2->CTags as $j => $ctag2) { $ischannel = trim($ctag2->GetAtt('ischannel')); - if($ctag2->GetName()=='item' && ($ctag2->GetAtt('rank')=='' || TestPurview($ctag2->GetAtt('rank')) ) ) - { - $link = "<a href='".$ctag2->GetAtt('link')."' target='".$ctag2->GetAtt('target')."'>".$ctag2->GetAtt('name')."</a>"; - if($ischannel=='1') - { - if($ctag2->GetAtt('addalt')!='') { + if ($ctag2->GetName() == 'item' && ($ctag2->GetAtt('rank') == '' || TestPurview($ctag2->GetAtt('rank')))) { + $link = "<a href='" . $ctag2->GetAtt('link') . "' target='" . $ctag2->GetAtt('target') . "'>" . $ctag2->GetAtt('name') . "</a>"; + if ($ischannel == '1') { + if ($ctag2->GetAtt('addalt') != '') { $addalt = $ctag2->GetAtt('addalt'); - } - else { + } else { $addalt = '录入新内容'; } - - if($ctag2->GetAtt('addico')!='') { + + if ($ctag2->GetAtt('addico') != '') { $addico = $ctag2->GetAtt('addico'); - } - else { + } else { $addico = 'images/gtk-sadd.png'; } - -//an add icos , small items use att ischannel='1' addico='ico' addalt='msg' linkadd='' -$link = " <div class='items'> + + //an add icos , small items use att ischannel='1' addico='ico' addalt='msg' linkadd='' + $link = " <div class='items'> <div class='fllct'>$link</div>\r\n <div class='flrct'> - <a href='".$ctag2->GetAtt('linkadd')."' target='".$ctag2->GetAtt('target')."'><img src='$addico' alt='$addalt' title='$addalt'/></a> + <a href='" . $ctag2->GetAtt('linkadd') . "' target='" . $ctag2->GetAtt('target') . "'><img src='$addico' alt='$addalt' title='$addalt'/></a> </div> </div>\r\n"; - - } - else - { + } else { $link .= "\r\n"; } - $itemtmp = str_replace('~link~',$link,$itemTemplet); + $itemtmp = str_replace('~link~', $link, $itemTemplet); echo $itemtmp; } } echo $footTemplet; - echo "<!-- Item ".($m+1)." End -->\r\n"; + echo "<!-- Item " . ($m + 1) . " End -->\r\n"; } } } diff --git a/src/dede/inc/inc_menu_map.php b/src/dede/inc/inc_menu_map.php index 2be72259..97676a88 100755 --- a/src/dede/inc/inc_menu_map.php +++ b/src/dede/inc/inc_menu_map.php @@ -1,42 +1,38 @@ <?php + /** * 菜单地图 * * @version $Id: inc_menu_map.php 1 10:32 2010年7月21日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ -require_once(dirname(__FILE__)."/../config.php"); +require_once(dirname(__FILE__) . "/../config.php"); -$maparray = array(1=>'文档相关',2=>'系统设置',3=>'必须辅助功能',4=>'网站更新操作',5=>'会员相关',6=>'基本模块插件'); +$maparray = array(1 => '文档相关', 2 => '系统设置', 3 => '必须辅助功能', 4 => '网站更新操作', 5 => '会员相关', 6 => '基本模块插件'); //载入可发布频道 $addset = ''; //检测可用的内容模型 -if($cfg_admin_channel = 'array' && count($admin_catalogs) > 0) -{ - $admin_catalog = join(',', $admin_catalogs); - $dsql->SetQuery(" SELECT channeltype FROM `#@__arctype` WHERE id IN({$admin_catalog}) GROUP BY channeltype "); -} -else -{ - $dsql->SetQuery(" SELECT channeltype FROM `#@__arctype` GROUP BY channeltype "); +if ($cfg_admin_channel = 'array' && count($admin_catalogs) > 0) { + $admin_catalog = join(',', $admin_catalogs); + $dsql->SetQuery(" SELECT channeltype FROM `#@__arctype` WHERE id IN({$admin_catalog}) GROUP BY channeltype "); +} else { + $dsql->SetQuery(" SELECT channeltype FROM `#@__arctype` GROUP BY channeltype "); } $dsql->Execute(); $candoChannel = ''; -while($row = $dsql->GetObject()) -{ - $candoChannel .= ($candoChannel=='' ? $row->channeltype : ','.$row->channeltype); +while ($row = $dsql->GetObject()) { + $candoChannel .= ($candoChannel == '' ? $row->channeltype : ',' . $row->channeltype); } -if(empty($candoChannel)) $candoChannel = 1; +if (empty($candoChannel)) $candoChannel = 1; $dsql->SetQuery("SELECT id,typename,addcon,mancon FROM `#@__channeltype` WHERE id IN({$candoChannel}) AND id<>-1 AND isshow=1 ORDER BY id ASC"); $dsql->Execute(); -while($row = $dsql->GetObject()) -{ - $addset .= " <m:item name='{$row->typename}' ischannel='1' link='{$row->mancon}?channelid={$row->id}' linkadd='{$row->addcon}?channelid={$row->id}' channelid='{$row->id}' rank='' target='main' />\r\n"; +while ($row = $dsql->GetObject()) { + $addset .= " <m:item name='{$row->typename}' ischannel='1' link='{$row->mancon}?channelid={$row->id}' linkadd='{$row->addcon}?channelid={$row->id}' channelid='{$row->id}' rank='' target='main' />\r\n"; } ////////////////////////// $menusMain = " @@ -46,7 +42,7 @@ $menusMain = " <m:item name='网站栏目管理' link='catalog_main.php' ischannel='1' addalt='创建栏目' linkadd='catalog_add.php?listtype=all' rank='t_List,t_AccList' target='main' /> <m:item name='所有档案列表' link='content_list.php' rank='a_List,a_AccList' target='main' /> <m:item name='等审核的档案' link='content_list.php?arcrank=-1' rank='a_Check,a_AccCheck' target='main' /> - <m:item name='我发布的文档' link='content_list.php?mid=".$cuserLogin->getUserID()."' rank='a_List,a_AccList,a_MyList' target='main' /> + <m:item name='我发布的文档' link='content_list.php?mid=" . $cuserLogin->getUserID() . "' rank='a_List,a_AccList,a_MyList' target='main' /> <m:item name='评论管理' link='feedback_main.php' rank='sys_Feedback' target='main' /> <m:item name='内容回收站' link='recycling.php' ischannel='1' addalt='清空回收站' addico='img/gtk-del.png' linkadd='archives_do.php?dopost=clear&aid=no' rank='a_List' target='main' /> </m:top> @@ -151,9 +147,8 @@ $menusMain = " $plusset = ''; $dsql->SetQuery("SELECT * FROM `#@__plus` WHERE isshow=1 ORDER BY aid ASC"); $dsql->Execute(); -while($row = $dsql->GetObject()) -{ - $plusset .= $row->menustring."\r\n"; +while ($row = $dsql->GetObject()) { + $plusset .= $row->menustring . "\r\n"; } $menusMain .= " @@ -171,30 +166,26 @@ $menusMain .= " $mapstring = ''; $dtp = new DedeTagparse(); -$dtp->SetNameSpace('m','<','>'); +$dtp->SetNameSpace('m', '<', '>'); $dtp->LoadString($menusMain); -foreach($maparray as $k=>$bigname) -{ - $mapstring .= "<dl class='maptop'>\r\n"; - $mapstring .= "<dt class='bigitem'>$bigname</dt>\r\n"; - $mapstring .= "<dd>\r\n"; - foreach($dtp->CTags as $ctag) - { - if($ctag->GetAtt('mapitem') == $k) - { - $mapstring .= "<dl class='mapitem'>\r\n"; - $mapstring .= "<dt>".$ctag->GetAtt('name')."</dt>\r\n"; - $mapstring .= "<dd>\r\n<ul class='item'>\r\n"; - $dtp2 = new DedeTagParse(); - $dtp2->SetNameSpace('m', '<', '>'); - $dtp2->LoadSource($ctag->InnerText); - foreach($dtp2->CTags as $j=>$ctag2) - { - $mapstring .= "<li><a href='".$ctag2->GetAtt('link')."' target='".$ctag2->GetAtt('target')."'>".$ctag2->GetAtt('name')."</a></li>\r\n"; - } - $mapstring .= "</ul>\r\n</dd>\r\n</dl>\r\n"; - } +foreach ($maparray as $k => $bigname) { + $mapstring .= "<dl class='maptop'>\r\n"; + $mapstring .= "<dt class='bigitem'>$bigname</dt>\r\n"; + $mapstring .= "<dd>\r\n"; + foreach ($dtp->CTags as $ctag) { + if ($ctag->GetAtt('mapitem') == $k) { + $mapstring .= "<dl class='mapitem'>\r\n"; + $mapstring .= "<dt>" . $ctag->GetAtt('name') . "</dt>\r\n"; + $mapstring .= "<dd>\r\n<ul class='item'>\r\n"; + $dtp2 = new DedeTagParse(); + $dtp2->SetNameSpace('m', '<', '>'); + $dtp2->LoadSource($ctag->InnerText); + foreach ($dtp2->CTags as $j => $ctag2) { + $mapstring .= "<li><a href='" . $ctag2->GetAtt('link') . "' target='" . $ctag2->GetAtt('target') . "'>" . $ctag2->GetAtt('name') . "</a></li>\r\n"; + } + $mapstring .= "</ul>\r\n</dd>\r\n</dl>\r\n"; } - $mapstring .= "</dd>\r\n</dl>\r\n"; -} \ No newline at end of file + } + $mapstring .= "</dd>\r\n</dl>\r\n"; +} diff --git a/src/dede/inc/inc_menu_module.php b/src/dede/inc/inc_menu_module.php index f1dcd875..72c27019 100755 --- a/src/dede/inc/inc_menu_module.php +++ b/src/dede/inc/inc_menu_module.php @@ -1,14 +1,15 @@ <?php + /** * 模块菜单 * * @version $Id: inc_menu_module.php 1 10:32 2010年7月21日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ -require_once(dirname(__FILE__)."/../config.php"); +require_once(dirname(__FILE__) . "/../config.php"); /* 模块菜单一般在不要直接改此文件,直接保存在#@__sys_module表即可,格式为 @@ -24,23 +25,21 @@ require_once(dirname(__FILE__)."/../config.php"); $moduleset = ''; $dsql->SetQuery("SELECT * FROM `#@__sys_module` ORDER BY id DESC"); $dsql->Execute('mm'); -while($row = $dsql->GetObject('mm')) -{ - $moduleset .= $row->menustring."\r\n"; +while ($row = $dsql->GetObject('mm')) { + $moduleset .= $row->menustring . "\r\n"; } //载入插件菜单 $plusset = ''; $dsql->SetQuery("SELECT * FROM `#@__plus` WHERE isshow=1 ORDER BY aid ASC"); $dsql->Execute(); -while($row = $dsql->GetObject()) { +while ($row = $dsql->GetObject()) { $row->menustring = str_replace('plus_友情链接', 'plus_友情链接模块', $row->menustring); - $plusset .= $row->menustring."\r\n"; + $plusset .= $row->menustring . "\r\n"; } $adminMenu = ''; -if($cuserLogin->getUserType() >= 10) -{ +if ($cuserLogin->getUserType() >= 10) { $adminMenu = "<m:top name='模块管理' c='6,' display='block'> <m:item name='模块管理' link='module_main.php' rank='sys_module' target='main' /> <m:item name='上传新模块' link='module_upload.php' rank='sys_module' target='main' /> @@ -58,4 +57,4 @@ $adminMenu $moduleset ----------------------------------------------- -"; \ No newline at end of file +"; diff --git a/src/dede/index.php b/src/dede/index.php index 9180040c..81c3ebe7 100755 --- a/src/dede/index.php +++ b/src/dede/index.php @@ -1,32 +1,30 @@ <?php + /** * 管理后台首页 * * @version $Id: index.php 1 11:06 2010年7月13日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ -if ( preg_match("#PHP (.*) Development Server#",$_SERVER['SERVER_SOFTWARE']) ) -{ - if ( $_SERVER['REQUEST_URI'] == dirname($_SERVER['SCRIPT_NAME']) ) - { +if (preg_match("#PHP (.*) Development Server#", $_SERVER['SERVER_SOFTWARE'])) { + if ($_SERVER['REQUEST_URI'] == dirname($_SERVER['SCRIPT_NAME'])) { header('HTTP/1.1 301 Moved Permanently'); - header('Location:'.$_SERVER['REQUEST_URI'].'/'); + header('Location:' . $_SERVER['REQUEST_URI'] . '/'); } } - -require_once(dirname(__FILE__)."/config.php"); -require_once(DEDEINC.'/dedetag.class.php'); -$defaultIcoFile = DEDEDATA.'/admin/quickmenu.txt'; -$myIcoFile = DEDEDATA.'/admin/quickmenu-'.$cuserLogin->getUserID().'.txt'; -if(!file_exists($myIcoFile)) $myIcoFile = $defaultIcoFile; +require_once(dirname(__FILE__) . "/config.php"); +require_once(DEDEINC . '/dedetag.class.php'); +$defaultIcoFile = DEDEDATA . '/admin/quickmenu.txt'; +$myIcoFile = DEDEDATA . '/admin/quickmenu-' . $cuserLogin->getUserID() . '.txt'; -require(DEDEADMIN.'/inc/inc_menu_map.php'); -include(DEDEADMIN.'/templets/index2.htm'); -exit(); +if (!file_exists($myIcoFile)) $myIcoFile = $defaultIcoFile; +require(DEDEADMIN . '/inc/inc_menu_map.php'); +include(DEDEADMIN . '/templets/index2.htm'); +exit(); diff --git a/src/dede/index_body.php b/src/dede/index_body.php index a4ebdc26..7b2cbd86 100755 --- a/src/dede/index_body.php +++ b/src/dede/index_body.php @@ -4,7 +4,7 @@ * 管理后台首页主体 * * @version $Id: index_body.php 1 11:06 2010年7月13日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -35,8 +35,7 @@ if (empty($dopost)) { /*----------------------- 增加新项 function _AddNew() { } --------------------------*/ -else if ($dopost == 'addnew') { +-------------------------*/ else if ($dopost == 'addnew') { if (empty($link) || empty($title)) { ShowMsg("链接网址或标题不能为空!", "-1"); exit(); @@ -62,8 +61,7 @@ else if ($dopost == 'addnew') { /*--------------------------- 保存修改的项 function _EditSave() { } -----------------------------*/ -else if ($dopost == 'editsave') { +----------------------------*/ else if ($dopost == 'editsave') { $quickmenu = stripslashes($quickmenu); $myIcoFileTrue = DEDEDATA . '/admin/quickmenu-' . $cuserLogin->getUserID() . '.txt'; @@ -77,8 +75,7 @@ else if ($dopost == 'editsave') { /*--------------------------- 保存修改的项 function _EditSave() { } -----------------------------*/ -else if ($dopost == 'movesave') { +----------------------------*/ else if ($dopost == 'movesave') { $movedata = str_replace('\\', "", $sortorder); $movedata = json_decode($movedata, TRUE); $movedata = serialize($movedata); @@ -90,8 +87,7 @@ else if ($dopost == 'movesave') { /*----------------------------- 显示修改表单 function _EditShow() { } ------------------------------*/ -else if ($dopost == 'editshow') { +-----------------------------*/ else if ($dopost == 'editshow') { $fp = fopen($myIcoFile, 'r'); $oldct = trim(fread($fp, filesize($myIcoFile))); fclose($fp); @@ -135,8 +131,7 @@ else if ($dopost == 'editshow') { /*--------------------------------- 载入右边内容 function _getRightSide() { } ----------------------------------*/ -else if ($dopost == 'getRightSide') { +---------------------------------*/ else if ($dopost == 'getRightSide') { $query = " SELECT COUNT(*) AS dd FROM `#@__member` "; $row1 = $dsql->GetOne($query); $query = " SELECT COUNT(*) AS dd FROM `#@__feedback` "; @@ -228,8 +223,8 @@ else if ($dopost == 'getRightSide') { if (!extension_loaded("openssl")) { echo json_encode(array( "code" => -1001, - "msg"=>"PHP不支持OpenSSL,无法完成Dede商业授权", - "result"=>null, + "msg" => "PHP不支持OpenSSL,无法完成Dede商业授权", + "result" => null, )); exit; } @@ -237,8 +232,8 @@ else if ($dopost == 'getRightSide') { if (empty($cfg_auth_code)) { echo json_encode(array( "code" => -1002, - "msg"=>"当前站点尚未购买Dede商业授权", - "result"=>null, + "msg" => "当前站点尚未购买Dede商业授权", + "result" => null, )); exit; } @@ -259,15 +254,15 @@ else if ($dopost == 'getRightSide') { if (isset($res->sid)) { echo json_encode(array( "code" => 200, - "msg"=>"", - "result"=>array( + "msg" => "", + "result" => array( "domain" => $res->domain, "title" => $res->title, - "stype" => $res->stype == 1? "企业单位" : "个人", + "stype" => $res->stype == 1 ? "企业单位" : "个人", "auth_version" => $res->auth_version, "auth_at" => date("Y-m-d", $res->auth_at), "core" => $core_info, - ), + ), )); } } diff --git a/src/dede/index_menu.php b/src/dede/index_menu.php index 78b373b5..5e7936b4 100755 --- a/src/dede/index_menu.php +++ b/src/dede/index_menu.php @@ -1,15 +1,16 @@ <?php + /** * 菜单项 * * @version $Id: index_menu.php 1 11:06 2010年7月13日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ -require(dirname(__FILE__).'/config.php'); -require(DEDEADMIN.'/inc/inc_menu.php'); -require(DEDEADMIN.'/inc/inc_menu_func.php'); +require(dirname(__FILE__) . '/config.php'); +require(DEDEADMIN . '/inc/inc_menu.php'); +require(DEDEADMIN . '/inc/inc_menu_func.php'); $openitem = (empty($openitem) ? 1 : $openitem); include DedeInclude('templets/index_menu2.htm'); diff --git a/src/dede/index_menu_load.php b/src/dede/index_menu_load.php index a75533cd..ffc376f0 100755 --- a/src/dede/index_menu_load.php +++ b/src/dede/index_menu_load.php @@ -1,27 +1,25 @@ <?php + /** * 载入菜单 * * @version $Id: index_menu_load.php 1 8:48 2010年7月13日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ -require_once(dirname(__FILE__).'/config.php'); +require_once(dirname(__FILE__) . '/config.php'); AjaxHead(); -if($openitem != 100) -{ - require(dirname(__FILE__).'/inc/inc_menu.php'); - require(DEDEADMIN.'/inc/inc_menu_func.php'); - GetMenus($cuserLogin->getUserRank(),'main'); +if ($openitem != 100) { + require(dirname(__FILE__) . '/inc/inc_menu.php'); + require(DEDEADMIN . '/inc/inc_menu_func.php'); + GetMenus($cuserLogin->getUserRank(), 'main'); exit(); -} -else -{ +} else { $openitem = 0; - require(dirname(__FILE__).'/inc/inc_menu_module.php'); - require(DEDEADMIN.'/inc/inc_menu_func.php'); - GetMenus($cuserLogin->getUserRank(),'module'); + require(dirname(__FILE__) . '/inc/inc_menu_module.php'); + require(DEDEADMIN . '/inc/inc_menu_func.php'); + GetMenus($cuserLogin->getUserRank(), 'module'); exit(); -} \ No newline at end of file +} diff --git a/src/dede/index_menu_module.php b/src/dede/index_menu_module.php index 3055d96d..a0a65149 100755 --- a/src/dede/index_menu_module.php +++ b/src/dede/index_menu_module.php @@ -1,52 +1,56 @@ <?php + /** * 快捷发布菜单 * * @version $Id: index_memnu_module.php 1 23:44 2011/2/16 tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ -require(dirname(__FILE__)."/config.php"); -if($cuserLogin->adminStyle!='dedecms') -{ - header("location:index_menu.php?openitem=100"); - exit(); +require(dirname(__FILE__) . "/config.php"); +if ($cuserLogin->adminStyle != 'dedecms') { + header("location:index_menu.php?openitem=100"); + exit(); } -require(DEDEADMIN.'/inc/inc_menu_module.php'); -require(DEDEADMIN.'/inc/inc_menu_func.php'); +require(DEDEADMIN . '/inc/inc_menu_module.php'); +require(DEDEADMIN . '/inc/inc_menu_func.php'); ?> <html> + <head> -<title>DedeCMS menu - - - - + DedeBIZ menu + + + + + - - - - -
-getUserRank(),'module'); -?> -
- - -
+ + + + +
+ getUserRank(), 'module'); + ?> +
+ + + + +
+ \ No newline at end of file diff --git a/src/dede/index_testenv.php b/src/dede/index_testenv.php index 342b3f2d..f0abd1bc 100755 --- a/src/dede/index_testenv.php +++ b/src/dede/index_testenv.php @@ -127,13 +127,7 @@ if (!function_exists('IsWritable')) { // 检测权限 $safeMsg = array(); -//if(TestExecuteable(DEDEROOT.'/data',$cfg_basehost) || TestExecuteable(DEDEROOT.'/uploads',$cfg_basehost)) -//{ -// $helpurl = "http://help.dedecms.com/install-use/server/2011/1109/2124.html"; -// $safeMsg[] = '目前data、uploads有执行.php权限,非常危险,需要立即取消目录的执行权限! -// -// 查看如何取消'; -//} + $dirname = str_replace('index_body.php', '', strtolower($_SERVER['PHP_SELF'])); if (preg_match("#[\\|/]dede[\\|/]#", $dirname)) { $safeMsg[] = '默认管理目录为dede,需要立即将它更名;'; @@ -155,28 +149,23 @@ if ($rs < 0) { $safeMsg[] = $msg; } -//if(PostHost($cfg_basehost.'/data/admin/ver.txt') === @file_get_contents(DEDEDATA.'/admin/ver.txt')) -//{ -// $helpurl = 'http://help.dedecms.com/install-use/apply/2011/1110/2129.html'; -// $safeMsg[] = '强烈建议将data目录搬移到Web根目录以外;查看如何搬迁'; -//} ?> 0) { ?> - + \ No newline at end of file diff --git a/src/dede/index_top.php b/src/dede/index_top.php index 6ddb2dd4..e0412da6 100755 --- a/src/dede/index_top.php +++ b/src/dede/index_top.php @@ -1,19 +1,17 @@ adminStyle=='dedecms') -{ +require(dirname(__FILE__) . "/config.php"); +if ($cuserLogin->adminStyle == 'dedecms') { include DedeInclude('templets/index_top1.htm'); -} -else -{ +} else { include DedeInclude('templets/index_top2.htm'); } diff --git a/src/dede/js/album.js b/src/dede/js/album.js index 33f0f44d..97628579 100755 --- a/src/dede/js/album.js +++ b/src/dede/js/album.js @@ -2,7 +2,7 @@ * 图集 * * @version $Id: album.js 1 22:28 2010年7月20日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -22,10 +22,10 @@ function checkSubmitAlb() { if ($("#thumbnails .albCt").length > 0) { // 这里从thumbnails中取出图片元素信息 - $("#thumbnails .albCt").each(function(){ + $("#thumbnails .albCt").each(function () { albums.push({ - "img" : $(this).find("img").attr("src"), - "txt" : $(this).find("input").val() + "img": $(this).find("img").attr("src"), + "txt": $(this).find("input").val() }) }) } @@ -35,27 +35,27 @@ function checkSubmitAlb() { return true; } -function testGet(){ - LoadTestDiv(); +function testGet() { + LoadTestDiv(); } -function checkMuList(psid,cmid){ - if($Obj('pagestyle3').checked){ - $Obj('cfgmulist').style.display = 'block'; +function checkMuList(psid, cmid) { + if ($Obj('pagestyle3').checked) { + $Obj('cfgmulist').style.display = 'block'; $Obj('spagelist').style.display = 'none'; - } else if($Obj('pagestyle1').checked) { + } else if ($Obj('pagestyle1').checked) { $Obj('cfgmulist').style.display = 'none'; $Obj('spagelist').style.display = 'block'; - } else { + } else { $Obj('cfgmulist').style.display = 'none'; $Obj('spagelist').style.display = 'none'; } } //图集,显示与隐藏zip文件选项 -function showZipField(formitem,zipid,upid){ - if(formitem.checked){ - $Obj(zipid).style.display = 'block'; +function showZipField(formitem, zipid, upid) { + if (formitem.checked) { + $Obj(zipid).style.display = 'block'; $Obj(upid).style.display = 'none'; //$Obj('handfield').style.display = 'none'; // $Obj('formhtml').checked = false; @@ -67,42 +67,42 @@ function showZipField(formitem,zipid,upid){ } //图集,显示与隐藏Html编辑框 -function showHtmlField(formitem,htmlid,upid){ - if($Nav()!="IE"){ +function showHtmlField(formitem, htmlid, upid) { + if ($Nav() != "IE") { alert("该方法不适用于非IE浏览器!"); - return ; + return; } - if(formitem.checked){ + if (formitem.checked) { $Obj(htmlid).style.display = 'block'; $Obj(upid).style.display = 'none'; //$Obj('handfield').style.display = 'none'; $Obj('formzip').checked = false; - } else { + } else { $Obj(htmlid).style.display = 'none'; //$Obj('handfield').style.display = 'block'; $Obj('copyhtml').innerHTML = ''; } } -function seePicNewAlb(f, imgdid, frname, hpos, acname){ - var newobj = null; - if(f.value=='') return ; +function seePicNewAlb(f, imgdid, frname, hpos, acname) { + var newobj = null; + if (f.value == '') return; vImg = $Obj(imgdid); picnameObj = document.getElementById('picname'); - nFrame = $Nav()=='IE' ? eval('document.frames.'+frname) : $Obj(frname); + nFrame = $Nav() == 'IE' ? eval('document.frames.' + frname) : $Obj(frname); nForm = f.form; //修改form的action等参数 - if(nForm.detachEvent) nForm.detachEvent("onsubmit", checkSubmitAlb); - else nForm.removeEventListener("submit", checkSubmitAlb, false); + if (nForm.detachEvent) nForm.detachEvent("onsubmit", checkSubmitAlb); + else nForm.removeEventListener("submit", checkSubmitAlb, false); nForm.action = 'archives_do.php'; nForm.target = frname; nForm.dopost.value = 'uploadLitpic'; nForm.submit(); - + picnameObj.value = ''; newobj = $Obj('uploadwait'); - if(!newobj){ - newobj = document.createElement("DIV"); + if (!newobj) { + newobj = document.createElement("DIV"); newobj.id = 'uploadwait'; newobj.style.position = 'absolute'; newobj.className = 'uploadwait'; @@ -121,21 +121,21 @@ function seePicNewAlb(f, imgdid, frname, hpos, acname){ nForm.litpic.disabled = true; //nForm.litpic = null; //if(nForm.attachEvent) nForm.attachEvent("onsubmit", checkSubmit); - //else nForm.addEventListener("submit", checkSubmit, true); + //else nForm.addEventListener("submit", checkSubmit, true); } //删除已经上传的图片 -function delAlbPic(pid){ - var tgobj = $Obj('albCtok'+pid); +function delAlbPic(pid) { + var tgobj = $Obj('albCtok' + pid); var myajax = new DedeAjax(tgobj); - myajax.SendGet2('swfupload.php?dopost=del&id='+pid); + myajax.SendGet2('swfupload.php?dopost=del&id=' + pid); $Obj('thumbnails').removeChild(tgobj); } //删除已经上传的图片(编辑时用) -function delAlbPicOld(picfile, pid){ - var tgobj = $Obj('albold'+pid); +function delAlbPicOld(picfile, pid) { + var tgobj = $Obj('albold' + pid); var myajax = new DedeAjax(tgobj); - myajax.SendGet2('swfupload.php?dopost=delold&picfile='+picfile); + myajax.SendGet2('swfupload.php?dopost=delold&picfile=' + picfile); $Obj('thumbnailsEdit').removeChild(tgobj); } \ No newline at end of file diff --git a/src/dede/js/co.js b/src/dede/js/co.js index 20eb154e..1f0d1aaf 100755 --- a/src/dede/js/co.js +++ b/src/dede/js/co.js @@ -1,155 +1,154 @@ /** * - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ - -function nav(){ - if(window.navigator.userAgent.indexOf("MSIE")>=1) return 'IE'; - else if(window.navigator.userAgent.indexOf("Firefox")>=1) return 'FF'; - else return "OT"; + +function nav() { + if (window.navigator.userAgent.indexOf("MSIE") >= 1) return 'IE'; + else if (window.navigator.userAgent.indexOf("Firefox") >= 1) return 'FF'; + else return "OT"; } -function myObj(oid){ - return document.getElementById(oid); +function myObj(oid) { + return document.getElementById(oid); } -function showHide(objname){ - var obj = myObj(objname); - if(obj.style.display==null || obj.style.display=='none'){ - if(nav()=='IE') obj.style.display = "block"; - else obj.style.display = "table-row"; - } else { - obj.style.display = "none"; - } +function showHide(objname) { + var obj = myObj(objname); + if (obj.style.display == null || obj.style.display == 'none') { + if (nav() == 'IE') obj.style.display = "block"; + else obj.style.display = "table-row"; + } else { + obj.style.display = "none"; + } } -function showTestWin(surl){ +function showTestWin(surl) { window.open(surl, "testWin", "scrollbars=yes,resizable=yes,statebar=no,width=600,height=450,left=100, top=100"); } -function showItem(objname){ - var obj = myObj(objname); - if(nav()=='IE') obj.style.display = "block"; - else obj.style.display = "table"; +function showItem(objname) { + var obj = myObj(objname); + if (nav() == 'IE') obj.style.display = "block"; + else obj.style.display = "table"; } -function showItemM(objname){ - var obj = myObj(objname); - if(nav()=='IE') obj.style.display = "block"; - else obj.style.display = "table"; +function showItemM(objname) { + var obj = myObj(objname); + if (nav() == 'IE') obj.style.display = "block"; + else obj.style.display = "table"; } -function showItem1(){ - showItem('needset'); - showItem('head1'); - myObj('adset').style.display = "none"; - myObj('head2').style.display = "none"; +function showItem1() { + showItem('needset'); + showItem('head1'); + myObj('adset').style.display = "none"; + myObj('head2').style.display = "none"; } -function showItem2(){ - showItemM('adset'); - showItemM('head2'); - myObj('needset').style.display = "none"; - myObj('head1').style.display = "none"; +function showItem2() { + showItemM('adset'); + showItemM('head2'); + myObj('needset').style.display = "none"; + myObj('head1').style.display = "none"; } -function testMore(){ - if(myObj('usemore').checked) { - if(nav()=='IE') myObj('usemoretr').style.display = 'block'; +function testMore() { + if (myObj('usemore').checked) { + if (nav() == 'IE') myObj('usemoretr').style.display = 'block'; else myObj('usemoretr').style.display = 'table-row'; - myObj('handset').style.display = 'none'; + myObj('handset').style.display = 'none'; } else { myObj('usemoretr').style.display = 'none'; - if(nav()=='IE') myObj('handset').style.display = 'block'; + if (nav() == 'IE') myObj('handset').style.display = 'block'; else myObj('handset').style.display = 'table-row'; } } -function selSourceSet(){ - if(myObj('source3').checked){ - if(nav()=='IE') myObj('rssset').style.display = 'block'; +function selSourceSet() { + if (myObj('source3').checked) { + if (nav() == 'IE') myObj('rssset').style.display = 'block'; else myObj('rssset').style.display = 'table-row'; myObj('batchset').style.display = 'none'; myObj('handset').style.display = 'none'; myObj('arturl').style.display = 'none'; - } else if(myObj('source2').checked){ + } else if (myObj('source2').checked) { myObj('rssset').style.display = 'none'; myObj('batchset').style.display = 'none'; - if(nav()=='IE') myObj('handset').style.display = 'block'; + if (nav() == 'IE') myObj('handset').style.display = 'block'; else myObj('handset').style.display = 'table-row'; - if(nav()=='IE') myObj('arturl').style.display = 'block'; + if (nav() == 'IE') myObj('arturl').style.display = 'block'; else myObj('arturl').style.display = 'table-row'; - } else { - myObj('rssset').style.display = 'none'; - if(nav()=='IE') myObj('batchset').style.display = 'block'; + } else { + myObj('rssset').style.display = 'none'; + if (nav() == 'IE') myObj('batchset').style.display = 'block'; else myObj('batchset').style.display = 'table-row'; - if(nav()=='IE') myObj('handset').style.display = 'block'; + if (nav() == 'IE') myObj('handset').style.display = 'block'; else myObj('handset').style.display = 'table-row'; - if(nav()=='IE') myObj('arturl').style.display = 'block'; + if (nav() == 'IE') myObj('arturl').style.display = 'block'; else myObj('arturl').style.display = 'table-row'; - } - testMore(); + } + testMore(); } -function selListenSet(){ - if(myObj('islisten1').checked) { - myObj('listentr').style.display = 'none'; +function selListenSet() { + if (myObj('islisten1').checked) { + myObj('listentr').style.display = 'none'; } else { - if(nav()=='IE') myObj('listentr').style.display = 'block'; - else myObj('listentr').style.display = 'table-row'; + if (nav() == 'IE') myObj('listentr').style.display = 'block'; + else myObj('listentr').style.display = 'table-row'; } } -function selUrlRuleSet(){ - if(myObj('urlrule2').checked) { - myObj('arearuletr').style.display = 'none'; - if(nav()=='IE') myObj('regxruletr').style.display = 'block'; - else myObj('regxruletr').style.display = 'table-row'; +function selUrlRuleSet() { + if (myObj('urlrule2').checked) { + myObj('arearuletr').style.display = 'none'; + if (nav() == 'IE') myObj('regxruletr').style.display = 'block'; + else myObj('regxruletr').style.display = 'table-row'; } - else - { - if(nav()=='IE') myObj('arearuletr').style.display = 'block'; + else { + if (nav() == 'IE') myObj('arearuletr').style.display = 'block'; else myObj('arearuletr').style.display = 'table-row'; myObj('regxruletr').style.display = 'none'; } } -function testRss(){ +function testRss() { var surl = ''; surl = escape(myObj('rssurl').value); - showTestWin("co_do.php?dopost=testrss&rssurl="+surl); + showTestWin("co_do.php?dopost=testrss&rssurl=" + surl); } -function testRegx(){ +function testRegx() { var surl = escape(myObj('regxurl').value); var sstart = myObj('startid').value; var send = myObj('endid').value; var saddv = myObj('addv').value; - showTestWin("co_do.php?dopost=testregx®xurl="+surl+"&startid="+sstart+"&endid="+send+"&addv="+saddv); + showTestWin("co_do.php?dopost=testregx®xurl=" + surl + "&startid=" + sstart + "&endid=" + send + "&addv=" + saddv); } -function toHex( n ){ - var digitArray = new Array('0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f'); +function toHex(n) { + var digitArray = new Array('0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f'); var result = '' var start = true; - for ( var i=32; i>0; ) { - i -= 4; - var digit = ( n >> i ) & 0xf; + for (var i = 32; i > 0;) { + i -= 4; + var digit = (n >> i) & 0xf; if (!start || digit != 0) { - start = false; + start = false; result += digitArray[digit]; - } + } } - return ( result == '' ? '0' : result ); + return (result == '' ? '0' : result); } -function selTrim(selfield){ +function selTrim(selfield) { var tagobj = myObj(selfield); - if(nav()=='IE'){ var posLeft = window.event.clientX-200; var posTop = window.event.clientY; } - else{ var posLeft = 100;var posTop = 100; } - window.open("templets/co_trimrule.html?"+selfield, "coRule", "scrollbars=no,resizable=yes,statebar=no,width=320,height=180,left="+posLeft+", top="+posTop); + if (nav() == 'IE') { var posLeft = window.event.clientX - 200; var posTop = window.event.clientY; } + else { var posLeft = 100; var posTop = 100; } + window.open("templets/co_trimrule.html?" + selfield, "coRule", "scrollbars=no,resizable=yes,statebar=no,width=320,height=180,left=" + posLeft + ", top=" + posTop); } \ No newline at end of file diff --git a/src/dede/js/context_menu.js b/src/dede/js/context_menu.js index 050aea91..5149305c 100755 --- a/src/dede/js/context_menu.js +++ b/src/dede/js/context_menu.js @@ -1,7 +1,7 @@ /** * * @version $Id: context_menu.js 1 22:28 2010年7月20日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -100,11 +100,11 @@ ContextMenu.fixPos = function (x, y) { if(dw>0){ WebFX_PopUpcss.style.left = (x - dw) + ContextMenu.getScrollLeft() + "px"; }else { - WebFX_PopUpcss.style.left = x + ContextMenu.getScrollLeft(); + WebFX_PopUpcss.style.left = x + ContextMenu.getScrollLeft(); } if(dh>0) { - WebFX_PopUpcss.style.top = (y - dh) + ContextMenu.getScrollTop() + "px" + WebFX_PopUpcss.style.top = (y - dh) + ContextMenu.getScrollTop() + "px" }else{ - WebFX_PopUpcss.style.top = y + ContextMenu.getScrollTop(); }*/ + WebFX_PopUpcss.style.top = y + ContextMenu.getScrollTop(); }*/ WebFX_PopUpcss.style.top = y + "px"; WebFX_PopUpcss.style.left = x + "px"; } diff --git a/src/dede/js/dedeajax.js b/src/dede/js/dedeajax.js index bc5b2971..2f038a3a 100755 --- a/src/dede/js/dedeajax.js +++ b/src/dede/js/dedeajax.js @@ -1,7 +1,7 @@ /** * * @version $Id: dedeajax.js 1 22:28 2010年7月20日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -13,135 +13,134 @@ DedeXDOM = null; DedeContainer = null; //获取指定ID的元素 -function $(eid){ - return document.getElementById(eid); +function $(eid) { + return document.getElementById(eid); } function $DE(id) { - return document.getElementById(id); + return document.getElementById(id); } //参数 gcontainer 是保存下载完成的内容的容器 -function DedeAjax(gcontainer){ +function DedeAjax(gcontainer) { - DedeContainer = gcontainer; + DedeContainer = gcontainer; - //post或get发送数据的键值对 + //post或get发送数据的键值对 + this.keys = Array(); + this.values = Array(); + this.keyCount = -1; + + //http请求头 + this.rkeys = Array(); + this.rvalues = Array(); + this.rkeyCount = -1; + //请求头类型 + this.rtype = 'text'; + + //初始化xmlhttp + if (window.ActiveXObject) {//IE6、IE5 + try { DedeXHTTP = new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { } + if (DedeXHTTP == null) try { DedeXHTTP = new ActiveXObject("Microsoft.XMLHTTP"); } catch (e) { } + } + else { + DedeXHTTP = new XMLHttpRequest(); + } + + DedeXHTTP.onreadystatechange = function () { + if (DedeXHTTP.readyState == 4) { + if (DedeXHTTP.status == 200) { + DedeContainer.innerHTML = DedeXHTTP.responseText; + DedeXHTTP = null; + } else DedeContainer.innerHTML = "下载数据失败"; + } else DedeContainer.innerHTML = "正在下载数据..."; + }; + + //增加一个POST或GET键值对 + this.AddKey = function (skey, svalue) { + this.keyCount++; + this.keys[this.keyCount] = skey; + this.values[this.keyCount] = escape(svalue); + }; + + //增加一个Http请求头键值对 + this.AddHead = function (skey, svalue) { + this.rkeyCount++; + this.rkeys[this.rkeyCount] = skey; + this.rvalues[this.rkeyCount] = svalue; + }; + + //清除当前对象的哈希表参数 + this.ClearSet = function () { + this.keyCount = -1; this.keys = Array(); this.values = Array(); - this.keyCount = -1; - - //http请求头 + this.rkeyCount = -1; this.rkeys = Array(); this.rvalues = Array(); - this.rkeyCount = -1; - //请求头类型 - this.rtype = 'text'; - - //初始化xmlhttp - if(window.ActiveXObject){//IE6、IE5 - try { DedeXHTTP = new ActiveXObject("Msxml2.XMLHTTP");} catch (e) { } - if (DedeXHTTP == null) try { DedeXHTTP = new ActiveXObject("Microsoft.XMLHTTP");} catch (e) { } + }; + + //发送http请求头 + this.SendHead = function () { + if (this.rkeyCount != -1) { //发送用户自行设定的请求头 + for (; i <= this.rkeyCount; i++) { + DedeXHTTP.setRequestHeader(this.rkeys[i], this.rvalues[i]); + } } - else{ - DedeXHTTP = new XMLHttpRequest(); + if (this.rtype == 'binary') { + DedeXHTTP.setRequestHeader("Content-Type", "multipart/form-data"); + } else { + DedeXHTTP.setRequestHeader("Content-Type", "application/x-www-form-urlencoded"); } - - DedeXHTTP.onreadystatechange = function(){ - if(DedeXHTTP.readyState == 4){ - if(DedeXHTTP.status == 200){ - DedeContainer.innerHTML = DedeXHTTP.responseText; - DedeXHTTP = null; - }else DedeContainer.innerHTML = "下载数据失败"; - }else DedeContainer.innerHTML = "正在下载数据..."; -}; - -//增加一个POST或GET键值对 -this.AddKey = function(skey,svalue){ - this.keyCount++; - this.keys[this.keyCount] = skey; - this.values[this.keyCount] = escape(svalue); -}; - -//增加一个Http请求头键值对 -this.AddHead = function(skey,svalue){ - this.rkeyCount++; - this.rkeys[this.rkeyCount] = skey; - this.rvalues[this.rkeyCount] = svalue; -}; - -//清除当前对象的哈希表参数 -this.ClearSet = function(){ - this.keyCount = -1; - this.keys = Array(); - this.values = Array(); - this.rkeyCount = -1; - this.rkeys = Array(); - this.rvalues = Array(); -}; - -//发送http请求头 -this.SendHead = function(){ - if(this.rkeyCount!=-1){ //发送用户自行设定的请求头 - for(;i<=this.rkeyCount;i++){ - DedeXHTTP.setRequestHeader(this.rkeys[i],this.rvalues[i]); - } - } - if(this.rtype=='binary'){ - DedeXHTTP.setRequestHeader("Content-Type","multipart/form-data"); - }else{ - DedeXHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); - } -}; - -//用Post方式发送数据 -this.SendPost = function(purl){ - var pdata = ""; - var i=0; - this.state = 0; - DedeXHTTP.open("POST", purl, true); - this.SendHead(); - if(this.keyCount!=-1){ //post数据 - for(;i<=this.keyCount;i++){ - if(pdata=="") pdata = this.keys[i]+'='+this.values[i]; - else pdata += "&"+this.keys[i]+'='+this.values[i]; - } - } - DedeXHTTP.send(pdata); -}; - -//用GET方式发送数据 -this.SendGet = function(purl){ - var gkey = ""; - var i=0; - this.state = 0; - if(this.keyCount!=-1){ //get参数 - for(;i<=this.keyCount;i++){ - if(gkey=="") gkey = this.keys[i]+'='+this.values[i]; - else gkey += "&"+this.keys[i]+'='+this.values[i]; - } - if(purl.indexOf('?')==-1) purl = purl + '?' + gkey; - else purl = purl + '&' + gkey; - } - DedeXHTTP.open("GET", purl, true); - this.SendHead(); - DedeXHTTP.send(null); -}; + }; + + //用Post方式发送数据 + this.SendPost = function (purl) { + var pdata = ""; + var i = 0; + this.state = 0; + DedeXHTTP.open("POST", purl, true); + this.SendHead(); + if (this.keyCount != -1) { //post数据 + for (; i <= this.keyCount; i++) { + if (pdata == "") pdata = this.keys[i] + '=' + this.values[i]; + else pdata += "&" + this.keys[i] + '=' + this.values[i]; + } + } + DedeXHTTP.send(pdata); + }; + + //用GET方式发送数据 + this.SendGet = function (purl) { + var gkey = ""; + var i = 0; + this.state = 0; + if (this.keyCount != -1) { //get参数 + for (; i <= this.keyCount; i++) { + if (gkey == "") gkey = this.keys[i] + '=' + this.values[i]; + else gkey += "&" + this.keys[i] + '=' + this.values[i]; + } + if (purl.indexOf('?') == -1) purl = purl + '?' + gkey; + else purl = purl + '&' + gkey; + } + DedeXHTTP.open("GET", purl, true); + this.SendHead(); + DedeXHTTP.send(null); + }; } // End Class DedeAjax //初始化xmldom -function InitXDom(){ - if(DedeXDOM!=null) return; +function InitXDom() { + if (DedeXDOM != null) return; var obj = null; - if (typeof(DOMParser) != "undefined") { // Gecko、Mozilla、Firefox + if (typeof (DOMParser) != "undefined") { // Gecko、Mozilla、Firefox var parser = new DOMParser(); obj = parser.parseFromString(xmlText, "text/xml"); } else { // IE - try { obj = new ActiveXObject("MSXML2.DOMDocument");} catch (e) { } + try { obj = new ActiveXObject("MSXML2.DOMDocument"); } catch (e) { } if (obj == null) try { obj = new ActiveXObject("Microsoft.XMLDOM"); } catch (e) { } } DedeXDOM = obj; }; - \ No newline at end of file diff --git a/src/dede/js/dialog.js b/src/dede/js/dialog.js index 7f613527..dfe8eb66 100755 --- a/src/dede/js/dialog.js +++ b/src/dede/js/dialog.js @@ -1,24 +1,24 @@ /** * * @version $Id: dialog.js 1 22:28 2010年7月20日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ - + document.write("") -function editTitle(aid){ - var show = document.getElementById("show_news"); - var myajax = new DedeAjax(show,false,false,"","",""); - myajax.SendGet2("catalog_edit.php?dopost=time&id="+aid); - DedeXHTTP = null; +function editTitle(aid) { + var show = document.getElementById("show_news"); + var myajax = new DedeAjax(show, false, false, "", "", ""); + myajax.SendGet2("catalog_edit.php?dopost=time&id=" + aid); + DedeXHTTP = null; } -function $Dede(id){ return document.getElementById(id)} -function AlertMsg(title,id){ - var msgw,msgh,msgbg,msgcolor,bordercolor,titlecolor,titlebg,content; +function $Dede(id) { return document.getElementById(id) } +function AlertMsg(title, id) { + var msgw, msgh, msgbg, msgcolor, bordercolor, titlecolor, titlebg, content; //弹出窗口设置 msgw = 600; //窗口宽度 msgh = 400; //窗口高度 @@ -28,31 +28,31 @@ function AlertMsg(title,id){ titlecolor = "#254015"; //标题颜色 titlebg = "#369 url(images/tbg.gif)"; //标题背景 //遮罩背景设置 - content = "
对不起,载入失败
"; - var sWidth,sHeight; - sWidth = screen.availWidth; - if(screen.availHeight > document.body.scrollHeight){ + content = "
对不起,载入失败
"; + var sWidth, sHeight; + sWidth = screen.availWidth; + if (screen.availHeight > document.body.scrollHeight) { sHeight = screen.availHeight; //少于一屏 - }else{ + } else { sHeight = document.body.scrollHeight; //多于一屏 } //创建遮罩背景 - var maskObj = document.createElement("div"); - maskObj.setAttribute('id','maskdiv'); - maskObj.style.position = "absolute"; - maskObj.style.top = "0"; - maskObj.style.left = "0"; - maskObj.style.background = "#777"; - maskObj.style.filter = "Alpha(opacity=30);"; - maskObj.style.opacity = "0.3"; - maskObj.style.width = sWidth + "px"; - maskObj.style.height = sHeight + "px"; - maskObj.style.zIndex = "10000"; - document.body.appendChild(maskObj); + var maskObj = document.createElement("div"); + maskObj.setAttribute('id', 'maskdiv'); + maskObj.style.position = "absolute"; + maskObj.style.top = "0"; + maskObj.style.left = "0"; + maskObj.style.background = "#777"; + maskObj.style.filter = "Alpha(opacity=30);"; + maskObj.style.opacity = "0.3"; + maskObj.style.width = sWidth + "px"; + maskObj.style.height = sHeight + "px"; + maskObj.style.zIndex = "10000"; + document.body.appendChild(maskObj); //创建弹出窗口 - var msgObj = document.createElement("div") - msgObj.setAttribute("id","msgdiv"); - msgObj.style.position ="absolute"; + var msgObj = document.createElement("div") + msgObj.setAttribute("id", "msgdiv"); + msgObj.style.position = "absolute"; //msgObj.style.top = (screen.availHeight - msgh) / 4 + "px"; //msgObj.style.left = (screen.availWidth - msgw) / 2 + "px"; msgObj.style.top = "100px"; @@ -61,11 +61,11 @@ function AlertMsg(title,id){ msgObj.style.height = msgh + "px"; msgObj.style.fontSize = "12px"; msgObj.style.background = msgbg; - msgObj.style.border = "1px solid " + bordercolor; - msgObj.style.zIndex = "10001"; + msgObj.style.border = "1px solid " + bordercolor; + msgObj.style.zIndex = "10001"; //创建标题 var thObj = document.createElement("div"); - thObj.setAttribute("id","msgth"); + thObj.setAttribute("id", "msgth"); thObj.className = "DragAble"; thObj.title = "按住鼠标左键可以拖动窗口!"; thObj.style.cursor = "move"; @@ -73,11 +73,11 @@ function AlertMsg(title,id){ thObj.style.color = titlecolor; thObj.style.fontWeight = 'bold'; thObj.style.background = titlebg; - var titleStr = "关闭"+""+ title +""; + var titleStr = "关闭" + "" + title + ""; thObj.innerHTML = titleStr; //创建内容 var bodyObj = document.createElement("div"); - bodyObj.setAttribute("id","msgbody"); + bodyObj.setAttribute("id", "msgbody"); bodyObj.style.padding = "0px"; bodyObj.style.lineHeight = "1.5em"; var txt = document.createTextNode(content); @@ -89,44 +89,44 @@ function AlertMsg(title,id){ $Dede("msgdiv").appendChild(bodyObj); editTitle(id); } -function CloseMsg(){ +function CloseMsg() { //移除对象 - document.body.removeChild($Dede("maskdiv")); - $Dede("msgdiv").removeChild($Dede("msgth")); - $Dede("msgdiv").removeChild($Dede("msgbody")); - document.body.removeChild($Dede("msgdiv")); + document.body.removeChild($Dede("maskdiv")); + $Dede("msgdiv").removeChild($Dede("msgth")); + $Dede("msgdiv").removeChild($Dede("msgbody")); + document.body.removeChild($Dede("msgdiv")); } //拖动窗口 -var ie = document.all; -var nn6 = document.getElementById&&!document.all; -var isdrag = false; -var y,x; -var oDragObj; - -function moveMouse(e) { - if (isdrag) { - oDragObj.style.top = (nn6 ? nTY + e.clientY - y : nTY + event.clientY - y)+"px"; - oDragObj.style.left = (nn6 ? nTX + e.clientX - x : nTX + event.clientX - x)+"px"; - return false; - } -} - -function initDrag(e) { - var oDragHandle = nn6 ? e.target : event.srcElement; - var topElement = "HTML"; - while (oDragHandle.tagName != topElement && oDragHandle.className != "DragAble") { - oDragHandle = nn6 ? oDragHandle.parentNode : oDragHandle.parentElement; - } - if (oDragHandle.className=="DragAble") { - isdrag = true; - oDragObj = oDragHandle.parentNode; - nTY = parseInt(oDragObj.style.top); - y = nn6 ? e.clientY : event.clientY; - nTX = parseInt(oDragObj.style.left); - x = nn6 ? e.clientX : event.clientX; - document.onmousemove = moveMouse; - return false; - } -} -document.onmousedown = initDrag; +var ie = document.all; +var nn6 = document.getElementById && !document.all; +var isdrag = false; +var y, x; +var oDragObj; + +function moveMouse(e) { + if (isdrag) { + oDragObj.style.top = (nn6 ? nTY + e.clientY - y : nTY + event.clientY - y) + "px"; + oDragObj.style.left = (nn6 ? nTX + e.clientX - x : nTX + event.clientX - x) + "px"; + return false; + } +} + +function initDrag(e) { + var oDragHandle = nn6 ? e.target : event.srcElement; + var topElement = "HTML"; + while (oDragHandle.tagName != topElement && oDragHandle.className != "DragAble") { + oDragHandle = nn6 ? oDragHandle.parentNode : oDragHandle.parentElement; + } + if (oDragHandle.className == "DragAble") { + isdrag = true; + oDragObj = oDragHandle.parentNode; + nTY = parseInt(oDragObj.style.top); + y = nn6 ? e.clientY : event.clientY; + nTX = parseInt(oDragObj.style.left); + x = nn6 ? e.clientX : event.clientX; + document.onmousemove = moveMouse; + return false; + } +} +document.onmousedown = initDrag; document.onmouseup = new Function("isdrag=false"); diff --git a/src/dede/js/diy.js b/src/dede/js/diy.js index 840ffb39..bee3ef24 100755 --- a/src/dede/js/diy.js +++ b/src/dede/js/diy.js @@ -1,15 +1,15 @@ /** * * @version $Id: diy.js 1 22:28 2010年7月20日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ - - -function showHide2(objname){ + + +function showHide2(objname) { var obj = $Obj(objname); - if(obj.style.display != 'block'){ obj.style.display = 'block' } - else{ obj.style.display = 'none'; } + if (obj.style.display != 'block') { obj.style.display = 'block' } + else { obj.style.display = 'none'; } } \ No newline at end of file diff --git a/src/dede/js/float.js b/src/dede/js/float.js index 39894f56..de585223 100755 --- a/src/dede/js/float.js +++ b/src/dede/js/float.js @@ -1,111 +1,111 @@ /** * * @version $Id: float.js 1 22:28 2010年7月20日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ - \ No newline at end of file diff --git a/src/dede/js/frame.js b/src/dede/js/frame.js index 1aee753d..02151cee 100755 --- a/src/dede/js/frame.js +++ b/src/dede/js/frame.js @@ -1,124 +1,108 @@ - - - + + diff --git a/src/dede/js/handlers.js b/src/dede/js/handlers.js index 32500854..00543821 100755 --- a/src/dede/js/handlers.js +++ b/src/dede/js/handlers.js @@ -1,16 +1,16 @@ /** * * @version $Id: handlers.js 1 22:28 2010年7月20日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ //---事件句并------------------------------ -function fileQueueError(file, errorCode, message){ - try { - var imageName = "error.gif"; +function fileQueueError(file, errorCode, message) { + try { + var imageName = "error.gif"; var errorName = ""; if (errorCode === SWFUpload.errorCode_QUEUE_LIMIT_EXCEEDED) { errorName = "你添加的文件超过了限制!"; @@ -22,17 +22,17 @@ function fileQueueError(file, errorCode, message){ } switch (errorCode) { - case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: - imageName = "zerobyte.gif"; - break; - case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: - imageName = "toobig.gif"; - break; - case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: - case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE: - default: - alert(message); - break; + case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: + imageName = "zerobyte.gif"; + break; + case SWFUpload.QUEUE_ERROR.FILE_EXCEEDS_SIZE_LIMIT: + imageName = "toobig.gif"; + break; + case SWFUpload.QUEUE_ERROR.ZERO_BYTE_FILE: + case SWFUpload.QUEUE_ERROR.INVALID_FILETYPE: + default: + alert(message); + break; } addImage("images/" + imageName, 0); } catch (ex) { @@ -54,7 +54,7 @@ function fileDialogComplete(numFilesSelected, numFilesQueued) { function uploadProgress(file, bytesLoaded) { try { var percent = Math.ceil((bytesLoaded / file.size) * 100); - var progress = new FileProgress(file, this.customSettings.upload_target); + var progress = new FileProgress(file, this.customSettings.upload_target); progress.setProgress(percent); if (percent === 100) { progress.setStatus("创建缩略图..."); @@ -70,7 +70,7 @@ function uploadProgress(file, bytesLoaded) { function uploadSuccess(file, serverData) { try { - var progress = new FileProgress(file, this.customSettings.upload_target); + var progress = new FileProgress(file, this.customSettings.upload_target); if (serverData.substring(0, 7) === "FILEID:") { addImage("swfupload.php?dopost=thumbnail&id=" + serverData.substring(7), serverData.substring(7)); @@ -95,7 +95,7 @@ function uploadComplete(file) { if (this.getStats().files_queued > 0) { this.startUpload(); } else { - var progress = new FileProgress(file, this.customSettings.upload_target); + var progress = new FileProgress(file, this.customSettings.upload_target); progress.setComplete(); progress.setStatus("所有图片上传完成..."); progress.toggleCancel(false); @@ -106,37 +106,37 @@ function uploadComplete(file) { } function uploadError(file, errorCode, message) { - var imageName = "error.gif"; + var imageName = "error.gif"; var progress; try { switch (errorCode) { - case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED: - try { - progress = new FileProgress(file, this.customSettings.upload_target); - progress.setCancelled(); - progress.setStatus("Cancelled"); - progress.toggleCancel(false); - } - catch (ex1) { - this.debug(ex1); - } - break; - case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED: - try { - progress = new FileProgress(file, this.customSettings.upload_target); - progress.setCancelled(); - progress.setStatus("Stopped"); - progress.toggleCancel(true); - } - catch (ex2) { - this.debug(ex2); - } - case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED: - imageName = "uploadlimit.gif"; - break; - default: - alert(message); - break; + case SWFUpload.UPLOAD_ERROR.FILE_CANCELLED: + try { + progress = new FileProgress(file, this.customSettings.upload_target); + progress.setCancelled(); + progress.setStatus("Cancelled"); + progress.toggleCancel(false); + } + catch (ex1) { + this.debug(ex1); + } + break; + case SWFUpload.UPLOAD_ERROR.UPLOAD_STOPPED: + try { + progress = new FileProgress(file, this.customSettings.upload_target); + progress.setCancelled(); + progress.setStatus("Stopped"); + progress.toggleCancel(true); + } + catch (ex2) { + this.debug(ex2); + } + case SWFUpload.UPLOAD_ERROR.UPLOAD_LIMIT_EXCEEDED: + imageName = "uploadlimit.gif"; + break; + default: + alert(message); + break; } addImage("images/" + imageName, 0); @@ -148,29 +148,28 @@ function uploadError(file, errorCode, message) { } var albImg = 0; -function addImage(src, pid){ +function addImage(src, pid) { var newImgDiv = document.createElement("div"); var delstr = ''; var iptwidth = 190; albImg++; - if(pid != 0) { + if (pid != 0) { albImg = 'ok' + pid; - delstr = '[删除]'; + delstr = '[删除]'; } else { albImg = 'err' + albImg; } newImgDiv.className = 'albCt'; - newImgDiv.id = 'albCt'+albImg; + newImgDiv.id = 'albCt' + albImg; document.getElementById("thumbnails").appendChild(newImgDiv); - newImgDiv.innerHTML = ''+delstr; - if(typeof arctype != 'undefined' && arctype == 'article' ) - { + newImgDiv.innerHTML = '' + delstr; + if (typeof arctype != 'undefined' && arctype == 'article') { iptwidth = 100; - if(pid != 0) { - newImgDiv.innerHTML = ''+delstr; + if (pid != 0) { + newImgDiv.innerHTML = '' + delstr; } } - newImgDiv.innerHTML += '
注释:
'; + newImgDiv.innerHTML += '
注释:
'; } diff --git a/src/dede/js/ieemu.js b/src/dede/js/ieemu.js index 367092b0..d709e99d 100755 --- a/src/dede/js/ieemu.js +++ b/src/dede/js/ieemu.js @@ -1,7 +1,7 @@ /** * * @version $Id: ieemu.js 1 22:28 2010年7月20日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -15,14 +15,14 @@ var moz = !ie && document.getElementById != null && document.layers == null; * fromElement and toElement */ function extendEventObject() { - Event.prototype.__defineSetter__("returnValue", function (b) { + Event.prototype.__defineSetter__("returnValue", function (b) { if (!b) this.preventDefault(); }); - + Event.prototype.__defineSetter__("cancelBubble", function (b) { if (b) this.stopPropagation(); }); - + Event.prototype.__defineGetter__("srcElement", function () { var node = this.target; while (node.nodeType != 1) node = node.parentNode; @@ -50,7 +50,7 @@ function extendEventObject() { while (node.nodeType != 1) node = node.parentNode; return node; }); - + Event.prototype.__defineGetter__("offsetX", function () { return this.layerX; }); @@ -63,24 +63,24 @@ function extendEventObject() { * Emulates element.attachEvent as well as detachEvent */ function emulateAttachEvent() { - HTMLDocument.prototype.attachEvent = - HTMLElement.prototype.attachEvent = function (sType, fHandler) { - var shortTypeName = sType.replace(/on/, ""); - fHandler._ieEmuEventHandler = function (e) { - window.event = e; - return fHandler(); + HTMLDocument.prototype.attachEvent = + HTMLElement.prototype.attachEvent = function (sType, fHandler) { + var shortTypeName = sType.replace(/on/, ""); + fHandler._ieEmuEventHandler = function (e) { + window.event = e; + return fHandler(); + }; + this.addEventListener(shortTypeName, fHandler._ieEmuEventHandler, false); }; - this.addEventListener(shortTypeName, fHandler._ieEmuEventHandler, false); - }; - HTMLDocument.prototype.detachEvent = - HTMLElement.prototype.detachEvent = function (sType, fHandler) { - var shortTypeName = sType.replace(/on/, ""); - if (typeof fHandler._ieEmuEventHandler == "function") - this.removeEventListener(shortTypeName, fHandler._ieEmuEventHandler, false); - else - this.removeEventListener(shortTypeName, fHandler, true); - }; + HTMLDocument.prototype.detachEvent = + HTMLElement.prototype.detachEvent = function (sType, fHandler) { + var shortTypeName = sType.replace(/on/, ""); + if (typeof fHandler._ieEmuEventHandler == "function") + this.removeEventListener(shortTypeName, fHandler._ieEmuEventHandler, false); + else + this.removeEventListener(shortTypeName, fHandler, true); + }; } /* @@ -88,7 +88,7 @@ function emulateAttachEvent() { * event to window.event */ function emulateEventHandlers(eventNames) { - for (var i = 0; i < eventNames.length; i++) { + for (var i = 0; i < eventNames.length; i++) { document.addEventListener(eventNames[i], function (e) { window.event = e; }, true); // using capture @@ -99,7 +99,7 @@ function emulateEventHandlers(eventNames) { * Simple emulation of document.all * this one is far from complete. Be cautious */ - + function emulateAllModel() { var allGetter = function () { var a = this.getElementsByTagName("*"); @@ -118,7 +118,7 @@ function extendElementModel() { if (this.parentNode == this.ownerDocument) return null; return this.parentNode; }); - + HTMLElement.prototype.__defineGetter__("children", function () { var tmp = []; var j = 0; @@ -138,11 +138,11 @@ function extendElementModel() { } return tmp; }); - + HTMLElement.prototype.contains = function (oEl) { if (oEl == this) return true; if (oEl == null) return false; - return this.contains(oEl.parentNode); + return this.contains(oEl.parentNode); }; } @@ -187,43 +187,43 @@ function emulateHTMLModel() { HTMLElement.prototype.insertAdjacentHTML = function (sWhere, sHTML) { var df; // : DocumentFragment var r = this.ownerDocument.createRange(); - + switch (String(sWhere).toLowerCase()) { case "beforebegin": r.setStartBefore(this); df = r.createContextualFragment(sHTML); this.parentNode.insertBefore(df, this); break; - + case "afterbegin": r.selectNodeContents(this); r.collapse(true); df = r.createContextualFragment(sHTML); this.insertBefore(df, this.firstChild); break; - + case "beforeend": r.selectNodeContents(this); r.collapse(false); df = r.createContextualFragment(sHTML); this.appendChild(df); break; - + case "afterend": r.setStartAfter(this); df = r.createContextualFragment(sHTML); this.parentNode.insertBefore(df, this.nextSibling); break; - } + } }; HTMLElement.prototype.__defineSetter__("outerHTML", function (sHTML) { - var r = this.ownerDocument.createRange(); - r.setStartBefore(this); - var df = r.createContextualFragment(sHTML); - this.parentNode.replaceChild(df, this); - - return sHTML; + var r = this.ownerDocument.createRange(); + r.setStartBefore(this); + var df = r.createContextualFragment(sHTML); + this.parentNode.replaceChild(df, this); + + return sHTML; }); HTMLElement.prototype.__defineGetter__("canHaveChildren", function () { @@ -256,14 +256,14 @@ function emulateHTMLModel() { } if (!this.canHaveChildren) return str + ">"; - + return str + ">" + this.innerHTML + ""; }); HTMLElement.prototype.__defineSetter__("innerText", function (sText) { this.innerHTML = convertTextToHTML(sText); - return sText; + return sText; }); var tmpGet; diff --git a/src/dede/js/main.js b/src/dede/js/main.js index 0eb307f3..d85f885c 100755 --- a/src/dede/js/main.js +++ b/src/dede/js/main.js @@ -382,7 +382,7 @@ function LoadQuickDiv(e, surl, oname, w, h) { newobj.style.position = 'absolute'; newobj.className = 'pubdlg'; newobj.style.width = w; - newobj.style.height = h+30; + newobj.style.height = h + 30; document.body.appendChild(newobj); } if (posTop > 500) posTop = 500; @@ -623,7 +623,7 @@ args = { // 这里用到了一个展开语法 // https://developer.mozilla.org/zh-CN/docs/Web/JavaScript/Reference/Operators/Spread_syntax function ShowMsg(content, ...args) { - title = "DedeCMS信息提示"; + title = "DedeBIZ信息提示"; if (typeof content == "undefined") content = ""; modalID = guid(); var footer = ``; @@ -776,7 +776,7 @@ $(document).ready(function () { '" width=200>

宽度:px,高度:px

' + optButton + '
', { footer: footer, noClose: false, - title: 'DedeCMS缩略图裁剪', + title: 'DedeBIZ缩略图裁剪', }); setTimeout(function () { @@ -813,7 +813,7 @@ $(document).ready(function () { }, function (start) { $(this).val(start.format("YYYY-MM-DD HH:mm:ss")); }); - $('.datepicker').on('show.daterangepicker', function(ev, picker) { + $('.datepicker').on('show.daterangepicker', function (ev, picker) { if (picker.element.offset().top - $(window).scrollTop() + picker.container.outerHeight() > $(window).height()) { picker.drops = 'up'; } else { diff --git a/src/dede/log_edit.php b/src/dede/log_edit.php index 2f00d8f4..18b0c6f3 100755 --- a/src/dede/log_edit.php +++ b/src/dede/log_edit.php @@ -1,51 +1,42 @@ ExecuteNoneQuery("DELETE FROM #@__log"); - ShowMsg("成功清空所有日志!","log_list.php"); + ShowMsg("成功清空所有日志!", "log_list.php"); exit(); -} -else if($dopost=="del") -{ +} else if ($dopost == "del") { $bkurl = isset($_COOKIE['ENV_GOBACK_URL']) ? $_COOKIE['ENV_GOBACK_URL'] : "log_list.php"; - $ids = explode('`',$ids); + $ids = explode('`', $ids); $dquery = ""; - foreach($ids as $id) - { - if($dquery=="") - { + foreach ($ids as $id) { + if ($dquery == "") { $dquery .= " lid='$id' "; - } - else - { + } else { $dquery .= " Or lid='$id' "; } } - if($dquery!="") $dquery = " where ".$dquery; + if ($dquery != "") $dquery = " where " . $dquery; $dsql->ExecuteNoneQuery("DELETE FROM #@__log $dquery"); - ShowMsg("成功删除指定的日志!",$bkurl); + ShowMsg("成功删除指定的日志!", $bkurl); exit(); -} -else -{ - ShowMsg("无法识别你的请求!","javascript:;"); +} else { + ShowMsg("无法识别你的请求!", "javascript:;"); exit(); -} \ No newline at end of file +} diff --git a/src/dede/log_list.php b/src/dede/log_list.php index 8b2f683c..34836ded 100755 --- a/src/dede/log_list.php +++ b/src/dede/log_list.php @@ -1,30 +1,30 @@ 0) $where .= " AND #@__log.adminid='$adminid' "; -if($cip!="") $where .= " AND #@__log.cip LIKE '%$cip%' "; +if (empty($adminid)) $adminid = 0; +if (empty($cip)) $cip = ""; +if (empty($dtime)) $dtime = 0; +if ($adminid > 0) $where .= " AND #@__log.adminid='$adminid' "; +if ($cip != "") $where .= " AND #@__log.cip LIKE '%$cip%' "; -if($dtime>0) -{ +if ($dtime > 0) { $nowtime = time(); - $starttime = $nowtime - ($dtime*24*3600); + $starttime = $nowtime - ($dtime * 24 * 3600); $where .= " AND #@__log.dtime>'$starttime' "; } $sql = "SELECT #@__log.*,#@__admin.userid FROM #@__log @@ -33,15 +33,14 @@ $sql = "SELECT #@__log.*,#@__admin.userid FROM #@__log $adminlist = ""; $dsql->SetQuery("SELECT id,uname FROM #@__admin"); $dsql->Execute('admin'); -while($myrow = $dsql->GetObject('admin')) -{ - $adminlist .="\r\n"; +while ($myrow = $dsql->GetObject('admin')) { + $adminlist .= "\r\n"; } $dlist = new DataListCP(); $dlist->pageSize = 20; -$dlist->SetParameter("adminid",$adminid); -$dlist->SetParameter("cip",$cip); -$dlist->SetParameter("dtime",$dtime); -$dlist->SetTemplate(DEDEADMIN."/templets/log_list.htm"); +$dlist->SetParameter("adminid", $adminid); +$dlist->SetParameter("cip", $cip); +$dlist->SetParameter("dtime", $dtime); +$dlist->SetTemplate(DEDEADMIN . "/templets/log_list.htm"); $dlist->SetSource($sql); -$dlist->Display(); \ No newline at end of file +$dlist->Display(); diff --git a/src/dede/login.php b/src/dede/login.php index 8ba56ae2..c65aa068 100755 --- a/src/dede/login.php +++ b/src/dede/login.php @@ -1,114 +1,100 @@ 您的管理目录的名称中包含默认名称dede,建议在FTP里把它修改为其它名称,那样会更安全!'; -} -else -{ +} else { $redmsg = ''; } //登录检测 -$admindirs = explode('/',str_replace("\\",'/',dirname(__FILE__))); -$admindir = $admindirs[count($admindirs)-1]; -if($dopost=='login') -{ +$admindirs = explode('/', str_replace("\\", '/', dirname(__FILE__))); +$admindir = $admindirs[count($admindirs) - 1]; +if ($dopost == 'login') { $validate = empty($validate) ? '' : strtolower(trim($validate)); $svali = strtolower(GetCkVdValue()); - if(($validate=='' || $validate != $svali) && preg_match("/6/",$safe_gdopen)){ + if (($validate == '' || $validate != $svali) && preg_match("/6/", $safe_gdopen)) { ResetVdValue(); - ShowMsg('验证码不正确!','login.php',0,1000); + ShowMsg('验证码不正确!', 'login.php', 0, 1000); exit; } else { $cuserLogin = new userLogin($admindir); - if(!empty($userid) && !empty($pwd)) - { - $res = $cuserLogin->checkUser($userid,$pwd); + if (!empty($userid) && !empty($pwd)) { + $res = $cuserLogin->checkUser($userid, $pwd); //success - if($res==1) - { + if ($res == 1) { $cuserLogin->keepUser(); - if(!empty($gotopage)) - { - ShowMsg('成功登录,正在转向管理管理主页!',$gotopage); + if (!empty($gotopage)) { + ShowMsg('成功登录,正在转向管理管理主页!', $gotopage); exit(); - } - else - { - ShowMsg('成功登录,正在转向管理管理主页!',"index.php"); + } else { + ShowMsg('成功登录,正在转向管理管理主页!', "index.php"); exit(); } } //error - else if($res==-1) - { + else if ($res == -1) { ResetVdValue(); - ShowMsg('你的用户名不存在!','login.php',0,1000); - exit; - } - else - { + ShowMsg('你的用户名不存在!', 'login.php', 0, 1000); + exit; + } else { ResetVdValue(); - ShowMsg('你的密码错误!','login.php',0,1000); - exit; + ShowMsg('你的密码错误!', 'login.php', 0, 1000); + exit; } } //password empty - else - { + else { ResetVdValue(); - ShowMsg('用户和密码没填写完整!','login.php',0,1000); - exit; + ShowMsg('用户和密码没填写完整!', 'login.php', 0, 1000); + exit; } } } -include('templets/login.htm'); \ No newline at end of file +include('templets/login.htm'); diff --git a/src/dede/makehtml_all.php b/src/dede/makehtml_all.php index 8b79d4e7..852d3b8a 100755 --- a/src/dede/makehtml_all.php +++ b/src/dede/makehtml_all.php @@ -1,159 +1,132 @@ dsql->GetOne("SELECT * FROM `#@__homepageset` "); - $templet = str_replace("{style}", $cfg_df_style,$row['templet']); - $homeFile = DEDEADMIN.'/'.$row['position']; - $homeFile = str_replace("\\", '/', $homeFile); - $homeFile = preg_replace("#\/{1,}#" ,'/', $homeFile); - if($row['showmod'] == 1) - { - $pv->SetTemplet($cfg_basedir.$cfg_templets_dir.'/'.$templet); - $pv->SaveToHtml($homeFile); - $pv->Close(); - } else { - if (file_exists($homeFile)) @unlink($homeFile); - } - ShowMsg("完成更新所有文档,现在开始更新栏目页!","makehtml_all.php?action=make&step=4&uptype=$uptype&mkvalue=$mkvalue"); + $templet = str_replace("{style}", $cfg_df_style, $row['templet']); + $homeFile = DEDEADMIN . '/' . $row['position']; + $homeFile = str_replace("\\", '/', $homeFile); + $homeFile = preg_replace("#\/{1,}#", '/', $homeFile); + if ($row['showmod'] == 1) { + $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . '/' . $templet); + $pv->SaveToHtml($homeFile); + $pv->Close(); + } else { + if (file_exists($homeFile)) @unlink($homeFile); + } + ShowMsg("完成更新所有文档,现在开始更新栏目页!", "makehtml_all.php?action=make&step=4&uptype=$uptype&mkvalue=$mkvalue"); exit(); } //更新栏目 /*------------------- function _4_MakeCatalog() - --------------------*/ - else if($step==4) - { + --------------------*/ else if ($step == 4) { $mkvalue = intval($mkvalue); $typeidsok = $typeids = array(); $adminID = $cuserLogin->getUserID(); - $mkcachefile = DEDEDATA."/mkall_cache_{$adminID}.php"; - if($uptype=='all' || empty($mkvalue)) - { + $mkcachefile = DEDEDATA . "/mkall_cache_{$adminID}.php"; + if ($uptype == 'all' || empty($mkvalue)) { ShowMsg("不需要进行初处理,现更新所有栏目!", "makehtml_list_action.php?gotype=mkallct"); exit(); - } - else - { - if($uptype=='time') - { - $query = "SELECT DISTINCT typeid From `#@__arctiny` WHERE senddate >=".GetMkTime($mkvalue)." AND arcrank>-1"; - } - else - { + } else { + if ($uptype == 'time') { + $query = "SELECT DISTINCT typeid From `#@__arctiny` WHERE senddate >=" . GetMkTime($mkvalue) . " AND arcrank>-1"; + } else { $query = "SELECT DISTINCT typeid From `#@__arctiny` WHERE id>=$mkvalue AND arcrank>-1"; } $dsql->SetQuery($query); $dsql->Execute(); - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $typeids[$row['typeid']] = 1; } - foreach($typeids as $k=>$v) - { + foreach ($typeids as $k => $v) { $vs = array(); $vs = GetParentIds($k); - if( !isset($typeidsok[$k]) ) - { + if (!isset($typeidsok[$k])) { $typeidsok[$k] = 1; } - foreach($vs as $k=>$v) - { - if(!isset($typeidsok[$v])) - { + foreach ($vs as $k => $v) { + if (!isset($typeidsok[$v])) { $typeidsok[$v] = 1; } } } } - $fp = fopen($mkcachefile,'w') or die("无法写入缓存文件:{$mkcachefile} 所以无法更新栏目!"); - if(count($typeidsok)>0) - { - fwrite($fp,"<"."?php\r\n"); + $fp = fopen($mkcachefile, 'w') or die("无法写入缓存文件:{$mkcachefile} 所以无法更新栏目!"); + if (count($typeidsok) > 0) { + fwrite($fp, "<" . "?php\r\n"); $i = -1; - foreach($typeidsok as $k=>$t) - { - if($k!='') - { + foreach ($typeidsok as $k => $t) { + if ($k != '') { $i++; fwrite($fp, "\$idArray[$i]={$k};\r\n"); } } - fwrite($fp,"?".">"); + fwrite($fp, "?" . ">"); fclose($fp); - ShowMsg("完成栏目缓存处理,现转向更新栏目!","makehtml_list_action.php?gotype=mkall"); + ShowMsg("完成栏目缓存处理,现转向更新栏目!", "makehtml_list_action.php?gotype=mkall"); exit(); - } - else - { + } else { fclose($fp); - ShowMsg("没有可更新的栏目,现在作最后数据优化!","makehtml_all.php?action=make&step=10"); + ShowMsg("没有可更新的栏目,现在作最后数据优化!", "makehtml_all.php?action=make&step=10"); exit(); } } //成功状态 /*------------------- function _10_MakeAllOK() - --------------------*/ - else if($step==10) - { + --------------------*/ else if ($step == 10) { $adminID = $cuserLogin->getUserID(); - $mkcachefile = DEDEDATA."/mkall_cache_{$adminID}.php"; + $mkcachefile = DEDEDATA . "/mkall_cache_{$adminID}.php"; @unlink($mkcachefile); OptimizeData($dsql); - ShowMsg("完成所有文件的更新!","javascript:;"); + ShowMsg("完成所有文件的更新!", "javascript:;"); exit(); - }//make step + } //make step } //action=='make' @@ -167,15 +140,14 @@ else if($action=='make') function OptimizeData($dsql) { global $cfg_dbprefix; - $tptables = array("{$cfg_dbprefix}archives","{$cfg_dbprefix}arctiny"); + $tptables = array("{$cfg_dbprefix}archives", "{$cfg_dbprefix}arctiny"); $dsql->SetQuery("SELECT maintable,addtable FROM `#@__channeltype` "); $dsql->Execute(); - while($row = $dsql->GetObject()) - { - $addtable = str_replace('#@__',$cfg_dbprefix,$row->addtable); - if($addtable!='' && !in_array($addtable,$tptables)) $tptables[] = $addtable; + while ($row = $dsql->GetObject()) { + $addtable = str_replace('#@__', $cfg_dbprefix, $row->addtable); + if ($addtable != '' && !in_array($addtable, $tptables)) $tptables[] = $addtable; } $tptable = ''; - foreach($tptables as $t) $tptable .= ($tptable=='' ? "`{$t}`" : ",`{$t}`" ); + foreach ($tptables as $t) $tptable .= ($tptable == '' ? "`{$t}`" : ",`{$t}`"); $dsql->ExecuteNoneQuery(" OPTIMIZE TABLE $tptable; "); -} \ No newline at end of file +} diff --git a/src/dede/makehtml_archives.php b/src/dede/makehtml_archives.php index 9ed2ed12..bcdd23e3 100755 --- a/src/dede/makehtml_archives.php +++ b/src/dede/makehtml_archives.php @@ -1,13 +1,14 @@ =$startid AND arcrank=0 "); -if($endid > $startid && $startid > 0) $gwhere .= " AND id <= $endid "; +$gwhere = ($startid == -1 ? " WHERE arcrank=0 " : " WHERE id>=$startid AND arcrank=0 "); +if ($endid > $startid && $startid > 0) $gwhere .= " AND id <= $endid "; -if($typeid!=0) { +if ($typeid != 0) { $ids = GetSonIds($typeid); $gwhere .= " AND typeid in($ids) "; } -if($idsql=='') $idsql = $gwhere; +if ($idsql == '') $idsql = $gwhere; -if($seltime==1) -{ +if ($seltime == 1) { $t1 = GetMkTime($stime); $t2 = GetMkTime($etime); $idsql .= " And (senddate >= $t1 And senddate <= $t2) "; -} -else if(isset($t1) && is_numeric($t1)) -{ +} else if (isset($t1) && is_numeric($t1)) { $idsql .= " And senddate >= $t1 "; } //统计记录总数 -if($totalnum==0) -{ +if ($totalnum == 0) { $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__arctiny` $idsql"); $totalnum = $row['dd']; //清空缓存 @@ -69,27 +63,23 @@ if($totalnum==0) } //获取记录,并生成HTML -if($totalnum > $startdd+$pagesize) -{ +if ($totalnum > $startdd + $pagesize) { $limitSql = " LIMIT $startdd,$pagesize"; -} -else { - $limitSql = " LIMIT $startdd,".($totalnum - $startdd); +} else { + $limitSql = " LIMIT $startdd," . ($totalnum - $startdd); } $tjnum = $startdd; -if(empty($sstime)) $sstime = time(); +if (empty($sstime)) $sstime = time(); //如果生成数量大于500,并且没选栏目,按栏目排序生成 -if($totalnum > 500 && empty($typeid)) -{ - $dsql->Execute('out',"SELECT id FROM `#@__arctiny` $idsql ORDER BY typeid ASC $limitSql"); +if ($totalnum > 500 && empty($typeid)) { + $dsql->Execute('out', "SELECT id FROM `#@__arctiny` $idsql ORDER BY typeid ASC $limitSql"); } else { - $dsql->Execute('out',"SELECT id FROM `#@__arctiny` $idsql $limitSql"); + $dsql->Execute('out', "SELECT id FROM `#@__arctiny` $idsql $limitSql"); } -while($row=$dsql->GetObject('out')) -{ +while ($row = $dsql->GetObject('out')) { $tjnum++; $id = $row->id; $ac = new Archives($id); @@ -99,13 +89,13 @@ while($row=$dsql->GetObject('out')) $t2 = ExecTime(); $t2 = ($t2 - $est1); $ttime = time() - $sstime; -$ttime = number_format(($ttime / 60),2); +$ttime = number_format(($ttime / 60), 2); //返回提示信息 -$tjlen = $totalnum>0 ? ceil( ($tjnum/$totalnum) * 100 ) : 100; +$tjlen = $totalnum > 0 ? ceil(($tjnum / $totalnum) * 100) : 100; $dvlen = $tjlen * 2; $tjsta = "
"; -$tjsta .= "
本次用时:".number_format($t2,2).",总用时:$ttime 分钟,到达位置:".($startdd+$pagesize)."
完成创建文件总数的:$tjlen %,继续执行任务..."; +$tjsta .= "
本次用时:" . number_format($t2, 2) . ",总用时:$ttime 分钟,到达位置:" . ($startdd + $pagesize) . "
完成创建文件总数的:$tjlen %,继续执行任务..."; //速度测试 @@ -117,27 +107,20 @@ if($startdd > 1000) } */ -if($tjnum < $totalnum) -{ +if ($tjnum < $totalnum) { $nurl = "makehtml_archives_action.php?endid=$endid&startid=$startid&typeid=$typeid"; - $nurl .= "&totalnum=$totalnum&startdd=".($startdd+$pagesize)."&pagesize=$pagesize"; - $nurl .= "&seltime=$seltime&sstime=$sstime&stime=".urlencode($stime)."&etime=".urlencode($etime)."&uptype=$uptype&mkvalue=$mkvalue"; - ShowMsg($tjsta,$nurl,0,100); + $nurl .= "&totalnum=$totalnum&startdd=" . ($startdd + $pagesize) . "&pagesize=$pagesize"; + $nurl .= "&seltime=$seltime&sstime=$sstime&stime=" . urlencode($stime) . "&etime=" . urlencode($etime) . "&uptype=$uptype&mkvalue=$mkvalue"; + ShowMsg($tjsta, $nurl, 0, 100); exit(); -} -else -{ - if($typeid!='') - { - ShowMsg("生成文件:$totalnum 总用时:{$ttime} 分钟,现转向当前栏目更新>>","makehtml_list_action.php?typeid=$typeid&uptype=all&maxpagesize=50&upnext=1"); - } - else - { - if($uptype=='') - { - ShowMsg("完成所有创建任务!,生成文件:$totalnum 总用时:{$ttime} 分钟。","javascript:;"); +} else { + if ($typeid != '') { + ShowMsg("生成文件:$totalnum 总用时:{$ttime} 分钟,现转向当前栏目更新>>", "makehtml_list_action.php?typeid=$typeid&uptype=all&maxpagesize=50&upnext=1"); + } else { + if ($uptype == '') { + ShowMsg("完成所有创建任务!,生成文件:$totalnum 总用时:{$ttime} 分钟。", "javascript:;"); } else { - ShowMsg("完成文档HTML更新任务,现在开始进行主页更新...","makehtml_all.php?action=make&step=3&uptype=$uptype&mkvalue=$mkvalue"); + ShowMsg("完成文档HTML更新任务,现在开始进行主页更新...", "makehtml_all.php?action=make&step=3&uptype=$uptype&mkvalue=$mkvalue"); } } -} \ No newline at end of file +} diff --git a/src/dede/makehtml_freelist.php b/src/dede/makehtml_freelist.php index 74ba4586..d6066ea9 100755 --- a/src/dede/makehtml_freelist.php +++ b/src/dede/makehtml_freelist.php @@ -1,12 +1,13 @@ = $startid "; -if(!empty($endid) && $endid>=$startid) -{ +if (!empty($endid) && $endid >= $startid) { $ci .= " And aid <= $endid "; } header("Content-Type: text/html; charset={$cfg_soft_lang}"); $dsql->SetQuery("SELECT aid FROM `#@__freelist` WHERE $ci"); $dsql->Execute(); -while($row=$dsql->GetArray()) -{ +while ($row = $dsql->GetArray()) { $idArray[] = $row['aid']; } -if(!isset($pageno)) $pageno=0; -if(empty($idArray)) $idArray = ''; +if (!isset($pageno)) $pageno = 0; +if (empty($idArray)) $idArray = ''; $totalpage = count($idArray); -if(isset($idArray[$pageno])) -{ +if (isset($idArray[$pageno])) { $lid = $idArray[$pageno]; } else { - ShowMsg( "完成所有文件创建!", 'javascript:;'); + ShowMsg("完成所有文件创建!", 'javascript:;'); exit(); } $lv = new FreeList($lid); $ntotalpage = $lv->TotalPage; -if(empty($mkpage)) $mkpage = 1; -if(empty($maxpagesize)) $maxpagesize = 50; +if (empty($mkpage)) $mkpage = 1; +if (empty($maxpagesize)) $maxpagesize = 50; //如果栏目的文档太多,分多批次更新 -if($ntotalpage<=$maxpagesize) -{ +if ($ntotalpage <= $maxpagesize) { $lv->MakeHtml(); $finishType = true; -}else -{ - $lv->MakeHtml($mkpage,$maxpagesize); +} else { + $lv->MakeHtml($mkpage, $maxpagesize); $finishType = false; $mkpage = $mkpage + $maxpagesize; - if( $mkpage >= ($ntotalpage+1) ) - { + if ($mkpage >= ($ntotalpage + 1)) { $finishType = true; } } $lv->Close(); -$nextpage = $pageno+1; -if($nextpage==$totalpage) -{ - ShowMsg( "完成所有文件创建!", 'javascript:;'); -} -else -{ - if($finishType) - { +$nextpage = $pageno + 1; +if ($nextpage == $totalpage) { + ShowMsg("完成所有文件创建!", 'javascript:;'); +} else { + if ($finishType) { $gourl = "makehtml_freelist_action.php?maxpagesize=$maxpagesize&startid=$startid&endid=$endid&pageno=$nextpage"; - ShowMsg("成功创建列表:".$tid.",继续进行操作!",$gourl,0,100); - } - else - { + ShowMsg("成功创建列表:" . $tid . ",继续进行操作!", $gourl, 0, 100); + } else { $gourl = "makehtml_freelist_action.php?mkpage=$mkpage&maxpagesize=$maxpagesize&startid=$startid&endid=$endid&pageno=$pageno"; - ShowMsg("列表:".$tid.",继续进行操作...",$gourl,0,100); + ShowMsg("列表:" . $tid . ",继续进行操作...", $gourl, 0, 100); } } -$dsql->ExecuteNoneQuery("Update `#@__freelist` set nodefault='1' where aid='$startid';"); \ No newline at end of file +$dsql->ExecuteNoneQuery("Update `#@__freelist` set nodefault='1' where aid='$startid';"); diff --git a/src/dede/makehtml_homepage.php b/src/dede/makehtml_homepage.php index 85d1df65..8748b2c8 100755 --- a/src/dede/makehtml_homepage.php +++ b/src/dede/makehtml_homepage.php @@ -4,7 +4,7 @@ * 生成首页 * * @version $Id: makehtml_homepage.php 2 9:30 2010-11-11 tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/dede/makehtml_js.php b/src/dede/makehtml_js.php index 2cd5b47e..e6689a70 100755 --- a/src/dede/makehtml_js.php +++ b/src/dede/makehtml_js.php @@ -1,13 +1,14 @@ GetOne("SELECT id FROM `#@__arctype` WHERE id>'$typeid' AND ispart<>2 ORDER BY id ASC LIMIT 0,1;"); - if(!is_array($row)) - { + if (!is_array($row)) { echo ""; echo "
完成所有文件更新!
"; exit(); } else { $pv = new PartView($row['id']); - $pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet); - $pv->SaveToHtml($cfg_basedir.$cfg_cmspath."/data/js/".$row['id'].".js", 0); + $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $templet); + $pv->SaveToHtml($cfg_basedir . $cfg_cmspath . "/data/js/" . $row['id'] . ".js", 0); $typeid = $row['id'];; - ShowMsg("成功更新".$cfg_cmspath."/data/js/".$row['id'].".js,继续进行操作!","makehtml_js_action.php?typeid=$typeid",0,100); + ShowMsg("成功更新" . $cfg_cmspath . "/data/js/" . $row['id'] . ".js,继续进行操作!", "makehtml_js_action.php?typeid=$typeid", 0, 100); exit(); } } else { $pv = new PartView($typeid); - $pv->SetTemplet($cfg_basedir.$cfg_templets_dir."/".$templet); - $pv->SaveToHtml($cfg_basedir.$cfg_cmspath."/data/js/".$typeid.".js", 0); + $pv->SetTemplet($cfg_basedir . $cfg_templets_dir . "/" . $templet); + $pv->SaveToHtml($cfg_basedir . $cfg_cmspath . "/data/js/" . $typeid . ".js", 0); echo ""; - echo "
成功更新".$cfg_cmspath."/data/js/".$typeid.".js!"; + echo "
成功更新" . $cfg_cmspath . "/data/js/" . $typeid . ".js!"; echo "预览:
"; echo "
"; - echo ""; + echo ""; exit(); -} \ No newline at end of file +} diff --git a/src/dede/makehtml_list.php b/src/dede/makehtml_list.php index 0a64bc8a..e7d9eebe 100755 --- a/src/dede/makehtml_list.php +++ b/src/dede/makehtml_list.php @@ -1,13 +1,14 @@ getUserID(); //检测获取所有栏目ID //普通生成或一键更新时更新所有栏目 -if($gotype=='' || $gotype=='mkallct') -{ - if($upnext==1 || $typeid==0) - { - if($typeid>0) - { - $tidss = GetSonIds($typeid,0); - $idArray = explode(',',$tidss); +if ($gotype == '' || $gotype == 'mkallct') { + if ($upnext == 1 || $typeid == 0) { + if ($typeid > 0) { + $tidss = GetSonIds($typeid, 0); + $idArray = explode(',', $tidss); } else { - foreach($cfg_Cs as $k=>$v) $idArray[] = $k; + foreach ($cfg_Cs as $k => $v) $idArray[] = $k; } } else { $idArray = array(); @@ -41,35 +39,28 @@ if($gotype=='' || $gotype=='mkallct') } } //一键更新带缓存的情况 -else if($gotype=='mkall') -{ +else if ($gotype == 'mkall') { $uppage = 1; - $mkcachefile = DEDEDATA."/mkall_cache_{$adminID}.php"; + $mkcachefile = DEDEDATA . "/mkall_cache_{$adminID}.php"; $idArray = array(); - if(file_exists($mkcachefile)) require_once($mkcachefile); + if (file_exists($mkcachefile)) require_once($mkcachefile); } //当前更新栏目的ID -$totalpage=count($idArray); -if(isset($idArray[$pageno])) -{ +$totalpage = count($idArray); +if (isset($idArray[$pageno])) { $tid = $idArray[$pageno]; -} -else -{ - if($gotype=='') - { - ShowMsg("完成所有列表更新!","javascript:;"); +} else { + if ($gotype == '') { + ShowMsg("完成所有列表更新!", "javascript:;"); exit(); - } - else if($gotype=='mkall' || $gotype=='mkallct') - { - ShowMsg("完成所有栏目列表更新,现在作最后数据优化!","makehtml_all.php?action=make&step=10"); + } else if ($gotype == 'mkall' || $gotype == 'mkallct') { + ShowMsg("完成所有栏目列表更新,现在作最后数据优化!", "makehtml_all.php?action=make&step=10"); exit(); } } -if($pageno==0 && $mkpage==1) //清空缓存 +if ($pageno == 0 && $mkpage == 1) //清空缓存 { $dsql->ExecuteNoneQuery("Delete From `#@__arccache` "); } @@ -77,66 +68,55 @@ if($pageno==0 && $mkpage==1) //清空缓存 $reurl = ''; //更新数组所记录的栏目 -if(!empty($tid)) -{ - if(!isset($cfg_Cs[$tid])) - { - ShowMsg('没有该栏目数据, 可能缓存文件(/data/cache/inc_catalog_base.inc)没有更新, 请检查是否有写入权限','javascript:;'); +if (!empty($tid)) { + if (!isset($cfg_Cs[$tid])) { + ShowMsg('没有该栏目数据, 可能缓存文件(/data/cache/inc_catalog_base.inc)没有更新, 请检查是否有写入权限', 'javascript:;'); exit(); } - if($cfg_Cs[$tid][1]>0) - { - require_once(DEDEINC."/arc.listview.class.php"); + if ($cfg_Cs[$tid][1] > 0) { + require_once(DEDEINC . "/arc.listview.class.php"); $lv = new ListView($tid); - $position= MfTypedir($lv->Fields['typedir']); - } - else - { - require_once(DEDEINC."/arc.sglistview.class.php"); - $lv = new SgListView($tid); + $position = MfTypedir($lv->Fields['typedir']); + } else { + require_once(DEDEINC . "/arc.sglistview.class.php"); + $lv = new SgListView($tid); } - // 这里统一统计 + // 这里统一统计 $lv->CountRecord(); - if($lv->TypeLink->TypeInfos['ispart']==0 && $lv->TypeLink->TypeInfos['isdefault']!=-1) $ntotalpage = $lv->TotalPage; + if ($lv->TypeLink->TypeInfos['ispart'] == 0 && $lv->TypeLink->TypeInfos['isdefault'] != -1) $ntotalpage = $lv->TotalPage; else $ntotalpage = 1; //如果栏目的文档太多,分多批次更新 - if($ntotalpage <= $maxpagesize || $lv->TypeLink->TypeInfos['ispart']!=0 || $lv->TypeLink->TypeInfos['isdefault']==-1) - { + if ($ntotalpage <= $maxpagesize || $lv->TypeLink->TypeInfos['ispart'] != 0 || $lv->TypeLink->TypeInfos['isdefault'] == -1) { $reurl = $lv->MakeHtml('', '', 0); $finishType = TRUE; - } - else - { + } else { $reurl = $lv->MakeHtml($mkpage, $maxpagesize, 0); $finishType = FALSE; $mkpage = $mkpage + $maxpagesize; - if( $mkpage >= ($ntotalpage+1) ) $finishType = TRUE; + if ($mkpage >= ($ntotalpage + 1)) $finishType = TRUE; } } -$nextpage = $pageno+1; -if($nextpage >= $totalpage && $finishType) -{ - if($gotype=='') - { - if(empty($reurl)) { $reurl = '../plus/list.php?tid='.$tid; } - ShowMsg("完成所有栏目列表更新!浏览栏目","javascript:;"); +$nextpage = $pageno + 1; +if ($nextpage >= $totalpage && $finishType) { + if ($gotype == '') { + if (empty($reurl)) { + $reurl = '../plus/list.php?tid=' . $tid; + } + ShowMsg("完成所有栏目列表更新!浏览栏目", "javascript:;"); exit(); - } - else if($gotype=='mkall' || $gotype=='mkallct') - { - ShowMsg("完成所有栏目列表更新,现在作最后数据优化!","makehtml_all.php?action=make&step=10"); + } else if ($gotype == 'mkall' || $gotype == 'mkallct') { + ShowMsg("完成所有栏目列表更新,现在作最后数据优化!", "makehtml_all.php?action=make&step=10"); exit(); } } else { - if($finishType) - { + if ($finishType) { $gourl = "makehtml_list_action.php?gotype={$gotype}&uppage=$uppage&maxpagesize=$maxpagesize&typeid=$typeid&pageno=$nextpage"; - ShowMsg("成功创建栏目:".$tid.",继续进行操作!",$gourl,0,100); + ShowMsg("成功创建栏目:" . $tid . ",继续进行操作!", $gourl, 0, 100); exit(); } else { $gourl = "makehtml_list_action.php?gotype={$gotype}&uppage=$uppage&mkpage=$mkpage&maxpagesize=$maxpagesize&typeid=$typeid&pageno=$pageno"; - ShowMsg("栏目:".$tid.",继续进行操作...",$gourl,0,100); + ShowMsg("栏目:" . $tid . ",继续进行操作...", $gourl, 0, 100); exit(); } -} \ No newline at end of file +} diff --git a/src/dede/makehtml_map.php b/src/dede/makehtml_map.php index c7e88c1d..93852257 100755 --- a/src/dede/makehtml_map.php +++ b/src/dede/makehtml_map.php @@ -1,40 +1,37 @@ GetSiteMap($dopost); -if($dopost=="site") -{ - $murl = $cfg_cmspath."/data/sitemap.html"; - $tmpfile = $cfg_basedir.$cfg_templets_dir."/plus/sitemap.htm"; -} -else -{ - $murl = $cfg_cmspath."/data/rssmap.html"; - $tmpfile = $cfg_basedir.$cfg_templets_dir."/plus/rssmap.htm"; +if ($dopost == "site") { + $murl = $cfg_cmspath . "/data/sitemap.html"; + $tmpfile = $cfg_basedir . $cfg_templets_dir . "/plus/sitemap.htm"; +} else { + $murl = $cfg_cmspath . "/data/rssmap.html"; + $tmpfile = $cfg_basedir . $cfg_templets_dir . "/plus/rssmap.htm"; } $dtp = new DedeTagParse(); $dtp->LoadTemplet($tmpfile); -$dtp->SaveTo($cfg_basedir.$murl); +$dtp->SaveTo($cfg_basedir . $murl); $dtp->Clear(); echo ""; echo "
成功更新文件: $murl 浏览...
"; -exit(); \ No newline at end of file +exit(); diff --git a/src/dede/makehtml_map_guide.php b/src/dede/makehtml_map_guide.php index 4e03ec90..0742d4ab 100755 --- a/src/dede/makehtml_map_guide.php +++ b/src/dede/makehtml_map_guide.php @@ -1,12 +1,13 @@ GetOne("SELECT id FROM `#@__arctype` WHERE id>'$tid' AND ispart<>2 ORDER BY id ASC LIMIT 0,1;"); -if(!is_array($row)) -{ +if (!is_array($row)) { echo ""; echo "
完成所有文件更新!
"; } else { - $rv = new RssView($row['id'],$maxrecord); + $rv = new RssView($row['id'], $maxrecord); $rssurl = $rv->MakeRss(0); $tid = $row['id']; - ShowMsg("成功更新".$rssurl.",继续进行操作!","makehtml_rss_action.php?tid=$tid&maxrecord=$maxrecord",0,100); -} \ No newline at end of file + ShowMsg("成功更新" . $rssurl . ",继续进行操作!", "makehtml_rss_action.php?tid=$tid&maxrecord=$maxrecord", 0, 100); +} diff --git a/src/dede/makehtml_spec.php b/src/dede/makehtml_spec.php index a0d15bd6..8ec21838 100755 --- a/src/dede/makehtml_spec.php +++ b/src/dede/makehtml_spec.php @@ -1,24 +1,24 @@ MakeHtml(0); echo ""; echo "
成功生成所有专题HTML列表!预览
"; exit(); } -include DedeInclude('templets/makehtml_spec.htm'); \ No newline at end of file +include DedeInclude('templets/makehtml_spec.htm'); diff --git a/src/dede/makehtml_taglist.php b/src/dede/makehtml_taglist.php index 351172d6..f0c20ea6 100644 --- a/src/dede/makehtml_taglist.php +++ b/src/dede/makehtml_taglist.php @@ -3,7 +3,7 @@ * 生成Tag * * @version $Id: makehtml_taglist.php 1 11:17 2020年8月19日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -11,5 +11,3 @@ require_once(dirname(__FILE__)."/config.php"); $tid = isset($tid)? $tid : 0; include DedeInclude('templets/makehtml_taglist.htm'); - -?> \ No newline at end of file diff --git a/src/dede/makehtml_taglist_action.php b/src/dede/makehtml_taglist_action.php index e08dbb7b..bcdf4b36 100644 --- a/src/dede/makehtml_taglist_action.php +++ b/src/dede/makehtml_taglist_action.php @@ -4,7 +4,7 @@ * 生成Tag操作 * * @version $Id: makehtml_taglist_action.php 1 11:17 2020年8月19日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/dede/makeremote_all.php b/src/dede/makeremote_all.php index 25b560d9..7546ac44 100755 --- a/src/dede/makeremote_all.php +++ b/src/dede/makeremote_all.php @@ -1,42 +1,42 @@ '.$signer.''; + $color = ($val == 0) ? 'red' : 'green'; + $signer = ($val == 0) ? '未同步' : '已同步'; + return '' . $signer . ''; } //生成远程目录数组 -function addDir($filedir='', $description='', $dfserv=0, $state=0, $issystem=0) +function addDir($filedir = '', $description = '', $dfserv = 0, $state = 0, $issystem = 0) { return array( 'filedir' => $filedir, @@ -48,54 +48,52 @@ function addDir($filedir='', $description='', $dfserv=0, $state=0, $issystem=0) } //将配置数组生成配置内容 -function makeConfig($dirarray=array()) +function makeConfig($dirarray = array()) { $config_str = ''; - foreach($dirarray as $k => $val) - { - $config_str .= '$remotefile['.$k.'] = array('."\n"; - $config_str .= ' \'filedir\'=>\''.$val['filedir']."',\n"; - $config_str .= ' \'description\'=>\''.$val['description']."',\n"; - $config_str .= ' \'dfserv\'=>'.$val['dfserv'].",\n"; - $config_str .= ' \'state\'=>'.$val['state'].",\n"; - $config_str .= ' \'issystem\'=>'.$val['issystem']."\n"; + foreach ($dirarray as $k => $val) { + $config_str .= '$remotefile[' . $k . '] = array(' . "\n"; + $config_str .= ' \'filedir\'=>\'' . $val['filedir'] . "',\n"; + $config_str .= ' \'description\'=>\'' . $val['description'] . "',\n"; + $config_str .= ' \'dfserv\'=>' . $val['dfserv'] . ",\n"; + $config_str .= ' \'state\'=>' . $val['state'] . ",\n"; + $config_str .= ' \'issystem\'=>' . $val['issystem'] . "\n"; $config_str .= ");\n"; } - return ($config_str == '')? '' : $config_str; + return ($config_str == '') ? '' : $config_str; } //递归获取目录 by:tianya -function getDirs($directory,$exempt = array('.','..','.ds_store','.svn'),&$files = array()) -{ +function getDirs($directory, $exempt = array('.', '..', '.ds_store', '.svn'), &$files = array()) +{ //没有则创建 - if(is_dir($directory) && !opendir($directory)) mkdir($directory,0777,TRUE); - $handle = opendir($directory); - - while(false !== ($resource = readdir($handle))) - { - if(!in_array(strtolower($resource),$exempt)) - { + if (is_dir($directory) && !opendir($directory)) mkdir($directory, 0777, TRUE); + $handle = opendir($directory); + + while (false !== ($resource = readdir($handle))) { + if (!in_array(strtolower($resource), $exempt)) { //排除目录 - if(is_dir($directory.$resource.'/')) - { - array_merge($files, - getDirs($directory.$resource.'/',$exempt,$files)); + if (is_dir($directory . $resource . '/')) { + array_merge( + $files, + getDirs($directory . $resource . '/', $exempt, $files) + ); } else { - //if(!is_file($directory.'/'.$resource)) - //{ - $files[] = $directory.'/'.$resource; - //} + //if(!is_file($directory.'/'.$resource)) + //{ + $files[] = $directory . '/' . $resource; + //} } - } + } } - closedir($handle); - return $files; -} + closedir($handle); + return $files; +} -function updateConfig($dirarray=array()) +function updateConfig($dirarray = array()) { //将其转换为配置写入文件 - $configfile = DEDEDATA.'/config.file.inc.php'; + $configfile = DEDEDATA . '/config.file.inc.php'; $old_config = @file_get_contents($configfile); $config_str = makeConfig($dirarray); //替换配置项 @@ -103,15 +101,11 @@ function updateConfig($dirarray=array()) file_put_contents($configfile, $new_config); } -if($dopost == '') -{ - +if ($dopost == '') { } /* function Updateremote() -*/ -else if($dopost == 'updateremote') -{ +*/ else if ($dopost == 'updateremote') { $dirbox = array(); // 定义一个目录容器,确保目录的唯一性 //获取所有HTML生成文件夹列表 $query = "SELECT id,typedir,ispart FROM #@__arctype WHERE ispart <> '3'"; @@ -120,13 +114,11 @@ else if($dopost == 'updateremote') $dirarray = array(); $i = 0; - while ($row = $dsql->GetArray("al")) - { + while ($row = $dsql->GetArray("al")) { $darray = explode('/', preg_replace('/{cmspath}/', '', $row['typedir'])); //仅获取顶级目录作为文件同步更新目录 - if(!in_array($darray[1], $dirbox)) - { - $dirarray[$i] = addDir('/'.$darray[1], '文档HTML默认保存路', 0, 0, 1); + if (!in_array($darray[1], $dirbox)) { + $dirarray[$i] = addDir('/' . $darray[1], '文档HTML默认保存路', 0, 0, 1); $dirbox[] = $darray[1]; $i++; } @@ -139,171 +131,149 @@ else if($dopost == 'updateremote') $dirarray[$i++] = addDir('/data/js', '生成js目录', 0, 0, 1); //$remotefile = array(); //把非系统目录的内容提取出来 - foreach ($remotefile as $key => $value) - { + foreach ($remotefile as $key => $value) { //处理用户自定义配置 - if($value['issystem'] == 0) - { - $dirarray[$i++] = addDir($value['filedir'], $value['description'], - $value['dfserv'], $value['state'], $value['issystem']); + if ($value['issystem'] == 0) { + $dirarray[$i++] = addDir( + $value['filedir'], + $value['description'], + $value['dfserv'], + $value['state'], + $value['issystem'] + ); } } - + updateConfig($dirarray); - - ShowMsg("成功更新同步目录,请重新对目录进行同步操作!","makeremote_all.php"); + + ShowMsg("成功更新同步目录,请重新对目录进行同步操作!", "makeremote_all.php"); exit; } /* function Make()&MakeAll() -*/ -else if($dopost == 'make') -{ - if($step == 1) - { - if($maketype == 'makeall') - { +*/ else if ($dopost == 'make') { + if ($step == 1) { + if ($maketype == 'makeall') { //如果更新所有,则需要重新组合$Iterm - foreach($remotefile as $key => $val) - { + foreach ($remotefile as $key => $val) { $Iterm[] = $val['filedir']; } } else { //初始化配置 - $Iterm = !isset($Iterm)? array(): $Iterm; + $Iterm = !isset($Iterm) ? array() : $Iterm; } - $serviterm = !isset($serviterm)? array(): $serviterm; - $cacheMakeFile = DEDEDATA.'/cache/filelist.inc.php'; + $serviterm = !isset($serviterm) ? array() : $serviterm; + $cacheMakeFile = DEDEDATA . '/cache/filelist.inc.php'; $dirlist = $alllist = $updir = array(); - $dirindex = 0;//目录统一索引 - + $dirindex = 0; //目录统一索引 + //采用比较人性化的更新方式进行提示更新 //初始化本地文件夹底层的子集目录 - - if(count($Iterm) > 0) - { + + if (count($Iterm) > 0) { //获取远程文件(夹)列表 - foreach($Iterm as $key => $val) - { + foreach ($Iterm as $key => $val) { $config = $serviterm[$key]; - if(is_array($dirlist = getDirs(DEDEROOT.$val))) - { - foreach($dirlist as $k => $v) - { - $alllist[] = $v.'|'.$config; - if(!in_array($val, array_values($updir))) $updir[] = $val; + if (is_array($dirlist = getDirs(DEDEROOT . $val))) { + foreach ($dirlist as $k => $v) { + $alllist[] = $v . '|' . $config; + if (!in_array($val, array_values($updir))) $updir[] = $val; } } } //遍历文件夹列表,如果存在子集文件夹大于3的则需要进行细分 //将列表写入缓存 $cachestr = " $val) - { - list($filename,$fileconfig) = explode('|', $val); - if(is_dir($filename)) - { + foreach ($alllist as $key => $val) { + list($filename, $fileconfig) = explode('|', $val); + if (is_dir($filename)) { $deepDir = getDirs($filename); $dd = 0; //先遍历一遍确定子集文件夹数目 - foreach($deepDir as $k => $v) - { - if(is_dir($v)) $dd++; + foreach ($deepDir as $k => $v) { + if (is_dir($v)) $dd++; } - if($dd > 3) - { + if ($dd > 3) { //如果自己文件夹数目大于3则 - foreach($deepDir as $k => $v) - { - $v .= '|'.$fileconfig; + foreach ($deepDir as $k => $v) { + $v .= '|' . $fileconfig; $cachestr .= " \$dirlist['$dirindex']='$v';\n"; $dirindex++; } - }else{ + } else { $cachestr .= " \$dirlist['$dirindex']='$val';\n"; $dirindex++; } } } - - foreach($updir as $key => $val) - { + + foreach ($updir as $key => $val) { $cachestr .= " \$upremote['$key']='$val';\n"; } $cachestr .= "?>"; file_put_contents($cacheMakeFile, $cachestr); $tnum = count($alllist); - ShowMsg("成功获取远程列表,下面进行文件远程发布!","makeremote_all.php?dopost=make&step=2&sta=1&totalnum=$tnum"); + ShowMsg("成功获取远程列表,下面进行文件远程发布!", "makeremote_all.php?dopost=make&step=2&sta=1&totalnum=$tnum"); exit; } else { echo '您没有选择,请先选择再点击更新!'; } - exit; - } elseif ($step == 2) - { - if(file_exists(DEDEDATA.'/cache/filelist.inc.php')) - { - require_once(DEDEDATA.'/cache/filelist.inc.php'); + exit; + } elseif ($step == 2) { + if (file_exists(DEDEDATA . '/cache/filelist.inc.php')) { + require_once(DEDEDATA . '/cache/filelist.inc.php'); } - if(is_array($dirlist)) - { - if($sta > 0 && $sta < $totalnum) - { - list($dirname, $ftpconfig) = explode('|', $dirlist[$sta-1]); + if (is_array($dirlist)) { + if ($sta > 0 && $sta < $totalnum) { + list($dirname, $ftpconfig) = explode('|', $dirlist[$sta - 1]); list($servurl, $servuser, $servpwd) = explode(',', $ftpconfig); - $config=array( 'hostname' => $servurl, 'username' => $servuser, - 'password' => $servpwd,'debug' => 'TRUE'); - if($ftp->connect($config)) - { + $config = array( + 'hostname' => $servurl, 'username' => $servuser, + 'password' => $servpwd, 'debug' => 'TRUE' + ); + if ($ftp->connect($config)) { //var_dump(is_dir($dirname));exit; - if(is_dir($dirname)) - { + if (is_dir($dirname)) { //如果是文件目录 - $remotedir = str_replace(DEDEROOT, '', $dirname).'/'; - $localdir = '..'.$remotedir.'/'; + $remotedir = str_replace(DEDEROOT, '', $dirname) . '/'; + $localdir = '..' . $remotedir . '/'; $ftp->rmkdir($remotedir); - if( $ftp->mirror($localdir, $remotedir)) - { + if ($ftp->mirror($localdir, $remotedir)) { $sta++; - ShowMsg("成功同步文件夹$remotedir,进入下一个任务","makeremote_all.php?dopost=make&step=2&sta={$sta}&totalnum=$totalnum"); + ShowMsg("成功同步文件夹$remotedir,进入下一个任务", "makeremote_all.php?dopost=make&step=2&sta={$sta}&totalnum=$totalnum"); exit; } } else { $remotefile = str_replace(DEDEROOT, '', $dirname); - $localfile = '..'.$remotefile; + $localfile = '..' . $remotefile; //创建远程文件夹 $remotedir = preg_replace('/[^\/]*\.(\w){0,}/', '', $remotefile); - + //如果是文件则需要智能处理 $remotebox = array(); $ftp->rmkdir($remotedir); - foreach($dirlist as $key => $val) - { - list($filename,$fileconfig) = explode('|', $val); - if(preg_replace('/[^\/]*\.(\w){0,}/', '', str_replace(DEDEROOT, '', $filename)) == $remotedir) - { + foreach ($dirlist as $key => $val) { + list($filename, $fileconfig) = explode('|', $val); + if (preg_replace('/[^\/]*\.(\w){0,}/', '', str_replace(DEDEROOT, '', $filename)) == $remotedir) { //如果这些文件都在同一目录,则统计这些记录的id项目 $remotebox[] = $key; } } //print_r($remotebox); //if(count($remotebox) > 1 && count($remotebox) < 20) - if(count($remotebox) > 1) - { + if (count($remotebox) > 1) { //如果大于1,则说明有多条记录在同一文件夹内 - $localdir = '..'.$remotedir; - if( $ftp->mirror($localdir, $remotedir)) - { + $localdir = '..' . $remotedir; + if ($ftp->mirror($localdir, $remotedir)) { $sta = end($remotebox) + 1; - ShowMsg("成功同步文件夹$remotedir,进入下一个任务","makeremote_all.php?dopost=make&step=2&sta={$sta}&totalnum=$totalnum"); + ShowMsg("成功同步文件夹$remotedir,进入下一个任务", "makeremote_all.php?dopost=make&step=2&sta={$sta}&totalnum=$totalnum"); exit; } } else { - if( $ftp->upload($localfile, $remotefile) ) - { + if ($ftp->upload($localfile, $remotefile)) { $sta++; - ShowMsg("成功同步文件$remotefile,进入下一个任务","makeremote_all.php?dopost=make&step=2&sta={$sta}&totalnum=$totalnum"); + ShowMsg("成功同步文件$remotefile,进入下一个任务", "makeremote_all.php?dopost=make&step=2&sta={$sta}&totalnum=$totalnum"); exit; } } @@ -311,16 +281,15 @@ else if($dopost == 'make') } } else { //否则成功更新完毕 - foreach($remotefile as $key => $val) - { - if(in_array($val['filedir'],array_values($upremote))) - { + foreach ($remotefile as $key => $val) { + if (in_array($val['filedir'], array_values($upremote))) { $remotefile[$key]['state'] = 1; } } updateConfig($remotefile); - @unlink(DEDEDATA.'/cache/filelist.inc.php'); - echo '全部同步完毕!';exit; + @unlink(DEDEDATA . '/cache/filelist.inc.php'); + echo '全部同步完毕!'; + exit; } } else { exit('Error:None remote cache file exist!'); @@ -328,4 +297,4 @@ else if($dopost == 'make') exit; } } -include DedeInclude('templets/makeremote_all.htm'); \ No newline at end of file +include DedeInclude('templets/makeremote_all.htm'); diff --git a/src/dede/mda_main.php b/src/dede/mda_main.php index 6619bca4..f7226183 100755 --- a/src/dede/mda_main.php +++ b/src/dede/mda_main.php @@ -1,120 +1,109 @@ IsTable('#@__plus_mda_setting') ) -{ - $mysql_version = $dsql->GetVersion(TRUE); - - foreach( $install_sqls as $install_sql ) - { - $sql = preg_replace("#ENGINE=MyISAM#i", 'TYPE=MyISAM', $install_sql); - $sql41tmp = 'ENGINE=MyISAM DEFAULT CHARSET='.$cfg_db_language; - - if($mysql_version >= 4.1) - { - $sql = preg_replace("#TYPE=MyISAM#i", $sql41tmp, $sql); - } - $dsql->ExecuteNoneQuery($sql); - } +if (!$dsql->IsTable('#@__plus_mda_setting')) { + $mysql_version = $dsql->GetVersion(TRUE); + foreach ($install_sqls as $install_sql) { + $sql = preg_replace("#ENGINE=MyISAM#i", 'TYPE=MyISAM', $install_sql); + $sql41tmp = 'ENGINE=MyISAM DEFAULT CHARSET=' . $cfg_db_language; + + if ($mysql_version >= 4.1) { + $sql = preg_replace("#TYPE=MyISAM#i", $sql41tmp, $sql); + } + $dsql->ExecuteNoneQuery($sql); + } } /*-------------------------------- function __update(){ } -------------------------------*/ -$version=mda_get_setting('version'); +$version = mda_get_setting('version'); if (empty($version)) $version = '0.0.1'; if (version_compare($version, MDA_VER, '<')) { - $mysql_version = $dsql->GetVersion(TRUE); + $mysql_version = $dsql->GetVersion(TRUE); - foreach ($update_sqls as $ver => $sqls) { - if (version_compare($ver, $version,'<')) { - continue; - } - foreach ($sqls as $sql) { - $sql = preg_replace("#ENGINE=MyISAM#i", 'TYPE=MyISAM', $sql); - $sql41tmp = 'ENGINE=MyISAM DEFAULT CHARSET='.$cfg_db_language; - - if($mysql_version >= 4.1) - { - $sql = preg_replace("#TYPE=MyISAM#i", $sql41tmp, $sql); - } - $dsql->ExecuteNoneQuery($sql); - } - mda_set_setting('version', $ver); - $version=mda_get_setting('version'); + foreach ($update_sqls as $ver => $sqls) { + if (version_compare($ver, $version, '<')) { + continue; } + foreach ($sqls as $sql) { + $sql = preg_replace("#ENGINE=MyISAM#i", 'TYPE=MyISAM', $sql); + $sql41tmp = 'ENGINE=MyISAM DEFAULT CHARSET=' . $cfg_db_language; + + if ($mysql_version >= 4.1) { + $sql = preg_replace("#TYPE=MyISAM#i", $sql41tmp, $sql); + } + $dsql->ExecuteNoneQuery($sql); + } + mda_set_setting('version', $ver); + $version = mda_get_setting('version'); + } } -if(empty($dopost)) $dopost = ''; +if (empty($dopost)) $dopost = ''; /*-------------------------------- function __link(){ } -------------------------------*/ -if($dopost == 'place' OR $dopost == 'report' OR $dopost == 'account' OR $dopost == 'setting') -{ - if ( !mda_islogin() ) - { - ShowMsg("您尚未登录德得广告,请先登录后继续使用……!",'?dopost=login'); - exit(); - } - mda_check_islogin(); +if ($dopost == 'place' or $dopost == 'report' or $dopost == 'account' or $dopost == 'setting') { + if (!mda_islogin()) { + ShowMsg("您尚未登录德得广告,请先登录后继续使用……!", '?dopost=login'); + exit(); + } + mda_check_islogin(); - if($dopost=='place') - { - $channel_uuid = mda_get_setting('channel_uuid'); - $manage_url = MDA_APIHOST."/place?from=dedecms&uuid={$channel_uuid}"; - $ptitle = '广告管理'; - } elseif ($dopost=='report') - { - $manage_url = MDA_APIHOST."/report"; - $ptitle = '报表管理'; - } elseif ($dopost=='account') - { - $manage_url = MDA_APIHOST."/account"; - $ptitle = '结算中心'; - } elseif ($dopost=='setting') - { - $manage_url = MDA_APIHOST."/setting"; - $ptitle = '德得设置'; - } + if ($dopost == 'place') { + $channel_uuid = mda_get_setting('channel_uuid'); + $manage_url = MDA_APIHOST . "/place?from=dedecms&uuid={$channel_uuid}"; + $ptitle = '广告管理'; + } elseif ($dopost == 'report') { + $manage_url = MDA_APIHOST . "/report"; + $ptitle = '报表管理'; + } elseif ($dopost == 'account') { + $manage_url = MDA_APIHOST . "/account"; + $ptitle = '结算中心'; + } elseif ($dopost == 'setting') { + $manage_url = MDA_APIHOST . "/setting"; + $ptitle = '德得设置'; + } - echo << @@ -155,91 +144,82 @@ EOT; } /*-------------------------------- function __clearcache(){ } --------------------------------*/ -else if($dopost == 'clearcache'){ - if (!is_dir(DEDEDATA . "/cache/mda/") OR RmRecurse(DEDEDATA . "/cache/mda/") ) - { - ShowMsg("成功清除缓存信息",-1); - exit(); - } else { - ShowMsg("清除缓存失败,请尝试手工删除".DEDEDATA."/cache/mda/", 'javascript:;'); - exit(); - } +-------------------------------*/ else if ($dopost == 'clearcache') { + if (!is_dir(DEDEDATA . "/cache/mda/") or RmRecurse(DEDEDATA . "/cache/mda/")) { + ShowMsg("成功清除缓存信息", -1); + exit(); + } else { + ShowMsg("清除缓存失败,请尝试手工删除" . DEDEDATA . "/cache/mda/", 'javascript:;'); + exit(); + } } /*-------------------------------- function __bind_user(){ } --------------------------------*/ -else if($dopost == 'bind_user') -{ - $email = isset($email)? $email : ''; - $pwd = isset($pwd)? $pwd : ''; - $domain = isset($domain)? $domain : ''; - $channel_name = isset($channel_name)? $channel_name : ''; - if ( !$email OR !$pwd OR !$domain OR !$channel_name) - { - ShowMsg("填写正确的账号信息!",-1); - exit(); - } - if($cfg_soft_lang=='gb2312') $channel_name = gb2utf8($channel_name); - $paramsArr=array( - 'email'=>$email, - 'password'=>$pwd, - 'domain'=>$domain, - 'channel_name'=>$channel_name, - ); - $rs = json_decode(mda_http_send(MDA_API_BIND_USER,0,$paramsArr),TRUE); - if ( !$rs ) - { - ShowMsg("请求API错误,请重试!",-1); - exit(); - } - if ( $rs['code'] != 0 ) - { - ShowMsg("请求失败,错误代码[code:{$rs['code']}],消息[{$rs['msg']}]",-1); - exit(); - } - $channel_uuid = $rs['data']['channel_uuid']; - $channel_secret = $rs['data']['channel_secret']; +-------------------------------*/ else if ($dopost == 'bind_user') { + $email = isset($email) ? $email : ''; + $pwd = isset($pwd) ? $pwd : ''; + $domain = isset($domain) ? $domain : ''; + $channel_name = isset($channel_name) ? $channel_name : ''; + if (!$email or !$pwd or !$domain or !$channel_name) { + ShowMsg("填写正确的账号信息!", -1); + exit(); + } + if ($cfg_soft_lang == 'gb2312') $channel_name = gb2utf8($channel_name); + $paramsArr = array( + 'email' => $email, + 'password' => $pwd, + 'domain' => $domain, + 'channel_name' => $channel_name, + ); + $rs = json_decode(mda_http_send(MDA_API_BIND_USER, 0, $paramsArr), TRUE); + if (!$rs) { + ShowMsg("请求API错误,请重试!", -1); + exit(); + } + if ($rs['code'] != 0) { + ShowMsg("请求失败,错误代码[code:{$rs['code']}],消息[{$rs['msg']}]", -1); + exit(); + } + $channel_uuid = $rs['data']['channel_uuid']; + $channel_secret = $rs['data']['channel_secret']; - mda_set_setting('email', $email); - mda_set_setting('channel_uuid', $channel_uuid); - mda_set_setting('channel_secret', $channel_secret); - $login_url = "?dopost=login"; - echo << EOT; - ShowMsg("绑定成功,下面自动登录德得广告平台", "?dopost=login"); - exit(); + ShowMsg("绑定成功,下面自动登录德得广告平台", "?dopost=login"); + exit(); } /*-------------------------------- function __login(){ } --------------------------------*/ -else if($dopost == 'login') -{ - $email = mda_get_setting('email'); - $channel_uuid = mda_get_setting('channel_uuid'); - $channel_secret = mda_get_setting('channel_secret'); - $ts = time(); - $paramsArr=array( - 'channel_uuid'=>$channel_uuid, - 'channel_secret'=>$channel_secret, - 'email'=>$email, - 'ts'=>$ts, - 'crc'=>md5($channel_uuid.$channel_secret.$ts), - ); - $jquery_file = MDA_JQUERY; - $api_login = MDA_API_LOGIN; - $params = json_encode($paramsArr); - $rs = json_decode(mda_http_send(MDA_API_LOGIN,0,$paramsArr),TRUE); - if ( isset($rs['code']) AND $rs['code'] == 0 ) { - $_SESSION['mda_email']=$email; - } else { - unset($_SESSION['mda_email']); - header('Location:?logout=1'); - exit(); - } - - echo << $channel_uuid, + 'channel_secret' => $channel_secret, + 'email' => $email, + 'ts' => $ts, + 'crc' => md5($channel_uuid . $channel_secret . $ts), + ); + $jquery_file = MDA_JQUERY; + $api_login = MDA_API_LOGIN; + $params = json_encode($paramsArr); + $rs = json_decode(mda_http_send(MDA_API_LOGIN, 0, $paramsArr), TRUE); + if (isset($rs['code']) and $rs['code'] == 0) { + $_SESSION['mda_email'] = $email; + } else { + unset($_SESSION['mda_email']); + header('Location:?logout=1'); + exit(); + } + + echo << EOT; - exit; -} + exit; +} /*-------------------------------- function __main(){ } --------------------------------*/ -else if($dopost == 'main'){ - $mda_version = MDA_VER; - $channel_uuid = mda_get_setting('channel_uuid'); - $channel_secret = mda_get_setting('channel_secret'); - $msg = << @@ -328,58 +307,54 @@ else if($dopost == 'main'){ {$login_str} {$change_isv_id} EOT; - $wintitle = '德得广告管理'; - $wecome_info = '德得广告模块 》'; - $win = new OxWindow(); - $win->AddTitle($wintitle); - $win->AddMsgItem($msg); - $winform = $win->GetWindow('hand', ' ', false); - $win->Display(); - exit; -} else if($dopost == 'set_secret') { - $email = mda_get_setting('email'); - $channel_uuid = mda_get_setting('channel_uuid'); - $ts = time(); - $paramsArr=array( - 'channel_uuid'=>$channel_uuid, - 'channel_secret'=>$channel_secret, - 'email'=>$email, - 'ts'=>$ts, - 'crc'=>md5($channel_uuid.$channel_secret.$ts), - ); - $rs = json_decode(mda_http_send(MDA_API_LOGIN,0,$paramsArr),TRUE); - if ( !$rs ) - { - ShowMsg("请求API错误,请重试!",-1); - exit(); - } - if ( $rs['code'] != 0 ) - { - ShowMsg("请求失败,错误代码[code:{$rs['code']}],消息[{$rs['msg']}]",'?dopost=main'); - exit(); - } - if ($rs['code'] == 0){ - ShowMsg("Channel Secret 修改成功……!",'?dopost=main'); - mda_set_setting('channel_secret', $channel_secret); - } + $wintitle = '德得广告管理'; + $wecome_info = '德得广告模块 》'; + $win = new OxWindow(); + $win->AddTitle($wintitle); + $win->AddMsgItem($msg); + $winform = $win->GetWindow('hand', ' ', false); + $win->Display(); + exit; +} else if ($dopost == 'set_secret') { + $email = mda_get_setting('email'); + $channel_uuid = mda_get_setting('channel_uuid'); + $ts = time(); + $paramsArr = array( + 'channel_uuid' => $channel_uuid, + 'channel_secret' => $channel_secret, + 'email' => $email, + 'ts' => $ts, + 'crc' => md5($channel_uuid . $channel_secret . $ts), + ); + $rs = json_decode(mda_http_send(MDA_API_LOGIN, 0, $paramsArr), TRUE); + if (!$rs) { + ShowMsg("请求API错误,请重试!", -1); + exit(); + } + if ($rs['code'] != 0) { + ShowMsg("请求失败,错误代码[code:{$rs['code']}],消息[{$rs['msg']}]", '?dopost=main'); + exit(); + } + if ($rs['code'] == 0) { + ShowMsg("Channel Secret 修改成功……!", '?dopost=main'); + mda_set_setting('channel_secret', $channel_secret); + } } // ------------------------------------------------------------------------ /*-------------------------------- function __index(){ } --------------------------------*/ -else { - if ( mda_get_setting('email') AND mda_get_setting('channel_uuid') AND mda_get_setting('channel_secret') AND empty($logout)) - { - header('Location:?dopost=login'); - exit; - } - - $mda_reg_url = MDA_REG_URL; - $mda_forget_pwd_url = MDA_FORGOT_PASSWORD_URL; - $domain = !empty($_SERVER['HTTP_HOST'])? $_SERVER['HTTP_HOST'] : $_SERVER['SERVER_NAME']; - $mda_update_url = MDA_APIHOST."/help/dedecms_module_download"; - -echo << @@ -460,5 +435,4 @@ echo << EOT; - -} \ No newline at end of file +} diff --git a/src/dede/media_add.php b/src/dede/media_add.php index 2b7b688b..e241a5af 100755 --- a/src/dede/media_add.php +++ b/src/dede/media_add.php @@ -4,7 +4,7 @@ * 附件添加 * * @version $Id: media_add.php 2 15:25 2011-6-2 tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/dede/media_edit.php b/src/dede/media_edit.php index b2e7b2ee..08a95411 100755 --- a/src/dede/media_edit.php +++ b/src/dede/media_edit.php @@ -1,157 +1,126 @@ GetOne("SELECT url FROM #@__uploads WHERE aid='".$aid."'"); - $truefile = $cfg_basedir.$myrow['url']; + if ($ids == "") { + $myrow = $dsql->GetOne("SELECT url FROM #@__uploads WHERE aid='" . $aid . "'"); + $truefile = $cfg_basedir . $myrow['url']; $rs = 0; - if(!file_exists($truefile)||$myrow['url']=="") - { + if (!file_exists($truefile) || $myrow['url'] == "") { $rs = 1; } else { $rs = @unlink($truefile); //如果开启远程附件则需要同步删除文件 - if($cfg_remote_site=='Y') - { - if($ftp->connect($ftpconfig) && $remoteuploads == 1) - { + if ($cfg_remote_site == 'Y') { + if ($ftp->connect($ftpconfig) && $remoteuploads == 1) { $remotefile = str_replace(DEDEROOT, '', $truefile); $ftp->delete_file($remotefile); } } } - if($rs==1) - { + if ($rs == 1) { $msg = "成功删除一个附件!"; - $dsql->ExecuteNoneQuery("DELETE FROM #@__uploads WHERE aid='".$aid."'"); + $dsql->ExecuteNoneQuery("DELETE FROM #@__uploads WHERE aid='" . $aid . "'"); } - ShowMsg($msg,$backurl); + ShowMsg($msg, $backurl); exit(); } else { $ids = explode(',', $ids); $idquery = ""; - foreach($ids as $aid) - { - if($idquery=="") - { + foreach ($ids as $aid) { + if ($idquery == "") { $idquery .= " WHERE aid='$aid' "; - } - else - { + } else { $idquery .= " OR aid='$aid' "; } } $dsql->SetQuery("SELECT aid,url FROM #@__uploads $idquery "); $dsql->Execute(); - + //如果开启远程附件则需要同步删除文件 - if($cfg_remote_site=='Y' && $remoteuploads == 1) - { + if ($cfg_remote_site == 'Y' && $remoteuploads == 1) { $ftp->connect($ftpconfig); } - while($myrow=$dsql->GetArray()) - { - $truefile = $cfg_basedir.$myrow['url']; + while ($myrow = $dsql->GetArray()) { + $truefile = $cfg_basedir . $myrow['url']; $rs = 0; - if(!file_exists($truefile) || $myrow['url']=="") - { + if (!file_exists($truefile) || $myrow['url'] == "") { $rs = 1; - } - else - { + } else { $rs = @unlink($truefile); - if($cfg_remote_site=='Y' && $remoteuploads == 1) - { + if ($cfg_remote_site == 'Y' && $remoteuploads == 1) { $remotefile = str_replace(DEDEROOT, '', $truefile); $ftp->delete_file($remotefile); } } - if($rs==1) - { - $dsql->ExecuteNoneQuery("DELETE FROM #@__uploads WHERE aid='".$myrow['aid']."'"); + if ($rs == 1) { + $dsql->ExecuteNoneQuery("DELETE FROM #@__uploads WHERE aid='" . $myrow['aid'] . "'"); } } - ShowMsg('成功删除选定的文件!',$backurl); + ShowMsg('成功删除选定的文件!', $backurl); exit(); } } /*-------------------------------- function __save_edit() //保存更改 ------------------------------------*/ -else if($dopost=='save') -{ - if($aid=="") exit(); +-----------------------------------*/ else if ($dopost == 'save') { + if ($aid == "") exit(); CheckCSRF(); //检查是否有修改权限 - $myrow = $dsql->GetOne("SELECT * FROM #@__uploads WHERE aid='".$aid."'"); - if($myrow['mid']!=$cuserLogin->getUserID()) - { + $myrow = $dsql->GetOne("SELECT * FROM #@__uploads WHERE aid='" . $aid . "'"); + if ($myrow['mid'] != $cuserLogin->getUserID()) { CheckPurview('sys_Upload'); } //检测文件类型 $addquery = ""; - if(is_uploaded_file($upfile)) - { - if($mediatype==1) - { - $sparr = Array("image/pjpeg","image/jpeg","image/gif","image/png","image/xpng","image/wbmp"); - if(!in_array($upfile_type,$sparr)) - { - ShowMsg("你上传的不是图片类型的文件!","javascript:history.go(-1);"); + if (is_uploaded_file($upfile)) { + if ($mediatype == 1) { + $sparr = array("image/pjpeg", "image/jpeg", "image/gif", "image/png", "image/xpng", "image/wbmp"); + if (!in_array($upfile_type, $sparr)) { + ShowMsg("你上传的不是图片类型的文件!", "javascript:history.go(-1);"); exit(); } - } - else if($mediatype==2) - { - $sparr = Array("application/x-shockwave-flash"); - if(!in_array($upfile_type,$sparr)) - { - ShowMsg("你上传的不是Flash类型的文件!","javascript:history.go(-1);"); + } else if ($mediatype == 2) { + $sparr = array("application/x-shockwave-flash"); + if (!in_array($upfile_type, $sparr)) { + ShowMsg("你上传的不是Flash类型的文件!", "javascript:history.go(-1);"); exit(); } - }else if($mediatype==3) - { - if(!preg_match('#audio|media|video#i', $upfile_type)) - { - ShowMsg("你上传的为不正确类型的影音文件!","javascript:history.go(-1);"); + } else if ($mediatype == 3) { + if (!preg_match('#audio|media|video#i', $upfile_type)) { + ShowMsg("你上传的为不正确类型的影音文件!", "javascript:history.go(-1);"); exit(); } - if(!preg_match("#\.".$cfg_mediatype."#", $upfile_name)) - { - ShowMsg("你上传的影音文件扩展名无法被识别,请更改系统配置的参数!","javascript:history.go(-1);"); + if (!preg_match("#\." . $cfg_mediatype . "#", $upfile_name)) { + ShowMsg("你上传的影音文件扩展名无法被识别,请更改系统配置的参数!", "javascript:history.go(-1);"); exit(); } - }else - { - if(!preg_match("#\.".$cfg_softtype."#", $upfile_name)) - { - ShowMsg("你上传的附件扩展名无法被识别,请更改系统配置的参数!","javascript:history.go(-1);"); + } else { + if (!preg_match("#\." . $cfg_softtype . "#", $upfile_name)) { + ShowMsg("你上传的附件扩展名无法被识别,请更改系统配置的参数!", "javascript:history.go(-1);"); exit(); } } @@ -160,44 +129,36 @@ else if($dopost=='save') $nowtime = time(); $oldfile = $myrow['url']; $oldfiles = explode('/', $oldfile); - $fullfilename = $cfg_basedir.$oldfile; - $oldfile_path = preg_replace("#".$oldfiles[count($oldfiles)-1]."$#", "", $oldfile); - if(!is_dir($cfg_basedir.$oldfile_path)) - { - MkdirAll($cfg_basedir.$oldfile_path, 777); + $fullfilename = $cfg_basedir . $oldfile; + $oldfile_path = preg_replace("#" . $oldfiles[count($oldfiles) - 1] . "$#", "", $oldfile); + if (!is_dir($cfg_basedir . $oldfile_path)) { + MkdirAll($cfg_basedir . $oldfile_path, 777); CloseFtp(); } @move_uploaded_file($upfile, $fullfilename); - if($mediatype==1) - { - require_once(DEDEINC."/image.func.php"); - if(in_array($upfile_type, $cfg_photo_typenames)) - { + if ($mediatype == 1) { + require_once(DEDEINC . "/image.func.php"); + if (in_array($upfile_type, $cfg_photo_typenames)) { WaterImg($fullfilename, 'up'); } } $filesize = $upfile_size; $imgw = 0; $imgh = 0; - if($mediatype==1) - { + if ($mediatype == 1) { $info = ""; - $sizes[0] = 0; $sizes[1] = 0; + $sizes[0] = 0; + $sizes[1] = 0; $sizes = @getimagesize($fullfilename, $info); $imgw = $sizes[0]; $imgh = $sizes[1]; } - if($imgw>0) - { + if ($imgw > 0) { $addquery = ",width='$imgw',height='$imgh',filesize='$filesize' "; - } - else - { + } else { $addquery = ",filesize='$filesize' "; } - } - else - { + } else { $fileurl = $filename; } @@ -205,15 +166,14 @@ else if($dopost=='save') $query = " UPDATE #@__uploads SET title='$title',mediatype='$mediatype',playtime='$playtime'"; $query .= "$addquery WHERE aid='$aid' "; $dsql->ExecuteNoneQuery($query); - ShowMsg('成功更改一则附件数据!','media_edit.php?aid='.$aid); + ShowMsg('成功更改一则附件数据!', 'media_edit.php?aid=' . $aid); exit(); } //读取档案信息 -$myrow = $dsql->GetOne("SELECT * FROM #@__uploads WHERE aid='".$aid."'"); -if(!is_array($myrow)) -{ - ShowMsg('错误,找不到此编号的档案!','javascript:;'); +$myrow = $dsql->GetOne("SELECT * FROM #@__uploads WHERE aid='" . $aid . "'"); +if (!is_array($myrow)) { + ShowMsg('错误,找不到此编号的档案!', 'javascript:;'); exit(); } -include DedeInclude('templets/media_edit.htm'); \ No newline at end of file +include DedeInclude('templets/media_edit.htm'); diff --git a/src/dede/media_main.php b/src/dede/media_main.php index 4a9b4f6e..f8f45468 100755 --- a/src/dede/media_main.php +++ b/src/dede/media_main.php @@ -1,56 +1,47 @@ 0 "; -} -else if($membertype==2) -{ +} else if ($membertype == 2) { $addsql .= " AND u.mid>0 "; } -if(empty($mediatype)) -{ +if (empty($mediatype)) { $mediatype = 0; } -if($mediatype>1) -{ +if ($mediatype > 1) { $addsql .= " AND u.mediatype='$membertype' "; } $sql = "SELECT u.aid,u.title,u.url,u.mediatype,u.filesize,u.mid,u.uptime @@ -61,41 +52,34 @@ LEFT JOIN #@__member m ON m.mid = u.mid $addsql ORDER BY u.aid DESC"; $dlist = new DataListCP(); $dlist->pageSize = 20; -$dlist->SetParameter("mediatype",$mediatype); -$dlist->SetParameter("keyword",$keyword); -$dlist->SetParameter("membertype",$membertype); -$dlist->SetTemplate(DEDEADMIN."/templets/media_main.htm"); +$dlist->SetParameter("mediatype", $mediatype); +$dlist->SetParameter("keyword", $keyword); +$dlist->SetParameter("membertype", $membertype); +$dlist->SetTemplate(DEDEADMIN . "/templets/media_main.htm"); $dlist->SetSource($sql); $dlist->Display(); -function MediaType($tid,$nurl) +function MediaType($tid, $nurl) { - if($tid==1) - { + if ($tid == 1) { return "图片预览"; - } - else if($tid==2) - { + } else if ($tid == 2) { return "FLASH"; - } - else if($tid==3) - { + } else if ($tid == 3) { return "视频/音频"; - } - else - { + } else { return "附件/其它"; } } function GetFileSize($fs) { - $fs = $fs/1024; - return trim(sprintf("%10.1f",$fs)." K"); + $fs = $fs / 1024; + return trim(sprintf("%10.1f", $fs) . " K"); } -function UploadAdmin($adminid,$mid) +function UploadAdmin($adminid, $mid) { - if($adminid!='') return $adminid; + if ($adminid != '') return $adminid; else return $mid; -} \ No newline at end of file +} diff --git a/src/dede/member_do.php b/src/dede/member_do.php index ba69cc02..2f2e0f02 100755 --- a/src/dede/member_do.php +++ b/src/dede/member_do.php @@ -1,52 +1,45 @@ GetOne("SELECT * FROM `#@__member` WHERE mid='$id' LIMIT 1 "); $rs = 0; - if($row['matt'] == 10) - { + if ($row['matt'] == 10) { $nrow = $dsql->GetOne("SELECT * FROM `#@__admin` WHERE id='$id' LIMIT 1 "); //已经删除关连的管理员帐号 - if(!is_array($nrow)) $rs = $dsql->ExecuteNoneQuery2("DELETE FROM `#@__member` WHERE mid='$id' LIMIT 1"); - } - else - { + if (!is_array($nrow)) $rs = $dsql->ExecuteNoneQuery2("DELETE FROM `#@__member` WHERE mid='$id' LIMIT 1"); + } else { $rs = $dsql->ExecuteNoneQuery2("DELETE FROM `#@__member` WHERE mid='$id' LIMIT 1"); } - if($rs > 0) - { + if ($rs > 0) { $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_tj` WHERE mid='$id' LIMIT 1"); $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_space` WHERE mid='$id' LIMIT 1"); $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_company` WHERE mid='$id' LIMIT 1"); @@ -60,125 +53,109 @@ if($dopost=="delmember") $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_friends` WHERE mid='$id' Or fid='$id' "); $dsql->ExecuteNoneQuery("DELETE FROM `#@__feedback` WHERE mid='$id' "); $dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET mid='0' WHERE mid='$id'"); - } - else - { + } else { ShowMsg("无法删除此会员,如果这个会员是[管理员]
必须先删除这个[管理员]才能删除此帐号!", $ENV_GOBACK_URL, 0, 5000); exit(); } } - ShowMsg("成功删除一个会员!",$ENV_GOBACK_URL); + ShowMsg("成功删除一个会员!", $ENV_GOBACK_URL); exit(); } - $randcode = mt_rand(10000,99999); - $safecode = substr(md5($cfg_cookie_encode.$randcode),0,24); + $randcode = mt_rand(10000, 99999); + $safecode = substr(md5($cfg_cookie_encode . $randcode), 0, 24); $wintitle = "会员管理-删除会员"; - $wecome_info = "会员管理::删除会员"; + $wecome_info = "会员管理::删除会员"; $win = new OxWindow(); - $win->Init("member_do.php","js/blank.js","POST"); - $win->AddHidden("fmdo","yes"); - $win->AddHidden("dopost",$dopost); - $win->AddHidden("id",$id); - $win->AddHidden("randcode",$randcode); - $win->AddHidden("safecode",$safecode); - $win->AddTitle("你确实要删除(ID:".$id.")这个会员?"); - $win->AddMsgItem("安全验证串: (复制本代码: $safecode )","30"); + $win->Init("member_do.php", "js/blank.js", "POST"); + $win->AddHidden("fmdo", "yes"); + $win->AddHidden("dopost", $dopost); + $win->AddHidden("id", $id); + $win->AddHidden("randcode", $randcode); + $win->AddHidden("safecode", $safecode); + $win->AddTitle("你确实要删除(ID:" . $id . ")这个会员?"); + $win->AddMsgItem("安全验证串: (复制本代码: $safecode )", "30"); $winform = $win->GetWindow("ok"); $win->Display(); -}else if($dopost=="delmembers"){ +} else if ($dopost == "delmembers") { CheckPurview('member_Del'); - if($fmdo=='yes') - { - $safecodeok = substr(md5($cfg_cookie_encode.$randcode),0,24); - if($safecodeok!=$safecode) - { - ShowMsg("请填写正确的安全验证串!","member_do.php?id={$id}&dopost=delmembers"); + if ($fmdo == 'yes') { + $safecodeok = substr(md5($cfg_cookie_encode . $randcode), 0, 24); + if ($safecodeok != $safecode) { + ShowMsg("请填写正确的安全验证串!", "member_do.php?id={$id}&dopost=delmembers"); exit(); } - if(!empty($id)) - { + if (!empty($id)) { //删除用户信息 - - $rs = $dsql->ExecuteNoneQuery2("DELETE FROM `#@__member` WHERE mid IN (".str_replace("`",",",$id).") And matt<>10 "); - if($rs > 0) - { - $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_tj` WHERE mid IN (".str_replace("`",",",$id).") "); - $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_space` WHERE mid IN (".str_replace("`",",",$id).") "); - $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_company` WHERE mid IN (".str_replace("`",",",$id).") "); - $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_person` WHERE mid IN (".str_replace("`",",",$id).") "); + + $rs = $dsql->ExecuteNoneQuery2("DELETE FROM `#@__member` WHERE mid IN (" . str_replace("`", ",", $id) . ") And matt<>10 "); + if ($rs > 0) { + $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_tj` WHERE mid IN (" . str_replace("`", ",", $id) . ") "); + $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_space` WHERE mid IN (" . str_replace("`", ",", $id) . ") "); + $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_company` WHERE mid IN (" . str_replace("`", ",", $id) . ") "); + $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_person` WHERE mid IN (" . str_replace("`", ",", $id) . ") "); //删除用户相关数据 - $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_stow` WHERE mid IN (".str_replace("`",",",$id).") "); - $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_flink` WHERE mid IN (".str_replace("`",",",$id).") "); - $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_operation` WHERE mid IN (".str_replace("`",",",$id).") "); - $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_pms` WHERE toid IN (".str_replace("`",",",$id).") Or fromid IN (".str_replace("`",",",$id).") "); - $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_friends` WHERE mid IN (".str_replace("`",",",$id).") Or fid IN (".str_replace("`",",",$id).") "); - $dsql->ExecuteNoneQuery("DELETE FROM `#@__feedback` WHERE mid IN (".str_replace("`",",",$id).") "); - $dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET mid='0' WHERE mid IN (".str_replace("`",",",$id).")"); - } - else - { - ShowMsg("无法删除此会员,如果这个会员是管理员关连的ID,
必须先删除这个管理员才能删除此帐号!",$ENV_GOBACK_URL,0,3000); + $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_stow` WHERE mid IN (" . str_replace("`", ",", $id) . ") "); + $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_flink` WHERE mid IN (" . str_replace("`", ",", $id) . ") "); + $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_operation` WHERE mid IN (" . str_replace("`", ",", $id) . ") "); + $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_pms` WHERE toid IN (" . str_replace("`", ",", $id) . ") Or fromid IN (" . str_replace("`", ",", $id) . ") "); + $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_friends` WHERE mid IN (" . str_replace("`", ",", $id) . ") Or fid IN (" . str_replace("`", ",", $id) . ") "); + $dsql->ExecuteNoneQuery("DELETE FROM `#@__feedback` WHERE mid IN (" . str_replace("`", ",", $id) . ") "); + $dsql->ExecuteNoneQuery("UPDATE `#@__archives` SET mid='0' WHERE mid IN (" . str_replace("`", ",", $id) . ")"); + } else { + ShowMsg("无法删除此会员,如果这个会员是管理员关连的ID,
必须先删除这个管理员才能删除此帐号!", $ENV_GOBACK_URL, 0, 3000); exit(); } } - ShowMsg("成功删除这些会员!",$ENV_GOBACK_URL); + ShowMsg("成功删除这些会员!", $ENV_GOBACK_URL); exit(); } $randcode = mt_rand(10000, 99999); - $safecode = substr(md5($cfg_cookie_encode.$randcode), 0, 24); + $safecode = substr(md5($cfg_cookie_encode . $randcode), 0, 24); $wintitle = "会员管理-删除会员"; - $wecome_info = "会员管理::删除会员"; + $wecome_info = "会员管理::删除会员"; $win = new OxWindow(); $win->Init("member_do.php", "js/blank.js", "POST"); $win->AddHidden("fmdo", "yes"); $win->AddHidden("dopost", $dopost); - $win->AddHidden("id",$id); + $win->AddHidden("id", $id); $win->AddHidden("randcode", $randcode); $win->AddHidden("safecode", $safecode); - $win->AddTitle("你确实要删除(ID:".$id.")这个会员?"); - $win->AddMsgItem(" 安全验证串: (复制本代码: $safecode)","30"); + $win->AddTitle("你确实要删除(ID:" . $id . ")这个会员?"); + $win->AddMsgItem(" 安全验证串: (复制本代码: $safecode)", "30"); $winform = $win->GetWindow("ok"); $win->Display(); } /*---------------- function __Recommend() 推荐会员 -----------------*/ -else if ($dopost=="recommend") -{ +----------------*/ else if ($dopost == "recommend") { CheckPurview('member_Edit'); $id = preg_replace("#[^0-9]#", "", $id); - if($matt==0) - { + if ($matt == 0) { $dsql->ExecuteNoneQuery("UPDATE `#@__member` SET matt=1 WHERE mid='$id' AND matt<>10 LIMIT 1"); - ShowMsg("成功设置一个会员推荐!",$ENV_GOBACK_URL); + ShowMsg("成功设置一个会员推荐!", $ENV_GOBACK_URL); exit(); - } - else - { + } else { $dsql->ExecuteNoneQuery("UPDATE `#@__member` SET matt=0 WHERE mid='$id' AND matt<>10 LIMIT 1"); - ShowMsg("成功取消一个会员推荐!",$ENV_GOBACK_URL); + ShowMsg("成功取消一个会员推荐!", $ENV_GOBACK_URL); exit(); } } /*---------------- function __EditUser() 更改会员 -----------------*/ -else if ($dopost=='edituser') -{ +----------------*/ else if ($dopost == 'edituser') { CheckPurview('member_Edit'); - if(!isset($_POST['id'])) exit('Request Error!'); - $pwdsql = empty($pwd) ? '' : ",pwd='".md5($pwd)."'"; - if(empty($sex)) $sex = '男'; - $uptime=GetMkTime($uptime); - - if($matt==10 && $oldmatt!=10) - { + if (!isset($_POST['id'])) exit('Request Error!'); + $pwdsql = empty($pwd) ? '' : ",pwd='" . md5($pwd) . "'"; + if (empty($sex)) $sex = '男'; + $uptime = GetMkTime($uptime); + + if ($matt == 10 && $oldmatt != 10) { ShowMsg("对不起,为安全起见,不支持直接把前台会员转为管理的操作!", "-1"); exit(); - } + } $query = "UPDATE `#@__member` SET email = '$email', uname = '$uname', @@ -193,8 +170,7 @@ else if ($dopost=='edituser') $pwdsql WHERE mid='$id' AND matt<>10 "; $rs = $dsql->ExecuteNoneQuery2($query); - if($rs==0) - { + if ($rs == 0) { $query = "UPDATE `#@__member` SET email = '$email', uname = '$uname', @@ -207,72 +183,60 @@ else if ($dopost=='edituser') exptime='$exptime' $pwdsql WHERE mid='$id' "; - $rs = $dsql->ExecuteNoneQuery2($query); + $rs = $dsql->ExecuteNoneQuery2($query); } - + #api{{ - if(defined('UC_API') && @include_once DEDEROOT.'/api/uc.func.php') - { + if (defined('UC_API') && @include_once DEDEROOT . '/api/uc.func.php') { $row = $dsql->GetOne("SELECT `scores`,`userid` FROM `#@__member` WHERE `mid`='$id' AND `matt`<>10"); - $amount = $scores-$row['scores']; - uc_credit_note($row['userid'],$amount); + $amount = $scores - $row['scores']; + uc_credit_note($row['userid'], $amount); } #/aip}} - - ShowMsg('成功更改会员资料!', 'member_view.php?id='.$id); + + ShowMsg('成功更改会员资料!', 'member_view.php?id=' . $id); exit(); } /*-------------- function __LoginCP() 登录会员的控制面板 -----------*/ -else if ($dopost=="memberlogin") -{ +----------*/ else if ($dopost == "memberlogin") { CheckPurview('member_Edit'); - PutCookie('DedeUserID',$id,1800); - PutCookie('DedeLoginTime',time(),1800); - if(empty($jumpurl)) header("location:../member/index.php"); + PutCookie('DedeUserID', $id, 1800); + PutCookie('DedeLoginTime', time(), 1800); + if (empty($jumpurl)) header("location:../member/index.php"); else header("location:$jumpurl"); -} else if ($dopost == "deoperations") -{ +} else if ($dopost == "deoperations") { $nid = preg_replace('#[^0-9,]#', '', preg_replace('#`#', ',', $nid)); $nid = explode(',', $nid); - if(is_array($nid)) - { - foreach ($nid as $var) - { + if (is_array($nid)) { + foreach ($nid as $var) { $query = "DELETE FROM `#@__member_operation` WHERE aid = '$var'"; $dsql->ExecuteNoneQuery($query); } - ShowMsg("删除成功!","member_operations.php"); + ShowMsg("删除成功!", "member_operations.php"); exit(); } -} else if ($dopost == "upoperations") -{ +} else if ($dopost == "upoperations") { $nid = preg_replace('#[^0-9,]#', '', preg_replace('#`#', ',', $nid)); $nid = explode(',', $nid); - if(is_array($nid)) - { - foreach ($nid as $var) - { + if (is_array($nid)) { + foreach ($nid as $var) { $query = "UPDATE `#@__member_operation` SET sta = '1' WHERE aid = '$var'"; $dsql->ExecuteNoneQuery($query); - ShowMsg("设置成功!","member_operations.php"); + ShowMsg("设置成功!", "member_operations.php"); exit(); } } -} else if($dopost == "okoperations") -{ +} else if ($dopost == "okoperations") { $nid = preg_replace('#[^0-9,]#', '', preg_replace('#`#', ',', $nid)); $nid = explode(',', $nid); - if(is_array($nid)) - { - foreach ($nid as $var) - { + if (is_array($nid)) { + foreach ($nid as $var) { $query = "UPDATE `#@__member_operation` SET sta = '2' WHERE aid = '$var'"; $dsql->ExecuteNoneQuery($query); - ShowMsg("设置成功!","member_operations.php"); + ShowMsg("设置成功!", "member_operations.php"); exit(); } } -} \ No newline at end of file +} diff --git a/src/dede/member_main.php b/src/dede/member_main.php index 7116d340..eb373055 100755 --- a/src/dede/member_main.php +++ b/src/dede/member_main.php @@ -1,117 +1,102 @@ 类型\r\n" : "\r\n"; $sexform = empty($sex) ? "\r\n" : "\r\n"; -$sortkey = empty($sortkey) ? 'mid' : preg_replace("#[^a-z]#i",'',$sortkey); +$sortkey = empty($sortkey) ? 'mid' : preg_replace("#[^a-z]#i", '', $sortkey); -$staArr = array(-2=>'限制用户(禁言)', -1=>'未通过审核', 0=>'审核通过,提示填写完整信息', 1=>'没填写详细资料', 2=>'正常使用状态'); -$staArrmatt = array(1=>'被推荐', 0=>'非普通 ' ); +$staArr = array(-2 => '限制用户(禁言)', -1 => '未通过审核', 0 => '审核通过,提示填写完整信息', 1 => '没填写详细资料', 2 => '正常使用状态'); +$staArrmatt = array(1 => '被推荐', 0 => '非普通 '); $MemberTypes = array(); $dsql->SetQuery("Select rank,membername From `#@__arcrank` where rank>0 "); $dsql->Execute(); -while($row = $dsql->GetObject()) -{ +while ($row = $dsql->GetObject()) { $MemberTypes[$row->rank] = $row->membername; } -if($sortkey=='mid') -{ +if ($sortkey == 'mid') { $sortform = "\r\n"; -} -else if($sortkey=='rank') -{ +} else if ($sortkey == 'rank') { $sortform = "\r\n"; -} -else if($sortkey=='money') -{ +} else if ($sortkey == 'money') { $sortform = "\r\n"; -} -else if($sortkey=='scores') -{ +} else if ($sortkey == 'scores') { $sortform = "\r\n"; -} -else -{ +} else { $sortform = "\r\n"; } $wheres[] = " (userid LIKE '%$keyword%' OR uname LIKE '%$keyword%' OR email LIKE '%$keyword%') "; -if($sex != '') -{ +if ($sex != '') { $wheres[] = " sex LIKE '$sex' "; } -if($mtype != '') -{ +if ($mtype != '') { $wheres[] = " mtype LIKE '$mtype' "; } -if($spacesta != -10) -{ +if ($spacesta != -10) { $wheres[] = " spacesta = '$spacesta' "; } -if($matt != 10) -{ +if ($matt != 10) { $wheres[] = " matt= '$matt' "; } -$whereSql = join(' AND ',$wheres); -if($whereSql!='') -{ - $whereSql = ' WHERE '.$whereSql; +$whereSql = join(' AND ', $wheres); +if ($whereSql != '') { + $whereSql = ' WHERE ' . $whereSql; } $sql = "SELECT * FROM `#@__member` $whereSql ORDER BY $sortkey DESC "; $dlist = new DataListCP(); -$dlist->SetParameter('sex',$sex); -$dlist->SetParameter('spacesta',$spacesta); -$dlist->SetParameter('matt',$matt); -$dlist->SetParameter('mtype',$mtype); -$dlist->SetParameter('sortkey',$sortkey); -$dlist->SetParameter('keyword',$keyword); -$dlist->SetTemplet(DEDEADMIN."/templets/member_main.htm"); +$dlist->SetParameter('sex', $sex); +$dlist->SetParameter('spacesta', $spacesta); +$dlist->SetParameter('matt', $matt); +$dlist->SetParameter('mtype', $mtype); +$dlist->SetParameter('sortkey', $sortkey); +$dlist->SetParameter('keyword', $keyword); +$dlist->SetTemplet(DEDEADMIN . "/templets/member_main.htm"); $dlist->SetSource($sql); $dlist->display(); -function GetMemberName($rank,$mt) +function GetMemberName($rank, $mt) { global $MemberTypes; - if(isset($MemberTypes[$rank])) - { - if($mt=='ut') return " 待升级:".$MemberTypes[$rank].""; + if (isset($MemberTypes[$rank])) { + if ($mt == 'ut') return " 待升级:" . $MemberTypes[$rank] . ""; else return $MemberTypes[$rank]; } else { - if($mt=='ut') return ''; + if ($mt == 'ut') return ''; else return $mt; } } function GetMAtt($m) { - if($m<1) return ''; - else if($m==10) return " [管理员]"; + if ($m < 1) return ''; + else if ($m == 10) return " [管理员]"; else return " [荐]"; -} \ No newline at end of file +} diff --git a/src/dede/member_operations.php b/src/dede/member_operations.php index 488ac55e..e5d39227 100755 --- a/src/dede/member_operations.php +++ b/src/dede/member_operations.php @@ -1,37 +1,37 @@ pageSize = 25; -$dlist->SetParameter("buyid",$buyid); -if(isset($sta)) $dlist->SetParameter("sta",$sta); +$dlist->SetParameter("buyid", $buyid); +if (isset($sta)) $dlist->SetParameter("sta", $sta); $dlist->dsql->SetQuery("SELECT * FROM #@__moneycard_type "); $dlist->dsql->Execute('ts'); -while($rw = $dlist->dsql->GetArray('ts')) -{ +while ($rw = $dlist->dsql->GetArray('ts')) { $TypeNames[$rw['tid']] = $rw['pname']; } -$tplfile = DEDEADMIN."/templets/member_operations.htm"; +$tplfile = DEDEADMIN . "/templets/member_operations.htm"; //这两句的顺序不能更换 $dlist->SetTemplate($tplfile); //载入模板 @@ -41,41 +41,32 @@ $dlist->Display(); //显示 function GetMemberID($mid) { global $dsql; - if($mid==0) - { + if ($mid == 0) { return '0'; } $row = $dsql->GetOne("SELECT userid FROM #@__member WHERE mid='$mid' "); - if(is_array($row)) - { - return "".$row['userid'].""; - } - else - { + if (is_array($row)) { + return "" . $row['userid'] . ""; + } else { return '0'; } } function GetPType($tname) { - if($tname=='card') return '点数卡'; - else if($tname=='archive') return '购买文章'; - else if($tname=='stc') return '兑换金币'; + if ($tname == 'card') return '点数卡'; + else if ($tname == 'archive') return '购买文章'; + else if ($tname == 'stc') return '兑换金币'; else return '会员升级'; } function GetSta($sta) { - if($sta==0) - { + if ($sta == 0) { return '未付款'; - } - else if($sta==1) - { + } else if ($sta == 1) { return '已付款'; - } - else - { + } else { return '已完成'; } -} \ No newline at end of file +} diff --git a/src/dede/member_pm.php b/src/dede/member_pm.php index 3e6a53d7..7bdb052f 100755 --- a/src/dede/member_pm.php +++ b/src/dede/member_pm.php @@ -1,64 +1,61 @@ ExecuteNoneQuery("DELETE FROM #@__member_pms WHERE id='$ID'"); } } $whereSql = ''; -if(!empty($folder)) $whereSql = "WHERE folder='$folder'"; +if (!empty($folder)) $whereSql = "WHERE folder='$folder'"; $postuser = "收件人"; -if($folder=="inbox"||$folder=='') $postuser = "发件人"; +if ($folder == "inbox" || $folder == '') $postuser = "发件人"; -if(!empty($keyword)) -{ - $whereSql .= " AND (subject like '%".$keyword."%' OR message like '%".$keyword."%')"; +if (!empty($keyword)) { + $whereSql .= " AND (subject like '%" . $keyword . "%' OR message like '%" . $keyword . "%')"; } -if(!empty($username)) -{ - $whereSql .= " AND floginid like '%".$username."%'"; +if (!empty($username)) { + $whereSql .= " AND floginid like '%" . $username . "%'"; } $sql = "SELECT * FROM #@__member_pms $whereSql ORDER BY sendtime desc"; $dlist = new DataListCP(); $dlist->pagesize = 25; -$dlist->SetParameter("folder",$folder); -$dlist->SetParameter("username",$username); -$dlist->SetParameter("keyword",$keyword); -$dlist->SetTemplate(DEDEADMIN."/templets/member_pm.htm"); +$dlist->SetParameter("folder", $folder); +$dlist->SetParameter("username", $username); +$dlist->SetParameter("keyword", $keyword); +$dlist->SetTemplate(DEDEADMIN . "/templets/member_pm.htm"); $dlist->SetSource($sql); $dlist->Display(); $dlist->Close(); function GetFolders($me) { - if($me=="outbox") return '发件箱'; - else if($me=="inbox") return '收件箱'; + if ($me == "outbox") return '发件箱'; + else if ($me == "inbox") return '收件箱'; } function IsReader($me) { $me = preg_replace("#[^0-1]#", "", $me); - if($me) return ""; + if ($me) return ""; else return "×"; -} \ No newline at end of file +} diff --git a/src/dede/member_pmall.php b/src/dede/member_pmall.php index 96908729..23854409 100755 --- a/src/dede/member_pmall.php +++ b/src/dede/member_pmall.php @@ -1,47 +1,45 @@ ExecuteNoneQuery("INSERT INTO #@__member_pms(floginid,fromid,toid,tologinid,folder,hasview,subject,sendtime,writetime,message,isadmin) VALUES('$floginid','$fromid','$toid','$tologinid','outbox','0','$subject','$sendtime','$writetime','$message','1');"); - ShowMsg('短信已成功发送','-1'); + ShowMsg('短信已成功发送', '-1'); exit(); } -require_once(DEDEADMIN."/templets/member_pmall.htm"); \ No newline at end of file +require_once(DEDEADMIN . "/templets/member_pmall.htm"); diff --git a/src/dede/member_pmone.php b/src/dede/member_pmone.php index ec3241b8..0026c988 100755 --- a/src/dede/member_pmone.php +++ b/src/dede/member_pmone.php @@ -1,88 +1,73 @@ 0x80) - { - if(isset($ck_uid[$i+1]) && ord($ck_uid[$i+1])>0x40) - { + + for ($i = 0; isset($ck_uid[$i]); $i++) { + if (ord($ck_uid[$i]) > 0x80) { + if (isset($ck_uid[$i + 1]) && ord($ck_uid[$i + 1]) > 0x40) { $i++; + } else { + return $msgtitle . '可能含有乱码,建议你改用英文字母和数字组合!'; } - else - { - return $msgtitle.'可能含有乱码,建议你改用英文字母和数字组合!'; - } - } - else - { - if(preg_match("#[^0-9a-z@\.-]i#", $ck_uid[$i])) - { - return $msgtitle.'不能含有 [@]、[.]、[-]以外的特殊符号!'; + } else { + if (preg_match("#[^0-9a-z@\.-]i#", $ck_uid[$i])) { + return $msgtitle . '不能含有 [@]、[.]、[-]以外的特殊符号!'; } } } - if($ckhas) - { + if ($ckhas) { $row = $dsql->GetOne("SELECT * FROM `#@__member` WHERE userid LIKE '$uid' "); - if(is_array($row)) return $msgtitle."已经存在!"; + if (is_array($row)) return $msgtitle . "已经存在!"; } return 'ok'; } -if(!isset($action)) $action = ''; -if($action=="post") -{ +if (!isset($action)) $action = ''; +if ($action == "post") { $floginid = $cuserLogin->getUserName(); $fromid = $cuserLogin->getUserID(); - if($subject=='') - { - ShowMsg("请填写信息标题!","-1"); + if ($subject == '') { + ShowMsg("请填写信息标题!", "-1"); exit(); } - $msg = CheckUserID($msgtoid,"用户名",false); - if($msg!='ok') - { - ShowMsg($msg,"-1"); + $msg = CheckUserID($msgtoid, "用户名", false); + if ($msg != 'ok') { + ShowMsg($msg, "-1"); exit(); } $row = $dsql->GetOne("Select * From `#@__member` where userid like '$msgtoid' "); - if(!is_array($row)) - { - ShowMsg("你指定的用户不存在,不能发送信息!","-1"); + if (!is_array($row)) { + ShowMsg("你指定的用户不存在,不能发送信息!", "-1"); exit(); } - $subject = cn_substrR(HtmlReplace($subject,1),60); - $message = cn_substrR(HtmlReplace($message,0),1024); + $subject = cn_substrR(HtmlReplace($subject, 1), 60); + $message = cn_substrR(HtmlReplace($message, 0), 1024); $sendtime = $writetime = time(); //发给收件人(收件人可管理) @@ -90,7 +75,7 @@ if($action=="post") VALUES ('$floginid','$fromid','{$row['mid']}','{$row['userid']}','inbox','$subject','$sendtime','$writetime','0','0','$message'); "; $dsql->ExecuteNoneQuery($inquery); - ShowMsg('短信已成功发送','member_pmone.php'); + ShowMsg('短信已成功发送', 'member_pmone.php'); exit(); } -require_once(DEDEADMIN."/templets/member_pmone.htm"); \ No newline at end of file +require_once(DEDEADMIN . "/templets/member_pmone.htm"); diff --git a/src/dede/member_rank.php b/src/dede/member_rank.php index 16d46c60..60192f17 100755 --- a/src/dede/member_rank.php +++ b/src/dede/member_rank.php @@ -1,60 +1,52 @@ 0) - { - $query = "UPDATE `#@__arcrank` SET membername='$name',money='$money',rank='$rank',scores='$scores' WHERE id='$id' "; + $id = ${"ID_" . $startID}; + $name = ${"name_" . $startID}; + $rank = ${"rank_" . $startID}; + $money = ${"money_" . $startID}; + $scores = ${"scores_" . $startID}; + if (isset(${"check_" . $startID})) { + if ($rank > 0) { + $query = "UPDATE `#@__arcrank` SET membername='$name',money='$money',rank='$rank',scores='$scores' WHERE id='$id' "; } - } - else - { + } else { $query = "DELETE FROM `#@__arcrank` WHERE id='$id' AND rank<>10"; } - if($query!='') $dsql->ExecuteNoneQuery($query); + if ($query != '') $dsql->ExecuteNoneQuery($query); } - if(isset($check_new)) - { - if($rank_new > 0 && $name_new != '' && $rank_new > 10) - { + if (isset($check_new)) { + if ($rank_new > 0 && $name_new != '' && $rank_new > 10) { $inquery = "INSERT INTO `#@__arcrank`(`rank`,`membername`,`adminrank`,`money`,`scores`,`purviews`) VALUES('$rank_new','$name_new','5','$money_new','$scores',''); "; $dsql->ExecuteNoneQuery($inquery); } } echo ""; } -if($dopost == 'del') -{ +if ($dopost == 'del') { $dsql->ExecuteNoneQuery("DELETE FROM `#@__arcrank` WHERE id='$id' AND rank<>10"); - ShowMsg("删除成功!","member_rank.php"); + ShowMsg("删除成功!", "member_rank.php"); exit(); } $dsql->SetQuery("SELECT * FROM `#@__arcrank` WHERE rank>0 ORDER BY rank"); $dsql->Execute(); -include DedeInclude('templets/member_rank.htm'); \ No newline at end of file +include DedeInclude('templets/member_rank.htm'); diff --git a/src/dede/member_scores.php b/src/dede/member_scores.php index dd6465ce..54add1b3 100755 --- a/src/dede/member_scores.php +++ b/src/dede/member_scores.php @@ -1,42 +1,37 @@ ExecuteNoneQuery("INSERT INTO `#@__scores`(integral,icon,titles,isdefault) VALUES('$integral','$add_icon','$add_titles','$add_isdefault')"); } - foreach($_POST as $rk=>$rv) - { - if(preg_match("#-#", $rk)) - { + foreach ($_POST as $rk => $rv) { + if (preg_match("#-#", $rk)) { $ID = preg_replace("#[^0-9]#", "", $rk); $fildes = preg_replace("#[^a-z]#", "", $rk); $k = $$rk; - if(empty($k)) - { + if (empty($k)) { $k = 0; } - $sql = $fildes."='".$k."'"; - $dsql->ExecuteNoneQuery("UPDATE `#@__scores` SET ".$sql." WHERE id='{$ID}'"); - if(preg_match("#Ids-#", $rk)) - { - if($k) $dsql->ExecuteNoneQuery("DELETE FROM `#@__scores` WHERE id='$ID'"); + $sql = $fildes . "='" . $k . "'"; + $dsql->ExecuteNoneQuery("UPDATE `#@__scores` SET " . $sql . " WHERE id='{$ID}'"); + if (preg_match("#Ids-#", $rk)) { + if ($k) $dsql->ExecuteNoneQuery("DELETE FROM `#@__scores` WHERE id='$ID'"); } } } @@ -45,8 +40,7 @@ if($action=='save') $Scores = array(); $dsql->SetQuery("SELECT * FROM `#@__scores` ORDER BY id ASC"); $dsql->Execute(); -while($rs = $dsql->GetArray()) -{ - array_push($Scores,$rs); +while ($rs = $dsql->GetArray()) { + array_push($Scores, $rs); } -include DedeInclude('templets/member_scores.htm'); \ No newline at end of file +include DedeInclude('templets/member_scores.htm'); diff --git a/src/dede/member_toadmin.php b/src/dede/member_toadmin.php index 0c6563c0..1a47de8d 100755 --- a/src/dede/member_toadmin.php +++ b/src/dede/member_toadmin.php @@ -1,17 +1,18 @@ GetOne("SELECT * FROM #@__member WHERE mid='$id'"); $password = $row['pwd']; $inputpwd = ",pwd"; $pwd = substr($password, 5, 20); - $inputpwdv = ",'".$pwd."'"; - $pwdm = ",pwd='".$password."'"; + $inputpwdv = ",'" . $pwd . "'"; + $pwdm = ",pwd='" . $password . "'"; } - $typeids=(empty($typeids))? "" : $typeids; - if($typeids=='') - { - ShowMsg("请为该管理员指定管理栏目!","member_toadmin.php?id={$id}"); + $typeids = (empty($typeids)) ? "" : $typeids; + if ($typeids == '') { + ShowMsg("请为该管理员指定管理栏目!", "member_toadmin.php?id={$id}"); exit(); } $typeid = join(',', $typeids); - if($typeid=='0') $typeid = ''; - if($id!=1) - { + if ($typeid == '0') $typeid = ''; + if ($id != 1) { $query = "INSERT INTO `#@__admin`(id,usertype,userid$inputpwd,uname,typeid,tname,email) VALUES('$id','$usertype','$userid'$inputpwdv,'$uname','$typeid','$tname','$email')"; - } - else - { + } else { $query = "INSERT INTO `#@__admin`(id,userid$inputpwd,uname,typeid,tname,email) VALUES('$id','$userid'$inputpwdv,'$uname','$typeid','$tname','$email')"; } @@ -77,28 +70,26 @@ if($dopost == "toadmin") $inquery = "INSERT INTO `#@__member_pms` (`floginid`,`fromid`,`toid`,`tologinid`,`folder`,`subject`,`sendtime`,`writetime`,`hasview`,`isadmin`,`message`) VALUES ('$floginid','$fromid','$id','$userid','inbox','$subject','$sendtime','$writetime','0','0','$message'); "; $dsql->ExecuteNoneQuery($inquery); - ShowMsg("成功升级一个帐户!","member_main.php"); + ShowMsg("成功升级一个帐户!", "member_main.php"); exit(); -} +} $id = preg_replace("#[^0-9]#", "", $id); //显示用户信息 $randcode = mt_rand(10000, 99999); -$safecode = substr(md5($cfg_cookie_encode.$randcode), 0, 24); +$safecode = substr(md5($cfg_cookie_encode . $randcode), 0, 24); $typeOptions = ''; -$typeid=(empty($typeid))? '' : $typeid; +$typeid = (empty($typeid)) ? '' : $typeid; $typeids = explode(',', $typeid); $dsql->SetQuery("SELECT id,typename FROM `#@__arctype` WHERE reid=0 AND (ispart=0 OR ispart=1)"); $dsql->Execute('op'); -while($nrow = $dsql->GetObject('op')) -{ - $typeOptions .= "\r\n"; +while ($nrow = $dsql->GetObject('op')) { + $typeOptions .= "\r\n"; $dsql->SetQuery("SELECT id,typename FROM #@__arctype WHERE reid={$nrow->id} AND (ispart=0 OR ispart=1)"); $dsql->Execute('s'); - while($nrow = $dsql->GetObject('s')) - { - $typeOptions .= "\r\n"; + while ($nrow = $dsql->GetObject('s')) { + $typeOptions .= "\r\n"; } } $row = $dsql->GetOne("SELECT * FROM #@__member WHERE mid='$id'"); -include DedeInclude('templets/member_toadmin.htm'); \ No newline at end of file +include DedeInclude('templets/member_toadmin.htm'); diff --git a/src/dede/member_type.php b/src/dede/member_type.php index add064a9..9de31810 100755 --- a/src/dede/member_type.php +++ b/src/dede/member_type.php @@ -1,50 +1,43 @@ ExecuteNoneQuery($query); } } //增加新记录 - if(isset($check_new) && $pname_new!='') - { + if (isset($check_new) && $pname_new != '') { $query = "INSERT INTO #@__member_type(rank,pname,money,exptime) VALUES('{$rank_new}','{$pname_new}','{$money_new}','{$exptime_new}');"; $dsql->ExecuteNoneQuery($query); } @@ -54,8 +47,7 @@ if($dopost=="save") $arcranks = array(); $dsql->SetQuery("SELECT * FROM #@__arcrank WHERE rank>10 "); $dsql->Execute(); -while($row=$dsql->GetArray()) -{ +while ($row = $dsql->GetArray()) { $arcranks[$row['rank']] = $row['membername']; } @@ -67,4 +59,4 @@ $times[183] = '半年'; $times[366] = '一年'; $times[32767] = '终身'; -require_once(DEDEADMIN."/templets/member_type.htm"); \ No newline at end of file +require_once(DEDEADMIN . "/templets/member_type.htm"); diff --git a/src/dede/member_view.php b/src/dede/member_view.php index 6b8fa0c7..ec22ecd2 100755 --- a/src/dede/member_view.php +++ b/src/dede/member_view.php @@ -1,35 +1,35 @@ GetOne("select * from #@__member where mid='$id'"); $staArr = array( - -10=>'等待验证邮件', - -2=>'限制用户(禁言)', - -1=>'未通过审核', - 0=>'审核通过,提示填写完整信息', - 1=>'没填写详细资料', - 2=>'正常使用状态' + -10 => '等待验证邮件', + -2 => '限制用户(禁言)', + -1 => '未通过审核', + 0 => '审核通过,提示填写完整信息', + 1 => '没填写详细资料', + 2 => '正常使用状态' ); //如果这个用户是管理员帐号,必须有足够权限的用户才能操作 -if($row['matt']==10) CheckPurview('sys_User'); +if ($row['matt'] == 10) CheckPurview('sys_User'); -if($row['uptime']>0 && $row['exptime']>0) -{ - $mhasDay = $row['exptime'] - ceil((time() - $row['uptime'])/3600/24)+1; +if ($row['uptime'] > 0 && $row['exptime'] > 0) { + $mhasDay = $row['exptime'] - ceil((time() - $row['uptime']) / 3600 / 24) + 1; } else { $mhasDay = 0; } -include DedeInclude('templets/member_view.htm'); \ No newline at end of file +include DedeInclude('templets/member_view.htm'); diff --git a/src/dede/module_main.php b/src/dede/module_main.php index bbec484a..547374b2 100755 --- a/src/dede/module_main.php +++ b/src/dede/module_main.php @@ -1,113 +1,85 @@ SetQuery("SELECT `varname`,`type`,`value`,`groupid` FROM `#@__sysconfig` ORDER BY aid ASC "); - $dsql->Execute(); - while($row = $dsql->GetArray()) - { - if($row['type']=='number') fwrite($fp,"\${$row['varname']} = ".$row['value'].";\r\n"); - else fwrite($fp,"\${$row['varname']} = '".str_replace("'",'',$row['value'])."';\r\n"); - } - fwrite($fp,"?".">"); - fclose($fp); + global $dsql; + $configfile = DEDEDATA . '/config.cache.inc.php'; + if (!is_writeable($configfile)) { + echo "配置文件'{$configfile}'不支持写入,无法修改系统配置参数!"; + //ClearAllLink(); + exit(); + } + $fp = fopen($configfile, 'w'); + flock($fp, 3); + fwrite($fp, "<" . "?php\r\n"); + $dsql->SetQuery("SELECT `varname`,`type`,`value`,`groupid` FROM `#@__sysconfig` ORDER BY aid ASC "); + $dsql->Execute(); + while ($row = $dsql->GetArray()) { + if ($row['type'] == 'number') fwrite($fp, "\${$row['varname']} = " . $row['value'] . ";\r\n"); + else fwrite($fp, "\${$row['varname']} = '" . str_replace("'", '', $row['value']) . "';\r\n"); + } + fwrite($fp, "?" . ">"); + fclose($fp); } - -function SendData($hash = '',$type = 1) -{ - if(!empty($hash)){ - global $cfg_basehost; - $str = "basehost=".$cfg_basehost."&hash=".$hash."&type=".$type; - $fp = fsockopen('www.dedecms.com',80,$errno,$errstr,30); - if(!$fp) - { - return FALSE; - }else{ - fputs($fp, "POST http://www.dedecms.com/plugin.php HTTP/1.1\r\n"); - fputs($fp, "Host: www.dedecms.com\r\n"); - fputs($fp, "Content-type: application/x-www-form-urlencoded\r\n"); - fputs($fp, "Content-length: ".strlen($str)."\r\n"); - fputs($fp, "Connection: close\r\n\r\n"); - fputs($fp, $str."\r\n\r\n"); - fclose($fp); - } - }else{ - return FALSE; - } -} /*-------------- function ShowAll(); --------------*/ -if($action=='') -{ - $types = array('soft'=>'模块','templets'=>'模板','plus'=>'小插件','patch'=>'补丁'); - $dm = new DedeModule($mdir); - if(empty($moduletype)) $moduletype = ''; - - $modules_remote = $dm->GetModuleUrlList($moduletype,$mdurl); - $modules = array(); - $modules = $dm->GetModuleList($moduletype); - is_array($modules) || $modules = array(); - if (is_array($modules_remote) && count($modules_remote) > 0) { - $modules = array_merge($modules, $modules_remote); - } - require_once(dirname(__FILE__)."/templets/module_main.htm"); - $dm->Clear(); - exit(); +if ($action == '') { + $types = array('soft' => '模块', 'templets' => '模板', 'plus' => '小插件', 'patch' => '补丁'); + $dm = new DedeModule($mdir); + if (empty($moduletype)) $moduletype = ''; + + $modules_remote = $dm->GetModuleUrlList($moduletype, $mdurl); + $modules = array(); + $modules = $dm->GetModuleList($moduletype); + is_array($modules) || $modules = array(); + if (is_array($modules_remote) && count($modules_remote) > 0) { + $modules = array_merge($modules, $modules_remote); + } + require_once(dirname(__FILE__) . "/templets/module_main.htm"); + $dm->Clear(); + exit(); } /*-------------- function ViewDevelopoer(); ---------------*/ -else if($action=='view_developoer') -{ +--------------*/ else if ($action == 'view_developoer') { // 检验开发者信息 $dm = new DedeModule($mdir); $info = $dm->GetModuleInfo($hash); - if ($info==null) { + if ($info == null) { ShowMsg("获取模块信息错误,模块文件可能被篡改", -1); exit; } @@ -124,80 +96,69 @@ else if($action=='view_developoer') } $authAt = date("Y-m-d", $devInfo['auth_at']); - ShowMsg("

开发者名称:{$devInfo['dev_name']}

开发者全称:{$devInfo['realname']}

开发者ID:{$devInfo['dev_id']} 查看详情

$offUrl

认证于:{$authAt}

","javascript:;"); -exit; + ShowMsg("

开发者名称:{$devInfo['dev_name']}

开发者全称:{$devInfo['realname']}

开发者ID:{$devInfo['dev_id']} 查看详情

$offUrl

认证于:{$authAt}

", "javascript:;"); + exit; } /*-------------- function Setup(); ---------------*/ -else if($action=='setup') -{ - $dm = new DedeModule($mdir); - $infos = $dm->GetModuleInfo($hash); - if ($infos==null) { - ShowMsg("获取模块信息错误,模块文件可能被篡改", -1); - exit; - } +--------------*/ else if ($action == 'setup') { + $dm = new DedeModule($mdir); + $infos = $dm->GetModuleInfo($hash); + if ($infos == null) { + ShowMsg("获取模块信息错误,模块文件可能被篡改", -1); + exit; + } - $alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '
(这个模块的语言编码与你系统的编码不一致,请向开发者确认它的兼容性)'); - - $filelists = $dm->GetFileLists($hash); - $filelist = ''; - $prvdirs = array(); - $incdir = array(); - foreach($filelists as $v) - { - if(empty($v['name'])) continue; - if($v['type']=='dir') - { - $v['type'] = '目录'; - $incdir[] = $v['name']; - } - else - { - $v['type'] = '文件'; - } - $filelist .= "{$v['type']}|{$v['name']}\r\n"; + $alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '
(这个模块的语言编码与你系统的编码不一致,请向开发者确认它的兼容性)'); + + $filelists = $dm->GetFileLists($hash); + $filelist = ''; + $prvdirs = array(); + $incdir = array(); + foreach ($filelists as $v) { + if (empty($v['name'])) continue; + if ($v['type'] == 'dir') { + $v['type'] = '目录'; + $incdir[] = $v['name']; + } else { + $v['type'] = '文件'; } - //检测需要的目录权限 - foreach($filelists as $v) - { - $prvdir = preg_replace("#\/([^\/]*)$#", '/', $v['name']); - if(!preg_match("#^\.#", $prvdir)) $prvdir = './'; - $n = TRUE; - foreach($incdir as $k=>$v) - { - if(preg_match("#^".$v."#i", $prvdir)) - { - $n = FALSE; - BREAK; - } - } - if(!isset($prvdirs[$prvdir]) && $n && is_dir($prvdir)) - { - $prvdirs[$prvdir][0] = 1; - $prvdirs[$prvdir][1] = TestWriteAble($prvdir); - } + $filelist .= "{$v['type']}|{$v['name']}\r\n"; + } + //检测需要的目录权限 + foreach ($filelists as $v) { + $prvdir = preg_replace("#\/([^\/]*)$#", '/', $v['name']); + if (!preg_match("#^\.#", $prvdir)) $prvdir = './'; + $n = TRUE; + foreach ($incdir as $k => $v) { + if (preg_match("#^" . $v . "#i", $prvdir)) { + $n = FALSE; + break; + } } - $prvdir = "
\r\n"; - $prvdir .= "\r\n"; - foreach($prvdirs as $k=>$v) - { - if($v) $cw = '√'; - else $cw = '×'; - $prvdir .= ""; - $prvdir .= "\r\n"; + if (!isset($prvdirs[$prvdir]) && $n && is_dir($prvdir)) { + $prvdirs[$prvdir][0] = 1; + $prvdirs[$prvdir][1] = TestWriteAble($prvdir); } - $prvdir .= "
目录可写
$k$cw
"; + } + $prvdir = "\r\n"; + $prvdir .= "\r\n"; + foreach ($prvdirs as $k => $v) { + if ($v) $cw = '√'; + else $cw = '×'; + $prvdir .= ""; + $prvdir .= "\r\n"; + } + $prvdir .= "
目录可写
$k$cw
"; - $win = new OxWindow(); - $win->Init("module_main.php","js/blank.js","post"); - $wecome_info = "模块管理"; - $win->AddTitle(" 模块管理 >> 安装模块: {$infos['name']}"); - $win->AddHidden("hash",$hash); - $win->AddHidden("action",'setupstart'); + $win = new OxWindow(); + $win->Init("module_main.php", "js/blank.js", "post"); + $wecome_info = "模块管理"; + $win->AddTitle(" 模块管理 >> 安装模块: {$infos['name']}"); + $win->AddHidden("hash", $hash); + $win->AddHidden("action", 'setupstart'); - $msg = " + $msg = " @@ -259,114 +220,103 @@ else if($action=='setup')
模块名称:
"; - $win->AddMsgItem("
$msg
"); - $winform = $win->GetWindow("ok",""); - $win->Display(); - $dm->Clear(); - exit(); + $win->AddMsgItem("
$msg
"); + $winform = $win->GetWindow("ok", ""); + $win->Display(); + $dm->Clear(); + exit(); } /*--------------- function SetupRun() ---------------*/ -else if($action=='setupstart') -{ - if(!is_writeable($mdir)) - { - ShowMsg("目录 {$mdir} 不支持写入,这将导致安装程序没法正常创建!","-1"); - exit(); - } - $dm = new DedeModule($mdir); +--------------*/ else if ($action == 'setupstart') { + if (!is_writeable($mdir)) { + ShowMsg("目录 {$mdir} 不支持写入,这将导致安装程序没法正常创建!", "-1"); + exit(); + } + $dm = new DedeModule($mdir); - $minfos = $dm->GetModuleInfo($hash); - extract($minfos, EXTR_SKIP); + $minfos = $dm->GetModuleInfo($hash); + extract($minfos, EXTR_SKIP); - $menustring = addslashes($dm->GetSystemFile($hash,'menustring')); - $indexurl = str_replace('**', '=', $indexurl); + $menustring = addslashes($dm->GetSystemFile($hash, 'menustring')); + $indexurl = str_replace('**', '=', $indexurl); - $query = "INSERT INTO `#@__sys_module`(`hashcode` , `modname` , `indexname` , `indexurl` , `ismember` , `menustring` ) + $query = "INSERT INTO `#@__sys_module`(`hashcode` , `modname` , `indexname` , `indexurl` , `ismember` , `menustring` ) VALUES ('$hash' , '$name' , '$indexname' , '$indexurl' , '$ismember' , '$menustring' ) "; - $rs = $dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_module` WHERE hashcode LIKE '$hash' "); - $rs = $dsql->ExecuteNoneQuery($query); - if(!$rs) - { - ShowMsg('保存数据库信息失败,无法完成安装!'.$dsql->GetError(),'javascript:;'); - exit(); - } + $rs = $dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_module` WHERE hashcode LIKE '$hash' "); + $rs = $dsql->ExecuteNoneQuery($query); + if (!$rs) { + ShowMsg('保存数据库信息失败,无法完成安装!' . $dsql->GetError(), 'javascript:;'); + exit(); + } + + $dm->WriteFiles($hash, $isreplace); + $filename = ''; + if (!isset($autosetup) || $autosetup == 0) $filename = $dm->WriteSystemFile($hash, 'setup'); + if (!isset($autodel) || $autodel == 0) $dm->WriteSystemFile($hash, 'uninstall'); + $dm->WriteSystemFile($hash, 'readme'); + $dm->Clear(); - $dm->WriteFiles($hash,$isreplace); - $filename = ''; - if(!isset($autosetup) || $autosetup==0) $filename = $dm->WriteSystemFile($hash, 'setup'); - if(!isset($autodel) || $autodel==0) $dm->WriteSystemFile($hash, 'uninstall'); - $dm->WriteSystemFile($hash,'readme'); - $dm->Clear(); - - //用模块的安装程序安装 - if(!isset($autosetup) || $autosetup==0) - { - include(DEDEDATA.'/module/'.$filename); - exit(); + //用模块的安装程序安装 + if (!isset($autosetup) || $autosetup == 0) { + include(DEDEDATA . '/module/' . $filename); + exit(); + } + //系统自动安装 + else { + $mysql_version = $dsql->GetVersion(TRUE); + //默认使用MySQL 4.1 以下版本的SQL语句,对大于4.1版本采用替换处理 TYPE=MyISAM ==> ENGINE=MyISAM DEFAULT CHARSET=#~lang~# + $setupsql = $dm->GetSystemFile($hash, 'setupsql40'); + + $setupsql = preg_replace("#ENGINE=MyISAM#i", 'TYPE=MyISAM', $setupsql); + $sql41tmp = 'ENGINE=MyISAM DEFAULT CHARSET=' . $cfg_db_language; + + if ($mysql_version >= 4.1) { + $setupsql = preg_replace("#TYPE=MyISAM#i", $sql41tmp, $setupsql); } - //系统自动安装 - else - { - $mysql_version = $dsql->GetVersion(TRUE); - //默认使用MySQL 4.1 以下版本的SQL语句,对大于4.1版本采用替换处理 TYPE=MyISAM ==> ENGINE=MyISAM DEFAULT CHARSET=#~lang~# - $setupsql = $dm->GetSystemFile($hash, 'setupsql40'); - - $setupsql = preg_replace("#ENGINE=MyISAM#i", 'TYPE=MyISAM', $setupsql); - $sql41tmp = 'ENGINE=MyISAM DEFAULT CHARSET='.$cfg_db_language; - - if($mysql_version >= 4.1) - { - $setupsql = preg_replace("#TYPE=MyISAM#i", $sql41tmp, $setupsql); - } - - //_ROOTURL_ - if($cfg_cmspath=='/') $cfg_cmspath = ''; - - $rooturl = $cfg_basehost.$cfg_cmspath; - - $setupsql = preg_replace("#_ROOTURL_#i", $rooturl, $setupsql); - $setupsql = preg_replace("#[\r\n]{1,}#", "\n", $setupsql); - - $sqls = @split(";[ \t]{0,}\n", $setupsql); - foreach($sqls as $sql) - { - if(trim($sql)!='') $dsql->ExecuteNoneQuery($sql); - } - - ReWriteConfigAuto(); - - $rflwft = ""; - echo $rflwft; - - UpDateCatCache(); - SendData($hash); - ShowMsg('模块安装完成...', 'module_main.php'); - exit(); + + //_ROOTURL_ + if ($cfg_cmspath == '/') $cfg_cmspath = ''; + + $rooturl = $cfg_basehost . $cfg_cmspath; + + $setupsql = preg_replace("#_ROOTURL_#i", $rooturl, $setupsql); + $setupsql = preg_replace("#[\r\n]{1,}#", "\n", $setupsql); + + $sqls = @split(";[ \t]{0,}\n", $setupsql); + foreach ($sqls as $sql) { + if (trim($sql) != '') $dsql->ExecuteNoneQuery($sql); } + + ReWriteConfigAuto(); + + $rflwft = ""; + echo $rflwft; + + UpDateCatCache(); + ShowMsg('模块安装完成...', 'module_main.php'); + exit(); + } } /*-------------- function DelModule(); ---------------*/ -else if($action=='del') -{ - $dm = new DedeModule($mdir); - $infos = $dm->GetModuleInfo($hash); - - $alertMsg = ($infos['lang']==$cfg_soft_lang ? '' : '
(这个模块的语言编码与你系统的编码不一致,请向开发者确认它的兼容性)'); - - $win = new OxWindow(); - $win->Init("module_main.php", "js/blank.js", "post"); - $wecome_info = "模块管理"; - $win->AddTitle("模块管理 >> 删除模块: {$infos['name']}"); - $win->AddHidden('hash', $hash); - $win->AddHidden('action', 'delok'); - $msg = " +--------------*/ else if ($action == 'del') { + $dm = new DedeModule($mdir); + $infos = $dm->GetModuleInfo($hash); + + $alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '
(这个模块的语言编码与你系统的编码不一致,请向开发者确认它的兼容性)'); + + $win = new OxWindow(); + $win->Init("module_main.php", "js/blank.js", "post"); + $wecome_info = "模块管理"; + $win->AddTitle("模块管理 >> 删除模块: {$infos['name']}"); + $win->AddHidden('hash', $hash); + $win->AddHidden('action', 'delok'); + $msg = " @@ -399,47 +349,42 @@ else if($action=='del')
模块名称:
"; - $win->AddMsgItem("
$msg
"); - $winform = $win->GetWindow("ok",""); - $win->Display(); - $dm->Clear(); - exit(); -} -else if($action=='delok') -{ - $dm = new DedeModule($mdir); - $modfile = $mdir."/".$dm->GetHashFile($hash); - unlink($modfile) or die("删除文件 {$modfile} 失败!"); - ShowMsg("成功删除一个模块文件!","module_main.php"); - exit(); + $win->AddMsgItem("
$msg
"); + $winform = $win->GetWindow("ok", ""); + $win->Display(); + $dm->Clear(); + exit(); +} else if ($action == 'delok') { + $dm = new DedeModule($mdir); + $modfile = $mdir . "/" . $dm->GetHashFile($hash); + unlink($modfile) or die("删除文件 {$modfile} 失败!"); + ShowMsg("成功删除一个模块文件!", "module_main.php"); + exit(); } /*-------------- function UnInstall(); ---------------*/ -else if($action=='uninstall') -{ - $dm = new DedeModule($mdir); - $infos = $dm->GetModuleInfo($hash); - - if($infos['url']=='') $infos['url'] = ' '; - $alertMsg = ($infos['lang']==$cfg_soft_lang ? '' : '
(这个模块的语言编码与你系统的编码不一致,请向开发者确认它的兼容性)'); - - $filelists = $dm->GetFileLists($hash); - $filelist = ''; - foreach($filelists as $v) - { - if(empty($v['name'])) continue; - if($v['type']=='dir') $v['type'] = '目录'; - else $v['type'] = '文件'; - $filelist .= "{$v['type']}|{$v['name']}\r\n"; - } - $win = new OxWindow(); - $win->Init("module_main.php", "js/blank.js", "post"); - $wecome_info = "模块管理"; - $win->AddTitle("模块管理 >> 卸载模块: {$infos['name']}"); - $win->AddHidden("hash",$hash); - $win->AddHidden("action",'uninstallok'); - $msg = " +--------------*/ else if ($action == 'uninstall') { + $dm = new DedeModule($mdir); + $infos = $dm->GetModuleInfo($hash); + + if ($infos['url'] == '') $infos['url'] = ' '; + $alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '
(这个模块的语言编码与你系统的编码不一致,请向开发者确认它的兼容性)'); + + $filelists = $dm->GetFileLists($hash); + $filelist = ''; + foreach ($filelists as $v) { + if (empty($v['name'])) continue; + if ($v['type'] == 'dir') $v['type'] = '目录'; + else $v['type'] = '文件'; + $filelist .= "{$v['type']}|{$v['name']}\r\n"; + } + $win = new OxWindow(); + $win->Init("module_main.php", "js/blank.js", "post"); + $wecome_info = "模块管理"; + $win->AddTitle("模块管理 >> 卸载模块: {$infos['name']}"); + $win->AddHidden("hash", $hash); + $win->AddHidden("action", 'uninstallok'); + $msg = " @@ -484,112 +429,97 @@ else if($action=='uninstall')
模块名称:
"; - $win->AddMsgItem("
$msg
"); - $winform = $win->GetWindow("ok",""); - $win->Display(); - $dm->Clear(); - exit(); + $win->AddMsgItem("
$msg
"); + $winform = $win->GetWindow("ok", ""); + $win->Display(); + $dm->Clear(); + exit(); } /*-------------- function UnInstallRun(); ---------------*/ -else if($action=='uninstallok') -{ - $dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_module` WHERE hashcode LIKE '$hash' "); - $dm = new DedeModule($mdir); +--------------*/ else if ($action == 'uninstallok') { + $dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_module` WHERE hashcode LIKE '$hash' "); + $dm = new DedeModule($mdir); - $minfos = $dm->GetModuleInfo($hash); - extract($minfos, EXTR_SKIP); + $minfos = $dm->GetModuleInfo($hash); + extract($minfos, EXTR_SKIP); - if(!isset($moduletype) || $moduletype != 'patch' ) - { - $dm->DeleteFiles($hash, $isreplace); - } - @$dm->DelSystemFile($hash, 'readme'); - @$dm->DelSystemFile($hash, 'setup'); - $dm->Clear(); - if(!isset($autodel) || $autodel==0) - { - include(DEDEDATA."/module/{$hash}-uninstall.php"); - @unlink(DEDEDATA."/module/{$hash}-uninstall.php"); - exit(); - } - else - { - @$dm->DelSystemFile($hash, 'uninstall'); - $delsql = $dm->GetSystemFile($hash, 'delsql'); - if(trim($delsql)!='') - { - $sqls = explode(';', $delsql); - foreach($sqls as $sql) - { - if(trim($sql)!='') $dsql->ExecuteNoneQuery($sql); - } - } - - ReWriteConfigAuto(); - - $rflwft = ""; - echo $rflwft; - SendData($hash,2); - ShowMsg('模块卸载完成...','module_main.php'); - exit(); + if (!isset($moduletype) || $moduletype != 'patch') { + $dm->DeleteFiles($hash, $isreplace); + } + @$dm->DelSystemFile($hash, 'readme'); + @$dm->DelSystemFile($hash, 'setup'); + $dm->Clear(); + if (!isset($autodel) || $autodel == 0) { + include(DEDEDATA . "/module/{$hash}-uninstall.php"); + @unlink(DEDEDATA . "/module/{$hash}-uninstall.php"); + exit(); + } else { + @$dm->DelSystemFile($hash, 'uninstall'); + $delsql = $dm->GetSystemFile($hash, 'delsql'); + if (trim($delsql) != '') { + $sqls = explode(';', $delsql); + foreach ($sqls as $sql) { + if (trim($sql) != '') $dsql->ExecuteNoneQuery($sql); + } } + + ReWriteConfigAuto(); + + $rflwft = ""; + echo $rflwft; + ShowMsg('模块卸载完成...', 'module_main.php'); + exit(); + } } /*-------------- function ShowReadme(); ---------------*/ -else if($action=='showreadme') -{ - $dm = new DedeModule($mdir); - $msg = $dm->GetSystemFile($hash,'readme'); - $msg = preg_replace("/(.*)(.*)/isU","",$msg); - $dm->Clear(); - $win = new OxWindow(); - $win->Init("module_main.php","js/blank.js","post"); - $wecome_info = "模块管理"; - $win->AddTitle("模块管理 >> 使用说明:"); - $win->AddMsgItem("
$msg
"); - $winform = $win->GetWindow("hand"); - $win->Display(); - exit(); +--------------*/ else if ($action == 'showreadme') { + $dm = new DedeModule($mdir); + $msg = $dm->GetSystemFile($hash, 'readme'); + $msg = preg_replace("/(.*)(.*)/isU", "", $msg); + $dm->Clear(); + $win = new OxWindow(); + $win->Init("module_main.php", "js/blank.js", "post"); + $wecome_info = "模块管理"; + $win->AddTitle("模块管理 >> 使用说明:"); + $win->AddMsgItem("
$msg
"); + $winform = $win->GetWindow("hand"); + $win->Display(); + exit(); } /*-------------- function ViewOne(); ---------------*/ -else if($action=='view') -{ - $dm = new DedeModule($mdir); - $infos = $dm->GetModuleInfo($hash); - - if($infos['url']=='') $infos['url'] = ' '; - $alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '
(这个模块的语言编码与你系统的编码不一致,请向开发者确认它的兼容性)'); - - $filelists = $dm->GetFileLists($hash); - $filelist = ''; - $setupinfo = ''; - foreach($filelists as $v) - { - if(empty($v['name'])) continue; - if($v['type']=='dir') $v['type'] = '目录'; - else $v['type'] = '文件'; - $filelist .= "{$v['type']}|{$v['name']}\r\n"; - } - if(file_exists(DEDEDATA."/module/{$hash}-readme.php")) - { - $setupinfo = "已安装 卸载"; - } else { - $setupinfo = "未安装 安装"; - } - $win = new OxWindow(); - $win->Init("", "js/blank.js",""); - $wecome_info = "模块管理"; - $win->AddTitle("模块管理 >> 模块详情: {$infos['name']}"); - $msg = " +--------------*/ else if ($action == 'view') { + $dm = new DedeModule($mdir); + $infos = $dm->GetModuleInfo($hash); + + if ($infos['url'] == '') $infos['url'] = ' '; + $alertMsg = ($infos['lang'] == $cfg_soft_lang ? '' : '
(这个模块的语言编码与你系统的编码不一致,请向开发者确认它的兼容性)'); + + $filelists = $dm->GetFileLists($hash); + $filelist = ''; + $setupinfo = ''; + foreach ($filelists as $v) { + if (empty($v['name'])) continue; + if ($v['type'] == 'dir') $v['type'] = '目录'; + else $v['type'] = '文件'; + $filelist .= "{$v['type']}|{$v['name']}\r\n"; + } + if (file_exists(DEDEDATA . "/module/{$hash}-readme.php")) { + $setupinfo = "已安装 卸载"; + } else { + $setupinfo = "未安装 安装"; + } + $win = new OxWindow(); + $win->Init("", "js/blank.js", ""); + $wecome_info = "模块管理"; + $win->AddTitle("模块管理 >> 模块详情: {$infos['name']}"); + $msg = " @@ -625,40 +555,36 @@ else if($action=='view')
模块名称:
"; - $win->AddMsgItem("
$msg
"); - $winform = $win->GetWindow('hand', ''); - $win->Display(); - $dm->Clear(); - exit(); + $win->AddMsgItem("
$msg
"); + $winform = $win->GetWindow('hand', ''); + $win->Display(); + $dm->Clear(); + exit(); } /*-------------- function Edit(); ---------------*/ -else if($action=='edit') -{ - $dm = new DedeModule($mdir); +--------------*/ else if ($action == 'edit') { + $dm = new DedeModule($mdir); - $minfos = $dm->GetModuleInfo($hash); - extract($minfos, EXTR_SKIP); + $minfos = $dm->GetModuleInfo($hash); + extract($minfos, EXTR_SKIP); - if(!isset($lang)) $lang = 'gb2312'; - if(!isset($moduletype)) $moduletype = 'soft'; + if (!isset($lang)) $lang = 'gb2312'; + if (!isset($moduletype)) $moduletype = 'soft'; - $menustring = $dm->GetSystemFile($hash, 'menustring'); - $setupsql40 = dede_htmlspecialchars($dm->GetSystemFile($hash, 'setupsql40')); - $readmetxt = $dm->GetSystemFile($hash, 'readme'); - $delsql = $dm->GetSystemFile($hash, 'delsql'); - $filelist = $dm->GetSystemFile($hash,'oldfilelist',false); - $indexurl = str_replace('**', '=', $indexurl); - $dm->Clear(); - - require_once(dirname(__FILE__).'/templets/module_edit.htm'); - exit(); + $menustring = $dm->GetSystemFile($hash, 'menustring'); + $setupsql40 = dede_htmlspecialchars($dm->GetSystemFile($hash, 'setupsql40')); + $readmetxt = $dm->GetSystemFile($hash, 'readme'); + $delsql = $dm->GetSystemFile($hash, 'delsql'); + $filelist = $dm->GetSystemFile($hash, 'oldfilelist', false); + $indexurl = str_replace('**', '=', $indexurl); + $dm->Clear(); + + require_once(dirname(__FILE__) . '/templets/module_edit.htm'); + exit(); } /*-------------- function Download(); ---------------*/ -else if($action=='download') -{ +--------------*/ else if ($action == 'download') { ShowMsg("暂不支持模块下载功能", "javascript:;"); -} \ No newline at end of file +} diff --git a/src/dede/module_make.php b/src/dede/module_make.php index 2c7d75e2..d5a4d4c5 100755 --- a/src/dede/module_make.php +++ b/src/dede/module_make.php @@ -4,7 +4,7 @@ * 生成模块 * * @version $Id: module_make.php 1 14:17 2010年7月20日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/dede/module_upload.php b/src/dede/module_upload.php index 15135366..7a1b4a6f 100755 --- a/src/dede/module_upload.php +++ b/src/dede/module_upload.php @@ -1,91 +1,79 @@ get_List($tmpfilename); $dedefileindex = -1; //为了节省资源,系统仅以.xml作为扩展名识别ZIP包里了dede模块格式文件 - if(is_array($files)) - { - for($i=0; $i
>>返回重新上传>>","javascript:;"); + ShowMsg("对不起,你上传的压缩包中不存在dede模块文件!

>>返回重新上传>>", "javascript:;"); exit(); } - $ziptmp = $mdir.'/ziptmp'; + $ziptmp = $mdir . '/ziptmp'; $z->Extract($tmpfilename, $ziptmp, $dedefileindex); unlink($tmpfilename); - $tmpfilename = $mdir."/ziptmp/".$dedefile; + $tmpfilename = $mdir . "/ziptmp/" . $dedefile; } $dm = new DedeModule($mdir); - $infos = $dm->GetModuleInfo($tmpfilename,'file'); - if(empty($infos['hash'])) - { + $infos = $dm->GetModuleInfo($tmpfilename, 'file'); + if (empty($infos['hash'])) { unlink($tmpfilename); $dm->Clear(); - ShowMsg("对不起,你上传的文件可能不是织梦模块的标准格式文件!

>>返回重新上传>>","javascript:;"); + ShowMsg("对不起,你上传的文件可能不是织梦模块的标准格式文件!

>>返回重新上传>>", "javascript:;"); exit(); } - $okfile = $mdir.'/'.$infos['hash'].'.xml'; - if($dm->HasModule($infos['hash']) && empty($delhas)) - { + $okfile = $mdir . '/' . $infos['hash'] . '.xml'; + if ($dm->HasModule($infos['hash']) && empty($delhas)) { unlink($tmpfilename); $dm->Clear(); - ShowMsg("对不起,你上传的模块已经存在,
如果要覆盖请先删除原来版本或选择强制删除的选项!

>>返回重新上传>>","javascript:;"); + ShowMsg("对不起,你上传的模块已经存在,
如果要覆盖请先删除原来版本或选择强制删除的选项!

>>返回重新上传>>", "javascript:;"); exit(); } @unlink($okfile); - copy($tmpfilename,$okfile); + copy($tmpfilename, $okfile); @unlink($tmpfilename); $dm->Clear(); - ShowMsg("成功上传一个新的模块!","module_main.php?action=view&hash={$infos['hash']}"); + ShowMsg("成功上传一个新的模块!", "module_main.php?action=view&hash={$infos['hash']}"); exit(); } -} -else -{ +} else { $win = new OxWindow(); $win->Init("module_upload.php", "js/blank.js", "POST' enctype='multipart/form-data"); $win->mainTitle = "模块管理"; diff --git a/src/dede/mychannel_add.php b/src/dede/mychannel_add.php index 1794fc45..824f77c5 100755 --- a/src/dede/mychannel_add.php +++ b/src/dede/mychannel_add.php @@ -1,61 +1,54 @@ '频道id'必须为数字!","-1"); + if (empty($id) || preg_match("#[^0-9-]#", $id)) { + ShowMsg("'频道id'必须为数字!", "-1"); exit(); } - if(preg_match("#[^a-z0-9]#i", $nid) || $nid == "") - { - ShowMsg("'频道名字标识'必须为英文字母或与数字混合字符串!","-1"); + if (preg_match("#[^a-z0-9]#i", $nid) || $nid == "") { + ShowMsg("'频道名字标识'必须为英文字母或与数字混合字符串!", "-1"); exit(); } - if($addtable == "") - { - ShowMsg("附加表不能为空!","-1"); + if ($addtable == "") { + ShowMsg("附加表不能为空!", "-1"); exit(); } - $trueTable2 = str_replace("#@__",$cfg_dbprefix,$addtable); + $trueTable2 = str_replace("#@__", $cfg_dbprefix, $addtable); - if($issystem == -1 && $id>0) $id = $id * -1; + if ($issystem == -1 && $id > 0) $id = $id * -1; //检查id是否重复 $row = $dsql->GetOne("SELECT * FROM #@__channeltype WHERE id='$id' OR nid LIKE '$nid' OR addtable LIKE '$addtable'"); - if(is_array($row)) - { - ShowMsg("可能‘频道id’、‘频道名称标识’、‘附加表名称’在数据库已存在,不能重复使用!","-1"); + if (is_array($row)) { + ShowMsg("可能‘频道id’、‘频道名称标识’、‘附加表名称’在数据库已存在,不能重复使用!", "-1"); exit(); } $mysql_version = $dsql->GetVersion(); //创建附加表 - if($trueTable2!='') - { + if ($trueTable2 != '') { $istb = $dsql->IsTable($trueTable2); - if(!$istb || $isdel==1) - { + if (!$istb || $isdel == 1) { //是否需要摘要字段 $dsql->ExecuteNoneQuery("DROP TABLE IF EXISTS `{$trueTable2}`;"); - if($issystem != -1) - { + if ($issystem != -1) { $tabsql = "CREATE TABLE `$trueTable2`( `aid` int(11) NOT NULL default '0', `typeid` int(11) NOT NULL default '0', @@ -63,10 +56,8 @@ if($action=='add') `templet` varchar(30) NOT NULL default '', `userip` char(15) NOT NULL default '', "; - } - else - { - $tabsql = "CREATE TABLE `$trueTable2`( + } else { + $tabsql = "CREATE TABLE `$trueTable2`( `aid` int(11) NOT NULL default '0', `typeid` int(11) NOT NULL default '0', `channel` SMALLINT NOT NULL DEFAULT '0', @@ -84,26 +75,21 @@ if($action=='add') `badpost` MEDIUMINT( 8 ) UNSIGNED NOT NULL DEFAULT '0', "; } - if($mysql_version < 4.1) - { + if ($mysql_version < 4.1) { $tabsql .= " PRIMARY KEY (`aid`), KEY `typeid` (`typeid`)\r\n) TYPE=MyISAM; "; - } - else - { - $tabsql .= " PRIMARY KEY (`aid`), KEY `typeid` (`typeid`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; "; + } else { + $tabsql .= " PRIMARY KEY (`aid`), KEY `typeid` (`typeid`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=" . $cfg_db_language . "; "; } $rs = $dsql->ExecuteNoneQuery($tabsql); - if(!$rs) - { - ShowMsg("创建附加表失败!".$dsql->GetError(),"javascript:;"); + if (!$rs) { + ShowMsg("创建附加表失败!" . $dsql->GetError(), "javascript:;"); exit(); } } } $listfields = $fieldset = ''; - if($issystem == -1) - { + if ($issystem == -1) { $fieldset = " @@ -123,11 +109,11 @@ if($action=='add') $inQuery = "INSERT INTO `#@__channeltype`(id,nid,typename,addtable,addcon,mancon,editcon,useraddcon,usermancon,usereditcon,fieldset,listfields,issystem,issend,arcsta,usertype,sendrank,needdes,needpic,titlename,onlyone,dfcid) VALUES ('$id','$nid','$typename','$addtable','$addcon','$mancon','$editcon','$useraddcon','$usermancon','$usereditcon','$fieldset','$listfields','$issystem','$issend','$arcsta','$usertype','$sendrank','$needdes','$needpic','$titlename','$onlyone','$dfcid');"; $dsql->ExecuteNoneQuery($inQuery); - ShowMsg("成功增加一个频道模型!", "mychannel_edit.php?id=".$id); + ShowMsg("成功增加一个频道模型!", "mychannel_edit.php?id=" . $id); exit(); } $row = $dsql->GetOne("SELECT id FROM `#@__channeltype` ORDER BY id DESC LIMIT 0,1 "); $newid = $row['id'] + 1; -if($newid < 10) $newid = $newid+10; +if ($newid < 10) $newid = $newid + 10; -require_once(DEDEADMIN."/templets/mychannel_add.htm"); \ No newline at end of file +require_once(DEDEADMIN . "/templets/mychannel_add.htm"); diff --git a/src/dede/mychannel_edit.php b/src/dede/mychannel_edit.php index df4e35dc..15eb4fe4 100755 --- a/src/dede/mychannel_edit.php +++ b/src/dede/mychannel_edit.php @@ -1,71 +1,63 @@ ExecuteNoneQuery("UPDATE `#@__channeltype` SET isshow=1 WHERE id='$id' "); ShowMsg("操作成功!", "mychannel_main.php"); exit(); -} -else if($dopost=="hide") -{ +} else if ($dopost == "hide") { $dsql->ExecuteNoneQuery("UPDATE `#@__channeltype` SET isshow=0 WHERE id='$id'"); ShowMsg("操作成功!", "mychannel_main.php"); exit(); } /*---------------- function __CopyStart() ------------------*/ -else if($dopost=="copystart") -{ - if($id==-1) - { - ShowMsg("专题模型不支持复制!","-1"); +-----------------*/ else if ($dopost == "copystart") { + if ($id == -1) { + ShowMsg("专题模型不支持复制!", "-1"); exit(); } $row = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='$id'"); - if($row['id'] > -1) - { + if ($row['id'] > -1) { $nrow = $dsql->GetOne("SELECT MAX(id) AS id FROM `#@__channeltype` LIMIT 0,1 "); $newid = $nrow['id'] + 1; - if($newid < 10) - { + if ($newid < 10) { $newid = $newid + 10; } $idname = $newid; } else { $nrow = $dsql->GetOne("SELECT MIN(id) AS id FROM `#@__channeltype` LIMIT 0,1 "); $newid = $nrow['id'] - 1; - if($newid < -10) - { + if ($newid < -10) { $newid = $newid - 10; } - $idname = 'w'.($newid * -1); + $idname = 'w' . ($newid * -1); } $row = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='$id'"); $wintitle = "频道管理-模型复制"; $wecome_info = " 频道管理 - 模型复制"; $win = new OxWindow(); $win->Init("mychannel_edit.php", "js/blank.js", "post"); - $win->AddTitle(" 被复制频道: [".$row['typename']."]"); + $win->AddTitle(" 被复制频道: [" . $row['typename'] . "]"); $win->AddHidden("cid", $id); $win->AddHidden("id", $id); $win->AddHidden("dopost", 'copysave'); @@ -104,21 +96,17 @@ else if($dopost=="copystart") } /*---------------- function __Export() ------------------*/ -else if($dopost=="export") -{ - if($id==-1) - { - ShowMsg("专题模型不支持导出!","-1"); +-----------------*/ else if ($dopost == "export") { + if ($id == -1) { + ShowMsg("专题模型不支持导出!", "-1"); exit(); } $row = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='$id' "); $channelconfig = ''; $row['maintable'] = preg_replace('#dede_#', '#@__', $row['maintable']); $row['addtable'] = preg_replace('#dede_#', '#@__', $row['addtable']); - foreach($row as $k=>$v) - { - if($k=='fieldset') $v = "\r\n$v\r\n"; + foreach ($row as $k => $v) { + if ($k == 'fieldset') $v = "\r\n$v\r\n"; $channelconfig .= "$v\r\n"; } $wintitle = "导出内容模型规则"; @@ -126,15 +114,13 @@ else if($dopost=="export") $win = new OxWindow(); $win->Init(); $win->AddTitle("以下为规则 [{$row['typename']}] 的模型规则,你可以共享给你的朋友:"); - $winform = $win->GetWindow("hand", ""); + $winform = $win->GetWindow("hand", ""); $win->Display(); exit(); } /*---------------- function __ExportIn() ------------------*/ -else if($dopost=="exportin") -{ +-----------------*/ else if ($dopost == "exportin") { $wintitle = "导入内容模型规则"; $wecome_info = "内容模型管理::导入内容模型规则"; $win = new OxWindow(); @@ -148,13 +134,11 @@ else if($dopost=="exportin") } /*---------------- function __ExportInOk() ------------------*/ -else if($dopost=="exportinok") -{ - require_once(DEDEADMIN."/inc/inc_admin_channel.php"); +-----------------*/ else if ($dopost == "exportinok") { + require_once(DEDEADMIN . "/inc/inc_admin_channel.php"); function GotoStaMsg($msg) { - global $wintitle,$wecome_info,$winform; + global $wintitle, $wecome_info, $winform; $wintitle = "导入内容模型规则"; $wecome_info = "内容模型管理::导入内容模型规则"; $win = new OxWindow(); @@ -173,17 +157,15 @@ else if($dopost=="exportinok") $dtp->SetNameSpace('channel', '<', '>'); $dtp->LoadSource($exconfig); - if(!is_array($dtp->CTags)) GotoStaMsg("模型规则不是合法的Dede模型规则!"); + if (!is_array($dtp->CTags)) GotoStaMsg("模型规则不是合法的Dede模型规则!"); $fields = array(); - foreach($dtp->CTags as $ctag) - { + foreach ($dtp->CTags as $ctag) { $fname = $ctag->GetName('name'); $fields[$fname] = trim($ctag->GetInnerText()); } - if(!isset($fields['nid']) || !isset($fields['fieldset'])) - { + if (!isset($fields['nid']) || !isset($fields['fieldset'])) { GotoStaMsg("模型规则不是合法的Dede模型规则!"); } @@ -191,23 +173,19 @@ else if($dopost=="exportinok") $mysql_version = $dsql->GetVersion(true); $row = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE nid='{$fields['nid']}' "); - if(is_array($row)) - { + if (is_array($row)) { GotoStaMsg("系统中已经存在相同标识 {$fields['nid']} 的规则!"); } //创建表 - if($fields['issystem'] != -1) - { + if ($fields['issystem'] != -1) { $tabsql = "CREATE TABLE IF NOT EXISTS `{$fields['addtable']}`( `aid` int(11) NOT NULL default '0', `typeid` int(11) NOT NULL default '0', `redirecturl` varchar(255) NOT NULL default '', `templet` varchar(30) NOT NULL default '', `userip` char(15) NOT NULL default '',"; - } - else - { + } else { $tabsql = "CREATE TABLE IF NOT EXISTS `{$fields['addtable']}`( `aid` int(11) NOT NULL default '0', `typeid` int(11) NOT NULL default '0', @@ -219,29 +197,22 @@ else if($dopost=="exportinok") `senddate` int(11) NOT NULL default '0', `flag` set('c','h','p','f','s','j','a','b') default NULL,"; } - if($mysql_version < 4.1) - { + if ($mysql_version < 4.1) { $tabsql .= " PRIMARY KEY (`aid`), KEY `typeid` (`typeid`)\r\n) TYPE=MyISAM; "; - } - else - { - $tabsql .= " PRIMARY KEY (`aid`), KEY `typeid` (`typeid`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; "; + } else { + $tabsql .= " PRIMARY KEY (`aid`), KEY `typeid` (`typeid`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=" . $cfg_db_language . "; "; } $rs = $dsql->ExecuteNoneQuery($tabsql); - if(!$rs) - { - GotoStaMsg("创建表失败!".$dsql->GetError()); + if (!$rs) { + GotoStaMsg("创建表失败!" . $dsql->GetError()); exit(); } - if($fields['issystem']==1) $fields['issystem'] = 0; - if($fields['issystem'] == 0) - { + if ($fields['issystem'] == 1) $fields['issystem'] = 0; + if ($fields['issystem'] == 0) { $row = $dsql->GetOne("SELECT id FROM `#@__channeltype` ORDER BY id DESC "); $fields['newid'] = $row['id'] + 1; - } - else - { + } else { $row = $dsql->GetOne("SELECT id FROM `#@__channeltype` ORDER BY id ASC "); $fields['newid'] = $row['id'] - 1; } @@ -260,47 +231,40 @@ else if($dopost=="exportinok") $rs = $dsql->ExecuteNoneQuery($inquery); - if(!$rs) GotoStaMsg("导入模型时发生错误!".$dsql->GetError()); + if (!$rs) GotoStaMsg("导入模型时发生错误!" . $dsql->GetError()); $dtp = new DedeTagParse(); - $dtp->SetNameSpace("field","<",">"); + $dtp->SetNameSpace("field", "<", ">"); $dtp->LoadSource($fieldset); $allfields = ''; - if(is_array($dtp->CTags)) - { - foreach($dtp->CTags as $ctag) - { + if (is_array($dtp->CTags)) { + foreach ($dtp->CTags as $ctag) { //检测被修改的字段类型 $dtype = $ctag->GetAtt('type'); $fieldname = $ctag->GetName(); $dfvalue = $ctag->GetAtt('default'); $islist = $ctag->GetAtt('islist'); $mxlen = $ctag->GetAtt('maxlength'); - $fieldinfos = GetFieldMake($dtype,$fieldname,$dfvalue,$mxlen); + $fieldinfos = GetFieldMake($dtype, $fieldname, $dfvalue, $mxlen); $ntabsql = $fieldinfos[0]; $buideType = $fieldinfos[1]; - if($islist!='') - { - $allfields .= ($allfields=='' ? $fieldname : ','.$fieldname); + if ($islist != '') { + $allfields .= ($allfields == '' ? $fieldname : ',' . $fieldname); } $dsql->ExecuteNoneQuery(" ALTER TABLE `{$fields['addtable']}` ADD $ntabsql "); } } - if($allfields!='') - { + if ($allfields != '') { $dsql->ExecuteNoneQuery("UPDATE `#@__channeltype` SET listfields='$allfields' WHERE id='{$fields['newid']}' "); } GotoStaMsg("成功导入一个模型!"); } /*---------------- function __SaveCopy() ------------------*/ -else if($dopost=="copysave") -{ +-----------------*/ else if ($dopost == "copysave") { $cid = intval($cid); $row = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='$cid' ", MYSQL_ASSOC); - foreach($row as $k=>$v) - { + foreach ($row as $k => $v) { ${strtolower($k)} = addslashes($v); } $inquery = " INSERT INTO `#@__channeltype`(`id` , `nid` , `typename` , `addtable` , `addcon` , @@ -311,42 +275,35 @@ else if($dopost=="copysave") '$issystem' , '$isshow' , '$issend' , '$arcsta','$usertype' , '$sendrank' ); "; $mysql_version = $dsql->GetVersion(TRUE); - if(!$dsql->IsTable($newaddtable)) - { + if (!$dsql->IsTable($newaddtable)) { $dsql->Execute('me', "SHOW CREATE TABLE {$dsql->dbName}.{$addtable}"); $row = $dsql->GetArray('me', MYSQL_BOTH); $tableStruct = $row[1]; $tb = str_replace('#@__', $cfg_dbprefix, $addtable); - $tableStruct = preg_replace("/CREATE TABLE `$addtable`/iU","CREATE TABLE `$newaddtable`",$tableStruct); + $tableStruct = preg_replace("/CREATE TABLE `$addtable`/iU", "CREATE TABLE `$newaddtable`", $tableStruct); $dsql->ExecuteNoneQuery($tableStruct); } - if($copytemplet==1) - { - $tmpletdir = $cfg_basedir.$cfg_templets_dir.'/'.$cfg_df_style; - copy("{$tmpletdir}/article_{$nid}.htm","{$tmpletdir}/{$newnid}_article.htm"); - copy("{$tmpletdir}/list_{$nid}.htm","{$tmpletdir}/{$newnid}_list.htm"); - copy("{$tmpletdir}/index_{$nid}.htm","{$tmpletdir}/{$newnid}_index.htm"); + if ($copytemplet == 1) { + $tmpletdir = $cfg_basedir . $cfg_templets_dir . '/' . $cfg_df_style; + copy("{$tmpletdir}/article_{$nid}.htm", "{$tmpletdir}/{$newnid}_article.htm"); + copy("{$tmpletdir}/list_{$nid}.htm", "{$tmpletdir}/{$newnid}_list.htm"); + copy("{$tmpletdir}/index_{$nid}.htm", "{$tmpletdir}/{$newnid}_index.htm"); } $rs = $dsql->ExecuteNoneQuery($inquery); - if($rs) - { - ShowMsg("成功复制模型,现转到详细参数页... ","mychannel_edit.php?id={$newid}&dopost=edit"); + if ($rs) { + ShowMsg("成功复制模型,现转到详细参数页... ", "mychannel_edit.php?id={$newid}&dopost=edit"); exit(); - } - else - { + } else { $errv = $dsql->GetError(); - ShowMsg("系统出错,请把错误代码发送到官方论坛,以检查原因!
错误代码:mychannel_edit.php?dopost=savecopy $errv","javascript:;"); + ShowMsg("系统出错,请把错误代码发送到官方论坛,以检查原因!
错误代码:mychannel_edit.php?dopost=savecopy $errv", "javascript:;"); exit(); } } /*------------ function __SaveEdit() -------------*/ -else if($dopost=="save") -{ +------------*/ else if ($dopost == "save") { $fieldset = preg_replace("#[\r\n]{1,}#", "\r\n", $fieldset); - $usertype = empty($usertype)? '' : $usertype; + $usertype = empty($usertype) ? '' : $usertype; $query = "Update `#@__channeltype` set typename = '$typename', @@ -369,40 +326,35 @@ else if($dopost=="save") onlyone = '$onlyone', dfcid = '$dfcid' where id='$id' "; - if(trim($fieldset)!='') - { + if (trim($fieldset) != '') { $dtp = new DedeTagParse(); $dtp->SetNameSpace("field", "<", ">"); $dtp->LoadSource(stripslashes($fieldset)); - if(!is_array($dtp->CTags)) - { - ShowMsg("文本配置参数无效,无法进行解析!","-1"); + if (!is_array($dtp->CTags)) { + ShowMsg("文本配置参数无效,无法进行解析!", "-1"); exit(); } } $trueTable = str_replace("#@__", $cfg_dbprefix, $addtable); - if(!$dsql->IsTable($trueTable)) - { - ShowMsg("系统找不到你所指定的表 $trueTable ,请手工创建这个表!","-1"); + if (!$dsql->IsTable($trueTable)) { + ShowMsg("系统找不到你所指定的表 $trueTable ,请手工创建这个表!", "-1"); exit(); } $dsql->ExecuteNoneQuery($query); - ShowMsg("成功更改一个模型!","mychannel_main.php"); + ShowMsg("成功更改一个模型!", "mychannel_main.php"); exit(); } /*-------------------- function __GetTemplate() ---------------------*/ -else if($dopost=="gettemplets") -{ - require_once(DEDEINC."/oxwindow.class.php"); +--------------------*/ else if ($dopost == "gettemplets") { + require_once(DEDEINC . "/oxwindow.class.php"); $row = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='$id'"); $wintitle = " 频道管理-查看模板"; $wecome_info = "频道管理::查看模板"; $win = new OxWindow(); $win->Init("", "js/blank.js", ""); - $win->AddTitle(" 频道:(".$row['typename'].")默认模板文件说明:"); - $defaulttemplate = $cfg_templets_dir.'/'.$cfg_df_style; + $win->AddTitle(" 频道:(" . $row['typename'] . ")默认模板文件说明:"); + $defaulttemplate = $cfg_templets_dir . '/' . $cfg_df_style; $msg = " 文档模板:{$defaulttemplate}/article_{$row['nid']}.htm [修改]
@@ -413,64 +365,58 @@ else if($dopost=="gettemplets") [修改] "; $win->AddMsgItem("
$msg
"); - $winform = $win->GetWindow("hand",""); + $winform = $win->GetWindow("hand", ""); $win->Display(); exit(); } /*-------------------- function __Delete() ---------------------*/ -else if($dopost=="delete") -{ +--------------------*/ else if ($dopost == "delete") { CheckPurview('c_Del'); $row = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='$id'"); - if($row['issystem'] == 1) - { - ShowMsg("系统模型不允许删除!","mychannel_main.php"); + if ($row['issystem'] == 1) { + ShowMsg("系统模型不允许删除!", "mychannel_main.php"); exit(); } - if(empty($job)) $job=""; + if (empty($job)) $job = ""; - if($job == "") //确认提示 + if ($job == "") //确认提示 { - require_once(DEDEINC."/oxwindow.class.php"); + require_once(DEDEINC . "/oxwindow.class.php"); $wintitle = "频道管理-删除模型"; $wecome_info = "频道管理::删除模型"; $win = new OxWindow(); - $win->Init("mychannel_edit.php","js/blank.js","POST"); - $win->AddHidden("job","yes"); - $win->AddHidden("dopost",$dopost); - $win->AddHidden("id",$id); - $win->AddTitle("你确实要删除 (".$row['typename'].") 这个频道?"); + $win->Init("mychannel_edit.php", "js/blank.js", "POST"); + $win->AddHidden("job", "yes"); + $win->AddHidden("dopost", $dopost); + $win->AddHidden("id", $id); + $win->AddTitle("你确实要删除 (" . $row['typename'] . ") 这个频道?"); $winform = $win->GetWindow("ok"); $win->Display(); exit(); - } else if($job=="yes") //操作 + } else if ($job == "yes") //操作 { - require_once(DEDEINC."/typeunit.class.admin.php"); - $myrow = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$id'",MYSQL_ASSOC); - if(!is_array($myrow)) - { - ShowMsg('你所指定的频道信息不存在!','-1'); + require_once(DEDEINC . "/typeunit.class.admin.php"); + $myrow = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$id'", MYSQL_ASSOC); + if (!is_array($myrow)) { + ShowMsg('你所指定的频道信息不存在!', '-1'); exit(); } //检查频道的表是否独占数据表 - $addtable = str_replace($cfg_dbprefix,'',str_replace('#@__',$cfg_dbprefix,$myrow['addtable'])); + $addtable = str_replace($cfg_dbprefix, '', str_replace('#@__', $cfg_dbprefix, $myrow['addtable'])); $row = $dsql->GetOne("SELECT COUNT(id) AS dd FROM `#@__channeltype` WHERE addtable like '{$cfg_dbprefix}{$addtable}' OR addtable LIKE CONCAT('#','@','__','$addtable') ; "); - $isExclusive2 = ($row['dd']>1 ? 0 : 1 ); + $isExclusive2 = ($row['dd'] > 1 ? 0 : 1); //获取与频道关连的所有栏目id $tids = ''; - $dsql->Execute('qm',"SELECT id FROM `#@__arctype` WHERE channeltype='$id'"); - while($row = $dsql->GetArray('qm')) - { - $tids .= ($tids=='' ? $row['id'] : ','.$row['id']); + $dsql->Execute('qm', "SELECT id FROM `#@__arctype` WHERE channeltype='$id'"); + while ($row = $dsql->GetArray('qm')) { + $tids .= ($tids == '' ? $row['id'] : ',' . $row['id']); } //删除相关信息 - if($tids!='') - { + if ($tids != '') { $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE typeid IN($tids); "); $dsql->ExecuteNoneQuery("DELETE FROM `{$myrow['maintable']}` WHERE typeid IN($tids); "); $dsql->ExecuteNoneQuery("DELETE FROM `#@__spec` WHERE typeid IN ($tids); "); @@ -479,14 +425,10 @@ else if($dopost=="delete") } //删除附加表或附加表内的信息 - if($isExclusive2==1) - { + if ($isExclusive2 == 1) { $dsql->ExecuteNoneQuery("DROP TABLE IF EXISTS `{$cfg_dbprefix}{$addtable}`;"); - } - else - { - if($tids!='' && $myrow['addtable']!='') - { + } else { + if ($tids != '' && $myrow['addtable'] != '') { $dsql->ExecuteNoneQuery("DELETE FROM `{$myrow['addtable']}` WHERE typeid IN ($tids); "); } } @@ -496,32 +438,27 @@ else if($dopost=="delete") //更新栏目缓存 UpDateCatCache($dsql); - ShowMsg("成功删除一个模型!","mychannel_main.php"); + ShowMsg("成功删除一个模型!", "mychannel_main.php"); exit(); } -}//del +} //del /*---------------- function __modifysearch() ------------------*/ -else if($dopost == 'modifysearch') -{ - if(!isset($step)) $step=0; - if(empty($step)) - { +-----------------*/ else if ($dopost == 'modifysearch') { + if (!isset($step)) $step = 0; + if (empty($step)) { $step = 1; $mid = intval($mid); $query = "SELECT mainfields, addonfields, template FROM `#@__advancedsearch` WHERE mid='$mid'"; $searchinfo = $dsql->GetOne($query); - if(!is_array($searchinfo)) - { + if (!is_array($searchinfo)) { $searchinfo = array(); $searchinfo['mainfields'] = $searchinfo['addonfields'] = $searchinfo['template'] = ''; } $searchinfo['mainfields'] = explode(',', $searchinfo['mainfields']); $searchinfo['addonfields'] = explode(',', $searchinfo['addonfields']); $addonfieldsarr = array(); - foreach($searchinfo['addonfields'] as $k) - { + foreach ($searchinfo['addonfields'] as $k) { $karr = explode(':', $k); $addonfieldsarr[] = $karr[0]; } @@ -532,12 +469,12 @@ else if($dopost == 'modifysearch') $c4 = in_array('source', $searchinfo['mainfields']) ? 'checked' : ''; $c5 = in_array('senddate', $searchinfo['mainfields']) ? 'checked' : ''; - $mainfields = ' '; - $mainfields .= ' '; + $mainfields = ' '; + $mainfields .= ' '; - $mainfields .= ' '; - $mainfields .= ' '; - $mainfields .= ' '; + $mainfields .= ' '; + $mainfields .= ' '; + $mainfields .= ' '; /* $mainfields .= ''; $mainfields .= ''; @@ -553,99 +490,83 @@ else if($dopost == 'modifysearch') $dtp = new DedeTagParse(); $dtp->SetNameSpace("field", "<", ">"); $dtp->LoadSource($channel['fieldset']); - if($channel['issystem'] < 0) - { + if ($channel['issystem'] < 0) { $checked = in_array('typeid', $addonfieldsarr) ? 'checked' : ''; - $addonfields .= ' '; + $addonfields .= ' '; $checked = in_array('senddate', $addonfieldsarr) ? 'checked' : ''; - $addonfields .= ' '; + $addonfields .= ' '; } - if(is_array($dtp->CTags) && !empty($dtp->CTags)) - { - foreach($dtp->CTags as $ctag) - { + if (is_array($dtp->CTags) && !empty($dtp->CTags)) { + foreach ($dtp->CTags as $ctag) { $datatype = $ctag->GetAtt('type'); $value = $ctag->GetName(); - if($channel['issystem'] < 0) - { - $_oo = array('channel','arcrank', 'title', 'senddate', 'mid', 'click', 'flag', 'litpic', 'userip', 'lastpost', 'scores', 'goodpost', 'badpost', 'endtime'); - if(in_array($value, $_oo)) continue; + if ($channel['issystem'] < 0) { + $_oo = array('channel', 'arcrank', 'title', 'senddate', 'mid', 'click', 'flag', 'litpic', 'userip', 'lastpost', 'scores', 'goodpost', 'badpost', 'endtime'); + if (in_array($value, $_oo)) continue; } $label = $ctag->GetAtt('itemname'); - if(in_array($datatype, $searchtype)){ + if (in_array($datatype, $searchtype)) { $checked = in_array($value, $addonfieldsarr) ? 'checked' : ''; $addonfields .= " "; } } } - require_once(dirname(__FILE__)."/templets/mychannel_modifysearch.htm"); - } else if ($step == 1) - { + require_once(dirname(__FILE__) . "/templets/mychannel_modifysearch.htm"); + } else if ($step == 1) { $query = "SELECT * FROM `#@__channeltype` WHERE id='$mid'"; $channel = $dsql->GetOne($query); - if(empty($addonfields)) - { + if (empty($addonfields)) { $addonfields = ''; } $template = trim($template); - $forms = '
'; + $forms = ''; $forms .= ""; $forms .= ""; $forms .= "关键词:
"; $mainstring = ''; - if(!empty($mainfields) && is_array($mainfields)) - { + if (!empty($mainfields) && is_array($mainfields)) { $mainstring = implode(',', $mainfields); - foreach($mainfields as $mainfield) - { - if($mainfield == 'typeid') - { - require_once(dirname(__FILE__)."/../include/typelink.class.php"); + foreach ($mainfields as $mainfield) { + if ($mainfield == 'typeid') { + require_once(dirname(__FILE__) . "/../include/typelink.class.php"); $tl = new TypeLink(0); - $typeOptions = $tl->GetOptionArray(0,0,$mid); + $typeOptions = $tl->GetOptionArray(0, 0, $mid); $forms .= "
栏目:"; $forms .= "
"; - }else if ($mainfield == 'iscommend') - { + } else if ($mainfield == 'iscommend') { $forms .= "
"; - }else if ($mainfield == 'writer') - { + } else if ($mainfield == 'writer') { $forms .= "作者:
"; - }else if ($mainfield == 'source') - { + } else if ($mainfield == 'source') { $forms .= "来源:
"; - }else if ($mainfield == 'senddate') - { + } else if ($mainfield == 'senddate') { $forms .= "开始时间:
"; $forms .= "结束时间:
"; } - } } $addonstring = ''; - $intarr = array('int','float'); - $textarr = array('textdata','textchar','text','htmltext','multitext'); - - if($channel['issystem'] < 0) - { - foreach($addonfields as $addonfield) - { - if($addonfield == 'typeid'){ - require_once(dirname(__FILE__)."/../include/typelink.class.php"); + $intarr = array('int', 'float'); + $textarr = array('textdata', 'textchar', 'text', 'htmltext', 'multitext'); + + if ($channel['issystem'] < 0) { + foreach ($addonfields as $addonfield) { + if ($addonfield == 'typeid') { + require_once(dirname(__FILE__) . "/../include/typelink.class.php"); $tl = new TypeLink(0); - $typeOptions = $tl->GetOptionArray(0,0,$mid); + $typeOptions = $tl->GetOptionArray(0, 0, $mid); $forms .= "
栏目:"; $forms .= "
"; $addonstring .= 'typeid:int,'; - } elseif($addonfield == 'senddate') { + } elseif ($addonfield == 'senddate') { $forms .= "开始时间:
"; $forms .= "结束时间:
"; $addonstring .= 'senddate:datetime,'; @@ -653,8 +574,7 @@ else if($dopost == 'modifysearch') } } - if(is_array($addonfields) && !empty($addonfields)) - { + if (is_array($addonfields) && !empty($addonfields)) { $query = "SELECT * FROM #@__channeltype WHERE id='$mid'"; $channel = $dsql->GetOne($query); @@ -662,14 +582,11 @@ else if($dopost == 'modifysearch') $dtp->SetNameSpace("field", "<", ">"); $dtp->LoadSource($channel['fieldset']); $fieldarr = $itemarr = $typearr = array(); - foreach($dtp->CTags as $ctag) - { - foreach($addonfields as $addonfield) - { + foreach ($dtp->CTags as $ctag) { + foreach ($addonfields as $addonfield) { - if($ctag->GetName() == $addonfield) - { - if($addonfield == 'typeid' || $addonfield == 'senddate') continue; + if ($ctag->GetName() == $addonfield) { + if ($addonfield == 'typeid' || $addonfield == 'senddate') continue; $fieldarr[] = $addonfield; $itemarr[] = $ctag->GetAtt('itemname'); @@ -679,59 +596,47 @@ else if($dopost == 'modifysearch') } } - foreach($fieldarr as $k=>$field) - { + foreach ($fieldarr as $k => $field) { $itemname = $itemarr[$k]; $name = $field; $type = $typearr[$k]; - $tmp = $name.':'.$type; - if(in_array($type, $intarr)) - { - $forms .= "
$itemname :
"; - } else if (in_array($type, $textarr)) - { + $tmp = $name . ':' . $type; + if (in_array($type, $intarr)) { + $forms .= "
$itemname :
"; + } else if (in_array($type, $textarr)) { $forms .= "$itemname :
"; - - } else if ($type == 'select') - { + } else if ($type == 'select') { $values = explode(',', $valuearr[$k]); - if(is_array($values) && !empty($values)) - { + if (is_array($values) && !empty($values)) { $forms .= "
$itemname : "; } - } else if ($type == 'radio') - { + } else if ($type == 'radio') { $values = explode(',', $valuearr[$k]); - if(is_array($values) && !empty($values)){ - $forms .= "
$itemname : "; - foreach($values as $value){ - $forms .= ""; + if (is_array($values) && !empty($values)) { + $forms .= "
$itemname : "; + foreach ($values as $value) { + $forms .= ""; } } - } else if ($type == 'checkbox') - { + } else if ($type == 'checkbox') { $values = explode(',', $valuearr[$k]); - if(is_array($values) && !empty($values)) - { + if (is_array($values) && !empty($values)) { $forms .= "
$itemname : "; - foreach($values as $value) - { - $forms .= ""; + foreach ($values as $value) { + $forms .= ""; } } - - }elseif($type == 'datetime'){ + } elseif ($type == 'datetime') { $forms .= "
开始时间:
"; $forms .= "结束时间:
"; - }else{ + } else { $tmp = ''; } - $addonstring .= $tmp.','; + $addonstring .= $tmp . ','; } } $forms .= '
'; @@ -739,20 +644,19 @@ else if($dopost == 'modifysearch') $query = "REPLACE INTO #@__advancedsearch(mid, maintable, mainfields, addontable, addonfields, forms, template) VALUES('$mid','$maintable','$mainstring','$addontable','$addonstring','$formssql', '$template')"; $dsql->ExecuteNoneQuery($query); $formshtml = dede_htmlspecialchars($forms); - echo ''; - echo "下面为生成的html表单,请自行复制,根据自己需求修改样式后粘贴到对应的模板中

"; + echo ''; + echo "下面为生成的html表单,请自行复制,根据自己需求修改样式后粘贴到对应的模板中

"; echo '
预览:

'; echo $forms; } exit; } //删除自定义搜索; -else if($dopost == 'del') -{ +else if ($dopost == 'del') { $mid = intval($mid); $dsql->ExecuteNoneQuery("DELETE FROM `#@__advancedsearch` WHERE mid = '$mid'; "); - ShowMsg("成功删除一个自定义搜索!","mychannel_main.php"); + ShowMsg("成功删除一个自定义搜索!", "mychannel_main.php"); exit(); } $row = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='$id' "); -require_once(DEDEADMIN."/templets/mychannel_edit.htm"); \ No newline at end of file +require_once(DEDEADMIN . "/templets/mychannel_edit.htm"); diff --git a/src/dede/mychannel_field_add.php b/src/dede/mychannel_field_add.php index c43adb2a..eafbae29 100755 --- a/src/dede/mychannel_field_add.php +++ b/src/dede/mychannel_field_add.php @@ -1,47 +1,43 @@ GetVersion(); /*---------------------- function Save() ---------------------*/ -if($action=='save') -{ +if ($action == 'save') { //修改字段配置信息 $dfvalue = trim($vdefault); - $isnull = ($isnull==1 ? "true" : "false"); + $isnull = ($isnull == 1 ? "true" : "false"); $mxlen = $maxlength; - - if(preg_match("#^(select|radio|checkbox)$#i", $dtype)) - { - if(!preg_match("#,#", $dfvalue)) - { - ShowMsg("你设定了字段为 {$dtype} 类型,必须在默认值中指定元素列表,如:'a,b,c' ","-1"); + + if (preg_match("#^(select|radio|checkbox)$#i", $dtype)) { + if (!preg_match("#,#", $dfvalue)) { + ShowMsg("你设定了字段为 {$dtype} 类型,必须在默认值中指定元素列表,如:'a,b,c' ", "-1"); exit(); } } - - if($dtype=='stepselect') - { + + if ($dtype == 'stepselect') { $arr = $dsql->GetOne("SELECT * FROM `#@__stepselect` WHERE egroup='$fieldname' "); - if(!is_array($arr)) - { - ShowMsg("你设定了字段为联动类型,但系统中没找到与你定义的字段名相同的联动组名!","-1"); + if (!is_array($arr)) { + ShowMsg("你设定了字段为联动类型,但系统中没找到与你定义的字段名相同的联动组名!", "-1"); exit(); } } @@ -60,44 +56,37 @@ if($action=='save') $ntabsql = $fieldinfos[0]; $buideType = $fieldinfos[1]; $rs = $dsql->ExecuteNoneQuery("ALTER TABLE `$trueTable` ADD $ntabsql "); - if(!$rs) - { + if (!$rs) { $gerr = $dsql->GetError(); - ShowMsg("增加字段失败,错误提示为:".$gerr,"javascript:;"); + ShowMsg("增加字段失败,错误提示为:" . $gerr, "javascript:;"); exit(); } //检测旧配置信息,并替换为新配置 $ok = FALSE; $fieldname = strtolower($fieldname); - if(is_array($dtp->CTags)) - { - foreach($dtp->CTags as $tagid=>$ctag) - { - if($fieldname == strtolower($ctag->GetName())) - { + if (is_array($dtp->CTags)) { + foreach ($dtp->CTags as $tagid => $ctag) { + if ($fieldname == strtolower($ctag->GetName())) { $dtp->Assign($tagid, stripslashes($fieldstring), FALSE); $ok = true; break; } } - $oksetting = $ok ? $dtp->GetResultNP() : $fieldset."\n".stripslashes($fieldstring); - } - else - { - $oksetting = $fieldset."\r\n".stripslashes($fieldstring); + $oksetting = $ok ? $dtp->GetResultNP() : $fieldset . "\n" . stripslashes($fieldstring); + } else { + $oksetting = $fieldset . "\r\n" . stripslashes($fieldstring); } - - $addlist = GetAddFieldList($dtp,$oksetting); + + $addlist = GetAddFieldList($dtp, $oksetting); $oksetting = addslashes($oksetting); $rs = $dsql->ExecuteNoneQuery("UPDATE `#@__channeltype` SET fieldset='$oksetting',listfields='$addlist' WHERE id='$id' "); - if(!$rs) - { + if (!$rs) { $grr = $dsql->GetError(); - ShowMsg("保存节点配置出错!".$grr, "javascript:;"); + ShowMsg("保存节点配置出错!" . $grr, "javascript:;"); exit(); } - + ShowMsg("成功增加一个字段!", "mychannel_edit.php?id={$id}&dopost=edit&openfield=1"); exit(); } @@ -111,13 +100,10 @@ $row = $dsql->GetOne("SELECT '#@__archives' AS maintable,addtable FROM `#@__chan $trueTable = $row['addtable']; $tabsql = "CREATE TABLE IF NOT EXISTS `$trueTable`( `aid` int(11) NOT NULL default '0',\r\n `typeid` int(11) NOT NULL default '0',\r\n "; -if($mysql_version < 4.1) -{ - $tabsql .= " PRIMARY KEY (`aid`), KEY `".$trueTable."_index` (`typeid`)\r\n) TYPE=MyISAM; "; -} -else -{ - $tabsql .= " PRIMARY KEY (`aid`), KEY `".$trueTable."_index` (`typeid`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; "; +if ($mysql_version < 4.1) { + $tabsql .= " PRIMARY KEY (`aid`), KEY `" . $trueTable . "_index` (`typeid`)\r\n) TYPE=MyISAM; "; +} else { + $tabsql .= " PRIMARY KEY (`aid`), KEY `" . $trueTable . "_index` (`typeid`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=" . $cfg_db_language . "; "; } $dsql->ExecuteNoneQuery($tabsql); @@ -125,45 +111,38 @@ $dsql->ExecuteNoneQuery($tabsql); //检测附加表里含有的字段 $fields = array(); -if(empty($row['maintable'])) $row['maintable'] = '#@__archives'; +if (empty($row['maintable'])) $row['maintable'] = '#@__archives'; $rs = $dsql->SetQuery("SHOW fields FROM `{$row['maintable']}`"); $dsql->Execute('a'); -while($nrow = $dsql->GetArray('a', MYSQL_ASSOC)) -{ - if ( $cfg_dbtype == 'sqlite' ) - { +while ($nrow = $dsql->GetArray('a', MYSQL_ASSOC)) { + if ($cfg_dbtype == 'sqlite') { $nrow['Field'] = $nrow['name']; } $fields[strtolower($nrow['Field'])] = 1; } $dsql->Execute("a", "SHOW fields FROM `{$row['addtable']}`"); -while($nrow = $dsql->GetArray('a', MYSQL_ASSOC)) -{ - if ( $cfg_dbtype == 'sqlite' ) - { +while ($nrow = $dsql->GetArray('a', MYSQL_ASSOC)) { + if ($cfg_dbtype == 'sqlite') { $nrow['Field'] = $nrow['name']; } - if(!isset($fields[strtolower($nrow['Field'])])) - { + if (!isset($fields[strtolower($nrow['Field'])])) { $fields[strtolower($nrow['Field'])] = 1; } } $f = ''; -foreach($fields as $k=>$v) -{ - $f .= ($f=='' ? $k : ' '.$k); +foreach ($fields as $k => $v) { + $f .= ($f == '' ? $k : ' ' . $k); } // 获取频道模型 $dsql->SetQuery("SELECT id,typename,nid FROM `#@__channeltype` WHERE id<>-1 AND isshow=1 ORDER BY id"); $dsql->Execute(); -while($row=$dsql->GetObject()) -{ +while ($row = $dsql->GetObject()) { $channelArray[$row->id]['typename'] = $row->typename; $channelArray[$row->id]['nid'] = $row->nid; } -require_once(DEDEADMIN."/templets/mychannel_field_add.htm"); +require_once(DEDEADMIN . "/templets/mychannel_field_add.htm"); diff --git a/src/dede/mychannel_field_edit.php b/src/dede/mychannel_field_edit.php index 1a927cf5..da493c7a 100755 --- a/src/dede/mychannel_field_edit.php +++ b/src/dede/mychannel_field_edit.php @@ -1,19 +1,20 @@ GetVersion(); @@ -25,15 +26,13 @@ $trueTable = $row['addtable']; $dtp = new DedeTagParse(); $dtp->SetNameSpace("field", "<", ">"); $dtp->LoadSource($fieldset); -foreach($dtp->CTags as $ctag) -{ - if(strtolower($ctag->GetName())==strtolower($fname)) break; +foreach ($dtp->CTags as $ctag) { + if (strtolower($ctag->GetName()) == strtolower($fname)) break; } //字段类型信息 -$ds = file(dirname(__FILE__)."/inc/fieldtype.txt"); -foreach($ds as $d) -{ +$ds = file(dirname(__FILE__) . "/inc/fieldtype.txt"); +foreach ($ds as $d) { $dds = explode(',', trim($d)); $fieldtypes[$dds[0]] = $dds[1]; } @@ -41,8 +40,7 @@ foreach($ds as $d) // 获取频道模型 $dsql->SetQuery("SELECT id,typename,nid FROM `#@__channeltype` WHERE id<>-1 AND isshow=1 ORDER BY id"); $dsql->Execute(); -while($crow=$dsql->GetObject()) -{ +while ($crow = $dsql->GetObject()) { $channelArray[$crow->id]['typename'] = $crow->typename; $channelArray[$crow->id]['nid'] = $crow->nid; } @@ -51,43 +49,34 @@ while($crow=$dsql->GetObject()) /*-------------------- function _SAVE() ----------------------*/ -if($action=='save') -{ - if(!isset($fieldtypes[$dtype])) - { - ShowMsg("你修改的是系统专用类型的数据,禁止操作!","-1"); +if ($action == 'save') { + if (!isset($fieldtypes[$dtype])) { + ShowMsg("你修改的是系统专用类型的数据,禁止操作!", "-1"); exit(); } - + $dfvalue = $vdefault; - if(preg_match("#^(select|radio|checkbox)#", $dtype)) - { - if(!preg_match("#,#", $dfvalue)) - { - ShowMsg("你设定了字段为 {$dtype} 类型,必须在默认值中指定元素列表,如:'a,b,c' ","-1"); + if (preg_match("#^(select|radio|checkbox)#", $dtype)) { + if (!preg_match("#,#", $dfvalue)) { + ShowMsg("你设定了字段为 {$dtype} 类型,必须在默认值中指定元素列表,如:'a,b,c' ", "-1"); exit(); } } - if($dtype=='stepselect') - { + if ($dtype == 'stepselect') { $arr = $dsql->GetOne("SELECT * FROM `#@__stepselect` WHERE egroup='$fname' "); - if(!is_array($arr)) - { - ShowMsg("你设定了字段为联动类型,但系统中没找到与你定义的字段名相同的联动组名!","-1"); + if (!is_array($arr)) { + ShowMsg("你设定了字段为联动类型,但系统中没找到与你定义的字段名相同的联动组名!", "-1"); exit(); } } //检测数据库是否存在附加表,不存在则新建一个 $tabsql = "CREATE TABLE IF NOT EXISTS `{$row['addtable']}`( `aid` int(11) NOT NULL default '0',\r\n `typeid` int(11) NOT NULL default '0',\r\n "; - if($mysql_version < 4.1) - { - $tabsql .= " PRIMARY KEY (`aid`), KEY `".$trueTable."_index` (`typeid`)\r\n) TYPE=MyISAM; "; - } - else - { - $tabsql .= " PRIMARY KEY (`aid`), KEY `".$trueTable."_index` (`typeid`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=".$cfg_db_language."; "; + if ($mysql_version < 4.1) { + $tabsql .= " PRIMARY KEY (`aid`), KEY `" . $trueTable . "_index` (`typeid`)\r\n) TYPE=MyISAM; "; + } else { + $tabsql .= " PRIMARY KEY (`aid`), KEY `" . $trueTable . "_index` (`typeid`)\r\n) ENGINE=MyISAM DEFAULT CHARSET=" . $cfg_db_language . "; "; } $dsql->ExecuteNoneQuery($tabsql); @@ -95,78 +84,67 @@ if($action=='save') $fields = array(); $rs = $dsql->SetQuery("SHOW fields FROM `{$row['addtable']}`"); $dsql->Execute('a'); - while($nrow = $dsql->GetArray('a',MYSQL_ASSOC)) - { - $fields[ strtolower($nrow['Field']) ] = $nrow['Type']; + while ($nrow = $dsql->GetArray('a', MYSQL_ASSOC)) { + $fields[strtolower($nrow['Field'])] = $nrow['Type']; } //修改字段配置信息 - $isnull = ($isnull==1 ? "true" : "false"); + $isnull = ($isnull == 1 ? "true" : "false"); $mxlen = $maxlength; $fieldname = strtolower($fname); //检测被修改的字段类型,并更新数据表 - $fieldinfos = GetFieldMake($dtype,$fieldname,$dfvalue,$mxlen); + $fieldinfos = GetFieldMake($dtype, $fieldname, $dfvalue, $mxlen); $ntabsql = $fieldinfos[0]; $buideType = $fieldinfos[1]; $tabsql = ''; //检测旧数据类型,并替换为新配置 - foreach($dtp->CTags as $tagid=>$ctag) - { - if($fieldname==strtolower($ctag->GetName())) - { - if(isset($fields[$fieldname]) && $fields[$fieldname] != $buideType) - { - $tabsql = "ALTER TABLE `$trueTable` CHANGE `$fieldname` ".$ntabsql; + foreach ($dtp->CTags as $tagid => $ctag) { + if ($fieldname == strtolower($ctag->GetName())) { + if (isset($fields[$fieldname]) && $fields[$fieldname] != $buideType) { + $tabsql = "ALTER TABLE `$trueTable` CHANGE `$fieldname` " . $ntabsql; $dsql->ExecuteNoneQuery($tabsql); - }else if(!isset($fields[$fieldname])) - { - $tabsql = "ALTER TABLE `$trueTable` ADD ".$ntabsql; + } else if (!isset($fields[$fieldname])) { + $tabsql = "ALTER TABLE `$trueTable` ADD " . $ntabsql; $dsql->ExecuteNoneQuery($tabsql); - }else - { + } else { $tabsql = ''; } - $dtp->Assign($tagid,stripslashes($fieldstring),false); + $dtp->Assign($tagid, stripslashes($fieldstring), false); break; } } $oksetting = $dtp->GetResultNP(); - $addlist = GetAddFieldList($dtp,$oksetting); + $addlist = GetAddFieldList($dtp, $oksetting); $oksetting = addslashes($oksetting); $dsql->ExecuteNoneQuery("UPDATE `#@__channeltype` SET fieldset='$oksetting',listfields='$addlist' WHERE id='$id' "); - ShowMsg("成功更改一个字段的配置!","mychannel_edit.php?id={$id}&dopost=edit&openfield=1"); + ShowMsg("成功更改一个字段的配置!", "mychannel_edit.php?id={$id}&dopost=edit&openfield=1"); exit(); } /*------------------ 删除字段 function _DELETE() --------------------*/ -else if($action=="delete") -{ - if($row['issystem']==1) - { - ShowMsg("对不起,系统模型的字段不允许删除!","-1"); +-------------------*/ else if ($action == "delete") { + if ($row['issystem'] == 1) { + ShowMsg("对不起,系统模型的字段不允许删除!", "-1"); exit(); } //检测旧数据类型,并替换为新配置 - foreach($dtp->CTags as $tagid=>$ctag) - { - if(strtolower($ctag->GetName()) == strtolower($fname)) - { + foreach ($dtp->CTags as $tagid => $ctag) { + if (strtolower($ctag->GetName()) == strtolower($fname)) { $dtp->Assign($tagid, "#@Delete@#"); } } - + $oksetting = addslashes($dtp->GetResultNP()); $dsql->ExecuteNoneQuery("UPDATE `#@__channeltype` SET fieldset='$oksetting' WHERE id='$id' "); $dsql->ExecuteNoneQuery("ALTER TABLE `$trueTable` DROP `$fname` "); - ShowMsg("成功删除一个字段!","mychannel_edit.php?id={$id}&dopost=edit&openfield=1"); + ShowMsg("成功删除一个字段!", "mychannel_edit.php?id={$id}&dopost=edit&openfield=1"); exit(); } -require_once(DEDEADMIN."/templets/mychannel_field_edit.htm"); \ No newline at end of file +require_once(DEDEADMIN . "/templets/mychannel_field_edit.htm"); diff --git a/src/dede/mychannel_main.php b/src/dede/mychannel_main.php index 44879590..25c58782 100755 --- a/src/dede/mychannel_main.php +++ b/src/dede/mychannel_main.php @@ -1,37 +1,35 @@ SetTemplet(DEDEADMIN."/templets/mychannel_main.htm"); +$dlist->SetTemplet(DEDEADMIN . "/templets/mychannel_main.htm"); $dlist->SetSource($sql); $dlist->display(); -function GetSta($sta,$id) +function GetSta($sta, $id) { - if($sta==1) - { - return ($id!=-1 ? "启用 > 禁用" : "固定项目"); - } - else - { + if ($sta == 1) { + return ($id != -1 ? "启用 > 禁用" : "固定项目"); + } else { return "禁用 > 启用"; } } function IsSystem($s) { - return $s==1 ? "系统" : "自动"; -} \ No newline at end of file + return $s == 1 ? "系统" : "自动"; +} diff --git a/src/dede/mynews_add.php b/src/dede/mynews_add.php index a203eb0b..16b24874 100755 --- a/src/dede/mynews_add.php +++ b/src/dede/mynews_add.php @@ -1,19 +1,19 @@ ExecuteNoneQuery("DELETE FROM #@__mynews WHERE aid='$aid';"); - ShowMsg("成功删除一条站内新闻!","mynews_main.php"); + ShowMsg("成功删除一条站内新闻!", "mynews_main.php"); exit(); -} -else if($dopost=="editsave") -{ - $inquery = "UPDATE #@__mynews SET title='$title',typeid='$typeid',writer='$writer',senddate='".GetMKTime($sdate)."',body='$body' WHERE aid='$aid';"; +} else if ($dopost == "editsave") { + $inquery = "UPDATE #@__mynews SET title='$title',typeid='$typeid',writer='$writer',senddate='" . GetMKTime($sdate) . "',body='$body' WHERE aid='$aid';"; $dsql->ExecuteNoneQuery($inquery); - ShowMsg("成功更改一条站内新闻!","mynews_main.php"); + ShowMsg("成功更改一条站内新闻!", "mynews_main.php"); exit(); } $myNews = $dsql->GetOne("SELECT #@__mynews.*,#@__arctype.typename FROM #@__mynews LEFT JOIN #@__arctype ON #@__arctype.id=#@__mynews.typeid WHERE #@__mynews.aid='$aid';"); -include DedeInclude('templets/mynews_edit.htm'); \ No newline at end of file +include DedeInclude('templets/mynews_edit.htm'); diff --git a/src/dede/mynews_main.php b/src/dede/mynews_main.php index 3f181c5a..eef28b4d 100755 --- a/src/dede/mynews_main.php +++ b/src/dede/mynews_main.php @@ -1,17 +1,18 @@ SetTemplet(DEDEADMIN."/templets/mynews_main.htm"); +$dlist->SetTemplet(DEDEADMIN . "/templets/mynews_main.htm"); $dlist->SetSource($sql); -$dlist->display(); \ No newline at end of file +$dlist->display(); diff --git a/src/dede/mytag_add.php b/src/dede/mytag_add.php index b7270536..7e13934e 100755 --- a/src/dede/mytag_add.php +++ b/src/dede/mytag_add.php @@ -1,26 +1,25 @@ GetOne("SELECT typeid FROM `#@__mytag` WHERE typeid='$typeid' AND tagname LIKE '$tagname'"); - if(is_array($row)) - { - ShowMsg("在相同栏目下已经存在同名的标记!","-1"); + if (is_array($row)) { + ShowMsg("在相同栏目下已经存在同名的标记!", "-1"); exit(); } $starttime = GetMkTime($starttime); @@ -28,11 +27,11 @@ if($dopost=="save") $inQuery = "INSERT INTO `#@__mytag`(typeid,tagname,timeset,starttime,endtime,normbody,expbody) VALUES('$typeid','$tagname','$timeset','$starttime','$endtime','$normbody','$expbody'); "; $dsql->ExecuteNoneQuery($inQuery); - ShowMsg("成功增加一个自定义标记!","mytag_main.php"); + ShowMsg("成功增加一个自定义标记!", "mytag_main.php"); exit(); } $startDay = time(); -$endDay = AddDay($startDay,30); +$endDay = AddDay($startDay, 30); $startDay = GetDateTimeMk($startDay); $endDay = GetDateTimeMk($endDay); -include DedeInclude('templets/mytag_add.htm'); \ No newline at end of file +include DedeInclude('templets/mytag_add.htm'); diff --git a/src/dede/mytag_edit.php b/src/dede/mytag_edit.php index 8c370587..f3356c36 100755 --- a/src/dede/mytag_edit.php +++ b/src/dede/mytag_edit.php @@ -1,29 +1,27 @@ ExecuteNoneQuery("DELETE FROM `#@__mytag` WHERE aid='$aid'"); - ShowMsg("成功删除一个自定义标记!",$ENV_GOBACK_URL); + ShowMsg("成功删除一个自定义标记!", $ENV_GOBACK_URL); exit(); -} -else if($dopost=="saveedit") -{ +} else if ($dopost == "saveedit") { CheckCSRF(); $starttime = GetMkTime($starttime); $endtime = GetMkTime($endtime); @@ -37,12 +35,10 @@ else if($dopost=="saveedit") expbody='$expbody' WHERE aid='$aid' "; $dsql->ExecuteNoneQuery($query); - ShowMsg("成功更改一个自定义标记!",$ENV_GOBACK_URL); + ShowMsg("成功更改一个自定义标记!", $ENV_GOBACK_URL); exit(); -} -else if($dopost=="getjs") -{ - require_once(DEDEINC."/oxwindow.class.php"); +} else if ($dopost == "getjs") { + require_once(DEDEINC . "/oxwindow.class.php"); $jscode = ""; $showhtml = "\r\n\r\n$jscode\r\n\r\n"; $showhtml .= "预览:"; @@ -54,12 +50,10 @@ else if($dopost=="getjs") $winform = $win->GetWindow('hand', $showhtml); $win->Display(); exit(); -} -else if($dopost=="testjs") -{ +} else if ($dopost == "testjs") { echo ""; echo ""; exit(); } $row = $dsql->GetOne("SELECT * FROM `#@__mytag` WHERE aid='$aid'"); -include DedeInclude('templets/mytag_edit.htm'); \ No newline at end of file +include DedeInclude('templets/mytag_edit.htm'); diff --git a/src/dede/mytag_main.php b/src/dede/mytag_main.php index 7deacb52..08d1bffa 100755 --- a/src/dede/mytag_main.php +++ b/src/dede/mytag_main.php @@ -1,31 +1,32 @@ SetTemplet(DEDEADMIN.'/templets/mytag_main.htm'); +$dlist->SetTemplet(DEDEADMIN . '/templets/mytag_main.htm'); $dlist->SetSource($sql); $dlist->display(); function TestType($tname) { - return $tname=='' ? '所有栏目' : $tname; + return $tname == '' ? '所有栏目' : $tname; } function TimeSetValue($ts) { - return $ts==0 ? '不限时间' : '限时标记'; -} \ No newline at end of file + return $ts == 0 ? '不限时间' : '限时标记'; +} diff --git a/src/dede/mytag_tag_guide.php b/src/dede/mytag_tag_guide.php index 9dd6bf21..745ca7e1 100755 --- a/src/dede/mytag_tag_guide.php +++ b/src/dede/mytag_tag_guide.php @@ -1,13 +1,14 @@ 0) $attlist .= " typeid='".$typeid."'"; -if(isset($arcid)) $attlist .= " idlist='".$arcid."'"; -if($channel>0) $attlist .= " channelid='".$channel."'"; -if($att>0) $attlist .= " att='".$att."'"; -if($col>1) $attlist .= " col='".$col."'"; -if($subday>0) $attlist .= " subday='".$subday."'"; +$attlist .= " row='" . $row . "'"; +$attlist .= " titlelen='" . $titlelen . "'"; +if ($orderby != 'senddate') $attlist .= " orderby='" . $orderby . "'"; +if ($order != 'desc') $attlist .= " order='" . $order . "'"; +if ($typeid > 0) $attlist .= " typeid='" . $typeid . "'"; +if (isset($arcid)) $attlist .= " idlist='" . $arcid . "'"; +if ($channel > 0) $attlist .= " channelid='" . $channel . "'"; +if ($att > 0) $attlist .= " att='" . $att . "'"; +if ($col > 1) $attlist .= " col='" . $col . "'"; +if ($subday > 0) $attlist .= " subday='" . $subday . "'"; -if(!empty($types)) -{ +if (!empty($types)) { $attlist .= " type='"; - foreach($types as $v) - { - $attlist .= $v.'.'; + foreach ($types as $v) { + $attlist .= $v . '.'; } $attlist .= "'"; } $innertext = stripslashes($innertext); -if($keyword!="") -{ +if ($keyword != "") { $attlist .= " keyword='$keyword'"; } $fulltag = "{dede:arclist$attlist} $innertext {/dede:arclist}\r\n"; -if($dopost=='savetag') -{ +if ($dopost == 'savetag') { $fulltag = addslashes($fulltag); $tagname = "auto"; $inQuery = "INSERT INTO `#@__mytag`(typeid,tagname,timeset,starttime,endtime,normbody,expbody) @@ -53,4 +50,4 @@ if($dopost=='savetag') $dsql->ExecuteNoneQuery("UPDATE `#@__mytag` SET tagname='{$tagname}_{$id}' WHERE aid='$id'"); $fulltag = "{dede:mytag name='{$tagname}_{$id}' ismake='yes'/}"; } -include DedeInclude('templets/mytag_tag_guide_ok.htm'); \ No newline at end of file +include DedeInclude('templets/mytag_tag_guide_ok.htm'); diff --git a/src/dede/pic_view.php b/src/dede/pic_view.php index ad380330..8875d893 100755 --- a/src/dede/pic_view.php +++ b/src/dede/pic_view.php @@ -1,98 +1,86 @@ 转到上级目录\n"); + echo ("转到上级目录\n"); } } function ListPic($truePath, $nowPath) { global $listSize; - $col=0; - $rowdd=0; + $col = 0; + $rowdd = 0; $rowdd++; - $imgfile=""; + $imgfile = ""; $truePath = preg_replace("#\/$#", "", preg_replace("#\\\\{1,}#", "/", trim($truePath))); $nowPath = preg_replace("#\/$#", "", preg_replace("#\/{1,}#", "/", trim($nowPath))); $dh = dir($truePath); - echo("\n"); - while( $filename = $dh->read() ) - { - if(!preg_match("#\.$#", $filename)) - { - $fullName = $truePath."/".$filename; - $fileUrl = $nowPath."/".$filename; - if(is_dir($fullName)) - { - if($col % $listSize==0 && $col != 0) - { - echo("\n\n"); - for($i = $rowdd-$listSize; $i < $rowdd; $i++) - { - echo("".$filelist[$i]."\n"); + echo ("\n"); + while ($filename = $dh->read()) { + if (!preg_match("#\.$#", $filename)) { + $fullName = $truePath . "/" . $filename; + $fileUrl = $nowPath . "/" . $filename; + if (is_dir($fullName)) { + if ($col % $listSize == 0 && $col != 0) { + echo ("\n\n"); + for ($i = $rowdd - $listSize; $i < $rowdd; $i++) { + echo ("" . $filelist[$i] . "\n"); } - echo("\n\n"); + echo ("\n\n"); } $line = "
- +
"; $filelist[$rowdd] = $filename; $col++; $rowdd++; echo $line; - } - else if(IsImg($filename)) - { - if($col % $listSize==0 && $col != 0) - { - echo("\n\n"); - for($i=$rowdd-$listSize; $i<$rowdd; $i++) - { - echo("".$filelist[$i]."\n"); + } else if (IsImg($filename)) { + if ($col % $listSize == 0 && $col != 0) { + echo ("\n\n"); + for ($i = $rowdd - $listSize; $i < $rowdd; $i++) { + echo ("" . $filelist[$i] . "\n"); } - echo("\n\n"); + echo ("\n\n"); } $line = "
- ".GetImgFile($truePath, $nowPath, $filename)." + " . GetImgFile($truePath, $nowPath, $filename) . "
"; $filelist[$rowdd] = $filename; @@ -102,57 +90,48 @@ function ListPic($truePath, $nowPath) } } } - echo("\n"); - if( !empty($filelist) ) - { - echo("\n"); - $t = ($rowdd-1) % $listSize; - if( $t == 0 ) - { + echo ("\n"); + if (!empty($filelist)) { + echo ("\n"); + $t = ($rowdd - 1) % $listSize; + if ($t == 0) { $t = $listSize; } - for($i = $rowdd - $t; $i < $rowdd; $i++) - { - echo("".$filelist[$i]."\n"); + for ($i = $rowdd - $t; $i < $rowdd; $i++) { + echo ("" . $filelist[$i] . "\n"); } - echo("\n"); + echo ("\n"); } } function GetImgFile($truePath, $nowPath, $fileName) { - $toW=102; - $toH=102; - $srcFile = $truePath."/".$fileName; + $toW = 102; + $toH = 102; + $srcFile = $truePath . "/" . $fileName; $info = ""; $data = GetImageSize($srcFile, $info); - $srcW=$data[0]; - $srcH=$data[1]; - if($toW >= $srcW && $toH >= $srcH) - { + $srcW = $data[0]; + $srcH = $data[1]; + if ($toW >= $srcW && $toH >= $srcH) { $ftoW = $srcW; $ftoH = $srcH; - } - else - { + } else { $toWH = $toW / $toH; $srcWH = $srcW / $srcH; - if($toWH <= $srcWH) - { + if ($toWH <= $srcWH) { $ftoW = $toW; - $ftoH = $ftoW * ( $srcH / $srcW); - } - else - { + $ftoH = $ftoW * ($srcH / $srcW); + } else { $ftoH = $toH; - $ftoW = $ftoH * ( $srcW / $srcH ); + $ftoW = $ftoH * ($srcW / $srcH); } } - return(""); + return (""); } function IsImg($fileName) { - if(preg_match("#\.(jpg|gif|png)$#", $fileName)) return 1; + if (preg_match("#\.(jpg|gif|png)$#", $fileName)) return 1; else return 0; -} \ No newline at end of file +} diff --git a/src/dede/plus_edit.php b/src/dede/plus_edit.php index f4a3b644..5b0cc72c 100755 --- a/src/dede/plus_edit.php +++ b/src/dede/plus_edit.php @@ -1,34 +1,30 @@ ExecuteNoneQuery("UPDATE `#@__plus` SET isshow=1 WHERE aid='$aid';"); - ShowMsg("成功启用一个插件,请刷新导航菜单!","plus_main.php"); + ShowMsg("成功启用一个插件,请刷新导航菜单!", "plus_main.php"); exit(); -} -else if($dopost=="hide") -{ +} else if ($dopost == "hide") { $dsql->ExecuteNoneQuery("UPDATE `#@__plus` SET isshow=0 WHERE aid='$aid';"); - ShowMsg("成功禁用一个插件,请刷新导航菜单!","plus_main.php"); + ShowMsg("成功禁用一个插件,请刷新导航菜单!", "plus_main.php"); exit(); -} -else if($dopost=="delete") -{ - if(empty($job)) $job=""; - if($job=="") //确认提示 +} else if ($dopost == "delete") { + if (empty($job)) $job = ""; + if ($job == "") //确认提示 { - require_once(DEDEINC."/oxwindow.class.php"); + require_once(DEDEINC . "/oxwindow.class.php"); $wintitle = "删除插件"; $wecome_info = "插件管理::删除插件"; $win = new OxWindow(); @@ -36,25 +32,23 @@ else if($dopost=="delete") $win->AddHidden("job", "yes"); $win->AddHidden("dopost", $dopost); $win->AddHidden("aid", $aid); - $win->AddTitle("你确实要删除'".$title."'这个插件?"); + $win->AddTitle("你确实要删除'" . $title . "'这个插件?"); $win->AddMsgItem("警告:在这里删除仅仅删除菜单项,要干净删除请在模块管理处删除!

模块管理>>
"); $winform = $win->GetWindow("ok"); $win->Display(); exit(); - } - else if($job=="yes") //操作 + } else if ($job == "yes") //操作 { $dsql->ExecuteNoneQuery("DELETE FROM `#@__plus` WHERE aid='$aid';"); - ShowMsg("成功删除一个插件,请刷新导航菜单!","plus_main.php"); + ShowMsg("成功删除一个插件,请刷新导航菜单!", "plus_main.php"); exit(); } -} -else if($dopost=="saveedit") //保存更改 +} else if ($dopost == "saveedit") //保存更改 { $inquery = "UPDATE `#@__plus` SET plusname='$plusname',menustring='$menustring',filelist='$filelist' WHERE aid='$aid';"; $dsql->ExecuteNoneQuery($inquery); - ShowMsg("成功更改插件的配置!","plus_main.php"); + ShowMsg("成功更改插件的配置!", "plus_main.php"); exit(); } $row = $dsql->GetOne("SELECT * FROM `#@__plus` WHERE aid='$aid'"); -include DedeInclude('templets/plus_edit.htm'); \ No newline at end of file +include DedeInclude('templets/plus_edit.htm'); diff --git a/src/dede/plus_main.php b/src/dede/plus_main.php index f3389e99..21129ff5 100755 --- a/src/dede/plus_main.php +++ b/src/dede/plus_main.php @@ -1,32 +1,30 @@ SetTemplet(DEDEADMIN."/templets/plus_main.htm"); +$dlist->SetTemplet(DEDEADMIN . "/templets/plus_main.htm"); $dlist->SetSource($sql); $dlist->display(); -function GetSta($sta,$id,$title) +function GetSta($sta, $id, $title) { - if($sta==1) - { - return "   修改   启用 > 禁用   删除"; - } - else - { - return "   修改   禁用 > 启用   册除"; + if ($sta == 1) { + return "   修改   启用 > 禁用   删除"; + } else { + return "   修改   禁用 > 启用   册除"; } -} \ No newline at end of file +} diff --git a/src/dede/public_guide.php b/src/dede/public_guide.php index a77f533d..75b90152 100755 --- a/src/dede/public_guide.php +++ b/src/dede/public_guide.php @@ -1,26 +1,25 @@ ExecuteNoneQuery("UPDATE `#@__channeltype` SET isdefault=0 WHERE id<>'$cid'"); - if($cid != 0) - { + if ($cid != 0) { $dsql->ExecuteNoneQuery("UPDATE `#@__channeltype` SET isdefault=1 WHERE id='$cid'"); } $win = new OxWindow(); @@ -28,16 +27,13 @@ if($action=='setdefault') $win->mainTitle = "内容发布向导"; $wecome_info = "内容发布向导"; $win->AddTitle("内容发布向导 >> 设置默认发布表单"); - if($cid==0) - { + if ($cid == 0) { $msg = " 成功取消默认发布表单!
你目前想要进行的操作: 返回发布向导页 "; - } - else - { + } else { $msg = " 成功保存默认发布表单,以后点击“内容发布”面板将直接跳转到你选择的内容发布页!
@@ -57,30 +53,27 @@ function __PageShow(); $row = $dsql->GetOne("SELECT id,addcon FROM `#@__channeltype` WHERE isdefault='1' "); //已经设置了默认发布表单 -if(is_array($row) && $action!='edit') -{ +if (is_array($row) && $action != 'edit') { $addcon = $row['addcon']; - if($addcon=='') - { - $addcon='archives_add.php'; + if ($addcon == '') { + $addcon = 'archives_add.php'; } $channelid = $row['id']; $cid = 0; - require_once(DEDEADMIN.'/'.$addcon); + require_once(DEDEADMIN . '/' . $addcon); exit(); } //没有设置默认发布表单 -else -{ +else { $dsql->SetQuery("SELECT id,typename,mancon,isdefault,addtable FROM `#@__channeltype` WHERE id<>-1 And isshow=1 "); $dsql->Execute(); } include DedeInclude('templets/public_guide.htm'); //获取频道栏目数 -function GetCatalogs(&$dsql,$cid) +function GetCatalogs(&$dsql, $cid) { $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__arctype` WHERE channeltype='$cid' "); return (!is_array($row) ? '0' : $row['dd']); -} \ No newline at end of file +} diff --git a/src/dede/recycling.php b/src/dede/recycling.php index afa485b9..da0f4ba1 100755 --- a/src/dede/recycling.php +++ b/src/dede/recycling.php @@ -1,30 +1,29 @@ SetTemplet(DEDEADMIN."/templets/recycling.htm"); +$dlist->SetTemplet(DEDEADMIN . "/templets/recycling.htm"); $dlist->SetSource($query); -$dlist->display(); \ No newline at end of file +$dlist->display(); diff --git a/src/dede/search_keywords_main.php b/src/dede/search_keywords_main.php index 0c73ee7d..37808c43 100755 --- a/src/dede/search_keywords_main.php +++ b/src/dede/search_keywords_main.php @@ -1,31 +1,30 @@ ExecuteNoneQuery("DELETE FROM `#@__search_keywords` WHERE aid='$aid';"); AjaxHead(); @@ -45,29 +43,26 @@ else if($dopost=='del') exit(); } //批量删除字段 -else if($dopost=='delall') -{ - foreach($aids as $aid) - { +else if ($dopost == 'delall') { + foreach ($aids as $aid) { $dsql->ExecuteNoneQuery("DELETE FROM `#@__search_keywords` WHERE aid='$aid';"); } - ShowMsg("删除成功!",$ENV_GOBACK_URL); + ShowMsg("删除成功!", $ENV_GOBACK_URL); exit(); } //第一次进入这个页面 -if($dopost=='') -{ +if ($dopost == '') { $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__search_keywords` "); $totalRow = $row['dd']; - include(DEDEADMIN."/templets/search_keywords_main.htm"); + include(DEDEADMIN . "/templets/search_keywords_main.htm"); } //获得特定的关键字列表 -function GetKeywordList($dsql,$pageno,$pagesize,$orderby='aid') +function GetKeywordList($dsql, $pageno, $pagesize, $orderby = 'aid') { global $cfg_phpurl; - $start = ($pageno-1) * $pagesize; - $printhead ="
+ $start = ($pageno - 1) * $pagesize; + $printhead = " @@ -82,12 +77,11 @@ function GetKeywordList($dsql,$pageno,$pagesize,$orderby='aid') \r\n "; echo $printhead; - if($orderby=='result') $orderby = $orderby." ASC"; - else $orderby = $orderby." DESC"; + if ($orderby == 'result') $orderby = $orderby . " ASC"; + else $orderby = $orderby . " DESC"; $dsql->SetQuery("SELECT * FROM `#@__search_keywords` ORDER BY $orderby LIMIT $start,$pagesize "); $dsql->Execute(); - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $line = " @@ -95,8 +89,8 @@ function GetKeywordList($dsql,$pageno,$pagesize,$orderby='aid') - - + + \r\n"; echo "
{$row['result']}".MyDate("Y-m-d H:i:s",$row['lasttime'])."{$row['result']}" . MyDate("Y-m-d H:i:s", $row['lasttime']) . " 更新 | 删除 @@ -113,4 +107,4 @@ function GetKeywordList($dsql,$pageno,$pagesize,$orderby='aid')
\r\n"; -} \ No newline at end of file +} diff --git a/src/dede/shops_delivery.php b/src/dede/shops_delivery.php index 516d530f..5a0a4f44 100755 --- a/src/dede/shops_delivery.php +++ b/src/dede/shops_delivery.php @@ -1,94 +1,79 @@ 100) ) - { - ShowMsg("请填写配送方式名称!","-1"); +if (!isset($do)) $do = ''; +if ($do == 'add') { + if (empty($dname) || (strlen($dname) > 100)) { + ShowMsg("请填写配送方式名称!", "-1"); exit(); } $price = preg_replace("#[^.0-9]#", "", $price); - if($price < 0.01) - { + if ($price < 0.01) { $price = '0.00'; } - $des = cn_substrR($des,255); + $des = cn_substrR($des, 255); $InQuery = "INSERT INTO `#@__shops_delivery`(`dname`,`price`,`des`) VALUES ('$dname','$price','$des');"; $result = $dsql->ExecuteNoneQuery($InQuery); - if($result) - { - ShowMsg("成功添加一个配送方式!","shops_delivery.php"); - } - else - { - ShowMsg("添加配送方式时发生SQL错误!","-1"); + if ($result) { + ShowMsg("成功添加一个配送方式!", "shops_delivery.php"); + } else { + ShowMsg("添加配送方式时发生SQL错误!", "-1"); } exit(); -} else if ($do == 'del') -{ +} else if ($do == 'del') { $id = intval($id); $dsql->ExecuteNoneQuery("DELETE FROM `#@__shops_delivery` WHERE pid='$id'"); - ShowMsg("已删除当前配送方式!","shops_delivery.php"); + ShowMsg("已删除当前配送方式!", "shops_delivery.php"); exit(); -} else if ($do == 'edit') -{ - foreach($pid as $id) - { +} else if ($do == 'edit') { + foreach ($pid as $id) { $id = intval($id); $row = $dsql->GetOne("SELECT pid,dname,price,des FROM `#@__shops_delivery` WHERE pid='$id' LIMIT 0,1"); - if(!is_array($row)) - { + if (!is_array($row)) { continue; } - $dname = ${"m_dname".$id}; - $price = ${"m_price".$id}; - $des = ${"m_des".$id}; - if( empty($dname) || (strlen($dname) > 100) ) - { + $dname = ${"m_dname" . $id}; + $price = ${"m_price" . $id}; + $des = ${"m_des" . $id}; + if (empty($dname) || (strlen($dname) > 100)) { $dname = addslashes($row['dname']); } $price = preg_replace("#[^.0-9]#", "", $price); - if(empty($price)) - { + if (empty($price)) { $price = $row['price']; } - if(empty($des)) - { + if (empty($des)) { $des = addslashes($row['des']); - } - else - { - $des = cn_substrR($des,255); + } else { + $des = cn_substrR($des, 255); } $dsql->ExecuteNoneQuery("UPDATE `#@__shops_delivery` SET dname='$dname',price='$price',des='$des' WHERE pid='$id'"); } - ShowMsg("成功修改配送方式!","shops_delivery.php"); + ShowMsg("成功修改配送方式!", "shops_delivery.php"); exit(); } $deliveryarr = array(); $dsql->SetQuery("SELECT pid,dname,price,des FROM `#@__shops_delivery` ORDER BY orders ASC"); $dsql->Execute(); -while($row = $dsql->GetArray()) -{ +while ($row = $dsql->GetArray()) { $deliveryarr[] = $row; } $dlist = new DataListCP(); $dlist->pageSize = 25; //设定每页显示记录数(默认25条) //这两句的顺序不能更换 -$dlist->SetTemplate(DEDEADMIN."/templets/shops_delivery.htm"); //载入模板 +$dlist->SetTemplate(DEDEADMIN . "/templets/shops_delivery.htm"); //载入模板 $dlist->SetSource("SELECT `pid`,`dname`,`price`,`des` FROM `#@__shops_delivery` ORDER BY `orders` ASC"); // 设定查询SQL $dlist->Display(); //显示 \ No newline at end of file diff --git a/src/dede/shops_operations.php b/src/dede/shops_operations.php index d72d432c..c855e174 100755 --- a/src/dede/shops_operations.php +++ b/src/dede/shops_operations.php @@ -1,61 +1,50 @@ ExecuteNoneQuery($sql); - } - else if ($dopost == 'push') - { + } else if ($dopost == 'push') { $nids = explode('`', $nid); $wh = ''; - foreach($nids as $n) - { - if($wh=='') $wh = " WHERE oid='$n' "; + foreach ($nids as $n) { + if ($wh == '') $wh = " WHERE oid='$n' "; else $wh .= " OR oid='$n' "; } - $sql="UPDATE `#@__shops_orders` SET `state`='2' $wh "; + $sql = "UPDATE `#@__shops_orders` SET `state`='2' $wh "; $dsql->ExecuteNoneQuery($sql); - } - else if ($dopost == 'ok') - { - $nids = explode('`',$nid); + } else if ($dopost == 'ok') { + $nids = explode('`', $nid); $wh = ''; - foreach($nids as $n) - { - if($wh=='') $wh = " WHERE oid='$n' "; + foreach ($nids as $n) { + if ($wh == '') $wh = " WHERE oid='$n' "; else $wh .= " OR oid='$n' "; } - $sql="UPDATE `#@__shops_orders` SET `state`='4' $wh "; + $sql = "UPDATE `#@__shops_orders` SET `state`='4' $wh "; $dsql->ExecuteNoneQuery($sql); - } - else if ($dopost == 'delete') - { + } else if ($dopost == 'delete') { $nids = explode('`', $nid); - foreach($nids as $n) - { + foreach ($nids as $n) { $query = "DELETE FROM `#@__shops_products` WHERE oid='$n'"; $query2 = "DELETE FROM `#@__shops_orders` WHERE oid='$n'"; $query3 = "DELETE FROM `#@__shops_userinfo` WHERE oid='$n'"; @@ -63,36 +52,32 @@ if(isset($dopost)) $dsql->ExecuteNoneQuery($query2); $dsql->ExecuteNoneQuery($query3); } - ShowMsg("成功删除指定的订单记录!",$ENV_GOBACK_URL); + ShowMsg("成功删除指定的订单记录!", $ENV_GOBACK_URL); exit(); - } - else - { - ShowMsg("不充许的操作范围!",$ENV_GOBACK_URL); + } else { + ShowMsg("不充许的操作范围!", $ENV_GOBACK_URL); exit(); } - ShowMsg("成功更改指定的订单记录!",$ENV_GOBACK_URL); + ShowMsg("成功更改指定的订单记录!", $ENV_GOBACK_URL); exit(); } $addsql = ''; -if(empty($oid)) $oid = 0; -setcookie("ENV_GOBACK_URL",$dedeNowurl,time()+3600,"/"); -if(isset($buyid)) -{ +if (empty($oid)) $oid = 0; +setcookie("ENV_GOBACK_URL", $dedeNowurl, time() + 3600, "/"); +if (isset($buyid)) { $buyid = preg_replace("#[^-0-9A-Z]#", "", $buyid); - $addsql = "WHERE s.oid='".$buyid."'"; + $addsql = "WHERE s.oid='" . $buyid . "'"; } -if(isset($sta)) -{ +if (isset($sta)) { $addsql = "WHERE s.`state`='$sta'"; } $sql = "SELECT s.`oid`,s.`cartcount`,s.`price`,s.`state`,s.`stime`,s.priceCount,s.dprice,s.paytype,u.`consignee`,u.`tel`,s.`userid` FROM `#@__shops_orders` AS s LEFT JOIN `#@__shops_userinfo` AS u ON s.oid=u.oid $addsql ORDER BY `stime` DESC"; $dlist = new DataListCP(); -$dlist->SetParameter("oid",$oid); -if(isset($sta)) $dlist->SetParameter("sta",$sta); -$tplfile = DEDEADMIN."/templets/shops_operations.htm"; +$dlist->SetParameter("oid", $oid); +if (isset($sta)) $dlist->SetParameter("sta", $sta); +$tplfile = DEDEADMIN . "/templets/shops_operations.htm"; //这两句的顺序不能更换 $dlist->SetTemplate($tplfile); //载入模板 @@ -101,24 +86,15 @@ $dlist->Display(); function GetSta($sta) { - if($sta==0) - { + if ($sta == 0) { return '未付款'; - } - else if($sta==1) - { + } else if ($sta == 1) { return '已付款'; - } - else if($sta==2) - { + } else if ($sta == 2) { return '已发货'; - } - else if($sta==3) - { + } else if ($sta == 3) { return '已确认'; - } - else - { + } else { return '已完成'; } } @@ -128,12 +104,9 @@ function GetsType($pid) global $dsql; $pid = intval($pid); $row = $dsql->GetOne("SELECT name FROM `#@__payment` WHERE id='$pid'"); - if(is_array($row)) - { + if (is_array($row)) { return $row['name']; - } - else - { + } else { return '-'; } } @@ -141,14 +114,11 @@ function GetsType($pid) function GetMemberID($mid) { global $dsql; - if($mid==0) return '0'; + if ($mid == 0) return '0'; $row = $dsql->GetOne("SELECT userid FROM `#@__member` WHERE mid='$mid' "); - if(is_array($row)) - { - return "".$row['userid'].""; - } - else - { + if (is_array($row)) { + return "" . $row['userid'] . ""; + } else { return '0'; } -} \ No newline at end of file +} diff --git a/src/dede/shops_operations_cart.php b/src/dede/shops_operations_cart.php index 4c57bc41..c128174f 100755 --- a/src/dede/shops_operations_cart.php +++ b/src/dede/shops_operations_cart.php @@ -1,51 +1,45 @@ 无效操作!"); +if (!isset($oid)) exit("无效操作!"); $oid = preg_replace("#[^-0-9A-Z]#", "", $oid); -if(empty($oid)) exit("无效订单号!"); +if (empty($oid)) exit("无效订单号!"); $row = $dsql->GetOne("SELECT * FROM `#@__shops_userinfo` WHERE oid='$oid'"); -$sql="SELECT o.*,p.title,p.price as uprice,d.dname FROM `#@__shops_orders` as o left join `#@__shops_products` as p on o.oid=p.oid left join `#@__shops_delivery` as d on d.pid=o.pid WHERE o.oid='$oid'"; +$sql = "SELECT o.*,p.title,p.price as uprice,d.dname FROM `#@__shops_orders` as o left join `#@__shops_products` as p on o.oid=p.oid left join `#@__shops_delivery` as d on d.pid=o.pid WHERE o.oid='$oid'"; $dlist = new DataListCP(); $dlist->pageSize = 20; -$dlist->SetParameter("oid",$oid); -$dlist->SetTemplate(DEDEADMIN."/templets/shops_operations_cart.htm"); +$dlist->SetParameter("oid", $oid); +$dlist->SetTemplate(DEDEADMIN . "/templets/shops_operations_cart.htm"); $dlist->SetSource($sql); $dlist->Display(); $dlist->Close(); -function GetSta($sta,$oid) +function GetSta($sta, $oid) { global $dsql; $row = $dsql->GetOne("SELECT paytype FROM `#@__shops_orders` WHERE oid='$oid'"); $payname = $dsql->GetOne("SELECT name,fee FROM `#@__payment` WHERE id='{$row['paytype']}'"); - if($sta==0) - { - return $payname['name']." 手续费:".$payname['fee']."元"; - } - else if ($sta==1) - { + if ($sta == 0) { + return $payname['name'] . " 手续费:" . $payname['fee'] . "元"; + } else if ($sta == 1) { return '已付款,等发货'; - } - else if ($sta==2) - { - return '确认'; - } - else - { + } else if ($sta == 2) { + return '确认'; + } else { return '已完成'; } -} \ No newline at end of file +} diff --git a/src/dede/shops_operations_userinfo.php b/src/dede/shops_operations_userinfo.php index ccdca4e9..973f017a 100755 --- a/src/dede/shops_operations_userinfo.php +++ b/src/dede/shops_operations_userinfo.php @@ -1,32 +1,32 @@ 无效操作!"); +if (!isset($oid)) exit("无效操作!"); $oid = preg_replace("#[^-0-9A-Z]#", "", $oid); -if(empty($oid)) exit("无效订单号!"); +if (empty($oid)) exit("无效订单号!"); $rows = $dsql->GetOne("SELECT * FROM `#@__shops_userinfo` WHERE oid='$oid' LIMIT 0,1"); -if(!is_array($rows)){ +if (!is_array($rows)) { $dsql->Close(); exit("该订单下没相关用户信息!"); } $row = $dsql->GetOne("SELECT pid,dprice FROM `#@__shops_orders` WHERE oid='$oid'"); -if(is_array($row)) -{ +if (is_array($row)) { $rs = $dsql->GetOne("SELECT dname FROM `#@__shops_delivery` WHERE pid='$row[pid]'"); $rows['dname'] = $rs['dname']; $rows['dprice'] = $row['dprice']; } $rows['des'] = stripslashes($rows['des']); -include DEDEADMIN."/templets/shops_operations_userinfo.htm"; -unset($rows); \ No newline at end of file +include DEDEADMIN . "/templets/shops_operations_userinfo.htm"; +unset($rows); diff --git a/src/dede/soft_add.php b/src/dede/soft_add.php index 5c9bfe07..3aef5eef 100755 --- a/src/dede/soft_add.php +++ b/src/dede/soft_add.php @@ -1,41 +1,40 @@ 0 && $channelid==0) - { + if ($cid > 0 && $channelid == 0) { $row = $dsql->GetOne("SELECT channeltype FROM `#@__arctype` WHERE id='$cid'; "); $channelid = $row['channeltype']; } else { - if($channelid==0) $channelid = 1; + if ($channelid == 0) $channelid = 1; } $softconfig = $dsql->GetOne("SELECT * FROM `#@__softconfig` "); //获得频道模型信息 $cInfos = $dsql->GetOne(" SELECT * FROM `#@__channeltype` WHERE id='$channelid' "); $channelid = $cInfos['id']; - + //获取文章最大id以确定当前权重 $maxWright = $dsql->GetOne("SELECT COUNT(*) AS cc FROM #@__archives"); include DedeInclude("templets/soft_add.htm"); @@ -43,53 +42,47 @@ if($dopost != 'save') } /*-------------------------------- function __save(){ } --------------------------------*/ -else if($dopost=='save') -{ - require_once(DEDEINC.'/image.func.php'); - require_once(DEDEINC.'/oxwindow.class.php'); - - $flag = isset($flags) ? join(',',$flags) : ''; - $notpost = isset($notpost) && $notpost == 1 ? 1: 0; - if(empty($click)) $click = ($cfg_arc_click=='-1' ? mt_rand(50, 200) : $cfg_arc_click); - - if(!isset($typeid2)) $typeid2 = 0; - if(!isset($autokey)) $autokey = 0; - if(!isset($remote)) $remote = 0; - if(!isset($dellink)) $dellink = 0; - if(!isset($autolitpic)) $autolitpic = 0; +-------------------------------*/ else if ($dopost == 'save') { + require_once(DEDEINC . '/image.func.php'); + require_once(DEDEINC . '/oxwindow.class.php'); + + $flag = isset($flags) ? join(',', $flags) : ''; + $notpost = isset($notpost) && $notpost == 1 ? 1 : 0; + if (empty($click)) $click = ($cfg_arc_click == '-1' ? mt_rand(50, 200) : $cfg_arc_click); - if($typeid==0) - { - ShowMsg("请指定文档的栏目!","-1"); + if (!isset($typeid2)) $typeid2 = 0; + if (!isset($autokey)) $autokey = 0; + if (!isset($remote)) $remote = 0; + if (!isset($dellink)) $dellink = 0; + if (!isset($autolitpic)) $autolitpic = 0; + + if ($typeid == 0) { + ShowMsg("请指定文档的栏目!", "-1"); exit(); } - if(empty($channelid)) - { - ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1"); + if (empty($channelid)) { + ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1"); exit(); } - if(!CheckChannel($typeid,$channelid) ) - { - ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1"); + if (!CheckChannel($typeid, $channelid)) { + ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1"); exit(); } - if(!TestPurview('a_New')) - { - CheckCatalog($typeid,"对不起,你没有操作栏目 {$typeid} 的权限!"); + if (!TestPurview('a_New')) { + CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的权限!"); } //对保存的内容进行处理 - if(empty($writer))$writer=$cuserLogin->getUserName(); - if(empty($source))$source='未知'; + if (empty($writer)) $writer = $cuserLogin->getUserName(); + if (empty($source)) $source = '未知'; $pubdate = GetMkTime($pubdate); $senddate = time(); - $sortrank = AddDay($pubdate,$sortup); - - if($ishtml==0) $ismake = -1; + $sortrank = AddDay($pubdate, $sortup); + + if ($ishtml == 0) $ismake = -1; else $ismake = 0; - - if(empty($click)) $click = ($cfg_arc_click=='-1' ? mt_rand(50, 200) : $cfg_arc_click); + + if (empty($click)) $click = ($cfg_arc_click == '-1' ? mt_rand(50, 200) : $cfg_arc_click); $title = preg_replace('#"#', '"', $title); $title = cn_substrR($title, $cfg_title_maxlen); @@ -102,40 +95,37 @@ else if($dopost=='save') $filename = trim(cn_substrR($filename, 40)); $userip = GetIP(); $isremote = 0; - $serviterm=empty($serviterm)? "" : $serviterm; - if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) - { + $serviterm = empty($serviterm) ? "" : $serviterm; + if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) { $arcrank = -1; } $adminid = $cuserLogin->getUserID(); //处理上传的缩略图 - if(empty($ddisremote)) - { + if (empty($ddisremote)) { $ddisremote = 0; } $litpic = GetDDImage('none', $picname, $ddisremote); // 处理新的缩略图上传 if ($litpic_b64 != "") { - $data = explode( ',', $litpic_b64 ); + $data = explode(',', $litpic_b64); $ntime = time(); - $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime); + $savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime); CreateDir($savepath); - $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999)); - $fullUrl = $fullUrl.".png"; - - file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] )); + $fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999)); + $fullUrl = $fullUrl . ".png"; + + file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1])); // 加水印 - WaterImg($cfg_basedir.$fullUrl, 'up'); + WaterImg($cfg_basedir . $fullUrl, 'up'); $litpic = $fullUrl; } //生成文档ID $arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $adminid); - if(empty($arcID)) - { - ShowMsg("无法获得主键,因此无法进行后续操作!","-1"); + if (empty($arcID)) { + ShowMsg("无法获得主键,因此无法进行后续操作!", "-1"); exit(); } @@ -145,64 +135,52 @@ else if($dopost=='save') //分析处理附加表数据 $inadd_f = ''; $inadd_v = ''; - if(!empty($dede_addonfields)) - { + if (!empty($dede_addonfields)) { $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if(!isset(${$vs[0]})) - { + $vs = explode(',', $v); + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; - } - else if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理 - { - ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]); - } - else + } else if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理 { - if(!isset(${$vs[0]})) - { + ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]); + } else { + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$arcID); + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID); } - $inadd_f .= ','.$vs[0]; - $inadd_v .= " ,'".${$vs[0]}."' "; + $inadd_f .= ',' . $vs[0]; + $inadd_v .= " ,'" . ${$vs[0]} . "' "; } } } //处理图片文档的自定义属性 - if($litpic!='' && !preg_match('#p#', $flag)) - { - $flag = ($flag=='' ? 'p' : $flag.',p'); + if ($litpic != '' && !preg_match('#p#', $flag)) { + $flag = ($flag == '' ? 'p' : $flag . ',p'); } - if($redirecturl!='' && !preg_match('#j#', $flag)) - { - $flag = ($flag=='' ? 'j' : $flag.',j'); + if ($redirecturl != '' && !preg_match('#j#', $flag)) { + $flag = ($flag == '' ? 'j' : $flag . ',j'); } //跳转网址的文档强制为动态 - if(preg_match('#j#', $flag)) $ismake = -1; + if (preg_match('#j#', $flag)) $ismake = -1; //保存到主表 $inQuery = "INSERT INTO `#@__archives`(id,typeid,typeid2,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle, color,writer,source,litpic,pubdate,senddate,mid,notpost,description,keywords,filename,dutyadmin,weight) VALUES ('$arcID','$typeid','$typeid2','$sortrank','$flag','$ismake','$channelid','$arcrank','$click','$money','$title','$shorttitle', '$color','$writer','$source','$litpic','$pubdate','$senddate','$adminid','$notpost','$description','$keywords','$filename','$adminid','$weight');"; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { + if (!$dsql->ExecuteNoneQuery($inQuery)) { $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeCMS官方。".str_replace('"','',$gerr),"javascript:;"); + ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeCMS官方。" . str_replace('"', '', $gerr), "javascript:;"); exit(); } @@ -212,50 +190,41 @@ else if($dopost=='save') //本地链接处理 $softurl1 = stripslashes($softurl1); $nsoftsize = ''; - if($softurl1 != '') - { + if ($softurl1 != '') { $urls .= "{dede:link islocal='1' text='{$servermsg1}'} $softurl1 {/dede:link}\r\n"; $autosize = empty($autosize) ? FALSE : TRUE; - if($autosize && empty($softsize)) - { - $nsoftsize = @filesize($cfg_basedir.$softurl1); - if(empty($nsoftsize)) $nsoftsize = '未知'; - else - { + if ($autosize && empty($softsize)) { + $nsoftsize = @filesize($cfg_basedir . $softurl1); + if (empty($nsoftsize)) $nsoftsize = '未知'; + else { $nsoftsize = trim(sprintf("%0.2f", $nsoftsize / 1024 / 1024)); - $nsoftsize = $nsoftsize." MB"; + $nsoftsize = $nsoftsize . " MB"; } } } - + //软件大小 - if(!empty($nsoftsize)) $softsize = $nsoftsize; - else if(empty($softsize)) $softsize = '未知'; - else $softsize = $softsize.' '.$unit; - + if (!empty($nsoftsize)) $softsize = $nsoftsize; + else if (empty($softsize)) $softsize = '未知'; + else $softsize = $softsize . ' ' . $unit; + //其它链接处理 - for($i=2; $i<=30; $i++) - { - if(!empty(${'softurl'.$i})) - { - $forconfig = empty(${'forconfig'.$i}) ? FALSE : TRUE; - if($forconfig) - { - if(empty(${'need'.$i})) continue; - $serverUrl = stripslashes(${'softurlfirst'.$i}); + for ($i = 2; $i <= 30; $i++) { + if (!empty(${'softurl' . $i})) { + $forconfig = empty(${'forconfig' . $i}) ? FALSE : TRUE; + if ($forconfig) { + if (empty(${'need' . $i})) continue; + $serverUrl = stripslashes(${'softurlfirst' . $i}); $serverUrl = preg_replace("#\/$#", "", $serverUrl); - $softurl = stripslashes(${'softurl'.$i}); - if( cn_substr($softurl, 1) != '/' ) $softurl = '/'.$softurl; - $softurl = $serverUrl.$softurl; - } - else - { - $softurl = stripslashes(${'softurl'.$i}); + $softurl = stripslashes(${'softurl' . $i}); + if (cn_substr($softurl, 1) != '/') $softurl = '/' . $softurl; + $softurl = $serverUrl . $softurl; + } else { + $softurl = stripslashes(${'softurl' . $i}); } - $servermsg = str_replace("'", "", stripslashes(${'servermsg'.$i})); - if($servermsg=='') $servermsg = '下载地址'.$i; - if($softurl != 'http://') - { + $servermsg = str_replace("'", "", stripslashes(${'servermsg' . $i})); + if ($servermsg == '') $servermsg = '下载地址' . $i; + if ($softurl != 'http://') { $urls .= "{dede:link text='$servermsg'} $softurl {/dede:link}\r\n"; } } @@ -265,11 +234,10 @@ else if($dopost=='save') //保存到附加表 $cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' "); $addtable = trim($cts['addtable']); - if(empty($addtable)) - { + if (empty($addtable)) { $dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'"); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作!。","javascript:;"); + ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作!。", "javascript:;"); exit(); } $daccess = isset($daccess) && is_numeric($daccess) ? $daccess : 0; @@ -278,31 +246,29 @@ else if($dopost=='save') os,softrank,officialUrl,officialDemo,softsize,softlinks,introduce,daccess,needmoney{$inadd_f}) VALUES ('$arcID','$typeid','$redirecturl','$useip','$filetype','$language','$softtype','$accredit', '$os','$softrank','$officialUrl','$officialDemo','$softsize','$urls','$body','$daccess','$needmoney'{$inadd_v});"; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { + if (!$dsql->ExecuteNoneQuery($inQuery)) { $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'"); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCMS官方。".str_replace('"','',$gerr),"javascript:;"); + ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请把相关信息提交给DedeCMS官方。" . str_replace('"', '', $gerr), "javascript:;"); exit(); } //生成HTML InsertTags($tags, $arcID); $arcUrl = MakeArt($arcID, TRUE, TRUE, 0); - if($arcUrl=='') - { - $arcUrl = $cfg_phpurl."/view.php?aid=$arcID"; + if ($arcUrl == '') { + $arcUrl = $cfg_phpurl . "/view.php?aid=$arcID"; } ClearMyAddon($arcID, $title); - + // 自动更新关联内容 if (is_array($automake)) { foreach ($automake as $key => $value) { if (isset(${$key}) && !empty(${$key})) { $ids = explode(",", ${$key}); foreach ($ids as $id) { - MakeArt($id,true,true,$isremote); + MakeArt($id, true, true, $isremote); } } } @@ -315,13 +281,13 @@ else if($dopost=='save')    查看软件    - 更改软件 + 更改软件    已发布软件管理    网站栏目管理 "; - $msg = "
{$msg}
".GetUpdateTest(); + $msg = "
{$msg}
" . GetUpdateTest(); $wintitle = "成功发布一个软件!"; $wecome_info = "文章管理::发布软件"; @@ -330,4 +296,4 @@ else if($dopost=='save') $win->AddMsgItem($msg); $winform = $win->GetWindow("hand", " ", FALSE); $win->Display(); -} \ No newline at end of file +} diff --git a/src/dede/soft_config.php b/src/dede/soft_config.php index 020ee266..11265f20 100755 --- a/src/dede/soft_config.php +++ b/src/dede/soft_config.php @@ -1,21 +1,21 @@ 0 || $dfywboy>0) $gotojump = 1; +if ($dopost == "save") { + if ($dfrank > 0 || $dfywboy > 0) $gotojump = 1; $query = "UPDATE `#@__softconfig` SET `downtype` = '$downtype' , `gotojump` ='$gotojump' , @@ -33,8 +33,7 @@ if($dopost=="save") } //读取参数 $row = $dsql->GetOne("SELECT * FROM `#@__softconfig` "); -if(!is_array($row)) -{ +if (!is_array($row)) { $dsql->ExecuteNoneQuery("INSERT INTO `#@__softconfig`(`downtype`,`ismoresite`,`islocal`,`gotojump`,`sites`,`downmsg`,`moresitedo`,`dfrank`,`dfywboy`, `argrange`) VALUES ('1', '0','1', '0', '' ,'$downmsg','1', '0', '0', '0'); "); $row['downtype'] = 1; @@ -49,4 +48,4 @@ if(!is_array($row)) $row['argrange'] = 0; } include DedeInclude('templets/soft_config.htm'); -exit(); \ No newline at end of file +exit(); diff --git a/src/dede/soft_edit.php b/src/dede/soft_edit.php index 9fb4bbe9..3b601f2c 100755 --- a/src/dede/soft_edit.php +++ b/src/dede/soft_edit.php @@ -1,26 +1,26 @@ SetQuery($arcQuery); $arcRow = $dsql->GetOne($arcQuery); - if(!is_array($arcRow)) - { - ShowMsg("读取档案基本信息出错!","-1"); + if (!is_array($arcRow)) { + ShowMsg("读取档案基本信息出错!", "-1"); exit(); } - $query = "SELECT * FROM `#@__channeltype` WHERE id='".$arcRow['channel']."'"; + $query = "SELECT * FROM `#@__channeltype` WHERE id='" . $arcRow['channel'] . "'"; $cInfos = $dsql->GetOne($query); - if(!is_array($cInfos)) - { - ShowMsg("读取频道配置信息出错!","javascript:;"); + if (!is_array($cInfos)) { + ShowMsg("读取频道配置信息出错!", "javascript:;"); exit(); } $addtable = $cInfos['addtable']; @@ -52,21 +50,17 @@ if($dopost!='save') $nForm = ''; $daccess = $addRow['daccess']; $needmoney = $addRow['needmoney']; - if($addRow['softlinks'] != '') - { + if ($addRow['softlinks'] != '') { $dtp = new DedeTagParse(); $dtp->LoadSource($addRow['softlinks']); - if(is_array($dtp->CTags)) - { - foreach($dtp->CTags as $ctag) - { - if($ctag->GetName()=='link') - { + if (is_array($dtp->CTags)) { + foreach ($dtp->CTags as $ctag) { + if ($ctag->GetName() == 'link') { $islocal = $ctag->GetAtt('islocal'); - if($islocal != 1) $needmsg = "删除"; - else $needmsg = ''; - $nForm .= "
软件地址{$newRowStart}: - 服务器名称: + if ($islocal != 1) $needmsg = "删除"; + else $needmsg = ''; + $nForm .= "
软件地址{$newRowStart}: + 服务器名称: $needmsg
\r\n"; @@ -78,150 +72,128 @@ if($dopost!='save') } $channelid = $arcRow['channel']; $tags = GetTags($aid); - $arcRow=XSSClean($arcRow);$addRow=XSSClean($addRow); + $arcRow = XSSClean($arcRow); + $addRow = XSSClean($addRow); include DedeInclude("templets/soft_edit.htm"); exit(); } /*-------------------------------- function __save(){ } --------------------------------*/ -else if($dopost=='save') -{ - require_once(DEDEINC.'/image.func.php'); - require_once(DEDEINC.'/oxwindow.class.php'); - - $flag = isset($flags) ? join(',',$flags) : ''; - $notpost = isset($notpost) && $notpost == 1 ? 1: 0; - - if(empty($typeid2)) $typeid2 = 0; - if(!isset($autokey)) $autokey = 0; - if(!isset($remote)) $remote = 0; - if(!isset($dellink)) $dellink = 0; - if(!isset($autolitpic)) $autolitpic = 0; +-------------------------------*/ else if ($dopost == 'save') { + require_once(DEDEINC . '/image.func.php'); + require_once(DEDEINC . '/oxwindow.class.php'); + + $flag = isset($flags) ? join(',', $flags) : ''; + $notpost = isset($notpost) && $notpost == 1 ? 1 : 0; + + if (empty($typeid2)) $typeid2 = 0; + if (!isset($autokey)) $autokey = 0; + if (!isset($remote)) $remote = 0; + if (!isset($dellink)) $dellink = 0; + if (!isset($autolitpic)) $autolitpic = 0; - if($typeid==0) - { - ShowMsg("请指定文档的栏目!","-1"); + if ($typeid == 0) { + ShowMsg("请指定文档的栏目!", "-1"); exit(); } - if(empty($channelid)) - { - ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!","-1"); + if (empty($channelid)) { + ShowMsg("文档为非指定的类型,请检查你发布内容的表单是否合法!", "-1"); exit(); } - if(!CheckChannel($typeid,$channelid)) - { - ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!","-1"); + if (!CheckChannel($typeid, $channelid)) { + ShowMsg("你所选择的栏目与当前模型不相符,请选择白色的选项!", "-1"); exit(); } - if(!TestPurview('a_Edit')) - { - if(TestPurview('a_AccEdit')) - { - CheckCatalog($typeid,"对不起,你没有操作栏目 {$typeid} 的文档权限!"); - } - else - { - CheckArcAdmin($id,$cuserLogin->getUserID()); + if (!TestPurview('a_Edit')) { + if (TestPurview('a_AccEdit')) { + CheckCatalog($typeid, "对不起,你没有操作栏目 {$typeid} 的文档权限!"); + } else { + CheckArcAdmin($id, $cuserLogin->getUserID()); } } //对保存的内容进行处理 $pubdate = GetMkTime($pubdate); $senddate = time(); - $sortrank = AddDay($pubdate,$sortup); - if($ishtml==0) - { + $sortrank = AddDay($pubdate, $sortup); + if ($ishtml == 0) { $ismake = -1; - } - else - { + } else { $ismake = 0; } - $title = cn_substrR($title,$cfg_title_maxlen); - $shorttitle = cn_substrR($shorttitle,36); - $color = cn_substrR($color,7); - $writer = cn_substrR($writer,20); - $source = cn_substrR($source,30); - $description = cn_substrR($description,$cfg_auot_description); - $keywords = cn_substrR($keywords,60); - $filename = trim(cn_substrR($filename,40)); + $title = cn_substrR($title, $cfg_title_maxlen); + $shorttitle = cn_substrR($shorttitle, 36); + $color = cn_substrR($color, 7); + $writer = cn_substrR($writer, 20); + $source = cn_substrR($source, 30); + $description = cn_substrR($description, $cfg_auot_description); + $keywords = cn_substrR($keywords, 60); + $filename = trim(cn_substrR($filename, 40)); $isremote = 0; - $serviterm=empty($serviterm)? "" : $serviterm; - if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) - { + $serviterm = empty($serviterm) ? "" : $serviterm; + if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) { $arcrank = -1; } $adminid = $cuserLogin->getUserID(); //处理上传的缩略图 - if(empty($ddisremote)) - { + if (empty($ddisremote)) { $ddisremote = 0; } - $litpic = GetDDImage('litpic',$picname,$ddisremote); + $litpic = GetDDImage('litpic', $picname, $ddisremote); // 处理新的缩略图上传 if ($litpic_b64 != "") { - $data = explode( ',', $litpic_b64 ); + $data = explode(',', $litpic_b64); $ntime = time(); - $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime); + $savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime); CreateDir($savepath); - $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999)); - $fullUrl = $fullUrl.".png"; - - file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] )); + $fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999)); + $fullUrl = $fullUrl . ".png"; + + file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1])); // 加水印 - WaterImg($cfg_basedir.$fullUrl, 'up'); + WaterImg($cfg_basedir . $fullUrl, 'up'); $litpic = $fullUrl; } //分析处理附加表数据 $inadd_f = ''; $inadd_v = ''; - if(!empty($dede_addonfields)) - { - $addonfields = explode(';',$dede_addonfields); + if (!empty($dede_addonfields)) { + $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理 - { - ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]); - } - else + $vs = explode(',', $v); + if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理 { - if(!isset(${$vs[0]})) - { + ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]); + } else { + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$id); + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $id); } - $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'"; + $inadd_f .= ",`{$vs[0]}` = '" . ${$vs[0]} . "'"; } } } //处理图片文档的自定义属性 - if($litpic!='' && !preg_match('#p#',$flag)) - { - $flag = ($flag=='' ? 'p' : $flag.',p'); + if ($litpic != '' && !preg_match('#p#', $flag)) { + $flag = ($flag == '' ? 'p' : $flag . ',p'); } - if($redirecturl!='' && !preg_match('#j#', $flag)) - { - $flag = ($flag=='' ? 'j' : $flag.',j'); + if ($redirecturl != '' && !preg_match('#j#', $flag)) { + $flag = ($flag == '' ? 'j' : $flag . ',j'); } //跳转网址的文档强制为动态 - if(preg_match('#j#', $flag)) $ismake = -1; + if (preg_match('#j#', $flag)) $ismake = -1; //更改主档案表 $inQuery = "UPDATE `#@__archives` SET typeid='$typeid', @@ -246,32 +218,27 @@ else if($dopost=='save') dutyadmin='$adminid', weight='$weight' WHERE id='$id'; "; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { - ShowMsg("更新数据库archives表时出错,请检查!","-1"); + if (!$dsql->ExecuteNoneQuery($inQuery)) { + ShowMsg("更新数据库archives表时出错,请检查!", "-1"); exit(); } //软件链接列表 $urls = ''; - - for($i=1; $i<=30; $i++) - { - if(!empty(${'softurl'.$i})) - { - $islocal = empty(${'islocal'.$i}) ? '' : 1; - $isneed = empty(${'del'.$i}) ? true : false; - $servermsg = str_replace("'",'',stripslashes(${'servermsg'.$i})); - $softurl = stripslashes(${'softurl'.$i}); - - if($servermsg=='') - { - $servermsg = '下载地址'.$i; + + for ($i = 1; $i <= 30; $i++) { + if (!empty(${'softurl' . $i})) { + $islocal = empty(${'islocal' . $i}) ? '' : 1; + $isneed = empty(${'del' . $i}) ? true : false; + $servermsg = str_replace("'", '', stripslashes(${'servermsg' . $i})); + $softurl = stripslashes(${'softurl' . $i}); + + if ($servermsg == '') { + $servermsg = '下载地址' . $i; } - if($softurl != 'http://') - { - if($islocal==1) $urls .= "{dede:link islocal='$islocal' text='{$servermsg}'} $softurl {/dede:link}\r\n" ; - else if($isneed) $urls .= "{dede:link text='$servermsg'} $softurl {/dede:link}\r\n"; + if ($softurl != 'http://') { + if ($islocal == 1) $urls .= "{dede:link islocal='$islocal' text='{$servermsg}'} $softurl {/dede:link}\r\n"; + else if ($isneed) $urls .= "{dede:link text='$servermsg'} $softurl {/dede:link}\r\n"; else continue; } } @@ -281,8 +248,7 @@ else if($dopost=='save') //更新附加表 $cts = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' "); $addtable = trim($cts['addtable']); - if($addtable!='') - { + if ($addtable != '') { $useip = GetIP(); $inQuery = "UPDATE `$addtable` SET typeid ='$typeid', @@ -303,9 +269,8 @@ else if($dopost=='save') introduce='$body' {$inadd_f} WHERE aid='$id';"; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { - ShowMsg("更新数据库附加表 addonsoft 时出错,请检查原因!","-1"); + if (!$dsql->ExecuteNoneQuery($inQuery)) { + ShowMsg("更新数据库附加表 addonsoft 时出错,请检查原因!", "-1"); exit(); } } @@ -314,19 +279,18 @@ else if($dopost=='save') UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags); $arcUrl = MakeArt($id, TRUE, TRUE, $isremote); - if($arcUrl=="") - { - $arcUrl = $cfg_phpurl."/view.php?aid=$id"; + if ($arcUrl == "") { + $arcUrl = $cfg_phpurl . "/view.php?aid=$id"; } ClearMyAddon($id, $title); - + // 自动更新关联内容 if (is_array($automake)) { foreach ($automake as $key => $value) { if (isset(${$key}) && !empty(${$key})) { $ids = explode(",", ${$key}); foreach ($ids as $id) { - MakeArt($id,true,true,$isremote); + MakeArt($id, true, true, $isremote); } } } @@ -337,7 +301,7 @@ else if($dopost=='save')   请选择你的后续操作: 发布新软件    - 继续修改 + 继续修改    查看软件    @@ -352,4 +316,4 @@ else if($dopost=='save') $win->AddMsgItem($msg); $winform = $win->GetWindow("hand", " ", FALSE); $win->Display(); -} \ No newline at end of file +} diff --git a/src/dede/spec_add.php b/src/dede/spec_add.php index 3871f267..ce253df6 100755 --- a/src/dede/spec_add.php +++ b/src/dede/spec_add.php @@ -1,23 +1,23 @@ getUserName(); - if(empty($source))$source = '未知'; + if (empty($writer)) $writer = $cuserLogin->getUserName(); + if (empty($source)) $source = '未知'; $pubdate = GetMkTime($pubdate); $senddate = time(); $sortrank = AddDay($pubdate, $sortup); - if($ishtml == 0) $ismake = -1; + if ($ishtml == 0) $ismake = -1; else $ismake = 0; $title = preg_replace('#"#', '"', $title); @@ -67,36 +65,34 @@ else if($dopost=='save') $keywords = cn_substrR($keywords, 60); $filename = trim(cn_substrR($filename, 40)); $isremote = 0; - $serviterm=empty($serviterm)? "" : $serviterm; - if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1; + $serviterm = empty($serviterm) ? "" : $serviterm; + if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) $arcrank = -1; $adminid = $cuserLogin->getUserID(); //处理上传的缩略图 - if(empty($ddisremote)) - { + if (empty($ddisremote)) { $ddisremote = 0; } $litpic = GetDDImage('none', $picname, $ddisremote); // 处理新的缩略图上传 if ($litpic_b64 != "") { - $data = explode( ',', $litpic_b64 ); + $data = explode(',', $litpic_b64); $ntime = time(); - $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime); + $savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime); CreateDir($savepath); - $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999)); - $fullUrl = $fullUrl.".png"; - - file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] )); + $fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999)); + $fullUrl = $fullUrl . ".png"; + + file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1])); // 加水印 - WaterImg($cfg_basedir.$fullUrl, 'up'); + WaterImg($cfg_basedir . $fullUrl, 'up'); $litpic = $fullUrl; } //生成文档ID $arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $adminid); - if(empty($arcID)) - { + if (empty($arcID)) { ShowMsg("无法获得主键,无法进行后续操作!", "-1"); exit(); } @@ -106,54 +102,45 @@ else if($dopost=='save') color,writer,source,litpic,pubdate,senddate,mid,voteid,notpost,description,keywords,filename) VALUES ('$arcID','$typeid','$sortrank','$flag','$ismake','$channelid','$arcrank','$click','$money','$title','$shorttitle', '$color','$writer','$source','$litpic','$pubdate','$senddate','$adminid','0','$notpost','$description','$keywords','$filename');"; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { + if (!$dsql->ExecuteNoneQuery($inQuery)) { echo $inQuery; $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeCMS官方。".str_replace('"','',$gerr),"javascript:;"); + ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请把相关信息提交给DedeCMS官方。" . str_replace('"', '', $gerr), "javascript:;"); exit(); } //专题节点列表 $arcids = array(); $notelist = ''; - for($i=1; $i<=$cfg_specnote; $i++) - { - if(!empty(${'notename'.$i})) - { - $notename = str_replace("'", "", trim(${'notename'.$i})); - $arcid = trim(${'arcid'.$i}); - $col = trim(${'col'.$i}); - $imgwidth = trim(${'imgwidth'.$i}); - $imgheight = trim(${'imgheight'.$i}); - $titlelen = trim(${'titlelen'.$i}); - $infolen = trim(${'infolen'.$i}); - $listtmp = trim(${'listtmp'.$i}); - $noteid = trim(${'noteid'.$i}); - $isauto = trim(${'isauto'.$i}); - $keywords = str_replace("'","",trim(${'keywords'.$i})); - $typeid = trim(${'typeid'.$i}); - if(!empty(${'rownum'.$i})) $rownum = trim(${'rownum'.$i}); + for ($i = 1; $i <= $cfg_specnote; $i++) { + if (!empty(${'notename' . $i})) { + $notename = str_replace("'", "", trim(${'notename' . $i})); + $arcid = trim(${'arcid' . $i}); + $col = trim(${'col' . $i}); + $imgwidth = trim(${'imgwidth' . $i}); + $imgheight = trim(${'imgheight' . $i}); + $titlelen = trim(${'titlelen' . $i}); + $infolen = trim(${'infolen' . $i}); + $listtmp = trim(${'listtmp' . $i}); + $noteid = trim(${'noteid' . $i}); + $isauto = trim(${'isauto' . $i}); + $keywords = str_replace("'", "", trim(${'keywords' . $i})); + $typeid = trim(${'typeid' . $i}); + if (!empty(${'rownum' . $i})) $rownum = trim(${'rownum' . $i}); else $rownum = 0; $arcid = preg_replace("#[^0-9,]#", "", $arcid); $ids = explode(",", $arcid); $okids = ""; - if(is_array($ids)) - { - foreach($ids as $mid) - { + if (is_array($ids)) { + foreach ($ids as $mid) { $mid = trim($mid); - if($mid=="") continue; - if(!isset($arcids[$mid])) - { - if($okids=="") - { + if ($mid == "") continue; + if (!isset($arcids[$mid])) { + if ($okids == "") { $okids .= $mid; - } - else - { - $okids .= ",".$mid; + } else { + $okids .= "," . $mid; } $arcids[$mid] = 1; } @@ -171,70 +158,60 @@ else if($dopost=='save') //分析处理附加表数据 $inadd_f = ''; $inadd_v = ''; - if(!empty($dede_addonfields)) - { + if (!empty($dede_addonfields)) { $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } $vs = explode(',', $v); - if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理 - { - ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$litpic,$keywords,$vs[1]); - } - else + if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理 { - if(!isset(${$vs[0]})) - { + ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]); + } else { + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$arcID); + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID); } - $inadd_f .= ','.$vs[0]; - $inadd_v .= " ,'".${$vs[0]}."' "; + $inadd_f .= ',' . $vs[0]; + $inadd_v .= " ,'" . ${$vs[0]} . "' "; } } } //处理图片文档的自定义属性 - if($litpic!='' && !preg_match('#p#', $flag)) - { - $flag = ($flag=='' ? 'p' : $flag.',p'); + if ($litpic != '' && !preg_match('#p#', $flag)) { + $flag = ($flag == '' ? 'p' : $flag . ',p'); } $useip = GetIP(); //加入附加表 $inQuery = "INSERT INTO `#@__addonspec`(aid,typeid,userip,templet,note{$inadd_f}) VALUES ('$arcID','$typeid','$useip','$templet','$notelist'{$inadd_v});"; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { + if (!$dsql->ExecuteNoneQuery($inQuery)) { $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); $dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'"); - ShowMsg("把数据保存到数据库附加表 addonspec 时出错,请检查原因!","-1"); + ShowMsg("把数据保存到数据库附加表 addonspec 时出错,请检查原因!", "-1"); exit(); } //生成HTML InsertTags($tags, $arcID); $artUrl = MakeArt($arcID, TRUE, TRUE, $isremote); - if($artUrl=='') - { - $artUrl = $cfg_phpurl."/view.php?aid=$arcID"; + if ($artUrl == '') { + $artUrl = $cfg_phpurl . "/view.php?aid=$arcID"; } ClearMyAddon($arcID, $title); - + // 自动更新关联内容 if (is_array($automake)) { foreach ($automake as $key => $value) { if (isset(${$key}) && !empty(${$key})) { $ids = explode(",", ${$key}); foreach ($ids as $id) { - MakeArt($id,true,true,$isremote); + MakeArt($id, true, true, $isremote); } } } @@ -256,4 +233,4 @@ else if($dopost=='save') $win->AddMsgItem($msg); $winform = $win->GetWindow("hand", " ", FALSE); $win->Display(); -} \ No newline at end of file +} diff --git a/src/dede/spec_edit.php b/src/dede/spec_edit.php index 740a87f9..fe6edbcc 100755 --- a/src/dede/spec_edit.php +++ b/src/dede/spec_edit.php @@ -1,22 +1,22 @@ GetOne($arcQuery); - if(!is_array($arcRow)) - { - ShowMsg("读取档案基本信息出错!","-1"); + if (!is_array($arcRow)) { + ShowMsg("读取档案基本信息出错!", "-1"); exit(); } $query = "SELECT * FROM `#@__channeltype` WHERE id='-1'"; $cInfos = $dsql->GetOne($query); - if(!is_array($cInfos)) - { - ShowMsg("读取频道配置信息出错!","javascript:;"); + if (!is_array($cInfos)) { + ShowMsg("读取频道配置信息出错!", "javascript:;"); exit(); } $addRow = $dsql->GetOne("SELECT * FROM `#@__addonspec` WHERE aid='$aid'"); @@ -45,27 +43,25 @@ if($dopost!='save') } /*-------------------------------- function __save(){ } --------------------------------*/ -else if($dopost=='save') -{ - require_once(DEDEINC.'/image.func.php'); - require_once(DEDEINC.'/oxwindow.class.php'); +-------------------------------*/ else if ($dopost == 'save') { + require_once(DEDEINC . '/image.func.php'); + require_once(DEDEINC . '/oxwindow.class.php'); $flag = isset($flags) ? join(',', $flags) : ''; - $notpost = isset($notpost) && $notpost == 1 ? 1: 0; - - if(!isset($tags)) $tags = ''; - $channelid= -1; + $notpost = isset($notpost) && $notpost == 1 ? 1 : 0; + + if (!isset($tags)) $tags = ''; + $channelid = -1; //处理自定义字段会用到这些变量 - if(!isset($autokey)) $autokey = 0; - if(!isset($remote)) $remote = 0; - if(!isset($dellink)) $dellink = 0; - if(!isset($autolitpic)) $autolitpic = 0; + if (!isset($autokey)) $autokey = 0; + if (!isset($remote)) $remote = 0; + if (!isset($dellink)) $dellink = 0; + if (!isset($autolitpic)) $autolitpic = 0; //对保存的内容进行处理 $pubdate = GetMkTime($pubdate); $sortrank = AddDay($pubdate, $sortup); - if($ishtml==0) $ismake = -1; + if ($ishtml == 0) $ismake = -1; else $ismake = 0; $title = cn_substrR($title, $cfg_title_maxlen); @@ -77,71 +73,63 @@ else if($dopost=='save') $keywords = trim(cn_substrR($keywords, 60)); $filename = trim(cn_substrR($filename, 40)); $isremote = 0; - $serviterm = empty($serviterm)? "" : $serviterm; - if(!TestPurview('a_Check,a_AccCheck,a_MyCheck')) - { + $serviterm = empty($serviterm) ? "" : $serviterm; + if (!TestPurview('a_Check,a_AccCheck,a_MyCheck')) { $arcrank = -1; } $adminid = $cuserLogin->getUserID(); //处理上传的缩略图 - if(empty($ddisremote)) - { + if (empty($ddisremote)) { $ddisremote = 0; } $litpic = GetDDImage('none', $picname, $ddisremote); // 处理新的缩略图上传 if ($litpic_b64 != "") { - $data = explode( ',', $litpic_b64 ); + $data = explode(',', $litpic_b64); $ntime = time(); - $savepath = $ddcfg_image_dir.'/'.MyDate($cfg_addon_savetype, $ntime); + $savepath = $ddcfg_image_dir . '/' . MyDate($cfg_addon_savetype, $ntime); CreateDir($savepath); - $fullUrl = $savepath.'/'.dd2char(MyDate('mdHis', $ntime).$cuserLogin->getUserID().mt_rand(1000, 9999)); - $fullUrl = $fullUrl.".png"; - - file_put_contents($cfg_basedir.$fullUrl, base64_decode( $data[ 1 ] )); + $fullUrl = $savepath . '/' . dd2char(MyDate('mdHis', $ntime) . $cuserLogin->getUserID() . mt_rand(1000, 9999)); + $fullUrl = $fullUrl . ".png"; + + file_put_contents($cfg_basedir . $fullUrl, base64_decode($data[1])); // 加水印 - WaterImg($cfg_basedir.$fullUrl, 'up'); + WaterImg($cfg_basedir . $fullUrl, 'up'); $litpic = $fullUrl; } - + //分析处理附加表数据 $inadd_f = ''; $inadd_v = ''; - if(!empty($dede_addonfields)) - { + if (!empty($dede_addonfields)) { $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if($vs[1]=='htmltext'||$vs[1]=='textdata') //HTML文本特殊处理 + $vs = explode(',', $v); + if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') //HTML文本特殊处理 { ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $litpic, $keywords, $vs[1]); - }else{ - if(!isset(${$vs[0]})) - { + } else { + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $arcID); } - $inadd_f .= ",`{$vs[0]}` = '".${$vs[0]}."'"; + $inadd_f .= ",`{$vs[0]}` = '" . ${$vs[0]} . "'"; } } } //处理图片文档的自定义属性 - if($litpic!='' && !preg_match('#p#',$flag)) - { - $flag = ($flag=='' ? 'p' : $flag.',p'); + if ($litpic != '' && !preg_match('#p#', $flag)) { + $flag = ($flag == '' ? 'p' : $flag . ',p'); } $inQuery = "UPDATE `#@__archives` SET typeid='$typeid', @@ -162,85 +150,61 @@ else if($dopost=='save') shorttitle='$shorttitle', filename='$filename' WHERE id='$id'; "; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { - ShowMsg("更新数据库archives表时出错,请检查!","-1"); + if (!$dsql->ExecuteNoneQuery($inQuery)) { + ShowMsg("更新数据库archives表时出错,请检查!", "-1"); exit(); } //专题节点列表 $arcids = array(); $notelist = ''; - for($i=1;$i<=$cfg_specnote;$i++) - { - if(!empty(${'notename'.$i})) - { - $notename = str_replace("'","",trim(${'notename'.$i})); - $arcid = trim(${'arcid'.$i}); - $col = trim(${'col'.$i}); - $imgwidth = trim(${'imgwidth'.$i}); - $imgheight = trim(${'imgheight'.$i}); - $titlelen = trim(${'titlelen'.$i}); - $infolen = trim(${'infolen'.$i}); - $listtmp = trim(${'listtmp'.$i}); - if(isset(${'noteid'.$i})) - { - $noteid = trim(${'noteid'.$i}); - } - else - { + for ($i = 1; $i <= $cfg_specnote; $i++) { + if (!empty(${'notename' . $i})) { + $notename = str_replace("'", "", trim(${'notename' . $i})); + $arcid = trim(${'arcid' . $i}); + $col = trim(${'col' . $i}); + $imgwidth = trim(${'imgwidth' . $i}); + $imgheight = trim(${'imgheight' . $i}); + $titlelen = trim(${'titlelen' . $i}); + $infolen = trim(${'infolen' . $i}); + $listtmp = trim(${'listtmp' . $i}); + if (isset(${'noteid' . $i})) { + $noteid = trim(${'noteid' . $i}); + } else { $noteid = $i; } - if(isset(${'isauto'.$i})) - { - $isauto = trim(${'isauto'.$i}); - } - else - { + if (isset(${'isauto' . $i})) { + $isauto = trim(${'isauto' . $i}); + } else { $isauto = 0; } - if(isset(${'keywords'.$i})) - { - $keywords = str_replace("'","",trim(${'keywords'.$i})); - } - else - { + if (isset(${'keywords' . $i})) { + $keywords = str_replace("'", "", trim(${'keywords' . $i})); + } else { $keywords = ""; } - if(!empty(${'typeid'.$i})) - { - $ttypeid = trim(${'typeid'.$i}); - } - else - { + if (!empty(${'typeid' . $i})) { + $ttypeid = trim(${'typeid' . $i}); + } else { $ttypeid = 0; } - if(!empty(${'rownum'.$i})) - { - $rownum = trim(${'rownum'.$i}); - } - else - { + if (!empty(${'rownum' . $i})) { + $rownum = trim(${'rownum' . $i}); + } else { $rownum = 0; } $arcid = preg_replace("#[^0-9,]#", "", $arcid); $ids = explode(",", $arcid); $okids = ""; - if(is_array($ids)) - { - foreach($ids as $mid) - { + if (is_array($ids)) { + foreach ($ids as $mid) { $mid = trim($mid); - if($mid=="") continue; - if(!isset($arcids[$mid])) - { - if($okids=="") - { + if ($mid == "") continue; + if (!isset($arcids[$mid])) { + if ($okids == "") { $okids .= $mid; - } - else - { - $okids .= ",".$mid; + } else { + $okids .= "," . $mid; } $arcids[$mid] = 1; } @@ -257,8 +221,7 @@ else if($dopost=='save') //更新附加表 $inQuery = "UPDATE `#@__addonspec` SET typeid ='$typeid',note='$notelist'{$inadd_f},templet='$templet' WHERE aid='$id';"; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { + if (!$dsql->ExecuteNoneQuery($inQuery)) { ShowMsg("更新数据库附加表 addonspec 时出错,请检查原因!", "-1"); exit(); } @@ -266,19 +229,18 @@ else if($dopost=='save') //生成HTML UpIndexKey($id, $arcrank, $typeid, $sortrank, $tags); $artUrl = MakeArt($id, TRUE, TRUE, $isremote); - if($artUrl=='') - { - $artUrl = $cfg_phpurl."/view.php?aid=$id"; + if ($artUrl == '') { + $artUrl = $cfg_phpurl . "/view.php?aid=$id"; } ClearMyAddon($id, $title); - + // 自动更新关联内容 if (is_array($automake)) { foreach ($automake as $key => $value) { if (isset(${$key}) && !empty(${$key})) { $ids = explode(",", ${$key}); foreach ($ids as $id) { - MakeArt($id,true,true,$isremote); + MakeArt($id, true, true, $isremote); } } } @@ -288,7 +250,7 @@ else if($dopost=='save') $msg = "  请选择你的后续操作: 发布新专题    - 查看更改 + 查看更改    查看专题    @@ -300,4 +262,4 @@ else if($dopost=='save') $win->AddMsgItem($msg); $winform = $win->GetWindow("hand", " ", FALSE); $win->Display(); -} \ No newline at end of file +} diff --git a/src/dede/stepselect_main.php b/src/dede/stepselect_main.php index dd83381e..705af297 100755 --- a/src/dede/stepselect_main.php +++ b/src/dede/stepselect_main.php @@ -1,51 +1,45 @@ Execute('me','SELECT * FROM `#@__stepselect` ORDER BY id DESC'); - while($arr = $dsql->GetArray()) - { + $dsql->Execute('me', 'SELECT * FROM `#@__stepselect` ORDER BY id DESC'); + while ($arr = $dsql->GetArray()) { $etypes[] = $arr; $egroups[$arr['egroup']] = $arr['itemname']; } - if($egroup!='') - { + if ($egroup != '') { $orderby = 'ORDER BY disorder ASC, evalue ASC'; - if(!empty($topvalue)) - { + if (!empty($topvalue)) { // 判断是否为1级联动 - if ($topvalue % 500 == 0) - { - $egroupsql = " WHERE egroup LIKE '$egroup' AND evalue>=$topvalue AND evalue < ".($topvalue + 500); - } else { + if ($topvalue % 500 == 0) { + $egroupsql = " WHERE egroup LIKE '$egroup' AND evalue>=$topvalue AND evalue < " . ($topvalue + 500); + } else { $egroupsql = " WHERE (evalue LIKE '$topvalue.%%%' OR evalue=$topvalue) AND egroup LIKE '$egroup'"; } - } - else - { + } else { $egroupsql = " WHERE egroup LIKE '$egroup' "; } $sql = "SELECT * FROM `#@__sys_enum` $egroupsql $orderby"; @@ -55,15 +49,13 @@ if(empty($action)) } //echo $sql;exit; $dlist = new DataListCP(); - $dlist->SetParameter('egroup',$egroup); - $dlist->SetParameter('topvalue',$topvalue); - $dlist->SetTemplet(DEDEADMIN."/templets/stepselect_main.htm"); + $dlist->SetParameter('egroup', $egroup); + $dlist->SetParameter('topvalue', $topvalue); + $dlist->SetTemplet(DEDEADMIN . "/templets/stepselect_main.htm"); $dlist->SetSource($sql); $dlist->display(); exit(); -} -else if($action=='edit' || $action=='addnew' || $action=='addenum' || $action=='view') -{ +} else if ($action == 'edit' || $action == 'addnew' || $action == 'addenum' || $action == 'view') { AjaxHead(); include('./templets/stepselect_showajax.htm'); exit(); @@ -71,56 +63,43 @@ else if($action=='edit' || $action=='addnew' || $action=='addenum' || $action==' /*----------------- 删除类型或枚举值 function __del() { } -------------------*/ -else if($action=='del') -{ +------------------*/ else if ($action == 'del') { $arr = $dsql->GetOne("SELECT * FROM `#@__stepselect` WHERE id='$id' "); - if(!is_array($arr)) - { - ShowMsg("无法获取分类信息,不允许后续操作!", "stepselect_main.php?".ExecTime()); + if (!is_array($arr)) { + ShowMsg("无法获取分类信息,不允许后续操作!", "stepselect_main.php?" . ExecTime()); exit(); } - if($arr['issystem']==1) - { - ShowMsg("系统内置的枚举分类不能删除!", "stepselect_main.php?".ExecTime()); + if ($arr['issystem'] == 1) { + ShowMsg("系统内置的枚举分类不能删除!", "stepselect_main.php?" . ExecTime()); exit(); } $dsql->ExecuteNoneQuery("DELETE FROM `#@__stepselect` WHERE id='$id'; "); $dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_enum` WHERE egroup='{$arr['egroup']}'; "); - ShowMsg("成功删除一个分类!", "stepselect_main.php?".ExecTime()); + ShowMsg("成功删除一个分类!", "stepselect_main.php?" . ExecTime()); exit(); -} -else if($action=='delenumAllSel') -{ - if(isset($ids) && is_array($ids)) - { +} else if ($action == 'delenumAllSel') { + if (isset($ids) && is_array($ids)) { $id = join(',', $ids); $groups = array(); $dsql->Execute('me', "SELECT egroup FROM `#@__sys_enum` WHERE id IN($id) GROUP BY egroup"); - while($row = $dsql->GetArray('me')) - { + while ($row = $dsql->GetArray('me')) { $groups[] = $row['egroup']; } $dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_enum` WHERE id IN($id); "); //更新缓存 - foreach($groups as $egropu) - { + foreach ($groups as $egropu) { WriteEnumsCache($egroup); } ShowMsg("成功删除选中的枚举分类!", $ENV_GOBACK_URL); - } - else - { + } else { ShowMsg("你没选择任何分类!", "-1"); } exit(); -} -else if($action=='delenum') -{ +} else if ($action == 'delenum') { $row = $dsql->GetOne("SELECT egroup FROM `#@__sys_enum` WHERE id = '$id' "); $dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_enum` WHERE id='{$id}'; "); WriteEnumsCache($row['egroup']); @@ -130,70 +109,58 @@ else if($action=='delenum') /*----------------- 保存类型修改 function __edit_save() { } -------------------*/ -else if($action=='edit_save') -{ - if(preg_match("#[^0-9a-z_-]#i", $egroup)) - { - ShowMsg("组名称不能有全角字符或特殊符号!","-1"); +------------------*/ else if ($action == 'edit_save') { + if (preg_match("#[^0-9a-z_-]#i", $egroup)) { + ShowMsg("组名称不能有全角字符或特殊符号!", "-1"); exit(); } $dsql->ExecuteNoneQuery("UPDATE `#@__stepselect` SET `itemname`='$itemname',`egroup`='$egroup' WHERE id='$id'; "); - ShowMsg("成功修改一个分类!", "stepselect_main.php?".ExecTime()); + ShowMsg("成功修改一个分类!", "stepselect_main.php?" . ExecTime()); exit(); } /*----------------- 保存新类型 function __addnew_save() { } -------------------*/ -else if($action=='addnew_save') -{ - if(preg_match("#[^0-9a-z_-]#i", $egroup)) - { +------------------*/ else if ($action == 'addnew_save') { + if (preg_match("#[^0-9a-z_-]#i", $egroup)) { ShowMsg("组名称不能有全角字符或特殊符号!", "-1"); exit(); } $arr = $dsql->GetOne("SELECT * FROM `#@__stepselect` WHERE itemname LIKE '$itemname' OR egroup LIKE '$egroup' "); - if(is_array($arr)) - { - ShowMsg("你指定的类别名称或组名称已经存在,不能使用!","stepselect_main.php"); + if (is_array($arr)) { + ShowMsg("你指定的类别名称或组名称已经存在,不能使用!", "stepselect_main.php"); exit(); } $dsql->ExecuteNoneQuery("INSERT INTO `#@__stepselect`(`itemname`,`egroup`,`issign`,`issystem`) VALUES('$itemname','$egroup','0','0'); "); WriteEnumsCache($egroup); - ShowMsg("成功添加一个分类!","stepselect_main.php?egroup=$egroup"); + ShowMsg("成功添加一个分类!", "stepselect_main.php?egroup=$egroup"); exit(); } /*--------- 把旧版全国省市表替换当前地区数据 function __exarea() { } -----------*/ -else if($action=='exarea') -{ +----------*/ else if ($action == 'exarea') { $bigtypes = array(); $dsql->ExecuteNoneQuery("DELETE FROM `#@__sys_enum` WHERE egroup='nativeplace'; "); $query = "SELECT * FROM `#@__area` WHERE reid =0 order by id asc"; $dsql->Execute('me', $query); $n = 1; - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $bigtypes[$row['id']] = $evalue = $disorder = $n * 500; $dsql->ExecuteNoneQuery("INSERT INTO `#@__sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`) VALUES('{$row['name']}','$evalue','nativeplace','$disorder','0'); "); - $n++; + $n++; } $stypes = array(); - foreach($bigtypes as $k=>$v) - { + foreach ($bigtypes as $k => $v) { $query = "SELECT * FROM `#@__area` WHERE reid=$k order by id asc"; $dsql->Execute('me', $query); $n = 1; - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $stypes[$row['id']] = $evalue = $disorder = $v + $n; $dsql->ExecuteNoneQuery("INSERT INTO `#@__sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`) VALUES('{$row['name']}','$evalue','nativeplace','$disorder','0'); "); - $n++; + $n++; } } WriteEnumsCache('nativeplace'); @@ -211,54 +178,44 @@ function __addenum_save() { } 新增二级枚举下添加"-N"自己类别选择,例如: 1001二级枚举下面的3级类目,则为1001-1,1001-2... 这时候需要issign=2 ----------------------*/ -else if($action=='addenum_save') -{ - if(empty($ename) || empty($egroup)) - { - Showmsg("类别名称或组名称不能为空!","-1"); - exit(); +---------------------*/ else if ($action == 'addenum_save') { + if (empty($ename) || empty($egroup)) { + Showmsg("类别名称或组名称不能为空!", "-1"); + exit(); } - if($issign == 1 || $topvalue == 0) - { + if ($issign == 1 || $topvalue == 0) { $enames = explode(',', $ename); - foreach($enames as $ename) - { + foreach ($enames as $ename) { $arr = $dsql->GetOne("SELECT * FROM `#@__sys_enum` WHERE egroup='$egroup' AND (evalue MOD 500)=0 ORDER BY disorder DESC "); - if(!is_array($arr)) $disorder = $evalue = ($issign==1 ? 1 : 500); - else $disorder = $evalue = $arr['disorder'] + ($issign==1 ? 1 : 500); - + if (!is_array($arr)) $disorder = $evalue = ($issign == 1 ? 1 : 500); + else $disorder = $evalue = $arr['disorder'] + ($issign == 1 ? 1 : 500); + $dsql->ExecuteNoneQuery("INSERT INTO `#@__sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`) - VALUES('$ename','$evalue','$egroup','$disorder','$issign'); "); + VALUES('$ename','$evalue','$egroup','$disorder','$issign'); "); } - WriteEnumsCache($egroup); - ShowMsg("成功添加枚举分类!".$dsql->GetError(), $ENV_GOBACK_URL); + WriteEnumsCache($egroup); + ShowMsg("成功添加枚举分类!" . $dsql->GetError(), $ENV_GOBACK_URL); exit(); - } else if ($issign == 2 && $topvalue != 0) - { + } else if ($issign == 2 && $topvalue != 0) { $minid = $topvalue; $maxnum = 500; // 三级子类最多500个 $enames = explode(',', $ename); - foreach ($enames as $ename) - { + foreach ($enames as $ename) { $arr = $dsql->GetOne("SELECT * FROM `#@__sys_enum` WHERE egroup='$egroup' AND evalue LIKE '$topvalue.%%%' ORDER BY evalue DESC "); - if(!is_array($arr)) - { + if (!is_array($arr)) { $disorder = $minid; - $evalue = $minid.'.001'; - } - else - { + $evalue = $minid . '.001'; + } else { $disorder = $minid; preg_match("#([0-9]{1,})\.([0-9]{1,})#", $arr['evalue'], $matchs); $addvalue = $matchs[2] + 1; $addvalue = sprintf("%03d", $addvalue); - $evalue = $matchs[1].'.'.$addvalue; + $evalue = $matchs[1] . '.' . $addvalue; } $sql = "INSERT INTO `#@__sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`) VALUES('$ename','$evalue','$egroup','$disorder','$issign'); "; // echo $sql;exit; - $dsql->ExecuteNoneQuery($sql); + $dsql->ExecuteNoneQuery($sql); } // echo $minid; WriteEnumsCache($egroup); @@ -268,17 +225,13 @@ else if($action=='addenum_save') $minid = $topvalue; $maxid = $topvalue + 500; $enames = explode(',', $ename); - foreach($enames as $ename) - { + foreach ($enames as $ename) { $arr = $dsql->GetOne("SELECT * FROM `#@__sys_enum` WHERE egroup='$egroup' AND evalue>$minid AND evalue<$maxid ORDER BY evalue DESC "); - if(!is_array($arr)) - { - $disorder = $evalue = $minid+1; - } - else - { - $disorder = $arr['disorder']+1; - $evalue = $arr['evalue']+1; + if (!is_array($arr)) { + $disorder = $evalue = $minid + 1; + } else { + $disorder = $arr['disorder'] + 1; + $evalue = $arr['evalue'] + 1; } $dsql->ExecuteNoneQuery("INSERT INTO `#@__sys_enum`(`ename`,`evalue`,`egroup`,`disorder`,`issign`) VALUES('$ename','$evalue','$egroup','$disorder','$issign'); "); @@ -291,9 +244,7 @@ else if($action=='addenum_save') /*----------------- 修改枚举名称和排序 function __upenum() { } -------------------*/ -else if($action=='upenum') -{ +------------------*/ else if ($action == 'upenum') { $ename = trim(preg_replace("# └─(─){1,}#", '', $ename)); $row = $dsql->GetOne("SELECT egroup FROM `#@__sys_enum` WHERE id = '$aid' "); WriteEnumsCache($row['egroup']); @@ -304,11 +255,9 @@ else if($action=='upenum') /*----------------- 更新枚举缓存 function __upallcache() { } -------------------*/ -else if($action=='upallcache') -{ - if(!isset($egroup)) $egroup = ''; +------------------*/ else if ($action == 'upallcache') { + if (!isset($egroup)) $egroup = ''; WriteEnumsCache($egroup); ShowMsg("成更新枚举缓存!", $ENV_GOBACK_URL); exit(); -} \ No newline at end of file +} diff --git a/src/dede/swfupload.php b/src/dede/swfupload.php index 8c4dc164..40c85424 100755 --- a/src/dede/swfupload.php +++ b/src/dede/swfupload.php @@ -1,58 +1,51 @@ getUserID().'-'.dd2char(MyDate('ymdHis', time())); - if( file_exists($cfg_basedir.$filedir.'/'.$filename.$sname) ) - { - for($i=50; $i <= 5000; $i++) - { - if( !file_exists($cfg_basedir.$filedir.'/'.$filename.'-'.$i.$sname) ) - { - $filename = $filename.'-'.$i; + $filename = $cuserLogin->getUserID() . '-' . dd2char(MyDate('ymdHis', time())); + if (file_exists($cfg_basedir . $filedir . '/' . $filename . $sname)) { + for ($i = 50; $i <= 5000; $i++) { + if (!file_exists($cfg_basedir . $filedir . '/' . $filename . '-' . $i . $sname)) { + $filename = $filename . '-' . $i; break; } } } - $fileurl = $filedir.'/'.$filename.$sname; - $rs = copy($FiledataNew, $cfg_basedir.$fileurl); + $fileurl = $filedir . '/' . $filename . $sname; + $rs = copy($FiledataNew, $cfg_basedir . $fileurl); unlink($FiledataNew); - if(!$rs) - { + if (!$rs) { echo "ERROR: Copy Uploadfile Error! "; exit(0); } //WaterImg($cfg_basedir.$fileurl, 'up'); - $title = $filename.$sname; + $title = $filename . $sname; $inquery = "INSERT INTO `#@__uploads`(title,url,mediatype,width,height,playtime,filesize,uptime,mid) - VALUES ('$title','$fileurl','$ftype','0','0','0','".filesize($cfg_basedir.$fileurl)."','".time()."','".$cuserLogin->getUserID()."'); "; - if(!empty($arcid)) - { - $inquery = "INSERT INTO `#@__uploads`(arcid,title,url,mediatype,width,height,playtime,filesize,uptime,mid) - VALUES ('$arcid','$title','$fileurl','$ftype','0','0','0','".filesize($cfg_basedir.$fileurl)."','".time()."','".$cuserLogin->getUserID()."'); "; - } - - $dsql->ExecuteNoneQuery($inquery); + VALUES ('$title','$fileurl','$ftype','0','0','0','" . filesize($cfg_basedir . $fileurl) . "','" . time() . "','" . $cuserLogin->getUserID() . "'); "; + if (!empty($arcid)) { + $inquery = "INSERT INTO `#@__uploads`(arcid,title,url,mediatype,width,height,playtime,filesize,uptime,mid) + VALUES ('$arcid','$title','$fileurl','$ftype','0','0','0','" . filesize($cfg_basedir . $fileurl) . "','" . time() . "','" . $cuserLogin->getUserID() . "'); "; + } + + $dsql->ExecuteNoneQuery($inquery); $fid = $dsql->GetLastID(); AddMyAddon($fid, $fileurl); //生成缩略图 ob_start(); - ImageResizeNew($cfg_basedir.$fileurl, $cfg_ddimg_width, $cfg_ddimg_height, '', false); + ImageResizeNew($cfg_basedir . $fileurl, $cfg_ddimg_width, $cfg_ddimg_height, '', false); $imagevariable = ob_get_contents(); ob_end_clean(); - + //保存信息到 session if (!isset($_SESSION['file_info'])) $_SESSION['file_info'] = array(); if (!isset($_SESSION['bigfile_info'])) $_SESSION['bigfile_info'] = array(); if (!isset($_SESSION['fileid'])) $_SESSION['fileid'] = 1; else $_SESSION['fileid']++; - + $_SESSION['bigfile_info'][$_SESSION['fileid']] = $fileurl; $_SESSION['file_info'][$_SESSION['fileid']] = $imagevariable; - echo "FILEID:".$_SESSION['fileid']; + echo "FILEID:" . $_SESSION['fileid']; exit(0); } /************************ //生成缩图 function GetThumbnail(){ } *************************/ -else if($dopost=='thumbnail') -{ - if( empty($id) ) - { +else if ($dopost == 'thumbnail') { + if (empty($id)) { header('HTTP/1.1 500 Internal Server Error'); echo 'No ID'; exit(0); } - if (!is_array($_SESSION['file_info']) || !isset($_SESSION['file_info'][$id])) - { + if (!is_array($_SESSION['file_info']) || !isset($_SESSION['file_info'][$id])) { header('HTTP/1.1 404 Not found'); exit(0); } header('Content-type: image/jpeg'); - header('Content-Length: '.strlen($_SESSION['file_info'][$id])); + header('Content-Length: ' . strlen($_SESSION['file_info'][$id])); echo $_SESSION['file_info'][$id]; exit(0); } /************************ //删除指定ID的图片 *************************/ -else if($dopost=='del') -{ - if(!isset($_SESSION['bigfile_info'][$id])) - { +else if ($dopost == 'del') { + if (!isset($_SESSION['bigfile_info'][$id])) { echo ''; exit(); } $dsql->ExecuteNoneQuery("DELETE FROM `#@__uploads` WHERE url LIKE '{$_SESSION['bigfile_info'][$id]}'; "); - @unlink($cfg_basedir.$_SESSION['bigfile_info'][$id]); + @unlink($cfg_basedir . $_SESSION['bigfile_info'][$id]); $_SESSION['file_info'][$id] = ''; $_SESSION['bigfile_info'][$id] = ''; echo "已删除!"; @@ -179,44 +160,39 @@ else if($dopost=='del') /************************ //获取图片地址 *************************/ -else if($dopost=='addtoedit') -{ - if(!isset($_SESSION['bigfile_info'][$id])) - { +else if ($dopost == 'addtoedit') { + if (!isset($_SESSION['bigfile_info'][$id])) { echo ''; exit(); } - echo $_SESSION['bigfile_info'][$id]; - exit(); + echo $_SESSION['bigfile_info'][$id]; + exit(); } /************************ //获取本地图片的缩略预览图 function GetddImg(){ } *************************/ -else if($dopost=='ddimg') -{ +else if ($dopost == 'ddimg') { //生成缩略图 ob_start(); - if(!preg_match("/^(http[s]?:\/\/)?([^\/]+)/i", $img)) $img = $cfg_basedir.$img; + if (!preg_match("/^(http[s]?:\/\/)?([^\/]+)/i", $img)) $img = $cfg_basedir . $img; ImageResizeNew($img, $cfg_ddimg_width, $cfg_ddimg_height, '', false); $imagevariable = ob_get_contents(); ob_end_clean(); header('Content-type: image/jpeg'); - header('Content-Length: '.strlen($imagevariable)); - echo $imagevariable; + header('Content-Length: ' . strlen($imagevariable)); + echo $imagevariable; exit(); } /************************ //删除指定的图片(编辑图集时用) *************************/ -else if($dopost=='delold') -{ - $imgfile = $cfg_basedir.$picfile; - if(!file_exists($imgfile) && !is_dir($imgfile) && preg_match("#^".$cfg_medias_dir."#", $imgfile)) - { +else if ($dopost == 'delold') { + $imgfile = $cfg_basedir . $picfile; + if (!file_exists($imgfile) && !is_dir($imgfile) && preg_match("#^" . $cfg_medias_dir . "#", $imgfile)) { @unlink($imgfile); } $dsql->ExecuteNoneQuery("DELETE FROM `#@__uploads` WHERE url LIKE '{$picfile}'; "); echo "已删除!"; exit(); -} \ No newline at end of file +} diff --git a/src/dede/sys_admin_user.php b/src/dede/sys_admin_user.php index 6319c99c..58b031b7 100755 --- a/src/dede/sys_admin_user.php +++ b/src/dede/sys_admin_user.php @@ -1,41 +1,41 @@ SetQuery("SELECT rank,typename FROM `#@__admintype` "); $dsql->Execute(); -while($row = $dsql->GetObject()) -{ +while ($row = $dsql->GetObject()) { $adminRanks[$row->rank] = $row->typename; } $query = "SELECT #@__admin.*,#@__arctype.typename FROM #@__admin LEFT JOIN #@__arctype ON #@__admin.typeid = #@__arctype.id $rank "; $dlist = new DataListCP(); -$dlist->SetTemplet(DEDEADMIN."/templets/sys_admin_user.htm"); +$dlist->SetTemplet(DEDEADMIN . "/templets/sys_admin_user.htm"); $dlist->SetSource($query); $dlist->Display(); function GetUserType($trank) { global $adminRanks; - if(isset($adminRanks[$trank])) return $adminRanks[$trank]; + if (isset($adminRanks[$trank])) return $adminRanks[$trank]; else return "错误类型"; } function GetChannel($c) { - if($c==""||$c==0) return "所有频道"; + if ($c == "" || $c == 0) return "所有频道"; else return $c; -} \ No newline at end of file +} diff --git a/src/dede/sys_admin_user_add.php b/src/dede/sys_admin_user_add.php index 206f215f..f67bb548 100755 --- a/src/dede/sys_admin_user_add.php +++ b/src/dede/sys_admin_user_add.php @@ -1,44 +1,41 @@ 请使用[0-9a-zA-Z_@!.-]内的字符!', '-1', 0, 3000); exit(); } - $safecodeok = substr(md5($cfg_cookie_encode.$randcode), 0, 24); - if($safecode != $safecodeok ) - { + $safecodeok = substr(md5($cfg_cookie_encode . $randcode), 0, 24); + if ($safecode != $safecodeok) { ShowMsg('请填写安全验证串!', '-1', 0, 3000); exit(); } $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__member` WHERE userid LIKE '$userid' "); - if($row['dd']>0) - { - ShowMsg('用户名已存在!','-1'); + if ($row['dd'] > 0) { + ShowMsg('用户名已存在!', '-1'); exit(); } $mpwd = md5($pwd); $pwd = substr(md5($pwd), 5, 20); $typeid = join(',', $typeids); - if($typeid=='0') $typeid = ''; - + if ($typeid == '0') $typeid = ''; + //关连前台会员帐号 $adminquery = "INSERT INTO `#@__member` (`mtype`,`userid`,`pwd`,`uname`,`sex`,`rank`,`money`,`email`, `scores` ,`matt` ,`face`,`safequestion`,`safeanswer` ,`jointime` ,`joinip` ,`logintime` ,`loginip` ) @@ -46,11 +43,10 @@ if($dopost=='add') $dsql->ExecuteNoneQuery($adminquery); $mid = $dsql->GetLastID(); - if($mid <= 0 ) - { - die($dsql->GetError().' 数据库出错!'); + if ($mid <= 0) { + die($dsql->GetError() . ' 数据库出错!'); } - + //后台管理员 $inquery = "INSERT INTO `#@__admin`(id,usertype,userid,pwd,uname,typeid,tname,email) VALUES('$mid','$usertype','$userid','$pwd','$uname','$typeid','$tname','$email'); "; @@ -64,7 +60,7 @@ if($dopost=='add') $adminquery = "INSERT INTO `#@__member_tj` (`mid`,`article`,`album`,`archives`,`homecount`,`pagecount`,`feedback`,`friend`,`stow`) VALUES ('$mid','0','0','0','0','0','0','0','0'); "; $dsql->ExecuteNoneQuery($adminquery); - + $adminquery = "Insert Into `#@__member_space`(`mid` ,`pagesize` ,`matt` ,`spacename` ,`spacelogo` ,`spacestyle`, `sign` ,`spacenews`) Values('$mid','10','0','{$uname}的空间','','person','',''); "; $dsql->ExecuteNoneQuery($adminquery); @@ -73,20 +69,18 @@ if($dopost=='add') exit(); } $randcode = mt_rand(10000, 99999); -$safecode = substr(md5($cfg_cookie_encode.$randcode), 0, 24); +$safecode = substr(md5($cfg_cookie_encode . $randcode), 0, 24); $typeOptions = ''; $dsql->SetQuery(" SELECT id,typename FROM `#@__arctype` WHERE reid=0 AND (ispart=0 OR ispart=1) "); $dsql->Execute('op'); -while($row = $dsql->GetObject('op')) -{ +while ($row = $dsql->GetObject('op')) { $topc = $row->id; $typeOptions .= "\r\n"; $dsql->SetQuery(" SELECT id,typename FROM `#@__arctype` WHERE reid={$row->id} AND (ispart=0 OR ispart=1) "); $dsql->Execute('s'); - while($row = $dsql->GetObject('s')) - { + while ($row = $dsql->GetObject('s')) { $typeOptions .= "\r\n"; } } make_hash(); -include DedeInclude('templets/sys_admin_user_add.htm'); \ No newline at end of file +include DedeInclude('templets/sys_admin_user_add.htm'); diff --git a/src/dede/sys_admin_user_edit.php b/src/dede/sys_admin_user_edit.php index 88d734c1..900857ad 100755 --- a/src/dede/sys_admin_user_edit.php +++ b/src/dede/sys_admin_user_edit.php @@ -1,50 +1,46 @@ ExecuteNoneQuery($query); @@ -52,72 +48,63 @@ if($dopost=='saveedit') $dsql->ExecuteNoneQuery($query); ShowMsg("成功更改一个帐户!", "sys_admin_user.php"); exit(); -} -else if($dopost=='delete') -{ - if(empty($userok)) $userok=""; - if($userok!="yes") - { +} else if ($dopost == 'delete') { + if (empty($userok)) $userok = ""; + if ($userok != "yes") { $randcode = mt_rand(10000, 99999); - $safecode = substr(md5($cfg_cookie_encode.$randcode),0,24); - require_once(DEDEINC."/oxwindow.class.php"); + $safecode = substr(md5($cfg_cookie_encode . $randcode), 0, 24); + require_once(DEDEINC . "/oxwindow.class.php"); $wintitle = "删除用户"; $wecome_info = "系统帐号管理::删除用户"; $win = new OxWindow(); - $win->Init("sys_admin_user_edit.php","js/blank.js","POST"); + $win->Init("sys_admin_user_edit.php", "js/blank.js", "POST"); $win->AddHidden("dopost", $dopost); $win->AddHidden("userok", "yes"); $win->AddHidden("randcode", $randcode); $win->AddHidden("safecode", $safecode); $win->AddHidden("id", $id); $win->AddTitle("系统警告!"); - $win->AddMsgItem("你确信要删除用户:$userid 吗?","50"); - $win->AddMsgItem("安全验证串: (复制本代码: $safecode )","30"); + $win->AddMsgItem("你确信要删除用户:$userid 吗?", "50"); + $win->AddMsgItem("安全验证串: (复制本代码: $safecode )", "30"); $winform = $win->GetWindow("ok"); $win->Display(); exit(); } - $safecodeok = substr(md5($cfg_cookie_encode.$randcode),0,24); - if($safecodeok!=$safecode) - { + $safecodeok = substr(md5($cfg_cookie_encode . $randcode), 0, 24); + if ($safecodeok != $safecode) { ShowMsg("请填写正确的安全验证串!", "sys_admin_user.php"); exit(); } //不能删除id为1的创建人帐号,不能删除自己 - $rs = $dsql->ExecuteNoneQuery2("DELETE FROM `#@__admin` WHERE id='$id' AND id<>1 AND id<>'".$cuserLogin->getUserID()."' "); - if($rs>0) - { + $rs = $dsql->ExecuteNoneQuery2("DELETE FROM `#@__admin` WHERE id='$id' AND id<>1 AND id<>'" . $cuserLogin->getUserID() . "' "); + if ($rs > 0) { //更新前台用户信息 $dsql->ExecuteNoneQuery("UPDATE `#@__member` SET matt='0' WHERE mid='$id' LIMIT 1"); - ShowMsg("成功删除一个帐户!","sys_admin_user.php"); - } - else - { - ShowMsg("不能删除id为1的创建人帐号,不能删除自己!","sys_admin_user.php",0,3000); + ShowMsg("成功删除一个帐户!", "sys_admin_user.php"); + } else { + ShowMsg("不能删除id为1的创建人帐号,不能删除自己!", "sys_admin_user.php", 0, 3000); } exit(); } //显示用户信息 -$randcode = mt_rand(10000,99999); -$safecode = substr(md5($cfg_cookie_encode.$randcode),0,24); +$randcode = mt_rand(10000, 99999); +$safecode = substr(md5($cfg_cookie_encode . $randcode), 0, 24); $typeOptions = ''; $row = $dsql->GetOne("SELECT * FROM `#@__admin` WHERE id='$id'"); $typeids = explode(',', $row['typeid']); $dsql->SetQuery("SELECT id,typename FROM `#@__arctype` WHERE reid=0 AND (ispart=0 OR ispart=1)"); $dsql->Execute('op'); -while($nrow = $dsql->GetObject('op')) -{ - $typeOptions .= "\r\n"; +while ($nrow = $dsql->GetObject('op')) { + $typeOptions .= "\r\n"; $dsql->SetQuery("SELECT id,typename FROM #@__arctype WHERE reid={$nrow->id} AND (ispart=0 OR ispart=1)"); $dsql->Execute('s'); - - while($nrow = $dsql->GetObject('s')) - { - $typeOptions .= "\r\n"; + + while ($nrow = $dsql->GetObject('s')) { + $typeOptions .= "\r\n"; } } make_hash(); -include DedeInclude('templets/sys_admin_user_edit.htm'); \ No newline at end of file +include DedeInclude('templets/sys_admin_user_edit.htm'); diff --git a/src/dede/sys_admin_user_tj.php b/src/dede/sys_admin_user_tj.php index 47029714..f0db1914 100755 --- a/src/dede/sys_admin_user_tj.php +++ b/src/dede/sys_admin_user_tj.php @@ -1,31 +1,30 @@ GetOne("SELECT userid FROM `#@__admin` WHERE id='$uid'; "); $userid = $row['userid']; $y = intval(MyDate('Y', time())); $m = intval(MyDate('m', time())); $d = intval(MyDate('d', time())); - + //全部 - $sql="SELECT addtable FROM `#@__channeltype` WHERE issystem='-1'"; + $sql = "SELECT addtable FROM `#@__channeltype` WHERE issystem='-1'"; $dsql->Execute('me', $sql); - while($frow = $dsql->GetArray('me')) - { - $dd=empty($dd)? "0" : $dd; - $cc=empty($cc)? "0" : $cc; + while ($frow = $dsql->GetArray('me')) { + $dd = empty($dd) ? "0" : $dd; + $cc = empty($cc) ? "0" : $cc; $row = $dsql->GetOne("SELECT COUNT(aid) AS dd,SUM(click) AS cc FROM `{$frow['addtable']}` WHERE mid='$uid'; "); $dd += $row['dd']; $cc += $row['cc']; @@ -33,20 +32,19 @@ if(isset($dopost) && $dopost=='getone') $row = $dsql->GetOne("SELECT COUNT(id) AS dd,SUM(click) AS cc FROM `#@__archives` WHERE mid='$uid'; "); $dd = $row['dd'] + $dd; $cc = $row['cc'] + $cc; - + //季度 $starttime = 0; - if( preg_match("#[123]#", $m) && $m < 10) $starttime = $y."-01-01 00:00:00"; - else if( preg_match("#[456]#", $m) ) $starttime = $y."-04-01 00:00:00"; - else if( preg_match("#[789]#", $m) ) $starttime = $y."-07-01 00:00:00"; - else $starttime = $y."-10-01 00:00:00"; + if (preg_match("#[123]#", $m) && $m < 10) $starttime = $y . "-01-01 00:00:00"; + else if (preg_match("#[456]#", $m)) $starttime = $y . "-04-01 00:00:00"; + else if (preg_match("#[789]#", $m)) $starttime = $y . "-07-01 00:00:00"; + else $starttime = $y . "-10-01 00:00:00"; $istarttime = GetMkTime($starttime); - $sql="SELECT addtable FROM `#@__channeltype` WHERE issystem='-1'"; + $sql = "SELECT addtable FROM `#@__channeltype` WHERE issystem='-1'"; $dsql->Execute('me', $sql); - while($frow = $dsql->GetArray('me')) - { - $dds = empty($dds)? "0" : $dds; - $ccs = empty($ccs)? "0" : $ccs; + while ($frow = $dsql->GetArray('me')) { + $dds = empty($dds) ? "0" : $dds; + $ccs = empty($ccs) ? "0" : $ccs; $row = $dsql->GetOne("SELECT COUNT(aid) AS dd,SUM(click) AS cc FROM `{$frow['addtable']}` WHERE senddate>$istarttime AND mid='$uid'; "); $dds += $row['dd']; $ccs += $row['cc']; @@ -54,16 +52,15 @@ if(isset($dopost) && $dopost=='getone') $row = $dsql->GetOne("SELECT COUNT(id) AS dd,SUM(click) AS cc FROM `#@__archives` WHERE senddate>$istarttime AND mid='$uid'; "); $dds = $row['dd'] + $dds; $ccs = $row['cc'] + $ccs; - + //当月 - $starttime = $y."-{$m}-01 00:00:00"; + $starttime = $y . "-{$m}-01 00:00:00"; $istarttime = GetMkTime($starttime); - $sql="SELECT addtable FROM `#@__channeltype` WHERE issystem='-1'"; + $sql = "SELECT addtable FROM `#@__channeltype` WHERE issystem='-1'"; $dsql->Execute('me', $sql); - while($frow = $dsql->GetArray('me')) - { - $ddm = empty($ddm)? "0" : $ddm; - $ccm = empty($ccm)? "0" : $ccm; + while ($frow = $dsql->GetArray('me')) { + $ddm = empty($ddm) ? "0" : $ddm; + $ccm = empty($ccm) ? "0" : $ccm; $row = $dsql->GetOne("SELECT COUNT(aid) AS dd,SUM(click) AS cc FROM `{$frow['addtable']}` WHERE senddate>$istarttime AND mid='$uid'; "); $ddm += $row['dd']; $ccm += $row['cc']; @@ -71,16 +68,15 @@ if(isset($dopost) && $dopost=='getone') $row = $dsql->GetOne("SELECT COUNT(id) AS dd,SUM(click) AS cc FROM `#@__archives` WHERE senddate>$istarttime AND mid='$uid'; "); $ddm = $row['dd'] + $ddm; $ccm = $row['cc'] + $ccm; - + //本周 - $starttime = $y."-{$m}-{$d} 00:00:00"; - $istarttime = GetMkTime($starttime) - (7*24*3600); - $sql="SELECT addtable FROM `#@__channeltype` WHERE issystem='-1'"; + $starttime = $y . "-{$m}-{$d} 00:00:00"; + $istarttime = GetMkTime($starttime) - (7 * 24 * 3600); + $sql = "SELECT addtable FROM `#@__channeltype` WHERE issystem='-1'"; $dsql->Execute('me', $sql); - while($frow = $dsql->GetArray('me')) - { - $ddw=empty($ddw)? "0" : $ddw; - $ccw=empty($ccw)? "0" : $ccw; + while ($frow = $dsql->GetArray('me')) { + $ddw = empty($ddw) ? "0" : $ddw; + $ccw = empty($ccw) ? "0" : $ccw; $row = $dsql->GetOne("SELECT COUNT(aid) AS dd,SUM(click) AS cc FROM `{$frow['addtable']}` WHERE senddate>$istarttime AND mid='$uid'; "); $ddw += $row['dd']; $ccw += $row['cc']; @@ -88,16 +84,15 @@ if(isset($dopost) && $dopost=='getone') $row = $dsql->GetOne("SELECT COUNT(id) AS dd,SUM(click) AS cc FROM `#@__archives` WHERE senddate>$istarttime AND mid='$uid'; "); $ddw = $row['dd'] + $ddw; $ccw = $row['cc'] + $ccw; - + //当天 - $starttime = $y."-{$m}-{$d} 00:00:00"; + $starttime = $y . "-{$m}-{$d} 00:00:00"; $istarttime = GetMkTime($starttime); - $sql="SELECT addtable FROM `#@__channeltype` WHERE issystem='-1'"; + $sql = "SELECT addtable FROM `#@__channeltype` WHERE issystem='-1'"; $dsql->Execute('me', $sql); - while($frow = $dsql->GetArray('me')) - { - $ddd=empty($ddd)? "0" : $ddd; - $ccd=empty($ccd)? "0" : $ccd; + while ($frow = $dsql->GetArray('me')) { + $ddd = empty($ddd) ? "0" : $ddd; + $ccd = empty($ccd) ? "0" : $ccd; $row = $dsql->GetOne("SELECT COUNT(aid) AS dd,SUM(click) AS cc FROM `{$frow['addtable']}` WHERE senddate>$istarttime AND mid='$uid'; "); $ddd += $row['dd']; $ccd += $row['cc']; @@ -105,7 +100,7 @@ if(isset($dopost) && $dopost=='getone') $row = $dsql->GetOne("SELECT COUNT(id) AS dd,SUM(click) AS cc FROM `#@__archives` WHERE senddate>$istarttime AND mid='$uid'; "); $ddd = $row['dd'] + $ddd; $ccd = $row['cc'] + $ccd; - + $msg = " @@ -129,4 +124,4 @@ if(isset($dopost) && $dopost=='getone') exit(); } -include DedeInclude('templets/sys_admin_user_tj.htm'); \ No newline at end of file +include DedeInclude('templets/sys_admin_user_tj.htm'); diff --git a/src/dede/sys_cache_up.php b/src/dede/sys_cache_up.php index 6cf8553e..8fde3088 100755 --- a/src/dede/sys_cache_up.php +++ b/src/dede/sys_cache_up.php @@ -1,41 +1,38 @@ '; + else if ($step == 3) { + echo ''; $dsql->ExecuteNoneQuery("DELETE FROM `#@__arccache`"); echo "\n成功更新arclist调用缓存,准备清理过期会员访问历史...
"; $oldtime = time() - (90 * 24 * 3600); $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_pms` WHERE sendtime<'$oldtime' "); echo "成功清理过期短信,准备修正错误文档,这可能要占较长的时间..."; - if($uparc == 1) - { + if ($uparc == 1) { echo ""; - } - else - { + } else { echo ""; } exit(); } //修正错误文档 - else if($step == 9) - { - ShowMsg('修正错误文档操作已经取消,请在<系统->系统错误修复[S]>中操作...','sys_cache_up.php?dopost=ok&step=-1&uparc=1',0,5000); - exit(); + else if ($step == 9) { + ShowMsg('修正错误文档操作已经取消,请在<系统->系统错误修复[S]>中操作...', 'sys_cache_up.php?dopost=ok&step=-1&uparc=1', 0, 5000); + exit(); } } -include DedeInclude('templets/sys_cache_up.htm'); \ No newline at end of file +include DedeInclude('templets/sys_cache_up.htm'); diff --git a/src/dede/sys_data.php b/src/dede/sys_data.php index 4976f770..686a64ee 100755 --- a/src/dede/sys_data.php +++ b/src/dede/sys_data.php @@ -1,80 +1,63 @@ 关闭]\r\n"; - if(empty($tablename)) - { + if (empty($tablename)) { echo "没有指定表名!"; - } - else - { - $dsql->SetQuery("SHOW CREATE TABLE ".$dsql->dbName.".".$tablename); + } else { + $dsql->SetQuery("SHOW CREATE TABLE " . $dsql->dbName . "." . $tablename); $dsql->Execute('me'); - $row2 = $dsql->GetArray('me',MYSQL_BOTH); + $row2 = $dsql->GetArray('me', MYSQL_BOTH); $ctinfo = $row2[1]; echo trim($ctinfo); } echo ''; exit(); -} -else if($dopost=="opimize") //优化表 +} else if ($dopost == "opimize") //优化表 { echo "[关闭]\r\n"; - if(empty($tablename)) - { + if (empty($tablename)) { echo "没有指定表名!"; - } - else - { + } else { $rs = $dsql->ExecuteNoneQuery("OPTIMIZE TABLE `$tablename` "); - if($rs) - { + if ($rs) { echo "执行优化表: $tablename OK!"; - } - else - { - echo "执行优化表: $tablename 失败,原因是:".$dsql->GetError(); + } else { + echo "执行优化表: $tablename 失败,原因是:" . $dsql->GetError(); } } echo ''; exit(); -} -else if($dopost=="repair") //修复表 +} else if ($dopost == "repair") //修复表 { echo "[关闭]\r\n"; - if(empty($tablename)) - { + if (empty($tablename)) { echo "没有指定表名!"; - } - else - { + } else { $rs = $dsql->ExecuteNoneQuery("REPAIR TABLE `$tablename` "); - if($rs) - { + if ($rs) { echo "修复表: $tablename OK!"; - } - else - { - echo "修复表: $tablename 失败,原因是:".$dsql->GetError(); + } else { + echo "修复表: $tablename 失败,原因是:" . $dsql->GetError(); } } echo ''; @@ -82,33 +65,28 @@ else if($dopost=="repair") //修复表 } //获取系统存在的表信息 -$otherTables = Array(); -$dedeSysTables = Array(); -$channelTables = Array(); +$otherTables = array(); +$dedeSysTables = array(); +$channelTables = array(); $dsql->SetQuery("SELECT addtable FROM `#@__channeltype` "); $dsql->Execute(); -while($row = $dsql->GetObject()) -{ +while ($row = $dsql->GetObject()) { $channelTables[] = $row->addtable; } $dsql->SetQuery("SHOW TABLES"); $dsql->Execute('t'); -while($row = $dsql->GetArray('t',MYSQL_BOTH)) -{ - if(preg_match("#^{$cfg_dbprefix}#", $row[0])||in_array($row[0],$channelTables)) - { +while ($row = $dsql->GetArray('t', MYSQL_BOTH)) { + if (preg_match("#^{$cfg_dbprefix}#", $row[0]) || in_array($row[0], $channelTables)) { $dedeSysTables[] = $row[0]; - } - else - { + } else { $otherTables[] = $row[0]; } } $mysql_version = $dsql->GetVersion(); include DedeInclude('templets/sys_data.htm'); -function TjCount($tbname,&$dsql) +function TjCount($tbname, &$dsql) { $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM $tbname"); return $row['dd']; -} \ No newline at end of file +} diff --git a/src/dede/sys_data_done.php b/src/dede/sys_data_done.php index 304b7d05..eba9ed32 100755 --- a/src/dede/sys_data_done.php +++ b/src/dede/sys_data_done.php @@ -4,7 +4,7 @@ * 数据库操作 * * @version $Id: sys_data_done.php 1 17:19 2010年7月20日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -276,8 +276,8 @@ function PutInfo($msg1, $msg2) - DedeCMS 提示信息 - \n\n\n
{$msg2}"; + DedeBIZ 提示信息 + \n\n\n
{$msg2}"; echo $msginfo . "\n\n"; } diff --git a/src/dede/sys_data_replace.php b/src/dede/sys_data_replace.php index fabcb196..c798740b 100755 --- a/src/dede/sys_data_replace.php +++ b/src/dede/sys_data_replace.php @@ -1,35 +1,32 @@ GetTableFields($exptable); echo "
"; - echo "表(".$exptable.")含有的字段:
"; - while($row = $dsql->GetFieldObject()) - { - echo "name}')\">".$row->name."\r\n"; + echo "表(" . $exptable . ")含有的字段:
"; + while ($row = $dsql->GetFieldObject()) { + echo "name}')\">" . $row->name . "\r\n"; } echo "
"; exit(); @@ -37,64 +34,50 @@ else if($action=='getfields') /*------------------------------- //保存用户设置,清空会员数据 function __Apply() ---------------------------------*/ -else if($action=='apply') -{ +--------------------------------*/ else if ($action == 'apply') { $validate = empty($validate) ? '' : strtolower($validate); $svali = GetCkVdValue(); - if($validate == "" || $validate != $svali) - { + if ($validate == "" || $validate != $svali) { ShowMsg("安全确认码不正确!", "javascript:;"); exit(); } - if($exptable == '' || $rpfield == '') - { + if ($exptable == '' || $rpfield == '') { ShowMsg("请指定数据表和字段!", "javascript:;"); exit(); } - if($rpstring=='') - { + if ($rpstring == '') { ShowMsg("请指定被替换内容!", "javascript:;"); exit(); } - if($rptype=='replace') - { + if ($rptype == 'replace') { $condition = empty($condition) ? '' : " WHERE $condition "; $rs = $dsql->ExecuteNoneQuery("UPDATE $exptable SET $rpfield=REPLACE($rpfield,'$rpstring','$tostring') $condition "); $dsql->ExecuteNoneQuery("OPTIMIZE TABLE `$exptable`"); - if($rs) - { + if ($rs) { ShowMsg("成功完成数据替换!", "javascript:;"); exit(); - } - else - { + } else { ShowMsg("数据替换失败!", "javascript:;"); exit(); } - } - else - { + } else { $condition = empty($condition) ? '' : " And $condition "; $rpstring = stripslashes($rpstring); - $rpstring2 = str_replace("\\","\\\\",$rpstring); - $rpstring2 = str_replace("'","\\'",$rpstring2); + $rpstring2 = str_replace("\\", "\\\\", $rpstring); + $rpstring2 = str_replace("'", "\\'", $rpstring2); $dsql->SetQuery("SELECT $keyfield,$rpfield FROM $exptable WHERE $rpfield REGEXP '$rpstring2' $condition "); $dsql->Execute(); $tt = $dsql->GetTotalRow(); - if($tt==0) - { - ShowMsg("根据你指定的正则,找不到任何东西!","javascript:;"); + if ($tt == 0) { + ShowMsg("根据你指定的正则,找不到任何东西!", "javascript:;"); exit(); } $oo = 0; - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $kid = $row[$keyfield]; - $rpf = preg_replace("#".$rpstring."#i", $tostring, $row[$rpfield]); + $rpf = preg_replace("#" . $rpstring . "#i", $tostring, $row[$rpfield]); $rs = $dsql->ExecuteNoneQuery("UPDATE $exptable SET $rpfield='$rpf' WHERE $keyfield='$kid' "); - if($rs) - { + if ($rs) { $oo++; } } @@ -102,4 +85,4 @@ else if($action=='apply') ShowMsg("共找到 $tt 条记录,成功替换了 $oo 条!", "javascript:;"); exit(); } -} \ No newline at end of file +} diff --git a/src/dede/sys_data_revert.php b/src/dede/sys_data_revert.php index 4a3b951b..82b3d830 100755 --- a/src/dede/sys_data_revert.php +++ b/src/dede/sys_data_revert.php @@ -1,31 +1,27 @@ read()) !== false) -{ - if(!preg_match("#txt$#", $filename)) - { +while (($filename = $dh->read()) !== false) { + if (!preg_match("#txt$#", $filename)) { continue; } - if(preg_match("#tables_struct#", $filename)) - { + if (preg_match("#tables_struct#", $filename)) { $structfile = $filename; - } - else if( filesize("$bkdir/$filename") >0 ) - { + } else if (filesize("$bkdir/$filename") > 0) { $filelists[] = $filename; } } $dh->close(); -include DedeInclude('templets/sys_data_revert.htm'); \ No newline at end of file +include DedeInclude('templets/sys_data_revert.htm'); diff --git a/src/dede/sys_group.php b/src/dede/sys_group.php index 06e5e4ac..282ebed5 100755 --- a/src/dede/sys_group.php +++ b/src/dede/sys_group.php @@ -1,14 +1,15 @@ GetOne("SELECT * FROM #@__admintype WHERE rank='".$rankid."'"); - if(is_array($row)) - { +if (!empty($dopost)) { + $row = $dsql->GetOne("SELECT * FROM #@__admintype WHERE rank='" . $rankid . "'"); + if (is_array($row)) { ShowMsg('你所创建的组别的级别值已存在,不允许重复!', '-1'); exit(); } - if($rankid > 10) - { + if ($rankid > 10) { ShowMsg('组级别值不能大于10, 否则一切权限设置均无效!', '-1'); exit(); } $AllPurviews = ''; - if(is_array($purviews)) - { - foreach($purviews as $pur) - { - $AllPurviews = $pur.' '; + if (is_array($purviews)) { + foreach ($purviews as $pur) { + $AllPurviews = $pur . ' '; } $AllPurviews = trim($AllPurviews); } @@ -36,4 +32,4 @@ if(!empty($dopost)) ShowMsg("成功创建一个新的用户组!", "sys_group.php"); exit(); } -include DedeInclude('templets/sys_group_add.htm'); \ No newline at end of file +include DedeInclude('templets/sys_group_add.htm'); diff --git a/src/dede/sys_group_edit.php b/src/dede/sys_group_edit.php index acc37ed6..1ad4ea60 100755 --- a/src/dede/sys_group_edit.php +++ b/src/dede/sys_group_edit.php @@ -1,29 +1,26 @@ ExecuteNoneQuery("UPDATE `#@__admintype` SET typename='$typename',purviews='$purview' WHERE CONCAT(`rank`)='$rank'"); ShowMsg('成功更改用户组的权限!', 'sys_group.php'); exit(); -} -else if($dopost=='del') -{ +} else if ($dopost == 'del') { $dsql->ExecuteNoneQuery("DELETE FROM `#@__admintype` WHERE CONCAT(`rank`)='$rank' AND system='0';"); - ShowMsg("成功删除一个用户组!","sys_group.php"); + ShowMsg("成功删除一个用户组!", "sys_group.php"); exit(); } -$groupRanks = Array(); +$groupRanks = array(); $groupSet = $dsql->GetOne("SELECT * FROM `#@__admintype` WHERE CONCAT(`rank`)='{$rank}' "); $groupRanks = explode(' ', $groupSet['purviews']); include DedeInclude('templets/sys_group_edit.htm'); @@ -47,5 +42,5 @@ include DedeInclude('templets/sys_group_edit.htm'); function CRank($n) { global $groupRanks; - return in_array($n,$groupRanks) ? ' checked' : ''; -} \ No newline at end of file + return in_array($n, $groupRanks) ? ' checked' : ''; +} diff --git a/src/dede/sys_info.php b/src/dede/sys_info.php index d242fa89..50f97f56 100755 --- a/src/dede/sys_info.php +++ b/src/dede/sys_info.php @@ -1,61 +1,52 @@ SetQuery("SELECT `varname`,`type`,`value`,`groupid` FROM `#@__sysconfig` ORDER BY aid ASC "); $dsql->Execute(); - while($row = $dsql->GetArray()) - { - if($row['type']=='number') - { - if($row['value']=='') $row['value'] = 0; - fwrite($fp,"\${$row['varname']} = ".$row['value'].";\r\n"); - } - else - { - fwrite($fp,"\${$row['varname']} = '".str_replace("'",'',$row['value'])."';\r\n"); + while ($row = $dsql->GetArray()) { + if ($row['type'] == 'number') { + if ($row['value'] == '') $row['value'] = 0; + fwrite($fp, "\${$row['varname']} = " . $row['value'] . ";\r\n"); + } else { + fwrite($fp, "\${$row['varname']} = '" . str_replace("'", '', $row['value']) . "';\r\n"); } } - fwrite($fp,"?".">"); + fwrite($fp, "?" . ">"); fclose($fp); } //保存配置的改动 -if($dopost=="save") -{ +if ($dopost == "save") { CheckCSRF(); - foreach($_POST as $k=>$v) - { - if(preg_match("#^edit___#", $k)) - { + foreach ($_POST as $k => $v) { + if (preg_match("#^edit___#", $k)) { $v = cn_substrR(${$k}, 1024); - } - else - { + } else { continue; } $k = preg_replace("#^edit___#", "", $k); @@ -66,23 +57,19 @@ if($dopost=="save") exit(); } //增加新变量 -else if($dopost=='add') -{ +else if ($dopost == 'add') { CheckCSRF(); - if($vartype=='bool' && ($nvarvalue!='Y' && $nvarvalue!='N')) - { - ShowMsg("布尔变量值必须为'Y'或'N'!","-1"); + if ($vartype == 'bool' && ($nvarvalue != 'Y' && $nvarvalue != 'N')) { + ShowMsg("布尔变量值必须为'Y'或'N'!", "-1"); exit(); } - if(trim($nvarname)=='' || preg_match("#[^a-z_]#i", $nvarname) ) - { - ShowMsg("变量名不能为空并且必须为[a-z_]组成!","-1"); + if (trim($nvarname) == '' || preg_match("#[^a-z_]#i", $nvarname)) { + ShowMsg("变量名不能为空并且必须为[a-z_]组成!", "-1"); exit(); } $row = $dsql->GetOne("SELECT varname FROM `#@__sysconfig` WHERE varname LIKE '$nvarname' "); - if(is_array($row)) - { - ShowMsg("该变量名称已经存在!","-1"); + if (is_array($row)) { + ShowMsg("该变量名称已经存在!", "-1"); exit(); } $row = $dsql->GetOne("SELECT aid FROM `#@__sysconfig` ORDER BY aid DESC "); @@ -90,26 +77,22 @@ else if($dopost=='add') $inquery = "INSERT INTO `#@__sysconfig`(`aid`,`varname`,`info`,`value`,`type`,`groupid`) VALUES ('$aid','$nvarname','$varmsg','$nvarvalue','$vartype','$vargroup')"; $rs = $dsql->ExecuteNoneQuery($inquery); - if(!$rs) - { + if (!$rs) { ShowMsg("新增变量失败,可能有非法字符!", "sys_info.php?gp=$vargroup"); exit(); } - if(!is_writeable($configfile)) - { - ShowMsg("成功保存变量,但由于 $configfile 无法写入,因此不能更新配置文件!","sys_info.php?gp=$vargroup"); + if (!is_writeable($configfile)) { + ShowMsg("成功保存变量,但由于 $configfile 无法写入,因此不能更新配置文件!", "sys_info.php?gp=$vargroup"); exit(); - }else - { + } else { ReWriteConfig(); - ShowMsg("成功保存变量并更新配置文件!","sys_info.php?gp=$vargroup"); + ShowMsg("成功保存变量并更新配置文件!", "sys_info.php?gp=$vargroup"); exit(); } } // 搜索配置 -else if ($dopost=='search') -{ - $keywords = isset($keywords)? strip_tags($keywords) : ''; +else if ($dopost == 'search') { + $keywords = isset($keywords) ? strip_tags($keywords) : ''; $i = 1; $configstr = << @@ -121,66 +104,59 @@ else if ($dopost=='search') EOT; echo $configstr; - if ($keywords) - { + if ($keywords) { $dsql->SetQuery("SELECT * FROM `#@__sysconfig` WHERE info LIKE '%$keywords%' OR varname LIKE '%$keywords%' order by aid asc"); $dsql->Execute(); - + while ($row = $dsql->GetArray()) { - $bgcolor = ($i++%2==0)? "#F9FCEF" : "#ffffff"; - $row['info'] = preg_replace("#{$keywords}#", ''.$keywords.'', $row['info']); - $row['varname'] = preg_replace("#{$keywords}#", ''.$keywords.'', $row['varname']); + $bgcolor = ($i++ % 2 == 0) ? "#F9FCEF" : "#ffffff"; + $row['info'] = preg_replace("#{$keywords}#", '' . $keywords . '', $row['info']); + $row['varname'] = preg_replace("#{$keywords}#", '' . $keywords . '', $row['varname']); ?> - - - + + + + + +
管理员↓|统计信息→
+
+ 是"; + echo ""; + } else if ($row['type'] == 'bstring') { + echo ""; + } else if ($row['type'] == 'number') { + echo ""; + } else { + echo ""; + } + ?> +
是"; - echo ""; - }else if($row['type']=='bstring') - { - echo ""; - }else if($row['type']=='number') - { - echo ""; - }else - { - echo ""; - } - ?> - - - - - - 没有找到搜索的内容 '; } exit; -} else if ($dopost=='make_encode') -{ - $chars='abcdefghigklmnopqrstuvwxwyABCDEFGHIGKLMNOPQRSTUVWXWY0123456789'; - $hash=''; - $length = rand(28,32); +} else if ($dopost == 'make_encode') { + $chars = 'abcdefghigklmnopqrstuvwxwyABCDEFGHIGKLMNOPQRSTUVWXWY0123456789'; + $hash = ''; + $length = rand(28, 32); $max = strlen($chars) - 1; - for($i = 0; $i < $length; $i++) { + for ($i = 0; $i < $length; $i++) { $hash .= $chars[mt_rand(0, $max)]; } echo $hash; exit(); } -include DedeInclude('templets/sys_info.htm'); \ No newline at end of file +include DedeInclude('templets/sys_info.htm'); diff --git a/src/dede/sys_info_mark.php b/src/dede/sys_info_mark.php index 7c281f53..53d4ceb3 100755 --- a/src/dede/sys_info_mark.php +++ b/src/dede/sys_info_mark.php @@ -1,68 +1,59 @@ \r\n"; - $fp = fopen($ImageWaterConfigFile,"w") or die("写入文件 $ImageWaterConfigFile 失败,请检查权限!"); - fwrite($fp,$configstr); + $configstr = "<" . "?php\r\n" . $configstr . "?" . ">\r\n"; + $fp = fopen($ImageWaterConfigFile, "w") or die("写入文件 $ImageWaterConfigFile 失败,请检查权限!"); + fwrite($fp, $configstr); fclose($fp); echo "\r\n"; } require_once($ImageWaterConfigFile); -include DedeInclude('templets/sys_info_mark.htm'); \ No newline at end of file +include DedeInclude('templets/sys_info_mark.htm'); diff --git a/src/dede/sys_passport.php b/src/dede/sys_passport.php index e1a56be7..d543d7f7 100755 --- a/src/dede/sys_passport.php +++ b/src/dede/sys_passport.php @@ -1,30 +1,29 @@ '; + $configstr = '<' . '?' . "\r\n" . $configstr . '?' . '>'; $fp = fopen($ConfigFile, "w") or die("写入文件 $ConfigFile 失败,请检查权限!"); fwrite($fp, $configstr); fclose($fp); - echo "\r\n"; + echo "\r\n"; } -include DedeInclude('templets/sys_passport.htm'); \ No newline at end of file +include DedeInclude('templets/sys_passport.htm'); diff --git a/src/dede/sys_payment.php b/src/dede/sys_payment.php index 81f1190b..be8dfee4 100755 --- a/src/dede/sys_payment.php +++ b/src/dede/sys_payment.php @@ -1,19 +1,20 @@ 1) - { + if (count($formarray) > 1) { $this->FormArray = $formarray; - //var_dump($this->FormArray); + //var_dump($this->FormArray); $this->SetDefaultTpl(); } } - + //析构函数,兼容PHP4 /* function Array2form($formarray = array()) @@ -68,95 +68,89 @@ class Array2form $this->__construct($formarray); } */ - + //获取一个特定项目的表单 function GetIterm($itermid = '', $itermtype = 1) { $reval = $reval_form = $reval_title = $reval_des = $myformItem = ''; - if(is_array($this->FormArray)) - { + if (is_array($this->FormArray)) { foreach ($this->FormArray as $key => $val) { - if($key == $itermid) - { + if ($key == $itermid) { $reval_title = $val['title']; $reval_des = $val['description']; - $reval_form = $this->GetForm($key,$val, $val['type']); + $reval_form = $this->GetForm($key, $val, $val['type']); //进行模板标签替换 - if($itermtype == 1) - $reval = preg_replace(array("/~title~/","/~form~/","/~description~/"), - array($reval_title, $reval_form, $reval_des), $this->ArrFromTPL); - else return $reval_form; + if ($itermtype == 1) + $reval = preg_replace( + array("/~title~/", "/~form~/", "/~description~/"), + array($reval_title, $reval_form, $reval_des), + $this->ArrFromTPL + ); + else return $reval_form; } } } else { return FALSE; } - return empty($reval)? '' : $reval; + return empty($reval) ? '' : $reval; } - - function GetForm($key, $formarry = array(), $formtype='text') + + function GetForm($key, $formarry = array(), $formtype = 'text') { - switch ($formtype) - { + switch ($formtype) { case 'text': //生成文本编辑框 - $valstr=(empty($formarry['value']))? "value=''" : "value='{$formarry['value']}'"; + $valstr = (empty($formarry['value'])) ? "value=''" : "value='{$formarry['value']}'"; $reval_form = ""; - break; + break; case 'select': //生成选择框 $reval_title = $formarry['title']; - $items = explode(',',$formarry['iterm']); + $items = explode(',', $formarry['iterm']); $reval_form = "\r\n"; - break; + break; } return $reval_form; } - - + + //获取所有的表单内容 function GetAll() { - $reval=empty($reval)? '' : $reval; - if(is_array($this->FormArray)) - { - foreach ($this->FormArray as $key => $val) - { + $reval = empty($reval) ? '' : $reval; + if (is_array($this->FormArray)) { + foreach ($this->FormArray as $key => $val) { $reval .= $this->GetIterm($key); } return $reval; - }else{ - return FALSE; + } else { + return FALSE; } } - + //获取一个特定项目的表单 function SetDefaultTpl($tplname = '') { - if(empty($tplname)) - { + if (empty($tplname)) { $this->ArrFromTPL = '

~title~:~form~~description~

'; } else { - if(file_exists($tplname)) $this->ArrFromTPL = file_get_contents($tplname); - else $this->ArrFromTPL = $tplname; + if (file_exists($tplname)) $this->ArrFromTPL = file_get_contents($tplname); + else $this->ArrFromTPL = $tplname; } } } @@ -168,15 +162,12 @@ $tplstring = " "; //安装支付接口 -if($dopost=='install') -{ +if ($dopost == 'install') { $row = $dsql->GetOne("SELECT * FROM `#@__payment` WHERE id='$pid'"); - if(is_array($row)) - { - if($cfg_soft_lang == 'utf-8') - { + if (is_array($row)) { + if ($cfg_soft_lang == 'utf-8') { $config_row = AutoCharset(unserialize(utf82gb($row['config']))); - }else if($cfg_soft_lang == 'gb2312'){ + } else if ($cfg_soft_lang == 'gb2312') { $config_row = unserialize($row['config']); } //print_r($config_row);exit; @@ -186,84 +177,75 @@ if($dopost=='install') } include DedeInclude('templets/sys_payment_install.htm'); exit; -} +} //配置支付接口 -else if($dopost=='config') -{ - if($pay_name=="" || $pay_desc=="" || $pay_fee=="") - { - ShowMsg("您有未填写的项目!","-1"); +else if ($dopost == 'config') { + if ($pay_name == "" || $pay_desc == "" || $pay_fee == "") { + ShowMsg("您有未填写的项目!", "-1"); exit(); } $row = $dsql->GetOne("SELECT * FROM `#@__payment` WHERE id='$pid'"); - if($cfg_soft_lang == 'utf-8') - { + if ($cfg_soft_lang == 'utf-8') { $config = AutoCharset(unserialize(utf82gb($row['config']))); - }else if($cfg_soft_lang == 'gb2312'){ + } else if ($cfg_soft_lang == 'gb2312') { $config = unserialize($row['config']); } - $payments = "'code' => '".$row['code']."',"; - foreach ($config as $key => $v) - { + $payments = "'code' => '" . $row['code'] . "',"; + foreach ($config as $key => $v) { $config[$key]['value'] = ${$key}; - $payments .= "'".$key."' => '".$config[$key]['value']."',"; + $payments .= "'" . $key . "' => '" . $config[$key]['value'] . "',"; } $payments = substr($payments, 0, -1); - $payment = "\$payment=array(".$payments.")"; - $configstr = "<"."?php\r\n".$payment."\r\n?".">\r\n"; - if(!empty($payment)) - { - $m_file = DEDEDATA."/payment/".$row['code'].".php"; - $fp = fopen($m_file,"w") or die("写入文件 $safeconfigfile 失败,请检查权限!"); - fwrite($fp,$configstr); + $payment = "\$payment=array(" . $payments . ")"; + $configstr = "<" . "?php\r\n" . $payment . "\r\n?" . ">\r\n"; + if (!empty($payment)) { + $m_file = DEDEDATA . "/payment/" . $row['code'] . ".php"; + $fp = fopen($m_file, "w") or die("写入文件 $safeconfigfile 失败,请检查权限!"); + fwrite($fp, $configstr); fclose($fp); } - if($cfg_soft_lang == 'utf-8') - { - $config = AutoCharset($config,'utf-8','gb2312'); + if ($cfg_soft_lang == 'utf-8') { + $config = AutoCharset($config, 'utf-8', 'gb2312'); $config = serialize($config); $config = gb2utf8($config); - }else{ + } else { $config = serialize($config); } - + $query = "UPDATE `#@__payment` SET name = '$pay_name',fee='$pay_fee',description='$pay_desc',config='$config',enabled='1' WHERE id='$pid'"; $dsql->ExecuteNoneQuery($query); - if($pm=='edit') $msg="保存修改成功"; - else $msg="安装成功!"; + if ($pm == 'edit') $msg = "保存修改成功"; + else $msg = "安装成功!"; ShowMsg($msg, "sys_payment.php"); exit(); } //删除支付接口 -else if($dopost=='uninstall') -{ +else if ($dopost == 'uninstall') { $row = $dsql->GetOne("SELECT * FROM `#@__payment` WHERE id='$pid'"); - if($cfg_soft_lang == 'utf-8') - { + if ($cfg_soft_lang == 'utf-8') { $config = AutoCharset(unserialize(utf82gb($row['config']))); - }else if($cfg_soft_lang == 'gb2312'){ + } else if ($cfg_soft_lang == 'gb2312') { $config = unserialize($row['config']); } - foreach ($config as $key => $v) $config[$key]['value']=""; - if($cfg_soft_lang == 'utf-8') - { - $config = AutoCharset($config,'utf-8','gb2312'); + foreach ($config as $key => $v) $config[$key]['value'] = ""; + if ($cfg_soft_lang == 'utf-8') { + $config = AutoCharset($config, 'utf-8', 'gb2312'); $config = serialize($config); $config = gb2utf8($config); - }else{ + } else { $config = serialize($config); } $query = "UPDATE `#@__payment` SET fee='',config='$config',enabled='0' WHERE id='$pid'"; $dsql->ExecuteNoneQuery($query); //同时需要删除对应的缓存 - $m_file = DEDEDATA."/payment/".$row['code'].".php"; + $m_file = DEDEDATA . "/payment/" . $row['code'] . ".php"; @unlink($m_file); ShowMsg("删除成功!", "sys_payment.php"); exit(); } $sql = "SELECT * FROM `#@__payment` ORDER BY rank ASC"; $dlist = new DataListCP(); -$dlist->SetTemplet(DEDEADMIN."/templets/sys_payment.htm"); +$dlist->SetTemplet(DEDEADMIN . "/templets/sys_payment.htm"); $dlist->SetSource($sql); -$dlist->display(); \ No newline at end of file +$dlist->display(); diff --git a/src/dede/sys_repair.php b/src/dede/sys_repair.php index 469fb8c2..a5b54aa1 100755 --- a/src/dede/sys_repair.php +++ b/src/dede/sys_repair.php @@ -1,20 +1,20 @@ <<点击此返回>>", "javascript:;"); //exit(); -if(empty($dopost)) -{ +if (empty($dopost)) { $win = new OxWindow(); $win->Init("sys_repair.php", "js/blank.js", "POST' enctype='multipart/form-data' "); $win->mainTitle = "系统修复工具"; @@ -40,16 +40,14 @@ if(empty($dopost)) "; $win->AddMsgItem("
$msg
"); - $winform = $win->GetWindow('hand',''); + $winform = $win->GetWindow('hand', ''); $win->Display(); exit(); } /*------------------- 数据结构常规检测 function 1_test_db() { } ---------------------*/ -else if($dopost==1) -{ +--------------------*/ else if ($dopost == 1) { $win = new OxWindow(); $win->Init("sys_repair.php", "js/blank.js", "POST' enctype='multipart/form-data' "); $win->mainTitle = "系统修复工具"; @@ -74,36 +72,29 @@ else if($dopost==1) "; $win->AddMsgItem("
$msg
"); - $winform = $win->GetWindow('hand',''); + $winform = $win->GetWindow('hand', ''); $win->Display(); exit(); } /*------------------- 检测微表正确性并尝试修复 function 2_test_arctiny() { } ---------------------*/ -else if($dopost==2) -{ +--------------------*/ else if ($dopost == 2) { $msg = ''; - + $allarcnum = 0; $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__archives` "); $allarcnum = $arcnum = $row['dd']; $msg .= "·#@__archives 表总记录数: {$arcnum}
"; - + $shtables = array(); $dsql->Execute('me', " SELECT addtable FROM `#@__channeltype` WHERE id < -1 "); - while($row = $dsql->GetArray('me') ) - { + while ($row = $dsql->GetArray('me')) { $addtable = strtolower(trim(str_replace('#@__', $cfg_dbprefix, $row['addtable']))); - if(empty($addtable)) - { + if (empty($addtable)) { continue; - } - else - { - if( !isset($shtables[$addtable]) ) - { + } else { + if (!isset($shtables[$addtable])) { $shtables[$addtable] = 1; $row = $dsql->GetOne("SELECT COUNT(aid) AS dd FROM `$addtable` "); $msg .= "·{$addtable} 表总记录数: {$row['dd']}
"; @@ -115,12 +106,9 @@ else if($dopost==2) $errall = "完成修正或无错误返回>>"; $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__arctiny` "); $msg .= "※微统计表记录数: {$row['dd']}
"; - if($row['dd']==$allarcnum) - { + if ($row['dd'] == $allarcnum) { $msg .= "

两者记录一致,无需修正!


"; - } - else - { + } else { $sql = " TRUNCATE TABLE `#@__arctiny`"; $dsql->ExecuteNoneQuery($sql); $msg .= "两者记录不一致,尝试进行简单修正...
"; @@ -129,20 +117,16 @@ else if($dopost==2) SELECT id, typeid, typeid2, arcrank, channel, senddate, sortrank, mid FROM `#@__archives` "; $dsql->ExecuteNoneQuery($sql); //导入单表模型微数据 - foreach($shtables as $tb=>$v) - { + foreach ($shtables as $tb => $v) { $sql = "INSERT INTO `#@__arctiny`(id, typeid, typeid2, arcrank, channel, senddate, sortrank, mid) SELECT aid, typeid, 0, arcrank, channel, senddate, 0, mid FROM `$tb` "; - $rs = $dsql->ExecuteNoneQuery($sql); + $rs = $dsql->ExecuteNoneQuery($sql); $doarray[$tb] = 1; } $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__arctiny` "); - if($row['dd']==$allarcnum) - { + if ($row['dd'] == $allarcnum) { $msg .= "

修正记录成功!


"; - } - else - { + } else { $msg .= "

修正记录失败,建议进行高级综合检测!


"; $errall = " 进行高级结合性检测>> "; } @@ -166,58 +150,50 @@ else if($dopost==2) "; $win->AddMsgItem("
$msg
"); - $winform = $win->GetWindow('hand',''); + $winform = $win->GetWindow('hand', ''); $win->Display(); exit(); } /*------------------- 高级方式修复微表(会删除不合法主键的内容) function 3_re_arctiny() { } ---------------------*/ -else if($dopost==3) -{ +--------------------*/ else if ($dopost == 3) { $errnum = 0; $sql = " TRUNCATE TABLE `#@__arctiny`"; $dsql->ExecuteNoneQuery($sql); - + $sql = "SELECT arc.id, arc.typeid, arc.typeid2, arc.arcrank, arc.channel, arc.senddate, arc.sortrank, arc.mid, ch.addtable FROM `#@__archives` arc LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel "; $dsql->Execute('me', $sql); - while($row = $dsql->GetArray('me') ) - { + while ($row = $dsql->GetArray('me')) { $sql = "INSERT INTO `#@__arctiny`(id, typeid, typeid2, arcrank, channel, senddate, sortrank, mid) VALUES('{$row['id']}','{$row['typeid']}','{$row['typeid2']}','{$row['arcrank']}', '{$row['channel']}','{$row['senddate']}','{$row['sortrank']}','{$row['mid']}'); "; $rs = $dsql->ExecuteNoneQuery($sql); - if(!$rs) - { + if (!$rs) { $addtable = trim($addtable); - $errnum ++; + $errnum++; $dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='{$row['id']}' "); - if(!empty($addtable)) $dsql->ExecuteNoneQuery("DELETE FROM `$addtable` WHERE id='{$row['id']}' "); + if (!empty($addtable)) $dsql->ExecuteNoneQuery("DELETE FROM `$addtable` WHERE id='{$row['id']}' "); } } //导入单表模型微数据 $dsql->SetQuery("SELECT id,addtable FROM `#@__channeltype` WHERE id < -1 "); $dsql->Execute(); $doarray = array(); - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $tb = str_replace('#@__', $cfg_dbprefix, $row['addtable']); - if(empty($tb) || isset($doarray[$tb]) ) - { + if (empty($tb) || isset($doarray[$tb])) { continue; - } - else - { + } else { $sql = "INSERT INTO `#@__arctiny`(id, typeid, typeid2, arcrank, channel, senddate, sortrank, mid) SELECT aid, typeid, 0, arcrank, channel, senddate, 0, mid FROM `$tb` "; - $rs = $dsql->ExecuteNoneQuery($sql); + $rs = $dsql->ExecuteNoneQuery($sql); $doarray[$tb] = 1; } } $win = new OxWindow(); - $win->Init("sys_repair.php","js/blank.js","POST' enctype='multipart/form-data' "); + $win->Init("sys_repair.php", "js/blank.js", "POST' enctype='multipart/form-data' "); $win->mainTitle = "系统修复工具"; $wecome_info = "系统错误修复工具 >> 高级综合检测修复"; $win->AddTitle('本工具用于检测和修复你的系统可能存在的错误'); @@ -234,7 +210,7 @@ else if($dopost==3) "; $win->AddMsgItem("
$msg
"); - $winform = $win->GetWindow('hand',''); + $winform = $win->GetWindow('hand', ''); $win->Display(); exit(); -} \ No newline at end of file +} diff --git a/src/dede/sys_safetest.php b/src/dede/sys_safetest.php index b5e08700..cf78197c 100755 --- a/src/dede/sys_safetest.php +++ b/src/dede/sys_safetest.php @@ -4,7 +4,7 @@ * 安全检测 * * @version $Id: sys_safetest.php 2 9:25 2010-11-12 tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -37,7 +37,7 @@ EOT;; function TestOneFile($f) { - global $message, $info,$offFiles; + global $message, $info, $offFiles; $str = ''; //排除safefile和data/tplcache目录 @@ -48,14 +48,14 @@ function TestOneFile($f) $str .= fgets($fp, 1024); } fclose($fp); - + if (preg_match("#(" . $info . ")[ \r\n\t]{0,}([\[\(])#i", $str)) { - $trfile = preg_replace("#^" . DEDEROOT . "#", '', $f ); + $trfile = preg_replace("#^" . DEDEROOT . "#", '', $f); $oldTrfile = $trfile; - $trfile = substr(str_replace("/","\\",$trfile) ,1); + $trfile = substr(str_replace("/", "\\", $trfile), 1); $localFilehash = md5_file($f); - $remoteFilehash = isset($offFiles[$trfile])? $offFiles[$trfile] : ''; + $remoteFilehash = isset($offFiles[$trfile]) ? $offFiles[$trfile] : ''; if ($localFilehash === $remoteFilehash) { return 0; } @@ -95,9 +95,8 @@ if ($action == 'test') { if ($message == '') $message = "没发现可疑文件!"; echo $message; exit(); -} -else if($action =='viewdiff'){ - $filename = isset($filename)? $filename : ""; +} else if ($action == 'viewdiff') { + $filename = isset($filename) ? $filename : ""; if (empty($filename)) { ShowMsg("没有选择对应的文件", "-1"); exit; @@ -110,10 +109,9 @@ else if($action =='viewdiff'){ $file = "$cfg_basedir/$filename"; $new = ""; - if(is_file($file)) - { - $fp = fopen($file,"r"); - $new = fread($fp,filesize($file)); + if (is_file($file)) { + $fp = fopen($file, "r"); + $new = fread($fp, filesize($file)); fclose($fp); } diff --git a/src/dede/sys_sql_query.php b/src/dede/sys_sql_query.php index c4bcffe9..505d5459 100755 --- a/src/dede/sys_sql_query.php +++ b/src/dede/sys_sql_query.php @@ -1,173 +1,140 @@ SetQuery("SHOW CREATE TABLE ".$dsql->dbName.".".$tablename); + } else { + $dsql->SetQuery("SHOW CREATE TABLE " . $dsql->dbName . "." . $tablename); $dsql->Execute('me'); - $row2 = $dsql->GetArray('me',MYSQL_BOTH); + $row2 = $dsql->GetArray('me', MYSQL_BOTH); $ctinfo = $row2[1]; - echo "".trim($ctinfo).""; + echo "" . trim($ctinfo) . ""; } exit(); } //优化表 -else if($dopost=="opimize") -{ +else if ($dopost == "opimize") { CheckCSRF(); - if(empty($tablename)) - { + if (empty($tablename)) { echo "没有指定表名!"; - } - else - { + } else { $rs = $dsql->ExecuteNoneQuery("OPTIMIZE TABLE `$tablename` "); - if($rs) echo "执行优化表: $tablename OK!"; - else echo "执行优化表: $tablename 失败,原因是:".$dsql->GetError(); + if ($rs) echo "执行优化表: $tablename OK!"; + else echo "执行优化表: $tablename 失败,原因是:" . $dsql->GetError(); } exit(); } //优化全部表 -else if($dopost=="opimizeAll") -{ +else if ($dopost == "opimizeAll") { CheckCSRF(); $dsql->SetQuery("SHOW TABLES"); $dsql->Execute('t'); - while($row = $dsql->GetArray('t',MYSQL_BOTH)) - { + while ($row = $dsql->GetArray('t', MYSQL_BOTH)) { $rs = $dsql->ExecuteNoneQuery("OPTIMIZE TABLE `{$row[0]}` "); - if($rs) - { + if ($rs) { echo "优化表: {$row[0]} ok!
\r\n"; } else { - echo "优化表: {$row[0]} 失败! 原因是: ".$dsql->GetError()."
\r\n"; + echo "优化表: {$row[0]} 失败! 原因是: " . $dsql->GetError() . "
\r\n"; } } exit(); } //修复表 -else if($dopost=="repair") -{ +else if ($dopost == "repair") { CheckCSRF(); - if(empty($tablename)) - { + if (empty($tablename)) { echo "没有指定表名!"; - } - else - { + } else { $rs = $dsql->ExecuteNoneQuery("REPAIR TABLE `$tablename` "); - if($rs) echo "修复表: $tablename OK!"; - else echo "修复表: $tablename 失败,原因是:".$dsql->GetError(); + if ($rs) echo "修复表: $tablename OK!"; + else echo "修复表: $tablename 失败,原因是:" . $dsql->GetError(); } exit(); } //修复全部表 -else if($dopost=="repairAll") -{ +else if ($dopost == "repairAll") { CheckCSRF(); $dsql->SetQuery("Show Tables"); $dsql->Execute('t'); - while($row = $dsql->GetArray('t',MYSQL_BOTH)) - { + while ($row = $dsql->GetArray('t', MYSQL_BOTH)) { $rs = $dsql->ExecuteNoneQuery("REPAIR TABLE `{$row[0]}` "); - if($rs) - { + if ($rs) { echo "修复表: {$row[0]} ok!
\r\n"; } else { - echo "修复表: {$row[0]} 失败! 原因是: ".$dsql->GetError()."
\r\n"; + echo "修复表: {$row[0]} 失败! 原因是: " . $dsql->GetError() . "
\r\n"; } } exit(); } //执行SQL语句 -else if($dopost=="query") -{ +else if ($dopost == "query") { CheckCSRF(); $sqlquery = trim(stripslashes($sqlquery)); - if(preg_match("#drop(.*)table#i", $sqlquery) || preg_match("#drop(.*)database#", $sqlquery)) - { + if (preg_match("#drop(.*)table#i", $sqlquery) || preg_match("#drop(.*)database#", $sqlquery)) { echo "删除'数据表'或'数据库'的语句不允许在这里执行。"; exit(); } //运行查询语句 - if(preg_match("#^select #i", $sqlquery)) - { + if (preg_match("#^select #i", $sqlquery)) { $dsql->SetQuery($sqlquery); $dsql->Execute(); - if($dsql->GetTotalRow()<=0) - { + if ($dsql->GetTotalRow() <= 0) { echo "运行SQL:{$sqlquery},无返回记录!"; - } - else - { - echo "运行SQL:{$sqlquery},共有".$dsql->GetTotalRow()."条记录,最大返回100条!"; + } else { + echo "运行SQL:{$sqlquery},共有" . $dsql->GetTotalRow() . "条记录,最大返回100条!"; } $j = 0; - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $j++; - if($j > 100) - { + if ($j > 100) { break; } echo "
"; echo "记录:$j"; echo "
"; - foreach($row as $k=>$v) - { + foreach ($row as $k => $v) { echo "{$k}:{$v}
\r\n"; } } exit(); } - if($querytype==2) - { + if ($querytype == 2) { //普通的SQL语句 - $sqlquery = str_replace("\r","",$sqlquery); - $sqls = preg_split("#;[ \t]{0,}\n#",$sqlquery); - $nerrCode = ""; $i=0; - foreach($sqls as $q) - { + $sqlquery = str_replace("\r", "", $sqlquery); + $sqls = preg_split("#;[ \t]{0,}\n#", $sqlquery); + $nerrCode = ""; + $i = 0; + foreach ($sqls as $q) { $q = trim($q); - if($q=="") - { + if ($q == "") { continue; } $dsql->ExecuteNoneQuery($q); $errCode = trim($dsql->GetError()); - if($errCode=="") - { + if ($errCode == "") { $i++; - } - else - { - $nerrCode .= "执行: $q 出错,错误提示:".$errCode."
"; + } else { + $nerrCode .= "执行: $q 出错,错误提示:" . $errCode . "
"; } } echo "成功执行{$i}个SQL语句!

"; echo $nerrCode; - } - else - { + } else { $dsql->ExecuteNoneQuery($sqlquery); $nerrCode = trim($dsql->GetError()); echo "成功执行1个SQL语句!

"; @@ -176,4 +143,4 @@ else if($dopost=="query") exit(); } make_hash(); -include DedeInclude('templets/sys_sql_query.htm'); \ No newline at end of file +include DedeInclude('templets/sys_sql_query.htm'); diff --git a/src/dede/sys_task.php b/src/dede/sys_task.php index 57c2e137..2cd0d345 100755 --- a/src/dede/sys_task.php +++ b/src/dede/sys_task.php @@ -1,22 +1,22 @@ ExecuteNoneQuery("DELETE FROM `#@__sys_task` WHERE id='$id' "); ShowMsg("成功删除一个任务!", "sys_task.php"); exit(); } -include DedeInclude('templets/sys_task.htm'); \ No newline at end of file +include DedeInclude('templets/sys_task.htm'); diff --git a/src/dede/sys_task_add.php b/src/dede/sys_task_add.php index 048b458b..682af19d 100755 --- a/src/dede/sys_task_add.php +++ b/src/dede/sys_task_add.php @@ -1,34 +1,31 @@ ExecuteNoneQuery($Query); - if($rs) - { + if ($rs) { ShowMsg('成功增加一个任务!', 'sys_task.php'); - } - else - { - ShowMsg('增加任务失败!'.$dsql->GetError(), 'javascript:;'); + } else { + ShowMsg('增加任务失败!' . $dsql->GetError(), 'javascript:;'); } exit(); } -include DedeInclude('templets/sys_task_add.htm'); \ No newline at end of file +include DedeInclude('templets/sys_task_add.htm'); diff --git a/src/dede/sys_task_edit.php b/src/dede/sys_task_edit.php index a6ff7d80..8fe6a155 100755 --- a/src/dede/sys_task_edit.php +++ b/src/dede/sys_task_edit.php @@ -1,22 +1,22 @@ ExecuteNoneQuery($query); - if($rs) - { + if ($rs) { ShowMsg('成功修改一个任务!', 'sys_task.php'); - } - else - { - ShowMsg('修改任务失败!'.$dsql->GetError(), 'javascript:;'); + } else { + ShowMsg('修改任务失败!' . $dsql->GetError(), 'javascript:;'); } exit(); } $row = $dsql->GetOne("SELECT * FROM `#@__sys_task` WHERE id='$id' "); -include DedeInclude('templets/sys_task_edit.htm'); \ No newline at end of file +include DedeInclude('templets/sys_task_edit.htm'); diff --git a/src/dede/tag_test.php b/src/dede/tag_test.php index f2dcb425..287b0743 100755 --- a/src/dede/tag_test.php +++ b/src/dede/tag_test.php @@ -1,14 +1,15 @@ 0) $pv = new PartView($typeid); +if ($typeid > 0) $pv = new PartView($typeid); else $pv = new PartView(); $pv->SetTemplet($partcode, "string"); -if( $showsource == "" || $showsource == "yes" ) -{ +if ($showsource == "" || $showsource == "yes") { echo "模板代码:"; - echo "
".dede_htmlspecialchars($partcode)."
"; + echo "
" . dede_htmlspecialchars($partcode) . "
"; echo "结果:
"; } -$pv->Display(); \ No newline at end of file +$pv->Display(); diff --git a/src/dede/tags_main.php b/src/dede/tags_main.php index 7353f26f..33c9e94c 100755 --- a/src/dede/tags_main.php +++ b/src/dede/tags_main.php @@ -4,7 +4,7 @@ * 获取TAGS管理 * * @version $Id: tag_test_action.php 1 23:07 2010年7月20日Z tianya $ - * @package DedeCMS.Administrator + * @package DedeBIZ.Administrator * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/dede/task_do.php b/src/dede/task_do.php index 4ec5ea7a..0aee1e71 100755 --- a/src/dede/task_do.php +++ b/src/dede/task_do.php @@ -1,14 +1,15 @@ $v) - { - if($k=='nextdo') - { + foreach ($_GET as $k => $v) { + if ($k == 'nextdo') { $nextdo = ''; $nextdos = explode(',', $GLOBALS[$k]); - if(isset($nextdos[1])) - { - for($i=1; $i < count($nextdos); $i++) - { - if( trim($nextdos[$i]) == '' ) continue; - $nextdo .= ($nextdo=='' ? $nextdos[$i] : ','.$nextdos[$i]); + if (isset($nextdos[1])) { + for ($i = 1; $i < count($nextdos); $i++) { + if (trim($nextdos[$i]) == '') continue; + $nextdo .= ($nextdo == '' ? $nextdos[$i] : ',' . $nextdos[$i]); } } //如果系统有多重任务, 把下一任务和任务列表参数提交给程序处理 - if( in_array('morejob', $notallowArr) ) - { - $reurl .= "&doposttmp=".$nextdos[0]; - if($nextdo != '') $reurl .= "&nextdotmp=$nextdo"; - } - else - { - $reurl .= "&dopost=".$nextdos[0]; - if($nextdo != '') $reurl .= "&nextdo=$nextdo"; + if (in_array('morejob', $notallowArr)) { + $reurl .= "&doposttmp=" . $nextdos[0]; + if ($nextdo != '') $reurl .= "&nextdotmp=$nextdo"; + } else { + $reurl .= "&dopost=" . $nextdos[0]; + if ($nextdo != '') $reurl .= "&nextdo=$nextdo"; } - } - else if( in_array($k, $notallowArr) ) - { + } else if (in_array($k, $notallowArr)) { continue; - } - else - { - $reurl .= "&{$k}=".urlencode($GLOBALS[$k]); + } else { + $reurl .= "&{$k}=" . urlencode($GLOBALS[$k]); } } return $reurl; @@ -61,72 +51,61 @@ function GetNextUrl($notallowArr = array('dopost', 'f', 'del')) /****************************** //更新上一篇和下一篇 function makeprenext() { } -******************************/ -if($dopost=='makeprenext') -{ - require_once(DEDEINC.'/arc.archives.class.php'); + ******************************/ +if ($dopost == 'makeprenext') { + require_once(DEDEINC . '/arc.archives.class.php'); $aid = intval($aid); $preRow = $dsql->GetOne("SELECT id FROM `#@__arctiny` WHERE id<$aid AND arcrank>-1 AND typeid='$typeid' ORDER BY id DESC"); $nextRow = $dsql->GetOne("SELECT id FROM `#@__arctiny` WHERE id>$aid AND arcrank>-1 AND typeid='$typeid' ORDER BY id ASC"); - if(is_array($preRow)) - { + if (is_array($preRow)) { $envs['aid'] = $preRow['id']; $arc = new Archives($preRow['id']); $arc->MakeHtml(); } - if(is_array($nextRow)) - { + if (is_array($nextRow)) { $envs['aid'] = $nextRow['id']; $arc = new Archives($nextRow['id']); $arc->MakeHtml(); } - if( empty($nextdo) ) - { + if (empty($nextdo)) { ShowMsg("完成上下篇文档更新任务!完成所有更新任务!", "close::tgtable"); exit(); - } - else - { + } else { $jumpurl = GetNextUrl(); - ShowMsg("完成下篇文档更新任务! 继续执行其它任务...", $jumpurl,0,500); + ShowMsg("完成下篇文档更新任务! 继续执行其它任务...", $jumpurl, 0, 500); exit(); } } /****************************** //更新主页的任务 function makeindex() { } -******************************/ -if($dopost=='makeindex') -{ - require_once(DEDEINC.'/arc.partview.class.php'); + ******************************/ +if ($dopost == 'makeindex') { + require_once(DEDEINC . '/arc.partview.class.php'); $envs = $_sys_globals = array(); $envs['aid'] = 0; $pv = new PartView(); $row = $pv->dsql->GetOne('SELECT * FROM `#@__homepageset`'); $templet = str_replace("{style}", $cfg_df_style, $row['templet']); - $homeFile = dirname(__FILE__).'/'.$row['position']; + $homeFile = dirname(__FILE__) . '/' . $row['position']; $homeFile = str_replace("//", "/", str_replace("\\", "/", $homeFile)); $fp = fopen($homeFile, 'w') or die("无法更新网站主页到:$homeFile 位置"); fclose($fp); - $tpl = $cfg_basedir.$cfg_templets_dir.'/'.$templet; - if(!file_exists($tpl)) - { - $tpl = $cfg_basedir.$cfg_templets_dir.'/default/index.htm'; - if(!file_exists($tpl)) exit("无法找到主页模板:$tpl "); + $tpl = $cfg_basedir . $cfg_templets_dir . '/' . $templet; + if (!file_exists($tpl)) { + $tpl = $cfg_basedir . $cfg_templets_dir . '/default/index.htm'; + if (!file_exists($tpl)) exit("无法找到主页模板:$tpl "); } $GLOBALS['_arclistEnv'] = 'index'; $pv->SetTemplet($tpl); $pv->SaveToHtml($homeFile); $pv->Close(); - if( empty($nextdo) ) - { + if (empty($nextdo)) { ShowMsg("完成主页更新任务!完成所有更新任务!", "close::tgtable"); exit(); - } - else - { + } else { $jumpurl = GetNextUrl(); - ShowMsg("完成主页更新! 现在跳转到其它更新任务...", $jumpurl,0,500); + ShowMsg("完成主页更新! 现在跳转到其它更新任务...", $jumpurl, 0, 500); exit(); } } @@ -134,60 +113,49 @@ if($dopost=='makeindex') //更新所有关连的栏目 function makeparenttype() { } ******************************/ -else if($dopost=='makeparenttype') -{ - require_once(DEDEDATA."/cache/inc_catalog_base.inc"); - require_once(DEDEINC.'/arc.listview.class.php'); +else if ($dopost == 'makeparenttype') { + require_once(DEDEDATA . "/cache/inc_catalog_base.inc"); + require_once(DEDEINC . '/arc.listview.class.php'); $notallowArr = array('dopost', 'f', 'del', 'curpage', 'morejob'); $jumpurl = GetNextUrl($notallowArr); - - if( empty($typeid) ) - { + + if (empty($typeid)) { ShowMsg("完成栏目更新任务!完成所有更新任务!", "close::tgtable"); exit(); } $topids = explode(',', GetTopids($typeid)); - if(empty($curpage)) $curpage = 0; + if (empty($curpage)) $curpage = 0; $tid = $topids[$curpage]; - - if(isset($cfg_Cs[$tid]) && $cfg_Cs[$tid][1]>0) - { - require_once(DEDEINC."/arc.listview.class.php"); + + if (isset($cfg_Cs[$tid]) && $cfg_Cs[$tid][1] > 0) { + require_once(DEDEINC . "/arc.listview.class.php"); $lv = new ListView($tid); $lv->CountRecord(); $lv->MakeHtml(); $lv->Close(); - } - else - { - require_once(DEDEINC."/arc.sglistview.class.php"); + } else { + require_once(DEDEINC . "/arc.sglistview.class.php"); $lv = new SgListView($tid); $lv->CountRecord(); $lv->MakeHtml(); $lv->Close(); } - - if($curpage >= count($topids)-1) - { - if( !empty($doposttmp) ) - { + + if ($curpage >= count($topids) - 1) { + if (!empty($doposttmp)) { $jumpurl = preg_replace("#doposttmp|nextdotmp#", 'del', $jumpurl); $jumpurl .= "&dopost={$doposttmp}&nextdo={$nextdotmp}"; - ShowMsg("完成栏目:{$tid} 更新!
完成栏目更新任务,继续执行后续任务...", $jumpurl,0,500); + ShowMsg("完成栏目:{$tid} 更新!
完成栏目更新任务,继续执行后续任务...", $jumpurl, 0, 500); exit(); - } - else - { + } else { ShowMsg("完成栏目:{$tid} 更新!
完成栏目更新任务,完成所有更新任务!", "close::tgtable"); exit(); } - } - else - { + } else { $curpage++; $jumpurl .= "&curpage={$curpage}&dopost=makeparenttype"; - ShowMsg("完成栏目:{$tid} 更新,继续更新其它栏目...", $jumpurl,0,500); + ShowMsg("完成栏目:{$tid} 更新,继续更新其它栏目...", $jumpurl, 0, 500); exit(); } -} \ No newline at end of file +} diff --git a/src/dede/templets/article_coonepage_rule.htm b/src/dede/templets/article_coonepage_rule.htm index 9fab19af..63020976 100755 --- a/src/dede/templets/article_coonepage_rule.htm +++ b/src/dede/templets/article_coonepage_rule.htm @@ -96,11 +96,13 @@ - +
@@ -117,8 +119,7 @@ - + @@ -157,26 +158,26 @@ - + + 是 @@ -185,7 +186,7 @@ + 如:news.dedebiz.com @@ -197,7 +198,8 @@ -
单页采集规则管理:
-
网站名称:
原内容编码: - + + + GB2312/GBK
用作文章来源: + 否
网站网址:
  使用不带http及任何附加目录的网址
- 如:news.dedecms.com
采集规则:
  +
diff --git a/src/dede/templets/baidunews.htm b/src/dede/templets/baidunews.htm index 1d0b8b69..f39e965a 100755 --- a/src/dede/templets/baidunews.htm +++ b/src/dede/templets/baidunews.htm @@ -5,8 +5,8 @@ 百度新闻地图 - - + + @@ -27,7 +27,7 @@

《互联网新闻开放协议》是百度新闻搜索制定的搜索引擎新闻源收录标准,网站可将发布的新闻内容制作成遵循此开放协议的XML格式的网页(独立于原有的新闻发布形式)供搜索引擎索引。

详情参见

配置的相关参数在 【系统设置 -> 其他选项】中调整

-

只适用于文章频道,数据表为DedeCMS默认的

+

只适用于文章频道,数据表为V6默认的

diff --git a/src/dede/templets/co_add_step1.htm b/src/dede/templets/co_add_step1.htm index ef7c1d81..2711211f 100755 --- a/src/dede/templets/co_add_step1.htm +++ b/src/dede/templets/co_add_step1.htm @@ -1,253 +1,270 @@ - + + - -新增采集节点 - - - + + 新增采集节点 + + + + -
-
-
新增采集节点:第一步设置基本信息及网址索引页规则
+
+
+
新增采集节点:第一步设置基本信息及网址索引页规则
- +
-
- - - - - - - - - - - - - - - - - - - - - - + + + + +
- - - - - -
节点基本信息
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
节点名称:目标页面编码: - - GB2312 - - UTF8 - - BIG5 -
区域匹配模式: - - 正则表达式 - - 字符串 - 内容导入顺序: - - 与目标站一致 - - 与目标站相反 -
以下选项仅在开启防盗链模式才需设定,如果目标网站没有防盗链功能请不要开启,否则会降低采集速度。
防盗链模式: - - 不开启 - - 开启 - 资源下载超时时间: - 秒 -
引用网址: - - (一般为目标网站其中一个文章页的网址) -
-
- - - - - -
列表网址获取规则
- - - - - - - - - - - - - - - - - - - - - -
来源属性: - - 批量生成列表网址 - - 手工指定列表网址 - - 从RSS中获取 -
批量生成地址设置: - - - - - - - - - - -
- 匹配网址: - - -
- (如:http://www.dedecms.com/html/test/list_(*).html,如果不能匹配所有网址,可以在手工指定网址的地方输入要追加的网址)
- (*)从 - - 到 - - (页码或规律数字)  - 每页递增: - - - 启用多栏目通配(#) -
-
手工指定网址:
- 在指定了通配规则后有些不能匹配的网址也可以在这里指定。
-
- - - - - -
文章网址匹配规则
- - - - - - - - - - - - - - - - - - - -
内容网址匹配模式: - - 指定包含有文章网址的区域(可以获取区域的网址、标题、图片等信息) - - 指定网址正则表达式(仅能获得网址信息)
包含有文章网址的区域设置: - + + + + + +
+ + + + + + + + + + + + + + + + + - -
+ + + + + +
节点基本信息
+
+ - - + + + - + + + - + + + + + + - - + + +
区域开始的HTML: - + 节点名称:目标页面编码: + + GB2312 + + UTF8 + + BIG5
区域结束的HTML:区域匹配模式: - + + 正则表达式 + + 字符串 + 内容导入顺序: + + 与目标站一致 + + 与目标站相反
如果链接中含有图片:以下选项仅在开启防盗链模式才需设定,如果目标网站没有防盗链功能请不要开启,否则会降低采集速度。
防盗链模式: + + 不开启 + + 开启 + 资源下载超时时间: - - 不处理 - - 采集为缩略图 +
对区域网址进行再次筛选:
- (使用正则表达式)
必须包含: - - (优先级高于后者)引用网址: + + (一般为目标网站其中一个文章页的网址) +
+
+ + + + + +
列表网址获取规则
+
+ - + + + + + + + + + + + + + + + + + + + +
不能包含: - 来源属性: + + 批量生成列表网址 + + 手工指定列表网址 + + 从RSS中获取 +
批量生成地址设置: + + + + + + + + + + +
+ 匹配网址: + + +
+ (如:http://wwws.dedebiz.com/html/test/list_(*).html,如果不能匹配所有网址,可以在手工指定网址的地方输入要追加的网址) +
+ (*)从 + + 到 + + (页码或规律数字)  + 每页递增: + + + 启用多栏目通配(#) +
+
手工指定网址:
+ 在指定了通配规则后有些不能匹配的网址也可以在这里指定。
+
+
+ + + + + +
文章网址匹配规则
+
+ + + + + + + + + + + + + + +
内容网址匹配模式: + + 指定包含有文章网址的区域(可以获取区域的网址、标题、图片等信息) + + 指定网址正则表达式(仅能获得网址信息)
包含有文章网址的区域设置: + + + + + + + + + + + + + + + + + + + + +
区域开始的HTML: + +
区域结束的HTML: + +
如果链接中含有图片: + + 不处理 + + 采集为缩略图 +
对区域网址进行再次筛选:
+ (使用正则表达式)
必须包含: + + (优先级高于后者)
不能包含: +
+
-
-
  -
- +
  +
+ + \ No newline at end of file diff --git a/src/dede/templets/co_config.htm b/src/dede/templets/co_config.htm index 7d40384f..71bea449 100755 --- a/src/dede/templets/co_config.htm +++ b/src/dede/templets/co_config.htm @@ -1,7 +1,7 @@ - -~templets~ +~templets~ \ No newline at end of file diff --git a/src/dede/templets/co_edit.htm b/src/dede/templets/co_edit.htm index 70dd6581..dcf2d11f 100755 --- a/src/dede/templets/co_edit.htm +++ b/src/dede/templets/co_edit.htm @@ -1,517 +1,605 @@ - + + - -修改采集节点 - - - - - + + 修改采集节点 + + + + + + -
-
-
修改采集节点
+
+
+
修改采集节点
- - + +
-
-
- - - - - - - - -
- - - - - -
网址索引内容配置
-
- - - - - - +
+ + + + + + + + + +
+ + + + + +
网址索引内容配置
+
- - - - - - - - - - - - - - - - - - + + + + + + - - - - -
- - - - - -
节点基本信息
-
- - - - - - - - - - - - - - - - - - - - - - - - - - -
节点名称: - - 目标页面编码: - GetAtt('sourcelang')=='gb2312') echo " checked='1'"; ?>/> - GB2312 - GetAtt('sourcelang')=='utf-8') echo " checked='1'"; ?>/> - UTF8 - GetAtt('sourcelang')=='big5') echo " checked='1'"; ?>/> - BIG5 -
区域匹配模式: - GetAtt('macthtype')=='regex') echo " checked='1'"; ?>/> - 正则表达式 - GetAtt('macthtype')=='string') echo " checked='1'"; ?>/> - 字符串 - 内容导入顺序: - GetAtt('cosort')=='asc') echo " checked='1'"; ?>/> - 与目标站一致 - GetAtt('cosort')=='desc') echo " checked='1'"; ?>/> - 与目标站相反 -
以下选项仅在开启防盗链模式才需设定,如果目标网站没有防盗链功能请不要开启,否则会降低采集速度。
防盗链模式: - GetAtt('isref')=='no') echo " checked='1'"; ?>/> - 不开启 - GetAtt('isref')=='yes') echo " checked='1'"; ?>/> - 开启 - 资源下载超时时间: - 秒 -
引用网址: - - (一般为目标网站其中一个文章页的网址) -
-
- - - - - -
列表网址获取规则
- - - - - - - - - - - - - - '> - - - - '> - - - -
来源属性: - GetAtt('sourcetype')=='batch') echo " checked='checked'"; ?>/> - 批量生成列表网址 - GetAtt('sourcetype')=='hand') echo " checked='checked'"; ?>/> - 手工指定列表网址 - GetAtt('sourcetype')=='rss') echo " checked='checked'"; ?>/> - 从RSS中获取 -
批量生成地址设置: - - - - - - - - - - -
- 匹配网址: - - -
- (如:http://www.dedecms.com/html/test/list_(*).html,如果不能匹配所有网址,可以在手工指定网址的地方输入要追加的网址)
- (*)从 - - 到 - - (填写页码或规律递增数字)  - 每页递增: - - /> - 启用多栏目通配(#) -
-
手工指定网址:
- 在指定了通配规则后有些不能匹配的网址也可以在这里指定。
- -
多栏目通配规则:
- - 如果目标网站使用单一模板,可以在匹配网址中用"(#)"表示近似网址的差异,然后在通配规则中设定集合,并且可以指定导出栏目。 - -
-
- -
示例格式:[(#)=>labs/list_3; (*)=>1-25; typeid=>7] 匹配网址:http://www.aaa.com/(#)_(*).html -
-
- - - - - -
文章网址匹配规则
- - - - - - - - - - - - - - - - - - - - -
内容网址匹配模式: - GetAtt('urlrule')=='area') echo " checked='1'"; ?>/> - 指定包含有文章网址的区域(可以获取区域的网址、标题、图片等信息) - GetAtt('urlrule')=='regx') echo " checked='1'"; ?>/> - 指定网址正则表达式(仅能获得网址信息) -
包含有文章网址的区域设置: - +
+ + + + + + + + + + + + + + + + + - -
+ + + + + +
节点基本信息
+
+ + + + + + - + + + - + + + + + + - - + +
节点名称: + + 目标页面编码: + GetAtt('sourcelang')=='gb2312') echo " checked='1'"; ?> /> + GB2312 + GetAtt('sourcelang')=='utf-8') echo " checked='1'"; ?> /> + UTF8 + GetAtt('sourcelang')=='big5') echo " checked='1'"; ?> /> + BIG5
区域结束的HTML:区域匹配模式: + GetAtt('macthtype')=='regex') echo " checked='1'"; ?> /> + 正则表达式 + GetAtt('macthtype')=='string') echo " checked='1'"; ?> /> + 字符串 + 内容导入顺序: - + GetAtt('cosort')=='asc') echo " checked='1'"; ?> /> + 与目标站一致 + GetAtt('cosort')=='desc') echo " checked='1'"; ?> /> + 与目标站相反
如果链接中含有图片:以下选项仅在开启防盗链模式才需设定,如果目标网站没有防盗链功能请不要开启,否则会降低采集速度。
防盗链模式: + GetAtt('isref')=='no') echo " checked='1'"; ?> /> + 不开启 + GetAtt('isref')=='yes') echo " checked='1'"; ?> /> + 开启 + 资源下载超时时间: - GetAtt('listpic')=='0') echo " checked='1'"; ?>/> - 不处理 - GetAtt('listpic')=='1') echo " checked='1'"; ?>/> - 采集为缩略图 +
对区域网址进行再次筛选:
- (使用正则表达式)
必须包含: - - (优先级高于后者) + 引用网址: + + (一般为目标网站其中一个文章页的网址)
+
+ + + + + +
列表网址获取规则
+
+ - + + + + + + + + + + + '> + + + + '> + +
不能包含: - + 来源属性: + GetAtt('sourcetype')=='batch') echo " checked='checked'"; ?> /> + 批量生成列表网址 + GetAtt('sourcetype')=='hand') echo " checked='checked'"; ?> /> + 手工指定列表网址 + GetAtt('sourcetype')=='rss') echo " checked='checked'"; ?> /> + 从RSS中获取 +
批量生成地址设置: + + + + + + + + + + +
+ 匹配网址: + + +
+ (如:https://www.dedebiz.com/html/test/list_(*).html,如果不能匹配所有网址,可以在手工指定网址的地方输入要追加的网址) +
+ (*)从 + + 到 + + (填写页码或规律递增数字)  + 每页递增: + + /> + 启用多栏目通配(#) +
+
手工指定网址:
+ 在指定了通配规则后有些不能匹配的网址也可以在这里指定。
+ +
多栏目通配规则:
+ + 如果目标网站使用单一模板,可以在匹配网址中用"(#)"表示近似网址的差异,然后在通配规则中设定集合,并且可以指定导出栏目。 + +
+
+ +
示例格式:[(#)=>labs/list_3; (*)=>1-25; typeid=>7] + 匹配网址:http://www.aaa.com/(#)_(*).html
-
-
  - -   - -
+
+ + + + + +
文章网址匹配规则
+
+ -
- - - - - + + + + - - + +
- + - - +
+ + + + + + + + + + + + + + + + + + + + +
预览网址: + +  
内容分页导航所在的区域匹配规则:
+ GetAtt('sptype')=='full') echo " checked='1'"; ?> /> + 全部列出的分页列表
+ GetAtt('sptype')=='next') echo " checked='1'"; ?> /> + 上下页形式或不完整的分页列表
+ + GetAtt('sptype')=='diyrule') echo " checked='1'"; ?> /> + 分页列表规则 开始: + + 结束: +
+ 如果设定分页列表规则.可采用地址规则(正则),其中{p}是递增变量,从1开始每次增加1,例如:{path}{file}_{p}{ext}
+ 规则说明:{path}地址+目录 {file}文件 {ext}文件扩展名 + {p}分页列表数
+  以下为固定的采集项目:(项目点击可展开/隐藏,内容摘要、关键字、缩略图系统会用正则进行自动匹配) +
+ + + + + + + + + + + + + + +
+ + + + +
+ + + + + +
关键字过滤内容: + +
+
+
+ + + + +
+ + + + + +
摘要过滤内容: + +
+
+
+ + + + + + + +
 文章标题 +
+ + + + + + + + + + + +
匹配规则: + +
过滤规则: + + + +
+
+
+ + + + + + + +
 文章作者
+ + + + + + + + + + + +
匹配规则: + +
过滤规则: + + + +
+
+
+ + + + + + + +
 文章来源
+ + + + + + + + + + + +
匹配规则: + +
过滤规则: + + + +
+
+
+ + + + + + + +
 发布时间
+ + + + + + + + + + + +
匹配规则: + +
过滤规则: + + + +
+
+
+ + + + + +
+  以下是针对模型设置的采集项目: +
+ GetOne("Select * From `#@__channeltype` where id='{$channelid}' "); $dtp = new DedeTagParse(); $dtp->SetNameSpace('field','<','>'); @@ -540,76 +628,85 @@ tr{display:compact} } ?> - - - - - - - - - - - + + + +
-   -  字段值: - -
- - - - - - - - - - - - - - - - -
匹配规则: - - - /> - 分页内容字段(规则中只允许单一的该类型字段)
- /> - 下载字段里的多媒体资源 -
过滤规则: - - - -
自定义处理接口: - - - ' style='display:none' /> + + + + + + + + + + +
+   +  字段值: + +
+ + + + + + + + + + + + + + + + +
匹配规则: + + + /> + 分页内容字段(规则中只允许单一的该类型字段)
+ /> + 下载字段里的多媒体资源 +
过滤规则: + + + +
自定义处理接口: + + + - 函数或程序的变量
- @body 表示原始网页 @litpic 缩略图
- @me 表示当前标记值和最终结果 - + @body 表示原始网页 @litpic 缩略图
+ @me 表示当前标记值和最终结果 + +
+
+
-
+ +   + +
- -
- -   - -
- + + \ No newline at end of file diff --git a/src/dede/templets/co_test_rule.htm b/src/dede/templets/co_test_rule.htm index d8d4136f..1bdad804 100755 --- a/src/dede/templets/co_test_rule.htm +++ b/src/dede/templets/co_test_rule.htm @@ -1,39 +1,44 @@ - + + - -测试节点 - + + 测试节点 + + - - - - - + + - - - - -
- - - - - -
测试节点: - - -
+ + + - - - + +
+ + + + + +
测试节点: + + +
- - - - - - - - - - - - - - - - - - + + + + + + + - -
节点名称: noteInfos['notename']); ?>
列表测试信息: 
- -
网页规则测试:(DedeCMS里时间日期字段一般是整数类型,如果您看到pubdate、senddate是整数,那种属正常的情况)
- 单个网页测试网址: -
- +
网页规则测试:(DedeCMSV6里时间日期字段一般是整数类型,如果您看到pubdate、senddate是整数,那种属正常的情况)
+ 单个网页测试网址: +
+ -
+
- -   - + +   +
 
+ + +   + + + \ No newline at end of file diff --git a/src/dede/templets/index2.htm b/src/dede/templets/index2.htm index c851586a..3c4326f8 100755 --- a/src/dede/templets/index2.htm +++ b/src/dede/templets/index2.htm @@ -1,140 +1,167 @@ - + + - -<?php echo $cfg_webname; ?>-<?php echo $cfg_softname." ".$cfg_version; ?> - - - - - + + <?php echo $cfg_webname; ?>-<?php echo $cfg_softname." ".$cfg_version; ?> + + + + + + -
- -
-
-
+ +
+
+ -
-
-
-
-
- -
v6
-
-
- - - + >织梦绿
- -
- -
-

滚动消息:

-
-
- - - 代码托管 帮助中心 -
+ +
  • + >淡蓝
  • + +
  • + >咖啡 +
  • + +
  • + >水墨 +
  • + + +
    + +
    + +
    +

    滚动消息:

    +
    -
    -
    - -
    -
    -
    -
    - -
    -
    -
    +
    +
    + +
    + +
    +
    + -
    - + + + - + + \ No newline at end of file diff --git a/src/dede/templets/index_menu2.htm b/src/dede/templets/index_menu2.htm index 736aaab6..327ee2fd 100755 --- a/src/dede/templets/index_menu2.htm +++ b/src/dede/templets/index_menu2.htm @@ -2,9 +2,9 @@ - DedeCMS menu + DedeBIZ menu - + var curopenItem = '$openitem';\r\n" .sitemu a { font-size: 13px; - color: rgba(0,0,0,.65); + color: rgba(0, 0, 0, .65); } body { diff --git a/src/dede/templets/login.htm b/src/dede/templets/login.htm index f9735b7b..3d482cde 100755 --- a/src/dede/templets/login.htm +++ b/src/dede/templets/login.htm @@ -1,5 +1,6 @@ + @@ -40,9 +41,11 @@ padding: 1em 0; } - .login-power a ,.goindex a{ + .login-power a, + .goindex a { color: #3DB058; } + .goindex { line-height: 65px; } @@ -92,8 +95,8 @@ -
    Powered by DedeCMS© 2020 + DedeCMS© 2020 DedeBiz技术支持
    diff --git a/src/dede/templets/module_help.htm b/src/dede/templets/module_help.htm index 9ceaf674..bcc9834a 100755 --- a/src/dede/templets/module_help.htm +++ b/src/dede/templets/module_help.htm @@ -1,51 +1,57 @@ - + + - - - + -模块打包 - - + //myajax.SendGet2('module_make.php?action=gethash&email='+email+'&modulname='+modulname); + DedeXHTTP = null; + } + + 模块打包 + + + -
    -
    -
    模块管理
    -
    - +
    +
    +
    模块管理
    +
    +
    + > DedeBIZ模块开发指南: - @@ -93,6 +100,7 @@ td{padding-left:8px} -
     模块管理 - > DedeCMS模块开发指南:
    + +
    + @@ -59,9 +65,10 @@ td{padding-left:8px} - + -
    目录
    3、开发模块安装程序和卸载的注意事项。
    4、Dedecms的后台管理程序的开发注意事项。4、DedeCMSV6的后台管理程序的开发注意事项。
    +
     
    + + \ No newline at end of file diff --git a/src/dede/templets/sys_data.htm b/src/dede/templets/sys_data.htm index 673620b7..3fcbce2a 100755 --- a/src/dede/templets/sys_data.htm +++ b/src/dede/templets/sys_data.htm @@ -105,7 +105,7 @@
    - DedeCMS默认系统表: + DedeCMSV6默认系统表: 选择 diff --git a/src/dede/templets/sys_info.htm b/src/dede/templets/sys_info.htm index c0f4889b..b0f9d1ef 100755 --- a/src/dede/templets/sys_info.htm +++ b/src/dede/templets/sys_info.htm @@ -37,6 +37,7 @@ } function getSearch() { var searchKeywords = $Obj('keywds').value; + searchKeywords = searchKeywords.replace(/^cfg_/, ""); var myajax = new DedeAjax($Obj('_search')); myajax.SendGet('sys_info.php?dopost=search&keywords=' + searchKeywords) $Obj('_searchback').innerHTML = '' @@ -49,16 +50,17 @@ }); } - - + +
    - +
    - + +
    DedeCMS系统配置参数:DedeCMSV6系统配置参数:
    \r\n"; ?> -
    @@ -155,7 +157,7 @@ foreach($ds as $dl) ?> - + @@ -221,8 +223,9 @@ if($row['type']=='bool') - + +
    参数说明 参数值 变量名  -
    diff --git a/src/dede/templets/sys_info_mark.htm b/src/dede/templets/sys_info_mark.htm index 74c141f7..9ee81042 100755 --- a/src/dede/templets/sys_info_mark.htm +++ b/src/dede/templets/sys_info_mark.htm @@ -5,52 +5,54 @@ 系统配置参数 - 图片水印设置 - - + + - +
    + DedeCMSV6系统配置参数 - 图片水印设置 @@ -103,50 +105,50 @@ diff --git a/src/dede/templets/sys_payment.htm b/src/dede/templets/sys_payment.htm index edd9cfcd..e39a820d 100755 --- a/src/dede/templets/sys_payment.htm +++ b/src/dede/templets/sys_payment.htm @@ -20,14 +20,15 @@
    -
    - DedeCMS系统配置参数 - 图片水印设置
    上传的图片是否使用图片水印功能:
    + > 开启 + > + 关闭
    采集的图片是否使用图片水印功能: + > + 开启 + > + 关闭
    选择水印的文件类型: - +   + > png   + > 文字
    水印位置: + > + 随机位置 + > + 顶部居左 + > + 顶部居中 + > + 顶部居右 + > + 左边居中 + > + 图片中心 + > + 右边居中 + > + 底部居左 + > + 底部居中 + > + 底部居右
    +
    diff --git a/src/dede/templets/tag_test.htm b/src/dede/templets/tag_test.htm index e8c7dc56..647d0ed9 100755 --- a/src/dede/templets/tag_test.htm +++ b/src/dede/templets/tag_test.htm @@ -5,8 +5,8 @@ 主页更新向导 - - + + @@ -34,7 +34,8 @@ -
    - +
    支付接口列表 [查看更多接口] [查看更多接口] +
    +
    @@ -51,8 +52,7 @@ @@ -79,8 +79,7 @@ diff --git a/src/dede/templets/winmode.htm b/src/dede/templets/winmode.htm index 91f37b69..bc5474a7 100755 --- a/src/dede/templets/winmode.htm +++ b/src/dede/templets/winmode.htm @@ -1,47 +1,52 @@ - + + - -{dede:wintitle/} - + + {dede:wintitle/} + + -
      全局标记指的是应用在网站主页、单独页面、频道封面使用的单独的模板标记,在列表或文章模板中,一般只允许调用channel、arclist标记(hotart、coolart、imglist等都是这个标记延伸出来的标记),但是环境变量限定为文章或列表所在的栏目,如果您要测试的标记是在列表或文章中使用,请指定环境变量(栏目ID)。
    -   各标记的具体含义和用途,请在模板标记参考一章查阅。 +   各标记的具体含义和用途,请在模板标记参考一章查阅。
    - +
    - - - - - - - - - - - - - - - - - - -
    - Power by DedeCMS OX -
    - - - - -
    -  {dede:wecome_info/} -
    - {dede:winform/} -
    -

    -{dede:lang_cms_powerby/} -
    -
    -

    + + + + + + + + + + + + + + + + + + + +
    + Power by DedeCMSV6 OX +
    + + + + +
    +  {dede:wecome_info/} +
    +
    + {dede:winform/} +
    +

    + {dede:lang_cms_powerby/} +
    +
    +

    \ No newline at end of file diff --git a/src/dede/templets_main.php b/src/dede/templets_main.php index a6656f2a..723c3930 100755 --- a/src/dede/templets_main.php +++ b/src/dede/templets_main.php @@ -1,24 +1,24 @@ SetTemplet(DEDEADMIN."/templets/templets_one.htm"); +$dlist->SetTemplet(DEDEADMIN . "/templets/templets_one.htm"); $dlist->SetSource($sql); $dlist->display(); function GetIsMake($im) { - return $im==1 ? '需编译' : '不编译'; -} \ No newline at end of file + return $im == 1 ? '需编译' : '不编译'; +} diff --git a/src/dede/templets_one_add.php b/src/dede/templets_one_add.php index 3a0b6a15..f0fff167 100755 --- a/src/dede/templets_one_add.php +++ b/src/dede/templets_one_add.php @@ -1,47 +1,44 @@ GetOne("SELECT filename FROM `#@__sgpage` WHERE likeid='$likeid' AND filename LIKE '$filename' "); - if(is_array($row)) - { - ShowMsg("已经存在相同的文件名,请更改为其它文件名!","-1"); + if (is_array($row)) { + ShowMsg("已经存在相同的文件名,请更改为其它文件名!", "-1"); exit(); } $inQuery = "INSERT INTO `#@__sgpage`(title,keywords,description,template,likeid,ismake,filename,uptime,body) VALUES('$title','$keywords','$description','$template','$likeid','$ismake','$filename','$uptime','$body'); "; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { - ShowMsg("增加页面失败,请检内容是否有问题!","-1"); + if (!$dsql->ExecuteNoneQuery($inQuery)) { + ShowMsg("增加页面失败,请检内容是否有问题!", "-1"); exit(); } $id = $dsql->GetLastID(); - include_once(DEDEINC."/arc.sgpage.class.php"); + include_once(DEDEINC . "/arc.sgpage.class.php"); $sg = new sgpage($id); $sg->SaveToHtml(); - ShowMsg("成功增加一个页面!","templets_one.php"); + ShowMsg("成功增加一个页面!", "templets_one.php"); exit(); } $row = $dsql->GetOne("SELECT MAX(aid) AS aid FROM `#@__sgpage` "); -$nowid = is_array($row) ? $row['aid']+1 : ''; -include_once(DEDEADMIN."/templets/templets_one_add.htm"); \ No newline at end of file +$nowid = is_array($row) ? $row['aid'] + 1 : ''; +include_once(DEDEADMIN . "/templets/templets_one_add.htm"); diff --git a/src/dede/templets_one_edit.php b/src/dede/templets_one_edit.php index 0b199142..40a86e76 100755 --- a/src/dede/templets_one_edit.php +++ b/src/dede/templets_one_edit.php @@ -1,36 +1,33 @@ ExecuteNoneQuery($inQuery)) - { - ShowMsg("更新页面数据时失败,请检查长相是否有问题!","-1"); + if (!$dsql->ExecuteNoneQuery($inQuery)) { + ShowMsg("更新页面数据时失败,请检查长相是否有问题!", "-1"); exit(); } $sg = new sgpage($aid); $sg->SaveToHtml(); ShowMsg("成功修改一个页面!", "templets_one.php"); exit(); -} -else if($dopost=="delete") -{ +} else if ($dopost == "delete") { $row = $dsql->GetOne("SELECT filename FROM `#@__sgpage` WHERE aid='$aid'"); - $filename = preg_replace("#\/{1,}#", "/", $cfg_basedir.$cfg_cmspath."/".$row['filename']); + $filename = preg_replace("#\/{1,}#", "/", $cfg_basedir . $cfg_cmspath . "/" . $row['filename']); $dsql->ExecuteNoneQuery(" DELETE FROM `#@__sgpage` WHERE aid='$aid' "); - if(is_file($filename)) - { + if (is_file($filename)) { unlink($filename); } ShowMsg("成功删除一个页面!", "templets_one.php"); exit(); -} -else if($dopost=="make") -{ - include_once(DEDEINC."/arc.sgpage.class.php"); +} else if ($dopost == "make") { + include_once(DEDEINC . "/arc.sgpage.class.php"); $row = $dsql->GetOne("SELECT filename FROM `#@__sgpage` WHERE aid='$aid'"); - $fileurl = $cfg_cmsurl.'/'.preg_replace("#\/{1,}#", "/", $row['filename']); + $fileurl = $cfg_cmsurl . '/' . preg_replace("#\/{1,}#", "/", $row['filename']); $sg = new sgpage($aid); $sg->SaveToHtml(); ShowMsg("成功更新一个页面!", $fileurl); exit(); -} -else if($dopost=="mkall") -{ - include_once(DEDEINC."/arc.sgpage.class.php"); - $dsql->Execute("ex","SELECT aid FROM `#@__sgpage` "); +} else if ($dopost == "mkall") { + include_once(DEDEINC . "/arc.sgpage.class.php"); + $dsql->Execute("ex", "SELECT aid FROM `#@__sgpage` "); $i = 0; - while($row = $dsql->GetArray("ex")) - { + while ($row = $dsql->GetArray("ex")) { $sg = new sgpage($row['aid']); $sg->SaveToHtml(); $i++; } ShowMsg("成功更新 $i 个页面!", '-1'); exit(); -} -else if($dopost=="mksel") -{ - if(empty($ids)) - { +} else if ($dopost == "mksel") { + if (empty($ids)) { $ids = ''; } - include_once(DEDEINC."/arc.sgpage.class.php"); + include_once(DEDEINC . "/arc.sgpage.class.php"); $i = 0; - if($ids == 0) - { - ShowMsg('您没有选择需要更新的文档!','-1'); + if ($ids == 0) { + ShowMsg('您没有选择需要更新的文档!', '-1'); exit(); - } - else if(is_array($ids)) - { - foreach($ids as $aid) - { + } else if (is_array($ids)) { + foreach ($ids as $aid) { $sg = new sgpage($aid); $sg->SaveToHtml(); $i++; } - ShowMsg("成功更新 $i 个页面!",'-1'); + ShowMsg("成功更新 $i 个页面!", '-1'); exit(); } -} -else if($dopost=="view") -{ - if(empty($aid)) - { - ShowMsg('错误的ID!','javascript:;'); - exit(); - } - include_once(DEDEINC."/arc.sgpage.class.php"); - $sg = new sgpage($aid); - $sg->display(); - exit(); +} else if ($dopost == "view") { + if (empty($aid)) { + ShowMsg('错误的ID!', 'javascript:;'); + exit(); + } + include_once(DEDEINC . "/arc.sgpage.class.php"); + $sg = new sgpage($aid); + $sg->display(); + exit(); } $row = $dsql->GetOne("SELECT * FROM `#@__sgpage` WHERE aid='$aid' "); -include(DEDEADMIN."/templets/templets_one_edit.htm"); \ No newline at end of file +include(DEDEADMIN . "/templets/templets_one_edit.htm"); diff --git a/src/dede/templets_tagsource.php b/src/dede/templets_tagsource.php index b74129af..38f209ba 100755 --- a/src/dede/templets_tagsource.php +++ b/src/dede/templets_tagsource.php @@ -1,32 +1,32 @@ + - -系统运行目录权限检测 - - - + + 系统运行目录权限检测 + + + + -'; - $reval = false; - if(empty($rootDir)) $rootDir = DEDEROOT; - if (TestWriteable($d)) + if (!function_exists('TestExecuteable')) { + // 检查是否具目录可执行 + function TestExecuteable($d = '.', $siteuRL = '', $rootDir = '') { - @file_put_contents($d.'/'.$filename, $testStr); - $remoteUrl = $siteuRL.'/'.str_replace($rootDir, '', str_replace("\\", '/',realpath($d))).'/'.$filename; - $tempStr = @PostHost($remoteUrl); + $testStr = '<' . chr(0x3F) . 'p' . chr(hexdec(68)) . chr(112) . "\n\r"; + $filename = md5($d) . '.php'; + $testStr .= 'function test(){ echo md5(\'' . $d . '\');}' . "\n\rtest();\n\r"; + $testStr .= chr(0x3F) . '>'; + $reval = false; + if (empty($rootDir)) $rootDir = DEDEROOT; + if (TestWriteable($d)) { + @file_put_contents($d . '/' . $filename, $testStr); + $remoteUrl = $siteuRL . '/' . str_replace($rootDir, '', str_replace("\\", '/', realpath($d))) . '/' . $filename; + $tempStr = @PostHost($remoteUrl); - $reval = (md5($d) == trim($tempStr))? true : false; - unlink($d.'/'.$filename); - return $reval; - } else - { - return -1; + $reval = (md5($d) == trim($tempStr)) ? true : false; + unlink($d . '/' . $filename); + return $reval; + } else { + return -1; + } } } -} -if(!function_exists('PostHost')) -{ - function PostHost($host,$data='',$method='GET',$showagent=null,$port=null,$timeout=30){ - $parse = @parse_url($host); - if (empty($parse)) return false; - if ((int)$port>0) { - $parse['port'] = $port; - } elseif (!@$parse['port']) { - $parse['port'] = '80'; - } - $parse['host'] = str_replace(array('http://','https://'),array('','ssl://'),"$parse[scheme]://").$parse['host']; - if (!$fp=@fsockopen($parse['host'],$parse['port'],$errnum,$errstr,$timeout)) { - return false; - } - $method = strtoupper($method); - $wlength = $wdata = $responseText = ''; - $parse['path'] = str_replace(array('\\','//'),'/',@$parse['path'])."?".@$parse['query']; - if ($method=='GET') { - $separator = @$parse['query'] ? '&' : ''; - substr($data,0,1)=='&' && $data = substr($data,1); - $parse['path'] .= $separator.$data; - } elseif ($method=='POST') { - $wlength = "Content-length: ".strlen($data)."\r\n"; - $wdata = $data; - } - $write = "$method $parse[path] HTTP/1.0\r\nHost: $parse[host]\r\nContent-type: application/x-www-form-urlencoded\r\n{$wlength}Connection: close\r\n\r\n$wdata"; - @fwrite($fp,$write); - while ($data = @fread($fp, 4096)) { - $responseText .= $data; + if (!function_exists('PostHost')) { + function PostHost($host, $data = '', $method = 'GET', $showagent = null, $port = null, $timeout = 30) + { + $parse = @parse_url($host); + if (empty($parse)) return false; + if ((int)$port > 0) { + $parse['port'] = $port; + } elseif (!@$parse['port']) { + $parse['port'] = '80'; + } + $parse['host'] = str_replace(array('http://', 'https://'), array('', 'ssl://'), "$parse[scheme]://") . $parse['host']; + if (!$fp = @fsockopen($parse['host'], $parse['port'], $errnum, $errstr, $timeout)) { + return false; + } + $method = strtoupper($method); + $wlength = $wdata = $responseText = ''; + $parse['path'] = str_replace(array('\\', '//'), '/', @$parse['path']) . "?" . @$parse['query']; + if ($method == 'GET') { + $separator = @$parse['query'] ? '&' : ''; + substr($data, 0, 1) == '&' && $data = substr($data, 1); + $parse['path'] .= $separator . $data; + } elseif ($method == 'POST') { + $wlength = "Content-length: " . strlen($data) . "\r\n"; + $wdata = $data; + } + $write = "$method $parse[path] HTTP/1.0\r\nHost: $parse[host]\r\nContent-type: application/x-www-form-urlencoded\r\n{$wlength}Connection: close\r\n\r\n$wdata"; + @fwrite($fp, $write); + while ($data = @fread($fp, 4096)) { + $responseText .= $data; + } + @fclose($fp); + empty($showagent) && $responseText = trim(stristr($responseText, "\r\n\r\n"), "\r\n"); + return $responseText; } - @fclose($fp); - empty($showagent) && $responseText = trim(stristr($responseText,"\r\n\r\n"),"\r\n"); - return $responseText; } -} $allPath = array(); $needDir = "$cfg_medias_dir| @@ -133,32 +127,30 @@ if(!function_exists('PostHost')) $cfg_special| $cfg_cmspath$cfg_arcdir"; $needDir = explode('|', $needDir); - foreach($needDir as $key => $val) - { + foreach ($needDir as $key => $val) { $allPath[trim($val)] = array( - 'read'=>true, // 读取 - 'write'=>true, // 写入 - 'execute'=>false // 执行 + 'read' => true, // 读取 + 'write' => true, // 写入 + 'execute' => false // 执行 ); } - - + + // 所有栏目目录 $sql = "SELECT typedir FROM #@__arctype ORDER BY id DESC"; $dsql->SetQuery($sql); $dsql->Execute('al', $sql); - while($row = $dsql->GetArray('al')) - { + while ($row = $dsql->GetArray('al')) { $typedir = str_replace($cfg_basehost, '', $row['typedir']); - if(preg_match("/^http:|^ftp:/i", $row['typedir'])) continue; + if (preg_match("/^http:|^ftp:/i", $row['typedir'])) continue; $typedir = str_replace("{cmspath}", $cfg_cmspath, $row['typedir']); $allPath[trim($typedir)] = array( - 'read'=>true, // 读取 - 'write'=>true, // 写入 - 'execute'=>false // 执行 + 'read' => true, // 读取 + 'write' => true, // 写入 + 'execute' => false // 执行 ); } - + // 只允许读取,不允许写入的目录 $needDir = array( 'include', @@ -166,257 +158,241 @@ if(!function_exists('PostHost')) 'plus', ); // 获取子目录 - function GetSondir($d, &$dirname=array()) + function GetSondir($d, &$dirname = array()) { $dh = dir($d); - while($filename = $dh->read() ) - { - if(substr($filename, 0, 1)=='.' || is_file($d.'/'.$filename) || - preg_match("#^(svn|bak-)#i", $filename) ) - { - CONTINUE; + while ($filename = $dh->read()) { + if ( + substr($filename, 0, 1) == '.' || is_file($d . '/' . $filename) || + preg_match("#^(svn|bak-)#i", $filename) + ) { + continue; } - if(is_dir($d.'/'.$filename)) - { - $dirname[] = $d.'/'.$filename; - GetSondir($d.'/'.$filename,$dirname); + if (is_dir($d . '/' . $filename)) { + $dirname[] = $d . '/' . $filename; + GetSondir($d . '/' . $filename, $dirname); } } $dh->close(); return $dirname; } - + //获取所有文件列表 - function preg_ls($path=".", $rec=FALSE, $pat="/.*/", $ignoredir='') + function preg_ls($path = ".", $rec = FALSE, $pat = "/.*/", $ignoredir = '') { - while (substr ($path,-1,1) =="/") - { - $path=substr ($path,0,-1); + while (substr($path, -1, 1) == "/") { + $path = substr($path, 0, -1); } - if (!is_dir ($path) ) - { - $path=dirname ($path); + if (!is_dir($path)) { + $path = dirname($path); } - if ($rec!==TRUE) - { - $rec=FALSE; + if ($rec !== TRUE) { + $rec = FALSE; } - $d=dir ($path); - $ret=Array (); - while (FALSE!== ($e=$d->read () ) ) - { - if ( ($e==".") || ($e=="..") ) - { + $d = dir($path); + $ret = array(); + while (FALSE !== ($e = $d->read())) { + if (($e == ".") || ($e == "..")) { continue; } - if ($rec && is_dir ($path."/".$e) && ($ignoredir == '' || strpos($ignoredir,$e ) === FALSE)) - { - $ret = array_merge ($ret, preg_ls($path."/".$e, $rec, $pat, $ignoredir)); + if ($rec && is_dir($path . "/" . $e) && ($ignoredir == '' || strpos($ignoredir, $e) === FALSE)) { + $ret = array_merge($ret, preg_ls($path . "/" . $e, $rec, $pat, $ignoredir)); continue; } - if (!preg_match ($pat, $e) ) - { + if (!preg_match($pat, $e)) { continue; } - $ret[] = $path."/".$e; + $ret[] = $path . "/" . $e; } - return (empty ($ret) && preg_match ($pat,basename($path))) ? Array ($path."/") : $ret; + return (empty($ret) && preg_match($pat, basename($path))) ? array($path . "/") : $ret; } - - foreach($needDir as $key => $val) - { - $allPath[trim('/'.$val)] = array( - 'read'=>true, // 读取 - 'write'=>false, // 写入 - 'execute'=>true // 执行 + + foreach ($needDir as $key => $val) { + $allPath[trim('/' . $val)] = array( + 'read' => true, // 读取 + 'write' => false, // 写入 + 'execute' => true // 执行 ); - $sonDir = GetSondir(DEDEROOT.'/'.$val); - foreach($sonDir as $kk => $vv) - { + $sonDir = GetSondir(DEDEROOT . '/' . $val); + foreach ($sonDir as $kk => $vv) { $vv = trim(str_replace(DEDEROOT, '', $vv)); $allPath[$vv] = array( - 'read'=>true, // 读取 - 'write'=>false, // 写入 - 'execute'=>true // 执行 + 'read' => true, // 读取 + 'write' => false, // 写入 + 'execute' => true // 执行 ); } - } - + // 不需要执行的 $needDir = array( '/images', '/templets' ); - foreach($needDir as $key => $val) - { - $allPath[trim('/'.$val)] = array( - 'read'=>true, // 读取 - 'write'=>false, // 写入 - 'execute'=>false // 执行 + foreach ($needDir as $key => $val) { + $allPath[trim('/' . $val)] = array( + 'read' => true, // 读取 + 'write' => false, // 写入 + 'execute' => false // 执行 ); - $sonDir = GetSondir(DEDEROOT.'/'.$val); - foreach($sonDir as $kk => $vv) - { - $vv = trim(str_replace(DEDEROOT.'/', '', $vv)); + $sonDir = GetSondir(DEDEROOT . '/' . $val); + foreach ($sonDir as $kk => $vv) { + $vv = trim(str_replace(DEDEROOT . '/', '', $vv)); $allPath[$vv] = array( - 'read'=>true, // 读取 - 'write'=>false, // 写入 - 'execute'=>false // 执行 + 'read' => true, // 读取 + 'write' => false, // 写入 + 'execute' => false // 执行 ); } - } - + // 所有js建议只读 $jsDir = array( '/images', '/templets', '/include' ); - foreach ($jsDir as $k => $v) - { - $jsfiles = preg_ls(DEDEROOT.$v, TRUE, "/.*\.(js)$/i"); - foreach ($jsfiles as $k => $v) - { - $vv = trim(str_replace(DEDEROOT.'/', '/', $v)); + foreach ($jsDir as $k => $v) { + $jsfiles = preg_ls(DEDEROOT . $v, TRUE, "/.*\.(js)$/i"); + foreach ($jsfiles as $k => $v) { + $vv = trim(str_replace(DEDEROOT . '/', '/', $v)); $allPath[$vv] = array( - 'read'=>true, // 读取 - 'write'=>false, // 写入 - 'execute'=>false // 执行 + 'read' => true, // 读取 + 'write' => false, // 写入 + 'execute' => false // 执行 ); } } -?> -
    -
    -
    系统运行目录权限检测返回主页帮助说明
    -
    -
    说明:本程序用于检测DedeCMS站点所涉及的目录权限,并且提供一个全面的检测说明,您可以根据检测报告来配置站点以保证站点更为安全。
    -
    - - - - - - - - - -
    目录执行读取写入
    -
    -
    -
    - - - -
    -
    -
    -
    -
    -
    -
    - - + function GoPlay() { + if (n > log.length - 1) { + n = -1; + clearIntervals(); + } + if (n > -1) { + postcheck(n); + n++; + } + } + + function postcheck(n) { + var item = log[n]; + item = item.split('|'); + + document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight; + if (item == '') { + return false; + } + var tempvar = '\r ' + item[0] + '\r ' + item[1] + '\r \r ' + item[2] + '\r \r ' + item[3] + '\r '; + + //chiledelem.innerHTML = tempvar; + //document.getElementById("mainList").appendChild(chiledelem); + $("#mainList").append(tempvar); + document.getElementById('log').scrollTop = document.getElementById('log').scrollHeight; + } + + function setIntervals() { + timer = setInterval('GoPlay()', 50); + } + + function clearIntervals() { + clearInterval(timer); + //document.getElementById('install').submit(); + alert('全部检测完毕,您可以按照检测结果进行系统权限调整!'); + } + //setTimeout(setIntervals, 100); + + + function changeHeight() { + var newheight = $(window).height() - 170; + $("#safelist").css('height', newheight + 'px'); + var logheight = newheight; + $("#log").css('height', logheight + 'px'); + } + // 开始检测 + function startScan() { + setTimeout(setIntervals, 100); + } + $.ready = function() { + changeHeight(); + $(window).resize(function() { + changeHeight(); + }); + }; + + \ No newline at end of file diff --git a/src/dede/tpl.php b/src/dede/tpl.php index 9dd57730..0d0c5053 100755 --- a/src/dede/tpl.php +++ b/src/dede/tpl.php @@ -1,102 +1,89 @@ read())) - { - if($entry != '.' && $entry != '..' && !is_dir($tagHelpDir.$entry)) - { + while (false !== ($entry = $dir->read())) { + if ($entry != '.' && $entry != '..' && !is_dir($tagHelpDir . $entry)) { $dtags[] = str_replace('.txt', '', $entry); } } $dir->close(); - foreach($dtags as $tag) - { + foreach ($dtags as $tag) { //$helpContent = file_get_contents($tagHelpDir.$tag.'.txt'); - $fp = fopen($tagHelpDir.$tag.'.txt','r'); - $helpContent = fread($fp,filesize($tagHelpDir.$tag.'.txt')); + $fp = fopen($tagHelpDir . $tag . '.txt', 'r'); + $helpContent = fread($fp, filesize($tagHelpDir . $tag . '.txt')); fclose($fp); $helps[$tag] = explode('>>dede>>', $helpContent); } make_hash(); - include DEDEADMIN.'/templets/tpl_edit.htm'; + include DEDEADMIN . '/templets/tpl_edit.htm'; exit(); } /*--------------------------- function save_tpl() { } 保存编辑模板 ---------------------------*/ -else if($action == 'saveedit') -{ +--------------------------*/ else if ($action == 'saveedit') { CheckCSRF(); - if($filename == '') - { + if ($filename == '') { ShowMsg('未指定要编辑的文件或文件名不合法', '-1'); exit(); } - if(!preg_match("#\.htm$#", $filename)) - { + if (!preg_match("#\.htm$#", $filename)) { ShowMsg('DEDE模板文件,文件名必须用.htm结尾!', '-1'); exit(); } @@ -105,46 +92,39 @@ else if($action == 'saveedit') $content = preg_replace("/##\/textarea/i", "Init("tpl.php","js/blank.js","POST' enctype='multipart/form-data' "); + $win->Init("tpl.php", "js/blank.js", "POST' enctype='multipart/form-data' "); $win->mainTitle = "模块管理"; $wecome_info = "模板管理 >> 上传模板"; $win->AddTitle('请选择要上传的文件:'); - $win->AddHidden("action",'uploadok'); + $win->AddHidden("action", 'uploadok'); $msg = " @@ -158,37 +138,30 @@ else if ($action == 'upload')
    "; $win->AddMsgItem("
    $msg
    "); - $winform = $win->GetWindow('ok',''); + $winform = $win->GetWindow('ok', ''); $win->Display(); exit(); } /*---------------------- function _upload() {} 上传新模板 ------------------------*/ -else if ($action == 'uploadok') -{ +-----------------------*/ else if ($action == 'uploadok') { CheckCSRF(); - if( !is_uploaded_file($upfile) ) - { - ShowMsg("貌似你什么都没有上传哦!","javascript:;"); + if (!is_uploaded_file($upfile)) { + ShowMsg("貌似你什么都没有上传哦!", "javascript:;"); exit(); - } - else - { - if( !preg_match("#\.(htm|html)$#", $upfile_name) ) - { - ShowMsg("DedeCMS模板只能用 .htm 或 .html扩展名!", "-1"); - exit(); + } else { + if (!preg_match("#\.(htm|html)$#", $upfile_name)) { + ShowMsg("DedeCMSV6模板只能用 .htm 或 .html扩展名!", "-1"); + exit(); } - if( preg_match("#[\\\\\/]#", $upfile_name) ) - { + if (preg_match("#[\\\\\/]#", $upfile_name)) { ShowMsg("模板文件名有非法字符,禁止上传!", "-1"); - exit(); + exit(); } - move_uploaded_file($upfile, $templetdird.'/'.$upfile_name); + move_uploaded_file($upfile, $templetdird . '/' . $upfile_name); @unlink($upfile); - ShowMsg("成功上传一个模板!","templets_main.php?acdir=$acdir"); + ShowMsg("成功上传一个模板!", "templets_main.php?acdir=$acdir"); exit(); } exit(); @@ -196,12 +169,9 @@ else if ($action == 'uploadok') /*--------------------------- function edittag() { } 修改标签碎片 ---------------------------*/ -else if($action=='edittag' || $action=='addnewtag') -{ - if($action=='addnewtag') - { - $democode = '<'."?php +--------------------------*/ else if ($action == 'edittag' || $action == 'addnewtag') { + if ($action == 'addnewtag') { + $democode = '<' . "?php if(!defined('DEDEINC')) { exit(\"Request Error!\"); @@ -224,42 +194,36 @@ function lib_demotag(&\$ctag,&\$refObj) //------------------------------------------------------ return \$revalue; } -?".'>'; +?" . '>'; $filename = "demotag.lib.php"; $title = "新建标签"; - } - else - { - if(!preg_match("#^[a-z0-9_-]{1,}\.lib\.php$#i", $filename)) - { - ShowMsg('文件不是标准的标签碎片文件,不允许在此编辑!','-1'); + } else { + if (!preg_match("#^[a-z0-9_-]{1,}\.lib\.php$#i", $filename)) { + ShowMsg('文件不是标准的标签碎片文件,不允许在此编辑!', '-1'); exit(); } - $fp = fopen(DEDEINC.'/taglib/'.$filename,'r'); - $democode = fread($fp, filesize(DEDEINC.'/taglib/'.$filename)); + $fp = fopen(DEDEINC . '/taglib/' . $filename, 'r'); + $democode = fread($fp, filesize(DEDEINC . '/taglib/' . $filename)); fclose($fp); $title = "修改标签"; } make_hash(); - include DEDEADMIN.'/templets/tpl_edit_tag.htm'; + include DEDEADMIN . '/templets/tpl_edit_tag.htm'; exit(); } /*--------------------------- function savetagfile() { } 保存标签碎片修改 ---------------------------*/ -else if($action=='savetagfile') -{ +--------------------------*/ else if ($action == 'savetagfile') { CheckCSRF(); - if(!preg_match("#^[a-z0-9_-]{1,}\.lib\.php$#i", $filename)) - { + if (!preg_match("#^[a-z0-9_-]{1,}\.lib\.php$#i", $filename)) { ShowMsg('文件名不合法,不允许进行操作!', '-1'); exit(); } - require_once(DEDEINC.'/oxwindow.class.php'); + require_once(DEDEINC . '/oxwindow.class.php'); $tagname = preg_replace("#\.lib\.php$#i", "", $filename); $content = stripslashes($content); - $truefile = DEDEINC.'/taglib/'.$filename; + $truefile = DEDEINC . '/taglib/' . $filename; $fp = fopen($truefile, 'w'); fwrite($fp, $content); fclose($fp); @@ -276,7 +240,7 @@ else if($action=='savetagfile') $win = new OxWindow(); $win->AddTitle("修改/新建标签:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",false); + $winform = $win->GetWindow("hand", " ", false); $win->Display(); exit(); -} \ No newline at end of file +} diff --git a/src/dede/vote_add.php b/src/dede/vote_add.php index 868a764f..767a34af 100755 --- a/src/dede/vote_add.php +++ b/src/dede/vote_add.php @@ -1,88 +1,80 @@ ".${"voteitem".$i}."\r\n"; + $voteitems .= "" . ${"voteitem" . $i} . "\r\n"; } } $inQuery = "INSERT INTO `#@__vote`(votename,starttime,endtime,totalcount,ismore,votenote,isallow,view,spec,isenable) VALUES('$votename','$starttime','$endtime','0','$ismore','$voteitems','$isallow','$view','$spec','$isenable'); "; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { - ShowMsg("增加投票失败,请检查数据是否非法!","-1"); + if (!$dsql->ExecuteNoneQuery($inQuery)) { + ShowMsg("增加投票失败,请检查数据是否非法!", "-1"); exit(); } $aid = $dsql->GetLastID(); $vt = new DedeVote($aid); $vote_content = $vt->GetVoteForm(); - $vote_content = preg_replace(array("#/#","#([\r\n])[\s]+#"),array("\/"," "),$vote_content);//取出内容中的空白字符并进行转义 - $vote_content = 'document.write("'.$vote_content.'");'; - - $vote_file = DEDEDATA."/vote/vote_".$aid.".js"; + $vote_content = preg_replace(array("#/#", "#([\r\n])[\s]+#"), array("\/", " "), $vote_content); //取出内容中的空白字符并进行转义 + $vote_content = 'document.write("' . $vote_content . '");'; + + $vote_file = DEDEDATA . "/vote/vote_" . $aid . ".js"; file_put_contents($vote_file, $vote_content); - ShowMsg("成功增加一组投票!","vote_main.php"); + ShowMsg("成功增加一组投票!", "vote_main.php"); exit(); -} -else if($dopost=="save" && $isarc == 1) -{ +} else if ($dopost == "save" && $isarc == 1) { $starttime = GetMkTime($starttime); $endtime = GetMkTime($endtime); $voteitems = ""; - + $j = 0; - for($i=1; $i<=15; $i++) - { - if(!empty(${"voteitem".$i})) - { + for ($i = 1; $i <= 15; $i++) { + if (!empty(${"voteitem" . $i})) { $j++; - $voteitems .= "".${"voteitem".$i}."\r\n"; + $voteitems .= "" . ${"voteitem" . $i} . "\r\n"; } } $inQuery = "INSERT INTO `#@__vote`(votename,starttime,endtime,totalcount,ismore,votenote,isallow,view,spec,isenable) VALUES('$votename','$starttime','$endtime','0','$ismore','$voteitems','$isallow','$view','$spec','$isenable'); "; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { - ShowMsg("增加投票失败,请检查数据是否非法!","-1"); + if (!$dsql->ExecuteNoneQuery($inQuery)) { + ShowMsg("增加投票失败,请检查数据是否非法!", "-1"); exit(); } $aid = $dsql->GetLastID(); $vt = new DedeVote($aid); $vote_content = $vt->GetVoteForm(); - $vote_content = preg_replace(array("#/#","#([\r\n])[\s]+#"),array("\/"," "),$vote_content);//取出内容中的空白字符并进行转义 - $vote_content = 'document.write("'.$vote_content.'");'; - - $vote_file = DEDEDATA."/vote/vote_".$aid.".js"; + $vote_content = preg_replace(array("#/#", "#([\r\n])[\s]+#"), array("\/", " "), $vote_content); //取出内容中的空白字符并进行转义 + $vote_content = 'document.write("' . $vote_content . '");'; + + $vote_file = DEDEDATA . "/vote/vote_" . $aid . ".js"; file_put_contents($vote_file, $vote_content); - ShowMsg("成功增加一组投票!","vote_main.php?issel=1&aid=".$aid); + ShowMsg("成功增加一组投票!", "vote_main.php?issel=1&aid=" . $aid); exit(); } $startDay = time(); -$endDay = AddDay($startDay,30); +$endDay = AddDay($startDay, 30); $startDay = GetDateTimeMk($startDay); $endDay = GetDateTimeMk($endDay); -include DedeInclude('templets/vote_add.htm'); \ No newline at end of file +include DedeInclude('templets/vote_add.htm'); diff --git a/src/dede/vote_edit.php b/src/dede/vote_edit.php index 834dd453..c3a826af 100755 --- a/src/dede/vote_edit.php +++ b/src/dede/vote_edit.php @@ -1,39 +1,33 @@ ExecuteNoneQuery("DELETE FROM `#@__vote` WHERE aid='$aid'")) - { - if($dsql->ExecuteNoneQuery("DELETE FROM `#@__vote_member` WHERE voteid='$aid'")) - { +if ($dopost == "delete") { + if ($dsql->ExecuteNoneQuery("DELETE FROM `#@__vote` WHERE aid='$aid'")) { + if ($dsql->ExecuteNoneQuery("DELETE FROM `#@__vote_member` WHERE voteid='$aid'")) { ShowMsg('成功删除一组投票!', $ENV_GOBACK_URL); exit; } - } - else - { + } else { ShowMsg('指定删除投票不存在!', $ENV_GOBACK_URL); exit; } -} -else if($dopost=="saveedit") -{ +} else if ($dopost == "saveedit") { CheckCSRF(); $starttime = GetMkTime($starttime); $endtime = GetMkTime($endtime); @@ -49,28 +43,22 @@ else if($dopost=="saveedit") isenable='$isenable' WHERE aid='$aid' "; - if($dsql->ExecuteNoneQuery($query)) - { + if ($dsql->ExecuteNoneQuery($query)) { $vt = new DedeVote($aid); - $vote_file = DEDEDATA."/vote/vote_".$aid.".js"; + $vote_file = DEDEDATA . "/vote/vote_" . $aid . ".js"; $vote_content = $vt->GetVoteForm(); - $vote_content = preg_replace(array("#/#","#([\r\n])[\s]+#"),array("\/"," "),$vote_content); //取出内容中的空白字符并进行转义 - $vote_content = 'document.write("'.$vote_content.'");'; - file_put_contents($vote_file,$vote_content); - ShowMsg('成功更改一组投票!',$ENV_GOBACK_URL); + $vote_content = preg_replace(array("#/#", "#([\r\n])[\s]+#"), array("\/", " "), $vote_content); //取出内容中的空白字符并进行转义 + $vote_content = 'document.write("' . $vote_content . '");'; + file_put_contents($vote_file, $vote_content); + ShowMsg('成功更改一组投票!', $ENV_GOBACK_URL); + } else { + ShowMsg('更改一组投票失败!', $ENV_GOBACK_URL); } - else - { - ShowMsg('更改一组投票失败!',$ENV_GOBACK_URL); - } -} -else -{ +} else { $row = $dsql->GetOne("SELECT * FROM #@__vote WHERE aid='$aid'"); - if(!is_array($row)) - { + if (!is_array($row)) { ShowMsg('指定投票不存在!', '-1'); exit(); } include DedeInclude('templets/vote_edit.htm'); -} \ No newline at end of file +} diff --git a/src/dede/vote_getcode.php b/src/dede/vote_getcode.php index 375ad07e..8368bef7 100755 --- a/src/dede/vote_getcode.php +++ b/src/dede/vote_getcode.php @@ -1,14 +1,15 @@ SetParameter('issel',$issel); - $dlist->SetTemplet(DEDEADMIN."/templets/vote_select.htm"); +if ($issel == 1) { + $dlist->SetParameter('issel', $issel); + $dlist->SetTemplet(DEDEADMIN . "/templets/vote_select.htm"); } else { - $dlist->SetTemplet(DEDEADMIN."/templets/vote_main.htm"); + $dlist->SetTemplet(DEDEADMIN . "/templets/vote_main.htm"); } $dlist->SetSource($sql); -$dlist->display(); \ No newline at end of file +$dlist->display(); diff --git a/src/include/arc.archives.class.php b/src/include/arc.archives.class.php index 34b6563d..57fff254 100755 --- a/src/include/arc.archives.class.php +++ b/src/include/arc.archives.class.php @@ -1,25 +1,25 @@ IsError = FALSE; $this->ArcID = $aid; $this->PreNext = array(); @@ -62,17 +62,13 @@ class Archives $this->dsql = $dsql; $query = "SELECT channel,typeid FROM `#@__arctiny` WHERE id='$aid' "; $arr = $this->dsql->GetOne($query); - if(!is_array($arr)) - { + if (!is_array($arr)) { $this->IsError = TRUE; - } - else - { - if($arr['channel']==0) $arr['channel']=1; + } else { + if ($arr['channel'] == 0) $arr['channel'] = 1; $this->ChannelUnit = new ChannelUnit($arr['channel'], $aid); $this->TypeLink = new TypeLink($arr['typeid']); - if($this->ChannelUnit->ChannelInfos['issystem']!=-1) - { + if ($this->ChannelUnit->ChannelInfos['issystem'] != -1) { // 如果当前文档不是系统模型,为单表模型 $query = "SELECT arc.*,tp.reid,tp.typedir,ch.addtable FROM `#@__archives` arc @@ -80,9 +76,7 @@ class Archives LEFT JOIN #@__channeltype as ch on arc.channel = ch.id WHERE arc.id='$aid' "; $this->Fields = $this->dsql->GetOne($query); - } - else - { + } else { $this->Fields['title'] = ''; $this->Fields['money'] = $this->Fields['arcrank'] = 0; $this->Fields['senddate'] = $this->Fields['pubdate'] = $this->Fields['mid'] = $this->Fields['adminid'] = 0; @@ -90,8 +84,7 @@ class Archives $this->Fields['filename'] = ''; } - if($this->TypeLink->TypeInfos['corank'] > 0 && $this->Fields['arcrank']==0) - { + if ($this->TypeLink->TypeInfos['corank'] > 0 && $this->Fields['arcrank'] == 0) { $this->Fields['arcrank'] = $this->TypeLink->TypeInfos['corank']; } @@ -107,12 +100,9 @@ class Archives $this->TempSource = ''; $this->ftp = &$ftp; $this->remoteDir = ''; - if(empty($GLOBALS['pageno'])) - { + if (empty($GLOBALS['pageno'])) { $this->NowPage = 1; - } - else - { + } else { $this->NowPage = $GLOBALS['pageno']; } @@ -123,23 +113,19 @@ class Archives $this->Fields['typeid'] = $arr['typeid']; //设置一些全局参数的值 - foreach($GLOBALS['PubFields'] as $k=>$v) - { + foreach ($GLOBALS['PubFields'] as $k => $v) { $this->Fields[$k] = $v; } //为了减少重复查询,这里直接把附加表查询记录放在 $this->addTableRow 中,在 ParAddTable() 不再查询 - if($this->ChannelUnit->ChannelInfos['addtable']!='') - { + if ($this->ChannelUnit->ChannelInfos['addtable'] != '') { $query = "SELECT * FROM `{$this->ChannelUnit->ChannelInfos['addtable']}` WHERE `aid` = '$aid'"; $this->addTableRow = $this->dsql->GetOne($query); } //issystem==-1 表示单表模型,单表模型不支持redirecturl这类参数,因此限定内容普通模型才进行下面查询 - if($this->ChannelUnit->ChannelInfos['addtable']!='' && $this->ChannelUnit->ChannelInfos['issystem']!=-1) - { - if(is_array($this->addTableRow)) - { + if ($this->ChannelUnit->ChannelInfos['addtable'] != '' && $this->ChannelUnit->ChannelInfos['issystem'] != -1) { + if (is_array($this->addTableRow)) { $this->Fields['redirecturl'] = $this->addTableRow['redirecturl']; $this->Fields['templet'] = $this->addTableRow['templet']; $this->Fields['userip'] = $this->addTableRow['userip']; @@ -147,12 +133,10 @@ class Archives $this->Fields['templet'] = (empty($this->Fields['templet']) ? '' : trim($this->Fields['templet'])); $this->Fields['redirecturl'] = (empty($this->Fields['redirecturl']) ? '' : trim($this->Fields['redirecturl'])); $this->Fields['userip'] = (empty($this->Fields['userip']) ? '' : trim($this->Fields['userip'])); - } - else - { + } else { $this->Fields['templet'] = $this->Fields['redirecturl'] = ''; } - }//!error + } //!error } //php4构造函数 @@ -170,52 +154,40 @@ class Archives function ParAddTable() { //读取附加表信息,并把附加表的资料经过编译处理后导入到$this->Fields中,以方便在模板中用 {dede:field name='fieldname' /} 标记统一调用 - if($this->ChannelUnit->ChannelInfos['addtable']!='') - { + if ($this->ChannelUnit->ChannelInfos['addtable'] != '') { $row = $this->addTableRow; - if($this->ChannelUnit->ChannelInfos['issystem']==-1) - { + if ($this->ChannelUnit->ChannelInfos['issystem'] == -1) { $this->Fields['title'] = $row['title']; $this->Fields['senddate'] = $this->Fields['pubdate'] = $row['senddate']; $this->Fields['mid'] = $this->Fields['adminid'] = $row['mid']; $this->Fields['ismake'] = 1; $this->Fields['arcrank'] = 0; - $this->Fields['money']=0; + $this->Fields['money'] = 0; $this->Fields['filename'] = ''; } - if(is_array($row)) - { - foreach($row as $k=>$v) $row[strtolower($k)] = $v; + if (is_array($row)) { + foreach ($row as $k => $v) $row[strtolower($k)] = $v; } - if(is_array($this->ChannelUnit->ChannelFields) && !empty($this->ChannelUnit->ChannelFields)) - { - foreach($this->ChannelUnit->ChannelFields as $k=>$arr) - { - if(isset($row[$k])) - { - if(!empty($arr['rename'])) - { + if (is_array($this->ChannelUnit->ChannelFields) && !empty($this->ChannelUnit->ChannelFields)) { + foreach ($this->ChannelUnit->ChannelFields as $k => $arr) { + if (isset($row[$k])) { + if (!empty($arr['rename'])) { $nk = $arr['rename']; - } - else - { + } else { $nk = $k; } $cobj = $this->GetCurTag($k); - if(is_object($cobj)) - { - foreach($this->dtp->CTags as $ctag) - { - if($ctag->GetTagName()=='field' && $ctag->GetAtt('name')==$k) - { + if (is_object($cobj)) { + foreach ($this->dtp->CTags as $ctag) { + if ($ctag->GetTagName() == 'field' && $ctag->GetAtt('name') == $k) { //带标识的专题节点 - if($ctag->GetAtt('noteid') != '') { - $this->Fields[$k.'_'.$ctag->GetAtt('noteid')] = $this->ChannelUnit->MakeField($k, $row[$k], $ctag); + if ($ctag->GetAtt('noteid') != '') { + $this->Fields[$k . '_' . $ctag->GetAtt('noteid')] = $this->ChannelUnit->MakeField($k, $row[$k], $ctag); } //带类型的字段节点 - else if($ctag->GetAtt('type') != '') { - $this->Fields[$k.'_'.$ctag->GetAtt('type')] = $this->ChannelUnit->MakeField($k, $row[$k], $ctag); + else if ($ctag->GetAtt('type') != '') { + $this->Fields[$k . '_' . $ctag->GetAtt('type')] = $this->ChannelUnit->MakeField($k, $row[$k], $ctag); } //其它字段 else { @@ -223,52 +195,42 @@ class Archives } } } - } - else - { + } else { $this->Fields[$nk] = $row[$k]; } - if($arr['type']=='htmltext' && $GLOBALS['cfg_keyword_replace']=='Y' && !empty($this->Fields['keywords'])) - { - $this->Fields[$nk] = $this->ReplaceKeyword($this->Fields['keywords'],$this->Fields[$nk]); + if ($arr['type'] == 'htmltext' && $GLOBALS['cfg_keyword_replace'] == 'Y' && !empty($this->Fields['keywords'])) { + $this->Fields[$nk] = $this->ReplaceKeyword($this->Fields['keywords'], $this->Fields[$nk]); } } - }//End foreach + } //End foreach } //设置全局环境变量 $this->Fields['typename'] = $this->TypeLink->TypeInfos['typename']; - @SetSysEnv($this->Fields['typeid'],$this->Fields['typename'],$this->Fields['id'],$this->Fields['title'],'archives'); + @SetSysEnv($this->Fields['typeid'], $this->Fields['typename'], $this->Fields['id'], $this->Fields['title'], 'archives'); } //完成附加表信息读取 unset($row); //处理要分页显示的字段 - $this->SplitTitles = Array(); - if($this->SplitPageField!='' && $GLOBALS['cfg_arcsptitle']='Y' - && isset($this->Fields[$this->SplitPageField])) - { - $this->SplitFields = explode("#p#",$this->Fields[$this->SplitPageField]); + $this->SplitTitles = array(); + if ($this->SplitPageField != '' && $GLOBALS['cfg_arcsptitle'] = 'Y' + && isset($this->Fields[$this->SplitPageField]) + ) { + $this->SplitFields = explode("#p#", $this->Fields[$this->SplitPageField]); $i = 1; - foreach($this->SplitFields as $k=>$v) - { - $tmpv = cn_substr($v,50); - $pos = strpos($tmpv,'#e#'); - if($pos>0) - { - $st = trim(cn_substr($tmpv,$pos)); - if($st==""||$st=="副标题"||$st=="分页标题") - { - $this->SplitFields[$k] = preg_replace("/^(.*)#e#/is","",$v); + foreach ($this->SplitFields as $k => $v) { + $tmpv = cn_substr($v, 50); + $pos = strpos($tmpv, '#e#'); + if ($pos > 0) { + $st = trim(cn_substr($tmpv, $pos)); + if ($st == "" || $st == "副标题" || $st == "分页标题") { + $this->SplitFields[$k] = preg_replace("/^(.*)#e#/is", "", $v); continue; - } - else - { - $this->SplitFields[$k] = preg_replace("/^(.*)#e#/is","",$v); + } else { + $this->SplitFields[$k] = preg_replace("/^(.*)#e#/is", "", $v); $this->SplitTitles[$k] = $st; } - } - else - { + } else { continue; } $i++; @@ -278,15 +240,12 @@ class Archives } //处理默认缩略图等 - if (isset($this->Fields['litpic'])) - { - if($this->Fields['litpic'] == '-' || $this->Fields['litpic'] == '') - { - $this->Fields['litpic'] = $GLOBALS['cfg_cmspath'].'/static/defaultpic.jpg'; + if (isset($this->Fields['litpic'])) { + if ($this->Fields['litpic'] == '-' || $this->Fields['litpic'] == '') { + $this->Fields['litpic'] = $GLOBALS['cfg_cmspath'] . '/static/defaultpic.jpg'; } - if(!preg_match("#^http:\/\/#i", $this->Fields['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') - { - $this->Fields['litpic'] = $GLOBALS['cfg_mainsite'].$this->Fields['litpic']; + if (!preg_match("#^http:\/\/#i", $this->Fields['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { + $this->Fields['litpic'] = $GLOBALS['cfg_mainsite'] . $this->Fields['litpic']; } $this->Fields['picname'] = $this->Fields['litpic']; @@ -294,27 +253,21 @@ class Archives $this->Fields['image'] = (!preg_match('/jpg|gif|png/i', $this->Fields['picname']) ? '' : ""); } // 处理投票选项 - if (isset($this->Fields['voteid']) && !empty($this->Fields['voteid'])) - { + if (isset($this->Fields['voteid']) && !empty($this->Fields['voteid'])) { $this->Fields['vote'] = ''; $voteid = $this->Fields['voteid']; $this->Fields['vote'] = ""; - if ($GLOBALS['cfg_multi_site'] == 'Y') - { + if ($GLOBALS['cfg_multi_site'] == 'Y') { $this->Fields['vote'] = ""; } } - if (isset($this->Fields['goodpost']) && isset($this->Fields['badpost'])) - { + if (isset($this->Fields['goodpost']) && isset($this->Fields['badpost'])) { //digg - if($this->Fields['goodpost'] + $this->Fields['badpost'] == 0) - { + if ($this->Fields['goodpost'] + $this->Fields['badpost'] == 0) { $this->Fields['goodper'] = $this->Fields['badper'] = 0; - } - else - { - $this->Fields['goodper'] = number_format($this->Fields['goodpost']/($this->Fields['goodpost']+$this->Fields['badpost']), 3)*100; + } else { + $this->Fields['goodper'] = number_format($this->Fields['goodpost'] / ($this->Fields['goodpost'] + $this->Fields['badpost']), 3) * 100; $this->Fields['badper'] = 100 - $this->Fields['goodper']; } } @@ -323,18 +276,13 @@ class Archives //获得当前字段参数 function GetCurTag($fieldname) { - if(!isset($this->dtp->CTags)) - { + if (!isset($this->dtp->CTags)) { return ''; } - foreach($this->dtp->CTags as $ctag) - { - if($ctag->GetTagName()=='field' && $ctag->GetAtt('name')==$fieldname) - { + foreach ($this->dtp->CTags as $ctag) { + if ($ctag->GetTagName() == 'field' && $ctag->GetAtt('name') == $fieldname) { return $ctag; - } - else - { + } else { continue; } } @@ -348,12 +296,11 @@ class Archives * @param int $isremote 是否远程 * @return string */ - function MakeHtml($isremote=0) + function MakeHtml($isremote = 0) { - global $fileFirst,$baidu_seo,$cfg_basehost; + global $fileFirst, $baidu_seo, $cfg_basehost; - if($this->IsError) - { + if ($this->IsError) { return ''; } $this->Fields["displaytype"] = "st"; @@ -361,69 +308,80 @@ class Archives $this->LoadTemplet(); $this->ParAddTable(); $this->ParseTempletsFirst(); - $this->Fields['senddate'] = empty($this->Fields['senddate'])? '' : $this->Fields['senddate']; - $this->Fields['title'] = empty($this->Fields['title'])? '' : $this->Fields['title']; - $this->Fields['arcrank'] = empty($this->Fields['arcrank'])? 0 : $this->Fields['arcrank']; - $this->Fields['ismake'] = empty($this->Fields['ismake'])? 0 : $this->Fields['ismake']; - $this->Fields['money'] = empty($this->Fields['money'])? 0 : $this->Fields['money']; - $this->Fields['filename'] = empty($this->Fields['filename'])? '' : $this->Fields['filename']; + $this->Fields['senddate'] = empty($this->Fields['senddate']) ? '' : $this->Fields['senddate']; + $this->Fields['title'] = empty($this->Fields['title']) ? '' : $this->Fields['title']; + $this->Fields['arcrank'] = empty($this->Fields['arcrank']) ? 0 : $this->Fields['arcrank']; + $this->Fields['ismake'] = empty($this->Fields['ismake']) ? 0 : $this->Fields['ismake']; + $this->Fields['money'] = empty($this->Fields['money']) ? 0 : $this->Fields['money']; + $this->Fields['filename'] = empty($this->Fields['filename']) ? '' : $this->Fields['filename']; //分析要创建的文件名称 $filename = GetFileNewName( - $this->ArcID,$this->Fields['typeid'],$this->Fields['senddate'], - $this->Fields['title'],$this->Fields['ismake'],$this->Fields['arcrank'], - $this->TypeLink->TypeInfos['namerule'],$this->TypeLink->TypeInfos['typedir'],$this->Fields['money'],$this->Fields['filename'] + $this->ArcID, + $this->Fields['typeid'], + $this->Fields['senddate'], + $this->Fields['title'], + $this->Fields['ismake'], + $this->Fields['arcrank'], + $this->TypeLink->TypeInfos['namerule'], + $this->TypeLink->TypeInfos['typedir'], + $this->Fields['money'], + $this->Fields['filename'] ); $filenames = explode(".", $filename); - $this->ShortName = $filenames[count($filenames)-1]; - if($this->ShortName=='') $this->ShortName = 'html'; - $fileFirst = preg_replace("/\.".$this->ShortName."$/i", "", $filename); + $this->ShortName = $filenames[count($filenames) - 1]; + if ($this->ShortName == '') $this->ShortName = 'html'; + $fileFirst = preg_replace("/\." . $this->ShortName . "$/i", "", $filename); $this->Fields['namehand'] = basename($fileFirst); $filenames = explode("/", $filename); - $this->NameFirst = preg_replace("/\.".$this->ShortName."$/i", "", $filenames[count($filenames)-1]); - if($this->NameFirst=='') - { + $this->NameFirst = preg_replace("/\." . $this->ShortName . "$/i", "", $filenames[count($filenames) - 1]); + if ($this->NameFirst == '') { $this->NameFirst = $this->arcID; } //获得当前文档的全名 $filenameFull = GetFileUrl( - $this->ArcID,$this->Fields['typeid'],$this->Fields["senddate"], - $this->Fields["title"],$this->Fields["ismake"], - $this->Fields["arcrank"],$this->TypeLink->TypeInfos['namerule'],$this->TypeLink->TypeInfos['typedir'],$this->Fields["money"],$this->Fields['filename'], - $this->TypeLink->TypeInfos['moresite'],$this->TypeLink->TypeInfos['siteurl'],$this->TypeLink->TypeInfos['sitepath'] + $this->ArcID, + $this->Fields['typeid'], + $this->Fields["senddate"], + $this->Fields["title"], + $this->Fields["ismake"], + $this->Fields["arcrank"], + $this->TypeLink->TypeInfos['namerule'], + $this->TypeLink->TypeInfos['typedir'], + $this->Fields["money"], + $this->Fields['filename'], + $this->TypeLink->TypeInfos['moresite'], + $this->TypeLink->TypeInfos['siteurl'], + $this->TypeLink->TypeInfos['sitepath'] ); $this->Fields['arcurl'] = $this->Fields['fullname'] = $filenameFull; //对于已设置不生成HTML的文章直接返回网址 - if($this->Fields['ismake']==-1 || $this->Fields['arcrank']!=0 || $this->Fields['money']>0 - || ($this->Fields['typeid']==0 && $this->Fields['channel'] != -1) ) - { + if ( + $this->Fields['ismake'] == -1 || $this->Fields['arcrank'] != 0 || $this->Fields['money'] > 0 + || ($this->Fields['typeid'] == 0 && $this->Fields['channel'] != -1) + ) { return $this->GetTrueUrl($filename); } //循环生成HTML文件 - else - { + else { $seoUrls = array(); - for($i=1;$i<=$this->TotalPage;$i++) - { - if($this->TotalPage > 1) { + for ($i = 1; $i <= $this->TotalPage; $i++) { + if ($this->TotalPage > 1) { $this->Fields['tmptitle'] = (empty($this->Fields['tmptitle']) ? $this->Fields['title'] : $this->Fields['tmptitle']); - if($i>1) $this->Fields['title'] = $this->Fields['tmptitle']."($i)"; - } - if($i>1) - { - $TRUEfilename = $this->GetTruePath().$fileFirst."_".$i.".".$this->ShortName; - $URLFilename = $fileFirst."_".$i.".".$this->ShortName; + if ($i > 1) $this->Fields['title'] = $this->Fields['tmptitle'] . "($i)"; } - else - { - $TRUEfilename = $this->GetTruePath().$filename; + if ($i > 1) { + $TRUEfilename = $this->GetTruePath() . $fileFirst . "_" . $i . "." . $this->ShortName; + $URLFilename = $fileFirst . "_" . $i . "." . $this->ShortName; + } else { + $TRUEfilename = $this->GetTruePath() . $filename; $URLFilename = $filename; } - $seoUrls = array_merge($seoUrls, array($cfg_basehost.$URLFilename)); - $this->ParseDMFields($i,1); + $seoUrls = array_merge($seoUrls, array($cfg_basehost . $URLFilename)); + $this->ParseDMFields($i, 1); $this->dtp->SaveTo($TRUEfilename); } @@ -439,14 +397,14 @@ class Archives ); curl_setopt_array($ch, $options); $result = curl_exec($ch); - $rs = json_decode($result,true); + $rs = json_decode($result, true); - if ($rs["success"]==1) { - echo "百度搜索引擎提交成功,剩余次数:".$rs["remain"]."
    \r\n"; + if ($rs["success"] == 1) { + echo "百度搜索引擎提交成功,剩余次数:" . $rs["remain"] . "
    \r\n"; } } } - $this->dsql->ExecuteNoneQuery("Update `#@__archives` SET ismake=1 WHERE id='".$this->ArcID."'"); + $this->dsql->ExecuteNoneQuery("Update `#@__archives` SET ismake=1 WHERE id='" . $this->ArcID . "'"); return $this->GetTrueUrl($filename); } @@ -459,21 +417,20 @@ class Archives */ function GetTrueUrl($nurl) { - return GetFileUrl - ( - $this->Fields['id'], - $this->Fields['typeid'], - $this->Fields['senddate'], - $this->Fields['title'], - $this->Fields['ismake'], - $this->Fields['arcrank'], - $this->TypeLink->TypeInfos['namerule'], - $this->TypeLink->TypeInfos['typedir'], - $this->Fields['money'], - $this->Fields['filename'], - $this->TypeLink->TypeInfos['moresite'], - $this->TypeLink->TypeInfos['siteurl'], - $this->TypeLink->TypeInfos['sitepath'] + return GetFileUrl( + $this->Fields['id'], + $this->Fields['typeid'], + $this->Fields['senddate'], + $this->Fields['title'], + $this->Fields['ismake'], + $this->Fields['arcrank'], + $this->TypeLink->TypeInfos['namerule'], + $this->TypeLink->TypeInfos['typedir'], + $this->Fields['money'], + $this->Fields['filename'], + $this->TypeLink->TypeInfos['moresite'], + $this->TypeLink->TypeInfos['siteurl'], + $this->TypeLink->TypeInfos['sitepath'] ); } @@ -500,28 +457,21 @@ class Archives function GetField($fname, $ctag) { //所有Field数组 OR 普通Field - if($fname=='array') - { + if ($fname == 'array') { return $this->Fields; } //指定了ID的节点 - else if($ctag->GetAtt('noteid') != '') - { - if( isset($this->Fields[$fname.'_'.$ctag->GetAtt('noteid')]) ) - { - return $this->Fields[$fname.'_'.$ctag->GetAtt('noteid')]; + else if ($ctag->GetAtt('noteid') != '') { + if (isset($this->Fields[$fname . '_' . $ctag->GetAtt('noteid')])) { + return $this->Fields[$fname . '_' . $ctag->GetAtt('noteid')]; } } //指定了type的节点 - else if($ctag->GetAtt('type') != '') - { - if( isset($this->Fields[$fname.'_'.$ctag->GetAtt('type')]) ) - { - return $this->Fields[$fname.'_'.$ctag->GetAtt('type')]; + else if ($ctag->GetAtt('type') != '') { + if (isset($this->Fields[$fname . '_' . $ctag->GetAtt('type')])) { + return $this->Fields[$fname . '_' . $ctag->GetAtt('type')]; } - } - else if( isset($this->Fields[$fname]) ) - { + } else if (isset($this->Fields[$fname])) { return $this->Fields[$fname]; } return ''; @@ -535,42 +485,32 @@ class Archives */ function GetTempletFile() { - global $cfg_basedir,$cfg_templets_dir,$cfg_df_style; + global $cfg_basedir, $cfg_templets_dir, $cfg_df_style; $cid = $this->ChannelUnit->ChannelInfos['nid']; - if(!empty($this->Fields['templet'])) - { + if (!empty($this->Fields['templet'])) { $filetag = MfTemplet($this->Fields['templet']); - if( !preg_match("#\/#", $filetag) ) $filetag = $GLOBALS['cfg_df_style'].'/'.$filetag; - } - else - { + if (!preg_match("#\/#", $filetag)) $filetag = $GLOBALS['cfg_df_style'] . '/' . $filetag; + } else { $filetag = MfTemplet($this->TypeLink->TypeInfos["temparticle"]); } $tid = $this->Fields['typeid']; - $filetag = str_replace('{cid}', $cid,$filetag); - $filetag = str_replace('{tid}', $tid,$filetag); - $tmpfile = $cfg_basedir.$cfg_templets_dir.'/'.$filetag; - if($cid=='spec') - { - if( !empty($this->Fields['templet']) ) - { - $tmpfile = $cfg_basedir.$cfg_templets_dir.'/'.$filetag; - } - else - { - $tmpfile = $cfg_basedir.$cfg_templets_dir."/{$cfg_df_style}/article_spec.htm"; + $filetag = str_replace('{cid}', $cid, $filetag); + $filetag = str_replace('{tid}', $tid, $filetag); + $tmpfile = $cfg_basedir . $cfg_templets_dir . '/' . $filetag; + if ($cid == 'spec') { + if (!empty($this->Fields['templet'])) { + $tmpfile = $cfg_basedir . $cfg_templets_dir . '/' . $filetag; + } else { + $tmpfile = $cfg_basedir . $cfg_templets_dir . "/{$cfg_df_style}/article_spec.htm"; } } - if ( defined('DEDEMOB') ) - { - $tmpfile =str_replace('.htm','_m.htm',$tmpfile); + if (defined('DEDEMOB')) { + $tmpfile = str_replace('.htm', '_m.htm', $tmpfile); } - if(!file_exists($tmpfile)) - { - $tmpfile = $cfg_basedir.$cfg_templets_dir."/{$cfg_df_style}/".($cid=='spec' ? 'article_spec.htm' : 'article_default.htm'); - if ( defined('DEDEMOB') ) - { - $tmpfile =str_replace('.htm','_m.htm',$tmpfile); + if (!file_exists($tmpfile)) { + $tmpfile = $cfg_basedir . $cfg_templets_dir . "/{$cfg_df_style}/" . ($cid == 'spec' ? 'article_spec.htm' : 'article_default.htm'); + if (defined('DEDEMOB')) { + $tmpfile = str_replace('.htm', '_m.htm', $tmpfile); } } if (!preg_match("#.htm$#", $tmpfile)) return FALSE; @@ -586,12 +526,11 @@ class Archives function display() { global $htmltype; - if($this->IsError) - { + if ($this->IsError) { return ''; } $this->Fields["displaytype"] = "dm"; - if($this->NowPage > 1) $this->Fields["title"] = $this->Fields["title"]."({$this->NowPage})"; + if ($this->NowPage > 1) $this->Fields["title"] = $this->Fields["title"] . "({$this->NowPage})"; //预编译 $this->LoadTemplet(); $this->ParAddTable(); @@ -599,24 +538,20 @@ class Archives $this->ParseTempletsFirst(); //跳转网址 - $this->Fields['flag']=empty($this->Fields['flag'])? "" : $this->Fields['flag']; - if(preg_match("#j#", $this->Fields['flag']) && $this->Fields['redirecturl'] != '') - { - if($GLOBALS['cfg_jump_once']=='N') - { - $pageHtml = "\r\n\r\n\r\n".$this->Fields['title']."\r\n"; - $pageHtml .= "Fields['redirecturl']."\">\r\n\r\n\r\n"; - $pageHtml .= "现在正在转向:".$this->Fields['title'].",请稍候...

    \r\n转向内容简介:".$this->Fields['description']."\r\n\r\n\r\n"; + $this->Fields['flag'] = empty($this->Fields['flag']) ? "" : $this->Fields['flag']; + if (preg_match("#j#", $this->Fields['flag']) && $this->Fields['redirecturl'] != '') { + if ($GLOBALS['cfg_jump_once'] == 'N') { + $pageHtml = "\r\n\r\n\r\n" . $this->Fields['title'] . "\r\n"; + $pageHtml .= "Fields['redirecturl'] . "\">\r\n\r\n\r\n"; + $pageHtml .= "现在正在转向:" . $this->Fields['title'] . ",请稍候...

    \r\n转向内容简介:" . $this->Fields['description'] . "\r\n\r\n\r\n"; echo $pageHtml; - } - else - { + } else { header("location:{$this->Fields['redirecturl']}"); } exit(); } $pageCount = $this->NowPage; - $this->ParseDMFields($pageCount,0); + $this->ParseDMFields($pageCount, 0); $this->dtp->display(); } @@ -628,20 +563,16 @@ class Archives */ function LoadTemplet() { - if($this->TempSource=='') - { + if ($this->TempSource == '') { $tempfile = $this->GetTempletFile(); - if(!file_exists($tempfile) || !is_file($tempfile)) - { + if (!file_exists($tempfile) || !is_file($tempfile)) { echo "文档ID:{$this->Fields['id']} - {$this->TypeLink->TypeInfos['typename']} - {$this->Fields['title']}
    "; echo "模板文件不存在,无法解析文档!"; exit(); } $this->dtp->LoadTemplate($tempfile); $this->TempSource = $this->dtp->SourceString; - } - else - { + } else { $this->dtp->LoadSource($this->TempSource); } } @@ -654,20 +585,17 @@ class Archives */ function ParseTempletsFirst() { - if(empty($this->Fields['keywords'])) - { + if (empty($this->Fields['keywords'])) { $this->Fields['keywords'] = ''; } - if(empty($this->Fields['reid'])) - { + if (empty($this->Fields['reid'])) { $this->Fields['reid'] = 0; } $GLOBALS['envs']['tags'] = $this->Fields['tags']; - if(isset($this->TypeLink->TypeInfos['reid'])) - { + if (isset($this->TypeLink->TypeInfos['reid'])) { $GLOBALS['envs']['reid'] = $this->TypeLink->TypeInfos['reid']; } @@ -679,12 +607,11 @@ class Archives $GLOBALS['envs']['aid'] = $GLOBALS['envs']['id'] = $this->Fields['id']; - $GLOBALS['envs']['adminid'] = $GLOBALS['envs']['mid'] = isset($this->Fields['mid'])? $this->Fields['mid'] : 1; + $GLOBALS['envs']['adminid'] = $GLOBALS['envs']['mid'] = isset($this->Fields['mid']) ? $this->Fields['mid'] : 1; $GLOBALS['envs']['channelid'] = $this->TypeLink->TypeInfos['channeltype']; - if($this->Fields['reid']>0) - { + if ($this->Fields['reid'] > 0) { $GLOBALS['envs']['typeid'] = $this->Fields['reid']; } @@ -699,94 +626,68 @@ class Archives * @param string $ismake 是否生成 * @return string */ - function ParseDMFields($pageNo, $ismake=1) + function ParseDMFields($pageNo, $ismake = 1) { $this->NowPage = $pageNo; $this->Fields['nowpage'] = $this->NowPage; - if($this->SplitPageField!='' && isset($this->Fields[$this->SplitPageField])) - { + if ($this->SplitPageField != '' && isset($this->Fields[$this->SplitPageField])) { $this->Fields[$this->SplitPageField] = $this->SplitFields[$pageNo - 1]; - if($pageNo>1) $this->Fields['description'] = trim(preg_replace("/[\r\n\t]/", ' ', cn_substr(html2text($this->Fields[$this->SplitPageField]), 200))); + if ($pageNo > 1) $this->Fields['description'] = trim(preg_replace("/[\r\n\t]/", ' ', cn_substr(html2text($this->Fields[$this->SplitPageField]), 200))); } //解析模板 - if(is_array($this->dtp->CTags)) - { - foreach($this->dtp->CTags as $i=>$ctag) - { - if($ctag->GetName()=='field') - { - $this->dtp->Assign($i, $this->GetField($ctag->GetAtt('name'), $ctag) ); - } - else if($ctag->GetName()=='pagebreak') - { - if($ismake==0) - { - $this->dtp->Assign($i,$this->GetPagebreakDM($this->TotalPage,$this->NowPage,$this->ArcID)); + if (is_array($this->dtp->CTags)) { + foreach ($this->dtp->CTags as $i => $ctag) { + if ($ctag->GetName() == 'field') { + $this->dtp->Assign($i, $this->GetField($ctag->GetAtt('name'), $ctag)); + } else if ($ctag->GetName() == 'pagebreak') { + if ($ismake == 0) { + $this->dtp->Assign($i, $this->GetPagebreakDM($this->TotalPage, $this->NowPage, $this->ArcID)); + } else { + $this->dtp->Assign($i, $this->GetPagebreak($this->TotalPage, $this->NowPage, $this->ArcID)); } - else - { - $this->dtp->Assign($i,$this->GetPagebreak($this->TotalPage,$this->NowPage,$this->ArcID)); + } else if ($ctag->GetName() == 'pagetitle') { + if ($ismake == 0) { + $this->dtp->Assign($i, $this->GetPageTitlesDM($ctag->GetAtt("style"), $pageNo)); + } else { + $this->dtp->Assign($i, $this->GetPageTitlesST($ctag->GetAtt("style"), $pageNo)); } - } - else if($ctag->GetName()=='pagetitle') - { - if($ismake==0) - { - $this->dtp->Assign($i,$this->GetPageTitlesDM($ctag->GetAtt("style"),$pageNo)); - } - else - { - $this->dtp->Assign($i,$this->GetPageTitlesST($ctag->GetAtt("style"),$pageNo)); - } - } - else if($ctag->GetName()=='prenext') - { - $this->dtp->Assign($i,$this->GetPreNext($ctag->GetAtt('get'))); - } - else if($ctag->GetName()=='fieldlist') - { + } else if ($ctag->GetName() == 'prenext') { + $this->dtp->Assign($i, $this->GetPreNext($ctag->GetAtt('get'))); + } else if ($ctag->GetName() == 'fieldlist') { $innertext = trim($ctag->GetInnerText()); - if($innertext=='') $innertext = GetSysTemplets('tag_fieldlist.htm'); + if ($innertext == '') $innertext = GetSysTemplets('tag_fieldlist.htm'); $dtp2 = new DedeTagParse(); - $dtp2->SetNameSpace('field','[',']'); + $dtp2->SetNameSpace('field', '[', ']'); $dtp2->LoadSource($innertext); $oldSource = $dtp2->SourceString; $oldCtags = $dtp2->CTags; $res = ''; - if(is_array($this->ChannelUnit->ChannelFields) && is_array($dtp2->CTags)) - { - foreach($this->ChannelUnit->ChannelFields as $k=>$v) - { - if(isset($v['autofield']) && empty($v['autofield'])) { + if (is_array($this->ChannelUnit->ChannelFields) && is_array($dtp2->CTags)) { + foreach ($this->ChannelUnit->ChannelFields as $k => $v) { + if (isset($v['autofield']) && empty($v['autofield'])) { continue; } $dtp2->SourceString = $oldSource; $dtp2->CTags = $oldCtags; $fname = $v['itemname']; - foreach($dtp2->CTags as $tid=>$ctag2) - { - if($ctag2->GetName()=='name') - { - $dtp2->Assign($tid,$fname); - } - else if($ctag2->GetName()=='tagname') - { - $dtp2->Assign($tid,$k); - } - else if($ctag2->GetName()=='value') - { - $this->Fields[$k] = $this->ChannelUnit->MakeField($k,$this->Fields[$k],$ctag2); - @$dtp2->Assign($tid,$this->Fields[$k]); + foreach ($dtp2->CTags as $tid => $ctag2) { + if ($ctag2->GetName() == 'name') { + $dtp2->Assign($tid, $fname); + } else if ($ctag2->GetName() == 'tagname') { + $dtp2->Assign($tid, $k); + } else if ($ctag2->GetName() == 'value') { + $this->Fields[$k] = $this->ChannelUnit->MakeField($k, $this->Fields[$k], $ctag2); + @$dtp2->Assign($tid, $this->Fields[$k]); } } $res .= $dtp2->GetResult(); } } - $this->dtp->Assign($i,$res); - }//end case + $this->dtp->Assign($i, $res); + } //end case - }//结束模板循环 + } //结束模板循环 } } @@ -811,11 +712,10 @@ class Archives * pre:上一篇 preimg:上一篇图片 next:下一篇 nextimg:下一篇图片 * @return string */ - function GetPreNext($gtype='') + function GetPreNext($gtype = '') { $rs = ''; - if(count($this->PreNext)<2) - { + if (count($this->PreNext) < 2) { $aid = $this->ArcID; $preR = $this->dsql->GetOne("Select id From `#@__arctiny` where id<$aid And arcrank>-1 And typeid='{$this->Fields['typeid']}' order by id desc"); $nextR = $this->dsql->GetOne("Select id From `#@__arctiny` where id>$aid And arcrank>-1 And typeid='{$this->Fields['typeid']}' order by id asc"); @@ -824,64 +724,75 @@ class Archives $query = "Select arc.id,arc.title,arc.shorttitle,arc.typeid,arc.ismake,arc.senddate,arc.arcrank,arc.money,arc.filename,arc.litpic, t.typedir,t.typename,t.namerule,t.namerule2,t.ispart,t.moresite,t.siteurl,t.sitepath from `#@__archives` arc left join #@__arctype t on arc.typeid=t.id "; - $nextRow = $this->dsql->GetOne($query.$next); - $preRow = $this->dsql->GetOne($query.$pre); - if(is_array($preRow)) - { - if ( defined('DEDEMOB') ) - { - $mlink = 'view.php?aid='.$preRow['id']; + $nextRow = $this->dsql->GetOne($query . $next); + $preRow = $this->dsql->GetOne($query . $pre); + if (is_array($preRow)) { + if (defined('DEDEMOB')) { + $mlink = 'view.php?aid=' . $preRow['id']; } else { - $mlink = GetFileUrl($preRow['id'],$preRow['typeid'],$preRow['senddate'],$preRow['title'],$preRow['ismake'],$preRow['arcrank'], - $preRow['namerule'],$preRow['typedir'],$preRow['money'],$preRow['filename'],$preRow['moresite'],$preRow['siteurl'],$preRow['sitepath']); + $mlink = GetFileUrl( + $preRow['id'], + $preRow['typeid'], + $preRow['senddate'], + $preRow['title'], + $preRow['ismake'], + $preRow['arcrank'], + $preRow['namerule'], + $preRow['typedir'], + $preRow['money'], + $preRow['filename'], + $preRow['moresite'], + $preRow['siteurl'], + $preRow['sitepath'] + ); } - + $this->PreNext['pre'] = "上一篇:{$preRow['title']} "; $this->PreNext['preimg'] = "\"{$preRow['title']}\"/ "; - } - else - { + } else { $this->PreNext['pre'] = "上一篇:没有了 "; - $this->PreNext['preimg'] ="\"对不起,没有上一图集了!\"/"; + $this->PreNext['preimg'] = "\"对不起,没有上一图集了!\"/"; } - if(is_array($nextRow)) - { - if ( defined('DEDEMOB') ) - { - $mlink = 'view.php?aid='.$preRow['id']; + if (is_array($nextRow)) { + if (defined('DEDEMOB')) { + $mlink = 'view.php?aid=' . $preRow['id']; } else { - $mlink = GetFileUrl($nextRow['id'],$nextRow['typeid'],$nextRow['senddate'],$nextRow['title'],$nextRow['ismake'],$nextRow['arcrank'], - $nextRow['namerule'],$nextRow['typedir'],$nextRow['money'],$nextRow['filename'],$nextRow['moresite'],$nextRow['siteurl'],$nextRow['sitepath']); + $mlink = GetFileUrl( + $nextRow['id'], + $nextRow['typeid'], + $nextRow['senddate'], + $nextRow['title'], + $nextRow['ismake'], + $nextRow['arcrank'], + $nextRow['namerule'], + $nextRow['typedir'], + $nextRow['money'], + $nextRow['filename'], + $nextRow['moresite'], + $nextRow['siteurl'], + $nextRow['sitepath'] + ); } - + $this->PreNext['next'] = "下一篇:{$nextRow['title']} "; $this->PreNext['nextimg'] = "\"{$nextRow['title']}\"/ "; - } - else - { + } else { $this->PreNext['next'] = "下一篇:没有了 "; - $this->PreNext['nextimg'] ="\"对不起,没有下一图集了!\"/"; + $this->PreNext['nextimg'] = "\"对不起,没有下一图集了!\"/"; } } - if($gtype=='pre') - { + if ($gtype == 'pre') { $rs = $this->PreNext['pre']; - } - else if($gtype=='preimg'){ + } else if ($gtype == 'preimg') { $rs = $this->PreNext['preimg']; - } - else if($gtype=='next') - { + } else if ($gtype == 'next') { $rs = $this->PreNext['next']; - } - else if($gtype=='nextimg'){ + } else if ($gtype == 'nextimg') { $rs = $this->PreNext['nextimg']; - } - else - { - $rs = $this->PreNext['pre']."   ".$this->PreNext['next']; + } else { + $rs = $this->PreNext['pre'] . "   " . $this->PreNext['next']; } return $rs; } @@ -898,84 +809,59 @@ class Archives function GetPagebreakDM($totalPage, $nowPage, $aid) { global $cfg_rewrite; - if($totalPage==1) - { + if ($totalPage == 1) { return ""; } - $PageList = "
  • 共".$totalPage."页:
  • "; - $nPage = $nowPage-1; - $lPage = $nowPage+1; - if($nowPage==1) - { - $PageList.="
  • 上一页
  • "; - } - else - { - if($nPage==1) - { - $PageList.="
  • 上一页
  • "; - if($cfg_rewrite == 'Y') - { + $PageList = "
  • 共" . $totalPage . "页:
  • "; + $nPage = $nowPage - 1; + $lPage = $nowPage + 1; + if ($nowPage == 1) { + $PageList .= "
  • 上一页
  • "; + } else { + if ($nPage == 1) { + $PageList .= "
  • 上一页
  • "; + if ($cfg_rewrite == 'Y') { $PageList = preg_replace("#.php\?aid=(\d+)#i", '-\\1-1.html', $PageList); } - } - else - { - $PageList.="
  • 上一页
  • "; - if($cfg_rewrite == 'Y') - { + } else { + $PageList .= "
  • 上一页
  • "; + if ($cfg_rewrite == 'Y') { $PageList = str_replace(".php?aid=", "-", $PageList); $PageList = preg_replace("#&pageno=(\d+)#i", '-\\1.html', $PageList); } } } - for($i=1;$i<=$totalPage;$i++) - { - if($i==1) - { - if($nowPage!=1) - { - $PageList.="
  • 1
  • "; - if($cfg_rewrite == 'Y') - { + for ($i = 1; $i <= $totalPage; $i++) { + if ($i == 1) { + if ($nowPage != 1) { + $PageList .= "
  • 1
  • "; + if ($cfg_rewrite == 'Y') { $PageList = preg_replace("#.php\?aid=(\d+)#i", '-\\1-1.html', $PageList); } + } else { + $PageList .= "
  • 1
  • "; } - else - { - $PageList.="
  • 1
  • "; - } - } - else - { + } else { $n = $i; - if($nowPage!=$i) - { - $PageList.="
  • ".$n."
  • "; - if($cfg_rewrite == 'Y') - { + if ($nowPage != $i) { + $PageList .= "
  • " . $n . "
  • "; + if ($cfg_rewrite == 'Y') { $PageList = str_replace(".php?aid=", "-", $PageList); $PageList = preg_replace("#&pageno=(\d+)#i", '-\\1.html', $PageList); } - } - else - { - $PageList.="
  • {$n}
  • "; + } else { + $PageList .= "
  • {$n}
  • "; } } } - if($lPage <= $totalPage) - { - $PageList.="
  • 下一页
  • "; - if($cfg_rewrite == 'Y') - { + if ($lPage <= $totalPage) { + $PageList .= "
  • 下一页
  • "; + if ($cfg_rewrite == 'Y') { $PageList = str_replace(".php?aid=", "-", $PageList); $PageList = preg_replace("#&pageno=(\d+)#i", '-\\1.html', $PageList); } - } - else - { - $PageList.= "
  • 下一页
  • "; + } else { + $PageList .= "
  • 下一页
  • "; } return $PageList; } @@ -991,61 +877,41 @@ class Archives */ function GetPagebreak($totalPage, $nowPage, $aid) { - if($totalPage==1) - { + if ($totalPage == 1) { return ""; } - $PageList = "
  • 共".$totalPage."页:
  • "; - $nPage = $nowPage-1; - $lPage = $nowPage+1; - if($nowPage==1) - { - $PageList.="
  • 上一页
  • "; - } - else - { - if($nPage==1) - { - $PageList.="
  • 上一页
  • "; - } - else - { - $PageList.="
  • 上一页
  • "; + $PageList = "
  • 共" . $totalPage . "页:
  • "; + $nPage = $nowPage - 1; + $lPage = $nowPage + 1; + if ($nowPage == 1) { + $PageList .= "
  • 上一页
  • "; + } else { + if ($nPage == 1) { + $PageList .= "
  • 上一页
  • "; + } else { + $PageList .= "
  • 上一页
  • "; } } - for($i=1;$i<=$totalPage;$i++) - { - if($i==1) - { - if($nowPage!=1) - { - $PageList.="
  • 1
  • "; - } - else - { - $PageList.="
  • 1
  • "; + for ($i = 1; $i <= $totalPage; $i++) { + if ($i == 1) { + if ($nowPage != 1) { + $PageList .= "
  • 1
  • "; + } else { + $PageList .= "
  • 1
  • "; } - } - else - { + } else { $n = $i; - if($nowPage!=$i) - { - $PageList.="
  • ".$n."
  • "; - } - else - { - $PageList.="
  • {$n}
  • "; + if ($nowPage != $i) { + $PageList .= "
  • " . $n . "
  • "; + } else { + $PageList .= "
  • {$n}
  • "; } } } - if($lPage <= $totalPage) - { - $PageList.="
  • 下一页
  • "; - } - else - { - $PageList.= "
  • 下一页
  • "; + if ($lPage <= $totalPage) { + $PageList .= "
  • 下一页
  • "; + } else { + $PageList .= "
  • 下一页
  • "; } return $PageList; } @@ -1060,57 +926,38 @@ class Archives */ function GetPageTitlesDM($styleName, $pageNo) { - if($this->TotalPage==1) - { + if ($this->TotalPage == 1) { return ""; } - if(count($this->SplitTitles)==0) - { + if (count($this->SplitTitles) == 0) { return ""; } - $i=1; + $i = 1; $aid = $this->ArcID; - if($styleName=='link') - { + if ($styleName == 'link') { $revalue = ""; - foreach($this->SplitTitles as $k=>$v) - { - if($i==1) - { + foreach ($this->SplitTitles as $k => $v) { + if ($i == 1) { $revalue .= "$v \r\n"; - } - else - { - if($pageNo==$i) - { + } else { + if ($pageNo == $i) { $revalue .= " $v \r\n"; - } - else - { + } else { $revalue .= "$v \r\n"; } } $i++; } - } - else - { + } else { $revalue = "\r\n"; - foreach($this->SplitTitles as $k=>$v) - { - if($i==1) - { - $revalue .= "\r\n"; - } - else - { - if($pageNo==$i) - { - $revalue .= "\r\n"; - } - else - { - $revalue .= "\r\n"; + foreach ($this->SplitTitles as $k => $v) { + if ($i == 1) { + $revalue .= "\r\n"; + } else { + if ($pageNo == $i) { + $revalue .= "\r\n"; + } else { + $revalue .= "\r\n"; } } $i++; @@ -1196,12 +1024,12 @@ class Archives * @param string $body * @return string */ - function ReplaceKeyword($kw,&$body) + function ReplaceKeyword($kw, &$body) { global $cfg_cmspath; $maxkey = 5; - $kws = explode(",",trim($kw)); //以分好为间隔符 - $i=0; + $kws = explode(",", trim($kw)); //以分好为间隔符 + $i = 0; $karr = $kaarr = $GLOBALS['replaced'] = array(); //暂时屏蔽超链接 @@ -1231,17 +1059,15 @@ class Archives $query = "SELECT * FROM #@__keywords WHERE rpurl<>'' ORDER BY rank DESC"; $this->dsql->SetQuery($query); $this->dsql->Execute(); - while($row = $this->dsql->GetArray()) - { + while ($row = $this->dsql->GetArray()) { $key = trim($row['keyword']); - $key_url=trim($row['rpurl']); + $key_url = trim($row['rpurl']); $karr[] = $key; $kaarr[] = "$key"; } // 这里可能会有错误 - if (version_compare(PHP_VERSION, '5.5.0', '>=')) - { + if (version_compare(PHP_VERSION, '5.5.0', '>=')) { $body = @preg_replace_callback("#(^|>)([^<]+)(?=<|$)#sU", "_highlight('\\2', \$karr, \$kaarr, '\\1')", $body); } else { $body = @preg_replace("#(^|>)([^<]+)(?=<|$)#sUe", "_highlight('\\2', \$karr, \$kaarr, '\\1')", $body); @@ -1251,38 +1077,29 @@ class Archives $body = preg_replace("#()#isU", '\\1>\\3<\\4', $body); return $body; } - - -}//End Archives +} //End Archives //高亮专用, 替换多次是可能不能达到最多次 function _highlight($string, $words, $result, $pre) { global $cfg_replace_num; - if (version_compare(PHP_VERSION, '5.5.0', '>=')) - { + if (version_compare(PHP_VERSION, '5.5.0', '>=')) { $string = $string[0]; $pre = $pre[0]; } $string = str_replace('\"', '"', $string); - if($cfg_replace_num > 0) - { - foreach ($words as $key => $word) - { - if($GLOBALS['replaced'][$word] == 1) - { + if ($cfg_replace_num > 0) { + foreach ($words as $key => $word) { + if ($GLOBALS['replaced'][$word] == 1) { continue; } - $string = preg_replace("#".preg_quote($word)."#", $result[$key], $string, $cfg_replace_num); - if(strpos($string, $word) !== FALSE) - { + $string = preg_replace("#" . preg_quote($word) . "#", $result[$key], $string, $cfg_replace_num); + if (strpos($string, $word) !== FALSE) { $GLOBALS['replaced'][$word] = 1; } } - } - else - { + } else { $string = str_replace($words, $result, $string); } - return $pre.$string; + return $pre . $string; } diff --git a/src/include/arc.caicai.class.php b/src/include/arc.caicai.class.php index fc7d073e..837e5657 100755 --- a/src/include/arc.caicai.class.php +++ b/src/include/arc.caicai.class.php @@ -1,22 +1,22 @@ -pageNO = $pageno; $this->totalResult = $totalresult; - if(isset($this->tpl->tpCfgs['pagesize'])){ + if (isset($this->tpl->tpCfgs['pagesize'])) { $this->pageSize = $this->tpl->tpCfgs['pagesize']; } - $this->totalPage = ceil($this->totalResult/$this->pageSize); - if($this->totalPage > $this->maxPageSize) - { + $this->totalPage = ceil($this->totalResult / $this->pageSize); + if ($this->totalPage > $this->maxPageSize) { $this->totalPage = $this->maxPageSize; } //限制最大页数 - if($this->pageNO > $this->totalPage) - { + if ($this->pageNO > $this->totalPage) { $this->pageNO = $this->totalPage; $this->totalResult = $this->totalPage * $this->pageSize; } $this->sourceSql = preg_replace("#LIMIT [0-9,]{1,}#i", '', $this->sourceSql); - if( $this->totalResult==0 ) - { + if ($this->totalResult == 0) { //$this->isQuery = true; //$this->dsql->Execute('dlist',$this->sourceSql); //$this->totalResult = $this->dsql->GetTotalRow('dlist'); - $countQuery = preg_replace("#SELECT[ \r\n\t](.*)[ \r\n\t]FROM#is","SELECT COUNT(*) as dd FROM", $this->sourceSql); + $countQuery = preg_replace("#SELECT[ \r\n\t](.*)[ \r\n\t]FROM#is", "SELECT COUNT(*) as dd FROM", $this->sourceSql); $row = $this->dsql->GetOne($countQuery); $this->totalResult = $row['dd']; - $this->sourceSql .= " LIMIT 0,".$this->pageSize; - } - else - { - $this->sourceSql .= " LIMIT ".(($this->pageNO-1) * $this->pageSize).",".$this->pageSize; + $this->sourceSql .= " LIMIT 0," . $this->pageSize; + } else { + $this->sourceSql .= " LIMIT " . (($this->pageNO - 1) * $this->pageSize) . "," . $this->pageSize; } } @@ -78,55 +73,66 @@ class Caicai extends DataListCP * @param array $fields * @return array */ - function GetArcList($atts, $refObj='', $fields=array()) + function GetArcList($atts, $refObj = '', $fields = array()) { $rsArray = array(); $t1 = Exectime(); - if(!$this->isQuery) - { + if (!$this->isQuery) { $this->dsql->Execute('dlist', $this->sourceSql); } $i = 0; - while($arr=$this->dsql->GetArray('dlist')) - { + while ($arr = $this->dsql->GetArray('dlist')) { $i++; - $arr['filename'] = $arr['arcurl'] = GetFileUrl($arr['id'],$arr['typeid'],$arr['senddate'],$arr['title'],$arr['ismake'], - $arr['arcrank'],$arr['namerule'],$arr['typedir'],$arr['money'],$arr['filename'],$arr['moresite'],$arr['siteurl'],$arr['sitepath']); - $arr['typeurl'] = GetTypeUrl($arr['typeid'],MfTypedir($arr['typedir']),$arr['isdefault'],$arr['defaultname'], - $arr['ispart'],$arr['namerule2'],$arr['moresite'],$arr['siteurl'],$arr['sitepath']); - if($arr['litpic'] == '-' || $arr['litpic'] == '') - { + $arr['filename'] = $arr['arcurl'] = GetFileUrl( + $arr['id'], + $arr['typeid'], + $arr['senddate'], + $arr['title'], + $arr['ismake'], + $arr['arcrank'], + $arr['namerule'], + $arr['typedir'], + $arr['money'], + $arr['filename'], + $arr['moresite'], + $arr['siteurl'], + $arr['sitepath'] + ); + $arr['typeurl'] = GetTypeUrl( + $arr['typeid'], + MfTypedir($arr['typedir']), + $arr['isdefault'], + $arr['defaultname'], + $arr['ispart'], + $arr['namerule2'], + $arr['moresite'], + $arr['siteurl'], + $arr['sitepath'] + ); + if ($arr['litpic'] == '-' || $arr['litpic'] == '') { $arr['litpic'] = 'templets/images/dfpic.gif'; } - if(!preg_match("#^http:\/\/#i", $arr['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') - { - $arr['litpic'] = $GLOBALS['cfg_mainsite'].$arr['litpic']; + if (!preg_match("#^http:\/\/#i", $arr['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { + $arr['litpic'] = $GLOBALS['cfg_mainsite'] . $arr['litpic']; } $arr['picname'] = $arr['litpic']; - $arr['alttitle'] = $arr['userid']." 的空间"; - $arr['face'] = ($arr['face']!='' ? $arr['face'] : 'images/nopic.gif'); - if($arr['userid']!='') - { - $arr['spaceurl'] = $GLOBALS['cfg_basehost'].'/member/index.php?uid='.$arr['userid']; - } - else - { + $arr['alttitle'] = $arr['userid'] . " 的空间"; + $arr['face'] = ($arr['face'] != '' ? $arr['face'] : 'images/nopic.gif'); + if ($arr['userid'] != '') { + $arr['spaceurl'] = $GLOBALS['cfg_basehost'] . '/member/index.php?uid=' . $arr['userid']; + } else { $arr['alttitle'] = $arr['title']; $arr['spaceurl'] = $arr['arcurl']; $arr['face'] = $arr['litpic']; - $arr['face'] = str_replace('defaultpic','dfcaicai',$arr['face']); + $arr['face'] = str_replace('defaultpic', 'dfcaicai', $arr['face']); } - if(!empty($arr['lastpost'])) - { - $arr['lastpost'] = MyDate('m-d h:i',$arr['lastpost']); - } - else - { + if (!empty($arr['lastpost'])) { + $arr['lastpost'] = MyDate('m-d h:i', $arr['lastpost']); + } else { $arr['lastpost'] = "说几句>>"; } $rsArray[$i] = $arr; - if($i >= $this->pageSize) - { + if ($i >= $this->pageSize) { break; } } @@ -143,12 +149,12 @@ class Caicai extends DataListCP * @param array $fields * @return array */ - function GetSortArc($atts, $refObj='', $fields=array()) + function GetSortArc($atts, $refObj = '', $fields = array()) { $arcrow = (empty($atts['row']) ? 12 : $atts['row']); - $order = (empty($atts['order']) ? 'scores' : $atts['order'] ); - $orderway = (empty($atts['orderway']) ? 'desc' : $atts['orderway'] ); - if(empty($arcrow)) $arcrow = 12; + $order = (empty($atts['order']) ? 'scores' : $atts['order']); + $orderway = (empty($atts['orderway']) ? 'desc' : $atts['orderway']); + if (empty($arcrow)) $arcrow = 12; $query = "SELECT arc.*,tp.typedir,tp.typename, tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath @@ -156,67 +162,79 @@ class Caicai extends DataListCP WHERE arc.arcrank>-1 ORDER BY arc.{$order} $orderway LIMIT 0,$arcrow "; $rsArray = array(); - - $cacheFile = DEDEDATA.'/cache/caicai_'.md5($query).'.inc'; + + $cacheFile = DEDEDATA . '/cache/caicai_' . md5($query) . '.inc'; $needCache = false; - if(file_exists($cacheFile) && filemtime($cacheFile)-time() < $this->arcCacheTime) - { + if (file_exists($cacheFile) && filemtime($cacheFile) - time() < $this->arcCacheTime) { $fp = fopen($cacheFile, 'r'); $ids = fread($fp, filesize($cacheFile)); fclose($fp); $ids = trim($ids); - if( !empty($ids) ) - { + if (!empty($ids)) { $query = "SELECT arc.*,tp.typedir,tp.typename, tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON tp.id=arc.typeid WHERE arc.id in($ids) ORDER BY arc.{$order} $orderway "; } - } - else - { + } else { $needCache = true; } $ids = array(); $i = 0; - $this->dsql->Execute('cai',$query); - while($arr=$this->dsql->GetArray('cai')) - { + $this->dsql->Execute('cai', $query); + while ($arr = $this->dsql->GetArray('cai')) { $i++; $ids[] = $arr['id']; - $arr['filename'] = $arr['arcurl'] = GetFileUrl($arr['id'],$arr['typeid'],$arr['senddate'],$arr['title'],$arr['ismake'], - $arr['arcrank'],$arr['namerule'],$arr['typedir'],$arr['money'],$arr['filename'],$arr['moresite'],$arr['siteurl'],$arr['sitepath']); + $arr['filename'] = $arr['arcurl'] = GetFileUrl( + $arr['id'], + $arr['typeid'], + $arr['senddate'], + $arr['title'], + $arr['ismake'], + $arr['arcrank'], + $arr['namerule'], + $arr['typedir'], + $arr['money'], + $arr['filename'], + $arr['moresite'], + $arr['siteurl'], + $arr['sitepath'] + ); - $arr['typeurl'] = GetTypeUrl($arr['typeid'], MfTypedir($arr['typedir']), $arr['isdefault'], $arr['defaultname'], - $arr['ispart'], $arr['namerule2'], $arr['moresite'], $arr['siteurl'], $arr['sitepath']); + $arr['typeurl'] = GetTypeUrl( + $arr['typeid'], + MfTypedir($arr['typedir']), + $arr['isdefault'], + $arr['defaultname'], + $arr['ispart'], + $arr['namerule2'], + $arr['moresite'], + $arr['siteurl'], + $arr['sitepath'] + ); - if($arr['litpic']=='') $arr['litpic'] = '/static/defaultpic.gif'; + if ($arr['litpic'] == '') $arr['litpic'] = '/static/defaultpic.gif'; - if(!preg_match("#^http:\/\/#", $arr['litpic'])) - { - $arr['picname'] = $arr['litpic'] = $GLOBALS['cfg_cmsurl'].$arr['litpic']; - } - else - { + if (!preg_match("#^http:\/\/#", $arr['litpic'])) { + $arr['picname'] = $arr['litpic'] = $GLOBALS['cfg_cmsurl'] . $arr['litpic']; + } else { $arr['picname'] = $arr['litpic'] = $arr['litpic']; } $rsArray[$i] = $arr; } $this->dsql->FreeResult('cai'); - + //写入缓存 - if($needCache && count($ids) > 0) - { + if ($needCache && count($ids) > 0) { $idsstr = join(',', $ids); file_put_contents($cacheFile, $idsstr); // $fp = fopen($cacheFile, 'w'); // fwrite($fp, $idsstr); // fclose($fp); } - - return $rsArray; + return $rsArray; } /** @@ -227,15 +245,14 @@ class Caicai extends DataListCP * @param array $fields * @return array */ - function GetCatalog($atts,$refObj='',$fields=array()) + function GetCatalog($atts, $refObj = '', $fields = array()) { $maxrow = (empty($atts['row']) ? 12 : $atts['row']); $query = "SELECT id,typename FROM `#@__arctype` WHERE reid=0 AND ispart<2 AND channeltype>0 ORDER BY sortrank ASC LIMIT 0,$maxrow "; $rsArray = array(); - $this->dsql->Execute('co',$query); + $this->dsql->Execute('co', $query); $i = 0; - while($arr=$this->dsql->GetArray('co')) - { + while ($arr = $this->dsql->GetArray('co')) { $i++; $rsArray[$i] = $arr; } diff --git a/src/include/arc.freelist.class.php b/src/include/arc.freelist.class.php index ec3a638f..850f8b8c 100755 --- a/src/include/arc.freelist.class.php +++ b/src/include/arc.freelist.class.php @@ -1,22 +1,22 @@ -SetNameSpace("dede","{","}"); + $ndtp->SetNameSpace("dede", "{", "}"); $ndtp->LoadString($liststr); $this->ListObj = $ndtp->GetTag('list'); $this->PageSize = $this->ListObj->GetAtt('pagesize'); - if(empty($this->PageSize)) - { + if (empty($this->PageSize)) { $this->PageSize = 30; } $channelid = $this->ListObj->GetAtt('channel'); - + /* if(empty($channelid)) { @@ -76,10 +75,10 @@ class FreeList */ $channelid = intval($channelid); $this->maintable = '#@__archives'; - + //全局模板解析器 $this->dtp = new DedeTagParse(); - $this->dtp->SetNameSpace("dede","{","}"); + $this->dtp->SetNameSpace("dede", "{", "}"); $this->dtp->SetRefObj($this); //设置一些全局参数的值 @@ -89,17 +88,13 @@ class FreeList $this->Fields['keywords'] = $this->FLInfos['keywords']; $this->Fields['description'] = $this->FLInfos['description']; $channelid = $this->ListObj->GetAtt('channel'); - if(!empty($channelid)) - { + if (!empty($channelid)) { $this->Fields['channeltype'] = $channelid; $this->ChannelUnit = new ChannelUnit($channelid); - } - else - { + } else { $this->Fields['channeltype'] = 0; } - foreach($GLOBALS['PubFields'] as $k=>$v) - { + foreach ($GLOBALS['PubFields'] as $k => $v) { $this->Fields[$k] = $v; } $this->PartView = new PartView(); @@ -125,99 +120,79 @@ class FreeList */ function CountRecord() { - global $cfg_list_son,$cfg_needsontype; + global $cfg_list_son, $cfg_needsontype; //统计数据库记录 $this->TotalResult = -1; - if(isset($GLOBALS['TotalResult'])) - { + if (isset($GLOBALS['TotalResult'])) { $this->TotalResult = $GLOBALS['TotalResult']; } - if(isset($GLOBALS['PageNo'])) - { + if (isset($GLOBALS['PageNo'])) { $this->PageNo = $GLOBALS['PageNo']; - } - else - { + } else { $this->PageNo = 1; } //已经有总记录的值 - if($this->TotalResult==-1) - { + if ($this->TotalResult == -1) { $addSql = " arcrank > -1 AND channel>-1 "; $typeid = $this->ListObj->GetAtt('typeid'); $subday = $this->ListObj->GetAtt('subday'); $listtype = $this->ListObj->GetAtt('type'); $att = $this->ListObj->GetAtt('att'); $channelid = $this->ListObj->GetAtt('channel'); - if(empty($channelid)) - { + if (empty($channelid)) { $channelid = 0; } //是否指定栏目条件 - if(!empty($typeid)) - { - if($cfg_list_son=='N') - { + if (!empty($typeid)) { + if ($cfg_list_son == 'N') { $addSql .= " AND (typeid='$typeid') "; - } - else - { - $addSql .= " AND typeid in (".GetSonIds($typeid,0,TRUE).") "; + } else { + $addSql .= " AND typeid in (" . GetSonIds($typeid, 0, TRUE) . ") "; } } //自定义属性条件 - if($att!='') { - $flags = explode(',',$att); - for($i=0;isset($flags[$i]);$i++) $addSql .= " AND FIND_IN_SET('{$flags[$i]}',flag)>0 "; + if ($att != '') { + $flags = explode(',', $att); + for ($i = 0; isset($flags[$i]); $i++) $addSql .= " AND FIND_IN_SET('{$flags[$i]}',flag)>0 "; } //文档的频道模型 - if($channelid>0 && !preg_match("#spec#i", $listtype)) - { + if ($channelid > 0 && !preg_match("#spec#i", $listtype)) { $addSql .= " AND channel = '$channelid' "; } //推荐文档 带缩略图 专题文档 - if(preg_match("#commend#i",$listtype)) - { + if (preg_match("#commend#i", $listtype)) { $addSql .= " AND FIND_IN_SET('c',flag) > 0 "; } - if(preg_match("#image#i",$listtype)) - { + if (preg_match("#image#i", $listtype)) { $addSql .= " AND litpic <> '' "; } - if(preg_match("#spec#i",$listtype) || $channelid==-1) - { + if (preg_match("#spec#i", $listtype) || $channelid == -1) { $addSql .= " AND channel = -1 "; } - if(!empty($subday)) - { + if (!empty($subday)) { $starttime = time() - $subday * 86400; $addSql .= " AND senddate > $starttime "; } $keyword = $this->ListObj->GetAtt('keyword'); - if(!empty($keyword)) - { + if (!empty($keyword)) { $addSql .= " AND CONCAT(title,keywords) REGEXP '$keyword' "; } $cquery = "SELECT COUNT(*) AS dd FROM `{$this->maintable}` WHERE $addSql"; $row = $this->dsql->GetOne($cquery); - if(is_array($row)) - { + if (is_array($row)) { $this->TotalResult = $row['dd']; - } - else - { + } else { $this->TotalResult = 0; } } - $this->TotalPage = ceil($this->TotalResult/$this->PageSize); - if($this->TotalPage > $this->FLInfos['maxpage']) - { + $this->TotalPage = ceil($this->TotalResult / $this->PageSize); + if ($this->TotalPage > $this->FLInfos['maxpage']) { $this->TotalPage = $this->FLInfos['maxpage']; $this->TotalResult = $this->TotalPage * $this->PageSize; } @@ -231,15 +206,14 @@ class FreeList */ function LoadTemplet() { - $tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']; - $tempfile = str_replace("{style}",$GLOBALS['cfg_df_style'],$this->FLInfos['templet']); - $tempfile = $tmpdir."/".$tempfile; - if(!file_exists($tempfile)) - { - $tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/list_free.htm"; + $tmpdir = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_templets_dir']; + $tempfile = str_replace("{style}", $GLOBALS['cfg_df_style'], $this->FLInfos['templet']); + $tempfile = $tmpdir . "/" . $tempfile; + if (!file_exists($tempfile)) { + $tempfile = $tmpdir . "/" . $GLOBALS['cfg_df_style'] . "/list_free.htm"; } $this->dtp->LoadTemplate($tempfile); - $this->TempletsFile = preg_replace("#^".$GLOBALS['cfg_basedir']."#", '', $tempfile); + $this->TempletsFile = preg_replace("#^" . $GLOBALS['cfg_basedir'] . "#", '', $tempfile); } /** @@ -250,64 +224,54 @@ class FreeList * @param string $makepagesize 生成的页码数 * @return string */ - function MakeHtml($startpage=1, $makepagesize=0) + function MakeHtml($startpage = 1, $makepagesize = 0) { $this->LoadTemplet(); $murl = ""; - if(empty($startpage)) - { + if (empty($startpage)) { $startpage = 1; } $this->ParseTempletsFirst(); - $totalpage = ceil($this->TotalResult/$this->PageSize); - if($totalpage==0) - { + $totalpage = ceil($this->TotalResult / $this->PageSize); + if ($totalpage == 0) { $totalpage = 1; } - if($makepagesize>0) - { - $endpage = $startpage+$makepagesize; - } - else - { - $endpage = ($totalpage+1); + if ($makepagesize > 0) { + $endpage = $startpage + $makepagesize; + } else { + $endpage = ($totalpage + 1); } - if($endpage>($totalpage+1)) - { + if ($endpage > ($totalpage + 1)) { $endpage = $totalpage; } $firstFile = ''; - for($this->PageNo=$startpage;$this->PageNo<$endpage;$this->PageNo++) - { - $this->ParseDMFields($this->PageNo,1); + for ($this->PageNo = $startpage; $this->PageNo < $endpage; $this->PageNo++) { + $this->ParseDMFields($this->PageNo, 1); //文件名 $makeFile = $this->GetMakeFileRule(); - if(!preg_match("#^\/#", $makeFile)) - { - $makeFile = "/".$makeFile; + if (!preg_match("#^\/#", $makeFile)) { + $makeFile = "/" . $makeFile; } - $makeFile = str_replace('{page}',$this->PageNo,$makeFile); + $makeFile = str_replace('{page}', $this->PageNo, $makeFile); $murl = $makeFile; - $makeFile = $GLOBALS['cfg_basedir'].$makeFile; + $makeFile = $GLOBALS['cfg_basedir'] . $makeFile; $makeFile = preg_replace("#\/{1,}#", "/", $makeFile); - if($this->PageNo==1) - { + if ($this->PageNo == 1) { $firstFile = $makeFile; } //保存文件 $this->dtp->SaveTo($makeFile); - echo "
    "; + echo "
    "; } - if($this->FLInfos['nodefault']==0) - { - $murl = '/'.str_replace('{cmspath}',$GLOBALS['cfg_cmspath'],$this->FLInfos['listdir']); - $murl .= '/'.$this->FLInfos['defaultpage']; - $indexfile = $GLOBALS['cfg_basedir'].$murl; + if ($this->FLInfos['nodefault'] == 0) { + $murl = '/' . str_replace('{cmspath}', $GLOBALS['cfg_cmspath'], $this->FLInfos['listdir']); + $murl .= '/' . $this->FLInfos['defaultpage']; + $indexfile = $GLOBALS['cfg_basedir'] . $murl; $murl = preg_replace("#\/{1,}#", "/", $murl); - echo "
    复制:$firstFile 为 ".$this->FLInfos['defaultpage']."

    "; - copy($firstFile,$indexfile); + echo "
    复制:$firstFile 为 " . $this->FLInfos['defaultpage'] . "

    "; + copy($firstFile, $indexfile); } $this->Close(); return $murl; @@ -323,7 +287,7 @@ class FreeList { $this->LoadTemplet(); $this->ParseTempletsFirst(); - $this->ParseDMFields($this->PageNo,0); + $this->ParseDMFields($this->PageNo, 0); $this->dtp->Display(); } @@ -336,45 +300,34 @@ class FreeList function DisplayPartTemplets() { $nmfa = 0; - $tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']; - if($this->Fields['ispart']==1) - { - $tempfile = str_replace("{tid}",$this->FreeID,$this->Fields['tempindex']); - $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile); - $tempfile = $tmpdir."/".$tempfile; - if(!file_exists($tempfile)) - { - $tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_default.htm"; + $tmpdir = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_templets_dir']; + if ($this->Fields['ispart'] == 1) { + $tempfile = str_replace("{tid}", $this->FreeID, $this->Fields['tempindex']); + $tempfile = str_replace("{cid}", $this->ChannelUnit->ChannelInfos['nid'], $tempfile); + $tempfile = $tmpdir . "/" . $tempfile; + if (!file_exists($tempfile)) { + $tempfile = $tmpdir . "/" . $GLOBALS['cfg_df_style'] . "/index_default.htm"; } $this->PartView->SetTemplet($tempfile); - } - else if($this->Fields['ispart']==2) - { - $tempfile = str_replace("{tid}",$this->FreeID,$this->Fields['tempone']); - $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile); - if(is_file($tmpdir."/".$tempfile)) - { - $this->PartView->SetTemplet($tmpdir."/".$tempfile); - } - else - { - $this->PartView->SetTemplet("这是没有使用模板的单独页!","string"); $nmfa = 1; + } else if ($this->Fields['ispart'] == 2) { + $tempfile = str_replace("{tid}", $this->FreeID, $this->Fields['tempone']); + $tempfile = str_replace("{cid}", $this->ChannelUnit->ChannelInfos['nid'], $tempfile); + if (is_file($tmpdir . "/" . $tempfile)) { + $this->PartView->SetTemplet($tmpdir . "/" . $tempfile); + } else { + $this->PartView->SetTemplet("这是没有使用模板的单独页!", "string"); + $nmfa = 1; } } CreateDir($this->Fields['typedir']); - $makeUrl = $this->GetMakeFileRule($this->Fields['id'],"index",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']); - $makeFile = $this->GetTruePath().$makeUrl; - if($nmfa==0) - { + $makeUrl = $this->GetMakeFileRule($this->Fields['id'], "index", $this->Fields['typedir'], $this->Fields['defaultname'], $this->Fields['namerule2']); + $makeFile = $this->GetTruePath() . $makeUrl; + if ($nmfa == 0) { $this->PartView->Display(); - } - else{ - if(!file_exists($makeFile)) - { + } else { + if (!file_exists($makeFile)) { $this->PartView->Display(); - } - else - { + } else { include($makeFile); } } @@ -388,7 +341,7 @@ class FreeList */ function ParseTempletsFirst() { - MakeOneTag($this->dtp,$this); + MakeOneTag($this->dtp, $this); } /** @@ -399,36 +352,26 @@ class FreeList * @param string $ismake 是否编译 * @return string */ - function ParseDMFields($PageNo,$ismake=1) + function ParseDMFields($PageNo, $ismake = 1) { - foreach($this->dtp->CTags as $tagid=>$ctag) - { - if($ctag->GetName()=="freelist") - { - $limitstart = ($this->PageNo-1) * $this->PageSize; - if($this->PageNo > $this->FLInfos['maxpage']) $this->dtp->Assign($tagid, '已经超过了最大允许列出的页面!'); - else $this->dtp->Assign($tagid,$this->GetList($limitstart,$ismake)); - } - else if($ctag->GetName()=="pagelist") - { + foreach ($this->dtp->CTags as $tagid => $ctag) { + if ($ctag->GetName() == "freelist") { + $limitstart = ($this->PageNo - 1) * $this->PageSize; + if ($this->PageNo > $this->FLInfos['maxpage']) $this->dtp->Assign($tagid, '已经超过了最大允许列出的页面!'); + else $this->dtp->Assign($tagid, $this->GetList($limitstart, $ismake)); + } else if ($ctag->GetName() == "pagelist") { $list_len = trim($ctag->GetAtt("listsize")); - $ctag->GetAtt("listitem")=="" ? $listitem="info,index,pre,pageno,next,end,option" : $listitem=$ctag->GetAtt("listitem"); - if($list_len=="") - { + $ctag->GetAtt("listitem") == "" ? $listitem = "info,index,pre,pageno,next,end,option" : $listitem = $ctag->GetAtt("listitem"); + if ($list_len == "") { $list_len = 3; } - if($ismake==0) - { - $this->dtp->Assign($tagid,$this->GetPageListDM($list_len,$listitem)); + if ($ismake == 0) { + $this->dtp->Assign($tagid, $this->GetPageListDM($list_len, $listitem)); + } else { + $this->dtp->Assign($tagid, $this->GetPageListST($list_len, $listitem)); } - else - { - $this->dtp->Assign($tagid,$this->GetPageListST($list_len,$listitem)); - } - } - else if($ctag->GetName()=="pageno") - { - $this->dtp->Assign($tagid,$PageNo); + } else if ($ctag->GetName() == "pageno") { + $this->dtp->Assign($tagid, $PageNo); } } } @@ -444,18 +387,15 @@ class FreeList $okfile = ''; $namerule = $this->FLInfos['namerule']; $listdir = $this->FLInfos['listdir']; - $listdir = str_replace('{cmspath}',$GLOBALS['cfg_cmspath'],$listdir); - $okfile = str_replace('{listid}',$this->FLInfos['aid'],$namerule); - $okfile = str_replace('{listdir}',$listdir,$okfile); - $okfile = str_replace("\\","/",$okfile); + $listdir = str_replace('{cmspath}', $GLOBALS['cfg_cmspath'], $listdir); + $okfile = str_replace('{listid}', $this->FLInfos['aid'], $namerule); + $okfile = str_replace('{listdir}', $listdir, $okfile); + $okfile = str_replace("\\", "/", $okfile); $mdir = preg_replace("#/([^/]*)$#", "", $okfile); - if(!preg_match("#\/#", $mdir) && preg_match("#\.#", $mdir)) - { + if (!preg_match("#\/#", $mdir) && preg_match("#\.#", $mdir)) { return $okfile; - } - else - { - CreateDir($mdir,'',''); + } else { + CreateDir($mdir, '', ''); return $okfile; } } @@ -468,30 +408,29 @@ class FreeList * @param string $ismake 是否编译 * @return string */ - function GetList($limitstart, $ismake=1) + function GetList($limitstart, $ismake = 1) { - global $cfg_list_son,$cfg_needsontype; + global $cfg_list_son, $cfg_needsontype; $col = $this->ListObj->GetAtt('col'); - if(empty($col)) - { + if (empty($col)) { $col = 1; } $titlelen = $this->ListObj->GetAtt('titlelen'); $infolen = $this->ListObj->GetAtt('infolen'); $imgwidth = $this->ListObj->GetAtt('imgwidth'); $imgheight = $this->ListObj->GetAtt('imgheight'); - $titlelen = AttDef($titlelen,60); - $infolen = AttDef($infolen,250); - $imgwidth = AttDef($imgwidth,80); - $imgheight = AttDef($imgheight,80); + $titlelen = AttDef($titlelen, 60); + $infolen = AttDef($infolen, 250); + $imgwidth = AttDef($imgwidth, 80); + $imgheight = AttDef($imgheight, 80); $innertext = trim($this->ListObj->GetInnerText()); - if(empty($innertext)) $innertext = GetSysTemplets("list_fulllist.htm"); + if (empty($innertext)) $innertext = GetSysTemplets("list_fulllist.htm"); $tablewidth = 100; - if($col=="") $col=1; + if ($col == "") $col = 1; $colWidth = ceil(100 / $col); - $tablewidth = $tablewidth."%"; - $colWidth = $colWidth."%"; + $tablewidth = $tablewidth . "%"; + $colWidth = $colWidth . "%"; //按不同情况设定SQL条件 $orwhere = " arc.arcrank > -1 AND channel>-1 "; @@ -500,53 +439,43 @@ class FreeList $listtype = $this->ListObj->GetAtt('type'); $att = $this->ListObj->GetAtt('att'); $channelid = $this->ListObj->GetAtt('channel'); - if(empty($channelid)) $channelid = 0; + if (empty($channelid)) $channelid = 0; //是否指定栏目条件 - if(!empty($typeid)) - { - if($cfg_list_son=='N') - { + if (!empty($typeid)) { + if ($cfg_list_son == 'N') { $orwhere .= " AND (arc.typeid='$typeid') "; - } - else - { - $orwhere .= " AND arc.typeid IN (".GetSonIds($typeid, 0, TRUE).") "; + } else { + $orwhere .= " AND arc.typeid IN (" . GetSonIds($typeid, 0, TRUE) . ") "; } } //自定义属性条件 - if($att!='') { + if ($att != '') { $flags = explode(',', $att); - for($i=0; isset($flags[$i]); $i++) $orwhere .= " AND FIND_IN_SET('{$flags[$i]}',flag)>0 "; + for ($i = 0; isset($flags[$i]); $i++) $orwhere .= " AND FIND_IN_SET('{$flags[$i]}',flag)>0 "; } //文档的频道模型 - if($channelid>0 && !preg_match("#spec#i", $listtype)) - { + if ($channelid > 0 && !preg_match("#spec#i", $listtype)) { $orwhere .= " AND arc.channel = '$channelid' "; } //推荐文档 带缩略图 专题文档 - if(preg_match("#commend#i",$listtype)) - { + if (preg_match("#commend#i", $listtype)) { $orwhere .= " AND FIND_IN_SET('c',flag) > 0 "; } - if(preg_match("#image#i",$listtype)) - { + if (preg_match("#image#i", $listtype)) { $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 "; } - if(!empty($subday)) - { - $starttime = time() - $subday*86400; + if (!empty($subday)) { + $starttime = time() - $subday * 86400; $orwhere .= " AND arc.senddate > $starttime "; } $keyword = $this->ListObj->GetAtt('keyword'); - if(!empty($keyword)) - { + if (!empty($keyword)) { $orwhere .= " AND CONCAT(arc.title,arc.keywords) REGEXP '$keyword' "; } $orderby = $this->ListObj->GetAtt('orderby'); @@ -554,65 +483,42 @@ class FreeList //排序方式 $ordersql = ""; - if($orderby=="senddate") - { - $ordersql=" ORDER BY arc.senddate $orderWay"; - } - else if($orderby=="pubdate") - { - $ordersql=" ORDER BY arc.pubdate $orderWay"; - } - else if($orderby=="id") - { - $ordersql=" ORDER BY arc.id $orderWay"; - } - else if($orderby=="hot"||$orderby=="click") - { + if ($orderby == "senddate") { + $ordersql = " ORDER BY arc.senddate $orderWay"; + } else if ($orderby == "pubdate") { + $ordersql = " ORDER BY arc.pubdate $orderWay"; + } else if ($orderby == "id") { + $ordersql = " ORDER BY arc.id $orderWay"; + } else if ($orderby == "hot" || $orderby == "click") { $ordersql = " ORDER BY arc.click $orderWay"; - } - else if($orderby=="lastpost") - { + } else if ($orderby == "lastpost") { $ordersql = " ORDER BY arc.lastpost $orderWay"; - } - else if($orderby=="scores") - { + } else if ($orderby == "scores") { $ordersql = " ORDER BY arc.scores $orderWay"; - } - else if($orderby=="rand") - { + } else if ($orderby == "rand") { $ordersql = " ORDER BY rand()"; - } - else - { - $ordersql=" ORDER BY arc.sortrank $orderWay"; + } else { + $ordersql = " ORDER BY arc.sortrank $orderWay"; } //获得附加表的相关信息 $addField = ""; $addJoin = ""; - if(is_object($this->ChannelUnit)) - { + if (is_object($this->ChannelUnit)) { $addtable = $this->ChannelUnit->ChannelInfos['addtable']; - if($addtable!="") - { - $addJoin = " LEFT JOIN $addtable ON arc.id = ".$addtable.".aid "; + if ($addtable != "") { + $addJoin = " LEFT JOIN $addtable ON arc.id = " . $addtable . ".aid "; $addField = ""; - $fields = explode(",",$this->ChannelUnit->ChannelInfos['listfields']); - foreach($fields as $k=>$v) - { + $fields = explode(",", $this->ChannelUnit->ChannelInfos['listfields']); + foreach ($fields as $k => $v) { $nfields[$v] = $k; } - foreach($this->ChannelUnit->ChannelFields as $k=>$arr) - { - if(isset($nfields[$k])) - { - if(!empty($arr['rename'])) - { - $addField .= ",".$addtable.".".$k." as ".$arr['rename']; - } - else - { - $addField .= ",".$addtable.".".$k; + foreach ($this->ChannelUnit->ChannelFields as $k => $arr) { + if (isset($nfields[$k])) { + if (!empty($arr['rename'])) { + $addField .= "," . $addtable . "." . $k . " as " . $arr['rename']; + } else { + $addField .= "," . $addtable . "." . $k; } } } @@ -625,147 +531,138 @@ class FreeList FROM {$this->maintable} arc LEFT JOIN #@__arctype tp ON arc.typeid=tp.id $addJoin - WHERE $orwhere $ordersql LIMIT $limitstart,".$this->PageSize; + WHERE $orwhere $ordersql LIMIT $limitstart," . $this->PageSize; $this->dsql->SetQuery($query); $this->dsql->Execute("al"); $artlist = ""; - if($col>1) - { + if ($col > 1) { $artlist = "\r\n"; } $indtp = new DedeTagParse(); - $indtp->SetNameSpace("field","[","]"); + $indtp->SetNameSpace("field", "[", "]"); $indtp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; - for($i=0;$i<$this->PageSize;$i++) - { - if($col>1) - { + for ($i = 0; $i < $this->PageSize; $i++) { + if ($col > 1) { $artlist .= "\r\n"; } - for($j=0;$j<$col;$j++) - { - if($col>1) - { + for ($j = 0; $j < $col; $j++) { + if ($col > 1) { $artlist .= "\r\n"; } - }//Loop Col + } //Loop Col - if($col>1){ + if ($col > 1) { $i += $col - 1; } - if($col>1) - { + if ($col > 1) { $artlist .= " \r\n"; } - }//Loop Line + } //Loop Line - if($col>1) - { + if ($col > 1) { $artlist .= "
    \r\n"; } - if($row = $this->dsql->GetArray("al")) - { + if ($row = $this->dsql->GetArray("al")) { $GLOBALS['autoindex']++; //处理一些特殊字段 $row['id'] = $row['id']; - $row['arcurl'] = $this->GetArcUrl($row['id'],$row['typeid'],$row['senddate'], - $row['title'],$row['ismake'],$row['arcrank'],$row['namerule'],$row['typedir'],$row['money'], - $row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']); - $row['typeurl'] = GetTypeUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'], - $row['ispart'],$row['namerule2'],$row['siteurl'],$row['sitepath']); - if($ismake==0 && $GLOBALS['cfg_multi_site']=='Y') - { - if($row["siteurl"]=="") - { + $row['arcurl'] = $this->GetArcUrl( + $row['id'], + $row['typeid'], + $row['senddate'], + $row['title'], + $row['ismake'], + $row['arcrank'], + $row['namerule'], + $row['typedir'], + $row['money'], + $row['filename'], + $row['moresite'], + $row['siteurl'], + $row['sitepath'] + ); + $row['typeurl'] = GetTypeUrl( + $row['typeid'], + $row['typedir'], + $row['isdefault'], + $row['defaultname'], + $row['ispart'], + $row['namerule2'], + $row['siteurl'], + $row['sitepath'] + ); + if ($ismake == 0 && $GLOBALS['cfg_multi_site'] == 'Y') { + if ($row["siteurl"] == "") { $row["siteurl"] = $GLOBALS['cfg_mainsite']; } } - $row['description'] = cn_substr($row['description'],$infolen); + $row['description'] = cn_substr($row['description'], $infolen); - if($row['litpic'] == '-' || $row['litpic'] == '') - { - $row['litpic'] = $GLOBALS['cfg_cmspath'].'/static/defaultpic.gif'; + if ($row['litpic'] == '-' || $row['litpic'] == '') { + $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/static/defaultpic.gif'; } - if(!preg_match("#^http:\/\/#i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') - { - $row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic']; + if (!preg_match("#^http:\/\/#i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { + $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic']; } $row['picname'] = $row['litpic']; $row['info'] = $row['description']; $row['filename'] = $row['arcurl']; $row['stime'] = GetDateMK($row['pubdate']); - $row['textlink'] = "".$row['title'].""; - $row['typelink'] = "[".$row['typename']."]"; - $row['imglink'] = "".str_replace(""; - $row['image'] = "".str_replace(""; + $row['textlink'] = "" . $row['title'] . ""; + $row['typelink'] = "[" . $row['typename'] . "]"; + $row['imglink'] = "" . str_replace(""; + $row['image'] = "" . str_replace(""; $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl']; $row['memberurl'] = $GLOBALS['cfg_memberurl']; $row['templeturl'] = $GLOBALS['cfg_templeturl']; - $row['title'] = cn_substr($row['title'],$titlelen); - if($row['color']!="") - { - $row['title'] = "".$row['title'].""; + $row['title'] = cn_substr($row['title'], $titlelen); + if ($row['color'] != "") { + $row['title'] = "" . $row['title'] . ""; } - if(preg_match("#c#", $row['flag'])) - { - $row['title'] = "".$row['title'].""; + if (preg_match("#c#", $row['flag'])) { + $row['title'] = "" . $row['title'] . ""; } //编译附加表里的数据 - if(is_object($this->ChannelUnit)) - { - foreach($row as $k=>$v) - { - if(preg_match("#[A-Z]#", $k)) - { + if (is_object($this->ChannelUnit)) { + foreach ($row as $k => $v) { + if (preg_match("#[A-Z]#", $k)) { $row[strtolower($k)] = $v; } } - foreach($this->ChannelUnit->ChannelFields as $k=>$arr) - { - if(isset($row[$k])) - { - $row[$k] = $this->ChannelUnit->MakeField($k,$row[$k]); + foreach ($this->ChannelUnit->ChannelFields as $k => $arr) { + if (isset($row[$k])) { + $row[$k] = $this->ChannelUnit->MakeField($k, $row[$k]); } } } //解析单条记录 - if(is_array($indtp->CTags)) - { - foreach($indtp->CTags as $k=>$ctag) - { + if (is_array($indtp->CTags)) { + foreach ($indtp->CTags as $k => $ctag) { $_f = $ctag->GetName(); - if($_f=='array') - { + if ($_f == 'array') { //传递整个数组,在runphp模式中有特殊作用 - $indtp->Assign($k,$row); - } - else - { - if(isset($row[$_f])) - { - $indtp->Assign($k,$row[$_f]); - } - else - { - $indtp->Assign($k,""); + $indtp->Assign($k, $row); + } else { + if (isset($row[$_f])) { + $indtp->Assign($k, $row[$_f]); + } else { + $indtp->Assign($k, ""); } } } } $artlist .= $indtp->GetResult(); - }//if hasRow + } //if hasRow - else - { + else { $artlist .= ""; } - if($col>1) - { + if ($col > 1) { $artlist .= "
    \r\n"; } $this->dsql->FreeResult("al"); @@ -780,129 +677,102 @@ class FreeList * @param string $listitem 列表项目 * @return string */ - function GetPageListST($list_len, $listitem="info,index,end,pre,next,pageno") + function GetPageListST($list_len, $listitem = "info,index,end,pre,next,pageno") { - $prepage=""; - $nextpage=""; - $prepagenum = $this->PageNo-1; - $nextpagenum = $this->PageNo+1; - if($list_len=="" || preg_match("#[^0-9]#", $list_len)) - { - $list_len=3; + $prepage = ""; + $nextpage = ""; + $prepagenum = $this->PageNo - 1; + $nextpagenum = $this->PageNo + 1; + if ($list_len == "" || preg_match("#[^0-9]#", $list_len)) { + $list_len = 3; } - $totalpage = ceil($this->TotalResult/$this->PageSize); - if($totalpage <= 1 && $this->TotalResult > 0) - { - return "
  • 共1页/".$this->TotalResult."条记录
  • "; + $totalpage = ceil($this->TotalResult / $this->PageSize); + if ($totalpage <= 1 && $this->TotalResult > 0) { + return "
  • 共1页/" . $this->TotalResult . "条记录
  • "; } - if($this->TotalResult == 0) - { - return "
  • 共0页/".$this->TotalResult."条记录
  • "; + if ($this->TotalResult == 0) { + return "
  • 共0页/" . $this->TotalResult . "条记录
  • "; } - $maininfo = "
  • 共{$totalpage}页/".$this->TotalResult."条记录
  • "; + $maininfo = "
  • 共{$totalpage}页/" . $this->TotalResult . "条记录
  • "; $purl = $this->GetCurUrl(); $tnamerule = $this->GetMakeFileRule(); $tnamerule = preg_replace("#^(.*)\/#", '', $tnamerule); - + //获得上一页和主页的链接 - if($this->PageNo != 1) - { - $prepage.="
  • 上一页
  • \r\n"; - $indexpage="
  • 首页
  • \r\n"; - } - else - { - $indexpage="
  • 首页
  • \r\n"; + if ($this->PageNo != 1) { + $prepage .= "
  • 上一页
  • \r\n"; + $indexpage = "
  • 首页
  • \r\n"; + } else { + $indexpage = "
  • 首页
  • \r\n"; } //下一页,未页的链接 - if($this->PageNo!=$totalpage && $totalpage>1) - { - $nextpage.="下一页\r\n"; - $endpage="末页\r\n"; - } - else - { - $endpage="
  • 末页
  • \r\n"; + if ($this->PageNo != $totalpage && $totalpage > 1) { + $nextpage .= "下一页\r\n"; + $endpage = "末页\r\n"; + } else { + $endpage = "
  • 末页
  • \r\n"; } //option链接 $optionlen = strlen($totalpage); - $optionlen = $optionlen*12 + 18; - if($optionlen < 36) $optionlen = 36; - if($optionlen > 100) $optionlen = 100; + $optionlen = $optionlen * 12 + 18; + if ($optionlen < 36) $optionlen = 36; + if ($optionlen > 100) $optionlen = 100; $optionlist = ""; //获得数字链接 - $listdd=""; + $listdd = ""; $total_list = $list_len * 2 + 1; - if($this->PageNo >= $total_list) - { - $j = $this->PageNo-$list_len; - $total_list = $this->PageNo+$list_len; - if($total_list > $totalpage) - { + if ($this->PageNo >= $total_list) { + $j = $this->PageNo - $list_len; + $total_list = $this->PageNo + $list_len; + if ($total_list > $totalpage) { $total_list = $totalpage; } - } - else - { + } else { $j = 1; - if($total_list > $totalpage) - { + if ($total_list > $totalpage) { $total_list = $totalpage; } } - - for($j; $j<=$total_list; $j++) - { - if($j==$this->PageNo) - { - $listdd.= "
  • {$j}
  • \r\n"; - } - else - { - $listdd.="
  • ".$j."
  • \r\n"; + + for ($j; $j <= $total_list; $j++) { + if ($j == $this->PageNo) { + $listdd .= "
  • {$j}
  • \r\n"; + } else { + $listdd .= "
  • " . $j . "
  • \r\n"; } } $plist = ""; - if(preg_match('#info#i', $listitem)) - { - $plist .= $maininfo.' '; + if (preg_match('#info#i', $listitem)) { + $plist .= $maininfo . ' '; } - if(preg_match('#index#i',$listitem)) - { - $plist .= $indexpage.' '; + if (preg_match('#index#i', $listitem)) { + $plist .= $indexpage . ' '; } - if(preg_match('#pre#i', $listitem)) - { - $plist .= $prepage.' '; + if (preg_match('#pre#i', $listitem)) { + $plist .= $prepage . ' '; } - if(preg_match('#pageno#i', $listitem)) - { - $plist .= $listdd.' '; + if (preg_match('#pageno#i', $listitem)) { + $plist .= $listdd . ' '; } - if(preg_match('#next#i', $listitem)) - { - $plist .= $nextpage.' '; + if (preg_match('#next#i', $listitem)) { + $plist .= $nextpage . ' '; } - if(preg_match('#end#i', $listitem)) - { - $plist .= $endpage.' '; + if (preg_match('#end#i', $listitem)) { + $plist .= $endpage . ' '; } - if(preg_match('#option#i', $listitem)) - { + if (preg_match('#option#i', $listitem)) { $plist .= $optionlist; } return $plist; @@ -916,83 +786,66 @@ class FreeList * @param string $listitem 列表项目 * @return string */ - function GetPageListDM($list_len,$listitem="index,end,pre,next,pageno") + function GetPageListDM($list_len, $listitem = "index,end,pre,next,pageno") { - $prepage=""; - $nextpage=""; - $prepagenum = $this->PageNo-1; - $nextpagenum = $this->PageNo+1; - if($list_len==""||preg_match("/[^0-9]/", $list_len)) - { - $list_len=3; + $prepage = ""; + $nextpage = ""; + $prepagenum = $this->PageNo - 1; + $nextpagenum = $this->PageNo + 1; + if ($list_len == "" || preg_match("/[^0-9]/", $list_len)) { + $list_len = 3; } - $totalpage = ceil($this->TotalResult/$this->PageSize); - if($totalpage<=1 && $this->TotalResult>0) - { - return "
  • 共1页/".$this->TotalResult."条记录
  • "; + $totalpage = ceil($this->TotalResult / $this->PageSize); + if ($totalpage <= 1 && $this->TotalResult > 0) { + return "
  • 共1页/" . $this->TotalResult . "条记录
  • "; } - if($this->TotalResult == 0) - { - return "
  • 共0页/".$this->TotalResult."条记录
  • "; + if ($this->TotalResult == 0) { + return "
  • 共0页/" . $this->TotalResult . "条记录
  • "; } - $maininfo = "
  • 共{$totalpage}页/".$this->TotalResult."条记录
  • "; + $maininfo = "
  • 共{$totalpage}页/" . $this->TotalResult . "条记录
  • "; $purl = $this->GetCurUrl(); - $geturl = "lid=".$this->FreeID."&TotalResult=".$this->TotalResult."&"; - $hidenform = "\r\n"; - $hidenform .= "\r\n"; - $purl .= "?".$geturl; + $geturl = "lid=" . $this->FreeID . "&TotalResult=" . $this->TotalResult . "&"; + $hidenform = "\r\n"; + $hidenform .= "\r\n"; + $purl .= "?" . $geturl; //获得上一页和下一页的链接 - if($this->PageNo != 1) - { - $prepage.="
  • 上一页\r\n"; - $indexpage="
  • 首页\r\n"; - } - else - { - $indexpage="
  • 首页
  • \r\n"; + if ($this->PageNo != 1) { + $prepage .= "
  • 上一页\r\n"; + $indexpage = "
  • 首页\r\n"; + } else { + $indexpage = "
  • 首页
  • \r\n"; } - if($this->PageNo!=$totalpage && $totalpage>1) - { - $nextpage.="
  • 下一页\r\n"; - $endpage="
  • 末页\r\n"; - } - else - { - $endpage="
  • 末页
  • \r\n"; + if ($this->PageNo != $totalpage && $totalpage > 1) { + $nextpage .= "
  • 下一页\r\n"; + $endpage = "
  • 末页\r\n"; + } else { + $endpage = "
  • 末页
  • \r\n"; } //获得数字链接 - $listdd=""; + $listdd = ""; $total_list = $list_len * 2 + 1; - if($this->PageNo >= $total_list) - { - $j = $this->PageNo-$list_len; - $total_list = $this->PageNo+$list_len; - if($total_list>$totalpage) $total_list=$totalpage; - } - else - { - $j=1; - if($total_list>$totalpage) $total_list=$totalpage; + if ($this->PageNo >= $total_list) { + $j = $this->PageNo - $list_len; + $total_list = $this->PageNo + $list_len; + if ($total_list > $totalpage) $total_list = $totalpage; + } else { + $j = 1; + if ($total_list > $totalpage) $total_list = $totalpage; } - for($j;$j<=$total_list;$j++) - { - if($j==$this->PageNo) - { - $listdd.= "
  • $j
  • \r\n"; - } - else - { - $listdd.="
  • ".$j."
  • \r\n"; + for ($j; $j <= $total_list; $j++) { + if ($j == $this->PageNo) { + $listdd .= "
  • $j
  • \r\n"; + } else { + $listdd .= "
  • " . $j . "
  • \r\n"; } } - $plist = "
    $hidenform"; - $plist .= $maininfo.$indexpage.$prepage.$listdd.$nextpage.$endpage; - if($totalpage>$total_list) - { - $plist.="\r\n"; - $plist.="\r\n"; + $plist = "$hidenform"; + $plist .= $maininfo . $indexpage . $prepage . $listdd . $nextpage . $endpage; + if ($totalpage > $total_list) { + $plist .= "\r\n"; + $plist .= "\r\n"; } $plist .= "
    \r\n"; return $plist; @@ -1017,11 +870,36 @@ class FreeList * @param string $sitepath 站点路径 * @return string */ - function GetArcUrl($aid, $typeid, $timetag, $title, $ismake=0, $rank=0, $namerule='', $artdir='', - $money=0, $filename='', $moresite='', $siteurl='', $sitepath='') - { - return GetFileUrl($aid, $typeid, $timetag, $title, $ismake, $rank, $namerule, $artdir, - $money, $filename, $moresite, $siteurl, $sitepath); + function GetArcUrl( + $aid, + $typeid, + $timetag, + $title, + $ismake = 0, + $rank = 0, + $namerule = '', + $artdir = '', + $money = 0, + $filename = '', + $moresite = '', + $siteurl = '', + $sitepath = '' + ) { + return GetFileUrl( + $aid, + $typeid, + $timetag, + $title, + $ismake, + $rank, + $namerule, + $artdir, + $money, + $filename, + $moresite, + $siteurl, + $sitepath + ); } /** @@ -1032,14 +910,11 @@ class FreeList */ function GetCurUrl() { - if(!empty($_SERVER["REQUEST_URI"])) - { + if (!empty($_SERVER["REQUEST_URI"])) { $nowurl = $_SERVER["REQUEST_URI"]; - $nowurls = explode("?",$nowurl); + $nowurls = explode("?", $nowurl); $nowurl = $nowurls[0]; - } - else - { + } else { $nowurl = $_SERVER["PHP_SELF"]; } return $nowurl; diff --git a/src/include/arc.listview.class.php b/src/include/arc.listview.class.php index 32264089..d3d03fb9 100755 --- a/src/include/arc.listview.class.php +++ b/src/include/arc.listview.class.php @@ -1,15 +1,15 @@ -TypeID = $typeid; $this->dsql = &$dsql; $this->CrossID = ''; @@ -64,19 +64,17 @@ class ListView $this->dtp->SetRefObj($this); $this->dtp->SetNameSpace("dede", "{", "}"); $this->dtp2 = new DedeTagParse(); - $this->dtp2->SetNameSpace("field","[","]"); + $this->dtp2->SetNameSpace("field", "[", "]"); $this->TypeLink = new TypeLink($typeid); $this->upPageType = $uppage; $this->ftp = &$ftp; $this->remoteDir = ''; - $this->TotalResult = is_numeric($this->TotalResult)? $this->TotalResult : ""; - - if(!is_array($this->TypeLink->TypeInfos)) - { + $this->TotalResult = is_numeric($this->TotalResult) ? $this->TotalResult : ""; + + if (!is_array($this->TypeLink->TypeInfos)) { $this->IsError = true; } - if(!$this->IsError) - { + if (!$this->IsError) { $this->ChannelUnit = new ChannelUnit($this->TypeLink->TypeInfos['channeltype']); $this->Fields = $this->TypeLink->TypeInfos; $this->Fields['id'] = $typeid; @@ -84,53 +82,45 @@ class ListView $this->Fields['title'] = preg_replace("/[<>]/", " / ", $this->TypeLink->GetPositionLink(false)); //设置一些全局参数的值 - foreach($GLOBALS['PubFields'] as $k=>$v) $this->Fields[$k] = $v; - $this->Fields['rsslink'] = $GLOBALS['cfg_cmsurl']."/data/rss/".$this->TypeID.".xml"; + foreach ($GLOBALS['PubFields'] as $k => $v) $this->Fields[$k] = $v; + $this->Fields['rsslink'] = $GLOBALS['cfg_cmsurl'] . "/data/rss/" . $this->TypeID . ".xml"; //设置环境变量 - SetSysEnv($this->TypeID,$this->Fields['typename'],0,'','list'); + SetSysEnv($this->TypeID, $this->Fields['typename'], 0, '', 'list'); $this->Fields['typeid'] = $this->TypeID; //获得交叉栏目ID - if($this->TypeLink->TypeInfos['cross']>0 && $this->TypeLink->TypeInfos['ispart']==0) - { + if ($this->TypeLink->TypeInfos['cross'] > 0 && $this->TypeLink->TypeInfos['ispart'] == 0) { $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}' "; - } - else - { + } else { $this->Fields['crossid'] = preg_replace('/[^0-9,]/', '', trim($this->Fields['crossid'])); - if($this->Fields['crossid']!='') - { + if ($this->Fields['crossid'] != '') { $selquery = "SELECT id,topid FROM `#@__arctype` WHERE id in({$this->Fields['crossid']}) AND id<>{$this->TypeID} AND topid<>{$this->TypeID} "; } } - if($selquery!='') - { + if ($selquery != '') { $this->dsql->SetQuery($selquery); $this->dsql->Execute(); - while($arr = $this->dsql->GetArray()) - { - $this->CrossID .= ($this->CrossID=='' ? $arr['id'] : ','.$arr['id']); + while ($arr = $this->dsql->GetArray()) { + $this->CrossID .= ($this->CrossID == '' ? $arr['id'] : ',' . $arr['id']); } } } - - }//!error + } //!error } //php4构造函数 - function ListView($typeid,$uppage=0){ - $this->__construct($typeid,$uppage); + function ListView($typeid, $uppage = 0) + { + $this->__construct($typeid, $uppage); } - + //关闭相关资源 function Close() { - } /** @@ -142,130 +132,100 @@ class ListView */ function CountRecord() { - global $cfg_list_son,$cfg_need_typeid2,$cfg_cross_sectypeid; - if(empty($cfg_need_typeid2)) $cfg_need_typeid2 = 'N'; - + global $cfg_list_son, $cfg_need_typeid2, $cfg_cross_sectypeid; + if (empty($cfg_need_typeid2)) $cfg_need_typeid2 = 'N'; + //统计数据库记录 $this->TotalResult = -1; - if(isset($GLOBALS['TotalResult'])) $this->TotalResult = $GLOBALS['TotalResult']; - if(isset($GLOBALS['PageNo'])) $this->PageNo = $GLOBALS['PageNo']; + if (isset($GLOBALS['TotalResult'])) $this->TotalResult = $GLOBALS['TotalResult']; + if (isset($GLOBALS['PageNo'])) $this->PageNo = $GLOBALS['PageNo']; else $this->PageNo = 1; $this->addSql = " arc.arcrank > -1 "; - + $typeid2like = " '%,{$this->TypeID},%' "; - if($cfg_list_son=='N') - { - - if($cfg_need_typeid2=='N') - { - if($this->CrossID=='') $this->addSql .= " AND (arc.typeid='".$this->TypeID."') "; + if ($cfg_list_son == 'N') { + + if ($cfg_need_typeid2 == 'N') { + if ($this->CrossID == '') $this->addSql .= " AND (arc.typeid='" . $this->TypeID . "') "; else $this->addSql .= " AND (arc.typeid in({$this->CrossID},{$this->TypeID})) "; + } else { + if ($this->CrossID == '') { + $this->addSql .= " AND ( (arc.typeid='" . $this->TypeID . "') OR CONCAT(',', arc.typeid2, ',') LIKE $typeid2like) "; + } else { + if ($cfg_cross_sectypeid == 'Y') { + $typeid2Clike = " '%,{$this->CrossID},%' "; + $this->addSql .= " AND ( arc.typeid IN({$this->CrossID},{$this->TypeID}) OR CONCAT(',', arc.typeid2, ',') LIKE $typeid2like OR CONCAT(',', arc.typeid2, ',') LIKE $typeid2Clike)"; + } else { + $this->addSql .= " AND ( arc.typeid IN({$this->CrossID},{$this->TypeID}) OR CONCAT(',', arc.typeid2, ',') LIKE $typeid2like)"; + } + } } - else - { - if($this->CrossID=='') - { - $this->addSql .= " AND ( (arc.typeid='".$this->TypeID."') OR CONCAT(',', arc.typeid2, ',') LIKE $typeid2like) "; - } else { - if($cfg_cross_sectypeid == 'Y') - { - $typeid2Clike = " '%,{$this->CrossID},%' "; - $this->addSql .= " AND ( arc.typeid IN({$this->CrossID},{$this->TypeID}) OR CONCAT(',', arc.typeid2, ',') LIKE $typeid2like OR CONCAT(',', arc.typeid2, ',') LIKE $typeid2Clike)"; - } else { - $this->addSql .= " AND ( arc.typeid IN({$this->CrossID},{$this->TypeID}) OR CONCAT(',', arc.typeid2, ',') LIKE $typeid2like)"; - } - } - } - } - else - { - $sonids = GetSonIds($this->TypeID,$this->Fields['channeltype']); - if(!preg_match("/,/", $sonids)) { + } else { + $sonids = GetSonIds($this->TypeID, $this->Fields['channeltype']); + if (!preg_match("/,/", $sonids)) { $sonidsCon = " arc.typeid = '$sonids' "; - } - else { + } else { $sonidsCon = " arc.typeid IN($sonids) "; } - if($cfg_need_typeid2=='N') - { - if($this->CrossID=='') $this->addSql .= " AND ( $sonidsCon ) "; + if ($cfg_need_typeid2 == 'N') { + if ($this->CrossID == '') $this->addSql .= " AND ( $sonidsCon ) "; else $this->addSql .= " AND ( arc.typeid IN ({$sonids},{$this->CrossID}) ) "; - } - else - { - if($this->CrossID=='') - { - $this->addSql .= " AND ( $sonidsCon OR CONCAT(',', arc.typeid2, ',') like $typeid2like ) "; - } else { - if($cfg_cross_sectypeid == 'Y') - { - $typeid2Clike = " '%,{$this->CrossID},%' "; - $this->addSql .= " AND ( arc.typeid IN ({$sonids},{$this->CrossID}) OR CONCAT(',', arc.typeid2, ',') LIKE $typeid2like OR CONCAT(',', arc.typeid2, ',') LIKE $typeid2Clike) "; - } else { - $this->addSql .= " AND ( arc.typeid IN ({$sonids},{$this->CrossID}) OR CONCAT(',', arc.typeid2, ',') LIKE $typeid2like) "; - } - - } + } else { + if ($this->CrossID == '') { + $this->addSql .= " AND ( $sonidsCon OR CONCAT(',', arc.typeid2, ',') like $typeid2like ) "; + } else { + if ($cfg_cross_sectypeid == 'Y') { + $typeid2Clike = " '%,{$this->CrossID},%' "; + $this->addSql .= " AND ( arc.typeid IN ({$sonids},{$this->CrossID}) OR CONCAT(',', arc.typeid2, ',') LIKE $typeid2like OR CONCAT(',', arc.typeid2, ',') LIKE $typeid2Clike) "; + } else { + $this->addSql .= " AND ( arc.typeid IN ({$sonids},{$this->CrossID}) OR CONCAT(',', arc.typeid2, ',') LIKE $typeid2like) "; + } + } } } - if($this->TotalResult==-1) - { - $cquery = "SELECT COUNT(*) AS dd FROM `#@__arctiny` arc WHERE ".$this->addSql; + if ($this->TotalResult == -1) { + $cquery = "SELECT COUNT(*) AS dd FROM `#@__arctiny` arc WHERE " . $this->addSql; $row = $this->dsql->GetOne($cquery); - if(is_array($row)) - { + if (is_array($row)) { $this->TotalResult = $row['dd']; - } - else - { + } else { $this->TotalResult = 0; } } //初始化列表模板,并统计页面总数 - $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$this->TypeLink->TypeInfos['templist']; + $tempfile = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_templets_dir'] . "/" . $this->TypeLink->TypeInfos['templist']; $tempfile = str_replace("{tid}", $this->TypeID, $tempfile); $tempfile = str_replace("{cid}", $this->ChannelUnit->ChannelInfos['nid'], $tempfile); - if ( defined('DEDEMOB') ) - { - $tempfile =str_replace('.htm','_m.htm',$tempfile); + if (defined('DEDEMOB')) { + $tempfile = str_replace('.htm', '_m.htm', $tempfile); } - if(!file_exists($tempfile)) - { - $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/list_default.htm"; - if ( defined('DEDEMOB') ) - { - $tempfile =str_replace('.htm','_m.htm',$tempfile); + if (!file_exists($tempfile)) { + $tempfile = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_templets_dir'] . "/" . $GLOBALS['cfg_df_style'] . "/list_default.htm"; + if (defined('DEDEMOB')) { + $tempfile = str_replace('.htm', '_m.htm', $tempfile); } } - - if(!file_exists($tempfile)||!is_file($tempfile)) - { + + if (!file_exists($tempfile) || !is_file($tempfile)) { echo "模板文件不存在,无法解析文档!"; exit(); } $this->dtp->LoadTemplate($tempfile); $ctag = $this->dtp->GetTag("page"); - if(!is_object($ctag)) - { + if (!is_object($ctag)) { $ctag = $this->dtp->GetTag("list"); } - if(!is_object($ctag)) - { + if (!is_object($ctag)) { $this->PageSize = 20; - } - else - { - if($ctag->GetAtt("pagesize")!="") - { + } else { + if ($ctag->GetAtt("pagesize") != "") { $this->PageSize = $ctag->GetAtt("pagesize"); - } - else - { + } else { $this->PageSize = 20; } } - $this->TotalPage = ceil($this->TotalResult/$this->PageSize); + $this->TotalPage = ceil($this->TotalResult / $this->PageSize); } /** @@ -277,80 +237,69 @@ class ListView * @param string $isremote 是否为远程 * @return string */ - function MakeHtml($startpage=1, $makepagesize=0, $isremote=0) + function MakeHtml($startpage = 1, $makepagesize = 0, $isremote = 0) { - if(empty($startpage)) - { + if (empty($startpage)) { $startpage = 1; } //创建封面模板文件 - if($this->TypeLink->TypeInfos['isdefault']==-1) - { + if ($this->TypeLink->TypeInfos['isdefault'] == -1) { echo '这个类目是动态类目!'; - return '../plus/list.php?tid='.$this->TypeLink->TypeInfos['id']; + return '../plus/list.php?tid=' . $this->TypeLink->TypeInfos['id']; } //单独页面 - else if($this->TypeLink->TypeInfos['ispart']>0) - { + else if ($this->TypeLink->TypeInfos['ispart'] > 0) { $reurl = $this->MakePartTemplets(); return $reurl; } - if(empty($this->TotalResult)) $this->CountRecord(); + if (empty($this->TotalResult)) $this->CountRecord(); //初步给固定值的标记赋值 $this->ParseTempletsFirst(); - $totalpage = ceil($this->TotalResult/$this->PageSize); - if($totalpage==0) - { + $totalpage = ceil($this->TotalResult / $this->PageSize); + if ($totalpage == 0) { $totalpage = 1; } CreateDir(MfTypedir($this->Fields['typedir'])); $murl = ''; - if($makepagesize > 0) - { - $endpage = $startpage+$makepagesize; - } - else - { - $endpage = ($totalpage+1); + if ($makepagesize > 0) { + $endpage = $startpage + $makepagesize; + } else { + $endpage = ($totalpage + 1); } - if( $endpage >= $totalpage+1 ) - { - $endpage = $totalpage+1; + if ($endpage >= $totalpage + 1) { + $endpage = $totalpage + 1; } - if($endpage==1) - { + if ($endpage == 1) { $endpage = 2; } - for($this->PageNo=$startpage; $this->PageNo < $endpage; $this->PageNo++) - { - $this->ParseDMFields($this->PageNo,1); - $makeFile = $this->GetMakeFileRule($this->Fields['id'],'list',$this->Fields['typedir'],'',$this->Fields['namerule2']); + for ($this->PageNo = $startpage; $this->PageNo < $endpage; $this->PageNo++) { + $this->ParseDMFields($this->PageNo, 1); + $makeFile = $this->GetMakeFileRule($this->Fields['id'], 'list', $this->Fields['typedir'], '', $this->Fields['namerule2']); $makeFile = str_replace("{page}", $this->PageNo, $makeFile); $murl = $makeFile; - if(!preg_match("/^\//", $makeFile)) - { - $makeFile = "/".$makeFile; + if (!preg_match("/^\//", $makeFile)) { + $makeFile = "/" . $makeFile; } - $makeFile = $this->GetTruePath().$makeFile; + $makeFile = $this->GetTruePath() . $makeFile; $makeFile = preg_replace("/\/{1,}/", "/", $makeFile); $murl = $this->GetTrueUrl($murl); $this->dtp->SaveTo($makeFile); } - if($startpage==1) - { + if ($startpage == 1) { //如果列表启用封面文件,复制这个文件第一页 - if($this->TypeLink->TypeInfos['isdefault']==1 - && $this->TypeLink->TypeInfos['ispart']==0) - { - $onlyrule = $this->GetMakeFileRule($this->Fields['id'],"list",$this->Fields['typedir'],'',$this->Fields['namerule2']); - $onlyrule = str_replace("{page}","1",$onlyrule); - $list_1 = $this->GetTruePath().$onlyrule; - $murl = MfTypedir($this->Fields['typedir']).'/'.$this->Fields['defaultname']; - $indexname = $this->GetTruePath().$murl; - copy($list_1,$indexname); + if ( + $this->TypeLink->TypeInfos['isdefault'] == 1 + && $this->TypeLink->TypeInfos['ispart'] == 0 + ) { + $onlyrule = $this->GetMakeFileRule($this->Fields['id'], "list", $this->Fields['typedir'], '', $this->Fields['namerule2']); + $onlyrule = str_replace("{page}", "1", $onlyrule); + $list_1 = $this->GetTruePath() . $onlyrule; + $murl = MfTypedir($this->Fields['typedir']) . '/' . $this->Fields['defaultname']; + $indexname = $this->GetTruePath() . $murl; + copy($list_1, $indexname); } } return $murl; @@ -364,35 +313,31 @@ class ListView */ function Display() { - if($this->TypeLink->TypeInfos['ispart']>0) - { + if ($this->TypeLink->TypeInfos['ispart'] > 0) { $this->DisplayPartTemplets(); - return ; + return; } $this->CountRecord(); - if((empty($this->PageNo) || $this->PageNo==1) - && $this->TypeLink->TypeInfos['ispart']==1) - { - $tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']; - $tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempindex']); - $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile); - $tempfile = $tmpdir."/".$tempfile; - if ( defined('DEDEMOB') ) - { - $tempfile =str_replace('.htm','_m.htm',$tempfile); + if ((empty($this->PageNo) || $this->PageNo == 1) + && $this->TypeLink->TypeInfos['ispart'] == 1 + ) { + $tmpdir = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_templets_dir']; + $tempfile = str_replace("{tid}", $this->TypeID, $this->Fields['tempindex']); + $tempfile = str_replace("{cid}", $this->ChannelUnit->ChannelInfos['nid'], $tempfile); + $tempfile = $tmpdir . "/" . $tempfile; + if (defined('DEDEMOB')) { + $tempfile = str_replace('.htm', '_m.htm', $tempfile); } - if(!file_exists($tempfile)) - { - $tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_default.htm"; - if ( defined('DEDEMOB') ) - { - $tempfile =str_replace('.htm','_m.htm',$tempfile); + if (!file_exists($tempfile)) { + $tempfile = $tmpdir . "/" . $GLOBALS['cfg_df_style'] . "/index_default.htm"; + if (defined('DEDEMOB')) { + $tempfile = str_replace('.htm', '_m.htm', $tempfile); } } $this->dtp->LoadTemplate($tempfile); } $this->ParseTempletsFirst(); - $this->ParseDMFields($this->PageNo,0); + $this->ParseDMFields($this->PageNo, 0); $this->dtp->Display(); } @@ -404,46 +349,36 @@ class ListView */ function MakePartTemplets() { - $this->PartView = new PartView($this->TypeID,false); + $this->PartView = new PartView($this->TypeID, false); $this->PartView->SetTypeLink($this->TypeLink); $nmfa = 0; - $tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']; - if($this->Fields['ispart']==1) - { - $tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempindex']); - $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile); - $tempfile = $tmpdir."/".$tempfile; - if ( defined('DEDEMOB') ) - { - $tempfile =str_replace('.htm','_m.htm',$tempfile); + $tmpdir = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_templets_dir']; + if ($this->Fields['ispart'] == 1) { + $tempfile = str_replace("{tid}", $this->TypeID, $this->Fields['tempindex']); + $tempfile = str_replace("{cid}", $this->ChannelUnit->ChannelInfos['nid'], $tempfile); + $tempfile = $tmpdir . "/" . $tempfile; + if (defined('DEDEMOB')) { + $tempfile = str_replace('.htm', '_m.htm', $tempfile); } - if(!file_exists($tempfile)) - { - $tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_default.htm"; - if ( defined('DEDEMOB') ) - { - $tempfile =str_replace('.htm','_m.htm',$tempfile); + if (!file_exists($tempfile)) { + $tempfile = $tmpdir . "/" . $GLOBALS['cfg_df_style'] . "/index_default.htm"; + if (defined('DEDEMOB')) { + $tempfile = str_replace('.htm', '_m.htm', $tempfile); } } $this->PartView->SetTemplet($tempfile); - } - else if($this->Fields['ispart']==2) - { + } else if ($this->Fields['ispart'] == 2) { //跳转网址 return $this->Fields['typedir']; } CreateDir(MfTypedir($this->Fields['typedir'])); - $makeUrl = $this->GetMakeFileRule($this->Fields['id'],"index",MfTypedir($this->Fields['typedir']),$this->Fields['defaultname'],$this->Fields['namerule2']); + $makeUrl = $this->GetMakeFileRule($this->Fields['id'], "index", MfTypedir($this->Fields['typedir']), $this->Fields['defaultname'], $this->Fields['namerule2']); $makeUrl = preg_replace("/\/{1,}/", "/", $makeUrl); - $makeFile = $this->GetTruePath().$makeUrl; - if($nmfa==0) - { + $makeFile = $this->GetTruePath() . $makeUrl; + if ($nmfa == 0) { $this->PartView->SaveToHtml($makeFile); - } - else - { - if(!file_exists($makeFile)) - { + } else { + if (!file_exists($makeFile)) { $this->PartView->SaveToHtml($makeFile); } } @@ -459,52 +394,40 @@ class ListView */ function DisplayPartTemplets() { - $this->PartView = new PartView($this->TypeID,false); + $this->PartView = new PartView($this->TypeID, false); $this->PartView->SetTypeLink($this->TypeLink); $nmfa = 0; - $tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']; - if($this->Fields['ispart']==1) - { + $tmpdir = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_templets_dir']; + if ($this->Fields['ispart'] == 1) { //封面模板 - $tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempindex']); - $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile); - $tempfile = $tmpdir."/".$tempfile; - if ( defined('DEDEMOB') ) - { - $tempfile =str_replace('.htm','_m.htm',$tempfile); + $tempfile = str_replace("{tid}", $this->TypeID, $this->Fields['tempindex']); + $tempfile = str_replace("{cid}", $this->ChannelUnit->ChannelInfos['nid'], $tempfile); + $tempfile = $tmpdir . "/" . $tempfile; + if (defined('DEDEMOB')) { + $tempfile = str_replace('.htm', '_m.htm', $tempfile); } - if(!file_exists($tempfile)) - { - $tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_default.htm"; - if ( defined('DEDEMOB') ) - { - $tempfile =str_replace('.htm','_m.htm',$tempfile); + if (!file_exists($tempfile)) { + $tempfile = $tmpdir . "/" . $GLOBALS['cfg_df_style'] . "/index_default.htm"; + if (defined('DEDEMOB')) { + $tempfile = str_replace('.htm', '_m.htm', $tempfile); } } $this->PartView->SetTemplet($tempfile); - } - else if($this->Fields['ispart']==2) - { + } else if ($this->Fields['ispart'] == 2) { //跳转网址 $gotourl = $this->Fields['typedir']; header("Location:$gotourl"); exit(); } CreateDir(MfTypedir($this->Fields['typedir'])); - $makeUrl = $this->GetMakeFileRule($this->Fields['id'],"index",MfTypedir($this->Fields['typedir']),$this->Fields['defaultname'],$this->Fields['namerule2']); - $makeFile = $this->GetTruePath().$makeUrl; - if($nmfa==0) - { + $makeUrl = $this->GetMakeFileRule($this->Fields['id'], "index", MfTypedir($this->Fields['typedir']), $this->Fields['defaultname'], $this->Fields['namerule2']); + $makeFile = $this->GetTruePath() . $makeUrl; + if ($nmfa == 0) { $this->PartView->Display(); - } - else - { - if(!file_exists($makeFile)) - { + } else { + if (!file_exists($makeFile)) { $this->PartView->Display(); - } - else - { + } else { include($makeFile); } } @@ -531,13 +454,11 @@ class ListView */ function GetTrueUrl($nurl) { - if($this->Fields['moresite']==1) - { - if($this->Fields['sitepath']!='') - { - $nurl = preg_replace("/^".$this->Fields['sitepath']."/", '', $nurl); + if ($this->Fields['moresite'] == 1) { + if ($this->Fields['sitepath'] != '') { + $nurl = preg_replace("/^" . $this->Fields['sitepath'] . "/", '', $nurl); } - $nurl = $this->Fields['siteurl'].$nurl; + $nurl = $this->Fields['siteurl'] . $nurl; } return $nurl; } @@ -550,14 +471,13 @@ class ListView */ function ParseTempletsFirst() { - if(isset($this->TypeLink->TypeInfos['reid'])) - { + if (isset($this->TypeLink->TypeInfos['reid'])) { $GLOBALS['envs']['reid'] = $this->TypeLink->TypeInfos['reid']; } $GLOBALS['envs']['typeid'] = $this->TypeID; $GLOBALS['envs']['topid'] = GetTopid($this->Fields['typeid']); $GLOBALS['envs']['cross'] = 1; - MakeOneTag($this->dtp,$this); + MakeOneTag($this->dtp, $this); } /** @@ -568,66 +488,53 @@ class ListView * @param int $ismake 是否编译 * @return string */ - function ParseDMFields($PageNo,$ismake=1) + function ParseDMFields($PageNo, $ismake = 1) { //替换第二页后的内容 - if(($PageNo>1 || strlen($this->Fields['content'])<10 ) && !$this->IsReplace) - { - $this->dtp->SourceString = str_replace('[cmsreplace]','display:none',$this->dtp->SourceString); + if (($PageNo > 1 || strlen($this->Fields['content']) < 10) && !$this->IsReplace) { + $this->dtp->SourceString = str_replace('[cmsreplace]', 'display:none', $this->dtp->SourceString); $this->IsReplace = true; } - foreach($this->dtp->CTags as $tagid=>$ctag) - { - if($ctag->GetName()=="list") - { - $limitstart = ($this->PageNo-1) * $this->PageSize; + foreach ($this->dtp->CTags as $tagid => $ctag) { + if ($ctag->GetName() == "list") { + $limitstart = ($this->PageNo - 1) * $this->PageSize; $row = $this->PageSize; - if(trim($ctag->GetInnerText())=="") - { + if (trim($ctag->GetInnerText()) == "") { $InnerText = GetSysTemplets("list_fulllist.htm"); - } - else - { + } else { $InnerText = trim($ctag->GetInnerText()); } - $this->dtp->Assign($tagid, - $this->GetArcList( - $limitstart, - $row, - $ctag->GetAtt("col"), - $ctag->GetAtt("titlelen"), - $ctag->GetAtt("infolen"), - $ctag->GetAtt("imgwidth"), - $ctag->GetAtt("imgheight"), - $ctag->GetAtt("listtype"), - $ctag->GetAtt("orderby"), - $InnerText, - $ctag->GetAtt("tablewidth"), - $ismake, - $ctag->GetAtt("orderway") - ) + $this->dtp->Assign( + $tagid, + $this->GetArcList( + $limitstart, + $row, + $ctag->GetAtt("col"), + $ctag->GetAtt("titlelen"), + $ctag->GetAtt("infolen"), + $ctag->GetAtt("imgwidth"), + $ctag->GetAtt("imgheight"), + $ctag->GetAtt("listtype"), + $ctag->GetAtt("orderby"), + $InnerText, + $ctag->GetAtt("tablewidth"), + $ismake, + $ctag->GetAtt("orderway") + ) ); - } - else if($ctag->GetName()=="pagelist") - { + } else if ($ctag->GetName() == "pagelist") { $list_len = trim($ctag->GetAtt("listsize")); - $ctag->GetAtt("listitem")=="" ? $listitem="index,pre,pageno,next,end,option" : $listitem=$ctag->GetAtt("listitem"); - if($list_len=="") - { + $ctag->GetAtt("listitem") == "" ? $listitem = "index,pre,pageno,next,end,option" : $listitem = $ctag->GetAtt("listitem"); + if ($list_len == "") { $list_len = 3; } - if($ismake==0) - { - $this->dtp->Assign($tagid,$this->GetPageListDM($list_len,$listitem)); - } - else - { - $this->dtp->Assign($tagid,$this->GetPageListST($list_len,$listitem)); + if ($ismake == 0) { + $this->dtp->Assign($tagid, $this->GetPageListDM($list_len, $listitem)); + } else { + $this->dtp->Assign($tagid, $this->GetPageListST($list_len, $listitem)); } - } - else if($PageNo!=1 && $ctag->GetName()=='field' && $ctag->GetAtt('display')!='') - { - $this->dtp->Assign($tagid,''); + } else if ($PageNo != 1 && $ctag->GetName() == 'field' && $ctag->GetAtt('display') != '') { + $this->dtp->Assign($tagid, ''); } } } @@ -643,17 +550,14 @@ class ListView * @param string $namerule2 栏目规则 * @return string */ - function GetMakeFileRule($typeid,$wname,$typedir,$defaultname,$namerule2) + function GetMakeFileRule($typeid, $wname, $typedir, $defaultname, $namerule2) { $typedir = MfTypedir($typedir); - if($wname=='index') - { - return $typedir.'/'.$defaultname; - } - else - { - $namerule2 = str_replace('{tid}',$typeid,$namerule2); - $namerule2 = str_replace('{typedir}',$typedir,$namerule2); + if ($wname == 'index') { + return $typedir . '/' . $defaultname; + } else { + $namerule2 = str_replace('{tid}', $typeid, $namerule2); + $namerule2 = str_replace('{typedir}', $typedir, $namerule2); return $namerule2; } } @@ -677,92 +581,91 @@ class ListView * @param string $orderWay 排序方式 * @return string */ - function GetArcList($limitstart=0,$row=10,$col=1,$titlelen=30,$infolen=250, - $imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$innertext="",$tablewidth="100",$ismake=1,$orderWay='desc') - { - global $cfg_list_son,$cfg_digg_update; - - $typeid=$this->TypeID; - - if($row=='') $row = 10; - if($limitstart=='') $limitstart = 0; - if($titlelen=='') $titlelen = 100; - if($infolen=='') $infolen = 250; - if($imgwidth=='') $imgwidth = 120; - if($imgheight=='') $imgheight = 120; - if($listtype=='') $listtype = 'all'; - if($orderWay=='') $orderWay = 'desc'; - - if($orderby=='') { - $orderby='default'; - } - else { - $orderby=strtolower($orderby); + function GetArcList( + $limitstart = 0, + $row = 10, + $col = 1, + $titlelen = 30, + $infolen = 250, + $imgwidth = 120, + $imgheight = 90, + $listtype = "all", + $orderby = "default", + $innertext = "", + $tablewidth = "100", + $ismake = 1, + $orderWay = 'desc' + ) { + global $cfg_list_son, $cfg_digg_update; + + $typeid = $this->TypeID; + + if ($row == '') $row = 10; + if ($limitstart == '') $limitstart = 0; + if ($titlelen == '') $titlelen = 100; + if ($infolen == '') $infolen = 250; + if ($imgwidth == '') $imgwidth = 120; + if ($imgheight == '') $imgheight = 120; + if ($listtype == '') $listtype = 'all'; + if ($orderWay == '') $orderWay = 'desc'; + + if ($orderby == '') { + $orderby = 'default'; + } else { + $orderby = strtolower($orderby); } - - $tablewidth = str_replace('%','',$tablewidth); - if($tablewidth=='') $tablewidth=100; - if($col=='') $col=1; - $colWidth = ceil(100/$col); - $tablewidth = $tablewidth.'%'; - $colWidth = $colWidth.'%'; - + + $tablewidth = str_replace('%', '', $tablewidth); + if ($tablewidth == '') $tablewidth = 100; + if ($col == '') $col = 1; + $colWidth = ceil(100 / $col); + $tablewidth = $tablewidth . '%'; + $colWidth = $colWidth . '%'; + $innertext = trim($innertext); - if($innertext=='') { + if ($innertext == '') { $innertext = GetSysTemplets('list_fulllist.htm'); } //排序方式 $ordersql = ''; - if($orderby=="senddate" || $orderby=="id") { - $ordersql=" ORDER BY arc.id $orderWay"; - } - else if($orderby=="hot" || $orderby=="click") { + if ($orderby == "senddate" || $orderby == "id") { + $ordersql = " ORDER BY arc.id $orderWay"; + } else if ($orderby == "hot" || $orderby == "click") { $ordersql = " ORDER BY arc.click $orderWay"; - } - else if($orderby=="lastpost") { + } else if ($orderby == "lastpost") { $ordersql = " ORDER BY arc.lastpost $orderWay"; - } - else { - $ordersql=" ORDER BY arc.sortrank $orderWay"; + } else { + $ordersql = " ORDER BY arc.sortrank $orderWay"; } //获得附加表的相关信息 $addtable = $this->ChannelUnit->ChannelInfos['addtable']; - if($addtable!="") - { - $addJoin = " LEFT JOIN `$addtable` ON arc.id = ".$addtable.'.aid '; + if ($addtable != "") { + $addJoin = " LEFT JOIN `$addtable` ON arc.id = " . $addtable . '.aid '; $addField = ''; - $fields = explode(',',$this->ChannelUnit->ChannelInfos['listfields']); - foreach($fields as $k=>$v) - { + $fields = explode(',', $this->ChannelUnit->ChannelInfos['listfields']); + foreach ($fields as $k => $v) { $nfields[$v] = $k; } - if(is_array($this->ChannelUnit->ChannelFields) && !empty($this->ChannelUnit->ChannelFields)) - { - foreach($this->ChannelUnit->ChannelFields as $k=>$arr) - { - if(isset($nfields[$k])) - { - if(!empty($arr['rename'])) { - $addField .= ','.$addtable.'.'.$k.' as '.$arr['rename']; - } - else { - $addField .= ','.$addtable.'.'.$k; + if (is_array($this->ChannelUnit->ChannelFields) && !empty($this->ChannelUnit->ChannelFields)) { + foreach ($this->ChannelUnit->ChannelFields as $k => $arr) { + if (isset($nfields[$k])) { + if (!empty($arr['rename'])) { + $addField .= ',' . $addtable . '.' . $k . ' as ' . $arr['rename']; + } else { + $addField .= ',' . $addtable . '.' . $k; } } } } - } - else - { + } else { $addField = ''; $addJoin = ''; } //如果不用默认的sortrank或id排序,使用联合查询(数据量大时非常缓慢) - if(preg_match('/hot|click|lastpost/', $orderby)) - { + if (preg_match('/hot|click|lastpost/', $orderby)) { $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,tp.defaultname, tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath $addField @@ -772,24 +675,19 @@ class ListView WHERE {$this->addSql} $ordersql LIMIT $limitstart,$row"; } //普通情况先从arctiny表查出ID,然后按ID查询(速度非常快) - else - { + else { $t1 = ExecTime(); $ids = array(); $query = "SELECT id FROM `#@__arctiny` arc WHERE {$this->addSql} $ordersql LIMIT $limitstart,$row "; $this->dsql->SetQuery($query); $this->dsql->Execute(); - while($arr=$this->dsql->GetArray()) - { + while ($arr = $this->dsql->GetArray()) { $ids[] = $arr['id']; } - $idstr = join(',',$ids); - if($idstr=='') - { + $idstr = join(',', $ids); + if ($idstr == '') { return ''; - } - else - { + } else { $query = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname, tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath $addField @@ -809,104 +707,105 @@ class ListView $artlist = ''; $this->dtp2->LoadSource($innertext); $GLOBALS['autoindex'] = 0; - for($i=0;$i<$row;$i++) - { - if($col>1) - { + for ($i = 0; $i < $row; $i++) { + if ($col > 1) { $artlist .= "
    \r\n"; } - for($j=0;$j<$col;$j++) - { - if($row = $this->dsql->GetArray("al")) - { + for ($j = 0; $j < $col; $j++) { + if ($row = $this->dsql->GetArray("al")) { $GLOBALS['autoindex']++; $ids[$row['id']] = $row['id']; //处理一些特殊字段 - $row['infos'] = cn_substr($row['description'],$infolen); + $row['infos'] = cn_substr($row['description'], $infolen); $row['id'] = $row['id']; - if($row['corank'] > 0 && $row['arcrank']==0) - { + if ($row['corank'] > 0 && $row['arcrank'] == 0) { $row['arcrank'] = $row['corank']; } - $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'], - $row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']); - $row['typeurl'] = GetTypeUrl($row['typeid'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'], - $row['ispart'],$row['namerule2'],$row['moresite'],$row['siteurl'],$row['sitepath']); - if($row['litpic'] == '-' || $row['litpic'] == '') - { - $row['litpic'] = $GLOBALS['cfg_cmspath'].'/static/defaultpic.jpg'; + $row['filename'] = $row['arcurl'] = GetFileUrl( + $row['id'], + $row['typeid'], + $row['senddate'], + $row['title'], + $row['ismake'], + $row['arcrank'], + $row['namerule'], + $row['typedir'], + $row['money'], + $row['filename'], + $row['moresite'], + $row['siteurl'], + $row['sitepath'] + ); + $row['typeurl'] = GetTypeUrl( + $row['typeid'], + MfTypedir($row['typedir']), + $row['isdefault'], + $row['defaultname'], + $row['ispart'], + $row['namerule2'], + $row['moresite'], + $row['siteurl'], + $row['sitepath'] + ); + if ($row['litpic'] == '-' || $row['litpic'] == '') { + $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/static/defaultpic.jpg'; } - if(!preg_match("/^http:\/\//i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') - { - $row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic']; + if (!preg_match("/^http:\/\//i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { + $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic']; } $row['picname'] = $row['litpic']; $row['stime'] = GetDateMK($row['pubdate']); - $row['typelink'] = "".$row['typename'].""; - $row['image'] = "".preg_replace("/[<]/", "", $row['title'])."'>"; - $row['imglink'] = "".$row['image'].""; + $row['typelink'] = "" . $row['typename'] . ""; + $row['image'] = "" . preg_replace("/[<]/", "", $row['title']) . "'>"; + $row['imglink'] = "" . $row['image'] . ""; $row['fulltitle'] = $row['title']; - $row['title'] = cn_substr($row['title'],$titlelen); - if($row['color']!='') - { - $row['title'] = "".$row['title'].""; + $row['title'] = cn_substr($row['title'], $titlelen); + if ($row['color'] != '') { + $row['title'] = "" . $row['title'] . ""; } - if(preg_match('/c/', $row['flag'])) - { - $row['title'] = "".$row['title'].""; + if (preg_match('/c/', $row['flag'])) { + $row['title'] = "" . $row['title'] . ""; } - $row['textlink'] = "".$row['title'].""; + $row['textlink'] = "" . $row['title'] . ""; $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl']; $row['memberurl'] = $GLOBALS['cfg_memberurl']; $row['templeturl'] = $GLOBALS['cfg_templeturl']; //编译附加表里的数据 - foreach($row as $k=>$v) - { + foreach ($row as $k => $v) { $row[strtolower($k)] = $v; } - foreach($this->ChannelUnit->ChannelFields as $k=>$arr) - { - if(isset($row[$k])) - { - $row[$k] = $this->ChannelUnit->MakeField($k,$row[$k]); + foreach ($this->ChannelUnit->ChannelFields as $k => $arr) { + if (isset($row[$k])) { + $row[$k] = $this->ChannelUnit->MakeField($k, $row[$k]); } } - if(is_array($this->dtp2->CTags)) - { - foreach($this->dtp2->CTags as $k=>$ctag) - { - if($ctag->GetName()=='array') - { + if (is_array($this->dtp2->CTags)) { + foreach ($this->dtp2->CTags as $k => $ctag) { + if ($ctag->GetName() == 'array') { //传递整个数组,在runphp模式中有特殊作用 - $this->dtp2->Assign($k,$row); - } - else - { - if(isset($row[$ctag->GetName()])) - { - $this->dtp2->Assign($k,$row[$ctag->GetName()]); - } - else - { - $this->dtp2->Assign($k,''); + $this->dtp2->Assign($k, $row); + } else { + if (isset($row[$ctag->GetName()])) { + $this->dtp2->Assign($k, $row[$ctag->GetName()]); + } else { + $this->dtp2->Assign($k, ''); } } } } $artlist .= $this->dtp2->GetResult(); - }//if hasRow + } //if hasRow - }//Loop Col + } //Loop Col - if($col>1) - { + if ($col > 1) { $i += $col - 1; $artlist .= "
    \r\n"; } - }//Loop Line + } //Loop Line $t3 = ExecTime(); @@ -923,112 +822,90 @@ class ListView * @param string $list_len 列表样式 * @return string */ - function GetPageListST($list_len,$listitem="index,end,pre,next,pageno") + function GetPageListST($list_len, $listitem = "index,end,pre,next,pageno") { $prepage = $nextpage = ''; - $prepagenum = $this->PageNo-1; - $nextpagenum = $this->PageNo+1; - if($list_len=='' || preg_match("/[^0-9]/", $list_len)) - { - $list_len=3; + $prepagenum = $this->PageNo - 1; + $nextpagenum = $this->PageNo + 1; + if ($list_len == '' || preg_match("/[^0-9]/", $list_len)) { + $list_len = 3; } - $totalpage = ceil($this->TotalResult/$this->PageSize); - if($totalpage<=1 && $this->TotalResult>0) - { + $totalpage = ceil($this->TotalResult / $this->PageSize); + if ($totalpage <= 1 && $this->TotalResult > 0) { - return "
  • 1".$this->TotalResult."条记录
  • \r\n"; + return "
  • 1" . $this->TotalResult . "条记录
  • \r\n"; } - if($this->TotalResult == 0) - { - return "
  • 0".$this->TotalResult."条记录
  • \r\n"; + if ($this->TotalResult == 0) { + return "
  • 0" . $this->TotalResult . "条记录
  • \r\n"; } $purl = $this->GetCurUrl(); - $maininfo = "
  • {$totalpage}".$this->TotalResult."
  • \r\n"; - $tnamerule = $this->GetMakeFileRule($this->Fields['id'],"list",$this->Fields['typedir'],$this->Fields['defaultname'],$this->Fields['namerule2']); + $maininfo = "
  • {$totalpage}" . $this->TotalResult . "
  • \r\n"; + $tnamerule = $this->GetMakeFileRule($this->Fields['id'], "list", $this->Fields['typedir'], $this->Fields['defaultname'], $this->Fields['namerule2']); //获得上一页和主页的链接 - if($this->PageNo != 1) - { - $prepage.="
  • 上一页
  • \r\n"; - $indexpage="
  • 首页
  • \r\n"; - } - else - { - $indexpage="
  • 首页
  • \r\n"; + if ($this->PageNo != 1) { + $prepage .= "
  • 上一页
  • \r\n"; + $indexpage = "
  • 首页
  • \r\n"; + } else { + $indexpage = "
  • 首页
  • \r\n"; } //下一页,未页的链接 - if($this->PageNo!=$totalpage && $totalpage>1) - { - $nextpage.="
  • 下一页
  • \r\n"; - $endpage="
  • 末页
  • \r\n"; - } - else - { - $endpage="
  • 末页
  • \r\n"; + if ($this->PageNo != $totalpage && $totalpage > 1) { + $nextpage .= "
  • 下一页
  • \r\n"; + $endpage = "
  • 末页
  • \r\n"; + } else { + $endpage = "
  • 末页
  • \r\n"; } //option链接 $optionlist = ''; $optionlen = strlen($totalpage); - $optionlen = $optionlen*12 + 18; - if($optionlen < 36) $optionlen = 36; - if($optionlen > 100) $optionlen = 100; + $optionlen = $optionlen * 12 + 18; + if ($optionlen < 36) $optionlen = 36; + if ($optionlen > 100) $optionlen = 100; $optionlist = "
  • \r\n"; //获得数字链接 - $listdd=""; + $listdd = ""; $total_list = $list_len * 2 + 1; - if($this->PageNo >= $total_list) - { - $j = $this->PageNo-$list_len; - $total_list = $this->PageNo+$list_len; - if($total_list>$totalpage) - { - $total_list=$totalpage; + if ($this->PageNo >= $total_list) { + $j = $this->PageNo - $list_len; + $total_list = $this->PageNo + $list_len; + if ($total_list > $totalpage) { + $total_list = $totalpage; } - } - else - { - $j=1; - if($total_list>$totalpage) - { - $total_list=$totalpage; + } else { + $j = 1; + if ($total_list > $totalpage) { + $total_list = $totalpage; } } - for($j;$j<=$total_list;$j++) - { - if($j==$this->PageNo) - { - $listdd.= "
  • $j
  • \r\n"; - } - else - { - $listdd.="
  • ".$j."
  • \r\n"; + for ($j; $j <= $total_list; $j++) { + if ($j == $this->PageNo) { + $listdd .= "
  • $j
  • \r\n"; + } else { + $listdd .= "
  • " . $j . "
  • \r\n"; } } $plist = ''; - if(preg_match('/index/i', $listitem)) $plist .= $indexpage; - if(preg_match('/pre/i', $listitem)) $plist .= $prepage; - if(preg_match('/pageno/i', $listitem)) $plist .= $listdd; - if(preg_match('/next/i', $listitem)) $plist .= $nextpage; - if(preg_match('/end/i', $listitem)) $plist .= $endpage; - if(preg_match('/option/i', $listitem)) $plist .= $optionlist; - if(preg_match('/info/i', $listitem)) $plist .= $maininfo; - + if (preg_match('/index/i', $listitem)) $plist .= $indexpage; + if (preg_match('/pre/i', $listitem)) $plist .= $prepage; + if (preg_match('/pageno/i', $listitem)) $plist .= $listdd; + if (preg_match('/next/i', $listitem)) $plist .= $nextpage; + if (preg_match('/end/i', $listitem)) $plist .= $endpage; + if (preg_match('/option/i', $listitem)) $plist .= $optionlist; + if (preg_match('/info/i', $listitem)) $plist .= $maininfo; + return $plist; } @@ -1040,110 +917,90 @@ class ListView * @param string $list_len 列表样式 * @return string */ - function GetPageListDM($list_len,$listitem="index,end,pre,next,pageno") + function GetPageListDM($list_len, $listitem = "index,end,pre,next,pageno") { global $cfg_rewrite; $prepage = $nextpage = ''; - $prepagenum = $this->PageNo-1; - $nextpagenum = $this->PageNo+1; - if($list_len=='' || preg_match("/[^0-9]/", $list_len)) - { - $list_len=3; + $prepagenum = $this->PageNo - 1; + $nextpagenum = $this->PageNo + 1; + if ($list_len == '' || preg_match("/[^0-9]/", $list_len)) { + $list_len = 3; } - $totalpage = ceil($this->TotalResult/$this->PageSize); - if($totalpage<=1 && $this->TotalResult>0) - { - return "
  • 共 1 页/".$this->TotalResult." 条记录
  • \r\n"; + $totalpage = ceil($this->TotalResult / $this->PageSize); + if ($totalpage <= 1 && $this->TotalResult > 0) { + return "
  • 共 1 页/" . $this->TotalResult . " 条记录
  • \r\n"; } - if($this->TotalResult == 0) - { - return "
  • 共 0 页/".$this->TotalResult." 条记录
  • \r\n"; + if ($this->TotalResult == 0) { + return "
  • 共 0 页/" . $this->TotalResult . " 条记录
  • \r\n"; } - $maininfo = "
  • {$totalpage}".$this->TotalResult."
  • \r\n"; - + $maininfo = "
  • {$totalpage}" . $this->TotalResult . "
  • \r\n"; + $purl = $this->GetCurUrl(); // 如果开启为静态,则对规则进行替换 - if($cfg_rewrite == 'Y') - { + if ($cfg_rewrite == 'Y') { $nowurls = preg_replace("/\-/", ".php?", $purl); $nowurls = explode("?", $nowurls); $purl = $nowurls[0]; } - $geturl = "tid=".$this->TypeID."&TotalResult=".$this->TotalResult."&"; - $purl .= '?'.$geturl; - + $geturl = "tid=" . $this->TypeID . "&TotalResult=" . $this->TotalResult . "&"; + $purl .= '?' . $geturl; + $optionlist = ''; //$hidenform = "\r\n"; //$hidenform .= "\r\n"; //获得上一页和下一页的链接 - if($this->PageNo != 1) - { - $prepage.="
  • 上一页
  • \r\n"; - $indexpage="
  • 首页
  • \r\n"; - } - else - { - $indexpage="
  • 首页
  • \r\n"; - } - if($this->PageNo!=$totalpage && $totalpage>1) - { - $nextpage.="
  • 下一页
  • \r\n"; - $endpage="
  • 末页
  • \r\n"; - } - else - { - $endpage="
  • 末页
  • \r\n"; + if ($this->PageNo != 1) { + $prepage .= "
  • 上一页
  • \r\n"; + $indexpage = "
  • 首页
  • \r\n"; + } else { + $indexpage = "
  • 首页
  • \r\n"; + } + if ($this->PageNo != $totalpage && $totalpage > 1) { + $nextpage .= "
  • 下一页
  • \r\n"; + $endpage = "
  • 末页
  • \r\n"; + } else { + $endpage = "
  • 末页
  • \r\n"; } //获得数字链接 - $listdd=""; + $listdd = ""; $total_list = $list_len * 2 + 1; - if($this->PageNo >= $total_list) - { - $j = $this->PageNo-$list_len; - $total_list = $this->PageNo+$list_len; - if($total_list>$totalpage) - { - $total_list=$totalpage; + if ($this->PageNo >= $total_list) { + $j = $this->PageNo - $list_len; + $total_list = $this->PageNo + $list_len; + if ($total_list > $totalpage) { + $total_list = $totalpage; } - } - else - { - $j=1; - if($total_list>$totalpage) - { - $total_list=$totalpage; + } else { + $j = 1; + if ($total_list > $totalpage) { + $total_list = $totalpage; } } - for($j;$j<=$total_list;$j++) - { - if($j==$this->PageNo) - { - $listdd.= "
  • $j
  • \r\n"; - } - else - { - $listdd.="
  • ".$j."
  • \r\n"; + for ($j; $j <= $total_list; $j++) { + if ($j == $this->PageNo) { + $listdd .= "
  • $j
  • \r\n"; + } else { + $listdd .= "
  • " . $j . "
  • \r\n"; } } $plist = ''; - if(preg_match('/index/i', $listitem)) $plist .= $indexpage; - if(preg_match('/pre/i', $listitem)) $plist .= $prepage; - if(preg_match('/pageno/i', $listitem)) $plist .= $listdd; - if(preg_match('/next/i', $listitem)) $plist .= $nextpage; - if(preg_match('/end/i', $listitem)) $plist .= $endpage; - if(preg_match('/option/i', $listitem)) $plist .= $optionlist; - if(preg_match('/info/i', $listitem)) $plist .= $maininfo; - - if($cfg_rewrite == 'Y') - { + if (preg_match('/index/i', $listitem)) $plist .= $indexpage; + if (preg_match('/pre/i', $listitem)) $plist .= $prepage; + if (preg_match('/pageno/i', $listitem)) $plist .= $listdd; + if (preg_match('/next/i', $listitem)) $plist .= $nextpage; + if (preg_match('/end/i', $listitem)) $plist .= $endpage; + if (preg_match('/option/i', $listitem)) $plist .= $optionlist; + if (preg_match('/info/i', $listitem)) $plist .= $maininfo; + + if ($cfg_rewrite == 'Y') { $plist = str_replace('.php?tid=', '-', $plist); $plist = str_replace('&TotalResult=', '-', $plist); - $plist = preg_replace("/&PageNo=(\d+)/i",'-\\1.html',$plist); + $plist = preg_replace("/&PageNo=(\d+)/i", '-\\1.html', $plist); } return $plist; } @@ -1156,14 +1013,11 @@ class ListView */ function GetCurUrl() { - if(!empty($_SERVER['REQUEST_URI'])) - { + if (!empty($_SERVER['REQUEST_URI'])) { $nowurl = $_SERVER['REQUEST_URI']; $nowurls = explode('?', $nowurl); $nowurl = $nowurls[0]; - } - else - { + } else { $nowurl = $_SERVER['PHP_SELF']; } return $nowurl; diff --git a/src/include/arc.memberlistview.class.php b/src/include/arc.memberlistview.class.php index 93ec2634..32c9e924 100755 --- a/src/include/arc.memberlistview.class.php +++ b/src/include/arc.memberlistview.class.php @@ -1,15 +1,15 @@ -sourceSql = ''; $this->pageSize = 25; $this->queryTime = 0; - $this->getValues = Array(); + $this->getValues = array(); $this->randts = time(); $this->dsql = $GLOBALS['dsql']; - $this->SetVar('ParseEnv','datalist'); + $this->SetVar('ParseEnv', 'datalist'); $this->tpl = new DedeTemplate(); - if($GLOBALS['cfg_tplcache']=='N') - { + if ($GLOBALS['cfg_tplcache'] == 'N') { $this->tpl->isCache = false; } - if($tplfile!='') - { + if ($tplfile != '') { $this->tpl->LoadTemplate($tplfile); } } //兼容PHP4 - function MemberListview($tplfile='') + function MemberListview($tplfile = '') { $this->__construct($tplfile); } @@ -116,37 +114,31 @@ class MemberListview */ function PreLoad() { - global $totalresult,$pageno; - if(empty($pageno) || preg_match("/[^0-9]/", $pageno)) - { + global $totalresult, $pageno; + if (empty($pageno) || preg_match("/[^0-9]/", $pageno)) { $pageno = 1; } - if(empty($totalresult) || preg_match("/[^0-9]/", $totalresult)) - { + if (empty($totalresult) || preg_match("/[^0-9]/", $totalresult)) { $totalresult = 0; } $this->pageNO = $pageno; $this->totalResult = $totalresult; - if(isset($this->tpl->tpCfgs['pagesize'])) - { + if (isset($this->tpl->tpCfgs['pagesize'])) { $this->pageSize = $this->tpl->tpCfgs['pagesize']; } - $this->totalPage = ceil($this->totalResult/$this->pageSize); - if($this->totalResult==0) - { + $this->totalPage = ceil($this->totalResult / $this->pageSize); + if ($this->totalResult == 0) { //$this->isQuery = true; //$this->dsql->Execute('mbdl',$this->sourceSql); //$this->totalResult = $this->dsql->GetTotalRow('mbdl'); - $countQuery = preg_replace("/select[ \r\n\t](.*)[ \r\n\t]from/i","Select count(*) as dd From",$this->sourceSql); + $countQuery = preg_replace("/select[ \r\n\t](.*)[ \r\n\t]from/i", "Select count(*) as dd From", $this->sourceSql); $row = $this->dsql->GetOne($countQuery); $row['dd'] = empty($row['dd']) ? 0 : $row['dd']; $this->totalResult = $row['dd']; - $this->sourceSql .= " limit 0,".$this->pageSize; - } - else - { - $this->sourceSql .= " limit ".(($this->pageNO-1) * $this->pageSize).",".$this->pageSize; + $this->sourceSql .= " limit 0," . $this->pageSize; + } else { + $this->sourceSql .= " limit " . (($this->pageNO - 1) * $this->pageSize) . "," . $this->pageSize; } } @@ -174,7 +166,7 @@ class MemberListview function SetVar($k, $v) { global $_vars; - if(!isset($_vars[$k])) $_vars[$k] = $v; + if (!isset($_vars[$k])) $_vars[$k] = $v; } /** @@ -186,7 +178,7 @@ class MemberListview function GetVar($k) { global $_vars; - if(isset($_vars[$k])) return $_vars[$k]; + if (isset($_vars[$k])) return $_vars[$k]; else return ''; } @@ -199,67 +191,82 @@ class MemberListview * @param string $fields 字段 * @return array */ - function GetArcList($atts,$refObj='',$fields=array()) + function GetArcList($atts, $refObj = '', $fields = array()) { $attlist = "titlelen=30,infolen=200,imgwidth=120,imgheight=90"; - FillAtts($atts,$attlist); - FillFields($atts,$fields,$refObj); + FillAtts($atts, $attlist); + FillFields($atts, $fields, $refObj); extract($atts, EXTR_OVERWRITE); $rsArray = array(); //global $_vars; //$t1 = Exectime(); - if(!$this->isQuery) - { - $this->dsql->Execute('mbdl',$this->sourceSql); + if (!$this->isQuery) { + $this->dsql->Execute('mbdl', $this->sourceSql); } $i = 0; - while($row = $this->dsql->GetArray('mbdl')) - { + while ($row = $this->dsql->GetArray('mbdl')) { $i++; - if(!isset($row['description'])) $row['description'] = ''; - if(!isset($row['color'])) $row['color'] = ''; - if(!isset($row['pubdate'])) $row['pubdate'] = $row['senddate']; + if (!isset($row['description'])) $row['description'] = ''; + if (!isset($row['color'])) $row['color'] = ''; + if (!isset($row['pubdate'])) $row['pubdate'] = $row['senddate']; //处理一些特殊字段 - $row['infos'] = cn_substr($row['description'],$infolen); + $row['infos'] = cn_substr($row['description'], $infolen); $row['id'] = $row['id']; - $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'], - $row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']); - $row['typeurl'] = GetTypeUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'],$row['ispart'], - $row['namerule2'],$row['moresite'],$row['siteurl'],$row['sitepath']); - if($row['litpic'] == '-' || $row['litpic'] == '') - { - $row['litpic'] = $GLOBALS['cfg_cmspath'].'/static/defaultpic.gif'; + $row['filename'] = $row['arcurl'] = GetFileUrl( + $row['id'], + $row['typeid'], + $row['senddate'], + $row['title'], + $row['ismake'], + $row['arcrank'], + $row['namerule'], + $row['typedir'], + $row['money'], + $row['filename'], + $row['moresite'], + $row['siteurl'], + $row['sitepath'] + ); + $row['typeurl'] = GetTypeUrl( + $row['typeid'], + $row['typedir'], + $row['isdefault'], + $row['defaultname'], + $row['ispart'], + $row['namerule2'], + $row['moresite'], + $row['siteurl'], + $row['sitepath'] + ); + if ($row['litpic'] == '-' || $row['litpic'] == '') { + $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/static/defaultpic.gif'; } - if(!preg_match("/^http:\/\//i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') - { - $row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic']; + if (!preg_match("/^http:\/\//i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { + $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic']; } $row['picname'] = $row['litpic']; $row['stime'] = GetDateMK($row['pubdate']); - $row['typelink'] = "".$row['typename'].""; - $row['image'] = "".preg_replace("/[<]/", "", $row['title'])."'>"; - $row['imglink'] = "".$row['image'].""; + $row['typelink'] = "" . $row['typename'] . ""; + $row['image'] = "" . preg_replace("/[<]/", "", $row['title']) . "'>"; + $row['imglink'] = "" . $row['image'] . ""; $row['fulltitle'] = $row['title']; - $row['title'] = cn_substr($row['title'],$titlelen); - if($row['color']!='') - { - $row['title'] = "".$row['title'].""; + $row['title'] = cn_substr($row['title'], $titlelen); + if ($row['color'] != '') { + $row['title'] = "" . $row['title'] . ""; } - if(preg_match('/b/', $row['flag'])) - { - $row['title'] = "".$row['title'].""; + if (preg_match('/b/', $row['flag'])) { + $row['title'] = "" . $row['title'] . ""; } //$row['title'] = "".$row['title'].""; - $row['textlink'] = "".$row['title'].""; + $row['textlink'] = "" . $row['title'] . ""; $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl']; $row['memberurl'] = $GLOBALS['cfg_memberurl']; $row['templeturl'] = $GLOBALS['cfg_templeturl']; $rsArray[$i] = $row; - if($i >= $this->pageSize) - { + if ($i >= $this->pageSize) { break; } } @@ -278,132 +285,103 @@ class MemberListview * @param string $fields 字段 * @return string */ - function GetPageList($atts,$refObj='',$fields=array()) + function GetPageList($atts, $refObj = '', $fields = array()) { - global $lang_pre_page,$lang_next_page,$lang_index_page,$lang_end_page,$lang_record_number,$lang_page,$lang_total; - $prepage = $nextpage = $geturl= $hidenform = ''; + global $lang_pre_page, $lang_next_page, $lang_index_page, $lang_end_page, $lang_record_number, $lang_page, $lang_total; + $prepage = $nextpage = $geturl = $hidenform = ''; $purl = $this->GetCurUrl(); - $prepagenum = $this->pageNO-1; - $nextpagenum = $this->pageNO+1; - if(!isset($atts['listsize']) || preg_match("/[^0-9]/", $atts['listsize'])) - { + $prepagenum = $this->pageNO - 1; + $nextpagenum = $this->pageNO + 1; + if (!isset($atts['listsize']) || preg_match("/[^0-9]/", $atts['listsize'])) { $atts['listsize'] = 5; } - if(!isset($atts['listitem'])) - { + if (!isset($atts['listitem'])) { $atts['listitem'] = "info,index,end,pre,next,pageno"; } - $totalpage = ceil($this->totalResult/$this->pageSize); + $totalpage = ceil($this->totalResult / $this->pageSize); //echo " {$totalpage}=={$this->totalResult}=={$this->pageSize}"; //无结果或只有一页的情况 - if($totalpage<=1 && $this->totalResult > 0) - { - return "{$lang_total} 1 {$lang_page}/".$this->totalResult.$lang_record_number; + if ($totalpage <= 1 && $this->totalResult > 0) { + return "{$lang_total} 1 {$lang_page}/" . $this->totalResult . $lang_record_number; } - if($this->totalResult == 0) - { - return "{$lang_total} 0 {$lang_page}/".$this->totalResult.$lang_record_number; + if ($this->totalResult == 0) { + return "{$lang_total} 0 {$lang_page}/" . $this->totalResult . $lang_record_number; } $infos = "{$lang_total} {$totalpage} {$lang_page}/{$this->totalResult}{$lang_record_number} "; - if($this->totalResult!=0) - { + if ($this->totalResult != 0) { $this->getValues['totalresult'] = $this->totalResult; } - if(count($this->getValues)>0) - { - foreach($this->getValues as $key=>$value) - { + if (count($this->getValues) > 0) { + foreach ($this->getValues as $key => $value) { $value = urlencode($value); - $geturl.="$key=$value"."&"; - $hidenform.="\r\n"; + $geturl .= "$key=$value" . "&"; + $hidenform .= "\r\n"; } } - $purl .= "?".$geturl; + $purl .= "?" . $geturl; //获得上一页和下一页的链接 - if($this->pageNO!=1) - { - $prepage.="$lang_pre_page \r\n"; - $indexpage="$lang_index_page \r\n"; - } - else - { - $indexpage="$lang_index_page \r\n"; + if ($this->pageNO != 1) { + $prepage .= "$lang_pre_page \r\n"; + $indexpage = "$lang_index_page \r\n"; + } else { + $indexpage = "$lang_index_page \r\n"; } - if($this->pageNO!=$totalpage&&$totalpage>1) - { - $nextpage.="$lang_next_page \r\n"; - $endpage="$lang_end_page \r\n"; - } - else - { - $endpage=" $lang_end_page \r\n"; + if ($this->pageNO != $totalpage && $totalpage > 1) { + $nextpage .= "$lang_next_page \r\n"; + $endpage = "$lang_end_page \r\n"; + } else { + $endpage = " $lang_end_page \r\n"; } //获得数字链接 - $listdd=""; + $listdd = ""; $total_list = $atts['listsize'] * 2 + 1; - if($this->pageNO>=$total_list) - { - $j=$this->pageNO-$atts['listsize']; - $total_list=$this->pageNO+$atts['listsize']; - if($total_list>$totalpage) - { - $total_list=$totalpage; + if ($this->pageNO >= $total_list) { + $j = $this->pageNO - $atts['listsize']; + $total_list = $this->pageNO + $atts['listsize']; + if ($total_list > $totalpage) { + $total_list = $totalpage; } + } else { + $j = 1; + if ($total_list > $totalpage) $total_list = $totalpage; } - else - { - $j=1; - if($total_list>$totalpage) $total_list=$totalpage; - } - for($j;$j<=$total_list;$j++) - { - if($j==$this->pageNO) - { - $listdd.= "$j \r\n"; - } - else - { - $listdd.="".$j." \r\n"; + for ($j; $j <= $total_list; $j++) { + if ($j == $this->pageNO) { + $listdd .= "$j \r\n"; + } else { + $listdd .= "" . $j . " \r\n"; } } $plist = "
    \r\n"; //info,index,end,pre,next,pageno,form - if(preg_match("/info/i",$atts['listitem'])) - { + if (preg_match("/info/i", $atts['listitem'])) { $plist .= $infos; } - if(preg_match("/index/i",$atts['listitem'])) - { + if (preg_match("/index/i", $atts['listitem'])) { $plist .= $indexpage; } - if(preg_match("/pre/i",$atts['listitem'])) - { + if (preg_match("/pre/i", $atts['listitem'])) { $plist .= $prepage; } - if(preg_match("/pageno/i",$atts['listitem'])) - { + if (preg_match("/pageno/i", $atts['listitem'])) { $plist .= $listdd; } - if(preg_match("/next/i",$atts['listitem'])) - { + if (preg_match("/next/i", $atts['listitem'])) { $plist .= $nextpage; } - if(preg_match("/end/i",$atts['listitem'])) - { + if (preg_match("/end/i", $atts['listitem'])) { $plist .= $endpage; } - if(preg_match("/form/i",$atts['listitem'])) - { - $plist .="
    $hidenform"; - if($totalpage>$total_list) - { - $plist.="\r\n"; - $plist.="\r\n"; + if (preg_match("/form/i", $atts['listitem'])) { + $plist .= " $hidenform"; + if ($totalpage > $total_list) { + $plist .= "\r\n"; + $plist .= "\r\n"; } $plist .= "
    \r\n"; } @@ -419,14 +397,11 @@ class MemberListview */ function GetCurUrl() { - if(!empty($_SERVER["REQUEST_URI"])) - { + if (!empty($_SERVER["REQUEST_URI"])) { $nowurl = $_SERVER["REQUEST_URI"]; - $nowurls = explode("?",$nowurl); + $nowurls = explode("?", $nowurl); $nowurl = $nowurls[0]; - } - else - { + } else { $nowurl = $_SERVER["PHP_SELF"]; } return $nowurl; @@ -445,8 +420,8 @@ class MemberListview */ function Display() { - - if($this->sourceSql != '') $this->PreLoad(); + + if ($this->sourceSql != '') $this->PreLoad(); //在PHP4中,对象引用必须放在display之前,放在其它位置中无效 $this->tpl->SetObject($this); diff --git a/src/include/arc.partview.class.php b/src/include/arc.partview.class.php index 32e4e000..53b15054 100755 --- a/src/include/arc.partview.class.php +++ b/src/include/arc.partview.class.php @@ -1,22 +1,22 @@ -TypeID = $typeid; $this->dsql = $GLOBALS['dsql']; $this->dtp = new DedeTagParse(); - $this->dtp->SetNameSpace("dede","{","}"); + $this->dtp->SetNameSpace("dede", "{", "}"); $this->dtp->SetRefObj($this); $this->ftp = &$ftp; $this->remoteDir = ''; - if($needtypelink) - { + if ($needtypelink) { $this->TypeLink = new TypeLink($typeid); - if(is_array($this->TypeLink->TypeInfos)) - { - foreach($this->TypeLink->TypeInfos as $k=>$v) - { - if(preg_match("/[^0-9]/", $k)) - { + if (is_array($this->TypeLink->TypeInfos)) { + foreach ($this->TypeLink->TypeInfos as $k => $v) { + if (preg_match("/[^0-9]/", $k)) { $this->Fields[$k] = $v; } } @@ -67,22 +63,21 @@ class PartView @$_sys_globals['typename'] = $this->Fields['typename']; //设置环境变量 - @SetSysEnv($this->TypeID,$this->Fields['typename'],0,'','partview'); + @SetSysEnv($this->TypeID, $this->Fields['typename'], 0, '', 'partview'); } - SetSysEnv($this->TypeID,'',0,'','partview'); + SetSysEnv($this->TypeID, '', 0, '', 'partview'); $this->Fields['typeid'] = $this->TypeID; //设置一些全局参数的值 - foreach($GLOBALS['PubFields'] as $k=>$v) - { + foreach ($GLOBALS['PubFields'] as $k => $v) { $this->Fields[$k] = $v; } } - + //php4构造函数 - function PartView($typeid=0,$needtypelink=TRUE) + function PartView($typeid = 0, $needtypelink = TRUE) { - $this->__construct($typeid,$needtypelink); + $this->__construct($typeid, $needtypelink); } /** @@ -95,8 +90,7 @@ class PartView function SetRefObj(&$refObj) { $this->dtp->SetRefObj($refObj); - if(isset($refObj->TypeID)) - { + if (isset($refObj->TypeID)) { $this->__construct($refObj->TypeID); } } @@ -111,12 +105,9 @@ class PartView function SetTypeLink(&$typelink) { $this->TypeLink = $typelink; - if(is_array($this->TypeLink->TypeInfos)) - { - foreach($this->TypeLink->TypeInfos as $k=>$v) - { - if(preg_match("/[^0-9]/", $k)) - { + if (is_array($this->TypeLink->TypeInfos)) { + foreach ($this->TypeLink->TypeInfos as $k => $v) { + if (preg_match("/[^0-9]/", $k)) { $this->Fields[$k] = $v; } } @@ -131,18 +122,14 @@ class PartView * @param string $stype 设置类型 * @return string */ - function SetTemplet($temp,$stype="file") + function SetTemplet($temp, $stype = "file") { - if($stype=="string") - { + if ($stype == "string") { $this->dtp->LoadSource($temp); - } - else - { + } else { $this->dtp->LoadTemplet($temp); } - if($this->TypeID > 0) - { + if ($this->TypeID > 0) { $this->Fields['position'] = $this->TypeLink->GetPositionLink(TRUE); $this->Fields['title'] = $this->TypeLink->GetPositionLink(false); } @@ -179,7 +166,7 @@ class PartView * @param string $isremote 是否远程 * @return string */ - function SaveToHtml($filename,$isremote=0) + function SaveToHtml($filename, $isremote = 0) { $this->dtp->SaveTo($filename); } @@ -193,23 +180,18 @@ class PartView function ParseTemplet() { $GLOBALS['envs']['typeid'] = $this->TypeID; - if($this->TypeID>0) - { + if ($this->TypeID > 0) { $GLOBALS['envs']['topid'] = GetTopid($this->TypeID); - } - else - { + } else { $GLOBALS['envs']['topid'] = 0; } - if(isset($this->TypeLink->TypeInfos['reid'])) - { + if (isset($this->TypeLink->TypeInfos['reid'])) { $GLOBALS['envs']['reid'] = $this->TypeLink->TypeInfos['reid']; } - if(isset($this->TypeLink->TypeInfos['channeltype'])) - { - $GLOBALS['envs']['channelid'] = $this->TypeLink->TypeInfos['channeltype']; + if (isset($this->TypeLink->TypeInfos['channeltype'])) { + $GLOBALS['envs']['channelid'] = $this->TypeLink->TypeInfos['channeltype']; } - MakeOneTag($this->dtp,$this); //这个函数放在 channelunit.func.php 文件中 + MakeOneTag($this->dtp, $this); //这个函数放在 channelunit.func.php 文件中 } /** @@ -241,35 +223,74 @@ class PartView * @param object $ctag * @return array */ - function GetArcList($templets='',$typeid=0,$row=10,$col=1,$titlelen=30,$infolen=160, - $imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$keyword="",$innertext="", - $tablewidth="100",$arcid=0,$idlist="",$channelid=0,$limit="",$att=0,$order='desc',$subday=0, - $autopartid=-1,$ismember=0,$maintable='',$ctag='') - { - if(empty($autopartid)) - { + function GetArcList( + $templets = '', + $typeid = 0, + $row = 10, + $col = 1, + $titlelen = 30, + $infolen = 160, + $imgwidth = 120, + $imgheight = 90, + $listtype = "all", + $orderby = "default", + $keyword = "", + $innertext = "", + $tablewidth = "100", + $arcid = 0, + $idlist = "", + $channelid = 0, + $limit = "", + $att = 0, + $order = 'desc', + $subday = 0, + $autopartid = -1, + $ismember = 0, + $maintable = '', + $ctag = '' + ) { + if (empty($autopartid)) { $autopartid = -1; } - if(empty($typeid)) - { - $typeid=$this->TypeID; + if (empty($typeid)) { + $typeid = $this->TypeID; } - if($autopartid!=-1) - { - $typeid = $this->GetAutoChannelID($autopartid,$typeid); - if($typeid==0) - { + if ($autopartid != -1) { + $typeid = $this->GetAutoChannelID($autopartid, $typeid); + if ($typeid == 0) { return ""; } } - if(!isset($GLOBALS['__SpGetArcList'])) - { - require_once(dirname(__FILE__)."/inc/inc_fun_SpGetArcList.php"); + if (!isset($GLOBALS['__SpGetArcList'])) { + require_once(dirname(__FILE__) . "/inc/inc_fun_SpGetArcList.php"); } - return SpGetArcList($this->dsql,$templets,$typeid,$row,$col,$titlelen,$infolen,$imgwidth,$imgheight, - $listtype,$orderby,$keyword,$innertext,$tablewidth,$arcid,$idlist,$channelid,$limit,$att, - $order,$subday,$ismember,$maintable,$ctag); + return SpGetArcList( + $this->dsql, + $templets, + $typeid, + $row, + $col, + $titlelen, + $infolen, + $imgwidth, + $imgheight, + $listtype, + $orderby, + $keyword, + $innertext, + $tablewidth, + $arcid, + $idlist, + $channelid, + $limit, + $att, + $order, + $subday, + $ismember, + $maintable, + $ctag + ); } //关闭所占用的资源 diff --git a/src/include/arc.rssview.class.php b/src/include/arc.rssview.class.php index 97449842..117f2262 100755 --- a/src/include/arc.rssview.class.php +++ b/src/include/arc.rssview.class.php @@ -1,24 +1,24 @@ -TypeID = $typeid; $this->dtp = new DedeTagParse(); $this->dtp->refObj = $this; - $templetfiles = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/plus/rss.htm"; + $templetfiles = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_templets_dir'] . "/plus/rss.htm"; $this->dtp->LoadTemplate($templetfiles); $this->dsql = $GLOBALS['dsql']; $this->TypeLink = new TypeLink($typeid); $this->TypeFields = $this->TypeLink->TypeInfos; $this->MaxRow = $max_row; $this->TypeFields['title'] = $this->TypeLink->GetPositionLink(false); - $this->TypeFields['title'] = preg_replace("/[<>]/"," / ",$this->TypeFields['title']); - $this->TypeFields['typelink'] = $GLOBALS['cfg_basehost'].$this->TypeLink->GetOneTypeUrl($this->TypeFields); + $this->TypeFields['title'] = preg_replace("/[<>]/", " / ", $this->TypeFields['title']); + $this->TypeFields['typelink'] = $GLOBALS['cfg_basehost'] . $this->TypeLink->GetOneTypeUrl($this->TypeFields); $this->TypeFields['powerby'] = $GLOBALS['cfg_powerby']; $this->TypeFields['adminemail'] = $GLOBALS['cfg_adminemail']; $this->ftp = &$ftp; $this->remoteDir = ''; - foreach($this->TypeFields as $k=>$v) - { + foreach ($this->TypeFields as $k => $v) { $this->TypeFields[$k] = dede_htmlspecialchars($v); } $this->ParseTemplet(); } //php4构造函数 - function RssView($typeid,$max_row=50) + function RssView($typeid, $max_row = 50) { - $this->__construct($typeid,$max_row); + $this->__construct($typeid, $max_row); } //关闭相关资源 @@ -95,10 +94,10 @@ class RssView * @param string $isremote 是否远程 * @return string */ - function MakeRss($isremote=0) + function MakeRss($isremote = 0) { - $murl = $GLOBALS['cfg_cmspath']."/data/rss/".$this->TypeID.".xml"; - $mfile = $GLOBALS['cfg_basedir'].$murl; + $murl = $GLOBALS['cfg_cmspath'] . "/data/rss/" . $this->TypeID . ".xml"; + $mfile = $GLOBALS['cfg_basedir'] . $murl; $this->dtp->SaveTo($mfile); return $murl; } @@ -111,16 +110,13 @@ class RssView */ function ParseTemplet() { - foreach($this->dtp->CTags as $tid => $ctag) - { - if($ctag->GetName()=="field") - { - $this->dtp->Assign($tid,$this->TypeFields[$ctag->GetAtt('name')]); - } - else if($ctag->GetName()=="rssitem") - { - $this->dtp->Assign($tid, - $this->GetArcList($ctag->GetInnerText()) + foreach ($this->dtp->CTags as $tid => $ctag) { + if ($ctag->GetName() == "field") { + $this->dtp->Assign($tid, $this->TypeFields[$ctag->GetAtt('name')]); + } else if ($ctag->GetName() == "rssitem") { + $this->dtp->Assign( + $tid, + $this->GetArcList($ctag->GetInnerText()) ); } } @@ -133,87 +129,94 @@ class RssView * @param string $innertext 底层模板 * @return string */ - function GetArcList($innertext="") + function GetArcList($innertext = "") { - $typeid=$this->TypeID; + $typeid = $this->TypeID; $innertext = trim($innertext); - if($innertext=="") - { + if ($innertext == "") { $innertext = GetSysTemplets("rss.htm"); } $orwhere = " arc.arcrank > -1 "; - $orwhere .= " AND (arc.typeid in (".GetSonIds($this->TypeID,$this->TypeFields['channeltype']).") ) "; - $ordersql=" ORDER BY arc.id desc"; + $orwhere .= " AND (arc.typeid in (" . GetSonIds($this->TypeID, $this->TypeFields['channeltype']) . ") ) "; + $ordersql = " ORDER BY arc.id desc"; $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault, tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id - WHERE $orwhere $ordersql LIMIT 0,".$this->MaxRow; + WHERE $orwhere $ordersql LIMIT 0," . $this->MaxRow; $this->dsql->SetQuery($query); $this->dsql->Execute('al'); $artlist = ''; $dtp2 = new DedeTagParse(); - $dtp2->SetNameSpace('field','[',']'); + $dtp2->SetNameSpace('field', '[', ']'); $dtp2->LoadSource($innertext); - while($row = $this->dsql->GetArray('al')) - { + while ($row = $this->dsql->GetArray('al')) { //处理一些特殊字段 - if($row['litpic'] == '-' || $row['litpic'] == '') - { - $row['litpic'] = $GLOBALS['cfg_cmspath'].'/static/defaultpic.gif'; + if ($row['litpic'] == '-' || $row['litpic'] == '') { + $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/static/defaultpic.gif'; } - if(!preg_match("/^http:\/\//", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') - { - $row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic']; + if (!preg_match("/^http:\/\//", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { + $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic']; } $row['picname'] = $row['litpic']; - $row["arcurl"] = GetFileUrl($row["id"],$row["typeid"],$row["senddate"],$row["title"], - $row["ismake"],$row["arcrank"],$row["namerule"],$row["typedir"],$row["money"],$row['filename'],$row["moresite"],$row["siteurl"],$row["sitepath"]); - $row["typeurl"] = GetTypeUrl($row["typeid"],$row["typedir"],$row["isdefault"],$row["defaultname"],$row["ispart"], - $row["namerule2"],$row["moresite"],$row["siteurl"],$row["sitepath"]); + $row["arcurl"] = GetFileUrl( + $row["id"], + $row["typeid"], + $row["senddate"], + $row["title"], + $row["ismake"], + $row["arcrank"], + $row["namerule"], + $row["typedir"], + $row["money"], + $row['filename'], + $row["moresite"], + $row["siteurl"], + $row["sitepath"] + ); + $row["typeurl"] = GetTypeUrl( + $row["typeid"], + $row["typedir"], + $row["isdefault"], + $row["defaultname"], + $row["ispart"], + $row["namerule2"], + $row["moresite"], + $row["siteurl"], + $row["sitepath"] + ); $row["info"] = $row["description"]; $row["filename"] = $row["arcurl"]; $row["stime"] = GetDateMK($row["pubdate"]); - $row["image"] = ""; - $row["fullurl"] = $GLOBALS["cfg_basehost"].$row["arcurl"]; - if($GLOBALS['cfg_multi_site'] == 'Y') $row["fullurl"] = $row["arcurl"]; + $row["image"] = ""; + $row["fullurl"] = $GLOBALS["cfg_basehost"] . $row["arcurl"]; + if ($GLOBALS['cfg_multi_site'] == 'Y') $row["fullurl"] = $row["arcurl"]; $row["phpurl"] = $GLOBALS["cfg_plus_dir"]; $row["templeturl"] = $GLOBALS["cfg_templets_dir"]; - if($row["source"]=='') - { + if ($row["source"] == '') { $row["source"] = $GLOBALS['cfg_webname']; } - if($row["writer"]=='') - { + if ($row["writer"] == '') { $row["writer"] = "秩名"; } - foreach($row as $k=>$v) - { + foreach ($row as $k => $v) { $row[$k] = dede_htmlspecialchars($v); } - if(is_array($dtp2->CTags)) - { - foreach($dtp2->CTags as $k=>$ctag) - { - if($ctag->GetName()=='array') - { + if (is_array($dtp2->CTags)) { + foreach ($dtp2->CTags as $k => $ctag) { + if ($ctag->GetName() == 'array') { //传递整个数组,在runphp模式中有特殊作用 - $dtp2->Assign($k,$row); - } - else - { - if(isset($row[$ctag->GetName()])) - { - $dtp2->Assign($k,$row[$ctag->GetName()]); - } - else - { - $dtp2->Assign($k,''); + $dtp2->Assign($k, $row); + } else { + if (isset($row[$ctag->GetName()])) { + $dtp2->Assign($k, $row[$ctag->GetName()]); + } else { + $dtp2->Assign($k, ''); } } } } - $artlist .= $dtp2->GetResult()."\r\n"; + $artlist .= $dtp2->GetResult() . "\r\n"; } $this->dsql->FreeResult('al'); return $artlist; diff --git a/src/include/arc.searchview.class.php b/src/include/arc.searchview.class.php index 458a428c..f9583fe1 100755 --- a/src/include/arc.searchview.class.php +++ b/src/include/arc.searchview.class.php @@ -3,7 +3,7 @@ * 搜索视图类 * * @version $Id: arc.searchview.class.php 1 15:26 2010年7月7日Z tianya $ - * @package DedeCMS.Libraries + * @package DedeBIZ.Libraries * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -21,7 +21,7 @@ require_once(DEDEINC . "/taglib/channel.lib.php"); * 搜索视图类 * * @package SearchView - * @subpackage DedeCMS.Libraries + * @subpackage DedeBIZ.Libraries * @link https://www.dedebiz.com */ class SearchView diff --git a/src/include/arc.sglistview.class.php b/src/include/arc.sglistview.class.php index 0b096f77..e7db9e9d 100755 --- a/src/include/arc.sglistview.class.php +++ b/src/include/arc.sglistview.class.php @@ -1,22 +1,22 @@ -TypeID = $typeid; @@ -62,17 +62,15 @@ class SgListView $this->dtp = new DedeTagParse(); $this->dtp->SetRefObj($this); $this->sAddTable = false; - $this->dtp->SetNameSpace("dede","{","}"); + $this->dtp->SetNameSpace("dede", "{", "}"); $this->dtp2 = new DedeTagParse(); - $this->dtp2->SetNameSpace("field","[","]"); + $this->dtp2->SetNameSpace("field", "[", "]"); $this->TypeLink = new TypeLink($typeid); $this->searchArr = $searchArr; - if(!is_array($this->TypeLink->TypeInfos)) - { + if (!is_array($this->TypeLink->TypeInfos)) { $this->IsError = true; } - if(!$this->IsError) - { + if (!$this->IsError) { $this->ChannelUnit = new ChannelUnit($this->TypeLink->TypeInfos['channeltype']); $this->Fields = $this->TypeLink->TypeInfos; $this->Fields['id'] = $typeid; @@ -86,52 +84,44 @@ class SgListView $this->ListFields = explode(',', $listfield); //设置一些全局参数的值 - foreach($GLOBALS['PubFields'] as $k=>$v) $this->Fields[$k] = $v; - $this->Fields['rsslink'] = $GLOBALS['cfg_cmsurl']."/data/rss/".$this->TypeID.".xml"; + foreach ($GLOBALS['PubFields'] as $k => $v) $this->Fields[$k] = $v; + $this->Fields['rsslink'] = $GLOBALS['cfg_cmsurl'] . "/data/rss/" . $this->TypeID . ".xml"; //设置环境变量 - SetSysEnv($this->TypeID,$this->Fields['typename'],0,'','list'); + SetSysEnv($this->TypeID, $this->Fields['typename'], 0, '', 'list'); $this->Fields['typeid'] = $this->TypeID; //获得交叉栏目ID - if($this->TypeLink->TypeInfos['cross']>0 && $this->TypeLink->TypeInfos['ispart']==0) - { + if ($this->TypeLink->TypeInfos['cross'] > 0 && $this->TypeLink->TypeInfos['ispart'] == 0) { $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}' "; - } - else - { + } else { $this->Fields['crossid'] = preg_replace("/[^0-9,]/", '', trim($this->Fields['crossid'])); - if($this->Fields['crossid']!='') - { + if ($this->Fields['crossid'] != '') { $selquery = "SELECT id,topid FROM `#@__arctype` WHERE id IN({$this->Fields['crossid']}) AND id<>{$this->TypeID} AND topid<>{$this->TypeID} "; } } - if($selquery!='') - { + if ($selquery != '') { $this->dsql->SetQuery($selquery); $this->dsql->Execute(); - while($arr = $this->dsql->GetArray()) - { - $this->CrossID .= ($this->CrossID=='' ? $arr['id'] : ','.$arr['id']); + while ($arr = $this->dsql->GetArray()) { + $this->CrossID .= ($this->CrossID == '' ? $arr['id'] : ',' . $arr['id']); } } } - - }//!error + } //!error } //php4构造函数 - function SgListView($typeid,$searchArr=array()){ - $this->__construct($typeid,$searchArr); + function SgListView($typeid, $searchArr = array()) + { + $this->__construct($typeid, $searchArr); } //关闭相关资源 function Close() { - } /** @@ -146,127 +136,94 @@ class SgListView //统计数据库记录 $this->TotalResult = -1; - if(isset($GLOBALS['TotalResult'])) $this->TotalResult = $GLOBALS['TotalResult']; - if(isset($GLOBALS['PageNo'])) $this->PageNo = $GLOBALS['PageNo']; + if (isset($GLOBALS['TotalResult'])) $this->TotalResult = $GLOBALS['TotalResult']; + if (isset($GLOBALS['PageNo'])) $this->PageNo = $GLOBALS['PageNo']; else $this->PageNo = 1; $this->addSql = " arc.arcrank > -1 "; //栏目id条件 - if(!empty($this->TypeID)) - { - if($cfg_list_son=='N') - { - if($this->CrossID=='') $this->addSql .= " AND (arc.typeid='".$this->TypeID."') "; + if (!empty($this->TypeID)) { + if ($cfg_list_son == 'N') { + if ($this->CrossID == '') $this->addSql .= " AND (arc.typeid='" . $this->TypeID . "') "; else $this->addSql .= " AND (arc.typeid IN({$this->CrossID},{$this->TypeID})) "; - } - else - { - if($this->CrossID=='') $this->addSql .= " AND (arc.typeid IN (".GetSonIds($this->TypeID,$this->Fields['channeltype']).") ) "; - else $this->addSql .= " AND (arc.typeid IN (".GetSonIds($this->TypeID,$this->Fields['channeltype']).",{$this->CrossID}) ) "; + } else { + if ($this->CrossID == '') $this->addSql .= " AND (arc.typeid IN (" . GetSonIds($this->TypeID, $this->Fields['channeltype']) . ") ) "; + else $this->addSql .= " AND (arc.typeid IN (" . GetSonIds($this->TypeID, $this->Fields['channeltype']) . ",{$this->CrossID}) ) "; } } $naddQuery = ''; //地区与信息类型条件 - if(count($this->searchArr) > 0) - { - if(!empty($this->searchArr['nativeplace'])) - { - if($this->searchArr['nativeplace'] % 500 ==0 ) - { - $naddQuery .= " AND arc.nativeplace >= '{$this->searchArr['nativeplace']}' AND arc.nativeplace < '".($this->searchArr['nativeplace']+500)."'"; - } - else - { + if (count($this->searchArr) > 0) { + if (!empty($this->searchArr['nativeplace'])) { + if ($this->searchArr['nativeplace'] % 500 == 0) { + $naddQuery .= " AND arc.nativeplace >= '{$this->searchArr['nativeplace']}' AND arc.nativeplace < '" . ($this->searchArr['nativeplace'] + 500) . "'"; + } else { $naddQuery .= "AND arc.nativeplace = '{$this->searchArr['nativeplace']}'"; } } - if(!empty($this->searchArr['infotype'])) - { - if($this->searchArr['infotype'] % 500 ==0 ) - { - $naddQuery .= " AND arc.infotype >= '{$this->searchArr['infotype']}' AND arc.infotype < '".($this->searchArr['infotype']+500)."'"; - } - else - { + if (!empty($this->searchArr['infotype'])) { + if ($this->searchArr['infotype'] % 500 == 0) { + $naddQuery .= " AND arc.infotype >= '{$this->searchArr['infotype']}' AND arc.infotype < '" . ($this->searchArr['infotype'] + 500) . "'"; + } else { $naddQuery .= "AND arc.infotype = '{$this->searchArr['infotype']}'"; } } - if(!empty($this->searchArr['keyword'])) - { + if (!empty($this->searchArr['keyword'])) { $naddQuery .= "AND arc.title like '%{$this->searchArr['keyword']}%' "; - } + } } - if($naddQuery!='') - { + if ($naddQuery != '') { $this->sAddTable = true; $this->addSql .= $naddQuery; } - if($this->TotalResult==-1) - { - if($this->sAddTable) - { - $cquery = "SELECT COUNT(*) AS dd FROM `{$this->AddTable}` arc WHERE ".$this->addSql; - } - else - { - $cquery = "SELECT COUNT(*) AS dd FROM `#@__arctiny` arc WHERE ".$this->addSql; + if ($this->TotalResult == -1) { + if ($this->sAddTable) { + $cquery = "SELECT COUNT(*) AS dd FROM `{$this->AddTable}` arc WHERE " . $this->addSql; + } else { + $cquery = "SELECT COUNT(*) AS dd FROM `#@__arctiny` arc WHERE " . $this->addSql; } $row = $this->dsql->GetOne($cquery); - if(is_array($row)) - { + if (is_array($row)) { $this->TotalResult = $row['dd']; - } - else - { + } else { $this->TotalResult = 0; } } //初始化列表模板,并统计页面总数 - $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$this->TypeLink->TypeInfos['templist']; - $tempfile = str_replace("{tid}",$this->TypeID,$tempfile); - $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile); - if ( defined('DEDEMOB') ) - { - $tempfile =str_replace('.htm','_m.htm',$tempfile); + $tempfile = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_templets_dir'] . "/" . $this->TypeLink->TypeInfos['templist']; + $tempfile = str_replace("{tid}", $this->TypeID, $tempfile); + $tempfile = str_replace("{cid}", $this->ChannelUnit->ChannelInfos['nid'], $tempfile); + if (defined('DEDEMOB')) { + $tempfile = str_replace('.htm', '_m.htm', $tempfile); } - if(!file_exists($tempfile)) - { - $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/list_default_sg.htm"; - if ( defined('DEDEMOB') ) - { - $tempfile =str_replace('.htm','_m.htm',$tempfile); + if (!file_exists($tempfile)) { + $tempfile = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_templets_dir'] . "/" . $GLOBALS['cfg_df_style'] . "/list_default_sg.htm"; + if (defined('DEDEMOB')) { + $tempfile = str_replace('.htm', '_m.htm', $tempfile); } } - if(!file_exists($tempfile)||!is_file($tempfile)) - { + if (!file_exists($tempfile) || !is_file($tempfile)) { echo "模板文件不存在,无法解析文档!"; exit(); } $this->dtp->LoadTemplate($tempfile); $ctag = $this->dtp->GetTag("page"); - if(!is_object($ctag)) - { + if (!is_object($ctag)) { $ctag = $this->dtp->GetTag("list"); } - if(!is_object($ctag)) - { + if (!is_object($ctag)) { $this->PageSize = 20; - } - else - { - if($ctag->GetAtt('pagesize')!='') - { + } else { + if ($ctag->GetAtt('pagesize') != '') { $this->PageSize = $ctag->GetAtt('pagesize'); - } - else - { + } else { $this->PageSize = 20; } } - $this->TotalPage = ceil($this->TotalResult/$this->PageSize); + $this->TotalPage = ceil($this->TotalResult / $this->PageSize); } /** @@ -277,80 +234,69 @@ class SgListView * @param string $makepagesize 生成尺寸 * @return string */ - function MakeHtml($startpage=1,$makepagesize=0) + function MakeHtml($startpage = 1, $makepagesize = 0) { - if(empty($startpage)) - { + if (empty($startpage)) { $startpage = 1; } //创建封面模板文件 - if($this->TypeLink->TypeInfos['isdefault']==-1) - { + if ($this->TypeLink->TypeInfos['isdefault'] == -1) { echo '这个类目是动态类目!'; return ''; } //单独页面 - else if($this->TypeLink->TypeInfos['ispart']>0) - { + else if ($this->TypeLink->TypeInfos['ispart'] > 0) { $reurl = $this->MakePartTemplets(); return $reurl; } - if(empty($this->TotalResult)) $this->CountRecord(); + if (empty($this->TotalResult)) $this->CountRecord(); //初步给固定值的标记赋值 $this->ParseTempletsFirst(); - $totalpage = ceil($this->TotalResult/$this->PageSize); - if($totalpage==0) - { + $totalpage = ceil($this->TotalResult / $this->PageSize); + if ($totalpage == 0) { $totalpage = 1; } CreateDir(MfTypedir($this->Fields['typedir'])); $murl = ''; - if($makepagesize > 0) - { - $endpage = $startpage+$makepagesize; + if ($makepagesize > 0) { + $endpage = $startpage + $makepagesize; + } else { + $endpage = ($totalpage + 1); } - else - { - $endpage = ($totalpage+1); + if ($endpage >= $totalpage + 1) { + $endpage = $totalpage + 1; } - if( $endpage >= $totalpage+1 ) - { - $endpage = $totalpage+1; - } - if($endpage==1) - { + if ($endpage == 1) { $endpage = 2; } - for($this->PageNo=$startpage; $this->PageNo < $endpage; $this->PageNo++) - { - $this->ParseDMFields($this->PageNo,1); - $makeFile = $this->GetMakeFileRule($this->Fields['id'],'list',$this->Fields['typedir'],'',$this->Fields['namerule2']); - $makeFile = str_replace("{page}",$this->PageNo,$makeFile); + for ($this->PageNo = $startpage; $this->PageNo < $endpage; $this->PageNo++) { + $this->ParseDMFields($this->PageNo, 1); + $makeFile = $this->GetMakeFileRule($this->Fields['id'], 'list', $this->Fields['typedir'], '', $this->Fields['namerule2']); + $makeFile = str_replace("{page}", $this->PageNo, $makeFile); $murl = $makeFile; - if(!preg_match("/^\//",$makeFile)) - { - $makeFile = "/".$makeFile; + if (!preg_match("/^\//", $makeFile)) { + $makeFile = "/" . $makeFile; } - $makeFile = $this->GetTruePath().$makeFile; + $makeFile = $this->GetTruePath() . $makeFile; $makeFile = preg_replace("/\/{1,}/", "/", $makeFile); $murl = $this->GetTrueUrl($murl); $this->dtp->SaveTo($makeFile); } - if($startpage==1) - { + if ($startpage == 1) { //如果列表启用封面文件,复制这个文件第一页 - if($this->TypeLink->TypeInfos['isdefault']==1 - && $this->TypeLink->TypeInfos['ispart']==0) - { - $onlyrule = $this->GetMakeFileRule($this->Fields['id'],"list",$this->Fields['typedir'],'',$this->Fields['namerule2']); - $onlyrule = str_replace("{page}","1",$onlyrule); - $list_1 = $this->GetTruePath().$onlyrule; - $murl = MfTypedir($this->Fields['typedir']).'/'.$this->Fields['defaultname']; - $indexname = $this->GetTruePath().$murl; - copy($list_1,$indexname); + if ( + $this->TypeLink->TypeInfos['isdefault'] == 1 + && $this->TypeLink->TypeInfos['ispart'] == 0 + ) { + $onlyrule = $this->GetMakeFileRule($this->Fields['id'], "list", $this->Fields['typedir'], '', $this->Fields['namerule2']); + $onlyrule = str_replace("{page}", "1", $onlyrule); + $list_1 = $this->GetTruePath() . $onlyrule; + $murl = MfTypedir($this->Fields['typedir']) . '/' . $this->Fields['defaultname']; + $indexname = $this->GetTruePath() . $murl; + copy($list_1, $indexname); } } return $murl; @@ -364,10 +310,9 @@ class SgListView */ function Display() { - if($this->TypeLink->TypeInfos['ispart']>0 && count($this->searchArr)==0 ) - { + if ($this->TypeLink->TypeInfos['ispart'] > 0 && count($this->searchArr) == 0) { $this->DisplayPartTemplets(); - return ; + return; } $this->CountRecord(); /* @@ -385,7 +330,7 @@ class SgListView } */ $this->ParseTempletsFirst(); - $this->ParseDMFields($this->PageNo,0); + $this->ParseDMFields($this->PageNo, 0); $this->dtp->Display(); } @@ -397,46 +342,36 @@ class SgListView */ function MakePartTemplets() { - $this->PartView = new PartView($this->TypeID,false); + $this->PartView = new PartView($this->TypeID, false); $this->PartView->SetTypeLink($this->TypeLink); $nmfa = 0; - $tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']; - if($this->Fields['ispart']==1) - { - $tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempindex']); - $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile); - $tempfile = $tmpdir."/".$tempfile; - if ( defined('DEDEMOB') ) - { - $tempfile =str_replace('.htm','_m.htm',$tempfile); - } - if(!file_exists($tempfile)) - { - $tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_default_sg.htm"; - if ( defined('DEDEMOB') ) - { - $tempfile =str_replace('.htm','_m.htm',$tempfile); + $tmpdir = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_templets_dir']; + if ($this->Fields['ispart'] == 1) { + $tempfile = str_replace("{tid}", $this->TypeID, $this->Fields['tempindex']); + $tempfile = str_replace("{cid}", $this->ChannelUnit->ChannelInfos['nid'], $tempfile); + $tempfile = $tmpdir . "/" . $tempfile; + if (defined('DEDEMOB')) { + $tempfile = str_replace('.htm', '_m.htm', $tempfile); + } + if (!file_exists($tempfile)) { + $tempfile = $tmpdir . "/" . $GLOBALS['cfg_df_style'] . "/index_default_sg.htm"; + if (defined('DEDEMOB')) { + $tempfile = str_replace('.htm', '_m.htm', $tempfile); } } $this->PartView->SetTemplet($tempfile); - } - else if($this->Fields['ispart']==2) - { + } else if ($this->Fields['ispart'] == 2) { //跳转网址 return $this->Fields['typedir']; } CreateDir(MfTypedir($this->Fields['typedir'])); - $makeUrl = $this->GetMakeFileRule($this->Fields['id'],"index",MfTypedir($this->Fields['typedir']),$this->Fields['defaultname'],$this->Fields['namerule2']); + $makeUrl = $this->GetMakeFileRule($this->Fields['id'], "index", MfTypedir($this->Fields['typedir']), $this->Fields['defaultname'], $this->Fields['namerule2']); $makeUrl = preg_replace("/\/{1,}/", "/", $makeUrl); - $makeFile = $this->GetTruePath().$makeUrl; - if($nmfa==0) - { + $makeFile = $this->GetTruePath() . $makeUrl; + if ($nmfa == 0) { $this->PartView->SaveToHtml($makeFile); - } - else - { - if(!file_exists($makeFile)) - { + } else { + if (!file_exists($makeFile)) { $this->PartView->SaveToHtml($makeFile); } } @@ -451,52 +386,40 @@ class SgListView */ function DisplayPartTemplets() { - $this->PartView = new PartView($this->TypeID,false); + $this->PartView = new PartView($this->TypeID, false); $this->PartView->SetTypeLink($this->TypeLink); $nmfa = 0; - $tmpdir = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']; - if($this->Fields['ispart']==1) - { + $tmpdir = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_templets_dir']; + if ($this->Fields['ispart'] == 1) { //封面模板 - $tempfile = str_replace("{tid}",$this->TypeID,$this->Fields['tempindex']); - $tempfile = str_replace("{cid}",$this->ChannelUnit->ChannelInfos['nid'],$tempfile); - $tempfile = $tmpdir."/".$tempfile; - if ( defined('DEDEMOB') ) - { - $tempfile =str_replace('.htm','_m.htm',$tempfile); - } - if(!file_exists($tempfile)) - { - $tempfile = $tmpdir."/".$GLOBALS['cfg_df_style']."/index_default_sg.htm"; - if ( defined('DEDEMOB') ) - { - $tempfile =str_replace('.htm','_m.htm',$tempfile); + $tempfile = str_replace("{tid}", $this->TypeID, $this->Fields['tempindex']); + $tempfile = str_replace("{cid}", $this->ChannelUnit->ChannelInfos['nid'], $tempfile); + $tempfile = $tmpdir . "/" . $tempfile; + if (defined('DEDEMOB')) { + $tempfile = str_replace('.htm', '_m.htm', $tempfile); + } + if (!file_exists($tempfile)) { + $tempfile = $tmpdir . "/" . $GLOBALS['cfg_df_style'] . "/index_default_sg.htm"; + if (defined('DEDEMOB')) { + $tempfile = str_replace('.htm', '_m.htm', $tempfile); } } $this->PartView->SetTemplet($tempfile); - } - else if($this->Fields['ispart']==2) - { + } else if ($this->Fields['ispart'] == 2) { //跳转网址 $gotourl = $this->Fields['typedir']; header("Location:$gotourl"); exit(); } CreateDir(MfTypedir($this->Fields['typedir'])); - $makeUrl = $this->GetMakeFileRule($this->Fields['id'],"index",MfTypedir($this->Fields['typedir']),$this->Fields['defaultname'],$this->Fields['namerule2']); - $makeFile = $this->GetTruePath().$makeUrl; - if($nmfa==0) - { + $makeUrl = $this->GetMakeFileRule($this->Fields['id'], "index", MfTypedir($this->Fields['typedir']), $this->Fields['defaultname'], $this->Fields['namerule2']); + $makeFile = $this->GetTruePath() . $makeUrl; + if ($nmfa == 0) { $this->PartView->Display(); - } - else - { - if(!file_exists($makeFile)) - { + } else { + if (!file_exists($makeFile)) { $this->PartView->Display(); - } - else - { + } else { include($makeFile); } } @@ -523,14 +446,12 @@ class SgListView */ function GetTrueUrl($nurl) { - if(preg_match("/^http[s]?:\/\//", $nurl)) return $nurl; - if($this->Fields['moresite']==1) - { - if($this->Fields['sitepath']!='') - { - $nurl = preg_replace("/^".$this->Fields['sitepath']."/", '', $nurl); + if (preg_match("/^http[s]?:\/\//", $nurl)) return $nurl; + if ($this->Fields['moresite'] == 1) { + if ($this->Fields['sitepath'] != '') { + $nurl = preg_replace("/^" . $this->Fields['sitepath'] . "/", '', $nurl); } - $nurl = $this->Fields['siteurl'].$nurl; + $nurl = $this->Fields['siteurl'] . $nurl; } return $nurl; } @@ -543,14 +464,13 @@ class SgListView */ function ParseTempletsFirst() { - if(isset($this->TypeLink->TypeInfos['reid'])) - { + if (isset($this->TypeLink->TypeInfos['reid'])) { $GLOBALS['envs']['reid'] = $this->TypeLink->TypeInfos['reid']; } $GLOBALS['envs']['channelid'] = $this->TypeLink->TypeInfos['channeltype']; $GLOBALS['envs']['typeid'] = $this->TypeID; $GLOBALS['envs']['cross'] = 1; - MakeOneTag($this->dtp,$this); + MakeOneTag($this->dtp, $this); } /** @@ -561,63 +481,50 @@ class SgListView * @param int $ismake 是否编译 * @return void */ - function ParseDMFields($PageNo, $ismake=1) + function ParseDMFields($PageNo, $ismake = 1) { //替换第二页后的内容 - if(($PageNo>1 || strlen($this->Fields['content'])<10 ) && !$this->IsReplace) - { - $this->dtp->SourceString = str_replace('[cmsreplace]','display:none',$this->dtp->SourceString); + if (($PageNo > 1 || strlen($this->Fields['content']) < 10) && !$this->IsReplace) { + $this->dtp->SourceString = str_replace('[cmsreplace]', 'display:none', $this->dtp->SourceString); $this->IsReplace = true; } - foreach($this->dtp->CTags as $tagid=>$ctag) - { - if($ctag->GetName()=="list") - { - $limitstart = ($this->PageNo-1) * $this->PageSize; + foreach ($this->dtp->CTags as $tagid => $ctag) { + if ($ctag->GetName() == "list") { + $limitstart = ($this->PageNo - 1) * $this->PageSize; $row = $this->PageSize; - if(trim($ctag->GetInnerText())=="") - { + if (trim($ctag->GetInnerText()) == "") { $InnerText = GetSysTemplets("list_fulllist.htm"); - } - else - { + } else { $InnerText = trim($ctag->GetInnerText()); } - $this->dtp->Assign($tagid, - $this->GetArcList( - $limitstart, - $row, - $ctag->GetAtt("col"), - $ctag->GetAtt("titlelen"), - $ctag->GetAtt("listtype"), - $ctag->GetAtt("orderby"), - $InnerText, - $ctag->GetAtt("tablewidth"), - $ismake, - $ctag->GetAtt("orderway") - ) + $this->dtp->Assign( + $tagid, + $this->GetArcList( + $limitstart, + $row, + $ctag->GetAtt("col"), + $ctag->GetAtt("titlelen"), + $ctag->GetAtt("listtype"), + $ctag->GetAtt("orderby"), + $InnerText, + $ctag->GetAtt("tablewidth"), + $ismake, + $ctag->GetAtt("orderway") + ) ); - } - else if($ctag->GetName()=="pagelist") - { + } else if ($ctag->GetName() == "pagelist") { $list_len = trim($ctag->GetAtt("listsize")); - $ctag->GetAtt("listitem")=="" ? $listitem="index,pre,pageno,next,end,option" : $listitem=$ctag->GetAtt("listitem"); - if($list_len=="") - { + $ctag->GetAtt("listitem") == "" ? $listitem = "index,pre,pageno,next,end,option" : $listitem = $ctag->GetAtt("listitem"); + if ($list_len == "") { $list_len = 3; } - if($ismake==0) - { - $this->dtp->Assign($tagid,$this->GetPageListDM($list_len,$listitem)); + if ($ismake == 0) { + $this->dtp->Assign($tagid, $this->GetPageListDM($list_len, $listitem)); + } else { + $this->dtp->Assign($tagid, $this->GetPageListST($list_len, $listitem)); } - else - { - $this->dtp->Assign($tagid,$this->GetPageListST($list_len,$listitem)); - } - } - else if($PageNo!=1 && $ctag->GetName()=='field' && $ctag->GetAtt('display')!='') - { - $this->dtp->Assign($tagid,''); + } else if ($PageNo != 1 && $ctag->GetName() == 'field' && $ctag->GetAtt('display') != '') { + $this->dtp->Assign($tagid, ''); } } } @@ -633,17 +540,14 @@ class SgListView * @param string $namerule2 名称规则 * @return string */ - function GetMakeFileRule($typeid,$wname,$typedir,$defaultname,$namerule2) + function GetMakeFileRule($typeid, $wname, $typedir, $defaultname, $namerule2) { $typedir = MfTypedir($typedir); - if($wname=='index') - { - return $typedir.'/'.$defaultname; - } - else - { - $namerule2 = str_replace('{tid}',$typeid,$namerule2); - $namerule2 = str_replace('{typedir}',$typedir,$namerule2); + if ($wname == 'index') { + return $typedir . '/' . $defaultname; + } else { + $namerule2 = str_replace('{tid}', $typeid, $namerule2); + $namerule2 = str_replace('{typedir}', $typedir, $namerule2); return $namerule2; } } @@ -667,54 +571,48 @@ class SgListView * @param string $orderWay 排序方式 * @return string */ - function GetArcList($limitstart=0,$row=10,$col=1,$titlelen=30,$listtype="all",$orderby="default",$innertext="",$tablewidth="100",$ismake=1,$orderWay='desc') + function GetArcList($limitstart = 0, $row = 10, $col = 1, $titlelen = 30, $listtype = "all", $orderby = "default", $innertext = "", $tablewidth = "100", $ismake = 1, $orderWay = 'desc') { global $cfg_list_son; - $typeid=$this->TypeID; + $typeid = $this->TypeID; - if($row=='') $row = 10; + if ($row == '') $row = 10; - if($limitstart=='') $limitstart = 0; + if ($limitstart == '') $limitstart = 0; - if($titlelen=='') $titlelen = 100; + if ($titlelen == '') $titlelen = 100; - if($listtype=='') $listtype = "all"; + if ($listtype == '') $listtype = "all"; - if($orderby=='') $orderby='id'; - else $orderby=strtolower($orderby); + if ($orderby == '') $orderby = 'id'; + else $orderby = strtolower($orderby); - if($orderWay=='') $orderWay = 'desc'; + if ($orderWay == '') $orderWay = 'desc'; $tablewidth = str_replace("%", "", $tablewidth); - if($tablewidth=='') $tablewidth=100; - if($col=='') $col=1; + if ($tablewidth == '') $tablewidth = 100; + if ($col == '') $col = 1; $colWidth = ceil(100 / $col); - $tablewidth = $tablewidth."%"; - $colWidth = $colWidth."%"; + $tablewidth = $tablewidth . "%"; + $colWidth = $colWidth . "%"; $innertext = trim($innertext); - if($innertext=='') $innertext = GetSysTemplets('list_sglist.htm'); + if ($innertext == '') $innertext = GetSysTemplets('list_sglist.htm'); //排序方式 $ordersql = ''; - if($orderby=='senddate'||$orderby=='id') - { - $ordersql=" ORDER BY arc.aid $orderWay"; - } - else if($orderby=='hot'||$orderby=='click') - { + if ($orderby == 'senddate' || $orderby == 'id') { + $ordersql = " ORDER BY arc.aid $orderWay"; + } else if ($orderby == 'hot' || $orderby == 'click') { $ordersql = " ORDER BY arc.click $orderWay"; - } - else - { - $ordersql=" ORDER BY arc.aid $orderWay"; + } else { + $ordersql = " ORDER BY arc.aid $orderWay"; } - $addField = 'arc.'.join(',arc.',$this->ListFields); + $addField = 'arc.' . join(',arc.', $this->ListFields); //如果不用默认的sortrank或id排序,使用联合查询(数据量大时非常缓慢) - if(preg_match('/hot|click/', $orderby) || $this->sAddTable) - { + if (preg_match('/hot|click/', $orderby) || $this->sAddTable) { $query = "SELECT tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2, tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,arc.aid,arc.aid AS id,arc.typeid, $addField @@ -723,26 +621,21 @@ class SgListView WHERE {$this->addSql} $ordersql LIMIT $limitstart,$row"; } //普通情况先从arctiny表查出ID,然后按ID查询(速度非常快) - else - { + else { $t1 = ExecTime(); $ids = array(); - $nordersql = str_replace('.aid','.id',$ordersql); + $nordersql = str_replace('.aid', '.id', $ordersql); $query = "SELECT id From `#@__arctiny` arc WHERE {$this->addSql} $nordersql LIMIT $limitstart,$row "; $this->dsql->SetQuery($query); $this->dsql->Execute(); - while($arr=$this->dsql->GetArray()) - { + while ($arr = $this->dsql->GetArray()) { $ids[] = $arr['id']; } - $idstr = join(',',$ids); - if($idstr=='') - { + $idstr = join(',', $ids); + if ($idstr == '') { return ''; - } - else - { + } else { $query = "SELECT tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2, tp.ispart,tp.moresite,tp.siteurl,tp.sitepath,arc.aid,arc.aid AS id,arc.typeid, $addField @@ -761,36 +654,52 @@ class SgListView $artlist = ''; $this->dtp2->LoadSource($innertext); $GLOBALS['autoindex'] = 0; - for($i=0;$i<$row;$i++) - { - if($col>1) - { + for ($i = 0; $i < $row; $i++) { + if ($col > 1) { $artlist .= "
    \r\n"; } - for($j=0;$j<$col;$j++) - { - if($row = $this->dsql->GetArray("al")) - { + for ($j = 0; $j < $col; $j++) { + if ($row = $this->dsql->GetArray("al")) { $GLOBALS['autoindex']++; - $ids[$row['aid']] = $row['id']= $row['aid']; + $ids[$row['aid']] = $row['id'] = $row['aid']; //处理一些特殊字段 $row['ismake'] = 1; $row['money'] = 0; $row['arcrank'] = 0; $row['filename'] = ''; - $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'], - $row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']); - - $row['typeurl'] = GetTypeUrl($row['typeid'],MfTypedir($row['typedir']),$row['isdefault'],$row['defaultname'], - $row['ispart'],$row['namerule2'],$row['moresite'],$row['siteurl'],$row['sitepath']); - if($row['litpic'] == '-' || $row['litpic'] == '') - { - $row['litpic'] = $GLOBALS['cfg_cmspath'].'/static/defaultpic.gif'; + $row['filename'] = $row['arcurl'] = GetFileUrl( + $row['id'], + $row['typeid'], + $row['senddate'], + $row['title'], + $row['ismake'], + $row['arcrank'], + $row['namerule'], + $row['typedir'], + $row['money'], + $row['filename'], + $row['moresite'], + $row['siteurl'], + $row['sitepath'] + ); + + $row['typeurl'] = GetTypeUrl( + $row['typeid'], + MfTypedir($row['typedir']), + $row['isdefault'], + $row['defaultname'], + $row['ispart'], + $row['namerule2'], + $row['moresite'], + $row['siteurl'], + $row['sitepath'] + ); + if ($row['litpic'] == '-' || $row['litpic'] == '') { + $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/static/defaultpic.gif'; } - if(!preg_match("/^http:\/\//", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') - { - $row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic']; + if (!preg_match("/^http:\/\//", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { + $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic']; } $row['picname'] = $row['litpic']; @@ -798,18 +707,17 @@ class SgListView $row['stime'] = GetDateMK($row['pubdate']); - $row['typelink'] = "".$row['typename'].""; + $row['typelink'] = "" . $row['typename'] . ""; $row['fulltitle'] = $row['title']; - $row['title'] = cn_substr($row['title'],$titlelen); + $row['title'] = cn_substr($row['title'], $titlelen); - if(preg_match('/b/', $row['flag'])) - { - $row['title'] = "".$row['title'].""; + if (preg_match('/b/', $row['flag'])) { + $row['title'] = "" . $row['title'] . ""; } - $row['textlink'] = "".$row['title'].""; + $row['textlink'] = "" . $row['title'] . ""; $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl']; @@ -818,49 +726,38 @@ class SgListView $row['templeturl'] = $GLOBALS['cfg_templeturl']; //编译附加表里的数据 - foreach($row as $k=>$v) $row[strtolower($k)] = $v; - - foreach($this->ChannelUnit->ChannelFields as $k=>$arr) - { - if(isset($row[$k])) - { - $row[$k] = $this->ChannelUnit->MakeField($k,$row[$k]); - } + foreach ($row as $k => $v) $row[strtolower($k)] = $v; + + foreach ($this->ChannelUnit->ChannelFields as $k => $arr) { + if (isset($row[$k])) { + $row[$k] = $this->ChannelUnit->MakeField($k, $row[$k]); + } } - if(is_array($this->dtp2->CTags)) - { - foreach($this->dtp2->CTags as $k=>$ctag) - { - if($ctag->GetName()=='array') - { + if (is_array($this->dtp2->CTags)) { + foreach ($this->dtp2->CTags as $k => $ctag) { + if ($ctag->GetName() == 'array') { //传递整个数组,在runphp模式中有特殊作用 - $this->dtp2->Assign($k,$row); - } - else - { - if(isset($row[$ctag->GetName()])) - { - $this->dtp2->Assign($k,$row[$ctag->GetName()]); - } - else - { - $this->dtp2->Assign($k,''); + $this->dtp2->Assign($k, $row); + } else { + if (isset($row[$ctag->GetName()])) { + $this->dtp2->Assign($k, $row[$ctag->GetName()]); + } else { + $this->dtp2->Assign($k, ''); } } } } $artlist .= $this->dtp2->GetResult(); - }//if hasRow + } //if hasRow - }//Loop Col + } //Loop Col - if($col>1) - { + if ($col > 1) { $i += $col - 1; $artlist .= "
    \r\n"; } - }//Loop Line + } //Loop Line $t3 = ExecTime(); @@ -877,50 +774,41 @@ class SgListView * @param string $listitem 列表样式 * @return string */ - function GetPageListST($list_len,$listitem="index,end,pre,next,pageno") + function GetPageListST($list_len, $listitem = "index,end,pre,next,pageno") { - $prepage=""; - $nextpage=""; - $prepagenum = $this->PageNo-1; - $nextpagenum = $this->PageNo+1; - if($list_len=="" || preg_match("/[^0-9]/", $list_len)) - { - $list_len=3; + $prepage = ""; + $nextpage = ""; + $prepagenum = $this->PageNo - 1; + $nextpagenum = $this->PageNo + 1; + if ($list_len == "" || preg_match("/[^0-9]/", $list_len)) { + $list_len = 3; } $totalpage = ceil($this->TotalResult / $this->PageSize); - if($totalpage <= 1 && $this->TotalResult > 0) - { - return "
  • 共 1 页".$this->TotalResult."条记录
  • "; + if ($totalpage <= 1 && $this->TotalResult > 0) { + return "
  • 共 1 页" . $this->TotalResult . "条记录
  • "; } - if($this->TotalResult == 0) - { - return "
  • 共 0 页".$this->TotalResult."条记录
  • "; + if ($this->TotalResult == 0) { + return "
  • 共 0 页" . $this->TotalResult . "条记录
  • "; } $purl = $this->GetCurUrl(); - $maininfo = "
  • 共 {$totalpage} 页".$this->TotalResult."条
  • "; + $maininfo = "
  • 共 {$totalpage} 页" . $this->TotalResult . "条
  • "; $tnamerule = $this->GetMakeFileRule($this->Fields['id'], "list", $this->Fields['typedir'], $this->Fields['defaultname'], $this->Fields['namerule2']); $tnamerule = preg_replace("/^(.*)\//", '', $tnamerule); //获得上一页和主页的链接 - if($this->PageNo != 1) - { - $prepage.="
  • 上一页
  • \r\n"; - $indexpage="
  • 首页
  • \r\n"; - } - else - { - $indexpage="
  • 首页
  • \r\n"; + if ($this->PageNo != 1) { + $prepage .= "
  • 上一页
  • \r\n"; + $indexpage = "
  • 首页
  • \r\n"; + } else { + $indexpage = "
  • 首页
  • \r\n"; } //下一页,未页的链接 - if($this->PageNo != $totalpage && $totalpage>1) - { - $nextpage.="
  • 下一页
  • \r\n"; - $endpage="
  • 末页
  • \r\n"; - } - else - { - $endpage="
  • 末页
  • "; + if ($this->PageNo != $totalpage && $totalpage > 1) { + $nextpage .= "
  • 下一页
  • \r\n"; + $endpage = "
  • 末页
  • \r\n"; + } else { + $endpage = "
  • 末页
  • "; } //option链接 @@ -946,61 +834,45 @@ class SgListView //获得数字链接 $listdd = ""; $total_list = $list_len * 2 + 1; - if($this->PageNo >= $total_list) - { + if ($this->PageNo >= $total_list) { $j = $this->PageNo - $list_len; $total_list = $this->PageNo + $list_len; - if($total_list > $totalpage) - { + if ($total_list > $totalpage) { $total_list = $totalpage; } - } - else - { - $j=1; - if($total_list > $totalpage) - { + } else { + $j = 1; + if ($total_list > $totalpage) { $total_list = $totalpage; } } - for($j; $j <= $total_list; $j++) - { - if($j == $this->PageNo) - { - $listdd.= "
  • $j
  • \r\n"; - } - else - { - $listdd.="
  • ".$j."
  • \r\n"; + for ($j; $j <= $total_list; $j++) { + if ($j == $this->PageNo) { + $listdd .= "
  • $j
  • \r\n"; + } else { + $listdd .= "
  • " . $j . "
  • \r\n"; } } $plist = ""; - if(preg_match('/info/i', $listitem)) - { - $plist .= $maininfo.' '; + if (preg_match('/info/i', $listitem)) { + $plist .= $maininfo . ' '; } - if(preg_match('/index/i', $listitem)) - { - $plist .= $indexpage.' '; + if (preg_match('/index/i', $listitem)) { + $plist .= $indexpage . ' '; } - if(preg_match('/pre/i', $listitem)) - { - $plist .= $prepage.' '; + if (preg_match('/pre/i', $listitem)) { + $plist .= $prepage . ' '; } - if(preg_match('/pageno/i', $listitem)) - { - $plist .= $listdd.' '; + if (preg_match('/pageno/i', $listitem)) { + $plist .= $listdd . ' '; } - if(preg_match('/next/i', $listitem)) - { - $plist .= $nextpage.' '; + if (preg_match('/next/i', $listitem)) { + $plist .= $nextpage . ' '; } - if(preg_match('/end/i', $listitem)) - { - $plist .= $endpage.' '; + if (preg_match('/end/i', $listitem)) { + $plist .= $endpage . ' '; } - if(preg_match('/option/i', $listitem)) - { + if (preg_match('/option/i', $listitem)) { $plist .= $optionlist; } return $plist; @@ -1014,90 +886,72 @@ class SgListView * @param string $listitem 列表样式 * @return string */ - function GetPageListDM($list_len,$listitem="index,end,pre,next,pageno") + function GetPageListDM($list_len, $listitem = "index,end,pre,next,pageno") { - global $nativeplace,$infotype,$keyword; - if(empty($nativeplace)) $nativeplace = 0; - if(empty($infotype)) $infotype = 0; - if(empty($keyword)) $keyword = ''; + global $nativeplace, $infotype, $keyword; + if (empty($nativeplace)) $nativeplace = 0; + if (empty($infotype)) $infotype = 0; + if (empty($keyword)) $keyword = ''; $prepage = $nextpage = ''; $prepagenum = $this->PageNo - 1; $nextpagenum = $this->PageNo + 1; - if($list_len=="" || preg_match("/[^0-9]/", $list_len)) - { - $list_len=3; + if ($list_len == "" || preg_match("/[^0-9]/", $list_len)) { + $list_len = 3; } $totalpage = ceil($this->TotalResult / $this->PageSize); - if($totalpage<=1 && $this->TotalResult>0) - { - return "
  • 共1页/".$this->TotalResult."条记录
  • "; + if ($totalpage <= 1 && $this->TotalResult > 0) { + return "
  • 共1页/" . $this->TotalResult . "条记录
  • "; } - if($this->TotalResult == 0) - { - return "
  • 共0页/".$this->TotalResult."条记录
  • "; + if ($this->TotalResult == 0) { + return "
  • 共0页/" . $this->TotalResult . "条记录
  • "; } $purl = $this->GetCurUrl(); - $geturl = "tid=".$this->TypeID."&TotalResult=".$this->TotalResult."&nativeplace=$nativeplace&infotype=$infotype&keyword=".urlencode($keyword)."&"; - $hidenform = "\r\n"; + $geturl = "tid=" . $this->TypeID . "&TotalResult=" . $this->TotalResult . "&nativeplace=$nativeplace&infotype=$infotype&keyword=" . urlencode($keyword) . "&"; + $hidenform = "\r\n"; $hidenform = "\r\n"; $hidenform = "\r\n"; $hidenform = "\r\n"; - $hidenform .= "\r\n"; - $purl .= "?".$geturl; + $hidenform .= "\r\n"; + $purl .= "?" . $geturl; //获得上一页和下一页的链接 - if($this->PageNo != 1) - { - $prepage.="
  • 上一页
  • \r\n"; - $indexpage="
  • 首页
  • \r\n"; + if ($this->PageNo != 1) { + $prepage .= "
  • 上一页
  • \r\n"; + $indexpage = "
  • 首页
  • \r\n"; + } else { + $indexpage = "
  • 首页
  • \r\n"; } - else - { - $indexpage="
  • 首页
  • \r\n"; - } - if($this->PageNo!=$totalpage && $totalpage>1) - { - $nextpage.="
  • 下一页
  • \r\n"; - $endpage="
  • 末页
  • \r\n"; - } - else - { - $endpage="
  • 末页
  • "; + if ($this->PageNo != $totalpage && $totalpage > 1) { + $nextpage .= "
  • 下一页
  • \r\n"; + $endpage = "
  • 末页
  • \r\n"; + } else { + $endpage = "
  • 末页
  • "; } //获得数字链接 - $listdd=""; + $listdd = ""; $total_list = $list_len * 2 + 1; - if($this->PageNo >= $total_list) - { + if ($this->PageNo >= $total_list) { $j = $this->PageNo - $list_len; $total_list = $this->PageNo + $list_len; - if($total_list > $totalpage) - { + if ($total_list > $totalpage) { $total_list = $totalpage; } - } - else - { - $j=1; - if($total_list > $totalpage) - { + } else { + $j = 1; + if ($total_list > $totalpage) { $total_list = $totalpage; } } - for($j; $j <= $total_list; $j++) - { - if($j == $this->PageNo) - { - $listdd.= "
  • $j
  • \r\n"; - } - else - { - $listdd.="
  • ".$j."
  • \r\n"; + for ($j; $j <= $total_list; $j++) { + if ($j == $this->PageNo) { + $listdd .= "
  • $j
  • \r\n"; + } else { + $listdd .= "
  • " . $j . "
  • \r\n"; } } - $plist = $indexpage.$prepage.$listdd.$nextpage.$endpage; + $plist = $indexpage . $prepage . $listdd . $nextpage . $endpage; return $plist; } @@ -1109,14 +963,11 @@ class SgListView */ function GetCurUrl() { - if(!empty($_SERVER["REQUEST_URI"])) - { + if (!empty($_SERVER["REQUEST_URI"])) { $nowurl = $_SERVER["REQUEST_URI"]; - $nowurls = explode("?",$nowurl); + $nowurls = explode("?", $nowurl); $nowurl = $nowurls[0]; - } - else - { + } else { $nowurl = $_SERVER["PHP_SELF"]; } return $nowurl; diff --git a/src/include/arc.sgpage.class.php b/src/include/arc.sgpage.class.php index 77518338..5087d37a 100755 --- a/src/include/arc.sgpage.class.php +++ b/src/include/arc.sgpage.class.php @@ -1,20 +1,20 @@ -dsql = $GLOBALS['dsql']; $this->dtp = new DedeTagParse(); $this->dtp->refObj = $this; - $this->dtp->SetNameSpace("dede","{","}"); + $this->dtp->SetNameSpace("dede", "{", "}"); $this->Fields = $this->dsql->GetOne("SELECT * FROM `#@__sgpage` WHERE aid='$aid' "); $envs['aid'] = $this->Fields['aid']; //设置一些全局参数的值 - foreach($GLOBALS['PubFields'] as $k=>$v) - { + foreach ($GLOBALS['PubFields'] as $k => $v) { $this->Fields[$k] = $v; } - if($this->Fields['ismake']==1) - { + if ($this->Fields['ismake'] == 1) { $pv = new PartView(); - $pv->SetTemplet($this->Fields['body'],'string'); + $pv->SetTemplet($this->Fields['body'], 'string'); $this->Fields['body'] = $pv->GetResult(); } - $tplfile = $cfg_basedir.str_replace('{style}',$cfg_templets_dir.'/'.$cfg_df_style,$this->Fields['template']); + $tplfile = $cfg_basedir . str_replace('{style}', $cfg_templets_dir . '/' . $cfg_df_style, $this->Fields['template']); $this->dtp->LoadTemplate($tplfile); $this->ParseTemplet(); } @@ -96,7 +94,7 @@ class sgpage */ function SaveToHtml() { - $filename = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_cmspath'].'/'.$this->Fields['filename']; + $filename = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_cmspath'] . '/' . $this->Fields['filename']; $filename = preg_replace("/\/{1,}/", '/', $filename); $this->dtp->SaveTo($filename); } @@ -110,7 +108,7 @@ class sgpage function ParseTemplet() { $GLOBALS['envs']['likeid'] = $this->Fields['likeid']; - MakeOneTag($this->dtp,$this); + MakeOneTag($this->dtp, $this); } //关闭所占用的资源 diff --git a/src/include/arc.specview.class.php b/src/include/arc.specview.class.php index 2197c924..b88a109d 100755 --- a/src/include/arc.specview.class.php +++ b/src/include/arc.specview.class.php @@ -1,24 +1,24 @@ -TypeID = 0; $this->dsql = $GLOBALS['dsql']; $this->dtp = new DedeTagParse(); $this->dtp->SetRefObj($this); - $this->dtp->SetNameSpace("dede","{","}"); + $this->dtp->SetNameSpace("dede", "{", "}"); $this->dtp2 = new DedeTagParse(); - $this->dtp2->SetNameSpace("field","[","]"); + $this->dtp2->SetNameSpace("field", "[", "]"); $this->TypeLink = new TypeLink(0); $this->ChannelUnit = new ChannelUnit(-1); $this->ftp = &$ftp; $this->remoteDir = ''; //设置一些全局参数的值 - foreach($GLOBALS['PubFields'] as $k=>$v) - { + foreach ($GLOBALS['PubFields'] as $k => $v) { $this->Fields[$k] = $v; } - if($starttime==0) - { + if ($starttime == 0) { $this->StartTime = 0; - } - else - { + } else { $this->StartTime = GetMkTime($starttime); } $this->CountRecord(); - $tempfile = $GLOBALS['cfg_basedir'].$GLOBALS['cfg_templets_dir']."/".$GLOBALS['cfg_df_style']."/list_spec.htm"; - if(!file_exists($tempfile)||!is_file($tempfile)) - { + $tempfile = $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_templets_dir'] . "/" . $GLOBALS['cfg_df_style'] . "/list_spec.htm"; + if (!file_exists($tempfile) || !is_file($tempfile)) { echo "模板文件不存在,无法解析文档!"; exit(); } @@ -86,26 +81,20 @@ class SpecView $this->TempInfos['tags'] = $this->dtp->CTags; $this->TempInfos['source'] = $this->dtp->SourceString; $ctag = $this->dtp->GetTag("page"); - if(!is_object($ctag)) - { + if (!is_object($ctag)) { $this->PageSize = 20; - } - else - { - if($ctag->GetAtt("pagesize")!="") - { + } else { + if ($ctag->GetAtt("pagesize") != "") { $this->PageSize = $ctag->GetAtt("pagesize"); - } - else - { + } else { $this->PageSize = 20; } } - $this->TotalPage = ceil($this->TotalResult/$this->PageSize); + $this->TotalPage = ceil($this->TotalResult / $this->PageSize); } //php4构造函数 - function SpecView($starttime=0) + function SpecView($starttime = 0) { $this->__construct($starttime); } @@ -124,35 +113,24 @@ class SpecView function CountRecord() { $this->TotalResult = -1; - if(isset($GLOBALS['TotalResult'])) - { + if (isset($GLOBALS['TotalResult'])) { $this->TotalResult = $GLOBALS['TotalResult']; } - if(isset($GLOBALS['PageNo'])) - { + if (isset($GLOBALS['PageNo'])) { $this->PageNo = $GLOBALS['PageNo']; - } - else - { + } else { $this->PageNo = 1; } - if($this->TotalResult==-1) - { - if($this->StartTime>0) - { - $timesql = " AND #@__archives.senddate>'".$this->StartTime."'"; - } - else - { + if ($this->TotalResult == -1) { + if ($this->StartTime > 0) { + $timesql = " AND #@__archives.senddate>'" . $this->StartTime . "'"; + } else { $timesql = ""; } $row = $this->dsql->GetOne("SELECT count(*) AS dd FROM #@__archives WHERE #@__archives.arcrank > -1 AND channel=-1 $timesql"); - if(is_array($row)) - { + if (is_array($row)) { $this->TotalResult = $row['dd']; - } - else - { + } else { $this->TotalResult = 0; } } @@ -166,47 +144,42 @@ class SpecView */ function Display() { - if(isset($this->TypeLink->TypeInfos) && ($this->TypeLink->TypeInfos['ispart']==1 - ||$this->TypeLink->TypeInfos['ispart']==2)) - { + if (isset($this->TypeLink->TypeInfos) && ($this->TypeLink->TypeInfos['ispart'] == 1 + || $this->TypeLink->TypeInfos['ispart'] == 2)) { $this->DisplayPartTemplets(); } $this->ParseTempletsFirst(); - foreach($this->dtp->CTags as $tagid=>$ctag) - { - if($ctag->GetName()=="list") - { - $limitstart = ($this->PageNo-1) * $this->PageSize; + foreach ($this->dtp->CTags as $tagid => $ctag) { + if ($ctag->GetName() == "list") { + $limitstart = ($this->PageNo - 1) * $this->PageSize; $row = $this->PageSize; - if(trim($ctag->GetInnerText())=="") - { + if (trim($ctag->GetInnerText()) == "") { $InnerText = GetSysTemplets("list_fulllist.htm"); - } - else - { + } else { $InnerText = trim($ctag->GetInnerText()); } - $this->dtp->Assign($tagid, - $this->GetArcList($limitstart,$row, - $ctag->GetAtt("col"), - $ctag->GetAtt("titlelen"), - $ctag->GetAtt("infolen"), - $ctag->GetAtt("imgwidth"), - $ctag->GetAtt("imgheight"), - $ctag->GetAtt("listtype"), - $ctag->GetAtt("orderby"), - $InnerText, - $ctag->GetAtt("tablewidth")) + $this->dtp->Assign( + $tagid, + $this->GetArcList( + $limitstart, + $row, + $ctag->GetAtt("col"), + $ctag->GetAtt("titlelen"), + $ctag->GetAtt("infolen"), + $ctag->GetAtt("imgwidth"), + $ctag->GetAtt("imgheight"), + $ctag->GetAtt("listtype"), + $ctag->GetAtt("orderby"), + $InnerText, + $ctag->GetAtt("tablewidth") + ) ); - } - else if($ctag->GetName()=="pagelist") - { + } else if ($ctag->GetName() == "pagelist") { $list_len = trim($ctag->GetAtt("listsize")); - if($list_len=="") - { + if ($list_len == "") { $list_len = 3; } - $this->dtp->Assign($tagid,$this->GetPageListDM($list_len)); + $this->dtp->Assign($tagid, $this->GetPageListDM($list_len)); } } $this->dtp->Display(); @@ -219,65 +192,59 @@ class SpecView * @param int $isremote 是否远程 * @return string */ - function MakeHtml($isremote=0) + function MakeHtml($isremote = 0) { //初步给固定值的标记赋值 $this->ParseTempletsFirst(); $totalpage = ceil($this->TotalResult / $this->PageSize); - if($totalpage==0) - { + if ($totalpage == 0) { $totalpage = 1; } CreateDir($GLOBALS['cfg_special']); $murl = ""; - for($this->PageNo=1;$this->PageNo<=$totalpage;$this->PageNo++) - { - foreach($this->dtp->CTags as $tagid=>$ctag) - { - if($ctag->GetName()=="list") - { - $limitstart = ($this->PageNo-1) * $this->PageSize; + for ($this->PageNo = 1; $this->PageNo <= $totalpage; $this->PageNo++) { + foreach ($this->dtp->CTags as $tagid => $ctag) { + if ($ctag->GetName() == "list") { + $limitstart = ($this->PageNo - 1) * $this->PageSize; $row = $this->PageSize; - if(trim($ctag->GetInnerText())=="") - { + if (trim($ctag->GetInnerText()) == "") { $InnerText = GetSysTemplets("spec_list.htm"); - } - else - { + } else { $InnerText = trim($ctag->GetInnerText()); } - $this->dtp->Assign($tagid, - $this->GetArcList($limitstart,$row, - $ctag->GetAtt("col"), - $ctag->GetAtt("titlelen"), - $ctag->GetAtt("infolen"), - $ctag->GetAtt("imgwidth"), - $ctag->GetAtt("imgheight"), - "spec", - $ctag->GetAtt("orderby"), - $InnerText, - $ctag->GetAtt("tablewidth")) + $this->dtp->Assign( + $tagid, + $this->GetArcList( + $limitstart, + $row, + $ctag->GetAtt("col"), + $ctag->GetAtt("titlelen"), + $ctag->GetAtt("infolen"), + $ctag->GetAtt("imgwidth"), + $ctag->GetAtt("imgheight"), + "spec", + $ctag->GetAtt("orderby"), + $InnerText, + $ctag->GetAtt("tablewidth") + ) ); - } - else if($ctag->GetName()=="pagelist") - { + } else if ($ctag->GetName() == "pagelist") { $list_len = trim($ctag->GetAtt("listsize")); - if($list_len=="") - { + if ($list_len == "") { $list_len = 3; } - $this->dtp->Assign($tagid,$this->GetPageListST($list_len)); + $this->dtp->Assign($tagid, $this->GetPageListST($list_len)); } - }//End foreach + } //End foreach - $makeFile = $GLOBALS['cfg_special']."/spec_".$this->PageNo.$GLOBALS['art_shortname']; + $makeFile = $GLOBALS['cfg_special'] . "/spec_" . $this->PageNo . $GLOBALS['art_shortname']; $murl = $makeFile; - $makeFile = $GLOBALS['cfg_basedir'].$makeFile; + $makeFile = $GLOBALS['cfg_basedir'] . $makeFile; $this->dtp->SaveTo($makeFile); echo "成功创建:$murl
    "; } - copy($GLOBALS['cfg_basedir'].$GLOBALS['cfg_special']."/spec_1".$GLOBALS['art_shortname'],$GLOBALS['cfg_basedir'].$GLOBALS['cfg_special']."/index.html"); - $murl = $GLOBALS['cfg_special']."/index.html"; + copy($GLOBALS['cfg_basedir'] . $GLOBALS['cfg_special'] . "/spec_1" . $GLOBALS['art_shortname'], $GLOBALS['cfg_basedir'] . $GLOBALS['cfg_special'] . "/index.html"); + $murl = $GLOBALS['cfg_special'] . "/index.html"; return $murl; } @@ -289,7 +256,7 @@ class SpecView */ function ParseTempletsFirst() { - MakeOneTag($this->dtp,$this); + MakeOneTag($this->dtp, $this); } /** @@ -309,88 +276,77 @@ class SpecView * @param string $tablewidth 表格宽度 * @return string */ - function GetArcList($limitstart=0,$row=10,$col=1,$titlelen=30,$infolen=250, - $imgwidth=120,$imgheight=90,$listtype="all",$orderby="default",$innertext="",$tablewidth="100") - { - $typeid=$this->TypeID; - if($row=="") - { + function GetArcList( + $limitstart = 0, + $row = 10, + $col = 1, + $titlelen = 30, + $infolen = 250, + $imgwidth = 120, + $imgheight = 90, + $listtype = "all", + $orderby = "default", + $innertext = "", + $tablewidth = "100" + ) { + $typeid = $this->TypeID; + if ($row == "") { $row = 10; } - if($limitstart=="") - { + if ($limitstart == "") { $limitstart = 0; } - if($titlelen=="") - { + if ($titlelen == "") { $titlelen = 30; } - if($infolen=="") - { + if ($infolen == "") { $infolen = 250; } - if($imgwidth=="") - { + if ($imgwidth == "") { $imgwidth = 120; } - if($imgheight=="") - { + if ($imgheight == "") { $imgheight = 120; } - if($listtype=="") - { + if ($listtype == "") { $listtype = "all"; } - if($orderby=="") - { - $orderby="default"; - } - else - { - $orderby=strtolower($orderby); + if ($orderby == "") { + $orderby = "default"; + } else { + $orderby = strtolower($orderby); } $tablewidth = str_replace("%", "", $tablewidth); - if($tablewidth=="") - { - $tablewidth=100; + if ($tablewidth == "") { + $tablewidth = 100; } - if($col=="") - { - $col=1; + if ($col == "") { + $col = 1; } - $colWidth = ceil(100/$col); - $tablewidth = $tablewidth."%"; - $colWidth = $colWidth."%"; + $colWidth = ceil(100 / $col); + $tablewidth = $tablewidth . "%"; + $colWidth = $colWidth . "%"; $innertext = trim($innertext); - if($innertext=="") - { + if ($innertext == "") { $innertext = GetSysTemplets("spec_list.htm"); } //按不同情况设定SQL条件 $orwhere = " arc.arcrank > -1 AND arc.channel = -1 "; - if($this->StartTime>0) - { - $orwhere .= " AND arc.senddate>'".$this->StartTime."'"; + if ($this->StartTime > 0) { + $orwhere .= " AND arc.senddate>'" . $this->StartTime . "'"; } //排序方式 $ordersql = ''; - if($orderby=='senddate') - { - $ordersql=" ORDER BY arc.senddate desc"; - } - else if($orderby=='pubdate') - { - $ordersql=" ORDER BY arc.pubdate desc"; - } - else if($orderby=='id') - { - $ordersql=" ORDER BY arc.id desc"; - } - else - { - $ordersql=" ORDER BY arc.sortrank desc"; + if ($orderby == 'senddate') { + $ordersql = " ORDER BY arc.senddate desc"; + } else if ($orderby == 'pubdate') { + $ordersql = " ORDER BY arc.pubdate desc"; + } else if ($orderby == 'id') { + $ordersql = " ORDER BY arc.id desc"; + } else { + $ordersql = " ORDER BY arc.sortrank desc"; } $query = "SELECT arc.*,tp.typedir,tp.typename,tp.isdefault,arc.money, tp.defaultname,tp.namerule,tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath @@ -399,103 +355,94 @@ class SpecView $this->dsql->SetQuery($query); $this->dsql->Execute('al'); $artlist = ''; - if($col>1) - { + if ($col > 1) { $artlist = "\r\n"; } $this->dtp2->LoadSource($innertext); - for($i=0;$i<$row;$i++) - { - if($col>1) - { + for ($i = 0; $i < $row; $i++) { + if ($col > 1) { $artlist .= "\r\n"; } - for($j=0;$j<$col;$j++) - { - if($col>1) - { + for ($j = 0; $j < $col; $j++) { + if ($col > 1) { $artlist .= "\r\n"; } - }//Loop Col + } //Loop Col - if($col>1) - { + if ($col > 1) { $artlist .= "\r\n"; } - }//Loop Line + } //Loop Line - if($col>1) - { + if ($col > 1) { $artlist .= "
    \r\n"; } - if($row = $this->dsql->GetArray("al")) - { + if ($row = $this->dsql->GetArray("al")) { //处理一些特殊字段 - $row["description"] = cn_substr($row["description"],$infolen); - $row["title"] = cn_substr($row["title"],$titlelen); + $row["description"] = cn_substr($row["description"], $infolen); + $row["title"] = cn_substr($row["title"], $titlelen); $row["id"] = $row["id"]; - if($row['litpic'] == '-' || $row['litpic'] == '') - { - $row['litpic'] = $GLOBALS['cfg_cmspath'].'/static/defaultpic.gif'; + if ($row['litpic'] == '-' || $row['litpic'] == '') { + $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/static/defaultpic.gif'; } - if(!preg_match("/^http:\/\//", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') - { - $row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic']; + if (!preg_match("/^http:\/\//", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { + $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic']; } $row['picname'] = $row['litpic']; - $row["arcurl"] = GetFileUrl($row["id"],$row["typeid"],$row["senddate"],$row["title"], - $row["ismake"],$row["arcrank"],$row["namerule"],$row["typedir"],$row["money"],$row['filename'],$row["moresite"],$row["siteurl"],$row["sitepath"]); - $row["typeurl"] = GetTypeUrl($row["typeid"],$row["typedir"],$row["isdefault"],$row["defaultname"],$row["ispart"],$row["namerule2"],$row["moresite"],$row["siteurl"],$row["sitepath"]); + $row["arcurl"] = GetFileUrl( + $row["id"], + $row["typeid"], + $row["senddate"], + $row["title"], + $row["ismake"], + $row["arcrank"], + $row["namerule"], + $row["typedir"], + $row["money"], + $row['filename'], + $row["moresite"], + $row["siteurl"], + $row["sitepath"] + ); + $row["typeurl"] = GetTypeUrl($row["typeid"], $row["typedir"], $row["isdefault"], $row["defaultname"], $row["ispart"], $row["namerule2"], $row["moresite"], $row["siteurl"], $row["sitepath"]); $row["info"] = $row["description"]; $row["filename"] = $row["arcurl"]; $row["stime"] = GetDateMK($row["pubdate"]); - $row["textlink"] = "".$row["title"].""; - $row["typelink"] = "[".$row["typename"]."]"; - $row["imglink"] = ""; - $row["image"] = ""; + $row["textlink"] = "" . $row["title"] . ""; + $row["typelink"] = "[" . $row["typename"] . "]"; + $row["imglink"] = ""; + $row["image"] = ""; $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl']; $row['memberurl'] = $GLOBALS['cfg_memberurl']; $row['templeturl'] = $GLOBALS['cfg_templeturl']; //编译附加表里的数据 - foreach($this->ChannelUnit->ChannelFields as $k=>$arr) - { - if(isset($row[$k])) - { - $row[$k] = $this->ChannelUnit->MakeField($k,$row[$k]); + foreach ($this->ChannelUnit->ChannelFields as $k => $arr) { + if (isset($row[$k])) { + $row[$k] = $this->ChannelUnit->MakeField($k, $row[$k]); } } - if(is_array($this->dtp2->CTags)) - { - foreach($this->dtp2->CTags as $k=>$ctag) - { - if($ctag->GetName()=='array') - { + if (is_array($this->dtp2->CTags)) { + foreach ($this->dtp2->CTags as $k => $ctag) { + if ($ctag->GetName() == 'array') { //传递整个数组,在runphp模式中有特殊作用 - $this->dtp2->Assign($k,$row); - } - else - { - if(isset($row[$ctag->GetName()])) - { - $this->dtp2->Assign($k,$row[$ctag->GetName()]); - } - else - { - $this->dtp2->Assign($k,''); + $this->dtp2->Assign($k, $row); + } else { + if (isset($row[$ctag->GetName()])) { + $this->dtp2->Assign($k, $row[$ctag->GetName()]); + } else { + $this->dtp2->Assign($k, ''); } } } } $artlist .= $this->dtp2->GetResult(); - }//if hasRow + } //if hasRow - else - { + else { $artlist .= ""; } - if($col>1) - { + if ($col > 1) { $artlist .= "
    \r\n"; } $this->dsql->FreeResult("al"); @@ -511,79 +458,61 @@ class SpecView */ function GetPageListST($list_len) { - $prepage=""; - $nextpage=""; + $prepage = ""; + $nextpage = ""; $prepagenum = $this->PageNo - 1; $nextpagenum = $this->PageNo + 1; - if($list_len=="" || preg_match("/[^0-9]/", $list_len)) - { - $list_len=3; + if ($list_len == "" || preg_match("/[^0-9]/", $list_len)) { + $list_len = 3; } $totalpage = ceil($this->TotalResult / $this->PageSize); - if($totalpage <= 1 && $this->TotalResult > 0) - { + if ($totalpage <= 1 && $this->TotalResult > 0) { - return "1".$this->TotalResult."条记录"; + return "1" . $this->TotalResult . "条记录"; } - if($this->TotalResult == 0) - { - return "0".$this->TotalResult."条记录"; + if ($this->TotalResult == 0) { + return "0" . $this->TotalResult . "条记录"; } $purl = $this->GetCurUrl(); $tnamerule = "spec_"; //获得上一页和下一页的链接 - if($this->PageNo != 1) - { - $prepage.="
  • 上一页
  • \r\n"; - $indexpage="
  • 首页
  • \r\n"; - } - else - { - $indexpage="
  • 首页
  • \r\n"; - } - if($this->PageNo!=$totalpage && $totalpage>1) - { - $nextpage.="
  • 下一页
  • \r\n"; - $endpage="
  • 末页
  • \r\n"; - } - else - { - $endpage="
  • 末页
  • \r\n"; + if ($this->PageNo != 1) { + $prepage .= "
  • 上一页
  • \r\n"; + $indexpage = "
  • 首页
  • \r\n"; + } else { + $indexpage = "
  • 首页
  • \r\n"; + } + if ($this->PageNo != $totalpage && $totalpage > 1) { + $nextpage .= "
  • 下一页
  • \r\n"; + $endpage = "
  • 末页
  • \r\n"; + } else { + $endpage = "
  • 末页
  • \r\n"; } //获得数字链接 - $listdd=""; + $listdd = ""; $total_list = $list_len * 2 + 1; - if($this->PageNo >= $total_list) - { + if ($this->PageNo >= $total_list) { $j = $this->PageNo - $list_len; $total_list = $this->PageNo + $list_len; - if($total_list > $totalpage) - { + if ($total_list > $totalpage) { $total_list = $totalpage; } - } - else - { - $j=1; - if($total_list > $totalpage) - { + } else { + $j = 1; + if ($total_list > $totalpage) { $total_list = $totalpage; } } - for($j; $j<=$total_list; $j++) - { - if($j == $this->PageNo) - { - $listdd.= "
  • $j
  • \r\n"; - } - else - { - $listdd.="
  • ".$j."
  • \r\n"; + for ($j; $j <= $total_list; $j++) { + if ($j == $this->PageNo) { + $listdd .= "
  • $j
  • \r\n"; + } else { + $listdd .= "
  • " . $j . "
  • \r\n"; } } - $plist = $indexpage.$prepage.$listdd.$nextpage.$endpage; + $plist = $indexpage . $prepage . $listdd . $nextpage . $endpage; return $plist; } @@ -594,86 +523,68 @@ class SpecView * @param int $list_len 列表宽度 * @return string */ - + function GetPageListDM($list_len) { - $prepage=""; - $nextpage=""; + $prepage = ""; + $nextpage = ""; $prepagenum = $this->PageNo - 1; $nextpagenum = $this->PageNo + 1; - if($list_len=="" || preg_match("/[^0-9]/", $list_len)) - { - $list_len=3; + if ($list_len == "" || preg_match("/[^0-9]/", $list_len)) { + $list_len = 3; } $totalpage = ceil($this->TotalResult / $this->PageSize); - if($totalpage <= 1 && $this->TotalResult > 0) - { - return "共1页/".$this->TotalResult."条记录"; + if ($totalpage <= 1 && $this->TotalResult > 0) { + return "共1页/" . $this->TotalResult . "条记录"; } - if($this->TotalResult == 0) - { - return "共0页/".$this->TotalResult."条记录"; + if ($this->TotalResult == 0) { + return "共0页/" . $this->TotalResult . "条记录"; } $purl = $this->GetCurUrl(); - $geturl = "typeid=".$this->TypeID."&TotalResult=".$this->TotalResult."&"; - $hidenform = "\r\n"; - $hidenform .= "\r\n"; - $purl .= "?".$geturl; + $geturl = "typeid=" . $this->TypeID . "&TotalResult=" . $this->TotalResult . "&"; + $hidenform = "\r\n"; + $hidenform .= "\r\n"; + $purl .= "?" . $geturl; //获得上一页和下一页的链接 - if($this->PageNo != 1) - { - $prepage.="
  • 上一页
  • \r\n"; - $indexpage="
  • 首页
  • \r\n"; - } - else - { - $indexpage="
  • 首页
  • \r\n"; - } - if($this->PageNo != $totalpage && $totalpage>1) - { - $nextpage.="
  • 下一页
  • \r\n"; - $endpage="
  • 末页
  • \r\n"; - } - else - { - $endpage="
  • 末页
  • "; + if ($this->PageNo != 1) { + $prepage .= "
  • 上一页
  • \r\n"; + $indexpage = "
  • 首页
  • \r\n"; + } else { + $indexpage = "
  • 首页
  • \r\n"; + } + if ($this->PageNo != $totalpage && $totalpage > 1) { + $nextpage .= "
  • 下一页
  • \r\n"; + $endpage = "
  • 末页
  • \r\n"; + } else { + $endpage = "
  • 末页
  • "; } //获得数字链接 $listdd = ""; $total_list = $list_len * 2 + 1; - if($this->PageNo >= $total_list) - { + if ($this->PageNo >= $total_list) { $j = $this->PageNo - $list_len; $total_list = $this->PageNo + $list_len; - if($total_list > $totalpage) - { + if ($total_list > $totalpage) { $total_list = $totalpage; } - } - else - { - $j=1; - if($total_list > $totalpage) - { + } else { + $j = 1; + if ($total_list > $totalpage) { $total_list = $totalpage; } } - for($j; $j<=$total_list; $j++) - { - if($j == $this->PageNo) - { - $listdd.= "
  • $j
  • \r\n"; - } - else - { - $listdd.="
  • ".$j."
  • \r\n"; + for ($j; $j <= $total_list; $j++) { + if ($j == $this->PageNo) { + $listdd .= "
  • $j
  • \r\n"; + } else { + $listdd .= "
  • " . $j . "
  • \r\n"; } } - $plist = $indexpage.$prepage.$listdd.$nextpage.$endpage; + $plist = $indexpage . $prepage . $listdd . $nextpage . $endpage; return $plist; } @@ -685,14 +596,11 @@ class SpecView */ function GetCurUrl() { - if(!empty($_SERVER["REQUEST_URI"])) - { + if (!empty($_SERVER["REQUEST_URI"])) { $nowurl = $_SERVER["REQUEST_URI"]; - $nowurls = explode("?",$nowurl); + $nowurls = explode("?", $nowurl); $nowurl = $nowurls[0]; - } - else - { + } else { $nowurl = $_SERVER["PHP_SELF"]; } return $nowurl; diff --git a/src/include/arc.taglist.class.php b/src/include/arc.taglist.class.php index 2382d05e..553cd39d 100755 --- a/src/include/arc.taglist.class.php +++ b/src/include/arc.taglist.class.php @@ -3,7 +3,7 @@ * Tag列表类 * * @version $Id: arc.taglist.class.php 1 18:17 2010年7月7日Z tianya $ - * @package DedeCMS.Libraries + * @package DedeBIZ.Libraries * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -17,7 +17,7 @@ require_once(DEDEINC . '/typelink.class.php'); * Tag列表类 * * @package TagList - * @subpackage DedeCMS.Libraries + * @subpackage DedeBIZ.Libraries * @link https://www.dedebiz.com */ class TagList diff --git a/src/include/autoload.inc.php b/src/include/autoload.inc.php index 921446ff..e99b408f 100755 --- a/src/include/autoload.inc.php +++ b/src/include/autoload.inc.php @@ -2,7 +2,7 @@ if(!defined('DEDEINC')) exit("Request Error!"); /** * @version $Id: autoload.inc.php 1 17:44 2020-09-22 tianya $ - * @package DedeCMS.Libraries + * @package DedeBIZ.Libraries * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -41,4 +41,3 @@ function __autoload($classname) } } } -?> \ No newline at end of file diff --git a/src/include/autoload7.inc.php b/src/include/autoload7.inc.php index 78b020e5..ae1c3f11 100755 --- a/src/include/autoload7.inc.php +++ b/src/include/autoload7.inc.php @@ -2,7 +2,7 @@ if(!defined('DEDEINC')) exit("Request Error!"); /** * @version $Id: autoload7.inc.php 1 17:44 2020-09-22 tianya $ - * @package DedeCMS.Libraries + * @package DedeBIZ.Libraries * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -42,4 +42,3 @@ function dede_autoloader($classname) } } spl_autoload_register('dede_autoloader'); -?> \ No newline at end of file diff --git a/src/include/channelunit.class.php b/src/include/channelunit.class.php index a544da07..8ebdcc2f 100755 --- a/src/include/channelunit.class.php +++ b/src/include/channelunit.class.php @@ -1,14 +1,14 @@ -ChannelInfos = ''; $this->ChannelFields = array(); @@ -35,45 +35,35 @@ class ChannelUnit $this->dsql = $GLOBALS['dsql']; $sql = " SELECT * FROM `#@__channeltype` WHERE id='$cid' "; $this->ChannelInfos = $this->dsql->GetOne($sql); - if(!is_array($this->ChannelInfos)) - { + if (!is_array($this->ChannelInfos)) { echo '读取频道信息失败,无法进行后续操作!'; exit(); } $dtp = new DedeTagParse(); - $dtp->SetNameSpace('field','<','>'); + $dtp->SetNameSpace('field', '<', '>'); $dtp->LoadSource($this->ChannelInfos['fieldset']); - if(is_array($dtp->CTags)) - { - $tnames = Array(); - foreach($dtp->CTags as $ctag) - { + if (is_array($dtp->CTags)) { + $tnames = array(); + foreach ($dtp->CTags as $ctag) { $tname = $ctag->GetName(); - if(isset($tnames[$tname])) - { + if (isset($tnames[$tname])) { break; } $tnames[$tname] = 1; - if($this->AllFieldNames!='') - { - $this->AllFieldNames .= ','.$tname; - } - else - { + if ($this->AllFieldNames != '') { + $this->AllFieldNames .= ',' . $tname; + } else { $this->AllFieldNames .= $tname; } - if(is_array($ctag->CAttribute->Items)) - { + if (is_array($ctag->CAttribute->Items)) { $this->ChannelFields[$tname] = $ctag->CAttribute->Items; } $this->ChannelFields[$tname]['value'] = ''; $this->ChannelFields[$tname]['innertext'] = $ctag->GetInnerText(); - if(empty($this->ChannelFields[$tname]['itemname'])) - { + if (empty($this->ChannelFields[$tname]['itemname'])) { $this->ChannelFields[$tname]['itemname'] = $tname; } - if($ctag->GetAtt('page')=='split') - { + if ($ctag->GetAtt('page') == 'split') { $this->SplitPageField = $tname; } } @@ -81,9 +71,9 @@ class ChannelUnit $dtp->Clear(); } - function ChannelUnit($cid,$aid=0) + function ChannelUnit($cid, $aid = 0) { - $this->__construct($cid,$aid); + $this->__construct($cid, $aid); } /** @@ -107,49 +97,39 @@ class ChannelUnit * @param string $addvalue 增加值 * @return string */ - function MakeField($fname, $fvalue, $addvalue='') - { + function MakeField($fname, $fvalue, $addvalue = '') + { //处理各种数据类型 $ftype = $this->ChannelFields[$fname]['type']; - if($fvalue=='') - { - if($ftype != 'checkbox') $fvalue = $this->ChannelFields[$fname]['default']; + if ($fvalue == '') { + if ($ftype != 'checkbox') $fvalue = $this->ChannelFields[$fname]['default']; } - if($ftype=='text') - { + if ($ftype == 'text') { $fvalue = HtmlReplace($fvalue); - } - else if($ftype=='textdata') - { - if(!is_file($GLOBALS['cfg_basedir'].$fvalue)) - { + } else if ($ftype == 'textdata') { + if (!is_file($GLOBALS['cfg_basedir'] . $fvalue)) { return ''; } - $fp = fopen($GLOBALS['cfg_basedir'].$fvalue,'r'); + $fp = fopen($GLOBALS['cfg_basedir'] . $fvalue, 'r'); $fvalue = ''; - while(!feof($fp)) - { - $fvalue .= fgets($fp,1024); + while (!feof($fp)) { + $fvalue .= fgets($fp, 1024); } fclose($fp); - } - else if($ftype=='addon') - { + } else if ($ftype == 'addon') { $foldvalue = $fvalue; $tmptext = GetSysTemplets("channel_addon.htm"); - $fvalue = str_replace('~link~',$foldvalue,$tmptext); - $fvalue = str_replace('~phpurl~',$GLOBALS['cfg_phpurl'],$fvalue); - } - else if(file_exists(DEDEINC.'/taglib/channel/'.$ftype.'.lib.php')) - { - include_once(DEDEINC.'/taglib/channel/'.$ftype.'.lib.php'); - $func = 'ch_'.$ftype; - $fvalue = $func($fvalue,$addvalue,$this,$fname); + $fvalue = str_replace('~link~', $foldvalue, $tmptext); + $fvalue = str_replace('~phpurl~', $GLOBALS['cfg_phpurl'], $fvalue); + } else if (file_exists(DEDEINC . '/taglib/channel/' . $ftype . '.lib.php')) { + include_once(DEDEINC . '/taglib/channel/' . $ftype . '.lib.php'); + $func = 'ch_' . $ftype; + $fvalue = $func($fvalue, $addvalue, $this, $fname); } return $fvalue; } - + /** * 获取缩略图链接 * @@ -159,76 +139,74 @@ class ChannelUnit */ function GetlitImgLinks($fvalue) { - if($GLOBALS["htmltype"]=="dm"){ - if(empty($GLOBALS["pageno"])) $NowPage = 1; + if ($GLOBALS["htmltype"] == "dm") { + if (empty($GLOBALS["pageno"])) $NowPage = 1; else $NowPage = intval($GLOBALS["pageno"]); - }else{ - if(empty($GLOBALS["stNowPage"])) $NowPage = 1; + } else { + if (empty($GLOBALS["stNowPage"])) $NowPage = 1; else $NowPage = intval($GLOBALS["stNowPage"]); } - + $revalue = ""; $dtp = new DedeTagParse(); $dtp->LoadSource($fvalue); - if(!is_array($dtp->CTags)){ + if (!is_array($dtp->CTags)) { $dtp->Clear(); return "无图片信息!"; } $ptag = $dtp->GetTag("pagestyle"); - if(is_object($ptag)){ + if (is_object($ptag)) { $pagestyle = $ptag->GetAtt('value'); $maxwidth = $ptag->GetAtt('maxwidth'); $ddmaxwidth = $ptag->GetAtt('ddmaxwidth'); $irow = $ptag->GetAtt('row'); $icol = $ptag->GetAtt('col'); - if(empty($maxwidth)) $maxwidth = $GLOBALS['cfg_album_width']; - }else{ + if (empty($maxwidth)) $maxwidth = $GLOBALS['cfg_album_width']; + } else { $pagestyle = 2; $maxwidth = $GLOBALS['cfg_album_width']; $ddmaxwidth = 200; } - if($pagestyle == 3){ - if(empty($irow)) $irow = 4; - if(empty($icol)) $icol = 4; + if ($pagestyle == 3) { + if (empty($irow)) $irow = 4; + if (empty($icol)) $icol = 4; } $mrow = 0; $mcol = 0; $photoid = 1; $images = array(); $TotalPhoto = sizeof($dtp->CTags); - - foreach($dtp->CTags as $ctag){ - if($ctag->GetName()=="img") - { + + foreach ($dtp->CTags as $ctag) { + if ($ctag->GetName() == "img") { $iw = $ctag->GetAtt('width'); $ih = $ctag->GetAtt('heigth'); - $alt = str_replace("'","",$ctag->GetAtt('text')); + $alt = str_replace("'", "", $ctag->GetAtt('text')); $src = trim($ctag->GetInnerText()); $ddimg = $ctag->GetAtt('ddimg'); - if($iw > $maxwidth) $iw = $maxwidth; + if ($iw > $maxwidth) $iw = $maxwidth; $iw = (empty($iw) ? "" : "width='$iw'"); - if($GLOBALS["htmltype"]=="dm") { + if ($GLOBALS["htmltype"] == "dm") { $imgurl = "view.php?aid=$this->ArcID&pageno=$photoid"; - }else{ - if($photoid==1){ - $imgurl = $GLOBALS["fileFirst"].".html"; - }else{ - $imgurl = $GLOBALS["fileFirst"]."_".$photoid.".html"; + } else { + if ($photoid == 1) { + $imgurl = $GLOBALS["fileFirst"] . ".html"; + } else { + $imgurl = $GLOBALS["fileFirst"] . "_" . $photoid . ".html"; } } - $imgcls = "image".($photoid-1); + $imgcls = "image" . ($photoid - 1); $revalue .= "
    $alt
    $ddimg
    $ddimg
    $ddimg
    $photoid
    \r\n"; $photoid++; - } - } + } + } unset($dtp); unset($images); - return $revalue; + return $revalue; } //关闭所占用的资源 function Close() { } - }//End class ChannelUnit \ No newline at end of file diff --git a/src/include/channelunit.func.php b/src/include/channelunit.func.php index 874242d4..d167d92c 100755 --- a/src/include/channelunit.func.php +++ b/src/include/channelunit.func.php @@ -1,29 +1,29 @@ -=')) { if (!function_exists('mysql_connect') and function_exists('mysqli_connect')) { diff --git a/src/include/common.inc.php b/src/include/common.inc.php index fec4318f..6e6805d9 100755 --- a/src/include/common.inc.php +++ b/src/include/common.inc.php @@ -2,7 +2,7 @@ /** * @version $Id: common.inc.php 3 17:44 2010-11-23 tianya $ - * @package DedeCMS.Libraries + * @package DedeBIZ.Libraries * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/include/customfields.func.php b/src/include/customfields.func.php index 496e5d8e..cfc7d008 100755 --- a/src/include/customfields.func.php +++ b/src/include/customfields.func.php @@ -1,13 +1,13 @@ -GetName(); $fieldType = $ctag->GetAtt('type'); $formitem = $formitem = GetSysTemplets("custom_fields_{$admintype}.htm"); $innertext = trim($ctag->GetInnerText()); - if($innertext!='') - { + if ($innertext != '') { $formitem = $innertext; } - - if($fieldType=='select') - { + + if ($fieldType == 'select') { $myformItem = ''; - $items = explode(',',$ctag->GetAtt("default")); + $items = explode(',', $ctag->GetAtt("default")); $myformItem = "\r\n"; $innertext = $myformItem; - } - else if($fieldType=='stepselect') - { - global $hasSetEnumJs,$cfg_cmspath; - $cmspath = ( (empty($cfg_cmspath) || !preg_match('/[/$]/', $cfg_cmspath)) ? $cfg_cmspath.'/' : $cfg_cmspath ); - $myformItem = ''; - $myformItem .= "\r\n"; - $myformItem .= "\r\n"; - $myformItem .= "\r\n"; - $myformItem .= "\r\n"; - if($hasSetEnumJs != 'hasset') - { - $myformItem .= ''."\r\n"; - $GLOBALS['hasSetEnumJs'] = 'hasset'; - } - $myformItem .= "\r\n"; - $myformItem .= ''."\r\n"; - $formitem = str_replace('~name~', $ctag->GetAtt('itemname'), $formitem); - $formitem = str_replace('~form~', $myformItem, $formitem); - return $formitem; - } - else if($fieldType=='radio') - { + } else if ($fieldType == 'stepselect') { + global $hasSetEnumJs, $cfg_cmspath; + $cmspath = ((empty($cfg_cmspath) || !preg_match('/[/$]/', $cfg_cmspath)) ? $cfg_cmspath . '/' : $cfg_cmspath); $myformItem = ''; - $items = explode(',',$ctag->GetAtt("default")); + $myformItem .= "\r\n"; + $myformItem .= "\r\n"; + $myformItem .= "\r\n"; + $myformItem .= "\r\n"; + if ($hasSetEnumJs != 'hasset') { + $myformItem .= '' . "\r\n"; + $GLOBALS['hasSetEnumJs'] = 'hasset'; + } + $myformItem .= "\r\n"; + $myformItem .= '' . "\r\n"; + $formitem = str_replace('~name~', $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace('~form~', $myformItem, $formitem); + return $formitem; + } else if ($fieldType == 'radio') { + $myformItem = ''; + $items = explode(',', $ctag->GetAtt("default")); $i = 0; - foreach($items as $v) - { + foreach ($items as $v) { $v = trim($v); - if($v!='') - { - $myformItem .= ($i==0 ? "$v\r\n" : "$v\r\n"); + if ($v != '') { + $myformItem .= ($i == 0 ? "$v\r\n" : "$v\r\n"); $i++; } } $innertext = $myformItem; - } - else if($fieldType=='checkbox') - { + } else if ($fieldType == 'checkbox') { $myformItem = ''; - $items = explode(',',$ctag->GetAtt("default")); - foreach($items as $v) - { + $items = explode(',', $ctag->GetAtt("default")); + foreach ($items as $v) { $v = trim($v); - if($v!='') - { - if($admintype == 'membermodel') - { + if ($v != '') { + if ($admintype == 'membermodel') { $myformItem .= "\r\n"; } else { - $myformItem .= "$v\r\n"; + $myformItem .= "$v\r\n"; } - } } $innertext = $myformItem; - } - else if($fieldType=='htmltext'||$fieldType=='textdata') - { - $dfvalue = ($ctag->GetAtt('default')!='' ? $ctag->GetAtt('default') : ''); + } else if ($fieldType == 'htmltext' || $fieldType == 'textdata') { + $dfvalue = ($ctag->GetAtt('default') != '' ? $ctag->GetAtt('default') : ''); $dfvalue = str_replace('{{', '<', $dfvalue); $dfvalue = str_replace('}}', '>', $dfvalue); - if($admintype=='admin') - { + if ($admintype == 'admin') { $innertext = GetEditor($fieldname, $dfvalue, 350, 'Basic', 'string'); - } - else if($admintype=='diy') - { + } else if ($admintype == 'diy') { $innertext = GetEditor($fieldname, $dfvalue, 350, 'Diy', 'string'); - } - else - { + } else { $innertext = GetEditor($fieldname, $dfvalue, 350, 'Member', 'string'); } - } - else if($fieldType=="multitext") - { + } else if ($fieldType == "multitext") { $innertext = "\r\n"; - } - else if($fieldType=="datetime") - { + } else if ($fieldType == "datetime") { $nowtime = GetDateTimeMk(time()); $innertext = ""; - } - else if($fieldType=='img'||$fieldType=='imgfile') - { - if($admintype=='diy') { + } else if ($fieldType == 'img' || $fieldType == 'imgfile') { + if ($admintype == 'diy') { $innertext = "\r\n"; + } else { + $innertext = " \r\n"; } - else { - $innertext = " \r\n"; - } - } - else if($fieldType=='media') - { - if($admintype=='diy') - { + } else if ($fieldType == 'media') { + if ($admintype == 'diy') { $innertext = "不支持的类型\r\n"; + } else { + $innertext = " \r\n"; } - else - { - $innertext = " \r\n"; - } - } - else if($fieldType=='addon') - { - if($admintype=='diy') - { + } else if ($fieldType == 'addon') { + if ($admintype == 'diy') { $innertext = "\r\n"; + } else { + $innertext = " \r\n"; } - else - { - $innertext = " \r\n"; - } - } - else if($fieldType=='int'||$fieldType=='float') - { - $dfvalue = ($ctag->GetAtt('default')!='' ? $ctag->GetAtt('default') : '0'); + } else if ($fieldType == 'int' || $fieldType == 'float') { + $dfvalue = ($ctag->GetAtt('default') != '' ? $ctag->GetAtt('default') : '0'); $innertext = " (填写数值)\r\n"; - } else if($fieldType=='relation') { - $dfvalue = ($ctag->GetAtt('default')!='' ? $ctag->GetAtt('default') : ''); - $channel = ($ctag->GetAtt('channel') == "")? "1" : $ctag->GetAtt('channel'); + } else if ($fieldType == 'relation') { + $dfvalue = ($ctag->GetAtt('default') != '' ? $ctag->GetAtt('default') : ''); + $channel = ($ctag->GetAtt('channel') == "") ? "1" : $ctag->GetAtt('channel'); $innertext = "
    \r\n"; if ($ctag->GetAtt('automake') == 1) { $innertext .= ""; } - + $innertext .= << if(typeof SelectArcList === "undefined") { @@ -180,15 +138,13 @@ if(typeof SelectArcList === "undefined") { } EOT; - } - else - { - $dfvalue = ($ctag->GetAtt('default')!='' ? $ctag->GetAtt('default') : ''); + } else { + $dfvalue = ($ctag->GetAtt('default') != '' ? $ctag->GetAtt('default') : ''); $innertext = " \r\n"; } - $formitem = str_replace("~name~",$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace("~form~",$innertext,$formitem); + $formitem = str_replace("~name~", $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace("~form~", $innertext, $formitem); return $formitem; } @@ -205,177 +161,124 @@ EOT; * @param string $fieldname 变量类型 * @return string */ -function GetFieldValue($dvalue, $dtype, $aid=0, $job='add', $addvar='', $admintype='admin', $fieldname='') +function GetFieldValue($dvalue, $dtype, $aid = 0, $job = 'add', $addvar = '', $admintype = 'admin', $fieldname = '') { global $cfg_basedir, $cfg_cmspath, $adminid, $cfg_ml, $cfg_cookie_encode; - if(!empty($adminid)) - { + if (!empty($adminid)) { $adminid = $adminid; - } - else - { + } else { $adminid = isset($cfg_ml) ? $cfg_ml->M_ID : 1; } - if($dtype=='int') - { - if($dvalue=='') - { + if ($dtype == 'int') { + if ($dvalue == '') { return 0; } return GetAlabNum($dvalue); - } else if ($dtype=='relation') { + } else if ($dtype == 'relation') { $dvalue = trim(preg_replace("#[^0-9,]#", "", $dvalue)); return $dvalue; - } - else if($dtype=='stepselect') - { + } else if ($dtype == 'stepselect') { $dvalue = trim(preg_replace("#[^0-9\.]#", "", $dvalue)); return $dvalue; - } - else if($dtype=='float') - { - if($dvalue=='') - { + } else if ($dtype == 'float') { + if ($dvalue == '') { return 0; } return GetAlabNum($dvalue); - } - else if($dtype=='datetime') - { - if($dvalue=='') - { + } else if ($dtype == 'datetime') { + if ($dvalue == '') { return 0; } return GetMkTime($dvalue); - } - else if($dtype=='checkbox') - { + } else if ($dtype == 'checkbox') { $okvalue = ''; - if(is_array($dvalue)) - { - $okvalue = join(',',$dvalue); + if (is_array($dvalue)) { + $okvalue = join(',', $dvalue); } return $okvalue; - } - else if($dtype=="htmltext") - { - if($admintype=='member' || $admintype=='diy') - { - $dvalue = HtmlReplace($dvalue,-1); + } else if ($dtype == "htmltext") { + if ($admintype == 'member' || $admintype == 'diy') { + $dvalue = HtmlReplace($dvalue, -1); } return $dvalue; - } - else if($dtype=="multitext") - { - if($admintype=='member' || $admintype=='diy') - { - $dvalue = HtmlReplace($dvalue,0); + } else if ($dtype == "multitext") { + if ($admintype == 'member' || $admintype == 'diy') { + $dvalue = HtmlReplace($dvalue, 0); } return $dvalue; - } - else if($dtype=="textdata") - { - $ipath = $cfg_cmspath."/data/textdata"; - $tpath = ceil($aid / 5000); - if(!is_dir($cfg_basedir.$ipath)) - { - MkdirAll($cfg_basedir.$ipath, $GLOBALS['cfg_dir_purview']); - } - if(!is_dir($cfg_basedir.$ipath.'/'.$tpath)) - { - MkdirAll($cfg_basedir.$ipath.'/'.$tpath,$GLOBALS['cfg_dir_purview']); - } - $ipath = $ipath.'/'.$tpath; - $filename = "{$ipath}/{$aid}-".cn_substr(md5($cfg_cookie_encode), 0, 16).".txt"; + } else if ($dtype == "textdata") { + $ipath = $cfg_cmspath . "/data/textdata"; + $tpath = ceil($aid / 5000); + if (!is_dir($cfg_basedir . $ipath)) { + MkdirAll($cfg_basedir . $ipath, $GLOBALS['cfg_dir_purview']); + } + if (!is_dir($cfg_basedir . $ipath . '/' . $tpath)) { + MkdirAll($cfg_basedir . $ipath . '/' . $tpath, $GLOBALS['cfg_dir_purview']); + } + $ipath = $ipath . '/' . $tpath; + $filename = "{$ipath}/{$aid}-" . cn_substr(md5($cfg_cookie_encode), 0, 16) . ".txt"; - //会员投稿内容安全处理 - if($admintype=='member' || $admintype=='diy') - { - $dvalue = HtmlReplace($dvalue, -1); - } - $fp = fopen($cfg_basedir.$filename,"w"); - fwrite($fp, stripslashes($dvalue)); - fclose($fp); - CloseFtp(); - return $filename; - } - else if($dtype=='img' || $dtype=='imgfile') - { - if(preg_match("#[\\|/]uploads[\\|/]userup#", $dvalue)) return $dvalue; - if($admintype=='diy') - { + //会员投稿内容安全处理 + if ($admintype == 'member' || $admintype == 'diy') { + $dvalue = HtmlReplace($dvalue, -1); + } + $fp = fopen($cfg_basedir . $filename, "w"); + fwrite($fp, stripslashes($dvalue)); + fclose($fp); + CloseFtp(); + return $filename; + } else if ($dtype == 'img' || $dtype == 'imgfile') { + if (preg_match("#[\\|/]uploads[\\|/]userup#", $dvalue)) return $dvalue; + if ($admintype == 'diy') { $iurl = MemberUploads($fieldname, '', 0, 'image', '', -1, -1, false); return $iurl; } $iurl = stripslashes($dvalue); - if(trim($iurl)=='') - { + if (trim($iurl) == '') { return ''; } - $iurl = trim(str_replace($GLOBALS['cfg_basehost'],"",$iurl)); - $imgurl = "{dede:img text='' width='' height=''} ".$iurl." {/dede:img}"; - if(preg_match("/^http:\/\//i", $iurl) && $GLOBALS['cfg_isUrlOpen']) - { + $iurl = trim(str_replace($GLOBALS['cfg_basehost'], "", $iurl)); + $imgurl = "{dede:img text='' width='' height=''} " . $iurl . " {/dede:img}"; + if (preg_match("/^http:\/\//i", $iurl) && $GLOBALS['cfg_isUrlOpen']) { //远程图片 $reimgs = ''; - if($GLOBALS['cfg_isUrlOpen']) - { - $reimgs = GetRemoteImage($iurl,$adminid); - if(is_array($reimgs)) - { - if($dtype=='imgfile') - { + if ($GLOBALS['cfg_isUrlOpen']) { + $reimgs = GetRemoteImage($iurl, $adminid); + if (is_array($reimgs)) { + if ($dtype == 'imgfile') { $imgurl = $reimgs[1]; - } - else - { - $imgurl = "{dede:img text='' width='".$reimgs[1]."' height='".$reimgs[2]."'} ".$reimgs[0]." {/dede:img}"; + } else { + $imgurl = "{dede:img text='' width='" . $reimgs[1] . "' height='" . $reimgs[2] . "'} " . $reimgs[0] . " {/dede:img}"; } } - } - else - { - if($dtype=='imgfile') - { + } else { + if ($dtype == 'imgfile') { $imgurl = $iurl; - } - else - { - $imgurl = "{dede:img text='' width='' height=''} ".$iurl." {/dede:img}"; + } else { + $imgurl = "{dede:img text='' width='' height=''} " . $iurl . " {/dede:img}"; } } - } - else if($iurl != '') - { + } else if ($iurl != '') { //站内图片 - $imgfile = $cfg_basedir.$iurl; - if(is_file($imgfile)) - { + $imgfile = $cfg_basedir . $iurl; + if (is_file($imgfile)) { $info = ''; - $imginfos = GetImageSize($imgfile,$info); - if($dtype=="imgfile") - { + $imginfos = GetImageSize($imgfile, $info); + if ($dtype == "imgfile") { $imgurl = $iurl; - } - else - { - $imgurl = "{dede:img text='' width='".$imginfos[0]."' height='".$imginfos[1]."'} $iurl {/dede:img}"; + } else { + $imgurl = "{dede:img text='' width='" . $imginfos[0] . "' height='" . $imginfos[1] . "'} $iurl {/dede:img}"; } } } return addslashes($imgurl); - } - else if($dtype=='addon' && $admintype=='diy') - { - if(preg_match("#[\\|/]uploads[\\|/]userup#", $dvalue)) return $dvalue; - $dvalue = MemberUploads($fieldname,'', 0, 'addon', '', -1, -1, false); + } else if ($dtype == 'addon' && $admintype == 'diy') { + if (preg_match("#[\\|/]uploads[\\|/]userup#", $dvalue)) return $dvalue; + $dvalue = MemberUploads($fieldname, '', 0, 'addon', '', -1, -1, false); return $dvalue; - } - else - { - if($admintype=='member' || $admintype=='diy') - { - $dvalue = HtmlReplace($dvalue,1); + } else { + if ($admintype == 'member' || $admintype == 'diy') { + $dvalue = HtmlReplace($dvalue, 1); } return $dvalue; } @@ -391,52 +294,43 @@ function GetFieldValue($dvalue, $dtype, $aid=0, $job='add', $addvar='', $adminty * @param string $fieldname 变量名称 * @return string */ -function GetFormItemValue($ctag, $fvalue, $admintype='admin', $fieldname='') +function GetFormItemValue($ctag, $fvalue, $admintype = 'admin', $fieldname = '') { global $cfg_basedir; $fieldname = $ctag->GetName(); $formitem = $formitem = GetSysTemplets("custom_fields_{$admintype}.htm"); $innertext = trim($ctag->GetInnerText()); - if($innertext!='') - { + if ($innertext != '') { $formitem = $innertext; } $ftype = $ctag->GetAtt('type'); $myformItem = ''; - if(preg_match("/select|radio|checkbox/i", $ftype)) - { - $items = explode(',',$ctag->GetAtt('default')); + if (preg_match("/select|radio|checkbox/i", $ftype)) { + $items = explode(',', $ctag->GetAtt('default')); } - if($ftype=='select') - { + if ($ftype == 'select') { $myformItem = "\r\n"; $innertext = $myformItem; - } - else if($ctag->GetAtt("type")=='stepselect') - { - global $hasSetEnumJs,$cfg_cmspath; - $cmspath = ( (empty($cfg_cmspath) || preg_match('/[/$]/', $cfg_cmspath)) ? $cfg_cmspath.'/' : $cfg_cmspath ); + } else if ($ctag->GetAtt("type") == 'stepselect') { + global $hasSetEnumJs, $cfg_cmspath; + $cmspath = ((empty($cfg_cmspath) || preg_match('/[/$]/', $cfg_cmspath)) ? $cfg_cmspath . '/' : $cfg_cmspath); $myformItem = ''; $myformItem .= "\r\n"; $myformItem .= "\r\n"; $myformItem .= "\r\n"; $myformItem .= "\r\n"; - if($hasSetEnumJs != 'hasset') - { - $myformItem .= ''."\r\n"; + if ($hasSetEnumJs != 'hasset') { + $myformItem .= '' . "\r\n"; $GLOBALS['hasSetEnumJs'] = 'hasset'; } $myformItem .= "\r\n"; @@ -444,41 +338,30 @@ function GetFormItemValue($ctag, $fvalue, $admintype='admin', $fieldname='') $formitem = str_replace('~name~', $ctag->GetAtt('itemname'), $formitem); $formitem = str_replace('~form~', $myformItem, $formitem); return $formitem; - } - else if($ftype=='radio') - { - if(is_array($items)) - { - foreach($items as $v) - { + } else if ($ftype == 'radio') { + if (is_array($items)) { + foreach ($items as $v) { $v = trim($v); - if($v=='') continue; - $myformItem.= ($fvalue==$v ? "$v\r\n" : "$v\r\n"); + if ($v == '') continue; + $myformItem .= ($fvalue == $v ? "$v\r\n" : "$v\r\n"); } } $innertext = $myformItem; } //checkbox - else if($ftype=='checkbox') - { + else if ($ftype == 'checkbox') { $myformItem = ''; - $fvalues = explode(',',$fvalue); - if(is_array($items)) - { - foreach($items as $v) - { + $fvalues = explode(',', $fvalue); + if (is_array($items)) { + foreach ($items as $v) { $v = trim($v); - if($v=='') - { + if ($v == '') { continue; } - if(in_array($v,$fvalues)) - { + if (in_array($v, $fvalues)) { $myformItem .= "$v\r\n"; - } - else - { + } else { $myformItem .= "$v\r\n"; } } @@ -487,84 +370,56 @@ function GetFormItemValue($ctag, $fvalue, $admintype='admin', $fieldname='') } //文本数据的特殊处理 - else if($ftype=="textdata") - { - if(is_file($cfg_basedir.$fvalue)) - { - $fp = fopen($cfg_basedir.$fvalue,'r'); + else if ($ftype == "textdata") { + if (is_file($cfg_basedir . $fvalue)) { + $fp = fopen($cfg_basedir . $fvalue, 'r'); $okfvalue = ''; - while(!feof($fp)){ $okfvalue .= fgets($fp,1024); } + while (!feof($fp)) { + $okfvalue .= fgets($fp, 1024); + } fclose($fp); - } - else - { + } else { $okfvalue = ''; } - if($admintype=='admin') - { - $myformItem = GetEditor($fieldname,$okfvalue,350,'Basic','string')."\r\n \r\n "; - } - else - { - $myformItem = GetEditor($fieldname,$okfvalue,350,'Member','string')."\r\n \r\n "; + if ($admintype == 'admin') { + $myformItem = GetEditor($fieldname, $okfvalue, 350, 'Basic', 'string') . "\r\n \r\n "; + } else { + $myformItem = GetEditor($fieldname, $okfvalue, 350, 'Member', 'string') . "\r\n \r\n "; } $innertext = $myformItem; - } - else if($ftype=="htmltext") - { - if($admintype=='admin') - { - $myformItem = GetEditor($fieldname,$fvalue,350,'Basic','string')."\r\n "; - } - else - { - $myformItem = GetEditor($fieldname,$fvalue,350,'Member','string')."\r\n "; + } else if ($ftype == "htmltext") { + if ($admintype == 'admin') { + $myformItem = GetEditor($fieldname, $fvalue, 350, 'Basic', 'string') . "\r\n "; + } else { + $myformItem = GetEditor($fieldname, $fvalue, 350, 'Member', 'string') . "\r\n "; } $innertext = $myformItem; - } - else if($ftype=="multitext") - { + } else if ($ftype == "multitext") { $innertext = "\r\n"; - } - else if($ftype=="datetime") - { + } else if ($ftype == "datetime") { $nowtime = GetDateTimeMk($fvalue); $innertext = ""; - } - else if($ftype=="img") - { + } else if ($ftype == "img") { $ndtp = new DedeTagParse(); $ndtp->LoadSource($fvalue); - if(!is_array($ndtp->CTags)) - { + if (!is_array($ndtp->CTags)) { $ndtp->Clear(); $fvalue = ""; - } - else - { + } else { $ntag = $ndtp->GetTag("img"); $fvalue = trim($ntag->GetInnerText()); } - $innertext = " \r\n"; - } - else if($ftype=="imgfile") - { - $innertext = " \r\n"; - } - else if($ftype=="media") - { - $innertext = " \r\n"; - } - else if($ftype=="addon") - { - $innertext = " \r\n"; - } - else if($ftype=="int"||$ftype=="float") - { + $innertext = " \r\n"; + } else if ($ftype == "imgfile") { + $innertext = " \r\n"; + } else if ($ftype == "media") { + $innertext = " \r\n"; + } else if ($ftype == "addon") { + $innertext = " \r\n"; + } else if ($ftype == "int" || $ftype == "float") { $innertext = " (填写数值)\r\n"; - } - else if($ftype=="relation") { - $channel = ($ctag->GetAtt('channel') == "")? "1" : $ctag->GetAtt('channel'); + } else if ($ftype == "relation") { + $channel = ($ctag->GetAtt('channel') == "") ? "1" : $ctag->GetAtt('channel'); $innertext = "
    \r\n"; if ($ctag->GetAtt('automake') == 1) { @@ -581,12 +436,10 @@ if(typeof SelectArcList === "undefined") { } EOT; - } - else - { + } else { $innertext = "\r\n"; } - $formitem = str_replace('~name~',$ctag->GetAtt('itemname'),$formitem); - $formitem = str_replace('~form~',$innertext,$formitem); + $formitem = str_replace('~name~', $ctag->GetAtt('itemname'), $formitem); + $formitem = str_replace('~form~', $innertext, $formitem); return $formitem; -} \ No newline at end of file +} diff --git a/src/include/datalistcp.class.php b/src/include/datalistcp.class.php index e2afbc65..551a613f 100755 --- a/src/include/datalistcp.class.php +++ b/src/include/datalistcp.class.php @@ -1,4 +1,4 @@ -Display(); //显示 * * @version $Id: datalistcp.class.php 3 17:02 2010年7月9日Z tianya $ - * @package DedeCMS.Libraries + * @package DedeBIZ.Libraries * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ -require_once(DEDEINC.'/dedetemplate.class.php'); +require_once(DEDEINC . '/dedetemplate.class.php'); $codefile = (isset($needCode) ? $needCode : $cfg_soft_lang); $codefile = preg_replace("#[^\w-]#", '', $codefile); -if(file_exists(DEDEINC.'/code/datalist.'.$codefile.'.inc')) -{ - require_once(DEDEINC.'/code/datalist.'.$codefile.'.inc'); -} -else -{ +if (file_exists(DEDEINC . '/code/datalist.' . $codefile . '.inc')) { + require_once(DEDEINC . '/code/datalist.' . $codefile . '.inc'); +} else { $lang_pre_page = '上页'; $lang_next_page = '下页'; $lang_index_page = '首页'; @@ -39,7 +36,7 @@ else /** * DataListCP * - * @package DedeCMS.Libraries + * @package DedeBIZ.Libraries */ class DataListCP { @@ -61,12 +58,10 @@ class DataListCP * @param string $tplfile 模板文件 * @return string */ - function __construct($tplfile='') + function __construct($tplfile = '') { - if ( $GLOBALS['cfg_dbtype'] =='mysql' ) - { - if ($GLOBALS['cfg_mysql_type'] == 'mysqli' && function_exists("mysqli_init")) - { + if ($GLOBALS['cfg_dbtype'] == 'mysql') { + if ($GLOBALS['cfg_mysql_type'] == 'mysqli' && function_exists("mysqli_init")) { $dsql = $GLOBALS['dsqli']; } else { $dsql = $GLOBALS['dsql']; @@ -74,28 +69,26 @@ class DataListCP } else { $dsql = $GLOBALS['dsqlitete']; } - - $this->sourceSql=''; - $this->pageSize=25; - $this->queryTime=0; - $this->getValues=Array(); + + $this->sourceSql = ''; + $this->pageSize = 25; + $this->queryTime = 0; + $this->getValues = array(); $this->isQuery = false; $this->totalResult = 0; $this->totalPage = 0; $this->pageNO = 0; $this->dsql = $dsql; - $this->SetVar('ParseEnv','datalist'); + $this->SetVar('ParseEnv', 'datalist'); $this->tpl = new DedeTemplate(); - if($GLOBALS['cfg_tplcache']=='N') - { + if ($GLOBALS['cfg_tplcache'] == 'N') { $this->tpl->isCache = false; } - if($tplfile!='') - { + if ($tplfile != '') { $this->tpl->LoadTemplate($tplfile); } } - + /** * 兼容PHP4版本 * @@ -103,7 +96,7 @@ class DataListCP * @param string $tplfile 模板文件 * @return void */ - function DataListCP($tplfile='') + function DataListCP($tplfile = '') { $this->__construct($tplfile); } @@ -133,51 +126,44 @@ class DataListCP */ function PreLoad() { - global $totalresult,$pageno; - if(empty($pageno) || preg_match("#[^0-9]#", $pageno)) - { + global $totalresult, $pageno; + if (empty($pageno) || preg_match("#[^0-9]#", $pageno)) { $pageno = 1; } - if(empty($totalresult) || preg_match("#[^0-9]#", $totalresult)) - { + if (empty($totalresult) || preg_match("#[^0-9]#", $totalresult)) { $totalresult = 0; } $this->pageNO = $pageno; $this->totalResult = $totalresult; - if(isset($this->tpl->tpCfgs['pagesize'])) - { + if (isset($this->tpl->tpCfgs['pagesize'])) { $this->pageSize = $this->tpl->tpCfgs['pagesize']; } $this->totalPage = ceil($this->totalResult / $this->pageSize); - if($this->totalResult==0) - { + if ($this->totalResult == 0) { $countQuery = preg_replace("#SELECT[ \r\n\t](.*)[ \r\n\t]FROM#is", 'SELECT COUNT(*) AS dd FROM', $this->sourceSql); $countQuery = preg_replace("#ORDER[ \r\n\t]{1,}BY(.*)#is", '', $countQuery); - + $row = $this->dsql->GetOne($countQuery); - if(!is_array($row)) $row['dd'] = 0; - $this->totalResult = isset($row['dd'])? $row['dd'] : 0; - $this->sourceSql .= " LIMIT 0,".$this->pageSize; - } - else - { - $this->sourceSql .= " LIMIT ".(($this->pageNO-1) * $this->pageSize).",".$this->pageSize; + if (!is_array($row)) $row['dd'] = 0; + $this->totalResult = isset($row['dd']) ? $row['dd'] : 0; + $this->sourceSql .= " LIMIT 0," . $this->pageSize; + } else { + $this->sourceSql .= " LIMIT " . (($this->pageNO - 1) * $this->pageSize) . "," . $this->pageSize; } } //设置网址的Get参数键值 - function SetParameter($key,$value) + function SetParameter($key, $value) { $this->getValues[$key] = $value; } //设置/获取文档相关的各种变量 - function SetVar($k,$v) + function SetVar($k, $v) { global $_vars; - if(!isset($_vars[$k])) - { + if (!isset($_vars[$k])) { $_vars[$k] = $v; } } @@ -187,11 +173,10 @@ class DataListCP global $_vars; return isset($_vars[$k]) ? $_vars[$k] : ''; } - + function XSSClean($val) { - if (is_array($val)) - { + if (is_array($val)) { foreach ($val as $key => $v) { $val[$key] = $this->XSSClean($v); } @@ -199,71 +184,70 @@ class DataListCP } return $this->RemoveXss($val); } - - function RemoveXss($val) { - global $cfg_soft_lang; - if($cfg_soft_lang=='gb2312') $val = gb2utf8($val); - $val = preg_replace('/([\x00-\x08,\x0b-\x0c,\x0e-\x19])/', '', $val); - $search = 'abcdefghijklmnopqrstuvwxyz'; - $search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; - $search .= '1234567890!@#$%^&*()'; - $search .= '~`";:?+/={}[]-_|\'\\'; - for ($i = 0; $i < strlen($search); $i++) { - $val = preg_replace('/(&#[xX]0{0,8}'.dechex(ord($search[$i])).';?)/i', $search[$i], $val); // with a ; - $val = preg_replace('/(�{0,8}'.ord($search[$i]).';?)/', $search[$i], $val); // with a ; - } - - $val = str_replace("`","‘",$val); - $val = str_replace("'","‘",$val); - $val = str_replace("\"","“",$val); - $val = str_replace(",",",",$val); - $val = str_replace("(","(",$val); - $val = str_replace(")",")",$val); - $ra1 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base'); - $ra2 = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload'); - $ra = array_merge($ra1, $ra2); + function RemoveXss($val) + { + global $cfg_soft_lang; + if ($cfg_soft_lang == 'gb2312') $val = gb2utf8($val); + $val = preg_replace('/([\x00-\x08,\x0b-\x0c,\x0e-\x19])/', '', $val); + $search = 'abcdefghijklmnopqrstuvwxyz'; + $search .= 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'; + $search .= '1234567890!@#$%^&*()'; + $search .= '~`";:?+/={}[]-_|\'\\'; + for ($i = 0; $i < strlen($search); $i++) { + $val = preg_replace('/(&#[xX]0{0,8}' . dechex(ord($search[$i])) . ';?)/i', $search[$i], $val); // with a ; + $val = preg_replace('/(�{0,8}' . ord($search[$i]) . ';?)/', $search[$i], $val); // with a ; + } + + $val = str_replace("`", "‘", $val); + $val = str_replace("'", "‘", $val); + $val = str_replace("\"", "“", $val); + $val = str_replace(",", ",", $val); + $val = str_replace("(", "(", $val); + $val = str_replace(")", ")", $val); + + $ra1 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base'); + $ra2 = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload'); + $ra = array_merge($ra1, $ra2); - $found = true; - while ($found == true) { - $val_before = $val; - for ($i = 0; $i < sizeof($ra); $i++) { - $pattern = '/'; - for ($j = 0; $j < strlen($ra[$i]); $j++) { - if ($j > 0) { - $pattern .= '('; - $pattern .= '(&#[xX]0{0,8}([9ab]);)'; - $pattern .= '|'; - $pattern .= '|(�{0,8}([9|10|13]);)'; - $pattern .= ')*'; - } - $pattern .= $ra[$i][$j]; - } - $pattern .= '/i'; - $replacement = substr($ra[$i], 0, 2).''.substr($ra[$i], 2); - $val = preg_replace($pattern, $replacement, $val); - if ($val_before == $val) { - $found = false; - } - } - } - if($cfg_soft_lang=='gb2312') $val = utf82gb($val); - return $val; - } + $found = true; + while ($found == true) { + $val_before = $val; + for ($i = 0; $i < sizeof($ra); $i++) { + $pattern = '/'; + for ($j = 0; $j < strlen($ra[$i]); $j++) { + if ($j > 0) { + $pattern .= '('; + $pattern .= '(&#[xX]0{0,8}([9ab]);)'; + $pattern .= '|'; + $pattern .= '|(�{0,8}([9|10|13]);)'; + $pattern .= ')*'; + } + $pattern .= $ra[$i][$j]; + } + $pattern .= '/i'; + $replacement = substr($ra[$i], 0, 2) . '' . substr($ra[$i], 2); + $val = preg_replace($pattern, $replacement, $val); + if ($val_before == $val) { + $found = false; + } + } + } + if ($cfg_soft_lang == 'gb2312') $val = utf82gb($val); + return $val; + } //获取当前页数据列表 - function GetArcList($atts,$refObj='',$fields=array()) + function GetArcList($atts, $refObj = '', $fields = array()) { $rsArray = array(); $t1 = Exectime(); - if(!$this->isQuery) $this->dsql->Execute('dlist',$this->sourceSql); + if (!$this->isQuery) $this->dsql->Execute('dlist', $this->sourceSql); $i = 0; - while($arr=$this->dsql->GetArray('dlist')) - { + while ($arr = $this->dsql->GetArray('dlist')) { $i++; $rsArray[$i] = $this->XSSClean($arr); - if($i >= $this->pageSize) - { + if ($i >= $this->pageSize) { break; } } @@ -273,128 +257,101 @@ class DataListCP } //获取分页导航列表 - function GetPageList($atts,$refObj='',$fields=array()) + function GetPageList($atts, $refObj = '', $fields = array()) { - global $lang_pre_page,$lang_next_page,$lang_index_page,$lang_end_page,$lang_record_number,$lang_page,$lang_total; - $prepage = $nextpage = $geturl= $hidenform = ''; + global $lang_pre_page, $lang_next_page, $lang_index_page, $lang_end_page, $lang_record_number, $lang_page, $lang_total; + $prepage = $nextpage = $geturl = $hidenform = ''; $purl = $this->GetCurUrl(); - $prepagenum = $this->pageNO-1; - $nextpagenum = $this->pageNO+1; - if(!isset($atts['listsize']) || preg_match("#[^0-9]#", $atts['listsize'])) - { + $prepagenum = $this->pageNO - 1; + $nextpagenum = $this->pageNO + 1; + if (!isset($atts['listsize']) || preg_match("#[^0-9]#", $atts['listsize'])) { $atts['listsize'] = 5; } - if(!isset($atts['listitem'])) - { + if (!isset($atts['listitem'])) { $atts['listitem'] = "info,index,end,pre,next,pageno"; } - $totalpage = ceil($this->totalResult/$this->pageSize); + $totalpage = ceil($this->totalResult / $this->pageSize); //echo " {$totalpage}=={$this->totalResult}=={$this->pageSize}"; //无结果或只有一页的情况 - if($totalpage<=1 && $this->totalResult > 0) - { - return "
      \n
    • {$lang_total} 1 {$lang_page}/".$this->totalResult.$lang_record_number."
    "; + if ($totalpage <= 1 && $this->totalResult > 0) { + return "
      \n
    • {$lang_total} 1 {$lang_page}/" . $this->totalResult . $lang_record_number . "
    "; } - if($this->totalResult == 0) - { - return "
      \n
    • {$lang_total} 0 {$lang_page}/".$this->totalResult.$lang_record_number."
    "; + if ($this->totalResult == 0) { + return "
      \n
    • {$lang_total} 0 {$lang_page}/" . $this->totalResult . $lang_record_number . "
    "; } $infos = "
  • {$lang_total} {$totalpage} {$lang_page}/{$this->totalResult}{$lang_record_number}
  • "; - if($this->totalResult!=0) - { + if ($this->totalResult != 0) { $this->getValues['totalresult'] = $this->totalResult; } - if(count($this->getValues)>0) - { - foreach($this->getValues as $key=>$value) - { + if (count($this->getValues) > 0) { + foreach ($this->getValues as $key => $value) { $value = urlencode($value); - $geturl .= "$key=$value"."&"; + $geturl .= "$key=$value" . "&"; $hidenform .= "\n"; } } - $purl .= "?".$geturl; + $purl .= "?" . $geturl; //获得上一页和下一页的链接 - if($this->pageNO != 1) - { - $prepage .= "
  • $lang_pre_page
  • \n"; - $indexpage = "
  • $lang_index_page
  • \n"; - } - else - { - $indexpage = "
  • "."$lang_index_page \n"."
  • "; - } - if($this->pageNO != $totalpage && $totalpage > 1) - { - $nextpage.="
  • $lang_next_page
  • \n"; - $endpage="
  • $lang_end_page
  • \n"; + if ($this->pageNO != 1) { + $prepage .= "
  • $lang_pre_page
  • \n"; + $indexpage = "
  • $lang_index_page
  • \n"; + } else { + $indexpage = "
  • " . "$lang_index_page \n" . "
  • "; } - else - { - $endpage="
  • $lang_end_page
  • \n"; + if ($this->pageNO != $totalpage && $totalpage > 1) { + $nextpage .= "
  • $lang_next_page
  • \n"; + $endpage = "
  • $lang_end_page
  • \n"; + } else { + $endpage = "
  • $lang_end_page
  • \n"; } //获得数字链接 $listdd = ""; $total_list = $atts['listsize'] * 2 + 1; - if($this->pageNO >= $total_list) - { + if ($this->pageNO >= $total_list) { $j = $this->pageNO - $atts['listsize']; - $total_list=$this->pageNO + $atts['listsize']; - if($total_list > $totalpage) - { + $total_list = $this->pageNO + $atts['listsize']; + if ($total_list > $totalpage) { $total_list = $totalpage; } - } - else - { - $j=1; - if($total_list > $totalpage) - { + } else { + $j = 1; + if ($total_list > $totalpage) { $total_list = $totalpage; } } - for($j; $j<=$total_list; $j++) - { - $listdd .= $j==$this->pageNO ? "
  • $j
  • \r\n" : "
  • ".$j."
  • \n"; + for ($j; $j <= $total_list; $j++) { + $listdd .= $j == $this->pageNO ? "
  • $j
  • \r\n" : "
  • " . $j . "
  • \n"; } $plist = "
      \n"; //info,index,end,pre,next,pageno,form - if(preg_match("#info#i",$atts['listitem'])) - { + if (preg_match("#info#i", $atts['listitem'])) { $plist .= $infos; } - if(preg_match("#index#i", $atts['listitem'])) - { + if (preg_match("#index#i", $atts['listitem'])) { $plist .= $indexpage; } - if(preg_match("#pre#i", $atts['listitem'])) - { + if (preg_match("#pre#i", $atts['listitem'])) { $plist .= $prepage; } - if(preg_match("#pageno#i", $atts['listitem'])) - { + if (preg_match("#pageno#i", $atts['listitem'])) { $plist .= $listdd; } - if(preg_match("#next#i", $atts['listitem'])) - { + if (preg_match("#next#i", $atts['listitem'])) { $plist .= $nextpage; } - if(preg_match("#end#i", $atts['listitem'])) - { + if (preg_match("#end#i", $atts['listitem'])) { $plist .= $endpage; } - if(preg_match("#form#i", $atts['listitem'])) - { - $plist .="
      $hidenform"; - if($totalpage>$total_list) - { - $plist.="\r\n"; - $plist.="\r\n"; + if (preg_match("#form#i", $atts['listitem'])) { + $plist .= " $hidenform"; + if ($totalpage > $total_list) { + $plist .= "\r\n"; + $plist .= "\r\n"; } $plist .= "
      \n"; } @@ -405,14 +362,11 @@ class DataListCP //获得当前网址 function GetCurUrl() { - if(!empty($_SERVER["REQUEST_URI"])) - { + if (!empty($_SERVER["REQUEST_URI"])) { $nowurl = $_SERVER["REQUEST_URI"]; - $nowurls = explode("?",$nowurl); + $nowurls = explode("?", $nowurl); $nowurl = $nowurls[0]; - } - else - { + } else { $nowurl = $_SERVER["PHP_SELF"]; } return $nowurl; @@ -421,7 +375,6 @@ class DataListCP //关闭 function Close() { - } //显示数据 @@ -439,4 +392,4 @@ class DataListCP { $this->tpl->SaveTo($filename); } -} \ No newline at end of file +} diff --git a/src/include/dedeatt.class.php b/src/include/dedeatt.class.php index eed748b5..23acb04a 100755 --- a/src/include/dedeatt.class.php +++ b/src/include/dedeatt.class.php @@ -1,9 +1,10 @@ Items[$str])) - { + if (isset($this->Items[$str])) { return $this->Items[$str]; - } - else - { + } else { return ""; } } @@ -82,16 +79,16 @@ class DedeAtt */ function GetCount() { - return $this->Count+1; + return $this->Count + 1; } -}//End DedeAtt +} //End DedeAtt /** * 属性解析器 * function c____DedeAttParse(); * * @package DedeAtt - * @subpackage DedeCMS.Libraries + * @subpackage DedeBIZ.Libraries * @link https://www.dedebiz.com */ class DedeAttParse @@ -108,14 +105,13 @@ class DedeAttParse * @param string $str 需要解析的字符串 * @return string */ - function SetSource($str="") + function SetSource($str = "") { $this->CAtt = new DedeAtt(); $strLen = 0; - $this->SourceString = trim(preg_replace("/[ \t\r\n]{1,}/"," ",$str)); + $this->SourceString = trim(preg_replace("/[ \t\r\n]{1,}/", " ", $str)); $strLen = strlen($this->SourceString); - if($strLen>0&&$strLen<=$this->SourceMaxSize) - { + if ($strLen > 0 && $strLen <= $this->SourceMaxSize) { $this->ParseAtt(); } } @@ -129,117 +125,91 @@ class DedeAttParse function ParseAtt() { $d = ""; - $tmpatt=""; - $tmpvalue=""; - $startdd=-1; - $ddtag=""; - $notAttribute=TRUE; + $tmpatt = ""; + $tmpvalue = ""; + $startdd = -1; + $ddtag = ""; + $notAttribute = TRUE; $strLen = strlen($this->SourceString); // 这里是获得Tag的名称,可视情况是否需要 // 如果不在这个里解析,则在解析整个Tag时解析 // 属性中不应该存在tagname这个名称 - for($i=0;$i<$strLen;$i++) - { - $d = substr($this->SourceString,$i,1); - if($d==' ') - { + for ($i = 0; $i < $strLen; $i++) { + $d = substr($this->SourceString, $i, 1); + if ($d == ' ') { $this->CAtt->Count++; - if($this->CharToLow) - { - $this->CAtt->Items["tagname"]=strtolower(trim($tmpvalue)); - } - else - { - $this->CAtt->Items["tagname"]=trim($tmpvalue); + if ($this->CharToLow) { + $this->CAtt->Items["tagname"] = strtolower(trim($tmpvalue)); + } else { + $this->CAtt->Items["tagname"] = trim($tmpvalue); } $tmpvalue = ""; $notAttribute = FALSE; break; - } - else - { + } else { $tmpvalue .= $d; } } //不存在属性列表的情况 - if($notAttribute) - { + if ($notAttribute) { $this->CAtt->Count++; - $this->CAtt->Items["tagname"]= ($this->CharToLow ? strtolower(trim($tmpvalue)) : trim($tmpvalue)); + $this->CAtt->Items["tagname"] = ($this->CharToLow ? strtolower(trim($tmpvalue)) : trim($tmpvalue)); } //如果字符串含有属性值,遍历源字符串,并获得各属性 - if(!$notAttribute) - { - for($i;$i<$strLen;$i++) - { - $d = substr($this->SourceString,$i,1); - if($startdd==-1) - { - if($d!="=") - { + if (!$notAttribute) { + for ($i; $i < $strLen; $i++) { + $d = substr($this->SourceString, $i, 1); + if ($startdd == -1) { + if ($d != "=") { $tmpatt .= $d; - } - else - { - if($this->CharToLow) - { + } else { + if ($this->CharToLow) { $tmpatt = strtolower(trim($tmpatt)); - } - else - { + } else { $tmpatt = trim($tmpatt); } - $startdd=0; + $startdd = 0; } - } - else if($startdd==0) - { - switch($d) - { + } else if ($startdd == 0) { + switch ($d) { case ' ': // continue; break; case '\'': - $ddtag='\''; - $startdd=1; + $ddtag = '\''; + $startdd = 1; break; case '"': - $ddtag='"'; - $startdd=1; + $ddtag = '"'; + $startdd = 1; break; default: - $tmpvalue.=$d; - $ddtag=' '; - $startdd=1; + $tmpvalue .= $d; + $ddtag = ' '; + $startdd = 1; break; } - } - else if($startdd==1) - { - if($d==$ddtag) - { + } else if ($startdd == 1) { + if ($d == $ddtag) { $this->CAtt->Count++; - $this->CAtt->Items[$tmpatt] = trim($tmpvalue);//strtolower(trim($tmpvalue)); + $this->CAtt->Items[$tmpatt] = trim($tmpvalue); //strtolower(trim($tmpvalue)); $tmpatt = ""; $tmpvalue = ""; - $startdd=-1; - } - else - { - $tmpvalue.=$d; + $startdd = -1; + } else { + $tmpvalue .= $d; } } } - if($tmpatt!="") - { + if ($tmpatt != "") { $this->CAtt->Count++; - $this->CAtt->Items[$tmpatt]=trim($tmpvalue);//strtolower(trim($tmpvalue)); - }//完成属性解析 + $this->CAtt->Items[$tmpatt] = trim($tmpvalue); //strtolower(trim($tmpvalue)); + } //完成属性解析 - }//for + } //for - }//has Attribute + } //has Attribute }//End DedeAttParse \ No newline at end of file diff --git a/src/include/dedebiz.class.php b/src/include/dedebiz.class.php index d083156b..87b9f0a3 100644 --- a/src/include/dedebiz.class.php +++ b/src/include/dedebiz.class.php @@ -1,4 +1,4 @@ -MakeSign($req); $str = json_encode($req); $length = strlen($str); $s = @socket_write($this->socket, $str, $length); - + if (!$s) { return (object)array( "code" => -1, @@ -62,7 +63,7 @@ class DedeBizClient } $msg = ""; - while(($str = socket_read($this->socket, 1024)) !== FALSE){ + while (($str = socket_read($this->socket, 1024)) !== FALSE) { $msg .= $str; if (strlen($str) < 1024) { break; @@ -72,7 +73,8 @@ class DedeBizClient } // 用户获取当前服务器状态信息 - function SystemInfo(){ + function SystemInfo() + { $req = array( "method" => "system_info", ); @@ -128,7 +130,7 @@ class DedeBizClient } // 设置首页锁定状态 - function AdminSetIndexLockState($pwd,$state) + function AdminSetIndexLockState($pwd, $state) { $req = array( "method" => "admin_set_index_lock_state", @@ -142,7 +144,7 @@ class DedeBizClient // 缓存 // $key:键 $val:值 $d:缓存时间 - function CacheSet($key,$val,$duration) + function CacheSet($key, $val, $duration) { $req = array( "method" => "cache_set", @@ -196,7 +198,7 @@ class DedeBizClient // 获取分词结果 // $body:内容 $sep:分隔符 - function Pinyin($body,$sep) + function Pinyin($body, $sep) { $req = array( "method" => "pinyin", @@ -217,7 +219,7 @@ class DedeBizClient if (isset($req['parms']) && count($req['parms']) > 0) { ksort($req['parms']); } - + $pstr = "appid={$this->appid}method={$req['method']}key={$this->key}"; if (isset($req['parms']) && count($req['parms']) > 0) { foreach ($req['parms'] as $key => $value) { @@ -250,4 +252,4 @@ class DedeBizClient { socket_close($this->socket); } -} \ No newline at end of file +} diff --git a/src/include/dedecollection.class.php b/src/include/dedecollection.class.php index 341c8538..cf78eb06 100755 --- a/src/include/dedecollection.class.php +++ b/src/include/dedecollection.class.php @@ -1,24 +1,24 @@ -LoadString($configString); - for($i=0; $i<=$dtp->Count; $i++) - { + for ($i = 0; $i <= $dtp->Count; $i++) { $ctag = $dtp->CTags[$i]; //item 配置 //节点基本信息 - if($ctag->GetName()=="noteinfo") - { + if ($ctag->GetName() == "noteinfo") { $this->noteInfos['notename'] = $ctag->GetAtt('notename'); $this->noteInfos['matchtype'] = $ctag->GetAtt('matchtype'); $this->noteInfos['channelid'] = $ctag->GetAtt('channelid'); @@ -103,8 +101,7 @@ class DedeCollection //list 配置 //要采集的列表页的信息 - else if($ctag->GetName()=="listrule") - { + else if ($ctag->GetName() == "listrule") { $this->lists['sourcetype'] = $ctag->GetAtt('sourcetype'); $this->lists['rssurl'] = $ctag->GetAtt('rssurl'); $this->lists['regxurl'] = $ctag->GetAtt('regxurl'); @@ -117,44 +114,38 @@ class DedeCollection $this->lists['listpic'] = $ctag->GetAtt('listpic'); $this->lists['usemore'] = $ctag->GetAtt('usemore'); $dtp2->LoadString($ctag->GetInnerText()); - for($j=0; $j<=$dtp2->Count; $j++) - { + for ($j = 0; $j <= $dtp2->Count; $j++) { $ctag2 = $dtp2->CTags[$j]; $tname = $ctag2->GetName(); - if($tname=='addurls') - { + if ($tname == 'addurls') { $this->lists['addurls'] = trim($ctag2->GetInnerText()); - } - else if($tname=='regxrule') - { + } else if ($tname == 'regxrule') { $this->lists['regxrule'] = trim($ctag2->GetInnerText()); - } - else if($tname=='areastart') - { + } else if ($tname == 'areastart') { $this->lists['areastart'] = trim($ctag2->GetInnerText()); - } - else if($tname=='areaend') - { + } else if ($tname == 'areaend') { $this->lists['areaend'] = trim($ctag2->GetInnerText()); - } - else if($tname=='batchrule') - { + } else if ($tname == 'batchrule') { $this->lists['batchrule'] = trim($ctag2->GetInnerText()); } } //分析列表网址 - if($this->lists['sourcetype'] != 'rss') - { - $this->lists['url'] = GetUrlFromListRule($this->lists['regxurl'],$this->lists['addurls'], - $this->lists['startid'],$this->lists['endid'],$this->lists['addv'],$this->lists['usemore'],$this->lists['batchrule']); - } - else - { + if ($this->lists['sourcetype'] != 'rss') { + $this->lists['url'] = GetUrlFromListRule( + $this->lists['regxurl'], + $this->lists['addurls'], + $this->lists['startid'], + $this->lists['endid'], + $this->lists['addv'], + $this->lists['usemore'], + $this->lists['batchrule'] + ); + } else { $this->lists['url'] = $this->lists['rssurl']; } } - }//End Loop + } //End Loop $dtp->Clear(); $dtp2->Clear(); @@ -172,33 +163,22 @@ class DedeCollection $dtp = new DedeTagParse(); $dtp2 = new DedeTagParse(); $dtp->LoadString($configString); - for($i=0; $i<=$dtp->Count; $i++) - { + for ($i = 0; $i <= $dtp->Count; $i++) { $ctag = $dtp->CTags[$i]; - if($ctag->GetName()=='sppage') - { + if ($ctag->GetName() == 'sppage') { $this->artNotes['sppage'] = $ctag->GetInnerText(); $this->artNotes['sptype'] = $ctag->GetAtt('sptype'); $this->spNotes['srul'] = $ctag->GetAtt('srul'); $this->spNotes['erul'] = $ctag->GetAtt('erul'); - } - else if($ctag->GetName()=='previewurl') - { + } else if ($ctag->GetName() == 'previewurl') { $this->artNotes['previewurl'] = $ctag->GetInnerText(); - } - else if($ctag->GetName()=='keywordtrim') - { + } else if ($ctag->GetName() == 'keywordtrim') { $this->artNotes['keywordtrim'] = $ctag->GetInnerText(); - } - else if($ctag->GetName()=='descriptiontrim') - { + } else if ($ctag->GetName() == 'descriptiontrim') { $this->artNotes['descriptiontrim'] = $ctag->GetInnerText(); - } - else if($ctag->GetName()=='item') - { + } else if ($ctag->GetName() == 'item') { $field = $ctag->GetAtt('field'); - if($field == '') - { + if ($field == '') { continue; } $this->artNotes[$field]['value'] = $ctag->GetAtt('value'); @@ -209,26 +189,20 @@ class DedeCollection $this->artNotes[$field]['function'] = ''; $t = 0; $dtp2->LoadString($ctag->GetInnerText()); - for($k=0; $k<=$dtp2->Count; $k++) - { + for ($k = 0; $k <= $dtp2->Count; $k++) { $ctag2 = $dtp2->CTags[$k]; - if($ctag2->GetName()=='trim') - { - $this->artNotes[$field]['trim'][$t][0] = str_replace('#n#',' ',$ctag2->GetInnerText()); + if ($ctag2->GetName() == 'trim') { + $this->artNotes[$field]['trim'][$t][0] = str_replace('#n#', ' ', $ctag2->GetInnerText()); $this->artNotes[$field]['trim'][$t][1] = $ctag2->GetAtt('replace'); $t++; - } - else if($ctag2->GetName()=='match') - { - $this->artNotes[$field]['match'] = str_replace('#n#',' ',$ctag2->GetInnerText()); - } - else if($ctag2->GetName()=='function') - { + } else if ($ctag2->GetName() == 'match') { + $this->artNotes[$field]['match'] = str_replace('#n#', ' ', $ctag2->GetInnerText()); + } else if ($ctag2->GetName() == 'function') { $this->artNotes[$field]['function'] = $ctag2->GetInnerText(); } } } - }//End Loop + } //End Loop $dtp->Clear(); $dtp2->Clear(); @@ -244,7 +218,7 @@ class DedeCollection * @param bool $issave 是否保存 * @return string */ - function DownUrl($aid, $dourl, $litpic='', $issave=TRUE) + function DownUrl($aid, $dourl, $litpic = '', $issave = TRUE) { $this->tmpLinks = array(); $this->tmpUnitValue = ''; @@ -252,25 +226,20 @@ class DedeCollection $this->tmpHtml = $this->DownOnePage($dourl); //检测是否有分页字段,并预先处理 - if(!empty($this->artNotes['sppage'])) - { + if (!empty($this->artNotes['sppage'])) { $noteid = ''; - foreach($this->artNotes as $k=>$sarr) - { - if(isset($sarr['isunit']) && $sarr['isunit']==1) - { + foreach ($this->artNotes as $k => $sarr) { + if (isset($sarr['isunit']) && $sarr['isunit'] == 1) { $noteid = $k; break; } } - + $this->GetSpPage($dourl, $noteid, $this->tmpHtml); - if(preg_match("/#p#/i", $this->tmpUnitValue)) - { - if ($this->artNotes["sptype"] != 'diyrule') - { - $this->tmpUnitValue = '副标题#e#'.$this->tmpUnitValue; + if (preg_match("/#p#/i", $this->tmpUnitValue)) { + if ($this->artNotes["sptype"] != 'diyrule') { + $this->tmpUnitValue = '副标题#e#' . $this->tmpUnitValue; } } } @@ -279,46 +248,41 @@ class DedeCollection $body = $this->GetPageFields($dourl, $issave, $litpic); //保存资料到数据库 - if($issave) - { - $query = " UPDATE `#@__co_htmls` SET dtime='".time()."',result='".addslashes($body)."',isdown='1' WHERE aid='$aid' "; - if(!$this->dsql->ExecuteNoneQuery($query)) - { + if ($issave) { + $query = " UPDATE `#@__co_htmls` SET dtime='" . time() . "',result='" . addslashes($body) . "',isdown='1' WHERE aid='$aid' "; + if (!$this->dsql->ExecuteNoneQuery($query)) { echo $this->dsql->GetError(); } return $body; } return $body; } - + // 解析地址 function GetUrl($uri) { $arr = $tmp = array(); // query - $x = array_pad( explode( '?', $uri ), 2, false ); - $arr['query'] = ( $x[1] )? $x[1] : '' ; + $x = array_pad(explode('?', $uri), 2, false); + $arr['query'] = ($x[1]) ? $x[1] : ''; // resource - $x = array_pad( explode( '/', $x[0] ), 2, false ); - $x_last = array_pop( $x ); - if( strpos( $x_last, '.' ) === false ) - { + $x = array_pad(explode('/', $x[0]), 2, false); + $x_last = array_pop($x); + if (strpos($x_last, '.') === false) { $arr['resource'] = ''; $x[] = $x_last; - } - else - { + } else { $arr['resource'] = $x_last; $tmp = @explode('.', $arr['resource']); $arr['file'] = @$tmp[0]; - $arr['ext'] = '.'.@$tmp[1]; + $arr['ext'] = '.' . @$tmp[1]; } // path - $arr['path'] = implode( '/', $x ); - if( substr( $arr['path'], -1 ) !== '/' ) $arr['path'] .= '/'; + $arr['path'] = implode('/', $x); + if (substr($arr['path'], -1) !== '/') $arr['path'] .= '/'; // url $arr['url'] = $uri; @@ -336,60 +300,47 @@ class DedeCollection * @param int $step 步骤 * @return string */ - function GetSpPage($dourl, $noteid, $html, $step=0) + function GetSpPage($dourl, $noteid, $html, $step = 0) { $sarr = $this->artNotes[$noteid]; - + $linkareaHtml = $this->GetHtmlArea('[内容]', $this->artNotes['sppage'], $html); - if($linkareaHtml=='') - { - if($this->tmpUnitValue=='') - { + if ($linkareaHtml == '') { + if ($this->tmpUnitValue == '') { $this->tmpUnitValue .= $this->GetHtmlArea('[内容]', $sarr['match'], $html); - } - else - { - $this->tmpUnitValue .= "#p#副标题#e#".$this->GetHtmlArea('[内容]', $sarr['match'], $html); + } else { + $this->tmpUnitValue .= "#p#副标题#e#" . $this->GetHtmlArea('[内容]', $sarr['match'], $html); } if ($this->artNotes["sptype"] != 'diyrule') return; - } - + //完整的分页列表 - if($this->artNotes["sptype"]=='full' || $this->artNotes["sptype"]=='') - { + if ($this->artNotes["sptype"] == 'full' || $this->artNotes["sptype"] == '') { $this->tmpUnitValue .= $this->GetHtmlArea('[内容]', $sarr['match'], $html); $this->cDedeHtml->GetLinkType = "link"; $this->cDedeHtml->SetSource($linkareaHtml, $dourl, 'link'); - foreach($this->cDedeHtml->Links as $k=>$t) - { + foreach ($this->cDedeHtml->Links as $k => $t) { $k = $this->cDedeHtml->FillUrl($k); - if($k==$dourl) - { + if ($k == $dourl) { continue; } $nhtml = $this->DownOnePage($k); - if($nhtml!='') - { + if ($nhtml != '') { $ct = trim($this->GetHtmlArea('[内容]', $sarr['match'], $nhtml)); - if($ct!='') - { - $this->tmpUnitValue .= "#p#副标题#e#".$ct; + if ($ct != '') { + $this->tmpUnitValue .= "#p#副标题#e#" . $ct; } } } - } - else if ($this->artNotes["sptype"] == 'diyrule') - { + } else if ($this->artNotes["sptype"] == 'diyrule') { $maxpage = 10; $urlinfo = $this->GetUrl($dourl); $testurl = str_replace(array_keys($urlinfo), array_values($urlinfo), $this->artNotes['sppage']); $testurl = str_ireplace('{p}', '~p~', $testurl); $testurl = str_replace(array('{', '}'), '', $testurl); $lastchash = md5($html); - for($i=$this->spNotes['srul']; $i <= $this->spNotes['erul']; $i++) - { + for ($i = $this->spNotes['srul']; $i <= $this->spNotes['erul']; $i++) { $tempurl = str_replace('~p~', $i, $testurl); $tempurl = $this->cDedeHtml->FillUrl($tempurl); @@ -397,47 +348,37 @@ class DedeCollection $newchash = md5($nhtml); if ($newchash == $lastchash) continue; $lastchash = $newchash; - - if($nhtml!='') - { + + if ($nhtml != '') { $ct = trim($this->GetHtmlArea('[内容]', $sarr['match'], $nhtml)); - if($ct!='') - { - $this->tmpUnitValue .= "#p#副标题#e#".$ct; + if ($ct != '') { + $this->tmpUnitValue .= "#p#副标题#e#" . $ct; // echo $this->tmpUnitValue;exit; } } } } //上下页形式或不完整的分页列表 - else - { - if($step>50) - { + else { + if ($step > 50) { return; } - if($step==0) - { + if ($step == 0) { $this->tmpUnitValue .= $this->GetHtmlArea('[内容]', $sarr['match'], $html); } $this->cDedeHtml->GetLinkType = "link"; $this->cDedeHtml->SetSource($linkareaHtml, $dourl, 'link'); $hasLink = FALSE; - foreach($this->cDedeHtml->Links as $k=>$t) - { + foreach ($this->cDedeHtml->Links as $k => $t) { $k = $this->cDedeHtml->FillUrl($k); - if(in_array($k, $this->tmpLinks)) - { - CONTINUE; - } - else{ + if (in_array($k, $this->tmpLinks)) { + continue; + } else { $nhtml = $this->DownOnePage($k); - if($nhtml!='') - { - $ct = trim($this->GetHtmlArea('[内容]',$sarr['match'],$nhtml)); - if($ct!='') - { - $this->tmpUnitValue .= "#p#副标题#e#".$ct; + if ($nhtml != '') { + $ct = trim($this->GetHtmlArea('[内容]', $sarr['match'], $nhtml)); + if ($ct != '') { + $this->tmpUnitValue .= "#p#副标题#e#" . $ct; } } $hasLink = TRUE; @@ -446,8 +387,7 @@ class DedeCollection $step++; } } - if($hasLink) - { + if ($hasLink) { $this->GetSpPage($dourl, $noteid, $nhtml, $step); } } @@ -465,41 +405,33 @@ class DedeCollection function GetHtmlArea($sptag, &$areaRule, &$html) { //用正则表达式的模式匹配 - if($this->noteInfos['matchtype']=='regex') - { + if ($this->noteInfos['matchtype'] == 'regex') { $areaRule = str_replace("/", "\\/", $areaRule); $areaRules = explode($sptag, $areaRule); $arr = array(); - if($html==''||$areaRules[0]=='') - { + if ($html == '' || $areaRules[0] == '') { return ''; } - preg_match('#'.$areaRules[0]."(.*)".$areaRules[1]."#isU", $html, $arr); + preg_match('#' . $areaRules[0] . "(.*)" . $areaRules[1] . "#isU", $html, $arr); return empty($arr[1]) ? '' : trim($arr[1]); } //用字符串模式匹配 - else - { - $areaRules = explode($sptag,$areaRule); - if($html=='' || $areaRules[0]=='') - { + else { + $areaRules = explode($sptag, $areaRule); + if ($html == '' || $areaRules[0] == '') { return ''; } - $posstart = @strpos($html,$areaRules[0]); - if($posstart===FALSE) - { + $posstart = @strpos($html, $areaRules[0]); + if ($posstart === FALSE) { return ''; } $posstart = $posstart + strlen($areaRules[0]); - $posend = @strpos($html,$areaRules[1],$posstart); - if($posend > $posstart && $posend!==FALSE) - { + $posend = @strpos($html, $areaRules[1], $posstart); + if ($posend > $posstart && $posend !== FALSE) { //return substr($html,$posstart+strlen($areaRules[0]),$posend-$posstart-strlen($areaRules[0])); - return substr($html,$posstart,$posend-$posstart); - } - else - { + return substr($html, $posstart, $posend - $posstart); + } else { return ''; } } @@ -529,94 +461,77 @@ class DedeCollection * @param string $islitpic 是否缩略图 * @return string */ - function DownMedia($dourl, $mtype='img', $islitpic=FALSE) + function DownMedia($dourl, $mtype = 'img', $islitpic = FALSE) { global $notckpic; - if(empty($notckpic)) - { + if (empty($notckpic)) { $notckpic = 0; } //检测是否已经下载此文件 $wi = FALSE; $tofile = $filename = ''; - if($notckpic==0) - { - $row = $this->dsql->GetOne("SELECT hash,tofile FROM `#@__co_mediaurls` WHERE nid='{$this->noteId}' AND hash='".md5($dourl)."' "); - if(isset($row['tofile'])) - { + if ($notckpic == 0) { + $row = $this->dsql->GetOne("SELECT hash,tofile FROM `#@__co_mediaurls` WHERE nid='{$this->noteId}' AND hash='" . md5($dourl) . "' "); + if (isset($row['tofile'])) { $tofile = $filename = $row['tofile']; } } //如果不存在,下载文件 - if($tofile=='' || !file_exists($GLOBALS['cfg_basedir'].$filename)) - { - $filename = $this->GetRndName($dourl,$mtype); - if(!preg_match("#^\/#", $filename)) - { - $filename = "/".$filename; + if ($tofile == '' || !file_exists($GLOBALS['cfg_basedir'] . $filename)) { + $filename = $this->GetRndName($dourl, $mtype); + if (!preg_match("#^\/#", $filename)) { + $filename = "/" . $filename; } //防盗链模式 - if($this->noteInfos['isref']=='yes' && $this->noteInfos['refurl']!='') - { - if($this->noteInfos['exptime']=='') - { + if ($this->noteInfos['isref'] == 'yes' && $this->noteInfos['refurl'] != '') { + if ($this->noteInfos['exptime'] == '') { $this->noteInfos['exptime'] = 10; } - DownImageKeep($dourl,$this->noteInfos['refurl'],$GLOBALS['cfg_basedir'].$filename,'',0,$this->Item['exptime']); + DownImageKeep($dourl, $this->noteInfos['refurl'], $GLOBALS['cfg_basedir'] . $filename, '', 0, $this->Item['exptime']); } //普通模式 - else - { + else { $this->cHttpDown->OpenUrl($dourl); - $this->cHttpDown->SaveToBin($GLOBALS['cfg_basedir'].$filename); + $this->cHttpDown->SaveToBin($GLOBALS['cfg_basedir'] . $filename); $this->cHttpDown->Close(); } //下载文件成功,保存记录 - if(file_exists($GLOBALS['cfg_basedir'].$filename)) - { - if($tofile=='') - { - $query = "INSERT INTO `#@__co_mediaurls`(nid,hash,tofile) VALUES ('".$this->noteId."', '".md5($dourl)."', '".addslashes($filename)."');"; - } - else - { - $query = "UPDATE `#@__co_mediaurls` SET tofile='".addslashes($filename)."' WHERE hash='".md5($dourl)."' "; + if (file_exists($GLOBALS['cfg_basedir'] . $filename)) { + if ($tofile == '') { + $query = "INSERT INTO `#@__co_mediaurls`(nid,hash,tofile) VALUES ('" . $this->noteId . "', '" . md5($dourl) . "', '" . addslashes($filename) . "');"; + } else { + $query = "UPDATE `#@__co_mediaurls` SET tofile='" . addslashes($filename) . "' WHERE hash='" . md5($dourl) . "' "; } $this->dsql->ExecuteNoneQuery($query); } } //如果下载图片失败或图片不存在,返回网址 - if(!file_exists($GLOBALS['cfg_basedir'].$filename)) - { + if (!file_exists($GLOBALS['cfg_basedir'] . $filename)) { return $dourl; } //生成缩略图 - if($mtype=='img' && !$islitpic && $this->breImage=='') - { + if ($mtype == 'img' && !$islitpic && $this->breImage == '') { $this->breImage = $filename; - if(!preg_match("#^http:\/\/#", $this->breImage) && file_exists($GLOBALS['cfg_basedir'].$filename)) - { - $filenames = explode('/',$filename); - $filenamed = $filenames[count($filenames)-1]; - $nfilename = str_replace('.','_lit.',$filenamed); - $nfilename = str_replace($filenamed,$nfilename,$filename); - if(@copy($GLOBALS['cfg_basedir'].$filename, $GLOBALS['cfg_basedir'].$nfilename)) - { - ImageResize($GLOBALS['cfg_basedir'].$nfilename,$GLOBALS['cfg_ddimg_width'],$GLOBALS['cfg_ddimg_height']); + if (!preg_match("#^http:\/\/#", $this->breImage) && file_exists($GLOBALS['cfg_basedir'] . $filename)) { + $filenames = explode('/', $filename); + $filenamed = $filenames[count($filenames) - 1]; + $nfilename = str_replace('.', '_lit.', $filenamed); + $nfilename = str_replace($filenamed, $nfilename, $filename); + if (@copy($GLOBALS['cfg_basedir'] . $filename, $GLOBALS['cfg_basedir'] . $nfilename)) { + ImageResize($GLOBALS['cfg_basedir'] . $nfilename, $GLOBALS['cfg_ddimg_width'], $GLOBALS['cfg_ddimg_height']); $this->breImage = $nfilename; } } } - if($mtype=='img' && !$islitpic) - { - @WaterImg($GLOBALS['cfg_basedir'].$filename,'collect'); + if ($mtype == 'img' && !$islitpic) { + @WaterImg($GLOBALS['cfg_basedir'] . $filename, 'collect'); } return $filename; } @@ -631,55 +546,44 @@ class DedeCollection */ function GetRndName($url, $v) { - global $cfg_image_dir,$cfg_dir_purview; + global $cfg_image_dir, $cfg_dir_purview; $this->mediaCount++; $mnum = $this->mediaCount; - $timedir = "c".MyDate("ymd",time()); + $timedir = "c" . MyDate("ymd", time()); //存放路径 - $fullurl = preg_replace("#\/{1,}#", "/", $cfg_image_dir."/"); - if(!is_dir($GLOBALS['cfg_basedir']."/$fullurl")) - { - MkdirAll($GLOBALS['cfg_basedir']."/$fullurl", $cfg_dir_purview); + $fullurl = preg_replace("#\/{1,}#", "/", $cfg_image_dir . "/"); + if (!is_dir($GLOBALS['cfg_basedir'] . "/$fullurl")) { + MkdirAll($GLOBALS['cfg_basedir'] . "/$fullurl", $cfg_dir_purview); } - $fullurl = $fullurl.$timedir."/"; - if(!is_dir($GLOBALS['cfg_basedir']."/$fullurl")) - { - MkdirAll($GLOBALS['cfg_basedir']."/$fullurl", $cfg_dir_purview); + $fullurl = $fullurl . $timedir . "/"; + if (!is_dir($GLOBALS['cfg_basedir'] . "/$fullurl")) { + MkdirAll($GLOBALS['cfg_basedir'] . "/$fullurl", $cfg_dir_purview); } //文件名称 - $timename = str_replace('.','', ExecTime()); + $timename = str_replace('.', '', ExecTime()); $threadnum = 0; - if(isset($_GET['threadnum'])) - { + if (isset($_GET['threadnum'])) { $threadnum = intval($_GET['threadnum']); } - $filename = dd2char($timename.$threadnum.'-'.$mnum.mt_rand(1000,9999)); + $filename = dd2char($timename . $threadnum . '-' . $mnum . mt_rand(1000, 9999)); //分配扩展名 - $urls = explode('.',$url); - if($v=='img') - { + $urls = explode('.', $url); + if ($v == 'img') { $shortname = '.jpg'; - if(preg_match("#\.gif$#i", $url)) - { + if (preg_match("#\.gif$#i", $url)) { $shortname = '.gif'; - } - else if(preg_match("#\.png$#i", $url)) - { + } else if (preg_match("#\.png$#i", $url)) { $shortname = '.png'; } - } - else if($v=='embed') - { + } else if ($v == 'embed') { $shortname = '.swf'; - } - else - { + } else { $shortname = ''; } - $fullname = $fullurl.$filename.$shortname; + $fullname = $fullurl . $filename . $shortname; return preg_replace("#\/{1,}#", "/", $fullname); } @@ -692,11 +596,10 @@ class DedeCollection * @param string $litpic 缩略图 * @return string */ - function GetPageFields($dourl, $needDown, $litpic='') + function GetPageFields($dourl, $needDown, $litpic = '') { global $cfg_auot_description; - if($this->tmpHtml == '') - { + if ($this->tmpHtml == '') { return ''; } $artitem = ''; @@ -707,106 +610,77 @@ class DedeCollection //自动分析关键字和摘要 preg_match("#tmpHtml, $inarr); preg_match("#tmpHtml, $inarr2); - if(!isset($inarr[1]) && isset($inarr2[1])) - { + if (!isset($inarr[1]) && isset($inarr2[1])) { $inarr[1] = $inarr2[1]; } - if(isset($inarr[1])) - { - $keywords = trim(cn_substr(html2text($inarr[1]),30)); - $keywords = preg_replace("#".$this->artNotes['keywordtrim']."#isU",'',$keywords); - if(!preg_match("#,#", $keywords)) - { + if (isset($inarr[1])) { + $keywords = trim(cn_substr(html2text($inarr[1]), 30)); + $keywords = preg_replace("#" . $this->artNotes['keywordtrim'] . "#isU", '', $keywords); + if (!preg_match("#,#", $keywords)) { $keywords = str_replace(' ', ',', $keywords); } - $artitem .= "{dede:field name='keywords'}".$keywords."{/dede:field}\r\n"; - } - else - { + $artitem .= "{dede:field name='keywords'}" . $keywords . "{/dede:field}\r\n"; + } else { $artitem .= "{dede:field name='keywords'}{/dede:field}\r\n"; } // preg_match("#tmpHtml, $inarr); // preg_match("#tmpHtml, $inarr2); preg_match("#]*?)['\"]#iU", $this->tmpHtml, $inarr); preg_match("#]*?)['\"][\s]+name=['\"]description['\"]#iU", $this->tmpHtml, $inarr2); - if(!isset($inarr[1]) && isset($inarr2[1])) - { + if (!isset($inarr[1]) && isset($inarr2[1])) { $inarr[1] = $inarr2[1]; } - if(isset($inarr[1])) - { - $description = trim(cn_substr(html2text($inarr[1]),$cfg_auot_description)); - $description = preg_replace("/".$this->artNotes['descriptiontrim']."/isU",'',$description); - $artitem .= "{dede:field name='description'}".$description."{/dede:field}\r\n"; - } - else - { + if (isset($inarr[1])) { + $description = trim(cn_substr(html2text($inarr[1]), $cfg_auot_description)); + $description = preg_replace("/" . $this->artNotes['descriptiontrim'] . "/isU", '', $description); + $artitem .= "{dede:field name='description'}" . $description . "{/dede:field}\r\n"; + } else { $artitem .= "{dede:field name='description'}{/dede:field}\r\n"; } - foreach($this->artNotes as $k=>$sarr) - { + foreach ($this->artNotes as $k => $sarr) { //可能出现意外的情况 - if($k=='sppage' || $k=='sptype') - { + if ($k == 'sppage' || $k == 'sptype') { continue; } - if(!is_array($sarr)) - { + if (!is_array($sarr)) { continue; } //特殊的规则或没匹配选项 - if($sarr['match']=='' || trim($sarr['match'])=='[内容]') - { - if($sarr['value']!='[内容]') - { + if ($sarr['match'] == '' || trim($sarr['match']) == '[内容]') { + if ($sarr['value'] != '[内容]') { $v = trim($sarr['value']); - } - else - { + } else { $v = ''; } - } - else - { + } else { //分多页的内容 - if($this->tmpUnitValue!='' && !$isPutUnit && $sarr['isunit']==1) - { + if ($this->tmpUnitValue != '' && !$isPutUnit && $sarr['isunit'] == 1) { $v = $this->tmpUnitValue; $isPutUnit = TRUE; - } - else - { - $v = $this->GetHtmlArea('[内容]',$sarr['match'],$this->tmpHtml); + } else { + $v = $this->GetHtmlArea('[内容]', $sarr['match'], $this->tmpHtml); } //过滤内容规则 - if(isset($sarr['trim']) && $v!='') - { - foreach($sarr['trim'] as $nv) - { - if($nv[0]=='') - { + if (isset($sarr['trim']) && $v != '') { + foreach ($sarr['trim'] as $nv) { + if ($nv[0] == '') { continue; } $nvs = str_replace("/", "\\/", $nv[0]); - $v = preg_replace("#".$nvs."#isU", $nv[1], $v); + $v = preg_replace("#" . $nvs . "#isU", $nv[1], $v); } } //是否下载远程资源 - if($needDown) - { - if($sarr['isdown'] == '1') - { + if ($needDown) { + if ($sarr['isdown'] == '1') { $v = $this->DownMedias($v, $dourl); } - } - else - { - if($sarr['isdown'] == '1') - { + } else { + if ($sarr['isdown'] == '1') { $v = $this->MediasReplace($v, $dourl); } } @@ -814,34 +688,27 @@ class DedeCollection $v = trim($v); //用户自行对内容进行处理的接口 - if($sarr['function'] != '') - { + if ($sarr['function'] != '') { $tmpLtKeys[$k]['v'] = $v; $tmpLtKeys[$k]['f'] = $sarr['function']; - } - else - { + } else { $v = preg_replace("#( )$#", '', $v); $v = preg_replace("#[\r\n\t ]{1,}$#", '', $v); $artitem .= "{dede:field name='$k'}$v{/dede:field}\r\n"; } - }//End Foreach + } //End Foreach //处理带函数的项目 - foreach($tmpLtKeys as $k=>$sarr) - { - $v = $this->RunPHP($sarr['v'],$sarr['f']); + foreach ($tmpLtKeys as $k => $sarr) { + $v = $this->RunPHP($sarr['v'], $sarr['f']); $v = preg_replace("#( )$#", '', $v); $v = preg_replace("#[\r\n\t ]{1,}$#", '', $v); $artitem .= "{dede:field name='$k'}$v{/dede:field}\r\n"; } - if($litpic!='' && $this->lists['listpic']==1) - { - $artitem .= "{dede:field name='litpic'}".$this->DownMedia($litpic,'img',TRUE)."{/dede:field}\r\n"; - } - else - { - $artitem .= "{dede:field name='litpic'}".$this->breImage."{/dede:field}\r\n"; + if ($litpic != '' && $this->lists['listpic'] == 1) { + $artitem .= "{dede:field name='litpic'}" . $this->DownMedia($litpic, 'img', TRUE) . "{/dede:field}\r\n"; + } else { + $artitem .= "{dede:field name='litpic'}" . $this->breImage . "{/dede:field}\r\n"; } return $artitem; } @@ -856,14 +723,12 @@ class DedeCollection */ function DownMedias(&$html, $url) { - $this->cDedeHtml->SetSource($html,$url,'media'); + $this->cDedeHtml->SetSource($html, $url, 'media'); //下载标记里的图片和flash - foreach($this->cDedeHtml->Medias as $k=>$v) - { + foreach ($this->cDedeHtml->Medias as $k => $v) { $furl = $this->cDedeHtml->FillUrl($k); - if($v=='embed' && !preg_match("#\.(swf)\?(.*)$#i", $k)&& !preg_match("#\.(swf)$#i", $k)) - { + if ($v == 'embed' && !preg_match("#\.(swf)\?(.*)$#i", $k) && !preg_match("#\.(swf)$#i", $k)) { continue; } $okurl = $this->DownMedia($furl, $v); @@ -871,18 +736,12 @@ class DedeCollection } //下载超链接里的图片 - foreach($this->cDedeHtml->Links as $v=>$k) - { - if(preg_match("#\.(jpg|gif|png)\?(.*)$#i",$v) || preg_match("#\.(jpg|gif|png)$#i", $v)) - { + foreach ($this->cDedeHtml->Links as $v => $k) { + if (preg_match("#\.(jpg|gif|png)\?(.*)$#i", $v) || preg_match("#\.(jpg|gif|png)$#i", $v)) { $m = "img"; - } - else if(preg_match("#\.(swf)\?(.*)$#i", $v) || preg_match("#\.(swf)$#i", $v)) - { + } else if (preg_match("#\.(swf)\?(.*)$#i", $v) || preg_match("#\.(swf)$#i", $v)) { $m = "embed"; - } - else - { + } else { continue; } $furl = $this->cDedeHtml->FillUrl($v); @@ -903,8 +762,7 @@ class DedeCollection function MediasReplace(&$html, $dourl) { $this->cDedeHtml->SetSource($html, $dourl, 'media'); - foreach($this->cDedeHtml->Medias as $k=>$v) - { + foreach ($this->cDedeHtml->Medias as $k => $v) { $k = trim($k); $okurl = $this->cDedeHtml->FillUrl($k); $html = str_replace($k, $okurl, $html); @@ -918,52 +776,41 @@ class DedeCollection $links = array(); //从RSS中获取网址 - if($this->lists['sourcetype']=='rss') - { + if ($this->lists['sourcetype'] == 'rss') { $dourl = $this->lists['rssurl']; $links = GetRssLinks($dourl); return $links; } //正常情况 - if(isset($this->lists['url'][0][0])) - { + if (isset($this->lists['url'][0][0])) { $dourl = $this->lists['url'][0][0]; - } - else - { + } else { $dourl = ''; $this->errString = "配置中指定列表的网址错误!\r\n"; return $links; } $dhtml = new DedeHtml2(); $html = $this->DownOnePage($dourl); - if($html=='') - { + if ($html == '') { $this->errString = "读取网址: $dourl 时失败!\r\n"; return $links; } - if( trim($this->lists['areastart']) !='' && trim($this->lists['areaend']) != '' ) - { - $areabody = $this->lists['areastart'].'[var:区域]'.$this->lists['areaend']; - $html = $this->GetHtmlArea('[var:区域]',$areabody,$html); + if (trim($this->lists['areastart']) != '' && trim($this->lists['areaend']) != '') { + $areabody = $this->lists['areastart'] . '[var:区域]' . $this->lists['areaend']; + $html = $this->GetHtmlArea('[var:区域]', $areabody, $html); } $t1 = ExecTime(); - $dhtml->SetSource($html,$dourl,'link'); - $this->lists['musthas'] = str_replace('/', '\/', $this->lists['musthas']); - foreach($dhtml->Links as $s) - { - if($this->lists['nothas']!='') - { - if( preg_match("#".$this->lists['nothas']."#i", $s['link']) ) - { + $dhtml->SetSource($html, $dourl, 'link'); + $this->lists['musthas'] = str_replace('/', '\/', $this->lists['musthas']); + foreach ($dhtml->Links as $s) { + if ($this->lists['nothas'] != '') { + if (preg_match("#" . $this->lists['nothas'] . "#i", $s['link'])) { continue; } } - if($this->lists['musthas']!='') - { - if( !preg_match("#".$this->lists['musthas']."#i", $s['link']) ) - { + if ($this->lists['musthas'] != '') { + if (!preg_match("#" . $this->lists['musthas'] . "#i", $s['link'])) { continue; } } @@ -993,96 +840,78 @@ class DedeCollection * @param int $pagesize 分页尺寸 * @return string */ - function GetSourceUrl($islisten=0, $glstart=0, $pagesize=10) + function GetSourceUrl($islisten = 0, $glstart = 0, $pagesize = 10) { //在第一页中进行预处理 //“下载种子网址的未下载内容”的模式不需要经过采集种子网址的步骤 - if($glstart==0) - { + if ($glstart == 0) { //重新采集所有内容模式 - if($islisten == -1) - { - $this->dsql->ExecuteNoneQuery("DELETE FROM `#@__co_urls` WHERE nid='".$this->noteId."'"); - $this->dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` WHERE nid='".$this->noteId."' "); + if ($islisten == -1) { + $this->dsql->ExecuteNoneQuery("DELETE FROM `#@__co_urls` WHERE nid='" . $this->noteId . "'"); + $this->dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` WHERE nid='" . $this->noteId . "' "); } //监听模式(保留未导出的内容、保留节点的历史网址记录) - else - { - $this->dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` WHERE nid='".$this->noteId."' AND isexport=1 "); + else { + $this->dsql->ExecuteNoneQuery("DELETE FROM `#@__co_htmls` WHERE nid='" . $this->noteId . "' AND isexport=1 "); } } //从RSS中获取种子 - if($this->lists['sourcetype']=='rss') - { + if ($this->lists['sourcetype'] == 'rss') { $links = GetRssLinks($this->lists['rssurl']); //if($this->noteInfos['cosort']!='asc') $tmplink = krsort($links); $lk = 0; - foreach($links as $v) - { - if($islisten==1) - { - $lrow = $this->dsql->GetOne("SELECT * FROM `#@__co_urls` WHERE nid='{$this->noteId}' AND hash='".md5($v['link'])."' "); - if(is_array($lrow)) - { + foreach ($links as $v) { + if ($islisten == 1) { + $lrow = $this->dsql->GetOne("SELECT * FROM `#@__co_urls` WHERE nid='{$this->noteId}' AND hash='" . md5($v['link']) . "' "); + if (is_array($lrow)) { continue; } } $lk++; - if($mytotal > 0 && $lk >= $mytotal) break; + if ($mytotal > 0 && $lk >= $mytotal) break; $inquery = "INSERT INTO `#@__co_htmls` (`nid` ,`typeid`, `title` , `litpic` , `url` , `dtime` , `isdown` , `isexport` , `result`) - VALUES ('{$this->noteId}' , '0', '".addslashes($v['title'])."' , '".addslashes($v['image'])."' , '".addslashes($v['link'])."' , 'dtime' , '0' , '0' , ''); "; + VALUES ('{$this->noteId}' , '0', '" . addslashes($v['title']) . "' , '" . addslashes($v['image']) . "' , '" . addslashes($v['link']) . "' , 'dtime' , '0' , '0' , ''); "; $this->dsql->ExecuteNoneQuery($inquery); - $inquery = "INSERT INTO `#@__co_urls`(hash,nid) VALUES ('".md5($v['link'])."','{$this->noteId}');"; + $inquery = "INSERT INTO `#@__co_urls`(hash,nid) VALUES ('" . md5($v['link']) . "','{$this->noteId}');"; $this->dsql->ExecuteNoneQuery($inquery); } return 0; - } - else - { + } else { $tmplink = array(); $arrStart = 0; $moviePostion = 0; $endpos = $glstart + $pagesize; $totallen = count($this->lists['url']); - //dump($this->lists['url']);exit; - foreach($this->lists['url'] as $k=>$cururls) - { + //dump($this->lists['url']);exit; + foreach ($this->lists['url'] as $k => $cururls) { //$status = FALSE; $urlnum = 0; $cururl = $cururls[0]; $typeid = (empty($cururls[1]) ? 0 : $cururls[1]); $moviePostion++; - - if($moviePostion > $endpos) - { + + if ($moviePostion > $endpos) { break; } - if($moviePostion > $glstart) - { + if ($moviePostion > $glstart) { $html = $this->DownOnePage($cururl); - if( trim($this->lists['areastart']) !='' && trim($this->lists['areaend']) != '' ) - { - $areabody = $this->lists['areastart'].'[var:区域]'.$this->lists['areaend']; - $html = $this->GetHtmlArea('[var:区域]',$areabody,$html); + if (trim($this->lists['areastart']) != '' && trim($this->lists['areaend']) != '') { + $areabody = $this->lists['areastart'] . '[var:区域]' . $this->lists['areaend']; + $html = $this->GetHtmlArea('[var:区域]', $areabody, $html); } $this->cDedeHtml->SetSource($html, $cururl, 'link'); $lk = 0; - foreach($this->cDedeHtml->Links as $k=>$v) - { - if($this->lists['nothas']!='') - { - if( preg_match("#".$this->lists['nothas']."#", $v['link']) ) - { + foreach ($this->cDedeHtml->Links as $k => $v) { + if ($this->lists['nothas'] != '') { + if (preg_match("#" . $this->lists['nothas'] . "#", $v['link'])) { continue; } } - if($this->lists['musthas']!='') - { - if( !preg_match("#".$this->lists['musthas']."#i", $v['link']) ) - { + if ($this->lists['musthas'] != '') { + if (!preg_match("#" . $this->lists['musthas'] . "#i", $v['link'])) { continue; } } @@ -1093,58 +922,45 @@ class DedeCollection } $this->cDedeHtml->Clear(); } - }//foreach + } //foreach //if($this->noteInfos['cosort']!='asc') krsort($tmplink); $unum = count($tmplink); - if($unum>0) - { + if ($unum > 0) { //echo "完成本次种子网址抓取,共找到:{$unum} 个记录!
      \r\n"; - foreach($tmplink as $vs) - { + foreach ($tmplink as $vs) { $v = $vs[0]; $typeid = $vs[1]; - if($islisten==1) - { - $lrow = $this->dsql->GetOne("SELECT * FROM `#@__co_urls` WHERE nid='{$this->noteId}' AND hash='".md5($v['link'])."' "); - if(is_array($lrow)) - { + if ($islisten == 1) { + $lrow = $this->dsql->GetOne("SELECT * FROM `#@__co_urls` WHERE nid='{$this->noteId}' AND hash='" . md5($v['link']) . "' "); + if (is_array($lrow)) { continue; } } $inquery = "INSERT INTO `#@__co_htmls` (`nid` ,`typeid`, `title` , `litpic` , `url` , `dtime` , `isdown` , `isexport` , `result`) - VALUES ('{$this->noteId}' ,'$typeid', '".addslashes($v['title'])."' , '".addslashes($v['image'])."' , '".addslashes($v['link'])."' , '".time()."' , '0' , '0' , ''); "; + VALUES ('{$this->noteId}' ,'$typeid', '" . addslashes($v['title']) . "' , '" . addslashes($v['image']) . "' , '" . addslashes($v['link']) . "' , '" . time() . "' , '0' , '0' , ''); "; $this->dsql->ExecuteNoneQuery($inquery); - $inquery = "INSERT INTO `#@__co_urls`(hash,nid) VALUES ('".md5($v['link'])."','{$this->noteId}');"; + $inquery = "INSERT INTO `#@__co_urls`(hash,nid) VALUES ('" . md5($v['link']) . "','{$this->noteId}');"; $this->dsql->ExecuteNoneQuery($inquery); } - if($endpos >= $totallen) - { + if ($endpos >= $totallen) { return 0; + } else { + return ($totallen - $endpos); } - else - { - return ($totallen-$endpos); - } - } - else - { + } else { //仅在第一批采集时出错才返回 - if($glstart==0) - { + if ($glstart == 0) { return -1; } //在其它页出错照常采集后面内容 - if($endpos >= $totallen) - { + if ($endpos >= $totallen) { return 0; - } - else - { - return ($totallen-$endpos); + } else { + return ($totallen - $endpos); } } } @@ -1162,17 +978,15 @@ class DedeCollection { $DedeMeValue = $fvalue; $phpcode = preg_replace("#'@me'|\"@me\"|@me#isU", '$DedeMeValue', $phpcode); - if(preg_match("#@body#i", $phpcode)) - { + if (preg_match("#@body#i", $phpcode)) { $DedeBodyValue = $this->tmpHtml; $phpcode = preg_replace("#'@body'|\"@body\"|@body#isU", '$DedeBodyValue', $phpcode); } - if(preg_match("#@litpic#i", $phpcode)) - { + if (preg_match("#@litpic#i", $phpcode)) { $DedeLitPicValue = $this->breImage; $phpcode = preg_replace("#'@litpic'|\"@litpic\"|@litpic#isU", '$DedeLitPicValue', $phpcode); } - eval($phpcode.";"); + eval($phpcode . ";"); return $DedeMeValue; } @@ -1186,25 +1000,18 @@ class DedeCollection function ChangeCode(&$str) { global $cfg_soft_lang; - if($cfg_soft_lang=='utf-8') - { - if($this->noteInfos["sourcelang"]=="gb2312") - { + if ($cfg_soft_lang == 'utf-8') { + if ($this->noteInfos["sourcelang"] == "gb2312") { $str = gb2utf8($str); } - if($this->noteInfos["sourcelang"]=="big5") - { + if ($this->noteInfos["sourcelang"] == "big5") { $str = gb2utf8(big52gb($str)); } - } - else - { - if($this->noteInfos["sourcelang"]=="utf-8") - { + } else { + if ($this->noteInfos["sourcelang"] == "utf-8") { $str = utf82gb($str); } - if($this->noteInfos["sourcelang"]=="big5") - { + if ($this->noteInfos["sourcelang"] == "big5") { $str = big52gb($str); } } diff --git a/src/include/dedecollection.func.php b/src/include/dedecollection.func.php index 8debcff9..ee9bc2cb 100755 --- a/src/include/dedecollection.func.php +++ b/src/include/dedecollection.func.php @@ -1,17 +1,17 @@ -100) - { + while (!feof($m_fp)) { + $line = trim(fgets($m_fp, 256)); + if ($line == "" || $lnum > 100) { break; } $hkey = ""; $hvalue = ""; $v = 0; - for($i=0; $i$maxtime) - { + if (time() - $starttime > $maxtime) { break; } //到达指定大小结束 - if($i >= $contentLength) - { + if ($i >= $contentLength) { break; } } - if($okdata!="") - { - fwrite($fp,$okdata); + if ($okdata != "") { + fwrite($fp, $okdata); } fclose($fp); - if($okdata=="") - { + if ($okdata == "") { @unlink($filename); fclose($m_fp); return FALSE; @@ -160,18 +139,14 @@ function DownImageKeep($gurl, $rfurl, $filename, $gcookie="", $JumpCount=0, $max */ function RefurlCookie($gurl) { - global $gcookie,$lastRfurl; + global $gcookie, $lastRfurl; $gurl = trim($gurl); - if(!empty($gcookie) && $lastRfurl==$gurl) - { + if (!empty($gcookie) && $lastRfurl == $gurl) { return $gcookie; + } else { + $lastRfurl = $gurl; } - else - { - $lastRfurl=$gurl; - } - if(trim($gurl)=='') - { + if (trim($gurl) == '') { return ''; } $urlinfos = GetHostInfo($gurl); @@ -184,23 +159,18 @@ function RefurlCookie($gurl) $sessionQuery .= "Connection: Close\r\n\r\n"; $errno = ""; $errstr = ""; - $m_fp = fsockopen($ghost, 80, $errno, $errstr,10) or die($ghost.'
      '); - fwrite($m_fp,$sessionQuery); + $m_fp = fsockopen($ghost, 80, $errno, $errstr, 10) or die($ghost . '
      '); + fwrite($m_fp, $sessionQuery); $lnum = 0; //获取详细应答头 $gcookie = ""; - while(!feof($m_fp)) - { - $line = trim(fgets($m_fp,256)); - if($line == "" || $lnum>100) - { + while (!feof($m_fp)) { + $line = trim(fgets($m_fp, 256)); + if ($line == "" || $lnum > 100) { break; - } - else - { - if(preg_match("/^cookie/i", $line)) - { + } else { + if (preg_match("/^cookie/i", $line)) { $gcookie = $line; break; } @@ -221,7 +191,7 @@ function GetHostInfo($gurl) { $gurl = preg_replace("/^http:\/\//i", "", trim($gurl)); $garr['host'] = preg_replace("/\/(.*)$/i", "", $gurl); - $garr['query'] = "/".preg_replace("/^([^\/]*)\//i", "", $gurl); + $garr['query'] = "/" . preg_replace("/^([^\/]*)\//i", "", $gurl); return $garr; } @@ -234,31 +204,25 @@ function GetHostInfo($gurl) */ function TurnImageTag(&$body) { - global $cfg_album_width,$cfg_ddimg_width; - if(empty($cfg_album_width)) - { + global $cfg_album_width, $cfg_ddimg_width; + if (empty($cfg_album_width)) { $cfg_album_width = 800; } - if(empty($cfg_ddimg_width)) - { + if (empty($cfg_ddimg_width)) { $cfg_ddimg_width = 150; } $patten = "/<\\s*img\\s.*?src\\s*=\\s*([\"\\'])?(?(1)(.*?)\\1|([^\\s\\>\"\\']+))/isx"; - preg_match_all($patten,$body,$images); + preg_match_all($patten, $body, $images); $returnArray1 = $images[2]; $returnArray2 = $images[3]; - foreach ( $returnArray1 as $key => $value ) - { - if ($value) - { - $ttx .= "{dede:img ddimg='$litpicname' text='图 ".($key+1)."'}".$value."{/dede:img}"."\r\n"; - } - else - { - $ttx .= "{dede:img ddimg='$litpicname' text='图 ".($key+1)."'}".$returnArray2[$key]."{/dede:img}"."\r\n"; + foreach ($returnArray1 as $key => $value) { + if ($value) { + $ttx .= "{dede:img ddimg='$litpicname' text='图 " . ($key + 1) . "'}" . $value . "{/dede:img}" . "\r\n"; + } else { + $ttx .= "{dede:img ddimg='$litpicname' text='图 " . ($key + 1) . "'}" . $returnArray2[$key] . "{/dede:img}" . "\r\n"; } } - $ttx = "\r\n{dede:pagestyle maxwidth='{$cfg_album_width}' ddmaxwidth='{$cfg_ddimg_width}' row='3' col='3' value='2'/}\r\n{dede:comments}图集类型会采集时生成此配置是正常的,不过如果后面没有跟着img标记则表示规则无效{/dede:comments}\r\n".$ttx; + $ttx = "\r\n{dede:pagestyle maxwidth='{$cfg_album_width}' ddmaxwidth='{$cfg_ddimg_width}' row='3' col='3' value='2'/}\r\n{dede:comments}图集类型会采集时生成此配置是正常的,不过如果后面没有跟着img标记则表示规则无效{/dede:comments}\r\n" . $ttx; return $ttx; } @@ -273,15 +237,12 @@ function TurnLinkTag(&$body) { $ttx = ''; $handid = '服务器'; - preg_match_all("/]+?)>(.+?)<\/a>/is",$body,$match); - if(is_array($match[1]) && count($match[1])>0) - { - for($i=0;isset($match[1][$i]);$i++) - { - $servername = (isset($match[3][$i]) ? str_replace("'","`",$match[3][$i]) : $handid.($i+1)); - if(preg_match("/[<>]/", $servername) || strlen($servername)>40) - { - $servername = $handid.($i+1); + preg_match_all("/]+?)>(.+?)<\/a>/is", $body, $match); + if (is_array($match[1]) && count($match[1]) > 0) { + for ($i = 0; isset($match[1][$i]); $i++) { + $servername = (isset($match[3][$i]) ? str_replace("'", "`", $match[3][$i]) : $handid . ($i + 1)); + if (preg_match("/[<>]/", $servername) || strlen($servername) > 40) { + $servername = $handid . ($i + 1); } $ttx .= "{dede:link text='$servername'} {$match[1][$i]} {/dede:link}\r\n"; } @@ -318,63 +279,43 @@ function GetRssLinks($rssurl) $rsshtml = $dhd->GetHtml(); //分析编码 - preg_match("/encoding=[\"']([^\"']*)[\"']/is",$rsshtml,$infos); - if(isset($infos[1])) - { + preg_match("/encoding=[\"']([^\"']*)[\"']/is", $rsshtml, $infos); + if (isset($infos[1])) { $pcode = strtolower(trim($infos[1])); - } - else - { + } else { $pcode = strtolower($cfg_soft_lang); } - if($cfg_soft_lang=='gb2312') - { - if($pcode=='utf-8') - { + if ($cfg_soft_lang == 'gb2312') { + if ($pcode == 'utf-8') { $rsshtml = utf82gb($rsshtml); - } - else if($pcode=='big5') - { + } else if ($pcode == 'big5') { $rsshtml = big52gb($rsshtml); } - } - else if($cfg_soft_lang=='utf-8') - { - if($pcode=='gbk'||$pcode=='gb2312') - { + } else if ($cfg_soft_lang == 'utf-8') { + if ($pcode == 'gbk' || $pcode == 'gb2312') { $rsshtml = gb2utf8($rsshtml); - } - else if($pcode=='big5') - { + } else if ($pcode == 'big5') { $rsshtml = gb2utf8(big52gb($rsshtml)); } } $rsarr = array(); - preg_match_all("/(.*)<\/title>/isU",$rsshtml,$titles); - preg_match_all("/(.*)<\/link>/isU",$rsshtml,$links); - preg_match_all("/(.*)<\/description>/isU",$rsshtml,$descriptions); - if(!isset($links[2])) - { + preg_match_all("/(.*)<\/title>/isU", $rsshtml, $titles); + preg_match_all("/(.*)<\/link>/isU", $rsshtml, $links); + preg_match_all("/(.*)<\/description>/isU", $rsshtml, $descriptions); + if (!isset($links[2])) { return ''; } - foreach($links[2] as $k=>$v) - { + foreach ($links[2] as $k => $v) { $rsarr[$k]['link'] = RpCdata($v); - if(isset($titles[2][$k])) - { + if (isset($titles[2][$k])) { $rsarr[$k]['title'] = RpCdata($titles[2][$k]); - } - else - { + } else { $rsarr[$k]['title'] = preg_replace("/^(.*)\//i", "", RpCdata($titles[2][$k])); } - if(isset($descriptions[2][$k])) - { - $rsarr[$k]['image'] = GetddImgFromRss($descriptions[2][$k],$rssurl); - } - else - { + if (isset($descriptions[2][$k])) { + $rsarr[$k]['image'] = GetddImgFromRss($descriptions[2][$k], $rssurl); + } else { $rsarr[$k]['image'] = ''; } } @@ -389,21 +330,17 @@ function GetRssLinks($rssurl) * @param string $refurl 来源地址 * @return string */ -function GetddImgFromRss($descriptions,$refurl) +function GetddImgFromRss($descriptions, $refurl) { - if($descriptions=='') - { + if ($descriptions == '') { return ''; } - preg_match_all("/ \r\n\t]{1,}/isU",$descriptions,$imgs); - if(isset($imgs[2][0])) - { + preg_match_all("/ \r\n\t]{1,}/isU", $descriptions, $imgs); + if (isset($imgs[2][0])) { $imgs[2][0] = preg_replace("/[\"']/", '', $imgs[2][0]); $imgs[2][0] = preg_replace("/\/{1,}/", '/', $imgs[2][0]); - return FillUrl($refurl,$imgs[2][0]); - } - else - { + return FillUrl($refurl, $imgs[2][0]); + } else { return ''; } } @@ -416,75 +353,56 @@ function GetddImgFromRss($descriptions,$refurl) * @param string $surl 站点地址 * @return string */ -function FillUrl($refurl,$surl) +function FillUrl($refurl, $surl) { $i = $pathStep = 0; $dstr = $pstr = $okurl = ''; $refurl = trim($refurl); $surl = trim($surl); $urls = @parse_url($refurl); - $basehost = ( (!isset($urls['port']) || $urls['port']=='80') ? $urls['host'] : $urls['host'].':'.$urls['port']); + $basehost = ((!isset($urls['port']) || $urls['port'] == '80') ? $urls['host'] : $urls['host'] . ':' . $urls['port']); //$basepath = $basehost.(!isset($urls['path']) ? '' : '/'.$urls['path']); //由于直接获得的path在处理 http://xxxx/nnn/aaa?fdsafd 这种情况时会有错误,因此用其它方式处理 $basepath = $basehost; - $paths = explode('/',preg_replace("/^http:\/\//i", "", $refurl)); + $paths = explode('/', preg_replace("/^http:\/\//i", "", $refurl)); $n = count($paths); - for($i=1;$i < ($n-1);$i++) - { - if(!preg_match("/[\?]/", $paths[$i])) $basepath .= '/'.$paths[$i]; + for ($i = 1; $i < ($n - 1); $i++) { + if (!preg_match("/[\?]/", $paths[$i])) $basepath .= '/' . $paths[$i]; } - if(!preg_match("/[\?\.]/", $paths[$n-1])) - { - $basepath .= '/'.$paths[$n-1]; + if (!preg_match("/[\?\.]/", $paths[$n - 1])) { + $basepath .= '/' . $paths[$n - 1]; } - if($surl=='') - { + if ($surl == '') { return $basepath; } $pos = strpos($surl, "#"); - if($pos>0) - { + if ($pos > 0) { $surl = substr($surl, 0, $pos); } //用 '/' 表示网站根的网址 - if($surl[0]=='/') - { - $okurl = $basehost.$surl; - } - else if($surl[0]=='.') - { - if(strlen($surl)<=2) - { + if ($surl[0] == '/') { + $okurl = $basehost . $surl; + } else if ($surl[0] == '.') { + if (strlen($surl) <= 2) { return ''; + } else if ($surl[1] == '/') { + $okurl = $basepath . preg_replace('/^./', '', $surl); + } else { + $okurl = $basepath . '/' . $surl; } - else if($surl[1]=='/') - { - $okurl = $basepath.preg_replace('/^./', '', $surl); - } - else - { - $okurl = $basepath.'/'.$surl; - } - } - else - { - if( strlen($surl) < 7 ) - { - $okurl = $basepath.'/'.$surl; - } - else if( preg_match("/^http:\/\//i",$surl) ) - { + } else { + if (strlen($surl) < 7) { + $okurl = $basepath . '/' . $surl; + } else if (preg_match("/^http:\/\//i", $surl)) { $okurl = $surl; - } - else - { - $okurl = $basepath.'/'.$surl; + } else { + $okurl = $basepath . '/' . $surl; } } $okurl = preg_replace("/^http:\/\//i", '', $okurl); - $okurl = 'http://'.preg_replace("/\/{1,}/", '/', $okurl); + $okurl = 'http://' . preg_replace("/\/{1,}/", '/', $okurl); return $okurl; } @@ -501,58 +419,46 @@ function FillUrl($refurl,$surl) * @param string $batchrule 列表规则 * @return string */ -function GetUrlFromListRule($regxurl='',$handurl='',$startid=0,$endid=0,$addv=1,$usemore=0,$batchrule='') +function GetUrlFromListRule($regxurl = '', $handurl = '', $startid = 0, $endid = 0, $addv = 1, $usemore = 0, $batchrule = '') { - global $dsql,$islisten; + global $dsql, $islisten; $lists = array(); $n = 0; $islisten = (empty($islisten) ? 0 : $islisten); - if($handurl!='') - { - $handurls = explode("\n",$handurl); - foreach($handurls as $handurl) - { + if ($handurl != '') { + $handurls = explode("\n", $handurl); + foreach ($handurls as $handurl) { $handurl = trim($handurl); - if(preg_match("/^http:\/\//i", $handurl)) - { + if (preg_match("/^http:\/\//i", $handurl)) { $lists[$n][0] = $handurl; $lists[$n][1] = 0; $n++; - if($islisten==1) - { + if ($islisten == 1) { break; } } } } - if($regxurl!='') - { + if ($regxurl != '') { //没指定(#)和(*) - if(!preg_match("/\(\*\)/i", $regxurl) && !preg_match("/\(#\)/", $regxurl)) - { + if (!preg_match("/\(\*\)/i", $regxurl) && !preg_match("/\(#\)/", $regxurl)) { $lists[$n][0] = $regxurl; $lists[$n][1] = 0; $n++; - } - else - { - if($addv <= 0) - { + } else { + if ($addv <= 0) { $addv = 1; } //没指定多栏目匹配规则 - if($usemore==0) - { - while($startid <= $endid) - { - $lists[$n][0] = str_replace("(*)",sprintf('%0'.strlen($startid).'d',$startid),$regxurl); + if ($usemore == 0) { + while ($startid <= $endid) { + $lists[$n][0] = str_replace("(*)", sprintf('%0' . strlen($startid) . 'd', $startid), $regxurl); $lists[$n][1] = 0; - $startid = sprintf('%0'.strlen($startid).'d',$startid + $addv); + $startid = sprintf('%0' . strlen($startid) . 'd', $startid + $addv); $n++; - if($n>2000 || $islisten==1) - { + if ($n > 2000 || $islisten == 1) { break; } } @@ -560,16 +466,13 @@ function GetUrlFromListRule($regxurl='',$handurl='',$startid=0,$endid=0,$addv=1, //匹配多个栏目 //规则表达式 [(#)=>(#)匹配的网址; (*)=>(*)的范围,如:1-20; typeid=>栏目id; addurl=>附加的网址(用|分开多个)] - else - { - $nrules = explode(']',trim($batchrule)); - foreach($nrules as $nrule) - { + else { + $nrules = explode(']', trim($batchrule)); + foreach ($nrules as $nrule) { $nrule = trim($nrule); $nrule = preg_replace("/^\[|\]$/", '', $nrule); - $nrules = explode(';',$nrule); - if(count($nrules)<3) - { + $nrules = explode(';', $nrule); + if (count($nrules) < 3) { continue; } $brtag = ''; @@ -577,83 +480,63 @@ function GetUrlFromListRule($regxurl='',$handurl='',$startid=0,$endid=0,$addv=1, $endid = 0; $typeid = 0; $addurls = array(); - foreach($nrules as $nrule) - { + foreach ($nrules as $nrule) { $nrule = trim($nrule); - list($k,$v) = explode('=>',$nrule); - if(trim($k)=='(#)') - { + list($k, $v) = explode('=>', $nrule); + if (trim($k) == '(#)') { $brtag = trim($v); - } - else if(trim($k)=='typeid') - { + } else if (trim($k) == 'typeid') { $typeid = trim($v); - } - else if(trim($k)=='addurl') - { + } else if (trim($k) == 'addurl') { $addurl = trim($v); - $addurls = explode('|',$addurl); - } - else if(trim($k)=='(*)') - { + $addurls = explode('|', $addurl); + } else if (trim($k) == '(*)') { $v = preg_replace("/[ \r\n\t]/", '', trim($v)); - list($startid,$endid) = explode('-',$v); + list($startid, $endid) = explode('-', $v); } } //如果栏目用栏目名称 - if(preg_match('/[^0-9]/', $typeid)) - { + if (preg_match('/[^0-9]/', $typeid)) { $arr = $dsql->GetOne("SELECT id FROM `#@__arctype` WHERE typename LIKE '$typeid' "); - if(is_array($arr)) - { + if (is_array($arr)) { $typeid = $arr['id']; - } - else - { + } else { $typeid = 0; } } //附加网址优先 $mjj = 0; - if(isset($addurls[0])) - { - foreach($addurls as $addurl) - { + if (isset($addurls[0])) { + foreach ($addurls as $addurl) { $addurl = trim($addurl); - if($addurl=='') - { + if ($addurl == '') { continue; } $lists[$n][0] = $addurl; $lists[$n][1] = $typeid; $n++; $mjj++; - if($islisten==1) - { + if ($islisten == 1) { break; } } } //如果为非监听模式或监听模式没手工指定的附加网址 - if($islisten!=1 || $mjj==0 ) - { + if ($islisten != 1 || $mjj == 0) { //匹配规则里的网址,注:(#)的网址是是允许使用(*)的 - while($startid <= $endid) - { - $lists[$n][0] = str_replace("(#)",$brtag,$regxurl); - $lists[$n][0] = str_replace("(*)",sprintf('%0'.strlen($startid).'d',$startid),$lists[$n][0]); + while ($startid <= $endid) { + $lists[$n][0] = str_replace("(#)", $brtag, $regxurl); + $lists[$n][0] = str_replace("(*)", sprintf('%0' . strlen($startid) . 'd', $startid), $lists[$n][0]); $lists[$n][1] = $typeid; - $startid = sprintf('%0'.strlen($startid).'d',$startid + $addv); + $startid = sprintf('%0' . strlen($startid) . 'd', $startid + $addv); $n++; - if($islisten==1) - { + if ($islisten == 1) { break; } - if($n>20000) - { + if ($n > 20000) { break; } } diff --git a/src/include/dedehtml2.class.php b/src/include/dedehtml2.class.php index 3b2a19fd..806c07c8 100755 --- a/src/include/dedehtml2.class.php +++ b/src/include/dedehtml2.class.php @@ -6,7 +6,7 @@ * * * @version $Id: dedehtml2.class.php 1 14:44 2010年7月6日Z tianya $ - * @package DedeCMS.Libraries + * @package DedeBIZ.Libraries * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -16,7 +16,7 @@ * 织梦HTML解析类V1.6 PHP版 * * @package DedeHtml2 - * @subpackage DedeCMS.Libraries + * @subpackage DedeBIZ.Libraries * @link https://www.dedebiz.com */ class DedeHtml2 @@ -670,5 +670,3 @@ class DedeAttribute2 }//End Function PrivateAttParse }//End Class DedeAttribute2 - -?> \ No newline at end of file diff --git a/src/include/dedehttpdown.class.php b/src/include/dedehttpdown.class.php index 06c1b50f..51125baf 100755 --- a/src/include/dedehttpdown.class.php +++ b/src/include/dedehttpdown.class.php @@ -3,7 +3,7 @@ * 织梦HTTP下载类 * * @version $Id: dedehttpdown.class.php 1 11:42 2010年7月6日Z tianya $ - * @package DedeCMS.Libraries + * @package DedeBIZ.Libraries * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -570,7 +570,6 @@ class DedeHttpDown if ($this->m_fp) { @fclose($this->m_fp); } - } /** diff --git a/src/include/dedemodule.class.php b/src/include/dedemodule.class.php index a5ce3c52..e443e5a7 100755 --- a/src/include/dedemodule.class.php +++ b/src/include/dedemodule.class.php @@ -3,7 +3,7 @@ * 织梦模块类 * * @version $Id: dedemodule.class.php 1 10:31 2010年7月6日Z tianya $ - * @package DedeCMS.Libraries + * @package DedeBIZ.Libraries * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -63,7 +63,7 @@ class DedeModule while ($filename = $dh->read()) { if (preg_match("/\.xml$/i", $filename)) { $minfos = $this->GetModuleInfo(str_replace('.xml', '', $filename)); - if ($minfos==null) { + if ($minfos == null) { continue; } if (isset($minfos['moduletype']) && $moduletype != '' && $moduletype != $minfos['moduletype']) { @@ -193,7 +193,7 @@ class DedeModule $pubKey = @base64url_decode($minfos['pubkey']); @openssl_public_decrypt(base64url_decode($minfos['info']), $decontent, $pubKey); $enInfo = (array)json_decode($decontent); - if (count($enInfo)==0) { + if (count($enInfo) == 0) { return null; } if ($enInfo['module_name'] != $minfos['name'] || $enInfo['dev_id'] != $minfos['dev_id']) { diff --git a/src/include/dedesqli.class.php b/src/include/dedesqli.class.php index ea429d94..7096836c 100755 --- a/src/include/dedesqli.class.php +++ b/src/include/dedesqli.class.php @@ -1,4 +1,4 @@ -isClose = FALSE; $this->safeCheck = TRUE; - $this->pconnect = $pconnect; - if($nconnect) - { + $this->pconnect = $pconnect; + if ($nconnect) { $this->Init($pconnect); } } - function DedeSql($pconnect=FALSE,$nconnect=TRUE) + function DedeSql($pconnect = FALSE, $nconnect = TRUE) { - $this->__construct($pconnect,$nconnect); + $this->__construct($pconnect, $nconnect); } - function Init($pconnect=FALSE) + function Init($pconnect = FALSE) { $this->linkID = 0; //$this->queryString = ''; @@ -88,7 +87,7 @@ class DedeSqli } //用指定参数初始数据库信息 - function SetSource($host,$username,$pwd,$dbname,$dbprefix="dede_") + function SetSource($host, $username, $pwd, $dbname, $dbprefix = "dede_") { $this->dbHost = $host; $this->dbUser = $username; @@ -103,29 +102,26 @@ class DedeSqli } //设置SQL里的参数 - function SetParameter($key,$value) + function SetParameter($key, $value) { - $this->parameters[$key]=$value; + $this->parameters[$key] = $value; } //连接数据库 - function Open($pconnect=FALSE) + function Open($pconnect = FALSE) { global $dsqli; //连接数据库 - if($dsqli && !$dsqli->isClose && $dsqli->isInit) - { + if ($dsqli && !$dsqli->isClose && $dsqli->isInit) { $this->linkID = $dsqli->linkID; - } - else - { + } else { $i = 0; @list($dbhost, $dbport) = explode(':', $this->dbHost); !$dbport && $dbport = 3306; $this->linkID = mysqli_init(); mysqli_real_connect($this->linkID, $dbhost, $this->dbUser, $this->dbPwd, false, $dbport); - mysqli_errno($this->linkID) != 0 && $this->DisplayError('DedeCMS错误警告: 链接('.$this->pconnect.') 到MySQL发生错误'); + mysqli_errno($this->linkID) != 0 && $this->DisplayError('DedeBIZ错误警告: 链接(' . $this->pconnect . ') 到MySQL发生错误'); //复制一个对象副本 @@ -133,15 +129,13 @@ class DedeSqli } //处理错误,成功连接则选择数据库 - if(!$this->linkID) - { - $this->DisplayError("DedeCMS错误警告:连接数据库失败,可能数据库密码不对或数据库服务器出错!"); + if (!$this->linkID) { + $this->DisplayError("DedeBIZ错误警告:连接数据库失败,可能数据库密码不对或数据库服务器出错!"); exit(); } - $this->isInit = TRUE; + $this->isInit = TRUE; $serverinfo = mysqli_get_server_info($this->linkID); - if (version_compare($serverinfo,'4.1',">=") && $GLOBALS['cfg_db_language']) - { + if (version_compare($serverinfo, '4.1', ">=") && $GLOBALS['cfg_db_language']) { mysqli_query($this->linkID, "SET character_set_connection=" . $GLOBALS['cfg_db_language'] . ",character_set_results=" . $GLOBALS['cfg_db_language'] . ",character_set_client=binary"); } if ($serverinfo > '5.0') { @@ -159,7 +153,6 @@ class DedeSqli if ($this->linkID) { @mysqli_query($this->linkID, "SET interactive_timeout=3600, wait_timeout=3600 ;"); } - } //获得错误描述 @@ -172,11 +165,10 @@ class DedeSqli //关闭数据库 //mysql能自动管理非持久连接的连接池 //实际上关闭并无意义并且容易出错,所以取消这函数 - function Close($isok=FALSE) + function Close($isok = FALSE) { $this->FreeResultAll(); - if($isok) - { + if ($isok) { @mysqli_close($this->linkID); $this->isClose = TRUE; $GLOBALS['dsql'] = NULL; @@ -194,56 +186,50 @@ class DedeSqli @mysqli_close($dblink); } - function Esc( $_str ) + function Esc($_str) { - if ( version_compare( phpversion(), '4.3.0', '>=' ) ) - { - return @mysqli_real_escape_string($this->linkID, $_str ); + if (version_compare(phpversion(), '4.3.0', '>=')) { + return @mysqli_real_escape_string($this->linkID, $_str); } else { - return @mysqli_escape_string ($this->linkID, $_str ); + return @mysqli_escape_string($this->linkID, $_str); } } //执行一个不返回结果的SQL语句,如update,delete,insert等 - function ExecuteNoneQuery($sql='') + function ExecuteNoneQuery($sql = '') { global $dsqli; - if(!$dsqli->isInit) - { - $this->Init($this->pconnect); - } - if($dsqli->isClose) - { + if (!$dsqli->isInit) { + $this->Init($this->pconnect); + } + if ($dsqli->isClose) { $this->Open(FALSE); $dsqli->isClose = FALSE; } - if(!empty($sql)) - { + if (!empty($sql)) { $this->SetQuery($sql); - }else{ + } else { return FALSE; } - if(is_array($this->parameters)) - { - foreach($this->parameters as $key=>$value) - { - $this->queryString = str_replace("@".$key,"'$value'",$this->queryString); + if (is_array($this->parameters)) { + foreach ($this->parameters as $key => $value) { + $this->queryString = str_replace("@" . $key, "'$value'", $this->queryString); } } //SQL语句安全检查 - if($this->safeCheck) CheckSql($this->queryString,'update'); + if ($this->safeCheck) CheckSql($this->queryString, 'update'); $t1 = ExecTime(); $rs = mysqli_query($this->linkID, $this->queryString); //查询性能测试 - if($this->recordLog) { - $queryTime = ExecTime() - $t1; + if ($this->recordLog) { + $queryTime = ExecTime() - $t1; $this->RecordLog($queryTime); } - if (DEBUG_LEVEL===TRUE) { + if (DEBUG_LEVEL === TRUE) { $queryTime = ExecTime() - $t1; - echo "
      执行SQL:".$this->queryString.",执行时间:{$queryTime}
      \r\n"; + echo "
      执行SQL:" . $this->queryString . ",执行时间:{$queryTime}
      \r\n"; } return $rs; @@ -251,53 +237,48 @@ class DedeSqli //执行一个返回影响记录条数的SQL语句,如update,delete,insert等 - function ExecuteNoneQuery2($sql='') + function ExecuteNoneQuery2($sql = '') { global $dsqli; - if(!$dsqli->isInit) - { - $this->Init($this->pconnect); - } - if($dsqli->isClose) - { + if (!$dsqli->isInit) { + $this->Init($this->pconnect); + } + if ($dsqli->isClose) { $this->Open(FALSE); $dsqli->isClose = FALSE; } - if(!empty($sql)) - { + if (!empty($sql)) { $this->SetQuery($sql); } - if(is_array($this->parameters)) - { - foreach($this->parameters as $key=>$value) - { - $this->queryString = str_replace("@".$key,"'$value'",$this->queryString); + if (is_array($this->parameters)) { + foreach ($this->parameters as $key => $value) { + $this->queryString = str_replace("@" . $key, "'$value'", $this->queryString); } } $t1 = ExecTime(); mysqli_query($this->linkID, $this->queryString); //查询性能测试 - if($this->recordLog) { - $queryTime = ExecTime() - $t1; + if ($this->recordLog) { + $queryTime = ExecTime() - $t1; $this->RecordLog($queryTime); //echo $this->queryString."--{$queryTime}
      \r\n"; } - if (DEBUG_LEVEL===TRUE) { + if (DEBUG_LEVEL === TRUE) { $queryTime = ExecTime() - $t1; - echo "
      执行SQL:".$this->queryString.",执行时间:{$queryTime}
      \r\n"; + echo "
      执行SQL:" . $this->queryString . ",执行时间:{$queryTime}
      \r\n"; } return mysqli_affected_rows($this->linkID); } - function ExecNoneQuery($sql='') + function ExecNoneQuery($sql = '') { return $this->ExecuteNoneQuery($sql); } - function GetFetchRow($id='me') + function GetFetchRow($id = 'me') { return @mysqli_fetch_row($this->result[$id]); } @@ -308,127 +289,109 @@ class DedeSqli } //执行一个带返回结果的SQL语句,如SELECT,SHOW等 - function Execute($id="me", $sql='') + function Execute($id = "me", $sql = '') { global $dsqli; - if(!$dsqli->isInit) - { - $this->Init($this->pconnect); - } - if($dsqli->isClose) - { + if (!$dsqli->isInit) { + $this->Init($this->pconnect); + } + if ($dsqli->isClose) { $this->Open(FALSE); $dsqli->isClose = FALSE; } - if(!empty($sql)) - { + if (!empty($sql)) { $this->SetQuery($sql); } //SQL语句安全检查 - if($this->safeCheck) - { + if ($this->safeCheck) { CheckSql($this->queryString); } $t1 = ExecTime(); //var_dump($this->queryString); $this->result[$id] = mysqli_query($this->linkID, $this->queryString); - //var_dump(mysql_error()); + //var_dump(mysql_error()); //查询性能测试 - if($this->recordLog) { - $queryTime = ExecTime() - $t1; + if ($this->recordLog) { + $queryTime = ExecTime() - $t1; $this->RecordLog($queryTime); //echo $this->queryString."--{$queryTime}
      \r\n"; } - if (DEBUG_LEVEL===TRUE) { + if (DEBUG_LEVEL === TRUE) { $queryTime = ExecTime() - $t1; - echo "
      执行SQL:".$this->queryString.",执行时间:{$queryTime}
      \r\n"; + echo "
      执行SQL:" . $this->queryString . ",执行时间:{$queryTime}
      \r\n"; } - if($this->result[$id]===FALSE) - { - $this->DisplayError(mysqli_error($this->linkID)."
      Error sql: ".$this->queryString.""); + if ($this->result[$id] === FALSE) { + $this->DisplayError(mysqli_error($this->linkID) . "
      Error sql: " . $this->queryString . ""); } } - function Query($id="me",$sql='') + function Query($id = "me", $sql = '') { - $this->Execute($id,$sql); + $this->Execute($id, $sql); } //执行一个SQL语句,返回前一条记录或仅返回一条记录 - function GetOne($sql='',$acctype=MYSQLI_ASSOC) + function GetOne($sql = '', $acctype = MYSQLI_ASSOC) { global $dsqli; // $t1 = ExecTime(); - if(!$dsqli->isInit) - { - $this->Init($this->pconnect); + if (!$dsqli->isInit) { + $this->Init($this->pconnect); } // echo ExecTime() - $t1; - if($dsqli->isClose) - { + if ($dsqli->isClose) { $this->Open(FALSE); $dsqli->isClose = FALSE; } - - if(!empty($sql)) - { - if(!preg_match("/LIMIT/i",$sql)) $this->SetQuery(preg_replace("/[,;]$/i", '', trim($sql))." LIMIT 0,1;"); + + if (!empty($sql)) { + if (!preg_match("/LIMIT/i", $sql)) $this->SetQuery(preg_replace("/[,;]$/i", '', trim($sql)) . " LIMIT 0,1;"); else $this->SetQuery($sql); } $this->Execute("one"); $arr = $this->GetArray("one", $acctype); - if(!is_array($arr)) - { + if (!is_array($arr)) { return ''; - } - else - { - @mysqli_free_result($this->result["one"]); return($arr); + } else { + @mysqli_free_result($this->result["one"]); + return ($arr); } } //执行一个不与任何表名有关的SQL语句,Create等 - function ExecuteSafeQuery($sql,$id="me") + function ExecuteSafeQuery($sql, $id = "me") { global $dsqli; - if(!$dsqli->isInit) - { - $this->Init($this->pconnect); - } - if($dsqli->isClose) - { + if (!$dsqli->isInit) { + $this->Init($this->pconnect); + } + if ($dsqli->isClose) { $this->Open(FALSE); $dsqli->isClose = FALSE; } - $this->result[$id] = @mysqli_query($sql,$this->linkID); + $this->result[$id] = @mysqli_query($sql, $this->linkID); } //返回当前的一条记录并把游标移向下一记录 // MYSQLI_ASSOC、MYSQLI_NUM、MYSQLI_BOTH - function GetArray($id="me",$acctype=MYSQLI_ASSOC) + function GetArray($id = "me", $acctype = MYSQLI_ASSOC) { // var_dump($this->result); - if($this->result[$id]===0) - { + if ($this->result[$id] === 0) { return FALSE; - } - else - { + } else { return @mysqli_fetch_array($this->result[$id], $acctype); } } - function GetObject($id="me") + function GetObject($id = "me") { - if($this->result[$id]===0) - { + if ($this->result[$id] === 0) { return FALSE; - } - else - { + } else { return mysqli_fetch_object($this->result[$id]); } } @@ -437,29 +400,25 @@ class DedeSqli function IsTable($tbname) { global $dsqli; - if(!$dsqli->isInit) - { - $this->Init($this->pconnect); - } - $prefix="#@__"; + if (!$dsqli->isInit) { + $this->Init($this->pconnect); + } + $prefix = "#@__"; $tbname = str_replace($prefix, $GLOBALS['cfg_dbprefix'], $tbname); - if( mysqli_num_rows( @mysqli_query($this->linkID, "SHOW TABLES LIKE '".$tbname."'"))) - { + if (mysqli_num_rows(@mysqli_query($this->linkID, "SHOW TABLES LIKE '" . $tbname . "'"))) { return TRUE; } return FALSE; } //获得MySql的版本号 - function GetVersion($isformat=TRUE) + function GetVersion($isformat = TRUE) { global $dsqli; - if(!$dsqli->isInit) - { - $this->Init($this->pconnect); - } - if($dsqli->isClose) - { + if (!$dsqli->isInit) { + $this->Init($this->pconnect); + } + if ($dsqli->isClose) { $this->Open(FALSE); $dsqli->isClose = FALSE; } @@ -467,43 +426,38 @@ class DedeSqli $row = mysqli_fetch_array($rs); $mysql_version = $row[0]; mysqli_free_result($rs); - if($isformat) - { - $mysql_versions = explode(".",trim($mysql_version)); - $mysql_version = number_format($mysql_versions[0].".".$mysql_versions[1],2); + if ($isformat) { + $mysql_versions = explode(".", trim($mysql_version)); + $mysql_version = number_format($mysql_versions[0] . "." . $mysql_versions[1], 2); } return $mysql_version; } //获取特定表的信息 - function GetTableFields($tbname, $id="me") - { - global $dsqli; - if(!$dsqli->isInit) - { - $this->Init($this->pconnect); - } - $prefix="#@__"; + function GetTableFields($tbname, $id = "me") + { + global $dsqli; + if (!$dsqli->isInit) { + $this->Init($this->pconnect); + } + $prefix = "#@__"; $tbname = str_replace($prefix, $GLOBALS['cfg_dbprefix'], $tbname); $query = "SELECT * FROM {$tbname} LIMIT 0,1"; $this->result[$id] = mysqli_query($this->linkID, $query); } //获取字段详细信息 - function GetFieldObject($id="me") + function GetFieldObject($id = "me") { return mysqli_fetch_field($this->result[$id]); } //获得查询的总记录数 - function GetTotalRow($id="me") + function GetTotalRow($id = "me") { - if($this->result[$id]===0) - { + if ($this->result[$id] === 0) { return -1; - } - else - { + } else { return @mysqli_num_rows($this->result[$id]); } } @@ -520,20 +474,17 @@ class DedeSqli } //释放记录集占用的资源 - function FreeResult($id="me") + function FreeResult($id = "me") { @mysqli_free_result($this->result[$id]); } function FreeResultAll() { - if(!is_array($this->result)) - { + if (!is_array($this->result)) { return ''; } - foreach($this->result as $kk => $vv) - { - if($vv) - { + foreach ($this->result as $kk => $vv) { + if ($vv) { @mysqli_free_result($vv); } } @@ -542,8 +493,8 @@ class DedeSqli //设置SQL语句,会自动把SQL语句里的#@__替换为$this->dbPrefix(在配置文件中为$cfg_dbprefix) function SetQuery($sql) { - $prefix="#@__"; - $sql = str_replace($prefix,$GLOBALS['cfg_dbprefix'],$sql); + $prefix = "#@__"; + $sql = str_replace($prefix, $GLOBALS['cfg_dbprefix'], $sql); $this->queryString = $sql; } @@ -552,11 +503,11 @@ class DedeSqli $this->SetQuery($sql); } - function RecordLog($runtime=0) - { - $RecordLogFile = dirname(__FILE__).'/../data/mysqli_record_log.inc'; - $url = $this->GetCurUrl(); - $savemsg = <<GetCurUrl(); + $savemsg = <<queryString} @@ -566,57 +517,50 @@ EOT; $fp = @fopen($RecordLogFile, 'a'); @fwrite($fp, $savemsg); @fclose($fp); - } + } //显示数据链接错误信息 function DisplayError($msg) { - $errorTrackFile = dirname(__FILE__).'/../data/mysqli_error_trace.inc'; - if( file_exists(dirname(__FILE__).'/../data/mysqli_error_trace.php') ) - { - @unlink(dirname(__FILE__).'/../data/mysqli_error_trace.php'); - } - if($this->showError) - { - $emsg = ''; - $emsg .= "

      DedeCMS Error Warning!

      \r\n"; - $emsg .= "
      "; - $emsg .= "
      \r\n"; - $emsg .= "

      Error page: ".$this->GetCurUrl()."
      \r\n"; - $emsg .= "
      Error infos: {$msg}
      \r\n"; - $emsg .= "
      \r\n"; - - echo $emsg; - } - - $savemsg = 'Page: '.$this->GetCurUrl()."\r\nError: ".$msg."\r\nTime".date('Y-m-d H:i:s'); + $errorTrackFile = dirname(__FILE__) . '/../data/mysqli_error_trace.inc'; + if (file_exists(dirname(__FILE__) . '/../data/mysqli_error_trace.php')) { + @unlink(dirname(__FILE__) . '/../data/mysqli_error_trace.php'); + } + if ($this->showError) { + $emsg = ''; + $emsg .= "

      DedeBIZ Error Warning!

      \r\n"; + $emsg .= ""; + $emsg .= "
      \r\n"; + $emsg .= "

      Error page: " . $this->GetCurUrl() . "
      \r\n"; + $emsg .= "
      Error infos: {$msg}
      \r\n"; + $emsg .= "
      \r\n"; + + echo $emsg; + } + + $savemsg = 'Page: ' . $this->GetCurUrl() . "\r\nError: " . $msg . "\r\nTime" . date('Y-m-d H:i:s'); //保存MySql错误日志 $fp = @fopen($errorTrackFile, 'a'); - @fwrite($fp, '<'.'?php exit();'."\r\n/*\r\n{$savemsg}\r\n*/\r\n?".">\r\n"); + @fwrite($fp, '<' . '?php exit();' . "\r\n/*\r\n{$savemsg}\r\n*/\r\n?" . ">\r\n"); @fclose($fp); } //获得当前的脚本网址 function GetCurUrl() { - if(!empty($_SERVER["REQUEST_URI"])) - { + if (!empty($_SERVER["REQUEST_URI"])) { $scriptName = $_SERVER["REQUEST_URI"]; $nowurl = $scriptName; - } - else - { + } else { $scriptName = $_SERVER["PHP_SELF"]; - if(empty($_SERVER["QUERY_STRING"])) { + if (empty($_SERVER["QUERY_STRING"])) { $nowurl = $scriptName; - } - else { - $nowurl = $scriptName."?".$_SERVER["QUERY_STRING"]; + } else { + $nowurl = $scriptName . "?" . $_SERVER["QUERY_STRING"]; } } return $nowurl; } - } //复制一个对象副本 @@ -626,51 +570,42 @@ function CopySQLiPoint(&$ndsql) } //SQL语句过滤程序,由80sec提供,这里作了适当的修改 -if (!function_exists('CheckSql')) -{ - function CheckSql($db_string,$querytype='select') +if (!function_exists('CheckSql')) { + function CheckSql($db_string, $querytype = 'select') { global $cfg_cookie_encode; $clean = ''; - $error=''; + $error = ''; $old_pos = 0; $pos = -1; - $log_file = DEDEINC.'/../data/'.md5($cfg_cookie_encode).'_safe.txt'; + $log_file = DEDEINC . '/../data/' . md5($cfg_cookie_encode) . '_safe.txt'; $userIP = GetIP(); $getUrl = GetCurUrl(); //如果是普通查询语句,直接过滤一些特殊语法 - if($querytype=='select') - { + if ($querytype == 'select') { $notallow1 = "[^0-9a-z@\._-]{1,}(union|sleep|benchmark|load_file|outfile)[^0-9a-z@\.-]{1,}"; //$notallow2 = "--|/\*"; - if(preg_match("/".$notallow1."/i", $db_string)) - { - fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||SelectBreak\r\n"); + if (preg_match("/" . $notallow1 . "/i", $db_string)) { + fputs(fopen($log_file, 'a+'), "$userIP||$getUrl||$db_string||SelectBreak\r\n"); exit("Safe Alert: Request Error step 1 !"); } } //完整的SQL检查 - while (TRUE) - { + while (TRUE) { $pos = strpos($db_string, '\'', $pos + 1); - if ($pos === FALSE) - { + if ($pos === FALSE) { break; } $clean .= substr($db_string, $old_pos, $pos - $old_pos); - while (TRUE) - { + while (TRUE) { $pos1 = strpos($db_string, '\'', $pos + 1); $pos2 = strpos($db_string, '\\', $pos + 1); - if ($pos1 === FALSE) - { + if ($pos1 === FALSE) { break; - } - elseif ($pos2 == FALSE || $pos2 > $pos1) - { + } elseif ($pos2 == FALSE || $pos2 > $pos1) { $pos = $pos1; break; } @@ -680,65 +615,53 @@ if (!function_exists('CheckSql')) $old_pos = $pos + 1; } $clean .= substr($db_string, $old_pos); - $clean = trim(strtolower(preg_replace(array('~\s+~s' ), array(' '), $clean))); + $clean = trim(strtolower(preg_replace(array('~\s+~s'), array(' '), $clean))); - if (strpos($clean, '@') !== FALSE OR strpos($clean,'char(')!== FALSE OR strpos($clean,'"')!== FALSE - OR strpos($clean,'$s$$s$')!== FALSE) - { + if ( + strpos($clean, '@') !== FALSE or strpos($clean, 'char(') !== FALSE or strpos($clean, '"') !== FALSE + or strpos($clean, '$s$$s$') !== FALSE + ) { $fail = TRUE; - if(preg_match("#^create table#i",$clean)) $fail = FALSE; - $error="unusual character"; + if (preg_match("#^create table#i", $clean)) $fail = FALSE; + $error = "unusual character"; } //老版本的Mysql并不支持union,常用的程序里也不使用union,但是一些黑客使用它,所以检查它 - if (strpos($clean, 'union') !== FALSE && preg_match('~(^|[^a-z])union($|[^[a-z])~s', $clean) != 0) - { + if (strpos($clean, 'union') !== FALSE && preg_match('~(^|[^a-z])union($|[^[a-z])~s', $clean) != 0) { $fail = TRUE; - $error="union detect"; + $error = "union detect"; } //发布版本的程序可能比较少包括--,#这样的注释,但是黑客经常使用它们 - elseif (strpos($clean, '/*') > 2 || strpos($clean, '--') !== FALSE || strpos($clean, '#') !== FALSE) - { + elseif (strpos($clean, '/*') > 2 || strpos($clean, '--') !== FALSE || strpos($clean, '#') !== FALSE) { $fail = TRUE; - $error="comment detect"; + $error = "comment detect"; } //这些函数不会被使用,但是黑客会用它来操作文件,down掉数据库 - elseif (strpos($clean, 'sleep') !== FALSE && preg_match('~(^|[^a-z])sleep($|[^[a-z])~s', $clean) != 0) - { + elseif (strpos($clean, 'sleep') !== FALSE && preg_match('~(^|[^a-z])sleep($|[^[a-z])~s', $clean) != 0) { $fail = TRUE; - $error="slown down detect"; - } - elseif (strpos($clean, 'benchmark') !== FALSE && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0) - { + $error = "slown down detect"; + } elseif (strpos($clean, 'benchmark') !== FALSE && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0) { $fail = TRUE; - $error="slown down detect"; - } - elseif (strpos($clean, 'load_file') !== FALSE && preg_match('~(^|[^a-z])load_file($|[^[a-z])~s', $clean) != 0) - { + $error = "slown down detect"; + } elseif (strpos($clean, 'load_file') !== FALSE && preg_match('~(^|[^a-z])load_file($|[^[a-z])~s', $clean) != 0) { $fail = TRUE; - $error="file fun detect"; - } - elseif (strpos($clean, 'into outfile') !== FALSE && preg_match('~(^|[^a-z])into\s+outfile($|[^[a-z])~s', $clean) != 0) - { + $error = "file fun detect"; + } elseif (strpos($clean, 'into outfile') !== FALSE && preg_match('~(^|[^a-z])into\s+outfile($|[^[a-z])~s', $clean) != 0) { $fail = TRUE; - $error="file fun detect"; + $error = "file fun detect"; } //老版本的MYSQL不支持子查询,我们的程序里可能也用得少,但是黑客可以使用它来查询数据库敏感信息 - elseif (preg_match('~\([^)]*?select~s', $clean) != 0) - { + elseif (preg_match('~\([^)]*?select~s', $clean) != 0) { $fail = TRUE; - $error="sub select detect"; + $error = "sub select detect"; } - if (!empty($fail)) - { - fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||$error\r\n"); + if (!empty($fail)) { + fputs(fopen($log_file, 'a+'), "$userIP||$getUrl||$db_string||$error\r\n"); exit("Safe Alert: Request Error step 2!"); - } - else - { + } else { return $db_string; } } diff --git a/src/include/dedesqlite.class.php b/src/include/dedesqlite.class.php index 7f875f31..b30f37d0 100755 --- a/src/include/dedesqlite.class.php +++ b/src/include/dedesqlite.class.php @@ -1,4 +1,4 @@ -isClose = FALSE; $this->safeCheck = TRUE; - $this->pconnect = $pconnect; - if($nconnect) - { + $this->pconnect = $pconnect; + if ($nconnect) { $this->Init($pconnect); } } - function DedeSql($pconnect=FALSE,$nconnect=TRUE) + function DedeSql($pconnect = FALSE, $nconnect = TRUE) { - $this->__construct($pconnect,$nconnect); + $this->__construct($pconnect, $nconnect); } - function Init($pconnect=FALSE) + function Init($pconnect = FALSE) { $this->linkID = 0; //$this->queryString = ''; @@ -80,7 +79,7 @@ class DedeSqlite } //用指定参数初始数据库信息 - function SetSource($host,$username,$pwd,$dbname,$dbprefix="dede_") + function SetSource($host, $username, $pwd, $dbname, $dbprefix = "dede_") { $this->dbHost = $host; $this->dbUser = $username; @@ -91,36 +90,32 @@ class DedeSqlite } //设置SQL里的参数 - function SetParameter($key,$value) + function SetParameter($key, $value) { - $this->parameters[$key]=$value; + $this->parameters[$key] = $value; } //连接数据库 - function Open($pconnect=FALSE) + function Open($pconnect = FALSE) { global $dsqlite; //连接数据库 - if($dsqlite && !$dsqlite->isClose && $dsqlite->isInit) - { + if ($dsqlite && !$dsqlite->isClose && $dsqlite->isInit) { $this->linkID = $dsqlite->linkID; - } - else - { + } else { - $this->linkID = new SQLite3(DEDEDATA.'/'.$this->dbName.'.db'); + $this->linkID = new SQLite3(DEDEDATA . '/' . $this->dbName . '.db'); //复制一个对象副本 CopySQLiPoint($this); } //处理错误,成功连接则选择数据库 - if(!$this->linkID) - { - $this->DisplayError("DedeCMS错误警告:连接数据库失败,可能数据库密码不对或数据库服务器出错!"); + if (!$this->linkID) { + $this->DisplayError("DedeBIZ错误警告:连接数据库失败,可能数据库密码不对或数据库服务器出错!"); exit(); } - $this->isInit = TRUE; + $this->isInit = TRUE; return TRUE; } @@ -140,11 +135,10 @@ class DedeSqlite //关闭数据库 //mysql能自动管理非持久连接的连接池 //实际上关闭并无意义并且容易出错,所以取消这函数 - function Close($isok=FALSE) + function Close($isok = FALSE) { $this->FreeResultAll(); - if($isok) - { + if ($isok) { $this->linkID->close(); $this->isClose = TRUE; $GLOBALS['dsql'] = NULL; @@ -161,48 +155,43 @@ class DedeSqlite { } - function Esc( $_str ) + function Esc($_str) { return addslashes($_str); } //执行一个不返回结果的SQL语句,如update,delete,insert等 - function ExecuteNoneQuery($sql='') + function ExecuteNoneQuery($sql = '') { global $dsqlite; - if(!$dsqlite->isInit) - { - $this->Init($this->pconnect); - } - if($dsqlite->isClose) - { + if (!$dsqlite->isInit) { + $this->Init($this->pconnect); + } + if ($dsqlite->isClose) { $this->Open(FALSE); $dsqlite->isClose = FALSE; } - if(!empty($sql)) - { + if (!empty($sql)) { $this->SetQuery($sql); - }else{ + } else { return FALSE; } - if(is_array($this->parameters)) - { - foreach($this->parameters as $key=>$value) - { - $this->queryString = str_replace("@".$key,"'$value'",$this->queryString); + if (is_array($this->parameters)) { + foreach ($this->parameters as $key => $value) { + $this->queryString = str_replace("@" . $key, "'$value'", $this->queryString); } } //SQL语句安全检查 - if($this->safeCheck) CheckSql($this->queryString,'update'); + if ($this->safeCheck) CheckSql($this->queryString, 'update'); $t1 = ExecTime(); - + $rs = $this->linkID->exec($this->queryString); //查询性能测试 - if($this->recordLog) { - $queryTime = ExecTime() - $t1; + if ($this->recordLog) { + $queryTime = ExecTime() - $t1; $this->RecordLog($queryTime); //echo $this->queryString."--{$queryTime}
      \r\n"; } @@ -211,36 +200,31 @@ class DedeSqlite //执行一个返回影响记录条数的SQL语句,如update,delete,insert等 - function ExecuteNoneQuery2($sql='') + function ExecuteNoneQuery2($sql = '') { global $dsqlite; - if(!$dsqlite->isInit) - { - $this->Init($this->pconnect); - } - if($dsqlite->isClose) - { + if (!$dsqlite->isInit) { + $this->Init($this->pconnect); + } + if ($dsqlite->isClose) { $this->Open(FALSE); $dsqlite->isClose = FALSE; } - if(!empty($sql)) - { + if (!empty($sql)) { $this->SetQuery($sql); } - if(is_array($this->parameters)) - { - foreach($this->parameters as $key=>$value) - { - $this->queryString = str_replace("@".$key,"'$value'",$this->queryString); + if (is_array($this->parameters)) { + foreach ($this->parameters as $key => $value) { + $this->queryString = str_replace("@" . $key, "'$value'", $this->queryString); } } $t1 = ExecTime(); $this->linkID->exec($this->queryString); //查询性能测试 - if($this->recordLog) { - $queryTime = ExecTime() - $t1; + if ($this->recordLog) { + $queryTime = ExecTime() - $t1; $this->RecordLog($queryTime); //echo $this->queryString."--{$queryTime}
      \r\n"; } @@ -248,12 +232,12 @@ class DedeSqlite return $this->linkID->changes(); } - function ExecNoneQuery($sql='') + function ExecNoneQuery($sql = '') { return $this->ExecuteNoneQuery($sql); } - function GetFetchRow($id='me') + function GetFetchRow($id = 'me') { return $this->result[$id]->numColumns(); } @@ -264,93 +248,81 @@ class DedeSqlite } //执行一个带返回结果的SQL语句,如SELECT,SHOW等 - function Execute($id="me", $sql='') + function Execute($id = "me", $sql = '') { global $dsqlite; - if(!$dsqlite->isInit) - { - $this->Init($this->pconnect); - } - if($dsqlite->isClose) - { + if (!$dsqlite->isInit) { + $this->Init($this->pconnect); + } + if ($dsqlite->isClose) { $this->Open(FALSE); $dsqlite->isClose = FALSE; } - if(!empty($sql)) - { + if (!empty($sql)) { $this->SetQuery($sql); } //SQL语句安全检查 - if($this->safeCheck) - { + if ($this->safeCheck) { CheckSql($this->queryString); } $t1 = ExecTime(); //var_dump($this->queryString); - + $this->result[$id] = $this->linkID->query($this->queryString); - - //var_dump(mysql_error()); + + //var_dump(mysql_error()); //查询性能测试 - if($this->recordLog) { - $queryTime = ExecTime() - $t1; + if ($this->recordLog) { + $queryTime = ExecTime() - $t1; $this->RecordLog($queryTime); //echo $this->queryString."--{$queryTime}
      \r\n"; } - if($this->result[$id]===FALSE) - { - $this->DisplayError($this->linkID->lastErrorMsg()."
      Error sql: ".$this->queryString.""); + if ($this->result[$id] === FALSE) { + $this->DisplayError($this->linkID->lastErrorMsg() . "
      Error sql: " . $this->queryString . ""); } } - function Query($id="me",$sql='') + function Query($id = "me", $sql = '') { - $this->Execute($id,$sql); + $this->Execute($id, $sql); } //执行一个SQL语句,返回前一条记录或仅返回一条记录 - function GetOne($sql='',$acctype=MYSQLI_ASSOC) + function GetOne($sql = '', $acctype = MYSQLI_ASSOC) { global $dsqlite; - if(!$dsqlite->isInit) - { - $this->Init($this->pconnect); - } - if($dsqlite->isClose) - { + if (!$dsqlite->isInit) { + $this->Init($this->pconnect); + } + if ($dsqlite->isClose) { $this->Open(FALSE); $dsqlite->isClose = FALSE; } - if(!empty($sql)) - { - if(!preg_match("/LIMIT/i",$sql)) $this->SetQuery(preg_replace("/[,;]$/i", '', trim($sql))." LIMIT 0,1;"); + if (!empty($sql)) { + if (!preg_match("/LIMIT/i", $sql)) $this->SetQuery(preg_replace("/[,;]$/i", '', trim($sql)) . " LIMIT 0,1;"); else $this->SetQuery($sql); } $this->Execute("one"); $arr = $this->GetArray("one", $acctype); - if(!is_array($arr)) - { + if (!is_array($arr)) { return ''; - } - else - { - $this->result["one"]->reset(); return($arr); + } else { + $this->result["one"]->reset(); + return ($arr); } } //执行一个不与任何表名有关的SQL语句,Create等 - function ExecuteSafeQuery($sql,$id="me") + function ExecuteSafeQuery($sql, $id = "me") { global $dsqlite; - if(!$dsqlite->isInit) - { - $this->Init($this->pconnect); - } - if($dsqlite->isClose) - { + if (!$dsqlite->isInit) { + $this->Init($this->pconnect); + } + if ($dsqlite->isClose) { $this->Open(FALSE); $dsqlite->isClose = FALSE; } @@ -359,43 +331,37 @@ class DedeSqlite //返回当前的一条记录并把游标移向下一记录 // SQLITE3_ASSOC、SQLITE3_NUM、SQLITE3_BOTH - function GetArray($id="me",$acctype=SQLITE3_ASSOC) + function GetArray($id = "me", $acctype = SQLITE3_ASSOC) { - switch ( $acctype ) - { + switch ($acctype) { case MYSQL_ASSOC: $acctype = SQLITE3_ASSOC; - break; + break; case MYSQL_NUM: $acctype = SQLITE3_NUM; - break; + break; default: $acctype = SQLITE3_BOTH; break; } - - if($this->result[$id]===0) - { + + if ($this->result[$id] === 0) { return FALSE; - } - else - { + } else { $rs = $this->result[$id]->fetchArray($acctype); - if ( !$rs ) { - $this->result[$id]=0; + if (!$rs) { + $this->result[$id] = 0; return false; } return $rs; } } - function GetObject($id="me") + function GetObject($id = "me") { - if ( !isset($this->_fixObject[$id]) ) - { + if (!isset($this->_fixObject[$id])) { $this->_fixObject[$id] = array(); - while ( $row = $this->result[$id]->fetchArray(SQLITE3_ASSOC) ) - { + while ($row = $this->result[$id]->fetchArray(SQLITE3_ASSOC)) { $this->_fixObject[$id][] = (object)$row; } $this->result[$id]->reset(); @@ -407,77 +373,71 @@ class DedeSqlite function IsTable($tbname) { global $dsqlite; - if(!$dsqlite->isInit) - { - $this->Init($this->pconnect); - } - $prefix="#@__"; + if (!$dsqlite->isInit) { + $this->Init($this->pconnect); + } + $prefix = "#@__"; $tbname = str_replace($prefix, $GLOBALS['cfg_dbprefix'], $tbname); - $row = $this->linkID->querySingle( "PRAGMA table_info({$tbname});"); - - if( $row !== null ) - { + $row = $this->linkID->querySingle("PRAGMA table_info({$tbname});"); + + if ($row !== null) { return TRUE; } return FALSE; } //获得MySql的版本号 - function GetVersion($isformat=TRUE) + function GetVersion($isformat = TRUE) { global $dsqlite; - if(!$dsqlite->isInit) - { - $this->Init($this->pconnect); - } - if($dsqlite->isClose) - { + if (!$dsqlite->isInit) { + $this->Init($this->pconnect); + } + if ($dsqlite->isClose) { $this->Open(FALSE); $dsqlite->isClose = FALSE; } $rs = $this->linkID->querySingle("select sqlite_version();"); $sqlite_version = $rs; - if($isformat) - { - $sqlite_versions = explode(".",trim($sqlite_version)); - $sqlite_version = number_format($sqlite_versions[0].".".$sqlite_versions[1],2); + if ($isformat) { + $sqlite_versions = explode(".", trim($sqlite_version)); + $sqlite_version = number_format($sqlite_versions[0] . "." . $sqlite_versions[1], 2); } return $sqlite_version; } //获取特定表的信息 - function GetTableFields($tbname, $id="me") - { - global $dsqlite; - if(!$dsqlite->isInit) - { - $this->Init($this->pconnect); - } - $prefix="#@__"; + function GetTableFields($tbname, $id = "me") + { + global $dsqlite; + if (!$dsqlite->isInit) { + $this->Init($this->pconnect); + } + $prefix = "#@__"; $tbname = str_replace($prefix, $GLOBALS['cfg_dbprefix'], $tbname); $query = "SELECT * FROM {$tbname} LIMIT 0,1"; $this->result[$id] = $this->linkID->query($query); } //获取字段详细信息 - function GetFieldObject($id="me") + function GetFieldObject($id = "me") { - $cols = $this->result[$id]->numColumns(); + $cols = $this->result[$id]->numColumns(); $fields = array(); - while ($row = $this->result[$id]->fetchArray()) { - for ($i = 1; $i < $cols; $i++) { - $fields[] = $this->result[$id]->columnName($i); - } - } - + while ($row = $this->result[$id]->fetchArray()) { + for ($i = 1; $i < $cols; $i++) { + $fields[] = $this->result[$id]->columnName($i); + } + } + return (object)$fields; } //获得查询的总记录数 - function GetTotalRow($id="me") + function GetTotalRow($id = "me") { - $queryString = preg_replace("/SELECT(.*)FROM/isU",'SELECT count(*) as dd FROM',$this->queryString); + $queryString = preg_replace("/SELECT(.*)FROM/isU", 'SELECT count(*) as dd FROM', $this->queryString); $rs = $this->linkID->query($queryString); $row = $rs->fetchArray(); return $row['dd']; @@ -495,24 +455,19 @@ class DedeSqlite } //释放记录集占用的资源 - function FreeResult($id="me") + function FreeResult($id = "me") { - if ( $this->result[$id] ) - { + if ($this->result[$id]) { @$this->result[$id]->reset(); } - } function FreeResultAll() { - if(!is_array($this->result)) - { + if (!is_array($this->result)) { return ''; } - foreach($this->result as $kk => $vv) - { - if($vv) - { + foreach ($this->result as $kk => $vv) { + if ($vv) { @$vv->reset(); } } @@ -521,46 +476,43 @@ class DedeSqlite //设置SQL语句,会自动把SQL语句里的#@__替换为$this->dbPrefix(在配置文件中为$cfg_dbprefix) function SetQuery($sql) { - $prefix="#@__"; - $sql = str_replace($prefix,$GLOBALS['cfg_dbprefix'],$sql); + $prefix = "#@__"; + $sql = str_replace($prefix, $GLOBALS['cfg_dbprefix'], $sql); $this->queryString = $sql; //$this->queryString = preg_replace("/CONCAT\(',', arc.typeid2, ','\)/i","printf(',%s,', arc.typeid2)",$this->queryString); - if ( preg_match("/CONCAT\(([^\)]*?)\)/i",$this->queryString,$matches) ) - { - $this->queryString = preg_replace("/CONCAT\(([^\)]*?)\)/i",str_replace(",","||",$matches[1]), $this->queryString); - $this->queryString = str_replace("'||'","','",$this->queryString); - } - - $this->queryString = preg_replace("/FIND_IN_SET\('([\w]+)', arc.flag\)>0/i","(',' || arc.flag || ',') LIKE '%,\\1,%'",$this->queryString); - $this->queryString = preg_replace("/FIND_IN_SET\('([\w]+)', arc.flag\)<1/i","(',' || arc.flag || ',') NOT LIKE '%,\\1,%'",$this->queryString); - if ( preg_match("/CREATE TABLE/i",$this->queryString) ) - { - $this->queryString = preg_replace("/[\r\n]/",'',$this->queryString); - $this->queryString = preg_replace('/character set (.*?) /i','',$this->queryString); - $this->queryString = preg_replace('/unsigned/i','',$this->queryString); - $this->queryString = str_replace('TYPE=MyISAM','',$this->queryString); - - $this->queryString = preg_replace ('/TINYINT\(([\d]+)\)/i','INTEGER',$this->queryString); - $this->queryString = preg_replace ('/mediumint\(([\d]+)\)/i','INTEGER',$this->queryString); - $this->queryString = preg_replace ('/smallint\(([\d]+)\)/i','INTEGER',$this->queryString); - $this->queryString = preg_replace('/int\(([\d]+)\)/i','INTEGER',$this->queryString); - $this->queryString = preg_replace('/auto_increment/i','PRIMARY KEY AUTOINCREMENT',$this->queryString); - $this->queryString = preg_replace('/, KEY(.*?)MyISAM;/i','',$this->queryString); - $this->queryString = preg_replace('/, KEY(.*?);/i',');',$this->queryString); - $this->queryString = preg_replace('/, UNIQUE KEY(.*?);/i',');',$this->queryString); - $this->queryString = preg_replace('/set\(([^\)]*?)\)/','varchar',$this->queryString); - $this->queryString = preg_replace('/enum\(([^\)]*?)\)/','varchar',$this->queryString); - if ( preg_match("/PRIMARY KEY AUTOINCREMENT/",$this->queryString) ) - { - $this->queryString = preg_replace('/,([\t\s ]+)PRIMARY KEY \(`([0-9a-zA-Z]+)`\)/i','',$this->queryString); - $this->queryString = str_replace(', PRIMARY KEY (`id`)','',$this->queryString); + if (preg_match("/CONCAT\(([^\)]*?)\)/i", $this->queryString, $matches)) { + $this->queryString = preg_replace("/CONCAT\(([^\)]*?)\)/i", str_replace(",", "||", $matches[1]), $this->queryString); + $this->queryString = str_replace("'||'", "','", $this->queryString); + } + + $this->queryString = preg_replace("/FIND_IN_SET\('([\w]+)', arc.flag\)>0/i", "(',' || arc.flag || ',') LIKE '%,\\1,%'", $this->queryString); + $this->queryString = preg_replace("/FIND_IN_SET\('([\w]+)', arc.flag\)<1/i", "(',' || arc.flag || ',') NOT LIKE '%,\\1,%'", $this->queryString); + if (preg_match("/CREATE TABLE/i", $this->queryString)) { + $this->queryString = preg_replace("/[\r\n]/", '', $this->queryString); + $this->queryString = preg_replace('/character set (.*?) /i', '', $this->queryString); + $this->queryString = preg_replace('/unsigned/i', '', $this->queryString); + $this->queryString = str_replace('TYPE=MyISAM', '', $this->queryString); + + $this->queryString = preg_replace('/TINYINT\(([\d]+)\)/i', 'INTEGER', $this->queryString); + $this->queryString = preg_replace('/mediumint\(([\d]+)\)/i', 'INTEGER', $this->queryString); + $this->queryString = preg_replace('/smallint\(([\d]+)\)/i', 'INTEGER', $this->queryString); + $this->queryString = preg_replace('/int\(([\d]+)\)/i', 'INTEGER', $this->queryString); + $this->queryString = preg_replace('/auto_increment/i', 'PRIMARY KEY AUTOINCREMENT', $this->queryString); + $this->queryString = preg_replace('/, KEY(.*?)MyISAM;/i', '', $this->queryString); + $this->queryString = preg_replace('/, KEY(.*?);/i', ');', $this->queryString); + $this->queryString = preg_replace('/, UNIQUE KEY(.*?);/i', ');', $this->queryString); + $this->queryString = preg_replace('/set\(([^\)]*?)\)/', 'varchar', $this->queryString); + $this->queryString = preg_replace('/enum\(([^\)]*?)\)/', 'varchar', $this->queryString); + if (preg_match("/PRIMARY KEY AUTOINCREMENT/", $this->queryString)) { + $this->queryString = preg_replace('/,([\t\s ]+)PRIMARY KEY \(`([0-9a-zA-Z]+)`\)/i', '', $this->queryString); + $this->queryString = str_replace(', PRIMARY KEY (`id`)', '', $this->queryString); } } - $this->queryString = preg_replace("/SHOW fields FROM `([\w]+)`/i","PRAGMA table_info('\\1') ",$this->queryString); - $this->queryString = preg_replace("/SHOW CREATE TABLE .([\w]+)/i","SELECT 0,sql FROM sqlite_master WHERE name='\\1'; ",$this->queryString); + $this->queryString = preg_replace("/SHOW fields FROM `([\w]+)`/i", "PRAGMA table_info('\\1') ", $this->queryString); + $this->queryString = preg_replace("/SHOW CREATE TABLE .([\w]+)/i", "SELECT 0,sql FROM sqlite_master WHERE name='\\1'; ", $this->queryString); //var_dump($this->queryString); - $this->queryString = preg_replace("/Show Tables/i","SELECT name FROM sqlite_master WHERE type = \"table\"",$this->queryString); - $this->queryString = str_replace("\'","\"",$this->queryString); + $this->queryString = preg_replace("/Show Tables/i", "SELECT name FROM sqlite_master WHERE type = \"table\"", $this->queryString); + $this->queryString = str_replace("\'", "\"", $this->queryString); //var_dump($this->queryString); } @@ -569,11 +521,11 @@ class DedeSqlite $this->SetQuery($sql); } - function RecordLog($runtime=0) - { - $RecordLogFile = dirname(__FILE__).'/../data/mysqli_record_log.inc'; - $url = $this->GetCurUrl(); - $savemsg = <<GetCurUrl(); + $savemsg = <<queryString} @@ -583,57 +535,50 @@ EOT; $fp = @fopen($RecordLogFile, 'a'); @fwrite($fp, $savemsg); @fclose($fp); - } + } //显示数据链接错误信息 function DisplayError($msg) { - $errorTrackFile = dirname(__FILE__).'/../data/mysqli_error_trace.inc'; - if( file_exists(dirname(__FILE__).'/../data/mysqli_error_trace.php') ) - { - @unlink(dirname(__FILE__).'/../data/mysqli_error_trace.php'); - } - if($this->showError) - { - $emsg = ''; - $emsg .= "

      DedeCMS Error Warning!

      \r\n"; - $emsg .= ""; - $emsg .= "
      \r\n"; - $emsg .= "

      Error page: ".$this->GetCurUrl()."
      \r\n"; - $emsg .= "
      Error infos: {$msg}
      \r\n"; - $emsg .= "
      \r\n"; - - echo $emsg; - } - - $savemsg = 'Page: '.$this->GetCurUrl()."\r\nError: ".$msg."\r\nTime".date('Y-m-d H:i:s'); + $errorTrackFile = dirname(__FILE__) . '/../data/mysqli_error_trace.inc'; + if (file_exists(dirname(__FILE__) . '/../data/mysqli_error_trace.php')) { + @unlink(dirname(__FILE__) . '/../data/mysqli_error_trace.php'); + } + if ($this->showError) { + $emsg = ''; + $emsg .= "

      DedeBIZ Error Warning!

      \r\n"; + $emsg .= ""; + $emsg .= "
      \r\n"; + $emsg .= "

      Error page: " . $this->GetCurUrl() . "
      \r\n"; + $emsg .= "
      Error infos: {$msg}
      \r\n"; + $emsg .= "
      \r\n"; + + echo $emsg; + } + + $savemsg = 'Page: ' . $this->GetCurUrl() . "\r\nError: " . $msg . "\r\nTime" . date('Y-m-d H:i:s'); //保存MySql错误日志 $fp = @fopen($errorTrackFile, 'a'); - @fwrite($fp, '<'.'?php exit();'."\r\n/*\r\n{$savemsg}\r\n*/\r\n?".">\r\n"); + @fwrite($fp, '<' . '?php exit();' . "\r\n/*\r\n{$savemsg}\r\n*/\r\n?" . ">\r\n"); @fclose($fp); } //获得当前的脚本网址 function GetCurUrl() { - if(!empty($_SERVER["REQUEST_URI"])) - { + if (!empty($_SERVER["REQUEST_URI"])) { $scriptName = $_SERVER["REQUEST_URI"]; $nowurl = $scriptName; - } - else - { + } else { $scriptName = $_SERVER["PHP_SELF"]; - if(empty($_SERVER["QUERY_STRING"])) { + if (empty($_SERVER["QUERY_STRING"])) { $nowurl = $scriptName; - } - else { - $nowurl = $scriptName."?".$_SERVER["QUERY_STRING"]; + } else { + $nowurl = $scriptName . "?" . $_SERVER["QUERY_STRING"]; } } return $nowurl; } - } //复制一个对象副本 @@ -643,51 +588,42 @@ function CopySQLiPoint(&$ndsql) } //SQL语句过滤程序,由80sec提供,这里作了适当的修改 -if (!function_exists('CheckSql')) -{ - function CheckSql($db_string,$querytype='select') +if (!function_exists('CheckSql')) { + function CheckSql($db_string, $querytype = 'select') { global $cfg_cookie_encode; $clean = ''; - $error=''; + $error = ''; $old_pos = 0; $pos = -1; - $log_file = DEDEINC.'/../data/'.md5($cfg_cookie_encode).'_safe.txt'; + $log_file = DEDEINC . '/../data/' . md5($cfg_cookie_encode) . '_safe.txt'; $userIP = GetIP(); $getUrl = GetCurUrl(); //如果是普通查询语句,直接过滤一些特殊语法 - if($querytype=='select') - { + if ($querytype == 'select') { $notallow1 = "[^0-9a-z@\._-]{1,}(union|sleep|benchmark|load_file|outfile)[^0-9a-z@\.-]{1,}"; //$notallow2 = "--|/\*"; - if(preg_match("/".$notallow1."/i", $db_string)) - { - fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||SelectBreak\r\n"); + if (preg_match("/" . $notallow1 . "/i", $db_string)) { + fputs(fopen($log_file, 'a+'), "$userIP||$getUrl||$db_string||SelectBreak\r\n"); exit("Safe Alert: Request Error step 1 !"); } } //完整的SQL检查 - while (TRUE) - { + while (TRUE) { $pos = strpos($db_string, '\'', $pos + 1); - if ($pos === FALSE) - { + if ($pos === FALSE) { break; } $clean .= substr($db_string, $old_pos, $pos - $old_pos); - while (TRUE) - { + while (TRUE) { $pos1 = strpos($db_string, '\'', $pos + 1); $pos2 = strpos($db_string, '\\', $pos + 1); - if ($pos1 === FALSE) - { + if ($pos1 === FALSE) { break; - } - elseif ($pos2 == FALSE || $pos2 > $pos1) - { + } elseif ($pos2 == FALSE || $pos2 > $pos1) { $pos = $pos1; break; } @@ -697,65 +633,53 @@ if (!function_exists('CheckSql')) $old_pos = $pos + 1; } $clean .= substr($db_string, $old_pos); - $clean = trim(strtolower(preg_replace(array('~\s+~s' ), array(' '), $clean))); + $clean = trim(strtolower(preg_replace(array('~\s+~s'), array(' '), $clean))); - if (strpos($clean, '@') !== FALSE OR strpos($clean,'char(')!== FALSE OR strpos($clean,'"')!== FALSE - OR strpos($clean,'$s$$s$')!== FALSE) - { + if ( + strpos($clean, '@') !== FALSE or strpos($clean, 'char(') !== FALSE or strpos($clean, '"') !== FALSE + or strpos($clean, '$s$$s$') !== FALSE + ) { $fail = TRUE; - if(preg_match("#^create table#i",$clean)) $fail = FALSE; - $error="unusual character"; + if (preg_match("#^create table#i", $clean)) $fail = FALSE; + $error = "unusual character"; } //老版本的Mysql并不支持union,常用的程序里也不使用union,但是一些黑客使用它,所以检查它 - if (strpos($clean, 'union') !== FALSE && preg_match('~(^|[^a-z])union($|[^[a-z])~s', $clean) != 0) - { + if (strpos($clean, 'union') !== FALSE && preg_match('~(^|[^a-z])union($|[^[a-z])~s', $clean) != 0) { $fail = TRUE; - $error="union detect"; + $error = "union detect"; } //发布版本的程序可能比较少包括--,#这样的注释,但是黑客经常使用它们 - elseif (strpos($clean, '/*') > 2 || strpos($clean, '--') !== FALSE || strpos($clean, '#') !== FALSE) - { + elseif (strpos($clean, '/*') > 2 || strpos($clean, '--') !== FALSE || strpos($clean, '#') !== FALSE) { $fail = TRUE; - $error="comment detect"; + $error = "comment detect"; } //这些函数不会被使用,但是黑客会用它来操作文件,down掉数据库 - elseif (strpos($clean, 'sleep') !== FALSE && preg_match('~(^|[^a-z])sleep($|[^[a-z])~s', $clean) != 0) - { + elseif (strpos($clean, 'sleep') !== FALSE && preg_match('~(^|[^a-z])sleep($|[^[a-z])~s', $clean) != 0) { $fail = TRUE; - $error="slown down detect"; - } - elseif (strpos($clean, 'benchmark') !== FALSE && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0) - { + $error = "slown down detect"; + } elseif (strpos($clean, 'benchmark') !== FALSE && preg_match('~(^|[^a-z])benchmark($|[^[a-z])~s', $clean) != 0) { $fail = TRUE; - $error="slown down detect"; - } - elseif (strpos($clean, 'load_file') !== FALSE && preg_match('~(^|[^a-z])load_file($|[^[a-z])~s', $clean) != 0) - { + $error = "slown down detect"; + } elseif (strpos($clean, 'load_file') !== FALSE && preg_match('~(^|[^a-z])load_file($|[^[a-z])~s', $clean) != 0) { $fail = TRUE; - $error="file fun detect"; - } - elseif (strpos($clean, 'into outfile') !== FALSE && preg_match('~(^|[^a-z])into\s+outfile($|[^[a-z])~s', $clean) != 0) - { + $error = "file fun detect"; + } elseif (strpos($clean, 'into outfile') !== FALSE && preg_match('~(^|[^a-z])into\s+outfile($|[^[a-z])~s', $clean) != 0) { $fail = TRUE; - $error="file fun detect"; + $error = "file fun detect"; } //老版本的MYSQL不支持子查询,我们的程序里可能也用得少,但是黑客可以使用它来查询数据库敏感信息 - elseif (preg_match('~\([^)]*?select~s', $clean) != 0) - { + elseif (preg_match('~\([^)]*?select~s', $clean) != 0) { $fail = TRUE; - $error="sub select detect"; + $error = "sub select detect"; } - if (!empty($fail)) - { - fputs(fopen($log_file,'a+'),"$userIP||$getUrl||$db_string||$error\r\n"); + if (!empty($fail)) { + fputs(fopen($log_file, 'a+'), "$userIP||$getUrl||$db_string||$error\r\n"); exit("Safe Alert: Request Error step 2!"); - } - else - { + } else { return $db_string; } } diff --git a/src/include/dedetag.class.php b/src/include/dedetag.class.php index d3fbcb61..8c2b9637 100755 --- a/src/include/dedetag.class.php +++ b/src/include/dedetag.class.php @@ -1,9 +1,9 @@ -IsCache = TRUE; - } - else - { + } else { $this->IsCache = FALSE; } - if ( DEDE_ENVIRONMENT == 'development' ) - { + if (DEDE_ENVIRONMENT == 'development') { $this->IsCache = FALSE; } $this->NameSpace = 'dede'; @@ -150,7 +145,7 @@ class DedeTagParse * @param string $e 结束标记 * @return void */ - function SetNameSpace($str, $s="{", $e="}") + function SetNameSpace($str, $s = "{", $e = "}") { $this->NameSpace = strtolower($str); $this->TagStartWord = $s; @@ -167,9 +162,9 @@ class DedeTagParse { $this->SourceString = ''; $this->CTags = array(); - $this->Count=-1; + $this->Count = -1; } - + /** * 强制引用 * @@ -184,7 +179,7 @@ class DedeTagParse function GetCount() { - return $this->Count+1; + return $this->Count + 1; } function Clear() @@ -193,7 +188,7 @@ class DedeTagParse } // ------------------------------------------------------------------------ - + /** * CheckDisabledFunctions * @@ -203,22 +198,19 @@ class DedeTagParse * @param string * @return bool */ - function CheckDisabledFunctions($str,&$errmsg='') + function CheckDisabledFunctions($str, &$errmsg = '') { global $cfg_disable_funs; - $cfg_disable_funs = isset($cfg_disable_funs)? $cfg_disable_funs : 'phpinfo,eval,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,file_put_contents,fsockopen,fopen,fwrite'; + $cfg_disable_funs = isset($cfg_disable_funs) ? $cfg_disable_funs : 'phpinfo,eval,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,file_put_contents,fsockopen,fopen,fwrite'; // 模板引擎增加disable_functions if (defined('DEDEDISFUN')) { - $tokens = token_get_all_nl('"); + $tokens = token_get_all_nl('"); $disabled_functions = explode(',', $cfg_disable_funs); - foreach ($tokens as $token) - { - if (is_array($token)) - { - if ($token[0] = '306' && in_array($token[1], $disabled_functions)) - { - $errmsg = 'DedeCMS Error:function disabled "'.$token[1].'" more...'; - return FALSE; + foreach ($tokens as $token) { + if (is_array($token)) { + if ($token[0] = '306' && in_array($token[1], $disabled_functions)) { + $errmsg = 'DedeBIZ Error:function disabled "' . $token[1] . '" more...'; + return FALSE; } } } @@ -235,29 +227,26 @@ class DedeTagParse */ function LoadCache($filename) { - global $cfg_tplcache,$cfg_tplcache_dir; - if(!$this->IsCache) - { + global $cfg_tplcache, $cfg_tplcache_dir; + if (!$this->IsCache) { return FALSE; } $cdir = dirname($filename); - $cachedir = DEDEROOT.$cfg_tplcache_dir; - $ckfile = str_replace($cdir,'',$filename).substr(md5($filename),0,16).'.inc'; - $ckfullfile = $cachedir.'/'.$ckfile; - $ckfullfile_t = $cachedir.'/'.$ckfile.'.txt'; + $cachedir = DEDEROOT . $cfg_tplcache_dir; + $ckfile = str_replace($cdir, '', $filename) . substr(md5($filename), 0, 16) . '.inc'; + $ckfullfile = $cachedir . '/' . $ckfile; + $ckfullfile_t = $cachedir . '/' . $ckfile . '.txt'; $this->CacheFile = $ckfullfile; $this->TempMkTime = filemtime($filename); - if(!file_exists($ckfullfile)||!file_exists($ckfullfile_t)) - { + if (!file_exists($ckfullfile) || !file_exists($ckfullfile_t)) { return FALSE; } //检测模板最后更新时间 - $fp = fopen($ckfullfile_t,'r'); - $time_info = trim(fgets($fp,64)); + $fp = fopen($ckfullfile_t, 'r'); + $time_info = trim(fgets($fp, 64)); fclose($fp); - if($time_info != $this->TempMkTime) - { + if ($time_info != $this->TempMkTime) { return FALSE; } @@ -266,10 +255,8 @@ class DedeTagParse $errmsg = ''; //把缓冲数组内容读入类 - if( isset($z) && is_array($z) ) - { - foreach($z as $k=>$v) - { + if (isset($z) && is_array($z)) { + foreach ($z as $k => $v) { $this->Count++; $ctag = new DedeTAg(); $ctag->CAttribute = new DedeAttribute(); @@ -280,21 +267,17 @@ class DedeTagParse $ctag->EndPos = $v[3]; $ctag->TagValue = ''; $ctag->TagID = $k; - if(isset($v[4]) && is_array($v[4])) - { + if (isset($v[4]) && is_array($v[4])) { $i = 0; $ctag->CAttribute->Items = array(); - foreach($v[4] as $k=>$v) - { + foreach ($v[4] as $k => $v) { $ctag->CAttribute->Count++; - $ctag->CAttribute->Items[$k]=$v; + $ctag->CAttribute->Items[$k] = $v; } } $this->CTags[$this->Count] = $ctag; } - } - else - { + } else { //模板没有缓冲数组 $this->CTags = ''; $this->Count = -1; @@ -311,53 +294,47 @@ class DedeTagParse */ function SaveCache() { - $fp = fopen($this->CacheFile.'.txt',"w"); - fwrite($fp,$this->TempMkTime."\n"); + $fp = fopen($this->CacheFile . '.txt', "w"); + fwrite($fp, $this->TempMkTime . "\n"); fclose($fp); - $fp = fopen($this->CacheFile,"w"); - flock($fp,3); - fwrite($fp,'<'.'?php'."\r\n"); + $fp = fopen($this->CacheFile, "w"); + flock($fp, 3); + fwrite($fp, '<' . '?php' . "\r\n"); $errmsg = ''; - if(is_array($this->CTags)) - { - foreach($this->CTags as $tid=>$ctag) - { - $arrayValue = 'Array("'.$ctag->TagName.'",'; + if (is_array($this->CTags)) { + foreach ($this->CTags as $tid => $ctag) { + $arrayValue = 'Array("' . $ctag->TagName . '",'; if (!$this->CheckDisabledFunctions($ctag->InnerText, $errmsg)) { fclose($fp); @unlink($this->taghashfile); @unlink($this->CacheFile); - @unlink($this->CacheFile.'.txt'); + @unlink($this->CacheFile . '.txt'); die($errmsg); } - $arrayValue .= '"'.str_replace('$','\$',str_replace("\r","\\r",str_replace("\n","\\n",str_replace('"','\"',str_replace("\\","\\\\",$ctag->InnerText))))).'"'; + $arrayValue .= '"' . str_replace('$', '\$', str_replace("\r", "\\r", str_replace("\n", "\\n", str_replace('"', '\"', str_replace("\\", "\\\\", $ctag->InnerText))))) . '"'; $arrayValue .= ",{$ctag->StartPos},{$ctag->EndPos});"; - fwrite($fp,"\$z[$tid]={$arrayValue}\n"); - if(is_array($ctag->CAttribute->Items)) - { - fwrite($fp,"\$z[$tid][4]=array();\n"); - foreach($ctag->CAttribute->Items as $k=>$v) - { - $v = str_replace("\\","\\\\",$v); - $v = str_replace('"',"\\".'"',$v); - $v = str_replace('$','\$',$v); - $k = trim(str_replace("'","",$k)); - if($k=="") - { + fwrite($fp, "\$z[$tid]={$arrayValue}\n"); + if (is_array($ctag->CAttribute->Items)) { + fwrite($fp, "\$z[$tid][4]=array();\n"); + foreach ($ctag->CAttribute->Items as $k => $v) { + $v = str_replace("\\", "\\\\", $v); + $v = str_replace('"', "\\" . '"', $v); + $v = str_replace('$', '\$', $v); + $k = trim(str_replace("'", "", $k)); + if ($k == "") { continue; } - if($k!='tagname') - { - fwrite($fp,"\$z[$tid][4]['$k']=\"$v\";\n"); + if ($k != 'tagname') { + fwrite($fp, "\$z[$tid][4]['$k']=\"$v\";\n"); } } } } } - fwrite($fp,"\n".'?'.'>'); + fwrite($fp, "\n" . '?' . '>'); fclose($fp); } - + /** * 载入模板文件 * @@ -368,25 +345,18 @@ class DedeTagParse function LoadTemplate($filename) { $this->SetDefault(); - if(!file_exists($filename)) - { + if (!file_exists($filename)) { $this->SourceString = " $filename Not Found! "; $this->ParseTemplet(); - } - else - { + } else { $fp = @fopen($filename, "r"); - while($line = fgets($fp,1024)) - { + while ($line = fgets($fp, 1024)) { $this->SourceString .= $line; } fclose($fp); - if($this->LoadCache($filename)) - { + if ($this->LoadCache($filename)) { return ''; - } - else - { + } else { $this->ParseTemplet(); } } @@ -420,9 +390,8 @@ class DedeTagParse $this->ParseTemplet(); */ //优化模板字符串存取读取方式 - $this->taghashfile = $filename = DEDEDATA.'/tplcache/'.md5($str).'.inc'; - if( !is_file($filename) ) - { + $this->taghashfile = $filename = DEDEDATA . '/tplcache/' . md5($str) . '.inc'; + if (!is_file($filename)) { file_put_contents($filename, $str); } $this->LoadTemplate($filename); @@ -442,18 +411,14 @@ class DedeTagParse */ function GetTagID($str) { - if($this->Count==-1) - { + if ($this->Count == -1) { return -1; } - if($this->CharToLow) - { - $str=strtolower($str); + if ($this->CharToLow) { + $str = strtolower($str); } - foreach($this->CTags as $id=>$CTag) - { - if($CTag->TagName==$str && !$CTag->IsReplace) - { + foreach ($this->CTags as $id => $CTag) { + if ($CTag->TagName == $str && !$CTag->IsReplace) { return $id; break; } @@ -470,18 +435,14 @@ class DedeTagParse */ function GetTag($str) { - if($this->Count==-1) - { + if ($this->Count == -1) { return ''; } - if($this->CharToLow) - { - $str=strtolower($str); + if ($this->CharToLow) { + $str = strtolower($str); } - foreach($this->CTags as $id=>$CTag) - { - if($CTag->TagName==$str && !$CTag->IsReplace) - { + foreach ($this->CTags as $id => $CTag) { + if ($CTag->TagName == $str && !$CTag->IsReplace) { return $CTag; break; } @@ -510,12 +471,9 @@ class DedeTagParse */ function GetTagByID($id) { - if(isset($this->CTags[$id])) - { + if (isset($this->CTags[$id])) { return $this->CTags[$id]; - } - else - { + } else { return ''; } } @@ -530,8 +488,7 @@ class DedeTagParse */ function AssignVar($vname, $vvalue) { - if(!isset($_sys_globals['define'])) - { + if (!isset($_sys_globals['define'])) { $_sys_globals['define'] = 'yes'; } $_sys_globals[$vname] = $vvalue; @@ -548,14 +505,12 @@ class DedeTagParse */ function Assign($i, $str, $runfunc = TRUE) { - if(isset($this->CTags[$i])) - { + if (isset($this->CTags[$i])) { $this->CTags[$i]->IsReplace = TRUE; $this->CTags[$i]->TagValue = $str; - if( $this->CTags[$i]->GetAtt('function')!='' && $runfunc ) - { - $this->CTags[$i]->TagValue = $this->EvalFunc( $str, $this->CTags[$i]->GetAtt('function'),$this->CTags[$i] ); + if ($this->CTags[$i]->GetAtt('function') != '' && $runfunc) { + $this->CTags[$i]->TagValue = $this->EvalFunc($str, $this->CTags[$i]->GetAtt('function'), $this->CTags[$i]); } } } @@ -570,11 +525,9 @@ class DedeTagParse */ function AssignName($tagname, $str) { - foreach($this->CTags as $id=>$CTag) - { - if($CTag->TagName==$tagname) - { - $this->Assign($id,$str); + foreach ($this->CTags as $id => $CTag) { + if ($CTag->TagName == $tagname) { + $this->Assign($id, $str); } } } @@ -588,44 +541,37 @@ class DedeTagParse function AssignSysTag() { global $_sys_globals; - for($i=0;$i<=$this->Count;$i++) - { + for ($i = 0; $i <= $this->Count; $i++) { $CTag = $this->CTags[$i]; $str = ''; //获取一个外部变量 - if( $CTag->TagName == 'global' ) - { + if ($CTag->TagName == 'global') { $str = $this->GetGlobals($CTag->GetAtt('name')); - if( $this->CTags[$i]->GetAtt('function')!='' ) - { + if ($this->CTags[$i]->GetAtt('function') != '') { //$str = $this->EvalFunc( $this->CTags[$i]->TagValue, $this->CTags[$i]->GetAtt('function'),$this->CTags[$i] ); - $str = $this->EvalFunc( $str, $this->CTags[$i]->GetAtt('function'),$this->CTags[$i] ); + $str = $this->EvalFunc($str, $this->CTags[$i]->GetAtt('function'), $this->CTags[$i]); } $this->CTags[$i]->IsReplace = TRUE; $this->CTags[$i]->TagValue = $str; } //引入静态文件 - else if( $CTag->TagName == 'include' ) - { - $filename = ($CTag->GetAtt('file')=='' ? $CTag->GetAtt('filename') : $CTag->GetAtt('file') ); - $str = $this->IncludeFile($filename,$CTag->GetAtt('ismake')); + else if ($CTag->TagName == 'include') { + $filename = ($CTag->GetAtt('file') == '' ? $CTag->GetAtt('filename') : $CTag->GetAtt('file')); + $str = $this->IncludeFile($filename, $CTag->GetAtt('ismake')); $this->CTags[$i]->IsReplace = TRUE; $this->CTags[$i]->TagValue = $str; } //循环一个普通数组 - else if( $CTag->TagName == 'foreach' ) - { + else if ($CTag->TagName == 'foreach') { $arr = $this->CTags[$i]->GetAtt('array'); - if(isset($GLOBALS[$arr])) - { - foreach($GLOBALS[$arr] as $k=>$v) - { + if (isset($GLOBALS[$arr])) { + foreach ($GLOBALS[$arr] as $k => $v) { $istr = ''; - $istr .= preg_replace("/\[field:key([\r\n\t\f ]+)\/\]/is",$k,$this->CTags[$i]->InnerText); - $str .= preg_replace("/\[field:value([\r\n\t\f ]+)\/\]/is",$v,$istr); + $istr .= preg_replace("/\[field:key([\r\n\t\f ]+)\/\]/is", $k, $this->CTags[$i]->InnerText); + $str .= preg_replace("/\[field:value([\r\n\t\f ]+)\/\]/is", $v, $istr); } } $this->CTags[$i]->IsReplace = TRUE; @@ -633,19 +579,13 @@ class DedeTagParse } //设置/获取变量值 - else if( $CTag->TagName == 'var' ) - { + else if ($CTag->TagName == 'var') { $vname = $this->CTags[$i]->GetAtt('name'); - if($vname=='') - { + if ($vname == '') { $str = ''; - } - else if($this->CTags[$i]->GetAtt('value')!='') - { + } else if ($this->CTags[$i]->GetAtt('value') != '') { $_vars[$vname] = $this->CTags[$i]->GetAtt('value'); - } - else - { + } else { $str = (isset($_vars[$vname]) ? $_vars[$vname] : ''); } $this->CTags[$i]->IsReplace = TRUE; @@ -653,12 +593,10 @@ class DedeTagParse } //运行PHP接口 - if( $CTag->GetAtt('runphp') == 'yes' ) - { + if ($CTag->GetAtt('runphp') == 'yes') { $this->RunPHP($CTag, $i); } - if(is_array($this->CTags[$i]->TagValue)) - { + if (is_array($this->CTags[$i]->TagValue)) { $this->CTags[$i]->TagValue = 'array'; } } @@ -668,12 +606,9 @@ class DedeTagParse function RunPHP(&$refObj, $i) { $DedeMeValue = $phpcode = ''; - if($refObj->GetAtt('source')=='value') - { + if ($refObj->GetAtt('source') == 'value') { $phpcode = $this->CTags[$i]->TagValue; - } - else - { + } else { $DedeMeValue = $this->CTags[$i]->TagValue; $phpcode = $refObj->GetInnerText(); } @@ -694,30 +629,25 @@ class DedeTagParse function GetResultNP() { $ResultString = ''; - if($this->Count==-1) - { + if ($this->Count == -1) { return $this->SourceString; } $this->AssignSysTag(); $nextTagEnd = 0; $strok = ""; - for($i=0;$i<=$this->Count;$i++) - { - if($this->CTags[$i]->GetValue()!="") - { - if($this->CTags[$i]->GetValue()=='#@Delete@#') - { + for ($i = 0; $i <= $this->Count; $i++) { + if ($this->CTags[$i]->GetValue() != "") { + if ($this->CTags[$i]->GetValue() == '#@Delete@#') { $this->CTags[$i]->TagValue = ""; } - $ResultString .= substr($this->SourceString,$nextTagEnd,$this->CTags[$i]->StartPos-$nextTagEnd); + $ResultString .= substr($this->SourceString, $nextTagEnd, $this->CTags[$i]->StartPos - $nextTagEnd); $ResultString .= $this->CTags[$i]->GetValue(); $nextTagEnd = $this->CTags[$i]->EndPos; } } $slen = strlen($this->SourceString); - if($slen>$nextTagEnd) - { - $ResultString .= substr($this->SourceString,$nextTagEnd,$slen-$nextTagEnd); + if ($slen > $nextTagEnd) { + $ResultString .= substr($this->SourceString, $nextTagEnd, $slen - $nextTagEnd); } return $ResultString; } @@ -731,23 +661,20 @@ class DedeTagParse function GetResult() { $ResultString = ''; - if($this->Count==-1) - { + if ($this->Count == -1) { return $this->SourceString; } $this->AssignSysTag(); $nextTagEnd = 0; $strok = ""; - for($i=0;$i<=$this->Count;$i++) - { - $ResultString .= substr($this->SourceString,$nextTagEnd,$this->CTags[$i]->StartPos-$nextTagEnd); + for ($i = 0; $i <= $this->Count; $i++) { + $ResultString .= substr($this->SourceString, $nextTagEnd, $this->CTags[$i]->StartPos - $nextTagEnd); $ResultString .= $this->CTags[$i]->GetValue(); $nextTagEnd = $this->CTags[$i]->EndPos; } $slen = strlen($this->SourceString); - if($slen>$nextTagEnd) - { - $ResultString .= substr($this->SourceString,$nextTagEnd,$slen-$nextTagEnd); + if ($slen > $nextTagEnd) { + $ResultString .= substr($this->SourceString, $nextTagEnd, $slen - $nextTagEnd); } return $ResultString; } @@ -772,8 +699,8 @@ class DedeTagParse */ function SaveTo($filename) { - $fp = @fopen($filename,"w") or die("DedeTag Engine Create File False"); - fwrite($fp,$this->GetResult()); + $fp = @fopen($filename, "w") or die("DedeTag Engine Create File False"); + fwrite($fp, $this->GetResult()); fclose($fp); } @@ -787,46 +714,40 @@ class DedeTagParse { $TagStartWord = $this->TagStartWord; $TagEndWord = $this->TagEndWord; - $sPos = 0; $ePos = 0; - $FullTagStartWord = $TagStartWord.$this->NameSpace.":"; - $sTagEndWord = $TagStartWord."/".$this->NameSpace.":"; - $eTagEndWord = "/".$TagEndWord; + $sPos = 0; + $ePos = 0; + $FullTagStartWord = $TagStartWord . $this->NameSpace . ":"; + $sTagEndWord = $TagStartWord . "/" . $this->NameSpace . ":"; + $eTagEndWord = "/" . $TagEndWord; $tsLen = strlen($FullTagStartWord); - $sourceLen=strlen($this->SourceString); - - if( $sourceLen <= ($tsLen + 3) ) - { + $sourceLen = strlen($this->SourceString); + + if ($sourceLen <= ($tsLen + 3)) { return; } $cAtt = new DedeAttributeParse(); $cAtt->charToLow = $this->CharToLow; //遍历模板字符串,请取标记及其属性信息 - for($i=0; $i < $sourceLen; $i++) - { + for ($i = 0; $i < $sourceLen; $i++) { $tTagName = ''; //如果不进行此判断,将无法识别相连的两个标记 - if($i-1 >= 0) - { - $ss = $i-1; - } - else - { + if ($i - 1 >= 0) { + $ss = $i - 1; + } else { $ss = 0; } - $sPos = strpos($this->SourceString,$FullTagStartWord,$ss); + $sPos = strpos($this->SourceString, $FullTagStartWord, $ss); $isTag = $sPos; - if($i==0) - { - $headerTag = substr($this->SourceString,0,strlen($FullTagStartWord)); - if($headerTag==$FullTagStartWord) - { - $isTag=TRUE; $sPos=0; + if ($i == 0) { + $headerTag = substr($this->SourceString, 0, strlen($FullTagStartWord)); + if ($headerTag == $FullTagStartWord) { + $isTag = TRUE; + $sPos = 0; } } - if($isTag===FALSE) - { + if ($isTag === FALSE) { break; } //判断是否已经到倒数第三个字符(可能性几率极小,取消此逻辑) @@ -836,68 +757,56 @@ class DedeTagParse break; } */ - for($j=($sPos+$tsLen);$j<($sPos+$tsLen+$this->TagMaxLen);$j++) - { - if($j>($sourceLen-1)) - { + for ($j = ($sPos + $tsLen); $j < ($sPos + $tsLen + $this->TagMaxLen); $j++) { + if ($j > ($sourceLen - 1)) { break; - } - else if( preg_match("/[\/ \t\r\n]/", $this->SourceString[$j]) || $this->SourceString[$j] == $this->TagEndWord ) - { + } else if (preg_match("/[\/ \t\r\n]/", $this->SourceString[$j]) || $this->SourceString[$j] == $this->TagEndWord) { break; - } - else - { + } else { $tTagName .= $this->SourceString[$j]; } } - if($tTagName!='') - { - $i = $sPos+$tsLen; + if ($tTagName != '') { + $i = $sPos + $tsLen; $endPos = -1; - $fullTagEndWordThis = $sTagEndWord.$tTagName.$TagEndWord; - - $e1 = strpos($this->SourceString,$eTagEndWord, $i); - $e2 = strpos($this->SourceString,$FullTagStartWord, $i); - $e3 = strpos($this->SourceString,$fullTagEndWordThis,$i); - + $fullTagEndWordThis = $sTagEndWord . $tTagName . $TagEndWord; + + $e1 = strpos($this->SourceString, $eTagEndWord, $i); + $e2 = strpos($this->SourceString, $FullTagStartWord, $i); + $e3 = strpos($this->SourceString, $fullTagEndWordThis, $i); + //$eTagEndWord = /} $FullTagStartWord = {tag: $fullTagEndWordThis = {/tag:xxx] - - $e1 = trim($e1); $e2 = trim($e2); $e3 = trim($e3); - $e1 = ($e1=='' ? '-1' : $e1); - $e2 = ($e2=='' ? '-1' : $e2); - $e3 = ($e3=='' ? '-1' : $e3); + + $e1 = trim($e1); + $e2 = trim($e2); + $e3 = trim($e3); + $e1 = ($e1 == '' ? '-1' : $e1); + $e2 = ($e2 == '' ? '-1' : $e2); + $e3 = ($e3 == '' ? '-1' : $e3); //not found '{/tag:' - if($e3==-1) - { + if ($e3 == -1) { $endPos = $e1; $elen = $endPos + strlen($eTagEndWord); } //not found '/}' - else if($e1==-1) - { + else if ($e1 == -1) { $endPos = $e3; $elen = $endPos + strlen($fullTagEndWordThis); } //found '/}' and found '{/dede:' - else - { + else { //if '/}' more near '{dede:'、'{/dede:' , end tag is '/}', else is '{/dede:' - if($e1 < $e2 && $e1 < $e3 ) - { + if ($e1 < $e2 && $e1 < $e3) { $endPos = $e1; $elen = $endPos + strlen($eTagEndWord); - } - else - { + } else { $endPos = $e3; $elen = $endPos + strlen($fullTagEndWordThis); } } //not found end tag , error - if($endPos==-1) - { + if ($endPos == -1) { echo "Tag Character postion $sPos, '$tTagName' Error!
      \r\n"; break; } @@ -908,26 +817,20 @@ class DedeTagParse $attStr = ''; $innerText = ''; $startInner = 0; - for($j=($sPos+$tsLen);$j < $ePos;$j++) - { - if($startInner==0 && ($this->SourceString[$j]==$TagEndWord && $this->SourceString[$j-1]!="\\") ) - { - $startInner=1; + for ($j = ($sPos + $tsLen); $j < $ePos; $j++) { + if ($startInner == 0 && ($this->SourceString[$j] == $TagEndWord && $this->SourceString[$j - 1] != "\\")) { + $startInner = 1; continue; } - if($startInner==0) - { + if ($startInner == 0) { $attStr .= $this->SourceString[$j]; - } - else - { + } else { $innerText .= $this->SourceString[$j]; } } //echo "$attStr\r\n"; $cAtt->SetSource($attStr); - if($cAtt->cAttributes->GetTagName()!='') - { + if ($cAtt->cAttributes->GetTagName() != '') { $this->Count++; $CDTag = new DedeTag(); $CDTag->TagName = $cAtt->cAttributes->GetTagName(); @@ -939,16 +842,13 @@ class DedeTagParse $CDTag->InnerText = $innerText; $this->CTags[$this->Count] = $CDTag; } - } - else - { - $i = $sPos+$tsLen; + } else { + $i = $sPos + $tsLen; break; } - }//结束遍历模板字符串 + } //结束遍历模板字符串 - if($this->IsCache) - { + if ($this->IsCache) { $this->SaveCache(); } } @@ -962,20 +862,17 @@ class DedeTagParse * @param object $refObj 隶属对象 * @return string */ - function EvalFunc($fieldvalue,$functionname,&$refObj) + function EvalFunc($fieldvalue, $functionname, &$refObj) { $DedeFieldValue = $fieldvalue; - $functionname = str_replace("{\"","[\"",$functionname); - $functionname = str_replace("\"}","\"]",$functionname); - $functionname = preg_replace("/'@me'|\"@me\"|@me/i",'$DedeFieldValue',$functionname); - $functionname = "\$DedeFieldValue = ".$functionname; - @eval($functionname.";"); //or die("$functionname"); - if(empty($DedeFieldValue)) - { + $functionname = str_replace("{\"", "[\"", $functionname); + $functionname = str_replace("\"}", "\"]", $functionname); + $functionname = preg_replace("/'@me'|\"@me\"|@me/i", '$DedeFieldValue', $functionname); + $functionname = "\$DedeFieldValue = " . $functionname; + @eval($functionname . ";"); //or die("$functionname"); + if (empty($DedeFieldValue)) { return ''; - } - else - { + } else { return $DedeFieldValue; } } @@ -992,18 +889,14 @@ class DedeTagParse $varname = trim($varname); //禁止在模板文件读取数据库密码 - if($varname=="dbuserpwd"||$varname=="cfg_dbpwd") - { + if ($varname == "dbuserpwd" || $varname == "cfg_dbpwd") { return ""; } //正常情况 - if(isset($GLOBALS[$varname])) - { + if (isset($GLOBALS[$varname])) { return $GLOBALS[$varname]; - } - else - { + } else { return ""; } } @@ -1016,40 +909,31 @@ class DedeTagParse * @param string $ismake 是否需要编译 * @return string */ - function IncludeFile($filename, $ismake='no') + function IncludeFile($filename, $ismake = 'no') { global $cfg_df_style; $restr = ''; - if($filename=='') - { + if ($filename == '') { return ''; } - if( file_exists(DEDEROOT."/templets/".$filename) ) - { - $okfile = DEDEROOT."/templets/".$filename; - } - else if(file_exists(DEDEROOT.'/templets/'.$cfg_df_style.'/'.$filename) ) - { - $okfile = DEDEROOT.'/templets/'.$cfg_df_style.'/'.$filename; - } - else - { + if (file_exists(DEDEROOT . "/templets/" . $filename)) { + $okfile = DEDEROOT . "/templets/" . $filename; + } else if (file_exists(DEDEROOT . '/templets/' . $cfg_df_style . '/' . $filename)) { + $okfile = DEDEROOT . '/templets/' . $cfg_df_style . '/' . $filename; + } else { return "无法在这个位置找到: $filename"; } //编译 - if($ismake!="no") - { - require_once(DEDEINC."/channelunit.func.php"); + if ($ismake != "no") { + require_once(DEDEINC . "/channelunit.func.php"); $dtp = new DedeTagParse(); $dtp->LoadTemplet($okfile); - MakeOneTag($dtp,$this->refObj); + MakeOneTag($dtp, $this->refObj); $restr = $dtp->GetResult(); - } - else - { - $fp = @fopen($okfile,"r"); - while($line=fgets($fp,1024)) $restr.=$line; + } else { + $fp = @fopen($okfile, "r"); + while ($line = fgets($fp, 1024)) $restr .= $line; fclose($fp); } return $restr; @@ -1059,7 +943,7 @@ class DedeTagParse /********************************************** //class DedeAttribute Dede模板标记属性集合 function c____DedeAttribute(); -**********************************************/ + **********************************************/ //属性的数据描述 class DedeAttribute { @@ -1068,16 +952,12 @@ class DedeAttribute //获得某个属性 function GetAtt($str) { - if($str=="") - { + if ($str == "") { return ""; } - if(isset($this->Items[$str])) - { + if (isset($this->Items[$str])) { return $this->Items[$str]; - } - else - { + } else { return ""; } } @@ -1091,7 +971,7 @@ class DedeAttribute //判断属性是否存在 function IsAttribute($str) { - if(isset($this->Items[$str])) return TRUE; + if (isset($this->Items[$str])) return TRUE; else return FALSE; } @@ -1104,39 +984,38 @@ class DedeAttribute // 获得属性个数 function GetCount() { - return $this->Count+1; + return $this->Count + 1; } } /******************************* //属性解析器(本版本中已经支持使用\'这种语法,和用.间隔表示name属性,如 field.body) function c____DedeAttributeParse(); -********************************/ + ********************************/ class DedeAttributeParse { var $sourceString = ""; var $sourceMaxSize = 1024; var $cAttributes = ""; var $charToLow = TRUE; - function SetSource($str='') + function SetSource($str = '') { $this->cAttributes = new DedeAttribute(); $strLen = 0; - $this->sourceString = trim(preg_replace("/[ \r\n\t]{1,}/"," ",$str)); - + $this->sourceString = trim(preg_replace("/[ \r\n\t]{1,}/", " ", $str)); + //为了在function内能使用数组,这里允许对[ ]进行转义使用 - $this->sourceString = str_replace('\]',']',$this->sourceString); - $this->sourceString = str_replace('[','[',$this->sourceString); + $this->sourceString = str_replace('\]', ']', $this->sourceString); + $this->sourceString = str_replace('[', '[', $this->sourceString); /* $this->sourceString = str_replace('\>','>',$this->sourceString); $this->sourceString = str_replace('<','>',$this->sourceString); $this->sourceString = str_replace('{','{',$this->sourceString); $this->sourceString = str_replace('\}','}',$this->sourceString); */ - + $strLen = strlen($this->sourceString); - if($strLen>0 && $strLen <= $this->sourceMaxSize) - { + if ($strLen > 0 && $strLen <= $this->sourceMaxSize) { $this->ParseAttribute(); } } @@ -1149,76 +1028,59 @@ class DedeAttributeParse $tmpvalue = ''; $startdd = -1; $ddtag = ''; - $hasAttribute=FALSE; + $hasAttribute = FALSE; $strLen = strlen($this->sourceString); $this->cAttributes->Items = array(); // 获得Tag的名称,解析到 cAtt->GetAtt('tagname') 中 - for($i=0; $i<$strLen; $i++) - { - if($this->sourceString[$i]==' ') - { + for ($i = 0; $i < $strLen; $i++) { + if ($this->sourceString[$i] == ' ') { $this->cAttributes->Count++; $tmpvalues = explode('.', $tmpvalue); $this->cAttributes->Items['tagname'] = ($this->charToLow ? strtolower($tmpvalues[0]) : $tmpvalues[0]); - if(isset($tmpvalues[1]) && $tmpvalues[1]!='') - { + if (isset($tmpvalues[1]) && $tmpvalues[1] != '') { $this->cAttributes->Items['name'] = $tmpvalues[1]; } $tmpvalue = ''; $hasAttribute = TRUE; break; - } - else - { + } else { $tmpvalue .= $this->sourceString[$i]; } } //不存在属性列表的情况 - if(!$hasAttribute) - { + if (!$hasAttribute) { $this->cAttributes->Count++; $tmpvalues = explode('.', $tmpvalue); $this->cAttributes->Items['tagname'] = ($this->charToLow ? strtolower($tmpvalues[0]) : $tmpvalues[0]); - if(isset($tmpvalues[1]) && $tmpvalues[1]!='') - { + if (isset($tmpvalues[1]) && $tmpvalues[1] != '') { $this->cAttributes->Items['name'] = $tmpvalues[1]; } - return ; + return; } $tmpvalue = ''; //如果字符串含有属性值,遍历源字符串,并获得各属性 - for($i; $i<$strLen; $i++) - { + for ($i; $i < $strLen; $i++) { $d = $this->sourceString[$i]; //查找属性名称 - if($startdd==-1) - { - if($d != '=') - { + if ($startdd == -1) { + if ($d != '=') { $tmpatt .= $d; - } - else - { - if($this->charToLow) - { + } else { + if ($this->charToLow) { $tmpatt = strtolower(trim($tmpatt)); - } - else - { + } else { $tmpatt = trim($tmpatt); } - $startdd=0; + $startdd = 0; } } //查找属性的限定标志 - else if($startdd==0) - { - switch($d) - { + else if ($startdd == 0) { + switch ($d) { case ' ': break; case '"': @@ -1235,30 +1097,24 @@ class DedeAttributeParse $startdd = 1; break; } - } - else if($startdd==1) - { - if($d==$ddtag && ( isset($this->sourceString[$i-1]) && $this->sourceString[$i-1]!="\\") ) - { + } else if ($startdd == 1) { + if ($d == $ddtag && (isset($this->sourceString[$i - 1]) && $this->sourceString[$i - 1] != "\\")) { $this->cAttributes->Count++; $this->cAttributes->Items[$tmpatt] = trim($tmpvalue); $tmpatt = ''; $tmpvalue = ''; $startdd = -1; - } - else - { + } else { $tmpvalue .= $d; } } - }//for + } //for //最后一个属性的给值 - if($tmpatt != '') - { + if ($tmpatt != '') { $this->cAttributes->Count++; $this->cAttributes->Items[$tmpatt] = trim($tmpvalue); } //print_r($this->cAttributes->Items); - }// end func -} \ No newline at end of file + } // end func +} diff --git a/src/include/dedetemplate.class.php b/src/include/dedetemplate.class.php index 68d6d37e..dd50e342 100755 --- a/src/include/dedetemplate.class.php +++ b/src/include/dedetemplate.class.php @@ -1,9 +1,9 @@ -$v) - { - if(preg_match('/^field\./i',$v)) - { + foreach ($atts as $k => $v) { + if (preg_match('/^field\./i', $v)) { $key = preg_replace('/^field\./i', '', $v); - if( isset($fields[$key]) ) - { + if (isset($fields[$key])) { $atts[$k] = $fields[$key]; } - } - else if(preg_match('/^var\./i', $v)) - { + } else if (preg_match('/^var\./i', $v)) { $key = preg_replace('/^var\./i', '', $v); - if( isset($_vars[$key]) ) - { + if (isset($_vars[$key])) { $atts[$k] = $_vars[$key]; } - } - else if(preg_match('/^global\./i', $v)) - { + } else if (preg_match('/^global\./i', $v)) { $key = preg_replace('/^global\./i', '', $v); - if( isset($GLOBALS[$key]) ) - { + if (isset($GLOBALS[$key])) { $atts[$k] = $GLOBALS[$key]; } } @@ -117,18 +100,18 @@ function FillFields(&$atts, &$refObj, &$fields) * function C__Tag(); * * @package Tag - * @subpackage DedeCMS.Libraries - * @link http://www.dedecms.com + * @subpackage DedeBIZ.Libraries + * @link https://www.dedebiz.com */ class Tag { - var $isCompiler=FALSE; //标记是否已被替代,供解析器使用 - var $tagName=""; //标记名称 - var $innerText=""; //标记之间的文本 - var $startPos=0; //标记起始位置 - var $endPos=0; //标记结束位置 - var $cAtt=""; //标记属性描述,即是class TagAttribute - var $tagValue=""; //标记的值 + var $isCompiler = FALSE; //标记是否已被替代,供解析器使用 + var $tagName = ""; //标记名称 + var $innerText = ""; //标记之间的文本 + var $startPos = 0; //标记起始位置 + var $endPos = 0; //标记结束位置 + var $cAtt = ""; //标记属性描述,即是class TagAttribute + var $tagValue = ""; //标记的值 var $tagID = 0; /** @@ -173,8 +156,8 @@ class Tag * function C__DedeTemplate * * @package DedeTemplate - * @subpackage DedeCMS.Libraries - * @link http://www.dedecms.com + * @subpackage DedeBIZ.Libraries + * @link https://www.dedebiz.com */ class DedeTemplate { @@ -214,38 +197,31 @@ class DedeTemplate * @param string $refDir 所属目录 * @return void */ - function __construct($templatedir='',$refDir='') + function __construct($templatedir = '', $refDir = '') { //$definedVars[] = 'var'; //缓存目录 - if($templatedir=='') - { - $this->templateDir = DEDEROOT.'/templates'; - } - else - { + if ($templatedir == '') { + $this->templateDir = DEDEROOT . '/templates'; + } else { $this->templateDir = $templatedir; } //模板include目录 - if($refDir=='') - { - if(isset($GLOBALS['cfg_df_style'])) - { - $this->refDir = $this->templateDir.'/'.$GLOBALS['cfg_df_style'].'/'; - } - else - { + if ($refDir == '') { + if (isset($GLOBALS['cfg_df_style'])) { + $this->refDir = $this->templateDir . '/' . $GLOBALS['cfg_df_style'] . '/'; + } else { $this->refDir = $this->templateDir; } } - $this->cacheDir = DEDEROOT.$GLOBALS['cfg_tplcache_dir']; + $this->cacheDir = DEDEROOT . $GLOBALS['cfg_tplcache_dir']; } //构造函数,兼容PHP4 - function DedeTemplate($templatedir='',$refDir='') + function DedeTemplate($templatedir = '', $refDir = '') { - $this->__construct($templatedir,$refDir); + $this->__construct($templatedir, $refDir); } /** @@ -309,7 +285,7 @@ class DedeTemplate * @param string $tend 结束标记 * @return void */ - function SetTagStyle($ts='{dede:',$ftend='{/dede:',$stend='/}',$tend='}') + function SetTagStyle($ts = '{dede:', $ftend = '{/dede:', $stend = '/}', $tend = '}') { $this->tagStartWord = $ts; $this->fullTagEndWord = $ftend; @@ -338,53 +314,46 @@ class DedeTemplate */ function LoadTemplate($tmpfile) { - if(!file_exists($tmpfile)) - { + if (!file_exists($tmpfile)) { echo " Template Not Found! "; exit(); } $tmpfile = preg_replace("/[\\/]{1,}/", "/", $tmpfile); - $tmpfiles = explode('/',$tmpfile); + $tmpfiles = explode('/', $tmpfile); $tmpfileOnlyName = preg_replace("/(.*)\//", "", $tmpfile); $this->templateFile = $tmpfile; $this->refDir = ''; - for($i=0; $i < count($tmpfiles)-1; $i++) - { - $this->refDir .= $tmpfiles[$i].'/'; + for ($i = 0; $i < count($tmpfiles) - 1; $i++) { + $this->refDir .= $tmpfiles[$i] . '/'; } - if(!is_dir($this->cacheDir)) - { + if (!is_dir($this->cacheDir)) { $this->cacheDir = $this->refDir; } - if($this->cacheDir!='') - { - $this->cacheDir = $this->cacheDir.'/'; + if ($this->cacheDir != '') { + $this->cacheDir = $this->cacheDir . '/'; } - if(isset($GLOBALS['_DEBUG_CACHE'])) - { + if (isset($GLOBALS['_DEBUG_CACHE'])) { $this->cacheDir = $this->refDir; } - $this->cacheFile = $this->cacheDir.preg_replace("/\.(wml|html|htm|php)$/", "_".$this->GetEncodeStr($tmpfile).'.inc', $tmpfileOnlyName); - $this->configFile = $this->cacheDir.preg_replace("/\.(wml|html|htm|php)$/", "_".$this->GetEncodeStr($tmpfile).'_config.inc', $tmpfileOnlyName); + $this->cacheFile = $this->cacheDir . preg_replace("/\.(wml|html|htm|php)$/", "_" . $this->GetEncodeStr($tmpfile) . '.inc', $tmpfileOnlyName); + $this->configFile = $this->cacheDir . preg_replace("/\.(wml|html|htm|php)$/", "_" . $this->GetEncodeStr($tmpfile) . '_config.inc', $tmpfileOnlyName); //不开启缓存、当缓存文件不存在、及模板为更新的文件的时候才载入模板并进行解析 - if($this->isCache==FALSE || !file_exists($this->cacheFile) - || filemtime($this->templateFile) > filemtime($this->cacheFile)) - { + if ( + $this->isCache == FALSE || !file_exists($this->cacheFile) + || filemtime($this->templateFile) > filemtime($this->cacheFile) + ) { $t1 = ExecTime(); //debug - $fp = fopen($this->templateFile,'r'); - $this->sourceString = fread($fp,filesize($this->templateFile)); + $fp = fopen($this->templateFile, 'r'); + $this->sourceString = fread($fp, filesize($this->templateFile)); fclose($fp); $this->ParseTemplate(); //模板解析时间 //echo ExecTime() - $t1; - } - else - { + } else { //如果存在config文件,则载入此文件,该文件用于保存 $this->tpCfgs的内容,以供扩展用途 //模板中用{tag:config name='' value=''/}来设定该值 - if(file_exists($this->configFile)) - { + if (file_exists($this->configFile)) { include($this->configFile); } } @@ -397,12 +366,12 @@ class DedeTemplate * @param string $str 模板字符串 * @return void */ - function LoadString($str='') + function LoadString($str = '') { $this->sourceString = $str; $hashcode = md5($this->sourceString); - $this->cacheFile = $this->cacheDir."/string_".$hashcode.".inc"; - $this->configFile = $this->cacheDir."/string_".$hashcode."_config.inc"; + $this->cacheFile = $this->cacheDir . "/string_" . $hashcode . ".inc"; + $this->configFile = $this->cacheDir . "/string_" . $hashcode . "_config.inc"; $this->ParseTemplate(); } @@ -450,8 +419,8 @@ class DedeTemplate include $this->cacheFile; $okstr = ob_get_contents(); ob_end_clean(); - $fp = @fopen($savefile,"w") or die(" Tag Engine Create File FALSE! "); - fwrite($fp,$okstr); + $fp = @fopen($savefile, "w") or die(" Tag Engine Create File FALSE! "); + fwrite($fp, $okstr); fclose($fp); } @@ -466,22 +435,19 @@ class DedeTemplate * @param string * @return bool */ - function CheckDisabledFunctions($str,&$errmsg='') + function CheckDisabledFunctions($str, &$errmsg = '') { global $cfg_disable_funs; - $cfg_disable_funs = isset($cfg_disable_funs)? $cfg_disable_funs : 'phpinfo,eval,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,file_put_contents,fsockopen,fopen,fwrite'; + $cfg_disable_funs = isset($cfg_disable_funs) ? $cfg_disable_funs : 'phpinfo,eval,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,file_put_contents,fsockopen,fopen,fwrite'; // 模板引擎增加disable_functions if (!defined('DEDEDISFUN')) { $tokens = token_get_all_nl($str); $disabled_functions = explode(',', $cfg_disable_funs); - foreach ($tokens as $token) - { - if (is_array($token)) - { - if ($token[0] = '306' && in_array($token[1], $disabled_functions)) - { - $errmsg = 'DedeCMS Error:function disabled "'.$token[1].'" more...'; - return FALSE; + foreach ($tokens as $token) { + if (is_array($token)) { + if ($token[0] = '306' && in_array($token[1], $disabled_functions)) { + $errmsg = 'DedeBIZ Error:function disabled "' . $token[1] . '" more...'; + return FALSE; } } } @@ -496,42 +462,39 @@ class DedeTemplate * @param string $ctype 缓存类型 * @return void */ - function WriteCache($ctype='all') + function WriteCache($ctype = 'all') { - if(!file_exists($this->cacheFile) || $this->isCache==FALSE - || ( file_exists($this->templateFile) && (filemtime($this->templateFile) > filemtime($this->cacheFile)) ) ) - { - if(!$this->isParse) - { - $this->ParseTemplate(); - } - $fp = fopen($this->cacheFile,'w') or dir("Write Cache File Error! "); - flock($fp,3); - $result = trim($this->GetResult()); - $errmsg = ''; - //var_dump($result);exit(); - if (!$this->CheckDisabledFunctions($result, $errmsg)) - { - fclose($fp); - @unlink($this->cacheFile); - die($errmsg); - } - fwrite($fp,$result); + if ( + !file_exists($this->cacheFile) || $this->isCache == FALSE + || (file_exists($this->templateFile) && (filemtime($this->templateFile) > filemtime($this->cacheFile))) + ) { + if (!$this->isParse) { + $this->ParseTemplate(); + } + $fp = fopen($this->cacheFile, 'w') or dir("Write Cache File Error! "); + flock($fp, 3); + $result = trim($this->GetResult()); + $errmsg = ''; + //var_dump($result);exit(); + if (!$this->CheckDisabledFunctions($result, $errmsg)) { fclose($fp); - if(count($this->tpCfgs) > 0) - { - $fp = fopen($this->configFile,'w') or dir("Write Config File Error! "); - flock($fp,3); - fwrite($fp,'<'.'?php'."\r\n"); - foreach($this->tpCfgs as $k=>$v) - { - $v = str_replace("\"","\\\"",$v); - $v = str_replace("\$","\\\$",$v); - fwrite($fp,"\$this->tpCfgs['$k']=\"$v\";\r\n"); - } - fwrite($fp,'?'.'>'); - fclose($fp); + @unlink($this->cacheFile); + die($errmsg); + } + fwrite($fp, $result); + fclose($fp); + if (count($this->tpCfgs) > 0) { + $fp = fopen($this->configFile, 'w') or dir("Write Config File Error! "); + flock($fp, 3); + fwrite($fp, '<' . '?php' . "\r\n"); + foreach ($this->tpCfgs as $k => $v) { + $v = str_replace("\"", "\\\"", $v); + $v = str_replace("\$", "\\\$", $v); + fwrite($fp, "\$this->tpCfgs['$k']=\"$v\";\r\n"); } + fwrite($fp, '?' . '>'); + fclose($fp); + } } /* if(!file_exists($this->cacheFile) || $this->isCache==FALSE @@ -597,7 +560,7 @@ class DedeTemplate function GetEncodeStr($tmpfile) { //$tmpfiles = explode('/',$tmpfile); - $encodeStr = substr(md5($tmpfile),0,24); + $encodeStr = substr(md5($tmpfile), 0, 24); return $encodeStr; } @@ -609,9 +572,8 @@ class DedeTemplate */ function ParseTemplate() { - if($this->makeLoop > 5) - { - return ; + if ($this->makeLoop > 5) { + return; } $this->count = -1; $this->cTags = array(); @@ -624,8 +586,7 @@ class DedeTemplate $tagEndWord = $this->tagEndWord; $startWordLen = strlen($tagStartWord); $sourceLen = strlen($this->sourceString); - if( $sourceLen <= ($startWordLen + 3) ) - { + if ($sourceLen <= ($startWordLen + 3)) { return; } $cAtt = new TagAttributeParse(); @@ -636,87 +597,71 @@ class DedeTemplate $preTag = ''; $tswLen = strlen($tagStartWord); @$cAtt->cAttributes->items = array(); - for($i=0; $i<$sourceLen; $i++) - { + for ($i = 0; $i < $sourceLen; $i++) { $ttagName = ''; //如果不进行此判断,将无法识别相连的两个标记 - if($i-1>=0) - { - $ss = $i-1; - } - else - { + if ($i - 1 >= 0) { + $ss = $i - 1; + } else { $ss = 0; } - $tagPos = strpos($this->sourceString,$tagStartWord,$ss); + $tagPos = strpos($this->sourceString, $tagStartWord, $ss); //判断后面是否还有模板标记 - if($tagPos==0 && ($sourceLen-$i < $tswLen - || substr($this->sourceString,$i,$tswLen)!=$tagStartWord )) - { + if ($tagPos == 0 && ($sourceLen - $i < $tswLen + || substr($this->sourceString, $i, $tswLen) != $tagStartWord)) { $tagPos = -1; break; } //获取TAG基本信息 - for($j = $tagPos+$startWordLen; $j < $tagPos+$startWordLen+$this->tagMaxLen; $j++) - { - if(preg_match("/[ >\/\r\n\t\}\.]/", $this->sourceString[$j])) - { + for ($j = $tagPos + $startWordLen; $j < $tagPos + $startWordLen + $this->tagMaxLen; $j++) { + if (preg_match("/[ >\/\r\n\t\}\.]/", $this->sourceString[$j])) { break; - } - else - { + } else { $ttagName .= $this->sourceString[$j]; } } - if($ttagName!='') - { + if ($ttagName != '') { $i = $tagPos + $startWordLen; $endPos = -1; //判断 '/}' '{tag:下一标记开始' '{/tag:标记结束' 谁最靠近 - $fullTagEndWordThis = $fullTagEndWord.$ttagName.$tagEndWord; + $fullTagEndWordThis = $fullTagEndWord . $ttagName . $tagEndWord; $e1 = strpos($this->sourceString, $sTagEndWord, $i); $e2 = strpos($this->sourceString, $tagStartWord, $i); $e3 = strpos($this->sourceString, $fullTagEndWordThis, $i); - $e1 = trim($e1); $e2 = trim($e2); $e3 = trim($e3); - $e1 = ($e1=='' ? '-1' : $e1); - $e2 = ($e2=='' ? '-1' : $e2); - $e3 = ($e3=='' ? '-1' : $e3); - if($e3==-1) - { + $e1 = trim($e1); + $e2 = trim($e2); + $e3 = trim($e3); + $e1 = ($e1 == '' ? '-1' : $e1); + $e2 = ($e2 == '' ? '-1' : $e2); + $e3 = ($e3 == '' ? '-1' : $e3); + if ($e3 == -1) { //不存在'{/tag:标记' $endPos = $e1; $elen = $endPos + strlen($sTagEndWord); - } - else if($e1==-1) - { + } else if ($e1 == -1) { //不存在 '/}' $endPos = $e3; $elen = $endPos + strlen($fullTagEndWordThis); } //同时存在 '/}' 和 '{/tag:标记' - else - { + else { //如果 '/}' 比 '{tag:'、'{/tag:标记' 都要靠近,则认为结束标志是 '/}',否则结束标志为 '{/tag:标记' - if($e1 < $e2 && $e1 < $e3 ) - { + if ($e1 < $e2 && $e1 < $e3) { $endPos = $e1; $elen = $endPos + strlen($sTagEndWord); - } - else - { + } else { $endPos = $e3; $elen = $endPos + strlen($fullTagEndWordThis); } } //如果找不到结束标记,则认为这个标记存在错误 - if($endPos==-1) - { + if ($endPos == -1) { echo "Tpl Character postion $tagPos, '$ttagName' Error!
      \r\n"; break; } @@ -726,45 +671,37 @@ class DedeTemplate $attStr = ''; $innerText = ''; $startInner = 0; - for($j = $tagPos+$startWordLen; $j < $endPos; $j++) - { - if($startInner==0) - { - if($this->sourceString[$j]==$tagEndWord) - { - $startInner=1; continue; - } - else - { + for ($j = $tagPos + $startWordLen; $j < $endPos; $j++) { + if ($startInner == 0) { + if ($this->sourceString[$j] == $tagEndWord) { + $startInner = 1; + continue; + } else { $attStr .= $this->sourceString[$j]; } - } - else - { + } else { $innerText .= $this->sourceString[$j]; } } $ttagName = strtolower($ttagName); //if、php标记,把整个属性串视为属性 - if(preg_match("/^if[0-9]{0,}$/", $ttagName)) - { + if (preg_match("/^if[0-9]{0,}$/", $ttagName)) { $cAtt->cAttributes = new TagAttribute(); $cAtt->cAttributes->count = 2; $cAtt->cAttributes->items['tagname'] = $ttagName; $cAtt->cAttributes->items['condition'] = preg_replace("/^if[0-9]{0,}[\r\n\t ]/", "", $attStr); - $innerText = preg_replace("/\{else\}/i", '<'."?php\r\n}\r\nelse{\r\n".'?'.'>', $innerText); - } - else if($ttagName=='php') - { + $innerText = preg_replace("/\{else\}/i", '<' . "?php\r\n}\r\nelse{\r\n" . '?' . '>', $innerText); + } else if ($ttagName == 'php') { $cAtt->cAttributes = new TagAttribute(); $cAtt->cAttributes->count = 2; $cAtt->cAttributes->items['tagname'] = $ttagName; - $cAtt->cAttributes->items['code'] = '<'."?php\r\n".trim(preg_replace("/^php[0-9]{0,}[\r\n\t ]/", - "",$attStr))."\r\n?".'>'; - } - else - { + $cAtt->cAttributes->items['code'] = '<' . "?php\r\n" . trim(preg_replace( + "/^php[0-9]{0,}[\r\n\t ]/", + "", + $attStr + )) . "\r\n?" . '>'; + } else { //普通标记,解释属性 $cAtt->SetSource($attStr); } @@ -778,15 +715,12 @@ class DedeTemplate $cTag->tagID = $this->count; $cTag->innerText = $innerText; $this->cTags[$this->count] = $cTag; - } - else - { - $i = $tagPos+$startWordLen; + } else { + $i = $tagPos + $startWordLen; break; } - }//结束遍历模板字符串 - if( $this->count > -1 && $this->isCompiler ) - { + } //结束遍历模板字符串 + if ($this->count > -1 && $this->isCompiler) { $this->CompilerAll(); } } @@ -801,22 +735,19 @@ class DedeTemplate function CompilerAll() { $this->loopNum++; - if($this->loopNum > 10) - { + if ($this->loopNum > 10) { return; //限制最大递归深度为 10 以防止因标记出错等可能性导致死循环 } $ResultString = ''; $nextTagEnd = 0; - for($i=0; isset($this->cTags[$i]); $i++) - { + for ($i = 0; isset($this->cTags[$i]); $i++) { $ResultString .= substr($this->sourceString, $nextTagEnd, $this->cTags[$i]->startPos - $nextTagEnd); $ResultString .= $this->CompilerOneTag($this->cTags[$i]); $nextTagEnd = $this->cTags[$i]->endPos; } $slen = strlen($this->sourceString); - if($slen > $nextTagEnd) - { - $ResultString .= substr($this->sourceString,$nextTagEnd,$slen-$nextTagEnd); + if ($slen > $nextTagEnd) { + $ResultString .= substr($this->sourceString, $nextTagEnd, $slen - $nextTagEnd); } $this->sourceString = $ResultString; $this->ParseTemplate(); @@ -831,13 +762,12 @@ class DedeTemplate */ function GetResult() { - if(!$this->isParse) - { + if (!$this->isParse) { $this->ParseTemplate(); } $addset = ''; - $addset .= '<'.'?php'."\r\n".'if(!isset($GLOBALS[\'_vars\'])) $GLOBALS[\'_vars\'] = array(); '."\r\n".'$fields = array();'."\r\n".'?'.'>'; - return preg_replace("/\?".">[ \r\n\t]{0,}<"."\?php/", "", $addset.$this->sourceString); + $addset .= '<' . '?php' . "\r\n" . 'if(!isset($GLOBALS[\'_vars\'])) $GLOBALS[\'_vars\'] = array(); ' . "\r\n" . '$fields = array();' . "\r\n" . '?' . '>'; + return preg_replace("/\?" . ">[ \r\n\t]{0,}<" . "\?php/", "", $addset . $this->sourceString); } /** @@ -856,222 +786,163 @@ class DedeTemplate //用于在模板中设置一个变量以提供作扩展用途 //此变量直接提交到 this->tpCfgs 中,并会生成与模板对应的缓存文件 ***_config.php 文件 - if( $tagname == 'config' ) - { + if ($tagname == 'config') { $this->tpCfgs[$varname] = $cTag->GetAtt('value'); - } - else if( $tagname == 'global' ) - { - $cTag->tagValue = $this->CompilerArrayVar('global',$varname); - if( $cTag->GetAtt('function') != '' ) - { + } else if ($tagname == 'global') { + $cTag->tagValue = $this->CompilerArrayVar('global', $varname); + if ($cTag->GetAtt('function') != '') { $cTag->tagValue = $this->CompilerFunction($cTag->GetAtt('function'), $cTag->tagValue); } - $cTag->tagValue = '<'.'?php echo '.$cTag->tagValue.'; ?'.'>'; - } - else if( $tagname == 'cfg' ) - { - $cTag->tagValue = '$GLOBALS[\'cfg_'.$varname.'\']'; //处理函数 - if( $cTag->GetAtt('function')!='' ) - { + $cTag->tagValue = '<' . '?php echo ' . $cTag->tagValue . '; ?' . '>'; + } else if ($tagname == 'cfg') { + $cTag->tagValue = '$GLOBALS[\'cfg_' . $varname . '\']'; //处理函数 + if ($cTag->GetAtt('function') != '') { $cTag->tagValue = $this->CompilerFunction($cTag->GetAtt('function'), $cTag->tagValue); } - $cTag->tagValue = '<'.'?php echo '.$cTag->tagValue.'; ?'.'>'; - } - else if( $tagname == 'name' ) - { - $cTag->tagValue = '$'.$varname; //处理函数 - if( $cTag->GetAtt('function')!='' ) - { + $cTag->tagValue = '<' . '?php echo ' . $cTag->tagValue . '; ?' . '>'; + } else if ($tagname == 'name') { + $cTag->tagValue = '$' . $varname; //处理函数 + if ($cTag->GetAtt('function') != '') { $cTag->tagValue = $this->CompilerFunction($cTag->GetAtt('function'), $cTag->tagValue); } - $cTag->tagValue = '<'.'?php echo '.$cTag->tagValue.'; ?'.'>'; - } - else if( $tagname == 'object' ) - { - list($_obs,$_em) = explode('->',$varname); + $cTag->tagValue = '<' . '?php echo ' . $cTag->tagValue . '; ?' . '>'; + } else if ($tagname == 'object') { + list($_obs, $_em) = explode('->', $varname); $cTag->tagValue = "\$GLOBALS['{$_obs}']->{$_em}"; //处理函数 - if( $cTag->GetAtt('function')!='' ) - { + if ($cTag->GetAtt('function') != '') { $cTag->tagValue = $this->CompilerFunction($cTag->GetAtt('function'), $cTag->tagValue); } - $cTag->tagValue = '<'.'?php echo '.$cTag->tagValue.'; ?'.'>'; - } - else if($tagname == 'var') - { + $cTag->tagValue = '<' . '?php echo ' . $cTag->tagValue . '; ?' . '>'; + } else if ($tagname == 'var') { $cTag->tagValue = $this->CompilerArrayVar('var', $varname); - if( $cTag->GetAtt('function')!='' ) - { + if ($cTag->GetAtt('function') != '') { $cTag->tagValue = $this->CompilerFunction($cTag->GetAtt('function'), $cTag->tagValue); } // 增加默认空值处理 - if ($cTag->GetAtt('default')!='') - { - $cTag->tagValue = '<'.'?php echo empty('.$cTag->tagValue.')? \''.addslashes($cTag->GetAtt('default')).'\':'.$cTag->tagValue.'; ?'.'>'; + if ($cTag->GetAtt('default') != '') { + $cTag->tagValue = '<' . '?php echo empty(' . $cTag->tagValue . ')? \'' . addslashes($cTag->GetAtt('default')) . '\':' . $cTag->tagValue . '; ?' . '>'; } else { - $cTag->tagValue = '<'.'?php echo '.$cTag->tagValue.'; ?'.'>'; + $cTag->tagValue = '<' . '?php echo ' . $cTag->tagValue . '; ?' . '>'; } - } - else if($tagname == 'field') - { - $cTag->tagValue = '$fields[\''.$varname.'\']'; - if( $cTag->GetAtt('function')!='' ) - { + } else if ($tagname == 'field') { + $cTag->tagValue = '$fields[\'' . $varname . '\']'; + if ($cTag->GetAtt('function') != '') { $cTag->tagValue = $this->CompilerFunction($cTag->GetAtt('function'), $cTag->tagValue); } - $cTag->tagValue = '<'.'?php echo '.$cTag->tagValue.'; ?'.'>'; - } - else if( preg_match("/^key[0-9]{0,}/", $tagname) || preg_match("/^value[0-9]{0,}/", $tagname)) - { - if( preg_match("/^value[0-9]{0,}/", $tagname) && $varname!='' ) - { - $cTag->tagValue = '<'.'?php echo '.$this->CompilerArrayVar($tagname,$varname).'; ?'.'>'; - } - else - { - $cTag->tagValue = '<'.'?php echo $'.$tagname.'; ?'.'>'; + $cTag->tagValue = '<' . '?php echo ' . $cTag->tagValue . '; ?' . '>'; + } else if (preg_match("/^key[0-9]{0,}/", $tagname) || preg_match("/^value[0-9]{0,}/", $tagname)) { + if (preg_match("/^value[0-9]{0,}/", $tagname) && $varname != '') { + $cTag->tagValue = '<' . '?php echo ' . $this->CompilerArrayVar($tagname, $varname) . '; ?' . '>'; + } else { + $cTag->tagValue = '<' . '?php echo $' . $tagname . '; ?' . '>'; } - } - else if( preg_match("/^if[0-9]{0,}$/", $tagname) ) - { + } else if (preg_match("/^if[0-9]{0,}$/", $tagname)) { $cTag->tagValue = $this->CompilerIf($cTag); - } - else if( $tagname=='echo' ) - { - if(trim($cTag->GetInnerText())=='') $cTag->tagValue = $cTag->GetAtt('code'); - else - { - $cTag->tagValue = '<'."?php echo $".trim($cTag->GetInnerText())." ;?".'>'; + } else if ($tagname == 'echo') { + if (trim($cTag->GetInnerText()) == '') $cTag->tagValue = $cTag->GetAtt('code'); + else { + $cTag->tagValue = '<' . "?php echo $" . trim($cTag->GetInnerText()) . " ;?" . '>'; } - } - else if( $tagname=='php' ) - { - if(trim($cTag->GetInnerText())=='') $cTag->tagValue = $cTag->GetAtt('code'); - else - { - $cTag->tagValue = '<'."?php\r\n".trim($cTag->GetInnerText())."\r\n?".'>'; + } else if ($tagname == 'php') { + if (trim($cTag->GetInnerText()) == '') $cTag->tagValue = $cTag->GetAtt('code'); + else { + $cTag->tagValue = '<' . "?php\r\n" . trim($cTag->GetInnerText()) . "\r\n?" . '>'; } } //遍历数组 - else if( preg_match("/^array[0-9]{0,}/",$tagname) ) - { + else if (preg_match("/^array[0-9]{0,}/", $tagname)) { $kk = '$key'; $vv = '$value'; - if($cTag->GetAtt('key')!='') - { - $kk = '$key'.$cTag->GetAtt('key'); + if ($cTag->GetAtt('key') != '') { + $kk = '$key' . $cTag->GetAtt('key'); } - if($cTag->GetAtt('value')!='') - { - $vv = '$value'.$cTag->GetAtt('value'); + if ($cTag->GetAtt('value') != '') { + $vv = '$value' . $cTag->GetAtt('value'); } $addvar = ''; - if(!preg_match("/\(/",$varname)) - { - $varname = '$GLOBALS[\''.$varname.'\']'; - } - else - { - $addvar = "\r\n".'$myarrs = $pageClass->'.$varname.";\r\n"; + if (!preg_match("/\(/", $varname)) { + $varname = '$GLOBALS[\'' . $varname . '\']'; + } else { + $addvar = "\r\n" . '$myarrs = $pageClass->' . $varname . ";\r\n"; $varname = ' $myarrs '; } - $rsvalue = '<'.'?php '.$addvar.' foreach('.$varname.' as '.$kk.'=>'.$vv.'){ ?'.">"; + $rsvalue = '<' . '?php ' . $addvar . ' foreach(' . $varname . ' as ' . $kk . '=>' . $vv . '){ ?' . ">"; $rsvalue .= $cTag->GetInnerText(); - $rsvalue .= '<'.'?php } ?'.">\r\n"; + $rsvalue .= '<' . '?php } ?' . ">\r\n"; $cTag->tagValue = $rsvalue; } //include 文件 - else if($tagname == 'include') - { + else if ($tagname == 'include') { $filename = $cTag->GetAtt('file'); - if($filename=='') - { + if ($filename == '') { $filename = $cTag->GetAtt('filename'); } $cTag->tagValue = $this->CompilerInclude($filename, FALSE); - if($cTag->tagValue==0) $cTag->tagValue = ''; - $cTag->tagValue = '<'.'?php include $this->CompilerInclude("'.$filename.'");'."\r\n".' ?'.'>'; - } - else if( $tagname=='label' ) - { + if ($cTag->tagValue == 0) $cTag->tagValue = ''; + $cTag->tagValue = '<' . '?php include $this->CompilerInclude("' . $filename . '");' . "\r\n" . ' ?' . '>'; + } else if ($tagname == 'label') { $bindFunc = $cTag->GetAtt('bind'); - $rsvalue = 'echo '.$bindFunc.";\r\n"; - $rsvalue = '<'.'?php '.$rsvalue.' ?'.">\r\n"; + $rsvalue = 'echo ' . $bindFunc . ";\r\n"; + $rsvalue = '<' . '?php ' . $rsvalue . ' ?' . ">\r\n"; $cTag->tagValue = $rsvalue; - } - else if( $tagname=='datalist' ) - { + } else if ($tagname == 'datalist') { //生成属性数组 - foreach($cTag->cAtt->items as $k=>$v) - { + foreach ($cTag->cAtt->items as $k => $v) { $v = $this->TrimAtts($v); - $rsvalue .= '$atts[\''.$k.'\'] = \''.str_replace("'","\\'",$v)."';\r\n"; + $rsvalue .= '$atts[\'' . $k . '\'] = \'' . str_replace("'", "\\'", $v) . "';\r\n"; } - $rsvalue = '<'.'?php'."\r\n".'$atts = array();'."\r\n".$rsvalue; - $rsvalue .= '$blockValue = $this->refObj->GetArcList($atts,$this->refObj,$fields); '."\r\n"; - $rsvalue .= 'if(is_array($blockValue)){'."\r\n"; - $rsvalue .= 'foreach( $blockValue as $key=>$fields )'."\r\n{\r\n".'?'.">"; + $rsvalue = '<' . '?php' . "\r\n" . '$atts = array();' . "\r\n" . $rsvalue; + $rsvalue .= '$blockValue = $this->refObj->GetArcList($atts,$this->refObj,$fields); ' . "\r\n"; + $rsvalue .= 'if(is_array($blockValue)){' . "\r\n"; + $rsvalue .= 'foreach( $blockValue as $key=>$fields )' . "\r\n{\r\n" . '?' . ">"; $rsvalue .= $cTag->GetInnerText(); - $rsvalue .= '<'.'?php'."\r\n}\r\n}".'?'.'>'; + $rsvalue .= '<' . '?php' . "\r\n}\r\n}" . '?' . '>'; $cTag->tagValue = $rsvalue; - } - else if( $tagname=='pagelist' ) - { + } else if ($tagname == 'pagelist') { //生成属性数组 - foreach($cTag->cAtt->items as $k=>$v) - { + foreach ($cTag->cAtt->items as $k => $v) { $v = $this->TrimAtts($v); - $rsvalue .= '$atts[\''.$k.'\'] = \''.str_replace("'","\\'",$v)."';\r\n"; + $rsvalue .= '$atts[\'' . $k . '\'] = \'' . str_replace("'", "\\'", $v) . "';\r\n"; } - $rsvalue = '<'.'?php'."\r\n".'$atts = array();'."\r\n".$rsvalue; - $rsvalue .= ' echo $this->refObj->GetPageList($atts,$this->refObj,$fields); '."\r\n".'?'.">\r\n"; + $rsvalue = '<' . '?php' . "\r\n" . '$atts = array();' . "\r\n" . $rsvalue; + $rsvalue .= ' echo $this->refObj->GetPageList($atts,$this->refObj,$fields); ' . "\r\n" . '?' . ">\r\n"; $cTag->tagValue = $rsvalue; - } - else - { + } else { $bindFunc = $cTag->GetAtt('bind'); $bindType = $cTag->GetAtt('bindtype'); - $rstype = ($cTag->GetAtt('resulttype')=='' ? $cTag->GetAtt('rstype') : $cTag->GetAtt('resulttype') ); + $rstype = ($cTag->GetAtt('resulttype') == '' ? $cTag->GetAtt('rstype') : $cTag->GetAtt('resulttype')); $rstype = strtolower($rstype); //生成属性数组 - foreach($cTag->cAtt->items as $k=>$v) - { - if(preg_match("/(bind|bindtype)/i",$k)) - { + foreach ($cTag->cAtt->items as $k => $v) { + if (preg_match("/(bind|bindtype)/i", $k)) { continue; } $v = $this->TrimAtts($v); - $rsvalue .= '$atts[\''.$k.'\'] = \''.str_replace("'","\\'",$v)."';\r\n"; + $rsvalue .= '$atts[\'' . $k . '\'] = \'' . str_replace("'", "\\'", $v) . "';\r\n"; } - $rsvalue = '<'.'?php'."\r\n".'$atts = array();'."\r\n".$rsvalue; + $rsvalue = '<' . '?php' . "\r\n" . '$atts = array();' . "\r\n" . $rsvalue; //绑定到默认函数还是指定函数(datasource属性指定) - if($bindFunc=='') - { - $rsvalue .= '$blockValue = MakePublicTag($atts,$this->refObj,$fields); '."\r\n"; - } - else - { + if ($bindFunc == '') { + $rsvalue .= '$blockValue = MakePublicTag($atts,$this->refObj,$fields); ' . "\r\n"; + } else { //自定义绑定函数如果不指定 bindtype,则指向$this->refObj->绑定函数名,即是默认指向被引用的类对象 - if($bindType=='') $rsvalue .= '$blockValue = $this->refObj->'.$bindFunc.'($atts,$this->refObj,$fields); '."\r\n"; - else $rsvalue .= '$blockValue = '.$bindFunc.'($atts,$this->refObj,$fields); '."\r\n"; + if ($bindType == '') $rsvalue .= '$blockValue = $this->refObj->' . $bindFunc . '($atts,$this->refObj,$fields); ' . "\r\n"; + else $rsvalue .= '$blockValue = ' . $bindFunc . '($atts,$this->refObj,$fields); ' . "\r\n"; } //返回结果类型:默认为 array 是一个二维数组,string 是字符串 - if($rstype=='string') - { - $rsvalue .= 'echo $blockValue;'."\r\n".'?'.">"; - } - else - { - $rsvalue .= 'if(is_array($blockValue) && count($blockValue) > 0){'."\r\n"; - $rsvalue .= 'foreach( $blockValue as $key=>$fields )'."\r\n{\r\n".'?'.">"; + if ($rstype == 'string') { + $rsvalue .= 'echo $blockValue;' . "\r\n" . '?' . ">"; + } else { + $rsvalue .= 'if(is_array($blockValue) && count($blockValue) > 0){' . "\r\n"; + $rsvalue .= 'foreach( $blockValue as $key=>$fields )' . "\r\n{\r\n" . '?' . ">"; $rsvalue .= $cTag->GetInnerText(); - $rsvalue .= '<'.'?php'."\r\n}\r\n}\r\n".'?'.'>'; + $rsvalue .= '<' . '?php' . "\r\n}\r\n}\r\n" . '?' . '>'; } $cTag->tagValue = $rsvalue; } @@ -1090,70 +961,48 @@ class DedeTemplate { $okvalue = ''; - if(!preg_match("/\[/", $varname)) - { - if(preg_match("/^value/",$vartype)) - { - $varname = $vartype.'.'.$varname; + if (!preg_match("/\[/", $varname)) { + if (preg_match("/^value/", $vartype)) { + $varname = $vartype . '.' . $varname; } - $varnames = explode('.',$varname); - if(isset($varnames[1])) - { + $varnames = explode('.', $varname); + if (isset($varnames[1])) { $varname = $varnames[0]; - for($i=1; isset($varnames[$i]); $i++) - { - $varname .= "['".$varnames[$i]."']"; + for ($i = 1; isset($varnames[$i]); $i++) { + $varname .= "['" . $varnames[$i] . "']"; } } } - if(preg_match("/\[/", $varname)) - { + if (preg_match("/\[/", $varname)) { $varnames = explode('[', $varname); $arrend = ''; - for($i=1;isset($varnames[$i]);$i++) - { - $arrend .= '['.$varnames[$i]; + for ($i = 1; isset($varnames[$i]); $i++) { + $arrend .= '[' . $varnames[$i]; } - if(!preg_match("/[\"']/", $arrend)) { + if (!preg_match("/[\"']/", $arrend)) { $arrend = str_replace('[', '', $arrend); $arrend = str_replace(']', '', $arrend); $arrend = "['{$arrend}']"; } - if($vartype=='var') - { - $okvalue = '$GLOBALS[\'_vars\'][\''.$varnames[0].'\']'.$arrend; - } - else if( preg_match("/^value/", $vartype) ) - { - $okvalue = '$'.$varnames[0].$arrend; - } - else if($vartype=='field') - { - $okvalue = '$fields[\''.$varnames[0].'\']'.$arrend; - } - else - { - $okvalue = '$GLOBALS[\''.$varnames[0].'\']'.$arrend; - } - } - else - { - if($vartype=='var') - { - $okvalue = '$GLOBALS[\'_vars\'][\''.$varname.'\']'; - } - else if( preg_match("/^value/",$vartype) ) - { - $okvalue = '$'.$vartype; - } - else if($vartype=='field') - { - $okvalue = '$'.str_replace($varname); + if ($vartype == 'var') { + $okvalue = '$GLOBALS[\'_vars\'][\'' . $varnames[0] . '\']' . $arrend; + } else if (preg_match("/^value/", $vartype)) { + $okvalue = '$' . $varnames[0] . $arrend; + } else if ($vartype == 'field') { + $okvalue = '$fields[\'' . $varnames[0] . '\']' . $arrend; + } else { + $okvalue = '$GLOBALS[\'' . $varnames[0] . '\']' . $arrend; } - else - { - $okvalue = '$GLOBALS[\''.$varname.'\']'; + } else { + if ($vartype == 'var') { + $okvalue = '$GLOBALS[\'_vars\'][\'' . $varname . '\']'; + } else if (preg_match("/^value/", $vartype)) { + $okvalue = '$' . $vartype; + } else if ($vartype == 'field') { + $okvalue = '$' . str_replace($varname); + } else { + $okvalue = '$GLOBALS[\'' . $varname . '\']'; } } return $okvalue; @@ -1169,18 +1018,18 @@ class DedeTemplate function CompilerIf($cTag) { $condition = trim($cTag->GetAtt('condition')); - if($condition =='') - { - $cTag->tagValue=''; return ''; + if ($condition == '') { + $cTag->tagValue = ''; + return ''; } - if (version_compare(PHP_VERSION, '5.5.0', '>=')) - { + if (version_compare(PHP_VERSION, '5.5.0', '>=')) { $condition = preg_replace_callback("/((var\.|field\.|cfg\.|global\.|key[0-9]{0,}\.|value[0-9]{0,}\.)[\._a-z0-9]+)/is", "private_rt", $condition); } else { $condition = preg_replace("/((var\.|field\.|cfg\.|global\.|key[0-9]{0,}\.|value[0-9]{0,}\.)[\._a-z0-9]+)/ies", "private_rt('\\1')", $condition); - } $rsvalue = '<'.'?php if('.$condition.'){ ?'.'>'; + } + $rsvalue = '<' . '?php if(' . $condition . '){ ?' . '>'; $rsvalue .= $cTag->GetInnerText(); - $rsvalue .= '<'.'?php } ?'.'>'; + $rsvalue .= '<' . '?php } ?' . '>'; return $rsvalue; } @@ -1193,8 +1042,8 @@ class DedeTemplate */ function TrimAtts($v) { - $v = str_replace('<'.'?','<?',$v); - $v = str_replace('?'.'>','?>',$v); + $v = str_replace('<' . '?', '<?', $v); + $v = str_replace('?' . '>', '?>', $v); return $v; } @@ -1221,23 +1070,18 @@ class DedeTemplate * @param string $isload 是否载入 * @return string */ - function CompilerInclude($filename, $isload=TRUE) + function CompilerInclude($filename, $isload = TRUE) { $okfile = ''; - if( @file_exists($filename) ) - { + if (@file_exists($filename)) { $okfile = $filename; + } else if (@file_exists($this->refDir . $filename)) { + $okfile = $this->refDir . $filename; + } else if (@file_exists($this->refDir . "../" . $filename)) { + $okfile = $this->refDir . "../" . $filename; } - else if( @file_exists($this->refDir.$filename) ) - { - $okfile = $this->refDir.$filename; - } - else if( @file_exists($this->refDir."../".$filename) ) - { - $okfile = $this->refDir."../".$filename; - } - if($okfile=='') return 0; - if( !$isload ) return 1; + if ($okfile == '') return 0; + if (!$isload) return 1; $itpl = new DedeTemplate($this->templateDir); $itpl->isCache = $this->isCache; $itpl->SetObject($this->refObj); @@ -1252,8 +1096,8 @@ class DedeTemplate * 属性的数据描述 * * @package TagAttribute - * @subpackage DedeCMS.Libraries - * @link http://www.dedecms.com + * @subpackage DedeBIZ.Libraries + * @link https://www.dedebiz.com */ class TagAttribute { @@ -1269,16 +1113,12 @@ class TagAttribute */ function GetAtt($str) { - if($str=="") - { + if ($str == "") { return ""; } - if(isset($this->items[$str])) - { + if (isset($this->items[$str])) { return $this->items[$str]; - } - else - { + } else { return ""; } } @@ -1304,7 +1144,7 @@ class TagAttribute */ function IsAttribute($str) { - if(isset($this->items[$str])) return TRUE; + if (isset($this->items[$str])) return TRUE; else return FALSE; } @@ -1327,17 +1167,17 @@ class TagAttribute */ function Getcount() { - return $this->count+1; + return $this->count + 1; } -}//End Class +} //End Class /** * 属性解析器 * function C__TagAttributeParse(); * * @package TagAttribute - * @subpackage DedeCMS.Libraries - * @link http://www.dedecms.com + * @subpackage DedeBIZ.Libraries + * @link https://www.dedebiz.com */ class TagAttributeParse { @@ -1345,14 +1185,13 @@ class TagAttributeParse var $sourceMaxSize = 1024; var $cAttributes = array(); var $charToLow = TRUE; - function SetSource($str="") + function SetSource($str = "") { $this->cAttributes = new TagAttribute(); $strLen = 0; - $this->sourceString = trim(preg_replace("/[ \r\n\t\f]{1,}/"," ",$str)); + $this->sourceString = trim(preg_replace("/[ \r\n\t\f]{1,}/", " ", $str)); $strLen = strlen($this->sourceString); - if($strLen>0 && $strLen <= $this->sourceMaxSize) - { + if ($strLen > 0 && $strLen <= $this->sourceMaxSize) { $this->ParseAttribute(); } } @@ -1370,94 +1209,71 @@ class TagAttributeParse $tmpvalue = ''; $startdd = -1; $ddtag = ''; - $hasAttribute=FALSE; + $hasAttribute = FALSE; $strLen = strlen($this->sourceString); $this->cAttributes->items = array(); // 获得Tag的名称,解析到 cAtt->GetAtt('tagname') 中 - for($i=0; $i<$strLen; $i++) - { - if($this->sourceString[$i]==' ') - { + for ($i = 0; $i < $strLen; $i++) { + if ($this->sourceString[$i] == ' ') { $this->cAttributes->count++; $tmpvalues = explode('.', $tmpvalue); $this->cAttributes->items['tagname'] = ($this->charToLow ? strtolower($tmpvalues[0]) : $tmpvalues[0]); - if( isset($tmpvalues[2]) ) - { + if (isset($tmpvalues[2])) { $okname = $tmpvalues[1]; - for($j=2;isset($tmpvalues[$j]);$j++) - { - $okname .= "['".$tmpvalues[$j]."']"; + for ($j = 2; isset($tmpvalues[$j]); $j++) { + $okname .= "['" . $tmpvalues[$j] . "']"; } $this->cAttributes->items['name'] = $okname; - } - else if(isset($tmpvalues[1]) && $tmpvalues[1]!='') - { + } else if (isset($tmpvalues[1]) && $tmpvalues[1] != '') { $this->cAttributes->items['name'] = $tmpvalues[1]; } $tmpvalue = ''; $hasAttribute = TRUE; break; - } - else - { + } else { $tmpvalue .= $this->sourceString[$i]; } } //不存在属性列表的情况 - if(!$hasAttribute) - { + if (!$hasAttribute) { $this->cAttributes->count++; $tmpvalues = explode('.', $tmpvalue); $this->cAttributes->items['tagname'] = ($this->charToLow ? strtolower($tmpvalues[0]) : $tmpvalues[0]); - if( isset($tmpvalues[2]) ) - { + if (isset($tmpvalues[2])) { $okname = $tmpvalues[1]; - for($i=2;isset($tmpvalues[$i]);$i++) - { - $okname .= "['".$tmpvalues[$i]."']"; - } + for ($i = 2; isset($tmpvalues[$i]); $i++) { + $okname .= "['" . $tmpvalues[$i] . "']"; + } $this->cAttributes->items['name'] = $okname; - } - else if(isset($tmpvalues[1]) && $tmpvalues[1]!='') - { + } else if (isset($tmpvalues[1]) && $tmpvalues[1] != '') { $this->cAttributes->items['name'] = $tmpvalues[1]; } - return ; + return; } $tmpvalue = ''; //如果字符串含有属性值,遍历源字符串,并获得各属性 - for($i; $i<$strLen; $i++) - { + for ($i; $i < $strLen; $i++) { $d = $this->sourceString[$i]; //查找属性名称 - if($startdd==-1) - { - if($d != '=') - { + if ($startdd == -1) { + if ($d != '=') { $tmpatt .= $d; - } - else - { - if($this->charToLow) - { + } else { + if ($this->charToLow) { $tmpatt = strtolower(trim($tmpatt)); - } - else - { + } else { $tmpatt = trim($tmpatt); } - $startdd=0; + $startdd = 0; } } //查找属性的限定标志 - else if($startdd==0) - { - switch($d) - { + else if ($startdd == 0) { + switch ($d) { case ' ': break; case '\'': @@ -1474,34 +1290,28 @@ class TagAttributeParse $startdd = 1; break; } - } - else if($startdd==1) - { - if($d==$ddtag && ( isset($this->sourceString[$i-1]) && $this->sourceString[$i-1]!="\\") ) - { + } else if ($startdd == 1) { + if ($d == $ddtag && (isset($this->sourceString[$i - 1]) && $this->sourceString[$i - 1] != "\\")) { $this->cAttributes->count++; $this->cAttributes->items[$tmpatt] = trim($tmpvalue); $tmpatt = ''; $tmpvalue = ''; $startdd = -1; - } - else - { + } else { $tmpvalue .= $d; } } - }//for + } //for //最后一个属性的给值 - if($tmpatt != '') - { + if ($tmpatt != '') { $this->cAttributes->count++; $this->cAttributes->items[$tmpatt] = trim($tmpvalue); - }//print_r($this->cAttributes->items); + } //print_r($this->cAttributes->items); - }// end func + } // end func -}//End Class +} //End Class /** * 私有标签编译,主要用于if标签内的字符串解析 @@ -1517,30 +1327,23 @@ function private_rt($str) } else { $arr = explode('.', $str); } - + $rs = '$GLOBALS[\''; - if($arr[0] == 'cfg') - { - return $rs.'cfg_'.$arr[1]."']"; - } - elseif($arr[0] == 'var') - { + if ($arr[0] == 'cfg') { + return $rs . 'cfg_' . $arr[1] . "']"; + } elseif ($arr[0] == 'var') { $arr[0] = '_vars'; $rs .= implode('\'][\'', $arr); $rs .= "']"; return $rs; - } - elseif($arr[0] == 'global') - { + } elseif ($arr[0] == 'global') { unset($arr[0]); $rs .= implode('\'][\'', $arr); $rs .= "']"; return $rs; - } - else - { - if($arr[0] == 'field') $arr[0] = 'fields'; - $rs = '$'.$arr[0]."['"; + } else { + if ($arr[0] == 'field') $arr[0] = 'fields'; + $rs = '$' . $arr[0] . "['"; unset($arr[0]); $rs .= implode('\'][\'', $arr); $rs .= "']"; diff --git a/src/include/dedevote.class.php b/src/include/dedevote.class.php index 1abc4cfe..efbec037 100755 --- a/src/include/dedevote.class.php +++ b/src/include/dedevote.class.php @@ -1,21 +1,21 @@ -dsql = $GLOBALS['dsql']; $this->VoteInfos = $this->dsql->GetOne("SELECT * FROM `#@__vote` WHERE aid='$aid'"); - $this->VoteNotes = Array(); + $this->VoteNotes = array(); $this->VoteCount = 0; $this->VoteID = $aid; - if(!is_array($this->VoteInfos)) - { + if (!is_array($this->VoteInfos)) { return; } $dtp = new DedeTagParse(); $dtp->SetNameSpace("v", "<", ">"); $dtp->LoadSource($this->VoteInfos['votenote']); - if(is_array($dtp->CTags)) - { - foreach($dtp->CTags as $ctag) - { + if (is_array($dtp->CTags)) { + foreach ($dtp->CTags as $ctag) { $this->VoteNotes[$ctag->GetAtt('id')]['count'] = $ctag->GetAtt('count'); $this->VoteNotes[$ctag->GetAtt('id')]['name'] = trim($ctag->GetInnerText()); $this->VoteCount++; @@ -56,7 +53,7 @@ class DedeVote { $this->__construct($aid); } - + function Close() { } @@ -69,12 +66,9 @@ class DedeVote */ function GetTotalCount() { - if(!empty($this->VoteInfos["totalcount"])) - { + if (!empty($this->VoteInfos["totalcount"])) { return $this->VoteInfos["totalcount"]; - } - else - { + } else { return 0; } } @@ -88,8 +82,7 @@ class DedeVote */ function AddVoteCount($aid) { - if(isset($this->VoteNotes[$aid])) - { + if (isset($this->VoteNotes[$aid])) { $this->VoteNotes[$aid]['count']++; } } @@ -106,59 +99,48 @@ class DedeVote * @param string $itembgcolor 项目背景 * @return string */ - function GetVoteForm($lineheight=30,$tablewidth="100%",$titlebgcolor="#EDEDE2",$titlebackgroup="",$tablebg="#FFFFFF",$itembgcolor="#FFFFFF") + function GetVoteForm($lineheight = 30, $tablewidth = "100%", $titlebgcolor = "#EDEDE2", $titlebackgroup = "", $tablebg = "#FFFFFF", $itembgcolor = "#FFFFFF") { //省略参数 - if($lineheight=="") - { - $lineheight=24; + if ($lineheight == "") { + $lineheight = 24; } - if($tablewidth=="") - { - $tablewidth="100%"; + if ($tablewidth == "") { + $tablewidth = "100%"; } - if($titlebgcolor=="") - { - $titlebgcolor="#98C6EF"; + if ($titlebgcolor == "") { + $titlebgcolor = "#98C6EF"; } - if($titlebackgroup!="") - { - $titlebackgroup="background='$titlebackgroup'"; + if ($titlebackgroup != "") { + $titlebackgroup = "background='$titlebackgroup'"; } - if($tablebg=="") - { - $tablebg="#FFFFFF"; + if ($tablebg == "") { + $tablebg = "#FFFFFF"; } - if($itembgcolor=="") - { - $itembgcolor="#FFFFFF"; + if ($itembgcolor == "") { + $itembgcolor = "#FFFFFF"; } $items = "\r\n"; - $items .= "\r\n"; + $items .= "\r\n"; $items .= "\r\n"; - $items .= "\r\n"; - $items .= "\r\n"; - $items.="\r\n"; - if($this->VoteCount > 0) - { + $items .= "\r\n"; + $items .= "\r\n"; + $items .= "\r\n"; + if ($this->VoteCount > 0) { - foreach($this->VoteNotes as $k=>$arr) - { - if($this->VoteInfos['ismore']==0) - { - $items.="\r\n"; - } - else - { - $items.="\r\n"; + foreach ($this->VoteNotes as $k => $arr) { + if ($this->VoteInfos['ismore'] == 0) { + $items .= "\r\n"; + } else { + $items .= "\r\n"; } } $items .= "\r\n"; + $items .= "value='查看结果' onClick=window.open('" . $GLOBALS['cfg_phpurl'] . "/vote.php?dopost=view&aid=" . $this->VoteID . "'); />\r\n"; } - $items.="\r\n
      ".$this->VoteInfos['votename']."
      " . $this->VoteInfos['votename'] . "
      \r\n"; $items .= "\r\n"; $items .= "VoteID."'); />
      \r\n"; + $items .= "\r\n\r\n"; return $items; } @@ -172,100 +154,83 @@ class DedeVote */ function SaveVote($voteitem) { - global $ENV_GOBACK_URL,$file,$memberID,$row,$content; - if(empty($voteitem)) - { + global $ENV_GOBACK_URL, $file, $memberID, $row, $content; + if (empty($voteitem)) { return '你没选中任何项目!'; } $items = ''; //检查投票是否已过期 $nowtime = time(); - if($nowtime > $this->VoteInfos['endtime']) - { - - ShowMsg('投票已经过期!',$ENV_GOBACK_URL); + if ($nowtime > $this->VoteInfos['endtime']) { + + ShowMsg('投票已经过期!', $ENV_GOBACK_URL); exit(); } - if($nowtime < $this->VoteInfos['starttime']) - { - ShowMsg('投票还没有开始!',$ENV_GOBACK_URL); + if ($nowtime < $this->VoteInfos['starttime']) { + ShowMsg('投票还没有开始!', $ENV_GOBACK_URL); exit(); } - + //检测游客是否已投过票 - if(isset($_COOKIE['VOTE_MEMBER_IP'])) - { - if($_COOKIE['VOTE_MEMBER_IP'] == $_SERVER['REMOTE_ADDR']) - { - ShowMsg('您已投过票',$ENV_GOBACK_URL); + if (isset($_COOKIE['VOTE_MEMBER_IP'])) { + if ($_COOKIE['VOTE_MEMBER_IP'] == $_SERVER['REMOTE_ADDR']) { + ShowMsg('您已投过票', $ENV_GOBACK_URL); exit(); } else { - setcookie('VOTE_MEMBER_IP',$_SERVER['REMOTE_ADDR'],time()*$row['spec']*3600,'/'); + setcookie('VOTE_MEMBER_IP', $_SERVER['REMOTE_ADDR'], time() * $row['spec'] * 3600, '/'); } } else { - setcookie('VOTE_MEMBER_IP',$_SERVER['REMOTE_ADDR'],time()*$row['spec']*3600,'/'); + setcookie('VOTE_MEMBER_IP', $_SERVER['REMOTE_ADDR'], time() * $row['spec'] * 3600, '/'); } //检查用户是否已投过票 $nowtime = time(); $VoteMem = $this->dsql->GetOne("SELECT * FROM #@__vote_member WHERE voteid = '$this->VoteID' and userid='$memberID'"); - if(!empty($memberID)) - { - if(isset($VoteMem['id'])) - { - $voteday = date("Y-m-d",$VoteMem['uptime']); - $day = strtotime("-".$row['spec']." day"); - $day = date("Y-m-d",$day); - if($day < $voteday) - { - ShowMsg('在'.$row['spec'].'天内不能重复投票',$ENV_GOBACK_URL); + if (!empty($memberID)) { + if (isset($VoteMem['id'])) { + $voteday = date("Y-m-d", $VoteMem['uptime']); + $day = strtotime("-" . $row['spec'] . " day"); + $day = date("Y-m-d", $day); + if ($day < $voteday) { + ShowMsg('在' . $row['spec'] . '天内不能重复投票', $ENV_GOBACK_URL); exit(); - }else{ + } else { $query = "UPDATE #@__vote_member SET uptime='$nowtime' WHERE voteid='$this->VoteID' AND userid='$memberID'"; - if($this->dsql->ExecuteNoneQuery($query) == false) - { - ShowMsg('插入数据过程中出现错误',$ENV_GOBACK_URL); + if ($this->dsql->ExecuteNoneQuery($query) == false) { + ShowMsg('插入数据过程中出现错误', $ENV_GOBACK_URL); exit(); } } - }else{ + } else { $query = "INSERT INTO #@__vote_member(id,voteid,userid,uptime) VALUES('','$this->VoteID','$memberID','$nowtime')"; - if($this->dsql->ExecuteNoneQuery($query) == false) - { - ShowMsg('插入数据过程中出现错误',$ENV_GOBACK_URL); + if ($this->dsql->ExecuteNoneQuery($query) == false) { + ShowMsg('插入数据过程中出现错误', $ENV_GOBACK_URL); exit(); } } } //必须存在投票项目 - if($this->VoteCount > 0) - { - foreach($this->VoteNotes as $k=>$v) - { - if($this->VoteInfos['ismore']==0) - { + if ($this->VoteCount > 0) { + foreach ($this->VoteNotes as $k => $v) { + if ($this->VoteInfos['ismore'] == 0) { //单选项 - if($voteitem == $k) - { - $this->VoteNotes[$k]['count']++; break; + if ($voteitem == $k) { + $this->VoteNotes[$k]['count']++; + break; } - } - else - { + } else { //多选项 - if(is_array($voteitem) && in_array($k,$voteitem)) - { + if (is_array($voteitem) && in_array($k, $voteitem)) { $this->VoteNotes[$k]['count']++; } } } - foreach($this->VoteNotes as $k=>$arr) - { - $items .= "".$arr['name']."\r\n"; + foreach ($this->VoteNotes as $k => $arr) { + $items .= "" . $arr['name'] . "\r\n"; } } - $this->dsql->ExecuteNoneQuery("UPDATE `#@__vote` SET totalcount='".($this->VoteInfos['totalcount']+1)."',votenote='".addslashes($items)."' WHERE aid='".$this->VoteID."'"); + $this->dsql->ExecuteNoneQuery("UPDATE `#@__vote` SET totalcount='" . ($this->VoteInfos['totalcount'] + 1) . "',votenote='" . addslashes($items) . "' WHERE aid='" . $this->VoteID . "'"); return "投票成功!"; } @@ -278,21 +243,19 @@ class DedeVote * @param string $tablesplit 表格分隔 * @return string */ - function GetVoteResult($tablewidth="600", $lineheight="24", $tablesplit="40%") + function GetVoteResult($tablewidth = "600", $lineheight = "24", $tablesplit = "40%") { $totalcount = $this->VoteInfos['totalcount']; - if($totalcount==0) - { - $totalcount=1; + if ($totalcount == 0) { + $totalcount = 1; } $res = "\r\n"; $res .= "\r\n"; - $i=1; - foreach($this->VoteNotes as $k=>$arr) - { - $res .= ""; + $i = 1; + foreach ($this->VoteNotes as $k => $arr) { + $res .= ""; $c = $arr['count']; - $res .= "\r\n"; + $res .= "\r\n"; $i++; } $res .= "\r\n"; diff --git a/src/include/diyform.cls.php b/src/include/diyform.cls.php index 3acd0d10..269e3b09 100755 --- a/src/include/diyform.cls.php +++ b/src/include/diyform.cls.php @@ -1,23 +1,23 @@ -__construct($diyid); } /** @@ -41,23 +42,23 @@ class diyform * @param string $diyid 自定义表单ID * @return string */ - function __construct($diyid){ + function __construct($diyid) + { $this->diyid = $diyid; $this->db = $GLOBALS['dsql']; $query = "SELECT * FROM #@__diyforms WHERE diyid='{$diyid}'"; $diyinfo = $this->db->GetOne($query); - if(!is_array($diyinfo)) - { - showMsg('参数不正确,该自定义表单不存在','javascript:;'); + if (!is_array($diyinfo)) { + showMsg('参数不正确,该自定义表单不存在', 'javascript:;'); exit(); } $this->info = $diyinfo['info']; $this->name = $diyinfo['name']; $this->table = $diyinfo['table']; $this->public = $diyinfo['public']; - $this->listTemplate = $diyinfo['listtemplate'] != '' && file_exists(DEDETEMPLATE.'/plus/'.$diyinfo['listtemplate']) ? $diyinfo['listtemplate'] : 'list_diyform.htm'; - $this->viewTemplate = $diyinfo['viewtemplate'] != '' && file_exists(DEDETEMPLATE.'/plus/'.$diyinfo['viewtemplate']) ? $diyinfo['viewtemplate'] : 'view_diyform.htm';; - $this->postTemplate = $diyinfo['posttemplate'] != '' && file_exists(DEDETEMPLATE.'/plus/'.$diyinfo['posttemplate']) ? $diyinfo['posttemplate'] : 'post_diyform.htm';; + $this->listTemplate = $diyinfo['listtemplate'] != '' && file_exists(DEDETEMPLATE . '/plus/' . $diyinfo['listtemplate']) ? $diyinfo['listtemplate'] : 'list_diyform.htm'; + $this->viewTemplate = $diyinfo['viewtemplate'] != '' && file_exists(DEDETEMPLATE . '/plus/' . $diyinfo['viewtemplate']) ? $diyinfo['viewtemplate'] : 'view_diyform.htm';; + $this->postTemplate = $diyinfo['posttemplate'] != '' && file_exists(DEDETEMPLATE . '/plus/' . $diyinfo['posttemplate']) ? $diyinfo['posttemplate'] : 'post_diyform.htm';; } /** @@ -69,36 +70,30 @@ class diyform * @param string $admintype 管理类型 * @return string */ - function getForm($type = 'post', $value = '', $admintype='diy') + function getForm($type = 'post', $value = '', $admintype = 'diy') { global $cfg_cookie_encode; $dtp = new DedeTagParse(); - $dtp->SetNameSpace("field","<",">"); + $dtp->SetNameSpace("field", "<", ">"); $dtp->LoadSource($this->info); $formstring = ''; $formfields = ''; $func = $type == 'post' ? 'GetFormItem' : 'GetFormItemValue'; - if(is_array($dtp->CTags)) - { - foreach($dtp->CTags as $tagid=>$tag) - { - if($tag->GetAtt('autofield')) - { - if($type == 'post') - { - $formstring .= $func($tag,$admintype); + if (is_array($dtp->CTags)) { + foreach ($dtp->CTags as $tagid => $tag) { + if ($tag->GetAtt('autofield')) { + if ($type == 'post') { + $formstring .= $func($tag, $admintype); + } else { + $formstring .= $func($tag, dede_htmlspecialchars($value[$tag->GetName()], ENT_QUOTES), $admintype); } - else - { - $formstring .= $func($tag,dede_htmlspecialchars($value[$tag->GetName()],ENT_QUOTES),$admintype); - } - $formfields .= $formfields == '' ? $tag->GetName().','.$tag->GetAtt('type') : ';'.$tag->GetName().','.$tag->GetAtt('type'); + $formfields .= $formfields == '' ? $tag->GetName() . ',' . $tag->GetAtt('type') : ';' . $tag->GetName() . ',' . $tag->GetAtt('type'); } } } - $formstring .= "\n"; - $formstring .= ""; + $formstring .= "\n"; + $formstring .= ""; return $formstring; } @@ -111,17 +106,14 @@ class diyform function getFieldList() { $dtp = new DedeTagParse(); - $dtp->SetNameSpace("field","<",">"); + $dtp->SetNameSpace("field", "<", ">"); $dtp->LoadSource($this->info); $fields = array(); - if(is_array($dtp->CTags)) - { - foreach($dtp->CTags as $tagid=>$tag) - { + if (is_array($dtp->CTags)) { + foreach ($dtp->CTags as $tagid => $tag) { $fields[$tag->GetName()] = array($tag->GetAtt('itemname'), $tag->GetAtt('type')); } } return $fields; } - }//End Class \ No newline at end of file diff --git a/src/include/downmix.inc.php b/src/include/downmix.inc.php index 30c03a4d..1db755ad 100755 --- a/src/include/downmix.inc.php +++ b/src/include/downmix.inc.php @@ -1,13 +1,14 @@ SetQuery("SELECT egroup FROM `#@__sys_enum` GROUP BY egroup "); - } - else { + } else { $dsql->SetQuery("SELECT egroup FROM `#@__sys_enum` WHERE egroup='$egroup' GROUP BY egroup "); } $dsql->Execute('enum'); - while($nrow = $dsql->GetArray('enum')) { + while ($nrow = $dsql->GetArray('enum')) { $egroups[] = $nrow['egroup']; } - foreach($egroups as $egroup) - { - $cachefile = DEDEDATA.'/enums/'.$egroup.'.php'; - $fp = fopen($cachefile,'w'); - fwrite($fp,'<'."?php\r\nglobal \$em_{$egroup}s;\r\n\$em_{$egroup}s = array();\r\n"); + foreach ($egroups as $egroup) { + $cachefile = DEDEDATA . '/enums/' . $egroup . '.php'; + $fp = fopen($cachefile, 'w'); + fwrite($fp, '<' . "?php\r\nglobal \$em_{$egroup}s;\r\n\$em_{$egroup}s = array();\r\n"); $dsql->SetQuery("SELECT ename,evalue,issign FROM `#@__sys_enum` WHERE egroup='$egroup' ORDER BY disorder ASC, evalue ASC "); $dsql->Execute('enum'); $issign = -1; $tenum = false; //三级联动标识 - while($nrow = $dsql->GetArray('enum')) - { - fwrite($fp,"\$em_{$egroup}s['{$nrow['evalue']}'] = '{$nrow['ename']}';\r\n"); - if($issign==-1) $issign = $nrow['issign']; - if($nrow['issign']==2) $tenum = true; + while ($nrow = $dsql->GetArray('enum')) { + fwrite($fp, "\$em_{$egroup}s['{$nrow['evalue']}'] = '{$nrow['ename']}';\r\n"); + if ($issign == -1) $issign = $nrow['issign']; + if ($nrow['issign'] == 2) $tenum = true; } if ($tenum) $dsql->ExecuteNoneQuery("UPDATE `#@__stepselect` SET `issign`=2 WHERE egroup='$egroup'; "); - fwrite($fp,'?'.'>'); + fwrite($fp, '?' . '>'); fclose($fp); - if(empty($issign)) WriteEnumsJs($egroup); + if (empty($issign)) WriteEnumsJs($egroup); } return '成功更新所有枚举缓存!'; } @@ -66,13 +63,12 @@ function WriteEnumsCache($egroup='') function GetEnumsTypes($v) { $rearr['top'] = $rearr['son'] = 0; - if($v==0) return $rearr; - if($v%500==0) { + if ($v == 0) return $rearr; + if ($v % 500 == 0) { $rearr['top'] = $v; - } - else { + } else { $rearr['son'] = $v; - $rearr['top'] = $v - ($v%500); + $rearr['top'] = $v - ($v % 500); } return $rearr; } @@ -87,27 +83,22 @@ function GetEnumsTypes($v) * @param string $seltitle 选择标题 * @return string 成功后返回一个枚举表单 */ -function GetEnumsForm($egroup, $evalue=0, $formid='', $seltitle='') +function GetEnumsForm($egroup, $evalue = 0, $formid = '', $seltitle = '') { - $cachefile = DEDEDATA.'/enums/'.$egroup.'.php'; + $cachefile = DEDEDATA . '/enums/' . $egroup . '.php'; include($cachefile); - if($formid=='') - { + if ($formid == '') { $formid = $egroup; } $forms = "\r\n"; } @@ -101,23 +98,17 @@ class OxWindow * @param string $col 显示列数 * @return void */ - function AddMsgItem($ivalue, $height="auto", $col="2") + function AddMsgItem($ivalue, $height = "auto", $col = "2") { - if($height!=""&&$height!="0") - { + if ($height != "" && $height != "0") { $height = " height='$height'"; + } else { + $height = ""; } - else - { - $height=""; - } - if($col!=""&&$col!=0) - { - $colspan="colspan='$col'"; - } - else - { - $colspan=""; + if ($col != "" && $col != 0) { + $colspan = "colspan='$col'"; + } else { + $colspan = ""; } $this->myWinItem .= "\r\n"; $this->myWinItem .= "\r\n"; @@ -132,16 +123,13 @@ class OxWindow * @param string $col 列 * @return string */ - function AddTitle($title, $col="2") + function AddTitle($title, $col = "2") { global $cfg_static_dir; - if($col!=""&&$col!="0") - { - $colspan="colspan='$col'"; - } - else - { - $colspan=""; + if ($col != "" && $col != "0") { + $colspan = "colspan='$col'"; + } else { + $colspan = ""; } $this->myWinItem .= "\r\n"; $this->myWinItem .= "\r\n"; @@ -154,14 +142,11 @@ class OxWindow * @param bool $isform * @return void */ - function CloseWin($isform=true) + function CloseWin($isform = true) { - if(!$isform) - { + if (!$isform) { $this->myWin .= "
      ".$i."、".$arr['name']."
      " . $i . "、" . $arr['name'] . "
      $ivalue
      $title
      \r\n"; - } - else - { + } else { $this->myWin .= "\r\n"; } } @@ -174,10 +159,9 @@ class OxWindow */ function SetCheckScript($scripts) { - $pos = strpos($this->myWin,$this->tmpCode); - if($pos > 0) - { - $this->myWin = substr_replace($this->myWin,$scripts,$pos,strlen($this->tmpCode)); + $pos = strpos($this->myWin, $this->tmpCode); + if ($pos > 0) { + $this->myWin = substr_replace($this->myWin, $scripts, $pos, strlen($this->tmpCode)); } } @@ -189,7 +173,7 @@ class OxWindow * @param bool $isform 是否是表单 * @return string */ - function GetWindow($wintype="save", $msg="", $isform=true) + function GetWindow($wintype = "save", $msg = "", $isform = true) { global $cfg_static_dir; $this->StartWin(); @@ -212,10 +196,8 @@ class OxWindow $tt = "保存"; break; } - if($wintype!="") - { - if($wintype!="hand") - { + if ($wintype != "") { + if ($wintype != "hand") { $this->myWin .= " @@ -228,15 +210,10 @@ class OxWindow "; - } - else - { - if($msg!='') - { + } else { + if ($msg != '') { $this->myWin .= "$msg"; - } - else - { + } else { $this->myWin .= ''; } } @@ -252,28 +229,22 @@ class OxWindow * @param string $modfile 模型模板 * @return string */ - function Display($modfile="") + function Display($modfile = "") { - global $cfg_templets_dir,$wecome_info,$cfg_basedir; - if(empty($wecome_info)) - { - $wecome_info = "DedeCMS OX 通用对话框:"; + global $cfg_templets_dir, $wecome_info, $cfg_basedir; + if (empty($wecome_info)) { + $wecome_info = "DedeBIZ OX 通用对话框:"; } $ctp = new DedeTagParse(); - if($modfile=='') - { - $ctp->LoadTemplate($cfg_basedir.$cfg_templets_dir.'/plus/win_templet.htm'); - } - else - { + if ($modfile == '') { + $ctp->LoadTemplate($cfg_basedir . $cfg_templets_dir . '/plus/win_templet.htm'); + } else { $ctp->LoadTemplate($modfile); } $emnum = $ctp->Count; - for($i=0;$i<=$emnum;$i++) - { - if(isset($GLOBALS[$ctp->CTags[$i]->GetTagName()])) - { - $ctp->Assign($i,$GLOBALS[$ctp->CTags[$i]->GetTagName()]); + for ($i = 0; $i <= $emnum; $i++) { + if (isset($GLOBALS[$ctp->CTags[$i]->GetTagName()])) { + $ctp->Assign($i, $GLOBALS[$ctp->CTags[$i]->GetTagName()]); } } $ctp->Display(); @@ -293,9 +264,9 @@ function ShowMsgWin($msg, $title) { $win = new OxWindow(); $win->Init(); - $win->mainTitle = "DedeCMS系统提示:"; + $win->mainTitle = "DedeBIZ系统提示:"; $win->AddTitle($title); $win->AddMsgItem("
      $msg
      "); $winform = $win->GetWindow("hand"); $win->Display(); -} \ No newline at end of file +} diff --git a/src/include/request.class.php b/src/include/request.class.php index e3d69b57..2ecc1080 100755 --- a/src/include/request.class.php +++ b/src/include/request.class.php @@ -1,4 +1,5 @@ isinit) - { + $GLOBALS['request'] = isset($GLOBALS['request']) ? $GLOBALS['request'] : new Request; + if (!$GLOBALS['request']->isinit) { $GLOBALS['request']->Init(); } return $GLOBALS['request']->Item($key, $df); @@ -33,7 +33,7 @@ class Request //把GET、POST的变量合并一块,相当于 _REQUEST var $forms = array(); - + //_GET 变量 var $gets = array(); @@ -45,33 +45,28 @@ class Request //文件变量 var $files = array(); - + //严禁保存的文件名 var $filter_filename = '/\.(php|pl|sh|js)$/i'; - /** - * 初始化用户请求 - * 对于 post、get 的数据,会转到 selfforms 数组, 并删除原来数组 - * 对于 cookie 的数据,会转到 cookies 数组,但不删除原来数组 - */ + /** + * 初始化用户请求 + * 对于 post、get 的数据,会转到 selfforms 数组, 并删除原来数组 + * 对于 cookie 的数据,会转到 cookies 数组,但不删除原来数组 + */ function Init() { - global $_POST,$_GET; + global $_POST, $_GET; //处理post、get $formarr = array('p' => $_POST, 'g' => $_GET); - foreach($formarr as $_k => $_r) - { - if( count($_r) > 0 ) - { - foreach($_r as $k=>$v) - { - if( preg_match('/^cfg_(.*?)/i', $k) ) - { + foreach ($formarr as $_k => $_r) { + if (count($_r) > 0) { + foreach ($_r as $k => $v) { + if (preg_match('/^cfg_(.*?)/i', $k)) { continue; } $this->forms[$k] = $v; - if( $_k=='p' ) - { + if ($_k == 'p') { $this->posts[$k] = $v; } else { $this->gets[$k] = $v; @@ -82,95 +77,85 @@ class Request unset($_POST); unset($_GET); unset($_REQUEST); - + //处理cookie - if( count($_COOKIE) > 0 ) - { - foreach($_COOKIE as $k=>$v) - { - if( preg_match('/^config/i', $k) ) - { + if (count($_COOKIE) > 0) { + foreach ($_COOKIE as $k => $v) { + if (preg_match('/^config/i', $k)) { continue; } $this->cookies[$k] = $v; } } //unset($_POST, $_GET); - + //上传的文件处理 - if( isset($_FILES) && count($_FILES) > 0 ) - { + if (isset($_FILES) && count($_FILES) > 0) { $this->FilterFiles($_FILES); } $this->isinit = TRUE; - + //global变量 //self::$forms['_global'] = $GLOBALS; } - /** - * 把 eval 重命名为 myeval - */ - function MyEval( $phpcode ) + /** + * 把 eval 重命名为 myeval + */ + function MyEval($phpcode) { - return eval( $phpcode ); + return eval($phpcode); } - /** - * 获得指定表单值 - */ - function Item( $formname, $defaultvalue = '' ) + /** + * 获得指定表单值 + */ + function Item($formname, $defaultvalue = '') { return isset($this->forms[$formname]) ? $this->forms[$formname] : $defaultvalue; } - /** - * 获得指定临时文件名值 - */ - function Upfile( $formname, $defaultvalue = '' ) + /** + * 获得指定临时文件名值 + */ + function Upfile($formname, $defaultvalue = '') { return isset($this->files[$formname]['tmp_name']) ? $this->files[$formname]['tmp_name'] : $defaultvalue; } - /** - * 过滤文件相关 - */ - function FilterFiles( &$files ) + /** + * 过滤文件相关 + */ + function FilterFiles(&$files) { - foreach($files as $k=>$v) - { + foreach ($files as $k => $v) { $this->files[$k] = $v; } unset($_FILES); } - /** - * 移动上传的文件 - */ - function MoveUploadFile( $formname, $filename, $filetype = '' ) + /** + * 移动上传的文件 + */ + function MoveUploadFile($formname, $filename, $filetype = '') { - if( $this->IsUploadFile( $formname ) ) - { - if( preg_match($this->filter_filename, $filename) ) - { + if ($this->IsUploadFile($formname)) { + if (preg_match($this->filter_filename, $filename)) { return FALSE; - } - else - { + } else { return move_uploaded_file($this->files[$formname]['tmp_name'], $filename); } } } - /** - * 获得文件的扩展名 - */ - function GetShortname( $formname ) + /** + * 获得文件的扩展名 + */ + function GetShortname($formname) { $filetype = strtolower(isset($this->files[$formname]['type']) ? $this->files[$formname]['type'] : ''); $shortname = ''; - switch($filetype) - { + switch ($filetype) { case 'image/jpeg': $shortname = 'jpg'; break; @@ -191,65 +176,54 @@ class Request break; default: $filename = isset($this->files[$formname]['name']) ? $this->files[$formname]['name'] : ''; - if( preg_match("/\./", $filename) ) - { + if (preg_match("/\./", $filename)) { $fs = explode('.', $filename); - $shortname = strtolower($fs[ count($fs)-1 ]); + $shortname = strtolower($fs[count($fs) - 1]); } break; } return $shortname; } - /** - * 获得指定文件表单的文件详细信息 - */ - function GetFileInfo( $formname, $item = '' ) + /** + * 获得指定文件表单的文件详细信息 + */ + function GetFileInfo($formname, $item = '') { - if( !isset( $this->files[$formname]['tmp_name'] ) ) - { + if (!isset($this->files[$formname]['tmp_name'])) { return FALSE; - } - else - { - if($item=='') - { + } else { + if ($item == '') { return $this->files[$formname]; - } - else - { + } else { return (isset($this->files[$formname][$item]) ? $this->files[$formname][$item] : ''); } } } - /** - * 判断是否存在上传的文件 - */ - function IsUploadFile( $formname ) + /** + * 判断是否存在上传的文件 + */ + function IsUploadFile($formname) { - if( !isset( $this->files[$formname]['tmp_name'] ) ) - { + if (!isset($this->files[$formname]['tmp_name'])) { return FALSE; - } - else - { - return is_uploaded_file( $this->files[$formname]['tmp_name'] ); + } else { + return is_uploaded_file($this->files[$formname]['tmp_name']); } } - + /** * 检查文件后缀是否为指定值 * * @param string $subfix * @return boolean */ - function CheckSubfix($formname, $subfix = 'csv') + function CheckSubfix($formname, $subfix = 'csv') { - if( $this->GetShortname( $formname ) != $subfix) - { + if ($this->GetShortname($formname) != $subfix) { return FALSE; } return TRUE; } -} \ No newline at end of file +} diff --git a/src/include/shopcar.class.php b/src/include/shopcar.class.php index 4b8a4dc5..2706d862 100755 --- a/src/include/shopcar.class.php +++ b/src/include/shopcar.class.php @@ -1,21 +1,21 @@ OrdersId = $this->getCookie("OrdersId"); - if(empty($this->OrdersId)) - { + if (empty($this->OrdersId)) { $this->OrdersId = $this->MakeOrders(); } } @@ -43,8 +42,8 @@ class MemberShops */ function MakeOrders() { - $this->OrdersId = 'S-P'.time().'RN'.mt_rand(100,999); - $this->deCrypt($this->saveCookie("OrdersId",$this->OrdersId)); + $this->OrdersId = 'S-P' . time() . 'RN' . mt_rand(100, 999); + $this->deCrypt($this->saveCookie("OrdersId", $this->OrdersId)); return $this->OrdersId; } @@ -57,8 +56,8 @@ class MemberShops */ function addItem($id, $value) { - $this->productsId = DE_ItemEcode.$id; - $this->saveCookie($this->productsId,$value); + $this->productsId = DE_ItemEcode . $id; + $this->saveCookie($this->productsId, $value); } /** @@ -69,8 +68,8 @@ class MemberShops */ function delItem($id) { - $this->productsId = DE_ItemEcode.$id; - setcookie($this->productsId, "", time()-3600000,"/"); + $this->productsId = DE_ItemEcode . $id; + setcookie($this->productsId, "", time() - 3600000, "/"); } /** @@ -80,11 +79,9 @@ class MemberShops */ function clearItem() { - foreach($_COOKIE as $key => $vals) - { - if(preg_match('/'.DE_ItemEcode.'/', $key)) - { - setcookie($key, "", time()-3600000,"/"); + foreach ($_COOKIE as $key => $vals) { + if (preg_match('/' . DE_ItemEcode . '/', $key)) { + setcookie($key, "", time() - 3600000, "/"); } } return 1; @@ -98,24 +95,20 @@ class MemberShops function getItems() { $Products = array(); - foreach($_COOKIE as $key => $vals) - { - if(preg_match("#".DE_ItemEcode."#", $key) && preg_match("#[^_0-9a-z]#", $key)) - { + foreach ($_COOKIE as $key => $vals) { + if (preg_match("#" . DE_ItemEcode . "#", $key) && preg_match("#[^_0-9a-z]#", $key)) { parse_str($this->deCrypt($vals), $arrays); $values = @array_values($arrays); - if(!empty($values)) - { + if (!empty($values)) { $arrays['price'] = sprintf("%01.2f", $arrays['price']); - if($arrays['buynum'] < 1) - { + if ($arrays['buynum'] < 1) { $arrays['buynum'] = 0; } $Products[$key] = $arrays; } } } - unset($key,$vals,$values,$arrays); + unset($key, $vals, $values, $arrays); return $Products; } @@ -127,14 +120,13 @@ class MemberShops */ function getOneItem($id) { - $key = DE_ItemEcode.$id; - if(!isset($_COOKIE[$key]) && empty($_COOKIE[$key])) - { + $key = DE_ItemEcode . $id; + if (!isset($_COOKIE[$key]) && empty($_COOKIE[$key])) { return ''; } $itemValue = $_COOKIE[$key]; parse_str($this->deCrypt($itemValue), $Products); - unset($key,$itemValue); + unset($key, $itemValue); return $Products; } @@ -148,14 +140,12 @@ class MemberShops $Products = $this->getItems(); $itemsCount = count($Products); $i = 0; - if($itemsCount > 0) - { - foreach($Products as $val) - { - $i = $i+$val['buynum']; + if ($itemsCount > 0) { + foreach ($Products as $val) { + $i = $i + $val['buynum']; } } - unset($Products,$val,$itemsCount); + unset($Products, $val, $itemsCount); return $i; } @@ -167,18 +157,15 @@ class MemberShops function priceCount() { $price = 0.00; - foreach($_COOKIE as $key => $vals) - { - if(preg_match("/".DE_ItemEcode."/", $key)) - { - $Products = $this->getOneItem(str_replace(DE_ItemEcode,"",$key)); - if($Products['buynum'] > 0 && $Products['price'] > 0) - { - $price = $price + ($Products['price']*$Products['buynum']); + foreach ($_COOKIE as $key => $vals) { + if (preg_match("/" . DE_ItemEcode . "/", $key)) { + $Products = $this->getOneItem(str_replace(DE_ItemEcode, "", $key)); + if ($Products['buynum'] > 0 && $Products['price'] > 0) { + $price = $price + ($Products['price'] * $Products['buynum']); } } } - unset($key,$vals,$Products); + unset($key, $vals, $Products); return sprintf("%01.2f", $price); } @@ -191,10 +178,10 @@ class MemberShops //解密接口字符串 function deCrypt($txt) { - return $this->mchStrCode($txt,'DECODE'); + return $this->mchStrCode($txt, 'DECODE'); } - - function mchStrCode($string, $operation = 'ENCODE') + + function mchStrCode($string, $operation = 'ENCODE') { $key_length = 4; $expiry = 0; @@ -203,17 +190,18 @@ class MemberShops $egiskeys = md5(substr($fixedkey, 16, 16)); $runtokey = $key_length ? ($operation == 'ENCODE' ? substr(md5(microtime(true)), -$key_length) : substr($string, 0, $key_length)) : ''; $keys = md5(substr($runtokey, 0, 16) . substr($fixedkey, 0, 16) . substr($runtokey, 16) . substr($fixedkey, 16)); - $string = $operation == 'ENCODE' ? sprintf('%010d', $expiry ? $expiry + time() : 0).substr(md5($string.$egiskeys), 0, 16) . $string : base64_decode(substr($string, $key_length)); + $string = $operation == 'ENCODE' ? sprintf('%010d', $expiry ? $expiry + time() : 0) . substr(md5($string . $egiskeys), 0, 16) . $string : base64_decode(substr($string, $key_length)); - $i = 0; $result = ''; + $i = 0; + $result = ''; $string_length = strlen($string); - for ($i = 0; $i < $string_length; $i++){ + for ($i = 0; $i < $string_length; $i++) { $result .= chr(ord($string[$i]) ^ ord($keys[$i % 32])); } - if($operation == 'ENCODE') { + if ($operation == 'ENCODE') { return $runtokey . str_replace('=', '', base64_encode($result)); } else { - if((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26).$egiskeys), 0, 16)) { + if ((substr($result, 0, 10) == 0 || substr($result, 0, 10) - time() > 0) && substr($result, 10, 16) == substr(md5(substr($result, 26) . $egiskeys), 0, 16)) { return substr($result, 26); } else { return ''; @@ -225,33 +213,28 @@ class MemberShops function enCode($array) { $arrayenc = array(); - foreach($array as $key => $val) - { - $arrayenc[] = $key.'='.urlencode($val); + foreach ($array as $key => $val) { + $arrayenc[] = $key . '=' . urlencode($val); } return implode('&', $arrayenc); } //创建加密的_cookie - function saveCookie($key,$value) + function saveCookie($key, $value) { - if(is_array($value)) - { + if (is_array($value)) { $value = $this->enCrypt($this->enCode($value)); - } - else - { + } else { $value = $this->enCrypt($value); } - setcookie($key,$value,time()+36000,'/'); + setcookie($key, $value, time() + 36000, '/'); } //获得解密的_cookie function getCookie($key) { - if(isset($_COOKIE[$key]) && !empty($_COOKIE[$key])) - { + if (isset($_COOKIE[$key]) && !empty($_COOKIE[$key])) { return $this->deCrypt($_COOKIE[$key]); } } -} \ No newline at end of file +} diff --git a/src/include/sitemap.class.php b/src/include/sitemap.class.php index 999142aa..b494ffa0 100755 --- a/src/include/sitemap.class.php +++ b/src/include/sitemap.class.php @@ -1,21 +1,21 @@ -idCounter = 0; $this->artDir = $GLOBALS['cfg_arcdir']; - $this->baseDir = $GLOBALS['cfg_cmspath'].$GLOBALS['cfg_basedir']; + $this->baseDir = $GLOBALS['cfg_cmspath'] . $GLOBALS['cfg_basedir']; $this->idArrary = ""; $this->dsql = $GLOBALS['dsql']; } @@ -51,30 +51,23 @@ class SiteMap * @param string $maptype 地图类型 site:站点 rss:rss * @return string */ - function GetSiteMap($maptype="site") + function GetSiteMap($maptype = "site") { $mapString = ""; - if($maptype=="rss") - { + if ($maptype == "rss") { $this->dsql->SetQuery("SELECT id,typedir,isdefault,defaultname,typename,ispart,namerule2,moresite,siteurl,sitepath FROM #@__arctype WHERE ishidden<>1 AND reid=0 AND ispart<>2 ORDER BY sortrank"); - } - else - { + } else { $this->dsql->SetQuery("SELECT id,typedir,isdefault,defaultname,typename,ispart,namerule2,siteurl,sitepath,moresite,siteurl,sitepath FROM #@__arctype WHERE reid=0 AND ishidden<>1 ORDER BY sortrank"); } $this->dsql->Execute(0); - while($row=$this->dsql->GetObject(0)) - { - if($maptype=="site") - { - $typelink = GetTypeUrl($row->id,MfTypedir($row->typedir),$row->isdefault,$row->defaultname,$row->ispart,$row->namerule2,$row->moresite,$row->siteurl,$row->sitepath); - } - else - { - $typelink = $GLOBALS['cfg_cmsurl']."/data/rss/".$row->id.".xml"; + while ($row = $this->dsql->GetObject(0)) { + if ($maptype == "site") { + $typelink = GetTypeUrl($row->id, MfTypedir($row->typedir), $row->isdefault, $row->defaultname, $row->ispart, $row->namerule2, $row->moresite, $row->siteurl, $row->sitepath); + } else { + $typelink = $GLOBALS['cfg_cmsurl'] . "/data/rss/" . $row->id . ".xml"; } - $mapString .= "
      \r\n

      ".$row->typename."

      "; - $mapString .= "\t
        \t\t\r".$this->LogicListAllSunType($row->id,$maptype)."\t\n
      \r\n"; + $mapString .= "
      \r\n

      " . $row->typename . "

      "; + $mapString .= "\t
        \t\t\r" . $this->LogicListAllSunType($row->id, $maptype) . "\t\n
      \r\n"; /* $mapString .= ""; $mapString .= "".$row->typename.""; @@ -98,28 +91,21 @@ class SiteMap { $fid = $id; $mapString = ""; - if($maptype=="rss") - { - $this->dsql->SetQuery("SELECT id,typedir,isdefault,defaultname,typename,ispart,namerule2,moresite,siteurl,sitepath FROM #@__arctype WHERE reid='".$id."' AND ishidden<>1 AND ispart<>2 ORDER BY sortrank"); - } - else - { - $this->dsql->SetQuery("SELECT id,typedir,isdefault,defaultname,typename,ispart,namerule2,moresite,siteurl,sitepath FROM #@__arctype WHERE reid='".$id."' AND ishidden<>1 ORDER BY sortrank"); + if ($maptype == "rss") { + $this->dsql->SetQuery("SELECT id,typedir,isdefault,defaultname,typename,ispart,namerule2,moresite,siteurl,sitepath FROM #@__arctype WHERE reid='" . $id . "' AND ishidden<>1 AND ispart<>2 ORDER BY sortrank"); + } else { + $this->dsql->SetQuery("SELECT id,typedir,isdefault,defaultname,typename,ispart,namerule2,moresite,siteurl,sitepath FROM #@__arctype WHERE reid='" . $id . "' AND ishidden<>1 ORDER BY sortrank"); } $this->dsql->Execute($fid); - while($row=$this->dsql->GetObject($fid)) - { - if($maptype=="site") - { - $typelink = GetTypeUrl($row->id,MfTypedir($row->typedir),$row->isdefault,$row->defaultname,$row->ispart,$row->namerule2,$row->moresite,$row->siteurl,$row->sitepath); - } - else - { - $typelink = $GLOBALS['cfg_cmsurl']."/data/rss/".$row->id.".xml"; + while ($row = $this->dsql->GetObject($fid)) { + if ($maptype == "site") { + $typelink = GetTypeUrl($row->id, MfTypedir($row->typedir), $row->isdefault, $row->defaultname, $row->ispart, $row->namerule2, $row->moresite, $row->siteurl, $row->sitepath); + } else { + $typelink = $GLOBALS['cfg_cmsurl'] . "/data/rss/" . $row->id . ".xml"; } - $mapString .= "
    • ".$row->typename."
    • \n\t\t"; - $mapString .= $this->LogicListAllSunType($row->id,$maptype); + $mapString .= "
    • " . $row->typename . "
    • \n\t\t"; + $mapString .= $this->LogicListAllSunType($row->id, $maptype); } return $mapString; } -} \ No newline at end of file +} diff --git a/src/include/splitword.class.php b/src/include/splitword.class.php index 31abba67..41d33c3c 100755 --- a/src/include/splitword.class.php +++ b/src/include/splitword.class.php @@ -8,7 +8,7 @@ * 4、对主词典使用特殊格式进行编码, 不需要载入词典到内存操作 * * @version $Id: splitword.class.php 2 11:45 2011-2-14 itplato $ - * @package DedeCMS.Libraries + * @package DedeBIZ.Libraries * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -1131,5 +1131,3 @@ class SplitWord return true; } } - -?> diff --git a/src/include/taglib/adminname.lib.php b/src/include/taglib/adminname.lib.php index b7e887ef..a8d521c5 100755 --- a/src/include/taglib/adminname.lib.php +++ b/src/include/taglib/adminname.lib.php @@ -1,15 +1,15 @@ -Fields['dutyadmin'])) - { + if (empty($refObj->Fields['dutyadmin'])) { $dutyadmin = $GLOBALS['cfg_df_dutyadmin']; - } - else - { + } else { $row = $dsql->GetOne("SELECT uname FROM `#@__admin` WHERE id='{$refObj->Fields['dutyadmin']}' "); $dutyadmin = isset($row['uname']) ? $row['uname'] : $GLOBALS['cfg_df_dutyadmin']; } return $dutyadmin; -} \ No newline at end of file +} diff --git a/src/include/taglib/arccontent.lib.php b/src/include/taglib/arccontent.lib.php index 44f37a51..5510410e 100644 --- a/src/include/taglib/arccontent.lib.php +++ b/src/include/taglib/arccontent.lib.php @@ -1,17 +1,17 @@ GetAtt('aid'); @@ -33,10 +33,9 @@ function lib_arccontent( &$ctag, &$refObj ) $asql = "WHERE id>{$refObj->Fields['id']}"; } $row = $dsql->GetOne("SELECT id,channel FROM `#@__arctiny` $asql AND arcrank>-1 AND typeid='{$refObj->Fields['typeid']}' ORDER BY id DESC"); - + $channel = new ChannelUnit($row['channel'], $refObj->Fields['id']); $fields = $dsql->GetOne("SELECT * FROM `{$channel->ChannelInfos['addtable']}` WHERE aid = {$row['id']}"); - } if (!empty($aid)) { @@ -49,21 +48,18 @@ function lib_arccontent( &$ctag, &$refObj ) $innerText = trim($ctag->GetInnerText()); $ctp = new DedeTagParse(); - $ctp->SetNameSpace('field','[',']'); + $ctp->SetNameSpace('field', '[', ']'); $ctp->LoadSource($innerText); - - if(is_array($ctp->CTags)) - { - foreach($ctp->CTags as $tagid=>$ctag) - { - if(isset($fields[$ctag->GetName()])) { - $ctp->Assign($tagid,$fields[$ctag->GetName()]); + + if (is_array($ctp->CTags)) { + foreach ($ctp->CTags as $tagid => $ctag) { + if (isset($fields[$ctag->GetName()])) { + $ctp->Assign($tagid, $fields[$ctag->GetName()]); } } $revalue .= $ctp->GetResult(); } return $revalue; - -} \ No newline at end of file +} diff --git a/src/include/taglib/arclist.lib.php b/src/include/taglib/arclist.lib.php index 97337882..7eb6f023 100755 --- a/src/include/taglib/arclist.lib.php +++ b/src/include/taglib/arclist.lib.php @@ -1,11 +1,11 @@ -GetTagName(); $channelid = $ctag->GetAtt('channelid'); - + //增加对分页内容的处理 $pagesize = $ctag->GetAtt('pagesize'); - if($pagesize == '') - { + if ($pagesize == '') { $multi = 0; } else { $tagid = $ctag->GetAtt('tagid'); @@ -40,66 +39,79 @@ function lib_arclist( &$ctag, &$refObj ) // arclist是否需要weight排序,默认为"N",如果需要排序则设置为"Y" $isweight = $ctag->GetAtt('isweight'); - if($tagname=='imglist' || $tagname=='imginfolist') { + if ($tagname == 'imglist' || $tagname == 'imginfolist') { $listtype = 'image'; - } - else if($tagname=='specart') { + } else if ($tagname == 'specart') { $channelid = -1; - $listtype=''; - } - else if($tagname=='coolart') { + $listtype = ''; + } else if ($tagname == 'coolart') { $listtype = 'commend'; - } - else if($tagname=='autolist') { + } else if ($tagname == 'autolist') { $autopartid = $ctag->GetAtt('partsort'); - } - else { + } else { $listtype = $ctag->GetAtt('type'); } //排序 - if($ctag->GetAtt('sort')!='') $orderby = $ctag->GetAtt('sort'); - else if($tagname=='hotart') $orderby = 'click'; + if ($ctag->GetAtt('sort') != '') $orderby = $ctag->GetAtt('sort'); + else if ($tagname == 'hotart') $orderby = 'click'; else $orderby = $ctag->GetAtt('orderby'); //对相应的标记使用不同的默认innertext - if(trim($ctag->GetInnerText()) != '') $innertext = $ctag->GetInnerText(); - else if($tagname=='imglist') $innertext = GetSysTemplets('part_imglist.htm'); - else if($tagname=='imginfolist') $innertext = GetSysTemplets('part_imginfolist.htm'); + if (trim($ctag->GetInnerText()) != '') $innertext = $ctag->GetInnerText(); + else if ($tagname == 'imglist') $innertext = GetSysTemplets('part_imglist.htm'); + else if ($tagname == 'imginfolist') $innertext = GetSysTemplets('part_imginfolist.htm'); else $innertext = GetSysTemplets("part_arclist.htm"); //兼容titlelength - if($ctag->GetAtt('titlelength')!='') $titlelen = $ctag->GetAtt('titlelength'); + if ($ctag->GetAtt('titlelength') != '') $titlelen = $ctag->GetAtt('titlelength'); else $titlelen = $ctag->GetAtt('titlelen'); //兼容infolength - if($ctag->GetAtt('infolength')!='') $infolen = $ctag->GetAtt('infolength'); + if ($ctag->GetAtt('infolength') != '') $infolen = $ctag->GetAtt('infolength'); else $infolen = $ctag->GetAtt('infolen'); $typeid = trim($ctag->GetAtt('typeid')); - if(empty($typeid)) { - $typeid = ( isset($refObj->Fields['typeid']) ? $refObj->Fields['typeid'] : $envs['typeid'] ); + if (empty($typeid)) { + $typeid = (isset($refObj->Fields['typeid']) ? $refObj->Fields['typeid'] : $envs['typeid']); } - if($listtype=='autolist') { - $typeid = lib_GetAutoChannelID($ctag->GetAtt('partsort'),$typeid); + if ($listtype == 'autolist') { + $typeid = lib_GetAutoChannelID($ctag->GetAtt('partsort'), $typeid); } - if($ctag->GetAtt('att')=='') { + if ($ctag->GetAtt('att') == '') { $flag = $ctag->GetAtt('flag'); - } - else { + } else { $flag = $ctag->GetAtt('att'); } - return lib_arclistDone - ( - $refObj, $ctag, $typeid, $ctag->GetAtt('row'), $ctag->GetAtt('col'), $titlelen, $infolen, - $ctag->GetAtt('imgwidth'), $ctag->GetAtt('imgheight'), $listtype, $orderby, - $ctag->GetAtt('keyword'), $innertext, $envs['aid'], $ctag->GetAtt('idlist'), $channelid, - $ctag->GetAtt('limit'), $flag,$ctag->GetAtt('orderway'), $ctag->GetAtt('subday'), $ctag->GetAtt('noflag'), - $tagid,$pagesize,$isweight - ); + return lib_arclistDone( + $refObj, + $ctag, + $typeid, + $ctag->GetAtt('row'), + $ctag->GetAtt('col'), + $titlelen, + $infolen, + $ctag->GetAtt('imgwidth'), + $ctag->GetAtt('imgheight'), + $listtype, + $orderby, + $ctag->GetAtt('keyword'), + $innertext, + $envs['aid'], + $ctag->GetAtt('idlist'), + $channelid, + $ctag->GetAtt('limit'), + $flag, + $ctag->GetAtt('orderway'), + $ctag->GetAtt('subday'), + $ctag->GetAtt('noflag'), + $tagid, + $pagesize, + $isweight + ); } /** @@ -131,23 +143,45 @@ function lib_arclist( &$ctag, &$refObj ) * @param string $isweight 是否需要对检索出来的内容按照weight排序 * @return string */ -function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen=30, $infolen=160, - $imgwidth=120, $imgheight=90, $listtype='all', $orderby='default', $keyword='', - $innertext='', $arcid=0, $idlist='', $channelid=0, $limit='', $att='', $order='desc', $subday=0, $noflag='',$tagid='', $pagesize=0, $isweight='N') -{ - global $dsql,$PubFields,$cfg_keyword_like,$cfg_index_cache,$_arclistEnv,$envs,$cfg_cache_type,$cfg_digg_update; - $row = AttDef($row,10); - $titlelen = AttDef($titlelen,30); - $infolen = AttDef($infolen,160); - $imgwidth = AttDef($imgwidth,120); - $imgheight = AttDef($imgheight,120); - $listtype = AttDef($listtype,'all'); - $arcid = AttDef($arcid,0); - $channelid = AttDef($channelid,0); - $orderby = AttDef($orderby,'default'); - $orderWay = AttDef($order,'desc'); - $subday = AttDef($subday,0); - $pagesize = AttDef($pagesize,0); +function lib_arclistDone( + &$refObj, + &$ctag, + $typeid = 0, + $row = 10, + $col = 1, + $titlelen = 30, + $infolen = 160, + $imgwidth = 120, + $imgheight = 90, + $listtype = 'all', + $orderby = 'default', + $keyword = '', + $innertext = '', + $arcid = 0, + $idlist = '', + $channelid = 0, + $limit = '', + $att = '', + $order = 'desc', + $subday = 0, + $noflag = '', + $tagid = '', + $pagesize = 0, + $isweight = 'N' +) { + global $dsql, $PubFields, $cfg_keyword_like, $cfg_index_cache, $_arclistEnv, $envs, $cfg_cache_type, $cfg_digg_update; + $row = AttDef($row, 10); + $titlelen = AttDef($titlelen, 30); + $infolen = AttDef($infolen, 160); + $imgwidth = AttDef($imgwidth, 120); + $imgheight = AttDef($imgheight, 120); + $listtype = AttDef($listtype, 'all'); + $arcid = AttDef($arcid, 0); + $channelid = AttDef($channelid, 0); + $orderby = AttDef($orderby, 'default'); + $orderWay = AttDef($order, 'desc'); + $subday = AttDef($subday, 0); + $pagesize = AttDef($pagesize, 0); $line = $row; $orderby = strtolower($orderby); $keyword = trim($keyword); @@ -155,68 +189,80 @@ function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen $tablewidth = $ctag->GetAtt('tablewidth'); $writer = $ctag->GetAtt('writer'); - if($tablewidth == "") $tablewidth = 100; - if(empty($col)) $col = 1; - $colWidth = ceil(100/$col); - $tablewidth = $tablewidth."%"; - $colWidth = $colWidth."%"; - - //记录属性,以便分页样式统一调用 - $attarray = compact("row", "titlelen", 'infolen', 'imgwidth', 'imgheight', 'listtype', - 'arcid', 'channelid', 'orderby', 'orderWay', 'subday','pagesize', - 'orderby', 'keyword', 'tablewidth', 'col', 'colWidth'); + if ($tablewidth == "") $tablewidth = 100; + if (empty($col)) $col = 1; + $colWidth = ceil(100 / $col); + $tablewidth = $tablewidth . "%"; + $colWidth = $colWidth . "%"; - if($innertext=='') $innertext = GetSysTemplets('part_arclist.htm'); - if( @$ctag->GetAtt('getall') == 1 ) $getall = 1; + //记录属性,以便分页样式统一调用 + $attarray = compact( + "row", + "titlelen", + 'infolen', + 'imgwidth', + 'imgheight', + 'listtype', + 'arcid', + 'channelid', + 'orderby', + 'orderWay', + 'subday', + 'pagesize', + 'orderby', + 'keyword', + 'tablewidth', + 'col', + 'colWidth' + ); + + if ($innertext == '') $innertext = GetSysTemplets('part_arclist.htm'); + if (@$ctag->GetAtt('getall') == 1) $getall = 1; else $getall = 0; - if($att=='0') $att=''; - if($att=='3') $att='f'; - if($att=='1') $att='h'; + if ($att == '0') $att = ''; + if ($att == '3') $att = 'f'; + if ($att == '1') $att = 'h'; $orwheres = array(); $maintable = '#@__archives'; //按不同情况设定SQL条件 排序方式 - if($idlist=='') - { - if($orderby=='near' && $cfg_keyword_like=='N') { $keyword=''; } + if ($idlist == '') { + if ($orderby == 'near' && $cfg_keyword_like == 'N') { + $keyword = ''; + } - if($writer=='this') { + if ($writer == 'this') { $wmid = isset($refObj->Fields['mid']) ? $refObj->Fields['mid'] : 0; $orwheres[] = " arc.mid = '$wmid' "; } - + //时间限制(用于调用最近热门文章、热门评论之类),这里的时间只能计算到天,否则缓存功能将无效 - if($subday > 0) - { + if ($subday > 0) { $ntime = gmmktime(0, 0, 0, gmdate('m'), gmdate('d'), gmdate('Y')); $limitday = $ntime - ($subday * 24 * 3600); $orwheres[] = " arc.senddate > $limitday "; } //关键字条件 - if($keyword!='') - { + if ($keyword != '') { $keyword = str_replace(',', '|', $keyword); $orwheres[] = " CONCAT(arc.title,arc.keywords) REGEXP '$keyword' "; } //文档属性 - if(preg_match('/commend/i', $listtype)) $orwheres[] = " FIND_IN_SET('c', arc.flag)>0 "; - if(preg_match('/image/i', $listtype)) $orwheres[] = " FIND_IN_SET('p', arc.flag)>0 "; - if($att != '') { + if (preg_match('/commend/i', $listtype)) $orwheres[] = " FIND_IN_SET('c', arc.flag)>0 "; + if (preg_match('/image/i', $listtype)) $orwheres[] = " FIND_IN_SET('p', arc.flag)>0 "; + if ($att != '') { $flags = explode(',', $att); - for($i=0; isset($flags[$i]); $i++) $orwheres[] = " FIND_IN_SET('{$flags[$i]}', arc.flag)>0 "; + for ($i = 0; isset($flags[$i]); $i++) $orwheres[] = " FIND_IN_SET('{$flags[$i]}', arc.flag)>0 "; } - if(!empty($typeid) && $typeid != 'top') - { + if (!empty($typeid) && $typeid != 'top') { //指定了多个栏目时,不再获取子类的id - if( preg_match('#,#', $typeid) ) - { + if (preg_match('#,#', $typeid)) { //指定了getall属性或主页模板例外 - if($getall==1 || empty($refObj->Fields['typeid'])) - { + if ($getall == 1 || empty($refObj->Fields['typeid'])) { $typeids = explode(',', $typeid); - foreach($typeids as $ttid) { + foreach ($typeids as $ttid) { $typeidss[] = GetSonIds($ttid); } $typeidStr = join(',', $typeidss); @@ -225,60 +271,47 @@ function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen $typeid = join(',', $typeidssok); } $orwheres[] = " arc.typeid IN ($typeid) "; - } - else - { + } else { //处理交叉栏目 $CrossID = ''; - if($ctag->GetAtt('cross')=='1') - { + if ($ctag->GetAtt('cross') == '1') { $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[] = ' arc.typeid IN ('.GetSonIds($typeid).')'; - } - else - { + if ($arr['cross'] == 0 || ($arr['cross'] == 2 && trim($arr['crossid'] == ''))) { + $orwheres[] = ' arc.typeid IN (' . GetSonIds($typeid) . ')'; + } else { $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}' "; - } - else { + } else { $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->Execute(); - while($arr = $dsql->GetArray()) - { - $CrossID .= ($CrossID=='' ? $arr['id'] : ','.$arr['id']); + while ($arr = $dsql->GetArray()) { + $CrossID .= ($CrossID == '' ? $arr['id'] : ',' . $arr['id']); } } } } - if($CrossID=='') $orwheres[] = ' arc.typeid IN ('.GetSonIds($typeid).')'; - else $orwheres[] = ' arc.typeid IN ('.GetSonIds($typeid).','.$CrossID.')'; + if ($CrossID == '') $orwheres[] = ' arc.typeid IN (' . GetSonIds($typeid) . ')'; + else $orwheres[] = ' arc.typeid IN (' . GetSonIds($typeid) . ',' . $CrossID . ')'; } } //频道ID - if(preg_match('#spec#i', $listtype)) $channelid==-1; + if (preg_match('#spec#i', $listtype)) $channelid == -1; - if(!empty($channelid)) $orwheres[] = " And arc.channel = '$channelid' "; + if (!empty($channelid)) $orwheres[] = " And arc.channel = '$channelid' "; - if(!empty($noflag)) - { - if(!preg_match('#,#', $noflag)) - { + if (!empty($noflag)) { + if (!preg_match('#,#', $noflag)) { $orwheres[] = " FIND_IN_SET('$noflag', arc.flag)<1 "; - } - else - { + } else { $noflags = explode(',', $noflag); - foreach($noflags as $noflag) { - if(trim($noflag)=='') continue; + foreach ($noflags as $noflag) { + if (trim($noflag) == '') continue; $orwheres[] = " FIND_IN_SET('$noflag', arc.flag)<1 "; } } @@ -292,49 +325,45 @@ function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen //文档排序的方式 $ordersql = ''; - if($orderby=='hot' || $orderby=='click') $ordersql = " ORDER BY arc.click $orderWay"; - else if($orderby == 'sortrank' || $orderby=='pubdate') $ordersql = " ORDER BY arc.sortrank $orderWay"; - else if($orderby == 'id') $ordersql = " ORDER BY arc.id $orderWay"; - else if($orderby == 'near') $ordersql = " ORDER BY ABS(arc.id - ".$arcid.")"; - else if($orderby == 'lastpost') $ordersql = " ORDER BY arc.lastpost $orderWay"; - else if($orderby == 'scores') $ordersql = " ORDER BY arc.scores $orderWay"; + if ($orderby == 'hot' || $orderby == 'click') $ordersql = " ORDER BY arc.click $orderWay"; + else if ($orderby == 'sortrank' || $orderby == 'pubdate') $ordersql = " ORDER BY arc.sortrank $orderWay"; + else if ($orderby == 'id') $ordersql = " ORDER BY arc.id $orderWay"; + else if ($orderby == 'near') $ordersql = " ORDER BY ABS(arc.id - " . $arcid . ")"; + else if ($orderby == 'lastpost') $ordersql = " ORDER BY arc.lastpost $orderWay"; + else if ($orderby == 'scores') $ordersql = " ORDER BY arc.scores $orderWay"; //功能:增加按好评数和差评数调用 - else if($orderby == 'goodpost') $ordersql = " order by arc.goodpost $orderWay"; - else if($orderby == 'badpost') $ordersql = " order by arc.badpost $orderWay"; - else if($orderby == 'rand') $ordersql = " ORDER BY rand()"; - else $ordersql = " ORDER BY arc.sortrank $orderWay"; + else if ($orderby == 'goodpost') $ordersql = " order by arc.goodpost $orderWay"; + else if ($orderby == 'badpost') $ordersql = " order by arc.badpost $orderWay"; + else if ($orderby == 'rand') $ordersql = " ORDER BY rand()"; + else $ordersql = " ORDER BY arc.sortrank $orderWay"; //limit条件 $limit = trim(preg_replace('#limit#is', '', $limit)); - if($limit!='') - { + if ($limit != '') { $limitsql = " LIMIT $limit "; $limitarr = explode(',', $limit); - $line = isset($limitarr[1])? $limitarr[1] : $line; - } - else $limitsql = " LIMIT 0,$line "; - + $line = isset($limitarr[1]) ? $limitarr[1] : $line; + } else $limitsql = " LIMIT 0,$line "; + $orwhere = ''; - if(isset($orwheres[0])) { - $orwhere = join(' And ',$orwheres); + if (isset($orwheres[0])) { + $orwhere = join(' And ', $orwheres); $orwhere = preg_replace("#^ And#is", '', $orwhere); $orwhere = preg_replace("#And[ ]{1,}And#is", 'And ', $orwhere); } - if($orwhere!='') $orwhere = " WHERE $orwhere "; - + if ($orwhere != '') $orwhere = " WHERE $orwhere "; + //获取附加表信息 $addfield = trim($ctag->GetAtt('addfields')); $addfieldsSql = ''; $addfieldsSqlJoin = ''; - if($addfield != '' && !empty($channelid)) - { + if ($addfield != '' && !empty($channelid)) { $row = $dsql->GetOne("SELECT addtable FROM `#@__channeltype` WHERE id='$channelid' "); - if(isset($row['addtable']) && trim($row['addtable']) != '') - { + if (isset($row['addtable']) && trim($row['addtable']) != '') { $addtable = trim($row['addtable']); $addfields = explode(',', $addfield); $row['addtable'] = trim($row['addtable']); - $addfieldsSql = ",addf.".join(',addf.', $addfields); + $addfieldsSql = ",addf." . join(',addf.', $addfields); $addfieldsSqlJoin = " LEFT JOIN `$addtable` addf ON addf.aid = arc.id "; } } @@ -347,32 +376,27 @@ function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen $orwhere $ordersql $limitsql"; //统一hash - $taghash = md5(serialize($ctag).$typeid); + $taghash = md5(serialize($ctag) . $typeid); $needSaveCache = true; //进行tagid的默认处理 - if($pagesize > 0) $tagid = AttDef($tagid,'tag'.$taghash ); - - if($idlist!='' || $GLOBALS['_arclistEnv']=='index' || $cfg_index_cache==0) - { + if ($pagesize > 0) $tagid = AttDef($tagid, 'tag' . $taghash); + + if ($idlist != '' || $GLOBALS['_arclistEnv'] == 'index' || $cfg_index_cache == 0) { $needSaveCache = false; - } - else - { + } else { $idlist = GetArclistCache($taghash); - if($idlist != '') { + if ($idlist != '') { $needSaveCache = false; } //如果使用的是内容缓存,直接返回结果 - if($cfg_cache_type=='content' && $idlist != '') - { - $idlist = ($idlist==0 ? '' : $idlist); + if ($cfg_cache_type == 'content' && $idlist != '') { + $idlist = ($idlist == 0 ? '' : $idlist); return $idlist; } } //指定了id或使用缓存中的id - if($idlist != '') - { + if ($idlist != '') { $query = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart, tp.moresite,tp.siteurl,tp.sitepath $addfieldsSql @@ -380,89 +404,100 @@ function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen $addfieldsSqlJoin WHERE arc.id in($idlist) $ordersql "; } - + $dsql->SetQuery($query); $dsql->Execute('al'); //$row = $dsql->GetArray("al"); $artlist = ''; - if($pagesize > 0) $artlist .= "
      \r\n"; - if($col > 1) $artlist = "\r\n"; + if ($pagesize > 0) $artlist .= "
      \r\n"; + if ($col > 1) $artlist = "
      \r\n"; $dtp2 = new DedeTagParse(); $dtp2->SetNameSpace('field', '[', ']'); $dtp2->LoadString($innertext); $GLOBALS['autoindex'] = 0; $ids = array(); $orderWeight = array(); - - for($i=0; $i<$line; $i++) - { - if($col>1) $artlist .= "\r\n"; - for($j=0; $j<$col; $j++) - { - if($col>1) $artlist .= " \r\n"; + for ($j = 0; $j < $col; $j++) { + if ($col > 1) $artlist .= " \r\n"; - }//Loop Col - if($col>1) $i += $col - 1; - if($col>1) $artlist .= " \r\n"; - }//loop line - if($col>1) $artlist .= "
      \r\n"; - if($row = $dsql->GetArray("al")) - { + + for ($i = 0; $i < $line; $i++) { + if ($col > 1) $artlist .= "
      \r\n"; + if ($row = $dsql->GetArray("al")) { $ids[] = $row['id']; //处理一些特殊字段 - $row['info'] = $row['infos'] = cn_substr($row['description'],$infolen); + $row['info'] = $row['infos'] = cn_substr($row['description'], $infolen); $row['id'] = $row['id']; - if($row['corank'] > 0 && $row['arcrank']==0) - { + if ($row['corank'] > 0 && $row['arcrank'] == 0) { $row['arcrank'] = $row['corank']; } - $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'], - $row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']); + $row['filename'] = $row['arcurl'] = GetFileUrl( + $row['id'], + $row['typeid'], + $row['senddate'], + $row['title'], + $row['ismake'], + $row['arcrank'], + $row['namerule'], + $row['typedir'], + $row['money'], + $row['filename'], + $row['moresite'], + $row['siteurl'], + $row['sitepath'] + ); - $row['typeurl'] = GetTypeUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'],$row['ispart'], - $row['namerule2'],$row['moresite'],$row['siteurl'],$row['sitepath']); + $row['typeurl'] = GetTypeUrl( + $row['typeid'], + $row['typedir'], + $row['isdefault'], + $row['defaultname'], + $row['ispart'], + $row['namerule2'], + $row['moresite'], + $row['siteurl'], + $row['sitepath'] + ); - if($row['litpic'] == '-' || $row['litpic'] == '') - { - $row['litpic'] = $GLOBALS['cfg_cmspath'].'/static/defaultpic.gif'; + if ($row['litpic'] == '-' || $row['litpic'] == '') { + $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/static/defaultpic.gif'; } - if(!preg_match("#^http:\/\/#i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') - { - $row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic']; + if (!preg_match("#^http:\/\/#i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { + $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic']; } $row['picname'] = $row['litpic']; $row['stime'] = GetDateMK($row['pubdate']); - $row['typelink'] = "".$row['typename'].""; - $row['image'] = "".preg_replace("#[<]#", "", $row['title'])."'>"; - $row['imglink'] = "".$row['image'].""; + $row['typelink'] = "" . $row['typename'] . ""; + $row['image'] = "" . preg_replace("#[<]#", "", $row['title']) . "'>"; + $row['imglink'] = "" . $row['image'] . ""; $row['fulltitle'] = $row['title']; $row['title'] = cn_substr($row['title'], $titlelen); - if($row['color']!='') $row['title'] = "".$row['title'].""; - if(preg_match('#b#', $row['flag'])) $row['title'] = "".$row['title'].""; + if ($row['color'] != '') $row['title'] = "" . $row['title'] . ""; + if (preg_match('#b#', $row['flag'])) $row['title'] = "" . $row['title'] . ""; //$row['title'] = "".$row['title'].""; - $row['textlink'] = "".$row['title'].""; + $row['textlink'] = "" . $row['title'] . ""; $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl']; $row['memberurl'] = $GLOBALS['cfg_memberurl']; $row['templeturl'] = $GLOBALS['cfg_templeturl']; - if(is_array($dtp2->CTags)) - { - foreach($dtp2->CTags as $k=>$ctag) - { - if($ctag->GetName()=='array') - { + if (is_array($dtp2->CTags)) { + foreach ($dtp2->CTags as $k => $ctag) { + if ($ctag->GetName() == 'array') { //传递整个数组,在runphp模式中有特殊作用 $dtp2->Assign($k, $row); } else { - if(isset($row[$ctag->GetName()])) $dtp2->Assign($k,$row[$ctag->GetName()]); + if (isset($row[$ctag->GetName()])) $dtp2->Assign($k, $row[$ctag->GetName()]); else $dtp2->Assign($k, ''); } } $GLOBALS['autoindex']++; } - if($pagesize > 0) - { - if($GLOBALS['autoindex'] <= $pagesize) - { + if ($pagesize > 0) { + if ($GLOBALS['autoindex'] <= $pagesize) { $liststr = $dtp2->GetResult(); - $artlist .= $liststr."\r\n"; + $artlist .= $liststr . "\r\n"; } else { $artlist .= ""; $orderWeight[] = array( @@ -472,54 +507,51 @@ function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen } } else { $liststr = $dtp2->GetResult(); - $artlist .= $liststr."\r\n"; + $artlist .= $liststr . "\r\n"; } $orderWeight[] = array( 'weight' => $row['weight'], 'arclist' => $liststr ); - }//if hasRow - else{ + } //if hasRow + else { $artlist .= ''; } - + // 进行判断,如果启用排序则内容输出为重新排序后的内容 // var_dump($isweight=='y' && count($orderWeight) == $line); $isweight = strtolower($isweight); - if ( $isweight=='y' ) - { + if ($isweight == 'y') { $artlist = ''; $orderWeight = list_sort_by($orderWeight, 'weight', 'asc'); - + foreach ($orderWeight as $vv) { - $artlist .= $vv['arclist']; + $artlist .= $vv['arclist']; } } - if($col>1) $artlist .= "
      \r\n"; + if ($col > 1) $artlist .= " \r\n"; + } //Loop Col + if ($col > 1) $i += $col - 1; + if ($col > 1) $artlist .= " \r\n"; + } //loop line + if ($col > 1) $artlist .= " \r\n"; $dsql->FreeResult("al"); $idsstr = join(',', $ids); - + //分页特殊处理 - if($pagesize > 0) - { + if ($pagesize > 0) { $artlist .= "
      \r\n"; - $row = $dsql->GetOne("SELECT tagid FROM `#@__arcmulti` WHERE tagid='$tagid'"); - $uptime = time(); - $attstr = addslashes(serialize($attarray)); - $innertext = addslashes($innertext); - if(!is_array($row)) - { - $query = "INSERT INTO `#@__arcmulti`(tagid,uptime,innertext,pagesize,arcids,ordersql,addfieldsSql,addfieldsSqlJoin,attstr) + $row = $dsql->GetOne("SELECT tagid FROM `#@__arcmulti` WHERE tagid='$tagid'"); + $uptime = time(); + $attstr = addslashes(serialize($attarray)); + $innertext = addslashes($innertext); + if (!is_array($row)) { + $query = "INSERT INTO `#@__arcmulti`(tagid,uptime,innertext,pagesize,arcids,ordersql,addfieldsSql,addfieldsSqlJoin,attstr) VALUES('$tagid','$uptime','$innertext','$pagesize','$idsstr','$ordersql','$addfieldsSql','$addfieldsSqlJoin','$attstr'); "; - $dsql->ExecuteNoneQuery($query); - } else { - $query = "UPDATE `#@__arcmulti` + $dsql->ExecuteNoneQuery($query); + } else { + $query = "UPDATE `#@__arcmulti` SET uptime='$uptime', innertext='$innertext', @@ -531,19 +563,18 @@ function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen attstr='$attstr' WHERE tagid='$tagid' "; - $dsql->ExecuteNoneQuery($query); - } + $dsql->ExecuteNoneQuery($query); + } } - + //保存ID缓存 - if($needSaveCache) - { - if($idsstr=='') $idsstr = '0'; - if($cfg_cache_type=='content' && $idsstr!='0') { + if ($needSaveCache) { + if ($idsstr == '') $idsstr = '0'; + if ($cfg_cache_type == 'content' && $idsstr != '0') { $idsstr = addslashes($artlist); } - $inquery = "INSERT INTO `#@__arccache`(`md5hash`,`uptime`,`cachedata`) VALUES ('".$taghash."','".time()."', '$idsstr'); "; - $dsql->ExecuteNoneQuery("DELETE FROM `#@__arccache` WHERE md5hash='".$taghash."' "); + $inquery = "INSERT INTO `#@__arccache`(`md5hash`,`uptime`,`cachedata`) VALUES ('" . $taghash . "','" . time() . "', '$idsstr'); "; + $dsql->ExecuteNoneQuery("DELETE FROM `#@__arccache` WHERE md5hash='" . $taghash . "' "); $dsql->ExecuteNoneQuery($inquery); } return $artlist; @@ -558,18 +589,16 @@ function lib_arclistDone(&$refObj, &$ctag, $typeid=0, $row=10, $col=1, $titlelen */ function GetArclistCache($md5hash) { - global $dsql,$envs,$cfg_makesign_cache,$cfg_index_cache,$cfg_cache_type; - if($cfg_index_cache <= 0) return ''; - if(isset($envs['makesign']) && $cfg_makesign_cache=='N') return ''; + global $dsql, $envs, $cfg_makesign_cache, $cfg_index_cache, $cfg_cache_type; + if ($cfg_index_cache <= 0) return ''; + if (isset($envs['makesign']) && $cfg_makesign_cache == 'N') return ''; $mintime = time() - $cfg_index_cache; $arr = $dsql->GetOne("SELECT cachedata,uptime FROM `#@__arccache` WHERE md5hash = '$md5hash' "); - if(!is_array($arr)) { + if (!is_array($arr)) { return ''; - } - else if($arr['uptime'] < $mintime) { + } else if ($arr['uptime'] < $mintime) { return ''; - } - else { + } else { return $arr['cachedata']; } } @@ -585,10 +614,10 @@ function GetArclistCache($md5hash) function lib_GetAutoChannelID($sortid, $topid) { global $dsql; - if(empty($sortid)) $sortid = 1; + if (empty($sortid)) $sortid = 1; $getstart = $sortid - 1; $row = $dsql->GetOne("SELECT id,typename FROM `#@__arctype` WHERE reid='{$topid}' And ispart<2 And ishidden<>'1' ORDER BY sortrank asc limit $getstart,1"); - if(!is_array($row)) return 0; + if (!is_array($row)) return 0; else return $row['id']; } @@ -602,25 +631,26 @@ function lib_GetAutoChannelID($sortid, $topid) * asc正向排序 desc逆向排序 nat自然排序 * @return array */ -function list_sort_by($list, $field, $sortby='asc') { - if(is_array($list)){ - $refer = $resultSet = array(); - foreach ($list as $i => $data) - $refer[$i] = &$data[$field]; - switch ($sortby) { - case 'asc': // 正向排序 +function list_sort_by($list, $field, $sortby = 'asc') +{ + if (is_array($list)) { + $refer = $resultSet = array(); + foreach ($list as $i => $data) + $refer[$i] = &$data[$field]; + switch ($sortby) { + case 'asc': // 正向排序 asort($refer); break; - case 'desc':// 逆向排序 + case 'desc': // 逆向排序 arsort($refer); break; - case 'nat': // 自然排序 + case 'nat': // 自然排序 natcasesort($refer); break; - } - foreach ( $refer as $key=> $val) - $resultSet[] = &$list[$key]; - return $resultSet; - } - return false; -} \ No newline at end of file + } + foreach ($refer as $key => $val) + $resultSet[] = &$list[$key]; + return $resultSet; + } + return false; +} diff --git a/src/include/taglib/arclistsg.lib.php b/src/include/taglib/arclistsg.lib.php index ddfb77a9..a682b38e 100755 --- a/src/include/taglib/arclistsg.lib.php +++ b/src/include/taglib/arclistsg.lib.php @@ -1,15 +1,16 @@ CAttribute->Items,$attlist); + $attlist = "typeid|0,row|10,col|1,flag|,titlelen|30,sort|default,keyword|,innertext|,arcid|0,idlist|,channelid|0,limit|,orderway|desc,subday|0"; + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $line = $row; - $orderby=strtolower($sort); - if($col=='') $col = 1; - if(empty($imgwidth)) $imgwidth = ""; - if(empty($imgheight)) $imgheight = ""; + $orderby = strtolower($sort); + if ($col == '') $col = 1; + if (empty($imgwidth)) $imgwidth = ""; + if (empty($imgheight)) $imgheight = ""; $innertext = trim($ctag->GetInnerText()); - if($innertext=='') $innertext = GetSysTemplets("part_arclistsg.htm"); + if ($innertext == '') $innertext = GetSysTemplets("part_arclistsg.htm"); - if(empty($channelid) && isset($GLOBALS['envs']['channelid'])) { + if (empty($channelid) && isset($GLOBALS['envs']['channelid'])) { $channelid = $GLOBALS['envs']['channelid']; } - - if(empty($typeid) && !empty($envs['typeid'])) { - $typeid = $envs['typeid']; + + if (empty($typeid) && !empty($envs['typeid'])) { + $typeid = $envs['typeid']; } - - if(empty($typeid) && empty($channelid)) - { + + if (empty($typeid) && empty($channelid)) { return "No channel info!"; } - if(!empty($channelid)) $gquery = "SELECT addtable,listfields FROM `#@__channeltype` WHERE id='$channelid' "; + if (!empty($channelid)) $gquery = "SELECT addtable,listfields FROM `#@__channeltype` WHERE id='$channelid' "; else $gquery = "SELECT ch.addtable,listfields FROM `#@__arctype` tp LEFT JOIN `#@__channeltype` ch ON ch.id=tp.channeltype WHERE id='$typeid'"; - $row = $dsql->GetOne($gquery); + $row = $dsql->GetOne($gquery); $orwheres = array(); $maintable = trim($row['addtable']); - if($maintable=='') - { + if ($maintable == '') { return "No addtable info!"; } //列表调用字段 $listarcs = array('aid', 'typeid'); - if(!empty($row['listfields'])) - { - $listfields = explode(',', $row['listfields']); - foreach($listfields as $v) - { - if(!in_array($v, $listarcs)) $listarcs[] = $v; - } + if (!empty($row['listfields'])) { + $listfields = explode(',', $row['listfields']); + foreach ($listfields as $v) { + if (!in_array($v, $listarcs)) $listarcs[] = $v; + } } $arclistquery = join(',', $listarcs); $arclistquery .= ",arc.aid AS id,arc.senddate AS pubdate"; //按不同情况设定SQL条件 排序方式 - if($idlist=='') - { - if($orderby=='near' && $cfg_keyword_like=='N'){ $keyword=''; } + if ($idlist == '') { + if ($orderby == 'near' && $cfg_keyword_like == 'N') { + $keyword = ''; + } //时间限制(用于调用最近热门文章、热门评论之类) - if($subday>0) - { + if ($subday > 0) { //这里的时间只能计算到天,否则缓存功能将无效 $ntime = gmmktime(0, 0, 0, gmdate('m'), gmdate('d'), gmdate('Y')); $limitday = $ntime - ($subday * 24 * 3600); $orwheres[] = " arc.senddate > $limitday "; } - - if($flag!='') - { - $flags = explode(',',$flag); - for($i=0;isset($flags[$i]);$i++) $orwheres[] = " FIND_IN_SET('{$flags[$i]}',flag)>0 "; + + if ($flag != '') { + $flags = explode(',', $flag); + for ($i = 0; isset($flags[$i]); $i++) $orwheres[] = " FIND_IN_SET('{$flags[$i]}',flag)>0 "; } - if(!empty($typeid)) - { + if (!empty($typeid)) { //指定了多个栏目时,不再获取子类的id - if(preg_match('#,#',$typeid)) $orwheres[] = " typeid IN ($typeid) "; - else - { + if (preg_match('#,#', $typeid)) $orwheres[] = " typeid IN ($typeid) "; + else { //处理交叉栏目 $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' "); - if($arr['cross']==0 || ($arr['cross']==2 && trim($arr['crossid']==''))) - $orwheres[] = ' typeid IN ('.GetSonIds($typeid).')'; - else - { + if ($arr['cross'] == 0 || ($arr['cross'] == 2 && trim($arr['crossid'] == ''))) + $orwheres[] = ' typeid IN (' . GetSonIds($typeid) . ')'; + else { $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}' "; - } - else { + } else { $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->Execute(); - while($arr = $dsql->GetArray()) { - $CrossID .= ($CrossID=='' ? $arr['id'] : ','.$arr['id']); + while ($arr = $dsql->GetArray()) { + $CrossID .= ($CrossID == '' ? $arr['id'] : ',' . $arr['id']); } } } } - if($CrossID=='') $orwheres[] = ' typeid IN ('.GetSonIds($typeid).')'; - else $orwheres[] = ' typeid IN ('.GetSonIds($typeid).','.$CrossID.')'; + if ($CrossID == '') $orwheres[] = ' typeid IN (' . GetSonIds($typeid) . ')'; + else $orwheres[] = ' typeid IN (' . GetSonIds($typeid) . ',' . $CrossID . ')'; } } //频道ID - if(!empty($channelid)) $orwheres[] = " AND arc.channel = '$channelid' "; + if (!empty($channelid)) $orwheres[] = " AND arc.channel = '$channelid' "; //由于这个条件会导致缓存功能失去意义,因此取消 //if($arcid!=0) $orwheres[] = " arc.id<>'$arcid' "; } //文档排序的方式 $ordersql = ''; - if($orderby=='hot'||$orderby=='click') $ordersql = " ORDER BY arc.click $orderway"; - else if($orderby=='id') $ordersql = " ORDER BY arc.aid $orderway"; - else if($orderby=='near') $ordersql = " ORDER BY ABS(arc.id - ".$arcid.")"; - else if($orderby=='rand') $ordersql = " ORDER BY rand()"; - else $ordersql=" ORDER BY arc.aid $orderway"; + if ($orderby == 'hot' || $orderby == 'click') $ordersql = " ORDER BY arc.click $orderway"; + else if ($orderby == 'id') $ordersql = " ORDER BY arc.aid $orderway"; + else if ($orderby == 'near') $ordersql = " ORDER BY ABS(arc.id - " . $arcid . ")"; + else if ($orderby == 'rand') $ordersql = " ORDER BY rand()"; + else $ordersql = " ORDER BY arc.aid $orderway"; //limit条件 $limit = trim(preg_replace('#limit#i', '', $limit)); - if($limit!='') $limitsql = " LIMIT $limit "; + if ($limit != '') $limitsql = " LIMIT $limit "; else $limitsql = " LIMIT 0,$line "; $orwhere = ''; - if(isset($orwheres[0])) { - $orwhere = join(' AND ',$orwheres); + if (isset($orwheres[0])) { + $orwhere = join(' AND ', $orwheres); $orwhere = preg_replace("#^ AND#i", '', $orwhere); $orwhere = preg_replace("#AND[ ]{1,}AND#i", 'AND ', $orwhere); } - if($orwhere!='') $orwhere = " WHERE $orwhere "; + if ($orwhere != '') $orwhere = " WHERE $orwhere "; $query = "SELECT $arclistquery,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule, tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath @@ -165,14 +155,13 @@ function lib_arclistsg(&$ctag,&$refObj) $md5hash = md5($query); $needcache = TRUE; - if($idlist!='') $needcache = FALSE; - else{ + if ($idlist != '') $needcache = FALSE; + else { $idlist = GetArclistSgCache($md5hash); - if($idlist!='') $needcache = FALSE; + if ($idlist != '') $needcache = FALSE; } //指定了id或使用缓存中的id - if($idlist!='' && $_arclistEnv != 'index') - { + if ($idlist != '' && $_arclistEnv != 'index') { $query = "SELECT $arclistquery,tp.typedir,tp.typename,tp.isdefault,tp.defaultname,tp.namerule,tp.namerule2,tp.ispart, tp.moresite,tp.siteurl,tp.sitepath FROM `$maintable` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id WHERE arc.aid IN($idlist) $ordersql $limitsql"; @@ -181,83 +170,94 @@ function lib_arclistsg(&$ctag,&$refObj) $dsql->Execute("al"); $artlist = ""; $dtp2 = new DedeTagParse(); - $dtp2->SetNameSpace("field","[","]"); + $dtp2->SetNameSpace("field", "[", "]"); $dtp2->LoadString($innertext); $GLOBALS['autoindex'] = 0; $ids = array(); - for($i=0;$i<$line;$i++) - { - for($j=0;$j<$col;$j++) - { - if($col>1) $artlist .= "
      \r\n"; - if($row = $dsql->GetArray("al")) - { + for ($i = 0; $i < $line; $i++) { + for ($j = 0; $j < $col; $j++) { + if ($col > 1) $artlist .= "
      \r\n"; + if ($row = $dsql->GetArray("al")) { $ids[] = $row['aid']; - $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],1, - 0,$row['namerule'],$row['typedir'],0,'',$row['moresite'],$row['siteurl'],$row['sitepath']); + $row['filename'] = $row['arcurl'] = GetFileUrl( + $row['id'], + $row['typeid'], + $row['senddate'], + $row['title'], + 1, + 0, + $row['namerule'], + $row['typedir'], + 0, + '', + $row['moresite'], + $row['siteurl'], + $row['sitepath'] + ); - $row['typeurl'] = GetTypeUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'],$row['ispart'], - $row['namerule2'],$row['moresite'],$row['siteurl'],$row['sitepath']); + $row['typeurl'] = GetTypeUrl( + $row['typeid'], + $row['typedir'], + $row['isdefault'], + $row['defaultname'], + $row['ispart'], + $row['namerule2'], + $row['moresite'], + $row['siteurl'], + $row['sitepath'] + ); - if($row['litpic'] == '-' || $row['litpic'] == '') - { - $row['litpic'] = $GLOBALS['cfg_cmspath'].'/static/defaultpic.gif'; + if ($row['litpic'] == '-' || $row['litpic'] == '') { + $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/static/defaultpic.gif'; } - if(!preg_match("#^http:\/\/#i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') - { - $row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic']; + if (!preg_match("#^http:\/\/#i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { + $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic']; } $row['picname'] = $row['litpic']; - - $row['image'] = "".preg_replace("#[<]#", "", $row['title'])."' />"; - $row['imglink'] = "".$row['image'].""; + $row['image'] = "" . preg_replace("#[<]#", "", $row['title']) . "' />"; + + $row['imglink'] = "" . $row['image'] . ""; $row['stime'] = GetDateMK($row['pubdate']); - $row['typelink'] = "".$row['typename'].""; + $row['typelink'] = "" . $row['typename'] . ""; $row['fulltitle'] = $row['title']; - $row['title'] = cn_substr($row['title'],$titlelen); - $row['textlink'] = "".$row['title'].""; + $row['title'] = cn_substr($row['title'], $titlelen); + $row['textlink'] = "" . $row['title'] . ""; $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl']; $row['memberurl'] = $GLOBALS['cfg_memberurl']; $row['templeturl'] = $GLOBALS['cfg_templeturl']; - if(is_array($dtp2->CTags)) - { - foreach($dtp2->CTags as $k=>$ctag) - { - if($ctag->GetName()=='array') - { + if (is_array($dtp2->CTags)) { + foreach ($dtp2->CTags as $k => $ctag) { + if ($ctag->GetName() == 'array') { //传递整个数组,在runphp模式中有特殊作用 - $dtp2->Assign($k,$row); - } - else - { - if(isset($row[$ctag->GetName()])) $dtp2->Assign($k,$row[$ctag->GetName()]); - else $dtp2->Assign($k,''); + $dtp2->Assign($k, $row); + } else { + if (isset($row[$ctag->GetName()])) $dtp2->Assign($k, $row[$ctag->GetName()]); + else $dtp2->Assign($k, ''); } } $GLOBALS['autoindex']++; } - $artlist .= $dtp2->GetResult()."\r\n"; - }//if hasRow - else{ + $artlist .= $dtp2->GetResult() . "\r\n"; + } //if hasRow + else { $artlist .= ''; } - if($col>1) $artlist .= "
      \r\n"; - }//Loop Col - if($col>1) $i += $col - 1; - }//loop line + if ($col > 1) $artlist .= "
      \r\n"; + } //Loop Col + if ($col > 1) $i += $col - 1; + } //loop line $dsql->FreeResult("al"); //保存ID缓存 - $idsstr = join(',',$ids); - if($idsstr!='' && $needcache && $cfg_index_cache>0) - { + $idsstr = join(',', $ids); + if ($idsstr != '' && $needcache && $cfg_index_cache > 0) { $mintime = time() - ($cfg_index_cache * 3600); - $inquery = "INSERT INTO `#@__arccache`(`md5hash`,`uptime`,`cachedata`) VALUES ('".$md5hash."', '".time()."', '$idsstr'); "; - $dsql->ExecuteNoneQuery("DELETE FROM `#@__arccache` WHERE md5hash='".$md5hash."' or uptime < $mintime "); + $inquery = "INSERT INTO `#@__arccache`(`md5hash`,`uptime`,`cachedata`) VALUES ('" . $md5hash . "', '" . time() . "', '$idsstr'); "; + $dsql->ExecuteNoneQuery("DELETE FROM `#@__arccache` WHERE md5hash='" . $md5hash . "' or uptime < $mintime "); $dsql->ExecuteNoneQuery($inquery); } return $artlist; @@ -266,26 +266,26 @@ function lib_arclistsg(&$ctag,&$refObj) //查询缓存 function GetArclistSgCache($md5hash) { - global $dsql,$envs,$cfg_makesign_cache,$cfg_index_cache; + global $dsql, $envs, $cfg_makesign_cache, $cfg_index_cache; //没启用缓存 - if($cfg_index_cache<=0) return ''; + if ($cfg_index_cache <= 0) return ''; //少量更新禁用缓存 - if(isset($envs['makesign']) && $cfg_makesign_cache=='N') return ''; + if (isset($envs['makesign']) && $cfg_makesign_cache == 'N') return ''; //正常情况 $mintime = time() - ($cfg_index_cache * 3600); $arr = $dsql->GetOne("SELECT cachedata,uptime FROM `#@__arccache` WHERE md5hash = '$md5hash' AND uptime > $mintime "); //没数据 - if(!is_array($arr)) return ''; + if (!is_array($arr)) return ''; //返回缓存id数据 else return $arr['cachedata']; } -function lib_GetAutoChannelID2($sortid,$topid) +function lib_GetAutoChannelID2($sortid, $topid) { global $dsql; - if(empty($sortid)) $sortid = 1; + if (empty($sortid)) $sortid = 1; $getstart = $sortid - 1; $row = $dsql->GetOne("SELECT id,typename From #@__arctype WHERE reid='{$topid}' AND ispart<2 AND ishidden<>'1' ORDER BY sortrank asc limit $getstart,1"); - if(!is_array($row)) return 0; + if (!is_array($row)) return 0; else return $row['id']; -} \ No newline at end of file +} diff --git a/src/include/taglib/arcpagelist.lib.php b/src/include/taglib/arcpagelist.lib.php index 06917f6b..3f3fe475 100755 --- a/src/include/taglib/arcpagelist.lib.php +++ b/src/include/taglib/arcpagelist.lib.php @@ -1,42 +1,40 @@ -CAttribute->Items,$attlist); - extract($ctag->CAttribute->Items, EXTR_SKIP); - - $row = $dsql->GetOne("SELECT * FROM `#@__arcmulti` WHERE tagid='$tagid'"); - if(is_array($row)) - { - $ids = explode(',', $row['arcids']); - - $totalnum = count($ids); - $pagestr = '
      '; - if($row['pagesize'] < $totalnum) - { - $pagestr .= multipage($totalnum, 1, $row['pagesize'], $tagid); - } else { - $pagestr .= '共1页'; - } - $pagestr .= '
      '; - return $pagestr; + global $dsql; + $attlist = "tagid|,style|1"; + FillAttsDefault($ctag->CAttribute->Items, $attlist); + extract($ctag->CAttribute->Items, EXTR_SKIP); + + $row = $dsql->GetOne("SELECT * FROM `#@__arcmulti` WHERE tagid='$tagid'"); + if (is_array($row)) { + $ids = explode(',', $row['arcids']); + + $totalnum = count($ids); + $pagestr = '
      '; + if ($row['pagesize'] < $totalnum) { + $pagestr .= multipage($totalnum, 1, $row['pagesize'], $tagid); } else { - $pagestr = '
      '; - $pagestr .= '没有检索到对应分页'; - $pagestr .= '
      '; - return $pagestr; + $pagestr .= '共1页'; } + $pagestr .= '
      '; + return $pagestr; + } else { + $pagestr = '
      '; + $pagestr .= '没有检索到对应分页'; + $pagestr .= '
      '; + return $pagestr; + } } /** @@ -49,33 +47,33 @@ function lib_arcpagelist(&$ctag, &$refObj) * @param string $tagid 标签ID * @return string */ -function multipage($allItemTotal, $currPageNum, $pageSize, $tagid='') +function multipage($allItemTotal, $currPageNum, $pageSize, $tagid = '') { - if ($allItemTotal == 0) return ""; + if ($allItemTotal == 0) return ""; - //计算总页数 - $pagesNum = ceil($allItemTotal/$pageSize); + //计算总页数 + $pagesNum = ceil($allItemTotal / $pageSize); - //第一页显示 - $firstPage = ($currPageNum <= 1) ? $currPageNum ."<<" : "1<<"; + //第一页显示 + $firstPage = ($currPageNum <= 1) ? $currPageNum . "<<" : "1<<"; - //最后一页显示 - $lastPage = ($currPageNum >= $pagesNum)? ">>". $currPageNum : ">>". $pagesNum .""; + //最后一页显示 + $lastPage = ($currPageNum >= $pagesNum) ? ">>" . $currPageNum : ">>" . $pagesNum . ""; - //上一页显示 - $prePage = ($currPageNum <= 1) ? "上页" : "[上一页]"; + //上一页显示 + $prePage = ($currPageNum <= 1) ? "上页" : "[上一页]"; - //下一页显示 - $nextPage = ($currPageNum >= $pagesNum) ? "下页" : "[下一页]"; + //下一页显示 + $nextPage = ($currPageNum >= $pagesNum) ? "下页" : "[下一页]"; - //按页显示 - $listNums = ""; - for ($i=($currPageNum-4); $i<($currPageNum+9); $i++) { - if ($i < 1 || $i > $pagesNum) continue; - if ($i == $currPageNum) $listNums.= "".$i.""; - else $listNums.= " ". $i ." "; - } + //按页显示 + $listNums = ""; + for ($i = ($currPageNum - 4); $i < ($currPageNum + 9); $i++) { + if ($i < 1 || $i > $pagesNum) continue; + if ($i == $currPageNum) $listNums .= "" . $i . ""; + else $listNums .= " " . $i . " "; + } - $returnUrl = $listNums; - return $returnUrl; -} \ No newline at end of file + $returnUrl = $listNums; + return $returnUrl; +} diff --git a/src/include/taglib/autochannel.lib.php b/src/include/taglib/autochannel.lib.php index 225a6d9f..ee0d7dc5 100755 --- a/src/include/taglib/autochannel.lib.php +++ b/src/include/taglib/autochannel.lib.php @@ -1,64 +1,67 @@ -CAttribute->Items,$attlist); + $attlist = 'partsort|0,typeid=-1'; + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnerText()); $topid = $typeid; $sortid = $partsort; - if($topid=='-1' || $topid=='') - { - $topid = ( isset($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : 0); + if ($topid == '-1' || $topid == '') { + $topid = (isset($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : 0); } - - if(empty($sortid)) $sortid = 1; + + if (empty($sortid)) $sortid = 1; $getstart = $sortid - 1; $row = $dsql->GetOne("SELECT id,typename FROM `#@__arctype` WHERE reid='{$topid}' AND ispart<2 AND ishidden<>'1' ORDER BY sortrank asc limit $getstart,1"); - - if(!is_array($row) ) return ''; + + if (!is_array($row)) return ''; else $typeid = $row['id']; - - if(trim($innertext)=='') $innertext = GetSysTemplets('part_autochannel.htm'); - + + if (trim($innertext) == '') $innertext = GetSysTemplets('part_autochannel.htm'); + $row = $dsql->GetOne("SELECT id,typedir,isdefault,defaultname,ispart,namerule2,typename,moresite,siteurl,sitepath FROM `#@__arctype` WHERE id='$typeid' "); - if(!is_array($row)) return ''; + if (!is_array($row)) return ''; $dtp = new DedeTagParse(); - $dtp->SetNameSpace('field','[',']'); + $dtp->SetNameSpace('field', '[', ']'); $dtp->LoadSource($innertext); - if(!is_array($dtp->CTags)) - { + if (!is_array($dtp->CTags)) { unset($dtp); return ''; - } - else - { - $row['typelink'] = GetTypeUrl($row['id'],MfTypedir($row['typedir']),$row['isdefault'], - $row['defaultname'],$row['ispart'],$row['namerule2'],$row['siteurl'],$row['sitepath']); - foreach($dtp->CTags as $tagid=>$ctag) - { - if(isset($row[$ctag->GetName()])) $dtp->Assign($tagid,$row[$ctag->GetName()]); + } else { + $row['typelink'] = GetTypeUrl( + $row['id'], + MfTypedir($row['typedir']), + $row['isdefault'], + $row['defaultname'], + $row['ispart'], + $row['namerule2'], + $row['siteurl'], + $row['sitepath'] + ); + foreach ($dtp->CTags as $tagid => $ctag) { + if (isset($row[$ctag->GetName()])) $dtp->Assign($tagid, $row[$ctag->GetName()]); } $revalue = $dtp->GetResult(); unset($dtp); return $revalue; } -} \ No newline at end of file +} diff --git a/src/include/taglib/cattree.lib.php b/src/include/taglib/cattree.lib.php index 6aea534a..e4d3800f 100755 --- a/src/include/taglib/cattree.lib.php +++ b/src/include/taglib/cattree.lib.php @@ -1,9 +1,9 @@ -CAttribute->Items,$attlist); + $attlist = "showall|,catid|0"; + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $revalue = ''; - if(empty($typeid)) - { - if( isset($refObj->TypeLink->TypeInfos['id']) ) { + if (empty($typeid)) { + if (isset($refObj->TypeLink->TypeInfos['id'])) { $typeid = $refObj->TypeLink->TypeInfos['id']; $reid = $refObj->TypeLink->TypeInfos['reid']; $topid = $refObj->TypeLink->TypeInfos['topid']; $channeltype = $refObj->TypeLink->TypeInfos['channeltype']; $ispart = $refObj->TypeLink->TypeInfos['ispart']; - if($reid==0) $topid = $typeid; + if ($reid == 0) $topid = $typeid; } else { - $typeid = $reid = $topid = $channeltype = $ispart = 0; + $typeid = $reid = $topid = $channeltype = $ispart = 0; } - } - else - { + } else { $row = $dsql->GetOne("SELECT reid,topid,channeltype,ispart FROM `#@__arctype` WHERE id='$typeid' "); - if(!is_array($row)) - { + if (!is_array($row)) { $typeid = $reid = $topid = $channeltype = $ispart = 0; } else { $reid = $row['reid']; @@ -46,35 +42,27 @@ function lib_cattree(&$ctag, &$refObj) $ispart = $row['ispart']; } } - if( !empty($catid) ) - { + if (!empty($catid)) { $topQuery = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid='$catid' And ishidden<>1 "; - } - else - { - if($showall == "yes" ) - { + } else { + if ($showall == "yes") { $topQuery = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid='$topid' "; + } else { + if ($showall == '') { + if ($ispart < 2 && !empty($channeltype)) $showall = $channeltype; + else $showall = 6; + } + $topQuery = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid='{$topid}' And channeltype='{$showall}' And ispart<2 And ishidden<>1 "; } - else - { - if($showall=='') - { - if( $ispart < 2 && !empty($channeltype) ) $showall = $channeltype; - else $showall = 6; - } - $topQuery = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid='{$topid}' And channeltype='{$showall}' And ispart<2 And ishidden<>1 "; - } } - $dsql->Execute('t', $topQuery); - while($row = $dsql->GetArray('t')) - { - $row['typelink'] = GetOneTypeUrlA($row); - $revalue .= "
      \n"; - $revalue .= "
      {$row['typename']}
      \n"; - cattreeListSon($row['id'], $revalue); - $revalue .= "
      \n"; - } + $dsql->Execute('t', $topQuery); + while ($row = $dsql->GetArray('t')) { + $row['typelink'] = GetOneTypeUrlA($row); + $revalue .= "
      \n"; + $revalue .= "
      {$row['typename']}
      \n"; + cattreeListSon($row['id'], $revalue); + $revalue .= "
      \n"; + } return $revalue; } @@ -84,13 +72,12 @@ function cattreeListSon($id, &$revalue) $query = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid='{$id}' And ishidden<>1 "; $dsql->Execute($id, $query); $thisv = ''; - while($row = $dsql->GetArray($id)) - { - $row['typelink'] = GetOneTypeUrlA($row); - $thisv .= "
      \n"; - $thisv .= "
      {$row['typename']}
      \n"; - cattreeListSon($row['id'], $thisv); - $thisv .= "
      \n"; - } - if($thisv!='') $revalue .= "
      \n$thisv
      \n"; -} \ No newline at end of file + while ($row = $dsql->GetArray($id)) { + $row['typelink'] = GetOneTypeUrlA($row); + $thisv .= "
      \n"; + $thisv .= "
      {$row['typename']}
      \n"; + cattreeListSon($row['id'], $thisv); + $thisv .= "
      \n"; + } + if ($thisv != '') $revalue .= "
      \n$thisv
      \n"; +} diff --git a/src/include/taglib/channel.lib.php b/src/include/taglib/channel.lib.php index fa76a8ea..d3aac1d2 100755 --- a/src/include/taglib/channel.lib.php +++ b/src/include/taglib/channel.lib.php @@ -1,51 +1,48 @@ CAttribute->Items,$attlist); + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = $ctag->GetInnerText(); $line = empty($row) ? 100 : $row; - + $likeType = ''; //读取固定的缓存块 $cacheid = trim($cacheid); - if($cacheid !='') { + if ($cacheid != '') { $likeType = GetCacheBlock($cacheid); - if($likeType != '') return $likeType; + if ($likeType != '') return $likeType; } $reid = 0; $topid = 0; //如果属性里没指定栏目id,从引用类里获取栏目信息 - if(empty($typeid)) - { - if( isset($refObj->TypeLink->TypeInfos['id']) ) - { + if (empty($typeid)) { + if (isset($refObj->TypeLink->TypeInfos['id'])) { $typeid = $refObj->TypeLink->TypeInfos['id']; $reid = $refObj->TypeLink->TypeInfos['reid']; $topid = $refObj->TypeLink->TypeInfos['topid']; + } else { + $typeid = 0; } - else { - $typeid = 0; - } } //如果指定了栏目id,从数据库获取栏目信息 - else - { + else { $row2 = $dsql->GetOne("SELECT * FROM `#@__arctype` WHERE id='$typeid' "); if (is_array($row2)) { @@ -55,102 +52,86 @@ function lib_channel(&$ctag,&$refObj) $issetInfos = true; } } - - if($type=='' || $type=='sun') $type='son'; - if($innertext=='') $innertext = GetSysTemplets("channel_list.htm"); - if($type=='top') - { + if ($type == '' || $type == 'sun') $type = 'son'; + if ($innertext == '') $innertext = GetSysTemplets("channel_list.htm"); + + if ($type == 'top') { $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath From `#@__arctype` WHERE reid=0 And ishidden<>1 order by sortrank asc limit 0, $line "; - } - else if($type=='son') - { - if($typeid==0) return ''; + } else if ($type == 'son') { + if ($typeid == 0) return ''; $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath From `#@__arctype` WHERE reid='$typeid' And ishidden<>1 order by sortrank asc limit 0, $line "; - } - else if($type=='self') - { - if($reid==0) return ''; + } else if ($type == 'self') { + if ($reid == 0) return ''; $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line "; } //And id<>'$typeid' $needRel = false; $dtp2 = new DedeTagParse(); - $dtp2->SetNameSpace('field','[',']'); + $dtp2->SetNameSpace('field', '[', ']'); $dtp2->LoadSource($innertext); //检查是否有子栏目,并返回rel提示(用于二级菜单) - if(preg_match('#:rel#', $innertext)) $needRel = true; - - if(empty($sql)) return ''; + if (preg_match('#:rel#', $innertext)) $needRel = true; + + if (empty($sql)) return ''; $dsql->SetQuery($sql); $dsql->Execute(); - + $totalRow = $dsql->GetTotalRow(); //如果用子栏目模式,当没有子栏目时显示同级栏目 - if($type=='son' && $reid!=0 && $totalRow==0) - { + if ($type == 'son' && $reid != 0 && $totalRow == 0) { $sql = "SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE reid='$reid' And ishidden<>1 order by sortrank asc limit 0, $line "; $dsql->SetQuery($sql); - $dsql->Execute(); + $dsql->Execute(); } $GLOBALS['autoindex'] = 0; - for($i=0;$i < $line;$i++) - { - if($col>1) $likeType .= "
      \r\n"; - for($j=0; $j<$col; $j++) - { - if($col>1) $likeType .= "
      \r\n"; - if($row=$dsql->GetArray()) - { + for ($i = 0; $i < $line; $i++) { + if ($col > 1) $likeType .= "
      \r\n"; + for ($j = 0; $j < $col; $j++) { + if ($col > 1) $likeType .= "
      \r\n"; + if ($row = $dsql->GetArray()) { $row['sonids'] = $row['rel'] = ''; - if($needRel) - { + if ($needRel) { $row['sonids'] = GetSonIds($row['id'], 0, false); - if($row['sonids']=='') $row['rel'] = ''; + if ($row['sonids'] == '') $row['rel'] = ''; else $row['rel'] = " rel='dropmenu{$row['id']}'"; } //处理同级栏目中,当前栏目的样式 - if( ($row['id']==$typeid || ($topid==$row['id'] && $type=='top') ) && $currentstyle!='' ) - { + if (($row['id'] == $typeid || ($topid == $row['id'] && $type == 'top')) && $currentstyle != '') { $linkOkstr = $currentstyle; $row['typelink'] = GetOneTypeUrlA($row); - $linkOkstr = str_replace("~rel~",$row['rel'],$linkOkstr); - $linkOkstr = str_replace("~id~",$row['id'],$linkOkstr); - $linkOkstr = str_replace("~typelink~",$row['typelink'],$linkOkstr); - $linkOkstr = str_replace("~typename~",$row['typename'],$linkOkstr); + $linkOkstr = str_replace("~rel~", $row['rel'], $linkOkstr); + $linkOkstr = str_replace("~id~", $row['id'], $linkOkstr); + $linkOkstr = str_replace("~typelink~", $row['typelink'], $linkOkstr); + $linkOkstr = str_replace("~typename~", $row['typename'], $linkOkstr); $likeType .= $linkOkstr; - } - else - { + } else { $row['typelink'] = $row['typeurl'] = GetOneTypeUrlA($row); - if(is_array($dtp2->CTags)) - { - foreach($dtp2->CTags as $tagid=>$ctag) - { - if(isset($row[$ctag->GetName()])) $dtp2->Assign($tagid,$row[$ctag->GetName()]); + if (is_array($dtp2->CTags)) { + foreach ($dtp2->CTags as $tagid => $ctag) { + if (isset($row[$ctag->GetName()])) $dtp2->Assign($tagid, $row[$ctag->GetName()]); } } $likeType .= $dtp2->GetResult(); } } - if($col>1) $likeType .= "
      \r\n"; + if ($col > 1) $likeType .= "
      \r\n"; $GLOBALS['autoindex']++; } //Loop Col - if($col>1) - { + if ($col > 1) { $i += $col - 1; $likeType .= "
      \r\n"; } } //Loop for $i $dsql->FreeResult(); - if($cacheid !='') { + if ($cacheid != '') { WriteCacheBlock($cacheid, $likeType); } return $likeType; -} \ No newline at end of file +} diff --git a/src/include/taglib/channel/img.lib.php b/src/include/taglib/channel/img.lib.php index 4eb92d84..4367f5de 100755 --- a/src/include/taglib/channel/img.lib.php +++ b/src/include/taglib/channel/img.lib.php @@ -1,25 +1,23 @@ LoadSource($fvalue); - if(!is_array($dtp->CTags)) - { + if (!is_array($dtp->CTags)) { $dtp->Clear(); return "无图片信息!"; } @@ -30,16 +28,14 @@ function ch_img($fvalue,&$arcTag,&$refObj,$fname='') $row = $cfg_album_row; $icol = $cfg_album_col; $ptag = $dtp->GetTag('pagestyle'); - if(is_object($ptag)) - { + if (is_object($ptag)) { $pagestyle = $ptag->GetAtt('value'); $maxwidth = $ptag->GetAtt('maxwidth'); $ddmaxwidth = $ptag->GetAtt('ddmaxwidth'); $pagepicnum = $ptag->GetAtt('pagepicnum'); $irow = $ptag->GetAtt('row'); $icol = $ptag->GetAtt('col'); - if(empty($maxwidth)) - { + if (empty($maxwidth)) { $maxwidth = $cfg_album_width; } } @@ -49,30 +45,22 @@ function ch_img($fvalue,&$arcTag,&$refObj,$fname='') $mcol = 0; $images = array(); $innerTmp = $arcTag->GetInnerText(); - if(trim($innerTmp)=='') - { + if (trim($innerTmp) == '') { $innerTmp = GetSysTemplets("channel_article_image.htm"); } - if($pagestyle==1) - { + if ($pagestyle == 1) { $pagesize = $pagepicnum; - } - else if($pagestyle==2) - { + } else if ($pagestyle == 2) { $pagesize = 1; - } - else - { + } else { $pagesize = $irow * $icol; } - if(is_object($arcTag) && $arcTag->GetAtt('pagesize') > 0) - { + if (is_object($arcTag) && $arcTag->GetAtt('pagesize') > 0) { $pagesize = $arcTag->GetAtt('pagesize'); } - if(empty($pagesize)) - { + if (empty($pagesize)) { $pagesize = 12; } $aid = $refObj->ArcID; @@ -80,82 +68,66 @@ function ch_img($fvalue,&$arcTag,&$refObj,$fname='') $title = $row['title']; $revalue = ''; $GLOBAL['photoid'] = 0; - foreach($dtp->CTags as $ctag) - { - if($ctag->GetName()=="img") - { + foreach ($dtp->CTags as $ctag) { + if ($ctag->GetName() == "img") { $fields = $ctag->CAttribute->Items; - $fields['text'] = str_replace("'","",$ctag->GetAtt('text')); + $fields['text'] = str_replace("'", "", $ctag->GetAtt('text')); $fields['title'] = $title; $fields['imgsrc'] = trim($ctag->GetInnerText()); $fields['imgsrctrue'] = $fields['imgsrc']; - if(empty($fields['ddimg'])) - { + if (empty($fields['ddimg'])) { $fields['ddimg'] = $fields['imgsrc']; } - if($cfg_multi_site=='Y') - { + if ($cfg_multi_site == 'Y') { //$cfg_basehost) - if( !preg_match('#^http:#i', $fields['imgsrc']) ) { - $fields['imgsrc'] = $cfg_basehost.$fields['imgsrc']; + if (!preg_match('#^http:#i', $fields['imgsrc'])) { + $fields['imgsrc'] = $cfg_basehost . $fields['imgsrc']; } - if( !preg_match('#^http:#i', $fields['ddimg']) ) { - $fields['ddimg'] = $cfg_basehost.$fields['ddimg']; + if (!preg_match('#^http:#i', $fields['ddimg'])) { + $fields['ddimg'] = $cfg_basehost . $fields['ddimg']; } } - if(empty($fields['width'])) - { + if (empty($fields['width'])) { $fields['width'] = $maxwidth; } //if($fields['text']=='') //{ - //$fields['text'] = '图片'.($GLOBAL['photoid']+1); + //$fields['text'] = '图片'.($GLOBAL['photoid']+1); //} - $fields['alttext'] = str_replace("'",'',$fields['text']); + $fields['alttext'] = str_replace("'", '', $fields['text']); $fields['pagestyle'] = $pagestyle; $dtp2 = new DedeTagParse(); - $dtp2->SetNameSpace("field","[","]"); + $dtp2->SetNameSpace("field", "[", "]"); $dtp2->LoadSource($innerTmp); - if($GLOBAL['photoid']>0 && ($GLOBAL['photoid'] % $pagesize)==0) - { + if ($GLOBAL['photoid'] > 0 && ($GLOBAL['photoid'] % $pagesize) == 0) { $revalue .= "#p#分页标题#e#"; } - if($pagestyle==1) - { + if ($pagestyle == 1) { $fields['imgwidth'] = ''; $fields['linkurl'] = $fields['imgsrc']; $fields['textlink'] = "
      {$fields['text']}"; - } - else if($pagestyle==2) - { - if($fields['width'] > $maxwidth) { + } else if ($pagestyle == 2) { + if ($fields['width'] > $maxwidth) { $fields['imgwidth'] = " width='$maxwidth' "; - } - else { + } else { $fields['imgwidth'] = " width='{$fields['width']}' "; } $fields['linkurl'] = $fields['imgsrc']; - if($fields['text']!='') { + if ($fields['text'] != '') { $fields['textlink'] = "
      {$fields['text']}\r\n"; - } - else { + } else { $fields['textlink'] = ''; } - } - else if($pagestyle==3) - { + } else if ($pagestyle == 3) { $fields['text'] = $fields['textlink'] = ''; $fields['imgsrc'] = $fields['ddimg']; $fields['imgwidth'] = " width='$ddmaxwidth' "; - $fields['linkurl'] = "{$GLOBALS['cfg_phpurl']}/showphoto.php?aid={$refObj->ArcID}&src=".urlencode($fields['imgsrctrue'])."&npos={$GLOBAL['photoid']}"; + $fields['linkurl'] = "{$GLOBALS['cfg_phpurl']}/showphoto.php?aid={$refObj->ArcID}&src=" . urlencode($fields['imgsrctrue']) . "&npos={$GLOBAL['photoid']}"; } - if(is_array($dtp2->CTags)) - { - foreach($dtp2->CTags as $tagid=>$ctag) - { - if(isset($fields[$ctag->GetName()])) - { - $dtp2->Assign($tagid,$fields[$ctag->GetName()]); + if (is_array($dtp2->CTags)) { + foreach ($dtp2->CTags as $tagid => $ctag) { + if (isset($fields[$ctag->GetName()])) { + $dtp2->Assign($tagid, $fields[$ctag->GetName()]); } } $revalue .= $dtp2->GetResult(); @@ -164,4 +136,4 @@ function ch_img($fvalue,&$arcTag,&$refObj,$fname='') } } return $revalue; -} \ No newline at end of file +} diff --git a/src/include/taglib/channel/softlinks.lib.php b/src/include/taglib/channel/softlinks.lib.php index 1a608c2a..f67236ee 100755 --- a/src/include/taglib/channel/softlinks.lib.php +++ b/src/include/taglib/channel/softlinks.lib.php @@ -1,10 +1,10 @@ GetOne("SELECT * FROM `#@__softconfig` "); $phppath = $GLOBALS['cfg_phpurl']; $downlinks = ''; - if($row['downtype']!='0' && !$downloadpage) - { + if ($row['downtype'] != '0' && !$downloadpage) { $tempStr = GetSysTemplets("channel_downlinkpage.htm"); - $links = $phppath."/download.php?open=0&aid=".$refObj->ArcID."&cid=".$refObj->ChannelID; + $links = $phppath . "/download.php?open=0&aid=" . $refObj->ArcID . "&cid=" . $refObj->ChannelID; $downlinks = str_replace("~link~", $links, $tempStr); return $downlinks; - } - else - { + } else { return ch_softlinks_all($fvalue, $ctag, $refObj, $row); } } @@ -45,58 +42,51 @@ function ch_softlinks_all($fvalue, &$ctag, &$refObj, &$row) global $cfg_phpurl; $phppath = $cfg_phpurl; $islinktype = false; - if(!empty($link_type)) $islinktype = true; + if (!empty($link_type)) $islinktype = true; $dtp = new DedeTagParse(); $dtp->LoadSource($fvalue); - if( !is_array($dtp->CTags) ) - { + if (!is_array($dtp->CTags)) { $dtp->Clear(); return "无链接信息!"; } // 去除链接信息 - if (!empty($row['sites'])) - { + if (!empty($row['sites'])) { $sertype_arr = array(); $row['sites'] = preg_replace("#[\r\n]{1,}#", "\n", $row['sites']); $sites = explode("\n", trim($row['sites'])); - foreach($sites as $site) - { - if(trim($site)=='') continue; - - @list($link,$serverName,$serverType) = explode('|', $site); + foreach ($sites as $site) { + if (trim($site) == '') continue; + + @list($link, $serverName, $serverType) = explode('|', $site); $sertype_arr[trim($serverName)] = trim($serverType); } } $tempStr = GetSysTemplets('channel_downlinks.htm'); $downlinks = ''; - foreach($dtp->CTags as $ctag) - { - if($ctag->GetName()=='link') - { + foreach ($dtp->CTags as $ctag) { + if ($ctag->GetName() == 'link') { $link = trim($ctag->GetInnerText()); $serverName = trim($ctag->GetAtt('text')); $islocal = trim($ctag->GetAtt('islocal')); if (isset($sertype_arr[$serverName]) && $islinktype && $sertype_arr[$serverName] != $link_type) continue; - + //分析本地链接 - if(!isset($firstLink) && $islocal==1) $firstLink = $link; - if($islocal==1 && $row['islocal'] != 1) continue; - + if (!isset($firstLink) && $islocal == 1) $firstLink = $link; + if ($islocal == 1 && $row['islocal'] != 1) continue; + //支持http,迅雷下载,ftp,flashget - if(!preg_match("#^http:\/\/|^thunder:\/\/|^ftp:\/\/|^flashget:\/\/#i", $link)) - { - $link = $GLOBALS['cfg_mainsite'].$link; + if (!preg_match("#^http:\/\/|^thunder:\/\/|^ftp:\/\/|^flashget:\/\/#i", $link)) { + $link = $GLOBALS['cfg_mainsite'] . $link; } $downloads = getDownloads($link); $uhash = substr(md5($link), 0, 24); - if($row['gotojump']==1) - { - $link = $phppath."/download.php?open=2&id={$refObj->ArcID}&uhash={$uhash}"; + if ($row['gotojump'] == 1) { + $link = $phppath . "/download.php?open=2&id={$refObj->ArcID}&uhash={$uhash}"; } - $temp = str_replace("~link~",$link,$tempStr); - $temp = str_replace("~server~",$serverName,$temp); - $temp = str_replace("~downloads~",$downloads,$temp); + $temp = str_replace("~link~", $link, $tempStr); + $temp = str_replace("~server~", $serverName, $temp); + $temp = str_replace("~downloads~", $downloads, $temp); $downlinks .= $temp; } } @@ -104,22 +94,19 @@ function ch_softlinks_all($fvalue, &$ctag, &$refObj, &$row) //获取镜像功能的地址 //必须设置为:[根据本地地址和服务器列表自动生成] 的情况 $linkCount = 1; - if($row['ismoresite']==1 && $row['moresitedo']==1 && trim($row['sites'])!='' && isset($firstLink)) - { + if ($row['ismoresite'] == 1 && $row['moresitedo'] == 1 && trim($row['sites']) != '' && isset($firstLink)) { $firstLink = preg_replace("#http:\/\/([^\/]*)\/#i", '/', $firstLink); - - foreach($sites as $site) - { - if(trim($site)=='') continue; - list($link,$serverName,$serverType) = explode('|', $site); + + foreach ($sites as $site) { + if (trim($site) == '') continue; + list($link, $serverName, $serverType) = explode('|', $site); if (!empty($link_type) && $link_type != trim($serverType)) continue; - - $link = trim( preg_replace("#\/$#", "", $link) ).$firstLink; + + $link = trim(preg_replace("#\/$#", "", $link)) . $firstLink; $downloads = getDownloads($link); $uhash = substr(md5($link), 0, 24); - if($row['gotojump']==1) - { - $link = $phppath."/download.php?open=2&id={$refObj->ArcID}&uhash={$uhash}"; + if ($row['gotojump'] == 1) { + $link = $phppath . "/download.php?open=2&id={$refObj->ArcID}&uhash={$uhash}"; } $temp = str_replace("~link~", $link, $tempStr); $temp = str_replace("~server~", $serverName, $temp); @@ -136,13 +123,10 @@ function getDownloads($url) $hash = md5($url); $query = "SELECT downloads FROM `#@__downloads` WHERE hash='$hash' "; $row = $dsql->GetOne($query); - if(is_array($row)) - { + if (is_array($row)) { $downloads = $row['downloads']; - } - else - { + } else { $downloads = 0; } return $downloads; -} \ No newline at end of file +} diff --git a/src/include/taglib/channel/specialtopic.lib.php b/src/include/taglib/channel/specialtopic.lib.php index eab8c66b..42ffcac2 100755 --- a/src/include/taglib/channel/specialtopic.lib.php +++ b/src/include/taglib/channel/specialtopic.lib.php @@ -1,31 +1,28 @@ -GetAtt('noteid'); $rvalue = ''; $tempStr = GetSysTemplets('channel_spec_note.htm'); $dtp = new DedeTagParse(); $dtp->LoadSource($noteinfo); - if(is_array($dtp->CTags)) - { - foreach($dtp->CTags as $k=>$ctag) - { + if (is_array($dtp->CTags)) { + foreach ($dtp->CTags as $k => $ctag) { $notename = $ctag->GetAtt('name'); //指定名称的专题节点 - if($noteid != '' && $ctag->GetAtt('noteid') != $noteid) - { + if ($noteid != '' && $ctag->GetAtt('noteid') != $noteid) { continue; } $isauto = $ctag->GetAtt('isauto'); @@ -33,30 +30,43 @@ function ch_specialtopic($noteinfo, $arcTag, $refObj, $fname='') $rownum = trim($ctag->GetAtt('rownum')); $keywords = ''; $stypeid = 0; - if(empty($rownum)) $rownum = 40; + if (empty($rownum)) $rownum = 40; //通过关键字和栏目ID自动获取模式 - if($isauto==1) - { + if ($isauto == 1) { $idlist = ''; $keywords = trim($ctag->GetAtt('keywords')); $stypeid = $ctag->GetAtt('typeid'); } - $listTemplet = trim($ctag->GetInnerText())!='' ? $ctag->GetInnerText() : GetSysTemplets('spec_arclist.htm'); - - $idvalue = lib_arclistDone - ( - $refObj, $ctag, $stypeid, $rownum, $ctag->GetAtt('col'), $ctag->GetAtt('titlelen'),$ctag->GetAtt('infolen'), - $ctag->GetAtt('imgwidth'), $ctag->GetAtt('imgheight'), 'all', 'default', $keywords, $listTemplet, 0, $idlist, - $ctag->GetAtt('channel'), '', $ctag->GetAtt('att') - ); + $listTemplet = trim($ctag->GetInnerText()) != '' ? $ctag->GetInnerText() : GetSysTemplets('spec_arclist.htm'); + + $idvalue = lib_arclistDone( + $refObj, + $ctag, + $stypeid, + $rownum, + $ctag->GetAtt('col'), + $ctag->GetAtt('titlelen'), + $ctag->GetAtt('infolen'), + $ctag->GetAtt('imgwidth'), + $ctag->GetAtt('imgheight'), + 'all', + 'default', + $keywords, + $listTemplet, + 0, + $idlist, + $ctag->GetAtt('channel'), + '', + $ctag->GetAtt('att') + ); $notestr = str_replace('~notename~', $notename, $tempStr); $notestr = str_replace('~spec_arclist~', $idvalue, $notestr); $rvalue .= $notestr; - if($noteid != '' && $ctag->GetAtt('noteid')==$noteid) break; + if ($noteid != '' && $ctag->GetAtt('noteid') == $noteid) break; } } $dtp->Clear(); return $rvalue; -} \ No newline at end of file +} diff --git a/src/include/taglib/channel/stepselect.lib.php b/src/include/taglib/channel/stepselect.lib.php index 71080ec6..f76c9e3b 100755 --- a/src/include/taglib/channel/stepselect.lib.php +++ b/src/include/taglib/channel/stepselect.lib.php @@ -1,67 +1,56 @@ =500) - { - if($evalue % 500 == 0) - { - return (isset($GLOBALS['em_'.$egroup.'s'][$evalue]) ? $GLOBALS['em_'.$egroup.'s'][$evalue] : ''); - } - else if (preg_match("#([0-9]{1,})\.([0-9]{1,})#", $evalue, $matchs)) - { + if ($evalue >= 500) { + if ($evalue % 500 == 0) { + return (isset($GLOBALS['em_' . $egroup . 's'][$evalue]) ? $GLOBALS['em_' . $egroup . 's'][$evalue] : ''); + } else if (preg_match("#([0-9]{1,})\.([0-9]{1,})#", $evalue, $matchs)) { $esonvalue = $matchs[1]; $etopvalue = $esonvalue - ($esonvalue % 500); $esecvalue = $evalue; - $GLOBALS['em_'.$egroup.'s'][$etopvalue] = empty($GLOBALS['em_'.$egroup.'s'][$etopvalue])? '' - : $GLOBALS['em_'.$egroup.'s'][$etopvalue]; - $GLOBALS['em_'.$egroup.'s'][$esonvalue] = empty($GLOBALS['em_'.$egroup.'s'][$esonvalue])? '' - : $GLOBALS['em_'.$egroup.'s'][$esonvalue]; - $GLOBALS['em_'.$egroup.'s'][$esecvalue] = empty($GLOBALS['em_'.$egroup.'s'][$esecvalue])? '' - : $GLOBALS['em_'.$egroup.'s'][$esecvalue]; - return $GLOBALS['em_'.$egroup.'s'][$etopvalue].' -- '.$GLOBALS['em_'.$egroup.'s'][$esonvalue].' -- '.$GLOBALS['em_'.$egroup.'s'][$esecvalue]; - } - else - { + $GLOBALS['em_' . $egroup . 's'][$etopvalue] = empty($GLOBALS['em_' . $egroup . 's'][$etopvalue]) ? '' + : $GLOBALS['em_' . $egroup . 's'][$etopvalue]; + $GLOBALS['em_' . $egroup . 's'][$esonvalue] = empty($GLOBALS['em_' . $egroup . 's'][$esonvalue]) ? '' + : $GLOBALS['em_' . $egroup . 's'][$esonvalue]; + $GLOBALS['em_' . $egroup . 's'][$esecvalue] = empty($GLOBALS['em_' . $egroup . 's'][$esecvalue]) ? '' + : $GLOBALS['em_' . $egroup . 's'][$esecvalue]; + return $GLOBALS['em_' . $egroup . 's'][$etopvalue] . ' -- ' . $GLOBALS['em_' . $egroup . 's'][$esonvalue] . ' -- ' . $GLOBALS['em_' . $egroup . 's'][$esecvalue]; + } else { $elimit = $evalue % 500; $erevalue = $evalue - $elimit; - $GLOBALS['em_'.$egroup.'s'][$erevalue] = empty($GLOBALS['em_'.$egroup.'s'][$erevalue])? '' - : $GLOBALS['em_'.$egroup.'s'][$erevalue]; - $GLOBALS['em_'.$egroup.'s'][$evalue] = empty($GLOBALS['em_'.$egroup.'s'][$evalue])? '' - : $GLOBALS['em_'.$egroup.'s'][$evalue]; - return $GLOBALS['em_'.$egroup.'s'][$erevalue].' -- '.$GLOBALS['em_'.$egroup.'s'][$evalue]; + $GLOBALS['em_' . $egroup . 's'][$erevalue] = empty($GLOBALS['em_' . $egroup . 's'][$erevalue]) ? '' + : $GLOBALS['em_' . $egroup . 's'][$erevalue]; + $GLOBALS['em_' . $egroup . 's'][$evalue] = empty($GLOBALS['em_' . $egroup . 's'][$evalue]) ? '' + : $GLOBALS['em_' . $egroup . 's'][$evalue]; + return $GLOBALS['em_' . $egroup . 's'][$erevalue] . ' -- ' . $GLOBALS['em_' . $egroup . 's'][$evalue]; } } -} \ No newline at end of file +} diff --git a/src/include/taglib/channelartlist.lib.php b/src/include/taglib/channelartlist.lib.php index 4cd8d385..94e49c40 100755 --- a/src/include/taglib/channelartlist.lib.php +++ b/src/include/taglib/channelartlist.lib.php @@ -1,81 +1,76 @@ -CAttribute->Items,$attlist); + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnerText()); $artlist = ''; //读取固定的缓存块 $cacheid = trim($cacheid); - if($cacheid !='') { + if ($cacheid != '') { $artlist = GetCacheBlock($cacheid); - if($artlist!='') return $artlist; + if ($artlist != '') return $artlist; } - - if(empty($typeid)) - { - $typeid = ( !empty($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : 0 ); + + if (empty($typeid)) { + $typeid = (!empty($refObj->TypeLink->TypeInfos['id']) ? $refObj->TypeLink->TypeInfos['id'] : 0); } - - if($innertext=='') $innertext = GetSysTemplets('part_channelartlist.htm'); + + if ($innertext == '') $innertext = GetSysTemplets('part_channelartlist.htm'); $totalnum = $row; - if(empty($totalnum)) $totalnum = 20; + if (empty($totalnum)) $totalnum = 20; //获得类别ID总数的信息 $typeids = array(); - if($typeid==0 || $typeid=='top') { + if ($typeid == 0 || $typeid == 'top') { $tpsql = " reid=0 AND ispart<>2 AND ishidden<>1 AND channeltype>0 "; - } - else - { - if(!preg_match('#,#', $typeid)) { + } else { + if (!preg_match('#,#', $typeid)) { $tpsql = " reid='$typeid' AND ispart<>2 AND ishidden<>1 "; - } - else { + } else { $tpsql = " id IN($typeid) AND ispart<>2 AND ishidden<>1 "; } } $dsql->SetQuery("SELECT id,typename,typedir,isdefault,ispart,defaultname,namerule2,moresite,siteurl,sitepath FROM `#@__arctype` WHERE $tpsql ORDER BY sortrank ASC LIMIT $totalnum"); $dsql->Execute(); - while($row = $dsql->GetArray()) { + while ($row = $dsql->GetArray()) { $typeids[] = $row; } - if(!isset($typeids[0])) return ''; + if (!isset($typeids[0])) return ''; $GLOBALS['itemindex'] = 0; $GLOBALS['itemparity'] = 1; - for($i=0;isset($typeids[$i]);$i++) - { + for ($i = 0; isset($typeids[$i]); $i++) { $GLOBALS['itemindex']++; $pv = new PartView($typeids[$i]['id']); $pv->Fields['typeurl'] = GetOneTypeUrlA($typeids[$i]); - $pv->SetTemplet($innertext,'string'); + $pv->SetTemplet($innertext, 'string'); $artlist .= $pv->GetResult(); - $GLOBALS['itemparity'] = ($GLOBALS['itemparity']==1 ? 2 : 1); + $GLOBALS['itemparity'] = ($GLOBALS['itemparity'] == 1 ? 2 : 1); } //注销环境变量,以防止后续调用中被使用 $GLOBALS['envs']['typeid'] = $_sys_globals['typeid']; $GLOBALS['envs']['reid'] = ''; - if($cacheid !='') { + if ($cacheid != '') { WriteCacheBlock($cacheid, $artlist); } return $artlist; -} \ No newline at end of file +} diff --git a/src/include/taglib/comment.lib.php b/src/include/taglib/comment.lib.php index 49c79f86..ef0ff028 100644 --- a/src/include/taglib/comment.lib.php +++ b/src/include/taglib/comment.lib.php @@ -3,7 +3,7 @@ * 用于注释的标签 * * @version $Id: comment.lib.php 1 9:29 2020年9月2日Z tianya $ - * @package DedeCMS.Taglib + * @package DedeBIZ.Taglib * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com @@ -14,4 +14,3 @@ function lib_comment(&$ctag, &$refObj) { return ""; } -?> \ No newline at end of file diff --git a/src/include/taglib/demotag.lib.php b/src/include/taglib/demotag.lib.php index 1f1720e1..8d3b5de5 100755 --- a/src/include/taglib/demotag.lib.php +++ b/src/include/taglib/demotag.lib.php @@ -1,33 +1,33 @@ CAttribute->Items,$attlist); + $attlist = "row|12,titlelen|24"; + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $revalue = ''; - + //你需编写的代码,不能用echo之类语法,把最终返回值传给$revalue //------------------------------------------------------ - + $revalue = 'Hello Word!'; - + //------------------------------------------------------ return $revalue; -} \ No newline at end of file +} diff --git a/src/include/taglib/feedback.lib.php b/src/include/taglib/feedback.lib.php index ab7a2832..a390e3a9 100755 --- a/src/include/taglib/feedback.lib.php +++ b/src/include/taglib/feedback.lib.php @@ -6,7 +6,7 @@ if (!defined('DEDEINC')) { * 调用最新评论 * * @version $Id: feedback.lib.php 1 9:29 2010年7月6日Z tianya $ - * @package DedeCMS.Taglib + * @package DedeBIZ.Taglib * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/include/taglib/flink.lib.php b/src/include/taglib/flink.lib.php index a09faa3f..9060023e 100755 --- a/src/include/taglib/flink.lib.php +++ b/src/include/taglib/flink.lib.php @@ -6,7 +6,7 @@ if (!defined('DEDEINC')) { * 友情链接 * * @version $Id: flink.lib.php 1 9:29 2010年7月6日Z tianya $ - * @package DedeCMS.Taglib + * @package DedeBIZ.Taglib * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/include/taglib/flinktype.lib.php b/src/include/taglib/flinktype.lib.php index fb5b8567..5aa493bf 100755 --- a/src/include/taglib/flinktype.lib.php +++ b/src/include/taglib/flinktype.lib.php @@ -1,66 +1,62 @@ CAttribute->Items,$attlist); + $attlist = "row|24,titlelen|24"; + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $totalrow = $row; $revalue = ''; - + $equery = "SELECT * FROM `#@__flinktype` order by id asc limit 0,$totalrow"; - if(trim($ctag->GetInnerText())=='') $innertext = "
    • [field:typename /]
    • "; + if (trim($ctag->GetInnerText()) == '') $innertext = "
    • [field:typename /]
    • "; else $innertext = $ctag->GetInnerText(); - if(!isset($type)) $type = ''; + if (!isset($type)) $type = ''; $dtp = new DedeTagParse(); - $dtp->SetNameSpace("dede","{","}"); + $dtp->SetNameSpace("dede", "{", "}"); $dtp->LoadString($innertext); - + $dsql->SetQuery($equery); $dsql->Execute(); $rs = ''; $row = array(); - while($dbrow=$dsql->GetObject()) - { + while ($dbrow = $dsql->GetObject()) { $row[] = $dbrow; } - $dedecms = new stdClass; - $dedecms->id = 999; - $dedecms->typename = '织梦链'; - if($type == 'dedecms') $row[] = $dedecms; - + $dedecms = new stdClass; + $dedecms->id = 999; + $dedecms->typename = '织梦链'; + if ($type == 'dedecms') $row[] = $dedecms; + foreach ($row as $key => $value) { - if (is_array($dtp->CTags)) - { + if (is_array($dtp->CTags)) { $GLOBALS['envs']['flinkid'] = $value->id; - foreach($dtp->CTags as $tagid=>$ctag) - { + foreach ($dtp->CTags as $tagid => $ctag) { $tagname = $ctag->GetName(); - if($tagname=="flink") $dtp->Assign($tagid, lib_flink($ctag, $refObj)); + if ($tagname == "flink") $dtp->Assign($tagid, lib_flink($ctag, $refObj)); } } $rs = $dtp->GetResult(); - $rs = preg_replace("/\[field:id([\/\s]{0,})\]/isU", $value->id, $rs); + $rs = preg_replace("/\[field:id([\/\s]{0,})\]/isU", $value->id, $rs); $rs = preg_replace("/\[field:typename([\/\s]{0,})\]/isU", $value->typename, $rs); $revalue .= $rs; } - + return $revalue; -} \ No newline at end of file +} diff --git a/src/include/taglib/hotwords.lib.php b/src/include/taglib/hotwords.lib.php index d69d4db2..1d407c8f 100755 --- a/src/include/taglib/hotwords.lib.php +++ b/src/include/taglib/hotwords.lib.php @@ -1,34 +1,35 @@ CAttribute->Items,$attlist); + $attlist = "num|6,subday|365,maxlength|16"; + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $nowtime = time(); - if(empty($subday)) $subday = 365; - if(empty($num)) $num = 6; - if(empty($maxlength)) $maxlength = 20; - $maxlength = $maxlength+1; + if (empty($subday)) $subday = 365; + if (empty($num)) $num = 6; + if (empty($maxlength)) $maxlength = 20; + $maxlength = $maxlength + 1; $mintime = $nowtime - ($subday * 24 * 3600); $dsql->SetQuery("SELECT keyword FROM `#@__search_keywords` WHERE lasttime>$mintime AND length(keyword)<$maxlength ORDER BY count DESC LIMIT 0,$num"); $dsql->Execute('hw'); $hotword = ''; - while($row=$dsql->GetArray('hw')){ - $hotword .= " ".$row['keyword']." "; + while ($row = $dsql->GetArray('hw')) { + $hotword .= " " . $row['keyword'] . " "; } return $hotword; -} \ No newline at end of file +} diff --git a/src/include/taglib/infoguide.lib.php b/src/include/taglib/infoguide.lib.php index 51092cf2..d6cad663 100755 --- a/src/include/taglib/infoguide.lib.php +++ b/src/include/taglib/infoguide.lib.php @@ -1,82 +1,75 @@ -CAttribute->Items,$attlist); //extract($ctag->CAttribute->Items, EXTR_SKIP); - - $cmspath = ( (empty($cfg_cmspath) || preg_match('#[/$]#', $cfg_cmspath)) ? $cfg_cmspath.'/' : $cfg_cmspath ); - - if(empty($refObj->Fields['typeid'])) - { + + $cmspath = ((empty($cfg_cmspath) || preg_match('#[/$]#', $cfg_cmspath)) ? $cfg_cmspath . '/' : $cfg_cmspath); + + if (empty($refObj->Fields['typeid'])) { $row = $dsql->GetOne("SELECT id FROM `#@__arctype` WHERE channeltype='-8' And reid = '0' "); $typeid = (is_array($row) ? $row['id'] : 0); - if(empty($typeid)) - { + if (empty($typeid)) { return '请指定一个栏目类型为“分类信息”,否则无法使用这个搜索表单!'; } - } - else - { + } else { $typeid = $refObj->Fields['typeid']; } - + $innerText = trim($ctag->GetInnerText()); - if(empty($innerText)) $innerText = GetSysTemplets("info_guide.htm"); + if (empty($innerText)) $innerText = GetSysTemplets("info_guide.htm"); $ctp = new DedeTagParse(); - $ctp->SetNameSpace('field','[',']'); + $ctp->SetNameSpace('field', '[', ']'); $ctp->LoadSource($innerText); $revalue = $seli = ''; - - $fields = array('nativeplace'=>'','infotype'=>'','typeid'=>$typeid); - - if($hasSetEnumJs !='has' ) - { - $revalue .= ''."\r\n"; + + $fields = array('nativeplace' => '', 'infotype' => '', 'typeid' => $typeid); + + if ($hasSetEnumJs != 'has') { + $revalue .= '' . "\r\n"; $GLOBALS['hasSetEnumJs'] = 'hasset'; } - + $fields['nativeplace'] = $fields['infotype'] = ''; - - if(empty($nativeplace)) $nativeplace = 0; - if(empty($infotype)) $infotype = 0; - + + if (empty($nativeplace)) $nativeplace = 0; + if (empty($infotype)) $infotype = 0; + $fields['nativeplace'] .= "\r\n"; $fields['nativeplace'] .= "地区:\r\n"; $fields['nativeplace'] .= "\r\n
      \r\n"; $fields['nativeplace'] .= "\r\n"; - $fields['nativeplace'] .= ''."\r\n"; - + $fields['nativeplace'] .= '' . "\r\n"; + $fields['infotype'] .= "\r\n"; $fields['infotype'] .= "类型:\r\n"; $fields['infotype'] .= "
      \r\n"; $fields['infotype'] .= "\r\n"; - $fields['infotype'] .= ''."\r\n"; - - if(is_array($ctp->CTags)) - { - foreach($ctp->CTags as $tagid=>$ctag) - { - if(isset($fields[$ctag->GetName()])) { - $ctp->Assign($tagid,$fields[$ctag->GetName()]); + $fields['infotype'] .= '' . "\r\n"; + + if (is_array($ctp->CTags)) { + foreach ($ctp->CTags as $tagid => $ctag) { + if (isset($fields[$ctag->GetName()])) { + $ctp->Assign($tagid, $fields[$ctag->GetName()]); } } $revalue .= $ctp->GetResult(); } - + return $revalue; -} \ No newline at end of file +} diff --git a/src/include/taglib/infolink.lib.php b/src/include/taglib/infolink.lib.php index 8ca755db..67e4a7c4 100755 --- a/src/include/taglib/infolink.lib.php +++ b/src/include/taglib/infolink.lib.php @@ -1,133 +1,118 @@ -CAttribute->Items,$attlist); //extract($ctag->CAttribute->Items, EXTR_SKIP); - - $cmspath = ( (empty($cfg_cmspath) || !preg_match("#\/$#", $cfg_cmspath)) ? $cfg_cmspath.'/' : $cfg_cmspath ); - $baseurl = preg_replace("#\/$#", '', $cfg_mainsite).$cmspath; - + + $cmspath = ((empty($cfg_cmspath) || !preg_match("#\/$#", $cfg_cmspath)) ? $cfg_cmspath . '/' : $cfg_cmspath); + $baseurl = preg_replace("#\/$#", '', $cfg_mainsite) . $cmspath; + $smalltypes = ''; - if( !empty($refObj->TypeLink->TypeInfos['smalltypes']) ) { + if (!empty($refObj->TypeLink->TypeInfos['smalltypes'])) { $smalltypes = explode(',', $refObj->TypeLink->TypeInfos['smalltypes']); } - - if(empty($refObj->Fields['typeid'])) { + + if (empty($refObj->Fields['typeid'])) { $row = $dsql->GetOne("SELECT id FROM `#@__arctype` WHERE channeltype='-8' And reid = '0' "); $typeid = (is_array($row) ? $row['id'] : 0); - } - else { + } else { $typeid = $refObj->Fields['typeid']; } - + $innerText = trim($ctag->GetInnerText()); - if(empty($innerText)) $innerText = GetSysTemplets("info_link.htm"); + if (empty($innerText)) $innerText = GetSysTemplets("info_link.htm"); $ctp = new DedeTagParse(); - $ctp->SetNameSpace('field','[',']'); + $ctp->SetNameSpace('field', '[', ']'); $ctp->LoadSource($innerText); $revalue = $seli = ''; - $channelid = ( empty($refObj->TypeLink->TypeInfos['channeltype']) ? -8 : $refObj->TypeLink->TypeInfos['channeltype'] ); - - $fields = array('nativeplace'=>'','infotype'=>'','typeid'=>$typeid, - 'channelid'=>$channelid,'linkallplace'=>'','linkalltype'=>''); - + $channelid = (empty($refObj->TypeLink->TypeInfos['channeltype']) ? -8 : $refObj->TypeLink->TypeInfos['channeltype']); + + $fields = array( + 'nativeplace' => '', 'infotype' => '', 'typeid' => $typeid, + 'channelid' => $channelid, 'linkallplace' => '', 'linkalltype' => '' + ); + $fields['nativeplace'] = $fields['infotype'] = ''; - + $fields['linkallplace'] = "不限"; $fields['linkalltype'] = "不限"; - + //地区链接 - if(empty($nativeplace)) - { - foreach($em_nativeplaces as $eid=>$em) - { - if($eid % 500 != 0) continue; + if (empty($nativeplace)) { + foreach ($em_nativeplaces as $eid => $em) { + if ($eid % 500 != 0) continue; $fields['nativeplace'] .= " {$em}\r\n"; } - } - else - { - $sontype = ( ($nativeplace % 500 != 0) ? $nativeplace : 0 ); - $toptype = ( ($nativeplace % 500 == 0) ? $nativeplace : ( $nativeplace-($nativeplace%500) ) ); - + } else { + $sontype = (($nativeplace % 500 != 0) ? $nativeplace : 0); + $toptype = (($nativeplace % 500 == 0) ? $nativeplace : ($nativeplace - ($nativeplace % 500))); + $fields['nativeplace'] = " {$em_nativeplaces[$toptype]} >> "; - foreach($em_nativeplaces as $eid=>$em) - { - if($eid < $toptype+1 || $eid > $toptype+499) continue; - if($eid == $nativeplace) { + foreach ($em_nativeplaces as $eid => $em) { + if ($eid < $toptype + 1 || $eid > $toptype + 499) continue; + if ($eid == $nativeplace) { $fields['nativeplace'] .= " {$em}\r\n"; - } - else { + } else { $fields['nativeplace'] .= " {$em}\r\n"; - } - } + } + } } //小分类链接 - if(empty($infotype) || is_array($smalltypes)) - { - - foreach($em_infotypes as $eid=>$em) - { - if(!is_array($smalltypes) && $eid % 500 != 0) continue; - if(is_array($smalltypes) && !in_array($eid, $smalltypes)) continue; - if($eid == $infotype) - { + if (empty($infotype) || is_array($smalltypes)) { + + foreach ($em_infotypes as $eid => $em) { + if (!is_array($smalltypes) && $eid % 500 != 0) continue; + if (is_array($smalltypes) && !in_array($eid, $smalltypes)) continue; + if ($eid == $infotype) { $fields['infotype'] .= " {$em}\r\n"; - } - else { + } else { $fields['infotype'] .= " {$em}\r\n"; } } - } - else - { - $sontype = ( ($infotype % 500 != 0) ? $infotype : 0 ); - $toptype = ( ($infotype % 500 == 0) ? $infotype : ( $infotype-($infotype%500) ) ); + } else { + $sontype = (($infotype % 500 != 0) ? $infotype : 0); + $toptype = (($infotype % 500 == 0) ? $infotype : ($infotype - ($infotype % 500))); $fields['infotype'] .= "{$em_infotypes[$toptype]} >> "; - foreach($em_infotypes as $eid=>$em) - { - if($eid < $toptype+1 || $eid > $toptype+499) continue; - if($eid == $infotype) { + foreach ($em_infotypes as $eid => $em) { + if ($eid < $toptype + 1 || $eid > $toptype + 499) continue; + if ($eid == $infotype) { $fields['infotype'] .= " {$em}\r\n"; - } - else { + } else { $fields['infotype'] .= " {$em}\r\n"; - } - } + } + } } - - - if(is_array($ctp->CTags)) - { - foreach($ctp->CTags as $tagid=>$ctag) - { - if(isset($fields[$ctag->GetName()])) { - $ctp->Assign($tagid,$fields[$ctag->GetName()]); + + + if (is_array($ctp->CTags)) { + foreach ($ctp->CTags as $tagid => $ctag) { + if (isset($fields[$ctag->GetName()])) { + $ctp->Assign($tagid, $fields[$ctag->GetName()]); } } $revalue .= $ctp->GetResult(); } - + return $revalue; -} \ No newline at end of file +} diff --git a/src/include/taglib/likearticle.lib.php b/src/include/taglib/likearticle.lib.php index 3fd115e4..0d1127bc 100755 --- a/src/include/taglib/likearticle.lib.php +++ b/src/include/taglib/likearticle.lib.php @@ -1,110 +1,100 @@ -CAttribute->Items,$attlist); + $attlist = "row|12,titlelen|28,infolen|150,col|1,tablewidth|100,mytypeid|0,byabs|0,imgwidth|120,imgheight|90"; + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $revalue = ''; - - if(empty($tablewidth)) $tablewidth = 100; - if(empty($col)) $col = 1; - $colWidth = ceil(100/$col); - $tablewidth = $tablewidth."%"; - $colWidth = $colWidth."%"; - + + if (empty($tablewidth)) $tablewidth = 100; + if (empty($col)) $col = 1; + $colWidth = ceil(100 / $col); + $tablewidth = $tablewidth . "%"; + $colWidth = $colWidth . "%"; + $ids = array(); $tids = array(); - - if(!empty($refObj->Fields['tags'])) { + + if (!empty($refObj->Fields['tags'])) { $keyword = $refObj->Fields['tags']; + } else { + $keyword = (!empty($refObj->Fields['keywords']) ? $refObj->Fields['keywords'] : ''); } - else { - $keyword = ( !empty($refObj->Fields['keywords']) ? $refObj->Fields['keywords'] : '' ); - } - - $typeid = ( !empty($mytypeid) ? $mytypeid : 0 ); - if(empty($typeid)) - { - if(!empty($refObj->Typelink->TypeInfos['reid'])) { - $typeid = $refObj->Typelink->TypeInfos['reid']; - } - else { - if(!empty($refObj->Fields['typeid'])) $typeid = $refObj->Fields['typeid']; + + $typeid = (!empty($mytypeid) ? $mytypeid : 0); + if (empty($typeid)) { + if (!empty($refObj->Typelink->TypeInfos['reid'])) { + $typeid = $refObj->Typelink->TypeInfos['reid']; + } else { + if (!empty($refObj->Fields['typeid'])) $typeid = $refObj->Fields['typeid']; } } - - if( !empty($typeid) && !preg_match('#,#', $typeid) ) { + + if (!empty($typeid) && !preg_match('#,#', $typeid)) { $typeid = GetSonIds($typeid); } - + $limitRow = $row - count($ids); $keyword = ''; - if(!empty($refObj->Fields['keywords'])) - { - $keywords = explode(',' , trim($refObj->Fields['keywords'])); - $keyword = ''; - $n = 1; - foreach($keywords as $k) - { - if($n > 3) break; - - if(trim($k)=='') continue; - else $k = addslashes($k); - - $keyword .= ($keyword=='' ? " CONCAT(arc.keywords,' ',arc.title) LIKE '%$k%' " : " OR CONCAT(arc.keywords,' ',arc.title) LIKE '%$k%' "); - $n++; - } + if (!empty($refObj->Fields['keywords'])) { + $keywords = explode(',', trim($refObj->Fields['keywords'])); + $keyword = ''; + $n = 1; + foreach ($keywords as $k) { + if ($n > 3) break; + + if (trim($k) == '') continue; + else $k = addslashes($k); + + $keyword .= ($keyword == '' ? " CONCAT(arc.keywords,' ',arc.title) LIKE '%$k%' " : " OR CONCAT(arc.keywords,' ',arc.title) LIKE '%$k%' "); + $n++; + } } $arcid = (!empty($refObj->Fields['id']) ? $refObj->Fields['aid'] : 0); - if( empty($arcid) || $byabs==0 ) - { - $orderquery = " ORDER BY arc.id desc "; + if (empty($arcid) || $byabs == 0) { + $orderquery = " ORDER BY arc.id desc "; + } else { + $orderquery = " ORDER BY ABS(arc.id - " . $arcid . ") "; } - else { - $orderquery = " ORDER BY ABS(arc.id - ".$arcid.") "; - } - if($keyword != '') - { - if(!empty($typeid)) { - $typeid = " AND arc.typeid IN($typeid) AND arc.id<>$arcid "; - } - $query = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule, + if ($keyword != '') { + if (!empty($typeid)) { + $typeid = " AND arc.typeid IN($typeid) AND arc.id<>$arcid "; + } + $query = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule, tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id where arc.arcrank>-1 AND ($keyword) $typeid $orderquery limit 0, $row"; - } - else - { - if(!empty($typeid)) { - $typeid = " arc.typeid IN($typeid) AND arc.id<>$arcid "; - } - $query = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule, + } else { + if (!empty($typeid)) { + $typeid = " arc.typeid IN($typeid) AND arc.id<>$arcid "; + } + $query = "SELECT arc.*,tp.typedir,tp.typename,tp.corank,tp.isdefault,tp.defaultname,tp.namerule, tp.namerule2,tp.ispart,tp.moresite,tp.siteurl,tp.sitepath FROM `#@__archives` arc LEFT JOIN `#@__arctype` tp ON arc.typeid=tp.id WHERE arc.arcrank>-1 AND $typeid $orderquery limit 0, $row"; } - - $innertext = trim( $ctag->GetInnerText() ); - if($innertext=='') $innertext = GetSysTemplets('part_arclist.htm'); + + $innertext = trim($ctag->GetInnerText()); + if ($innertext == '') $innertext = GetSysTemplets('part_arclist.htm'); $dsql->SetQuery($query); $dsql->Execute('al'); $artlist = ''; - if($col > 1) { + if ($col > 1) { $artlist = "\r\n"; } $dtp2 = new DedeTagParse(); @@ -112,82 +102,94 @@ function lib_likearticle(&$ctag,&$refObj) $dtp2->LoadString($innertext); $GLOBALS['autoindex'] = 0; $line = $row; - for($i=0; $i < $line; $i++) - { - if($col>1) $artlist .= "\r\n"; - for($j=0; $j < $col; $j++) - { - if($col>1) $artlist .= " \r\n"; + for ($j = 0; $j < $col; $j++) { + if ($col > 1) $artlist .= " \r\n"; + if ($col > 1) $artlist .= " \r\n"; } //Loop Col - if($col>1) $i += $col - 1; - if($col>1) $artlist .= " \r\n"; + if ($col > 1) $i += $col - 1; + if ($col > 1) $artlist .= " \r\n"; } //loop line - if($col>1) $artlist .= "
      \r\n"; - if($row = $dsql->GetArray("al")) - { + for ($i = 0; $i < $line; $i++) { + if ($col > 1) $artlist .= "
      \r\n"; + if ($row = $dsql->GetArray("al")) { $ids[] = $row['id']; //处理一些特殊字段 - $row['info'] = $row['infos'] = cn_substr($row['description'],$infolen); + $row['info'] = $row['infos'] = cn_substr($row['description'], $infolen); $row['id'] = $row['id']; - if($row['corank'] > 0 && $row['arcrank']==0) - { + if ($row['corank'] > 0 && $row['arcrank'] == 0) { $row['arcrank'] = $row['corank']; } - $row['filename'] = $row['arcurl'] = GetFileUrl($row['id'],$row['typeid'],$row['senddate'],$row['title'],$row['ismake'], - $row['arcrank'],$row['namerule'],$row['typedir'],$row['money'],$row['filename'],$row['moresite'],$row['siteurl'],$row['sitepath']); + $row['filename'] = $row['arcurl'] = GetFileUrl( + $row['id'], + $row['typeid'], + $row['senddate'], + $row['title'], + $row['ismake'], + $row['arcrank'], + $row['namerule'], + $row['typedir'], + $row['money'], + $row['filename'], + $row['moresite'], + $row['siteurl'], + $row['sitepath'] + ); - $row['typeurl'] = GetTypeUrl($row['typeid'],$row['typedir'],$row['isdefault'],$row['defaultname'],$row['ispart'], - $row['namerule2'],$row['moresite'],$row['siteurl'],$row['sitepath']); + $row['typeurl'] = GetTypeUrl( + $row['typeid'], + $row['typedir'], + $row['isdefault'], + $row['defaultname'], + $row['ispart'], + $row['namerule2'], + $row['moresite'], + $row['siteurl'], + $row['sitepath'] + ); - if($row['litpic'] == '-' || $row['litpic'] == '') - { - $row['litpic'] = $GLOBALS['cfg_cmspath'].'/static/defaultpic.gif'; + if ($row['litpic'] == '-' || $row['litpic'] == '') { + $row['litpic'] = $GLOBALS['cfg_cmspath'] . '/static/defaultpic.gif'; } - if(!preg_match("#^http:\/\/#i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') - { - $row['litpic'] = $GLOBALS['cfg_mainsite'].$row['litpic']; + if (!preg_match("#^http:\/\/#i", $row['litpic']) && $GLOBALS['cfg_multi_site'] == 'Y') { + $row['litpic'] = $GLOBALS['cfg_mainsite'] . $row['litpic']; } $row['picname'] = $row['litpic']; $row['stime'] = GetDateMK($row['pubdate']); - $row['typelink'] = "".$row['typename'].""; - $row['image'] = "".preg_replace("#[<]#","",$row['title'])."'>"; - $row['imglink'] = "".$row['image'].""; + $row['typelink'] = "" . $row['typename'] . ""; + $row['image'] = "" . preg_replace("#[<]#", "", $row['title']) . "'>"; + $row['imglink'] = "" . $row['image'] . ""; $row['fulltitle'] = $row['title']; $row['title'] = cn_substr($row['title'], $titlelen); - if($row['color']!='') $row['title'] = "".$row['title'].""; - if(preg_match('#b#', $row['flag'])) $row['title'] = "".$row['title'].""; - $row['textlink'] = "".$row['title'].""; + if ($row['color'] != '') $row['title'] = "" . $row['title'] . ""; + if (preg_match('#b#', $row['flag'])) $row['title'] = "" . $row['title'] . ""; + $row['textlink'] = "" . $row['title'] . ""; $row['plusurl'] = $row['phpurl'] = $GLOBALS['cfg_phpurl']; $row['memberurl'] = $GLOBALS['cfg_memberurl']; $row['templeturl'] = $GLOBALS['cfg_templeturl']; - - if(is_array($dtp2->CTags)) - { - foreach($dtp2->CTags as $k=>$ctag) - { - if($ctag->GetName()=='array') { - $dtp2->Assign($k,$row); - } - else { - if(isset($row[$ctag->GetName()])) $dtp2->Assign($k,$row[$ctag->GetName()]); - else $dtp2->Assign($k,''); + + if (is_array($dtp2->CTags)) { + foreach ($dtp2->CTags as $k => $ctag) { + if ($ctag->GetName() == 'array') { + $dtp2->Assign($k, $row); + } else { + if (isset($row[$ctag->GetName()])) $dtp2->Assign($k, $row[$ctag->GetName()]); + else $dtp2->Assign($k, ''); } } $GLOBALS['autoindex']++; } - $artlist .= $dtp2->GetResult()."\r\n"; + $artlist .= $dtp2->GetResult() . "\r\n"; } //if hasRow - else - { + else { $artlist .= ''; } - if($col>1) $artlist .= "
      \r\n"; + if ($col > 1) $artlist .= " \r\n"; $dsql->FreeResult("al"); return $artlist; -} \ No newline at end of file +} diff --git a/src/include/taglib/likepage.lib.php b/src/include/taglib/likepage.lib.php index 929eec04..14b1da3f 100755 --- a/src/include/taglib/likepage.lib.php +++ b/src/include/taglib/likepage.lib.php @@ -1,19 +1,20 @@ CAttribute->Items 获得,这样也可以支持中文名 - $attlist="row|8"; - FillAttsDefault($ctag->CAttribute->Items,$attlist); + $attlist = "row|8"; + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnerText()); $aid = (isset($refObj->Fields['aid']) ? $refObj->Fields['aid'] : 0); $revalue = ''; - if($innertext=='') $innertext = GetSysTemplets("part_likesgpage.htm"); + if ($innertext == '') $innertext = GetSysTemplets("part_likesgpage.htm"); $likeid = (empty($refObj->Fields['likeid']) ? 'all' : $refObj->Fields['likeid']); $dsql->SetQuery("SELECT aid,title,filename FROM `#@__sgpage` WHERE likeid LIKE '$likeid' LIMIT 0,$row"); $dsql->Execute(); $ctp = new DedeTagParse(); - $ctp->SetNameSpace('field','[',']'); + $ctp->SetNameSpace('field', '[', ']'); $ctp->LoadSource($innertext); - while($row = $dsql->GetArray()) - { - if($aid != $row['aid']) - { - $row['url'] = $GLOBALS['cfg_cmsurl'].'/'.$row['filename']; - foreach($ctp->CTags as $tagid=>$ctag) { - if(!empty($row[$ctag->GetName()])) $ctp->Assign($tagid,$row[$ctag->GetName()]); + while ($row = $dsql->GetArray()) { + if ($aid != $row['aid']) { + $row['url'] = $GLOBALS['cfg_cmsurl'] . '/' . $row['filename']; + foreach ($ctp->CTags as $tagid => $ctag) { + if (!empty($row[$ctag->GetName()])) $ctp->Assign($tagid, $row[$ctag->GetName()]); } $revalue .= $ctp->GetResult(); - } - else - { - $revalue .= '
      '.$row['title'].'
      '; + } else { + $revalue .= '
      ' . $row['title'] . '
      '; } } return $revalue; -} \ No newline at end of file +} diff --git a/src/include/taglib/loop.lib.php b/src/include/taglib/loop.lib.php index a8fb8391..c87a0070 100755 --- a/src/include/taglib/loop.lib.php +++ b/src/include/taglib/loop.lib.php @@ -1,56 +1,50 @@ CAttribute->Items,$attlist); + $attlist = "table|,tablename|,row|8,sort|,if|,ifcase|,orderway|desc"; + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnertext()); $revalue = ''; - if(!empty($table)) $tablename = $table; + if (!empty($table)) $tablename = $table; - if($tablename==''||$innertext=='') return ''; - if($if!='') $ifcase = $if; + if ($tablename == '' || $innertext == '') return ''; + if ($if != '') $ifcase = $if; - if($sort!='') $sort = " ORDER BY $sort $orderway "; - if($ifcase!='') $ifcase=" WHERE $ifcase "; + if ($sort != '') $sort = " ORDER BY $sort $orderway "; + if ($ifcase != '') $ifcase = " WHERE $ifcase "; $dsql->SetQuery("SELECT * FROM $tablename $ifcase $sort LIMIT 0,$row"); $dsql->Execute(); $ctp = new DedeTagParse(); - $ctp->SetNameSpace("field","[","]"); + $ctp->SetNameSpace("field", "[", "]"); $ctp->LoadSource($innertext); $GLOBALS['autoindex'] = 0; - while($row = $dsql->GetArray()) - { + while ($row = $dsql->GetArray()) { $GLOBALS['autoindex']++; - foreach($ctp->CTags as $tagid=>$ctag) - { - if($ctag->GetName()=='array') - { - $ctp->Assign($tagid, $row); - } - else - { - if( !empty($row[$ctag->GetName()])) $ctp->Assign($tagid,$row[$ctag->GetName()]); - } + foreach ($ctp->CTags as $tagid => $ctag) { + if ($ctag->GetName() == 'array') { + $ctp->Assign($tagid, $row); + } else { + if (!empty($row[$ctag->GetName()])) $ctp->Assign($tagid, $row[$ctag->GetName()]); + } } $revalue .= $ctp->GetResult(); } return $revalue; -} \ No newline at end of file +} diff --git a/src/include/taglib/memberlist.lib.php b/src/include/taglib/memberlist.lib.php index d3faa8f1..ef41aacc 100755 --- a/src/include/taglib/memberlist.lib.php +++ b/src/include/taglib/memberlist.lib.php @@ -1,54 +1,54 @@ CAttribute->Items,$attlist); + global $dsql, $sqlCt; + $attlist = "row|6,iscommend|0,orderby|logintime,signlen|50"; + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $revalue = ''; $innerText = trim($ctag->GetInnerText()); - if(empty($innerText)) $innerText = GetSysTemplets('memberlist.htm'); + if (empty($innerText)) $innerText = GetSysTemplets('memberlist.htm'); $wheresql = ' WHERE mb.spacesta>-1 AND mb.matt<10 '; - if($iscommend > 0) $wheresql .= " AND mb.matt='$iscommend' "; + if ($iscommend > 0) $wheresql .= " AND mb.matt='$iscommend' "; $sql = "SELECT mb.*,ms.spacename,ms.sign FROM `#@__member` mb LEFT JOIN `#@__member_space` ms ON ms.mid = mb.mid $wheresql order by mb.{$orderby} DESC LIMIT 0,$row "; - + $ctp = new DedeTagParse(); - $ctp->SetNameSpace('field','[',']'); + $ctp->SetNameSpace('field', '[', ']'); $ctp->LoadSource($innerText); - $dsql->Execute('mb',$sql); - while($row = $dsql->GetArray('mb')) - { - $row['spaceurl'] = $GLOBALS['cfg_basehost'].'/member/index.php?uid='.$row['userid']; - if(empty($row['face'])){ - $row['face']=($row['sex']=='女')? $GLOBALS['cfg_memberurl'].'/templets/images/dfgirl.png' : $GLOBALS['cfg_memberurl'].'/templets/images/dfboy.png'; + $dsql->Execute('mb', $sql); + while ($row = $dsql->GetArray('mb')) { + $row['spaceurl'] = $GLOBALS['cfg_basehost'] . '/member/index.php?uid=' . $row['userid']; + if (empty($row['face'])) { + $row['face'] = ($row['sex'] == '女') ? $GLOBALS['cfg_memberurl'] . '/templets/images/dfgirl.png' : $GLOBALS['cfg_memberurl'] . '/templets/images/dfboy.png'; } - foreach($ctp->CTags as $tagid=>$ctag){ - if(isset($row[$ctag->GetName()])){ $ctp->Assign($tagid,$row[$ctag->GetName()]); } + foreach ($ctp->CTags as $tagid => $ctag) { + if (isset($row[$ctag->GetName()])) { + $ctp->Assign($tagid, $row[$ctag->GetName()]); + } } $revalue .= $ctp->GetResult(); } - + return $revalue; -} \ No newline at end of file +} diff --git a/src/include/taglib/myad.lib.php b/src/include/taglib/myad.lib.php index 6df0107c..1bbee665 100755 --- a/src/include/taglib/myad.lib.php +++ b/src/include/taglib/myad.lib.php @@ -1,23 +1,23 @@ -CAttribute->Items,$attlist); + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $body = lib_GetMyTagT($refObj, $typeid, $name, '#@__myad'); - + return $body; -} \ No newline at end of file +} diff --git a/src/include/taglib/mynews.lib.php b/src/include/taglib/mynews.lib.php index fa77d546..aff4fd09 100755 --- a/src/include/taglib/mynews.lib.php +++ b/src/include/taglib/mynews.lib.php @@ -1,42 +1,42 @@ CAttribute->Items,$attlist); + $attlist = "row|1,titlelen|24"; + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); $innertext = trim($ctag->GetInnerText()); - if(empty($row)) $row=1; - if(empty($titlelen)) $titlelen=30; - if(empty($innertext)) $innertext = GetSysTemplets('mynews.htm'); + if (empty($row)) $row = 1; + if (empty($titlelen)) $titlelen = 30; + if (empty($innertext)) $innertext = GetSysTemplets('mynews.htm'); $idsql = ''; - if($envs['typeid'] > 0) $idsql = " WHERE typeid='".GetTopid($this->TypeID)."' "; + if ($envs['typeid'] > 0) $idsql = " WHERE typeid='" . GetTopid($this->TypeID) . "' "; $dsql->SetQuery("SELECT * FROM #@__mynews $idsql ORDER BY senddate DESC LIMIT 0,$row"); $dsql->Execute(); $ctp = new DedeTagParse(); - $ctp->SetNameSpace('field','[',']'); + $ctp->SetNameSpace('field', '[', ']'); $ctp->LoadSource($innertext); $revalue = ''; - while($row = $dsql->GetArray()) - { - foreach($ctp->CTags as $tagid=>$ctag){ - @$ctp->Assign($tagid,$row[$ctag->GetName()]); + while ($row = $dsql->GetArray()) { + foreach ($ctp->CTags as $tagid => $ctag) { + @$ctp->Assign($tagid, $row[$ctag->GetName()]); } $revalue .= $ctp->GetResult(); } return $revalue; -} \ No newline at end of file +} diff --git a/src/include/taglib/mytag.lib.php b/src/include/taglib/mytag.lib.php index a7b82ce1..e8ca4935 100755 --- a/src/include/taglib/mytag.lib.php +++ b/src/include/taglib/mytag.lib.php @@ -1,56 +1,54 @@ -CAttribute->Items,$attlist); + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); - if(trim($ismake)=='') $ismake = 'no'; + if (trim($ismake) == '') $ismake = 'no'; $body = lib_GetMyTagT($refObj, $typeid, $name, '#@__mytag'); //编译 - if($ismake=='yes') - { - require_once(DEDEINC.'/arc.partview.class.php'); + if ($ismake == 'yes') { + require_once(DEDEINC . '/arc.partview.class.php'); $pvCopy = new PartView($typeid); - $pvCopy->SetTemplet($body,"string"); + $pvCopy->SetTemplet($body, "string"); $body = $pvCopy->GetResult(); } return $body; } -function lib_GetMyTagT(&$refObj, $typeid,$tagname,$tablename) +function lib_GetMyTagT(&$refObj, $typeid, $tagname, $tablename) { global $dsql; - if($tagname=='') return ''; - if(trim($typeid)=='') $typeid=0; - if( !empty($refObj->Fields['typeid']) && $typeid==0) $typeid = $refObj->Fields['typeid']; - + if ($tagname == '') return ''; + if (trim($typeid) == '') $typeid = 0; + if (!empty($refObj->Fields['typeid']) && $typeid == 0) $typeid = $refObj->Fields['typeid']; + $typesql = $row = ''; - if($typeid > 0) $typesql = " And typeid IN(0,".GetTopids($typeid).") "; - + if ($typeid > 0) $typesql = " And typeid IN(0," . GetTopids($typeid) . ") "; + $row = $dsql->GetOne(" SELECT * FROM $tablename WHERE tagname LIKE '$tagname' $typesql ORDER BY typeid DESC "); - if(!is_array($row)) return ''; + if (!is_array($row)) return ''; $nowtime = time(); - if($row['timeset']==1 - && ($nowtime<$row['starttime'] || $nowtime>$row['endtime']) ) - { + if ( + $row['timeset'] == 1 + && ($nowtime < $row['starttime'] || $nowtime > $row['endtime']) + ) { $body = $row['expbody']; - } - else - { + } else { $body = $row['normbody']; } - + return $body; -} \ No newline at end of file +} diff --git a/src/include/taglib/php.lib.php b/src/include/taglib/php.lib.php index 36b591c7..5188989c 100755 --- a/src/include/taglib/php.lib.php +++ b/src/include/taglib/php.lib.php @@ -5,12 +5,12 @@ if (!defined('DEDEINC')) * * * @version $Id: php.lib.php1 9:29 2010年7月6日Z tianya $ - * @package DedeCMS.Taglib + * @package DedeBIZ.Taglib * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ - + function lib_php(&$ctag, &$refObj) { global $dsql; @@ -24,4 +24,4 @@ function lib_php(&$ctag, &$refObj) $revalue = ob_get_contents(); ob_clean(); return $revalue; -} \ No newline at end of file +} diff --git a/src/include/taglib/productimagelist.lib.php b/src/include/taglib/productimagelist.lib.php index 2e10717f..549f7ab3 100755 --- a/src/include/taglib/productimagelist.lib.php +++ b/src/include/taglib/productimagelist.lib.php @@ -4,35 +4,32 @@ * * * @version $Id: productimagelist.lib.php 1 9:29 2010年7月6日Z tianya $ - * @package DedeCMS.Taglib + * @package DedeBIZ.Taglib * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com */ - + function lib_productimagelist(&$ctag, &$refObj) { - global $dsql,$sqlCt; - $attlist="desclen|80"; - FillAttsDefault($ctag->CAttribute->Items,$attlist); + global $dsql, $sqlCt; + $attlist = "desclen|80"; + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); - if(!isset($refObj->addTableRow['imgurls'])) return ; - + if (!isset($refObj->addTableRow['imgurls'])) return; + $revalue = ''; $innerText = trim($ctag->GetInnerText()); - if(empty($innerText)) $innerText = GetSysTemplets('productimagelist.htm'); - + if (empty($innerText)) $innerText = GetSysTemplets('productimagelist.htm'); + $dtp = new DedeTagParse(); $dtp->LoadSource($refObj->addTableRow['imgurls']); - + $images = array(); - if(is_array($dtp->CTags)) - { - foreach($dtp->CTags as $ctag) - { - if($ctag->GetName()=="img") - { + if (is_array($dtp->CTags)) { + foreach ($dtp->CTags as $ctag) { + if ($ctag->GetName() == "img") { $row = array(); $row['imgsrc'] = trim($ctag->GetInnerText()); $row['text'] = $ctag->GetAtt('text'); @@ -44,16 +41,16 @@ function lib_productimagelist(&$ctag, &$refObj) $revalue = ''; $ctp = new DedeTagParse(); - $ctp->SetNameSpace('field','[',']'); + $ctp->SetNameSpace('field', '[', ']'); $ctp->LoadSource($innerText); - foreach($images as $row) - { - foreach($ctp->CTags as $tagid=>$ctag) - { - if(isset($row[$ctag->GetName()])){ $ctp->Assign($tagid,$row[$ctag->GetName()]); } + foreach ($images as $row) { + foreach ($ctp->CTags as $tagid => $ctag) { + if (isset($row[$ctag->GetName()])) { + $ctp->Assign($tagid, $row[$ctag->GetName()]); + } } $revalue .= $ctp->GetResult(); } return $revalue; -} \ No newline at end of file +} diff --git a/src/include/taglib/qrcode.lib.php b/src/include/taglib/qrcode.lib.php index aff9e741..d4124a7e 100755 --- a/src/include/taglib/qrcode.lib.php +++ b/src/include/taglib/qrcode.lib.php @@ -1,47 +1,42 @@ -CAttribute->Items,$attlist); + $attlist = "type|,id|"; + FillAttsDefault($ctag->CAttribute->Items, $attlist); extract($ctag->CAttribute->Items, EXTR_SKIP); //var_dump($refObj->Fields['id']); - if ( empty($type) AND empty($id) ) - { - if ( get_class ($refObj) == 'Archives' ) - { + if (empty($type) and empty($id)) { + if (get_class($refObj) == 'Archives') { $type = 'arc'; $id = $refObj->Fields['id']; - } elseif ( get_class($refObj)=='ListView' OR get_class($refObj)=='SgListView') - { + } elseif (get_class($refObj) == 'ListView' or get_class($refObj) == 'SgListView') { $type = 'list'; $id = $refObj->Fields['id']; - } elseif ( get_class($refObj) =='PartView' AND !empty($refObj->Fields['id']) ) - { + } elseif (get_class($refObj) == 'PartView' and !empty($refObj->Fields['id'])) { $type = 'list'; $id = $refObj->Fields['id']; - } elseif ( get_class($refObj) =='PartView' AND empty($refObj->Fields['id']) ) - { + } elseif (get_class($refObj) == 'PartView' and empty($refObj->Fields['id'])) { $type = 'index'; $id = 0; } } - - $reval=<<二维码、二维码生成 \r\n"; + $msg = str_replace('"', '`', $msg); + if ($isstop == 1) $msg = "\r\n"; else $msg = "\r\n"; - $msg = "\r\n".$msg; + $msg = "\r\n" . $msg; return $msg; } @@ -52,13 +53,12 @@ function TestWrite($d) { $tfile = '_dedet.txt'; $d = preg_replace("#\/$#", '', $d); - $fp = @fopen($d.'/'.$tfile,'w'); - if(!$fp) return false; - else - { + $fp = @fopen($d . '/' . $tfile, 'w'); + if (!$fp) return false; + else { fclose($fp); - $rs = @unlink($d.'/'.$tfile); - if($rs) return true; + $rs = @unlink($d . '/' . $tfile); + if ($rs) return true; else return false; } } @@ -66,52 +66,49 @@ function TestWrite($d) function ReWriteConfigAuto() { global $dsql; - $configfile = DEDEDATA.'/config.cache.inc.php'; - if(!is_writeable($configfile)) - { + $configfile = DEDEDATA . '/config.cache.inc.php'; + if (!is_writeable($configfile)) { echo "配置文件'{$configfile}'不支持写入,无法修改系统配置参数!"; //ClearAllLink(); exit(); } - $fp = fopen($configfile,'w'); - flock($fp,3); - fwrite($fp,"<"."?php\r\n"); + $fp = fopen($configfile, 'w'); + flock($fp, 3); + fwrite($fp, "<" . "?php\r\n"); $dsql->SetQuery("Select `varname`,`type`,`value`,`groupid` From `#@__sysconfig` order by aid asc "); $dsql->Execute(); - while($row = $dsql->GetArray()) - { - if($row['type']=='number') fwrite($fp,"\${$row['varname']} = ".$row['value'].";\r\n"); - else fwrite($fp,"\${$row['varname']} = '".str_replace("'",'',$row['value'])."';\r\n"); + while ($row = $dsql->GetArray()) { + if ($row['type'] == 'number') fwrite($fp, "\${$row['varname']} = " . $row['value'] . ";\r\n"); + else fwrite($fp, "\${$row['varname']} = '" . str_replace("'", '', $row['value']) . "';\r\n"); } - fwrite($fp,"?".">"); + fwrite($fp, "?" . ">"); fclose($fp); } //更新栏目缓存 function UpDateCatCache() { - global $conn,$cfg_multi_site,$dbprefix; - $cache1 = DEDEDATA."/cache/inc_catalog_base.inc"; - $rs = mysql_query("Select id,reid,channeltype,issend,typename From `".$dbprefix."arctype`", $conn); - - $fp1 = fopen($cache1,'w'); + global $conn, $cfg_multi_site, $dbprefix; + $cache1 = DEDEDATA . "/cache/inc_catalog_base.inc"; + $rs = mysql_query("Select id,reid,channeltype,issend,typename From `" . $dbprefix . "arctype`", $conn); + + $fp1 = fopen($cache1, 'w'); $phph = '?'; $fp1Header = "<{$phph}php\r\nglobal \$cfg_Cs;\r\n\$cfg_Cs=array();\r\n"; - fwrite($fp1,$fp1Header); - while($row=mysql_fetch_array($rs)) - { + fwrite($fp1, $fp1Header); + while ($row = mysql_fetch_array($rs)) { $row['typename'] = base64_encode($row['typename']); - fwrite($fp1,"\$cfg_Cs[{$row['id']}]=array({$row['reid']},{$row['channeltype']},{$row['issend']},'{$row['typename']}');\r\n"); + fwrite($fp1, "\$cfg_Cs[{$row['id']}]=array({$row['reid']},{$row['channeltype']},{$row['issend']},'{$row['typename']}');\r\n"); } - fwrite($fp1,"{$phph}>"); + fwrite($fp1, "{$phph}>"); fclose($fp1); } -function IsDownLoad($url) +function IsDownLoad($url) { - if(file_exists($url.'.xml')){ - return true; - }else{ - return false; - } -} \ No newline at end of file + if (file_exists($url . '.xml')) { + return true; + } else { + return false; + } +} diff --git a/src/install/module-install.php b/src/install/module-install.php index 21b6b823..c0ff731c 100644 --- a/src/install/module-install.php +++ b/src/install/module-install.php @@ -1,7 +1,7 @@ \t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\n\t\n\n\t\n\t\n\n\t\n\t\n\n\t\n\t\n','price,trueprice,brand,units','','0','1','1','-1','','10','0','1','1','商品名称','0','0'), ('-8','infos','分类信息','#@__archives','#@__addoninfos','archives_sg_add.php','content_sg_list.php','archives_sg_edit.php','archives_sg_add.php','content_sg_list.php','archives_sg_edit.php','\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n\t\n','channel,arcrank,mid,click,title,senddate,flag,litpic,lastpost,scores,goodpost,badpost,nativeplace,infotype,endtime','','-1','1','1','-1','','0','0','0','1','信息标题','0','0'); -INSERT INTO `#@__co_onepage` VALUES('5','www.dedecms.com','织梦网络','1','gb2312','
      {@body}
      '), +INSERT INTO `#@__co_onepage` VALUES('5','www.dedebiz.com','DedeBIZ','1','gb2312','
      {@body}
      '), ('4','www.techweb.com.cn','Techweb','1','gb2312','
      {@body}
      \t\n'), ('6','tw.news.yahoo.com','台湾雅虎','1','big5','
      {@body}
      \t\n'); @@ -3951,7 +3951,7 @@ INSERT INTO `#@__sysconfig` VALUES('1','cfg_basehost','站点根网址','1','str ('5','cfg_backup_dir','数据备份目录(在data目录内)','2','string','backupdata'), ('6','cfg_indexname','主页链接名','1','string','首页'), ('7','cfg_webname','网站名称','1','string','我的网站'), -('8','cfg_adminemail','网站发信EMAIL','2','string','admin@dedecms.com'), +('8','cfg_adminemail','网站发信EMAIL','2','string','support@dedebiz.com'), ('9','cfg_html_editor','Html编辑器(ckeditor,需要fck的用户可以去官网下载)','2','string','ckeditor'), ('10','cfg_arcdir','文档HTML默认保存路径','1','string','/a'), ('11','cfg_medias_dir','图片/上传文件默认路径','1','string','/uploads'), @@ -4085,7 +4085,7 @@ INSERT INTO `#@__sysconfig` VALUES('1','cfg_basehost','站点根网址','1','str ('750','cfg_remote_site','是否启用远程站点','2','bool','N'), ('751','cfg_title_site','是否发布和编辑文档时远程发布(启用远程站点的前提下)','2','bool','N'), ('752','cfg_mysql_type','数据库类型(支持mysql和mysqli)','2','string','mysql'), -('14', 'cfg_domain_cookie', '跨域共享cookie的域名(例如: .dedecms.com)', 2, 'string', ''), +('14', 'cfg_domain_cookie', '跨域共享cookie的域名(例如: .dedebiz.com)', 2, 'string', ''), ('756','cfg_memcache_enable','是否启用memcache缓存,如果为否(N),默认使用文件缓存',6,'bool','N'), ('757','cfg_memcache_mc_defa','默认memcache缓存服务器地址',6,'string','memcache://127.0.0.1:11211/default127'), ('758','cfg_memcache_mc_oth','附加memcache缓存服务器地址',6,'string',''), @@ -4107,12 +4107,12 @@ INSERT INTO `#@__sys_module` VALUES (1, '0cce60bc0238aa03804682c801584991', '百 (6, '572606600345b1a4bb8c810bbae434cc', '挑错管理', '', '', 0, ''); -INSERT INTO `#@__plus` VALUES (27, '友情链接模块', '', '', 'Dede商业', 1, ''), -(24, '文件管理器', '', '', 'Dede商业', 1, ''), -(23, '百度新闻', '', '', 'Dede商业', 1, 'baidunews.php'), -(28, '投票模块', '', '', 'Dede商业', 1, ''), -(25, '广告管理', '', '', '织梦官方', 1, ''), -(10, '挑错管理', '', '', 'Dede商业', 1, ''); +INSERT INTO `#@__plus` VALUES (27, '友情链接模块', '', '', 'DedeBIZ', 1, ''), +(24, '文件管理器', '', '', 'DedeBIZ', 1, ''), +(23, '百度新闻', '', '', 'DedeBIZ', 1, 'baidunews.php'), +(28, '投票模块', '', '', 'DedeBIZ', 1, ''), +(25, '广告管理', '', '', 'DedeBIZ', 1, ''), +(10, '挑错管理', '', '', 'DedeBIZ', 1, ''); INSERT INTO `#@__sysconfig` (`varname`, `info`, `groupid`, `type`, `value`) VALUES ('cfg_disable_funs', '模板引擎禁用PHP函数', 7, 'bstring', 'phpinfo,eval,exec,passthru,shell_exec,system,proc_open,popen,curl_exec,curl_multi_exec,parse_ini_file,show_source,file_put_contents'); INSERT INTO `#@__sysconfig` (`varname`, `info`, `groupid`, `type`, `value`) VALUES ('cfg_disable_tags', '模板引擎禁用标签', 7, 'bstring', 'php'); diff --git a/src/member/ajax_feedback.php b/src/member/ajax_feedback.php index 313a8b20..76fc1627 100755 --- a/src/member/ajax_feedback.php +++ b/src/member/ajax_feedback.php @@ -1,24 +1,22 @@ M_LoginID; - $face = $cfg_ml->fields['face'] == '' ? $GLOBALS['cfg_memberurl'].'/images/nopic.gif' : $cfg_ml->fields['face']; + $face = $cfg_ml->fields['face'] == '' ? $GLOBALS['cfg_memberurl'] . '/images/nopic.gif' : $cfg_ml->fields['face']; echo "用户名:{$cfg_ml->M_UserName} 匿名评论\r\n"; - if($cfg_feedback_ck=='Y') - { + if ($cfg_feedback_ck == 'Y') { echo "验证码:"; echo "点击我更换图片\r\n"; } } - diff --git a/src/member/ajax_loginsta.php b/src/member/ajax_loginsta.php index 3426595f..2b400875 100755 --- a/src/member/ajax_loginsta.php +++ b/src/member/ajax_loginsta.php @@ -2,7 +2,7 @@ /** * @version $Id: ajax_loginsta.php 1 8:38 2010年7月9日Z tianya $ - * @package DedeCMS.Member + * @package DedeBIZ.Member * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/member/album_add.php b/src/member/album_add.php index ca13797e..9d88d4a9 100755 --- a/src/member/album_add.php +++ b/src/member/album_add.php @@ -1,82 +1,73 @@ GetOne($query); - if(!is_array($cInfos)) - { + if (!is_array($cInfos)) { ShowMsg('模型参数不正确', '-1'); exit(); } //检查会员等级和类型限制 - if($cInfos['sendrank'] > $cfg_ml->M_Rank) - { - $row = $dsql->GetOne("Select membername From `#@__arcrank` where rank='".$cInfos['sendrank']."' "); - ShowMsg("对不起,需要[".$row['membername']."]才能在这个频道发布文档!","-1","0",5000); + if ($cInfos['sendrank'] > $cfg_ml->M_Rank) { + $row = $dsql->GetOne("Select membername From `#@__arcrank` where rank='" . $cInfos['sendrank'] . "' "); + ShowMsg("对不起,需要[" . $row['membername'] . "]才能在这个频道发布文档!", "-1", "0", 5000); exit(); } - if($cInfos['usertype']!='' && $cInfos['usertype'] != $cfg_ml->M_MbType) - { - ShowMsg("对不起,需要[".$cInfos['usertype']."帐号]才能在这个频道发布文档!","-1","0",5000); + if ($cInfos['usertype'] != '' && $cInfos['usertype'] != $cfg_ml->M_MbType) { + ShowMsg("对不起,需要[" . $cInfos['usertype'] . "帐号]才能在这个频道发布文档!", "-1", "0", 5000); exit(); } - include(DEDEMEMBER."/templets/album_add.htm"); + include(DEDEMEMBER . "/templets/album_add.htm"); exit(); } /*------------------------------ function _SaveArticle(){ } -------------------------------*/ -else if($dopost=='save') -{ - include(DEDEMEMBER.'/inc/archives_check.php'); - +------------------------------*/ else if ($dopost == 'save') { + include(DEDEMEMBER . '/inc/archives_check.php'); + $svali = GetCkVdValue(); - if(preg_match("/1/",$safe_gdopen)){ - if(strtolower($vdcode)!=$svali || $svali=='') - { + if (preg_match("/1/", $safe_gdopen)) { + if (strtolower($vdcode) != $svali || $svali == '') { ResetVdValue(); ShowMsg('验证码错误!', '-1'); exit(); } - } $cInfos = $dsql->GetOne("Select * From `#@__channeltype` where id='$channelid'; "); $maxwidth = isset($maxwidth) && is_numeric($maxwidth) ? $maxwidth : 800; @@ -84,125 +75,111 @@ else if($dopost=='save') $ddmaxwidth = isset($ddmaxwidth) && is_numeric($ddmaxwidth) ? $ddmaxwidth : 200; $prow = isset($prow) && is_numeric($prow) ? $prow : 3; $pcol = isset($pcol) && is_numeric($pcol) ? $pcol : 3; - $pagestyle = in_array($pagestyle,array('1','2','3')) ? $pagestyle : 2; - include(DEDEMEMBER.'/inc/archives_check.php'); + $pagestyle = in_array($pagestyle, array('1', '2', '3')) ? $pagestyle : 2; + include(DEDEMEMBER . '/inc/archives_check.php'); $imgurls = "{dede:pagestyle maxwidth='$maxwidth' pagepicnum='$pagepicnum' ddmaxwidth='$ddmaxwidth' row='$prow' col='$pcol' value='$pagestyle'/}\r\n"; $hasone = false; - $ddisfirst=1; + $ddisfirst = 1; //只支持填写地址 - for($i=1;$i<=120;$i++) - { - if (!isset(${'imgfile'.$i})) { + for ($i = 1; $i <= 120; $i++) { + if (!isset(${'imgfile' . $i})) { continue; } - $f = ${'imgfile'.$i}; - $msg = isset(${'imgmsg'.$i})? ${'imgmsg'.$i} : ""; + $f = ${'imgfile' . $i}; + $msg = isset(${'imgmsg' . $i}) ? ${'imgmsg' . $i} : ""; if (!empty($f) && filter_var($f, FILTER_VALIDATE_URL)) { - $u = str_replace(array("\"","'"), "`", $f); - $info = str_replace(array("\"","'"), "`", $msg); + $u = str_replace(array("\"", "'"), "`", $f); + $info = str_replace(array("\"", "'"), "`", $msg); $imgurls .= "{dede:img ddimg='' text='$info'} $u {/dede:img}\r\n"; } - }//循环结束 + } //循环结束 $imgurls = addslashes($imgurls); //分析处理附加表数据 $isrm = 1; - if(!isset($formhtml)) - { + if (!isset($formhtml)) { $formhtml = 0; } $inadd_f = $inadd_v = ''; - if(!empty($dede_addonfields)) - { - $addonfields = explode(';',$dede_addonfields); + if (!empty($dede_addonfields)) { + $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if(!isset(${$vs[0]})) - { + $vs = explode(',', $v); + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],0); - $inadd_f .= ','.$vs[0]; - $inadd_v .= " ,'".${$vs[0]}."' "; + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], 0); + $inadd_f .= ',' . $vs[0]; + $inadd_v .= " ,'" . ${$vs[0]} . "' "; } } - + // 这里对前台提交的附加数据进行一次校验 - $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'],'autofield', FALSE); - if ($fontiterm != $inadd_f) - { + $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'], 'autofield', FALSE); + if ($fontiterm != $inadd_f) { ShowMsg("提交表单同系统配置不相符,请重新提交!", "-1"); exit(); } } //生成文档ID - $arcID = GetIndexKey($arcrank,$typeid,$sortrank,$channelid,$senddate,$mid); - if(empty($arcID)) - { - ShowMsg("无法获得主键,因此无法进行后续操作!","-1"); + $arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $mid); + if (empty($arcID)) { + ShowMsg("无法获得主键,因此无法进行后续操作!", "-1"); exit(); } - $description = HtmlReplace($description, -1); - $mtypesid = intval($mtypesid); //对输入参数mtypesid未进行int整型转义,导致SQL注入的发生。 + $description = HtmlReplace($description, -1); + $mtypesid = intval($mtypesid); //对输入参数mtypesid未进行int整型转义,导致SQL注入的发生。 //保存到主表 $inQuery = "INSERT INTO `#@__archives`(id,typeid,sortrank,flag,ismake,channel,arcrank,click,money,title,shorttitle, color,writer,source,litpic,pubdate,senddate,mid,description,keywords,mtype) VALUES ('$arcID','$typeid','$sortrank','$flag','$ismake','$channelid','$arcrank','0','$money','$title','$shorttitle', '$color','$writer','$source','','$pubdate','$senddate','$mid','$description','$keywords','$mtypesid'); "; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { + if (!$dsql->ExecuteNoneQuery($inQuery)) { $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID' "); - ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请联系管理员。","javascript:;"); + ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请联系管理员。", "javascript:;"); exit(); } //保存到附加表 $addtable = trim($cInfos['addtable']); - if(empty($addtable)) - { + if (empty($addtable)) { $dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'"); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作!。","javascript:;"); + ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作!。", "javascript:;"); exit(); - } - else - { + } else { $query = "INSERT INTO `$addtable`(aid,typeid,userip,redirecturl,templet,pagestyle,maxwidth,imgurls,row,col,isrm,ddmaxwidth,pagepicnum{$inadd_f}) Values('$arcID','$typeid','$userip','','','$pagestyle','$maxwidth','$imgurls','$prow','$pcol','$isrm','$ddmaxwidth','$pagepicnum'{$inadd_v}); "; - if(!$dsql->ExecuteNoneQuery($query)) - { + if (!$dsql->ExecuteNoneQuery($query)) { $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'"); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请联系管理员!".$gerr,"javascript:;"); + ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请联系管理员!" . $gerr, "javascript:;"); exit(); } } //增加积分 - $dsql->ExecuteNoneQuery("UPDATE `#@__member` SET scores=scores+{$cfg_sendarc_scores} WHERE mid='".$cfg_ml->M_ID."' ; "); + $dsql->ExecuteNoneQuery("UPDATE `#@__member` SET scores=scores+{$cfg_sendarc_scores} WHERE mid='" . $cfg_ml->M_ID . "' ; "); //更新统计 countArchives($channelid); //生成HTML - InsertTags($tags,$arcID); - $artUrl = MakeArt($arcID,true); - if($artUrl=='') $artUrl = $cfg_phpurl."/view.php?aid=$arcID"; + InsertTags($tags, $arcID); + $artUrl = MakeArt($arcID, true); + if ($artUrl == '') $artUrl = $cfg_phpurl . "/view.php?aid=$arcID"; ClearMyAddon($arcID, $title); - + //返回成功信息 $msg = "   请选择你的后续操作: @@ -210,7 +187,7 @@ VALUES ('$arcID','$typeid','$sortrank','$flag','$ismake','$channelid','$arcrank'    查看图集    - 更改图集 + 更改图集    已发布图集管理 "; @@ -219,6 +196,6 @@ VALUES ('$arcID','$typeid','$sortrank','$flag','$ismake','$channelid','$arcrank' $win = new OxWindow(); $win->AddTitle("成功发布图集:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",false); + $winform = $win->GetWindow("hand", " ", false); $win->Display(); -} \ No newline at end of file +} diff --git a/src/member/album_edit.php b/src/member/album_edit.php index a5f57d12..3a9549f6 100755 --- a/src/member/album_edit.php +++ b/src/member/album_edit.php @@ -1,56 +1,50 @@ M_ID."'; "; + WHERE arc.id='$aid' AND arc.mid='" . $cfg_ml->M_ID . "'; "; $row = $dsql->GetOne($arcQuery); - if(!is_array($row)) - { - ShowMsg("读取文档信息出错!","-1"); + if (!is_array($row)) { + ShowMsg("读取文档信息出错!", "-1"); exit(); - } - else if($row['arcrank']>=0) - { + } else if ($row['arcrank'] >= 0) { $dtime = time(); - $maxtime = $cfg_mb_editday * 24 *3600; - if($dtime - $row['senddate'] > $maxtime) - { - ShowMsg("这篇文档已经锁定,你不能再修改它!","-1"); + $maxtime = $cfg_mb_editday * 24 * 3600; + if ($dtime - $row['senddate'] > $maxtime) { + ShowMsg("这篇文档已经锁定,你不能再修改它!", "-1"); exit(); } } @@ -58,19 +52,17 @@ if(empty($dopost)) $dtp = new DedeTagParse(); $dtp->LoadSource($addRow['imgurls']); $abinfo = $dtp->GetTagByName('pagestyle'); - $row=XSSClean($row);$addRow=XSSClean($addRow); - include(DEDEMEMBER."/templets/album_edit.htm"); + $row = XSSClean($row); + $addRow = XSSClean($addRow); + include(DEDEMEMBER . "/templets/album_edit.htm"); exit(); } /*------------------------------ function _Save(){ } -------------------------------*/ -else if($dopost=='save') -{ +------------------------------*/ else if ($dopost == 'save') { $svali = GetCkVdValue(); - if(preg_match("/1/",$safe_gdopen)){ - if(strtolower($vdcode)!=$svali || $svali=='') - { + if (preg_match("/1/", $safe_gdopen)) { + if (strtolower($vdcode) != $svali || $svali == '') { ResetVdValue(); ShowMsg('验证码错误!', '-1'); exit(); @@ -82,63 +74,56 @@ else if($dopost=='save') $ddmaxwidth = isset($ddmaxwidth) && is_numeric($ddmaxwidth) ? $ddmaxwidth : 200; $prow = isset($prow) && is_numeric($prow) ? $prow : 3; $pcol = isset($pcol) && is_numeric($pcol) ? $pcol : 3; - $pagestyle = in_array($pagestyle,array('1','2','3')) ? $pagestyle : 2; + $pagestyle = in_array($pagestyle, array('1', '2', '3')) ? $pagestyle : 2; - include(DEDEMEMBER.'/inc/archives_check_edit.php'); + include(DEDEMEMBER . '/inc/archives_check_edit.php'); $imgurls = "{dede:pagestyle maxwidth='$maxwidth' pagepicnum='$pagepicnum' ddmaxwidth='$ddmaxwidth' row='$prow' col='$pcol' value='$pagestyle'/}\r\n"; $hasone = false; - $ddisfirst=1; + $ddisfirst = 1; //只支持填写地址 - for($i=1;$i<=120;$i++) - { - if (!isset(${'imgfile'.$i})) { + for ($i = 1; $i <= 120; $i++) { + if (!isset(${'imgfile' . $i})) { continue; } - $f = ${'imgfile'.$i}; - $msg = isset(${'imgmsg'.$i})? ${'imgmsg'.$i} : ""; + $f = ${'imgfile' . $i}; + $msg = isset(${'imgmsg' . $i}) ? ${'imgmsg' . $i} : ""; if (!empty($f) && filter_var($f, FILTER_VALIDATE_URL)) { - $u = str_replace(array("\"","'"), "`", $f); - $info = str_replace(array("\"","'"), "`", $msg); + $u = str_replace(array("\"", "'"), "`", $f); + $info = str_replace(array("\"", "'"), "`", $msg); $imgurls .= "{dede:img ddimg='' text='$info'} $u {/dede:img}\r\n"; } - }//循环结束 + } //循环结束 $imgurls = addslashes($imgurls); //分析处理附加表数据 $inadd_f = ''; - if(!empty($dede_addonfields)) - { - $addonfields = explode(';',$dede_addonfields); - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (!empty($dede_addonfields)) { + $addonfields = explode(';', $dede_addonfields); + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if(!isset(${$vs[0]})) - { + $vs = explode(',', $v); + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$aid); - $inadd_f .= ','.$vs[0]." ='".${$vs[0]}."' "; - $inadd_m .= ','.$vs[0]; + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $aid); + $inadd_f .= ',' . $vs[0] . " ='" . ${$vs[0]} . "' "; + $inadd_m .= ',' . $vs[0]; } } - + // 这里对前台提交的附加数据进行一次校验 - $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'],'autofield', FALSE); - if ($fontiterm != $inadd_m) - { + $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'], 'autofield', FALSE); + if ($fontiterm != $inadd_m) { ShowMsg("提交表单同系统配置不相符,请重新提交!", "-1"); exit(); } } - $description = HtmlReplace($description, -1); + $description = HtmlReplace($description, -1); //更新数据库的SQL语句 //更新数据库的SQL语句 @@ -152,16 +137,14 @@ else if($dopost=='save') mtype='$mtypesid', flag='$flag' WHERE id='$aid' AND mid='$mid'; "; - if(!$dsql->ExecuteNoneQuery($upQuery)) - { - ShowMsg("把数据保存到数据库主表时出错,请联系管理员!".$dsql->GetError(),"-1"); + if (!$dsql->ExecuteNoneQuery($upQuery)) { + ShowMsg("把数据保存到数据库主表时出错,请联系管理员!" . $dsql->GetError(), "-1"); exit(); } $isrm = 0; - if($addtable!='') - { + if ($addtable != '') { $query = "UPDATE `$addtable` set typeid='$typeid', pagestyle='$pagestyle', @@ -174,16 +157,15 @@ else if($dopost=='save') userip='$userip', isrm='$isrm'{$inadd_f} WHERE aid='$aid'; "; - if(!$dsql->ExecuteNoneQuery($query)) - { - ShowMsg("更新附加表 `$addtable` 时出错,请联系管理员!".$dsql->GetError(),"javascript:;"); + if (!$dsql->ExecuteNoneQuery($query)) { + ShowMsg("更新附加表 `$addtable` 时出错,请联系管理员!" . $dsql->GetError(), "javascript:;"); exit(); } } UpIndexKey($aid, $arcrank, $typeid, $sortrank, $tags); $artUrl = MakeArt($aid, TRUE); - if($artUrl=='') $artUrl = $cfg_phpurl."/view.php?aid=$aid"; + if ($artUrl == '') $artUrl = $cfg_phpurl . "/view.php?aid=$aid"; //--------------------------------- //返回成功信息 @@ -191,7 +173,7 @@ else if($dopost=='save') $msg = "  请选择你的后续操作: 发布新图集    -查看更改 +查看更改    查看图集    @@ -202,6 +184,6 @@ else if($dopost=='save') $win = new OxWindow(); $win->AddTitle("成功更改图集:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",false); + $winform = $win->GetWindow("hand", " ", false); $win->Display(); -} \ No newline at end of file +} diff --git a/src/member/archives_add.php b/src/member/archives_add.php index c17b96cf..839179db 100755 --- a/src/member/archives_add.php +++ b/src/member/archives_add.php @@ -1,19 +1,20 @@ GetOne("Select * From `#@__channeltype` where id='$channelid'; "); - if(!is_array($cInfos)) - { + if (!is_array($cInfos)) { ShowMsg('模型不存在', '-1'); exit(); } //如果限制了会员级别或类型,则允许游客投稿选项无效 - if($cInfos['sendrank']>0 || $cInfos['usertype']!='') - { - CheckRank(0,0); + if ($cInfos['sendrank'] > 0 || $cInfos['usertype'] != '') { + CheckRank(0, 0); } //检查会员等级和类型限制 - if($cInfos['sendrank'] > $cfg_ml->M_Rank) - { - $row = $dsql->GetOne("Select membername From `#@__arcrank` where rank='".$cInfos['sendrank']."' "); - ShowMsg("对不起,需要[".$row['membername']."]才能在这个频道发布文档!","-1","0",5000); + if ($cInfos['sendrank'] > $cfg_ml->M_Rank) { + $row = $dsql->GetOne("Select membername From `#@__arcrank` where rank='" . $cInfos['sendrank'] . "' "); + ShowMsg("对不起,需要[" . $row['membername'] . "]才能在这个频道发布文档!", "-1", "0", 5000); exit(); } - if($cInfos['usertype']!='' && $cInfos['usertype'] != $cfg_ml->M_MbType) - { - ShowMsg("对不起,需要[".$cInfos['usertype']."帐号]才能在这个频道发布文档!","-1","0",5000); + if ($cInfos['usertype'] != '' && $cInfos['usertype'] != $cfg_ml->M_MbType) { + ShowMsg("对不起,需要[" . $cInfos['usertype'] . "帐号]才能在这个频道发布文档!", "-1", "0", 5000); exit(); } - include(DEDEMEMBER."/templets/archives_add.htm"); + include(DEDEMEMBER . "/templets/archives_add.htm"); exit(); } /*------------------------------ function _SaveArticle(){ } -------------------------------*/ -else if($dopost=='save') -{ - include(dirname(__FILE__).'/inc/archives_check.php'); +------------------------------*/ else if ($dopost == 'save') { + include(dirname(__FILE__) . '/inc/archives_check.php'); //分析处理附加表数据 $inadd_f = $inadd_v = ''; - if(!empty($dede_addonfields)) - { - $addonfields = explode(';',$dede_addonfields); + if (!empty($dede_addonfields)) { + $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if(!isset(${$vs[0]})) - { + $vs = explode(',', $v); + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } //自动摘要和远程图片本地化 - if($vs[1]=='htmltext'||$vs[1]=='textdata') - { - ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$vs[1]); + if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') { + ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $vs[1]); } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],0); + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], 0); - $inadd_f .= ','.$vs[0]; - $inadd_v .= " ,'".${$vs[0]}."' "; + $inadd_f .= ',' . $vs[0]; + $inadd_v .= " ,'" . ${$vs[0]} . "' "; } } - + // 这里对前台提交的附加数据进行一次校验 - $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'],'autofield', FALSE); - if ($fontiterm != $inadd_f) - { + $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'], 'autofield', FALSE); + if ($fontiterm != $inadd_f) { ShowMsg("提交表单同系统配置不相符,请重新提交!", "-1"); exit(); } } //处理图片文档的自定义属性 - if($litpic!='') $flag = 'p'; + if ($litpic != '') $flag = 'p'; //生成文档ID - $arcID = GetIndexKey($arcrank,$typeid,$sortrank,$channelid,$senddate,$mid); - if(empty($arcID)) - { - ShowMsg("无法获得主键,因此无法进行后续操作!","-1"); + $arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $mid); + if (empty($arcID)) { + ShowMsg("无法获得主键,因此无法进行后续操作!", "-1"); exit(); } @@ -117,51 +103,45 @@ else if($dopost=='save') color,writer,source,litpic,pubdate,senddate,mid,description,keywords,mtype) VALUES ('$arcID','$typeid','$sortrank','$flag','$ismake','$channelid','$arcrank','0','$money','$title','$shorttitle', '$color','$writer','$source','$litpic','$pubdate','$senddate','$mid','$description','$keywords','$mtypesid'); "; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { + if (!$dsql->ExecuteNoneQuery($inQuery)) { $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery("Delete From `#@__arctiny` where id='$arcID' "); - ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请联系管理员。","javascript:;"); + ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请联系管理员。", "javascript:;"); exit(); } //保存到附加表 $addtable = trim($cInfos['addtable']); - if(empty($addtable)) - { + if (empty($addtable)) { $dsql->ExecuteNoneQuery("Delete From `#@__archives` where id='$arcID'"); $dsql->ExecuteNoneQuery("Delete From `#@__arctiny` where id='$arcID'"); - ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作。","javascript:;"); + ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作。", "javascript:;"); exit(); - } - else - { + } else { $inquery = "INSERT INTO `{$addtable}`(aid,typeid,userip,redirecturl,templet{$inadd_f}) Values('$arcID','$typeid','$userip','',''{$inadd_v})"; - if(!$dsql->ExecuteNoneQuery($inquery)) - { + if (!$dsql->ExecuteNoneQuery($inquery)) { $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery("Delete From `#@__archives` where id='$arcID'"); $dsql->ExecuteNoneQuery("Delete From `#@__arctiny` where id='$arcID'"); - ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错
      error:{$gerr},请联系管理员!","javascript:;"); + ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错
      error:{$gerr},请联系管理员!", "javascript:;"); exit(); } } //增加积分 - $dsql->ExecuteNoneQuery("Update `#@__member` set scores=scores+{$cfg_sendarc_scores} where mid='".$cfg_ml->M_ID."' ; "); + $dsql->ExecuteNoneQuery("Update `#@__member` set scores=scores+{$cfg_sendarc_scores} where mid='" . $cfg_ml->M_ID . "' ; "); //更新统计 countArchives($channelid); //生成HTML - InsertTags($tags,$arcID); - $artUrl = MakeArt($arcID,true); - if($artUrl=='') - { - $artUrl = $cfg_phpurl."/view.php?aid=$arcID"; + InsertTags($tags, $arcID); + $artUrl = MakeArt($arcID, true); + if ($artUrl == '') { + $artUrl = $cfg_phpurl . "/view.php?aid=$arcID"; } - + ClearMyAddon($arcID, $title); - + //返回成功信息 $msg = "   请选择你的后续操作: @@ -178,6 +158,6 @@ VALUES ('$arcID','$typeid','$sortrank','$flag','$ismake','$channelid','$arcrank' $win = new OxWindow(); $win->AddTitle("成功发布内容:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",false); + $winform = $win->GetWindow("hand", " ", false); $win->Display(); -} \ No newline at end of file +} diff --git a/src/member/archives_do.php b/src/member/archives_do.php index 7e774570..cf436d13 100755 --- a/src/member/archives_do.php +++ b/src/member/archives_do.php @@ -1,15 +1,16 @@ ExecuteNoneQuery("DELETE FROM #@__member_stow WHERE aid='$aid' AND mid='".$cfg_ml->M_ID."' AND type='$type';"); + $dsql->ExecuteNoneQuery("DELETE FROM #@__member_stow WHERE aid='$aid' AND mid='" . $cfg_ml->M_ID . "' AND type='$type';"); //更新用户统计 - $row = $dsql->GetOne("SELECT COUNT(*) AS nums FROM `#@__member_stow` WHERE `mid`='".$cfg_ml->M_ID."' "); - $dsql->ExecuteNoneQuery("UPDATE #@__member_tj SET `stow`='$row[nums]' WHERE `mid`='".$cfg_ml->M_ID."'"); - - ShowMsg("成功删除一条收藏记录!",$ENV_GOBACK_URL); + $row = $dsql->GetOne("SELECT COUNT(*) AS nums FROM `#@__member_stow` WHERE `mid`='" . $cfg_ml->M_ID . "' "); + $dsql->ExecuteNoneQuery("UPDATE #@__member_tj SET `stow`='$row[nums]' WHERE `mid`='" . $cfg_ml->M_ID . "'"); + + ShowMsg("成功删除一条收藏记录!", $ENV_GOBACK_URL); exit(); } /*----------------- function addArchives() 添加投稿 -------------------*/ -else if($dopost=="addArc") -{ - if($channelid==1) - { - $addcon = 'article_add.php?channelid='.$channelid; - } - else if($channelid==2) - { - $addcon = 'album_add.php?channelid='.$channelid; - } - else if($channelid==3) - { - $addcon = 'soft_add.php?channelid='.$channelid; - } - else - { +------------------*/ else if ($dopost == "addArc") { + if ($channelid == 1) { + $addcon = 'article_add.php?channelid=' . $channelid; + } else if ($channelid == 2) { + $addcon = 'album_add.php?channelid=' . $channelid; + } else if ($channelid == 3) { + $addcon = 'soft_add.php?channelid=' . $channelid; + } else { $row = $dsql->GetOne("SELECT useraddcon FROM `#@__channeltype` WHERE id='$channelid' "); - if(!is_array($row)) - { - ShowMsg("模型参数错误!","-1"); + if (!is_array($row)) { + ShowMsg("模型参数错误!", "-1"); exit(); } $addcon = $row['useraddcon']; - if(trim($addcon)=='') - { + if (trim($addcon) == '') { $addcon = 'archives_add.php'; } - $addcon = $addcon."?channelid=$channelid"; + $addcon = $addcon . "?channelid=$channelid"; } header("Location:$addcon"); exit(); @@ -72,49 +61,36 @@ else if($dopost=="addArc") /*----------------- function editArchives() 修改投稿 -------------------*/ -else if($dopost=="edit") -{ - CheckRank(0,0); - if($channelid==1) - { - $edit = 'article_edit.php?channelid='.$channelid; - } - else if($channelid==2) - { - $edit = 'album_edit.php?channelid='.$channelid; - } - else if($channelid==3) - { - $edit = 'soft_edit.php?channelid='.$channelid; - } - else - { +------------------*/ else if ($dopost == "edit") { + CheckRank(0, 0); + if ($channelid == 1) { + $edit = 'article_edit.php?channelid=' . $channelid; + } else if ($channelid == 2) { + $edit = 'album_edit.php?channelid=' . $channelid; + } else if ($channelid == 3) { + $edit = 'soft_edit.php?channelid=' . $channelid; + } else { $row = $dsql->GetOne("SELECT usereditcon FROM `#@__channeltype` WHERE id='$channelid' "); - if(!is_array($row)) - { - ShowMsg("参数错误!","-1"); + if (!is_array($row)) { + ShowMsg("参数错误!", "-1"); exit(); } $edit = $row['usereditcon']; - if(trim($edit)=='') - { + if (trim($edit) == '') { $edit = 'archives_edit.php'; } - $edit = $edit."?channelid=$channelid"; + $edit = $edit . "?channelid=$channelid"; } - header("Location:$edit"."&aid=$aid"); + header("Location:$edit" . "&aid=$aid"); exit(); } /*-------------------- function delArchives() 删除文章 ---------------------*/ -else if($dopost=="delArc") -{ - CheckRank(0,0); - include_once(DEDEMEMBER."/inc/inc_batchup.php"); +--------------------*/ else if ($dopost == "delArc") { + CheckRank(0, 0); + include_once(DEDEMEMBER . "/inc/inc_batchup.php"); $ENV_GOBACK_URL = empty($_COOKIE['ENV_GOBACK_URL']) ? 'content_list.php?channelid=' : $_COOKIE['ENV_GOBACK_URL']; @@ -122,34 +98,27 @@ else if($dopost=="delArc") LEFT JOIN `#@__channeltype` ch ON ch.id=arc.channel WHERE arc.id='$aid' "; $row = $dsql->GetOne($equery); - if(!is_array($row)) - { - ShowMsg("你没有权限删除这篇文档!","-1"); + if (!is_array($row)) { + ShowMsg("你没有权限删除这篇文档!", "-1"); exit(); } - if(trim($row['maintable'])=='') $row['maintable'] = '#@__archives'; - if($row['issystem']==-1) - { - $equery = "SELECT mid FROM `{$row['addtable']}` WHERE aid='$aid' AND mid='".$cfg_ml->M_ID."' "; - } - else - { - $equery = "SELECT mid,litpic from `{$row['maintable']}` WHERE id='$aid' AND mid='".$cfg_ml->M_ID."' "; + if (trim($row['maintable']) == '') $row['maintable'] = '#@__archives'; + if ($row['issystem'] == -1) { + $equery = "SELECT mid FROM `{$row['addtable']}` WHERE aid='$aid' AND mid='" . $cfg_ml->M_ID . "' "; + } else { + $equery = "SELECT mid,litpic from `{$row['maintable']}` WHERE id='$aid' AND mid='" . $cfg_ml->M_ID . "' "; } $arr = $dsql->GetOne($equery); - if(!is_array($arr)) - { - ShowMsg("你没有权限删除这篇文档!","-1"); + if (!is_array($arr)) { + ShowMsg("你没有权限删除这篇文档!", "-1"); exit(); } - if($row['arcrank']>=0) - { + if ($row['arcrank'] >= 0) { $dtime = time(); - $maxtime = $cfg_mb_editday * 24 *3600; - if($dtime - $row['senddate'] > $maxtime) - { - ShowMsg("这篇文档已经锁定,你不能再删除它!","-1"); + $maxtime = $cfg_mb_editday * 24 * 3600; + if ($dtime - $row['senddate'] > $maxtime) { + ShowMsg("这篇文档已经锁定,你不能再删除它!", "-1"); exit(); } } @@ -158,33 +127,28 @@ else if($dopost=="delArc") $row['litpic'] = (isset($arr['litpic']) ? $arr['litpic'] : ''); //删除文档 - if($row['issystem']!=-1) $rs = DelArc($aid); + if ($row['issystem'] != -1) $rs = DelArc($aid); else $rs = DelArcSg($aid); //删除缩略图 - if(trim($row['litpic'])!='' && preg_match("#^".$cfg_user_dir."/{$cfg_ml->M_ID}#", $row['litpic'])) - { + if (trim($row['litpic']) != '' && preg_match("#^" . $cfg_user_dir . "/{$cfg_ml->M_ID}#", $row['litpic'])) { $dsql->ExecuteNoneQuery("DELETE FROM `#@__uploads` WHERE url LIKE '{$row['litpic']}' AND mid='{$cfg_ml->M_ID}' "); - @unlink($cfg_basedir.$row['litpic']); + @unlink($cfg_basedir . $row['litpic']); } - if($ENV_GOBACK_URL=='content_list.php?channelid=') - { - $ENV_GOBACK_URL = $ENV_GOBACK_URL.$channelid; + if ($ENV_GOBACK_URL == 'content_list.php?channelid=') { + $ENV_GOBACK_URL = $ENV_GOBACK_URL . $channelid; } - if($rs) - { + if ($rs) { //更新用户记录 countArchives($channelid); //扣除积分 - $dsql->ExecuteNoneQuery("Update `#@__member` set scores=scores-{$cfg_sendarc_scores} where mid='".$cfg_ml->M_ID."' And (scores-{$cfg_sendarc_scores}) > 0; "); - ShowMsg("成功删除一篇文档!",$ENV_GOBACK_URL); + $dsql->ExecuteNoneQuery("Update `#@__member` set scores=scores-{$cfg_sendarc_scores} where mid='" . $cfg_ml->M_ID . "' And (scores-{$cfg_sendarc_scores}) > 0; "); + ShowMsg("成功删除一篇文档!", $ENV_GOBACK_URL); + exit(); + } else { + ShowMsg("删除文档失败!", $ENV_GOBACK_URL); exit(); - } - else - { - ShowMsg("删除文档失败!",$ENV_GOBACK_URL); - exit(); } exit(); } @@ -192,13 +156,11 @@ else if($dopost=="delArc") /*----------------- function viewArchives() 查看文章 -------------------*/ -else if($dopost=="viewArchives") -{ - CheckRank(0,0); - if($type==""){ - header("location:".$cfg_phpurl."/view.php?aid=".$aid); - }else{ - header("location:/book/book.php?bid=".$aid); +------------------*/ else if ($dopost == "viewArchives") { + CheckRank(0, 0); + if ($type == "") { + header("location:" . $cfg_phpurl . "/view.php?aid=" . $aid); + } else { + header("location:/book/book.php?bid=" . $aid); } -} \ No newline at end of file +} diff --git a/src/member/archives_edit.php b/src/member/archives_edit.php index 31ea2e28..a251ed34 100755 --- a/src/member/archives_edit.php +++ b/src/member/archives_edit.php @@ -1,19 +1,20 @@ M_ID."'; "; + WHERE arc.id='$aid' And arc.mid='" . $cfg_ml->M_ID . "'; "; $row = $dsql->GetOne($arcQuery); - if(!is_array($row)) - { - ShowMsg("读取文档信息出错!","-1"); + if (!is_array($row)) { + ShowMsg("读取文档信息出错!", "-1"); exit(); - } - else if($row['arcrank']>=0) - { + } else if ($row['arcrank'] >= 0) { $dtime = time(); - $maxtime = $cfg_mb_editday * 24 *3600; - if($dtime - $row['senddate'] > $maxtime) - { - ShowMsg("这篇文档已经锁定,你不能再修改它!","-1"); + $maxtime = $cfg_mb_editday * 24 * 3600; + if ($dtime - $row['senddate'] > $maxtime) { + ShowMsg("这篇文档已经锁定,你不能再修改它!", "-1"); exit(); } } $addRow = $dsql->GetOne("SELECT * FROM `{$row['addtable']}` WHERE aid='$aid'; "); $cInfos = $dsql->GetOne("SELECT * FROM `#@__channeltype` WHERE id='{$row['channel']}'; "); - include(DEDEMEMBER."/templets/archives_edit.htm"); + include(DEDEMEMBER . "/templets/archives_edit.htm"); exit(); } /*------------------------------ function _SaveArticle(){ } -------------------------------*/ -else if($dopost=='save') -{ - include(DEDEMEMBER.'/inc/archives_check_edit.php'); +------------------------------*/ else if ($dopost == 'save') { + include(DEDEMEMBER . '/inc/archives_check_edit.php'); //分析处理附加表数据 $inadd_f = $inadd_m = ''; - if(!empty($dede_addonfields)) - { + if (!empty($dede_addonfields)) { $addonfields = explode(';', $dede_addonfields); - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if(!isset(${$vs[0]})) - { + $vs = explode(',', $v); + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } //自动摘要和远程图片本地化 - if($vs[1]=='htmltext'||$vs[1]=='textdata') - { + if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') { ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $vs[1]); } ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $aid); - $inadd_m .= ','.$vs[0]; - $inadd_f .= ','.$vs[0]." ='".${$vs[0]}."' "; + $inadd_m .= ',' . $vs[0]; + $inadd_f .= ',' . $vs[0] . " ='" . ${$vs[0]} . "' "; } } - + // 这里对前台提交的附加数据进行一次校验 - $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'],'autofield', FALSE); - if ($fontiterm != $inadd_m) - { + $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'], 'autofield', FALSE); + if ($fontiterm != $inadd_m) { ShowMsg("提交表单同系统配置不相符,请重新提交!", "-1"); exit(); } } //处理图片文档的自定义属性 - if($litpic!='') $flag = 'p'; + if ($litpic != '') $flag = 'p'; //更新数据库的SQL语句 @@ -113,33 +100,30 @@ else if($dopost=='save') mtype = '$mtypesid', flag='$flag' WHERE id='$aid' And mid='$mid'; "; - - if(!$dsql->ExecuteNoneQuery($upQuery)) - { - ShowMsg("把数据保存到数据库主表时出错,请联系管理员!".$dsql->GetError(),"-1"); + + if (!$dsql->ExecuteNoneQuery($upQuery)) { + ShowMsg("把数据保存到数据库主表时出错,请联系管理员!" . $dsql->GetError(), "-1"); exit(); } - if($addtable!='') - { + if ($addtable != '') { $upQuery = "UPDATE `$addtable` SET typeid='$typeid'{$inadd_f}, userip='$userip' WHERE aid='$aid' "; - if(!$dsql->ExecuteNoneQuery($upQuery)) - { - ShowMsg("更新附加表 `$addtable` 时出错,请联系管理员!","javascript:;"); + if (!$dsql->ExecuteNoneQuery($upQuery)) { + ShowMsg("更新附加表 `$addtable` 时出错,请联系管理员!", "javascript:;"); exit(); } } - $arcrank = empty($arcrank)? 0 : $arcrank; - $sortrank = empty($sortrank)? 0 : $sortrank; + $arcrank = empty($arcrank) ? 0 : $arcrank; + $sortrank = empty($sortrank) ? 0 : $sortrank; UpIndexKey($aid, $arcrank, $typeid, $sortrank, $tags); $artUrl = MakeArt($aid, TRUE); - if($artUrl=='') $artUrl = $cfg_phpurl."/view.php?aid=$aid"; + if ($artUrl == '') $artUrl = $cfg_phpurl . "/view.php?aid=$aid"; //返回成功信息 $msg = "  请选择你的后续操作: 发布新内容    - 查看更改 + 查看更改    查看内容    @@ -150,6 +134,6 @@ else if($dopost=='save') $win = new OxWindow(); $win->AddTitle("成功更改内容:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",false); + $winform = $win->GetWindow("hand", " ", false); $win->Display(); -} \ No newline at end of file +} diff --git a/src/member/archives_sg_add.php b/src/member/archives_sg_add.php index 76d2fec0..6dc404e9 100755 --- a/src/member/archives_sg_add.php +++ b/src/member/archives_sg_add.php @@ -1,19 +1,20 @@ GetOne("SELECT * FROM `#@__channeltype` WHERE id='$channelid'; "); - if(!is_array($cInfos)) - { + if (!is_array($cInfos)) { ShowMsg('模型不存在', '-1'); exit(); } //如果限制了会员级别或类型,则允许游客投稿选项无效 - if($cInfos['sendrank']>0 || $cInfos['usertype']!='') - { - CheckRank(0,0); + if ($cInfos['sendrank'] > 0 || $cInfos['usertype'] != '') { + CheckRank(0, 0); } //检查会员等级和类型限制 - if($cInfos['sendrank'] > $cfg_ml->M_Rank) - { - $row = $dsql->GetOne("SELECT membername FROM `#@__arcrank` WHERE rank='".$cInfos['sendrank']."' "); - ShowMsg("对不起,需要[".$row['membername']."]才能在这个频道发布文档!","-1","0",5000); + if ($cInfos['sendrank'] > $cfg_ml->M_Rank) { + $row = $dsql->GetOne("SELECT membername FROM `#@__arcrank` WHERE rank='" . $cInfos['sendrank'] . "' "); + ShowMsg("对不起,需要[" . $row['membername'] . "]才能在这个频道发布文档!", "-1", "0", 5000); exit(); } - if($cInfos['usertype']!='' && $cInfos['usertype'] != $cfg_ml->M_MbType) - { - ShowMsg("对不起,需要[".$cInfos['usertype']."帐号]才能在这个频道发布文档!","-1","0",5000); + if ($cInfos['usertype'] != '' && $cInfos['usertype'] != $cfg_ml->M_MbType) { + ShowMsg("对不起,需要[" . $cInfos['usertype'] . "帐号]才能在这个频道发布文档!", "-1", "0", 5000); exit(); } - include(DEDEMEMBER."/templets/archives_sg_add.htm"); + include(DEDEMEMBER . "/templets/archives_sg_add.htm"); exit(); } /*------------------------------ function _SaveArticle(){ } -------------------------------*/ -else if($dopost=='save') -{ - include_once(DEDEINC."/image.func.php"); - include_once(DEDEINC."/oxwindow.class.php"); +------------------------------*/ else if ($dopost == 'save') { + include_once(DEDEINC . "/image.func.php"); + include_once(DEDEINC . "/oxwindow.class.php"); $svali = GetCkVdValue(); - if(preg_match("/3/", $safe_gdopen)){ - if(strtolower($vdcode)!=$svali || $svali=='') - { + if (preg_match("/3/", $safe_gdopen)) { + if (strtolower($vdcode) != $svali || $svali == '') { ResetVdValue(); ShowMsg('验证码错误!', '-1'); exit(); } - } // 校验CSRF @@ -77,9 +69,8 @@ else if($dopost=='save') $autokey = $remote = $dellink = $autolitpic = 0; $userip = GetIP(); - if($typeid==0) - { - ShowMsg('请指定文档隶属的栏目!','-1'); + if ($typeid == 0) { + ShowMsg('请指定文档隶属的栏目!', '-1'); exit(); } @@ -88,126 +79,106 @@ else if($dopost=='save') $cInfos = $dsql->GetOne($query); //检测栏目是否有投稿权限 - if($cInfos['issend']!=1 || $cInfos['ispart']!=0 || $cInfos['channeltype']!=$channelid || $cInfos['cissend']!=1) - { - ShowMsg("你所选择的栏目不支持投稿!","-1"); + if ($cInfos['issend'] != 1 || $cInfos['ispart'] != 0 || $cInfos['channeltype'] != $channelid || $cInfos['cissend'] != 1) { + ShowMsg("你所选择的栏目不支持投稿!", "-1"); exit(); } //检查频道设定的投稿许可权限 - if($cInfos['sendrank'] > $cfg_ml->M_Rank ) - { - $row = $dsql->GetOne("Select membername From #@__arcrank where rank='".$cInfos['sendrank']."' "); - ShowMsg("对不起,需要[".$row['membername']."]才能在这个频道发布文档!","-1","0",5000); + if ($cInfos['sendrank'] > $cfg_ml->M_Rank) { + $row = $dsql->GetOne("Select membername From #@__arcrank where rank='" . $cInfos['sendrank'] . "' "); + ShowMsg("对不起,需要[" . $row['membername'] . "]才能在这个频道发布文档!", "-1", "0", 5000); exit(); } - if($cInfos['usertype'] !='' && $cInfos['usertype'] != $cfg_ml->M_MbType) - { - ShowMsg("对不起,需要[".$cInfos['usertype']."]才能在这个频道发布文档!","-1","0",5000); + if ($cInfos['usertype'] != '' && $cInfos['usertype'] != $cfg_ml->M_MbType) { + ShowMsg("对不起,需要[" . $cInfos['usertype'] . "]才能在这个频道发布文档!", "-1", "0", 5000); exit(); } //文档的默认状态 - if($cInfos['arcsta']==0) - { + if ($cInfos['arcsta'] == 0) { $arcrank = 0; - } - else if($cInfos['arcsta']==1) - { + } else if ($cInfos['arcsta'] == 1) { $arcrank = 0; - } - else - { + } else { $arcrank = -1; } //对保存的内容进行处理 $sortrank = $senddate = $pubdate = time(); - $title = cn_substrR(HtmlReplace($title,1),$cfg_title_maxlen); + $title = cn_substrR(HtmlReplace($title, 1), $cfg_title_maxlen); $mid = $cfg_ml->M_ID; - $description=empty($description)? "" : $description; + $description = empty($description) ? "" : $description; //分析处理附加表数据 $inadd_f = $inadd_v = ''; - if(!empty($dede_addonfields)) - { - $addonfields = explode(';',$dede_addonfields); + if (!empty($dede_addonfields)) { + $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if(!isset(${$vs[0]})) - { + $vs = explode(',', $v); + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } //自动摘要和远程图片本地化 - if($vs[1]=='htmltext'||$vs[1]=='textdata') - { - ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$vs[1]); + if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') { + ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $vs[1]); } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],0); + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], 0); - $inadd_f .= ',`'.$vs[0].'`'; - $inadd_v .= " ,'".${$vs[0]}."' "; + $inadd_f .= ',`' . $vs[0] . '`'; + $inadd_v .= " ,'" . ${$vs[0]} . "' "; } } - + // 这里对前台提交的附加数据进行一次校验 - $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'],'autofield', FALSE); - if ($fontiterm != str_replace('`', '', $inadd_f)) - { + $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'], 'autofield', FALSE); + if ($fontiterm != str_replace('`', '', $inadd_f)) { ShowMsg("提交表单同系统配置不相符,请重新提交!", "-1"); exit(); } } //生成文档ID - $arcID = GetIndexKey($arcrank,$typeid,$sortrank,$channelid,$senddate,$mid); - if(empty($arcID)) - { - ShowMsg("无法获得主键,因此无法进行后续操作!","-1"); + $arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $mid); + if (empty($arcID)) { + ShowMsg("无法获得主键,因此无法进行后续操作!", "-1"); exit(); } //保存到附加表 $addtable = trim($cInfos['addtable']); - if(empty($addtable)) - { + if (empty($addtable)) { $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作。","javascript:;"); + ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作。", "javascript:;"); exit(); - } - else - { + } else { $inquery = "INSERT INTO `{$addtable}`(aid,typeid,arcrank,mid,channel,title,senddate,litpic,userip{$inadd_f}) Values('$arcID','$typeid','$arcrank','$mid','$channelid','$title','$senddate','','$userip'{$inadd_v})"; - if(!$dsql->ExecuteNoneQuery($inquery)) - { + if (!$dsql->ExecuteNoneQuery($inquery)) { $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请联系管理员!","javascript:;"); + ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请联系管理员!", "javascript:;"); exit(); } } //增加积分 - $dsql->ExecuteNoneQuery("UPDATE `#@__member` SET scores=scores+{$cfg_sendarc_scores} WHERE mid='".$cfg_ml->M_ID."' ; "); + $dsql->ExecuteNoneQuery("UPDATE `#@__member` SET scores=scores+{$cfg_sendarc_scores} WHERE mid='" . $cfg_ml->M_ID . "' ; "); //生成HTML - $artUrl = MakeArt($arcID,true); - if($artUrl=='') $artUrl = $cfg_phpurl."/view.php?aid=$arcID"; - + $artUrl = MakeArt($arcID, true); + if ($artUrl == '') $artUrl = $cfg_phpurl . "/view.php?aid=$arcID"; + ClearMyAddon($arcID, $title); - + //返回成功信息 $msg = "   请选择你的后续操作: @@ -224,6 +195,6 @@ else if($dopost=='save') $win = new OxWindow(); $win->AddTitle("成功发布内容:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",false); + $winform = $win->GetWindow("hand", " ", false); $win->Display(); -} \ No newline at end of file +} diff --git a/src/member/archives_sg_edit.php b/src/member/archives_sg_edit.php index 9537d2ea..a11595ab 100755 --- a/src/member/archives_sg_edit.php +++ b/src/member/archives_sg_edit.php @@ -1,19 +1,20 @@ GetOne($arcQuery); - if(!is_array($cInfos)) - { - ShowMsg("读取文档信息出错!","-1"); + if (!is_array($cInfos)) { + ShowMsg("读取文档信息出错!", "-1"); exit(); } $addRow = $dsql->GetOne("SELECT * FROM `{$cInfos['addtable']}` WHERE aid='$aid'; "); - if($addRow['mid']!=$cfg_ml->M_ID) - { - ShowMsg("对不起,你没权限操作此文档!","-1"); + if ($addRow['mid'] != $cfg_ml->M_ID) { + ShowMsg("对不起,你没权限操作此文档!", "-1"); exit(); } $addRow['id'] = $addRow['aid']; - include(DEDEMEMBER."/templets/archives_sg_edit.htm"); + include(DEDEMEMBER . "/templets/archives_sg_edit.htm"); exit(); } /*------------------------------ function _SaveArticle(){ } -------------------------------*/ -else if($dopost=='save') -{ - require_once(DEDEINC."/image.func.php"); - require_once(DEDEINC."/oxwindow.class.php"); +------------------------------*/ else if ($dopost == 'save') { + require_once(DEDEINC . "/image.func.php"); + require_once(DEDEINC . "/oxwindow.class.php"); $flag = ''; $typeid = isset($typeid) && is_numeric($typeid) ? $typeid : 0; $userip = GetIP(); - + $svali = GetCkVdValue(); - if(preg_match("/3/",$safe_gdopen)){ - if(strtolower($vdcode)!=$svali || $svali=='') - { + if (preg_match("/3/", $safe_gdopen)) { + if (strtolower($vdcode) != $svali || $svali == '') { ResetVdValue(); ShowMsg('验证码错误!', '-1'); exit(); } } - if($typeid==0) - { - ShowMsg('请指定文档隶属的栏目!','-1'); + if ($typeid == 0) { + ShowMsg('请指定文档隶属的栏目!', '-1'); exit(); } $query = "SELECT tp.ispart,tp.channeltype,tp.issend,ch.issend AS cissend,ch.sendrank,ch.arcsta,ch.addtable,ch.fieldset,ch.usertype @@ -76,9 +70,8 @@ else if($dopost=='save') $addtable = $cInfos['addtable']; //检测栏目是否有投稿权限 - if($cInfos['issend']!=1 || $cInfos['ispart']!=0|| $cInfos['channeltype']!=$channelid || $cInfos['cissend']!=1) - { - ShowMsg("你所选择的栏目不支持投稿!","-1"); + if ($cInfos['issend'] != 1 || $cInfos['ispart'] != 0 || $cInfos['channeltype'] != $channelid || $cInfos['cissend'] != 1) { + ShowMsg("你所选择的栏目不支持投稿!", "-1"); exit(); } @@ -86,16 +79,11 @@ else if($dopost=='save') CheckCSRF(); //文档的默认状态 - if($cInfos['arcsta']==0) - { + if ($cInfos['arcsta'] == 0) { $arcrank = 0; - } - else if($cInfos['arcsta']==1) - { + } else if ($cInfos['arcsta'] == 1) { $arcrank = 0; - } - else - { + } else { $arcrank = -1; } @@ -105,66 +93,57 @@ else if($dopost=='save') //分析处理附加表数据 $inadd_f = $inadd_m = ''; - if(!empty($dede_addonfields)) - { - $addonfields = explode(';',$dede_addonfields); - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (!empty($dede_addonfields)) { + $addonfields = explode(';', $dede_addonfields); + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if(!isset(${$vs[0]})) - { + $vs = explode(',', $v); + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } //自动摘要和远程图片本地化 - if($vs[1]=='htmltext'||$vs[1]=='textdata') - { - ${$vs[0]} = AnalyseHtmlBody(${$vs[0]},$description,$vs[1]); + if ($vs[1] == 'htmltext' || $vs[1] == 'textdata') { + ${$vs[0]} = AnalyseHtmlBody(${$vs[0]}, $description, $vs[1]); } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$aid); + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $aid); - $inadd_f .= ',`'.$vs[0]."` ='".${$vs[0]}."' "; - $inadd_m .= ','.$vs[0]; + $inadd_f .= ',`' . $vs[0] . "` ='" . ${$vs[0]} . "' "; + $inadd_m .= ',' . $vs[0]; } } - + // 这里对前台提交的附加数据进行一次校验 - $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'],'autofield', FALSE); - if ($fontiterm != $inadd_m) - { + $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'], 'autofield', FALSE); + if ($fontiterm != $inadd_m) { ShowMsg("提交表单同系统配置不相符,请重新提交!", "-1"); exit(); } } - if($addtable!='') - { + if ($addtable != '') { $upQuery = "UPDATE `$addtable` SET `title`='$title',`typeid`='$typeid',`arcrank`='$arcrank',userip='$userip'{$inadd_f} WHERE aid='$aid' "; - if(!$dsql->ExecuteNoneQuery($upQuery)) - { - ShowMsg("更新附加表 `$addtable` 时出错,请联系管理员!","javascript:;"); + if (!$dsql->ExecuteNoneQuery($upQuery)) { + ShowMsg("更新附加表 `$addtable` 时出错,请联系管理员!", "javascript:;"); exit(); } } - - UpIndexKey($aid,0,$typeid,$sortrank,''); - $artUrl = MakeArt($aid,true); - - if($artUrl=='') $artUrl = $cfg_phpurl."/view.php?aid=$aid"; + + UpIndexKey($aid, 0, $typeid, $sortrank, ''); + $artUrl = MakeArt($aid, true); + + if ($artUrl == '') $artUrl = $cfg_phpurl . "/view.php?aid=$aid"; //返回成功信息 $msg = "请选择你的后续操作: 发布新内容    - 查看更改 + 查看更改    查看内容    @@ -175,6 +154,6 @@ else if($dopost=='save') $win = new OxWindow(); $win->AddTitle("成功更改内容:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",false); + $winform = $win->GetWindow("hand", " ", false); $win->Display(); -} \ No newline at end of file +} diff --git a/src/member/article_add.php b/src/member/article_add.php index c30de3a2..005f7770 100755 --- a/src/member/article_add.php +++ b/src/member/article_add.php @@ -1,19 +1,20 @@ GetOne("SELECT * FROM `#@__channeltype` WHERE id='$channelid'; "); //如果限制了会员级别或类型,则允许游客投稿选项无效 - if($cInfos['sendrank']>0 || $cInfos['usertype']!='') CheckRank(0,0); + if ($cInfos['sendrank'] > 0 || $cInfos['usertype'] != '') CheckRank(0, 0); //检查会员等级和类型限制 - if($cInfos['sendrank'] > $cfg_ml->M_Rank) - { - $row = $dsql->GetOne("SELECT membername FROM `#@__arcrank` WHERE rank='".$cInfos['sendrank']."' "); - ShowMsg("对不起,需要[".$row['membername']."]才能在这个频道发布文档!","-1","0",5000); + if ($cInfos['sendrank'] > $cfg_ml->M_Rank) { + $row = $dsql->GetOne("SELECT membername FROM `#@__arcrank` WHERE rank='" . $cInfos['sendrank'] . "' "); + ShowMsg("对不起,需要[" . $row['membername'] . "]才能在这个频道发布文档!", "-1", "0", 5000); exit(); } - - if($cInfos['usertype']!='' && $cInfos['usertype'] != $cfg_ml->M_MbType) - { - ShowMsg("对不起,需要[".$cInfos['usertype']."帐号]才能在这个频道发布文档!","-1","0",5000); + + if ($cInfos['usertype'] != '' && $cInfos['usertype'] != $cfg_ml->M_MbType) { + ShowMsg("对不起,需要[" . $cInfos['usertype'] . "帐号]才能在这个频道发布文档!", "-1", "0", 5000); exit(); } - include(DEDEMEMBER."/templets/article_add.htm"); + include(DEDEMEMBER . "/templets/article_add.htm"); exit(); } /*------------------------------ function _SaveArticle(){ } -------------------------------*/ -else if($dopost=='save') -{ - include(DEDEMEMBER.'/inc/archives_check.php'); +------------------------------*/ else if ($dopost == 'save') { + include(DEDEMEMBER . '/inc/archives_check.php'); //分析处理附加表数据 $inadd_f = $inadd_v = ''; - if(!empty($dede_addonfields)) - { + if (!empty($dede_addonfields)) { $addonfields = explode(';', $dede_addonfields); $inadd_f = ''; $inadd_v = ''; - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } $vs = explode(',', $v); - if(!isset(${$vs[0]})) - { + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } - ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1],0); - $inadd_f .= ','.$vs[0]; - $inadd_v .= " ,'".${$vs[0]}."' "; + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], 0); + $inadd_f .= ',' . $vs[0]; + $inadd_v .= " ,'" . ${$vs[0]} . "' "; } } } - + // 这里对前台提交的附加数据进行一次校验 - $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'],'autofield', FALSE); - if ($fontiterm != $inadd_f) - { + $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'], 'autofield', FALSE); + if ($fontiterm != $inadd_f) { ShowMsg("提交表单同系统配置不相符,请重新提交!", "-1"); exit(); } @@ -93,9 +83,8 @@ else if($dopost=='save') //生成文档ID $arcID = GetIndexKey($arcrank, $typeid, $sortrank, $channelid, $senddate, $mid); - if(empty($arcID)) - { - ShowMsg("无法获得主键,因此无法进行后续操作!","-1"); + if (empty($arcID)) { + ShowMsg("无法获得主键,因此无法进行后续操作!", "-1"); exit(); } @@ -104,51 +93,46 @@ else if($dopost=='save') color,writer,source,litpic,pubdate,senddate,mid,description,keywords,mtype) VALUES ('$arcID','$typeid','$sortrank','$flag','$ismake','$channelid','$arcrank','0','$money','$title','$shorttitle', '$color','$writer','$source','','$pubdate','$senddate','$mid','$description','$keywords','$mtypesid'); "; - if(!$dsql->ExecuteNoneQuery($inQuery)) - { + if (!$dsql->ExecuteNoneQuery($inQuery)) { $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID' "); - ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请联系管理员。","javascript:;"); + ShowMsg("把数据保存到数据库主表 `#@__archives` 时出错,请联系管理员。", "javascript:;"); exit(); } //保存到附加表 $addtable = trim($cInfos['addtable']); - if(empty($addtable)) - { + if (empty($addtable)) { $dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'"); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作!。","javascript:;"); + ShowMsg("没找到当前模型[{$channelid}]的主表信息,无法完成操作!。", "javascript:;"); exit(); - } - else - { + } else { $inquery = "INSERT INTO `{$addtable}`(aid,typeid,userip,redirecturl,templet,body{$inadd_f}) Values('$arcID','$typeid','$userip','','','$body'{$inadd_v})"; - if(!$dsql->ExecuteNoneQuery($inquery)) - { + if (!$dsql->ExecuteNoneQuery($inquery)) { $gerr = $dsql->GetError(); $dsql->ExecuteNoneQuery("DELETE FROM `#@__archives` WHERE id='$arcID'"); $dsql->ExecuteNoneQuery("DELETE FROM `#@__arctiny` WHERE id='$arcID'"); - ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请联系管理员!","javascript:;"); + ShowMsg("把数据保存到数据库附加表 `{$addtable}` 时出错,请联系管理员!", "javascript:;"); exit(); } } //增加积分 - $dsql->ExecuteNoneQuery("UPDATE `#@__member` set scores=scores+{$cfg_sendarc_scores} WHERE mid='".$cfg_ml->M_ID."' ; "); + $dsql->ExecuteNoneQuery("UPDATE `#@__member` set scores=scores+{$cfg_sendarc_scores} WHERE mid='" . $cfg_ml->M_ID . "' ; "); //更新统计 countArchives($channelid); //生成HTML InsertTags($tags, $arcID); $artUrl = MakeArt($arcID, TRUE); - if($artUrl=='') $artUrl = $cfg_phpurl."/view.php?aid=$arcID"; - + if ($artUrl == '') $artUrl = $cfg_phpurl . "/view.php?aid=$arcID"; + ClearMyAddon($arcID, $title); - + //返回成功信息 $msg = - "请选择你的后续操作: + "请选择你的后续操作: 继续发布文章    查看文章 @@ -161,6 +145,6 @@ VALUES ('$arcID','$typeid','$sortrank','$flag','$ismake','$channelid','$arcrank' $win = new OxWindow(); $win->AddTitle("成功发布文章:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",false); + $winform = $win->GetWindow("hand", " ", false); $win->Display(); -} \ No newline at end of file +} diff --git a/src/member/article_edit.php b/src/member/article_edit.php index d4cfc302..2697908d 100755 --- a/src/member/article_edit.php +++ b/src/member/article_edit.php @@ -1,19 +1,20 @@ M_ID."'; "; + WHERE arc.id='$aid' And arc.mid='" . $cfg_ml->M_ID . "'; "; $row = $dsql->GetOne($arcQuery); - if(!is_array($row)) - { - ShowMsg("读取文章信息出错!","-1"); + if (!is_array($row)) { + ShowMsg("读取文章信息出错!", "-1"); exit(); - } - else if($row['arcrank']>=0) - { + } else if ($row['arcrank'] >= 0) { $dtime = time(); - $maxtime = $cfg_mb_editday * 24 *3600; - if($dtime - $row['senddate'] > $maxtime) - { - ShowMsg("这篇文档已经锁定,你不能再修改它!","-1"); + $maxtime = $cfg_mb_editday * 24 * 3600; + if ($dtime - $row['senddate'] > $maxtime) { + ShowMsg("这篇文档已经锁定,你不能再修改它!", "-1"); exit(); } } $addRow = $dsql->GetOne("SELECT * FROM `{$row['addtable']}` WHERE aid='$aid'; "); - include(DEDEMEMBER."/templets/article_edit.htm"); + include(DEDEMEMBER . "/templets/article_edit.htm"); exit(); } /*------------------------------ function _SaveArticle(){ } -------------------------------*/ -else if($dopost=='save') -{ - include(DEDEMEMBER.'/inc/archives_check_edit.php'); +------------------------------*/ else if ($dopost == 'save') { + include(DEDEMEMBER . '/inc/archives_check_edit.php'); //分析处理附加表数据 $inadd_f = $inadd_m = ''; - if(!empty($dede_addonfields)) - { - $addonfields = explode(';',$dede_addonfields); - if(is_array($addonfields)) - { - foreach($addonfields as $v) - { - if($v=='') - { + if (!empty($dede_addonfields)) { + $addonfields = explode(';', $dede_addonfields); + if (is_array($addonfields)) { + foreach ($addonfields as $v) { + if ($v == '') { continue; } - $vs = explode(',',$v); - if(!isset(${$vs[0]})) - { + $vs = explode(',', $v); + if (!isset(${$vs[0]})) { ${$vs[0]} = ''; } - ${$vs[0]} = GetFieldValueA(${$vs[0]},$vs[1],$aid); - $inadd_f .= ','.$vs[0]." ='".${$vs[0]}."' "; - $inadd_m .= ','.$vs[0]; + ${$vs[0]} = GetFieldValueA(${$vs[0]}, $vs[1], $aid); + $inadd_f .= ',' . $vs[0] . " ='" . ${$vs[0]} . "' "; + $inadd_m .= ',' . $vs[0]; } } - + // 这里对前台提交的附加数据进行一次校验 - $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'],'autofield', FALSE); + $fontiterm = PrintAutoFieldsAdd($cInfos['fieldset'], 'autofield', FALSE); - if ($fontiterm != $inadd_m) - { + if ($fontiterm != $inadd_m) { ShowMsg("提交表单同系统配置不相符,请重新提交!", "-1"); exit(); } } - - $body = AnalyseHtmlBody($body,$description); - $body = HtmlReplace($body,-1); + + $body = AnalyseHtmlBody($body, $description); + $body = HtmlReplace($body, -1); //更新数据库的SQL语句 $upQuery = "UPDATE `#@__archives` SET @@ -104,32 +92,28 @@ else if($dopost=='save') keywords='$keywords', flag='$flag' WHERE id='$aid' AND mid='$mid'; "; - if(!$dsql->ExecuteNoneQuery($upQuery)) - { - ShowMsg("把数据保存到数据库主表时出错,请联系管理员!".$dsql->GetError(),"-1"); + if (!$dsql->ExecuteNoneQuery($upQuery)) { + ShowMsg("把数据保存到数据库主表时出错,请联系管理员!" . $dsql->GetError(), "-1"); exit(); } - if($addtable!='') - { + if ($addtable != '') { $upQuery = "UPDATE `$addtable` SET typeid='$typeid',body='$body'{$inadd_f},userip='$userip' WHERE aid='$aid' "; - if(!$dsql->ExecuteNoneQuery($upQuery)) - { - ShowMsg("更新附加表 `$addtable` 时出错,请联系管理员!","javascript:;"); + if (!$dsql->ExecuteNoneQuery($upQuery)) { + ShowMsg("更新附加表 `$addtable` 时出错,请联系管理员!", "javascript:;"); exit(); } } UpIndexKey($aid, $arcrank, $typeid, $sortrank, $tags); - $artUrl = MakeArt($aid,true); - if($artUrl=='') - { - $artUrl = $cfg_phpurl."/view.php?aid=$aid"; + $artUrl = MakeArt($aid, true); + if ($artUrl == '') { + $artUrl = $cfg_phpurl . "/view.php?aid=$aid"; } //返回成功信息 $msg = "  请选择你的后续操作: 发布新文章    - 查看更改 + 查看更改    查看文章    @@ -140,6 +124,6 @@ else if($dopost=='save') $win = new OxWindow(); $win->AddTitle("成功更改文章:"); $win->AddMsgItem($msg); - $winform = $win->GetWindow("hand"," ",false); + $winform = $win->GetWindow("hand", " ", false); $win->Display(); -} \ No newline at end of file +} diff --git a/src/member/buy.php b/src/member/buy.php index 35d1b912..84cd0bfd 100755 --- a/src/member/buy.php +++ b/src/member/buy.php @@ -1,22 +1,22 @@ M_LoginID; +$myurl = $cfg_basehost . $cfg_member_dir . '/index.php?uid=' . $cfg_ml->M_LoginID; $moneycards = ''; $membertypes = ''; $dsql->SetQuery("SELECT * FROM `#@__moneycard_type`"); $dsql->Execute(); -while($row = $dsql->GetObject()) -{ +while ($row = $dsql->GetObject()) { $row->money = sprintf("%01.2f", $row->money); $moneycards .= " @@ -28,9 +28,8 @@ while($row = $dsql->GetObject()) } $dsql->SetQuery("SELECT `#@__member_type`.*,`#@__arcrank`.membername,`#@__arcrank`.money as cm From `#@__member_type` LEFT JOIN `#@__arcrank` on `#@__arcrank`.rank = `#@__member_type`.rank "); $dsql->Execute(); -while($row = $dsql->GetObject()) -{ - $row->money = sprintf("%01.2f", $row->money); +while ($row = $dsql->GetObject()) { + $row->money = sprintf("%01.2f", $row->money); $membertypes .= " {$row->pname} @@ -41,5 +40,5 @@ while($row = $dsql->GetObject()) "; } $tpl = new DedeTemplate(); -$tpl->LoadTemplate(DEDEMEMBER.'/templets/buy.htm'); -$tpl->Display(); \ No newline at end of file +$tpl->LoadTemplate(DEDEMEMBER . '/templets/buy.htm'); +$tpl->Display(); diff --git a/src/member/buy_action.php b/src/member/buy_action.php index fc4107c2..5e21f8a8 100755 --- a/src/member/buy_action.php +++ b/src/member/buy_action.php @@ -2,7 +2,7 @@ /** * @version $Id: buy_action.php 1 8:38 2010年7月9日Z tianya $ - * @package DedeCMS.Member + * @package DedeBIZ.Member * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/member/check_card.php b/src/member/check_card.php index 8d0b99a7..861eed5d 100755 --- a/src/member/check_card.php +++ b/src/member/check_card.php @@ -1,44 +1,41 @@ -GetOne("SELECT * FROM #@__moneycard_record WHERE cardid='$cardid' "); -if(!is_array($row)) -{ - ShowMsg("卡号错误:不存在此卡号!","-1"); +if (!is_array($row)) { + ShowMsg("卡号错误:不存在此卡号!", "-1"); exit(); } -if($row['isexp']==-1) -{ - ShowMsg("此卡号已经失效,不能再次使用!","-1"); +if ($row['isexp'] == -1) { + ShowMsg("此卡号已经失效,不能再次使用!", "-1"); exit(); } $hasMoney = $row['num']; -$dsql->ExecuteNoneQuery("UPDATE `#@__moneycard_record` SET uid='".$cfg_ml->M_ID."',isexp='-1',utime='".time()."' WHERE cardid='$cardid' "); -$dsql->ExecuteNoneQuery("UPDATE `#@__member` SET money=money+$hasMoney WHERE mid='".$cfg_ml->M_ID."'"); +$dsql->ExecuteNoneQuery("UPDATE `#@__moneycard_record` SET uid='" . $cfg_ml->M_ID . "',isexp='-1',utime='" . time() . "' WHERE cardid='$cardid' "); +$dsql->ExecuteNoneQuery("UPDATE `#@__member` SET money=money+$hasMoney WHERE mid='" . $cfg_ml->M_ID . "'"); -ShowMsg("充值成功,你本次增加的金币为:{$hasMoney} 个!",-1); -exit(); \ No newline at end of file +ShowMsg("充值成功,你本次增加的金币为:{$hasMoney} 个!", -1); +exit(); diff --git a/src/member/config.php b/src/member/config.php index 99c8f749..0037123d 100755 --- a/src/member/config.php +++ b/src/member/config.php @@ -1,22 +1,22 @@ $value) - { - if(in_array($key,array('tags','body','dede_fields','dede_addonfields','dopost','introduce'))) continue; + foreach ($val as $key => $value) { + if (in_array($key, array('tags', 'body', 'dede_fields', 'dede_addonfields', 'dopost', 'introduce'))) continue; $val[$key] = XSSClean($val[$key]); } return $val; @@ -27,45 +27,45 @@ function XSSClean($val) { $search .= '1234567890!@#$%^&*()'; $search .= '~`";:?+/={}[]-_|\'\\'; for ($i = 0; $i < strlen($search); $i++) { - $val = preg_replace('/(&#[xX]0{0,8}'.dechex(ord($search[$i])).';?)/i', $search[$i], $val); // with a ; - $val = preg_replace('/(�{0,8}'.ord($search[$i]).';?)/', $search[$i], $val); // with a ; + $val = preg_replace('/(&#[xX]0{0,8}' . dechex(ord($search[$i])) . ';?)/i', $search[$i], $val); // with a ; + $val = preg_replace('/(�{0,8}' . ord($search[$i]) . ';?)/', $search[$i], $val); // with a ; } - - $val = str_replace("`","‘",$val); - $val = str_replace("'","‘",$val); - $val = str_replace("\"","“",$val); - $val = str_replace(",",",",$val); - $val = str_replace("(","(",$val); - $val = str_replace(")",")",$val); + + $val = str_replace("`", "‘", $val); + $val = str_replace("'", "‘", $val); + $val = str_replace("\"", "“", $val); + $val = str_replace(",", ",", $val); + $val = str_replace("(", "(", $val); + $val = str_replace(")", ")", $val); $ra1 = array('javascript', 'vbscript', 'expression', 'applet', 'meta', 'xml', 'blink', 'link', 'style', 'script', 'embed', 'object', 'iframe', 'frame', 'frameset', 'ilayer', 'layer', 'bgsound', 'title', 'base'); $ra2 = array('onabort', 'onactivate', 'onafterprint', 'onafterupdate', 'onbeforeactivate', 'onbeforecopy', 'onbeforecut', 'onbeforedeactivate', 'onbeforeeditfocus', 'onbeforepaste', 'onbeforeprint', 'onbeforeunload', 'onbeforeupdate', 'onblur', 'onbounce', 'oncellchange', 'onchange', 'onclick', 'oncontextmenu', 'oncontrolselect', 'oncopy', 'oncut', 'ondataavailable', 'ondatasetchanged', 'ondatasetcomplete', 'ondblclick', 'ondeactivate', 'ondrag', 'ondragend', 'ondragenter', 'ondragleave', 'ondragover', 'ondragstart', 'ondrop', 'onerror', 'onerrorupdate', 'onfilterchange', 'onfinish', 'onfocus', 'onfocusin', 'onfocusout', 'onhelp', 'onkeydown', 'onkeypress', 'onkeyup', 'onlayoutcomplete', 'onload', 'onlosecapture', 'onmousedown', 'onmouseenter', 'onmouseleave', 'onmousemove', 'onmouseout', 'onmouseover', 'onmouseup', 'onmousewheel', 'onmove', 'onmoveend', 'onmovestart', 'onpaste', 'onpropertychange', 'onreadystatechange', 'onreset', 'onresize', 'onresizeend', 'onresizestart', 'onrowenter', 'onrowexit', 'onrowsdelete', 'onrowsinserted', 'onscroll', 'onselect', 'onselectionchange', 'onselectstart', 'onstart', 'onstop', 'onsubmit', 'onunload'); $ra = array_merge($ra1, $ra2); - $found = true; + $found = true; while ($found == true) { - $val_before = $val; - for ($i = 0; $i < sizeof($ra); $i++) { - $pattern = '/'; - for ($j = 0; $j < strlen($ra[$i]); $j++) { - if ($j > 0) { - $pattern .= '('; - $pattern .= '(&#[xX]0{0,8}([9ab]);)'; - $pattern .= '|'; - $pattern .= '|(�{0,8}([9|10|13]);)'; - $pattern .= ')*'; + $val_before = $val; + for ($i = 0; $i < sizeof($ra); $i++) { + $pattern = '/'; + for ($j = 0; $j < strlen($ra[$i]); $j++) { + if ($j > 0) { + $pattern .= '('; + $pattern .= '(&#[xX]0{0,8}([9ab]);)'; + $pattern .= '|'; + $pattern .= '|(�{0,8}([9|10|13]);)'; + $pattern .= ')*'; + } + $pattern .= $ra[$i][$j]; + } + $pattern .= '/i'; + $replacement = substr($ra[$i], 0, 2) . '' . substr($ra[$i], 2); + $val = preg_replace($pattern, $replacement, $val); + if ($val_before == $val) { + $found = false; } - $pattern .= $ra[$i][$j]; - } - $pattern .= '/i'; - $replacement = substr($ra[$i], 0, 2).''.substr($ra[$i], 2); - $val = preg_replace($pattern, $replacement, $val); - if ($val_before == $val) { - $found = false; - } - } + } } - if($cfg_soft_lang=='gb2312') utf82gb($val); + if ($cfg_soft_lang == 'gb2312') utf82gb($val); return $val; } $_GET = XSSClean($_GET); @@ -73,10 +73,10 @@ $_POST = XSSClean($_POST); $_REQUEST = XSSClean($_REQUEST); $_COOKIE = XSSClean($_COOKIE); -require_once(dirname(__FILE__).'/../include/common.inc.php'); -require_once(DEDEINC.'/filter.inc.php'); -require_once(DEDEINC.'/memberlogin.class.php'); -require_once(DEDEINC.'/dedetemplate.class.php'); +require_once(dirname(__FILE__) . '/../include/common.inc.php'); +require_once(DEDEINC . '/filter.inc.php'); +require_once(DEDEINC . '/memberlogin.class.php'); +require_once(DEDEINC . '/dedetemplate.class.php'); // 检查CSRF function CheckCSRF() @@ -84,21 +84,22 @@ function CheckCSRF() $cc_csrf_token_check = GetCookie("dede_csrf_token"); if ( !(isset($_POST['_csrf_token'], $cc_csrf_token_check) - && is_string($_POST['_csrf_token']) && is_string($cc_csrf_token_check) - && hash_equals($_POST['_csrf_token'], $cc_csrf_token_check)) + && is_string($_POST['_csrf_token']) && is_string($cc_csrf_token_check) + && hash_equals($_POST['_csrf_token'], $cc_csrf_token_check)) ) { ShowMsg('CSRF校验失败,请刷新页面重新提交', '-1'); exit(); } - + DropCookie("dede_csrf_token"); } // 生成CSRF校验token,在比较重要的表单中应该要加上这个token校验 $cc_csrf_token = GetCookie("dede_csrf_token"); if (!isset($GLOBALS['csrf_token']) || $GLOBALS['csrf_token'] === null) { - if (isset($cc_csrf_token) && is_string($cc_csrf_token) - && preg_match('#^[0-9a-f]{32}$#iS',$cc_csrf_token) === 1 + if ( + isset($cc_csrf_token) && is_string($cc_csrf_token) + && preg_match('#^[0-9a-f]{32}$#iS', $cc_csrf_token) === 1 ) { $GLOBALS['csrf_token'] = $cc_csrf_token; } else { @@ -118,13 +119,11 @@ $dedeNowurls = explode('?', $dedeNowurl); $s_scriptName = $dedeNowurls[0]; $menutype = ''; $menutype_son = ''; -$gourl = empty($gourl)? "" : RemoveXSS($gourl); +$gourl = empty($gourl) ? "" : RemoveXSS($gourl); //检查是否开放会员功能 -if($cfg_mb_open=='N') -{ - if ( defined( 'AJAXLOGIN' ) ) - { +if ($cfg_mb_open == 'N') { + if (defined('AJAXLOGIN')) { if ($format === 'json') { echo json_encode(array( "code" => -1, @@ -136,27 +135,25 @@ if($cfg_mb_open=='N') die(''); } } else { - ShowMsg("系统关闭了会员功能,因此你无法访问此页面!","javascript:;"); + ShowMsg("系统关闭了会员功能,因此你无法访问此页面!", "javascript:;"); exit(); } - } $keeptime = isset($keeptime) && is_numeric($keeptime) ? $keeptime : -1; $cfg_ml = new MemberLogin($keeptime); //判断用户是否登录 $myurl = ''; -if($cfg_ml->IsLogin()) -{ - $myurl = $cfg_memberurl."/index.php?uid=".urlencode($cfg_ml->M_LoginID); - if(!preg_match("#^http[s]?:#i", $myurl)) $myurl = $cfg_basehost.$myurl; - if ($cfg_ml->fields['face'] =="") { - $cfg_ml->fields['face'] = $cfg_cmsurl."/static/img/avatar.png"; +if ($cfg_ml->IsLogin()) { + $myurl = $cfg_memberurl . "/index.php?uid=" . urlencode($cfg_ml->M_LoginID); + if (!preg_match("#^http[s]?:#i", $myurl)) $myurl = $cfg_basehost . $myurl; + if ($cfg_ml->fields['face'] == "") { + $cfg_ml->fields['face'] = $cfg_cmsurl . "/static/img/avatar.png"; } } /** 有没新短信 **/ -$pms = $dsql->GetOne("SELECT COUNT(*) AS nums FROM #@__member_pms WHERE toid='{$cfg_ml->M_ID}' AND `hasview`=0 AND folder = 'inbox'"); +$pms = $dsql->GetOne("SELECT COUNT(*) AS nums FROM #@__member_pms WHERE toid='{$cfg_ml->M_ID}' AND `hasview`=0 AND folder = 'inbox'"); /** * 检查用户是否有权限进行某个操作 @@ -166,56 +163,42 @@ $pms = $dsql->GetOne("SELECT COUNT(*) AS nums FROM #@__member_pms WHERE toid='{$ * @param bool $needinfo 是否需要填写详细信息 * @return void */ -function CheckRank($rank=0, $money=0, $needinfo=TRUE) +function CheckRank($rank = 0, $money = 0, $needinfo = TRUE) { - global $cfg_ml,$cfg_memberurl,$cfg_mb_spacesta; - if(!$cfg_ml->IsLogin()) - { - header("Location:{$cfg_memberurl}/login.php?gourl=".urlencode(GetCurUrl())); + global $cfg_ml, $cfg_memberurl, $cfg_mb_spacesta; + if (!$cfg_ml->IsLogin()) { + header("Location:{$cfg_memberurl}/login.php?gourl=" . urlencode(GetCurUrl())); exit(); - } - else - { - if($cfg_mb_spacesta == '-10') - { + } else { + if ($cfg_mb_spacesta == '-10') { //如果启用注册邮件验证 - if($cfg_ml->fields['spacesta'] == '-10') - { - $msg="您尚未进行邮件验证,请到邮箱查阅...
      重新发送邮件验证 点击此处"; - ShowMsg($msg,"-1",0,5000); + if ($cfg_ml->fields['spacesta'] == '-10') { + $msg = "您尚未进行邮件验证,请到邮箱查阅...
      重新发送邮件验证 点击此处"; + ShowMsg($msg, "-1", 0, 5000); exit; } } - if($cfg_ml->M_Rank < $rank) - { + if ($cfg_ml->M_Rank < $rank) { $needname = ""; - if($cfg_ml->M_Rank==0) - { + if ($cfg_ml->M_Rank == 0) { $row = $dsql->GetOne("SELECT membername FROM #@__arcrank WHERE rank='$rank'"); $myname = "普通会员"; $needname = $row['membername']; - } - else - { - $dsql->SetQuery("SELECT membername From #@__arcrank WHERE rank='$rank' OR rank='".$cfg_ml->M_Rank."' ORDER BY rank DESC"); + } else { + $dsql->SetQuery("SELECT membername From #@__arcrank WHERE rank='$rank' OR rank='" . $cfg_ml->M_Rank . "' ORDER BY rank DESC"); $dsql->Execute(); $row = $dsql->GetObject(); $needname = $row->membername; - if($row = $dsql->GetObject()) - { + if ($row = $dsql->GetObject()) { $myname = $row->membername; - } - else - { + } else { $myname = "普通会员"; } } - ShowMsg("对不起,需要:$needname 才能访问本页面。
      你目前的等级是:$myname 。","-1",0,5000); + ShowMsg("对不起,需要:$needname 才能访问本页面。
      你目前的等级是:$myname 。", "-1", 0, 5000); exit(); - } - else if($cfg_ml->M_Money < $money) - { - ShowMsg("对不起,需要花费金币:$money 才能访问本页面。
      你目前拥有的金币是:".$cfg_ml->M_Money." 。","-1",0,5000); + } else if ($cfg_ml->M_Money < $money) { + ShowMsg("对不起,需要花费金币:$money 才能访问本页面。
      你目前拥有的金币是:" . $cfg_ml->M_Money . " 。", "-1", 0, 5000); exit(); } } @@ -230,25 +213,19 @@ function CheckRank($rank=0, $money=0, $needinfo=TRUE) */ function countArchives($channelid) { - global $cfg_ml,$dsql; + global $cfg_ml, $dsql; $id = (int)$channelid; - if($cfg_ml->IsLogin()) - { - $channeltype = array(1 => 'article',2 => 'album',3 => 'soft',-8 => 'infos'); - if(isset($channeltype[$id])) - { + if ($cfg_ml->IsLogin()) { + $channeltype = array(1 => 'article', 2 => 'album', 3 => 'soft', -8 => 'infos'); + if (isset($channeltype[$id])) { $_field = $channeltype[$id]; - } - else - { + } else { $_field = 'articles'; } - $row = $dsql->GetOne("SELECT COUNT(*) AS nums FROM #@__archives WHERE channel='$id' AND mid='".$cfg_ml->M_ID."'"); - - $dsql->ExecuteNoneQuery("UPDATE #@__member_tj SET ".$_field."='".$row['nums']."' WHERE mid='".$cfg_ml->M_ID."'"); - } - else - { + $row = $dsql->GetOne("SELECT COUNT(*) AS nums FROM #@__archives WHERE channel='$id' AND mid='" . $cfg_ml->M_ID . "'"); + + $dsql->ExecuteNoneQuery("UPDATE #@__member_tj SET " . $_field . "='" . $row['nums'] . "' WHERE mid='" . $cfg_ml->M_ID . "'"); + } else { return FALSE; } -} \ No newline at end of file +} diff --git a/src/member/content_list.php b/src/member/content_list.php index 68f3110d..3dae88c1 100755 --- a/src/member/content_list.php +++ b/src/member/content_list.php @@ -4,7 +4,7 @@ * 内容列表 * * @version $Id: content_list.php 1 13:52 2010年7月9日Z tianya $ - * @package DedeCMS.Member + * @package DedeBIZ.Member * @copyright Copyright (c) 2020, DedeBIZ.COM * @license https://www.dedebiz.com/license * @link https://www.dedebiz.com diff --git a/src/member/content_sg_list.php b/src/member/content_sg_list.php index aa0f7f8c..71fd9c2a 100755 --- a/src/member/content_sg_list.php +++ b/src/member/content_sg_list.php @@ -1,62 +1,56 @@ M_ID; $tl = new TypeLink($cid); $cInfos = $tl->dsql->GetOne("SELECT arcsta,issend,issystem,usertype,typename,addtable FROM `#@__channeltype` WHERE id='$channelid'; "); -if(!is_array($cInfos)) -{ +if (!is_array($cInfos)) { ShowMsg('模型不存在', '-1'); exit(); } $arcsta = $cInfos['arcsta']; //禁止访问无权限的模型 -if($cInfos['usertype'] !='' && $cInfos['usertype']!=$cfg_ml->M_MbType) -{ +if ($cInfos['usertype'] != '' && $cInfos['usertype'] != $cfg_ml->M_MbType) { ShowMsg('你无权限访问该部分', '-1'); exit(); } -if($cid==0) -{ - $positionname = $cInfos['typename']." >> "; -} -else -{ - $positionname = str_replace($cfg_list_symbol," >> ",$tl->GetPositionName())." >> "; +if ($cid == 0) { + $positionname = $cInfos['typename'] . " >> "; +} else { + $positionname = str_replace($cfg_list_symbol, " >> ", $tl->GetPositionName()) . " >> "; } $whereSql = " WHERE arc.channel = '$channelid' AND arc.mid='$mid' "; -if($keyword!='') -{ - $keyword = cn_substr(trim(preg_replace("#[><\|\"\r\n\t%\*\.\?\(\)\$ ;,'%-]#", "", stripslashes($keyword))),30); +if ($keyword != '') { + $keyword = cn_substr(trim(preg_replace("#[><\|\"\r\n\t%\*\.\?\(\)\$ ;,'%-]#", "", stripslashes($keyword))), 30); $keyword = addslashes($keyword); $whereSql .= " AND (arc.title like '%$keyword%') "; } -if($cid!=0) -{ - $whereSql .= " AND arc.typeid in (".GetSonIds($cid).")"; +if ($cid != 0) { + $whereSql .= " AND arc.typeid in (" . GetSonIds($cid) . ")"; } if ($arcrank == '1') { $whereSql .= " And arc.arcrank >= 0"; @@ -73,10 +67,10 @@ $query = "SELECT arc.aid,arc.aid as id,arc.typeid,arc.senddate,arc.channel,arc.c ORDER BY arc.aid desc "; $dlist = new DataListCP(); $dlist->pageSize = 20; -$dlist->SetParameter("dopost","listArchives"); -$dlist->SetParameter("keyword",$keyword); -$dlist->SetParameter("cid",$cid); -$dlist->SetParameter("channelid",$channelid); -$dlist->SetTemplate(DEDEMEMBER."/templets/content_sg_list.htm"); +$dlist->SetParameter("dopost", "listArchives"); +$dlist->SetParameter("keyword", $keyword); +$dlist->SetParameter("cid", $cid); +$dlist->SetParameter("channelid", $channelid); +$dlist->SetTemplate(DEDEMEMBER . "/templets/content_sg_list.htm"); $dlist->SetSource($query); -$dlist->Display(); \ No newline at end of file +$dlist->Display(); diff --git a/src/member/control.php b/src/member/control.php index 8565d2f6..3190a8bc 100755 --- a/src/member/control.php +++ b/src/member/control.php @@ -1,9 +1,10 @@ M_ID}' "; $dsql->ExecuteNoneQuery($query); // 清除缓存 @@ -31,5 +29,5 @@ if($dopost=='save') exit(); } $face = $cfg_ml->fields['face']; -include(DEDEMEMBER."/templets/edit_face.htm"); +include(DEDEMEMBER . "/templets/edit_face.htm"); exit(); diff --git a/src/member/feedback.php b/src/member/feedback.php index 021b83d3..b53f1ac3 100755 --- a/src/member/feedback.php +++ b/src/member/feedback.php @@ -1,12 +1,13 @@ GetOne("SELECT COUNT(*) AS dd FROM `#@__member_flink` WHERE mid='".$cfg_ml->M_ID."' "); - if($row['dd']>=50) - { + $row = $dsql->GetOne("SELECT COUNT(*) AS dd FROM `#@__member_flink` WHERE mid='" . $cfg_ml->M_ID . "' "); + if ($row['dd'] >= 50) { echo "增加网址失败,因为已经达到五十个网址的上限!"; GetLinkList($dsql); exit(); } - if(!preg_match("#^http:\/\/#",$url)) $url = "http://".HtmlReplace($url, 2); + if (!preg_match("#^http:\/\/#", $url)) $url = "http://" . HtmlReplace($url, 2); $title = HtmlReplace($title); $url = HtmlReplace($url); - $inquery = "INSERT INTO `#@__member_flink`(mid,title,url) VALUES(".$cfg_ml->M_ID.",'$title','$url'); "; + $inquery = "INSERT INTO `#@__member_flink`(mid,title,url) VALUES(" . $cfg_ml->M_ID . ",'$title','$url'); "; $dsql->ExecuteNoneQuery($inquery); echo "成功增加一链接!"; GetLinkList($dsql); exit(); -} -else if($dopost=="del") -{ +} else if ($dopost == "del") { AjaxHead(); $aid = intval($aid); - if(empty($aid)) exit("参数错误!"); + if (empty($aid)) exit("参数错误!"); - $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_flink` WHERE aid='$aid' AND mid='".$cfg_ml->M_ID."';"); + $dsql->ExecuteNoneQuery("DELETE FROM `#@__member_flink` WHERE aid='$aid' AND mid='" . $cfg_ml->M_ID . "';"); echo "成功删除链接:{$aid}"; GetLinkList($dsql); -} -else if($dopost=="update") -{ +} else if ($dopost == "update") { AjaxHead(); $aid = intval($aid); - if(!preg_match("#^http:\/\/#", $url)) $url = "http://".HtmlReplace($url,2); - + if (!preg_match("#^http:\/\/#", $url)) $url = "http://" . HtmlReplace($url, 2); + $title = HtmlReplace($title); - $url = HtmlReplace($url); - $upquery = "UPDATE `#@__member_flink` SET title='$title',url='$url' WHERE aid='$aid' AND mid='".$cfg_ml->M_ID."'; "; + $url = HtmlReplace($url); + $upquery = "UPDATE `#@__member_flink` SET title='$title',url='$url' WHERE aid='$aid' AND mid='" . $cfg_ml->M_ID . "'; "; $rs = $dsql->ExecuteNoneQuery($upquery); - if($rs) - { + if ($rs) { echo "成功更新链接:{$title}"; GetLinkList($dsql); exit(); - } - else - { + } else { echo "更新链接:{$title} 失败!"; GetLinkList($dsql); exit(); } -} -else if($dopost=="reload") -{ +} else if ($dopost == "reload") { AjaxHead(); GetLinkList($dsql); exit(); } //默认界面 -else -{ - require_once(dirname(__FILE__)."/templets/flink_main.htm"); +else { + require_once(dirname(__FILE__) . "/templets/flink_main.htm"); exit(); } @@ -92,11 +80,10 @@ else function GetLinkList(&$dsql) { global $cfg_ml; - $dsql->SetQuery("SELECT * FROM `#@__member_flink` WHERE mid='".$cfg_ml->M_ID."' ORDER BY aid DESC"); + $dsql->SetQuery("SELECT * FROM `#@__member_flink` WHERE mid='" . $cfg_ml->M_ID . "' ORDER BY aid DESC"); $dsql->Execute(); - $j=0; - while($row = $dsql->GetArray()) - { + $j = 0; + while ($row = $dsql->GetArray()) { $j++; $line = "