source: extensions/photoWidget/admin.php @ 8956

Last change on this file since 8956 was 6850, checked in by nikrou, 14 years ago

Add IT thanks to sergix
Add CZ thanks to webprostor-hosting
Bug fix : Flash animation didn't work when category used a permanink.
Update FSF address
Remove configuration when plugin is uninstalled.

File size: 4.5 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | photoWidget  - a plugin for Piwigo                                    |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2010 Nicolas Roudaire             http://www.nikrou.net  |
6// +-----------------------------------------------------------------------+
7// | This program is free software; you can redistribute it and/or modify  |
8// | it under the terms of the GNU General Public License as published by  |
9// | the Free Software Foundation                                          |
10// |                                                                       |
11// | This program is distributed in the hope that it will be useful, but   |
12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
14// | General Public License for more details.                              |
15// |                                                                       |
16// | You should have received a copy of the GNU General Public License     |
17// | along with this program; if not, write to the Free Software           |
18// | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,            |
19// | MA 02110-1301 USA.                                                    |
20// +-----------------------------------------------------------------------+
21
22if (!defined('PHPWG_ROOT_PATH')) {
23  die('Hacking attempt!');
24}
25
26load_language('plugin.lang', PW_PLUGIN_LANG);
27
28$me = get_plugin_data($plugin_id);
29$save_config = false;
30
31if (!empty($_POST['submit'])) {
32  if (isset($_POST['pw_all_categories'])) {
33    if ($_POST['pw_all_categories']==1) {
34      array_push($GLOBALS['page']['infos'],
35                 l10n('You choose that mode for').' '.l10n('all categories'));
36      $me->pw_all_categories = 1;
37      $me->pw_categories = array();
38      $save_config = true;
39    } else {
40      if (isset($_POST['pw_categories'])) {
41        if (count($_POST['pw_categories'])==1 && ($_POST['pw_categories'][0]=='__none__')) {
42          array_push($GLOBALS['page']['errors'],
43                     l10n('You must choose at least one category'));
44          $me->pw_categories = array();
45          $save_config = true;     
46        } else {
47          array_push($GLOBALS['page']['infos'],
48                     l10n('You choose that mode for').' '.
49                     l10n_dec('one category',
50                              'severals categories',
51                              count($_POST['pw_categories'])));
52          $me->pw_all_categories = 0;
53          $me->pw_categories = $_POST['pw_categories'];       
54          $save_config = true;     
55        }
56      } else {
57        array_push($GLOBALS['page']['errors'],
58                   l10n('You must choose at least one category'));
59      }
60    }
61  }
62
63  if (!empty($_POST['pw_width']) && intval($_POST['pw_width'])!=$me->pw_width) {
64    $me->pw_width = intval($_POST['pw_width']);
65    array_push($GLOBALS['page']['infos'], l10n('Width has been updated'));
66    $save_config = true;
67  }
68  if (!empty($_POST['pw_height']) && intval($_POST['pw_height'])!=$me->pw_height) {
69    $me->pw_height = intval($_POST['pw_height']);
70    array_push($GLOBALS['page']['infos'], l10n('Height has been updated'));
71    $save_config = true;
72  }
73  if (!empty($_POST['pw_bgcolor']) && trim($_POST['pw_bgcolor'])!=$me->pw_bgcolor) {
74    $me->pw_bgcolor = $_POST['pw_bgcolor'];
75    array_push($GLOBALS['page']['infos'], l10n('Background color of animation has been updated'));
76    $save_config = true;
77  }
78
79  if ($save_config) {
80    $me->save_config();
81  }
82}
83
84$query = '
85SELECT id,name
86  FROM '.CATEGORIES_TABLE;
87
88$all_categories = simple_hash_from_query($query, 'id', 'name');
89
90$GLOBALS['template']->set_filenames(array('plugin_admin_content' => PW_TEMPLATE . '/admin.tpl'));
91$GLOBALS['template']->assign('PW_CAT_CHOICES', array(1 => l10n('Yes'), 0 => l10n('No')));
92$GLOBALS['template']->assign('ALL_CATEGORIES', $all_categories); 
93$GLOBALS['template']->assign('PW_CATEGORIES', $me->pw_categories);
94$GLOBALS['template']->assign('PW_ALL_CATEGORIES', $me->pw_all_categories);
95$GLOBALS['template']->assign('PWG_PHOTO_WIDGET_PLUGIN_CSS', PW_CSS);
96$GLOBALS['template']->assign('PWG_PHOTO_WIDGET_PLUGIN_JS', PW_JS);
97$GLOBALS['template']->assign('PW_BGCOLOR', $me->pw_bgcolor);
98$GLOBALS['template']->assign('PW_WIDTH', $me->pw_width); 
99$GLOBALS['template']->assign('PW_HEIGHT', $me->pw_height); 
100$GLOBALS['template']->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
101?>
Note: See TracBrowser for help on using the repository browser.