[6610] | 1 | <?php |
---|
| 2 | /* Configuration of Panoramas */ |
---|
| 3 | if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!'); |
---|
| 4 | if (!defined('IN_ADMIN') or !IN_ADMIN) die('Hacking attempt!'); |
---|
| 5 | load_language('plugin.lang', VAG_PATH); |
---|
| 6 | |
---|
| 7 | global $conf, $template, $user; |
---|
| 8 | $errors = array(); |
---|
| 9 | $infos = array(); |
---|
| 10 | |
---|
| 11 | $vag = & $conf['virtual_AutoGrant']; |
---|
| 12 | |
---|
| 13 | $sub = ( isset($_POST['submit']) ) ? true : false; |
---|
| 14 | |
---|
| 15 | if ( $sub ) { |
---|
| 16 | $nsp = array_merge($vag, $_POST); |
---|
| 17 | if ( $user['id'] != $conf['webmaster_id'] and $nsp['grant_to_webmaster'] != $vag['grant_to_webmaster']) { |
---|
| 18 | $nsp['grant_to_webmaster'] = $vag['grant_to_webmaster']; |
---|
| 19 | array_push($infos, l10n('Grant automatically the default webmaster has been reset to its previous value.')); |
---|
| 20 | } |
---|
| 21 | // if ( count($errors) > 0 ) |
---|
| 22 | // array_push($errors, l10n('Your configuration is NOT saved due to above reasons.')); |
---|
| 23 | if ( !is_webmaster() and count($errors) == 0 ) |
---|
| 24 | array_push($infos, l10n('You are not authorized to change this configuration (Webmaster only).')); |
---|
| 25 | if ( is_webmaster() and count($errors) == 0 ) |
---|
| 26 | { |
---|
| 27 | $nsp = array_merge( $vag, array_intersect_key($nsp, $vag) ); |
---|
| 28 | // var_dump($nsp); |
---|
| 29 | $confvag = serialize($nsp); |
---|
| 30 | conf_update_param('virtual_AutoGrant', $confvag); |
---|
| 31 | array_push($infos, l10n('Your configuration is saved.')); |
---|
| 32 | } |
---|
[6613] | 33 | $vag = array_merge($vag, $nsp); |
---|
[6610] | 34 | } |
---|
| 35 | $template->set_filenames( array('VAG_admin' => dirname(__FILE__).'/template/VAG_admin.tpl') ); |
---|
| 36 | // foreach ($vag as $k => & $v) { |
---|
| 37 | // if (is_string($v)) $vag[$k] = htmlspecialchars($v, ENT_QUOTES, 'utf-8'); |
---|
| 38 | // else $vag[$k] = $v; |
---|
| 39 | // } |
---|
| 40 | // if (count($errors) != 0) $template->assign('errors', $errors); |
---|
| 41 | if (count($infos) != 0) $template->assign('infos', $infos); |
---|
| 42 | $vag = array_merge( $vag, array( |
---|
| 43 | 'Dir' => VAG_DIR, |
---|
[6619] | 44 | 'Path' => VAG_PATH, |
---|
[6610] | 45 | 'Ver' => VAG_VER, |
---|
| 46 | )); |
---|
| 47 | $template->assign( 'VAG', $vag ); |
---|
| 48 | $template->assign_var_from_handle('ADMIN_CONTENT', 'VAG_admin'); |
---|
| 49 | ?> |
---|