-
-
Notifications
You must be signed in to change notification settings - Fork 214
/
login.php
126 lines (96 loc) · 3.32 KB
/
login.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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
<?php
/*
* e107 website system
*
* Copyright (C) e107 Inc (e107.org)
* Released under the terms and conditions of the
* GNU General Public License (http://www.gnu.org/licenses/gpl.txt)
*
* Login routine
*
*/
require_once("class2.php");
if ((USER || e_LOGIN != e_SELF || (empty($pref['user_reg']) && !e107::getUserProvider()->isSocialLoginEnabled())) && e_QUERY !== 'preview' && !getperms('0') ) // Disable page if user logged in, or some custom e_LOGIN value is used.
{
$prev = e107::getRedirect()->getPreviousUrl();
if(!empty($prev))
{
e107::redirect($prev);
exit();
}
e107::redirect();
exit();
}
e107::coreLan('login');
if(!defined('e_IFRAME')) define('e_IFRAME',true);
require_once(HEADERF);
$use_imagecode = ($pref['logcode'] && extension_loaded("gd"));
define("LOGIN_CAPTCHA", $use_imagecode);
//if (LOGIN_CAPTCHA)
//{
//require_once(e_HANDLER."secure_img_handler.php");
//$sec_img = new secure_image;
//}
if (!USER || getperms('0'))
{
if (!defined('LOGINMESSAGE')) define('LOGINMESSAGE', ''); // LOGINMESSAGE only appears with errors
require_once(e_HANDLER.'form_handler.php'); // required for BC
$rs = new form; // required for BC
if (empty($LOGIN_TABLE))
{
if(deftrue('BOOTSTRAP'))
{
$LOGIN_TEMPLATE = e107::getCoreTemplate('login');
}
else // BC Stuff.
{
if (file_exists(THEME.'templates/login_template.php')) //v2.x path
{
require_once(THEME.'templates/login_template.php');
}
elseif (file_exists(THEME.'login_template.php'))
{
require_once(THEME.'login_template.php');
}
else
{
$LOGIN_TEMPLATE = e107::getCoreTemplate('login');
}
}
}
$sc = e107::getScBatch('login');
$sc->wrapper('login/page');
if(!empty($LOGIN_TEMPLATE['page']))
{
$LOGIN_TABLE_HEADER = $LOGIN_TEMPLATE['page']['header'];
$LOGIN_TABLE = "<form id='login-page' class='form-signin' method='post' action='".e_SELF."' onsubmit='hashLoginPassword(this)' >".$LOGIN_TEMPLATE['page']['body']."</form>";
$LOGIN_TABLE_FOOTER = $LOGIN_TEMPLATE['page']['footer'];
}
$text = $tp->parseTemplate($LOGIN_TABLE,true, $sc);
if(getperms('0'))
{
$find = array('[', ']');
$replace = array("<a href='".e_HTTP."index.php' class='btn btn-primary' role='button'>", "</a>");
$return_link = str_replace($find, $replace, LAN_LOGIN_33);
echo "<div class='alert alert-block alert-error alert-danger center'>".LAN_LOGIN_32." <br /><br />".$return_link."</div>";
if(empty($pref['user_reg']))
{
$find = array('[', ']');
$replace = array("<a href='".e_ADMIN_ABS."prefs.php#nav-core-prefs-registration' class='btn btn-primary' role='button' target='_blank'>", "</a>");
$pref_link = str_replace($find, $replace, LAN_LOGIN_35);
echo "<div class='alert alert-block alert-error alert-danger center'>".LAN_LOGIN_34." <br /><br />".$pref_link."</div>";
}
}
$login_message = SITENAME; // $login_message = LAN_LOGIN_3." | ".SITENAME;
if(strpos($LOGIN_TABLE_HEADER,'LOGIN_TABLE_LOGINMESSAGE') === false && strpos($LOGIN_TABLE,'LOGIN_TABLE_LOGINMESSAGE') === false)
{
if(deftrue('e_IFRAME'))
{
echo LOGINMESSAGE;
}
}
echo $tp->parseTemplate($LOGIN_TABLE_HEADER,true, $sc);
$ns->tablerender($login_message, $text, 'login_page');
echo $tp->parseTemplate($LOGIN_TABLE_FOOTER, true, $sc);
}
require_once(FOOTERF);