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 | * wgGitHub module for xoops |
||||
14 | * |
||||
15 | * @copyright 2020 XOOPS Project (https://xooops.org) |
||||
16 | * @license GPL 2.0 or later |
||||
17 | * @package wggithub |
||||
18 | * @since 1.0 |
||||
19 | * @min_xoops 2.5.10 |
||||
20 | * @author Goffy - XOOPS Development Team - Email:<[email protected]> - Website:<https://wedega.com> |
||||
21 | */ |
||||
22 | |||||
23 | use Xmf\Request; |
||||
0 ignored issues
–
show
|
|||||
24 | use XoopsModules\Wggithub; |
||||
25 | use XoopsModules\Wggithub\Constants; |
||||
26 | use XoopsModules\Wggithub\Common; |
||||
27 | |||||
28 | require __DIR__ . '/header.php'; |
||||
29 | // It recovered the value of argument op in URL$ |
||||
30 | $op = Request::getCmd('op', 'list'); |
||||
31 | $logId = Request::getInt('log_id'); |
||||
32 | $start = Request::getInt('start', 0); |
||||
33 | $limit = Request::getInt('limit', $helper->getConfig('adminpager')); |
||||
34 | $GLOBALS['xoopsTpl']->assign('start', $start); |
||||
35 | $GLOBALS['xoopsTpl']->assign('limit', $limit); |
||||
36 | |||||
37 | switch ($op) { |
||||
38 | case 'list': |
||||
39 | default: |
||||
40 | // Define Stylesheet |
||||
41 | $GLOBALS['xoTheme']->addStylesheet($style, null); |
||||
42 | $templateMain = 'wggithub_admin_logs.tpl'; |
||||
43 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('logs.php')); |
||||
44 | $adminObject->addItemButton(\_AM_WGGITHUB_LOG_CLEAR, 'logs.php?op=clear', 'delete'); |
||||
45 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
||||
46 | $logsCount = $logsHandler->getCountLogs(); |
||||
47 | $logsAll = $logsHandler->getAllLogs($start, $limit); |
||||
48 | $GLOBALS['xoopsTpl']->assign('logs_count', $logsCount); |
||||
49 | $GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL); |
||||
50 | $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
||||
51 | // Table view logs |
||||
52 | if ($logsCount > 0) { |
||||
53 | foreach (\array_keys($logsAll) as $i) { |
||||
54 | $log = $logsAll[$i]->getValuesLogs(); |
||||
55 | $GLOBALS['xoopsTpl']->append('logs_list', $log); |
||||
56 | unset($log); |
||||
57 | } |
||||
58 | // Display Navigation |
||||
59 | if ($logsCount > $limit) { |
||||
60 | include_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||||
0 ignored issues
–
show
|
|||||
61 | $pagenav = new \XoopsPageNav($logsCount, $limit, $start, 'start', 'op=list&limit=' . $limit); |
||||
0 ignored issues
–
show
The type
XoopsPageNav was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths
Loading history...
|
|||||
62 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
||||
63 | } |
||||
64 | } else { |
||||
65 | $GLOBALS['xoopsTpl']->assign('error', \_AM_WGGITHUB_THEREARENT_LOGS); |
||||
66 | } |
||||
67 | break; |
||||
68 | case 'save': |
||||
69 | // Security Check |
||||
70 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||
71 | \redirect_header('logs.php', 3, \implode(',', $GLOBALS['xoopsSecurity']->getErrors())); |
||||
0 ignored issues
–
show
The function
redirect_header was not found. Maybe you did not declare it correctly or list all dependencies?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||
72 | } |
||||
73 | if ($logId > 0) { |
||||
74 | $logsObj = $logsHandler->get($logId); |
||||
75 | } else { |
||||
76 | $logsObj = $logsHandler->create(); |
||||
77 | } |
||||
78 | // Set Vars |
||||
79 | $logsObj->setVar('log_type', Request::getInt('log_type', 0)); |
||||
80 | $logsObj->setVar('log_details', Request::getString('log_details', '')); |
||||
81 | $logsObj->setVar('log_result', Request::getString('log_result', '')); |
||||
82 | $logDatecreatedObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('log_datecreated')); |
||||
0 ignored issues
–
show
|
|||||
83 | $logsObj->setVar('log_datecreated', $logDatecreatedObj->getTimestamp()); |
||||
84 | $logsObj->setVar('log_submitter', Request::getInt('log_submitter', 0)); |
||||
85 | // Insert Data |
||||
86 | if ($logsHandler->insert($logsObj)) { |
||||
87 | \redirect_header('logs.php?op=list&start=' . $start . '&limit=' . $limit, 2, \_AM_WGGITHUB_FORM_OK); |
||||
88 | } |
||||
89 | // Get Form |
||||
90 | $GLOBALS['xoopsTpl']->assign('error', $logsObj->getHtmlErrors()); |
||||
91 | $form = $logsObj->getFormLogs(false, $start, $limit); |
||||
92 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||||
93 | break; |
||||
94 | case 'edit': |
||||
95 | $templateMain = 'wggithub_admin_logs.tpl'; |
||||
96 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('logs.php')); |
||||
97 | $adminObject->addItemButton(\_AM_WGGITHUB_LOGS_LIST, 'logs.php', 'list'); |
||||
98 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
||||
99 | // Get Form |
||||
100 | $logsObj = $logsHandler->get($logId); |
||||
101 | $form = $logsObj->getFormLogs(false, $start, $limit); |
||||
102 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||||
103 | break; |
||||
104 | case 'delete': |
||||
105 | $templateMain = 'wggithub_admin_logs.tpl'; |
||||
106 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('logs.php')); |
||||
107 | $logsObj = $logsHandler->get($logId); |
||||
108 | if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
||||
109 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||
110 | \redirect_header('logs.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
||||
111 | } |
||||
112 | if ($logsHandler->delete($logsObj)) { |
||||
113 | \redirect_header('logs.php', 3, \_AM_WGGITHUB_FORM_DELETE_OK); |
||||
114 | } else { |
||||
115 | $GLOBALS['xoopsTpl']->assign('error', $logsObj->getHtmlErrors()); |
||||
116 | } |
||||
117 | } else { |
||||
118 | $xoopsconfirm = new Common\XoopsConfirm( |
||||
119 | ['ok' => 1, 'log_id' => $logId, 'op' => 'delete'], |
||||
120 | $_SERVER['REQUEST_URI'], |
||||
121 | \sprintf(\_AM_WGGITHUB_FORM_SURE_DELETE, $logsObj->getVar('log_details'))); |
||||
122 | $form = $xoopsconfirm->getFormXoopsConfirm(); |
||||
123 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||||
124 | } |
||||
125 | break; |
||||
126 | case 'clear': |
||||
127 | $templateMain = 'wggithub_admin_logs.tpl'; |
||||
128 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('logs.php')); |
||||
129 | $adminObject->addItemButton(\_AM_WGGITHUB_LOGS_LIST, 'logs.php', 'list'); |
||||
130 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
||||
131 | if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
||||
132 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||
133 | \redirect_header('logs.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
||||
134 | } |
||||
135 | $logsHandler->deleteAll(null, true); |
||||
136 | \redirect_header('logs.php', 3, \_AM_WGGITHUB_FORM_DELETE_OK); |
||||
137 | } else { |
||||
138 | $xoopsconfirm = new Common\XoopsConfirm( |
||||
139 | ['ok' => 1, 'op' => 'clear'], |
||||
140 | $_SERVER['REQUEST_URI'], |
||||
141 | \sprintf(\_AM_WGGITHUB_FORM_SURE_DELETEALL, 'wggithub_logs')); |
||||
142 | $form = $xoopsconfirm->getFormXoopsConfirm(); |
||||
143 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||||
144 | } |
||||
145 | break; |
||||
146 | } |
||||
147 | require __DIR__ . '/footer.php'; |
||||
148 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths