Example #1
0
     }
 }
 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()) {
     $doconfirms = qa_opt('confirm_user_emails') && $useraccount['level'] < QA_USER_LEVEL_EXPERT;
     $isconfirmed = $useraccount['flags'] & QA_USER_FLAGS_EMAIL_CONFIRMED ? true : false;
     $qa_content['form_profile']['fields']['email'] = array('type' => $userediting ? 'text' : 'static', 'label' => qa_lang_html('users/email_label'), 'tags' => 'NAME="email"', 'value' => qa_html(isset($inemail) ? $inemail : $useraccount['email']), 'error' => qa_html(@$errors['email']), 'note' => ($doconfirms ? qa_lang_html($isconfirmed ? 'users/email_confirmed' : 'users/email_not_confirmed') . ' ' : '') . qa_lang_html('users/only_shown_admins'));
 }
 //	Show IP addresses and times for last login or write - only if we're a moderator or higher
 if ($loginlevel >= QA_USER_LEVEL_MODERATOR && !qa_user_permit_error()) {
     $qa_content['form_profile']['fields']['lastlogin'] = array('type' => 'static', 'label' => qa_lang_html('users/last_login_label'), 'value' => strtr(qa_lang_html('users/x_ago_from_y'), array('^1' => qa_time_to_string(qa_opt('db_time') - $useraccount['loggedin']), '^2' => qa_ip_anchor_html($useraccount['loginip']))), 'note' => qa_lang_html('users/only_shown_moderators'));
     if (isset($useraccount['written'])) {
         $qa_content['form_profile']['fields']['lastwrite'] = array('type' => 'static', 'label' => qa_lang_html('users/last_write_label'), 'value' => strtr(qa_lang_html('users/x_ago_from_y'), array('^1' => qa_time_to_string(qa_opt('db_time') - $useraccount['written']), '^2' => qa_ip_anchor_html($useraccount['writeip']))), 'note' => qa_lang_html('users/only_shown_moderators'));
     } else {
         unset($qa_content['form_profile']['fields']['lastwrite']);
     }
 }
 //	Show other profile fields
 $fieldsediting = $fieldseditable && $userediting;
 foreach ($userfields as $userfield) {
     if ($userfield['flags'] & QA_FIELD_FLAGS_LINK_URL && !$fieldsediting) {
         $valuehtml = qa_url_to_html_link(@$userprofile[$userfield['title']], qa_opt('links_in_new_window'));
     } else {
         $value = @$inprofile[$userfield['fieldid']];
         if (!isset($value)) {
             $value = @$userprofile[$userfield['title']];
         }
         $valuehtml = qa_html($value, $userfield['flags'] & QA_FIELD_FLAGS_MULTI_LINE && !$fieldsediting ? true : false);
    $qa_content['error'] = qa_lang_html('users/no_permission');
    return $qa_content;
}
//	Check to see if any were approved or blocked here
$pageerror = qa_admin_check_clicks();
//	Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/approve_users_title');
$qa_content['error'] = isset($pageerror) ? $pageerror : qa_admin_page_error();
$qa_content['message_list'] = array('form' => array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('admin/click'))), 'messages' => array());
if (count($users)) {
    foreach ($users as $user) {
        $message = array();
        $message['tags'] = 'id="p' . qa_html($user['userid']) . '"';
        // use p prefix for qa_admin_click() in qa-admin.js
        $message['content'] = qa_lang_html('users/registered_label') . ' ' . strtr(qa_lang_html('users/x_ago_from_y'), array('^1' => qa_time_to_string(qa_opt('db_time') - $user['created']), '^2' => qa_ip_anchor_html($user['createip']))) . '<br/>';
        $htmlemail = qa_html($user['email']);
        $message['content'] .= qa_lang_html('users/email_label') . ' <a href="mailto:' . $htmlemail . '">' . $htmlemail . '</a>';
        if (qa_opt('confirm_user_emails')) {
            $message['content'] .= '<small> - ' . qa_lang_html($user['flags'] & QA_USER_FLAGS_EMAIL_CONFIRMED ? 'users/email_confirmed' : 'users/email_not_confirmed') . '</small>';
        }
        foreach ($userfields as $userfield) {
            if (strlen(@$user['profile'][$userfield['title']])) {
                $message['content'] .= '<br/>' . qa_html($userfield['content'] . ': ' . $user['profile'][$userfield['title']]);
            }
        }
        $message['meta_order'] = qa_lang_html('main/meta_order');
        $message['who']['data'] = qa_get_one_user_html($user['handle']);
        $message['form'] = array('style' => 'light', 'buttons' => array('approve' => array('tags' => 'name="admin_' . $user['userid'] . '_userapprove" onclick="return qa_admin_click(this);"', 'label' => qa_lang_html('question/approve_button'), 'popup' => qa_lang_html('admin/approve_user_popup')), 'block' => array('tags' => 'name="admin_' . $user['userid'] . '_userblock" onclick="return qa_admin_click(this);"', 'label' => qa_lang_html('admin/block_button'), 'popup' => qa_lang_html('admin/block_user_popup'))));
        $qa_content['message_list']['messages'][] = $message;
    }
Example #3
0
function qa_who_to_html($isbyuser, $postuserid, $usershtml, $ip = null, $microformats = false, $name = null)
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    if (isset($postuserid) && isset($usershtml[$postuserid])) {
        $whohtml = $usershtml[$postuserid];
        if ($microformats) {
            $whohtml = '<span class="vcard author">' . $whohtml . '</span>';
        }
    } else {
        if (strlen($name)) {
            $whohtml = qa_html($name);
        } elseif ($isbyuser) {
            $whohtml = qa_lang_html('main/me');
        } else {
            $whohtml = qa_lang_html('main/anonymous');
        }
        if (isset($ip)) {
            $whohtml = qa_ip_anchor_html($ip, $whohtml);
        }
    }
    return qa_lang_html_sub_split('main/by_x', $whohtml);
}
function qa_who_to_html($isbyuser, $postuserid, $usershtml, $ip = null, $microformats = false)
{
    if (isset($postuserid) && isset($usershtml[$postuserid])) {
        $whohtml = $usershtml[$postuserid];
        if ($microformats) {
            $whohtml = '<SPAN CLASS="vcard author">' . $whohtml . '</SPAN>';
        }
    } elseif ($isbyuser) {
        $whohtml = qa_lang_html('main/me');
    } else {
        $whohtml = qa_lang_html('main/anonymous');
        if (isset($ip)) {
            $whohtml = qa_ip_anchor_html($ip, $whohtml);
        }
    }
    return qa_lang_html_sub_split('main/by_x', $whohtml);
}