XoopsModules25x /
mymenus
This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include, or for example
via PHP's auto-loading mechanism.
| 1 | <?php namespace XoopsModules\Mymenus; |
||||||
| 2 | |||||||
| 3 | /* |
||||||
| 4 | You may not change or alter any portion of this comment or credits |
||||||
| 5 | of supporting developers from this source code or any supporting source code |
||||||
| 6 | which is considered copyrighted (c) material of the original comment or credit authors. |
||||||
| 7 | |||||||
| 8 | This program is distributed in the hope that it will be useful, |
||||||
| 9 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||||
| 10 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||||
| 11 | */ |
||||||
| 12 | |||||||
| 13 | /** |
||||||
| 14 | * @copyright XOOPS Project (https://xoops.org) |
||||||
| 15 | * @license http://www.gnu.org/licenses/gpl-2.0.html GNU Public License |
||||||
| 16 | * @package Mymenus |
||||||
| 17 | * @since 1.0 |
||||||
| 18 | * @author trabis <[email protected]>, bleekk <[email protected]> |
||||||
| 19 | */ |
||||||
| 20 | |||||||
| 21 | use Xmf\Request; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 22 | use XoopsModules\Mymenus; |
||||||
| 23 | |||||||
| 24 | /** |
||||||
| 25 | * Class LinksUtility |
||||||
| 26 | */ |
||||||
| 27 | class LinksUtility |
||||||
| 28 | { |
||||||
| 29 | |||||||
| 30 | /** |
||||||
| 31 | * Display the links in a menu |
||||||
| 32 | * |
||||||
| 33 | * @param integer $start |
||||||
| 34 | * @param integer $mid |
||||||
| 35 | * |
||||||
| 36 | * @return bool|mixed|string |
||||||
| 37 | */ |
||||||
| 38 | public static function listLinks($start = 0, $mid) |
||||||
| 39 | { |
||||||
| 40 | /** @var \XoopsModules\Mymenus\Helper $helper */ |
||||||
| 41 | $helper = \XoopsModules\Mymenus\Helper::getInstance(); |
||||||
| 42 | |||||||
| 43 | global $mymenusTpl; |
||||||
| 44 | // |
||||||
| 45 | $linksCriteria = new \CriteriaCompo(new \Criteria('mid', (int)$mid)); |
||||||
|
0 ignored issues
–
show
The type
Criteria 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...
The type
CriteriaCompo 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...
|
|||||||
| 46 | $linksCount = $helper->getHandler('Links')->getCount($linksCriteria); |
||||||
| 47 | $mymenusTpl->assign('count', $linksCount); |
||||||
| 48 | // |
||||||
| 49 | $linksCriteria->setSort('weight'); |
||||||
| 50 | $linksCriteria->setOrder('ASC'); |
||||||
| 51 | // |
||||||
| 52 | // $menusArray = array(); |
||||||
| 53 | if (($linksCount > 0) && ($linksCount >= (int)$start)) { |
||||||
| 54 | $linksCriteria->setStart((int)$start); |
||||||
| 55 | $linksArrays = $helper->getHandler('Links')->getObjects($linksCriteria, false, false); // as array |
||||||
| 56 | // |
||||||
| 57 | $menuBuilder = new Mymenus\Builder($linksArrays); |
||||||
| 58 | $menusArray = $menuBuilder->render(); |
||||||
| 59 | $mymenusTpl->assign('menus', $menusArray); // not 'menus', 'links' shoult be better |
||||||
| 60 | } |
||||||
| 61 | // |
||||||
| 62 | $mymenusTpl->assign('addform', self::editLink(null, null, $mid)); |
||||||
| 63 | |||||||
| 64 | // |
||||||
| 65 | return $mymenusTpl->fetch($GLOBALS['xoops']->path("modules/{$helper->getDirname()}/templates/static/mymenus_admin_links.tpl")); |
||||||
| 66 | } |
||||||
| 67 | |||||||
| 68 | /** |
||||||
| 69 | * @param $mid |
||||||
| 70 | */ |
||||||
| 71 | public static function addLink($mid) |
||||||
| 72 | { |
||||||
| 73 | /** @var \XoopsModules\Mymenus\Helper $helper */ |
||||||
| 74 | $helper = \XoopsModules\Mymenus\Helper::getInstance(); |
||||||
| 75 | // |
||||||
| 76 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||||
| 77 | redirect_header($GLOBALS['mymenusAdminPage'], 3, implode('<br>', $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...
|
|||||||
| 78 | } |
||||||
| 79 | if (!$mid) { |
||||||
| 80 | redirect_header($GLOBALS['mymenusAdminPage'] . '?op=list', 2, _AM_MYMENUS_MSG_MENU_INVALID_ERROR); |
||||||
| 81 | } |
||||||
| 82 | // |
||||||
| 83 | $linksCiteria = new \CriteriaCompo(new \Criteria('mid', $mid)); |
||||||
| 84 | $linksCiteria->setSort('weight'); |
||||||
| 85 | $linksCiteria->setOrder('DESC'); |
||||||
| 86 | $linksCiteria->setLimit(1); |
||||||
| 87 | $linksObjs = $helper->getHandler('Links')->getObjects($linksCiteria); |
||||||
| 88 | $weight = 1; |
||||||
| 89 | if (isset($linksObjs[0]) && ($linksObjs[0] instanceof \XoopsModules\Mymenus\Links)) { |
||||||
| 90 | $weight = $linksObjs[0]->getVar('weight') + 1; |
||||||
| 91 | } |
||||||
| 92 | |||||||
| 93 | $newLinksObj = $helper->getHandler('Links')->create(); |
||||||
| 94 | // if (!isset($_POST['hooks'])) { |
||||||
| 95 | // $_POST['hooks'] = array(); |
||||||
| 96 | // } |
||||||
| 97 | if (!Request::getArray('hooks', null, 'POST')) { |
||||||
| 98 | $_POST['hooks'] = []; |
||||||
| 99 | } |
||||||
| 100 | // clean incoming POST vars |
||||||
| 101 | $newLinksObj->setVar('id', Request::getInt('id',0,'POST')); |
||||||
| 102 | $newLinksObj->setVar('pid', Request::getInt('pid',0,'POST')); |
||||||
| 103 | $newLinksObj->setVar('mid', Request::getInt('mid',0,'POST')); |
||||||
| 104 | $newLinksObj->setVar('title', Request::getString('title','','POST')); |
||||||
| 105 | $newLinksObj->setVar('alt_title', Request::getString('alt_title','','POST')); |
||||||
| 106 | $newLinksObj->setVar('visible', Request::getInt('visible',0,'POST')); |
||||||
| 107 | $newLinksObj->setVar('link', Request::getString('link','','POST')); |
||||||
| 108 | $newLinksObj->setVar('weight', Request::getInt('weight',0,'POST')); |
||||||
| 109 | $newLinksObj->setVar('target', Request::getString('target','','POST')); |
||||||
| 110 | $newLinksObj->setVar('groups', Request::getArray('groups', [], 'POST')); |
||||||
| 111 | $newLinksObj->setVar('hooks', Request::getArray('hooks', [], 'POST')); |
||||||
| 112 | $newLinksObj->setVar('image', Request::getString('image','','POST')); |
||||||
| 113 | $newLinksObj->setVar('css', Request::getString('css','','POST')); |
||||||
| 114 | |||||||
| 115 | $newLinksObj->setVar('weight', $weight); |
||||||
| 116 | /** @var \XoopsModules\Mymenus\LinksHandler $linksHandler */ |
||||||
| 117 | $linksHandler = $helper->getHandler('Links'); |
||||||
| 118 | if (!$linksHandler->insert($newLinksObj)) { |
||||||
| 119 | $msg = _AM_MYMENUS_MSG_ERROR; |
||||||
| 120 | } else { |
||||||
| 121 | $linksHandler->updateWeights($newLinksObj); |
||||||
| 122 | $msg = _AM_MYMENUS_MSG_SUCCESS; |
||||||
| 123 | } |
||||||
| 124 | |||||||
| 125 | redirect_header($GLOBALS['mymenusAdminPage'] . '?op=list&mid=' . $newLinksObj->getVar('mid'), 2, $msg); |
||||||
| 126 | } |
||||||
| 127 | |||||||
| 128 | /** |
||||||
| 129 | * @param integer $id |
||||||
| 130 | * @param integer $mid |
||||||
| 131 | */ |
||||||
| 132 | public static function saveLink($id, $mid) |
||||||
| 133 | { |
||||||
| 134 | /** @var \XoopsModules\Mymenus\Helper $helper */ |
||||||
| 135 | $helper = \XoopsModules\Mymenus\Helper::getInstance(); |
||||||
| 136 | /** @var \XoopsModules\Mymenus\LinksHandler $linksHandler */ |
||||||
| 137 | $linksHandler = $helper->getHandler('Links'); |
||||||
| 138 | // |
||||||
| 139 | if (!$GLOBALS['xoopsSecurity']->check()) { |
||||||
| 140 | redirect_header($GLOBALS['mymenusAdminPage'], 3, implode('<br>', $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...
|
|||||||
| 141 | } |
||||||
| 142 | if (!$mid) { |
||||||
| 143 | redirect_header($GLOBALS['mymenusAdminPage'] . '?op=list', 2, _AM_MYMENUS_MSG_MENU_INVALID_ERROR); |
||||||
| 144 | } |
||||||
| 145 | // |
||||||
| 146 | $mid = (int)$mid; |
||||||
| 147 | $linksObj = $linksHandler->get((int)$id); |
||||||
| 148 | |||||||
| 149 | //if this was moved then parent could be in different menu, if so then set parent to top level |
||||||
| 150 | if (Request::getInt('pid', '', 'POST')) { |
||||||
| 151 | $parentLinksObj = $linksHandler->get($linksObj->getVar('pid')); //get the parent object |
||||||
| 152 | if (($parentLinksObj instanceof \XoopsModules\Mymenus\Links) |
||||||
| 153 | && ($linksObj->getVar('mid') != $parentLinksObj->getVar('mid'))) { |
||||||
| 154 | $linksObj->setVar('pid', 0); |
||||||
| 155 | } |
||||||
| 156 | } |
||||||
| 157 | // Disable xoops debugger in dialog window |
||||||
| 158 | xoops_load('xoopslogger'); |
||||||
|
0 ignored issues
–
show
The function
xoops_load 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...
|
|||||||
| 159 | $xoopsLogger = \XoopsLogger::getInstance(); |
||||||
|
0 ignored issues
–
show
The type
XoopsLogger 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...
|
|||||||
| 160 | $xoopsLogger->activated = false; |
||||||
| 161 | error_reporting(0); |
||||||
| 162 | |||||||
| 163 | // @TODO: clean incoming POST vars |
||||||
| 164 | $linksObj->setVars($_POST); |
||||||
| 165 | |||||||
| 166 | if (!$linksHandler->insert($linksObj)) { |
||||||
| 167 | $msg = _AM_MYMENUS_MSG_ERROR; |
||||||
| 168 | } else { |
||||||
| 169 | $msg = _AM_MYMENUS_MSG_SUCCESS; |
||||||
| 170 | } |
||||||
| 171 | |||||||
| 172 | redirect_header($GLOBALS['mymenusAdminPage'] . "?op=list&mid={$mid}", 2, $msg); |
||||||
| 173 | } |
||||||
| 174 | |||||||
| 175 | /** |
||||||
| 176 | * @param null $id |
||||||
|
0 ignored issues
–
show
|
|||||||
| 177 | * @param null $pid |
||||||
|
0 ignored issues
–
show
|
|||||||
| 178 | * |
||||||
| 179 | * @param null $mid |
||||||
|
0 ignored issues
–
show
|
|||||||
| 180 | * @return string |
||||||
| 181 | */ |
||||||
| 182 | public static function editLink($id = null, $pid = null, $mid = null) |
||||||
| 183 | { |
||||||
| 184 | /** @var \XoopsModules\Mymenus\Helper $helper */ |
||||||
| 185 | $helper = \XoopsModules\Mymenus\Helper::getInstance(); |
||||||
| 186 | // |
||||||
| 187 | // Disable xoops debugger in dialog window |
||||||
| 188 | xoops_load('xoopslogger'); |
||||||
|
0 ignored issues
–
show
The function
xoops_load 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...
|
|||||||
| 189 | $xoopsLogger = \XoopsLogger::getInstance(); |
||||||
| 190 | $xoopsLogger->activated = false; |
||||||
| 191 | error_reporting(0); |
||||||
| 192 | |||||||
| 193 | $pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); |
||||||
|
0 ignored issues
–
show
The type
Xmf\Module\Admin 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...
|
|||||||
| 194 | |||||||
| 195 | // $registry = MymenusRegistry::getInstance(); |
||||||
| 196 | // $plugin = MymenusPlugin::getInstance(); |
||||||
| 197 | |||||||
| 198 | $linksObj = $helper->getHandler('Links')->get((int)$id); |
||||||
| 199 | |||||||
| 200 | if ($linksObj->isNew()) { |
||||||
| 201 | $formTitle = _ADD; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 202 | if (null !== $pid) { |
||||||
| 203 | $linksObj->setVar('pid', (int)$pid); |
||||||
| 204 | } |
||||||
| 205 | if (null !== $mid) { |
||||||
| 206 | $linksObj->setVar('mid', (int)$mid); |
||||||
| 207 | } |
||||||
| 208 | } else { |
||||||
| 209 | $formTitle = _EDIT; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 210 | } |
||||||
| 211 | $form = new \XoopsThemeForm($formTitle, 'admin_form', $GLOBALS['mymenusAdminPage'], 'post', true); |
||||||
|
0 ignored issues
–
show
The type
XoopsThemeForm 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...
|
|||||||
| 212 | // links: title |
||||||
| 213 | $formtitle = new \XoopsFormText(_AM_MYMENUS_MENU_TITLE, 'title', 50, 255, $linksObj->getVar('title')); |
||||||
|
0 ignored issues
–
show
The type
XoopsFormText 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...
|
|||||||
| 214 | $form->addElement($formtitle, true); |
||||||
| 215 | // links: alt_title |
||||||
| 216 | $formalttitle = new \XoopsFormText(_AM_MYMENUS_MENU_ALTTITLE, 'alt_title', 50, 255, $linksObj->getVar('alt_title')); |
||||||
| 217 | $form->addElement($formalttitle); |
||||||
| 218 | // links: mid |
||||||
| 219 | $menusCriteria = new \CriteriaCompo(); |
||||||
| 220 | $menusCriteria->setSort('title'); |
||||||
| 221 | $menusCriteria->setOrder('ASC'); |
||||||
| 222 | $menusList = $helper->getHandler('Menus')->getList($menusCriteria); |
||||||
| 223 | if (count($menusList) > 1) { |
||||||
| 224 | // display menu options (if more than 1 menu available |
||||||
| 225 | if (!$linksObj->getVar('mid')) { // initial menu value not set |
||||||
| 226 | // $menuValues = array_flip($menusList); |
||||||
| 227 | $formmid = new \XoopsFormSelect(_AM_MYMENUS_MENU_MENU, 'mid', $mid);//array_shift($menuValues)); |
||||||
|
0 ignored issues
–
show
The type
XoopsFormSelect 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...
|
|||||||
| 228 | } else { |
||||||
| 229 | $formmid = new \XoopsFormSelect(_AM_MYMENUS_MENU_MENU, 'mid', $linksObj->getVar('mid')); |
||||||
| 230 | } |
||||||
| 231 | $formmid->addOptionArray($menusList); |
||||||
| 232 | } else { |
||||||
| 233 | $menuKeys = array_keys($menusList); |
||||||
| 234 | $menuTitle = array_shift($menusList); |
||||||
| 235 | $formmid = new \XoopsFormElementTray('Menu'); |
||||||
|
0 ignored issues
–
show
The type
XoopsFormElementTray 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...
|
|||||||
| 236 | $formmid->addElement(new \XoopsFormHidden('mid', $menuKeys[0])); |
||||||
|
0 ignored issues
–
show
The type
XoopsFormHidden 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...
|
|||||||
| 237 | $formmid->addElement(new \XoopsFormLabel('', $menuTitle, 'menuTitle')); |
||||||
|
0 ignored issues
–
show
The type
XoopsFormLabel 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...
|
|||||||
| 238 | } |
||||||
| 239 | $form->addElement($formmid); |
||||||
| 240 | // links: link |
||||||
| 241 | $formlink = new \XoopsFormText(_AM_MYMENUS_MENU_LINK, 'link', 50, 255, $linksObj->getVar('link')); |
||||||
| 242 | $form->addElement($formlink); |
||||||
| 243 | // links: image |
||||||
| 244 | $formimage = new \XoopsFormText(_AM_MYMENUS_MENU_IMAGE, 'image', 50, 255, $linksObj->getVar('image')); |
||||||
| 245 | $form->addElement($formimage); |
||||||
| 246 | // |
||||||
| 247 | //$form->addElement($formparent); |
||||||
| 248 | // links: visible |
||||||
| 249 | $statontxt = " <img src='{$pathIcon16}/1.png' alt='" . _YES . "'> " . _YES . ' '; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 250 | $statofftxt = " <img src='{$pathIcon16}/0.png' alt='" . _NO . "'> " . _NO . ' '; |
||||||
|
0 ignored issues
–
show
|
|||||||
| 251 | $formvis = new \XoopsFormRadioYN(_AM_MYMENUS_MENU_VISIBLE, 'visible', $linksObj->getVar('visible'), $statontxt, $statofftxt); |
||||||
|
0 ignored issues
–
show
The type
XoopsFormRadioYN 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...
|
|||||||
| 252 | $form->addElement($formvis); |
||||||
| 253 | // links: target |
||||||
| 254 | $formtarget = new \XoopsFormSelect(_AM_MYMENUS_MENU_TARGET, 'target', $linksObj->getVar('target')); |
||||||
| 255 | $formtarget->addOption('_self', _AM_MYMENUS_MENU_TARG_SELF); |
||||||
| 256 | $formtarget->addOption('_blank', _AM_MYMENUS_MENU_TARG_BLANK); |
||||||
| 257 | $formtarget->addOption('_parent', _AM_MYMENUS_MENU_TARG_PARENT); |
||||||
| 258 | $formtarget->addOption('_top', _AM_MYMENUS_MENU_TARG_TOP); |
||||||
| 259 | $form->addElement($formtarget); |
||||||
| 260 | // links: groups |
||||||
| 261 | $formgroups = new \XoopsFormSelectGroup(_AM_MYMENUS_MENU_GROUPS, 'groups', true, $linksObj->getVar('groups'), 5, true); |
||||||
|
0 ignored issues
–
show
The type
XoopsFormSelectGroup 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...
|
|||||||
| 262 | $formgroups->setDescription(_AM_MYMENUS_MENU_GROUPS_HELP); |
||||||
| 263 | $form->addElement($formgroups); |
||||||
| 264 | // @TODO: reintroduce hooks |
||||||
| 265 | /* |
||||||
| 266 | //links: hooks |
||||||
| 267 | $formhooks = new \XoopsFormSelect(_AM_MYMENUS_MENU_ACCESS_FILTER, "hooks", $linksObj->getVar('hooks'), 5, true); |
||||||
| 268 | $plugin->triggerEvent('AccessFilter'); |
||||||
| 269 | $results = $registry->getEntry('accessFilter'); |
||||||
| 270 | if ($results) { |
||||||
| 271 | foreach ($results as $result) { |
||||||
| 272 | $formhooks->addOption($result['method'], $result['name']); |
||||||
| 273 | } |
||||||
| 274 | } |
||||||
| 275 | $form->addElement($formhooks); |
||||||
| 276 | */ |
||||||
| 277 | // links: css |
||||||
| 278 | $formcss = new \XoopsFormText(_AM_MYMENUS_MENU_CSS, 'css', 50, 255, $linksObj->getVar('css')); |
||||||
| 279 | $form->addElement($formcss); |
||||||
| 280 | // |
||||||
| 281 | $buttonTray = new \XoopsFormElementTray('', ''); |
||||||
| 282 | $buttonTray->addElement(new \XoopsFormButton('', 'submit_button', _SUBMIT, 'submit')); |
||||||
|
0 ignored issues
–
show
The type
XoopsFormButton 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...
|
|||||||
| 283 | $button = new \XoopsFormButton('', 'reset', _CANCEL, 'button'); |
||||||
|
0 ignored issues
–
show
|
|||||||
| 284 | if (null !== $id) { |
||||||
| 285 | $button->setExtra("onclick=\"document.location.href='" . $GLOBALS['mymenusAdminPage'] . "?op=list&mid={$mid}'\""); |
||||||
| 286 | } else { |
||||||
| 287 | $button->setExtra("onclick=\"document.getElementById('addform').style.display = 'none'; return false;\""); |
||||||
| 288 | } |
||||||
| 289 | $buttonTray->addElement($button); |
||||||
| 290 | $form->addElement($buttonTray); |
||||||
| 291 | |||||||
| 292 | if (null !== $id) { |
||||||
| 293 | $form->addElement(new \XoopsFormHidden('op', 'save')); |
||||||
| 294 | $form->addElement(new \XoopsFormHidden('id', $id)); |
||||||
| 295 | } else { |
||||||
| 296 | $form->addElement(new \XoopsFormHidden('op', 'add')); |
||||||
| 297 | } |
||||||
| 298 | |||||||
| 299 | return $form->render(); |
||||||
| 300 | } |
||||||
| 301 | |||||||
| 302 | /** |
||||||
| 303 | * |
||||||
| 304 | * Update the {@see MymenusLinks} weight (order) |
||||||
| 305 | * |
||||||
| 306 | * @param integer $id of links object |
||||||
| 307 | * @param integer $weight |
||||||
| 308 | */ |
||||||
| 309 | public static function moveLink($id, $weight) |
||||||
| 310 | { |
||||||
| 311 | /** @var \XoopsModules\Mymenus\Helper $helper */ |
||||||
| 312 | $helper = \XoopsModules\Mymenus\Helper::getInstance(); |
||||||
| 313 | /** @var Mymenus\LinksHandler $linksHandler */ |
||||||
| 314 | $linksHandler = $helper->getHandler('Links'); |
||||||
| 315 | // |
||||||
| 316 | $linksObj = $linksHandler->get((int)$id); |
||||||
| 317 | $linksObj->setVar('weight', (int)$weight); |
||||||
| 318 | $linksHandler->insert($linksObj); |
||||||
| 319 | $linksHandler->updateWeights($linksObj); |
||||||
| 320 | } |
||||||
| 321 | |||||||
| 322 | /** |
||||||
| 323 | * @param $id |
||||||
| 324 | * @param $visible |
||||||
| 325 | */ |
||||||
| 326 | public static function toggleLinkVisibility($id, $visible) |
||||||
|
0 ignored issues
–
show
The parameter
$visible is not used and could be removed.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
This check looks for parameters that have been defined for a function or method, but which are not used in the method body. Loading history...
|
|||||||
| 327 | { |
||||||
| 328 | /** @var \XoopsModules\Mymenus\Helper $helper */ |
||||||
| 329 | $helper = \XoopsModules\Mymenus\Helper::getInstance(); |
||||||
| 330 | /** @var \XoopsModules\Mymenus\LinksHandler $linksHandler */ |
||||||
| 331 | $linksHandler = $helper->getHandler('Links'); |
||||||
| 332 | // Disable xoops debugger in dialog window |
||||||
| 333 | xoops_load('xoopslogger'); |
||||||
|
0 ignored issues
–
show
The function
xoops_load 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...
|
|||||||
| 334 | $xoopsLogger = \XoopsLogger::getInstance(); |
||||||
| 335 | $xoopsLogger->activated = false; |
||||||
| 336 | error_reporting(0); |
||||||
| 337 | // |
||||||
| 338 | $linksObj = $linksHandler->get((int)$id); |
||||||
| 339 | $visible = (1 === $linksObj->getVar('visible')) ? 0 : 1; |
||||||
| 340 | $linksObj->setVar('visible', $visible); |
||||||
| 341 | $linksHandler->insert($linksObj); |
||||||
| 342 | echo $linksObj->getVar('visible'); |
||||||
| 343 | } |
||||||
| 344 | } |
||||||
| 345 |
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