📄 forums.inc.php
字号:
showtype('', 'bottom');
}
echo "<br><br><center><input type=\"submit\" name=\"detailsubmit\" value=\"$lang[submit]\"></form>";
} else {
if($type == 'group') {
if($namenew) {
$db->query("UPDATE {$tablepre}forums SET name='$namenew',forumcolumns='".intval($forumcolumnsnew)."' WHERE fid='$fid'");
updatecache('forums');
cpmsg('forums_edit_succeed', 'admincp.php?action=forumsedit');
} else {
cpmsg('forums_edit_name_invalid');
}
} else {
$extensionarray = array();
foreach(explode(',', $attachextensionsnew) as $extension) {
if($extension = trim($extension)) {
$extensionarray[] = $extension;
}
}
$attachextensionsnew = implode(', ', $extensionarray);
foreach($perms as $perm) {
${$perm.'new'} = is_array($$perm) && !empty($$perm) ? "\t".implode("\t", $$perm)."\t" : '';
}
$fupadd = '';
if($fupnew != $forum['fup']) {
$query = $db->query("SELECT fid FROM {$tablepre}forums WHERE fup='$fid'");
if($db->num_rows($query)) {
cpmsg('forums_edit_sub_notnull');
}
$query = $db->query("SELECT fid, type, inheritedmod FROM {$tablepre}forums WHERE fid='$fupnew'");
$fup = $db->fetch_array($query);
$fupadd = ", type='".($fup['type'] == 'forum' ? 'sub' : 'forum')."', fup='$fup[fid]'";
$db->query("DELETE FROM {$tablepre}moderators WHERE fid='$fid' AND inherited='1'");
$query = $db->query("SELECT * FROM {$tablepre}moderators WHERE fid='$fupnew' ".($fup['inheritedmod'] ? '' : "AND inherited='1'"));
while($mod = $db->fetch_array($query)) {
$db->query("REPLACE INTO {$tablepre}moderators (uid, fid, displayorder, inherited)
VALUES ('$mod[uid]', '$fid', '0', '1')");
}
$moderators = $tab = '';
$query = $db->query("SELECT m.username FROM {$tablepre}members m, {$tablepre}moderators mo WHERE mo.fid='$fid' AND mo.inherited='0' AND m.uid=mo.uid ORDER BY mo.displayorder");
while($mod = $db->fetch_array($query)) {
$moderators .= $tab.addslashes($mod['username']);
$tab = "\t";
}
$db->query("UPDATE {$tablepre}forumfields SET moderators='$moderators' WHERE fid='$fid'");
}
$supe_pushsettingadd = $supe_status ? ", supe_pushsetting='".serialize($supe_pushsetting)."'" : '';
if(!$allowsharenew && (bool)$allowsharenew != (bool)$forum['allowshare']) {
$db->query("UPDATE {$tablepre}threads SET blog='0' WHERE fid='$fid'");
}
$allowpostspecialnew = bindec(intval($allowpostspecialnew[4]).intval($allowpostspecialnew[3]).intval($allowpostspecialnew[2]).intval($allowpostspecialnew[1]));
$forumcolumnsnew = intval($forumcolumnsnew);
$threadcachesnew = max(0, min(100, intval($threadcachesnew)));
$db->query("UPDATE {$tablepre}forums SET status='$statusnew', name='$namenew', styleid='$styleidnew', allowshare='$allowsharenew',
allowpostspecial='$allowpostspecialnew', allowpaytoauthor='$allowpaytoauthornew', allowhtml='$allowhtmlnew', allowbbcode='$allowbbcodenew', allowimgcode='$allowimgcodenew',
allowsmilies='$allowsmiliesnew', alloweditrules='$alloweditrulesnew', modnewposts='$modnewpostsnew',
recyclebin='$recyclebinnew', jammer='$jammernew', allowanonymous='$allowanonymousnew', forumcolumns='$forumcolumnsnew', threadcaches='$threadcachesnew',
disablewatermark='$disablewatermarknew', autoclose='".intval($autoclosenew * $autoclosetimenew)."' $fupadd
WHERE fid='$fid'");
$query = $db->query("SELECT fid FROM {$tablepre}forumfields WHERE fid='$fid'");
if(!($db->num_rows($query))) {
$db->query("INSERT INTO {$tablepre}forumfields (fid)
VALUES ('$fid')");
}
$postcreditsarray = $replycreditsarray = array();
if($postcreditsstatus) {
for($i = 1; $i <= 8; $i++) {
if(isset($extcredits[$i]) && isset($postcreditsnew[$i])) {
$postcreditsnew[$i] = $postcreditsnew[$i] < -99 ? -99 : $postcreditsnew[$i];
$postcreditsnew[$i] = $postcreditsnew[$i] > 99 ? 99 : $postcreditsnew[$i];
$postcreditsarray[$i] = intval($postcreditsnew[$i]);
}
}
}
if($replycreditsstatus) {
for($i = 1; $i <= 8; $i++) {
if(isset($extcredits[$i]) && isset($replycreditsnew[$i])) {
$replycreditsnew[$i] = $replycreditsnew[$i] < -99 ? -99 : $replycreditsnew[$i];
$replycreditsnew[$i] = $replycreditsnew[$i] > 99 ? 99 : $replycreditsnew[$i];
$replycreditsarray[$i] = intval($replycreditsnew[$i]);
}
}
}
if($digestcreditsstatus) {
for($i = 1; $i <= 8; $i++) {
if(isset($extcredits[$i]) && isset($digestcreditsnew[$i])) {
$digestcreditsnew[$i] = $digestcreditsnew[$i] < -99 ? -99 : $digestcreditsnew[$i];
$digestcreditsnew[$i] = $digestcreditsnew[$i] > 99 ? 99 : $digestcreditsnew[$i];
$digestcreditsarray[$i] = intval($digestcreditsnew[$i]);
}
}
}
if($postattachcreditsstatus) {
for($i = 1; $i <= 8; $i++) {
if(isset($extcredits[$i]) && isset($postattachcreditsnew[$i])) {
$postattachcreditsnew[$i] = $postattachcreditsnew[$i] < -99 ? -99 : $postattachcreditsnew[$i];
$postattachcreditsnew[$i] = $postattachcreditsnew[$i] > 99 ? 99 : $postattachcreditsnew[$i];
$postattachcreditsarray[$i] = intval($postattachcreditsnew[$i]);
}
}
}
if($getattachcreditsstatus) {
for($i = 1; $i <= 8; $i++) {
if(isset($extcredits[$i]) && isset($getattachcreditsnew[$i])) {
$getattachcreditsnew[$i] = $getattachcreditsnew[$i] < -99 ? -99 : $getattachcreditsnew[$i];
$getattachcreditsnew[$i] = $getattachcreditsnew[$i] > 99 ? 99 : $getattachcreditsnew[$i];
$getattachcreditsarray[$i] = intval($getattachcreditsnew[$i]);
}
}
}
$postcreditsnew = $postcreditsarray ? addslashes(serialize($postcreditsarray)) : '';
$replycreditsnew = $replycreditsarray ? addslashes(serialize($replycreditsarray)) : '';
$digestcreditsnew = $digestcreditsarray ? addslashes(serialize($digestcreditsarray)) : '';
$postattachcreditsnew = $postattachcreditsarray ? addslashes(serialize($postattachcreditsarray)) : '';
$getattachcreditsnew = $getattachcreditsarray ? addslashes(serialize($getattachcreditsarray)) : '';
if($threadtypesnew['status']) {
if(is_array($threadtypesnew['options']) && $threadtypesnew['options']) {
$typeids = '0';
foreach($threadtypesnew['options'] as $key => $val) {
$typeids .= $val ? ', '.intval($key) : '';
}
$threadtypesnew['types'] = $threadtypesnew['flat'] = $threadtypes['selectbox'] = array();
$query = $db->query("SELECT * FROM {$tablepre}threadtypes WHERE typeid IN ($typeids) ORDER BY displayorder");
while($type = $db->fetch_array($query)) {
$threadtypesnew['types'][$type['typeid']] = $type['name'];
if($threadtypesnew['options'][$type['typeid']] == 1) {
$threadtypesnew['types'][$type['typeid']] = $threadtypesnew['flat'][$type['typeid']] = $type['name'];
} else {
$threadtypesnew['types'][$type['typeid']] = $threadtypesnew['selectbox'][$type['typeid']] = $type['name'];
}
}
$threadtypesnew = $threadtypesnew['types'] ? addslashes(serialize(array
(
'required' => (bool)$threadtypesnew['required'],
'listable' => (bool)$threadtypesnew['listable'],
'prefix' => (bool)$threadtypesnew['prefix'],
'types' => $threadtypesnew['types'],
'selectbox' => $threadtypesnew['selectbox'],
'flat' => $threadtypesnew['flat'],
))) : '';
}
} else {
$threadtypesnew = '';
}
$db->query("UPDATE {$tablepre}forumfields SET description='$descriptionnew', icon='$iconnew', password='$passwordnew', redirect='$redirectnew', rules='$rulesnew',
attachextensions='$attachextensionsnew', threadtypes='$threadtypesnew', postcredits='$postcreditsnew', replycredits='$replycreditsnew', digestcredits='$digestcreditsnew',
postattachcredits='$postattachcreditsnew', getattachcredits='$getattachcreditsnew', viewperm='$viewpermnew', postperm='$postpermnew', replyperm='$replypermnew',
getattachperm='$getattachpermnew', postattachperm='$postattachpermnew'$supe_pushsettingadd WHERE fid='$fid'");
if($statusnew == 0) {
$db->query("UPDATE {$tablepre}forums SET status='$statusnew' WHERE fup='$fid'", 'UNBUFFERED');
}
updatecache('forums');
cpmsg('forums_edit_succeed', 'admincp.php?action=forumsedit');
}
}
} elseif($action == 'forumdelete') {
$query = $db->query("SELECT COUNT(*) FROM {$tablepre}forums WHERE fup='$fid'");
if($db->result($query, 0)) {
cpmsg('forums_delete_sub_notnull');
}
if(!$confirmed) {
cpmsg('forums_delete_confirm', "admincp.php?action=forumdelete&fid=$fid", 'form');
} else {
require_once DISCUZ_ROOT.'./include/post.func.php';
$tids = 0;
$query = $db->query("SELECT tid FROM {$tablepre}threads WHERE attachment>'0' AND fid='$fid'");
while($thread = $db->fetch_array($query)) {
$tids .= ','.$thread['tid'];
}
if($tids) {
$query = $db->query("SELECT filename FROM {$tablepre}attachments WHERE tid IN ($tids)");
while($attach = $db->fetch_array($query)) {
@unlink($attachdir.'/'.$attach['filename']);
}
$db->query("DELETE FROM {$tablepre}attachments WHERE tid IN ($tids)");
}
$db->query("DELETE FROM {$tablepre}threads WHERE fid='$fid'");
$db->query("DELETE FROM {$tablepre}posts WHERE fid='$fid'");
$db->query("DELETE FROM {$tablepre}forums WHERE fid='$fid'");
$db->query("DELETE FROM {$tablepre}forumfields WHERE fid='$fid'");
$db->query("DELETE FROM {$tablepre}moderators WHERE fid='$fid'");
$db->query("DELETE FROM {$tablepre}access WHERE fid='$fid'");
updatecache('forums');
cpmsg('forums_delete_succeed', 'admincp.php?action=forumsedit');
}
} elseif($action == 'threadtypes') {
if(!submitcheck('typesubmit')) {
$forumsarray = array();
$query = $db->query("SELECT f.fid, f.name, 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']);
if(is_array($forum['threadtypes']['types'])) {
foreach($forum['threadtypes']['types'] as $typeid => $name) {
$forumsarray[$typeid][] = '<a href="forumdisplay.php?fid='.$forum['fid'].'" target="_blank">'.$forum['name'].'</a> [<a href="admincp.php?action=forumdetail&fid='.$forum['fid'].'">'.$lang['edit'].'</a>]';
}
}
}
$threadtypes = '';
$query = $db->query("SELECT * FROM {$tablepre}threadtypes ORDER BY displayorder");
while($type = $db->fetch_array($query)) {
$threadtypes .= "<tr align=\"center\"><td bgcolor=\"".ALTBG1."\"><input type=\"checkbox\" name=\"delete[]\" value=\"$type[typeid]\"></td>\n".
"<td bgcolor=\"".ALTBG2."\"><input type=\"text\" size=\"15\" name=\"namenew[$type[typeid]]\" value=\"".dhtmlspecialchars($type['name'])."\"></td>\n".
"<td bgcolor=\"".ALTBG1."\"><input type=\"text\" size=\"2\" name=\"displayordernew[$type[typeid]]\" value=\"$type[displayorder]\"></td>\n".
"<td bgcolor=\"".ALTBG2."\"><input type=\"text\" size=\"30\" name=\"descriptionnew[$type[typeid]]\" value=\"$type[description]\"></td>\n".
"<td bgcolor=\"".ALTBG1."\">".(is_array($forumsarray[$type['typeid']]) ? implode(', ', $forumsarray[$type['typeid']]) : '')."</td></tr>\n";
}
showtips('forums_threadtypes_tips');
?>
<form method="post" action="admincp.php?action=threadtypes">
<input type="hidden" name="formhash" value="<?=FORMHASH?>">
<table cellspacing="<?=INNERBORDERWIDTH?>" cellpadding="<?=TABLESPACE?>" width="95%" align="center" class="tableborder">
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -