From c2ce93defe3563312ec4931000ad1fa1c72663a9 Mon Sep 17 00:00:00 2001
From: Ralf Becker '.lang('Substitutions and their meanings:').'';
- foreach($vars as $var => $var_help)
+ $help = $help ? lang($help) : '';
+ if ($subst_help)
{
- $lname = ($lname = lang($var)) == $var.'*' ? $var : $lname;
- $help .= " '.lang('Substitutions and their meanings:').'';
+ foreach($vars as $var => $var_help)
+ {
+ $lname = ($lname = lang($var)) == $var.'*' ? $var : $lname;
+ $help .= "
' : '';
- $help .= '
\n".'$$'.$lname.'$$: '.$var_help;
+ $help .= '
\n".'$$'.$lname.'$$: '.$var_help;
+ }
+ $help .= "
"; print_r($repository[$_appname]); echo "\n"; + // the following hook can be used to verify the prefs + // if you return something else than False, it is treated as an error-msg and + // displayed to the user (the prefs get not saved !!!) + // + if ($error = $GLOBALS['phpgw']->hooks->single(array( + 'location' => 'verify_settings', + 'prefs' => $repository[$_appname], + 'prefix' => $prefix, + 'type' => $GLOBALS['type'] + ),$_GET['appname'])) + { + return $error; + } + $GLOBALS['phpgw']->preferences->save_repository(True,$GLOBALS['type']); + + return False; } /* Only check this once */ @@ -397,20 +415,20 @@ /* Don't use a switch here, we need to check some permissions durring the ifs */ if ($GLOBALS['type'] == 'user' || !($GLOBALS['type'])) { - process_array($GLOBALS['phpgw']->preferences->user,$user,$session_data['notifys'],$prefix); + $error = process_array($GLOBALS['phpgw']->preferences->user,$user,$session_data['notifys'],$prefix); } if ($GLOBALS['type'] == 'default' && is_admin()) { - process_array($GLOBALS['phpgw']->preferences->default, $default,$session_data['notifys']); + $error = process_array($GLOBALS['phpgw']->preferences->default, $default,$session_data['notifys']); } if ($GLOBALS['type'] == 'forced' && is_admin()) { - process_array($GLOBALS['phpgw']->preferences->forced, $forced,$session_data['notifys']); + $error = process_array($GLOBALS['phpgw']->preferences->forced, $forced,$session_data['notifys']); } - if (!is_admin()) + if (!is_admin() || $error) { $GLOBALS['phpgw']->redirect_link('/preferences/index.php'); } @@ -427,7 +445,7 @@ 'appname' => $_GET['appname'] // we use this to reset prefix on appname-change )); // changes for the admin itself, should have immediate feedback ==> redirect - if ($_POST['submit'] && $GLOBALS['type'] == 'user' && $_GET['appname'] == 'preferences') { + if (!$error && $_POST['submit'] && $GLOBALS['type'] == 'user' && $_GET['appname'] == 'preferences') { $GLOBALS['phpgw']->redirect_link('/preferences/preferences.php','appname='.$_GET['appname']); } @@ -435,6 +453,7 @@ lang('Preferences') : lang('%1 - Preferences',$GLOBALS['phpgw_info']['apps'][$_GET['appname']]['title']); $GLOBALS['phpgw']->common->phpgw_header(); + $t->set_var('messages',$error); $t->set_var('action_url',$GLOBALS['phpgw']->link('/preferences/preferences.php','appname=' . $_GET['appname'])); switch ($GLOBALS['type']) // set up some globals to be used by the hooks