Issues (29)

Security Analysis    no vulnerabilities found

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

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