forked from nilsteampassnet/TeamPass
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.php
executable file
·1373 lines (1292 loc) · 72.3 KB
/
index.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<?php
declare(strict_types=1);
/**
* Teampass - a collaborative passwords manager.
* ---
* This file is part of the TeamPass project.
*
* TeamPass is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by
* the Free Software Foundation, version 3 of the License.
*
* TeamPass is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* Certain components of this file may be under different licenses. For
* details, see the `licenses` directory or individual file headers.
* ---
* @file index.php
* @author Nils Laumaillé ([email protected])
* @copyright 2009-2024 Teampass.net
* @license GPL-3.0
* @see https://www.teampass.net
*/
use voku\helper\AntiXSS;
use TeampassClasses\SessionManager\SessionManager;
use Symfony\Component\HttpFoundation\Request as SymfonyRequest;
use TeampassClasses\Language\Language;
use TeampassClasses\ConfigManager\ConfigManager;
// Security Headers
header('X-XSS-Protection: 1; mode=block');
// deepcode ignore TooPermissiveXFrameOptions: Not the case as sameorigin is used
header('X-Frame-Options: SameOrigin');
// Cache Headers
header("Cache-Control: no-cache, no-store, must-revalidate");
header("Pragma: no-cache");
header("Expires: 0");
// **PREVENTING SESSION HIJACKING**
// Prevents javascript XSS attacks aimed to steal the session ID
//ini_set('session.cookie_httponly', 1);
// **PREVENTING SESSION FIXATION**
// Session ID cannot be passed through URLs
//ini_set('session.use_only_cookies', 1);
// Uses a secure connection (HTTPS) if possible
//ini_set('session.cookie_secure', 0);
//ini_set('session.cookie_samesite', 'Lax');
// Before we start processing, we should abort no install is present
if (file_exists(__DIR__.'/includes/config/settings.php') === false) {
// This should never happen, but in case it does
// this means if headers are sent, redirect will fallback to JS
if (headers_sent()) {
echo '<script language="javascript" type="text/javascript">document.location.replace("install/install.php");</script>';
} else {
header('Location: install/install.php');
}
// Now either way, we should stop processing further
exit;
}
// initialise CSRFGuard library
require_once __DIR__.'/includes/libraries/csrfp/libs/csrf/csrfprotector.php';
csrfProtector::init();
// Load functions
require_once __DIR__. '/includes/config/include.php';
require_once __DIR__.'/sources/main.functions.php';
// init
loadClasses();
$session = SessionManager::getSession();
$session->set('key', SessionManager::getCookieValue('PHPSESSID'));
$request = SymfonyRequest::createFromGlobals();
$configManager = new ConfigManager(__DIR__, $request->getRequestUri());
$SETTINGS = $configManager->getAllSettings();
$antiXss = new AntiXSS();
// Quick major version check -> upgrade needed?
if (isset($SETTINGS['teampass_version']) === true && version_compare(TP_VERSION, $SETTINGS['teampass_version']) > 0) {
// Perform redirection
if (headers_sent()) {
echo '<script language="javascript" type="text/javascript">document.location.replace("install/install.php");</script>';
} else {
header('Location: install/upgrade.php');
}
// No other way, we should stop processing further
exit;
}
$SETTINGS = $antiXss->xss_clean($SETTINGS);
// Load Core library
require_once $SETTINGS['cpassman_dir'] . '/sources/core.php';
// Prepare POST variables
$post_language = filter_input(INPUT_POST, 'language', FILTER_SANITIZE_FULL_SPECIAL_CHARS);
$session_user_language = $session->get('user-language');
$session_user_admin = $session->get('user-admin');
$session_user_human_resources = (int) $session->get('user-can_manage_all_users');
$session_name = $session->get('user-name');
$session_lastname = $session->get('user-lastname');
$session_user_manager = $session->get('user-manager');
$session_initial_url = $session->get('user-initial_url');
$session_nb_users_online = $session->get('system-nb_users_online');
$session_auth_type = $session->get('user-auth_type');
$server = [];
$server['request_uri'] = (string) $request->getRequestUri();
$server['request_time'] = (int) $request->server->get('REQUEST_TIME');
$get = [];
$get['page'] = $request->query->get('page') === null ? '' : $antiXss->xss_clean($request->query->get('page'));
$get['otv'] = $request->query->get('otv') === null ? '' : $antiXss->xss_clean($request->query->get('otv'));
/* DEFINE WHAT LANGUAGE TO USE */
if (null === $session->get('user-validite_pw') && $post_language === null && $session_user_language === null) {
//get default language
$dataLanguage = DB::queryFirstRow(
'SELECT m.valeur AS valeur, l.flag AS flag
FROM ' . prefixTable('misc') . ' AS m
INNER JOIN ' . prefixTable('languages') . ' AS l ON (m.valeur = l.name)
WHERE m.type=%s_type AND m.intitule=%s_intitule',
[
'type' => 'admin',
'intitule' => 'default_language',
]
);
if (empty($dataLanguage['valeur'])) {
$session->set('user-language', 'english');
$session->set('user-language_flag', 'us.png');
$session_user_language = 'english';
} else {
$session->set('user-language', $dataLanguage['valeur']);
$session->set('user-language_flag', $dataLanguage['flag']);
$session_user_language = $dataLanguage['valeur'];
}
} elseif (isset($SETTINGS['default_language']) === true && $session_user_language === null) {
$session->set('user-language', $SETTINGS['default_language']);
$session_user_language = $SETTINGS['default_language'];
} elseif ($post_language !== null) {
$session->set('user-language', $post_language);
$session_user_language = $post_language;
} elseif ($session_user_language === null || empty($session_user_language) === true) {
if ($post_language !== null) {
$session->set('user-language', $post_language);
$session_user_language = $post_language;
} elseif ($session_user_language !== null) {
$session->set('user-language', $SETTINGS['default_language']);
$session_user_language = $SETTINGS['default_language'];
}
}
$lang = new Language($session_user_language, __DIR__. '/includes/language/');
if (isset($SETTINGS['cpassman_dir']) === false || $SETTINGS['cpassman_dir'] === '') {
$SETTINGS['cpassman_dir'] = __DIR__;
$SETTINGS['cpassman_url'] = (string) $server['request_uri'];
}
// Some template adjust
if (array_key_exists($get['page'], $mngPages) === true) {
$menuAdmin = true;
} else {
$menuAdmin = false;
}
// Some template adjust
if (array_key_exists($get['page'], $utilitiesPages) === true) {
$menuUtilities = true;
} else {
$menuUtilities = false;
}
?>
<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>
<head>
<meta http-equiv='Content-Type' content='text/html;charset=utf-8' />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta http-equiv="x-ua-compatible" content="ie=edge" />
<title>Teampass</title>
<script type='text/javascript'>
//<![CDATA[
if (window.location.href.indexOf('page=') === -1 &&
(window.location.href.indexOf('otv=') === -1 &&
window.location.href.indexOf('action=') === -1)
) {
if (window.location.href.indexOf('session_over=true') !== -1) {
location.replace('./includes/core/logout.php');
}
}
//]]>
</script>
<!-- IonIcons -->
<link rel="stylesheet" href="includes/css/ionicons.min.css">
<!-- Theme style -->
<link rel="stylesheet" href="plugins/adminlte/css/adminlte.min.css">
<link rel="stylesheet" href="plugins/pace-progress/themes/corner-indicator.css" type="text/css" />
<link rel="stylesheet" href="plugins/select2/css/select2.min.css" type="text/css" />
<!--<link rel="stylesheet" href="plugins/select2/css/select2-bootstrap.min.css" type="text/css" />-->
<link rel="stylesheet" href="plugins/select2/theme/select2-bootstrap4.min.css" type="text/css" />
<!-- Theme style -->
<link rel="stylesheet" href="includes/css/teampass.css">
<!-- Google Font: Source Sans Pro -->
<link rel="stylesheet" type="text/css" href="includes/fonts/fonts.css">
<!-- Altertify -->
<link rel="stylesheet" href="plugins/alertifyjs/css/alertify.min.css" />
<link rel="stylesheet" href="plugins/alertifyjs/css/themes/bootstrap.min.css" />
<!-- Toastr -->
<link rel="stylesheet" href="plugins/toastr/toastr.min.css" />
<!-- favicon -->
<link rel="shortcut icon" type="image/png" href="<?php echo isset($SETTINGS['favicon']) === true ? $SETTINGS['favicon'] : '';?>"/>
<!-- Custom style -->
<?php
if (file_exists(__DIR__ . '/includes/css/custom.css') === true) {?>
<link rel="stylesheet" href="includes/css/custom.css">
<?php
} ?>
</head>
<?php
//error_log(print_r($session->all(), true));
// display an item in the context of OTV link
if ((null === $session->get('user-validite_pw') || empty($session->get('user-validite_pw')) === true || empty($session->get('user-id')) === true)
&& empty($get['otv']) === false)
{
include './includes/core/otv.php';
exit;
} elseif ($session->has('user-validite_pw') && $session->get('user-validite_pw') && null !== $session->get('user-validite_pw') && $session->get('user-validite_pw') === 1 &&
empty($get['page']) === false && empty($session->get('user-id')) === false
) {
?>
<body class="hold-transition sidebar-mini layout-navbar-fixed layout-fixed">
<div class="wrapper">
<!-- Navbar -->
<nav class="main-header navbar navbar-expand navbar-white navbar-light border-bottom">
<!-- User encryption still ongoing -->
<div id="user_not_ready" class="alert alert-warning hidden pointer p-2 mt-2" style="position:absolute; left:200px;">
<span class="align-middle infotip ml-2" title="<?php echo $lang->get('keys_encryption_not_ready'); ?>"><?php echo $lang->get('account_not_ready'); ?><span id="user_not_ready_progress"></span><i class="fa-solid fa-hourglass-half fa-beat-fade mr-2 ml-2"></i></span>
</div>
<!-- Left navbar links -->
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" data-widget="pushmenu" href="#"><i class="fa-solid fa-bars"></i></a>
</li>
<?php
if ($get['page'] === 'items') {
?>
<li class="nav-item d-none d-sm-inline-block">
<a class="nav-link" href="#">
<i class="far fa-arrow-alt-circle-right columns-position tree-increase infotip" title="<?php echo $lang->get('move_right_columns_separator'); ?>"></i>
</a>
</li>
<li class="nav-item d-none d-sm-inline-block">
<a class="nav-link" href="#">
<i class="far fa-arrow-alt-circle-left columns-position tree-decrease infotip" title="<?php echo $lang->get('move_left_columns_separator'); ?>"></i>
</a>
</li>
<?php
} ?>
</ul>
<!-- Right navbar links -->
<ul class="navbar-nav ml-auto">
<span class="fa-stack infotip pointer hidden mr-2" title="<?php echo $lang->get('get_your_recovery_keys'); ?>" id="open_user_keys_management" style="vertical-align: top;">
<i class="fa-solid fa-circle text-danger fa-stack-2x"></i>
<i class="fa-solid fa-bell fa-shake fa-stack-1x fa-inverse"></i>
</span>
<!-- Messages Dropdown Menu -->
<li class="nav-item dropdown">
<div class="dropdown show">
<a class="btn btn-primary dropdown-toggle" href="#" data-toggle="dropdown">
<?php
echo $session_name . ' ' . $session_lastname; ?>
</a>
<div class="dropdown-menu dropdown-menu-right">
<a class="dropdown-item user-menu" href="#" data-name="increase_session">
<i class="far fa-clock fa-fw mr-2"></i><?php echo $lang->get('index_add_one_hour'); ?></a>
<div class="dropdown-divider"></div>
<a class="dropdown-item user-menu" href="#" data-name="profile">
<i class="fa-solid fa-user-circle fa-fw mr-2"></i><?php echo $lang->get('my_profile'); ?>
</a>
<?php
if (empty($session_auth_type) === false && $session_auth_type !== 'ldap') {
?>
<a class="dropdown-item user-menu" href="#" data-name="password-change">
<i class="fa-solid fa-lock fa-fw mr-2"></i><?php echo $lang->get('index_change_pw'); ?>
</a>
<?php
} elseif ($session_auth_type === 'ldap') {
?>
<a class="dropdown-item user-menu" href="#" data-name="sync-new-ldap-password">
<i class="fa-solid fa-key fa-fw mr-2"></i><?php echo $lang->get('sync_new_ldap_password'); ?>
</a>
<?php
} ?>
<a class="dropdown-item user-menu<?php echo (int) $session_user_admin === 1 ? ' hidden' : '';?>" href="#" data-name="generate-new_keys">
<i class="fa-solid fa-spray-can-sparkles fa-fw mr-2"></i><?php echo $lang->get('generate_new_keys'); ?>
</a>
<!--
<div class="dropdown-divider"></div>
<a class="dropdown-item user-menu" href="#" data-name="generate-an-otp">
<i class="fa-solid fa-qrcode fa-fw mr-2"></i><?php echo $lang->get('generate_an_otp'); ?>
</a>
-->
<div class="dropdown-divider"></div>
<a class="dropdown-item user-menu" href="#" data-name="logout">
<i class="fa-solid fa-sign-out-alt fa-fw mr-2"></i><?php echo $lang->get('disconnect'); ?>
</a>
</div>
</div>
</li>
<li>
<span class="align-middle infotip ml-2 text-info" title="<?php echo $lang->get('index_expiration_in'); ?>" id="countdown"></span>
</li>
<li class="nav-item">
<a class="nav-link" data-widget="control-sidebar" data-slide="true" href="#" id="controlsidebar"><i class="fa-solid fa-th-large"></i></a>
</li>
</ul>
</nav>
<!-- /.navbar -->
<!-- Main Sidebar Container -->
<aside class="main-sidebar sidebar-dark-primary elevation-4">
<!-- Brand Logo -->
<a href="<?php echo $SETTINGS['cpassman_url'] . '/index.php?page=' . ((int) $session_user_admin === 1 ? 'admin' : 'items'); ?>" class="brand-link">
<img src="includes/images/teampass-logo2-home.png" alt="Teampass Logo" class="brand-image">
<span class="brand-text font-weight-light"><?php echo TP_TOOL_NAME; ?></span>
</a>
<!-- Sidebar -->
<div class="sidebar">
<!-- Sidebar Menu -->
<nav class="mt-2" style="margin-bottom:40px;">
<ul class="nav nav-pills nav-sidebar flex-column" data-widget="treeview" role="menu" data-accordion="false">
<?php
if ($session_user_admin === 0) {
// ITEMS & SEARCH
echo '
<li class="nav-item">
<a href="#" data-name="items" class="nav-link', $get['page'] === 'items' ? ' active' : '', '">
<i class="nav-icon fa-solid fa-key"></i>
<p>
' . $lang->get('pw') . '
</p>
</a>
</li>';
}
// IMPORT menu
if (isset($SETTINGS['allow_import']) === true && (int) $SETTINGS['allow_import'] === 1&& $session_user_admin === 0) {
echo '
<li class="nav-item">
<a href="#" data-name="import" class="nav-link', $get['page'] === 'import' ? ' active' : '', '">
<i class="nav-icon fa-solid fa-file-import"></i>
<p>
' . $lang->get('import') . '
</p>
</a>
</li>';
}
// EXPORT menu
if (
isset($SETTINGS['allow_print']) === true && (int) $SETTINGS['allow_print'] === 1
&& isset($SETTINGS['roles_allowed_to_print_select']) === true
&& empty($SETTINGS['roles_allowed_to_print_select']) === false
&& count(array_intersect(
explode(';', $session->get('user-roles')),
explode(',', str_replace(['"', '[', ']'], '', $SETTINGS['roles_allowed_to_print_select']))
)) > 0
&& (int) $session_user_admin === 0
) {
echo '
<li class="nav-item">
<a href="#" data-name="export" class="nav-link', $get['page'] === 'export' ? ' active' : '', '">
<i class="nav-icon fa-solid fa-file-export"></i>
<p>
' . $lang->get('export') . '
</p>
</a>
</li>';
}
/*
// OFFLINE MODE menu
if (isset($SETTINGS['settings_offline_mode']) === true && (int) $SETTINGS['settings_offline_mode'] === 1) {
echo '
<li class="nav-item">
<a href="#" data-name="offline" class="nav-link', $get['page'] === 'offline' ? ' active' : '' ,'">
<i class="nav-icon fa-solid fa-plug"></i>
<p>
'.$lang->get('offline').'
</p>
</a>
</li>';
}
*/
if ($session_user_admin === 0) {
echo '
<li class="nav-item">
<a href="#" data-name="search" class="nav-link', $get['page'] === 'search' ? ' active' : '', '">
<i class="nav-icon fa-solid fa-search"></i>
<p>
' . $lang->get('find') . '
</p>
</a>
</li>';
}
// Favourites menu
if (
isset($SETTINGS['enable_favourites']) === true && (int) $SETTINGS['enable_favourites'] === 1
&& (int) $session_user_admin === 0
) {
echo '
<li class="nav-item">
<a href="#" data-name="favourites" class="nav-link', $get['page'] === 'admin' ? ' favourites' : '', '">
<i class="nav-icon fa-solid fa-star"></i>
<p>
' . $lang->get('favorites') . '
</p>
</a>
</li>';
}
/*
// KB menu
if (isset($SETTINGS['enable_kb']) === true && $SETTINGS['enable_kb'] === '1'
) {
echo '
<li class="nav-item">
<a href="#" data-name="kb" class="nav-link', $get['page'] === 'kb' ? ' active' : '' ,'">
<i class="nav-icon fa-solid fa-map-signs"></i>
<p>
'.$lang->get('kb_menu').'
</p>
</a>
</li>';
}
*/
// SUGGESTION menu
if (
isset($SETTINGS['enable_suggestion']) && (int) $SETTINGS['enable_suggestion'] === 1
&& $session_user_manager === 1
) {
echo '
<li class="nav-item">
<a href="#" data-name="suggestion" class="nav-link', $get['page'] === 'suggestion' ? ' active' : '', '">
<i class="nav-icon fa-solid fa-lightbulb"></i>
<p>
' . $lang->get('suggestion_menu') . '
</p>
</a>
</li>';
}
// Admin menu
if ($session_user_admin === 1) {
echo '
<li class="nav-item">
<a href="#" data-name="admin" class="nav-link', $get['page'] === 'admin' ? ' active' : '', '">
<i class="nav-icon fa-solid fa-info"></i>
<p>
' . $lang->get('admin_main') . '
</p>
</a>
</li>
<li class="nav-item has-treeview', $menuAdmin === true ? ' menu-open' : '', '">
<a href="#" class="nav-link">
<i class="nav-icon fa-solid fa-wrench"></i>
<p>
' . $lang->get('admin_settings') . '
<i class="fa-solid fa-angle-left right"></i>
</p>
</a>
<ul class="nav-item nav-treeview">
<li class="nav-item">
<a href="#" data-name="options" class="nav-link', $get['page'] === 'options' ? ' active' : '', '">
<i class="fa-solid fa-check-double nav-icon"></i>
<p>' . $lang->get('options') . '</p>
</a>
</li>
<li class="nav-item">
<a href="#" data-name="2fa" class="nav-link', $get['page'] === '2fa' ? ' active' : '', '">
<i class="fa-solid fa-qrcode nav-icon"></i>
<p>' . $lang->get('mfa_short') . '</p>
</a>
</li>
<li class="nav-item">
<a href="#" data-name="api" class="nav-link', $get['page'] === 'api' ? ' active' : '', '">
<i class="fa-solid fa-cubes nav-icon"></i>
<p>' . $lang->get('api') . '</p>
</a>
</li>
<li class="nav-item">
<a href="#" data-name="backups" class="nav-link', $get['page'] === 'backups' ? ' active' : '', '">
<i class="fa-solid fa-database nav-icon"></i>
<p>' . $lang->get('backups') . '</p>
</a>
</li>
<li class="nav-item">
<a href="#" data-name="emails" class="nav-link', $get['page'] === 'emails' ? ' active' : '', '">
<i class="fa-solid fa-envelope nav-icon"></i>
<p>' . $lang->get('emails') . '</p>
</a>
</li>
<li class="nav-item">
<a href="#" data-name="fields" class="nav-link', $get['page'] === 'fields' ? ' active' : '', '">
<i class="fa-solid fa-keyboard nav-icon"></i>
<p>' . $lang->get('fields') . '</p>
</a>
</li>
<li class="nav-item">
<a href="#" data-name="ldap" class="nav-link', $get['page'] === 'ldap' ? ' active' : '', '">
<i class="fa-solid fa-id-card nav-icon"></i>
<p>' . $lang->get('ldap') . '</p>
</a>
</li>';
if (WIP === true) {
echo '
<li class="nav-item">
<a href="#" data-name="oauth" class="nav-link', $get['page'] === 'oauth' ? ' active' : '', '">
<i class="fa-solid fa-plug nav-icon"></i>
<p>' . $lang->get('oauth') . '</p>
</a>
</li>';
}
echo '
<li class="nav-item">
<a href="#" data-name="uploads" class="nav-link', $get['page'] === 'uploads' ? ' active' : '', '">
<i class="fa-solid fa-file-upload nav-icon"></i>
<p>' . $lang->get('uploads') . '</p>
</a>
</li>
<li class="nav-item">
<a href="#" data-name="statistics" class="nav-link', $get['page'] === 'statistics' ? ' active' : '', '">
<i class="fa-solid fa-chart-bar nav-icon"></i>
<p>' . $lang->get('statistics') . '</p>
</a>
</li>
</ul>
</li>';
if (isset($SETTINGS['enable_tasks_manager']) && (int) $SETTINGS['enable_tasks_manager'] === 1) {
echo '
<li class="nav-item">
<a href="#" data-name="tasks" class="nav-link', $get['page'] === 'tasks' ? ' active' : '', '">
<i class="fa-solid fa-tasks nav-icon"></i>
<p>' . $lang->get('tasks') . '</p>
</a>
</li>';
}
}
if (
$session_user_admin === 1
|| $session_user_manager === 1
|| $session_user_human_resources === 1
) {
if (WIP === true) {
echo '
<li class="nav-item">
<a href="#" data-name="tools" class="nav-link', $get['page'] === 'tools' ? ' active' : '', '">
<i class="nav-icon fa-solid fa-screwdriver-wrench"></i>
<p>
' . $lang->get('tools') . '
</p>
</a>
</li>';
}
echo '
<li class="nav-item">
<a href="#" data-name="folders" class="nav-link', $get['page'] === 'folders' ? ' active' : '', '">
<i class="nav-icon fa-solid fa-folder-open"></i>
<p>
' . $lang->get('folders') . '
</p>
</a>
</li>
<li class="nav-item">
<a href="#" data-name="roles" class="nav-link', $get['page'] === 'roles' ? ' active' : '', '">
<i class="nav-icon fa-solid fa-graduation-cap"></i>
<p>
' . $lang->get('roles') . '
</p>
</a>
</li>
<li class="nav-item">
<a href="#" data-name="users" class="nav-link', $get['page'] === 'users' ? ' active' : '', '">
<i class="nav-icon fa-solid fa-users"></i>
<p>
' . $lang->get('users') . '
</p>
</a>
</li>
<li class="nav-item has-treeview', $menuUtilities === true ? ' menu-open' : '', '">
<a href="#" class="nav-link">
<i class="nav-icon fa-solid fa-cubes"></i>
<p>' . $lang->get('admin_views') . '<i class="fa-solid fa-angle-left right"></i></p>
</a>
<ul class="nav nav-treeview">
<li class="nav-item">
<a href="#" data-name="utilities.renewal" class="nav-link', $get['page'] === 'utilities.renewal' ? ' active' : '', '">
<i class="far fa-calendar-alt nav-icon"></i>
<p>' . $lang->get('renewal') . '</p>
</a>
</li>
<li class="nav-item">
<a href="#" data-name="utilities.deletion" class="nav-link', $get['page'] === 'utilities.deletion' ? ' active' : '', '">
<i class="fa-solid fa-trash-alt nav-icon"></i>
<p>' . $lang->get('deletion') . '</p>
</a>
</li>
<li class="nav-item">
<a href="#" data-name="utilities.logs" class="nav-link', $get['page'] === 'utilities.logs' ? ' active' : '', '">
<i class="fa-solid fa-history nav-icon"></i>
<p>' . $lang->get('logs') . '</p>
</a>
</li>
<li class="nav-item">
<a href="#" data-name="utilities.database" class="nav-link', $get['page'] === 'utilities.database' ? ' active' : '', '">
<i class="fa-solid fa-database nav-icon"></i>
<p>' . $lang->get('database') . '</p>
</a>
</li>
</ul>
</li>';
} ?>
</ul>
</nav>
<!-- /.sidebar-menu -->
<div class="menu-footer">
<div class="" id="sidebar-footer">
<i class="fa-solid fa-clock-o mr-2 infotip text-info pointer" title="<?php echo $lang->get('server_time') . ' ' .
date($SETTINGS['date_format'], (int) $server['request_time']) . ' - ' .
date($SETTINGS['time_format'], (int) $server['request_time']); ?>"></i>
<i class="fa-solid fa-users mr-2 infotip text-info pointer" title="<?php echo $session_nb_users_online . ' ' . $lang->get('users_online'); ?>"></i>
<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>
<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>
<i class="fa-solid fa-bug infotip pointer text-info" title="<?php echo $lang->get('bugs_page'); ?>" onclick="generateBugReport()"></i>
</div>
<?php
?>
</div>
</div>
<!-- /.sidebar -->
</aside>
<!-- Content Wrapper. Contains page content -->
<div class="content-wrapper">
<!-- DEFECT REPORT -->
<div class="card card-danger m-2 hidden" id="dialog-bug-report">
<div class="card-header">
<h3 class="card-title">
<i class="fa-solid fa-bug mr-2"></i>
<?php echo $lang->get('defect_report'); ?>
</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="mb-2 alert alert-info">
<i class="icon fa-solid fa-info mr-2"></i>
<?php echo $lang->get('bug_report_to_github'); ?>
</div>
<textarea class="form-control" style="min-height:300px;" id="dialog-bug-report-text" placeholder="<?php echo $lang->get('please_wait_while_loading'); ?>"></textarea>
</div>
</div>
</div>
<div class="card-footer">
<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>
<button class="btn btn-primary" id="dialog-bug-report-github-button"><?php echo $lang->get('open_bug_report_in_github'); ?></button>
<button class="btn btn-default float-right close-element"><?php echo $lang->get('close'); ?></button>
</div>
</div>
<!-- /.DEFECT REPORT -->
<!-- USER CHANGE AUTH PASSWORD -->
<div class="card card-warning m-3 hidden" id="dialog-user-change-password">
<div class="card-header">
<h3 class="card-title">
<i class="fa-solid fa-bullhorn mr-2"></i>
<?php echo $lang->get('your_attention_is_required'); ?>
</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="mb-5 alert alert-info hidden" id="dialog-user-change-password-info">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><?php echo $lang->get('provide_your_current_password'); ?></span>
</div>
<input type="password" class="form-control" id="profile-current-password">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><?php echo $lang->get('index_new_pw'); ?></span>
</div>
<input type="password" class="form-control" id="profile-password">
<div class="input-group-append" style="margin: 0px;">
<span class="input-group-text" id="profile-password-strength"></span>
<input type="hidden" id="profile-password-complex" />
</div>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><?php echo $lang->get('index_change_pw_confirmation'); ?></span>
</div>
<input type="password" class="form-control" id="profile-password-confirm">
</div>
<div class="form-control mt-3 font-weight-light grey" id="dialog-user-change-password-progress">
<?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
</div>
</div>
</div>
</div>
<div class="card-footer">
<button class="btn btn-primary" id="dialog-user-change-password-do"><?php echo $lang->get('launch'); ?></button>
<button class="btn btn-default float-right" id="dialog-user-change-password-close"><?php echo $lang->get('close'); ?></button>
</div>
</div>
<!-- /.USER CHANGE AUTH PASSWORD -->
<!-- LDAP USER HAS CHANGED AUTH PASSWORD -->
<div class="card card-warning m-3 hidden" id="dialog-ldap-user-change-password">
<div class="card-header">
<h3 class="card-title">
<i class="fa-solid fa-bullhorn mr-2"></i>
<?php echo $lang->get('your_attention_is_required'); ?>
</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="mb-5 alert alert-info hidden" id="dialog-ldap-user-change-password-info">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><?php echo $lang->get('provide_your_previous_password'); ?></span>
</div>
<input type="password" class="form-control" id="dialog-ldap-user-change-password-old">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><?php echo $lang->get('provide_your_current_password'); ?></span>
</div>
<input type="password" class="form-control" id="dialog-ldap-user-change-password-current">
</div>
<div class="form-control mt-3 font-weight-light grey" id="dialog-ldap-user-change-password-progress">
<?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
</div>
</div>
</div>
</div>
<div class="card-footer">
<button class="btn btn-primary" id="dialog-ldap-user-change-password-do"><?php echo $lang->get('launch'); ?></button>
<button class="btn btn-default float-right" id="dialog-ldap-user-change-password-close"><?php echo $lang->get('close'); ?></button>
</div>
</div>
<!-- /.LDAP USER HAS CHANGED AUTH PASSWORD -->
<!-- ADMIN ASKS FOR USER PASSWORD CHANGE -->
<div class="card card-warning m-3 hidden" id="dialog-admin-change-user-password">
<div class="card-header">
<h3 class="card-title">
<i class="fa-solid fa-bullhorn mr-2"></i>
<?php echo $lang->get('your_attention_is_required'); ?>
</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="mb-2 alert alert-info" id="dialog-admin-change-user-password-info">
</div>
<div class="form-control mt-3 font-weight-light grey" id="dialog-admin-change-user-password-progress">
<?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
</div>
<div class="mt-3">
<label>
<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>
<input type="checkbox" id="dialog-admin-change-user-password-do-show-password" class="pointer">
</label>
</div>
</div>
</div>
<input type="hidden" id="admin_change_user_password_target_user" value="">
<input type="hidden" id="admin_change_user_encryption_code_target_user" value="">
</div>
<div class="card-footer">
<button class="btn btn-primary mr-3" id="dialog-admin-change-user-password-do"><?php echo $lang->get('launch'); ?></button>
<button class="btn btn-default float-right" id="dialog-admin-change-user-password-close"><?php echo $lang->get('close'); ?></button>
</div>
</div>
<!-- /.ADMIN ASKS FOR USER PASSWORD CHANGE -->
<!-- USER PROVIDES TEMPORARY CODE -->
<div class="card card-warning m-3 hidden" id="dialog-user-temporary-code">
<div class="card-header">
<h3 class="card-title">
<i class="fa-solid fa-bullhorn mr-2"></i>
<?php echo $lang->get('your_attention_is_required'); ?>
</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="mb-5 alert alert-info" id="dialog-user-temporary-code-info">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><?php echo $lang->get('provide_your_current_password'); ?></span>
</div>
<input type="password" class="form-control" id="dialog-user-temporary-code-current-password">
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><?php echo $lang->get('temporary_encryption_code'); ?></span>
</div>
<input type="password" class="form-control" id="dialog-user-temporary-code-value">
</div>
<div class="form-control mt-3 font-weight-light grey" id="dialog-user-temporary-code-progress">
<?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
</div>
</div>
</div>
</div>
<div class="card-footer">
<button class="btn btn-primary" id="dialog-user-temporary-code-do"><?php echo $lang->get('launch'); ?></button>
<button class="btn btn-default float-right" id="dialog-user-temporary-code-close"><?php echo $lang->get('close'); ?></button>
</div>
</div>
<!-- /.USER PROVIDES TEMPORARY CODE -->
<!-- ENCRYPTION KEYS GENERATION -->
<div class="card card-warning m-3 mt-3 hidden" id="dialog-encryption-keys">
<div class="card-header">
<h3 class="card-title">
<i class="fa-solid fa-bullhorn mr-2"></i>
<?php echo $lang->get('your_attention_is_required'); ?>
</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="mb-2 alert alert-info" id="warning-text-reencryption">
<i class="icon fa-solid fa-info mr-2"></i>
<?php echo $lang->get('objects_encryption_explanation'); ?>
</div>
</div>
</div>
<input type="hidden" id="sharekeys_reencryption_target_user" value="">
</div>
<div class="card-footer">
<button class="btn btn-primary" id="button_do_sharekeys_reencryption"><?php echo $lang->get('launch'); ?></button>
<button class="btn btn-default float-right" id="button_close_sharekeys_reencryption"><?php echo $lang->get('close'); ?></button>
</div>
</div>
<!-- /.ENCRYPTION KEYS GENERATION -->
<!-- ENCRYPTION KEYS GENERATION FOR LDAP NEW USER -->
<div class="card card-warning m-3 mt-3 hidden" id="dialog-ldap-user-build-keys-database">
<div class="card-header">
<h3 class="card-title">
<i class="fa-solid fa-bullhorn mr-2"></i>
<?php echo $lang->get('your_attention_is_required'); ?>
</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="mb-2 alert alert-info" id="warning-text-reencryption">
<i class="icon fa-solid fa-info mr-2"></i>
<?php echo $lang->get('help_for_launching_items_encryption'); ?>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><?php echo $lang->get('temporary_encryption_code'); ?></span>
</div>
<input type="password" class="form-control" id="dialog-ldap-user-build-keys-database-code">
</div>
<div class="form-control mt-3 font-weight-light grey" id="dialog-ldap-user-build-keys-database-progress">
<?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
</div>
</div>
</div>
<input type="hidden" id="sharekeys_reencryption_target_user" value="">
</div>
<div class="card-footer">
<button class="btn btn-primary" id="dialog-ldap-user-build-keys-database-do"><?php echo $lang->get('launch'); ?></button>
<button class="btn btn-default float-right" id="dialog-ldap-user-build-keys-database-close"><?php echo $lang->get('close'); ?></button>
</div>
</div>
<!-- /.ENCRYPTION KEYS GENERATION -->
<!-- ENCRYPTION PERSONAL ITEMS GENERATION -->
<div class="card card-warning m-3 hidden" id="dialog-encryption-personal-items-after-upgrade">
<div class="card-header">
<h3 class="card-title">
<i class="fa-solid fa-bullhorn mr-2"></i>
<?php echo $lang->get('your_attention_is_required'); ?>
</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-sm-12 col-md-12">
<div class="mb-2 alert alert-info" id="warning-text-changing-password">
<i class="icon fa-solid fa-info mr-2"></i>
<?php echo $lang->get('objects_encryption_explanation'); ?>
</div>
<div class="input-group mb-3">
<div class="input-group-prepend">
<span class="input-group-text"><?php echo $lang->get('personal_salt_key'); ?></span>
</div>
<input type="password" class="form-control" id="user-current-defuse-psk">
</div>
<div class="form-control mt-3 font-weight-light grey" id="user-current-defuse-psk-progress">
<?php echo $lang->get('provide_current_psk_and_click_launch'); ?>
</div>
</div>
</div>
</div>
<div class="card-footer">
<button class="btn btn-primary" id="button_do_personal_items_reencryption"><?php echo $lang->get('launch'); ?></button>
<button class="btn btn-default float-right" id="button_close_personal_items_reencryption"><?php echo $lang->get('close'); ?></button>
</div>
</div>
<!-- /.ENCRYPTION PERSONAL ITEMS GENERATION -->
<?php
if ($session_initial_url !== null && empty($session_initial_url) === false) {
include $session_initial_url;
} elseif ($get['page'] === 'items') {
// SHow page with Items
if ((int) $session_user_admin !== 1) {
include $SETTINGS['cpassman_dir'] . '/pages/items.php';
} elseif ((int) $session_user_admin === 1) {
include $SETTINGS['cpassman_dir'] . '/pages/admin.php';
} else {
$session->set('system-error_code', ERR_NOT_ALLOWED);
//not allowed page
include $SETTINGS['cpassman_dir'] . '/error.php';
}
} elseif (in_array($get['page'], array_keys($mngPages)) === true) {
// Define if user is allowed to see management pages
if ($session_user_admin === 1) {
// deepcode ignore FileInclusion: $get['page'] is secured through usage of array_keys test bellow
include $SETTINGS['cpassman_dir'] . '/pages/' . basename($mngPages[$get['page']]);
} elseif ($session_user_manager === 1 || $session_user_human_resources === 1) {
if ($get['page'] === 'manage_main' || $get['page'] === 'manage_settings'
) {
$session->set('system-error_code', ERR_NOT_ALLOWED);
//not allowed page
include $SETTINGS['cpassman_dir'] . '/error.php';
}
} else {
$session->set('system-error_code', ERR_NOT_ALLOWED);
//not allowed page
include $SETTINGS['cpassman_dir'] . '/error.php';
}
} elseif (empty($get['page']) === false && file_exists($SETTINGS['cpassman_dir'] . '/pages/' . $get['page'] . '.php') === true) {
// deepcode ignore FileInclusion: $get['page'] is tested against file_exists just below
include $SETTINGS['cpassman_dir'] . '/pages/' . basename($get['page'] . '.php');
} else {
$session->set('system-array_roles', ERR_NOT_EXIST);
//page doesn't exist
include $SETTINGS['cpassman_dir'].'/error.php';
}