Update gettext : add spaces

DomCi : remove line too longs on all the files


git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5280 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2019-05-23 14:19:30 +00:00
parent a79b59685f
commit 17168aaaef
39 changed files with 588 additions and 565 deletions

View File

@@ -185,8 +185,8 @@ class authsql extends auth
$rc = $this->db->update ($email,
array ($this->fieldPassword => $cryptpassword));
if ($rc !== 1)
throw new Exception (dgettext("domframework","Can't change the password"),
500);
throw new Exception (dgettext ("domframework",
"Can't change the password"), 500);
}
/** List all the users available in the database
Return firstname, lastname, mail, with mail is an array */

View File

@@ -321,15 +321,11 @@ class authzgroups
$this->dbGroupMember->foreign = array (
"idgroup"=>array ("authzgroup", "idgroup",
"ON UPDATE CASCADE ON DELETE CASCADE"));
$this->dbGroupMember->titles = array ("idgroupmember"=>
dgettext("domframework",
"idgroupmember"),
"user"=>dgettext("domframework",
"User"),
"idgroup"=>dgettext("domframework",
"idgroup"),
"comment"=>dgettext("domframework",
"Comment"));
$this->dbGroupMember->titles = array (
"idgroupmember"=> dgettext ("domframework", "idgroupmember"),
"user"=>dgettext ("domframework", "User"),
"idgroup"=>dgettext ("domframework", "idgroup"),
"comment"=>dgettext ("domframework", "Comment"));
$this->dbRight = new dblayer ($dsn, $username, $password, $driver_options);
$this->dbRight->debug = $this->debug;
@@ -349,15 +345,12 @@ class authzgroups
"idobject"=>array ("authzobject", "idobject",
"ON UPDATE CASCADE ON DELETE CASCADE"),
);
$this->dbRight->titles = array ("idright"=>dgettext("domframework",
"idright"),
"idgroup"=>dgettext("domframework",
"idgroup"),
"idobject"=>dgettext("domframework",
"idobject"),
$this->dbRight->titles = array (
"idright"=>dgettext ("domframework", "idright"),
"idgroup"=>dgettext ("domframework", "idgroup"),
"idobject"=>dgettext ("domframework", "idobject"),
"right"=>dgettext ("domframework", "Right"),
"comment"=>dgettext("domframework",
"Comment"));
"comment"=>dgettext ("domframework", "Comment"));
return TRUE;
}

View File

@@ -133,7 +133,7 @@ class dblayer
$driver = @explode (":", $dsn);
if (! isset ($driver[0]))
throw new Exception (dgettext("domframework", "No valid DSN provided"),
throw new \Exception (dgettext ("domframework", "No valid DSN provided"),
500);
if (! in_array ($driver[0], pdo_drivers ()))
throw new \Exception (sprintf (dgettext ("domframework",
@@ -147,11 +147,11 @@ class dblayer
// Look at the right to write in database and in the directory
$file = substr ($dsn, 7);
if (! is_writeable (dirname ($file)))
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"The directory for SQLite database is write protected"),
500);
if (file_exists ($file) && ! is_writeable ($file))
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"The SQLite database file is write protected"),
500);
if (function_exists ("posix_getuid") &&
@@ -170,9 +170,9 @@ class dblayer
self::$instance[$this->dsn]->setAttribute (PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION);
}
catch (Exception $e)
catch (\Exception $e)
{
throw new Exception ("PDO error : ".$e->getMessage(), 500);
throw new \Exception ("PDO error : ".$e->getMessage(), 500);
}
}
@@ -192,9 +192,9 @@ class dblayer
self::$instance[$this->dsn]->setAttribute (PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION);
}
catch (Exception $e)
catch (\Exception $e)
{
throw new Exception ("PDO error : ".$e->getMessage(), 500);
throw new \Exception ("PDO error : ".$e->getMessage(), 500);
}
}
@@ -213,9 +213,9 @@ class dblayer
self::$instance[$this->dsn]->setAttribute (PDO::ATTR_ERRMODE,
PDO::ERRMODE_EXCEPTION);
}
catch (Exception $e)
catch (\Exception $e)
{
throw new Exception ("PDO error : ".$e->getMessage(), 500);
throw new \Exception ("PDO error : ".$e->getMessage(), 500);
}
}
@@ -224,7 +224,7 @@ class dblayer
$this->sep = "\"";
break;
default:
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Unknown PDO driver provided"), 500);
}
return self::$instance[$this->dsn];
@@ -235,7 +235,7 @@ class dblayer
public function databasename ()
{
if ($this->sep === "")
throw new Exception (dgettext("domframework", "Database not connected"),
throw new \Exception (dgettext ("domframework", "Database not connected"),
500);
$vals = explode (";", substr (strstr ($this->dsn, ":"), 1));
$dsnExplode = array ();
@@ -254,7 +254,7 @@ class dblayer
public function listTables ()
{
if ($this->sep === "")
throw new Exception (dgettext("domframework", "Database not connected"),
throw new \Exception (dgettext ("domframework", "Database not connected"),
500);
switch (self::$instance[$this->dsn]->getAttribute(PDO::ATTR_DRIVER_NAME))
{
@@ -287,7 +287,7 @@ class dblayer
$res[] = $d["tablename"];
break;
default:
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Unknown database driver in listTables"), 500);
}
return $res;
@@ -573,7 +573,7 @@ class dblayer
$st->bindValue (":".md5 ($key), $val, PDO::PARAM_STR);
else
{
throw new Exception ("TO BE DEVELOPPED : ".$this->fields[$foreign][0],
throw new \Exception ("TO BE DEVELOPPED : ".$this->fields[$foreign][0],
500);
}
$st->execute ();
@@ -598,20 +598,20 @@ class dblayer
{
if ($this->debug) echo "== Entering insert\n";
if ($this->sep === "")
throw new Exception (dgettext("domframework", "Database not connected"),
throw new \Exception (dgettext ("domframework", "Database not connected"),
500);
if ($this->table === null)
throw new \Exception (dgettext ("domframework",
"No table name defined to insert in the table"),
500);
if ($this->unique === null)
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Unique fields of table are not defined"), 500);
if (! is_array ($this->unique))
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"The unique configuration is not an array"), 500);
if (!is_array ($data))
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"The data provided to create are not array"),
405);
foreach ($this->fields as $key=>$params)
@@ -628,7 +628,7 @@ class dblayer
$errors = reset ($errors);
if (! is_array ($errors))
$errors = array (0=>"error", 1=>$errors);
throw new Exception ($errors[1], 405);
throw new \Exception ($errors[1], 405);
}
foreach ($this->fields as $field=>$desc)
{
@@ -663,14 +663,15 @@ class dblayer
elseif ($this->fields[$key][0] === "date")
$st->bindValue (":".md5 ($key), $val, PDO::PARAM_STR);
else
throw new Exception ("TO BE DEVELOPPED : ".$this->fields[$key][0], 500);
throw new \Exception ("TO BE DEVELOPPED : ".$this->fields[$key][0],
500);
}
try
{
$st->execute ();
}
catch (Exception $e)
catch (\Exception $e)
{
echo "dblayer execute exception : ".$e->getMessage()."\n";
exit;
@@ -709,21 +710,21 @@ class dblayer
{
if ($this->debug) echo "== Entering read\n";
if ($this->sep === "")
throw new Exception (dgettext("domframework", "Database not connected"),
throw new \Exception (dgettext ("domframework", "Database not connected"),
500);
if ($this->table === null)
throw new \Exception (dgettext ("domframework",
"No table name defined to read the table"), 500);
if ($select !== null && !is_array ($select))
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Select information provided is not an array"),
405);
if ($display !== null && !is_array ($display))
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Display information provided is not an array"),
405);
if ($order !== null && !is_array ($order))
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Order information provided is not an array"),
405);
if ($display !== null)
@@ -731,7 +732,7 @@ class dblayer
foreach ($display as $f)
{
if (!in_array ($f, array_keys ($this->fields)))
throw new Exception (sprintf (dgettext("domframework",
throw new \Exception (sprintf (dgettext ("domframework",
"Field '%s' not allowed"), $f), 500);
}
}
@@ -763,14 +764,14 @@ class dblayer
foreach ($select as $n=>$s)
{
if (! is_array ($s))
throw new Exception ("Select not an array for element $n", 500);
throw new \Exception ("Select not an array for element $n", 500);
// The foreign keys can not be in the select too (conflict)
if (in_array ($s[0],$foreignSelectCols))
continue;
if (! array_key_exists (0, $s))
throw new Exception ("Select field for key $n not provided", 406);
throw new \Exception ("Select field for key $n not provided", 406);
if (! array_key_exists (1, $s))
throw new Exception ("Select value for key $n not provided", 406);
throw new \Exception ("Select value for key $n not provided", 406);
if ($n > 0)
{
if ($whereOr === false)
@@ -781,7 +782,7 @@ class dblayer
if (!isset ($s[2]))
$s[2] = "=";
if (!isset ($s[0]))
throw new Exception (sprintf (dgettext("domframework",
throw new \Exception (sprintf (dgettext ("domframework",
"Select not found for id=%d"), $n), 500);
// The double-quotes are added for sqlite to escape the column if its
// name is 'group'
@@ -803,9 +804,9 @@ class dblayer
foreach ($foreignSelect as $n=>$s)
{
if (! array_key_exists (0, $s))
throw new Exception ("Foreign field for key $n not provided", 406);
throw new \Exception ("Foreign field for key $n not provided", 406);
if (! array_key_exists (1, $s))
throw new Exception ("Foreign value for key $n not provided", 406);
throw new \Exception ("Foreign value for key $n not provided", 406);
if ($n > 0)
{
$req .= " AND";
@@ -837,11 +838,11 @@ class dblayer
{
$st = self::$instance[$this->dsn]->prepare ($req);
}
catch (Exception $e)
catch (\Exception $e)
{
if ($this->debug) echo "DEBUG : PREPARE ERROR ! Return FALSE".
$e->getMessage()."\n";
throw new Exception ($e->getMessage(), 500);
throw new \Exception ($e->getMessage(), 500);
}
if ($select !== NULL)
@@ -890,18 +891,19 @@ class dblayer
{
if ($this->debug) echo "== Entering update\n";
if ($this->sep === "")
throw new Exception (dgettext("domframework", "Database not connected"),
throw new \Exception (dgettext ("domframework", "Database not connected"),
500);
if ($this->table === null)
throw new \Exception (dgettext ("domframework",
"No table name defined to update in the table"),
500);
if (count ($this->fields) === 0)
throw new Exception (dgettext("domframework", "No Field defined"), 500);
throw new \Exception (dgettext ("domframework", "No Field defined"), 500);
if ($this->primary === null)
throw new Exception (dgettext("domframework", "No Primary defined"), 500);
throw new \Exception (dgettext ("domframework", "No Primary defined"),
500);
if (count ($data) === 0)
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"No data to update provided"), 500);
$dataOK = array ();
$errors = $this->verify ($data, $updatekey);
@@ -910,11 +912,11 @@ class dblayer
if (is_array ($errors))
{
if (isset ($errors[0][1]))
throw new Exception ($errors[0][1], 405);
throw new \Exception ($errors[0][1], 405);
$err = reset ($errors);
throw new Exception ($err[1], 405);
throw new \Exception ($err[1], 405);
}
throw new Exception ($errors[1], 405);
throw new \Exception ($errors[1], 405);
}
foreach ($this->fields as $field=>$desc)
{
@@ -973,7 +975,7 @@ class dblayer
else
{
if ($this->debug) echo "(UNKNOWN)\n";
throw new Exception ("TO BE DEVELOPPED : ".$fields[$key][0], 500);
throw new \Exception ("TO BE DEVELOPPED : ".$fields[$key][0], 500);
}
}
@@ -992,7 +994,8 @@ class dblayer
{
if ($this->debug) echo "== Entering delete\n";
if ($this->sep === "")
throw new Exception (dgettext("domframework", "Database not connected"));
throw new \Exception (dgettext ("domframework", "Database not connected"),
500);
if ($this->table === null)
throw new \Exception (dgettext ("domframework",
"No table name defined to delete in the table"),
@@ -1009,7 +1012,7 @@ class dblayer
{
$st->execute ();
}
catch (Exception $e)
catch (\Exception $e)
{
throw new \Exception ($e->getMessage (), 500);
}
@@ -1025,7 +1028,7 @@ class dblayer
{
if ($this->debug) echo "== Entering titles\n";
if (count ($this->fields) === 0)
throw new Exception (dgettext("domframework", "No Field defined"), 500);
throw new \Exception (dgettext ("domframework", "No Field defined"), 500);
$arr = array ();
if (count ($this->titles) !== 0)
{
@@ -1046,7 +1049,8 @@ class dblayer
{
if ($this->debug) echo "== Entering dropTables\n";
if ($this->sep === "")
throw new Exception (dgettext("domframework", "Database not connected"));
throw new \Exception (dgettext ("domframework", "Database not connected"),
500);
if ($this->table === null)
throw new \Exception (dgettext ("domframework",
"No table name defined to drop the table"), 500);
@@ -1076,10 +1080,10 @@ class dblayer
{
if ($this->debug) echo "== Entering createTable\n";
if ($this->sep === "")
throw new Exception (dgettext("domframework", "Database not connected"),
throw new \Exception (dgettext ("domframework", "Database not connected"),
500);
if (count ($this->fields) === 0)
throw new Exception (dgettext("domframework", "No Field defined"), 500);
throw new \Exception (dgettext ("domframework", "No Field defined"), 500);
if ($this->table === null)
throw new \Exception (dgettext ("domframework",
"No table name defined to create the table"), 500);
@@ -1098,7 +1102,7 @@ class dblayer
$sql .= "$this->sep$field$this->sep ";
// Type of field : in $params[0]
if (!isset ($params[0]))
throw new Exception (sprintf (
throw new \Exception (sprintf (
dgettext ("domframework",
"No database type defined for field '%s'"),
$field), 500);
@@ -1111,7 +1115,7 @@ class dblayer
break;
case "varchar":
if (!isset ($params[1]))
throw new Exception (sprintf (dgettext("domframework",
throw new \Exception (sprintf (dgettext ("domframework",
"No Size provided for varchar field '%s'"),
$field), 500);
$sql .= "VARCHAR(".$params[1].")";
@@ -1126,7 +1130,7 @@ class dblayer
$params = array_slice ($params, 1);
break;
default:
throw new Exception (sprintf (
throw new \Exception (sprintf (
dgettext ("domframework",
"Unknown type '%s' provided for field '%s'"),
$params[0], $field), 500);
@@ -1145,7 +1149,7 @@ class dblayer
case "not null": $sql .= " NOT NULL"; break;
case "autoincrement": $sql .= " AUTOINCREMENT";break;
default:
throw new Exception (sprintf (dgettext("domframework",
throw new \Exception (sprintf (dgettext ("domframework",
"Unknown additionnal parameter for field '%s'"),
$field), 500);
}
@@ -1156,7 +1160,7 @@ class dblayer
if ($this->unique !== null)
{
if (!is_array ($this->unique))
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"The Unique field definition is not an array"),
500);
foreach ($this->unique as $u)
@@ -1195,7 +1199,7 @@ class dblayer
$sql .= "$this->sep$field$this->sep ";
// Type of field : in $params[0]
if (!isset ($params[0]))
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"No database type defined for field"), 500);
switch ($params[0])
{
@@ -1205,7 +1209,7 @@ class dblayer
break;
case "varchar":
if (!isset ($params[1]))
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"No Size provided for varchar field"), 500);
$sql .= "VARCHAR(".$params[1].")";
$params = array_slice ($params, 2);
@@ -1219,7 +1223,7 @@ class dblayer
$params = array_slice ($params, 1);
break;
default:
throw new Exception (sprintf (
throw new \Exception (sprintf (
dgettext ("domframework",
"Unknown type provided for field '%s'"),
$field), 500);
@@ -1238,7 +1242,7 @@ class dblayer
case "not null": $sql .= " NOT NULL"; break;
case "autoincrement": $sql .= " AUTO_INCREMENT";break;
default:
throw new Exception (sprintf (
throw new \Exception (sprintf (
dgettext ("domframework",
"Unknown additionnal parameter for field '%s'"),
$field), 500);
@@ -1290,7 +1294,7 @@ class dblayer
{
// Type of field : in $params[0]
if (!isset ($params[0]))
throw new Exception (sprintf (
throw new \Exception (sprintf (
dgettext ("domframework",
"No database type defined for field '%s'"),
$field), 500);
@@ -1302,7 +1306,7 @@ class dblayer
break;
case "varchar":
if (!isset ($params[1]))
throw new Exception (sprintf (
throw new \Exception (sprintf (
dgettext ("domframework",
"No Size provided for varchar field '%s'"),
$field), 500);
@@ -1318,7 +1322,7 @@ class dblayer
$params = array_slice ($params, 1);
break;
default:
throw new Exception (sprintf (
throw new \Exception (sprintf (
dgettext ("domframework",
"Unknown type provided for field '%s'"),
$field), 500);
@@ -1336,7 +1340,7 @@ class dblayer
{
case "not null": $sql .= " NOT NULL"; break;
default:
throw new Exception (sprintf (
throw new \Exception (sprintf (
dgettext ("domframework",
"Unknown additionnal parameter for field '%s'"),
$field), 500);
@@ -1373,7 +1377,7 @@ class dblayer
$sql .=")";
break;
default:
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"PDO Engine not supported in dbLayer"), 500);
}

View File

@@ -97,9 +97,8 @@ class fts
foreach ($fields as $field)
{
if (! array_key_exists ($field, $dbl->fields ()))
throw new \Exception (sprintf (
dgettext("domframework", "The field '%s' doesn't exists in database"),
$field), 500);
throw new \Exception (sprintf (dgettext ("domframework",
"The field '%s' doesn't exists in database"), $field), 500);
if ($i > 0)
$dbl->whereAddOR ();
$dbl->whereAddParenthesisOpen ();

View File

@@ -474,11 +474,11 @@ class ipaddresses
public function ipInNetwork ($ip, $network, $cidr)
{
if ($this->validIPAddress ($ip) === false)
throw new \Excpetion (dgettext("domframework", "Invalid IP address"),
throw new \Exception (dgettext ("domframework", "Invalid IP address"),
500);
if ($this->validIPAddress ($network) === false)
throw new \Excpetion (dgettext("domframework", "Invalid Network address"),
500);
throw new \Exception (dgettext ("domframework",
"Invalid Network address"), 500);
$ipv4 = $this->validIPv4Address ($ip);
$networkv4 = $this->validIPv4Address ($network);
if ($ipv4 !== $networkv4)

View File

@@ -148,7 +148,8 @@ class mail
private function sectionUpdate ($sectionID, $param)
{
if (! array_key_exists ($sectionID, $this->sections))
throw new \Exception (dgettext("domframework", "Section not found"), 404);
throw new \Exception (dgettext ("domframework", "Section not found"),
404);
if (! is_array ($param))
throw new \Exception (dgettext ("domframework",
"Param provided to sectionUpdate is not array"), 406);

View File

@@ -344,24 +344,24 @@ $content .= "</li>\n";
TRUE)
{
if ($this->authREST["email"] === "anonymous")
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Access forbidden"), 403);
}
$this->chained->connect();
// $chainedValues are the information associated to the $chain
$chainedValues = $this->chained->keyexists ($chain);
if ($chainedValues === false)
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Object not found"), 404);
}
if ($this->accessright ($this->authREST["email"]) !== TRUE)
{
if ($this->authREST["email"] === "anonymous")
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Access forbidden"), 403);
}
@@ -372,7 +372,7 @@ $content .= "</li>\n";
if (!isset ($extension) || $extension === null || $extension === "")
$extension = reset ($this->extensionsAllowed);
if (!in_array ($extension, $this->extensionsAllowed))
throw new Exception (dgettext("domframework","Extension not allowed"),
throw new \Exception (dgettext ("domframework","Extension not allowed"),
403);
$search = rawurldecode ($search);
$this->connect();
@@ -423,9 +423,9 @@ $content .= "</li>\n";
TRUE)
{
if ($this->authREST["email"] === "anonymous")
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new Exception (dgettext("domframework","Access forbidden"),
throw new \Exception (dgettext ("domframework","Access forbidden"),
403);
}
$this->chained->connect();
@@ -438,24 +438,27 @@ $content .= "</li>\n";
if ($this->accessright ($this->authREST["email"]) !== TRUE)
{
if ($this->authREST["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->editright ($this->authREST["email"]) !== TRUE)
{
if ($this->authREST["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->readonly ($this->authREST["email"]) === TRUE)
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
if (!isset ($extension) || $extension === null || $extension === "")
$extension = reset ($this->extensionsAllowed);
if (!in_array ($extension, $this->extensionsAllowed))
throw new Exception (dgettext("domframework","Extension not allowed"),
403);
throw new \Exception (dgettext ("domframework",
"Extension not allowed"), 403);
$this->connect();
$values = $_POST;
$errorsChain = array ();
@@ -476,7 +479,7 @@ $content .= "</li>\n";
$this->objectDB->insert ($values);
$this->renderrest ($extension, "OK", 200);
}
catch (Exception $e)
catch (\Exception $e)
{
$this->renderrest ($extension, $e->getMessage(), 400);
}
@@ -491,9 +494,9 @@ $content .= "</li>\n";
TRUE)
{
if ($this->authREST["email"] === "anonymous")
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new Exception (dgettext("domframework","Access forbidden"),
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
$this->chained->connect();
@@ -506,24 +509,27 @@ $content .= "</li>\n";
if ($this->accessright ($this->authREST["email"]) !== TRUE)
{
if ($this->authREST["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->editright ($this->authREST["email"]) !== TRUE)
{
if ($this->authREST["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->readonly ($this->authREST["email"]) === TRUE)
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
if (!isset ($extension) || $extension === null || $extension === "")
$extension = reset ($this->extensionsAllowed);
if (!in_array ($extension, $this->extensionsAllowed))
throw new Exception (dgettext("domframework","Extension not allowed"),
403);
throw new \Exception (dgettext ("domframework",
"Extension not allowed"), 403);
$this->connect();
parse_str (file_get_contents ("php://input"), $values);
$errorsChain = array ();
@@ -542,7 +548,7 @@ $content .= "</li>\n";
$this->objectDB->update ($id, $values);
$this->renderrest ($extension, "OK", 200);
}
catch (Exception $e)
catch (\Exception $e)
{
$this->renderrest ($extension, $e->getMessage(), 400);
}
@@ -557,46 +563,49 @@ $content .= "</li>\n";
TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new Exception (dgettext("domframework","Access forbidden"),
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
$this->chained->connect();
// $chainedValues are the information associated to the $chain
$chainedValues = $this->chained->keyexists ($chain);
if ($chainedValues === false)
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Object not found"), 404);
}
if ($this->accessright ($this->authREST["email"]) !== TRUE)
{
if ($this->authREST["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->editright ($this->authREST["email"]) !== TRUE)
{
if ($this->authREST["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->readonly ($this->authREST["email"]) === TRUE)
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
if (!isset ($extension) || $extension === null || $extension === "")
$extension = reset ($this->extensionsAllowed);
if (!in_array ($extension, $this->extensionsAllowed))
throw new Exception (dgettext("domframework","Extension not allowed"),
403);
throw new \Exception (dgettext ("domframework",
"Extension not allowed"), 403);
$this->connect();
try
{
$this->objectDB->delete ($id);
$this->renderrest ($extension, "OK", 200);
}
catch (Exception $e)
catch (\Exception $e)
{
$this->renderrest ($extension, $e->getMessage(), 400);
}
@@ -610,8 +619,8 @@ $content .= "</li>\n";
if ($this->chained !== null)
{
if (strpos ($this->chained->url_prefix, "/{chain}/") !== false)
throw new Exception ("Chained can not have an already chained object",
500);
throw new \Exception (dgettext ("domframework",
"Chained can not have an already chained object"), 500);
$this->url_prefix = $this->chained->url_prefix."/{chain}/".
$this->url_prefix;
}
@@ -636,24 +645,24 @@ $content .= "</li>\n";
TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Access forbidden"), 403);
}
$this->chained->connect();
// $chainedValues are the information associated to the $chain
$chainedValues = $this->chained->keyexists ($chain);
if ($chainedValues === false)
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Object not found"), 404);
}
if ($this->accessright ($this->authHTML["email"]) !== TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Access forbidden"), 403);
}
@@ -741,9 +750,9 @@ $content .= "</li>\n";
foreach ($this->objectDB->foreign as $foreign=>$params)
{
if (! isset ($params[0]))
throw new Exception ("Undefined foreign key", 500);
throw new \Exception ("Undefined foreign key", 500);
if (! isset ($params[1]))
throw new Exception ("Undefined foreign key column", 500);
throw new \Exception ("Undefined foreign key column", 500);
$class = $params[0];
$column = $params[1];
require_once ("models/model_$class.php");
@@ -990,12 +999,14 @@ $content .= "</li>\n";
$content .= " <tr>\n";
if ($this->readwriteAllowed && $this->displayActions &&
$this->actionsAtEnd === false)
$content .= " <th>".dgettext("domframework","Actions")."</th>\n";
$content .= " <th>".dgettext ("domframework", "Actions").
"</th>\n";
foreach ($titles as $title)
$content .= " <th>".htmlentities ($title)."</th>\n";
if ($this->readwriteAllowed && $this->displayActions &&
$this->actionsAtEnd !== false)
$content .= " <th>".dgettext("domframework","Actions")."</th>\n";
$content .= " <th>".dgettext ("domframework", "Actions").
"</th>\n";
$content .= " </tr>\n";
$content .= " </thead>\n";
$content .= " <tbody>\n";
@@ -1044,7 +1055,7 @@ $content .= "</li>\n";
foreach ($this->internalLinks as $linkData)
{
if (! isset ($linkData["linkname"]))
throw new Exception ("No linkname defined !", 500);
throw new \Exception ("No linkname defined !", 500);
$content .= " <a href='".$route->baseURL().$this->url_prefix."/".
$line[$this->objectDB->primary]."/".
$linkData["linkname"]."'>";
@@ -1097,34 +1108,37 @@ $content .= "</li>\n";
TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new Exception (dgettext("domframework","Access forbidden"),
throw new \Exception (dgettext ("domframework","Access forbidden"),
403);
}
$this->chained->connect();
// $chainedValues are the information associated to the $chain
$chainedValues = $this->chained->keyexists ($chain);
if ($chainedValues === false)
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Object not found"), 404);
}
if ($this->accessright ($this->authHTML["email"], $id) !== TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->editright ($this->authHTML["email"], $id) !== TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->readonly ($this->authHTML["email"], $id) === TRUE)
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
$this->connect();
$csrf = new csrf ();
@@ -1138,7 +1152,7 @@ $content .= "</li>\n";
str_replace ("{chain}", $chain, $this->url_prefix),
"");
}
catch (Exception $e)
catch (\Exception $e)
{
$renderer->flash ("ERROR", $e->getMessage());
$route->redirect ("/".
@@ -1158,34 +1172,37 @@ $content .= "</li>\n";
TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new Exception (dgettext("domframework","Access forbidden"),
throw new \Exception (dgettext ("domframework","Access forbidden"),
403);
}
$this->chained->connect();
// $chainedValues are the information associated to the $chain
$chainedValues = $this->chained->keyexists ($chain);
if ($chainedValues === false)
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Object not found"), 404);
}
if ($this->accessright ($this->authHTML["email"]) !== TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->editright ($this->authHTML["email"]) !== TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->readonly ($this->authHTML["email"]) === TRUE)
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
$this->connect();
@@ -1197,9 +1214,9 @@ $content .= "</li>\n";
foreach ($this->objectDB->foreign as $foreign=>$params)
{
if (! isset ($params[0]))
throw new Exception ("Undefined foreign key", 500);
throw new \Exception ("Undefined foreign key", 500);
if (! isset ($params[1]))
throw new Exception ("Undefined foreign key column", 500);
throw new \Exception ("Undefined foreign key column", 500);
$class = $params[0];
$column = $params[1];
require_once ("models/model_$class.php");
@@ -1346,7 +1363,7 @@ $content .= "</li>\n";
{
$field = new formfield ($key, $val);
if (! isset ($this->objectDB->fields[$key]))
throw new Exception (sprintf (dgettext("domframework",
throw new \Exception (sprintf (dgettext ("domframework",
"Field '%s' (defined in titles) not found in fields"),
$key), 500);
if (in_array ("not null", $this->objectDB->fields[$key]))
@@ -1389,9 +1406,9 @@ $content .= "</li>\n";
TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new Exception (dgettext("domframework","Access forbidden"),
throw new \Exception (dgettext ("domframework","Access forbidden"),
403);
}
$this->chained->connect();
@@ -1404,19 +1421,22 @@ $content .= "</li>\n";
if ($this->accessright ($this->authHTML["email"]) !== TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->editright ($this->authHTML["email"]) !== TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->readonly ($this->authHTML["email"]) === TRUE)
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
$this->connect();
$f = new form ();
@@ -1441,7 +1461,7 @@ $content .= "</li>\n";
str_replace ("{chain}", $chain, $this->url_prefix),
"");
}
catch (Exception $e)
catch (\Exception $e)
{
$renderer = new renderer ();
$renderer->flash ("ERROR", $e->getMessage ());
@@ -1471,9 +1491,9 @@ $content .= "</li>\n";
TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new Exception (dgettext("domframework","Access forbidden"),
throw new \Exception (dgettext ("domframework","Access forbidden"),
403);
}
$this->chained->connect();
@@ -1486,9 +1506,10 @@ $content .= "</li>\n";
if ($this->accessright ($this->authHTML["email"], $id) !== TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->chained !== null &&
$this->chained->editright ($this->authHTML["email"], $chain) !== true)
@@ -1507,9 +1528,9 @@ $content .= "</li>\n";
foreach ($this->objectDB->foreign as $foreign=>$params)
{
if (! isset ($params[0]))
throw new Exception ("Undefined foreign key", 500);
throw new \Exception ("Undefined foreign key", 500);
if (! isset ($params[1]))
throw new Exception ("Undefined foreign key column", 500);
throw new \Exception ("Undefined foreign key column", 500);
$class = $params[0];
$column = $params[1];
require_once ("models/model_$class.php");
@@ -1538,7 +1559,8 @@ $content .= "</li>\n";
$values = $this->objectDB->read (array (array ($this->objectDB->primary,
$id)));
if (count ($values) === 0)
throw new Exception (dgettext("domframework", "Object not found"), 404);
throw new \Exception (dgettext ("domframework", "Object not found"),
404);
$values = $values[0];
if (isset ($_SESSION["domframework"]["routeSQL"]["errors"]))
{
@@ -1660,7 +1682,7 @@ $content .= "</li>\n";
{
$field = new formfield ($key, $val);
if (! isset ($this->objectDB->fields[$key]))
throw new Exception (sprintf (dgettext("domframework",
throw new \Exception (sprintf (dgettext ("domframework",
"Field '%s' (defined in titles) not found in fields"),
$key), 500);
if (in_array ("not null", $this->objectDB->fields[$key]))
@@ -1709,9 +1731,9 @@ $content .= "</li>\n";
TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new Exception (dgettext("domframework","Access forbidden"),
throw new \Exception (dgettext ("domframework","Access forbidden"),
403);
}
$this->chained->connect();
@@ -1724,30 +1746,34 @@ $content .= "</li>\n";
if ($this->accessright ($this->authHTML["email"], $id) !== TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->editright ($this->authHTML["email"], $id) !== TRUE)
{
if ($this->authHTML["email"] === "anonymous")
throw new Exception (dgettext("domframework","Anonymous not allowed"),
401);
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework",
"Anonymous not allowed"), 401);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
}
if ($this->readonly ($this->authHTML["email"], $id) === TRUE)
throw new Exception (dgettext("domframework","Access forbidden"), 403);
throw new \Exception (dgettext ("domframework", "Access forbidden"),
403);
$this->connect();
$oldvalues = $this->objectDB->read (array (array
($this->objectDB->primary, $id)));
if (count ($oldvalues) === 0)
throw new Exception (dgettext("domframework", "Object not found"), 404);
throw new \Exception (dgettext ("domframework", "Object not found"),
404);
$oldvalues = $oldvalues[0];
$f = new form ();
$values = $f->values ();
if ($values[$this->objectDB->primary] !== $id)
throw new Exception (dgettext("domframework",
throw new \Exception (dgettext ("domframework",
"Can not change the primary key"), 403);
$errorsChain = array ();
if ($this->chainedForeign !== null &&
@@ -1770,7 +1796,7 @@ $content .= "</li>\n";
str_replace ("{chain}", $chain, $this->url_prefix),
"");
}
catch (Exception $e)
catch (\Exception $e)
{
$renderer = new renderer ();
$renderer->flash ("ERROR", $e->getMessage ());