source: extensions/Panoramas/AS_Panorama_admin.php @ 19460

Last change on this file since 19460 was 19460, checked in by Klarsfeld, 11 years ago

Upgrade for Piwigo 2.4.5
Only languages en-UK and fr-FR upgraded

File size: 3.5 KB
Line 
1<?php
2/* Configuration of Panoramas */
3if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
4if (!defined('IN_ADMIN') or !IN_ADMIN) die('Hacking attempt!');
5load_language('plugin.lang', ASP_PATH);
6
7global $conf, $template;
8$errors = array();
9$infos = array();
10$asp = & $conf['AS_panorama'];
11
12$sub = ( isset($_POST['submit']) ) ? true : false;
13
14if ( $sub ) {
15        // 'in_mode_360' => '_360',
16  // Picture name substring to display in Mode 360     
17        // 'in_mode_180' => '_180', #
18  // Picture name substring to display in Mode 180
19  $nsp = array_merge($asp, $_POST);
20        if ( $nsp['viewport_width']=='' or !is_numeric($nsp['viewport_width']) or $nsp['viewport_width'] < 50 or $nsp['viewport_width'] > 100 )
21    array_push($errors, l10n('Viewport width ratio is out of range (Correct range: 50-100).'));
22        if ( $nsp['viewport_height']=='' or !is_numeric($nsp['viewport_height']) or $nsp['viewport_height'] < 500 or $nsp['viewport_height'] > 800 )
23    array_push($errors, l10n('Viewport height is out of range (Correct range: 500/+).')); 
24        if ( $nsp['min_viewport_width']=='' or !is_numeric($nsp['min_viewport_width']) or $nsp['min_viewport_width'] < 320 )
25    array_push($errors, l10n('Minimal Viewport width is out of range (Correct range: 320/+).')); 
26        if ( $nsp['max_viewport_width']=='' or !is_numeric($nsp['max_viewport_width']) or $nsp['max_viewport_width'] < $nsp['min_viewport_width'] )
27    array_push($errors, l10n('Maximal Viewport width is out of range (Correct range: Minimal/+).')); 
28        if ( $nsp['speed']=='' or !is_numeric($nsp['speed']) or $nsp['speed'] < 10 or $nsp['speed'] > 90 )
29    array_push($errors, l10n('Relative speed factor is out of range (Correct range: 10-90).')); 
30        if ( $nsp['start_position']=='' or !is_numeric($nsp['start_position']) or $nsp['start_position'] < 0 or $nsp['start_position'] > 99 )
31    array_push($errors, l10n('Start position ratio is out of range (Correct range: 0-99).')); 
32  $nsp['in_mode_360'] = trim((string) $nsp['in_mode_360']);
33  $nsp['in_mode_180'] = trim((string) $nsp['in_mode_180']);
34        if ( $nsp['in_mode_360']=='' or $nsp['in_mode_180']=='' )
35    array_push($errors, l10n('Picture name substring could not be empty.')); 
36        if ( $nsp['in_mode_360'] == $nsp['in_mode_180'] )
37    array_push($errors, l10n('Picture name substrings must be different.')); 
38        if ( count($errors) > 0 )
39        array_push($errors, l10n('Your configuration is NOT saved due to above reasons.'));
40  if ( !is_webmaster() and count($errors) == 0 )
41    array_push($infos, l10n('You are not authorized to change this configuration (Webmaster only).'));
42  if ( is_webmaster() and count($errors) == 0 )
43  {
44    $nsp = array_merge( $asp, $nsp );
45    unset($nsp['submit'], $nsp['Ver'], $nsp['Path'], $nsp['Dir']);
46    // var_dump($nsp);
47    $confasp = serialize($nsp);
48    conf_update_param('AS_panorama', $confasp);
49        array_push($infos, l10n('Your configuration is saved.'));
50  }
51  $asp = $nsp;
52}
53$template->set_filenames( array('AS_panorama_admin' => dirname(__FILE__).'/template/AS_Panorama_admin.tpl') );
54foreach ($asp as $k => & $v) {
55  if (is_string($v)) $asp[$k] = htmlspecialchars($v, ENT_QUOTES, 'utf-8');
56  else $asp[$k] = $v;
57}
58if (count($errors) != 0) $template->assign('errors', $errors);
59if (count($infos) != 0) $template->assign('infos', $infos);
60$asp['Path'] = embellish_url($template->get_template_vars('ROOT_URL').ASP_PATH);
61$asp = array_merge( $asp, array(
62        'Dir' => ASP_DIR,
63        'Path' => ASP_PATH,
64        'Ver' => ASP_VER,
65  ));
66$template->assign( 'ASP', $asp );
67$template->assign_var_from_handle('ADMIN_CONTENT', 'AS_panorama_admin');
68?>
Note: See TracBrowser for help on using the repository browser.