ggoffy /
wggithub
| 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 TDM XOOPS - 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 | // Request req_id |
||||
| 32 | $reqId = Request::getInt('req_id'); |
||||
| 33 | switch ($op) { |
||||
| 34 | case 'list': |
||||
| 35 | default: |
||||
| 36 | // Define Stylesheet |
||||
| 37 | $GLOBALS['xoTheme']->addStylesheet($style, null); |
||||
| 38 | $start = Request::getInt('start', 0); |
||||
| 39 | $limit = Request::getInt('limit', $helper->getConfig('adminpager')); |
||||
| 40 | $templateMain = 'wggithub_admin_requests.tpl'; |
||||
| 41 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('requests.php')); |
||||
| 42 | $adminObject->addItemButton(\_AM_WGGITHUB_ADD_REQUEST, 'requests.php?op=new', 'add'); |
||||
|
0 ignored issues
–
show
|
|||||
| 43 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
||||
| 44 | $requestsCount = $requestsHandler->getCountRequests(); |
||||
| 45 | $requestsAll = $requestsHandler->getAllRequests($start, $limit); |
||||
| 46 | $GLOBALS['xoopsTpl']->assign('requests_count', $requestsCount); |
||||
| 47 | $GLOBALS['xoopsTpl']->assign('wggithub_url', WGGITHUB_URL); |
||||
| 48 | $GLOBALS['xoopsTpl']->assign('wggithub_upload_url', WGGITHUB_UPLOAD_URL); |
||||
| 49 | // Table view requests |
||||
| 50 | if ($requestsCount > 0) { |
||||
| 51 | foreach (\array_keys($requestsAll) as $i) { |
||||
| 52 | $request = $requestsAll[$i]->getValuesRequests(); |
||||
| 53 | $GLOBALS['xoopsTpl']->append('requests_list', $request); |
||||
| 54 | unset($request); |
||||
| 55 | } |
||||
| 56 | // Display Navigation |
||||
| 57 | if ($requestsCount > $limit) { |
||||
| 58 | include_once \XOOPS_ROOT_PATH . '/class/pagenav.php'; |
||||
|
0 ignored issues
–
show
|
|||||
| 59 | $pagenav = new \XoopsPageNav($requestsCount, $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...
|
|||||
| 60 | $GLOBALS['xoopsTpl']->assign('pagenav', $pagenav->renderNav(4)); |
||||
| 61 | } |
||||
| 62 | } else { |
||||
| 63 | $GLOBALS['xoopsTpl']->assign('error', \_AM_WGGITHUB_THEREARENT_REQUESTS); |
||||
|
0 ignored issues
–
show
|
|||||
| 64 | } |
||||
| 65 | break; |
||||
| 66 | case 'new': |
||||
| 67 | $templateMain = 'wggithub_admin_requests.tpl'; |
||||
| 68 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('requests.php')); |
||||
| 69 | $adminObject->addItemButton(\_AM_WGGITHUB_REQUESTS_LIST, 'requests.php', 'list'); |
||||
|
0 ignored issues
–
show
|
|||||
| 70 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
||||
| 71 | // Form Create |
||||
| 72 | $requestsObj = $requestsHandler->create(); |
||||
| 73 | $form = $requestsObj->getFormRequests(); |
||||
| 74 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||||
| 75 | break; |
||||
| 76 | case 'save': |
||||
| 77 | // Security Check |
||||
| 78 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||
| 79 | \redirect_header('requests.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...
|
|||||
| 80 | } |
||||
| 81 | if ($reqId > 0) { |
||||
| 82 | $requestsObj = $requestsHandler->get($reqId); |
||||
| 83 | } else { |
||||
| 84 | $requestsObj = $requestsHandler->create(); |
||||
| 85 | } |
||||
| 86 | // Set Vars |
||||
| 87 | $requestsObj->setVar('req_request', Request::getString('req_request', '')); |
||||
| 88 | $requestsObj->setVar('req_result', Request::getString('req_result', '')); |
||||
| 89 | $requestDatecreatedObj = \DateTime::createFromFormat(_SHORTDATESTRING, Request::getString('req_datecreated')); |
||||
|
0 ignored issues
–
show
|
|||||
| 90 | $requestsObj->setVar('req_datecreated', $requestDatecreatedObj->getTimestamp()); |
||||
| 91 | $requestsObj->setVar('req_submitter', Request::getInt('req_submitter', 0)); |
||||
| 92 | // Insert Data |
||||
| 93 | if ($requestsHandler->insert($requestsObj)) { |
||||
| 94 | \redirect_header('requests.php?op=list', 2, \_AM_WGGITHUB_FORM_OK); |
||||
| 95 | } |
||||
| 96 | // Get Form |
||||
| 97 | $GLOBALS['xoopsTpl']->assign('error', $requestsObj->getHtmlErrors()); |
||||
| 98 | $form = $requestsObj->getFormRequests(); |
||||
| 99 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||||
| 100 | break; |
||||
| 101 | case 'edit': |
||||
| 102 | $templateMain = 'wggithub_admin_requests.tpl'; |
||||
| 103 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('requests.php')); |
||||
| 104 | $adminObject->addItemButton(\_AM_WGGITHUB_ADD_REQUEST, 'requests.php?op=new', 'add'); |
||||
| 105 | $adminObject->addItemButton(\_AM_WGGITHUB_REQUESTS_LIST, 'requests.php', 'list'); |
||||
| 106 | $GLOBALS['xoopsTpl']->assign('buttons', $adminObject->displayButton('left')); |
||||
| 107 | // Get Form |
||||
| 108 | $requestsObj = $requestsHandler->get($reqId); |
||||
| 109 | $form = $requestsObj->getFormRequests(); |
||||
| 110 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||||
| 111 | break; |
||||
| 112 | case 'delete': |
||||
| 113 | $templateMain = 'wggithub_admin_requests.tpl'; |
||||
| 114 | $GLOBALS['xoopsTpl']->assign('navigation', $adminObject->displayNavigation('requests.php')); |
||||
| 115 | $requestsObj = $requestsHandler->get($reqId); |
||||
| 116 | $reqRequest = $requestsObj->getVar('req_request'); |
||||
| 117 | if (isset($_REQUEST['ok']) && 1 == $_REQUEST['ok']) { |
||||
| 118 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||
| 119 | \redirect_header('requests.php', 3, \implode(', ', $GLOBALS['xoopsSecurity']->getErrors())); |
||||
| 120 | } |
||||
| 121 | if ($requestsHandler->delete($requestsObj)) { |
||||
| 122 | \redirect_header('requests.php', 3, \_AM_WGGITHUB_FORM_DELETE_OK); |
||||
| 123 | } else { |
||||
| 124 | $GLOBALS['xoopsTpl']->assign('error', $requestsObj->getHtmlErrors()); |
||||
| 125 | } |
||||
| 126 | } else { |
||||
| 127 | $customConfirm = new Common\Confirm( |
||||
| 128 | ['ok' => 1, 'req_id' => $reqId, 'op' => 'delete'], |
||||
| 129 | $_SERVER['REQUEST_URI'], |
||||
| 130 | \sprintf(\_AM_WGGITHUB_FORM_SURE_DELETE, $requestsObj->getVar('req_request'))); |
||||
| 131 | $form = $customConfirm->getFormConfirm(); |
||||
| 132 | $GLOBALS['xoopsTpl']->assign('form', $form->render()); |
||||
| 133 | } |
||||
| 134 | break; |
||||
| 135 | } |
||||
| 136 | require __DIR__ . '/footer.php'; |
||||
| 137 |
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