|
|
|
@ -106,7 +106,8 @@ function calendrier_args_time($time, $script, $type, $fin = '') {
|
|
|
|
|
|
|
|
|
|
// https://code.spip.net/@calendrier_href
|
|
|
|
|
function calendrier_href($script, $annee, $mois, $jour, $type, $fin, $ancre, $img, $titre, $class = '', $alt = '', $clic = '', $style = '', $evt = '') {
|
|
|
|
|
static $moi = null;
|
|
|
|
|
$h = null;
|
|
|
|
|
static $moi = null;
|
|
|
|
|
// pas d'Ajax pour l'espace public pour le moment ou si indispo
|
|
|
|
|
// sinon preparer la RegExp qui l'empeche aussi pour la page elle-meme
|
|
|
|
|
if ($moi === null) {
|
|
|
|
@ -118,7 +119,7 @@ function calendrier_href($script, $annee, $mois, $jour, $type, $fin, $ancre, $im
|
|
|
|
|
$url = calendrier_args_time($d, $script, $type, $fin) . ($ancre ? "#$ancre" : '');
|
|
|
|
|
$c = ($class ? " class=\"$class\"" : '');
|
|
|
|
|
|
|
|
|
|
if ($img) { $clic = http_img_pack($img, ($alt ? $alt : $titre), $c);
|
|
|
|
|
if ($img) { $clic = http_img_pack($img, ($alt ?: $titre), $c);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($moi and preg_match($moi, $script)) {
|
|
|
|
@ -203,7 +204,7 @@ function calendrier_height($heure, $heurefin, $debut, $fin, $dimheure, $dimjour)
|
|
|
|
|
// https://code.spip.net/@http_calendrier_init
|
|
|
|
|
function http_calendrier_init($time = '', $type = 'mois', $echelle = '', $partie_cal = '', $script = '', $evt = null) {
|
|
|
|
|
if (is_array($time)) {
|
|
|
|
|
list($j,$m,$a) = $time;
|
|
|
|
|
[$j, $m, $a] = $time;
|
|
|
|
|
if ($j + $m + $a) { $time = @mktime(0, 0, 0, $m, $j, $a);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
@ -221,7 +222,7 @@ function http_calendrier_init($time = '', $type = 'mois', $echelle = '', $partie
|
|
|
|
|
if (!is_string($partie_cal) or !preg_match('/^\w+$/', $partie_cal)) {
|
|
|
|
|
$partie_cal = DEFAUT_PARTIE;
|
|
|
|
|
}
|
|
|
|
|
list($script, $ancre) =
|
|
|
|
|
[$script, $ancre] =
|
|
|
|
|
calendrier_retire_args_ancre($script);
|
|
|
|
|
if (is_null($evt)) {
|
|
|
|
|
$g = 'quete_calendrier_' . $type;
|
|
|
|
@ -242,12 +243,13 @@ function http_calendrier_init($time = '', $type = 'mois', $echelle = '', $partie
|
|
|
|
|
|
|
|
|
|
// https://code.spip.net/@http_calendrier_mois
|
|
|
|
|
function http_calendrier_mois($annee, $mois, $jour, $echelle, $partie_cal, $script, $ancre, $evt) {
|
|
|
|
|
global $spip_ecran;
|
|
|
|
|
if (!isset($spip_ecran)) { $spip_ecran = isset($_COOKIE['spip_ecran']) ? $_COOKIE['spip_ecran'] : 'large';
|
|
|
|
|
$evenements = [];
|
|
|
|
|
global $spip_ecran;
|
|
|
|
|
if (!isset($spip_ecran)) { $spip_ecran = $_COOKIE['spip_ecran'] ?? 'large';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (is_array($evt)) {
|
|
|
|
|
list($sansduree, $evenements, $premier_jour, $dernier_jour) = $evt;
|
|
|
|
|
[$sansduree, $evenements, $premier_jour, $dernier_jour] = $evt;
|
|
|
|
|
if (!$premier_jour) { $premier_jour = '01';
|
|
|
|
|
}
|
|
|
|
|
if (!$dernier_jour) {
|
|
|
|
@ -269,7 +271,7 @@ function http_calendrier_mois($annee, $mois, $jour, $echelle, $partie_cal, $scri
|
|
|
|
|
$dernier_jour = '31';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$id = ($ancre ? $ancre : 'agenda') . '-nav';
|
|
|
|
|
$id = ($ancre ?: 'agenda') . '-nav';
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
"<div><div id='$id'></div>" .
|
|
|
|
@ -346,7 +348,7 @@ function http_calendrier_mois_sept($annee, $mois, $premier_jour, $dernier_jour,
|
|
|
|
|
$init = '';
|
|
|
|
|
$debut = date('w', mktime(1, 1, 1, $mois, $premier_jour, $annee));
|
|
|
|
|
|
|
|
|
|
for ($i = $debut ? $debut : 7; $i > 1; $i--) {$init .= "\n<td></td>";
|
|
|
|
|
for ($i = $debut ?: 7; $i > 1; $i--) {$init .= "\n<td></td>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$total = '';
|
|
|
|
@ -450,12 +452,12 @@ function http_calendrier_mois_clics($annee, $mois, $jour, $script, $finurl, $anc
|
|
|
|
|
// https://code.spip.net/@http_calendrier_semaine
|
|
|
|
|
function http_calendrier_semaine($annee, $mois, $jour, $echelle, $partie_cal, $script, $ancre, $evt) {
|
|
|
|
|
global $spip_ecran;
|
|
|
|
|
if (!isset($spip_ecran)) { $spip_ecran = isset($_COOKIE['spip_ecran']) ? $_COOKIE['spip_ecran'] : 'large';
|
|
|
|
|
if (!isset($spip_ecran)) { $spip_ecran = $_COOKIE['spip_ecran'] ?? 'large';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$finurl = calendrier_retire_defaults($echelle, $partie_cal);
|
|
|
|
|
$init = date('w', mktime(1, 1, 1, $mois, $jour, $annee));
|
|
|
|
|
$init = $jour + 1 - ($init ? $init : 7);
|
|
|
|
|
$init = $jour + 1 - ($init ?: 7);
|
|
|
|
|
$sd = '';
|
|
|
|
|
|
|
|
|
|
if (is_array($evt)) {
|
|
|
|
@ -463,7 +465,7 @@ function http_calendrier_semaine($annee, $mois, $jour, $echelle, $partie_cal, $s
|
|
|
|
|
$sd = http_calendrier_sans_date($annee, $mois, $evt[0]);
|
|
|
|
|
$evt = http_calendrier_semaine_sept($annee, $mois, $init, $echelle, $partie_cal, $evt);
|
|
|
|
|
} else {
|
|
|
|
|
list($sansduree, $evenements, , ) = $evt;
|
|
|
|
|
[$sansduree, $evenements, , ] = $evt;
|
|
|
|
|
if ($sansduree) {
|
|
|
|
|
foreach ($sansduree as $d => $r) {
|
|
|
|
|
$evenements[$d] = !$evenements[$d] ? $r : array_merge($evenements[$d], $r);
|
|
|
|
@ -474,7 +476,7 @@ function http_calendrier_semaine($annee, $mois, $jour, $echelle, $partie_cal, $s
|
|
|
|
|
} else { $evt = "<tr><td >$evt</td></tr>";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$id = ($ancre ? $ancre : 'agenda') . '-nav';
|
|
|
|
|
$id = ($ancre ?: 'agenda') . '-nav';
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
"<div><div id='$id'></div>" .
|
|
|
|
@ -569,10 +571,10 @@ function http_calendrier_semaine_sept($annee, $mois, $jour, $echelle, $partie_ca
|
|
|
|
|
// https://code.spip.net/@http_calendrier_jour
|
|
|
|
|
function http_calendrier_jour($annee, $mois, $jour, $echelle, $partie_cal, $script, $ancre, $evt) {
|
|
|
|
|
global $spip_ecran;
|
|
|
|
|
if (!isset($spip_ecran)) { $spip_ecran = isset($_COOKIE['spip_ecran']) ? $_COOKIE['spip_ecran'] : 'large';
|
|
|
|
|
if (!isset($spip_ecran)) { $spip_ecran = $_COOKIE['spip_ecran'] ?? 'large';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$id = ($ancre ? $ancre : 'agenda') . '-nav';
|
|
|
|
|
$id = ($ancre ?: 'agenda') . '-nav';
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
"<div><div id='$id'></div>" .
|
|
|
|
@ -634,7 +636,7 @@ function http_calendrier_jour_sept($annee, $mois, $jour, $echelle, $partie_cal,
|
|
|
|
|
$droite = (!test_espace_prive() ? '' :
|
|
|
|
|
http_calendrier_ics($annee, $mois, $jour + 1, $echelle, $partie_cal, 0, $evt));
|
|
|
|
|
} else {
|
|
|
|
|
list($sansduree, $evenements, $premier_jour, $dernier_jour) = $evt;
|
|
|
|
|
[$sansduree, $evenements, $premier_jour, $dernier_jour] = $evt;
|
|
|
|
|
|
|
|
|
|
if ($sansduree) {
|
|
|
|
|
foreach ($sansduree as $d => $r) {
|
|
|
|
@ -670,7 +672,7 @@ function http_calendrier_ics($annee, $mois, $jour, $echelle, $partie_cal, $large
|
|
|
|
|
$debut = $GLOBALS['calendrier_partie'][$partie_cal]['debut'];
|
|
|
|
|
$fin = $GLOBALS['calendrier_partie'][$partie_cal]['fin'];
|
|
|
|
|
} elseif (preg_match('/^(\d+)\D(\d+)$/', $partie_cal, $m)) {
|
|
|
|
|
list(,$debut, $fin) = $m;
|
|
|
|
|
[, $debut, $fin] = $m;
|
|
|
|
|
} else {
|
|
|
|
|
$debut = 7;
|
|
|
|
|
$fin = 21;
|
|
|
|
@ -679,7 +681,7 @@ function http_calendrier_ics($annee, $mois, $jour, $echelle, $partie_cal, $large
|
|
|
|
|
if ($echelle == 0) { $echelle = DEFAUT_D_ECHELLE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
list($dimheure, $dimjour, $fontsize, $padding) =
|
|
|
|
|
[$dimheure, $dimjour, $fontsize, $padding] =
|
|
|
|
|
calendrier_echelle($debut, $fin, $echelle);
|
|
|
|
|
$size = sprintf('%0.2f', DEFAUT_TAILLE_HEURE + (10 / $echelle));
|
|
|
|
|
$style .= "height:${dimjour}px;font-size:${size}em;";
|
|
|
|
@ -701,7 +703,7 @@ function http_calendrier_ics($annee, $mois, $jour, $echelle, $partie_cal, $large
|
|
|
|
|
function http_calendrier_ics_div($evts, $date, $debut, $fin, $dimheure, $dimjour, $echelle, $largeur, $padding) {
|
|
|
|
|
global $spip_lang_left;
|
|
|
|
|
$total = '';
|
|
|
|
|
$tous = 1 + count($evts);
|
|
|
|
|
$tous = 1 + (is_countable($evts) ? count($evts) : 0);
|
|
|
|
|
$i = $bas_prec = 0;
|
|
|
|
|
|
|
|
|
|
foreach ($evts as $evenement) {
|
|
|
|
@ -762,10 +764,10 @@ $minutes_fin = 59;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$colors = $evenement['CATEGORIES'];
|
|
|
|
|
$url = isset($evenement['URL']) ? $evenement['URL'] : '';
|
|
|
|
|
$url = $evenement['URL'] ?? '';
|
|
|
|
|
$desc = PtoBR(propre($evenement['DESCRIPTION']));
|
|
|
|
|
$perso = construire_personne_ics($evenement['ATTENDEE']);
|
|
|
|
|
$lieu = isset($evenement['LOCATION']) ? $evenement['LOCATION'] : '';
|
|
|
|
|
$lieu = $evenement['LOCATION'] ?? '';
|
|
|
|
|
$sum = typo($evenement['SUMMARY']);
|
|
|
|
|
if (!$sum) { $sum = $desc;
|
|
|
|
|
$desc = '';
|
|
|
|
@ -988,7 +990,7 @@ function construire_personne_ics($personnes) {
|
|
|
|
|
$m = sql_fetsel('email, nom', 'spip_auteurs', "id_auteur=$p");
|
|
|
|
|
if ($m) {
|
|
|
|
|
$mail = $m['email'];
|
|
|
|
|
$r[$k] = $m['nom'] ? $m['nom'] : ($mail ? $mail : $p);
|
|
|
|
|
$r[$k] = $m['nom'] ?: ($mail ?: $p);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($mail) {
|
|
|
|
@ -1006,7 +1008,7 @@ function construire_personne_ics($personnes) {
|
|
|
|
|
|
|
|
|
|
function http_calendrier_trimestre($annee, $mois, $jour, $echelle, $partie_cal, $self, $ancre, $evt) {
|
|
|
|
|
global $spip_lang_right, $spip_lang_left, $spip_ecran;
|
|
|
|
|
if (!isset($spip_ecran)) { $spip_ecran = isset($_COOKIE['spip_ecran']) ? $_COOKIE['spip_ecran'] : 'large';
|
|
|
|
|
if (!isset($spip_ecran)) { $spip_ecran = $_COOKIE['spip_ecran'] ?? 'large';
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$script = preg_match('/\bscript=(\w+)/', $self, $m) ? $m[1] : '';
|
|
|
|
@ -1054,7 +1056,7 @@ function http_calendrier_trimestre($annee, $mois, $jour, $echelle, $partie_cal,
|
|
|
|
|
}
|
|
|
|
|
$res .= '</td></tr>';
|
|
|
|
|
|
|
|
|
|
$id = ($ancre ? $ancre : 'agenda') . '-nav';
|
|
|
|
|
$id = ($ancre ?: 'agenda') . '-nav';
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
"<div><div id='$id'></div>" .
|
|
|
|
@ -1082,7 +1084,7 @@ function http_calendrier_navigation($annee, $mois, $jour, $echelle, $partie_cal,
|
|
|
|
|
$arg_partie = ($partie_cal != DEFAUT_PARTIE) ? "&partie_cal=$partie_cal" : '';
|
|
|
|
|
|
|
|
|
|
if ($args_pred) {
|
|
|
|
|
list($a, $m, $j, $t) = $args_pred;
|
|
|
|
|
[$a, $m, $j, $t] = $args_pred;
|
|
|
|
|
$args_pred = calendrier_href(
|
|
|
|
|
$script,
|
|
|
|
|
$a,
|
|
|
|
@ -1099,7 +1101,7 @@ function http_calendrier_navigation($annee, $mois, $jour, $echelle, $partie_cal,
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if ($args_suiv) {
|
|
|
|
|
list($a, $m, $j, $t) = $args_suiv;
|
|
|
|
|
[$a, $m, $j, $t] = $args_suiv;
|
|
|
|
|
$args_suiv = calendrier_href(
|
|
|
|
|
$script,
|
|
|
|
|
$a,
|
|
|
|
@ -1138,7 +1140,7 @@ $raz = $regs[1];
|
|
|
|
|
|
|
|
|
|
$href = calendrier_args_date($href, $annee, $mois, $jour, '', "$arg_echelle" . ((DEFAUT_PARTIE == DEFAUT_PARTIE_R) ? '' : ('&partie_cal=' . DEFAUT_PARTIE_R)));
|
|
|
|
|
|
|
|
|
|
$id = ($ancre ? $ancre : 'agenda') . '-nav';
|
|
|
|
|
$id = ($ancre ?: 'agenda') . '-nav';
|
|
|
|
|
$onmouseover = "if (!this.trimestre)\n{this.trimestre=!charger_node_url('$href', document.getElementById('$id'));}\n;$('#$id').css('visibility','visible').show();";
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
@ -1262,7 +1264,10 @@ function calendrier_navigation_heures($annee, $mois, $jour, $echelle, $partie_ca
|
|
|
|
|
/// Bloc de navigation sur le type mois/semaine/jour
|
|
|
|
|
|
|
|
|
|
function calendrier_navigation_type($annee, $mois, $jour, $finurl, $script, $type) {
|
|
|
|
|
return
|
|
|
|
|
$arg_echelle = null;
|
|
|
|
|
$arg_partie = null;
|
|
|
|
|
$ancre = null;
|
|
|
|
|
return
|
|
|
|
|
calendrier_href(
|
|
|
|
|
$script,
|
|
|
|
|
$annee,
|
|
|
|
@ -1456,7 +1461,8 @@ function http_calendrier_messages($annee = '', $mois = '', $jour = '', $heures =
|
|
|
|
|
// https://code.spip.net/@http_calendrier_rv
|
|
|
|
|
function http_calendrier_rv($messages, $type) {
|
|
|
|
|
|
|
|
|
|
$total = $date_rv = '';
|
|
|
|
|
$titre = null;
|
|
|
|
|
$total = $date_rv = '';
|
|
|
|
|
if (!$messages) { return $total;
|
|
|
|
|
}
|
|
|
|
|
$connect_quand = $GLOBALS['visiteur_session']['quand'];
|
|
|
|
@ -1628,7 +1634,7 @@ function quete_calendrier_jour($annee, $mois, $jour) {
|
|
|
|
|
// https://code.spip.net/@quete_calendrier_interval
|
|
|
|
|
function quete_calendrier_interval($limites) {
|
|
|
|
|
include_spip('inc/urls');
|
|
|
|
|
list($avant, $apres) = $limites;
|
|
|
|
|
[$avant, $apres] = $limites;
|
|
|
|
|
$evt = [];
|
|
|
|
|
quete_calendrier_interval_articles($avant, $apres, $evt);
|
|
|
|
|
quete_calendrier_interval_breves($avant, $apres, $evt);
|
|
|
|
@ -1638,7 +1644,7 @@ function quete_calendrier_interval($limites) {
|
|
|
|
|
|
|
|
|
|
// https://code.spip.net/@quete_calendrier_interval_forums
|
|
|
|
|
function quete_calendrier_interval_forums($limites, &$evenements) {
|
|
|
|
|
list($avant, $apres) = $limites;
|
|
|
|
|
[$avant, $apres] = $limites;
|
|
|
|
|
$result = sql_select('DISTINCT titre, date_heure, id_forum', 'spip_forum', "date_heure >= $avant AND date_heure < $apres", '', 'date_heure');
|
|
|
|
|
while ($row = sql_fetch($result)) {
|
|
|
|
|
$amj = date_anneemoisjour($row['date_heure']);
|
|
|
|
@ -1678,7 +1684,7 @@ function quete_calendrier_interval_articles($avant, $apres, &$evenements) {
|
|
|
|
|
$evenements[$amj][] =
|
|
|
|
|
[
|
|
|
|
|
'CATEGORIES' => calendrier_categories('spip_articles', $id, 'id_article'),
|
|
|
|
|
'DESCRIPTION' => $row['descriptif'] ? $row['descriptif'] : $langues[$row['lang']],
|
|
|
|
|
'DESCRIPTION' => $row['descriptif'] ?: $langues[$row['lang']],
|
|
|
|
|
'SUMMARY' => $row['titre'],
|
|
|
|
|
'URL' => generer_url_ecrire_article($id, '', '', 'prop')];
|
|
|
|
|
}
|
|
|
|
|