1
|
<?php
|
2
|
/**
|
3
|
*
|
4
|
* @category frontend
|
5
|
* @package page
|
6
|
* @author WebsiteBaker Project
|
7
|
* @copyright 2004-2009, Ryan Djurovich
|
8
|
* @copyright 2009-2011, Website Baker Org. e.V.
|
9
|
* @link http://www.websitebaker2.org/
|
10
|
* @license http://www.gnu.org/licenses/gpl.html
|
11
|
* @platform WebsiteBaker 2.8.x
|
12
|
* @requirements PHP 5.2.2 and higher
|
13
|
* @version $Id: index.php 1450 2011-05-22 10:13:47Z DarkViper $
|
14
|
* @filesource $HeadURL: svn://isteam.dynxs.de/wb-archiv/branches/2.8.x/wb/index.php $
|
15
|
* @lastmodified $Date: 2011-05-22 12:13:47 +0200 (Sun, 22 May 2011) $
|
16
|
*
|
17
|
*/
|
18
|
|
19
|
$starttime = array_sum(explode(" ",microtime()));
|
20
|
|
21
|
define('DEBUG', false);
|
22
|
// Include config file
|
23
|
$config_file = dirname(__FILE__).'/config.php';
|
24
|
if(file_exists($config_file))
|
25
|
{
|
26
|
require_once($config_file);
|
27
|
}
|
28
|
|
29
|
// Check if the config file has been set-up
|
30
|
if(!defined('TABLE_PREFIX'))
|
31
|
{
|
32
|
/*
|
33
|
* Remark: HTTP/1.1 requires a qualified URI incl. the scheme, name
|
34
|
* of the host and absolute path as the argument of location. Some, but
|
35
|
* not all clients will accept relative URIs also.
|
36
|
*/
|
37
|
$host = $_SERVER['HTTP_HOST'];
|
38
|
$uri = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\');
|
39
|
$file = 'install/index.php';
|
40
|
$target_url = 'http://'.$host.$uri.'/'.$file;
|
41
|
$sResponse = $_SERVER['SERVER_PROTOCOL'].' 307 Temporary Redirect';
|
42
|
header($sResponse);
|
43
|
header('Location: '.$target_url);
|
44
|
exit; // make sure that subsequent code will not be executed
|
45
|
}
|
46
|
|
47
|
require_once(WB_PATH.'/framework/class.frontend.php');
|
48
|
// Create new frontend object
|
49
|
$wb = new frontend();
|
50
|
|
51
|
// Figure out which page to display
|
52
|
// Stop processing if intro page was shown
|
53
|
$wb->page_select() or die();
|
54
|
|
55
|
// Collect info about the currently viewed page
|
56
|
// and check permissions
|
57
|
$wb->get_page_details();
|
58
|
|
59
|
// Collect general website settings
|
60
|
$wb->get_website_settings();
|
61
|
|
62
|
// Load functions available to templates, modules and code sections
|
63
|
// also, set some aliases for backward compatibility
|
64
|
require(WB_PATH.'/framework/frontend.functions.php');
|
65
|
|
66
|
// redirect menu-link
|
67
|
$this_page_id = PAGE_ID;
|
68
|
|
69
|
$php43 = version_compare(phpversion(), '4.3', '>=');
|
70
|
|
71
|
$sql = 'SELECT `module`, `block` FROM `'.TABLE_PREFIX.'sections` ';
|
72
|
$sql .= 'WHERE `page_id` = '.(int)$this_page_id.' AND `module` = "menu_link"';
|
73
|
$query_this_module = $database->query($sql);
|
74
|
if($query_this_module->numRows() == 1) // This is a menu_link. Get link of target-page and redirect
|
75
|
{
|
76
|
// get target_page_id
|
77
|
$sql = 'SELECT * FROM `'.TABLE_PREFIX.'mod_menu_link` WHERE `page_id` = '.(int)$this_page_id;
|
78
|
$query_tpid = $database->query($sql);
|
79
|
if($query_tpid->numRows() == 1)
|
80
|
{
|
81
|
$res = $query_tpid->fetchRow();
|
82
|
$target_page_id = $res['target_page_id'];
|
83
|
$redirect_type = $res['redirect_type'];
|
84
|
$anchor = ($res['anchor'] != '0' ? '#'.(string)$res['anchor'] : '');
|
85
|
$extern = $res['extern'];
|
86
|
// set redirect-type
|
87
|
if($redirect_type == 301)
|
88
|
{
|
89
|
if($php43)
|
90
|
{
|
91
|
@header('HTTP/1.1 301 Moved Permanently', TRUE, 301);
|
92
|
}
|
93
|
else
|
94
|
{
|
95
|
@header('HTTP/1.1 301 Moved Permanently');
|
96
|
}
|
97
|
}
|
98
|
if($target_page_id == -1)
|
99
|
{
|
100
|
if($extern != '')
|
101
|
{
|
102
|
$target_url = $extern.$anchor;
|
103
|
header('Location: '.$target_url);
|
104
|
exit;
|
105
|
}
|
106
|
}
|
107
|
else
|
108
|
{
|
109
|
// get link of target-page
|
110
|
$sql = 'SELECT `link` FROM `'.TABLE_PREFIX.'pages` WHERE `page_id` = '.$target_page_id;
|
111
|
$target_page_link = $database->get_one($sql);
|
112
|
if($target_page_link != null)
|
113
|
{
|
114
|
$target_url = WB_URL.PAGES_DIRECTORY.$target_page_link.PAGE_EXTENSION.$anchor;
|
115
|
header('Location: '.$target_url);
|
116
|
exit;
|
117
|
}
|
118
|
}
|
119
|
}
|
120
|
}
|
121
|
//Get pagecontent in buffer for Droplets and/or Filter operations
|
122
|
ob_start();
|
123
|
require(WB_PATH.'/templates/'.TEMPLATE.'/index.php');
|
124
|
$output = ob_get_contents();
|
125
|
if(ob_get_length() > 0) { ob_end_clean(); }
|
126
|
|
127
|
// wb->preprocess() -- replace all [wblink123] with real, internal links
|
128
|
if( method_exists($wb, 'preprocess') )
|
129
|
{
|
130
|
$wb->preprocess($output);
|
131
|
}
|
132
|
// Load Droplet engine and process
|
133
|
if(file_exists(WB_PATH .'/modules/droplets/droplets.php'))
|
134
|
{
|
135
|
include_once(WB_PATH .'/modules/droplets/droplets.php');
|
136
|
if(function_exists('evalDroplets'))
|
137
|
{
|
138
|
$output = evalDroplets($output);
|
139
|
}
|
140
|
}
|
141
|
// Load backwards compatible frontend filter support and process
|
142
|
if(file_exists(WB_PATH .'/modules/output_filter/filter-routines.php'))
|
143
|
{
|
144
|
include_once(WB_PATH .'/modules/output_filter/filter-routines.php');
|
145
|
if(function_exists('filter_frontend_output'))
|
146
|
{
|
147
|
$output = filter_frontend_output($output);
|
148
|
}
|
149
|
}
|
150
|
// move css definitions into head section
|
151
|
if(function_exists('moveCssToHead')) {
|
152
|
$output = moveCssToHead($output);
|
153
|
}
|
154
|
// now send complete page to the browser
|
155
|
echo $output;
|
156
|
// end of wb-script
|
157
|
exit;
|