Issues (175)

Security Analysis    no request data  

This project does not seem to handle request data directly as such no vulnerable execution paths were found.

  Cross-Site Scripting
Cross-Site Scripting enables an attacker to inject code into the response of a web-request that is viewed by other users. It can for example be used to bypass access controls, or even to take over other users' accounts.
  File Exposure
File Exposure allows an attacker to gain access to local files that he should not be able to access. These files can for example include database credentials, or other configuration files.
  File Manipulation
File Manipulation enables an attacker to write custom data to files. This potentially leads to injection of arbitrary code on the server.
  Object Injection
Object Injection enables an attacker to inject an object into PHP code, and can lead to arbitrary code execution, file exposure, or file manipulation attacks.
  Code Injection
Code Injection enables an attacker to execute arbitrary code on the server.
  Response Splitting
Response Splitting can be used to send arbitrary responses.
  File Inclusion
File Inclusion enables an attacker to inject custom files into PHP's file loading mechanism, either explicitly passed to include, or for example via PHP's auto-loading mechanism.
  Command Injection
Command Injection enables an attacker to inject a shell command that is execute with the privileges of the web-server. This can be used to expose sensitive data, or gain access of your server.
  SQL Injection
SQL Injection enables an attacker to execute arbitrary SQL code on your database server gaining access to user data, or manipulating user data.
  XPath Injection
XPath Injection enables an attacker to modify the parts of XML document that are read. If that XML document is for example used for authentication, this can lead to further vulnerabilities similar to SQL Injection.
  LDAP Injection
LDAP Injection enables an attacker to inject LDAP statements potentially granting permission to run unauthorized queries, or modify content inside the LDAP tree.
  Header Injection
  Other Vulnerability
This category comprises other attack vectors such as manipulating the PHP runtime, loading custom extensions, freezing the runtime, or similar.
  Regex Injection
Regex Injection enables an attacker to execute arbitrary code in your PHP process.
  XML Injection
XML Injection enables an attacker to read files on your local filesystem including configuration files, or can be abused to freeze your web-server process.
  Variable Injection
Variable Injection enables an attacker to overwrite program variables with custom data, and can lead to further vulnerabilities.
Unfortunately, the security analysis is currently not available for your project. If you are a non-commercial open-source project, please contact support to gain access.

Upgrade to new PHP Analysis Engine

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
$groups       = ($GLOBALS['xoopsUser'] instanceof \XoopsUser) ? $GLOBALS['xoopsUser']->getGroups() : XOOPS_GROUP_ANONYMOUS;
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 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 the composer.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 or require-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 ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
11
$gpermHandler = xoops_getHandler('groupperm');
12
13
// Права на просмотр страницы
14
// ==========================
15
16
// Объявляем объекты
17
//$instructionHandler = xoops_getModuleHandler('instruction', 'instruction');
18
//$categoryHandler   = xoops_getModuleHandler('category', 'instruction');
19
//$pageHandler  = xoops_getModuleHandler('page', 'instruction');
20
21
// Получаем данные
22
// ID страницы
23
$pageid = Request::getInt('id', 0, 'GET');
24
// Без кэша
25
$nocache = Request::getInt('nocache', 0, 'GET');
26
27
// Существует ли такая страница
28
$criteria = new \CriteriaCompo();
29
$criteria->add(new \Criteria('pageid ', $pageid));
30
$criteria->add(new \Criteria('status ', '0', '>'));
31
if (0 == $pageHandler->getCount($criteria)) {
32
    redirect_header('index.php', 3, _MD_INSTRUCTION_PAGENOTEXIST);
33
    exit();
34
}
35
//
36
unset($criteria);
37
38
// Находим данные о странице
39
$objInspage = $pageHandler->get($pageid);
40
// Находим данные об инструкции
41
$objInsinstr = $instructionHandler->get($objInspage->getVar('instrid'));
42
43
// Если админ и ссылка на отключение кэша
44
if (($GLOBALS['xoopsUser'] instanceof \XoopsUser) && $GLOBALS['xoopsUser']->isAdmin() && $nocache) {
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 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 the composer.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 or require-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 ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
45
    // Отключаем кэш
46
    $GLOBALS['xoopsConfig']['module_cache'][$GLOBALS['xoopsModule']->getVar('mid')] = 0;
47
}
48
49
// Задание тайтла
50
$xoopsOption['xoops_pagetitle'] = $GLOBALS['xoopsModule']->name() . ' - ' . $objInsinstr->getVar('title') . ' - ' . $objInspage->getVar('title');
51
// Шаблон
52
$GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_page.tpl';
53
// Заголовок
54
include_once $GLOBALS['xoops']->path('header.php');
55
// Стили
56
$xoTheme->addStylesheet(XOOPS_URL . '/modules/' . $moduleDirName . '/assets/css/style.css');
57
// Скрипты
58
$xoTheme->addScript(XOOPS_URL . '/modules/' . $moduleDirName . '/assets/js/tree.js');
59
60
// Права на просмотр инструкции
61
$categories = Xoopsmodules\instruction\Utility::getItemIds();
62 View Code Duplication
if (!in_array($objInsinstr->getVar('cid'), $categories)) {
63
    redirect_header(XOOPS_URL . '/modules/' . $moduleDirName . '/', 3, _NOPERM);
64
    exit();
65
}
66
67
// Массив данных о странице
68
$pages = [];
69
// Название страницы
70
$pages['title'] = $objInspage->getVar('title');
71
// ID страницы
72
$pages['pageid'] = $objInspage->getVar('pageid');
73
// ID инструкции
74
$pages['instrid'] = $objInspage->getVar('instrid');
75
// Основной текст
76
$pages['hometext'] = $objInspage->getVar('hometext');
77
// Сноска - массив строк
78
$footnote = $objInspage->getVar('footnote');
79
// Если есть сноски
80
if ($footnote) {
81
    $pages['footnotes'] = explode('|', $objInspage->getVar('footnote'));
82
} else {
83
    $pages['footnotes'] = false;
84
}
85
// Мета-теги ключевых слов
86
$pages['keywords'] = $objInspage->getVar('keywords');
87
// Мета-теги описания
88
$pages['description'] = $objInspage->getVar('description');
89
//
90
// Если админ, рисуем админлинк
91
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 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 the composer.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 or require-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 ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
92
    $pages['adminlink'] = '&nbsp;<a href="'
93
                          . XOOPS_URL
94
                          . '/modules/'
95
                          . $moduleDirName
96
                          . '/admin/instr.php?op=editpage&pageid='
97
                          . $pages['pageid']
98
                          . '"><img style="width:16px;" src="'. $pathIcon16 . '/edit.png" alt='
99
                          . _EDIT
100
                          . ' title='
101
                          . _EDIT
102
                          . '></a>&nbsp;<a href="'
103
                          . XOOPS_URL
104
                          . '/modules/'
105
                          . $moduleDirName
106
                          . '/admin/instr.php?op=delpage&pageid='
107
                          . $pages['pageid']
108
                          . '"><img style="width:16px;" src="'. $pathIcon16 . '/delete.png" alt='
109
                          . _DELETE
110
                          . ' title='
111
                          . _DELETE
112
                          . '></a>&nbsp;';
113
} else {
114
    $pages['adminlink'] = '&nbsp;';
115
    // Если можно редактировать
116
    if ($gpermHandler->checkRight($moduleDirName . '_edit', $objInsinstr->getVar('cid'), $groups, $GLOBALS['xoopsModule']->getVar('mid'))) {
117
        $pages['adminlink'] .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/submit.php?op=editpage&pageid=' . $pages['pageid'] . '"><img style="width:16px;" src="'. $pathIcon16 . '/edit.png" alt=' . _EDIT . ' title=' . _EDIT . '></a>';
118
    }
119
120
    $pages['adminlink'] .= '&nbsp;';
121
    // Если нет админлика
122
    if ('[&nbsp;&nbsp;]' === $pages['adminlink']) {
123
        $pages['adminlink'] = '';
124
    }
125
}
126
// Выводим в шаблон
127
$GLOBALS['xoopsTpl']->assign('insPage', $pages);
128
129
// Находим данные об категории
130
$objInscat = $categoryHandler->get($objInsinstr->getVar('cid'));
131
132
// Навигация
133
$criteria = new \CriteriaCompo();
134
$criteria->setSort('weight ASC, title');
135
$criteria->setOrder('ASC');
136
$inscat_arr    = $categoryHandler->getall($criteria);
137
$mytree        = new \XoopsObjectTree($inscat_arr, 'cid', 'pid');
138
$nav_parent_id = $mytree->getAllParent($objInsinstr->getVar('cid'));
139
$titre_page    = $nav_parent_id;
140
$nav_parent_id = array_reverse($nav_parent_id);
141
$navigation    = '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/">' . $GLOBALS['xoopsModule']->name() . '</a>&nbsp;:&nbsp;';
142 View Code Duplication
foreach (array_keys($nav_parent_id) as $i) {
143
    $navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $nav_parent_id[$i]->getVar('cid') . '">' . $nav_parent_id[$i]->getVar('title') . '</a>&nbsp;:&nbsp;';
144
}
145
$navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/index.php?cid=' . $objInscat->getVar('cid') . '">' . $objInscat->getVar('title') . '</a>&nbsp;:&nbsp;';
146
$navigation .= '<a href="' . XOOPS_URL . '/modules/' . $moduleDirName . '/instr.php?id=' . $pages['instrid'] . '">' . $objInsinstr->getVar('title') . '</a>';
147
$xoopsTpl->assign('insNav', $navigation);
148
149
unset($criteria);
150
151
// Список страниц в данной справке
152
$criteria = new \CriteriaCompo();
153
$criteria->add(new \Criteria('instrid', $pages['instrid'], '='));
154
$criteria->add(new \Criteria('status ', '0', '>'));
155
$criteria->setSort('weight');
156
$criteria->setOrder('ASC');
157
$ins_page = $pageHandler->getall($criteria);
158
unset($criteria);
159
// Предыдущая и следующая страницы
160
$prevpages = [];
161
$nextpages = [];
162
// Инициализируем
163
$instree = new Xoopsmodules\instruction\Tree($ins_page, 'pageid', 'pid');
164
// Выводим список страниц в шаблон
165
$GLOBALS['xoopsTpl']->assign('insListPage', $instree->makePagesUser($pageid, $prevpages, $nextpages));
166
// Выводим в шаблон
167
$xoopsTpl->assign('insPrevpages', $prevpages);
168
$xoopsTpl->assign('insNextpages', $nextpages);
169
// Языковые константы
170
//$xoopsTpl->assign( 'lang_listpages', _MD_INSTRUCTION_LISTPAGES );
171
$xoopsTpl->assign('lang_menu', _MD_INSTRUCTION_MENU);
172
173
// Рейтинг
174 View Code Duplication
if (xoops_getModuleOption('userat', 'instruction')) {
175
    $xoopsTpl->assign('insUserat', true);
176
} else {
177
    $xoopsTpl->assign('insUserat', false);
178
}
179
180
// Мета теги
181
$xoTheme->addMeta('meta', 'keywords', $objInspage->getVar('keywords'));
182
$xoTheme->addMeta('meta', 'description', $objInspage->getVar('description'));
183
184
// Комментарии
185
include_once $GLOBALS['xoops']->path('include/comment_view.php');
186
// Подвал
187
include_once $GLOBALS['xoops']->path('footer.php');
188