function qa_db_open_qs_selectspec($voteuserid, $start) { $pagesize = qa_opt_if_loaded('page_size_una_qs'); $where_clause_question_open = 'acount=0 AND closedbyid IS NULL'; $type = 'Q'; // question (not hidden) $selectspec = qa_db_posts_basic_selectspec($voteuserid, false); $selectspec['source'] .= " JOIN (SELECT postid FROM ^posts WHERE " . "type=\$ AND " . $where_clause_question_open . " ORDER BY ^posts.created DESC LIMIT #,#)" . " y ON ^posts.postid=y.postid"; array_push($selectspec['arguments'], $type, $start, $pagesize); $selectspec['sortdesc'] = 'created'; return $selectspec; }
public function process_request($request) { $requestparts = explode('/', qa_request()); $slugs = array_slice($requestparts, 1); $countslugs = count($slugs); $userid = qa_get_logged_in_userid(); $start = qa_get_start(); $count = qa_opt_if_loaded('page_size_activity'); $totalcount = qa_opt('cache_qcount'); $qspec = qa_db_posts_basic_selectspec($userid, false); qa_db_add_selectspec_opost($qspec, 'ra', false, false); qa_db_add_selectspec_ousers($qspec, 'rau', 'raup'); $qspec['source'] .= " JOIN (SELECT questionid, childid FROM ^homepage ORDER BY ^homepage.updated DESC) AS rcaq ON ^posts.postid=rcaq.questionid" . " LEFT JOIN ^posts AS ra ON childid=ra.postid" . (QA_FINAL_EXTERNAL_USERS ? "" : " LEFT JOIN ^users AS rau ON ra.userid=rau.userid") . " LEFT JOIN ^userpoints AS raup ON ra.userid=raup.userid LIMIT #,#"; array_push($qspec['columns'], 'childid'); array_push($qspec['arguments'], $start, $count); $qspec['sortdesc'] = 'otime'; $query = 'SELECT '; foreach ($qspec['columns'] as $columnas => $columnfrom) { $query .= $columnfrom . (is_int($columnas) ? '' : ' AS ' . $columnas) . ', '; } $query = qa_db_apply_sub(substr($query, 0, -2) . (strlen(@$qspec['source']) ? ' FROM ' . $qspec['source'] : ''), @$qspec['arguments']); $results = qa_db_read_all_assoc(qa_db_query_raw($query)); qa_db_post_select($results, $qspec); list($categories, $categoryid) = qa_db_select_with_pending(qa_db_category_nav_selectspec($slugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null); $questions = qa_any_sort_and_dedupe($results); // $questions=qa_any_sort_and_dedupe(array_merge($recentquestions,$recentanswers)); $pagesize = qa_opt('page_size_home'); if ($countslugs) { if (!isset($categoryid)) { return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } $categorytitlehtml = qa_html($categories[$categoryid]['title']); $sometitle = qa_lang_html_sub('main/recent_qs_as_in_x', $categorytitlehtml); $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml); } else { $sometitle = qa_lang_html('main/recent_qs_as_title'); $nonetitle = qa_lang_html('main/no_questions_found'); } require_once QA_INCLUDE_DIR . 'qa-app-q-list.php'; $qa_content = qa_q_list_page_content($questions, $pagesize, $start, $totalcount, $sometitle, $nonetitle, $categories, $categoryid, true, qa_opt('eql_homepage_url'), qa_opt('feed_for_qa') ? qa_opt('eql_homepage_url') : null, count($questions) < $pagesize ? qa_html_suggest_ask($categoryid) : qa_html_suggest_qs_tags(qa_using_tags(), qa_category_path_request($categories, $categoryid)), null, null); return $qa_content; }
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) {
*/ 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/messages.php'; // Check we're not using single-sign on integration, which doesn't allow walls if (QA_FINAL_EXTERNAL_USERS) { qa_fatal_error('User accounts are handled by external code'); } // $handle, $userhtml are already set by qa-page-user.php $start = qa_get_start(); // Find the questions for this user list($useraccount, $usermessages) = qa_db_select_with_pending(qa_db_user_account_selectspec($handle, false), qa_db_recent_messages_selectspec(null, null, $handle, false, qa_opt_if_loaded('page_size_wall'), $start)); if (!is_array($useraccount)) { // check the user exists return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } // Perform pagination $pagesize = qa_opt('page_size_wall'); $count = $useraccount['wallposts']; $loginuserid = qa_get_logged_in_userid(); $usermessages = array_slice($usermessages, 0, $pagesize); $usermessages = qa_wall_posts_add_rules($usermessages, $start); // Process deleting or adding a wall post (similar but not identical code to qq-page-user-profile.php) $errors = array(); $wallposterrorhtml = qa_wall_error_html($loginuserid, $useraccount['userid'], $useraccount['flags']); foreach ($usermessages as $message) { if ($message['deleteable'] && qa_clicked('m' . $message['messageid'] . '_dodelete')) {
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)) {
GNU General Public License for more details. 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 . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; // $handle, $userhtml are already set by qa-page-user.php - also $userid if using external user integration // Find the recent activity for this user $loginuserid = qa_get_logged_in_userid(); $identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle; list($useraccount, $questions, $answerqs, $commentqs, $editqs) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), qa_db_user_recent_qs_selectspec($loginuserid, $identifier, qa_opt_if_loaded('page_size_activity')), 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)); 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 references $questions = qa_any_sort_and_dedupe(array_merge($questions, $answerqs, $commentqs, $editqs)); $questions = array_slice($questions, 0, qa_opt('page_size_activity')); $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions), false); // Prepare content for theme $qa_content = qa_content_prepare(true); if (count($questions)) { $qa_content['title'] = qa_lang_html_sub('profile/recent_activity_by_x', $userhtml); } else { $qa_content['title'] = qa_lang_html_sub('profile/no_posts_by_x', $userhtml); }
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(); }
*/ if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser header('Location: ../'); exit; } require_once QA_INCLUDE_DIR . 'qa-app-format.php'; require_once QA_INCLUDE_DIR . 'qa-app-options.php'; require_once QA_INCLUDE_DIR . 'qa-app-search.php'; // Perform the search if appropriate if (strlen(qa_get('q'))) { // Pull in input parameters $inquery = trim(qa_get('q')); $userid = qa_get_logged_in_userid(); $start = qa_get_start(); $display = qa_opt_if_loaded('page_size_search'); $count = 2 * (isset($display) ? $display : QA_DB_RETRIEVE_QS_AS) + 1; // get enough results to be able to give some idea of how many pages of search results there are // Perform the search using appropriate module $results = qa_get_search_results($inquery, $start, $count, $userid, false, false); // Count and truncate results $pagesize = qa_opt('page_size_search'); $gotcount = count($results); $results = array_slice($results, 0, $pagesize); // Retrieve extra information on users $fullquestions = array(); foreach ($results as $result) { if (isset($result['question'])) { $fullquestions[] = $result['question']; } }
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'; require_once QA_INCLUDE_DIR . 'app/q-list.php'; $categoryslugs = qa_request_parts(1); $countslugs = count($categoryslugs); $userid = qa_get_logged_in_userid(); // Get lists of recent activity in all its forms, plus category information list($questions1, $questions2, $questions3, $questions4, $categories, $categoryid) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, $categoryslugs, null, false, false, qa_opt_if_loaded('page_size_activity')), qa_db_recent_a_qs_selectspec($userid, 0, $categoryslugs), qa_db_recent_c_qs_selectspec($userid, 0, $categoryslugs), qa_db_recent_edit_qs_selectspec($userid, 0, $categoryslugs), qa_db_category_nav_selectspec($categoryslugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($categoryslugs) : null); if ($countslugs) { if (!isset($categoryid)) { return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } $categorytitlehtml = qa_html($categories[$categoryid]['title']); $sometitle = qa_lang_html_sub('main/recent_activity_in_x', $categorytitlehtml); $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml); } else { $sometitle = qa_lang_html('main/recent_activity_title'); $nonetitle = qa_lang_html('main/no_questions_found'); } // Prepare and return content for theme return qa_q_list_page_content(qa_any_sort_and_dedupe(array_merge($questions1, $questions2, $questions3, $questions4)), qa_opt('page_size_activity'), 0, null, $sometitle, $nonetitle, $categories, $categoryid, true, 'activity/', qa_opt('feed_for_activity') ? 'activity' : null, qa_html_suggest_qs_tags(qa_using_tags(), qa_category_path_request($categories, $categoryid)), null, null); /* Omit PHP closing tag to help avoid accidental output
function get_user_activity($handle) { $userid = qa_handle_to_userid($handle); require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; $loginuserid = qa_get_logged_in_userid(); $identifier = QA_FINAL_EXTERNAL_USERS ? $userid : $handle; list($useraccount, $questions, $answerqs, $commentqs, $editqs) = qa_db_select_with_pending(QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_account_selectspec($handle, false), qa_db_user_recent_qs_selectspec($loginuserid, $identifier, qa_opt_if_loaded('page_size_activity')), 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)); 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 references $questions = qa_any_sort_and_dedupe(array_merge($questions, $answerqs, $commentqs, $editqs)); $questions = array_slice($questions, 0, qa_opt('page_size_activity')); $usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions), false); $htmldefaults = qa_post_html_defaults('Q'); $htmldefaults['whoview'] = false; $htmldefaults['voteview'] = false; $htmldefaults['avatarsize'] = 0; foreach ($questions as $question) { $qa_content[] = qa_any_to_q_html_fields($question, $loginuserid, qa_cookie_get(), $usershtml, null, array('voteview' => false) + qa_post_html_options($question, $htmldefaults)); } $output = '<div class="widget user-activities">'; $output .= '<h3 class="widget-title">' . ra_name($handle) . '\'s ' . _ra_lang('activities') . '</h3>'; $output .= '<ul class="question-list">'; if (isset($qa_content)) { foreach ($qa_content as $qs) { if ($qs['what'] == 'answered') { $icon = 'icon-chat-3 answered'; } elseif ($qs['what'] == 'asked') { $icon = 'icon-question asked'; } elseif ($qs['what'] == 'commented') { $icon = 'icon-chat-2 commented'; } elseif ($qs['what'] == 'edited' || $qs['what'] == 'answer edited') { $icon = 'icon-edit edited'; } elseif ($qs['what'] == 'closed') { $icon = 'icon-error closed'; } elseif ($qs['what'] == 'answer selected') { $icon = 'icon-checked selected'; } elseif ($qs['what'] == 'recategorized') { $icon = 'icon-folder-close recategorized'; } else { $icon = 'icon-pin undefined'; } $output .= '<li class="activity-item">'; $output .= '<div class="type pull-left ' . $icon . '"></div>'; $output .= '<div class="list-right">'; $output .= '<h5 class="when"><a href="' . @$qs['what_url'] . '">' . $qs['what'] . '</a> ' . implode(' ', $qs['when']) . '</h5>'; $output .= '<h5 class="what"><a href="' . $qs['url'] . '">' . $qs['title'] . '</a></h5>'; $output .= '</div>'; $output .= '</li>'; } } else { $output .= '<li>' . _ra_lang('No activity yet.') . '</li>'; } $output .= '</ul>'; $output .= '</div>'; return $output; }
function ranking($ranking) { $class = @$ranking['type'] == 'users' ? 'qa-top-users' : 'qa-top-tags'; $item_count = min($ranking['rows'], count($ranking['items'])); if (@$ranking['type'] == 'users') { if (count($ranking['items'])) { $this->output('<div class="page-users-list clearfix"><div class="row">'); $columns = qa_opt('columns_users'); $pagesize = qa_opt('page_size_users'); $start = qa_get_start(); $users = qa_db_select_with_pending(qa_db_top_users_selectspec($start, qa_opt_if_loaded('page_size_users'))); $users = array_slice($users, 0, $pagesize); $usershtml = qa_userids_handles_html($users); foreach ($ranking['items'] as $user) { $this->output('<div class="user-box col-sm-' . ceil(12 / $columns) . ' col-xs-12">'); $user_raw = !empty($user['raw']) ? $user['raw'] : $user; $handle = @$user_raw['handle']; $handle_html = @$usershtml[$user_raw['userid']]; if (defined('QA_WORDPRESS_INTEGRATE_PATH')) { $level_html = $user['score']; unset($user['score']); } else { if (is_numeric($user['score'])) { $user_level = donut_get_user_level($user_raw['userid']); $level_html = qa_user_level_string($user_level); } else { $level_html = $user['score']; unset($user['score']); } } if (empty($handle_html)) { $handle_html = $user['label']; } $avatar = QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html(@$user_raw['userid'], qa_opt('avatar_users_size'), true) : qa_get_user_avatar_html(@$user_raw['flags'], @$user_raw['email'], @$user_raw['handle'], @$user_raw['avatarblobid'], @$user_raw['avatarwidth'], @$user_raw['avatarheight'], 70, true); if (isset($user['score'])) { $userpoints = $user['score']; $pointshtml = $userpoints === 1 ? qa_lang_html_sub('main/1_point', '1', '1') : qa_lang_html_sub('main/x_points', qa_html($userpoints)); if (!empty($pointshtml)) { $pointshtml = '<p class="score">' . $pointshtml . '</p>'; } } $this->output(' <div class="user-box-inner"> <div class="user-avatar"> ' . $avatar . ' </div> <div class="user-data"> ' . $handle_html . ' <div class="user-level"> ' . $level_html . ' </div> <div class="counts clearfix"> ' . @$pointshtml . ' </div> </div>'); if (qa_opt('badge_active') && function_exists('qa_get_badge_list')) { $this->output('<div class="badge-list">' . donut_user_badge($handle) . '</div>'); } $this->output('</div>'); $this->output('</div>'); } $this->output('</div>'); $this->output('</div>'); } else { $title = isset($this->content['ranking_users']['title']) ? $this->content['ranking_users']['title'] : @$this->content['title']; $this->output(' <div class="no-items"> <div class="alert alert-info"><span class="fa fa-warning"></span> ' . $title . '</div> </div>'); } } elseif (@$ranking['type'] == 'tags') { if (count($ranking['items'])) { $this->output('<div id="tags-list" class="row ' . $class . '">'); $columns = qa_opt('columns_tags'); for ($column = 0; $column < $columns; $column++) { $this->set_context('ranking_column', $column); $this->output('<div class="col-md-' . ceil(12 / $columns) . ' col-xs-12" >'); $this->output('<ul class="donut-tags-list">'); for ($row = 0; $row < $item_count; $row++) { $this->set_context('ranking_row', $row); $this->donut_tags_item(@$ranking['items'][$column * $item_count + $row], $class, $column > 0); } $this->clear_context('ranking_column'); $this->output('</ul>'); $this->output('</div>'); } $this->clear_context('ranking_row'); $this->output('</div>'); } else { $this->output(' <div class="no-items"> <div class="alert alert-info"><span class="fa fa-warning"></span> ' . $this->content['ranking_tags']['title'] . '</div> </div>'); } } else { parent::ranking($ranking); } }
function ranking($ranking) { $class = @$ranking['type'] == 'users' ? 'qa-top-users' : 'qa-top-tags'; $rows = min($ranking['rows'], count($ranking['items'])); if (!$rows) { $rows = 1; } if (@$ranking['type'] == 'users') { $this->output('<div class="page-users-list clearfix"><div class="row">'); if (isset($ranking['items'])) { $columns = ceil(count($ranking['items']) / $rows); } if (isset($ranking['items'])) { $pagesize = qa_opt('page_size_users'); $start = qa_get_start(); $users = qa_db_select_with_pending(qa_db_top_users_selectspec($start, qa_opt_if_loaded('page_size_users'))); $users = array_slice($users, 0, $pagesize); $usershtml = qa_userids_handles_html($users); foreach ($ranking['items'] as $user) { $this->output('<div class="user-box col-sm-' . ceil(12 / $columns) . ' col-xs-12">'); $user_raw = !empty($user['raw']) ? $user['raw'] : $user; $handle = @$user_raw['handle']; $handle_html = @$usershtml[$user_raw['userid']]; if (isset($user_raw['userid'])) { $user_rank = qa_db_select_with_pending(qa_db_user_rank_selectspec($user_raw['userid'], true)); $level_html = qa_user_level_string($user_rank); } else { $level_html = $user['score']; unset($user['score']); } if (empty($handle_html)) { $handle_html = $user['label']; } $avatar = QA_FINAL_EXTERNAL_USERS ? qa_get_external_avatar_html(@$user_raw['userid'], qa_opt('avatar_users_size'), true) : qa_get_user_avatar_html(@$user_raw['flags'], @$user_raw['email'], @$user_raw['handle'], @$user_raw['avatarblobid'], @$user_raw['avatarwidth'], @$user_raw['avatarheight'], 70, true); if (isset($user['score'])) { $userpoints = $user['score']; $pointshtml = $userpoints === 1 ? qa_lang_html_sub('main/1_point', '1', '1') : qa_lang_html_sub('main/x_points', qa_html($userpoints)); if (!empty($pointshtml)) { $pointshtml = '<p class="score">' . $pointshtml . '</p>'; } } $this->output(' <div class="user-box-inner"> <div class="user-avatar"> ' . $avatar . ' </div> <div class="user-data"> ' . $handle_html . ' <div class="user-level"> ' . $level_html . ' </div> <div class="counts clearfix"> ' . @$pointshtml . ' </div> </div>'); if (qa_opt('badge_active') && function_exists('qa_get_badge_list')) { $this->output('<div class="badge-list">' . donut_user_badge($handle) . '</div>'); } $this->output('</div>'); $this->output('</div>'); } } else { $this->output(' <div class="no-items"> <h3 class="">' . qa_lang_html('main/no_active_users') . '</h3> </div>'); } $this->output('</div>'); $this->output('</div>'); } elseif (@$ranking['type'] == 'tags') { if ($rows > 0) { $this->output('<div id="tags-list" class="row ' . $class . '">'); $tags = array(); foreach (@$ranking['items'] as $item) { $tags[] = strip_tags($item['label']); } $columns = ceil(count($ranking['items']) / $rows); for ($column = 0; $column < $columns; $column++) { $this->set_context('ranking_column', $column); $this->output('<div class="col-md-' . ceil(12 / $columns) . ' col-xs-12" >'); $this->output('<ul class="donut-tags-list">'); for ($row = 0; $row < $rows; $row++) { $this->set_context('ranking_row', $row); $this->donut_tags_item(@$ranking['items'][$column * $rows + $row], $class, $column > 0); } $this->clear_context('ranking_column'); $this->output('</ul>'); $this->output('</div>'); } $this->clear_context('ranking_row'); $this->output('</div>'); } else { $this->output(' <div class="no-items"> <h3 class="icon-warning">' . qa_lang('cleanstrap/no_tags') . '</h3> <p>' . qa_lang('cleanstrap/no_results_detail') . '</p> </div>'); } } else { if ($rows > 0) { $this->output('<table class="' . $class . '-table">'); $columns = ceil(count($ranking['items']) / $rows); for ($row = 0; $row < $rows; $row++) { $this->set_context('ranking_row', $row); $this->output('<tr>'); for ($column = 0; $column < $columns; $column++) { $this->set_context('ranking_column', $column); $this->ranking_item(@$ranking['items'][$column * $rows + $row], $class, $column > 0); } $this->clear_context('ranking_column'); $this->output('</tr>'); } $this->clear_context('ranking_row'); $this->output('</table>'); } else { $this->output(' <div class="no-items"> <h3 class="icon-warning">' . qa_lang_html('cleanstrap/no_results') . '</h3> <p>' . qa_lang_html('cleanstrap/no_results_detail') . '</p> </div>'); } } }
$selectsort = 'hotness'; break; case 'votes': $selectsort = 'netvotes'; break; case 'answers': $selectsort = 'acount'; break; case 'views': $selectsort = 'views'; break; default: $selectsort = 'created'; break; } @(list($questions, $categories, $categoryid, $favorite) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, $selectsort, $start, $categoryslugs, null, false, false, qa_opt_if_loaded('page_size_qs')), qa_db_category_nav_selectspec($categoryslugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($categoryslugs) : null, $countslugs && isset($userid) ? qa_db_is_favorite_selectspec($userid, QA_ENTITY_CATEGORY, $categoryslugs) : null)); if ($countslugs) { if (!isset($categoryid)) { return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } $categorytitlehtml = qa_html($categories[$categoryid]['title']); $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml); } else { $nonetitle = qa_lang_html('main/no_questions_found'); } $categorypathprefix = QA_ALLOW_UNINDEXED_QUERIES ? 'questions/' : null; // this default is applied if sorted not by recent $feedpathprefix = null; $linkparams = array('sort' => $sort); switch ($sort) { case 'hot':
// don't allow this page to be requested directly from browser 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-updates.php'; $tag = qa_request_part(1); // picked up from qa-page.php $start = qa_get_start(); $userid = qa_get_logged_in_userid(); // Find the questions with this tag if (!strlen($tag)) { qa_redirect('tags'); } @(list($questions, $tagword, $favorite) = qa_db_select_with_pending(qa_db_tag_recent_qs_selectspec($userid, $tag, $start, false, qa_opt_if_loaded('page_size_tag_qs')), qa_db_tag_word_selectspec($tag), isset($userid) ? qa_db_is_favorite_selectspec($userid, QA_ENTITY_TAG, $tag) : null)); $pagesize = qa_opt('page_size_tag_qs'); $questions = array_slice($questions, 0, $pagesize); $usershtml = qa_userids_handles_html($questions); // Prepare content for theme $qa_content = qa_content_prepare(true); $qa_content['title'] = qa_lang_html_sub('main/questions_tagged_x', qa_html($tag)); if (isset($userid) && isset($tagword)) { $qa_content['favorite'] = qa_favorite_form(QA_ENTITY_TAG, $tagword['wordid'], $favorite, qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'main/add_tag_x_favorites', $tagword['word'])); } if (!count($questions)) { $qa_content['q_list']['title'] = qa_lang_html('main/no_questions_found'); } $qa_content['q_list']['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"'); $qa_content['q_list']['qs'] = array(); foreach ($questions as $postid => $question) {
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; // Get popular tags $start = qa_get_start(); $userid = qa_get_logged_in_userid(); $populartags = qa_db_select_with_pending(qa_db_popular_tags_selectspec($start, qa_opt_if_loaded('page_size_tags'))); $tagcount = qa_opt('cache_tagcount'); $pagesize = qa_opt('page_size_tags'); // Prepare content for theme $qa_content = qa_content_prepare(); $qa_content['title'] = qa_lang_html('main/popular_tags'); $qa_content['ranking'] = array('items' => array(), 'rows' => ceil($pagesize / qa_opt('columns_tags')), 'type' => 'tags'); if (count($populartags)) { $favoritemap = qa_get_favorite_non_qs_map(); $output = 0; foreach ($populartags as $word => $count) { $qa_content['ranking']['items'][] = array('label' => qa_tag_html($word, false, @$favoritemap['tag'][qa_strtolower($word)]), 'count' => number_format($count)); if (++$output >= $pagesize) { break; } }
$countslugs = @count($categoryslugs); $by = qa_get('by'); $start = qa_get_start(); $userid = qa_get_logged_in_userid(); switch ($by) { case 'selected': $selectby = 'selchildid'; break; case 'upvotes': $selectby = 'amaxvote'; break; default: $selectby = 'acount'; break; } list($questions, $categories, $categoryid) = qa_db_select_with_pending(qa_db_unanswered_qs_selectspec($userid, $selectby, $start, $categoryslugs, false, false, qa_opt_if_loaded('page_size_una_qs')), QA_ALLOW_UNINDEXED_QUERIES ? qa_db_category_nav_selectspec($categoryslugs, false, false, true) : null, $countslugs ? qa_db_slugs_to_category_id_selectspec($categoryslugs) : null); if ($countslugs) { if (!isset($categoryid)) { return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } $categorytitlehtml = qa_html($categories[$categoryid]['title']); } $feedpathprefix = null; $linkparams = array('by' => $by); switch ($by) { case 'selected': if ($countslugs) { $sometitle = qa_lang_html_sub('main/unselected_qs_in_x', $categorytitlehtml); $nonetitle = qa_lang_html_sub('main/no_una_questions_in_x', $categorytitlehtml); } else { $sometitle = qa_lang_html('main/unselected_qs_title');
$selectsort = 'hotness'; break; case 'votes': $selectsort = 'netvotes'; break; case 'answers': $selectsort = 'acount'; break; case 'views': $selectsort = 'views'; break; default: $selectsort = 'created'; break; } list($questions, $categories, $categoryid) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, $selectsort, $start, $categoryslugs, null, false, false, qa_opt_if_loaded('page_size_qs')), qa_db_category_nav_selectspec($categoryslugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($categoryslugs) : null); if ($countslugs) { if (!isset($categoryid)) { return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } $categorytitlehtml = qa_html($categories[$categoryid]['title']); $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml); } else { $nonetitle = qa_lang_html('main/no_questions_found'); } $categorypathprefix = QA_ALLOW_UNINDEXED_QUERIES ? 'questions/' : null; // this default is applied if sorted not by recent $feedpathprefix = null; $linkparams = array('sort' => $sort); switch ($sort) { case 'hot':
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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/users.php'; require_once QA_INCLUDE_DIR . 'db/selects.php'; require_once QA_INCLUDE_DIR . 'app/format.php'; // Get list of all users $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); // Prepare content for theme $qa_content = qa_content_prepare(); $qa_content['title'] = qa_lang_html('main/highest_users'); $qa_content['ranking'] = array('items' => array(), 'rows' => ceil($pagesize / qa_opt('columns_users')), 'type' => 'users'); if (count($users)) { foreach ($users as $userid => $user) { if (QA_FINAL_EXTERNAL_USERS) { $avatarhtml = qa_get_external_avatar_html($user['userid'], qa_opt('avatar_users_size'), true); } else { $avatarhtml = qa_get_user_avatar_html($user['flags'], $user['email'], $user['handle'], $user['avatarblobid'], $user['avatarwidth'], $user['avatarheight'], qa_opt('avatar_users_size'), true); }
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);
require_once QA_INCLUDE_DIR . 'db/selects.php'; require_once QA_INCLUDE_DIR . 'app/format.php'; // Determine whether path begins with qa or not (question and answer listing can be accessed either way) $requestparts = explode('/', qa_request()); $explicitqa = strtolower($requestparts[0]) == 'qa'; if ($explicitqa) { $slugs = array_slice($requestparts, 1); } elseif (strlen($requestparts[0])) { $slugs = $requestparts; } else { $slugs = array(); } $countslugs = count($slugs); // Get list of questions, other bits of information that might be useful $userid = qa_get_logged_in_userid(); list($questions1, $questions2, $categories, $categoryid, $custompage) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, $slugs, null, false, false, qa_opt_if_loaded('page_size_activity')), qa_db_recent_a_qs_selectspec($userid, 0, $slugs), qa_db_category_nav_selectspec($slugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null, $countslugs == 1 && !$explicitqa ? qa_db_page_full_selectspec($slugs[0], false) : null); // First, if this matches a custom page, return immediately with that page's content if (isset($custompage) && !($custompage['flags'] & QA_PAGE_FLAGS_EXTERNAL)) { qa_set_template('custom-' . $custompage['pageid']); $qa_content = qa_content_prepare(); $level = qa_get_logged_in_level(); if (!qa_permit_value_error($custompage['permit'], $userid, $level, qa_get_logged_in_flags()) || !isset($custompage['permit'])) { $qa_content['title'] = qa_html($custompage['heading']); $qa_content['custom'] = $custompage['content']; if ($level >= QA_USER_LEVEL_ADMIN) { $qa_content['navigation']['sub'] = array('admin/pages' => array('label' => qa_lang('admin/edit_custom_page'), 'url' => qa_path_html('admin/pages', array('edit' => $custompage['pageid'])))); } } else { $qa_content['error'] = qa_lang_html('users/no_permission'); } return $qa_content;
// don't allow this page to be requested directly from browser 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-updates.php'; $tag = qa_request_part(1); // picked up from qa-page.php $start = qa_get_start(); $userid = qa_get_logged_in_userid(); // Find the questions with this tag if (!strlen($tag)) { qa_redirect('tags'); } list($questions, $tagword) = qa_db_select_with_pending(qa_db_tag_recent_qs_selectspec($userid, $tag, $start, false, qa_opt_if_loaded('page_size_tag_qs')), qa_db_tag_word_selectspec($tag)); $pagesize = qa_opt('page_size_tag_qs'); $questions = array_slice($questions, 0, $pagesize); $usershtml = qa_userids_handles_html($questions); // Prepare content for theme $qa_content = qa_content_prepare(true); $qa_content['title'] = qa_lang_html_sub('main/questions_tagged_x', qa_html($tag)); if (isset($userid) && isset($tagword)) { $favoritemap = qa_get_favorite_non_qs_map(); $favorite = @$favoritemap['tag'][qa_strtolower($tagword['word'])]; $qa_content['favorite'] = qa_favorite_form(QA_ENTITY_TAG, $tagword['wordid'], $favorite, qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'main/add_tag_x_favorites', $tagword['word'])); } if (!count($questions)) { $qa_content['q_list']['title'] = qa_lang_html('main/no_questions_found'); } $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));