This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
1 | <?php |
||||
2 | |||||
3 | /* |
||||
4 | * You may not change or alter any portion of this comment or credits |
||||
5 | * of supporting developers from this source code or any supporting source code |
||||
6 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||||
7 | * |
||||
8 | * This program is distributed in the hope that it will be useful, |
||||
9 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||||
10 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||||
11 | */ |
||||
12 | |||||
13 | /** |
||||
14 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||||
15 | * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
||||
16 | * @author Kazumi Ono (AKA onokazu) http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ |
||||
17 | * @author XOOPS Development Team |
||||
18 | */ |
||||
19 | |||||
20 | use XoopsModules\Blocksadmin\Helper; |
||||
21 | /** @var Helper $helper */ |
||||
22 | /** @var \XoopsConfigHandler $configHandler */ |
||||
23 | |||||
24 | $configHandler = xoops_getHandler('config'); |
||||
25 | |||||
26 | if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) { |
||||
27 | exit('Access Denied'); |
||||
28 | } |
||||
29 | $op = 'list'; |
||||
30 | if (!empty($_POST['op'])) { |
||||
31 | $op = $_POST['op']; |
||||
32 | } |
||||
33 | if (isset($_GET['op'])) { |
||||
34 | $op = trim($_GET['op']); |
||||
35 | } |
||||
36 | if (isset($_GET['confcat_id'])) { |
||||
37 | $confcat_id = (int)$_GET['confcat_id']; |
||||
38 | } |
||||
39 | /* if ($op == 'list') { |
||||
40 | $confcatHandler = xoops_getHandler('configcategory'); |
||||
41 | $confcats =& $confcatHandler->getObjects(); |
||||
42 | $catcount = count($confcats); |
||||
43 | xoops_cp_header(); |
||||
44 | echo '<h4 style="text-align:left">'._MD_AM_SITEPREF.'</h4><ul>'; |
||||
45 | for ($i = 0; $i < $catcount; ++$i) { |
||||
46 | echo '<li>'.constant($confcats[$i]->getVar('confcat_name')).' [<a href="admin.php?fct=preferences&op=show&confcat_id='.$confcats[$i]->getVar('confcat_id').'">'._EDIT.'</a>]</li>'; |
||||
47 | } |
||||
48 | echo '</ul>'; |
||||
49 | xoops_cp_footer(); |
||||
50 | exit(); |
||||
51 | } */ |
||||
52 | |||||
53 | /* if ($op == 'show') { |
||||
54 | if (empty($confcat_id)) { |
||||
55 | $confcat_id = 1; |
||||
56 | } |
||||
57 | $confcatHandler = xoops_getHandler('configcategory'); |
||||
58 | $confcat =& $confcatHandler->get($confcat_id); |
||||
59 | if (!is_object($confcat)) { |
||||
60 | redirect_header('admin.php?fct=preferences', 1); |
||||
61 | } |
||||
62 | require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; |
||||
63 | require_once XOOPS_ROOT_PATH.'/class/xoopslists.php'; |
||||
64 | $form = new XoopsThemeForm(constant($confcat->getVar('confcat_name')), 'pref_form', 'admin.php?fct=preferences'); |
||||
65 | |||||
66 | $configHandler = xoops_getHandler('config'); |
||||
67 | $criteria = new CriteriaCompo(); |
||||
68 | $criteria->add(new Criteria('conf_modid', 0)); |
||||
69 | $criteria->add(new Criteria('conf_catid', $confcat_id)); |
||||
70 | $config =& $configHandler->getConfigs($criteria); |
||||
71 | $confcount = count($config); |
||||
72 | for ($i = 0; $i < $confcount; ++$i) { |
||||
73 | $title = (!defined($config[$i]->getVar('conf_desc')) || constant($config[$i]->getVar('conf_desc')) == '') ? constant($config[$i]->getVar('conf_title')) : constant($config[$i]->getVar('conf_title')) |
||||
74 | . '<br><br><span style="font-weight:normal;">' |
||||
75 | . constant($config[$i]->getVar('conf_desc')) |
||||
76 | . '</span>'; |
||||
77 | switch ($config[$i]->getVar('conf_formtype')) { |
||||
78 | case 'textarea': |
||||
79 | $myts = MyTextSanitizer::getInstance(); |
||||
80 | if ($config[$i]->getVar('conf_valuetype') == 'array') { |
||||
81 | // this is exceptional.. only when value type is arrayneed a smarter way for this |
||||
82 | $ele = ($config[$i]->getVar('conf_value') != '') ? new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), htmlspecialchars(implode('|', $config[$i]->getConfValueForOutput())), 5, 50) : new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), '', 5, 50); |
||||
83 | } else { |
||||
84 | $ele = new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), htmlspecialchars($config[$i]->getConfValueForOutput()), 5, 50); |
||||
85 | } |
||||
86 | break; |
||||
87 | case 'select': |
||||
88 | $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
||||
89 | $options =& $configHandler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); |
||||
90 | $opcount = count($options); |
||||
91 | for ($j = 0; $j < $opcount; $j++) { |
||||
92 | $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); |
||||
93 | $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); |
||||
94 | $ele->addOption($optval, $optkey); |
||||
95 | } |
||||
96 | break; |
||||
97 | case 'select_multi': |
||||
98 | $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), 5, true); |
||||
99 | $options =& $configHandler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); |
||||
100 | $opcount = count($options); |
||||
101 | for ($j = 0; $j < $opcount; $j++) { |
||||
102 | $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); |
||||
103 | $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); |
||||
104 | $ele->addOption($optval, $optkey); |
||||
105 | } |
||||
106 | break; |
||||
107 | case 'yesno': |
||||
108 | $ele = new XoopsFormRadioYN($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), _YES, _NO); |
||||
109 | break; |
||||
110 | case 'theme': |
||||
111 | case 'theme_multi': |
||||
112 | $ele = ($config[$i]->getVar('conf_formtype') != 'theme_multi') ? new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()) : new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), 5, true); |
||||
113 | $handle = opendir(XOOPS_THEME_PATH . '/'); |
||||
114 | $dirlist = []; |
||||
115 | while (false !== ($file = readdir($handle))) { |
||||
116 | if (is_dir(XOOPS_THEME_PATH . '/' . $file) && !preg_match('/^[.]{1,2}$/', $file) && strtolower($file) != 'cvs') { |
||||
117 | $dirlist[$file] = $file; |
||||
118 | } |
||||
119 | } |
||||
120 | closedir($handle); |
||||
121 | if (!empty($dirlist)) { |
||||
122 | asort($dirlist); |
||||
123 | $ele->addOptionArray($dirlist); |
||||
124 | } |
||||
125 | //$themesetHandler = xoops_getHandler('themeset'); |
||||
126 | //$themesetlist =& $themesetHandler->getList(); |
||||
127 | //asort($themesetlist); |
||||
128 | //foreach ($themesetlist as $key => $name) { |
||||
129 | // $ele->addOption($key, $name.' ('._MD_AM_THEMESET.')'); |
||||
130 | //} |
||||
131 | // old theme value is used to determine whether to update cache or not. kind of dirty way |
||||
132 | $form->addElement(new XoopsFormHidden('_old_theme', $config[$i]->getConfValueForOutput())); |
||||
133 | break; |
||||
134 | case 'tplset': |
||||
135 | $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
||||
136 | $tplsetHandler = xoops_getHandler('tplset'); |
||||
137 | $tplsetlist =& $tplsetHandler->getList(); |
||||
138 | asort($tplsetlist); |
||||
139 | foreach ($tplsetlist as $key => $name) { |
||||
140 | $ele->addOption($key, $name); |
||||
141 | } |
||||
142 | // old theme value is used to determine whether to update cache or not. kind of dirty way |
||||
143 | $form->addElement(new XoopsFormHidden('_old_theme', $config[$i]->getConfValueForOutput())); |
||||
144 | break; |
||||
145 | case 'timezone': |
||||
146 | $ele = new XoopsFormSelectTimezone($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
||||
147 | break; |
||||
148 | case 'language': |
||||
149 | $ele = new XoopsFormSelectLang($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
||||
150 | break; |
||||
151 | case 'startpage': |
||||
152 | $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
||||
153 | |||||
154 | $moduleHandler = xoops_getHandler('module'); |
||||
155 | $criteria = new CriteriaCompo(new Criteria('hasmain', 1)); |
||||
156 | $criteria->add(new Criteria('isactive', 1)); |
||||
157 | $moduleslist = $moduleHandler->getList($criteria, true); |
||||
158 | $moduleslist['--'] = _MD_AM_NONE; |
||||
159 | $ele->addOptionArray($moduleslist); |
||||
160 | break; |
||||
161 | case 'group': |
||||
162 | $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false); |
||||
163 | break; |
||||
164 | case 'group_multi': |
||||
165 | $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true); |
||||
166 | break; |
||||
167 | // RMV-NOTIFY - added 'user' and 'user_multi' |
||||
168 | case 'user': |
||||
169 | $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false); |
||||
170 | break; |
||||
171 | case 'user_multi': |
||||
172 | $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true); |
||||
173 | break; |
||||
174 | case 'module_cache': |
||||
175 | $moduleHandler = xoops_getHandler('module'); |
||||
176 | $modules = $moduleHandler->getObjects(new Criteria('hasmain', 1), true); |
||||
177 | $currrent_val = $config[$i]->getConfValueForOutput(); |
||||
178 | $cache_options = ['0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK]; |
||||
179 | if (count($modules) > 0) { |
||||
180 | $ele = new XoopsFormElementTray($title, '<br>'); |
||||
181 | foreach (array_keys($modules) as $mid) { |
||||
182 | $c_val = isset($currrent_val[$mid]) ? intval($currrent_val[$mid]) : null; |
||||
183 | $selform = new XoopsFormSelect($modules[$mid]->getVar('name'), $config[$i]->getVar('conf_name') . "[$mid]", $c_val); |
||||
184 | $selform->addOptionArray($cache_options); |
||||
185 | $ele->addElement($selform); |
||||
186 | unset($selform); |
||||
187 | } |
||||
188 | } else { |
||||
189 | $ele = new XoopsFormLabel($title, _MD_AM_NOMODULE); |
||||
190 | } |
||||
191 | break; |
||||
192 | case 'site_cache': |
||||
193 | $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
||||
194 | $ele->addOptionArray(['0' => _NOCACHE, '30' => sprintf(_SECONDS, 30), '60' => _MINUTE, '300' => sprintf(_MINUTES, 5), '1800' => sprintf(_MINUTES, 30), '3600' => _HOUR, '18000' => sprintf(_HOURS, 5), '86400' => _DAY, '259200' => sprintf(_DAYS, 3), '604800' => _WEEK]); |
||||
195 | break; |
||||
196 | case 'password': |
||||
197 | $myts = MyTextSanitizer::getInstance(); |
||||
198 | $ele = new XoopsFormPassword($title, $config[$i]->getVar('conf_name'), 50, 255, htmlspecialchars($config[$i]->getConfValueForOutput())); |
||||
199 | break; |
||||
200 | case 'textbox': |
||||
201 | default: |
||||
202 | $myts = MyTextSanitizer::getInstance(); |
||||
203 | $ele = new XoopsFormText($title, $config[$i]->getVar('conf_name'), 50, 255, htmlspecialchars($config[$i]->getConfValueForOutput())); |
||||
204 | break; |
||||
205 | } |
||||
206 | $hidden = new XoopsFormHidden('conf_ids[]', $config[$i]->getVar('conf_id')); |
||||
207 | $form->addElement($ele); |
||||
208 | $form->addElement($hidden); |
||||
209 | unset($ele); |
||||
210 | unset($hidden); |
||||
211 | } |
||||
212 | $form->addElement(new XoopsFormHidden('op', 'save')); |
||||
213 | $xoopsGTicket->addTicketXoopsFormElement($form, __LINE__); |
||||
214 | $form->addElement(new XoopsFormButton('', 'button', _GO, 'submit')); |
||||
215 | xoops_cp_header(); |
||||
216 | echo '<a href="admin.php?fct=preferences">' . _MD_AM_PREFMAIN . '</a> <span style="font-weight:bold;">»»</span> ' . constant($confcat->getVar('confcat_name')) . '<br><br>'; |
||||
217 | $form->display(); |
||||
218 | xoops_cp_footer(); |
||||
219 | exit(); |
||||
220 | } */ |
||||
221 | |||||
222 | if ('showmod' === $op) { |
||||
223 | $mod = isset($_GET['mod']) ? (int)$_GET['mod'] : 0; |
||||
224 | if (empty($mod)) { |
||||
225 | header('Location: admin.php?fct=preferences'); |
||||
226 | exit(); |
||||
227 | } |
||||
228 | $config = &$configHandler->getConfigs(new Criteria('conf_modid', $mod)); |
||||
229 | $count = count($config); |
||||
230 | if ($count < 1) { |
||||
231 | redirect_header('admin.php?fct=preferences', 1); |
||||
232 | } |
||||
233 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||||
234 | $form = new XoopsThemeForm(_MD_AM_MODCONFIG, 'pref_form', 'admin.php?fct=preferences'); |
||||
235 | $moduleHandler = xoops_getHandler('module'); |
||||
236 | $module = $moduleHandler->get($mod); |
||||
237 | // if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php')) { |
||||
238 | // require_once XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php'; |
||||
239 | // } |
||||
240 | |||||
241 | $helper = Helper::getInstance(); |
||||
242 | $helper->loadLanguage('modinfo'); |
||||
243 | |||||
244 | // if has comments feature, need comment lang file |
||||
245 | if (1 == $module->getVar('hascomments')) { |
||||
246 | require_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/comment.php'; |
||||
247 | } |
||||
248 | // RMV-NOTIFY |
||||
249 | // if has notification feature, need notification lang file |
||||
250 | if (1 == $module->getVar('hasnotification')) { |
||||
251 | require_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/notification.php'; |
||||
252 | } |
||||
253 | |||||
254 | $modname = $module->getVar('name'); |
||||
255 | $button_tray = new XoopsFormElementTray(''); |
||||
256 | if ($module->getInfo('adminindex')) { |
||||
257 | // $form->addElement(new XoopsFormHidden('redirect', XOOPS_URL.'/modules/'.$module->getVar('dirname').'/'.$module->getInfo('adminindex'))); |
||||
258 | $button_tray->addElement(new XoopsFormHidden('redirect', XOOPS_URL . '/modules/' . $module->getVar('dirname') . '/admin/admin.php?fct=preferences&op=showmod&mod=' . $module->getVar('mid'))); // GIJ Patch |
||||
259 | } |
||||
260 | for ($i = 0; $i < $count; ++$i) { |
||||
261 | $title4tray = (!defined($config[$i]->getVar('conf_desc')) || '' == constant($config[$i]->getVar('conf_desc'))) ? constant($config[$i]->getVar('conf_title')) : constant($config[$i]->getVar('conf_title')) . '<br><br><span style="font-weight:normal;">' . constant( |
||||
262 | $config[$i]->getVar('conf_desc') |
||||
263 | ) . '</span>'; // GIJ |
||||
264 | $title = ''; // GIJ |
||||
265 | switch ($config[$i]->getVar('conf_formtype')) { |
||||
266 | case 'textarea': |
||||
267 | $myts = MyTextSanitizer::getInstance(); |
||||
268 | if ('array' === $config[$i]->getVar('conf_valuetype')) { |
||||
269 | // this is exceptional.. only when value type is arrayneed a smarter way for this |
||||
270 | $ele = ('' != $config[$i]->getVar('conf_value')) ? new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), htmlspecialchars(implode('|', $config[$i]->getConfValueForOutput()), ENT_QUOTES | ENT_HTML5), 5, 50) : new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), '', 5, 50); |
||||
271 | } else { |
||||
272 | $ele = new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), htmlspecialchars($config[$i]->getConfValueForOutput(), ENT_QUOTES | ENT_HTML5), 5, 50); |
||||
273 | } |
||||
274 | break; |
||||
275 | case 'select': |
||||
276 | $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
||||
277 | $options = &$configHandler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); |
||||
278 | $opcount = count($options); |
||||
279 | for ($j = 0; $j < $opcount; $j++) { |
||||
280 | $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); |
||||
281 | $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); |
||||
282 | $ele->addOption($optval, $optkey); |
||||
283 | } |
||||
284 | break; |
||||
285 | case 'select_multi': |
||||
286 | $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), 5, true); |
||||
287 | $options = &$configHandler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); |
||||
288 | $opcount = count($options); |
||||
289 | for ($j = 0; $j < $opcount; $j++) { |
||||
290 | $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); |
||||
291 | $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); |
||||
292 | $ele->addOption($optval, $optkey); |
||||
293 | } |
||||
294 | break; |
||||
295 | case 'yesno': |
||||
296 | $ele = new XoopsFormRadioYN($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), _YES, _NO); |
||||
297 | break; |
||||
298 | case 'group': |
||||
299 | require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
||||
300 | $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false); |
||||
301 | break; |
||||
302 | case 'group_multi': |
||||
303 | require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
||||
304 | $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true); |
||||
305 | break; |
||||
306 | // RMV-NOTIFY: added 'user' and 'user_multi' |
||||
307 | case 'user': |
||||
308 | require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
||||
309 | $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false); |
||||
310 | break; |
||||
311 | case 'user_multi': |
||||
312 | require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
||||
313 | $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true); |
||||
314 | break; |
||||
315 | case 'password': |
||||
316 | $myts = MyTextSanitizer::getInstance(); |
||||
317 | $ele = new XoopsFormPassword($title, $config[$i]->getVar('conf_name'), 50, 255, htmlspecialchars($config[$i]->getConfValueForOutput(), ENT_QUOTES | ENT_HTML5)); |
||||
318 | break; |
||||
319 | case 'textbox': |
||||
320 | default: |
||||
321 | $myts = MyTextSanitizer::getInstance(); |
||||
322 | $ele = new XoopsFormText($title, $config[$i]->getVar('conf_name'), 50, 255, htmlspecialchars($config[$i]->getConfValueForOutput(), ENT_QUOTES | ENT_HTML5)); |
||||
323 | break; |
||||
324 | } |
||||
325 | $hidden = new XoopsFormHidden('conf_ids[]', $config[$i]->getVar('conf_id')); |
||||
326 | $ele_tray = new XoopsFormElementTray($title4tray, ''); |
||||
327 | $ele_tray->addElement($ele); |
||||
328 | $ele_tray->addElement($hidden); |
||||
329 | $form->addElement($ele_tray); |
||||
330 | unset($ele_tray); |
||||
331 | unset($ele); |
||||
332 | unset($hidden); |
||||
333 | } |
||||
334 | $button_tray->addElement(new XoopsFormHidden('op', 'save')); |
||||
335 | $GLOBALS['xoopsSecurity']->getTokenHTML(); |
||||
336 | $button_tray->addElement(new XoopsFormButton('', 'button', _GO, 'submit')); |
||||
337 | $form->addElement($button_tray); |
||||
338 | xoops_cp_header(); |
||||
339 | // GIJ patch start |
||||
340 | require __DIR__ . '/mymenu.php'; |
||||
341 | echo "<h3 style='text-align:left;'>" . $module->getVar('name') . ' ' . _PREFERENCES . "</h3>\n"; |
||||
342 | // GIJ patch end |
||||
343 | $form->display(); |
||||
344 | xoops_cp_footer(); |
||||
345 | exit(); |
||||
346 | } |
||||
347 | |||||
348 | if ('save' === $op) { |
||||
349 | //if ( !admin_refcheck("/modules/$admin_mydirname/admin/") ) { |
||||
350 | // exit('Invalid referer'); |
||||
351 | //} |
||||
352 | if (!$GLOBALS['xoopsSecurity']->check(true, 'mymenu')) { |
||||
353 | redirect_header(XOOPS_URL . '/', 3, $GLOBALS['xoopsSecurity']->getErrors()); |
||||
354 | } |
||||
355 | require_once XOOPS_ROOT_PATH . '/class/template.php'; |
||||
356 | $xoopsTpl = new XoopsTpl(); |
||||
357 | $xoopsTpl->clear_all_cache(); |
||||
358 | // regenerate admin menu file |
||||
359 | xoops_module_write_admin_menu(xoops_module_get_admin_menu()); |
||||
0 ignored issues
–
show
Deprecated Code
introduced
by
![]() |
|||||
360 | if (!empty($_POST['conf_ids'])) { |
||||
361 | $conf_ids = $_POST['conf_ids']; |
||||
362 | } |
||||
363 | $count = count($conf_ids); |
||||
364 | $tpl_updated = false; |
||||
365 | $theme_updated = false; |
||||
366 | $startmod_updated = false; |
||||
367 | $lang_updated = false; |
||||
368 | if ($count > 0) { |
||||
369 | for ($i = 0; $i < $count; ++$i) { |
||||
370 | $config = &$configHandler->getConfig($conf_ids[$i]); |
||||
371 | $new_value = &$_POST[$config->getVar('conf_name')]; |
||||
372 | if (is_array($new_value) || $new_value != $config->getVar('conf_value')) { |
||||
373 | // if language has been changed |
||||
374 | if (!$lang_updated && XOOPS_CONF == $config->getVar('conf_catid') && 'language' === $config->getVar('conf_name')) { |
||||
375 | // regenerate admin menu file |
||||
376 | $xoopsConfig['language'] = $_POST[$config->getVar('conf_name')]; |
||||
377 | xoops_module_write_admin_menu(xoops_module_get_admin_menu()); |
||||
0 ignored issues
–
show
The function
xoops_module_get_admin_menu() has been deprecated.
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
![]() |
|||||
378 | $lang_updated = true; |
||||
379 | } |
||||
380 | |||||
381 | // if default theme has been changed |
||||
382 | if (!$theme_updated && XOOPS_CONF == $config->getVar('conf_catid') && 'theme_set' === $config->getVar('conf_name')) { |
||||
383 | /** @var \XoopsMemberHandler $memberHandler */ |
||||
384 | $memberHandler = xoops_getHandler('member'); |
||||
385 | $memberHandler->updateUsersByField('theme', $_POST[$config->getVar('conf_name')]); |
||||
386 | $theme_updated = true; |
||||
387 | } |
||||
388 | |||||
389 | // if default template set has been changed |
||||
390 | if (!$tpl_updated && XOOPS_CONF == $config->getVar('conf_catid') && 'template_set' === $config->getVar('conf_name')) { |
||||
391 | // clear cached/compiled files and regenerate them if default theme has been changed |
||||
392 | if ($xoopsConfig['template_set'] != $_POST[$config->getVar('conf_name')]) { |
||||
393 | $newtplset = $_POST[$config->getVar('conf_name')]; |
||||
394 | |||||
395 | // clear all compiled and cachedfiles |
||||
396 | $xoopsTpl->clear_compiled_tpl(); |
||||
397 | |||||
398 | // generate compiled files for the new theme |
||||
399 | // block files only for now.. |
||||
400 | /** @var \XoopsTplfileHandler $tplfileHandler */ |
||||
401 | $tplfileHandler = xoops_getHandler('tplfile'); |
||||
402 | $dtemplates = $tplfileHandler->find('default', 'block'); |
||||
403 | $dcount = count($dtemplates); |
||||
404 | |||||
405 | // need to do this to pass to xoops_template_touch function |
||||
406 | $GLOBALS['xoopsConfig']['template_set'] = $newtplset; |
||||
407 | |||||
408 | for ($j = 0; $j < $dcount; ++$j) { |
||||
409 | $found = $tplfileHandler->find($newtplset, 'block', $dtemplates[$j]->getVar('tpl_refid'), null); |
||||
410 | if (count($found) > 0) { |
||||
411 | // template for the new theme found, compile it |
||||
412 | xoops_template_touch($found[0]->getVar('tpl_id')); |
||||
413 | } else { |
||||
414 | // not found, so compile 'default' template file |
||||
415 | xoops_template_touch($dtemplates[$j]->getVar('tpl_id')); |
||||
416 | } |
||||
417 | } |
||||
418 | |||||
419 | // generate image cache files from image binary data, save them under cache/ |
||||
420 | $imageHandler = xoops_getHandler('imagesetimg'); |
||||
421 | $imagefiles = &$imageHandler->getObjects(new Criteria('tplset_name', $newtplset), true); |
||||
422 | foreach (array_keys($imagefiles) as $j) { |
||||
423 | if ($fp = fopen(XOOPS_CACHE_PATH . '/' . $newtplset . '_' . $imagefiles[$j]->getVar('imgsetimg_file'), 'wb')) { |
||||
424 | fwrite($fp, $imagefiles[$j]->getVar('imgsetimg_body')); |
||||
425 | fclose($fp); |
||||
426 | } else { |
||||
427 | } |
||||
428 | } |
||||
429 | } |
||||
430 | $tpl_updated = true; |
||||
431 | } |
||||
432 | |||||
433 | // add read permission for the start module to all groups |
||||
434 | if (!$startmod_updated && '--' != $new_value && XOOPS_CONF == $config->getVar('conf_catid') && 'startpage' === $config->getVar('conf_name')) { |
||||
435 | /** @var \XoopsMemberHandler $memberHandler */ |
||||
436 | $memberHandler = xoops_getHandler('member'); |
||||
437 | $groups = $memberHandler->getGroupList(); |
||||
438 | /** @var \XoopsGroupPermHandler $grouppermHandler */ |
||||
439 | $grouppermHandler = xoops_getHandler('groupperm'); |
||||
440 | /** @var \XoopsModuleHandler $moduleHandler */ |
||||
441 | $moduleHandler = xoops_getHandler('module'); |
||||
442 | $module = $moduleHandler->getByDirname($new_value); |
||||
443 | foreach ($groups as $groupid => $groupname) { |
||||
444 | if (!$grouppermHandler->checkRight('module_read', $module->getVar('mid'), $groupid)) { |
||||
445 | $grouppermHandler->addRight('module_read', $module->getVar('mid'), $groupid); |
||||
446 | } |
||||
447 | } |
||||
448 | $startmod_updated = true; |
||||
449 | } |
||||
450 | |||||
451 | $config->setConfValueForInput($new_value); |
||||
452 | $configHandler->insertConfig($config); |
||||
453 | } |
||||
454 | unset($new_value); |
||||
455 | } |
||||
456 | } |
||||
457 | /* if (!empty($_POST['use_mysession']) && $xoopsConfig['use_mysession'] == 0 && $_POST['session_name'] != '') { |
||||
458 | setcookie($_POST['session_name'], session_id(), time()+(60*intval($_POST['session_expire'])), '/', '', 0); |
||||
459 | } */ |
||||
460 | if (!empty($_POST['redirect'])) { |
||||
461 | redirect_header($_POST['redirect'], 2, _AM_SYSTEM_DBUPDATED); |
||||
462 | } else { |
||||
463 | redirect_header('admin.php?fct=preferences', 2, _AM_SYSTEM_DBUPDATED); |
||||
464 | } |
||||
465 | } |
||||
466 |