www.gusucode.com > 08CMS空白站群系统 3.3 繁体 UTF-8 > upload/admina/vcatalogs.inc.php
<?php (!defined('M_COM') || !defined('M_ADMIN')) && exit('No Permission'); aheader(); !checkapermission(101) && amessage(lang('no_apermission')); if($sid && $sid_self) amessage(lang('msite admin item !')); load_cache('vcatalogs'); if($action == 'vcatalogsedit'){ if(!submitcheck('bvcatalogsedit') && !submitcheck('bvcatalogadd')){ a_guide('vcatalogsedit'); tabheader(lang('add vote coclass'),'vcatalogadd','?entry=vcatalogs&action=vcatalogsedit'); trbasic(lang('coclass cname'),'vcatalogadd[title]','','text'); tabfooter('bvcatalogadd',lang('add')); tabheader(lang('vote coclass manager'),'vcatalogsedit','?entry=vcatalogs&action=vcatalogsedit','6'); trcategory(array(lang('sn'),lang('coclass cname'),lang('order'),lang('delete'))); $k = 0; foreach($vcatalogs as $caid => $vcatalog) { $k ++; echo "<tr>\n". "<td class=\"item1\" align=\"center\" width=\"40\">$k</td>\n". "<td class=\"item2\"><input type=\"text\" name=\"vcatalogsnew[$caid][title]\" value=\"".mhtmlspecialchars($vcatalog['title'])."\" size=\"25\" maxlength=\"30\"></td>\n". "<td class=\"item1\" align=\"center\" width=\"50\"><input type=\"text\" name=\"vcatalogsnew[$caid][vieworder]\" value=\"$vcatalog[vieworder]\" size=\"2\"></td>\n". "<td class=\"item2\" align=\"center\" width=\"50\"><a href=\"?entry=vcatalogs&action=vcatalogdelete&caid=$caid\">[".lang('delete')."]</a></td>\n". "</tr>"; } tabfooter('bvcatalogsedit'); }elseif(submitcheck('bvcatalogsedit')){ if(!empty($vcatalogsnew)){ foreach($vcatalogsnew as $caid => $vcatalognew){ $vcatalognew['title'] = $vcatalognew['title'] ? $vcatalognew['title'] : $vcatalogs[$caid]['title']; $vcatalognew['vieworder'] = max(0,intval($vcatalognew['vieworder'])); if(($vcatalognew['title'] != $vcatalogs[$caid]['title']) || ($vcatalognew['vieworder'] != $vcatalogs[$caid]['vieworder'])){ $db->query("UPDATE {$tblprefix}vcatalogs SET title='$vcatalognew[title]', vieworder='$vcatalognew[vieworder]' WHERE caid='$caid' "); } } updatecache('vcatalogs'); } amessage(lang('coclass edit finish'), '?entry=vcatalogs&action=vcatalogsedit'); }elseif(submitcheck('bvcatalogadd')){ empty($vcatalogadd['title']) && amessage(lang('data missing'),'?entry=vcatalogs&action=vcatalogsedit'); $db->query("INSERT INTO {$tblprefix}vcatalogs SET title='$vcatalogadd[title]'"); updatecache('vcatalogs'); amessage(lang('vote coclass add finish'), '?entry=vcatalogs&action=vcatalogsedit'); } }elseif($action == 'vcatalogdelete' && $caid) { if(!isset($confirm) || $confirm != 'ok') { $message = lang('del_alert')."<br><br>"; $message .= lang('confirm click')."[<a href=?entry=vcatalogs&action=vcatalogdelete&caid=".$caid."&confirm=ok>".lang('delete')."</a>]<br>"; $message .= lang('giveup click')."[<a href=?entry=vcatalogs&action=vcatalogsedit>".lang('goback')."</a>]"; amessage($message); } if($db->result_one("SELECT COUNT(*) FROM {$tblprefix}votes WHERE caid='$caid'")) amessage(lang('coclass without vote can delete'), '?entry=vcatalogs&action=vcatalogsedit'); $db->query("DELETE FROM {$tblprefix}vcatalogs WHERE caid='$caid'"); updatecache('vcatalogs'); amessage(lang('coclass delete finish'), '?entry=vcatalogs&action=vcatalogsedit'); } ?>