forked from projectsend/projectsend
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
112 lines (99 loc) · 4.07 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
110
111
112
<?php
/**
* ProjectSend (previously cFTP) is a free, clients-oriented, private file
* sharing web application.
* Clients are created and assigned a username and a password. Then you can
* upload as much files as you want under each account, and optionally add
* a name and description to them.
*
* ProjectSend is hosted on Google Code.
* Feel free to participate!
*
* @link http://code.google.com/p/clients-oriented-ftp/
* @license http://www.gnu.org/licenses/gpl-2.0.html GNU GPL version 2
* @package ProjectSend
*
*/
use ProjectSend\Classes\Session as Session;
$allowed_levels = array(9,8,7,0);
require_once 'bootstrap.php';
$page_title = __('Log in','cftp_admin');
$body_class = array('login');
$page_id = 'login';
if ( isset($_SESSION['errorstate'] ) ) {
$errorstate = $_SESSION['errorstate'];
unset($_SESSION['errorstate']);
}
// Social login
if (!empty($_GET['external_login']) && $_GET['external_login'] == '1' && !empty($_GET['provider']) )
{
if (Session::has('SOCIAL_LOGIN_NETWORK')) {
Session::remove('SOCIAL_LOGIN_NETWORK');
}
Session::add('SOCIAL_LOGIN_NETWORK', $_GET['provider']);
$process = new \ProjectSend\Classes\DoProcess($dbh);
$process->socialLogin($_GET['provider']);
}
include_once ADMIN_VIEWS_DIR . DS . 'header-unlogged.php';
?>
<div class="col-xs-12 col-sm-12 col-lg-4 col-lg-offset-4">
<?php echo get_branding_layout(true); ?>
<?php
$login_types = array(
'local' => '1',
'ldap' => get_option('ldap_signin_enabled'),
);
?>
<div class="white-box">
<div class="white-box-interior">
<div class="ajax_response">
<?php
/** Coming from an external form */
if ( isset( $_GET['error'] ) ) {
switch ( $_GET['error'] ) {
case 1:
echo system_message('danger',__("The supplied credentials are not valid.",'cftp_admin'),'login_error');
break;
case 'timeout':
echo system_message('danger',__("Session timed out. Please log in again.",'cftp_admin'),'login_error');
break;
}
}
?>
</div>
<ul class="nav nav-tabs" role="tablist">
<li role="presentation" class="active"><a href="#local" aria-controls="local" role="tab" data-toggle="tab">Local account</a></li>
<?php if ($login_types['ldap'] == '1') { ?>
<li role="presentation"><a href="#ldap" aria-controls="ldap" role="tab" data-toggle="tab">LDAP</a></li>
<?php } ?>
</ul>
<div class="tab-content">
<div role="tabpanel" class="tab-pane fade in active" id="local">
<?php include_once FORMS_DIR . DS . 'login.php'; ?>
<div class="login_form_links">
<p id="reset_pass_link"><?php _e("Forgot your password?",'cftp_admin'); ?> <a href="<?php echo BASE_URI; ?>reset-password.php"><?php _e('Set up a new one.','cftp_admin'); ?></a></p>
<?php
if (CLIENTS_CAN_REGISTER == '1') {
?>
<p id="register_link"><?php _e("Don't have an account yet?",'cftp_admin'); ?> <a href="<?php echo BASE_URI; ?>register.php"><?php _e('Register as a new client.','cftp_admin'); ?></a></p>
<?php
} else {
?>
<p><?php _e("This server does not allow self registrations.",'cftp_admin'); ?></p>
<p><?php _e("If you need an account, please contact a server administrator.",'cftp_admin'); ?></p>
<?php
}
?>
</div>
</div>
<?php if ($login_types['ldap'] == '1') { ?>
<div role="tabpanel" class="tab-pane fade" id="ldap">
<?php include_once FORMS_DIR . DS . 'login-ldap.php'; ?>
</div>
<?php } ?>
</div>
</div>
</div>
</div>
<?php
include_once ADMIN_VIEWS_DIR . DS . 'footer.php';