📄 groups.inc.php
字号:
}
} else {
$radminidnew = $group['type'] == 'system' && in_array($group['groupid'], array(1, 2, 3)) ? $group['groupid'] : 0;
}
if(is_array($raterangenew)) {
foreach($raterangenew as $id => $rate) {
if($id >= 1 && $id <= 8 && $rate['allowrate']) {
$rate['min'] = intval($rate['min'] < -999 ? -999 : $rate['min']);
$rate['max'] = intval($rate['max'] > 999 ? 999 : $rate['max']);
$rate['mrpd'] = intval($rate['mrpd'] > 99999 ? 99999 : $rate['mrpd']);
if(!$rate['mrpd'] || $rate['max'] <= $rate['min'] || $rate['mrpd'] < max(abs($rate['min']), abs($rate['max']))) {
cpmsg('usergroups_edit_rate_invalid');
} else {
$raterangenew[$id] = implode("\t", array($id, $rate['min'], $rate['max'], $rate['mrpd']));
}
} else {
unset($raterangenew[$id]);
}
}
}
$raterangenew = $raterangenew ? implode("\n", $raterangenew) : '';
$maxpricenew = $maxpricenew < 0 ? 0 : intval($maxpricenew);
$extensionarray = array();
foreach(explode(',', $attachextensionsnew) as $extension) {
if($extension = trim($extension)) {
$extensionarray[] = $extension;
}
}
$attachextensionsnew = implode(', ', $extensionarray);
$db->query("UPDATE {$tablepre}usergroups SET grouptitle='$grouptitlenew', radminid='$radminidnew', system='$systemnew', allowvisit='$allowvisitnew',
readaccess='$readaccessnew', allowmultigroups='$allowmultigroupsnew', allowtransfer='$allowtransfernew', allowviewpro='$allowviewpronew',
allowviewstats='$allowviewstatsnew', allowinvisible='$allowinvisiblenew', allowsearch='$allowsearchnew', allowavatar='$allowavatarnew',
reasonpm='$reasonpmnew', allowuseblog='$allowuseblognew', allownickname='$allownicknamenew', allowcstatus='$allowcstatusnew',
disableperiodctrl='$disableperiodctrlnew', maxpmnum='$maxpmnumnew', allowpost='$allowpostnew', allowreply='$allowreplynew',
allowanonymous='$allowanonymousnew', allowsetreadperm='$allowsetreadpermnew', maxprice='$maxpricenew', allowhidecode='$allowhidecodenew',
allowhtml='$allowhtmlnew', allowpostpoll='$allowpostpollnew', allowdirectpost='$allowdirectpostnew', allowvote='$allowvotenew',
allowcusbbcode='$allowcusbbcodenew', allowsigbbcode='$allowsigbbcodenew', allowsigimgcode='$allowsigimgcodenew', raterange='$raterangenew',
maxsigsize='$maxsigsizenew', allowgetattach='$allowgetattachnew', allowpostattach='$allowpostattachnew',
allowsetattachperm='$allowsetattachpermnew',
maxattachsize='$maxattachsizenew', maxsizeperday='$maxsizeperdaynew', attachextensions='$attachextensionsnew' WHERE groupid='$edit'");
if($allowinvisiblenew == 0 && $group['allowinvisible'] != $allowinvisiblenew) {
$db->query("UPDATE {$tablepre}members SET invisible='0' WHERE groupid='$edit'");
}
if($group['type'] == 'special' && $radminidnew != $group['radminid']) {
$db->query("UPDATE {$tablepre}members SET adminid='".($radminidnew ? $radminidnew : -1)."' WHERE groupid='$edit' AND adminid='$group[radminid]'");
}
updatecache('usergroups');
cpmsg('usergroups_edit_succeed', 'admincp.php?action='.($return != 'admingroups' ? 'usergroups' : 'admingroups'));
}
}
} else {
if($type == 'member') {
$orderarray = array();
if(is_array($groupnew)) {
foreach($groupnew as $id => $group) {
if((is_array($delete) && in_array($id, $delete)) || ($id == 0 && (!$group['grouptitle'] || $group['creditshigher'] == ''))) {
unset($groupnew[$id]);
} else {
$orderarray[$group['creditshigher']] = $id;
}
}
}
if(empty($orderarray[0]) || min(array_flip($orderarray)) >= 0) {
cpmsg('usergroups_update_credits_invalid');
}
ksort($orderarray);
$rangearray = array();
$lowerlimit = array_keys($orderarray);
for($i = 0; $i < count($lowerlimit); $i++) {
$rangearray[$orderarray[$lowerlimit[$i]]] = array
(
'creditshigher' => isset($lowerlimit[$i - 1]) ? $lowerlimit[$i] : -999999999,
'creditslower' => isset($lowerlimit[$i + 1]) ? $lowerlimit[$i + 1] : 9999999999
);
}
foreach($groupnew as $id => $group) {
$creditshighernew = $rangearray[$id]['creditshigher'];
$creditslowernew = $rangearray[$id]['creditslower'];
if($creditshighernew == $creditslowernew) {
cpmsg('usergroups_update_credits_duplicate');
}
if($id) {
$db->query("UPDATE {$tablepre}usergroups SET grouptitle='$group[grouptitle]', creditshigher='$creditshighernew', creditslower='$creditslowernew', stars='$group[stars]', color='$group[color]', groupavatar='$group[groupavatar]' WHERE groupid='$id' AND type='member'");
} elseif($group['grouptitle'] && $group['creditshigher'] != '') {
$db->query("INSERT INTO {$tablepre}usergroups (type, grouptitle, creditshigher, creditslower, stars, color, groupavatar, allowvisit, readaccess, allowpost, allowsigbbcode)
VALUES ('member', '$group[grouptitle]', '$creditshighernew', '$creditslowernew', '$groupnew[stars]', '$groupnew[color]', '$groupnew[groupavatar]', '1', '1', '1', '1')");
}
}
if(!empty($delete)) {
$db->query("DELETE FROM {$tablepre}usergroups WHERE groupid IN ('".implode('\',\'', $delete)."') AND type='member'");
}
} elseif($type == 'special') {
if($grouptitlenew) {
$db->query("INSERT INTO {$tablepre}usergroups (type, grouptitle, stars, color, groupavatar, allowvisit, readaccess, allowpost, allowsigbbcode)
VALUES ('special', '$grouptitlenew', '$starsnew', '$colornew', '$groupavatarnew', '1', '1', '1', '1')");
}
if(is_array($group_title)) {
$ids = $comma = '';
foreach($group_title as $id => $title) {
if($delete[$id]) {
$ids .= "$comma'$id'";
$comma = ',';
} else {
$db->query("UPDATE {$tablepre}usergroups SET grouptitle='$group_title[$id]', stars='$group_stars[$id]', color='$group_color[$id]', groupavatar='$group_avatar[$id]' WHERE groupid='$id'");
}
}
}
if($ids) {
$db->query("DELETE FROM {$tablepre}usergroups WHERE groupid IN ($ids) AND type='special'");
$db->query("DELETE FROM {$tablepre}admingroups WHERE admingid IN ($ids)");
$db->query("DELETE FROM {$tablepre}adminactions WHERE admingid IN ($ids)");
$query = $db->query("SELECT groupid FROM {$tablepre}usergroups WHERE type='member' AND creditslower>'0' ORDER BY creditslower LIMIT 1");
$db->query("UPDATE {$tablepre}members SET groupid='".$db->result($query, 0)."', adminid='0' WHERE groupid IN ($ids)", 'UNBUFFERED');
//$db->query("UPDATE {$tablepre}members SET groupid='".$db->result($query, 0)."', adminid='0' WHERE groupid IN ($ids) AND adminid='-1'", 'UNBUFFERED');
//$db->query("UPDATE {$tablepre}members SET groupid=adminid WHERE groupid IN ($ids) AND adminid IN ('1', '2', '3')", 'UNBUFFERED');
}
} elseif($type == 'system') {
if(is_array($group_title)) {
foreach($group_title as $id => $title) {
$db->query("UPDATE {$tablepre}usergroups SET grouptitle='$group_title[$id]', stars='$group_stars[$id]', color='$group_color[$id]', groupavatar='$group_avatar[$id]' WHERE groupid='$id'");
}
}
}
updatecache('usergroups');
cpmsg('usergroups_update_succeed', 'admincp.php?action=usergroups');
}
} elseif($action == 'ranks') {
if(!submitcheck('ranksubmit')) {
$ranks = '';
$query = $db->query("SELECT * FROM {$tablepre}ranks ORDER BY postshigher");
while($rank = $db->fetch_array($query)) {
$ranks .= "<tr align=\"center\"><td bgcolor=\"".ALTBG1."\"><input type=\"checkbox\" name=\"delete[{$rank[rankid]}]\" value=\"$rank[rankid]\"></td>\n".
"<td bgcolor=\"".ALTBG2."\"><input type=\"text\" size=\"12\" name=\"ranktitlenew[{$rank[rankid]}]\" value=\"$rank[ranktitle]\"></td>\n".
"<td bgcolor=\"".ALTBG1."\"><input type=\"text\" size=\"6\" name=\"postshighernew[{$rank[rankid]}]\" value=\"$rank[postshigher]\">\n".
"<td bgcolor=\"".ALTBG1."\"><input type=\"text\" size=\"2\"name=\"starsnew[{$rank[rankid]}]\" value=\"$rank[stars]\"></td>\n".
"<td bgcolor=\"".ALTBG2."\"><input type=\"text\" size=\"6\"name=\"colornew[{$rank[rankid]}]\" value=\"$rank[color]\"></td>";
}
?>
<table cellspacing="<?=INNERBORDERWIDTH?>" cellpadding="<?=TABLESPACE?>" width="85%" align="center" class="tableborder">
<tr class="header"><td><?=$lang['tips']?></td></tr>
<tr bgcolor="<?=ALTBG1?>"><td>
<br><?=$lang['ranks_tips']?>
</td></tr></table><br>
<form method="post" action="admincp.php?action=ranks">
<input type="hidden" name="formhash" value="<?=FORMHASH?>">
<table cellspacing="<?=INNERBORDERWIDTH?>" cellpadding="<?=TABLESPACE?>" width="85%" align="center" class="tableborder">
<tr class="header" align="center"><td width="48"><input type="checkbox" name="chkall" class="header" onclick="checkall(this.form)"><?=$lang['del']?></td>
<td><?=$lang['ranks_title']?></td><td><?=$lang['ranks_postshigher']?></td><td><?=$lang['ranks_stars']?></td><td><?=$lang['ranks_color']?></td></tr>
<?=$ranks?>
<tr><td colspan="5" class="singleborder"> </td></tr>
<tr align="center" bgcolor="<?=ALTBG1?>"><td><?=$lang['add_new']?></td>
<td><input type="text" size="12" name="newranktitle"></td>
<td><input type="text" size="6" name="newpostshigher"></td>
<td><input type="text" size="2" name="newstars"></td>
<td><input type="text" size="6" name="newcolor"></td>
</tr></table><br>
<center><input type="submit" name="ranksubmit" value="<?=$lang['submit']?>"></center></form>
<?
} else {
if($delete) {
$ids = implode('\',\'', $delete);
$db->query("DELETE FROM {$tablepre}ranks WHERE rankid IN ('$ids')");
}
foreach($ranktitlenew as $id => $value) {
$db->query("UPDATE {$tablepre}ranks SET ranktitle='$ranktitlenew[$id]', postshigher='$postshighernew[$id]', stars='$starsnew[$id]', color='$colornew[$id]' WHERE rankid='$id'");
}
if($newranktitle) {
$db->query("INSERT INTO {$tablepre}ranks (ranktitle, postshigher, stars, color)
VALUES ('$newranktitle', '$newpostshigher', '$newstars', '$newcolor')");
}
updatecache('ranks');
cpmsg('ranks_succeed', 'admincp.php?action=ranks');
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -