📄 forums.inc.php
字号:
'<tr 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 class=\"altbg1\" width=\"10%\">extcredits$i</td>".
"<td class=\"altbg2\" width=\"10%\">{$extcredits[$i]['title']}</td>".
"<td class=\"altbg1\" width=\"12%\"><input type=\"text\" size=\"2\" name=\"postcreditsnew[$i]\" value=\"".(isset($forum['postcredits'][$i]) ? $forum['postcredits'][$i] : 0)."\"></td>".
"<td class=\"altbg2\" width=\"12%\"><input type=\"text\" size=\"2\" name=\"replycreditsnew[$i]\" value=\"".(isset($forum['replycredits'][$i]) ? $forum['replycredits'][$i] : 0)."\"></td>".
"<td class=\"altbg1\" width=\"12%\"><input type=\"text\" size=\"2\" name=\"digestcreditsnew[$i]\" value=\"".(isset($forum['digestcredits'][$i]) ? $forum['digestcredits'][$i] : 0)."\"></td>".
"<td class=\"altbg2\" width=\"12%\"><input type=\"text\" size=\"2\" name=\"postattachcreditsnew[$i]\" value=\"".(isset($forum['postattachcredits'][$i]) ? $forum['postattachcredits'][$i] : 0)."\"></td>".
"<td class=\"altbg1\" width=\"12%\"><input type=\"text\" size=\"2\" name=\"getattachcreditsnew[$i]\" value=\"".(isset($forum['getattachcredits'][$i]) ? $forum['getattachcredits'][$i] : 0)."\"></td></tr>";
}
if($allowthreadtypes && $forum['status'] != 2) {
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 '</table><br><table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableborder">'.
'<tr class="header"><td>'.$lang['forums_edit_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.'<tr><td colspan=5>'.$lang['add_new'].'<a href="###" onclick="addtype()">[+]</a></td></tr><tbody id="type_0"><tr align="center"><td class="altbg1"><input type="text" name="newname[0]" size="15"></td><td class="altbg2"><input type="text" name="newdescription[0]" size="15"></td><td class="altbg1"><input class="radio" type="radio" name="newoptions[0]" value="0"></td><td class="altbg2"><input class="radio" type="radio" name="newoptions[0]" value="1" checked></td><td class="altbg1"><input class="radio" type="radio" name="newoptions[0]" value="2"></td></tr></tbody>';
for($i = 1; $i < 10; $i++) {
echo '<tbody id="type_'.$i.'" style="display: none"><tr align="center"><td class="altbg1"><input type="text" name="newname['.$i.']" size="15"></td><td class="altbg2"><input type="text" name="newdescription['.$i.']" size="15"></td><td class="altbg1"><input class="radio" type="radio" name="newoptions['.$i.']" value="0"></td><td class="altbg2"><input class="radio" type="radio" name="newoptions['.$i.']" value="1" checked></td><td class="altbg1"><input class="radio" type="radio" name="newoptions['.$i.']" value="2"></td></tr></tbody>';
}
echo '<tr><td colspan=5>'.$lang['settings_threadtypes_comment'].'</td></tr></table>';
}
echo '<br><table width="100%" border="0" cellpadding="0" cellspacing="0" class="tableborder">'.
'<tr class="header"><td>'.$lang['forums_edit_perm'].'</td>'.
'<td><input class="checkbox" type="checkbox" name="chkall1" onclick="checkall(this.form, \'viewperm\', \'chkall1\')"> '.$lang['forums_edit_perm_view'].'</td>'.
'<td><input class="checkbox" type="checkbox" name="chkall2" onclick="checkall(this.form, \'postperm\', \'chkall2\')"> '.$lang['forums_edit_perm_post'].'</td>'.
'<td><input class="checkbox" type="checkbox" name="chkall3" onclick="checkall(this.form, \'replyperm\', \'chkall3\')"> '.$lang['forums_edit_perm_reply'].'</td>'.
'<td><input class="checkbox" type="checkbox" name="chkall4" onclick="checkall(this.form, \'getattachperm\', \'chkall4\')"> '.$lang['forums_edit_perm_get_attach'].'</td>'.
'<td><input class="checkbox" type="checkbox" name="chkall5" onclick="checkall(this.form, \'postattachperm\', \'chkall5\')"> '.$lang['forums_edit_perm_post_attach'].'</td></tr>';
foreach($groups as $group) {
echo '<tr><td class="altbg1"><input class="checkbox" title="'.$lang['select_all'].'" type="checkbox" name="chkallv'.$group['groupid'].'" onclick="checkallvalue(this.form, '.$group['groupid'].', \'chkallv'.$group['groupid'].'\')"> '.$group[grouptitle].'</td>';
$altbgthis = 'altbg1';
foreach($perms as $perm) {
$checked = strstr($forum[$perm], "\t$group[groupid]\t") ? 'checked' : NULL;
$altbgthis = $altbgthis == 'altbg2' ? 'altbg1' : 'altbg2';
echo '<td class="'.$altbgthis.'"><input class="checkbox" type="checkbox" name="'.$perm.'[]" value="'.$group['groupid'].'" '.$checked.'></td>';
}
echo '</tr>';
}
echo '</td></tr><tr><td colspan="6">'.$lang['forums_edit_perm_comment'].'</td></tr>';
echo '<tr class="header"><td colspan="6"><b>'.$lang['forums_edit_access_mask'].'</b></td></tr>';
echo '<tr><td class="altbg1">'.$lang['forums_edit_perm_view'].':</td><td class="altbg2" colspan="5">'.substr($viewaccess, 2).'</td></tr>';
echo '<tr><td class="altbg1">'.$lang['forums_edit_perm_post'].':</td><td class="altbg2" colspan="5">'.substr($postaccess, 2).'</td></tr>';
echo '<tr><td class="altbg1">'.$lang['forums_edit_perm_reply'].':</td><td class="altbg2" colspan="5">'.substr($replyaccess, 2).'</td></tr>';
echo '<tr><td class="altbg1">'.$lang['forums_edit_perm_get_attach'].':</td><td class="altbg2" colspan="5">'.substr($getattachaccess, 2).'</td></tr>';
echo '<tr><td class="altbg1">'.$lang['forums_edit_perm_post_attach'].':</td><td class="altbg2" colspan="5">'.substr($postattachaccess, 2).'</td></tr>';
showtype('', 'bottom');
}
echo "<br><center><input class=\"button\" type=\"submit\" name=\"detailsubmit\" value=\"$lang[submit]\">";
if($forum['type'] != 'group') {
echo " <input class=\"button\" type=\"submit\" name=\"saveconfigsubmit\" value=\"".$lang['saveconf']."\"></form>";
}
} else {
if(strlen($namenew) > 50) {
cpmsg('forums_name_toolong');
}
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'");
}
$statusnew = $supe['status'] && $supe['circlestatus'] && $circlenew ? 2 : $statusnew;
$supe_pushsetting[status] = $statusnew == 2 && !$supe_pushsetting[status] ? 1 : $supe_pushsetting[status];
$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]));
$allowspecialonlynew = $allowpostspecialnew ? $allowspecialonlynew : 0;
$forumcolumnsnew = intval($forumcolumnsnew);
$threadcachesnew = max(0, min(100, intval($threadcachesnew)));
$db->query("UPDATE {$tablepre}forums SET status='$statusnew', name='$namenew', styleid='$styleidnew', allowshare='$allowsharenew', alloweditpost='$alloweditpostnew',
allowpostspecial='$allowpostspecialnew', allowspecialonly='$allowspecialonlynew', allowpaytoauthor='$allowpaytoauthornew', allowhtml='$allowhtmlnew', allowbbcode='$allowbbcodenew', allowimgcode='$allowimgcodenew',
allowsmilies='$allowsmiliesnew', alloweditrules='$alloweditrulesnew', modnewposts='$modnewpostsnew',
recyclebin='$recyclebinnew', jammer='$jammernew', allowanonymous='$allowanonymousnew', forumcolumns='$forumcolumnsnew', threadcaches='$threadcachesnew',
simple='$simplenew', 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)) : '';
$threadtypesnew['types'] = $threadtypesnew['flat'] = $threadtypes['selectbox'] = array();
if($allowthreadtypes && $forum['status'] != 2) {
if(is_array($newname) && $newname) {
$newname = array_unique($newname);
if($newname) {
foreach($newname AS $key => $val) {
$val = trim($val);
if($val) {
$query = $db->query("SELECT typeid FROM {$tablepre}threadtypes WHERE name='$val'");
$newtypeid = $db->result($query, 0);
if(!$newtypeid) {
$db->query("INSERT INTO {$tablepre}threadtypes (name, description) VALUES
('$val', '".dhtmlspecialchars(trim($newdescription[$key]))."')");
$newtypeid = $db->insert_id();
}
if($newoptions[$key] == 1) {
$threadtypesnew['types'][$newtypeid] = $threadtypesnew['flat'][$newtypeid] = $val;
} elseif($newoptions[$key] == 2) {
$threadtypesnew['types'][$newtypeid] = $threadtypesnew['selectbox'][$newtypeid] = $val;
}
}
}
}
$threadtypesnew['status'] = 1;
} else {
$newname = array();
}
if($threadtypesnew['status']) {
if(is_array($threadtypesnew['options']) && $threadtypesnew['options']) {
$typeids = '0';
foreach($threadtypesnew['options'] as $key => $val) {
$typeids .= $val ? ', '.intval($key) : '';
}
$query = $db->query("SELECT * FROM {$tablepre}threadtypes WHERE typeid IN ($typeids) ORDER BY displayorder");
while($type = $db->fetch_array($query)) {
if($threadtypesnew['options'][$type['typeid']] == 1) {
$threadtypesnew['types'][$type['typeid']] = $threadtypesnew['flat'][$type['typeid']] = $type['name'];
} elseif($threadtypesnew['options'][$type['typeid']] == 2) {
$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 = '';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -