-
Notifications
You must be signed in to change notification settings - Fork 1
/
statistics.php
executable file
·88 lines (78 loc) · 2.65 KB
/
statistics.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
<?php
/******************************************************************************
* Statistiken V 3.5.0 (kompatibel mit Admidio 4.1 and above)
*
* Beta-Version
*
* Dieses Plugin ermöglicht das Erstellen von Statistiken aus den Profildaten
* der angemeldeten Benutzer. Konfigurierte Statistiken können gespeichert,
* geladen und angezeigt werden.
*
*
* @copyright 2004-2024 The Admidio Team
* @see https://www.admidio.org/
* @license https://www.gnu.org/licenses/gpl-2.0.html GNU General Public License v2.0 only
*
*****************************************************************************/
require_once(__DIR__ . '/includes.php');
require_once(__DIR__ . '/utils/db_constants.php');
require_once(__DIR__ . '/install/install_functions.php');
$showOverview = false;
if (!isset($plgAllowShow)) {
$plgAllowShow = array('Administrator');
}
if (!isset($plgAllowConfig)) {
$plgAllowConfig = array('Administrator');
}
foreach ($plgAllowShow as $i) {
if ($i == 'Benutzer'
&& $gValidLogin) {
$showOverview = true;
} elseif ($i == 'Rollenverwalter'
&& $gCurrentUser->assignRoles()) {
$showOverview = true;
} elseif ($i == 'Listenberechtigte'
&& $gCurrentUser->checkRolesRight('rol_all_lists_view')) {
$showOverview = true;
} elseif ($i === 'Administrator' && $gCurrentUser->isAdministrator()) {
$showOverview = true;
} elseif (hasRole($i)) {
$showOverview = true;
}
}
$showConfig = false;
foreach ($plgAllowConfig as $i) {
if ($i == 'Benutzer'
&& $gValidLogin) {
$showPlugin = true;
} elseif ($i == 'Rollenverwalter'
&& $gCurrentUser->assignRoles()) {
$showConfig = true;
} elseif ($i == 'Listenberechtigte'
&& $gCurrentUser->checkRolesRight('rol_all_lists_view')) {
$showConfig = true;
} elseif ($i === 'Administrator' && $gCurrentUser->isAdministrator()) {
$showConfig = true;
} elseif (hasRole($i)) {
$showConfig = true;
}
}
$showInstall = false;
if ($gCurrentUser->isAdministrator()) {
$showInstall = true;
}
if ($showOverview || $showConfig || $showInstall) {
$sql = 'SELECT men_id FROM ' . TBL_MENU . '
WHERE men_name_intern IN (\'statistics\', \'statistics_editor\')';
$statement = $gDb->query($sql);
if ($statement->rowCount() === 0) {
if (statCheckPreviousInstallations()) {
statAddMenu();
} else {
header('Location: ./install/install.php');
exit();
}
} else {
echo 'Plugin is successfully installed. Please go to the menu of Admidio and select the new added entries of the statistic plugin!';
}
}