Completed
Push — master ( f5725e...47133a )
by Michael
02:14
created
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 1 patch
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.
submit.php 1 patch
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.
class/common/ServerStats.php 1 patch
Indentation   +55 added lines, -55 removed lines patch added patch discarded remove patch
@@ -17,60 +17,60 @@
 block discarded – undo
17 17
  */
18 18
 trait ServerStats
19 19
 {
20
-    /**
21
-     * serverStats()
22
-     *
23
-     * @return string
24
-     */
25
-    public static function getServerStats()
26
-    {
27
-        //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
28
-        $moduleDirName      = basename(dirname(dirname(__DIR__)));
29
-        $moduleDirNameUpper = strtoupper($moduleDirName);
30
-        xoops_loadLanguage('common', $moduleDirName);
31
-        $html = '';
32
-        //        $sql   = 'SELECT metavalue';
33
-        //        $sql   .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta');
34
-        //        $sql   .= " WHERE metakey='version' LIMIT 1";
35
-        //        $query = $GLOBALS['xoopsDB']->query($sql);
36
-        //        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
37
-        $html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n";
38
-        $html .= "<div style='padding: 8px;'>\n";
39
-        //        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n";
40
-        //        $html .= "<br>\n";
41
-        //        $html .= "<br>\n";
42
-        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n";
43
-        $html .= "<ul>\n";
44
-        //
45
-        $gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
46
-        $html  .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
47
-        if (function_exists('gd_info')) {
48
-            if (true === ($gdlib = gd_info())) {
49
-                $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
50
-            }
51
-        }
52
-        //
53
-        //    $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF');
54
-        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode;
55
-        //
56
-        //    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
57
-        //    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
58
-        //
59
-        $downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
60
-        $html      .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
61
-        //
62
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n";
63
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n";
64
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n";
65
-        $html .= "</ul>\n";
66
-        $html .= "<ul>\n";
67
-        $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
68
-        $html .= "</ul>\n";
69
-        $html .= "<br>\n";
70
-        $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n";
71
-        $html .= '</div>';
72
-        $html .= '</fieldset><br>';
20
+	/**
21
+	 * serverStats()
22
+	 *
23
+	 * @return string
24
+	 */
25
+	public static function getServerStats()
26
+	{
27
+		//mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
28
+		$moduleDirName      = basename(dirname(dirname(__DIR__)));
29
+		$moduleDirNameUpper = strtoupper($moduleDirName);
30
+		xoops_loadLanguage('common', $moduleDirName);
31
+		$html = '';
32
+		//        $sql   = 'SELECT metavalue';
33
+		//        $sql   .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta');
34
+		//        $sql   .= " WHERE metakey='version' LIMIT 1";
35
+		//        $query = $GLOBALS['xoopsDB']->query($sql);
36
+		//        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
37
+		$html .= "<fieldset><legend style='font-weight: bold; color: #900;'>" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "</legend>\n";
38
+		$html .= "<div style='padding: 8px;'>\n";
39
+		//        $html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "</div>\n";
40
+		//        $html .= "<br>\n";
41
+		//        $html .= "<br>\n";
42
+		$html .= '<div>' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "</div>\n";
43
+		$html .= "<ul>\n";
44
+		//
45
+		$gdlib = function_exists('gd_info') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . '</span>';
46
+		$html  .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib;
47
+		if (function_exists('gd_info')) {
48
+			if (true === ($gdlib = gd_info())) {
49
+				$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '<b>' . $gdlib['GD Version'] . '</b>';
50
+			}
51
+		}
52
+		//
53
+		//    $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF');
54
+		//    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode;
55
+		//
56
+		//    $registerglobals = (!ini_get('register_globals')) ? "<span style=\"color: green;\">" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>' : "<span style=\"color: red;\">" . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>';
57
+		//    $html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals;
58
+		//
59
+		$downloads = ini_get('file_uploads') ? '<span style="color: green;">' . constant('CO_' . $moduleDirNameUpper . '_ON') . '</span>' : '<span style="color: red;">' . constant('CO_' . $moduleDirNameUpper . '_OFF') . '</span>';
60
+		$html      .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads;
61
+		//
62
+		$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' <b><span style="color: blue;">' . ini_get('upload_max_filesize') . "</span></b>\n";
63
+		$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' <b><span style="color: blue;">' . ini_get('post_max_size') . "</span></b>\n";
64
+		$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' <b><span style="color: blue;">' . ini_get('memory_limit') . "</span></b>\n";
65
+		$html .= "</ul>\n";
66
+		$html .= "<ul>\n";
67
+		$html .= '<li>' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' <b>' . XOOPS_ROOT_PATH . "</b>\n";
68
+		$html .= "</ul>\n";
69
+		$html .= "<br>\n";
70
+		$html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n";
71
+		$html .= '</div>';
72
+		$html .= '</fieldset><br>';
73 73
 
74
-        return $html;
75
-    }
74
+		return $html;
75
+	}
76 76
 }
Please login to merge, or discard this patch.
include/search.inc.php 1 patch
Indentation   +39 added lines, -39 removed lines patch added patch discarded remove patch
@@ -13,46 +13,46 @@
 block discarded – undo
13 13
  */
14 14
 function instruction_search($queryarray, $andor, $limit, $offset, $userid)
15 15
 {
16
-    // Подключаем функции
17
-    $moduleDirName = basename(dirname(__DIR__));
18
-    include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/class/utility.php');
16
+	// Подключаем функции
17
+	$moduleDirName = basename(dirname(__DIR__));
18
+	include_once $GLOBALS['xoops']->path('modules/' . $moduleDirName . '/class/utility.php');
19 19
 
20
-    $sql = 'SELECT p.pageid, p.title, p.uid, p.datecreated, i.title FROM ' . $GLOBALS['xoopsDB']->prefix('instruction_page') . ' p, ' . $GLOBALS['xoopsDB']->prefix('instruction_instr') . ' i WHERE i.instrid = p.instrid AND i.status > 0 AND p.status > 0 AND p.type > 0';
21
-    if (0 != $userid) {
22
-        $sql .= ' AND p.uid = ' . (int)$userid . ' ';
23
-        //return NULL;
24
-    }
20
+	$sql = 'SELECT p.pageid, p.title, p.uid, p.datecreated, i.title FROM ' . $GLOBALS['xoopsDB']->prefix('instruction_page') . ' p, ' . $GLOBALS['xoopsDB']->prefix('instruction_instr') . ' i WHERE i.instrid = p.instrid AND i.status > 0 AND p.status > 0 AND p.type > 0';
21
+	if (0 != $userid) {
22
+		$sql .= ' AND p.uid = ' . (int)$userid . ' ';
23
+		//return NULL;
24
+	}
25 25
 
26
-    // Права на просмотр
27
-    $categories = Xoopsmodules\instruction\Utility::getItemIds();
28
-    if (is_array($categories) && count($categories) > 0) {
29
-        $sql .= ' AND i.cid IN ( ' . implode(', ', $categories) . ' ) ';
30
-        // Если пользователь не имеет прав просмотра ни одной категории
31
-    } else {
32
-        return null;
33
-    }
26
+	// Права на просмотр
27
+	$categories = Xoopsmodules\instruction\Utility::getItemIds();
28
+	if (is_array($categories) && count($categories) > 0) {
29
+		$sql .= ' AND i.cid IN ( ' . implode(', ', $categories) . ' ) ';
30
+		// Если пользователь не имеет прав просмотра ни одной категории
31
+	} else {
32
+		return null;
33
+	}
34 34
 
35
-    // Добавляем в условие ключевые слова поиска
36
-    if (is_array($queryarray) && $count = count($queryarray)) {
37
-        $sql .= " AND ( ( p.title LIKE '%$queryarray[0]%' OR p.hometext LIKE '%$queryarray[0]%' )";
38
-        for ($i = 1; $i < $count; $i++) {
39
-            $sql .= " $andor ";
40
-            $sql .= "( p.title LIKE '%$queryarray[$i]%' OR p.hometext LIKE '%$queryarray[$i]%' )";
41
-        }
42
-        $sql .= ' ) ';
43
-    }
44
-    //$sql .= "ORDER BY date DESC";
45
-    $result = $GLOBALS['xoopsDB']->query($sql, $limit, $offset);
46
-    $ret    = [];
47
-    $i      = 0;
48
-    // Перебираем все результаты
49
-    while (list($pageid, $ptitle, $puid, $pdatecreated, $ititle) = $GLOBALS['xoopsDB']->fetchRow($result)) {
50
-        $ret[$i]['image'] = 'assets/images/size2.gif';
51
-        $ret[$i]['link']  = 'page.php?id=' . $pageid;
52
-        $ret[$i]['title'] = $ititle . ': ' . $ptitle;
53
-        $ret[$i]['time']  = $pdatecreated;
54
-        $ret[$i]['uid']   = $puid;
55
-        $i++;
56
-    }
57
-    return $ret;
35
+	// Добавляем в условие ключевые слова поиска
36
+	if (is_array($queryarray) && $count = count($queryarray)) {
37
+		$sql .= " AND ( ( p.title LIKE '%$queryarray[0]%' OR p.hometext LIKE '%$queryarray[0]%' )";
38
+		for ($i = 1; $i < $count; $i++) {
39
+			$sql .= " $andor ";
40
+			$sql .= "( p.title LIKE '%$queryarray[$i]%' OR p.hometext LIKE '%$queryarray[$i]%' )";
41
+		}
42
+		$sql .= ' ) ';
43
+	}
44
+	//$sql .= "ORDER BY date DESC";
45
+	$result = $GLOBALS['xoopsDB']->query($sql, $limit, $offset);
46
+	$ret    = [];
47
+	$i      = 0;
48
+	// Перебираем все результаты
49
+	while (list($pageid, $ptitle, $puid, $pdatecreated, $ititle) = $GLOBALS['xoopsDB']->fetchRow($result)) {
50
+		$ret[$i]['image'] = 'assets/images/size2.gif';
51
+		$ret[$i]['link']  = 'page.php?id=' . $pageid;
52
+		$ret[$i]['title'] = $ititle . ': ' . $ptitle;
53
+		$ret[$i]['time']  = $pdatecreated;
54
+		$ret[$i]['uid']   = $puid;
55
+		$i++;
56
+	}
57
+	return $ret;
58 58
 }
Please login to merge, or discard this patch.
class/common/VersionChecks.php 1 patch
Indentation   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -17,77 +17,77 @@
 block discarded – undo
17 17
  */
18 18
 trait VersionChecks
19 19
 {
20
-    /**
21
-     *
22
-     * Verifies XOOPS version meets minimum requirements for this module
23
-     * @static
24
-     * @param \XoopsModule|null $module
25
-     *
26
-     * @param null|string       $requiredVer
27
-     * @return bool true if meets requirements, false if not
28
-     */
29
-    public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null)
30
-    {
31
-        $moduleDirName = basename(dirname(dirname(__DIR__)));
32
-        if (null === $module) {
33
-            $module = \XoopsModule::getByDirname($moduleDirName);
34
-        }
35
-        xoops_loadLanguage('admin', $moduleDirName);
36
-        //check for minimum XOOPS version
37
-        $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
38
-        $currArray  = explode('.', $currentVer);
39
-        if (null === $requiredVer) {
40
-            $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
41
-        }
42
-        $reqArray = explode('.', $requiredVer);
43
-        $success  = true;
44
-        foreach ($reqArray as $k => $v) {
45
-            if (isset($currArray[$k])) {
46
-                if ($currArray[$k] > $v) {
47
-                    break;
48
-                } elseif ($currArray[$k] == $v) {
49
-                    continue;
50
-                } else {
51
-                    $success = false;
52
-                    break;
53
-                }
54
-            } else {
55
-                if ((int)$v > 0) { // handles versions like x.x.x.0_RC2
56
-                    $success = false;
57
-                    break;
58
-                }
59
-            }
60
-        }
20
+	/**
21
+	 *
22
+	 * Verifies XOOPS version meets minimum requirements for this module
23
+	 * @static
24
+	 * @param \XoopsModule|null $module
25
+	 *
26
+	 * @param null|string       $requiredVer
27
+	 * @return bool true if meets requirements, false if not
28
+	 */
29
+	public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null)
30
+	{
31
+		$moduleDirName = basename(dirname(dirname(__DIR__)));
32
+		if (null === $module) {
33
+			$module = \XoopsModule::getByDirname($moduleDirName);
34
+		}
35
+		xoops_loadLanguage('admin', $moduleDirName);
36
+		//check for minimum XOOPS version
37
+		$currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string
38
+		$currArray  = explode('.', $currentVer);
39
+		if (null === $requiredVer) {
40
+			$requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string
41
+		}
42
+		$reqArray = explode('.', $requiredVer);
43
+		$success  = true;
44
+		foreach ($reqArray as $k => $v) {
45
+			if (isset($currArray[$k])) {
46
+				if ($currArray[$k] > $v) {
47
+					break;
48
+				} elseif ($currArray[$k] == $v) {
49
+					continue;
50
+				} else {
51
+					$success = false;
52
+					break;
53
+				}
54
+			} else {
55
+				if ((int)$v > 0) { // handles versions like x.x.x.0_RC2
56
+					$success = false;
57
+					break;
58
+				}
59
+			}
60
+		}
61 61
 
62
-        if (false === $success) {
63
-            $module->setErrors(sprintf(_AM_INSTRUCTION_ERROR_BAD_XOOPS, $requiredVer, $currentVer));
64
-        }
62
+		if (false === $success) {
63
+			$module->setErrors(sprintf(_AM_INSTRUCTION_ERROR_BAD_XOOPS, $requiredVer, $currentVer));
64
+		}
65 65
 
66
-        return $success;
67
-    }
66
+		return $success;
67
+	}
68 68
 
69
-    /**
70
-     *
71
-     * Verifies PHP version meets minimum requirements for this module
72
-     * @static
73
-     * @param \XoopsModule $module
74
-     *
75
-     * @return bool true if meets requirements, false if not
76
-     */
77
-    public static function checkVerPhp(\XoopsModule $module)
78
-    {
79
-        xoops_loadLanguage('admin', $module->dirname());
80
-        // check for minimum PHP version
81
-        $success = true;
82
-        $verNum  = PHP_VERSION;
83
-        $reqVer  = $module->getInfo('min_php');
84
-        if (false !== $reqVer && '' !== $reqVer) {
85
-            if (version_compare($verNum, $reqVer, '<')) {
86
-                $module->setErrors(sprintf(_AM_INSTRUCTION_ERROR_BAD_PHP, $reqVer, $verNum));
87
-                $success = false;
88
-            }
89
-        }
69
+	/**
70
+	 *
71
+	 * Verifies PHP version meets minimum requirements for this module
72
+	 * @static
73
+	 * @param \XoopsModule $module
74
+	 *
75
+	 * @return bool true if meets requirements, false if not
76
+	 */
77
+	public static function checkVerPhp(\XoopsModule $module)
78
+	{
79
+		xoops_loadLanguage('admin', $module->dirname());
80
+		// check for minimum PHP version
81
+		$success = true;
82
+		$verNum  = PHP_VERSION;
83
+		$reqVer  = $module->getInfo('min_php');
84
+		if (false !== $reqVer && '' !== $reqVer) {
85
+			if (version_compare($verNum, $reqVer, '<')) {
86
+				$module->setErrors(sprintf(_AM_INSTRUCTION_ERROR_BAD_PHP, $reqVer, $verNum));
87
+				$success = false;
88
+			}
89
+		}
90 90
 
91
-        return $success;
92
-    }
91
+		return $success;
92
+	}
93 93
 }
Please login to merge, or discard this patch.
index.php 1 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.
class/Page.php 1 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/InstructionHandler.php 1 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.