Project

General

Profile

1 2 Manuela
<?php
2
/**
3
 *
4
 * @category        frontend
5
 * @package         page
6
 * @author          WebsiteBaker Project
7
 * @copyright       WebsiteBaker Org. e.V.
8
 * @link            http://websitebaker.org/
9
 * @license         http://www.gnu.org/licenses/gpl.html
10
 * @platform        WebsiteBaker 2.8.3
11
 * @requirements    PHP 5.3.6 and higher
12
 * @version         $Id$
13
 * @filesource      $HeadURL$
14
 * @lastmodified    $Date$
15
 *
16
 */
17
18
$starttime = array_sum(explode(" ",microtime()));
19
20
// Include config file
21
if (!defined('WB_PATH')) {
22
    $sStartupFile = __DIR__.'/config.php';
23
    if (is_readable($sStartupFile)) {
24
        require($sStartupFile);
25
    }
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 7 Manuela
37
    $_SERVER['REQUEST_SCHEME'] = isset($_SERVER['REQUEST_SCHEME']) ? $_SERVER['REQUEST_SCHEME'] : 'http';
38 2 Manuela
    $host       = $_SERVER['HTTP_HOST'];
39
    $uri        = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\');
40
    $file       = 'install/index.php';
41 7 Manuela
    $target_url = $_SERVER['REQUEST_SCHEME'].'://'.$host.$uri.'/'.$file;
42 2 Manuela
    $sResponse  = $_SERVER['SERVER_PROTOCOL'].' 307 Temporary Redirect';
43
    header($sResponse);
44
    header('Location: '.$target_url);
45
    exit;    // make sure that subsequent code will not be executed
46
}
47
48 7 Manuela
// if (!class_exists('frontend')) { require WB_PATH.'/framework/class.frontend.php';  }
49 2 Manuela
// Create new frontend object
50
if (!isset($wb) || !($wb instanceof frontend)) { $wb = new frontend(); }
51
52
// activate frontend Output_Filter (index.php)
53
if (is_readable(WB_PATH .'/modules/output_filter/index.php')) {
54
    if (!function_exists('executeFrontendOutputFilter')) {
55
        include WB_PATH .'/modules/output_filter/index.php';
56
    }
57
} else {
58
    throw new RuntimeException('missing mandatory global Output_Filter!');
59
}
60
61
// Figure out which page to display
62
// Stop processing if intro page was shown
63
$wb->page_select() or die();
64
65
// Collect info about the currently viewed page
66
// and check permissions
67
$wb->get_page_details();
68
69
// Collect general website settings
70
$wb->get_website_settings();
71
72
// Load functions available to templates, modules and code sections
73
// also, set some aliases for backward compatibility
74
if (!function_exists('register_frontend_modfiles')){require(WB_PATH.'/framework/frontend.functions.php');}
75
76
//Get pagecontent in buffer for Droplets and/or Filter operations
77
ob_start();
78
require(WB_PATH.'/templates/'.TEMPLATE.'/index.php');
79
$output = ob_get_contents();
80
if(ob_get_length() > 0) { ob_end_clean(); }
81
// execute frontend output filters
82
    if(file_exists(WB_PATH .'/modules/output_filter/index.php')) {
83
        include_once(WB_PATH .'/modules/output_filter/index.php');
84
        if(function_exists('executeFrontendOutputFilter')) {
85
            $output = executeFrontendOutputFilter($output);
86
        }
87
    }
88
// now send complete page to the browser
89
echo $output;
90
// end of wb-script
91
exit;