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; }
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')) { $qa_content['description'] = qa_html(qa_opt('home_description')); } return $qa_content; /* Omit PHP closing tag to help avoid accidental output */
} foreach ($results as $result) { if (isset($result['question'])) { $fields = qa_post_html_fields($result['question'], $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($result['question'], $qdefaults)); } elseif (isset($result['url'])) { $fields = array('what' => qa_html($result['url']), 'meta_order' => qa_lang_html('main/meta_order')); } else { continue; } // nothing to show here if (isset($qdefaults['blockwordspreg'])) { $result['title'] = qa_block_words_replace($result['title'], $qdefaults['blockwordspreg']); } $fields['title'] = qa_html($result['title']); $fields['url'] = qa_html($result['url']); $qa_content['q_list']['qs'][] = $fields; } $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $start + $gotcount, qa_opt('pages_prev_next'), array('q' => $inquery), $gotcount >= $count); if (qa_opt('feed_for_search')) { $qa_content['feed'] = array('url' => qa_path_html(qa_feed_request('search/' . $inquery)), 'label' => qa_lang_html_sub('main/results_for_x', qa_html($inquery))); } if (empty($qa_content['page_links'])) { $qa_content['suggest_next'] = qa_html_suggest_qs_tags(qa_using_tags()); } } else { $qa_content['error'] = qa_lang_html('main/search_explanation'); } return $qa_content; /* Omit PHP closing tag to help avoid accidental output */
break; case 'upvotes': if ($countslugs) { $sometitle = qa_lang_html_sub('main/unupvoteda_qs_in_x', $categorytitlehtml); $nonetitle = qa_lang_html_sub('main/no_una_questions_in_x', $categorytitlehtml); } else { $sometitle = qa_lang_html('main/unupvoteda_qs_title'); $nonetitle = qa_lang_html('main/no_unupvoteda_qs_found'); $count = qa_opt('cache_unupaqcount'); } break; default: $feedpathprefix = qa_opt('feed_for_unanswered') ? 'unanswered' : null; $linkparams = array(); if ($countslugs) { $sometitle = qa_lang_html_sub('main/unanswered_qs_in_x', $categorytitlehtml); $nonetitle = qa_lang_html_sub('main/no_una_questions_in_x', $categorytitlehtml); } else { $sometitle = qa_lang_html('main/unanswered_qs_title'); $nonetitle = qa_lang_html('main/no_una_questions_found'); $count = qa_opt('cache_unaqcount'); } break; } // Prepare and return content for theme $qa_content = qa_q_list_page_content($questions, qa_opt('page_size_una_qs'), $start, @$count, $sometitle, $nonetitle, QA_ALLOW_UNINDEXED_QUERIES ? $categories : null, QA_ALLOW_UNINDEXED_QUERIES ? $categoryid : null, false, 'unanswered/', $feedpathprefix, qa_html_suggest_qs_tags(qa_using_tags()), $linkparams, $linkparams); $qa_content['navigation']['sub'] = qa_unanswered_sub_navigation($by, $categoryslugs); return $qa_content; /* Omit PHP closing tag to help avoid accidental output */
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 */
list($questions, $tagword) = qa_db_select_with_pending(qa_db_tag_recent_qs_selectspec($userid, $tag, $start, false, qa_opt_if_loaded('page_size_tag_qs')), qa_db_tag_word_selectspec($tag)); $pagesize = qa_opt('page_size_tag_qs'); $questions = array_slice($questions, 0, $pagesize); $usershtml = qa_userids_handles_html($questions); // Prepare content for theme $qa_content = qa_content_prepare(true); $qa_content['title'] = qa_lang_html_sub('main/questions_tagged_x', qa_html($tag)); if (isset($userid) && isset($tagword)) { $favoritemap = qa_get_favorite_non_qs_map(); $favorite = @$favoritemap['tag'][qa_strtolower($tagword['word'])]; $qa_content['favorite'] = qa_favorite_form(QA_ENTITY_TAG, $tagword['wordid'], $favorite, qa_lang_sub($favorite ? 'main/remove_x_favorites' : 'main/add_tag_x_favorites', $tagword['word'])); } if (!count($questions)) { $qa_content['q_list']['title'] = qa_lang_html('main/no_questions_found'); } $qa_content['q_list']['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'hidden' => array('code' => qa_get_form_security_code('vote'))); $qa_content['q_list']['qs'] = array(); foreach ($questions as $postid => $question) { $qa_content['q_list']['qs'][] = qa_post_html_fields($question, $userid, qa_cookie_get(), $usershtml, null, qa_post_html_options($question)); } $qa_content['page_links'] = qa_html_page_links(qa_request(), $start, $pagesize, $tagword['tagcount'], qa_opt('pages_prev_next')); if (empty($qa_content['page_links'])) { $qa_content['suggest_next'] = qa_html_suggest_qs_tags(true); } if (qa_opt('feed_for_tag_qs')) { $qa_content['feed'] = array('url' => qa_path_html(qa_feed_request('tag/' . $tag)), 'label' => qa_lang_html_sub('main/questions_tagged_x', qa_html($tag))); } return $qa_content; /* Omit PHP closing tag to help avoid accidental output */
$linkparams = array('sort' => $sort); switch ($sort) { case 'hot': $sometitle = $countslugs ? qa_lang_html_sub('main/hot_qs_in_x', $categorytitlehtml) : qa_lang_html('main/hot_qs_title'); $feedpathprefix = qa_opt('feed_for_hot') ? 'hot' : null; break; case 'votes': $sometitle = $countslugs ? qa_lang_html_sub('main/voted_qs_in_x', $categorytitlehtml) : qa_lang_html('main/voted_qs_title'); break; case 'answers': $sometitle = $countslugs ? qa_lang_html_sub('main/answered_qs_in_x', $categorytitlehtml) : qa_lang_html('main/answered_qs_title'); break; case 'views': $sometitle = $countslugs ? qa_lang_html_sub('main/viewed_qs_in_x', $categorytitlehtml) : qa_lang_html('main/viewed_qs_title'); break; default: $linkparams = array(); $sometitle = $countslugs ? qa_lang_html_sub('main/recent_qs_in_x', $categorytitlehtml) : qa_lang_html('main/recent_qs_title'); $categorypathprefix = 'questions/'; $feedpathprefix = qa_opt('feed_for_questions') ? 'questions' : null; break; } // Prepare and return content for theme $qa_content = qa_q_list_page_content($questions, qa_opt('page_size_qs'), $start, $countslugs ? $categories[$categoryid]['qcount'] : qa_opt('cache_qcount'), $sometitle, $nonetitle, $categories, $categoryid, true, $categorypathprefix, $feedpathprefix, $countslugs ? qa_html_suggest_qs_tags(qa_using_tags()) : qa_html_suggest_ask($categoryid), $linkparams, $linkparams); if (QA_ALLOW_UNINDEXED_QUERIES || !$countslugs) { $qa_content['navigation']['sub'] = qa_qs_sub_navigation($sort, $categoryslugs); } return $qa_content; /* Omit PHP closing tag to help avoid accidental output */
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 */