source: extensions/lightbox/admin/admin.php @ 4621

Last change on this file since 4621 was 4621, checked in by patdenice, 14 years ago

[Plugin][Lightbox]
Update Colorbox to 1.3.5
Add grey2 theme.

File size: 3.4 KB
Line 
1<?php
2
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4
5global $template, $conf;
6
7// Chargement des parametres
8load_language('plugin.lang', LIGHTBOX_PATH);
9include(dirname(__FILE__).'/config_default.inc.php');
10$params = array_merge($config_default, unserialize($conf['lightbox']));
11
12// Mise a jour de la base de donnee
13if (isset($_POST['submit']) and !is_adviser())
14{
15  $params  = array(
16    'display_name'       => $_POST['display_name'] ? true : false,
17    'name_link'          => $_POST['name_link'],
18    'display_arrows'     => $_POST['display_arrows'] ? true : false,
19    'all_cat'            => $_POST['all_cat'] ? true : false,
20    'theme'              => $_POST['theme'],
21    'transition'         => $_POST['transition'],
22    'transition_speed'   => $_POST['transition_speed'],
23    'initial_width'      => !empty($_POST['initial_width']) ? $_POST['initial_width'].$_POST['initial_width_px'] : '',
24    'initial_height'     => !empty($_POST['initial_height']) ? $_POST['initial_height'].$_POST['initial_height_px'] : '',
25    'fixed_width'        => !empty($_POST['fixed_width']) ? $_POST['fixed_width'].$_POST['fixed_width_px'] : '',
26    'fixed_height'       => !empty($_POST['fixed_height']) ? $_POST['fixed_height'].$_POST['fixed_height_px'] : '',
27  );
28 
29  $query = '
30UPDATE ' . CONFIG_TABLE . '
31  SET value="' . addslashes(serialize($params)) . '"
32  WHERE param="lightbox"
33  LIMIT 1';
34  pwg_query($query);
35 
36  array_push($page['infos'], l10n('lb_configuration_saved'));
37}
38
39// Restaurer les paramètres par défaut
40if (isset($_POST['restore']) and !is_adviser())
41{
42  $params  = $config_default;
43
44  $query = '
45UPDATE ' . CONFIG_TABLE . '
46  SET value="' . addslashes(serialize($params)) . '"
47  WHERE param="lightbox"
48  LIMIT 1';
49  pwg_query($query);
50 
51  array_push($page['infos'], l10n('lb_default_parameters_saved'));
52}
53
54// Récupération des thèmes
55$path = LIGHTBOX_PATH . 'theme';
56$theme_dir = opendir($path);
57$themes = array();
58while (($node = readdir($theme_dir)) !== false)
59{
60  if (is_dir($path . '/' . $node)
61    and is_file($path . '/' . $node . '/colorbox.css'))
62  {
63    array_push($themes, $node);
64  }
65}
66
67// Configuration du template
68$template->assign(array(
69  'DISPLAY_NAME'         => $params['display_name'],
70  'NAME_LINK'            => $params['name_link'],
71  'DISPLAY_ARROWS'       => $params['display_arrows'],
72  'ALL_CAT'              => $params['all_cat'],
73  'themes'               => $themes,
74  'SELECTED_THEME'       => $params['theme'],
75  'SELECTED_TRANSITION'  => $params['transition'],
76  'TRANSITION_SPEED'     => $params['transition_speed'],
77  'INITIAL_WIDTH'        => rtrim($params['initial_width'], 'px%'),
78  'INITIAL_WIDTH_PX'     => strpos($params['initial_width'], '%') ? false : true,
79  'INITIAL_HEIGHT'       => rtrim($params['initial_height'], 'px%'),
80  'INITIAL_HEIGHT_PX'    => strpos($params['initial_height'], '%') ? false : true,
81  'FIXED_WIDTH'          => rtrim($params['fixed_width'], 'px%'),
82  'FIXED_WIDTH_PX'       => strpos($params['fixed_width'], '%')? false : true,
83  'FIXED_HEIGHT'         => rtrim($params['fixed_height'], 'px%'),
84  'FIXED_HEIGHT_PX'      => strpos($params['fixed_height'], '%')? false : true,
85));
86
87
88$template->set_filenames(array('plugin_admin_content' => dirname(__FILE__) . '/admin.tpl'));
89$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
90
91?>
Note: See TracBrowser for help on using the repository browser.