function qa_userids_handles_html($useridhandles, $microformats = false)
{
    require_once QA_INCLUDE_DIR . 'qa-app-users.php';
    global $qa_root_url_relative;
    if (QA_FINAL_EXTERNAL_USERS) {
        $keyuserids = array();
        foreach ($useridhandles as $useridhandle) {
            if (isset($useridhandle['userid'])) {
                $keyuserids[$useridhandle['userid']] = true;
            }
            if (isset($useridhandle['lastuserid'])) {
                $keyuserids[$useridhandle['lastuserid']] = true;
            }
        }
        if (count($keyuserids)) {
            return qa_get_users_html(array_keys($keyuserids), true, $qa_root_url_relative, $microformats);
        } else {
            return array();
        }
    } else {
        $usershtml = array();
        foreach ($useridhandles as $useridhandle) {
            if (isset($useridhandle['userid']) && $useridhandle['handle']) {
                $usershtml[$useridhandle['userid']] = qa_get_one_user_html($useridhandle['handle'], $microformats);
            }
            if (isset($useridhandle['lastuserid']) && $useridhandle['lasthandle']) {
                $usershtml[$useridhandle['lastuserid']] = qa_get_one_user_html($useridhandle['lasthandle'], $microformats);
            }
        }
        return $usershtml;
    }
}
Beispiel #2
0
function qa_userids_handles_html($useridhandles, $microformats = false)
{
    require_once QA_INCLUDE_DIR . 'app/users.php';
    if (QA_FINAL_EXTERNAL_USERS) {
        $keyuserids = array();
        foreach ($useridhandles as $useridhandle) {
            if (isset($useridhandle['userid'])) {
                $keyuserids[$useridhandle['userid']] = true;
            }
            if (isset($useridhandle['lastuserid'])) {
                $keyuserids[$useridhandle['lastuserid']] = true;
            }
        }
        if (count($keyuserids)) {
            return qa_get_users_html(array_keys($keyuserids), true, qa_path_to_root(), $microformats);
        } else {
            return array();
        }
    } else {
        $usershtml = array();
        $favoritemap = qa_get_favorite_non_qs_map();
        foreach ($useridhandles as $useridhandle) {
            if (isset($useridhandle['userid'])) {
                $usershtml[$useridhandle['userid']] = qa_get_one_user_html($useridhandle['handle'], $microformats, @$favoritemap['user'][$useridhandle['userid']]);
            }
            if (isset($useridhandle['lastuserid'])) {
                $usershtml[$useridhandle['lastuserid']] = qa_get_one_user_html($useridhandle['lasthandle'], $microformats, @$favoritemap['user'][$useridhandle['lastuserid']]);
            }
        }
        return $usershtml;
    }
}
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-updates.php';
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
$handle = qa_request_part(1);
if (!strlen($handle)) {
    qa_redirect('users');
}
//	Get the HTML to display for the handle, and if we're using external users, determine the userid
if (QA_FINAL_EXTERNAL_USERS) {
    $publictouserid = qa_get_userids_from_public(array($handle));
    if (!count($publictouserid)) {
        return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
    }
    $userid = reset($publictouserid);
    // don't use $publictouserid[$handle] since $handle capitalization might be different
    $usershtml = qa_get_users_html(array($userid), false, qa_path_to_root(), true);
    $userhtml = @$usershtml[$userid];
} else {
    $userhtml = qa_html($handle);
}
//	Find the user profile and questions and answers for this handle
$loginuserid = qa_get_logged_in_userid();
$identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
@(list($useraccount, $userprofile, $userfields, $userpoints, $userrank, $questions, $answerqs, $commentqs, $editqs, $favorite) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_profile_selectspec($handle, false), QA_FINAL_EXTERNAL_USERS ? null : qa_db_userfields_selectspec(), qa_db_user_points_selectspec($identifier), qa_db_user_rank_selectspec($identifier), qa_db_user_recent_qs_selectspec($loginuserid, $identifier, qa_opt_if_loaded('page_size_user_posts')), qa_db_user_recent_a_qs_selectspec($loginuserid, $identifier), qa_db_user_recent_c_qs_selectspec($loginuserid, $identifier), qa_db_user_recent_edit_qs_selectspec($loginuserid, $identifier), isset($loginuserid) && !QA_FINAL_EXTERNAL_USERS ? qa_db_is_favorite_selectspec($loginuserid, QA_ENTITY_USER, $handle) : null));
//	Check the user exists and work out what can and can't be set (if not using single sign-on)
$loginlevel = qa_get_logged_in_level();
if (!QA_FINAL_EXTERNAL_USERS) {
    // if we're using integrated user management, we can know and show more
    if (!is_array($userpoints) && !is_array($useraccount)) {
        return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
    }
}
// report that we entered this page
qa_report_event('page_enter', qa_get_logged_in_userid(), qa_get_logged_in_handle(), qa_cookie_get(), array('params' => $_SERVER['QUERY_STRING'], 'path' => $_SERVER['SCRIPT_NAME']));
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
if (!strlen(@$pass_subrequests[0])) {
    qa_redirect('users');
}
if (QA_FINAL_EXTERNAL_USERS) {
    $publictouserid = qa_get_userids_from_public(array(@$pass_subrequests[0]));
    $userid = @$publictouserid[@$pass_subrequests[0]];
    if (!isset($userid)) {
        return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
    }
    $usershtml = qa_get_users_html(array($userid), false, $qa_root_url_relative, true);
    $userhtml = @$usershtml[$userid];
} else {
    $handle = @$pass_subrequests[0];
    // picked up from qa-page.php
    $userhtml = qa_html($handle);
}
//	Find the user profile and questions and answers for this handle
$identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
@(list($useraccount, $userprofile, $userfields, $userpoints, $userrank, $questions, $answerquestions, $commentquestions) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_profile_selectspec($handle, false), QA_FINAL_EXTERNAL_USERS ? null : qa_db_userfields_selectspec(), qa_db_user_points_selectspec($identifier), qa_db_user_rank_selectspec($identifier), qa_db_user_recent_qs_selectspec($qa_login_userid, $identifier), qa_db_user_recent_a_qs_selectspec($qa_login_userid, $identifier), qa_db_user_recent_c_qs_selectspec($qa_login_userid, $identifier)));
//	Check the user exists and work out what can and can't be set (if not using single sign-on)
if (!QA_FINAL_EXTERNAL_USERS) {
    // if we're using integrated user management, we can know and show more
    if (!is_array($userpoints) && !is_array($useraccount)) {
        return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
    }