X-Git-Url: https://delta.frontaccounting.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=includes%2Fcurrent_user.inc;h=5d4d5f0e3282b3da3e4235949765154cbb5270f9;hb=a001646bef2b971535791d4e67b8565684d6de24;hp=20ce1e0fc9599f8d178f34c07146603497ba18e2;hpb=3f5a61dd5f2abfbaa853c6777c95ea8e780e6472;p=fa-stable.git diff --git a/includes/current_user.inc b/includes/current_user.inc index 20ce1e0f..5d4d5f0e 100644 --- a/includes/current_user.inc +++ b/includes/current_user.inc @@ -59,7 +59,7 @@ class current_user function login($company, $loginname, $password) { - global $security_areas, $security_groups, $security_headings, $path_to_root, $dflt_lang, $SysPrefs; + global $security_areas, $security_groups, $security_headings, $path_to_root, $dflt_lang, $SysPrefs, $src_version, $db_version, $installed_extensions; $this->set_company($company); $this->logged = false; @@ -132,7 +132,7 @@ class current_user $this->prefs = new user_prefs($myrow); $this->user = @$myrow["id"]; $this->email = @$myrow["email"]; - update_user_visitdate($this->username); + update_user_visitdate($this->username, $src_version, $db_version, $installed_extensions); $this->logged = true; $this->last_act = time(); $this->timeout = session_timeout(); @@ -158,8 +158,14 @@ class current_user $hash = md5($password); update_user_password($user['id'], $user['user_id'], $hash); + + $sender = get_company_pref('email'); + if (empty($sender)) + $header = ""; + else + $header = "From: $sender"; - mail($email, _("New password for")." ".$SysPrefs->app_title, $password); + mail($email, _("New password for")." ".$SysPrefs->app_title, $password, $header); return true; } @@ -315,7 +321,7 @@ function number_format2($number, $decimals=0) $dec = $decimals; } - $num = number_format($number, $dec, $dsep, $tsep); + $num = number_format($number, intval($dec), $dsep, $tsep); return $decimals==='max' ? rtrim($num, '0') : $num; @@ -353,7 +359,7 @@ function price_decimal_format($number, &$dec) if ($pos !== false) { $len = strlen(substr($str, $pos + 1)); - if ($len > $dec) + if ($len > $dec && $len < ini_get('precision')-3) $dec = $len; } return number_format2($number, $dec); @@ -732,6 +738,8 @@ function recalculate_cols(&$cols) function flush_dir($path, $wipe = false) { + if (!file_exists($path)) + return; $dir = @opendir($path); if(!$dir) return;