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.

class/Page.php (5 issues)

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 namespace Xoopsmodules\instruction;
2
3
//if (!defined("XOOPS_ROOT_PATH")) {
0 ignored issues
show
Unused Code Comprehensibility introduced by
70% of this comment could be valid code. Did you maybe forget this after debugging?

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.

Loading history...
4
//	die("XOOPS root path not defined");
5
//}
6
7
include_once $GLOBALS['xoops']->path('include/common.php');
8
9
/**
10
 * Class Page
11
 * @package Xoopsmodules\instruction
12
 */
13
class Page extends \XoopsObject
14
{
15
    // constructor
16
    public function __construct()
17
    {
18
        //	$this->XoopsObject();
0 ignored issues
show
Unused Code Comprehensibility introduced by
72% of this comment could be valid code. Did you maybe forget this after debugging?

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.

Loading history...
19
        $this->initVar('pageid', XOBJ_DTYPE_INT, null, false, 11);
20
        $this->initVar('pid', XOBJ_DTYPE_INT, 0, false, 11);
21
        $this->initVar('instrid', XOBJ_DTYPE_INT, 0, false, 11);
22
        $this->initVar('uid', XOBJ_DTYPE_INT, 0, false, 11);
23
        $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false, 255);
24
        $this->initVar('status', XOBJ_DTYPE_INT, 1, false, 1);
25
        $this->initVar('type', XOBJ_DTYPE_INT, 1, false, 1);
26
        $this->initVar('hometext', XOBJ_DTYPE_TXTAREA, null, false);
27
        $this->initVar('footnote', XOBJ_DTYPE_TXTAREA, '', false);
28
        $this->initVar('weight', XOBJ_DTYPE_INT, 0, false, 11);
29
        $this->initVar('keywords', XOBJ_DTYPE_TXTBOX, '', false, 255);
30
        $this->initVar('description', XOBJ_DTYPE_TXTBOX, '', false, 255);
31
        $this->initVar('comments', XOBJ_DTYPE_INT, 0, false, 11);
32
        $this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10);
33
        $this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10);
34
        $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false, 1);
35
        $this->initVar('dosmiley', XOBJ_DTYPE_INT, 0, false, 1);
36
        $this->initVar('doxcode', XOBJ_DTYPE_INT, 1, false, 1);
37
        $this->initVar('dobr', XOBJ_DTYPE_INT, 0, false, 1);
38
    }
39
40
    /**
41
     * @return mixed
42
     */
43
    public function getNewInstertId()
44
    {
45
        $newEnreg = $GLOBALS['xoopsDB']->getInsertId();
46
        return $newEnreg;
47
    }
48
49
    // Получаем форму
50
51
    /**
52
     * @param bool|null|string $action
53
     * @param int              $instrid
54
     * @return \XoopsThemeForm
55
     */
56
    public function getForm($action = false, $instrid = 0)
57
    {
58
        // Если нет $action
59
        if (false === $action) {
60
            $action = xoops_getenv('REQUEST_URI');
61
        }
62
63
        // Подключаем формы
64
        include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
65
        // Подключаем типы страниц
66
        $pagetypes = include $GLOBALS['xoops']->path('modules/instruction/include/pagetypes.inc.php');
67
68
        // Название формы
69
        $title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDPAGE) : sprintf(_AM_INSTRUCTION_FORMEDITPAGE);
70
71
        // Форма
72
        $form = new \XoopsThemeForm($title, 'instr_form_page', $action, 'post', true);
73
        // Название
74
        $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true);
75
76
        // Родительская страница
77
        //        $pageHandler = xoops_getModuleHandler('page', 'instruction');
0 ignored issues
show
Unused Code Comprehensibility introduced by
54% of this comment could be valid code. Did you maybe forget this after debugging?

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.

Loading history...
78
        $pageHandler = new PageHandler;
79
80
        $criteria = new \CriteriaCompo();
81
        // ID инструкции в которой данная страница
82
        $instrid_page = $this->isNew() ? $instrid : $this->getVar('instrid');
83
        // Находим все страницы данной инструкции
84
        $criteria->add(new \Criteria('instrid', $instrid_page, '='));
85
        // Если мы редактируем, то убрать текущую страницу из списка выбора родительской
86
        if (!$this->isNew()) {
87
            $criteria->add(new \Criteria('pageid', $this->getVar('pageid'), '<>'));
88
        }
89
        $criteria->setSort('weight');
90
        $criteria->setOrder('ASC');
91
        $inspage_arr = $pageHandler->getall($criteria);
92
        unset($criteria);
93
        // Подключаем трей
94
        include_once $GLOBALS['xoops']->path('class/tree.php');
95
        $mytree = new \XoopsObjectTree($inspage_arr, 'pageid', 'pid');
96
97
        // $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_PPAGEC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true)));
0 ignored issues
show
Unused Code Comprehensibility introduced by
69% of this comment could be valid code. Did you maybe forget this after debugging?

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.

Loading history...
98
        $helper = Helper::getInstance();
99
        $module = $helper->getModule();
100
101 View Code Duplication
        if (Utility::checkVerXoops($module, '2.5.9')) {
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.

Loading history...
102
            $mytree_select = $mytree->makeSelectElement('pid', 'title', '--', $this->getVar('pid'), true, 0, '', _AM_INSTRUCTION_PPAGEC);
103
            $form->addElement($mytree_select);
104
        } else {
105
            $form->addElement(new \XoopsFormLabel(_AM_INSTRUCTION_PPAGEC, $mytree->makeSelBox('pid', 'title', '--', $this->getVar('pid'), true)));
106
        }
107
108
        // Вес
109
        $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_WEIGHTC, 'weight', 5, 5, $this->getVar('weight')), true);
110
        // Основной текст
111
        $form->addElement(Utility::getWysiwygForm(_AM_INSTRUCTION_HOMETEXTC, 'hometext', $this->getVar('hometext', 'e')), true);
112
        // Сноска
113
        $form_footnote = new \XoopsFormTextArea(_AM_INSTRUCTION_FOOTNOTEC, 'footnote', $this->getVar('footnote', 'e'));
114
        $form_footnote->setDescription(_AM_INSTRUCTION_FOOTNOTE_DSC);
115
        $form->addElement($form_footnote, false);
116
        unset($form_footnote);
117
        // Статус
118
        $form->addElement(new \XoopsFormRadioYN(_AM_INSTRUCTION_ACTIVEC, 'status', $this->getVar('status')), false);
119
        // Тип страницы
120
        $form_type = new \XoopsFormSelect(_AM_INSTR_PAGETYPEC, 'type', $this->getVar('type'));
121
        $form_type->setDescription(_AM_INSTR_PAGETYPEC_DESC);
122
        $form_type->addOptionArray($pagetypes);
123
        $form->addElement($form_type, false);
124
        // Мета-теги ключевых слов
125
        $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'keywords', 50, 255, $this->getVar('keywords')), false);
126
        // Мета-теги описания
127
        $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'description', 50, 255, $this->getVar('description')), false);
128
129
        // Настройки
130
        $option_tray = new \XoopsFormElementTray(_OPTIONS, '<br>');
131
        // HTML
132
        $html_checkbox = new \XoopsFormCheckBox('', 'dohtml', $this->getVar('dohtml'));
133
        $html_checkbox->addOption(1, _AM_INSTR_DOHTML);
134
        $option_tray->addElement($html_checkbox);
135
        // Смайлы
136
        $smiley_checkbox = new \XoopsFormCheckBox('', 'dosmiley', $this->getVar('dosmiley'));
137
        $smiley_checkbox->addOption(1, _AM_INSTR_DOSMILEY);
138
        $option_tray->addElement($smiley_checkbox);
139
        // ББ коды
140
        $xcode_checkbox = new \XoopsFormCheckBox('', 'doxcode', $this->getVar('doxcode'));
141
        $xcode_checkbox->addOption(1, _AM_INSTR_DOXCODE);
142
        $option_tray->addElement($xcode_checkbox);
143
        //
144
        $br_checkbox = new \XoopsFormCheckBox('', 'dobr', $this->getVar('dobr'));
145
        $br_checkbox->addOption(1, _AM_INSTR_DOAUTOWRAP);
146
        $option_tray->addElement($br_checkbox);
147
        //
148
        $form->addElement($option_tray);
149
150
        // Если мы редактируем страницу
151
        if (!$this->isNew()) {
152
            $form->addElement(new \XoopsFormHidden('pageid', $this->getVar('pageid')));
153
        } else {
154
            $form->addElement(new \XoopsFormHidden('pageid', 0));
155
        }
156
        // ID инструкции
157
        if ($instrid) {
158
            $form->addElement(new \XoopsFormHidden('instrid', $instrid));
159
        } else {
160
            $form->addElement(new \XoopsFormHidden('instrid', 0));
161
        }
162
        //
163
        $form->addElement(new \XoopsFormHidden('op', 'savepage'));
164
        // Кнопка
165
        $button_tray = new \XoopsFormElementTray('', '');
166
        $button_tray->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
167
        $save_btn = new \XoopsFormButton('', 'cancel', _AM_INSTR_SAVEFORM);
168
        $save_btn->setExtra('onclick="instrSavePage();"');
169
        $button_tray->addElement($save_btn);
170
        $form->addElement($button_tray);
171
172
        return $form;
173
    }
174
175
    //
176
177
    /**
178
     * @return mixed
179
     */
180
    public function getInstrid()
181
    {
182
        // Возвращаем ID инструкции
183
        return $this->getVar('instrid');
184
    }
185
}
186