[ Index ] |
|
Code source de SPIP Agora 1.4 |
1 <?php 2 /***************************************************** 3 * This file is part of Agora, web based content management system. 4 * 5 * Agora is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 2 of the License. 8 * 9 * Agora is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details (file "COPYING"). 13 * 14 * Copyright © Arnaud Martin, Antoine Pitrou et Philippe Rivière. 15 * List of authors detailed in "copyright_fr.html" file. 16 * E-mail : agora@sig.premier-ministre.gouv.fr 17 * Web site : http://www.agora.gouv.fr 18 *****************************************************/ 19 global $nl_preview_path; 20 21 if (isset($nl_preview_path)) { 22 $GLOBALS['dossier_squelettes'] = 'ecrire/squelettes_newsletter/' . $nl_preview_path; 23 } 24 else { 25 $GLOBALS['dossier_squelettes'] = ($GLOBALS['dossier_squelettes'] ? $GLOBALS['dossier_squelettes']. '/' : ''); 26 } 27 28 //this function changes 2004-04-14 17:01:37 29 //to 20040414T170137Z 30 //XXX TODO: Put all the dates in UTC. We'll do it one day... 31 function xml_iso_datetime ($dateTime) { 32 return date("Y-m-d\THis\Z", strtotime($dateTime)); 33 } 34 35 //generation of the correct URL for the DXS version of an article 36 function url_article_dxs ($id_article) { 37 return "article_dxs.php?id_article=" . $id_article; 38 } 39 40 //generation of the correct URL for the DXS version of a "rubrique" 41 function url_rubrique_dxs ($id_rubrique) { 42 return "rubrique_dxs.php?id_rubrique=" . $id_rubrique; 43 } 44 45 function base64_data ($id_document) { 46 require_once(dirname(__FILE__). '/include/bd/inc_document_factory.php'); 47 $document = &recuperer_instance_document(); 48 $document->load($id_document); 49 $data = $document->getFichierContenuBase64(); 50 51 if ($data == FALSE) 52 return ''; 53 else 54 return $data; 55 } 56 57 //sends back an base64 encoded version of a file $filename in IMG 58 function base64_data_file ($filename) { 59 require_once(dirname(__FILE__). '/include/bd/inc_document_factory.php'); 60 $document = &recuperer_instance_document(); 61 $document->load($id_document); 62 $data = $document->getFichierContenuBase64(); 63 64 if ($data == FALSE) 65 return ''; 66 else 67 return $data; 68 } 69 70 //Generation des CDATA "parsables" par le systeme DXS 71 //le probleme que l'on peut avoir, c'est le ]]> dans 72 //le contenu, interdit par les specs. 73 //on le remplace donc par une chaine aleatoire qui 74 //ne sera pas presente dans le contenu CDATA 75 function genererTagCDATA ($contenu, $tag) { 76 if ($contenu == '') 77 return ''; 78 79 $escapeString = "]]>"; 80 81 while (strpos($contenu, $escapeString) != FALSE) { 82 //theoretically never happens. Theoretically :+) 83 if ($escapeString == '__DXS_ESCAPE_STRING__') { 84 $letters = array('a', 'e', 'i', 'o', 'u', 'b', 'c', 'd', 'f', 'g', 'v', 'w', 'x', 'z'); 85 shuffle($letters); 86 $escapeString = implode("", $letters); 87 } 88 else { 89 //quick'n'dirty solution. 90 $escapeString = '__DXS_ESCAPE_STRING__'; 91 } 92 } 93 94 if ($escapeString != "]]>") { 95 $contenu = str_replace("]]>", $escapeString, $contenu); 96 $result = '<' . $tag . ' escape="' . $escapeString . '"><![CDATA['; 97 } 98 else { 99 $result = '<' . $tag . '><![CDATA['; 100 } 101 102 return $result . $contenu . ']]></' . $tag . '>'; 103 } 104 ?>
titre
Description
Corps
titre
Description
Corps
titre
Description
Corps
titre
Corps
Généré le : Sat Feb 24 14:40:03 2007 | par Balluche grâce à PHPXref 0.7 |