Passage en Namespace et tous les tests fonctionnels OK

This commit is contained in:
2021-05-10 11:48:15 +02:00
parent 536dd0d56b
commit eb30d8ef97
56 changed files with 1091 additions and 964 deletions
+1 -1
View File
@@ -119,7 +119,7 @@ class Authjwt extends Auth
if ($auth["email"] === "anonymous")
throw new \Exception (dgettext ("domframework",
"AuthJWT : can not create token for anonymous"), 403);
$uuid = uuid::uuid4 ();
$uuid = Uuid::uuid4 ();
$cachefile = new Cachefile ();
$cachefile->directory = $this->cacheDir;
$cachefile->write ($uuid, $auth);
+11 -11
View File
@@ -78,7 +78,7 @@ class Authorizationdb extends Authorization
{
$this->treecheckExecute ($object);
}
catch (Exception $e)
catch (\Exception $e)
{
throw new \Exception ($e->getMessage(), 405);
}
@@ -163,7 +163,7 @@ class Authorizationdb extends Authorization
{
$this->treecheckExecute ($object);
}
catch (Exception $e)
catch (\Exception $e)
{
throw new \Exception ($e->getMessage(), 405);
}
@@ -191,7 +191,7 @@ class Authorizationdb extends Authorization
{
$this->treecheckWrite ($object);
}
catch (Exception $e)
catch (\Exception $e)
{
throw new \Exception ($e->getMessage(), 405);
}
@@ -227,7 +227,7 @@ class Authorizationdb extends Authorization
{
$this->treecheckExecute ($object);
}
catch (Exception $e)
catch (\Exception $e)
{
throw new \Exception ($e->getMessage(), 405);
}
@@ -259,7 +259,7 @@ class Authorizationdb extends Authorization
{
$this->treecheckWrite ($object);
}
catch (Exception $e)
catch (\Exception $e)
{
throw new \Exception ($e->getMessage(), 405);
}
@@ -301,7 +301,7 @@ class Authorizationdb extends Authorization
{
$this->treecheckExecute ($object);
}
catch (Exception $e)
catch (\Exception $e)
{
throw new \Exception ($e->getMessage(), 405);
}
@@ -347,7 +347,7 @@ class Authorizationdb extends Authorization
{
$this->treecheckExecute ($object);
}
catch (Exception $e)
catch (\Exception $e)
{
throw new \Exception ($e->getMessage(), 405);
}
@@ -390,7 +390,7 @@ class Authorizationdb extends Authorization
{
$this->treecheckExecute ($object);
}
catch (Exception $e)
catch (\Exception $e)
{
throw new \Exception ($e->getMessage(), 405);
}
@@ -430,7 +430,7 @@ class Authorizationdb extends Authorization
{
$this->treecheckExecute ($object);
}
catch (Exception $e)
catch (\Exception $e)
{
throw new \Exception ($e->getMessage(), 405);
}
@@ -468,7 +468,7 @@ class Authorizationdb extends Authorization
{
$this->treecheckExecute ($object);
}
catch (Exception $e)
catch (\Exception $e)
{
throw new \Exception ($e->getMessage(), 405);
}
@@ -506,7 +506,7 @@ class Authorizationdb extends Authorization
{
$this->treecheckExecute ($object);
}
catch (Exception $e)
catch (\Exception $e)
{
throw new \Exception ($e->getMessage(), 405);
}
+4 -4
View File
@@ -70,7 +70,7 @@ class Authzgroups
{
$st = $this->dbObject->prepare ($req);
}
catch (Exception $e)
catch (\Exception $e)
{
if ($this->dbObject->debug) echo "DEBUG : PREPARE ERROR ! Return FALSE".
$e->getMessage()."\n";
@@ -86,14 +86,14 @@ class Authzgroups
if ($rc === false)
throw new \Exception ("Can't execute SQL request", 500);
}
catch (Exception $e)
catch (\Exception $e)
{
if ($this->dbObject->debug) echo "DEBUG : EXECUTE ERROR ! Return FALSE".
$e->getMessage()."\n";
throw new \Exception ($e->getMessage(), 500);
}
$res = array ();
while ($d = $st->fetch (PDO::FETCH_ASSOC))
while ($d = $st->fetch (\PDO::FETCH_ASSOC))
$res[$d["object"]] = $d["right"];
// Transform the numerical rights to RO/RW
foreach ($res as $k=>$r)
@@ -382,7 +382,7 @@ class Authzgroups
$class= "db$table";
$this->$class->createTable ();
}
catch (Exception $e)
catch (\Exception $e)
{
echo $e->getMessage()."\n";
}
+3 -3
View File
@@ -253,7 +253,7 @@ class Cli
$constParams .= ">";
}
}
catch (Exception $e)
catch (\Exception $e)
{
// No constructor
}
@@ -346,7 +346,7 @@ class Cli
$paramsConst = $r1->getParameters();
$min = $max = count ($paramsConst);
}
catch (Exception $e)
catch (\Exception $e)
{
// No constructor available in class
}
@@ -437,7 +437,7 @@ class Cli
var_dump ($s);
}
}
catch (Exception $e)
catch (\Exception $e)
{
file_put_contents("php://stderr", $e->getMessage()."\n");
if ($this->EXPERT)
+1 -1
View File
@@ -97,7 +97,7 @@ class Convert
foreach (preg_split ("#([".preg_quote ($delimiters)."]+)#", $str, -1,
PREG_SPLIT_DELIM_CAPTURE) as $tok)
{
$res .= \convert::ucfirst ($tok);
$res .= Convert::ucfirst ($tok);
}
return $res;
}
+2 -2
View File
@@ -389,7 +389,7 @@ class Dblayer
elseif ($data[$key] !== "" && $params[0] === "datetime")
{
// The date format must be in ANSI SQL : YYYY-MM-DD HH:MM:SS
$d = DateTime::createFromFormat("Y-m-d H:i:s", $data[$key]);
$d = \DateTime::createFromFormat("Y-m-d H:i:s", $data[$key]);
if (!$d || $d->format("Y-m-d H:i:s") !== $data[$key])
{
$errors[$key] = array ("error", sprintf (
@@ -402,7 +402,7 @@ class Dblayer
elseif ($data[$key] !== "" && $params[0] === "date")
{
// The date format must be in ANSI SQL : YYYY-MM-DD
$d = DateTime::createFromFormat("Y-m-d", $data[$key]);
$d = \DateTime::createFromFormat("Y-m-d", $data[$key]);
if (!$d || $d->format("Y-m-d") !== $data[$key])
{
$errors[$key] = array ("error", sprintf (
+1 -1
View File
@@ -97,7 +97,7 @@ class Dblayerauthzgroups extends Dblayer
$this->authzgroups->accessRight ($this->module, $this->user,
$this->path."/".$line[$this->primary]);
}
catch (Exception $e)
catch (\Exception $e)
{
unset ($data[$key]);
}
+6 -6
View File
@@ -1647,10 +1647,10 @@ class Dblayeroo
if (! is_object ($object))
$this->DBException ("Invalid setForeignObj parameter: not an object");
if (! is_subclass_of ($object, __CLASS__) &&
get_class ($object) !== "dblayeroo" &&
get_class ($object) !== __NAMESPACE__."\dblayeroo")
get_class ($object) !== "Dblayeroo" &&
get_class ($object) !== __NAMESPACE__."\Dblayeroo")
$this->DBException (
"Invalid object provided to setForeignObj (not dblayeroo object)");
"Invalid object provided to setForeignObj (not Dblayeroo object)");
if (! isset ($object->table))
$this->DBException (
"Invalid object provided to setForeignObj (no table defined)");
@@ -2098,10 +2098,10 @@ class Dblayeroo
if (! is_object ($object))
$this->DBException ("Invalid object provided to join (not object)");
if (! is_subclass_of ($object, __CLASS__) &&
get_class ($object) !== "dblayeroo" &&
get_class ($object) !== __NAMESPACE__."\dblayeroo")
get_class ($object) !== "Dblayeroo" &&
get_class ($object) !== __NAMESPACE__."\Dblayeroo")
$this->DBException (
"Invalid object provided to join (not dblayeroo object)");
"Invalid object provided to join (not Dblayeroo object)");
if ($this->dsn !== $object->dsn)
$this->DBException (
"DSN different : don't support JOIN between databases");
+1 -1
View File
@@ -771,7 +771,7 @@ class Mail
// time. An exception is raised, but it is not important
$this->delHeader ($head, $sectionID);
}
catch (Exception $e)
catch (\Exception $e)
{
}
}
+8 -8
View File
@@ -60,7 +60,7 @@ class Rss
return $this->link;
if (! is_string ($link))
throw new \Exception ("Link provided to RSS is not a string", 500);
$verify = new verify ();
$verify = new Verify ();
if (! $verify->is_URL ($link))
throw new \Exception ("Link provided to RSS is not an URL", 500);
if ($link === "")
@@ -124,14 +124,14 @@ class Rss
if (! is_string ($lastBuildDate))
throw new \Exception ("lastBuildDate provided to RSS is not a string",
500);
$verify = new verify ();
$verify = new Verify ();
if (! $verify->is_datetimeSQL ($lastBuildDate))
throw new \Exception ("lastBuildDate provided to RSS is not a valid date",
500);
if ($lastBuildDate === "")
$lastBuildDate = null;
else
$lastBuildDate = \convert::convertDate ($lastBuildDate, "Y-m-d H:i:s",
$lastBuildDate = Convert::convertDate ($lastBuildDate, "Y-m-d H:i:s",
\DateTime::RFC2822);
$this->lastBuildDate = $lastBuildDate;
return $this;
@@ -194,7 +194,7 @@ class Rss
$tmpItem->pubDate = $item->pubDate ();
}
// Ident correctely the xml created in SimpleXML
$dom = new DOMDocument('1.0');
$dom = new \DOMDocument('1.0');
$dom->preserveWhiteSpace = false;
$dom->formatOutput = true;
$dom->loadXML($xml->asXML());
@@ -258,7 +258,7 @@ class Rssitem
return $this->link;
if (! is_string ($link))
throw new \Exception ("Link provided to RSS Item is not a string", 500);
$verify = new verify ();
$verify = new Verify ();
if (! $verify->is_URL ($link))
throw new \Exception ("Link provided to RSS Item is not an URL", 500);
if ($link === "")
@@ -339,14 +339,14 @@ class Rssitem
if (! is_string ($pubDate))
throw new \Exception ("pubDate provided to RSS Item is not a string",
500);
if (! \verify::staticIs_datetimeSQL ($pubDate))
if (! Verify::staticIs_datetimeSQL ($pubDate))
throw new \Exception ("pubDate provided to RSS Item is not a valid date",
500);
if ($pubDate === "")
$pubDate = null;
else
$pubDate = \convert::convertDate ($pubDate, "Y-m-d H:i:s",
DateTime::RFC2822);
$pubDate = Convert::convertDate ($pubDate, "Y-m-d H:i:s",
\DateTime::RFC2822);
$this->pubDate = $pubDate;
return $this;
}