Add NAMESPACE support (not activated, but just needed to add the namespace on top of file)

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@4630 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2018-10-24 14:36:00 +00:00
parent 3b2f0e6f82
commit 681863f187
13 changed files with 53 additions and 49 deletions

View File

@@ -1,7 +1,8 @@
<?php
/** DomFramework
@package domframework
@author Dominique Fournier <dominique@fournier38.fr> */
* @package domframework
* @author Dominique Fournier <dominique@fournier38.fr>
*/
require_once ("domframework/auth.php");
require_once ("domframework/authparams.php");
@@ -116,8 +117,8 @@ class authentication
// If the user is already connected, redirect to the main page of the site
if (session_id () === "")
session_start ();
$auth = new \auth ();
$pre = new \authparams (array ("session"));
$auth = new auth ();
$pre = new authparams (array ("session"));
if (isset ($_SESSION["domframework"]["authentication"]["message"]))
$message = $_SESSION["domframework"]["authentication"]["message"];
else
@@ -168,7 +169,7 @@ class authentication
$this->route->redirect ("/authentication/$url", "");
}
}
$authparams = new \authparams (array ("post"));
$authparams = new authparams (array ("post"));
$res = $this->verifAuth ($authparams->email, $authparams->password);
if (! is_array ($res))
{
@@ -217,7 +218,7 @@ class authentication
if ($this->debug)
echo "=== entering verifAuthREST (restMethods=".
print_r ($this->restMethods, true).")\n";
$authparams = new \authparams ($this->restMethods);
$authparams = new authparams ($this->restMethods);
$res = array ("email"=>"anonymous", "password"=>"anonymous");
if ($authparams->email !== "anonymous" &&
$authparams->password !== "anonymous")
@@ -245,7 +246,7 @@ class authentication
if ($this->debug)
echo "=== entering verifAuthHTML (htmlMethods=".
print_r ($this->htmlMethods, true).")\n";
$authparams = new \authparams ($this->htmlMethods);
$authparams = new authparams ($this->htmlMethods);
// Don't ask to the provider if anonymous is known
if ($authparams->email === "anonymous" || $authparams->email === null)
{
@@ -328,7 +329,8 @@ class authentication
if (! is_array ($serversParam))
throw new \Exception ("Auth Server $key configuration error : ".
"not an array", 500);
$authmethod = new $classname ();
$class = __NAMESPACE__."\\$classname";
$authmethod = new $class ();
foreach ($serversParam as $param=>$value)
{
if ($this->debug)