qa-page.php 1.6 KB
Newer Older
Scott committed
1 2 3 4 5
<?php
/*
	Question2Answer by Gideon Greenspan and contributors
	http://www.question2answer.org/

6
	Description: Initialization for page requests
Scott committed
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21


	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
*/

22 23 24 25
if (!defined('QA_VERSION')) { // don't allow this page to be requested directly from browser
	header('Location: ../');
	exit;
}
Scott committed
26

27
require_once QA_INCLUDE_DIR . 'app/page.php';
Scott committed
28 29


Scott committed
30
// Below are the steps that actually execute for this file - all the above are function definitions
Scott committed
31

32
global $qa_usage;
Scott committed
33

34 35
qa_report_process_stage('init_page');
qa_db_connect('qa_page_db_fail_handler');
36
qa_initialize_postdb_plugins();
Scott committed
37

38 39 40
qa_page_queue_pending();
qa_load_state();
qa_check_login_modules();
Scott committed
41

42 43
if (QA_DEBUG_PERFORMANCE)
	$qa_usage->mark('setup');
Scott committed
44

45
qa_check_page_clicks();
Scott committed
46

47
$qa_content = qa_get_request_content();
Scott committed
48

49 50 51
if (is_array($qa_content)) {
	if (QA_DEBUG_PERFORMANCE)
		$qa_usage->mark('view');
Scott committed
52

53
	qa_output_content($qa_content);
Scott committed
54

55 56
	if (QA_DEBUG_PERFORMANCE)
		$qa_usage->mark('theme');
Scott committed
57

58 59
	if (qa_do_content_stats($qa_content) && QA_DEBUG_PERFORMANCE)
		$qa_usage->mark('stats');
Scott committed
60

61 62 63
	if (QA_DEBUG_PERFORMANCE)
		$qa_usage->output();
}
Scott committed
64

65
qa_db_disconnect();