本文整理汇总了PHP中qa_userids_handles_html函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_userids_handles_html函数的具体用法?PHP qa_userids_handles_html怎么用?PHP qa_userids_handles_html使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_userids_handles_html函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: it_q_list_page_content
function it_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-updates.php';
$userid = qa_get_logged_in_userid();
// Chop down to size, get user information for display
if (isset($pagesize)) {
$questions = array_slice($questions, 0, $pagesize);
}
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
$qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
$qa_content['q_list']['qs'] = array();
if (count($questions)) {
$qa_content['title'] = $sometitle;
$defaults = qa_post_html_defaults('Q');
foreach ($questions as $question) {
$qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $userid, it_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
}
} else {
$qa_content['title'] = $nonetitle;
}
if (isset($count) && isset($pagesize)) {
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
}
return $qa_content;
}
示例2: qa_q_list_page_content
function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = null, $categoryparams = null, $dummy = null)
{
if (qa_to_override(__FUNCTION__)) {
$args = func_get_args();
return qa_call_override(__FUNCTION__, $args);
}
require_once QA_INCLUDE_DIR . 'app/format.php';
require_once QA_INCLUDE_DIR . 'app/updates.php';
$userid = qa_get_logged_in_userid();
// Chop down to size, get user information for display
if (isset($pagesize)) {
$questions = array_slice($questions, 0, $pagesize);
}
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
// Prepare content for theme
$qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
$qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
$qa_content['q_list']['qs'] = array();
if (count($questions)) {
$qa_content['title'] = $sometitle;
$defaults = qa_post_html_defaults('Q');
if (isset($categorypathprefix)) {
$defaults['categorypathprefix'] = $categorypathprefix;
}
foreach ($questions as $question) {
$fields = qa_any_to_q_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question, $defaults));
if (!empty($fields['raw']['closedbyid'])) {
$fields['closed'] = array('state' => qa_lang_html('main/closed'));
}
$qa_content['q_list']['qs'][] = $fields;
}
} else {
$qa_content['title'] = $nonetitle;
}
if (isset($userid) && isset($categoryid)) {
$favoritemap = qa_get_favorite_non_qs_map();
$categoryisfavorite = @$favoritemap['category'][$navcategories[$categoryid]['backpath']];
$qa_content['favorite'] = qa_favorite_form(QA_ENTITY_CATEGORY, $categoryid, $categoryisfavorite, qa_lang_sub($categoryisfavorite ? 'main/remove_x_favorites' : 'main/add_category_x_favorites', $navcategories[$categoryid]['title']));
}
if (isset($count) && isset($pagesize)) {
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
}
if (empty($qa_content['page_links'])) {
$qa_content['suggest_next'] = $suggest;
}
if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
$qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount, $categoryparams);
}
if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
$qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
}
return $qa_content;
}
示例3: get_user_activity
function get_user_activity($handle, $limit = 10)
{
$userid = qa_handle_to_userid($handle);
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
$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($userid, $identifier, $limit), qa_db_user_recent_a_qs_selectspec($userid, $identifier), qa_db_user_recent_c_qs_selectspec($userid, $identifier), qa_db_user_recent_edit_qs_selectspec($userid, $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, $limit);
$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, $userid, qa_cookie_get(), $usershtml, null, array('voteview' => false) + qa_post_html_options($question, $htmldefaults));
}
$output = '<div class="user-activities">';
$output .= '<ul>';
if (isset($qa_content)) {
foreach ($qa_content as $qs) {
$icon = 'icon-time undefined';
$output .= '<li class="activity-item">';
$output .= '<div class="list-right">';
$output .= '<div class="type pull-left ' . $icon . '"></div>';
$output .= '<div class="what"><a class="what-task" href="' . @$qs['url'] . '">' . $qs['what'] . '</a>';
$output .= '<a href="' . $qs['url'] . '">' . $qs['title'] . '</a> </div>';
$output .= '<strong class="when">' . implode(' ', $qs['when']) . '</strong>';
$output .= '</div>';
$output .= '</li>';
}
} else {
$output .= '<li>' . qa_lang('cleanstrap/no_activity_yet') . '</li>';
}
$output .= '</ul>';
$output .= '</div>';
return $output;
}
示例4: qa_q_list_page_content
function qa_q_list_page_content($questions, $pagesize, $start, $count, $sometitle, $nonetitle, $navcategories, $categoryid, $categoryqcount, $categorypathprefix, $feedpathprefix, $suggest, $pagelinkparams = array())
{
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
global $qa_login_userid, $qa_cookieid, $qa_request;
// get globals from qa-page.php
// Chop down to size, get user information for display
if (isset($pagesize)) {
$questions = array_slice($questions, 0, $pagesize);
}
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
// Prepare content for theme
$qa_content = qa_content_prepare(true, array_keys(qa_category_path($navcategories, $categoryid)));
$qa_content['q_list']['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"');
$qa_content['q_list']['qs'] = array();
if (count($questions)) {
$qa_content['title'] = $sometitle;
$options = qa_post_html_defaults('Q');
if (isset($categorypathprefix)) {
$options['categorypathprefix'] = $categorypathprefix;
}
foreach ($questions as $question) {
$qa_content['q_list']['qs'][] = qa_any_to_q_html_fields($question, $qa_login_userid, $qa_cookieid, $usershtml, null, $options);
}
} else {
$qa_content['title'] = $nonetitle;
}
if (isset($count) && isset($pagesize)) {
$qa_content['page_links'] = qa_html_page_links($qa_request, $start, $pagesize, $count, qa_opt('pages_prev_next'), $pagelinkparams);
}
if (empty($qa_content['page_links'])) {
$qa_content['suggest_next'] = $suggest;
}
if (qa_using_categories() && count($navcategories) && isset($categorypathprefix)) {
$qa_content['navigation']['cat'] = qa_category_navigation($navcategories, $categoryid, $categorypathprefix, $categoryqcount);
}
if (isset($feedpathprefix) && (qa_opt('feed_per_category') || !isset($categoryid))) {
$qa_content['feed'] = array('url' => qa_path_html(qa_feed_request($feedpathprefix . (isset($categoryid) ? '/' . qa_category_path_request($navcategories, $categoryid) : ''))), 'label' => strip_tags($sometitle));
}
return $qa_content;
}
示例5: output_widget
public function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'db/selects.php';
if (!isset($qa_content['q_view']['raw']['type']) || $qa_content['q_view']['raw']['type'] != 'Q') {
// question might not be visible, etc...
return;
}
$questionid = $qa_content['q_view']['raw']['postid'];
$userid = qa_get_logged_in_userid();
$cookieid = qa_cookie_get();
$questions = qa_db_single_select(qa_db_related_qs_selectspec($userid, $questionid, qa_opt('page_size_related_qs')));
$minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
foreach ($questions as $key => $question) {
if ($question['score'] < $minscore) {
unset($questions[$key]);
}
}
$titlehtml = qa_lang_html(count($questions) ? 'main/related_qs_title' : 'main/no_related_qs_title');
if ($region == 'side') {
$themeobject->output('<div class="qa-related-qs">', '<h2 style="margin-top:0; padding-top:0;">', $titlehtml, '</h2>');
$themeobject->output('<ul class="qa-related-q-list">');
foreach ($questions as $question) {
$themeobject->output('<li class="qa-related-q-item">' . '<a href="' . qa_q_path_html($question['postid'], $question['title']) . '">' . qa_html($question['title']) . '</a>' . '</li>');
}
$themeobject->output('</ul>', '</div>');
} else {
$themeobject->output('<h2>', $titlehtml, '</h2>');
$q_list = array('form' => array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote'))), 'qs' => array());
$defaults = qa_post_html_defaults('Q');
$usershtml = qa_userids_handles_html($questions);
foreach ($questions as $question) {
$q_list['qs'][] = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, qa_post_html_options($question, $defaults));
}
$themeobject->q_list_and_form($q_list);
}
}
示例6: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
if (@$qa_content['q_view']['raw']['type'] != 'Q') {
// question might not be visible, etc...
return;
}
$questionid = $qa_content['q_view']['raw']['postid'];
$userid = qa_get_logged_in_userid();
$cookieid = qa_cookie_get();
$questions = qa_db_single_select(qa_db_related_qs_selectspec($userid, $questionid, qa_opt('page_size_related_qs')));
$minscore = qa_match_to_min_score(qa_opt('match_related_qs'));
foreach ($questions as $key => $question) {
if ($question['score'] < $minscore) {
unset($questions[$key]);
}
}
$titlehtml = qa_lang_html(count($questions) ? 'main/related_qs_title' : 'main/no_related_qs_title');
if ($region == 'side') {
$themeobject->output('<DIV CLASS="qa-related-qs">', '<H2 STYLE="margin-top:0; padding-top:0;">', $titlehtml, '</H2>');
$themeobject->output('<UL CLASS="qa-related-q-list">');
foreach ($questions as $question) {
$themeobject->output('<LI CLASS="qa-related-q-item"><A HREF="' . qa_q_path_html($question['postid'], $question['title']) . '">' . qa_html($question['title']) . '</A></LI>');
}
$themeobject->output('</UL>', '</DIV>');
} else {
$themeobject->output('<H2>', $titlehtml, '</H2>');
$q_list = array('form' => array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"'), 'qs' => array());
$options = qa_post_html_defaults('Q');
$usershtml = qa_userids_handles_html($questions);
foreach ($questions as $question) {
$q_list['qs'][] = qa_post_html_fields($question, $userid, $cookieid, $usershtml, null, $options);
}
$themeobject->q_list_and_form($q_list);
}
}
示例7: header
*/
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';
// Check that we're logged in
$userid = qa_get_logged_in_userid();
if (!isset($userid)) {
qa_redirect('login');
}
// Get lists of favorites for this user
@(list($questions, $users, $tags, $categories) = qa_db_select_with_pending(qa_db_user_favorite_qs_selectspec($userid), QA_FINAL_EXTERNAL_USERS ? null : qa_db_user_favorite_users_selectspec($userid), qa_db_user_favorite_tags_selectspec($userid), qa_db_user_favorite_categories_selectspec($userid)));
$usershtml = qa_userids_handles_html(QA_FINAL_EXTERNAL_USERS ? $questions : array_merge($questions, $users));
// Prepare and return content for theme
$qa_content = qa_content_prepare(true);
$qa_content['title'] = qa_lang_html('misc/my_favorites_title');
// Favorite questions
$qa_content['q_list'] = array('title' => count($questions) ? qa_lang_html('main/nav_qs') : qa_lang_html('misc/no_favorite_qs'), 'qs' => array());
if (count($questions)) {
$qa_content['q_list']['form'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"');
$options = qa_post_html_defaults('Q');
foreach ($questions as $question) {
$qa_content['q_list']['qs'][] = qa_post_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, $options);
}
}
// Favorite users
if (!QA_FINAL_EXTERNAL_USERS) {
$qa_content['ranking_users'] = array('title' => count($users) ? qa_lang_html('main/nav_users') : qa_lang_html('misc/no_favorite_users'), 'items' => array(), 'rows' => ceil(count($users) / qa_opt('columns_users')), 'type' => 'users');
示例8: isset
}
}
}
if (qa_is_http_post() || strlen($pagestate)) {
require QA_INCLUDE_DIR . 'pages/question-post.php';
}
$formrequested = isset($formtype);
if (!$formrequested && $question['answerbutton']) {
$immedoption = qa_opt('show_a_form_immediate');
if ($immedoption == 'always' || $immedoption == 'if_no_as' && !$question['isbyuser'] && !$question['acount']) {
$formtype = 'a_add';
}
// show answer form by default
}
// Get information on the users referenced
$usershtml = qa_userids_handles_html(array_merge(array($question), $answers, $commentsfollows), true);
// Prepare content for theme
$qa_content = qa_content_prepare(true, array_keys(qa_category_path($categories, $question['categoryid'])));
if (isset($userid) && !$formrequested) {
$qa_content['favorite'] = qa_favorite_form(QA_ENTITY_QUESTION, $questionid, $favorite, qa_lang($favorite ? 'question/remove_q_favorites' : 'question/add_q_favorites'));
}
$qa_content['script_rel'][] = 'qa-content/qa-question.js?' . QA_VERSION;
if (isset($pageerror)) {
$qa_content['error'] = $pageerror;
} elseif ($question['queued']) {
$qa_content['error'] = $question['isbyuser'] ? qa_lang_html('question/q_your_waiting_approval') : qa_lang_html('question/q_waiting_your_approval');
}
if ($question['hidden']) {
$qa_content['hidden'] = true;
}
qa_sort_by($commentsfollows, 'created');
示例9: qa_get_start
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);
}
// Recent questions by this user
$qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
$qa_content['q_list']['qs'] = array();
$htmldefaults = qa_post_html_defaults('Q');
$htmldefaults['whoview'] = false;
$htmldefaults['avatarsize'] = 0;
$htmldefaults['ovoteview'] = true;
$htmldefaults['answersview'] = false;
示例10: doctype
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') {
//.........这里部分代码省略.........
示例11: qa_get_search_results
$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'];
}
}
$usershtml = qa_userids_handles_html($fullquestions);
// Report the search event
qa_report_event('search', $userid, qa_get_logged_in_handle(), qa_cookie_get(), array('query' => $inquery, 'start' => $start));
}
// Prepare content for theme
$qa_content = qa_content_prepare(true);
if (strlen(qa_get('q'))) {
$qa_content['search']['value'] = qa_html($inquery);
if (count($results)) {
$qa_content['title'] = qa_lang_html_sub('main/results_for_x', qa_html($inquery));
} else {
$qa_content['title'] = qa_lang_html_sub('main/no_results_for_x', qa_html($inquery));
}
$qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote')));
$qa_content['q_list']['qs'] = array();
$qdefaults = qa_post_html_defaults('Q');
示例12: ranking
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);
}
}
示例13: array
// Data for functions to run
$favswitch = array('questions' => array('page_opt' => 'page_size_qs', 'fn_spec' => 'qa_db_user_favorite_qs_selectspec', 'fn_view' => 'qa_favorite_q_list_view', 'key' => 'q_list'), 'users' => array('page_opt' => 'page_size_users', 'fn_spec' => 'qa_db_user_favorite_users_selectspec', 'fn_view' => 'qa_favorite_users_view', 'key' => 'ranking_users'), 'tags' => array('page_opt' => 'page_size_tags', 'fn_spec' => 'qa_db_user_favorite_tags_selectspec', 'fn_view' => 'qa_favorite_tags_view', 'key' => 'ranking_tags'));
// Check that we're logged in
$userid = qa_get_logged_in_userid();
if (!isset($userid)) {
qa_redirect('login');
}
// Get lists of favorites of this type
$favtype = qa_request_part(1);
$start = qa_get_start();
if (!array_key_exists($favtype, $favswitch) || $favtype === 'users' && QA_FINAL_EXTERNAL_USERS) {
return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
}
extract($favswitch[$favtype]);
// get switch variables
$pagesize = qa_opt($page_opt);
list($totalItems, $items) = qa_db_select_with_pending(qa_db_selectspec_count($fn_spec($userid)), $fn_spec($userid, $pagesize, $start));
$count = $totalItems['count'];
$usershtml = qa_userids_handles_html($items);
// Prepare and return content for theme
$qa_content = qa_content_prepare(true);
$qa_content['title'] = qa_lang_html('misc/my_favorites_title');
$qa_content[$key] = $fn_view($items, $usershtml);
// Sub navigation for account pages and suggestion
$qa_content['suggest_next'] = qa_lang_html_sub('misc/suggest_favorites_add', '<span class="qa-favorite-image"> </span>');
$qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $count, qa_opt('pages_prev_next'));
$qa_content['navigation']['sub'] = qa_user_sub_navigation(qa_get_logged_in_handle(), 'favorites', true);
return $qa_content;
/*
Omit PHP closing tag to help avoid accidental output
*/
示例14: 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) {
//.........这里部分代码省略.........
示例15: qa_lang_html
// Send back new count of answers
$countanswers = $question['acount'];
if ($countanswers == 1) {
echo qa_lang_html('question/1_answer_title');
} else {
echo qa_lang_html_sub('question/x_answers_title', $countanswers);
}
// If the answer was not deleted....
if (isset($answer)) {
$question = $question + qa_page_q_post_rules($question, null, null, $qchildposts);
// array union
$answer = $answer + qa_page_q_post_rules($answer, $question, $qchildposts, $achildposts);
foreach ($achildposts as $key => $achildpost) {
$achildposts[$key] = $achildpost + qa_page_q_post_rules($achildpost, $answer, $achildposts, null);
}
$usershtml = qa_userids_handles_html(array_merge(array($answer), $achildposts), true);
$a_view = qa_page_q_answer_view($question, $answer, $answer['postid'] == $question['selchildid'] && $answer['type'] == 'A', $usershtml, false);
$a_view['c_list'] = qa_page_q_comment_follow_list($question, $answer, $achildposts, false, $usershtml, false, null);
$themeclass = qa_load_theme_class(qa_get_site_theme(), 'ajax-answer', null, null);
// ... send back the HTML for it
echo "\n";
$themeclass->a_list_item($a_view);
}
return;
}
}
echo "QA_AJAX_RESPONSE\n0\n";
// fall back to non-Ajax submission if something failed
/*
Omit PHP closing tag to help avoid accidental output
*/