@@ -93,7 +93,7 @@ |
||
| 93 | 93 | |
| 94 | 94 | $res = ltrim($res['texte']); |
| 95 | 95 | if (empty($res)) { |
| 96 | - spip_log("$arg $qs resultat vide", 'transmettre' . _LOG_INFO_IMPORTANTE); |
|
| 96 | + spip_log("$arg $qs resultat vide", 'transmettre'._LOG_INFO_IMPORTANTE); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | echo $res; |
@@ -17,92 +17,92 @@ |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | function action_api_transmettre_dist($arg = null) { |
| 25 | 25 | |
| 26 | - // Obtenir l'argument 'id_auteur/cle/format/fond' |
|
| 27 | - if (is_null($arg)) { |
|
| 28 | - $arg = _request('arg'); |
|
| 29 | - } |
|
| 30 | - |
|
| 31 | - $args = explode('/', $arg); |
|
| 32 | - |
|
| 33 | - if (count($args) !== 4) { |
|
| 34 | - action_api_transmettre_fail($arg); |
|
| 35 | - } |
|
| 36 | - |
|
| 37 | - [$id_auteur, $cle, $format, $fond] = $args; |
|
| 38 | - $id_auteur = intval($id_auteur); |
|
| 39 | - |
|
| 40 | - if (preg_match(',[^\w\\.-],', $format)) { |
|
| 41 | - action_api_transmettre_fail("format $format ??"); |
|
| 42 | - } |
|
| 43 | - if (preg_match(',[^\w\\.-],', $fond)) { |
|
| 44 | - action_api_transmettre_fail("fond $fond ??"); |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - // verifier la cle |
|
| 48 | - //[(#ENV{id,0}|securiser_acces{#ENV{cle}, voirstats, #ENV{op}, #ENV{args}}|?{1,0})] |
|
| 49 | - //[(#ENV{id,0}|securiser_acces{#ENV{cle}, voirstats, #ENV{op}, #ENV{args}}|?{1,0})] |
|
| 50 | - |
|
| 51 | - $qs = $_SERVER['QUERY_STRING']; |
|
| 52 | - // retirer action et arg de la qs |
|
| 53 | - $contexte = []; |
|
| 54 | - parse_str($qs, $contexte); |
|
| 55 | - foreach ($contexte as $k => $v) { |
|
| 56 | - if (in_array($k, ['action', 'arg', 'var_mode'])) { |
|
| 57 | - unset($contexte[$k]); |
|
| 58 | - } |
|
| 59 | - } |
|
| 60 | - $qs = http_build_query($contexte); |
|
| 61 | - include_spip('inc/acces'); |
|
| 62 | - if (!securiser_acces_low_sec(intval($id_auteur), $cle, "transmettre/$format", $fond, $qs)) { |
|
| 63 | - // si le autoriser low_sec n'est pas bon, on peut valider l'appel si l'auteur est identifie |
|
| 64 | - include_spip('inc/autoriser'); |
|
| 65 | - $autoriser_type = preg_replace(',\W+,', '', "_{$format}{$fond}"); |
|
| 66 | - if ( |
|
| 67 | - !$id_auteur |
|
| 68 | - or empty($GLOBALS['visiteur_session']['id_auteur']) |
|
| 69 | - or $GLOBALS['visiteur_session']['id_auteur'] != $id_auteur |
|
| 70 | - or !autoriser('transmettre', $autoriser_type, $id_auteur) |
|
| 71 | - ) { |
|
| 72 | - action_api_transmettre_fail("auth QS $qs ??"); |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - $contexte['id_auteur'] = $id_auteur; |
|
| 77 | - |
|
| 78 | - $fond = "transmettre/$format/$fond"; |
|
| 79 | - |
|
| 80 | - if (!trouver_fond($fond)) { |
|
| 81 | - $fond = "prive/$fond"; |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - if (!trouver_fond($fond)) { |
|
| 85 | - action_api_transmettre_fail("fond $fond ??"); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - $res = recuperer_fond($fond, $contexte, ['raw' => true]); |
|
| 89 | - if (!empty($res['entetes'])) { |
|
| 90 | - foreach ($res['entetes'] as $h => $v) { |
|
| 91 | - header("$h: $v"); |
|
| 92 | - } |
|
| 93 | - } |
|
| 94 | - |
|
| 95 | - $res = ltrim($res['texte']); |
|
| 96 | - if (empty($res)) { |
|
| 97 | - spip_log("$arg $qs resultat vide", 'transmettre' . _LOG_INFO_IMPORTANTE); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - echo $res; |
|
| 101 | - exit(); |
|
| 26 | + // Obtenir l'argument 'id_auteur/cle/format/fond' |
|
| 27 | + if (is_null($arg)) { |
|
| 28 | + $arg = _request('arg'); |
|
| 29 | + } |
|
| 30 | + |
|
| 31 | + $args = explode('/', $arg); |
|
| 32 | + |
|
| 33 | + if (count($args) !== 4) { |
|
| 34 | + action_api_transmettre_fail($arg); |
|
| 35 | + } |
|
| 36 | + |
|
| 37 | + [$id_auteur, $cle, $format, $fond] = $args; |
|
| 38 | + $id_auteur = intval($id_auteur); |
|
| 39 | + |
|
| 40 | + if (preg_match(',[^\w\\.-],', $format)) { |
|
| 41 | + action_api_transmettre_fail("format $format ??"); |
|
| 42 | + } |
|
| 43 | + if (preg_match(',[^\w\\.-],', $fond)) { |
|
| 44 | + action_api_transmettre_fail("fond $fond ??"); |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + // verifier la cle |
|
| 48 | + //[(#ENV{id,0}|securiser_acces{#ENV{cle}, voirstats, #ENV{op}, #ENV{args}}|?{1,0})] |
|
| 49 | + //[(#ENV{id,0}|securiser_acces{#ENV{cle}, voirstats, #ENV{op}, #ENV{args}}|?{1,0})] |
|
| 50 | + |
|
| 51 | + $qs = $_SERVER['QUERY_STRING']; |
|
| 52 | + // retirer action et arg de la qs |
|
| 53 | + $contexte = []; |
|
| 54 | + parse_str($qs, $contexte); |
|
| 55 | + foreach ($contexte as $k => $v) { |
|
| 56 | + if (in_array($k, ['action', 'arg', 'var_mode'])) { |
|
| 57 | + unset($contexte[$k]); |
|
| 58 | + } |
|
| 59 | + } |
|
| 60 | + $qs = http_build_query($contexte); |
|
| 61 | + include_spip('inc/acces'); |
|
| 62 | + if (!securiser_acces_low_sec(intval($id_auteur), $cle, "transmettre/$format", $fond, $qs)) { |
|
| 63 | + // si le autoriser low_sec n'est pas bon, on peut valider l'appel si l'auteur est identifie |
|
| 64 | + include_spip('inc/autoriser'); |
|
| 65 | + $autoriser_type = preg_replace(',\W+,', '', "_{$format}{$fond}"); |
|
| 66 | + if ( |
|
| 67 | + !$id_auteur |
|
| 68 | + or empty($GLOBALS['visiteur_session']['id_auteur']) |
|
| 69 | + or $GLOBALS['visiteur_session']['id_auteur'] != $id_auteur |
|
| 70 | + or !autoriser('transmettre', $autoriser_type, $id_auteur) |
|
| 71 | + ) { |
|
| 72 | + action_api_transmettre_fail("auth QS $qs ??"); |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + $contexte['id_auteur'] = $id_auteur; |
|
| 77 | + |
|
| 78 | + $fond = "transmettre/$format/$fond"; |
|
| 79 | + |
|
| 80 | + if (!trouver_fond($fond)) { |
|
| 81 | + $fond = "prive/$fond"; |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + if (!trouver_fond($fond)) { |
|
| 85 | + action_api_transmettre_fail("fond $fond ??"); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + $res = recuperer_fond($fond, $contexte, ['raw' => true]); |
|
| 89 | + if (!empty($res['entetes'])) { |
|
| 90 | + foreach ($res['entetes'] as $h => $v) { |
|
| 91 | + header("$h: $v"); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | + |
|
| 95 | + $res = ltrim($res['texte']); |
|
| 96 | + if (empty($res)) { |
|
| 97 | + spip_log("$arg $qs resultat vide", 'transmettre' . _LOG_INFO_IMPORTANTE); |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + echo $res; |
|
| 101 | + exit(); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | function action_api_transmettre_fail($arg) { |
| 105 | - include_spip('inc/minipres'); |
|
| 106 | - echo minipres(_T('info_acces_interdit'), $arg); |
|
| 107 | - exit; |
|
| 105 | + include_spip('inc/minipres'); |
|
| 106 | + echo minipres(_T('info_acces_interdit'), $arg); |
|
| 107 | + exit; |
|
| 108 | 108 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | 19 | return; |
| 20 | 20 | } |
| 21 | -require_once _ROOT_RESTREINT . 'base/objets.php'; |
|
| 21 | +require_once _ROOT_RESTREINT.'base/objets.php'; |
|
| 22 | 22 | |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | $f = (!preg_match('/^[\w\.]*$/', $serveur)) |
| 60 | 60 | ? '' // nom de serveur mal ecrit |
| 61 | 61 | : ($serveur ? |
| 62 | - (_DIR_CONNECT . $serveur . '.php') // serveur externe |
|
| 62 | + (_DIR_CONNECT.$serveur.'.php') // serveur externe |
|
| 63 | 63 | : (_FILE_CONNECT ?: ($install ? _FILE_CONNECT_TMP // init du serveur principal |
| 64 | 64 | : ''))); // installation pas faite |
| 65 | 65 | |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | // chargement de la version du jeu de fonctions |
| 102 | 102 | // si pas dans le fichier par defaut |
| 103 | 103 | $type = $GLOBALS['db_ok']['type']; |
| 104 | - $jeu = 'spip_' . $type . '_functions_' . $version; |
|
| 104 | + $jeu = 'spip_'.$type.'_functions_'.$version; |
|
| 105 | 105 | if (!isset($GLOBALS[$jeu])) { |
| 106 | - if (!find_in_path($type . '_' . $version . '.php', 'req/', true)) { |
|
| 106 | + if (!find_in_path($type.'_'.$version.'.php', 'req/', true)) { |
|
| 107 | 107 | spip_log("spip_connect: serveur $index version '$version' non defini pour '$type'", _LOG_HS); |
| 108 | 108 | |
| 109 | 109 | // ne plus reessayer |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | $connexion = spip_connect($serveur); |
| 166 | 166 | $e = sql_errno($serveur); |
| 167 | 167 | $t = ($connexion['type'] ?? 'sql'); |
| 168 | - $m = "Erreur $e de $t: " . sql_error($serveur) . "\nin " . sql_error_backtrace() . "\n" . trim($connexion['last']); |
|
| 169 | - $f = $t . $serveur; |
|
| 170 | - spip_log($m, $f . '.' . _LOG_ERREUR); |
|
| 168 | + $m = "Erreur $e de $t: ".sql_error($serveur)."\nin ".sql_error_backtrace()."\n".trim($connexion['last']); |
|
| 169 | + $f = $t.$serveur; |
|
| 170 | + spip_log($m, $f.'.'._LOG_ERREUR); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | // si en cours d'installation ou si db=@test@ on ne pose rien |
| 254 | 254 | // car c'est un test de connexion |
| 255 | 255 | if (!defined('_ECRIRE_INSTALL') and $db !== '@test@') { |
| 256 | - $f = _DIR_TMP . $type . '.' . substr(md5($host . $port . $db), 0, 8) . '.out'; |
|
| 256 | + $f = _DIR_TMP.$type.'.'.substr(md5($host.$port.$db), 0, 8).'.out'; |
|
| 257 | 257 | } elseif ($db == '@test@') { |
| 258 | 258 | $db = ''; |
| 259 | 259 | } |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | // En cas d'indisponibilite du serveur, eviter de le bombarder |
| 293 | 293 | if ($f) { |
| 294 | 294 | @touch($f); |
| 295 | - spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type . '.' . _LOG_HS); |
|
| 295 | + spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type.'.'._LOG_HS); |
|
| 296 | 296 | } |
| 297 | 297 | return null; |
| 298 | 298 | } |
@@ -390,11 +390,11 @@ discard block |
||
| 390 | 390 | } elseif (is_array($a)) { |
| 391 | 391 | return join(',', array_map('_q', $a)); |
| 392 | 392 | } elseif (is_scalar($a)) { |
| 393 | - return ("'" . addslashes($a) . "'"); |
|
| 393 | + return ("'".addslashes($a)."'"); |
|
| 394 | 394 | } elseif ($a === null) { |
| 395 | 395 | return "''"; |
| 396 | 396 | } |
| 397 | - throw new \RuntimeException('Can’t use _q with ' . gettype($a)); |
|
| 397 | + throw new \RuntimeException('Can’t use _q with '.gettype($a)); |
|
| 398 | 398 | } |
| 399 | 399 | |
| 400 | 400 | /** |
@@ -445,7 +445,7 @@ discard block |
||
| 445 | 445 | $next = reset($textes); |
| 446 | 446 | if ( |
| 447 | 447 | strpos($next, "'") === 0 |
| 448 | - and strpos($query_echappees, $part . $next, $currentpos) === $nextpos |
|
| 448 | + and strpos($query_echappees, $part.$next, $currentpos) === $nextpos |
|
| 449 | 449 | ) { |
| 450 | 450 | $part .= array_shift($textes); |
| 451 | 451 | } |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | $parts[$k] = [ |
| 458 | 458 | 'texte' => $part, |
| 459 | 459 | 'position' => $nextpos, |
| 460 | - 'placeholder' => '%' . $k . '$s', |
|
| 460 | + 'placeholder' => '%'.$k.'$s', |
|
| 461 | 461 | ]; |
| 462 | 462 | $currentpos = $nextpos + strlen($part); |
| 463 | 463 | } |
@@ -448,8 +448,7 @@ |
||
| 448 | 448 | and strpos($query_echappees, $part . $next, $currentpos) === $nextpos |
| 449 | 449 | ) { |
| 450 | 450 | $part .= array_shift($textes); |
| 451 | - } |
|
| 452 | - else { |
|
| 451 | + } else { |
|
| 453 | 452 | break; |
| 454 | 453 | } |
| 455 | 454 | } |
@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\SQL |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | require_once _ROOT_RESTREINT . 'base/objets.php'; |
| 22 | 22 | |
@@ -42,118 +42,118 @@ discard block |
||
| 42 | 42 | **/ |
| 43 | 43 | function spip_connect($serveur = '', $version = '') { |
| 44 | 44 | |
| 45 | - $serveur = !is_string($serveur) ? '' : strtolower($serveur); |
|
| 46 | - $index = $serveur ?: 0; |
|
| 47 | - if (!$version) { |
|
| 48 | - $version = $GLOBALS['spip_sql_version']; |
|
| 49 | - } |
|
| 50 | - if (isset($GLOBALS['connexions'][$index][$version])) { |
|
| 51 | - return $GLOBALS['connexions'][$index]; |
|
| 52 | - } |
|
| 53 | - |
|
| 54 | - include_spip('base/abstract_sql'); |
|
| 55 | - $install = (_request('exec') == 'install'); |
|
| 56 | - |
|
| 57 | - // Premiere connexion ? |
|
| 58 | - if (!($old = isset($GLOBALS['connexions'][$index]))) { |
|
| 59 | - $f = (!preg_match('/^[\w\.]*$/', $serveur)) |
|
| 60 | - ? '' // nom de serveur mal ecrit |
|
| 61 | - : ($serveur ? |
|
| 62 | - (_DIR_CONNECT . $serveur . '.php') // serveur externe |
|
| 63 | - : (_FILE_CONNECT ?: ($install ? _FILE_CONNECT_TMP // init du serveur principal |
|
| 64 | - : ''))); // installation pas faite |
|
| 65 | - |
|
| 66 | - unset($GLOBALS['db_ok']); |
|
| 67 | - unset($GLOBALS['spip_connect_version']); |
|
| 68 | - if ($f) { |
|
| 69 | - if (is_readable($f)) { |
|
| 70 | - include($f); |
|
| 71 | - } elseif ($serveur and !$install) { |
|
| 72 | - // chercher une declaration de serveur dans le path |
|
| 73 | - // qui pourra un jour servir a declarer des bases sqlite |
|
| 74 | - // par des plugins. Et sert aussi aux boucles POUR. |
|
| 75 | - find_in_path("$serveur.php", 'connect/', true); |
|
| 76 | - } |
|
| 77 | - } |
|
| 78 | - if (!isset($GLOBALS['db_ok'])) { |
|
| 79 | - // fera mieux la prochaine fois |
|
| 80 | - if ($install) { |
|
| 81 | - return false; |
|
| 82 | - } |
|
| 83 | - if ($f and is_readable($f)) { |
|
| 84 | - spip_log("spip_connect: fichier de connexion '$f' OK.", _LOG_INFO_IMPORTANTE); |
|
| 85 | - } else { |
|
| 86 | - spip_log("spip_connect: fichier de connexion '$f' non trouve", _LOG_INFO_IMPORTANTE); |
|
| 87 | - } |
|
| 88 | - spip_log("spip_connect: echec connexion ou serveur $index mal defini dans '$f'.", _LOG_HS); |
|
| 89 | - |
|
| 90 | - // ne plus reessayer si ce n'est pas l'install |
|
| 91 | - return $GLOBALS['connexions'][$index] = false; |
|
| 92 | - } |
|
| 93 | - $GLOBALS['connexions'][$index] = $GLOBALS['db_ok']; |
|
| 94 | - } |
|
| 95 | - // si la connexion a deja ete tentee mais a echoue, le dire! |
|
| 96 | - if (!$GLOBALS['connexions'][$index]) { |
|
| 97 | - return false; |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - // la connexion a reussi ou etait deja faite. |
|
| 101 | - // chargement de la version du jeu de fonctions |
|
| 102 | - // si pas dans le fichier par defaut |
|
| 103 | - $type = $GLOBALS['db_ok']['type']; |
|
| 104 | - $jeu = 'spip_' . $type . '_functions_' . $version; |
|
| 105 | - if (!isset($GLOBALS[$jeu])) { |
|
| 106 | - if (!find_in_path($type . '_' . $version . '.php', 'req/', true)) { |
|
| 107 | - spip_log("spip_connect: serveur $index version '$version' non defini pour '$type'", _LOG_HS); |
|
| 108 | - |
|
| 109 | - // ne plus reessayer |
|
| 110 | - return $GLOBALS['connexions'][$index][$version] = []; |
|
| 111 | - } |
|
| 112 | - } |
|
| 113 | - $GLOBALS['connexions'][$index][$version] = $GLOBALS[$jeu]; |
|
| 114 | - if ($old) { |
|
| 115 | - return $GLOBALS['connexions'][$index]; |
|
| 116 | - } |
|
| 117 | - |
|
| 118 | - $GLOBALS['connexions'][$index]['spip_connect_version'] = $GLOBALS['spip_connect_version'] ?? 0; |
|
| 119 | - |
|
| 120 | - // initialisation de l'alphabet utilise dans les connexions SQL |
|
| 121 | - // si l'installation l'a determine. |
|
| 122 | - // Celui du serveur principal l'impose aux serveurs secondaires |
|
| 123 | - // s'ils le connaissent |
|
| 124 | - |
|
| 125 | - if (!$serveur) { |
|
| 126 | - $charset = spip_connect_main($GLOBALS[$jeu], $GLOBALS['db_ok']['charset']); |
|
| 127 | - if (!$charset) { |
|
| 128 | - unset($GLOBALS['connexions'][$index]); |
|
| 129 | - spip_log('spip_connect: absence de charset', _LOG_AVERTISSEMENT); |
|
| 130 | - |
|
| 131 | - return false; |
|
| 132 | - } |
|
| 133 | - } else { |
|
| 134 | - if ($GLOBALS['db_ok']['charset']) { |
|
| 135 | - $charset = $GLOBALS['db_ok']['charset']; |
|
| 136 | - } |
|
| 137 | - // spip_meta n'existe pas toujours dans la base |
|
| 138 | - // C'est le cas d'un dump sqlite par exemple |
|
| 139 | - elseif ( |
|
| 140 | - $GLOBALS['connexions'][$index]['spip_connect_version'] |
|
| 141 | - and sql_showtable('spip_meta', true, $serveur) |
|
| 142 | - and $r = sql_getfetsel('valeur', 'spip_meta', "nom='charset_sql_connexion'", '', '', '', '', $serveur) |
|
| 143 | - ) { |
|
| 144 | - $charset = $r; |
|
| 145 | - } else { |
|
| 146 | - $charset = -1; |
|
| 147 | - } |
|
| 148 | - } |
|
| 149 | - if ($charset != -1) { |
|
| 150 | - $f = $GLOBALS[$jeu]['set_charset']; |
|
| 151 | - if (function_exists($f)) { |
|
| 152 | - $f($charset, $serveur); |
|
| 153 | - } |
|
| 154 | - } |
|
| 155 | - |
|
| 156 | - return $GLOBALS['connexions'][$index]; |
|
| 45 | + $serveur = !is_string($serveur) ? '' : strtolower($serveur); |
|
| 46 | + $index = $serveur ?: 0; |
|
| 47 | + if (!$version) { |
|
| 48 | + $version = $GLOBALS['spip_sql_version']; |
|
| 49 | + } |
|
| 50 | + if (isset($GLOBALS['connexions'][$index][$version])) { |
|
| 51 | + return $GLOBALS['connexions'][$index]; |
|
| 52 | + } |
|
| 53 | + |
|
| 54 | + include_spip('base/abstract_sql'); |
|
| 55 | + $install = (_request('exec') == 'install'); |
|
| 56 | + |
|
| 57 | + // Premiere connexion ? |
|
| 58 | + if (!($old = isset($GLOBALS['connexions'][$index]))) { |
|
| 59 | + $f = (!preg_match('/^[\w\.]*$/', $serveur)) |
|
| 60 | + ? '' // nom de serveur mal ecrit |
|
| 61 | + : ($serveur ? |
|
| 62 | + (_DIR_CONNECT . $serveur . '.php') // serveur externe |
|
| 63 | + : (_FILE_CONNECT ?: ($install ? _FILE_CONNECT_TMP // init du serveur principal |
|
| 64 | + : ''))); // installation pas faite |
|
| 65 | + |
|
| 66 | + unset($GLOBALS['db_ok']); |
|
| 67 | + unset($GLOBALS['spip_connect_version']); |
|
| 68 | + if ($f) { |
|
| 69 | + if (is_readable($f)) { |
|
| 70 | + include($f); |
|
| 71 | + } elseif ($serveur and !$install) { |
|
| 72 | + // chercher une declaration de serveur dans le path |
|
| 73 | + // qui pourra un jour servir a declarer des bases sqlite |
|
| 74 | + // par des plugins. Et sert aussi aux boucles POUR. |
|
| 75 | + find_in_path("$serveur.php", 'connect/', true); |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | + if (!isset($GLOBALS['db_ok'])) { |
|
| 79 | + // fera mieux la prochaine fois |
|
| 80 | + if ($install) { |
|
| 81 | + return false; |
|
| 82 | + } |
|
| 83 | + if ($f and is_readable($f)) { |
|
| 84 | + spip_log("spip_connect: fichier de connexion '$f' OK.", _LOG_INFO_IMPORTANTE); |
|
| 85 | + } else { |
|
| 86 | + spip_log("spip_connect: fichier de connexion '$f' non trouve", _LOG_INFO_IMPORTANTE); |
|
| 87 | + } |
|
| 88 | + spip_log("spip_connect: echec connexion ou serveur $index mal defini dans '$f'.", _LOG_HS); |
|
| 89 | + |
|
| 90 | + // ne plus reessayer si ce n'est pas l'install |
|
| 91 | + return $GLOBALS['connexions'][$index] = false; |
|
| 92 | + } |
|
| 93 | + $GLOBALS['connexions'][$index] = $GLOBALS['db_ok']; |
|
| 94 | + } |
|
| 95 | + // si la connexion a deja ete tentee mais a echoue, le dire! |
|
| 96 | + if (!$GLOBALS['connexions'][$index]) { |
|
| 97 | + return false; |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + // la connexion a reussi ou etait deja faite. |
|
| 101 | + // chargement de la version du jeu de fonctions |
|
| 102 | + // si pas dans le fichier par defaut |
|
| 103 | + $type = $GLOBALS['db_ok']['type']; |
|
| 104 | + $jeu = 'spip_' . $type . '_functions_' . $version; |
|
| 105 | + if (!isset($GLOBALS[$jeu])) { |
|
| 106 | + if (!find_in_path($type . '_' . $version . '.php', 'req/', true)) { |
|
| 107 | + spip_log("spip_connect: serveur $index version '$version' non defini pour '$type'", _LOG_HS); |
|
| 108 | + |
|
| 109 | + // ne plus reessayer |
|
| 110 | + return $GLOBALS['connexions'][$index][$version] = []; |
|
| 111 | + } |
|
| 112 | + } |
|
| 113 | + $GLOBALS['connexions'][$index][$version] = $GLOBALS[$jeu]; |
|
| 114 | + if ($old) { |
|
| 115 | + return $GLOBALS['connexions'][$index]; |
|
| 116 | + } |
|
| 117 | + |
|
| 118 | + $GLOBALS['connexions'][$index]['spip_connect_version'] = $GLOBALS['spip_connect_version'] ?? 0; |
|
| 119 | + |
|
| 120 | + // initialisation de l'alphabet utilise dans les connexions SQL |
|
| 121 | + // si l'installation l'a determine. |
|
| 122 | + // Celui du serveur principal l'impose aux serveurs secondaires |
|
| 123 | + // s'ils le connaissent |
|
| 124 | + |
|
| 125 | + if (!$serveur) { |
|
| 126 | + $charset = spip_connect_main($GLOBALS[$jeu], $GLOBALS['db_ok']['charset']); |
|
| 127 | + if (!$charset) { |
|
| 128 | + unset($GLOBALS['connexions'][$index]); |
|
| 129 | + spip_log('spip_connect: absence de charset', _LOG_AVERTISSEMENT); |
|
| 130 | + |
|
| 131 | + return false; |
|
| 132 | + } |
|
| 133 | + } else { |
|
| 134 | + if ($GLOBALS['db_ok']['charset']) { |
|
| 135 | + $charset = $GLOBALS['db_ok']['charset']; |
|
| 136 | + } |
|
| 137 | + // spip_meta n'existe pas toujours dans la base |
|
| 138 | + // C'est le cas d'un dump sqlite par exemple |
|
| 139 | + elseif ( |
|
| 140 | + $GLOBALS['connexions'][$index]['spip_connect_version'] |
|
| 141 | + and sql_showtable('spip_meta', true, $serveur) |
|
| 142 | + and $r = sql_getfetsel('valeur', 'spip_meta', "nom='charset_sql_connexion'", '', '', '', '', $serveur) |
|
| 143 | + ) { |
|
| 144 | + $charset = $r; |
|
| 145 | + } else { |
|
| 146 | + $charset = -1; |
|
| 147 | + } |
|
| 148 | + } |
|
| 149 | + if ($charset != -1) { |
|
| 150 | + $f = $GLOBALS[$jeu]['set_charset']; |
|
| 151 | + if (function_exists($f)) { |
|
| 152 | + $f($charset, $serveur); |
|
| 153 | + } |
|
| 154 | + } |
|
| 155 | + |
|
| 156 | + return $GLOBALS['connexions'][$index]; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -162,12 +162,12 @@ discard block |
||
| 162 | 162 | * @param string $serveur Nom du connecteur de bdd utilisé |
| 163 | 163 | **/ |
| 164 | 164 | function spip_sql_erreur($serveur = '') { |
| 165 | - $connexion = spip_connect($serveur); |
|
| 166 | - $e = sql_errno($serveur); |
|
| 167 | - $t = ($connexion['type'] ?? 'sql'); |
|
| 168 | - $m = "Erreur $e de $t: " . sql_error($serveur) . "\nin " . sql_error_backtrace() . "\n" . trim($connexion['last']); |
|
| 169 | - $f = $t . $serveur; |
|
| 170 | - spip_log($m, $f . '.' . _LOG_ERREUR); |
|
| 165 | + $connexion = spip_connect($serveur); |
|
| 166 | + $e = sql_errno($serveur); |
|
| 167 | + $t = ($connexion['type'] ?? 'sql'); |
|
| 168 | + $m = "Erreur $e de $t: " . sql_error($serveur) . "\nin " . sql_error_backtrace() . "\n" . trim($connexion['last']); |
|
| 169 | + $f = $t . $serveur; |
|
| 170 | + spip_log($m, $f . '.' . _LOG_ERREUR); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | /** |
@@ -189,23 +189,23 @@ discard block |
||
| 189 | 189 | * - array : description de la connexion, si l'instruction sql est indisponible pour cette connexion |
| 190 | 190 | **/ |
| 191 | 191 | function spip_connect_sql($version, $ins = '', $serveur = '', $continue = false) { |
| 192 | - $desc = spip_connect($serveur, $version); |
|
| 193 | - if ( |
|
| 194 | - $desc |
|
| 195 | - and $f = ($desc[$version][$ins] ?? '') |
|
| 196 | - and function_exists($f) |
|
| 197 | - ) { |
|
| 198 | - return $f; |
|
| 199 | - } |
|
| 200 | - if ($continue) { |
|
| 201 | - return $desc; |
|
| 202 | - } |
|
| 203 | - if ($ins) { |
|
| 204 | - spip_log("Le serveur '$serveur' version $version n'a pas '$ins'", _LOG_ERREUR); |
|
| 205 | - } |
|
| 206 | - include_spip('inc/minipres'); |
|
| 207 | - echo minipres(_T('info_travaux_titre'), _T('titre_probleme_technique'), ['status' => 503]); |
|
| 208 | - exit; |
|
| 192 | + $desc = spip_connect($serveur, $version); |
|
| 193 | + if ( |
|
| 194 | + $desc |
|
| 195 | + and $f = ($desc[$version][$ins] ?? '') |
|
| 196 | + and function_exists($f) |
|
| 197 | + ) { |
|
| 198 | + return $f; |
|
| 199 | + } |
|
| 200 | + if ($continue) { |
|
| 201 | + return $desc; |
|
| 202 | + } |
|
| 203 | + if ($ins) { |
|
| 204 | + spip_log("Le serveur '$serveur' version $version n'a pas '$ins'", _LOG_ERREUR); |
|
| 205 | + } |
|
| 206 | + include_spip('inc/minipres'); |
|
| 207 | + echo minipres(_T('info_travaux_titre'), _T('titre_probleme_technique'), ['status' => 503]); |
|
| 208 | + exit; |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | /** |
@@ -231,70 +231,70 @@ discard block |
||
| 231 | 231 | * @return array|null Description de la connexion |
| 232 | 232 | */ |
| 233 | 233 | function spip_connect_db( |
| 234 | - $host, |
|
| 235 | - $port, |
|
| 236 | - $login, |
|
| 237 | - $pass, |
|
| 238 | - $db = '', |
|
| 239 | - $type = 'mysql', |
|
| 240 | - $prefixe = '', |
|
| 241 | - $auth = '', |
|
| 242 | - $charset = '' |
|
| 234 | + $host, |
|
| 235 | + $port, |
|
| 236 | + $login, |
|
| 237 | + $pass, |
|
| 238 | + $db = '', |
|
| 239 | + $type = 'mysql', |
|
| 240 | + $prefixe = '', |
|
| 241 | + $auth = '', |
|
| 242 | + $charset = '' |
|
| 243 | 243 | ) { |
| 244 | - // temps avant nouvelle tentative de connexion |
|
| 245 | - // suite a une connection echouee |
|
| 246 | - if (!defined('_CONNECT_RETRY_DELAY')) { |
|
| 247 | - define('_CONNECT_RETRY_DELAY', 30); |
|
| 248 | - } |
|
| 249 | - |
|
| 250 | - $f = ''; |
|
| 251 | - // un fichier de identifiant par combinaison (type,host,port,db) |
|
| 252 | - // pour ne pas declarer tout indisponible d'un coup |
|
| 253 | - // si en cours d'installation ou si db=@test@ on ne pose rien |
|
| 254 | - // car c'est un test de connexion |
|
| 255 | - if (!defined('_ECRIRE_INSTALL') and $db !== '@test@') { |
|
| 256 | - $f = _DIR_TMP . $type . '.' . substr(md5($host . $port . $db), 0, 8) . '.out'; |
|
| 257 | - } elseif ($db == '@test@') { |
|
| 258 | - $db = ''; |
|
| 259 | - } |
|
| 260 | - |
|
| 261 | - if ( |
|
| 262 | - $f |
|
| 263 | - and @file_exists($f) |
|
| 264 | - and (time() - @filemtime($f) < _CONNECT_RETRY_DELAY) |
|
| 265 | - ) { |
|
| 266 | - spip_log("Echec : $f recent. Pas de tentative de connexion", _LOG_HS); |
|
| 267 | - |
|
| 268 | - return null; |
|
| 269 | - } |
|
| 270 | - |
|
| 271 | - if (!$prefixe) { |
|
| 272 | - $prefixe = $GLOBALS['table_prefix'] ?? $db; |
|
| 273 | - } |
|
| 274 | - $h = charger_fonction($type, 'req', true); |
|
| 275 | - if (!$h) { |
|
| 276 | - spip_log("les requetes $type ne sont pas fournies", _LOG_HS); |
|
| 277 | - |
|
| 278 | - return null; |
|
| 279 | - } |
|
| 280 | - if ($g = $h($host, $port, $login, $pass, $db, $prefixe)) { |
|
| 281 | - if (!is_array($auth)) { |
|
| 282 | - // compatibilite version 0.7 initiale |
|
| 283 | - $g['ldap'] = $auth; |
|
| 284 | - $auth = ['ldap' => $auth]; |
|
| 285 | - } |
|
| 286 | - $g['authentification'] = $auth; |
|
| 287 | - $g['type'] = $type; |
|
| 288 | - $g['charset'] = $charset; |
|
| 289 | - |
|
| 290 | - return $GLOBALS['db_ok'] = $g; |
|
| 291 | - } |
|
| 292 | - // En cas d'indisponibilite du serveur, eviter de le bombarder |
|
| 293 | - if ($f) { |
|
| 294 | - @touch($f); |
|
| 295 | - spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type . '.' . _LOG_HS); |
|
| 296 | - } |
|
| 297 | - return null; |
|
| 244 | + // temps avant nouvelle tentative de connexion |
|
| 245 | + // suite a une connection echouee |
|
| 246 | + if (!defined('_CONNECT_RETRY_DELAY')) { |
|
| 247 | + define('_CONNECT_RETRY_DELAY', 30); |
|
| 248 | + } |
|
| 249 | + |
|
| 250 | + $f = ''; |
|
| 251 | + // un fichier de identifiant par combinaison (type,host,port,db) |
|
| 252 | + // pour ne pas declarer tout indisponible d'un coup |
|
| 253 | + // si en cours d'installation ou si db=@test@ on ne pose rien |
|
| 254 | + // car c'est un test de connexion |
|
| 255 | + if (!defined('_ECRIRE_INSTALL') and $db !== '@test@') { |
|
| 256 | + $f = _DIR_TMP . $type . '.' . substr(md5($host . $port . $db), 0, 8) . '.out'; |
|
| 257 | + } elseif ($db == '@test@') { |
|
| 258 | + $db = ''; |
|
| 259 | + } |
|
| 260 | + |
|
| 261 | + if ( |
|
| 262 | + $f |
|
| 263 | + and @file_exists($f) |
|
| 264 | + and (time() - @filemtime($f) < _CONNECT_RETRY_DELAY) |
|
| 265 | + ) { |
|
| 266 | + spip_log("Echec : $f recent. Pas de tentative de connexion", _LOG_HS); |
|
| 267 | + |
|
| 268 | + return null; |
|
| 269 | + } |
|
| 270 | + |
|
| 271 | + if (!$prefixe) { |
|
| 272 | + $prefixe = $GLOBALS['table_prefix'] ?? $db; |
|
| 273 | + } |
|
| 274 | + $h = charger_fonction($type, 'req', true); |
|
| 275 | + if (!$h) { |
|
| 276 | + spip_log("les requetes $type ne sont pas fournies", _LOG_HS); |
|
| 277 | + |
|
| 278 | + return null; |
|
| 279 | + } |
|
| 280 | + if ($g = $h($host, $port, $login, $pass, $db, $prefixe)) { |
|
| 281 | + if (!is_array($auth)) { |
|
| 282 | + // compatibilite version 0.7 initiale |
|
| 283 | + $g['ldap'] = $auth; |
|
| 284 | + $auth = ['ldap' => $auth]; |
|
| 285 | + } |
|
| 286 | + $g['authentification'] = $auth; |
|
| 287 | + $g['type'] = $type; |
|
| 288 | + $g['charset'] = $charset; |
|
| 289 | + |
|
| 290 | + return $GLOBALS['db_ok'] = $g; |
|
| 291 | + } |
|
| 292 | + // En cas d'indisponibilite du serveur, eviter de le bombarder |
|
| 293 | + if ($f) { |
|
| 294 | + @touch($f); |
|
| 295 | + spip_log("Echec connexion serveur $type : host[$host] port[$port] login[$login] base[$db]", $type . '.' . _LOG_HS); |
|
| 296 | + } |
|
| 297 | + return null; |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | |
@@ -326,32 +326,32 @@ discard block |
||
| 326 | 326 | * - nom du charset sinon |
| 327 | 327 | **/ |
| 328 | 328 | function spip_connect_main($connexion, $charset_sql_connexion = '') { |
| 329 | - if ($GLOBALS['spip_connect_version'] < 0.1 and _DIR_RESTREINT) { |
|
| 330 | - include_spip('inc/headers'); |
|
| 331 | - redirige_url_ecrire('upgrade', 'reinstall=oui'); |
|
| 332 | - } |
|
| 333 | - |
|
| 334 | - if (!($f = $connexion['select'])) { |
|
| 335 | - return false; |
|
| 336 | - } |
|
| 337 | - // si le charset est fourni, l'utiliser |
|
| 338 | - if ($charset_sql_connexion) { |
|
| 339 | - return $charset_sql_connexion; |
|
| 340 | - } |
|
| 341 | - // sinon on regarde la table spip_meta |
|
| 342 | - // en cas d'erreur select retourne la requette (is_string=true donc) |
|
| 343 | - if ( |
|
| 344 | - !$r = $f('valeur', 'spip_meta', "nom='charset_sql_connexion'") |
|
| 345 | - or is_string($r) |
|
| 346 | - ) { |
|
| 347 | - return false; |
|
| 348 | - } |
|
| 349 | - if (!($f = $connexion['fetch'])) { |
|
| 350 | - return false; |
|
| 351 | - } |
|
| 352 | - $r = $f($r); |
|
| 353 | - |
|
| 354 | - return (isset($r['valeur']) && $r['valeur']) ? $r['valeur'] : -1; |
|
| 329 | + if ($GLOBALS['spip_connect_version'] < 0.1 and _DIR_RESTREINT) { |
|
| 330 | + include_spip('inc/headers'); |
|
| 331 | + redirige_url_ecrire('upgrade', 'reinstall=oui'); |
|
| 332 | + } |
|
| 333 | + |
|
| 334 | + if (!($f = $connexion['select'])) { |
|
| 335 | + return false; |
|
| 336 | + } |
|
| 337 | + // si le charset est fourni, l'utiliser |
|
| 338 | + if ($charset_sql_connexion) { |
|
| 339 | + return $charset_sql_connexion; |
|
| 340 | + } |
|
| 341 | + // sinon on regarde la table spip_meta |
|
| 342 | + // en cas d'erreur select retourne la requette (is_string=true donc) |
|
| 343 | + if ( |
|
| 344 | + !$r = $f('valeur', 'spip_meta', "nom='charset_sql_connexion'") |
|
| 345 | + or is_string($r) |
|
| 346 | + ) { |
|
| 347 | + return false; |
|
| 348 | + } |
|
| 349 | + if (!($f = $connexion['fetch'])) { |
|
| 350 | + return false; |
|
| 351 | + } |
|
| 352 | + $r = $f($r); |
|
| 353 | + |
|
| 354 | + return (isset($r['valeur']) && $r['valeur']) ? $r['valeur'] : -1; |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | /** |
@@ -367,8 +367,8 @@ discard block |
||
| 367 | 367 | * @return array |
| 368 | 368 | */ |
| 369 | 369 | function spip_connect_ldap($serveur = '') { |
| 370 | - include_spip('auth/ldap'); |
|
| 371 | - return auth_ldap_connect($serveur); |
|
| 370 | + include_spip('auth/ldap'); |
|
| 371 | + return auth_ldap_connect($serveur); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | /** |
@@ -384,16 +384,16 @@ discard block |
||
| 384 | 384 | * @return string Valeur échappée. |
| 385 | 385 | **/ |
| 386 | 386 | function _q($a): string { |
| 387 | - if (is_numeric($a)) { |
|
| 388 | - return strval($a); |
|
| 389 | - } elseif (is_array($a)) { |
|
| 390 | - return join(',', array_map('_q', $a)); |
|
| 391 | - } elseif (is_scalar($a)) { |
|
| 392 | - return ("'" . addslashes($a) . "'"); |
|
| 393 | - } elseif ($a === null) { |
|
| 394 | - return "''"; |
|
| 395 | - } |
|
| 396 | - throw new \RuntimeException('Can’t use _q with ' . gettype($a)); |
|
| 387 | + if (is_numeric($a)) { |
|
| 388 | + return strval($a); |
|
| 389 | + } elseif (is_array($a)) { |
|
| 390 | + return join(',', array_map('_q', $a)); |
|
| 391 | + } elseif (is_scalar($a)) { |
|
| 392 | + return ("'" . addslashes($a) . "'"); |
|
| 393 | + } elseif ($a === null) { |
|
| 394 | + return "''"; |
|
| 395 | + } |
|
| 396 | + throw new \RuntimeException('Can’t use _q with ' . gettype($a)); |
|
| 397 | 397 | } |
| 398 | 398 | |
| 399 | 399 | /** |
@@ -409,75 +409,75 @@ discard block |
||
| 409 | 409 | * @return array |
| 410 | 410 | */ |
| 411 | 411 | function query_echappe_textes($query, $uniqid = null) { |
| 412 | - static $codeEchappements = null; |
|
| 413 | - if (is_null($codeEchappements) or $uniqid) { |
|
| 414 | - if (is_null($uniqid)) { |
|
| 415 | - $uniqid = uniqid(); |
|
| 416 | - } |
|
| 417 | - $uniqid = substr(md5($uniqid), 0, 4); |
|
| 418 | - $codeEchappements = ['\\\\' => "\x1@#{$uniqid}#@\x1", "\\'" => "\x2@#{$uniqid}#@\x2", '\\"' => "\x3@#{$uniqid}#@\x3", '%' => "\x4@#{$uniqid}#@\x4"]; |
|
| 419 | - } |
|
| 420 | - if ($query === null) { |
|
| 421 | - return $codeEchappements; |
|
| 422 | - } |
|
| 423 | - |
|
| 424 | - // si la query contient deja des codes d'echappement on va s'emmeler les pinceaux et donc on ne touche a rien |
|
| 425 | - // ce n'est pas un cas legitime |
|
| 426 | - foreach ($codeEchappements as $codeEchappement) { |
|
| 427 | - if (strpos($query, (string) $codeEchappement) !== false) { |
|
| 428 | - return [$query, []]; |
|
| 429 | - } |
|
| 430 | - } |
|
| 431 | - |
|
| 432 | - $query_echappees = str_replace(array_keys($codeEchappements), array_values($codeEchappements), $query); |
|
| 433 | - if (preg_match_all("/('[^']*')|(\"[^\"]*\")/S", $query_echappees, $textes)) { |
|
| 434 | - $textes = reset($textes); |
|
| 435 | - |
|
| 436 | - $parts = []; |
|
| 437 | - $currentpos = 0; |
|
| 438 | - $k = 0; |
|
| 439 | - while (count($textes)) { |
|
| 440 | - $part = array_shift($textes); |
|
| 441 | - $nextpos = strpos($query_echappees, $part, $currentpos); |
|
| 442 | - // si besoin recoller ensemble les doubles '' de sqlite (echappement des ') |
|
| 443 | - while (count($textes) and substr($part, -1) === "'") { |
|
| 444 | - $next = reset($textes); |
|
| 445 | - if ( |
|
| 446 | - strpos($next, "'") === 0 |
|
| 447 | - and strpos($query_echappees, $part . $next, $currentpos) === $nextpos |
|
| 448 | - ) { |
|
| 449 | - $part .= array_shift($textes); |
|
| 450 | - } |
|
| 451 | - else { |
|
| 452 | - break; |
|
| 453 | - } |
|
| 454 | - } |
|
| 455 | - $k++; |
|
| 456 | - $parts[$k] = [ |
|
| 457 | - 'texte' => $part, |
|
| 458 | - 'position' => $nextpos, |
|
| 459 | - 'placeholder' => '%' . $k . '$s', |
|
| 460 | - ]; |
|
| 461 | - $currentpos = $nextpos + strlen($part); |
|
| 462 | - } |
|
| 463 | - |
|
| 464 | - // et on replace les parts une par une en commencant par la fin |
|
| 465 | - while ($k > 0) { |
|
| 466 | - $query_echappees = substr_replace($query_echappees, $parts[$k]['placeholder'], $parts[$k]['position'], strlen($parts[$k]['texte'])); |
|
| 467 | - $k--; |
|
| 468 | - } |
|
| 469 | - $textes = array_column($parts, 'texte'); |
|
| 470 | - } else { |
|
| 471 | - $textes = []; |
|
| 472 | - } |
|
| 473 | - |
|
| 474 | - // si il reste des quotes simples ou doubles, c'est qu'on s'est emmelle les pinceaux |
|
| 475 | - // dans le doute on ne touche a rien |
|
| 476 | - if (strpbrk($query_echappees, "'\"") !== false) { |
|
| 477 | - return [$query, []]; |
|
| 478 | - } |
|
| 479 | - |
|
| 480 | - return [$query_echappees, $textes]; |
|
| 412 | + static $codeEchappements = null; |
|
| 413 | + if (is_null($codeEchappements) or $uniqid) { |
|
| 414 | + if (is_null($uniqid)) { |
|
| 415 | + $uniqid = uniqid(); |
|
| 416 | + } |
|
| 417 | + $uniqid = substr(md5($uniqid), 0, 4); |
|
| 418 | + $codeEchappements = ['\\\\' => "\x1@#{$uniqid}#@\x1", "\\'" => "\x2@#{$uniqid}#@\x2", '\\"' => "\x3@#{$uniqid}#@\x3", '%' => "\x4@#{$uniqid}#@\x4"]; |
|
| 419 | + } |
|
| 420 | + if ($query === null) { |
|
| 421 | + return $codeEchappements; |
|
| 422 | + } |
|
| 423 | + |
|
| 424 | + // si la query contient deja des codes d'echappement on va s'emmeler les pinceaux et donc on ne touche a rien |
|
| 425 | + // ce n'est pas un cas legitime |
|
| 426 | + foreach ($codeEchappements as $codeEchappement) { |
|
| 427 | + if (strpos($query, (string) $codeEchappement) !== false) { |
|
| 428 | + return [$query, []]; |
|
| 429 | + } |
|
| 430 | + } |
|
| 431 | + |
|
| 432 | + $query_echappees = str_replace(array_keys($codeEchappements), array_values($codeEchappements), $query); |
|
| 433 | + if (preg_match_all("/('[^']*')|(\"[^\"]*\")/S", $query_echappees, $textes)) { |
|
| 434 | + $textes = reset($textes); |
|
| 435 | + |
|
| 436 | + $parts = []; |
|
| 437 | + $currentpos = 0; |
|
| 438 | + $k = 0; |
|
| 439 | + while (count($textes)) { |
|
| 440 | + $part = array_shift($textes); |
|
| 441 | + $nextpos = strpos($query_echappees, $part, $currentpos); |
|
| 442 | + // si besoin recoller ensemble les doubles '' de sqlite (echappement des ') |
|
| 443 | + while (count($textes) and substr($part, -1) === "'") { |
|
| 444 | + $next = reset($textes); |
|
| 445 | + if ( |
|
| 446 | + strpos($next, "'") === 0 |
|
| 447 | + and strpos($query_echappees, $part . $next, $currentpos) === $nextpos |
|
| 448 | + ) { |
|
| 449 | + $part .= array_shift($textes); |
|
| 450 | + } |
|
| 451 | + else { |
|
| 452 | + break; |
|
| 453 | + } |
|
| 454 | + } |
|
| 455 | + $k++; |
|
| 456 | + $parts[$k] = [ |
|
| 457 | + 'texte' => $part, |
|
| 458 | + 'position' => $nextpos, |
|
| 459 | + 'placeholder' => '%' . $k . '$s', |
|
| 460 | + ]; |
|
| 461 | + $currentpos = $nextpos + strlen($part); |
|
| 462 | + } |
|
| 463 | + |
|
| 464 | + // et on replace les parts une par une en commencant par la fin |
|
| 465 | + while ($k > 0) { |
|
| 466 | + $query_echappees = substr_replace($query_echappees, $parts[$k]['placeholder'], $parts[$k]['position'], strlen($parts[$k]['texte'])); |
|
| 467 | + $k--; |
|
| 468 | + } |
|
| 469 | + $textes = array_column($parts, 'texte'); |
|
| 470 | + } else { |
|
| 471 | + $textes = []; |
|
| 472 | + } |
|
| 473 | + |
|
| 474 | + // si il reste des quotes simples ou doubles, c'est qu'on s'est emmelle les pinceaux |
|
| 475 | + // dans le doute on ne touche a rien |
|
| 476 | + if (strpbrk($query_echappees, "'\"") !== false) { |
|
| 477 | + return [$query, []]; |
|
| 478 | + } |
|
| 479 | + |
|
| 480 | + return [$query_echappees, $textes]; |
|
| 481 | 481 | } |
| 482 | 482 | |
| 483 | 483 | /** |
@@ -491,16 +491,16 @@ discard block |
||
| 491 | 491 | * @return string |
| 492 | 492 | */ |
| 493 | 493 | function query_reinjecte_textes($query, $textes) { |
| 494 | - // recuperer les codes echappements |
|
| 495 | - $codeEchappements = query_echappe_textes(null); |
|
| 494 | + // recuperer les codes echappements |
|
| 495 | + $codeEchappements = query_echappe_textes(null); |
|
| 496 | 496 | |
| 497 | - if (!empty($textes)) { |
|
| 498 | - $query = sprintf($query, ...$textes); |
|
| 499 | - } |
|
| 497 | + if (!empty($textes)) { |
|
| 498 | + $query = sprintf($query, ...$textes); |
|
| 499 | + } |
|
| 500 | 500 | |
| 501 | - $query = str_replace(array_values($codeEchappements), array_keys($codeEchappements), $query); |
|
| 501 | + $query = str_replace(array_values($codeEchappements), array_keys($codeEchappements), $query); |
|
| 502 | 502 | |
| 503 | - return $query; |
|
| 503 | + return $query; |
|
| 504 | 504 | } |
| 505 | 505 | |
| 506 | 506 | |
@@ -519,7 +519,7 @@ discard block |
||
| 519 | 519 | **/ |
| 520 | 520 | function spip_query($query, $serveur = '') { |
| 521 | 521 | |
| 522 | - $f = spip_connect_sql($GLOBALS['spip_sql_version'], 'query', $serveur, true); |
|
| 522 | + $f = spip_connect_sql($GLOBALS['spip_sql_version'], 'query', $serveur, true); |
|
| 523 | 523 | |
| 524 | - return function_exists($f) ? $f($query, $serveur) : false; |
|
| 524 | + return function_exists($f) ? $f($query, $serveur) : false; |
|
| 525 | 525 | } |
@@ -339,8 +339,7 @@ |
||
| 339 | 339 | if (!autoriser('modifier', $type, intval($id))) { |
| 340 | 340 | $contexte['editable'] = ''; |
| 341 | 341 | } |
| 342 | - } |
|
| 343 | - else { |
|
| 342 | + } else { |
|
| 344 | 343 | if (!autoriser('creer', $type, 0, null, ['id_parent' => $id_parent])) { |
| 345 | 344 | $contexte['editable'] = ''; |
| 346 | 345 | } |
@@ -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 | include_spip('base/abstract_sql'); |
| 23 | 23 | |
@@ -59,56 +59,56 @@ discard block |
||
| 59 | 59 | * Retour des traitements. |
| 60 | 60 | **/ |
| 61 | 61 | function formulaires_editer_objet_traiter( |
| 62 | - $type, |
|
| 63 | - $id = 'new', |
|
| 64 | - $id_parent = 0, |
|
| 65 | - $lier_trad = 0, |
|
| 66 | - $retour = '', |
|
| 67 | - $config_fonc = 'articles_edit_config', |
|
| 68 | - $row = [], |
|
| 69 | - $hidden = '' |
|
| 62 | + $type, |
|
| 63 | + $id = 'new', |
|
| 64 | + $id_parent = 0, |
|
| 65 | + $lier_trad = 0, |
|
| 66 | + $retour = '', |
|
| 67 | + $config_fonc = 'articles_edit_config', |
|
| 68 | + $row = [], |
|
| 69 | + $hidden = '' |
|
| 70 | 70 | ) { |
| 71 | 71 | |
| 72 | - $res = []; |
|
| 73 | - // eviter la redirection forcee par l'action... |
|
| 74 | - set_request('redirect'); |
|
| 75 | - if ($action_editer = charger_fonction("editer_$type", 'action', true)) { |
|
| 76 | - [$id, $err] = $action_editer($id); |
|
| 77 | - } else { |
|
| 78 | - $action_editer = charger_fonction('editer_objet', 'action'); |
|
| 79 | - [$id, $err] = $action_editer($id, $type); |
|
| 80 | - } |
|
| 81 | - $id_table_objet = id_table_objet($type); |
|
| 82 | - $res[$id_table_objet] = $id; |
|
| 83 | - if ($err or !$id) { |
|
| 84 | - $res['message_erreur'] = ($err ?: _T('erreur')); |
|
| 85 | - } else { |
|
| 86 | - // Un lien de trad a prendre en compte |
|
| 87 | - if ($lier_trad) { |
|
| 88 | - // referencer la traduction |
|
| 89 | - $referencer_traduction = charger_fonction('referencer_traduction', 'action'); |
|
| 90 | - $referencer_traduction($type, $id, $lier_trad); |
|
| 91 | - // actions de recopie de champs / liens sur le nouvel objet créé |
|
| 92 | - $completer_traduction = charger_fonction('completer_traduction', 'inc'); |
|
| 93 | - $err = $completer_traduction($type, $id, $lier_trad); |
|
| 94 | - if ($err) { |
|
| 95 | - $res['message_erreur'] = $err; |
|
| 96 | - return $res; |
|
| 97 | - } |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - $res['message_ok'] = _T('info_modification_enregistree'); |
|
| 101 | - if ($retour) { |
|
| 102 | - if (strncmp($retour, 'javascript:', 11) == 0) { |
|
| 103 | - $res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/' . substr($retour, 11) . '/*]]>*/</script>'; |
|
| 104 | - $res['editable'] = true; |
|
| 105 | - } else { |
|
| 106 | - $res['redirect'] = parametre_url($retour, $id_table_objet, $id); |
|
| 107 | - } |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - |
|
| 111 | - return $res; |
|
| 72 | + $res = []; |
|
| 73 | + // eviter la redirection forcee par l'action... |
|
| 74 | + set_request('redirect'); |
|
| 75 | + if ($action_editer = charger_fonction("editer_$type", 'action', true)) { |
|
| 76 | + [$id, $err] = $action_editer($id); |
|
| 77 | + } else { |
|
| 78 | + $action_editer = charger_fonction('editer_objet', 'action'); |
|
| 79 | + [$id, $err] = $action_editer($id, $type); |
|
| 80 | + } |
|
| 81 | + $id_table_objet = id_table_objet($type); |
|
| 82 | + $res[$id_table_objet] = $id; |
|
| 83 | + if ($err or !$id) { |
|
| 84 | + $res['message_erreur'] = ($err ?: _T('erreur')); |
|
| 85 | + } else { |
|
| 86 | + // Un lien de trad a prendre en compte |
|
| 87 | + if ($lier_trad) { |
|
| 88 | + // referencer la traduction |
|
| 89 | + $referencer_traduction = charger_fonction('referencer_traduction', 'action'); |
|
| 90 | + $referencer_traduction($type, $id, $lier_trad); |
|
| 91 | + // actions de recopie de champs / liens sur le nouvel objet créé |
|
| 92 | + $completer_traduction = charger_fonction('completer_traduction', 'inc'); |
|
| 93 | + $err = $completer_traduction($type, $id, $lier_trad); |
|
| 94 | + if ($err) { |
|
| 95 | + $res['message_erreur'] = $err; |
|
| 96 | + return $res; |
|
| 97 | + } |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + $res['message_ok'] = _T('info_modification_enregistree'); |
|
| 101 | + if ($retour) { |
|
| 102 | + if (strncmp($retour, 'javascript:', 11) == 0) { |
|
| 103 | + $res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/' . substr($retour, 11) . '/*]]>*/</script>'; |
|
| 104 | + $res['editable'] = true; |
|
| 105 | + } else { |
|
| 106 | + $res['redirect'] = parametre_url($retour, $id_table_objet, $id); |
|
| 107 | + } |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | + |
|
| 111 | + return $res; |
|
| 112 | 112 | } |
| 113 | 113 | |
| 114 | 114 | /** |
@@ -132,29 +132,29 @@ discard block |
||
| 132 | 132 | * Tableau des erreurs |
| 133 | 133 | **/ |
| 134 | 134 | function formulaires_editer_objet_verifier($type, $id = 'new', $oblis = []) { |
| 135 | - $erreurs = []; |
|
| 136 | - if (intval($id)) { |
|
| 137 | - $conflits = controler_contenu($type, $id); |
|
| 138 | - if ($conflits and is_countable($conflits) ? count($conflits) : 0) { |
|
| 139 | - foreach ($conflits as $champ => $conflit) { |
|
| 140 | - if (!isset($erreurs[$champ])) { |
|
| 141 | - $erreurs[$champ] = ''; |
|
| 142 | - } |
|
| 143 | - $erreurs[$champ] .= _T('alerte_modif_info_concourante') . "<br /><textarea readonly='readonly' class='forml'>" . entites_html($conflit['base']) . '</textarea>'; |
|
| 144 | - } |
|
| 145 | - } |
|
| 146 | - } |
|
| 147 | - foreach ($oblis as $obli) { |
|
| 148 | - $value = _request($obli); |
|
| 149 | - if (is_null($value) or !(is_array($value) ? count($value) : strlen($value))) { |
|
| 150 | - if (!isset($erreurs[$obli])) { |
|
| 151 | - $erreurs[$obli] = ''; |
|
| 152 | - } |
|
| 153 | - $erreurs[$obli] .= _T('info_obligatoire'); |
|
| 154 | - } |
|
| 155 | - } |
|
| 156 | - |
|
| 157 | - return $erreurs; |
|
| 135 | + $erreurs = []; |
|
| 136 | + if (intval($id)) { |
|
| 137 | + $conflits = controler_contenu($type, $id); |
|
| 138 | + if ($conflits and is_countable($conflits) ? count($conflits) : 0) { |
|
| 139 | + foreach ($conflits as $champ => $conflit) { |
|
| 140 | + if (!isset($erreurs[$champ])) { |
|
| 141 | + $erreurs[$champ] = ''; |
|
| 142 | + } |
|
| 143 | + $erreurs[$champ] .= _T('alerte_modif_info_concourante') . "<br /><textarea readonly='readonly' class='forml'>" . entites_html($conflit['base']) . '</textarea>'; |
|
| 144 | + } |
|
| 145 | + } |
|
| 146 | + } |
|
| 147 | + foreach ($oblis as $obli) { |
|
| 148 | + $value = _request($obli); |
|
| 149 | + if (is_null($value) or !(is_array($value) ? count($value) : strlen($value))) { |
|
| 150 | + if (!isset($erreurs[$obli])) { |
|
| 151 | + $erreurs[$obli] = ''; |
|
| 152 | + } |
|
| 153 | + $erreurs[$obli] .= _T('info_obligatoire'); |
|
| 154 | + } |
|
| 155 | + } |
|
| 156 | + |
|
| 157 | + return $erreurs; |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | /** |
@@ -199,154 +199,154 @@ discard block |
||
| 199 | 199 | * Environnement du formulaire. |
| 200 | 200 | **/ |
| 201 | 201 | function formulaires_editer_objet_charger( |
| 202 | - $type, |
|
| 203 | - $id = 'new', |
|
| 204 | - $id_parent = 0, |
|
| 205 | - $lier_trad = 0, |
|
| 206 | - $retour = '', |
|
| 207 | - $config_fonc = 'articles_edit_config', |
|
| 208 | - $row = [], |
|
| 209 | - $hidden = '' |
|
| 202 | + $type, |
|
| 203 | + $id = 'new', |
|
| 204 | + $id_parent = 0, |
|
| 205 | + $lier_trad = 0, |
|
| 206 | + $retour = '', |
|
| 207 | + $config_fonc = 'articles_edit_config', |
|
| 208 | + $row = [], |
|
| 209 | + $hidden = '' |
|
| 210 | 210 | ) { |
| 211 | 211 | |
| 212 | - $table_objet = table_objet($type); |
|
| 213 | - $table_objet_sql = table_objet_sql($type); |
|
| 214 | - $id_table_objet = id_table_objet($type); |
|
| 215 | - if (!is_array($row)) { |
|
| 216 | - $row = []; |
|
| 217 | - } |
|
| 218 | - |
|
| 219 | - // on accepte pas une fonction de config inconnue si elle vient d'un modele |
|
| 220 | - if ( |
|
| 221 | - $config_fonc |
|
| 222 | - and !in_array($config_fonc, ['articles_edit_config', 'rubriques_edit_config', 'auteurs_edit_config']) |
|
| 223 | - and $config_fonc !== $table_objet . '_edit_config' |
|
| 224 | - ) { |
|
| 225 | - if ( |
|
| 226 | - $args = test_formulaire_inclus_par_modele() |
|
| 227 | - and in_array($config_fonc, $args) |
|
| 228 | - ) { |
|
| 229 | - $config_fonc = ''; |
|
| 230 | - } |
|
| 231 | - } |
|
| 232 | - |
|
| 233 | - $new = !is_numeric($id); |
|
| 234 | - $lang_default = ''; |
|
| 235 | - // Appel direct dans un squelette |
|
| 236 | - if (!$row) { |
|
| 237 | - if (!$new or $lier_trad) { |
|
| 238 | - if ($select = charger_fonction('precharger_' . $type, 'inc', true)) { |
|
| 239 | - $row = $select($id, $id_parent, $lier_trad); |
|
| 240 | - // si on a une fonction precharger, elle pu faire un reglage de langue |
|
| 241 | - $lang_default = (!empty($row['lang']) ? $row['lang'] : null); |
|
| 242 | - } else { |
|
| 243 | - $row = sql_fetsel('*', $table_objet_sql, $id_table_objet . '=' . intval($id)); |
|
| 244 | - } |
|
| 245 | - if (!$new) { |
|
| 246 | - $md5 = controles_md5($row ?: []); |
|
| 247 | - } |
|
| 248 | - } |
|
| 249 | - if (!$row) { |
|
| 250 | - $row = []; |
|
| 251 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 252 | - if ($desc = $trouver_table($table_objet)) { |
|
| 253 | - foreach ($desc['field'] as $k => $v) { |
|
| 254 | - $row[$k] = ''; |
|
| 255 | - } |
|
| 256 | - } |
|
| 257 | - } |
|
| 258 | - } |
|
| 259 | - |
|
| 260 | - // Gaffe: sans ceci, on ecrase systematiquement l'article d'origine |
|
| 261 | - // (et donc: pas de lien de traduction) |
|
| 262 | - $id = ($new or $lier_trad) |
|
| 263 | - ? 'oui' |
|
| 264 | - : $row[$id_table_objet]; |
|
| 265 | - $row[$id_table_objet] = $id; |
|
| 266 | - |
|
| 267 | - $contexte = $row; |
|
| 268 | - if (is_numeric($id_parent) && strlen($id_parent) && (!isset($contexte['id_parent']) or $new)) { |
|
| 269 | - if (!isset($contexte['id_parent'])) { |
|
| 270 | - unset($contexte['id_rubrique']); |
|
| 271 | - } |
|
| 272 | - $contexte['id_parent'] = $id_parent; |
|
| 273 | - } elseif (!isset($contexte['id_parent'])) { |
|
| 274 | - // id_rubrique dans id_parent si possible |
|
| 275 | - if (isset($contexte['id_rubrique'])) { |
|
| 276 | - $contexte['id_parent'] = $contexte['id_rubrique']; |
|
| 277 | - unset($contexte['id_rubrique']); |
|
| 278 | - } else { |
|
| 279 | - $contexte['id_parent'] = ''; |
|
| 280 | - } |
|
| 281 | - if ( |
|
| 282 | - !$contexte['id_parent'] |
|
| 283 | - and $preselectionner_parent_nouvel_objet = charger_fonction('preselectionner_parent_nouvel_objet', 'inc', true) |
|
| 284 | - ) { |
|
| 285 | - $contexte['id_parent'] = $preselectionner_parent_nouvel_objet($type, $row); |
|
| 286 | - } |
|
| 287 | - } |
|
| 288 | - |
|
| 289 | - $config = []; |
|
| 290 | - if ($config_fonc) { |
|
| 291 | - $contexte['config'] = $config = $config_fonc($contexte); |
|
| 292 | - if (!$lang_default) { |
|
| 293 | - $lang_default = $config['langue'] ?? session_get('lang') ; |
|
| 294 | - } |
|
| 295 | - } |
|
| 296 | - $config = $config + [ |
|
| 297 | - 'lignes' => 0, |
|
| 298 | - 'langue' => '', |
|
| 299 | - ]; |
|
| 300 | - |
|
| 301 | - $att_text = " class='textarea' " |
|
| 302 | - . " rows='" |
|
| 303 | - . ($config['lignes'] + 15) |
|
| 304 | - . "' cols='40'"; |
|
| 305 | - if (isset($contexte['texte'])) { |
|
| 306 | - [$contexte['texte'], $contexte['_texte_trop_long']] = editer_texte_recolle($contexte['texte'], $att_text); |
|
| 307 | - } |
|
| 308 | - |
|
| 309 | - // on veut conserver la langue de l'interface ; |
|
| 310 | - // on passe cette donnee sous un autre nom, au cas ou le squelette |
|
| 311 | - // voudrait l'exploiter |
|
| 312 | - if (isset($contexte['lang'])) { |
|
| 313 | - $contexte['langue'] = $contexte['lang']; |
|
| 314 | - unset($contexte['lang']); |
|
| 315 | - } |
|
| 316 | - |
|
| 317 | - $contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n" . |
|
| 318 | - (!$lier_trad ? '' : |
|
| 319 | - ("\n<input type='hidden' name='lier_trad' value='" . |
|
| 320 | - $lier_trad . |
|
| 321 | - "' />" . |
|
| 322 | - "\n<input type='hidden' name='changer_lang' value='" . |
|
| 323 | - $lang_default . |
|
| 324 | - "' />")) |
|
| 325 | - . $hidden |
|
| 326 | - . ($md5 ?? ''); |
|
| 327 | - |
|
| 328 | - // preciser que le formulaire doit passer dans un pipeline |
|
| 329 | - $contexte['_pipeline'] = ['editer_contenu_objet', ['type' => $type, 'id' => $id]]; |
|
| 330 | - |
|
| 331 | - // preciser que le formulaire doit etre securise auteur/action |
|
| 332 | - // n'est plus utile lorsque l'action accepte l'id en argument direct |
|
| 333 | - // on le garde pour compat |
|
| 334 | - $contexte['_action'] = ["editer_$type", $id]; |
|
| 335 | - |
|
| 336 | - // et in fine placer l'autorisation |
|
| 337 | - include_spip('inc/autoriser'); |
|
| 338 | - if (intval($id)) { |
|
| 339 | - if (!autoriser('modifier', $type, intval($id))) { |
|
| 340 | - $contexte['editable'] = ''; |
|
| 341 | - } |
|
| 342 | - } |
|
| 343 | - else { |
|
| 344 | - if (!autoriser('creer', $type, 0, null, ['id_parent' => $id_parent])) { |
|
| 345 | - $contexte['editable'] = ''; |
|
| 346 | - } |
|
| 347 | - } |
|
| 348 | - |
|
| 349 | - return $contexte; |
|
| 212 | + $table_objet = table_objet($type); |
|
| 213 | + $table_objet_sql = table_objet_sql($type); |
|
| 214 | + $id_table_objet = id_table_objet($type); |
|
| 215 | + if (!is_array($row)) { |
|
| 216 | + $row = []; |
|
| 217 | + } |
|
| 218 | + |
|
| 219 | + // on accepte pas une fonction de config inconnue si elle vient d'un modele |
|
| 220 | + if ( |
|
| 221 | + $config_fonc |
|
| 222 | + and !in_array($config_fonc, ['articles_edit_config', 'rubriques_edit_config', 'auteurs_edit_config']) |
|
| 223 | + and $config_fonc !== $table_objet . '_edit_config' |
|
| 224 | + ) { |
|
| 225 | + if ( |
|
| 226 | + $args = test_formulaire_inclus_par_modele() |
|
| 227 | + and in_array($config_fonc, $args) |
|
| 228 | + ) { |
|
| 229 | + $config_fonc = ''; |
|
| 230 | + } |
|
| 231 | + } |
|
| 232 | + |
|
| 233 | + $new = !is_numeric($id); |
|
| 234 | + $lang_default = ''; |
|
| 235 | + // Appel direct dans un squelette |
|
| 236 | + if (!$row) { |
|
| 237 | + if (!$new or $lier_trad) { |
|
| 238 | + if ($select = charger_fonction('precharger_' . $type, 'inc', true)) { |
|
| 239 | + $row = $select($id, $id_parent, $lier_trad); |
|
| 240 | + // si on a une fonction precharger, elle pu faire un reglage de langue |
|
| 241 | + $lang_default = (!empty($row['lang']) ? $row['lang'] : null); |
|
| 242 | + } else { |
|
| 243 | + $row = sql_fetsel('*', $table_objet_sql, $id_table_objet . '=' . intval($id)); |
|
| 244 | + } |
|
| 245 | + if (!$new) { |
|
| 246 | + $md5 = controles_md5($row ?: []); |
|
| 247 | + } |
|
| 248 | + } |
|
| 249 | + if (!$row) { |
|
| 250 | + $row = []; |
|
| 251 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 252 | + if ($desc = $trouver_table($table_objet)) { |
|
| 253 | + foreach ($desc['field'] as $k => $v) { |
|
| 254 | + $row[$k] = ''; |
|
| 255 | + } |
|
| 256 | + } |
|
| 257 | + } |
|
| 258 | + } |
|
| 259 | + |
|
| 260 | + // Gaffe: sans ceci, on ecrase systematiquement l'article d'origine |
|
| 261 | + // (et donc: pas de lien de traduction) |
|
| 262 | + $id = ($new or $lier_trad) |
|
| 263 | + ? 'oui' |
|
| 264 | + : $row[$id_table_objet]; |
|
| 265 | + $row[$id_table_objet] = $id; |
|
| 266 | + |
|
| 267 | + $contexte = $row; |
|
| 268 | + if (is_numeric($id_parent) && strlen($id_parent) && (!isset($contexte['id_parent']) or $new)) { |
|
| 269 | + if (!isset($contexte['id_parent'])) { |
|
| 270 | + unset($contexte['id_rubrique']); |
|
| 271 | + } |
|
| 272 | + $contexte['id_parent'] = $id_parent; |
|
| 273 | + } elseif (!isset($contexte['id_parent'])) { |
|
| 274 | + // id_rubrique dans id_parent si possible |
|
| 275 | + if (isset($contexte['id_rubrique'])) { |
|
| 276 | + $contexte['id_parent'] = $contexte['id_rubrique']; |
|
| 277 | + unset($contexte['id_rubrique']); |
|
| 278 | + } else { |
|
| 279 | + $contexte['id_parent'] = ''; |
|
| 280 | + } |
|
| 281 | + if ( |
|
| 282 | + !$contexte['id_parent'] |
|
| 283 | + and $preselectionner_parent_nouvel_objet = charger_fonction('preselectionner_parent_nouvel_objet', 'inc', true) |
|
| 284 | + ) { |
|
| 285 | + $contexte['id_parent'] = $preselectionner_parent_nouvel_objet($type, $row); |
|
| 286 | + } |
|
| 287 | + } |
|
| 288 | + |
|
| 289 | + $config = []; |
|
| 290 | + if ($config_fonc) { |
|
| 291 | + $contexte['config'] = $config = $config_fonc($contexte); |
|
| 292 | + if (!$lang_default) { |
|
| 293 | + $lang_default = $config['langue'] ?? session_get('lang') ; |
|
| 294 | + } |
|
| 295 | + } |
|
| 296 | + $config = $config + [ |
|
| 297 | + 'lignes' => 0, |
|
| 298 | + 'langue' => '', |
|
| 299 | + ]; |
|
| 300 | + |
|
| 301 | + $att_text = " class='textarea' " |
|
| 302 | + . " rows='" |
|
| 303 | + . ($config['lignes'] + 15) |
|
| 304 | + . "' cols='40'"; |
|
| 305 | + if (isset($contexte['texte'])) { |
|
| 306 | + [$contexte['texte'], $contexte['_texte_trop_long']] = editer_texte_recolle($contexte['texte'], $att_text); |
|
| 307 | + } |
|
| 308 | + |
|
| 309 | + // on veut conserver la langue de l'interface ; |
|
| 310 | + // on passe cette donnee sous un autre nom, au cas ou le squelette |
|
| 311 | + // voudrait l'exploiter |
|
| 312 | + if (isset($contexte['lang'])) { |
|
| 313 | + $contexte['langue'] = $contexte['lang']; |
|
| 314 | + unset($contexte['lang']); |
|
| 315 | + } |
|
| 316 | + |
|
| 317 | + $contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n" . |
|
| 318 | + (!$lier_trad ? '' : |
|
| 319 | + ("\n<input type='hidden' name='lier_trad' value='" . |
|
| 320 | + $lier_trad . |
|
| 321 | + "' />" . |
|
| 322 | + "\n<input type='hidden' name='changer_lang' value='" . |
|
| 323 | + $lang_default . |
|
| 324 | + "' />")) |
|
| 325 | + . $hidden |
|
| 326 | + . ($md5 ?? ''); |
|
| 327 | + |
|
| 328 | + // preciser que le formulaire doit passer dans un pipeline |
|
| 329 | + $contexte['_pipeline'] = ['editer_contenu_objet', ['type' => $type, 'id' => $id]]; |
|
| 330 | + |
|
| 331 | + // preciser que le formulaire doit etre securise auteur/action |
|
| 332 | + // n'est plus utile lorsque l'action accepte l'id en argument direct |
|
| 333 | + // on le garde pour compat |
|
| 334 | + $contexte['_action'] = ["editer_$type", $id]; |
|
| 335 | + |
|
| 336 | + // et in fine placer l'autorisation |
|
| 337 | + include_spip('inc/autoriser'); |
|
| 338 | + if (intval($id)) { |
|
| 339 | + if (!autoriser('modifier', $type, intval($id))) { |
|
| 340 | + $contexte['editable'] = ''; |
|
| 341 | + } |
|
| 342 | + } |
|
| 343 | + else { |
|
| 344 | + if (!autoriser('creer', $type, 0, null, ['id_parent' => $id_parent])) { |
|
| 345 | + $contexte['editable'] = ''; |
|
| 346 | + } |
|
| 347 | + } |
|
| 348 | + |
|
| 349 | + return $contexte; |
|
| 350 | 350 | } |
| 351 | 351 | |
| 352 | 352 | /** |
@@ -357,29 +357,29 @@ discard block |
||
| 357 | 357 | * @return array |
| 358 | 358 | */ |
| 359 | 359 | function coupe_trop_long($texte) { |
| 360 | - $aider = charger_fonction('aider', 'inc'); |
|
| 361 | - if (strlen($texte) > 28 * 1024) { |
|
| 362 | - $texte = str_replace("\r\n", "\n", $texte); |
|
| 363 | - $pos = strpos($texte, "\n\n", 28 * 1024); // coupe para > 28 ko |
|
| 364 | - if ($pos > 0 and $pos < 32 * 1024) { |
|
| 365 | - $debut = substr($texte, 0, $pos) . "\n\n<!--SPIP-->\n"; |
|
| 366 | - $suite = substr($texte, $pos + 2); |
|
| 367 | - } else { |
|
| 368 | - $pos = strpos($texte, ' ', 28 * 1024); // sinon coupe espace |
|
| 369 | - if (!($pos > 0 and $pos < 32 * 1024)) { |
|
| 370 | - $pos = 28 * 1024; // au pire (pas d'espace trouv'e) |
|
| 371 | - $decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere |
|
| 372 | - } else { |
|
| 373 | - $decalage = 1; |
|
| 374 | - } |
|
| 375 | - $debut = substr($texte, 0, $pos + $decalage); // Il faut conserver l'espace s'il y en a un |
|
| 376 | - $suite = substr($texte, $pos + $decalage); |
|
| 377 | - } |
|
| 378 | - |
|
| 379 | - return ([$debut, $suite]); |
|
| 380 | - } else { |
|
| 381 | - return ([$texte, '']); |
|
| 382 | - } |
|
| 360 | + $aider = charger_fonction('aider', 'inc'); |
|
| 361 | + if (strlen($texte) > 28 * 1024) { |
|
| 362 | + $texte = str_replace("\r\n", "\n", $texte); |
|
| 363 | + $pos = strpos($texte, "\n\n", 28 * 1024); // coupe para > 28 ko |
|
| 364 | + if ($pos > 0 and $pos < 32 * 1024) { |
|
| 365 | + $debut = substr($texte, 0, $pos) . "\n\n<!--SPIP-->\n"; |
|
| 366 | + $suite = substr($texte, $pos + 2); |
|
| 367 | + } else { |
|
| 368 | + $pos = strpos($texte, ' ', 28 * 1024); // sinon coupe espace |
|
| 369 | + if (!($pos > 0 and $pos < 32 * 1024)) { |
|
| 370 | + $pos = 28 * 1024; // au pire (pas d'espace trouv'e) |
|
| 371 | + $decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere |
|
| 372 | + } else { |
|
| 373 | + $decalage = 1; |
|
| 374 | + } |
|
| 375 | + $debut = substr($texte, 0, $pos + $decalage); // Il faut conserver l'espace s'il y en a un |
|
| 376 | + $suite = substr($texte, $pos + $decalage); |
|
| 377 | + } |
|
| 378 | + |
|
| 379 | + return ([$debut, $suite]); |
|
| 380 | + } else { |
|
| 381 | + return ([$texte, '']); |
|
| 382 | + } |
|
| 383 | 383 | } |
| 384 | 384 | |
| 385 | 385 | /** |
@@ -390,25 +390,25 @@ discard block |
||
| 390 | 390 | * @return array |
| 391 | 391 | */ |
| 392 | 392 | function editer_texte_recolle($texte, $att_text) { |
| 393 | - if ( |
|
| 394 | - (strlen($texte) < 29 * 1024) |
|
| 395 | - or (include_spip('inc/layer') and ($GLOBALS['browser_name'] != 'MSIE')) |
|
| 396 | - ) { |
|
| 397 | - return [$texte, '']; |
|
| 398 | - } |
|
| 399 | - |
|
| 400 | - include_spip('inc/barre'); |
|
| 401 | - $textes_supplement = "<br /><span style='color: red'>" . _T('info_texte_long') . "</span>\n"; |
|
| 402 | - $nombre = 0; |
|
| 403 | - |
|
| 404 | - while (strlen($texte) > 29 * 1024) { |
|
| 405 | - $nombre++; |
|
| 406 | - [$texte1, $texte] = coupe_trop_long($texte); |
|
| 407 | - $textes_supplement .= '<br />' . |
|
| 408 | - "<textarea id='texte$nombre' name='texte_plus[$nombre]'$att_text>$texte1</textarea>\n"; |
|
| 409 | - } |
|
| 410 | - |
|
| 411 | - return [$texte, $textes_supplement]; |
|
| 393 | + if ( |
|
| 394 | + (strlen($texte) < 29 * 1024) |
|
| 395 | + or (include_spip('inc/layer') and ($GLOBALS['browser_name'] != 'MSIE')) |
|
| 396 | + ) { |
|
| 397 | + return [$texte, '']; |
|
| 398 | + } |
|
| 399 | + |
|
| 400 | + include_spip('inc/barre'); |
|
| 401 | + $textes_supplement = "<br /><span style='color: red'>" . _T('info_texte_long') . "</span>\n"; |
|
| 402 | + $nombre = 0; |
|
| 403 | + |
|
| 404 | + while (strlen($texte) > 29 * 1024) { |
|
| 405 | + $nombre++; |
|
| 406 | + [$texte1, $texte] = coupe_trop_long($texte); |
|
| 407 | + $textes_supplement .= '<br />' . |
|
| 408 | + "<textarea id='texte$nombre' name='texte_plus[$nombre]'$att_text>$texte1</textarea>\n"; |
|
| 409 | + } |
|
| 410 | + |
|
| 411 | + return [$texte, $textes_supplement]; |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | /** |
@@ -419,17 +419,17 @@ discard block |
||
| 419 | 419 | * @param int $longueur |
| 420 | 420 | */ |
| 421 | 421 | function titre_automatique($champ_titre, $champs_contenu, $longueur = null) { |
| 422 | - if (!_request($champ_titre)) { |
|
| 423 | - $titrer_contenu = charger_fonction('titrer_contenu', 'inc'); |
|
| 424 | - if (!is_null($longueur)) { |
|
| 425 | - $t = $titrer_contenu($champs_contenu, null, $longueur); |
|
| 426 | - } else { |
|
| 427 | - $t = $titrer_contenu($champs_contenu); |
|
| 428 | - } |
|
| 429 | - if ($t) { |
|
| 430 | - set_request($champ_titre, $t); |
|
| 431 | - } |
|
| 432 | - } |
|
| 422 | + if (!_request($champ_titre)) { |
|
| 423 | + $titrer_contenu = charger_fonction('titrer_contenu', 'inc'); |
|
| 424 | + if (!is_null($longueur)) { |
|
| 425 | + $t = $titrer_contenu($champs_contenu, null, $longueur); |
|
| 426 | + } else { |
|
| 427 | + $t = $titrer_contenu($champs_contenu); |
|
| 428 | + } |
|
| 429 | + if ($t) { |
|
| 430 | + set_request($champ_titre, $t); |
|
| 431 | + } |
|
| 432 | + } |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | /** |
@@ -449,20 +449,20 @@ discard block |
||
| 449 | 449 | * @return string |
| 450 | 450 | */ |
| 451 | 451 | function inc_titrer_contenu_dist($champs_contenu, $c = null, $longueur = 50) { |
| 452 | - // trouver un champ texte non vide |
|
| 453 | - $t = ''; |
|
| 454 | - foreach ($champs_contenu as $champ) { |
|
| 455 | - if ($t = _request($champ, $c)) { |
|
| 456 | - break; |
|
| 457 | - } |
|
| 458 | - } |
|
| 459 | - |
|
| 460 | - if ($t) { |
|
| 461 | - include_spip('inc/texte_mini'); |
|
| 462 | - $t = couper($t, $longueur, '...'); |
|
| 463 | - } |
|
| 464 | - |
|
| 465 | - return $t; |
|
| 452 | + // trouver un champ texte non vide |
|
| 453 | + $t = ''; |
|
| 454 | + foreach ($champs_contenu as $champ) { |
|
| 455 | + if ($t = _request($champ, $c)) { |
|
| 456 | + break; |
|
| 457 | + } |
|
| 458 | + } |
|
| 459 | + |
|
| 460 | + if ($t) { |
|
| 461 | + include_spip('inc/texte_mini'); |
|
| 462 | + $t = couper($t, $longueur, '...'); |
|
| 463 | + } |
|
| 464 | + |
|
| 465 | + return $t; |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | /** |
@@ -484,26 +484,26 @@ discard block |
||
| 484 | 484 | * - array sinon couples ('$prefixe$colonne => md5) |
| 485 | 485 | **/ |
| 486 | 486 | function controles_md5(array $data, string $prefixe = 'ctr_', string $format = 'html') { |
| 487 | - $ctr = []; |
|
| 488 | - foreach ($data as $key => $val) { |
|
| 489 | - $m = md5($val ?? ''); |
|
| 490 | - $k = $prefixe . $key; |
|
| 491 | - |
|
| 492 | - switch ($format) { |
|
| 493 | - case 'html': |
|
| 494 | - $ctr[$k] = "<input type='hidden' value='$m' name='$k' />"; |
|
| 495 | - break; |
|
| 496 | - default: |
|
| 497 | - $ctr[$k] = $m; |
|
| 498 | - break; |
|
| 499 | - } |
|
| 500 | - } |
|
| 501 | - |
|
| 502 | - if ($format === 'html') { |
|
| 503 | - return "\n\n<!-- controles md5 -->\n" . join("\n", $ctr) . "\n\n"; |
|
| 504 | - } else { |
|
| 505 | - return $ctr; |
|
| 506 | - } |
|
| 487 | + $ctr = []; |
|
| 488 | + foreach ($data as $key => $val) { |
|
| 489 | + $m = md5($val ?? ''); |
|
| 490 | + $k = $prefixe . $key; |
|
| 491 | + |
|
| 492 | + switch ($format) { |
|
| 493 | + case 'html': |
|
| 494 | + $ctr[$k] = "<input type='hidden' value='$m' name='$k' />"; |
|
| 495 | + break; |
|
| 496 | + default: |
|
| 497 | + $ctr[$k] = $m; |
|
| 498 | + break; |
|
| 499 | + } |
|
| 500 | + } |
|
| 501 | + |
|
| 502 | + if ($format === 'html') { |
|
| 503 | + return "\n\n<!-- controles md5 -->\n" . join("\n", $ctr) . "\n\n"; |
|
| 504 | + } else { |
|
| 505 | + return $ctr; |
|
| 506 | + } |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | /** |
@@ -542,80 +542,80 @@ discard block |
||
| 542 | 542 | * - post : le contenu posté |
| 543 | 543 | **/ |
| 544 | 544 | function controler_contenu($type, $id, $options = [], $c = false, $serveur = '') { |
| 545 | - include_spip('inc/filtres'); |
|
| 546 | - |
|
| 547 | - $table_objet = table_objet($type); |
|
| 548 | - $spip_table_objet = table_objet_sql($type); |
|
| 549 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 550 | - $desc = $trouver_table($table_objet, $serveur); |
|
| 551 | - |
|
| 552 | - // Appels incomplets (sans $c) |
|
| 553 | - if (!is_array($c)) { |
|
| 554 | - $c = []; |
|
| 555 | - foreach ($desc['field'] as $champ => $ignore) { |
|
| 556 | - if (_request($champ)) { |
|
| 557 | - $c[$champ] = _request($champ); |
|
| 558 | - } |
|
| 559 | - } |
|
| 560 | - } |
|
| 561 | - |
|
| 562 | - // Securite : certaines variables ne sont jamais acceptees ici |
|
| 563 | - // car elles ne relevent pas de autoriser(article, modifier) ; |
|
| 564 | - // il faut passer par instituer_XX() |
|
| 565 | - // TODO: faut-il passer ces variables interdites |
|
| 566 | - // dans un fichier de description separe ? |
|
| 567 | - unset($c['statut']); |
|
| 568 | - unset($c['id_parent']); |
|
| 569 | - unset($c['id_rubrique']); |
|
| 570 | - unset($c['id_secteur']); |
|
| 571 | - |
|
| 572 | - // Gerer les champs non vides |
|
| 573 | - if (isset($options['nonvide']) and is_array($options['nonvide'])) { |
|
| 574 | - foreach ($options['nonvide'] as $champ => $sinon) { |
|
| 575 | - if ($c[$champ] === '') { |
|
| 576 | - $c[$champ] = $sinon; |
|
| 577 | - } |
|
| 578 | - } |
|
| 579 | - } |
|
| 580 | - |
|
| 581 | - // N'accepter que les champs qui existent |
|
| 582 | - // [TODO] ici aussi on peut valider les contenus en fonction du type |
|
| 583 | - $champs = []; |
|
| 584 | - foreach ($desc['field'] as $champ => $ignore) { |
|
| 585 | - if (isset($c[$champ])) { |
|
| 586 | - $champs[$champ] = $c[$champ]; |
|
| 587 | - } |
|
| 588 | - } |
|
| 589 | - |
|
| 590 | - // Nettoyer les valeurs |
|
| 591 | - $champs = array_map('corriger_caracteres', $champs); |
|
| 592 | - |
|
| 593 | - // Envoyer aux plugins |
|
| 594 | - $champs = pipeline( |
|
| 595 | - 'pre_edition', |
|
| 596 | - [ |
|
| 597 | - 'args' => [ |
|
| 598 | - 'table' => $spip_table_objet, // compatibilite |
|
| 599 | - 'table_objet' => $table_objet, |
|
| 600 | - 'spip_table_objet' => $spip_table_objet, |
|
| 601 | - 'type' => $type, |
|
| 602 | - 'id_objet' => $id, |
|
| 603 | - 'champs' => $options['champs'] ?? [], // [doc] c'est quoi ? |
|
| 604 | - 'action' => 'controler', |
|
| 605 | - 'serveur' => $serveur, |
|
| 606 | - ], |
|
| 607 | - 'data' => $champs |
|
| 608 | - ] |
|
| 609 | - ); |
|
| 610 | - |
|
| 611 | - if (!$champs) { |
|
| 612 | - return false; |
|
| 613 | - } |
|
| 614 | - |
|
| 615 | - // Verifier si les mises a jour sont pertinentes, datees, en conflit etc |
|
| 616 | - $conflits = controler_md5($champs, $_POST, $type, $id, $serveur, $options['prefix'] ?? 'ctr_'); |
|
| 617 | - |
|
| 618 | - return $conflits; |
|
| 545 | + include_spip('inc/filtres'); |
|
| 546 | + |
|
| 547 | + $table_objet = table_objet($type); |
|
| 548 | + $spip_table_objet = table_objet_sql($type); |
|
| 549 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 550 | + $desc = $trouver_table($table_objet, $serveur); |
|
| 551 | + |
|
| 552 | + // Appels incomplets (sans $c) |
|
| 553 | + if (!is_array($c)) { |
|
| 554 | + $c = []; |
|
| 555 | + foreach ($desc['field'] as $champ => $ignore) { |
|
| 556 | + if (_request($champ)) { |
|
| 557 | + $c[$champ] = _request($champ); |
|
| 558 | + } |
|
| 559 | + } |
|
| 560 | + } |
|
| 561 | + |
|
| 562 | + // Securite : certaines variables ne sont jamais acceptees ici |
|
| 563 | + // car elles ne relevent pas de autoriser(article, modifier) ; |
|
| 564 | + // il faut passer par instituer_XX() |
|
| 565 | + // TODO: faut-il passer ces variables interdites |
|
| 566 | + // dans un fichier de description separe ? |
|
| 567 | + unset($c['statut']); |
|
| 568 | + unset($c['id_parent']); |
|
| 569 | + unset($c['id_rubrique']); |
|
| 570 | + unset($c['id_secteur']); |
|
| 571 | + |
|
| 572 | + // Gerer les champs non vides |
|
| 573 | + if (isset($options['nonvide']) and is_array($options['nonvide'])) { |
|
| 574 | + foreach ($options['nonvide'] as $champ => $sinon) { |
|
| 575 | + if ($c[$champ] === '') { |
|
| 576 | + $c[$champ] = $sinon; |
|
| 577 | + } |
|
| 578 | + } |
|
| 579 | + } |
|
| 580 | + |
|
| 581 | + // N'accepter que les champs qui existent |
|
| 582 | + // [TODO] ici aussi on peut valider les contenus en fonction du type |
|
| 583 | + $champs = []; |
|
| 584 | + foreach ($desc['field'] as $champ => $ignore) { |
|
| 585 | + if (isset($c[$champ])) { |
|
| 586 | + $champs[$champ] = $c[$champ]; |
|
| 587 | + } |
|
| 588 | + } |
|
| 589 | + |
|
| 590 | + // Nettoyer les valeurs |
|
| 591 | + $champs = array_map('corriger_caracteres', $champs); |
|
| 592 | + |
|
| 593 | + // Envoyer aux plugins |
|
| 594 | + $champs = pipeline( |
|
| 595 | + 'pre_edition', |
|
| 596 | + [ |
|
| 597 | + 'args' => [ |
|
| 598 | + 'table' => $spip_table_objet, // compatibilite |
|
| 599 | + 'table_objet' => $table_objet, |
|
| 600 | + 'spip_table_objet' => $spip_table_objet, |
|
| 601 | + 'type' => $type, |
|
| 602 | + 'id_objet' => $id, |
|
| 603 | + 'champs' => $options['champs'] ?? [], // [doc] c'est quoi ? |
|
| 604 | + 'action' => 'controler', |
|
| 605 | + 'serveur' => $serveur, |
|
| 606 | + ], |
|
| 607 | + 'data' => $champs |
|
| 608 | + ] |
|
| 609 | + ); |
|
| 610 | + |
|
| 611 | + if (!$champs) { |
|
| 612 | + return false; |
|
| 613 | + } |
|
| 614 | + |
|
| 615 | + // Verifier si les mises a jour sont pertinentes, datees, en conflit etc |
|
| 616 | + $conflits = controler_md5($champs, $_POST, $type, $id, $serveur, $options['prefix'] ?? 'ctr_'); |
|
| 617 | + |
|
| 618 | + return $conflits; |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | |
@@ -645,64 +645,64 @@ discard block |
||
| 645 | 645 | * - post : le contenu posté |
| 646 | 646 | **/ |
| 647 | 647 | function controler_md5(&$champs, $ctr, $type, $id, $serveur, $prefix = 'ctr_') { |
| 648 | - $spip_table_objet = table_objet_sql($type); |
|
| 649 | - $id_table_objet = id_table_objet($type); |
|
| 650 | - |
|
| 651 | - // Controle des MD5 envoyes |
|
| 652 | - // On elimine les donnees non modifiees par le formulaire (mais |
|
| 653 | - // potentiellement modifiees entre temps par un autre utilisateur) |
|
| 654 | - foreach ($champs as $key => $val) { |
|
| 655 | - if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) { |
|
| 656 | - if (is_scalar($val) and $m == md5($val)) { |
|
| 657 | - unset($champs[$key]); |
|
| 658 | - } |
|
| 659 | - } |
|
| 660 | - } |
|
| 661 | - if (!$champs) { |
|
| 662 | - return; |
|
| 663 | - } |
|
| 664 | - |
|
| 665 | - // On veut savoir si notre modif va avoir un impact |
|
| 666 | - // par rapport aux donnees contenues dans la base |
|
| 667 | - // (qui peuvent etre differentes de celles ayant servi a calculer le ctr) |
|
| 668 | - $s = sql_fetsel(array_keys($champs), $spip_table_objet, "$id_table_objet=$id", $serveur); |
|
| 669 | - $intact = true; |
|
| 670 | - foreach ($champs as $ch => $val) { |
|
| 671 | - $intact &= ($s[$ch] == $val); |
|
| 672 | - } |
|
| 673 | - if ($intact) { |
|
| 674 | - return; |
|
| 675 | - } |
|
| 676 | - |
|
| 677 | - // Detection de conflits : |
|
| 678 | - // On verifie si notre modif ne provient pas d'un formulaire |
|
| 679 | - // genere a partir de donnees modifiees dans l'intervalle ; ici |
|
| 680 | - // on compare a ce qui est dans la base, et on bloque en cas |
|
| 681 | - // de conflit. |
|
| 682 | - $ctrh = $ctrq = $conflits = []; |
|
| 683 | - foreach (array_keys($champs) as $key) { |
|
| 684 | - if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) { |
|
| 685 | - $ctrh[$key] = $m; |
|
| 686 | - $ctrq[] = $key; |
|
| 687 | - } |
|
| 688 | - } |
|
| 689 | - if ($ctrq) { |
|
| 690 | - $ctrq = sql_fetsel($ctrq, $spip_table_objet, "$id_table_objet=$id", $serveur); |
|
| 691 | - foreach ($ctrh as $key => $m) { |
|
| 692 | - if ( |
|
| 693 | - $m != md5($ctrq[$key]) |
|
| 694 | - and $champs[$key] !== $ctrq[$key] |
|
| 695 | - ) { |
|
| 696 | - $conflits[$key] = [ |
|
| 697 | - 'base' => $ctrq[$key], |
|
| 698 | - 'post' => $champs[$key] |
|
| 699 | - ]; |
|
| 700 | - unset($champs[$key]); # stocker quand meme les modifs ? |
|
| 701 | - } |
|
| 702 | - } |
|
| 703 | - } |
|
| 704 | - |
|
| 705 | - return $conflits; |
|
| 648 | + $spip_table_objet = table_objet_sql($type); |
|
| 649 | + $id_table_objet = id_table_objet($type); |
|
| 650 | + |
|
| 651 | + // Controle des MD5 envoyes |
|
| 652 | + // On elimine les donnees non modifiees par le formulaire (mais |
|
| 653 | + // potentiellement modifiees entre temps par un autre utilisateur) |
|
| 654 | + foreach ($champs as $key => $val) { |
|
| 655 | + if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) { |
|
| 656 | + if (is_scalar($val) and $m == md5($val)) { |
|
| 657 | + unset($champs[$key]); |
|
| 658 | + } |
|
| 659 | + } |
|
| 660 | + } |
|
| 661 | + if (!$champs) { |
|
| 662 | + return; |
|
| 663 | + } |
|
| 664 | + |
|
| 665 | + // On veut savoir si notre modif va avoir un impact |
|
| 666 | + // par rapport aux donnees contenues dans la base |
|
| 667 | + // (qui peuvent etre differentes de celles ayant servi a calculer le ctr) |
|
| 668 | + $s = sql_fetsel(array_keys($champs), $spip_table_objet, "$id_table_objet=$id", $serveur); |
|
| 669 | + $intact = true; |
|
| 670 | + foreach ($champs as $ch => $val) { |
|
| 671 | + $intact &= ($s[$ch] == $val); |
|
| 672 | + } |
|
| 673 | + if ($intact) { |
|
| 674 | + return; |
|
| 675 | + } |
|
| 676 | + |
|
| 677 | + // Detection de conflits : |
|
| 678 | + // On verifie si notre modif ne provient pas d'un formulaire |
|
| 679 | + // genere a partir de donnees modifiees dans l'intervalle ; ici |
|
| 680 | + // on compare a ce qui est dans la base, et on bloque en cas |
|
| 681 | + // de conflit. |
|
| 682 | + $ctrh = $ctrq = $conflits = []; |
|
| 683 | + foreach (array_keys($champs) as $key) { |
|
| 684 | + if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) { |
|
| 685 | + $ctrh[$key] = $m; |
|
| 686 | + $ctrq[] = $key; |
|
| 687 | + } |
|
| 688 | + } |
|
| 689 | + if ($ctrq) { |
|
| 690 | + $ctrq = sql_fetsel($ctrq, $spip_table_objet, "$id_table_objet=$id", $serveur); |
|
| 691 | + foreach ($ctrh as $key => $m) { |
|
| 692 | + if ( |
|
| 693 | + $m != md5($ctrq[$key]) |
|
| 694 | + and $champs[$key] !== $ctrq[$key] |
|
| 695 | + ) { |
|
| 696 | + $conflits[$key] = [ |
|
| 697 | + 'base' => $ctrq[$key], |
|
| 698 | + 'post' => $champs[$key] |
|
| 699 | + ]; |
|
| 700 | + unset($champs[$key]); # stocker quand meme les modifs ? |
|
| 701 | + } |
|
| 702 | + } |
|
| 703 | + } |
|
| 704 | + |
|
| 705 | + return $conflits; |
|
| 706 | 706 | } |
| 707 | 707 | |
| 708 | 708 | /** |
@@ -714,9 +714,9 @@ discard block |
||
| 714 | 714 | * @return string |
| 715 | 715 | */ |
| 716 | 716 | function display_conflit_champ($x) { |
| 717 | - if (strstr($x, "\n") or strlen($x) > 80) { |
|
| 718 | - return "<textarea style='width:99%; height:10em;'>" . entites_html($x) . "</textarea>\n"; |
|
| 719 | - } else { |
|
| 720 | - return "<input type='text' size='40' style='width:99%' value=\"" . entites_html($x) . "\" />\n"; |
|
| 721 | - } |
|
| 717 | + if (strstr($x, "\n") or strlen($x) > 80) { |
|
| 718 | + return "<textarea style='width:99%; height:10em;'>" . entites_html($x) . "</textarea>\n"; |
|
| 719 | + } else { |
|
| 720 | + return "<input type='text' size='40' style='width:99%' value=\"" . entites_html($x) . "\" />\n"; |
|
| 721 | + } |
|
| 722 | 722 | } |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | $res['message_ok'] = _T('info_modification_enregistree'); |
| 101 | 101 | if ($retour) { |
| 102 | 102 | if (strncmp($retour, 'javascript:', 11) == 0) { |
| 103 | - $res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/' . substr($retour, 11) . '/*]]>*/</script>'; |
|
| 103 | + $res['message_ok'] .= '<script type="text/javascript">/*<![CDATA[*/'.substr($retour, 11).'/*]]>*/</script>'; |
|
| 104 | 104 | $res['editable'] = true; |
| 105 | 105 | } else { |
| 106 | 106 | $res['redirect'] = parametre_url($retour, $id_table_objet, $id); |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | if (!isset($erreurs[$champ])) { |
| 141 | 141 | $erreurs[$champ] = ''; |
| 142 | 142 | } |
| 143 | - $erreurs[$champ] .= _T('alerte_modif_info_concourante') . "<br /><textarea readonly='readonly' class='forml'>" . entites_html($conflit['base']) . '</textarea>'; |
|
| 143 | + $erreurs[$champ] .= _T('alerte_modif_info_concourante')."<br /><textarea readonly='readonly' class='forml'>".entites_html($conflit['base']).'</textarea>'; |
|
| 144 | 144 | } |
| 145 | 145 | } |
| 146 | 146 | } |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | if ( |
| 221 | 221 | $config_fonc |
| 222 | 222 | and !in_array($config_fonc, ['articles_edit_config', 'rubriques_edit_config', 'auteurs_edit_config']) |
| 223 | - and $config_fonc !== $table_objet . '_edit_config' |
|
| 223 | + and $config_fonc !== $table_objet.'_edit_config' |
|
| 224 | 224 | ) { |
| 225 | 225 | if ( |
| 226 | 226 | $args = test_formulaire_inclus_par_modele() |
@@ -235,12 +235,12 @@ discard block |
||
| 235 | 235 | // Appel direct dans un squelette |
| 236 | 236 | if (!$row) { |
| 237 | 237 | if (!$new or $lier_trad) { |
| 238 | - if ($select = charger_fonction('precharger_' . $type, 'inc', true)) { |
|
| 238 | + if ($select = charger_fonction('precharger_'.$type, 'inc', true)) { |
|
| 239 | 239 | $row = $select($id, $id_parent, $lier_trad); |
| 240 | 240 | // si on a une fonction precharger, elle pu faire un reglage de langue |
| 241 | 241 | $lang_default = (!empty($row['lang']) ? $row['lang'] : null); |
| 242 | 242 | } else { |
| 243 | - $row = sql_fetsel('*', $table_objet_sql, $id_table_objet . '=' . intval($id)); |
|
| 243 | + $row = sql_fetsel('*', $table_objet_sql, $id_table_objet.'='.intval($id)); |
|
| 244 | 244 | } |
| 245 | 245 | if (!$new) { |
| 246 | 246 | $md5 = controles_md5($row ?: []); |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | if ($config_fonc) { |
| 291 | 291 | $contexte['config'] = $config = $config_fonc($contexte); |
| 292 | 292 | if (!$lang_default) { |
| 293 | - $lang_default = $config['langue'] ?? session_get('lang') ; |
|
| 293 | + $lang_default = $config['langue'] ?? session_get('lang'); |
|
| 294 | 294 | } |
| 295 | 295 | } |
| 296 | 296 | $config = $config + [ |
@@ -314,13 +314,12 @@ discard block |
||
| 314 | 314 | unset($contexte['lang']); |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - $contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n" . |
|
| 318 | - (!$lier_trad ? '' : |
|
| 319 | - ("\n<input type='hidden' name='lier_trad' value='" . |
|
| 320 | - $lier_trad . |
|
| 321 | - "' />" . |
|
| 322 | - "\n<input type='hidden' name='changer_lang' value='" . |
|
| 323 | - $lang_default . |
|
| 317 | + $contexte['_hidden'] = "<input type='hidden' name='editer_$type' value='oui' />\n". |
|
| 318 | + (!$lier_trad ? '' : ("\n<input type='hidden' name='lier_trad' value='". |
|
| 319 | + $lier_trad. |
|
| 320 | + "' />". |
|
| 321 | + "\n<input type='hidden' name='changer_lang' value='". |
|
| 322 | + $lang_default. |
|
| 324 | 323 | "' />")) |
| 325 | 324 | . $hidden |
| 326 | 325 | . ($md5 ?? ''); |
@@ -360,14 +359,14 @@ discard block |
||
| 360 | 359 | $aider = charger_fonction('aider', 'inc'); |
| 361 | 360 | if (strlen($texte) > 28 * 1024) { |
| 362 | 361 | $texte = str_replace("\r\n", "\n", $texte); |
| 363 | - $pos = strpos($texte, "\n\n", 28 * 1024); // coupe para > 28 ko |
|
| 362 | + $pos = strpos($texte, "\n\n", 28 * 1024); // coupe para > 28 ko |
|
| 364 | 363 | if ($pos > 0 and $pos < 32 * 1024) { |
| 365 | - $debut = substr($texte, 0, $pos) . "\n\n<!--SPIP-->\n"; |
|
| 364 | + $debut = substr($texte, 0, $pos)."\n\n<!--SPIP-->\n"; |
|
| 366 | 365 | $suite = substr($texte, $pos + 2); |
| 367 | 366 | } else { |
| 368 | - $pos = strpos($texte, ' ', 28 * 1024); // sinon coupe espace |
|
| 367 | + $pos = strpos($texte, ' ', 28 * 1024); // sinon coupe espace |
|
| 369 | 368 | if (!($pos > 0 and $pos < 32 * 1024)) { |
| 370 | - $pos = 28 * 1024; // au pire (pas d'espace trouv'e) |
|
| 369 | + $pos = 28 * 1024; // au pire (pas d'espace trouv'e) |
|
| 371 | 370 | $decalage = 0; // si y'a pas d'espace, il ne faut pas perdre le caract`ere |
| 372 | 371 | } else { |
| 373 | 372 | $decalage = 1; |
@@ -398,13 +397,13 @@ discard block |
||
| 398 | 397 | } |
| 399 | 398 | |
| 400 | 399 | include_spip('inc/barre'); |
| 401 | - $textes_supplement = "<br /><span style='color: red'>" . _T('info_texte_long') . "</span>\n"; |
|
| 400 | + $textes_supplement = "<br /><span style='color: red'>"._T('info_texte_long')."</span>\n"; |
|
| 402 | 401 | $nombre = 0; |
| 403 | 402 | |
| 404 | 403 | while (strlen($texte) > 29 * 1024) { |
| 405 | 404 | $nombre++; |
| 406 | 405 | [$texte1, $texte] = coupe_trop_long($texte); |
| 407 | - $textes_supplement .= '<br />' . |
|
| 406 | + $textes_supplement .= '<br />'. |
|
| 408 | 407 | "<textarea id='texte$nombre' name='texte_plus[$nombre]'$att_text>$texte1</textarea>\n"; |
| 409 | 408 | } |
| 410 | 409 | |
@@ -487,7 +486,7 @@ discard block |
||
| 487 | 486 | $ctr = []; |
| 488 | 487 | foreach ($data as $key => $val) { |
| 489 | 488 | $m = md5($val ?? ''); |
| 490 | - $k = $prefixe . $key; |
|
| 489 | + $k = $prefixe.$key; |
|
| 491 | 490 | |
| 492 | 491 | switch ($format) { |
| 493 | 492 | case 'html': |
@@ -500,7 +499,7 @@ discard block |
||
| 500 | 499 | } |
| 501 | 500 | |
| 502 | 501 | if ($format === 'html') { |
| 503 | - return "\n\n<!-- controles md5 -->\n" . join("\n", $ctr) . "\n\n"; |
|
| 502 | + return "\n\n<!-- controles md5 -->\n".join("\n", $ctr)."\n\n"; |
|
| 504 | 503 | } else { |
| 505 | 504 | return $ctr; |
| 506 | 505 | } |
@@ -652,7 +651,7 @@ discard block |
||
| 652 | 651 | // On elimine les donnees non modifiees par le formulaire (mais |
| 653 | 652 | // potentiellement modifiees entre temps par un autre utilisateur) |
| 654 | 653 | foreach ($champs as $key => $val) { |
| 655 | - if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) { |
|
| 654 | + if (isset($ctr[$prefix.$key]) and $m = $ctr[$prefix.$key]) { |
|
| 656 | 655 | if (is_scalar($val) and $m == md5($val)) { |
| 657 | 656 | unset($champs[$key]); |
| 658 | 657 | } |
@@ -681,7 +680,7 @@ discard block |
||
| 681 | 680 | // de conflit. |
| 682 | 681 | $ctrh = $ctrq = $conflits = []; |
| 683 | 682 | foreach (array_keys($champs) as $key) { |
| 684 | - if (isset($ctr[$prefix . $key]) and $m = $ctr[$prefix . $key]) { |
|
| 683 | + if (isset($ctr[$prefix.$key]) and $m = $ctr[$prefix.$key]) { |
|
| 685 | 684 | $ctrh[$key] = $m; |
| 686 | 685 | $ctrq[] = $key; |
| 687 | 686 | } |
@@ -715,8 +714,8 @@ discard block |
||
| 715 | 714 | */ |
| 716 | 715 | function display_conflit_champ($x) { |
| 717 | 716 | if (strstr($x, "\n") or strlen($x) > 80) { |
| 718 | - return "<textarea style='width:99%; height:10em;'>" . entites_html($x) . "</textarea>\n"; |
|
| 717 | + return "<textarea style='width:99%; height:10em;'>".entites_html($x)."</textarea>\n"; |
|
| 719 | 718 | } else { |
| 720 | - return "<input type='text' size='40' style='width:99%' value=\"" . entites_html($x) . "\" />\n"; |
|
| 719 | + return "<input type='text' size='40' style='width:99%' value=\"".entites_html($x)."\" />\n"; |
|
| 721 | 720 | } |
| 722 | 721 | } |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -21,31 +21,31 @@ discard block |
||
| 21 | 21 | * @return array |
| 22 | 22 | */ |
| 23 | 23 | function plugins_extraire_boutons_dist($arbre) { |
| 24 | - $les_boutons = null; |
|
| 25 | - $ret = ['bouton' => [], 'onglet' => []]; |
|
| 26 | - // recuperer les boutons et onglets si necessaire |
|
| 27 | - spip_xml_match_nodes(',^(bouton|onglet)\s,', $arbre, $les_boutons); |
|
| 28 | - if (is_array($les_boutons) && count($les_boutons)) { |
|
| 29 | - $ret['bouton'] = []; |
|
| 30 | - $ret['onglet'] = []; |
|
| 31 | - foreach ($les_boutons as $bouton => $val) { |
|
| 32 | - $bouton = spip_xml_decompose_tag($bouton); |
|
| 33 | - $type = reset($bouton); |
|
| 34 | - $bouton = end($bouton); |
|
| 35 | - if (isset($bouton['id'])) { |
|
| 36 | - $id = $bouton['id']; |
|
| 37 | - $val = reset($val); |
|
| 38 | - if (is_array($val)) { |
|
| 39 | - $ret[$type][$id]['parent'] = $bouton['parent'] ?? ''; |
|
| 40 | - $ret[$type][$id]['position'] = $bouton['position'] ?? ''; |
|
| 41 | - $ret[$type][$id]['titre'] = isset($val['titre']) ? trim(spip_xml_aplatit($val['titre'])) : ''; |
|
| 42 | - $ret[$type][$id]['icone'] = isset($val['icone']) ? trim(end($val['icone'])) : ''; |
|
| 43 | - $ret[$type][$id]['action'] = isset($val['url']) ? trim(end($val['url'])) : ''; |
|
| 44 | - $ret[$type][$id]['parametres'] = isset($val['args']) ? trim(end($val['args'])) : ''; |
|
| 45 | - } |
|
| 46 | - } |
|
| 47 | - } |
|
| 48 | - } |
|
| 24 | + $les_boutons = null; |
|
| 25 | + $ret = ['bouton' => [], 'onglet' => []]; |
|
| 26 | + // recuperer les boutons et onglets si necessaire |
|
| 27 | + spip_xml_match_nodes(',^(bouton|onglet)\s,', $arbre, $les_boutons); |
|
| 28 | + if (is_array($les_boutons) && count($les_boutons)) { |
|
| 29 | + $ret['bouton'] = []; |
|
| 30 | + $ret['onglet'] = []; |
|
| 31 | + foreach ($les_boutons as $bouton => $val) { |
|
| 32 | + $bouton = spip_xml_decompose_tag($bouton); |
|
| 33 | + $type = reset($bouton); |
|
| 34 | + $bouton = end($bouton); |
|
| 35 | + if (isset($bouton['id'])) { |
|
| 36 | + $id = $bouton['id']; |
|
| 37 | + $val = reset($val); |
|
| 38 | + if (is_array($val)) { |
|
| 39 | + $ret[$type][$id]['parent'] = $bouton['parent'] ?? ''; |
|
| 40 | + $ret[$type][$id]['position'] = $bouton['position'] ?? ''; |
|
| 41 | + $ret[$type][$id]['titre'] = isset($val['titre']) ? trim(spip_xml_aplatit($val['titre'])) : ''; |
|
| 42 | + $ret[$type][$id]['icone'] = isset($val['icone']) ? trim(end($val['icone'])) : ''; |
|
| 43 | + $ret[$type][$id]['action'] = isset($val['url']) ? trim(end($val['url'])) : ''; |
|
| 44 | + $ret[$type][$id]['parametres'] = isset($val['args']) ? trim(end($val['args'])) : ''; |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | + } |
|
| 48 | + } |
|
| 49 | 49 | |
| 50 | - return $ret; |
|
| 50 | + return $ret; |
|
| 51 | 51 | } |
@@ -46,11 +46,11 @@ discard block |
||
| 46 | 46 | } |
| 47 | 47 | ob_start(); |
| 48 | 48 | if (strpos($page['texte'], '?xml') !== false) { |
| 49 | - $page['texte'] = str_replace('<' . '?xml', "<\1?xml", $page['texte']); |
|
| 49 | + $page['texte'] = str_replace('<'.'?xml', "<\1?xml", $page['texte']); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | try { |
| 53 | - $res = eval('?' . '>' . $page['texte']); |
|
| 53 | + $res = eval('?'.'>'.$page['texte']); |
|
| 54 | 54 | $page['texte'] = ob_get_contents(); |
| 55 | 55 | } catch (\Throwable $e) { |
| 56 | 56 | $code = $page['texte']; |
@@ -58,12 +58,12 @@ discard block |
||
| 58 | 58 | if (!function_exists('numerote_ligne_php')) { |
| 59 | 59 | function numerote_ligne_php($match) { |
| 60 | 60 | $GLOBALS['numero_ligne_php']++; |
| 61 | - return "\n/*" . str_pad($GLOBALS['numero_ligne_php'], 3, '0', STR_PAD_LEFT) . '*/'; |
|
| 61 | + return "\n/*".str_pad($GLOBALS['numero_ligne_php'], 3, '0', STR_PAD_LEFT).'*/'; |
|
| 62 | 62 | } |
| 63 | 63 | } |
| 64 | - $code = '/*001*/' . preg_replace_callback(",\n,", 'numerote_ligne_php', $code); |
|
| 64 | + $code = '/*001*/'.preg_replace_callback(",\n,", 'numerote_ligne_php', $code); |
|
| 65 | 65 | $code = trim(highlight_string($code, true)); |
| 66 | - erreur_squelette('L' . $e->getLine() . ': ' . $e->getMessage() . '<br />' . $code, [$page['source'],'',$e->getFile(),'',$GLOBALS['spip_lang']]); |
|
| 66 | + erreur_squelette('L'.$e->getLine().': '.$e->getMessage().'<br />'.$code, [$page['source'], '', $e->getFile(), '', $GLOBALS['spip_lang']]); |
|
| 67 | 67 | $page['texte'] = '<!-- Erreur -->'; |
| 68 | 68 | } |
| 69 | 69 | ob_end_clean(); |
@@ -71,7 +71,7 @@ discard block |
||
| 71 | 71 | $page['process_ins'] = 'html'; |
| 72 | 72 | |
| 73 | 73 | if (strpos($page['texte'], '?xml') !== false) { |
| 74 | - $page['texte'] = str_replace("<\1?xml", '<' . '?xml', $page['texte']); |
|
| 74 | + $page['texte'] = str_replace("<\1?xml", '<'.'?xml', $page['texte']); |
|
| 75 | 75 | } |
| 76 | 76 | } |
| 77 | 77 | |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | /** |
@@ -29,50 +29,50 @@ discard block |
||
| 29 | 29 | * @return void |
| 30 | 30 | */ |
| 31 | 31 | |
| 32 | - /** @var bool Évaluation réussie ? */ |
|
| 32 | + /** @var bool Évaluation réussie ? */ |
|
| 33 | 33 | $res = true; |
| 34 | 34 | |
| 35 | 35 | // Cas d'une page contenant du PHP : |
| 36 | 36 | if (empty($page['process_ins']) or $page['process_ins'] != 'html') { |
| 37 | - include_spip('inc/lang'); |
|
| 37 | + include_spip('inc/lang'); |
|
| 38 | 38 | |
| 39 | - // restaurer l'etat des notes avant calcul |
|
| 40 | - if ( |
|
| 41 | - isset($page['notes']) |
|
| 42 | - and $page['notes'] |
|
| 43 | - and $notes = charger_fonction('notes', 'inc', true) |
|
| 44 | - ) { |
|
| 45 | - $notes($page['notes'], 'restaurer_etat'); |
|
| 46 | - } |
|
| 47 | - ob_start(); |
|
| 48 | - if (strpos($page['texte'], '?xml') !== false) { |
|
| 49 | - $page['texte'] = str_replace('<' . '?xml', "<\1?xml", $page['texte']); |
|
| 50 | - } |
|
| 39 | + // restaurer l'etat des notes avant calcul |
|
| 40 | + if ( |
|
| 41 | + isset($page['notes']) |
|
| 42 | + and $page['notes'] |
|
| 43 | + and $notes = charger_fonction('notes', 'inc', true) |
|
| 44 | + ) { |
|
| 45 | + $notes($page['notes'], 'restaurer_etat'); |
|
| 46 | + } |
|
| 47 | + ob_start(); |
|
| 48 | + if (strpos($page['texte'], '?xml') !== false) { |
|
| 49 | + $page['texte'] = str_replace('<' . '?xml', "<\1?xml", $page['texte']); |
|
| 50 | + } |
|
| 51 | 51 | |
| 52 | - try { |
|
| 53 | - $res = eval('?' . '>' . $page['texte']); |
|
| 54 | - $page['texte'] = ob_get_contents(); |
|
| 55 | - } catch (\Throwable $e) { |
|
| 56 | - $code = $page['texte']; |
|
| 57 | - $GLOBALS['numero_ligne_php'] = 1; |
|
| 58 | - if (!function_exists('numerote_ligne_php')) { |
|
| 59 | - function numerote_ligne_php($match) { |
|
| 60 | - $GLOBALS['numero_ligne_php']++; |
|
| 61 | - return "\n/*" . str_pad($GLOBALS['numero_ligne_php'], 3, '0', STR_PAD_LEFT) . '*/'; |
|
| 62 | - } |
|
| 63 | - } |
|
| 64 | - $code = '/*001*/' . preg_replace_callback(",\n,", 'numerote_ligne_php', $code); |
|
| 65 | - $code = trim(highlight_string($code, true)); |
|
| 66 | - erreur_squelette('L' . $e->getLine() . ': ' . $e->getMessage() . '<br />' . $code, [$page['source'],'',$e->getFile(),'',$GLOBALS['spip_lang']]); |
|
| 67 | - $page['texte'] = '<!-- Erreur -->'; |
|
| 68 | - } |
|
| 69 | - ob_end_clean(); |
|
| 52 | + try { |
|
| 53 | + $res = eval('?' . '>' . $page['texte']); |
|
| 54 | + $page['texte'] = ob_get_contents(); |
|
| 55 | + } catch (\Throwable $e) { |
|
| 56 | + $code = $page['texte']; |
|
| 57 | + $GLOBALS['numero_ligne_php'] = 1; |
|
| 58 | + if (!function_exists('numerote_ligne_php')) { |
|
| 59 | + function numerote_ligne_php($match) { |
|
| 60 | + $GLOBALS['numero_ligne_php']++; |
|
| 61 | + return "\n/*" . str_pad($GLOBALS['numero_ligne_php'], 3, '0', STR_PAD_LEFT) . '*/'; |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | + $code = '/*001*/' . preg_replace_callback(",\n,", 'numerote_ligne_php', $code); |
|
| 65 | + $code = trim(highlight_string($code, true)); |
|
| 66 | + erreur_squelette('L' . $e->getLine() . ': ' . $e->getMessage() . '<br />' . $code, [$page['source'],'',$e->getFile(),'',$GLOBALS['spip_lang']]); |
|
| 67 | + $page['texte'] = '<!-- Erreur -->'; |
|
| 68 | + } |
|
| 69 | + ob_end_clean(); |
|
| 70 | 70 | |
| 71 | - $page['process_ins'] = 'html'; |
|
| 71 | + $page['process_ins'] = 'html'; |
|
| 72 | 72 | |
| 73 | - if (strpos($page['texte'], '?xml') !== false) { |
|
| 74 | - $page['texte'] = str_replace("<\1?xml", '<' . '?xml', $page['texte']); |
|
| 75 | - } |
|
| 73 | + if (strpos($page['texte'], '?xml') !== false) { |
|
| 74 | + $page['texte'] = str_replace("<\1?xml", '<' . '?xml', $page['texte']); |
|
| 75 | + } |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // le résultat de calcul d'un squelette est toujours de type string |
@@ -135,9 +135,9 @@ discard block |
||
| 135 | 135 | sql_updateq( |
| 136 | 136 | 'spip_rubriques', |
| 137 | 137 | ['statut' => 'publie', 'date' => date('Y-m-d H:i:s')], |
| 138 | - 'id_rubrique=' . intval($id_rubrique) |
|
| 138 | + 'id_rubrique='.intval($id_rubrique) |
|
| 139 | 139 | ); |
| 140 | - $id_parent = sql_getfetsel('id_parent', 'spip_rubriques AS R', 'R.id_rubrique=' . intval($id_rubrique)); |
|
| 140 | + $id_parent = sql_getfetsel('id_parent', 'spip_rubriques AS R', 'R.id_rubrique='.intval($id_rubrique)); |
|
| 141 | 141 | if (!$id_parent) { |
| 142 | 142 | break; |
| 143 | 143 | } |
@@ -172,7 +172,7 @@ discard block |
||
| 172 | 172 | return $id_pred != $id_rubrique; |
| 173 | 173 | } |
| 174 | 174 | // passer au parent si on a depublie |
| 175 | - $r = sql_fetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id_pred)); |
|
| 175 | + $r = sql_fetsel('id_parent', 'spip_rubriques', 'id_rubrique='.intval($id_pred)); |
|
| 176 | 176 | $id_pred = $r['id_parent']; |
| 177 | 177 | } |
| 178 | 178 | |
@@ -197,14 +197,14 @@ discard block |
||
| 197 | 197 | $date = date('Y-m-d H:i:s'); |
| 198 | 198 | } |
| 199 | 199 | $postdates = ($GLOBALS['meta']['post_dates'] == 'non') ? |
| 200 | - ' AND date <= ' . sql_quote($date) : ''; |
|
| 200 | + ' AND date <= '.sql_quote($date) : ''; |
|
| 201 | 201 | |
| 202 | 202 | if (!$id_rubrique = intval($id_rubrique)) { |
| 203 | 203 | return false; |
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | // verifier qu'elle existe et est bien publiee |
| 207 | - $r = sql_fetsel('id_rubrique,statut', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 207 | + $r = sql_fetsel('id_rubrique,statut', 'spip_rubriques', 'id_rubrique='.intval($id_rubrique)); |
|
| 208 | 208 | if (!$r or $r['statut'] !== 'publie') { |
| 209 | 209 | return false; |
| 210 | 210 | } |
@@ -214,12 +214,12 @@ discard block |
||
| 214 | 214 | $compte = [ |
| 215 | 215 | 'articles' => sql_countsel( |
| 216 | 216 | 'spip_articles', |
| 217 | - 'id_rubrique=' . intval($id_rubrique) . " AND statut='publie'$postdates" |
|
| 217 | + 'id_rubrique='.intval($id_rubrique)." AND statut='publie'$postdates" |
|
| 218 | 218 | ), |
| 219 | - 'rubriques' => sql_countsel('spip_rubriques', 'id_parent=' . intval($id_rubrique) . " AND statut='publie'"), |
|
| 219 | + 'rubriques' => sql_countsel('spip_rubriques', 'id_parent='.intval($id_rubrique)." AND statut='publie'"), |
|
| 220 | 220 | 'documents' => sql_countsel( |
| 221 | 221 | 'spip_documents AS D JOIN spip_documents_liens AS L ON D.id_document=L.id_document', |
| 222 | - 'L.id_objet=' . intval($id_rubrique) . " AND L.objet='rubrique' and D.mode NOT IN('logoon', 'logooff') " |
|
| 222 | + 'L.id_objet='.intval($id_rubrique)." AND L.objet='rubrique' and D.mode NOT IN('logoon', 'logooff') " |
|
| 223 | 223 | ) |
| 224 | 224 | ]; |
| 225 | 225 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | } |
| 245 | 245 | } |
| 246 | 246 | |
| 247 | - sql_updateq('spip_rubriques', ['statut' => 'prepa'], 'id_rubrique=' . intval($id_rubrique)); |
|
| 247 | + sql_updateq('spip_rubriques', ['statut' => 'prepa'], 'id_rubrique='.intval($id_rubrique)); |
|
| 248 | 248 | |
| 249 | 249 | # spip_log("depublier_rubrique $id_pred"); |
| 250 | 250 | return true; |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | |
| 308 | 308 | // Afficher les articles post-dates ? |
| 309 | 309 | $postdates = ($GLOBALS['meta']['post_dates'] == 'non') ? |
| 310 | - 'AND A.date <= ' . sql_quote(date('Y-m-d H:i:s')) : ''; |
|
| 310 | + 'AND A.date <= '.sql_quote(date('Y-m-d H:i:s')) : ''; |
|
| 311 | 311 | |
| 312 | 312 | $r = sql_select( |
| 313 | 313 | 'R.id_rubrique AS id, max(A.date) AS date_h', |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | sql_updateq( |
| 320 | 320 | 'spip_rubriques', |
| 321 | 321 | ['statut_tmp' => 'publie', 'date_tmp' => $row['date_h']], |
| 322 | - 'id_rubrique=' . intval($row['id']) |
|
| 322 | + 'id_rubrique='.intval($row['id']) |
|
| 323 | 323 | ); |
| 324 | 324 | } |
| 325 | 325 | |
@@ -345,7 +345,7 @@ discard block |
||
| 345 | 345 | sql_updateq( |
| 346 | 346 | 'spip_rubriques', |
| 347 | 347 | ['statut_tmp' => 'publie', 'date_tmp' => $row['date_h']], |
| 348 | - 'id_rubrique=' . intval($row['id']) |
|
| 348 | + 'id_rubrique='.intval($row['id']) |
|
| 349 | 349 | ); |
| 350 | 350 | $continuer = true; |
| 351 | 351 | } |
@@ -398,7 +398,7 @@ discard block |
||
| 398 | 398 | and $rows = sql_allfetsel( |
| 399 | 399 | 'A.id_rubrique AS id, R.id_secteur AS id_secteur, R.profondeur+1 as profondeur', |
| 400 | 400 | 'spip_rubriques AS A JOIN spip_rubriques AS R ON A.id_parent = R.id_rubrique', |
| 401 | - 'R.profondeur=' . intval($prof) . ' AND (A.id_secteur <> R.id_secteur OR A.profondeur > R.profondeur+1)', |
|
| 401 | + 'R.profondeur='.intval($prof).' AND (A.id_secteur <> R.id_secteur OR A.profondeur > R.profondeur+1)', |
|
| 402 | 402 | '', |
| 403 | 403 | 'R.id_secteur', |
| 404 | 404 | '0,100' |
@@ -437,11 +437,11 @@ discard block |
||
| 437 | 437 | and $rows = sql_allfetsel( |
| 438 | 438 | 'id_rubrique as id', |
| 439 | 439 | 'spip_rubriques', |
| 440 | - 'profondeur=' . intval($prof + 1) . ' AND id_parent NOT IN (' . sql_get_select( |
|
| 440 | + 'profondeur='.intval($prof + 1).' AND id_parent NOT IN ('.sql_get_select( |
|
| 441 | 441 | 'zzz.id_rubrique', |
| 442 | 442 | 'spip_rubriques AS zzz', |
| 443 | - 'zzz.profondeur=' . intval($prof) |
|
| 444 | - ) . ')', |
|
| 443 | + 'zzz.profondeur='.intval($prof) |
|
| 444 | + ).')', |
|
| 445 | 445 | '', |
| 446 | 446 | '', |
| 447 | 447 | '0,100' |
@@ -455,7 +455,7 @@ discard block |
||
| 455 | 455 | // si pas de rubrique a profondeur $prof+1 pas la peine de continuer |
| 456 | 456 | // si il reste des rubriques non vues, c'est une branche morte ou reference circulaire (base foireuse) |
| 457 | 457 | // on arrete les frais |
| 458 | - if (sql_countsel('spip_rubriques', 'profondeur=' . intval($prof + 1))) { |
|
| 458 | + if (sql_countsel('spip_rubriques', 'profondeur='.intval($prof + 1))) { |
|
| 459 | 459 | $prof++; |
| 460 | 460 | $continuer = true; |
| 461 | 461 | } |
@@ -463,12 +463,12 @@ discard block |
||
| 463 | 463 | |
| 464 | 464 | // loger si la table des rubriques semble foireuse |
| 465 | 465 | // et mettre un id_secteur=0 sur ces rubriques pour eviter toute selection par les boucles |
| 466 | - if (sql_countsel('spip_rubriques', 'profondeur>' . intval($prof + 1))) { |
|
| 466 | + if (sql_countsel('spip_rubriques', 'profondeur>'.intval($prof + 1))) { |
|
| 467 | 467 | spip_log( |
| 468 | - 'Les rubriques de profondeur>' . ($prof + 1) . ' semblent suspectes (branches morte ou reference circulaire dans les parents)', |
|
| 468 | + 'Les rubriques de profondeur>'.($prof + 1).' semblent suspectes (branches morte ou reference circulaire dans les parents)', |
|
| 469 | 469 | _LOG_CRITIQUE |
| 470 | 470 | ); |
| 471 | - sql_update('spip_rubriques', ['id_secteur' => 0], 'profondeur>' . intval($prof + 1)); |
|
| 471 | + sql_update('spip_rubriques', ['id_secteur' => 0], 'profondeur>'.intval($prof + 1)); |
|
| 472 | 472 | } |
| 473 | 473 | |
| 474 | 474 | // reparer les articles |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | ); |
| 480 | 480 | |
| 481 | 481 | while ($row = sql_fetch($r)) { |
| 482 | - sql_update('spip_articles', ['id_secteur' => $row['secteur']], 'id_article=' . intval($row['id'])); |
|
| 482 | + sql_update('spip_articles', ['id_secteur' => $row['secteur']], 'id_article='.intval($row['id'])); |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | // avertir les plugins qui peuvent faire leur mises a jour egalement |
@@ -510,7 +510,7 @@ discard block |
||
| 510 | 510 | $t = sql_updateq( |
| 511 | 511 | 'spip_rubriques', |
| 512 | 512 | ['lang' => $row['lang'], 'langue_choisie' => 'non'], |
| 513 | - 'id_rubrique=' . intval($id_rubrique) |
|
| 513 | + 'id_rubrique='.intval($id_rubrique) |
|
| 514 | 514 | ); |
| 515 | 515 | } |
| 516 | 516 | |
@@ -555,7 +555,7 @@ discard block |
||
| 555 | 555 | sql_updateq( |
| 556 | 556 | 'spip_articles', |
| 557 | 557 | ['lang' => $row['lang'], 'langue_choisie' => 'non'], |
| 558 | - 'id_article=' . intval($id_article) |
|
| 558 | + 'id_article='.intval($id_article) |
|
| 559 | 559 | ); |
| 560 | 560 | } |
| 561 | 561 | |
@@ -630,11 +630,11 @@ discard block |
||
| 630 | 630 | ]; |
| 631 | 631 | // generer un nom de fonction "anonyme" unique |
| 632 | 632 | do { |
| 633 | - $functionname = 'f_calculer_langues_utilisees_' . $boucle->id_table . '_' . time() . '_' . random_int(0, mt_getrandmax()); |
|
| 633 | + $functionname = 'f_calculer_langues_utilisees_'.$boucle->id_table.'_'.time().'_'.random_int(0, mt_getrandmax()); |
|
| 634 | 634 | } while (function_exists($functionname)); |
| 635 | 635 | $code = calculer_boucle('calculer_langues_utilisees', $boucles); |
| 636 | - $code = '$SP=0; $command=array();$command["connect"] = $connect = "' . $serveur . '"; $Pile=array(0=>array());' . "\n" . $code; |
|
| 637 | - $code = 'function ' . $functionname . '(){' . $code . '};$res = ' . $functionname . '();'; |
|
| 636 | + $code = '$SP=0; $command=array();$command["connect"] = $connect = "'.$serveur.'"; $Pile=array(0=>array());'."\n".$code; |
|
| 637 | + $code = 'function '.$functionname.'(){'.$code.'};$res = '.$functionname.'();'; |
|
| 638 | 638 | $res = ''; |
| 639 | 639 | eval($code); |
| 640 | 640 | $res = explode(',', $res); |
@@ -736,11 +736,11 @@ discard block |
||
| 736 | 736 | $maxiter-- and $filles = sql_allfetsel( |
| 737 | 737 | 'id_rubrique', |
| 738 | 738 | 'spip_rubriques', |
| 739 | - sql_in('id_parent', $r) . ' AND ' . sql_in('id_rubrique', $r, 'NOT') |
|
| 739 | + sql_in('id_parent', $r).' AND '.sql_in('id_rubrique', $r, 'NOT') |
|
| 740 | 740 | ) |
| 741 | 741 | ) { |
| 742 | 742 | $r = join(',', array_column($filles, 'id_rubrique')); |
| 743 | - $branche .= ',' . $r; |
|
| 743 | + $branche .= ','.$r; |
|
| 744 | 744 | } |
| 745 | 745 | |
| 746 | 746 | # securite pour ne pas plomber la conso memoire sur les sites prolifiques |
@@ -780,7 +780,7 @@ discard block |
||
| 780 | 780 | |
| 781 | 781 | if (isset($b[$id])) { |
| 782 | 782 | // Notre branche commence par la rubrique de depart si $tout=true |
| 783 | - return $tout ? (strlen($b[$id]) ? $b[$id] . ",$id" : $id) : $b[$id]; |
|
| 783 | + return $tout ? (strlen($b[$id]) ? $b[$id].",$id" : $id) : $b[$id]; |
|
| 784 | 784 | } |
| 785 | 785 | |
| 786 | 786 | $hier = ''; |
@@ -793,11 +793,11 @@ discard block |
||
| 793 | 793 | $maxiter-- and $parents = sql_allfetsel( |
| 794 | 794 | 'id_parent', |
| 795 | 795 | 'spip_rubriques', |
| 796 | - sql_in('id_rubrique', $ids_nouveaux_parents) . ' AND ' . sql_in('id_parent', $hier, 'NOT') |
|
| 796 | + sql_in('id_rubrique', $ids_nouveaux_parents).' AND '.sql_in('id_parent', $hier, 'NOT') |
|
| 797 | 797 | ) |
| 798 | 798 | ) { |
| 799 | 799 | $ids_nouveaux_parents = join(',', array_column($parents, 'id_parent')); |
| 800 | - $hier = $ids_nouveaux_parents . (strlen($hier) ? ',' . $hier : ''); |
|
| 800 | + $hier = $ids_nouveaux_parents.(strlen($hier) ? ','.$hier : ''); |
|
| 801 | 801 | } |
| 802 | 802 | |
| 803 | 803 | # securite pour ne pas plomber la conso memoire sur les sites prolifiques |
@@ -829,7 +829,7 @@ discard block |
||
| 829 | 829 | include_spip('base/abstract_sql'); |
| 830 | 830 | if ($check) { |
| 831 | 831 | $postdates = ($GLOBALS['meta']['post_dates'] == 'non') ? |
| 832 | - 'AND A.date <= ' . sql_quote(date('Y-m-d H:i:s')) : ''; |
|
| 832 | + 'AND A.date <= '.sql_quote(date('Y-m-d H:i:s')) : ''; |
|
| 833 | 833 | |
| 834 | 834 | $r = sql_select( |
| 835 | 835 | 'DISTINCT A.id_rubrique AS id', |
@@ -846,7 +846,7 @@ discard block |
||
| 846 | 846 | $t = sql_fetsel( |
| 847 | 847 | 'date', |
| 848 | 848 | 'spip_articles', |
| 849 | - "statut='publie' AND date > " . sql_quote(date('Y-m-d H:i:s')), |
|
| 849 | + "statut='publie' AND date > ".sql_quote(date('Y-m-d H:i:s')), |
|
| 850 | 850 | '', |
| 851 | 851 | 'date', |
| 852 | 852 | '1' |
@@ -902,7 +902,7 @@ discard block |
||
| 902 | 902 | $r = sql_getfetsel( |
| 903 | 903 | 'id_rubrique', |
| 904 | 904 | 'spip_rubriques', |
| 905 | - 'titre = ' . sql_quote($titre) . ' AND id_parent=' . intval($id_parent), |
|
| 905 | + 'titre = '.sql_quote($titre).' AND id_parent='.intval($id_parent), |
|
| 906 | 906 | $groupby = [], |
| 907 | 907 | $orderby = [], |
| 908 | 908 | $limit = '', |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | sql_updateq( |
| 939 | 939 | 'spip_rubriques', |
| 940 | 940 | ['id_secteur' => $id_secteur, 'lang' => $lang], |
| 941 | - 'id_rubrique=' . intval($id_rubrique), |
|
| 941 | + 'id_rubrique='.intval($id_rubrique), |
|
| 942 | 942 | [], |
| 943 | 943 | $serveur |
| 944 | 944 | ); |
@@ -19,7 +19,7 @@ discard block |
||
| 19 | 19 | */ |
| 20 | 20 | |
| 21 | 21 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 22 | - return; |
|
| 22 | + return; |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | |
@@ -55,65 +55,65 @@ discard block |
||
| 55 | 55 | * @return void |
| 56 | 56 | **/ |
| 57 | 57 | function calculer_rubriques_if($id_rubrique, $modifs, $infos = [], $postdate = false) { |
| 58 | - $statuts_publies = null; |
|
| 59 | - $neuf = false; |
|
| 60 | - |
|
| 61 | - // Compat avec l'ancienne signature |
|
| 62 | - if (is_string($infos)) { |
|
| 63 | - $infos = ['statut_ancien' => $infos]; |
|
| 64 | - } |
|
| 65 | - if (!isset($infos['statut_ancien'])) { |
|
| 66 | - $infos['statut_ancien'] = ''; |
|
| 67 | - } |
|
| 68 | - |
|
| 69 | - // On recherche quels statuts tester |
|
| 70 | - if ( |
|
| 71 | - isset($infos['objet']) |
|
| 72 | - and include_spip('inc/filtres') |
|
| 73 | - and $declaration_statut = objet_info($infos['objet'], 'statut') |
|
| 74 | - and is_array($declaration_statut) |
|
| 75 | - ) { |
|
| 76 | - foreach ($declaration_statut as $champ_statut) { |
|
| 77 | - if ($champ_statut['champ'] == 'statut') { |
|
| 78 | - $statuts_publies = array_map('trim', explode(',', $champ_statut['publie'])); |
|
| 79 | - break; // stop on a trouvé le bon champ |
|
| 80 | - } |
|
| 81 | - } |
|
| 82 | - } else { |
|
| 83 | - $statuts_publies = ['publie']; |
|
| 84 | - } |
|
| 85 | - |
|
| 86 | - if (in_array($infos['statut_ancien'], $statuts_publies)) { |
|
| 87 | - if ( |
|
| 88 | - isset($modifs['statut']) |
|
| 89 | - or isset($modifs['id_rubrique']) |
|
| 90 | - or ($postdate and strtotime($postdate) > time()) |
|
| 91 | - ) { |
|
| 92 | - $neuf |= depublier_branche_rubrique_if($id_rubrique); |
|
| 93 | - } |
|
| 94 | - // ne publier que si c'est pas un postdate, ou si la date n'est pas dans le futur |
|
| 95 | - if ($postdate) { |
|
| 96 | - calculer_prochain_postdate(true); |
|
| 97 | - $neuf |= (strtotime($postdate) <= time()); // par securite |
|
| 98 | - } elseif (isset($modifs['id_rubrique'])) { |
|
| 99 | - $neuf |= publier_branche_rubrique($modifs['id_rubrique']); |
|
| 100 | - } |
|
| 101 | - } elseif (isset($modifs['statut']) and in_array($modifs['statut'], $statuts_publies)) { |
|
| 102 | - if ($postdate) { |
|
| 103 | - calculer_prochain_postdate(true); |
|
| 104 | - $neuf |= (strtotime($postdate) <= time()); // par securite |
|
| 105 | - } else { |
|
| 106 | - $neuf |= publier_branche_rubrique($id_rubrique); |
|
| 107 | - } |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - if ($neuf) { |
|
| 111 | - // Sauver la date de la derniere mise a jour (pour menu_rubriques) |
|
| 112 | - ecrire_meta('date_calcul_rubriques', date('U')); |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - $langues = calculer_langues_utilisees(); |
|
| 116 | - ecrire_meta('langues_utilisees', $langues); |
|
| 58 | + $statuts_publies = null; |
|
| 59 | + $neuf = false; |
|
| 60 | + |
|
| 61 | + // Compat avec l'ancienne signature |
|
| 62 | + if (is_string($infos)) { |
|
| 63 | + $infos = ['statut_ancien' => $infos]; |
|
| 64 | + } |
|
| 65 | + if (!isset($infos['statut_ancien'])) { |
|
| 66 | + $infos['statut_ancien'] = ''; |
|
| 67 | + } |
|
| 68 | + |
|
| 69 | + // On recherche quels statuts tester |
|
| 70 | + if ( |
|
| 71 | + isset($infos['objet']) |
|
| 72 | + and include_spip('inc/filtres') |
|
| 73 | + and $declaration_statut = objet_info($infos['objet'], 'statut') |
|
| 74 | + and is_array($declaration_statut) |
|
| 75 | + ) { |
|
| 76 | + foreach ($declaration_statut as $champ_statut) { |
|
| 77 | + if ($champ_statut['champ'] == 'statut') { |
|
| 78 | + $statuts_publies = array_map('trim', explode(',', $champ_statut['publie'])); |
|
| 79 | + break; // stop on a trouvé le bon champ |
|
| 80 | + } |
|
| 81 | + } |
|
| 82 | + } else { |
|
| 83 | + $statuts_publies = ['publie']; |
|
| 84 | + } |
|
| 85 | + |
|
| 86 | + if (in_array($infos['statut_ancien'], $statuts_publies)) { |
|
| 87 | + if ( |
|
| 88 | + isset($modifs['statut']) |
|
| 89 | + or isset($modifs['id_rubrique']) |
|
| 90 | + or ($postdate and strtotime($postdate) > time()) |
|
| 91 | + ) { |
|
| 92 | + $neuf |= depublier_branche_rubrique_if($id_rubrique); |
|
| 93 | + } |
|
| 94 | + // ne publier que si c'est pas un postdate, ou si la date n'est pas dans le futur |
|
| 95 | + if ($postdate) { |
|
| 96 | + calculer_prochain_postdate(true); |
|
| 97 | + $neuf |= (strtotime($postdate) <= time()); // par securite |
|
| 98 | + } elseif (isset($modifs['id_rubrique'])) { |
|
| 99 | + $neuf |= publier_branche_rubrique($modifs['id_rubrique']); |
|
| 100 | + } |
|
| 101 | + } elseif (isset($modifs['statut']) and in_array($modifs['statut'], $statuts_publies)) { |
|
| 102 | + if ($postdate) { |
|
| 103 | + calculer_prochain_postdate(true); |
|
| 104 | + $neuf |= (strtotime($postdate) <= time()); // par securite |
|
| 105 | + } else { |
|
| 106 | + $neuf |= publier_branche_rubrique($id_rubrique); |
|
| 107 | + } |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + if ($neuf) { |
|
| 111 | + // Sauver la date de la derniere mise a jour (pour menu_rubriques) |
|
| 112 | + ecrire_meta('date_calcul_rubriques', date('U')); |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + $langues = calculer_langues_utilisees(); |
|
| 116 | + ecrire_meta('langues_utilisees', $langues); |
|
| 117 | 117 | } |
| 118 | 118 | |
| 119 | 119 | |
@@ -131,22 +131,22 @@ discard block |
||
| 131 | 131 | * true si le statut change effectivement |
| 132 | 132 | */ |
| 133 | 133 | function publier_branche_rubrique($id_rubrique) { |
| 134 | - $id_pred = $id_rubrique; |
|
| 135 | - while (true) { |
|
| 136 | - sql_updateq( |
|
| 137 | - 'spip_rubriques', |
|
| 138 | - ['statut' => 'publie', 'date' => date('Y-m-d H:i:s')], |
|
| 139 | - 'id_rubrique=' . intval($id_rubrique) |
|
| 140 | - ); |
|
| 141 | - $id_parent = sql_getfetsel('id_parent', 'spip_rubriques AS R', 'R.id_rubrique=' . intval($id_rubrique)); |
|
| 142 | - if (!$id_parent) { |
|
| 143 | - break; |
|
| 144 | - } |
|
| 145 | - $id_rubrique = $id_parent; |
|
| 146 | - } |
|
| 134 | + $id_pred = $id_rubrique; |
|
| 135 | + while (true) { |
|
| 136 | + sql_updateq( |
|
| 137 | + 'spip_rubriques', |
|
| 138 | + ['statut' => 'publie', 'date' => date('Y-m-d H:i:s')], |
|
| 139 | + 'id_rubrique=' . intval($id_rubrique) |
|
| 140 | + ); |
|
| 141 | + $id_parent = sql_getfetsel('id_parent', 'spip_rubriques AS R', 'R.id_rubrique=' . intval($id_rubrique)); |
|
| 142 | + if (!$id_parent) { |
|
| 143 | + break; |
|
| 144 | + } |
|
| 145 | + $id_rubrique = $id_parent; |
|
| 146 | + } |
|
| 147 | 147 | |
| 148 | 148 | # spip_log(" publier_branche_rubrique($id_rubrique $id_pred"); |
| 149 | - return $id_pred != $id_rubrique; |
|
| 149 | + return $id_pred != $id_rubrique; |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | /** |
@@ -164,20 +164,20 @@ discard block |
||
| 164 | 164 | * true si le statut change effectivement |
| 165 | 165 | */ |
| 166 | 166 | function depublier_branche_rubrique_if($id_rubrique) { |
| 167 | - $date = date('Y-m-d H:i:s'); // figer la date |
|
| 168 | - |
|
| 169 | - # spip_log("depublier_branche_rubrique($id_rubrique ?"); |
|
| 170 | - $id_pred = $id_rubrique; |
|
| 171 | - while ($id_pred) { |
|
| 172 | - if (!depublier_rubrique_if($id_pred, $date)) { |
|
| 173 | - return $id_pred != $id_rubrique; |
|
| 174 | - } |
|
| 175 | - // passer au parent si on a depublie |
|
| 176 | - $r = sql_fetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id_pred)); |
|
| 177 | - $id_pred = $r['id_parent']; |
|
| 178 | - } |
|
| 179 | - |
|
| 180 | - return $id_pred != $id_rubrique; |
|
| 167 | + $date = date('Y-m-d H:i:s'); // figer la date |
|
| 168 | + |
|
| 169 | + # spip_log("depublier_branche_rubrique($id_rubrique ?"); |
|
| 170 | + $id_pred = $id_rubrique; |
|
| 171 | + while ($id_pred) { |
|
| 172 | + if (!depublier_rubrique_if($id_pred, $date)) { |
|
| 173 | + return $id_pred != $id_rubrique; |
|
| 174 | + } |
|
| 175 | + // passer au parent si on a depublie |
|
| 176 | + $r = sql_fetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id_pred)); |
|
| 177 | + $id_pred = $r['id_parent']; |
|
| 178 | + } |
|
| 179 | + |
|
| 180 | + return $id_pred != $id_rubrique; |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | /** |
@@ -194,61 +194,61 @@ discard block |
||
| 194 | 194 | * true si la rubrique a été dépubliée |
| 195 | 195 | */ |
| 196 | 196 | function depublier_rubrique_if($id_rubrique, $date = null) { |
| 197 | - if (is_null($date)) { |
|
| 198 | - $date = date('Y-m-d H:i:s'); |
|
| 199 | - } |
|
| 200 | - $postdates = ($GLOBALS['meta']['post_dates'] == 'non') ? |
|
| 201 | - ' AND date <= ' . sql_quote($date) : ''; |
|
| 202 | - |
|
| 203 | - if (!$id_rubrique = intval($id_rubrique)) { |
|
| 204 | - return false; |
|
| 205 | - } |
|
| 206 | - |
|
| 207 | - // verifier qu'elle existe et est bien publiee |
|
| 208 | - $r = sql_fetsel('id_rubrique,statut', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 209 | - if (!$r or $r['statut'] !== 'publie') { |
|
| 210 | - return false; |
|
| 211 | - } |
|
| 212 | - |
|
| 213 | - // On met le nombre de chaque type d'enfants dans un tableau |
|
| 214 | - // Le type de l'objet est au pluriel |
|
| 215 | - $compte = [ |
|
| 216 | - 'articles' => sql_countsel( |
|
| 217 | - 'spip_articles', |
|
| 218 | - 'id_rubrique=' . intval($id_rubrique) . " AND statut='publie'$postdates" |
|
| 219 | - ), |
|
| 220 | - 'rubriques' => sql_countsel('spip_rubriques', 'id_parent=' . intval($id_rubrique) . " AND statut='publie'"), |
|
| 221 | - 'documents' => sql_countsel( |
|
| 222 | - 'spip_documents AS D JOIN spip_documents_liens AS L ON D.id_document=L.id_document', |
|
| 223 | - 'L.id_objet=' . intval($id_rubrique) . " AND L.objet='rubrique' and D.mode NOT IN('logoon', 'logooff') " |
|
| 224 | - ) |
|
| 225 | - ]; |
|
| 226 | - |
|
| 227 | - // On passe le tableau des comptes dans un pipeline pour que les plugins puissent ajouter (ou retirer) des enfants |
|
| 228 | - $compte = pipeline( |
|
| 229 | - 'objet_compte_enfants', |
|
| 230 | - [ |
|
| 231 | - 'args' => [ |
|
| 232 | - 'objet' => 'rubrique', |
|
| 233 | - 'id_objet' => $id_rubrique, |
|
| 234 | - 'statut' => 'publie', |
|
| 235 | - 'date' => $date |
|
| 236 | - ], |
|
| 237 | - 'data' => $compte |
|
| 238 | - ] |
|
| 239 | - ); |
|
| 240 | - |
|
| 241 | - // S'il y a au moins un enfant de n'importe quoi, on ne dépublie pas |
|
| 242 | - foreach ($compte as $objet => $n) { |
|
| 243 | - if ($n) { |
|
| 244 | - return false; |
|
| 245 | - } |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - sql_updateq('spip_rubriques', ['statut' => 'prepa'], 'id_rubrique=' . intval($id_rubrique)); |
|
| 197 | + if (is_null($date)) { |
|
| 198 | + $date = date('Y-m-d H:i:s'); |
|
| 199 | + } |
|
| 200 | + $postdates = ($GLOBALS['meta']['post_dates'] == 'non') ? |
|
| 201 | + ' AND date <= ' . sql_quote($date) : ''; |
|
| 202 | + |
|
| 203 | + if (!$id_rubrique = intval($id_rubrique)) { |
|
| 204 | + return false; |
|
| 205 | + } |
|
| 206 | + |
|
| 207 | + // verifier qu'elle existe et est bien publiee |
|
| 208 | + $r = sql_fetsel('id_rubrique,statut', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 209 | + if (!$r or $r['statut'] !== 'publie') { |
|
| 210 | + return false; |
|
| 211 | + } |
|
| 212 | + |
|
| 213 | + // On met le nombre de chaque type d'enfants dans un tableau |
|
| 214 | + // Le type de l'objet est au pluriel |
|
| 215 | + $compte = [ |
|
| 216 | + 'articles' => sql_countsel( |
|
| 217 | + 'spip_articles', |
|
| 218 | + 'id_rubrique=' . intval($id_rubrique) . " AND statut='publie'$postdates" |
|
| 219 | + ), |
|
| 220 | + 'rubriques' => sql_countsel('spip_rubriques', 'id_parent=' . intval($id_rubrique) . " AND statut='publie'"), |
|
| 221 | + 'documents' => sql_countsel( |
|
| 222 | + 'spip_documents AS D JOIN spip_documents_liens AS L ON D.id_document=L.id_document', |
|
| 223 | + 'L.id_objet=' . intval($id_rubrique) . " AND L.objet='rubrique' and D.mode NOT IN('logoon', 'logooff') " |
|
| 224 | + ) |
|
| 225 | + ]; |
|
| 226 | + |
|
| 227 | + // On passe le tableau des comptes dans un pipeline pour que les plugins puissent ajouter (ou retirer) des enfants |
|
| 228 | + $compte = pipeline( |
|
| 229 | + 'objet_compte_enfants', |
|
| 230 | + [ |
|
| 231 | + 'args' => [ |
|
| 232 | + 'objet' => 'rubrique', |
|
| 233 | + 'id_objet' => $id_rubrique, |
|
| 234 | + 'statut' => 'publie', |
|
| 235 | + 'date' => $date |
|
| 236 | + ], |
|
| 237 | + 'data' => $compte |
|
| 238 | + ] |
|
| 239 | + ); |
|
| 240 | + |
|
| 241 | + // S'il y a au moins un enfant de n'importe quoi, on ne dépublie pas |
|
| 242 | + foreach ($compte as $objet => $n) { |
|
| 243 | + if ($n) { |
|
| 244 | + return false; |
|
| 245 | + } |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + sql_updateq('spip_rubriques', ['statut' => 'prepa'], 'id_rubrique=' . intval($id_rubrique)); |
|
| 249 | 249 | |
| 250 | 250 | # spip_log("depublier_rubrique $id_pred"); |
| 251 | - return true; |
|
| 251 | + return true; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | |
@@ -271,18 +271,18 @@ discard block |
||
| 271 | 271 | **/ |
| 272 | 272 | function calculer_rubriques() { |
| 273 | 273 | |
| 274 | - calculer_rubriques_publiees(); |
|
| 274 | + calculer_rubriques_publiees(); |
|
| 275 | 275 | |
| 276 | - // Apres chaque (de)publication |
|
| 277 | - // recalculer les langues utilisees sur le site |
|
| 278 | - $langues = calculer_langues_utilisees(); |
|
| 279 | - ecrire_meta('langues_utilisees', $langues); |
|
| 276 | + // Apres chaque (de)publication |
|
| 277 | + // recalculer les langues utilisees sur le site |
|
| 278 | + $langues = calculer_langues_utilisees(); |
|
| 279 | + ecrire_meta('langues_utilisees', $langues); |
|
| 280 | 280 | |
| 281 | - // Sauver la date de la derniere mise a jour (pour menu_rubriques) |
|
| 282 | - ecrire_meta('date_calcul_rubriques', date('U')); |
|
| 281 | + // Sauver la date de la derniere mise a jour (pour menu_rubriques) |
|
| 282 | + ecrire_meta('date_calcul_rubriques', date('U')); |
|
| 283 | 283 | |
| 284 | - // on calcule la date du prochain article post-date |
|
| 285 | - calculer_prochain_postdate(); |
|
| 284 | + // on calcule la date du prochain article post-date |
|
| 285 | + calculer_prochain_postdate(); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
@@ -299,61 +299,61 @@ discard block |
||
| 299 | 299 | **/ |
| 300 | 300 | function calculer_rubriques_publiees() { |
| 301 | 301 | |
| 302 | - // Mettre les compteurs a zero |
|
| 303 | - sql_updateq('spip_rubriques', ['date_tmp' => '0000-00-00 00:00:00', 'statut_tmp' => 'prepa']); |
|
| 304 | - |
|
| 305 | - // |
|
| 306 | - // Publier et dater les rubriques qui ont un article publie |
|
| 307 | - // |
|
| 308 | - |
|
| 309 | - // Afficher les articles post-dates ? |
|
| 310 | - $postdates = ($GLOBALS['meta']['post_dates'] == 'non') ? |
|
| 311 | - 'AND A.date <= ' . sql_quote(date('Y-m-d H:i:s')) : ''; |
|
| 312 | - |
|
| 313 | - $r = sql_select( |
|
| 314 | - 'R.id_rubrique AS id, max(A.date) AS date_h', |
|
| 315 | - 'spip_rubriques AS R JOIN spip_articles AS A ON R.id_rubrique = A.id_rubrique', |
|
| 316 | - "A.date>R.date_tmp AND A.statut='publie' $postdates ", |
|
| 317 | - 'R.id_rubrique' |
|
| 318 | - ); |
|
| 319 | - while ($row = sql_fetch($r)) { |
|
| 320 | - sql_updateq( |
|
| 321 | - 'spip_rubriques', |
|
| 322 | - ['statut_tmp' => 'publie', 'date_tmp' => $row['date_h']], |
|
| 323 | - 'id_rubrique=' . intval($row['id']) |
|
| 324 | - ); |
|
| 325 | - } |
|
| 326 | - |
|
| 327 | - // point d'entree pour permettre a des plugins de gerer le statut |
|
| 328 | - // autrement (par ex: toute rubrique est publiee des sa creation) |
|
| 329 | - // Ce pipeline fait ce qu'il veut, mais s'il touche aux statuts/dates |
|
| 330 | - // c'est statut_tmp/date_tmp qu'il doit modifier |
|
| 331 | - // [C'est un trigger... a renommer en trig_calculer_rubriques ?] |
|
| 332 | - pipeline('calculer_rubriques', null); |
|
| 333 | - |
|
| 334 | - |
|
| 335 | - // Les rubriques qui ont une rubrique fille plus recente |
|
| 336 | - // on tourne tant que les donnees remontent vers la racine. |
|
| 337 | - do { |
|
| 338 | - $continuer = false; |
|
| 339 | - $r = sql_select( |
|
| 340 | - 'R.id_rubrique AS id, max(SR.date_tmp) AS date_h', |
|
| 341 | - 'spip_rubriques AS R JOIN spip_rubriques AS SR ON R.id_rubrique = SR.id_parent', |
|
| 342 | - "(SR.date_tmp>R.date_tmp OR R.statut_tmp<>'publie') AND SR.statut_tmp='publie' ", |
|
| 343 | - 'R.id_rubrique' |
|
| 344 | - ); |
|
| 345 | - while ($row = sql_fetch($r)) { |
|
| 346 | - sql_updateq( |
|
| 347 | - 'spip_rubriques', |
|
| 348 | - ['statut_tmp' => 'publie', 'date_tmp' => $row['date_h']], |
|
| 349 | - 'id_rubrique=' . intval($row['id']) |
|
| 350 | - ); |
|
| 351 | - $continuer = true; |
|
| 352 | - } |
|
| 353 | - } while ($continuer); |
|
| 354 | - |
|
| 355 | - // Enregistrement des modifs |
|
| 356 | - sql_update('spip_rubriques', ['date' => 'date_tmp', 'statut' => 'statut_tmp']); |
|
| 302 | + // Mettre les compteurs a zero |
|
| 303 | + sql_updateq('spip_rubriques', ['date_tmp' => '0000-00-00 00:00:00', 'statut_tmp' => 'prepa']); |
|
| 304 | + |
|
| 305 | + // |
|
| 306 | + // Publier et dater les rubriques qui ont un article publie |
|
| 307 | + // |
|
| 308 | + |
|
| 309 | + // Afficher les articles post-dates ? |
|
| 310 | + $postdates = ($GLOBALS['meta']['post_dates'] == 'non') ? |
|
| 311 | + 'AND A.date <= ' . sql_quote(date('Y-m-d H:i:s')) : ''; |
|
| 312 | + |
|
| 313 | + $r = sql_select( |
|
| 314 | + 'R.id_rubrique AS id, max(A.date) AS date_h', |
|
| 315 | + 'spip_rubriques AS R JOIN spip_articles AS A ON R.id_rubrique = A.id_rubrique', |
|
| 316 | + "A.date>R.date_tmp AND A.statut='publie' $postdates ", |
|
| 317 | + 'R.id_rubrique' |
|
| 318 | + ); |
|
| 319 | + while ($row = sql_fetch($r)) { |
|
| 320 | + sql_updateq( |
|
| 321 | + 'spip_rubriques', |
|
| 322 | + ['statut_tmp' => 'publie', 'date_tmp' => $row['date_h']], |
|
| 323 | + 'id_rubrique=' . intval($row['id']) |
|
| 324 | + ); |
|
| 325 | + } |
|
| 326 | + |
|
| 327 | + // point d'entree pour permettre a des plugins de gerer le statut |
|
| 328 | + // autrement (par ex: toute rubrique est publiee des sa creation) |
|
| 329 | + // Ce pipeline fait ce qu'il veut, mais s'il touche aux statuts/dates |
|
| 330 | + // c'est statut_tmp/date_tmp qu'il doit modifier |
|
| 331 | + // [C'est un trigger... a renommer en trig_calculer_rubriques ?] |
|
| 332 | + pipeline('calculer_rubriques', null); |
|
| 333 | + |
|
| 334 | + |
|
| 335 | + // Les rubriques qui ont une rubrique fille plus recente |
|
| 336 | + // on tourne tant que les donnees remontent vers la racine. |
|
| 337 | + do { |
|
| 338 | + $continuer = false; |
|
| 339 | + $r = sql_select( |
|
| 340 | + 'R.id_rubrique AS id, max(SR.date_tmp) AS date_h', |
|
| 341 | + 'spip_rubriques AS R JOIN spip_rubriques AS SR ON R.id_rubrique = SR.id_parent', |
|
| 342 | + "(SR.date_tmp>R.date_tmp OR R.statut_tmp<>'publie') AND SR.statut_tmp='publie' ", |
|
| 343 | + 'R.id_rubrique' |
|
| 344 | + ); |
|
| 345 | + while ($row = sql_fetch($r)) { |
|
| 346 | + sql_updateq( |
|
| 347 | + 'spip_rubriques', |
|
| 348 | + ['statut_tmp' => 'publie', 'date_tmp' => $row['date_h']], |
|
| 349 | + 'id_rubrique=' . intval($row['id']) |
|
| 350 | + ); |
|
| 351 | + $continuer = true; |
|
| 352 | + } |
|
| 353 | + } while ($continuer); |
|
| 354 | + |
|
| 355 | + // Enregistrement des modifs |
|
| 356 | + sql_update('spip_rubriques', ['date' => 'date_tmp', 'statut' => 'statut_tmp']); |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | /** |
@@ -368,123 +368,123 @@ discard block |
||
| 368 | 368 | * @return void |
| 369 | 369 | **/ |
| 370 | 370 | function propager_les_secteurs() { |
| 371 | - // Profondeur 0 |
|
| 372 | - // Toutes les rubriques racines sont de profondeur 0 |
|
| 373 | - // et fixer les id_secteur des rubriques racines |
|
| 374 | - sql_update('spip_rubriques', ['id_secteur' => 'id_rubrique', 'profondeur' => 0], 'id_parent=0'); |
|
| 375 | - // Toute rubrique non racine est de profondeur >0 |
|
| 376 | - sql_updateq('spip_rubriques', ['profondeur' => 1], 'id_parent<>0 AND profondeur=0'); |
|
| 377 | - |
|
| 378 | - // securite : pas plus d'iteration que de rubriques dans la base |
|
| 379 | - $maxiter = sql_countsel('spip_rubriques'); |
|
| 380 | - |
|
| 381 | - // reparer les rubriques qui n'ont pas l'id_secteur de leur parent |
|
| 382 | - // on fait profondeur par profondeur |
|
| 383 | - |
|
| 384 | - $prof = 0; |
|
| 385 | - do { |
|
| 386 | - $continuer = false; |
|
| 387 | - |
|
| 388 | - // Par recursivite : si toutes les rubriques de profondeur $prof sont bonnes |
|
| 389 | - // on fixe le profondeur $prof+1 |
|
| 390 | - |
|
| 391 | - // Toutes les rubriques dont le parent est de profondeur $prof ont une profondeur $prof+1 |
|
| 392 | - // on teste A.profondeur > $prof+1 car : |
|
| 393 | - // - toutes les rubriques de profondeur 0 à $prof sont bonnes |
|
| 394 | - // - si A.profondeur = $prof+1 c'est bon |
|
| 395 | - // - cela nous protege de la boucle infinie en cas de reference circulaire dans les rubriques |
|
| 396 | - $maxiter2 = $maxiter; |
|
| 397 | - while ( |
|
| 398 | - $maxiter2-- |
|
| 399 | - and $rows = sql_allfetsel( |
|
| 400 | - 'A.id_rubrique AS id, R.id_secteur AS id_secteur, R.profondeur+1 as profondeur', |
|
| 401 | - 'spip_rubriques AS A JOIN spip_rubriques AS R ON A.id_parent = R.id_rubrique', |
|
| 402 | - 'R.profondeur=' . intval($prof) . ' AND (A.id_secteur <> R.id_secteur OR A.profondeur > R.profondeur+1)', |
|
| 403 | - '', |
|
| 404 | - 'R.id_secteur', |
|
| 405 | - '0,100' |
|
| 406 | - ) |
|
| 407 | - ) { |
|
| 408 | - $id_secteur = null; |
|
| 409 | - $ids = []; |
|
| 410 | - while ($row = array_shift($rows)) { |
|
| 411 | - if ($row['id_secteur'] !== $id_secteur) { |
|
| 412 | - if (count($ids)) { |
|
| 413 | - sql_updateq( |
|
| 414 | - 'spip_rubriques', |
|
| 415 | - ['id_secteur' => $id_secteur, 'profondeur' => $prof + 1], |
|
| 416 | - sql_in('id_rubrique', $ids) |
|
| 417 | - ); |
|
| 418 | - } |
|
| 419 | - $id_secteur = $row['id_secteur']; |
|
| 420 | - $ids = []; |
|
| 421 | - } |
|
| 422 | - $ids[] = $row['id']; |
|
| 423 | - } |
|
| 424 | - if (count($ids)) { |
|
| 425 | - sql_updateq( |
|
| 426 | - 'spip_rubriques', |
|
| 427 | - ['id_secteur' => $id_secteur, 'profondeur' => $prof + 1], |
|
| 428 | - sql_in('id_rubrique', $ids) |
|
| 429 | - ); |
|
| 430 | - } |
|
| 431 | - } |
|
| 432 | - |
|
| 433 | - |
|
| 434 | - // Toutes les rubriques de profondeur $prof+1 qui n'ont pas un parent de profondeur $prof sont decalees |
|
| 435 | - $maxiter2 = $maxiter; |
|
| 436 | - while ( |
|
| 437 | - $maxiter2-- |
|
| 438 | - and $rows = sql_allfetsel( |
|
| 439 | - 'id_rubrique as id', |
|
| 440 | - 'spip_rubriques', |
|
| 441 | - 'profondeur=' . intval($prof + 1) . ' AND id_parent NOT IN (' . sql_get_select( |
|
| 442 | - 'zzz.id_rubrique', |
|
| 443 | - 'spip_rubriques AS zzz', |
|
| 444 | - 'zzz.profondeur=' . intval($prof) |
|
| 445 | - ) . ')', |
|
| 446 | - '', |
|
| 447 | - '', |
|
| 448 | - '0,100' |
|
| 449 | - ) |
|
| 450 | - ) { |
|
| 451 | - $rows = array_column($rows, 'id'); |
|
| 452 | - sql_updateq('spip_rubriques', ['profondeur' => $prof + 2], sql_in('id_rubrique', $rows)); |
|
| 453 | - } |
|
| 454 | - |
|
| 455 | - // ici on a fini de valider $prof+1, toutes les rubriques de prondeur 0 a $prof+1 sont OK |
|
| 456 | - // si pas de rubrique a profondeur $prof+1 pas la peine de continuer |
|
| 457 | - // si il reste des rubriques non vues, c'est une branche morte ou reference circulaire (base foireuse) |
|
| 458 | - // on arrete les frais |
|
| 459 | - if (sql_countsel('spip_rubriques', 'profondeur=' . intval($prof + 1))) { |
|
| 460 | - $prof++; |
|
| 461 | - $continuer = true; |
|
| 462 | - } |
|
| 463 | - } while ($continuer and $maxiter--); |
|
| 464 | - |
|
| 465 | - // loger si la table des rubriques semble foireuse |
|
| 466 | - // et mettre un id_secteur=0 sur ces rubriques pour eviter toute selection par les boucles |
|
| 467 | - if (sql_countsel('spip_rubriques', 'profondeur>' . intval($prof + 1))) { |
|
| 468 | - spip_log( |
|
| 469 | - 'Les rubriques de profondeur>' . ($prof + 1) . ' semblent suspectes (branches morte ou reference circulaire dans les parents)', |
|
| 470 | - _LOG_CRITIQUE |
|
| 471 | - ); |
|
| 472 | - sql_update('spip_rubriques', ['id_secteur' => 0], 'profondeur>' . intval($prof + 1)); |
|
| 473 | - } |
|
| 474 | - |
|
| 475 | - // reparer les articles |
|
| 476 | - $r = sql_select( |
|
| 477 | - 'A.id_article AS id, R.id_secteur AS secteur', |
|
| 478 | - 'spip_articles AS A, spip_rubriques AS R', |
|
| 479 | - 'A.id_rubrique = R.id_rubrique AND A.id_secteur <> R.id_secteur' |
|
| 480 | - ); |
|
| 481 | - |
|
| 482 | - while ($row = sql_fetch($r)) { |
|
| 483 | - sql_update('spip_articles', ['id_secteur' => $row['secteur']], 'id_article=' . intval($row['id'])); |
|
| 484 | - } |
|
| 485 | - |
|
| 486 | - // avertir les plugins qui peuvent faire leur mises a jour egalement |
|
| 487 | - pipeline('trig_propager_les_secteurs', ''); |
|
| 371 | + // Profondeur 0 |
|
| 372 | + // Toutes les rubriques racines sont de profondeur 0 |
|
| 373 | + // et fixer les id_secteur des rubriques racines |
|
| 374 | + sql_update('spip_rubriques', ['id_secteur' => 'id_rubrique', 'profondeur' => 0], 'id_parent=0'); |
|
| 375 | + // Toute rubrique non racine est de profondeur >0 |
|
| 376 | + sql_updateq('spip_rubriques', ['profondeur' => 1], 'id_parent<>0 AND profondeur=0'); |
|
| 377 | + |
|
| 378 | + // securite : pas plus d'iteration que de rubriques dans la base |
|
| 379 | + $maxiter = sql_countsel('spip_rubriques'); |
|
| 380 | + |
|
| 381 | + // reparer les rubriques qui n'ont pas l'id_secteur de leur parent |
|
| 382 | + // on fait profondeur par profondeur |
|
| 383 | + |
|
| 384 | + $prof = 0; |
|
| 385 | + do { |
|
| 386 | + $continuer = false; |
|
| 387 | + |
|
| 388 | + // Par recursivite : si toutes les rubriques de profondeur $prof sont bonnes |
|
| 389 | + // on fixe le profondeur $prof+1 |
|
| 390 | + |
|
| 391 | + // Toutes les rubriques dont le parent est de profondeur $prof ont une profondeur $prof+1 |
|
| 392 | + // on teste A.profondeur > $prof+1 car : |
|
| 393 | + // - toutes les rubriques de profondeur 0 à $prof sont bonnes |
|
| 394 | + // - si A.profondeur = $prof+1 c'est bon |
|
| 395 | + // - cela nous protege de la boucle infinie en cas de reference circulaire dans les rubriques |
|
| 396 | + $maxiter2 = $maxiter; |
|
| 397 | + while ( |
|
| 398 | + $maxiter2-- |
|
| 399 | + and $rows = sql_allfetsel( |
|
| 400 | + 'A.id_rubrique AS id, R.id_secteur AS id_secteur, R.profondeur+1 as profondeur', |
|
| 401 | + 'spip_rubriques AS A JOIN spip_rubriques AS R ON A.id_parent = R.id_rubrique', |
|
| 402 | + 'R.profondeur=' . intval($prof) . ' AND (A.id_secteur <> R.id_secteur OR A.profondeur > R.profondeur+1)', |
|
| 403 | + '', |
|
| 404 | + 'R.id_secteur', |
|
| 405 | + '0,100' |
|
| 406 | + ) |
|
| 407 | + ) { |
|
| 408 | + $id_secteur = null; |
|
| 409 | + $ids = []; |
|
| 410 | + while ($row = array_shift($rows)) { |
|
| 411 | + if ($row['id_secteur'] !== $id_secteur) { |
|
| 412 | + if (count($ids)) { |
|
| 413 | + sql_updateq( |
|
| 414 | + 'spip_rubriques', |
|
| 415 | + ['id_secteur' => $id_secteur, 'profondeur' => $prof + 1], |
|
| 416 | + sql_in('id_rubrique', $ids) |
|
| 417 | + ); |
|
| 418 | + } |
|
| 419 | + $id_secteur = $row['id_secteur']; |
|
| 420 | + $ids = []; |
|
| 421 | + } |
|
| 422 | + $ids[] = $row['id']; |
|
| 423 | + } |
|
| 424 | + if (count($ids)) { |
|
| 425 | + sql_updateq( |
|
| 426 | + 'spip_rubriques', |
|
| 427 | + ['id_secteur' => $id_secteur, 'profondeur' => $prof + 1], |
|
| 428 | + sql_in('id_rubrique', $ids) |
|
| 429 | + ); |
|
| 430 | + } |
|
| 431 | + } |
|
| 432 | + |
|
| 433 | + |
|
| 434 | + // Toutes les rubriques de profondeur $prof+1 qui n'ont pas un parent de profondeur $prof sont decalees |
|
| 435 | + $maxiter2 = $maxiter; |
|
| 436 | + while ( |
|
| 437 | + $maxiter2-- |
|
| 438 | + and $rows = sql_allfetsel( |
|
| 439 | + 'id_rubrique as id', |
|
| 440 | + 'spip_rubriques', |
|
| 441 | + 'profondeur=' . intval($prof + 1) . ' AND id_parent NOT IN (' . sql_get_select( |
|
| 442 | + 'zzz.id_rubrique', |
|
| 443 | + 'spip_rubriques AS zzz', |
|
| 444 | + 'zzz.profondeur=' . intval($prof) |
|
| 445 | + ) . ')', |
|
| 446 | + '', |
|
| 447 | + '', |
|
| 448 | + '0,100' |
|
| 449 | + ) |
|
| 450 | + ) { |
|
| 451 | + $rows = array_column($rows, 'id'); |
|
| 452 | + sql_updateq('spip_rubriques', ['profondeur' => $prof + 2], sql_in('id_rubrique', $rows)); |
|
| 453 | + } |
|
| 454 | + |
|
| 455 | + // ici on a fini de valider $prof+1, toutes les rubriques de prondeur 0 a $prof+1 sont OK |
|
| 456 | + // si pas de rubrique a profondeur $prof+1 pas la peine de continuer |
|
| 457 | + // si il reste des rubriques non vues, c'est une branche morte ou reference circulaire (base foireuse) |
|
| 458 | + // on arrete les frais |
|
| 459 | + if (sql_countsel('spip_rubriques', 'profondeur=' . intval($prof + 1))) { |
|
| 460 | + $prof++; |
|
| 461 | + $continuer = true; |
|
| 462 | + } |
|
| 463 | + } while ($continuer and $maxiter--); |
|
| 464 | + |
|
| 465 | + // loger si la table des rubriques semble foireuse |
|
| 466 | + // et mettre un id_secteur=0 sur ces rubriques pour eviter toute selection par les boucles |
|
| 467 | + if (sql_countsel('spip_rubriques', 'profondeur>' . intval($prof + 1))) { |
|
| 468 | + spip_log( |
|
| 469 | + 'Les rubriques de profondeur>' . ($prof + 1) . ' semblent suspectes (branches morte ou reference circulaire dans les parents)', |
|
| 470 | + _LOG_CRITIQUE |
|
| 471 | + ); |
|
| 472 | + sql_update('spip_rubriques', ['id_secteur' => 0], 'profondeur>' . intval($prof + 1)); |
|
| 473 | + } |
|
| 474 | + |
|
| 475 | + // reparer les articles |
|
| 476 | + $r = sql_select( |
|
| 477 | + 'A.id_article AS id, R.id_secteur AS secteur', |
|
| 478 | + 'spip_articles AS A, spip_rubriques AS R', |
|
| 479 | + 'A.id_rubrique = R.id_rubrique AND A.id_secteur <> R.id_secteur' |
|
| 480 | + ); |
|
| 481 | + |
|
| 482 | + while ($row = sql_fetch($r)) { |
|
| 483 | + sql_update('spip_articles', ['id_secteur' => $row['secteur']], 'id_article=' . intval($row['id'])); |
|
| 484 | + } |
|
| 485 | + |
|
| 486 | + // avertir les plugins qui peuvent faire leur mises a jour egalement |
|
| 487 | + pipeline('trig_propager_les_secteurs', ''); |
|
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | |
@@ -499,23 +499,23 @@ discard block |
||
| 499 | 499 | * true si un changement a eu lieu |
| 500 | 500 | **/ |
| 501 | 501 | function calculer_langues_rubriques_etape() { |
| 502 | - $s = sql_select( |
|
| 503 | - 'A.id_rubrique AS id_rubrique, R.lang AS lang', |
|
| 504 | - 'spip_rubriques AS A, spip_rubriques AS R', |
|
| 505 | - "A.id_parent = R.id_rubrique AND A.langue_choisie != 'oui' AND R.lang<>'' AND R.lang<>A.lang" |
|
| 506 | - ); |
|
| 507 | - |
|
| 508 | - $t = false; |
|
| 509 | - while ($row = sql_fetch($s)) { |
|
| 510 | - $id_rubrique = $row['id_rubrique']; |
|
| 511 | - $t = sql_updateq( |
|
| 512 | - 'spip_rubriques', |
|
| 513 | - ['lang' => $row['lang'], 'langue_choisie' => 'non'], |
|
| 514 | - 'id_rubrique=' . intval($id_rubrique) |
|
| 515 | - ); |
|
| 516 | - } |
|
| 517 | - |
|
| 518 | - return $t; |
|
| 502 | + $s = sql_select( |
|
| 503 | + 'A.id_rubrique AS id_rubrique, R.lang AS lang', |
|
| 504 | + 'spip_rubriques AS A, spip_rubriques AS R', |
|
| 505 | + "A.id_parent = R.id_rubrique AND A.langue_choisie != 'oui' AND R.lang<>'' AND R.lang<>A.lang" |
|
| 506 | + ); |
|
| 507 | + |
|
| 508 | + $t = false; |
|
| 509 | + while ($row = sql_fetch($s)) { |
|
| 510 | + $id_rubrique = $row['id_rubrique']; |
|
| 511 | + $t = sql_updateq( |
|
| 512 | + 'spip_rubriques', |
|
| 513 | + ['lang' => $row['lang'], 'langue_choisie' => 'non'], |
|
| 514 | + 'id_rubrique=' . intval($id_rubrique) |
|
| 515 | + ); |
|
| 516 | + } |
|
| 517 | + |
|
| 518 | + return $t; |
|
| 519 | 519 | } |
| 520 | 520 | |
| 521 | 521 | /** |
@@ -535,38 +535,38 @@ discard block |
||
| 535 | 535 | **/ |
| 536 | 536 | function calculer_langues_rubriques() { |
| 537 | 537 | |
| 538 | - // rubriques (recursivite) |
|
| 539 | - sql_updateq( |
|
| 540 | - 'spip_rubriques', |
|
| 541 | - ['lang' => $GLOBALS['meta']['langue_site'], 'langue_choisie' => 'non'], |
|
| 542 | - "id_parent=0 AND langue_choisie != 'oui'" |
|
| 543 | - ); |
|
| 544 | - while (calculer_langues_rubriques_etape()) { |
|
| 545 | - ; |
|
| 546 | - } |
|
| 547 | - |
|
| 548 | - // articles |
|
| 549 | - $s = sql_select( |
|
| 550 | - 'A.id_article AS id_article, R.lang AS lang', |
|
| 551 | - 'spip_articles AS A, spip_rubriques AS R', |
|
| 552 | - "A.id_rubrique = R.id_rubrique AND A.langue_choisie != 'oui' AND (length(A.lang)=0 OR length(R.lang)>0) AND R.lang<>A.lang" |
|
| 553 | - ); |
|
| 554 | - while ($row = sql_fetch($s)) { |
|
| 555 | - $id_article = $row['id_article']; |
|
| 556 | - sql_updateq( |
|
| 557 | - 'spip_articles', |
|
| 558 | - ['lang' => $row['lang'], 'langue_choisie' => 'non'], |
|
| 559 | - 'id_article=' . intval($id_article) |
|
| 560 | - ); |
|
| 561 | - } |
|
| 562 | - |
|
| 563 | - if ($GLOBALS['meta']['multi_rubriques'] == 'oui') { |
|
| 564 | - $langues = calculer_langues_utilisees(); |
|
| 565 | - ecrire_meta('langues_utilisees', $langues); |
|
| 566 | - } |
|
| 567 | - |
|
| 568 | - // avertir les plugins qui peuvent faire leur mises a jour egalement |
|
| 569 | - pipeline('trig_calculer_langues_rubriques', ''); |
|
| 538 | + // rubriques (recursivite) |
|
| 539 | + sql_updateq( |
|
| 540 | + 'spip_rubriques', |
|
| 541 | + ['lang' => $GLOBALS['meta']['langue_site'], 'langue_choisie' => 'non'], |
|
| 542 | + "id_parent=0 AND langue_choisie != 'oui'" |
|
| 543 | + ); |
|
| 544 | + while (calculer_langues_rubriques_etape()) { |
|
| 545 | + ; |
|
| 546 | + } |
|
| 547 | + |
|
| 548 | + // articles |
|
| 549 | + $s = sql_select( |
|
| 550 | + 'A.id_article AS id_article, R.lang AS lang', |
|
| 551 | + 'spip_articles AS A, spip_rubriques AS R', |
|
| 552 | + "A.id_rubrique = R.id_rubrique AND A.langue_choisie != 'oui' AND (length(A.lang)=0 OR length(R.lang)>0) AND R.lang<>A.lang" |
|
| 553 | + ); |
|
| 554 | + while ($row = sql_fetch($s)) { |
|
| 555 | + $id_article = $row['id_article']; |
|
| 556 | + sql_updateq( |
|
| 557 | + 'spip_articles', |
|
| 558 | + ['lang' => $row['lang'], 'langue_choisie' => 'non'], |
|
| 559 | + 'id_article=' . intval($id_article) |
|
| 560 | + ); |
|
| 561 | + } |
|
| 562 | + |
|
| 563 | + if ($GLOBALS['meta']['multi_rubriques'] == 'oui') { |
|
| 564 | + $langues = calculer_langues_utilisees(); |
|
| 565 | + ecrire_meta('langues_utilisees', $langues); |
|
| 566 | + } |
|
| 567 | + |
|
| 568 | + // avertir les plugins qui peuvent faire leur mises a jour egalement |
|
| 569 | + pipeline('trig_calculer_langues_rubriques', ''); |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | |
@@ -583,80 +583,80 @@ discard block |
||
| 583 | 583 | * Liste des langues utilisées séparées par des virgules |
| 584 | 584 | **/ |
| 585 | 585 | function calculer_langues_utilisees($serveur = '') { |
| 586 | - include_spip('public/interfaces'); |
|
| 587 | - include_spip('public/compiler'); |
|
| 588 | - include_spip('public/composer'); |
|
| 589 | - include_spip('public/phraser_html'); |
|
| 590 | - $langues = []; |
|
| 591 | - |
|
| 592 | - $langues[$GLOBALS['meta']['langue_site']] = 1; |
|
| 593 | - |
|
| 594 | - include_spip('base/objets'); |
|
| 595 | - $tables = lister_tables_objets_sql(); |
|
| 596 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 597 | - |
|
| 598 | - foreach (array_keys($tables) as $t) { |
|
| 599 | - $desc = $trouver_table($t, $serveur); |
|
| 600 | - // c'est une table avec des langues |
|
| 601 | - if ( |
|
| 602 | - $desc['exist'] |
|
| 603 | - and isset($desc['field']['lang']) |
|
| 604 | - and isset($desc['field']['langue_choisie']) |
|
| 605 | - ) { |
|
| 606 | - $boucle = new Boucle(); |
|
| 607 | - $boucle->show = $desc; |
|
| 608 | - $boucle->nom = 'calculer_langues_utilisees'; |
|
| 609 | - $boucle->id_boucle = $desc['table_objet']; |
|
| 610 | - $boucle->id_table = $desc['table_objet']; |
|
| 611 | - $boucle->primary = $desc['key']['PRIMARY KEY'] ?? ''; |
|
| 612 | - $boucle->sql_serveur = $serveur; |
|
| 613 | - $boucle->select[] = 'DISTINCT lang'; |
|
| 614 | - $boucle->from[$desc['table_objet']] = $t; |
|
| 615 | - $boucle->separateur[] = ','; |
|
| 616 | - $boucle->return = '$Pile[$SP][\'lang\']'; |
|
| 617 | - $boucle->iterateur = 'sql'; |
|
| 618 | - |
|
| 619 | - $boucle->descr['nom'] = 'calculer_langues_utilisees'; // eviter notice php |
|
| 620 | - $boucle->descr['sourcefile'] = 'internal'; |
|
| 621 | - $boucle->descr['gram'] = 'html'; |
|
| 622 | - |
|
| 623 | - $boucle = pipeline('pre_boucle', $boucle); |
|
| 624 | - |
|
| 625 | - if ( |
|
| 626 | - isset($desc['statut']) |
|
| 627 | - and $desc['statut'] |
|
| 628 | - ) { |
|
| 629 | - $boucles = [ |
|
| 630 | - 'calculer_langues_utilisees' => $boucle, |
|
| 631 | - ]; |
|
| 632 | - // generer un nom de fonction "anonyme" unique |
|
| 633 | - do { |
|
| 634 | - $functionname = 'f_calculer_langues_utilisees_' . $boucle->id_table . '_' . time() . '_' . random_int(0, mt_getrandmax()); |
|
| 635 | - } while (function_exists($functionname)); |
|
| 636 | - $code = calculer_boucle('calculer_langues_utilisees', $boucles); |
|
| 637 | - $code = '$SP=0; $command=array();$command["connect"] = $connect = "' . $serveur . '"; $Pile=array(0=>array());' . "\n" . $code; |
|
| 638 | - $code = 'function ' . $functionname . '(){' . $code . '};$res = ' . $functionname . '();'; |
|
| 639 | - $res = ''; |
|
| 640 | - eval($code); |
|
| 641 | - $res = explode(',', $res); |
|
| 642 | - foreach ($res as $lang) { |
|
| 643 | - $langues[$lang] = 1; |
|
| 644 | - } |
|
| 645 | - } else { |
|
| 646 | - $res = sql_select(implode(',', $boucle->select), $boucle->from); |
|
| 647 | - while ($row = sql_fetch($res)) { |
|
| 648 | - $langues[$row['lang']] = 1; |
|
| 649 | - } |
|
| 650 | - } |
|
| 651 | - } |
|
| 652 | - } |
|
| 653 | - |
|
| 654 | - $langues = array_filter(array_keys($langues)); |
|
| 655 | - sort($langues); |
|
| 656 | - $langues = join(',', $langues); |
|
| 657 | - spip_log("langues utilisees: $langues"); |
|
| 658 | - |
|
| 659 | - return $langues; |
|
| 586 | + include_spip('public/interfaces'); |
|
| 587 | + include_spip('public/compiler'); |
|
| 588 | + include_spip('public/composer'); |
|
| 589 | + include_spip('public/phraser_html'); |
|
| 590 | + $langues = []; |
|
| 591 | + |
|
| 592 | + $langues[$GLOBALS['meta']['langue_site']] = 1; |
|
| 593 | + |
|
| 594 | + include_spip('base/objets'); |
|
| 595 | + $tables = lister_tables_objets_sql(); |
|
| 596 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 597 | + |
|
| 598 | + foreach (array_keys($tables) as $t) { |
|
| 599 | + $desc = $trouver_table($t, $serveur); |
|
| 600 | + // c'est une table avec des langues |
|
| 601 | + if ( |
|
| 602 | + $desc['exist'] |
|
| 603 | + and isset($desc['field']['lang']) |
|
| 604 | + and isset($desc['field']['langue_choisie']) |
|
| 605 | + ) { |
|
| 606 | + $boucle = new Boucle(); |
|
| 607 | + $boucle->show = $desc; |
|
| 608 | + $boucle->nom = 'calculer_langues_utilisees'; |
|
| 609 | + $boucle->id_boucle = $desc['table_objet']; |
|
| 610 | + $boucle->id_table = $desc['table_objet']; |
|
| 611 | + $boucle->primary = $desc['key']['PRIMARY KEY'] ?? ''; |
|
| 612 | + $boucle->sql_serveur = $serveur; |
|
| 613 | + $boucle->select[] = 'DISTINCT lang'; |
|
| 614 | + $boucle->from[$desc['table_objet']] = $t; |
|
| 615 | + $boucle->separateur[] = ','; |
|
| 616 | + $boucle->return = '$Pile[$SP][\'lang\']'; |
|
| 617 | + $boucle->iterateur = 'sql'; |
|
| 618 | + |
|
| 619 | + $boucle->descr['nom'] = 'calculer_langues_utilisees'; // eviter notice php |
|
| 620 | + $boucle->descr['sourcefile'] = 'internal'; |
|
| 621 | + $boucle->descr['gram'] = 'html'; |
|
| 622 | + |
|
| 623 | + $boucle = pipeline('pre_boucle', $boucle); |
|
| 624 | + |
|
| 625 | + if ( |
|
| 626 | + isset($desc['statut']) |
|
| 627 | + and $desc['statut'] |
|
| 628 | + ) { |
|
| 629 | + $boucles = [ |
|
| 630 | + 'calculer_langues_utilisees' => $boucle, |
|
| 631 | + ]; |
|
| 632 | + // generer un nom de fonction "anonyme" unique |
|
| 633 | + do { |
|
| 634 | + $functionname = 'f_calculer_langues_utilisees_' . $boucle->id_table . '_' . time() . '_' . random_int(0, mt_getrandmax()); |
|
| 635 | + } while (function_exists($functionname)); |
|
| 636 | + $code = calculer_boucle('calculer_langues_utilisees', $boucles); |
|
| 637 | + $code = '$SP=0; $command=array();$command["connect"] = $connect = "' . $serveur . '"; $Pile=array(0=>array());' . "\n" . $code; |
|
| 638 | + $code = 'function ' . $functionname . '(){' . $code . '};$res = ' . $functionname . '();'; |
|
| 639 | + $res = ''; |
|
| 640 | + eval($code); |
|
| 641 | + $res = explode(',', $res); |
|
| 642 | + foreach ($res as $lang) { |
|
| 643 | + $langues[$lang] = 1; |
|
| 644 | + } |
|
| 645 | + } else { |
|
| 646 | + $res = sql_select(implode(',', $boucle->select), $boucle->from); |
|
| 647 | + while ($row = sql_fetch($res)) { |
|
| 648 | + $langues[$row['lang']] = 1; |
|
| 649 | + } |
|
| 650 | + } |
|
| 651 | + } |
|
| 652 | + } |
|
| 653 | + |
|
| 654 | + $langues = array_filter(array_keys($langues)); |
|
| 655 | + sort($langues); |
|
| 656 | + $langues = join(',', $langues); |
|
| 657 | + spip_log("langues utilisees: $langues"); |
|
| 658 | + |
|
| 659 | + return $langues; |
|
| 660 | 660 | } |
| 661 | 661 | |
| 662 | 662 | /** |
@@ -673,9 +673,9 @@ discard block |
||
| 673 | 673 | * incluant les rubriques noeuds et toutes leurs descendances |
| 674 | 674 | */ |
| 675 | 675 | function calcul_branche_in($id) { |
| 676 | - $calcul_branche_in = charger_fonction('calcul_branche_in', 'inc'); |
|
| 676 | + $calcul_branche_in = charger_fonction('calcul_branche_in', 'inc'); |
|
| 677 | 677 | |
| 678 | - return $calcul_branche_in($id); |
|
| 678 | + return $calcul_branche_in($id); |
|
| 679 | 679 | } |
| 680 | 680 | |
| 681 | 681 | /** |
@@ -693,9 +693,9 @@ discard block |
||
| 693 | 693 | * incluant les rubriques transmises et toutes leurs parentées |
| 694 | 694 | */ |
| 695 | 695 | function calcul_hierarchie_in($id, $tout = true) { |
| 696 | - $calcul_hierarchie_in = charger_fonction('calcul_hierarchie_in', 'inc'); |
|
| 696 | + $calcul_hierarchie_in = charger_fonction('calcul_hierarchie_in', 'inc'); |
|
| 697 | 697 | |
| 698 | - return $calcul_hierarchie_in($id, $tout); |
|
| 698 | + return $calcul_hierarchie_in($id, $tout); |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | |
@@ -716,40 +716,40 @@ discard block |
||
| 716 | 716 | * incluant les rubriques noeuds et toutes leurs descendances |
| 717 | 717 | */ |
| 718 | 718 | function inc_calcul_branche_in_dist($id) { |
| 719 | - static $b = []; |
|
| 720 | - |
|
| 721 | - // normaliser $id qui a pu arriver comme un array, comme un entier, ou comme une chaine NN,NN,NN |
|
| 722 | - if (!is_array($id)) { |
|
| 723 | - $id = explode(',', $id); |
|
| 724 | - } |
|
| 725 | - $id = join(',', array_map('intval', $id)); |
|
| 726 | - if (isset($b[$id])) { |
|
| 727 | - return $b[$id]; |
|
| 728 | - } |
|
| 729 | - |
|
| 730 | - // Notre branche commence par la rubrique de depart |
|
| 731 | - $branche = $r = $id; |
|
| 732 | - |
|
| 733 | - // On ajoute une generation (les filles de la generation precedente) |
|
| 734 | - // jusqu'a epuisement, en se protegeant des references circulaires |
|
| 735 | - $maxiter = 10000; |
|
| 736 | - while ( |
|
| 737 | - $maxiter-- and $filles = sql_allfetsel( |
|
| 738 | - 'id_rubrique', |
|
| 739 | - 'spip_rubriques', |
|
| 740 | - sql_in('id_parent', $r) . ' AND ' . sql_in('id_rubrique', $r, 'NOT') |
|
| 741 | - ) |
|
| 742 | - ) { |
|
| 743 | - $r = join(',', array_column($filles, 'id_rubrique')); |
|
| 744 | - $branche .= ',' . $r; |
|
| 745 | - } |
|
| 746 | - |
|
| 747 | - # securite pour ne pas plomber la conso memoire sur les sites prolifiques |
|
| 748 | - if (strlen($branche) < 10000) { |
|
| 749 | - $b[$id] = $branche; |
|
| 750 | - } |
|
| 751 | - |
|
| 752 | - return $branche; |
|
| 719 | + static $b = []; |
|
| 720 | + |
|
| 721 | + // normaliser $id qui a pu arriver comme un array, comme un entier, ou comme une chaine NN,NN,NN |
|
| 722 | + if (!is_array($id)) { |
|
| 723 | + $id = explode(',', $id); |
|
| 724 | + } |
|
| 725 | + $id = join(',', array_map('intval', $id)); |
|
| 726 | + if (isset($b[$id])) { |
|
| 727 | + return $b[$id]; |
|
| 728 | + } |
|
| 729 | + |
|
| 730 | + // Notre branche commence par la rubrique de depart |
|
| 731 | + $branche = $r = $id; |
|
| 732 | + |
|
| 733 | + // On ajoute une generation (les filles de la generation precedente) |
|
| 734 | + // jusqu'a epuisement, en se protegeant des references circulaires |
|
| 735 | + $maxiter = 10000; |
|
| 736 | + while ( |
|
| 737 | + $maxiter-- and $filles = sql_allfetsel( |
|
| 738 | + 'id_rubrique', |
|
| 739 | + 'spip_rubriques', |
|
| 740 | + sql_in('id_parent', $r) . ' AND ' . sql_in('id_rubrique', $r, 'NOT') |
|
| 741 | + ) |
|
| 742 | + ) { |
|
| 743 | + $r = join(',', array_column($filles, 'id_rubrique')); |
|
| 744 | + $branche .= ',' . $r; |
|
| 745 | + } |
|
| 746 | + |
|
| 747 | + # securite pour ne pas plomber la conso memoire sur les sites prolifiques |
|
| 748 | + if (strlen($branche) < 10000) { |
|
| 749 | + $b[$id] = $branche; |
|
| 750 | + } |
|
| 751 | + |
|
| 752 | + return $branche; |
|
| 753 | 753 | } |
| 754 | 754 | |
| 755 | 755 | |
@@ -771,45 +771,45 @@ discard block |
||
| 771 | 771 | * incluant les rubriques transmises et toutes leurs parentées |
| 772 | 772 | */ |
| 773 | 773 | function inc_calcul_hierarchie_in_dist($id, $tout = true) { |
| 774 | - static $b = []; |
|
| 775 | - |
|
| 776 | - // normaliser $id qui a pu arriver comme un array, comme un entier, ou comme une chaine NN,NN,NN |
|
| 777 | - if (!is_array($id)) { |
|
| 778 | - $id = explode(',', $id); |
|
| 779 | - } |
|
| 780 | - $id = join(',', array_map('intval', $id)); |
|
| 781 | - |
|
| 782 | - if (isset($b[$id])) { |
|
| 783 | - // Notre branche commence par la rubrique de depart si $tout=true |
|
| 784 | - return $tout ? (strlen($b[$id]) ? $b[$id] . ",$id" : $id) : $b[$id]; |
|
| 785 | - } |
|
| 786 | - |
|
| 787 | - $hier = ''; |
|
| 788 | - |
|
| 789 | - // On ajoute une generation (les filles de la generation precedente) |
|
| 790 | - // jusqu'a epuisement, en se protegeant des references circulaires |
|
| 791 | - $ids_nouveaux_parents = $id; |
|
| 792 | - $maxiter = 10000; |
|
| 793 | - while ( |
|
| 794 | - $maxiter-- and $parents = sql_allfetsel( |
|
| 795 | - 'id_parent', |
|
| 796 | - 'spip_rubriques', |
|
| 797 | - sql_in('id_rubrique', $ids_nouveaux_parents) . ' AND ' . sql_in('id_parent', $hier, 'NOT') |
|
| 798 | - ) |
|
| 799 | - ) { |
|
| 800 | - $ids_nouveaux_parents = join(',', array_column($parents, 'id_parent')); |
|
| 801 | - $hier = $ids_nouveaux_parents . (strlen($hier) ? ',' . $hier : ''); |
|
| 802 | - } |
|
| 803 | - |
|
| 804 | - # securite pour ne pas plomber la conso memoire sur les sites prolifiques |
|
| 805 | - if (strlen($hier) < 10000) { |
|
| 806 | - $b[$id] = $hier; |
|
| 807 | - } |
|
| 808 | - |
|
| 809 | - // Notre branche commence par la rubrique de depart si $tout=true |
|
| 810 | - $hier = $tout ? (strlen($hier) ? "$hier,$id" : $id) : $hier; |
|
| 811 | - |
|
| 812 | - return $hier; |
|
| 774 | + static $b = []; |
|
| 775 | + |
|
| 776 | + // normaliser $id qui a pu arriver comme un array, comme un entier, ou comme une chaine NN,NN,NN |
|
| 777 | + if (!is_array($id)) { |
|
| 778 | + $id = explode(',', $id); |
|
| 779 | + } |
|
| 780 | + $id = join(',', array_map('intval', $id)); |
|
| 781 | + |
|
| 782 | + if (isset($b[$id])) { |
|
| 783 | + // Notre branche commence par la rubrique de depart si $tout=true |
|
| 784 | + return $tout ? (strlen($b[$id]) ? $b[$id] . ",$id" : $id) : $b[$id]; |
|
| 785 | + } |
|
| 786 | + |
|
| 787 | + $hier = ''; |
|
| 788 | + |
|
| 789 | + // On ajoute une generation (les filles de la generation precedente) |
|
| 790 | + // jusqu'a epuisement, en se protegeant des references circulaires |
|
| 791 | + $ids_nouveaux_parents = $id; |
|
| 792 | + $maxiter = 10000; |
|
| 793 | + while ( |
|
| 794 | + $maxiter-- and $parents = sql_allfetsel( |
|
| 795 | + 'id_parent', |
|
| 796 | + 'spip_rubriques', |
|
| 797 | + sql_in('id_rubrique', $ids_nouveaux_parents) . ' AND ' . sql_in('id_parent', $hier, 'NOT') |
|
| 798 | + ) |
|
| 799 | + ) { |
|
| 800 | + $ids_nouveaux_parents = join(',', array_column($parents, 'id_parent')); |
|
| 801 | + $hier = $ids_nouveaux_parents . (strlen($hier) ? ',' . $hier : ''); |
|
| 802 | + } |
|
| 803 | + |
|
| 804 | + # securite pour ne pas plomber la conso memoire sur les sites prolifiques |
|
| 805 | + if (strlen($hier) < 10000) { |
|
| 806 | + $b[$id] = $hier; |
|
| 807 | + } |
|
| 808 | + |
|
| 809 | + // Notre branche commence par la rubrique de depart si $tout=true |
|
| 810 | + $hier = $tout ? (strlen($hier) ? "$hier,$id" : $id) : $hier; |
|
| 811 | + |
|
| 812 | + return $hier; |
|
| 813 | 813 | } |
| 814 | 814 | |
| 815 | 815 | |
@@ -827,47 +827,47 @@ discard block |
||
| 827 | 827 | * @return void |
| 828 | 828 | **/ |
| 829 | 829 | function calculer_prochain_postdate($check = false) { |
| 830 | - include_spip('base/abstract_sql'); |
|
| 831 | - if ($check) { |
|
| 832 | - $postdates = ($GLOBALS['meta']['post_dates'] == 'non') ? |
|
| 833 | - 'AND A.date <= ' . sql_quote(date('Y-m-d H:i:s')) : ''; |
|
| 834 | - |
|
| 835 | - $r = sql_select( |
|
| 836 | - 'DISTINCT A.id_rubrique AS id', |
|
| 837 | - 'spip_articles AS A LEFT JOIN spip_rubriques AS R ON A.id_rubrique=R.id_rubrique', |
|
| 838 | - "R.statut != 'publie' AND A.statut='publie'$postdates" |
|
| 839 | - ); |
|
| 840 | - while ($row = sql_fetch($r)) { |
|
| 841 | - publier_branche_rubrique($row['id']); |
|
| 842 | - } |
|
| 843 | - |
|
| 844 | - pipeline('trig_calculer_prochain_postdate', ''); |
|
| 845 | - } |
|
| 846 | - |
|
| 847 | - $t = sql_fetsel( |
|
| 848 | - 'date', |
|
| 849 | - 'spip_articles', |
|
| 850 | - "statut='publie' AND date > " . sql_quote(date('Y-m-d H:i:s')), |
|
| 851 | - '', |
|
| 852 | - 'date', |
|
| 853 | - '1' |
|
| 854 | - ); |
|
| 855 | - |
|
| 856 | - if ($t) { |
|
| 857 | - $t = $t['date']; |
|
| 858 | - if ( |
|
| 859 | - !isset($GLOBALS['meta']['date_prochain_postdate']) |
|
| 860 | - or $t <> $GLOBALS['meta']['date_prochain_postdate'] |
|
| 861 | - ) { |
|
| 862 | - ecrire_meta('date_prochain_postdate', strtotime($t)); |
|
| 863 | - ecrire_meta('derniere_modif', time()); |
|
| 864 | - } |
|
| 865 | - } else { |
|
| 866 | - effacer_meta('date_prochain_postdate'); |
|
| 867 | - ecrire_meta('derniere_modif', time()); |
|
| 868 | - } |
|
| 869 | - |
|
| 870 | - spip_log("prochain postdate: $t"); |
|
| 830 | + include_spip('base/abstract_sql'); |
|
| 831 | + if ($check) { |
|
| 832 | + $postdates = ($GLOBALS['meta']['post_dates'] == 'non') ? |
|
| 833 | + 'AND A.date <= ' . sql_quote(date('Y-m-d H:i:s')) : ''; |
|
| 834 | + |
|
| 835 | + $r = sql_select( |
|
| 836 | + 'DISTINCT A.id_rubrique AS id', |
|
| 837 | + 'spip_articles AS A LEFT JOIN spip_rubriques AS R ON A.id_rubrique=R.id_rubrique', |
|
| 838 | + "R.statut != 'publie' AND A.statut='publie'$postdates" |
|
| 839 | + ); |
|
| 840 | + while ($row = sql_fetch($r)) { |
|
| 841 | + publier_branche_rubrique($row['id']); |
|
| 842 | + } |
|
| 843 | + |
|
| 844 | + pipeline('trig_calculer_prochain_postdate', ''); |
|
| 845 | + } |
|
| 846 | + |
|
| 847 | + $t = sql_fetsel( |
|
| 848 | + 'date', |
|
| 849 | + 'spip_articles', |
|
| 850 | + "statut='publie' AND date > " . sql_quote(date('Y-m-d H:i:s')), |
|
| 851 | + '', |
|
| 852 | + 'date', |
|
| 853 | + '1' |
|
| 854 | + ); |
|
| 855 | + |
|
| 856 | + if ($t) { |
|
| 857 | + $t = $t['date']; |
|
| 858 | + if ( |
|
| 859 | + !isset($GLOBALS['meta']['date_prochain_postdate']) |
|
| 860 | + or $t <> $GLOBALS['meta']['date_prochain_postdate'] |
|
| 861 | + ) { |
|
| 862 | + ecrire_meta('date_prochain_postdate', strtotime($t)); |
|
| 863 | + ecrire_meta('derniere_modif', time()); |
|
| 864 | + } |
|
| 865 | + } else { |
|
| 866 | + effacer_meta('date_prochain_postdate'); |
|
| 867 | + ecrire_meta('derniere_modif', time()); |
|
| 868 | + } |
|
| 869 | + |
|
| 870 | + spip_log("prochain postdate: $t"); |
|
| 871 | 871 | } |
| 872 | 872 | |
| 873 | 873 | /** |
@@ -892,62 +892,62 @@ discard block |
||
| 892 | 892 | */ |
| 893 | 893 | function creer_rubrique_nommee($titre, $id_parent = 0, $serveur = '') { |
| 894 | 894 | |
| 895 | - // eclater l'arborescence demandee |
|
| 896 | - // echapper les </multi> et autres balises fermantes html |
|
| 897 | - $titre = preg_replace(',</([a-z][^>]*)>,ims', "<@\\1>", $titre); |
|
| 898 | - $arbo = explode('/', preg_replace(',^/,', '', $titre)); |
|
| 899 | - include_spip('base/abstract_sql'); |
|
| 900 | - foreach ($arbo as $titre) { |
|
| 901 | - // retablir les </multi> et autres balises fermantes html |
|
| 902 | - $titre = preg_replace(',<@([a-z][^>]*)>,ims', "</\\1>", $titre); |
|
| 903 | - $r = sql_getfetsel( |
|
| 904 | - 'id_rubrique', |
|
| 905 | - 'spip_rubriques', |
|
| 906 | - 'titre = ' . sql_quote($titre) . ' AND id_parent=' . intval($id_parent), |
|
| 907 | - $groupby = [], |
|
| 908 | - $orderby = [], |
|
| 909 | - $limit = '', |
|
| 910 | - $having = [], |
|
| 911 | - $serveur |
|
| 912 | - ); |
|
| 913 | - if ($r !== null) { |
|
| 914 | - $id_parent = $r; |
|
| 915 | - } else { |
|
| 916 | - $id_rubrique = sql_insertq('spip_rubriques', [ |
|
| 917 | - 'titre' => $titre, |
|
| 918 | - 'id_parent' => $id_parent, |
|
| 919 | - 'statut' => 'prepa' |
|
| 920 | - ], $desc = [], $serveur); |
|
| 921 | - if ($id_parent > 0) { |
|
| 922 | - $data = sql_fetsel( |
|
| 923 | - 'id_secteur,lang', |
|
| 924 | - 'spip_rubriques', |
|
| 925 | - "id_rubrique=$id_parent", |
|
| 926 | - $groupby = [], |
|
| 927 | - $orderby = [], |
|
| 928 | - $limit = '', |
|
| 929 | - $having = [], |
|
| 930 | - $serveur |
|
| 931 | - ); |
|
| 932 | - $id_secteur = $data['id_secteur']; |
|
| 933 | - $lang = $data['lang']; |
|
| 934 | - } else { |
|
| 935 | - $id_secteur = $id_rubrique; |
|
| 936 | - $lang = $GLOBALS['meta']['langue_site']; |
|
| 937 | - } |
|
| 938 | - |
|
| 939 | - sql_updateq( |
|
| 940 | - 'spip_rubriques', |
|
| 941 | - ['id_secteur' => $id_secteur, 'lang' => $lang], |
|
| 942 | - 'id_rubrique=' . intval($id_rubrique), |
|
| 943 | - [], |
|
| 944 | - $serveur |
|
| 945 | - ); |
|
| 946 | - |
|
| 947 | - // pour la recursion |
|
| 948 | - $id_parent = $id_rubrique; |
|
| 949 | - } |
|
| 950 | - } |
|
| 951 | - |
|
| 952 | - return intval($id_parent); |
|
| 895 | + // eclater l'arborescence demandee |
|
| 896 | + // echapper les </multi> et autres balises fermantes html |
|
| 897 | + $titre = preg_replace(',</([a-z][^>]*)>,ims', "<@\\1>", $titre); |
|
| 898 | + $arbo = explode('/', preg_replace(',^/,', '', $titre)); |
|
| 899 | + include_spip('base/abstract_sql'); |
|
| 900 | + foreach ($arbo as $titre) { |
|
| 901 | + // retablir les </multi> et autres balises fermantes html |
|
| 902 | + $titre = preg_replace(',<@([a-z][^>]*)>,ims', "</\\1>", $titre); |
|
| 903 | + $r = sql_getfetsel( |
|
| 904 | + 'id_rubrique', |
|
| 905 | + 'spip_rubriques', |
|
| 906 | + 'titre = ' . sql_quote($titre) . ' AND id_parent=' . intval($id_parent), |
|
| 907 | + $groupby = [], |
|
| 908 | + $orderby = [], |
|
| 909 | + $limit = '', |
|
| 910 | + $having = [], |
|
| 911 | + $serveur |
|
| 912 | + ); |
|
| 913 | + if ($r !== null) { |
|
| 914 | + $id_parent = $r; |
|
| 915 | + } else { |
|
| 916 | + $id_rubrique = sql_insertq('spip_rubriques', [ |
|
| 917 | + 'titre' => $titre, |
|
| 918 | + 'id_parent' => $id_parent, |
|
| 919 | + 'statut' => 'prepa' |
|
| 920 | + ], $desc = [], $serveur); |
|
| 921 | + if ($id_parent > 0) { |
|
| 922 | + $data = sql_fetsel( |
|
| 923 | + 'id_secteur,lang', |
|
| 924 | + 'spip_rubriques', |
|
| 925 | + "id_rubrique=$id_parent", |
|
| 926 | + $groupby = [], |
|
| 927 | + $orderby = [], |
|
| 928 | + $limit = '', |
|
| 929 | + $having = [], |
|
| 930 | + $serveur |
|
| 931 | + ); |
|
| 932 | + $id_secteur = $data['id_secteur']; |
|
| 933 | + $lang = $data['lang']; |
|
| 934 | + } else { |
|
| 935 | + $id_secteur = $id_rubrique; |
|
| 936 | + $lang = $GLOBALS['meta']['langue_site']; |
|
| 937 | + } |
|
| 938 | + |
|
| 939 | + sql_updateq( |
|
| 940 | + 'spip_rubriques', |
|
| 941 | + ['id_secteur' => $id_secteur, 'lang' => $lang], |
|
| 942 | + 'id_rubrique=' . intval($id_rubrique), |
|
| 943 | + [], |
|
| 944 | + $serveur |
|
| 945 | + ); |
|
| 946 | + |
|
| 947 | + // pour la recursion |
|
| 948 | + $id_parent = $id_rubrique; |
|
| 949 | + } |
|
| 950 | + } |
|
| 951 | + |
|
| 952 | + return intval($id_parent); |
|
| 953 | 953 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | include_spip('inc/presentation'); |
@@ -31,7 +31,7 @@ discard block |
||
| 31 | 31 | * @uses exec_puce_statut_args() |
| 32 | 32 | **/ |
| 33 | 33 | function exec_puce_statut_dist(): void { |
| 34 | - exec_puce_statut_args(_request('id'), _request('type')); |
|
| 34 | + exec_puce_statut_args(_request('id'), _request('type')); |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | /** |
@@ -50,26 +50,26 @@ discard block |
||
| 50 | 50 | * Type d'objet |
| 51 | 51 | **/ |
| 52 | 52 | function exec_puce_statut_args($id, $type): void { |
| 53 | - $id = intval($id); |
|
| 54 | - if ( |
|
| 55 | - $table_objet_sql = table_objet_sql($type) |
|
| 56 | - and $d = lister_tables_objets_sql($table_objet_sql) |
|
| 57 | - and isset($d['statut_textes_instituer']) |
|
| 58 | - and $d['statut_textes_instituer'] |
|
| 59 | - ) { |
|
| 60 | - $prim = id_table_objet($type); |
|
| 61 | - if (isset($d['field']['id_rubrique'])) { |
|
| 62 | - $select = 'id_rubrique,statut'; |
|
| 63 | - } else { |
|
| 64 | - $select = '0 as id_rubrique,statut'; |
|
| 65 | - } |
|
| 66 | - $r = sql_fetsel($select, $table_objet_sql, "$prim=$id"); |
|
| 67 | - $statut = $r['statut']; |
|
| 68 | - $id_rubrique = $r['id_rubrique']; |
|
| 69 | - } else { |
|
| 70 | - $id_rubrique = $id; |
|
| 71 | - $statut = 'prop'; // arbitraire |
|
| 72 | - } |
|
| 73 | - $puce_statut = charger_fonction('puce_statut', 'inc'); |
|
| 74 | - ajax_retour($puce_statut($id, $statut, $id_rubrique, $type, true)); |
|
| 53 | + $id = intval($id); |
|
| 54 | + if ( |
|
| 55 | + $table_objet_sql = table_objet_sql($type) |
|
| 56 | + and $d = lister_tables_objets_sql($table_objet_sql) |
|
| 57 | + and isset($d['statut_textes_instituer']) |
|
| 58 | + and $d['statut_textes_instituer'] |
|
| 59 | + ) { |
|
| 60 | + $prim = id_table_objet($type); |
|
| 61 | + if (isset($d['field']['id_rubrique'])) { |
|
| 62 | + $select = 'id_rubrique,statut'; |
|
| 63 | + } else { |
|
| 64 | + $select = '0 as id_rubrique,statut'; |
|
| 65 | + } |
|
| 66 | + $r = sql_fetsel($select, $table_objet_sql, "$prim=$id"); |
|
| 67 | + $statut = $r['statut']; |
|
| 68 | + $id_rubrique = $r['id_rubrique']; |
|
| 69 | + } else { |
|
| 70 | + $id_rubrique = $id; |
|
| 71 | + $statut = 'prop'; // arbitraire |
|
| 72 | + } |
|
| 73 | + $puce_statut = charger_fonction('puce_statut', 'inc'); |
|
| 74 | + ajax_retour($puce_statut($id, $statut, $id_rubrique, $type, true)); |
|
| 75 | 75 | } |
@@ -9,384 +9,384 @@ |
||
| 9 | 9 | |
| 10 | 10 | $GLOBALS['CHARSET']['translit'] = [ |
| 11 | 11 | // latin [fausse plage] |
| 12 | - 128 => 'EUR', |
|
| 13 | - 131 => 'f', |
|
| 14 | - 140 => 'OE', |
|
| 15 | - 147 => '\'\'', |
|
| 16 | - 148 => '\'\'', |
|
| 17 | - 153 => '(TM)', |
|
| 18 | - 156 => 'oe', |
|
| 19 | - 159 => 'Y', |
|
| 12 | + 128 => 'EUR', |
|
| 13 | + 131 => 'f', |
|
| 14 | + 140 => 'OE', |
|
| 15 | + 147 => '\'\'', |
|
| 16 | + 148 => '\'\'', |
|
| 17 | + 153 => '(TM)', |
|
| 18 | + 156 => 'oe', |
|
| 19 | + 159 => 'Y', |
|
| 20 | 20 | |
| 21 | 21 | // latin [legal] |
| 22 | - 160 => ' ', |
|
| 23 | - 161 => '!', |
|
| 24 | - 162 => 'c', |
|
| 25 | - 163 => 'L', |
|
| 26 | - 164 => 'O', |
|
| 27 | - 165 => 'yen', |
|
| 28 | - 166 => '|', |
|
| 29 | - 167 => 'p', |
|
| 30 | - 169 => '(c)', |
|
| 31 | - 171 => '<<', |
|
| 32 | - 172 => '-', |
|
| 33 | - 173 => '-', |
|
| 34 | - 174 => '(R)', |
|
| 35 | - 176 => 'o', |
|
| 36 | - 177 => '+-', |
|
| 37 | - 181 => 'mu', |
|
| 38 | - 182 => 'p', |
|
| 39 | - 183 => '.', |
|
| 40 | - 186 => 'o ', |
|
| 41 | - 187 => '>>', |
|
| 42 | - 191 => '?', |
|
| 43 | - 192 => 'A', |
|
| 44 | - 193 => 'A', |
|
| 45 | - 194 => 'A', |
|
| 46 | - 195 => 'A', |
|
| 47 | - 196 => 'A', |
|
| 48 | - 197 => 'A', |
|
| 49 | - 198 => 'AE', |
|
| 50 | - 199 => 'C', |
|
| 51 | - 200 => 'E', |
|
| 52 | - 201 => 'E', |
|
| 53 | - 202 => 'E', |
|
| 54 | - 203 => 'E', |
|
| 55 | - 204 => 'I', |
|
| 56 | - 205 => 'I', |
|
| 57 | - 206 => 'I', |
|
| 58 | - 207 => 'I', |
|
| 59 | - 209 => 'N', |
|
| 60 | - 210 => 'O', |
|
| 61 | - 211 => 'O', |
|
| 62 | - 212 => 'O', |
|
| 63 | - 213 => 'O', |
|
| 64 | - 214 => 'O', |
|
| 65 | - 216 => 'O', |
|
| 66 | - 217 => 'U', |
|
| 67 | - 218 => 'U', |
|
| 68 | - 219 => 'U', |
|
| 69 | - 220 => 'U', |
|
| 70 | - 223 => 'ss', |
|
| 71 | - 224 => 'a', |
|
| 72 | - 225 => 'a', |
|
| 73 | - 226 => 'a', |
|
| 74 | - 227 => 'a', |
|
| 75 | - 228 => 'a', |
|
| 76 | - 229 => 'a', |
|
| 77 | - 230 => 'ae', |
|
| 78 | - 231 => 'c', |
|
| 79 | - 232 => 'e', |
|
| 80 | - 233 => 'e', |
|
| 81 | - 234 => 'e', |
|
| 82 | - 235 => 'e', |
|
| 83 | - 236 => 'i', |
|
| 84 | - 237 => 'i', |
|
| 85 | - 238 => 'i', |
|
| 86 | - 239 => 'i', |
|
| 87 | - 241 => 'n', |
|
| 88 | - 242 => 'o', |
|
| 89 | - 243 => 'o', |
|
| 90 | - 244 => 'o', |
|
| 91 | - 245 => 'o', |
|
| 92 | - 246 => 'o', |
|
| 93 | - 248 => 'o', |
|
| 94 | - 249 => 'u', |
|
| 95 | - 250 => 'u', |
|
| 96 | - 251 => 'u', |
|
| 97 | - 252 => 'u', |
|
| 98 | - 255 => 'y', |
|
| 22 | + 160 => ' ', |
|
| 23 | + 161 => '!', |
|
| 24 | + 162 => 'c', |
|
| 25 | + 163 => 'L', |
|
| 26 | + 164 => 'O', |
|
| 27 | + 165 => 'yen', |
|
| 28 | + 166 => '|', |
|
| 29 | + 167 => 'p', |
|
| 30 | + 169 => '(c)', |
|
| 31 | + 171 => '<<', |
|
| 32 | + 172 => '-', |
|
| 33 | + 173 => '-', |
|
| 34 | + 174 => '(R)', |
|
| 35 | + 176 => 'o', |
|
| 36 | + 177 => '+-', |
|
| 37 | + 181 => 'mu', |
|
| 38 | + 182 => 'p', |
|
| 39 | + 183 => '.', |
|
| 40 | + 186 => 'o ', |
|
| 41 | + 187 => '>>', |
|
| 42 | + 191 => '?', |
|
| 43 | + 192 => 'A', |
|
| 44 | + 193 => 'A', |
|
| 45 | + 194 => 'A', |
|
| 46 | + 195 => 'A', |
|
| 47 | + 196 => 'A', |
|
| 48 | + 197 => 'A', |
|
| 49 | + 198 => 'AE', |
|
| 50 | + 199 => 'C', |
|
| 51 | + 200 => 'E', |
|
| 52 | + 201 => 'E', |
|
| 53 | + 202 => 'E', |
|
| 54 | + 203 => 'E', |
|
| 55 | + 204 => 'I', |
|
| 56 | + 205 => 'I', |
|
| 57 | + 206 => 'I', |
|
| 58 | + 207 => 'I', |
|
| 59 | + 209 => 'N', |
|
| 60 | + 210 => 'O', |
|
| 61 | + 211 => 'O', |
|
| 62 | + 212 => 'O', |
|
| 63 | + 213 => 'O', |
|
| 64 | + 214 => 'O', |
|
| 65 | + 216 => 'O', |
|
| 66 | + 217 => 'U', |
|
| 67 | + 218 => 'U', |
|
| 68 | + 219 => 'U', |
|
| 69 | + 220 => 'U', |
|
| 70 | + 223 => 'ss', |
|
| 71 | + 224 => 'a', |
|
| 72 | + 225 => 'a', |
|
| 73 | + 226 => 'a', |
|
| 74 | + 227 => 'a', |
|
| 75 | + 228 => 'a', |
|
| 76 | + 229 => 'a', |
|
| 77 | + 230 => 'ae', |
|
| 78 | + 231 => 'c', |
|
| 79 | + 232 => 'e', |
|
| 80 | + 233 => 'e', |
|
| 81 | + 234 => 'e', |
|
| 82 | + 235 => 'e', |
|
| 83 | + 236 => 'i', |
|
| 84 | + 237 => 'i', |
|
| 85 | + 238 => 'i', |
|
| 86 | + 239 => 'i', |
|
| 87 | + 241 => 'n', |
|
| 88 | + 242 => 'o', |
|
| 89 | + 243 => 'o', |
|
| 90 | + 244 => 'o', |
|
| 91 | + 245 => 'o', |
|
| 92 | + 246 => 'o', |
|
| 93 | + 248 => 'o', |
|
| 94 | + 249 => 'u', |
|
| 95 | + 250 => 'u', |
|
| 96 | + 251 => 'u', |
|
| 97 | + 252 => 'u', |
|
| 98 | + 255 => 'y', |
|
| 99 | 99 | |
| 100 | 100 | // turc |
| 101 | - 286 => 'G', |
|
| 102 | - 287 => 'g', |
|
| 103 | - 304 => 'I', |
|
| 104 | - 305 => 'i', |
|
| 101 | + 286 => 'G', |
|
| 102 | + 287 => 'g', |
|
| 103 | + 304 => 'I', |
|
| 104 | + 305 => 'i', |
|
| 105 | 105 | |
| 106 | 106 | // esperanto |
| 107 | - 264 => 'Cx', |
|
| 108 | - 265 => 'cx', |
|
| 109 | - 284 => 'Gx', |
|
| 110 | - 285 => 'gx', |
|
| 111 | - 292 => 'Hx', |
|
| 112 | - 293 => 'hx', |
|
| 113 | - 308 => 'Jx', |
|
| 114 | - 309 => 'jx', |
|
| 115 | - 348 => 'Sx', |
|
| 116 | - 349 => 'sx', |
|
| 117 | - 364 => 'Ux', |
|
| 118 | - 365 => 'ux', |
|
| 107 | + 264 => 'Cx', |
|
| 108 | + 265 => 'cx', |
|
| 109 | + 284 => 'Gx', |
|
| 110 | + 285 => 'gx', |
|
| 111 | + 292 => 'Hx', |
|
| 112 | + 293 => 'hx', |
|
| 113 | + 308 => 'Jx', |
|
| 114 | + 309 => 'jx', |
|
| 115 | + 348 => 'Sx', |
|
| 116 | + 349 => 'sx', |
|
| 117 | + 364 => 'Ux', |
|
| 118 | + 365 => 'ux', |
|
| 119 | 119 | |
| 120 | 120 | |
| 121 | 121 | // latin2 [Czech] |
| 122 | - 283 => 'e', |
|
| 123 | - 353 => 's', |
|
| 124 | - 269 => 'c', |
|
| 125 | - 345 => 'r', |
|
| 126 | - 382 => 'z', |
|
| 127 | - 367 => 'u', |
|
| 128 | - 328 => 'n', |
|
| 129 | - 357 => 't', |
|
| 130 | - 271 => 'd', |
|
| 131 | - 449 => 'o', |
|
| 132 | - 282 => 'E', |
|
| 133 | - 352 => 'S', |
|
| 134 | - 268 => 'C', |
|
| 135 | - 344 => 'R', |
|
| 136 | - 381 => 'Z', |
|
| 137 | - 366 => 'U', |
|
| 138 | - 327 => 'N', |
|
| 139 | - 356 => 'T', |
|
| 140 | - 270 => 'D', |
|
| 141 | - 467 => 'O', |
|
| 122 | + 283 => 'e', |
|
| 123 | + 353 => 's', |
|
| 124 | + 269 => 'c', |
|
| 125 | + 345 => 'r', |
|
| 126 | + 382 => 'z', |
|
| 127 | + 367 => 'u', |
|
| 128 | + 328 => 'n', |
|
| 129 | + 357 => 't', |
|
| 130 | + 271 => 'd', |
|
| 131 | + 449 => 'o', |
|
| 132 | + 282 => 'E', |
|
| 133 | + 352 => 'S', |
|
| 134 | + 268 => 'C', |
|
| 135 | + 344 => 'R', |
|
| 136 | + 381 => 'Z', |
|
| 137 | + 366 => 'U', |
|
| 138 | + 327 => 'N', |
|
| 139 | + 356 => 'T', |
|
| 140 | + 270 => 'D', |
|
| 141 | + 467 => 'O', |
|
| 142 | 142 | |
| 143 | 143 | // francais |
| 144 | - 338 => 'OE', |
|
| 145 | - 339 => 'oe', |
|
| 146 | - 376 => 'Y', |
|
| 147 | - 402 => 'f', |
|
| 144 | + 338 => 'OE', |
|
| 145 | + 339 => 'oe', |
|
| 146 | + 376 => 'Y', |
|
| 147 | + 402 => 'f', |
|
| 148 | 148 | |
| 149 | 149 | //polskie |
| 150 | - 260 => 'A', |
|
| 151 | - 261 => 'a', |
|
| 152 | - 262 => 'C', |
|
| 153 | - 263 => 'c', |
|
| 154 | - 280 => 'E', |
|
| 155 | - 281 => 'e', |
|
| 156 | - 321 => 'L', |
|
| 157 | - 322 => 'l', |
|
| 158 | - 323 => 'N', |
|
| 159 | - 324 => 'n', |
|
| 160 | - 346 => 'S', |
|
| 161 | - 347 => 's', |
|
| 162 | - 377 => 'Z', |
|
| 163 | - 378 => 'z', |
|
| 164 | - 379 => 'Z', |
|
| 165 | - 380 => 'z', |
|
| 150 | + 260 => 'A', |
|
| 151 | + 261 => 'a', |
|
| 152 | + 262 => 'C', |
|
| 153 | + 263 => 'c', |
|
| 154 | + 280 => 'E', |
|
| 155 | + 281 => 'e', |
|
| 156 | + 321 => 'L', |
|
| 157 | + 322 => 'l', |
|
| 158 | + 323 => 'N', |
|
| 159 | + 324 => 'n', |
|
| 160 | + 346 => 'S', |
|
| 161 | + 347 => 's', |
|
| 162 | + 377 => 'Z', |
|
| 163 | + 378 => 'z', |
|
| 164 | + 379 => 'Z', |
|
| 165 | + 380 => 'z', |
|
| 166 | 166 | |
| 167 | 167 | //roumain |
| 168 | - 258 => 'A', |
|
| 169 | - 259 => 'a', |
|
| 170 | - 354 => 'T', |
|
| 171 | - 355 => 't', |
|
| 168 | + 258 => 'A', |
|
| 169 | + 259 => 'a', |
|
| 170 | + 354 => 'T', |
|
| 171 | + 355 => 't', |
|
| 172 | 172 | |
| 173 | 173 | //turc & roumain |
| 174 | - 350 => 'S', |
|
| 175 | - 351 => 's', |
|
| 174 | + 350 => 'S', |
|
| 175 | + 351 => 's', |
|
| 176 | 176 | |
| 177 | 177 | // cyrillique |
| 178 | - 1026 => 'D%', |
|
| 179 | - 1027 => 'G%', |
|
| 180 | - 8218 => '\'', |
|
| 181 | - 1107 => 'g%', |
|
| 182 | - 8222 => '"', |
|
| 183 | - 8230 => '...', |
|
| 184 | - 8224 => '/-', |
|
| 185 | - 8225 => '/=', |
|
| 186 | - 8364 => 'EUR', |
|
| 187 | - 8240 => '0/00', |
|
| 188 | - 1033 => 'LJ', |
|
| 189 | - 8249 => '<', |
|
| 190 | - 1034 => 'NJ', |
|
| 191 | - 1036 => 'KJ', |
|
| 192 | - 1035 => 'Ts', |
|
| 193 | - 1039 => 'DZ', |
|
| 194 | - 1106 => 'd%', |
|
| 195 | - 8216 => '`', |
|
| 196 | - 8217 => '\'', |
|
| 197 | - 8220 => '"', |
|
| 198 | - 8221 => '"', |
|
| 199 | - 8226 => ' o ', |
|
| 200 | - 8211 => '-', |
|
| 201 | - 8212 => '~', |
|
| 202 | - 8482 => '(TM)', |
|
| 203 | - 1113 => 'lj', |
|
| 204 | - 8250 => '>', |
|
| 205 | - 1114 => 'nj', |
|
| 206 | - 1116 => 'kj', |
|
| 207 | - 1115 => 'ts', |
|
| 208 | - 1119 => 'dz', |
|
| 209 | - 1038 => 'V%', |
|
| 210 | - 1118 => 'v%', |
|
| 211 | - 1032 => 'J%', |
|
| 212 | - 1168 => 'G3', |
|
| 213 | - 1025 => 'IO', |
|
| 214 | - 1028 => 'IE', |
|
| 215 | - 1031 => 'YI', |
|
| 216 | - 1030 => 'II', |
|
| 217 | - 1110 => 'ii', |
|
| 218 | - 1169 => 'g3', |
|
| 219 | - 1105 => 'io', |
|
| 220 | - 8470 => 'No.', |
|
| 221 | - 1108 => 'ie', |
|
| 222 | - 1112 => 'j%', |
|
| 223 | - 1029 => 'DS', |
|
| 224 | - 1109 => 'ds', |
|
| 225 | - 1111 => 'yi', |
|
| 226 | - 1040 => 'A', |
|
| 227 | - 1041 => 'B', |
|
| 228 | - 1042 => 'V', |
|
| 229 | - 1043 => 'G', |
|
| 230 | - 1044 => 'D', |
|
| 231 | - 1045 => 'E', |
|
| 232 | - 1046 => 'ZH', |
|
| 233 | - 1047 => 'Z', |
|
| 234 | - 1048 => 'I', |
|
| 235 | - 1049 => 'J', |
|
| 236 | - 1050 => 'K', |
|
| 237 | - 1051 => 'L', |
|
| 238 | - 1052 => 'M', |
|
| 239 | - 1053 => 'N', |
|
| 240 | - 1054 => 'O', |
|
| 241 | - 1055 => 'P', |
|
| 242 | - 1056 => 'R', |
|
| 243 | - 1057 => 'S', |
|
| 244 | - 1058 => 'T', |
|
| 245 | - 1059 => 'U', |
|
| 246 | - 1060 => 'F', |
|
| 247 | - 1061 => 'H', |
|
| 248 | - 1062 => 'C', |
|
| 249 | - 1063 => 'CH', |
|
| 250 | - 1064 => 'SH', |
|
| 251 | - 1065 => 'SCH', |
|
| 252 | - 1066 => '"', |
|
| 253 | - 1067 => 'Y', |
|
| 254 | - 1068 => '\'', |
|
| 255 | - 1069 => '`E', |
|
| 256 | - 1070 => 'YU', |
|
| 257 | - 1071 => 'YA', |
|
| 258 | - 1072 => 'a', |
|
| 259 | - 1073 => 'b', |
|
| 260 | - 1074 => 'v', |
|
| 261 | - 1075 => 'g', |
|
| 262 | - 1076 => 'd', |
|
| 263 | - 1077 => 'e', |
|
| 264 | - 1078 => 'zh', |
|
| 265 | - 1079 => 'z', |
|
| 266 | - 1080 => 'i', |
|
| 267 | - 1081 => 'j', |
|
| 268 | - 1082 => 'k', |
|
| 269 | - 1083 => 'l', |
|
| 270 | - 1084 => 'm', |
|
| 271 | - 1085 => 'n', |
|
| 272 | - 1086 => 'o', |
|
| 273 | - 1087 => 'p', |
|
| 274 | - 1088 => 'r', |
|
| 275 | - 1089 => 's', |
|
| 276 | - 1090 => 't', |
|
| 277 | - 1091 => 'u', |
|
| 278 | - 1092 => 'f', |
|
| 279 | - 1093 => 'h', |
|
| 280 | - 1094 => 'c', |
|
| 281 | - 1095 => 'ch', |
|
| 282 | - 1096 => 'sh', |
|
| 283 | - 1097 => 'sch', |
|
| 284 | - 1098 => '"', |
|
| 285 | - 1099 => 'y', |
|
| 286 | - 1100 => '\'', |
|
| 287 | - 1101 => '`e', |
|
| 288 | - 1102 => 'yu', |
|
| 289 | - 1103 => 'ya', |
|
| 178 | + 1026 => 'D%', |
|
| 179 | + 1027 => 'G%', |
|
| 180 | + 8218 => '\'', |
|
| 181 | + 1107 => 'g%', |
|
| 182 | + 8222 => '"', |
|
| 183 | + 8230 => '...', |
|
| 184 | + 8224 => '/-', |
|
| 185 | + 8225 => '/=', |
|
| 186 | + 8364 => 'EUR', |
|
| 187 | + 8240 => '0/00', |
|
| 188 | + 1033 => 'LJ', |
|
| 189 | + 8249 => '<', |
|
| 190 | + 1034 => 'NJ', |
|
| 191 | + 1036 => 'KJ', |
|
| 192 | + 1035 => 'Ts', |
|
| 193 | + 1039 => 'DZ', |
|
| 194 | + 1106 => 'd%', |
|
| 195 | + 8216 => '`', |
|
| 196 | + 8217 => '\'', |
|
| 197 | + 8220 => '"', |
|
| 198 | + 8221 => '"', |
|
| 199 | + 8226 => ' o ', |
|
| 200 | + 8211 => '-', |
|
| 201 | + 8212 => '~', |
|
| 202 | + 8482 => '(TM)', |
|
| 203 | + 1113 => 'lj', |
|
| 204 | + 8250 => '>', |
|
| 205 | + 1114 => 'nj', |
|
| 206 | + 1116 => 'kj', |
|
| 207 | + 1115 => 'ts', |
|
| 208 | + 1119 => 'dz', |
|
| 209 | + 1038 => 'V%', |
|
| 210 | + 1118 => 'v%', |
|
| 211 | + 1032 => 'J%', |
|
| 212 | + 1168 => 'G3', |
|
| 213 | + 1025 => 'IO', |
|
| 214 | + 1028 => 'IE', |
|
| 215 | + 1031 => 'YI', |
|
| 216 | + 1030 => 'II', |
|
| 217 | + 1110 => 'ii', |
|
| 218 | + 1169 => 'g3', |
|
| 219 | + 1105 => 'io', |
|
| 220 | + 8470 => 'No.', |
|
| 221 | + 1108 => 'ie', |
|
| 222 | + 1112 => 'j%', |
|
| 223 | + 1029 => 'DS', |
|
| 224 | + 1109 => 'ds', |
|
| 225 | + 1111 => 'yi', |
|
| 226 | + 1040 => 'A', |
|
| 227 | + 1041 => 'B', |
|
| 228 | + 1042 => 'V', |
|
| 229 | + 1043 => 'G', |
|
| 230 | + 1044 => 'D', |
|
| 231 | + 1045 => 'E', |
|
| 232 | + 1046 => 'ZH', |
|
| 233 | + 1047 => 'Z', |
|
| 234 | + 1048 => 'I', |
|
| 235 | + 1049 => 'J', |
|
| 236 | + 1050 => 'K', |
|
| 237 | + 1051 => 'L', |
|
| 238 | + 1052 => 'M', |
|
| 239 | + 1053 => 'N', |
|
| 240 | + 1054 => 'O', |
|
| 241 | + 1055 => 'P', |
|
| 242 | + 1056 => 'R', |
|
| 243 | + 1057 => 'S', |
|
| 244 | + 1058 => 'T', |
|
| 245 | + 1059 => 'U', |
|
| 246 | + 1060 => 'F', |
|
| 247 | + 1061 => 'H', |
|
| 248 | + 1062 => 'C', |
|
| 249 | + 1063 => 'CH', |
|
| 250 | + 1064 => 'SH', |
|
| 251 | + 1065 => 'SCH', |
|
| 252 | + 1066 => '"', |
|
| 253 | + 1067 => 'Y', |
|
| 254 | + 1068 => '\'', |
|
| 255 | + 1069 => '`E', |
|
| 256 | + 1070 => 'YU', |
|
| 257 | + 1071 => 'YA', |
|
| 258 | + 1072 => 'a', |
|
| 259 | + 1073 => 'b', |
|
| 260 | + 1074 => 'v', |
|
| 261 | + 1075 => 'g', |
|
| 262 | + 1076 => 'd', |
|
| 263 | + 1077 => 'e', |
|
| 264 | + 1078 => 'zh', |
|
| 265 | + 1079 => 'z', |
|
| 266 | + 1080 => 'i', |
|
| 267 | + 1081 => 'j', |
|
| 268 | + 1082 => 'k', |
|
| 269 | + 1083 => 'l', |
|
| 270 | + 1084 => 'm', |
|
| 271 | + 1085 => 'n', |
|
| 272 | + 1086 => 'o', |
|
| 273 | + 1087 => 'p', |
|
| 274 | + 1088 => 'r', |
|
| 275 | + 1089 => 's', |
|
| 276 | + 1090 => 't', |
|
| 277 | + 1091 => 'u', |
|
| 278 | + 1092 => 'f', |
|
| 279 | + 1093 => 'h', |
|
| 280 | + 1094 => 'c', |
|
| 281 | + 1095 => 'ch', |
|
| 282 | + 1096 => 'sh', |
|
| 283 | + 1097 => 'sch', |
|
| 284 | + 1098 => '"', |
|
| 285 | + 1099 => 'y', |
|
| 286 | + 1100 => '\'', |
|
| 287 | + 1101 => '`e', |
|
| 288 | + 1102 => 'yu', |
|
| 289 | + 1103 => 'ya', |
|
| 290 | 290 | |
| 291 | 291 | // vietnamien en translitteration de base |
| 292 | - 7843 => 'a', |
|
| 293 | - 7841 => 'a', |
|
| 294 | - 7845 => 'a', |
|
| 295 | - 7847 => 'a', |
|
| 296 | - 7849 => 'a', |
|
| 297 | - 7851 => 'a', |
|
| 298 | - 7853 => 'a', |
|
| 299 | - 7855 => 'a', |
|
| 300 | - 7857 => 'a', |
|
| 301 | - 7859 => 'a', |
|
| 302 | - 7861 => 'a', |
|
| 303 | - 7863 => 'a', |
|
| 304 | - 7842 => 'A', |
|
| 305 | - 7840 => 'A', |
|
| 306 | - 7844 => 'A', |
|
| 307 | - 7846 => 'A', |
|
| 308 | - 7848 => 'A', |
|
| 309 | - 7850 => 'A', |
|
| 310 | - 7852 => 'A', |
|
| 311 | - 7854 => 'A', |
|
| 312 | - 7856 => 'A', |
|
| 313 | - 7858 => 'A', |
|
| 314 | - 7860 => 'A', |
|
| 315 | - 7862 => 'A', |
|
| 316 | - 7867 => 'e', |
|
| 317 | - 7869 => 'e', |
|
| 318 | - 7865 => 'e', |
|
| 319 | - 7871 => 'e', |
|
| 320 | - 7873 => 'e', |
|
| 321 | - 7875 => 'e', |
|
| 322 | - 7877 => 'e', |
|
| 323 | - 7879 => 'e', |
|
| 324 | - 7866 => 'E', |
|
| 325 | - 7868 => 'E', |
|
| 326 | - 7864 => 'E', |
|
| 327 | - 7870 => 'E', |
|
| 328 | - 7872 => 'E', |
|
| 329 | - 7874 => 'E', |
|
| 330 | - 7876 => 'E', |
|
| 331 | - 7878 => 'E', |
|
| 332 | - 7881 => 'i', |
|
| 333 | - 7883 => 'i', |
|
| 334 | - 7880 => 'I', |
|
| 335 | - 7882 => 'I', |
|
| 336 | - 7887 => 'o', |
|
| 337 | - 7885 => 'o', |
|
| 338 | - 7889 => 'o', |
|
| 339 | - 7891 => 'o', |
|
| 340 | - 7893 => 'o', |
|
| 341 | - 7895 => 'o', |
|
| 342 | - 7897 => 'o', |
|
| 343 | - 417 => 'o', |
|
| 344 | - 7899 => 'o', |
|
| 345 | - 7901 => 'o', |
|
| 346 | - 7903 => 'o', |
|
| 347 | - 7905 => 'o', |
|
| 348 | - 7907 => 'o', |
|
| 349 | - 7886 => 'O', |
|
| 350 | - 7884 => 'O', |
|
| 351 | - 7888 => 'O', |
|
| 352 | - 7890 => 'O', |
|
| 353 | - 7892 => 'O', |
|
| 354 | - 7894 => 'O', |
|
| 355 | - 7896 => 'O', |
|
| 356 | - 416 => 'O', |
|
| 357 | - 7898 => 'O', |
|
| 358 | - 7900 => 'O', |
|
| 359 | - 7902 => 'O', |
|
| 360 | - 7904 => 'O', |
|
| 361 | - 7906 => 'O', |
|
| 362 | - 7911 => 'u', |
|
| 363 | - 361 => 'u', |
|
| 364 | - 7909 => 'u', |
|
| 365 | - 432 => 'u', |
|
| 366 | - 7913 => 'u', |
|
| 367 | - 7915 => 'u', |
|
| 368 | - 7917 => 'u', |
|
| 369 | - 7919 => 'u', |
|
| 370 | - 7921 => 'u', |
|
| 371 | - 7910 => 'U', |
|
| 372 | - 360 => 'U', |
|
| 373 | - 7908 => 'U', |
|
| 374 | - 431 => 'U', |
|
| 375 | - 7912 => 'U', |
|
| 376 | - 7914 => 'U', |
|
| 377 | - 7916 => 'U', |
|
| 378 | - 7918 => 'U', |
|
| 379 | - 7920 => 'U', |
|
| 380 | - 253 => 'y', |
|
| 381 | - 7923 => 'y', |
|
| 382 | - 7927 => 'y', |
|
| 383 | - 7929 => 'y', |
|
| 384 | - 7925 => 'y', |
|
| 385 | - 221 => 'Y', |
|
| 386 | - 7922 => 'Y', |
|
| 387 | - 7926 => 'Y', |
|
| 388 | - 7928 => 'Y', |
|
| 389 | - 7924 => 'Y', |
|
| 390 | - 273 => 'd' |
|
| 292 | + 7843 => 'a', |
|
| 293 | + 7841 => 'a', |
|
| 294 | + 7845 => 'a', |
|
| 295 | + 7847 => 'a', |
|
| 296 | + 7849 => 'a', |
|
| 297 | + 7851 => 'a', |
|
| 298 | + 7853 => 'a', |
|
| 299 | + 7855 => 'a', |
|
| 300 | + 7857 => 'a', |
|
| 301 | + 7859 => 'a', |
|
| 302 | + 7861 => 'a', |
|
| 303 | + 7863 => 'a', |
|
| 304 | + 7842 => 'A', |
|
| 305 | + 7840 => 'A', |
|
| 306 | + 7844 => 'A', |
|
| 307 | + 7846 => 'A', |
|
| 308 | + 7848 => 'A', |
|
| 309 | + 7850 => 'A', |
|
| 310 | + 7852 => 'A', |
|
| 311 | + 7854 => 'A', |
|
| 312 | + 7856 => 'A', |
|
| 313 | + 7858 => 'A', |
|
| 314 | + 7860 => 'A', |
|
| 315 | + 7862 => 'A', |
|
| 316 | + 7867 => 'e', |
|
| 317 | + 7869 => 'e', |
|
| 318 | + 7865 => 'e', |
|
| 319 | + 7871 => 'e', |
|
| 320 | + 7873 => 'e', |
|
| 321 | + 7875 => 'e', |
|
| 322 | + 7877 => 'e', |
|
| 323 | + 7879 => 'e', |
|
| 324 | + 7866 => 'E', |
|
| 325 | + 7868 => 'E', |
|
| 326 | + 7864 => 'E', |
|
| 327 | + 7870 => 'E', |
|
| 328 | + 7872 => 'E', |
|
| 329 | + 7874 => 'E', |
|
| 330 | + 7876 => 'E', |
|
| 331 | + 7878 => 'E', |
|
| 332 | + 7881 => 'i', |
|
| 333 | + 7883 => 'i', |
|
| 334 | + 7880 => 'I', |
|
| 335 | + 7882 => 'I', |
|
| 336 | + 7887 => 'o', |
|
| 337 | + 7885 => 'o', |
|
| 338 | + 7889 => 'o', |
|
| 339 | + 7891 => 'o', |
|
| 340 | + 7893 => 'o', |
|
| 341 | + 7895 => 'o', |
|
| 342 | + 7897 => 'o', |
|
| 343 | + 417 => 'o', |
|
| 344 | + 7899 => 'o', |
|
| 345 | + 7901 => 'o', |
|
| 346 | + 7903 => 'o', |
|
| 347 | + 7905 => 'o', |
|
| 348 | + 7907 => 'o', |
|
| 349 | + 7886 => 'O', |
|
| 350 | + 7884 => 'O', |
|
| 351 | + 7888 => 'O', |
|
| 352 | + 7890 => 'O', |
|
| 353 | + 7892 => 'O', |
|
| 354 | + 7894 => 'O', |
|
| 355 | + 7896 => 'O', |
|
| 356 | + 416 => 'O', |
|
| 357 | + 7898 => 'O', |
|
| 358 | + 7900 => 'O', |
|
| 359 | + 7902 => 'O', |
|
| 360 | + 7904 => 'O', |
|
| 361 | + 7906 => 'O', |
|
| 362 | + 7911 => 'u', |
|
| 363 | + 361 => 'u', |
|
| 364 | + 7909 => 'u', |
|
| 365 | + 432 => 'u', |
|
| 366 | + 7913 => 'u', |
|
| 367 | + 7915 => 'u', |
|
| 368 | + 7917 => 'u', |
|
| 369 | + 7919 => 'u', |
|
| 370 | + 7921 => 'u', |
|
| 371 | + 7910 => 'U', |
|
| 372 | + 360 => 'U', |
|
| 373 | + 7908 => 'U', |
|
| 374 | + 431 => 'U', |
|
| 375 | + 7912 => 'U', |
|
| 376 | + 7914 => 'U', |
|
| 377 | + 7916 => 'U', |
|
| 378 | + 7918 => 'U', |
|
| 379 | + 7920 => 'U', |
|
| 380 | + 253 => 'y', |
|
| 381 | + 7923 => 'y', |
|
| 382 | + 7927 => 'y', |
|
| 383 | + 7929 => 'y', |
|
| 384 | + 7925 => 'y', |
|
| 385 | + 221 => 'Y', |
|
| 386 | + 7922 => 'Y', |
|
| 387 | + 7926 => 'Y', |
|
| 388 | + 7928 => 'Y', |
|
| 389 | + 7924 => 'Y', |
|
| 390 | + 273 => 'd' |
|
| 391 | 391 | |
| 392 | 392 | ]; |
@@ -4,123 +4,123 @@ |
||
| 4 | 4 | // ** ne pas modifier le fichier ** |
| 5 | 5 | |
| 6 | 6 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 7 | - return; |
|
| 7 | + return; |
|
| 8 | 8 | } |
| 9 | 9 | |
| 10 | 10 | $GLOBALS[$GLOBALS['idx_lang']] = array( |
| 11 | 11 | |
| 12 | - // A |
|
| 13 | - 'accueil_site' => 'Startseite', |
|
| 14 | - 'article' => 'Artikel', |
|
| 15 | - 'articles' => 'Artikel', |
|
| 16 | - 'articles_auteur' => 'Artikel dieses Autors', |
|
| 17 | - 'articles_populaires' => 'Die beliebtesten Artikel', |
|
| 18 | - 'articles_rubrique' => 'Artikel dieser Rubrik', |
|
| 19 | - 'aucun_article' => 'Unter dieser Adresse gibt es keinen Artikel.', |
|
| 20 | - 'aucun_auteur' => 'Unter dieser Adresse gibt es keinen Autor.', |
|
| 21 | - 'aucun_site' => 'Unter dieser Adresse gibt es keien Website.', |
|
| 22 | - 'aucune_breve' => 'Unter dieser Adresse gibt es keine Meldung.', |
|
| 23 | - 'aucune_rubrique' => 'Unter dieser Adresse gibt es keine Rubrik.', |
|
| 24 | - 'auteur' => 'Autor', |
|
| 25 | - 'autres' => 'Andere', |
|
| 26 | - 'autres_breves' => 'Weitere Meldungen.', |
|
| 27 | - 'autres_groupes_mots_clefs' => 'Weitere Schlagwortgruppen', |
|
| 28 | - 'autres_sites' => 'Weitere Websites', |
|
| 29 | - |
|
| 30 | - // B |
|
| 31 | - 'bonjour' => 'Hallo', |
|
| 32 | - |
|
| 33 | - // C |
|
| 34 | - 'commenter_site' => 'Website kommentieren', |
|
| 35 | - 'contact' => 'Kontakt', |
|
| 36 | - 'copie_document_impossible' => 'Dokument kann nicht kopiert werden', |
|
| 37 | - |
|
| 38 | - // D |
|
| 39 | - 'date' => 'Datum', |
|
| 40 | - 'dernier_ajout' => 'Neuester Eintrag', |
|
| 41 | - 'dernieres_breves' => 'Neue Meldungen', |
|
| 42 | - 'derniers_articles' => 'Neueste Artikel', |
|
| 43 | - 'derniers_commentaires' => 'Neueste Kommentare', |
|
| 44 | - 'derniers_messages_forum' => 'Neue Forumsbeiträge', |
|
| 45 | - |
|
| 46 | - // E |
|
| 47 | - 'edition_mode_texte' => 'Im Textmodus bearbeiten ', |
|
| 48 | - 'en_reponse' => 'Antwort auf:', |
|
| 49 | - 'en_resume' => 'Als Zusammenfassung', |
|
| 50 | - 'envoyer_message' => 'Nachricht senden', |
|
| 51 | - 'espace_prive' => 'Redaktion', |
|
| 52 | - |
|
| 53 | - // F |
|
| 54 | - 'formats_acceptes' => 'Akzeptierte Formate: @formats@.', |
|
| 55 | - |
|
| 56 | - // H |
|
| 57 | - 'hierarchie_site' => 'Baumstruktur der Website', |
|
| 58 | - |
|
| 59 | - // J |
|
| 60 | - 'jours' => 'Tage', |
|
| 61 | - |
|
| 62 | - // L |
|
| 63 | - 'lien_connecter' => 'Login', |
|
| 64 | - |
|
| 65 | - // M |
|
| 66 | - 'meme_auteur' => 'Vom gleichen Autor', |
|
| 67 | - 'meme_rubrique' => 'In der gleichen Rubrik', |
|
| 68 | - 'memes_auteurs' => 'Von den gleichen Autoren', |
|
| 69 | - 'message' => 'Nachricht', |
|
| 70 | - 'messages_forum' => 'Nachrichten', |
|
| 71 | - 'messages_recents' => 'Neue Forumsbeiträge', |
|
| 72 | - 'mots_clef' => 'Schlagwort', |
|
| 73 | - 'mots_clefs' => 'Schlagworte', |
|
| 74 | - 'mots_clefs_meme_groupe' => 'Schlagworte der gleichen Kategorie', |
|
| 75 | - |
|
| 76 | - // N |
|
| 77 | - 'navigation' => 'Navigation', |
|
| 78 | - 'nom' => 'Name', |
|
| 79 | - 'nouveautes' => 'Neuigkeiten', |
|
| 80 | - 'nouveautes_web' => 'Neues im WWW', |
|
| 81 | - 'nouveaux_articles' => 'Neue Artikel', |
|
| 82 | - 'nouvelles_breves' => 'Neue Meldungen', |
|
| 83 | - |
|
| 84 | - // P |
|
| 85 | - 'page_precedente' => 'vorige Seite', |
|
| 86 | - 'page_suivante' => 'nächste Seite', |
|
| 87 | - 'par_auteur' => 'von ', |
|
| 88 | - 'participer_site' => 'Sie können bei dieser Website mitmachen, wenn Sie sich anmelden. Sie erhalten sofort eine E-Mail mit den Zugangsdaten zum Redaktionssystem.', |
|
| 89 | - 'plan_site' => 'Sitemap', |
|
| 90 | - 'popularite' => 'Beliebtheit', |
|
| 91 | - 'poster_message' => 'Nachricht senden', |
|
| 92 | - 'proposer_site' => 'Sie können in dieser Rubrik eine Seite vorschlagen :', |
|
| 93 | - |
|
| 94 | - // R |
|
| 95 | - 'repondre_article' => 'auf diesen Artikel antworten', |
|
| 96 | - 'repondre_breve' => 'auf diese Meldung antworten', |
|
| 97 | - 'resultats_recherche' => 'Suchergebnis(se)', |
|
| 98 | - 'retour_debut_forums' => 'Zurück zum Beginn des Forums', |
|
| 99 | - 'rss_abonnement' => 'Kopieren Sie die folgende URL in Ihren Feedreader:', |
|
| 100 | - 'rss_abonnement_titre' => 'Abonnieren', |
|
| 101 | - 'rss_abonnement_titre_page' => 'Abonnieren von', |
|
| 102 | - 'rss_explication' => 'Ein RSS-Feed sammelt Informationen über die Aktualisierungen einer Website. Er liefert den Inhalt von Einträgen oder Kommentaren oder einen Auszug daraus sowie einen Link zu den Vollversionen und einige andere Informationen. Der Feed ist dazu gedacht, von einem RSS-Aggregator (Feedreader) gelesen zu werden', |
|
| 103 | - 'rss_explication_titre' => 'Was ist ein RSS-Feed ?', |
|
| 104 | - 'rubrique' => 'Rubrik', |
|
| 105 | - 'rubriques' => 'Rubriken', |
|
| 106 | - |
|
| 107 | - // S |
|
| 108 | - 'signatures_petition' => 'Unterschrift', |
|
| 109 | - 'site_realise_avec_spip' => 'Realisiert mit SPIP', |
|
| 110 | - 'sites_web' => 'Websites', |
|
| 111 | - 'sous_rubriques' => 'Unterrubriken', |
|
| 112 | - 'spam' => 'SPAM', |
|
| 113 | - 'suite' => 'weiter', |
|
| 114 | - 'sur_web' => 'Im WWW', |
|
| 115 | - 'syndiquer_rubrique' => 'Diese Rubrik per RSS einbinden', |
|
| 116 | - 'syndiquer_site' => 'Die ganze Website mit RSS einbinden', |
|
| 117 | - |
|
| 118 | - // T |
|
| 119 | - 'texte_lettre_information' => 'Dies ist der Newsletter der Website ', |
|
| 120 | - 'texte_lettre_information_2' => 'Diese Mail informiert über die Neuerscheinungen der letzten', |
|
| 121 | - |
|
| 122 | - // V |
|
| 123 | - 'ver_imprimer' => 'Druckversion', |
|
| 124 | - 'voir_en_ligne' => 'Online ansehen', |
|
| 125 | - 'voir_squelette' => 'Layoutvorlage dieser Seite ansehen' |
|
| 12 | + // A |
|
| 13 | + 'accueil_site' => 'Startseite', |
|
| 14 | + 'article' => 'Artikel', |
|
| 15 | + 'articles' => 'Artikel', |
|
| 16 | + 'articles_auteur' => 'Artikel dieses Autors', |
|
| 17 | + 'articles_populaires' => 'Die beliebtesten Artikel', |
|
| 18 | + 'articles_rubrique' => 'Artikel dieser Rubrik', |
|
| 19 | + 'aucun_article' => 'Unter dieser Adresse gibt es keinen Artikel.', |
|
| 20 | + 'aucun_auteur' => 'Unter dieser Adresse gibt es keinen Autor.', |
|
| 21 | + 'aucun_site' => 'Unter dieser Adresse gibt es keien Website.', |
|
| 22 | + 'aucune_breve' => 'Unter dieser Adresse gibt es keine Meldung.', |
|
| 23 | + 'aucune_rubrique' => 'Unter dieser Adresse gibt es keine Rubrik.', |
|
| 24 | + 'auteur' => 'Autor', |
|
| 25 | + 'autres' => 'Andere', |
|
| 26 | + 'autres_breves' => 'Weitere Meldungen.', |
|
| 27 | + 'autres_groupes_mots_clefs' => 'Weitere Schlagwortgruppen', |
|
| 28 | + 'autres_sites' => 'Weitere Websites', |
|
| 29 | + |
|
| 30 | + // B |
|
| 31 | + 'bonjour' => 'Hallo', |
|
| 32 | + |
|
| 33 | + // C |
|
| 34 | + 'commenter_site' => 'Website kommentieren', |
|
| 35 | + 'contact' => 'Kontakt', |
|
| 36 | + 'copie_document_impossible' => 'Dokument kann nicht kopiert werden', |
|
| 37 | + |
|
| 38 | + // D |
|
| 39 | + 'date' => 'Datum', |
|
| 40 | + 'dernier_ajout' => 'Neuester Eintrag', |
|
| 41 | + 'dernieres_breves' => 'Neue Meldungen', |
|
| 42 | + 'derniers_articles' => 'Neueste Artikel', |
|
| 43 | + 'derniers_commentaires' => 'Neueste Kommentare', |
|
| 44 | + 'derniers_messages_forum' => 'Neue Forumsbeiträge', |
|
| 45 | + |
|
| 46 | + // E |
|
| 47 | + 'edition_mode_texte' => 'Im Textmodus bearbeiten ', |
|
| 48 | + 'en_reponse' => 'Antwort auf:', |
|
| 49 | + 'en_resume' => 'Als Zusammenfassung', |
|
| 50 | + 'envoyer_message' => 'Nachricht senden', |
|
| 51 | + 'espace_prive' => 'Redaktion', |
|
| 52 | + |
|
| 53 | + // F |
|
| 54 | + 'formats_acceptes' => 'Akzeptierte Formate: @formats@.', |
|
| 55 | + |
|
| 56 | + // H |
|
| 57 | + 'hierarchie_site' => 'Baumstruktur der Website', |
|
| 58 | + |
|
| 59 | + // J |
|
| 60 | + 'jours' => 'Tage', |
|
| 61 | + |
|
| 62 | + // L |
|
| 63 | + 'lien_connecter' => 'Login', |
|
| 64 | + |
|
| 65 | + // M |
|
| 66 | + 'meme_auteur' => 'Vom gleichen Autor', |
|
| 67 | + 'meme_rubrique' => 'In der gleichen Rubrik', |
|
| 68 | + 'memes_auteurs' => 'Von den gleichen Autoren', |
|
| 69 | + 'message' => 'Nachricht', |
|
| 70 | + 'messages_forum' => 'Nachrichten', |
|
| 71 | + 'messages_recents' => 'Neue Forumsbeiträge', |
|
| 72 | + 'mots_clef' => 'Schlagwort', |
|
| 73 | + 'mots_clefs' => 'Schlagworte', |
|
| 74 | + 'mots_clefs_meme_groupe' => 'Schlagworte der gleichen Kategorie', |
|
| 75 | + |
|
| 76 | + // N |
|
| 77 | + 'navigation' => 'Navigation', |
|
| 78 | + 'nom' => 'Name', |
|
| 79 | + 'nouveautes' => 'Neuigkeiten', |
|
| 80 | + 'nouveautes_web' => 'Neues im WWW', |
|
| 81 | + 'nouveaux_articles' => 'Neue Artikel', |
|
| 82 | + 'nouvelles_breves' => 'Neue Meldungen', |
|
| 83 | + |
|
| 84 | + // P |
|
| 85 | + 'page_precedente' => 'vorige Seite', |
|
| 86 | + 'page_suivante' => 'nächste Seite', |
|
| 87 | + 'par_auteur' => 'von ', |
|
| 88 | + 'participer_site' => 'Sie können bei dieser Website mitmachen, wenn Sie sich anmelden. Sie erhalten sofort eine E-Mail mit den Zugangsdaten zum Redaktionssystem.', |
|
| 89 | + 'plan_site' => 'Sitemap', |
|
| 90 | + 'popularite' => 'Beliebtheit', |
|
| 91 | + 'poster_message' => 'Nachricht senden', |
|
| 92 | + 'proposer_site' => 'Sie können in dieser Rubrik eine Seite vorschlagen :', |
|
| 93 | + |
|
| 94 | + // R |
|
| 95 | + 'repondre_article' => 'auf diesen Artikel antworten', |
|
| 96 | + 'repondre_breve' => 'auf diese Meldung antworten', |
|
| 97 | + 'resultats_recherche' => 'Suchergebnis(se)', |
|
| 98 | + 'retour_debut_forums' => 'Zurück zum Beginn des Forums', |
|
| 99 | + 'rss_abonnement' => 'Kopieren Sie die folgende URL in Ihren Feedreader:', |
|
| 100 | + 'rss_abonnement_titre' => 'Abonnieren', |
|
| 101 | + 'rss_abonnement_titre_page' => 'Abonnieren von', |
|
| 102 | + 'rss_explication' => 'Ein RSS-Feed sammelt Informationen über die Aktualisierungen einer Website. Er liefert den Inhalt von Einträgen oder Kommentaren oder einen Auszug daraus sowie einen Link zu den Vollversionen und einige andere Informationen. Der Feed ist dazu gedacht, von einem RSS-Aggregator (Feedreader) gelesen zu werden', |
|
| 103 | + 'rss_explication_titre' => 'Was ist ein RSS-Feed ?', |
|
| 104 | + 'rubrique' => 'Rubrik', |
|
| 105 | + 'rubriques' => 'Rubriken', |
|
| 106 | + |
|
| 107 | + // S |
|
| 108 | + 'signatures_petition' => 'Unterschrift', |
|
| 109 | + 'site_realise_avec_spip' => 'Realisiert mit SPIP', |
|
| 110 | + 'sites_web' => 'Websites', |
|
| 111 | + 'sous_rubriques' => 'Unterrubriken', |
|
| 112 | + 'spam' => 'SPAM', |
|
| 113 | + 'suite' => 'weiter', |
|
| 114 | + 'sur_web' => 'Im WWW', |
|
| 115 | + 'syndiquer_rubrique' => 'Diese Rubrik per RSS einbinden', |
|
| 116 | + 'syndiquer_site' => 'Die ganze Website mit RSS einbinden', |
|
| 117 | + |
|
| 118 | + // T |
|
| 119 | + 'texte_lettre_information' => 'Dies ist der Newsletter der Website ', |
|
| 120 | + 'texte_lettre_information_2' => 'Diese Mail informiert über die Neuerscheinungen der letzten', |
|
| 121 | + |
|
| 122 | + // V |
|
| 123 | + 'ver_imprimer' => 'Druckversion', |
|
| 124 | + 'voir_en_ligne' => 'Online ansehen', |
|
| 125 | + 'voir_squelette' => 'Layoutvorlage dieser Seite ansehen' |
|
| 126 | 126 | ); |