break; case 'answers': $questions = qa_feed_load_ifcategory($categoryslugs, 'main/recent_as_title', 'main/recent_as_in_x', $title, qa_db_recent_a_qs_selectspec(null, 0, $categoryslugs, null, false, $full, $count)); break; case 'comments': $questions = qa_feed_load_ifcategory($categoryslugs, 'main/recent_cs_title', 'main/recent_cs_in_x', $title, qa_db_recent_c_qs_selectspec(null, 0, $categoryslugs, null, false, $full, $count)); break; case 'qa': $questions = qa_feed_load_ifcategory($categoryslugs, 'main/recent_qs_as_title', 'main/recent_qs_as_in_x', $title, qa_db_qs_selectspec(null, 'created', 0, $categoryslugs, null, false, $full, $count), qa_db_recent_a_qs_selectspec(null, 0, $categoryslugs, null, false, $full, $count)); break; case 'activity': $questions = qa_feed_load_ifcategory($categoryslugs, 'main/recent_activity_title', 'main/recent_activity_in_x', $title, qa_db_qs_selectspec(null, 'created', 0, $categoryslugs, null, false, $full, $count), qa_db_recent_a_qs_selectspec(null, 0, $categoryslugs, null, false, $full, $count), qa_db_recent_c_qs_selectspec(null, 0, $categoryslugs, null, false, $full, $count), qa_db_recent_edit_qs_selectspec(null, 0, $categoryslugs, null, true, $full, $count)); break; case 'tag': $tag = $feedparams[0]; $questions = qa_feed_load_ifcategory(null, null, null, $title, qa_db_tag_recent_qs_selectspec(null, $tag, 0, $full, $count)); $title = qa_lang_sub('main/questions_tagged_x', $tag); $linkrequest = 'tag/' . $tag; break; case 'search': require_once QA_INCLUDE_DIR . 'app/search.php'; $query = $feedparams[0]; $results = qa_get_search_results($query, 0, $count, null, true, $full); $title = qa_lang_sub('main/results_for_x', $query); $linkrequest = 'search'; $linkparams = array('q' => $query); $questions = array(); foreach ($results as $result) { $setarray = array('title' => $result['title'], 'url' => $result['url']); if (isset($result['question'])) { $questions[] = array_merge($result['question'], $setarray);
qa_feed_load_ifcategory('main/recent_qs_as_title', 'main/recent_qs_as_in_x', qa_db_qs_selectspec(null, 'created', 0, $categoryslugs, null, false, $full, $count), qa_db_recent_a_qs_selectspec(null, 0, $categoryslugs, null, false, $full, $count)); break; case 'activity': qa_feed_load_ifcategory('main/recent_activity_title', 'main/recent_activity_in_x', qa_db_qs_selectspec(null, 'created', 0, $categoryslugs, null, false, $full, $count), qa_db_recent_a_qs_selectspec(null, 0, $categoryslugs, null, false, $full, $count), qa_db_recent_c_qs_selectspec(null, 0, $categoryslugs, null, false, $full, $count), qa_db_recent_edit_qs_selectspec(null, 0, $categoryslugs, null, true, $full, $count)); break; case 'tag': $tag = $feedparams[0]; qa_feed_load_ifcategory(null, null, qa_db_tag_recent_qs_selectspec(null, $tag, 0, $full, $count)); $title = qa_lang_sub('main/questions_tagged_x', $tag); $linkrequest = 'tag/' . $tag; break; case 'search': require_once QA_INCLUDE_DIR . 'qa-util-string.php'; $query = $feedparams[0]; $words = qa_string_to_words($query); qa_feed_load_ifcategory(null, null, qa_db_search_posts_selectspec(null, $words, $words, $words, $words, trim($query), 0, $full, $count)); $title = qa_lang_sub('main/results_for_x', $query); $linkrequest = 'search'; $linkparams = array('q' => $query); break; } // Remove duplicate questions (perhaps referenced in an answer and a comment) and cut down to size require_once QA_INCLUDE_DIR . 'qa-app-format.php'; require_once QA_INCLUDE_DIR . 'qa-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(); // Disconnect as quickly as possible to free up resources