Completed
Push — master ( 55b92e...48ecb4 )
by Michael
01:50
created
admin/cat.php 2 patches
Indentation   +267 added lines, -267 removed lines patch added patch discarded remove patch
@@ -27,272 +27,272 @@
 block discarded – undo
27 27
 // Выбор
28 28
 switch ($op) {
29 29
 
30
-    case 'main':
31
-
32
-        // Подключаем трей
33
-
34
-        include_once __DIR__  . '/../class/tree.php';
35
-        //include_once $GLOBALS['xoops']->path('modules/instruction/class/tree.php');
36
-
37
-        // Заголовок админки
38
-        xoops_cp_header();
39
-        // Навигация
40
-        $adminObject->displayNavigation(basename(__FILE__));
41
-
42
-        // Находим ID-категории => Число страниц
43
-        $cidinstrids = [];
44
-        $sql         = "SELECT `cid`, COUNT( `instrid` ) FROM {$insinstrHandler->table} GROUP BY `cid`";
45
-        $result      = $GLOBALS['xoopsDB']->query($sql);
46
-        while (list($cid, $count) = $GLOBALS['xoopsDB']->fetchRow($result)) {
47
-            // Заполняем массив
48
-            $cidinstrids[$cid] = $count;
49
-        }
50
-
51
-        // Выбираем категории из БД
52
-        $criteria = new CriteriaCompo();
53
-        $criteria->setSort('weight ASC, title');
54
-        $criteria->setOrder('ASC');
55
-        $ins_cat = $instructioncatHandler->getall($criteria);
56
-        unset($criteria);
57
-
58
-        // Инициализируем
59
-        $cattree = new InstructionTree($ins_cat, 'cid', 'pid');
60
-        // Выводим списко категорий в шаблон
61
-        $GLOBALS['xoopsTpl']->assign('insListCat', $cattree->makeCatsAdmin('--', $cidinstrids));
62
-
63
-        // Создание новой категории
64
-        $objInstructioncat = $instructioncatHandler->create();
65
-        $form              = $objInstructioncat->getForm('cat.php');
66
-        // Форма
67
-        $GLOBALS['xoopsTpl']->assign('insFormCat', $form->render());
68
-        // Выводим шаблон
69
-        $GLOBALS['xoopsTpl']->display('db:admin/instruction_admin_cat.tpl');
70
-
71
-        // Текст внизу админки
72
-        include __DIR__ . '/admin_footer.php';
73
-        // Подвал админки
74
-        xoops_cp_footer();
75
-
76
-        break;
77
-
78
-    // Редактирование категории
79
-    case 'editcat':
80
-
81
-        // Заголовок админки
82
-        xoops_cp_header();
83
-        // Навигация
84
-        $adminObject->displayNavigation(basename(__FILE__));
85
-
86
-        $objInstructioncat = $instructioncatHandler->get($cid);
87
-        $form              = $objInstructioncat->getForm('cat.php');
88
-        // Форма
89
-        //$GLOBALS['xoopsTpl']->assign( 'insFormCat', $form->render() );
90
-        echo $form->render();
91
-        // Выводим шаблон
92
-        $GLOBALS['xoopsTpl']->display('db:admin/instruction_admin_editcat.tpl');
93
-
94
-        // Текст внизу админки
95
-        include __DIR__ . '/admin_footer.php';
96
-        // Подвал админки
97
-        xoops_cp_footer();
98
-
99
-        break;
100
-
101
-    // Сохранение категорий
102
-    case 'savecat':
103
-
104
-        // Проверка
105
-        if (!$GLOBALS['xoopsSecurity']->check()) {
106
-            redirect_header('cat.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
107
-        }
108
-        // Если мы редактируем
109
-        if ($cid) {
110
-            $objInstructioncat = $instructioncatHandler->get($cid);
111
-        } else {
112
-            $objInstructioncat = $instructioncatHandler->create();
113
-            // Указываем дату создания
114
-            $objInstructioncat->setVar('datecreated', $time);
115
-        }
116
-
117
-        $err         = false;
118
-        $message_err = '';
119
-
120
-        // Дата обновления
121
-        $objInstructioncat->setVar('dateupdated', $time);
122
-        $objInstructioncat->setVar('pid', $pid);
123
-        $objInstructioncat->setVar('title', $_POST['title']);
124
-        $objInstructioncat->setVar('description', $_POST['description']);
125
-        $objInstructioncat->setVar('weight', $weight);
126
-        $objInstructioncat->setVar('metakeywords', $_POST['metakeywords']);
127
-        $objInstructioncat->setVar('metadescription', $_POST['metadescription']);
128
-
129
-        // Проверка веса
130
-        if (0 == $weight) {
131
-            $err         = true;
132
-            $message_err .= _AM_INSTRUCTION_ERR_WEIGHT . '<br>';
133
-        }
134
-        // Проверка категорий
135
-        if ($cid && ($cid == $pid)) {
136
-            $err         = true;
137
-            $message_err .= _AM_INSTRUCTION_ERR_PCAT . '<br>';
138
-        }
139
-        // Если были ошибки
140
-        if (true === $err) {
141
-            xoops_cp_header();
142
-            // Навигация
143
-            $adminObject->displayNavigation(basename(__FILE__));
144
-
145
-            $message_err = '<div class="errorMsg" style="text-align: left;">' . $message_err . '</div>';
146
-            // Выводим ошибки в шаблон
147
-            $GLOBALS['xoopsTpl']->assign('insErrorMsg', $message_err);
148
-            // Если небыло ошибок
149
-        } else {
150
-            // Вставляем данные в БД
151
-            if ($instructioncatHandler->insert($objInstructioncat)) {
152
-
153
-                // ID категории. Если редактируем - то не изменяется. Если создаём новую - то получаем ID созданной записи.
154
-                $new_cid = $cid ?: $objInstructioncat->get_new_enreg();
155
-
156
-                // ===============
157
-                // ==== Права ====
158
-                // ===============
159
-
160
-                $gpermHandler = xoops_getHandler('groupperm');
161
-
162
-                // Если мы редактируем категорию, то старые права нужно удалить
163
-                if ($cid) {
164
-                    // Права на просмотр
165
-                    $criteria = new CriteriaCompo();
166
-                    $criteria->add(new Criteria('gperm_itemid', $new_cid, '='));
167
-                    $criteria->add(new Criteria('gperm_modid', $GLOBALS['xoopsModule']->getVar('mid'), '='));
168
-                    $criteria->add(new Criteria('gperm_name', 'instruction_view', '='));
169
-                    $gpermHandler->deleteAll($criteria);
170
-                    // Права на добавление
171
-                    $criteria = new CriteriaCompo();
172
-                    $criteria->add(new Criteria('gperm_itemid', $new_cid, '='));
173
-                    $criteria->add(new Criteria('gperm_modid', $GLOBALS['xoopsModule']->getVar('mid'), '='));
174
-                    $criteria->add(new Criteria('gperm_name', 'instruction_submit', '='));
175
-                    $gpermHandler->deleteAll($criteria);
176
-                    // Права на редактирование
177
-                    $criteria = new CriteriaCompo();
178
-                    $criteria->add(new Criteria('gperm_itemid', $new_cid, '='));
179
-                    $criteria->add(new Criteria('gperm_modid', $GLOBALS['xoopsModule']->getVar('mid'), '='));
180
-                    $criteria->add(new Criteria('gperm_name', 'instruction_edit', '='));
181
-                    $gpermHandler->deleteAll($criteria);
182
-                }
183
-
184
-                // Добавляем права
185
-                // Права на просмотр
186
-                if (isset($_POST['groups_instr_view'])) {
187
-                    foreach ($_POST['groups_instr_view'] as $onegroup_id) {
188
-                        $gpermHandler->addRight('instruction_view', $new_cid, $onegroup_id, $GLOBALS['xoopsModule']->getVar('mid'));
189
-                    }
190
-                }
191
-                // Права на добавление
192
-                if (isset($_POST['groups_instr_submit'])) {
193
-                    foreach ($_POST['groups_instr_submit'] as $onegroup_id) {
194
-                        $gpermHandler->addRight('instruction_submit', $new_cid, $onegroup_id, $GLOBALS['xoopsModule']->getVar('mid'));
195
-                    }
196
-                }
197
-                // Права на редактирование
198
-                if (isset($_POST['groups_instr_edit'])) {
199
-                    foreach ($_POST['groups_instr_edit'] as $onegroup_id) {
200
-                        $gpermHandler->addRight('instruction_edit', $new_cid, $onegroup_id, $GLOBALS['xoopsModule']->getVar('mid'));
201
-                    }
202
-                }
203
-
204
-                //
205
-                redirect_header('cat.php', 3, _AM_INSTRUCTION_NEWCATADDED);
206
-            }
207
-            xoops_cp_header();
208
-            // Навигация
209
-            $adminObject->displayNavigation(basename(__FILE__));
210
-            // Выводим ошибки в шаблон
211
-            $GLOBALS['xoopsTpl']->assign('insErrorMsg', $objInstructioncat->getHtmlErrors());
212
-        }
213
-        // Выводим шаблон
214
-        $GLOBALS['xoopsTpl']->display('db:admin/instruction_admin_savecat.tpl');
215
-        // Выводим форму
216
-        $form = $objInstructioncat->getForm();
217
-        // Форма
218
-        echo $form->render();
219
-        // Текст внизу админки
220
-        include __DIR__ . '/admin_footer.php';
221
-        // Подвал админки
222
-        xoops_cp_footer();
223
-
224
-        break;
225
-
226
-    // Удаление категории
227
-    case 'delcat':
228
-
229
-        // Находим число инструкций в данной категории
230
-        // Критерий выборки
231
-        $criteria = new CriteriaCompo();
232
-        // Все инструкции в данной категории
233
-        $criteria->add(new Criteria('cid', $cid, '='));
234
-        $numrows = $insinstrHandler->getCount($criteria);
235
-        //
236
-        unset($criteria);
237
-        // Если есть хоть одна инструкция
238
-        if ($numrows) {
239
-            redirect_header('cat.php', 3, _AM_INSTRUCTION_ERR_CATNOTEMPTY);
240
-        }
241
-
242
-        $objInscat = $instructioncatHandler->get($cid);
243
-        // Если нет такой категории
244
-        if (!is_object($objInscat)) {
245
-            redirect_header('cat.php', 3, _AM_INSTRUCTION_ERR_CATNOTSELECT);
246
-        }
247
-
248
-        // Нельзя удалять пока есть доченрии категории
249
-        // Подключаем трей
250
-        include_once $GLOBALS['xoops']->path('class/tree.php');
251
-        $inscat_arr   = $instructioncatHandler->getall();
252
-        $mytree       = new XoopsObjectTree($inscat_arr, 'cid', 'pid');
253
-        $ins_childcat = $mytree->getAllChild($cid);
254
-        // Если есть дочернии категории
255
-        if (count($ins_childcat)) {
256
-            redirect_header('cat.php', 3, _AM_INSTRUCTION_ERR_CATCHILDREN);
257
-        }
258
-
259
-        // Нажали ли мы на кнопку OK
260
-        $ok = isset($_POST['ok']) ? (int)$_POST['ok'] : 0;
261
-        // Если мы нажали на кнопку
262
-        if ($ok) {
263
-
264
-            // Проверка
265
-            if (!$GLOBALS['xoopsSecurity']->check()) {
266
-                redirect_header('cat.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
267
-            }
268
-            // Пытаемся удалить категорию
269
-            if ($instructioncatHandler->delete($objInscat)) {
270
-
271
-                // Удалить права доступа к категории
272
-                // =================================
273
-
274
-                // Редирект
275
-                redirect_header('cat.php', 3, _AM_INSTRUCTION_CATDELETED);
276
-                // Если не смогли удалить категорию
277
-            } else {
278
-                // Редирект
279
-                redirect_header('cat.php', 3, _AM_INSTRUCTION_ERR_DELCAT);
280
-            }
281
-        } else {
282
-
283
-            // Заголовок админки
284
-            xoops_cp_header();
285
-            // Навигация
286
-            $adminObject->displayNavigation(basename(__FILE__));
287
-
288
-            xoops_confirm(['ok' => 1, 'cid' => $cid, 'op' => 'delcat'], 'cat.php', sprintf(_AM_INSTRUCTION_FORMDELCAT, $objInscat->getVar('title')));
289
-
290
-            // Текст внизу админки
291
-            include __DIR__ . '/admin_footer.php';
292
-            // Подвал админки
293
-            xoops_cp_footer();
294
-        }
295
-
296
-        break;
30
+	case 'main':
31
+
32
+		// Подключаем трей
33
+
34
+		include_once __DIR__  . '/../class/tree.php';
35
+		//include_once $GLOBALS['xoops']->path('modules/instruction/class/tree.php');
36
+
37
+		// Заголовок админки
38
+		xoops_cp_header();
39
+		// Навигация
40
+		$adminObject->displayNavigation(basename(__FILE__));
41
+
42
+		// Находим ID-категории => Число страниц
43
+		$cidinstrids = [];
44
+		$sql         = "SELECT `cid`, COUNT( `instrid` ) FROM {$insinstrHandler->table} GROUP BY `cid`";
45
+		$result      = $GLOBALS['xoopsDB']->query($sql);
46
+		while (list($cid, $count) = $GLOBALS['xoopsDB']->fetchRow($result)) {
47
+			// Заполняем массив
48
+			$cidinstrids[$cid] = $count;
49
+		}
50
+
51
+		// Выбираем категории из БД
52
+		$criteria = new CriteriaCompo();
53
+		$criteria->setSort('weight ASC, title');
54
+		$criteria->setOrder('ASC');
55
+		$ins_cat = $instructioncatHandler->getall($criteria);
56
+		unset($criteria);
57
+
58
+		// Инициализируем
59
+		$cattree = new InstructionTree($ins_cat, 'cid', 'pid');
60
+		// Выводим списко категорий в шаблон
61
+		$GLOBALS['xoopsTpl']->assign('insListCat', $cattree->makeCatsAdmin('--', $cidinstrids));
62
+
63
+		// Создание новой категории
64
+		$objInstructioncat = $instructioncatHandler->create();
65
+		$form              = $objInstructioncat->getForm('cat.php');
66
+		// Форма
67
+		$GLOBALS['xoopsTpl']->assign('insFormCat', $form->render());
68
+		// Выводим шаблон
69
+		$GLOBALS['xoopsTpl']->display('db:admin/instruction_admin_cat.tpl');
70
+
71
+		// Текст внизу админки
72
+		include __DIR__ . '/admin_footer.php';
73
+		// Подвал админки
74
+		xoops_cp_footer();
75
+
76
+		break;
77
+
78
+	// Редактирование категории
79
+	case 'editcat':
80
+
81
+		// Заголовок админки
82
+		xoops_cp_header();
83
+		// Навигация
84
+		$adminObject->displayNavigation(basename(__FILE__));
85
+
86
+		$objInstructioncat = $instructioncatHandler->get($cid);
87
+		$form              = $objInstructioncat->getForm('cat.php');
88
+		// Форма
89
+		//$GLOBALS['xoopsTpl']->assign( 'insFormCat', $form->render() );
90
+		echo $form->render();
91
+		// Выводим шаблон
92
+		$GLOBALS['xoopsTpl']->display('db:admin/instruction_admin_editcat.tpl');
93
+
94
+		// Текст внизу админки
95
+		include __DIR__ . '/admin_footer.php';
96
+		// Подвал админки
97
+		xoops_cp_footer();
98
+
99
+		break;
100
+
101
+	// Сохранение категорий
102
+	case 'savecat':
103
+
104
+		// Проверка
105
+		if (!$GLOBALS['xoopsSecurity']->check()) {
106
+			redirect_header('cat.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
107
+		}
108
+		// Если мы редактируем
109
+		if ($cid) {
110
+			$objInstructioncat = $instructioncatHandler->get($cid);
111
+		} else {
112
+			$objInstructioncat = $instructioncatHandler->create();
113
+			// Указываем дату создания
114
+			$objInstructioncat->setVar('datecreated', $time);
115
+		}
116
+
117
+		$err         = false;
118
+		$message_err = '';
119
+
120
+		// Дата обновления
121
+		$objInstructioncat->setVar('dateupdated', $time);
122
+		$objInstructioncat->setVar('pid', $pid);
123
+		$objInstructioncat->setVar('title', $_POST['title']);
124
+		$objInstructioncat->setVar('description', $_POST['description']);
125
+		$objInstructioncat->setVar('weight', $weight);
126
+		$objInstructioncat->setVar('metakeywords', $_POST['metakeywords']);
127
+		$objInstructioncat->setVar('metadescription', $_POST['metadescription']);
128
+
129
+		// Проверка веса
130
+		if (0 == $weight) {
131
+			$err         = true;
132
+			$message_err .= _AM_INSTRUCTION_ERR_WEIGHT . '<br>';
133
+		}
134
+		// Проверка категорий
135
+		if ($cid && ($cid == $pid)) {
136
+			$err         = true;
137
+			$message_err .= _AM_INSTRUCTION_ERR_PCAT . '<br>';
138
+		}
139
+		// Если были ошибки
140
+		if (true === $err) {
141
+			xoops_cp_header();
142
+			// Навигация
143
+			$adminObject->displayNavigation(basename(__FILE__));
144
+
145
+			$message_err = '<div class="errorMsg" style="text-align: left;">' . $message_err . '</div>';
146
+			// Выводим ошибки в шаблон
147
+			$GLOBALS['xoopsTpl']->assign('insErrorMsg', $message_err);
148
+			// Если небыло ошибок
149
+		} else {
150
+			// Вставляем данные в БД
151
+			if ($instructioncatHandler->insert($objInstructioncat)) {
152
+
153
+				// ID категории. Если редактируем - то не изменяется. Если создаём новую - то получаем ID созданной записи.
154
+				$new_cid = $cid ?: $objInstructioncat->get_new_enreg();
155
+
156
+				// ===============
157
+				// ==== Права ====
158
+				// ===============
159
+
160
+				$gpermHandler = xoops_getHandler('groupperm');
161
+
162
+				// Если мы редактируем категорию, то старые права нужно удалить
163
+				if ($cid) {
164
+					// Права на просмотр
165
+					$criteria = new CriteriaCompo();
166
+					$criteria->add(new Criteria('gperm_itemid', $new_cid, '='));
167
+					$criteria->add(new Criteria('gperm_modid', $GLOBALS['xoopsModule']->getVar('mid'), '='));
168
+					$criteria->add(new Criteria('gperm_name', 'instruction_view', '='));
169
+					$gpermHandler->deleteAll($criteria);
170
+					// Права на добавление
171
+					$criteria = new CriteriaCompo();
172
+					$criteria->add(new Criteria('gperm_itemid', $new_cid, '='));
173
+					$criteria->add(new Criteria('gperm_modid', $GLOBALS['xoopsModule']->getVar('mid'), '='));
174
+					$criteria->add(new Criteria('gperm_name', 'instruction_submit', '='));
175
+					$gpermHandler->deleteAll($criteria);
176
+					// Права на редактирование
177
+					$criteria = new CriteriaCompo();
178
+					$criteria->add(new Criteria('gperm_itemid', $new_cid, '='));
179
+					$criteria->add(new Criteria('gperm_modid', $GLOBALS['xoopsModule']->getVar('mid'), '='));
180
+					$criteria->add(new Criteria('gperm_name', 'instruction_edit', '='));
181
+					$gpermHandler->deleteAll($criteria);
182
+				}
183
+
184
+				// Добавляем права
185
+				// Права на просмотр
186
+				if (isset($_POST['groups_instr_view'])) {
187
+					foreach ($_POST['groups_instr_view'] as $onegroup_id) {
188
+						$gpermHandler->addRight('instruction_view', $new_cid, $onegroup_id, $GLOBALS['xoopsModule']->getVar('mid'));
189
+					}
190
+				}
191
+				// Права на добавление
192
+				if (isset($_POST['groups_instr_submit'])) {
193
+					foreach ($_POST['groups_instr_submit'] as $onegroup_id) {
194
+						$gpermHandler->addRight('instruction_submit', $new_cid, $onegroup_id, $GLOBALS['xoopsModule']->getVar('mid'));
195
+					}
196
+				}
197
+				// Права на редактирование
198
+				if (isset($_POST['groups_instr_edit'])) {
199
+					foreach ($_POST['groups_instr_edit'] as $onegroup_id) {
200
+						$gpermHandler->addRight('instruction_edit', $new_cid, $onegroup_id, $GLOBALS['xoopsModule']->getVar('mid'));
201
+					}
202
+				}
203
+
204
+				//
205
+				redirect_header('cat.php', 3, _AM_INSTRUCTION_NEWCATADDED);
206
+			}
207
+			xoops_cp_header();
208
+			// Навигация
209
+			$adminObject->displayNavigation(basename(__FILE__));
210
+			// Выводим ошибки в шаблон
211
+			$GLOBALS['xoopsTpl']->assign('insErrorMsg', $objInstructioncat->getHtmlErrors());
212
+		}
213
+		// Выводим шаблон
214
+		$GLOBALS['xoopsTpl']->display('db:admin/instruction_admin_savecat.tpl');
215
+		// Выводим форму
216
+		$form = $objInstructioncat->getForm();
217
+		// Форма
218
+		echo $form->render();
219
+		// Текст внизу админки
220
+		include __DIR__ . '/admin_footer.php';
221
+		// Подвал админки
222
+		xoops_cp_footer();
223
+
224
+		break;
225
+
226
+	// Удаление категории
227
+	case 'delcat':
228
+
229
+		// Находим число инструкций в данной категории
230
+		// Критерий выборки
231
+		$criteria = new CriteriaCompo();
232
+		// Все инструкции в данной категории
233
+		$criteria->add(new Criteria('cid', $cid, '='));
234
+		$numrows = $insinstrHandler->getCount($criteria);
235
+		//
236
+		unset($criteria);
237
+		// Если есть хоть одна инструкция
238
+		if ($numrows) {
239
+			redirect_header('cat.php', 3, _AM_INSTRUCTION_ERR_CATNOTEMPTY);
240
+		}
241
+
242
+		$objInscat = $instructioncatHandler->get($cid);
243
+		// Если нет такой категории
244
+		if (!is_object($objInscat)) {
245
+			redirect_header('cat.php', 3, _AM_INSTRUCTION_ERR_CATNOTSELECT);
246
+		}
247
+
248
+		// Нельзя удалять пока есть доченрии категории
249
+		// Подключаем трей
250
+		include_once $GLOBALS['xoops']->path('class/tree.php');
251
+		$inscat_arr   = $instructioncatHandler->getall();
252
+		$mytree       = new XoopsObjectTree($inscat_arr, 'cid', 'pid');
253
+		$ins_childcat = $mytree->getAllChild($cid);
254
+		// Если есть дочернии категории
255
+		if (count($ins_childcat)) {
256
+			redirect_header('cat.php', 3, _AM_INSTRUCTION_ERR_CATCHILDREN);
257
+		}
258
+
259
+		// Нажали ли мы на кнопку OK
260
+		$ok = isset($_POST['ok']) ? (int)$_POST['ok'] : 0;
261
+		// Если мы нажали на кнопку
262
+		if ($ok) {
263
+
264
+			// Проверка
265
+			if (!$GLOBALS['xoopsSecurity']->check()) {
266
+				redirect_header('cat.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
267
+			}
268
+			// Пытаемся удалить категорию
269
+			if ($instructioncatHandler->delete($objInscat)) {
270
+
271
+				// Удалить права доступа к категории
272
+				// =================================
273
+
274
+				// Редирект
275
+				redirect_header('cat.php', 3, _AM_INSTRUCTION_CATDELETED);
276
+				// Если не смогли удалить категорию
277
+			} else {
278
+				// Редирект
279
+				redirect_header('cat.php', 3, _AM_INSTRUCTION_ERR_DELCAT);
280
+			}
281
+		} else {
282
+
283
+			// Заголовок админки
284
+			xoops_cp_header();
285
+			// Навигация
286
+			$adminObject->displayNavigation(basename(__FILE__));
287
+
288
+			xoops_confirm(['ok' => 1, 'cid' => $cid, 'op' => 'delcat'], 'cat.php', sprintf(_AM_INSTRUCTION_FORMDELCAT, $objInscat->getVar('title')));
289
+
290
+			// Текст внизу админки
291
+			include __DIR__ . '/admin_footer.php';
292
+			// Подвал админки
293
+			xoops_cp_footer();
294
+		}
295
+
296
+		break;
297 297
 
298 298
 }
Please login to merge, or discard this patch.
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
 
32 32
         // Подключаем трей
33 33
 
34
-        include_once __DIR__  . '/../class/tree.php';
34
+        include_once __DIR__ . '/../class/tree.php';
35 35
         //include_once $GLOBALS['xoops']->path('modules/instruction/class/tree.php');
36 36
 
37 37
         // Заголовок админки
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
     case 'savecat':
103 103
 
104 104
         // Проверка
105
-        if (!$GLOBALS['xoopsSecurity']->check()) {
105
+        if ( ! $GLOBALS['xoopsSecurity']->check()) {
106 106
             redirect_header('cat.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
107 107
         }
108 108
         // Если мы редактируем
@@ -128,12 +128,12 @@  discard block
 block discarded – undo
128 128
 
129 129
         // Проверка веса
130 130
         if (0 == $weight) {
131
-            $err         = true;
131
+            $err = true;
132 132
             $message_err .= _AM_INSTRUCTION_ERR_WEIGHT . '<br>';
133 133
         }
134 134
         // Проверка категорий
135 135
         if ($cid && ($cid == $pid)) {
136
-            $err         = true;
136
+            $err = true;
137 137
             $message_err .= _AM_INSTRUCTION_ERR_PCAT . '<br>';
138 138
         }
139 139
         // Если были ошибки
@@ -241,7 +241,7 @@  discard block
 block discarded – undo
241 241
 
242 242
         $objInscat = $instructioncatHandler->get($cid);
243 243
         // Если нет такой категории
244
-        if (!is_object($objInscat)) {
244
+        if ( ! is_object($objInscat)) {
245 245
             redirect_header('cat.php', 3, _AM_INSTRUCTION_ERR_CATNOTSELECT);
246 246
         }
247 247
 
@@ -257,12 +257,12 @@  discard block
 block discarded – undo
257 257
         }
258 258
 
259 259
         // Нажали ли мы на кнопку OK
260
-        $ok = isset($_POST['ok']) ? (int)$_POST['ok'] : 0;
260
+        $ok = isset($_POST['ok']) ? (int) $_POST['ok'] : 0;
261 261
         // Если мы нажали на кнопку
262 262
         if ($ok) {
263 263
 
264 264
             // Проверка
265
-            if (!$GLOBALS['xoopsSecurity']->check()) {
265
+            if ( ! $GLOBALS['xoopsSecurity']->check()) {
266 266
                 redirect_header('cat.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors()));
267 267
             }
268 268
             // Пытаемся удалить категорию
Please login to merge, or discard this patch.