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

Last change on this file since 31033 was 30377, checked in by plg, 10 years ago

option to display/hide page banner (compatible with plugin Header Manager)

File size: 2.4 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('display_page_banner');
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
48foreach ($text_values as $k )
49  $template->assign( strtoupper($k), $my_conf[$k] );
50foreach ($bool_values as $k )
51  $template->assign( strtoupper($k), $my_conf[$k] );
52
53// we don't use square thumbs if the thumb size is 0
54$template->assign('use_album_square_thumbs', 0 != $my_conf['album_thumb_size']);
55
56if (0 == $my_conf['album_thumb_size'])
57{
58  $template->assign('ALBUM_THUMB_SIZE', 250);
59}
60
61$available_derivatives = array();
62foreach(array_keys(ImageStdParams::get_defined_type_map()) as $type)
63        $available_derivatives[$type] = l10n($type);
64
65$available_skins=array();
66$skin_dir = dirname(dirname(__FILE__)).'/skins/';
67$skin_suffix = '.inc.php';
68foreach( glob($skin_dir.'*'.$skin_suffix) as $file)
69{
70        $skin = substr($file, strlen($skin_dir), -strlen($skin_suffix));
71        $available_skins[$skin] = ucwords( str_replace('_', ' ',$skin));
72}
73
74$template->assign( array(
75        'available_derivatives' => $available_derivatives,
76        'available_skins' => $available_skins,
77        ) );
78
79$template->set_filename( 'modus_content', dirname(__FILE__).'/modus_admin.tpl' );
80$template->assign_var_from_handle( 'ADMIN_CONTENT', 'modus_content');
81?>
Note: See TracBrowser for help on using the repository browser.