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 | * ExtGallery Admin settings |
||
5 | * Manage admin pages |
||
6 | * |
||
7 | * You may not change or alter any portion of this comment or credits |
||
8 | * of supporting developers from this source code or any supporting source code |
||
9 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
10 | * This program is distributed in the hope that it will be useful, |
||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
13 | * |
||
14 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
15 | * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) |
||
16 | * @author Zoullou (http://www.zoullou.net) |
||
17 | * @package ExtGallery |
||
18 | */ |
||
19 | |||
20 | use Xmf\Request; |
||
21 | |||
22 | require_once __DIR__ . '/admin_header.php'; |
||
23 | |||
24 | xoops_load('XoopsFormLoader'); |
||
25 | |||
26 | if (Request::hasVar('op', 'GET')) { |
||
27 | $op = $_GET['op']; |
||
28 | } else { |
||
29 | $op = 'default'; |
||
30 | } |
||
31 | |||
32 | if (Request::hasVar('step', 'POST')) { |
||
33 | $step = $_POST['step']; |
||
34 | } else { |
||
35 | $step = 'default'; |
||
36 | } |
||
37 | |||
38 | switch ($op) { |
||
39 | case 'uploadfont': |
||
40 | |||
41 | switch ($step) { |
||
42 | case 'enreg': |
||
43 | |||
44 | $uploaddir = XOOPS_ROOT_PATH . '/modules/extgallery/assets/fonts/'; |
||
45 | $uploadfile = $uploaddir . basename($_FILES['font_file']['name']); |
||
46 | |||
47 | if (file_exists($uploadfile)) { |
||
48 | echo 'The font is already present on the server.'; |
||
49 | } |
||
50 | |||
51 | move_uploaded_file($_FILES['font_file']['tmp_name'], $uploadfile); |
||
52 | |||
53 | redirect_header('watermark-border.php', 3, _AM_EXTGALLERY_FONT_ADDED); |
||
54 | |||
55 | break; |
||
56 | case 'default': |
||
57 | |||
58 | default: |
||
59 | |||
60 | xoops_cp_header(); |
||
61 | |||
62 | $xoopsTpl->assign('uploadfont', true); |
||
63 | |||
64 | $fonts = []; |
||
65 | |||
66 | $rep = XOOPS_ROOT_PATH . '/modules/extgallery/assets/fonts/'; |
||
67 | $dir = opendir($rep); |
||
68 | while (false !== ($f = readdir($dir))) { |
||
69 | if (is_file($rep . $f)) { |
||
70 | if (preg_match('/.*ttf/', mb_strtolower($f))) { |
||
71 | $fonts[] = $f; |
||
72 | } |
||
73 | } |
||
74 | } |
||
75 | |||
76 | $xoopsTpl->assign('fonts', $fonts); |
||
77 | |||
78 | $form = new \XoopsThemeForm(_AM_EXTGALLERY_ADD_FONT, 'add_font', 'watermark-border.php?op=uploadfont', 'post', true); |
||
79 | $form->setExtra('enctype="multipart/form-data"'); |
||
80 | $form->addElement(new \XoopsFormFile(_AM_EXTGALLERY_FONT_FILE, 'font_file', get_cfg_var('upload_max_filesize') * 1024 * 1024), false); |
||
81 | $form->addElement(new \XoopsFormHidden('step', 'enreg')); |
||
82 | $form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
||
83 | |||
84 | $xoopsTpl->assign('fontform', $form->display()); |
||
0 ignored issues
–
show
|
|||
85 | |||
86 | // Call template file |
||
87 | $xoopsTpl->display(XOOPS_ROOT_PATH . '/modules/extgallery/templates/admin/extgallery_admin_watermark_border.tpl'); |
||
88 | require_once __DIR__ . '/admin_footer.php'; |
||
89 | |||
90 | break; |
||
91 | } |
||
92 | |||
93 | break; |
||
94 | case 'conf': |
||
95 | |||
96 | switch ($step) { |
||
97 | case 'enreg': |
||
98 | |||
99 | /** @var \XoopsModuleHandler $moduleHandler */ |
||
100 | /** @var \XoopsConfigHandler $configHandler */ |
||
101 | $configHandler = xoops_getHandler('config'); |
||
102 | $moduleIdCriteria = new \Criteria('conf_modid', $xoopsModule->getVar('mid')); |
||
103 | |||
104 | // Param for applied to the test photo |
||
105 | $testParam = []; |
||
106 | $testParam['watermark_type'] = $helper->getConfig('watermark_font'); |
||
107 | $testParam['watermark_font'] = $helper->getConfig('watermark_font'); |
||
108 | $testParam['watermark_text'] = $helper->getConfig('watermark_text'); |
||
109 | $testParam['watermark_position'] = $helper->getConfig('watermark_position'); |
||
110 | $testParam['watermark_color'] = $helper->getConfig('watermark_color'); |
||
111 | $testParam['watermark_fontsize'] = $helper->getConfig('watermark_fontsize'); |
||
112 | $testParam['watermark_padding'] = $helper->getConfig('watermark_padding'); |
||
113 | $testParam['inner_border_color'] = $helper->getConfig('inner_border_color'); |
||
114 | $testParam['inner_border_size'] = $helper->getConfig('inner_border_size'); |
||
115 | $testParam['outer_border_color'] = $helper->getConfig('outer_border_color'); |
||
116 | $testParam['outer_border_size'] = $helper->getConfig('outer_border_size'); |
||
117 | |||
118 | if (Request::hasVar('watermark_font', 'POST')) { |
||
119 | $testParam['watermark_font'] = $_POST['watermark_font']; |
||
120 | if ($helper->getConfig('watermark_font') != $_POST['watermark_font']) { |
||
121 | $criteria = new \CriteriaCompo(); |
||
122 | $criteria->add($moduleIdCriteria); |
||
123 | $criteria->add(new \Criteria('conf_name', 'watermark_font')); |
||
124 | $config = $configHandler->getConfigs($criteria); |
||
125 | $config = $config[0]; |
||
126 | $configValue = [ |
||
127 | 'conf_modid' => $xoopsModule->getVar('mid'), |
||
128 | 'conf_catid' => 0, |
||
129 | 'conf_name' => 'watermark_font', |
||
130 | 'conf_value' => $_POST['watermark_font'], |
||
131 | 'conf_formtype' => 'hidden', |
||
132 | 'conf_valuetype' => 'text', |
||
133 | ]; |
||
134 | $config->setVars($configValue); |
||
135 | $configHandler->insertConfig($config); |
||
136 | } |
||
137 | |||
138 | $testParam['watermark_type'] = $_POST['watermark_type']; |
||
139 | if ($helper->getConfig('watermark_type') != $_POST['watermark_type']) { |
||
140 | $criteria = new \CriteriaCompo(); |
||
141 | $criteria->add($moduleIdCriteria); |
||
142 | $criteria->add(new \Criteria('conf_name', 'watermark_type')); |
||
143 | $config = $configHandler->getConfigs($criteria); |
||
144 | $config = $config[0]; |
||
145 | $configValue = [ |
||
146 | 'conf_modid' => $xoopsModule->getVar('mid'), |
||
147 | 'conf_catid' => 0, |
||
148 | 'conf_name' => 'watermark_type', |
||
149 | 'conf_value' => $_POST['watermark_type'], |
||
150 | 'conf_formtype' => 'hidden', |
||
151 | 'conf_valuetype' => 'int', |
||
152 | ]; |
||
153 | $config->setVars($configValue); |
||
154 | $configHandler->insertConfig($config); |
||
155 | } |
||
156 | |||
157 | if (Request::hasVar('watermark_text', 'POST')) { |
||
158 | $testParam['watermark_text'] = $_POST['watermark_text']; |
||
159 | if ($helper->getConfig('watermark_text') != $_POST['watermark_text']) { |
||
160 | $criteria = new \CriteriaCompo(); |
||
161 | $criteria->add($moduleIdCriteria); |
||
162 | $criteria->add(new \Criteria('conf_name', 'watermark_text')); |
||
163 | $config = $configHandler->getConfigs($criteria); |
||
164 | $config = $config[0]; |
||
165 | $configValue = [ |
||
166 | 'conf_modid' => $xoopsModule->getVar('mid'), |
||
167 | 'conf_catid' => 0, |
||
168 | 'conf_name' => 'watermark_text', |
||
169 | 'conf_value' => $_POST['watermark_text'], |
||
170 | 'conf_formtype' => 'hidden', |
||
171 | 'conf_valuetype' => 'text', |
||
172 | ]; |
||
173 | $config->setVars($configValue); |
||
174 | $configHandler->insertConfig($config); |
||
175 | } |
||
176 | } |
||
177 | |||
178 | $testParam['watermark_position'] = $_POST['watermark_position']; |
||
179 | if ($helper->getConfig('watermark_position') != $_POST['watermark_position']) { |
||
180 | $criteria = new \CriteriaCompo(); |
||
181 | $criteria->add($moduleIdCriteria); |
||
182 | $criteria->add(new \Criteria('conf_name', 'watermark_position')); |
||
183 | $config = $configHandler->getConfigs($criteria); |
||
184 | $config = $config[0]; |
||
185 | $configValue = [ |
||
186 | 'conf_modid' => $xoopsModule->getVar('mid'), |
||
187 | 'conf_catid' => 0, |
||
188 | 'conf_name' => 'watermark_position', |
||
189 | 'conf_value' => $_POST['watermark_position'], |
||
190 | 'conf_formtype' => 'hidden', |
||
191 | 'conf_valuetype' => 'text', |
||
192 | ]; |
||
193 | $config->setVars($configValue); |
||
194 | $configHandler->insertConfig($config); |
||
195 | } |
||
196 | |||
197 | $testParam['watermark_color'] = $_POST['watermark_color']; |
||
198 | if ($helper->getConfig('watermark_color') != $_POST['watermark_color']) { |
||
199 | $criteria = new \CriteriaCompo(); |
||
200 | $criteria->add($moduleIdCriteria); |
||
201 | $criteria->add(new \Criteria('conf_name', 'watermark_color')); |
||
202 | $config = $configHandler->getConfigs($criteria); |
||
203 | $config = $config[0]; |
||
204 | $configValue = [ |
||
205 | 'conf_modid' => $xoopsModule->getVar('mid'), |
||
206 | 'conf_catid' => 0, |
||
207 | 'conf_name' => 'watermark_color', |
||
208 | 'conf_value' => $_POST['watermark_color'], |
||
209 | 'conf_formtype' => 'hidden', |
||
210 | 'conf_valuetype' => 'text', |
||
211 | ]; |
||
212 | $config->setVars($configValue); |
||
213 | $configHandler->insertConfig($config); |
||
214 | } |
||
215 | |||
216 | $testParam['watermark_fontsize'] = $_POST['watermark_fontsize']; |
||
217 | if ($helper->getConfig('watermark_fontsize') != $_POST['watermark_fontsize']) { |
||
218 | $criteria = new \CriteriaCompo(); |
||
219 | $criteria->add($moduleIdCriteria); |
||
220 | $criteria->add(new \Criteria('conf_name', 'watermark_fontsize')); |
||
221 | $config = $configHandler->getConfigs($criteria); |
||
222 | $config = $config[0]; |
||
223 | $configValue = [ |
||
224 | 'conf_modid' => $xoopsModule->getVar('mid'), |
||
225 | 'conf_catid' => 0, |
||
226 | 'conf_name' => 'watermark_fontsize', |
||
227 | 'conf_value' => $_POST['watermark_fontsize'], |
||
228 | 'conf_formtype' => 'hidden', |
||
229 | 'conf_valuetype' => 'int', |
||
230 | ]; |
||
231 | $config->setVars($configValue); |
||
232 | $configHandler->insertConfig($config); |
||
233 | } |
||
234 | |||
235 | $testParam['watermark_padding'] = $_POST['watermark_padding']; |
||
236 | if ($helper->getConfig('watermark_padding') != $_POST['watermark_padding']) { |
||
237 | $criteria = new \CriteriaCompo(); |
||
238 | $criteria->add($moduleIdCriteria); |
||
239 | $criteria->add(new \Criteria('conf_name', 'watermark_padding')); |
||
240 | $config = $configHandler->getConfigs($criteria); |
||
241 | $config = $config[0]; |
||
242 | $configValue = [ |
||
243 | 'conf_modid' => $xoopsModule->getVar('mid'), |
||
244 | 'conf_catid' => 0, |
||
245 | 'conf_name' => 'watermark_padding', |
||
246 | 'conf_value' => $_POST['watermark_padding'], |
||
247 | 'conf_formtype' => 'hidden', |
||
248 | 'conf_valuetype' => 'int', |
||
249 | ]; |
||
250 | $config->setVars($configValue); |
||
251 | $configHandler->insertConfig($config); |
||
252 | } |
||
253 | } |
||
254 | |||
255 | if (Request::hasVar('inner_border_color', 'POST')) { |
||
256 | $testParam['inner_border_color'] = $_POST['inner_border_color']; |
||
257 | if ($helper->getConfig('inner_border_color') != $_POST['inner_border_color']) { |
||
258 | $criteria = new \CriteriaCompo(); |
||
259 | $criteria->add($moduleIdCriteria); |
||
260 | $criteria->add(new \Criteria('conf_name', 'inner_border_color')); |
||
261 | $config = $configHandler->getConfigs($criteria); |
||
262 | $config = $config[0]; |
||
263 | $configValue = [ |
||
264 | 'conf_modid' => $xoopsModule->getVar('mid'), |
||
265 | 'conf_catid' => 0, |
||
266 | 'conf_name' => 'inner_border_color', |
||
267 | 'conf_value' => $_POST['inner_border_color'], |
||
268 | 'conf_formtype' => 'hidden', |
||
269 | 'conf_valuetype' => 'text', |
||
270 | ]; |
||
271 | $config->setVars($configValue); |
||
272 | $configHandler->insertConfig($config); |
||
273 | } |
||
274 | |||
275 | $testParam['inner_border_size'] = $_POST['inner_border_size']; |
||
276 | if ($helper->getConfig('inner_border_size') != $_POST['inner_border_size']) { |
||
277 | $criteria = new \CriteriaCompo(); |
||
278 | $criteria->add($moduleIdCriteria); |
||
279 | $criteria->add(new \Criteria('conf_name', 'inner_border_size')); |
||
280 | $config = $configHandler->getConfigs($criteria); |
||
281 | $config = $config[0]; |
||
282 | $configValue = [ |
||
283 | 'conf_modid' => $xoopsModule->getVar('mid'), |
||
284 | 'conf_catid' => 0, |
||
285 | 'conf_name' => 'inner_border_size', |
||
286 | 'conf_value' => $_POST['inner_border_size'], |
||
287 | 'conf_formtype' => 'hidden', |
||
288 | 'conf_valuetype' => 'int', |
||
289 | ]; |
||
290 | $config->setVars($configValue); |
||
291 | $configHandler->insertConfig($config); |
||
292 | } |
||
293 | |||
294 | $testParam['outer_border_color'] = $_POST['outer_border_color']; |
||
295 | if ($helper->getConfig('outer_border_color') != $_POST['outer_border_color']) { |
||
296 | $criteria = new \CriteriaCompo(); |
||
297 | $criteria->add($moduleIdCriteria); |
||
298 | $criteria->add(new \Criteria('conf_name', 'outer_border_color')); |
||
299 | $config = $configHandler->getConfigs($criteria); |
||
300 | $config = $config[0]; |
||
301 | $configValue = [ |
||
302 | 'conf_modid' => $xoopsModule->getVar('mid'), |
||
303 | 'conf_catid' => 0, |
||
304 | 'conf_name' => 'outer_border_color', |
||
305 | 'conf_value' => $_POST['outer_border_color'], |
||
306 | 'conf_formtype' => 'hidden', |
||
307 | 'conf_valuetype' => 'text', |
||
308 | ]; |
||
309 | $config->setVars($configValue); |
||
310 | $configHandler->insertConfig($config); |
||
311 | } |
||
312 | |||
313 | $testParam['outer_border_size'] = $_POST['outer_border_size']; |
||
314 | if ($helper->getConfig('outer_border_size') != $_POST['outer_border_size']) { |
||
315 | $criteria = new \CriteriaCompo(); |
||
316 | $criteria->add($moduleIdCriteria); |
||
317 | $criteria->add(new \Criteria('conf_name', 'outer_border_size')); |
||
318 | $config = $configHandler->getConfigs($criteria); |
||
319 | $config = $config[0]; |
||
320 | $configValue = [ |
||
321 | 'conf_modid' => $xoopsModule->getVar('mid'), |
||
322 | 'conf_catid' => 0, |
||
323 | 'conf_name' => 'outer_border_size', |
||
324 | 'conf_value' => $_POST['outer_border_size'], |
||
325 | 'conf_formtype' => 'hidden', |
||
326 | 'conf_valuetype' => 'int', |
||
327 | ]; |
||
328 | $config->setVars($configValue); |
||
329 | $configHandler->insertConfig($config); |
||
330 | } |
||
331 | } |
||
332 | |||
333 | // Refresh the photo exemple |
||
334 | |||
335 | require_once XOOPS_ROOT_PATH . '/modules/extgallery/class/pear/Image/Transform.php'; |
||
336 | |||
337 | // Loading original image |
||
338 | // Define Graphical library path |
||
339 | if ('imagick' === $helper->getConfig('graphic_lib')) { |
||
340 | define('IMAGE_TRANSFORM_IM_PATH', $helper->getConfig('graphic_lib_path')); |
||
341 | } |
||
342 | $newImageTransform = new \Image_Transform(); |
||
343 | // $imageTransform = Image_Transform::factory($helper->getConfig('graphic_lib')); |
||
344 | $imageTransform = $newImageTransform->factory($helper->getConfig('graphic_lib')); |
||
345 | $imageTransform->load('../assets/images/watermark-border-orig.jpg'); |
||
346 | |||
347 | // Making Watermark |
||
348 | if ('tl' === $testParam['watermark_position']) { |
||
349 | $x = 0; |
||
350 | $y = 0; |
||
351 | } elseif ('tr' === $testParam['watermark_position']) { |
||
352 | $x = -1; |
||
353 | $y = 0; |
||
354 | } elseif ('bl' === $testParam['watermark_position']) { |
||
355 | $x = 0; |
||
356 | $y = -1; |
||
357 | } elseif ('br' === $testParam['watermark_position']) { |
||
358 | $x = -1; |
||
359 | $y = -1; |
||
360 | } elseif ('tc' === $testParam['watermark_position']) { |
||
361 | $x = 1; |
||
362 | $y = 0; |
||
363 | } elseif ('bc' === $testParam['watermark_position']) { |
||
364 | $x = 1; |
||
365 | $y = -1; |
||
366 | } elseif ('lc' === $testParam['watermark_position']) { |
||
367 | $x = 0; |
||
368 | $y = 1; |
||
369 | } elseif ('rc' === $testParam['watermark_position']) { |
||
370 | $x = -1; |
||
371 | $y = 1; |
||
372 | } elseif ('cc' === $testParam['watermark_position']) { |
||
373 | $x = 1; |
||
374 | $y = 1; |
||
375 | } |
||
376 | |||
377 | $text = (0 == $testParam['watermark_type']) ? $GLOBALS['xoopsUser']->getVar('uname') : $testParam['watermark_text']; |
||
378 | |||
379 | $watermarkParams = [ |
||
380 | 'text' => $text, |
||
381 | 'x' => $x, |
||
382 | 'y' => $y, |
||
383 | 'color' => $testParam['watermark_color'], |
||
384 | 'font' => '../assets/fonts/' . $testParam['watermark_font'], |
||
385 | 'size' => $testParam['watermark_fontsize'], |
||
386 | 'resize_first' => false, |
||
387 | 'padding' => $testParam['watermark_padding'], |
||
388 | ]; |
||
389 | $imageTransform->addText($watermarkParams); |
||
390 | |||
391 | // Making border |
||
392 | $borders = []; |
||
393 | $borders[] = [ |
||
394 | 'borderWidth' => $testParam['inner_border_size'], |
||
395 | 'borderColor' => $testParam['inner_border_color'], |
||
396 | ]; |
||
397 | $borders[] = [ |
||
398 | 'borderWidth' => $testParam['outer_border_size'], |
||
399 | 'borderColor' => $testParam['outer_border_color'], |
||
400 | ]; |
||
401 | |||
402 | foreach ($borders as $border) { |
||
403 | $imageTransform->addBorder($border['borderWidth'], $border['borderColor']); |
||
404 | } |
||
405 | |||
406 | // Remove old test image |
||
407 | deleteImageTest(); |
||
408 | // Saving transformation on test image |
||
409 | $imageTransform->save('../assets/images/watermark-border-test-' . mb_substr(md5(uniqid(mt_rand(), true)), 27) . '.jpg'); |
||
410 | $imageTransform->free(); |
||
411 | |||
412 | redirect_header('watermark-border.php', 3, _AM_EXTGALLERY_CONFIGURATION_SAVED); |
||
413 | |||
414 | break; |
||
415 | } |
||
416 | |||
417 | break; |
||
418 | case 'default': |
||
419 | |||
420 | default: |
||
421 | |||
422 | xoops_cp_header(); |
||
423 | |||
424 | $nbFonts = 0; |
||
425 | $fonts = []; |
||
426 | |||
427 | $rep = XOOPS_ROOT_PATH . '/modules/extgallery/assets/fonts/'; |
||
428 | $dir = opendir($rep); |
||
429 | while (false !== ($f = readdir($dir))) { |
||
430 | if (is_file($rep . $f)) { |
||
431 | if (preg_match('/.*ttf/', mb_strtolower($f))) { |
||
432 | ++$nbFonts; |
||
433 | $fonts[] = $f; |
||
434 | } |
||
435 | } |
||
436 | } |
||
437 | |||
438 | $xoopsTpl->assign('nbfonts', sprintf(_AM_EXTGALLERY_ADD_FONT_LINK, $nbFonts)); |
||
439 | |||
440 | $xoopsTpl->assign('fonts', $fonts); |
||
441 | |||
442 | // Display Watermark param form if FreeType is supported |
||
443 | if (function_exists('imagettfbbox')) { |
||
444 | $xoopsTpl->assign('imagettfbbox', true); |
||
445 | |||
446 | $form = new \XoopsThemeForm(_AM_EXTGALLERY_WATERMARK_CONF, 'watermark_conf', 'watermark-border.php?op=conf', 'post', true); |
||
447 | $fontSelect = new \XoopsFormSelect(_AM_EXTGALLERY_FONT, 'watermark_font', $helper->getConfig('watermark_font')); |
||
448 | foreach ($fonts as $font) { |
||
449 | $fontSelect->addOption($font, $font); |
||
450 | } |
||
451 | $form->addElement($fontSelect); |
||
452 | |||
453 | $elementTray = new \XoopsFormElementTray(_AM_EXTGALLERY_WATERMARK_TEXT, ' '); |
||
454 | |||
455 | $selected1 = 1 == $helper->getConfig('watermark_type') ? ' checked' : ''; |
||
456 | $disable = 0 == $helper->getConfig('watermark_type') ? ' disabled="disabled"' : ''; |
||
457 | $style = 0 == $helper->getConfig('watermark_type') ? ' style="background-color:#DDDDDD;"' : ''; |
||
458 | $onClick = ' onClick="document.getElementById(\'watermark_text\').disabled = false; document.getElementById(\'watermark_text\').style.backgroundColor = \'#FFFFFF\';"'; |
||
459 | $WTextForm = '<input type="radio" name="watermark_type" value="1"' . $selected1 . $onClick . '> <input name="watermark_text" id="watermark_text" size="50" maxlength="255" value="' . $helper->getConfig('watermark_text') . '" type="text"' . $disable . $style . '><br>'; |
||
460 | |||
461 | $selected2 = 0 == $helper->getConfig('watermark_type') ? ' checked' : ''; |
||
462 | $onClick = ' onClick="document.getElementById(\'watermark_text\').disabled = true; document.getElementById(\'watermark_text\').style.backgroundColor = \'#DDDDDD\';"'; |
||
463 | $WTextForm .= '<input type="radio" name="watermark_type" value="0"' . $selected2 . $onClick . '> ' . _AM_EXTGALLERY_PRINT_SUBMITTER_UNAME; |
||
464 | |||
465 | $elementTray->addElement(new \XoopsFormLabel('', $WTextForm), false); |
||
466 | $form->addElement($elementTray); |
||
467 | $positionSelect = new \XoopsFormSelect(_AM_EXTGALLERY_POSITION, 'watermark_position', $helper->getConfig('watermark_position')); |
||
468 | $positionSelect->addOption('tl', _AM_EXTGALLERY_TOP_LEFT); |
||
469 | $positionSelect->addOption('tr', _AM_EXTGALLERY_TOP_RIGHT); |
||
470 | $positionSelect->addOption('bl', _AM_EXTGALLERY_BOTTOM_LEFT); |
||
471 | $positionSelect->addOption('br', _AM_EXTGALLERY_BOTTOM_RIGHT); |
||
472 | $positionSelect->addOption('tc', _AM_EXTGALLERY_TOP_CENTER); |
||
473 | $positionSelect->addOption('bc', _AM_EXTGALLERY_BOTTOM_CENTER); |
||
474 | $positionSelect->addOption('lc', _AM_EXTGALLERY_LEFT_CENTER); |
||
475 | $positionSelect->addOption('rc', _AM_EXTGALLERY_RIGHT_CENTER); |
||
476 | $positionSelect->addOption('cc', _AM_EXTGALLERY_CENTER_CENTER); |
||
477 | $form->addElement($positionSelect); |
||
478 | $form->addElement(new \XoopsFormColorPicker(_AM_EXTGALLERY_WATERMARK_COLOR, 'watermark_color', $helper->getConfig('watermark_color')), false); |
||
479 | $form->addElement(new \XoopsFormText(_AM_EXTGALLERY_WATERMARK_FONT_SIZE, 'watermark_fontsize', '2', '2', $helper->getConfig('watermark_fontsize')), false); |
||
480 | $form->addElement(new \XoopsFormText(_AM_EXTGALLERY_WATERMARK_PADDING, 'watermark_padding', '2', '2', $helper->getConfig('watermark_padding')), false); |
||
481 | $form->addElement(new \XoopsFormHidden('step', 'enreg')); |
||
482 | $form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
||
483 | |||
484 | $xoopsTpl->assign('watermarkform', $form->render()); |
||
485 | // Else display Warning message |
||
486 | } else { |
||
487 | $xoopsTpl->assign('freetypewarn', _AM_EXTGALLERY_WATERMARK_FREETYPE_WARN); |
||
488 | } |
||
489 | |||
490 | $form = new \XoopsThemeForm(_AM_EXTGALLERY_BORDER_CONF, 'border_conf', 'watermark-border.php?op=conf', 'post', true); |
||
491 | $form->addElement(new \XoopsFormColorPicker(_AM_EXTGALLERY_INNER_BORDER_COLOR, 'inner_border_color', $helper->getConfig('inner_border_color')), false); |
||
492 | $form->addElement(new \XoopsFormText(_AM_EXTGALLERY_INNER_BORDER_SIZE, 'inner_border_size', '2', '2', $helper->getConfig('inner_border_size')), false); |
||
493 | $form->addElement(new \XoopsFormColorPicker(_AM_EXTGALLERY_OUTER_BORDER_COLOR, 'outer_border_color', $helper->getConfig('outer_border_color')), false); |
||
494 | $form->addElement(new \XoopsFormText(_AM_EXTGALLERY_OUTER_BORDER_SIZE, 'outer_border_size', '2', '2', $helper->getConfig('outer_border_size')), false); |
||
495 | $form->addElement(new \XoopsFormHidden('step', 'enreg')); |
||
496 | $form->addElement(new \XoopsFormButton('', 'submit', _SUBMIT, 'submit')); |
||
497 | |||
498 | $xoopsTpl->assign('borderform', $form->render()); |
||
499 | |||
500 | $imageTest = getImageTest(); |
||
501 | |||
502 | if (isset($imageTest[0])) { |
||
503 | $xoopsTpl->assign('imagetest', $imageTest[0]); |
||
504 | } |
||
505 | // Call template file |
||
506 | $xoopsTpl->display(__DIR__ . '/../templates/admin/extgallery_admin_watermark_border.tpl'); |
||
507 | require_once __DIR__ . '/admin_footer.php'; |
||
508 | |||
509 | break; |
||
510 | } |
||
511 | |||
512 | /** |
||
513 | * @return array |
||
514 | */ |
||
515 | function getImageTest() |
||
516 | { |
||
517 | $ret = []; |
||
518 | $rep = \dirname(__DIR__) . '/assets/images/'; |
||
519 | $dir = opendir($rep); |
||
520 | while (false !== ($f = readdir($dir))) { |
||
521 | if (is_file($rep . $f)) { |
||
522 | if (preg_match('/watermark-border-test/', $f)) { |
||
523 | $ret[] = $f; |
||
524 | } |
||
525 | } |
||
526 | } |
||
527 | |||
528 | return $ret; |
||
529 | } |
||
530 | |||
531 | function deleteImageTest() |
||
532 | { |
||
533 | $files = getImageTest(); |
||
534 | foreach ($files as $file) { |
||
535 | unlink(__DIR__ . '/../assets/images/' . $file); |
||
536 | } |
||
537 | } |
||
538 |
This check looks for function or method calls that always return null and whose return value is used.
The method
getObject()
can return nothing but null, so it makes no sense to use the return value.The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.