@@ -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 | /** |
@@ -25,25 +25,25 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | function action_auth_dist() { |
| 27 | 27 | |
| 28 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | - $arg = $securiser_action(); |
|
| 30 | - |
|
| 31 | - if (!preg_match(",^(\w+)[/](.+)$,", $arg, $r)) { |
|
| 32 | - spip_log("action_auth_dist $arg pas compris"); |
|
| 33 | - } else { |
|
| 34 | - $auth_methode = $r[1]; |
|
| 35 | - $login = $r[2]; |
|
| 36 | - include_spip('inc/auth'); |
|
| 37 | - $res = auth_terminer_identifier_login($auth_methode, $login); |
|
| 38 | - |
|
| 39 | - if (is_string($res)) { // Erreur |
|
| 40 | - $redirect = _request('redirect'); |
|
| 41 | - $redirect = parametre_url($redirect, 'var_erreur', $res, '&'); |
|
| 42 | - include_spip('inc/headers'); |
|
| 43 | - redirige_par_entete($redirect); |
|
| 44 | - } |
|
| 45 | - |
|
| 46 | - // sinon on loge l'auteur identifie, et on finit (redirection automatique) |
|
| 47 | - auth_loger($res); |
|
| 48 | - } |
|
| 28 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | + $arg = $securiser_action(); |
|
| 30 | + |
|
| 31 | + if (!preg_match(",^(\w+)[/](.+)$,", $arg, $r)) { |
|
| 32 | + spip_log("action_auth_dist $arg pas compris"); |
|
| 33 | + } else { |
|
| 34 | + $auth_methode = $r[1]; |
|
| 35 | + $login = $r[2]; |
|
| 36 | + include_spip('inc/auth'); |
|
| 37 | + $res = auth_terminer_identifier_login($auth_methode, $login); |
|
| 38 | + |
|
| 39 | + if (is_string($res)) { // Erreur |
|
| 40 | + $redirect = _request('redirect'); |
|
| 41 | + $redirect = parametre_url($redirect, 'var_erreur', $res, '&'); |
|
| 42 | + include_spip('inc/headers'); |
|
| 43 | + redirige_par_entete($redirect); |
|
| 44 | + } |
|
| 45 | + |
|
| 46 | + // sinon on loge l'auteur identifie, et on finit (redirection automatique) |
|
| 47 | + auth_loger($res); |
|
| 48 | + } |
|
| 49 | 49 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -32,28 +32,28 @@ discard block |
||
| 32 | 32 | */ |
| 33 | 33 | function action_desinstaller_plugin_dist() { |
| 34 | 34 | |
| 35 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 36 | - $arg = $securiser_action(); |
|
| 37 | - list($dir_plugins, $plugin) = explode("::", $arg); |
|
| 38 | - $dir_type = "_DIR_PLUGINS"; |
|
| 39 | - if (defined('_DIR_PLUGINS_SUPPL') and $dir_plugins == _DIR_PLUGINS_SUPPL) { |
|
| 40 | - $dir_type = "_DIR_PLUGINS_SUPPL"; |
|
| 41 | - } |
|
| 42 | - $installer_plugins = charger_fonction('installer', 'plugins'); |
|
| 43 | - $infos = $installer_plugins($plugin, 'uninstall', $dir_type); |
|
| 44 | - if ($infos and !$infos['install_test'][0]) { |
|
| 45 | - include_spip('inc/plugin'); |
|
| 46 | - ecrire_plugin_actifs(array($plugin), false, 'enleve'); |
|
| 47 | - $erreur = ''; |
|
| 48 | - } else { |
|
| 49 | - $erreur = 'erreur_plugin_desinstalation_echouee'; |
|
| 50 | - } |
|
| 51 | - if ($redirect = _request('redirect')) { |
|
| 52 | - include_spip('inc/headers'); |
|
| 53 | - if ($erreur) { |
|
| 54 | - $redirect = parametre_url($redirect, 'erreur', $erreur); |
|
| 55 | - } |
|
| 56 | - $redirect = str_replace('&', '&', $redirect); |
|
| 57 | - redirige_par_entete($redirect); |
|
| 58 | - } |
|
| 35 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 36 | + $arg = $securiser_action(); |
|
| 37 | + list($dir_plugins, $plugin) = explode("::", $arg); |
|
| 38 | + $dir_type = "_DIR_PLUGINS"; |
|
| 39 | + if (defined('_DIR_PLUGINS_SUPPL') and $dir_plugins == _DIR_PLUGINS_SUPPL) { |
|
| 40 | + $dir_type = "_DIR_PLUGINS_SUPPL"; |
|
| 41 | + } |
|
| 42 | + $installer_plugins = charger_fonction('installer', 'plugins'); |
|
| 43 | + $infos = $installer_plugins($plugin, 'uninstall', $dir_type); |
|
| 44 | + if ($infos and !$infos['install_test'][0]) { |
|
| 45 | + include_spip('inc/plugin'); |
|
| 46 | + ecrire_plugin_actifs(array($plugin), false, 'enleve'); |
|
| 47 | + $erreur = ''; |
|
| 48 | + } else { |
|
| 49 | + $erreur = 'erreur_plugin_desinstalation_echouee'; |
|
| 50 | + } |
|
| 51 | + if ($redirect = _request('redirect')) { |
|
| 52 | + include_spip('inc/headers'); |
|
| 53 | + if ($erreur) { |
|
| 54 | + $redirect = parametre_url($redirect, 'erreur', $erreur); |
|
| 55 | + } |
|
| 56 | + $redirect = str_replace('&', '&', $redirect); |
|
| 57 | + redirige_par_entete($redirect); |
|
| 58 | + } |
|
| 59 | 59 | } |
@@ -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/actions'); |
@@ -33,84 +33,84 @@ discard block |
||
| 33 | 33 | * @return void |
| 34 | 34 | */ |
| 35 | 35 | function action_cookie_dist($set_cookie_admin = null, $change_session = null) { |
| 36 | - $redirect_echec = $redirect = null; |
|
| 37 | - $test_echec_cookie = null; |
|
| 38 | - $url = ""; |
|
| 39 | - if (is_null($set_cookie_admin)) { |
|
| 40 | - $set_cookie_admin = _request('cookie_admin'); |
|
| 41 | - $change_session = _request('change_session'); |
|
| 42 | - $test_echec_cookie = _request('test_echec_cookie'); |
|
| 36 | + $redirect_echec = $redirect = null; |
|
| 37 | + $test_echec_cookie = null; |
|
| 38 | + $url = ""; |
|
| 39 | + if (is_null($set_cookie_admin)) { |
|
| 40 | + $set_cookie_admin = _request('cookie_admin'); |
|
| 41 | + $change_session = _request('change_session'); |
|
| 42 | + $test_echec_cookie = _request('test_echec_cookie'); |
|
| 43 | 43 | |
| 44 | - // La cible de notre operation de connexion |
|
| 45 | - $url = securiser_redirect_action(_request('url')); |
|
| 46 | - $redirect = $url ? $url : generer_url_ecrire('accueil'); |
|
| 47 | - $redirect_echec = _request('url_echec'); |
|
| 48 | - if (!isset($redirect_echec)) { |
|
| 49 | - if (strpos($redirect, _DIR_RESTREINT_ABS) !== false) { |
|
| 50 | - $redirect_echec = generer_url_public('login', '', true); |
|
| 51 | - } else { |
|
| 52 | - $redirect_echec = $redirect; |
|
| 53 | - } |
|
| 54 | - } |
|
| 55 | - } |
|
| 44 | + // La cible de notre operation de connexion |
|
| 45 | + $url = securiser_redirect_action(_request('url')); |
|
| 46 | + $redirect = $url ? $url : generer_url_ecrire('accueil'); |
|
| 47 | + $redirect_echec = _request('url_echec'); |
|
| 48 | + if (!isset($redirect_echec)) { |
|
| 49 | + if (strpos($redirect, _DIR_RESTREINT_ABS) !== false) { |
|
| 50 | + $redirect_echec = generer_url_public('login', '', true); |
|
| 51 | + } else { |
|
| 52 | + $redirect_echec = $redirect; |
|
| 53 | + } |
|
| 54 | + } |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | 57 | |
| 58 | - // rejoue le cookie pour renouveler spip_session |
|
| 59 | - if ($change_session == 'oui') { |
|
| 60 | - $session = charger_fonction('session', 'inc'); |
|
| 61 | - $session(true); |
|
| 62 | - spip_log("statut 204 pour " . $_SERVER['REQUEST_URI']); |
|
| 63 | - http_status(204); // No Content |
|
| 64 | - return; |
|
| 65 | - } |
|
| 58 | + // rejoue le cookie pour renouveler spip_session |
|
| 59 | + if ($change_session == 'oui') { |
|
| 60 | + $session = charger_fonction('session', 'inc'); |
|
| 61 | + $session(true); |
|
| 62 | + spip_log("statut 204 pour " . $_SERVER['REQUEST_URI']); |
|
| 63 | + http_status(204); // No Content |
|
| 64 | + return; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - // tentative de connexion en auth_http |
|
| 68 | - if (_request('essai_auth_http') and !$GLOBALS['ignore_auth_http']) { |
|
| 69 | - include_spip('inc/auth'); |
|
| 70 | - if (@$_SERVER['PHP_AUTH_USER'] |
|
| 71 | - and @$_SERVER['PHP_AUTH_PW'] |
|
| 72 | - and $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) |
|
| 73 | - ) { |
|
| 74 | - auth_loger($auteur); |
|
| 75 | - redirige_par_entete(parametre_url($redirect, 't', time(), '&')); |
|
| 76 | - } else { |
|
| 77 | - ask_php_auth(_T('info_connexion_refusee'), |
|
| 78 | - _T('login_login_pass_incorrect'), |
|
| 79 | - _T('login_retour_site'), |
|
| 80 | - "url=" . rawurlencode($redirect), |
|
| 81 | - _T('login_nouvelle_tentative'), |
|
| 82 | - (strpos($url, _DIR_RESTREINT_ABS) !== false)); |
|
| 83 | - } |
|
| 84 | - } else { |
|
| 67 | + // tentative de connexion en auth_http |
|
| 68 | + if (_request('essai_auth_http') and !$GLOBALS['ignore_auth_http']) { |
|
| 69 | + include_spip('inc/auth'); |
|
| 70 | + if (@$_SERVER['PHP_AUTH_USER'] |
|
| 71 | + and @$_SERVER['PHP_AUTH_PW'] |
|
| 72 | + and $auteur = lire_php_auth($_SERVER['PHP_AUTH_USER'], $_SERVER['PHP_AUTH_PW']) |
|
| 73 | + ) { |
|
| 74 | + auth_loger($auteur); |
|
| 75 | + redirige_par_entete(parametre_url($redirect, 't', time(), '&')); |
|
| 76 | + } else { |
|
| 77 | + ask_php_auth(_T('info_connexion_refusee'), |
|
| 78 | + _T('login_login_pass_incorrect'), |
|
| 79 | + _T('login_retour_site'), |
|
| 80 | + "url=" . rawurlencode($redirect), |
|
| 81 | + _T('login_nouvelle_tentative'), |
|
| 82 | + (strpos($url, _DIR_RESTREINT_ABS) !== false)); |
|
| 83 | + } |
|
| 84 | + } else { |
|
| 85 | 85 | |
| 86 | - // en cas de login sur bonjour=oui, on tente de poser un cookie |
|
| 87 | - // puis de passer au login qui diagnostiquera l'echec de cookie |
|
| 88 | - // le cas echeant. |
|
| 89 | - if ($test_echec_cookie == 'oui') { |
|
| 90 | - spip_setcookie('spip_session', 'test_echec_cookie'); |
|
| 91 | - if ($redirect) { |
|
| 92 | - $redirect = parametre_url(parametre_url($redirect_echec, 'var_echec_cookie', 'oui', '&'), 'url', |
|
| 93 | - rawurlencode($redirect), '&'); |
|
| 94 | - } |
|
| 95 | - } else { |
|
| 86 | + // en cas de login sur bonjour=oui, on tente de poser un cookie |
|
| 87 | + // puis de passer au login qui diagnostiquera l'echec de cookie |
|
| 88 | + // le cas echeant. |
|
| 89 | + if ($test_echec_cookie == 'oui') { |
|
| 90 | + spip_setcookie('spip_session', 'test_echec_cookie'); |
|
| 91 | + if ($redirect) { |
|
| 92 | + $redirect = parametre_url(parametre_url($redirect_echec, 'var_echec_cookie', 'oui', '&'), 'url', |
|
| 93 | + rawurlencode($redirect), '&'); |
|
| 94 | + } |
|
| 95 | + } else { |
|
| 96 | 96 | |
| 97 | - $cook = isset($_COOKIE['spip_admin']) ? $_COOKIE['spip_admin'] : ''; |
|
| 98 | - // Suppression cookie d'admin ? |
|
| 99 | - if ($set_cookie_admin == "non") { |
|
| 100 | - if ($cook) { |
|
| 101 | - spip_setcookie('spip_admin', $cook, time() - 3600 * 24); |
|
| 102 | - } |
|
| 103 | - } // Ajout de cookie d'admin |
|
| 104 | - else { |
|
| 105 | - if ($set_cookie_admin and _DUREE_COOKIE_ADMIN) { |
|
| 106 | - spip_setcookie('spip_admin', $set_cookie_admin, time() + max(_DUREE_COOKIE_ADMIN, 2 * _RENOUVELLE_ALEA)); |
|
| 107 | - } |
|
| 108 | - } |
|
| 109 | - } |
|
| 110 | - } |
|
| 97 | + $cook = isset($_COOKIE['spip_admin']) ? $_COOKIE['spip_admin'] : ''; |
|
| 98 | + // Suppression cookie d'admin ? |
|
| 99 | + if ($set_cookie_admin == "non") { |
|
| 100 | + if ($cook) { |
|
| 101 | + spip_setcookie('spip_admin', $cook, time() - 3600 * 24); |
|
| 102 | + } |
|
| 103 | + } // Ajout de cookie d'admin |
|
| 104 | + else { |
|
| 105 | + if ($set_cookie_admin and _DUREE_COOKIE_ADMIN) { |
|
| 106 | + spip_setcookie('spip_admin', $set_cookie_admin, time() + max(_DUREE_COOKIE_ADMIN, 2 * _RENOUVELLE_ALEA)); |
|
| 107 | + } |
|
| 108 | + } |
|
| 109 | + } |
|
| 110 | + } |
|
| 111 | 111 | |
| 112 | - // Redirection finale |
|
| 113 | - if ($redirect) { |
|
| 114 | - redirige_par_entete($redirect, true); |
|
| 115 | - } |
|
| 112 | + // Redirection finale |
|
| 113 | + if ($redirect) { |
|
| 114 | + redirige_par_entete($redirect, true); |
|
| 115 | + } |
|
| 116 | 116 | } |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | if ($change_session == 'oui') { |
| 60 | 60 | $session = charger_fonction('session', 'inc'); |
| 61 | 61 | $session(true); |
| 62 | - spip_log("statut 204 pour " . $_SERVER['REQUEST_URI']); |
|
| 62 | + spip_log("statut 204 pour ".$_SERVER['REQUEST_URI']); |
|
| 63 | 63 | http_status(204); // No Content |
| 64 | 64 | return; |
| 65 | 65 | } |
@@ -77,7 +77,7 @@ discard block |
||
| 77 | 77 | ask_php_auth(_T('info_connexion_refusee'), |
| 78 | 78 | _T('login_login_pass_incorrect'), |
| 79 | 79 | _T('login_retour_site'), |
| 80 | - "url=" . rawurlencode($redirect), |
|
| 80 | + "url=".rawurlencode($redirect), |
|
| 81 | 81 | _T('login_nouvelle_tentative'), |
| 82 | 82 | (strpos($url, _DIR_RESTREINT_ABS) !== false)); |
| 83 | 83 | } |
@@ -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 | /** |
@@ -25,34 +25,34 @@ discard block |
||
| 25 | 25 | **/ |
| 26 | 26 | function action_instituer_langue_rubrique_dist() { |
| 27 | 27 | |
| 28 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | - $arg = $securiser_action(); |
|
| 30 | - $changer_lang = _request('changer_lang'); |
|
| 31 | - |
|
| 32 | - list($id_rubrique, $id_parent) = preg_split('/\W/', $arg); |
|
| 33 | - |
|
| 34 | - if ($changer_lang |
|
| 35 | - and $id_rubrique > 0 |
|
| 36 | - and $GLOBALS['meta']['multi_rubriques'] == 'oui' |
|
| 37 | - and ($GLOBALS['meta']['multi_secteurs'] == 'non' or $id_parent == 0) |
|
| 38 | - ) { |
|
| 39 | - if ($changer_lang != "herit") { |
|
| 40 | - sql_updateq('spip_rubriques', array('lang' => $changer_lang, 'langue_choisie' => 'oui'), |
|
| 41 | - "id_rubrique=$id_rubrique"); |
|
| 42 | - } else { |
|
| 43 | - if ($id_parent == 0) { |
|
| 44 | - $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 45 | - } else { |
|
| 46 | - $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=$id_parent"); |
|
| 47 | - } |
|
| 48 | - sql_updateq('spip_rubriques', array('lang' => $langue_parent, 'langue_choisie' => 'non'), |
|
| 49 | - "id_rubrique=$id_rubrique"); |
|
| 50 | - } |
|
| 51 | - include_spip('inc/rubriques'); |
|
| 52 | - calculer_langues_rubriques(); |
|
| 53 | - |
|
| 54 | - // invalider les caches marques de cette rubrique |
|
| 55 | - include_spip('inc/invalideur'); |
|
| 56 | - suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 57 | - } |
|
| 28 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | + $arg = $securiser_action(); |
|
| 30 | + $changer_lang = _request('changer_lang'); |
|
| 31 | + |
|
| 32 | + list($id_rubrique, $id_parent) = preg_split('/\W/', $arg); |
|
| 33 | + |
|
| 34 | + if ($changer_lang |
|
| 35 | + and $id_rubrique > 0 |
|
| 36 | + and $GLOBALS['meta']['multi_rubriques'] == 'oui' |
|
| 37 | + and ($GLOBALS['meta']['multi_secteurs'] == 'non' or $id_parent == 0) |
|
| 38 | + ) { |
|
| 39 | + if ($changer_lang != "herit") { |
|
| 40 | + sql_updateq('spip_rubriques', array('lang' => $changer_lang, 'langue_choisie' => 'oui'), |
|
| 41 | + "id_rubrique=$id_rubrique"); |
|
| 42 | + } else { |
|
| 43 | + if ($id_parent == 0) { |
|
| 44 | + $langue_parent = $GLOBALS['meta']['langue_site']; |
|
| 45 | + } else { |
|
| 46 | + $langue_parent = sql_getfetsel("lang", "spip_rubriques", "id_rubrique=$id_parent"); |
|
| 47 | + } |
|
| 48 | + sql_updateq('spip_rubriques', array('lang' => $langue_parent, 'langue_choisie' => 'non'), |
|
| 49 | + "id_rubrique=$id_rubrique"); |
|
| 50 | + } |
|
| 51 | + include_spip('inc/rubriques'); |
|
| 52 | + calculer_langues_rubriques(); |
|
| 53 | + |
|
| 54 | + // invalider les caches marques de cette rubrique |
|
| 55 | + include_spip('inc/invalideur'); |
|
| 56 | + suivre_invalideur("id='rubrique/$id_rubrique'"); |
|
| 57 | + } |
|
| 58 | 58 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | */ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -33,26 +33,26 @@ discard block |
||
| 33 | 33 | * @see action_cron() URL appelée en asynchrone pour excécuter le cron |
| 34 | 34 | */ |
| 35 | 35 | function action_super_cron_dist() { |
| 36 | - // Si fsockopen est possible, on lance le cron via un socket |
|
| 37 | - // en asynchrone |
|
| 38 | - if (function_exists('fsockopen')) { |
|
| 39 | - $url = generer_url_action('cron'); |
|
| 40 | - $parts = parse_url($url); |
|
| 41 | - $fp = fsockopen($parts['host'], |
|
| 42 | - isset($parts['port']) ? $parts['port'] : 80, |
|
| 43 | - $errno, $errstr, 30); |
|
| 44 | - if ($fp) { |
|
| 45 | - $out = "GET " . $parts['path'] . "?" . $parts['query'] . " HTTP/1.1\r\n"; |
|
| 46 | - $out .= "Host: " . $parts['host'] . "\r\n"; |
|
| 47 | - $out .= "Connection: Close\r\n\r\n"; |
|
| 48 | - fwrite($fp, $out); |
|
| 49 | - fclose($fp); |
|
| 36 | + // Si fsockopen est possible, on lance le cron via un socket |
|
| 37 | + // en asynchrone |
|
| 38 | + if (function_exists('fsockopen')) { |
|
| 39 | + $url = generer_url_action('cron'); |
|
| 40 | + $parts = parse_url($url); |
|
| 41 | + $fp = fsockopen($parts['host'], |
|
| 42 | + isset($parts['port']) ? $parts['port'] : 80, |
|
| 43 | + $errno, $errstr, 30); |
|
| 44 | + if ($fp) { |
|
| 45 | + $out = "GET " . $parts['path'] . "?" . $parts['query'] . " HTTP/1.1\r\n"; |
|
| 46 | + $out .= "Host: " . $parts['host'] . "\r\n"; |
|
| 47 | + $out .= "Connection: Close\r\n\r\n"; |
|
| 48 | + fwrite($fp, $out); |
|
| 49 | + fclose($fp); |
|
| 50 | 50 | |
| 51 | - return; |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - // ici lancer le cron par un CURL asynchrone si CURL est présent |
|
| 55 | - // TBD |
|
| 51 | + return; |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + // ici lancer le cron par un CURL asynchrone si CURL est présent |
|
| 55 | + // TBD |
|
| 56 | 56 | |
| 57 | - return; |
|
| 57 | + return; |
|
| 58 | 58 | } |
@@ -42,8 +42,8 @@ |
||
| 42 | 42 | isset($parts['port']) ? $parts['port'] : 80, |
| 43 | 43 | $errno, $errstr, 30); |
| 44 | 44 | if ($fp) { |
| 45 | - $out = "GET " . $parts['path'] . "?" . $parts['query'] . " HTTP/1.1\r\n"; |
|
| 46 | - $out .= "Host: " . $parts['host'] . "\r\n"; |
|
| 45 | + $out = "GET ".$parts['path']."?".$parts['query']." HTTP/1.1\r\n"; |
|
| 46 | + $out .= "Host: ".$parts['host']."\r\n"; |
|
| 47 | 47 | $out .= "Connection: Close\r\n\r\n"; |
| 48 | 48 | fwrite($fp, $out); |
| 49 | 49 | fclose($fp); |
@@ -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 | /** |
@@ -31,17 +31,17 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | function action_debloquer_edition_dist() { |
| 33 | 33 | |
| 34 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 35 | - $arg = $securiser_action(); |
|
| 34 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 35 | + $arg = $securiser_action(); |
|
| 36 | 36 | |
| 37 | - if ($arg) { |
|
| 38 | - include_spip('inc/drapeau_edition'); |
|
| 39 | - if ($arg == 'tous') { |
|
| 40 | - debloquer_tous($GLOBALS['visiteur_session']['id_auteur']); |
|
| 41 | - } else { |
|
| 42 | - $arg = explode("-", $arg); |
|
| 43 | - list($objet, $id_objet) = $arg; |
|
| 44 | - debloquer_edition($GLOBALS['visiteur_session']['id_auteur'], $id_objet, $objet); |
|
| 45 | - } |
|
| 46 | - } |
|
| 37 | + if ($arg) { |
|
| 38 | + include_spip('inc/drapeau_edition'); |
|
| 39 | + if ($arg == 'tous') { |
|
| 40 | + debloquer_tous($GLOBALS['visiteur_session']['id_auteur']); |
|
| 41 | + } else { |
|
| 42 | + $arg = explode("-", $arg); |
|
| 43 | + list($objet, $id_objet) = $arg; |
|
| 44 | + debloquer_edition($GLOBALS['visiteur_session']['id_auteur'], $id_objet, $objet); |
|
| 45 | + } |
|
| 46 | + } |
|
| 47 | 47 | } |
@@ -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 | /** |
@@ -28,20 +28,20 @@ discard block |
||
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | 30 | function action_confirmer_email_dist() { |
| 31 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 32 | - $arg = $securiser_action(); |
|
| 31 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 32 | + $arg = $securiser_action(); |
|
| 33 | 33 | |
| 34 | - include_spip('inc/filtres'); |
|
| 35 | - if ($GLOBALS['visiteur_session']['id_auteur'] and email_valide($arg)) { |
|
| 36 | - include_spip('action/editer_auteur'); |
|
| 37 | - auteur_modifier($GLOBALS['visiteur_session']['id_auteur'], array('email' => $arg)); |
|
| 38 | - } |
|
| 39 | - // verifier avant de rediriger pour invalider le message de confirmation |
|
| 40 | - // si ca n'a pas marche |
|
| 41 | - if ($redirect = _request('redirect') and !$arg == sql_getfetsel('email', 'spip_auteurs', |
|
| 42 | - 'id_auteur=' . intval($GLOBALS['visiteur_session'])) |
|
| 43 | - ) { |
|
| 44 | - $GLOBALS['redirect'] = parametre_url($redirect, 'email_modif', ''); |
|
| 45 | - } |
|
| 34 | + include_spip('inc/filtres'); |
|
| 35 | + if ($GLOBALS['visiteur_session']['id_auteur'] and email_valide($arg)) { |
|
| 36 | + include_spip('action/editer_auteur'); |
|
| 37 | + auteur_modifier($GLOBALS['visiteur_session']['id_auteur'], array('email' => $arg)); |
|
| 38 | + } |
|
| 39 | + // verifier avant de rediriger pour invalider le message de confirmation |
|
| 40 | + // si ca n'a pas marche |
|
| 41 | + if ($redirect = _request('redirect') and !$arg == sql_getfetsel('email', 'spip_auteurs', |
|
| 42 | + 'id_auteur=' . intval($GLOBALS['visiteur_session'])) |
|
| 43 | + ) { |
|
| 44 | + $GLOBALS['redirect'] = parametre_url($redirect, 'email_modif', ''); |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | 47 | } |
@@ -39,7 +39,7 @@ |
||
| 39 | 39 | // verifier avant de rediriger pour invalider le message de confirmation |
| 40 | 40 | // si ca n'a pas marche |
| 41 | 41 | if ($redirect = _request('redirect') and !$arg == sql_getfetsel('email', 'spip_auteurs', |
| 42 | - 'id_auteur=' . intval($GLOBALS['visiteur_session'])) |
|
| 42 | + 'id_auteur='.intval($GLOBALS['visiteur_session'])) |
|
| 43 | 43 | ) { |
| 44 | 44 | $GLOBALS['redirect'] = parametre_url($redirect, 'email_modif', ''); |
| 45 | 45 | } |
@@ -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 | /** |
@@ -28,52 +28,52 @@ discard block |
||
| 28 | 28 | * @return void |
| 29 | 29 | */ |
| 30 | 30 | function action_confirmer_inscription_dist() { |
| 31 | - $jeton = _request('jeton'); |
|
| 32 | - $email = _request('email'); |
|
| 31 | + $jeton = _request('jeton'); |
|
| 32 | + $email = _request('email'); |
|
| 33 | 33 | |
| 34 | - include_spip('action/inscrire_auteur'); |
|
| 35 | - if ($auteur = auteur_verifier_jeton($jeton) |
|
| 36 | - and $auteur['email'] == $email |
|
| 37 | - and $auteur['statut'] == 'nouveau' |
|
| 38 | - ) { |
|
| 34 | + include_spip('action/inscrire_auteur'); |
|
| 35 | + if ($auteur = auteur_verifier_jeton($jeton) |
|
| 36 | + and $auteur['email'] == $email |
|
| 37 | + and $auteur['statut'] == 'nouveau' |
|
| 38 | + ) { |
|
| 39 | 39 | |
| 40 | - // d'abord on confirme son statut |
|
| 41 | - $auteur = confirmer_statut_inscription($auteur); |
|
| 40 | + // d'abord on confirme son statut |
|
| 41 | + $auteur = confirmer_statut_inscription($auteur); |
|
| 42 | 42 | |
| 43 | - // OK c'est un nouvel inscrit qui confirme : |
|
| 44 | - // on le loge => ca va confirmer son statut et c'est plus sympa |
|
| 45 | - include_spip('inc/auth'); |
|
| 46 | - auth_loger($auteur); |
|
| 43 | + // OK c'est un nouvel inscrit qui confirme : |
|
| 44 | + // on le loge => ca va confirmer son statut et c'est plus sympa |
|
| 45 | + include_spip('inc/auth'); |
|
| 46 | + auth_loger($auteur); |
|
| 47 | 47 | |
| 48 | - // et on efface son jeton |
|
| 49 | - auteur_effacer_jeton($auteur['id_auteur']); |
|
| 48 | + // et on efface son jeton |
|
| 49 | + auteur_effacer_jeton($auteur['id_auteur']); |
|
| 50 | 50 | |
| 51 | - // si pas de redirection demandee, rediriger vers public ou prive selon le statut de l'auteur |
|
| 52 | - // TODO: ne semble pas marcher si inscrit non visiteur, a debug |
|
| 53 | - if (!_request('redirect')) { |
|
| 54 | - // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos |
|
| 55 | - if (autoriser('ecrire', '', '', $auteur['id_auteur'])) { |
|
| 56 | - // poser un cookie admin aussi |
|
| 57 | - $cookie = charger_fonction('cookie', 'action'); |
|
| 58 | - $cookie("@" . $GLOBALS['visiteur_session']['login']); |
|
| 59 | - $GLOBALS['redirect'] = _DIR_RESTREINT_ABS; |
|
| 60 | - } else { |
|
| 61 | - $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site']; |
|
| 62 | - } |
|
| 63 | - } |
|
| 64 | - } else { |
|
| 65 | - // lien perime : |
|
| 66 | - if ($GLOBALS['visiteur_session']['id_auteur']) { |
|
| 67 | - // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos |
|
| 68 | - if (autoriser('ecrire', '', '', $GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 69 | - $GLOBALS['redirect'] = _DIR_RESTREINT_ABS; |
|
| 70 | - } else { |
|
| 71 | - $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site']; |
|
| 72 | - } |
|
| 73 | - } else // rediriger vers la page de login si pas encore loge |
|
| 74 | - { |
|
| 75 | - $GLOBALS['redirect'] = parametre_url(generer_url_public('login', '', false), 'url', _request('redirect')); |
|
| 76 | - } |
|
| 77 | - } |
|
| 51 | + // si pas de redirection demandee, rediriger vers public ou prive selon le statut de l'auteur |
|
| 52 | + // TODO: ne semble pas marcher si inscrit non visiteur, a debug |
|
| 53 | + if (!_request('redirect')) { |
|
| 54 | + // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos |
|
| 55 | + if (autoriser('ecrire', '', '', $auteur['id_auteur'])) { |
|
| 56 | + // poser un cookie admin aussi |
|
| 57 | + $cookie = charger_fonction('cookie', 'action'); |
|
| 58 | + $cookie("@" . $GLOBALS['visiteur_session']['login']); |
|
| 59 | + $GLOBALS['redirect'] = _DIR_RESTREINT_ABS; |
|
| 60 | + } else { |
|
| 61 | + $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site']; |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | + } else { |
|
| 65 | + // lien perime : |
|
| 66 | + if ($GLOBALS['visiteur_session']['id_auteur']) { |
|
| 67 | + // on passe id_auteur explicite pour forcer une lecture en base de toutes les infos |
|
| 68 | + if (autoriser('ecrire', '', '', $GLOBALS['visiteur_session']['id_auteur'])) { |
|
| 69 | + $GLOBALS['redirect'] = _DIR_RESTREINT_ABS; |
|
| 70 | + } else { |
|
| 71 | + $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site']; |
|
| 72 | + } |
|
| 73 | + } else // rediriger vers la page de login si pas encore loge |
|
| 74 | + { |
|
| 75 | + $GLOBALS['redirect'] = parametre_url(generer_url_public('login', '', false), 'url', _request('redirect')); |
|
| 76 | + } |
|
| 77 | + } |
|
| 78 | 78 | |
| 79 | 79 | } |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | if (autoriser('ecrire', '', '', $auteur['id_auteur'])) { |
| 56 | 56 | // poser un cookie admin aussi |
| 57 | 57 | $cookie = charger_fonction('cookie', 'action'); |
| 58 | - $cookie("@" . $GLOBALS['visiteur_session']['login']); |
|
| 58 | + $cookie("@".$GLOBALS['visiteur_session']['login']); |
|
| 59 | 59 | $GLOBALS['redirect'] = _DIR_RESTREINT_ABS; |
| 60 | 60 | } else { |
| 61 | 61 | $GLOBALS['redirect'] = $GLOBALS['meta']['adresse_site']; |
@@ -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/autoriser'); |
@@ -35,33 +35,33 @@ discard block |
||
| 35 | 35 | **/ |
| 36 | 36 | function action_menu_rubriques_dist() { |
| 37 | 37 | |
| 38 | - // si pas acces a ecrire, pas acces au menu |
|
| 39 | - // on renvoi un 401 qui fait echouer la requete ajax silencieusement |
|
| 40 | - if (!autoriser('ecrire')) { |
|
| 41 | - $retour = "<ul class='cols_1'><li class='toutsite'><a href='" . generer_url_ecrire('accueil') . "'>" . _T('public:lien_connecter') . "</a></li></ul>"; |
|
| 42 | - include_spip('inc/actions'); |
|
| 43 | - ajax_retour($retour); |
|
| 44 | - exit; |
|
| 45 | - } |
|
| 46 | - |
|
| 47 | - if ($date = intval(_request('date'))) { |
|
| 48 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s", $date) . " GMT"); |
|
| 49 | - } |
|
| 50 | - |
|
| 51 | - $r = gen_liste_rubriques(); |
|
| 52 | - if (!$r |
|
| 53 | - and isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) |
|
| 54 | - and !strstr($_SERVER['SERVER_SOFTWARE'], 'IIS/') |
|
| 55 | - ) { |
|
| 56 | - include_spip('inc/headers'); |
|
| 57 | - header('Content-Type: text/html; charset=' . $GLOBALS['meta']['charset']); |
|
| 58 | - http_status(304); |
|
| 59 | - exit; |
|
| 60 | - } else { |
|
| 61 | - include_spip('inc/actions'); |
|
| 62 | - $ret = menu_rubriques(); |
|
| 63 | - ajax_retour($ret); |
|
| 64 | - } |
|
| 38 | + // si pas acces a ecrire, pas acces au menu |
|
| 39 | + // on renvoi un 401 qui fait echouer la requete ajax silencieusement |
|
| 40 | + if (!autoriser('ecrire')) { |
|
| 41 | + $retour = "<ul class='cols_1'><li class='toutsite'><a href='" . generer_url_ecrire('accueil') . "'>" . _T('public:lien_connecter') . "</a></li></ul>"; |
|
| 42 | + include_spip('inc/actions'); |
|
| 43 | + ajax_retour($retour); |
|
| 44 | + exit; |
|
| 45 | + } |
|
| 46 | + |
|
| 47 | + if ($date = intval(_request('date'))) { |
|
| 48 | + header("Last-Modified: " . gmdate("D, d M Y H:i:s", $date) . " GMT"); |
|
| 49 | + } |
|
| 50 | + |
|
| 51 | + $r = gen_liste_rubriques(); |
|
| 52 | + if (!$r |
|
| 53 | + and isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) |
|
| 54 | + and !strstr($_SERVER['SERVER_SOFTWARE'], 'IIS/') |
|
| 55 | + ) { |
|
| 56 | + include_spip('inc/headers'); |
|
| 57 | + header('Content-Type: text/html; charset=' . $GLOBALS['meta']['charset']); |
|
| 58 | + http_status(304); |
|
| 59 | + exit; |
|
| 60 | + } else { |
|
| 61 | + include_spip('inc/actions'); |
|
| 62 | + $ret = menu_rubriques(); |
|
| 63 | + ajax_retour($ret); |
|
| 64 | + } |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /** |
@@ -75,39 +75,39 @@ discard block |
||
| 75 | 75 | * Code HTML présentant la liste des rubriques |
| 76 | 76 | **/ |
| 77 | 77 | function menu_rubriques($complet = true) { |
| 78 | - $ret = "<li class='toutsite'><a href='" . generer_url_ecrire('plan') . "'>" . _T('info_tout_site') . "</a></li>"; |
|
| 79 | - |
|
| 80 | - if (!$complet) { |
|
| 81 | - return "<ul class='cols_1'>$ret\n</ul>\n"; |
|
| 82 | - } |
|
| 83 | - |
|
| 84 | - if (!isset($GLOBALS['db_art_cache'])) { |
|
| 85 | - gen_liste_rubriques(); |
|
| 86 | - } |
|
| 87 | - $arr_low = extraire_article(0, $GLOBALS['db_art_cache']); |
|
| 88 | - |
|
| 89 | - $total_lignes = $i = sizeof($arr_low); |
|
| 90 | - |
|
| 91 | - if ($i > 0) { |
|
| 92 | - $nb_col = min(8, ceil($total_lignes / 30)); |
|
| 93 | - if ($nb_col <= 1) { |
|
| 94 | - $nb_col = ceil($total_lignes / 10); |
|
| 95 | - } |
|
| 96 | - foreach ($arr_low as $id_rubrique => $titre_rubrique) { |
|
| 97 | - if (autoriser('voir', 'rubrique', $id_rubrique)) { |
|
| 98 | - $ret .= bandeau_rubrique($id_rubrique, $titre_rubrique, $i); |
|
| 99 | - $i++; |
|
| 100 | - } |
|
| 101 | - } |
|
| 102 | - |
|
| 103 | - $ret = "<ul class='cols_$nb_col'>" |
|
| 104 | - . $ret |
|
| 105 | - . "\n</ul>\n"; |
|
| 106 | - } else { |
|
| 107 | - $ret = "<ul class='cols_1'>$ret\n</ul>\n"; |
|
| 108 | - } |
|
| 109 | - |
|
| 110 | - return $ret; |
|
| 78 | + $ret = "<li class='toutsite'><a href='" . generer_url_ecrire('plan') . "'>" . _T('info_tout_site') . "</a></li>"; |
|
| 79 | + |
|
| 80 | + if (!$complet) { |
|
| 81 | + return "<ul class='cols_1'>$ret\n</ul>\n"; |
|
| 82 | + } |
|
| 83 | + |
|
| 84 | + if (!isset($GLOBALS['db_art_cache'])) { |
|
| 85 | + gen_liste_rubriques(); |
|
| 86 | + } |
|
| 87 | + $arr_low = extraire_article(0, $GLOBALS['db_art_cache']); |
|
| 88 | + |
|
| 89 | + $total_lignes = $i = sizeof($arr_low); |
|
| 90 | + |
|
| 91 | + if ($i > 0) { |
|
| 92 | + $nb_col = min(8, ceil($total_lignes / 30)); |
|
| 93 | + if ($nb_col <= 1) { |
|
| 94 | + $nb_col = ceil($total_lignes / 10); |
|
| 95 | + } |
|
| 96 | + foreach ($arr_low as $id_rubrique => $titre_rubrique) { |
|
| 97 | + if (autoriser('voir', 'rubrique', $id_rubrique)) { |
|
| 98 | + $ret .= bandeau_rubrique($id_rubrique, $titre_rubrique, $i); |
|
| 99 | + $i++; |
|
| 100 | + } |
|
| 101 | + } |
|
| 102 | + |
|
| 103 | + $ret = "<ul class='cols_$nb_col'>" |
|
| 104 | + . $ret |
|
| 105 | + . "\n</ul>\n"; |
|
| 106 | + } else { |
|
| 107 | + $ret = "<ul class='cols_1'>$ret\n</ul>\n"; |
|
| 108 | + } |
|
| 109 | + |
|
| 110 | + return $ret; |
|
| 111 | 111 | } |
| 112 | 112 | |
| 113 | 113 | /** |
@@ -126,46 +126,46 @@ discard block |
||
| 126 | 126 | * Code HTML présentant la liste des rubriques |
| 127 | 127 | **/ |
| 128 | 128 | function bandeau_rubrique($id_rubrique, $titre_rubrique, $zdecal) { |
| 129 | - static $zmax = 6; |
|
| 130 | - |
|
| 131 | - $nav = "<a href='" |
|
| 132 | - . generer_url_entite($id_rubrique, 'rubrique', '', '', false) |
|
| 133 | - . "'>" |
|
| 134 | - . supprimer_tags(preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique)) |
|
| 135 | - . "</a>\n"; |
|
| 136 | - |
|
| 137 | - // Limiter volontairement le nombre de sous-menus |
|
| 138 | - if (!(--$zmax)) { |
|
| 139 | - $zmax++; |
|
| 140 | - |
|
| 141 | - return "\n<li>$nav</li>"; |
|
| 142 | - } |
|
| 143 | - |
|
| 144 | - $arr_rub = extraire_article($id_rubrique, $GLOBALS['db_art_cache']); |
|
| 145 | - $i = sizeof($arr_rub); |
|
| 146 | - if (!$i) { |
|
| 147 | - $zmax++; |
|
| 148 | - |
|
| 149 | - return "\n<li>$nav</li>"; |
|
| 150 | - } |
|
| 151 | - |
|
| 152 | - |
|
| 153 | - $nb_col = 1; |
|
| 154 | - if ($nb_rub = count($arr_rub)) { |
|
| 155 | - $nb_col = min(10, max(1, ceil($nb_rub / 10))); |
|
| 156 | - } |
|
| 157 | - $ret = "<li class='haschild'>$nav<ul class='cols_$nb_col'>"; |
|
| 158 | - foreach ($arr_rub as $id_rub => $titre_rub) { |
|
| 159 | - if (autoriser('voir', 'rubrique', $id_rub)) { |
|
| 160 | - $titre = supprimer_numero(typo($titre_rub)); |
|
| 161 | - $ret .= bandeau_rubrique($id_rub, $titre, $zdecal + $i); |
|
| 162 | - $i++; |
|
| 163 | - } |
|
| 164 | - } |
|
| 165 | - $ret .= "</ul></li>\n"; |
|
| 166 | - $zmax++; |
|
| 167 | - |
|
| 168 | - return $ret; |
|
| 129 | + static $zmax = 6; |
|
| 130 | + |
|
| 131 | + $nav = "<a href='" |
|
| 132 | + . generer_url_entite($id_rubrique, 'rubrique', '', '', false) |
|
| 133 | + . "'>" |
|
| 134 | + . supprimer_tags(preg_replace(',[\x00-\x1f]+,', ' ', $titre_rubrique)) |
|
| 135 | + . "</a>\n"; |
|
| 136 | + |
|
| 137 | + // Limiter volontairement le nombre de sous-menus |
|
| 138 | + if (!(--$zmax)) { |
|
| 139 | + $zmax++; |
|
| 140 | + |
|
| 141 | + return "\n<li>$nav</li>"; |
|
| 142 | + } |
|
| 143 | + |
|
| 144 | + $arr_rub = extraire_article($id_rubrique, $GLOBALS['db_art_cache']); |
|
| 145 | + $i = sizeof($arr_rub); |
|
| 146 | + if (!$i) { |
|
| 147 | + $zmax++; |
|
| 148 | + |
|
| 149 | + return "\n<li>$nav</li>"; |
|
| 150 | + } |
|
| 151 | + |
|
| 152 | + |
|
| 153 | + $nb_col = 1; |
|
| 154 | + if ($nb_rub = count($arr_rub)) { |
|
| 155 | + $nb_col = min(10, max(1, ceil($nb_rub / 10))); |
|
| 156 | + } |
|
| 157 | + $ret = "<li class='haschild'>$nav<ul class='cols_$nb_col'>"; |
|
| 158 | + foreach ($arr_rub as $id_rub => $titre_rub) { |
|
| 159 | + if (autoriser('voir', 'rubrique', $id_rub)) { |
|
| 160 | + $titre = supprimer_numero(typo($titre_rub)); |
|
| 161 | + $ret .= bandeau_rubrique($id_rub, $titre, $zdecal + $i); |
|
| 162 | + $i++; |
|
| 163 | + } |
|
| 164 | + } |
|
| 165 | + $ret .= "</ul></li>\n"; |
|
| 166 | + $zmax++; |
|
| 167 | + |
|
| 168 | + return $ret; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * Liste des rubriques enfants de la rubrique (et leur titre) |
| 184 | 184 | **/ |
| 185 | 185 | function extraire_article($id_p, $t) { |
| 186 | - return array_key_exists($id_p, $t) ? $t[$id_p] : array(); |
|
| 186 | + return array_key_exists($id_p, $t) ? $t[$id_p] : array(); |
|
| 187 | 187 | } |
| 188 | 188 | |
| 189 | 189 | /** |
@@ -199,34 +199,34 @@ discard block |
||
| 199 | 199 | **/ |
| 200 | 200 | function gen_liste_rubriques() { |
| 201 | 201 | |
| 202 | - include_spip('inc/config'); |
|
| 203 | - // ici, un petit fichier cache ne fait pas de mal |
|
| 204 | - $last = lire_config('date_calcul_rubriques', 0); |
|
| 205 | - if (lire_fichier(_CACHE_RUBRIQUES, $cache)) { |
|
| 206 | - list($date, $GLOBALS['db_art_cache']) = @unserialize($cache); |
|
| 207 | - if ($date == $last) { |
|
| 208 | - return false; |
|
| 209 | - } // c'etait en cache :-) |
|
| 210 | - } |
|
| 211 | - // se restreindre aux rubriques utilisees recemment +secteurs |
|
| 202 | + include_spip('inc/config'); |
|
| 203 | + // ici, un petit fichier cache ne fait pas de mal |
|
| 204 | + $last = lire_config('date_calcul_rubriques', 0); |
|
| 205 | + if (lire_fichier(_CACHE_RUBRIQUES, $cache)) { |
|
| 206 | + list($date, $GLOBALS['db_art_cache']) = @unserialize($cache); |
|
| 207 | + if ($date == $last) { |
|
| 208 | + return false; |
|
| 209 | + } // c'etait en cache :-) |
|
| 210 | + } |
|
| 211 | + // se restreindre aux rubriques utilisees recemment +secteurs |
|
| 212 | 212 | |
| 213 | - $where = sql_in_select("id_rubrique", "id_rubrique", "spip_rubriques", "", "", "id_parent=0 DESC, date DESC", |
|
| 214 | - _CACHE_RUBRIQUES_MAX); |
|
| 213 | + $where = sql_in_select("id_rubrique", "id_rubrique", "spip_rubriques", "", "", "id_parent=0 DESC, date DESC", |
|
| 214 | + _CACHE_RUBRIQUES_MAX); |
|
| 215 | 215 | |
| 216 | - // puis refaire la requete pour avoir l'ordre alphabetique |
|
| 216 | + // puis refaire la requete pour avoir l'ordre alphabetique |
|
| 217 | 217 | |
| 218 | - $res = sql_select("id_rubrique, titre, id_parent", "spip_rubriques", $where, '', 'id_parent, 0+titre, titre'); |
|
| 218 | + $res = sql_select("id_rubrique, titre, id_parent", "spip_rubriques", $where, '', 'id_parent, 0+titre, titre'); |
|
| 219 | 219 | |
| 220 | - // il ne faut pas filtrer le autoriser voir ici |
|
| 221 | - // car on met le resultat en cache, commun a tout le monde |
|
| 222 | - $GLOBALS['db_art_cache'] = array(); |
|
| 223 | - while ($r = sql_fetch($res)) { |
|
| 224 | - $t = sinon($r['titre'], _T('ecrire:info_sans_titre')); |
|
| 225 | - $GLOBALS['db_art_cache'][$r['id_parent']][$r['id_rubrique']] = supprimer_numero(typo($t)); |
|
| 226 | - } |
|
| 220 | + // il ne faut pas filtrer le autoriser voir ici |
|
| 221 | + // car on met le resultat en cache, commun a tout le monde |
|
| 222 | + $GLOBALS['db_art_cache'] = array(); |
|
| 223 | + while ($r = sql_fetch($res)) { |
|
| 224 | + $t = sinon($r['titre'], _T('ecrire:info_sans_titre')); |
|
| 225 | + $GLOBALS['db_art_cache'][$r['id_parent']][$r['id_rubrique']] = supprimer_numero(typo($t)); |
|
| 226 | + } |
|
| 227 | 227 | |
| 228 | - $t = array($last ? $last : time(), $GLOBALS['db_art_cache']); |
|
| 229 | - ecrire_fichier(_CACHE_RUBRIQUES, serialize($t)); |
|
| 228 | + $t = array($last ? $last : time(), $GLOBALS['db_art_cache']); |
|
| 229 | + ecrire_fichier(_CACHE_RUBRIQUES, serialize($t)); |
|
| 230 | 230 | |
| 231 | - return true; |
|
| 231 | + return true; |
|
| 232 | 232 | } |
@@ -38,14 +38,14 @@ discard block |
||
| 38 | 38 | // si pas acces a ecrire, pas acces au menu |
| 39 | 39 | // on renvoi un 401 qui fait echouer la requete ajax silencieusement |
| 40 | 40 | if (!autoriser('ecrire')) { |
| 41 | - $retour = "<ul class='cols_1'><li class='toutsite'><a href='" . generer_url_ecrire('accueil') . "'>" . _T('public:lien_connecter') . "</a></li></ul>"; |
|
| 41 | + $retour = "<ul class='cols_1'><li class='toutsite'><a href='".generer_url_ecrire('accueil')."'>"._T('public:lien_connecter')."</a></li></ul>"; |
|
| 42 | 42 | include_spip('inc/actions'); |
| 43 | 43 | ajax_retour($retour); |
| 44 | 44 | exit; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | if ($date = intval(_request('date'))) { |
| 48 | - header("Last-Modified: " . gmdate("D, d M Y H:i:s", $date) . " GMT"); |
|
| 48 | + header("Last-Modified: ".gmdate("D, d M Y H:i:s", $date)." GMT"); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | $r = gen_liste_rubriques(); |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | and !strstr($_SERVER['SERVER_SOFTWARE'], 'IIS/') |
| 55 | 55 | ) { |
| 56 | 56 | include_spip('inc/headers'); |
| 57 | - header('Content-Type: text/html; charset=' . $GLOBALS['meta']['charset']); |
|
| 57 | + header('Content-Type: text/html; charset='.$GLOBALS['meta']['charset']); |
|
| 58 | 58 | http_status(304); |
| 59 | 59 | exit; |
| 60 | 60 | } else { |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * Code HTML présentant la liste des rubriques |
| 76 | 76 | **/ |
| 77 | 77 | function menu_rubriques($complet = true) { |
| 78 | - $ret = "<li class='toutsite'><a href='" . generer_url_ecrire('plan') . "'>" . _T('info_tout_site') . "</a></li>"; |
|
| 78 | + $ret = "<li class='toutsite'><a href='".generer_url_ecrire('plan')."'>"._T('info_tout_site')."</a></li>"; |
|
| 79 | 79 | |
| 80 | 80 | if (!$complet) { |
| 81 | 81 | return "<ul class='cols_1'>$ret\n</ul>\n"; |