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>'); }
/** * 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']); } } }
$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');
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of 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; } // 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-q-list.php'; // Get list of questions $questions = qa_db_select_with_pending(qa_db_qs_selectspec($qa_login_userid, 'hotness', $qa_start)); // Prepare and return content for theme $qa_content = qa_q_list_page_content($questions, qa_opt('page_size_hot_qs'), $qa_start, qa_opt('cache_qcount'), qa_lang_html('main/hot_qs_title'), qa_lang_html('main/no_questions_found'), null, null, null, null, qa_opt('feed_for_hot') ? 'hot' : null, qa_html_suggest_ask()); return $qa_content; /* Omit PHP closing tag to help avoid accidental output */
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');
$selectsort = 'hotness'; break; case 'votes': $selectsort = 'netvotes'; break; case 'answers': $selectsort = 'acount'; break; case 'views': $selectsort = 'views'; break; default: $selectsort = 'created'; break; } list($questions, $categories, $categoryid) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, $selectsort, $start, $categoryslugs, null, false, false, qa_opt_if_loaded('page_size_qs')), 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']); $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml); } else { $nonetitle = qa_lang_html('main/no_questions_found'); } $categorypathprefix = QA_ALLOW_UNINDEXED_QUERIES ? 'questions/' : null; // this default is applied if sorted not by recent $feedpathprefix = null; $linkparams = array('sort' => $sort); switch ($sort) { case 'hot':
function output_widget($region, $place, $themeobject, $template, $request, $qa_content) { $AdsPos = (int) qa_opt('tw_ads_pos'); 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); $sort = 'created'; $userid = qa_get_logged_in_userid(); $questions = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'created', 0, '', null, false, false, (int) qa_opt('tw_recent_number'))); $hotquestions = qa_db_select_with_pending(qa_db_qs_selectspec($userid, 'hotness', 0, '', null, false, false, (int) qa_opt('tw_popular_number'))); $themeobject->output(' <ul class="tabs nav nav-tabs"> <li><a href="#tab1" class="active">' . qa_opt('tw_popular_lable') . '</a></li> <li><a href="#tab2">' . qa_opt('tw_recent_lable') . '</a></li> </ul> <div class="tab-content" id="tab1"> <ul class="popular"> '); $thumb = ''; $i = 0; foreach ($hotquestions as $question) { $i++; $questionid = $question['postid']; $questionlink = qa_path_html(qa_q_request($questionid, $question['title']), null, qa_opt('site_url')); $q_time = qa_when_to_html($question['created'], 7); $when = @$q_time['prefix'] . ' ' . @$q_time['data'] . ' ' . @$q_time['suffix']; // get question content $result = qa_db_query_sub('SELECT content FROM ^posts WHERE postid=#', $questionid); $postinfo = qa_db_read_one_assoc($result, 'postid'); if (qa_opt('tw_thumbnail_enable')) { // get thumbnail $doc = new DOMDocument(); @$doc->loadHTML($postinfo['content']); $xpath = new DOMXPath($doc); $src = $xpath->evaluate("string(//img/@src)"); $default_thumbnail = qa_opt('tw_thumbnail'); if (empty($src) && !empty($default_thumbnail)) { $src = qa_opt('tw_thumbnail'); } $thumb = ''; if (!empty($src)) { $thumb = '<div class="tab-div-thumb"><a class="tab-link-thumbnail" href="' . $questionlink . '"><img class="tab-thumbnail" width="60" height="50" src="' . $src . '"></a></div>'; } } $themeobject->output('<li>' . $thumb); $themeobject->output('<div class="tab-div-body"><a class="tab-link" href="' . $questionlink . '"><p class="tab-link-header">' . $question['title'] . '</p></a>'); $themeobject->output('<span class="tab-time">' . $when . '</span></div></li>'); $ads_content = qa_opt('tw_ads'); if ($i == $AdsPos && !empty($ads_content)) { $themeobject->output('<div class="tab-ads">' . qa_opt('tw_ads') . '</div>'); } } $themeobject->output(' </ul> </div> <div class="tab-content" id="tab2" style="display: none;"> <ul class="recent"> '); $i = 0; foreach ($questions as $question) { $i++; $questionid = $question['postid']; $questionlink = qa_path_html(qa_q_request($questionid, $question['title']), null, qa_opt('site_url')); $q_time = qa_when_to_html($question['created'], 7); $when = @$q_time['prefix'] . ' ' . @$q_time['data'] . ' ' . @$q_time['suffix']; // get question content $result = qa_db_query_sub('SELECT content FROM ^posts WHERE postid=#', $questionid); $postinfo = qa_db_read_one_assoc($result, 'postid'); if (qa_opt('tw_thumbnail_enable')) { // get thumbnail $doc = new DOMDocument(); @$doc->loadHTML($postinfo['content']); $xpath = new DOMXPath($doc); $src = $xpath->evaluate("string(//img/@src)"); $default_thumbnail = qa_opt('tw_thumbnail'); if (empty($src) && !empty($default_thumbnail)) { $src = qa_opt('tw_thumbnail'); } $thumb = ''; if (!empty($src)) { $thumb = '<div class="tab-div-thumb"><a class="tab-link-thumbnail" href="' . $questionlink . '"><img class="tab-thumbnail" width="60" height="50" src="' . $src . '"></a></div>'; } } $themeobject->output('<li>' . $thumb); $themeobject->output('<div class="tab-div-body"><a class="tab-link" href="' . $questionlink . '"><p class="tab-link-header">' . $question['title'] . '</p></a>'); $themeobject->output('<span class="tab-time">' . $when . '</span></div></li>'); $ads_content = qa_opt('tw_ads'); if ($i == $AdsPos && !empty($ads_content)) { $themeobject->output('<div class="tab-ads">' . qa_opt('tw_ads') . '</div>'); } } $themeobject->output(' </ul> </div> '); }
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]);
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
<?php require_once 'qa-include/qa-base.php'; require_once QA_INCLUDE_DIR . 'db/selects.php'; require_once QA_INCLUDE_DIR . 'app/q-list.php'; //require_once QA_INCLUDE_DIR.'app/users.php'; //$user = qa_get_logged_in_user(); //$userid=$user["userid"];//qa_get_logged_in_userid(); list($questions, $categories, $categoryid) = qa_db_select_with_pending(qa_db_qs_selectspec(null, 'hotness', 0, null, null, false, true), qa_db_category_nav_selectspec(null, false, false, true), null); foreach ($questions as $key => $question) { $questionid = $question["postid"]; $answers = array(); $childposts = qa_db_single_select(qa_db_full_child_posts_selectspec(null, $questionid)); foreach ($childposts as $postid => $post) { if ($post['basetype'] == 'A') { $answers[$postid] = $post; } } $questions[$key]["answers"] = $answers; } $salida = []; foreach ($questions as $pregunta) { $salida[$pregunta["postid"]] = ['userid' => $pregunta["userid"], 'contenido' => substr($pregunta["title"] . ". " . strip_tags($pregunta["content"]), 0, 100)]; foreach ($pregunta["answers"] as $resp) { //$u = Medico::where('user_id','=',$resp["userid"])->first(); //if($u){ $salida[$pregunta["postid"]]["respuestas"][] = ["userid" => $resp["userid"], "contenido" => substr(strip_tags($resp["content"]), 0, 100)]; //} } } header('Content-Type: application/json');
$selectsort = 'hotness'; break; case 'votes': $selectsort = 'netvotes'; break; case 'answers': $selectsort = 'acount'; break; case 'views': $selectsort = 'views'; break; default: $selectsort = 'created'; break; } @(list($questions, $categories, $categoryid, $favorite) = qa_db_select_with_pending(qa_db_qs_selectspec($userid, $selectsort, $start, $categoryslugs, null, false, false, qa_opt_if_loaded('page_size_qs')), qa_db_category_nav_selectspec($categoryslugs, false, false, true), $countslugs ? qa_db_slugs_to_category_id_selectspec($categoryslugs) : null, $countslugs && isset($userid) ? qa_db_is_favorite_selectspec($userid, QA_ENTITY_CATEGORY, $categoryslugs) : null)); if ($countslugs) { if (!isset($categoryid)) { return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } $categorytitlehtml = qa_html($categories[$categoryid]['title']); $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml); } else { $nonetitle = qa_lang_html('main/no_questions_found'); } $categorypathprefix = QA_ALLOW_UNINDEXED_QUERIES ? 'questions/' : null; // this default is applied if sorted not by recent $feedpathprefix = null; $linkparams = array('sort' => $sort); switch ($sort) { case 'hot':
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); }
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);
switch ($sort) { case 'hot': $questionselect = qa_db_qs_selectspec($qa_login_userid, 'hotness', $qa_start, mp_get_categoryslug()); break; case 'votes': $questionselect = qa_db_qs_selectspec($qa_login_userid, 'netvotes', $qa_start, mp_get_categoryslug()); break; case 'answers': $questionselect = qa_db_qs_selectspec($qa_login_userid, 'acount', $qa_start, mp_get_categoryslug()); break; case 'views': $questionselect = qa_db_qs_selectspec($qa_login_userid, 'views', $qa_start, mp_get_categoryslug()); break; default: //$questionselect=qa_db_qs_selectspec($qa_login_userid, 'created', $qa_start, $categoryslugs); $questionselect = qa_db_qs_selectspec($qa_login_userid, 'created', $qa_start, mp_get_categoryslug()); break; } @(list($questions, $categories, $categoryid) = qa_db_select_with_pending($questionselect, 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']); $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml); } else { $nonetitle = qa_lang_html('main/no_questions_found'); } $categorypathprefix = null; // only show category list and feed when sorting by date $feedpathprefix = null;
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]);
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); }
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;
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')) {