Completed
Push — master ( e23147...f5725e )
by Michael
01:48
created
class/Page.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
         // Находим все страницы данной инструкции
87 87
         $criteria->add(new \Criteria('instrid', $instrid_page, '='));
88 88
         // Если мы редактируем, то убрать текущую страницу из списка выбора родительской
89
-        if (!$this->isNew()) {
89
+        if ( ! $this->isNew()) {
90 90
             $criteria->add(new \Criteria('pageid', $this->getVar('pageid'), '<>'));
91 91
         }
92 92
         $criteria->setSort('weight');
@@ -151,7 +151,7 @@  discard block
 block discarded – undo
151 151
         $form->addElement($option_tray);
152 152
 
153 153
         // Если мы редактируем страницу
154
-        if (!$this->isNew()) {
154
+        if ( ! $this->isNew()) {
155 155
             $form->addElement(new \XoopsFormHidden('pageid', $this->getVar('pageid')));
156 156
         } else {
157 157
             $form->addElement(new \XoopsFormHidden('pageid', 0));
Please login to merge, or discard this patch.
Indentation   +170 added lines, -170 removed lines patch added patch discarded remove patch
@@ -12,174 +12,174 @@
 block discarded – undo
12 12
  */
13 13
 class Page extends \XoopsObject
14 14
 {
15
-    // constructor
16
-    public function __construct()
17
-    {
18
-        //	$this->XoopsObject();
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');
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)));
98
-        $helper = Helper::getInstance();
99
-        $module = $helper->getModule();
100
-
101
-        if (Utility::checkVerXoops($module, '2.5.9')) {
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
-    }
15
+	// constructor
16
+	public function __construct()
17
+	{
18
+		//	$this->XoopsObject();
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');
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)));
98
+		$helper = Helper::getInstance();
99
+		$module = $helper->getModule();
100
+
101
+		if (Utility::checkVerXoops($module, '2.5.9')) {
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 185
 }
Please login to merge, or discard this patch.
class/CategoryHandler.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -34,9 +34,9 @@
 block discarded – undo
34 34
     public function updateDateupdated($cid = 0, $time = null)
35 35
     {
36 36
         // Если не передали время
37
-        $time = null === $time ? time() : (int)$time;
37
+        $time = null === $time ? time() : (int) $time;
38 38
         //
39
-        $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `cid` = %u', $this->table, $time, (int)$cid);
39
+        $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `cid` = %u', $this->table, $time, (int) $cid);
40 40
         //
41 41
         return $this->db->query($sql);
42 42
     }
Please login to merge, or discard this patch.
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -14,28 +14,28 @@
 block discarded – undo
14 14
  */
15 15
 class CategoryHandler extends \XoopsPersistableObjectHandler
16 16
 {
17
-    /**
18
-     * @param null|mixed $db
19
-     */
20
-    public function __construct(\XoopsDatabase $db = null)
21
-    {
22
-        parent::__construct($db, 'instruction_cat', Category::class, 'cid', 'title');
23
-    }
17
+	/**
18
+	 * @param null|mixed $db
19
+	 */
20
+	public function __construct(\XoopsDatabase $db = null)
21
+	{
22
+		parent::__construct($db, 'instruction_cat', Category::class, 'cid', 'title');
23
+	}
24 24
 
25
-    // Обновление даты обновления категории
25
+	// Обновление даты обновления категории
26 26
 
27
-    /**
28
-     * @param int      $cid
29
-     * @param null|int $time
30
-     * @return mixed
31
-     */
32
-    public function updateDateupdated($cid = 0, $time = null)
33
-    {
34
-        // Если не передали время
35
-        $time = null === $time ? time() : (int)$time;
36
-        //
37
-        $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `cid` = %u', $this->table, $time, (int)$cid);
38
-        //
39
-        return $this->db->query($sql);
40
-    }
27
+	/**
28
+	 * @param int      $cid
29
+	 * @param null|int $time
30
+	 * @return mixed
31
+	 */
32
+	public function updateDateupdated($cid = 0, $time = null)
33
+	{
34
+		// Если не передали время
35
+		$time = null === $time ? time() : (int)$time;
36
+		//
37
+		$sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `cid` = %u', $this->table, $time, (int)$cid);
38
+		//
39
+		return $this->db->query($sql);
40
+	}
41 41
 }
Please login to merge, or discard this patch.
class/Instruction.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -118,7 +118,7 @@
 block discarded – undo
118 118
         $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false);
119 119
 
120 120
         // Если мы редактируем категорию
121
-        if (!$this->isNew()) {
121
+        if ( ! $this->isNew()) {
122 122
             $form->addElement(new \XoopsFormHidden('instrid', $this->getVar('instrid')));
123 123
         }
124 124
         //
Please login to merge, or discard this patch.
Indentation   +98 added lines, -98 removed lines patch added patch discarded remove patch
@@ -12,114 +12,114 @@
 block discarded – undo
12 12
  */
13 13
 class Instruction extends \XoopsObject
14 14
 {
15
-    // constructor
16
-    public function __construct()
17
-    {
18
-        //		$this->XoopsObject();
19
-        $this->initVar('instrid', XOBJ_DTYPE_INT, null, false, 11);
20
-        $this->initVar('cid', XOBJ_DTYPE_INT, 0, false, 5);
21
-        $this->initVar('uid', XOBJ_DTYPE_INT, 0, false, 11);
22
-        $this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false);
23
-        $this->initVar('status', XOBJ_DTYPE_INT, 0, false, 1);
24
-        $this->initVar('pages', XOBJ_DTYPE_INT, 0, false, 11);
25
-        $this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false);
26
-        $this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10);
27
-        $this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10);
28
-        $this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false);
29
-        $this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false);
15
+	// constructor
16
+	public function __construct()
17
+	{
18
+		//		$this->XoopsObject();
19
+		$this->initVar('instrid', XOBJ_DTYPE_INT, null, false, 11);
20
+		$this->initVar('cid', XOBJ_DTYPE_INT, 0, false, 5);
21
+		$this->initVar('uid', XOBJ_DTYPE_INT, 0, false, 11);
22
+		$this->initVar('title', XOBJ_DTYPE_TXTBOX, '', false);
23
+		$this->initVar('status', XOBJ_DTYPE_INT, 0, false, 1);
24
+		$this->initVar('pages', XOBJ_DTYPE_INT, 0, false, 11);
25
+		$this->initVar('description', XOBJ_DTYPE_TXTAREA, null, false);
26
+		$this->initVar('datecreated', XOBJ_DTYPE_INT, 0, false, 10);
27
+		$this->initVar('dateupdated', XOBJ_DTYPE_INT, 0, false, 10);
28
+		$this->initVar('metakeywords', XOBJ_DTYPE_TXTBOX, '', false);
29
+		$this->initVar('metadescription', XOBJ_DTYPE_TXTBOX, '', false);
30 30
 
31
-        // Нет в таблице
32
-        $this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false);
33
-        $this->initVar('dobr', XOBJ_DTYPE_INT, 0, false);
34
-    }
31
+		// Нет в таблице
32
+		$this->initVar('dohtml', XOBJ_DTYPE_INT, 1, false);
33
+		$this->initVar('dobr', XOBJ_DTYPE_INT, 0, false);
34
+	}
35 35
 
36
-    /**
37
-     * @return mixed
38
-     */
39
-    public function getNewInstertId()
40
-    {
41
-        $newEnreg = $GLOBALS['xoopsDB']->getInsertId();
42
-        return $newEnreg;
43
-    }
36
+	/**
37
+	 * @return mixed
38
+	 */
39
+	public function getNewInstertId()
40
+	{
41
+		$newEnreg = $GLOBALS['xoopsDB']->getInsertId();
42
+		return $newEnreg;
43
+	}
44 44
 
45
-    // Получаем форму
45
+	// Получаем форму
46 46
 
47
-    /**
48
-     * @param bool|null|string $action
49
-     * @return \XoopsThemeForm
50
-     */
51
-    public function getForm($action = false)
52
-    {
53
-        global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
54
-        // Если нет $action
55
-        if (false === $action) {
56
-            $action = xoops_getenv('REQUEST_URI');
57
-        }
58
-        // Подключаем формы
59
-        include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
47
+	/**
48
+	 * @param bool|null|string $action
49
+	 * @return \XoopsThemeForm
50
+	 */
51
+	public function getForm($action = false)
52
+	{
53
+		global $xoopsDB, $xoopsModule, $xoopsModuleConfig;
54
+		// Если нет $action
55
+		if (false === $action) {
56
+			$action = xoops_getenv('REQUEST_URI');
57
+		}
58
+		// Подключаем формы
59
+		include_once $GLOBALS['xoops']->path('class/xoopsformloader.php');
60 60
 
61
-        // Название формы
62
-        $title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDINSTR) : sprintf(_AM_INSTRUCTION_FORMEDITINSTR);
61
+		// Название формы
62
+		$title = $this->isNew() ? sprintf(_AM_INSTRUCTION_FORMADDINSTR) : sprintf(_AM_INSTRUCTION_FORMEDITINSTR);
63 63
 
64
-        // Форма
65
-        $form = new \XoopsThemeForm($title, 'forminstr', $action, 'post', true);
66
-        //$form->setExtra('enctype="multipart/form-data"');
67
-        // Название инструкции
68
-        $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true);
69
-        // Категория
70
-        $categoryHandler = new CategoryHandler;
71
-        $criteria        = new \CriteriaCompo();
72
-        $criteria->setSort('weight ASC, title');
73
-        $criteria->setOrder('ASC');
74
-        $instructioncat_arr = $categoryHandler->getall($criteria);
75
-        unset($criteria);
76
-        // Подключаем трей
77
-        include_once $GLOBALS['xoops']->path('class/tree.php');
78
-        $mytree = new \XoopsObjectTree($instructioncat_arr, 'cid', 'pid');
64
+		// Форма
65
+		$form = new \XoopsThemeForm($title, 'forminstr', $action, 'post', true);
66
+		//$form->setExtra('enctype="multipart/form-data"');
67
+		// Название инструкции
68
+		$form->addElement(new \XoopsFormText(_AM_INSTRUCTION_TITLEC, 'title', 50, 255, $this->getVar('title')), true);
69
+		// Категория
70
+		$categoryHandler = new CategoryHandler;
71
+		$criteria        = new \CriteriaCompo();
72
+		$criteria->setSort('weight ASC, title');
73
+		$criteria->setOrder('ASC');
74
+		$instructioncat_arr = $categoryHandler->getall($criteria);
75
+		unset($criteria);
76
+		// Подключаем трей
77
+		include_once $GLOBALS['xoops']->path('class/tree.php');
78
+		$mytree = new \XoopsObjectTree($instructioncat_arr, 'cid', 'pid');
79 79
 
80
-        // $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_CATC, $mytree->makeSelBox('cid', 'title', '--', $this->getVar('cid'), true)));
81
-        $helper = Helper::getInstance();
82
-        $module = $helper->getModule();
80
+		// $form->addElement(new XoopsFormLabel(_AM_INSTRUCTION_CATC, $mytree->makeSelBox('cid', 'title', '--', $this->getVar('cid'), true)));
81
+		$helper = Helper::getInstance();
82
+		$module = $helper->getModule();
83 83
 
84
-        if (Utility::checkVerXoops($module, '2.5.9')) {
85
-            $mytree_select = $mytree->makeSelectElement('cid', 'title', '--', $this->getVar('cid'), true, 0, '', _AM_INSTRUCTION_CATC);
86
-            $form->addElement($mytree_select);
87
-        } else {
88
-            $form->addElement(new \XoopsFormLabel(_AM_INSTRUCTION_CATC, $mytree->makeSelBox('cid', 'title', '--', $this->getVar('cid'), true)));
89
-        }
84
+		if (Utility::checkVerXoops($module, '2.5.9')) {
85
+			$mytree_select = $mytree->makeSelectElement('cid', 'title', '--', $this->getVar('cid'), true, 0, '', _AM_INSTRUCTION_CATC);
86
+			$form->addElement($mytree_select);
87
+		} else {
88
+			$form->addElement(new \XoopsFormLabel(_AM_INSTRUCTION_CATC, $mytree->makeSelBox('cid', 'title', '--', $this->getVar('cid'), true)));
89
+		}
90 90
 
91
-        // Описание
92
-        $form->addElement(Utility::getWysiwygForm(_AM_INSTRUCTION_DESCRIPTIONC, 'description', $this->getVar('description', 'e')), true);
93
-        // Статус
94
-        $form->addElement(new \XoopsFormRadioYN(_AM_INSTRUCTION_ACTIVEC, 'status', $this->getVar('status')), false);
91
+		// Описание
92
+		$form->addElement(Utility::getWysiwygForm(_AM_INSTRUCTION_DESCRIPTIONC, 'description', $this->getVar('description', 'e')), true);
93
+		// Статус
94
+		$form->addElement(new \XoopsFormRadioYN(_AM_INSTRUCTION_ACTIVEC, 'status', $this->getVar('status')), false);
95 95
 
96
-        // Теги
97
-        $dir_tag_ok = false;
98
-        if (is_dir('../../tag') || is_dir('../tag')) {
99
-            $dir_tag_ok = true;
100
-        }
101
-        // Если влючена поддержка тегов и есть модуль tag
102
-        if (xoops_getModuleOption('usetag', 'instruction') && $dir_tag_ok) {
103
-            $itemIdForTag = $this->isNew() ? 0 : $this->getVar('instrid');
104
-            // Подключаем форму тегов
105
-            include_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php');
106
-            // Добавляем элемент в форму
107
-            $form->addElement(new \XoopsFormTag('tag', 60, 255, $itemIdForTag, 0));
108
-        }
96
+		// Теги
97
+		$dir_tag_ok = false;
98
+		if (is_dir('../../tag') || is_dir('../tag')) {
99
+			$dir_tag_ok = true;
100
+		}
101
+		// Если влючена поддержка тегов и есть модуль tag
102
+		if (xoops_getModuleOption('usetag', 'instruction') && $dir_tag_ok) {
103
+			$itemIdForTag = $this->isNew() ? 0 : $this->getVar('instrid');
104
+			// Подключаем форму тегов
105
+			include_once $GLOBALS['xoops']->path('modules/tag/include/formtag.php');
106
+			// Добавляем элемент в форму
107
+			$form->addElement(new \XoopsFormTag('tag', 60, 255, $itemIdForTag, 0));
108
+		}
109 109
 
110
-        // Мета-теги ключевых слов
111
-        $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false);
112
-        // Мета-теги описания
113
-        $form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false);
110
+		// Мета-теги ключевых слов
111
+		$form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METAKEYWORDSC, 'metakeywords', 50, 255, $this->getVar('metakeywords')), false);
112
+		// Мета-теги описания
113
+		$form->addElement(new \XoopsFormText(_AM_INSTRUCTION_METADESCRIPTIONC, 'metadescription', 50, 255, $this->getVar('metadescription')), false);
114 114
 
115
-        // Если мы редактируем категорию
116
-        if (!$this->isNew()) {
117
-            $form->addElement(new \XoopsFormHidden('instrid', $this->getVar('instrid')));
118
-        }
119
-        //
120
-        $form->addElement(new \XoopsFormHidden('op', 'saveinstr'));
121
-        // Кнопка
122
-        $form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
123
-        return $form;
124
-    }
115
+		// Если мы редактируем категорию
116
+		if (!$this->isNew()) {
117
+			$form->addElement(new \XoopsFormHidden('instrid', $this->getVar('instrid')));
118
+		}
119
+		//
120
+		$form->addElement(new \XoopsFormHidden('op', 'saveinstr'));
121
+		// Кнопка
122
+		$form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit'));
123
+		return $form;
124
+	}
125 125
 }
Please login to merge, or discard this patch.
class/InstructionHandler.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -32,9 +32,9 @@
 block discarded – undo
32 32
     public function updateDateupdated($instrid = 0, $time = null)
33 33
     {
34 34
         // Если не передали время
35
-        $time = null === $time ? time() : (int)$time;
35
+        $time = null === $time ? time() : (int) $time;
36 36
         //
37
-        $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `instrid` = %u', $this->table, $time, (int)$instrid);
37
+        $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `instrid` = %u', $this->table, $time, (int) $instrid);
38 38
         //
39 39
         return $this->db->query($sql);
40 40
     }
Please login to merge, or discard this patch.
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -14,52 +14,52 @@
 block discarded – undo
14 14
  */
15 15
 class InstructionHandler extends \XoopsPersistableObjectHandler
16 16
 {
17
-    /**
18
-     * @param null|mixed $db
19
-     */
20
-    public function __construct(\XoopsDatabase $db = null)
21
-    {
22
-        parent::__construct($db, 'instruction_instr', Instruction::class, 'instrid', 'title');
23
-    }
17
+	/**
18
+	 * @param null|mixed $db
19
+	 */
20
+	public function __construct(\XoopsDatabase $db = null)
21
+	{
22
+		parent::__construct($db, 'instruction_instr', Instruction::class, 'instrid', 'title');
23
+	}
24 24
 
25
-    // Обновление даты обновления инструкций
25
+	// Обновление даты обновления инструкций
26 26
 
27
-    /**
28
-     * @param int      $instrid
29
-     * @param bool|int $time
30
-     * @return mixed
31
-     */
32
-    public function updateDateupdated($instrid = 0, $time = null)
33
-    {
34
-        // Если не передали время
35
-        $time = null === $time ? time() : (int)$time;
36
-        //
37
-        $sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `instrid` = %u', $this->table, $time, (int)$instrid);
38
-        //
39
-        return $this->db->query($sql);
40
-    }
27
+	/**
28
+	 * @param int      $instrid
29
+	 * @param bool|int $time
30
+	 * @return mixed
31
+	 */
32
+	public function updateDateupdated($instrid = 0, $time = null)
33
+	{
34
+		// Если не передали время
35
+		$time = null === $time ? time() : (int)$time;
36
+		//
37
+		$sql = sprintf('UPDATE `%s` SET `dateupdated` = %u WHERE `instrid` = %u', $this->table, $time, (int)$instrid);
38
+		//
39
+		return $this->db->query($sql);
40
+	}
41 41
 
42
-    // Обновление числа страниц
42
+	// Обновление числа страниц
43 43
 
44
-    /**
45
-     * @param int $instrid
46
-     * @return mixed
47
-     */
48
-    public function updatePages($instrid = 0)
49
-    {
50
-        //        $pageHandler = xoops_getModuleHandler('page', 'instruction');
51
-        $pageHandler = new PageHandler;
52
-        // Находим число активных страниц
53
-        $criteria = new \CriteriaCompo();
54
-        $criteria->add(new \Criteria('instrid', $instrid, '='));
55
-        $criteria->add(new \Criteria('status ', '0', '>'));
56
-        // Число страниц
57
-        $pages = $pageHandler->getCount($criteria);
58
-        unset($criteria);
44
+	/**
45
+	 * @param int $instrid
46
+	 * @return mixed
47
+	 */
48
+	public function updatePages($instrid = 0)
49
+	{
50
+		//        $pageHandler = xoops_getModuleHandler('page', 'instruction');
51
+		$pageHandler = new PageHandler;
52
+		// Находим число активных страниц
53
+		$criteria = new \CriteriaCompo();
54
+		$criteria->add(new \Criteria('instrid', $instrid, '='));
55
+		$criteria->add(new \Criteria('status ', '0', '>'));
56
+		// Число страниц
57
+		$pages = $pageHandler->getCount($criteria);
58
+		unset($criteria);
59 59
 
60
-        // Сохраняем это число
61
-        $sql = sprintf('UPDATE `%s` SET `pages` = %u, `dateupdated` = %u WHERE `instrid` = %u', $this->table, $pages, time(), $instrid);
62
-        //
63
-        return $this->db->query($sql);
64
-    }
60
+		// Сохраняем это число
61
+		$sql = sprintf('UPDATE `%s` SET `pages` = %u, `dateupdated` = %u WHERE `instrid` = %u', $this->table, $pages, time(), $instrid);
62
+		//
63
+		return $this->db->query($sql);
64
+	}
65 65
 }
Please login to merge, or discard this patch.
include/comment_functions.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -9,9 +9,9 @@  discard block
 block discarded – undo
9 9
  */
10 10
 function instruction_com_update($pageid, $total_num)
11 11
 {
12
-    $db  = XoopsDatabaseFactory::getDatabaseConnection();
13
-    $sql = 'UPDATE ' . $db->prefix('instruction_page') . ' SET comments = ' . $total_num . ' WHERE pageid  = ' . $pageid;
14
-    $db->query($sql);
12
+	$db  = XoopsDatabaseFactory::getDatabaseConnection();
13
+	$sql = 'UPDATE ' . $db->prefix('instruction_page') . ' SET comments = ' . $total_num . ' WHERE pageid  = ' . $pageid;
14
+	$db->query($sql);
15 15
 }
16 16
 
17 17
 /**
@@ -19,5 +19,5 @@  discard block
 block discarded – undo
19 19
  */
20 20
 function instruction_com_approve(&$comment)
21 21
 {
22
-    // notification mail here
22
+	// notification mail here
23 23
 }
Please login to merge, or discard this patch.
include/common.php 2 patches
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -70,8 +70,8 @@
 block discarded – undo
70 70
 $debug = false;
71 71
 
72 72
 if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) {
73
-    require_once $GLOBALS['xoops']->path('class/template.php');
74
-    $xoopsTpl = new \XoopsTpl();
73
+	require_once $GLOBALS['xoops']->path('class/template.php');
74
+	$xoopsTpl = new \XoopsTpl();
75 75
 }
76 76
 
77 77
 $moduleDirName = basename(dirname(__DIR__));
Please login to merge, or discard this patch.
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -46,11 +46,11 @@  discard block
 block discarded – undo
46 46
 //require_once INSTRUCTION_ROOT_PATH . '/class/CategoryHandler.php';
47 47
 //require_once INSTRUCTION_ROOT_PATH . '/class/PageHandler.php';
48 48
 
49
-require_once __DIR__  . '/../class/Helper.php';
50
-require_once __DIR__  . '/../class/Utility.php';
51
-require_once __DIR__  . '/../class/InstructionHandler.php';
52
-require_once __DIR__  . '/../class/CategoryHandler.php';
53
-require_once __DIR__  . '/../class/PageHandler.php';
49
+require_once __DIR__ . '/../class/Helper.php';
50
+require_once __DIR__ . '/../class/Utility.php';
51
+require_once __DIR__ . '/../class/InstructionHandler.php';
52
+require_once __DIR__ . '/../class/CategoryHandler.php';
53
+require_once __DIR__ . '/../class/PageHandler.php';
54 54
 
55 55
 //xoops_load('constants', INSTRUCTION_DIRNAME);
56 56
 //xoops_load('utility', INSTRUCTION_DIRNAME);
@@ -85,7 +85,7 @@  discard block
 block discarded – undo
85 85
 
86 86
 $debug = false;
87 87
 
88
-if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) {
88
+if ( ! isset($GLOBALS['xoopsTpl']) || ! ($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) {
89 89
     require_once $GLOBALS['xoops']->path('class/template.php');
90 90
     $xoopsTpl = new \XoopsTpl();
91 91
 }
Please login to merge, or discard this patch.
index.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -63,7 +63,7 @@
 block discarded – undo
63 63
 // Если есть категория
64 64
 if ($cid) {
65 65
     // Если нельзя просматривать эту категорию
66
-    if (!in_array($cid, $categories)) {
66
+    if ( ! in_array($cid, $categories)) {
67 67
         redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_CAT);
68 68
     }
69 69
     $criteria->add(new \Criteria('cid', $cid, '='));
Please login to merge, or discard this patch.
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -48,11 +48,11 @@  discard block
 block discarded – undo
48 48
 $module = $helper->getModule();
49 49
 
50 50
 if (Xoopsmodules\instruction\Utility::checkVerXoops($module, '2.5.9')) {
51
-    $cat_select = $mytree->makeSelectElement('cid', 'title', '--', $cid, true, 0, "onChange='javascript: document.insformselcat.submit()'", '');
52
-    $GLOBALS['xoopsTpl']->assign('insFormSelCat', $cat_select->render());
51
+	$cat_select = $mytree->makeSelectElement('cid', 'title', '--', $cid, true, 0, "onChange='javascript: document.insformselcat.submit()'", '');
52
+	$GLOBALS['xoopsTpl']->assign('insFormSelCat', $cat_select->render());
53 53
 } else {
54
-    $cat_select = $mytree->makeSelBox('cid', 'title', '--', $cid, true, 0, "onChange='javascript: document.insformselcat.submit()'");
55
-    $GLOBALS['xoopsTpl']->assign('insFormSelCat', $cat_select);
54
+	$cat_select = $mytree->makeSelBox('cid', 'title', '--', $cid, true, 0, "onChange='javascript: document.insformselcat.submit()'");
55
+	$GLOBALS['xoopsTpl']->assign('insFormSelCat', $cat_select);
56 56
 }
57 57
 
58 58
 // Находим список всех инструкций
@@ -62,14 +62,14 @@  discard block
 block discarded – undo
62 62
 $criteria->add(new \Criteria('status', '0', '>'));
63 63
 // Если есть категория
64 64
 if ($cid) {
65
-    // Если нельзя просматривать эту категорию
66
-    if (!in_array($cid, $categories)) {
67
-        redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_CAT);
68
-    }
69
-    $criteria->add(new \Criteria('cid', $cid, '='));
70
-    // Иначе находим список всех
65
+	// Если нельзя просматривать эту категорию
66
+	if (!in_array($cid, $categories)) {
67
+		redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_CAT);
68
+	}
69
+	$criteria->add(new \Criteria('cid', $cid, '='));
70
+	// Иначе находим список всех
71 71
 } else {
72
-    $criteria->add(new \Criteria('cid', '( ' . implode(', ', $categories) . ' )', 'IN'));
72
+	$criteria->add(new \Criteria('cid', '( ' . implode(', ', $categories) . ' )', 'IN'));
73 73
 }
74 74
 
75 75
 // Число инструкций, удовлетворяющих данному условию
@@ -86,10 +86,10 @@  discard block
 block discarded – undo
86 86
 $instr_arr = $instructionHandler->getall($criteria);
87 87
 // Если записей больше чем $limit, то выводим пагинатор
88 88
 if ($numrows > $limit) {
89
-    $pagenav = new \XoopsPageNav($numrows, $limit, $start, 'start', 'cid=' . $cid);
90
-    $pagenav = $pagenav->renderNav(4);
89
+	$pagenav = new \XoopsPageNav($numrows, $limit, $start, 'start', 'cid=' . $cid);
90
+	$pagenav = $pagenav->renderNav(4);
91 91
 } else {
92
-    $pagenav = '';
92
+	$pagenav = '';
93 93
 }
94 94
 // Выводим пагинатор в шаблон
95 95
 $GLOBALS['xoopsTpl']->assign('insPagenav', $pagenav);
@@ -100,54 +100,54 @@  discard block
 block discarded – undo
100 100
 
101 101
 // Если есть записи
102 102
 if ($numrows > 0) {
103
-    $class = 'odd';
104
-    foreach (array_keys($instr_arr) as $i) {
105
-
106
-        //
107
-        $class = ('even' === $class) ? 'odd' : 'even';
108
-        // ID
109
-        $insinstr_instrid = $instr_arr[$i]->getVar('instrid');
110
-        // Название
111
-        $insinstr_title = $instr_arr[$i]->getVar('title');
112
-        // Статус
113
-        $insinstr_status = $instr_arr[$i]->getVar('status');
114
-        // Количество страниц
115
-        $insinstr_pages = $instr_arr[$i]->getVar('pages');
116
-        // Категория
117
-        $insinstr_cid = $instr_arr[$i]->getVar('cid');
118
-        $insinstr_cat = $categoryHandler->get($insinstr_cid);
119
-        // Права на добавление
120
-        $perm_submit = in_array($insinstr_cid, $cat_submit) ? true : false;
121
-        // Права на редактирование
122
-        $perm_edit = in_array($insinstr_cid, $cat_edit) ? true : false;
123
-        //Мета-теги ключевых слов
124
-        $insinstr_metakeywords = $instr_arr[$i]->getVar('metakeywords');
125
-        // Если есть - добавляем в мета-теги страницы
126
-        if ($insinstr_metakeywords) {
127
-            $index_metakeywords[] = $insinstr_metakeywords;
128
-        }
129
-        // Мета-теги описания
130
-        $insinstr_metadescript = $instr_arr[$i]->getVar('metadescription');
131
-        // Если есть - добавляем в мета-теги страницы
132
-        if ($insinstr_metadescript) {
133
-            $index_metadescript[] = $insinstr_metadescript;
134
-        }
135
-
136
-        // Выводим в шаблон
137
-        $GLOBALS['xoopsTpl']->append('insListInstr',
138
-                                     ['instrid' => $insinstr_instrid, 'title' => $insinstr_title, 'status' => $insinstr_status, 'pages' => $insinstr_pages, 'ctitle' => $insinstr_cat->getVar('title'), 'cid' => $insinstr_cid, 'permsubmit' => $perm_submit, 'permedit' => $perm_edit, 'class' => $class]
139
-        );
140
-    }
141
-
142
-    // Языковые константы
103
+	$class = 'odd';
104
+	foreach (array_keys($instr_arr) as $i) {
105
+
106
+		//
107
+		$class = ('even' === $class) ? 'odd' : 'even';
108
+		// ID
109
+		$insinstr_instrid = $instr_arr[$i]->getVar('instrid');
110
+		// Название
111
+		$insinstr_title = $instr_arr[$i]->getVar('title');
112
+		// Статус
113
+		$insinstr_status = $instr_arr[$i]->getVar('status');
114
+		// Количество страниц
115
+		$insinstr_pages = $instr_arr[$i]->getVar('pages');
116
+		// Категория
117
+		$insinstr_cid = $instr_arr[$i]->getVar('cid');
118
+		$insinstr_cat = $categoryHandler->get($insinstr_cid);
119
+		// Права на добавление
120
+		$perm_submit = in_array($insinstr_cid, $cat_submit) ? true : false;
121
+		// Права на редактирование
122
+		$perm_edit = in_array($insinstr_cid, $cat_edit) ? true : false;
123
+		//Мета-теги ключевых слов
124
+		$insinstr_metakeywords = $instr_arr[$i]->getVar('metakeywords');
125
+		// Если есть - добавляем в мета-теги страницы
126
+		if ($insinstr_metakeywords) {
127
+			$index_metakeywords[] = $insinstr_metakeywords;
128
+		}
129
+		// Мета-теги описания
130
+		$insinstr_metadescript = $instr_arr[$i]->getVar('metadescription');
131
+		// Если есть - добавляем в мета-теги страницы
132
+		if ($insinstr_metadescript) {
133
+			$index_metadescript[] = $insinstr_metadescript;
134
+		}
135
+
136
+		// Выводим в шаблон
137
+		$GLOBALS['xoopsTpl']->append('insListInstr',
138
+									 ['instrid' => $insinstr_instrid, 'title' => $insinstr_title, 'status' => $insinstr_status, 'pages' => $insinstr_pages, 'ctitle' => $insinstr_cat->getVar('title'), 'cid' => $insinstr_cid, 'permsubmit' => $perm_submit, 'permedit' => $perm_edit, 'class' => $class]
139
+		);
140
+	}
141
+
142
+	// Языковые константы
143 143
 }
144 144
 
145 145
 // Если есть мета-теги
146 146
 if (count($index_metakeywords)) {
147
-    $xoTheme->addMeta('meta', 'keywords', implode(', ', $index_metakeywords));
147
+	$xoTheme->addMeta('meta', 'keywords', implode(', ', $index_metakeywords));
148 148
 }
149 149
 if (count($index_metadescript)) {
150
-    $xoTheme->addMeta('meta', 'description', implode(', ', $index_metadescript));
150
+	$xoTheme->addMeta('meta', 'description', implode(', ', $index_metadescript));
151 151
 }
152 152
 
153 153
 // Подвал
Please login to merge, or discard this patch.
submit.php 2 patches
Indentation   +191 added lines, -191 removed lines patch added patch discarded remove patch
@@ -35,195 +35,195 @@
 block discarded – undo
35 35
 
36 36
 switch ($op) {
37 37
 
38
-    case 'editpage':
39
-
40
-        // Задание тайтла
41
-        $xoopsOption['xoops_pagetitle'] = '';
42
-        // Шаблон
43
-        $GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_editpage.tpl';
44
-        // Заголовок
45
-        include_once $GLOBALS['xoops']->path('header.php');
46
-
47
-        // Если мы редактируем страницу
48
-        if ($pageid) {
49
-            // Получаем объект страницы
50
-            $objInspage = $pageHandler->get($pageid);
51
-            // ID инструкции
52
-            $instrid = $objInspage->getVar('instrid');
53
-            // Объект инструкции
54
-            $objInsinstr = $instructionHandler->get($instrid);
55
-            // Можно ли редактировать инструкцию в данной категории
56
-            if (!in_array($objInsinstr->getVar('cid'), $cat_edit)) {
57
-                redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_EDITPAGE);
58
-            }
59
-            // Создание новой страницы
60
-        } elseif ($instrid) {
61
-
62
-            // Если нельзя добавлять не в одну категорию
63
-            //if( ! count( $cat_submit ) ) redirect_header( 'index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMIT_PAGE );
64
-            // Создаём объект страницы
65
-            $objInspage = $pageHandler->create();
66
-            // Объект инструкции
67
-            $objInsinstr = $instructionHandler->get($instrid);
68
-            // Можно ли добавлять инструкции в данной категории
69
-            if (!in_array($objInsinstr->getVar('cid'), $cat_submit)) {
70
-                redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMITPAGE);
71
-            }
72
-        } else {
73
-            redirect_header('index.php', 3, _MD_INSTRUCTION_BADREQUEST);
74
-        }
75
-
76
-        // Информация об инструкции
77
-
78
-        // Массив данных об инструкции
79
-        $instrs = [];
80
-        // ID инструкции
81
-        $instrs['instrid'] = $objInsinstr->getVar('instrid');
82
-        // Название страницы
83
-        $instrs['title'] = $objInsinstr->getVar('title');
84
-        // Описание
85
-        $instrs['description'] = $objInsinstr->getVar('description');
86
-
87
-        // Выводим в шаблон
88
-        $GLOBALS['xoopsTpl']->assign('insInstr', $instrs);
89
-
90
-        //
91
-
92
-        $form = $objInspage->getForm('submit.php', $instrid);
93
-        // Форма
94
-        $GLOBALS['xoopsTpl']->assign('insFormPage', $form->render());
95
-
96
-        // Подвал
97
-        include_once $GLOBALS['xoops']->path('footer.php');
98
-
99
-        break;
100
-    // Сохранение страницы
101
-    case 'savepage':
102
-
103
-        // Проверка
104
-        if (!$GLOBALS['xoopsSecurity']->check()) {
105
-            redirect_header('index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
106
-        }
107
-
108
-        $err         = false;
109
-        $message_err = '';
110
-
111
-        // Если мы редактируем
112
-        if ($pageid) {
113
-            $objInspage = $pageHandler->get($pageid);
114
-            // Объект инструкции
115
-            $objInsinstr = $instructionHandler->get($objInspage->getVar('instrid'));
116
-            // Можно ли редактировать инструкцию в данной категории
117
-            if (!in_array($objInsinstr->getVar('cid'), $cat_edit)) {
118
-                redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_EDITPAGE);
119
-            }
120
-        } elseif ($instrid) {
121
-            $objInspage = $pageHandler->create();
122
-            // Объект инструкции
123
-            $objInsinstr = $instructionHandler->get($instrid);
124
-            // Можно ли добавлять инструкции в данной категории
125
-            if (!in_array($objInsinstr->getVar('cid'), $cat_submit)) {
126
-                redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMITPAGE);
127
-            }
128
-
129
-            // Если мы создаём страницу необходимо указать к какой инструкции
130
-            $objInspage->setVar('instrid', $instrid);
131
-            // Указываем дату создания
132
-            $objInspage->setVar('datecreated', $time);
133
-            // Указываем пользователя
134
-            $objInspage->setVar('uid', $uid);
135
-        } else {
136
-            redirect_header('index.php', 3, _MD_INSTRUCTION_BADREQUEST);
137
-        }
138
-
139
-        // Родительская страница
140
-        $objInspage->setVar('pid', $pid);
141
-        // Дата обновления
142
-        $objInspage->setVar('dateupdated', $time);
143
-        //
144
-        $objInspage->setVar('title', Request::getString('title', '', 'POST'));
145
-        $objInspage->setVar('weight', $weight);
146
-        $objInspage->setVar('hometext', Request::getText('hometext', '', 'POST'));
147
-        // Сноска
148
-        $objInspage->setVar('footnote', Request::getText('footnote', '', 'POST'));
149
-        $objInspage->setVar('status', Request::getInt('status', 0, 'POST'));
150
-        $objInspage->setVar('keywords', Request::getString('keywords', '', 'POST'));
151
-        $objInspage->setVar('description', Request::getText('description', '', 'POST'));
152
-
153
-        // Проверка категорий
154
-        if (!$pageid && !$instrid) {
155
-            $err         = true;
156
-            $message_err .= _MD_INSTRUCTION_ERR_INSTR . '<br>';
157
-        }
158
-        // Проверка веса
159
-        if (0 == $weight) {
160
-            $err         = true;
161
-            $message_err .= _MD_INSTRUCTION_ERR_WEIGHT . '<br>';
162
-        }
163
-        // Проверка родительской страницы
164
-        if ($pageid && ($pageid == $pid)) {
165
-            $err         = true;
166
-            $message_err .= _MD_INSTRUCTION_ERR_PPAGE . '<br>';
167
-        }
168
-        // Если были ошибки
169
-        if (true === $err) {
170
-            // Задание тайтла
171
-            $xoopsOption['xoops_pagetitle'] = '';
172
-            // Шаблон
173
-            $GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_savepage.tpl';
174
-            // Заголовок
175
-            include_once $GLOBALS['xoops']->path('header.php');
176
-            // Сообщение об ошибке
177
-            $message_err = '<div class="errorMsg" style="text-align: left;">' . $message_err . '</div>';
178
-            // Выводим ошибки в шаблон
179
-            $GLOBALS['xoopsTpl']->assign('insErrorMsg', $message_err);
180
-            // Если небыло ошибок
181
-        } else {
182
-            // Вставляем данные в БД
183
-            if ($pageHandler->insert($objInspage)) {
184
-                // Если мы редактируем
185
-                if ($pageid) {
186
-                    // Обновление даты
187
-                    $sql = sprintf('UPDATE %s SET `dateupdated` = %u WHERE `instrid` = %u', $GLOBALS['xoopsDB']->prefix($moduleDirName . '_instr'), $time, $instrid);
188
-                    $GLOBALS['xoopsDB']->query($sql);
189
-                    // Запись в лог
190
-                    xoops_loadLanguage('main', 'userslog');
191
-                    //userslog_insert( $objInsinstr->getVar('title') . ': ' . $objInspage->getVar('title'), _MD_USERSLOG_MODIFY_PAGE );
192
-                    //
193
-                    redirect_header('index.php', 3, _MD_INSTRUCTION_PAGEMODIFY);
194
-                    // Если мы добавляем
195
-                } else {
196
-                    // Инкримент комментов
197
-                    $pageHandler->updateposts($uid, Request::getInt('status', 0, 'POST'), 'add');
198
-                    // Инкремент страниц и обновление даты
199
-                    $sql = sprintf('UPDATE %s SET `pages` = `pages` + 1, `dateupdated` = %u WHERE `instrid` = %u', $GLOBALS['xoopsDB']->prefix($moduleDirName . '_instr'), $time, $instrid);
200
-                    $GLOBALS['xoopsDB']->query($sql);
201
-                    // Запись в лог
202
-                    xoops_loadLanguage('main', 'userslog');
203
-                    //userslog_insert( $objInsinstr->getVar('title') . ': ' . $objInspage->getVar('title'), _MD_USERSLOG_SUBMIT_PAGE );
204
-                    //
205
-                    redirect_header('index.php', 3, _MD_INSTRUCTION_PAGEADDED);
206
-                }
207
-            }
208
-
209
-            // Задание тайтла
210
-            $xoopsOption['xoops_pagetitle'] = '';
211
-            // Шаблон
212
-            $GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_savepage.tpl';
213
-            // Заголовок
214
-            include_once $GLOBALS['xoops']->path('header.php');
215
-
216
-            // Выводим ошибки в шаблон
217
-            $GLOBALS['xoopsTpl']->assign('insErrorMsg', $objInspage->getHtmlErrors());
218
-        }
219
-        // Получаем форму
220
-        $form = $objInspage->getForm('submit.php', $instrid);
221
-
222
-        // Форма
223
-        $GLOBALS['xoopsTpl']->assign('insFormPage', $form->render());
224
-
225
-        // Подвал
226
-        include_once $GLOBALS['xoops']->path('footer.php');
227
-
228
-        break;
38
+	case 'editpage':
39
+
40
+		// Задание тайтла
41
+		$xoopsOption['xoops_pagetitle'] = '';
42
+		// Шаблон
43
+		$GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_editpage.tpl';
44
+		// Заголовок
45
+		include_once $GLOBALS['xoops']->path('header.php');
46
+
47
+		// Если мы редактируем страницу
48
+		if ($pageid) {
49
+			// Получаем объект страницы
50
+			$objInspage = $pageHandler->get($pageid);
51
+			// ID инструкции
52
+			$instrid = $objInspage->getVar('instrid');
53
+			// Объект инструкции
54
+			$objInsinstr = $instructionHandler->get($instrid);
55
+			// Можно ли редактировать инструкцию в данной категории
56
+			if (!in_array($objInsinstr->getVar('cid'), $cat_edit)) {
57
+				redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_EDITPAGE);
58
+			}
59
+			// Создание новой страницы
60
+		} elseif ($instrid) {
61
+
62
+			// Если нельзя добавлять не в одну категорию
63
+			//if( ! count( $cat_submit ) ) redirect_header( 'index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMIT_PAGE );
64
+			// Создаём объект страницы
65
+			$objInspage = $pageHandler->create();
66
+			// Объект инструкции
67
+			$objInsinstr = $instructionHandler->get($instrid);
68
+			// Можно ли добавлять инструкции в данной категории
69
+			if (!in_array($objInsinstr->getVar('cid'), $cat_submit)) {
70
+				redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMITPAGE);
71
+			}
72
+		} else {
73
+			redirect_header('index.php', 3, _MD_INSTRUCTION_BADREQUEST);
74
+		}
75
+
76
+		// Информация об инструкции
77
+
78
+		// Массив данных об инструкции
79
+		$instrs = [];
80
+		// ID инструкции
81
+		$instrs['instrid'] = $objInsinstr->getVar('instrid');
82
+		// Название страницы
83
+		$instrs['title'] = $objInsinstr->getVar('title');
84
+		// Описание
85
+		$instrs['description'] = $objInsinstr->getVar('description');
86
+
87
+		// Выводим в шаблон
88
+		$GLOBALS['xoopsTpl']->assign('insInstr', $instrs);
89
+
90
+		//
91
+
92
+		$form = $objInspage->getForm('submit.php', $instrid);
93
+		// Форма
94
+		$GLOBALS['xoopsTpl']->assign('insFormPage', $form->render());
95
+
96
+		// Подвал
97
+		include_once $GLOBALS['xoops']->path('footer.php');
98
+
99
+		break;
100
+	// Сохранение страницы
101
+	case 'savepage':
102
+
103
+		// Проверка
104
+		if (!$GLOBALS['xoopsSecurity']->check()) {
105
+			redirect_header('index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
106
+		}
107
+
108
+		$err         = false;
109
+		$message_err = '';
110
+
111
+		// Если мы редактируем
112
+		if ($pageid) {
113
+			$objInspage = $pageHandler->get($pageid);
114
+			// Объект инструкции
115
+			$objInsinstr = $instructionHandler->get($objInspage->getVar('instrid'));
116
+			// Можно ли редактировать инструкцию в данной категории
117
+			if (!in_array($objInsinstr->getVar('cid'), $cat_edit)) {
118
+				redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_EDITPAGE);
119
+			}
120
+		} elseif ($instrid) {
121
+			$objInspage = $pageHandler->create();
122
+			// Объект инструкции
123
+			$objInsinstr = $instructionHandler->get($instrid);
124
+			// Можно ли добавлять инструкции в данной категории
125
+			if (!in_array($objInsinstr->getVar('cid'), $cat_submit)) {
126
+				redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMITPAGE);
127
+			}
128
+
129
+			// Если мы создаём страницу необходимо указать к какой инструкции
130
+			$objInspage->setVar('instrid', $instrid);
131
+			// Указываем дату создания
132
+			$objInspage->setVar('datecreated', $time);
133
+			// Указываем пользователя
134
+			$objInspage->setVar('uid', $uid);
135
+		} else {
136
+			redirect_header('index.php', 3, _MD_INSTRUCTION_BADREQUEST);
137
+		}
138
+
139
+		// Родительская страница
140
+		$objInspage->setVar('pid', $pid);
141
+		// Дата обновления
142
+		$objInspage->setVar('dateupdated', $time);
143
+		//
144
+		$objInspage->setVar('title', Request::getString('title', '', 'POST'));
145
+		$objInspage->setVar('weight', $weight);
146
+		$objInspage->setVar('hometext', Request::getText('hometext', '', 'POST'));
147
+		// Сноска
148
+		$objInspage->setVar('footnote', Request::getText('footnote', '', 'POST'));
149
+		$objInspage->setVar('status', Request::getInt('status', 0, 'POST'));
150
+		$objInspage->setVar('keywords', Request::getString('keywords', '', 'POST'));
151
+		$objInspage->setVar('description', Request::getText('description', '', 'POST'));
152
+
153
+		// Проверка категорий
154
+		if (!$pageid && !$instrid) {
155
+			$err         = true;
156
+			$message_err .= _MD_INSTRUCTION_ERR_INSTR . '<br>';
157
+		}
158
+		// Проверка веса
159
+		if (0 == $weight) {
160
+			$err         = true;
161
+			$message_err .= _MD_INSTRUCTION_ERR_WEIGHT . '<br>';
162
+		}
163
+		// Проверка родительской страницы
164
+		if ($pageid && ($pageid == $pid)) {
165
+			$err         = true;
166
+			$message_err .= _MD_INSTRUCTION_ERR_PPAGE . '<br>';
167
+		}
168
+		// Если были ошибки
169
+		if (true === $err) {
170
+			// Задание тайтла
171
+			$xoopsOption['xoops_pagetitle'] = '';
172
+			// Шаблон
173
+			$GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_savepage.tpl';
174
+			// Заголовок
175
+			include_once $GLOBALS['xoops']->path('header.php');
176
+			// Сообщение об ошибке
177
+			$message_err = '<div class="errorMsg" style="text-align: left;">' . $message_err . '</div>';
178
+			// Выводим ошибки в шаблон
179
+			$GLOBALS['xoopsTpl']->assign('insErrorMsg', $message_err);
180
+			// Если небыло ошибок
181
+		} else {
182
+			// Вставляем данные в БД
183
+			if ($pageHandler->insert($objInspage)) {
184
+				// Если мы редактируем
185
+				if ($pageid) {
186
+					// Обновление даты
187
+					$sql = sprintf('UPDATE %s SET `dateupdated` = %u WHERE `instrid` = %u', $GLOBALS['xoopsDB']->prefix($moduleDirName . '_instr'), $time, $instrid);
188
+					$GLOBALS['xoopsDB']->query($sql);
189
+					// Запись в лог
190
+					xoops_loadLanguage('main', 'userslog');
191
+					//userslog_insert( $objInsinstr->getVar('title') . ': ' . $objInspage->getVar('title'), _MD_USERSLOG_MODIFY_PAGE );
192
+					//
193
+					redirect_header('index.php', 3, _MD_INSTRUCTION_PAGEMODIFY);
194
+					// Если мы добавляем
195
+				} else {
196
+					// Инкримент комментов
197
+					$pageHandler->updateposts($uid, Request::getInt('status', 0, 'POST'), 'add');
198
+					// Инкремент страниц и обновление даты
199
+					$sql = sprintf('UPDATE %s SET `pages` = `pages` + 1, `dateupdated` = %u WHERE `instrid` = %u', $GLOBALS['xoopsDB']->prefix($moduleDirName . '_instr'), $time, $instrid);
200
+					$GLOBALS['xoopsDB']->query($sql);
201
+					// Запись в лог
202
+					xoops_loadLanguage('main', 'userslog');
203
+					//userslog_insert( $objInsinstr->getVar('title') . ': ' . $objInspage->getVar('title'), _MD_USERSLOG_SUBMIT_PAGE );
204
+					//
205
+					redirect_header('index.php', 3, _MD_INSTRUCTION_PAGEADDED);
206
+				}
207
+			}
208
+
209
+			// Задание тайтла
210
+			$xoopsOption['xoops_pagetitle'] = '';
211
+			// Шаблон
212
+			$GLOBALS['xoopsOption']['template_main'] = $moduleDirName . '_savepage.tpl';
213
+			// Заголовок
214
+			include_once $GLOBALS['xoops']->path('header.php');
215
+
216
+			// Выводим ошибки в шаблон
217
+			$GLOBALS['xoopsTpl']->assign('insErrorMsg', $objInspage->getHtmlErrors());
218
+		}
219
+		// Получаем форму
220
+		$form = $objInspage->getForm('submit.php', $instrid);
221
+
222
+		// Форма
223
+		$GLOBALS['xoopsTpl']->assign('insFormPage', $form->render());
224
+
225
+		// Подвал
226
+		include_once $GLOBALS['xoops']->path('footer.php');
227
+
228
+		break;
229 229
 }
Please login to merge, or discard this patch.
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -53,7 +53,7 @@  discard block
 block discarded – undo
53 53
             // Объект инструкции
54 54
             $objInsinstr = $instructionHandler->get($instrid);
55 55
             // Можно ли редактировать инструкцию в данной категории
56
-            if (!in_array($objInsinstr->getVar('cid'), $cat_edit)) {
56
+            if ( ! in_array($objInsinstr->getVar('cid'), $cat_edit)) {
57 57
                 redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_EDITPAGE);
58 58
             }
59 59
             // Создание новой страницы
@@ -66,7 +66,7 @@  discard block
 block discarded – undo
66 66
             // Объект инструкции
67 67
             $objInsinstr = $instructionHandler->get($instrid);
68 68
             // Можно ли добавлять инструкции в данной категории
69
-            if (!in_array($objInsinstr->getVar('cid'), $cat_submit)) {
69
+            if ( ! in_array($objInsinstr->getVar('cid'), $cat_submit)) {
70 70
                 redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMITPAGE);
71 71
             }
72 72
         } else {
@@ -101,7 +101,7 @@  discard block
 block discarded – undo
101 101
     case 'savepage':
102 102
 
103 103
         // Проверка
104
-        if (!$GLOBALS['xoopsSecurity']->check()) {
104
+        if ( ! $GLOBALS['xoopsSecurity']->check()) {
105 105
             redirect_header('index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
106 106
         }
107 107
 
@@ -114,7 +114,7 @@  discard block
 block discarded – undo
114 114
             // Объект инструкции
115 115
             $objInsinstr = $instructionHandler->get($objInspage->getVar('instrid'));
116 116
             // Можно ли редактировать инструкцию в данной категории
117
-            if (!in_array($objInsinstr->getVar('cid'), $cat_edit)) {
117
+            if ( ! in_array($objInsinstr->getVar('cid'), $cat_edit)) {
118 118
                 redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_EDITPAGE);
119 119
             }
120 120
         } elseif ($instrid) {
@@ -122,7 +122,7 @@  discard block
 block discarded – undo
122 122
             // Объект инструкции
123 123
             $objInsinstr = $instructionHandler->get($instrid);
124 124
             // Можно ли добавлять инструкции в данной категории
125
-            if (!in_array($objInsinstr->getVar('cid'), $cat_submit)) {
125
+            if ( ! in_array($objInsinstr->getVar('cid'), $cat_submit)) {
126 126
                 redirect_header('index.php', 3, _MD_INSTRUCTION_NOPERM_SUBMITPAGE);
127 127
             }
128 128
 
@@ -151,18 +151,18 @@  discard block
 block discarded – undo
151 151
         $objInspage->setVar('description', Request::getText('description', '', 'POST'));
152 152
 
153 153
         // Проверка категорий
154
-        if (!$pageid && !$instrid) {
155
-            $err         = true;
154
+        if ( ! $pageid && ! $instrid) {
155
+            $err = true;
156 156
             $message_err .= _MD_INSTRUCTION_ERR_INSTR . '<br>';
157 157
         }
158 158
         // Проверка веса
159 159
         if (0 == $weight) {
160
-            $err         = true;
160
+            $err = true;
161 161
             $message_err .= _MD_INSTRUCTION_ERR_WEIGHT . '<br>';
162 162
         }
163 163
         // Проверка родительской страницы
164 164
         if ($pageid && ($pageid == $pid)) {
165
-            $err         = true;
165
+            $err = true;
166 166
             $message_err .= _MD_INSTRUCTION_ERR_PPAGE . '<br>';
167 167
         }
168 168
         // Если были ошибки
Please login to merge, or discard this patch.
blocks/instr_lastpage.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -12,63 +12,63 @@  discard block
 block discarded – undo
12 12
 function b_instr_lastpage_show($options = [])
13 13
 {
14 14
 
15
-    // Подключаем функции
16
-    $moduleDirName = basename(dirname(__DIR__));
17
-    include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/include/common.php');
18
-    //
19
-    $myts = MyTextSanitizer::getInstance();
20
-    //
21
-    //mb    $instructionHandler = xoops_getModuleHandler('instruction', 'instruction');
22
-    //mb    $pageHandler  = xoops_getModuleHandler('page', 'instruction');
15
+	// Подключаем функции
16
+	$moduleDirName = basename(dirname(__DIR__));
17
+	include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/include/common.php');
18
+	//
19
+	$myts = MyTextSanitizer::getInstance();
20
+	//
21
+	//mb    $instructionHandler = xoops_getModuleHandler('instruction', 'instruction');
22
+	//mb    $pageHandler  = xoops_getModuleHandler('page', 'instruction');
23 23
 
24
-    $db                 = \XoopsDatabaseFactory::getDatabase();
25
-    $instructionHandler = new \Xoopsmodules\instruction\InstructionHandler($db);
26
-    $pageHandler        = new \Xoopsmodules\instruction\PageHandler($db);
24
+	$db                 = \XoopsDatabaseFactory::getDatabase();
25
+	$instructionHandler = new \Xoopsmodules\instruction\InstructionHandler($db);
26
+	$pageHandler        = new \Xoopsmodules\instruction\PageHandler($db);
27 27
 
28
-    // Добавляем стили
29
-    //global $xoTheme;
30
-    //$xoTheme->addStylesheet( XOOPS_URL . '/modules/instruction/css/blocks.css' );
28
+	// Добавляем стили
29
+	//global $xoTheme;
30
+	//$xoTheme->addStylesheet( XOOPS_URL . '/modules/instruction/css/blocks.css' );
31 31
 
32
-    // Опции
33
-    // Количество страниц
34
-    $limit = $options[0];
35
-    // Количество символов
36
-    $numchars = $options[1];
32
+	// Опции
33
+	// Количество страниц
34
+	$limit = $options[0];
35
+	// Количество символов
36
+	$numchars = $options[1];
37 37
 
38
-    // Права на просмотр
39
-    $cat_view = Xoopsmodules\instruction\Utility::getItemIds();
40
-    // Массив выходных данных
41
-    $block = [];
38
+	// Права на просмотр
39
+	$cat_view = Xoopsmodules\instruction\Utility::getItemIds();
40
+	// Массив выходных данных
41
+	$block = [];
42 42
 
43
-    // Если есть категории для прасмотра
44
-    if (is_array($cat_view) && count($cat_view) > 0) {
43
+	// Если есть категории для прасмотра
44
+	if (is_array($cat_view) && count($cat_view) > 0) {
45 45
 
46
-        // Находим последние страницы
47
-        $sql = "SELECT p.pageid, p.instrid, p.title, p.dateupdated, i.title, i.cid FROM {$pageHandler->table} p, {$instructionHandler->table} i WHERE p.instrid = i.instrid AND i.cid IN (" . implode(', ', $cat_view) . ') AND p.status > 0 AND i.status > 0 ORDER BY p.dateupdated DESC';
48
-        // Лимит запроса
49
-        $result = $GLOBALS['xoopsDB']->query($sql, $limit);
50
-        // Перебираем все значения
51
-        $i = 0;
52
-        while (list($pageid, $instrid, $ptitle, $dateupdated, $ititle, $cid) = $GLOBALS['xoopsDB']->fetchRow($result)) {
53
-            // ID страницы
54
-            $block[$i]['pageid'] = $pageid;
55
-            // ID инструкции
56
-            $block[$i]['instrid'] = $instrid;
57
-            // Название страницы
58
-            $block[$i]['ptitle'] = $myts->htmlSpecialChars($ptitle);
59
-            // Название инструкции
60
-            $block[$i]['ititle'] = $myts->htmlSpecialChars($ititle);
61
-            // Дата обновления страницы
62
-            $block[$i]['dateupdated'] = formatTimeStamp($dateupdated, 's');
63
-            // Категория инстркции
64
-            $block[$i]['cid'] = $cid;
65
-            // Инкримент
66
-            $i++;
67
-        }
68
-    }
46
+		// Находим последние страницы
47
+		$sql = "SELECT p.pageid, p.instrid, p.title, p.dateupdated, i.title, i.cid FROM {$pageHandler->table} p, {$instructionHandler->table} i WHERE p.instrid = i.instrid AND i.cid IN (" . implode(', ', $cat_view) . ') AND p.status > 0 AND i.status > 0 ORDER BY p.dateupdated DESC';
48
+		// Лимит запроса
49
+		$result = $GLOBALS['xoopsDB']->query($sql, $limit);
50
+		// Перебираем все значения
51
+		$i = 0;
52
+		while (list($pageid, $instrid, $ptitle, $dateupdated, $ititle, $cid) = $GLOBALS['xoopsDB']->fetchRow($result)) {
53
+			// ID страницы
54
+			$block[$i]['pageid'] = $pageid;
55
+			// ID инструкции
56
+			$block[$i]['instrid'] = $instrid;
57
+			// Название страницы
58
+			$block[$i]['ptitle'] = $myts->htmlSpecialChars($ptitle);
59
+			// Название инструкции
60
+			$block[$i]['ititle'] = $myts->htmlSpecialChars($ititle);
61
+			// Дата обновления страницы
62
+			$block[$i]['dateupdated'] = formatTimeStamp($dateupdated, 's');
63
+			// Категория инстркции
64
+			$block[$i]['cid'] = $cid;
65
+			// Инкримент
66
+			$i++;
67
+		}
68
+	}
69 69
 
70
-    // Возвращаем массив
71
-    return $block;
70
+	// Возвращаем массив
71
+	return $block;
72 72
 }
73 73
 
74 74
 // Редактирование последних страниц
@@ -78,10 +78,10 @@  discard block
 block discarded – undo
78 78
  */
79 79
 function b_instr_lastpage_edit($options = [])
80 80
 {
81
-    $form = '';
82
-    $form .= _MB_INSTR_DISPLAYPAGESC . ' <input name="options[0]" size="5" maxlength="255" value="' . $options[0] . '" type="text" /><br>' . "\n";
83
-    $form .= _MB_INSTR_NUMCHARSC . ' <input name="options[1]" size="5" maxlength="255" value="' . $options[1] . '" type="text" /><br>' . "\n";
81
+	$form = '';
82
+	$form .= _MB_INSTR_DISPLAYPAGESC . ' <input name="options[0]" size="5" maxlength="255" value="' . $options[0] . '" type="text" /><br>' . "\n";
83
+	$form .= _MB_INSTR_NUMCHARSC . ' <input name="options[1]" size="5" maxlength="255" value="' . $options[1] . '" type="text" /><br>' . "\n";
84 84
 
85
-    // Возвращаем форму
86
-    return $form;
85
+	// Возвращаем форму
86
+	return $form;
87 87
 }
Please login to merge, or discard this patch.