diff options
Diffstat (limited to 'model/melaine-write.php')
-rw-r--r-- | model/melaine-write.php | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/model/melaine-write.php b/model/melaine-write.php index 4f5b441..642bf05 100644 --- a/model/melaine-write.php +++ b/model/melaine-write.php | |||
@@ -3,15 +3,22 @@ | |||
3 | // | 3 | // |
4 | // accès en écriture pour créer ou modifier des articles | 4 | // accès en écriture pour créer ou modifier des articles |
5 | 5 | ||
6 | function nouvelArticle($page, $article, $contenuHTML) | 6 | function nouvelArticle($page, $contenuHTML) |
7 | { | 7 | { |
8 | // debuggage | ||
9 | //exit(); | ||
10 | |||
11 | // manipulation du fichier | 8 | // manipulation du fichier |
12 | $nom_fichier = 'article' . $article . '.html'; | 9 | //$nom_fichier = 'article' . $article . '.html'; |
10 | $nom_fichier = time() . '.html'; | ||
13 | $fichier = fopen('data/' . $page . '/html/' . $nom_fichier, 'w'); // w peut créer un fichier, si il existe déjà, il est effacé par le nouveau contenu | 11 | $fichier = fopen('data/' . $page . '/html/' . $nom_fichier, 'w'); // w peut créer un fichier, si il existe déjà, il est effacé par le nouveau contenu |
14 | fputs($fichier, $contenuHTML); | 12 | fputs($fichier, $contenuHTML); |
15 | fclose($fichier); | 13 | fclose($fichier); |
16 | chmod('data/' . $page . '/html/' . $nom_fichier, 0666); | 14 | chmod('data/' . $page . '/html/' . $nom_fichier, 0666); |
17 | } | 15 | } |
16 | |||
17 | function modifArticle($page, $nom_fichier, $contenuHTML) | ||
18 | { | ||
19 | // manipulation du fichier | ||
20 | $fichier = fopen('data/' . $page . '/html/' . $nom_fichier, 'w'); // w peut créer un fichier, si il existe déjà, il est effacé par le nouveau contenu | ||
21 | fputs($fichier, $contenuHTML); | ||
22 | fclose($fichier); | ||
23 | chmod('data/' . $page . '/html/' . $nom_fichier, 0666); | ||
24 | } \ No newline at end of file | ||