Completed
Push — development ( 60bfa9...a230e9 )
by Nils
07:59
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
// Prepare POST variables
94
$post_language =        filter_input(INPUT_POST, 'language', FILTER_SANITIZE_STRING);
95
$post_sig_response =    filter_input(INPUT_POST, 'sig_response', FILTER_SANITIZE_STRING);
96
$post_duo_login =       filter_input(INPUT_POST, 'duo_login', FILTER_SANITIZE_STRING);
97
$post_duo_data =        filter_input(INPUT_POST, 'duo_data', FILTER_SANITIZE_STRING);
98
$post_login =           filter_input(INPUT_POST, 'login', FILTER_SANITIZE_STRING);
99
$post_pw =              filter_input(INPUT_POST, 'pw', FILTER_SANITIZE_STRING);
100
101
// Prepare superGlobal variables
102
$session_user_language =        $superGlobal->get("user_language", "SESSION");
103
$session_user_id =              $superGlobal->get("user_id", "SESSION");
104
$session_user_flag =            $superGlobal->get("user_language_flag", "SESSION");
105
$session_user_admin =           $superGlobal->get("user_admin", "SESSION");
106
$session_user_human_resources = $superGlobal->get("user_can_manage_all_users", "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
<meta http-equiv="X-UA-Compatible" content="IE=edge">
207
<title>Teampass</title>
208
<script type="text/javascript">
209
    //<![CDATA[
210
    if (window.location.href.indexOf("page=") == -1 && (window.location.href.indexOf("otv=") == -1 && window.location.href.indexOf("action=") == -1)) {
211
        if (window.location.href.indexOf("session_over=true") == -1) {
212
            //location.replace("./index.php?page=items");
213
        } else {
214
            location.replace("./logout.php");
215
        }
216
    }
217
    //]]>
218
</script>
219
<?php
220
221
// load HEADERS
222
if (isset($_SESSION['CPM'])) {
223
    echo $htmlHeaders;
224
}
225
?>
226
    </head>
227
228
<body>
229
    <?php
230
231
/* HEADER */
232
    echo '
233
    <div id="top">
234
        <div id="logo"><img src="includes/images/canevas/logo.png" alt="" /></div>';
235
    // Display menu
236
    if (empty($session_login) === false) {
237
        // welcome message
238
        echo '
239
        <div style="float:right; margin:-10px 5px 0 0; color:#FFF;">'
240
            .$LANG['index_welcome'].'&nbsp;<b>'.$session_name.'&nbsp;'.$session_lastname
241
            .'&nbsp;['.$session_login.']</b>&nbsp;-&nbsp;'
242
            , $session_user_admin === '1' ? $LANG['god'] :
243
                ($session_user_manager === '1' ? $LANG['gestionnaire'] :
244
                    ($session_user_read_only === '1' ? $LANG['read_only_account'] :
245
                        ($session_user_human_resources === '1' ? $LANG['human_resources'] :$LANG['user'])
246
                    )
247
                ), '&nbsp;'.strtolower($LANG['index_login']).'</div>';
248
249
        echo '
250
        <div id="menu_top">
251
            <div style="margin-left:20px; margin-top:2px;width:710px;" id="main_menu">';
252
        if ($session_user_admin === '0' || $SETTINGS_EXT['admin_full_right'] == 0) {
253
            echo '
254
                <a class="btn btn-default" href="#"',
255
                ($session_nb_folders !== null && intval($session_nb_folders) === 0)
256
                || ($session_nb_roles !== null && intval($session_nb_roles) === 0) ? '' : ' onclick="MenuAction(\'items\')"',
257
                '>
258
                    <i class="fa fa-key fa-2x tip" title="'.$LANG['pw'].'"></i>
259
                </a>
260
261
                <a class="btn btn-default" href="#"',
262
                ($session_nb_folders !== null && intval($session_nb_folders) === 0)
263
                || ($session_nb_roles !== null && intval($session_nb_roles) === 0) ? '' : ' onclick="MenuAction(\'find\')"',
264
                '>
265
                    <i class="fa fa-binoculars fa-2x tip" title="'.$LANG['find'].'"></i>
266
                </a>';
267
        }
268
269
        // Favourites menu
270
        if (isset($SETTINGS['enable_favourites'])
271
            && $SETTINGS['enable_favourites'] == 1
272
            &&
273
            ($session_user_admin === '0' || ($session_user_admin === '1' && $SETTINGS_EXT['admin_full_right'] === false))
274
        ) {
275
            echo '
276
                    <a class="btn btn-default" href="#" onclick="MenuAction(\'favourites\')">
277
                        <i class="fa fa-star fa-2x tip" title="'.$LANG['my_favourites'].'"></i>
278
                    </a>';
279
        }
280
        // KB menu
281 View Code Duplication
        if (isset($SETTINGS['enable_kb']) && $SETTINGS['enable_kb'] == 1) {
282
            echo '
283
                    <a class="btn btn-default" href="#" onclick="MenuAction(\'kb\')">
284
                        <i class="fa fa-map-signs fa-2x tip" title="'.$LANG['kb_menu'].'"></i>
285
                    </a>';
286
        }
287
        echo '
288
        <span id="menu_suggestion_position">';
289
        // SUGGESTION menu
290
        if (isset($SETTINGS['enable_suggestion']) && $SETTINGS['enable_suggestion'] === '1'
291
            && ($session_user_read_only === '1' || $session_user_admin === '1' || $session_user_manager === '1')
292
        ) {
293
            echo '
294
                <a class="btn btn-default" href="#" onclick="MenuAction(\'suggestion\')">
295
                    <i class="fa fa-lightbulb-o fa-2x tip" id="menu_icon_suggestions" title="'.$LANG['suggestion_menu'].'"></i>
296
                </a>';
297
        }
298
        echo '
299
        </span>';
300
        // Admin menu
301
        if ($session_user_admin === '1') {
302
            echo '
303
                    &nbsp;
304
                    <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_main\')">
305
                        <i class="fa fa-info fa-2x tip" title="'.$LANG['admin_main'].'"></i>
306
                    </a>
307
                    <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_settings\')">
308
                        <i class="fa fa-wrench fa-2x tip" title="'.$LANG['admin_settings'].'"></i>
309
                    </a>';
310
        }
311
312
        if ($session_user_admin === '1' || $session_user_manager === '1' || $session_user_human_resources === '1') {
313
            echo '
314
                &nbsp;
315
                <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_folders\')">
316
                    <i class="fa fa-folder-open fa-2x tip" title="'.$LANG['admin_groups'].'"></i>
317
                </a>
318
                <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_roles\')">
319
                    <i class="fa fa-graduation-cap fa-2x tip" title="'.$LANG['admin_functions'].'"></i>
320
                </a>
321
                <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_users\')">
322
                    <i class="fa fa-users fa-2x tip" title="'.$LANG['admin_users'].'"></i>
323
                </a>
324
                <a class="btn btn-default" href="#" onclick="MenuAction(\'manage_views\')">
325
                    <i class="fa fa-cubes fa-2x tip" title="'.$LANG['admin_views'].'"></i>
326
                </a>';
327
        }
328
329
        echo '
330
                <div style="float:right;">
331
                    <ul class="menu" style="">
332
                        <li class="" style="padding:4px;width:40px; text-align:center;"><i class="fa fa-dashboard fa-fw"></i>&nbsp;
333
                            <ul class="menu_200" style="text-align:left;">',
334
                                ($session_user_admin === '1' && $SETTINGS_EXT['admin_full_right'] === true) ? '' : isset($SETTINGS['enable_pf_feature']) === true && $SETTINGS['enable_pf_feature'] == 1 ? '
335
                                <li onclick="$(\'#div_set_personal_saltkey\').dialog(\'open\')">
336
                                    <i class="fa fa-key fa-fw"></i> &nbsp;'.$LANG['home_personal_saltkey_button'].'
337
                                </li>' : '', '
338
                                <li onclick="$(\'#div_increase_session_time\').dialog(\'open\')">
339
                                    <i class="fa fa-clock-o fa-fw"></i> &nbsp;'.$LANG['index_add_one_hour'].'
340
                                </li>
341
                                <li onclick="loadProfileDialog()">
342
                                    <i class="fa fa-user fa-fw"></i> &nbsp;'.$LANG['my_profile'].'
343
                                </li>
344
                                <li onclick="MenuAction(\'deconnexion\', \''.$session_user_id.'\')">
345
                                    <i class="fa fa-sign-out fa-fw"></i> &nbsp;'.$LANG['disconnect'].'
346
                                </li>
347
                            </ul>
348
                        </li>
349
                    </ul>
350
                </div>';
351
352
        if ($session_user_admin !== '1' || ($session_user_admin === '1' && $SETTINGS_EXT['admin_full_right'] === false)) {
353
            echo '
354
                <div style="float:right; margin-right:10px;">
355
                    <ul class="menu" id="menu_last_seen_items">
356
                        <li class="" style="padding:4px;width:40px; text-align:center;"><i class="fa fa-map fa-fw"></i>&nbsp;&nbsp;
357
                            <ul class="menu_200" id="last_seen_items_list" style="text-align:left;">
358
                                <li>'.$LANG['please_wait'].'</li>
359
                            </ul>
360
                        </li>
361
                    </ul>
362
                </div>';
363
        }
364
365
        // show avatar
366
        if ($session_user_avatar_thumb !== null && empty($session_user_avatar_thumb) === false) {
367
            if (file_exists('includes/avatars/'.$session_user_avatar_thumb)) {
368
                $avatar = $SETTINGS['cpassman_url'].'/includes/avatars/'.$session_user_avatar_thumb;
369
            } else {
370
                $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
371
            }
372
        } else {
373
            $avatar = $SETTINGS['cpassman_url'].'/includes/images/photo.jpg';
374
        }
375
        echo '
376
                <div style="float:right; margin-right:10px;">
377
                    <img src="'.$avatar.'" style="border-radius:10px; height:28px; cursor:pointer;" onclick="loadProfileDialog()" alt="photo" id="user_avatar_thumb" />
378
                </div>';
379
380
        echo '
381
            </div>';
382
383
        echo '
384
        </div>';
385
    }
386
387
    echo '
388
    </div>';
389
390
    echo '
391
<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">
392
    <span class="closeButton" onclick="$(\'#main_info_box\').hide()">&#10006</span>
393
    <div id="main_info_box_text" style="text-align:center;margin-top:10px;"></div>
394
</div>';
395
396
/* MAIN PAGE */
397
    echo '
398
        <input type="hidden" id="temps_restant" value="', isset($_SESSION['fin_session']) ? $_SESSION['fin_session'] : '', '" />
399
        <input type="hidden" name="language" id="language" value="" />
400
        <input type="hidden" name="user_pw_complexity" id="user_pw_complexity" value="', isset($_SESSION['user_pw_complexity']) ? $_SESSION['user_pw_complexity'] : '', '" />
401
        <input type="hidden" name="user_session" id="user_session" value=""/>
402
        <input type="hidden" name="encryptClientServer" id="encryptClientServer" value="', isset($SETTINGS['encryptClientServer']) ? $SETTINGS['encryptClientServer'] : '1', '" />
403
        <input type="hidden" name="please_login" id="please_login" value="" />
404
        <input type="hidden" name="disabled_action_on_going" id="disabled_action_on_going" value="" />
405
        <input type="hidden" id="duo_sig_response" value="', null !== $post_sig_response ? $post_sig_response : '', '" />';
406
407
// SENDING STATISTICS?
408
    if (isset($SETTINGS['send_stats']) && $SETTINGS['send_stats'] === "1"
409
        && (!isset($_SESSION['temporary']['send_stats_done']) || $_SESSION['temporary']['send_stats_done'] !== "1")
410
    ) {
411
        echo '
412
            <input type="hidden" name="send_statistics" id="send_statistics" value="1" />';
413
    } else {
414
        echo '
415
        <input type="hidden" name="send_statistics" id="send_statistics" value="0" />';
416
    }
417
418
    echo '
419
    <div id="', (isset($_GET['page']) && filter_var($_GET['page'], FILTER_SANITIZE_STRING) === "items" && $session_user_id !== null) ? "main_simple" : "main", '">';
420
// MESSAGE BOX
421
    echo '
422
            <div style="" class="div_center">
423
                <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>
424
            </div>';
425
    // Main page
426
    if ($session_autoriser !== null && $session_autoriser === true) {
427
        // Show menu
428
        echo '
429
            <form method="post" name="main_form" action="">
430
                <input type="hidden" name="menu_action" id="menu_action" value="" />
431
                <input type="hidden" name="changer_pw" id="changer_pw" value="" />
432
                <input type="hidden" name="form_user_id" id="form_user_id" value="', $session_user_id !== null ? $session_user_id : '', '" />
433
                <input type="hidden" name="is_admin" id="is_admin" value="', $session_is_admin !== null ? $session_is_admin : '', '" />
434
                <input type="hidden" name="personal_saltkey_set" id="personal_saltkey_set" value="', isset($_SESSION['user_settings']['clear_psk']) ? true : false, '" />
435
            </form>';
436
    }
437
// ---------
438
// Display a help to admin
439
    $errorAdmin = "";
440
441
// error nb folders
442
    if ($session_nb_folders !== null && intval($session_nb_folders) === 0) {
443
        $errorAdmin = '<span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;">&nbsp;</span>'.$LANG['error_no_folders'].'<br />';
444
    }
445
// error nb roles
446
    if ($session_nb_roles !== null && intval($session_nb_roles) === 0) {
447
        if (empty($errorAdmin)) {
448
            $errorAdmin = '<span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;">&nbsp;</span>'.$LANG['error_no_roles'];
449
        } else {
450
            $errorAdmin .= '<br /><span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;">&nbsp;</span>'.$LANG['error_no_roles'];
451
        }
452
    }
453
454
    if ($session_validite_pw !== null && empty($session_validite_pw) === false) {
455
        // error cpassman dir
456 View Code Duplication
        if (isset($SETTINGS['cpassman_dir']) && empty($SETTINGS['cpassman_dir']) || !isset($SETTINGS['cpassman_dir'])) {
457
            if (empty($errorAdmin)) {
458
                $errorAdmin = '<span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;">&nbsp;</span>'.$LANG['error_cpassman_dir'];
459
            } else {
460
                $errorAdmin .= '<br /><span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;">&nbsp;</span>'.$LANG['error_cpassman_dir'];
461
            }
462
        }
463
        // error cpassman url
464 View Code Duplication
        if ($session_validite_pw !== null && (isset($SETTINGS['cpassman_url']) && empty($SETTINGS['cpassman_url']) || !isset($SETTINGS['cpassman_url']))) {
465
            if (empty($errorAdmin)) {
466
                $errorAdmin = '<span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;">&nbsp;</span>'.$LANG['error_cpassman_url'];
467
            } else {
468
                $errorAdmin .= '<br /><span class="ui-icon ui-icon-lightbulb" style="float: left; margin-right: .3em;">&nbsp;</span>'.$LANG['error_cpassman_url'];
469
            }
470
        }
471
    }
472
// Display help
473
    if (!empty($errorAdmin)) {
474
        echo '
475
                <div style="margin:10px;padding:10px;" class="ui-state-error ui-corner-all">
476
                '.$errorAdmin.'
477
                </div>';
478
    }
479
// -----------
480
// Display Maintenance mode information
481
    if (isset($SETTINGS['maintenance_mode']) === true && $SETTINGS['maintenance_mode'] === '1'
482
            && $session_user_admin !== null && $session_user_admin === '1'
483
        ) {
484
        echo '
485
            <div style="text-align:center;margin-bottom:5px;padding:10px;" class="ui-state-highlight ui-corner-all">
486
                <b>'.$LANG['index_maintenance_mode_admin'].'</b>
487
            </div>';
488
    }
489
// Display UPDATE NEEDED information
490
    if (isset($SETTINGS['update_needed']) && $SETTINGS['update_needed'] === true
491
            && $session_user_admin !== null && $session_user_admin === '1'
492
            && (($session_hide_maintenance !== null && $session_hide_maintenance === '0')
493
            || $session_hide_maintenance === null)
494
        ) {
495
        echo '
496
            <div style="text-align:center;margin-bottom:5px;padding:10px;"
497
                class="ui-state-highlight ui-corner-all" id="div_maintenance">
498
                <b>'.$LANG['update_needed_mode_admin'].'</b>
499
                <span style="float:right;cursor:pointer;">
500
                    <span class="fa fa-close mi-red" onclick="toggleDiv(\'div_maintenance\')"></span>
501
                </span>
502
            </div>';
503
    }
504
505
// display an item in the context of OTV link
506
    if (($session_validite_pw === null || empty($session_validite_pw) === true || empty($session_user_id) === true) &&
507
        isset($_GET['otv']) && filter_var($_GET['otv'], FILTER_SANITIZE_STRING) === 'true'
508
    ) {
509
        // case where one-shot viewer
510
        if (isset($_GET['code']) && !empty($_GET['code'])
511
            && isset($_GET['stamp']) && !empty($_GET['stamp'])
512
        ) {
513
            include 'otv.php';
514
        } else {
515
            $_SESSION['error']['code'] = ERR_VALID_SESSION;
516
            $superGlobal->put(
517
                "initial_url",
518
                filter_var(
519
                    substr($server_request_uri, strpos($server_request_uri, "index.php?")),
520
                    FILTER_SANITIZE_URL
521
                ),
522
                "SESSION"
523
            );
524
            include $SETTINGS['cpassman_dir'].'/error.php';
525
        }
526
    // Ask the user to change his password
527
    } elseif (($session_validite_pw === null || $session_validite_pw === false)
528
        && empty($session_user_id) === false
529
    ) {
530
        //Check if password is valid
531
        echo '
532
        <div style="margin:auto; padding:20px; width:500px;" class="ui-state-focus ui-corner-all">
533
            <h3>'.$LANG['index_change_pw'].'</h3>
534
            <div style="height:20px;text-align:center;margin:2px;display:none;" id="change_pwd_error" class=""></div>
535
            <div style="text-align:center;margin:5px;padding:3px;" id="change_pwd_complexPw" class="ui-widget ui-state-active ui-corner-all">'.
536
            $LANG['complex_asked'].' : '.$SETTINGS_EXT['pwComplexity'][$_SESSION['user_pw_complexity']][1].
537
            '</div>
538
            <div id="pw_strength" style="margin:0 0 10px 140px;"></div>
539
            <table>
540
                <tr>
541
                    <td>'.$LANG['index_new_pw'].' :</td><td><input type="password" size="15" name="new_pw" id="new_pw"/></td>
542
                </tr>
543
                <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>
544
            </table>
545
            <input type="hidden" id="pw_strength_value" />
546
            <div style="width:420px; text-align:center; margin:15px 0 10px 0;">
547
                <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'].'" />
548
            </div>
549
        </div>
550
        <script type="text/javascript">
551
            $("#new_pw").focus();
552
        </script>';
553
    // Display pages
554
    } elseif ($session_validite_pw !== null
555
        && $session_validite_pw === true
556
        && empty($_GET['page']) === false
557
        && empty($session_user_id) === false
558
    ) {
559
        if (!extension_loaded('mcrypt')) {
560
            $_SESSION['error']['code'] = ERR_NO_MCRYPT;
561
            include $SETTINGS['cpassman_dir'].'/error.php';
562
        } elseif ($session_initial_url !== null && empty($session_initial_url) === false) {
563
            include $session_initial_url;
564
        } elseif ($_GET['page'] == "items") {
565
            // SHow page with Items
566
            if (($session_user_admin !== '1')
567
                ||
568
                ($session_user_admin === '1' && $SETTINGS_EXT['admin_full_right'] === false)
569
            ) {
570
                include 'items.php';
571
            } else {
572
                $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
573
                include $SETTINGS['cpassman_dir'].'/error.php';
574
            }
575
        } elseif ($_GET['page'] == "find") {
576
            // Show page for items findind
577
            include 'find.php';
578
        } elseif ($_GET['page'] == "favourites") {
579
            // Show page for user favourites
580
            include 'favorites.php';
581 View Code Duplication
        } elseif ($_GET['page'] == "kb") {
582
            // Show page KB
583
            if (isset($SETTINGS['enable_kb']) && $SETTINGS['enable_kb'] == 1) {
584
                include 'kb.php';
585
            } else {
586
                $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
587
                include $SETTINGS['cpassman_dir'].'/error.php';
588
            }
589
        } elseif ($_GET['page'] == "suggestion") {
590
            // Show page KB
591 View Code Duplication
            if (isset($SETTINGS['enable_suggestion']) && $SETTINGS['enable_suggestion'] == 1) {
592
                include 'suggestion.php';
593
            } else {
594
                $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
595
                include $SETTINGS['cpassman_dir'].'/error.php';
596
            }
597
        } elseif (in_array($_GET['page'], array_keys($mngPages))) {
598
            // Define if user is allowed to see management pages
599
            if ($session_user_admin === '1') {
600
                include($mngPages[$_GET['page']]);
601
            } elseif ($session_user_manager === '1' || $session_user_human_resources == '1') {
602
                if (($_GET['page'] != "manage_main" && $_GET['page'] != "manage_settings")) {
603
                    include($mngPages[$_GET['page']]);
604
                } else {
605
                    $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
606
                    include $SETTINGS['cpassman_dir'].'/error.php';
607
                }
608
            } else {
609
                $_SESSION['error']['code'] = ERR_NOT_ALLOWED; //not allowed page
610
                include $SETTINGS['cpassman_dir'].'/error.php';
611
            }
612
        } else {
613
            $_SESSION['error']['code'] = ERR_NOT_EXIST; //page doesn't exist
614
            include $SETTINGS['cpassman_dir'].'/error.php';
615
        }
616
    // Case of password recovery
617
    } elseif (isset($_GET['action']) && $_GET['action'] === "password_recovery") {
618
        // Case where user has asked new PW
619
        echo '
620
            <div style="width:400px;margin:50px auto 50px auto;padding:25px;" class="ui-state-highlight ui-corner-all">
621
                <div style="text-align:center;font-weight:bold;margin-bottom:20px;">
622
                    '.$LANG['pw_recovery_asked'].'
623
                </div>
624
                <div id="generate_new_pw_error" style="color:red;display:none;text-align:center;margin:5px;"></div>
625
                <div style="margin-bottom:3px;">
626
                    '.$LANG['pw_recovery_info'].'
627
                </div>
628
                <div style="margin:15px; text-align:center;">
629
                    <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'].'" />
630
                    <br /><br />
631
                    <div id="ajax_loader_send_mail" style="display:none; margin: 20px;"><span class="fa fa-cog fa-spin fa-2x"></span></div>
632
                </div>
633
                <div style="margin-top:30px; text-align:center;">
634
                    <a href="index.php" class="tip" title="'.$LANG['home'].'"><span class="fa fa-home fa-lg"></span></a>
635
                </div>
636
            </div>';
637
    } elseif (empty($session_user_id) === false && $session_user_id !== null) {
638
        // Page doesn't exist
639
        $_SESSION['error']['code'] = ERR_NOT_EXIST;
640
        include $SETTINGS['cpassman_dir'].'/error.php';
641
        // When user is not identified
642
    } else {
643
        // Automatic redirection
644
        if (strpos($server_request_uri, "?") > 0) {
645
            $nextUrl = filter_var(substr($server_request_uri, strpos($server_request_uri, "?")), FILTER_SANITIZE_URL);
646
        } else {
647
            $nextUrl = "";
648
        }
649
        // MAINTENANCE MODE
650
        if (isset($SETTINGS['maintenance_mode']) === true && $SETTINGS['maintenance_mode'] === '1') {
651
            echo '
652
                <div style="text-align:center;margin-top:30px;margin-bottom:20px;padding:10px;"
653
                    class="ui-state-error ui-corner-all">
654
                    <b>'.addslashes($LANG['index_maintenance_mode']).'</b>
655
                </div>';
656
        } elseif (isset($_GET['session_over']) && $_GET['session_over'] === 'true') {
657
            // SESSION FINISHED => RECONNECTION ASKED
658
            echo '
659
                    <div style="text-align:center;margin-top:30px;margin-bottom:20px;padding:10px;"
660
                        class="ui-state-error ui-corner-all">
661
                        <b>'.addslashes($LANG['index_session_expired']).'</b>
662
                    </div>';
663
        }
664
665
        // case where user not logged and can't access a direct link
666
        if (empty($_GET['page']) === false) {
667
            $superGlobal->put(
668
                "initial_url",
669
                filter_var(
670
                    substr($server_request_uri, strpos($server_request_uri, "index.php?")),
671
                    FILTER_SANITIZE_URL
672
                ),
673
                "SESSION"
674
            );
675
            // REDIRECTION PAGE ERREUR
676
            echo '
677
            <script language="javascript" type="text/javascript">
678
            <!--
679
                sessionStorage.clear();
680
                window.location.href = "index.php";
681
            -->
682
            </script>';
683
            exit;
684
        } else {
685
            $superGlobal->put("initial_url", '', "SESSION");
686
        }
687
688
        // CONNECTION FORM
689
        echo '
690
                <form method="post" name="form_identify" id="form_identify" action="">
691
                    <div style="width:480px;margin:10px auto 10px auto;padding:25px;" class="ui-state-highlight ui-corner-all">
692
                        <div style="text-align:center;font-weight:bold;margin-bottom:20px;">',
693
        isset($SETTINGS['custom_logo']) && !empty($SETTINGS['custom_logo']) ? '<img src="'.(string) $SETTINGS['custom_logo'].'" alt="" style="margin-bottom:40px;" />' : '', '<br />
694
                            '.$LANG['index_get_identified'].'
695
                            <span id="ajax_loader_connexion" style="display:none;margin-left:10px;"><span class="fa fa-cog fa-spin fa-1x"></span></span>
696
                        </div>
697
                        <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>';
698
        echo '
699
                        <div style="margin-bottom:3px;">
700
                            <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>
0 ignored issues
show
Security Cross-Site Scripting introduced by
isset($SETTINGS['custom_... : $LANG['index_login'] can contain request data and is used in output context(s) leading to a potential security vulnerability.

1 path for user data to reach this point

  1. Read from $_GET
    in includes/libraries/protect/SuperGlobal/SuperGlobal.php on line 45
  2. SuperGlobal::get() returns tainted data, and $SETTINGS is assigned
    in index.php on line 68

Preventing Cross-Site-Scripting Attacks

Cross-Site-Scripting allows an attacker to inject malicious code into your website - in particular Javascript code, and have that code executed with the privileges of a visiting user. This can be used to obtain data, or perform actions on behalf of that visiting user.

In order to prevent this, make sure to escape all user-provided data:

// for HTML
$sanitized = htmlentities($tainted, ENT_QUOTES);

// for URLs
$sanitized = urlencode($tainted);

General Strategies to prevent injection

In general, it is advisable to prevent any user-data to reach this point. This can be done by white-listing certain values:

if ( ! in_array($value, array('this-is-allowed', 'and-this-too'), true)) {
    throw new \InvalidArgumentException('This input is not allowed.');
}

For numeric data, we recommend to explicitly cast the data:

$sanitized = (integer) $tainted;
Loading history...
701
                            <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 : '', '" />
702
                            <span id="login_check_wait" style="display:none; float:right;"><i class="fa fa-cog fa-spin fa-1x"></i></span>
703
                        </div>';
704
705
        // AGSES
706
        if (isset($SETTINGS['agses_authentication_enabled']) && $SETTINGS['agses_authentication_enabled'] == 1) {
707
            echo '
708
                        <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">
709
                            '.$LANG['user_profile_agses_card_id'].': &nbsp;
710
                            <input type="text" size="12" id="agses_cardid">
711
                        </div>
712
                        <div id="agses_flickercode_div" style="text-align:center; display:none;">
713
                            <canvas id="axs_canvas"></canvas>
714
                        </div>';
715
        }
716
717
                        echo '
718
                        <div id="connect_pw" style="margin-bottom:3px;">
719
                            <label for="pw" class="form_label" id="user_pwd">'.$LANG['index_password'].'</label>
720
                            <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 : '', '" />
721
                        </div>';
722
723
        // Personal salt key
724
        if (isset($SETTINGS['psk_authentication']) && $SETTINGS['psk_authentication'] === "1") {
725
            echo '
726
                        <div id="connect_psk" style="margin-bottom:3px;">
727
                            <label for="personal_psk" class="form_label">'.$LANG['home_personal_saltkey'].'</label>
728
                            <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" />
729
                        </div>
730
                        <div id="connect_psk_confirm" style="margin-bottom:3px; display:none;">
731
                            <label for="psk_confirm" class="form_label">'.$LANG['home_personal_saltkey_confirm'].'</label>
732
                            <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" />
733
                        </div>';
734
        }
735
736
        // Google Authenticator code
737
        if (isset($SETTINGS['google_authentication']) === true && $SETTINGS['google_authentication'] === "1") {
738
            echo '
739
                        <div id="ga_code_div" style="margin-bottom:10px;">
740
                            '.$LANG['ga_identification_code'].'
741
                            <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.'\')" />
742
                        <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>
743
                        <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>
744
                        </div>';
745
        }
746
        echo '
747
                        <div style="margin-bottom:3px;">
748
                            <label for="duree_session" class="">'.$LANG['index_session_duration'].'&nbsp;('.$LANG['minutes'].') </label>
749
                            <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" />
750
                        </div>';
751
752
        // Google Authenticator code
753
        if (isset($SETTINGS['disable_show_forgot_pwd_link']) === true && $SETTINGS['google_authentication'] !== "1") {
754
            echo '
755
                        <div style="text-align:center;margin-top:5px;font-size:10pt;">
756
                            <span onclick="OpenDialog(\'div_forgot_pw\')" style="padding:3px;cursor:pointer;">'.$LANG['forgot_my_pw'].'</span>
757
                        </div>';
758
        }
759
        echo '
760
                        <div style="text-align:center;margin-top:15px;">
761
                            <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'].'" />
762
                        </div>
763
                    </div>
764
                </form>
765
                <script type="text/javascript">
766
                    $("#login").focus();
767
                </script>';
768
        // DIV for forgotten password
769
        echo '
770
                <div id="div_forgot_pw" style="display:none;">
771
                    <div style="margin:5px auto 5px auto;" id="div_forgot_pw_alert"></div>
772
                    <div style="margin:5px auto 5px auto;">'.$LANG['forgot_my_pw_text'].'</div>
773
                    <label for="forgot_pw_email">'.$LANG['email'].'</label>
774
                    <input type="text" size="40" name="forgot_pw_email" id="forgot_pw_email" />
775
                    <br />
776
                    <label for="forgot_pw_login">'.$LANG['login'].'</label>
777
                    <input type="text" size="20" name="forgot_pw_login" id="forgot_pw_login" />
778
                    <div id="div_forgot_pw_status" style="text-align:center;margin-top:15px;display:none; padding:5px;" class="ui-corner-all">
779
                        <i class="fa fa-cog fa-spin fa-2x"></i>&nbsp;<b>'.$LANG['please_wait'].'</b>
780
                    </div>
781
                </div>';
782
    }
783
    echo '
784
    </div>';
785
// FOOTER
786
/* DON'T MODIFY THE FOOTER ... MANY THANKS TO YOU */
787
    echo '
788
    <div id="footer">
789
        <div style="float:left;width:32%;">
790
            <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>
791
            &nbsp;|&nbsp;
792
            <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>
793
            &nbsp;
794
            <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>
795
            &nbsp;
796
            ', ($session_user_id !== null && empty($session_user_id) === false) ? '
797
            <a href="#" style="color:#F0F0F0;" class="tip" title="'.addslashes($LANG['bugs_page']).'" onclick="generateBugReport()"><i class="fa fa-bug"></i></a>' : '' ,'
798
        </div>
799
        <div style="float:left;width:32%;text-align:center;">
800
            ', ($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>' : '', '
801
        </div><div id="countdown2"></div>
802
        <div style="float:right;text-align:right;">
803
            <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']).'
804
        </div>
805
    </div>';
806
// PAGE LOADING
807
    echo '
808
    <div id="div_loading" class="hidden">
809
        <div style="padding:5px; z-index:9999999;" class="ui-widget-content ui-state-focus ui-corner-all">
810
            <i class="fa fa-cog fa-spin fa-2x"></i>
811
        </div>
812
    </div>';
813
// Alert BOX
814
    echo '
815
    <div id="div_dialog_message" style="display:none;">
816
        <div id="div_dialog_message_text" style="text-align:center; padding:4px; font-size:12px; margin-top:10px;"></div>
817
    </div>';
818
819
// WARNING FOR QUERY ERROR
820
    echo '
821
    <div id="div_mysql_error" style="display:none;">
822
        <div style="padding:10px;text-align:center;" id="mysql_error_warning"></div>
823
    </div>';
824
825
826
//Personnal SALTKEY
827
    if (isset($SETTINGS['enable_pf_feature']) && $SETTINGS['enable_pf_feature'] === "1") {
828
        echo '
829
        <div id="div_set_personal_saltkey" style="display:none;padding:4px;">
830
            <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>
831
            <table border="0">
832
                <tr>
833
                    <td>
834
                        <i class="fa fa-key"></i> <b>'.$LANG['home_personal_saltkey'].'</b>
835
                    </td>
836
                    <td>
837
                        <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'].'" />
838
                        <span id="set_personal_saltkey_last_letter" style="font-weight:bold;font-size:20px;"></span>
839
                    </td>
840
                </tr>
841
                <tr>
842
                    <td></td>
843
                    <td>
844
                        <div id="psk_strength" style="margin:3px 0 0 10px;"></div>
845
                        <input type="hidden" id="psk_strength_value" />
846
                    </td>
847
                </tr>
848
            </table>
849
            <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>
850
        </div>';
851
    }
852
853
// user profile
854
    echo '
855
<div id="dialog_user_profil" style="display:none;padding:4px;">
856
    <div id="div_user_profil">
857
        <i class="fa fa-cog fa-spin fa-2x"></i>&nbsp;<b>'.$LANG['please_wait'].'</b>
858
    </div>
859
</div>';
860
861
// DUO box
862
    echo '
863
<div id="dialog_duo" style="display:none;padding:4px;">
864
    <div id="div_duo"></div>
865
    '.$LANG['duo_loading_iframe'].'
866
    <form method="post" id="duo_form" action="">
867
        <input type="hidden" id="duo_login" name="duo_login" value="', null !== $post_duo_login ? $post_duo_login : '', '" />
868
        <input type="hidden" id="duo_data" name="duo_data" value="', null !== $post_duo_data ? htmlentities(base64_decode($post_duo_data)) : '', '" />
869
    </form>
870
</div>';
871
872
// INCREASE session time
873
    echo '
874
<div id="div_increase_session_time" style="display:none;padding:4px;">
875
    <b>'.$LANG['index_session_duration'].':</b>
876
    <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, '" />
877
    <b>'.$LANG['minutes'].'</b>
878
    <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>
879
</div>';
880
881
    closelog();
882
883
?>
884
<script type="text/javascript">NProgress.start();</script>
885
    </body>
886
</html>