Completed
Push — development ( d5d7d3...8706a1 )
by Nils
07:51
created

index.php (1 issue)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 *
4
 * @file          index.php
5
 * @author        Nils Laumaillé
6
 * @version       2.1.27
7
 * @copyright     (c) 2009-2017 Nils Laumaillé
8
 * @licensing     GNU AFFERO GPL 3.0
9
 * @link          http://www.teampass.net
10
 *
11
 * This library is distributed in the hope that it will be useful,
12
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14
 */
15
16
header("X-XSS-Protection: 1; mode=block");
17
header("X-Frame-Options: SameOrigin");
18
19
// **PREVENTING SESSION HIJACKING**
20
// Prevents javascript XSS attacks aimed to steal the session ID
21
ini_set('session.cookie_httponly', 1);
22
23
// **PREVENTING SESSION FIXATION**
24
// Session ID cannot be passed through URLs
25
ini_set('session.use_only_cookies', 1);
26
27
// Uses a secure connection (HTTPS) if possible
28
ini_set('session.cookie_secure', 0);
29
30
// Before we start processing, we should abort no install is present
31
if (!file_exists('includes/config/settings.php')) {
32
    // This should never happen, but in case it does
33
    // this means if headers are sent, redirect will fallback to JS
34
    if (headers_sent()) {
35
        echo '<script language="javascript" type="text/javascript">document.location.replace("install/install.php");</script>';
36
    } else {
37
        header('Location: install/install.php');
38
    }
39
    // Now either way, we should stop processing further
40
    exit();
41
}
42
43
// initialise CSRFGuard library
44
require_once('./includes/libraries/csrfp/libs/csrf/csrfprotector.php');
45
csrfProtector::init();
46
session_id();
47
48
// Load config
49 View Code Duplication
if (file_exists('../includes/config/tp.config.php')) {
50
    require_once '../includes/config/tp.config.php';
51
} elseif (file_exists('./includes/config/tp.config.php')) {
52
    require_once './includes/config/tp.config.php';
53
} else {
54
    throw new Exception("Error file '/includes/config/tp.config.php' not exists", 1);
55
}
56
57
// Include files
58
require_once $SETTINGS['cpassman_dir'].'/includes/config/settings.php';
59
require_once $SETTINGS['cpassman_dir'].'/includes/config/include.php';
60
require_once $SETTINGS['cpassman_dir'].'/includes/libraries/protect/SuperGlobal/SuperGlobal.php';
61
$superGlobal = new protect\SuperGlobal\SuperGlobal();
62
63
64
// initialize session
65
$_SESSION['CPM'] = 1;
66 View Code Duplication
if (isset($SETTINGS['cpassman_dir']) === false || $SETTINGS['cpassman_dir'] === "") {
67
    $SETTINGS['cpassman_dir'] = ".";
68
    $SETTINGS['cpassman_url'] = $superGlobal->get("REQUEST_URI", "SERVER");
69
}
70
71
// Include files
72
require_once $SETTINGS['cpassman_dir'].'/sources/SplClassLoader.php';
73
require_once $SETTINGS['cpassman_dir'].'/sources/main.functions.php';
74
75
76
// Open MYSQL database connection
77
require_once './includes/libraries/Database/Meekrodb/db.class.php';
78
$pass = defuse_return_decrypted($pass);
79
DB::$host = $server;
80
DB::$user = $user;
81
DB::$password = $pass;
82
DB::$dbName = $database;
83
DB::$port = $port;
84
DB::$encoding = $encoding;
85
DB::$error_handler = true;
86
$link = mysqli_connect($server, $user, $pass, $database, $port);
87
$link->set_charset($encoding);
88
89
90
// Load Core library
91
require_once $SETTINGS['cpassman_dir'].'/sources/core.php';
92
93
94
// Prepare POST variables
95
$post_language =        filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
96
$post_sig_response =    filter_input(INPUT_POST, 'sig_response', FILTER_SANITIZE_STRING);
97
$post_duo_login =       filter_input(INPUT_POST, 'duo_login', FILTER_SANITIZE_STRING);
98
$post_duo_data =        filter_input(INPUT_POST, 'duo_data', FILTER_SANITIZE_STRING);
99
$post_login =           filter_input(INPUT_POST, 'login', FILTER_SANITIZE_STRING);
100
$post_pw =              filter_input(INPUT_POST, 'pw', FILTER_SANITIZE_STRING);
101
102
// Prepare superGlobal variables
103
$session_user_language =        $superGlobal->get("user_language", "SESSION");
104
$session_user_id =              $superGlobal->get("user_id", "SESSION");
105
$session_user_flag =            $superGlobal->get("user_language_flag", "SESSION");
106
$session_user_admin =           $superGlobal->get("user_admin", "SESSION");
107
$session_user_avatar_thumb =    $superGlobal->get("user_avatar_thumb", "SESSION");
108
$session_name =                 $superGlobal->get("name", "SESSION");
109
$session_lastname =             $superGlobal->get("lastname", "SESSION");
110
$session_user_manager =         $superGlobal->get("user_manager", "SESSION");
111
$session_user_read_only =       $superGlobal->get("user_read_only", "SESSION");
112
$session_is_admin =             $superGlobal->get("is_admin", "SESSION");
113
$session_login =                $superGlobal->get("login", "SESSION");
114
$session_validite_pw =          $superGlobal->get("validite_pw", "SESSION");
115
$session_nb_folders =           $superGlobal->get("nb_folders", "SESSION");
116
$session_nb_roles =             $superGlobal->get("nb_roles", "SESSION");
117
$session_autoriser =            $superGlobal->get("autoriser", "SESSION");
118
$session_hide_maintenance =     $superGlobal->get("hide_maintenance", "SESSION");
119
$session_initial_url =          $superGlobal->get("initial_url", "SESSION");
120
$server_request_uri =           $superGlobal->get("REQUEST_URI", "SERVER");
121
$session_nb_users_online =      $superGlobal->get("nb_users_online", "SESSION");
122
123
124
/* DEFINE WHAT LANGUAGE TO USE */
125
if (isset($_GET['language']) === true) {
126
    // case of user has change language in the login page
127
    $dataLanguage = DB::queryFirstRow(
128
        "SELECT flag, name
129
        FROM ".prefix_table("languages")."
130
        WHERE name = %s",
131
        filter_var($_GET['language'], FILTER_SANITIZE_STRING)
132
    );
133
    $superGlobal->put("user_language", $dataLanguage['name'], "SESSION");
134
    $superGlobal->put("user_language_flag", $dataLanguage['flag'], "SESSION");
135
} elseif ($session_user_id === null && null === $post_language && $session_user_language === null) {
136
    //get default language
137
    $dataLanguage = DB::queryFirstRow(
138
        "SELECT m.valeur AS valeur, l.flag AS flag
139
        FROM ".prefix_table("misc")." AS m
140
        INNER JOIN ".prefix_table("languages")." AS l ON (m.valeur = l.name)
141
        WHERE m.type=%s_type AND m.intitule=%s_intitule",
142
        array(
143
            'type' => "admin",
144
            'intitule' => "default_language"
145
        )
146
    );
147
    if (empty($dataLanguage['valeur'])) {
148
        $superGlobal->put("user_language", "english", "SESSION");
149
        $superGlobal->put("user_language_flag", "us.png", "SESSION");
150
        $session_user_language = "english";
151
    } else {
152
        $superGlobal->put("user_language", $dataLanguage['valeur'], "SESSION");
153
        $superGlobal->put("user_language_flag", $dataLanguage['flag'], "SESSION");
154
        $session_user_language = $dataLanguage['valeur'];
155
    }
156
} elseif (isset($SETTINGS['default_language']) === true && $session_user_language === null) {
157
    $superGlobal->put("user_language", $SETTINGS['default_language'], "SESSION");
158
    $session_user_language = $SETTINGS['default_language'];
159
} elseif (null !== $post_language) {
160
    $superGlobal->put("user_language", $post_language, "SESSION");
161
    $session_user_language = $post_language;
162
} elseif ($session_user_language === null || empty($session_user_language) === true) {
163
    if (null !== $post_language) {
164
        $superGlobal->put("user_language", $post_language, "SESSION");
165
        $session_user_language = $post_language;
166 View Code Duplication
    } elseif ($session_user_language !== null) {
167
        $superGlobal->put("user_language", $SETTINGS['default_language'], "SESSION");
168
        $session_user_language = $SETTINGS['default_language'];
169
    }
170 View Code Duplication
} elseif ($session_user_language === '0') {
171
    $superGlobal->put("user_language", $SETTINGS['default_language'], "SESSION");
172
    $session_user_language = $SETTINGS['default_language'];
173
}
174
175 View Code Duplication
if (isset($SETTINGS['cpassman_dir']) === false || $SETTINGS['cpassman_dir'] === "") {
176
    $SETTINGS['cpassman_dir'] = ".";
177
    $SETTINGS['cpassman_url'] = (string) $server_request_uri;
178
}
179
180
// Load user languages files
181
if (in_array($session_user_language, $languagesList) === true) {
182 View Code Duplication
    if (file_exists($SETTINGS['cpassman_dir'].'/includes/language/'.$session_user_language.'.php') === true) {
183
        require_once $SETTINGS['cpassman_dir'].'/includes/language/'.$session_user_language.'.php';
184
    }
185
} else {
186
    $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
187
    include $SETTINGS['cpassman_dir'].'/error.php';
188
}
189
190
// load 2FA Google
191
if (isset($SETTINGS['google_authentication']) === true && $SETTINGS['google_authentication'] === "1") {
192
    include_once($SETTINGS['cpassman_dir']."/includes/libraries/Authentication/TwoFactorAuth/TwoFactorAuth.php");
193
}
194
195
// Load links, css and javascripts
196
if (isset($_SESSION['CPM']) === true && isset($SETTINGS['cpassman_dir']) === true) {
197
    require_once $SETTINGS['cpassman_dir'].'/load.php';
198
}
199
200
?>
201
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
202
203
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
204
<head>
205
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
206
<title>Teampass</title>
207
<script type="text/javascript">
208
    //<![CDATA[
209
    if (window.location.href.indexOf("page=") == -1 && (window.location.href.indexOf("otv=") == -1 && window.location.href.indexOf("action=") == -1)) {
210
        if (window.location.href.indexOf("session_over=true") == -1) {
211
            //location.replace("./index.php?page=items");
212
        } else {
213
            location.replace("./logout.php");
214
        }
215
    }
216
    //]]>
217
</script>
218
<?php
219
220
// load HEADERS
221
if (isset($_SESSION['CPM'])) {
222
    echo $htmlHeaders;
223
}
224
?>
225
    </head>
226
227
<body>
228
    <?php
229
230
/* HEADER */
231
    echo '
232
    <div id="top">
233
        <div id="logo"><img src="includes/images/canevas/logo.png" alt="" /></div>';
234
    // Display menu
235
    if (empty($session_login) === false) {
236
        // welcome message
237
        echo '
238
        <div style="float:right; margin:-10px 5px 0 0; color:#FFF;">'
239
            .$LANG['index_welcome'].'&nbsp;<b>'.$session_name.'&nbsp;'.$session_lastname
240
            .'&nbsp;['.$session_login.']</b>&nbsp;-&nbsp;'
241
            , $session_user_admin === '1' ? $LANG['god'] :
242
                ($session_user_manager === '1' ? $LANG['gestionnaire'] :
243
                    ($session_user_read_only === '1' ? $LANG['read_only_account'] : $LANG['user'])
244
                ), '&nbsp;'.strtolower($LANG['index_login']).'</div>';
245
246
        echo '
247
        <div id="menu_top">
248
            <div style="margin-left:20px; margin-top:2px;width:710px;" id="main_menu">';
249
        if ($session_user_admin === '0' || $SETTINGS_EXT['admin_full_right'] == 0) {
250
            echo '
251
                <a class="btn btn-default" href="#"',
252
                ($session_nb_folders !== null && intval($session_nb_folders) === 0)
253
                || ($session_nb_roles !== null && intval($session_nb_roles) === 0) ? '' : ' onclick="MenuAction(\'items\')"',
254
                '>
255
                    <i class="fa fa-key fa-2x tip" title="'.$LANG['pw'].'"></i>
256
                </a>
257
258
                <a class="btn btn-default" href="#"',
259
                ($session_nb_folders !== null && intval($session_nb_folders) === 0)
260
                || ($session_nb_roles !== null && intval($session_nb_roles) === 0) ? '' : ' onclick="MenuAction(\'find\')"',
261
                '>
262
                    <i class="fa fa-binoculars fa-2x tip" title="'.$LANG['find'].'"></i>
263
                </a>';
264
        }
265
266
        // Favourites menu
267
        if (isset($SETTINGS['enable_favourites'])
268
            && $SETTINGS['enable_favourites'] == 1
269
            &&
270
            ($session_user_admin === '0' || ($session_user_admin === '1' && $SETTINGS_EXT['admin_full_right'] === false))
271
        ) {
272
            echo '
273
                    <a class="btn btn-default" href="#" onclick="MenuAction(\'favourites\')">
274
                        <i class="fa fa-star fa-2x tip" title="'.$LANG['my_favourites'].'"></i>
275
                    </a>';
276
        }
277
        // KB menu
278 View Code Duplication
        if (isset($SETTINGS['enable_kb']) && $SETTINGS['enable_kb'] == 1) {
279
            echo '
280
                    <a class="btn btn-default" href="#" onclick="MenuAction(\'kb\')">
281
                        <i class="fa fa-map-signs fa-2x tip" title="'.$LANG['kb_menu'].'"></i>
282
                    </a>';
283
        }
284
        echo '
285
        <span id="menu_suggestion_position">';
286
        // SUGGESTION menu
287
        if (isset($SETTINGS['enable_suggestion']) && $SETTINGS['enable_suggestion'] === '1'
288
            && ($session_user_read_only === '1' || $session_user_admin === '1' || $session_user_manager === '1')
289
        ) {
290
            echo '
291
                <a class="btn btn-default" href="#" onclick="MenuAction(\'suggestion\')">
292
                    <i class="fa fa-lightbulb-o fa-2x tip" id="menu_icon_suggestions" title="'.$LANG['suggestion_menu'].'"></i>
293
                </a>';
294
        }
295
        echo '
296
        </span>';
297
        // Admin menu
298
        if ($session_user_admin === '1') {
299
            echo '
300
                    &nbsp;
301
                    <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_main\')">
302
                        <i class="fa fa-info fa-2x tip" title="'.$LANG['admin_main'].'"></i>
303
                    </a>
304
                    <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_settings\')">
305
                        <i class="fa fa-wrench fa-2x tip" title="'.$LANG['admin_settings'].'"></i>
306
                    </a>';
307
        }
308
309
        if ($session_user_admin === '1' || $session_user_manager === '1') {
310
            echo '
311
                &nbsp;
312
                <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_folders\')">
313
                    <i class="fa fa-folder-open fa-2x tip" title="'.$LANG['admin_groups'].'"></i>
314
                </a>
315
                <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_roles\')">
316
                    <i class="fa fa-graduation-cap fa-2x tip" title="'.$LANG['admin_functions'].'"></i>
317
                </a>
318
                <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_users\')">
319
                    <i class="fa fa-users fa-2x tip" title="'.$LANG['admin_users'].'"></i>
320
                </a>
321
                <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_views\')">
322
                    <i class="fa fa-cubes fa-2x tip" title="'.$LANG['admin_views'].'"></i>
323
                </a>';
324
        }
325
326
        echo '
327
                <div style="float:right;">
328
                    <ul class="menu" style="">
329
                        <li class="" style="padding:4px;width:40px; text-align:center;"><i class="fa fa-dashboard fa-fw"></i>&nbsp;
330
                            <ul class="menu_200" style="text-align:left;">',
331
                                ($session_user_admin === '1' && $SETTINGS_EXT['admin_full_right'] === true) ? '' : isset($SETTINGS['enable_pf_feature']) === true && $SETTINGS['enable_pf_feature'] == 1 ? '
332
                                <li onclick="$(\'#div_set_personal_saltkey\').dialog(\'open\')">
333
                                    <i class="fa fa-key fa-fw"></i> &nbsp;'.$LANG['home_personal_saltkey_button'].'
334
                                </li>' : '', '
335
                                <li onclick="$(\'#div_increase_session_time\').dialog(\'open\')">
336
                                    <i class="fa fa-clock-o fa-fw"></i> &nbsp;'.$LANG['index_add_one_hour'].'
337
                                </li>
338
                                <li onclick="loadProfileDialog()">
339
                                    <i class="fa fa-user fa-fw"></i> &nbsp;'.$LANG['my_profile'].'
340
                                </li>
341
                                <li onclick="MenuAction(\'deconnexion\', \''.$session_user_id.'\')">
342
                                    <i class="fa fa-sign-out fa-fw"></i> &nbsp;'.$LANG['disconnect'].'
343
                                </li>
344
                            </ul>
345
                        </li>
346
                    </ul>
347
                </div>';
348
349
        if ($session_user_admin !== '1' || ($session_user_admin === '1' && $SETTINGS_EXT['admin_full_right'] === false)) {
350
            echo '
351
                <div style="float:right; margin-right:10px;">
352
                    <ul class="menu" id="menu_last_seen_items">
353
                        <li class="" style="padding:4px;width:40px; text-align:center;"><i class="fa fa-map fa-fw"></i>&nbsp;&nbsp;
354
                            <ul class="menu_200" id="last_seen_items_list" style="text-align:left;">
355
                                <li>'.$LANG['please_wait'].'</li>
356
                            </ul>
357
                        </li>
358
                    </ul>
359
                </div>';
360
        }
361
362
        // show avatar
363
        if ($session_user_avatar_thumb !== null && empty($session_user_avatar_thumb) === false) {
364
            if (file_exists('includes/avatars/'.$session_user_avatar_thumb)) {
365
                $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$session_user_avatar_thumb;
366
            } else {
367
                $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
368
            }
369
        } else {
370
            $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
371
        }
372
        echo '
373
                <div style="float:right; margin-right:10px;">
374
                    <img src="'.$avatar.'" style="border-radius:10px; height:28px; cursor:pointer;" onclick="loadProfileDialog()" alt="photo" id="user_avatar_thumb" />
375
                </div>';
376
377
        echo '
378
            </div>';
379
380
        echo '
381
        </div>';
382
    }
383
384
    echo '
385
    </div>';
386
387
    echo '
388
<div id="main_info_box" style="display:none; z-index:99999; position:absolute; width:400px; height:40px;" class="ui-widget ui-state-active ui-color">
389
    <span class="closeButton" onclick="$(\'#main_info_box\').hide()">&#10006</span>
390
    <div id="main_info_box_text" style="text-align:center;margin-top:10px;"></div>
391
</div>';
392
393
/* MAIN PAGE */
394
    echo '
395
        <input type="hidden" id="temps_restant" value="', isset($_SESSION['fin_session']) ? $_SESSION['fin_session'] : '', '" />
396
        <input type="hidden" name="language" id="language" value="" />
397
        <input type="hidden" name="user_pw_complexity" id="user_pw_complexity" value="', isset($_SESSION['user_pw_complexity']) ? $_SESSION['user_pw_complexity'] : '', '" />
398
        <input type="hidden" name="user_session" id="user_session" value=""/>
399
        <input type="hidden" name="encryptClientServer" id="encryptClientServer" value="', isset($SETTINGS['encryptClientServer']) ? $SETTINGS['encryptClientServer'] : '1', '" />
400
        <input type="hidden" name="please_login" id="please_login" value="" />
401
        <input type="hidden" name="disabled_action_on_going" id="disabled_action_on_going" value="" />
402
        <input type="hidden" id="duo_sig_response" value="', null !== $post_sig_response ? intval($post_sig_response) : '', '" />';
403
404
// SENDING STATISTICS?
405
    if (isset($SETTINGS['send_stats']) && $SETTINGS['send_stats'] === "1"
406
        && (!isset($_SESSION['temporary']['send_stats_done']) || $_SESSION['temporary']['send_stats_done'] !== "1")
407
    ) {
408
        echo '
409
            <input type="hidden" name="send_statistics" id="send_statistics" value="1" />';
410
    } else {
411
        echo '
412
        <input type="hidden" name="send_statistics" id="send_statistics" value="0" />';
413
    }
414
415
    echo '
416
    <div id="', (isset($_GET['page']) && filter_var($_GET['page'], FILTER_SANITIZE_STRING) === "items" && $session_user_id !== null) ? "main_simple" : "main", '">';
417
// MESSAGE BOX
418
    echo '
419
            <div style="" class="div_center">
420
                <div id="message_box" style="display:none;width:200px;padding:5px;text-align:center; z-index:999999;" class="ui-widget-content ui-state-error ui-corner-all"></div>
421
            </div>';
422
    // Main page
423
    if ($session_autoriser !== null && $session_autoriser === true) {
424
        // Show menu
425
        echo '
426
            <form method="post" name="main_form" action="">
427
                <input type="hidden" name="menu_action" id="menu_action" value="" />
428
                <input type="hidden" name="changer_pw" id="changer_pw" value="" />
429
                <input type="hidden" name="form_user_id" id="form_user_id" value="', $session_user_id !== null ? $session_user_id : '', '" />
430
                <input type="hidden" name="is_admin" id="is_admin" value="', $session_is_admin !== null ? $session_is_admin : '', '" />
431
                <input type="hidden" name="personal_saltkey_set" id="personal_saltkey_set" value="', isset($_SESSION['user_settings']['clear_psk']) ? true : false, '" />
432
            </form>';
433
    }
434
// ---------
435
// Display a help to admin
436
    $errorAdmin = "";
437
438
// error nb folders
439
    if ($session_nb_folders !== null && intval($session_nb_folders) === 0) {
440
        $errorAdmin = '<span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;">&nbsp;</span>'.$LANG['error_no_folders'].'<br />';
441
    }
442
// error nb roles
443
    if ($session_nb_roles !== null && intval($session_nb_roles) === 0) {
444
        if (empty($errorAdmin)) {
445
            $errorAdmin = '<span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;">&nbsp;</span>'.$LANG['error_no_roles'];
446
        } else {
447
            $errorAdmin .= '<br /><span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;">&nbsp;</span>'.$LANG['error_no_roles'];
448
        }
449
    }
450
451
    if ($session_validite_pw !== null && empty($session_validite_pw) === false) {
452
        // error cpassman dir
453 View Code Duplication
        if (isset($SETTINGS['cpassman_dir']) && empty($SETTINGS['cpassman_dir']) || !isset($SETTINGS['cpassman_dir'])) {
454
            if (empty($errorAdmin)) {
455
                $errorAdmin = '<span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;">&nbsp;</span>'.$LANG['error_cpassman_dir'];
456
            } else {
457
                $errorAdmin .= '<br /><span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;">&nbsp;</span>'.$LANG['error_cpassman_dir'];
458
            }
459
        }
460
        // error cpassman url
461 View Code Duplication
        if ($session_validite_pw !== null && (isset($SETTINGS['cpassman_url']) && empty($SETTINGS['cpassman_url']) || !isset($SETTINGS['cpassman_url']))) {
462
            if (empty($errorAdmin)) {
463
                $errorAdmin = '<span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;">&nbsp;</span>'.$LANG['error_cpassman_url'];
464
            } else {
465
                $errorAdmin .= '<br /><span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;">&nbsp;</span>'.$LANG['error_cpassman_url'];
466
            }
467
        }
468
    }
469
// Display help
470
    if (!empty($errorAdmin)) {
471
        echo '
472
                <div style="margin:10px;padding:10px;" class="ui-state-error ui-corner-all">
473
                '.$errorAdmin.'
474
                </div>';
475
    }
476
// -----------
477
// Display Maintenance mode information
478
    if (isset($SETTINGS['maintenance_mode']) === true && $SETTINGS['maintenance_mode'] === '1'
479
            && $session_user_admin !== null && $session_user_admin === '1'
480
        ) {
481
        echo '
482
            <div style="text-align:center;margin-bottom:5px;padding:10px;" class="ui-state-highlight ui-corner-all">
483
                <b>'.$LANG['index_maintenance_mode_admin'].'</b>
484
            </div>';
485
    }
486
// Display UPDATE NEEDED information
487
    if (isset($SETTINGS['update_needed']) && $SETTINGS['update_needed'] === true
488
            && $session_user_admin !== null && $session_user_admin === '1'
489
            && (($session_hide_maintenance !== null && $session_hide_maintenance === '0')
490
            || $session_hide_maintenance === null)
491
        ) {
492
        echo '
493
            <div style="text-align:center;margin-bottom:5px;padding:10px;"
494
                class="ui-state-highlight ui-corner-all" id="div_maintenance">
495
                <b>'.$LANG['update_needed_mode_admin'].'</b>
496
                <span style="float:right;cursor:pointer;">
497
                    <span class="fa fa-close mi-red" onclick="toggleDiv(\'div_maintenance\')"></span>
498
                </span>
499
            </div>';
500
    }
501
502
// display an item in the context of OTV link
503
    if (($session_validite_pw === null || empty($session_validite_pw) === true || empty($session_user_id) === true) &&
504
        isset($_GET['otv']) && filter_var($_GET['otv'], FILTER_SANITIZE_STRING) === 'true'
505
    ) {
506
        // case where one-shot viewer
507
        if (isset($_GET['code']) && !empty($_GET['code'])
508
            && isset($_GET['stamp']) && !empty($_GET['stamp'])
509
        ) {
510
            include 'otv.php';
511
        } else {
512
            $_SESSION['error']['code'] = ERR_VALID_SESSION;
513
            $superGlobal->put(
514
                "initial_url",
515
                filter_var(
516
                    substr($server_request_uri, strpos($server_request_uri, "index.php?")),
517
                    FILTER_SANITIZE_URL
518
                ),
519
                "SESSION"
520
            );
521
            include $SETTINGS['cpassman_dir'].'/error.php';
522
        }
523
    // Ask the user to change his password
524
    } elseif (($session_validite_pw === null || $session_validite_pw === false)
525
        && empty($session_user_id) === false
526
    ) {
527
        //Check if password is valid
528
        echo '
529
        <div style="margin:auto; padding:20px; width:500px;" class="ui-state-focus ui-corner-all">
530
            <h3>'.$LANG['index_change_pw'].'</h3>
531
            <div style="height:20px;text-align:center;margin:2px;display:none;" id="change_pwd_error" class=""></div>
532
            <div style="text-align:center;margin:5px;padding:3px;" id="change_pwd_complexPw" class="ui-widget ui-state-active ui-corner-all">'.
533
            $LANG['complex_asked'].' : '.$SETTINGS_EXT['pwComplexity'][$_SESSION['user_pw_complexity']][1].
534
            '</div>
535
            <div id="pw_strength" style="margin:0 0 10px 140px;"></div>
536
            <table>
537
                <tr>
538
                    <td>'.$LANG['index_new_pw'].' :</td><td><input type="password" size="15" name="new_pw" id="new_pw"/></td>
539
                </tr>
540
                <tr><td>'.$LANG['index_change_pw_confirmation'].' :</td><td><input type="password" size="15" name="new_pw2" id="new_pw2" onkeypress="if (event.keyCode == 13) ChangeMyPass();" /></td></tr>
541
            </table>
542
            <input type="hidden" id="pw_strength_value" />
543
            <div style="width:420px; text-align:center; margin:15px 0 10px 0;">
544
                <input type="button" onClick="ChangeMyPass()" onkeypress="if (event.keyCode == 13) ChangeMyPass();" class="ui-state-default ui-corner-all" style="padding:4px;width:150px;margin:10px 0 0 80px;" value="'.$LANG['index_change_pw_button'].'" />
545
            </div>
546
        </div>
547
        <script type="text/javascript">
548
            $("#new_pw").focus();
549
        </script>';
550
    // Display pages
551
    } elseif ($session_validite_pw !== null
552
        && $session_validite_pw === true
553
        && empty($_GET['page']) === false
554
        && empty($session_user_id) === false
555
    ) {
556
        if (!extension_loaded('mcrypt')) {
557
            $_SESSION['error']['code'] = ERR_NO_MCRYPT;
558
            include $SETTINGS['cpassman_dir'].'/error.php';
559
        } elseif ($session_initial_url !== null && empty($session_initial_url) === false) {
560
            include $session_initial_url;
561
        } elseif ($_GET['page'] == "items") {
562
            // SHow page with Items
563
            if (($session_user_admin !== '1')
564
                ||
565
                ($session_user_admin === '1' && $SETTINGS_EXT['admin_full_right'] === false)
566
            ) {
567
                include 'items.php';
568
            } else {
569
                $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
570
                include $SETTINGS['cpassman_dir'].'/error.php';
571
            }
572
        } elseif ($_GET['page'] == "find") {
573
            // Show page for items findind
574
            include 'find.php';
575
        } elseif ($_GET['page'] == "favourites") {
576
            // Show page for user favourites
577
            include 'favorites.php';
578 View Code Duplication
        } elseif ($_GET['page'] == "kb") {
579
            // Show page KB
580
            if (isset($SETTINGS['enable_kb']) && $SETTINGS['enable_kb'] == 1) {
581
                include 'kb.php';
582
            } else {
583
                $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
584
                include $SETTINGS['cpassman_dir'].'/error.php';
585
            }
586
        } elseif ($_GET['page'] == "suggestion") {
587
            // Show page KB
588 View Code Duplication
            if (isset($SETTINGS['enable_suggestion']) && $SETTINGS['enable_suggestion'] == 1) {
589
                include 'suggestion.php';
590
            } else {
591
                $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
592
                include $SETTINGS['cpassman_dir'].'/error.php';
593
            }
594
        } elseif (in_array($_GET['page'], array_keys($mngPages))) {
595
            // Define if user is allowed to see management pages
596
            if ($session_user_admin === '1') {
597
                include($mngPages[$_GET['page']]);
598
            } elseif ($session_user_manager === '1') {
599
                if (($_GET['page'] != "manage_main" && $_GET['page'] != "manage_settings")) {
600
                    include($mngPages[$_GET['page']]);
601
                } else {
602
                    $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
603
                    include $SETTINGS['cpassman_dir'].'/error.php';
604
                }
605
            } else {
606
                $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
607
                include $SETTINGS['cpassman_dir'].'/error.php';
608
            }
609
        } else {
610
            $_SESSION['error']['code'] = ERR_NOT_EXIST; //page doesn't exist
611
            include $SETTINGS['cpassman_dir'].'/error.php';
612
        }
613
    // Case of password recovery
614
    } elseif (isset($_GET['action']) && $_GET['action'] === "password_recovery") {
615
        // Case where user has asked new PW
616
        echo '
617
            <div style="width:400px;margin:50px auto 50px auto;padding:25px;" class="ui-state-highlight ui-corner-all">
618
                <div style="text-align:center;font-weight:bold;margin-bottom:20px;">
619
                    '.$LANG['pw_recovery_asked'].'
620
                </div>
621
                <div id="generate_new_pw_error" style="color:red;display:none;text-align:center;margin:5px;"></div>
622
                <div style="margin-bottom:3px;">
623
                    '.$LANG['pw_recovery_info'].'
624
                </div>
625
                <div style="margin:15px; text-align:center;">
626
                    <input type="button" id="but_generate_new_password" onclick="GenerateNewPassword(\''.htmlspecialchars($_GET['key'], ENT_QUOTES).'\',\''.htmlspecialchars($_GET['login'], ENT_QUOTES).'\')" style="padding:3px;cursor:pointer;" class="ui-state-default ui-corner-all" value="'.$LANG['pw_recovery_button'].'" />
627
                    <br /><br />
628
                    <div id="ajax_loader_send_mail" style="display:none; margin: 20px;"><span class="fa fa-cog fa-spin fa-2x"></span></div>
629
                </div>
630
                <div style="margin-top:30px; text-align:center;">
631
                    <a href="index.php" class="tip" title="'.$LANG['home'].'"><span class="fa fa-home fa-lg"></span></a>
632
                </div>
633
            </div>';
634
    } elseif (empty($session_user_id) === false && $session_user_id !== null) {
635
        // Page doesn't exist
636
        $_SESSION['error']['code'] = ERR_NOT_EXIST;
637
        include $SETTINGS['cpassman_dir'].'/error.php';
638
        // When user is not identified
639
    } else {
640
        // Automatic redirection
641
        if (strpos($server_request_uri, "?") > 0) {
642
            $nextUrl = filter_var(substr($server_request_uri, strpos($server_request_uri, "?")), FILTER_SANITIZE_URL);
643
        } else {
644
            $nextUrl = "";
645
        }
646
        // MAINTENANCE MODE
647
        if (isset($SETTINGS['maintenance_mode']) === true && $SETTINGS['maintenance_mode'] === '1') {
648
            echo '
649
                <div style="text-align:center;margin-top:30px;margin-bottom:20px;padding:10px;"
650
                    class="ui-state-error ui-corner-all">
651
                    <b>'.addslashes($LANG['index_maintenance_mode']).'</b>
652
                </div>';
653
        } elseif (isset($_GET['session_over']) && $_GET['session_over'] === 'true') {
654
            // SESSION FINISHED => RECONNECTION ASKED
655
            echo '
656
                    <div style="text-align:center;margin-top:30px;margin-bottom:20px;padding:10px;"
657
                        class="ui-state-error ui-corner-all">
658
                        <b>'.addslashes($LANG['index_session_expired']).'</b>
659
                    </div>';
660
        }
661
662
        // case where user not logged and can't access a direct link
663
        if (empty($_GET['page']) === false) {
664
            $superGlobal->put(
665
                "initial_url",
666
                filter_var(
667
                    substr($server_request_uri, strpos($server_request_uri, "index.php?")),
668
                    FILTER_SANITIZE_URL
669
                ),
670
                "SESSION"
671
            );
672
            // REDIRECTION PAGE ERREUR
673
            echo '
674
            <script language="javascript" type="text/javascript">
675
            <!--
676
                sessionStorage.clear();
677
                window.location.href = "index.php";
678
            -->
679
            </script>';
680
            exit;
681
        } else {
682
            $superGlobal->put("initial_url", '', "SESSION");
683
        }
684
685
        // CONNECTION FORM
686
        echo '
687
                <form method="post" name="form_identify" id="form_identify" action="">
688
                    <div style="width:480px;margin:10px auto 10px auto;padding:25px;" class="ui-state-highlight ui-corner-all">
689
                        <div style="text-align:center;font-weight:bold;margin-bottom:20px;">',
690
        isset($SETTINGS['custom_logo']) && !empty($SETTINGS['custom_logo']) ? '<img src="'.(string) $SETTINGS['custom_logo'].'" alt="" style="margin-bottom:40px;" />' : '', '<br />
691
                            '.$LANG['index_get_identified'].'
692
                            <span id="ajax_loader_connexion" style="display:none;margin-left:10px;"><span class="fa fa-cog fa-spin fa-1x"></span></span>
693
                        </div>
694
                        <div id="connection_error" style="display:none;text-align:center;margin:5px; padding:3px;" class="ui-state-error ui-corner-all">&nbsp;<i class="fa fa-warning"></i>&nbsp;'.$LANG['index_bas_pw'].'</div>';
695
        echo '
696
                        <div style="margin-bottom:3px;">
697
                            <label for="login" class="form_label">', isset($SETTINGS['custom_login_text']) && !empty($SETTINGS['custom_login_text']) ? (string) $SETTINGS['custom_login_text'] : $LANG['index_login'], '</label>
698
                            <input type="text" size="10" id="login" name="login" class="input_text text ui-widget-content ui-corner-all" value="', empty($post_login) === false ? $post_login : '', '" />
699
                            <span id="login_check_wait" style="display:none; float:right;"><i class="fa fa-cog fa-spin fa-1x"></i></span>
700
                        </div>';
701
702
        // AGSES
703
        if (isset($SETTINGS['agses_authentication_enabled']) && $SETTINGS['agses_authentication_enabled'] == 1) {
704
            echo '
705
                        <div id="agses_cardid_div" style="text-align:center; display:none; padding:5px; width:454px; margin-bottom:5px;" class="ui-state-active ui-corner-all">
706
                            '.$LANG['user_profile_agses_card_id'].': &nbsp;
707
                            <input type="text" size="12" id="agses_cardid">
708
                        </div>
709
                        <div id="agses_flickercode_div" style="text-align:center; display:none;">
710
                            <canvas id="axs_canvas"></canvas>
711
                        </div>';
712
        }
713
714
                        echo '
715
                        <div id="connect_pw" style="margin-bottom:3px;">
716
                            <label for="pw" class="form_label" id="user_pwd">'.$LANG['index_password'].'</label>
717
                            <input type="password" size="10" id="pw" name="pw" onkeypress="if (event.keyCode == 13) launchIdentify(\'', isset($SETTINGS['duo']) && $SETTINGS['duo'] === "1" ? 1 : '', '\', \''.$nextUrl.'\', \'', isset($SETTINGS['google_authentication']) && $SETTINGS['google_authentication'] === "1" ? 1 : '', '\')" class="input_text text ui-widget-content ui-corner-all" value="', empty($post_pw) == false ? $post_pw : '', '" />
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
718
                        </div>';
719
720
        // Personal salt key
721
        if (isset($SETTINGS['psk_authentication']) && $SETTINGS['psk_authentication'] === "1") {
722
            echo '
723
                        <div id="connect_psk" style="margin-bottom:3px;">
724
                            <label for="personal_psk" class="form_label">'.$LANG['home_personal_saltkey'].'</label>
725
                            <input type="password" size="10" id="psk" name="psk" onkeypress="if (event.keyCode == 13) launchIdentify(\'', isset($SETTINGS['duo']) && $SETTINGS['duo'] === "1" ? 1 : '', '\', \''.$nextUrl.'\', \'', isset($SETTINGS['psk_authentication']) && $SETTINGS['psk_authentication'] === "1" ? 1 : '', '\')" class="input_text text ui-widget-content ui-corner-all" />
726
                        </div>
727
                        <div id="connect_psk_confirm" style="margin-bottom:3px; display:none;">
728
                            <label for="psk_confirm" class="form_label">'.$LANG['home_personal_saltkey_confirm'].'</label>
729
                            <input type="password" size="10" id="psk_confirm" name="psk_confirm" onkeypress="if (event.keyCode == 13) launchIdentify(\'', isset($SETTINGS['duo']) && $SETTINGS['duo'] === "1" ? 1 : '', '\', \''.$nextUrl.'\', \'', isset($SETTINGS['psk_authentication']) && $SETTINGS['psk_authentication'] === "1" ? 1 : '', '\')" class="input_text text ui-widget-content ui-corner-all" />
730
                        </div>';
731
        }
732
733
        // Google Authenticator code
734
        if (isset($SETTINGS['google_authentication']) && $SETTINGS['google_authentication'] === "1") {
735
            echo '
736
                        <div id="ga_code_div" style="margin-bottom:10px;">
737
                            '.$LANG['ga_identification_code'].'
738
                            <input type="text" size="4" id="ga_code" name="ga_code" style="margin:0px;" class="input_text text ui-widget-content ui-corner-all numeric_only" onkeypress="if (event.keyCode == 13) launchIdentify(\'', isset($SETTINGS['duo']) && $SETTINGS['duo'] === "1" ? 1 : '', '\', \''.$nextUrl.'\')" />
739
                        <div id="2fa_new_code_div" style="text-align:center; display:none; margin-top:5px; padding:5px;" class="ui-state-default ui-corner-all"></div>
740
                        <div style="margin-top:2px; font-size:10px; text-align:center; cursor:pointer;" onclick="send_user_new_temporary_ga_code()">'.$LANG['i_need_to_generate_new_ga_code'].'</div>
741
                        </div>';
742
        }
743
        echo '
744
                        <div style="margin-bottom:3px;">
745
                            <label for="duree_session" class="">'.$LANG['index_session_duration'].'&nbsp;('.$LANG['minutes'].') </label>
746
                            <input type="text" size="4" id="duree_session" name="duree_session" value="', isset($SETTINGS['default_session_expiration_time']) ? $SETTINGS['default_session_expiration_time'] : "60", '" onkeypress="if (event.keyCode == 13) launchIdentify(\'', isset($SETTINGS['duo']) && $SETTINGS['duo'] === "1" ? 1 : '', '\', \''.$nextUrl.'\')" class="input_text text ui-widget-content ui-corner-all numeric_only" />
747
                        </div>
748
749
                        <div style="text-align:center;margin-top:5px;font-size:10pt;">
750
                            <span onclick="OpenDialog(\'div_forgot_pw\')" style="padding:3px;cursor:pointer;">'.$LANG['forgot_my_pw'].'</span>
751
                        </div>
752
                        <div style="text-align:center;margin-top:15px;">
753
                            <input type="button" id="but_identify_user" onclick="launchIdentify(\'', isset($SETTINGS['duo']) && $SETTINGS['duo'] === "1" ? 1 : '', '\', \''.$nextUrl.'\', \'', isset($SETTINGS['psk_authentication']) && $SETTINGS['psk_authentication'] === "1" ? 1 : '', '\')" style="padding:3px;cursor:pointer;" class="ui-state-default ui-corner-all" value="'.$LANG['index_identify_button'].'" />
754
                        </div>
755
                    </div>
756
                </form>
757
                <script type="text/javascript">
758
                    $("#login").focus();
759
                </script>';
760
        // DIV for forgotten password
761
        echo '
762
                <div id="div_forgot_pw" style="display:none;">
763
                    <div style="margin:5px auto 5px auto;" id="div_forgot_pw_alert"></div>
764
                    <div style="margin:5px auto 5px auto;">'.$LANG['forgot_my_pw_text'].'</div>
765
                    <label for="forgot_pw_email">'.$LANG['email'].'</label>
766
                    <input type="text" size="40" name="forgot_pw_email" id="forgot_pw_email" />
767
                    <br />
768
                    <label for="forgot_pw_login">'.$LANG['login'].'</label>
769
                    <input type="text" size="20" name="forgot_pw_login" id="forgot_pw_login" />
770
                    <div id="div_forgot_pw_status" style="text-align:center;margin-top:15px;display:none; padding:5px;" class="ui-corner-all">
771
                        <i class="fa fa-cog fa-spin fa-2x"></i>&nbsp;<b>'.$LANG['please_wait'].'</b>
772
                    </div>
773
                </div>';
774
    }
775
    echo '
776
    </div>';
777
// FOOTER
778
/* DON'T MODIFY THE FOOTER ... MANY THANKS TO YOU */
779
    echo '
780
    <div id="footer">
781
        <div style="float:left;width:32%;">
782
            <a href="http://teampass.net" target="_blank" style="color:#F0F0F0;">'.$SETTINGS_EXT['tool_name'].'&nbsp;'.$SETTINGS_EXT['version'].'&nbsp;<i class="fa fa-copyright"></i>&nbsp;'.$SETTINGS_EXT['copyright'].'</a>
783
            &nbsp;|&nbsp;
784
            <a href="http://teampass.readthedocs.io/en/latest/" target="_blank" style="color:#F0F0F0;" class="tip" title="'.addslashes($LANG['documentation_canal']).' ReadTheDocs"><i class="fa fa-book"></i></a>
785
            &nbsp;
786
            <a href="https://www.reddit.com/r/TeamPass/" target="_blank" style="color:#F0F0F0;" class="tip" title="'.addslashes($LANG['admin_help']).'"><i class="fa fa-reddit-alien"></i></a>
787
        </div>
788
        <div style="float:left;width:32%;text-align:center;">
789
            ', ($session_user_id !== null && empty($session_user_id) === false) ? '<i class="fa fa-users"></i>&nbsp;'.$session_nb_users_online.'&nbsp;'.$LANG['users_online'].'&nbsp;|&nbsp;<i class="fa fa-hourglass-end"></i>&nbsp;'.$LANG['index_expiration_in'].'&nbsp;<div style="display:inline;" id="countdown"></div>' : '', '
790
        </div><div id="countdown2"></div>
791
        <div style="float:right;text-align:right;">
792
            <i class="fa fa-clock-o"></i>&nbsp;'. $LANG['server_time']." : ".@date($SETTINGS['date_format'], (string) $_SERVER['REQUEST_TIME'])." - ".@date($SETTINGS['time_format'], (string) $_SERVER['REQUEST_TIME']).'
793
        </div>
794
    </div>';
795
// PAGE LOADING
796
    echo '
797
    <div id="div_loading" class="hidden">
798
        <div style="padding:5px; z-index:9999999;" class="ui-widget-content ui-state-focus ui-corner-all">
799
            <i class="fa fa-cog fa-spin fa-2x"></i>
800
        </div>
801
    </div>';
802
// Alert BOX
803
    echo '
804
    <div id="div_dialog_message" style="display:none;">
805
        <div id="div_dialog_message_text" style="text-align:center; padding:4px; font-size:12px; margin-top:10px;"></div>
806
    </div>';
807
808
// WARNING FOR QUERY ERROR
809
    echo '
810
    <div id="div_mysql_error" style="display:none;">
811
        <div style="padding:10px;text-align:center;" id="mysql_error_warning"></div>
812
    </div>';
813
814
815
//Personnal SALTKEY
816
    if (isset($SETTINGS['enable_pf_feature']) && $SETTINGS['enable_pf_feature'] === "1") {
817
        echo '
818
        <div id="div_set_personal_saltkey" style="display:none;padding:4px;">
819
            <div style="text-align:center;margin:5px;padding:3px;" id="expected_psk_complexPw" class="ui-widget ui-state-active ui-corner-all hidden">', isset($SETTINGS['personal_saltkey_security_level']) === true && empty($SETTINGS['personal_saltkey_security_level']) === false ? $LANG['complex_asked']." : ".$SETTINGS_EXT['pwComplexity'][$SETTINGS['personal_saltkey_security_level']][1] : '', '</div>
820
            <table border="0">
821
                <tr>
822
                    <td>
823
                        <i class="fa fa-key"></i> <b>'.$LANG['home_personal_saltkey'].'</b>
824
                    </td>
825
                    <td>
826
                        <input type="password" name="input_personal_saltkey" id="input_personal_saltkey" style="width:200px;padding:5px;margin-left:10px;" class="text ui-widget-content ui-corner-all text_without_symbols tip" value="', isset($_SESSION['user_settings']['clear_psk']) ? (string) $_SESSION['user_settings']['clear_psk'] : '', '" title="<i class=\'fa fa-bullhorn\'></i>&nbsp;'.$LANG['text_without_symbols'].'" />
827
                        <span id="set_personal_saltkey_last_letter" style="font-weight:bold;font-size:20px;"></span>
828
                    </td>
829
                </tr>
830
                <tr>
831
                    <td></td>
832
                    <td>
833
                        <div id="psk_strength" style="margin:3px 0 0 10px;"></div>
834
                        <input type="hidden" id="psk_strength_value" />
835
                    </td>
836
                </tr>
837
            </table>
838
            <div style="display:none;margin-top:5px;text-align:center;padding:4px;" id="set_personal_saltkey_warning" class="ui-widget-content ui-corner-all"></div>
839
        </div>';
840
    }
841
842
// user profile
843
    echo '
844
<div id="dialog_user_profil" style="display:none;padding:4px;">
845
    <div id="div_user_profil">
846
        <i class="fa fa-cog fa-spin fa-2x"></i>&nbsp;<b>'.$LANG['please_wait'].'</b>
847
    </div>
848
</div>';
849
850
// DUO box
851
    echo '
852
<div id="dialog_duo" style="display:none;padding:4px;">
853
    <div id="div_duo"></div>
854
    '.$LANG['duo_loading_iframe'].'
855
    <form method="post" id="duo_form" action="#">
856
        <input type="hidden" id="duo_login" name="duo_login" value="', null !== $post_duo_login ? $post_duo_login : '', '" />
857
        <input type="hidden" id="duo_data" name="duo_data" value="', null !== $post_duo_data ? htmlentities(base64_decode($post_duo_data)) : '', '" />
858
    </form>
859
</div>';
860
861
// INCREASE session time
862
    echo '
863
<div id="div_increase_session_time" style="display:none;padding:4px;">
864
    <b>'.$LANG['index_session_duration'].':</b>
865
    <input type="text" id="input_session_duration" style="width:50px;padding:5px;margin:0 10px 0 10px;" class="text ui-widget-content ui-corner-all" value="', isset($_SESSION['user_settings']['session_duration']) ? (int) $_SESSION['user_settings']['session_duration'] / 60 : 60, '" />
866
    <b>'.$LANG['minutes'].'</b>
867
    <div style="display:none;margin-top:5px;text-align:center;padding:4px;" id="input_session_duration_warning" class="ui-widget-content ui-state-error ui-corner-all"></div>
868
</div>';
869
870
    closelog();
871
872
?>
873
<script type="text/javascript">NProgress.start();</script>
874
    </body>
875
</html>