diff options
Diffstat (limited to 'model/Article.php')
| -rw-r--r-- | model/Article.php | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/model/Article.php b/model/Article.php index ef68661..fa9fce1 100644 --- a/model/Article.php +++ b/model/Article.php | |||
| @@ -110,12 +110,19 @@ class Article | |||
| 110 | public function update($content) | 110 | public function update($content) |
| 111 | { | 111 | { |
| 112 | $fileName = 'data/' . $this->page . '/' . $this->format . '/' . $this->fileCode . '.' . $this->format; | 112 | $fileName = 'data/' . $this->page . '/' . $this->format . '/' . $this->fileCode . '.' . $this->format; |
| 113 | //var_dump($fileName); die(); | 113 | //var_dump(file_get_contents($fileName)); die(); |
| 114 | $file = fopen($fileName, 'w'); // w pour créer ou écraser | 114 | if(file_exists($fileName) && empty($content)) |
| 115 | fputs($file, $content); | 115 | { |
| 116 | fclose($file); | 116 | $this->delete(); |
| 117 | //chown($this->fileName, 'http'); | 117 | } |
| 118 | chmod($this->fileName, 0666); | 118 | elseif(!empty($content)) |
| 119 | { | ||
| 120 | $file = fopen($fileName, 'w'); // w pour créer ou écraser | ||
| 121 | fputs($file, $content); | ||
| 122 | fclose($file); | ||
| 123 | //chown($this->fileName, 'http'); | ||
| 124 | chmod($fileName, 0666); | ||
| 125 | } | ||
| 119 | } | 126 | } |
| 120 | 127 | ||
| 121 | // delete | 128 | // delete |
