@@ -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 | /** |
@@ -30,11 +30,11 @@ discard block |
||
| 30 | 30 | * @return string |
| 31 | 31 | */ |
| 32 | 32 | function set_spip_doc($fichier) { |
| 33 | - if (strpos($fichier, _DIR_IMG) === 0) { |
|
| 34 | - return substr($fichier, strlen(_DIR_IMG)); |
|
| 35 | - } else { |
|
| 36 | - return $fichier; |
|
| 37 | - } // ex: fichier distant |
|
| 33 | + if (strpos($fichier, _DIR_IMG) === 0) { |
|
| 34 | + return substr($fichier, strlen(_DIR_IMG)); |
|
| 35 | + } else { |
|
| 36 | + return $fichier; |
|
| 37 | + } // ex: fichier distant |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -46,24 +46,24 @@ discard block |
||
| 46 | 46 | * @return bool|string |
| 47 | 47 | */ |
| 48 | 48 | function get_spip_doc($fichier) { |
| 49 | - // fichier distant |
|
| 50 | - if (tester_url_absolue($fichier)) { |
|
| 51 | - return $fichier; |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - // gestion d'erreurs, fichier='' |
|
| 55 | - if (!strlen($fichier)) { |
|
| 56 | - return false; |
|
| 57 | - } |
|
| 58 | - |
|
| 59 | - $fichier = ( |
|
| 60 | - strncmp($fichier, _DIR_IMG, strlen(_DIR_IMG)) != 0 |
|
| 61 | - ) |
|
| 62 | - ? _DIR_IMG . $fichier |
|
| 63 | - : $fichier; |
|
| 64 | - |
|
| 65 | - // fichier normal |
|
| 66 | - return $fichier; |
|
| 49 | + // fichier distant |
|
| 50 | + if (tester_url_absolue($fichier)) { |
|
| 51 | + return $fichier; |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + // gestion d'erreurs, fichier='' |
|
| 55 | + if (!strlen($fichier)) { |
|
| 56 | + return false; |
|
| 57 | + } |
|
| 58 | + |
|
| 59 | + $fichier = ( |
|
| 60 | + strncmp($fichier, _DIR_IMG, strlen(_DIR_IMG)) != 0 |
|
| 61 | + ) |
|
| 62 | + ? _DIR_IMG . $fichier |
|
| 63 | + : $fichier; |
|
| 64 | + |
|
| 65 | + // fichier normal |
|
| 66 | + return $fichier; |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | /** |
@@ -77,24 +77,24 @@ discard block |
||
| 77 | 77 | * @return string |
| 78 | 78 | */ |
| 79 | 79 | function creer_repertoire_documents($ext) { |
| 80 | - $rep = sous_repertoire(_DIR_IMG, $ext); |
|
| 81 | - |
|
| 82 | - if (!$ext or !$rep) { |
|
| 83 | - spip_log("creer_repertoire_documents '$rep' interdit"); |
|
| 84 | - exit; |
|
| 85 | - } |
|
| 86 | - |
|
| 87 | - // Cette variable de configuration peut etre posee par un plugin |
|
| 88 | - // par exemple acces_restreint |
|
| 89 | - // sauf pour logo/ utilise pour stocker les logoon et logooff |
|
| 90 | - if (isset($GLOBALS['meta']["creer_htaccess"]) |
|
| 91 | - and $GLOBALS['meta']["creer_htaccess"] == 'oui' |
|
| 92 | - and $ext !== 'logo') { |
|
| 93 | - include_spip('inc/acces'); |
|
| 94 | - verifier_htaccess($rep); |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - return $rep; |
|
| 80 | + $rep = sous_repertoire(_DIR_IMG, $ext); |
|
| 81 | + |
|
| 82 | + if (!$ext or !$rep) { |
|
| 83 | + spip_log("creer_repertoire_documents '$rep' interdit"); |
|
| 84 | + exit; |
|
| 85 | + } |
|
| 86 | + |
|
| 87 | + // Cette variable de configuration peut etre posee par un plugin |
|
| 88 | + // par exemple acces_restreint |
|
| 89 | + // sauf pour logo/ utilise pour stocker les logoon et logooff |
|
| 90 | + if (isset($GLOBALS['meta']["creer_htaccess"]) |
|
| 91 | + and $GLOBALS['meta']["creer_htaccess"] == 'oui' |
|
| 92 | + and $ext !== 'logo') { |
|
| 93 | + include_spip('inc/acces'); |
|
| 94 | + verifier_htaccess($rep); |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + return $rep; |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -103,21 +103,21 @@ discard block |
||
| 103 | 103 | * @param string $nom |
| 104 | 104 | */ |
| 105 | 105 | function effacer_repertoire_temporaire($nom) { |
| 106 | - if ($d = opendir($nom)) { |
|
| 107 | - while (($f = readdir($d)) !== false) { |
|
| 108 | - if (is_file("$nom/$f")) { |
|
| 109 | - spip_unlink("$nom/$f"); |
|
| 110 | - } else { |
|
| 111 | - if ($f <> '.' and $f <> '..' |
|
| 112 | - and is_dir("$nom/$f") |
|
| 113 | - ) { |
|
| 114 | - effacer_repertoire_temporaire("$nom/$f"); |
|
| 115 | - } |
|
| 116 | - } |
|
| 117 | - } |
|
| 118 | - } |
|
| 119 | - closedir($d); |
|
| 120 | - @rmdir($nom); |
|
| 106 | + if ($d = opendir($nom)) { |
|
| 107 | + while (($f = readdir($d)) !== false) { |
|
| 108 | + if (is_file("$nom/$f")) { |
|
| 109 | + spip_unlink("$nom/$f"); |
|
| 110 | + } else { |
|
| 111 | + if ($f <> '.' and $f <> '..' |
|
| 112 | + and is_dir("$nom/$f") |
|
| 113 | + ) { |
|
| 114 | + effacer_repertoire_temporaire("$nom/$f"); |
|
| 115 | + } |
|
| 116 | + } |
|
| 117 | + } |
|
| 118 | + } |
|
| 119 | + closedir($d); |
|
| 120 | + @rmdir($nom); |
|
| 121 | 121 | } |
| 122 | 122 | |
| 123 | 123 | // |
@@ -134,28 +134,28 @@ discard block |
||
| 134 | 134 | */ |
| 135 | 135 | function copier_document($ext, $orig, $source, $subdir = null) { |
| 136 | 136 | |
| 137 | - $orig = preg_replace(',\.\.+,', '.', $orig); // pas de .. dans le nom du doc |
|
| 138 | - $dir = creer_repertoire_documents($subdir ? $subdir : $ext); |
|
| 139 | - $dest = preg_replace("/[^.=\w-]+/", "_", |
|
| 140 | - translitteration(preg_replace("/\.([^.]+)$/", "", |
|
| 141 | - preg_replace("/<[^>]*>/", '', basename($orig))))); |
|
| 137 | + $orig = preg_replace(',\.\.+,', '.', $orig); // pas de .. dans le nom du doc |
|
| 138 | + $dir = creer_repertoire_documents($subdir ? $subdir : $ext); |
|
| 139 | + $dest = preg_replace("/[^.=\w-]+/", "_", |
|
| 140 | + translitteration(preg_replace("/\.([^.]+)$/", "", |
|
| 141 | + preg_replace("/<[^>]*>/", '', basename($orig))))); |
|
| 142 | 142 | |
| 143 | - // ne pas accepter de noms de la forme -r90.jpg qui sont reserves |
|
| 144 | - // pour les images transformees par rotation (action/documenter) |
|
| 145 | - $dest = preg_replace(',-r(90|180|270)$,', '', $dest); |
|
| 143 | + // ne pas accepter de noms de la forme -r90.jpg qui sont reserves |
|
| 144 | + // pour les images transformees par rotation (action/documenter) |
|
| 145 | + $dest = preg_replace(',-r(90|180|270)$,', '', $dest); |
|
| 146 | 146 | |
| 147 | - // Si le document "source" est deja au bon endroit, ne rien faire |
|
| 148 | - if ($source == ($dir . $dest . '.' . $ext)) { |
|
| 149 | - return $source; |
|
| 150 | - } |
|
| 147 | + // Si le document "source" est deja au bon endroit, ne rien faire |
|
| 148 | + if ($source == ($dir . $dest . '.' . $ext)) { |
|
| 149 | + return $source; |
|
| 150 | + } |
|
| 151 | 151 | |
| 152 | - // sinon tourner jusqu'a trouver un numero correct |
|
| 153 | - $n = 0; |
|
| 154 | - while (@file_exists($newFile = $dir . $dest . ($n++ ? ('-' . $n) : '') . '.' . $ext)) { |
|
| 155 | - ; |
|
| 156 | - } |
|
| 152 | + // sinon tourner jusqu'a trouver un numero correct |
|
| 153 | + $n = 0; |
|
| 154 | + while (@file_exists($newFile = $dir . $dest . ($n++ ? ('-' . $n) : '') . '.' . $ext)) { |
|
| 155 | + ; |
|
| 156 | + } |
|
| 157 | 157 | |
| 158 | - return deplacer_fichier_upload($source, $newFile); |
|
| 158 | + return deplacer_fichier_upload($source, $newFile); |
|
| 159 | 159 | } |
| 160 | 160 | |
| 161 | 161 | /** |
@@ -170,28 +170,28 @@ discard block |
||
| 170 | 170 | * @return bool|string |
| 171 | 171 | */ |
| 172 | 172 | function determine_upload($type = '') { |
| 173 | - if (!function_exists('autoriser')) { |
|
| 174 | - include_spip('inc/autoriser'); |
|
| 175 | - } |
|
| 176 | - |
|
| 177 | - if (!autoriser('chargerftp') |
|
| 178 | - or $type == 'logos' |
|
| 179 | - ) # on ne le permet pas pour les logos |
|
| 180 | - { |
|
| 181 | - return false; |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - $repertoire = _DIR_TRANSFERT; |
|
| 185 | - if (!@is_dir($repertoire)) { |
|
| 186 | - $repertoire = str_replace(_DIR_TMP, '', $repertoire); |
|
| 187 | - $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
|
| 188 | - } |
|
| 189 | - |
|
| 190 | - if (!$GLOBALS['visiteur_session']['restreint']) { |
|
| 191 | - return $repertoire; |
|
| 192 | - } else { |
|
| 193 | - return sous_repertoire($repertoire, $GLOBALS['visiteur_session']['login']); |
|
| 194 | - } |
|
| 173 | + if (!function_exists('autoriser')) { |
|
| 174 | + include_spip('inc/autoriser'); |
|
| 175 | + } |
|
| 176 | + |
|
| 177 | + if (!autoriser('chargerftp') |
|
| 178 | + or $type == 'logos' |
|
| 179 | + ) # on ne le permet pas pour les logos |
|
| 180 | + { |
|
| 181 | + return false; |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + $repertoire = _DIR_TRANSFERT; |
|
| 185 | + if (!@is_dir($repertoire)) { |
|
| 186 | + $repertoire = str_replace(_DIR_TMP, '', $repertoire); |
|
| 187 | + $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
|
| 188 | + } |
|
| 189 | + |
|
| 190 | + if (!$GLOBALS['visiteur_session']['restreint']) { |
|
| 191 | + return $repertoire; |
|
| 192 | + } else { |
|
| 193 | + return sous_repertoire($repertoire, $GLOBALS['visiteur_session']['login']); |
|
| 194 | + } |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | /** |
@@ -210,35 +210,35 @@ discard block |
||
| 210 | 210 | * @return bool|mixed|string |
| 211 | 211 | */ |
| 212 | 212 | function deplacer_fichier_upload($source, $dest, $move = false) { |
| 213 | - // Securite |
|
| 214 | - if (substr($dest, 0, strlen(_DIR_RACINE)) == _DIR_RACINE) { |
|
| 215 | - $dest = _DIR_RACINE . preg_replace(',\.\.+,', '.', substr($dest, strlen(_DIR_RACINE))); |
|
| 216 | - } else { |
|
| 217 | - $dest = preg_replace(',\.\.+,', '.', $dest); |
|
| 218 | - } |
|
| 219 | - |
|
| 220 | - if ($move) { |
|
| 221 | - $ok = @rename($source, $dest); |
|
| 222 | - } else { |
|
| 223 | - $ok = @copy($source, $dest); |
|
| 224 | - } |
|
| 225 | - if (!$ok) { |
|
| 226 | - $ok = @move_uploaded_file($source, $dest); |
|
| 227 | - } |
|
| 228 | - if ($ok) { |
|
| 229 | - @chmod($dest, _SPIP_CHMOD & ~0111); |
|
| 230 | - } else { |
|
| 231 | - $f = @fopen($dest, 'w'); |
|
| 232 | - if ($f) { |
|
| 233 | - fclose($f); |
|
| 234 | - } else { |
|
| 235 | - include_spip('inc/flock'); |
|
| 236 | - raler_fichier($dest); |
|
| 237 | - } |
|
| 238 | - spip_unlink($dest); |
|
| 239 | - } |
|
| 240 | - |
|
| 241 | - return $ok ? $dest : false; |
|
| 213 | + // Securite |
|
| 214 | + if (substr($dest, 0, strlen(_DIR_RACINE)) == _DIR_RACINE) { |
|
| 215 | + $dest = _DIR_RACINE . preg_replace(',\.\.+,', '.', substr($dest, strlen(_DIR_RACINE))); |
|
| 216 | + } else { |
|
| 217 | + $dest = preg_replace(',\.\.+,', '.', $dest); |
|
| 218 | + } |
|
| 219 | + |
|
| 220 | + if ($move) { |
|
| 221 | + $ok = @rename($source, $dest); |
|
| 222 | + } else { |
|
| 223 | + $ok = @copy($source, $dest); |
|
| 224 | + } |
|
| 225 | + if (!$ok) { |
|
| 226 | + $ok = @move_uploaded_file($source, $dest); |
|
| 227 | + } |
|
| 228 | + if ($ok) { |
|
| 229 | + @chmod($dest, _SPIP_CHMOD & ~0111); |
|
| 230 | + } else { |
|
| 231 | + $f = @fopen($dest, 'w'); |
|
| 232 | + if ($f) { |
|
| 233 | + fclose($f); |
|
| 234 | + } else { |
|
| 235 | + include_spip('inc/flock'); |
|
| 236 | + raler_fichier($dest); |
|
| 237 | + } |
|
| 238 | + spip_unlink($dest); |
|
| 239 | + } |
|
| 240 | + |
|
| 241 | + return $ok ? $dest : false; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | |
@@ -262,51 +262,51 @@ discard block |
||
| 262 | 262 | */ |
| 263 | 263 | function check_upload_error($error, $msg = '', $return = false) { |
| 264 | 264 | |
| 265 | - if (!$error) { |
|
| 266 | - return false; |
|
| 267 | - } |
|
| 268 | - |
|
| 269 | - spip_log("Erreur upload $error -- cf. http://php.net/manual/fr/features.file-upload.errors.php"); |
|
| 270 | - |
|
| 271 | - switch ($error) { |
|
| 272 | - |
|
| 273 | - case 4: /* UPLOAD_ERR_NO_FILE */ |
|
| 274 | - return true; |
|
| 275 | - |
|
| 276 | - # on peut affiner les differents messages d'erreur |
|
| 277 | - case 1: /* UPLOAD_ERR_INI_SIZE */ |
|
| 278 | - $msg = _T('upload_limit', |
|
| 279 | - array('max' => ini_get('upload_max_filesize'))); |
|
| 280 | - break; |
|
| 281 | - case 2: /* UPLOAD_ERR_FORM_SIZE */ |
|
| 282 | - $msg = _T('upload_limit', |
|
| 283 | - array('max' => ini_get('upload_max_filesize'))); |
|
| 284 | - break; |
|
| 285 | - case 3: /* UPLOAD_ERR_PARTIAL */ |
|
| 286 | - $msg = _T('upload_limit', |
|
| 287 | - array('max' => ini_get('upload_max_filesize'))); |
|
| 288 | - break; |
|
| 289 | - |
|
| 290 | - default: /* autre */ |
|
| 291 | - if (!$msg) { |
|
| 292 | - $msg = _T('pass_erreur') . ' ' . $error |
|
| 293 | - . '<br />' . propre("[->http://php.net/manual/fr/features.file-upload.errors.php]"); |
|
| 294 | - } |
|
| 295 | - break; |
|
| 296 | - } |
|
| 297 | - |
|
| 298 | - spip_log("erreur upload $error"); |
|
| 299 | - if ($return) { |
|
| 300 | - return $msg; |
|
| 301 | - } |
|
| 302 | - |
|
| 303 | - if (_request("iframe") == "iframe") { |
|
| 304 | - echo "<div class='upload_answer upload_error'>$msg</div>"; |
|
| 305 | - exit; |
|
| 306 | - } |
|
| 307 | - |
|
| 308 | - include_spip('inc/minipres'); |
|
| 309 | - echo minipres($msg, |
|
| 310 | - "<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><a href='" . rawurldecode($GLOBALS['redirect']) . "'><button type='button'>" . _T('ecrire:bouton_suivant') . "</button></a></div>"); |
|
| 311 | - exit; |
|
| 265 | + if (!$error) { |
|
| 266 | + return false; |
|
| 267 | + } |
|
| 268 | + |
|
| 269 | + spip_log("Erreur upload $error -- cf. http://php.net/manual/fr/features.file-upload.errors.php"); |
|
| 270 | + |
|
| 271 | + switch ($error) { |
|
| 272 | + |
|
| 273 | + case 4: /* UPLOAD_ERR_NO_FILE */ |
|
| 274 | + return true; |
|
| 275 | + |
|
| 276 | + # on peut affiner les differents messages d'erreur |
|
| 277 | + case 1: /* UPLOAD_ERR_INI_SIZE */ |
|
| 278 | + $msg = _T('upload_limit', |
|
| 279 | + array('max' => ini_get('upload_max_filesize'))); |
|
| 280 | + break; |
|
| 281 | + case 2: /* UPLOAD_ERR_FORM_SIZE */ |
|
| 282 | + $msg = _T('upload_limit', |
|
| 283 | + array('max' => ini_get('upload_max_filesize'))); |
|
| 284 | + break; |
|
| 285 | + case 3: /* UPLOAD_ERR_PARTIAL */ |
|
| 286 | + $msg = _T('upload_limit', |
|
| 287 | + array('max' => ini_get('upload_max_filesize'))); |
|
| 288 | + break; |
|
| 289 | + |
|
| 290 | + default: /* autre */ |
|
| 291 | + if (!$msg) { |
|
| 292 | + $msg = _T('pass_erreur') . ' ' . $error |
|
| 293 | + . '<br />' . propre("[->http://php.net/manual/fr/features.file-upload.errors.php]"); |
|
| 294 | + } |
|
| 295 | + break; |
|
| 296 | + } |
|
| 297 | + |
|
| 298 | + spip_log("erreur upload $error"); |
|
| 299 | + if ($return) { |
|
| 300 | + return $msg; |
|
| 301 | + } |
|
| 302 | + |
|
| 303 | + if (_request("iframe") == "iframe") { |
|
| 304 | + echo "<div class='upload_answer upload_error'>$msg</div>"; |
|
| 305 | + exit; |
|
| 306 | + } |
|
| 307 | + |
|
| 308 | + include_spip('inc/minipres'); |
|
| 309 | + echo minipres($msg, |
|
| 310 | + "<div style='text-align: " . $GLOBALS['spip_lang_right'] . "'><a href='" . rawurldecode($GLOBALS['redirect']) . "'><button type='button'>" . _T('ecrire:bouton_suivant') . "</button></a></div>"); |
|
| 311 | + exit; |
|
| 312 | 312 | } |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | **/ |
| 21 | 21 | |
| 22 | 22 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 23 | - return; |
|
| 23 | + return; |
|
| 24 | 24 | } |
| 25 | 25 | |
| 26 | 26 | // Ce fichier doit imperativement definir la fonction ci-dessous: |
@@ -39,59 +39,59 @@ discard block |
||
| 39 | 39 | * @return array |
| 40 | 40 | */ |
| 41 | 41 | function public_styliser_dist($fond, $contexte, $lang = '', $connect = '') { |
| 42 | - static $styliser_par_z; |
|
| 43 | - |
|
| 44 | - // s'assurer que le fond est licite |
|
| 45 | - // car il peut etre construit a partir d'une variable d'environnement |
|
| 46 | - if (strpos($fond, "../") !== false or strncmp($fond, '/', 1) == 0) { |
|
| 47 | - $fond = "404"; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - if (strncmp($fond, 'modeles/', 8) == 0) { |
|
| 51 | - $modele = substr($fond, 8); |
|
| 52 | - $modele = styliser_modele($modele, null, $contexte); |
|
| 53 | - $fond = "modeles/$modele"; |
|
| 54 | - } |
|
| 55 | - |
|
| 56 | - // Choisir entre $fond-dist.html, $fond=7.html, etc? |
|
| 57 | - $id_rubrique = 0; |
|
| 58 | - // Chercher le fond qui va servir de squelette |
|
| 59 | - if ($r = quete_rubrique_fond($contexte)) { |
|
| 60 | - list($id_rubrique, $lang) = $r; |
|
| 61 | - } |
|
| 62 | - |
|
| 63 | - // trouver un squelette du nom demande |
|
| 64 | - // ne rien dire si on ne trouve pas, |
|
| 65 | - // c'est l'appelant qui sait comment gerer la situation |
|
| 66 | - // ou les plugins qui feront mieux dans le pipeline |
|
| 67 | - $squelette = trouver_fond($fond, "", true); |
|
| 68 | - $ext = $squelette['extension']; |
|
| 69 | - |
|
| 70 | - $flux = array( |
|
| 71 | - 'args' => array( |
|
| 72 | - 'id_rubrique' => $id_rubrique, |
|
| 73 | - 'ext' => $ext, |
|
| 74 | - 'fond' => $fond, |
|
| 75 | - 'lang' => $lang, |
|
| 76 | - 'contexte' => $contexte, // le style d'un objet peut dependre de lui meme |
|
| 77 | - 'connect' => $connect |
|
| 78 | - ), |
|
| 79 | - 'data' => $squelette['fond'], |
|
| 80 | - ); |
|
| 81 | - |
|
| 82 | - if (test_espace_prive() or defined('_ZPIP')) { |
|
| 83 | - if (!$styliser_par_z) { |
|
| 84 | - $styliser_par_z = charger_fonction('styliser_par_z', 'public'); |
|
| 85 | - } |
|
| 86 | - $flux = $styliser_par_z($flux); |
|
| 87 | - } |
|
| 88 | - |
|
| 89 | - $flux = styliser_par_objets($flux); |
|
| 90 | - |
|
| 91 | - // pipeline styliser |
|
| 92 | - $squelette = pipeline('styliser', $flux); |
|
| 93 | - |
|
| 94 | - return array($squelette, $ext, $ext, "$squelette.$ext"); |
|
| 42 | + static $styliser_par_z; |
|
| 43 | + |
|
| 44 | + // s'assurer que le fond est licite |
|
| 45 | + // car il peut etre construit a partir d'une variable d'environnement |
|
| 46 | + if (strpos($fond, "../") !== false or strncmp($fond, '/', 1) == 0) { |
|
| 47 | + $fond = "404"; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + if (strncmp($fond, 'modeles/', 8) == 0) { |
|
| 51 | + $modele = substr($fond, 8); |
|
| 52 | + $modele = styliser_modele($modele, null, $contexte); |
|
| 53 | + $fond = "modeles/$modele"; |
|
| 54 | + } |
|
| 55 | + |
|
| 56 | + // Choisir entre $fond-dist.html, $fond=7.html, etc? |
|
| 57 | + $id_rubrique = 0; |
|
| 58 | + // Chercher le fond qui va servir de squelette |
|
| 59 | + if ($r = quete_rubrique_fond($contexte)) { |
|
| 60 | + list($id_rubrique, $lang) = $r; |
|
| 61 | + } |
|
| 62 | + |
|
| 63 | + // trouver un squelette du nom demande |
|
| 64 | + // ne rien dire si on ne trouve pas, |
|
| 65 | + // c'est l'appelant qui sait comment gerer la situation |
|
| 66 | + // ou les plugins qui feront mieux dans le pipeline |
|
| 67 | + $squelette = trouver_fond($fond, "", true); |
|
| 68 | + $ext = $squelette['extension']; |
|
| 69 | + |
|
| 70 | + $flux = array( |
|
| 71 | + 'args' => array( |
|
| 72 | + 'id_rubrique' => $id_rubrique, |
|
| 73 | + 'ext' => $ext, |
|
| 74 | + 'fond' => $fond, |
|
| 75 | + 'lang' => $lang, |
|
| 76 | + 'contexte' => $contexte, // le style d'un objet peut dependre de lui meme |
|
| 77 | + 'connect' => $connect |
|
| 78 | + ), |
|
| 79 | + 'data' => $squelette['fond'], |
|
| 80 | + ); |
|
| 81 | + |
|
| 82 | + if (test_espace_prive() or defined('_ZPIP')) { |
|
| 83 | + if (!$styliser_par_z) { |
|
| 84 | + $styliser_par_z = charger_fonction('styliser_par_z', 'public'); |
|
| 85 | + } |
|
| 86 | + $flux = $styliser_par_z($flux); |
|
| 87 | + } |
|
| 88 | + |
|
| 89 | + $flux = styliser_par_objets($flux); |
|
| 90 | + |
|
| 91 | + // pipeline styliser |
|
| 92 | + $squelette = pipeline('styliser', $flux); |
|
| 93 | + |
|
| 94 | + return array($squelette, $ext, $ext, "$squelette.$ext"); |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -110,31 +110,31 @@ discard block |
||
| 110 | 110 | * Données du pipeline styliser |
| 111 | 111 | **/ |
| 112 | 112 | function styliser_par_objets($flux) { |
| 113 | - if (test_espace_prive() |
|
| 114 | - and !$squelette = $flux['data'] |
|
| 115 | - and strncmp($flux['args']['fond'], 'prive/objets/', 13) == 0 |
|
| 116 | - and $echafauder = charger_fonction('echafauder', 'prive', true) |
|
| 117 | - ) { |
|
| 118 | - if (strncmp($flux['args']['fond'], 'prive/objets/liste/', 19) == 0) { |
|
| 119 | - $table = table_objet(substr($flux['args']['fond'], 19)); |
|
| 120 | - $table_sql = table_objet_sql($table); |
|
| 121 | - $objets = lister_tables_objets_sql(); |
|
| 122 | - if (isset($objets[$table_sql])) { |
|
| 123 | - $flux['data'] = $echafauder($table, $table, $table_sql, "prive/objets/liste/objets", $flux['args']['ext']); |
|
| 124 | - } |
|
| 125 | - } |
|
| 126 | - if (strncmp($flux['args']['fond'], 'prive/objets/contenu/', 21) == 0) { |
|
| 127 | - $type = substr($flux['args']['fond'], 21); |
|
| 128 | - $table = table_objet($type); |
|
| 129 | - $table_sql = table_objet_sql($table); |
|
| 130 | - $objets = lister_tables_objets_sql(); |
|
| 131 | - if (isset($objets[$table_sql])) { |
|
| 132 | - $flux['data'] = $echafauder($type, $table, $table_sql, "prive/objets/contenu/objet", $flux['args']['ext']); |
|
| 133 | - } |
|
| 134 | - } |
|
| 135 | - } |
|
| 136 | - |
|
| 137 | - return $flux; |
|
| 113 | + if (test_espace_prive() |
|
| 114 | + and !$squelette = $flux['data'] |
|
| 115 | + and strncmp($flux['args']['fond'], 'prive/objets/', 13) == 0 |
|
| 116 | + and $echafauder = charger_fonction('echafauder', 'prive', true) |
|
| 117 | + ) { |
|
| 118 | + if (strncmp($flux['args']['fond'], 'prive/objets/liste/', 19) == 0) { |
|
| 119 | + $table = table_objet(substr($flux['args']['fond'], 19)); |
|
| 120 | + $table_sql = table_objet_sql($table); |
|
| 121 | + $objets = lister_tables_objets_sql(); |
|
| 122 | + if (isset($objets[$table_sql])) { |
|
| 123 | + $flux['data'] = $echafauder($table, $table, $table_sql, "prive/objets/liste/objets", $flux['args']['ext']); |
|
| 124 | + } |
|
| 125 | + } |
|
| 126 | + if (strncmp($flux['args']['fond'], 'prive/objets/contenu/', 21) == 0) { |
|
| 127 | + $type = substr($flux['args']['fond'], 21); |
|
| 128 | + $table = table_objet($type); |
|
| 129 | + $table_sql = table_objet_sql($table); |
|
| 130 | + $objets = lister_tables_objets_sql(); |
|
| 131 | + if (isset($objets[$table_sql])) { |
|
| 132 | + $flux['data'] = $echafauder($type, $table, $table_sql, "prive/objets/contenu/objet", $flux['args']['ext']); |
|
| 133 | + } |
|
| 134 | + } |
|
| 135 | + } |
|
| 136 | + |
|
| 137 | + return $flux; |
|
| 138 | 138 | } |
| 139 | 139 | |
| 140 | 140 | /** |
@@ -150,49 +150,49 @@ discard block |
||
| 150 | 150 | * @return array |
| 151 | 151 | */ |
| 152 | 152 | function quete_rubrique_fond($contexte) { |
| 153 | - static $liste_objets = null; |
|
| 154 | - static $quete = array(); |
|
| 155 | - if (is_null($liste_objets)) { |
|
| 156 | - $liste_objets = array(); |
|
| 157 | - include_spip('inc/urls'); |
|
| 158 | - include_spip('public/quete'); |
|
| 159 | - $l = urls_liste_objets(false); |
|
| 160 | - // placer la rubrique en tete des objets |
|
| 161 | - $l = array_diff($l, array('rubrique')); |
|
| 162 | - array_unshift($l, 'rubrique'); |
|
| 163 | - foreach ($l as $objet) { |
|
| 164 | - $id = id_table_objet($objet); |
|
| 165 | - if (!isset($liste_objets[$id])) { |
|
| 166 | - $liste_objets[$id] = objet_type($objet, false); |
|
| 167 | - } |
|
| 168 | - } |
|
| 169 | - } |
|
| 170 | - $c = array_intersect_key($contexte, $liste_objets); |
|
| 171 | - if (!count($c)) { |
|
| 172 | - return false; |
|
| 173 | - } |
|
| 174 | - |
|
| 175 | - $c = array_map('intval', $c); |
|
| 176 | - $s = serialize($c); |
|
| 177 | - if (isset($quete[$s])) { |
|
| 178 | - return $quete[$s]; |
|
| 179 | - } |
|
| 180 | - |
|
| 181 | - if (isset($c['id_rubrique']) and $r = $c['id_rubrique']) { |
|
| 182 | - unset($c['id_rubrique']); |
|
| 183 | - $c = array('id_rubrique' => $r) + $c; |
|
| 184 | - } |
|
| 185 | - |
|
| 186 | - foreach ($c as $_id => $id) { |
|
| 187 | - if ($id |
|
| 188 | - and $row = quete_parent_lang(table_objet_sql($liste_objets[$_id]), $id) |
|
| 189 | - ) { |
|
| 190 | - $lang = isset($row['lang']) ? $row['lang'] : ''; |
|
| 191 | - if ($_id == 'id_rubrique' or (isset($row['id_rubrique']) and $id = $row['id_rubrique'])) { |
|
| 192 | - return $quete[$s] = array($id, $lang); |
|
| 193 | - } |
|
| 194 | - } |
|
| 195 | - } |
|
| 196 | - |
|
| 197 | - return $quete[$s] = false; |
|
| 153 | + static $liste_objets = null; |
|
| 154 | + static $quete = array(); |
|
| 155 | + if (is_null($liste_objets)) { |
|
| 156 | + $liste_objets = array(); |
|
| 157 | + include_spip('inc/urls'); |
|
| 158 | + include_spip('public/quete'); |
|
| 159 | + $l = urls_liste_objets(false); |
|
| 160 | + // placer la rubrique en tete des objets |
|
| 161 | + $l = array_diff($l, array('rubrique')); |
|
| 162 | + array_unshift($l, 'rubrique'); |
|
| 163 | + foreach ($l as $objet) { |
|
| 164 | + $id = id_table_objet($objet); |
|
| 165 | + if (!isset($liste_objets[$id])) { |
|
| 166 | + $liste_objets[$id] = objet_type($objet, false); |
|
| 167 | + } |
|
| 168 | + } |
|
| 169 | + } |
|
| 170 | + $c = array_intersect_key($contexte, $liste_objets); |
|
| 171 | + if (!count($c)) { |
|
| 172 | + return false; |
|
| 173 | + } |
|
| 174 | + |
|
| 175 | + $c = array_map('intval', $c); |
|
| 176 | + $s = serialize($c); |
|
| 177 | + if (isset($quete[$s])) { |
|
| 178 | + return $quete[$s]; |
|
| 179 | + } |
|
| 180 | + |
|
| 181 | + if (isset($c['id_rubrique']) and $r = $c['id_rubrique']) { |
|
| 182 | + unset($c['id_rubrique']); |
|
| 183 | + $c = array('id_rubrique' => $r) + $c; |
|
| 184 | + } |
|
| 185 | + |
|
| 186 | + foreach ($c as $_id => $id) { |
|
| 187 | + if ($id |
|
| 188 | + and $row = quete_parent_lang(table_objet_sql($liste_objets[$_id]), $id) |
|
| 189 | + ) { |
|
| 190 | + $lang = isset($row['lang']) ? $row['lang'] : ''; |
|
| 191 | + if ($_id == 'id_rubrique' or (isset($row['id_rubrique']) and $id = $row['id_rubrique'])) { |
|
| 192 | + return $quete[$s] = array($id, $lang); |
|
| 193 | + } |
|
| 194 | + } |
|
| 195 | + } |
|
| 196 | + |
|
| 197 | + return $quete[$s] = false; |
|
| 198 | 198 | } |
@@ -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 | |
@@ -54,84 +54,84 @@ discard block |
||
| 54 | 54 | */ |
| 55 | 55 | function balise_LOGO__dist($p) { |
| 56 | 56 | |
| 57 | - preg_match(',^LOGO_([A-Z_]+?)(|_NORMAL|_SURVOL|_RUBRIQUE)$,i', $p->nom_champ, $regs); |
|
| 58 | - $type = strtolower($regs[1]); |
|
| 59 | - $suite_logo = $regs[2]; |
|
| 60 | - |
|
| 61 | - // cas de #LOGO_SITE_SPIP |
|
| 62 | - if ($type == 'site_spip') { |
|
| 63 | - $type = 'site'; |
|
| 64 | - $_id_objet = "\"'0'\""; |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - $id_objet = id_table_objet($type); |
|
| 68 | - if (!isset($_id_objet)) { |
|
| 69 | - $_id_objet = champ_sql($id_objet, $p); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - $fichier = ($p->etoile === '**') ? -1 : 0; |
|
| 73 | - $coord = array(); |
|
| 74 | - $align = $lien = ''; |
|
| 75 | - $mode_logo = ''; |
|
| 76 | - |
|
| 77 | - if ($p->param and !$p->param[0][0]) { |
|
| 78 | - $params = $p->param[0]; |
|
| 79 | - array_shift($params); |
|
| 80 | - foreach ($params as $a) { |
|
| 81 | - if ($a[0]->type === 'texte') { |
|
| 82 | - $n = $a[0]->texte; |
|
| 83 | - if (is_numeric($n)) { |
|
| 84 | - $coord[] = $n; |
|
| 85 | - } elseif (in_array($n, array('top', 'left', 'right', 'center', 'bottom'))) { |
|
| 86 | - $align = $n; |
|
| 87 | - } elseif (in_array($n, array('auto', 'icone', 'apercu', 'vignette'))) { |
|
| 88 | - $mode_logo = $n; |
|
| 89 | - } |
|
| 90 | - } else { |
|
| 91 | - $lien = calculer_liste($a, $p->descr, $p->boucles, $p->id_boucle); |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - $coord_x = !$coord ? 0 : intval(array_shift($coord)); |
|
| 97 | - $coord_y = !$coord ? 0 : intval(array_shift($coord)); |
|
| 98 | - |
|
| 99 | - if ($p->etoile === '*') { |
|
| 100 | - include_spip('balise/url_'); |
|
| 101 | - $lien = generer_generer_url_arg($type, $p, $_id_objet); |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - $connect = $p->id_boucle ? $p->boucles[$p->id_boucle]->sql_serveur : ''; |
|
| 105 | - if ($type == 'document') { |
|
| 106 | - $qconnect = _q($connect); |
|
| 107 | - $doc = "quete_document($_id_objet, $qconnect)"; |
|
| 108 | - if ($fichier) { |
|
| 109 | - $code = "quete_logo_file($doc, $qconnect)"; |
|
| 110 | - } else { |
|
| 111 | - $code = "quete_logo_document($doc, " . ($lien ? $lien : "''") . ", '$align', '$mode_logo', $coord_x, $coord_y, $qconnect)"; |
|
| 112 | - } |
|
| 113 | - // (x=non-faux ? y : '') pour affecter x en retournant y |
|
| 114 | - if ($p->descr['documents']) { |
|
| 115 | - $code = '(($doublons["documents"] .= ",". ' |
|
| 116 | - . $_id_objet |
|
| 117 | - . ") ? $code : '')"; |
|
| 118 | - } |
|
| 119 | - } elseif ($connect) { |
|
| 120 | - $code = "''"; |
|
| 121 | - spip_log('Les logos distants ne sont pas prevus'); |
|
| 122 | - } else { |
|
| 123 | - $code = logo_survol($id_objet, $_id_objet, $type, $align, $fichier, $lien, $p, $suite_logo); |
|
| 124 | - } |
|
| 125 | - |
|
| 126 | - // demande de reduction sur logo avec ecriture spip 2.1 : #LOGO_xxx{200, 0} |
|
| 127 | - if ($coord_x or $coord_y) { |
|
| 128 | - $code = "filtrer('image_graver',filtrer('image_reduire'," . $code . ", '$coord_x', '$coord_y'))"; |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - $p->code = $code; |
|
| 132 | - $p->interdire_scripts = false; |
|
| 133 | - |
|
| 134 | - return $p; |
|
| 57 | + preg_match(',^LOGO_([A-Z_]+?)(|_NORMAL|_SURVOL|_RUBRIQUE)$,i', $p->nom_champ, $regs); |
|
| 58 | + $type = strtolower($regs[1]); |
|
| 59 | + $suite_logo = $regs[2]; |
|
| 60 | + |
|
| 61 | + // cas de #LOGO_SITE_SPIP |
|
| 62 | + if ($type == 'site_spip') { |
|
| 63 | + $type = 'site'; |
|
| 64 | + $_id_objet = "\"'0'\""; |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + $id_objet = id_table_objet($type); |
|
| 68 | + if (!isset($_id_objet)) { |
|
| 69 | + $_id_objet = champ_sql($id_objet, $p); |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + $fichier = ($p->etoile === '**') ? -1 : 0; |
|
| 73 | + $coord = array(); |
|
| 74 | + $align = $lien = ''; |
|
| 75 | + $mode_logo = ''; |
|
| 76 | + |
|
| 77 | + if ($p->param and !$p->param[0][0]) { |
|
| 78 | + $params = $p->param[0]; |
|
| 79 | + array_shift($params); |
|
| 80 | + foreach ($params as $a) { |
|
| 81 | + if ($a[0]->type === 'texte') { |
|
| 82 | + $n = $a[0]->texte; |
|
| 83 | + if (is_numeric($n)) { |
|
| 84 | + $coord[] = $n; |
|
| 85 | + } elseif (in_array($n, array('top', 'left', 'right', 'center', 'bottom'))) { |
|
| 86 | + $align = $n; |
|
| 87 | + } elseif (in_array($n, array('auto', 'icone', 'apercu', 'vignette'))) { |
|
| 88 | + $mode_logo = $n; |
|
| 89 | + } |
|
| 90 | + } else { |
|
| 91 | + $lien = calculer_liste($a, $p->descr, $p->boucles, $p->id_boucle); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + $coord_x = !$coord ? 0 : intval(array_shift($coord)); |
|
| 97 | + $coord_y = !$coord ? 0 : intval(array_shift($coord)); |
|
| 98 | + |
|
| 99 | + if ($p->etoile === '*') { |
|
| 100 | + include_spip('balise/url_'); |
|
| 101 | + $lien = generer_generer_url_arg($type, $p, $_id_objet); |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + $connect = $p->id_boucle ? $p->boucles[$p->id_boucle]->sql_serveur : ''; |
|
| 105 | + if ($type == 'document') { |
|
| 106 | + $qconnect = _q($connect); |
|
| 107 | + $doc = "quete_document($_id_objet, $qconnect)"; |
|
| 108 | + if ($fichier) { |
|
| 109 | + $code = "quete_logo_file($doc, $qconnect)"; |
|
| 110 | + } else { |
|
| 111 | + $code = "quete_logo_document($doc, " . ($lien ? $lien : "''") . ", '$align', '$mode_logo', $coord_x, $coord_y, $qconnect)"; |
|
| 112 | + } |
|
| 113 | + // (x=non-faux ? y : '') pour affecter x en retournant y |
|
| 114 | + if ($p->descr['documents']) { |
|
| 115 | + $code = '(($doublons["documents"] .= ",". ' |
|
| 116 | + . $_id_objet |
|
| 117 | + . ") ? $code : '')"; |
|
| 118 | + } |
|
| 119 | + } elseif ($connect) { |
|
| 120 | + $code = "''"; |
|
| 121 | + spip_log('Les logos distants ne sont pas prevus'); |
|
| 122 | + } else { |
|
| 123 | + $code = logo_survol($id_objet, $_id_objet, $type, $align, $fichier, $lien, $p, $suite_logo); |
|
| 124 | + } |
|
| 125 | + |
|
| 126 | + // demande de reduction sur logo avec ecriture spip 2.1 : #LOGO_xxx{200, 0} |
|
| 127 | + if ($coord_x or $coord_y) { |
|
| 128 | + $code = "filtrer('image_graver',filtrer('image_reduire'," . $code . ", '$coord_x', '$coord_y'))"; |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + $p->code = $code; |
|
| 132 | + $p->interdire_scripts = false; |
|
| 133 | + |
|
| 134 | + return $p; |
|
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
@@ -158,20 +158,20 @@ discard block |
||
| 158 | 158 | * Code compilé retournant le chemin du logo ou le code HTML du logo. |
| 159 | 159 | **/ |
| 160 | 160 | function logo_survol($id_objet, $_id_objet, $type, $align, $fichier, $_lien, $p, $suite) { |
| 161 | - $code = "quete_logo('$id_objet', '" . |
|
| 162 | - (($suite == '_SURVOL') ? 'off' : |
|
| 163 | - (($suite == '_NORMAL') ? 'on' : 'ON')) . |
|
| 164 | - "', $_id_objet," . |
|
| 165 | - (($suite == '_RUBRIQUE') ? |
|
| 166 | - champ_sql('id_rubrique', $p) : |
|
| 167 | - (($type == 'rubrique') ? "quete_parent($_id_objet)" : "''")) . |
|
| 168 | - ', ' . intval($fichier) . ')'; |
|
| 169 | - |
|
| 170 | - if ($fichier) { |
|
| 171 | - return $code; |
|
| 172 | - } |
|
| 173 | - |
|
| 174 | - $align = preg_replace(",\W,", "", $align); |
|
| 175 | - |
|
| 176 | - return "quete_html_logo($code, '$align', " .($_lien ? $_lien : "''") .")"; |
|
| 161 | + $code = "quete_logo('$id_objet', '" . |
|
| 162 | + (($suite == '_SURVOL') ? 'off' : |
|
| 163 | + (($suite == '_NORMAL') ? 'on' : 'ON')) . |
|
| 164 | + "', $_id_objet," . |
|
| 165 | + (($suite == '_RUBRIQUE') ? |
|
| 166 | + champ_sql('id_rubrique', $p) : |
|
| 167 | + (($type == 'rubrique') ? "quete_parent($_id_objet)" : "''")) . |
|
| 168 | + ', ' . intval($fichier) . ')'; |
|
| 169 | + |
|
| 170 | + if ($fichier) { |
|
| 171 | + return $code; |
|
| 172 | + } |
|
| 173 | + |
|
| 174 | + $align = preg_replace(",\W,", "", $align); |
|
| 175 | + |
|
| 176 | + return "quete_html_logo($code, '$align', " .($_lien ? $_lien : "''") .")"; |
|
| 177 | 177 | } |
@@ -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 | /** |
@@ -32,78 +32,78 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | function auth_spip_dist($login, $pass, $serveur = '', $phpauth = false) { |
| 34 | 34 | |
| 35 | - // retrouver le login |
|
| 36 | - $login = auth_spip_retrouver_login($login); |
|
| 37 | - // login inconnu, n'allons pas plus loin |
|
| 38 | - if (!$login) { |
|
| 39 | - return array(); |
|
| 40 | - } |
|
| 41 | - |
|
| 42 | - $md5pass = ""; |
|
| 43 | - $shapass = $shanext = ""; |
|
| 44 | - |
|
| 45 | - if (preg_match(",^\{([0-9a-f]{64});([0-9a-f]{64})\}$,i", $pass, $regs)) { |
|
| 46 | - $shapass = $regs[1]; |
|
| 47 | - $shanext = $regs[2]; |
|
| 48 | - } // compat avec une base mixte md5/sha256 : le js a envoye les 2 hash |
|
| 49 | - elseif (preg_match(",^\{([0-9a-f]{64});([0-9a-f]{64});([0-9a-f]{32});([0-9a-f]{32})\}$,i", $pass, $regs)) { |
|
| 50 | - $shapass = $regs[1]; |
|
| 51 | - $shanext = $regs[2]; |
|
| 52 | - $md5pass = $regs[3]; |
|
| 53 | - //$md5next = $regs[4]; |
|
| 54 | - } // si envoi non crypte, crypter maintenant |
|
| 55 | - elseif ($pass) { |
|
| 56 | - $row = sql_fetsel("alea_actuel, alea_futur", "spip_auteurs", "login=" . sql_quote($login, $serveur, 'text'), '', '', |
|
| 57 | - '', '', $serveur); |
|
| 58 | - |
|
| 59 | - if ($row) { |
|
| 60 | - include_spip('auth/sha256.inc'); |
|
| 61 | - $shapass = spip_sha256($row['alea_actuel'] . $pass); |
|
| 62 | - $shanext = spip_sha256($row['alea_futur'] . $pass); |
|
| 63 | - $md5pass = md5($row['alea_actuel'] . $pass); |
|
| 64 | - } |
|
| 65 | - } |
|
| 66 | - |
|
| 67 | - // login inexistant ou mot de passe vide |
|
| 68 | - if (!$shapass and !$md5pass) { |
|
| 69 | - return array(); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - $row = sql_fetsel("*", "spip_auteurs", |
|
| 73 | - "login=" . sql_quote($login, $serveur, 'text') . " AND pass=" . sql_quote($shapass, $serveur, |
|
| 74 | - 'text') . " AND statut<>'5poubelle'", '', '', '', '', $serveur); |
|
| 75 | - |
|
| 76 | - // compat avec les anciennes bases en md5 |
|
| 77 | - if (!$row and $md5pass) { |
|
| 78 | - $row = sql_fetsel("*", "spip_auteurs", |
|
| 79 | - "login=" . sql_quote($login, $serveur, 'text') . " AND pass=" . sql_quote($md5pass, $serveur, |
|
| 80 | - 'text') . " AND statut<>'5poubelle'", '', '', '', '', $serveur); |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - // login/mot de passe incorrect |
|
| 84 | - if (!$row) { |
|
| 85 | - return array(); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - // fait tourner le codage du pass dans la base |
|
| 89 | - // sauf si phpauth : cela reviendrait a changer l'alea a chaque hit, et aucune action verifiable par securiser_action() |
|
| 90 | - if ($shanext and !$phpauth) { |
|
| 91 | - |
|
| 92 | - include_spip('inc/acces'); // pour creer_uniqid |
|
| 93 | - @sql_update('spip_auteurs', array( |
|
| 94 | - 'alea_actuel' => 'alea_futur', |
|
| 95 | - 'pass' => sql_quote($shanext, $serveur, 'text'), |
|
| 96 | - 'alea_futur' => sql_quote(creer_uniqid(), $serveur, 'text') |
|
| 97 | - ), "id_auteur=" . $row['id_auteur'] . ' AND pass IN (' . sql_quote($shapass, $serveur, |
|
| 98 | - 'text') . ', ' . sql_quote($md5pass, $serveur, 'text') . ')', '', $serveur); |
|
| 99 | - // En profiter pour verifier la securite de tmp/ |
|
| 100 | - // Si elle ne fonctionne pas a l'installation, prevenir |
|
| 101 | - if (!verifier_htaccess(_DIR_TMP) and defined('_ECRIRE_INSTALL')) { |
|
| 102 | - return false; |
|
| 103 | - } |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - return $row; |
|
| 35 | + // retrouver le login |
|
| 36 | + $login = auth_spip_retrouver_login($login); |
|
| 37 | + // login inconnu, n'allons pas plus loin |
|
| 38 | + if (!$login) { |
|
| 39 | + return array(); |
|
| 40 | + } |
|
| 41 | + |
|
| 42 | + $md5pass = ""; |
|
| 43 | + $shapass = $shanext = ""; |
|
| 44 | + |
|
| 45 | + if (preg_match(",^\{([0-9a-f]{64});([0-9a-f]{64})\}$,i", $pass, $regs)) { |
|
| 46 | + $shapass = $regs[1]; |
|
| 47 | + $shanext = $regs[2]; |
|
| 48 | + } // compat avec une base mixte md5/sha256 : le js a envoye les 2 hash |
|
| 49 | + elseif (preg_match(",^\{([0-9a-f]{64});([0-9a-f]{64});([0-9a-f]{32});([0-9a-f]{32})\}$,i", $pass, $regs)) { |
|
| 50 | + $shapass = $regs[1]; |
|
| 51 | + $shanext = $regs[2]; |
|
| 52 | + $md5pass = $regs[3]; |
|
| 53 | + //$md5next = $regs[4]; |
|
| 54 | + } // si envoi non crypte, crypter maintenant |
|
| 55 | + elseif ($pass) { |
|
| 56 | + $row = sql_fetsel("alea_actuel, alea_futur", "spip_auteurs", "login=" . sql_quote($login, $serveur, 'text'), '', '', |
|
| 57 | + '', '', $serveur); |
|
| 58 | + |
|
| 59 | + if ($row) { |
|
| 60 | + include_spip('auth/sha256.inc'); |
|
| 61 | + $shapass = spip_sha256($row['alea_actuel'] . $pass); |
|
| 62 | + $shanext = spip_sha256($row['alea_futur'] . $pass); |
|
| 63 | + $md5pass = md5($row['alea_actuel'] . $pass); |
|
| 64 | + } |
|
| 65 | + } |
|
| 66 | + |
|
| 67 | + // login inexistant ou mot de passe vide |
|
| 68 | + if (!$shapass and !$md5pass) { |
|
| 69 | + return array(); |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + $row = sql_fetsel("*", "spip_auteurs", |
|
| 73 | + "login=" . sql_quote($login, $serveur, 'text') . " AND pass=" . sql_quote($shapass, $serveur, |
|
| 74 | + 'text') . " AND statut<>'5poubelle'", '', '', '', '', $serveur); |
|
| 75 | + |
|
| 76 | + // compat avec les anciennes bases en md5 |
|
| 77 | + if (!$row and $md5pass) { |
|
| 78 | + $row = sql_fetsel("*", "spip_auteurs", |
|
| 79 | + "login=" . sql_quote($login, $serveur, 'text') . " AND pass=" . sql_quote($md5pass, $serveur, |
|
| 80 | + 'text') . " AND statut<>'5poubelle'", '', '', '', '', $serveur); |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + // login/mot de passe incorrect |
|
| 84 | + if (!$row) { |
|
| 85 | + return array(); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + // fait tourner le codage du pass dans la base |
|
| 89 | + // sauf si phpauth : cela reviendrait a changer l'alea a chaque hit, et aucune action verifiable par securiser_action() |
|
| 90 | + if ($shanext and !$phpauth) { |
|
| 91 | + |
|
| 92 | + include_spip('inc/acces'); // pour creer_uniqid |
|
| 93 | + @sql_update('spip_auteurs', array( |
|
| 94 | + 'alea_actuel' => 'alea_futur', |
|
| 95 | + 'pass' => sql_quote($shanext, $serveur, 'text'), |
|
| 96 | + 'alea_futur' => sql_quote(creer_uniqid(), $serveur, 'text') |
|
| 97 | + ), "id_auteur=" . $row['id_auteur'] . ' AND pass IN (' . sql_quote($shapass, $serveur, |
|
| 98 | + 'text') . ', ' . sql_quote($md5pass, $serveur, 'text') . ')', '', $serveur); |
|
| 99 | + // En profiter pour verifier la securite de tmp/ |
|
| 100 | + // Si elle ne fonctionne pas a l'installation, prevenir |
|
| 101 | + if (!verifier_htaccess(_DIR_TMP) and defined('_ECRIRE_INSTALL')) { |
|
| 102 | + return false; |
|
| 103 | + } |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + return $row; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | /** |
@@ -113,41 +113,41 @@ discard block |
||
| 113 | 113 | * @return array |
| 114 | 114 | */ |
| 115 | 115 | function auth_spip_formulaire_login($flux) { |
| 116 | - // faut il encore envoyer md5 ? |
|
| 117 | - // on regarde si il reste des pass md5 en base pour des auteurs en statut pas poubelle |
|
| 118 | - // les hash md5 ont une longueur 32, les sha 64 |
|
| 119 | - // en evitant une requete sql a chaque affichage du formulaire login sans session |
|
| 120 | - // (perf issue pour les sites qui mettent le formulaire de login sur la home) |
|
| 121 | - $compat_md5 = false; |
|
| 122 | - if (!isset($GLOBALS['meta']['sha_256_only']) or _request('var_mode')) { |
|
| 123 | - $compat_md5 = sql_countsel("spip_auteurs", "length(pass)=32 AND statut<>'poubelle'"); |
|
| 124 | - if ($compat_md5 and isset($GLOBALS['meta']['sha_256_only'])) { |
|
| 125 | - effacer_meta('sha_256_only'); |
|
| 126 | - } |
|
| 127 | - if (!$compat_md5) { |
|
| 128 | - ecrire_meta('sha_256_only', 'oui'); |
|
| 129 | - } |
|
| 130 | - } |
|
| 131 | - |
|
| 132 | - // javascript qui gere la securite du login en evitant de faire circuler le pass en clair |
|
| 133 | - $flux['data'] .= |
|
| 134 | - ($compat_md5 ? '<script type="text/javascript" src="' . _DIR_JAVASCRIPT . 'md5.js"></script>' : '') |
|
| 135 | - . '<script type="text/javascript" src="' . _DIR_JAVASCRIPT . 'login-sha-min.js"></script>' |
|
| 136 | - . '<script type="text/javascript">/*<![CDATA[*/' |
|
| 137 | - . "var login_info={'alea_actuel':'" . $flux['args']['contexte']['_alea_actuel'] . "'," |
|
| 138 | - . "'alea_futur':'" . $flux['args']['contexte']['_alea_futur'] . "'," |
|
| 139 | - . "'login':'" . $flux['args']['contexte']['var_login'] . "'," |
|
| 140 | - . "'page_auteur': '" . generer_url_public('informer_auteur') . "'," |
|
| 141 | - . "'informe_auteur_en_cours':false," |
|
| 142 | - . "'attente_informe':0," |
|
| 143 | - . "'compat_md5':" . ($compat_md5 ? "true" : "false") . "};" |
|
| 144 | - . "jQuery(function(){ |
|
| 116 | + // faut il encore envoyer md5 ? |
|
| 117 | + // on regarde si il reste des pass md5 en base pour des auteurs en statut pas poubelle |
|
| 118 | + // les hash md5 ont une longueur 32, les sha 64 |
|
| 119 | + // en evitant une requete sql a chaque affichage du formulaire login sans session |
|
| 120 | + // (perf issue pour les sites qui mettent le formulaire de login sur la home) |
|
| 121 | + $compat_md5 = false; |
|
| 122 | + if (!isset($GLOBALS['meta']['sha_256_only']) or _request('var_mode')) { |
|
| 123 | + $compat_md5 = sql_countsel("spip_auteurs", "length(pass)=32 AND statut<>'poubelle'"); |
|
| 124 | + if ($compat_md5 and isset($GLOBALS['meta']['sha_256_only'])) { |
|
| 125 | + effacer_meta('sha_256_only'); |
|
| 126 | + } |
|
| 127 | + if (!$compat_md5) { |
|
| 128 | + ecrire_meta('sha_256_only', 'oui'); |
|
| 129 | + } |
|
| 130 | + } |
|
| 131 | + |
|
| 132 | + // javascript qui gere la securite du login en evitant de faire circuler le pass en clair |
|
| 133 | + $flux['data'] .= |
|
| 134 | + ($compat_md5 ? '<script type="text/javascript" src="' . _DIR_JAVASCRIPT . 'md5.js"></script>' : '') |
|
| 135 | + . '<script type="text/javascript" src="' . _DIR_JAVASCRIPT . 'login-sha-min.js"></script>' |
|
| 136 | + . '<script type="text/javascript">/*<![CDATA[*/' |
|
| 137 | + . "var login_info={'alea_actuel':'" . $flux['args']['contexte']['_alea_actuel'] . "'," |
|
| 138 | + . "'alea_futur':'" . $flux['args']['contexte']['_alea_futur'] . "'," |
|
| 139 | + . "'login':'" . $flux['args']['contexte']['var_login'] . "'," |
|
| 140 | + . "'page_auteur': '" . generer_url_public('informer_auteur') . "'," |
|
| 141 | + . "'informe_auteur_en_cours':false," |
|
| 142 | + . "'attente_informe':0," |
|
| 143 | + . "'compat_md5':" . ($compat_md5 ? "true" : "false") . "};" |
|
| 144 | + . "jQuery(function(){ |
|
| 145 | 145 | jQuery('#var_login').change(actualise_auteur); |
| 146 | 146 | jQuery('form#formulaire_login').submit(login_submit); |
| 147 | 147 | });" |
| 148 | - . "/*]]>*/</script>"; |
|
| 148 | + . "/*]]>*/</script>"; |
|
| 149 | 149 | |
| 150 | - return $flux; |
|
| 150 | + return $flux; |
|
| 151 | 151 | } |
| 152 | 152 | |
| 153 | 153 | |
@@ -159,10 +159,10 @@ discard block |
||
| 159 | 159 | * toujours true pour un auteur cree dans SPIP |
| 160 | 160 | */ |
| 161 | 161 | function auth_spip_autoriser_modifier_login($serveur = '') { |
| 162 | - if (strlen($serveur)) { |
|
| 163 | - return false; |
|
| 164 | - } // les fonctions d'ecriture sur base distante sont encore incompletes |
|
| 165 | - return true; |
|
| 162 | + if (strlen($serveur)) { |
|
| 163 | + return false; |
|
| 164 | + } // les fonctions d'ecriture sur base distante sont encore incompletes |
|
| 165 | + return true; |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | /** |
@@ -176,21 +176,21 @@ discard block |
||
| 176 | 176 | * message d'erreur si login non valide, chaine vide sinon |
| 177 | 177 | */ |
| 178 | 178 | function auth_spip_verifier_login($new_login, $id_auteur = 0, $serveur = '') { |
| 179 | - // login et mot de passe |
|
| 180 | - if (strlen($new_login)) { |
|
| 181 | - if (strlen($new_login) < _LOGIN_TROP_COURT) { |
|
| 182 | - return _T('info_login_trop_court_car_pluriel', array('nb' => _LOGIN_TROP_COURT)); |
|
| 183 | - } else { |
|
| 184 | - $n = sql_countsel('spip_auteurs', |
|
| 185 | - "login=" . sql_quote($new_login) . " AND id_auteur!=" . intval($id_auteur) . " AND statut!='5poubelle'", '', '', |
|
| 186 | - $serveur); |
|
| 187 | - if ($n) { |
|
| 188 | - return _T('info_login_existant'); |
|
| 189 | - } |
|
| 190 | - } |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - return ''; |
|
| 179 | + // login et mot de passe |
|
| 180 | + if (strlen($new_login)) { |
|
| 181 | + if (strlen($new_login) < _LOGIN_TROP_COURT) { |
|
| 182 | + return _T('info_login_trop_court_car_pluriel', array('nb' => _LOGIN_TROP_COURT)); |
|
| 183 | + } else { |
|
| 184 | + $n = sql_countsel('spip_auteurs', |
|
| 185 | + "login=" . sql_quote($new_login) . " AND id_auteur!=" . intval($id_auteur) . " AND statut!='5poubelle'", '', '', |
|
| 186 | + $serveur); |
|
| 187 | + if ($n) { |
|
| 188 | + return _T('info_login_existant'); |
|
| 189 | + } |
|
| 190 | + } |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + return ''; |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | /** |
@@ -202,32 +202,32 @@ discard block |
||
| 202 | 202 | * @return bool |
| 203 | 203 | */ |
| 204 | 204 | function auth_spip_modifier_login($new_login, $id_auteur, $serveur = '') { |
| 205 | - if (is_null($new_login) or auth_spip_verifier_login($new_login, $id_auteur, $serveur) != '') { |
|
| 206 | - return false; |
|
| 207 | - } |
|
| 208 | - if (!$id_auteur = intval($id_auteur) |
|
| 209 | - or !$auteur = sql_fetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur), '', '', '', '', $serveur) |
|
| 210 | - ) { |
|
| 211 | - return false; |
|
| 212 | - } |
|
| 213 | - if ($new_login == $auteur['login']) { |
|
| 214 | - return true; |
|
| 215 | - } // on a rien fait mais c'est bon ! |
|
| 216 | - |
|
| 217 | - include_spip('action/editer_auteur'); |
|
| 218 | - |
|
| 219 | - // vider le login des auteurs a la poubelle qui avaient ce meme login |
|
| 220 | - if (strlen($new_login)) { |
|
| 221 | - $anciens = sql_allfetsel('id_auteur', 'spip_auteurs', |
|
| 222 | - 'login=' . sql_quote($new_login, $serveur, 'text') . " AND statut='5poubelle'", '', '', '', '', $serveur); |
|
| 223 | - while ($row = array_pop($anciens)) { |
|
| 224 | - auteur_modifier($row['id_auteur'], array('login' => ''), true); // manque la gestion de $serveur |
|
| 225 | - } |
|
| 226 | - } |
|
| 227 | - |
|
| 228 | - auteur_modifier($id_auteur, array('login' => $new_login), true); // manque la gestion de $serveur |
|
| 229 | - |
|
| 230 | - return true; |
|
| 205 | + if (is_null($new_login) or auth_spip_verifier_login($new_login, $id_auteur, $serveur) != '') { |
|
| 206 | + return false; |
|
| 207 | + } |
|
| 208 | + if (!$id_auteur = intval($id_auteur) |
|
| 209 | + or !$auteur = sql_fetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur), '', '', '', '', $serveur) |
|
| 210 | + ) { |
|
| 211 | + return false; |
|
| 212 | + } |
|
| 213 | + if ($new_login == $auteur['login']) { |
|
| 214 | + return true; |
|
| 215 | + } // on a rien fait mais c'est bon ! |
|
| 216 | + |
|
| 217 | + include_spip('action/editer_auteur'); |
|
| 218 | + |
|
| 219 | + // vider le login des auteurs a la poubelle qui avaient ce meme login |
|
| 220 | + if (strlen($new_login)) { |
|
| 221 | + $anciens = sql_allfetsel('id_auteur', 'spip_auteurs', |
|
| 222 | + 'login=' . sql_quote($new_login, $serveur, 'text') . " AND statut='5poubelle'", '', '', '', '', $serveur); |
|
| 223 | + while ($row = array_pop($anciens)) { |
|
| 224 | + auteur_modifier($row['id_auteur'], array('login' => ''), true); // manque la gestion de $serveur |
|
| 225 | + } |
|
| 226 | + } |
|
| 227 | + |
|
| 228 | + auteur_modifier($id_auteur, array('login' => $new_login), true); // manque la gestion de $serveur |
|
| 229 | + |
|
| 230 | + return true; |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | /** |
@@ -239,27 +239,27 @@ discard block |
||
| 239 | 239 | * @return string |
| 240 | 240 | */ |
| 241 | 241 | function auth_spip_retrouver_login($login, $serveur = '') { |
| 242 | - if (!strlen($login)) { |
|
| 243 | - return null; |
|
| 244 | - } // pas la peine de requeter |
|
| 245 | - $l = sql_quote($login, $serveur, 'text'); |
|
| 246 | - if ($r = sql_getfetsel('login', 'spip_auteurs', |
|
| 247 | - "statut<>'5poubelle'" . |
|
| 248 | - " AND (length(pass)>0)" . |
|
| 249 | - " AND (login=$l)", '', '', '', '', $serveur) |
|
| 250 | - ) { |
|
| 251 | - return $r; |
|
| 252 | - } |
|
| 253 | - // Si pas d'auteur avec ce login |
|
| 254 | - // regarder s'il a saisi son nom ou son mail. |
|
| 255 | - // Ne pas fusionner avec la requete precedente |
|
| 256 | - // car un nom peut etre homonyme d'un autre login |
|
| 257 | - else { |
|
| 258 | - return sql_getfetsel('login', 'spip_auteurs', |
|
| 259 | - "statut<>'5poubelle'" . |
|
| 260 | - " AND (length(pass)>0)" . |
|
| 261 | - " AND (login<>'' AND (nom=$l OR email=$l))", '', '', '', '', $serveur); |
|
| 262 | - } |
|
| 242 | + if (!strlen($login)) { |
|
| 243 | + return null; |
|
| 244 | + } // pas la peine de requeter |
|
| 245 | + $l = sql_quote($login, $serveur, 'text'); |
|
| 246 | + if ($r = sql_getfetsel('login', 'spip_auteurs', |
|
| 247 | + "statut<>'5poubelle'" . |
|
| 248 | + " AND (length(pass)>0)" . |
|
| 249 | + " AND (login=$l)", '', '', '', '', $serveur) |
|
| 250 | + ) { |
|
| 251 | + return $r; |
|
| 252 | + } |
|
| 253 | + // Si pas d'auteur avec ce login |
|
| 254 | + // regarder s'il a saisi son nom ou son mail. |
|
| 255 | + // Ne pas fusionner avec la requete precedente |
|
| 256 | + // car un nom peut etre homonyme d'un autre login |
|
| 257 | + else { |
|
| 258 | + return sql_getfetsel('login', 'spip_auteurs', |
|
| 259 | + "statut<>'5poubelle'" . |
|
| 260 | + " AND (length(pass)>0)" . |
|
| 261 | + " AND (login<>'' AND (nom=$l OR email=$l))", '', '', '', '', $serveur); |
|
| 262 | + } |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | |
@@ -277,11 +277,11 @@ discard block |
||
| 277 | 277 | */ |
| 278 | 278 | function auth_spip_informer_login($infos, $row, $serveur = '') { |
| 279 | 279 | |
| 280 | - // pour la methode SPIP on a besoin des alea en plus pour encoder le pass avec |
|
| 281 | - $infos['alea_actuel'] = $row['alea_actuel']; |
|
| 282 | - $infos['alea_futur'] = $row['alea_futur']; |
|
| 280 | + // pour la methode SPIP on a besoin des alea en plus pour encoder le pass avec |
|
| 281 | + $infos['alea_actuel'] = $row['alea_actuel']; |
|
| 282 | + $infos['alea_futur'] = $row['alea_futur']; |
|
| 283 | 283 | |
| 284 | - return $infos; |
|
| 284 | + return $infos; |
|
| 285 | 285 | } |
| 286 | 286 | |
| 287 | 287 | /** |
@@ -292,10 +292,10 @@ discard block |
||
| 292 | 292 | * toujours true pour un auteur cree dans SPIP |
| 293 | 293 | */ |
| 294 | 294 | function auth_spip_autoriser_modifier_pass($serveur = '') { |
| 295 | - if (strlen($serveur)) { |
|
| 296 | - return false; |
|
| 297 | - } // les fonctions d'ecriture sur base distante sont encore incompletes |
|
| 298 | - return true; |
|
| 295 | + if (strlen($serveur)) { |
|
| 296 | + return false; |
|
| 297 | + } // les fonctions d'ecriture sur base distante sont encore incompletes |
|
| 298 | + return true; |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | |
@@ -316,12 +316,12 @@ discard block |
||
| 316 | 316 | * message d'erreur si login non valide, chaine vide sinon |
| 317 | 317 | */ |
| 318 | 318 | function auth_spip_verifier_pass($login, $new_pass, $id_auteur = 0, $serveur = '') { |
| 319 | - // login et mot de passe |
|
| 320 | - if (strlen($new_pass) < _PASS_LONGUEUR_MINI) { |
|
| 321 | - return _T('info_passe_trop_court_car_pluriel', array('nb' => _PASS_LONGUEUR_MINI)); |
|
| 322 | - } |
|
| 319 | + // login et mot de passe |
|
| 320 | + if (strlen($new_pass) < _PASS_LONGUEUR_MINI) { |
|
| 321 | + return _T('info_passe_trop_court_car_pluriel', array('nb' => _PASS_LONGUEUR_MINI)); |
|
| 322 | + } |
|
| 323 | 323 | |
| 324 | - return ''; |
|
| 324 | + return ''; |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /** |
@@ -335,33 +335,33 @@ discard block |
||
| 335 | 335 | * @return bool |
| 336 | 336 | */ |
| 337 | 337 | function auth_spip_modifier_pass($login, $new_pass, $id_auteur, $serveur = '') { |
| 338 | - if (is_null($new_pass) or auth_spip_verifier_pass($login, $new_pass, $id_auteur, $serveur) != '') { |
|
| 339 | - return false; |
|
| 340 | - } |
|
| 341 | - |
|
| 342 | - if (!$id_auteur = intval($id_auteur) |
|
| 343 | - or !sql_fetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur), '', '', '', '', $serveur) |
|
| 344 | - ) { |
|
| 345 | - return false; |
|
| 346 | - } |
|
| 347 | - |
|
| 348 | - $c = array(); |
|
| 349 | - include_spip('inc/acces'); |
|
| 350 | - include_spip('auth/sha256.inc'); |
|
| 351 | - $htpass = generer_htpass($new_pass); |
|
| 352 | - $alea_actuel = creer_uniqid(); |
|
| 353 | - $alea_futur = creer_uniqid(); |
|
| 354 | - $pass = spip_sha256($alea_actuel . $new_pass); |
|
| 355 | - $c['pass'] = $pass; |
|
| 356 | - $c['htpass'] = $htpass; |
|
| 357 | - $c['alea_actuel'] = $alea_actuel; |
|
| 358 | - $c['alea_futur'] = $alea_futur; |
|
| 359 | - $c['low_sec'] = ''; |
|
| 360 | - |
|
| 361 | - include_spip('action/editer_auteur'); |
|
| 362 | - auteur_modifier($id_auteur, $c, true); // manque la gestion de $serveur |
|
| 363 | - |
|
| 364 | - return true; // on a bien modifie le pass |
|
| 338 | + if (is_null($new_pass) or auth_spip_verifier_pass($login, $new_pass, $id_auteur, $serveur) != '') { |
|
| 339 | + return false; |
|
| 340 | + } |
|
| 341 | + |
|
| 342 | + if (!$id_auteur = intval($id_auteur) |
|
| 343 | + or !sql_fetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur), '', '', '', '', $serveur) |
|
| 344 | + ) { |
|
| 345 | + return false; |
|
| 346 | + } |
|
| 347 | + |
|
| 348 | + $c = array(); |
|
| 349 | + include_spip('inc/acces'); |
|
| 350 | + include_spip('auth/sha256.inc'); |
|
| 351 | + $htpass = generer_htpass($new_pass); |
|
| 352 | + $alea_actuel = creer_uniqid(); |
|
| 353 | + $alea_futur = creer_uniqid(); |
|
| 354 | + $pass = spip_sha256($alea_actuel . $new_pass); |
|
| 355 | + $c['pass'] = $pass; |
|
| 356 | + $c['htpass'] = $htpass; |
|
| 357 | + $c['alea_actuel'] = $alea_actuel; |
|
| 358 | + $c['alea_futur'] = $alea_futur; |
|
| 359 | + $c['low_sec'] = ''; |
|
| 360 | + |
|
| 361 | + include_spip('action/editer_auteur'); |
|
| 362 | + auteur_modifier($id_auteur, $c, true); // manque la gestion de $serveur |
|
| 363 | + |
|
| 364 | + return true; // on a bien modifie le pass |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | /** |
@@ -375,54 +375,54 @@ discard block |
||
| 375 | 375 | * @return void |
| 376 | 376 | */ |
| 377 | 377 | function auth_spip_synchroniser_distant($id_auteur, $champs, $options = array(), $serveur = '') { |
| 378 | - // ne rien faire pour une base distante : on ne sait pas regenerer les htaccess |
|
| 379 | - if (strlen($serveur)) { |
|
| 380 | - return; |
|
| 381 | - } |
|
| 382 | - // si un login, pass ou statut a ete modifie |
|
| 383 | - // regenerer les fichier htpass |
|
| 384 | - if (isset($champs['login']) |
|
| 385 | - or isset($champs['pass']) |
|
| 386 | - or isset($champs['statut']) |
|
| 387 | - or (isset($options['all']) and $options['all']) |
|
| 388 | - ) { |
|
| 389 | - |
|
| 390 | - $htaccess = _DIR_RESTREINT . _ACCESS_FILE_NAME; |
|
| 391 | - $htpasswd = _DIR_TMP . _AUTH_USER_FILE; |
|
| 392 | - |
|
| 393 | - // Cette variable de configuration peut etre posee par un plugin |
|
| 394 | - // par exemple acces_restreint ; |
|
| 395 | - // si .htaccess existe, outrepasser spip_meta |
|
| 396 | - if ((!isset($GLOBALS['meta']['creer_htpasswd']) or ($GLOBALS['meta']['creer_htpasswd'] != 'oui')) |
|
| 397 | - and !@file_exists($htaccess) |
|
| 398 | - ) { |
|
| 399 | - spip_unlink($htpasswd); |
|
| 400 | - spip_unlink($htpasswd . "-admin"); |
|
| 401 | - |
|
| 402 | - return; |
|
| 403 | - } |
|
| 404 | - |
|
| 405 | - # remarque : ici on laisse passer les "nouveau" de maniere a leur permettre |
|
| 406 | - # de devenir redacteur le cas echeant (auth http)... a nettoyer |
|
| 407 | - // attention, il faut au prealable se connecter a la base (necessaire car utilise par install) |
|
| 408 | - |
|
| 409 | - $p1 = ''; // login:htpass pour tous |
|
| 410 | - $p2 = ''; // login:htpass pour les admins |
|
| 411 | - $s = sql_select("login, htpass, statut", "spip_auteurs", |
|
| 412 | - sql_in("statut", array('1comite', '0minirezo', 'nouveau'))); |
|
| 413 | - while ($t = sql_fetch($s)) { |
|
| 414 | - if (strlen($t['login']) and strlen($t['htpass'])) { |
|
| 415 | - $p1 .= $t['login'] . ':' . $t['htpass'] . "\n"; |
|
| 416 | - if ($t['statut'] == '0minirezo') { |
|
| 417 | - $p2 .= $t['login'] . ':' . $t['htpass'] . "\n"; |
|
| 418 | - } |
|
| 419 | - } |
|
| 420 | - } |
|
| 421 | - sql_free($s); |
|
| 422 | - if ($p1) { |
|
| 423 | - ecrire_fichier($htpasswd, $p1); |
|
| 424 | - ecrire_fichier($htpasswd . '-admin', $p2); |
|
| 425 | - spip_log("Ecriture de $htpasswd et $htpasswd-admin"); |
|
| 426 | - } |
|
| 427 | - } |
|
| 378 | + // ne rien faire pour une base distante : on ne sait pas regenerer les htaccess |
|
| 379 | + if (strlen($serveur)) { |
|
| 380 | + return; |
|
| 381 | + } |
|
| 382 | + // si un login, pass ou statut a ete modifie |
|
| 383 | + // regenerer les fichier htpass |
|
| 384 | + if (isset($champs['login']) |
|
| 385 | + or isset($champs['pass']) |
|
| 386 | + or isset($champs['statut']) |
|
| 387 | + or (isset($options['all']) and $options['all']) |
|
| 388 | + ) { |
|
| 389 | + |
|
| 390 | + $htaccess = _DIR_RESTREINT . _ACCESS_FILE_NAME; |
|
| 391 | + $htpasswd = _DIR_TMP . _AUTH_USER_FILE; |
|
| 392 | + |
|
| 393 | + // Cette variable de configuration peut etre posee par un plugin |
|
| 394 | + // par exemple acces_restreint ; |
|
| 395 | + // si .htaccess existe, outrepasser spip_meta |
|
| 396 | + if ((!isset($GLOBALS['meta']['creer_htpasswd']) or ($GLOBALS['meta']['creer_htpasswd'] != 'oui')) |
|
| 397 | + and !@file_exists($htaccess) |
|
| 398 | + ) { |
|
| 399 | + spip_unlink($htpasswd); |
|
| 400 | + spip_unlink($htpasswd . "-admin"); |
|
| 401 | + |
|
| 402 | + return; |
|
| 403 | + } |
|
| 404 | + |
|
| 405 | + # remarque : ici on laisse passer les "nouveau" de maniere a leur permettre |
|
| 406 | + # de devenir redacteur le cas echeant (auth http)... a nettoyer |
|
| 407 | + // attention, il faut au prealable se connecter a la base (necessaire car utilise par install) |
|
| 408 | + |
|
| 409 | + $p1 = ''; // login:htpass pour tous |
|
| 410 | + $p2 = ''; // login:htpass pour les admins |
|
| 411 | + $s = sql_select("login, htpass, statut", "spip_auteurs", |
|
| 412 | + sql_in("statut", array('1comite', '0minirezo', 'nouveau'))); |
|
| 413 | + while ($t = sql_fetch($s)) { |
|
| 414 | + if (strlen($t['login']) and strlen($t['htpass'])) { |
|
| 415 | + $p1 .= $t['login'] . ':' . $t['htpass'] . "\n"; |
|
| 416 | + if ($t['statut'] == '0minirezo') { |
|
| 417 | + $p2 .= $t['login'] . ':' . $t['htpass'] . "\n"; |
|
| 418 | + } |
|
| 419 | + } |
|
| 420 | + } |
|
| 421 | + sql_free($s); |
|
| 422 | + if ($p1) { |
|
| 423 | + ecrire_fichier($htpasswd, $p1); |
|
| 424 | + ecrire_fichier($htpasswd . '-admin', $p2); |
|
| 425 | + spip_log("Ecriture de $htpasswd et $htpasswd-admin"); |
|
| 426 | + } |
|
| 427 | + } |
|
| 428 | 428 | } |
@@ -11,143 +11,143 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | include_spip('inc/headers'); |
| 18 | 18 | |
| 19 | 19 | function install_etape_3b_dist() { |
| 20 | - $login = _request('login'); |
|
| 21 | - $email = _request('email'); |
|
| 22 | - $nom = _request('nom'); |
|
| 23 | - $pass = _request('pass'); |
|
| 24 | - $pass_verif = _request('pass_verif'); |
|
| 25 | - |
|
| 26 | - $server_db = defined('_INSTALL_SERVER_DB') |
|
| 27 | - ? _INSTALL_SERVER_DB |
|
| 28 | - : _request('server_db'); |
|
| 29 | - |
|
| 30 | - if (!defined('_PASS_LONGUEUR_MINI')) { |
|
| 31 | - define('_PASS_LONGUEUR_MINI', 6); |
|
| 32 | - } |
|
| 33 | - if (!defined('_LOGIN_TROP_COURT')) { |
|
| 34 | - define('_LOGIN_TROP_COURT', 4); |
|
| 35 | - } |
|
| 36 | - if ($login) { |
|
| 37 | - $echec = ($pass != $pass_verif) ? |
|
| 38 | - _T('info_passes_identiques') |
|
| 39 | - : ((strlen($pass) < _PASS_LONGUEUR_MINI) ? |
|
| 40 | - _T('info_passe_trop_court_car_pluriel', array('nb' => _PASS_LONGUEUR_MINI)) |
|
| 41 | - : ((strlen($login) < _LOGIN_TROP_COURT) ? |
|
| 42 | - _T('info_login_trop_court') |
|
| 43 | - : '')); |
|
| 44 | - include_spip('inc/filtres'); |
|
| 45 | - if (!$echec and $email and !email_valide($email)) { |
|
| 46 | - $echec = _T('form_email_non_valide'); |
|
| 47 | - } |
|
| 48 | - if ($echec) { |
|
| 49 | - echo minipres( |
|
| 50 | - 'AUTO', |
|
| 51 | - info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 52 | - "<div class='error'><h3>$echec</h3>\n" . |
|
| 53 | - '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 54 | - '</div>' |
|
| 55 | - ); |
|
| 56 | - exit; |
|
| 57 | - } |
|
| 58 | - } |
|
| 59 | - |
|
| 60 | - if (@file_exists(_FILE_CHMOD_TMP)) { |
|
| 61 | - include(_FILE_CHMOD_TMP); |
|
| 62 | - } else { |
|
| 63 | - redirige_url_ecrire('install'); |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 67 | - redirige_url_ecrire('install'); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - # maintenant on connait le vrai charset du site s'il est deja configure |
|
| 71 | - # sinon par defaut lire_meta reglera _DEFAULT_CHARSET |
|
| 72 | - # (les donnees arrivent de toute facon postees en _DEFAULT_CHARSET) |
|
| 73 | - |
|
| 74 | - lire_metas(); |
|
| 75 | - if ($login) { |
|
| 76 | - include_spip('inc/charsets'); |
|
| 77 | - |
|
| 78 | - $nom = (importer_charset($nom, _DEFAULT_CHARSET)); |
|
| 79 | - $login = (importer_charset($login, _DEFAULT_CHARSET)); |
|
| 80 | - $email = (importer_charset($email, _DEFAULT_CHARSET)); |
|
| 81 | - # pour le passwd, bizarrement il faut le convertir comme s'il avait |
|
| 82 | - # ete tape en iso-8859-1 ; car c'est en fait ce que voit md5.js |
|
| 83 | - $pass = unicode2charset(utf_8_to_unicode($pass), 'iso-8859-1'); |
|
| 84 | - include_spip('auth/sha256.inc'); |
|
| 85 | - include_spip('inc/acces'); |
|
| 86 | - $htpass = generer_htpass($pass); |
|
| 87 | - $alea_actuel = creer_uniqid(); |
|
| 88 | - $alea_futur = creer_uniqid(); |
|
| 89 | - $shapass = spip_sha256($alea_actuel . $pass); |
|
| 90 | - // prelablement, creer le champ webmestre si il n'existe pas (install neuve |
|
| 91 | - // sur une vieille base |
|
| 92 | - $t = sql_showtable('spip_auteurs', true); |
|
| 93 | - if (!isset($t['field']['webmestre'])) { |
|
| 94 | - @sql_alter("TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"); |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 98 | - if ($id_auteur !== null) { |
|
| 99 | - sql_updateq('spip_auteurs', array( |
|
| 100 | - 'nom' => $nom, |
|
| 101 | - 'email' => $email, |
|
| 102 | - 'login' => $login, |
|
| 103 | - 'pass' => $shapass, |
|
| 104 | - 'alea_actuel' => $alea_actuel, |
|
| 105 | - 'alea_futur' => $alea_futur, |
|
| 106 | - 'htpass' => $htpass, |
|
| 107 | - 'statut' => '0minirezo' |
|
| 108 | - ), "id_auteur=$id_auteur"); |
|
| 109 | - } else { |
|
| 110 | - $id_auteur = sql_insertq('spip_auteurs', array( |
|
| 111 | - 'nom' => $nom, |
|
| 112 | - 'email' => $email, |
|
| 113 | - 'login' => $login, |
|
| 114 | - 'pass' => $shapass, |
|
| 115 | - 'htpass' => $htpass, |
|
| 116 | - 'alea_actuel' => $alea_actuel, |
|
| 117 | - 'alea_futur' => $alea_futur, |
|
| 118 | - 'statut' => '0minirezo' |
|
| 119 | - )); |
|
| 120 | - } |
|
| 121 | - // le passer webmestre separrement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 122 | - @sql_updateq('spip_auteurs', array('webmestre' => 'oui'), "id_auteur=$id_auteur"); |
|
| 123 | - |
|
| 124 | - // inserer email comme email webmaster principal |
|
| 125 | - // (sauf s'il est vide: cas de la re-installation) |
|
| 126 | - if ($email) { |
|
| 127 | - ecrire_meta('email_webmaster', $email); |
|
| 128 | - } |
|
| 129 | - |
|
| 130 | - // Connecter directement celui qui vient de (re)donner son login |
|
| 131 | - // mais sans cookie d'admin ni connexion longue |
|
| 132 | - include_spip('inc/auth'); |
|
| 133 | - if (!$auteur = auth_identifier_login($login, $pass) |
|
| 134 | - or !auth_loger($auteur, true) |
|
| 135 | - ) { |
|
| 136 | - spip_log("login automatique impossible $auth_spip $session" . count($row)); |
|
| 137 | - } |
|
| 138 | - } |
|
| 139 | - |
|
| 140 | - // installer les metas |
|
| 141 | - $config = charger_fonction('config', 'inc'); |
|
| 142 | - $config(); |
|
| 143 | - |
|
| 144 | - // activer les plugins |
|
| 145 | - // leur installation ne peut pas se faire sur le meme hit, il faudra donc |
|
| 146 | - // poursuivre au hit suivant |
|
| 147 | - include_spip('inc/plugin'); |
|
| 148 | - actualise_plugins_actifs(); |
|
| 149 | - |
|
| 150 | - |
|
| 151 | - include_spip('inc/distant'); |
|
| 152 | - redirige_par_entete(parametre_url(self(), 'etape', '4', '&')); |
|
| 20 | + $login = _request('login'); |
|
| 21 | + $email = _request('email'); |
|
| 22 | + $nom = _request('nom'); |
|
| 23 | + $pass = _request('pass'); |
|
| 24 | + $pass_verif = _request('pass_verif'); |
|
| 25 | + |
|
| 26 | + $server_db = defined('_INSTALL_SERVER_DB') |
|
| 27 | + ? _INSTALL_SERVER_DB |
|
| 28 | + : _request('server_db'); |
|
| 29 | + |
|
| 30 | + if (!defined('_PASS_LONGUEUR_MINI')) { |
|
| 31 | + define('_PASS_LONGUEUR_MINI', 6); |
|
| 32 | + } |
|
| 33 | + if (!defined('_LOGIN_TROP_COURT')) { |
|
| 34 | + define('_LOGIN_TROP_COURT', 4); |
|
| 35 | + } |
|
| 36 | + if ($login) { |
|
| 37 | + $echec = ($pass != $pass_verif) ? |
|
| 38 | + _T('info_passes_identiques') |
|
| 39 | + : ((strlen($pass) < _PASS_LONGUEUR_MINI) ? |
|
| 40 | + _T('info_passe_trop_court_car_pluriel', array('nb' => _PASS_LONGUEUR_MINI)) |
|
| 41 | + : ((strlen($login) < _LOGIN_TROP_COURT) ? |
|
| 42 | + _T('info_login_trop_court') |
|
| 43 | + : '')); |
|
| 44 | + include_spip('inc/filtres'); |
|
| 45 | + if (!$echec and $email and !email_valide($email)) { |
|
| 46 | + $echec = _T('form_email_non_valide'); |
|
| 47 | + } |
|
| 48 | + if ($echec) { |
|
| 49 | + echo minipres( |
|
| 50 | + 'AUTO', |
|
| 51 | + info_progression_etape(3, 'etape_', 'install/', true) . |
|
| 52 | + "<div class='error'><h3>$echec</h3>\n" . |
|
| 53 | + '<p>' . _T('avis_connexion_echec_2') . '</p>' . |
|
| 54 | + '</div>' |
|
| 55 | + ); |
|
| 56 | + exit; |
|
| 57 | + } |
|
| 58 | + } |
|
| 59 | + |
|
| 60 | + if (@file_exists(_FILE_CHMOD_TMP)) { |
|
| 61 | + include(_FILE_CHMOD_TMP); |
|
| 62 | + } else { |
|
| 63 | + redirige_url_ecrire('install'); |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 67 | + redirige_url_ecrire('install'); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + # maintenant on connait le vrai charset du site s'il est deja configure |
|
| 71 | + # sinon par defaut lire_meta reglera _DEFAULT_CHARSET |
|
| 72 | + # (les donnees arrivent de toute facon postees en _DEFAULT_CHARSET) |
|
| 73 | + |
|
| 74 | + lire_metas(); |
|
| 75 | + if ($login) { |
|
| 76 | + include_spip('inc/charsets'); |
|
| 77 | + |
|
| 78 | + $nom = (importer_charset($nom, _DEFAULT_CHARSET)); |
|
| 79 | + $login = (importer_charset($login, _DEFAULT_CHARSET)); |
|
| 80 | + $email = (importer_charset($email, _DEFAULT_CHARSET)); |
|
| 81 | + # pour le passwd, bizarrement il faut le convertir comme s'il avait |
|
| 82 | + # ete tape en iso-8859-1 ; car c'est en fait ce que voit md5.js |
|
| 83 | + $pass = unicode2charset(utf_8_to_unicode($pass), 'iso-8859-1'); |
|
| 84 | + include_spip('auth/sha256.inc'); |
|
| 85 | + include_spip('inc/acces'); |
|
| 86 | + $htpass = generer_htpass($pass); |
|
| 87 | + $alea_actuel = creer_uniqid(); |
|
| 88 | + $alea_futur = creer_uniqid(); |
|
| 89 | + $shapass = spip_sha256($alea_actuel . $pass); |
|
| 90 | + // prelablement, creer le champ webmestre si il n'existe pas (install neuve |
|
| 91 | + // sur une vieille base |
|
| 92 | + $t = sql_showtable('spip_auteurs', true); |
|
| 93 | + if (!isset($t['field']['webmestre'])) { |
|
| 94 | + @sql_alter("TABLE spip_auteurs ADD webmestre varchar(3) DEFAULT 'non' NOT NULL"); |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + $id_auteur = sql_getfetsel('id_auteur', 'spip_auteurs', 'login=' . sql_quote($login)); |
|
| 98 | + if ($id_auteur !== null) { |
|
| 99 | + sql_updateq('spip_auteurs', array( |
|
| 100 | + 'nom' => $nom, |
|
| 101 | + 'email' => $email, |
|
| 102 | + 'login' => $login, |
|
| 103 | + 'pass' => $shapass, |
|
| 104 | + 'alea_actuel' => $alea_actuel, |
|
| 105 | + 'alea_futur' => $alea_futur, |
|
| 106 | + 'htpass' => $htpass, |
|
| 107 | + 'statut' => '0minirezo' |
|
| 108 | + ), "id_auteur=$id_auteur"); |
|
| 109 | + } else { |
|
| 110 | + $id_auteur = sql_insertq('spip_auteurs', array( |
|
| 111 | + 'nom' => $nom, |
|
| 112 | + 'email' => $email, |
|
| 113 | + 'login' => $login, |
|
| 114 | + 'pass' => $shapass, |
|
| 115 | + 'htpass' => $htpass, |
|
| 116 | + 'alea_actuel' => $alea_actuel, |
|
| 117 | + 'alea_futur' => $alea_futur, |
|
| 118 | + 'statut' => '0minirezo' |
|
| 119 | + )); |
|
| 120 | + } |
|
| 121 | + // le passer webmestre separrement du reste, au cas ou l'alter n'aurait pas fonctionne |
|
| 122 | + @sql_updateq('spip_auteurs', array('webmestre' => 'oui'), "id_auteur=$id_auteur"); |
|
| 123 | + |
|
| 124 | + // inserer email comme email webmaster principal |
|
| 125 | + // (sauf s'il est vide: cas de la re-installation) |
|
| 126 | + if ($email) { |
|
| 127 | + ecrire_meta('email_webmaster', $email); |
|
| 128 | + } |
|
| 129 | + |
|
| 130 | + // Connecter directement celui qui vient de (re)donner son login |
|
| 131 | + // mais sans cookie d'admin ni connexion longue |
|
| 132 | + include_spip('inc/auth'); |
|
| 133 | + if (!$auteur = auth_identifier_login($login, $pass) |
|
| 134 | + or !auth_loger($auteur, true) |
|
| 135 | + ) { |
|
| 136 | + spip_log("login automatique impossible $auth_spip $session" . count($row)); |
|
| 137 | + } |
|
| 138 | + } |
|
| 139 | + |
|
| 140 | + // installer les metas |
|
| 141 | + $config = charger_fonction('config', 'inc'); |
|
| 142 | + $config(); |
|
| 143 | + |
|
| 144 | + // activer les plugins |
|
| 145 | + // leur installation ne peut pas se faire sur le meme hit, il faudra donc |
|
| 146 | + // poursuivre au hit suivant |
|
| 147 | + include_spip('inc/plugin'); |
|
| 148 | + actualise_plugins_actifs(); |
|
| 149 | + |
|
| 150 | + |
|
| 151 | + include_spip('inc/distant'); |
|
| 152 | + redirige_par_entete(parametre_url(self(), 'etape', '4', '&')); |
|
| 153 | 153 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Fonctions |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -29,29 +29,29 @@ discard block |
||
| 29 | 29 | * @param bool $left |
| 30 | 30 | */ |
| 31 | 31 | function critere_compteur_articles_filtres_dist($idb, &$boucles, $crit, $left = false) { |
| 32 | - $boucle = &$boucles[$idb]; |
|
| 32 | + $boucle = &$boucles[$idb]; |
|
| 33 | 33 | |
| 34 | - $_statut = calculer_liste($crit->param[0], array(), $boucles, $boucle->id_parent); |
|
| 34 | + $_statut = calculer_liste($crit->param[0], array(), $boucles, $boucle->id_parent); |
|
| 35 | 35 | |
| 36 | - $not = ''; |
|
| 37 | - if ($crit->not) { |
|
| 38 | - $not = ", 'NOT'"; |
|
| 39 | - } |
|
| 40 | - $boucle->from['LAA'] = 'spip_auteurs_liens'; |
|
| 41 | - $boucle->from_type['LAA'] = 'left'; |
|
| 42 | - $boucle->join['LAA'] = array("'auteurs'", "'id_auteur'", "'id_auteur'", "'LAA.objet=\'article\''"); |
|
| 36 | + $not = ''; |
|
| 37 | + if ($crit->not) { |
|
| 38 | + $not = ", 'NOT'"; |
|
| 39 | + } |
|
| 40 | + $boucle->from['LAA'] = 'spip_auteurs_liens'; |
|
| 41 | + $boucle->from_type['LAA'] = 'left'; |
|
| 42 | + $boucle->join['LAA'] = array("'auteurs'", "'id_auteur'", "'id_auteur'", "'LAA.objet=\'article\''"); |
|
| 43 | 43 | |
| 44 | - $boucle->from['articles'] = 'spip_articles'; |
|
| 45 | - $boucle->from_type['articles'] = 'left'; |
|
| 46 | - $boucle->join['articles'] = array( |
|
| 47 | - "'LAA'", |
|
| 48 | - "'id_article'", |
|
| 49 | - "'id_objet'", |
|
| 50 | - "'(articles.statut IS NULL OR '.sql_in('articles.statut',_q($_statut)$not).')'" |
|
| 51 | - ); |
|
| 44 | + $boucle->from['articles'] = 'spip_articles'; |
|
| 45 | + $boucle->from_type['articles'] = 'left'; |
|
| 46 | + $boucle->join['articles'] = array( |
|
| 47 | + "'LAA'", |
|
| 48 | + "'id_article'", |
|
| 49 | + "'id_objet'", |
|
| 50 | + "'(articles.statut IS NULL OR '.sql_in('articles.statut',_q($_statut)$not).')'" |
|
| 51 | + ); |
|
| 52 | 52 | |
| 53 | - $boucle->select[] = 'COUNT(articles.id_article) AS compteur_articles'; |
|
| 54 | - $boucle->group[] = 'auteurs.id_auteur'; |
|
| 53 | + $boucle->select[] = 'COUNT(articles.id_article) AS compteur_articles'; |
|
| 54 | + $boucle->group[] = 'auteurs.id_auteur'; |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | * Pile complétée par le code à générer |
| 70 | 70 | */ |
| 71 | 71 | function balise_COMPTEUR_ARTICLES_dist($p) { |
| 72 | - return rindex_pile($p, 'compteur_articles', 'compteur_articles_filtres'); |
|
| 72 | + return rindex_pile($p, 'compteur_articles', 'compteur_articles_filtres'); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
@@ -85,43 +85,43 @@ discard block |
||
| 85 | 85 | * @return string |
| 86 | 86 | */ |
| 87 | 87 | function afficher_initiale($url, $initiale, $compteur, $debut, $pas) { |
| 88 | - static $memo = null; |
|
| 89 | - static $res = []; |
|
| 90 | - $out = ''; |
|
| 91 | - if (!$memo |
|
| 92 | - or (!$initiale and !$url) |
|
| 93 | - or ($initiale !== $memo['initiale']) |
|
| 94 | - ) { |
|
| 95 | - $newcompt = intval(floor(($compteur - 1) / $pas) * $pas); |
|
| 96 | - // si fin de la pagination et une seule entree, ne pas l'afficher, ca ne sert a rien |
|
| 97 | - if (!$initiale and !$url and !$memo['compteur']) { |
|
| 98 | - $memo = null; |
|
| 99 | - } |
|
| 100 | - if ($memo) { |
|
| 101 | - $on = (($memo['compteur'] <= $debut) |
|
| 102 | - and ( |
|
| 103 | - $newcompt > $debut or ($newcompt == $debut and $newcompt == $memo['compteur']) |
|
| 104 | - )); |
|
| 105 | - $res[] = lien_ou_expose($memo['url'], $memo['initiale'], $on, 'lien_pagination'); |
|
| 106 | - } |
|
| 107 | - if ($initiale) { |
|
| 108 | - $memo = array( |
|
| 109 | - 'entree' => isset($memo['entree']) ? $memo['entree'] + 1 : 0, |
|
| 110 | - 'initiale' => $initiale, |
|
| 111 | - 'url' => parametre_url($url, 'i', $initiale), |
|
| 112 | - 'compteur' => $newcompt |
|
| 113 | - ); |
|
| 114 | - } |
|
| 115 | - } |
|
| 116 | - if (!$initiale and !$url) { |
|
| 117 | - if (count($res) > 1) { |
|
| 118 | - $out = implode(' ', $res); |
|
| 119 | - } |
|
| 120 | - $memo = null; |
|
| 121 | - $res = []; |
|
| 122 | - } |
|
| 88 | + static $memo = null; |
|
| 89 | + static $res = []; |
|
| 90 | + $out = ''; |
|
| 91 | + if (!$memo |
|
| 92 | + or (!$initiale and !$url) |
|
| 93 | + or ($initiale !== $memo['initiale']) |
|
| 94 | + ) { |
|
| 95 | + $newcompt = intval(floor(($compteur - 1) / $pas) * $pas); |
|
| 96 | + // si fin de la pagination et une seule entree, ne pas l'afficher, ca ne sert a rien |
|
| 97 | + if (!$initiale and !$url and !$memo['compteur']) { |
|
| 98 | + $memo = null; |
|
| 99 | + } |
|
| 100 | + if ($memo) { |
|
| 101 | + $on = (($memo['compteur'] <= $debut) |
|
| 102 | + and ( |
|
| 103 | + $newcompt > $debut or ($newcompt == $debut and $newcompt == $memo['compteur']) |
|
| 104 | + )); |
|
| 105 | + $res[] = lien_ou_expose($memo['url'], $memo['initiale'], $on, 'lien_pagination'); |
|
| 106 | + } |
|
| 107 | + if ($initiale) { |
|
| 108 | + $memo = array( |
|
| 109 | + 'entree' => isset($memo['entree']) ? $memo['entree'] + 1 : 0, |
|
| 110 | + 'initiale' => $initiale, |
|
| 111 | + 'url' => parametre_url($url, 'i', $initiale), |
|
| 112 | + 'compteur' => $newcompt |
|
| 113 | + ); |
|
| 114 | + } |
|
| 115 | + } |
|
| 116 | + if (!$initiale and !$url) { |
|
| 117 | + if (count($res) > 1) { |
|
| 118 | + $out = implode(' ', $res); |
|
| 119 | + } |
|
| 120 | + $memo = null; |
|
| 121 | + $res = []; |
|
| 122 | + } |
|
| 123 | 123 | |
| 124 | - return $out; |
|
| 124 | + return $out; |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | /** |
@@ -140,23 +140,23 @@ discard block |
||
| 140 | 140 | * @return string |
| 141 | 141 | */ |
| 142 | 142 | function auteur_lien_messagerie($id_auteur, $en_ligne, $statut, $imessage, $email = '') { |
| 143 | - static $time = null; |
|
| 144 | - if (!in_array($statut, array('0minirezo', '1comite'))) { |
|
| 145 | - return ''; |
|
| 146 | - } |
|
| 143 | + static $time = null; |
|
| 144 | + if (!in_array($statut, array('0minirezo', '1comite'))) { |
|
| 145 | + return ''; |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | - if (is_null($time)) { |
|
| 149 | - $time = time(); |
|
| 150 | - } |
|
| 151 | - $parti = (($time - strtotime($en_ligne)) > 15 * 60); |
|
| 148 | + if (is_null($time)) { |
|
| 149 | + $time = time(); |
|
| 150 | + } |
|
| 151 | + $parti = (($time - strtotime($en_ligne)) > 15 * 60); |
|
| 152 | 152 | |
| 153 | - if ($imessage != 'non' and !$parti // historique : est-ce que ca a encore un sens de limiter vu qu'on a la notification par email ? |
|
| 154 | - and $GLOBALS['meta']['messagerie_agenda'] != 'non' |
|
| 155 | - ) { |
|
| 156 | - return parametre_url(parametre_url(generer_url_ecrire('message_edit', 'new=oui'), 'to', $id_auteur), 'redirect', self()); |
|
| 157 | - } elseif (strlen($email) and autoriser('voir', 'auteur', $id_auteur)) { |
|
| 158 | - return 'mailto:' . $email; |
|
| 159 | - } else { |
|
| 160 | - return ''; |
|
| 161 | - } |
|
| 153 | + if ($imessage != 'non' and !$parti // historique : est-ce que ca a encore un sens de limiter vu qu'on a la notification par email ? |
|
| 154 | + and $GLOBALS['meta']['messagerie_agenda'] != 'non' |
|
| 155 | + ) { |
|
| 156 | + return parametre_url(parametre_url(generer_url_ecrire('message_edit', 'new=oui'), 'to', $id_auteur), 'redirect', self()); |
|
| 157 | + } elseif (strlen($email) and autoriser('voir', 'auteur', $id_auteur)) { |
|
| 158 | + return 'mailto:' . $email; |
|
| 159 | + } else { |
|
| 160 | + return ''; |
|
| 161 | + } |
|
| 162 | 162 | } |
@@ -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 | |
@@ -35,19 +35,19 @@ discard block |
||
| 35 | 35 | * @return string URL nettoyée |
| 36 | 36 | **/ |
| 37 | 37 | function resolve_path($url) { |
| 38 | - list($url, $query) = array_pad(explode('?', $url, 2), 2, null); |
|
| 39 | - while (preg_match(',/\.?/,', $url, $regs) # supprime // et /./ |
|
| 40 | - or preg_match(',/[^/]*/\.\./,S', $url, $regs) # supprime /toto/../ |
|
| 41 | - or preg_match(',^/\.\./,S', $url, $regs) # supprime les /../ du haut |
|
| 42 | - ) { |
|
| 43 | - $url = str_replace($regs[0], '/', $url); |
|
| 44 | - } |
|
| 38 | + list($url, $query) = array_pad(explode('?', $url, 2), 2, null); |
|
| 39 | + while (preg_match(',/\.?/,', $url, $regs) # supprime // et /./ |
|
| 40 | + or preg_match(',/[^/]*/\.\./,S', $url, $regs) # supprime /toto/../ |
|
| 41 | + or preg_match(',^/\.\./,S', $url, $regs) # supprime les /../ du haut |
|
| 42 | + ) { |
|
| 43 | + $url = str_replace($regs[0], '/', $url); |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - if ($query) { |
|
| 47 | - $url .= '?' . $query; |
|
| 48 | - } |
|
| 46 | + if ($query) { |
|
| 47 | + $url .= '?' . $query; |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - return '/' . preg_replace(',^/,S', '', $url); |
|
| 50 | + return '/' . preg_replace(',^/,S', '', $url); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -68,41 +68,41 @@ discard block |
||
| 68 | 68 | **/ |
| 69 | 69 | function suivre_lien($url, $lien) { |
| 70 | 70 | |
| 71 | - if (preg_match(',^(mailto|javascript|data|tel|callto|file|ftp):,iS', $lien)) { |
|
| 72 | - return $lien; |
|
| 73 | - } |
|
| 74 | - if (preg_match(';^((?:[a-z]{3,33}:)?//.*?)(/.*)?$;iS', $lien, $r)) { |
|
| 75 | - $r = array_pad($r, 3, null); |
|
| 71 | + if (preg_match(',^(mailto|javascript|data|tel|callto|file|ftp):,iS', $lien)) { |
|
| 72 | + return $lien; |
|
| 73 | + } |
|
| 74 | + if (preg_match(';^((?:[a-z]{3,33}:)?//.*?)(/.*)?$;iS', $lien, $r)) { |
|
| 75 | + $r = array_pad($r, 3, null); |
|
| 76 | 76 | |
| 77 | - return $r[1] . resolve_path($r[2]); |
|
| 78 | - } |
|
| 77 | + return $r[1] . resolve_path($r[2]); |
|
| 78 | + } |
|
| 79 | 79 | |
| 80 | - # L'url site spip est un lien absolu aussi |
|
| 81 | - if (isset($GLOBALS['meta']['adresse_site']) and $lien == $GLOBALS['meta']['adresse_site']) { |
|
| 82 | - return $lien; |
|
| 83 | - } |
|
| 80 | + # L'url site spip est un lien absolu aussi |
|
| 81 | + if (isset($GLOBALS['meta']['adresse_site']) and $lien == $GLOBALS['meta']['adresse_site']) { |
|
| 82 | + return $lien; |
|
| 83 | + } |
|
| 84 | 84 | |
| 85 | - # lien relatif, il faut verifier l'url de base |
|
| 86 | - # commencer par virer la chaine de get de l'url de base |
|
| 87 | - $dir = '/'; |
|
| 88 | - $debut = ''; |
|
| 89 | - if (preg_match(';^((?:[a-z]{3,7}:)?//[^/]+)(/.*?/?)?([^/#?]*)([?][^#]*)?(#.*)?$;S', $url, $regs)) { |
|
| 90 | - $debut = $regs[1]; |
|
| 91 | - $dir = !strlen($regs[2]) ? '/' : $regs[2]; |
|
| 92 | - $mot = $regs[3]; |
|
| 93 | - $get = isset($regs[4]) ? $regs[4] : ''; |
|
| 94 | - $hash = isset($regs[5]) ? $regs[5] : ''; |
|
| 95 | - } |
|
| 96 | - switch (substr($lien, 0, 1)) { |
|
| 97 | - case '/': |
|
| 98 | - return $debut . resolve_path($lien); |
|
| 99 | - case '#': |
|
| 100 | - return $debut . resolve_path($dir . $mot . $get . $lien); |
|
| 101 | - case '': |
|
| 102 | - return $debut . resolve_path($dir . $mot . $get . $hash); |
|
| 103 | - default: |
|
| 104 | - return $debut . resolve_path($dir . $lien); |
|
| 105 | - } |
|
| 85 | + # lien relatif, il faut verifier l'url de base |
|
| 86 | + # commencer par virer la chaine de get de l'url de base |
|
| 87 | + $dir = '/'; |
|
| 88 | + $debut = ''; |
|
| 89 | + if (preg_match(';^((?:[a-z]{3,7}:)?//[^/]+)(/.*?/?)?([^/#?]*)([?][^#]*)?(#.*)?$;S', $url, $regs)) { |
|
| 90 | + $debut = $regs[1]; |
|
| 91 | + $dir = !strlen($regs[2]) ? '/' : $regs[2]; |
|
| 92 | + $mot = $regs[3]; |
|
| 93 | + $get = isset($regs[4]) ? $regs[4] : ''; |
|
| 94 | + $hash = isset($regs[5]) ? $regs[5] : ''; |
|
| 95 | + } |
|
| 96 | + switch (substr($lien, 0, 1)) { |
|
| 97 | + case '/': |
|
| 98 | + return $debut . resolve_path($lien); |
|
| 99 | + case '#': |
|
| 100 | + return $debut . resolve_path($dir . $mot . $get . $lien); |
|
| 101 | + case '': |
|
| 102 | + return $debut . resolve_path($dir . $mot . $get . $hash); |
|
| 103 | + default: |
|
| 104 | + return $debut . resolve_path($dir . $lien); |
|
| 105 | + } |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | |
@@ -125,14 +125,14 @@ discard block |
||
| 125 | 125 | * @return string Texte ou URL (en absolus) |
| 126 | 126 | **/ |
| 127 | 127 | function url_absolue($url, $base = '') { |
| 128 | - if (strlen($url = trim($url)) == 0) { |
|
| 129 | - return ''; |
|
| 130 | - } |
|
| 131 | - if (!$base) { |
|
| 132 | - $base = url_de_base() . (_DIR_RACINE ? _DIR_RESTREINT_ABS : ''); |
|
| 133 | - } |
|
| 128 | + if (strlen($url = trim($url)) == 0) { |
|
| 129 | + return ''; |
|
| 130 | + } |
|
| 131 | + if (!$base) { |
|
| 132 | + $base = url_de_base() . (_DIR_RACINE ? _DIR_RESTREINT_ABS : ''); |
|
| 133 | + } |
|
| 134 | 134 | |
| 135 | - return suivre_lien($base, $url); |
|
| 135 | + return suivre_lien($base, $url); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | /** |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @return string |
| 144 | 144 | */ |
| 145 | 145 | function protocole_implicite($url_absolue) { |
| 146 | - return preg_replace(';^[a-z]{3,7}://;i', '//', $url_absolue); |
|
| 146 | + return preg_replace(';^[a-z]{3,7}://;i', '//', $url_absolue); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | /** |
@@ -154,14 +154,14 @@ discard block |
||
| 154 | 154 | */ |
| 155 | 155 | function protocole_verifier($url_absolue, $protocoles_autorises = array('http','https')) { |
| 156 | 156 | |
| 157 | - if (preg_match(';^([a-z]{3,7})://;i', $url_absolue, $m)) { |
|
| 158 | - $protocole = $m[1]; |
|
| 159 | - if (in_array($protocole, $protocoles_autorises) |
|
| 160 | - or in_array(strtolower($protocole), array_map('strtolower', $protocoles_autorises))) { |
|
| 161 | - return true; |
|
| 162 | - } |
|
| 163 | - } |
|
| 164 | - return false; |
|
| 157 | + if (preg_match(';^([a-z]{3,7})://;i', $url_absolue, $m)) { |
|
| 158 | + $protocole = $m[1]; |
|
| 159 | + if (in_array($protocole, $protocoles_autorises) |
|
| 160 | + or in_array(strtolower($protocole), array_map('strtolower', $protocoles_autorises))) { |
|
| 161 | + return true; |
|
| 162 | + } |
|
| 163 | + } |
|
| 164 | + return false; |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -178,27 +178,27 @@ discard block |
||
| 178 | 178 | * @return string Texte avec des URLs absolues |
| 179 | 179 | **/ |
| 180 | 180 | function liens_absolus($texte, $base = '') { |
| 181 | - if (preg_match_all(',(<(a|link|image|img|script)\s[^<>]*(href|src)=[^<>]*>),imsS', $texte, $liens, PREG_SET_ORDER)) { |
|
| 182 | - if (!function_exists('extraire_attribut')) { |
|
| 183 | - include_spip('inc/filtres'); |
|
| 184 | - } |
|
| 185 | - foreach ($liens as $lien) { |
|
| 186 | - foreach (array('href', 'src') as $attr) { |
|
| 187 | - $href = extraire_attribut($lien[0], $attr); |
|
| 188 | - if (strlen($href) > 0) { |
|
| 189 | - if (!preg_match(';^((?:[a-z]{3,7}:)?//);iS', $href)) { |
|
| 190 | - $abs = url_absolue($href, $base); |
|
| 191 | - if (rtrim($href, '/') !== rtrim($abs, '/') and !preg_match('/^#/', $href)) { |
|
| 192 | - $texte_lien = inserer_attribut($lien[0], $attr, $abs); |
|
| 193 | - $texte = str_replace($lien[0], $texte_lien, $texte); |
|
| 194 | - } |
|
| 195 | - } |
|
| 196 | - } |
|
| 197 | - } |
|
| 198 | - } |
|
| 199 | - } |
|
| 181 | + if (preg_match_all(',(<(a|link|image|img|script)\s[^<>]*(href|src)=[^<>]*>),imsS', $texte, $liens, PREG_SET_ORDER)) { |
|
| 182 | + if (!function_exists('extraire_attribut')) { |
|
| 183 | + include_spip('inc/filtres'); |
|
| 184 | + } |
|
| 185 | + foreach ($liens as $lien) { |
|
| 186 | + foreach (array('href', 'src') as $attr) { |
|
| 187 | + $href = extraire_attribut($lien[0], $attr); |
|
| 188 | + if (strlen($href) > 0) { |
|
| 189 | + if (!preg_match(';^((?:[a-z]{3,7}:)?//);iS', $href)) { |
|
| 190 | + $abs = url_absolue($href, $base); |
|
| 191 | + if (rtrim($href, '/') !== rtrim($abs, '/') and !preg_match('/^#/', $href)) { |
|
| 192 | + $texte_lien = inserer_attribut($lien[0], $attr, $abs); |
|
| 193 | + $texte = str_replace($lien[0], $texte_lien, $texte); |
|
| 194 | + } |
|
| 195 | + } |
|
| 196 | + } |
|
| 197 | + } |
|
| 198 | + } |
|
| 199 | + } |
|
| 200 | 200 | |
| 201 | - return $texte; |
|
| 201 | + return $texte; |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
@@ -214,11 +214,11 @@ discard block |
||
| 214 | 214 | * @return string Texte ou URL (en absolus) |
| 215 | 215 | **/ |
| 216 | 216 | function abs_url($texte, $base = '') { |
| 217 | - if ($GLOBALS['mode_abs_url'] == 'url') { |
|
| 218 | - return url_absolue($texte, $base); |
|
| 219 | - } else { |
|
| 220 | - return liens_absolus($texte, $base); |
|
| 221 | - } |
|
| 217 | + if ($GLOBALS['mode_abs_url'] == 'url') { |
|
| 218 | + return url_absolue($texte, $base); |
|
| 219 | + } else { |
|
| 220 | + return liens_absolus($texte, $base); |
|
| 221 | + } |
|
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | /** |
@@ -231,11 +231,11 @@ discard block |
||
| 231 | 231 | * @return string |
| 232 | 232 | */ |
| 233 | 233 | function spip_htmlspecialchars($string, $flags = null, $encoding = 'UTF-8', $double_encode = true) { |
| 234 | - if (is_null($flags)) { |
|
| 235 | - $flags = ENT_COMPAT|ENT_HTML401; |
|
| 236 | - } |
|
| 234 | + if (is_null($flags)) { |
|
| 235 | + $flags = ENT_COMPAT|ENT_HTML401; |
|
| 236 | + } |
|
| 237 | 237 | |
| 238 | - return htmlspecialchars($string, $flags, $encoding, $double_encode); |
|
| 238 | + return htmlspecialchars($string, $flags, $encoding, $double_encode); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /** |
@@ -248,9 +248,9 @@ discard block |
||
| 248 | 248 | * @return string |
| 249 | 249 | */ |
| 250 | 250 | function spip_htmlentities($string, $flags = null, $encoding = 'UTF-8', $double_encode = true) { |
| 251 | - if (is_null($flags)) { |
|
| 252 | - $flags = ENT_COMPAT|ENT_HTML401; |
|
| 253 | - } |
|
| 251 | + if (is_null($flags)) { |
|
| 252 | + $flags = ENT_COMPAT|ENT_HTML401; |
|
| 253 | + } |
|
| 254 | 254 | |
| 255 | - return htmlentities($string, $flags, $encoding, $double_encode); |
|
| 255 | + return htmlentities($string, $flags, $encoding, $double_encode); |
|
| 256 | 256 | } |
@@ -19,206 +19,206 @@ |
||
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 22 | - return; |
|
| 22 | + return; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $GLOBALS['codes_langues'] = array( |
| 26 | - 'aa' => "Afar", |
|
| 27 | - 'ab' => "Abkhazian", |
|
| 28 | - 'af' => "Afrikaans", |
|
| 29 | - 'am' => "Amharic", |
|
| 30 | - 'an' => "Aragonés", |
|
| 31 | - 'ar' => "عربي", |
|
| 32 | - 'as' => "Assamese", |
|
| 33 | - 'ast' => "asturianu", |
|
| 34 | - 'ay' => "Aymara", |
|
| 35 | - 'az' => "Azərbaycan dili", |
|
| 36 | - 'ba' => "Bashkir", |
|
| 37 | - 'be' => "Беларуская", |
|
| 38 | - 'ber_tam' => "Tamazigh", |
|
| 39 | - 'ber_tam_tfng' => "Tamazigh tifinagh", |
|
| 40 | - 'bg' => "български", |
|
| 41 | - 'bh' => "Bihari", |
|
| 42 | - 'bi' => "Bislama", |
|
| 43 | - 'bm' => "Bambara", |
|
| 44 | - 'bn' => "Bengali; Bangla", |
|
| 45 | - 'bo' => "Tibetan", |
|
| 46 | - 'br' => "brezhoneg", |
|
| 47 | - 'bs' => "bosanski", |
|
| 48 | - 'ca' => "català", |
|
| 49 | - 'co' => "corsu", |
|
| 50 | - 'cpf' => "Kréol réyoné", |
|
| 51 | - 'cpf_dom' => "Kreyòl", |
|
| 52 | - 'cpf_hat' => "Kreyòl (Peyi Dayiti)", |
|
| 53 | - 'cs' => "čeština", |
|
| 54 | - 'cy' => "Cymraeg", # welsh, gallois |
|
| 55 | - 'da' => "dansk", |
|
| 56 | - 'de' => "Deutsch", |
|
| 57 | - 'dz' => "Bhutani", |
|
| 58 | - 'el' => "ελληνικά", |
|
| 59 | - 'en' => "English", |
|
| 60 | - 'en_hx' => "H4ck3R", |
|
| 61 | - 'en_sm' => "Smurf", |
|
| 62 | - 'eo' => "Esperanto", |
|
| 63 | - 'es' => "Español", |
|
| 64 | - 'es_co' => "Colombiano", |
|
| 65 | - 'es_mx_pop' => "Mexicano a lo güey", |
|
| 66 | - 'et' => "eesti", |
|
| 67 | - 'eu' => "euskara", |
|
| 68 | - 'fa' => "فارسى", |
|
| 69 | - 'ff' => "Fulah", // peul |
|
| 70 | - 'fi' => "suomi", |
|
| 71 | - 'fj' => "Fiji", |
|
| 72 | - 'fo' => "føroyskt", |
|
| 73 | - 'fon' => "fongbè", |
|
| 74 | - 'fr' => "français", |
|
| 75 | - 'fr_fem' => "français féminin", |
|
| 76 | - 'fr_sc' => "schtroumpf", |
|
| 77 | - 'fr_lpc' => "langue parlée complétée", |
|
| 78 | - 'fr_lsf' => "langue des signes française", |
|
| 79 | - 'fr_spl' => "français simplifié", |
|
| 80 | - 'fr_tu' => "français copain", |
|
| 81 | - 'fy' => "Frisian", |
|
| 82 | - 'ga' => "Irish", |
|
| 83 | - 'gd' => "Scots Gaelic", |
|
| 84 | - 'gl' => "galego", |
|
| 85 | - 'gn' => "Guarani", |
|
| 86 | - 'grc' => "Ἀρχαία Ἑλληνική", // grec ancien |
|
| 87 | - 'gu' => "Gujarati", |
|
| 88 | - 'ha' => "Hausa", |
|
| 89 | - 'hac' => "ک-هۆرامی", //"Kurdish-Horami" |
|
| 90 | - 'hbo' => "עברית־התנך", // hebreu classique ou biblique |
|
| 91 | - 'haz' => "هزاره گی", |
|
| 92 | - 'he' => "עברית", |
|
| 93 | - 'hi' => "हिंदी", |
|
| 94 | - 'hr' => "hrvatski", |
|
| 95 | - 'hu' => "magyar", |
|
| 96 | - 'hy' => "Հայերեն",// Arménien |
|
| 97 | - 'ia' => "Interlingua", |
|
| 98 | - 'id' => "Indonesia", |
|
| 99 | - 'ie' => "Interlingue", |
|
| 100 | - 'ik' => "Inupiak", |
|
| 101 | - 'is' => "íslenska", |
|
| 102 | - 'it' => "italiano", |
|
| 103 | - 'it_fem' => "italiana", |
|
| 104 | - 'iu' => "Inuktitut", |
|
| 105 | - 'ja' => "日本語", |
|
| 106 | - 'jv' => "Javanese", |
|
| 107 | - 'ka' => "ქართული", |
|
| 108 | - 'kk' => "қазақ тілі", // Kazakh |
|
| 109 | - 'kl' => "kalaallisut", |
|
| 110 | - 'km' => "ភាសាខ្មែរ",// Khmer |
|
| 111 | - 'kn' => "Kannada", |
|
| 112 | - 'ko' => "한국어", |
|
| 113 | - 'kok' => "कोंकणी", |
|
| 114 | - 'ks' => "Kashmiri", |
|
| 115 | - 'ku' => "کوردی", |
|
| 116 | - 'ky' => "Kirghiz", |
|
| 117 | - 'la' => "lingua latina", |
|
| 118 | - 'lb' => "Lëtzebuergesch", |
|
| 119 | - 'ln' => "Lingala", |
|
| 120 | - 'lo' => "ພາສາລາວ", # lao |
|
| 121 | - 'lt' => "lietuvių", |
|
| 122 | - 'lu' => "luba-katanga", |
|
| 123 | - 'lv' => "latviešu", |
|
| 124 | - 'man' => "mandingue", # a traduire en mandingue |
|
| 125 | - 'mfv' => "manjak", # ISO-639-3 |
|
| 126 | - 'mg' => "Malagasy", |
|
| 127 | - 'mi' => "Maori", |
|
| 128 | - 'mk' => "македонски јазик", |
|
| 129 | - 'ml' => "Malayalam", |
|
| 130 | - 'mn' => "Монгол хэл", |
|
| 131 | - 'mo' => "Moldavian", |
|
| 132 | - 'mos' => "Moré", |
|
| 133 | - 'mr' => "मराठी", |
|
| 134 | - 'ms' => "Bahasa Malaysia", |
|
| 135 | - 'mt' => "Maltese", |
|
| 136 | - 'my' => "Burmese", |
|
| 137 | - 'na' => "Nauru", |
|
| 138 | - 'nap' => "napulitano", |
|
| 139 | - 'ne' => "Nepali", |
|
| 140 | - 'nqo' => "N'ko", // www.manden.org |
|
| 141 | - 'nl' => "Nederlands", |
|
| 142 | - 'no' => "norsk", |
|
| 143 | - 'nb' => "norsk bokmål", |
|
| 144 | - 'nn' => "norsk nynorsk", |
|
| 145 | - 'oc' => "òc", |
|
| 146 | - 'oc_lnc' => "òc lengadocian", |
|
| 147 | - 'oc_ni' => "òc niçard", |
|
| 148 | - 'oc_ni_la' => "òc niçard (larg)", |
|
| 149 | - 'oc_ni_mis' => "òc nissart (mistralenc)", |
|
| 150 | - 'oc_prv' => "òc provençau", |
|
| 151 | - 'oc_gsc' => "òc gascon", |
|
| 152 | - 'oc_lms' => "òc lemosin", |
|
| 153 | - 'oc_auv' => "òc auvernhat", |
|
| 154 | - 'oc_va' => "òc vivaroaupenc", |
|
| 155 | - 'om' => "(Afan) Oromo", |
|
| 156 | - 'or' => "Oriya", |
|
| 157 | - 'pa' => "Punjabi", |
|
| 158 | - 'pbb' => 'Nasa Yuwe', |
|
| 159 | - 'pl' => "polski", |
|
| 160 | - 'prs' => "دری", // ISO-639-3 Dari (Afghanistan) |
|
| 161 | - 'ps' => "پښتو", |
|
| 162 | - 'pt' => "Português", |
|
| 163 | - 'pt_br' => "Português do Brasil", |
|
| 164 | - 'qu' => "Quechua", |
|
| 165 | - 'rm' => "Rhaeto-Romance", |
|
| 166 | - 'rn' => "Kirundi", |
|
| 167 | - 'ro' => "română", |
|
| 168 | - 'roa' => "ch'ti", |
|
| 169 | - 'ru' => "русский", |
|
| 170 | - 'rw' => "Kinyarwanda", |
|
| 171 | - 'sa' => "संस्कृत", |
|
| 172 | - 'sc' => "sardu", |
|
| 173 | - 'scn' => "sicilianu", |
|
| 174 | - 'sd' => "Sindhi", |
|
| 175 | - 'sg' => "Sangho", |
|
| 176 | - 'sh' => "srpskohrvastski", |
|
| 177 | - 'sh_latn' => 'srpskohrvastski', |
|
| 178 | - 'sh_cyrl' => 'Српскохрватски', |
|
| 179 | - 'si' => "Sinhalese", |
|
| 180 | - 'sk' => "slovenčina", // (Slovakia) |
|
| 181 | - 'sl' => "slovenščina", // (Slovenia) |
|
| 182 | - 'sm' => "Samoan", |
|
| 183 | - 'sn' => "Shona", |
|
| 184 | - 'so' => "Somali", |
|
| 185 | - 'sq' => "shqip", |
|
| 186 | - 'sr' => "српски", |
|
| 187 | - 'src' => 'sardu logudorésu', // sarde cf 'sc' |
|
| 188 | - 'sro' => 'sardu campidanésu', |
|
| 189 | - 'ss' => "Siswati", |
|
| 190 | - 'st' => "Sesotho", |
|
| 191 | - 'su' => "Sundanese", |
|
| 192 | - 'sv' => "svenska", |
|
| 193 | - 'sw' => "Kiswahili", |
|
| 194 | - 'ta' => "தமிழ்", // Tamil |
|
| 195 | - 'te' => "Telugu", |
|
| 196 | - 'tg' => "Tajik", |
|
| 197 | - 'th' => "ไทย", |
|
| 198 | - 'ti' => "Tigrinya", |
|
| 199 | - 'tk' => "Turkmen", |
|
| 200 | - 'tl' => "Tagalog", |
|
| 201 | - 'tn' => "Setswana", |
|
| 202 | - 'to' => "Tonga", |
|
| 203 | - 'tr' => "Türkçe", |
|
| 204 | - 'ts' => "Tsonga", |
|
| 205 | - 'tt' => "Татар", |
|
| 206 | - 'tw' => "Twi", |
|
| 207 | - 'ty' => "reo mā`ohi", // tahitien |
|
| 208 | - 'ug' => "Uighur", |
|
| 209 | - 'uk' => "українська", |
|
| 210 | - 'ur' => "ٱردو", |
|
| 211 | - 'uz' => "O'zbekcha", |
|
| 212 | - 'vi' => "Tiếng Việt", |
|
| 213 | - 'vo' => "Volapuk", |
|
| 214 | - 'wa' => "walon", |
|
| 215 | - 'wo' => "Wolof", |
|
| 216 | - 'xh' => "Xhosa", |
|
| 217 | - 'yi' => "Yiddish", |
|
| 218 | - 'yo' => "Yoruba", |
|
| 219 | - 'za' => "Zhuang", |
|
| 220 | - 'zh' => "中文", // chinois (ecriture simplifiee) |
|
| 221 | - 'zh_tw' => "台灣中文", // chinois taiwan (ecr. traditionnelle) |
|
| 222 | - 'zu' => "Zulu" |
|
| 26 | + 'aa' => "Afar", |
|
| 27 | + 'ab' => "Abkhazian", |
|
| 28 | + 'af' => "Afrikaans", |
|
| 29 | + 'am' => "Amharic", |
|
| 30 | + 'an' => "Aragonés", |
|
| 31 | + 'ar' => "عربي", |
|
| 32 | + 'as' => "Assamese", |
|
| 33 | + 'ast' => "asturianu", |
|
| 34 | + 'ay' => "Aymara", |
|
| 35 | + 'az' => "Azərbaycan dili", |
|
| 36 | + 'ba' => "Bashkir", |
|
| 37 | + 'be' => "Беларуская", |
|
| 38 | + 'ber_tam' => "Tamazigh", |
|
| 39 | + 'ber_tam_tfng' => "Tamazigh tifinagh", |
|
| 40 | + 'bg' => "български", |
|
| 41 | + 'bh' => "Bihari", |
|
| 42 | + 'bi' => "Bislama", |
|
| 43 | + 'bm' => "Bambara", |
|
| 44 | + 'bn' => "Bengali; Bangla", |
|
| 45 | + 'bo' => "Tibetan", |
|
| 46 | + 'br' => "brezhoneg", |
|
| 47 | + 'bs' => "bosanski", |
|
| 48 | + 'ca' => "català", |
|
| 49 | + 'co' => "corsu", |
|
| 50 | + 'cpf' => "Kréol réyoné", |
|
| 51 | + 'cpf_dom' => "Kreyòl", |
|
| 52 | + 'cpf_hat' => "Kreyòl (Peyi Dayiti)", |
|
| 53 | + 'cs' => "čeština", |
|
| 54 | + 'cy' => "Cymraeg", # welsh, gallois |
|
| 55 | + 'da' => "dansk", |
|
| 56 | + 'de' => "Deutsch", |
|
| 57 | + 'dz' => "Bhutani", |
|
| 58 | + 'el' => "ελληνικά", |
|
| 59 | + 'en' => "English", |
|
| 60 | + 'en_hx' => "H4ck3R", |
|
| 61 | + 'en_sm' => "Smurf", |
|
| 62 | + 'eo' => "Esperanto", |
|
| 63 | + 'es' => "Español", |
|
| 64 | + 'es_co' => "Colombiano", |
|
| 65 | + 'es_mx_pop' => "Mexicano a lo güey", |
|
| 66 | + 'et' => "eesti", |
|
| 67 | + 'eu' => "euskara", |
|
| 68 | + 'fa' => "فارسى", |
|
| 69 | + 'ff' => "Fulah", // peul |
|
| 70 | + 'fi' => "suomi", |
|
| 71 | + 'fj' => "Fiji", |
|
| 72 | + 'fo' => "føroyskt", |
|
| 73 | + 'fon' => "fongbè", |
|
| 74 | + 'fr' => "français", |
|
| 75 | + 'fr_fem' => "français féminin", |
|
| 76 | + 'fr_sc' => "schtroumpf", |
|
| 77 | + 'fr_lpc' => "langue parlée complétée", |
|
| 78 | + 'fr_lsf' => "langue des signes française", |
|
| 79 | + 'fr_spl' => "français simplifié", |
|
| 80 | + 'fr_tu' => "français copain", |
|
| 81 | + 'fy' => "Frisian", |
|
| 82 | + 'ga' => "Irish", |
|
| 83 | + 'gd' => "Scots Gaelic", |
|
| 84 | + 'gl' => "galego", |
|
| 85 | + 'gn' => "Guarani", |
|
| 86 | + 'grc' => "Ἀρχαία Ἑλληνική", // grec ancien |
|
| 87 | + 'gu' => "Gujarati", |
|
| 88 | + 'ha' => "Hausa", |
|
| 89 | + 'hac' => "ک-هۆرامی", //"Kurdish-Horami" |
|
| 90 | + 'hbo' => "עברית־התנך", // hebreu classique ou biblique |
|
| 91 | + 'haz' => "هزاره گی", |
|
| 92 | + 'he' => "עברית", |
|
| 93 | + 'hi' => "हिंदी", |
|
| 94 | + 'hr' => "hrvatski", |
|
| 95 | + 'hu' => "magyar", |
|
| 96 | + 'hy' => "Հայերեն",// Arménien |
|
| 97 | + 'ia' => "Interlingua", |
|
| 98 | + 'id' => "Indonesia", |
|
| 99 | + 'ie' => "Interlingue", |
|
| 100 | + 'ik' => "Inupiak", |
|
| 101 | + 'is' => "íslenska", |
|
| 102 | + 'it' => "italiano", |
|
| 103 | + 'it_fem' => "italiana", |
|
| 104 | + 'iu' => "Inuktitut", |
|
| 105 | + 'ja' => "日本語", |
|
| 106 | + 'jv' => "Javanese", |
|
| 107 | + 'ka' => "ქართული", |
|
| 108 | + 'kk' => "қазақ тілі", // Kazakh |
|
| 109 | + 'kl' => "kalaallisut", |
|
| 110 | + 'km' => "ភាសាខ្មែរ",// Khmer |
|
| 111 | + 'kn' => "Kannada", |
|
| 112 | + 'ko' => "한국어", |
|
| 113 | + 'kok' => "कोंकणी", |
|
| 114 | + 'ks' => "Kashmiri", |
|
| 115 | + 'ku' => "کوردی", |
|
| 116 | + 'ky' => "Kirghiz", |
|
| 117 | + 'la' => "lingua latina", |
|
| 118 | + 'lb' => "Lëtzebuergesch", |
|
| 119 | + 'ln' => "Lingala", |
|
| 120 | + 'lo' => "ພາສາລາວ", # lao |
|
| 121 | + 'lt' => "lietuvių", |
|
| 122 | + 'lu' => "luba-katanga", |
|
| 123 | + 'lv' => "latviešu", |
|
| 124 | + 'man' => "mandingue", # a traduire en mandingue |
|
| 125 | + 'mfv' => "manjak", # ISO-639-3 |
|
| 126 | + 'mg' => "Malagasy", |
|
| 127 | + 'mi' => "Maori", |
|
| 128 | + 'mk' => "македонски јазик", |
|
| 129 | + 'ml' => "Malayalam", |
|
| 130 | + 'mn' => "Монгол хэл", |
|
| 131 | + 'mo' => "Moldavian", |
|
| 132 | + 'mos' => "Moré", |
|
| 133 | + 'mr' => "मराठी", |
|
| 134 | + 'ms' => "Bahasa Malaysia", |
|
| 135 | + 'mt' => "Maltese", |
|
| 136 | + 'my' => "Burmese", |
|
| 137 | + 'na' => "Nauru", |
|
| 138 | + 'nap' => "napulitano", |
|
| 139 | + 'ne' => "Nepali", |
|
| 140 | + 'nqo' => "N'ko", // www.manden.org |
|
| 141 | + 'nl' => "Nederlands", |
|
| 142 | + 'no' => "norsk", |
|
| 143 | + 'nb' => "norsk bokmål", |
|
| 144 | + 'nn' => "norsk nynorsk", |
|
| 145 | + 'oc' => "òc", |
|
| 146 | + 'oc_lnc' => "òc lengadocian", |
|
| 147 | + 'oc_ni' => "òc niçard", |
|
| 148 | + 'oc_ni_la' => "òc niçard (larg)", |
|
| 149 | + 'oc_ni_mis' => "òc nissart (mistralenc)", |
|
| 150 | + 'oc_prv' => "òc provençau", |
|
| 151 | + 'oc_gsc' => "òc gascon", |
|
| 152 | + 'oc_lms' => "òc lemosin", |
|
| 153 | + 'oc_auv' => "òc auvernhat", |
|
| 154 | + 'oc_va' => "òc vivaroaupenc", |
|
| 155 | + 'om' => "(Afan) Oromo", |
|
| 156 | + 'or' => "Oriya", |
|
| 157 | + 'pa' => "Punjabi", |
|
| 158 | + 'pbb' => 'Nasa Yuwe', |
|
| 159 | + 'pl' => "polski", |
|
| 160 | + 'prs' => "دری", // ISO-639-3 Dari (Afghanistan) |
|
| 161 | + 'ps' => "پښتو", |
|
| 162 | + 'pt' => "Português", |
|
| 163 | + 'pt_br' => "Português do Brasil", |
|
| 164 | + 'qu' => "Quechua", |
|
| 165 | + 'rm' => "Rhaeto-Romance", |
|
| 166 | + 'rn' => "Kirundi", |
|
| 167 | + 'ro' => "română", |
|
| 168 | + 'roa' => "ch'ti", |
|
| 169 | + 'ru' => "русский", |
|
| 170 | + 'rw' => "Kinyarwanda", |
|
| 171 | + 'sa' => "संस्कृत", |
|
| 172 | + 'sc' => "sardu", |
|
| 173 | + 'scn' => "sicilianu", |
|
| 174 | + 'sd' => "Sindhi", |
|
| 175 | + 'sg' => "Sangho", |
|
| 176 | + 'sh' => "srpskohrvastski", |
|
| 177 | + 'sh_latn' => 'srpskohrvastski', |
|
| 178 | + 'sh_cyrl' => 'Српскохрватски', |
|
| 179 | + 'si' => "Sinhalese", |
|
| 180 | + 'sk' => "slovenčina", // (Slovakia) |
|
| 181 | + 'sl' => "slovenščina", // (Slovenia) |
|
| 182 | + 'sm' => "Samoan", |
|
| 183 | + 'sn' => "Shona", |
|
| 184 | + 'so' => "Somali", |
|
| 185 | + 'sq' => "shqip", |
|
| 186 | + 'sr' => "српски", |
|
| 187 | + 'src' => 'sardu logudorésu', // sarde cf 'sc' |
|
| 188 | + 'sro' => 'sardu campidanésu', |
|
| 189 | + 'ss' => "Siswati", |
|
| 190 | + 'st' => "Sesotho", |
|
| 191 | + 'su' => "Sundanese", |
|
| 192 | + 'sv' => "svenska", |
|
| 193 | + 'sw' => "Kiswahili", |
|
| 194 | + 'ta' => "தமிழ்", // Tamil |
|
| 195 | + 'te' => "Telugu", |
|
| 196 | + 'tg' => "Tajik", |
|
| 197 | + 'th' => "ไทย", |
|
| 198 | + 'ti' => "Tigrinya", |
|
| 199 | + 'tk' => "Turkmen", |
|
| 200 | + 'tl' => "Tagalog", |
|
| 201 | + 'tn' => "Setswana", |
|
| 202 | + 'to' => "Tonga", |
|
| 203 | + 'tr' => "Türkçe", |
|
| 204 | + 'ts' => "Tsonga", |
|
| 205 | + 'tt' => "Татар", |
|
| 206 | + 'tw' => "Twi", |
|
| 207 | + 'ty' => "reo mā`ohi", // tahitien |
|
| 208 | + 'ug' => "Uighur", |
|
| 209 | + 'uk' => "українська", |
|
| 210 | + 'ur' => "ٱردو", |
|
| 211 | + 'uz' => "O'zbekcha", |
|
| 212 | + 'vi' => "Tiếng Việt", |
|
| 213 | + 'vo' => "Volapuk", |
|
| 214 | + 'wa' => "walon", |
|
| 215 | + 'wo' => "Wolof", |
|
| 216 | + 'xh' => "Xhosa", |
|
| 217 | + 'yi' => "Yiddish", |
|
| 218 | + 'yo' => "Yoruba", |
|
| 219 | + 'za' => "Zhuang", |
|
| 220 | + 'zh' => "中文", // chinois (ecriture simplifiee) |
|
| 221 | + 'zh_tw' => "台灣中文", // chinois taiwan (ecr. traditionnelle) |
|
| 222 | + 'zu' => "Zulu" |
|
| 223 | 223 | |
| 224 | 224 | ); |
@@ -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 | /** |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * Pile complétée du code compilé |
| 37 | 37 | **/ |
| 38 | 38 | function balise_URL_LOGOUT($p) { |
| 39 | - return calculer_balise_dynamique($p, 'URL_LOGOUT', array()); |
|
| 39 | + return calculer_balise_dynamique($p, 'URL_LOGOUT', array()); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | * Liste (url) des arguments collectés. |
| 53 | 53 | */ |
| 54 | 54 | function balise_URL_LOGOUT_stat($args, $context_compil) { |
| 55 | - $url = isset($args[0]) ? $args[0] : ''; |
|
| 55 | + $url = isset($args[0]) ? $args[0] : ''; |
|
| 56 | 56 | |
| 57 | - return array($url); |
|
| 57 | + return array($url); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | **/ |
| 70 | 70 | function balise_URL_LOGOUT_dyn($cible) { |
| 71 | 71 | |
| 72 | - if (empty($GLOBALS['visiteur_session']['login']) and empty($GLOBALS['visiteur_session']['statut'])) { |
|
| 73 | - return ''; |
|
| 74 | - } |
|
| 72 | + if (empty($GLOBALS['visiteur_session']['login']) and empty($GLOBALS['visiteur_session']['statut'])) { |
|
| 73 | + return ''; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - return generer_url_action('logout', "logout=public&url=" . rawurlencode($cible ? $cible : self('&'))); |
|
| 76 | + return generer_url_action('logout', "logout=public&url=" . rawurlencode($cible ? $cible : self('&'))); |
|
| 77 | 77 | } |