Passed
Push — master ( b61ff7...0d33c7 )
by Nils
05:51
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'); ?>"><?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-control mt-3 font-weight-light grey" id="dialog-ldap-user-change-password-progress">
848
                                    <?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
849
                                </div>
850
                            </div>
851
                        </div>
852
                    </div>
853
                    <div class="card-footer">
854
                        <button class="btn btn-primary" id="dialog-ldap-user-change-password-do"><?php echo $lang->get('launch'); ?></button>
855
                        <button class="btn btn-default float-right" id="dialog-ldap-user-change-password-close"><?php echo $lang->get('close'); ?></button>
856
                    </div>
857
                </div>
858
                <!-- /.LDAP USER HAS CHANGED AUTH PASSWORD -->
859
860
861
                <!-- ADMIN ASKS FOR USER PASSWORD CHANGE -->
862
                <div class="card card-warning m-3 hidden" id="dialog-admin-change-user-password">
863
                    <div class="card-header">
864
                        <h3 class="card-title">
865
                            <i class="fa-solid fa-bullhorn mr-2"></i>
866
                            <?php echo $lang->get('your_attention_is_required'); ?>
867
                        </h3>
868
                    </div>
869
                    <div class="card-body">
870
                        <div class="row">
871
                            <div class="col-sm-12 col-md-12">
872
                                <div class="mb-2 alert alert-info" id="dialog-admin-change-user-password-info">
873
                                </div>
874
                                <div class="form-control mt-3 font-weight-light grey" id="dialog-admin-change-user-password-progress">
875
                                    <?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
876
                                </div>
877
                                <div class="mt-3">                                    
878
                                    <label>
879
                                        <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>
880
                                        <input type="checkbox" id="dialog-admin-change-user-password-do-show-password" class="pointer">
881
                                    </label>
882
                                </div>
883
                            </div>
884
                        </div>
885
                        <input type="hidden" id="admin_change_user_password_target_user" value="">
886
                        <input type="hidden" id="admin_change_user_encryption_code_target_user" value="">
887
                    </div>
888
                    <div class="card-footer">
889
                        <button class="btn btn-primary mr-3" id="dialog-admin-change-user-password-do"><?php echo $lang->get('launch'); ?></button>
890
                        <button class="btn btn-default float-right" id="dialog-admin-change-user-password-close"><?php echo $lang->get('close'); ?></button>
891
                    </div>
892
                </div>
893
                <!-- /.ADMIN ASKS FOR USER PASSWORD CHANGE -->
894
895
896
                <!-- USER PROVIDES TEMPORARY CODE -->
897
                <div class="card card-warning m-3 hidden" id="dialog-user-temporary-code">
898
                    <div class="card-header">
899
                        <h3 class="card-title">
900
                            <i class="fa-solid fa-bullhorn mr-2"></i>
901
                            <?php echo $lang->get('your_attention_is_required'); ?>
902
                        </h3>
903
                    </div>
904
                    <div class="card-body">
905
                        <div class="row">
906
                            <div class="col-sm-12 col-md-12">
907
                                <div class="mb-5 alert alert-info" id="dialog-user-temporary-code-info">
908
                                </div>
909
                                <div class="input-group mb-3">
910
                                    <div class="input-group-prepend">
911
                                        <span class="input-group-text"><?php echo $lang->get('provide_your_current_password'); ?></span>
912
                                    </div>
913
                                    <input type="password" class="form-control" id="dialog-user-temporary-code-current-password">
914
                                </div>
915
                                <div class="input-group mb-3">
916
                                    <div class="input-group-prepend">
917
                                        <span class="input-group-text"><?php echo $lang->get('temporary_encryption_code'); ?></span>
918
                                    </div>
919
                                    <input type="password" class="form-control" id="dialog-user-temporary-code-value">
920
                                </div>
921
                                <div class="form-control mt-3 font-weight-light grey" id="dialog-user-temporary-code-progress">
922
                                    <?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
923
                                </div>
924
                            </div>
925
                        </div>
926
                    </div>
927
                    <div class="card-footer">
928
                        <button class="btn btn-primary" id="dialog-user-temporary-code-do"><?php echo $lang->get('launch'); ?></button>
929
                        <button class="btn btn-default float-right" id="dialog-user-temporary-code-close"><?php echo $lang->get('close'); ?></button>
930
                    </div>
931
                </div>
932
                <!-- /.USER PROVIDES TEMPORARY CODE -->
933
934
935
                <!-- ENCRYPTION KEYS GENERATION -->
936
                <div class="card card-warning m-3 mt-3 hidden" id="dialog-encryption-keys">
937
                    <div class="card-header">
938
                        <h3 class="card-title">
939
                            <i class="fa-solid fa-bullhorn mr-2"></i>
940
                            <?php echo $lang->get('your_attention_is_required'); ?>
941
                        </h3>
942
                    </div>
943
                    <div class="card-body">
944
                        <div class="row">
945
                            <div class="col-sm-12 col-md-12">
946
                                <div class="mb-2 alert alert-info" id="warning-text-reencryption">
947
                                    <i class="icon fa-solid fa-info mr-2"></i>
948
                                    <?php echo $lang->get('objects_encryption_explanation'); ?>
949
                                </div>
950
                            </div>
951
                        </div>
952
                        <input type="hidden" id="sharekeys_reencryption_target_user" value="">
953
                    </div>
954
                    <div class="card-footer">
955
                        <button class="btn btn-primary" id="button_do_sharekeys_reencryption"><?php echo $lang->get('launch'); ?></button>
956
                        <button class="btn btn-default float-right" id="button_close_sharekeys_reencryption"><?php echo $lang->get('close'); ?></button>
957
                    </div>
958
                </div>
959
                <!-- /.ENCRYPTION KEYS GENERATION -->
960
961
962
                <!-- ENCRYPTION KEYS GENERATION FOR LDAP NEW USER -->
963
                <div class="card card-warning m-3 mt-3 hidden" id="dialog-ldap-user-build-keys-database">
964
                    <div class="card-header">
965
                        <h3 class="card-title">
966
                            <i class="fa-solid fa-bullhorn mr-2"></i>
967
                            <?php echo $lang->get('your_attention_is_required'); ?>
968
                        </h3>
969
                    </div>
970
                    <div class="card-body">
971
                        <div class="row">
972
                            <div class="col-sm-12 col-md-12">
973
                                <div class="mb-2 alert alert-info" id="warning-text-reencryption">
974
                                    <i class="icon fa-solid fa-info mr-2"></i>
975
                                    <?php echo $lang->get('help_for_launching_items_encryption'); ?>
976
                                </div>
977
978
                                <div class="input-group mb-3">
979
                                    <div class="input-group-prepend">
980
                                        <span class="input-group-text"><?php echo $lang->get('temporary_encryption_code'); ?></span>
981
                                    </div>
982
                                    <input type="password" class="form-control" id="dialog-ldap-user-build-keys-database-code">
983
                                    <br/>
984
                                </div>
985
                                <div class="input-group mb-3<?php if ($session_auth_type === 'oauth2') echo ' hidden'; ?>">
986
                                    <div class="input-group-prepend">
987
                                        <span class="input-group-text"><?php echo $lang->get('provide_your_current_password'); ?></span>
988
                                    </div>
989
                                    <input type="password" class="form-control" id="dialog-ldap-user-build-keys-database-userpassword">
990
                                </div>
991
                                
992
                                <div class="form-control mt-3 font-weight-light grey" id="dialog-ldap-user-build-keys-database-progress">
993
                                    <?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
994
                                </div>
995
                            </div>
996
                        </div>
997
                        <input type="hidden" id="sharekeys_reencryption_target_user" value="">
998
                    </div>
999
                    <div class="card-footer">
1000
                        <button class="btn btn-primary" id="dialog-ldap-user-build-keys-database-do"><?php echo $lang->get('launch'); ?></button>
1001
                        <button class="btn btn-default float-right" id="dialog-ldap-user-build-keys-database-close"><?php echo $lang->get('close'); ?></button>
1002
                    </div>
1003
                </div>
1004
                <!-- /.ENCRYPTION KEYS GENERATION -->
1005
1006
                <!-- ENCRYPTION PERSONAL ITEMS GENERATION -->
1007
                <div class="card card-warning m-3 hidden" id="dialog-encryption-personal-items-after-upgrade">
1008
                    <div class="card-header">
1009
                        <h3 class="card-title">
1010
                            <i class="fa-solid fa-bullhorn mr-2"></i>
1011
                            <?php echo $lang->get('your_attention_is_required'); ?>
1012
                        </h3>
1013
                    </div>
1014
                    <div class="card-body">
1015
                        <div class="row">
1016
                            <div class="col-sm-12 col-md-12">
1017
                                <div class="mb-2 alert alert-info" id="warning-text-changing-password">
1018
                                    <i class="icon fa-solid fa-info mr-2"></i>
1019
                                    <?php echo $lang->get('objects_encryption_explanation'); ?>
1020
                                </div>
1021
                                <div class="input-group mb-3">
1022
                                    <div class="input-group-prepend">
1023
                                        <span class="input-group-text"><?php echo $lang->get('personal_salt_key'); ?></span>
1024
                                    </div>
1025
                                    <input type="password" class="form-control" id="user-current-defuse-psk">
1026
                                </div>
1027
                                <div class="form-control mt-3 font-weight-light grey" id="user-current-defuse-psk-progress">
1028
                                    <?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
1029
                                </div>
1030
                            </div>
1031
                        </div>
1032
                    </div>
1033
                    <div class="card-footer">
1034
                        <button class="btn btn-primary" id="button_do_personal_items_reencryption"><?php echo $lang->get('launch'); ?></button>
1035
                        <button class="btn btn-default float-right" id="button_close_personal_items_reencryption"><?php echo $lang->get('close'); ?></button>
1036
                    </div>
1037
                </div>
1038
                <!-- /.ENCRYPTION PERSONAL ITEMS GENERATION -->
1039
1040
                <!-- ENCRYPTION PERSONAL ITEMS GENERATION WITH NEW PASSWORD -->
1041
                <div class="card card-warning m-3 hidden" id="dialog-encryption-personal-items-after-upgrade">
1042
                    <div class="card-header">
1043
                        <h3 class="card-title">
1044
                            <i class="fa-solid fa-bullhorn mr-2"></i>
1045
                            <?php echo $lang->get('your_attention_is_required'); ?>
1046
                        </h3>
1047
                    </div>
1048
                    <div class="card-body">
1049
                        <div class="row">
1050
                            <div class="col-sm-12 col-md-12">
1051
                                <div class="mb-2 alert alert-info" id="warning-text-changing-password">
1052
                                    <i class="icon fa-solid fa-info mr-2"></i>
1053
                                    <?php echo $lang->get('objects_encryption_explanation'); ?>
1054
                                </div>
1055
                                <div class="input-group mb-3">
1056
                                    <div class="input-group-prepend">
1057
                                        <span class="input-group-text"><?php echo $lang->get('provide_your_previous_password'); ?></span>
1058
                                    </div>
1059
                                    <input type="password" class="form-control" id="user-current-defuse-psk">
1060
                                </div>
1061
                                <div class="form-control mt-3 font-weight-light grey" id="user-current-defuse-psk-progress">
1062
                                    <?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
1063
                                </div>
1064
                            </div>
1065
                        </div>
1066
                    </div>
1067
                    <div class="card-footer">
1068
                        <button class="btn btn-primary" id="button_do_personal_items_reencryption"><?php echo $lang->get('launch'); ?></button>
1069
                        <button class="btn btn-default float-right" id="button_close_personal_items_reencryption"><?php echo $lang->get('close'); ?></button>
1070
                    </div>
1071
                </div>
1072
                <!-- /.ENCRYPTION PERSONAL ITEMS GENERATION WITH NEW PASSWORD -->
1073
                
1074
1075
                <?php
1076
                    // Case where user is allowed to see the page
1077
                    if ($get['page'] === 'items') {
1078
                        // SHow page with Items
1079
                        if ((int) $session_user_admin !== 1) {
1080
                            include $SETTINGS['cpassman_dir'] . '/pages/items.php';
1081
                        } elseif ((int) $session_user_admin === 1) {
1082
                            include $SETTINGS['cpassman_dir'] . '/pages/admin.php';
1083
                        } else {
1084
                            $session->set('system-error_code', ERR_NOT_ALLOWED);
1085
                            //not allowed page
1086
                            include $SETTINGS['cpassman_dir'] . '/error.php';
1087
                        }
1088
                    } elseif (in_array($get['page'], array_keys($mngPages)) === true) {
1089
                        // Define if user is allowed to see management pages
1090
                        if ($session_user_admin === 1) {
1091
                            // deepcode ignore FileInclusion: $get['page'] is secured through usage of array_keys test bellow
1092
                            include $SETTINGS['cpassman_dir'] . '/pages/' . basename($mngPages[$get['page']]);
1093
                        } elseif ($session_user_manager === 1 || $session_user_human_resources === 1) {
1094
                            if ($get['page'] === 'manage_main' || $get['page'] === 'manage_settings'
1095
                            ) {
1096
                                $session->set('system-error_code', ERR_NOT_ALLOWED);
1097
                                //not allowed page
1098
                                include $SETTINGS['cpassman_dir'] . '/error.php';
1099
                            }
1100
                        } else {
1101
                            $session->set('system-error_code', ERR_NOT_ALLOWED);
1102
                            //not allowed page
1103
                            include $SETTINGS['cpassman_dir'] . '/error.php';
1104
                        }
1105
                    } elseif (empty($get['page']) === false && file_exists($SETTINGS['cpassman_dir'] . '/pages/' . $get['page'] . '.php') === true) {
1106
                        // deepcode ignore FileInclusion: $get['page'] is tested against file_exists just below
1107
                        include $SETTINGS['cpassman_dir'] . '/pages/' . basename($get['page'] . '.php');
1108
                    } else {
1109
                        $session->set('system-array_roles', ERR_NOT_EXIST);
1110
                        //page doesn't exist
1111
                        include $SETTINGS['cpassman_dir'].'/error.php';
1112
                    }
1113
1114
?>
1115
1116
            </div>
1117
            <!-- /.content-wrapper -->
1118
1119
            <!-- Control Sidebar -->
1120
            <aside class="control-sidebar control-sidebar-dark">
1121
                <!-- Control sidebar content goes here -->
1122
                <div class="p-3">
1123
                    <h5><?php echo $lang->get('last_items_title'); ?></h5>
1124
                    <div>
1125
                        <ul class="list-unstyled" id="index-last-pwds">
1126
                        </ul>
1127
                    </div>
1128
                </div>
1129
            </aside>
1130
            <!-- /.control-sidebar -->
1131
1132
            <!-- Main Footer -->
1133
            <footer class="main-footer">
1134
                <!-- To the right -->
1135
                <div class="float-right d-none d-sm-inline">
1136
                    <?php echo $lang->get('version_alone'); ?>&nbsp;<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>
1137
                </div>
1138
                <!-- Default to the left -->
1139
                <strong>Copyright &copy; <?php echo TP_COPYRIGHT; ?> <a href="<?php echo TEAMPASS_URL; ?>"><?php echo TP_TOOL_NAME; ?></a>.</strong> All rights reserved.
1140
            </footer>
1141
        </div>
1142
        <!-- ./wrapper -->
1143
1144
    <?php
1145
        /* MAIN PAGE */
1146
1147
        echo '
1148
<input type="hidden" id="temps_restant" value="', $session->get('user-session_duration') ?? '', '" />';
1149
// display an item in the context of OTV link
1150
} elseif ((null === $session->get('user-validite_pw')|| empty($session->get('user-validite_pw')) === true || empty($session->get('user-id')) === true)
1151
    && empty($get['otv']) === false
1152
) {
1153
    // case where one-shot viewer
1154
    if (empty($request->query->get('code')) === false && empty($request->query->get('stamp')) === false
1155
    ) {
1156
        include './includes/core/otv.php';
1157
    } else {
1158
        $session->set('system-error_code', ERR_VALID_SESSION);
1159
        $session->set(
1160
            'user-initial_url',
1161
            filter_var(
1162
                substr(
1163
                    $server['request_uri'],
1164
                    strpos($server['request_uri'], 'index.php?')
1165
                ),
1166
                FILTER_SANITIZE_URL
1167
            )
1168
        );
1169
        include $SETTINGS['cpassman_dir'] . '/error.php';
1170
    }
1171
} elseif (//(empty($session->get('user-id')) === false && $session->get('user-id') !== null) ||
1172
        empty($session->get('user-id')) === true
1173
        || null === $session->get('user-validite_pw')
1174
        || $session->get('user-validite_pw') === 0
1175
    ) {
1176
    // case where user not logged and can't access a direct link
1177
    if (empty($get['page']) === false) {
1178
        $session->set(
1179
            'user-initial_url',
1180
            filter_var(
1181
                substr($server['request_uri'], strpos($server['request_uri'], 'index.php?')),
1182
                FILTER_SANITIZE_URL
1183
            )
1184
        );
1185
        // REDIRECTION PAGE ERREUR
1186
        echo '
1187
            <script language="javascript" type="text/javascript">
1188
                window.location.href = "./index.php";
1189
            </script>';
1190
        exit;
1191
    }
1192
    
1193
    // LOGIN form  
1194
    include $SETTINGS['cpassman_dir'] . '/includes/core/login.php';
1195
    
1196
} else {
1197
    // Clear session
1198
    $session->invalidate();
1199
}
1200
    ?>
1201
1202
    <!-- Modal -->
1203
    <div class="modal fade" id="warningModal" tabindex="-1" role="dialog" aria-labelledby="Caution" aria-hidden="true">
1204
        <div class="modal-dialog modal-dialog-centered modal-lg" role="document">
1205
            <div class="modal-content">
1206
                <div class="modal-header">
1207
                    <h5 class="modal-title" id="warningModalTitle"></h5>
1208
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close" id="warningModalCrossClose">
1209
                        <span aria-hidden="true">&times;</span>
1210
                    </button>
1211
                </div>
1212
                <div class="modal-body" id="warningModalBody">
1213
                </div>
1214
                <div class="modal-footer">
1215
                    <button type="button" class="btn btn-secondary" data-dismiss="modal" id="warningModalButtonClose"></button>
1216
                    <button type="button" class="btn btn-primary" id="warningModalButtonAction"></button>
1217
                </div>
1218
            </div>
1219
        </div>
1220
    </div>
1221
1222
1223
1224
    <!-- REQUIRED SCRIPTS -->
1225
1226
    <!-- Font Awesome Icons -->
1227
    <link href="plugins/fontawesome-free-6/css/fontawesome.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" rel="stylesheet">
1228
    <link href="plugins/fontawesome-free-6/css/solid.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" rel="stylesheet">
1229
    <link href="plugins/fontawesome-free-6/css/regular.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" rel="stylesheet">
1230
    <link href="plugins/fontawesome-free-6/css/brands.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" rel="stylesheet">
1231
    <link href="plugins/fontawesome-free-6/css/v5-font-face.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" rel="stylesheet" /> 
1232
    <!-- jQuery -->
1233
    <script src="plugins/jquery/jquery.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1234
    <script src="plugins/jquery/jquery.cookie.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/javascript"></script>
1235
    <!-- jQuery UI -->
1236
    <script src="plugins/jqueryUI/jquery-ui.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1237
    <link rel="stylesheet" href="plugins/jqueryUI/jquery-ui.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1238
    <!-- Popper -->
1239
    <script src="plugins/popper/umd/popper.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1240
    <!-- Bootstrap -->
1241
    <script src="plugins/bootstrap/js/bootstrap.bundle.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1242
    <!-- AdminLTE -->
1243
    <script src="plugins/adminlte/js/adminlte.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1244
    <!-- Altertify -->
1245
    <!--<script type="text/javascript" src="plugins/alertifyjs/alertify.min.js"></script>-->
1246
    <!-- Toastr -->
1247
    <script type="text/javascript" src="plugins/toastr/toastr.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1248
    <!-- STORE.JS -->
1249
    <script type="text/javascript" src="plugins/store.js/dist/store.everything.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1250
    <!-- cryptojs-aesphp -->
1251
    <script type="text/javascript" src="includes/libraries/cryptojs/crypto-js.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1252
    <script type="text/javascript" src="includes/libraries/cryptojs/encryption.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1253
    <!-- pace -->
1254
    <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>
1255
    <!-- select2 -->
1256
    <script type="text/javascript" src="plugins/select2/js/select2.full.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1257
    <!-- simplePassMeter -->
1258
    <link rel="stylesheet" href="plugins/simplePassMeter/simplePassMeter.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/css" />
1259
    <script type="text/javascript" src="plugins/simplePassMeter/simplePassMeter.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1260
    <!-- platform -->
1261
    <script type="text/javascript" src="plugins/platform/platform.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1262
    <!-- radiobuttons -->
1263
    <link rel="stylesheet" href="plugins/radioforbuttons/bootstrap-buttons.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/css" />
1264
    <script type="text/javascript" src="plugins/radioforbuttons/jquery.radiosforbuttons.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1265
    <!-- ICHECK -->
1266
    <!--<link rel="stylesheet" href="./plugins/icheck-material/icheck-material.min.css">-->
1267
    <link rel="stylesheet" href="./plugins/icheck/skins/all.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1268
    <script type="text/javascript" src="./plugins/icheck/icheck.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1269
    <!-- bootstrap-add-clear -->
1270
    <script type="text/javascript" src="plugins/bootstrap-add-clear/bootstrap-add-clear.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1271
    <!-- DOMPurify -->
1272
    <script type="text/javascript" src="plugins/DOMPurify/purify.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1273
1274
    <?php
1275
    $get['page'] = $request->query->filter('page', null, FILTER_SANITIZE_SPECIAL_CHARS);
1276
    if ($menuAdmin === true) {
1277
        ?>
1278
        <link rel="stylesheet" href="./plugins/toggles/css/toggles.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
1279
        <link rel="stylesheet" href="./plugins/toggles/css/toggles-modern.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
1280
        <script src="./plugins/toggles/toggles.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/javascript"></script>
1281
        <!-- InputMask -->
1282
        <script src="./plugins/inputmask/jquery.inputmask.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1283
        <!-- Sortable -->
1284
        <!--<script src="./plugins/sortable/jquery.sortable.js"></script>-->
1285
        <!-- PLUPLOAD -->
1286
        <script type="text/javascript" src="plugins/plupload/js/plupload.full.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1287
        <!-- DataTables -->
1288
        <link rel="stylesheet" src="./plugins/datatables/css/jquery.dataTables.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1289
        <link rel="stylesheet" src="./plugins/datatables/css/dataTables.bootstrap4.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1290
        <script type="text/javascript" src="./plugins/datatables/js/jquery.dataTables.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1291
        <script type="text/javascript" src="./plugins/datatables/js/dataTables.bootstrap4.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1292
        <link rel="stylesheet" src="./plugins/datatables/extensions/Responsive-2.2.2/css/responsive.bootstrap4.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1293
        <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>
1294
        <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>
1295
        <script type="text/javascript" src="./plugins/datatables/plugins/select.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1296
        <link rel="stylesheet" src="./plugins/datatables/extensions/Scroller-1.5.0/css/scroller.bootstrap4.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1297
        <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>
1298
    <?php
1299
    } elseif (isset($get['page']) === true) {
1300
        if (in_array($get['page'], ['items', 'import']) === true) {
1301
            ?>
1302
            <link rel="stylesheet" href="./plugins/jstree/themes/default/style.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
1303
            <link rel="stylesheet" href="./plugins/jstree/themes/default-dark/style.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
1304
            <script src="./plugins/jstree/jstree.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/javascript"></script>
1305
            <!-- countdownTimer -->
1306
            <script src="./plugins/jquery.countdown360/jquery.countdown360.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1307
            <!-- SUMMERNOTE -->
1308
            <link rel="stylesheet" href="./plugins/summernote/summernote-bs4.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1309
            <script src="./plugins/summernote/summernote-bs4.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1310
            <!-- date-picker -->
1311
            <link rel="stylesheet" href="./plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1312
            <script src="./plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1313
            <!-- time-picker -->
1314
            <link rel="stylesheet" href="./plugins/timepicker/bootstrap-timepicker.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1315
            <script src="./plugins/timepicker/bootstrap-timepicker.min.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
            <!-- VALIDATE -->
1319
            <script type="text/javascript" src="plugins/jquery-validation/jquery.validate.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1320
            <!-- PWSTRENGHT -->
1321
            <script type="text/javascript" src="plugins/zxcvbn/zxcvbn.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1322
            <script type="text/javascript" src="plugins/jquery.pwstrength/pwstrength-bootstrap.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1323
            <!-- TOGGLE -->
1324
            <link rel="stylesheet" href="./plugins/toggles/css/toggles.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
1325
            <link rel="stylesheet" href="./plugins/toggles/css/toggles-modern.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" />
1326
            <script src="./plugins/toggles/toggles.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>" type="text/javascript"></script>
1327
        <?php
1328
        } elseif (in_array($get['page'], ['search', 'folders', 'users', 'roles', 'utilities.deletion', 'utilities.logs', 'utilities.database', 'utilities.renewal', 'tasks']) === true) {
1329
            ?>
1330
            <!-- DataTables -->
1331
            <link rel="stylesheet" src="./plugins/datatables/css/jquery.dataTables.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1332
            <link rel="stylesheet" src="./plugins/datatables/css/dataTables.bootstrap4.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1333
            <script type="text/javascript" src="./plugins/datatables/js/jquery.dataTables.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1334
            <script type="text/javascript" src="./plugins/datatables/js/dataTables.bootstrap4.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1335
            <link rel="stylesheet" src="./plugins/datatables/extensions/Responsive-2.2.2/css/responsive.bootstrap4.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1336
            <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>
1337
            <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>
1338
            <script type="text/javascript" src="./plugins/datatables/plugins/select.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1339
            <link rel="stylesheet" src="./plugins/datatables/extensions/Scroller-1.5.0/css/scroller.bootstrap4.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1340
            <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>
1341
            <!-- dater picker -->
1342
            <link rel="stylesheet" href="./plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1343
            <script src="./plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1344
            <!-- daterange picker -->
1345
            <link rel="stylesheet" href="./plugins/daterangepicker/daterangepicker.css?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>">
1346
            <script src="./plugins/moment/moment.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1347
            <script src="./plugins/daterangepicker/daterangepicker.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1348
            <!-- SlimScroll -->
1349
            <script src="./plugins/slimScroll/jquery.slimscroll.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1350
            <!-- FastClick -->
1351
            <script src="./plugins/fastclick/fastclick.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1352
        <?php
1353
        } elseif ($get['page'] === 'profile') {
1354
            ?>
1355
            <!-- FILESAVER -->
1356
            <script type="text/javascript" src="plugins/downloadjs/download.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1357
            <!-- PLUPLOAD -->
1358
            <script type="text/javascript" src="plugins/plupload/js/plupload.full.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1359
        <?php
1360
        } elseif ($get['page'] === 'export') {
1361
            ?>
1362
            <!-- FILESAVER -->
1363
            <script type="text/javascript" src="plugins/downloadjs/download.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1364
            <!-- PWSTRENGHT -->
1365
            <script type="text/javascript" src="plugins/zxcvbn/zxcvbn.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1366
            <script type="text/javascript" src="plugins/jquery.pwstrength/pwstrength-bootstrap.min.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1367
        <?php
1368
        }
1369
    }
1370
    ?>
1371
    <!-- functions -->
1372
    <script type="text/javascript" src="includes/js/functions.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1373
    <script type="text/javascript" src="includes/js/CreateRandomString.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1374
    <input type="hidden" id="encryptClientServerStatus" value="<?php echo $SETTINGS['encryptClientServer'] ?? 1; ?>" />
1375
1376
    </body>
1377
1378
</html>
1379
1380
<script type="text/javascript">
1381
    //override defaults
1382
    /*alertify.defaults.transition = "slide";
1383
    alertify.defaults.theme.ok = "btn btn-primary";
1384
    alertify.defaults.theme.cancel = "btn btn-danger";
1385
    alertify.defaults.theme.input = "form-control";*/
1386
1387
    toastr.options = {
1388
        "closeButton": false,
1389
        "debug": false,
1390
        "newestOnTop": false,
1391
        "progressBar": false,
1392
        "positionClass": "toast-bottom-right",
1393
        "preventDuplicates": true,
1394
        "onClick": "close",
1395
        "showDuration": "300",
1396
        "hideDuration": "1000",
1397
        "timeOut": "0",
1398
        "extendedTimeOut": "0",
1399
        "showEasing": "swing",
1400
        "hideEasing": "linear",
1401
        "showMethod": "fadeIn",
1402
        "hideMethod": "fadeOut"
1403
    }
1404
1405
    // Clipboard translations
1406
    const TRANSLATIONS_CLIPBOARD = {
1407
        clipboard_unsafe: "<?php echo $lang->get('clipboard_unsafe'); ?>",
1408
        clipboard_clear_now: "<?php echo $lang->get('clipboard_clear_now'); ?>",
1409
        clipboard_clearing_failed: "<?php echo $lang->get('clipboard_clearing_failed'); ?>",
1410
        clipboard_cleared: "<?php echo $lang->get('clipboard_cleared'); ?>",
1411
        unable_to_clear_clipboard: "<?php echo $lang->get('unable_to_clear_clipboard'); ?>"
1412
    };
1413
</script>
1414
1415
<script type="text/javascript" src="includes/js/secure-clipboard-cleaner.js?v=<?php echo TP_VERSION . '.' . TP_VERSION_MINOR; ?>"></script>
1416
1417
<script>
1418
    $(document).ready(function() {
1419
        // PWA with windowControlsOverlay
1420
        if ('windowControlsOverlay' in navigator) {
1421
            // Event listener for window-controls-overlay changes
1422
            navigator.windowControlsOverlay.addEventListener('geometrychange', function(event) {
1423
                // Wait few time for resize animations
1424
                $(this).delay(250).queue(function() {
1425
                    // Move header content
1426
                    adjustForWindowControlsOverlay(event.titlebarAreaRect);
1427
                    $(this).dequeue();
1428
                });
1429
            });
1430
1431
            // Move header content
1432
            adjustForWindowControlsOverlay(navigator.windowControlsOverlay.getTitlebarAreaRect());
1433
        }
1434
1435
        function adjustForWindowControlsOverlay(rect) {
1436
            // Display width - available space + 5px margin
1437
            let margin = 5;
1438
            let width = document.documentElement.clientWidth - rect.width + margin;
1439
1440
            if (width - margin !== document.documentElement.clientWidth) {
1441
                // Add right padding to main-header
1442
                $('.main-header').css('padding-right', width + 'px');
1443
1444
                // Window drag area
1445
                $('.main-header').css('-webkit-app-region', 'drag');
1446
                $('.main-header *').css('-webkit-app-region', 'no-drag');
1447
            } else {
1448
                // Remove right padding to main-header
1449
                $('.main-header').css('padding-right', '0px');
1450
1451
                // No window drag area when titlebar is present
1452
                $('.main-header').css('-webkit-app-region', 'no-drag');
1453
            }
1454
        }
1455
    });
1456
1457
    // Handle external link open in current PWA
1458
    if ("launchQueue" in window) {
1459
        window.launchQueue.setConsumer((launchParams) => {
1460
            if (launchParams.targetURL) {
1461
                // Redirect on new URL in focus-existing client mode
1462
                window.location.href = launchParams.targetURL;
1463
            }
1464
        });
1465
    }
1466
</script>
1467
1468
<?php
1469
//$get = [];
1470
//$get['page'] = $request->query->get('page') === null ? '' : $request->query->get('page');
1471
1472
// Load links, css and javascripts
1473
if (isset($SETTINGS['cpassman_dir']) === true) {
1474
    include_once $SETTINGS['cpassman_dir'] . '/includes/core/load.js.php';
1475
    if ($menuAdmin === true) {
1476
        include_once $SETTINGS['cpassman_dir'] . '/pages/admin.js.php';
1477
        if ($get['page'] === '2fa') {
1478
            include_once $SETTINGS['cpassman_dir'] . '/pages/2fa.js.php';
1479
        } elseif ($get['page'] === 'api') {
1480
            include_once $SETTINGS['cpassman_dir'] . '/pages/api.js.php';
1481
        } elseif ($get['page'] === 'backups') {
1482
            include_once $SETTINGS['cpassman_dir'] . '/pages/backups.js.php';
1483
        } elseif ($get['page'] === 'emails') {
1484
            include_once $SETTINGS['cpassman_dir'] . '/pages/emails.js.php';
1485
        } elseif ($get['page'] === 'ldap') {
1486
            include_once $SETTINGS['cpassman_dir'] . '/pages/ldap.js.php';
1487
        } elseif ($get['page'] === 'uploads') {
1488
            include_once $SETTINGS['cpassman_dir'] . '/pages/uploads.js.php';
1489
        } elseif ($get['page'] === 'fields') {
1490
            include_once $SETTINGS['cpassman_dir'] . '/pages/fields.js.php';
1491
        } elseif ($get['page'] === 'options') {
1492
            include_once $SETTINGS['cpassman_dir'] . '/pages/options.js.php';
1493
        } elseif ($get['page'] === 'statistics') {
1494
            include_once $SETTINGS['cpassman_dir'] . '/pages/statistics.js.php';
1495
        } elseif ($get['page'] === 'tasks') {
1496
            include_once $SETTINGS['cpassman_dir'] . '/pages/tasks.js.php';
1497
        } elseif ($get['page'] === 'oauth') {
1498
            include_once $SETTINGS['cpassman_dir'] . '/pages/oauth.js.php';        
1499
        } elseif ($get['page'] === 'tools') {
1500
            include_once $SETTINGS['cpassman_dir'] . '/pages/tools.js.php';
1501
        }
1502
    } elseif (isset($get['page']) === true && $get['page'] !== '') {
1503
        if ($get['page'] === 'items') {
1504
            include_once $SETTINGS['cpassman_dir'] . '/pages/items.js.php';
1505
        } elseif ($get['page'] === 'import') {
1506
            include_once $SETTINGS['cpassman_dir'] . '/pages/import.js.php';
1507
        } elseif ($get['page'] === 'export') {
1508
            include_once $SETTINGS['cpassman_dir'] . '/pages/export.js.php';
1509
        } elseif ($get['page'] === 'offline') {
1510
            include_once $SETTINGS['cpassman_dir'] . '/pages/offline.js.php';
1511
        } elseif ($get['page'] === 'search') {
1512
            include_once $SETTINGS['cpassman_dir'] . '/pages/search.js.php';
1513
        } elseif ($get['page'] === 'profile') {
1514
            include_once $SETTINGS['cpassman_dir'] . '/pages/profile.js.php';
1515
        } elseif ($get['page'] === 'favourites') {
1516
            include_once $SETTINGS['cpassman_dir'] . '/pages/favorites.js.php';
1517
        } elseif ($get['page'] === 'folders') {
1518
            include_once $SETTINGS['cpassman_dir'] . '/pages/folders.js.php';
1519
        } elseif ($get['page'] === 'users') {
1520
            include_once $SETTINGS['cpassman_dir'] . '/pages/users.js.php';
1521
        } elseif ($get['page'] === 'roles') {
1522
            include_once $SETTINGS['cpassman_dir'] . '/pages/roles.js.php';
1523
        } elseif ($get['page'] === 'utilities.deletion') {
1524
            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.deletion.js.php';
1525
        } elseif ($get['page'] === 'utilities.logs') {
1526
            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.logs.js.php';
1527
        } elseif ($get['page'] === 'utilities.database') {
1528
            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.database.js.php';
1529
        } elseif ($get['page'] === 'utilities.renewal') {
1530
            include_once $SETTINGS['cpassman_dir'] . '/pages/utilities.renewal.js.php';
1531
        }
1532
    } else {
1533
        include_once $SETTINGS['cpassman_dir'] . '/includes/core/login.js.php';
1534
    }
1535
}
1536