public function member_profile_start()
 {
     global $mybb;
     if (!$mybb->settings['mppermissionsenabled'] || !$mybb->usergroup['canviewprofiles']) {
         return;
     }
     $memprofile = false;
     $uid = $mybb->get_input('uid', 1);
     if ($uid) {
         $memprofile = get_user($uid);
     } elseif ($mybb->user['uid']) {
         $memprofile = $mybb->user;
     }
     if ($mybb->settings['mppermissionsgroups'] != -1 && !is_member($mybb->settings['mppermissionsgroups'], array('usergroup' => $memprofile['usergroup'], 'additionalgroups' => $memprofile['additionalgroups']))) {
         return;
     }
     if (!$memprofile || !$memprofile['myprofilepermissions'] || $mybb->user['uid'] == $memprofile['uid'] || $mybb->usergroup['caneditprofiles']) {
         return;
     }
     require_once MYBB_ROOT . 'inc/functions_modcp.php';
     if (modcp_can_manage_user($memprofile['uid'])) {
         return;
     }
     if ($memprofile['myprofilepermissions'] == 1 || !$memprofile['buddylist'] && !$memprofile['ignorelist']) {
         error_no_permission();
     }
     if (my_strpos(',' . $memprofile['ignorelist'] . ',', ',' . $mybb->user['uid'] . ',') !== false) {
         error_no_permission();
     }
     if (!my_strpos(',' . $memprofile['buddylist'] . ',', ',' . $mybb->user['uid'] . ',') !== false) {
         error_no_permission();
     }
 }
Exemplo n.º 2
0
     }
 }
 // Creating a new ban
 if (!$existing_ban) {
     // Get the users info from their Username
     $options = array('fields' => array('username', 'usergroup', 'additionalgroups', 'displaygroup'));
     $user = get_user_by_username($mybb->input['username'], $options);
     if (!$user['uid']) {
         $errors[] = $lang->invalid_username;
     }
 }
 if ($user['uid'] == $mybb->user['uid']) {
     $errors[] = $lang->error_cannotbanself;
 }
 // Have permissions to ban this user?
 if (!modcp_can_manage_user($user['uid'])) {
     $errors[] = $lang->error_cannotbanuser;
 }
 // Check for an incoming reason
 if (empty($mybb->input['banreason'])) {
     $errors[] = $lang->error_nobanreason;
 }
 // Check banned group
 $usergroups_cache = $cache->read('usergroups');
 $usergroup = $usergroups_cache[$mybb->get_input('usergroup', MyBB::INPUT_INT)];
 $query = $db->simple_select("usergroups", "gid", "isbannedgroup=1 AND gid='" . $mybb->get_input('usergroup', MyBB::INPUT_INT) . "'");
 if (empty($usergroup['gid']) || empty($usergroup['isbannedgroup'])) {
     $errors[] = $lang->error_nobangroup;
 }
 // If this is a new ban, we check the user isn't already part of a banned group
 if (!$existing_ban && $user['uid']) {
Exemplo n.º 3
0
function m_ban_user_func($xmlrpc_params)
{
    global $input, $post, $thread, $forum, $pid, $tid, $fid, $modlogdata, $db, $lang, $theme, $plugins, $mybb, $session, $settings, $cache, $time, $mybbgroups, $moderation, $parser;
    $input = Tapatalk_Input::filterXmlInput(array('user_name' => Tapatalk_Input::STRING, 'mode' => Tapatalk_Input::INT, 'reason_text' => Tapatalk_Input::STRING, 'expired' => Tapatalk_Input::INT), $xmlrpc_params);
    $ban_time = '---';
    if (!empty($input['expired'])) {
        $expired = intval($input['expired']);
        $year = date("Y", $expired) - date("Y", time());
        $month = date("m", $expired) - date("m", time());
        $day = date("d", $expired) - date("d", time());
        if ($year < 0) {
            $year = 0;
            $month = 0;
            $day = 0;
        }
        if ($month < 0) {
            $month = 0;
        }
        if ($day < 0) {
            $day = 0;
        }
        $ban_time = $day . '-' . $month . '-' . $year;
    }
    mod_setup();
    $lang->load("modcp");
    // Get the users info from their Username
    $query = $db->simple_select("users", "uid, username,usergroup, additionalgroups, displaygroup", "username = '******'user_name_esc']}'", array('limit' => 1));
    $user = $db->fetch_array($query);
    if (!$user['uid']) {
        return xmlrespfalse($lang->invalid_username);
    }
    if ($user['uid'] == $mybb->user['uid']) {
        return xmlrespfalse($lang->error_cannotbanself);
    }
    // Have permissions to ban this user?
    if (!modcp_can_manage_user($user['uid'])) {
        return xmlrespfalse($lang->error_cannotbanuser);
    }
    // Check for an incoming reason
    if (empty($input['reason_text'])) {
        return xmlrespfalse($lang->error_nobanreason);
    }
    // Check banned group
    $query = $db->simple_select("usergroups", "gid", "isbannedgroup=1", array('limit' => 1));
    $gid = $db->fetch_field($query, "gid");
    if (!$gid) {
        return xmlrespfalse($lang->error_nobangroup);
    }
    // If this is a new ban, we check the user isn't already part of a banned group
    $query = $db->simple_select("banned", "uid", "uid='{$user['uid']}'");
    if ($db->fetch_field($query, "uid")) {
        return xmlrespfalse($lang->error_useralreadybanned);
    }
    $insert_array = array('uid' => $user['uid'], 'gid' => $gid, 'oldgroup' => $user['usergroup'], 'oldadditionalgroups' => $user['additionalgroups'], 'olddisplaygroup' => $user['displaygroup'], 'admin' => intval($mybb->user['uid']), 'dateline' => TIME_NOW, 'bantime' => $ban_time, 'lifted' => 0, 'reason' => $input['reason_text_esc']);
    $db->insert_query('banned', $insert_array);
    // Move the user to the banned group
    $update_array = array('usergroup' => $gid, 'displaygroup' => 0, 'additionalgroups' => '');
    $db->update_query('users', $update_array, "uid = {$user['uid']}");
    // soft delete (unapprove) posts if necessary
    if ($input['mode'] == 2) {
        $db->update_query('posts', array("visible" => 0), "uid = {$user['uid']}");
        $db->update_query('threads', array("visible" => 0), "uid = {$user['uid']}");
    }
    $cache->update_banned();
    log_moderator_action(array("uid" => $user['uid'], "username" => $user['username']), $lang->banned_user);
    $response = new xmlrpcval(array('result' => new xmlrpcval(true, 'boolean'), 'is_login_mod' => new xmlrpcval(true, 'boolean'), 'result_text' => new xmlrpcval("", 'base64')), 'struct');
    return new xmlrpcresp($response);
}