Exemplo n.º 1
0
function qa_user_permit_error($permitoption = null, $limitaction = null, $userlevel = null, $checkblocks = true)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'app/limits.php';
    $userid = qa_get_logged_in_userid();
    if (!isset($userlevel)) {
        $userlevel = qa_get_logged_in_level();
    }
    $flags = qa_get_logged_in_flags();
    if (!$checkblocks) {
        $flags &= ~QA_USER_FLAGS_USER_BLOCKED;
    }
    $error = qa_permit_error($permitoption, $userid, $userlevel, $flags);
    if ($checkblocks && !$error && qa_is_ip_blocked()) {
        $error = 'ipblock';
    }
    if (!$error && isset($userid) && $flags & QA_USER_FLAGS_MUST_CONFIRM && qa_opt('confirm_user_emails')) {
        $error = 'confirm';
    }
    if (!$error && isset($userid) && $flags & QA_USER_FLAGS_MUST_APPROVE && qa_opt('moderate_users')) {
        $error = 'approve';
    }
    if (isset($limitaction) && !$error) {
        if (qa_user_limits_remaining($limitaction) <= 0) {
            $error = 'limit';
        }
    }
    return $error;
}
Exemplo n.º 2
0
if (!QA_FINAL_EXTERNAL_USERS) {
    $qa_content['form_profile'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'fields' => array('avatar' => array('type' => 'image', 'style' => 'tall', 'label' => '', 'html' => qa_get_user_avatar_html($useraccount['flags'], $useraccount['email'], $useraccount['handle'], $useraccount['avatarblobid'], $useraccount['avatarwidth'], $useraccount['avatarheight'], qa_opt('avatar_profile_size'))), 'removeavatar' => null, 'duration' => array('type' => 'static', 'label' => qa_lang_html('users/member_for'), 'value' => qa_html(qa_time_to_string(qa_opt('db_time') - $useraccount['created']))), 'level' => array('type' => 'static', 'label' => qa_lang_html('users/member_type'), 'tags' => 'NAME="level"', 'value' => qa_html(qa_user_level_string($useraccount['level'])), 'note' => $useraccount['flags'] & QA_USER_FLAGS_USER_BLOCKED && isset($maxlevelassign) ? qa_lang_html('users/user_blocked') : '')));
    if (empty($qa_content['form_profile']['fields']['avatar']['html'])) {
        unset($qa_content['form_profile']['fields']['avatar']);
    }
    //	Private message form
    if (qa_opt('allow_private_messages') && isset($loginuserid) && $loginuserid != $userid && !($useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES)) {
        $qa_content['form_profile']['fields']['level']['value'] .= strtr(qa_lang_html('profile/send_private_message'), array('^1' => '<A HREF="' . qa_path_html('message/' . $handle) . '">', '^2' => '</A>'));
    }
    //	Show any extra privileges due to user's level or their points
    $showpermits = array();
    $permitoptions = qa_get_permit_options();
    foreach ($permitoptions as $permitoption) {
        if (qa_opt($permitoption) < QA_PERMIT_CONFIRMED) {
            // if it's not available to all users (after they've confirmed their email address)
            if (!qa_permit_error($permitoption, $userid, $useraccount['level'], $useraccount['flags'], $userpoints['points'])) {
                // but this user can
                if ($permitoption == 'permit_retag_cat') {
                    $showpermits[] = qa_lang(qa_using_categories() ? 'profile/permit_recat' : 'profile/permit_retag');
                } else {
                    $showpermits[] = qa_lang('profile/' . $permitoption);
                }
                // then show it as an extra priviliege
            }
        }
    }
    if (count($showpermits)) {
        $qa_content['form_profile']['fields']['permits'] = array('type' => 'static', 'label' => qa_lang_html('profile/extra_privileges'), 'value' => qa_html(implode("\n", $showpermits), true), 'rows' => count($showpermits));
    }
    //	Show email address only if we're an administrator
    if ($loginlevel >= QA_USER_LEVEL_ADMIN && !qa_user_permit_error()) {
Exemplo n.º 3
0
function qa_user_permit_error($permitoption = null, $limitaction = null)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
    $userid = qa_get_logged_in_userid();
    $flags = qa_get_logged_in_flags();
    $error = qa_permit_error($permitoption, $userid, qa_get_logged_in_level(), $flags);
    if (!$error && qa_is_ip_blocked()) {
        $error = 'ipblock';
    }
    if (!$error && isset($userid) && $flags & QA_USER_FLAGS_MUST_CONFIRM) {
        $error = 'confirm';
    }
    if (isset($limitaction) && !$error) {
        if (qa_limits_remaining(qa_get_logged_in_userid(), $limitaction) <= 0) {
            $error = 'limit';
        }
    }
    return $error;
}
             $qa_content['script_onloads'][] = array("qa_update_category_levels();");
             $qa_content['form_profile']['fields']['level']['tags'] .= ' id="level_select" onchange="qa_update_category_levels();"';
         }
     }
 } else {
     foreach ($userlevels as $userlevel) {
         if ($userlevel['entitytype'] == QA_ENTITY_CATEGORY && $userlevel['level'] > $useraccount['level']) {
             $qa_content['form_profile']['fields']['level']['value'] .= '<br/>' . strtr(qa_lang_html('users/level_for_category'), array('^1' => qa_html(qa_user_level_string($userlevel['level'])), '^2' => '<a href="' . qa_path_html(implode('/', array_reverse(explode('/', $userlevel['backpath'])))) . '">' . qa_html($userlevel['title']) . '</a>'));
         }
     }
 }
 //	Show any extra privileges due to user's level or their points
 $showpermits = array();
 $permitoptions = qa_get_permit_options();
 foreach ($permitoptions as $permitoption) {
     if (qa_permit_error($permitoption, $userid, QA_USER_LEVEL_APPROVED, QA_USER_FLAGS_EMAIL_CONFIRMED, 0) && !qa_permit_error($permitoption, $userid, $useraccount['level'], $useraccount['flags'], $userpoints['points'])) {
         if ($permitoption == 'permit_retag_cat') {
             $showpermits[] = qa_lang(qa_using_categories() ? 'profile/permit_recat' : 'profile/permit_retag');
         } else {
             $showpermits[] = qa_lang('profile/' . $permitoption);
         }
         // then show it as an extra priviliege
     }
 }
 if (count($showpermits)) {
     $qa_content['form_profile']['fields']['permits'] = array('type' => 'static', 'label' => qa_lang_html('profile/extra_privileges'), 'value' => qa_html(implode("\n", $showpermits), true), 'rows' => count($showpermits), 'id' => 'permits');
 }
 //	Show email address only if we're an administrator
 if ($loginlevel >= QA_USER_LEVEL_ADMIN && !qa_user_permit_error()) {
     $doconfirms = qa_opt('confirm_user_emails') && $useraccount['level'] < QA_USER_LEVEL_EXPERT;
     $isconfirmed = $useraccount['flags'] & QA_USER_FLAGS_EMAIL_CONFIRMED ? true : false;
Exemplo n.º 5
0
function qa_user_permit_error($permitoption = null, $actioncode = null)
{
    require_once QA_INCLUDE_DIR . 'qa-app-limits.php';
    $error = qa_permit_error($permitoption, qa_get_logged_in_userid(), qa_get_logged_in_level(), qa_get_logged_in_flags());
    if (!$error && qa_is_ip_blocked()) {
        $error = 'ipblock';
    }
    if (isset($actioncode) && !$error) {
        if (qa_limits_remaining(qa_get_logged_in_userid(), $actioncode) <= 0) {
            $error = 'limit';
        }
    }
    return $error;
}