source: extensions/photoWidget/admin.php @ 14518

Last change on this file since 14518 was 10988, checked in by nikrou, 13 years ago

Make plugin compatible with piwigo 2.2
Add pl_PL, thanks to Ortolan
Add ar_AR, thanks to bakir

File size: 4.1 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | photoWidget  - a plugin for Piwigo                                    |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2010-2011 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      $page['infos'][] = l10n('You choose that mode for').' '.l10n('All categories');
35      $me->pw_all_categories = 1;
36      $me->pw_categories = array();
37      $save_config = true;
38    } else {
39      if (isset($_POST['pw_categories'])) {
40        if (count($_POST['pw_categories'])==1 && ($_POST['pw_categories'][0]=='__none__')) {
41          $page['errors'][] = l10n('You must choose at least one category');
42          $me->pw_categories = array();
43          $save_config = true;     
44        } else {
45          $page['infos'][] = l10n('You choose that mode for').' '.
46            l10n_dec('one category',
47                     'severals categories',
48                     count($_POST['pw_categories'])
49                     );
50          $me->pw_all_categories = 0;
51          $me->pw_categories = $_POST['pw_categories'];       
52          $save_config = true;     
53        }
54      } else {
55        $page['errors'][] = l10n('You must choose at least one category');
56      }
57    }
58  }
59
60  if (!empty($_POST['pw_width']) && intval($_POST['pw_width'])!=$me->pw_width) {
61    $me->pw_width = intval($_POST['pw_width']);
62    $page['infos'][] = l10n('Width has been updated');
63    $save_config = true;
64  }
65  if (!empty($_POST['pw_height']) && intval($_POST['pw_height'])!=$me->pw_height) {
66    $me->pw_height = intval($_POST['pw_height']);
67    $page['infos'][] = l10n('Height has been updated');
68    $save_config = true;
69  }
70  if (!empty($_POST['pw_bgcolor']) && trim($_POST['pw_bgcolor'])!=$me->pw_bgcolor) {
71    $me->pw_bgcolor = $_POST['pw_bgcolor'];
72    $page['infos'][] = l10n('Background color of animation has been updated');
73    $save_config = true;
74  }
75
76  if ($save_config) {
77    $me->save_config();
78  }
79}
80
81$query = '
82SELECT id,name
83  FROM '.CATEGORIES_TABLE;
84
85$all_categories = simple_hash_from_query($query, 'id', 'name');
86
87$template->set_filenames(array('plugin_admin_content' => PW_TEMPLATE . '/admin.tpl'));
88$template->assign('PW_CAT_CHOICES', array(1 => l10n('Yes'), 0 => l10n('No')));
89$template->assign('ALL_CATEGORIES', $all_categories); 
90$template->assign('PW_CATEGORIES', $me->pw_categories);
91$template->assign('PW_ALL_CATEGORIES', $me->pw_all_categories);
92$template->assign('PWG_PHOTO_WIDGET_PLUGIN_CSS', PW_CSS);
93$template->assign('PWG_PHOTO_WIDGET_PLUGIN_JS', PW_JS);
94$template->assign('PW_BGCOLOR', $me->pw_bgcolor);
95$template->assign('PW_WIDTH', $me->pw_width); 
96$template->assign('PW_HEIGHT', $me->pw_height); 
97$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
98?>
Note: See TracBrowser for help on using the repository browser.