summaryrefslogtreecommitdiff
path: root/model/melaine-write.php
blob: 642bf05d31c0b60796d674b67fabf83f91ed57ae (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<?php
// model/melaine-write.php
//
// accès en écriture pour créer ou modifier des articles

function nouvelArticle($page, $contenuHTML)
{
	// manipulation du fichier
	//$nom_fichier = 'article' . $article . '.html';
	$nom_fichier = time() . '.html';
    $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
    fputs($fichier, $contenuHTML);
    fclose($fichier);
    chmod('data/' . $page . '/html/' . $nom_fichier, 0666);
}

function modifArticle($page, $nom_fichier, $contenuHTML)
{
	// manipulation du fichier
    $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
    fputs($fichier, $contenuHTML);
    fclose($fichier);
    chmod('data/' . $page . '/html/' . $nom_fichier, 0666);
}