Ejemplo n.º 1
0
function qa_page_queue_pending()
{
    if (qa_to_override(__FUNCTION__)) {
        $args = func_get_args();
        return qa_call_override(__FUNCTION__, $args);
    }
    qa_preload_options();
    $loginuserid = qa_get_logged_in_userid();
    if (isset($loginuserid)) {
        if (!QA_FINAL_EXTERNAL_USERS) {
            qa_db_queue_pending_select('loggedinuser', qa_db_user_account_selectspec($loginuserid, true));
        }
        qa_db_queue_pending_select('notices', qa_db_user_notices_selectspec($loginuserid));
        qa_db_queue_pending_select('favoritenonqs', qa_db_user_favorite_non_qs_selectspec($loginuserid));
        qa_db_queue_pending_select('userlimits', qa_db_user_limits_selectspec($loginuserid));
        qa_db_queue_pending_select('userlevels', qa_db_user_levels_selectspec($loginuserid, true));
    }
    qa_db_queue_pending_select('iplimits', qa_db_ip_limits_selectspec(qa_remote_ip_address()));
    qa_db_queue_pending_select('navpages', qa_db_pages_selectspec(array('B', 'M', 'O', 'F')));
    qa_db_queue_pending_select('widgets', qa_db_widgets_selectspec());
}
Ejemplo n.º 2
0
function qa_get_logged_in_levels()
{
    require_once QA_INCLUDE_DIR . 'db/selects.php';
    return qa_db_get_pending_result('userlevels', qa_db_user_levels_selectspec(qa_get_logged_in_userid(), true));
}
                         $inlevel = qa_post_text('uc_' . $index . '_level');
                         if (!isset($inlevel)) {
                             break;
                         }
                         $categoryid = qa_get_category_field_value('uc_' . $index . '_cat');
                         if (strlen($categoryid) && strlen($inlevel)) {
                             $inuserlevels[] = array('entitytype' => QA_ENTITY_CATEGORY, 'entityid' => $categoryid, 'level' => min($maxlevelassign, (int) $inlevel));
                         }
                     }
                     qa_db_user_levels_set($userid, $inuserlevels);
                 }
             }
             if (empty($errors)) {
                 qa_redirect(qa_request());
             }
             list($useraccount, $userprofile, $userlevels) = qa_db_select_with_pending(qa_db_user_account_selectspec($userid, true), qa_db_user_profile_selectspec($userid, true), qa_db_user_levels_selectspec($userid, true, true));
         }
     }
 }
 if (qa_clicked('doapprove') || qa_clicked('doblock') || qa_clicked('dounblock') || qa_clicked('dohideall') || qa_clicked('dodelete')) {
     if (!qa_check_form_security_code('user-' . $handle, qa_post_text('code'))) {
         $errors['page'] = qa_lang_html('misc/form_security_again');
     } else {
         if ($approvebutton && qa_clicked('doapprove')) {
             require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php';
             qa_set_user_level($userid, $useraccount['handle'], QA_USER_LEVEL_APPROVED, $useraccount['level']);
             qa_redirect(qa_request());
         }
         if (isset($maxlevelassign) && $maxuserlevel < QA_USER_LEVEL_MODERATOR) {
             if (qa_clicked('doblock')) {
                 require_once QA_INCLUDE_DIR . 'qa-app-users-edit.php';
Ejemplo n.º 4
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();
 }