function ra_top_users($limit = 5, $size) { $users = qa_db_select_with_pending(qa_db_top_users_selectspec(qa_get_start())); $output = '<ul class="top-users-list clearfix">'; $i = 1; foreach ($users as $u) { if (defined('QA_WORDPRESS_INTEGRATE_PATH')) { require_once QA_INCLUDE_DIR . 'qa-app-posts.php'; $u['handle'] = qa_post_userid_to_handle($u['userid']); } $output .= '<li class="top-user">'; $output .= '<div class="avatar pull-left" data-handle="' . $u['handle'] . '" data-id="' . qa_handle_to_userid($u['handle']) . '">'; $output .= ra_get_avatar($u['handle'], $size) . '</div>'; $output .= '<div class="top-user-data">'; $output .= '<a href="' . qa_path_html('user/' . $u['handle']) . '" class="name">' . ra_name($u['handle']) . '</a>'; //$output .= ra_user_badge($u['handle']); $output .= '<dl class="points">' . $u['points'] . ' ' . _ra_lang('Points') . '</dl>'; $output .= '</div>'; $output .= '</li>'; if ($i == $limit) { break; } $i++; } $output .= '</ul>'; echo $output; }
function process_request($request) { // Get list of unanswered open questions $userid = qa_get_logged_in_userid(); $start = qa_get_start(); $questions_selectspec = $this->qa_db_open_qs_selectspec($userid, $start); $questions = qa_db_select_with_pending($questions_selectspec); // Prepare and return the content for the theme $questions_found_title = qa_lang_html('open_questions/questions_found_title'); $no_questions_title = qa_lang_html('open_questions/no_questions_title'); $count = qa_opt('cache_unaqcount'); $qa_content = qa_q_list_page_content($questions, qa_opt('page_size_una_qs'), $start, @$count, $questions_found_title, $no_questions_title, null, null, false, null, null, qa_html_suggest_qs_tags(qa_using_tags()), null, null); return $qa_content; }
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; }
function process_request($request) { 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-q-list.php'; $start = qa_get_start(); $userid = qa_get_logged_in_userid(); $categoryslugs = qa_request_parts(1); //$selectspec = qa_db_qs_selectspec($userid, 'created', $start, $categoryslugs, null, false, false, qa_opt_if_loaded('page_size_qs')); $selectspec = qa_db_posts_basic_selectspec($userid, false); $selectspec['source'] .= ' JOIN ^postmeta ON ^posts.postid=^postmeta.post_id AND ^postmeta.meta_key=$ AND ^postmeta.meta_value>0' . (is_array($this->expert_user) ? ' AND ^posts.categoryid IN (#)' : ' AND $'); //$selectspec['source'].=' JOIN (SELECT postid FROM ^posts WHERE type=$ ORDER BY ^posts.created DESC LIMIT #,#) y ON ^posts.postid=y.postid'; $selectspec['arguments'] = array_merge($selectspec['arguments'], array('is_expert_question', $this->expert_user)); $questions = qa_db_select_with_pending($selectspec); $nonetitle = qa_lang_html('main/no_questions_found'); global $qa_start; // Prepare and return content for theme $qa_content = qa_q_list_page_content($questions, qa_opt('page_size_qs'), $qa_start, count($questions), qa_opt('expert_question_page_title'), $nonetitle, null, null, false, null, null, null, null); return $qa_content; }
function process_request($request) { $qa_content = qa_content_prepare(); $qa_content['site_title'] = "Notifications"; $qa_content['error'] = ""; $qa_content['suggest_next'] = ""; $qa_content['template'] = "notifications"; // Get the no of notifications $start = qa_get_start(); $pagesize = qa_opt('qw_all_notification_page_size'); if (!$pagesize) { $pagesize = 15; } $notifications_count = qw_get_notification_count(qa_get_logged_in_userid()); $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $notifications_count, qa_opt('pages_prev_next')); if (empty($qa_content['page_links'])) { $qa_content['suggest_next'] = qa_html_suggest_ask(); } $qa_content['custom'] = $this->opt_form(); return $qa_content; }
function process_request($request) { $start = qa_get_start(); $userid = qa_get_logged_in_userid(); // Prepare content for theme 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 QW_CONTROL_DIR . '/addons/social-login/cs-social-login-utils.php'; if (QA_FINAL_EXTERNAL_USERS) { qa_fatal_error('User accounts are handled by external code'); } if (!isset($userid)) { qa_redirect('login'); } $qa_content = qa_content_prepare(); $qa_content['title'] = qa_lang_html('notification/my_notification_settings'); $qa_content['site_title'] = qa_opt('site_title'); if (qa_clicked('save_notf_user_settings')) { $data_to_save = array('qw_mail_when_a_post' => !!qa_post_text('qw_mail_when_a_post'), 'qw_mail_when_related' => !!qa_post_text('qw_mail_when_related'), 'qw_mail_when_c_post' => !!qa_post_text('qw_mail_when_c_post'), 'qw_mail_when_q_reshow' => !!qa_post_text('qw_mail_when_q_reshow'), 'qw_mail_when_c_reshow' => !!qa_post_text('qw_mail_when_c_reshow'), 'qw_mail_when_a_select' => !!qa_post_text('qw_mail_when_a_select'), 'qw_mail_when_q_vote_up' => !!qa_post_text('qw_mail_when_q_vote_up'), 'qw_mail_when_q_vote_down' => !!qa_post_text('qw_mail_when_q_vote_down'), 'qw_mail_when_a_vote_up' => !!qa_post_text('qw_mail_when_a_vote_up'), 'qw_mail_when_a_vote_down' => !!qa_post_text('qw_mail_when_a_vote_down'), 'qw_mail_when_q_favorite' => !!qa_post_text('qw_mail_when_q_favorite'), 'qw_mail_when_u_favorite' => !!qa_post_text('qw_mail_when_u_favorite'), 'qw_mail_when_u_message' => !!qa_post_text('qw_mail_when_u_message'), 'qw_mail_when_u_wall_post' => !!qa_post_text('qw_mail_when_u_wall_post'), 'qw_mail_when_u_level' => !!qa_post_text('qw_mail_when_u_level'), 'qw_mail_when_q_post_user_fl' => !!qa_post_text('qw_mail_when_q_post_user_fl'), 'qw_mail_when_q_post_tag_fl' => !!qa_post_text('qw_mail_when_q_post_tag_fl'), 'qw_mail_when_q_post_cat_fl' => !!qa_post_text('qw_mail_when_q_post_cat_fl'), 'qw_mail_when_q_approve' => !!qa_post_text('qw_mail_when_q_approve'), 'qw_mail_when_q_reject' => !!qa_post_text('qw_mail_when_q_reject'), 'qw_mail_when_a_approve' => !!qa_post_text('qw_mail_when_a_approve'), 'qw_mail_when_a_reject' => !!qa_post_text('qw_mail_when_a_reject'), 'qw_mail_when_c_approve' => !!qa_post_text('qw_mail_when_c_approve'), 'qw_mail_when_c_reject' => !!qa_post_text('qw_mail_when_c_reject')); qw_save_notification_settings(json_encode($data_to_save), $userid); qa_redirect('notification-settings', array('state' => 'settings-saved')); } $disp_conf = qa_get('confirm'); $preferences = qw_get_notification_settings($userid); // qw_log(print_r(qw_check_pref_for_event($userid , 'a_post') , true )) ; if (!$disp_conf) { // display some summary about the user $qa_content['form_profile'] = array('title' => qa_lang_html('notification/my_notification_settings'), 'tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '" CLASS="social-login-settings"', 'style' => 'wide', 'buttons' => array('check_all' => array('type' => 'button', 'tags' => 'name="check_all_notf_fields" id="check_all_notf_fields" ', 'label' => qa_lang_html('notification/check_all')), 'uncheck_all' => array('type' => 'button', 'tags' => 'name="un_check_all_notf_fields" id="un_check_all_notf_fields" ', 'label' => qa_lang_html('notification/uncheck_all')), 'save' => array('tags' => 'onClick="qa_show_waiting_after(this, false);"', 'label' => qa_lang_html('notification/save_settings'))), 'fields' => array('qw_mail_when_a_post' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_post_lable'), 'tags' => 'NAME="qw_mail_when_a_post"', 'value' => @$preferences['qw_mail_when_a_post'] ? true : false), 'qw_mail_when_related' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_related_lable'), 'tags' => 'NAME="qw_mail_when_related"', 'value' => @$preferences['qw_mail_when_related'] ? true : false), 'qw_mail_when_c_post' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_c_post_lable'), 'tags' => 'NAME="qw_mail_when_c_post"', 'value' => @$preferences['qw_mail_when_c_post'] ? true : false), 'qw_mail_when_q_reshow' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_reshow_lable'), 'tags' => 'NAME="qw_mail_when_q_reshow"', 'value' => @$preferences['qw_mail_when_q_reshow'] ? true : false), 'qw_mail_when_c_reshow' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_c_reshow_lable'), 'tags' => 'NAME="qw_mail_when_c_reshow"', 'value' => @$preferences['qw_mail_when_c_reshow'] ? true : false), 'qw_mail_when_a_select' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_select_lable'), 'tags' => 'NAME="qw_mail_when_a_select"', 'value' => @$preferences['qw_mail_when_a_select'] ? true : false), 'qw_mail_when_q_vote_up' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_vote_up_lable'), 'tags' => 'NAME="qw_mail_when_q_vote_up"', 'value' => @$preferences['qw_mail_when_q_vote_up'] ? true : false), 'qw_mail_when_q_vote_down' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_vote_down_lable'), 'tags' => 'NAME="qw_mail_when_q_vote_down"', 'value' => @$preferences['qw_mail_when_q_vote_down'] ? true : false), 'qw_mail_when_a_vote_up' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_vote_up_lable'), 'tags' => 'NAME="qw_mail_when_a_vote_up"', 'value' => @$preferences['qw_mail_when_a_vote_up'] ? true : false), 'qw_mail_when_a_vote_down' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_vote_down_lable'), 'tags' => 'NAME="qw_mail_when_a_vote_down"', 'value' => @$preferences['qw_mail_when_a_vote_down'] ? true : false), 'qw_mail_when_q_favorite' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_favorite_lable'), 'tags' => 'NAME="qw_mail_when_q_favorite"', 'value' => @$preferences['qw_mail_when_q_favorite'] ? true : false), 'qw_mail_when_u_favorite' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_u_favorite_lable'), 'tags' => 'NAME="qw_mail_when_u_favorite"', 'value' => @$preferences['qw_mail_when_u_favorite'] ? true : false), 'qw_mail_when_u_message' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_u_message_lable'), 'tags' => 'NAME="qw_mail_when_u_message"', 'value' => @$preferences['qw_mail_when_u_message'] ? true : false), 'qw_mail_when_u_wall_post' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_u_wall_post_lable'), 'tags' => 'NAME="qw_mail_when_u_wall_post"', 'value' => @$preferences['qw_mail_when_u_wall_post'] ? true : false), 'qw_mail_when_u_level' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_u_level_lable'), 'tags' => 'NAME="qw_mail_when_u_level"', 'value' => @$preferences['qw_mail_when_u_level'] ? true : false), 'qw_mail_when_q_post_user_fl' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_post_user_fl_lable'), 'tags' => 'NAME="qw_mail_when_q_post_user_fl"', 'value' => @$preferences['qw_mail_when_q_post_user_fl'] ? true : false), 'qw_mail_when_q_post_tag_fl' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_post_tag_fl_lable'), 'tags' => 'NAME="qw_mail_when_q_post_tag_fl"', 'value' => @$preferences['qw_mail_when_q_post_tag_fl'] ? true : false), 'qw_mail_when_q_post_cat_fl' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_post_cat_fl_lable'), 'tags' => 'NAME="qw_mail_when_q_post_cat_fl"', 'value' => @$preferences['qw_mail_when_q_post_cat_fl'] ? true : false), 'qw_mail_when_q_approve' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_approve_lable'), 'tags' => 'NAME="qw_mail_when_q_approve"', 'value' => @$preferences['qw_mail_when_q_approve'] ? true : false), 'qw_mail_when_q_reject' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_q_reject_lable'), 'tags' => 'NAME="qw_mail_when_q_reject"', 'value' => @$preferences['qw_mail_when_q_reject'] ? true : false), 'qw_mail_when_a_approve' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_approve_lable'), 'tags' => 'NAME="qw_mail_when_a_approve"', 'value' => @$preferences['qw_mail_when_a_approve'] ? true : false), 'qw_mail_when_a_reject' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_a_reject_lable'), 'tags' => 'NAME="qw_mail_when_a_reject"', 'value' => @$preferences['qw_mail_when_a_reject'] ? true : false), 'qw_mail_when_c_approve' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_c_approve_lable'), 'tags' => 'NAME="qw_mail_when_c_approve"', 'value' => @$preferences['qw_mail_when_c_approve'] ? true : false), 'qw_mail_when_c_reject' => array('type' => 'checkbox', 'label' => qa_lang_html('notification/mail_when_c_reject_lable'), 'tags' => 'NAME="qw_mail_when_c_reject"', 'value' => @$preferences['qw_mail_when_c_reject'] ? true : false)), 'hidden' => array('save_notf_user_settings' => '1')); if (qa_get_state() == 'settings-saved') { $qa_content['form_profile']['ok'] = qa_lang_html('notification/settings_saved'); } } $qa_content['navigation']['sub'] = qa_account_sub_navigation(); return $qa_content; }
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-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']; }
break; case 'approve': $qa_content['error'] = qa_lang_html('main/view_q_must_be_approved'); break; default: $qa_content['error'] = qa_lang_html('users/no_permission'); break; } return $qa_content; } // Determine if captchas will be required $captchareason = qa_user_captcha_reason(qa_user_level_for_post($question)); $usecaptcha = $captchareason != false; // If we're responding to an HTTP POST, include file that handles all posting/editing/etc... logic // This is in a separate file because it's a *lot* of logic, and will slow down ordinary page views $pagestart = qa_get_start(); $pagestate = qa_get_state(); $showid = qa_get('show'); $pageerror = null; $formtype = null; $formpostid = null; $jumptoanchor = null; $commentsall = null; if (substr($pagestate, 0, 13) == 'showcomments-') { $commentsall = substr($pagestate, 13); $pagestate = null; } elseif (isset($showid)) { foreach ($commentsfollows as $comment) { if ($comment['postid'] == $showid) { $commentsall = $comment['parentid']; break;
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>'); } } }
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(); }