// // 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 // ////////////////////////////////////////////////////////////////////////////////////////////////////// // Export HTML + Images // v0.1.0 if(!is_object($journal)) die("Indisponible"); if($mode == "archive") { if(empty($archivePath)) $archivePath = "../archives/".$journal->courant['id']."/"; if(!file_exists($archivePath) && !@mkdir($archivePath)) die("Le répertoire $archivePath n'existe pas."); } require_once("../classes/ecrits.php"); require_once("../classes/fonctions.php"); if($mode == "export") { require_once("zip.lib.php"); $zip = new zipfile(); } $ecrits = new ecrits(); $datas = $journal->courant; $page = ' '.str2html($datas['titre']).'

'.str2html($datas['titre']).'

'; if($mode == "export") $page.= '

'.id2url($datas['id']).'

Export HTML avec images du '.date("d/m/Y").'.

'; else $page.= '

Un journal de '.str2html($cfg['titre']).'

Archive du journal au '.date("d/m/Y").'.

'; $page.= '

Sommaire

'; $liste_mois = $ecrits->liste_mois($datas['id']); $lst = array(); foreach($liste_mois as $mois) { $liste[$mois] = $ecrits->liste($datas['id'],$mois,TRUE,TRUE); $lst = array_merge($lst,$liste[$mois]); } $liste = $lst; if(count($liste) < 1) die("Rien à exporter. aucun écrit."); foreach($liste as $id=>$rec) { $rec['texte_html'] = str_replace('courant['id']),$rec['texte_html']); preg_match_all('/addfile($file, $fileName); else { $fp = @fopen($archivePath.$fileName,"w"); if(!$fp) continue; fputs($fp,$file); fclose($fp); } $rec['texte_html'] = str_replace($img[0],'
'.str2html($rec['titre']).'
'; } $page.= '
'; reset($liste); foreach($liste as $rec) { $page.= '

'.str2html($rec['titre']).'

'.str2html(date_fr("l j F Y à G\hi",$rec['date'])).'

'.stripslashes($rec['texte_html']).'
'; } $page.= '
'; if($mode == "export") { $zip->addfile($page,"index.html"); $archive = $zip->file(); $fp = @fopen($saveToFile,"w"); if(!$fp) die("Impossible d'ouvrir le fichier d'export en écriture."); fputs($fp,$archive); fclose($fp); } elseif($mode == "archive") { $fp = @fopen($archivePath."index.html","w"); if(!$fp) die("Impossible d'ouvrir le fichier d'export en écriture."); fputs($fp,$page); fclose($fp); } else { echo $page; exit; } ?>