|
1
|
|
|
<?php |
|
2
|
|
|
/* |
|
3
|
|
|
You may not change or alter any portion of this comment or credits |
|
4
|
|
|
of supporting developers from this source code or any supporting source code |
|
5
|
|
|
which is considered copyrighted (c) material of the original comment or credit authors. |
|
6
|
|
|
|
|
7
|
|
|
This program is distributed in the hope that it will be useful, |
|
8
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
9
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
/** |
|
13
|
|
|
* userlog module |
|
14
|
|
|
* |
|
15
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
|
16
|
|
|
* @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
|
17
|
|
|
* @package userlog admin |
|
18
|
|
|
* @since 1 |
|
19
|
|
|
* @author irmtfan ([email protected]) |
|
20
|
|
|
* @author XOOPS Project <www.xoops.org> <www.xoops.ir> |
|
21
|
|
|
*/ |
|
22
|
|
|
|
|
23
|
|
|
// defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); |
|
24
|
|
|
|
|
25
|
|
|
//$path = dirname(dirname(dirname(__DIR__))); |
|
26
|
|
|
//require_once $path . '/mainfile.php'; |
|
27
|
|
|
require_once __DIR__ . '/../include/common.php'; // after installation it will be included before admin_header.php |
|
28
|
|
|
$userlog = Userlog::getInstance(); |
|
29
|
|
|
$moduleDirName = basename(dirname(__DIR__)); |
|
30
|
|
|
$pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); |
|
31
|
|
|
$pathModIcon32 = $userlog->getModule()->getInfo('modicons32'); |
|
32
|
|
|
|
|
33
|
|
|
xoops_loadLanguage('modinfo', $moduleDirName); |
|
34
|
|
|
xoops_loadLanguage('admin', $moduleDirName); |
|
35
|
|
|
$userlog->loadLanguage('admin'); |
|
36
|
|
|
|
|
37
|
|
|
$i = 0; |
|
38
|
|
|
|
|
39
|
|
|
// Index |
|
40
|
|
|
$adminmenu[] = [ |
|
41
|
|
|
'title' => _AM_USERLOG_ADMENU_INDEX, |
|
42
|
|
|
'link' => 'admin/index.php', |
|
43
|
|
|
'icon' => $pathIcon32 . '/home.png', |
|
44
|
|
|
]; |
|
45
|
|
|
|
|
46
|
|
|
$adminmenu[] = [ |
|
47
|
|
|
'title' => _AM_USERLOG_ADMENU_SETTING, |
|
48
|
|
|
'link' => 'admin/setting.php', |
|
49
|
|
|
'icon' => $pathIcon32 . '/administration.png', |
|
50
|
|
|
]; |
|
51
|
|
|
|
|
52
|
|
|
$adminmenu[] = [ |
|
53
|
|
|
'title' => _AM_USERLOG_ADMENU_LOGS, |
|
54
|
|
|
'link' => 'admin/logs.php', |
|
55
|
|
|
'icon' => $pathIcon32 . '/content.png', |
|
56
|
|
|
]; |
|
57
|
|
|
|
|
58
|
|
|
$adminmenu[] = [ |
|
59
|
|
|
'title' => _AM_USERLOG_ADMENU_FILE, |
|
60
|
|
|
'link' => 'admin/file.php', |
|
61
|
|
|
'icon' => $pathIcon32 . '/compfile.png', |
|
62
|
|
|
]; |
|
63
|
|
|
|
|
64
|
|
|
$adminmenu[] = [ |
|
65
|
|
|
'title' => _AM_USERLOG_ADMENU_STATS, |
|
66
|
|
|
'link' => 'admin/stats.php', |
|
67
|
|
|
'icon' => $pathIcon32 . '/stats.png', |
|
68
|
|
|
]; |
|
69
|
|
|
|
|
70
|
|
|
$adminmenu[] = [ |
|
71
|
|
|
'title' => _AM_USERLOG_ABOUT, |
|
72
|
|
|
'link' => 'admin/about.php', |
|
73
|
|
|
'icon' => $pathIcon32 . '/about.png', |
|
74
|
|
|
]; |
|
75
|
|
|
|
|
76
|
|
|
// add js, css, toggle_cookie to admin pages |
|
77
|
|
|
global $xoTheme; |
|
|
|
|
|
|
78
|
|
|
$xoTheme->addScript('modules/' . USERLOG_DIRNAME . '/assets/js/scripts.js'); |
|
79
|
|
|
$xoTheme->addStylesheet('modules/' . USERLOG_DIRNAME . '/assets/css/style.css'); |
|
80
|
|
|
$toggle_script = 'var toggle_cookie="' . $userlog->cookiePrefix . 'TOGGLE' . '";'; |
|
81
|
|
|
$xoTheme->addScript(null, ['type' => 'text/javascript'], $toggle_script); |
|
82
|
|
|
|
Instead of relying on
globalstate, we recommend one of these alternatives:1. Pass all data via parameters
2. Create a class that maintains your state