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.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | use Xmf\Request; |
||
4 | use Xoopsmodules\instruction; |
||
5 | |||
6 | require_once __DIR__ . '/header.php'; |
||
7 | // Подключаем трей |
||
8 | include_once __DIR__ . '/class/Tree.php'; |
||
9 | |||
10 | // Объявляем объекты |
||
0 ignored issues
–
show
|
|||
11 | //$instructionHandler = xoops_getModuleHandler('instruction', 'instruction'); |
||
12 | //$categoryHandler = xoops_getModuleHandler('category', 'instruction'); |
||
13 | //$pageHandler = xoops_getModuleHandler('page', 'instruction'); |
||
14 | |||
15 | $instrid = Request::getInt('id', 0, 'GET'); |
||
16 | |||
17 | // Существует ли такая инструкция |
||
18 | $criteria = new \CriteriaCompo(); |
||
19 | $criteria->add(new \Criteria('instrid', $instrid)); |
||
20 | $criteria->add(new \Criteria('status ', '0', '>')); |
||
21 | if (0 == $instructionHandler->getCount($criteria)) { |
||
22 | redirect_header('index.php', 3, _MD_INSTRUCTION_INSTRNOTEXIST); |
||
23 | exit(); |
||
24 | } |
||
25 | // |
||
26 | unset($criteria); |
||
27 | |||
28 | // Находим данные об инструкции |
||
29 | $objInsinstr = $instructionHandler->get($instrid); |
||
30 | |||
31 | // Задание тайтла |
||
32 | $xoopsOption['xoops_pagetitle'] = $GLOBALS['xoopsModule']->name() . ' - ' . $objInsinstr->getVar('title'); |
||
33 | // Шаблон |
||
34 | $GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_instr.tpl'; |
||
35 | // Заголовок |
||
36 | include_once $GLOBALS['xoops']->path('header.php'); |
||
37 | // Стили |
||
38 | $xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $moduleDirName . '/assets/css/style.css'); |
||
39 | // Скрипты |
||
40 | $xoTheme->addScript(XOOPS_URL . '/modules/' . $moduleDirName . '/assets/js/tree.js'); |
||
41 | |||
42 | // Права на просмотр инструкции |
||
43 | $categories = Xoopsmodules\instruction\Utility::getItemIds(); |
||
44 | View Code Duplication | if (!in_array($objInsinstr->getVar('cid'), $categories)) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
45 | redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/', 3, _NOPERM); |
||
46 | exit(); |
||
47 | } |
||
48 | |||
49 | // Массив данных об инструкции |
||
50 | $instrs = []; |
||
51 | // ID инструкции |
||
52 | $instrs['instrid'] = $objInsinstr->getVar('instrid'); |
||
53 | // Название страницы |
||
54 | $instrs['title'] = $objInsinstr->getVar('title'); |
||
55 | // Описание |
||
56 | $instrs['description'] = $objInsinstr->getVar('description'); |
||
57 | // Если админ, рисуем админлинк |
||
58 | if (($GLOBALS['xoopsUser'] instanceof \XoopsUser) && $GLOBALS['xoopsUser']->isAdmin($GLOBALS['xoopsModule']->mid())) { |
||
0 ignored issues
–
show
The class
XoopsUser does not exist. Did you forget a USE statement, or did you not list all dependencies?
This error could be the result of: 1. Missing dependenciesPHP Analyzer uses your Are you sure this class is defined by one of your dependencies, or did you maybe
not list a dependency in either the 2. Missing use statementPHP does not complain about undefined classes in if ($x instanceof DoesNotExist) {
// Do something.
}
If you have not tested against this specific condition, such errors might go unnoticed. ![]() |
|||
59 | $instrs['adminlink'] = ' <a href="' |
||
60 | . XOOPS_URL |
||
61 | . '/modules/' |
||
62 | . $moduleDirName |
||
63 | . '/admin/instr.php?op=editinstr&instrid=' |
||
64 | . $instrid |
||
65 | . '"><img style="width:16px;" src="'. $pathIcon16 . '/edit.png" alt=' |
||
66 | . _EDIT |
||
67 | . ' title=' |
||
68 | . _EDIT |
||
69 | . '></a> <a href="' |
||
70 | . XOOPS_URL |
||
71 | . '/modules/' |
||
72 | . $moduleDirName |
||
73 | . '/admin/instr.php?op=delinstr&instrid=' |
||
74 | . $instrid |
||
75 | . '"><img style="width:16px;" src="'. $pathIcon16 . '/delete.png" alt=' |
||
76 | . _DELETE |
||
77 | . ' title=' |
||
78 | . _DELETE |
||
79 | . '></a> '; |
||
80 | } else { |
||
81 | $instrs['adminlink'] = ''; |
||
82 | } |
||
83 | |||
84 | // Выводим в шаблон |
||
85 | $GLOBALS['xoopsTpl']->assign('insInstr', $instrs); |
||
86 | |||
87 | // Мета теги |
||
88 | $xoTheme->addMeta('meta', 'keywords', $objInsinstr->getVar('metakeywords')); |
||
89 | $xoTheme->addMeta('meta', 'description', $objInsinstr->getVar('metadescription')); |
||
90 | |||
91 | // Находим данные об категории |
||
92 | $objInscat = $categoryHandler->get($objInsinstr->getVar('cid')); |
||
93 | |||
94 | // Навигация |
||
95 | $criteria = new \CriteriaCompo(); |
||
96 | $criteria->setSort('weight ASC, title'); |
||
97 | $criteria->setOrder('ASC'); |
||
98 | $inscat_arr = $categoryHandler->getall($criteria); |
||
99 | $mytree = new \XoopsObjectTree($inscat_arr, 'cid', 'pid'); |
||
100 | $nav_parent_id = $mytree->getAllParent($objInsinstr->getVar('cid')); |
||
101 | $titre_page = $nav_parent_id; |
||
102 | $nav_parent_id = array_reverse($nav_parent_id); |
||
103 | $navigation = '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/">' . $GLOBALS['xoopsModule']->name() . '</a> : '; |
||
104 | View Code Duplication | foreach (array_keys($nav_parent_id) as $i) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
105 | $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $nav_parent_id[$i]->getVar('cid') . '">' . $nav_parent_id[$i]->getVar('title') . '</a> : '; |
||
106 | } |
||
107 | $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $objInscat->getVar('cid') . '">' . $objInscat->getVar('title') . '</a> : '; |
||
108 | $navigation .= $objInsinstr->getVar('title'); |
||
109 | $xoopsTpl->assign('insNav', $navigation); |
||
110 | // |
||
111 | unset($criteria); |
||
112 | |||
113 | // Список страниц в данной инструкции |
||
114 | $criteria = new \CriteriaCompo(); |
||
115 | $criteria->add(new \Criteria('instrid', $instrid, '=')); |
||
116 | $criteria->add(new \Criteria('status ', '0', '>')); |
||
117 | $criteria->setSort('weight'); |
||
118 | $criteria->setOrder('ASC'); |
||
119 | $ins_page = $pageHandler->getall($criteria); |
||
120 | unset($criteria); |
||
121 | // Инициализируем |
||
122 | $instree = new Xoopsmodules\instruction\Tree($ins_page, 'pageid', 'pid'); |
||
123 | // Выводим список страниц в шаблон |
||
124 | $GLOBALS['xoopsTpl']->assign('insListPage', $instree->makePagesUser()); |
||
125 | |||
126 | // Языковые константы |
||
127 | $xoopsTpl->assign('lang_listpages', _MD_INSTRUCTION_LISTPAGES); |
||
128 | $xoopsTpl->assign('lang_menu', _MD_INSTRUCTION_MENU); |
||
129 | |||
130 | // Теги |
||
131 | if (xoops_getModuleOption('usetag', 'instruction')) { |
||
132 | include_once $GLOBALS['xoops']->path('modules/tag/include/tagbar.php'); |
||
133 | $xoopsTpl->assign('tags', true); |
||
134 | $xoopsTpl->assign('tagbar', tagBar($instrid, 0)); |
||
135 | } else { |
||
136 | $xoopsTpl->assign('tags', false); |
||
137 | } |
||
138 | |||
139 | // Рейтинг |
||
140 | View Code Duplication | if (xoops_getModuleOption('userat', 'instruction')) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
141 | $xoopsTpl->assign('insUserat', true); |
||
142 | } else { |
||
143 | $xoopsTpl->assign('insUserat', false); |
||
144 | } |
||
145 | |||
146 | // Подвал |
||
147 | include_once $GLOBALS['xoops']->path('footer.php'); |
||
148 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.