diff --git a/src/Auth.php b/src/Auth.php index d8afc84..a8fd138 100644 --- a/src/Auth.php +++ b/src/Auth.php @@ -160,7 +160,7 @@ class Auth */ public function authentication ($email, $password) { - throw new exception (dgettext ("domframework", + throw new \Exception (dgettext ("domframework", "No authentication available"), 405); } @@ -168,7 +168,7 @@ class Auth */ public function getdetails () { - throw new exception (dgettext ("domframework", + throw new \Exception (dgettext ("domframework", "No getdetails available"), 405); } @@ -179,7 +179,7 @@ class Auth */ public function changepassword ($oldpassword, $newpassword) { - throw new exception (dgettext ("domframework", + throw new \Exception (dgettext ("domframework", "No password change available"), 405); } @@ -191,7 +191,7 @@ class Auth */ public function overwritepassword ($email, $newpassword) { - throw new exception (dgettext ("domframework", + throw new \Exception (dgettext ("domframework", "No password overwrite available"), 405); } @@ -200,7 +200,7 @@ class Auth */ public function listusers () { - throw new exception (dgettext ("domframework", + throw new \Exception (dgettext ("domframework", "No List User available"), 405); } @@ -208,7 +208,7 @@ class Auth */ public function logout () { - throw new exception (dgettext ("domframework", + throw new \Exception (dgettext ("domframework", "No logout method available"), 405); } } diff --git a/src/Authentication.php b/src/Authentication.php index 17ee793..55a363d 100644 --- a/src/Authentication.php +++ b/src/Authentication.php @@ -105,7 +105,7 @@ class Authentication if (session_id () === "") session_start (); if ($this->debug) echo "
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)
{
diff --git a/src/Authhtpasswd.php b/src/Authhtpasswd.php
index d71342b..c492ae9 100644
--- a/src/Authhtpasswd.php
+++ b/src/Authhtpasswd.php
@@ -23,11 +23,11 @@ class Authhtpasswd extends Auth
public function connect ()
{
if (! file_exists ($this->htpasswdFile))
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"The HTPasswd file '%s' is not found"),
$this->htpasswdFile), 500);
if (! is_readable ($this->htpasswdFile))
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"The HTPasswd file '%s' is not readable"),
$this->htpasswdFile), 500);
}
@@ -55,12 +55,12 @@ class Authhtpasswd extends Auth
throw new \Exception (dgettext ("domframework",
"Invalid format of password"), 500);
if (crypt ($password, $cryptedPassword) !== $cryptedPassword)
- throw new Exception ("Bad password for '$email'", 401);
+ throw new \Exception ("Bad password for '$email'", 401);
$this->details = array ("email"=>$email);
return TRUE;
}
}
- throw new Exception ("Unable to find the user : '$email'", 401);
+ throw new \Exception ("Unable to find the user : '$email'", 401);
}
/** Return all the parameters recorded for the authenticate user */
@@ -75,7 +75,7 @@ class Authhtpasswd extends Auth
@param string $newpassword The new password to be recorded */
public function changepassword ($oldpassword, $newpassword)
{
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"The password can't be change for HTPasswd users"),
405);
}
@@ -87,7 +87,7 @@ class Authhtpasswd extends Auth
@param string $newpassword The new password to be recorded */
public function overwritepassword ($email, $newpassword)
{
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"The password can't be change for HTPasswd users"),
405);
}
diff --git a/src/Authimap.php b/src/Authimap.php
index b49e4ed..d2dec41 100644
--- a/src/Authimap.php
+++ b/src/Authimap.php
@@ -26,7 +26,7 @@ class Authimap extends Auth
function __construct ()
{
if (!function_exists ("imap_open"))
- throw new Exception ("IMAP support unavailable in PHP", 500);
+ throw new \Exception ("IMAP support unavailable in PHP", 500);
}
/** Establish the connection to IMAP server. Don't do anything as the
@@ -41,7 +41,7 @@ class Authimap extends Auth
@param string $password Password to authenticate */
public function authentication ($email, $password)
{
- $imap = new imap ($this->imapServer, $this->imapPort,
+ $imap = new Imap ($this->imapServer, $this->imapPort,
$email, $password,
$this->imapSSL, $this->imapSSLCheckCertificates);
$this->details = array ("email" => $email);
@@ -61,7 +61,7 @@ class Authimap extends Auth
@param string $newpassword The new password to be recorded */
public function changepassword ($oldpassword, $newpassword)
{
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"The password can't be change for IMAP users"), 405);
}
@@ -72,7 +72,7 @@ class Authimap extends Auth
@param string $newpassword The new password to be recorded */
public function overwritepassword ($email, $newpassword)
{
- throw new exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"The password can't be overwrite for IMAP users"),
405);
}
@@ -81,7 +81,7 @@ class Authimap extends Auth
Return firstname, lastname, mail, with mail is an array */
public function listusers ()
{
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Can't get list of users for IMAP server"), 405);
}
}
diff --git a/src/Authjwt.php b/src/Authjwt.php
index 332daa0..563d1d1 100644
--- a/src/Authjwt.php
+++ b/src/Authjwt.php
@@ -70,10 +70,10 @@ class Authjwt extends Auth
throw new \Exception (dgettext ("domframework",
"No Bearer Authentication available"), 401);
$token = substr ($_SERVER["HTTP_AUTHENTICATION"], 7);
- $jwt = new jwt ();
+ $jwt = new Jwt ();
$uuid = $jwt->decode ($token, $this->serverKey, $this->allowedAlg,
$this->cipherKey);
- $cachefile = new cachefile ();
+ $cachefile = new Cachefile ();
$cachefile->directory = $this->cacheDir;
$payload = $cachefile->read ((string)$uuid);
// The JWT was tested in authparams. End of process
@@ -120,10 +120,10 @@ class Authjwt extends Auth
throw new \Exception (dgettext ("domframework",
"AuthJWT : can not create token for anonymous"), 403);
$uuid = uuid::uuid4 ();
- $cachefile = new cachefile ();
+ $cachefile = new Cachefile ();
$cachefile->directory = $this->cacheDir;
$cachefile->write ($uuid, $auth);
- $jwt = new jwt ();
+ $jwt = new Jwt ();
return $jwt->encode ($uuid,
$this->serverKey, $this->algorithm, $this->cipherKey);
}
@@ -168,10 +168,10 @@ class Authjwt extends Auth
throw new \Exception (dgettext ("domframework",
"No Bearer Authentication available"), 401);
$token = substr ($_SERVER["HTTP_AUTHENTICATION"], 7);
- $jwt = new jwt ();
+ $jwt = new Jwt ();
$uuid = $jwt->decode ($token, $this->serverKey, $this->allowedAlg,
$this->cipherKey);
- $cachefile = new cachefile ();
+ $cachefile = new Cachefile ();
$cachefile->directory = $this->cacheDir;
$payload = $cachefile->read ((string)$uuid);
if (empty ($uuid) || empty ($payload) || ! key_exists ("email", $payload))
diff --git a/src/Authldap.php b/src/Authldap.php
index b37ba41..95d5576 100644
--- a/src/Authldap.php
+++ b/src/Authldap.php
@@ -116,7 +116,7 @@ class Authldap extends Auth
@param string $newpassword The new password to be recorded */
public function overwritepassword ($email, $newpassword)
{
- throw new exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"The password can't be overwrite for LDAP users"),
405);
}
diff --git a/src/Authorizationdb.php b/src/Authorizationdb.php
index 9659843..4d1264e 100644
--- a/src/Authorizationdb.php
+++ b/src/Authorizationdb.php
@@ -28,7 +28,7 @@ class Authorizationdb extends Authorization
$driver_options=null)
{
// Define the structure of the table in the database
- $this->db = new dblayer ($dsn, $username, $password, $driver_options);
+ $this->db = new Dblayer ($dsn, $username, $password, $driver_options);
$this->db->table = "domframework_authorization";
$this->db->tableprefix = $this->tableprefix;
$this->db->fields = array (
@@ -44,7 +44,7 @@ class Authorizationdb extends Authorization
public function initialize ()
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Database to authorize is not connected"), 500);
$tables = $this->db->listTables ();
if (!in_array ($this->db->tableprefix.$this->db->table, $tables))
@@ -63,16 +63,16 @@ class Authorizationdb extends Authorization
public function validate ($object)
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Not authenticated"), 401);
try
{
@@ -80,14 +80,14 @@ class Authorizationdb extends Authorization
}
catch (Exception $e)
{
- throw new Exception ($e->getMessage(), 405);
+ throw new \Exception ($e->getMessage(), 405);
}
// All the folder structure is accessible. Check if the object already
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Object %s doesn't exists"),
$object),
404);
@@ -140,24 +140,24 @@ class Authorizationdb extends Authorization
public function add ($object, $ownerid, $groupid, $modbits)
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Database to authorize is not connected"), 500);
// The modbits are stored in octal to be more readable
$modbits = decoct ($modbits);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Not authenticated"), 401);
if ($this->authiduser !== 0 && $this->authiduser !== $ownerid)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Can't create object not owned by myself"), 406);
if ($this->authiduser !== 0 && !in_array ($groupid, $this->authgroups))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Can't create object with not owned group"), 406);
try
{
@@ -165,14 +165,14 @@ class Authorizationdb extends Authorization
}
catch (Exception $e)
{
- throw new Exception ($e->getMessage(), 405);
+ throw new \Exception ($e->getMessage(), 405);
}
// All the folder structure is accessible. Check if the object already
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search))
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Object %s already defined"), $object),
400);
@@ -193,7 +193,7 @@ class Authorizationdb extends Authorization
}
catch (Exception $e)
{
- throw new Exception ($e->getMessage(), 405);
+ throw new \Exception ($e->getMessage(), 405);
}
$this->db->create (array ("object"=>$object,
@@ -209,19 +209,19 @@ class Authorizationdb extends Authorization
public function drop ($object)
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Not authenticated"), 401);
if ($object === "/")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"The root can not be removed"), 406);
try
{
@@ -229,14 +229,14 @@ class Authorizationdb extends Authorization
}
catch (Exception $e)
{
- throw new Exception ($e->getMessage(), 405);
+ throw new \Exception ($e->getMessage(), 405);
}
// All the folder structure is accessible. Check if the object already
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Object %s doesn't exists"),
$object), 400);
@@ -246,10 +246,10 @@ class Authorizationdb extends Authorization
{
$rc = $this->db->delete ($object);
if ($rc > 1)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Removing more than one object"), 406);
if ($rc == 0)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"No object removed"), 406);
$rc = $this->db->delete ("$object$this->separator%");
return TRUE;
@@ -261,15 +261,15 @@ class Authorizationdb extends Authorization
}
catch (Exception $e)
{
- throw new Exception ($e->getMessage(), 405);
+ throw new \Exception ($e->getMessage(), 405);
}
$rc = $this->db->delete ($object);
if ($rc > 1)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Removing more than one object"), 406);
if ($rc == 0)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"No object removed"), 406);
$rc = $this->db->delete ("$object$this->separator%");
return TRUE;
@@ -283,19 +283,19 @@ class Authorizationdb extends Authorization
public function chown ($object, $ownerid)
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Not authenticated"), 401);
if ($this->authiduser !== 0)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"The chown is reserved to root user"), 405);
try
{
@@ -303,14 +303,14 @@ class Authorizationdb extends Authorization
}
catch (Exception $e)
{
- throw new Exception ($e->getMessage(), 405);
+ throw new \Exception ($e->getMessage(), 405);
}
// All the folder structure is accessible. Check if the object already
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Object %s doesn't exists"), $object),
400);
$search = reset ($search);
@@ -326,22 +326,22 @@ class Authorizationdb extends Authorization
public function chgrp ($object, $groupid)
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Not authenticated"), 401);
if ($this->authiduser !== 0 && !in_array ($groupid, $this->authgroups))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"The user must be in the wanted group"), 405);
if (!in_array ("WRITE", $this->validate ($object)))
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"%s is write protected"), $object), 405);
try
{
@@ -349,14 +349,14 @@ class Authorizationdb extends Authorization
}
catch (Exception $e)
{
- throw new Exception ($e->getMessage(), 405);
+ throw new \Exception ($e->getMessage(), 405);
}
// All the folder structure is accessible. Check if the object already
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Object %s doesn't exists"), $object),
400);
$search = reset ($search);
@@ -372,19 +372,19 @@ class Authorizationdb extends Authorization
public function chmod ($object, $mod)
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Not authenticated"), 401);
if (!in_array ("WRITE", $this->validate ($object)))
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"%s is write protected"), $object), 405);
try
{
@@ -392,14 +392,14 @@ class Authorizationdb extends Authorization
}
catch (Exception $e)
{
- throw new Exception ($e->getMessage(), 405);
+ throw new \Exception ($e->getMessage(), 405);
}
// All the folder structure is accessible. Check if the object already
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Object %s doesn't exists"), $object),
400);
$search = reset ($search);
@@ -415,16 +415,16 @@ class Authorizationdb extends Authorization
public function lsmod ($object)
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Not authenticated"), 401);
try
{
@@ -432,14 +432,14 @@ class Authorizationdb extends Authorization
}
catch (Exception $e)
{
- throw new Exception ($e->getMessage(), 405);
+ throw new \Exception ($e->getMessage(), 405);
}
// All the folder structure is accessible. Check if the object already
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Object %s doesn't exists"), $object),
400);
$search = reset ($search);
@@ -453,16 +453,16 @@ class Authorizationdb extends Authorization
public function lsown ($object)
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Not authenticated"), 401);
try
{
@@ -470,14 +470,14 @@ class Authorizationdb extends Authorization
}
catch (Exception $e)
{
- throw new Exception ($e->getMessage(), 405);
+ throw new \Exception ($e->getMessage(), 405);
}
// All the folder structure is accessible. Check if the object already
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Object %s doesn't exists"), $object),
400);
$search = reset ($search);
@@ -491,16 +491,16 @@ class Authorizationdb extends Authorization
public function lsgrp ($object)
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Not authenticated"), 401);
try
{
@@ -508,14 +508,14 @@ class Authorizationdb extends Authorization
}
catch (Exception $e)
{
- throw new Exception ($e->getMessage(), 405);
+ throw new \Exception ($e->getMessage(), 405);
}
// All the folder structure is accessible. Check if the object already
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Object %s doesn't exists"), $object),
404);
$search = reset ($search);
@@ -531,7 +531,7 @@ class Authorizationdb extends Authorization
private function treecheckExecute ($object)
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Database to authorize is not connected"), 500);
// Search all the parents in an array
$parents = array ();
@@ -568,7 +568,7 @@ class Authorizationdb extends Authorization
}
}
if (!$found)
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"The path %s is not found in database"),
$p), 404);
else
@@ -593,7 +593,7 @@ class Authorizationdb extends Authorization
if (($parentModbits & 0001) === 1)
continue;
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"No execute rights on %s"), $p), 405);
}
}
@@ -624,7 +624,7 @@ class Authorizationdb extends Authorization
if (($parentModbits & 0002) === 2)
return TRUE;
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"No write rights on %s"), $parent), 405);
}
}
diff --git a/src/Authshibboleth.php b/src/Authshibboleth.php
index ee65718..56b9925 100644
--- a/src/Authshibboleth.php
+++ b/src/Authshibboleth.php
@@ -40,10 +40,10 @@ class Authshibboleth extends Auth
{
if ($this->urlAuthentificated !== "")
{
- $route = new route ();
+ $route = new Route ();
$route->redirect ($this->urlAuthentificated);
}
- throw new Exception ("Unable to authenticate user '$email'", 401);
+ throw new \Exception ("Unable to authenticate user '$email'", 401);
}
}
@@ -73,10 +73,10 @@ class Authshibboleth extends Auth
{
// Redirect to Shibboleth IDP
if ($this->urlPasswdChange == "")
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"The password can't be change for Shibboleth users"),
405);
- $route = new route ();
+ $route = new Route ();
$route->redirect ($this->urlPasswdChange);
}
@@ -87,7 +87,7 @@ class Authshibboleth extends Auth
@param string $newpassword The new password to be recorded */
public function overwritepassword ($email, $newpassword)
{
- throw new exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"The password can't be overwrite for Shibboleth users"),
405);
}
@@ -99,7 +99,7 @@ class Authshibboleth extends Auth
if ($this->urlLogout === "")
throw new \Exception (dgettext ("domframework",
"Shibboleth is not configured to allow logout"), 405);
- $route = new route ();
+ $route = new Route ();
$route->redirect ($this->urlLogout);
}
}
diff --git a/src/Authsql.php b/src/Authsql.php
index a17e8c1..715a3ae 100644
--- a/src/Authsql.php
+++ b/src/Authsql.php
@@ -44,25 +44,25 @@ class Authsql extends Auth
public function connect ()
{
if (! function_exists ("openssl_random_pseudo_bytes"))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"No PHP support for openssl_random_pseudo_bytes"),
500);
- $this->db = new dblayer ($this->dsn, $this->username, $this->password,
+ $this->db = new Dblayer ($this->dsn, $this->username, $this->password,
$this->driver_options);
if ($this->table === null)
- throw new Exception (dgettext ("domframework", "No SQL table defined"),
+ throw new \Exception (dgettext ("domframework", "No SQL table defined"),
500);
if ($this->fieldIdentifier === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"No fieldIdentifier defined"), 500);
if ($this->fieldPassword === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"No fieldPassword defined"), 500);
if ($this->fieldLastname === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"No fieldLastname defined"), 500);
if ($this->fieldFirstname === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"No fieldFirstname defined"), 500);
$fields = array_merge (array ($this->fieldIdentifier, $this->fieldPassword,
$this->fieldLastname, $this->fieldFirstname),
@@ -81,7 +81,7 @@ class Authsql extends Auth
public function authentication ($email, $password)
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"The SQL database is not connected"), 500);
$data = $this->db->read (array (array ($this->fieldIdentifier, $email)),
array_merge (array ($this->fieldIdentifier,
@@ -90,16 +90,16 @@ class Authsql extends Auth
$this->fieldPassword),
$this->fieldsInfo));
if (count ($data) === 0)
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Unable to find the user : '%s'"),
$email), 401);
if (! isset ($data[0][$this->fieldPassword]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Unable to get the user password from database"),
500);
$cryptedPassword = $data[0][$this->fieldPassword];
if (crypt ($password, $cryptedPassword) !== $cryptedPassword)
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Bad password for '%s'"), $email),
401);
// The password should never be stored by this function
@@ -124,11 +124,11 @@ class Authsql extends Auth
public function changepassword ($oldpassword, $newpassword)
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"The SQL database is not connected"), 500);
if ($this->details === null ||
! isset ($this->details[$this->fieldIdentifier]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Can't change the password if the user is not authenticated"),
500);
$data = $this->db->read (array (array ($this->fieldIdentifier,
@@ -137,7 +137,7 @@ class Authsql extends Auth
$this->fieldPassword));
$cryptedPassword = $data[0][$this->fieldPassword];
if (crypt ($oldpassword, $cryptedPassword) !== $cryptedPassword)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Bad old password provided"), 401);
$cost = 11;
$salt = substr (base64_encode (openssl_random_pseudo_bytes (17)), 0, 22);
@@ -152,7 +152,7 @@ class Authsql extends Auth
$rc = $this->db->update ($this->details[$this->fieldIdentifier],
array ($this->fieldPassword => $cryptpassword));
if ($rc !== 1)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Can't change the password"), 500);
}
@@ -164,13 +164,13 @@ class Authsql extends Auth
public function overwritepassword ($email, $newpassword)
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"The SQL database is not connected"), 500);
$data = $this->db->read (array (array ($this->fieldIdentifier, $email)),
array ($this->fieldIdentifier,
$this->fieldPassword));
if (count ($data) === 0)
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Unable to find the user : '%s'"),
$email), 401);
$cost = 11;
@@ -186,7 +186,7 @@ class Authsql extends Auth
$rc = $this->db->update ($email,
array ($this->fieldPassword => $cryptpassword));
if ($rc !== 1)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Can't change the password"), 500);
}
/** List all the users available in the database
@@ -194,7 +194,7 @@ class Authsql extends Auth
public function listusers ()
{
if ($this->db === null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"The SQL database is not connected"), 500);
$data = $this->db->read (null, array_merge (array ($this->fieldIdentifier,
$this->fieldFirstname,
diff --git a/src/Authsympa.php b/src/Authsympa.php
index 69efcd9..1abd039 100644
--- a/src/Authsympa.php
+++ b/src/Authsympa.php
@@ -17,7 +17,7 @@ namespace Domframework;
It use the SOAP protocol. So the PHP SOAP library is needed and the network
must be open between the Web server and the Sympa server.
POC :
-$auth = new authsympa ();
+$auth = new Authsympa ();
$auth->wsdl = "https://lists.domain.tld/sympa/wsdl";
$auth->list = "listtest@lists.domain.tld";
$auth->connect ();
diff --git a/src/Authzgroups.php b/src/Authzgroups.php
index 96e065b..fc404bb 100644
--- a/src/Authzgroups.php
+++ b/src/Authzgroups.php
@@ -42,7 +42,7 @@ class Authzgroups
if ($this->rightCache !== null)
return $this->rightCache;
if ($this->dbObject == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Object is not connected"), 500);
// Do the SQL request in hard to be more performant on jointures
if ($user === "cli" || $user === "root")
@@ -74,7 +74,7 @@ class Authzgroups
{
if ($this->dbObject->debug) echo "DEBUG : PREPARE ERROR ! Return FALSE".
$e->getMessage()."\n";
- throw new Exception ($e->getMessage(), 500);
+ throw new \Exception ($e->getMessage(), 500);
}
if ($user !== "cli" && $user !== "root")
@@ -84,13 +84,13 @@ class Authzgroups
{
$rc = $st->execute ();
if ($rc === false)
- throw new Exception ("Can't execute SQL request", 500);
+ throw new \Exception ("Can't execute SQL request", 500);
}
catch (Exception $e)
{
if ($this->dbObject->debug) echo "DEBUG : EXECUTE ERROR ! Return FALSE".
$e->getMessage()."\n";
- throw new Exception ($e->getMessage(), 500);
+ throw new \Exception ($e->getMessage(), 500);
}
$res = array ();
while ($d = $st->fetch (PDO::FETCH_ASSOC))
@@ -103,7 +103,7 @@ class Authzgroups
case "2": $res[$k] = "RW"; break;
case "1": $res[$k] = "RO"; break;
default:
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Unknown right stored"), 500);
}
}
@@ -156,16 +156,16 @@ class Authzgroups
public function accessRight ($module, $user, $object)
{
if ($this->dbObject === null)
- throw new Exception ("Can't use authzgroups\\accessRight without ".
+ throw new \Exception ("Can't use authzgroups\\accessRight without ".
"connected database", 500);
if ($module === null || ! is_string ($module) || trim ($module) === "")
- throw new Exception ("Module not provided to authzgroups\\accessRight",
+ throw new \Exception ("Module not provided to authzgroups\\accessRight",
500);
if ($user === null || ! is_string ($user) || trim ($user) === "")
- throw new Exception ("User not provided to authzgroups\\accessright",
+ throw new \Exception ("User not provided to authzgroups\\accessright",
500);
if ($object === null || ! is_string ($object))
- throw new Exception ("Object not provided to authzgroups\\accessRight",
+ throw new \Exception ("Object not provided to authzgroups\\accessRight",
500);
if ($object{0} !== "/")
$object = "/$object";
@@ -176,9 +176,9 @@ class Authzgroups
if ($rc !== "NO")
return TRUE;
if ($user === "anonymous")
- throw new Exception (dgettext ("domframework", "Anonymous not allowed"),
+ throw new \Exception (dgettext ("domframework", "Anonymous not allowed"),
401);
- throw new Exception (dgettext ("domframework", "Access forbidden"), 403);
+ throw new \Exception (dgettext ("domframework", "Access forbidden"), 403);
}
/** Return TRUE if the user right allow to edit the object (RW only)
@@ -191,16 +191,16 @@ class Authzgroups
public function accessWrite ($module, $user, $object)
{
if ($this->dbObject === null)
- throw new Exception ("Can't use authzgroups\\accessWrite without ".
+ throw new \Exception ("Can't use authzgroups\\accessWrite without ".
"connected database", 500);
if ($module === null || ! is_string ($module) || trim ($module) === "")
- throw new Exception ("Module not provided to authzgroups\\accessWrite",
+ throw new \Exception ("Module not provided to authzgroups\\accessWrite",
500);
if ($user === null || ! is_string ($user) || trim ($user) === "")
- throw new Exception ("User not provided to authzgroups\\accessWrite",
+ throw new \Exception ("User not provided to authzgroups\\accessWrite",
500);
if ($object === null || ! is_string ($object))
- throw new Exception ("Object not provided to authzgroups\\accessWrite",
+ throw new \Exception ("Object not provided to authzgroups\\accessWrite",
500);
if ($object{0} !== "/")
$object = "/$object";
@@ -211,9 +211,9 @@ class Authzgroups
if ($rc === "RW")
return TRUE;
if ($user === "anonymous")
- throw new Exception (dgettext ("domframework", "Anonymous not allowed"),
+ throw new \Exception (dgettext ("domframework", "Anonymous not allowed"),
401);
- throw new Exception (dgettext ("domframework", "Modification forbidden"),
+ throw new \Exception (dgettext ("domframework", "Modification forbidden"),
403);
}
@@ -228,16 +228,16 @@ class Authzgroups
public function accessReadOnly ($module, $user, $object)
{
if ($this->dbObject === null)
- throw new Exception ("Can't use authzgroups\\accessReadOnly without ".
+ throw new \Exception ("Can't use authzgroups\\accessReadOnly without ".
"connected database", 500);
if ($module === null || ! is_string ($module) || trim ($module) === "")
- throw new Exception ("Module not provided to authzgroups\\accessReadOnly",
+ throw new \Exception ("Module not provided to authzgroups\\accessReadOnly",
500);
if ($user === null || ! is_string ($user) || trim ($user) === "")
- throw new Exception ("User not provided to authzgroups\\accessReadOnly",
+ throw new \Exception ("User not provided to authzgroups\\accessReadOnly",
500);
if ($object === null || ! is_string ($object))
- throw new Exception ("Object not provided to authzgroups\\accessReadOnly",
+ throw new \Exception ("Object not provided to authzgroups\\accessReadOnly",
500);
if ($object{0} !== "/")
$object = "/$object";
@@ -248,9 +248,9 @@ class Authzgroups
if ($rc === "RO")
return TRUE;
if ($user === "anonymous")
- throw new Exception (dgettext ("domframework", "Anonymous not allowed"),
+ throw new \Exception (dgettext ("domframework", "Anonymous not allowed"),
401);
- throw new Exception (dgettext ("domframework", "Access forbidden"), 403);
+ throw new \Exception (dgettext ("domframework", "Access forbidden"), 403);
}
/////////////////////////
@@ -267,7 +267,7 @@ class Authzgroups
public function connect ($dsn, $username=null, $password=null,
$driver_options=null)
{
- $this->dbObject = new dblayer ($dsn, $username, $password, $driver_options);
+ $this->dbObject = new Dblayer ($dsn, $username, $password, $driver_options);
$this->dbObject->debug = $this->debug;
$this->dbObject->table = "authzobject";
$this->dbObject->prefix = $this->tableprefix;
@@ -284,7 +284,7 @@ class Authzgroups
"object" => dgettext ("domframework", "Object"),
"comment" => dgettext ("domframework", "Comment"));
- $this->dbGroup = new dblayer ($dsn, $username, $password, $driver_options);
+ $this->dbGroup = new Dblayer ($dsn, $username, $password, $driver_options);
$this->dbGroup->debug = $this->debug;
$this->dbGroup->table = "authzgroup";
$this->dbGroup->prefix = $this->tableprefix;
@@ -301,7 +301,7 @@ class Authzgroups
"group" => dgettext ("domframework", "Group"),
"comment" => dgettext ("domframework", "Comment"));
- $this->dbGroupMember = new dblayer ($dsn, $username, $password,
+ $this->dbGroupMember = new Dblayer ($dsn, $username, $password,
$driver_options);
$this->dbGroupMember->debug = $this->debug;
$this->dbGroupMember->table = "authzgroupmember";
@@ -323,7 +323,7 @@ class Authzgroups
"idgroup"=>dgettext ("domframework", "idgroup"),
"comment"=>dgettext ("domframework", "Comment"));
- $this->dbRight = new dblayer ($dsn, $username, $password, $driver_options);
+ $this->dbRight = new Dblayer ($dsn, $username, $password, $driver_options);
$this->dbRight->debug = $this->debug;
$this->dbRight->table = "authzright";
$this->dbRight->prefix = $this->tableprefix;
@@ -362,17 +362,17 @@ class Authzgroups
public function createTables ()
{
if ($this->dbObject == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Object is not connected"), 500);
if ($this->dbGroup == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Group is not connected"), 500);
if ($this->dbGroupMember == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for GroupMember is not connected"),
500);
if ($this->dbRight == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Right is not connected"), 500);
$tables = array ("Object", "Group", "GroupMember", "Right");
foreach ($tables as $table)
@@ -402,7 +402,7 @@ class Authzgroups
public function objectAdd ($module, $object, $comment="")
{
if ($this->dbObject == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Object is not connected"), 500);
// TODO : Check parameters before saving them
$this->rightCache = null;
@@ -418,11 +418,11 @@ class Authzgroups
public function objectDel ($module, $object)
{
if ($this->dbObject == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Object is not connected"), 500);
$idobjects = $this->objectRead ($module, $object);
if (! isset ($idobjects[0]["idobject"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted object not found"), 404);
$this->rightCache = null;
return $this->dbObject->delete ($idobjects[0]["idobject"]);
@@ -435,11 +435,11 @@ class Authzgroups
public function objectDelByID ($module, $idobject)
{
if ($this->dbObject == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Object is not connected"), 500);
$idobjects = $this->objectReadByID ($module, $idobject);
if (! isset ($idobjects[0]["idobject"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted object not found"), 404);
$this->rightCache = null;
return $this->dbObject->delete ($idobjects[0]["idobject"]);
@@ -454,11 +454,11 @@ class Authzgroups
public function objectUpdate ($module, $object, $newobject, $newcomment="")
{
if ($this->dbObject == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Object is not connected"), 500);
$idobjects = $this->objectRead ($module, $object);
if (! isset ($idobjects[0]["idobject"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted object not found"), 404);
$this->rightCache = null;
return $this->dbObject->update ($idobjects[0]["idobject"],
@@ -476,11 +476,11 @@ class Authzgroups
$newcomment="")
{
if ($this->dbObject == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Object is not connected"), 500);
$idobjects = $this->objectReadByID ($module, $idobject);
if (! isset ($idobjects[0]["idobject"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted object not found"), 404);
$this->rightCache = null;
return $this->dbObject->update ($idobjects[0]["idobject"],
@@ -496,7 +496,7 @@ class Authzgroups
public function objectRead ($module, $object=null)
{
if ($this->dbObject == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Object is not connected"), 500);
$select[] = array ("module", $module);
if ($object !== null)
@@ -513,7 +513,7 @@ class Authzgroups
public function objectReadByID ($module, $idobject=null)
{
if ($this->dbObject == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Object is not connected"), 500);
$select[] = array ("module", $module);
if ($idobject !== null)
@@ -551,7 +551,7 @@ class Authzgroups
public function groupAdd ($module, $group, $comment="")
{
if ($this->dbGroup == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Group is not connected"), 500);
// TODO : Check parameters before saving them
return $this->dbGroup->insert (array ("module"=>$module,
@@ -566,11 +566,11 @@ class Authzgroups
public function groupDel ($module, $group)
{
if ($this->dbGroup == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Group is not connected"), 500);
$idgroups = $this->groupRead ($module, $group);
if (! isset ($idgroups[0]["idgroup"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted group not found"), 404);
return $this->dbGroup->delete ($idgroups[0]["idgroup"]);
}
@@ -582,11 +582,11 @@ class Authzgroups
public function groupDelByID ($module, $idgroup)
{
if ($this->dbGroup == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Group is not connected"), 500);
$idgroups = $this->groupReadByID ($module, $idgroup);
if (! isset ($idgroups[0]["idgroup"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted group not found"), 404);
return $this->dbGroup->delete ($idgroups[0]["idgroup"]);
}
@@ -600,11 +600,11 @@ class Authzgroups
public function groupUpdate ($module, $group, $newgroup, $comment="")
{
if ($this->dbGroup == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Group is not connected"), 500);
$idgroups = $this->groupRead ($module, $group);
if (! isset ($idgroups[0]["idgroup"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted group not found"), 404);
return $this->dbGroup->update ($idgroups[0]["idgroup"],
array ("group"=>$newgroup,
@@ -620,11 +620,11 @@ class Authzgroups
public function groupUpdateByID ($module, $idgroup, $newgroup, $comment="")
{
if ($this->dbGroup == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Group is not connected"), 500);
$idgroups = $this->groupReadByID ($module, $idgroup);
if (! isset ($idgroups[0]["idgroup"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted group not found"), 404);
return $this->dbGroup->update ($idgroups[0]["idgroup"],
array ("group"=>$newgroup,
@@ -638,7 +638,7 @@ class Authzgroups
public function groupRead ($module, $group=null)
{
if ($this->dbGroup == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Group is not connected"), 500);
$select[] = array ("module", $module);
if ($group !== null)
@@ -654,7 +654,7 @@ class Authzgroups
public function groupReadByID ($module, $idgroup)
{
if ($this->dbGroup == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Group is not connected"), 500);
$select[] = array ("module", $module);
$select[] = array ("idgroup", $idgroup);
@@ -692,12 +692,12 @@ class Authzgroups
public function groupmemberAdd ($module, $group, $user, $comment="")
{
if ($this->dbGroupMember == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for GroupMember is not connected"),
500);
$groups = $this->groupRead ($module, $group);
if (! isset ($groups[0]["idgroup"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted group not found"), 404);
$this->rightCache = null;
return $this->dbGroupMember->insert (array (
@@ -714,18 +714,18 @@ class Authzgroups
public function groupmemberDel ($module, $group, $user)
{
if ($this->dbGroupMember == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for GroupMember is not connected"),
500);
$groups = $this->groupRead ($module, $group);
if (! isset ($groups[0]["idgroup"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted group not found"), 404);
$groupsMembers = $this->dbGroupMember->read (array (
array ("user", $user),
array ("idgroup", $groups[0]["idgroup"])));
if (! isset ($groupsMembers[0]["idgroupmember"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted GroupMember not found"), 404);
$this->rightCache = null;
return $this->dbGroupMember->delete ($groupsMembers[0]["idgroupmember"]);
@@ -739,17 +739,17 @@ class Authzgroups
public function groupmemberDelByID ($module, $idgroup, $idgroupmember)
{
if ($this->dbGroupMember == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for GroupMember is not connected"), 500);
$groups = $this->groupReadByID ($module, $idgroup);
if (! isset ($groups[0]["idgroup"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted group not found"), 404);
$groupsMembers = $this->dbGroupMember->read (array (
array ("idgroupmember", $idgroupmember),
array ("idgroup", $idgroup)));
if (! isset ($groupsMembers[0]["idgroupmember"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted GroupMember not found"), 404);
$this->rightCache = null;
return $this->dbGroupMember->delete ($groupsMembers[0]["idgroupmember"]);
@@ -779,7 +779,7 @@ class Authzgroups
{
$data = $this->groupmemberReadUserDataByID ($module, $idgroup, $iduser);
if (count ($data) === 0)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"IDUser in IDGroup not found"), 404);
$this->rightCache = null;
return $this->dbGroupMember->update ($iduser,
@@ -795,7 +795,7 @@ class Authzgroups
public function groupmemberReadUser ($module, $user)
{
if ($this->dbGroupMember == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for GroupMember is not connected"),
500);
$idgrouptmps = $this->groupRead ($module);
@@ -821,7 +821,7 @@ class Authzgroups
public function groupmemberReadUserByID ($module, $idgroupmember)
{
if ($this->dbGroupMember == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for GroupMember is not connected"),
500);
$idgrouptmps = $this->groupRead ($module);
@@ -848,12 +848,12 @@ class Authzgroups
public function groupmemberReadGroup ($module, $group)
{
if ($this->dbGroupMember == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for GroupMember is not connected"),
500);
$groups = $this->groupRead ($module, $group);
if (! isset ($groups[0]["idgroup"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted group not found"), 404);
$select[] = array ("idgroup", $groups[0]["idgroup"]);
return $this->dbGroupMember->read ($select, array ("user"));
@@ -867,12 +867,12 @@ class Authzgroups
public function groupmemberReadGroupByID ($module, $idgroup)
{
if ($this->dbGroupMember == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for GroupMember is not connected"),
500);
$groups = $this->groupReadByID ($module, $idgroup);
if (! isset ($groups[0]["idgroup"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted group not found"), 404);
$select[] = array ("idgroup", $groups[0]["idgroup"]);
return $this->dbGroupMember->read ($select);
@@ -886,12 +886,12 @@ class Authzgroups
public function groupmemberReadUserDataByID ($module, $idgroup, $iduser)
{
if ($this->dbGroupMember == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for GroupMember is not connected"),
500);
$groups = $this->groupReadByID ($module, $idgroup);
if (! isset ($groups[0]["idgroup"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted group not found"), 404);
$select[] = array ("idgroup", $groups[0]["idgroup"]);
$select[] = array ("idgroupmember", $iduser);
@@ -930,24 +930,24 @@ class Authzgroups
public function rightAdd ($module, $group, $object, $right, $comment="")
{
if ($this->dbRight == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Right is not connected"), 500);
switch ($right)
{
case "RW": $right=2;break;
case "RO": $right=1;break;
default:
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Unknown right provided (RO/RW only)"),
500);
}
$groups = $this->groupRead ($module, $group);
if (! isset ($groups[0]["idgroup"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted group not found"), 404);
$objects = $this->objectRead ($module, $object);
if (! isset ($objects[0]["idobject"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted object not found"), 404);
$this->rightCache = null;
return $this->dbRight->insert (array ("idgroup"=>$groups[0]["idgroup"],
@@ -968,24 +968,24 @@ class Authzgroups
$comment="")
{
if ($this->dbRight == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Right is not connected"), 500);
switch ($idright)
{
case "2": $right=2;break;
case "1": $right=1;break;
default:
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Unknown right provided (RO/RW only)"),
500);
}
$groups = $this->groupReadByID ($module, $idgroup);
if (! isset ($groups[0]["idgroup"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted group not found"), 404);
$objects = $this->objectReadByID ($module, $idobject);
if (! isset ($objects[0]["idobject"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted object not found"), 404);
$this->rightCache = null;
return $this->dbRight->insert (array ("idgroup"=>$groups[0]["idgroup"],
@@ -1002,11 +1002,11 @@ class Authzgroups
public function rightDel ($module, $group, $object)
{
if ($this->dbRight == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Right is not connected"), 500);
$idrights = $this->rightRead ($module, $group, $object);
if (!isset ($idrights[0]["idright"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted right not found"), 404);
$this->rightCache = null;
return $this->dbRight->delete ($idrights[0]["idright"]);
@@ -1019,11 +1019,11 @@ class Authzgroups
public function rightDelByID ($module, $idright)
{
if ($this->dbRight == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Right is not connected"), 500);
$idrights = $this->rightReadByID ($module, $idright);
if (!isset ($idrights[0]["idright"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted right not found"), 404);
$this->rightCache = null;
return $this->dbRight->delete ($idrights[0]["idright"]);
@@ -1040,20 +1040,20 @@ class Authzgroups
$newcomment="")
{
if ($this->dbRight == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Right is not connected"), 500);
switch ($newright)
{
case "RW": $newright=2;break;
case "RO": $newright=1;break;
default:
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Unknown right provided (RO/RW only)"),
500);
}
$idrights = $this->rightRead ($module, $group, $object);
if (!isset ($idrights[0]["idright"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted right not found"), 404);
$this->rightCache = null;
return $this->dbRight->update ($idrights[0]["idright"],
@@ -1072,20 +1072,20 @@ class Authzgroups
$newcomment="")
{
if ($this->dbRight == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Right is not connected"), 500);
switch ($newright)
{
case "2": $newright=2;break;
case "1": $newright=1;break;
default:
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Unknown right provided (RO/RW only)"),
500);
}
$idrights = $this->rightReadByID ($module, $idright);
if (!isset ($idrights[0]["idright"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted right not found"), 404);
$this->rightCache = null;
return $this->dbRight->update ($idrights[0]["idright"],
@@ -1104,15 +1104,15 @@ class Authzgroups
public function rightRead ($module, $group, $object)
{
if ($this->dbRight == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Right is not connected"), 500);
$groups = $this->groupRead ($module, $group);
if (! isset ($groups[0]["idgroup"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted group not found"), 404);
$objects = $this->objectRead ($module, $object);
if (! isset ($objects[0]["idobject"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted object not found"), 404);
$select[] = array ("idgroup", $groups[0]["idgroup"]);
$select[] = array ("idobject", $objects[0]["idobject"]);
@@ -1126,11 +1126,11 @@ class Authzgroups
public function rightReadByGroup ($module, $group)
{
if ($this->dbRight == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Right is not connected"), 500);
$groups = $this->groupRead ($module, $group);
if (! isset ($groups[0]["idgroup"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted group not found"), 404);
return $this->rightReadByGroupByID ($module, $objects[0]["idgroup"]);
}
@@ -1142,7 +1142,7 @@ class Authzgroups
public function rightReadByGroupByID ($module, $idgroup)
{
if ($this->dbRight == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Right is not connected"), 500);
$select[] = array ("idgroup", $idgroup);
return $this->dbRight->read ($select);
@@ -1156,7 +1156,7 @@ class Authzgroups
public function rightReadByID ($module, $idright)
{
if ($this->dbRight == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Right is not connected"), 500);
$select[] = array ("idright", $idright);
return $this->dbRight->read ($select);
@@ -1169,11 +1169,11 @@ class Authzgroups
public function rightReadByObject ($module, $object)
{
if ($this->dbRight == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Right is not connected"), 500);
$objects = $this->objectRead ($module, $object);
if (! isset ($objects[0]["idobject"]))
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Wanted object not found"), 404);
$select[] = array ("idobject", $objects[0]["idobject"]);
return $this->dbRight->read ($select);
@@ -1186,7 +1186,7 @@ class Authzgroups
public function rightReadByObjectByID ($module, $idobject)
{
if ($this->dbRight == null)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"DB for Right is not connected"), 500);
// FIXME : Do not use $module ?
$select[] = array ("idobject", $idobject);
diff --git a/src/Authzgroupsoo.php b/src/Authzgroupsoo.php
index f300c32..57474be 100644
--- a/src/Authzgroupsoo.php
+++ b/src/Authzgroupsoo.php
@@ -9,7 +9,7 @@ namespace Domframework;
/** All the needed functions to authorize or deny access to an authenticated
* user by its groups membership
- * Based on dblayeroo
+ * Based on Dblayeroo
*/
class Authzgroupsoo
{
@@ -288,7 +288,7 @@ class Authzgroupsoo
public function connect ($dsn, $username=null, $password=null,
$driver_options=null)
{
- $this->dbObject = new dblayeroo ($dsn, $username, $password,
+ $this->dbObject = new Dblayeroo ($dsn, $username, $password,
$driver_options);
$this->dbObject->debug ($this->debug);
$this->dbObject->table ("authzobject");
@@ -306,7 +306,7 @@ class Authzgroupsoo
"object" => dgettext ("domframework", "Object"),
"comment" => dgettext ("domframework", "Comment")));
- $this->dbGroup = new dblayeroo ($dsn, $username, $password,
+ $this->dbGroup = new Dblayeroo ($dsn, $username, $password,
$driver_options);
$this->dbGroup->debug ($this->debug);
$this->dbGroup->table ("authzgroup");
@@ -324,7 +324,7 @@ class Authzgroupsoo
"group" => dgettext ("domframework", "Group"),
"comment" => dgettext ("domframework", "Comment")));
- $this->dbGroupMember = new dblayeroo ($dsn, $username, $password,
+ $this->dbGroupMember = new Dblayeroo ($dsn, $username, $password,
$driver_options);
$this->dbGroupMember->debug ($this->debug);
$this->dbGroupMember->table ("authzgroupmember");
@@ -347,7 +347,7 @@ class Authzgroupsoo
"idgroup" => dgettext ("domframework", "idgroup"),
"comment" => dgettext ("domframework", "Comment")));
- $this->dbRight = new dblayeroo ($dsn, $username, $password,
+ $this->dbRight = new Dblayeroo ($dsn, $username, $password,
$driver_options);
$this->dbRight->debug ($this->debug);
$this->dbRight->table ("authzright");
diff --git a/src/Cacheoutput.php b/src/Cacheoutput.php
index d77251b..bab0b49 100644
--- a/src/Cacheoutput.php
+++ b/src/Cacheoutput.php
@@ -11,7 +11,7 @@ namespace Domframework;
* available, use it.
* It resend the headers as the ouptut send them
* Use it by :
- * $c = new cacheoutput ("URL");
+ * $c = new Cacheoutput ("URL");
* Don't forget to define a variable or the cache saved is always empty
*/
class Cacheoutput
@@ -36,13 +36,13 @@ class Cacheoutput
{
$res = @include ("domframework/cache$method.php");
if ($res === false)
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Unkwnown cache method : "), $method),
500);
$this->id = $id;
$this->ttl = $ttl;
$this->cacheCWD = getcwd();
- $cachemethod = "cache$method";
+ $cachemethod = "Cache$method";
$this->cache = new $cachemethod ();
if ($ttl === 0)
$this->cache->nocache = 1;
diff --git a/src/Cli.php b/src/Cli.php
index cf7615e..67d8c89 100644
--- a/src/Cli.php
+++ b/src/Cli.php
@@ -12,10 +12,9 @@ class Cli
{
/** Run in CLI mode with parameters
* Example of cli code :
- * #!/usr/bin/php5
+ * #!/usr/bin/php
* run();
*/
/** The expert mode allow to see/execute the models */
@@ -98,7 +97,7 @@ class Cli
":$errline]\n");
if ($this->EXPERT)
{
- $e = new Exception;
+ $e = new \Exception;
file_put_contents ("php://stderr",
print_r ($e->getTraceAsString(), TRUE)."\n");
}
@@ -238,13 +237,13 @@ class Cli
$class = $shortClasses[$class];
$file = $classes[$class];
require_once ($file);
- $refclass = new ReflectionClass ($class);
+ $refclass = new \ReflectionClass ($class);
// Look at constructor parameters
// PARAMETERS MUST NOT BE OPTIONNAL
$constParams = "";
try
{
- $r = new ReflectionMethod ($class, "__construct");
+ $r = new \ReflectionMethod ($class, "__construct");
$params = $r->getParameters();
foreach ($params as $param)
{
@@ -277,7 +276,7 @@ class Cli
echo $method->name.$constParams;
if ($argv[0] !== "-listmethodsonly")
{
- $r = new ReflectionMethod ($class, $method->name);
+ $r = new \ReflectionMethod ($class, $method->name);
$params = $r->getParameters();
foreach ($params as $param)
{
@@ -325,7 +324,7 @@ class Cli
die ("No method for class '$class' to execute\n");
$method = $argv[0];
array_shift ($argv);
- $refclass = new ReflectionClass ($class);
+ $refclass = new \ReflectionClass ($class);
$methods = $refclass->getMethods();
$found = FALSE;
foreach ($methods as $meth)
@@ -343,7 +342,7 @@ class Cli
$paramsConst = array ();
try
{
- $r1 = new ReflectionMethod ($class, "__construct");
+ $r1 = new \ReflectionMethod ($class, "__construct");
$paramsConst = $r1->getParameters();
$min = $max = count ($paramsConst);
}
@@ -352,7 +351,7 @@ class Cli
// No constructor available in class
}
- $r2 = new ReflectionMethod ($class, $method);
+ $r2 = new \ReflectionMethod ($class, $method);
$params = $r2->getParameters();
foreach ($params as $param)
{
@@ -425,7 +424,7 @@ class Cli
try
{
- $classReflection = new ReflectionClass($class);
+ $classReflection = new \ReflectionClass($class);
$r = $classReflection->newInstanceArgs($paramConst);
$s = call_user_func_array(array($r, $method), $argv);
if ($this->QUIET === false || $s !== "" && $s !== array () && $s !== null)
diff --git a/src/Color.php b/src/Color.php
index e6d7127..16b0e51 100644
--- a/src/Color.php
+++ b/src/Color.php
@@ -244,7 +244,7 @@ class Color
*/
public static function colorList ()
{
- $color = new \color ();
+ $color = new color ();
$colorList = $color->colorList;
return array_keys ($colorList);
}
@@ -254,7 +254,7 @@ class Color
*/
public static function textToRGB ($colorInText)
{
- $color = new \color ();
+ $color = new color ();
$colorList = $color->colorList;
if (! array_key_exists ($colorInText, $colorList))
throw new \Exception (sprintf (dgettext ("domframework",
@@ -273,7 +273,7 @@ class Color
throw new \Exception (dgettext ("domframework",
"No GD support in PHP : can't allocate color"),
500);
- $rgb = \color::textToRGB ($colorInText);
+ $rgb = color::textToRGB ($colorInText);
return imagecolorallocate ($gd, $rgb[0], $rgb[1], $rgb[2]);
}
}
diff --git a/src/Config.php b/src/Config.php
index b383c06..2dc231f 100644
--- a/src/Config.php
+++ b/src/Config.php
@@ -19,7 +19,7 @@ namespace Domframework;
* @default : the default value (can be an array or a string or a number)
* @group : Group all the parameters in a group
* POC :
- * $config = new config();
+ * $config = new Config();
* $config->default = array ("param"=>"default",
* "param2"=>array (1,2,3),
* "param3"=>null);
@@ -64,7 +64,7 @@ class Config
$conf = array ();
$rc = include ($this->confFile);
if ($rc !== 1)
- throw new Exception ("Error in configuration file", 500);
+ throw new \Exception ("Error in configuration file", 500);
return $conf;
}
@@ -104,26 +104,26 @@ class Config
{
$this->selectConfFile ();
if (!array_key_exists ($param, $this->default))
- throw new Exception ("Unknown configuration parameter '$param'", 500);
+ throw new \Exception ("Unknown configuration parameter '$param'", 500);
if (!file_exists ($this->confFile))
{
if (@file_put_contents ($this->confFile,
"confFile), 500);
}
elseif (! is_readable ($this->confFile))
- throw new Exception (sprintf ( dgettext ("domframework",
+ throw new \Exception (sprintf ( dgettext ("domframework",
"The configuration file '%s' is not readable"),
$this->confFile));
$conf = array ();
$rc = include ($this->confFile);
if ($rc !== 1)
- throw new Exception ("Error in configuration file", 500);
+ throw new \Exception ("Error in configuration file", 500);
if (! array_key_exists ($param, $this->default))
- throw new Exception (sprintf ("Configuration parameter '%s' not defined",
+ throw new \Exception (sprintf ("Configuration parameter '%s' not defined",
$param), 500);
// Create a conf where all the keys are defined. If the keys are already
// define, use them, or use the default ones
@@ -168,29 +168,29 @@ class Config
{
$this->selectConfFile ();
if (!array_key_exists ($param, $this->default))
- throw new Exception ("Unknown parameter '$param'", 500);
+ throw new \Exception ("Unknown parameter '$param'", 500);
if (!file_exists ($this->confFile))
{
if (@file_put_contents ($this->confFile,
"confFile));
}
elseif (! is_readable ($this->confFile))
- throw new Exception (sprintf (
+ throw new \Exception (sprintf (
dgettext ("domframework",
"The configuration file '%s' is not readable"),
$this->confFile), 500);
if (!is_writeable ($this->confFile))
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Configuration file '%s' is write protected"),
$this->confFile), 500);
$conf = array ();
$rc = include ($this->confFile);
if ($rc !== 1)
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Error in configuration file"), 500);
$newconf = array_merge ($this->default, $conf, array ($param=>$value));
$txt = "confFile, $txt, LOCK_EX) === FALSE)
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Can't save configuration file '%s'"),
$this->confFile), 500);
return TRUE;
@@ -236,7 +236,7 @@ class Config
$phpcode .= "),\r\n";
}
else
- throw new Exception (dgettext ("domframework",
+ throw new \Exception (dgettext ("domframework",
"Config : missing type ").gettype ($val), 500);
}
@@ -429,7 +429,7 @@ class Config
public function docComment ()
{
$debug = 0;
- $reflector = new ReflectionClass (get_class ($this));
+ $reflector = new \ReflectionClass (get_class ($this));
$modelFile = $reflector->getFileName();
if (! file_exists ($modelFile))
throw new \Exception (dgettext ("domframework",
@@ -478,7 +478,7 @@ class Config
if (! isset ($data["param"]))
continue;
if (substr ($data["param"], 0, 1) !== "/")
- throw new Exception (sprintf (dgettext ("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Parameter '%s' doesn't start by slash"), $data["param"]), 500);
$data["depth"] = $parenthesis;
$data["group"] = $group;
diff --git a/src/Daemon.php b/src/Daemon.php
index e7d5918..615e241 100644
--- a/src/Daemon.php
+++ b/src/Daemon.php
@@ -47,7 +47,7 @@ class Daemon
*/
public function start ($name, $callable, $params = array ())
{
- $file = new \file ();
+ $file = new file ();
if (! $file->is_writeable ($this->runDir))
throw new \Exception (sprintf ("Run Directory '%s' is not writeable",
$this->runDir), 500);
@@ -61,7 +61,7 @@ class Daemon
throw new \Exception (sprintf (
"Can't start the daemon: already running with PID %d", $pid), 500);
}
- $fork = new \fork ();
+ $fork = new fork ();
$pid = $fork->startDetachedChild ($name, $callable, $params);
file_put_contents ($this->runDir."/$name.pid", $pid);
return $pid;
@@ -77,7 +77,7 @@ class Daemon
*/
public function stop ($name, $maxWaitStop = 3, $maxWaitKill = 3)
{
- $file = new \file ();
+ $file = new file ();
if (! $file->is_writeable ($this->runDir))
throw new \Exception (sprintf ("Run Directory '%s' is not writeable",
$this->runDir), 500);
@@ -133,7 +133,7 @@ class Daemon
*/
public function status ($name)
{
- $file = new \file ();
+ $file = new file ();
if (! $file->is_writeable ($this->runDir))
throw new \Exception (sprintf ("Run Directory '%s' is not writeable",
$this->runDir), 500);
@@ -157,7 +157,7 @@ class Daemon
*/
public function reload ($name)
{
- $file = new \file ();
+ $file = new file ();
if (! $file->is_writeable ($this->runDir))
throw new \Exception (sprintf ("Run Directory '%s' is not writeable",
$this->runDir), 500);
diff --git a/src/Dblayer.php b/src/Dblayer.php
index 9ddd51d..b82ea4a 100644
--- a/src/Dblayer.php
+++ b/src/Dblayer.php
@@ -167,10 +167,10 @@ class Dblayer
if ($this->debug) echo "CONNECT TO DATABASE\n";
try
{
- self::$instance[$this->dsn] = new PDO ($dsn, $username, $password,
+ self::$instance[$this->dsn] = new \PDO ($dsn, $username, $password,
$driver_options);
- self::$instance[$this->dsn]->setAttribute (PDO::ATTR_ERRMODE,
- PDO::ERRMODE_EXCEPTION);
+ self::$instance[$this->dsn]->setAttribute (\PDO::ATTR_ERRMODE,
+ \PDO::ERRMODE_EXCEPTION);
}
catch (\Exception $e)
{
@@ -188,11 +188,11 @@ class Dblayer
if ($this->debug) echo "CONNECT TO DATABASE\n";
try
{
- $driver_options[PDO::MYSQL_ATTR_FOUND_ROWS] = 1;
- self::$instance[$this->dsn] = new PDO ($dsn, $username, $password,
+ $driver_options[\PDO::MYSQL_ATTR_FOUND_ROWS] = 1;
+ self::$instance[$this->dsn] = new \PDO ($dsn, $username, $password,
$driver_options);
- self::$instance[$this->dsn]->setAttribute (PDO::ATTR_ERRMODE,
- PDO::ERRMODE_EXCEPTION);
+ self::$instance[$this->dsn]->setAttribute (\PDO::ATTR_ERRMODE,
+ \PDO::ERRMODE_EXCEPTION);
}
catch (\Exception $e)
{
@@ -210,10 +210,10 @@ class Dblayer
if ($this->debug) echo "CONNECT TO DATABASE\n";
try
{
- self::$instance[$this->dsn] = new PDO ($dsn, $username, $password,
+ self::$instance[$this->dsn] = new \PDO ($dsn, $username, $password,
$driver_options);
- self::$instance[$this->dsn]->setAttribute (PDO::ATTR_ERRMODE,
- PDO::ERRMODE_EXCEPTION);
+ self::$instance[$this->dsn]->setAttribute (\PDO::ATTR_ERRMODE,
+ \PDO::ERRMODE_EXCEPTION);
}
catch (\Exception $e)
{
@@ -258,14 +258,14 @@ class Dblayer
if ($this->sep === "")
throw new \Exception (dgettext ("domframework", "Database not connected"),
500);
- switch (self::$instance[$this->dsn]->getAttribute(PDO::ATTR_DRIVER_NAME))
+ switch (self::$instance[$this->dsn]->getAttribute(\PDO::ATTR_DRIVER_NAME))
{
case "sqlite":
$req = "SELECT name FROM sqlite_master WHERE type='table'";
$st = self::$instance[$this->dsn]->prepare ($req);
$st->execute ();
$res = array ();
- while ($d = $st->fetch (PDO::FETCH_ASSOC))
+ while ($d = $st->fetch (\PDO::FETCH_ASSOC))
$res[] = $d["name"];
break;
case "mysql":
@@ -275,7 +275,7 @@ class Dblayer
$st = self::$instance[$this->dsn]->prepare ($req);
$st->execute ();
$res = array ();
- while ($d = $st->fetch (PDO::FETCH_ASSOC))
+ while ($d = $st->fetch (\PDO::FETCH_ASSOC))
$res[] = $d["TABLE_NAME"];
break;
case "pgsql":
@@ -285,7 +285,7 @@ class Dblayer
$st = self::$instance[$this->dsn]->prepare ($req);
$st->execute ();
$res = array ();
- while ($d = $st->fetch (PDO::FETCH_ASSOC))
+ while ($d = $st->fetch (\PDO::FETCH_ASSOC))
$res[] = $d["tablename"];
break;
default:
@@ -564,15 +564,15 @@ class Dblayer
if ($this->debug) echo "DEBUG BIND : $column(".md5 ($column)."->".
var_export ($val, TRUE)."\n";
if ($val === null)
- $st->bindValue (":".md5 ($key), $val, PDO::PARAM_NULL);
+ $st->bindValue (":".md5 ($key), $val, \PDO::PARAM_NULL);
elseif ($this->fields[$foreign][0] === "integer")
- $st->bindValue (":".md5 ($key), $val, PDO::PARAM_INT);
+ $st->bindValue (":".md5 ($key), $val, \PDO::PARAM_INT);
elseif ($this->fields[$foreign][0] === "varchar")
- $st->bindValue (":".md5 ($key), $val, PDO::PARAM_STR);
+ $st->bindValue (":".md5 ($key), $val, \PDO::PARAM_STR);
elseif ($this->fields[$foreign][0] === "datetime")
- $st->bindValue (":".md5 ($key), $val, PDO::PARAM_STR);
+ $st->bindValue (":".md5 ($key), $val, \PDO::PARAM_STR);
elseif ($this->fields[$foreign][0] === "date")
- $st->bindValue (":".md5 ($key), $val, PDO::PARAM_STR);
+ $st->bindValue (":".md5 ($key), $val, \PDO::PARAM_STR);
else
{
throw new \Exception ("TO BE DEVELOPPED : ".$this->fields[$foreign][0],
@@ -580,7 +580,7 @@ class Dblayer
}
$st->execute ();
$res = array ();
- while ($d = $st->fetch (PDO::FETCH_ASSOC))
+ while ($d = $st->fetch (\PDO::FETCH_ASSOC))
$res[] = $d;
if (count ($res) === 0)
{
@@ -655,15 +655,15 @@ class Dblayer
if ($this->debug) echo "DEBUG BIND : $key(".md5 ($key).")->".
var_export ($val, TRUE)."\n";
if ($val === null)
- $st->bindValue (":".md5 ($key), $val, PDO::PARAM_NULL);
+ $st->bindValue (":".md5 ($key), $val, \PDO::PARAM_NULL);
elseif ($this->fields[$key][0] === "integer")
- $st->bindValue (":".md5 ($key), $val, PDO::PARAM_INT);
+ $st->bindValue (":".md5 ($key), $val, \PDO::PARAM_INT);
elseif ($this->fields[$key][0] === "varchar")
- $st->bindValue (":".md5 ($key), $val, PDO::PARAM_STR);
+ $st->bindValue (":".md5 ($key), $val, \PDO::PARAM_STR);
elseif ($this->fields[$key][0] === "datetime")
- $st->bindValue (":".md5 ($key), $val, PDO::PARAM_STR);
+ $st->bindValue (":".md5 ($key), $val, \PDO::PARAM_STR);
elseif ($this->fields[$key][0] === "date")
- $st->bindValue (":".md5 ($key), $val, PDO::PARAM_STR);
+ $st->bindValue (":".md5 ($key), $val, \PDO::PARAM_STR);
else
throw new \Exception ("TO BE DEVELOPPED : ".$this->fields[$key][0],
500);
@@ -876,7 +876,7 @@ class Dblayer
if ($this->debug) echo "DEBUG : EXECUTE ERROR ! Return FALSE\n";
}
$res = array ();
- while ($d = $st->fetch (PDO::FETCH_ASSOC))
+ while ($d = $st->fetch (\PDO::FETCH_ASSOC))
$res[] = $d;
$res = call_user_func ($this->hookpostreadFunc, $res);
return $res;
@@ -952,27 +952,27 @@ class Dblayer
if ($val === null)
{
if ($this->debug) echo "(null)\n";
- $st->bindValue (":".md5 ($key), $val, PDO::PARAM_NULL);
+ $st->bindValue (":".md5 ($key), $val, \PDO::PARAM_NULL);
}
elseif ($fields[$key][0] === "integer")
{
if ($this->debug) echo "(integer)\n";
- $st->bindValue (":".md5 ($key), $val, PDO::PARAM_INT);
+ $st->bindValue (":".md5 ($key), $val, \PDO::PARAM_INT);
}
elseif ($fields[$key][0] === "varchar")
{
if ($this->debug) echo "(varchar)\n";
- $st->bindValue (":".md5 ($key), "$val", PDO::PARAM_STR);
+ $st->bindValue (":".md5 ($key), "$val", \PDO::PARAM_STR);
}
elseif ($fields[$key][0] === "datetime")
{
if ($this->debug) echo "(datetime)\n";
- $st->bindValue (":".md5 ($key), $val, PDO::PARAM_STR);
+ $st->bindValue (":".md5 ($key), $val, \PDO::PARAM_STR);
}
elseif ($fields[$key][0] === "date")
{
if ($this->debug) echo "(date)\n";
- $st->bindValue (":".md5 ($key), $val, PDO::PARAM_STR);
+ $st->bindValue (":".md5 ($key), $val, \PDO::PARAM_STR);
}
else
{
@@ -1089,7 +1089,7 @@ class Dblayer
if ($this->table === null)
throw new \Exception (dgettext ("domframework",
"No table name defined to create the table"), 500);
- switch (self::$instance[$this->dsn]->getAttribute(PDO::ATTR_DRIVER_NAME))
+ switch (self::$instance[$this->dsn]->getAttribute(\PDO::ATTR_DRIVER_NAME))
{
case "sqlite":
$sql = "CREATE TABLE IF NOT EXISTS ".
@@ -1400,7 +1400,7 @@ class Dblayer
$st = self::$instance[$this->dsn]->prepare ($sql);
$st->execute ();
$res = array ();
- while ($d = $st->fetch (PDO::FETCH_ASSOC))
+ while ($d = $st->fetch (\PDO::FETCH_ASSOC))
$res[] = $d;
return $res;
}
diff --git a/src/Dblayerauthzgroups.php b/src/Dblayerauthzgroups.php
index fd7c912..28f0be8 100644
--- a/src/Dblayerauthzgroups.php
+++ b/src/Dblayerauthzgroups.php
@@ -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);
diff --git a/src/Form.php b/src/Form.php
index 8eef4df..500ef6e 100644
--- a/src/Form.php
+++ b/src/Form.php
@@ -491,7 +491,7 @@ class Form
* $route->requestURL () method to found the calling page
*
* Example :
- $form = new \form ();
+ $form = new \Domframework\form ();
$form->logging (array ('\apps\general\controllers\logging', 'log'),
$authHTML["email"]);
$values = $form->values ();
diff --git a/src/Graph.php b/src/Graph.php
index 9d030ae..b0b8964 100644
--- a/src/Graph.php
+++ b/src/Graph.php
@@ -66,13 +66,13 @@ class Graph
if (! function_exists ("imagecreatetruecolor"))
throw new \Exception (dgettext ("domframework",
"No GD support in PHP : can't create image"), 500);
- $this->title = new graphTitle ();
- $this->legend = new graphLegend ();
- $this->data = new graphData ();
- $this->series = new graphSeries ();
- $this->axisX = new graphAxisX ();
- $this->axisY1 = new graphAxisY1 ();
- $this->axisY2 = new graphAxisY2 ();
+ $this->title = new GraphTitle ();
+ $this->legend = new GraphLegend ();
+ $this->data = new GraphData ();
+ $this->series = new GraphSeries ();
+ $this->axisX = new GraphAxisX ();
+ $this->axisY1 = new GraphAxisY1 ();
+ $this->axisY2 = new GraphAxisY2 ();
// Default values
$defaultTitleFontFile = "/usr/share/fonts/truetype/liberation/".
"LiberationSans-Bold.ttf";
@@ -165,7 +165,7 @@ class Graph
! in_array ($style, array ("line", "points", "linePoints")))
throw new \Exception (dgettext ("domframework",
"Invalid style provided to graph"), 406);
- $styleClass = "graphStyle".$style;
+ $styleClass = "GraphStyle".$style;
if ($this->style === null || $this->style ()->name () !== $style)
{
$this->style = new $styleClass ();
@@ -407,7 +407,7 @@ class GraphSeries
"Can't get a serie if the name is not a string"),
406);
if (! array_key_exists ($name, $this->series))
- $this->series[$name] = new graphSerie ($name);
+ $this->series[$name] = new GraphSerie ($name);
return $this->series[$name];
}
@@ -632,7 +632,7 @@ class GraphSerie
! in_array ($style, array ("line", "points", "linePoints")))
throw new \Exception (dgettext ("domframework",
"Invalid style provided to serie"), 406);
- $styleClass = "graphStyle".$style;
+ $styleClass = "GraphStyle".$style;
if ($this->style === null)
$this->style = new $styleClass ();
return $this->style;
diff --git a/src/Httpclient.php b/src/Httpclient.php
index 29f0dea..fc32e29 100644
--- a/src/Httpclient.php
+++ b/src/Httpclient.php
@@ -653,7 +653,7 @@ class Httpclient
// {{{
if ($this->tcpclient === null)
{
- $this->tcpclient = new tcpclient ($parseURL["host"], $this->port);
+ $this->tcpclient = new Tcpclient ($parseURL["host"], $this->port);
$this->tcpclient->timeout ($this->timeout);
$this->tcpclient->connect ();
if ($parseURL["scheme"] === "https")
diff --git a/src/Jwt.php b/src/Jwt.php
index 1f65031..eb68a14 100644
--- a/src/Jwt.php
+++ b/src/Jwt.php
@@ -53,7 +53,7 @@ class Jwt
$payload = $this->jsonEncode ($payload);
if ($ckey)
{
- $encrypt = new encrypt ();
+ $encrypt = new Encrypt ();
$payload = $encrypt->encrypt ($payload, $ckey, $cipherMethod);
}
$segments[] = $this->urlsafeB64Encode ($payload);
@@ -94,7 +94,7 @@ class Jwt
$payload = $this->urlsafeB64Decode ($payloadb64);
if ($ckey)
{
- $encrypt = new encrypt ();
+ $encrypt = new Encrypt ();
$payload = $encrypt->decrypt ($payload, $ckey);
}
$payload = $this->jsonDecode ($payload);
diff --git a/src/Logger.php b/src/Logger.php
index 3a98eab..02741f7 100644
--- a/src/Logger.php
+++ b/src/Logger.php
@@ -214,14 +214,14 @@ class Logger
private function logfile ($message, $priority)
{
if ($this->logfile === FALSE)
- throw new Exception ("Undefined file where logging");
+ throw new \Exception ("Undefined file where logging");
if (!file_exists ($this->logfile))
{
if (! is_dir (dirname ($this->logfile)))
- throw new Exception ("You must create the ".dirname ($this->logfile).
+ throw new \Exception ("You must create the ".dirname ($this->logfile).
"directory");
if (! is_writable (dirname ($this->logfile)))
- throw new Exception ("The directory ".dirname ($this->logfile)." must"
+ throw new \Exception ("The directory ".dirname ($this->logfile)." must"
." be writable to create log file");
}
elseif (!is_writable ($this->logfile))
@@ -232,7 +232,7 @@ class Logger
$user = getenv('USERNAME');
else
$user = "";
- throw new Exception ("Logfile $this->logfile is not writable for user ".
+ throw new \Exception ("Logfile $this->logfile is not writable for user ".
$user);
}
@@ -313,7 +313,7 @@ class Logger
private function logsession ($message, $priority)
{
if (! isset ($_SESSION))
- throw new Exception ("No session available to store the log", 500);
+ throw new \Exception ("No session available to store the log", 500);
ini_set ("date.timezone", $this->timezone);
$message = date ("Y/m/d H:i:s")." [".$this->priorities[$priority]."] ".
$message;
diff --git a/src/Outputcsv.php b/src/Outputcsv.php
index 4f78851..47b79a3 100644
--- a/src/Outputcsv.php
+++ b/src/Outputcsv.php
@@ -15,7 +15,7 @@ class Outputcsv extends Output
function __construct ()
{
if (!function_exists ("fputcsv"))
- throw new Exception ("CSV support not available in PHP !", 500);
+ throw new \Exception ("CSV support not available in PHP !", 500);
}
/** Display in CSV the data provided
diff --git a/src/Outputrest.php b/src/Outputrest.php
index dfa38ab..6f7d473 100644
--- a/src/Outputrest.php
+++ b/src/Outputrest.php
@@ -34,7 +34,7 @@ class Outputrest extends Output
{
if (! isset ($variable["exceptionCode"]))
$variable["exceptionCode"] = 200;
- $rest = new rest ();
+ $rest = new Rest ();
$rest->display ($data, $variable["exceptionCode"]);
}
}
diff --git a/src/Outputxml.php b/src/Outputxml.php
index 312bccd..0e003e1 100644
--- a/src/Outputxml.php
+++ b/src/Outputxml.php
@@ -29,7 +29,7 @@ class Outputxml extends Output
}
else
{
- $xml = new SimpleXMLElement (" ");
+ $xml = new \SimpleXMLElement (" ");
// function call to convert array to xml
if (!is_array ($data))
$data = array ($data);
diff --git a/src/Password.php b/src/Password.php
index bc211b5..a666e74 100644
--- a/src/Password.php
+++ b/src/Password.php
@@ -132,7 +132,7 @@ class Password
static public function cryptPasswd ($password)
// {{{
{
- $passwd = new password ();
+ $passwd = new Password ();
return $passwd->cryptPassword ($password);
}
// }}}
diff --git a/src/Queuefile.php b/src/Queuefile.php
index 0f9c37b..e5af1f1 100644
--- a/src/Queuefile.php
+++ b/src/Queuefile.php
@@ -36,7 +36,7 @@ class Queuefile extends Queue
throw new \Exception ("Invalid DSN provided to queuefile : not starting ".
"by file://", 500);
$this->queue = substr ($dsn, 7);
- $file = new \file ();
+ $file = new File ();
if (! $file->file_exists (dirname ($this->queue)))
$file->mkdir (dirname ($this->queue), 0777, true);
if (! $file->file_exists ($this->queue))
@@ -52,7 +52,7 @@ class Queuefile extends Queue
public function add ($entry)
// {{{
{
- $file = new \file ();
+ $file = new File ();
$file->lockEX ($this->queue);
$file->file_put_contents ($this->queue,
json_encode ($entry)."\n", FILE_APPEND);
@@ -68,7 +68,7 @@ class Queuefile extends Queue
public function getAll ($delete =false)
// {{{
{
- $file = new \file ();
+ $file = new File ();
if ($delete)
$file->lockEX ($this->queue);
else
@@ -93,7 +93,7 @@ class Queuefile extends Queue
public function count ()
// {{{
{
- $file = new \file ();
+ $file = new File ();
$file->lockSH ($this->queue);
$content = $file->file_get_contents ($this->queue);
$count = substr_count ($content, "\n");
@@ -108,7 +108,7 @@ class Queuefile extends Queue
public function clear ()
// {{{
{
- $file = new \file ();
+ $file = new File ();
$file->lockEX ($this->queue);
$file->file_put_contents ($this->queue, "");
$file->lockUN ($this->queue);
@@ -124,7 +124,7 @@ class Queuefile extends Queue
public function getFirst ($delete = false)
// {{{
{
- $file = new \file ();
+ $file = new File ();
if ($delete)
$file->lockEX ($this->queue);
else
@@ -156,7 +156,7 @@ class Queuefile extends Queue
public function getLast ($delete = false)
// {{{
{
- $file = new \file ();
+ $file = new File ();
if ($delete)
$file->lockEX ($this->queue);
else
@@ -190,7 +190,7 @@ class Queuefile extends Queue
public function getRange ($start, $number, $delete = false)
// {{{
{
- $file = new \file ();
+ $file = new File ();
if ($delete)
$file->lockEX ($this->queue);
else
diff --git a/src/Ratelimitfile.php b/src/Ratelimitfile.php
index 29baa69..5e28511 100644
--- a/src/Ratelimitfile.php
+++ b/src/Ratelimitfile.php
@@ -36,7 +36,7 @@ class Ratelimitfile extends Ratelimit
"File '%s' not writeable for user '%s'"),
$file, $user["name"]), 500);
file_put_contents ($file, $currentTimeStamp, FILE_APPEND);
- $lock = new lockfile ();
+ $lock = new Lockfile ();
$lock->storagelock = $this->storageDir."/lockfile.lock";
$lock->lockRW ();
$contents = file ($file);
diff --git a/src/Renderer.php b/src/Renderer.php
index 00492d1..40a96d7 100644
--- a/src/Renderer.php
+++ b/src/Renderer.php
@@ -35,7 +35,7 @@ class Renderer
// If the output is not defined in domframework, it will not be loaded but
// without error, it can be loaded by the autoloader
//@require_once ("domframework/output$this->output.php");
- $class = __NAMESPACE__."\\output$this->output";
+ $class = __NAMESPACE__."\\Output$this->output";
$obj = new $class ();
$res = call_user_func_array (array ($obj, "out"),
array ($this->result, $this->title,
@@ -119,7 +119,7 @@ class Renderer
if ($layoutfile !== false && ! file_exists ($layoutfile))
throw new \Exception ("Layout file $layoutfile not found", 500);
if ($route === null)
- $route = new route ();
+ $route = new Route ();
// Return a $dataflash with the displayed flash in Bootstrap
$dataflash = "";
if (isset ($_SESSION["renderer"]["flash"]))
@@ -158,7 +158,7 @@ class Renderer
unset ($_SESSION["renderer"]["flash"]);
}
- $html = new outputhtml ();
+ $html = new Outputhtml ();
$replacement = array_merge ($replacement,
array ("{baseurl}"=>$route->baseURL (),
"{baseurlresource}"=>$route->baseURLresource (),
diff --git a/src/Rest.php b/src/Rest.php
index 0d2f482..c8b5164 100644
--- a/src/Rest.php
+++ b/src/Rest.php
@@ -38,7 +38,7 @@ class Rest
// the output plugin at the end
$convert = array_intersect ($this->convert, $this->allowedtypes);
$type = array_search (reset ($this->allowedtypes), $this->convert);
- $http = new http;
+ $http = new Http;
$type = $http->bestChoice ($_SERVER["HTTP_ACCEPT"], array_keys ($convert),
$type);
$type = $this->convert[$type];
@@ -56,12 +56,12 @@ class Rest
function display ($message, $code = 200)
// {{{
{
- $http = new http;
+ $http = new Http;
$text = $http->codetext ($code);
header ($_SERVER["SERVER_PROTOCOL"]." $code $text");
$type = $this->chooseType ();
require_once ("domframework/output$type.php");
- $constr = __NAMESPACE__."\\output$type";
+ $constr = __NAMESPACE__."\\Output$type";
$method = "out";
$obj = new $constr ();
$obj->$method ($message);
diff --git a/src/Route.php b/src/Route.php
index d426e18..397c0c1 100644
--- a/src/Route.php
+++ b/src/Route.php
@@ -68,7 +68,7 @@ class Route
/** The route constructor : initialize the parameters */
function __construct ()
{
- $this->ratelimiter = new ratelimitfile ();
+ $this->ratelimiter = new Ratelimitfile ();
}
/** Get / Set the debug level
@@ -533,7 +533,7 @@ class Route
{
$this->error ($e);
}
- $renderer = new renderer ();
+ $renderer = new Renderer ();
$renderer->result = $data;
$renderer->output = $this->output;
$renderer->title = $this->title;
@@ -588,7 +588,7 @@ class Route
{
$this->error ($e);
}
- $renderer = new renderer ();
+ $renderer = new Renderer ();
$renderer->result = $data;
$renderer->output = $this->output;
$renderer->title = $this->title;
@@ -669,7 +669,7 @@ class Route
$this->redirect ($this->authenticationURL.$this->requestURL(), "");
}
- $http = new http ();
+ $http = new Http ();
@header ($_SERVER["SERVER_PROTOCOL"]." $getCode ".
$http->codetext ($getCode));
if ($getCode === 401)
@@ -680,7 +680,7 @@ class Route
}
// TODO : If the output is HTML, add the header line :
// echo " \n";
- $renderer = new renderer ();
+ $renderer = new Renderer ();
$renderer->result = $message;
$renderer->output = $this->output;
$renderer->title = $http->codetext ($getCode);
diff --git a/src/RouteSQL.php b/src/RouteSQL.php
index 13b305f..db0b248 100644
--- a/src/RouteSQL.php
+++ b/src/RouteSQL.php
@@ -177,7 +177,7 @@ class RouteSQL
{
// The maximum of links available in the paginator
$maxClickPaginator = 10;
- $route = new route ();
+ $route = new Route ();
$prePage = false;
$postPage = false;
$content = " \n";
@@ -242,7 +242,7 @@ $content .= "\n";
$content = "";
if ($this->displayActions && $this->readwriteAllowed)
{
- $route = new route ();
+ $route = new Route ();
$content .= " \n";
$content .= " "
.dgettext ("domframework", "Add new entry")."\n";
@@ -259,7 +259,7 @@ $content .= "\n";
*/
private function numberEntryByDisplayArea ($nbentries, $page, $num, $search)
{
- $route = new route ();
+ $route = new Route ();
$content = "";
$content .= " \n";
$content .= "