/** * 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']); } } }
$in = array(); $followpostid = qa_get('follow'); $in['categoryid'] = qa_get_category_field_value('category'); if (!isset($in['categoryid'])) { $in['categoryid'] = qa_get('cat'); } $userid = qa_get_logged_in_userid(); list($categories, $followanswer, $completetags) = qa_db_select_with_pending(qa_db_category_nav_selectspec($in['categoryid'], true), isset($followpostid) ? qa_db_full_post_selectspec($userid, $followpostid) : null, qa_db_popular_tags_selectspec(0, QA_DB_RETRIEVE_COMPLETE_TAGS)); if (!isset($categories[$in['categoryid']])) { $in['categoryid'] = null; } if (@$followanswer['basetype'] != 'A') { $followanswer = null; } // Check for permission error $permiterror = qa_user_maximum_permit_error('permit_post_q', QA_LIMIT_QUESTIONS); if ($permiterror) { $qa_content = qa_content_prepare(); // The 'approve', 'login', 'confirm', 'limit', 'userblock', 'ipblock' permission errors are reported to the user here // The other option ('level') prevents the menu option being shown, in qa_content_prepare(...) switch ($permiterror) { case 'login': $qa_content['error'] = qa_insert_login_links(qa_lang_html('question/ask_must_login'), qa_request(), isset($followpostid) ? array('follow' => $followpostid) : null); break; case 'confirm': $qa_content['error'] = qa_insert_login_links(qa_lang_html('question/ask_must_confirm'), qa_request(), isset($followpostid) ? array('follow' => $followpostid) : null); break; case 'limit': $qa_content['error'] = qa_lang_html('question/ask_limit'); break; case 'approve':
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 . '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]); } }
$qa_content['title'] = qa_lang_html_sub('main/ip_address_x', qa_html($ip)); $qa_content['error'] = @$pageerror; $qa_content['form'] = array('tags' => 'method="post" action="' . qa_self_html() . '"', 'style' => 'wide', 'fields' => array('host' => array('type' => 'static', 'label' => qa_lang_html('misc/host_name'), 'value' => qa_html($hostname))), 'hidden' => array('code' => qa_get_form_security_code('ip-' . $ip))); if ($blockable) { require_once QA_INCLUDE_DIR . 'qa-app-limits.php'; $blockipclauses = qa_block_ips_explode(qa_opt('block_ips_write')); $matchclauses = array(); foreach ($blockipclauses as $blockipclause) { if (qa_block_ip_match($ip, $blockipclause)) { $matchclauses[] = $blockipclause; } } if (count($matchclauses)) { $qa_content['form']['fields']['status'] = array('type' => 'static', 'label' => qa_lang_html('misc/matches_blocked_ips'), 'value' => qa_html(implode("\n", $matchclauses), true)); $qa_content['form']['buttons']['unblock'] = array('tags' => 'name="dounblock"', 'label' => qa_lang_html('misc/unblock_ip_button')); if (count($questions) && !qa_user_maximum_permit_error('permit_hide_show')) { $qa_content['form']['buttons']['hideall'] = array('tags' => 'name="dohideall" onclick="qa_show_waiting_after(this, false);"', 'label' => qa_lang_html('misc/hide_all_ip_button')); } } else { $qa_content['form']['buttons']['block'] = array('tags' => 'name="doblock"', 'label' => qa_lang_html('misc/block_ip_button')); } } $qa_content['q_list']['qs'] = array(); if (count($questions)) { $qa_content['q_list']['title'] = qa_lang_html_sub('misc/recent_activity_from_x', qa_html($ip)); foreach ($questions as $question) { $htmloptions = qa_post_html_options($question); $htmloptions['tagsview'] = false; $htmloptions['voteview'] = false; $htmloptions['ipview'] = false; $htmloptions['answersview'] = false;
function qa_load_theme_class($theme, $template, $content, $request) { if (qa_to_override(__FUNCTION__)) { $args = func_get_args(); return qa_call_override(__FUNCTION__, $args); } global $qa_layers; // First load the default class require_once QA_INCLUDE_DIR . 'qa-theme-base.php'; $classname = 'qa_html_theme_base'; // Then load the selected theme if valid, otherwise load the Classic theme if (!file_exists(QA_THEME_DIR . $theme . '/qa-styles.css')) { $theme = 'Classic'; } $themeroothtml = qa_html(qa_path_to_root() . 'qa-theme/' . $theme . '/'); if (file_exists(QA_THEME_DIR . $theme . '/qa-theme.php')) { require_once QA_THEME_DIR . $theme . '/qa-theme.php'; if (class_exists('qa_html_theme')) { $classname = 'qa_html_theme'; } } // Create the list of layers to load $loadlayers = $qa_layers; if (!qa_user_maximum_permit_error('permit_view_voters_flaggers')) { $loadlayers[] = array('directory' => QA_INCLUDE_DIR . 'plugins/', 'include' => 'qa-layer-voters-flaggers.php', 'urltoroot' => null); } // Then load any theme layers using some class-munging magic (substitute class names) $layerindex = 0; foreach ($loadlayers as $layer) { $filename = $layer['directory'] . $layer['include']; $layerphp = file_get_contents($filename); if (strlen($layerphp)) { $newclassname = 'qa_layer_' . ++$layerindex . '_from_' . preg_replace('/[^A-Za-z0-9_]+/', '_', basename($layer['include'])); // include file name in layer class name to make debugging easier if there is an error if (preg_match('/\\s+class\\s+qa_html_theme_layer\\s+extends\\s+qa_html_theme_base\\s+/im', $layerphp) != 1) { qa_fatal_error('Class for layer must be declared as "class qa_html_theme_layer extends qa_html_theme_base" in ' . $layer['directory'] . $layer['include']); } $searchwordreplace = array('qa_html_theme_base::qa_html_theme_base' => $classname . '::__construct', 'parent::qa_html_theme_base' => 'parent::__construct', 'qa_html_theme_layer' => $newclassname, 'qa_html_theme_base' => $classname, 'QA_HTML_THEME_LAYER_DIRECTORY' => "'" . $layer['directory'] . "'", 'QA_HTML_THEME_LAYER_URLTOROOT' => "'" . qa_path_to_root() . $layer['urltoroot'] . "'"); foreach ($searchwordreplace as $searchword => $replace) { if (preg_match_all('/\\W(' . preg_quote($searchword, '/') . ')\\W/im', $layerphp, $matches, PREG_PATTERN_ORDER | PREG_OFFSET_CAPTURE)) { $searchmatches = array_reverse($matches[1]); // don't use preg_replace due to complication of escaping replacement phrase foreach ($searchmatches as $searchmatch) { $layerphp = substr_replace($layerphp, $replace, $searchmatch[1], strlen($searchmatch[0])); } } } // echo '<pre style="text-align:left;">'.htmlspecialchars($layerphp).'</pre>'; // to debug munged code qa_eval_from_file($layerphp, $filename); $classname = $newclassname; } } // Finally, instantiate the object $themeclass = new $classname($template, $content, $themeroothtml, $request); return $themeclass; }
function qa_admin_sub_navigation() { if (qa_to_override(__FUNCTION__)) { $args = func_get_args(); return qa_call_override(__FUNCTION__, $args); } $navigation = array(); $level = qa_get_logged_in_level(); if ($level >= QA_USER_LEVEL_ADMIN) { $navigation['admin/general'] = array('label' => qa_lang_html('admin/general_title'), 'url' => qa_path_html('admin/general')); $navigation['admin/emails'] = array('label' => qa_lang_html('admin/emails_title'), 'url' => qa_path_html('admin/emails')); $navigation['admin/users'] = array('label' => qa_lang_html('admin/users_title'), 'url' => qa_path_html('admin/users'), 'selected_on' => array('admin/users$', 'admin/userfields$', 'admin/usertitles$')); if ($level >= QA_USER_LEVEL_SUPER) { $navigation['admin/layout'] = array('label' => qa_lang_html('admin/layout_title'), 'url' => qa_path_html('admin/layout')); } $navigation['admin/posting'] = array('label' => qa_lang_html('admin/posting_title'), 'url' => qa_path_html('admin/posting')); $navigation['admin/viewing'] = array('label' => qa_lang_html('admin/viewing_title'), 'url' => qa_path_html('admin/viewing')); $navigation['admin/lists'] = array('label' => qa_lang_html('admin/lists_title'), 'url' => qa_path_html('admin/lists')); if (qa_using_categories()) { $navigation['admin/categories'] = array('label' => qa_lang_html('admin/categories_title'), 'url' => qa_path_html('admin/categories')); } $navigation['admin/permissions'] = array('label' => qa_lang_html('admin/permissions_title'), 'url' => qa_path_html('admin/permissions')); if ($level >= QA_USER_LEVEL_SUPER) { $navigation['admin/pages'] = array('label' => qa_lang_html('admin/pages_title'), 'url' => qa_path_html('admin/pages')); } $navigation['admin/feeds'] = array('label' => qa_lang_html('admin/feeds_title'), 'url' => qa_path_html('admin/feeds')); $navigation['admin/points'] = array('label' => qa_lang_html('admin/points_title'), 'url' => qa_path_html('admin/points')); $navigation['admin/spam'] = array('label' => qa_lang_html('admin/spam_title'), 'url' => qa_path_html('admin/spam')); if ($level >= QA_USER_LEVEL_SUPER) { $navigation['admin/stats'] = array('label' => qa_lang_html('admin/stats_title'), 'url' => qa_path_html('admin/stats')); } if (!QA_FINAL_EXTERNAL_USERS) { $navigation['admin/mailing'] = array('label' => qa_lang_html('admin/mailing_title'), 'url' => qa_path_html('admin/mailing')); } if ($level >= QA_USER_LEVEL_SUPER) { $navigation['admin/plugins'] = array('label' => qa_lang_html('admin/plugins_title'), 'url' => qa_path_html('admin/plugins')); } } if (!qa_user_maximum_permit_error('permit_moderate')) { $count = qa_user_permit_error('permit_moderate') ? null : qa_opt('cache_queuedcount'); // if only in some categories don't show cached count $navigation['admin/moderate'] = array('label' => qa_lang_html('admin/moderate_title') . ($count ? ' (' . $count . ')' : ''), 'url' => qa_path_html('admin/moderate')); } if (qa_opt('flagging_of_posts') && !qa_user_maximum_permit_error('permit_hide_show')) { $count = qa_user_permit_error('permit_hide_show') ? null : qa_opt('cache_flaggedcount'); // if only in some categories don't show cached count $navigation['admin/flagged'] = array('label' => qa_lang_html('admin/flagged_title') . ($count ? ' (' . $count . ')' : ''), 'url' => qa_path_html('admin/flagged')); } if (!qa_user_maximum_permit_error('permit_hide_show') || !qa_user_maximum_permit_error('permit_delete_hidden')) { $navigation['admin/hidden'] = array('label' => qa_lang_html('admin/hidden_title'), 'url' => qa_path_html('admin/hidden')); } if (!QA_FINAL_EXTERNAL_USERS && qa_opt('moderate_users') && $level >= QA_USER_LEVEL_MODERATOR) { $count = qa_opt('cache_uapprovecount'); $navigation['admin/approve'] = array('label' => qa_lang_html('admin/approve_users_title') . ($count ? ' (' . $count . ')' : ''), 'url' => qa_path_html('admin/approve')); } return $navigation; }
function qa_content_prepare($voting = false, $categoryids = null) { if (qa_to_override(__FUNCTION__)) { $args = func_get_args(); return qa_call_override(__FUNCTION__, $args); } global $qa_template, $qa_page_error_html; if (QA_DEBUG_PERFORMANCE) { global $qa_usage; $qa_usage->mark('control'); } $request = qa_request(); $requestlower = qa_request(); $navpages = qa_db_get_pending_result('navpages'); $widgets = qa_db_get_pending_result('widgets'); if (isset($categoryids) && !is_array($categoryids)) { // accept old-style parameter $categoryids = array($categoryids); } $lastcategoryid = count($categoryids) ? end($categoryids) : null; $charset = 'utf-8'; $qa_content = array('content_type' => 'text/html; charset=' . $charset, 'charset' => $charset, 'direction' => qa_opt('site_text_direction'), 'site_title' => qa_html(qa_opt('site_title')), 'head_lines' => array(), 'navigation' => array('user' => array(), 'main' => array(), 'footer' => array('feedback' => array('url' => qa_path_html('feedback'), 'label' => qa_lang_html('main/nav_feedback')))), 'sidebar' => qa_opt('show_custom_sidebar') ? qa_opt('custom_sidebar') : null, 'sidepanel' => qa_opt('show_custom_sidepanel') ? qa_opt('custom_sidepanel') : null, 'widgets' => array()); if (qa_opt('show_custom_in_head')) { $qa_content['head_lines'][] = qa_opt('custom_in_head'); } if (qa_opt('show_custom_header')) { $qa_content['body_header'] = qa_opt('custom_header'); } if (qa_opt('show_custom_footer')) { $qa_content['body_footer'] = qa_opt('custom_footer'); } if (isset($categoryids)) { $qa_content['categoryids'] = $categoryids; } foreach ($navpages as $page) { if ($page['nav'] == 'B') { qa_navigation_add_page($qa_content['navigation']['main'], $page); } } if (qa_opt('nav_home') && qa_opt('show_custom_home')) { $qa_content['navigation']['main']['$'] = array('url' => qa_path_html(''), 'label' => qa_lang_html('main/nav_home')); } if (qa_opt('nav_activity')) { $qa_content['navigation']['main']['activity'] = array('url' => qa_path_html('activity'), 'label' => qa_lang_html('main/nav_activity')); } $hascustomhome = qa_has_custom_home(); if (qa_opt($hascustomhome ? 'nav_qa_not_home' : 'nav_qa_is_home')) { $qa_content['navigation']['main'][$hascustomhome ? 'qa' : '$'] = array('url' => qa_path_html($hascustomhome ? 'qa' : ''), 'label' => qa_lang_html('main/nav_qa')); } if (qa_opt('nav_questions')) { $qa_content['navigation']['main']['questions'] = array('url' => qa_path_html('questions'), 'label' => qa_lang_html('main/nav_qs')); } if (qa_opt('nav_hot')) { $qa_content['navigation']['main']['hot'] = array('url' => qa_path_html('hot'), 'label' => qa_lang_html('main/nav_hot')); } if (qa_opt('nav_unanswered')) { $qa_content['navigation']['main']['unanswered'] = array('url' => qa_path_html('unanswered'), 'label' => qa_lang_html('main/nav_unanswered')); } if (qa_using_tags() && qa_opt('nav_tags')) { $qa_content['navigation']['main']['tag'] = array('url' => qa_path_html('tags'), 'label' => qa_lang_html('main/nav_tags'), 'selected_on' => array('tags$', 'tag/')); } if (qa_using_categories() && qa_opt('nav_categories')) { $qa_content['navigation']['main']['categories'] = array('url' => qa_path_html('categories'), 'label' => qa_lang_html('main/nav_categories'), 'selected_on' => array('categories$', 'categories/')); } if (qa_opt('nav_users')) { $qa_content['navigation']['main']['user'] = array('url' => qa_path_html('users'), 'label' => qa_lang_html('main/nav_users'), 'selected_on' => array('users$', 'users/', 'user/')); } // Only the 'level' permission error prevents the menu option being shown - others reported on qa-page-ask.php if (qa_opt('nav_ask') && qa_user_maximum_permit_error('permit_post_q') != 'level') { $qa_content['navigation']['main']['ask'] = array('url' => qa_path_html('ask', qa_using_categories() && strlen($lastcategoryid) ? array('cat' => $lastcategoryid) : null), 'label' => qa_lang_html('main/nav_ask')); } if (qa_get_logged_in_level() >= QA_USER_LEVEL_ADMIN || !qa_user_maximum_permit_error('permit_moderate') || !qa_user_maximum_permit_error('permit_hide_show') || !qa_user_maximum_permit_error('permit_delete_hidden')) { $qa_content['navigation']['main']['admin'] = array('url' => qa_path_html('admin'), 'label' => qa_lang_html('main/nav_admin'), 'selected_on' => array('admin/')); } $qa_content['search'] = array('form_tags' => 'method="get" action="' . qa_path_html('search') . '"', 'form_extra' => qa_path_form_html('search'), 'title' => qa_lang_html('main/search_title'), 'field_tags' => 'name="q"', 'button_label' => qa_lang_html('main/search_button')); if (!qa_opt('feedback_enabled')) { unset($qa_content['navigation']['footer']['feedback']); } foreach ($navpages as $page) { if ($page['nav'] == 'M' || $page['nav'] == 'O' || $page['nav'] == 'F') { qa_navigation_add_page($qa_content['navigation'][$page['nav'] == 'F' ? 'footer' : 'main'], $page); } } $regioncodes = array('F' => 'full', 'M' => 'main', 'S' => 'side'); $placecodes = array('T' => 'top', 'H' => 'high', 'L' => 'low', 'B' => 'bottom'); foreach ($widgets as $widget) { if (is_numeric(strpos(',' . $widget['tags'] . ',', ',' . $qa_template . ',')) || is_numeric(strpos(',' . $widget['tags'] . ',', ',all,'))) { // see if it has been selected for display on this template $region = @$regioncodes[substr($widget['place'], 0, 1)]; $place = @$placecodes[substr($widget['place'], 1, 2)]; if (isset($region) && isset($place)) { // check region/place codes recognized $module = qa_load_module('widget', $widget['title']); if (isset($module) && method_exists($module, 'allow_template') && $module->allow_template(substr($qa_template, 0, 7) == 'custom-' ? 'custom' : $qa_template) && method_exists($module, 'allow_region') && $module->allow_region($region) && method_exists($module, 'output_widget')) { $qa_content['widgets'][$region][$place][] = $module; } // if module loaded and happy to be displayed here, tell theme about it } } } $logoshow = qa_opt('logo_show'); $logourl = qa_opt('logo_url'); $logowidth = qa_opt('logo_width'); $logoheight = qa_opt('logo_height'); if ($logoshow) { $qa_content['logo'] = '<a href="' . qa_path_html('') . '" class="qa-logo-link" title="' . qa_html(qa_opt('site_title')) . '">' . '<img src="' . qa_html(is_numeric(strpos($logourl, '://')) ? $logourl : qa_path_to_root() . $logourl) . '"' . ($logowidth ? ' width="' . $logowidth . '"' : '') . ($logoheight ? ' height="' . $logoheight . '"' : '') . ' border="0" alt="' . qa_html(qa_opt('site_title')) . '"/></a>'; } else { $qa_content['logo'] = '<a href="' . qa_path_html('') . '" class="qa-logo-link">' . qa_html(qa_opt('site_title')) . '</a>'; } $topath = qa_get('to'); // lets user switch between login and register without losing destination page $userlinks = qa_get_login_links(qa_path_to_root(), isset($topath) ? $topath : qa_path($request, $_GET, '')); $qa_content['navigation']['user'] = array(); if (qa_is_logged_in()) { $qa_content['loggedin'] = qa_lang_html_sub_split('main/logged_in_x', QA_FINAL_EXTERNAL_USERS ? qa_get_logged_in_user_html(qa_get_logged_in_user_cache(), qa_path_to_root(), false) : qa_get_one_user_html(qa_get_logged_in_handle(), false)); $qa_content['navigation']['user']['updates'] = array('url' => qa_path_html('updates'), 'label' => qa_lang_html('main/nav_updates')); if (!empty($userlinks['logout'])) { $qa_content['navigation']['user']['logout'] = array('url' => qa_html(@$userlinks['logout']), 'label' => qa_lang_html('main/nav_logout')); } if (!QA_FINAL_EXTERNAL_USERS) { $source = qa_get_logged_in_source(); if (strlen($source)) { $loginmodules = qa_load_modules_with('login', 'match_source'); foreach ($loginmodules as $module) { if ($module->match_source($source) && method_exists($module, 'logout_html')) { ob_start(); $module->logout_html(qa_path('logout', array(), qa_opt('site_url'))); $qa_content['navigation']['user']['logout'] = array('label' => ob_get_clean()); } } } } $notices = qa_db_get_pending_result('notices'); foreach ($notices as $notice) { $qa_content['notices'][] = qa_notice_form($notice['noticeid'], qa_viewer_html($notice['content'], $notice['format']), $notice); } } else { require_once QA_INCLUDE_DIR . 'util/string.php'; if (!QA_FINAL_EXTERNAL_USERS) { $loginmodules = qa_load_modules_with('login', 'login_html'); foreach ($loginmodules as $tryname => $module) { ob_start(); $module->login_html(isset($topath) ? qa_opt('site_url') . $topath : qa_path($request, $_GET, qa_opt('site_url')), 'menu'); $label = ob_get_clean(); if (strlen($label)) { $qa_content['navigation']['user'][implode('-', qa_string_to_words($tryname))] = array('label' => $label); } } } if (!empty($userlinks['login'])) { $qa_content['navigation']['user']['login'] = array('url' => qa_html(@$userlinks['login']), 'label' => qa_lang_html('main/nav_login')); } if (!empty($userlinks['register'])) { $qa_content['navigation']['user']['register'] = array('url' => qa_html(@$userlinks['register']), 'label' => qa_lang_html('main/nav_register')); } } if (QA_FINAL_EXTERNAL_USERS || !qa_is_logged_in()) { if (qa_opt('show_notice_visitor') && !isset($topath) && !isset($_COOKIE['qa_noticed'])) { $qa_content['notices'][] = qa_notice_form('visitor', qa_opt('notice_visitor')); } } else { setcookie('qa_noticed', 1, time() + 86400 * 3650, '/', QA_COOKIE_DOMAIN); // don't show first-time notice if a user has logged in if (qa_opt('show_notice_welcome') && qa_get_logged_in_flags() & QA_USER_FLAGS_WELCOME_NOTICE) { if ($requestlower != 'confirm' && $requestlower != 'account') { // let people finish registering in peace $qa_content['notices'][] = qa_notice_form('welcome', qa_opt('notice_welcome')); } } } $qa_content['script_rel'] = array('qa-content/jquery-1.11.2.min.js'); $qa_content['script_rel'][] = 'qa-content/qa-page.js?' . QA_VERSION; if ($voting) { $qa_content['error'] = @$qa_page_error_html; } $qa_content['script_var'] = array('qa_root' => qa_path_to_root(), 'qa_request' => $request); return $qa_content; }
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-app-admin.php'; require_once QA_INCLUDE_DIR . 'qa-db-selects.php'; require_once QA_INCLUDE_DIR . 'qa-app-format.php'; // Find most flagged questions, answers, comments $userid = qa_get_logged_in_userid(); $questions = qa_db_select_with_pending(qa_db_flagged_post_qs_selectspec($userid, 0, true)); // Check admin privileges (do late to allow one DB query) if (qa_user_maximum_permit_error('permit_hide_show')) { $qa_content = qa_content_prepare(); $qa_content['error'] = qa_lang_html('users/no_permission'); return $qa_content; } // Check to see if any were cleared or hidden here $pageerror = qa_admin_check_clicks(); // Remove questions the user has no permission to hide/show if (qa_user_permit_error('permit_hide_show')) { // if user not allowed to show/hide all posts foreach ($questions as $index => $question) { if (qa_user_post_permit_error('permit_hide_show', $question)) { unset($questions[$index]); } } }