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

Last change on this file since 6913 was 6913, checked in by cljosse, 14 years ago

[Autosize]update plugin


File size: 6.7 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);
31// +-----------------------------------------------------------------------+
32// | Check Access and exit when user status is not ok                      |
33// +-----------------------------------------------------------------------+
34//check_status(ACCESS_ADMINISTRATOR);
35include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
36include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
37
38$my_base_url = get_admin_plugin_menu_link(__FILE__);
39
40
41$tabsheet = new tabsheet();
42$tabsheet->add( 'autosize_admin',
43                l10n('admin'),
44                $my_base_url.'&amp;tab=autosize_admin'
45                           );
46/*                 
47$tabsheet->add( 'autosize_content',
48                l10n('content'),
49                $my_base_url.'&amp;tab=autosize_content'
50                           );
51*/                         
52                           
53                           
54        if (!isset($_GET['tab']))
55           $page['tab'] = 'autosize_admin';
56else
57       $page['tab'] = $_GET['tab'];     
58           
59                           
60$tabsheet->select($page['tab']);
61$tabsheet->assign();
62
63$page['global'] = array();
64$error = array();
65
66global $user, $conf, $errors ;
67global $args, $autosizes_message,$erreur_message ;
68
69include_once (AUTOSIZE_PATH.'include/constants.php'); 
70
71$aff_nb=true;
72
73 ; 
74include_once(PHPWG_ROOT_PATH.'admin/include/functions.php');
75include_once (PHPWG_ROOT_PATH.'admin/include/tabsheet.class.php');
76
77
78$my_base_url = get_admin_plugin_menu_link(__FILE__);
79load_language('lang', AUTOSIZE_PATH ); 
80// *************************************************************************
81// |                          Sélection de l'onglet                        |
82// *************************************************************************
83$autosizes_message =""; 
84$erreur_message="";
85global $conf;
86global $autosize_parametres;
87global $template,$page,$conf ; 
88    global $picture;
89 
90  $visible=true;       
91
92        $path = AUTOSIZE_PATH;
93          $plg_data = implode( '', file($path.'main.inc.php') );
94          if ( preg_match("|Plugin Name: (.*)|", $plg_data, $val) )
95          {
96            $plugin['name'] = trim( $val[1] );
97          }
98          if (preg_match("|Version: (.*)|", $plg_data, $val))
99          {
100            $plugin['version'] = trim($val[1]);
101          }
102          if ( preg_match("|Plugin URI: (.*)|", $plg_data, $val) )
103          {
104            $plugin['uri'] = trim($val[1]);
105          }
106          if ($desc = load_language('description.txt', $path.'/', array('return' => true)))
107          {
108            $plugin['description'] = trim($desc);
109          }
110          elseif ( preg_match("|Description: (.*)|", $plg_data, $val) )
111          {
112            $plugin['description'] = trim($val[1]);
113          }
114          if ( preg_match("|Author: (.*)|", $plg_data, $val) )
115          {
116            $plugin['author'] = trim($val[1]);
117          }
118          if ( preg_match("|Author URI: (.*)|", $plg_data, $val) )
119          {
120            $plugin['author uri'] = trim($val[1]);
121          }
122          if (!empty($plugin['uri']) and strpos($plugin['uri'] , 'extension_view.php?eid='))
123          {
124            list( , $extension) = explode('extension_view.php?eid=', $plugin['uri']);
125            if (is_numeric($extension)) $plugin['extension'] = $extension;
126          }
127          // IMPORTANT SECURITY !
128          $plugin = array_map('htmlspecialchars', $plugin);
129
130$version = $plugin['version'] ;
131         $autosize_parametres = cl_autosize_Get_Options();
132
133
134         
135   if (isset($_POST['submit']))  { 
136          if ($_POST['submit'] == l10n('cl_autosize_save'))  { 
137                 cl_autosize_sauve_options_inf() ;
138                     unset($_POST); 
139                 }
140        }       
141        //=========================================
142        if (isset($_POST['img_start']))  {
143                 unset($_POST);
144                 }
145 include (AUTOSIZE_PATH."include/affiche.php");                 
146//================================================================================
147$base_url = get_root_url().'admin_autosize.php';
148switch ($page['tab'])
149 {
150  case 'autosize_admin':
151
152    $template->set_filenames(array('plugin_admin_content' => realpath(AUTOSIZE_PATH . 'admin/template/admin.tpl')));
153
154 
155    $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
156    break; 
157 
158case 'autosize_content':
159
160 
161 $template->set_filenames(array( 'plugin_admin_content' => realpath(AUTOSIZE_PATH . 'template/picture.tpl' )));
162 $template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
163 break; 
164  }
165if (!isset($autosizes_message)){
166                  $autosizes_message = "";
167                } 
168 
169 
170                 
171                if  ($autosizes_message != "")  {
172                   array_push($page['autosizes'],  $autosizes_message);
173                 $autosizes_message="";
174                 }
175                if (!isset($erreur_message)){
176                  $erreur_message = "";
177                }               
178                if  ($erreur_message != "")  {
179       
180                  array_push($page['errors'], $erreur_message);
181                  $erreur_message="";
182       
183                 
184                 }               
185                 
186//================================================================
187 
188
189?>
Note: See TracBrowser for help on using the repository browser.