source: extensions/Autosize/admin/admin_autosize.php @ 17503

Last change on this file since 17503 was 17503, checked in by cljosse, 12 years ago

[extensions] Autosize fix compatibility with 2.4, update

File size: 6.6 KB
Line 
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
24if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
25if (!defined('AUTOSIZE_DIR')) define('AUTOSIZE_DIR' , basename(dirname(__FILE__)));
26if (!defined('AUTOSIZE_PATH')) 
27define(
28  'AUTOSIZE_PATH',
29   PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'
30);
31if (!defined('ROOT_URL')) 
32define(  'ROOT_URL',  get_root_url().'/' );
33
34if (!defined('AUTOSIZE_PATH_ABS')) 
35define('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);
41include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
42include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
43
44$my_base_url = get_admin_plugin_menu_link(__FILE__);
45
46
47
48$tabsheet = new tabsheet();
49$tabsheet->add( 'autosize_admin',
50                l10n('admin'),
51                $my_base_url.'&amp;tab=autosize_admin'
52                           );
53 /*     
54$tabsheet->add( 'autosize_help',
55                l10n('help'),
56                $my_base_url.'&amp;tab=autosize_help'
57                           );
58                           
59        */         
60                           
61        if (!isset($_GET['tab']))
62           $page['tab'] = 'autosize_admin';
63else
64       $page['tab'] = $_GET['tab'];     
65           
66                           
67$tabsheet->select($page['tab']);
68$tabsheet->assign();
69
70$page['global'] = array();
71$error = array();
72
73global $user, $conf, $errors ;
74global $args, $autosizes_message,$erreur_message ;
75
76include_once (AUTOSIZE_PATH.'include/constants.php'); 
77
78$aff_nb=true;
79
80 ; 
81include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
82include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
83
84
85$my_base_url = get_admin_plugin_menu_link(__FILE__);
86load_language('plugin.lang', AUTOSIZE_PATH ); 
87// *************************************************************************
88// |                          Sélection de l'onglet                        |
89// *************************************************************************
90global $infos_message ; 
91global $erreur_message;
92global $conf;
93global $autosize_parametres;
94global $template,$page,$conf ; 
95    global $picture;
96 
97 $visible=true; 
98 $path = AUTOSIZE_PATH;
99global $has_pamoorama,$select_type,$autosize_parametres;
100global $defined_types,$maxi_img ,$pictureDeriv ,$liste_type,$SRC_IMG;
101  $defined_types = array_keys(ImageStdParams::get_defined_type_map()); 
102  $autosize_parametres = cl_autosize_Get_Options();
103         
104   if (isset($_POST['submit']))  { 
105          if ($_POST['submit'] == l10n('cl_autosize_save'))  { 
106                 cl_autosize_sauve_options_inf() ;
107                     unset($_POST); 
108                 }
109        }       
110        //=========================================
111        if (isset($_POST['img_start']))  {
112                 unset($_POST);
113                 }
114  include (AUTOSIZE_PATH."include/affiche.php");                 
115//================================================================================
116$base_url = get_root_url().'admin_autosize.php';
117switch ($page['tab'])
118 {
119  case 'autosize_admin':
120    $template->set_filenames(array('plugin_admin_content' => realpath(AUTOSIZE_PATH . 'admin/template/admin.tpl')));
121    $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
122    break; 
123 
124case 'autosize_help': 
125
126 $message="
127    <script id='dimensions' src='./plugins/Autosize/js/autosize.dimensions.js'></script>
128    <script id='Affiche_script' src='./plugins/Autosize/js/Affiche_script.js'></script>
129    <fieldset id='fieldset'>
130    <div class='autosize'
131         autosize='MargeBasse:30px;MargeHaute:30px;parent:fieldset;ResizePicture:true'>
132        <img src='./plugins/Autosize/images/quadrille_100.png ' width='100%' />       
133    </div>
134</fieldset>"; 
135    if (isset($_POST['valid']))  {      $message = empty($_POST['texte']) ? $message : stripslashes($_POST['texte']);
136        }       
137    //=========================================================================
138   
139
140     $toolbar = 'Full';         //basic
141                $width = 'auto';
142                $height = 'auto';
143                $areas = array();
144                $areas[]='texte';
145                if (!empty($areas)){
146                                if (function_exists('set_fckeditor_instance'))
147                {  $template->set_prefilter('plugin_admin_content', 'add_remove_button');
148                                 set_fckeditor_instance($areas, $toolbar, $width, $height);
149                    }
150                        }
151
152 $template->set_filenames(array( 'plugin_admin_content' => realpath(AUTOSIZE_PATH . 'admin/template/help.tpl' )));
153 $template->assign(
154                                        array(
155   'message' =>  $message  ,
156   ));
157
158
159 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
160 break; 
161  }
162       if (!isset($infos_message)){
163                  $infos_message = "";
164                }                 
165                if  ($infos_message != "")  {
166                   array_push($page['infos'],  $infos_message);
167                   $infos_message="";
168                 }
169                if (!isset($erreur_message)){
170                  $erreur_message = "";
171                }               
172                if  ($erreur_message != "")  {
173       
174                  array_push($page['errors'], $erreur_message);
175                  $erreur_message="";
176       
177                 
178                 }               
179                 
180//================================================================
181 
182
183?>
Note: See TracBrowser for help on using the repository browser.