1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Piwigo - a PHP based photo gallery | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | Copyright(C) 2008-2014 Piwigo Team http://piwigo.org | |
---|
6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
8 | // +-----------------------------------------------------------------------+ |
---|
9 | // | This program is free software; you can redistribute it and/or modify | |
---|
10 | // | it under the terms of the GNU General Public License as published by | |
---|
11 | // | the Free Software Foundation | |
---|
12 | // | | |
---|
13 | // | This program is distributed in the hope that it will be useful, but | |
---|
14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
16 | // | General Public License for more details. | |
---|
17 | // | | |
---|
18 | // | You should have received a copy of the GNU General Public License | |
---|
19 | // | along with this program; if not, write to the Free Software | |
---|
20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
21 | // | USA. | |
---|
22 | // +-----------------------------------------------------------------------+ |
---|
23 | |
---|
24 | if( !defined("PHPWG_ROOT_PATH") ) |
---|
25 | { |
---|
26 | die ("Hacking attempt!"); |
---|
27 | } |
---|
28 | |
---|
29 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
30 | include_once(PHPWG_ROOT_PATH.'admin/include/functions_upload.inc.php'); |
---|
31 | include_once(PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); |
---|
32 | |
---|
33 | // +-----------------------------------------------------------------------+ |
---|
34 | // | Check Access and exit when user status is not ok | |
---|
35 | // +-----------------------------------------------------------------------+ |
---|
36 | check_status(ACCESS_ADMINISTRATOR); |
---|
37 | |
---|
38 | //-------------------------------------------------------- sections definitions |
---|
39 | |
---|
40 | check_input_parameter('section', $_GET, false, '/^[a-z]+$/i'); |
---|
41 | |
---|
42 | if (!isset($_GET['section'])) |
---|
43 | { |
---|
44 | $page['section'] = 'main'; |
---|
45 | } |
---|
46 | else |
---|
47 | { |
---|
48 | $page['section'] = $_GET['section']; |
---|
49 | } |
---|
50 | |
---|
51 | $main_checkboxes = array( |
---|
52 | 'allow_user_registration', |
---|
53 | 'obligatory_user_mail_address', |
---|
54 | 'rate', |
---|
55 | 'rate_anonymous', |
---|
56 | 'email_admin_on_new_user', |
---|
57 | 'allow_user_customization', |
---|
58 | 'log', |
---|
59 | 'history_admin', |
---|
60 | 'history_guest', |
---|
61 | ); |
---|
62 | |
---|
63 | $sizes_checkboxes = array( |
---|
64 | 'original_resize', |
---|
65 | ); |
---|
66 | |
---|
67 | $comments_checkboxes = array( |
---|
68 | 'activate_comments', |
---|
69 | 'comments_forall', |
---|
70 | 'comments_validation', |
---|
71 | 'email_admin_on_comment', |
---|
72 | 'email_admin_on_comment_validation', |
---|
73 | 'user_can_delete_comment', |
---|
74 | 'user_can_edit_comment', |
---|
75 | 'email_admin_on_comment_edition', |
---|
76 | 'email_admin_on_comment_deletion', |
---|
77 | 'comments_author_mandatory', |
---|
78 | 'comments_email_mandatory', |
---|
79 | 'comments_enable_website', |
---|
80 | ); |
---|
81 | |
---|
82 | $display_checkboxes = array( |
---|
83 | 'menubar_filter_icon', |
---|
84 | 'index_sort_order_input', |
---|
85 | 'index_flat_icon', |
---|
86 | 'index_posted_date_icon', |
---|
87 | 'index_created_date_icon', |
---|
88 | 'index_slideshow_icon', |
---|
89 | 'index_new_icon', |
---|
90 | 'picture_metadata_icon', |
---|
91 | 'picture_slideshow_icon', |
---|
92 | 'picture_favorite_icon', |
---|
93 | 'picture_download_icon', |
---|
94 | 'picture_navigation_icons', |
---|
95 | 'picture_navigation_thumb', |
---|
96 | 'picture_menu', |
---|
97 | ); |
---|
98 | |
---|
99 | $display_info_checkboxes = array( |
---|
100 | 'author', |
---|
101 | 'created_on', |
---|
102 | 'posted_on', |
---|
103 | 'dimensions', |
---|
104 | 'file', |
---|
105 | 'filesize', |
---|
106 | 'tags', |
---|
107 | 'categories', |
---|
108 | 'visits', |
---|
109 | 'rating_score', |
---|
110 | 'privacy_level', |
---|
111 | ); |
---|
112 | |
---|
113 | // image order management |
---|
114 | $sort_fields = array( |
---|
115 | '' => '', |
---|
116 | 'file ASC' => l10n('File name, A → Z'), |
---|
117 | 'file DESC' => l10n('File name, Z → A'), |
---|
118 | 'name ASC' => l10n('Photo title, A → Z'), |
---|
119 | 'name DESC' => l10n('Photo title, Z → A'), |
---|
120 | 'date_creation DESC' => l10n('Date created, new → old'), |
---|
121 | 'date_creation ASC' => l10n('Date created, old → new'), |
---|
122 | 'date_available DESC' => l10n('Date posted, new → old'), |
---|
123 | 'date_available ASC' => l10n('Date posted, old → new'), |
---|
124 | 'rating_score DESC' => l10n('Rating score, high → low'), |
---|
125 | 'rating_score ASC' => l10n('Rating score, low → high'), |
---|
126 | 'hit DESC' => l10n('Visits, high → low'), |
---|
127 | 'hit ASC' => l10n('Visits, low → high'), |
---|
128 | 'id ASC' => l10n('Numeric identifier, 1 → 9'), |
---|
129 | 'id DESC' => l10n('Numeric identifier, 9 → 1'), |
---|
130 | 'rank ASC' => l10n('Manual sort order'), |
---|
131 | ); |
---|
132 | |
---|
133 | $comments_order = array( |
---|
134 | 'ASC' => l10n('Show oldest comments first'), |
---|
135 | 'DESC' => l10n('Show latest comments first'), |
---|
136 | ); |
---|
137 | |
---|
138 | $mail_themes = array( |
---|
139 | 'clear' => 'Clear', |
---|
140 | 'dark' => 'Dark', |
---|
141 | ); |
---|
142 | |
---|
143 | //------------------------------ verification and registration of modifications |
---|
144 | if (isset($_POST['submit'])) |
---|
145 | { |
---|
146 | $int_pattern = '/^\d+$/'; |
---|
147 | |
---|
148 | switch ($page['section']) |
---|
149 | { |
---|
150 | case 'main' : |
---|
151 | { |
---|
152 | if ( !isset($conf['order_by_custom']) and !isset($conf['order_by_inside_category_custom']) ) |
---|
153 | { |
---|
154 | if ( !empty($_POST['order_by']) ) |
---|
155 | { |
---|
156 | $used = array(); |
---|
157 | foreach ($_POST['order_by'] as $i => $val) |
---|
158 | { |
---|
159 | if (empty($val) or isset($used[$val])) |
---|
160 | { |
---|
161 | unset($_POST['order_by'][$i]); |
---|
162 | } |
---|
163 | else |
---|
164 | { |
---|
165 | $used[$val] = true; |
---|
166 | } |
---|
167 | } |
---|
168 | if ( !count($_POST['order_by']) ) |
---|
169 | { |
---|
170 | $page['errors'][] = l10n('No order field selected'); |
---|
171 | } |
---|
172 | else |
---|
173 | { |
---|
174 | // limit to the number of available parameters |
---|
175 | $order_by = $order_by_inside_category = array_slice($_POST['order_by'], 0, ceil(count($sort_fields)/2)); |
---|
176 | |
---|
177 | // there is no rank outside categories |
---|
178 | if ( ($i = array_search('rank ASC', $order_by)) !== false) |
---|
179 | { |
---|
180 | unset($order_by[$i]); |
---|
181 | } |
---|
182 | |
---|
183 | // must define a default order_by if user want to order by rank only |
---|
184 | if ( count($order_by) == 0 ) |
---|
185 | { |
---|
186 | $order_by = array('id ASC'); |
---|
187 | } |
---|
188 | |
---|
189 | $_POST['order_by'] = 'ORDER BY '.implode(', ', $order_by); |
---|
190 | $_POST['order_by_inside_category'] = 'ORDER BY '.implode(', ', $order_by_inside_category); |
---|
191 | } |
---|
192 | } |
---|
193 | else |
---|
194 | { |
---|
195 | $page['errors'][] = l10n('No order field selected'); |
---|
196 | } |
---|
197 | } |
---|
198 | |
---|
199 | foreach( $main_checkboxes as $checkbox) |
---|
200 | { |
---|
201 | $_POST[$checkbox] = empty($_POST[$checkbox])?'false':'true'; |
---|
202 | } |
---|
203 | break; |
---|
204 | } |
---|
205 | case 'watermark' : |
---|
206 | { |
---|
207 | include(PHPWG_ROOT_PATH.'admin/include/configuration_watermark_process.inc.php'); |
---|
208 | break; |
---|
209 | } |
---|
210 | case 'sizes' : |
---|
211 | { |
---|
212 | include(PHPWG_ROOT_PATH.'admin/include/configuration_sizes_process.inc.php'); |
---|
213 | break; |
---|
214 | } |
---|
215 | case 'comments' : |
---|
216 | { |
---|
217 | // the number of comments per page must be an integer between 5 and 50 |
---|
218 | // included |
---|
219 | if (!preg_match($int_pattern, $_POST['nb_comment_page']) |
---|
220 | or $_POST['nb_comment_page'] < 5 |
---|
221 | or $_POST['nb_comment_page'] > 50) |
---|
222 | { |
---|
223 | $page['errors'][] = l10n('The number of comments a page must be between 5 and 50 included.'); |
---|
224 | } |
---|
225 | foreach( $comments_checkboxes as $checkbox) |
---|
226 | { |
---|
227 | $_POST[$checkbox] = empty($_POST[$checkbox])?'false':'true'; |
---|
228 | } |
---|
229 | break; |
---|
230 | } |
---|
231 | case 'default' : |
---|
232 | { |
---|
233 | // Never go here |
---|
234 | break; |
---|
235 | } |
---|
236 | case 'display' : |
---|
237 | { |
---|
238 | if (!preg_match($int_pattern, $_POST['nb_categories_page']) |
---|
239 | or $_POST['nb_categories_page'] < 4) |
---|
240 | { |
---|
241 | $page['errors'][] = l10n('The number of albums a page must be above 4.'); |
---|
242 | } |
---|
243 | foreach( $display_checkboxes as $checkbox) |
---|
244 | { |
---|
245 | $_POST[$checkbox] = empty($_POST[$checkbox])?'false':'true'; |
---|
246 | } |
---|
247 | foreach( $display_info_checkboxes as $checkbox) |
---|
248 | { |
---|
249 | $_POST['picture_informations'][$checkbox] = |
---|
250 | empty($_POST['picture_informations'][$checkbox])? false : true; |
---|
251 | } |
---|
252 | $_POST['picture_informations'] = addslashes(serialize($_POST['picture_informations'])); |
---|
253 | break; |
---|
254 | } |
---|
255 | } |
---|
256 | |
---|
257 | // updating configuration if no error found |
---|
258 | if (!in_array($page['section'], array('sizes', 'watermark')) and count($page['errors']) == 0) |
---|
259 | { |
---|
260 | //echo '<pre>'; print_r($_POST); echo '</pre>'; |
---|
261 | $result = pwg_query('SELECT param FROM '.CONFIG_TABLE); |
---|
262 | while ($row = pwg_db_fetch_assoc($result)) |
---|
263 | { |
---|
264 | if (isset($_POST[$row['param']])) |
---|
265 | { |
---|
266 | $value = $_POST[$row['param']]; |
---|
267 | |
---|
268 | if ('gallery_title' == $row['param']) |
---|
269 | { |
---|
270 | if (!$conf['allow_html_descriptions']) |
---|
271 | { |
---|
272 | $value = strip_tags($value); |
---|
273 | } |
---|
274 | } |
---|
275 | |
---|
276 | $query = ' |
---|
277 | UPDATE '.CONFIG_TABLE.' |
---|
278 | SET value = \''. str_replace("\'", "''", $value).'\' |
---|
279 | WHERE param = \''.$row['param'].'\' |
---|
280 | ;'; |
---|
281 | pwg_query($query); |
---|
282 | } |
---|
283 | } |
---|
284 | $page['infos'][] = l10n('Information data registered in database'); |
---|
285 | } |
---|
286 | |
---|
287 | //------------------------------------------------------ $conf reinitialization |
---|
288 | load_conf_from_db(); |
---|
289 | } |
---|
290 | |
---|
291 | // restore default derivatives settings |
---|
292 | if ('sizes' == $page['section'] and isset($_GET['action']) and 'restore_settings' == $_GET['action']) |
---|
293 | { |
---|
294 | ImageStdParams::set_and_save( ImageStdParams::get_default_sizes() ); |
---|
295 | pwg_query('DELETE FROM '.CONFIG_TABLE.' WHERE param = \'disabled_derivatives\''); |
---|
296 | clear_derivative_cache(); |
---|
297 | |
---|
298 | $page['infos'][] = l10n('Your configuration settings are saved'); |
---|
299 | } |
---|
300 | |
---|
301 | //----------------------------------------------------- template initialization |
---|
302 | $template->set_filename('config', 'configuration.tpl'); |
---|
303 | |
---|
304 | // TabSheet |
---|
305 | $tabsheet = new tabsheet(); |
---|
306 | $tabsheet->set_id('configuration'); |
---|
307 | $tabsheet->select($page['section']); |
---|
308 | $tabsheet->assign(); |
---|
309 | |
---|
310 | $action = get_root_url().'admin.php?page=configuration'; |
---|
311 | $action.= '&section='.$page['section']; |
---|
312 | |
---|
313 | $template->assign( |
---|
314 | array( |
---|
315 | 'U_HELP' => get_root_url().'admin/popuphelp.php?page=configuration', |
---|
316 | 'F_ACTION'=>$action |
---|
317 | )); |
---|
318 | |
---|
319 | switch ($page['section']) |
---|
320 | { |
---|
321 | case 'main' : |
---|
322 | { |
---|
323 | |
---|
324 | function order_by_is_local() |
---|
325 | { |
---|
326 | @include(PHPWG_ROOT_PATH. 'local/config/config.inc.php'); |
---|
327 | if (isset($conf['local_dir_site'])) |
---|
328 | { |
---|
329 | @include(PHPWG_ROOT_PATH.PWG_LOCAL_DIR. 'config/config.inc.php'); |
---|
330 | } |
---|
331 | |
---|
332 | return isset($conf['order_by']) or isset($conf['order_by_inside_category']); |
---|
333 | } |
---|
334 | |
---|
335 | if (order_by_is_local()) |
---|
336 | { |
---|
337 | $page['warnings'][] = l10n('You have specified <i>$conf[\'order_by\']</i> in your local configuration file, this parameter in deprecated, please remove it or rename it into <i>$conf[\'order_by_custom\']</i> !'); |
---|
338 | } |
---|
339 | |
---|
340 | if ( isset($conf['order_by_custom']) or isset($conf['order_by_inside_category_custom']) ) |
---|
341 | { |
---|
342 | $order_by = array(''); |
---|
343 | $template->assign('ORDER_BY_IS_CUSTOM', true); |
---|
344 | } |
---|
345 | else |
---|
346 | { |
---|
347 | $out = array(); |
---|
348 | $order_by = trim($conf['order_by_inside_category']); |
---|
349 | $order_by = str_replace('ORDER BY ', null, $order_by); |
---|
350 | $order_by = explode(', ', $order_by); |
---|
351 | } |
---|
352 | |
---|
353 | $template->assign( |
---|
354 | 'main', |
---|
355 | array( |
---|
356 | 'CONF_GALLERY_TITLE' => htmlspecialchars($conf['gallery_title']), |
---|
357 | 'CONF_PAGE_BANNER' => htmlspecialchars($conf['page_banner']), |
---|
358 | 'week_starts_on_options' => array( |
---|
359 | 'sunday' => $lang['day'][0], |
---|
360 | 'monday' => $lang['day'][1], |
---|
361 | ), |
---|
362 | 'week_starts_on_options_selected' => $conf['week_starts_on'], |
---|
363 | 'mail_theme' => $conf['mail_theme'], |
---|
364 | 'mail_theme_options' => $mail_themes, |
---|
365 | 'order_by' => $order_by, |
---|
366 | 'order_by_options' => $sort_fields, |
---|
367 | ) |
---|
368 | ); |
---|
369 | |
---|
370 | foreach ($main_checkboxes as $checkbox) |
---|
371 | { |
---|
372 | $template->append( |
---|
373 | 'main', |
---|
374 | array( |
---|
375 | $checkbox => $conf[$checkbox] |
---|
376 | ), |
---|
377 | true |
---|
378 | ); |
---|
379 | } |
---|
380 | break; |
---|
381 | } |
---|
382 | case 'comments' : |
---|
383 | { |
---|
384 | $template->assign( |
---|
385 | 'comments', |
---|
386 | array( |
---|
387 | 'NB_COMMENTS_PAGE'=>$conf['nb_comment_page'], |
---|
388 | 'comments_order'=>$conf['comments_order'], |
---|
389 | 'comments_order_options'=> $comments_order |
---|
390 | ) |
---|
391 | ); |
---|
392 | |
---|
393 | foreach ($comments_checkboxes as $checkbox) |
---|
394 | { |
---|
395 | $template->append( |
---|
396 | 'comments', |
---|
397 | array( |
---|
398 | $checkbox => $conf[$checkbox] |
---|
399 | ), |
---|
400 | true |
---|
401 | ); |
---|
402 | } |
---|
403 | break; |
---|
404 | } |
---|
405 | case 'default' : |
---|
406 | { |
---|
407 | $edit_user = build_user($conf['guest_id'], false); |
---|
408 | include_once(PHPWG_ROOT_PATH.'profile.php'); |
---|
409 | |
---|
410 | $errors = array(); |
---|
411 | if (save_profile_from_post($edit_user, $errors)) |
---|
412 | { |
---|
413 | // Reload user |
---|
414 | $edit_user = build_user($conf['guest_id'], false); |
---|
415 | $page['infos'][] = l10n('Information data registered in database'); |
---|
416 | } |
---|
417 | $page['errors'] = array_merge($page['errors'], $errors); |
---|
418 | |
---|
419 | load_profile_in_template( |
---|
420 | $action, |
---|
421 | '', |
---|
422 | $edit_user |
---|
423 | ); |
---|
424 | $template->assign('default', array()); |
---|
425 | break; |
---|
426 | } |
---|
427 | case 'display' : |
---|
428 | { |
---|
429 | foreach ($display_checkboxes as $checkbox) |
---|
430 | { |
---|
431 | $template->append( |
---|
432 | 'display', |
---|
433 | array( |
---|
434 | $checkbox => $conf[$checkbox] |
---|
435 | ), |
---|
436 | true |
---|
437 | ); |
---|
438 | } |
---|
439 | $template->append( |
---|
440 | 'display', |
---|
441 | array( |
---|
442 | 'picture_informations' => unserialize($conf['picture_informations']), |
---|
443 | 'NB_CATEGORIES_PAGE' => $conf['nb_categories_page'], |
---|
444 | ), |
---|
445 | true |
---|
446 | ); |
---|
447 | break; |
---|
448 | } |
---|
449 | case 'sizes' : |
---|
450 | { |
---|
451 | // we only load the derivatives if it was not already loaded: it occurs |
---|
452 | // when submitting the form and an error remains |
---|
453 | if (!isset($page['sizes_loaded_in_tpl'])) |
---|
454 | { |
---|
455 | $is_gd = (pwg_image::get_library()=='gd')? true : false; |
---|
456 | $template->assign('is_gd', $is_gd); |
---|
457 | $template->assign( |
---|
458 | 'sizes', |
---|
459 | array( |
---|
460 | 'original_resize_maxwidth' => $conf['original_resize_maxwidth'], |
---|
461 | 'original_resize_maxheight' => $conf['original_resize_maxheight'], |
---|
462 | 'original_resize_quality' => $conf['original_resize_quality'], |
---|
463 | ) |
---|
464 | ); |
---|
465 | |
---|
466 | foreach ($sizes_checkboxes as $checkbox) |
---|
467 | { |
---|
468 | $template->append( |
---|
469 | 'sizes', |
---|
470 | array( |
---|
471 | $checkbox => $conf[$checkbox] |
---|
472 | ), |
---|
473 | true |
---|
474 | ); |
---|
475 | } |
---|
476 | |
---|
477 | // derivatives = multiple size |
---|
478 | $enabled = ImageStdParams::get_defined_type_map(); |
---|
479 | $disabled = @unserialize(@$conf['disabled_derivatives']); |
---|
480 | if ($disabled === false) |
---|
481 | { |
---|
482 | $disabled = array(); |
---|
483 | } |
---|
484 | |
---|
485 | $tpl_vars = array(); |
---|
486 | foreach(ImageStdParams::get_all_types() as $type) |
---|
487 | { |
---|
488 | $tpl_var = array(); |
---|
489 | |
---|
490 | $tpl_var['must_square'] = ($type==IMG_SQUARE ? true : false); |
---|
491 | $tpl_var['must_enable'] = ($type==IMG_SQUARE || $type==IMG_THUMB)? true : false; |
---|
492 | |
---|
493 | if ($params = @$enabled[$type]) |
---|
494 | { |
---|
495 | $tpl_var['enabled'] = true; |
---|
496 | } |
---|
497 | else |
---|
498 | { |
---|
499 | $tpl_var['enabled']=false; |
---|
500 | $params=@$disabled[$type]; |
---|
501 | } |
---|
502 | |
---|
503 | if ($params) |
---|
504 | { |
---|
505 | list($tpl_var['w'],$tpl_var['h']) = $params->sizing->ideal_size; |
---|
506 | if ( ($tpl_var['crop'] = round(100*$params->sizing->max_crop)) > 0) |
---|
507 | { |
---|
508 | list($tpl_var['minw'],$tpl_var['minh']) = $params->sizing->min_size; |
---|
509 | } |
---|
510 | else |
---|
511 | { |
---|
512 | $tpl_var['minw'] = $tpl_var['minh'] = ""; |
---|
513 | } |
---|
514 | $tpl_var['sharpen'] = $params->sharpen; |
---|
515 | } |
---|
516 | $tpl_vars[$type]=$tpl_var; |
---|
517 | } |
---|
518 | $template->assign('derivatives', $tpl_vars); |
---|
519 | $template->assign('resize_quality', ImageStdParams::$quality); |
---|
520 | |
---|
521 | $tpl_vars = array(); |
---|
522 | $now = time(); |
---|
523 | foreach(ImageStdParams::$custom as $custom=>$time) |
---|
524 | { |
---|
525 | $tpl_vars[$custom] = ($now-$time<=24*3600) ? l10n('today') : time_since($time, 'day'); |
---|
526 | } |
---|
527 | $template->assign('custom_derivatives', $tpl_vars); |
---|
528 | } |
---|
529 | |
---|
530 | break; |
---|
531 | } |
---|
532 | case 'watermark' : |
---|
533 | { |
---|
534 | $watermark_files = array(); |
---|
535 | foreach (glob(PHPWG_ROOT_PATH.'themes/default/watermarks/*.png') as $file) |
---|
536 | { |
---|
537 | $watermark_files[] = substr($file, strlen(PHPWG_ROOT_PATH)); |
---|
538 | } |
---|
539 | if ( ($glob=glob(PHPWG_ROOT_PATH.PWG_LOCAL_DIR.'watermarks/*.png')) !== false) |
---|
540 | { |
---|
541 | foreach ($glob as $file) |
---|
542 | { |
---|
543 | $watermark_files[] = substr($file, strlen(PHPWG_ROOT_PATH)); |
---|
544 | } |
---|
545 | } |
---|
546 | $watermark_filemap = array( '' => '---' ); |
---|
547 | foreach( $watermark_files as $file) |
---|
548 | { |
---|
549 | $display = basename($file); |
---|
550 | $watermark_filemap[$file] = $display; |
---|
551 | } |
---|
552 | $template->assign('watermark_files', $watermark_filemap); |
---|
553 | |
---|
554 | if ($template->get_template_vars('watermark') === null) |
---|
555 | { |
---|
556 | $wm = ImageStdParams::get_watermark(); |
---|
557 | |
---|
558 | $position = 'custom'; |
---|
559 | if ($wm->xpos == 0 and $wm->ypos == 0) |
---|
560 | { |
---|
561 | $position = 'topleft'; |
---|
562 | } |
---|
563 | if ($wm->xpos == 100 and $wm->ypos == 0) |
---|
564 | { |
---|
565 | $position = 'topright'; |
---|
566 | } |
---|
567 | if ($wm->xpos == 50 and $wm->ypos == 50) |
---|
568 | { |
---|
569 | $position = 'middle'; |
---|
570 | } |
---|
571 | if ($wm->xpos == 0 and $wm->ypos == 100) |
---|
572 | { |
---|
573 | $position = 'bottomleft'; |
---|
574 | } |
---|
575 | if ($wm->xpos == 100 and $wm->ypos == 100) |
---|
576 | { |
---|
577 | $position = 'bottomright'; |
---|
578 | } |
---|
579 | |
---|
580 | if ($wm->xrepeat != 0) |
---|
581 | { |
---|
582 | $position = 'custom'; |
---|
583 | } |
---|
584 | |
---|
585 | $template->assign( |
---|
586 | 'watermark', |
---|
587 | array( |
---|
588 | 'file' => $wm->file, |
---|
589 | 'minw' => $wm->min_size[0], |
---|
590 | 'minh' => $wm->min_size[1], |
---|
591 | 'xpos' => $wm->xpos, |
---|
592 | 'ypos' => $wm->ypos, |
---|
593 | 'xrepeat' => $wm->xrepeat, |
---|
594 | 'opacity' => $wm->opacity, |
---|
595 | 'position' => $position, |
---|
596 | ) |
---|
597 | ); |
---|
598 | } |
---|
599 | |
---|
600 | break; |
---|
601 | } |
---|
602 | } |
---|
603 | |
---|
604 | //----------------------------------------------------------- sending html code |
---|
605 | $template->assign_var_from_handle('ADMIN_CONTENT', 'config'); |
---|
606 | ?> |
---|