1 | <?php |
---|
2 | // +-----------------------------------------------------------------------+ |
---|
3 | // | Piwigo - a PHP based picture gallery | |
---|
4 | // +-----------------------------------------------------------------------+ |
---|
5 | // | Copyright(C) 2008-2009 Piwigo Team http://piwigo.org | |
---|
6 | // | Copyright(C) 2003-2008 PhpWebGallery Team http://phpwebgallery.net | |
---|
7 | // | Copyright(C) 2002-2003 Pierrick LE GALL http://le-gall.net/pierrick | |
---|
8 | // +-----------------------------------------------------------------------+ |
---|
9 | // | This program is free software; you can redistribute it and/or modify | |
---|
10 | // | it under the terms of the GNU General Public License as published by | |
---|
11 | // | the Free Software Foundation | |
---|
12 | // | | |
---|
13 | // | This program is distributed in the hope that it will be useful, but | |
---|
14 | // | WITHOUT ANY WARRANTY; without even the implied warranty of | |
---|
15 | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
---|
16 | // | General Public License for more details. | |
---|
17 | // | | |
---|
18 | // | You should have received a copy of the GNU General Public License | |
---|
19 | // | along with this program; if not, write to the Free Software | |
---|
20 | // | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, | |
---|
21 | // | USA. | |
---|
22 | // +-----------------------------------------------------------------------+ |
---|
23 | |
---|
24 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
25 | if (!defined('AUTOSIZE_DIR')) define('AUTOSIZE_DIR' , basename(dirname(__FILE__))); |
---|
26 | if (!defined('AUTOSIZE_PATH')) |
---|
27 | define( |
---|
28 | 'AUTOSIZE_PATH', |
---|
29 | PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/' |
---|
30 | ); |
---|
31 | if (!defined('ROOT_URL')) |
---|
32 | define( 'ROOT_URL', get_root_url().'/' ); |
---|
33 | |
---|
34 | if (!defined('AUTOSIZE_PATH_ABS')) |
---|
35 | define('AUTOSIZE_PATH_ABS', realpath(AUTOSIZE_PATH)."/"); |
---|
36 | |
---|
37 | // +-----------------------------------------------------------------------+ |
---|
38 | // | Check Access and exit when user status is not ok | |
---|
39 | // +-----------------------------------------------------------------------+ |
---|
40 | //check_status(ACCESS_ADMINISTRATOR); |
---|
41 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
42 | include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); |
---|
43 | |
---|
44 | |
---|
45 | $my_base_url = get_admin_plugin_menu_link(__FILE__); |
---|
46 | |
---|
47 | |
---|
48 | $tabsheet = new tabsheet(); |
---|
49 | $tabsheet->add( 'autosize_admin', |
---|
50 | l10n('admin'), |
---|
51 | $my_base_url.'&tab=autosize_admin' |
---|
52 | ); |
---|
53 | /* |
---|
54 | $tabsheet->add( 'autosize_help', |
---|
55 | l10n('help'), |
---|
56 | $my_base_url.'&tab=autosize_help' |
---|
57 | ); |
---|
58 | |
---|
59 | */ |
---|
60 | |
---|
61 | if (!isset($_GET['tab'])) |
---|
62 | $page['tab'] = 'autosize_admin'; |
---|
63 | else |
---|
64 | $page['tab'] = $_GET['tab']; |
---|
65 | |
---|
66 | |
---|
67 | $tabsheet->select($page['tab']); |
---|
68 | $tabsheet->assign(); |
---|
69 | |
---|
70 | $page['global'] = array(); |
---|
71 | $error = array(); |
---|
72 | |
---|
73 | global $user, $conf, $errors ; |
---|
74 | global $args, $autosizes_message,$erreur_message ; |
---|
75 | |
---|
76 | include_once (AUTOSIZE_PATH.'include/constants.php'); |
---|
77 | |
---|
78 | $aff_nb=true; |
---|
79 | |
---|
80 | ; |
---|
81 | include_once(PHPWG_ROOT_PATH.'admin/include/functions.php'); |
---|
82 | include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php'); |
---|
83 | |
---|
84 | |
---|
85 | $my_base_url = get_admin_plugin_menu_link(__FILE__); |
---|
86 | load_language('plugin.lang', AUTOSIZE_PATH ); |
---|
87 | // ************************************************************************* |
---|
88 | // | Sélection de l'onglet | |
---|
89 | // ************************************************************************* |
---|
90 | global $infos_message , $erreur_message ,$warnings_message ; |
---|
91 | global $conf; |
---|
92 | global $autosize_parametres; |
---|
93 | global $template,$page,$conf ; |
---|
94 | global $picture; |
---|
95 | |
---|
96 | $visible=true; |
---|
97 | $path = AUTOSIZE_PATH; |
---|
98 | global $has_pamoorama,$autosize_parametres; |
---|
99 | global $defined_types,$pictureDeriv ,$liste_type,$SRC_IMG; |
---|
100 | global $pictureSelType ; |
---|
101 | $reload=false ; |
---|
102 | include (AUTOSIZE_PATH."include/affiche.php"); |
---|
103 | $autosize_parametres = cl_autosize_Get_Options(); |
---|
104 | $types = array_intersect(array_keys(ImageStdParams::get_defined_type_map()), array("Autosize","SelMaxi")); |
---|
105 | if (count($types)==0){ |
---|
106 | if(!isset($warnings_message)) $warnings_message=""; |
---|
107 | include_once (AUTOSIZE_PATH.'maintain.inc.php'); |
---|
108 | if (isset($conf['cl_derivatives_sav'])) { |
---|
109 | plugin_deactivate() ; |
---|
110 | } |
---|
111 | plugin_activate(); |
---|
112 | $warnings_message .= "Set :"; |
---|
113 | $defined_types = array_keys(ImageStdParams::get_defined_type_map()); |
---|
114 | $warnings_message .= cl_print_var($defined_types); |
---|
115 | $reload=true ; |
---|
116 | } |
---|
117 | $defined_types = array_keys(ImageStdParams::get_defined_type_map()); |
---|
118 | |
---|
119 | if (isset($_POST['submit'])) { |
---|
120 | if ($_POST['submit'] == l10n('cl_autosize_save')) { |
---|
121 | cl_autosize_sauve_options_inf() ; |
---|
122 | // unset($_POST); |
---|
123 | } |
---|
124 | } |
---|
125 | //========================================= |
---|
126 | if (isset($_POST['img_start'])) { |
---|
127 | unset($_POST); |
---|
128 | } |
---|
129 | |
---|
130 | //================================================================================ |
---|
131 | $base_url = get_root_url().'admin_autosize.php'; |
---|
132 | switch ($page['tab']) |
---|
133 | { |
---|
134 | case 'autosize_admin': |
---|
135 | $template->set_filenames(array('plugin_admin_content' => realpath(AUTOSIZE_PATH . 'admin/template/admin.tpl'))); |
---|
136 | $template->assign( |
---|
137 | array( 'reload' => $reload, |
---|
138 | |
---|
139 | )); |
---|
140 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
141 | break; |
---|
142 | |
---|
143 | case 'autosize_help': |
---|
144 | |
---|
145 | $message=" |
---|
146 | <script id='dimensions' src='./plugins/Autosize/js/autosize.dimensions.js'></script> |
---|
147 | <script id='Affiche_script' src='./plugins/Autosize/js/Affiche_script.js'></script> |
---|
148 | <fieldset id='fieldset'> |
---|
149 | <div class='autosize' |
---|
150 | autosize='MargeBasse:30px;MargeHaute:30px;parent:fieldset;ResizePicture:true'> |
---|
151 | <img src='./plugins/Autosize/images/quadrille_100.png ' width='100%' /> |
---|
152 | </div> |
---|
153 | </fieldset>"; |
---|
154 | if (isset($_POST['valid'])) { $message = empty($_POST['texte']) ? $message : stripslashes($_POST['texte']); |
---|
155 | } |
---|
156 | //========================================================================= |
---|
157 | |
---|
158 | |
---|
159 | $toolbar = 'Full'; //basic |
---|
160 | $width = 'auto'; |
---|
161 | $height = 'auto'; |
---|
162 | $areas = array(); |
---|
163 | $areas[]='texte'; |
---|
164 | if (!empty($areas)){ |
---|
165 | if (function_exists('set_fckeditor_instance')) |
---|
166 | { $template->set_prefilter('plugin_admin_content', 'add_remove_button'); |
---|
167 | set_fckeditor_instance($areas, $toolbar, $width, $height); |
---|
168 | } |
---|
169 | } |
---|
170 | |
---|
171 | $template->set_filenames(array( 'plugin_admin_content' => realpath(AUTOSIZE_PATH . 'admin/template/help.tpl' ))); |
---|
172 | $template->assign( |
---|
173 | array( |
---|
174 | 'message' => $message |
---|
175 | )); |
---|
176 | |
---|
177 | |
---|
178 | $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content'); |
---|
179 | break; |
---|
180 | } |
---|
181 | if (!isset($infos_message)){ |
---|
182 | $infos_message = ""; |
---|
183 | } |
---|
184 | if ($infos_message != "") { |
---|
185 | array_push($page['infos'], $infos_message); |
---|
186 | $infos_message=""; |
---|
187 | } |
---|
188 | if (!isset($erreur_message)){ |
---|
189 | $erreur_message = ""; |
---|
190 | } |
---|
191 | if ($erreur_message != "") { |
---|
192 | array_push($page['errors'], $erreur_message); |
---|
193 | $erreur_message=""; |
---|
194 | } |
---|
195 | if (!isset($warnings_message)){ |
---|
196 | $warnings_message = ""; |
---|
197 | } |
---|
198 | |
---|
199 | if ($warnings_message != "") { |
---|
200 | array_push($page['warnings'], $warnings_message); |
---|
201 | $warnings_message=""; |
---|
202 | } |
---|
203 | |
---|
204 | |
---|
205 | //================================================================ |
---|
206 | |
---|
207 | |
---|
208 | ?> |
---|