diff --git a/ecrire/articles.php3 b/ecrire/articles.php3 index 17f58d4a0e728018d8fca7f90c2e4b349279e668..36546c015efb460b4c158da4aee4254ab03dad9a 100644 --- a/ecrire/articles.php3 +++ b/ecrire/articles.php3 @@ -157,7 +157,7 @@ if ($jour_redac && $flag_editable) { // Appliquer la modification de langue if (lire_meta('multi_articles') == 'oui' AND $flag_editable) { - $row = spip_fetch_array(spip_query("SELECT lang FROM spip_rubriques WHERE id_rubrique=$rubrique_article")); + $row = spip_fetch_array(spip_query("SELECT lang FROM spip_rubriques WHERE id_rubrique=" . intval($rubrique_article))); $langue_parent = $row['lang']; if ($changer_lang) { diff --git a/ecrire/calendrier.php3 b/ecrire/calendrier.php3 index c824504273b481b3abc0549ebb3791e174281982..349478efc6bd751d9b7486aaad8af3e9b6bc3970 100644 --- a/ecrire/calendrier.php3 +++ b/ecrire/calendrier.php3 @@ -11,28 +11,70 @@ \***************************************************************************/ -if (isset($_GET['type'])) -{ - if ($_GET['type'] == 'semaine') - { include ("calendrier_semaine.php3");exit;} - else if ($_GET['type'] == 'jour') - { include ("calendrier_jour.php3");exit;} -} -include ("inc.php3"); -include_ecrire ("inc_calendrier.php"); + // ce script peut etre recopie a la racine pour obtenir le calendrier + // a partir de l'espace public. + // Evidemment les messages internes a la redaction seront absents. + +include((@is_dir("ecrire") ? 'ecrire/' : '') . "inc_version.php3"); + +if (!_DIR_RESTREINT) + include ("inc.php3"); + else { + include_ecrire("inc_presentation.php3"); + include_ecrire("inc_calendrier.php"); + include_ecrire("inc_texte.php3"); + include_ecrire("inc_layer.php3"); + } $today=getdate(time()); +$jour_today = $today["mday"]; +$mois_today = $today["mon"]; +$annee_today = $today["year"]; // sans arguments => mois courant -if (!$mois){$annee=$today["year"];$mois=$today["mon"]; } -$periode = $annee . '-' . sprintf("%02d", $mois) . '-01'; +if (!$mois){ + $jour=$jour_today; + $mois=$mois_today; + $annee=$annee_today; +} + +$date = date("Y-m-d", mktime(0,0,0,$mois, $jour, $annee)); +$jour = journum($date); +$mois = mois($date); +$annee = annee($date); + +if (!isset($type)) $type = 'mois'; $afficher_bandeau_calendrier = true; -debut_page(_T('titre_page_calendrier', - array('nom_mois' => nom_mois($periode), 'annee' => $annee)), - "redacteurs", - "calendrier"); +if ($type == 'semaine') { + $afficher_bandeau_calendrier_semaine = true; + + $titre = _T('titre_page_calendrier', + array('nom_mois' => nom_mois($date), 'annee' => $annee)); + } +elseif ($type == 'jour') { + $titre = nom_jour("$annee-$mois-$jour")." ". + affdate_jourcourt("$annee-$mois-$jour"); + $jour = $jour_today; + $mois = $mois_today; + $annee = $annee_today; + } + else { + $type = 'mois'; + $jour = '01'; + $titre = _T('titre_page_calendrier', + array('nom_mois' => nom_mois($annee . '-' . sprintf("%02d", $mois) . '-01'), + 'annee' => $annee)); + } + +if (!_DIR_RESTREINT) + debut_page($titre, "redacteurs", "calendrier"); + else debut_html($titre); + +$f = 'http_calendrier_init_' . $type; +echo $f($jour,$mois,$annee, $date); + +if (!_DIR_RESTREINT) fin_page(); else echo "</body></html>\n"; -echo http_calendrier_tout($mois,$annee, '01', '31'); ?> diff --git a/ecrire/calendrier_jour.php3 b/ecrire/calendrier_jour.php3 index 13e9d4b7ac54559e19cc438a0e79a597120cabdc..623d59f287d7dbbe04ed475a0b248489bbccfdd7 100644 --- a/ecrire/calendrier_jour.php3 +++ b/ecrire/calendrier_jour.php3 @@ -10,39 +10,7 @@ * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * \***************************************************************************/ - -include ("inc.php3"); -include_ecrire ("inc_calendrier.php"); - -$today=getdate(time()); -$jour_today = $today["mday"]; -$mois_today = $today["mon"]; -$annee_today = $today["year"]; - -// sans arguments => mois courant -if (!$mois){ - $jour=$jour_today; - $mois=$mois_today; - $annee=$annee_today; -} - -$date = date("Y-m-d", mktime(0,0,0,$mois, $jour, $annee)); -$jour = journum($date); -$mois = mois($date); -$annee = annee($date); - - -$afficher_bandeau_calendrier = true; - -debut_page(nom_jour("$annee-$mois-$jour")." ". affdate_jourcourt("$annee-$mois-$jour"), - "redacteurs", - "calendrier"); - -debut_gauche(); - -echo http_calendrier_journee($jour_today,$mois_today,$annee_today, - date("Y-m-d", mktime(0,0,0,$mois, $jour, $annee))); - -fin_page(); - +$type = 'jour'; +include ("calendrier.php3"); +exit; ?> diff --git a/ecrire/calendrier_semaine.php3 b/ecrire/calendrier_semaine.php3 index cd08253f6cdec88a43042d6a52d44395515920a4..cb1d6042273ca9a4008de6cedaf53bdbd2d6b57b 100644 --- a/ecrire/calendrier_semaine.php3 +++ b/ecrire/calendrier_semaine.php3 @@ -10,31 +10,7 @@ * Pour plus de details voir le fichier COPYING.txt ou l'aide en ligne. * \***************************************************************************/ - -include ("inc.php3"); - -// sans arguments => mois courant -if (!$mois){ - $today=getdate(time()); - $jour=$today["mday"]; - $mois=$today["mon"]; - $annee=$today["year"]; -} - -$date = date("Y-m-d", mktime(0,0,0,$mois, $jour, $annee)); -$jour = journum($date); -$mois = mois($date); -$annee = annee($date); - -$afficher_bandeau_calendrier = true; -$afficher_bandeau_calendrier_semaine = true; - -debut_page(_T('titre_page_calendrier', - array('nom_mois' => nom_mois($date), 'annee' => $annee)), - "redacteurs", - "calendrier"); - -echo http_calendrier_semaine($jour,$mois,$annee); - -// fin_page(); +$type = 'semaine'; +include ("calendrier.php3"); +exit; ?> diff --git a/ecrire/inc_calendrier.php b/ecrire/inc_calendrier.php index 4ce3c157cdfd3d536a9610b0744257ba6db824bc..3af961340b0b99b58629c9612b6827fe361a1beb 100644 --- a/ecrire/inc_calendrier.php +++ b/ecrire/inc_calendrier.php @@ -132,7 +132,7 @@ function http_calendrier_ics($evenements, $amj = "") # affiche un mois en grand, avec des tableau de clics vers d'autres mois -function http_calendrier_tout($mois, $annee, $premier_jour, $dernier_jour) +function http_calendrier_init_mois($premier_jour, $mois, $annee, $date) { global $spip_lang_left, $largeur_table, $largeur_gauche, $spip_ecran; @@ -149,6 +149,7 @@ function http_calendrier_tout($mois, $annee, $premier_jour, $dernier_jour) 'http_calendrier_clics' : 'http_calendrier_sans_clics';*/ $fclic = 'http_calendrier_clics'; + $dernier_jour = 31; while (!(checkdate($mois,$dernier_jour,$annee))) $dernier_jour--; $today=getdate(time()); $m=$today["mon"]; @@ -192,7 +193,8 @@ function http_calendrier_tout($mois, $annee, $premier_jour, $dernier_jour) function http_calendrier_aide_mess() { global $bleu, $vert, $jaune; - return + if (_DIR_RESTREINT) return ""; + return "<br /><br /><br />\n<table width='700'>\n<tr><td><font face='arial,helvetica,sans-serif' size='2'>" . "<b>"._T('info_aide')."</b>" . "<br />$bleu "._T('info_symbole_bleu')."\n" . @@ -597,8 +599,9 @@ function http_calendrier_clics($annee, $mois, $jour, $clic) $href = "message_edit.php3?rv=$annee-$mois-$jour&new=oui"; return "\n" . - http_href("calendrier_jour.php3?jour=$jour&mois=$mois&annee=$annee", $clic) . + http_href("calendrier.php3?type=jour&jour=$jour&mois=$mois&annee=$annee", $clic) . "\n" . + (_DIR_RESTREINT ? '' : ( http_href("$href&type=pb", $bleu, _T("lien_nouvea_pense_bete"), @@ -607,13 +610,13 @@ function http_calendrier_clics($annee, $mois, $jour, $clic) http_href("$href&type=normal", $vert, _T("lien_nouveau_message"), - 'color: green; font-family: Arial, Sans, sans-serif; font-size: 10px; ') . + 'color: green; font-family: Arial, Sans, sans-serif; font-size: 10px; '))) . (($GLOBALS['connect_statut'] != "0minirezo") ? "" : ("\n" . http_href("$href&type=affich", $jaune, _T("lien_nouvelle_annonce"), - 'color: #ff9900; font-family: Arial, Sans, sans-serif; font-size: 10px; '))); + 'color: #ff9900; font-family: Arial, Sans, sans-serif; font-size: 10px; '))); } # dispose les evenements d'une semaine @@ -1085,7 +1088,7 @@ function http_calendrier_jour_ics($debut, $fin, $largeur, $detcolor, $echelle, $ } -function http_calendrier_journee($jour_today,$mois_today,$annee_today, $date){ +function http_calendrier_init_jour($jour_today,$mois_today,$annee_today, $date){ global $largeur_table, $largeur_gauche, $spip_ecran; $jour = journum($date); $mois = mois($date); @@ -1100,7 +1103,7 @@ function http_calendrier_journee($jour_today,$mois_today,$annee_today, $date){ $largeur_centre = $largeur_table - ($largeur_gauche + 20); } - $retour = "<table cellpadding=0 cellspacing=0 border=0 width='$largeur_table'><tr>"; + $retour = "<div> </div><table cellpadding=0 cellspacing=0 border=0 width='$largeur_table'><tr>"; if ($spip_ecran == "large") { $retour .= "<td width='$largeur_gauche' class='verdana1' valign='top'>" . @@ -1127,7 +1130,7 @@ function http_calendrier_journee($jour_today,$mois_today,$annee_today, $date){ return $retour; } -function http_calendrier_semaine($jour_today,$mois_today,$annee_today) +function http_calendrier_init_semaine($jour_today,$mois_today,$annee_today,$date) { global $spip_ecran, $spip_lang_left, $couleur_claire; @@ -1209,7 +1212,7 @@ function http_calendrier_jour($jour,$mois,$annee,$large = "large", $le_message = if ($large == "col" ) { $entete = "<div align='center' style='padding: 5px;'><b class='verdana1'>" . - http_href("calendrier_jour.php3?jour=$jour&mois=$mois&annee=$annee", + http_href("calendrier.php3?type=jour&jour=$jour&mois=$mois&annee=$annee", affdate_jourcourt("$annee-$mois-$jour"), '', 'color:black;') . @@ -1440,11 +1443,13 @@ WHERE statut='publie' AND date < $apres ORDER BY date "); + $script = (_DIR_RESTREINT ? 'article' : 'articles'); while($row=spip_fetch_array($result)){ $amj = sql_calendrier_jour_ical($row['date']); $evenements[$amj][]= array( - 'URL' => "articles.php3?id_article=" . $row['id_article'], + 'URL' => $script . _EXTENSION_PHP . "?id_article=" . + $row['id_article'], 'CATEGORIES' => 'a', 'DESCRIPTION' => $row['titre']); } @@ -1463,9 +1468,10 @@ ORDER BY date_heure "); while($row=spip_fetch_array($result)){ $amj = sql_calendrier_jour_ical($row['date_heure']); + $script = (_DIR_RESTREINT ? 'breve' : 'breves_voir'); $evenements[$amj][]= array( - 'URL' => "breves_voir.php3?id_breve=" . $row['id_breve'], + 'URL' => $script . _EXTENSION_PHP . "?id_breve=" . $row['id_breve'], 'CATEGORIES' => 'b', 'DESCRIPTION' => $row['titre']); } @@ -1475,6 +1481,7 @@ ORDER BY date_heure function sql_calendrier_interval_rv($avant, $apres) { global $connect_id_auteur; $evenements= array(); + if (!$connect_id_auteur) return $evenements; $result=spip_query(" SELECT messages.id_message, messages.titre, messages.texte, messages.date_heure, messages.date_fin, messages.type @@ -1557,7 +1564,9 @@ WHERE (lien.id_message='$id_message' function sql_calendrier_taches_annonces () { + global $connect_id_auteur; $r = array(); + if (!$connect_id_auteur) return $r; $result = spip_query(" SELECT * FROM spip_messages WHERE type = 'affich' AND rv != 'oui' AND statut = 'publie' ORDER BY date_heure DESC"); @@ -1569,6 +1578,7 @@ WHERE type = 'affich' AND rv != 'oui' AND statut = 'publie' ORDER BY date_heure function sql_calendrier_taches_pb () { global $connect_id_auteur; $r = array(); + if (!$connect_id_auteur) return $r; $result = spip_query(" SELECT * FROM spip_messages AS messages WHERE id_auteur=$connect_id_auteur AND statut='publie' AND type='pb' AND rv!='oui'"); @@ -1582,6 +1592,7 @@ WHERE id_auteur=$connect_id_auteur AND statut='publie' AND type='pb' AND rv!='ou function sql_calendrier_taches_rv () { global $connect_id_auteur; $r = array(); + if (!$connect_id_auteur) return $r; $result = spip_query(" SELECT messages.* FROM spip_messages AS messages, spip_auteurs_messages AS lien @@ -1605,13 +1616,14 @@ ORDER BY messages.date_heure"); function sql_calendrier_agenda ($mois, $annee) { global $connect_id_auteur; + $rv = array(); + if (!$connect_id_auteur) return $rv; $date = date("Y-m-d", mktime(0,0,0,$mois, 1, $annee)); $mois = mois($date); $annee = annee($date); // rendez-vous personnels dans le mois $result_messages=spip_query("SELECT messages.date_heure FROM spip_messages AS messages, spip_auteurs_messages AS lien WHERE ((lien.id_auteur='$connect_id_auteur' AND lien.id_message=messages.id_message) OR messages.type='affich') AND messages.rv='oui' AND messages.date_heure >='$annee-$mois-1' AND date_heure < DATE_ADD('$annee-$mois-1', INTERVAL 1 MONTH) AND messages.statut='publie'"); - $rv = array(); while($row=spip_fetch_array($result_messages)){ $rv[journum($row['date_heure'])] = 1; } diff --git a/ecrire/inc_filtres.php3 b/ecrire/inc_filtres.php3 index 479f4f06d1bd49392304a283243827c3634335a7..16768c32ca12b6ef943f07871c4400192702f272 100644 --- a/ecrire/inc_filtres.php3 +++ b/ecrire/inc_filtres.php3 @@ -118,15 +118,29 @@ function http_href($href, $clic, $title='', $style='', $class='', $evt='') { return '<a href="' . str_replace('&', '&', $href) . '"' . - (!$style ? '' : (" style=\"" . $style . "\"")) . - (!$title ? '' : (" title=\"" . supprimer_tags($title)."\"")) . - (!$class ? '' : (" class=\"" . $class . "\"")) . - ($evt ? " $evt" : '') . + (!$title ? '' : ("\ntitle=\"" . supprimer_tags($title)."\"")) . + (!$style ? '' : ("\nstyle=\"" . $style . "\"")) . + (!$class ? '' : ("\nclass=\"" . $class . "\"")) . + ($evt ? "\n$evt" : '') . '>' . $clic . '</a>'; } +// produit une balise img avec un champ alt d'office (et different) si vide +// attention le htmlentities et la traduction doivent etre appliques avant. + +function http_img_pack($img, $alt, $att) { + static $num = 0; + return "<img src='" . _DIR_IMG_PACK . $img . + ("'\nalt=\"" . ($alt ? $alt : ('img_pack' . $num++)) . '" ') . + $att . " />"; +} + +function http_href_img($href, $img, $att, $title='', $style='', $class='', $evt='') { + return http_href($href, http_img_pack($img, $title, $att), $title, $style, $class, $evt); +} + // Corrige les caracteres degoutants utilises par les Windozeries function corriger_caracteres($texte) { static $trans; diff --git a/ecrire/inc_presentation.php3 b/ecrire/inc_presentation.php3 index 5645a980937e760819cf6ea6cba426b3d31c359c..8742050b3d031e7d57bbe676d1b3884b643d34f4 100644 --- a/ecrire/inc_presentation.php3 +++ b/ecrire/inc_presentation.php3 @@ -16,7 +16,7 @@ if (defined("_ECRIRE_INC_PRESENTATION")) return; define("_ECRIRE_INC_PRESENTATION", "1"); -include_ecrire("inc_filtres.php3"); # pour http_script (normalement déjà fait) +include_ecrire("inc_filtres.php3"); # pour les fonctions http_* (normalement deja la) include_ecrire ("inc_lang.php3"); utiliser_langue_visiteur(); @@ -1595,14 +1595,11 @@ function debut_html($titre = "", $rubrique="", $onLoad="") { // < script type="text/javascript" src="js_detectplugins.js"></script> debut_javascript($connect_statut == "0minirezo" AND $connect_toutes_rubriques, (lire_meta("activer_statistiques") != 'non')); -?> - <link rel="alternate stylesheet" href="spip_style_invisible.css" type="text/css" title="invisible" /> - <link rel="stylesheet" href="spip_style_visible.css" type="text/css" title="visible" /> - <link rel="stylesheet" href="spip_style_print.css" type="text/css" media="print"> -</head> -<?php - echo "<body text='#000000' bgcolor='#f8f7f3' link='$couleur_lien' vlink='$couleur_lien_off' alink='$couleur_lien_off' topmargin='0' leftmargin='0' marginwidth='0' marginheight='0' frameborder='0'"; + echo '<link rel="alternate stylesheet" href="', _DIR_RESTREINT, 'spip_style_invisible.css" type="text/css" title="invisible" />', "\n", + '<link rel="stylesheet" href="', _DIR_RESTREINT, 'spip_style_visible.css" type="text/css" title="visible" />', "\n", + '<link rel="stylesheet" href="', _DIR_RESTREINT, 'spip_style_print.css" type="text/css" media="print">', "\n", + "</head>\n<body text='#000000' bgcolor='#f8f7f3' link='$couleur_lien' vlink='$couleur_lien_off' alink='$couleur_lien_off' topmargin='0' leftmargin='0' marginwidth='0' marginheight='0' frameborder='0'"; if ($spip_lang_rtl) echo " dir='rtl'"; @@ -2370,13 +2367,15 @@ else { // Choix de la couleur: automatique en fonction de $couleurs_spip $link = new Link; - ksort($couleurs_spip); - while (list($key,$val) = each($couleurs_spip)) { + if ($couleurs_spip) { + ksort($couleurs_spip); + while (list($key,$val) = each($couleurs_spip)) { $link->delVar('set_couleur'); $link->addVar('set_couleur', $key); echo "<a href=\"".$link->getUrl()."\">" . http_img_pack("rien.gif", "", "width='8' height='8' border='0' style='margin: 1px; background-color: ".$couleurs_spip[$key]['couleur_claire'].";' onMouseOver=\"changestyle('bandeauinterface','visibility', 'visible');\""). "</a>"; + } } // echo "<img src=_DIR_IMG_PACK . 'rien.gif' width='10' height='1' />"; echo "</td>"; @@ -3151,24 +3150,10 @@ function voir_en_ligne ($type, $id, $statut=false, $image='racine-24.gif') { icone_horizontale($message, "../spip_redirect.php3?id_$type=$id&$en_ligne=oui", $image, "rien.gif"); } -// produit une balise img avec un champ alt d'office (et different) si vide -// attention le htmlentities et la traduction doivent etre appliques avant. - -function http_img_pack($img, $alt, $att) { - static $num = 0; - return "<img src='" . _DIR_IMG_PACK . $img . - ("'\nalt=\"" . ($alt ? $alt : ('img_pack' . $num++)) . '" ') . - $att . " />"; -} function http_style_background($img, $att='') { return " style='background: url(\"" . _DIR_IMG_PACK . $img . '")' . ($att ? (' ' . $att) : '') . ";'"; } - -function http_href_img($href, $img, $att, $title='', $style='', $class='', $evt='') { - return http_href($href, http_img_pack($img, $title, $att), $title, $style, $class, $evt); -} - ?> diff --git a/spip_admin.css b/spip_admin.css index e5b93e41e62d449262fea5069e79aeda246dd84d..92b63a4dfa1ce47169ab4c5f53a3ab50f4c45880 100644 --- a/spip_admin.css +++ b/spip_admin.css @@ -63,7 +63,7 @@ a:active.spip-admin-boutons { #spip-debug fieldset { background-color: #FFF; font-family: "Courier New", Courier, monospace; - font-size: 12; + font-size: 12px; } #spip-debug legend {