source: extensions/Stereo/config.php @ 22478

Last change on this file since 22478 was 5556, checked in by pbra, 15 years ago

Stereo Plugin : v2.0.b added admin menu better help button placement ...

File size: 4.1 KB
Line 
1<?php
2// +-----------------------------------------------------------------------+
3// | Stereo - a Piwigo Plugin                                              |
4// +-----------------------------------------------------------------------+
5// | Copyright(C) 2010 philippe Brangier                                   |
6// +-----------------------------------------------------------------------+
7// | This program is free software; you can redistribute it and/or modify  |
8// | it under the terms of the GNU General Public License as published by  |
9// | the Free Software Foundation                                          |
10// |                                                                       |
11// | This program is distributed in the hope that it will be useful, but   |
12// | WITHOUT ANY WARRANTY; without even the implied warranty of            |
13// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU      |
14// | General Public License for more details.                              |
15// |                                                                       |
16// | You should have received a copy of the GNU General Public License     |
17// | along with this program; if not, write to the Free Software           |
18// | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, |
19// | USA.                                                                  |
20// +-----------------------------------------------------------------------+
21/* Configuration of Stereo */
22if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
23if (!defined('IN_ADMIN') or !IN_ADMIN) die('Hacking attempt!');
24load_language('plugin.lang', STEREO_PATH);
25$stereoSerialized = @file_get_contents( $conf['local_data_dir'].'/plugins/'.STEREO_DIR.'.dat');
26if ($stereoSerialized!==false) $stereo = unserialize($stereoSerialized); else $stereo = array();
27
28$errors = array();
29$infos = array();
30
31$sub = ( isset($_POST['submit']) ) ? true : false;
32
33 if ($sub) {
34   $stereo = array_merge($stereo, $_POST);
35   //traitement du cas de checkbox
36   if (!isset($_POST['allowFullScreen']))       $stereo['allowFullScreen'] = 'false'; 
37   if (!isset($_POST['showhelp']))                      $stereo['showhelp'] = 'false'; 
38   }
39        // if ( $charlie['forced_width']!='' and (!is_numeric($charlie['forced_width']) or $charlie['forced_width'] < 90 or $charlie['forced_width'] > 1024 ))
40    // array_push($errors, l10n('Forced width is out of range (Correct range: 90-1024)'));
41        // if ( $charlie['forced_height']!='' and (!is_numeric($charlie['forced_height']) or $charlie['forced_height'] < 90 or $charlie['forced_height'] > 1024 ))
42    // array_push($errors, l10n('Forced height is out of range (Correct range: 90-1024)'));
43        // if (!is_numeric($charlie['video_default_width']) or $charlie['video_default_width'] < 90 or $charlie['video_default_width'] > 1024 )
44    // array_push($errors, l10n('Default width is out of range (Correct range: 90-1024)'));
45// }
46
47// Submit and errors
48if ( $sub )
49{
50        if ( count($errors) > 0 )
51        array_push($errors, l10n('Your configuration is NOT saved due to above reasons.'));
52}
53// Submit and Advisor => Thanks
54if ( $sub and is_adviser() and count($errors) == 0 )
55        array_push($infos, l10n('You are Adviser and you are not authorized to change this configuration.'));
56
57// Submit and not Advisor => Update Config table
58if ( $sub and !is_adviser() and count($errors) == 0 )
59{
60  $dir = $conf['local_data_dir'].'/plugins/';
61  @mkdir($dir);
62//var_dump($_POST);
63  $file = fopen( $dir.STEREO_DIR.'.dat', 'w' );
64  fwrite($file, serialize($stereo));
65  fclose( $file );
66        array_push($infos, l10n('Your configuration is saved.'));
67}
68// Send data
69$template->set_filenames(array(
70    'plugin_admin_content' => dirname(__FILE__) . '/config.tpl'));
71if (count($errors) != 0) $template->assign('errors', $errors);
72if (count($infos) != 0) $template->assign('infos', $infos);
73//if ($stereo['onclick']==0) $stereo['onclick'] =  'playpause'; // ???
74$template->assign(array(
75        'stereo' => $stereo,
76        'STEREO_PATH' => STEREO_PATH,
77        ) );
78$template->assign_var_from_handle('ADMIN_CONTENT', 'plugin_admin_content');
79//var_dump($stereo);
80?>
Note: See TracBrowser for help on using the repository browser.