@@ -12,7 +12,7 @@ |
||
| 12 | 12 | |
| 13 | 13 | # ou est l'espace prive ? |
| 14 | 14 | if (!defined('_DIR_RESTREINT_ABS')) { |
| 15 | - define('_DIR_RESTREINT_ABS', 'ecrire/'); |
|
| 15 | + define('_DIR_RESTREINT_ABS', 'ecrire/'); |
|
| 16 | 16 | } |
| 17 | 17 | include_once _DIR_RESTREINT_ABS.'inc_version.php'; |
| 18 | 18 | |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
@@ -45,130 +45,130 @@ discard block |
||
| 45 | 45 | **/ |
| 46 | 46 | function formulaires_dater_charger_dist($objet, $id_objet, $retour = '', $options = array()) { |
| 47 | 47 | |
| 48 | - $objet = objet_type($objet); |
|
| 49 | - if (!$objet or !intval($id_objet)) { |
|
| 50 | - return false; |
|
| 51 | - } |
|
| 52 | - |
|
| 53 | - if (!is_array($options)) { |
|
| 54 | - $options = unserialize($options); |
|
| 55 | - } |
|
| 56 | - |
|
| 57 | - $_id_objet = id_table_objet($objet); |
|
| 58 | - $table = table_objet($objet); |
|
| 59 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 60 | - $desc = $trouver_table($table); |
|
| 61 | - |
|
| 62 | - if (!$desc) { |
|
| 63 | - return false; |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - $champ_date = $desc['date'] ? $desc['date'] : 'date'; |
|
| 67 | - if (isset($options['champ_date']) and $options['champ_date']) { |
|
| 68 | - $champ_date = $options['champ_date']; |
|
| 69 | - } |
|
| 70 | - if (!isset($desc['field'][$champ_date])) { |
|
| 71 | - return false; |
|
| 72 | - } |
|
| 73 | - |
|
| 74 | - $valeurs = array( |
|
| 75 | - 'objet' => $objet, |
|
| 76 | - 'id_objet' => $id_objet, |
|
| 77 | - 'id' => $id_objet, |
|
| 78 | - ); |
|
| 79 | - |
|
| 80 | - |
|
| 81 | - $select = "$champ_date as date"; |
|
| 82 | - $champ_date_redac = 'date_redac'; |
|
| 83 | - if (isset($options['champ_date_redac']) and $options['champ_date_redac']) { |
|
| 84 | - $champ_date_redac = $options['champ_date_redac']; |
|
| 85 | - } |
|
| 86 | - if (isset($desc['field'][$champ_date_redac])) { |
|
| 87 | - $select .= ",$champ_date_redac as date_redac"; |
|
| 88 | - } |
|
| 89 | - if (isset($desc['field']['statut'])) { |
|
| 90 | - $select .= ",statut"; |
|
| 91 | - } |
|
| 92 | - |
|
| 93 | - |
|
| 94 | - $row = sql_fetsel($select, $desc['table'], "$_id_objet=" . intval($id_objet)); |
|
| 95 | - $statut = isset($row['statut']) ? $row['statut'] : 'publie'; // pas de statut => publie |
|
| 96 | - |
|
| 97 | - $valeurs['editable'] = autoriser('dater', $objet, $id_objet, null, array('statut' => $statut)); |
|
| 98 | - |
|
| 99 | - $possedeDateRedac = false; |
|
| 100 | - |
|
| 101 | - if (isset($row['date_redac']) and |
|
| 102 | - $regs = recup_date($row['date_redac'], false) |
|
| 103 | - ) { |
|
| 104 | - $annee_redac = $regs[0]; |
|
| 105 | - $mois_redac = $regs[1]; |
|
| 106 | - $jour_redac = $regs[2]; |
|
| 107 | - $heure_redac = $regs[3]; |
|
| 108 | - $minute_redac = $regs[4]; |
|
| 109 | - $possedeDateRedac = true; |
|
| 110 | - // attention : les vrai dates de l'annee 1 sont stockee avec +9000 => 9001 |
|
| 111 | - // mais reviennent ici en annee 1 par recup_date |
|
| 112 | - // on verifie donc que le intval($row['date_redac']) qui ressort l'annee |
|
| 113 | - // est bien lui aussi <=1 : dans ce cas c'est une date sql 'nulle' ou presque, selon |
|
| 114 | - // le gestionnnaire sql utilise (0001-01-01 pour PG par exemple) |
|
| 115 | - if (intval($row['date_redac']) <= 1 and ($annee_redac <= 1) and ($mois_redac <= 1) and ($jour_redac <= 1)) { |
|
| 116 | - $possedeDateRedac = false; |
|
| 117 | - } |
|
| 118 | - } else { |
|
| 119 | - $annee_redac = $mois_redac = $jour_redac = $heure_redac = $minute_redac = 0; |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - if ($regs = recup_date($row['date'], false)) { |
|
| 123 | - $annee = $regs[0]; |
|
| 124 | - $mois = $regs[1]; |
|
| 125 | - $jour = $regs[2]; |
|
| 126 | - $heure = $regs[3]; |
|
| 127 | - $minute = $regs[4]; |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - // attention, si la variable s'appelle date ou date_redac, le compilo va |
|
| 131 | - // la normaliser, ce qu'on ne veut pas ici. |
|
| 132 | - $valeurs['afficher_date_redac'] = ($possedeDateRedac ? $row['date_redac'] : ''); |
|
| 133 | - $valeurs['date_redac_jour'] = dater_formater_saisie_jour($jour_redac, $mois_redac, $annee_redac); |
|
| 134 | - $valeurs['date_redac_heure'] = "$heure_redac:$minute_redac"; |
|
| 135 | - |
|
| 136 | - $valeurs['afficher_date'] = $row['date']; |
|
| 137 | - $valeurs['date_jour'] = dater_formater_saisie_jour($jour, $mois, $annee); |
|
| 138 | - $valeurs['date_heure'] = "$heure:$minute"; |
|
| 139 | - |
|
| 140 | - $valeurs['sans_redac'] = !$possedeDateRedac; |
|
| 141 | - |
|
| 142 | - if (isset($options['date_redac'])) { |
|
| 143 | - $valeurs['_editer_date_anterieure'] = $options['date_redac']; |
|
| 144 | - } else { |
|
| 145 | - $valeurs['_editer_date_anterieure'] = ($objet == 'article' and ($GLOBALS['meta']['articles_redac'] != 'non' or $possedeDateRedac)); |
|
| 146 | - } |
|
| 147 | - $valeurs['_label_date'] = (($statut == 'publie') ? |
|
| 148 | - _T('texte_date_publication_objet') : _T('texte_date_creation_objet')); |
|
| 149 | - if (isset($options['label_date']) and $options['label_date']) { |
|
| 150 | - $valeurs['_label_date'] = $options['label_date']; |
|
| 151 | - } |
|
| 152 | - if (isset($options['label_date_redac']) and $options['label_date_redac']) { |
|
| 153 | - $valeurs['_label_date_redac'] = $options['label_date_redac']; |
|
| 154 | - } |
|
| 155 | - if (isset($options['texte_sans_date_redac']) and $options['texte_sans_date_redac']) { |
|
| 156 | - $valeurs['_texte_sans_date_redac'] = $options['texte_sans_date_redac']; |
|
| 157 | - } |
|
| 158 | - if (isset($options['class']) and $options['class']) { |
|
| 159 | - $valeurs['_class'] = $options['class']; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - $valeurs['_saisie_en_cours'] = (_request('_saisie_en_cours') !== null or _request('date_jour') !== null); |
|
| 163 | - |
|
| 164 | - // cas ou l'on ne peut pas dater mais on peut modifier la date de redac anterieure |
|
| 165 | - // https://core.spip.net/issues/3494 |
|
| 166 | - $valeurs['_editer_date'] = $valeurs['editable']; |
|
| 167 | - if ($valeurs['_editer_date_anterieure'] and !$valeurs['editable']) { |
|
| 168 | - $valeurs['editable'] = autoriser('modifier', $objet, $id_objet); |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - return $valeurs; |
|
| 48 | + $objet = objet_type($objet); |
|
| 49 | + if (!$objet or !intval($id_objet)) { |
|
| 50 | + return false; |
|
| 51 | + } |
|
| 52 | + |
|
| 53 | + if (!is_array($options)) { |
|
| 54 | + $options = unserialize($options); |
|
| 55 | + } |
|
| 56 | + |
|
| 57 | + $_id_objet = id_table_objet($objet); |
|
| 58 | + $table = table_objet($objet); |
|
| 59 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 60 | + $desc = $trouver_table($table); |
|
| 61 | + |
|
| 62 | + if (!$desc) { |
|
| 63 | + return false; |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + $champ_date = $desc['date'] ? $desc['date'] : 'date'; |
|
| 67 | + if (isset($options['champ_date']) and $options['champ_date']) { |
|
| 68 | + $champ_date = $options['champ_date']; |
|
| 69 | + } |
|
| 70 | + if (!isset($desc['field'][$champ_date])) { |
|
| 71 | + return false; |
|
| 72 | + } |
|
| 73 | + |
|
| 74 | + $valeurs = array( |
|
| 75 | + 'objet' => $objet, |
|
| 76 | + 'id_objet' => $id_objet, |
|
| 77 | + 'id' => $id_objet, |
|
| 78 | + ); |
|
| 79 | + |
|
| 80 | + |
|
| 81 | + $select = "$champ_date as date"; |
|
| 82 | + $champ_date_redac = 'date_redac'; |
|
| 83 | + if (isset($options['champ_date_redac']) and $options['champ_date_redac']) { |
|
| 84 | + $champ_date_redac = $options['champ_date_redac']; |
|
| 85 | + } |
|
| 86 | + if (isset($desc['field'][$champ_date_redac])) { |
|
| 87 | + $select .= ",$champ_date_redac as date_redac"; |
|
| 88 | + } |
|
| 89 | + if (isset($desc['field']['statut'])) { |
|
| 90 | + $select .= ",statut"; |
|
| 91 | + } |
|
| 92 | + |
|
| 93 | + |
|
| 94 | + $row = sql_fetsel($select, $desc['table'], "$_id_objet=" . intval($id_objet)); |
|
| 95 | + $statut = isset($row['statut']) ? $row['statut'] : 'publie'; // pas de statut => publie |
|
| 96 | + |
|
| 97 | + $valeurs['editable'] = autoriser('dater', $objet, $id_objet, null, array('statut' => $statut)); |
|
| 98 | + |
|
| 99 | + $possedeDateRedac = false; |
|
| 100 | + |
|
| 101 | + if (isset($row['date_redac']) and |
|
| 102 | + $regs = recup_date($row['date_redac'], false) |
|
| 103 | + ) { |
|
| 104 | + $annee_redac = $regs[0]; |
|
| 105 | + $mois_redac = $regs[1]; |
|
| 106 | + $jour_redac = $regs[2]; |
|
| 107 | + $heure_redac = $regs[3]; |
|
| 108 | + $minute_redac = $regs[4]; |
|
| 109 | + $possedeDateRedac = true; |
|
| 110 | + // attention : les vrai dates de l'annee 1 sont stockee avec +9000 => 9001 |
|
| 111 | + // mais reviennent ici en annee 1 par recup_date |
|
| 112 | + // on verifie donc que le intval($row['date_redac']) qui ressort l'annee |
|
| 113 | + // est bien lui aussi <=1 : dans ce cas c'est une date sql 'nulle' ou presque, selon |
|
| 114 | + // le gestionnnaire sql utilise (0001-01-01 pour PG par exemple) |
|
| 115 | + if (intval($row['date_redac']) <= 1 and ($annee_redac <= 1) and ($mois_redac <= 1) and ($jour_redac <= 1)) { |
|
| 116 | + $possedeDateRedac = false; |
|
| 117 | + } |
|
| 118 | + } else { |
|
| 119 | + $annee_redac = $mois_redac = $jour_redac = $heure_redac = $minute_redac = 0; |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + if ($regs = recup_date($row['date'], false)) { |
|
| 123 | + $annee = $regs[0]; |
|
| 124 | + $mois = $regs[1]; |
|
| 125 | + $jour = $regs[2]; |
|
| 126 | + $heure = $regs[3]; |
|
| 127 | + $minute = $regs[4]; |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + // attention, si la variable s'appelle date ou date_redac, le compilo va |
|
| 131 | + // la normaliser, ce qu'on ne veut pas ici. |
|
| 132 | + $valeurs['afficher_date_redac'] = ($possedeDateRedac ? $row['date_redac'] : ''); |
|
| 133 | + $valeurs['date_redac_jour'] = dater_formater_saisie_jour($jour_redac, $mois_redac, $annee_redac); |
|
| 134 | + $valeurs['date_redac_heure'] = "$heure_redac:$minute_redac"; |
|
| 135 | + |
|
| 136 | + $valeurs['afficher_date'] = $row['date']; |
|
| 137 | + $valeurs['date_jour'] = dater_formater_saisie_jour($jour, $mois, $annee); |
|
| 138 | + $valeurs['date_heure'] = "$heure:$minute"; |
|
| 139 | + |
|
| 140 | + $valeurs['sans_redac'] = !$possedeDateRedac; |
|
| 141 | + |
|
| 142 | + if (isset($options['date_redac'])) { |
|
| 143 | + $valeurs['_editer_date_anterieure'] = $options['date_redac']; |
|
| 144 | + } else { |
|
| 145 | + $valeurs['_editer_date_anterieure'] = ($objet == 'article' and ($GLOBALS['meta']['articles_redac'] != 'non' or $possedeDateRedac)); |
|
| 146 | + } |
|
| 147 | + $valeurs['_label_date'] = (($statut == 'publie') ? |
|
| 148 | + _T('texte_date_publication_objet') : _T('texte_date_creation_objet')); |
|
| 149 | + if (isset($options['label_date']) and $options['label_date']) { |
|
| 150 | + $valeurs['_label_date'] = $options['label_date']; |
|
| 151 | + } |
|
| 152 | + if (isset($options['label_date_redac']) and $options['label_date_redac']) { |
|
| 153 | + $valeurs['_label_date_redac'] = $options['label_date_redac']; |
|
| 154 | + } |
|
| 155 | + if (isset($options['texte_sans_date_redac']) and $options['texte_sans_date_redac']) { |
|
| 156 | + $valeurs['_texte_sans_date_redac'] = $options['texte_sans_date_redac']; |
|
| 157 | + } |
|
| 158 | + if (isset($options['class']) and $options['class']) { |
|
| 159 | + $valeurs['_class'] = $options['class']; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + $valeurs['_saisie_en_cours'] = (_request('_saisie_en_cours') !== null or _request('date_jour') !== null); |
|
| 163 | + |
|
| 164 | + // cas ou l'on ne peut pas dater mais on peut modifier la date de redac anterieure |
|
| 165 | + // https://core.spip.net/issues/3494 |
|
| 166 | + $valeurs['_editer_date'] = $valeurs['editable']; |
|
| 167 | + if ($valeurs['_editer_date_anterieure'] and !$valeurs['editable']) { |
|
| 168 | + $valeurs['editable'] = autoriser('modifier', $objet, $id_objet); |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + return $valeurs; |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | /** |
@@ -186,20 +186,20 @@ discard block |
||
| 186 | 186 | * Date formatée tel que `02/10/2012` |
| 187 | 187 | **/ |
| 188 | 188 | function dater_formater_saisie_jour($jour, $mois, $annee, $sep = '/') { |
| 189 | - $annee = str_pad($annee, 4, '0', STR_PAD_LEFT); |
|
| 190 | - if (intval($jour)) { |
|
| 191 | - $jour = str_pad($jour, 2, '0', STR_PAD_LEFT); |
|
| 192 | - $mois = str_pad($mois, 2, '0', STR_PAD_LEFT); |
|
| 189 | + $annee = str_pad($annee, 4, '0', STR_PAD_LEFT); |
|
| 190 | + if (intval($jour)) { |
|
| 191 | + $jour = str_pad($jour, 2, '0', STR_PAD_LEFT); |
|
| 192 | + $mois = str_pad($mois, 2, '0', STR_PAD_LEFT); |
|
| 193 | 193 | |
| 194 | - return "$jour$sep$mois$sep$annee"; |
|
| 195 | - } |
|
| 196 | - if (intval($mois)) { |
|
| 197 | - $mois = str_pad($mois, 2, '0', STR_PAD_LEFT); |
|
| 194 | + return "$jour$sep$mois$sep$annee"; |
|
| 195 | + } |
|
| 196 | + if (intval($mois)) { |
|
| 197 | + $mois = str_pad($mois, 2, '0', STR_PAD_LEFT); |
|
| 198 | 198 | |
| 199 | - return "$mois$sep$annee"; |
|
| 200 | - } |
|
| 199 | + return "$mois$sep$annee"; |
|
| 200 | + } |
|
| 201 | 201 | |
| 202 | - return $annee; |
|
| 202 | + return $annee; |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | /** |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | * Hash du formulaire |
| 219 | 219 | **/ |
| 220 | 220 | function formulaires_dater_identifier_dist($objet, $id_objet, $retour = '', $options = array()) { |
| 221 | - return serialize(array($objet, $id_objet)); |
|
| 221 | + return serialize(array($objet, $id_objet)); |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /** |
@@ -236,30 +236,30 @@ discard block |
||
| 236 | 236 | * Tableau des erreurs |
| 237 | 237 | */ |
| 238 | 238 | function formulaires_dater_verifier_dist($objet, $id_objet, $retour = '', $options = array()) { |
| 239 | - $erreurs = array(); |
|
| 240 | - |
|
| 241 | - // ouvrir le formulaire en edition ? |
|
| 242 | - if (_request('_saisie_en_cours')) { |
|
| 243 | - $erreurs['message_erreur'] = ''; |
|
| 244 | - |
|
| 245 | - return $erreurs; |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - if (_request('changer')) { |
|
| 249 | - foreach (array('date', 'date_redac') as $k) { |
|
| 250 | - if ($v = _request($k . '_jour') and !dater_recuperer_date_saisie($v, $k)) { |
|
| 251 | - $erreurs[$k] = _T('format_date_incorrecte'); |
|
| 252 | - } elseif ($v = _request($k . '_heure') and !dater_recuperer_heure_saisie($v)) { |
|
| 253 | - $erreurs[$k] = _T('format_heure_incorrecte'); |
|
| 254 | - } |
|
| 255 | - } |
|
| 256 | - |
|
| 257 | - if (!_request('date_jour')) { |
|
| 258 | - $erreurs['date'] = _T('info_obligatoire'); |
|
| 259 | - } |
|
| 260 | - } |
|
| 261 | - |
|
| 262 | - return $erreurs; |
|
| 239 | + $erreurs = array(); |
|
| 240 | + |
|
| 241 | + // ouvrir le formulaire en edition ? |
|
| 242 | + if (_request('_saisie_en_cours')) { |
|
| 243 | + $erreurs['message_erreur'] = ''; |
|
| 244 | + |
|
| 245 | + return $erreurs; |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + if (_request('changer')) { |
|
| 249 | + foreach (array('date', 'date_redac') as $k) { |
|
| 250 | + if ($v = _request($k . '_jour') and !dater_recuperer_date_saisie($v, $k)) { |
|
| 251 | + $erreurs[$k] = _T('format_date_incorrecte'); |
|
| 252 | + } elseif ($v = _request($k . '_heure') and !dater_recuperer_heure_saisie($v)) { |
|
| 253 | + $erreurs[$k] = _T('format_heure_incorrecte'); |
|
| 254 | + } |
|
| 255 | + } |
|
| 256 | + |
|
| 257 | + if (!_request('date_jour')) { |
|
| 258 | + $erreurs['date'] = _T('info_obligatoire'); |
|
| 259 | + } |
|
| 260 | + } |
|
| 261 | + |
|
| 262 | + return $erreurs; |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | /** |
@@ -277,79 +277,79 @@ discard block |
||
| 277 | 277 | * Retours des traitements |
| 278 | 278 | */ |
| 279 | 279 | function formulaires_dater_traiter_dist($objet, $id_objet, $retour = '', $options = array()) { |
| 280 | - $res = array('editable' => ' '); |
|
| 281 | - |
|
| 282 | - if (_request('changer')) { |
|
| 283 | - $table = table_objet($objet); |
|
| 284 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 285 | - $desc = $trouver_table($table); |
|
| 286 | - |
|
| 287 | - if (!$desc) { |
|
| 288 | - return array('message_erreur' => _L('erreur')); |
|
| 289 | - } #impossible en principe |
|
| 290 | - |
|
| 291 | - $champ_date = $desc['date'] ? $desc['date'] : 'date'; |
|
| 292 | - if (isset($options['champ_date']) and $options['champ_date']) { |
|
| 293 | - $champ_date = $options['champ_date']; |
|
| 294 | - } |
|
| 295 | - |
|
| 296 | - $set = array(); |
|
| 297 | - |
|
| 298 | - $charger = charger_fonction('charger', 'formulaires/dater/'); |
|
| 299 | - $v = $charger($objet, $id_objet, $retour, $options); |
|
| 300 | - |
|
| 301 | - if ($v['_editer_date']) { |
|
| 302 | - if (!$d = dater_recuperer_date_saisie(_request('date_jour'))) { |
|
| 303 | - $d = array(date('Y'), date('m'), date('d')); |
|
| 304 | - } |
|
| 305 | - if (!$h = dater_recuperer_heure_saisie(_request('date_heure'))) { |
|
| 306 | - $h = array(0, 0); |
|
| 307 | - } |
|
| 308 | - |
|
| 309 | - $set[$champ_date] = sql_format_date($d[0], $d[1], $d[2], $h[0], $h[1]); |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - $champ_date_redac = 'date_redac'; |
|
| 313 | - if (isset($options['champ_date_redac']) and $options['champ_date_redac']) { |
|
| 314 | - $champ_date_redac = $options['champ_date_redac']; |
|
| 315 | - } |
|
| 316 | - if (isset($desc['field'][$champ_date_redac]) and $v['_editer_date_anterieure']) { |
|
| 317 | - if (!_request('date_redac_jour') or _request('sans_redac')) { |
|
| 318 | - $set[$champ_date_redac] = sql_format_date(0, 0, 0, 0, 0, 0); |
|
| 319 | - } else { |
|
| 320 | - if (!$d = dater_recuperer_date_saisie(_request('date_redac_jour'), 'date_redac')) { |
|
| 321 | - $d = array(date('Y'), date('m'), date('d')); |
|
| 322 | - } |
|
| 323 | - if (!$h = dater_recuperer_heure_saisie(_request('date_redac_heure'))) { |
|
| 324 | - $h = array(0, 0); |
|
| 325 | - } |
|
| 326 | - $set[$champ_date_redac] = sql_format_date($d[0], $d[1], $d[2], $h[0], $h[1]); |
|
| 327 | - } |
|
| 328 | - } |
|
| 329 | - |
|
| 330 | - if (count($set)) { |
|
| 331 | - $publie_avant = objet_test_si_publie($objet, $id_objet); |
|
| 332 | - include_spip('action/editer_objet'); |
|
| 333 | - objet_modifier($objet, $id_objet, $set); |
|
| 334 | - $publie_apres = objet_test_si_publie($objet, $id_objet); |
|
| 335 | - if ($publie_avant !== $publie_apres) { |
|
| 336 | - // on refuse ajax pour forcer le rechargement de la page ici |
|
| 337 | - // on refera traiter une 2eme fois, mais c'est sans consequence |
|
| 338 | - refuser_traiter_formulaire_ajax(); |
|
| 339 | - } |
|
| 340 | - } |
|
| 341 | - } |
|
| 342 | - |
|
| 343 | - if ($retour) { |
|
| 344 | - $res['redirect'] = $retour; |
|
| 345 | - } |
|
| 346 | - |
|
| 347 | - set_request('date_jour'); |
|
| 348 | - set_request('date_redac_jour'); |
|
| 349 | - set_request('date_heure'); |
|
| 350 | - set_request('date_redac_heure'); |
|
| 351 | - |
|
| 352 | - return $res; |
|
| 280 | + $res = array('editable' => ' '); |
|
| 281 | + |
|
| 282 | + if (_request('changer')) { |
|
| 283 | + $table = table_objet($objet); |
|
| 284 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 285 | + $desc = $trouver_table($table); |
|
| 286 | + |
|
| 287 | + if (!$desc) { |
|
| 288 | + return array('message_erreur' => _L('erreur')); |
|
| 289 | + } #impossible en principe |
|
| 290 | + |
|
| 291 | + $champ_date = $desc['date'] ? $desc['date'] : 'date'; |
|
| 292 | + if (isset($options['champ_date']) and $options['champ_date']) { |
|
| 293 | + $champ_date = $options['champ_date']; |
|
| 294 | + } |
|
| 295 | + |
|
| 296 | + $set = array(); |
|
| 297 | + |
|
| 298 | + $charger = charger_fonction('charger', 'formulaires/dater/'); |
|
| 299 | + $v = $charger($objet, $id_objet, $retour, $options); |
|
| 300 | + |
|
| 301 | + if ($v['_editer_date']) { |
|
| 302 | + if (!$d = dater_recuperer_date_saisie(_request('date_jour'))) { |
|
| 303 | + $d = array(date('Y'), date('m'), date('d')); |
|
| 304 | + } |
|
| 305 | + if (!$h = dater_recuperer_heure_saisie(_request('date_heure'))) { |
|
| 306 | + $h = array(0, 0); |
|
| 307 | + } |
|
| 308 | + |
|
| 309 | + $set[$champ_date] = sql_format_date($d[0], $d[1], $d[2], $h[0], $h[1]); |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + $champ_date_redac = 'date_redac'; |
|
| 313 | + if (isset($options['champ_date_redac']) and $options['champ_date_redac']) { |
|
| 314 | + $champ_date_redac = $options['champ_date_redac']; |
|
| 315 | + } |
|
| 316 | + if (isset($desc['field'][$champ_date_redac]) and $v['_editer_date_anterieure']) { |
|
| 317 | + if (!_request('date_redac_jour') or _request('sans_redac')) { |
|
| 318 | + $set[$champ_date_redac] = sql_format_date(0, 0, 0, 0, 0, 0); |
|
| 319 | + } else { |
|
| 320 | + if (!$d = dater_recuperer_date_saisie(_request('date_redac_jour'), 'date_redac')) { |
|
| 321 | + $d = array(date('Y'), date('m'), date('d')); |
|
| 322 | + } |
|
| 323 | + if (!$h = dater_recuperer_heure_saisie(_request('date_redac_heure'))) { |
|
| 324 | + $h = array(0, 0); |
|
| 325 | + } |
|
| 326 | + $set[$champ_date_redac] = sql_format_date($d[0], $d[1], $d[2], $h[0], $h[1]); |
|
| 327 | + } |
|
| 328 | + } |
|
| 329 | + |
|
| 330 | + if (count($set)) { |
|
| 331 | + $publie_avant = objet_test_si_publie($objet, $id_objet); |
|
| 332 | + include_spip('action/editer_objet'); |
|
| 333 | + objet_modifier($objet, $id_objet, $set); |
|
| 334 | + $publie_apres = objet_test_si_publie($objet, $id_objet); |
|
| 335 | + if ($publie_avant !== $publie_apres) { |
|
| 336 | + // on refuse ajax pour forcer le rechargement de la page ici |
|
| 337 | + // on refera traiter une 2eme fois, mais c'est sans consequence |
|
| 338 | + refuser_traiter_formulaire_ajax(); |
|
| 339 | + } |
|
| 340 | + } |
|
| 341 | + } |
|
| 342 | + |
|
| 343 | + if ($retour) { |
|
| 344 | + $res['redirect'] = $retour; |
|
| 345 | + } |
|
| 346 | + |
|
| 347 | + set_request('date_jour'); |
|
| 348 | + set_request('date_redac_jour'); |
|
| 349 | + set_request('date_heure'); |
|
| 350 | + set_request('date_redac_heure'); |
|
| 351 | + |
|
| 352 | + return $res; |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | /** |
@@ -360,24 +360,24 @@ discard block |
||
| 360 | 360 | * @return array|string Chaîne vide si date invalide, tableau (année, mois, jour) sinon. |
| 361 | 361 | */ |
| 362 | 362 | function dater_recuperer_date_saisie($post, $quoi = 'date') { |
| 363 | - if (!preg_match('#^(?:(?:([0-9]{1,2})[/-])?([0-9]{1,2})[/-])?([0-9]{4}|[0-9]{1,2})#', $post, $regs)) { |
|
| 364 | - return ''; |
|
| 365 | - } |
|
| 366 | - if ($quoi == 'date_redac') { |
|
| 367 | - if ($regs[3] <> '' and $regs[3] < 1001) { |
|
| 368 | - $regs[3] += 9000; |
|
| 369 | - } |
|
| 370 | - |
|
| 371 | - return array($regs[3], $regs[2], $regs[1]); |
|
| 372 | - } else { |
|
| 373 | - if ( |
|
| 374 | - checkdate(intval($regs[2]), intval($regs[1]), intval($regs[3])) |
|
| 375 | - and $t = mktime(0, 0, 0, $regs[2], $regs[1], $regs[3]) |
|
| 376 | - ) { |
|
| 377 | - return array(date('Y', $t), date('m', $t), date('d', $t)); |
|
| 378 | - } |
|
| 379 | - return ''; |
|
| 380 | - } |
|
| 363 | + if (!preg_match('#^(?:(?:([0-9]{1,2})[/-])?([0-9]{1,2})[/-])?([0-9]{4}|[0-9]{1,2})#', $post, $regs)) { |
|
| 364 | + return ''; |
|
| 365 | + } |
|
| 366 | + if ($quoi == 'date_redac') { |
|
| 367 | + if ($regs[3] <> '' and $regs[3] < 1001) { |
|
| 368 | + $regs[3] += 9000; |
|
| 369 | + } |
|
| 370 | + |
|
| 371 | + return array($regs[3], $regs[2], $regs[1]); |
|
| 372 | + } else { |
|
| 373 | + if ( |
|
| 374 | + checkdate(intval($regs[2]), intval($regs[1]), intval($regs[3])) |
|
| 375 | + and $t = mktime(0, 0, 0, $regs[2], $regs[1], $regs[3]) |
|
| 376 | + ) { |
|
| 377 | + return array(date('Y', $t), date('m', $t), date('d', $t)); |
|
| 378 | + } |
|
| 379 | + return ''; |
|
| 380 | + } |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | /** |
@@ -387,12 +387,12 @@ discard block |
||
| 387 | 387 | * @return array |
| 388 | 388 | */ |
| 389 | 389 | function dater_recuperer_heure_saisie($post) { |
| 390 | - if (!preg_match('#([0-9]{1,2})(?:[h:](?:([0-9]{1,2}))?)?#', $post, $regs)) { |
|
| 391 | - return ''; |
|
| 392 | - } |
|
| 393 | - if ($regs[1] > 23 or $regs[2] > 59) { |
|
| 394 | - return ''; |
|
| 395 | - } |
|
| 396 | - |
|
| 397 | - return array($regs[1], $regs[2]); |
|
| 390 | + if (!preg_match('#([0-9]{1,2})(?:[h:](?:([0-9]{1,2}))?)?#', $post, $regs)) { |
|
| 391 | + return ''; |
|
| 392 | + } |
|
| 393 | + if ($regs[1] > 23 or $regs[2] > 59) { |
|
| 394 | + return ''; |
|
| 395 | + } |
|
| 396 | + |
|
| 397 | + return array($regs[1], $regs[2]); |
|
| 398 | 398 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | **/ |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -36,55 +36,55 @@ discard block |
||
| 36 | 36 | * ``` |
| 37 | 37 | **/ |
| 38 | 38 | function action_redirect_dist() { |
| 39 | - $type = _request('type'); |
|
| 40 | - $id = intval(_request('id')); |
|
| 41 | - $page = false; |
|
| 39 | + $type = _request('type'); |
|
| 40 | + $id = intval(_request('id')); |
|
| 41 | + $page = false; |
|
| 42 | 42 | |
| 43 | - // verifier le type ou page transmis |
|
| 44 | - if (!preg_match('/^\w+$/', $type)) { |
|
| 45 | - $page = _request('page'); |
|
| 46 | - if (!preg_match('/^\w+$/', $page)) { |
|
| 47 | - return; |
|
| 48 | - } |
|
| 49 | - } |
|
| 43 | + // verifier le type ou page transmis |
|
| 44 | + if (!preg_match('/^\w+$/', $type)) { |
|
| 45 | + $page = _request('page'); |
|
| 46 | + if (!preg_match('/^\w+$/', $page)) { |
|
| 47 | + return; |
|
| 48 | + } |
|
| 49 | + } |
|
| 50 | 50 | |
| 51 | - if ($var_mode = _request('var_mode')) { |
|
| 52 | - // forcer la mise a jour de l'url de cet objet ! |
|
| 53 | - if (!defined('_VAR_URLS')) { |
|
| 54 | - define('_VAR_URLS', true); |
|
| 55 | - } |
|
| 56 | - } |
|
| 51 | + if ($var_mode = _request('var_mode')) { |
|
| 52 | + // forcer la mise a jour de l'url de cet objet ! |
|
| 53 | + if (!defined('_VAR_URLS')) { |
|
| 54 | + define('_VAR_URLS', true); |
|
| 55 | + } |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - if ($page) { |
|
| 59 | - $url = generer_url_public($page, '', true); |
|
| 60 | - } else { |
|
| 61 | - $url = calculer_url_redirect_entite($type, $id, $var_mode); |
|
| 62 | - } |
|
| 58 | + if ($page) { |
|
| 59 | + $url = generer_url_public($page, '', true); |
|
| 60 | + } else { |
|
| 61 | + $url = calculer_url_redirect_entite($type, $id, $var_mode); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - $status = '302'; |
|
| 65 | - if ($url) { |
|
| 66 | - if ($var_mode) { |
|
| 67 | - $url = parametre_url($url, 'var_mode', $var_mode, '&'); |
|
| 68 | - } |
|
| 64 | + $status = '302'; |
|
| 65 | + if ($url) { |
|
| 66 | + if ($var_mode) { |
|
| 67 | + $url = parametre_url($url, 'var_mode', $var_mode, '&'); |
|
| 68 | + } |
|
| 69 | 69 | |
| 70 | - if ($var_mode == 'preview' |
|
| 71 | - and defined('_PREVIEW_TOKEN') |
|
| 72 | - and _PREVIEW_TOKEN |
|
| 73 | - and autoriser('previsualiser') |
|
| 74 | - ) { |
|
| 75 | - include_spip('inc/securiser_action'); |
|
| 76 | - $token = calculer_token_previsu($url); |
|
| 77 | - $url = parametre_url($url, 'var_previewtoken', $token); |
|
| 78 | - } |
|
| 70 | + if ($var_mode == 'preview' |
|
| 71 | + and defined('_PREVIEW_TOKEN') |
|
| 72 | + and _PREVIEW_TOKEN |
|
| 73 | + and autoriser('previsualiser') |
|
| 74 | + ) { |
|
| 75 | + include_spip('inc/securiser_action'); |
|
| 76 | + $token = calculer_token_previsu($url); |
|
| 77 | + $url = parametre_url($url, 'var_previewtoken', $token); |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - if (_request('status') and _request('status') == '301') { |
|
| 81 | - $status = '301'; |
|
| 82 | - } |
|
| 83 | - } else { |
|
| 84 | - $url = generer_url_public('404', '', true); |
|
| 85 | - } |
|
| 80 | + if (_request('status') and _request('status') == '301') { |
|
| 81 | + $status = '301'; |
|
| 82 | + } |
|
| 83 | + } else { |
|
| 84 | + $url = generer_url_public('404', '', true); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - redirige_par_entete(str_replace('&', '&', $url), '', $status); |
|
| 87 | + redirige_par_entete(str_replace('&', '&', $url), '', $status); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | /** |
@@ -99,32 +99,32 @@ discard block |
||
| 99 | 99 | * @return string|null |
| 100 | 100 | */ |
| 101 | 101 | function calculer_url_redirect_entite($type, $id, $var_mode) { |
| 102 | - // invalider le cache à chaque modif en bdd |
|
| 103 | - $date = 0; |
|
| 104 | - if (isset($GLOBALS['meta']['derniere_modif'])) { |
|
| 105 | - $date = $GLOBALS['meta']['derniere_modif']; |
|
| 106 | - } |
|
| 107 | - $key = "url-$date-$type-$id"; |
|
| 102 | + // invalider le cache à chaque modif en bdd |
|
| 103 | + $date = 0; |
|
| 104 | + if (isset($GLOBALS['meta']['derniere_modif'])) { |
|
| 105 | + $date = $GLOBALS['meta']['derniere_modif']; |
|
| 106 | + } |
|
| 107 | + $key = "url-$date-$type-$id"; |
|
| 108 | 108 | |
| 109 | - // Obtenir l’url et si elle est publié du cache memoization |
|
| 110 | - if (function_exists('cache_get') and $desc = cache_get($key)) { |
|
| 111 | - list($url, $publie) = $desc; |
|
| 112 | - } |
|
| 113 | - // Si on ne l’a pas trouvé, ou si var mode, on calcule l’url et son état publie |
|
| 114 | - if (empty($desc) or $var_mode) { |
|
| 115 | - $publie = objet_test_si_publie($type, $id); |
|
| 116 | - $url = generer_url_entite_absolue($id, $type, '', '', true); |
|
| 117 | - if (function_exists('cache_set')) { |
|
| 118 | - cache_set($key, array($url, $publie), 3600); |
|
| 119 | - } |
|
| 120 | - } |
|
| 109 | + // Obtenir l’url et si elle est publié du cache memoization |
|
| 110 | + if (function_exists('cache_get') and $desc = cache_get($key)) { |
|
| 111 | + list($url, $publie) = $desc; |
|
| 112 | + } |
|
| 113 | + // Si on ne l’a pas trouvé, ou si var mode, on calcule l’url et son état publie |
|
| 114 | + if (empty($desc) or $var_mode) { |
|
| 115 | + $publie = objet_test_si_publie($type, $id); |
|
| 116 | + $url = generer_url_entite_absolue($id, $type, '', '', true); |
|
| 117 | + if (function_exists('cache_set')) { |
|
| 118 | + cache_set($key, array($url, $publie), 3600); |
|
| 119 | + } |
|
| 120 | + } |
|
| 121 | 121 | |
| 122 | - // On valide l’url si elle est publiee ; sinon si preview on teste l’autorisation |
|
| 123 | - if ($publie) { |
|
| 124 | - return $url; |
|
| 125 | - } elseif (defined('_VAR_PREVIEW') and _VAR_PREVIEW and autoriser('voir', $type, $id)) { |
|
| 126 | - return $url; |
|
| 127 | - } |
|
| 122 | + // On valide l’url si elle est publiee ; sinon si preview on teste l’autorisation |
|
| 123 | + if ($publie) { |
|
| 124 | + return $url; |
|
| 125 | + } elseif (defined('_VAR_PREVIEW') and _VAR_PREVIEW and autoriser('voir', $type, $id)) { |
|
| 126 | + return $url; |
|
| 127 | + } |
|
| 128 | 128 | |
| 129 | - return; |
|
| 129 | + return; |
|
| 130 | 130 | } |
| 131 | 131 | \ No newline at end of file |
@@ -4,118 +4,118 @@ |
||
| 4 | 4 | // ** ne pas modifier le fichier ** |
| 5 | 5 | |
| 6 | 6 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 7 | - return; |
|
| 7 | + return; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $GLOBALS[$GLOBALS['idx_lang']] = array( |
| 11 | 11 | |
| 12 | - // A |
|
| 13 | - 'accueil_site' => 'ホーム', |
|
| 14 | - 'article' => '記事', |
|
| 15 | - 'articles' => '記事', |
|
| 16 | - 'articles_auteur' => 'この著者の記事', |
|
| 17 | - 'articles_populaires' => '人気のある記事', |
|
| 18 | - 'articles_rubrique' => 'このセクションにある記事', |
|
| 19 | - 'aucun_article' => 'このアドレスに記事はありません', |
|
| 20 | - 'aucun_auteur' => 'このアドレスに著者はいません', |
|
| 21 | - 'aucun_site' => 'このアドレスにサイトはありません', |
|
| 22 | - 'aucune_breve' => 'このアドレスにニュースはありません', |
|
| 23 | - 'aucune_rubrique' => 'このアドレスにセクションはありません', |
|
| 24 | - 'auteur' => '著者', |
|
| 25 | - 'autres' => 'その他', |
|
| 26 | - 'autres_breves' => '他のニュース', |
|
| 27 | - 'autres_groupes_mots_clefs' => 'キーワードの他のグループ', |
|
| 28 | - 'autres_sites' => '他のサイト', |
|
| 29 | - |
|
| 30 | - // B |
|
| 31 | - 'bonjour' => 'こんにちは', |
|
| 32 | - |
|
| 33 | - // C |
|
| 34 | - 'commenter_site' => 'このサイトについてコメントして下さい', |
|
| 35 | - 'contact' => '連絡先', |
|
| 36 | - 'copie_document_impossible' => 'ファイルのコーピは不可能です', |
|
| 37 | - |
|
| 38 | - // D |
|
| 39 | - 'date' => '日付', |
|
| 40 | - 'dernier_ajout' => '最新の追加', |
|
| 41 | - 'dernieres_breves' => '最新のニュース', |
|
| 42 | - 'derniers_articles' => '最新の記事', |
|
| 43 | - 'derniers_commentaires' => '最新のコメント', |
|
| 44 | - 'derniers_messages_forum' => 'フォーラムで投稿された最新のメッセージ', |
|
| 45 | - |
|
| 46 | - // E |
|
| 47 | - 'edition_mode_texte' => 'テキストモード編集', |
|
| 48 | - 'en_reponse' => '返事として:', |
|
| 49 | - 'en_resume' => 'まとめとして', |
|
| 50 | - 'envoyer_message' => 'メッセージを送る', |
|
| 51 | - 'espace_prive' => '管理エリア', |
|
| 52 | - |
|
| 53 | - // F |
|
| 54 | - 'formats_acceptes' => '受け入れるファイルのフォーマット: @formats@です。', |
|
| 55 | - |
|
| 56 | - // H |
|
| 57 | - 'hierarchie_site' => 'サイトの階層', |
|
| 58 | - |
|
| 59 | - // J |
|
| 60 | - 'jours' => '日付', |
|
| 61 | - |
|
| 62 | - // L |
|
| 63 | - 'lien_connecter' => 'ログイン', |
|
| 64 | - |
|
| 65 | - // M |
|
| 66 | - 'meme_auteur' => '同じ著者', |
|
| 67 | - 'meme_rubrique' => '同じセクションの中で', |
|
| 68 | - 'memes_auteurs' => '同じ著者', |
|
| 69 | - 'message' => 'フォーラムのメッセージ', |
|
| 70 | - 'messages_forum' => 'フォーラムのメッセージ', |
|
| 71 | - 'messages_recents' => '最新のフォーラムのメッセージ', |
|
| 72 | - 'mots_clef' => 'キーワード', |
|
| 73 | - 'mots_clefs' => 'キーワード', |
|
| 74 | - 'mots_clefs_meme_groupe' => '同じグループのキーワード', |
|
| 75 | - |
|
| 76 | - // N |
|
| 77 | - 'navigation' => 'ナビゲーション', |
|
| 78 | - 'nom' => 'お名前', |
|
| 79 | - 'nouveautes' => '最新刊', |
|
| 80 | - 'nouveautes_web' => 'ウェブに関する最新刊', |
|
| 81 | - 'nouveaux_articles' => '新しい記事', |
|
| 82 | - 'nouvelles_breves' => '新しいニュース', |
|
| 83 | - |
|
| 84 | - // P |
|
| 85 | - 'page_precedente' => '前のページ', |
|
| 86 | - 'page_suivante' => '次のページ', |
|
| 87 | - 'par_auteur' => '著者:', |
|
| 88 | - 'participer_site' => 'サインアップすると、サイトにご自分の記事を書くことが出来ます。申し込みしてから、管理エリアへのアクセスコードがメールで届きます。', |
|
| 89 | - 'plan_site' => 'サイトマップ', |
|
| 90 | - 'popularite' => '人気', |
|
| 91 | - 'poster_message' => 'メッセージを投稿する', |
|
| 92 | - 'proposer_site' => '追加するサイトを提案できるセクション:', |
|
| 93 | - |
|
| 94 | - // R |
|
| 95 | - 'repondre_article' => 'この記事に返信する', |
|
| 96 | - 'repondre_breve' => 'このニュースに返信する', |
|
| 97 | - 'resultats_recherche' => '検索結果', |
|
| 98 | - 'retour_debut_forums' => 'フォーラムの最初のページに戻る', |
|
| 99 | - 'rubrique' => 'セクション', |
|
| 100 | - 'rubriques' => 'セクション', |
|
| 101 | - |
|
| 102 | - // S |
|
| 103 | - 'signatures_petition' => '署名', |
|
| 104 | - 'site_realise_avec_spip' => 'SPIPで創造されたサイトです', |
|
| 105 | - 'sites_web' => 'ウェブサイト', |
|
| 106 | - 'sous_rubriques' => 'サブセクション', |
|
| 107 | - 'spam' => '迷惑メール', |
|
| 108 | - 'suite' => '次へ', |
|
| 109 | - 'sur_web' => 'ウェブ上', |
|
| 110 | - 'syndiquer_rubrique' => 'このセクションを供給する', |
|
| 111 | - 'syndiquer_site' => '全サイトを供給する', |
|
| 112 | - |
|
| 113 | - // T |
|
| 114 | - 'texte_lettre_information' => 'サイトのニュースレター', |
|
| 115 | - 'texte_lettre_information_2' => '最新刊をまとめるニュースレター', |
|
| 116 | - |
|
| 117 | - // V |
|
| 118 | - 'ver_imprimer' => '印刷用のバージョン', |
|
| 119 | - 'voir_en_ligne' => 'オンラインで見る', |
|
| 120 | - 'voir_squelette' => 'ページのテンプレートを見る' |
|
| 12 | + // A |
|
| 13 | + 'accueil_site' => 'ホーム', |
|
| 14 | + 'article' => '記事', |
|
| 15 | + 'articles' => '記事', |
|
| 16 | + 'articles_auteur' => 'この著者の記事', |
|
| 17 | + 'articles_populaires' => '人気のある記事', |
|
| 18 | + 'articles_rubrique' => 'このセクションにある記事', |
|
| 19 | + 'aucun_article' => 'このアドレスに記事はありません', |
|
| 20 | + 'aucun_auteur' => 'このアドレスに著者はいません', |
|
| 21 | + 'aucun_site' => 'このアドレスにサイトはありません', |
|
| 22 | + 'aucune_breve' => 'このアドレスにニュースはありません', |
|
| 23 | + 'aucune_rubrique' => 'このアドレスにセクションはありません', |
|
| 24 | + 'auteur' => '著者', |
|
| 25 | + 'autres' => 'その他', |
|
| 26 | + 'autres_breves' => '他のニュース', |
|
| 27 | + 'autres_groupes_mots_clefs' => 'キーワードの他のグループ', |
|
| 28 | + 'autres_sites' => '他のサイト', |
|
| 29 | + |
|
| 30 | + // B |
|
| 31 | + 'bonjour' => 'こんにちは', |
|
| 32 | + |
|
| 33 | + // C |
|
| 34 | + 'commenter_site' => 'このサイトについてコメントして下さい', |
|
| 35 | + 'contact' => '連絡先', |
|
| 36 | + 'copie_document_impossible' => 'ファイルのコーピは不可能です', |
|
| 37 | + |
|
| 38 | + // D |
|
| 39 | + 'date' => '日付', |
|
| 40 | + 'dernier_ajout' => '最新の追加', |
|
| 41 | + 'dernieres_breves' => '最新のニュース', |
|
| 42 | + 'derniers_articles' => '最新の記事', |
|
| 43 | + 'derniers_commentaires' => '最新のコメント', |
|
| 44 | + 'derniers_messages_forum' => 'フォーラムで投稿された最新のメッセージ', |
|
| 45 | + |
|
| 46 | + // E |
|
| 47 | + 'edition_mode_texte' => 'テキストモード編集', |
|
| 48 | + 'en_reponse' => '返事として:', |
|
| 49 | + 'en_resume' => 'まとめとして', |
|
| 50 | + 'envoyer_message' => 'メッセージを送る', |
|
| 51 | + 'espace_prive' => '管理エリア', |
|
| 52 | + |
|
| 53 | + // F |
|
| 54 | + 'formats_acceptes' => '受け入れるファイルのフォーマット: @formats@です。', |
|
| 55 | + |
|
| 56 | + // H |
|
| 57 | + 'hierarchie_site' => 'サイトの階層', |
|
| 58 | + |
|
| 59 | + // J |
|
| 60 | + 'jours' => '日付', |
|
| 61 | + |
|
| 62 | + // L |
|
| 63 | + 'lien_connecter' => 'ログイン', |
|
| 64 | + |
|
| 65 | + // M |
|
| 66 | + 'meme_auteur' => '同じ著者', |
|
| 67 | + 'meme_rubrique' => '同じセクションの中で', |
|
| 68 | + 'memes_auteurs' => '同じ著者', |
|
| 69 | + 'message' => 'フォーラムのメッセージ', |
|
| 70 | + 'messages_forum' => 'フォーラムのメッセージ', |
|
| 71 | + 'messages_recents' => '最新のフォーラムのメッセージ', |
|
| 72 | + 'mots_clef' => 'キーワード', |
|
| 73 | + 'mots_clefs' => 'キーワード', |
|
| 74 | + 'mots_clefs_meme_groupe' => '同じグループのキーワード', |
|
| 75 | + |
|
| 76 | + // N |
|
| 77 | + 'navigation' => 'ナビゲーション', |
|
| 78 | + 'nom' => 'お名前', |
|
| 79 | + 'nouveautes' => '最新刊', |
|
| 80 | + 'nouveautes_web' => 'ウェブに関する最新刊', |
|
| 81 | + 'nouveaux_articles' => '新しい記事', |
|
| 82 | + 'nouvelles_breves' => '新しいニュース', |
|
| 83 | + |
|
| 84 | + // P |
|
| 85 | + 'page_precedente' => '前のページ', |
|
| 86 | + 'page_suivante' => '次のページ', |
|
| 87 | + 'par_auteur' => '著者:', |
|
| 88 | + 'participer_site' => 'サインアップすると、サイトにご自分の記事を書くことが出来ます。申し込みしてから、管理エリアへのアクセスコードがメールで届きます。', |
|
| 89 | + 'plan_site' => 'サイトマップ', |
|
| 90 | + 'popularite' => '人気', |
|
| 91 | + 'poster_message' => 'メッセージを投稿する', |
|
| 92 | + 'proposer_site' => '追加するサイトを提案できるセクション:', |
|
| 93 | + |
|
| 94 | + // R |
|
| 95 | + 'repondre_article' => 'この記事に返信する', |
|
| 96 | + 'repondre_breve' => 'このニュースに返信する', |
|
| 97 | + 'resultats_recherche' => '検索結果', |
|
| 98 | + 'retour_debut_forums' => 'フォーラムの最初のページに戻る', |
|
| 99 | + 'rubrique' => 'セクション', |
|
| 100 | + 'rubriques' => 'セクション', |
|
| 101 | + |
|
| 102 | + // S |
|
| 103 | + 'signatures_petition' => '署名', |
|
| 104 | + 'site_realise_avec_spip' => 'SPIPで創造されたサイトです', |
|
| 105 | + 'sites_web' => 'ウェブサイト', |
|
| 106 | + 'sous_rubriques' => 'サブセクション', |
|
| 107 | + 'spam' => '迷惑メール', |
|
| 108 | + 'suite' => '次へ', |
|
| 109 | + 'sur_web' => 'ウェブ上', |
|
| 110 | + 'syndiquer_rubrique' => 'このセクションを供給する', |
|
| 111 | + 'syndiquer_site' => '全サイトを供給する', |
|
| 112 | + |
|
| 113 | + // T |
|
| 114 | + 'texte_lettre_information' => 'サイトのニュースレター', |
|
| 115 | + 'texte_lettre_information_2' => '最新刊をまとめるニュースレター', |
|
| 116 | + |
|
| 117 | + // V |
|
| 118 | + 'ver_imprimer' => '印刷用のバージョン', |
|
| 119 | + 'voir_en_ligne' => 'オンラインで見る', |
|
| 120 | + 'voir_squelette' => 'ページのテンプレートを見る' |
|
| 121 | 121 | ); |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -33,105 +33,105 @@ discard block |
||
| 33 | 33 | **/ |
| 34 | 34 | function analyse_csv($t) { |
| 35 | 35 | |
| 36 | - // Quel est le séparateur ? |
|
| 37 | - $virg = substr_count($t, ','); |
|
| 38 | - $pvirg = substr_count($t, ';'); |
|
| 39 | - $tab = substr_count($t, "\t"); |
|
| 40 | - if ($virg > $pvirg) { |
|
| 41 | - $sep = ','; |
|
| 42 | - $hs = ','; |
|
| 43 | - } else { |
|
| 44 | - $sep = ';'; |
|
| 45 | - $hs = ';'; |
|
| 46 | - $virg = $pvirg; |
|
| 47 | - } |
|
| 48 | - // un certain nombre de tab => le séparateur est tab |
|
| 49 | - if ($tab > $virg / 10) { |
|
| 50 | - $sep = "\t"; |
|
| 51 | - $hs = "\t"; |
|
| 52 | - } |
|
| 36 | + // Quel est le séparateur ? |
|
| 37 | + $virg = substr_count($t, ','); |
|
| 38 | + $pvirg = substr_count($t, ';'); |
|
| 39 | + $tab = substr_count($t, "\t"); |
|
| 40 | + if ($virg > $pvirg) { |
|
| 41 | + $sep = ','; |
|
| 42 | + $hs = ','; |
|
| 43 | + } else { |
|
| 44 | + $sep = ';'; |
|
| 45 | + $hs = ';'; |
|
| 46 | + $virg = $pvirg; |
|
| 47 | + } |
|
| 48 | + // un certain nombre de tab => le séparateur est tab |
|
| 49 | + if ($tab > $virg / 10) { |
|
| 50 | + $sep = "\t"; |
|
| 51 | + $hs = "\t"; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - // un separateur suivi de 3 guillemets attention ! |
|
| 55 | - // attention au ; ou , suceptible d'etre confondu avec un separateur |
|
| 56 | - // on substitue un # et on remplacera a la fin |
|
| 57 | - $t = preg_replace("/([\n$sep])\"\"\"/", '\\1""#', $t); |
|
| 58 | - $t = str_replace('""', '"#', $t); |
|
| 59 | - preg_match_all('/"[^"]*"/', $t, $r); |
|
| 60 | - foreach ($r[0] as $cell) { |
|
| 61 | - $t = str_replace($cell, |
|
| 62 | - str_replace($sep, $hs, |
|
| 63 | - str_replace("\n", "``**``", // échapper les saut de lignes, on les remettra après. |
|
| 64 | - substr($cell, 1, -1))), |
|
| 65 | - $t); |
|
| 66 | - } |
|
| 54 | + // un separateur suivi de 3 guillemets attention ! |
|
| 55 | + // attention au ; ou , suceptible d'etre confondu avec un separateur |
|
| 56 | + // on substitue un # et on remplacera a la fin |
|
| 57 | + $t = preg_replace("/([\n$sep])\"\"\"/", '\\1""#', $t); |
|
| 58 | + $t = str_replace('""', '"#', $t); |
|
| 59 | + preg_match_all('/"[^"]*"/', $t, $r); |
|
| 60 | + foreach ($r[0] as $cell) { |
|
| 61 | + $t = str_replace($cell, |
|
| 62 | + str_replace($sep, $hs, |
|
| 63 | + str_replace("\n", "``**``", // échapper les saut de lignes, on les remettra après. |
|
| 64 | + substr($cell, 1, -1))), |
|
| 65 | + $t); |
|
| 66 | + } |
|
| 67 | 67 | |
| 68 | - $t = preg_replace('/\r?\n/', "\n", |
|
| 69 | - preg_replace('/[\r\n]+/', "\n", $t)); |
|
| 68 | + $t = preg_replace('/\r?\n/', "\n", |
|
| 69 | + preg_replace('/[\r\n]+/', "\n", $t)); |
|
| 70 | 70 | |
| 71 | - list($entete, $corps) = explode("\n", $t, 2); |
|
| 72 | - $caption = ''; |
|
| 73 | - // sauter la ligne de tete formee seulement de separateurs |
|
| 74 | - if (substr_count($entete, $sep) == strlen($entete)) { |
|
| 75 | - list($entete, $corps) = explode("\n", $corps, 2); |
|
| 76 | - } |
|
| 77 | - // si une seule colonne, en faire le titre |
|
| 78 | - if (preg_match("/^([^$sep]+)$sep+\$/", $entete, $l)) { |
|
| 79 | - $caption = "\n||" . $l[1] . "|"; |
|
| 80 | - list($entete, $corps) = explode("\n", $corps, 2); |
|
| 81 | - } |
|
| 82 | - // si premiere colonne vide, le raccourci doit quand meme produire <th... |
|
| 83 | - if ($entete[0] == $sep) { |
|
| 84 | - $entete = ' ' . $entete; |
|
| 85 | - } |
|
| 71 | + list($entete, $corps) = explode("\n", $t, 2); |
|
| 72 | + $caption = ''; |
|
| 73 | + // sauter la ligne de tete formee seulement de separateurs |
|
| 74 | + if (substr_count($entete, $sep) == strlen($entete)) { |
|
| 75 | + list($entete, $corps) = explode("\n", $corps, 2); |
|
| 76 | + } |
|
| 77 | + // si une seule colonne, en faire le titre |
|
| 78 | + if (preg_match("/^([^$sep]+)$sep+\$/", $entete, $l)) { |
|
| 79 | + $caption = "\n||" . $l[1] . "|"; |
|
| 80 | + list($entete, $corps) = explode("\n", $corps, 2); |
|
| 81 | + } |
|
| 82 | + // si premiere colonne vide, le raccourci doit quand meme produire <th... |
|
| 83 | + if ($entete[0] == $sep) { |
|
| 84 | + $entete = ' ' . $entete; |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | - $lignes = explode("\n", $corps); |
|
| 87 | + $lignes = explode("\n", $corps); |
|
| 88 | 88 | |
| 89 | - // retrait des lignes vides finales |
|
| 90 | - while (count($lignes) > 0 |
|
| 91 | - and preg_match("/^$sep*$/", $lignes[count($lignes) - 1])) { |
|
| 92 | - unset($lignes[count($lignes) - 1]); |
|
| 93 | - } |
|
| 94 | - // calcul du nombre de colonne a chaque ligne |
|
| 95 | - $nbcols = array(); |
|
| 96 | - $max = $mil = substr_count($entete, $sep); |
|
| 97 | - foreach ($lignes as $k => $v) { |
|
| 98 | - if ($max <> ($nbcols[$k] = substr_count($v, $sep))) { |
|
| 99 | - if ($max > $nbcols[$k]) { |
|
| 100 | - $mil = $nbcols[$k]; |
|
| 101 | - } else { |
|
| 102 | - $mil = $max; |
|
| 103 | - $max = $nbcols[$k]; |
|
| 104 | - } |
|
| 105 | - } |
|
| 106 | - } |
|
| 107 | - // Si pas le meme nombre, cadrer au nombre max |
|
| 108 | - if ($mil <> $max) { |
|
| 109 | - foreach ($nbcols as $k => $v) { |
|
| 110 | - if ($v < $max) { |
|
| 111 | - $lignes[$k] .= str_repeat($sep, $max - $v); |
|
| 112 | - } |
|
| 113 | - } |
|
| 114 | - } |
|
| 115 | - // et retirer les colonnes integralement vides |
|
| 116 | - while (true) { |
|
| 117 | - $nbcols = ($entete[strlen($entete) - 1] === $sep); |
|
| 118 | - foreach ($lignes as $v) { |
|
| 119 | - $nbcols &= ($v[strlen($v) - 1] === $sep); |
|
| 120 | - } |
|
| 121 | - if (!$nbcols) { |
|
| 122 | - break; |
|
| 123 | - } |
|
| 124 | - $entete = substr($entete, 0, -1); |
|
| 125 | - foreach ($lignes as $k => $v) { |
|
| 126 | - $lignes[$k] = substr($v, 0, -1); |
|
| 127 | - } |
|
| 128 | - } |
|
| 89 | + // retrait des lignes vides finales |
|
| 90 | + while (count($lignes) > 0 |
|
| 91 | + and preg_match("/^$sep*$/", $lignes[count($lignes) - 1])) { |
|
| 92 | + unset($lignes[count($lignes) - 1]); |
|
| 93 | + } |
|
| 94 | + // calcul du nombre de colonne a chaque ligne |
|
| 95 | + $nbcols = array(); |
|
| 96 | + $max = $mil = substr_count($entete, $sep); |
|
| 97 | + foreach ($lignes as $k => $v) { |
|
| 98 | + if ($max <> ($nbcols[$k] = substr_count($v, $sep))) { |
|
| 99 | + if ($max > $nbcols[$k]) { |
|
| 100 | + $mil = $nbcols[$k]; |
|
| 101 | + } else { |
|
| 102 | + $mil = $max; |
|
| 103 | + $max = $nbcols[$k]; |
|
| 104 | + } |
|
| 105 | + } |
|
| 106 | + } |
|
| 107 | + // Si pas le meme nombre, cadrer au nombre max |
|
| 108 | + if ($mil <> $max) { |
|
| 109 | + foreach ($nbcols as $k => $v) { |
|
| 110 | + if ($v < $max) { |
|
| 111 | + $lignes[$k] .= str_repeat($sep, $max - $v); |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | + } |
|
| 115 | + // et retirer les colonnes integralement vides |
|
| 116 | + while (true) { |
|
| 117 | + $nbcols = ($entete[strlen($entete) - 1] === $sep); |
|
| 118 | + foreach ($lignes as $v) { |
|
| 119 | + $nbcols &= ($v[strlen($v) - 1] === $sep); |
|
| 120 | + } |
|
| 121 | + if (!$nbcols) { |
|
| 122 | + break; |
|
| 123 | + } |
|
| 124 | + $entete = substr($entete, 0, -1); |
|
| 125 | + foreach ($lignes as $k => $v) { |
|
| 126 | + $lignes[$k] = substr($v, 0, -1); |
|
| 127 | + } |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - foreach ($lignes as &$l) { |
|
| 131 | - $l = str_replace('"#','"',$l); |
|
| 132 | - $l = str_replace('``**``',"\n",$l); |
|
| 133 | - $l = explode($sep, $l); |
|
| 134 | - } |
|
| 130 | + foreach ($lignes as &$l) { |
|
| 131 | + $l = str_replace('"#','"',$l); |
|
| 132 | + $l = str_replace('``**``',"\n",$l); |
|
| 133 | + $l = explode($sep, $l); |
|
| 134 | + } |
|
| 135 | 135 | |
| 136 | - return array(explode($sep, $entete), $lignes, $caption); |
|
| 136 | + return array(explode($sep, $entete), $lignes, $caption); |
|
| 137 | 137 | } |
@@ -4,118 +4,118 @@ |
||
| 4 | 4 | // ** ne pas modifier le fichier ** |
| 5 | 5 | |
| 6 | 6 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 7 | - return; |
|
| 7 | + return; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $GLOBALS[$GLOBALS['idx_lang']] = array( |
| 11 | 11 | |
| 12 | - // A |
|
| 13 | - 'accueil_site' => 'Homepagina', |
|
| 14 | - 'article' => 'Artikel', |
|
| 15 | - 'articles' => 'Artikelen', |
|
| 16 | - 'articles_auteur' => 'Artikelen van deze auteur', |
|
| 17 | - 'articles_populaires' => 'Meest bekeken artikelen', |
|
| 18 | - 'articles_rubrique' => 'Artikelen in deze rubriek', |
|
| 19 | - 'aucun_article' => 'Op dit adres is geen artikel te vinden', |
|
| 20 | - 'aucun_auteur' => 'Op dit adres is geen auteur te vinden', |
|
| 21 | - 'aucun_site' => 'Op dit adres is geen site te vinden', |
|
| 22 | - 'aucune_breve' => 'Op dit adres is geen nieuwsflits te vinden', |
|
| 23 | - 'aucune_rubrique' => 'Op dit adres is geen rubriek te vinden', |
|
| 24 | - 'auteur' => 'Auteur', |
|
| 25 | - 'autres' => 'Anderen', |
|
| 26 | - 'autres_breves' => 'Andere nieuwsflitsen', |
|
| 27 | - 'autres_groupes_mots_clefs' => 'Andere groepen trefwoorden', |
|
| 28 | - 'autres_sites' => 'Andere sites', |
|
| 29 | - |
|
| 30 | - // B |
|
| 31 | - 'bonjour' => 'Hallo', |
|
| 32 | - |
|
| 33 | - // C |
|
| 34 | - 'commenter_site' => 'Reageren op de site', |
|
| 35 | - 'contact' => 'Contact', |
|
| 36 | - 'copie_document_impossible' => 'Het is niet mogelijk het document te kopiëren', |
|
| 37 | - |
|
| 38 | - // D |
|
| 39 | - 'date' => 'Datum', |
|
| 40 | - 'dernier_ajout' => 'Laatste toevoeging', |
|
| 41 | - 'dernieres_breves' => 'Laatste nieuwsflitsen', |
|
| 42 | - 'derniers_articles' => 'Laatste artikelen', |
|
| 43 | - 'derniers_commentaires' => 'Laatste commentaren', |
|
| 44 | - 'derniers_messages_forum' => 'Laatst gepubliceerde berichten in het forum', |
|
| 45 | - |
|
| 46 | - // E |
|
| 47 | - 'edition_mode_texte' => 'Uitgave in tekstmodus van', |
|
| 48 | - 'en_reponse' => 'Als antwoord op:', |
|
| 49 | - 'en_resume' => 'Samengevat', |
|
| 50 | - 'envoyer_message' => 'Een bericht sturen', |
|
| 51 | - 'espace_prive' => 'Privé gedeelte', |
|
| 52 | - |
|
| 53 | - // F |
|
| 54 | - 'formats_acceptes' => 'Toegelaten formaten: @formats@.', |
|
| 55 | - |
|
| 56 | - // H |
|
| 57 | - 'hierarchie_site' => 'Structuur van de site', |
|
| 58 | - |
|
| 59 | - // J |
|
| 60 | - 'jours' => 'dagen', |
|
| 61 | - |
|
| 62 | - // L |
|
| 63 | - 'lien_connecter' => 'Aanmelden', |
|
| 64 | - |
|
| 65 | - // M |
|
| 66 | - 'meme_auteur' => 'Van dezelfde auteur', |
|
| 67 | - 'meme_rubrique' => 'In dezelfde rubriek', |
|
| 68 | - 'memes_auteurs' => 'Van dezelfde auteurs', |
|
| 69 | - 'message' => 'Bericht', |
|
| 70 | - 'messages_forum' => 'Berichten', |
|
| 71 | - 'messages_recents' => 'Meest recente forumberichten', |
|
| 72 | - 'mots_clef' => 'Trefwoord', |
|
| 73 | - 'mots_clefs' => 'Trefwoorden', |
|
| 74 | - 'mots_clefs_meme_groupe' => 'Trefwoorden van dezelfde groep', |
|
| 75 | - |
|
| 76 | - // N |
|
| 77 | - 'navigation' => 'Navigatie', |
|
| 78 | - 'nom' => 'Naam', |
|
| 79 | - 'nouveautes' => 'Nieuwigheden', |
|
| 80 | - 'nouveautes_web' => 'Nieuwigheden op het Web', |
|
| 81 | - 'nouveaux_articles' => 'Nieuwe artikelen', |
|
| 82 | - 'nouvelles_breves' => 'Nieuwe nieuwsflitsen', |
|
| 83 | - |
|
| 84 | - // P |
|
| 85 | - 'page_precedente' => 'vorige pagina', |
|
| 86 | - 'page_suivante' => 'volgende pagina', |
|
| 87 | - 'par_auteur' => 'door ', |
|
| 88 | - 'participer_site' => 'Wanneer je je hieronder inschrijft, kun je zelf een bijdrage leveren aan deze site door je eigen artikelen voor te stellen. Je ontvangt meteen een e-mail met daarin de toegangscode voor het privé-gedeelte van de site.', |
|
| 89 | - 'plan_site' => 'Overzicht van de site', |
|
| 90 | - 'popularite' => 'Populariteit', |
|
| 91 | - 'poster_message' => 'Een bericht plaatsen', |
|
| 92 | - 'proposer_site' => 'Je kan voorstellen een site in deze rubriek op te nemen:', |
|
| 93 | - |
|
| 94 | - // R |
|
| 95 | - 'repondre_article' => 'Dit artikel beantwoorden', |
|
| 96 | - 'repondre_breve' => 'Op deze nieuwsflits reageren', |
|
| 97 | - 'resultats_recherche' => 'Resultaten van de zoekopdracht', |
|
| 98 | - 'retour_debut_forums' => 'Terug naar de startpagina van de forums', |
|
| 99 | - 'rubrique' => 'Rubriek', |
|
| 100 | - 'rubriques' => 'Rubrieken', |
|
| 101 | - |
|
| 102 | - // S |
|
| 103 | - 'signatures_petition' => 'Ondertekeningen', |
|
| 104 | - 'site_realise_avec_spip' => 'Site gebouwd met SPIP', |
|
| 105 | - 'sites_web' => 'Websites', |
|
| 106 | - 'sous_rubriques' => 'Subrubrieken', |
|
| 107 | - 'spam' => 'Spam', |
|
| 108 | - 'suite' => 'vervolg', |
|
| 109 | - 'sur_web' => 'Op het web', |
|
| 110 | - 'syndiquer_rubrique' => 'Nieuws overnemen uit deze rubriek', |
|
| 111 | - 'syndiquer_site' => 'Nieuws overnemen van de hele site', |
|
| 112 | - |
|
| 113 | - // T |
|
| 114 | - 'texte_lettre_information' => 'Dit is de nieuwsbrief van de site', |
|
| 115 | - 'texte_lettre_information_2' => 'Deze nieuwsbrief toont de publicaties vanaf', |
|
| 116 | - |
|
| 117 | - // V |
|
| 118 | - 'ver_imprimer' => 'Afdrukversie', |
|
| 119 | - 'voir_en_ligne' => 'Online bekijken', |
|
| 120 | - 'voir_squelette' => 'het skelet van deze bladzijde bekijken' |
|
| 12 | + // A |
|
| 13 | + 'accueil_site' => 'Homepagina', |
|
| 14 | + 'article' => 'Artikel', |
|
| 15 | + 'articles' => 'Artikelen', |
|
| 16 | + 'articles_auteur' => 'Artikelen van deze auteur', |
|
| 17 | + 'articles_populaires' => 'Meest bekeken artikelen', |
|
| 18 | + 'articles_rubrique' => 'Artikelen in deze rubriek', |
|
| 19 | + 'aucun_article' => 'Op dit adres is geen artikel te vinden', |
|
| 20 | + 'aucun_auteur' => 'Op dit adres is geen auteur te vinden', |
|
| 21 | + 'aucun_site' => 'Op dit adres is geen site te vinden', |
|
| 22 | + 'aucune_breve' => 'Op dit adres is geen nieuwsflits te vinden', |
|
| 23 | + 'aucune_rubrique' => 'Op dit adres is geen rubriek te vinden', |
|
| 24 | + 'auteur' => 'Auteur', |
|
| 25 | + 'autres' => 'Anderen', |
|
| 26 | + 'autres_breves' => 'Andere nieuwsflitsen', |
|
| 27 | + 'autres_groupes_mots_clefs' => 'Andere groepen trefwoorden', |
|
| 28 | + 'autres_sites' => 'Andere sites', |
|
| 29 | + |
|
| 30 | + // B |
|
| 31 | + 'bonjour' => 'Hallo', |
|
| 32 | + |
|
| 33 | + // C |
|
| 34 | + 'commenter_site' => 'Reageren op de site', |
|
| 35 | + 'contact' => 'Contact', |
|
| 36 | + 'copie_document_impossible' => 'Het is niet mogelijk het document te kopiëren', |
|
| 37 | + |
|
| 38 | + // D |
|
| 39 | + 'date' => 'Datum', |
|
| 40 | + 'dernier_ajout' => 'Laatste toevoeging', |
|
| 41 | + 'dernieres_breves' => 'Laatste nieuwsflitsen', |
|
| 42 | + 'derniers_articles' => 'Laatste artikelen', |
|
| 43 | + 'derniers_commentaires' => 'Laatste commentaren', |
|
| 44 | + 'derniers_messages_forum' => 'Laatst gepubliceerde berichten in het forum', |
|
| 45 | + |
|
| 46 | + // E |
|
| 47 | + 'edition_mode_texte' => 'Uitgave in tekstmodus van', |
|
| 48 | + 'en_reponse' => 'Als antwoord op:', |
|
| 49 | + 'en_resume' => 'Samengevat', |
|
| 50 | + 'envoyer_message' => 'Een bericht sturen', |
|
| 51 | + 'espace_prive' => 'Privé gedeelte', |
|
| 52 | + |
|
| 53 | + // F |
|
| 54 | + 'formats_acceptes' => 'Toegelaten formaten: @formats@.', |
|
| 55 | + |
|
| 56 | + // H |
|
| 57 | + 'hierarchie_site' => 'Structuur van de site', |
|
| 58 | + |
|
| 59 | + // J |
|
| 60 | + 'jours' => 'dagen', |
|
| 61 | + |
|
| 62 | + // L |
|
| 63 | + 'lien_connecter' => 'Aanmelden', |
|
| 64 | + |
|
| 65 | + // M |
|
| 66 | + 'meme_auteur' => 'Van dezelfde auteur', |
|
| 67 | + 'meme_rubrique' => 'In dezelfde rubriek', |
|
| 68 | + 'memes_auteurs' => 'Van dezelfde auteurs', |
|
| 69 | + 'message' => 'Bericht', |
|
| 70 | + 'messages_forum' => 'Berichten', |
|
| 71 | + 'messages_recents' => 'Meest recente forumberichten', |
|
| 72 | + 'mots_clef' => 'Trefwoord', |
|
| 73 | + 'mots_clefs' => 'Trefwoorden', |
|
| 74 | + 'mots_clefs_meme_groupe' => 'Trefwoorden van dezelfde groep', |
|
| 75 | + |
|
| 76 | + // N |
|
| 77 | + 'navigation' => 'Navigatie', |
|
| 78 | + 'nom' => 'Naam', |
|
| 79 | + 'nouveautes' => 'Nieuwigheden', |
|
| 80 | + 'nouveautes_web' => 'Nieuwigheden op het Web', |
|
| 81 | + 'nouveaux_articles' => 'Nieuwe artikelen', |
|
| 82 | + 'nouvelles_breves' => 'Nieuwe nieuwsflitsen', |
|
| 83 | + |
|
| 84 | + // P |
|
| 85 | + 'page_precedente' => 'vorige pagina', |
|
| 86 | + 'page_suivante' => 'volgende pagina', |
|
| 87 | + 'par_auteur' => 'door ', |
|
| 88 | + 'participer_site' => 'Wanneer je je hieronder inschrijft, kun je zelf een bijdrage leveren aan deze site door je eigen artikelen voor te stellen. Je ontvangt meteen een e-mail met daarin de toegangscode voor het privé-gedeelte van de site.', |
|
| 89 | + 'plan_site' => 'Overzicht van de site', |
|
| 90 | + 'popularite' => 'Populariteit', |
|
| 91 | + 'poster_message' => 'Een bericht plaatsen', |
|
| 92 | + 'proposer_site' => 'Je kan voorstellen een site in deze rubriek op te nemen:', |
|
| 93 | + |
|
| 94 | + // R |
|
| 95 | + 'repondre_article' => 'Dit artikel beantwoorden', |
|
| 96 | + 'repondre_breve' => 'Op deze nieuwsflits reageren', |
|
| 97 | + 'resultats_recherche' => 'Resultaten van de zoekopdracht', |
|
| 98 | + 'retour_debut_forums' => 'Terug naar de startpagina van de forums', |
|
| 99 | + 'rubrique' => 'Rubriek', |
|
| 100 | + 'rubriques' => 'Rubrieken', |
|
| 101 | + |
|
| 102 | + // S |
|
| 103 | + 'signatures_petition' => 'Ondertekeningen', |
|
| 104 | + 'site_realise_avec_spip' => 'Site gebouwd met SPIP', |
|
| 105 | + 'sites_web' => 'Websites', |
|
| 106 | + 'sous_rubriques' => 'Subrubrieken', |
|
| 107 | + 'spam' => 'Spam', |
|
| 108 | + 'suite' => 'vervolg', |
|
| 109 | + 'sur_web' => 'Op het web', |
|
| 110 | + 'syndiquer_rubrique' => 'Nieuws overnemen uit deze rubriek', |
|
| 111 | + 'syndiquer_site' => 'Nieuws overnemen van de hele site', |
|
| 112 | + |
|
| 113 | + // T |
|
| 114 | + 'texte_lettre_information' => 'Dit is de nieuwsbrief van de site', |
|
| 115 | + 'texte_lettre_information_2' => 'Deze nieuwsbrief toont de publicaties vanaf', |
|
| 116 | + |
|
| 117 | + // V |
|
| 118 | + 'ver_imprimer' => 'Afdrukversie', |
|
| 119 | + 'voir_en_ligne' => 'Online bekijken', |
|
| 120 | + 'voir_squelette' => 'het skelet van deze bladzijde bekijken' |
|
| 121 | 121 | ); |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Surligne |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -35,44 +35,44 @@ discard block |
||
| 35 | 35 | * Page HTML |
| 36 | 36 | **/ |
| 37 | 37 | function surligner_mots($page, $surcharge_surligne = '') { |
| 38 | - $surlignejs_engines = array( |
|
| 39 | - array( |
|
| 40 | - "," . str_replace(array("/", "."), array("\/", "\."), $GLOBALS['meta']['adresse_site']) . ",i", |
|
| 41 | - ",recherche=([^&]+),i" |
|
| 42 | - ), //SPIP |
|
| 43 | - array(",^http://(www\.)?google\.,i", ",q=([^&]+),i"), // Google |
|
| 44 | - array(",^http://(www\.)?search\.yahoo\.,i", ",p=([^&]+),i"), // Yahoo |
|
| 45 | - array(",^http://(www\.)?search\.msn\.,i", ",q=([^&]+),i"), // MSN |
|
| 46 | - array(",^http://(www\.)?search\.live\.,i", ",query=([^&]+),i"), // MSN Live |
|
| 47 | - array(",^http://(www\.)?search\.aol\.,i", ",userQuery=([^&]+),i"), // AOL |
|
| 48 | - array(",^http://(www\.)?ask\.com,i", ",q=([^&]+),i"), // Ask.com |
|
| 49 | - array(",^http://(www\.)?altavista\.,i", ",q=([^&]+),i"), // AltaVista |
|
| 50 | - array(",^http://(www\.)?feedster\.,i", ",q=([^&]+),i"), // Feedster |
|
| 51 | - array(",^http://(www\.)?search\.lycos\.,i", ",q=([^&]+),i"), // Lycos |
|
| 52 | - array(",^http://(www\.)?alltheweb\.,i", ",q=([^&]+),i"), // AllTheWeb |
|
| 53 | - array(",^http://(www\.)?technorati\.com,i", ",([^\?\/]+)(?:\?.*)$,i"), // Technorati |
|
| 54 | - ); |
|
| 38 | + $surlignejs_engines = array( |
|
| 39 | + array( |
|
| 40 | + "," . str_replace(array("/", "."), array("\/", "\."), $GLOBALS['meta']['adresse_site']) . ",i", |
|
| 41 | + ",recherche=([^&]+),i" |
|
| 42 | + ), //SPIP |
|
| 43 | + array(",^http://(www\.)?google\.,i", ",q=([^&]+),i"), // Google |
|
| 44 | + array(",^http://(www\.)?search\.yahoo\.,i", ",p=([^&]+),i"), // Yahoo |
|
| 45 | + array(",^http://(www\.)?search\.msn\.,i", ",q=([^&]+),i"), // MSN |
|
| 46 | + array(",^http://(www\.)?search\.live\.,i", ",query=([^&]+),i"), // MSN Live |
|
| 47 | + array(",^http://(www\.)?search\.aol\.,i", ",userQuery=([^&]+),i"), // AOL |
|
| 48 | + array(",^http://(www\.)?ask\.com,i", ",q=([^&]+),i"), // Ask.com |
|
| 49 | + array(",^http://(www\.)?altavista\.,i", ",q=([^&]+),i"), // AltaVista |
|
| 50 | + array(",^http://(www\.)?feedster\.,i", ",q=([^&]+),i"), // Feedster |
|
| 51 | + array(",^http://(www\.)?search\.lycos\.,i", ",q=([^&]+),i"), // Lycos |
|
| 52 | + array(",^http://(www\.)?alltheweb\.,i", ",q=([^&]+),i"), // AllTheWeb |
|
| 53 | + array(",^http://(www\.)?technorati\.com,i", ",([^\?\/]+)(?:\?.*)$,i"), // Technorati |
|
| 54 | + ); |
|
| 55 | 55 | |
| 56 | 56 | |
| 57 | - $ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null; |
|
| 58 | - //avoid a js injection |
|
| 59 | - if ($surcharge_surligne) { |
|
| 60 | - $surcharge_surligne = preg_replace(",(?<!\\\\)((?:(?>\\\\){2})*)('),", "$1\\\\$2", $surcharge_surligne); |
|
| 61 | - $surcharge_surligne = str_replace("\\", "\\\\", $surcharge_surligne); |
|
| 62 | - if ($GLOBALS['meta']['charset'] == 'utf-8') { |
|
| 63 | - include_spip('inc/charsets'); |
|
| 64 | - if (!is_utf8($surcharge_surligne)) { |
|
| 65 | - $surcharge_surligne = utf8_encode($surcharge_surligne); |
|
| 66 | - } |
|
| 67 | - } |
|
| 68 | - $surcharge_surligne = preg_replace(',\*$,', '', trim($surcharge_surligne)); # supprimer un * final |
|
| 69 | - } |
|
| 70 | - foreach ($surlignejs_engines as $engine) { |
|
| 71 | - if ($surcharge_surligne || (preg_match($engine[0], $ref) && preg_match($engine[1], $ref))) { |
|
| 57 | + $ref = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : null; |
|
| 58 | + //avoid a js injection |
|
| 59 | + if ($surcharge_surligne) { |
|
| 60 | + $surcharge_surligne = preg_replace(",(?<!\\\\)((?:(?>\\\\){2})*)('),", "$1\\\\$2", $surcharge_surligne); |
|
| 61 | + $surcharge_surligne = str_replace("\\", "\\\\", $surcharge_surligne); |
|
| 62 | + if ($GLOBALS['meta']['charset'] == 'utf-8') { |
|
| 63 | + include_spip('inc/charsets'); |
|
| 64 | + if (!is_utf8($surcharge_surligne)) { |
|
| 65 | + $surcharge_surligne = utf8_encode($surcharge_surligne); |
|
| 66 | + } |
|
| 67 | + } |
|
| 68 | + $surcharge_surligne = preg_replace(',\*$,', '', trim($surcharge_surligne)); # supprimer un * final |
|
| 69 | + } |
|
| 70 | + foreach ($surlignejs_engines as $engine) { |
|
| 71 | + if ($surcharge_surligne || (preg_match($engine[0], $ref) && preg_match($engine[1], $ref))) { |
|
| 72 | 72 | |
| 73 | - //good referrer found or var_recherche is not null |
|
| 74 | - include_spip('inc/filtres'); |
|
| 75 | - $script = " |
|
| 73 | + //good referrer found or var_recherche is not null |
|
| 74 | + include_spip('inc/filtres'); |
|
| 75 | + $script = " |
|
| 76 | 76 | <script type='text/javascript' src='" . url_absolue(find_in_path('javascript/SearchHighlight.js')) . "'></script> |
| 77 | 77 | <script type='text/javascript'>/*<![CDATA[*/ |
| 78 | 78 | if (window.jQuery) |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | engines:[/^" . str_replace(array("/", "."), array("\/", "\."), $GLOBALS['meta']['adresse_site']) . "/i,/recherche=([^&]+)/i], |
| 86 | 86 | highlight:'.surlignable', |
| 87 | 87 | nohighlight:'.pas_surlignable'" . |
| 88 | - ($surcharge_surligne ? ", |
|
| 88 | + ($surcharge_surligne ? ", |
|
| 89 | 89 | keys:'$surcharge_surligne'" : "") . ", |
| 90 | 90 | min_length: 3 |
| 91 | 91 | }) |
@@ -93,14 +93,14 @@ discard block |
||
| 93 | 93 | })(jQuery); |
| 94 | 94 | /*]]>*/</script> |
| 95 | 95 | "; |
| 96 | - // on l'insere juste avant </head>, sinon tout en bas |
|
| 97 | - if (is_null($l = strpos($page, '</head>'))) { |
|
| 98 | - $l = strlen($page); |
|
| 99 | - } |
|
| 100 | - $page = substr_replace($page, $script, $l, 0); |
|
| 101 | - break; |
|
| 102 | - } |
|
| 103 | - } |
|
| 96 | + // on l'insere juste avant </head>, sinon tout en bas |
|
| 97 | + if (is_null($l = strpos($page, '</head>'))) { |
|
| 98 | + $l = strlen($page); |
|
| 99 | + } |
|
| 100 | + $page = substr_replace($page, $script, $l, 0); |
|
| 101 | + break; |
|
| 102 | + } |
|
| 103 | + } |
|
| 104 | 104 | |
| 105 | - return $page; |
|
| 105 | + return $page; |
|
| 106 | 106 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/texte_mini'); |
@@ -34,7 +34,7 @@ discard block |
||
| 34 | 34 | * @return array Tablea ('','') |
| 35 | 35 | */ |
| 36 | 36 | function definir_raccourcis_alineas() { |
| 37 | - return array('', ''); |
|
| 37 | + return array('', ''); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * @return string |
| 48 | 48 | */ |
| 49 | 49 | function traiter_tableau($bloc) { |
| 50 | - return $bloc; |
|
| 50 | + return $bloc; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | 63 | function traiter_listes($texte) { |
| 64 | - return $texte; |
|
| 64 | + return $texte; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -77,16 +77,16 @@ discard block |
||
| 77 | 77 | */ |
| 78 | 78 | function traiter_raccourcis($letexte) { |
| 79 | 79 | |
| 80 | - // Appeler les fonctions de pre_traitement |
|
| 81 | - $letexte = pipeline('pre_propre', $letexte); |
|
| 80 | + // Appeler les fonctions de pre_traitement |
|
| 81 | + $letexte = pipeline('pre_propre', $letexte); |
|
| 82 | 82 | |
| 83 | - // APPELER ICI UN PIPELINE traiter_raccourcis ? |
|
| 84 | - // $letexte = pipeline('traiter_raccourcis', $letexte); |
|
| 83 | + // APPELER ICI UN PIPELINE traiter_raccourcis ? |
|
| 84 | + // $letexte = pipeline('traiter_raccourcis', $letexte); |
|
| 85 | 85 | |
| 86 | - // Appeler les fonctions de post-traitement |
|
| 87 | - $letexte = pipeline('post_propre', $letexte); |
|
| 86 | + // Appeler les fonctions de post-traitement |
|
| 87 | + $letexte = pipeline('post_propre', $letexte); |
|
| 88 | 88 | |
| 89 | - return $letexte; |
|
| 89 | + return $letexte; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /************************************************************************************************************************* |
@@ -102,19 +102,19 @@ discard block |
||
| 102 | 102 | * @return string |
| 103 | 103 | */ |
| 104 | 104 | function echappe_js($t, $class = ' class = "echappe-js"') { |
| 105 | - foreach (array('script', 'iframe') as $tag) { |
|
| 106 | - if (stripos($t, "<$tag") !== false |
|
| 107 | - and preg_match_all(',<' . $tag . '.*?($|</' . $tag . '.),isS', $t, $r, PREG_SET_ORDER) |
|
| 108 | - ) { |
|
| 109 | - foreach ($r as $regs) { |
|
| 110 | - $t = str_replace($regs[0], |
|
| 111 | - "<code$class>" . nl2br(spip_htmlspecialchars($regs[0])) . '</code>', |
|
| 112 | - $t); |
|
| 113 | - } |
|
| 114 | - } |
|
| 115 | - } |
|
| 116 | - |
|
| 117 | - return $t; |
|
| 105 | + foreach (array('script', 'iframe') as $tag) { |
|
| 106 | + if (stripos($t, "<$tag") !== false |
|
| 107 | + and preg_match_all(',<' . $tag . '.*?($|</' . $tag . '.),isS', $t, $r, PREG_SET_ORDER) |
|
| 108 | + ) { |
|
| 109 | + foreach ($r as $regs) { |
|
| 110 | + $t = str_replace($regs[0], |
|
| 111 | + "<code$class>" . nl2br(spip_htmlspecialchars($regs[0])) . '</code>', |
|
| 112 | + $t); |
|
| 113 | + } |
|
| 114 | + } |
|
| 115 | + } |
|
| 116 | + |
|
| 117 | + return $t; |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | |
@@ -143,55 +143,55 @@ discard block |
||
| 143 | 143 | * Code protégé |
| 144 | 144 | **/ |
| 145 | 145 | function interdire_scripts($arg, $mode_filtre=null) { |
| 146 | - // on memorise le resultat sur les arguments non triviaux |
|
| 147 | - static $dejavu = array(); |
|
| 148 | - |
|
| 149 | - // Attention, si ce n'est pas une chaine, laisser intact |
|
| 150 | - if (!$arg or !is_string($arg) or !strstr($arg, '<')) { |
|
| 151 | - return $arg; |
|
| 152 | - } |
|
| 153 | - |
|
| 154 | - if (is_null($mode_filtre) or !in_array($mode_filtre, array(-1, 0, 1))) { |
|
| 155 | - $mode_filtre = $GLOBALS['filtrer_javascript']; |
|
| 156 | - } |
|
| 157 | - |
|
| 158 | - if (isset($dejavu[$mode_filtre][$arg])) { |
|
| 159 | - return $dejavu[$mode_filtre][$arg]; |
|
| 160 | - } |
|
| 161 | - |
|
| 162 | - // echapper les tags asp/php |
|
| 163 | - $t = str_replace('<' . '%', '<%', $arg); |
|
| 164 | - |
|
| 165 | - // echapper le php |
|
| 166 | - $t = str_replace('<' . '?', '<?', $t); |
|
| 167 | - |
|
| 168 | - // echapper le < script language=php > |
|
| 169 | - $t = preg_replace(',<(script\b[^>]+\blanguage\b[^\w>]+php\b),UimsS', '<\1', $t); |
|
| 170 | - |
|
| 171 | - // Pour le js, trois modes : parano (-1), prive (0), ok (1) |
|
| 172 | - switch ($mode_filtre) { |
|
| 173 | - case 0: |
|
| 174 | - if (!_DIR_RESTREINT) { |
|
| 175 | - $t = echappe_js($t); |
|
| 176 | - } |
|
| 177 | - break; |
|
| 178 | - case -1: |
|
| 179 | - $t = echappe_js($t); |
|
| 180 | - break; |
|
| 181 | - } |
|
| 182 | - |
|
| 183 | - // pas de <base href /> svp ! |
|
| 184 | - $t = preg_replace(',<(base\b),iS', '<\1', $t); |
|
| 185 | - |
|
| 186 | - // Reinserer les echappements des modeles |
|
| 187 | - if (defined('_PROTEGE_JS_MODELES')) { |
|
| 188 | - $t = echappe_retour($t, "javascript" . _PROTEGE_JS_MODELES); |
|
| 189 | - } |
|
| 190 | - if (defined('_PROTEGE_PHP_MODELES')) { |
|
| 191 | - $t = echappe_retour($t, "php" . _PROTEGE_PHP_MODELES); |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - return $dejavu[$mode_filtre][$arg] = $t; |
|
| 146 | + // on memorise le resultat sur les arguments non triviaux |
|
| 147 | + static $dejavu = array(); |
|
| 148 | + |
|
| 149 | + // Attention, si ce n'est pas une chaine, laisser intact |
|
| 150 | + if (!$arg or !is_string($arg) or !strstr($arg, '<')) { |
|
| 151 | + return $arg; |
|
| 152 | + } |
|
| 153 | + |
|
| 154 | + if (is_null($mode_filtre) or !in_array($mode_filtre, array(-1, 0, 1))) { |
|
| 155 | + $mode_filtre = $GLOBALS['filtrer_javascript']; |
|
| 156 | + } |
|
| 157 | + |
|
| 158 | + if (isset($dejavu[$mode_filtre][$arg])) { |
|
| 159 | + return $dejavu[$mode_filtre][$arg]; |
|
| 160 | + } |
|
| 161 | + |
|
| 162 | + // echapper les tags asp/php |
|
| 163 | + $t = str_replace('<' . '%', '<%', $arg); |
|
| 164 | + |
|
| 165 | + // echapper le php |
|
| 166 | + $t = str_replace('<' . '?', '<?', $t); |
|
| 167 | + |
|
| 168 | + // echapper le < script language=php > |
|
| 169 | + $t = preg_replace(',<(script\b[^>]+\blanguage\b[^\w>]+php\b),UimsS', '<\1', $t); |
|
| 170 | + |
|
| 171 | + // Pour le js, trois modes : parano (-1), prive (0), ok (1) |
|
| 172 | + switch ($mode_filtre) { |
|
| 173 | + case 0: |
|
| 174 | + if (!_DIR_RESTREINT) { |
|
| 175 | + $t = echappe_js($t); |
|
| 176 | + } |
|
| 177 | + break; |
|
| 178 | + case -1: |
|
| 179 | + $t = echappe_js($t); |
|
| 180 | + break; |
|
| 181 | + } |
|
| 182 | + |
|
| 183 | + // pas de <base href /> svp ! |
|
| 184 | + $t = preg_replace(',<(base\b),iS', '<\1', $t); |
|
| 185 | + |
|
| 186 | + // Reinserer les echappements des modeles |
|
| 187 | + if (defined('_PROTEGE_JS_MODELES')) { |
|
| 188 | + $t = echappe_retour($t, "javascript" . _PROTEGE_JS_MODELES); |
|
| 189 | + } |
|
| 190 | + if (defined('_PROTEGE_PHP_MODELES')) { |
|
| 191 | + $t = echappe_retour($t, "php" . _PROTEGE_PHP_MODELES); |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + return $dejavu[$mode_filtre][$arg] = $t; |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | |
@@ -220,64 +220,64 @@ discard block |
||
| 220 | 220 | * Texte transformé |
| 221 | 221 | **/ |
| 222 | 222 | function typo($letexte, $echapper = true, $connect = null, $env = array()) { |
| 223 | - // Plus vite ! |
|
| 224 | - if (!$letexte) { |
|
| 225 | - return $letexte; |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - // les appels directs a cette fonction depuis le php de l'espace |
|
| 229 | - // prive etant historiquement ecrit sans argment $connect |
|
| 230 | - // on utilise la presence de celui-ci pour distinguer les cas |
|
| 231 | - // ou il faut passer interdire_script explicitement |
|
| 232 | - // les appels dans les squelettes (de l'espace prive) fournissant un $connect |
|
| 233 | - // ne seront pas perturbes |
|
| 234 | - $interdire_script = false; |
|
| 235 | - if (is_null($connect)) { |
|
| 236 | - $connect = ''; |
|
| 237 | - $interdire_script = true; |
|
| 238 | - $env['espace_prive'] = test_espace_prive(); |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - // Echapper les codes <html> etc |
|
| 242 | - if ($echapper) { |
|
| 243 | - $letexte = echappe_html($letexte, 'TYPO'); |
|
| 244 | - } |
|
| 245 | - |
|
| 246 | - // |
|
| 247 | - // Installer les modeles, notamment images et documents ; |
|
| 248 | - // |
|
| 249 | - // NOTE : propre() ne passe pas par ici mais directement par corriger_typo |
|
| 250 | - // cf. inc/lien |
|
| 251 | - |
|
| 252 | - $letexte = traiter_modeles($mem = $letexte, false, $echapper ? 'TYPO' : '', $connect, null, $env); |
|
| 253 | - if ($letexte != $mem) { |
|
| 254 | - $echapper = true; |
|
| 255 | - } |
|
| 256 | - unset($mem); |
|
| 257 | - |
|
| 258 | - $letexte = corriger_typo($letexte); |
|
| 259 | - $letexte = echapper_faux_tags($letexte); |
|
| 260 | - |
|
| 261 | - // reintegrer les echappements |
|
| 262 | - if ($echapper) { |
|
| 263 | - $letexte = echappe_retour($letexte, 'TYPO'); |
|
| 264 | - } |
|
| 265 | - |
|
| 266 | - // Dans les appels directs hors squelette, securiser ici aussi |
|
| 267 | - if ($interdire_script) { |
|
| 268 | - $letexte = interdire_scripts($letexte); |
|
| 269 | - } |
|
| 270 | - |
|
| 271 | - // Dans l'espace prive on se mefie de tout contenu dangereux |
|
| 272 | - // https://core.spip.net/issues/3371 |
|
| 273 | - // et aussi dans l'espace public si la globale filtrer_javascript = -1 |
|
| 274 | - // https://core.spip.net/issues/4166 |
|
| 275 | - if ($GLOBALS['filtrer_javascript'] == -1 |
|
| 276 | - or (isset($env['espace_prive']) and $env['espace_prive'] and $GLOBALS['filtrer_javascript']<=0)) { |
|
| 277 | - $letexte = echapper_html_suspect($letexte); |
|
| 278 | - } |
|
| 279 | - |
|
| 280 | - return $letexte; |
|
| 223 | + // Plus vite ! |
|
| 224 | + if (!$letexte) { |
|
| 225 | + return $letexte; |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + // les appels directs a cette fonction depuis le php de l'espace |
|
| 229 | + // prive etant historiquement ecrit sans argment $connect |
|
| 230 | + // on utilise la presence de celui-ci pour distinguer les cas |
|
| 231 | + // ou il faut passer interdire_script explicitement |
|
| 232 | + // les appels dans les squelettes (de l'espace prive) fournissant un $connect |
|
| 233 | + // ne seront pas perturbes |
|
| 234 | + $interdire_script = false; |
|
| 235 | + if (is_null($connect)) { |
|
| 236 | + $connect = ''; |
|
| 237 | + $interdire_script = true; |
|
| 238 | + $env['espace_prive'] = test_espace_prive(); |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + // Echapper les codes <html> etc |
|
| 242 | + if ($echapper) { |
|
| 243 | + $letexte = echappe_html($letexte, 'TYPO'); |
|
| 244 | + } |
|
| 245 | + |
|
| 246 | + // |
|
| 247 | + // Installer les modeles, notamment images et documents ; |
|
| 248 | + // |
|
| 249 | + // NOTE : propre() ne passe pas par ici mais directement par corriger_typo |
|
| 250 | + // cf. inc/lien |
|
| 251 | + |
|
| 252 | + $letexte = traiter_modeles($mem = $letexte, false, $echapper ? 'TYPO' : '', $connect, null, $env); |
|
| 253 | + if ($letexte != $mem) { |
|
| 254 | + $echapper = true; |
|
| 255 | + } |
|
| 256 | + unset($mem); |
|
| 257 | + |
|
| 258 | + $letexte = corriger_typo($letexte); |
|
| 259 | + $letexte = echapper_faux_tags($letexte); |
|
| 260 | + |
|
| 261 | + // reintegrer les echappements |
|
| 262 | + if ($echapper) { |
|
| 263 | + $letexte = echappe_retour($letexte, 'TYPO'); |
|
| 264 | + } |
|
| 265 | + |
|
| 266 | + // Dans les appels directs hors squelette, securiser ici aussi |
|
| 267 | + if ($interdire_script) { |
|
| 268 | + $letexte = interdire_scripts($letexte); |
|
| 269 | + } |
|
| 270 | + |
|
| 271 | + // Dans l'espace prive on se mefie de tout contenu dangereux |
|
| 272 | + // https://core.spip.net/issues/3371 |
|
| 273 | + // et aussi dans l'espace public si la globale filtrer_javascript = -1 |
|
| 274 | + // https://core.spip.net/issues/4166 |
|
| 275 | + if ($GLOBALS['filtrer_javascript'] == -1 |
|
| 276 | + or (isset($env['espace_prive']) and $env['espace_prive'] and $GLOBALS['filtrer_javascript']<=0)) { |
|
| 277 | + $letexte = echapper_html_suspect($letexte); |
|
| 278 | + } |
|
| 279 | + |
|
| 280 | + return $letexte; |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | // Correcteur typographique |
@@ -302,57 +302,57 @@ discard block |
||
| 302 | 302 | */ |
| 303 | 303 | function corriger_typo($letexte, $lang = '') { |
| 304 | 304 | |
| 305 | - // Plus vite ! |
|
| 306 | - if (!$letexte) { |
|
| 307 | - return $letexte; |
|
| 308 | - } |
|
| 309 | - |
|
| 310 | - $letexte = pipeline('pre_typo', $letexte); |
|
| 311 | - |
|
| 312 | - // Caracteres de controle "illegaux" |
|
| 313 | - $letexte = corriger_caracteres($letexte); |
|
| 314 | - |
|
| 315 | - // Proteger les caracteres typographiques a l'interieur des tags html |
|
| 316 | - if (preg_match_all(_TYPO_BALISE, $letexte, $regs, PREG_SET_ORDER)) { |
|
| 317 | - foreach ($regs as $reg) { |
|
| 318 | - $insert = $reg[0]; |
|
| 319 | - // hack: on transforme les caracteres a proteger en les remplacant |
|
| 320 | - // par des caracteres "illegaux". (cf corriger_caracteres()) |
|
| 321 | - $insert = strtr($insert, _TYPO_PROTEGER, _TYPO_PROTECTEUR); |
|
| 322 | - $letexte = str_replace($reg[0], $insert, $letexte); |
|
| 323 | - } |
|
| 324 | - } |
|
| 325 | - |
|
| 326 | - // trouver les blocs idiomes et les traiter à part |
|
| 327 | - $letexte = extraire_idiome($ei = $letexte, $lang, true); |
|
| 328 | - $ei = ($ei !== $letexte); |
|
| 329 | - |
|
| 330 | - // trouver les blocs multi et les traiter a part |
|
| 331 | - $letexte = extraire_multi($em = $letexte, $lang, true); |
|
| 332 | - $em = ($em !== $letexte); |
|
| 333 | - |
|
| 334 | - // Charger & appliquer les fonctions de typographie |
|
| 335 | - $typographie = charger_fonction(lang_typo($lang), 'typographie'); |
|
| 336 | - $letexte = $typographie($letexte); |
|
| 337 | - |
|
| 338 | - // Les citations en une autre langue, s'il y a lieu |
|
| 339 | - if ($em) { |
|
| 340 | - $letexte = echappe_retour($letexte, 'multi'); |
|
| 341 | - } |
|
| 342 | - if ($ei) { |
|
| 343 | - $letexte = echappe_retour($letexte, 'idiome'); |
|
| 344 | - } |
|
| 345 | - |
|
| 346 | - // Retablir les caracteres proteges |
|
| 347 | - $letexte = strtr($letexte, _TYPO_PROTECTEUR, _TYPO_PROTEGER); |
|
| 348 | - |
|
| 349 | - // pipeline |
|
| 350 | - $letexte = pipeline('post_typo', $letexte); |
|
| 351 | - |
|
| 352 | - # un message pour abs_url - on est passe en mode texte |
|
| 353 | - $GLOBALS['mode_abs_url'] = 'texte'; |
|
| 354 | - |
|
| 355 | - return $letexte; |
|
| 305 | + // Plus vite ! |
|
| 306 | + if (!$letexte) { |
|
| 307 | + return $letexte; |
|
| 308 | + } |
|
| 309 | + |
|
| 310 | + $letexte = pipeline('pre_typo', $letexte); |
|
| 311 | + |
|
| 312 | + // Caracteres de controle "illegaux" |
|
| 313 | + $letexte = corriger_caracteres($letexte); |
|
| 314 | + |
|
| 315 | + // Proteger les caracteres typographiques a l'interieur des tags html |
|
| 316 | + if (preg_match_all(_TYPO_BALISE, $letexte, $regs, PREG_SET_ORDER)) { |
|
| 317 | + foreach ($regs as $reg) { |
|
| 318 | + $insert = $reg[0]; |
|
| 319 | + // hack: on transforme les caracteres a proteger en les remplacant |
|
| 320 | + // par des caracteres "illegaux". (cf corriger_caracteres()) |
|
| 321 | + $insert = strtr($insert, _TYPO_PROTEGER, _TYPO_PROTECTEUR); |
|
| 322 | + $letexte = str_replace($reg[0], $insert, $letexte); |
|
| 323 | + } |
|
| 324 | + } |
|
| 325 | + |
|
| 326 | + // trouver les blocs idiomes et les traiter à part |
|
| 327 | + $letexte = extraire_idiome($ei = $letexte, $lang, true); |
|
| 328 | + $ei = ($ei !== $letexte); |
|
| 329 | + |
|
| 330 | + // trouver les blocs multi et les traiter a part |
|
| 331 | + $letexte = extraire_multi($em = $letexte, $lang, true); |
|
| 332 | + $em = ($em !== $letexte); |
|
| 333 | + |
|
| 334 | + // Charger & appliquer les fonctions de typographie |
|
| 335 | + $typographie = charger_fonction(lang_typo($lang), 'typographie'); |
|
| 336 | + $letexte = $typographie($letexte); |
|
| 337 | + |
|
| 338 | + // Les citations en une autre langue, s'il y a lieu |
|
| 339 | + if ($em) { |
|
| 340 | + $letexte = echappe_retour($letexte, 'multi'); |
|
| 341 | + } |
|
| 342 | + if ($ei) { |
|
| 343 | + $letexte = echappe_retour($letexte, 'idiome'); |
|
| 344 | + } |
|
| 345 | + |
|
| 346 | + // Retablir les caracteres proteges |
|
| 347 | + $letexte = strtr($letexte, _TYPO_PROTECTEUR, _TYPO_PROTEGER); |
|
| 348 | + |
|
| 349 | + // pipeline |
|
| 350 | + $letexte = pipeline('post_typo', $letexte); |
|
| 351 | + |
|
| 352 | + # un message pour abs_url - on est passe en mode texte |
|
| 353 | + $GLOBALS['mode_abs_url'] = 'texte'; |
|
| 354 | + |
|
| 355 | + return $letexte; |
|
| 356 | 356 | } |
| 357 | 357 | |
| 358 | 358 | |
@@ -368,7 +368,7 @@ discard block |
||
| 368 | 368 | * @return string |
| 369 | 369 | */ |
| 370 | 370 | function paragrapher($letexte, $forcer = true) { |
| 371 | - return $letexte; |
|
| 371 | + return $letexte; |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | /** |
@@ -380,11 +380,11 @@ discard block |
||
| 380 | 380 | * @return string Texte |
| 381 | 381 | **/ |
| 382 | 382 | function traiter_retours_chariots($letexte) { |
| 383 | - $letexte = preg_replace(",\r\n?,S", "\n", $letexte); |
|
| 384 | - $letexte = preg_replace(",<p[>[:space:]],iS", "\n\n\\0", $letexte); |
|
| 385 | - $letexte = preg_replace(",</p[>[:space:]],iS", "\\0\n\n", $letexte); |
|
| 383 | + $letexte = preg_replace(",\r\n?,S", "\n", $letexte); |
|
| 384 | + $letexte = preg_replace(",<p[>[:space:]],iS", "\n\n\\0", $letexte); |
|
| 385 | + $letexte = preg_replace(",</p[>[:space:]],iS", "\\0\n\n", $letexte); |
|
| 386 | 386 | |
| 387 | - return $letexte; |
|
| 387 | + return $letexte; |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | |
@@ -410,37 +410,37 @@ discard block |
||
| 410 | 410 | * Texte transformé |
| 411 | 411 | **/ |
| 412 | 412 | function propre($t, $connect = null, $env = array()) { |
| 413 | - // les appels directs a cette fonction depuis le php de l'espace |
|
| 414 | - // prive etant historiquement ecrits sans argment $connect |
|
| 415 | - // on utilise la presence de celui-ci pour distinguer les cas |
|
| 416 | - // ou il faut passer interdire_script explicitement |
|
| 417 | - // les appels dans les squelettes (de l'espace prive) fournissant un $connect |
|
| 418 | - // ne seront pas perturbes |
|
| 419 | - $interdire_script = false; |
|
| 420 | - if (is_null($connect)) { |
|
| 421 | - $connect = ''; |
|
| 422 | - $interdire_script = true; |
|
| 423 | - } |
|
| 424 | - |
|
| 425 | - if (!$t) { |
|
| 426 | - return strval($t); |
|
| 427 | - } |
|
| 428 | - |
|
| 429 | - // Dans l'espace prive on se mefie de tout contenu dangereux |
|
| 430 | - // avant echappement des balises <html> |
|
| 431 | - // https://core.spip.net/issues/3371 |
|
| 432 | - // et aussi dans l'espace public si la globale filtrer_javascript = -1 |
|
| 433 | - // https://core.spip.net/issues/4166 |
|
| 434 | - if ($interdire_script |
|
| 435 | - or $GLOBALS['filtrer_javascript'] == -1 |
|
| 436 | - or (isset($env['espace_prive']) and $env['espace_prive'] and $GLOBALS['filtrer_javascript']<=0) |
|
| 437 | - or (isset($env['wysiwyg']) and $env['wysiwyg'] and $GLOBALS['filtrer_javascript']<=0)) { |
|
| 438 | - $t = echapper_html_suspect($t, false); |
|
| 439 | - } |
|
| 440 | - $t = echappe_html($t); |
|
| 441 | - $t = expanser_liens($t, $connect, $env); |
|
| 442 | - $t = traiter_raccourcis($t); |
|
| 443 | - $t = echappe_retour_modeles($t, $interdire_script); |
|
| 444 | - |
|
| 445 | - return $t; |
|
| 413 | + // les appels directs a cette fonction depuis le php de l'espace |
|
| 414 | + // prive etant historiquement ecrits sans argment $connect |
|
| 415 | + // on utilise la presence de celui-ci pour distinguer les cas |
|
| 416 | + // ou il faut passer interdire_script explicitement |
|
| 417 | + // les appels dans les squelettes (de l'espace prive) fournissant un $connect |
|
| 418 | + // ne seront pas perturbes |
|
| 419 | + $interdire_script = false; |
|
| 420 | + if (is_null($connect)) { |
|
| 421 | + $connect = ''; |
|
| 422 | + $interdire_script = true; |
|
| 423 | + } |
|
| 424 | + |
|
| 425 | + if (!$t) { |
|
| 426 | + return strval($t); |
|
| 427 | + } |
|
| 428 | + |
|
| 429 | + // Dans l'espace prive on se mefie de tout contenu dangereux |
|
| 430 | + // avant echappement des balises <html> |
|
| 431 | + // https://core.spip.net/issues/3371 |
|
| 432 | + // et aussi dans l'espace public si la globale filtrer_javascript = -1 |
|
| 433 | + // https://core.spip.net/issues/4166 |
|
| 434 | + if ($interdire_script |
|
| 435 | + or $GLOBALS['filtrer_javascript'] == -1 |
|
| 436 | + or (isset($env['espace_prive']) and $env['espace_prive'] and $GLOBALS['filtrer_javascript']<=0) |
|
| 437 | + or (isset($env['wysiwyg']) and $env['wysiwyg'] and $GLOBALS['filtrer_javascript']<=0)) { |
|
| 438 | + $t = echapper_html_suspect($t, false); |
|
| 439 | + } |
|
| 440 | + $t = echappe_html($t); |
|
| 441 | + $t = expanser_liens($t, $connect, $env); |
|
| 442 | + $t = traiter_raccourcis($t); |
|
| 443 | + $t = echappe_retour_modeles($t, $interdire_script); |
|
| 444 | + |
|
| 445 | + return $t; |
|
| 446 | 446 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/config'); |
@@ -37,26 +37,26 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function exec_admin_plugin_dist($retour = '') { |
| 39 | 39 | |
| 40 | - if (!autoriser('configurer', '_plugins')) { |
|
| 41 | - include_spip('inc/minipres'); |
|
| 42 | - echo minipres(); |
|
| 43 | - } else { |
|
| 44 | - // on fait la verif du path avant tout, |
|
| 45 | - // et l'installation des qu'on est dans la colonne principale |
|
| 46 | - // si jamais la liste des plugins actifs change, il faut faire un refresh du hit |
|
| 47 | - // pour etre sur que les bons fichiers seront charges lors de l'install |
|
| 48 | - $new = actualise_plugins_actifs(); |
|
| 49 | - if ($new and _request('actualise') < 2) { |
|
| 50 | - include_spip('inc/headers'); |
|
| 51 | - if (isset($GLOBALS['fichier_php_compile_recent'])) { |
|
| 52 | - // attendre eventuellement l'invalidation du cache opcode |
|
| 53 | - spip_attend_invalidation_opcode_cache($GLOBALS['fichier_php_compile_recent']); |
|
| 54 | - } |
|
| 55 | - redirige_par_entete(parametre_url(self(), 'actualise', _request('actualise') + 1, '&')); |
|
| 56 | - } else { |
|
| 57 | - admin_plug_args(_request('voir'), _request('erreur'), _request('format')); |
|
| 58 | - } |
|
| 59 | - } |
|
| 40 | + if (!autoriser('configurer', '_plugins')) { |
|
| 41 | + include_spip('inc/minipres'); |
|
| 42 | + echo minipres(); |
|
| 43 | + } else { |
|
| 44 | + // on fait la verif du path avant tout, |
|
| 45 | + // et l'installation des qu'on est dans la colonne principale |
|
| 46 | + // si jamais la liste des plugins actifs change, il faut faire un refresh du hit |
|
| 47 | + // pour etre sur que les bons fichiers seront charges lors de l'install |
|
| 48 | + $new = actualise_plugins_actifs(); |
|
| 49 | + if ($new and _request('actualise') < 2) { |
|
| 50 | + include_spip('inc/headers'); |
|
| 51 | + if (isset($GLOBALS['fichier_php_compile_recent'])) { |
|
| 52 | + // attendre eventuellement l'invalidation du cache opcode |
|
| 53 | + spip_attend_invalidation_opcode_cache($GLOBALS['fichier_php_compile_recent']); |
|
| 54 | + } |
|
| 55 | + redirige_par_entete(parametre_url(self(), 'actualise', _request('actualise') + 1, '&')); |
|
| 56 | + } else { |
|
| 57 | + admin_plug_args(_request('voir'), _request('erreur'), _request('format')); |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | /** |
@@ -81,126 +81,126 @@ discard block |
||
| 81 | 81 | * Format d'affichage (liste ou arborescence) |
| 82 | 82 | **/ |
| 83 | 83 | function admin_plug_args($quoi, $erreur, $format) { |
| 84 | - if (!$quoi) { |
|
| 85 | - $quoi = 'actifs'; |
|
| 86 | - } |
|
| 87 | - // empecher l'affichage des erreurs dans le bandeau, on le donne ensuite |
|
| 88 | - // format brut par plugin |
|
| 89 | - $GLOBALS['erreurs_activation_raw'] = plugin_donne_erreurs(true, false); |
|
| 90 | - // format resume mis en forme |
|
| 91 | - $erreur_activation = plugin_donne_erreurs(); |
|
| 92 | - $commencer_page = charger_fonction('commencer_page', 'inc'); |
|
| 93 | - echo $commencer_page(_T('icone_admin_plugin'), "configuration", "plugin"); |
|
| 94 | - |
|
| 95 | - echo debut_gauche('plugin', true); |
|
| 96 | - echo recuperer_fond('prive/squelettes/navigation/configurer', array('exec' => 'admin_plugin')); |
|
| 97 | - |
|
| 98 | - echo pipeline('affiche_gauche', |
|
| 99 | - array( |
|
| 100 | - 'args' => array('exec' => 'admin_plugin'), |
|
| 101 | - 'data' => afficher_librairies() |
|
| 102 | - ) |
|
| 103 | - ); |
|
| 104 | - |
|
| 105 | - echo debut_droite('plugin', true); |
|
| 106 | - echo gros_titre(_T('icone_admin_plugin'), '', false); |
|
| 107 | - |
|
| 108 | - // Barre d'onglets de premier niveau |
|
| 109 | - echo barre_onglets("plugins", "plugins_actifs"); |
|
| 110 | - // Barre d'onglets de second niveau |
|
| 111 | - $onglet2 = $quoi == 'actifs' ? 'plugins_actifs' : 'admin_plugin'; |
|
| 112 | - echo debut_onglet('onglets_simple second'); |
|
| 113 | - echo onglet(_T('plugins_tous_liste'), generer_url_ecrire("admin_plugin", "voir=tous"), 'admin_plugin', $onglet2); |
|
| 114 | - echo onglet(_T('plugins_actifs_liste'), generer_url_ecrire("admin_plugin"), 'plugins_actifs', $onglet2); |
|
| 115 | - echo fin_onglet(); |
|
| 116 | - |
|
| 117 | - // message d'erreur au retour d'une operation |
|
| 118 | - if ($erreur) { |
|
| 119 | - echo "<div class='error'>$erreur</div>"; |
|
| 120 | - } |
|
| 121 | - if ($erreur_activation) { |
|
| 122 | - echo "<div class='error'>$erreur_activation</div>"; |
|
| 123 | - } |
|
| 124 | - |
|
| 125 | - // la mise a jour de cette meta a ete faite par ecrire_plugin_actifs |
|
| 126 | - $actifs = unserialize($GLOBALS['meta']['plugin']); |
|
| 127 | - $lcpa = $actifs + unserialize($GLOBALS['meta']['plugin_attente']); |
|
| 128 | - |
|
| 129 | - // Les affichages se basent sur le repertoire, pas sur le nom |
|
| 130 | - $actifs = liste_chemin_plugin($actifs, ''); |
|
| 131 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 132 | - $lcpas = liste_chemin_plugin($lcpa, _DIR_PLUGINS_SUPPL); |
|
| 133 | - } |
|
| 134 | - $lcpa = liste_chemin_plugin($lcpa); |
|
| 135 | - |
|
| 136 | - // on installe les plugins maintenant, |
|
| 137 | - // cela permet aux scripts d'install de faire des affichages (moches...) |
|
| 138 | - plugin_installes_meta(); |
|
| 139 | - |
|
| 140 | - echo "<div class='liste-plugins formulaire_spip'>"; |
|
| 141 | - echo debut_cadre_trait_couleur('plugin-24.png', true, '', _T('plugins_liste'), 'plugins'); |
|
| 142 | - |
|
| 143 | - if ($quoi !== 'actifs') { |
|
| 144 | - $lpf = liste_plugin_files(); |
|
| 145 | - if ($lpf) { |
|
| 146 | - echo "<p>" . _T('texte_presente_plugin') . "</p>"; |
|
| 147 | - } else { |
|
| 148 | - if (!@is_dir(_DIR_PLUGINS)) { |
|
| 149 | - echo "<p>" . _T('plugin_info_automatique_ftp', array('rep' => joli_repertoire(_DIR_PLUGINS))) |
|
| 150 | - . " — " . _T('plugin_info_automatique_creer') . "</p>"; |
|
| 151 | - } |
|
| 152 | - } |
|
| 153 | - $lcpaffiche = $lpf; |
|
| 154 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 155 | - $lcpaffichesup = liste_plugin_files(_DIR_PLUGINS_SUPPL); |
|
| 156 | - } |
|
| 157 | - } else { |
|
| 158 | - // la liste |
|
| 159 | - // $quoi=='actifs' |
|
| 160 | - $lcpaffiche = $lcpa; |
|
| 161 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 162 | - $lcpaffichesup = $lcpas; |
|
| 163 | - } |
|
| 164 | - } |
|
| 165 | - |
|
| 166 | - if ($quoi == 'actifs' or $lpf) { |
|
| 167 | - $nb = count($lcpa); |
|
| 168 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 169 | - $nb += count($lcpas); |
|
| 170 | - } |
|
| 171 | - echo "<h3>" . sinon(singulier_ou_pluriel($nb, 'plugins_actif_un', 'plugins_actifs', 'count'), |
|
| 172 | - _T('plugins_actif_aucun')) . "</h3>"; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - if (empty($format)) { |
|
| 176 | - $format = 'liste'; |
|
| 177 | - } elseif (!in_array($format, array('liste', 'repertoires'))) { |
|
| 178 | - $format = 'repertoires'; |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - $afficher = charger_fonction("afficher_$format", 'plugins'); |
|
| 182 | - $corps = $afficher(self(), $lcpaffiche, $lcpa, $actifs); |
|
| 183 | - if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 184 | - $corps .= $afficher(self(), $lcpaffichesup, $lcpas, $actifs, _DIR_PLUGINS_SUPPL); |
|
| 185 | - } |
|
| 186 | - |
|
| 187 | - if ($corps) { |
|
| 188 | - $corps .= "\n<div class='boutons' style='display:none;'>" |
|
| 189 | - . "<input type='submit' class='submit save' value='" . _T('bouton_enregistrer') |
|
| 190 | - . "' />" |
|
| 191 | - . "</div>"; |
|
| 192 | - } |
|
| 193 | - |
|
| 194 | - echo redirige_action_post('activer_plugins', 'activer', 'admin_plugin', '', $corps); |
|
| 195 | - |
|
| 196 | - echo fin_cadre_trait_couleur(true); |
|
| 197 | - |
|
| 198 | - if ($quoi == 'actifs') { |
|
| 199 | - echo affiche_les_plugins_verrouilles($actifs); |
|
| 200 | - } |
|
| 201 | - echo "</div>"; |
|
| 202 | - |
|
| 203 | - echo http_script(" |
|
| 84 | + if (!$quoi) { |
|
| 85 | + $quoi = 'actifs'; |
|
| 86 | + } |
|
| 87 | + // empecher l'affichage des erreurs dans le bandeau, on le donne ensuite |
|
| 88 | + // format brut par plugin |
|
| 89 | + $GLOBALS['erreurs_activation_raw'] = plugin_donne_erreurs(true, false); |
|
| 90 | + // format resume mis en forme |
|
| 91 | + $erreur_activation = plugin_donne_erreurs(); |
|
| 92 | + $commencer_page = charger_fonction('commencer_page', 'inc'); |
|
| 93 | + echo $commencer_page(_T('icone_admin_plugin'), "configuration", "plugin"); |
|
| 94 | + |
|
| 95 | + echo debut_gauche('plugin', true); |
|
| 96 | + echo recuperer_fond('prive/squelettes/navigation/configurer', array('exec' => 'admin_plugin')); |
|
| 97 | + |
|
| 98 | + echo pipeline('affiche_gauche', |
|
| 99 | + array( |
|
| 100 | + 'args' => array('exec' => 'admin_plugin'), |
|
| 101 | + 'data' => afficher_librairies() |
|
| 102 | + ) |
|
| 103 | + ); |
|
| 104 | + |
|
| 105 | + echo debut_droite('plugin', true); |
|
| 106 | + echo gros_titre(_T('icone_admin_plugin'), '', false); |
|
| 107 | + |
|
| 108 | + // Barre d'onglets de premier niveau |
|
| 109 | + echo barre_onglets("plugins", "plugins_actifs"); |
|
| 110 | + // Barre d'onglets de second niveau |
|
| 111 | + $onglet2 = $quoi == 'actifs' ? 'plugins_actifs' : 'admin_plugin'; |
|
| 112 | + echo debut_onglet('onglets_simple second'); |
|
| 113 | + echo onglet(_T('plugins_tous_liste'), generer_url_ecrire("admin_plugin", "voir=tous"), 'admin_plugin', $onglet2); |
|
| 114 | + echo onglet(_T('plugins_actifs_liste'), generer_url_ecrire("admin_plugin"), 'plugins_actifs', $onglet2); |
|
| 115 | + echo fin_onglet(); |
|
| 116 | + |
|
| 117 | + // message d'erreur au retour d'une operation |
|
| 118 | + if ($erreur) { |
|
| 119 | + echo "<div class='error'>$erreur</div>"; |
|
| 120 | + } |
|
| 121 | + if ($erreur_activation) { |
|
| 122 | + echo "<div class='error'>$erreur_activation</div>"; |
|
| 123 | + } |
|
| 124 | + |
|
| 125 | + // la mise a jour de cette meta a ete faite par ecrire_plugin_actifs |
|
| 126 | + $actifs = unserialize($GLOBALS['meta']['plugin']); |
|
| 127 | + $lcpa = $actifs + unserialize($GLOBALS['meta']['plugin_attente']); |
|
| 128 | + |
|
| 129 | + // Les affichages se basent sur le repertoire, pas sur le nom |
|
| 130 | + $actifs = liste_chemin_plugin($actifs, ''); |
|
| 131 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 132 | + $lcpas = liste_chemin_plugin($lcpa, _DIR_PLUGINS_SUPPL); |
|
| 133 | + } |
|
| 134 | + $lcpa = liste_chemin_plugin($lcpa); |
|
| 135 | + |
|
| 136 | + // on installe les plugins maintenant, |
|
| 137 | + // cela permet aux scripts d'install de faire des affichages (moches...) |
|
| 138 | + plugin_installes_meta(); |
|
| 139 | + |
|
| 140 | + echo "<div class='liste-plugins formulaire_spip'>"; |
|
| 141 | + echo debut_cadre_trait_couleur('plugin-24.png', true, '', _T('plugins_liste'), 'plugins'); |
|
| 142 | + |
|
| 143 | + if ($quoi !== 'actifs') { |
|
| 144 | + $lpf = liste_plugin_files(); |
|
| 145 | + if ($lpf) { |
|
| 146 | + echo "<p>" . _T('texte_presente_plugin') . "</p>"; |
|
| 147 | + } else { |
|
| 148 | + if (!@is_dir(_DIR_PLUGINS)) { |
|
| 149 | + echo "<p>" . _T('plugin_info_automatique_ftp', array('rep' => joli_repertoire(_DIR_PLUGINS))) |
|
| 150 | + . " — " . _T('plugin_info_automatique_creer') . "</p>"; |
|
| 151 | + } |
|
| 152 | + } |
|
| 153 | + $lcpaffiche = $lpf; |
|
| 154 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 155 | + $lcpaffichesup = liste_plugin_files(_DIR_PLUGINS_SUPPL); |
|
| 156 | + } |
|
| 157 | + } else { |
|
| 158 | + // la liste |
|
| 159 | + // $quoi=='actifs' |
|
| 160 | + $lcpaffiche = $lcpa; |
|
| 161 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 162 | + $lcpaffichesup = $lcpas; |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | + |
|
| 166 | + if ($quoi == 'actifs' or $lpf) { |
|
| 167 | + $nb = count($lcpa); |
|
| 168 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 169 | + $nb += count($lcpas); |
|
| 170 | + } |
|
| 171 | + echo "<h3>" . sinon(singulier_ou_pluriel($nb, 'plugins_actif_un', 'plugins_actifs', 'count'), |
|
| 172 | + _T('plugins_actif_aucun')) . "</h3>"; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + if (empty($format)) { |
|
| 176 | + $format = 'liste'; |
|
| 177 | + } elseif (!in_array($format, array('liste', 'repertoires'))) { |
|
| 178 | + $format = 'repertoires'; |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + $afficher = charger_fonction("afficher_$format", 'plugins'); |
|
| 182 | + $corps = $afficher(self(), $lcpaffiche, $lcpa, $actifs); |
|
| 183 | + if (defined('_DIR_PLUGINS_SUPPL')) { |
|
| 184 | + $corps .= $afficher(self(), $lcpaffichesup, $lcpas, $actifs, _DIR_PLUGINS_SUPPL); |
|
| 185 | + } |
|
| 186 | + |
|
| 187 | + if ($corps) { |
|
| 188 | + $corps .= "\n<div class='boutons' style='display:none;'>" |
|
| 189 | + . "<input type='submit' class='submit save' value='" . _T('bouton_enregistrer') |
|
| 190 | + . "' />" |
|
| 191 | + . "</div>"; |
|
| 192 | + } |
|
| 193 | + |
|
| 194 | + echo redirige_action_post('activer_plugins', 'activer', 'admin_plugin', '', $corps); |
|
| 195 | + |
|
| 196 | + echo fin_cadre_trait_couleur(true); |
|
| 197 | + |
|
| 198 | + if ($quoi == 'actifs') { |
|
| 199 | + echo affiche_les_plugins_verrouilles($actifs); |
|
| 200 | + } |
|
| 201 | + echo "</div>"; |
|
| 202 | + |
|
| 203 | + echo http_script(" |
|
| 204 | 204 | jQuery(function(){ |
| 205 | 205 | jQuery('.plugins li.item a[rel=info]').click(function(){ |
| 206 | 206 | var li = jQuery(this).parents('li').eq(0); |
@@ -226,14 +226,14 @@ discard block |
||
| 226 | 226 | }); |
| 227 | 227 | "); |
| 228 | 228 | |
| 229 | - echo pipeline('affiche_milieu', |
|
| 230 | - array( |
|
| 231 | - 'args' => array('exec' => 'admin_plugin'), |
|
| 232 | - 'data' => '' |
|
| 233 | - ) |
|
| 234 | - ); |
|
| 229 | + echo pipeline('affiche_milieu', |
|
| 230 | + array( |
|
| 231 | + 'args' => array('exec' => 'admin_plugin'), |
|
| 232 | + 'data' => '' |
|
| 233 | + ) |
|
| 234 | + ); |
|
| 235 | 235 | |
| 236 | - echo fin_gauche(), fin_page(); |
|
| 236 | + echo fin_gauche(), fin_page(); |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -247,23 +247,23 @@ discard block |
||
| 247 | 247 | * Code HTML |
| 248 | 248 | **/ |
| 249 | 249 | function affiche_les_plugins_verrouilles($actifs) { |
| 250 | - if ((!$liste = liste_plugin_files(_DIR_PLUGINS_DIST))) { |
|
| 251 | - return ''; |
|
| 252 | - } |
|
| 253 | - |
|
| 254 | - $afficher = charger_fonction("afficher_liste", 'plugins'); |
|
| 255 | - $liste = $afficher(self(), $liste, array(), $actifs, _DIR_PLUGINS_DIST); |
|
| 256 | - |
|
| 257 | - return |
|
| 258 | - "<div id='plugins_dist'>" |
|
| 259 | - . debut_cadre_trait_couleur('', true, '', _T('plugins_liste_dist'), 'liste_plugins_dist') |
|
| 260 | - . "<p>" |
|
| 261 | - . _T('plugin_info_plugins_dist_1', array('plugins_dist' => joli_repertoire(_DIR_PLUGINS_DIST))) |
|
| 262 | - . '<br />' . _T('plugin_info_plugins_dist_2') |
|
| 263 | - . "</p>" |
|
| 264 | - . $liste |
|
| 265 | - . fin_cadre_trait_couleur(true) |
|
| 266 | - . "</div>\n"; |
|
| 250 | + if ((!$liste = liste_plugin_files(_DIR_PLUGINS_DIST))) { |
|
| 251 | + return ''; |
|
| 252 | + } |
|
| 253 | + |
|
| 254 | + $afficher = charger_fonction("afficher_liste", 'plugins'); |
|
| 255 | + $liste = $afficher(self(), $liste, array(), $actifs, _DIR_PLUGINS_DIST); |
|
| 256 | + |
|
| 257 | + return |
|
| 258 | + "<div id='plugins_dist'>" |
|
| 259 | + . debut_cadre_trait_couleur('', true, '', _T('plugins_liste_dist'), 'liste_plugins_dist') |
|
| 260 | + . "<p>" |
|
| 261 | + . _T('plugin_info_plugins_dist_1', array('plugins_dist' => joli_repertoire(_DIR_PLUGINS_DIST))) |
|
| 262 | + . '<br />' . _T('plugin_info_plugins_dist_2') |
|
| 263 | + . "</p>" |
|
| 264 | + . $liste |
|
| 265 | + . fin_cadre_trait_couleur(true) |
|
| 266 | + . "</div>\n"; |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | /** |
@@ -275,19 +275,19 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | function afficher_librairies() { |
| 277 | 277 | |
| 278 | - if (!$libs = liste_librairies()) { |
|
| 279 | - return ''; |
|
| 280 | - } |
|
| 281 | - ksort($libs); |
|
| 282 | - $res = debut_cadre_enfonce('', true, '', _T('plugin_librairies_installees')); |
|
| 283 | - $res .= '<dl>'; |
|
| 284 | - foreach ($libs as $lib => $rep) { |
|
| 285 | - $res .= "<dt>$lib</dt><dd>" . joli_repertoire($rep) . "</dd>\n"; |
|
| 286 | - } |
|
| 287 | - $res .= '</dl>'; |
|
| 288 | - $res .= fin_cadre_enfonce(true); |
|
| 289 | - |
|
| 290 | - return $res; |
|
| 278 | + if (!$libs = liste_librairies()) { |
|
| 279 | + return ''; |
|
| 280 | + } |
|
| 281 | + ksort($libs); |
|
| 282 | + $res = debut_cadre_enfonce('', true, '', _T('plugin_librairies_installees')); |
|
| 283 | + $res .= '<dl>'; |
|
| 284 | + foreach ($libs as $lib => $rep) { |
|
| 285 | + $res .= "<dt>$lib</dt><dd>" . joli_repertoire($rep) . "</dd>\n"; |
|
| 286 | + } |
|
| 287 | + $res .= '</dl>'; |
|
| 288 | + $res .= fin_cadre_enfonce(true); |
|
| 289 | + |
|
| 290 | + return $res; |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | |
@@ -298,20 +298,20 @@ discard block |
||
| 298 | 298 | * Tableau (nom de la lib => repertoire , ...) |
| 299 | 299 | */ |
| 300 | 300 | function liste_librairies() { |
| 301 | - $libs = array(); |
|
| 302 | - foreach (array_reverse(creer_chemin()) as $d) { |
|
| 303 | - if (is_dir($dir = $d . 'lib/') |
|
| 304 | - and $t = opendir($dir) |
|
| 305 | - ) { |
|
| 306 | - while (($f = readdir($t)) !== false) { |
|
| 307 | - if ($f[0] != '.' |
|
| 308 | - and is_dir("$dir/$f") |
|
| 309 | - ) { |
|
| 310 | - $libs[$f] = $dir; |
|
| 311 | - } |
|
| 312 | - } |
|
| 313 | - } |
|
| 314 | - } |
|
| 315 | - |
|
| 316 | - return $libs; |
|
| 301 | + $libs = array(); |
|
| 302 | + foreach (array_reverse(creer_chemin()) as $d) { |
|
| 303 | + if (is_dir($dir = $d . 'lib/') |
|
| 304 | + and $t = opendir($dir) |
|
| 305 | + ) { |
|
| 306 | + while (($f = readdir($t)) !== false) { |
|
| 307 | + if ($f[0] != '.' |
|
| 308 | + and is_dir("$dir/$f") |
|
| 309 | + ) { |
|
| 310 | + $libs[$f] = $dir; |
|
| 311 | + } |
|
| 312 | + } |
|
| 313 | + } |
|
| 314 | + } |
|
| 315 | + |
|
| 316 | + return $libs; |
|
| 317 | 317 | } |