function check_privileges($userid, $event_points)
 {
     $user = qa_db_select_with_pending(qa_db_user_points_selectspec($userid, true));
     $upoints = (int) $user['points'];
     $before_points = (int) $user['points'] - $event_points;
     $permr = qa_db_read_one_value(qa_db_query_sub('SELECT meta_value FROM ^usermeta WHERE user_id=# AND meta_key=$ ', $userid, 'priv_notify'), true);
     // stale perms
     $stale = array();
     if ($permr) {
         $perms = explode('^', $permr);
         $stale = explode(',', $perms[0]);
     }
     $p_options = qa_get_permit_options();
     $notices = '';
     foreach ($p_options as $option) {
         if (qa_opt($option) == QA_PERMIT_POINTS) {
             $opoints = (int) qa_opt($option . '_points');
             if ($opoints < $upoints && $opoints > $before_points && !in_array($option, $stale)) {
                 $notices = ($notices ? $notices . ',' : '') . $option;
             }
         }
     }
     if ($notices) {
         qa_db_query_sub('INSERT INTO ^usermeta (user_id,meta_key,meta_value) VALUES (#,$,$) ON DUPLICATE KEY UPDATE meta_value=$', $userid, 'priv_notify', '^' . $notices, $permr . ($perms[1] ? ',' : '') . $notices);
         if (qa_opt('priv_email_notify_on')) {
             $this->notify($userid, $notices);
         }
     }
 }
예제 #2
0
 function qa_get_logged_in_points()
 {
     global $qa_cached_logged_in_points;
     if (!isset($qa_cached_logged_in_points)) {
         $qa_cached_logged_in_points = qa_db_select_with_pending(qa_db_user_points_selectspec(qa_get_logged_in_userid(), true));
     }
     return $qa_cached_logged_in_points['points'];
 }
예제 #3
0
 function qa_get_logged_in_points()
 {
     global $qa_cached_logged_in_points;
     if (!isset($qa_cached_logged_in_points)) {
         require_once QA_INCLUDE_DIR . 'db/selects.php';
         $qa_cached_logged_in_points = qa_db_select_with_pending(qa_db_user_points_selectspec(qa_get_logged_in_userid(), true));
     }
     return $qa_cached_logged_in_points['points'];
 }
예제 #4
0
function cs_user_data($handle)
{
    $userid = qa_handle_to_userid($handle);
    $identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
    if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
        $u = qa_db_select_with_pending(qa_db_user_rank_selectspec($handle), qa_db_user_points_selectspec($identifier));
        $user = array();
        $user[]['points'] = $u[1]['points'];
        unset($u[1]['points']);
        $user[] = 0;
        $user[] = $u[1];
    } else {
        $user[0] = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true));
        $user[1]['rank'] = qa_db_select_with_pending(qa_db_user_rank_selectspec($handle));
        $user[2] = qa_db_select_with_pending(qa_db_user_points_selectspec($identifier));
        $user = $user[0] + $user[1] + $user[2];
    }
    return $user;
}
예제 #5
0
}
require_once QA_INCLUDE_DIR . 'qa-db-users.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-users.php';
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-util-image.php';
//	Check we're not using single-sign on integration, that we're logged in
if (QA_FINAL_EXTERNAL_USERS) {
    qa_fatal_error('User accounts are handled by external code');
}
$userid = qa_get_logged_in_userid();
if (!isset($userid)) {
    qa_redirect('login');
}
//	Get current information on user
list($useraccount, $userprofile, $userpoints, $userfields) = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true), qa_db_user_profile_selectspec($userid, true), qa_db_user_points_selectspec($userid, true), qa_db_userfields_selectspec());
$changehandle = qa_opt('allow_change_usernames') || !$userpoints['qposts'] && !$userpoints['aposts'] && !$userpoints['cposts'];
$doconfirms = qa_opt('confirm_user_emails') && $useraccount['level'] < QA_USER_LEVEL_EXPERT;
$isconfirmed = $useraccount['flags'] & QA_USER_FLAGS_EMAIL_CONFIRMED ? true : false;
$haspassword = isset($useraccount['passsalt']) && isset($useraccount['passcheck']);
$isblocked = qa_user_permit_error() ? true : false;
//	Process profile if saved
if (qa_clicked('dosaveprofile') && !$isblocked) {
    require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php';
    $inhandle = $changehandle ? qa_post_text('handle') : $useraccount['handle'];
    $inemail = qa_post_text('email');
    $inmessages = qa_post_text('messages');
    $inwallposts = qa_post_text('wall');
    $inmailings = qa_post_text('mailings');
    $inavatar = qa_post_text('avatar');
    $inprofile = array();
예제 #6
0
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';
    }
    $userid = $useraccount['userid'];
    $fieldseditable = false;
    $maxlevelassign = null;
    if ($loginuserid && $loginuserid != $userid && ($loginlevel >= QA_USER_LEVEL_SUPER || $loginlevel > $useraccount['level']) && !qa_user_permit_error()) {
        // can't change self - or someone on your level (or higher, obviously) unless you're a super admin
        if ($loginlevel >= QA_USER_LEVEL_SUPER) {
            $maxlevelassign = QA_USER_LEVEL_SUPER;
        } elseif ($loginlevel >= QA_USER_LEVEL_ADMIN) {
    header('Location: ../');
    exit;
}
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-limits.php';
require_once QA_INCLUDE_DIR . 'qa-app-updates.php';
//	$handle, $userhtml are already set by qa-page-user.php - also $userid if using external user integration
//	Redirect to 'My Account' page if button clicked
if (qa_clicked('doaccount')) {
    qa_redirect('account');
}
//	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, $usermessages, $userpoints, $userlevels, $navcategories, $userrank) = 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_FINAL_EXTERNAL_USERS ? null : qa_db_recent_messages_selectspec(null, null, $handle, false, qa_opt_if_loaded('page_size_wall')), qa_db_user_points_selectspec($identifier), qa_db_user_levels_selectspec($identifier, QA_FINAL_EXTERNAL_USERS, true), qa_db_category_nav_selectspec(null, true), qa_db_user_rank_selectspec($identifier));
if (!QA_FINAL_EXTERNAL_USERS) {
    foreach ($userfields as $index => $userfield) {
        if (isset($userfield['permit']) && qa_permit_value_error($userfield['permit'], $loginuserid, qa_get_logged_in_level(), qa_get_logged_in_flags())) {
            unset($userfields[$index]);
        }
    }
}
// don't pay attention to user fields we're not allowed to view
//	Check the user exists and work out what can and can't be set (if not using single sign-on)
$errors = array();
$loginlevel = qa_get_logged_in_level();
if (!QA_FINAL_EXTERNAL_USERS) {
    // if we're using integrated user management, we can know and show more
    require_once QA_INCLUDE_DIR . 'qa-app-messages.php';
    if (!is_array($userpoints) && !is_array($useraccount)) {
예제 #8
0
function ra_user_points($handle)
{
    $userid = qa_handle_to_userid($handle);
    $db = qa_db_select_with_pending(qa_db_user_points_selectspec($userid, true));
    return strlen($db['points']) ? $db['points'] : '0';
}
예제 #9
0
	More about this license: http://www.question2answer.org/license.php
*/
if (!defined('QA_VERSION')) {
    // don't allow this page to be requested directly from browser
    header('Location: ../');
    exit;
}
require_once QA_INCLUDE_DIR . 'db/selects.php';
require_once QA_INCLUDE_DIR . 'app/format.php';
//	$handle, $userhtml are already set by qa-page-user.php - also $userid if using external user integration
$start = qa_get_start();
//	Find the questions for this user
$loginuserid = qa_get_logged_in_userid();
$identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
list($useraccount, $userpoints, $questions) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), qa_db_user_points_selectspec($identifier), qa_db_user_recent_a_qs_selectspec($loginuserid, $identifier, qa_opt_if_loaded('page_size_activity'), $start));
if (!QA_FINAL_EXTERNAL_USERS && !is_array($useraccount)) {
    // check the user exists
    return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
}
//	Get information on user questions
$pagesize = qa_opt('page_size_activity');
$count = (int) @$userpoints['aposts'];
$questions = array_slice($questions, 0, $pagesize);
$usershtml = qa_userids_handles_html($questions, false);
//	Prepare content for theme
$qa_content = qa_content_prepare(true);
if (count($questions)) {
    $qa_content['title'] = qa_lang_html_sub('profile/answers_by_x', $userhtml);
} else {
    $qa_content['title'] = qa_lang_html_sub('profile/no_answers_by_x', $userhtml);
예제 #10
0
 function user_priv_form()
 {
     // displays badge list in user profile
     global $qa_request;
     $handle = preg_replace('/^[^\\/]+\\/([^\\/]+).*/', "\$1", $qa_request);
     $userid = $this->priv_getuserfromhandle($handle);
     if (!$userid) {
         return;
     }
     $options = qa_get_permit_options();
     $user = qa_db_select_with_pending(qa_db_user_points_selectspec($userid, true));
     $upoints = (int) $user['points'];
     foreach ($options as $option) {
         if (qa_opt($option) == QA_PERMIT_POINTS) {
             $opoints = (int) qa_opt($option . '_points');
             $popts[$option] = $opoints;
         }
     }
     if (!isset($popts)) {
         return;
     }
     arsort($popts);
     $fields = array();
     foreach ($popts as $key => $val) {
         if ($upoints > $val) {
             $ppoints = 100;
         } else {
             $ppoints = round($upoints / $val * 100);
         }
         // shading
         if (qa_opt('priv_shading') == 0) {
             if ($ppoints <= 50) {
                 $col = round($ppoints / 50 * 255);
                 $col = dechex($col);
                 if (strlen($col) == 1) {
                     $col = '0' . $col;
                 }
                 $col = '#' . 'FF' . $col . '00';
             } else {
                 $col = round(($ppoints - 50) / 50 * 255) * -1 + 255;
                 $col = dechex($col);
                 if (strlen($col) == 1) {
                     $col = '0' . $col;
                 }
                 $col = '#' . $col . 'FF' . '00';
             }
         } else {
             $col = (255 - round($ppoints / 100 * 255)) * 3 / 4;
             $col = dechex($col);
             if (strlen($col) == 1) {
                 $col = '0' . $col;
             }
             $col = '#' . $col . $col . $col;
         }
         // hover text
         if ($ppoints == 100) {
             $hover = str_replace('#', $val, qa_opt('priv_hover_earned'));
         } else {
             $hover = str_replace('#', $val, qa_opt('priv_hover'));
             $hover = str_replace('%', $ppoints, $hover);
         }
         // fudge
         if ($key == 'permit_retag_cat') {
             $name = qa_lang_html(qa_using_categories() ? 'profile/permit_recat' : 'profile/permit_retag');
         } else {
             $name = qa_lang('profile/' . $key);
         }
         if ($name == '[profile/' . $key . ']') {
             global $qa_lang_file_pattern;
             foreach ($qa_lang_file_pattern as $k => $v) {
                 if (qa_lang($k . '/' . $key) != '[' . $k . '/' . $key . ']') {
                     $name = qa_lang($k . '/' . $key);
                     break;
                 }
             }
         }
         $text[] = ($ppoints == 100 ? '<b ' : '<font ') . 'title="' . $hover . '" style="color:' . $col . '; cursor:pointer">' . $name . '</td><td class="qa-form-tall-label">' . ($ppoints == 100 ? '<b ' : '<font ') . 'title="' . $hover . '" style="color:' . $col . '; cursor:pointer">' . $ppoints . '%';
     }
     $fields[] = array('label' => implode('</td></tr><tr class="priv-row"><td class="qa-form-tall-label">', $text), 'type' => 'static');
     $ok = null;
     $tags = null;
     $buttons = array();
     return array('ok' => $ok && !isset($error) ? $ok : null, 'style' => 'tall', 'tags' => $tags, 'title' => qa_opt('priv_title'), 'fields' => $fields, 'buttons' => $buttons);
 }
예제 #11
0
 function donut_get_user_data($handle)
 {
     $userid = qa_handle_to_userid($handle);
     $identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
     $user = array();
     if (defined('QA_WORDPRESS_INTEGRATE_PATH')) {
         $u_rank = qa_db_select_with_pending(qa_db_user_rank_selectspec($userid, true));
         $u_points = qa_db_select_with_pending(qa_db_user_points_selectspec($userid, true));
         $userinfo = array();
         $user_info = get_userdata($userid);
         $userinfo['userid'] = $userid;
         $userinfo['handle'] = $handle;
         $userinfo['email'] = $user_info->user_email;
         $user[0] = $userinfo;
         $user[1]['rank'] = $u_rank;
         $user[2] = $u_points;
         $user = $user[0] + $user[1] + $user[2];
     } else {
         $user['account'] = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true));
         $user['rank'] = qa_db_select_with_pending(qa_db_user_rank_selectspec($handle));
         $user['points'] = qa_db_select_with_pending(qa_db_user_points_selectspec($identifier));
         $user['followers'] = qa_db_read_one_value(qa_db_query_sub('SELECT count(*) FROM ^userfavorites WHERE ^userfavorites.entityid = # and ^userfavorites.entitytype = "U" ', $userid), true);
         $user['following'] = qa_db_read_one_value(qa_db_query_sub('SELECT count(*) FROM ^userfavorites WHERE ^userfavorites.userid = # and ^userfavorites.entitytype = "U" ', $userid), true);
     }
     return $user;
 }
예제 #12
0
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';
    }
    $userid = $useraccount['userid'];
    $loginlevel = qa_get_logged_in_level();
    $fieldseditable = false;
    $maxlevelassign = null;
    if ($qa_login_userid && $qa_login_userid != $userid && ($loginlevel >= QA_USER_LEVEL_SUPER || $loginlevel > $useraccount['level']) && !qa_user_permit_error()) {
        // can't change self - or someone on your level (or higher, obviously) unless you're a super admin
        if ($loginlevel >= QA_USER_LEVEL_SUPER) {
            $maxlevelassign = QA_USER_LEVEL_SUPER;
        } elseif ($loginlevel >= QA_USER_LEVEL_ADMIN) {
예제 #13
0
 function doctype()
 {
     if (strpos($this->request, 'user/') !== false && strpos($this->request, 'articles') !== false) {
         $this->request = 'user-articles';
     }
     /*
     	ADAPT USER PAGES AND SUBPAGES
     */
     if ($this->template == 'user' || $this->template == 'user-wall' || $this->template == 'user-activity' || $this->template == 'user-questions' || $this->template == 'user-answers' || $this->request == 'user-articles') {
         $handle = qa_request_part(1);
         if (!strlen($handle)) {
             $handle = qa_get_logged_in_handle();
             qa_redirect(isset($handle) ? 'user/' . $handle : 'users');
         }
         $identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle;
         list($useraccount, $userprofile, $userfields, $usermessages, $userpoints, $userlevels, $navcategories, $userrank) = 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_FINAL_EXTERNAL_USERS ? null : qa_db_recent_messages_selectspec(null, null, $handle, false, qa_opt_if_loaded('page_size_wall')), qa_db_user_points_selectspec($identifier), qa_db_user_levels_selectspec($identifier, QA_FINAL_EXTERNAL_USERS, true), qa_db_category_nav_selectspec(null, true), qa_db_user_rank_selectspec($identifier));
         $userid = $useraccount['userid'];
         $loginuserid = qa_get_logged_in_userid();
         if ($this->template == 'user') {
             // ADAPT FORM CONTENTS
             /*$this->content['form_activity']['fields']['activity'] = array('type'=>'static', 
             		'label'=>'Recent Activity',
             		'value'=>'<a href="'.$handle.'/activity">show</a>');*/
             // ADD PRIVATE MESSAGE LINK AFTER MEMBERSHIP DURATION
             if (qa_opt('allow_private_messages') && isset($loginuserid) && $loginuserid != $userid && !($useraccount['flags'] & QA_USER_FLAGS_NO_MESSAGES)) {
                 $this->content['form_profile']['fields']['duration']['value'] .= strtr(qa_lang_html('profile/send_private_message'), array('^1' => '<a href="' . qa_path_html('message/' . $handle) . '">', '^2' => '</a>'));
             }
         }
         $site_url = qa_opt('site_url');
         // RENEW THE SUB-NAVIGATION
         unset($this->content['navigation']['sub']);
         $this->content['navigation']['sub']['account'] = array('label' => 'User ' . $handle, 'url' => $site_url . '/user/' . $handle, 'selected' => $this->template == 'user' ? 1 : 0);
         $this->content['navigation']['sub']['wall'] = array('label' => $handle . '\'s Wall', 'url' => $site_url . '/user/' . $handle . '/wall', 'selected' => $this->template == 'user-wall' ? 1 : 0);
         $this->content['navigation']['sub']['activity'] = array('label' => qa_lang('qa_blog_lang/nav_activity'), 'url' => $site_url . '/user/' . $handle . '/activity', 'selected' => $this->template == 'user-activity' ? 1 : 0);
         $this->content['navigation']['sub']['questions'] = array('label' => qa_lang('qa_blog_lang/nav_questions'), 'url' => $site_url . '/user/' . $handle . '/questions', 'selected' => $this->template == 'user-questions' ? 1 : 0);
         $this->content['navigation']['sub']['answers'] = array('label' => qa_lang('qa_blog_lang/nav_answers'), 'url' => $site_url . '/user/' . $handle . '/answers', 'selected' => $this->template == 'user-answers' ? 1 : 0);
         $this->content['navigation']['sub']['articles'] = array('label' => qa_lang('qa_blog_lang/nav_articles'), 'url' => $site_url . '/user/' . $handle . '/articles', 'selected' => $this->request == 'user-articles' ? 1 : 0);
         $this->content['navigation']['sub']['newarticles'] = array('label' => qa_lang('qa_blog_lang/new_articles'), 'url' => $site_url . '/articles', 'selected' => $this->request == 'articles' ? 1 : 0);
         if ($this->request == 'user-articles') {
             unset($this->content['title']);
             $this->content['title'] = qa_lang('qa_blog_lang/title_recent') . " {$handle}";
             unset($this->content['suggest_next']);
             unset($this->content['error']);
             if ($this->request == 'user-articles') {
                 $qa_content['custom'] = "";
                 $html = "";
                 $result = qa_db_query_sub("SELECT * FROM ^blog_posts WHERE userid =  '{$userid}' ORDER BY posted DESC");
                 $i = 0;
                 while ($article = mysqli_fetch_array($result)) {
                     $i++;
                     $html .= article_item($article['title'], $site_url . '/blog/' . $article['postid'] . '/' . seoUrl2($article['title']) . '/', $article['posted'], $article['views']);
                 }
                 if ($i == 0) {
                     $html = "<h3>" . qa_lang('qa_blog_lang/oops') . " {$handle} " . qa_lang('qa_blog_lang/no_post') . "</h3>";
                 }
                 $this->content['custom'] = $html;
             }
         }
     } else {
         if ($this->template == 'account' || $this->template == 'favorites' || $this->template == 'updates' || $this->request == 'gallery' || $this->request == 'articles') {
             // ADAPT FORM FOR DETAILS SUBPAGE
             // RENEW THE SUB-NAVIGATION
             unset($this->content['navigation']['sub']);
             $this->content['navigation']['sub']['account'] = array('label' => 'My Details', 'url' => './account', 'selected' => $this->template == 'account' ? 1 : 0);
             $this->content['navigation']['sub']['favorites'] = array('label' => 'My Favorites', 'url' => './favorites', 'selected' => $this->template == 'favorites' ? 1 : 0);
             $this->content['navigation']['sub']['updates'] = array('label' => 'My Updates', 'url' => './updates', 'selected' => $this->template == 'updates' ? 1 : 0);
             $this->content['navigation']['sub']['articles'] = array('label' => 'My Articles', 'url' => './articles', 'selected' => $this->request == 'articles' ? 1 : 0);
         } else {
             if ($this->template == 'users') {
                 require_once QA_INCLUDE_DIR . 'qa-db-users.php';
                 require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
                 require_once QA_INCLUDE_DIR . 'qa-app-format.php';
                 $start = qa_get_start();
                 $users = qa_db_select_with_pending(qa_db_top_users_selectspec($start, qa_opt_if_loaded('page_size_users')));
                 $usercount = qa_opt('cache_userpointscount');
                 $pagesize = qa_opt('page_size_users');
                 $users = array_slice($users, 0, $pagesize);
                 $usershtml = qa_userids_handles_html($users);
                 // CHANGE TITLE
                 $this->content['title'] = 'Users';
                 $this->content['ranking'] = array('items' => array(), 'rows' => ceil($pagesize / qa_opt('columns_users')), 'type' => 'users');
                 if (count($users)) {
                     foreach ($users as $userid => $user) {
                         $this->content['ranking']['items'][] = array('label' => (QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html($user['userid'], qa_opt('avatar_users_size'), true) : qa_get_user_avatar_html($user['flags'], $user['email'], $user['handle'], $user['avatarblobid'], $user['avatarwidth'], $user['avatarheight'], qa_opt('avatar_users_size'), true)) . ' ' . $usershtml[$user['userid']], 'score' => qa_html(number_format($user['points'])));
                     }
                 } else {
                     $this->content['title'] = qa_lang_html('main/no_active_users');
                 }
                 $this->content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $usercount, qa_opt('pages_prev_next'));
                 // EMPTY SUB-NAVIGATION
                 $this->content['navigation']['sub'] = null;
             }
         }
     }
     if ($this->template == 'questions') {
         unset($this->content['navigation']['sub']);
         $this->content['navigation']['sub']['account'] = array('label' => 'My Details', 'url' => './account', 'selected' => 0);
         //print_r ($this->content['navigation']);
     }
     if ($this->request == 'login') {
         $this->content['form']['fields']['password']['note'] = '<a href="/forgot">I forgot my password</a> - <a href="/register">Register</a>';
     }
     qa_html_theme_base::doctype();
 }