Rework of blog example to be compliant with version of domframework
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@1551 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
@@ -24,7 +24,25 @@ class model_file
|
||||
throw new Exception (_("Asked article not in data path"), 404);
|
||||
if ($fileArticle === FALSE)
|
||||
throw new Exception (_("Article not found"), 404);
|
||||
return file_get_contents ($fileArticle);
|
||||
return unserialize (file_get_contents ($fileArticle));
|
||||
}
|
||||
|
||||
/** Create a new article if $articleid is false or edit an existing article
|
||||
if $articleid is defined */
|
||||
function set ($data, $articleid = FALSE)
|
||||
{
|
||||
$this->dataPath = realpath ($this->dataPath);
|
||||
if ($this->dataPath === FALSE)
|
||||
throw new Exception (_("Folder data not available"), 500);
|
||||
$fileArticle = $this->dataPath."/".$articleid;
|
||||
if (! file_exists ($fileArticle))
|
||||
throw new Exception (_("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);
|
||||
if ($fileArticle === FALSE)
|
||||
throw new Exception (_("Article not found"), 404);
|
||||
return file_put_contents ($fileArticle, serialize ($data));
|
||||
}
|
||||
|
||||
/** Return a list of all the articles ID */
|
||||
|
||||
Reference in New Issue
Block a user