📄 forums.inc.php
字号:
$perms = array('viewperm', 'postperm', 'replyperm', 'getattachperm', 'postattachperm');
$query = $db->query("SELECT *, f.fid AS fid FROM {$tablepre}forums f
LEFT JOIN {$tablepre}forumfields ff USING (fid)
WHERE f.fid='$fid'");
if(!$forum = $db->fetch_array($query)) {
cpmsg('forums_nonexistence');
}
if(!submitcheck('detailsubmit')) {
?>
<br><form method="post" action="admincp.php?action=forumdetail&fid=<?=$fid?>&">
<input type="hidden" name="formhash" value="<?=FORMHASH?>">
<input type="hidden" name="type" value="<?=$forum['type']?>">
<input type="hidden" name="detailsubmit" value="submit">
<?
if($forum['type'] == 'group') {
showtype("$lang[forums_cat_detail] - $forum[name]", 'top');
showsetting('forums_cat_name', 'namenew', $forum['name'], 'text');
showsetting('forums_sub_horizontal', 'forumcolumnsnew', $forum['forumcolumns'], 'text');
showtype('', 'bottom');
} else {
showtips('forums_edit_tips');
$fupselect = "<select name=\"fupnew\">\n";
$query = $db->query("SELECT fid, type, name, fup FROM {$tablepre}forums WHERE fid<>'$fid' AND type<>'sub' ORDER BY displayorder");
while($fup = $db->fetch_array($query)) {
$fups[] = $fup;
}
if(is_array($fups)) {
foreach($fups as $forum1) {
if($forum1['type'] == 'group') {
$selected = $forum1['fid'] == $forum['fup'] ? "selected=\"selected\"" : NULL;
$fupselect .= "<option value=\"$forum1[fid]\" $selected>$forum1[name]</option>\n";
foreach($fups as $forum2) {
if($forum2['type'] == 'forum' && $forum2['fup'] == $forum1['fid']) {
$selected = $forum2['fid'] == $forum['fup'] ? "selected=\"selected\"" : NULL;
$fupselect .= "<option value=\"$forum2[fid]\" $selected> > $forum2[name]</option>\n";
}
}
}
}
foreach($fups as $forum0) {
if($forum0['type'] == 'forum' && $forum0['fup'] == 0) {
$selected = $forum0['fid'] == $forum['fup'] ? "selected=\"selected\"" : NULL;
$fupselect .= "<option value=\"$forum0[fid]\" $selected>$forum0[name]</option>\n";
}
}
}
$fupselect .= '</select>';
$groups = array();
$query = $db->query("SELECT groupid, grouptitle FROM {$tablepre}usergroups");
while($group = $db->fetch_array($query)) {
$groups[] = $group;
}
$styleselect = "<select name=\"styleidnew\"><option value=\"0\">$lang[use_default]</option>";
$query = $db->query("SELECT styleid, name FROM {$tablepre}styles");
while($style = $db->fetch_array($query)) {
$styleselect .= "<option value=\"$style[styleid]\" ".
($style['styleid'] == $forum['styleid'] ? 'selected="selected"' : NULL).
">$style[name]</option>\n";
}
$styleselect .= '</select>';
if($forum['autoclose']) {
$acoption = $forum['autoclose'] / abs($forum['autoclose']);
$forum['autoclose'] = abs($forum['autoclose']);
} else {
$acoption = 0;
}
$checkac = array($acoption => 'checked');
$checkpostspecial = array();
$forum['allowpostspecial'] = sprintf('%04b', $forum['allowpostspecial']);
for($i = 1; $i <= 4; $i++) {
$checkpostspecial[$i] = $forum['allowpostspecial'][4 - $i] ? 'checked' : '';
}
$checkmod = array($forum['modnewposts'] => 'checked');
$checkrules = array($forum['alloweditrules'] => 'checked');
foreach($perms as $perm) {
$num = -1;
$$perm = "<table cellspacing=\"0\" cellpadding=\"0\" border=\"0\" width=\"100%\" align=\"center\"><tr>";
foreach($groups as $group) {
$num++;
if($num && $num % 4 == 0) {
$$perm .= "</tr><tr>";
}
$checked = strstr($forum[$perm], "\t$group[groupid]\t") ? 'checked' : NULL;
$$perm .= "<td><input type=\"checkbox\" name=\"{$perm}[]\" value=\"$group[groupid]\" $checked> $group[grouptitle]</td>\n";
}
$$perm .= '</tr></table>';
}
$viewaccess = $postaccess = $replyaccess = $getattachaccess = $postattachaccess = '';
$query = $db->query("SELECT m.username, a.* FROM {$tablepre}access a LEFT JOIN {$tablepre}members m USING (uid) WHERE fid='$fid'");
while($access = $db->fetch_array($query)) {
$member = ", <a href=\"admincp.php?action=access&uid=$access[uid]\" target=\"_blank\">$access[username]</a>";
$viewaccess .= $access['allowview'] ? $member : NULL;
$postaccess .= $access['allowpost'] ? $member : NULL;
$replyaccess .= $access['allowreply'] ? $member : NULL;
$getattachaccess .= $access['allowgetattach'] ? $member : NULL;
$postattachaccess .= $access['allowpostattach'] ? $member : NULL;
}
unset($member);
/* old
$forum['description'] = str_replace('<', '<', $forum['description']);
$forum['description'] = str_replace('>', '>', $forum['description']);
*/
if($forum['threadtypes']) {
$forum['threadtypes'] = unserialize($forum['threadtypes']);
$forum['threadtypes']['status'] = 1;
} else {
$forum['threadtypes'] = array('status' => 0, 'required' => 0, 'listable' => 0, 'prefix' => 0, 'options' => array());
}
$typeselect = '';
$query = $db->query("SELECT * FROM {$tablepre}threadtypes ORDER BY displayorder");
while($type = $db->fetch_array($query)) {
$typeselected = array();
if(isset($forum['threadtypes']['flat'][$type['typeid']])) {
$typeselected[1] = 'checked';
} elseif(isset($forum['threadtypes']['selectbox'][$type['typeid']])) {
$typeselected[2] = 'checked';
} else {
$typeselected[0] = 'checked';
}
$typeselect .= "<tr align=\"center\"><td class=\"altbg1\">$type[name]</td>".
"<td class=\"altbg2\">$type[description]</td>".
"<td class=\"altbg1\"><input type=\"radio\" name=\"threadtypesnew[options][{$type[typeid]}]\" value=\"0\" $typeselected[0]></td>".
"<td class=\"altbg2\"><input type=\"radio\" name=\"threadtypesnew[options][{$type[typeid]}]\" value=\"1\" $typeselected[1]></td>".
"<td class=\"altbg1\"><input type=\"radio\" name=\"threadtypesnew[options][{$type[typeid]}]\" value=\"2\" $typeselected[2]></td>".
"</tr>";
}
$typeselect = $typeselect ? $typeselect : '<tr><td class="altbg1" colspan="5">'.$lang['forums_edit_threadtypes_options_null'].'</td></tr>';
$forum['postcredits'] = $forum['postcredits']? unserialize($forum['postcredits']) : array();
$forum['replycredits'] = $forum['replycredits']? unserialize($forum['replycredits']) : array();
$forum['digestcredits'] = $forum['digestcredits']? unserialize($forum['digestcredits']) : array();
$forum['postattachcredits'] = $forum['postattachcredits']? unserialize($forum['postattachcredits']) : array();
$forum['getattachcredits'] = $forum['getattachcredits']? unserialize($forum['getattachcredits']) : array();
showtype("$lang[forums_detail] - $forum[name]", 'top');
showsetting('forums_edit_display', 'statusnew', $forum['status'], 'radio');
showsetting('forums_edit_up', '', '', $fupselect);
showsetting('forums_edit_style', '', '', $styleselect);
showsetting('forums_sub_horizontal', 'forumcolumnsnew', $forum['forumcolumns'], 'text');
showsetting('forums_threadcache', 'threadcachesnew', $forum['threadcaches'], 'text');
showsetting('forums_edit_redirect', 'redirectnew', $forum['redirect'], 'text');
showsetting('forums_edit_name', 'namenew', $forum['name'], 'text');
showsetting('forums_edit_icon', 'iconnew', $forum['icon'], 'text');
showsetting('forums_edit_description', 'descriptionnew', $forum['description'], 'textarea');
showsetting('forums_edit_rules', 'rulesnew', $forum['rules'], 'textarea');
showsetting('forums_edit_edit_rules', '', '', '<input type="radio" name="alloweditrulesnew" value="0" '.$checkrules[0].'> '.$lang['forums_edit_edit_rules_html_none'].'<br><input type="radio" name="alloweditrulesnew" value="1" '.$checkrules[1].'> '.$lang['forums_edit_edit_rules_html_no'].'<br><input type="radio" name="alloweditrulesnew" value="2" '.$checkrules[2].'> '.$lang['forums_edit_edit_rules_html_yes']);
if($supe_status) {
$forum['supe_pushsetting'] = unserialize($forum['supe_pushsetting']);
$forum['supe_pushsetting']['status'] = intval($forum['supe_pushsetting']['status']);
$forum['supe_pushsetting']['filter']['digest'] = intval($forum['supe_pushsetting']['filter']['digest']);
$forum['supe_pushsetting']['filter']['displayorder'] = intval($forum['supe_pushsetting']['filter']['displayorder']);
$supe_pushsetchecked = array($forum['supe_pushsetting']['status'] => ' checked');
$supe_pushsetdigestselected = array($forum['supe_pushsetting']['filter']['digest'] => ' selected');
$supe_pushsetdisplayorderselected = array($forum['supe_pushsetting']['filter']['displayorder'] => ' selected');
echo '<tr><td class="altbg1"><span class="bold">'.$lang['supe_collection_mode'].'</span><br>'.$lang['supe_collection_mode_comment'].'</td>';
echo '<td class="altbg2"><input type="radio" name="supe_pushsetting[status]" value="0" '.$supe_pushsetchecked[0].' onclick="findobj(\'supe_pushsetting_filter_div\').style.display=\'none\'">'.$lang['supe_pushsetting_status_0'].'<br><input type="radio" name="supe_pushsetting[status]" value="1" '.$supe_pushsetchecked[1].' onclick="findobj(\'supe_pushsetting_filter_div\').style.display=\'none\'">'.$lang['supe_pushsetting_status_1'].'<br><input type="radio" name="supe_pushsetting[status]" value="2" '.$supe_pushsetchecked[2].' onclick="findobj(\'supe_pushsetting_filter_div\').style.display=\'none\'">'.$lang['supe_pushsetting_status_2'].'<br><input type="radio" name="supe_pushsetting[status]" value="3" '.$supe_pushsetchecked[3].' onclick="findobj(\'supe_pushsetting_filter_div\').style.display=\'block\'">'.$lang['supe_pushsetting_status_3'];
echo '<div id="supe_pushsetting_filter_div" style="display:'.($forum['supe_pushsetting']['status'] == 3 ? 'block' : 'none').'">';
echo '<br>'.$lang['supe_pushsetting_views'].' >= <input type="input" name="supe_pushsetting[filter][views]" value="'.$forum['supe_pushsetting']['filter']['views'].'" size="8">';
echo '<br>'.$lang['supe_pushsetting_replys'].' >= <input type="input" name="supe_pushsetting[filter][replies]" value="'.$forum['supe_pushsetting']['filter']['replies'].'" size="8">';
echo '<br>'.$lang['supe_pushsetting_digest'].' >= <select name="supe_pushsetting[filter][digest]"><option value="0"'.$supe_pushsetdigestselected[0].'></option><option value="1"'.$supe_pushsetdigestselected[1].'>'.$lang['forums_digest_one'].'</option><option value="2"'.$supe_pushsetdigestselected[2].'>'.$lang['forums_digest_two'].'</option><option value="3"'.$supe_pushsetdigestselected[3].'>'.$lang['forums_digest_three'].'</option></select>';
echo '<br>'.$lang['supe_pushsetting_stick'].' >= <select name="supe_pushsetting[filter][displayorder]"><option value="0"'.$supe_pushsetdisplayorderselected[0].'></option><option value="1"'.$supe_pushsetdisplayorderselected[1].'>'.$lang['forums_stick_one'].'</option><option value="2"'.$supe_pushsetdisplayorderselected[2].'>'.$lang['forums_stick_two'].'</option><option value="3"'.$supe_pushsetdisplayorderselected[3].'>'.$lang['forums_stick_three'].'</option></select>';
echo '</div></td></tr>';
unset($supe_pushsetchecked, $supe_pushsetdigestselected, $supe_pushsetdisplayorderselected);
}
showtype('forums_edit_options');
showsetting('forums_edit_modposts', '', '', '<input type="radio" name="modnewpostsnew" value="0" '.$checkmod[0].'> '.$lang['none'].'<br><input type="radio" name="modnewpostsnew" value="1" '.$checkmod[1].'> '.$lang['forums_edit_modposts_threads'].'<br><input type="radio" name="modnewpostsnew" value="2" '.$checkmod[2].'> '.$lang['forums_edit_modposts_posts']);
showsetting('forums_edit_recyclebin', 'recyclebinnew', $forum['recyclebin'], 'radio');
showsetting('forums_edit_share', 'allowsharenew', $forum['allowshare'], 'radio');
showsetting('forums_edit_html', 'allowhtmlnew', $forum['allowhtml'], 'radio');
showsetting('forums_edit_bbcode', 'allowbbcodenew', $forum['allowbbcode'], 'radio');
showsetting('forums_edit_imgcode', 'allowimgcodenew', $forum['allowimgcode'], 'radio');
showsetting('forums_edit_smilies', 'allowsmiliesnew', $forum['allowsmilies'], 'radio');
showsetting('forums_edit_jammer', 'jammernew', $forum['jammer'], 'radio');
showsetting('forums_edit_anonymous', 'allowanonymousnew', $forum['allowanonymous'], 'radio');
showsetting('forums_edit_disablewatermark', 'disablewatermarknew', $forum['disablewatermark'], 'radio');
showsetting('forums_edit_trade_payto', 'allowpaytoauthornew', $forum['allowpaytoauthor'], 'radio');
showsetting('forums_allowpostspecial', '', '', '<input type="checkbox" name="allowpostspecialnew[1]" value="1" '.$checkpostspecial[1].'>'.$lang['forums_thread_poll'].'<br><input type="checkbox" name="allowpostspecialnew[2]" value="1" '.$checkpostspecial[2].'>'.$lang['forums_thread_trade'].'<br><input type="checkbox" name="allowpostspecialnew[3]" value="1" '.$checkpostspecial[3].'>'.$lang['forums_thread_reward'].'<br><input type="checkbox" name="allowpostspecialnew[4]" value="1" '.$checkpostspecial[4].'>'.$lang['forums_thread_activity']);
showsetting('forums_edit_autoclose', '', '', '<input type="radio" name="autoclosenew" value="0" '.$checkac[0].' onclick="this.form.autoclosetimenew.disabled=true;"> '.$lang['forums_edit_autoclose_none'].'<br><input type="radio" name="autoclosenew" value="1" '.$checkac[1].' onclick="this.form.autoclosetimenew.disabled=false;"> '.$lang['forums_edit_autoclose_dateline'].'<br><input type="radio" name="autoclosenew" value="-1" '.$checkac[-1].' onclick="this.form.autoclosetimenew.disabled=false;"> '.$lang['forums_edit_autoclose_lastpost']);
showsetting('forums_edit_autoclose_time', '', '', '<input type="text" size="30" value="'.$forum['autoclose'].'" name="autoclosetimenew" '.($acoption ? '' : 'disabled').'>');
showsetting('forums_edit_attach_ext', 'attachextensionsnew', $forum['attachextensions'], 'text');
showtype('forums_edit_credits');
showsetting('forums_edit_postcredits', 'postcreditsstatus', $forum['postcredits'], 'radio');
showsetting('forums_edit_replycredits', 'replycreditsstatus', $forum['replycredits'], 'radio');
showsetting('settings_digest_add_credits', 'digestcreditsstatus', $forum['digestcredits'], 'radio');
showsetting('settings_postattachment_add_cridits', 'postattachcreditsstatus', $forum['postattachcredits'], 'radio');
showsetting('settings_digest_cut_credits', 'getattachcreditsstatus', $forum['getattachcredits'], 'radio');
echo '<tr><td colspan="2" bgcolor="'.ALTBG1.'"><table cellspacing="'.INNERBORDERWIDTH.'" cellpadding="'.TABLESPACE.'" width="100%" align="center" class="tableborder">'.
'<tr align="center" class="header"><td>'.$lang['credits_id'].'</td><td>'.$lang['credits_title'].'</td><td>'.$lang['forums_edit_postcredits_add'].'</td><td>'.$lang['forums_edit_replycredits_add'].'</td><td>'.$lang['settings_credits_policy_digest'].'</td><td>'.$lang['settings_credits_policy_post_attach'].'</td><td>'.$lang['settings_credits_policy_get_attach'].'</td></tr>';
for($i = 1; $i <= 8; $i++) {
echo "<tr align=\"center\" ".(isset($extcredits[$i]) ? '' : 'disabled')."><td bgcolor=\"".ALTBG1."\">extcredits$i</td>".
"<td bgcolor=\"".ALTBG2."\">{$extcredits[$i]['title']}</td>".
"<td bgcolor=\"".ALTBG1."\"><input type=\"text\" size=\"2\" name=\"postcreditsnew[$i]\" value=\"".(isset($forum['postcredits'][$i]) ? $forum['postcredits'][$i] : 0)."\"></td>".
"<td bgcolor=\"".ALTBG2."\"><input type=\"text\" size=\"2\" name=\"replycreditsnew[$i]\" value=\"".(isset($forum['replycredits'][$i]) ? $forum['replycredits'][$i] : 0)."\"></td>".
"<td bgcolor=\"".ALTBG1."\"><input type=\"text\" size=\"2\" name=\"digestcreditsnew[$i]\" value=\"".(isset($forum['digestcredits'][$i]) ? $forum['digestcredits'][$i] : 0)."\"></td>".
"<td bgcolor=\"".ALTBG2."\"><input type=\"text\" size=\"2\" name=\"postattachcreditsnew[$i]\" value=\"".(isset($forum['postattachcredits'][$i]) ? $forum['postattachcredits'][$i] : 0)."\"></td>".
"<td bgcolor=\"".ALTBG1."\"><input type=\"text\" size=\"2\" name=\"getattachcreditsnew[$i]\" value=\"".(isset($forum['getattachcredits'][$i]) ? $forum['getattachcredits'][$i] : 0)."\"></td></tr>";
}
echo '</table></td></tr>';
showtype('forums_edit_threadtypes');
showsetting('forums_edit_threadtypes_status', 'threadtypesnew[status]', $forum['threadtypes']['status'], 'radio');
showsetting('forums_edit_threadtypes_required', 'threadtypesnew[required]', $forum['threadtypes']['required'], 'radio');
showsetting('forums_edit_threadtypes_listable', 'threadtypesnew[listable]', $forum['threadtypes']['listable'], 'radio');
showsetting('forums_edit_threadtypes_prefix', 'threadtypesnew[prefix]', $forum['threadtypes']['prefix'], 'radio');
echo '<tr><td colspan="2" class="altbg1">'.$lang['settings_threadtypes_comment'].'<br><br>'.
'<table cellspacing="'.INNERBORDERWIDTH.'" cellpadding="'.TABLESPACE.'" width="100%" align="center" class="tableborder">'.
'<tr align="center" class="header"><td>'.$lang['forums_cat_name'].'</td><td>'.$lang['forums_sort_note'].'</td><td width="20%">'.$lang['not_use'].'</td><td width="20%">'.$lang['forums_threadtypes_use_cols'].'</td><td width="20%">'.$lang['forums_threadtypes_use_choice'].'</td></tr>'.
$typeselect.'</table></td></tr>';
showtype('forums_edit_perm');
showsetting('forums_edit_perm_passwd', 'passwordnew', $forum['password'], 'text', '20%');
echo '<tr><td colspan="2" class="singleborder"> </td></tr>';
showsetting('forums_edit_perm_view', '', '', str_replace('cdb_groupname', 'viewperm', $viewperm), '20%');
echo '<td width="15%" bgcolor="'.ALTBG1.'">'.$lang['forums_edit_access_mask'].'</td><td bgcolor="'.ALTBG2.'">'.substr($viewaccess, 2).'</td></tr>';
echo '<tr><td colspan="2" class="singleborder"> </td></tr>';
showsetting('forums_edit_perm_post', '', '', str_replace('cdb_groupname', 'postperm', $postperm), '20%');
echo '<td width="15%" bgcolor="'.ALTBG1.'">'.$lang['forums_edit_access_mask'].'</td><td bgcolor="'.ALTBG2.'">'.substr($postaccess, 2).'</td></tr>';
echo '<tr><td colspan="2" class="singleborder"> </td></tr>';
showsetting('forums_edit_perm_reply', '', '', str_replace('cdb_groupname', 'replyperm', $replyperm), '20%');
echo '<td width="15%" bgcolor="'.ALTBG1.'">'.$lang['forums_edit_access_mask'].'</td><td bgcolor="'.ALTBG2.'">'.substr($replyaccess, 2).'</td></tr>';
echo '<tr><td colspan="2" class="singleborder"> </td></tr>';
showsetting('forums_edit_perm_get_attach', '', '', str_replace('cdb_groupname', 'getattachperm', $getattachperm), '20%');
echo '<td width="15%" bgcolor="'.ALTBG1.'">'.$lang['forums_edit_access_mask'].'</td><td bgcolor="'.ALTBG2.'">'.substr($getattachaccess, 2).'</td></tr>';
echo '<tr><td colspan="2" class="singleborder"> </td></tr>';
showsetting('forums_edit_perm_post_attach', '', '', str_replace('cdb_groupname', 'postattachperm', $postattachperm), '20%');
echo '<td width="15%" bgcolor="'.ALTBG1.'">'.$lang['forums_edit_access_mask'].'</td><td bgcolor="'.ALTBG2.'">'.substr($postattachaccess, 2).'</td></tr>';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -