Passed
Push — master ( e824e6...9b9d31 )
by Nils
05:57
created
Severity
1
<?php
2
3
declare(strict_types=1);
4
5
/**
6
 * Teampass - a collaborative passwords manager.
7
 * ---
8
 * This file is part of the TeamPass project.
9
 * 
10
 * TeamPass is free software: you can redistribute it and/or modify it
11
 * under the terms of the GNU General Public License as published by
12
 * the Free Software Foundation, version 3 of the License.
13
 * 
14
 * TeamPass is distributed in the hope that it will be useful,
15
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
 * GNU General Public License for more details.
18
 * 
19
 * You should have received a copy of the GNU General Public License
20
 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21
 * 
22
 * Certain components of this file may be under different licenses. For
23
 * details, see the `licenses` directory or individual file headers.
24
 * ---
25
 * @file      index.php
26
 * @author    Nils Laumaillé ([email protected])
27
 * @copyright 2009-2025 Teampass.net
28
 * @license   GPL-3.0
29
 * @see       https://www.teampass.net
30
 */
31
32
use voku\helper\AntiXSS;
33
use TeampassClasses\SessionManager\SessionManager;
34
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
35
use TeampassClasses\Language\Language;
36
use TeampassClasses\ConfigManager\ConfigManager;
37
38
// Security Headers
39
header('X-XSS-Protection: 1; mode=block');
40
// deepcode ignore TooPermissiveXFrameOptions: Not the case as sameorigin is used
41
header('X-Frame-Options: SameOrigin');
42
43
// Cache Headers
44
header("Cache-Control: no-cache, no-store, must-revalidate");
45
header("Pragma: no-cache");
46
header("Expires: 0");
47
48
// **PREVENTING SESSION HIJACKING**
49
// Prevents javascript XSS attacks aimed to steal the session ID
50
//ini_set('session.cookie_httponly', 1);
51
// **PREVENTING SESSION FIXATION**
52
// Session ID cannot be passed through URLs
53
//ini_set('session.use_only_cookies', 1);
54
// Uses a secure connection (HTTPS) if possible
55
//ini_set('session.cookie_secure', 0);
56
//ini_set('session.cookie_samesite', 'Lax');
57
// Before we start processing, we should abort no install is present
58
if (file_exists(__DIR__.'/includes/config/settings.php') === false) {
59
    // This should never happen, but in case it does
60
    // this means if headers are sent, redirect will fallback to JS
61
    if (headers_sent()) {
62
        echo '<script language="javascript" type="text/javascript">document.location.replace("install/install.php");</script>';
63
    } else {
64
        header('Location: install/install.php');
65
    }
66
    // Now either way, we should stop processing further
67
    exit;
68
}
69
70
// initialise CSRFGuard library
71
require_once __DIR__.'/includes/libraries/csrfp/libs/csrf/csrfprotector.php';
72
csrfProtector::init();
73
74
// Load functions
75
require_once __DIR__. '/includes/config/include.php';
76
require_once __DIR__.'/sources/main.functions.php';
77
78
// init
79
loadClasses();
80
$session = SessionManager::getSession();
81
82
// Random encryption key
83
if ($session->get('key') === null)
84
    $session->set('key', generateQuickPassword(30, false));
85
86
$request = SymfonyRequest::createFromGlobals();
87
$configManager = new ConfigManager();
88
$SETTINGS = $configManager->getAllSettings();
89
$antiXss = new AntiXSS();
90
$session->set('encryptClientServer', (int) $SETTINGS['encryptClientServer'] ?? 1);
91
92
// Quick major version check -> upgrade needed?
93
if (isset($SETTINGS['teampass_version']) === true && version_compare(TP_VERSION, $SETTINGS['teampass_version']) > 0) {
94
    $session->invalidate();
95
    // Perform redirection
96
    if (headers_sent()) {
97
        echo '<script language="javascript" type="text/javascript">document.location.replace("install/install.php");</script>';
98
    } else {
99
        header('Location: install/upgrade.php');
100
    }
101
    // No other way, we should stop processing further
102
    exit;
103
}
104
105
106
$SETTINGS = $antiXss->xss_clean($SETTINGS);
107
108
// Load Core library
109
require_once $SETTINGS['cpassman_dir'] . '/sources/core.php';
110
// Prepare POST variables
111
$post_language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
112
$session_user_language = $session->get('user-language');
113
$session_user_admin = $session->get('user-admin');
114
$session_user_human_resources = (int) $session->get('user-can_manage_all_users');
115
$session_name = $session->get('user-name');
116
$session_lastname = $session->get('user-lastname');
117
$session_user_manager = (int) $session->get('user-manager');
118
$session_initial_url = $session->get('user-initial_url');
119
$session_nb_users_online = $session->get('system-nb_users_online');
120
$session_auth_type = $session->get('user-auth_type');
121
122
$server = [];
123
$server['request_uri'] = (string) $request->getRequestUri();
124
$server['request_time'] = (int) $request->server->get('REQUEST_TIME');
125
126
$get = [];
127
$get['page'] = $request->query->get('page') === null ? '' : $antiXss->xss_clean($request->query->get('page'));
128
$get['otv'] = $request->query->get('otv') === null ? '' : $antiXss->xss_clean($request->query->get('otv'));
129
130
// Avoid blank page and session destroy if user go to index.php without ?page=
131
if (empty($get['page']) && !empty($session_name)) {
132
    if ($session_user_admin === 1) {
133
        $redirect_page = 'admin';
134
    } else {
135
        $redirect_page = 'items';
136
    }
137
138
    // Redirect user on default page.
139
    header('Location: index.php?page='.$redirect_page);
140
    exit();
141
}
142
143
// Force log of all queries
144
// Check if super privilege exists in session
145
if (!$session->has('hasSuperPrivilege')) {
146
    // Execute query
147
    $hasSuperPrivilege = (int) DB::queryFirstField(
148
        "SELECT COUNT(*) 
149
        FROM information_schema.user_privileges 
150
        WHERE GRANTEE = CONCAT(\"'\", CURRENT_USER(), \"'@'localhost'\") 
151
        AND PRIVILEGE_TYPE = 'SUPER'"
152
    );
153
    // Save in session
154
    $session->set('hasSuperPrivilege', $hasSuperPrivilege);
155
} else {
156
    // Get value from session
157
    $hasSuperPrivilege = (int) $session->get('hasSuperPrivilege');
158
}
159
// Enable or not if user has super privilege
160
if ($hasSuperPrivilege > 0) {
161
    if (defined('MYSQL_LOG') && MYSQL_LOG === true) {
0 ignored issues
show
The condition MYSQL_LOG === true is always false.
Loading history...
162
        DB::query("SET GLOBAL general_log = 'ON'");
163
        DB::query("SET GLOBAL general_log_file = " . (defined('MYSQL_LOG_FILE') ? MYSQL_LOG_FILE : "'/var/log/teampass_mysql_query.log'"));
164
    } else {
165
        DB::query("SET GLOBAL general_log = 'OFF'");
166
    }
167
}
168
169
/* DEFINE WHAT LANGUAGE TO USE */
170
if (null === $session->get('user-validite_pw') && $post_language === null && $session_user_language === null) {
171
    //get default language
172
    $dataLanguage = DB::queryFirstRow(
173
        'SELECT m.valeur AS valeur, l.flag AS flag
174
        FROM ' . prefixTable('misc') . ' AS m
175
        INNER JOIN ' . prefixTable('languages') . ' AS l ON (m.valeur = l.name)
176
        WHERE m.type=%s_type AND m.intitule=%s_intitule',
177
        [
178
            'type' => 'admin',
179
            'intitule' => 'default_language',
180
        ]
181
    );
182
    if (empty($dataLanguage['valeur'])) {
183
        $session->set('user-language', 'english');
184
        $session->set('user-language_flag', 'us.png');
185
        $session_user_language = 'english';
186
    } else {
187
        $session->set('user-language', $dataLanguage['valeur']);
188
        $session->set('user-language_flag', $dataLanguage['flag']);
189
        $session_user_language = $dataLanguage['valeur'];
190
    }
191
} elseif (isset($SETTINGS['default_language']) === true && $session_user_language === null) {
192
    $session->set('user-language', $SETTINGS['default_language']);
193
    $session_user_language = $SETTINGS['default_language'];
194
} elseif ($post_language !== null) {
195
    $session->set('user-language', $post_language);
196
    $session_user_language = $post_language;
197
} elseif ($session_user_language === null || empty($session_user_language) === true) {
198
    if ($post_language !== null) {
199
        $session->set('user-language', $post_language);
200
        $session_user_language = $post_language;
201
    } elseif ($session_user_language !== null) {
202
        $session->set('user-language', $SETTINGS['default_language']);
203
        $session_user_language = $SETTINGS['default_language'];
204
    }
205
}
206
$lang = new Language($session_user_language, __DIR__. '/includes/language/'); 
207
208
if (isset($SETTINGS['cpassman_dir']) === false || $SETTINGS['cpassman_dir'] === '') {
209
    $SETTINGS['cpassman_dir'] = __DIR__;
210
    $SETTINGS['cpassman_url'] = (string) $server['request_uri'];
211
}
212
213
// Get the URL
214
$cpassman_url = isset($SETTINGS['cpassman_url']) ? $SETTINGS['cpassman_url'] : '';
215
// URL validation
216
if (!filter_var($cpassman_url, FILTER_VALIDATE_URL)) {
217
    $cpassman_url = '';
218
}
219
// Sanitize the URL to prevent XSS
220
$cpassman_url = htmlspecialchars($cpassman_url, ENT_QUOTES, 'UTF-8');
221
222
// Some template adjust
223
if (array_key_exists($get['page'], $mngPages) === true) {
224
    $menuAdmin = true;
225
} else {
226
    $menuAdmin = false;
227
}
228
229
// Some template adjust
230
if (array_key_exists($get['page'], $utilitiesPages) === true) {
231
    $menuUtilities = true;
232
} else {
233
    $menuUtilities = false;
234
}
235
236
// Get the favicon
237
$favicon = isset($SETTINGS['favicon']) ? $SETTINGS['favicon'] : '';
238
// URL Validation
239
if (!filter_var($favicon, FILTER_VALIDATE_URL)) {
240
    $favicon = '';
241
}
242
// Sanitize the URL to prevent XSS
243
$favicon = htmlspecialchars($favicon, ENT_QUOTES, 'UTF-8');
244
245
// Define the date and time format
246
$date_format = isset($SETTINGS['date_format']) ? $SETTINGS['date_format'] : 'Y-m-d';
247
$time_format = isset($SETTINGS['time_format']) ? $SETTINGS['time_format'] : 'H:i:s';
248
249
// Force dark theme on page generation
250
$theme = $_COOKIE['teampass_theme'] ?? 'light';
251
$theme_body = $theme === 'dark' ? 'dark-mode' : '';
252
$theme_meta = $theme === 'dark' ? '#343a40' : '#fff';
253
$theme_navbar = $theme === 'dark' ? 'navbar-dark' : 'navbar-white navbar-light';
254
255
?>
256
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
257
258
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
259
260
<head>
261
    <meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
262
    <meta name="viewport" content="width=device-width, initial-scale=1" />
263
    <meta http-equiv="x-ua-compatible" content="ie=edge" />
264
    <meta name="theme-color" content="<?php echo $theme_meta; ?>" />
265
    <title><?php echo $configManager->getSetting('teampass_title') ?? 'Teampass'; ?></title>
266
    <script type='text/javascript'>
267
        //<![CDATA[
268
        if (window.location.href.indexOf('page=') === -1 &&
269
            (window.location.href.indexOf('otv=') === -1 &&
270
                window.location.href.indexOf('action=') === -1)
271
        ) {
272
            if (window.location.href.indexOf('session_over=true') !== -1) {
273
                location.replace('./includes/core/logout.php');
274
            }
275
        }
276
        //]]>
277
    </script>
278
279
    <!-- IonIcons -->
280
    <link rel="stylesheet" href="includes/css/ionicons.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
281
    <!-- Theme style -->
282
    <link rel="stylesheet" href="plugins/adminlte/css/adminlte.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
283
    <link rel="stylesheet" href="plugins/pace-progress/themes/corner-indicator.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/css" />
284
    <link rel="stylesheet" href="plugins/select2/css/select2.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/css" />
285
    <link rel="stylesheet" href="plugins/select2/theme/select2-bootstrap4.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/css" />
286
    <!-- Theme style -->
287
    <link rel="stylesheet" href="includes/css/teampass.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
288
    <!-- Google Font: Source Sans Pro -->
289
    <link rel="stylesheet" type="text/css" href="includes/fonts/fonts.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
290
    <!-- Altertify -->
291
    <link rel="stylesheet" href="plugins/alertifyjs/css/alertify.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
292
    <link rel="stylesheet" href="plugins/alertifyjs/css/themes/bootstrap.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
293
    <!-- Toastr -->
294
    <link rel="stylesheet" href="plugins/toastr/toastr.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
295
    <!-- favicon -->
296
    <link rel="shortcut icon" type="image/png" href="<?php echo $favicon;?>"/>
297
    <!-- manifest (PWA) -->
298
    <link rel="manifest" href="manifest.json?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
299
    <!-- Custom style -->
300
    <?php
301
    if (file_exists(__DIR__ . '/includes/css/custom.css') === true) {?>
302
        <link rel="stylesheet" href="includes/css/custom.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
303
    <?php
304
    } ?>
305
</head>
306
307
308
309
310
<?php
311
// display an item in the context of OTV link
312
if ((null === $session->get('user-validite_pw') || empty($session->get('user-validite_pw')) === true || empty($session->get('user-id')) === true)
313
    && empty($get['otv']) === false)
314
{
315
    include './includes/core/otv.php';
316
    exit;
317
} elseif ($session->has('user-validite_pw') && null !== $session->get('user-validite_pw') && ($session->get('user-validite_pw') === 0 || $session->get('user-validite_pw') === 1)
318
    && empty($get['page']) === false && empty($session->get('user-id')) === false
319
) {
320
    ?>
321
    <body class="hold-transition sidebar-mini layout-navbar-fixed layout-fixed <?php echo $theme_body; ?>">
322
        <div class="wrapper">
323
324
            <!-- Navbar -->
325
            <nav class="main-header navbar navbar-expand <?php echo $theme_navbar ?>">
326
                <!-- User encryption still ongoing -->
327
                <div id="user_not_ready" class="alert alert-warning hidden pointer p-2 mt-2" style="position:absolute; left:200px;">
328
                    <span class="align-middle infotip ml-2" title="<?php echo $lang->get('keys_encryption_not_ready'); ?>" id="user_not_ready_text"><?php echo $lang->get('account_not_ready'); ?><span id="user_not_ready_progress"></span><i class="fa-solid fa-hourglass-half fa-beat-fade mr-2 ml-2"></i></span>
329
                </div>
330
331
                <!-- Left navbar links -->
332
                <ul class="navbar-nav">
333
                    <li class="nav-item">
334
                        <a class="nav-link" data-widget="pushmenu" href="#"><i class="fa-solid fa-bars"></i></a>
335
                    </li>
336
                </ul>
337
338
                <!-- Right navbar links -->
339
                <ul class="navbar-nav ml-auto">
340
                    <span class="fa-stack infotip pointer hidden mr-2" title="<?php echo $lang->get('get_your_recovery_keys'); ?>" id="open_user_keys_management" style="vertical-align: top;">
341
                        <i class="fa-solid fa-circle text-danger fa-stack-2x"></i>
342
                        <i class="fa-solid fa-bell fa-shake fa-stack-1x fa-inverse"></i>
343
                    </span>
344
                    <!-- Messages Dropdown Menu -->
345
                    <li class="nav-item dropdown">
346
                        <div class="dropdown show">
347
                            <a class="btn btn-primary dropdown-toggle" href="#" data-toggle="dropdown">
348
                                <?php
349
                                    echo $session_name . '&nbsp;' . $session_lastname; ?>
350
                            </a>
351
352
                            <div class="dropdown-menu dropdown-menu-right">
353
                                <a class="dropdown-item user-menu" href="#" data-name="increase_session">
354
                                    <i class="far fa-clock fa-fw mr-2"></i><?php echo $lang->get('index_add_one_hour'); ?></a>
355
                                <div class="dropdown-divider"></div>
356
                                <a class="dropdown-item user-menu" href="#" data-name="profile">
357
                                    <i class="fa-solid fa-user-circle fa-fw mr-2"></i><?php echo $lang->get('my_profile'); ?>
358
                                </a>
359
                                <?php
360
                                    if (empty($session_auth_type) === false && $session_auth_type !== 'ldap' && $session_auth_type !== 'oauth2') {
361
                                        ?>
362
                                    <a class="dropdown-item user-menu" href="#" data-name="password-change">
363
                                        <i class="fa-solid fa-lock fa-fw mr-2"></i><?php echo $lang->get('index_change_pw'); ?>
364
                                    </a>
365
                                <?php
366
                                    } elseif ($session_auth_type === 'ldap') {
367
                                        ?>
368
                                    <a class="dropdown-item user-menu" href="#" data-name="sync-new-ldap-password">
369
                                        <i class="fa-solid fa-key fa-fw mr-2"></i><?php echo $lang->get('sync_new_ldap_password'); ?>
370
                                    </a>
371
                                <?php
372
                                    } ?>
373
                                <a class="dropdown-item user-menu<?php echo (int) $session_user_admin === 1 ? ' hidden' : '';?>" href="#" data-name="generate-new_keys">
374
                                    <i class="fa-solid fa-spray-can-sparkles fa-fw mr-2"></i><?php echo $lang->get('generate_new_keys'); ?>
375
                                </a>
376
377
                                <!--
378
                                <div class="dropdown-divider"></div>
379
                                <a class="dropdown-item user-menu" href="#" data-name="generate-an-otp">
380
                                    <i class="fa-solid fa-qrcode fa-fw mr-2"></i><?php echo $lang->get('generate_an_otp'); ?>
381
                                </a>
382
                                -->
383
384
                                <div class="dropdown-divider"></div>
385
                                <a class="dropdown-item user-menu" href="#" data-name="logout">
386
                                    <i class="fa-solid fa-sign-out-alt fa-fw mr-2"></i><?php echo $lang->get('disconnect'); ?>
387
                                </a>
388
                            </div>
389
                        </div>
390
                    </li>
391
                    <li>
392
                        <span class="align-middle infotip ml-2 text-info" title="<?php echo $lang->get('index_expiration_in'); ?>" id="countdown"></span>
393
                    </li>
394
                    <li class="nav-item">
395
                        <a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" id="controlsidebar"><i class="fa-solid fa-th-large"></i></a>
396
                    </li>
397
                    <li id="switch-theme" class="nav-item pointer">
398
                        <i class="fa-solid fa-circle-half-stroke m-2 m-2"></i>
399
                    </li>
400
                </ul>
401
            </nav>
402
            <!-- /.navbar -->
403
404
            <!-- Main Sidebar Container -->
405
            <aside class="main-sidebar sidebar-dark-primary elevation-4">
406
                <!-- Brand Logo -->
407
                <a href="<?php echo $cpassman_url . '/index.php?page=' . ((int) $session_user_admin === 1 ? 'admin' : 'items'); ?>" class="brand-link">
408
                    <img src="includes/images/teampass-logo2-home.png" alt="Teampass Logo" class="brand-image">
409
                    <span class="brand-text font-weight-light"><?php echo TP_TOOL_NAME; ?></span>
410
                </a>
411
412
                <!-- Sidebar -->
413
                <div class="sidebar">
414
                    <!-- Sidebar Menu -->
415
                    <nav class="mt-2" style="margin-bottom:40px;">
416
                        <ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
417
                            <?php
418
                                if ($session_user_admin === 0) {
419
                                    // ITEMS & SEARCH
420
                                    echo '
421
                    <li class="nav-item">
422
                        <a href="#" data-name="items" class="nav-link', $get['page'] === 'items' ? ' active' : '', '">
423
                        <i class="nav-icon fa-solid fa-key"></i>
424
                        <p>
425
                            ' . $lang->get('pw') . '
426
                        </p>
427
                        </a>
428
                    </li>';
429
                                }
430
431
    // IMPORT menu
432
    if (isset($SETTINGS['allow_import']) === true && (int) $SETTINGS['allow_import'] === 1 && (int) $session_user_admin === 0) {
433
        echo '
434
                    <li class="nav-item">
435
                        <a href="#" data-name="import" class="nav-link', $get['page'] === 'import' ? ' active' : '', '">
436
                        <i class="nav-icon fa-solid fa-file-import"></i>
437
                        <p>
438
                            ' . $lang->get('import') . '
439
                        </p>
440
                        </a>
441
                    </li>';
442
    }
443
    // EXPORT menu
444
    if (
445
                                    isset($SETTINGS['allow_print']) === true && (int) $SETTINGS['allow_print'] === 1
446
                                    && isset($SETTINGS['roles_allowed_to_print_select']) === true
447
                                    && empty($SETTINGS['roles_allowed_to_print_select']) === false
448
                                    && count(array_intersect(
449
                                        explode(';', $session->get('user-roles')),
450
                                        explode(',', str_replace(['"', '[', ']'], '', $SETTINGS['roles_allowed_to_print_select']))
451
                                    )) > 0
452
                                    && (int) $session_user_admin === 0
453
                                ) {
454
        echo '
455
                    <li class="nav-item">
456
                        <a href="#" data-name="export" class="nav-link', $get['page'] === 'export' ? ' active' : '', '">
457
                        <i class="nav-icon fa-solid fa-file-export"></i>
458
                        <p>
459
                            ' . $lang->get('export') . '
460
                        </p>
461
                        </a>
462
                    </li>';
463
    }
464
465
    /*
466
    // OFFLINE MODE menu
467
    if (isset($SETTINGS['settings_offline_mode']) === true && (int) $SETTINGS['settings_offline_mode'] === 1) {
468
        echo '
469
                    <li class="nav-item">
470
                        <a href="#" data-name="offline" class="nav-link', $get['page'] === 'offline' ? ' active' : '' ,'">
471
                        <i class="nav-icon fa-solid fa-plug"></i>
472
                        <p>
473
                            '.$lang->get('offline').'
474
                        </p>
475
                        </a>
476
                    </li>';
477
    }
478
    */
479
480
    if ($session_user_admin === 0) {
481
        echo '
482
                    <li class="nav-item">
483
                        <a href="#" data-name="search" class="nav-link', $get['page'] === 'search' ? ' active' : '', '">
484
                        <i class="nav-icon fa-solid fa-search"></i>
485
                        <p>
486
                            ' . $lang->get('find') . '
487
                        </p>
488
                        </a>
489
                    </li>';
490
    }
491
492
    // Favourites menu
493
    if (
494
                                    isset($SETTINGS['enable_favourites']) === true && (int) $SETTINGS['enable_favourites'] === 1
495
                                    && (int) $session_user_admin === 0
496
                                ) {
497
        echo '
498
                    <li class="nav-item">
499
                        <a href="#" data-name="favourites" class="nav-link', $get['page'] === 'favourites' ? ' active' : '', '">
500
                        <i class="nav-icon fa-solid fa-star"></i>
501
                        <p>
502
                            ' . $lang->get('favorites') . '
503
                        </p>
504
                        </a>
505
                    </li>';
506
    }
507
    /*
508
        // KB menu
509
        if (isset($SETTINGS['enable_kb']) === true && $SETTINGS['enable_kb'] === '1'
510
        ) {
511
            echo '
512
                        <li class="nav-item">
513
                            <a href="#" data-name="kb" class="nav-link', $get['page'] === 'kb' ? ' active' : '' ,'">
514
                            <i class="nav-icon fa-solid fa-map-signs"></i>
515
                            <p>
516
    '.$lang->get('kb_menu').'
517
                            </p>
518
                            </a>
519
                        </li>';
520
        }
521
    */
522
    // SUGGESTION menu
523
    if (
524
                                    isset($SETTINGS['enable_suggestion']) && (int) $SETTINGS['enable_suggestion'] === 1
525
                                    && $session_user_manager === 1
526
                                ) {
527
        echo '
528
                    <li class="nav-item">
529
                        <a href="#" data-name="suggestion" class="nav-link', $get['page'] === 'suggestion' ? ' active' : '', '">
530
                        <i class="nav-icon fa-solid fa-lightbulb"></i>
531
                        <p>
532
                            ' . $lang->get('suggestion_menu') . '
533
                        </p>
534
                        </a>
535
                    </li>';
536
    }
537
538
    // Admin menu
539
    if ($session_user_admin === 1) {
540
        echo '
541
                    <li class="nav-item">
542
                        <a href="#" data-name="admin" class="nav-link', $get['page'] === 'admin' ? ' active' : '', '">
543
                        <i class="nav-icon fa-solid fa-info"></i>
544
                        <p>
545
                            ' . $lang->get('admin_main') . '
546
                        </p>
547
                        </a>
548
                    </li>
549
                    <li class="nav-item has-treeview', $menuAdmin === true ? ' menu-open' : '', '">
550
                        <a href="#" class="nav-link">
551
                            <i class="nav-icon fa-solid fa-wrench"></i>
552
                            <p>
553
                                ' . $lang->get('admin_settings') . '
554
                                <i class="fa-solid fa-angle-left right"></i>
555
                            </p>
556
                        </a>
557
                        <ul class="nav-item nav-treeview">
558
                            <li class="nav-item">
559
                                <a href="#" data-name="options" class="nav-link', $get['page'] === 'options' ? ' active' : '', '">
560
                                    <i class="fa-solid fa-check-double nav-icon"></i>
561
                                    <p>' . $lang->get('options') . '</p>
562
                                </a>
563
                            </li>
564
                            <li class="nav-item">
565
                                <a href="#" data-name="2fa" class="nav-link', $get['page'] === '2fa' ? ' active' : '', '">
566
                                    <i class="fa-solid fa-qrcode nav-icon"></i>
567
                                    <p>' . $lang->get('mfa_short') . '</p>
568
                                </a>
569
                            </li>
570
                            <li class="nav-item">
571
                                <a href="#" data-name="api" class="nav-link', $get['page'] === 'api' ? ' active' : '', '">
572
                                    <i class="fa-solid fa-cubes nav-icon"></i>
573
                                    <p>' . $lang->get('api') . '</p>
574
                                </a>
575
                            </li>
576
                            <li class="nav-item">
577
                                <a href="#" data-name="backups" class="nav-link', $get['page'] === 'backups' ? ' active' : '', '">
578
                                    <i class="fa-solid fa-database nav-icon"></i>
579
                                    <p>' . $lang->get('backups') . '</p>
580
                                </a>
581
                            </li>
582
                            <li class="nav-item">
583
                                <a href="#" data-name="emails" class="nav-link', $get['page'] === 'emails' ? ' active' : '', '">
584
                                    <i class="fa-solid fa-envelope nav-icon"></i>
585
                                    <p>' . $lang->get('emails') . '</p>
586
                                </a>
587
                            </li>
588
                            <li class="nav-item">
589
                                <a href="#" data-name="fields" class="nav-link', $get['page'] === 'fields' ? ' active' : '', '">
590
                                    <i class="fa-solid fa-keyboard nav-icon"></i>
591
                                    <p>' . $lang->get('fields') . '</p>
592
                                </a>
593
                            </li>
594
                            <li class="nav-item">
595
                                <a href="#" data-name="ldap" class="nav-link', $get['page'] === 'ldap' ? ' active' : '', '">
596
                                    <i class="fa-solid fa-id-card nav-icon"></i>
597
                                    <p>' . $lang->get('ldap') . '</p>
598
                                </a>
599
                            </li>
600
601
                            <li class="nav-item">
602
                                <a href="#" data-name="oauth" class="nav-link', $get['page'] === 'oauth' ? ' active' : '', '">
603
                                    <i class="fa-solid fa-plug nav-icon"></i>
604
                                    <p>' . $lang->get('oauth') . '</p>
605
                                </a>
606
                            </li>
607
                            
608
                            <li class="nav-item">
609
                                <a href="#" data-name="uploads" class="nav-link', $get['page'] === 'uploads' ? ' active' : '', '">
610
                                    <i class="fa-solid fa-file-upload nav-icon"></i>
611
                                    <p>' . $lang->get('uploads') . '</p>
612
                                </a>
613
                            </li>
614
                            <li class="nav-item">
615
                                <a href="#" data-name="statistics" class="nav-link', $get['page'] === 'statistics' ? ' active' : '', '">
616
                                    <i class="fa-solid fa-chart-bar nav-icon"></i>
617
                                    <p>' . $lang->get('statistics') . '</p>
618
                                </a>
619
                            </li>
620
                        </ul>
621
                    </li>';
622
623
        if (isset($SETTINGS['enable_tasks_manager']) && (int) $SETTINGS['enable_tasks_manager'] === 1) {
624
            echo '
625
                    <li class="nav-item">
626
                        <a href="#" data-name="tasks" class="nav-link', $get['page'] === 'tasks' ? ' active' : '', '">
627
                        <i class="fa-solid fa-tasks nav-icon"></i>
628
                        <p>' . $lang->get('tasks') . '</p>
629
                        </a>
630
                    </li>';
631
        }
632
        
633
        if (WIP === true) {
634
            echo '
635
                    <li class="nav-item">
636
                        <a href="#" data-name="tools" class="nav-link', $get['page'] === 'tools' ? ' active' : '', '">
637
                        <i class="nav-icon fa-solid fa-person-drowning"></i>
638
                        <p>
639
                            ' . $lang->get('tools') . '
640
                        </p>
641
                        </a>
642
                    </li>';
643
        }
644
        echo '
645
                    <li class="nav-item">
646
                        <a href="#" data-name="import" class="nav-link', $get['page'] === 'import' ? ' active' : '', '">
647
                        <i class="nav-icon fa-solid fa-file-import"></i>
648
                        <p>
649
                            ' . $lang->get('import') . '
650
                        </p>
651
                        </a>
652
                    </li>';
653
    }
654
655
    if (
656
        $session_user_admin === 1
657
        || $session_user_manager === 1
658
        || $session_user_human_resources === 1
659
    ) {
660
        echo '
661
                    <li class="nav-item">
662
                        <a href="#" data-name="folders" class="nav-link', $get['page'] === 'folders' ? ' active' : '', '">
663
                        <i class="nav-icon fa-solid fa-folder-open"></i>
664
                        <p>
665
                            ' . $lang->get('folders') . '
666
                        </p>
667
                        </a>
668
                    </li>
669
                    <li class="nav-item">
670
                        <a href="#" data-name="roles" class="nav-link', $get['page'] === 'roles' ? ' active' : '', '">
671
                        <i class="nav-icon fa-solid fa-graduation-cap"></i>
672
                        <p>
673
                            ' . $lang->get('roles') . '
674
                        </p>
675
                        </a>
676
                    </li>
677
                    <li class="nav-item">
678
                        <a href="#" data-name="users" class="nav-link', $get['page'] === 'users' ? ' active' : '', '">
679
                        <i class="nav-icon fa-solid fa-users"></i>
680
                        <p>
681
                            ' . $lang->get('users') . '
682
                        </p>
683
                        </a>
684
                    </li>
685
                    <li class="nav-item has-treeview', $menuUtilities === true ? ' menu-open' : '', '">
686
                        <a href="#" class="nav-link">
687
                        <i class="nav-icon fa-solid fa-cubes"></i>
688
                        <p>' . $lang->get('admin_views') . '<i class="fa-solid fa-angle-left right"></i></p>
689
                        </a>
690
                        <ul class="nav nav-treeview">
691
                            <li class="nav-item">
692
                                <a href="#" data-name="utilities.renewal" class="nav-link', $get['page'] === 'utilities.renewal' ? ' active' : '', '">
693
                                <i class="far fa-calendar-alt nav-icon"></i>
694
                                <p>' . $lang->get('renewal') . '</p>
695
                                </a>
696
                            </li>
697
                            <li class="nav-item">
698
                                <a href="#" data-name="utilities.deletion" class="nav-link', $get['page'] === 'utilities.deletion' ? ' active' : '', '">
699
                                <i class="fa-solid fa-trash-alt nav-icon"></i>
700
                                <p>' . $lang->get('deletion') . '</p>
701
                                </a>
702
                            </li>
703
                            <li class="nav-item">
704
                                <a href="#" data-name="utilities.logs" class="nav-link', $get['page'] === 'utilities.logs' ? ' active' : '', '">
705
                                <i class="fa-solid fa-history nav-icon"></i>
706
                                <p>' . $lang->get('logs') . '</p>
707
                                </a>
708
                            </li>
709
                            <li class="nav-item">
710
                                <a href="#" data-name="utilities.database" class="nav-link', $get['page'] === 'utilities.database' ? ' active' : '', '">
711
                                <i class="fa-solid fa-database nav-icon"></i>
712
                                <p>' . $lang->get('database') . '</p>
713
                                </a>
714
                            </li>
715
                        </ul>
716
                    </li>';
717
    } ?>
718
                        </ul>
719
                    </nav>
720
                    <!-- /.sidebar-menu -->
721
                <div class="menu-footer">
722
                    <div class="" id="sidebar-footer">
723
                        <i class="fa-solid fa-clock-o mr-2 infotip text-info pointer" title="<?php echo htmlspecialchars($lang->get('server_time') . ' ' .
724
                            date($date_format, (int) $server['request_time']) . ' - ' .
725
                            date($time_format, (int) $server['request_time']), ENT_QUOTES, 'UTF-8'); ?>"></i>
726
                        <i class="fa-solid fa-users mr-2 infotip text-info pointer" title="<?php echo $session_nb_users_online . ' ' . $lang->get('users_online'); ?>"></i>
727
                        <a href="<?php echo DOCUMENTATION_URL; ?>" target="_blank" class="text-info"><i class="fa-solid fa-book mr-2 infotip" title="<?php echo $lang->get('documentation_canal'); ?>"></i></a>
728
                        <a href="<?php echo HELP_URL; ?>" target="_blank" class="text-info"><i class="fa-solid fa-life-ring mr-2 infotip" title="<?php echo $lang->get('admin_help'); ?>"></i></a>
729
                        <?php if ($session_user_admin === 1) : ?><i class="fa-solid fa-bug infotip pointer text-info" title="<?php echo $lang->get('bugs_page'); ?>" onclick="generateBugReport()"></i><?php endif; ?>
730
                    </div>
731
                    <?php
732
    ?>
733
                </div>
734
                </div>
735
                <!-- /.sidebar -->
736
            </aside>
737
738
            <!-- Content Wrapper. Contains page content -->
739
            <div class="content-wrapper">
740
741
                <!-- DEFECT REPORT -->
742
                <div class="card card-danger m-2 hidden" id="dialog-bug-report">
743
                    <div class="card-header">
744
                        <h3 class="card-title">
745
                            <i class="fa-solid fa-bug mr-2"></i>
746
                            <?php echo $lang->get('defect_report'); ?>
747
                        </h3>
748
                    </div>
749
                    <div class="card-body">
750
                        <div class="row">
751
                            <div class="col-sm-12 col-md-12">
752
                                <div class="mb-2 alert alert-info">
753
                                    <i class="icon fa-solid fa-info mr-2"></i>
754
                                    <?php echo $lang->get('bug_report_to_github'); ?>
755
                                </div>
756
                                <textarea class="form-control" style="min-height:300px;" id="dialog-bug-report-text" placeholder="<?php echo $lang->get('please_wait_while_loading'); ?>"></textarea>
757
                            </div>
758
                        </div>
759
                    </div>
760
                    <div class="card-footer">
761
                        <button class="btn btn-primary mr-2 clipboard-copy" data-clipboard-text="dialog-bug-report-text" id="dialog-bug-report-select-button"><?php echo $lang->get('copy_to_clipboard'); ?></button>
762
                        <button class="btn btn-primary" id="dialog-bug-report-github-button"><?php echo $lang->get('open_bug_report_in_github'); ?></button>
763
                        <button class="btn btn-default float-right close-element"><?php echo $lang->get('close'); ?></button>
764
                    </div>
765
                </div>
766
                <!-- /.DEFECT REPORT -->
767
768
769
                <!-- USER CHANGE AUTH PASSWORD -->
770
                <div class="card card-warning m-3 hidden" id="dialog-user-change-password">
771
                    <div class="card-header">
772
                        <h3 class="card-title">
773
                            <i class="fa-solid fa-bullhorn mr-2"></i>
774
                            <?php echo $lang->get('your_attention_is_required'); ?>
775
                        </h3>
776
                    </div>
777
                    <div class="card-body">
778
                        <div class="row">
779
                            <div class="col-sm-12 col-md-12">
780
                                <div class="mb-5 alert alert-info" id="dialog-user-change-password-info">
781
                                    <i class="icon fa-solid fa-info mr-2"></i>
782
                                    <?php echo $lang->get('user_password_policy_tip'); ?>
783
                                </div>
784
                                <div class="input-group mb-3">
785
                                    <div class="input-group-prepend">
786
                                        <span class="input-group-text"><?php echo $lang->get('provide_your_current_password'); ?></span>
787
                                    </div>
788
                                    <input type="password" class="form-control" id="profile-current-password">
789
                                </div>
790
                                <div class="input-group mb-3">
791
                                    <div class="input-group-prepend">
792
                                        <span class="input-group-text"><?php echo $lang->get('index_new_pw'); ?></span>
793
                                    </div>
794
                                    <input type="password" class="form-control" id="profile-password">
795
                                    <div class="input-group-append" style="margin: 0px;">
796
                                        <span class="input-group-text" id="profile-password-strength"></span>
797
                                        <input type="hidden" id="profile-password-complex" />
798
                                    </div>
799
                                </div>
800
                                <div class="input-group mb-3">
801
                                    <div class="input-group-prepend">
802
                                        <span class="input-group-text"><?php echo $lang->get('index_change_pw_confirmation'); ?></span>
803
                                    </div>
804
                                    <input type="password" class="form-control" id="profile-password-confirm">
805
                                </div>
806
                                <div class="form-control mt-3 font-weight-light grey" id="dialog-user-change-password-progress">
807
                                    <?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
808
                                </div>
809
                            </div>
810
                        </div>
811
                    </div>
812
                    <div class="card-footer">
813
                        <button class="btn btn-primary" id="dialog-user-change-password-do"><?php echo $lang->get('launch'); ?></button>
814
                        <button class="btn btn-default float-right" id="dialog-user-change-password-close"><?php echo $lang->get('close'); ?></button>
815
                    </div>
816
                </div>
817
                <!-- /.USER CHANGE AUTH PASSWORD -->
818
819
820
                <!-- LDAP USER HAS CHANGED AUTH PASSWORD -->
821
                <div class="card card-warning m-3 hidden" id="dialog-ldap-user-change-password">
822
                    <div class="card-header">
823
                        <h3 class="card-title">
824
                            <i class="fa-solid fa-bullhorn mr-2"></i>
825
                            <?php echo $lang->get('your_attention_is_required'); ?>
826
                        </h3>
827
                    </div>
828
                    <div class="card-body">
829
                        <div class="row">
830
                            <div class="col-sm-12 col-md-12">
831
                                <div class="mb-5 alert alert-info" id="dialog-ldap-user-change-password-info">
832
                                    <i class="icon fa-solid fa-info mr-2"></i>
833
                                    <?php echo $lang->get('user_password_changed'); ?>
834
                                </div>
835
                                <div class="input-group mb-3">
836
                                    <div class="input-group-prepend">
837
                                        <span class="input-group-text"><?php echo $lang->get('provide_your_previous_password'); ?></span>
838
                                    </div>
839
                                    <input type="password" class="form-control" id="dialog-ldap-user-change-password-old">
840
                                </div>
841
                                <div class="input-group mb-3"  id="new-password-field">
842
                                    <div class="input-group-prepend">
843
                                        <span class="input-group-text"><?php echo $lang->get('provide_your_current_password'); ?></span>
844
                                    </div>
845
                                    <input type="password" class="form-control" id="dialog-ldap-user-change-password-current">
846
                                </div>
847
                                <div class="form-check mb-3 alert alert-danger icheck-red hidden" id="dialog-ldap-user-change-password-confirm-ignore-div">
848
                                    <input type="checkbox" class="form-check-input form-item-control flat-blue" id="dialog-ldap-user-change-password-confirm-ignore" required>
849
                                    <label class="form-check-label ml-3" for="dialog-ldap-user-change-password-confirm-ignore"><i class="fa-solid fa-bolt fa-lg mr-2"></i><?php echo $lang->get('ignore_this_password_is_lost'); ?></label>
850
                                </div>
851
                                <div class="form-control mt-3 font-weight-light grey" id="dialog-ldap-user-change-password-progress">
852
                                    <?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
853
                                </div>
854
                            </div>
855
                        </div>
856
                    </div>
857
                    <div class="card-footer">
858
                        <button class="btn btn-primary" id="dialog-ldap-user-change-password-do"><?php echo $lang->get('launch'); ?></button>
859
                        <button class="btn btn-default float-right" id="dialog-ldap-user-change-password-close"><?php echo $lang->get('close'); ?></button>
860
                    </div>
861
                </div>
862
                <!-- /.LDAP USER HAS CHANGED AUTH PASSWORD -->
863
864
865
                <!-- ADMIN ASKS FOR USER PASSWORD CHANGE -->
866
                <div class="card card-warning m-3 hidden" id="dialog-admin-change-user-password">
867
                    <div class="card-header">
868
                        <h3 class="card-title">
869
                            <i class="fa-solid fa-bullhorn mr-2"></i>
870
                            <?php echo $lang->get('your_attention_is_required'); ?>
871
                        </h3>
872
                    </div>
873
                    <div class="card-body">
874
                        <div class="row">
875
                            <div class="col-sm-12 col-md-12">
876
                                <div class="mb-2 alert alert-info" id="dialog-admin-change-user-password-info">
877
                                </div>
878
                                <div class="form-control mt-3 font-weight-light grey" id="dialog-admin-change-user-password-progress">
879
                                    <?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
880
                                </div>
881
                                <div class="mt-3">                                    
882
                                    <label>
883
                                        <span class="mr-2 pointer fw-normal"><i class="fa-solid fa-eye mr-2 text-orange"></i><?php echo $lang->get('show_user_password');?></span>
884
                                        <input type="checkbox" id="dialog-admin-change-user-password-do-show-password" class="pointer">
885
                                    </label>
886
                                </div>
887
                            </div>
888
                        </div>
889
                        <input type="hidden" id="admin_change_user_password_target_user" value="">
890
                        <input type="hidden" id="admin_change_user_encryption_code_target_user" value="">
891
                    </div>
892
                    <div class="card-footer">
893
                        <button class="btn btn-primary mr-3" id="dialog-admin-change-user-password-do"><?php echo $lang->get('launch'); ?></button>
894
                        <button class="btn btn-default float-right" id="dialog-admin-change-user-password-close"><?php echo $lang->get('close'); ?></button>
895
                    </div>
896
                </div>
897
                <!-- /.ADMIN ASKS FOR USER PASSWORD CHANGE -->
898
899
900
                <!-- USER PROVIDES TEMPORARY CODE -->
901
                <div class="card card-warning m-3 hidden" id="dialog-user-temporary-code">
902
                    <div class="card-header">
903
                        <h3 class="card-title">
904
                            <i class="fa-solid fa-bullhorn mr-2"></i>
905
                            <?php echo $lang->get('your_attention_is_required'); ?>
906
                        </h3>
907
                    </div>
908
                    <div class="card-body">
909
                        <div class="row">
910
                            <div class="col-sm-12 col-md-12">
911
                                <div class="mb-5 alert alert-info" id="dialog-user-temporary-code-info">
912
                                </div>
913
                                <div class="input-group mb-3">
914
                                    <div class="input-group-prepend">
915
                                        <span class="input-group-text"><?php echo $lang->get('provide_your_current_password'); ?></span>
916
                                    </div>
917
                                    <input type="password" class="form-control" id="dialog-user-temporary-code-current-password">
918
                                </div>
919
                                <div class="input-group mb-3">
920
                                    <div class="input-group-prepend">
921
                                        <span class="input-group-text"><?php echo $lang->get('temporary_encryption_code'); ?></span>
922
                                    </div>
923
                                    <input type="password" class="form-control" id="dialog-user-temporary-code-value">
924
                                </div>
925
                                <div class="form-control mt-3 font-weight-light grey" id="dialog-user-temporary-code-progress">
926
                                    <?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
927
                                </div>
928
                            </div>
929
                        </div>
930
                    </div>
931
                    <div class="card-footer">
932
                        <button class="btn btn-primary" id="dialog-user-temporary-code-do"><?php echo $lang->get('launch'); ?></button>
933
                        <button class="btn btn-default float-right" id="dialog-user-temporary-code-close"><?php echo $lang->get('close'); ?></button>
934
                    </div>
935
                </div>
936
                <!-- /.USER PROVIDES TEMPORARY CODE -->
937
938
939
                <!-- ENCRYPTION KEYS GENERATION FOR LDAP NEW USER -->
940
                <div class="card card-warning m-3 mt-3 hidden" id="dialog-ldap-user-build-keys-database">
941
                    <div class="card-header">
942
                        <h3 class="card-title">
943
                            <i class="fa-solid fa-bullhorn mr-2"></i>
944
                            <?php echo $lang->get('your_attention_is_required'); ?>
945
                        </h3>
946
                    </div>
947
                    <div class="card-body">
948
                        <div class="row">
949
                            <div class="col-sm-12 col-md-12">
950
                                <div class="mb-2 alert alert-info" id="warning-text-reencryption">
951
                                    <i class="icon fa-solid fa-info mr-2"></i>
952
                                    <?php echo $lang->get('help_for_launching_items_encryption'); ?>
953
                                </div>
954
955
                                <div class="input-group mb-3">
956
                                    <div class="input-group-prepend">
957
                                        <span class="input-group-text"><?php echo $lang->get('temporary_encryption_code'); ?></span>
958
                                    </div>
959
                                    <input type="password" class="form-control" id="dialog-ldap-user-build-keys-database-code">
960
                                    <br/>
961
                                </div>
962
                                <div class="input-group mb-3<?php if ($session_auth_type === 'oauth2') echo ' hidden'; ?>">
963
                                    <div class="input-group-prepend">
964
                                        <span class="input-group-text"><?php echo $lang->get('provide_your_current_password'); ?></span>
965
                                    </div>
966
                                    <input type="password" class="form-control" id="dialog-ldap-user-build-keys-database-userpassword">
967
                                </div>
968
                                
969
                                <div class="form-control mt-3 font-weight-light grey" id="dialog-ldap-user-build-keys-database-progress">
970
                                    <?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
971
                                </div>
972
                            </div>
973
                        </div>
974
                        <input type="hidden" id="sharekeys_reencryption_target_user" value="">
975
                    </div>
976
                    <div class="card-footer">
977
                        <button class="btn btn-primary" id="dialog-ldap-user-build-keys-database-do"><?php echo $lang->get('launch'); ?></button>
978
                        <button class="btn btn-default float-right" id="dialog-ldap-user-build-keys-database-close"><?php echo $lang->get('close'); ?></button>
979
                    </div>
980
                </div>
981
                <!-- /.ENCRYPTION KEYS GENERATION -->
982
983
                <!-- ENCRYPTION PERSONAL ITEMS GENERATION WITH NEW PASSWORD -->
984
                <div class="card card-warning m-3 hidden" id="dialog-encryption-personal-items-after-password-change">
985
                    <div class="card-header">
986
                        <h3 class="card-title">
987
                            <i class="fa-solid fa-bullhorn mr-2"></i>
988
                            <?php echo $lang->get('your_attention_is_required'); ?>
989
                        </h3>
990
                    </div>
991
                    <div class="card-body">
992
                        <div class="row">
993
                            <div class="col-sm-12 col-md-12">
994
                                <div class="mb-2 alert alert-info">
995
                                    <i class="icon fa-solid fa-info mr-2"></i>
996
                                    <?php echo $lang->get('attention_user_password_change'); ?>
997
                                </div>                                
998
999
                                <div class="input-group mb-3">
1000
                                    <div class="input-group-prepend">
1001
                                        <span class="input-group-text"><?php echo $lang->get('provide_your_previous_password'); ?></span>
1002
                                    </div>
1003
                                    <input type="password" class="form-control" id="depiapc-previous-password">
1004
                                    <br/>
1005
                                </div>
1006
                                <div class="input-group mb-3">
1007
                                    <div class="input-group-prepend">
1008
                                        <span class="input-group-text"><?php echo $lang->get('your_current_password'); ?></span>
1009
                                    </div>
1010
                                    <input type="password" class="form-control" id="depiapc-current-password">
1011
                                </div>
1012
                                
1013
                                <div class="alert alert-danger mt-3" role="alert">                                    
1014
                                    <label>
1015
                                        <span class="mr-2 pointer fw-normal"><?php echo $lang->get('ignore_this_password_is_lost');?></span>
1016
                                        <input type="checkbox" id="depiapc-ignore-password" class="pointer flat-blue">
1017
                                    </label>
1018
                                </div>
1019
1020
                                <div class="form-control mt-3 font-weight-light grey" id="depiapc-progress">
1021
                                    <?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
1022
                                </div>
1023
                            </div>
1024
                        </div>
1025
                    </div>
1026
                    <div class="card-footer">
1027
                        <button class="btn btn-primary" id="button_depiapc_do"><?php echo $lang->get('launch'); ?></button>
1028
                        <button class="btn btn-default float-right" id="button_depiapc_close"><?php echo $lang->get('close'); ?></button>
1029
                    </div>
1030
                </div>
1031
                <!-- /.ENCRYPTION PERSONAL ITEMS GENERATION WITH NEW PASSWORD -->
1032
                
1033
1034
                <?php
1035
                    // Case where user is allowed to see the page
1036
                    if ($get['page'] === 'items') {
1037
                        // SHow page with Items
1038
                        if ((int) $session_user_admin !== 1) {
1039
                            include $SETTINGS['cpassman_dir'] . '/pages/items.php';
1040
                        } elseif ((int) $session_user_admin === 1) {
1041
                            include $SETTINGS['cpassman_dir'] . '/pages/admin.php';
1042
                        } else {
1043
                            $session->set('system-error_code', ERR_NOT_ALLOWED);
1044
                            //not allowed page
1045
                            include $SETTINGS['cpassman_dir'] . '/error.php';
1046
                        }
1047
                    } elseif (in_array($get['page'], array_keys($mngPages)) === true) {
1048
                        // Define if user is allowed to see management pages
1049
                        if ($session_user_admin === 1) {
1050
                            // deepcode ignore FileInclusion: $get['page'] is secured through usage of array_keys test bellow
1051
                            include $SETTINGS['cpassman_dir'] . '/pages/' . basename($mngPages[$get['page']]);
1052
                        } elseif ($session_user_manager === 1 || $session_user_human_resources === 1) {
1053
                            if ($get['page'] === 'manage_main' || $get['page'] === 'manage_settings'
1054
                            ) {
1055
                                $session->set('system-error_code', ERR_NOT_ALLOWED);
1056
                                //not allowed page
1057
                                include $SETTINGS['cpassman_dir'] . '/error.php';
1058
                            }
1059
                        } else {
1060
                            $session->set('system-error_code', ERR_NOT_ALLOWED);
1061
                            //not allowed page
1062
                            include $SETTINGS['cpassman_dir'] . '/error.php';
1063
                        }
1064
                    } elseif (empty($get['page']) === false && file_exists($SETTINGS['cpassman_dir'] . '/pages/' . $get['page'] . '.php') === true) {
1065
                        // deepcode ignore FileInclusion: $get['page'] is tested against file_exists just below
1066
                        include $SETTINGS['cpassman_dir'] . '/pages/' . basename($get['page'] . '.php');
1067
                    } else {
1068
                        $session->set('system-array_roles', ERR_NOT_EXIST);
1069
                        //page doesn't exist
1070
                        include $SETTINGS['cpassman_dir'].'/error.php';
1071
                    }
1072
1073
?>
1074
1075
            </div>
1076
            <!-- /.content-wrapper -->
1077
1078
            <!-- Control Sidebar -->
1079
            <aside class="control-sidebar control-sidebar-dark">
1080
                <!-- Control sidebar content goes here -->
1081
                <div class="p-3">
1082
                    <h5><?php echo $lang->get('last_items_title'); ?></h5>
1083
                    <div>
1084
                        <ul class="list-unstyled" id="index-last-pwds">
1085
                        </ul>
1086
                    </div>
1087
                </div>
1088
            </aside>
1089
            <!-- /.control-sidebar -->
1090
1091
            <!-- Main Footer -->
1092
            <footer class="main-footer">
1093
                <!-- To the right -->
1094
                <div class="float-right d-none d-sm-inline">
1095
                    <?php echo $lang->get('version_alone'); ?>&nbsp;<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>
1096
                </div>
1097
                <!-- Default to the left -->
1098
                <strong>Copyright &copy; <?php echo TP_COPYRIGHT; ?> <a href="<?php echo TEAMPASS_URL; ?>"><?php echo TP_TOOL_NAME; ?></a>.</strong> All rights reserved.
1099
            </footer>
1100
        </div>
1101
        <!-- ./wrapper -->
1102
1103
    <?php
1104
        /* MAIN PAGE */
1105
1106
        echo '
1107
<input type="hidden" id="temps_restant" value="', $session->get('user-session_duration') ?? '', '" />';
1108
// display an item in the context of OTV link
1109
} elseif ((null === $session->get('user-validite_pw')|| empty($session->get('user-validite_pw')) === true || empty($session->get('user-id')) === true)
1110
    && empty($get['otv']) === false
1111
) {
1112
    // case where one-shot viewer
1113
    if (empty($request->query->get('code')) === false && empty($request->query->get('stamp')) === false
1114
    ) {
1115
        include './includes/core/otv.php';
1116
    } else {
1117
        $session->set('system-error_code', ERR_VALID_SESSION);
1118
        $session->set(
1119
            'user-initial_url',
1120
            filter_var(
1121
                substr(
1122
                    $server['request_uri'],
1123
                    strpos($server['request_uri'], 'index.php?')
1124
                ),
1125
                FILTER_SANITIZE_URL
1126
            )
1127
        );
1128
        include $SETTINGS['cpassman_dir'] . '/error.php';
1129
    }
1130
} elseif (//(empty($session->get('user-id')) === false && $session->get('user-id') !== null) ||
1131
        empty($session->get('user-id')) === true
1132
        || null === $session->get('user-validite_pw')
1133
        || $session->get('user-validite_pw') === 0
1134
    ) {
1135
    // case where user not logged and can't access a direct link
1136
    if (empty($get['page']) === false) {
1137
        $session->set(
1138
            'user-initial_url',
1139
            filter_var(
1140
                substr($server['request_uri'], strpos($server['request_uri'], 'index.php?')),
1141
                FILTER_SANITIZE_URL
1142
            )
1143
        );
1144
        // REDIRECTION PAGE ERREUR
1145
        echo '
1146
            <script language="javascript" type="text/javascript">
1147
                window.location.href = "./index.php";
1148
            </script>';
1149
        exit;
1150
    }
1151
    
1152
    // LOGIN form  
1153
    include $SETTINGS['cpassman_dir'] . '/includes/core/login.php';
1154
    
1155
} else {
1156
    // Clear session
1157
    $session->invalidate();
1158
}
1159
    ?>
1160
1161
    <!-- Modal -->
1162
    <div class="modal fade" id="warningModal" tabindex="-1" role="dialog" aria-labelledby="Caution" aria-hidden="true">
1163
        <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
1164
            <div class="modal-content">
1165
                <div class="modal-header">
1166
                    <h5 class="modal-title" id="warningModalTitle"></h5>
1167
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close" id="warningModalCrossClose">
1168
                        <span aria-hidden="true">&times;</span>
1169
                    </button>
1170
                </div>
1171
                <div class="modal-body" id="warningModalBody">
1172
                </div>
1173
                <div class="modal-footer">
1174
                    <button type="button" class="btn btn-secondary" data-dismiss="modal" id="warningModalButtonClose"></button>
1175
                    <button type="button" class="btn btn-primary" id="warningModalButtonAction"></button>
1176
                </div>
1177
            </div>
1178
        </div>
1179
    </div>
1180
1181
1182
1183
    <!-- REQUIRED SCRIPTS -->
1184
1185
    <!-- Font Awesome Icons -->
1186
    <link href="plugins/fontawesome-free-6/css/fontawesome.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" rel="stylesheet">
1187
    <link href="plugins/fontawesome-free-6/css/solid.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" rel="stylesheet">
1188
    <link href="plugins/fontawesome-free-6/css/regular.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" rel="stylesheet">
1189
    <link href="plugins/fontawesome-free-6/css/brands.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" rel="stylesheet">
1190
    <link href="plugins/fontawesome-free-6/css/v5-font-face.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" rel="stylesheet" /> 
1191
    <!-- jQuery -->
1192
    <script src="plugins/jquery/jquery.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1193
    <script src="plugins/jquery/jquery.cookie.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/javascript"></script>
1194
    <!-- jQuery UI -->
1195
    <script src="plugins/jqueryUI/jquery-ui.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1196
    <link rel="stylesheet" href="plugins/jqueryUI/jquery-ui.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1197
    <!-- Popper -->
1198
    <script src="plugins/popper/umd/popper.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1199
    <!-- Bootstrap -->
1200
    <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1201
    <!-- AdminLTE -->
1202
    <script src="plugins/adminlte/js/adminlte.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1203
    <!-- Altertify -->
1204
    <!--<script type="text/javascript" src="plugins/alertifyjs/alertify.min.js"></script>-->
1205
    <!-- Toastr -->
1206
    <script type="text/javascript" src="plugins/toastr/toastr.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1207
    <!-- STORE.JS -->
1208
    <script type="text/javascript" src="plugins/store.js/dist/store.everything.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1209
    <!-- cryptojs-aesphp -->
1210
    <script type="text/javascript" src="includes/libraries/cryptojs/crypto-js.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1211
    <script type="text/javascript" src="includes/libraries/cryptojs/encryption.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1212
    <!-- pace -->
1213
    <script type="text/javascript" data-pace-options='{ "ajax": true, "eventLag": false }' src="plugins/pace-progress/pace.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1214
    <!-- select2 -->
1215
    <script type="text/javascript" src="plugins/select2/js/select2.full.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1216
    <!-- simplePassMeter -->
1217
    <link rel="stylesheet" href="plugins/simplePassMeter/simplePassMeter.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/css" />
1218
    <script type="text/javascript" src="plugins/simplePassMeter/simplePassMeter.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1219
    <!-- platform -->
1220
    <script type="text/javascript" src="plugins/platform/platform.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1221
    <!-- radiobuttons -->
1222
    <link rel="stylesheet" href="plugins/radioforbuttons/bootstrap-buttons.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/css" />
1223
    <script type="text/javascript" src="plugins/radioforbuttons/jquery.radiosforbuttons.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1224
    <!-- ICHECK -->
1225
    <!--<link rel="stylesheet" href="./plugins/icheck-material/icheck-material.min.css">-->
1226
    <link rel="stylesheet" href="./plugins/icheck/skins/all.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1227
    <script type="text/javascript" src="./plugins/icheck/icheck.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1228
    <!-- bootstrap-add-clear -->
1229
    <script type="text/javascript" src="plugins/bootstrap-add-clear/bootstrap-add-clear.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1230
    <!-- DOMPurify -->
1231
    <script type="text/javascript" src="plugins/DOMPurify/purify.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1232
1233
    <?php
1234
    $get['page'] = $request->query->filter('page', null, FILTER_SANITIZE_SPECIAL_CHARS);
1235
    if ($menuAdmin === true) {
1236
        ?>
1237
        <link rel="stylesheet" href="./plugins/toggles/css/toggles.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
1238
        <link rel="stylesheet" href="./plugins/toggles/css/toggles-modern.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
1239
        <script src="./plugins/toggles/toggles.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/javascript"></script>
1240
        <!-- InputMask -->
1241
        <script src="./plugins/inputmask/jquery.inputmask.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1242
        <!-- Sortable -->
1243
        <!--<script src="./plugins/sortable/jquery.sortable.js"></script>-->
1244
        <!-- PLUPLOAD -->
1245
        <script type="text/javascript" src="plugins/plupload/js/plupload.full.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1246
        <!-- DataTables -->
1247
        <link rel="stylesheet" src="./plugins/datatables/css/jquery.dataTables.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1248
        <link rel="stylesheet" src="./plugins/datatables/css/dataTables.bootstrap4.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1249
        <script type="text/javascript" src="./plugins/datatables/js/jquery.dataTables.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1250
        <script type="text/javascript" src="./plugins/datatables/js/dataTables.bootstrap4.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1251
        <link rel="stylesheet" src="./plugins/datatables/extensions/Responsive-2.2.2/css/responsive.bootstrap4.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1252
        <script type="text/javascript" src="./plugins/datatables/extensions/Responsive-2.2.2/js/dataTables.responsive.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1253
        <script type="text/javascript" src="./plugins/datatables/extensions/Responsive-2.2.2/js/responsive.bootstrap4.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1254
        <script type="text/javascript" src="./plugins/datatables/plugins/select.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1255
        <link rel="stylesheet" src="./plugins/datatables/extensions/Scroller-1.5.0/css/scroller.bootstrap4.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1256
        <script type="text/javascript" src="./plugins/datatables/extensions/Scroller-1.5.0/js/dataTables.scroller.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1257
    <?php
1258
    } elseif (isset($get['page']) === true) {
1259
        if (in_array($get['page'], ['items', 'import']) === true) {
1260
            ?>
1261
            <link rel="stylesheet" href="./plugins/jstree/themes/default/style.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
1262
            <link rel="stylesheet" href="./plugins/jstree/themes/default-dark/style.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
1263
            <script src="./plugins/jstree/jstree.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/javascript"></script>
1264
            <!-- countdownTimer -->
1265
            <script src="./plugins/jquery.countdown360/jquery.countdown360.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1266
            <!-- SUMMERNOTE -->
1267
            <link rel="stylesheet" href="./plugins/summernote/summernote-bs4.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1268
            <script src="./plugins/summernote/summernote-bs4.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1269
            <!-- date-picker -->
1270
            <link rel="stylesheet" href="./plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1271
            <script src="./plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1272
            <!-- time-picker -->
1273
            <link rel="stylesheet" href="./plugins/timepicker/bootstrap-timepicker.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1274
            <script src="./plugins/timepicker/bootstrap-timepicker.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1275
            <!-- PLUPLOAD -->
1276
            <script type="text/javascript" src="plugins/plupload/js/plupload.full.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1277
            <!-- VALIDATE -->
1278
            <script type="text/javascript" src="plugins/jquery-validation/jquery.validate.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1279
            <!-- PWSTRENGHT -->
1280
            <script type="text/javascript" src="plugins/zxcvbn/zxcvbn.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1281
            <script type="text/javascript" src="plugins/jquery.pwstrength/pwstrength-bootstrap.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1282
            <!-- TOGGLE -->
1283
            <link rel="stylesheet" href="./plugins/toggles/css/toggles.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
1284
            <link rel="stylesheet" href="./plugins/toggles/css/toggles-modern.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
1285
            <script src="./plugins/toggles/toggles.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/javascript"></script>
1286
        <?php
1287
        } elseif (in_array($get['page'], ['search', 'folders', 'users', 'roles', 'utilities.deletion', 'utilities.logs', 'utilities.database', 'utilities.renewal', 'tasks']) === true) {
1288
            ?>
1289
            <!-- DataTables -->
1290
            <link rel="stylesheet" src="./plugins/datatables/css/jquery.dataTables.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1291
            <link rel="stylesheet" src="./plugins/datatables/css/dataTables.bootstrap4.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1292
            <script type="text/javascript" src="./plugins/datatables/js/jquery.dataTables.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1293
            <script type="text/javascript" src="./plugins/datatables/js/dataTables.bootstrap4.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1294
            <link rel="stylesheet" src="./plugins/datatables/extensions/Responsive-2.2.2/css/responsive.bootstrap4.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1295
            <script type="text/javascript" src="./plugins/datatables/extensions/Responsive-2.2.2/js/dataTables.responsive.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1296
            <script type="text/javascript" src="./plugins/datatables/extensions/Responsive-2.2.2/js/responsive.bootstrap4.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1297
            <script type="text/javascript" src="./plugins/datatables/plugins/select.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1298
            <link rel="stylesheet" src="./plugins/datatables/extensions/Scroller-1.5.0/css/scroller.bootstrap4.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1299
            <script type="text/javascript" src="./plugins/datatables/extensions/Scroller-1.5.0/js/dataTables.scroller.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1300
            <!-- dater picker -->
1301
            <link rel="stylesheet" href="./plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1302
            <script src="./plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1303
            <!-- daterange picker -->
1304
            <link rel="stylesheet" href="./plugins/daterangepicker/daterangepicker.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1305
            <script src="./plugins/moment/moment.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1306
            <script src="./plugins/daterangepicker/daterangepicker.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1307
            <!-- SlimScroll -->
1308
            <script src="./plugins/slimScroll/jquery.slimscroll.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1309
            <!-- FastClick -->
1310
            <script src="./plugins/fastclick/fastclick.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1311
        <?php
1312
        } elseif ($get['page'] === 'profile') {
1313
            ?>
1314
            <!-- FILESAVER -->
1315
            <script type="text/javascript" src="plugins/downloadjs/download.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1316
            <!-- PLUPLOAD -->
1317
            <script type="text/javascript" src="plugins/plupload/js/plupload.full.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1318
        <?php
1319
        } elseif ($get['page'] === 'export') {
1320
            ?>
1321
            <!-- FILESAVER -->
1322
            <script type="text/javascript" src="plugins/downloadjs/download.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1323
            <!-- PWSTRENGHT -->
1324
            <script type="text/javascript" src="plugins/zxcvbn/zxcvbn.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1325
            <script type="text/javascript" src="plugins/jquery.pwstrength/pwstrength-bootstrap.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1326
        <?php
1327
        }
1328
    }
1329
    ?>
1330
    <!-- functions -->
1331
    <script type="text/javascript" src="includes/js/functions.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1332
    <script type="text/javascript" src="includes/js/CreateRandomString.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1333
    <input type="hidden" id="encryptClientServerStatus" value="<?php echo $SETTINGS['encryptClientServer'] ?? 1; ?>" />
1334
1335
    </body>
1336
1337
</html>
1338
1339
<script type="text/javascript">
1340
    //override defaults
1341
    /*alertify.defaults.transition = "slide";
1342
    alertify.defaults.theme.ok = "btn btn-primary";
1343
    alertify.defaults.theme.cancel = "btn btn-danger";
1344
    alertify.defaults.theme.input = "form-control";*/
1345
1346
    toastr.options = {
1347
        "closeButton": false,
1348
        "debug": false,
1349
        "newestOnTop": false,
1350
        "progressBar": false,
1351
        "positionClass": "toast-bottom-right",
1352
        "preventDuplicates": true,
1353
        "onClick": "close",
1354
        "showDuration": "300",
1355
        "hideDuration": "1000",
1356
        "timeOut": "0",
1357
        "extendedTimeOut": "0",
1358
        "showEasing": "swing",
1359
        "hideEasing": "linear",
1360
        "showMethod": "fadeIn",
1361
        "hideMethod": "fadeOut"
1362
    }
1363
1364
    // Clipboard translations
1365
    const TRANSLATIONS_CLIPBOARD = {
1366
        clipboard_unsafe: "<?php echo $lang->get('clipboard_unsafe'); ?>",
1367
        clipboard_clear_now: "<?php echo $lang->get('clipboard_clear_now'); ?>",
1368
        clipboard_clearing_failed: "<?php echo $lang->get('clipboard_clearing_failed'); ?>",
1369
        clipboard_cleared: "<?php echo $lang->get('clipboard_cleared'); ?>",
1370
        unable_to_clear_clipboard: "<?php echo $lang->get('unable_to_clear_clipboard'); ?>"
1371
    };
1372
</script>
1373
1374
<script type="text/javascript" src="includes/js/secure-clipboard-cleaner.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1375
1376
<script>
1377
    $(document).ready(function() {
1378
        // PWA with windowControlsOverlay
1379
        if ('windowControlsOverlay' in navigator) {
1380
            // Event listener for window-controls-overlay changes
1381
            navigator.windowControlsOverlay.addEventListener('geometrychange', function(event) {
1382
                // Wait few time for resize animations
1383
                $(this).delay(250).queue(function() {
1384
                    // Move header content
1385
                    adjustForWindowControlsOverlay(event.titlebarAreaRect);
1386
                    $(this).dequeue();
1387
                });
1388
            });
1389
1390
            // Move header content
1391
            adjustForWindowControlsOverlay(navigator.windowControlsOverlay.getTitlebarAreaRect());
1392
        }
1393
1394
        function adjustForWindowControlsOverlay(rect) {
1395
            // Display width - available space + 5px margin
1396
            let margin = 5;
1397
            let width = document.documentElement.clientWidth - rect.width + margin;
1398
1399
            if (width - margin !== document.documentElement.clientWidth) {
1400
                // Add right padding to main-header
1401
                $('.main-header').css('padding-right', width + 'px');
1402
1403
                // Window drag area
1404
                $('.main-header').css('-webkit-app-region', 'drag');
1405
                $('.main-header *').css('-webkit-app-region', 'no-drag');
1406
            } else {
1407
                // Remove right padding to main-header
1408
                $('.main-header').css('padding-right', '0px');
1409
1410
                // No window drag area when titlebar is present
1411
                $('.main-header').css('-webkit-app-region', 'no-drag');
1412
            }
1413
        }
1414
    });
1415
1416
    // Handle external link open in current PWA
1417
    if ("launchQueue" in window) {
1418
        window.launchQueue.setConsumer((launchParams) => {
1419
            if (launchParams.targetURL) {
1420
                // Redirect on new URL in focus-existing client mode
1421
                window.location.href = launchParams.targetURL;
1422
            }
1423
        });
1424
    }
1425
</script>
1426
1427
<?php
1428
//$get = [];
1429
//$get['page'] = $request->query->get('page') === null ? '' : $request->query->get('page');
1430
1431
// Load links, css and javascripts
1432
if (isset($SETTINGS['cpassman_dir']) === true) {
1433
    include_once $SETTINGS['cpassman_dir'] . '/includes/core/load.js.php';
1434
    if ($menuAdmin === true) {
1435
        include_once $SETTINGS['cpassman_dir'] . '/pages/admin.js.php';
1436
        if ($get['page'] === '2fa') {
1437
            include_once $SETTINGS['cpassman_dir'] . '/pages/2fa.js.php';
1438
        } elseif ($get['page'] === 'api') {
1439
            include_once $SETTINGS['cpassman_dir'] . '/pages/api.js.php';
1440
        } elseif ($get['page'] === 'backups') {
1441
            include_once $SETTINGS['cpassman_dir'] . '/pages/backups.js.php';
1442
        } elseif ($get['page'] === 'emails') {
1443
            include_once $SETTINGS['cpassman_dir'] . '/pages/emails.js.php';
1444
        } elseif ($get['page'] === 'ldap') {
1445
            include_once $SETTINGS['cpassman_dir'] . '/pages/ldap.js.php';
1446
        } elseif ($get['page'] === 'uploads') {
1447
            include_once $SETTINGS['cpassman_dir'] . '/pages/uploads.js.php';
1448
        } elseif ($get['page'] === 'fields') {
1449
            include_once $SETTINGS['cpassman_dir'] . '/pages/fields.js.php';
1450
        } elseif ($get['page'] === 'options') {
1451
            include_once $SETTINGS['cpassman_dir'] . '/pages/options.js.php';
1452
        } elseif ($get['page'] === 'statistics') {
1453
            include_once $SETTINGS['cpassman_dir'] . '/pages/statistics.js.php';
1454
        } elseif ($get['page'] === 'tasks') {
1455
            include_once $SETTINGS['cpassman_dir'] . '/pages/tasks.js.php';
1456
        } elseif ($get['page'] === 'oauth') {
1457
            include_once $SETTINGS['cpassman_dir'] . '/pages/oauth.js.php';        
1458
        } elseif ($get['page'] === 'tools') {
1459
            include_once $SETTINGS['cpassman_dir'] . '/pages/tools.js.php';
1460
        }
1461
    } elseif (isset($get['page']) === true && $get['page'] !== '') {
1462
        if ($get['page'] === 'items') {
1463
            include_once $SETTINGS['cpassman_dir'] . '/pages/items.js.php';
1464
        } elseif ($get['page'] === 'import') {
1465
            include_once $SETTINGS['cpassman_dir'] . '/pages/import.js.php';
1466
        } elseif ($get['page'] === 'export') {
1467
            include_once $SETTINGS['cpassman_dir'] . '/pages/export.js.php';
1468
        } elseif ($get['page'] === 'offline') {
1469
            include_once $SETTINGS['cpassman_dir'] . '/pages/offline.js.php';
1470
        } elseif ($get['page'] === 'search') {
1471
            include_once $SETTINGS['cpassman_dir'] . '/pages/search.js.php';
1472
        } elseif ($get['page'] === 'profile') {
1473
            include_once $SETTINGS['cpassman_dir'] . '/pages/profile.js.php';
1474
        } elseif ($get['page'] === 'favourites') {
1475
            include_once $SETTINGS['cpassman_dir'] . '/pages/favorites.js.php';
1476
        } elseif ($get['page'] === 'folders') {
1477
            include_once $SETTINGS['cpassman_dir'] . '/pages/folders.js.php';
1478
        } elseif ($get['page'] === 'users') {
1479
            include_once $SETTINGS['cpassman_dir'] . '/pages/users.js.php';
1480
        } elseif ($get['page'] === 'roles') {
1481
            include_once $SETTINGS['cpassman_dir'] . '/pages/roles.js.php';
1482
        } elseif ($get['page'] === 'utilities.deletion') {
1483
            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.deletion.js.php';
1484
        } elseif ($get['page'] === 'utilities.logs') {
1485
            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.logs.js.php';
1486
        } elseif ($get['page'] === 'utilities.database') {
1487
            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.database.js.php';
1488
        } elseif ($get['page'] === 'utilities.renewal') {
1489
            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.renewal.js.php';
1490
        }
1491
    } else {
1492
        include_once $SETTINGS['cpassman_dir'] . '/includes/core/login.js.php';
1493
    }
1494
}
1495