diff --git a/.gitattributes b/.gitattributes index f95059008e3d48083ea3b9c0035a9a67cc710664..c2a20696fcd00d47665a5c6d14cfac917b86db5c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -268,6 +268,7 @@ ecrire/inc_lang_liste.php -text ecrire/inc_magicquotes.php -text ecrire/inc_mini_nav.php -text ecrire/inc_naviguer.php -text +ecrire/inc_spip_cal.php -text ecrire/inc_spip_image.php -text ecrire/lang/ecrire_ru.php3 -text ecrire/lang/public_ru.php3 -text diff --git a/ecrire/calendrier.php3 b/ecrire/calendrier.php3 index 35b3fbc4848563e0ebda7d9037ae64532d6252a5..ee6a48a2e4cdec571ab3584bfab06000ca4dcafb 100644 --- a/ecrire/calendrier.php3 +++ b/ecrire/calendrier.php3 @@ -12,17 +12,20 @@ include ("inc.php3"); -$nom = "calendrier"; -$f = find_in_path('inc_' . $nom . '.php'); -if ($f) - include($f); -elseif (file_exists($f = (_DIR_INCLUDE . 'inc_' . $nom . '.php'))) - include($f); +// prendre $var_* comme variables pour eviter les conflits avec les http_vars -if (function_exists($nom)) - $nom($type, $css); -elseif (function_exists($f = $nom . "_dist")) - $f($type, $css); - else - spip_log("fonction $nom indisponible"); +$var_nom = "calendrier"; +$var_f = find_in_path('inc_' . $var_nom . '.php'); + +if ($var_f) + include($var_f); +elseif (file_exists($var_f = (_DIR_INCLUDE . 'inc_' . $var_nom . '.php'))) + include($var_f); + +if (function_exists($var_nom)) + $var_nom($type, $css); +elseif (function_exists($var_f = $var_nom . "_dist")) + $var_f($type, $css); +else + spip_log("fonction $var_nom indisponible"); ?> diff --git a/ecrire/inc_spip_cal.php b/ecrire/inc_spip_cal.php new file mode 100644 index 0000000000000000000000000000000000000000..149501b656e7173c5a505e658e629558b9739ac3 --- /dev/null +++ b/ecrire/inc_spip_cal.php @@ -0,0 +1,325 @@ +<?php + +/***************************************************************************\ + * SPIP, Systeme de publication pour l'internet * + * * + * Copyright (c) 2001-2005 * + * 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. * +\***************************************************************************/ + +include_ecrire("inc_filtres.php3"); +include_ecrire("inc_lang.php3"); +include_ecrire("inc_texte.php3"); +include_ecrire("inc_charsets.php3"); +include_ecrire("inc_meta.php3"); +include_ecrire("inc_admin.php3"); +include_ecrire("inc_acces.php3"); + +// avec le nouveau compilateur tout ceci me semble faisable en squelette. + +function ligne ($texte) { + echo filtrer_ical($texte)."\n"; +} + +function spip_cal_dist($id_auteur, $cle) +{ + if (verifier_low_sec($id_auteur, $cle, 'ical')) { + $query = "SELECT * FROM spip_auteurs WHERE id_auteur=$id_auteur"; + $result = spip_query($query); + + if ($row = spip_fetch_array($result)) { + $id_utilisateur=$row['id_auteur']; + $nom_utilisateur=$row['nom']; + $statut_utilisateur=$row['statut']; + $langue_utilisateur=$row['lang']; + } + } + if (!$id_utilisateur) { + echo _T('info_acces_interdit'); + exit; + } + lang_select($langue_utilisateur); + $nom_site = lire_meta("nom_site"); + $adresse_site = lire_meta("adresse_site"); + + @header("Content-Type: text/calendar; charset=utf-8"); + ligne ("BEGIN:VCALENDAR"); + ligne ("CALSCALE:GREGORIAN"); + ligne ("X-WR-CALNAME;VALUE=TEXT:$nom_site / $nom_utilisateur"); + ligne ("X-WR-RELCALID:cal$id_utilisateur @ $adresse_site"); + spip_ical_rendez_vous($id_utilisateur, $nom_site, $adresse_site); + spip_ical_taches($id_utilisateur, $nom_site, $adresse_site); + $nb_articles = spip_ical_articles($nom_site, $adresse_site); + $nb_breves = spip_ical_breves($nom_site, $adresse_site); + if ($nb_articles || $nb_breves) { + if ($nb_articles > 0) $titre_prop[] = _T('info_articles_proposes').": ".$nb_articles; + if ($nb_breves > 0) $titre_prop[] = _T('info_breves_valider').": ".$nb_breves; + $titre = join($titre_prop," / "); + ligne ("BEGIN:VTODO"); + ligne ("SUMMARY:[$nom_site] $titre"); + ligne ("UID:prop @ $adresse_site"); + $texte = join($titres," / "); + ligne ("DESCRIPTION:$texte"); + + $today=getdate(time()); + $jour = $today["mday"]; + $mois=$today["mon"]; + $annee=$today["year"]; + ligne ("DTSTAMP:".date ("Ymd\THis", mktime (12,0,0,$mois,$jour,$annee))); + ligne ("DTSTART:".date ("Ymd\THis", mktime (12,0,0,$mois,$jour,$annee))); + ligne ("CATEGORIES:"._T('icone_a_suivre')); + ligne ("URL:$adresse_site/ecrire/"); + ligne ("END:VTODO"); + } + spip_ical_messages($id_utilisateur, $nom_site, $adresse_site); + if ($statut_utilisateur == "0minirezo") { + spip_ical_forums($id_utilisateur, $nom_site, $adresse_site); + } + ligne ("END:VCALENDAR"); +} + +function spip_ical_rendez_vous($id_utilisateur, $nom_site, $adresse_site) +{ + $result_messages=spip_query("SELECT messages.* FROM spip_messages AS messages, spip_auteurs_messages AS lien WHERE ((lien.id_auteur='$id_utilisateur' AND lien.id_message=messages.id_message) OR messages.type='affich') AND messages.rv='oui' AND messages.statut='publie' GROUP BY messages.id_message ORDER BY messages.date_heure"); + while($row=spip_fetch_array($result_messages)){ + $id_message=$row['id_message']; + $date_heure=$row["date_heure"]; + $date_heure_fin=$row["date_fin"]; + //$titre=typo($row["titre"]); + $titre = $row["titre"]; + $texte = $row["texte"]; + $type=$row["type"]; + + if ($type == 'normal') { + $le_type = _T('info_message_2'); + $result_auteurs=spip_query("SELECT auteurs.* FROM spip_auteurs AS auteurs, spip_auteurs_messages AS lien WHERE (lien.id_message='$id_message' AND lien.id_auteur=auteurs.id_auteur)"); + while($row_auteur=spip_fetch_array($result_auteurs)){ + $id_auteur=$row_auteur['id_auteur']; + $nom_auteur=$row_auteur['nom']; + $email = $row_auteur ['email']; + + if ($id_auteur != $id_utilisateur) $titre = $titre." - ".$nom_auteur; + + if ($id_auteur == $id_utilisateur) ligne ("ORGANIZER:$nom_auteur <$email>"); + else ligne ("ATTENDEE:$nom_auteur <$email>"); + } + } + else if ($type == 'pb') { + $le_type = _T('info_pense_bete'); + } + else if ($type == 'affich') { + $le_type = _T('info_annonce'); + $titre = "[$nom_site] $titre"; + } + + ligne ("BEGIN:VEVENT"); + ligne ("SUMMARY:".$titre); + ligne ("DESCRIPTION:$texte"); + ligne ("UID:mess$id_message @ $adresse_site"); + ligne ("DTSTAMP:".date_ical($date_heure)); + ligne ("DTSTART:".date_ical($date_heure)); + if ($date_heure_fin > $date_heure) ligne ("DTEND:".date_ical($date_heure_fin)); + + ligne ("CATEGORIES:$le_type"); + ligne("URL:$adresse_site/ecrire/message.php3?id_message=$id_message"); + + ligne ("END:VEVENT"); + } +} + +function spip_ical_taches($id_utilisateur, $nom_site, $adresse_site) +{ + $result_messages=spip_query("SELECT messages.* FROM spip_messages AS messages, spip_auteurs_messages AS lien WHERE lien.id_auteur='$id_utilisateur' AND lien.id_message=messages.id_message AND messages.type='pb' AND messages.rv!='oui' AND messages.statut='publie' GROUP BY messages.id_message ORDER BY messages.date_heure"); + while($row=spip_fetch_array($result_messages)){ + $id_message=$row['id_message']; + $date_heure=$row["date_heure"]; + $titre = $row["titre"]; + $texte = $row["texte"]; + $type=$row["type"]; + + if ($type == 'normal') { + $le_type = _T('info_message_2'); + $result_auteurs=spip_query("SELECT auteurs.* FROM spip_auteurs AS auteurs, spip_auteurs_messages AS lien WHERE (lien.id_message='$id_message' AND lien.id_auteur=auteurs.id_auteur)"); + while($row_auteur=spip_fetch_array($result_auteurs)){ + $id_auteur=$row_auteur['id_auteur']; + $nom_auteur=$row_auteur['nom']; + $email = $row_auteur ['email']; + + if ($id_auteur != $id_utilisateur) $titre = $titre." - ".$nom_auteur; + + if ($id_auteur == $id_utilisateur) ligne ("ORGANIZER:$nom_auteur <$email>"); + else ligne ("ATTENDEE:$nom_auteur <$email>"); + } + } + else if ($type == 'pb') { + $le_type = _T('info_pense_bete'); + } + else if ($type == 'affich') { + $le_type = _T('info_annonce'); + $titre = "[$nom_site] $titre"; + } + + ligne ("BEGIN:VTODO"); + ligne ("SUMMARY:".$titre); + ligne ("DESCRIPTION:$texte"); + ligne ("UID:mess$id_message @ $adresse_site"); + ligne ("DTSTAMP:".date_ical($date_heure)); + ligne ("DTSTART:".date_ical($date_heure)); + ligne ("CATEGORIES:$le_type"); + ligne ("URL:$adresse_site/ecrire/message.php3?id_message=$id_message"); + ligne ("END:VTODO"); + } +} + +function spip_ical_articles($nom_site, $adresse_site) +{ + $titres = Array(); + $result_articles = spip_query("SELECT id_article, titre, date FROM spip_articles WHERE statut = 'prop'"); + while($row=spip_fetch_array($result_articles)){ + $id_article=$row['id_article']; + $titre = supprimer_numero($row['titre']); + $titres[] = $titre; + $date_heure = $row['date']; + $nb_articles ++; + ligne ("BEGIN:VEVENT"); + ligne ("SUMMARY:[$nom_site] $titre ("._T('info_article_propose').")"); + ligne ("UID:article$id_article @ $adresse_site"); + ligne ("DTSTAMP:".date ("Ymd\THis", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); + ligne ("DTSTART;VALUE=DATE:".date ("Ymd", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); + ligne ("CATEGORIES:"._T('info_article_propose')); + ligne("URL:$adresse_site/ecrire/articles.php3?id_article=$id_article"); + ligne ("END:VEVENT"); + } + return $nb_articles; +} + + +function spip_ical_breves($nom_site, $adresse_site) +{ + $result = spip_query("SELECT id_breve, titre, date_heure FROM spip_breves WHERE statut = 'prop'"); + while($row=spip_fetch_array($result)){ + $id_breve=$row['id_breve']; + $titre = supprimer_numero($row['titre']); + $titres[] = $titre; + $date_heure = $row['date_heure']; + $nb_breves++; + ligne ("BEGIN:VEVENT"); + ligne ("SUMMARY:[$nom_site] $titre ("._T('item_breve_proposee').")"); + ligne ("UID:breve$id_breve @ $adresse_site"); + ligne ("DTSTAMP:".date ("Ymd\THis", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); + ligne ("DTSTART;VALUE=DATE:".date ("Ymd", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); + ligne ("CATEGORIES:"._T('item_breve_proposee')); + ligne ("URL:$adresse_site/ecrire/breves_voir.php3?id_breve=$id_breve"); + ligne ("END:VEVENT"); + } + return $nb_breves; +} + + +function spip_ical_messages($id_utilisateur, $nom_site, $adresse_site) +{ + $result_messages = spip_query("SELECT * FROM spip_messages AS messages, spip_auteurs_messages AS lien WHERE lien.id_auteur=$id_utilisateur AND vu='non' AND statut='publie' AND type='normal' AND lien.id_message=messages.id_message"); + while($row=spip_fetch_array($result_messages)){ + $id_message=$row['id_message']; + $date_heure=$row["date_heure"]; + $titre = $row["titre"]; + $texte = $row["texte"]; + $type=$row["type"]; + + if ($type == 'normal') { + $le_type = _T('info_message_2'); + $result_auteurs=spip_query("SELECT auteurs.* FROM spip_auteurs AS auteurs, spip_auteurs_messages AS lien WHERE (lien.id_message='$id_message' AND lien.id_auteur=auteurs.id_auteur)"); + while($row_auteur=spip_fetch_array($result_auteurs)){ + $id_auteur=$row_auteur['id_auteur']; + $nom_auteur = $row_auteur['nom']; + $email = $row_auteur ['email']; + + if ($id_auteur != $id_utilisateur) $titre = $nom_auteur." - ".$titre; + + if ($id_auteur == $id_utilisateur) ligne ("ORGANIZER:$nom_auteur <$email>"); + else ligne ("ATTENDEE:$nom_auteur <$email>"); + } + $query_forum = "SELECT * FROM spip_forum WHERE statut='perso' AND id_message='$id_message' ORDER BY date_heure DESC LIMIT 1"; + $result_forum = spip_query($query_forum); + if ($row_forum = spip_fetch_array($result_forum)) { + $date_heure = $row_forum["date_heure"]; + $texte = $row_forum["texte"]; + $titre = $row_forum["titre"]; + $id_auteur = $row_forum["id_auteur"]; + + $result_auteurs2 = spip_query("SELECT * FROM spip_auteurs WHERE id_auteur = $id_auteur"); + if ($row_auteur2 = spip_fetch_array($result_auteurs2)){ + $nom_auteur = $row_auteur2['nom']; + $email = $row_auteur2 ['email']; + + $titre = $nom_auteur." - ".$titre; + } + } + } + else if ($type == 'pb') { + $le_type = _T('info_pense_bete'); + } + else if ($type == 'affich') { + $le_type = _T('info_annonce'); + $titre = "[$nom_site] $titre"; + } + + ligne ("BEGIN:VTODO"); + ligne ("SUMMARY:".$titre); + ligne ("DESCRIPTION:$texte"); + ligne ("UID:nouv_mess$id_message @ $adresse_site"); + ligne ("DTSTAMP:".date ("Ymd\THis", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); + ligne ("DTSTART:".date ("Ymd\THis", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); + ligne ("CATEGORIES:$le_type"); + ligne("URL:$adresse_site/ecrire/message.php3?id_message=$id_message"); + ligne ("END:VTODO"); + } +} + +function spip_ical_forums($id_utilisateur, $nom_site, $adresse_site) +{ + $query_forum = "SELECT * FROM spip_forum WHERE statut = 'prop'"; + $result_forum = spip_query($query_forum); + + while($row=spip_fetch_array($result_forum)){ + $nb_forum ++; + + $id_forum=$row['id_forum']; + $date_heure = $row['date_heure']; + $titre = $row['titre']; + $texte = $row['texte']; + $auteur = $row['auteur']; + $email_auteur = $row['email_auteur']; + if ($email_auteur) $email_auteur = "<$email_auteur>"; + + ligne ("BEGIN:VEVENT"); + ligne ("SUMMARY:[$nom_site] $titre "._T('icone_forum_suivi')); + ligne ("DESCRIPTION:$texte\r$auteur $email_auteur"); + ligne ("UID:forum$id_forum @ $adresse_site"); + ligne ("DTSTAMP:".date ("Ymd\THis", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); + ligne ("DTSTART:".date ("Ymd\THis", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); + ligne ("DTEND:".date ("Ymd\THis", mktime (heures($date_heure),minutes($date_heure)+60,0,mois($date_heure),jour($date_heure),annee($date_heure)))); + ligne ("CATEGORIES:"._T('icone_forum_suivi')); + ligne("URL:$adresse_site/ecrire/controle_forum.php3"); + ligne ("END:VEVENT"); + } + + if ($nb_forum > 0) { + ligne ("BEGIN:VTODO"); + ligne ("SUMMARY:[$nom_site] "._T('icone_forum_suivi').": $nb_forum"); + ligne ("UID:forum @ $adresse_site"); + + $today=getdate(time()); + $jour = $today["mday"]; + $mois=$today["mon"]; + $annee=$today["year"]; + ligne ("DTSTAMP:".date ("Ymd\THis", mktime (12,0,0,$mois,$jour,$annee))); + ligne ("DTSTART:".date ("Ymd\THis", mktime (12,0,0,$mois,$jour,$annee))); + ligne ("CATEGORIES:"._T('icone_forum_suivi')); + ligne("URL:$adresse_site/ecrire/controle_forum.php3"); + ligne ("END:VTODO"); + } +} \ No newline at end of file diff --git a/ecrire/inc_spip_image.php b/ecrire/inc_spip_image.php index b3d0a44a2ffc98a040a7ec7b125d5c32d893f9b5..a91052c59df98ad9fe5b7696d43cee082bae9e2b 100644 --- a/ecrire/inc_spip_image.php +++ b/ecrire/inc_spip_image.php @@ -565,7 +565,6 @@ breves.statut = 'publie' AND rel_breves.id_document ='". "' LIMIT 1"))) $refus = 4; } } } - spip_log("$refus"); if (is_int($refus)) { spip_log("Acces refuse ($refus) au document " . $id_document . ': ' . $file); $fond = 404; diff --git a/spip_cal.php3 b/spip_cal.php3 index 726b517278e983fc559176e0fc0a1d006f146944..407c4f2d1911be418dfcd7e9ba6683a35b6c0f1c 100644 --- a/spip_cal.php3 +++ b/spip_cal.php3 @@ -10,326 +10,23 @@ * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * \***************************************************************************/ +// prendre $var_* comme variables pour eviter les conflits avec les http_vars include ("ecrire/inc_version.php3"); -include_ecrire("inc_filtres.php3"); -include_ecrire("inc_lang.php3"); -include_ecrire("inc_texte.php3"); -include_ecrire("inc_charsets.php3"); -include_ecrire("inc_meta.php3"); -include_ecrire("inc_admin.php3"); -include_ecrire("inc_acces.php3"); +$var_nom = "spip_cal"; -/* -function ligne_x ($texte) { - if (ereg("^BEGIN", $texte)) echo "<br>"; - echo $texte."<br>"; -} -*/ -function ligne ($texte) { - echo filtrer_ical($texte)."\n"; -} +$var_f = find_in_path('inc_' . $var_nom . '.php'); -$nom_site = lire_meta("nom_site"); -$adresse_site = lire_meta("adresse_site"); +if ($var_f) + include($var_f); +elseif (file_exists($var_f = (_DIR_INCLUDE . 'inc_' . $var_nom . '.php'))) + include($var_f); -// securite -unset($id_utilisateur); -$id_auteur = intval($id); - -// verifier la cle -if (verifier_low_sec($id_auteur, $cle, 'ical')) { - $query = "SELECT * FROM spip_auteurs WHERE id_auteur=$id_auteur"; - $result = spip_query($query); - - if ($row = spip_fetch_array($result)) { - $id_utilisateur=$row['id_auteur']; - $nom_utilisateur=$row['nom']; - $statut_utilisateur=$row['statut']; - $langue_utilisateur=$row['lang']; - } -} -if (!$id_utilisateur) { - echo _T('info_acces_interdit'); - exit; -} - -lang_select($langue_utilisateur); - -@header("Content-Type: text/calendar; charset=utf-8"); - -ligne ("BEGIN:VCALENDAR"); -ligne ("CALSCALE:GREGORIAN"); -ligne ("X-WR-CALNAME;VALUE=TEXT:$nom_site / $nom_utilisateur"); -ligne ("X-WR-RELCALID:cal$id_utilisateur @ $adresse_site"); - - -// rendez-vous -$result_messages=spip_query("SELECT messages.* FROM spip_messages AS messages, spip_auteurs_messages AS lien WHERE ((lien.id_auteur='$id_utilisateur' AND lien.id_message=messages.id_message) OR messages.type='affich') AND messages.rv='oui' AND messages.statut='publie' GROUP BY messages.id_message ORDER BY messages.date_heure"); -while($row=spip_fetch_array($result_messages)){ - $id_message=$row['id_message']; - $date_heure=$row["date_heure"]; - $date_heure_fin=$row["date_fin"]; - //$titre=typo($row["titre"]); - $titre = $row["titre"]; - $texte = $row["texte"]; - $type=$row["type"]; - - if ($type == 'normal') { - $le_type = _T('info_message_2'); - $result_auteurs=spip_query("SELECT auteurs.* FROM spip_auteurs AS auteurs, spip_auteurs_messages AS lien WHERE (lien.id_message='$id_message' AND lien.id_auteur=auteurs.id_auteur)"); - while($row_auteur=spip_fetch_array($result_auteurs)){ - $id_auteur=$row_auteur['id_auteur']; - $nom_auteur=$row_auteur['nom']; - $email = $row_auteur ['email']; - - if ($id_auteur != $id_utilisateur) $titre = $titre." - ".$nom_auteur; - - if ($id_auteur == $id_utilisateur) ligne ("ORGANIZER:$nom_auteur <$email>"); - else ligne ("ATTENDEE:$nom_auteur <$email>"); - } - } - else if ($type == 'pb') { - $le_type = _T('info_pense_bete'); - } - else if ($type == 'affich') { - $le_type = _T('info_annonce'); - $titre = "[$nom_site] $titre"; - } - - ligne ("BEGIN:VEVENT"); - ligne ("SUMMARY:".$titre); - ligne ("DESCRIPTION:$texte"); - ligne ("UID:mess$id_message @ $adresse_site"); - ligne ("DTSTAMP:".date_ical($date_heure)); - ligne ("DTSTART:".date_ical($date_heure)); - if ($date_heure_fin > $date_heure) ligne ("DTEND:".date_ical($date_heure_fin)); - - ligne ("CATEGORIES:$le_type"); - ligne("URL:$adresse_site/ecrire/message.php3?id_message=$id_message"); - - ligne ("END:VEVENT"); - -} - -// todo -$result_messages=spip_query("SELECT messages.* FROM spip_messages AS messages, spip_auteurs_messages AS lien WHERE lien.id_auteur='$id_utilisateur' AND lien.id_message=messages.id_message AND messages.type='pb' AND messages.rv!='oui' AND messages.statut='publie' GROUP BY messages.id_message ORDER BY messages.date_heure"); -while($row=spip_fetch_array($result_messages)){ - $id_message=$row['id_message']; - $date_heure=$row["date_heure"]; - $titre = $row["titre"]; - $texte = $row["texte"]; - $type=$row["type"]; - - if ($type == 'normal') { - $le_type = _T('info_message_2'); - $result_auteurs=spip_query("SELECT auteurs.* FROM spip_auteurs AS auteurs, spip_auteurs_messages AS lien WHERE (lien.id_message='$id_message' AND lien.id_auteur=auteurs.id_auteur)"); - while($row_auteur=spip_fetch_array($result_auteurs)){ - $id_auteur=$row_auteur['id_auteur']; - $nom_auteur=$row_auteur['nom']; - $email = $row_auteur ['email']; - - if ($id_auteur != $id_utilisateur) $titre = $titre." - ".$nom_auteur; - - if ($id_auteur == $id_utilisateur) ligne ("ORGANIZER:$nom_auteur <$email>"); - else ligne ("ATTENDEE:$nom_auteur <$email>"); - } - } - else if ($type == 'pb') { - $le_type = _T('info_pense_bete'); - } - else if ($type == 'affich') { - $le_type = _T('info_annonce'); - $titre = "[$nom_site] $titre"; - } - - ligne ("BEGIN:VTODO"); - ligne ("SUMMARY:".$titre); - ligne ("DESCRIPTION:$texte"); - ligne ("UID:mess$id_message @ $adresse_site"); - ligne ("DTSTAMP:".date_ical($date_heure)); - ligne ("DTSTART:".date_ical($date_heure)); - ligne ("CATEGORIES:$le_type"); - ligne ("URL:$adresse_site/ecrire/message.php3?id_message=$id_message"); - ligne ("END:VTODO"); - -} - -// Articles et breves proposes -$titres = Array(); -$result_articles = spip_query("SELECT id_article, titre, date FROM spip_articles WHERE statut = 'prop'"); -while($row=spip_fetch_array($result_articles)){ - $id_article=$row['id_article']; - $titre = supprimer_numero($row['titre']); - $titres[] = $titre; - $date_heure = $row['date']; - $nb_articles ++; - ligne ("BEGIN:VEVENT"); - ligne ("SUMMARY:[$nom_site] $titre ("._T('info_article_propose').")"); - ligne ("UID:article$id_article @ $adresse_site"); - ligne ("DTSTAMP:".date ("Ymd\THis", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); - ligne ("DTSTART;VALUE=DATE:".date ("Ymd", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); - ligne ("CATEGORIES:"._T('info_article_propose')); - ligne("URL:$adresse_site/ecrire/articles.php3?id_article=$id_article"); - ligne ("END:VEVENT"); -} - -$result_articles = spip_query("SELECT id_breve, titre, date_heure FROM spip_breves WHERE statut = 'prop'"); -while($row=spip_fetch_array($result_articles)){ - $id_breve=$row['id_breve']; - $titre = supprimer_numero($row['titre']); - $titres[] = $titre; - $date_heure = $row['date_heure']; - $nb_breves++; - ligne ("BEGIN:VEVENT"); - ligne ("SUMMARY:[$nom_site] $titre ("._T('item_breve_proposee').")"); - ligne ("UID:breve$id_breve @ $adresse_site"); - ligne ("DTSTAMP:".date ("Ymd\THis", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); - ligne ("DTSTART;VALUE=DATE:".date ("Ymd", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); - ligne ("CATEGORIES:"._T('item_breve_proposee')); - ligne ("URL:$adresse_site/ecrire/breves_voir.php3?id_breve=$id_breve"); - ligne ("END:VEVENT"); - -} - -if ($nb_articles + $nb_breves > 0) { - if ($nb_articles > 0) $titre_prop[] = _T('info_articles_proposes').": ".$nb_articles; - if ($nb_breves > 0) $titre_prop[] = _T('info_breves_valider').": ".$nb_breves; - $titre = join($titre_prop," / "); - ligne ("BEGIN:VTODO"); - ligne ("SUMMARY:[$nom_site] $titre"); - ligne ("UID:prop @ $adresse_site"); - $texte = join($titres," / "); - ligne ("DESCRIPTION:$texte"); - - $today=getdate(time()); - $jour = $today["mday"]; - $mois=$today["mon"]; - $annee=$today["year"]; - ligne ("DTSTAMP:".date ("Ymd\THis", mktime (12,0,0,$mois,$jour,$annee))); - ligne ("DTSTART:".date ("Ymd\THis", mktime (12,0,0,$mois,$jour,$annee))); - ligne ("CATEGORIES:"._T('icone_a_suivre')); - ligne ("URL:$adresse_site/ecrire/"); - ligne ("END:VTODO"); -} - - -// Nouveaux messages - -$result_messages = spip_query("SELECT * FROM spip_messages AS messages, spip_auteurs_messages AS lien WHERE lien.id_auteur=$id_utilisateur AND vu='non' AND statut='publie' AND type='normal' AND lien.id_message=messages.id_message"); -while($row=spip_fetch_array($result_messages)){ - $id_message=$row['id_message']; - $date_heure=$row["date_heure"]; - $titre = $row["titre"]; - $texte = $row["texte"]; - $type=$row["type"]; - - if ($type == 'normal') { - $le_type = _T('info_message_2'); - $result_auteurs=spip_query("SELECT auteurs.* FROM spip_auteurs AS auteurs, spip_auteurs_messages AS lien WHERE (lien.id_message='$id_message' AND lien.id_auteur=auteurs.id_auteur)"); - while($row_auteur=spip_fetch_array($result_auteurs)){ - $id_auteur=$row_auteur['id_auteur']; - $nom_auteur = $row_auteur['nom']; - $email = $row_auteur ['email']; - - if ($id_auteur != $id_utilisateur) $titre = $nom_auteur." - ".$titre; - - if ($id_auteur == $id_utilisateur) ligne ("ORGANIZER:$nom_auteur <$email>"); - else ligne ("ATTENDEE:$nom_auteur <$email>"); - } - $query_forum = "SELECT * FROM spip_forum WHERE statut='perso' AND id_message='$id_message' ORDER BY date_heure DESC LIMIT 1"; - $result_forum = spip_query($query_forum); - if ($row_forum = spip_fetch_array($result_forum)) { - $date_heure = $row_forum["date_heure"]; - $texte = $row_forum["texte"]; - $titre = $row_forum["titre"]; - $id_auteur = $row_forum["id_auteur"]; - - $result_auteurs2 = spip_query("SELECT * FROM spip_auteurs WHERE id_auteur = $id_auteur"); - if ($row_auteur2 = spip_fetch_array($result_auteurs2)){ - $nom_auteur = $row_auteur2['nom']; - $email = $row_auteur2 ['email']; - - $titre = $nom_auteur." - ".$titre; - } - } - } - else if ($type == 'pb') { - $le_type = _T('info_pense_bete'); - } - else if ($type == 'affich') { - $le_type = _T('info_annonce'); - $titre = "[$nom_site] $titre"; - } - - - - ligne ("BEGIN:VTODO"); - ligne ("SUMMARY:".$titre); - ligne ("DESCRIPTION:$texte"); - ligne ("UID:nouv_mess$id_message @ $adresse_site"); - ligne ("DTSTAMP:".date ("Ymd\THis", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); - ligne ("DTSTART:".date ("Ymd\THis", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); - ligne ("CATEGORIES:$le_type"); - ligne("URL:$adresse_site/ecrire/message.php3?id_message=$id_message"); - ligne ("END:VTODO"); - -} - -// Messages de forum a valider -if ($statut_utilisateur == "0minirezo") { - - $query_forum = "SELECT * FROM spip_forum WHERE statut = 'prop'"; - $result_forum = spip_query($query_forum); - - while($row=spip_fetch_array($result_forum)){ - $nb_forum ++; - - $id_forum=$row['id_forum']; - $date_heure = $row['date_heure']; - $titre = $row['titre']; - $texte = $row['texte']; - $auteur = $row['auteur']; - $email_auteur = $row['email_auteur']; - if ($email_auteur) $email_auteur = "<$email_auteur>"; - - ligne ("BEGIN:VEVENT"); - ligne ("SUMMARY:[$nom_site] $titre "._T('icone_forum_suivi')); - ligne ("DESCRIPTION:$texte\r$auteur $email_auteur"); - ligne ("UID:forum$id_forum @ $adresse_site"); - ligne ("DTSTAMP:".date ("Ymd\THis", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); - ligne ("DTSTART:".date ("Ymd\THis", mktime (heures($date_heure),minutes($date_heure),0,mois($date_heure),jour($date_heure),annee($date_heure)))); - ligne ("DTEND:".date ("Ymd\THis", mktime (heures($date_heure),minutes($date_heure)+60,0,mois($date_heure),jour($date_heure),annee($date_heure)))); - ligne ("CATEGORIES:"._T('icone_forum_suivi')); - ligne("URL:$adresse_site/ecrire/controle_forum.php3"); - ligne ("END:VEVENT"); - - - - } - - if ($nb_forum > 0) { - ligne ("BEGIN:VTODO"); - ligne ("SUMMARY:[$nom_site] "._T('icone_forum_suivi').": $nb_forum"); - ligne ("UID:forum @ $adresse_site"); - - $today=getdate(time()); - $jour = $today["mday"]; - $mois=$today["mon"]; - $annee=$today["year"]; - ligne ("DTSTAMP:".date ("Ymd\THis", mktime (12,0,0,$mois,$jour,$annee))); - ligne ("DTSTART:".date ("Ymd\THis", mktime (12,0,0,$mois,$jour,$annee))); - ligne ("CATEGORIES:"._T('icone_forum_suivi')); - ligne("URL:$adresse_site/ecrire/controle_forum.php3"); - ligne ("END:VTODO"); - } -} - - - - -ligne ("END:VCALENDAR"); - - -?> \ No newline at end of file +if (function_exists($var_nom)) + $var_nom($id, $cle); +elseif (function_exists($var_f = $var_nom . "_dist")) + $var_f($id, $cle); + else + spip_log("fonction $nom indisponible"); +?> diff --git a/spip_image.php3 b/spip_image.php3 index bc7e3db12bf6ed6ef625c7aca2265cb2f6bf5802..2ec20d4dc9c6fc63ebfd5a37f4d4b01008443e57 100644 --- a/spip_image.php3 +++ b/spip_image.php3 @@ -10,26 +10,25 @@ * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * \***************************************************************************/ -// Charger un document, une image, un logo, un repertoire -// supprimer cet element, creer les vignettes, etc. +// prendre $var_* comme variables pour eviter les conflits avec les http_vars include ("ecrire/inc_version.php3"); -$nom = "spip_image"; +$var_nom = "spip_image"; -$f = find_in_path('inc_' . $nom . '.php'); +$var_f = find_in_path('inc_' . $var_nom . '.php'); -if ($f) - include($f); -elseif (file_exists($f = (_DIR_INCLUDE . 'inc_' . $nom . '.php'))) - include($f); +if ($var_f) + include($var_f); +elseif (file_exists($var_f = (_DIR_INCLUDE . 'inc_' . $var_nom . '.php'))) + include($var_f); -$nom .= '_' . $action; +$var_nom .= '_' . $action; -if (function_exists($nom)) - $nom($doc); -elseif (function_exists($f = $nom . '_' . "_dist")) - $f($doc); +if (function_exists($var_nom)) + $var_nom($doc); +elseif (function_exists($var_f = $var_nom . '_' . "_dist")) + $var_f($doc); else - spip_log("fonction $nom indisponible"); + spip_log("fonction $var_nom indisponible"); ?>