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

@@ -52,14 +52,14 @@ class Dblayerauthzgroups extends Dblayer
&$foreignSelect)
{
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
throw new \Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
throw new \Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
throw new Exception ("No authzgroups defined for dblayerauthzgroups",
throw new \Exception ("No authzgroups defined for dblayerauthzgroups",
500);
if ($display === null || ! in_array ($this->primary, $display))
{
@@ -80,14 +80,14 @@ class Dblayerauthzgroups extends Dblayer
{
// TODO : If foreign keys, do we check if the access is allowed too ?
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
throw new \Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
throw new \Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
throw new Exception ("No authzgroups defined for dblayerauthzgroups",
throw new \Exception ("No authzgroups defined for dblayerauthzgroups",
500);
$this->allowPath ();
foreach ($data as $key=>$line)
@@ -116,17 +116,17 @@ class Dblayerauthzgroups extends Dblayer
public function hookpreinsert ($data)
{
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
throw new \Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
throw new \Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
throw new Exception ("No authzgroups defined for dblayerauthzgroups",
throw new \Exception ("No authzgroups defined for dblayerauthzgroups",
500);
if ($this->createGroup === null)
throw new Exception ("No createGroup defined for dblayerauthzgroups",
throw new \Exception ("No createGroup defined for dblayerauthzgroups",
500);
$this->allowPath ();
$this->authzgroups->accessWrite ($this->module, $this->user, $this->path);
@@ -142,17 +142,17 @@ class Dblayerauthzgroups extends Dblayer
public function hookpostinsert ($data, $lastID)
{
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
throw new \Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
throw new \Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
throw new Exception ("No authzgroups defined for dblayerauthzgroups",
throw new \Exception ("No authzgroups defined for dblayerauthzgroups",
500);
if ($this->createGroup === null)
throw new Exception ("No createGroup defined for dblayerauthzgroups",
throw new \Exception ("No createGroup defined for dblayerauthzgroups",
500);
$this->authzgroups->objectAdd ($this->module, $this->path."/$lastID");
if (is_array ($this->createGroup))
@@ -171,7 +171,7 @@ class Dblayerauthzgroups extends Dblayer
}
else
{
throw new Exception ("createGroup defined for dblayerauthzgroups is not ".
throw new \Exception ("createGroup defined for dblayerauthzgroups is not ".
"an array or a string", 500);
}
return $lastID;
@@ -187,14 +187,14 @@ class Dblayerauthzgroups extends Dblayer
public function hookpreupdate ($updatekey, $data)
{
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
throw new \Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
throw new \Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
throw new Exception ("No authzgroups defined for dblayerauthzgroups",
throw new \Exception ("No authzgroups defined for dblayerauthzgroups",
500);
$this->allowPath ();
$this->authzgroups->accessWrite ($this->module, $this->user, $this->path);
@@ -211,14 +211,14 @@ class Dblayerauthzgroups extends Dblayer
public function hookpredelete ($deletekey)
{
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
throw new \Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
throw new \Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
throw new Exception ("No authzgroups defined for dblayerauthzgroups",
throw new \Exception ("No authzgroups defined for dblayerauthzgroups",
500);
$this->allowPath ();
$this->authzgroups->accessWrite ($this->module, $this->user, $this->path);
@@ -236,14 +236,14 @@ class Dblayerauthzgroups extends Dblayer
public function hookpostdelete ($deletekey, $nbLinesDeleted)
{
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
throw new \Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
throw new \Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
throw new Exception ("No authzgroups defined for dblayerauthzgroups",
throw new \Exception ("No authzgroups defined for dblayerauthzgroups",
500);
$this->authzgroups->objectDel ($this->module, $this->path."/$deletekey");
return $nbLinesDeleted;
@@ -254,14 +254,14 @@ class Dblayerauthzgroups extends Dblayer
private function allowPath ()
{
if ($this->module === null)
throw new Exception ("No module defined for dblayerauthzgroups", 500);
throw new \Exception ("No module defined for dblayerauthzgroups", 500);
if ($this->auth !== null && array_key_exists ("email", $this->auth) &&
$this->user === null)
$this->user = $this->auth["email"];
if ($this->user === null)
throw new Exception ("No user defined for dblayerauthzgroups", 500);
throw new \Exception ("No user defined for dblayerauthzgroups", 500);
if ($this->authzgroups === null)
throw new Exception ("No authzgroups defined for dblayerauthzgroups",
throw new \Exception ("No authzgroups defined for dblayerauthzgroups",
500);
if (substr ($this->path, -1) === "/")
$this->path = substr ($this->path, 0, -1);