www.gusucode.com > 08CMS空白站群系统 3.3 繁体 UTF-8 > upload/admina/fcatalogs.inc.php
<?php (!defined('M_COM') || !defined('M_ADMIN')) && exit('No Permission'); aheader(); !checkapermission(97) && amessage(lang('no_apermission')); if($sid && $sid_self) amessage(lang('msite admin item !')); load_cache('fcatalogs,fchannels,currencys,grouptypes,mtpls'); $fchidsarr = fchidsarr(); empty($fchidsarr) && amessage(lang('please define freeinfo channel')); if($action == 'fcatalogsedit'){ if(!submitcheck('bfcatalogsedit') && !submitcheck('bfcatalogadd')){ a_guide('fcatalogsedit'); tabheader(lang('message coclass manager'),'fcatalogsedit','?entry=fcatalogs&action=fcatalogsedit','7'); trcategory(array(lang('sn'),lang('coclass cname'),lang('order'),lang('channel'),lang('consult'),lang('detail'),lang('delete'))); $k = 0; foreach($fcatalogs as $caid => $fcatalog){ $k ++; $fcatalog = read_cache('fcatalog',$caid); echo "<tr>\n". "<td class=\"item1\" align=\"center\" width=\"30\">$k</td>\n". "<td class=\"item2\"><input type=\"text\" name=\"fcatalogsnew[$caid][title]\" value=\"".mhtmlspecialchars($fcatalog['title'])."\" size=\"25\" maxlength=\"30\"></td>\n". "<td class=\"item1\" align=\"center\" width=\"50\"><input type=\"text\" name=\"fcatalogsnew[$caid][vieworder]\" value=\"$fcatalog[vieworder]\" size=\"2\"></td>\n". "<td class=\"item2\" align=\"center\" width=\"100\">".mhtmlspecialchars($fchannels[$fcatalog['chid']]['cname'])."</td>\n". "<td class=\"item1\" align=\"center\" width=\"30\">".($fcatalog['cumode'] ? 'Y' : '-')."</td>\n". "<td class=\"item2\" align=\"center\" width=\"30\"><a href=\"?entry=fcatalogs&action=fcatalogdetail&caid=$caid\">".lang('setting')."</a></td>\n". "<td class=\"item1\" align=\"center\" width=\"30\"><a href=\"?entry=fcatalogs&action=fcatalogdelete&caid=$caid\">".lang('delete')."</a></td>\n". "</tr>"; } tabfooter('bfcatalogsedit'); tabheader(lang('add message coclass'),'fcatalogadd','?entry=fcatalogs&action=fcatalogsedit'); trbasic(lang('coclass cname'),'fcatalognew[title]','','text'); trbasic(lang('freeinfo channel'),'fcatalognew[chid]',makeoption($fchidsarr),'select'); trbasic(lang('weather consult coclass'),'fcatalognew[cumode]',0,'radio'); tabfooter('bfcatalogadd'); }elseif(submitcheck('bfcatalogsedit')){ if(!empty($fcatalogsnew)){ foreach($fcatalogsnew as $caid => $fcatalognew){ $fcatalognew['title'] = $fcatalognew['title'] ? $fcatalognew['title'] : $fcatalogs[$caid]['title']; $fcatalognew['vieworder'] = max(0,intval($fcatalognew['vieworder'])); if(($fcatalognew['title'] != $fcatalogs[$caid]['title']) || ($fcatalognew['vieworder'] != $fcatalogs[$caid]['vieworder'])){ $db->query("UPDATE {$tblprefix}fcatalogs SET title='$fcatalognew[title]', vieworder='$fcatalognew[vieworder]' WHERE caid='$caid' "); } } updatecache('fcatalogs'); } adminlog(lang('edit freeinfo coclass manager list')); amessage(lang('coclass edit finish'), '?entry=fcatalogs&action=fcatalogsedit'); }elseif(submitcheck('bfcatalogadd')){ if(!$fcatalognew['title']) amessage(lang('data missing'),'history.go(-1)'); $db->query("INSERT INTO {$tblprefix}fcatalogs SET title='$fcatalognew[title]', chid='$fcatalognew[chid]', cumode='$fcatalognew[cumode]' "); updatecache('fcatalogs'); adminlog(lang('add freeinfo coclass')); amessage(lang('message coclass add finish'), '?entry=fcatalogs&action=fcatalogsedit'); } }elseif($action =='fcatalogdetail' && $caid){ $fcatalog = read_cache('fcatalog',$caid); if(!submitcheck('bfcatalogdetail')){ a_guide('fcatalogdetail'); tabheader(lang('message coclass setting')." [$fcatalog[title]]",'fcatalogdetail','?entry=fcatalogs&action=fcatalogdetail&caid='.$caid,2,1); trbasic(lang('freeinfo channel'),'',$fchannels[$fcatalog['chid']]['cname'],''); trbasic(lang('message auto check'),'fcatalognew[autocheck]',$fcatalog['autocheck'],'radio'); trbasic(lang('author allow update checked message content'),'fcatalognew[allowupdate]',$fcatalog['allowupdate'],'radio'); trbasic(lang('message content template'),'fcatalognew[arctpl]',makeoption(array('' => lang('nosetting')) + mtplsarr('freeinfo'),$fcatalog['arctpl']),'select'); tabfooter(); if($fcatalog['cumode']){ tabheader(lang('consult setting')); trbasic(lang('allow reply usergroup'),'',makecheckbox('fcatalognew[rugids][]',ugidsarr(2),empty($fcatalog['rugids']) ? array() : explode(',',$fcatalog['rugids'])),''); trbasic(lang('commu content length limited'),'fcatalognew[culength]',$fcatalog['culength']); tabfooter(); }else{ $cridsarr = array('0' => lang('freesale')) + cridsarr(); tabheader(lang('issue1 tax setting')); trbasic(lang('tax currency type'),'fcatalognew[taxcrid]',makeoption($cridsarr,$fcatalog['taxcrid']),'select'); trbasic(lang('tax cell').'('.lang('day').')','fcatalognew[taxperiod]',$fcatalog['taxperiod'],'text'); trbasic(lang('tax price').'('.lang('currency / cell').')','fcatalognew[taxprice]',$fcatalog['taxprice'],'text'); trbasic(lang('taxmini'),'fcatalognew[taxmini]',$fcatalog['taxmini'],'text'); trbasic(lang('online message amount limited'),'fcatalognew[maxactive]',$fcatalog['maxactive'],'text'); tabfooter(); } ugids_table(lang('issue1 permission setting'),'bfcatalogdetail',$fcatalog['ugids'],0); }else{ $fcatalognew['culength'] = empty($fcatalognew['culength']) ? 0 : max(0,intval($fcatalognew['culength'])); $fcatalognew['rugids'] = empty($fcatalognew['rugids']) ? '' : implode(',',$fcatalognew['rugids']); $fcatalognew['taxperiod'] = empty($fcatalognew['taxperiod']) ? 0 : max(0,intval($fcatalognew['taxperiod'])); $fcatalognew['taxprice'] = empty($fcatalognew['taxprice']) ? 0 : max(0,intval($fcatalognew['taxprice'])); $fcatalognew['taxmini'] = empty($fcatalognew['taxmini']) ? 0 : max(0,intval($fcatalognew['taxmini'])); $fcatalognew['maxactive'] = empty($fcatalognew['maxactive']) ? 0 : max(0,intval($fcatalognew['maxactive'])); $fcatalognew['ugids'] = !empty($ugidsnew) ? implode(',',$ugidsnew) : ''; if(empty($fcatalognew['taxcrid']) || empty($fcatalognew['taxprice'])){// $fcatalognew['taxcrid'] = $fcatalognew['taxprice'] = 0; } if(empty($fcatalognew['taxperiod']) || empty($fcatalognew['taxcrid'])){//永久有效或免费信息 $fcatalognew['taxperiod'] = $fcatalognew['taxmini'] = 0; $fcatalognew['maxactive'] = 0; } if(!empty($fcatalognew['taxperiod'])){//有期限 $fcatalognew['taxmini'] = max(1,$fcatalognew['taxmini']); } $db->query("UPDATE {$tblprefix}fcatalogs SET autocheck='$fcatalognew[autocheck]', allowupdate='$fcatalognew[allowupdate]', arctpl='$fcatalognew[arctpl]', rugids='$fcatalognew[rugids]', culength='$fcatalognew[culength]', taxcrid='$fcatalognew[taxcrid]', taxperiod='$fcatalognew[taxperiod]', taxprice='$fcatalognew[taxprice]', taxmini='$fcatalognew[taxmini]', maxactive='$fcatalognew[maxactive]', ugids='$fcatalognew[ugids]' WHERE caid='$caid'"); updatecache('fcatalogs'); adminlog(lang('detail0 modify freeinfo coclass')); amessage(lang('coclass setting finish'), '?entry=fcatalogs&action=fcatalogsedit'); } } elseif($action == 'fcatalogdelete' && $caid) { if(!isset($confirm) || $confirm != 'ok') { $message = lang('del_alert')."<br><br>"; $message .= lang('confirm click')."[<a href=?entry=fcatalogs&action=fcatalogdelete&caid=".$caid."&confirm=ok>".lang('delete')."</a>]<br>"; $message .= lang('giveup click')."[<a href=?entry=fcatalogs&action=fcatalogsedit>".lang('goback')."</a>]"; amessage($message); } if($db->result_one("SELECT COUNT(*) FROM {$tblprefix}farchives WHERE caid='$caid'")){ amessage(lang('coclass without archive can delete'), '?entry=fcatalogs&action=fcatalogsedit'); } $db->query("DELETE FROM {$tblprefix}fcatalogs WHERE caid='$caid'"); del_cache('fcatalog',$caid); updatecache('fcatalogs'); adminlog(lang('delete freeinfo coclass')); amessage(lang('coclass delete finish'), '?entry=fcatalogs&action=fcatalogsedit'); }else amessage(lang('errorparament')); ?>