Change all the "new class" by "new Class"

This commit is contained in:
2021-05-07 13:10:37 +02:00
parent c8d275be31
commit c09fa961cd
39 changed files with 430 additions and 432 deletions

View File

@@ -105,7 +105,7 @@ class Authentication
if (session_id () === "")
session_start ();
if ($this->debug) echo "<pre>LOGOUT\n";
$authsession = new authsession ();
$authsession = new Authsession ();
$param = $authsession->getdetails ();
if ($this->debug) echo "Logout for '".$param["email"]."'\n";
call_user_func ($this->loggingFunc,
@@ -127,7 +127,7 @@ class Authentication
$algorithm = "HS256";
$cipherKey = null;
$cacheDir = "data/jwtCache";
$authjwt = new authjwt ();
$authjwt = new Authjwt ();
$authjwt->serverKey = $this->authServers["authjwt"]["serverKey"];
if (isset ($this->authServers["authjwt"]["cipherKey"]))
$authjwt->cipherKey = $this->authServers["authjwt"]["cipherKey"];
@@ -160,8 +160,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 ();
$authparams = new authparams (array ("session"));
$auth = new Auth ();
$authparams = new Authparams (array ("session"));
if (isset ($_SESSION["domframework"]["authentication"]["message"]))
$message = $_SESSION["domframework"]["authentication"]["message"];
else
@@ -189,7 +189,7 @@ class Authentication
session_start ();
if ($this->debug) echo "Call verifAuthLoginPage ($url) : Start\n";
// rate-limit the connections
$ratelimiter = new ratelimitfile ();
$ratelimiter = new Ratelimitfile ();
// 3 connections by minutes
$ratelimiter->maxEntries = $this->ratelimitAuth;
$ratelimiter->storageDir = $this->ratelimitDir;
@@ -214,7 +214,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))
{
@@ -224,7 +224,7 @@ class Authentication
call_user_func ($this->loggingFunc,
LOG_WARNING,
"Logging error for '$authparams->email' (HTML) : $res");
$authsession = new authsession ();
$authsession = new Authsession ();
$authsession->logout ();
$baseURL = $this->route->baseURL ();
$_SESSION["domframework"]["authentication"]["message"] = $res;
@@ -247,7 +247,7 @@ class Authentication
$res["lastname"] = null;
if (! array_key_exists ("firstname", $res))
$res["firstname"] = null;
$session = new authsession ();
$session = new Authsession ();
$session->savedata ($authparams->email, $authparams->password,
$res["lastname"], $res["firstname"]);
if (isset ($this->authServers["authjwt"]["serverKey"]))
@@ -278,7 +278,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")
@@ -328,7 +328,7 @@ class Authentication
if (! key_exists ("email", $payloadArray) ||
$payloadArray["email"] === "anonymous")
throw new \Exception ("JWT Must authenticate", 401);
$authjwt = new authjwt ();
$authjwt = new Authjwt ();
$authjwt->serverKey = $this->authServers["authjwt"]["serverKey"];
$authjwt->cipherKey = $cipherKey;
$authjwt->algorithm = $algorithm;
@@ -349,7 +349,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)
{
@@ -435,7 +435,7 @@ class Authentication
if (! is_array ($serversParam))
throw new \Exception ("Auth Server $key configuration error : ".
"not an array", 500);
$class = __NAMESPACE__."\\$classname";
$class = __NAMESPACE__."\\".ucfirst ($classname);
$authmethod = new $class ();
foreach ($serversParam as $param=>$value)
{