diff options
-rw-r--r-- | etc/inc/auth.inc | 18 | ||||
-rw-r--r-- | etc/inc/authgui.inc | 9 | ||||
-rw-r--r-- | usr/local/www/headjs.php | 13 |
3 files changed, 36 insertions, 4 deletions
diff --git a/etc/inc/auth.inc b/etc/inc/auth.inc index 08afe7d..26486e1 100644 --- a/etc/inc/auth.inc +++ b/etc/inc/auth.inc @@ -36,6 +36,24 @@ require_once("functions.inc"); $groupindex = index_groups(); $userindex = index_users(); +function logout_session() { + global $_SESSION; + + if (hasLockAbility($_SESSION['Username'])) { + unlink_if_exists("{$g['tmp_path']}/webconfigurator.lock"); + } + + /* wipe out $_SESSION */ + $_SESSION = array(); + + /* and destroy it */ + session_destroy(); + + $scriptName = split("/", $_SERVER["SCRIPT_FILENAME"]); + $scriptElms = count($scriptName); + $scriptName = $scriptName[$scriptElms-1]; +} + function &getSystemAdminNames() { global $config, $g, $userindex; $adminUsers = array(); diff --git a/etc/inc/authgui.inc b/etc/inc/authgui.inc index 956e936..36a7870 100644 --- a/etc/inc/authgui.inc +++ b/etc/inc/authgui.inc @@ -146,6 +146,13 @@ function display_error_form($http_code, $desc) { global $config, $g; $g['theme'] = $config['theme']; + logout_session(); + + if(isAjax()) { + echo "Error: {$http_code} Description: {$desc}"; + return; + } + $htmlstr = <<<EOD <html> <head> @@ -312,4 +319,4 @@ function display_login_form() { <?php } // end function -?> +?>
\ No newline at end of file diff --git a/usr/local/www/headjs.php b/usr/local/www/headjs.php index e2b4e20..09b1b44 100644 --- a/usr/local/www/headjs.php +++ b/usr/local/www/headjs.php @@ -82,7 +82,7 @@ function getHeadJS() { var responseText = resp.responseText; // debugging helper - //alert(responseText); + alert(responseText); if(responseText.indexOf('html') > 0) { /* somehow we have been fed an html page! */ @@ -95,7 +95,14 @@ function getHeadJS() { /* this function will be called if an HTTP error will be triggered */ function formFailure(resp) { - alert('An error occured while saving the data ' + resp.responseText); + showajaxmessage(resp.responseText); + if($('submit')) + $('submit').style.visibility = 'visible'; + if($('cancelbutton')) + $('cancelbutton').style.visibility = 'visible'; + if($('loading')) + $('loading').style.visibility = 'hidden'; + } function showajaxmessage(message) { @@ -153,4 +160,4 @@ function getHeadJS() { return $headjs; } -?> +?>
\ No newline at end of file |