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 | // |
||
7 | include __DIR__ . '/admin_header.php'; |
||
8 | // Функции модуля |
||
9 | //include __DIR__ . '/../class/utility.php'; |
||
10 | // Отключаем дебугер |
||
11 | $GLOBALS['xoopsLogger']->activated = false; |
||
12 | |||
13 | // Объявляем объекты |
||
14 | //$instructionHandler = xoops_getModuleHandler('instruction', 'instruction'); |
||
15 | //$categoryHandler = xoops_getModuleHandler('category', 'instruction'); |
||
16 | //$pageHandler = xoops_getModuleHandler('page', 'instruction'); |
||
17 | |||
18 | $uid = ($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->getVar('uid') : 0; |
||
0 ignored issues
–
show
|
|||
19 | $time = time(); |
||
20 | |||
21 | // Опция |
||
22 | $op = Request::getString('op', 'main', 'POST'); |
||
23 | |||
24 | // Выбор |
||
25 | switch ($op) { |
||
26 | // Сохранение страницы |
||
27 | case 'savepage': |
||
28 | // Выходной массив |
||
29 | $ret = []; |
||
30 | |||
31 | // Ошибки |
||
32 | $err = false; |
||
33 | $message_err = ''; |
||
34 | |||
35 | // |
||
36 | $title = Request::getString('title', '', 'POST'); |
||
37 | $pid = Request::getInt('pid', 0, 'POST'); |
||
38 | $weight = Request::getInt('weight', 0, 'POST'); |
||
39 | $hometext = Request::getString('hometext', '', 'POST'); |
||
40 | $footnote = Request::getString('footnote', '', 'POST'); |
||
41 | $status = Request::getInt('status', 0, 'POST'); |
||
42 | $type = Request::getInt('type', 0, 'POST'); |
||
43 | $keywords = Request::getString('keywords', '', 'POST'); |
||
44 | $description = Request::getString('description', '', 'POST'); |
||
45 | $dosmiley = (Request::getInt('dosmiley', 0, 'POST') > 0) ? 1 : 0; |
||
46 | $doxcode = (Request::getInt('doxcode', 0, 'POST') > 0) ? 1 : 0; |
||
47 | $dobr = (Request::getInt('dobr', 0, 'POST') > 0) ? 1 : 0; |
||
48 | $dohtml = (Request::getInt('dohtml', 0, 'POST') > 0) ? 1 : 0; |
||
49 | //$dohtml = Request::getInt( 'dohtml', 0, 'POST' ); |
||
50 | //$dosmiley = Request::getInt( 'dosmiley', 0, 'POST' ); |
||
51 | //$doxcode = Request::getInt( 'doxcode', 0, 'POST' ); |
||
52 | //$dobr = Request::getInt( 'dobr', 0, 'POST' ); |
||
53 | $pageid = Request::getInt('pageid', 0, 'POST'); |
||
54 | $instrid = Request::getInt('instrid', 0, 'POST'); |
||
55 | |||
56 | // Проверка |
||
57 | View Code Duplication | if (!$GLOBALS['xoopsSecurity']->check()) { |
|
58 | $err = true; |
||
59 | $err_txt = implode(', ', $GLOBALS['xoopsSecurity']->getErrors()); |
||
60 | $message_err .= $err_txt . '<br>' . _AM_INSTR_TRY_AGAIN . '<br>'; |
||
61 | } |
||
62 | // ========================= |
||
63 | // Устанавливаем новый token |
||
64 | $token_name = 'XOOPS_TOKEN'; |
||
65 | $token_timeout = 0; |
||
66 | // $token_name . '_REQUEST' - название элемента формы |
||
67 | $ret['toket'] = $GLOBALS['xoopsSecurity']->createToken($token_timeout, $token_name); |
||
68 | // ========================= |
||
69 | |||
70 | // Если мы редактируем |
||
71 | View Code Duplication | if ($pageid) { |
|
72 | $objInspage = $pageHandler->get($pageid); |
||
73 | } elseif ($instrid) { |
||
74 | $objInspage = $pageHandler->create(); |
||
75 | // Если мы создаём страницу необходимо указать к какой инструкции |
||
76 | $objInspage->setVar('instrid', $instrid); |
||
77 | // Указываем дату создания |
||
78 | $objInspage->setVar('datecreated', $time); |
||
79 | // Указываем пользователя |
||
80 | $objInspage->setVar('uid', $uid); |
||
81 | } else { |
||
82 | // Устанавливаем сообщение |
||
83 | $ret['message'] = _AM_INSTRUCTION_BADREQUEST; |
||
84 | // Возвращаем ответ скрипту через JSON |
||
85 | echo json_encode($ret); |
||
86 | // Прерываем выполнение |
||
87 | exit(); |
||
88 | } |
||
89 | |||
90 | // Родительская страница |
||
91 | $objInspage->setVar('pid', $pid); |
||
92 | // Дата обновления |
||
93 | $objInspage->setVar('dateupdated', $time); |
||
94 | // Название |
||
95 | $objInspage->setVar('title', $title); |
||
96 | // Вес |
||
97 | $objInspage->setVar('weight', $weight); |
||
98 | // Текст |
||
99 | $objInspage->setVar('hometext', $hometext); |
||
100 | // Сноска |
||
101 | $objInspage->setVar('footnote', $footnote); |
||
102 | // Статус |
||
103 | $objInspage->setVar('status', $status); |
||
104 | // Тип |
||
105 | $objInspage->setVar('type', $type); |
||
106 | // Мета-теги ключевых слов |
||
107 | $objInspage->setVar('keywords', $keywords); |
||
108 | // Мета-теги описания |
||
109 | $objInspage->setVar('description', $description); |
||
110 | // |
||
111 | $objInspage->setVar('dohtml', $dohtml); |
||
112 | $objInspage->setVar('dosmiley', $dosmiley); |
||
113 | $objInspage->setVar('doxcode', $doxcode); |
||
114 | $objInspage->setVar('dobr', $dobr); |
||
115 | |||
116 | // Проверка категорий |
||
117 | View Code Duplication | if (!$pageid && !$instrid) { |
|
118 | $err = true; |
||
119 | $message_err .= _AM_INSTRUCTION_ERR_INSTR . '<br>'; |
||
120 | } |
||
121 | // Проверка веса |
||
122 | if (0 == $weight) { |
||
123 | $err = true; |
||
124 | $message_err .= _AM_INSTRUCTION_ERR_WEIGHT . '<br>'; |
||
125 | } |
||
126 | // Проверка родительской страницы |
||
127 | View Code Duplication | if ($pageid && ($pageid == $pid)) { |
|
128 | $err = true; |
||
129 | $message_err .= _AM_INSTRUCTION_ERR_PPAGE . '<br>'; |
||
130 | } |
||
131 | // Проверка названия |
||
132 | if (!$title) { |
||
133 | $err = true; |
||
134 | $message_err .= _AM_INSTR_ERR_TITLE . '<br>'; |
||
135 | } |
||
136 | // Проверка основного текста |
||
137 | if (!$hometext) { |
||
138 | $err = true; |
||
139 | $message_err .= _AM_INSTR_ERR_HOMETEXT . '<br>'; |
||
140 | } |
||
141 | |||
142 | // Если были ошибки |
||
143 | if (true === $err) { |
||
144 | // |
||
145 | $message_err = '<div class="errorMsg" style="text-align: left;">' . $message_err . '</div>'; |
||
146 | // Устанавливаем сообщение |
||
147 | $ret['message'] = $message_err; |
||
148 | // Возвращаем ответ скрипту через JSON |
||
149 | echo json_encode($ret); |
||
150 | // Прерываем выполнение |
||
151 | exit(); |
||
152 | // Если небыло ошибок |
||
153 | } else { |
||
154 | // Вставляем данные в БД |
||
155 | if ($pageHandler->insert($objInspage)) { |
||
156 | // Находим ID созданной записи |
||
157 | $pageid_new = $pageid ?: $objInspage->getNewInstertId(); |
||
158 | // |
||
159 | $ret['pageid'] = $pageid_new; |
||
160 | // Получаем ID инструкции |
||
161 | $instrid = $objInspage->getInstrid(); |
||
162 | // Обновляем в инструкции число страниц и дату |
||
163 | $instructionHandler->updatePages($instrid); |
||
164 | // Если мы редактируем |
||
165 | if ($pageid) { |
||
166 | // Устанавливаем сообщение |
||
167 | $ret['message'] = '<div class="successMsg" style="text-align: left;">' . _AM_INSTRUCTION_PAGEMODIFY . '</div>'; |
||
168 | // Возвращаем ответ скрипту через JSON |
||
169 | echo json_encode($ret); |
||
170 | // Прерываем выполнение |
||
171 | exit(); |
||
172 | |||
173 | // Если мы добавляем |
||
174 | } else { |
||
175 | // Инкримент комментов |
||
176 | $pageHandler->updateposts($uid, $status, 'add'); |
||
177 | |||
178 | // Устанавливаем сообщение |
||
179 | $ret['message'] = '<div class="successMsg" style="text-align: left;">' . _AM_INSTRUCTION_PAGEADDED . '</div>'; |
||
180 | // Возвращаем ответ скрипту через JSON |
||
181 | echo json_encode($ret); |
||
182 | // Прерываем выполнение |
||
183 | exit(); |
||
184 | } |
||
185 | // Если не получилось вставить данные |
||
186 | } else { |
||
187 | |||
188 | // |
||
189 | $message_err = '<div class="errorMsg" style="text-align: left;">' . $objInspage->getHtmlErrors() . '</div>'; |
||
190 | // Устанавливаем сообщение |
||
191 | $ret['message'] = $message_err; |
||
192 | // Возвращаем ответ скрипту через JSON |
||
193 | echo json_encode($ret); |
||
194 | // Прерываем выполнение |
||
195 | exit(); |
||
196 | } |
||
197 | } |
||
198 | |||
199 | break; |
||
200 | } |
||
201 |
This error could be the result of:
1. Missing dependencies
PHP Analyzer uses your
composer.json
file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects thecomposer.json
to be in the root folder of your repository.Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the
require
orrequire-dev
section?2. Missing use statement
PHP does not complain about undefined classes in
ìnstanceof
checks. For example, the following PHP code will work perfectly fine:If you have not tested against this specific condition, such errors might go unnoticed.