-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
109 lines (64 loc) · 2.02 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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
/**
* MagicPage loader, Version 0.1.0
* Written by Robert Ian Hawdon.
* Connects to database, loads information, displays the page and closes connection again.
* Loads admin section if requested
*/
/** Start a session */
session_name("MPSESSID");
session_start();
/** Check if first run is required */
$mpversion = "0.3.0-Development";
$expectedconf = 'config.php';
if (file_exists($expectedconf)) {
$config = $expectedconf;
} else {
header( 'Location: /MP-Admin/firstrun.php' ) ;
}
/** Load MagicPage Config File */
include($config);
/** Connect to Database */
include($common . "/dbconnect.php");
/** Global Config */
include($common . "/dbfetchconfig.php");
/** MagicPage Functions **/
include($common . "/mpfunctions.php");
/** Load common theme functions */
include($common . "/themefunctions.php");
/** Check auth cookie if cookie exists and not authenticated */
if ( isset($_COOKIE['MPAUTH']) AND !isset($_SESSION['authenticated']) ) {
checkAuth();
}
/** Check for maintenance mode and override password **/
$query = "SELECT value FROM " . $dbprefix . "shared WHERE mpoption='maintenance'";
$result = $con->query($query);
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
$maintenance = $row['value'];
}
$query = "SELECT value FROM " . $dbprefix . "shared WHERE mpoption='mmoverride'";
$result = $con->query($query);
while($row = $result->fetch(PDO::FETCH_ASSOC)) {
$mmoverridepass = $row['value'];
}
$mmoverride = $_GET['mmoverride'];
/** Admin Redirect **/
$adm = $_GET['adm'];
if ( $adm == "go" ) {
include ("MP-Admin/adminpage.php");
} elseif ( $maintenance == "1" AND $mmoverride != $mmoverridepass ) {
/** If maintenance mode is true, then load block the site from showing unless overridden **/
include ("MP-Admin/Error/maintenance.php");
} else {
/** Loader */
$viewpage = $_GET['viewpage'];
if ( $viewpage == "" ) {
$viewpage = $HomepageID ;
}
include($themes . "/" . $MPTheme . "/index.php");
}
include($common . "/dbdisconnect.php");
/**
* End of OP-EZY MagicPage loader
*/
?>