= 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; } // 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); } // Then, if there's a slug that matches no category, check page modules provided by plugins if (!$explicitqa && $countslugs && !isset($categoryid)) { $pagemodules = qa_load_modules_with('page', 'match_request'); $request = qa_request(); foreach ($pagemodules as $pagemodule) { if ($pagemodule->match_request($request)) { $tmpl = isset($custompage['pageid']) ? 'custom-' . $custompage['pageid'] : 'custom'; qa_set_template($tmpl); return $pagemodule->process_request($request); } } } // Then, check whether we are showing a custom home page if (!$explicitqa && !$countslugs && qa_opt('show_custom_home')) { qa_set_template('custom'); $qa_content = qa_content_prepare(); $qa_content['title'] = qa_html(qa_opt('custom_home_heading')); $qa_content['custom'] = qa_opt('custom_home_content'); return $qa_content; } // If we got this far, it's a good old-fashioned Q&A listing page require_once QA_INCLUDE_DIR . 'app/q-list.php'; qa_set_template('qa'); $questions = qa_any_sort_and_dedupe(array_merge($questions1, $questions2)); $pagesize = qa_opt('page_size_home'); if ($countslugs) { if (!isset($categoryid)) { return include QA_INCLUDE_DIR . 'qa-page-not-found.php'; } $categorytitlehtml = qa_html($categories[$categoryid]['title']); $sometitle = qa_lang_html_sub('main/recent_qs_as_in_x', $categorytitlehtml); $nonetitle = qa_lang_html_sub('main/no_questions_in_x', $categorytitlehtml); } else { $sometitle = qa_lang_html('main/recent_qs_as_title'); $nonetitle = qa_lang_html('main/no_questions_found'); } // Prepare and return content for theme for Q&A listing page $qa_content = qa_q_list_page_content( $questions, // questions $pagesize, // questions per page 0, // start offset null, // total count (null to hide page links) $sometitle, // title if some questions $nonetitle, // title if no questions $categories, // categories for navigation $categoryid, // selected category id true, // show question counts in category navigation $explicitqa ? 'qa/' : '', // prefix for links in category navigation qa_opt('feed_for_qa') ? 'qa' : null, // prefix for RSS feed paths (null to hide) (count($questions) < $pagesize) // suggest what to do next ? qa_html_suggest_ask($categoryid) : qa_html_suggest_qs_tags(qa_using_tags(), qa_category_path_request($categories, $categoryid)), null, // page link params null // category nav params ); return $qa_content;