From 61cf7ed149664b7fbab691ecb23777ebdeb8047e Mon Sep 17 00:00:00 2001 From: hickert Date: Fri, 15 Feb 2008 10:12:14 +0000 Subject: [PATCH] Updated .php files. -Use error message type. git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@8926 594d385d-05f5-0310-b6e9-bd551577e9d8 --- gosa-core/html/getbin.php | 1 + gosa-core/html/getfax.php | 1 + gosa-core/html/getldif.php | 1 + gosa-core/html/getvcard.php | 5 +++-- gosa-core/html/getxls.php | 3 ++- gosa-core/html/index.php | 1 + gosa-core/html/logout.php | 1 + gosa-core/html/main.php | 33 ++++++++++++++++++++++----------- gosa-core/html/password.php | 12 ++++++------ gosa-core/html/setup.php | 1 + 10 files changed, 39 insertions(+), 20 deletions(-) diff --git a/gosa-core/html/getbin.php b/gosa-core/html/getbin.php index d2c2b75ec..db28c1f7e 100644 --- a/gosa-core/html/getbin.php +++ b/gosa-core/html/getbin.php @@ -23,6 +23,7 @@ @require_once ("functions.inc"); error_reporting (0); session::start(); +session::set('errorsAlreadyPosted',array()); /* Logged in? Simple security check */ if (!session::is_set('ui')){ diff --git a/gosa-core/html/getfax.php b/gosa-core/html/getfax.php index ff114f87e..47a7577c2 100644 --- a/gosa-core/html/getfax.php +++ b/gosa-core/html/getfax.php @@ -23,6 +23,7 @@ @require_once ("functions.inc"); error_reporting (0); session::start(); +session::set('errorsAlreadyPosted',array()); /* Logged in? Simple security check */ if (!session::is_set('ui')){ diff --git a/gosa-core/html/getldif.php b/gosa-core/html/getldif.php index a1e5aaad3..5568ce747 100644 --- a/gosa-core/html/getldif.php +++ b/gosa-core/html/getldif.php @@ -62,6 +62,7 @@ function dump_ldap ($mode= 0) @require_once ("functions.inc"); error_reporting (E_ALL | E_STRICT); session::start(); +session::set('errorsAlreadyPosted',array()); /* Logged in? Simple security check */ if (!session::is_set('ui')){ diff --git a/gosa-core/html/getvcard.php b/gosa-core/html/getvcard.php index ebc751143..9c20287b8 100644 --- a/gosa-core/html/getvcard.php +++ b/gosa-core/html/getvcard.php @@ -23,6 +23,7 @@ @require_once ("functions.inc"); error_reporting (0); session::start(); +session::set('errorsAlreadyPosted',array()); /* Logged in? Simple security check */ if (!session::is_set('ui')){ @@ -33,8 +34,8 @@ if (!session::is_set('ui')){ /* Uid parameter set? */ if (!isset($_GET['dn']) || $_GET['dn'] == ""){ - msg_dialog::display(_("Internal error"), _("Missing parameters!"), ERROR_DIALOG); - display_error_page(); + msg_dialog::display(_("Internal error"), _("Missing parameters!"), FATAL_ERROR_DIALOG); + exit; } header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); diff --git a/gosa-core/html/getxls.php b/gosa-core/html/getxls.php index 889bf74fe..fcfff67fb 100644 --- a/gosa-core/html/getxls.php +++ b/gosa-core/html/getxls.php @@ -467,6 +467,7 @@ function dump_ldap ($mode= 0) @require_once ("../include/php_setup.inc"); @require_once ("functions.inc"); session::start(); +session::set('errorsAlreadyPosted',array()); /* Logged in? Simple security check */ if (!session::is_set('ui')){ @@ -487,7 +488,7 @@ if(isset($_GET['n'])){ } $acl = $ui->get_permissions($dn,"ldapmanager/xlsexport"); if(!preg_match("/r/",$acl)){ - echo "insufficient permissions"; + msg_dialog::display(_("Permission denied!"),_("You are not allowed to perform this action."),FATAL_ERROR_DIALOG); exit(); } diff --git a/gosa-core/html/index.php b/gosa-core/html/index.php index 94a4fb345..e4cf86c7c 100644 --- a/gosa-core/html/index.php +++ b/gosa-core/html/index.php @@ -93,6 +93,7 @@ function displayLogin() /* Set error handler to own one, initialize time calculation and start session. */ session::start(); +session::set('errorsAlreadyPosted',array()); /* Destroy old session if exists. Else you will get your old session back, if you not logged out correctly. */ diff --git a/gosa-core/html/logout.php b/gosa-core/html/logout.php index 3c60db50b..b75970eb6 100644 --- a/gosa-core/html/logout.php +++ b/gosa-core/html/logout.php @@ -26,6 +26,7 @@ header("Content-type: text/html; charset=UTF-8"); /* try to start session, so we can remove userlocks, if the old session is still available */ @session::start(); +session::set('errorsAlreadyPosted',array()); if(session::is_set('ui')){ /* Get config & ui informations */ diff --git a/gosa-core/html/main.php b/gosa-core/html/main.php index 2b7f3a4a7..7e4412085 100644 --- a/gosa-core/html/main.php +++ b/gosa-core/html/main.php @@ -35,6 +35,7 @@ textdomain($domain); /* Remember everything we did after the last click */ session::start(); +session::set('errorsAlreadyPosted',array()); session::set('limit_exceeded',FALSE); if ($_SERVER["REQUEST_METHOD"] == "POST"){ @@ -136,21 +137,25 @@ bindtextdomain($domain, LOCALE_DIR); textdomain($domain); @DEBUG (DEBUG_TRACE, __LINE__, __FUNCTION__, __FILE__, $lang, "Setting language to"); +session::un_set('plist'); + /* Prepare plugin list */ if (!session::is_set('plist')){ /* Initially load all classes */ $class_list= get_declared_classes(); foreach ($class_mapping as $class => $path){ if (!in_array($class, $class_list)){ - if (is_readable("$BASE_DIR/$path")){ - require_once("$BASE_DIR/$path"); - } else { - echo sprintf(_("Fatal error: cannot locate file '%s' - please run '%s' to fix this"), "$BASE_DIR/$path", "update-gosa"); - exit; - } + if (is_readable("$BASE_DIR/$path")){ + require_once("$BASE_DIR/$path"); + } else { + msg_dialog::display(_("Could not location file."), + sprintf(_("Fatal error: cannot locate file '%s' - please run '%s' to fix this"), + "$BASE_DIR/$path", "update-gosa"), FATAL_ERROR_DIALOG); + exit; + } } } - + session::set('plist', new pluglist($config, $ui)); /* Load ocMapping into userinfo */ @@ -159,13 +164,16 @@ if (!session::is_set('plist')){ session::set('ui',$ui); } $plist= session::get('plist'); - /* Check for register globals */ if (isset($global_check) && $config->data['MAIN']['FORCEGLOBALS'] == 'true'){ - echo _("FATAL: Register globals is on. GOsa will refuse to login unless this is fixed by an administrator."); + msg_dialog::display( + _("PHP configuration"), + _("FATAL: Register globals is on. GOsa will refuse to login unless this is fixed by an administrator."), + FATAL_ERROR_DIALOG); + new log("security","login","",array(),"Register globals is on. For security reasons, this should be turned off.") ; session::destroy (); - exit (); + exit; } /* Check Plugin variable */ @@ -352,7 +360,10 @@ if((isset($config->data['MAIN']['ACCOUNT_EXPIRATION'])) && if (is_file("$plugin_dir/main.inc")){ require_once ("$plugin_dir/main.inc"); } else { - echo sprintf(_("FATAL: Can't find any plugin definitions for plugin '%s'!"), $plug); + msg_dialog::display( + _("Plugin"), + sprintf(_("FATAL: Can't find any plugin definitions for plugin '%s'!"), $plug), + FATAL_ERROR_DIALOG); exit(); } diff --git a/gosa-core/html/password.php b/gosa-core/html/password.php index 6e3d205a3..c7896deaa 100644 --- a/gosa-core/html/password.php +++ b/gosa-core/html/password.php @@ -53,8 +53,8 @@ session::set('LastError',""); /* Check if CONFIG_FILE is accessible */ if (!is_readable(CONFIG_DIR."/".CONFIG_FILE)){ - echo sprintf(_("GOsa configuration %s/%s is not readable. Aborted."), CONFIG_DIR,CONFIG_FILE); - exit(); + msg_dialog::display("", sprintf(_("GOsa configuration %s/%s is not readable. Aborted."),CONFIG_DIR,CONFIG_FILE), FATAL_ERROR_DIALOG); + exit; } /* Parse configuration file */ @@ -73,9 +73,9 @@ if (isset ($config->data['MAIN']['COMPILE'])){ /* Check for compile directory */ if (!(is_dir($smarty->compile_dir) && is_writable($smarty->compile_dir))){ - echo sprintf(_("Directory '%s' specified as compile directory is not accessible!"), - $smarty->compile_dir); - exit(); + msg_dialog::display(_("Accessibility"), sprintf(_("Directory '%s' specified as compile directory is not accessible!"), + $smarty->compile_dir), FATAL_ERROR_DIALOG); + exit; } /* Check for old files in compile directory */ @@ -158,7 +158,7 @@ if (isset($_GET['method'])){ $tmp = new passwordMethod($config); $available = $tmp->get_available_methods(); if (!isset($available[$method])){ - echo _("Error: Password method not available!"); + msg_dialog::display(_("Password method"),_("Error: Password method not available!"),FATAL_ERROR_DIALOG); exit; } } diff --git a/gosa-core/html/setup.php b/gosa-core/html/setup.php index 77454483a..d513ec884 100644 --- a/gosa-core/html/setup.php +++ b/gosa-core/html/setup.php @@ -52,6 +52,7 @@ ini_set("session.gc_maxlifetime",24*60*60); /* Start session */ session::start(); session::set('DEBUGLEVEL',1); +session::set('errorsAlreadyPosted',array()); /* Check for js */ if (!isset($_GET['js']) && !session::is_set('js')){ -- 2.30.2