From 68a835396ec64cb3891188c242a894cf5cb6aed7 Mon Sep 17 00:00:00 2001
From: dutoit
Date: Sat, 30 Aug 2003 09:27:49 +0000
Subject: [PATCH] *** empty log message ***
---
htdocs/conf/conf.class.php | 6 +++++
htdocs/main.inc.php3 | 48 ++++++++++++++++++++++++++++----------
htdocs/user/logout.php | 9 +++++++
3 files changed, 51 insertions(+), 12 deletions(-)
create mode 100644 htdocs/user/logout.php
diff --git a/htdocs/conf/conf.class.php b/htdocs/conf/conf.class.php
index 4fce9098715..49530144156 100644
--- a/htdocs/conf/conf.class.php
+++ b/htdocs/conf/conf.class.php
@@ -90,7 +90,13 @@ class DbConf {
$this->pass = getenv("LLX_DBPASS");
$this->name = getenv("LLX_DBNAME");
*/
+ }
+ /** return the dsn according to the pear syntax
+ */
+ function getdsn ()
+ {
+ return ($this->type.'://'.$this->user.':'.$this->pass.'@'.$this->host.'/'.$this->name);
}
}
diff --git a/htdocs/main.inc.php3 b/htdocs/main.inc.php3
index f2baed8a075..dc934791e81 100644
--- a/htdocs/main.inc.php3
+++ b/htdocs/main.inc.php3
@@ -19,7 +19,7 @@
* $Source$
*
*/
-define('DOL_VERSION','0.5.2');
+define('DOL_VERSION','0.5.1');
if (! include ("conf/conf.php"))
{
@@ -72,16 +72,40 @@ define('FPDF_FONTPATH',DOL_DOCUMENT_ROOT .'/includes/fpdf/font/');
$db = new DoliDb();
-// PEAR
-@include "DB.php";
-@include "PEAR/Info.php";
-//$dbpear = new DB();
-//
-//
$user = new User($db);
-$user->fetch($GLOBALS["REMOTE_USER"]);
-
+//XAVIER DUTOIT 18/09/2003 : si l'utilisateur n'est pas authentifié apache, on essaie pear Auth
+function loginFunction()
+{
+ /**
+ * Change the HTML output so that it fits to your
+ * application. */
+ echo "";
+}
+if (!empty ($GLOBALS["REMOTE_USER"]))
+ $user->fetch($GLOBALS["REMOTE_USER"]);
+else
+{
+ require_once "Auth/Auth.php";
+ $params = array(
+ "dsn" => $conf->db->getdsn (),
+ "table" => "llx_user",
+ "usernamecol" => "login",
+ "passwordcol" => "pass",
+ "cryptType" => "none",
+ );
+ $a = new Auth("DB", $params, "loginFunction");
+ $a->start();
+ if ($a->getAuth()) {
+ $user->fetch($a->getUsername());
+ }
+ else
+ die ("Veuillez vous authentifier");
+}
/*
* Definition de toutes les Constantes globales d'envirronement
*
@@ -330,7 +354,7 @@ function top_menu($head)
print '';
- print '';
+ print '';
print '';
// print '';
@@ -438,8 +462,8 @@ function llxFooter($foot='')
print '';
print 'Bug report ';
- print 'Source Code
';
- // print 'Source Code '.$foot.'
';
+ print 'Source Code '.$foot.'';
+
print "