Passed
Pull Request — master (#4638)
by Nils
05:48
created

index.php (1 issue)

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