\n";
@@ -312,7 +312,7 @@ $content .= "\n";
{
$content = "";
$content .= "
\n";
- $message = dgettext("domframework",
+ $message = dgettext ("domframework",
"Display the element {FIRST} to {LAST} on {COUNT} elements");
if ($nbentries === 0)
$message = str_replace ("{FIRST}", 0, $message);
@@ -344,24 +344,24 @@ $content .= "\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 .= "\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,39 +423,42 @@ $content .= "\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();
// $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();
$values = $_POST;
$errorsChain = array ();
@@ -463,7 +466,7 @@ $content .= "\n";
isset ($values[$this->chainedForeign]) &&
$values[$this->chainedForeign] !== $chain)
$errorsChain[$this->chainedForeign] =
- array ("error", dgettext("domframework",
+ array ("error", dgettext ("domframework",
"Can not change the external key"));
if ($this->chainedForeign !== null)
$values[$this->chainedForeign] = $chain;
@@ -476,7 +479,7 @@ $content .= "\n";
$this->objectDB->insert ($values);
$this->renderrest ($extension, "OK", 200);
}
- catch (Exception $e)
+ catch (\Exception $e)
{
$this->renderrest ($extension, $e->getMessage(), 400);
}
@@ -491,39 +494,42 @@ $content .= "\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();
// $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();
parse_str (file_get_contents ("php://input"), $values);
$errorsChain = array ();
@@ -531,7 +537,7 @@ $content .= "\n";
isset ($values[$this->chainedForeign]) &&
$values[$this->chainedForeign] !== $chain)
$errorsChain[$this->chainedForeign] =
- array ("error", dgettext("domframework",
+ array ("error", dgettext ("domframework",
"Can not change the external key"));
$errors = $this->objectDB->verify ($values, $id);
if (count ($errors) > 0 || count ($errorsChain) > 0)
@@ -542,7 +548,7 @@ $content .= "\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 .= "\n";
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);
}
$this->chained->connect();
// $chainedValues are the information associated to the $chain
$chainedValues = $this->chained->keyexists ($chain);
if ($chainedValues === false)
- throw new Exception (dgettext("domframework",
- "Object not found"), 404);
+ 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 .= "\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,25 +645,25 @@ $content .= "\n";
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);
}
$this->chained->connect();
// $chainedValues are the information associated to the $chain
$chainedValues = $this->chained->keyexists ($chain);
if ($chainedValues === false)
- throw new Exception (dgettext("domframework",
- "Object not found"), 404);
+ 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->chained !== null &&
@@ -741,9 +750,9 @@ $content .= "\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 .= "\n";
$content .= "
\n";
if ($this->readwriteAllowed && $this->displayActions &&
$this->actionsAtEnd === false)
- $content .= " | ".dgettext("domframework","Actions")." | \n";
+ $content .= " ".dgettext ("domframework", "Actions").
+ " | \n";
foreach ($titles as $title)
$content .= " ".htmlentities ($title)." | \n";
if ($this->readwriteAllowed && $this->displayActions &&
$this->actionsAtEnd !== false)
- $content .= " ".dgettext("domframework","Actions")." | \n";
+ $content .= " ".dgettext ("domframework", "Actions").
+ " | \n";
$content .= "
\n";
$content .= " \n";
$content .= "
\n";
@@ -1006,7 +1017,7 @@ $content .= "\n";
if ($this->readwriteAllowed && $this->displayActions)
$countTitles++;
$content .= " | ";
- $content .= dgettext("domframework","No entry available");
+ $content .= dgettext ("domframework","No entry available");
$content .= " |
\n";
}
else
@@ -1038,13 +1049,13 @@ $content .= "\n";
$line[$this->objectDB->primary]."/delete/$token'";
if ($this->deleteConfirm)
$content .= " onclick=\"return confirm('".
- dgettext("domframework",
+ dgettext ("domframework",
"Are you sure to delete this entry?")."')\"";
$content .= " class='delete'>".$this->textDelete."";
foreach ($this->internalLinks as $linkData)
{
if (! isset ($linkData["linkname"]))
- throw new Exception ("No linkname defined !", 500);
+ throw new \Exception ("No linkname defined !", 500);
$content .= " ";
@@ -1097,34 +1108,37 @@ $content .= "\n";
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);
}
$this->chained->connect();
// $chainedValues are the information associated to the $chain
$chainedValues = $this->chained->keyexists ($chain);
if ($chainedValues === false)
- throw new Exception (dgettext("domframework",
- "Object not found"), 404);
+ 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 .= "\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 .= "\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 .= "\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 .= "\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]))
@@ -1369,9 +1386,9 @@ $content .= "\n";
unset ($field);
}
- $field = new formfield ("submit", dgettext("domframework",
+ $field = new formfield ("submit", dgettext ("domframework",
"Save the data"));
- $field->defaults = dgettext("domframework","Save the data");
+ $field->defaults = dgettext ("domframework","Save the data");
$field->type = "submit";
$fields[] = $field;
unset ($field);
@@ -1389,34 +1406,37 @@ $content .= "\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();
$f = new form ();
@@ -1426,7 +1446,7 @@ $content .= "\n";
isset ($values[$this->chainedForeign]) &&
$values[$this->chainedForeign] !== $chain)
$errorsChain[$this->chainedForeign] =
- array ("error", dgettext("domframework",
+ array ("error", dgettext ("domframework",
"Can not change the external key"));
$errors = $this->objectDB->verify ($values);
if (count ($errors) == 0 && count ($errorsChain) == 0)
@@ -1435,13 +1455,13 @@ $content .= "\n";
{
$this->objectDB->insert ($values);
$renderer = new renderer ();
- $renderer->flash ("SUCCESS", dgettext("domframework",
+ $renderer->flash ("SUCCESS", dgettext ("domframework",
"Creation done"));
$route->redirect ("/".
str_replace ("{chain}", $chain, $this->url_prefix),
"");
}
- catch (Exception $e)
+ catch (\Exception $e)
{
$renderer = new renderer ();
$renderer->flash ("ERROR", $e->getMessage ());
@@ -1471,24 +1491,25 @@ $content .= "\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->chained !== null &&
$this->chained->editright ($this->authHTML["email"], $chain) !== true)
@@ -1507,9 +1528,9 @@ $content .= "\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 .= "\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 .= "\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]))
@@ -1687,9 +1709,9 @@ $content .= "\n";
if ($readonly === false && $this->readwriteAllowed === true)
{
- $field = new formfield ("submit", dgettext("domframework",
+ $field = new formfield ("submit", dgettext ("domframework",
"Save the data"));
- $field->defaults = dgettext("domframework","Save the data");
+ $field->defaults = dgettext ("domframework","Save the data");
$field->type = "submit";
$fields[] = $field;
unset ($field);
@@ -1709,52 +1731,56 @@ $content .= "\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();
$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",
- "Can not change the primary key"), 403);
+ throw new \Exception (dgettext ("domframework",
+ "Can not change the primary key"), 403);
$errorsChain = array ();
if ($this->chainedForeign !== null &&
isset ($values[$this->chainedForeign]) &&
$values[$this->chainedForeign] !== $chain)
$errorsChain[$this->chainedForeign] =
- array ("error", dgettext("domframework",
+ array ("error", dgettext ("domframework",
"Can not change the external key"));
if ($this->chainedForeign !== null)
$values[$this->chainedForeign] = $chain;
@@ -1765,12 +1791,12 @@ $content .= "\n";
{
$this->objectDB->update ($id, $values);
$renderer = new renderer ();
- $renderer->flash ("SUCCESS", dgettext("domframework","Update done"));
+ $renderer->flash ("SUCCESS", dgettext ("domframework","Update done"));
$route->redirect ("/".
str_replace ("{chain}", $chain, $this->url_prefix),
"");
}
- catch (Exception $e)
+ catch (\Exception $e)
{
$renderer = new renderer ();
$renderer->flash ("ERROR", $e->getMessage ());
diff --git a/smtp.php b/smtp.php
index bdd10d9..45b64d2 100644
--- a/smtp.php
+++ b/smtp.php
@@ -79,7 +79,7 @@ class smtp
{
if ($errstr === "" && $php_errormsg !== "")
$errstr = $php_errormsg;
- throw new \Exception (sprintf (dgettext("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Can't connect to SMTP server : %s"), $errstr), 500);
}
stream_set_timeout ($this->smtpStream, $this->timeout);
@@ -103,14 +103,14 @@ class smtp
if (@stream_socket_enable_crypto ($this->smtpStream, true,
STREAM_CRYPTO_METHOD_TLS_CLIENT) ===
false)
- throw new \Exception (sprintf (dgettext("domframework",
+ throw new \Exception (sprintf (dgettext ("domframework",
"Can't activate STARTTLS %s"), strstr ($php_errormsg, ": ")), 500);
ini_set('track_errors', 0);
$this->debug ("STARTTLS ACTIVATED\n");
}
}
elseif ($this->starttls === "encrypt")
- throw new \Exception (dgettext("domframework",
+ throw new \Exception (dgettext ("domframework",
"Server doesn't supports STARTTLS"), 500);
if ($this->user !== null && $this->password !== null)
@@ -133,7 +133,7 @@ class smtp
}
else
throw new \Exception (
- dgettext("domframework",
+ dgettext ("domframework",
"No authentication method available for the server"), 500);
}
}
@@ -169,7 +169,7 @@ class smtp
{
if ($this->smtpStream === null)
throw new \Exception (
- dgettext("domframework",
+ dgettext ("domframework",
"Can't send email : not connected to SMTP server"), 500);
$from = $this->cleanMail ($from);
if (is_string ($to))
@@ -199,7 +199,7 @@ class smtp
{
if ($this->smtpStream === null)
throw new \Exception (
- dgettext("domframework",
+ dgettext ("domframework",
"Can't send email : not connected to SMTP server"), 500);
$this->putLine ("QUIT\r\n");
fclose ($this->smtpStream);
@@ -211,7 +211,7 @@ class smtp
{
if ($this->smtpStream === null)
throw new \Exception (
- dgettext("domframework",
+ dgettext ("domframework",
"Can't send email : not connected to SMTP server"), 500);
$this->putLine ("RSET\r\n");
}
diff --git a/users.php b/users.php
index d508957..b3427a0 100644
--- a/users.php
+++ b/users.php
@@ -87,15 +87,15 @@ class users
public function checkEmail ($email)
{
if (! is_string ($email))
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"Invalid email provided : not a string"),
500);
if (strlen ($email) < 5)
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"Invalid email provided : too short"),
500);
if (strpos ($email, ":") !== false)
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"Invalid email provided : colon forbidden"),
500);
return true;
@@ -107,15 +107,15 @@ class users
public function checkFirstname ($firstname)
{
if (! is_string ($firstname))
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"Invalid firstname provided : not a string"),
500);
if (strlen ($firstname) < 1)
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"Invalid firstname provided : too short"),
500);
if (strpos ($firstname, ":") !== false)
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"Invalid firstname provided : colon forbidden"),
500);
return true;
@@ -127,11 +127,11 @@ class users
public function checkLastname ($lastname)
{
if (! is_string ($lastname))
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"Invalid lastname provided : not a string"),
500);
if (strpos ($lastname, ":") !== false)
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"Invalid lastname provided : colon forbidden"),
500);
return true;
@@ -143,15 +143,15 @@ class users
public function checkPassword ($password)
{
if (! is_string ($password))
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"Invalid password provided : not a string"),
500);
if (strlen ($password) < 5)
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"Invalid password provided : too short"),
500);
if (strlen ($password) >= 128)
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"Invalid password provided : too long"),
500);
return true;
@@ -163,7 +163,7 @@ class users
public function cryptPasswd ($password)
{
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);
$cost = 11;
diff --git a/userssql.php b/userssql.php
index 525d148..7cd8055 100644
--- a/userssql.php
+++ b/userssql.php
@@ -57,22 +57,22 @@ class userssql extends users
public function connect ()
{
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->fieldEmail === 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);
if ($this->fieldLastchange === null)
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"No fieldLastchange defined"), 500);
$this->db = new dblayer ($this->dsn, $this->username, $this->password,
$this->driver_options);
@@ -177,7 +177,7 @@ class userssql extends users
$this->checkPassword ($oldpassword);
$this->checkPassword ($newpassword);
if ($this->checkValidPassword ($email, $oldpassword) !== true)
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"Bad old password provided"), 401);
$cryptedPassword = $this->cryptPasswd ($newpassword);
return $this->db->update ($email,
@@ -200,7 +200,7 @@ class userssql extends users
$data = $this->db->read (array (array ($this->fieldEmail, $email)),
array ($this->fieldPassword));
if (count ($data) === 0)
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"No information found for this email"), 404);
$cryptedPassword = $this->cryptPasswd ($newpassword);
return $this->db->update ($email,
@@ -222,10 +222,10 @@ class userssql extends users
$data = $this->db->read (array (array ($this->fieldEmail, $email)),
array ($this->fieldPassword));
if (count ($data) === 0)
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"No information found for this email"), 404);
if (! isset ($data[0][$this->fieldPassword]))
- throw new Exception (dgettext("domframework",
+ throw new Exception (dgettext ("domframework",
"No password available for this email"), 404);
$cryptedPassword = $data[0][$this->fieldPassword];
if (crypt ($password, $cryptedPassword) !== $cryptedPassword)