Пример #1
0
function qa_delete_user($userid)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'qa-db-votes.php';
    require_once QA_INCLUDE_DIR . 'qa-db-users.php';
    require_once QA_INCLUDE_DIR . 'qa-db-post-update.php';
    require_once QA_INCLUDE_DIR . 'qa-db-points.php';
    $postids = qa_db_uservoteflag_user_get($userid);
    // posts this user has flagged or voted on, whose counts need updating
    qa_db_user_delete($userid);
    foreach ($postids as $postid) {
        // hoping there aren't many of these - saves a lot of new SQL code...
        qa_db_post_recount_votes($postid);
        qa_db_post_recount_flags($postid);
    }
    $postuserids = qa_db_posts_get_userids($postids);
    foreach ($postuserids as $postuserid) {
        qa_db_points_update_ifuser($postuserid, array('avoteds', 'qvoteds', 'upvoteds', 'downvoteds'));
    }
}
Пример #2
0
function qa_flags_clear_all($post, $userid, $handle, $cookieid)
{
    require_once QA_INCLUDE_DIR . 'qa-db-votes.php';
    require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
    qa_db_userflags_clear_all($post['postid']);
    qa_db_post_recount_flags($post['postid']);
    switch ($post['basetype']) {
        case 'Q':
            $action = 'q_clearflags';
            break;
        case 'A':
            $action = 'a_clearflags';
            break;
        case 'C':
            $action = 'c_clearflags';
            break;
    }
    qa_report_write_action($userid, null, $action, $post['basetype'] == 'Q' ? $post['postid'] : null, $post['basetype'] == 'A' ? $post['postid'] : null, $post['basetype'] == 'C' ? $post['postid'] : null);
    qa_report_event($action, $userid, $handle, $cookieid, array('postid' => $post['postid']));
}
Пример #3
0
function qa_flags_clear_all($oldpost, $userid, $handle, $cookieid)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'db/votes.php';
    require_once QA_INCLUDE_DIR . 'app/limits.php';
    require_once QA_INCLUDE_DIR . 'db/post-update.php';
    qa_db_userflags_clear_all($oldpost['postid']);
    qa_db_post_recount_flags($oldpost['postid']);
    qa_db_flaggedcount_update();
    switch ($oldpost['basetype']) {
        case 'Q':
            $event = 'q_clearflags';
            break;
        case 'A':
            $event = 'a_clearflags';
            break;
        case 'C':
            $event = 'c_clearflags';
            break;
    }
    qa_report_event($event, $userid, $handle, $cookieid, array('postid' => $oldpost['postid'], 'oldpost' => $oldpost));
}