if ($postcomment_cache_pid) {
         C::t('forum_postcache')->delete($postcomment_cache_pid);
     }
     if (!$member['adminid']) {
         $member_status = C::t('common_member_status')->fetch($member['uid']);
         if ($member_status) {
             captcha::report($member_status['lastip']);
         }
     }
 } elseif ($member['groupid'] == 4 || $member['groupid'] == 5) {
     if (!empty($member['groupterms']['main']['groupid'])) {
         $groupidnew = $member['groupterms']['main']['groupid'];
         $adminidnew = $member['groupterms']['main']['adminid'];
         unset($member['groupterms']['main']);
         unset($member['groupterms']['ext'][$member['groupid']]);
         $setarr['groupexpiry'] = groupexpiry($member['groupterms']);
     }
     $groupnew = C::t('common_usergroup')->fetch_by_credits($member['credits']);
     $groupidnew = $groupnew['groupid'];
     $adminidnew = 0;
 } else {
     $update = false;
     $groupidnew = $member['groupid'];
     $adminidnew = $member['adminid'];
     if (in_array('avatar', $_GET['clear'])) {
         $setarr['avatarstatus'] = 0;
         loaducenter();
         uc_user_deleteavatar($member['uid']);
     }
 }
 if (!empty($my_data) && !empty($mylogtype)) {
Exemple #2
0
                    $groupidnew = $groupterms['main']['groupid'];
                    $adminidnew = $groupterms['main']['adminid'];
                } else {
                    $groupidnew = $db->result_first("SELECT groupid FROM {$tablepre}usergroups WHERE type='member' AND '{$credits}'>=creditshigher AND '{$credits}'<creditslower LIMIT 1");
                    if (in_array($adminid, array(1, 2, 3))) {
                        $query = $db->query("SELECT groupid FROM {$tablepre}usergroups WHERE groupid IN ('" . implode('\',\'', $extgroupidarray) . "') AND radminid='{$adminid}' LIMIT 1");
                        $adminidnew = $db->num_rows($query) ? $adminid : 0;
                    } else {
                        $adminidnew = 0;
                    }
                }
                unset($groupterms['main']);
            }
            unset($groupterms['ext'][$expgroupid]);
        }
        $groupexpirynew = groupexpiry($groupterms);
        $extgroupidsnew = implode("\t", $extgroupidarray);
        $grouptermsnew = addslashes(serialize($groupterms));
        $db->query("UPDATE {$tablepre}members SET adminid='{$adminidnew}', groupid='{$groupidnew}', extgroupids='{$extgroupidsnew}', groupexpiry='{$groupexpirynew}' WHERE uid='{$discuz_uid}'");
        $db->query("UPDATE {$tablepre}memberfields SET groupterms='{$grouptermsnew}' WHERE uid='{$discuz_uid}'");
    }
    include template('groupexpiry');
} elseif ($action == 'switchstatus' && $discuz_uid) {
    if (!$allowinvisible) {
        showmessage('group_nopermission', NULL, 'NOPERM');
    }
    $db->query("UPDATE {$tablepre}members SET invisible = !invisible WHERE uid='{$discuz_uid}'", 'UNBUFFERED');
    include language('misc');
    showmessage($invisible ? '<a href="member.php?action=switchstatus" title="' . $language['login_switch_invisible_mode'] . '" ajaxtarget="loginstatus">' . $language['login_normal_mode'] . '</a>' : '<a href="member.php?action=switchstatus" title="' . $language['login_switch_normal_mode'] . '" ajaxtarget="loginstatus">' . $language['login_invisible_mode'] . '</a>', dreferer());
} else {
    showmessage('undefined_action', NULL, 'HALTED');
         $member['groupterms']['main'] = array('time' => $_G['gp_banexpirynew'], 'adminid' => $member['adminid'], 'groupid' => $member['groupid']);
         $member['groupterms']['ext'][$groupidnew] = $_G['gp_banexpirynew'];
         $sql .= ', groupexpiry=\'' . groupexpiry($member['groupterms']) . '\'';
     } else {
         $sql .= ', groupexpiry=0';
     }
     $adminidnew = -1;
     $my_data['expiry'] = groupexpiry($member['groupterms']);
     DB::delete('forum_postcomment', "authorid='{$member['uid']}' AND rpid>'0'");
 } elseif ($member['groupid'] == 4 || $member['groupid'] == 5) {
     if (!empty($member['groupterms']['main']['groupid'])) {
         $groupidnew = $member['groupterms']['main']['groupid'];
         $adminidnew = $member['groupterms']['main']['adminid'];
         unset($member['groupterms']['main']);
         unset($member['groupterms']['ext'][$member['groupid']]);
         $sql .= ', groupexpiry=\'' . groupexpiry($member['groupterms']) . '\'';
     }
     $groupidnew = DB::result_first("SELECT groupid FROM " . DB::table('common_usergroup') . " WHERE type='member' AND creditshigher<='{$member['credits']}' AND creditslower>'{$member['credits']}'");
     $adminidnew = 0;
 } else {
     $update = false;
     $groupidnew = $member['groupid'];
     $adminidnew = $member['adminid'];
     if (in_array('avatar', $_G['gp_clear'])) {
         $sql .= ', avatarstatus=\'0\'';
         loaducenter();
         uc_user_deleteavatar($member['uid']);
     }
 }
 if (!empty($my_data) && !empty($mylogtype)) {
     my_thread_log($mylogtype, $my_data);
            DB::query("INSERT INTO " . DB::table('forum_warning') . " (pid, operatorid, operator, authorid, author, dateline, reason) VALUES ('{$post['pid']}', '{$_G['uid']}', '{$_G['username']}', '{$post['authorid']}', '" . addslashes($post['author']) . "', '{$_G['timestamp']}', '{$reason}')", 'UNBUFFERED');
            $authorwarnings = DB::result_first("SELECT COUNT(*) FROM " . DB::table('forum_warning') . " WHERE authorid='{$post['authorid']}' AND dateline>={$_G['timestamp']}-" . $_G[setting][warningexpiration] * 86400);
            if ($authorwarnings >= $_G['setting']['warninglimit']) {
                $member = DB::fetch_first("SELECT adminid, groupid, extgroupids FROM " . DB::table('common_member') . " WHERE uid='{$post['authorid']}'");
                $groupterms = unserialize(DB::result_first("SELECT groupterms FROM " . DB::table('common_member_field_forum') . " WHERE uid='{$post['authorid']}'"));
                if ($member && $member['groupid'] != 4) {
                    $extgroupidsarray = array();
                    foreach (array_unique(array_merge($member['extgroupids'], array(4))) as $extgroupid) {
                        if ($extgroupid) {
                            $extgroupidsarray[] = $extgroupid;
                        }
                    }
                    $extgroupidsnew = implode("\t", $extgroupidsarray);
                    $banexpiry = TIMESTAMP + $_G['setting']['warningexpiration'] * 86400;
                    $groupterms['ext'][4] = $banexpiry;
                    DB::query("UPDATE " . DB::table('common_member') . " SET groupid='4', groupexpiry='" . groupexpiry($groupterms) . "' WHERE uid='{$post['authorid']}'");
                    DB::query("UPDATE " . DB::table('common_member_field_forum') . " SET groupterms='" . addslashes(serialize($groupterms)) . "' WHERE uid='{$post['authorid']}'");
                }
            }
            $pids .= $comma . $post['pid'];
            $comma = ',';
        } elseif (!$warned && $post['status'] & 2) {
            my_post_log('unwarn', array('pid' => $post['pid'], 'uid' => $post['authorid']));
            DB::query("UPDATE " . DB::table($posttable) . " SET status=status^2 WHERE pid='{$post['pid']}' AND status=status|2", 'UNBUFFERED');
            DB::query("DELETE FROM " . DB::table('forum_warning') . " WHERE pid='{$post['pid']}'", 'UNBUFFERED');
            $pids .= $comma . $post['pid'];
            $comma = ',';
        }
    }
    $resultarray = array('redirect' => "forum.php?mod=viewthread&tid={$_G['tid']}&page={$page}", 'reasonpm' => $sendreasonpm ? array('data' => $posts, 'var' => 'post', 'item' => 'reason_warn_post') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => stripslashes($reason), 'warningexpiration' => $_G['setting']['warningexpiration'], 'warninglimit' => $_G['setting']['warninglimit'], 'warningexpiration' => $_G['setting']['warningexpiration'], 'authorwarnings' => $authorwarnings), 'modtids' => 0, 'modlog' => $thread);
}
		$pids = $comma = '';
		foreach($posts as $k => $post) {
			if($post['adminid'] == 0) {
				if($warned && !($post['status'] & 2)) {
					$db->query("UPDATE {$tablepre}posts SET status=status|2 WHERE pid='$post[pid]'", 'UNBUFFERED');
					$reason = cutstr(dhtmlspecialchars($reason), 40);
					$db->query("INSERT INTO {$tablepre}warnings (pid, operatorid, operator, authorid, author, dateline, reason) VALUES ('$post[pid]', '$discuz_uid', '$discuz_user', '$post[authorid]', '".addslashes($post['author'])."', '$timestamp', '$reason')", 'UNBUFFERED');
					$authorwarnings = $db->result_first("SELECT COUNT(*) FROM {$tablepre}warnings WHERE authorid='$post[authorid]' AND dateline>=$timestamp-$warningexpiration*86400");
					if($authorwarnings >= $warninglimit) {
						$member = $db->fetch_first("SELECT adminid, groupid FROM {$tablepre}members WHERE uid='$post[authorid]'");
						if($member && $member['groupid'] != 4) {
							$banexpiry = $timestamp + $warningexpiration * 86400;
							$groupterms = array();
							$groupterms['main'] = array('time' => $banexpiry, 'adminid' => $member['adminid'], 'groupid' => $member['groupid']);
							$groupterms['ext'][4] = $banexpiry;
					  		$db->query("UPDATE {$tablepre}members SET groupid='4', groupexpiry='".groupexpiry($groupterms)."' WHERE uid='$post[authorid]'");
					  		$db->query("UPDATE {$tablepre}memberfields SET groupterms='".addslashes(serialize($groupterms))."' WHERE uid='$post[authorid]'");
					  	}
					}
					$pids .= $comma.$post['pid'];
					$comma = ',';
				} elseif(!$warned && ($post['status'] & 2)) {
					$db->query("UPDATE {$tablepre}posts SET status=status^2 WHERE pid='$post[pid]' AND status=status|2", 'UNBUFFERED');
					$db->query("DELETE FROM {$tablepre}warnings WHERE pid='$post[pid]'", 'UNBUFFERED');
					$pids .= $comma.$post['pid'];
					$comma = ',';
				}
			}
		}

		$resultarray = array(
            if ($authorwarnings >= $_G['setting']['warninglimit']) {
                $member = getuserbyuid($post[authorid]);
                $memberfieldforum = C::t('common_member_field_forum')->fetch($post[authorid]);
                $groupterms = dunserialize($memberfieldforum['groupterms']);
                unset($memberfieldforum);
                if ($member && $member['groupid'] != 4) {
                    $extgroupidsarray = array();
                    foreach (array_unique(array_merge($member['extgroupids'], array(4))) as $extgroupid) {
                        if ($extgroupid) {
                            $extgroupidsarray[] = $extgroupid;
                        }
                    }
                    $extgroupidsnew = implode("\t", $extgroupidsarray);
                    $banexpiry = TIMESTAMP + $_G['setting']['warningexpiration'] * 86400;
                    $groupterms['ext'][4] = $banexpiry;
                    C::t('common_member')->update($post['authorid'], array('groupid' => 4, 'groupexpiry' => groupexpiry($groupterms)));
                    C::t('common_member_field_forum')->update($post['authorid'], array('groupterms' => serialize($groupterms)));
                }
            }
            $pids .= $comma . $post['pid'];
            $comma = ',';
            crime('recordaction', $post['authorid'], 'crime_warnpost', lang('forum/misc', 'crime_postreason', array('reason' => $reason, 'tid' => $_G['tid'], 'pid' => $post['pid'])));
        } elseif (!$warned && $post['status'] & 2) {
            C::t('forum_post')->increase_status_by_pid('tid:' . $_G['tid'], $post['pid'], 2, '^', true);
            C::t('forum_warning')->delete_by_pid($post['pid']);
            $pids .= $comma . $post['pid'];
            $comma = ',';
        }
    }
    $resultarray = array('redirect' => "forum.php?mod=viewthread&tid={$_G['tid']}&page={$page}", 'reasonpm' => $sendreasonpm ? array('data' => $posts, 'var' => 'post', 'item' => 'reason_warn_post', 'notictype' => 'post') : array(), 'reasonvar' => array('tid' => $thread['tid'], 'subject' => $thread['subject'], 'modaction' => $modaction, 'reason' => $reason, 'warningexpiration' => $_G['setting']['warningexpiration'], 'warninglimit' => $_G['setting']['warninglimit'], 'warningexpiration' => $_G['setting']['warningexpiration'], 'authorwarnings' => $authorwarnings), 'modtids' => 0, 'modlog' => $thread);
}
Exemple #7
0
 protected function _handleBandUser($user, $days = 1)
 {
     $uid = $user['uid'];
     if ($this->_checkUserIgnore($uid)) {
         return false;
     }
     require_once libfile('function/forum');
     $setarr = array('groupid' => 4);
     if ($days) {
         $days = !empty($days) ? TIMESTAMP + $days * 86400 : 0;
         $days = $days > TIMESTAMP ? $days : 0;
         if ($days) {
             $user['groupterms']['main'] = array('time' => $days, 'adminid' => $user['adminid'], 'groupid' => $user['groupid']);
             $user['groupterms']['ext'][4] = $days;
             C::t('common_member_field_forum')->update($uid, array('groupterms' => serialize($user['groupterms'])));
             $setarr['groupexpiry'] = groupexpiry($user['groupterms']);
         } else {
             $setarr['groupexpiry'] = 0;
         }
     }
     require_once libfile('function/misc');
     return C::t('common_member')->update($uid, $setarr);
 }