本文整理汇总了PHP中qa_any_sort_and_dedupe函数的典型用法代码示例。如果您正苦于以下问题:PHP qa_any_sort_and_dedupe函数的具体用法?PHP qa_any_sort_and_dedupe怎么用?PHP qa_any_sort_and_dedupe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了qa_any_sort_and_dedupe函数的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: output_widget
function output_widget($region, $place, $themeobject, $template, $request, $qa_content)
{
$widget_opt = @$themeobject->current_widget['param']['options'];
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';
$categoryslugs = '';
$userid = qa_get_logged_in_userid();
// Get lists of recent activity in all its forms, plus category information
list($questions1, $questions2, $questions3, $questions4) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, $categoryslugs, null, false, false, $qcount), 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));
// Prepare and return content for theme
$content = qa_q_list_page_content(qa_any_sort_and_dedupe(array_merge($questions1, $questions2, $questions3, $questions4)), $qcount, 0, null, null, null, null, null, true, 'activity/', null, null, null, null);
$content = $content['q_list']['qs'];
if (@$themeobject->current_widget['param']['locations']['show_title']) {
$themeobject->output('<h3 class="widget-title">' . qa_lang('cleanstrap/recent_activities') . ' <a href="' . qa_path_html('activity') . '">' . qa_lang('cleanstrap/view_all') . '</a></h3>');
}
$themeobject->output('<div class="ra-question-activity-widget">');
$q_list = $content;
$themeobject->output('<ul class="activity-list">');
foreach ($q_list as $list) {
$themeobject->output('<li class="clearfix ' . (is_featured($list['raw']['postid']) ? ' featured' : '') . '"><span class="fav-star icon-heart' . (@$list['raw']['userfavoriteq'] ? ' active' : '') . '"></span><span class="post-status-c">' . cs_post_status($list) . '</span><a href="' . $list['url'] . '">' . $list['title'] . '<span class="time">' . implode(' ', $list['when']) . '</span><span class="ans-count total-' . $list['raw']['acount'] . '">' . $list['raw']['acount'] . '</span></a></li>');
}
$themeobject->output('</ul>');
$themeobject->output('</div>');
}
示例2: 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;
}
示例3: process_request
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;
}
示例4: qa_set_template
}
// Then, check whether we are showing a custom home page
if (!$explicitqa && !$countslugs && qa_opt('show_custom_home')) {
qa_set_template('custom');
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_html(qa_opt('custom_home_heading'));
if (qa_opt('show_home_description')) {
$qa_content['description'] = qa_html(qa_opt('home_description'));
}
$qa_content['custom'] = qa_opt('custom_home_content');
return $qa_content;
}
// If we got this far, it's a good old-fashioned Q&A listing page
require_once QA_INCLUDE_DIR . 'app/q-list.php';
qa_set_template('qa');
$questions = qa_any_sort_and_dedupe(array_merge($questions1, $questions2));
$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');
}
// Prepare and return content for theme for Q&A listing page
$qa_content = qa_q_list_page_content($questions, $pagesize, 0, null, $sometitle, $nonetitle, $categories, $categoryid, true, $explicitqa ? 'qa/' : '', qa_opt('feed_for_qa') ? 'qa' : 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);
if (!$explicitqa && !$countslugs && qa_opt('show_home_description')) {
示例5: qa_delete_user
qa_delete_user($userid);
qa_report_event('u_delete', $loginuserid, qa_get_logged_in_handle(), qa_cookie_get(), array('userid' => $userid, 'handle' => $useraccount['handle']));
qa_redirect('users');
}
}
}
// Process bonus setting button
if ($loginlevel >= QA_USER_LEVEL_ADMIN && qa_clicked('dosetbonus')) {
require_once QA_INCLUDE_DIR . 'qa-db-points.php';
qa_db_points_set_bonus($userid, (int) qa_post_text('bonus'));
qa_db_points_update_ifuser($userid, null);
qa_redirect(qa_request(), null, null, null, 'activity');
}
// Get information on user references in answers and other stuff need for page
$pagesize = qa_opt('page_size_user_posts');
$questions = qa_any_sort_and_dedupe(array_merge($questions, $answerqs, $commentqs, $editqs));
$questions = array_slice($questions, 0, $pagesize);
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
$usershtml[$userid] = $userhtml;
// Prepare content for theme
$qa_content = qa_content_prepare(true);
$qa_content['title'] = qa_lang_html_sub('profile/user_x', $userhtml);
if (isset($loginuserid) && !QA_FINAL_EXTERNAL_USERS) {
$qa_content['favorite'] = qa_favorite_form(QA_ENTITY_USER, $useraccount['userid'], $favorite, qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'users/add_user_x_favorites', $handle));
}
// General information about the user, only available if we're using internal user management
if (!QA_FINAL_EXTERNAL_USERS) {
$qa_content['form_profile'] = array('tags' => 'METHOD="POST" ACTION="' . qa_self_html() . '"', 'style' => 'wide', 'fields' => array('avatar' => array('type' => 'image', 'style' => 'tall', 'label' => '', 'html' => qa_get_user_avatar_html($useraccount['flags'], $useraccount['email'], $useraccount['handle'], $useraccount['avatarblobid'], $useraccount['avatarwidth'], $useraccount['avatarheight'], qa_opt('avatar_profile_size'))), 'removeavatar' => null, 'duration' => array('type' => 'static', 'label' => qa_lang_html('users/member_for'), 'value' => qa_html(qa_time_to_string(qa_opt('db_time') - $useraccount['created']))), 'level' => array('type' => 'static', 'label' => qa_lang_html('users/member_type'), 'tags' => 'NAME="level"', 'value' => qa_html(qa_user_level_string($useraccount['level'])), 'note' => $useraccount['flags'] & QA_USER_FLAGS_USER_BLOCKED && isset($maxlevelassign) ? qa_lang_html('users/user_blocked') : '')));
if (empty($qa_content['form_profile']['fields']['avatar']['html'])) {
unset($qa_content['form_profile']['fields']['avatar']);
}
示例6: header
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';
require_once QA_INCLUDE_DIR . 'qa-app-q-list.php';
$categoryslugs = qa_request_parts(1);
$countslugs = count($categoryslugs);
$userid = qa_get_logged_in_userid();
// Get list of comments with related questions, plus category information
list($questions, $categories, $categoryid) = qa_db_select_with_pending(qa_db_recent_c_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_cs_in_x', $categorytitlehtml);
$nonetitle = qa_lang_html_sub('main/no_comments_in_x', $categorytitlehtml);
} else {
$sometitle = qa_lang_html('main/recent_cs_title');
$nonetitle = qa_lang_html('main/no_comments_found');
}
// Prepare and return content for theme
return qa_q_list_page_content(qa_any_sort_and_dedupe($questions), qa_opt('page_size_activity'), 0, null, $sometitle, $nonetitle, $categories, $categoryid, false, 'comments/', qa_opt('feed_for_activity') ? 'comments' : null, qa_html_suggest_qs_tags(qa_using_tags(), qa_category_path_request($categories, $categoryid)));
/*
Omit PHP closing tag to help avoid accidental output
*/
示例7: array
$setarray = array('title' => $result['title'], 'url' => $result['url']);
if (isset($result['question'])) {
$questions[] = array_merge($result['question'], $setarray);
} elseif (isset($result['url'])) {
$questions[] = $setarray;
}
}
break;
}
// Remove duplicate questions (perhaps referenced in an answer and a comment) and cut down to size
require_once QA_INCLUDE_DIR . 'app/format.php';
require_once QA_INCLUDE_DIR . 'app/updates.php';
require_once QA_INCLUDE_DIR . 'util/string.php';
if ($feedtype != 'search' && $feedtype != 'hot') {
// leave search results and hot questions sorted by relevance
$questions = qa_any_sort_and_dedupe($questions);
}
$questions = array_slice($questions, 0, $count);
$blockwordspreg = qa_get_block_words_preg();
// Prepare the XML output
$lines = array();
$lines[] = '<?xml version="1.0" encoding="utf-8"?>';
$lines[] = '<rss version="2.0">';
$lines[] = '<channel>';
$lines[] = '<title>' . qa_xml($sitetitle . ' - ' . $title) . '</title>';
$lines[] = '<link>' . qa_xml(qa_path($linkrequest, $linkparams, $siteurl)) . '</link>';
$lines[] = '<description>Powered by Question2Answer</description>';
foreach ($questions as $question) {
// Determine whether this is a question, answer or comment, and act accordingly
$options = array('blockwordspreg' => @$blockwordspreg, 'showurllinks' => $showurllinks);
$time = null;
示例8: qa_get_logged_in_userid
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
require_once QA_INCLUDE_DIR . 'qa-app-q-list.php';
// Check that we're logged in
$userid = qa_get_logged_in_userid();
if (!isset($userid)) {
qa_redirect('login');
}
// Find out which updates to show
$forfavorites = qa_get('show') != 'content';
$forcontent = qa_get('show') != 'favorites';
// Get lists of recent updates for this user
$questions = qa_db_select_with_pending(qa_db_user_updates_selectspec($userid, $forfavorites, $forcontent));
if ($forfavorites) {
if ($forcontent) {
$sometitle = qa_lang_html('misc/recent_updates_title');
$nonetitle = qa_lang_html('misc/no_recent_updates');
} else {
$sometitle = qa_lang_html('misc/recent_updates_favorites');
$nonetitle = qa_lang_html('misc/no_updates_favorites');
}
} else {
$sometitle = qa_lang_html('misc/recent_updates_content');
$nonetitle = qa_lang_html('misc/no_updates_content');
}
// Prepare and return content for theme
$qa_content = qa_q_list_page_content(qa_any_sort_and_dedupe($questions), null, 0, null, $sometitle, $nonetitle, null, null, null, null, null, $forfavorites ? strtr(qa_lang_html('misc/suggest_update_favorites'), array('^1' => '<a href="' . qa_path_html('favorites') . '">', '^2' => '</a>')) : null);
$qa_content['navigation']['sub'] = array('all' => array('label' => qa_lang_html('misc/nav_all_my_updates'), 'url' => qa_path_html('updates'), 'selected' => $forfavorites && $forcontent), 'favorites' => array('label' => qa_lang_html('misc/nav_my_favorites'), 'url' => qa_path_html('updates', array('show' => 'favorites')), 'selected' => $forfavorites && !$forcontent), 'myposts' => array('label' => qa_lang_html('misc/nav_my_content'), 'url' => qa_path_html('updates', array('show' => 'content')), 'selected' => $forcontent && !$forfavorites));
return $qa_content;
/*
Omit PHP closing tag to help avoid accidental output
*/
示例9: header
header('Location: ../');
exit;
}
// report that we entered this page
qa_report_event('page_enter', qa_get_logged_in_userid(), qa_get_logged_in_handle(), qa_cookie_get(), array('params' => $_SERVER['QUERY_STRING'], 'path' => $_SERVER['SCRIPT_NAME']));
require_once QA_INCLUDE_DIR . 'qa-app-admin.php';
require_once QA_INCLUDE_DIR . 'qa-db-selects.php';
require_once QA_INCLUDE_DIR . 'qa-app-format.php';
// Find recently hidden questions, answers, comments
list($hiddenquestions, $hiddenanswers, $hiddencomments) = qa_db_select_with_pending(qa_db_qs_selectspec($qa_login_userid, 'created', 0, null, null, true), qa_db_recent_a_qs_selectspec($qa_login_userid, 0, null, null, true), qa_db_recent_c_qs_selectspec($qa_login_userid, 0, null, null, true));
// Check admin privileges (do late to allow one DB query)
if (!qa_admin_check_privileges($qa_content)) {
return $qa_content;
}
// Combine sets of questions and get information for users
$questions = qa_any_sort_and_dedupe(array_merge($hiddenquestions, $hiddenanswers, $hiddencomments));
$usershtml = qa_userids_handles_html(qa_any_get_userids_handles($questions));
// Prepare content for theme
$qa_content = qa_content_prepare();
$qa_content['title'] = qa_lang_html('admin/recent_hidden_title');
$qa_content['error'] = qa_admin_page_error();
$qa_content['q_list']['qs'] = array();
if (count($questions)) {
foreach ($questions as $question) {
$htmloptions = qa_post_html_defaults('Q');
$htmloptions['voteview'] = false;
$htmloptions['tagsview'] = false;
$htmloptions['answersview'] = false;
$htmlfields = qa_any_to_q_html_fields($question, $qa_login_userid, $qa_cookieid, $usershtml, null, $htmloptions);
if (isset($htmlfields['what_url'])) {
// link directly to relevant content
示例10: get_updated_qs
function get_updated_qs($count)
{
$userid = qa_get_logged_in_userid();
$aselspec = qa_db_recent_a_qs_selectspec($userid, 0, null, null, false, false, $count);
$aselspec['columns']['content'] = '^posts.content';
$aselspec['columns']['notify'] = '^posts.notify';
$aselspec['columns']['updated'] = 'UNIX_TIMESTAMP(^posts.updated)';
$aselspec['columns']['updatetype'] = '^posts.updatetype';
$aselspec['columns'][] = '^posts.format';
$aselspec['columns'][] = '^posts.lastuserid';
$aselspec['columns']['lastip'] = 'INET_NTOA(^posts.lastip)';
$aselspec['columns'][] = '^posts.parentid';
$aselspec['columns']['lastviewip'] = 'INET_NTOA(^posts.lastviewip)';
$cselspec = qa_db_recent_c_qs_selectspec($userid, 0, null, null, false, false, $count);
$cselspec['columns']['content'] = '^posts.content';
$cselspec['columns']['notify'] = '^posts.notify';
$cselspec['columns']['updated'] = 'UNIX_TIMESTAMP(^posts.updated)';
$cselspec['columns']['updatetype'] = '^posts.updatetype';
$cselspec['columns'][] = '^posts.format';
$cselspec['columns'][] = '^posts.lastuserid';
$cselspec['columns']['lastip'] = 'INET_NTOA(^posts.lastip)';
$cselspec['columns'][] = '^posts.parentid';
$cselspec['columns']['lastviewip'] = 'INET_NTOA(^posts.lastviewip)';
$eselspec = qa_db_recent_edit_qs_selectspec($userid, 0, null, null, false, false, $count);
$eselspec['columns']['content'] = '^posts.content';
$eselspec['columns']['notify'] = '^posts.notify';
$eselspec['columns']['updated'] = 'UNIX_TIMESTAMP(^posts.updated)';
$eselspec['columns']['updatetype'] = '^posts.updatetype';
$eselspec['columns'][] = '^posts.format';
$eselspec['columns'][] = '^posts.lastuserid';
$eselspec['columns']['lastip'] = 'INET_NTOA(^posts.lastip)';
$eselspec['columns'][] = '^posts.parentid';
$eselspec['columns']['lastviewip'] = 'INET_NTOA(^posts.lastviewip)';
@(list($questions1, $questions2, $questions3, $questions4) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, null, null, false, true, $count), $aselspec, $cselspec, $eselspec));
$qarray = qa_any_sort_and_dedupe(array_merge($questions1, $questions2, $questions3, $questions4));
// questions
return array_values($qarray);
}
示例11: header
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
*/
示例12: get_user_activity
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;
}