修改后出现了以下乱码:
- } else { $modifiedtypes = array(); if(is_array($delete)) { $modifiedtypes = $delete; $deleteids = '\''.implode('\',\'', $delete).'\''; $db->query("DELETE FROM {$tablepre}threadtypes WHERE typeid IN ($deleteids)"); if($db->affected_rows()) { $db->query("UPDATE {$tablepre}threads SET typeid='0' WHERE typeid IN ($deleteids)"); } } if(is_array($namenew)) { foreach($namenew as $typeid => $val) { $db->query("UPDATE {$tablepre}threadtypes SET name='".trim($namenew[$typeid])."', description='".dhtmlspecialchars(trim($descriptionnew[$typeid]))."', displayorder='$displayordernew[$typeid]' WHERE typeid='$typeid'"); if($db->affected_rows()) { $modifiedtypes[] = $typeid; } } if($modifiedtypes = array_unique($modifiedtypes)) { $query = $db->query("SELECT f.fid, ff.threadtypes FROM {$tablepre}forums f, {$tablepre}forumfields ff WHERE ff.threadtypes<>'' AND f.fid=ff.fid"); while($forum = $db->fetch_array($query)) { $forum['threadtypes'] = unserialize($forum['threadtypes']); foreach($modifiedtypes as $typeid) { if(isset($forum['threadtypes']['types'][$typeid])) { $db->query("SELECT * FROM {$tablepre}threadtypes WHERE typeid IN (".implode(',', array_keys($forum['threadtypes']['types'])).") ORDER BY displayorder"); $forum['threadtypes']['types'] = array(); while($type = $db->fetch_array($query)) { $forum['threadtypes']['types'][$type['typeid']] = $type['name']; } $db->query("UPDATE {$tablepre}forumfields SET threadtypes='".addslashes(serialize($forum['threadtypes']))."' WHERE fid='$fid'"); break; } } } } } if($newname != '') { $newname = dhtmlspecialchars(trim($newname)); $query = $db->query("SELECT typeid FROM {$tablepre}threadtypes WHERE name='$newname'"); if($db->num_rows($query)) { cpmsg('forums_threadtypes_duplicate'); } $db->query("INSERT INTO {$tablepre}threadtypes (name, description, displayorder) VALUES ('$newname', '".dhtmlspecialchars(trim($newdescription))."', '$newdisplayorder')"); } cpmsg('forums_threadtypes_succeed', 'admincp.php?action=threadtypes'); } } elseif($action == 'forumrules') { if(empty($fid)) { $forums = ''; if($adminid == 2) { $query = $db->query("SELECT fid, name FROM {$tablepre}forums WHERE alloweditrules>'0' AND type IN ('forum', 'sub')"); } else { $query = $db->query("SELECT f.fid, f.name, m.uid FROM {$tablepre}forums f LEFT JOIN {$tablepre}moderators m ON m.uid='$discuz_uid' AND m.fid=f.fid WHERE alloweditrules>'0' AND f.type IN ('forum', 'sub')"); } while($forum = $db->fetch_array($query)) { if($forum['uid'] || $adminid == 2) { $forums .= "".strip_tags($forum['name']).""; } } if($forums) { $forums = ''.$forums.''; } else { cpmsg('forums_rules_nopermission'); } ?>
复制代码 |