forked from PHPFusion/PHPFusion
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
83 lines (79 loc) · 3.62 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/*-------------------------------------------------------+
| PHPFusion Content Management System
| Copyright (C) PHP Fusion Inc
| https://phpfusion.com/
+--------------------------------------------------------+
| Filename: index.php
| Author: Core Development Team
+--------------------------------------------------------+
| This program is released as free software under the
| Affero GPL license. You can redistribute it and/or
| modify it under the terms of this license which you
| can read by viewing the included agpl.txt or online
| at www.gnu.org/licenses/agpl.html. Removal of this
| copyright header is strictly prohibited without
| written permission from the original author(s).
+--------------------------------------------------------*/
require_once __DIR__ . '/maincore.php';
$settings = fusion_get_settings();
if ($settings['site_seo'] && !get( 'aid' )) {
define( 'IN_PERMALINK', TRUE );
$router = PHPFusion\Rewrite\Router::getRouterInstance();
$router->rewritePage();
$filepath = $router->getFilePath();
if (empty( $filepath ) && filter_var( PERMALINK_CURRENT_PATH, FILTER_VALIDATE_URL )) {
redirect( PERMALINK_CURRENT_PATH, FALSE, FALSE, 301 );
} else {
if (check_get( 'lang' ) && valid_language( get( 'lang' ) )) {
$lang = stripinput( get( 'lang' ) );
set_language( $lang );
redirect( BASEDIR . $settings['opening_page'], FALSE, FALSE, 301 );
} else {
if (check_get( 'logout' ) && get( 'logout' ) == 'yes') {
$userdata = Authenticate::logOut();
redirect( BASEDIR . $settings['opening_page'], FALSE, FALSE, 301 );
} else {
if (!empty( $filepath )) {
if ($filepath == 'index.php') {
redirect( BASEDIR . $settings['opening_page'], FALSE, FALSE, 301 );
} else {
if (file_exists( $filepath )) {
require_once $filepath;
} else {
redirect( BASEDIR . 'index.php' );
}
}
} else {
if (server( 'REQUEST_URI' ) == $settings['site_path'] . $settings['opening_page']
or server( 'REQUEST_URI' ) == $settings['site_path'] . 'index.php'
or $router->removeParam( server( 'REQUEST_URI' ) ) == '/'
or server( 'REQUEST_URI' ) == $settings['site_path']
) {
if ($settings['opening_page'] == 'index.php') {
require_once THEMES . 'templates/header.php';
PHPFusion\HomePage::displayHome();
require_once THEMES . 'templates/footer.php';
} else {
redirect( BASEDIR . $settings['opening_page'], FALSE, FALSE, 301 );
}
} else {
$router->setPathtofile( 'error.php' );
$router->setGetParameters( ['code' => '404'] );
$router->setServerVars();
$router->setQueryString();
require_once BASEDIR . 'error.php';
}
}
}
}
}
} else {
if ($settings['opening_page'] == 'index.php') {
require_once THEMES . 'templates/header.php';
PHPFusion\HomePage::displayHome();
require_once THEMES . 'templates/footer.php';
} else {
redirect( BASEDIR . $settings['opening_page'], FALSE, FALSE, 301 );
}
}