diff --git a/.gitattributes b/.gitattributes index 743183097177169b33fc1ea55a70dd48790dc80d..dbead44f067a0854aedfa28799e765fb5a05f151 100644 --- a/.gitattributes +++ b/.gitattributes @@ -506,6 +506,9 @@ ecrire/safehtml/readme.txt -text ecrire/urls/page.php -text ecrire/urls/propres-qs.php -text ecrire/win_png.htc -text +ecrire/xml/atom.php -text +ecrire/xml/ical.php -text +ecrire/xml/rss.php -text /inc-public.php3 -text /index.php -text /rien.gif -text diff --git a/ecrire/action/rss.php b/ecrire/action/rss.php index 09b501afffe07923e979b0339006382f8106ecfe..edbca1edd7be1dd9e358a23682a3b7ddadc6e176 100644 --- a/ecrire/action/rss.php +++ b/ecrire/action/rss.php @@ -23,178 +23,10 @@ function trier_par_date($a, $b) { return ($a['date'] < $b['date']); } - -// -// Prend un tableau et l'affiche au format rss -// (fonction inverse de analyser_backend) -// A completer (il manque des tests, des valeurs par defaut, les enclosures, -// differents formats de sortie, etc.) -// -// http://doc.spip.org/@affiche_rss -function affiche_rss($rss, $intro = '', $fmt='') { - if (!$fmt) $fmt = 'rss'; - if (function_exists($f = 'affiche_rss_'.$fmt)) { - return $f($rss, $intro); - } - else - spip_log("Format $fmt inconnu"); -} - -// http://doc.spip.org/@affiche_rss_rss -function affiche_rss_rss($rss, $intro = '') { - // entetes - $u = '<'.'?xml version="1.0" encoding="'.$GLOBALS['meta']['charset'].'"?'.">\n"; - - $u .= ' -<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"> -<channel> - <title>'.texte_backend($intro['title']).'</title> - <link>'.texte_backend(url_absolue($intro['url'])).'</link> - <description>'.texte_backend($intro['description']).'</description> - <language>'.texte_backend($intro['language']).'</language> - '; - - // elements - if (is_array($rss)) { - usort($rss, 'trier_par_date'); - foreach ($rss as $article) { - $u .= ' - <item> - <title>'.texte_backend($article['title']).'</title> - <link>'.texte_backend(url_absolue($article['url'])).'</link> - <guid isPermaLink="true">'.texte_backend(url_absolue($article['url'])).'</guid> - <dc:date>'.date_iso($article['date']).'</dc:date> - <dc:format>text/html</dc:format>'; - if ($article['lang']) $u .= ' - <dc:language>'.texte_backend($article['lang']).'</dc:language>'; - if ($article['author']) { - if ($article['email']) - $article['author'].=' <'.$article['email'].'>'; - - $u .= ' - <dc:creator>'.texte_backend($article['author']).'</dc:creator>'; - } - $u .= ' - <description>'.texte_backend(liens_absolus($article['description'])).'</description> - </item> -'; - } - } - - // pied - $u .= ' - </channel> -</rss> -'; - - return array($u, 'Content-Type: text/xml; charset='.$GLOBALS['meta']['charset']); -} - -// http://doc.spip.org/@affiche_rss_atom -function affiche_rss_atom($rss, $intro = '') { - // entetes - $u = '<'.'?xml version="1.0" encoding="'.$GLOBALS['meta']['charset'] - .'"?'.">\n"; - $u .= '<feed xmlns="http://www.w3.org/2005/Atom"'; - if ($intro['language']) - $u .= ' xml:lang="'.$intro['language'].'"'; - $u .= '> - <title>'.texte_backend($intro['title']).'</title> - <id>'.texte_backend(url_absolue($intro['url'])).'</id> - <link href="'.texte_backend(url_absolue($intro['url'])).'"/>'; - if ($intro['description']) $u .= '<subtitle>'.texte_backend($intro['description']).'</subtitle>'; - $u .= '<link rel="self" type="application/atom+xml" href="'.texte_backend(url_absolue($_SERVER['REQUEST_URI'])).'"/> - <updated>'.gmdate("Y-m-d\TH:i:s\Z").'</updated>'; // probleme, <updated> pourrait etre plus precis - - // elements - if (is_array($rss)) { - usort($rss, 'trier_par_date'); - foreach ($rss as $article) { - $u .= "\n\t<entry"; - if ($article['lang']) - $u .= ' xml:lang="'.texte_backend($article['lang']).'"'; - $u .= '> - <title>'.texte_backend($article['title']).'</title> - <id>'.texte_backend(url_absolue($article['url'])).'</id> - <link rel="alternate" type="text/html" href="'.texte_backend(url_absolue($article['url'])).'"/> - <published>'.date_iso($article['date']).'</published> - <updated>'.date_iso($article['date']).'</updated>'; - if ($article['author']) { - $u .= ' - <author><name>'.texte_backend($article['author']).'</name>'; - if ($article['email']) - $u .= '<email>'.texte_backend($article['email']).'</email>'; - $u .= '</author>'; - } - $u .=' - <summary type="html">'.texte_backend(liens_absolus($article['description'])).'</summary> - </entry> -'; - } - } - - // pied - $u .= ' -</feed> - '; - - return array($u, 'Content-Type: text/xml; charset='.$GLOBALS['meta']['charset']); -} - -// http://doc.spip.org/@affiche_rss_ical -function affiche_rss_ical($rss, $intro = '') { - - // entetes - $u = -'BEGIN:VCALENDAR -CALSCALE:GREGORIAN -X-WR-CALNAME;VALUE=TEXT:'.filtrer_ical($intro['title']).' -X-WR-RELCALID:'.filtrer_ical(url_absolue($intro['url'])).' -'; - - // elements - if (is_array($rss)) { - usort($rss, 'trier_par_date'); - foreach ($rss as $article) { - - // Regler la date de fin a h+60min - if (!$article['enddate']) - $article['enddate'] = date_ical($article['date'],60); - else - $article['enddate'] = date_ical($article['enddate']); - - // Type d'evenement - if ($article['type'] == 'todo') - $type = 'VTODO'; - else - $type = 'VEVENT'; - - $u .= -'BEGIN:'.$type.' -SUMMARY:'.filtrer_ical($article['title']).' -URL:'.filtrer_ical(url_absolue($article['url'])).' -DTSTAMP:'. date_ical($article['date']).' -DTSTART:'. date_ical($article['date']).' -DTEND:'. $article['enddate'].' -DESCRIPTION:'.filtrer_ical(liens_absolus($article['description'])).' -ORGANIZER:'.filtrer_ical($article['author']).' -CATEGORIES:-- -END:'.$type.' -'; - } - } - - // pied - $u .= 'END:VCALENDAR'; - - return array($u, 'Content-Type: text/calendar; charset=utf-8'); -} - // // Fonctions de remplissage du RSS // - // Suivi des revisions d'articles // http://doc.spip.org/@rss_suivi_versions function rss_suivi_versions($a) { @@ -240,8 +72,6 @@ function rss_suivi_forums($a, $from, $where, $lien_moderation=false) { return $rss; } - - // Suivi de la messagerie privee // http://doc.spip.org/@rss_suivi_messagerie function rss_suivi_messagerie($a) { @@ -467,21 +297,13 @@ switch($op) { break; } -// -// Envoyer le RSS -// -$intro = array( + if (!$fmt) $fmt = 'rss'; + $f = charger_fonction($fmt, 'xml'); + $f($rss, array( 'title' => "[".$GLOBALS['meta']['nom_site']."] RSS ".$title, 'url' => $url, - 'language'=> $GLOBALS['spip_lang'] -); - -list($content,$header) = affiche_rss($rss, $intro, $fmt); -if ($header) @header($header); -echo $content; - -spip_log("spip_rss: ".spip_timer('rss')); - + 'language'=> $GLOBALS['spip_lang'])); + + spip_log("spip_rss applique $f sur '$fmt $opt $args'. Tempsd: " . spip_timer('rss')); } - ?> diff --git a/ecrire/inc/gadgets.php b/ecrire/inc/gadgets.php index f8e868f856c499fb127e4a0d4dbad49b3dfc164b..2d96867c7eac52a6adf1e691638348e52862a770 100644 --- a/ecrire/inc/gadgets.php +++ b/ecrire/inc/gadgets.php @@ -293,7 +293,15 @@ function bandeau_gadgets($largeur, $options, $id_rubrique) { // GADGET Menu rubriques . "\n<div id='bandeautoutsite' class='bandeau_couleur_sous' style='$spip_lang_left: 0px;'>" - . "<a href='" . generer_url_ecrire("articles_tous") . "' class='lien_sous'>"._T('icone_site_entier')."</a>" + . "<a href='" + . generer_url_ecrire("articles_tous") + . "' class='lien_sous'" +/* retire par la 7033 car bugge. a reintroduire ? +onmouseover=\"findObj_forcer('bandeautoutsite').style.visibility='visible'; charger_id_url_si_vide('" . generer_url_ecrire('rubriquer',"&var_ajax=1&id=$id_rubrique") . "','nav-recherche');\" */ + . ">" + ._T('icone_site_entier') + . "</a>" + . "<div id='nav-recherche'></div>" . "<div id='gadget-rubriques'></div>" . "</div>"; // FIN GADGET Menu rubriques diff --git a/ecrire/inc/informer.php b/ecrire/inc/informer.php index 186c873c9233c7eac324a9a890a17555bdbfe94e..97887155eb86e2bcd37e6600993c2c019542f8bc 100644 --- a/ecrire/inc/informer.php +++ b/ecrire/inc/informer.php @@ -42,7 +42,7 @@ function inc_informer_dist($id, $col, $exclus, $rac, $type) } $rac = htmlentities($rac); - spip_log("info $res"); + # ce lien provoque la selection (directe) de la rubrique cliquee $onClick = "findObj_forcer('id_parent').value=$id;"; # et l'affichage de son titre dans le bandeau diff --git a/ecrire/xml/atom.php b/ecrire/xml/atom.php new file mode 100644 index 0000000000000000000000000000000000000000..6bc31cc2d4ffa832f2783f8c02f68ebeedd2fa94 --- /dev/null +++ b/ecrire/xml/atom.php @@ -0,0 +1,70 @@ +<?php + +/***************************************************************************\ + * SPIP, Systeme de publication pour l'internet * + * * + * Copyright (c) 2001-2006 * + * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * + * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + + +if (!defined("_ECRIRE_INC_VERSION")) return; + +include_spip('inc/minipres'); +include_spip('inc/acces'); +include_spip('inc/texte'); // utile pour l'espace public, deja fait sinon + +function xml_atom_dist($rss, $intro = '') { + // entetes + $u = '<'.'?xml version="1.0" encoding="'.$GLOBALS['meta']['charset'] + .'"?'.">\n"; + $u .= '<feed xmlns="http://www.w3.org/2005/Atom"'; + if ($intro['language']) + $u .= ' xml:lang="'.$intro['language'].'"'; + $u .= '> + <title>'.texte_backend($intro['title']).'</title> + <id>'.texte_backend(url_absolue($intro['url'])).'</id> + <link href="'.texte_backend(url_absolue($intro['url'])).'"/>'; + if ($intro['description']) $u .= '<subtitle>'.texte_backend($intro['description']).'</subtitle>'; + $u .= '<link rel="self" type="application/atom+xml" href="'.texte_backend(url_absolue($_SERVER['REQUEST_URI'])).'"/> + <updated>'.gmdate("Y-m-d\TH:i:s\Z").'</updated>'; // probleme, <updated> pourrait etre plus precis + + // elements + if (is_array($rss)) { + usort($rss, 'trier_par_date'); + foreach ($rss as $article) { + $u .= "\n\t<entry"; + if ($article['lang']) + $u .= ' xml:lang="'.texte_backend($article['lang']).'"'; + $u .= '> + <title>'.texte_backend($article['title']).'</title> + <id>'.texte_backend(url_absolue($article['url'])).'</id> + <link rel="alternate" type="text/html" href="'.texte_backend(url_absolue($article['url'])).'"/> + <published>'.date_iso($article['date']).'</published> + <updated>'.date_iso($article['date']).'</updated>'; + if ($article['author']) { + $u .= ' + <author><name>'.texte_backend($article['author']).'</name>'; + if ($article['email']) + $u .= '<email>'.texte_backend($article['email']).'</email>'; + $u .= '</author>'; + } + $u .=' + <summary type="html">'.texte_backend(liens_absolus($article['description'])).'</summary> + </entry> +'; + } + } + + // pied + $u .= ' +</feed> + '; + + header('Content-Type: text/xml; charset='.$GLOBALS['meta']['charset']); + echo $u; +} +?> diff --git a/ecrire/xml/ical.php b/ecrire/xml/ical.php new file mode 100644 index 0000000000000000000000000000000000000000..02461813be008023194ae5b77c4f15bd8a783c6e --- /dev/null +++ b/ecrire/xml/ical.php @@ -0,0 +1,68 @@ +<?php + +/***************************************************************************\ + * SPIP, Systeme de publication pour l'internet * + * * + * Copyright (c) 2001-2006 * + * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * + * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + + +if (!defined("_ECRIRE_INC_VERSION")) return; + +include_spip('inc/minipres'); +include_spip('inc/acces'); +include_spip('inc/texte'); // utile pour l'espace public, deja fait sinon + +function xml_ical_dist($rss, $intro = '') { + + // entetes + $u = +'BEGIN:VCALENDAR +CALSCALE:GREGORIAN +X-WR-CALNAME;VALUE=TEXT:'.filtrer_ical($intro['title']).' +X-WR-RELCALID:'.filtrer_ical(url_absolue($intro['url'])).' +'; + + // elements + if (is_array($rss)) { + usort($rss, 'trier_par_date'); + foreach ($rss as $article) { + + // Regler la date de fin a h+60min + if (!$article['enddate']) + $article['enddate'] = date_ical($article['date'],60); + else + $article['enddate'] = date_ical($article['enddate']); + + // Type d'evenement + if ($article['type'] == 'todo') + $type = 'VTODO'; + else + $type = 'VEVENT'; + + $u .= +'BEGIN:'.$type.' +SUMMARY:'.filtrer_ical($article['title']).' +URL:'.filtrer_ical(url_absolue($article['url'])).' +DTSTAMP:'. date_ical($article['date']).' +DTSTART:'. date_ical($article['date']).' +DTEND:'. $article['enddate'].' +DESCRIPTION:'.filtrer_ical(liens_absolus($article['description'])).' +ORGANIZER:'.filtrer_ical($article['author']).' +CATEGORIES:-- +END:'.$type.' +'; + } + } + + // pied + $u .= 'END:VCALENDAR'; + + header('Content-Type: text/calendar; charset=utf-8'); + echo $u; +} +?> diff --git a/ecrire/xml/rss.php b/ecrire/xml/rss.php new file mode 100644 index 0000000000000000000000000000000000000000..cd8d4bfe295501a5d8d4c1b408cc81f84ee5c814 --- /dev/null +++ b/ecrire/xml/rss.php @@ -0,0 +1,68 @@ +<?php + +/***************************************************************************\ + * SPIP, Systeme de publication pour l'internet * + * * + * Copyright (c) 2001-2006 * + * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * + * * + * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * + * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * +\***************************************************************************/ + + +if (!defined("_ECRIRE_INC_VERSION")) return; + +include_spip('inc/minipres'); +include_spip('inc/acces'); +include_spip('inc/texte'); // utile pour l'espace public, deja fait sinon + +function xml_rss_dist($rss, $intro = '') { + // entetes + $u = '<'.'?xml version="1.0" encoding="'.$GLOBALS['meta']['charset'].'"?'.">\n"; + + $u .= ' +<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"> +<channel> + <title>'.texte_backend($intro['title']).'</title> + <link>'.texte_backend(url_absolue($intro['url'])).'</link> + <description>'.texte_backend($intro['description']).'</description> + <language>'.texte_backend($intro['language']).'</language> + '; + + // elements + if (is_array($rss)) { + usort($rss, 'trier_par_date'); + foreach ($rss as $article) { + $u .= ' + <item> + <title>'.texte_backend($article['title']).'</title> + <link>'.texte_backend(url_absolue($article['url'])).'</link> + <guid isPermaLink="true">'.texte_backend(url_absolue($article['url'])).'</guid> + <dc:date>'.date_iso($article['date']).'</dc:date> + <dc:format>text/html</dc:format>'; + if ($article['lang']) $u .= ' + <dc:language>'.texte_backend($article['lang']).'</dc:language>'; + if ($article['author']) { + if ($article['email']) + $article['author'].=' <'.$article['email'].'>'; + + $u .= ' + <dc:creator>'.texte_backend($article['author']).'</dc:creator>'; + } + $u .= ' + <description>'.texte_backend(liens_absolus($article['description'])).'</description> + </item> +'; + } + } + + // pied + $u .= ' + </channel> +</rss> +'; + header('Content-Type: text/xml; charset='.$GLOBALS['meta']['charset']); + echo $u; +} +?>