diff --git a/htdocs/lib/security.lib.php b/htdocs/lib/security.lib.php
index 1aa02eafa6e..54254455501 100644
--- a/htdocs/lib/security.lib.php
+++ b/htdocs/lib/security.lib.php
@@ -19,11 +19,191 @@
/**
* \file htdocs/lib/security.lib.php
- * \brief Ensemble de fonctions de securite de dolibarr sous forme de lib
+ * \brief Set of function used for dolibarr security
* \version $Id$
*/
+/**
+ * \brief Show Dolibarr default login page
+ * \param langs Lang object
+ * \param conf Conf object
+ * \param mysoc Company object
+ * \remarks You must change HTML code in this page to change design of logon page.
+ */
+function dol_loginfunction($langs,$conf,$mysoc)
+{
+ $langs->load("main");
+ $langs->load("other");
+
+ $conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
+ // Si feuille de style en php existe
+ if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php";
+
+ header('Cache-Control: Public, must-revalidate');
+
+ if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"];
+ else unset($_SESSION["urlfrom"]);
+
+ // Ce DTD est KO car inhibe document.body.scrollTop
+ //print '';
+ // Ce DTD est OK
+ print ''."\n";
+
+ // En tete html
+ print "\n";
+ print "
';
+ }
+
+ print "\n";
+ print '';
+
+ // Fin entete html
+ print "\n\n";
+}
+
+
/**
* \brief Fonction pour initialiser un salt pour la fonction crypt
* \param $type 2=>renvoi un salt pour cryptage DES
diff --git a/htdocs/main.inc.php b/htdocs/main.inc.php
index 25d6380d621..939722df623 100644
--- a/htdocs/main.inc.php
+++ b/htdocs/main.inc.php
@@ -283,6 +283,7 @@ if (! isset($_SESSION["dol_login"]))
if (! $login)
{
// We show login page
+ include_once(DOL_DOCUMENT_ROOT."/lib/security.lib.php");
dol_loginfunction($langs,$conf,$mysoc);
exit;
}
@@ -565,7 +566,7 @@ if (defined("MAIN_NOT_INSTALLED"))
$langs->load("main");
$langs->load("dict");
-// On charge les fichiers lang principaux
+// Load permissions
$user->getrights();
// Define some constants used for style of arrays
@@ -599,186 +600,6 @@ else
}
-/**
- * \brief Show Dolibarr default login page
- * \param langs Lang object
- * \param conf Conf object
- * \param mysoc Company object
- * \remarks You must change HTML code in this page to change design of logon page.
- */
-function dol_loginfunction($langs,$conf,$mysoc)
-{
- $langs->load("main");
- $langs->load("other");
-
- $conf->css = "theme/".$conf->theme."/".$conf->theme.".css";
- // Si feuille de style en php existe
- if (file_exists(DOL_DOCUMENT_ROOT.'/'.$conf->css.".php")) $conf->css.=".php";
-
- header('Cache-Control: Public, must-revalidate');
-
- if (! empty($_REQUEST["urlfrom"])) $_SESSION["urlfrom"]=$_REQUEST["urlfrom"];
- else unset($_SESSION["urlfrom"]);
-
- // Ce DTD est KO car inhibe document.body.scrollTop
- //print '';
- // Ce DTD est OK
- print ''."\n";
-
- // En tete html
- print "\n";
- print "\n";
- print ''."\n"; // Evite indexation par robots
- print "".$langs->trans("Login")."\n";
-
- print ''."\n";
-
- print ''."\n";
- print ''."\n";
- print ''."\n";
-
- // Body
- print '';
-
- // Start Form
- print '';
-
- // Message
- if ($_SESSION["dol_loginmesg"])
- {
- print '