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.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | /* |
||
3 | * You may not change or alter any portion of this comment or credits |
||
4 | * of supporting developers from this source code or any supporting source code |
||
5 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
6 | * |
||
7 | * This program is distributed in the hope that it will be useful, |
||
8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
10 | */ |
||
11 | |||
12 | /** |
||
13 | * @copyright {@link http://xoops.org/ XOOPS Project} |
||
14 | * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
||
15 | * @package |
||
16 | * @since |
||
17 | * @author XOOPS Development Team, |
||
18 | * @author GIJ=CHECKMATE (PEAK Corp. http://www.peak.ne.jp/) |
||
19 | * @author Antiques Promotion (http://www.antiquespromotion.ca) |
||
20 | */ |
||
21 | |||
22 | $configHandler = xoops_getHandler('config'); |
||
23 | |||
24 | if (!is_object($xoopsUser) || !is_object($xoopsModule) || !$xoopsUser->isAdmin($xoopsModule->mid())) { |
||
25 | exit('Access Denied'); |
||
26 | } else { |
||
27 | $op = 'list'; |
||
28 | if (!empty($_POST['op'])) { |
||
29 | $op = $_POST['op']; |
||
30 | } |
||
31 | if (isset($_GET['op'])) { |
||
32 | $op = trim($_GET['op']); |
||
33 | } |
||
34 | if (isset($_GET['confcat_id'])) { |
||
35 | $confcat_id = (int)$_GET['confcat_id']; |
||
36 | } |
||
37 | |||
38 | if ($op === 'showmod') { |
||
39 | $mod = isset($_GET['mod']) ? (int)$_GET['mod'] : 0; |
||
40 | if (empty($mod)) { |
||
41 | header('Location: admin.php?fct=preferences'); |
||
42 | exit(); |
||
43 | } |
||
44 | $config = $configHandler->getConfigs(new Criteria('conf_modid', $mod)); |
||
45 | $count = count($config); |
||
46 | if ($count < 1) { |
||
47 | redirect_header('admin.php?fct=preferences', 1); |
||
48 | } |
||
49 | require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; |
||
50 | $form = new XoopsThemeForm(_MD_APCAL_MODCONFIG, 'pref_form', 'admin.php?fct=preferences'); |
||
51 | /** @var XoopsModuleHandler $moduleHandler */ |
||
52 | $moduleHandler = xoops_getHandler('module'); |
||
53 | $module = $moduleHandler->get($mod); |
||
54 | if (file_exists(XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php')) { |
||
55 | require_once XOOPS_ROOT_PATH . '/modules/' . $module->getVar('dirname') . '/language/' . $xoopsConfig['language'] . '/modinfo.php'; |
||
56 | } |
||
57 | |||
58 | // if has comments feature, need comment lang file |
||
59 | View Code Duplication | if ($module->getVar('hascomments') == 1) { |
|
0 ignored issues
–
show
|
|||
60 | require_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/comment.php'; |
||
61 | } |
||
62 | // RMV-NOTIFY |
||
63 | // if has notification feature, need notification lang file |
||
64 | View Code Duplication | if ($module->getVar('hasnotification') == 1) { |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
65 | require_once XOOPS_ROOT_PATH . '/language/' . $xoopsConfig['language'] . '/notification.php'; |
||
66 | } |
||
67 | |||
68 | $modname = $module->getVar('name'); |
||
69 | $button_tray = new XoopsFormElementTray(''); |
||
70 | if ($module->getInfo('adminindex')) { |
||
71 | // $form->addElement(new XoopsFormHidden('redirect', XOOPS_URL.'/modules/'.$module->getVar('dirname').'/'.$module->getInfo('adminindex'))); |
||
72 | $button_tray->addElement(new XoopsFormHidden('redirect', XOOPS_URL |
||
73 | . '/modules/' |
||
74 | . $module->getVar('dirname') |
||
75 | . '/admin/admin.php?fct=preferences&op=showmod&mod=' |
||
76 | . $module->getVar('mid'))); // GIJ Patch |
||
77 | } |
||
78 | for ($i = 0; $i < $count; ++$i) { |
||
79 | $title4tray = (!defined($config[$i]->getVar('conf_desc')) |
||
80 | || constant($config[$i]->getVar('conf_desc')) === '') ? constant($config[$i]->getVar('conf_title')) : constant($config[$i]->getVar('conf_title')) |
||
81 | . '<br><br><span style="font-weight:normal;">' |
||
82 | . constant($config[$i]->getVar('conf_desc')) |
||
83 | . '</span>'; // GIJ |
||
84 | $title = ''; // GIJ |
||
85 | switch ($config[$i]->getVar('conf_formtype')) { |
||
86 | case 'textarea': |
||
87 | $myts = MyTextSanitizer::getInstance(); |
||
88 | if ($config[$i]->getVar('conf_valuetype') === 'array') { |
||
89 | // this is exceptional.. only when value type is arrayneed a smarter way for this |
||
90 | $ele = ($config[$i]->getVar('conf_value') !== '') ? new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), |
||
91 | $myts->htmlspecialchars(implode('|', $config[$i]->getConfValueForOutput())), 5, |
||
92 | 50) : new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), '', 5, 50); |
||
93 | } else { |
||
94 | $ele = new XoopsFormTextArea($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars($config[$i]->getConfValueForOutput()), 5, 50); |
||
95 | } |
||
96 | break; |
||
97 | View Code Duplication | case 'select': |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
98 | $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput()); |
||
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 | View Code Duplication | case 'select_multi': |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
108 | $ele = new XoopsFormSelect($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), 5, true); |
||
109 | $options = $configHandler->getConfigOptions(new Criteria('conf_id', $config[$i]->getVar('conf_id'))); |
||
110 | $opcount = count($options); |
||
111 | for ($j = 0; $j < $opcount; ++$j) { |
||
112 | $optval = defined($options[$j]->getVar('confop_value')) ? constant($options[$j]->getVar('confop_value')) : $options[$j]->getVar('confop_value'); |
||
113 | $optkey = defined($options[$j]->getVar('confop_name')) ? constant($options[$j]->getVar('confop_name')) : $options[$j]->getVar('confop_name'); |
||
114 | $ele->addOption($optval, $optkey); |
||
115 | } |
||
116 | break; |
||
117 | case 'yesno': |
||
118 | $ele = new XoopsFormRadioYN($title, $config[$i]->getVar('conf_name'), $config[$i]->getConfValueForOutput(), _YES, _NO); |
||
119 | break; |
||
120 | View Code Duplication | case 'group': |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
121 | require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
||
122 | $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false); |
||
123 | break; |
||
124 | View Code Duplication | case 'group_multi': |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
125 | require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
||
126 | $ele = new XoopsFormSelectGroup($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true); |
||
127 | break; |
||
128 | // RMV-NOTIFY: added 'user' and 'user_multi' |
||
129 | View Code Duplication | case 'user': |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
130 | require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
||
131 | $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 1, false); |
||
132 | break; |
||
133 | View Code Duplication | case 'user_multi': |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
134 | require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; |
||
135 | $ele = new XoopsFormSelectUser($title, $config[$i]->getVar('conf_name'), false, $config[$i]->getConfValueForOutput(), 5, true); |
||
136 | break; |
||
137 | View Code Duplication | case 'password': |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
138 | $myts = MyTextSanitizer::getInstance(); |
||
139 | $ele = new XoopsFormPassword($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput())); |
||
140 | break; |
||
141 | View Code Duplication | case 'color': |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
142 | $myts = MyTextSanitizer::getInstance(); |
||
143 | $ele = new XoopsFormColorPicker($title, $config[$i]->getVar('conf_name'), $myts->htmlspecialchars($config[$i]->getConfValueForOutput())); |
||
144 | break; |
||
145 | case 'textbox': |
||
146 | View Code Duplication | default: |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
147 | $myts = MyTextSanitizer::getInstance(); |
||
148 | $ele = new XoopsFormText($title, $config[$i]->getVar('conf_name'), 50, 255, $myts->htmlspecialchars($config[$i]->getConfValueForOutput())); |
||
149 | break; |
||
150 | } |
||
151 | $hidden = new XoopsFormHidden('conf_ids[]', $config[$i]->getVar('conf_id')); |
||
152 | $ele_tray = new XoopsFormElementTray($title4tray, ''); |
||
153 | $ele_tray->addElement($ele); |
||
154 | $ele_tray->addElement($hidden); |
||
155 | $form->addElement($ele_tray); |
||
156 | unset($ele_tray, $ele, $hidden); |
||
157 | } |
||
158 | $button_tray->addElement(new XoopsFormHidden('op', 'save')); |
||
159 | $xoopsGTicket->addTicketXoopsFormElement($button_tray, __LINE__, 1800, 'mymenu'); |
||
160 | $button_tray->addElement(new XoopsFormButton('', 'button', _GO, 'submit')); |
||
161 | $form->addElement($button_tray); |
||
162 | xoops_cp_header(); |
||
163 | // GIJ patch start |
||
164 | echo "<h3 style='text-align:left;'>" . $module->getVar('name') . ' ' . _PREFERENCES . "</h3>\n"; |
||
165 | // GIJ patch end |
||
166 | $form->display(); |
||
167 | xoops_cp_footer(); |
||
168 | exit(); |
||
169 | } |
||
170 | |||
171 | if ($op === 'save') { |
||
172 | //if ( !admin_refcheck("/modules/$admin_mydirname/admin/") ) { |
||
173 | // exit('Invalid referer'); |
||
174 | //} |
||
175 | if (!$xoopsGTicket->check(true, 'mymenu')) { |
||
176 | redirect_header(XOOPS_URL . '/', 3, $xoopsGTicket->getErrors()); |
||
177 | } |
||
178 | require_once XOOPS_ROOT_PATH . '/class/template.php'; |
||
179 | $xoopsTpl = new XoopsTpl(); |
||
180 | $xoopsTpl->clear_all_cache(); |
||
181 | // regenerate admin menu file |
||
182 | xoops_module_write_admin_menu(xoops_module_get_admin_menu()); |
||
183 | if (!empty($_POST['conf_ids'])) { |
||
184 | $conf_ids = $_POST['conf_ids']; |
||
185 | } |
||
186 | $count = count($conf_ids); |
||
187 | $tpl_updated = false; |
||
188 | $theme_updated = false; |
||
189 | $startmod_updated = false; |
||
190 | $lang_updated = false; |
||
191 | if ($count > 0) { |
||
192 | for ($i = 0; $i < $count; ++$i) { |
||
193 | $config = $configHandler->getConfig($conf_ids[$i]); |
||
194 | $new_value = $_POST[$config->getVar('conf_name')]; |
||
195 | if (is_array($new_value) || $new_value != $config->getVar('conf_value')) { |
||
196 | // if language has been changed |
||
197 | View Code Duplication | if (!$lang_updated && $config->getVar('conf_catid') == XOOPS_CONF |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
198 | && $config->getVar('conf_name') === 'language' |
||
199 | ) { |
||
200 | // regenerate admin menu file |
||
201 | $xoopsConfig['language'] = $_POST[$config->getVar('conf_name')]; |
||
202 | xoops_module_write_admin_menu(xoops_module_get_admin_menu()); |
||
203 | $lang_updated = true; |
||
204 | } |
||
205 | |||
206 | // if default theme has been changed |
||
207 | View Code Duplication | if (!$theme_updated && $config->getVar('conf_catid') == XOOPS_CONF |
|
0 ignored issues
–
show
This code seems to be duplicated across your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
208 | && $config->getVar('conf_name') === 'theme_set' |
||
209 | ) { |
||
210 | $memberHandler = xoops_getHandler('member'); |
||
211 | $memberHandler->updateUsersByField('theme', $_POST[$config->getVar('conf_name')]); |
||
212 | $theme_updated = true; |
||
213 | } |
||
214 | |||
215 | // if default template set has been changed |
||
216 | if (!$tpl_updated && $config->getVar('conf_catid') == XOOPS_CONF |
||
217 | && $config->getVar('conf_name') === 'template_set' |
||
218 | ) { |
||
219 | // clear cached/compiled files and regenerate them if default theme has been changed |
||
220 | if ($xoopsConfig['template_set'] != $_POST[$config->getVar('conf_name')]) { |
||
221 | $newtplset = $_POST[$config->getVar('conf_name')]; |
||
222 | |||
223 | // clear all compiled and cachedfiles |
||
224 | $xoopsTpl->clear_compiled_tpl(); |
||
225 | |||
226 | // generate compiled files for the new theme |
||
227 | // block files only for now.. |
||
228 | $tplfileHandler = xoops_getHandler('tplfile'); |
||
229 | $dtemplates = $tplfileHandler->find('default', 'block'); |
||
230 | $dcount = count($dtemplates); |
||
231 | |||
232 | // need to do this to pass to xoops_template_touch function |
||
233 | $GLOBALS['xoopsConfig']['template_set'] = $newtplset; |
||
234 | |||
235 | for ($j = 0; $j < $dcount; ++$j) { |
||
236 | $found = $tplfileHandler->find($newtplset, 'block', $dtemplates[$j]->getVar('tpl_refid'), null); |
||
237 | if (count($found) > 0) { |
||
238 | // template for the new theme found, compile it |
||
239 | xoops_template_touch($found[0]->getVar('tpl_id')); |
||
240 | } else { |
||
241 | // not found, so compile 'default' template file |
||
242 | xoops_template_touch($dtemplates[$j]->getVar('tpl_id')); |
||
243 | } |
||
244 | } |
||
245 | |||
246 | // generate image cache files from image binary data, save them under cache/ |
||
247 | $imageHandler = xoops_getHandler('imagesetimg'); |
||
248 | $imagefiles = $imageHandler->getObjects(new Criteria('tplset_name', $newtplset), true); |
||
249 | foreach (array_keys($imagefiles) as $j) { |
||
250 | if (!$fp = fopen(XOOPS_CACHE_PATH . '/' . $newtplset . '_' . $imagefiles[$j]->getVar('imgsetimg_file'), 'wb')) { |
||
251 | } else { |
||
252 | fwrite($fp, $imagefiles[$j]->getVar('imgsetimg_body')); |
||
253 | fclose($fp); |
||
254 | } |
||
255 | } |
||
256 | } |
||
257 | $tpl_updated = true; |
||
258 | } |
||
259 | |||
260 | // add read permission for the start module to all groups |
||
261 | if (!$startmod_updated && $new_value != '--' && $config->getVar('conf_catid') == XOOPS_CONF |
||
262 | && $config->getVar('conf_name') === 'startpage' |
||
263 | ) { |
||
264 | $memberHandler = xoops_getHandler('member'); |
||
265 | $groups = $memberHandler->getGroupList(); |
||
266 | $modulepermHandler = xoops_getHandler('groupperm'); |
||
267 | /** @var XoopsModuleHandler $moduleHandler */ |
||
268 | $moduleHandler = xoops_getHandler('module'); |
||
269 | $module = $moduleHandler->getByDirname($new_value); |
||
270 | foreach ($groups as $groupid => $groupname) { |
||
271 | if (!$modulepermHandler->checkRight('module_read', $module->getVar('mid'), $groupid)) { |
||
272 | $modulepermHandler->addRight('module_read', $module->getVar('mid'), $groupid); |
||
273 | } |
||
274 | } |
||
275 | $startmod_updated = true; |
||
276 | } |
||
277 | |||
278 | $config->setConfValueForInput($new_value); |
||
279 | $configHandler->insertConfig($config); |
||
280 | } |
||
281 | unset($new_value); |
||
282 | } |
||
283 | } |
||
284 | /* if (!empty($_POST['use_mysession']) && $xoopsConfig['use_mysession'] == 0 && $_POST['session_name'] != '') { |
||
285 | setcookie($_POST['session_name'], session_id(), time()+(60*(int)($_POST['session_expire'])), '/', '', 0); |
||
286 | } */ |
||
287 | if (!empty($_POST['redirect'])) { |
||
288 | redirect_header($_POST['redirect'], 2, _MD_APCAL_DBUPDATED); |
||
289 | } else { |
||
290 | redirect_header('admin.php?fct=preferences', 2, _MD_APCAL_DBUPDATED); |
||
291 | } |
||
292 | } |
||
293 | } |
||
294 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.