[3761] | 1 | <?php |
---|
| 2 | // +-----------------------------------------------------------------------+ |
---|
| 3 | // | akBookStyle - a plugin for Piwigo | |
---|
| 4 | // +-----------------------------------------------------------------------+ |
---|
[5432] | 5 | // | Copyright(C) 2009-2010 Nicolas Roudaire http://www.nikrou.net | |
---|
[3761] | 6 | // | Copyright(C) 2009 vdigital | |
---|
| 7 | // +-----------------------------------------------------------------------+ |
---|
| 8 | // | This program is free software; you can redistribute it and/or modify | |
---|
| 9 | // | it under the terms of the GNU General Public License as published by | |
---|
| 10 | // | the Free Software Foundation | |
---|
| 11 | // | | |
---|
| 12 | // | This program is distributed in the hope that it will be useful, but | |
---|
| 13 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
| 14 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
| 15 | // | General Public License for more details. | |
---|
| 16 | // | | |
---|
| 17 | // | You should have received a copy of the GNU General Public License | |
---|
| 18 | // | along with this program; if not, write to the Free Software | |
---|
| 19 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
| 20 | // | USA. | |
---|
| 21 | // +-----------------------------------------------------------------------+ |
---|
| 22 | |
---|
[3764] | 23 | if (!defined('PHPWG_ROOT_PATH')) { |
---|
| 24 | die('Hacking attempt!'); |
---|
| 25 | } |
---|
| 26 | |
---|
[5432] | 27 | $ThumbnailsLocations = array('top' => 'Top', |
---|
| 28 | 'left' => 'Left', |
---|
| 29 | 'bottom' => 'Bottom', |
---|
| 30 | 'right' => 'Right'); |
---|
| 31 | $MouseEvents = array('click' => 'Click', |
---|
| 32 | 'mouseover' => 'Mouseover'); |
---|
[3806] | 33 | |
---|
[3791] | 34 | $me = get_plugin_data($plugin_id); |
---|
| 35 | $save_config = false; |
---|
| 36 | |
---|
| 37 | if (!empty($_POST['submit'])) { |
---|
[3842] | 38 | if (!empty($_POST['ak_categories']) && $_POST['ak_categories']!=$me->ak_categories) { |
---|
| 39 | $me->ak_categories = $_POST['ak_categories']; |
---|
[5432] | 40 | array_push($GLOBALS['page']['infos'], |
---|
| 41 | l10n_dec('Applicable category has been updated', |
---|
| 42 | 'Applicable categories have been updated', |
---|
| 43 | count($_POST['ak_categories']))); |
---|
[3842] | 44 | $save_config = true; |
---|
| 45 | } |
---|
| 46 | |
---|
| 47 | if (!empty($_POST['ak_by_page']) && intval($_POST['ak_by_page'])!=$me->ak_by_page) { |
---|
| 48 | $me->ak_by_page = intval($_POST['ak_by_page']); |
---|
[5432] | 49 | array_push($GLOBALS['page']['infos'], l10n('Thumbnails per page has been updated')); |
---|
[3842] | 50 | $save_config = true; |
---|
| 51 | } |
---|
| 52 | |
---|
[3791] | 53 | if (!empty($_POST['ak_by_line']) && intval($_POST['ak_by_line'])!=$me->ak_by_line) { |
---|
| 54 | $me->ak_by_line = intval($_POST['ak_by_line']); |
---|
[5432] | 55 | array_push($GLOBALS['page']['infos'], l10n('Number of column has been updated')); |
---|
[3791] | 56 | $save_config = true; |
---|
| 57 | } |
---|
| 58 | |
---|
[3802] | 59 | if (!empty($_POST['ak_thumbnail_size']) && $_POST['ak_thumbnail_size']!=$me->ak_thumbnail_size) { |
---|
| 60 | $me->ak_thumbnail_size = (int) $_POST['ak_thumbnail_size']; |
---|
[5432] | 61 | array_push($GLOBALS['page']['infos'], l10n('Thumbnail size has been updated')); |
---|
[3792] | 62 | $save_config = true; |
---|
| 63 | } |
---|
| 64 | |
---|
[3806] | 65 | if (!empty($_POST['ak_mouse_event']) && $_POST['ak_mouse_event']!=$me->ak_mouse_event) { |
---|
[5432] | 66 | if (isset($MouseEvents[$_POST['ak_mouse_event']])) { |
---|
| 67 | $me->ak_mouse_event = $_POST['ak_mouse_event']; |
---|
| 68 | } else { |
---|
| 69 | $me->ak_mouse_event = 'click'; |
---|
| 70 | } |
---|
| 71 | array_push($GLOBALS['page']['infos'], l10n('Event to show medium picture has been updated.')); |
---|
[3802] | 72 | $save_config = true; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | if (!empty($_POST['ak_thumbnails_loc']) && $_POST['ak_thumbnails_loc']!=$me->ak_thumbnails_loc) { |
---|
[5432] | 76 | if (isset($ThumbnailsLocations[$_POST['ak_thumbnails_loc']])) { |
---|
| 77 | $me->ak_thumbnails_loc = $_POST['ak_thumbnails_loc']; |
---|
| 78 | } else { |
---|
| 79 | $me->ak_thumbnails_loc = 'left'; } |
---|
| 80 | array_push($GLOBALS['page']['infos'], l10n('Thumbnails location has been changed')); |
---|
[3802] | 81 | $save_config = true; |
---|
| 82 | } |
---|
| 83 | |
---|
[3791] | 84 | if ($save_config) { |
---|
| 85 | $me->save_config(); |
---|
| 86 | } |
---|
| 87 | } |
---|
[5432] | 88 | |
---|
| 89 | $query = ' |
---|
| 90 | SELECT id,name |
---|
| 91 | FROM '.CATEGORIES_TABLE; |
---|
| 92 | |
---|
| 93 | $all_categories = simple_hash_from_query($query, 'id', 'name'); |
---|
| 94 | |
---|
[3764] | 95 | $GLOBALS['template']->set_filenames(array('plugin_admin_content' => AK_PLUGIN_TEMPLATE . '/admin.tpl')); |
---|
[5432] | 96 | $GLOBALS['template']->assign('AK_PLUGIN_CSS', AK_PLUGIN_CSS); |
---|
| 97 | $GLOBALS['template']->assign('ALL_CATEGORIES', $all_categories); |
---|
[3842] | 98 | $GLOBALS['template']->assign('AK_CATEGORIES', $me->ak_categories); |
---|
| 99 | $GLOBALS['template']->assign('AK_BY_PAGE', $me->ak_by_page); |
---|
[3791] | 100 | $GLOBALS['template']->assign('AK_BY_LINE', $me->ak_by_line); |
---|
[3792] | 101 | $GLOBALS['template']->assign('AK_THUMBNAIL_SIZE', $me->ak_thumbnail_size); |
---|
[3806] | 102 | $GLOBALS['template']->assign('AK_MOUSE_EVENT', $me->ak_mouse_event); |
---|
| 103 | $GLOBALS['template']->assign('AK_AVAILABLE_EVENTS', array_keys($MouseEvents)); |
---|
| 104 | $GLOBALS['template']->assign('AK_EVENTS_LABELS', array_values($MouseEvents)); |
---|
[3802] | 105 | $GLOBALS['template']->assign('AK_THUMBNAILS_LOC', $me->ak_thumbnails_loc); |
---|
[5432] | 106 | $GLOBALS['template']->assign('AK_THUMBNAILS_LOCATIONS_KEYS', array_keys($ThumbnailsLocations)); |
---|
| 107 | $GLOBALS['template']->assign('AK_THUMBNAILS_LOCATIONS_VALUES', array_values($ThumbnailsLocations)); |
---|
[3764] | 108 | $GLOBALS['template']->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
[3761] | 109 | ?> |
---|