Update domframework to be gettext package compliant

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1661 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2014-08-06 13:16:43 +00:00
parent ab7f76d0bb
commit b8a3e1aa23
13 changed files with 223 additions and 111 deletions

View File

@@ -46,13 +46,13 @@ class config
if (@file_put_contents ($this->confFile,
"<?php\r\n\$conf = array ();\r\n")
=== FALSE)
throw new Exception (sprintf (
_("No configuration file '%s' available and it can't be created"),
$this->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 = "<?php\r\n";
$txt .= "\$conf = array(\r\n";
@@ -100,7 +102,8 @@ class config
$txt .= ");\r\n";
if (@file_put_contents ($this->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;