";
$res .= " \n";
@@ -73,7 +78,8 @@ class auth
/** Establish the connection to authentication server */
public function connect ()
{
- throw new Exception (_("No connect to authentication available"), 405);
+ throw new Exception (dgettext("domframework",
+ "No connect to authentication available"), 405);
}
/** Check if the email and password are correct
@@ -83,13 +89,15 @@ class auth
@param string $password Password to authenticate */
public function authentication ($email, $password)
{
- throw new exception (_("No authentication available"), 405);
+ throw new exception (dgettext("domframework",
+ "No authentication available"), 405);
}
/** Return all the parameters recorded for the authenticate user */
public function getdetails ()
{
- throw new exception (_("No getdetails available"), 405);
+ throw new exception (dgettext("domframework",
+ "No getdetails available"), 405);
}
/** Method to change the password
@@ -98,13 +106,15 @@ class auth
@param string $newpassword The new password to be recorded */
public function changepassword ($oldpassword, $newpassword)
{
- throw new exception (_("No password change available"), 405);
+ throw new exception (dgettext("domframework",
+ "No password change available"), 405);
}
/** List all the users available in the database
Return firstname, lastname, mail, with mail is an array */
public function listusers ()
{
- throw new exception (_("No List User available"), 405);
+ throw new exception (dgettext("domframework",
+ "No List User available"), 405);
}
}
diff --git a/authldap.php b/authldap.php
index bc3ac03..7c652fa 100644
--- a/authldap.php
+++ b/authldap.php
@@ -101,7 +101,8 @@ class authldap extends auth
@param string $newpassword The new password to be recorded */
public function changepassword ($oldpassword, $newpassword)
{
- throw new Exception (_("The password can't be change for LDAP users"), 405);
+ throw new Exception (dgettext("domframework",
+ "The password can't be change for LDAP users"), 405);
}
/** List all the users available in the database
diff --git a/authorizationdb.php b/authorizationdb.php
index 2b46052..c9b1fdb 100644
--- a/authorizationdb.php
+++ b/authorizationdb.php
@@ -44,7 +44,8 @@ class authorizationdb extends authorization
public function initialize ()
{
if ($this->db === null)
- throw new Exception (_("Database to authorize is not connected"), 500);
+ throw new Exception (dgettext("domframework",
+ "Database to authorize is not connected"), 500);
$tables = $this->db->listTables ();
if (!in_array ($this->db->tableprefix.$this->db->table, $tables))
{
@@ -62,14 +63,17 @@ class authorizationdb extends authorization
public function validate ($object)
{
if ($this->db === null)
- throw new Exception (_("Database to authorize is not connected"), 500);
+ throw new Exception (dgettext("domframework",
+ "Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (_("Object don't start by slash"), 406);
+ throw new Exception (dgettext("domframework",
+ "Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (_("Not authenticated"), 401);
+ throw new Exception (dgettext("domframework",
+ "Not authenticated"), 401);
try
{
$this->treecheckExecute ($object);
@@ -83,7 +87,9 @@ class authorizationdb extends authorization
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (_("Object %s doesn't exists"), $object),
+ throw new Exception (sprintf (dgettext("domframework",
+ "Object %s doesn't exists"),
+ $object),
404);
$search = reset ($search);
$ownerid = intval ($search["ownerid"]);
@@ -134,20 +140,25 @@ class authorizationdb extends authorization
public function add ($object, $ownerid, $groupid, $modbits)
{
if ($this->db === null)
- throw new Exception (_("Database to authorize is not connected"), 500);
+ throw new Exception (dgettext("domframework",
+ "Database to authorize is not connected"), 500);
// The modbits are stored in octal to be more readable
$modbits = decoct ($modbits);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (_("Object don't start by slash"), 406);
+ throw new Exception (dgettext("domframework",
+ "Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (_("Not authenticated"), 401);
+ throw new Exception (dgettext("domframework",
+ "Not authenticated"), 401);
if ($this->authiduser !== 0 && $this->authiduser !== $ownerid)
- throw new Exception (_("Can't create object not owned by myself"), 406);
+ throw new Exception (dgettext("domframework",
+ "Can't create object not owned by myself"), 406);
if ($this->authiduser !== 0 && !in_array ($groupid, $this->authgroups))
- throw new Exception (_("Can't create object with not owned group"), 406);
+ throw new Exception (dgettext("domframework",
+ "Can't create object with not owned group"), 406);
try
{
$this->treecheckExecute ($object);
@@ -161,7 +172,8 @@ class authorizationdb extends authorization
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search))
- throw new Exception (sprintf (_("Object %s already defined"), $object),
+ throw new Exception (sprintf (dgettext("domframework",
+ "Object %s already defined"), $object),
400);
// All the folder structure is accessible. Check if we can add the file in
@@ -197,16 +209,20 @@ class authorizationdb extends authorization
public function drop ($object)
{
if ($this->db === null)
- throw new Exception (_("Database to authorize is not connected"), 500);
+ throw new Exception (dgettext("domframework",
+ "Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (_("Object don't start by slash"), 406);
+ throw new Exception (dgettext("domframework",
+ "Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (_("Not authenticated"), 401);
+ throw new Exception (dgettext("domframework",
+ "Not authenticated"), 401);
if ($object === "/")
- throw new Exception (_("The root can not be removed"), 406);
+ throw new Exception (dgettext("domframework",
+ "The root can not be removed"), 406);
try
{
$this->treecheckExecute ($object);
@@ -220,8 +236,9 @@ class authorizationdb extends authorization
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (_("Object %s doesn't exists"), $object),
- 400);
+ throw new Exception (sprintf (dgettext("domframework",
+ "Object %s doesn't exists"),
+ $object), 400);
// All the folder structure is accessible. Check if we can remove the file
// in the last folder (Write modbit). Root can always write.
@@ -229,9 +246,11 @@ class authorizationdb extends authorization
{
$rc = $this->db->delete ($object);
if ($rc > 1)
- throw new Exception (_("Removing more than one object"), 406);
+ throw new Exception (dgettext("domframework",
+ "Removing more than one object"), 406);
if ($rc == 0)
- throw new Exception (_("No object removed"), 406);
+ throw new Exception (dgettext("domframework",
+ "No object removed"), 406);
$rc = $this->db->delete ("$object$this->separator%");
return TRUE;
}
@@ -247,9 +266,11 @@ class authorizationdb extends authorization
$rc = $this->db->delete ($object);
if ($rc > 1)
- throw new Exception (_("Removing more than one object"), 406);
+ throw new Exception (dgettext("domframework",
+ "Removing more than one object"), 406);
if ($rc == 0)
- throw new Exception (_("No object removed"), 406);
+ throw new Exception (dgettext("domframework",
+ "No object removed"), 406);
$rc = $this->db->delete ("$object$this->separator%");
return TRUE;
}
@@ -262,16 +283,20 @@ class authorizationdb extends authorization
public function chown ($object, $ownerid)
{
if ($this->db === null)
- throw new Exception (_("Database to authorize is not connected"), 500);
+ throw new Exception (dgettext("domframework",
+ "Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (_("Object don't start by slash"), 406);
+ throw new Exception (dgettext("domframework",
+ "Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (_("Not authenticated"), 401);
+ throw new Exception (dgettext("domframework",
+ "Not authenticated"), 401);
if ($this->authiduser !== 0)
- throw new Exception (_("The chown is reserved to root user"), 405);
+ throw new Exception (dgettext("domframework",
+ "The chown is reserved to root user"), 405);
try
{
$this->treecheckExecute ($object);
@@ -285,7 +310,8 @@ class authorizationdb extends authorization
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (_("Object %s doesn't exists"), $object),
+ throw new Exception (sprintf (dgettext("domframework",
+ "Object %s doesn't exists"), $object),
400);
$search = reset ($search);
$this->db->update ($object, array ("ownerid"=>$ownerid));
@@ -300,18 +326,23 @@ class authorizationdb extends authorization
public function chgrp ($object, $groupid)
{
if ($this->db === null)
- throw new Exception (_("Database to authorize is not connected"), 500);
+ throw new Exception (dgettext("domframework",
+ "Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (_("Object don't start by slash"), 406);
+ throw new Exception (dgettext("domframework",
+ "Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (_("Not authenticated"), 401);
+ throw new Exception (dgettext("domframework",
+ "Not authenticated"), 401);
if ($this->authiduser !== 0 && !in_array ($groupid, $this->authgroups))
- throw new Exception (_("The user must be in the wanted group"), 405);
+ throw new Exception (dgettext("domframework",
+ "The user must be in the wanted group"), 405);
if (!in_array ("WRITE", $this->validate ($object)))
- throw new Exception (sprintf (_("%s is write protected"), $object), 405);
+ throw new Exception (sprintf (dgettext("domframework",
+ "%s is write protected"), $object), 405);
try
{
$this->treecheckExecute ($object);
@@ -325,7 +356,8 @@ class authorizationdb extends authorization
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (_("Object %s doesn't exists"), $object),
+ throw new Exception (sprintf (dgettext("domframework",
+ "Object %s doesn't exists"), $object),
400);
$search = reset ($search);
$this->db->update ($object, array ("groupid"=>$groupid));
@@ -340,16 +372,20 @@ class authorizationdb extends authorization
public function chmod ($object, $mod)
{
if ($this->db === null)
- throw new Exception (_("Database to authorize is not connected"), 500);
+ throw new Exception (dgettext("domframework",
+ "Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (_("Object don't start by slash"), 406);
+ throw new Exception (dgettext("domframework",
+ "Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (_("Not authenticated"), 401);
+ throw new Exception (dgettext("domframework",
+ "Not authenticated"), 401);
if (!in_array ("WRITE", $this->validate ($object)))
- throw new Exception (sprintf (_("%s is write protected"), $object), 405);
+ throw new Exception (sprintf (dgettext("domframework",
+ "%s is write protected"), $object), 405);
try
{
$this->treecheckExecute ($object);
@@ -363,7 +399,8 @@ class authorizationdb extends authorization
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (_("Object %s doesn't exists"), $object),
+ throw new Exception (sprintf (dgettext("domframework",
+ "Object %s doesn't exists"), $object),
400);
$search = reset ($search);
// TODO : Don't update if the user is not the owner of the file
@@ -378,14 +415,17 @@ class authorizationdb extends authorization
public function lsmod ($object)
{
if ($this->db === null)
- throw new Exception (_("Database to authorize is not connected"), 500);
+ throw new Exception (dgettext("domframework",
+ "Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (_("Object don't start by slash"), 406);
+ throw new Exception (dgettext("domframework",
+ "Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (_("Not authenticated"), 401);
+ throw new Exception (dgettext("domframework",
+ "Not authenticated"), 401);
try
{
$this->treecheckExecute ($object);
@@ -399,7 +439,8 @@ class authorizationdb extends authorization
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (_("Object %s doesn't exists"), $object),
+ throw new Exception (sprintf (dgettext("domframework",
+ "Object %s doesn't exists"), $object),
400);
$search = reset ($search);
return octdec ($search["modbits"]);
@@ -412,14 +453,17 @@ class authorizationdb extends authorization
public function lsown ($object)
{
if ($this->db === null)
- throw new Exception (_("Database to authorize is not connected"), 500);
+ throw new Exception (dgettext("domframework",
+ "Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (_("Object don't start by slash"), 406);
+ throw new Exception (dgettext("domframework",
+ "Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (_("Not authenticated"), 401);
+ throw new Exception (dgettext("domframework",
+ "Not authenticated"), 401);
try
{
$this->treecheckExecute ($object);
@@ -433,7 +477,8 @@ class authorizationdb extends authorization
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (_("Object %s doesn't exists"), $object),
+ throw new Exception (sprintf (dgettext("domframework",
+ "Object %s doesn't exists"), $object),
400);
$search = reset ($search);
return intval ($search["ownerid"]);
@@ -446,14 +491,17 @@ class authorizationdb extends authorization
public function lsgrp ($object)
{
if ($this->db === null)
- throw new Exception (_("Database to authorize is not connected"), 500);
+ throw new Exception (dgettext("domframework",
+ "Database to authorize is not connected"), 500);
if (substr ($object, -1) === "/")
$object = substr ($object, 0, -1);
if (substr ($object, 0, 1) !== "/")
- throw new Exception (_("Object don't start by slash"), 406);
+ throw new Exception (dgettext("domframework",
+ "Object don't start by slash"), 406);
$object = preg_replace ("#//+#", "/", $object);
if ($this->authiduser === "")
- throw new Exception (_("Not authenticated"), 401);
+ throw new Exception (dgettext("domframework",
+ "Not authenticated"), 401);
try
{
$this->treecheckExecute ($object);
@@ -467,7 +515,8 @@ class authorizationdb extends authorization
// exists
$search = $this->db->read (array (array ("object", $object)));
if (count ($search) === 0)
- throw new Exception (sprintf (_("Object %s doesn't exists"), $object),
+ throw new Exception (sprintf (dgettext("domframework",
+ "Object %s doesn't exists"), $object),
404);
$search = reset ($search);
return intval ($search["groupid"]);
@@ -482,7 +531,8 @@ class authorizationdb extends authorization
private function treecheckExecute ($object)
{
if ($this->db === null)
- throw new Exception (_("Database to authorize is not connected"), 500);
+ throw new Exception (dgettext("domframework",
+ "Database to authorize is not connected"), 500);
// Search all the parents in an array
$parents = array ();
$par = $object;
@@ -518,7 +568,8 @@ class authorizationdb extends authorization
}
}
if (!$found)
- throw new Exception (sprintf (_("The path %s is not found in database"),
+ throw new Exception (sprintf (dgettext("domframework",
+ "The path %s is not found in database"),
$p), 404);
else
{
@@ -542,7 +593,8 @@ class authorizationdb extends authorization
if (($parentModbits & 0001) === 1)
continue;
- throw new Exception (sprintf (_("No execute rights on %s"), $p), 405);
+ throw new Exception (sprintf (dgettext("domframework",
+ "No execute rights on %s"), $p), 405);
}
}
return TRUE;
@@ -572,6 +624,7 @@ class authorizationdb extends authorization
if (($parentModbits & 0002) === 2)
return TRUE;
- throw new Exception (sprintf (_("No write rights on %s"), $parent), 405);
+ throw new Exception (sprintf (dgettext("domframework",
+ "No write rights on %s"), $parent), 405);
}
}
diff --git a/authparams.php b/authparams.php
index c20b56f..f4b576b 100644
--- a/authparams.php
+++ b/authparams.php
@@ -29,7 +29,8 @@ class authparams
/** Get informations from a HTTP authentication */
public function http()
{
- $realm = _("Restricted access");
+ $realm = dgettext("domframework",
+ "Restricted access");
if (!isset($_SERVER['PHP_AUTH_USER']))
{
header("WWW-Authenticate: Basic realm=\"$realm\"");
diff --git a/authsession.php b/authsession.php
index 853fef6..de66aca 100644
--- a/authsession.php
+++ b/authsession.php
@@ -48,7 +48,8 @@ class authsession extends auth
@param string $newpassword The new password to be recorded */
public function changepassword ($oldpassword, $newpassword)
{
- throw new Exception (_("The password can't be change for SESSION users"),
+ throw new Exception (dgettext("domframework",
+ "The password can't be change for SESSION users"),
405);
}
}
diff --git a/authsympa.php b/authsympa.php
index 8caab2f..359effb 100644
--- a/authsympa.php
+++ b/authsympa.php
@@ -41,14 +41,16 @@ class authsympa extends auth
public function __construct ()
{
if (! class_exists ("SoapClient"))
- throw new Exception (_("No SOAP PHP library available"), 500);
+ throw new Exception (dgettext("domframework",
+ "No SOAP PHP library available"), 500);
}
/** Connect to the Sympa server */
public function connect ()
{
if ($this->wsdl === null)
- throw new Exception (_("No WSDL provided to Sympa auth"), 401);
+ throw new Exception (dgettext("domframework",
+ "No WSDL provided to Sympa auth"), 401);
$this->client = new SoapClient($this->wsdl);
}
@@ -58,13 +60,15 @@ class authsympa extends auth
public function authentication ($email, $password)
{
if ($this->client === null)
- throw new Exception (_("The SOAP connection is not opened"), 401);
+ throw new Exception (dgettext("domframework",
+ "The SOAP connection is not opened"), 401);
if ($this->list === null)
- throw new Exception (_("The list to check is not defined"), 401);
+ throw new Exception (dgettext("domframework",
+ "The list to check is not defined"), 401);
$this->authkey = $this->client->login ($email, $password);
if ($this->authkey === null)
- throw new Exception (
- _("Can't connect with provided email/password to sympa"),
+ throw new Exception (dgettext("domframework",
+ "Can't connect with provided email/password to sympa"),
401);
$this->email = $email;
$rc = $this->client->authenticateAndRun ($email, $this->authkey,
@@ -77,7 +81,8 @@ class authsympa extends auth
/** Return all the parameters recorded for the authenticate user */
public function getdetails ()
{
- throw new Exception (_("The details can't be provided by Sympa"), 404);
+ throw new Exception (dgettext("domframework",
+ "The details can't be provided by Sympa"), 404);
}
/** Method to change the password
@@ -86,7 +91,8 @@ class authsympa extends auth
@param string $newpassword The new password to be recorded */
public function changepassword ($oldpassword, $newpassword)
{
- throw new Exception (_("The password can't be change for SYMPA users"),
+ throw new Exception (dgettext("domframework",
+ "The password can't be change for SYMPA users"),
405);
}
}
diff --git a/cachefile.php b/cachefile.php
index 225f901..f8ebefe 100644
--- a/cachefile.php
+++ b/cachefile.php
@@ -69,25 +69,30 @@ class cachefile
public function cachedir ()
{
if (! isset ($this->directory) || $this->directory === "")
- throw new Exception (_("No cache directory defined"), 500);
+ throw new Exception (dgettext("domframework",
+ "No cache directory defined"), 500);
if (! file_exists ($this->directory))
{
// Need to create the cache dir
$parent = realpath (dirname ($this->directory));
if (! is_writeable (dirname ($this->directory)))
- throw new Exception (sprintf (_(
+ throw new Exception (sprintf (dgettext("domframework",
+
"Directory %s is not writable : can not create cache directory"),
$parent), 500);
if (!mkdir ($this->directory))
- throw new Exception (sprintf (_("Can not create cache directory %s"),
+ throw new Exception (sprintf (dgettext("domframework",
+ "Can not create cache directory %s"),
$this->directory), 500);
chmod ($this->directory, 0777);
}
if (! is_writable ($this->directory))
- throw new Exception (sprintf (_("Cache directory %s is not writable"),
+ throw new Exception (sprintf (dgettext("domframework",
+ "Cache directory %s is not writable"),
$this->directory), 500);
if (! is_readable ($this->directory))
- throw new Exception (sprintf (_("Cache directory %s is not readable"),
+ throw new Exception (sprintf (dgettext("domframework",
+ "Cache directory %s is not readable"),
$this->directory), 500);
if (!file_exists ($this->directory."/.htaccess"))
file_put_contents ($this->directory."/.htaccess", "deny from all\n");
@@ -105,7 +110,8 @@ class cachefile
if ($this->nocache !== false)
return false;
if ($data === false)
- throw new Exception (_("Can not store FALSE in cache"), 500);
+ throw new Exception (dgettext("domframework",
+ "Can not store FALSE in cache"), 500);
try
{
$this->cachedir ();
@@ -148,10 +154,12 @@ class cachefile
if (!file_exists ($fileCache))
return false;
if (!is_readable ($fileCache))
- throw new Exception (sprintf (_("File cache %s is not readable"),
+ throw new Exception (sprintf (dgettext("domframework",
+ "File cache %s is not readable"),
$fileCache), 500);
if (!is_writable ($fileCache))
- throw new Exception (sprintf (_("File cache %s is not writable"),
+ throw new Exception (sprintf (dgettext("domframework",
+ "File cache %s is not writable"),
$fileCache), 500);
// Lock : waiting the reconstruction of the cache by another process
// Waiting 10s maximum to re-create the cache file
diff --git a/cacheoutput.php b/cacheoutput.php
index 30f42a4..f5e3aee 100644
--- a/cacheoutput.php
+++ b/cacheoutput.php
@@ -27,7 +27,8 @@ class cacheoutput
{
$res = @include ("domframework/cache$method.php");
if ($res === false)
- throw new Exception (sprintf (_("Unkwnown cache method : "), $method),
+ throw new Exception (sprintf (dgettext("domframework",
+ "Unkwnown cache method : "), $method),
500);
$this->id = $id;
$this->ttl = $ttl;
diff --git a/config.php b/config.php
index c1d07db..adb84af 100644
--- a/config.php
+++ b/config.php
@@ -46,13 +46,13 @@ class config
if (@file_put_contents ($this->confFile,
"confFile));
+ throw new Exception (sprintf (dgettext("domframework",
+ "No configuration file '%s' available and it can't be created"),
+ $this->confFile));
}
elseif (! is_readable ($this->confFile))
- throw new Exception (sprintf (
- _("The configuration file '%s' is not readable"),
+ throw new Exception (sprintf ( dgettext("domframework",
+ "The configuration file '%s' is not readable"),
$this->confFile));
$conf = array ();
$rc = include ($this->confFile);
@@ -83,16 +83,18 @@ class config
}
elseif (! is_readable ($this->confFile))
throw new Exception (sprintf (
- _("The configuration file '%s' is not readable"),
+ dgettext("domframework",
+ "The configuration file '%s' is not readable"),
$this->confFile));
if (!is_writeable ($this->confFile))
- throw new Exception (sprintf (
- "Configuration file '%s' is write protected",
+ throw new Exception (sprintf (dgettext("domframework",
+ "Configuration file '%s' is write protected"),
$this->confFile));
$conf = array ();
$rc = include ($this->confFile);
if ($rc !== 1)
- throw new Exception ("Error in configuration file");
+ throw new Exception (dgettext("domframework",
+ "Error in configuration file"), 500);
$newconf = array_merge ($this->default, $conf, array ($param=>$value));
$txt = "confFile, $txt, LOCK_EX) === FALSE)
- throw new Exception (sprintf ("Can't save configuration file '%s'",
+ throw new Exception (sprintf (dgettext("domframework",
+ "Can't save configuration file '%s'"),
$this->confFile));
return TRUE;
}
@@ -135,7 +138,8 @@ class config
$phpcode .= "),\r\n";
}
else
- throw new Exception ("Config : missing type ".gettype ($val));
+ throw new Exception (dgettext("domframework",
+ "Config : missing type ").gettype ($val), 500);
}
return $phpcode;
diff --git a/dblayer.php b/dblayer.php
index 41f8f7f..8d3286d 100644
--- a/dblayer.php
+++ b/dblayer.php
@@ -64,7 +64,7 @@ class dblayer extends PDO
public function databasename ()
{
if ($this->db === null)
- throw new Exception (_("Database not connected"));
+ throw new Exception (dgettext("domframework", "Database not connected"));
$vals = explode (";", substr (strstr ($this->dsn, ":"), 1));
$dsnExplode = array ();
foreach ($vals as $val)
@@ -81,7 +81,7 @@ class dblayer extends PDO
public function listTables ()
{
if ($this->db === null)
- throw new Exception (_("Database not connected"));
+ throw new Exception (dgettext("domframework", "Database not connected"));
switch ($this->db->getAttribute(PDO::ATTR_DRIVER_NAME))
{
case "sqlite":
@@ -113,7 +113,8 @@ class dblayer extends PDO
$res[] = $d["tablename"];
break;
default:
- throw new Exception (_("Unknown database driver in listTables"));
+ throw new Exception (dgettext("domframework",
+ "Unknown database driver in listTables"));
}
return $res;
}
diff --git a/docs/USAGE b/docs/USAGE
index be9c6b2..909042d 100644
--- a/docs/USAGE
+++ b/docs/USAGE
@@ -324,6 +324,19 @@ You can remove the objects with :
You can see if the user can access to the object with READ, WRITE, EXECUTE :
$auth->validate ("/module/
\n"; // End controls
@@ -576,12 +577,15 @@ class csrf
if ($this->csrf === FALSE )
return TRUE;
if (! isset ($_SESSION["domframework"]["form"]["csrf"]))
- throw new Exception (_("No previous CSRF token : abort"));
+ throw new Exception (dgettext("domframework",
+ "No previous CSRF token : abort"));
if ($_SESSION["domframework"]["form"]["csrf"] !== $tokenFromUser)
- throw new Exception (_("Invalid CSRF token provided"));
+ throw new Exception (dgettext("domframework",
+ "Invalid CSRF token provided"));
if (($_SESSION["domframework"]["form"]["csrfStart"] + $this->csrfTimeout) <
microtime (TRUE))
- throw new Exception (_("Obsolete CSRF token provided"));
+ throw new Exception (dgettext("domframework",
+ "Obsolete CSRF token provided"));
return TRUE;
}