source: extensions/Panoramas/AS_Panorama_admin.php @ 11298

Last change on this file since 11298 was 6533, checked in by vdigital, 14 years ago

Fix: Notice: Undefined index: name in .../plugins/Panoramas/AS_Panorama.php on line 47
Fix: Panorama / Panoramas
Fix: Panoramas are disconnected when picture widths are lower than the viewport width

File size: 3.3 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['min_viewport_width']=='' or !is_numeric($nsp['min_viewport_width']) or $nsp['min_viewport_width'] < 320 )
23    array_push($errors, l10n('Minimal Viewport width is out of range (Correct range: 320/+).')); 
24        if ( $nsp['max_viewport_width']=='' or !is_numeric($nsp['max_viewport_width']) or $nsp['max_viewport_width'] < $nsp['min_viewport_width'] )
25    array_push($errors, l10n('Maximal Viewport width is out of range (Correct range: Minimal/+).')); 
26        if ( $nsp['speed']=='' or !is_numeric($nsp['speed']) or $nsp['speed'] < 10 or $nsp['speed'] > 90 )
27    array_push($errors, l10n('Relative speed factor is out of range (Correct range: 10-90).')); 
28        if ( $nsp['start_position']=='' or !is_numeric($nsp['start_position']) or $nsp['start_position'] < 0 or $nsp['start_position'] > 99 )
29    array_push($errors, l10n('Start position ratio is out of range (Correct range: 0-99).')); 
30  $nsp['in_mode_360'] = trim((string) $nsp['in_mode_360']);
31  $nsp['in_mode_180'] = trim((string) $nsp['in_mode_180']);
32        if ( $nsp['in_mode_360']=='' or $nsp['in_mode_180']=='' )
33    array_push($errors, l10n('Picture name substring could not be empty.')); 
34        if ( $nsp['in_mode_360'] == $nsp['in_mode_180'] )
35    array_push($errors, l10n('Picture name substrings must be different.')); 
36        if ( count($errors) > 0 )
37        array_push($errors, l10n('Your configuration is NOT saved due to above reasons.'));
38  if ( !is_webmaster() and count($errors) == 0 )
39    array_push($infos, l10n('You are not authorized to change this configuration (Webmaster only).'));
40  if ( is_webmaster() and count($errors) == 0 )
41  {
42    $nsp = array_merge( $asp, $nsp );
43    unset($nsp['submit'], $nsp['Ver'], $nsp['Path'], $nsp['Dir']);
44    // var_dump($nsp);
45    $confasp = serialize($nsp);
46    conf_update_param('AS_panorama', $confasp);
47        array_push($infos, l10n('Your configuration is saved.'));
48  }
49  $asp = $nsp;
50}
51$template->set_filenames( array('AS_panorama_admin' => dirname(__FILE__).'/template/AS_Panorama_admin.tpl') );
52foreach ($asp as $k => & $v) {
53  if (is_string($v)) $asp[$k] = htmlspecialchars($v, ENT_QUOTES, 'utf-8');
54  else $asp[$k] = $v;
55}
56if (count($errors) != 0) $template->assign('errors', $errors);
57if (count($infos) != 0) $template->assign('infos', $infos);
58$asp['Path'] = embellish_url($template->get_template_vars('ROOT_URL').ASP_PATH);
59$asp = array_merge( $asp, array(
60        'Dir' => ASP_DIR,
61        'Path' => ASP_PATH,
62        'Ver' => ASP_VER,
63  ));
64$template->assign( 'ASP', $asp );
65$template->assign_var_from_handle('ADMIN_CONTENT', 'AS_panorama_admin');
66?>
Note: See TracBrowser for help on using the repository browser.