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

@@ -146,13 +146,13 @@ class routeSQL
switch ($flash[0])
{
case 4: $dataflash .= "alert-danger";
$alert = dgettext("domframework","Error!");break;
$alert = dgettext ("domframework","Error!");break;
case 3: $dataflash .= "alert-warning";
$alert = dgettext("domframework","Warning!");break;
$alert = dgettext ("domframework","Warning!");break;
case 2: $dataflash .= "alert-info";
$alert = dgettext("domframework","Info:");break;
$alert = dgettext ("domframework","Info:");break;
case 1: $dataflash .= "alert-success";
$alert = dgettext("domframework","Success:");break;
$alert = dgettext ("domframework","Success:");break;
}
$dataflash .= " alert-dismissable'>\n";
$dataflash .= "<strong>$alert</strong> ".$flash[1]."\n";
@@ -246,7 +246,7 @@ $content .= "</li>\n";
$route = new route ();
$content .= " <div class='actionExtern'>\n";
$content .= " <a href='".$route->baseURL().$this->url_prefix."/add'>"
.dgettext("domframework","Add new entry")."</a>\n";
.dgettext ("domframework","Add new entry")."</a>\n";
$content .= " </div>\n";
}
return $content;
@@ -275,7 +275,7 @@ $content .= "</li>\n";
$content .= ">$element</option>\n";
}
$content .= " </select>\n";
$content .= " ".dgettext("domframework","elements")."\n";
$content .= " ".dgettext ("domframework","elements")."\n";
$content .= " </form>\n";
$content .= " </div>\n";
return $content;
@@ -294,7 +294,7 @@ $content .= "</li>\n";
$content .= " <div class='searchArea'>\n";
$content .= " <form method='get' action='".$route->baseURL().
$this->url_prefix."'>\n";
$content .= " ".dgettext("domframework","Search:");
$content .= " ".dgettext ("domframework","Search:");
$content .= " <input type='text' name='search' value='".
htmlentities ($search, ENT_QUOTES)."'/>\n";
$content .= " </form>\n";
@@ -312,7 +312,7 @@ $content .= "</li>\n";
{
$content = "";
$content .= " <div class='informationArea'>\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 .= "</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,39 +423,42 @@ $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();
// $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 .= "</li>\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 .= "</li>\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 .= "</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();
// $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 .= "</li>\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 .= "</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",
"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 .= "</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,25 +645,25 @@ $content .= "</li>\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 .= "</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";
@@ -1006,7 +1017,7 @@ $content .= "</li>\n";
if ($this->readwriteAllowed && $this->displayActions)
$countTitles++;
$content .= " <tr><td colspan='$countTitles' class='noentry'>";
$content .= dgettext("domframework","No entry available");
$content .= dgettext ("domframework","No entry available");
$content .= "</td></tr>\n";
}
else
@@ -1038,13 +1049,13 @@ $content .= "</li>\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."</a>";
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",
"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 .= "</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]))
@@ -1369,9 +1386,9 @@ $content .= "</li>\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 .= "</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();
$f = new form ();
@@ -1426,7 +1446,7 @@ $content .= "</li>\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 .= "</li>\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 .= "</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->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]))
@@ -1687,9 +1709,9 @@ $content .= "</li>\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 .= "</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();
$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 .= "</li>\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 ());