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

Last change on this file since 11442 was 11442, checked in by cljosse, 13 years ago

[extensions] Autosize fix compatibility with charlies

File size: 6.4 KB
RevLine 
[6912]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);
[8912]31if (!defined('ROOT_URL')) 
32define(  'ROOT_URL',  get_root_url().'/' );
[11442]33
[8912]34if (!defined('AUTOSIZE_PATH_ABS')) 
[11442]35define('AUTOSIZE_PATH_ABS', realpath(AUTOSIZE_PATH)."/");
[8912]36
[6912]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
[6978]47
[6912]48$tabsheet = new tabsheet();
49$tabsheet->add( 'autosize_admin',
50                l10n('admin'),
51                $my_base_url.'&amp;tab=autosize_admin'
52                           );
[8912]53 /*     
[8864]54$tabsheet->add( 'autosize_help',
55                l10n('help'),
56                $my_base_url.'&amp;tab=autosize_help'
[6912]57                           );
58                           
[8912]59        */         
[6912]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__);
[10845]86load_language('plugin.lang', AUTOSIZE_PATH ); 
[6912]87// *************************************************************************
88// |                          Sélection de l'onglet                        |
89// *************************************************************************
[8864]90global $infos_message ; 
91global $erreur_message;
[6912]92global $conf;
93global $autosize_parametres;
94global $template,$page,$conf ; 
95    global $picture;
96 
[8864]97 $visible=true; 
98 $path = AUTOSIZE_PATH;
99 $autosize_parametres = cl_autosize_Get_Options();
[7899]100         
[6912]101   if (isset($_POST['submit']))  { 
[6913]102          if ($_POST['submit'] == l10n('cl_autosize_save'))  { 
[6912]103                 cl_autosize_sauve_options_inf() ;
104                     unset($_POST); 
105                 }
106        }       
107        //=========================================
108        if (isset($_POST['img_start']))  {
109                 unset($_POST);
110                 }
111 include (AUTOSIZE_PATH."include/affiche.php");                 
112//================================================================================
[6913]113$base_url = get_root_url().'admin_autosize.php';
[6912]114switch ($page['tab'])
115 {
116  case 'autosize_admin':
117    $template->set_filenames(array('plugin_admin_content' => realpath(AUTOSIZE_PATH . 'admin/template/admin.tpl')));
118    $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
119    break; 
120 
[8864]121case 'autosize_help': 
[6912]122
[8911]123 $message="
[10845]124    <script id='dimensions' src='./plugins/Autosize/js/autosize.dimensions.js'></script>
[8864]125    <script id='Affiche_script' src='./plugins/Autosize/js/Affiche_script.js'></script>
[8911]126    <fieldset id='fieldset'>
[8864]127    <div class='autosize'
[8911]128         autosize='MargeBasse:30px;MargeHaute:30px;parent:fieldset;ResizePicture:true'>
129        <img src='./plugins/Autosize/images/ECO_050.jpg ' width='100%' />       
[8864]130    </div>
131</fieldset>"; 
132    if (isset($_POST['valid']))  {      $message = empty($_POST['texte']) ? $message : stripslashes($_POST['texte']);
133        }       
[8911]134    //=========================================================================
135   
136
137     $toolbar = 'Full';         //basic
138                $width = 'auto';
139                $height = 'auto';
[8864]140                $areas = array();
141                $areas[]='texte';
142                if (!empty($areas)){
143                                if (function_exists('set_fckeditor_instance'))
[8911]144                {  $template->set_prefilter('plugin_admin_content', 'add_remove_button');
145                                 set_fckeditor_instance($areas, $toolbar, $width, $height);
146                    }
[8864]147                        }
148
149 $template->set_filenames(array( 'plugin_admin_content' => realpath(AUTOSIZE_PATH . 'admin/template/help.tpl' )));
150 $template->assign(
151                                        array(
152   'message' =>  $message  ,
153   ));
154
155
[6912]156 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
157 break; 
158  }
[8864]159       if (!isset($infos_message)){
160                  $infos_message = "";
161                }                 
162                if  ($infos_message != "")  {
163                   array_push($page['infos'],  $infos_message);
164                   $infos_message="";
[6912]165                 }
166                if (!isset($erreur_message)){
167                  $erreur_message = "";
168                }               
169                if  ($erreur_message != "")  {
170       
171                  array_push($page['errors'], $erreur_message);
172                  $erreur_message="";
173       
174                 
175                 }               
176                 
177//================================================================
178 
179
180?>
Note: See TracBrowser for help on using the repository browser.