modernising uiconfig a little bit and fixed mulitiple levels for framework for framed templates

This commit is contained in:
Ralf Becker 2010-07-29 17:02:20 +00:00
parent fcec62794e
commit cff42abd07

View File

@ -1,17 +1,17 @@
<?php
/**************************************************************************\
* eGroupWare - Admin config *
* Written by Miles Lott <milos@groupwhere.org> *
* http://www.egroupware.org *
* -------------------------------------------- *
* This program is free software; you can redistribute it and/or modify it *
* under the terms of the GNU General Public License as published by the *
* Free Software Foundation; either version 2 of the License, or (at your *
* option) any later version. *
\**************************************************************************/
/* $Id$ */
/**
* eGgroupWare admin - site configuration
*
* @link http://www.egroupware.org
* @author Miles Lott <milos@groupwhere.org>
* @package admin
* @license http://opensource.org/licenses/gpl-license.php GPL - GNU General Public License
* @version $Id$
*/
/**
* Site configuration for all apps using an $app/templates/default/config.tpl
*/
class uiconfig
{
var $public_functions = array('index' => True);
@ -20,32 +20,22 @@
{
if ($GLOBALS['egw']->acl->check('site_config_access',1,'admin'))
{
$GLOBALS['egw']->redirect_link('/index.php');
egw::redirect_link('/index.php');
}
$referer = $_POST['submit'] || $_POST['cancel'] ? $_POST['referer'] : $_SERVER['HTTP_REFERER'];
if (!$referer) $referer = $GLOBALS['egw']->link('/admin/index.php');
if ($GLOBALS['egw_info']['server']['webserver_url'])
{
list(,$show_app) = explode($GLOBALS['egw_info']['server']['webserver_url'],$referer);
}
else
{
$parts = parse_url($referer);
$show_app = $parts['path'];
unset($parts);
}
list(,$show_app) = explode('/',$show_app);
$referer = $_POST['submit'] || $_POST['cancel'] ? $_POST['referer'] :
common::get_referer('/admin/index.php',$_POST['referer']);
list(,$show_app) = explode('/',$referer);
if (!$show_app) $show_app = 'admin';
// load the translations of the app we show too, so they dont need to be in admin!
if ($_GET['appname'] != 'admin')
{
$GLOBALS['egw']->translation->add_app($_GET['appname']);
translation::add_app($_GET['appname']);
}
if(get_magic_quotes_gpc() && is_array($_POST['newsettings']))
{
$_POST['newsettings'] = $this->array_stripslashes($_POST['newsettings']);
$_POST['newsettings'] = array_stripslashes($_POST['newsettings']);
}
switch($_GET['appname'])
@ -65,7 +55,7 @@
case 'phpgwapi':
case '':
/* This keeps the admin from getting into what is a setup-only config */
$GLOBALS['egw']->redirect_link('/admin/index.php');
egw::redirect_link('/admin/index.php');
break;
default:
$appname = $_GET['appname'];
@ -84,7 +74,7 @@
if ($_POST['cancel'] || $_POST['submit'] && $GLOBALS['egw']->acl->check('site_config_access',2,'admin'))
{
$GLOBALS['egw']->redirect($referer);
egw::redirect_link($referer);
}
if ($_POST['submit'])
@ -128,7 +118,7 @@
if(!$errors)
{
$GLOBALS['egw']->redirect($referer);
egw::redirect_link($referer);
}
}
@ -247,24 +237,4 @@
$t->set_var('lang_cancel', lang('Cancel'));
$t->pfp('out','footer');
}
/**
* applies stripslashes recursivly on each element of an array
*
* @param array &$var
* @return array
*/
function array_stripslashes($var)
{
if (!is_array($var))
{
return stripslashes($var);
}
foreach($var as $key => $val)
{
$var[$key] = is_array($val) ? $this->array_stripslashes($val) : stripslashes($val);
}
return $var;
}
}
?>