X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;f=includes%2Fsession.inc;h=a08344aea10fad53ead55414cd55cf64cf7359e5;hb=a8fff3858fd1c49a5f26a67b5f578bc86a45d235;hp=0354221d9baa2af4d303ef7b22ad7253a4305675;hpb=cf015790b7363cfcf29b98c82d20787c8d703fc1;p=fa-stable.git diff --git a/includes/session.inc b/includes/session.inc index 0354221d..a08344ae 100644 --- a/includes/session.inc +++ b/includes/session.inc @@ -11,7 +11,14 @@ function output_html($text) { - global $before_box, $Ajax; + global $before_box, $Ajax, $messages; + // Fatal errors are not send to error_handler, + // so we must check the output + if ($text && preg_match('/\bFatal error(<.*?>)?:(.*)/i', $text, $m)) { + $Ajax->aCommands = array(); // Don't update page via ajax on errors + $text = preg_replace('/\bFatal error(<.*?>)?:(.*)/i','', $text); + $messages[] = array(E_ERROR, $m[2], null, null); + } $Ajax->run(); return in_ajax() ? fmt_errors() : ($before_box.fmt_errors().$text); } @@ -101,6 +108,23 @@ } } + //----------------------------------------------------------------------------- + // Removing magic quotes from nested arrays/variables + // + function strip_quotes($data) + { + if(get_magic_quotes_gpc()) { + if(is_array($data)) { + foreach($data as $k => $v) { + $data[$k] = strip_quotes($data[$k]); + } + } else + return stripslashes($data); + } + return $data; + } + + //---------------------------------------------------------------------------------------- if (!isset($_SESSION["wa_current_user"]) || (isset($_SESSION["wa_current_user"]) && !$_SESSION["wa_current_user"]->logged_in())) @@ -112,7 +136,7 @@ if (!isset($_POST["user_name_entry_field"]) or $_POST["user_name_entry_field"] == "") { include($path_to_root . "/access/login.php"); - $Ajax->redirect($path_to_root . "/access/login.php"); + $Ajax->redirect($path_to_root . "/access/login.php"); exit; } } @@ -128,7 +152,8 @@ $succeed = $_SESSION["wa_current_user"]->login($_POST["company_login_name"], $_POST["user_name_entry_field"], md5($_POST["password"])); - + // select full vs fallback ui mode on login + $_SESSION["wa_current_user"]->ui_mode = $_POST['ui_mode']; if (!$succeed) { // Incorrect password @@ -147,6 +172,8 @@ check_page_security($page_security); - +// POST vars cleanup needed for direct reuse. +// We quote all values later with db_escape() before db update. + $_POST = strip_quotes($_POST); ?> \ No newline at end of file