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