/** * Process the delete hidden posts request from the admin */ function ami_dhp_delete_hidden_posts_process() { // load all required files if not loaded require_once QA_INCLUDE_DIR . 'qa-app-admin.php'; require_once QA_INCLUDE_DIR . 'qa-db-admin.php'; require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; // Check admin privileges if (qa_user_maximum_permit_error('permit_hide_show') && qa_user_maximum_permit_error('permit_delete_hidden')) { return false; } $userid = qa_get_logged_in_userid(); // Find recently hidden questions, answers, comments list($hiddenquestions, $hiddenanswers, $hiddencomments) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, null, null, 'Q_HIDDEN', true), qa_db_recent_a_qs_selectspec($userid, 0, null, null, 'A_HIDDEN', true), qa_db_recent_c_qs_selectspec($userid, 0, null, null, 'C_HIDDEN', true)); // first delete all hidden posts if (count($hiddencomments)) { foreach ($hiddencomments as $hiddencomment) { ami_dhp_post_delete_recursive($hiddencomment['opostid']); } } // delete all the hidden answers if (count($hiddenanswers)) { foreach ($hiddenanswers as $hiddenanswer) { ami_dhp_post_delete_recursive($hiddenanswer['opostid']); } } // delete all the hidden questions if (count($hiddenquestions)) { foreach ($hiddenquestions as $hiddenquestion) { ami_dhp_post_delete_recursive($hiddenquestion['postid']); } } }
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>'); }
require_once QA_INCLUDE_DIR . 'db/selects.php'; require_once QA_INCLUDE_DIR . 'app/format.php'; // Determine whether path begins with qa or not (question and answer listing can be accessed either way) $requestparts = explode('/', qa_request()); $explicitqa = strtolower($requestparts[0]) == 'qa'; if ($explicitqa) { $slugs = array_slice($requestparts, 1); } elseif (strlen($requestparts[0])) { $slugs = $requestparts; } else { $slugs = array(); } $countslugs = count($slugs); // Get list of questions, other bits of information that might be useful $userid = qa_get_logged_in_userid(); list($questions1, $questions2, $categories, $categoryid, $custompage) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, $slugs, null, false, false, qa_opt_if_loaded('page_size_activity')), qa_db_recent_a_qs_selectspec($userid, 0, $slugs), qa_db_category_nav_selectspec($slugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null, $countslugs == 1 && !$explicitqa ? qa_db_page_full_selectspec($slugs[0], false) : null); // First, if this matches a custom page, return immediately with that page's content if (isset($custompage) && !($custompage['flags'] & QA_PAGE_FLAGS_EXTERNAL)) { qa_set_template('custom-' . $custompage['pageid']); $qa_content = qa_content_prepare(); $level = qa_get_logged_in_level(); if (!qa_permit_value_error($custompage['permit'], $userid, $level, qa_get_logged_in_flags()) || !isset($custompage['permit'])) { $qa_content['title'] = qa_html($custompage['heading']); $qa_content['custom'] = $custompage['content']; if ($level >= QA_USER_LEVEL_ADMIN) { $qa_content['navigation']['sub'] = array('admin/pages' => array('label' => qa_lang('admin/edit_custom_page'), 'url' => qa_path_html('admin/pages', array('edit' => $custompage['pageid'])))); } } else { $qa_content['error'] = qa_lang_html('users/no_permission'); } return $qa_content;
GNU General Public License for more details. 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 . 'app/admin.php'; require_once QA_INCLUDE_DIR . 'db/admin.php'; require_once QA_INCLUDE_DIR . 'db/selects.php'; require_once QA_INCLUDE_DIR . 'app/format.php'; // Find recently hidden questions, answers, comments $userid = qa_get_logged_in_userid(); list($hiddenquestions, $hiddenanswers, $hiddencomments) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, null, null, 'Q_HIDDEN', true), qa_db_recent_a_qs_selectspec($userid, 0, null, null, 'A_HIDDEN', true), qa_db_recent_c_qs_selectspec($userid, 0, null, null, 'C_HIDDEN', true)); // Check admin privileges (do late to allow one DB query) if (qa_user_maximum_permit_error('permit_hide_show') && qa_user_maximum_permit_error('permit_delete_hidden')) { $qa_content = qa_content_prepare(); $qa_content['error'] = qa_lang_html('users/no_permission'); return $qa_content; } // Check to see if any have been reshown or deleted $pageerror = qa_admin_check_clicks(); // Combine sets of questions and remove those this user has no permissions for $questions = qa_any_sort_by_date(array_merge($hiddenquestions, $hiddenanswers, $hiddencomments)); if (qa_user_permit_error('permit_hide_show') && qa_user_permit_error('permit_delete_hidden')) { // not allowed to see all hidden posts foreach ($questions as $index => $question) { if (qa_user_post_permit_error('permit_hide_show', $question) && qa_user_post_permit_error('permit_delete_hidden', $question)) { unset($questions[$index]);
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. 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 . 'app/admin.php'; require_once QA_INCLUDE_DIR . 'db/selects.php'; require_once QA_INCLUDE_DIR . 'app/format.php'; // Find queued questions, answers, comments $userid = qa_get_logged_in_userid(); list($queuedquestions, $queuedanswers, $queuedcomments) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, null, null, 'Q_QUEUED', true), qa_db_recent_a_qs_selectspec($userid, 0, null, null, 'A_QUEUED', true), qa_db_recent_c_qs_selectspec($userid, 0, null, null, 'C_QUEUED', true)); // Check admin privileges (do late to allow one DB query) if (qa_user_maximum_permit_error('permit_moderate')) { $qa_content = qa_content_prepare(); $qa_content['error'] = qa_lang_html('users/no_permission'); return $qa_content; } // Check to see if any were approved/rejected here $pageerror = qa_admin_check_clicks(); // Combine sets of questions and remove those this user has no permission to moderate $questions = qa_any_sort_by_date(array_merge($queuedquestions, $queuedanswers, $queuedcomments)); if (qa_user_permit_error('permit_moderate')) { // if user not allowed to moderate all posts foreach ($questions as $index => $question) { if (qa_user_post_permit_error('permit_moderate', $question)) { unset($questions[$index]);
require_once '../../qa-include/qa-base.php'; qa_report_process_stage('init_ajax'); // Get general Ajax parameters from the POST payload, and clear $_GET qa_set_request(qa_post_text('qa_request'), qa_post_text('qa_root')); 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-users.php'; require_once QA_INCLUDE_DIR . 'qa-app-options.php'; require_once QA_INCLUDE_DIR . 'qa-app-q-list.php'; //require_once QA_INCLUDE_DIR.'qa-page.php'; //qa_set_template('qa'); $pagesize = qa_opt('page_size_home'); $page_number = (int) $_POST['page']; $limit = (int) $pagesize * $page_number; $userid = qa_get_logged_in_userid(); list($questions1, $questions2) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, null, null, false, false, $limit), qa_db_recent_a_qs_selectspec($userid, 0, null, null, false, false, $limit)); $questions = qa_any_sort_and_dedupe(array_merge($questions1, $questions2)); array_splice($questions, 0, (int) $pagesize * ($page_number - 1)); $qa_content = it_q_list_page_content($questions, $pagesize, 0, null, '', '', null, null, false, '', null, '', null, null); //echo "QA_AJAX_RESPONSE\n1\n"; $themeclass = qa_load_theme_class(qa_get_site_theme(), 'qa', null, null); $themeclass->q_list($qa_content["q_list"]); die; 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);
$questions = qa_feed_load_ifcategory($categoryslugs, 'main/hot_qs_title', 'main/hot_qs_in_x', $title, qa_db_qs_selectspec(null, 'hotness', 0, $categoryslugs, null, false, $full, $count)); break; case 'unanswered': $questions = qa_feed_load_ifcategory($categoryslugs, 'main/unanswered_qs_title', 'main/unanswered_qs_in_x', $title, qa_db_unanswered_qs_selectspec(null, null, 0, $categoryslugs, false, $full, $count)); 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();
*/ 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'; $ip = qa_request_part(1); // picked up from qa-page.php if (long2ip(ip2long($ip)) !== $ip) { return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } // Find recently (hidden, queued or not) questions, answers, comments and edits for this IP $userid = qa_get_logged_in_userid(); list($qs, $qs_queued, $qs_hidden, $a_qs, $a_queued_qs, $a_hidden_qs, $c_qs, $c_queued_qs, $c_hidden_qs, $edit_qs) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, null, $ip, false), qa_db_qs_selectspec($userid, 'created', 0, null, $ip, 'Q_QUEUED'), qa_db_qs_selectspec($userid, 'created', 0, null, $ip, 'Q_HIDDEN', true), qa_db_recent_a_qs_selectspec($userid, 0, null, $ip, false), qa_db_recent_a_qs_selectspec($userid, 0, null, $ip, 'A_QUEUED'), qa_db_recent_a_qs_selectspec($userid, 0, null, $ip, 'A_HIDDEN', true), qa_db_recent_c_qs_selectspec($userid, 0, null, $ip, false), qa_db_recent_c_qs_selectspec($userid, 0, null, $ip, 'C_QUEUED'), qa_db_recent_c_qs_selectspec($userid, 0, null, $ip, 'C_HIDDEN', true), qa_db_recent_edit_qs_selectspec($userid, 0, null, $ip, false)); // Check we have permission to view this page, and whether we can block or unblock IPs if (qa_user_maximum_permit_error('permit_anon_view_ips')) { $qa_content = qa_content_prepare(); $qa_content['error'] = qa_lang_html('users/no_permission'); return $qa_content; } $blockable = qa_user_level_maximum() >= QA_USER_LEVEL_MODERATOR; // allow moderator in one category to block across all categories // Perform blocking or unblocking operations as appropriate if (qa_clicked('doblock') || qa_clicked('dounblock') || qa_clicked('dohideall')) { if (!qa_check_form_security_code('ip-' . $ip, qa_post_text('code'))) { $pageerror = qa_lang_html('misc/form_security_again'); } elseif ($blockable) { if (qa_clicked('doblock')) { $oldblocked = qa_opt('block_ips_write');
GNU General Public License for more details. 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; } // 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');
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); }
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 answers with related questions, plus category information @(list($questions, $categories, $categoryid) = qa_db_select_with_pending(qa_db_recent_a_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_as_in_x', $categorytitlehtml); $nonetitle = qa_lang_html_sub('main/no_answers_in_x', $categorytitlehtml); } else { $sometitle = qa_lang_html('main/recent_as_title'); $nonetitle = qa_lang_html('main/no_answers_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, 'answers/', qa_opt('feed_for_activity') ? 'answers' : null, qa_html_suggest_qs_tags(qa_using_tags(), qa_category_path_request($categories, $categoryid))); /* 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
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; } // 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-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; require_once QA_INCLUDE_DIR . 'qa-app-q-list.php'; $categoryslugs = $pass_subrequests; $countslugs = count($categoryslugs); // 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($qa_login_userid, 'created', 0, $categoryslugs), qa_db_recent_a_qs_selectspec($qa_login_userid, 0, $categoryslugs), qa_db_recent_c_qs_selectspec($qa_login_userid, 0, $categoryslugs), qa_db_recent_edit_qs_selectspec($qa_login_userid, 0, $categoryslugs), qa_db_category_nav_selectspec($categoryslugs, false), $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))); /* Omit PHP closing tag to help avoid accidental output
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-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; // Determine whether path begins with qa or not (question and answer listing can be accessed either way) $explicitqa = $qa_request_lc_parts[0] == 'qa'; if ($explicitqa) { $slugs = array_slice($qa_request_parts, 1); } elseif (strlen($qa_request_parts[0])) { // $qa_request_parts[0] always present so we need to check its length $slugs = $qa_request_parts; } else { $slugs = array(); } $countslugs = count($slugs); // Get list of questions, other bits of information that might be @(list($questions1, $questions2, $categories, $categoryid, $custompage) = qa_db_select_with_pending(qa_db_qs_selectspec($qa_login_userid, 'created', 0, $slugs), qa_db_recent_a_qs_selectspec($qa_login_userid, 0, $slugs), qa_db_category_nav_selectspec($slugs, false), $countslugs ? qa_db_slugs_to_category_id_selectspec($slugs) : null, $countslugs == 1 && !$explicitqa ? qa_db_page_full_selectspec($slugs[0], false) : null)); // First, if this matches a custom page, return immediately with that page's content if (isset($custompage) && !($custompage['flags'] & QA_PAGE_FLAGS_EXTERNAL)) { $qa_template = 'custom'; $qa_content = qa_content_prepare(); $qa_content['title'] = qa_html($custompage['heading']); $qa_content['custom'] = $custompage['content']; if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN) { $qa_content['navigation']['sub'] = array('admin/pages' => array('label' => qa_lang('admin/edit_custom_page'), 'url' => qa_path_html('admin/pages', array('edit' => $custompage['pageid'])))); } return $qa_content; } // Then, see if we should redirect because the 'qa' page is the same as the home page if ($explicitqa && !qa_is_http_post() && !qa_has_custom_home()) { qa_redirect(qa_category_path_request($categories, $categoryid), $_GET); }
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser 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-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; $ip = @$pass_subrequests[0]; // picked up from qa-page.php if (long2ip(ip2long($ip)) !== $ip) { return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } // Find recently (hidden or not) questions, answers, comments and edits list($qs, $qs_hidden, $a_qs, $a_hidden_qs, $c_qs, $c_hidden_qs, $edit_qs) = qa_db_select_with_pending(qa_db_qs_selectspec($qa_login_userid, 'created', 0, null, $ip, false), qa_db_qs_selectspec($qa_login_userid, 'created', 0, null, $ip, true, true), qa_db_recent_a_qs_selectspec($qa_login_userid, 0, null, $ip, false), qa_db_recent_a_qs_selectspec($qa_login_userid, 0, null, $ip, true, true), qa_db_recent_c_qs_selectspec($qa_login_userid, 0, null, $ip, false), qa_db_recent_c_qs_selectspec($qa_login_userid, 0, null, $ip, true, true), qa_db_recent_edit_qs_selectspec($qa_login_userid, 0, null, $ip, false)); // Check we have permission to view this page, and whether we can block or unblock IPs if (qa_user_permit_error('permit_anon_view_ips')) { $qa_content = qa_content_prepare(); $qa_content['error'] = qa_lang_html('users/no_permission'); return $qa_content; } $blockable = qa_get_logged_in_level() >= QA_USER_LEVEL_MODERATOR; // Perform blocking or unblocking operations as appropriate if ($blockable) { if (qa_clicked('doblock')) { $oldblocked = qa_opt('block_ips_write'); qa_set_option('block_ips_write', (strlen($oldblocked) ? $oldblocked . ' , ' : '') . $ip); qa_redirect($qa_request); } if (qa_clicked('dounblock')) {