// // This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike License. // // To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/1.0/ // // or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA. // // Francais (brouillon): http://creativecommons.org/projects/international/fr/translated-license // ////////////////////////////////////////////////////////////////////////////////////////////////////// // Modification d'un écrit // Version 0.3.0 $requiredFiles = array("ecrits","cache","fonctions"); include_once("head.php"); function show_date($date) { $out = ' à h '; return $out; } if(isset($_SERVER['argv'][0])) $action = $_SERVER['argv'][0]; elseif(isset($_POST['preview'])) $mode = "preview"; else $action = ""; $date = $_POST['date']; if(!is_array($date)) $date = unserialize($date); if(is_array($date)) $date = mktime($date['heure'],$date['minute'],0,$date['mois'],$date['jour'],$date['annee']); // Actions de post if(isset($_POST) && isset($_POST['save'])) { $id = $ecrits->modifier($journal->courant['id'],$_POST['id'],array( "titre" => $_POST['titre'], "texte" => $_POST['texte'], "statut"=> $_POST['statut'], "fuseau"=> $mem->infos['fuseau'], "valide"=> $_POST['valide'], "syntaxe"=> $_POST['syntaxe'], "date" => $date)); if(!$ecrits->erreur) { header("location: lire?".$_POST['id']); exit; } else $err = $ecrits->erreur; } if($_POST) $id = $_POST['id']; else $id = $_GET['id']; if(empty($id)) $id = $_SERVER['argv'][0]; // Action de visualisation if($mode == "preview") { $titre = $_POST['titre']; $texte = $ecrits->do_html($journal->courant['id'],$_POST['syntaxe'],$_POST['texte']); $page = '

Prévisualisation, n\'oubliez pas de sauvegarder cet écrit.

'.$texte.'

'; $titre = $_POST['titre']; } else { if(count($_POST) < 1) $ecrit = $ecrits->lire($journal->courant['id'],$id); else { $ecrit = $_POST; $ecrit['date'] = $date; } if(!is_array($ecrit) || !isset($ecrit['id'])) { header("location: gestion?err=".urlencode("Cet écrit n'existe pas.")); exit; } $date = show_date($ecrit['date']); if($action == "restaure") $_POST['texte'] = $ecrits->lire_rescue($journal->courant['id']); elseif($action == "raz") $ecrits->suppr_rescue($journal->courant['id']); else { $res = $ecrits->exist_rescue($journal->courant['id']); if($res) { $ecrits->erreur = "Une sauvegarde de sécurité du ".date("d/m/Y à H:i",$res)." a été détectée.
Récuperer la sauvegarde - Supprimer la sauvegarde"; } } $page.= '
'; if($err) $page.= "

".stripslashes($err)."

"; $page.= '



Type d\'écrit:




'.$date.'

'; $titre = "Modifier"; } page($titre,$page); ?>