-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
71 lines (57 loc) · 2.09 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
<?php
require_once("global/library.php");
use FormTools\Core;
use FormTools\General;
use FormTools\Installation;
use FormTools\Pages;
use FormTools\Settings;
use FormTools\Themes;
use FormTools\Upgrade;
if (!Core::checkConfigFileExists()) {
General::redirect("install/");
}
Core::init();
$LANG = Core::$L;
if (Core::checkConfigFileExists()) {
Installation::clearSessions();
}
$upgrade_info = Upgrade::upgrade();
// if this user is already logged in, redirect them to their own login page
if (Core::$user->isLoggedIn()) {
Core::$user->redirectToLoginPage();
}
$settings = Settings::get();
$id = General::getLoginOverrideId();
$error = "";
if (isset($_POST["username"]) && !empty($_POST["username"])) {
$error = Core::$user->login($_POST);
}
$username = General::stripChars((isset($_POST["username"]) && !empty($_POST["username"])) ? $_POST["username"] : "");
$replacements = array(
"program_name" => $settings["program_name"],
"forgot_password_link" => "forget_password.php" . (!empty($id) ? "?id={$id}" : "")
);
// compile the variables for use in the templates
$page = array(
"page" => "login",
"page_url" => Pages::getPageUrl("login"),
"settings" => Settings::get(),
"head_title" => $LANG["phrase_admin_panel"],
"error" => $error,
"text_login" => General::evalSmartyString($LANG["text_login"], $replacements),
"program_name" => $settings["program_name"],
"login_heading" => sprintf("%s %s", $settings['program_name'], $LANG["word_administration"]),
"username" => $username,
"is_logged_in" => false,
"head_string" => "<noscript><style type=\"text/css\">.login_outer_table { display: none; }</style></noscript>"
);
if ($upgrade_info["upgraded"]) {
$replacements = array("version" => Core::getVersionString());
$page["upgrade_notification"] = General::evalSmartyString($LANG["text_upgraded"], $replacements);
} else {
if (!$upgrade_info["success"]) {
$page["success"] = false;
$page["message"] = $upgrade_info["error_msg"];
}
}
Themes::displayPage("index.tpl", $page, Core::$user->getTheme(), Core::$user->getSwatch());