source: extensions/modus/admin/admin.inc.php @ 29336

Last change on this file since 29336 was 28453, checked in by plg, 10 years ago

i18n on configuration screen

remove size "default" which has no obvious meaning currently

hide info about "Full row thumbnail layout" which is hard to understand and cannot be configured (yet)

File size: 2.3 KB
Line 
1<?php
2if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
3
4global $template;
5
6include_once( dirname(dirname(__FILE__)).'/functions.inc.php');
7$default_conf = modus_get_default_config();
8
9load_language('theme.lang', dirname(__FILE__).'/../');
10
11$my_conf = @$conf['modus_theme'];
12if (!isset($my_conf))
13  $my_conf = $default_conf;
14elseif (!is_array($my_conf))
15{
16  $my_conf = unserialize($my_conf);
17        $my_conf = array_merge($default_conf, $my_conf);
18}
19
20$text_values = array('skin', 'album_thumb_size', 'index_photo_deriv','index_photo_deriv_hdpi');
21$bool_values = array();
22
23// *************** POST management ********************
24if (isset($_POST[$text_values[0]]))
25{
26        foreach ($text_values as $k )
27                $my_conf[$k] = stripslashes($_POST[$k]);
28        foreach ($bool_values as $k )
29                $my_conf[$k] = isset($_POST[$k]) ? true:false;
30 
31  if (!isset($_POST['use_album_square_thumbs']))
32  {
33    $my_conf['album_thumb_size'] = 0;
34  }
35 
36        // int/double
37        $my_conf['album_thumb_size'] = max(0, $my_conf['album_thumb_size']);
38  $my_conf = array_intersect_key($my_conf, $default_conf);
39  conf_update_param('modus_theme', addslashes(serialize($my_conf)) );
40
41        global $page;
42  $page['infos'][] = l10n('Information data registered in database');
43}
44
45
46// *************** template init ********************
47
48
49foreach ($text_values as $k )
50  $template->assign( strtoupper($k), $my_conf[$k] );
51foreach ($bool_values as $k )
52  $template->assign( strtoupper($k), $my_conf[$k] );
53
54// we don't use square thumbs if the thumb size is 0
55$template->assign('use_album_square_thumbs', 0 != $my_conf['album_thumb_size']);
56
57if (0 == $my_conf['album_thumb_size'])
58{
59  $template->assign('ALBUM_THUMB_SIZE', 250);
60}
61
62$available_derivatives = array();
63foreach(array_keys(ImageStdParams::get_defined_type_map()) as $type)
64        $available_derivatives[$type] = l10n($type);
65
66$available_skins=array();
67$skin_dir = dirname(dirname(__FILE__)).'/skins/';
68$skin_suffix = '.inc.php';
69foreach( glob($skin_dir.'*'.$skin_suffix) as $file)
70{
71        $skin = substr($file, strlen($skin_dir), -strlen($skin_suffix));
72        $available_skins[$skin] = ucwords( str_replace('_', ' ',$skin));
73}
74
75$template->assign( array(
76        'available_derivatives' => $available_derivatives,
77        'available_skins' => $available_skins,
78        ) );
79
80$template->set_filename( 'modus_content', dirname(__FILE__).'/modus_admin.tpl' );
81$template->assign_var_from_handle( 'ADMIN_CONTENT', 'modus_content');
82?>
Note: See TracBrowser for help on using the repository browser.