PHP 7.X produces A non-numeric value encountered in \includes\date_functions.inc...
[fa-stable.git] / access / password_reset.php
index b1fba1b061696d04a6970ae97db24cf44fc45ffd..e9af83f7f8f8239b817ec684df1e1ba0d8abcfd4 100644 (file)
@@ -17,7 +17,7 @@
        $js = "<script language='JavaScript' type='text/javascript'>
 function defaultCompany()
 {
-       document.forms[0].company_login_name.options[".$_SESSION["wa_current_user"]->company."].selected = true;
+       document.forms[0].company_login_name.options[".user_company()."].selected = true;
 }
 </script>";
        add_js_file('login.js');
@@ -28,7 +28,7 @@ function defaultCompany()
 
        $login_timeout = $_SESSION["wa_current_user"]->last_act;
 
-       $title = $app_title." ".$version." - "._("Password reset");
+       $title = $SysPrefs->app_title." ".$version." - "._("Password reset");
        $encoding = isset($_SESSION['language']->encoding) ? $_SESSION['language']->encoding : "iso-8859-1";
        $rtl = isset($_SESSION['language']->dir) ? $_SESSION['language']->dir : "ltr";
        $onload = !$login_timeout ? "onload='defaultCompany()'" : "";
@@ -36,7 +36,7 @@ function defaultCompany()
        echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n";
        echo "<html dir='$rtl' >\n";
        echo "<head profile=\"http://www.w3.org/2005/10/profile\"><title>$title</title>\n";
-       echo "<meta http-equiv='Content-type' content='text/html; charset=$encoding' />\n";
+       echo "<meta http-equiv='Content-type' content='text/html; charset=$encoding' >\n";
        echo "<link href='$path_to_root/themes/$def_theme/default.css' rel='stylesheet' type='text/css'> \n";
        echo "<link href='$path_to_root/themes/default/images/favicon.ico' rel='icon' type='image/x-icon'> \n";
        send_scripts();
@@ -53,35 +53,33 @@ function defaultCompany()
        start_table(false, "class='login'");
        start_row();
        echo "<td align='center' colspan=2>";
-  echo "<a target='_blank' href='$power_url'><img src='$path_to_root/themes/$def_theme/images/logo_frontaccounting.png' alt='FrontAccounting' height='50' onload='fixPNG(this)' border='0' /></a>";
+       echo "<a target='_blank' href='".$SysPrefs->power_url."'><img src='$path_to_root/themes/$def_theme/images/logo_frontaccounting.png' alt='FrontAccounting' height='50' onload='fixPNG(this)' border='0' ></a>";
        echo "</td>\n";
        end_row();
 
-       echo "<input type='hidden' id=ui_mode name='ui_mode' value='".$_SESSION["wa_current_user"]->ui_mode."' />\n";
-       table_section_title(_("Version")." $version   Build $build_version - "._("Password reset"));
+       echo "<input type='hidden' id=ui_mode name='ui_mode' value='".fallback_mode()."' >\n";
+       table_section_title(_("Version")." $version   Build ".$SysPrefs->build_version." - "._("Password reset"));
 
        text_row(_("Email"), "email_entry_field", "", 20, 30);
 
-  if (isset($_SESSION['wa_current_user']->company))
-    $coy =  $_SESSION['wa_current_user']->company;
-  else
-    $coy = $def_coy;
-  if (!@$text_company_selection) {
-    echo "<tr><td>"._("Company")."</td><td><select name='company_login_name'>\n";
-    for ($i = 0; $i < count($db_connections); $i++)
-      echo "<option value=$i ".($i==$coy ? 'selected':'') .">" . $db_connections[$i]["name"] . "</option>";
-    echo "</select>\n";
-    echo "</td></tr>";
-  } else {
-//                     $coy = $def_coy;
-    text_row(_("Company"), "company_login_nickname", "", 20, 50);
-  }
-  start_row();
-  label_cell("Please enter your e-mail", "colspan=2 align='center' id='log_msg'");
-  end_row();
+    $coy =  user_company();
+    if (!isset($coy))
+        $coy = $def_coy;
+    if (!@$SysPrefs->text_company_selection) {
+        echo "<tr><td>"._("Company")."</td><td><select name='company_login_name'>\n";
+        for ($i = 0; $i < count($db_connections); $i++)
+            echo "<option value=$i ".($i==$coy ? 'selected':'') .">" . $db_connections[$i]["name"] . "</option>";
+        echo "</select>\n";
+        echo "</td></tr>";
+    } else {
+        text_row(_("Company"), "company_login_nickname", "", 20, 50);
+    }
+    start_row();
+    label_cell("Please enter your e-mail", "colspan=2 align='center' id='log_msg'");
+    end_row();
        end_table(1);
        echo "<center><input type='submit' value='&nbsp;&nbsp;"._("Send password -->")."&nbsp;&nbsp;' name='SubmitReset'
-                onclick='set_fullmode();' /></center>\n";
+                onclick='set_fullmode();'></center>\n";
 
        end_form(1);
        $Ajax->addScript(true, "document.forms[0].password.focus();");
@@ -105,10 +103,10 @@ function defaultCompany()
        echo "</tr></table>\n";
        echo "<table class='footer'>\n";
        echo "<tr>\n";
-       echo "<td><a target='_blank' href='$power_url' tabindex='-1'>$app_title $version - " . _("Theme:") . " " . $def_theme . "</a></td>\n";
+       echo "<td><a target='_blank' href='".$SysPrefs->power_url."' tabindex='-1'>".$SysPrefs->app_title." $version - " . _("Theme:") . " " . $def_theme . "</a></td>\n";
        echo "</tr>\n";
        echo "<tr>\n";
-       echo "<td><a target='_blank' href='$power_url' tabindex='-1'>$power_by</a></td>\n";
+       echo "<td><a target='_blank' href='".$SysPrefs->power_url."' tabindex='-1'>".$SysPrefs->power_by."</a></td>\n";
        echo "</tr>\n";
        echo "</table><br><br>\n";
        echo "</body></html>\n";