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

@@ -15,15 +15,19 @@ class model_file
{
$this->dataPath = realpath ($this->dataPath);
if ($this->dataPath === FALSE)
throw new Exception (_("Folder data not available"), 500);
throw new Exception (dgettext("domframework",
"Folder data not available"), 500);
$fileArticle = $this->dataPath."/".$articleid;
if (! file_exists ($fileArticle))
throw new Exception (_("Article not found"), 404);
throw new Exception (dgettext("domframework",
"Article not found"), 404);
$fileArticle = realpath ($fileArticle);
if (substr ($fileArticle, 0, strlen ($this->dataPath)) !== $this->dataPath)
throw new Exception (_("Asked article not in data path"), 404);
throw new Exception (dgettext("domframework",
"Asked article not in data path"), 404);
if ($fileArticle === FALSE)
throw new Exception (_("Article not found"), 404);
throw new Exception (dgettext("domframework",
"Article not found"), 404);
return unserialize (file_get_contents ($fileArticle));
}
@@ -33,15 +37,19 @@ class model_file
{
$this->dataPath = realpath ($this->dataPath);
if ($this->dataPath === FALSE)
throw new Exception (_("Folder data not available"), 500);
throw new Exception (dgettext("domframework",
"Folder data not available"), 500);
$fileArticle = $this->dataPath."/".$articleid;
if (! file_exists ($fileArticle))
throw new Exception (_("Article not found"), 404);
throw new Exception (dgettext("domframework",
"Article not found"), 404);
$fileArticle = realpath ($fileArticle);
if (substr ($fileArticle, 0, strlen ($this->dataPath)) !== $this->dataPath)
throw new Exception (_("Asked article not in data path"), 404);
throw new Exception (dgettext("domframework",
"Asked article not in data path"), 404);
if ($fileArticle === FALSE)
throw new Exception (_("Article not found"), 404);
throw new Exception (dgettext("domframework",
"Article not found"), 404);
return file_put_contents ($fileArticle, serialize ($data));
}
@@ -50,7 +58,8 @@ class model_file
{
$list = glob ($this->dataPath."/*");
if ($list === FALSE || empty ($list))
throw new Exception (_("No article found"), 404);
throw new Exception (dgettext("domframework",
"No article found"), 404);
foreach ($list as $key=>$val)
$list[$key] = basename ($val);
return $list;