예제 #1
0
                                            }
                                        } else {
                                            // Set all his/her posts to guest
                                            $db->query('UPDATE ' . $db->prefix . 'posts SET poster_id=1 WHERE poster_id=' . $id) or error('Unable to update posts', __FILE__, __LINE__, $db->error());
                                        }
                                        // Delete the user
                                        $db->query('DELETE FROM ' . $db->prefix . 'users WHERE id=' . $id) or error('Unable to delete user', __FILE__, __LINE__, $db->error());
                                        // Delete user avatar
                                        delete_avatar($id);
                                        // Regenerate the users info cache
                                        if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
                                            require PUN_ROOT . 'include/cache.php';
                                        }
                                        generate_users_info_cache();
                                        if ($group_id == PUN_ADMIN) {
                                            generate_admins_cache();
                                        }
                                        redirect('index.php', $lang_profile['User delete redirect']);
                                    }
                                    $page_title = array(pun_htmlspecialchars($pun_config['o_board_title']), $lang_common['Profile'], $lang_profile['Confirm delete user']);
                                    define('PUN_ACTIVE_PAGE', 'profile');
                                    require PUN_ROOT . 'header.php';
                                    ?>
<div class="blockform">
	<h2><span><?php 
                                    echo $lang_profile['Confirm delete user'];
                                    ?>
</span></h2>
	<div class="box">
		<form id="confirm_del_user" method="post" action="profile.php?id=<?php 
                                    echo $id;
예제 #2
0
function get_admin_ids()
{
    if (file_exists(LUNA_CACHE_DIR . 'cache_admins.php')) {
        include LUNA_CACHE_DIR . 'cache_admins.php';
    }
    if (!defined('LUNA_ADMINS_LOADED')) {
        if (!defined('LUNA_CACHE_FUNCTIONS_LOADED')) {
            require LUNA_ROOT . 'include/cache.php';
        }
        generate_admins_cache();
        require LUNA_CACHE_DIR . 'cache_admins.php';
    }
    return $luna_admins;
}
예제 #3
0
function get_admin_ids()
{
    if (file_exists(FORUM_CACHE_DIR . 'cache_admins.php')) {
        include FORUM_CACHE_DIR . 'cache_admins.php';
    }
    if (!defined('PUN_ADMINS_LOADED')) {
        if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
            require PUN_ROOT . 'include/cache.php';
        }
        generate_admins_cache();
        require FORUM_CACHE_DIR . 'cache_admins.php';
    }
    return $pun_admins;
}
예제 #4
0
 public function delete_user($id)
 {
     global $lang_profile;
     // Get the username and group of the user we are deleting
     $select_info_delete_user = array('group_id', 'username');
     $result = DB::for_table('users')->where('id', $id)->select_many($select_info_delete_user)->find_one();
     $group_id = $result['group_id'];
     $username = $result['username'];
     if ($group_id == FEATHER_ADMIN) {
         message($lang_profile['No delete admin message']);
     }
     if ($this->request->post('delete_user_comply')) {
         // If the user is a moderator or an administrator, we remove him/her from the moderator list in all forums as well
         $group_mod = DB::for_table('groups')->where('g_id', $group_id)->find_one_col('g_moderator');
         if ($group_id == FEATHER_ADMIN || $group_mod == '1') {
             $select_info_delete_moderators = array('id', 'moderators');
             $result = DB::for_table('forums')->select_many($select_info_delete_moderators)->find_many();
             foreach ($result as $cur_forum) {
                 $cur_moderators = $cur_forum['moderators'] != '' ? unserialize($cur_forum['moderators']) : array();
                 if (in_array($id, $cur_moderators)) {
                     unset($cur_moderators[$username]);
                     if (!empty($cur_moderators)) {
                         DB::for_table('forums')->where('id', $cur_forum['id'])->find_one()->set('moderators', serialize($cur_moderators))->save();
                     } else {
                         DB::for_table('forums')->where('id', $cur_forum['id'])->find_one()->set_expr('moderators', 'NULL')->save();
                     }
                 }
             }
         }
         // Delete any subscriptions
         DB::for_table('topic_subscriptions')->where('user_id', $id)->delete_many();
         DB::for_table('forum_subscriptions')->where('user_id', $id)->delete_many();
         // Remove him/her from the online list (if they happen to be logged in)
         DB::for_table('online')->where('user_id', $id)->delete_many();
         // Should we delete all posts made by this user?
         if ($this->request->post('delete_posts')) {
             require FEATHER_ROOT . 'include/search_idx.php';
             // Hold on, this could take some time!
             @set_time_limit(0);
             // Find all posts made by this user
             $select_user_posts = array('p.id', 'p.topic_id', 't.forum_id');
             $result = DB::for_table('posts')->table_alias('p')->select_many($select_user_posts)->inner_join('topics', array('t.id', '=', 'p.topic_id'), 't')->inner_join('forums', array('f.id', '=', 't.forum_id'), 'f')->where('p.poster_id', $id)->find_many();
             if ($result) {
                 foreach ($result as $cur_post) {
                     // Determine whether this post is the "topic post" or not
                     $result2 = DB::for_table('posts')->where('topic_id', $cur_post['topic_id'])->order_by('posted')->find_one_col('id');
                     if ($this->db->result($result2) == $cur_post['id']) {
                         delete_topic($cur_post['topic_id']);
                     } else {
                         delete_post($cur_post['id'], $cur_post['topic_id']);
                     }
                     update_forum($cur_post['forum_id']);
                 }
             }
         } else {
             // Set all his/her posts to guest
             DB::for_table('posts')->where_in('poster_id', '1')->update_many('poster_id', $id);
         }
         // Delete the user
         DB::for_table('users')->where('id', $id)->delete_many();
         // Delete user avatar
         delete_avatar($id);
         // Regenerate the users info cache
         if (!defined('FORUM_CACHE_FUNCTIONS_LOADED')) {
             require FEATHER_ROOT . 'include/cache.php';
         }
         generate_users_info_cache();
         if ($group_id == FEATHER_ADMIN) {
             generate_admins_cache();
         }
         redirect(get_base_url(), $lang_profile['User delete redirect']);
     }
 }