[5611] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
| 3 | // | photoWidget - a plugin for Piwigo | |
---|
| 4 | // +-----------------------------------------------------------------------+ |
---|
[19908] | 5 | // | Copyright(C) 2010-2013 Nicolas Roudaire http://www.nikrou.net | |
---|
[5611] | 6 | // +-----------------------------------------------------------------------+ |
---|
| 7 | // | This program is free software; you can redistribute it and/or modify | |
---|
[19908] | 8 | // | it under the terms of the GNU General Public License version 2 as | |
---|
| 9 | // | published by the Free Software Foundation | |
---|
[5611] | 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 | |
---|
[6850] | 18 | // | Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, | |
---|
[19908] | 19 | // | MA 02110-1301 USA | |
---|
[5611] | 20 | // +-----------------------------------------------------------------------+ |
---|
| 21 | |
---|
| 22 | if (!defined('PHPWG_ROOT_PATH')) { |
---|
| 23 | die('Hacking attempt!'); |
---|
| 24 | } |
---|
| 25 | |
---|
| 26 | load_language('plugin.lang', PW_PLUGIN_LANG); |
---|
| 27 | |
---|
| 28 | $me = get_plugin_data($plugin_id); |
---|
| 29 | $save_config = false; |
---|
| 30 | |
---|
| 31 | if (!empty($_POST['submit'])) { |
---|
[5647] | 32 | if (isset($_POST['pw_all_categories'])) { |
---|
| 33 | if ($_POST['pw_all_categories']==1) { |
---|
[10988] | 34 | $page['infos'][] = l10n('You choose that mode for').' '.l10n('All categories'); |
---|
[5647] | 35 | $me->pw_all_categories = 1; |
---|
| 36 | $me->pw_categories = array(); |
---|
[5611] | 37 | $save_config = true; |
---|
[5647] | 38 | } else { |
---|
| 39 | if (isset($_POST['pw_categories'])) { |
---|
| 40 | if (count($_POST['pw_categories'])==1 && ($_POST['pw_categories'][0]=='__none__')) { |
---|
[10988] | 41 | $page['errors'][] = l10n('You must choose at least one category'); |
---|
[5647] | 42 | $me->pw_categories = array(); |
---|
| 43 | $save_config = true; |
---|
| 44 | } else { |
---|
[10988] | 45 | $page['infos'][] = l10n('You choose that mode for').' '. |
---|
| 46 | l10n_dec('one category', |
---|
| 47 | 'severals categories', |
---|
| 48 | count($_POST['pw_categories']) |
---|
| 49 | ); |
---|
[5647] | 50 | $me->pw_all_categories = 0; |
---|
| 51 | $me->pw_categories = $_POST['pw_categories']; |
---|
| 52 | $save_config = true; |
---|
| 53 | } |
---|
| 54 | } else { |
---|
[10988] | 55 | $page['errors'][] = l10n('You must choose at least one category'); |
---|
[5647] | 56 | } |
---|
[5611] | 57 | } |
---|
| 58 | } |
---|
[5647] | 59 | |
---|
| 60 | if (!empty($_POST['pw_width']) && intval($_POST['pw_width'])!=$me->pw_width) { |
---|
[5611] | 61 | $me->pw_width = intval($_POST['pw_width']); |
---|
[10988] | 62 | $page['infos'][] = l10n('Width has been updated'); |
---|
[5611] | 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']); |
---|
[10988] | 67 | $page['infos'][] = l10n('Height has been updated'); |
---|
[5611] | 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']; |
---|
[10988] | 72 | $page['infos'][] = l10n('Background color of animation has been updated'); |
---|
[5611] | 73 | $save_config = true; |
---|
| 74 | } |
---|
| 75 | |
---|
| 76 | if ($save_config) { |
---|
| 77 | $me->save_config(); |
---|
| 78 | } |
---|
| 79 | } |
---|
| 80 | |
---|
| 81 | $query = ' |
---|
[19908] | 82 | SELECT id,name,global_rank,uppercats |
---|
[5611] | 83 | FROM '.CATEGORIES_TABLE; |
---|
| 84 | |
---|
[19908] | 85 | display_select_cat_wrapper($query, $me->pw_categories, 'all_categories'); |
---|
[5611] | 86 | |
---|
[10988] | 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('PW_ALL_CATEGORIES', $me->pw_all_categories); |
---|
| 90 | $template->assign('PWG_PHOTO_WIDGET_PLUGIN_CSS', PW_CSS); |
---|
| 91 | $template->assign('PWG_PHOTO_WIDGET_PLUGIN_JS', PW_JS); |
---|
| 92 | $template->assign('PW_BGCOLOR', $me->pw_bgcolor); |
---|
| 93 | $template->assign('PW_WIDTH', $me->pw_width); |
---|
| 94 | $template->assign('PW_HEIGHT', $me->pw_height); |
---|
| 95 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|