@@ -52,29 +52,28 @@ discard block |
||
| 52 | 52 | $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
| 53 | 53 | . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
| 54 | 54 | . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
| 55 | - . (($tls_ldap != 'oui') ? '' : |
|
| 56 | - "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 55 | + . (($tls_ldap != 'oui') ? '' : "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 57 | 56 | . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
| 58 | 57 | |
| 59 | 58 | $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : array(); |
| 60 | 59 | $res = ''; |
| 61 | 60 | foreach ($champs as $champ => $v) { |
| 62 | - $nom = 'ldap_' . $champ; |
|
| 61 | + $nom = 'ldap_'.$champ; |
|
| 63 | 62 | $val = trim(_request($nom)); |
| 64 | 63 | if (preg_match('/^\w*$/', $val)) { |
| 65 | 64 | if ($val) { |
| 66 | 65 | $val = _q($val); |
| 67 | 66 | } |
| 68 | 67 | } else { |
| 69 | - $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 68 | + $val = 'array('._q(preg_split('/\W+/', $val)).')'; |
|
| 70 | 69 | }; |
| 71 | 70 | if ($val) { |
| 72 | - $res .= "'$champ' => " . $val . ','; |
|
| 71 | + $res .= "'$champ' => ".$val.','; |
|
| 73 | 72 | } |
| 74 | 73 | } |
| 75 | 74 | $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
| 76 | 75 | |
| 77 | - install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 76 | + install_fichier_connexion(_DIR_CONNECT._FILE_LDAP, $conn); |
|
| 78 | 77 | } |
| 79 | 78 | |
| 80 | 79 | function etape_ldap5_suite() { |
@@ -87,7 +86,7 @@ discard block |
||
| 87 | 86 | ); |
| 88 | 87 | |
| 89 | 88 | echo generer_form_ecrire('install', ( |
| 90 | - "<input type='hidden' name='etape' value='3' />" . |
|
| 89 | + "<input type='hidden' name='etape' value='3' />". |
|
| 91 | 90 | "<input type='hidden' name='ldap_present' value='true' />" |
| 92 | 91 | . bouton_suivant())); |
| 93 | 92 | |
@@ -11,85 +11,85 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | include_spip('inc/headers'); |
| 17 | 17 | include_spip('auth/ldap'); |
| 18 | 18 | |
| 19 | 19 | // https://code.spip.net/@install_etape_ldap5_dist |
| 20 | 20 | function install_etape_ldap5_dist() { |
| 21 | - etape_ldap5_save(); |
|
| 22 | - etape_ldap5_suite(); |
|
| 21 | + etape_ldap5_save(); |
|
| 22 | + etape_ldap5_suite(); |
|
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | function etape_ldap5_save() { |
| 26 | - if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 27 | - redirige_url_ecrire('install'); |
|
| 28 | - } |
|
| 26 | + if (!@file_exists(_FILE_CONNECT_TMP)) { |
|
| 27 | + redirige_url_ecrire('install'); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - ecrire_meta('ldap_statut_import', _request('statut_ldap')); |
|
| 30 | + ecrire_meta('ldap_statut_import', _request('statut_ldap')); |
|
| 31 | 31 | |
| 32 | - lire_fichier(_FILE_CONNECT_TMP, $conn); |
|
| 32 | + lire_fichier(_FILE_CONNECT_TMP, $conn); |
|
| 33 | 33 | |
| 34 | - if ($p = strpos($conn, "'');")) { |
|
| 35 | - ecrire_fichier( |
|
| 36 | - _FILE_CONNECT_TMP, |
|
| 37 | - substr($conn, 0, $p + 1) |
|
| 38 | - . _FILE_LDAP |
|
| 39 | - . substr($conn, $p + 1) |
|
| 40 | - ); |
|
| 41 | - } |
|
| 34 | + if ($p = strpos($conn, "'');")) { |
|
| 35 | + ecrire_fichier( |
|
| 36 | + _FILE_CONNECT_TMP, |
|
| 37 | + substr($conn, 0, $p + 1) |
|
| 38 | + . _FILE_LDAP |
|
| 39 | + . substr($conn, $p + 1) |
|
| 40 | + ); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | - $adresse_ldap = addcslashes(_request('adresse_ldap'), "'\\"); |
|
| 44 | - $login_ldap = addcslashes(_request('login_ldap'), "'\\"); |
|
| 45 | - $pass_ldap = addcslashes(_request('pass_ldap'), "'\\"); |
|
| 46 | - $port_ldap = addcslashes(_request('port_ldap'), "'\\"); |
|
| 47 | - $tls_ldap = addcslashes(_request('tls_ldap'), "'\\"); |
|
| 48 | - $protocole_ldap = addcslashes(_request('protocole_ldap'), "'\\"); |
|
| 49 | - $base_ldap = addcslashes(_request('base_ldap'), "'\\"); |
|
| 50 | - $base_ldap_text = addcslashes(_request('base_ldap_text'), "'\\"); |
|
| 43 | + $adresse_ldap = addcslashes(_request('adresse_ldap'), "'\\"); |
|
| 44 | + $login_ldap = addcslashes(_request('login_ldap'), "'\\"); |
|
| 45 | + $pass_ldap = addcslashes(_request('pass_ldap'), "'\\"); |
|
| 46 | + $port_ldap = addcslashes(_request('port_ldap'), "'\\"); |
|
| 47 | + $tls_ldap = addcslashes(_request('tls_ldap'), "'\\"); |
|
| 48 | + $protocole_ldap = addcslashes(_request('protocole_ldap'), "'\\"); |
|
| 49 | + $base_ldap = addcslashes(_request('base_ldap'), "'\\"); |
|
| 50 | + $base_ldap_text = addcslashes(_request('base_ldap_text'), "'\\"); |
|
| 51 | 51 | |
| 52 | - $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
|
| 53 | - . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
|
| 54 | - . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
|
| 55 | - . (($tls_ldap != 'oui') ? '' : |
|
| 56 | - "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 57 | - . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
|
| 52 | + $conn = "\$GLOBALS['ldap_base'] = '$base_ldap';\n" |
|
| 53 | + . "\$GLOBALS['ldap_link'] = @ldap_connect('$adresse_ldap','$port_ldap');\n" |
|
| 54 | + . "@ldap_set_option(\$GLOBALS['ldap_link'],LDAP_OPT_PROTOCOL_VERSION,'$protocole_ldap');\n" |
|
| 55 | + . (($tls_ldap != 'oui') ? '' : |
|
| 56 | + "@ldap_start_tls(\$GLOBALS['ldap_link']);\n") |
|
| 57 | + . "@ldap_bind(\$GLOBALS['ldap_link'],'$login_ldap','$pass_ldap');\n"; |
|
| 58 | 58 | |
| 59 | - $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : array(); |
|
| 60 | - $res = ''; |
|
| 61 | - foreach ($champs as $champ => $v) { |
|
| 62 | - $nom = 'ldap_' . $champ; |
|
| 63 | - $val = trim(_request($nom)); |
|
| 64 | - if (preg_match('/^\w*$/', $val)) { |
|
| 65 | - if ($val) { |
|
| 66 | - $val = _q($val); |
|
| 67 | - } |
|
| 68 | - } else { |
|
| 69 | - $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 70 | - }; |
|
| 71 | - if ($val) { |
|
| 72 | - $res .= "'$champ' => " . $val . ','; |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
|
| 59 | + $champs = is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : array(); |
|
| 60 | + $res = ''; |
|
| 61 | + foreach ($champs as $champ => $v) { |
|
| 62 | + $nom = 'ldap_' . $champ; |
|
| 63 | + $val = trim(_request($nom)); |
|
| 64 | + if (preg_match('/^\w*$/', $val)) { |
|
| 65 | + if ($val) { |
|
| 66 | + $val = _q($val); |
|
| 67 | + } |
|
| 68 | + } else { |
|
| 69 | + $val = 'array(' . _q(preg_split('/\W+/', $val)) . ')'; |
|
| 70 | + }; |
|
| 71 | + if ($val) { |
|
| 72 | + $res .= "'$champ' => " . $val . ','; |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + $conn .= "\$GLOBALS['ldap_champs'] = array($res);\n"; |
|
| 76 | 76 | |
| 77 | - install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 77 | + install_fichier_connexion(_DIR_CONNECT . _FILE_LDAP, $conn); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | function etape_ldap5_suite() { |
| 81 | - echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 81 | + echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 82 | 82 | |
| 83 | - echo info_etape( |
|
| 84 | - _T('info_ldap_ok'), |
|
| 85 | - info_progression_etape(5, 'etape_ldap', 'install/'), |
|
| 86 | - _T('info_terminer_installation') |
|
| 87 | - ); |
|
| 83 | + echo info_etape( |
|
| 84 | + _T('info_ldap_ok'), |
|
| 85 | + info_progression_etape(5, 'etape_ldap', 'install/'), |
|
| 86 | + _T('info_terminer_installation') |
|
| 87 | + ); |
|
| 88 | 88 | |
| 89 | - echo generer_form_ecrire('install', ( |
|
| 90 | - "<input type='hidden' name='etape' value='3' />" . |
|
| 91 | - "<input type='hidden' name='ldap_present' value='true' />" |
|
| 92 | - . bouton_suivant())); |
|
| 89 | + echo generer_form_ecrire('install', ( |
|
| 90 | + "<input type='hidden' name='etape' value='3' />" . |
|
| 91 | + "<input type='hidden' name='ldap_present' value='true' />" |
|
| 92 | + . bouton_suivant())); |
|
| 93 | 93 | |
| 94 | - echo install_fin_html(); |
|
| 94 | + echo install_fin_html(); |
|
| 95 | 95 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | */ |
| 19 | 19 | |
| 20 | 20 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 21 | - return; |
|
| 21 | + return; |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | /** |
@@ -27,18 +27,18 @@ discard block |
||
| 27 | 27 | * @uses info_copyright() |
| 28 | 28 | **/ |
| 29 | 29 | function install_etape__dist() { |
| 30 | - utiliser_langue_visiteur(); |
|
| 31 | - $menu_langues = menu_langues('var_lang_ecrire'); |
|
| 32 | - if (!$menu_langues) { |
|
| 33 | - redirige_url_ecrire('install', 'etape=chmod'); |
|
| 34 | - } else { |
|
| 35 | - include_spip('inc/presentation'); // pour info_copyright |
|
| 30 | + utiliser_langue_visiteur(); |
|
| 31 | + $menu_langues = menu_langues('var_lang_ecrire'); |
|
| 32 | + if (!$menu_langues) { |
|
| 33 | + redirige_url_ecrire('install', 'etape=chmod'); |
|
| 34 | + } else { |
|
| 35 | + include_spip('inc/presentation'); // pour info_copyright |
|
| 36 | 36 | |
| 37 | - $res = "<div class='petit-centre'><img alt='SPIP' class='logo' src='" . chemin_image('logo-spip.png') . "' />\n" . |
|
| 38 | - "<p class='small'>" . info_copyright() . "</p></div>\n" . |
|
| 39 | - '<p>' . _T('install_select_langue') . '</p>' . |
|
| 40 | - '<div>' . $menu_langues . "</div>\n" . |
|
| 41 | - generer_form_ecrire('install', "<input type='hidden' name='etape' value='chmod' />" . bouton_suivant()); |
|
| 42 | - echo minipres('AUTO', $res); |
|
| 43 | - } |
|
| 37 | + $res = "<div class='petit-centre'><img alt='SPIP' class='logo' src='" . chemin_image('logo-spip.png') . "' />\n" . |
|
| 38 | + "<p class='small'>" . info_copyright() . "</p></div>\n" . |
|
| 39 | + '<p>' . _T('install_select_langue') . '</p>' . |
|
| 40 | + '<div>' . $menu_langues . "</div>\n" . |
|
| 41 | + generer_form_ecrire('install', "<input type='hidden' name='etape' value='chmod' />" . bouton_suivant()); |
|
| 42 | + echo minipres('AUTO', $res); |
|
| 43 | + } |
|
| 44 | 44 | } |
@@ -34,11 +34,11 @@ |
||
| 34 | 34 | } else { |
| 35 | 35 | include_spip('inc/presentation'); // pour info_copyright |
| 36 | 36 | |
| 37 | - $res = "<div class='petit-centre'><img alt='SPIP' class='logo' src='" . chemin_image('logo-spip.png') . "' />\n" . |
|
| 38 | - "<p class='small'>" . info_copyright() . "</p></div>\n" . |
|
| 39 | - '<p>' . _T('install_select_langue') . '</p>' . |
|
| 40 | - '<div>' . $menu_langues . "</div>\n" . |
|
| 41 | - generer_form_ecrire('install', "<input type='hidden' name='etape' value='chmod' />" . bouton_suivant()); |
|
| 37 | + $res = "<div class='petit-centre'><img alt='SPIP' class='logo' src='".chemin_image('logo-spip.png')."' />\n". |
|
| 38 | + "<p class='small'>".info_copyright()."</p></div>\n". |
|
| 39 | + '<p>'._T('install_select_langue').'</p>'. |
|
| 40 | + '<div>'.$menu_langues."</div>\n". |
|
| 41 | + generer_form_ecrire('install', "<input type='hidden' name='etape' value='chmod' />".bouton_suivant()); |
|
| 42 | 42 | echo minipres('AUTO', $res); |
| 43 | 43 | } |
| 44 | 44 | } |
@@ -22,192 +22,192 @@ |
||
| 22 | 22 | |
| 23 | 23 | if (isset($GLOBALS['_INC_PUBLIC']) and $GLOBALS['_INC_PUBLIC']) { |
| 24 | 24 | |
| 25 | - echo recuperer_fond($fond, $contexte_inclus, array(), _request('connect')); |
|
| 25 | + echo recuperer_fond($fond, $contexte_inclus, array(), _request('connect')); |
|
| 26 | 26 | |
| 27 | 27 | } else { |
| 28 | 28 | |
| 29 | - $GLOBALS['_INC_PUBLIC'] = 1; |
|
| 30 | - define('_PIPELINE_SUFFIX', test_espace_prive() ? '_prive' : ''); |
|
| 31 | - |
|
| 32 | - // Faut-il initialiser SPIP ? (oui dans le cas general) |
|
| 33 | - if (!defined('_DIR_RESTREINT_ABS')) { |
|
| 34 | - if (defined('_DIR_RESTREINT') |
|
| 35 | - and @file_exists(_ROOT_RESTREINT . 'inc_version.php') |
|
| 36 | - ) { |
|
| 37 | - include_once _ROOT_RESTREINT . 'inc_version.php'; |
|
| 38 | - } else { |
|
| 39 | - die('inc_version absent ?'); |
|
| 40 | - } |
|
| 41 | - } // $fond defini dans le fichier d'appel ? |
|
| 42 | - |
|
| 43 | - else { |
|
| 44 | - if (isset($fond) and !_request('fond')) { |
|
| 45 | - } // fond demande dans l'url par page=xxxx ? |
|
| 46 | - else { |
|
| 47 | - if (isset($_GET[_SPIP_PAGE])) { |
|
| 48 | - $fond = (string)$_GET[_SPIP_PAGE]; |
|
| 49 | - |
|
| 50 | - // Securite |
|
| 51 | - if (strstr($fond, '/') |
|
| 52 | - and !( |
|
| 53 | - isset($GLOBALS['visiteur_session']) // pour eviter d'evaluer la suite pour les anonymes |
|
| 54 | - and include_spip('inc/autoriser') |
|
| 55 | - and autoriser('webmestre')) |
|
| 56 | - ) { |
|
| 57 | - include_spip('inc/minipres'); |
|
| 58 | - echo minipres(); |
|
| 59 | - exit; |
|
| 60 | - } |
|
| 61 | - // l'argument Page a priorite sur l'argument action |
|
| 62 | - // le cas se presente a cause des RewriteRule d'Apache |
|
| 63 | - // qui permettent d'ajouter un argument dans la QueryString |
|
| 64 | - // mais pas d'en retirer un en conservant les autres. |
|
| 65 | - if (isset($_GET['action']) and $_GET['action'] === $fond) { |
|
| 66 | - unset($_GET['action']); |
|
| 67 | - } |
|
| 68 | - # sinon, fond par defaut |
|
| 69 | - } else { |
|
| 70 | - // sinon fond par defaut (cf. assembler.php) |
|
| 71 | - $fond = pipeline('detecter_fond_par_defaut', ''); |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - $tableau_des_temps = array(); |
|
| 77 | - |
|
| 78 | - // Particularites de certains squelettes |
|
| 79 | - if ($fond == 'login') { |
|
| 80 | - $forcer_lang = true; |
|
| 81 | - } |
|
| 82 | - |
|
| 83 | - if (isset($forcer_lang) and $forcer_lang and ($forcer_lang !== 'non') |
|
| 84 | - and !_request('action') |
|
| 85 | - and $_SERVER['REQUEST_METHOD'] != 'POST' |
|
| 86 | - ) { |
|
| 87 | - include_spip('inc/lang'); |
|
| 88 | - verifier_lang_url(); |
|
| 89 | - } |
|
| 90 | - |
|
| 91 | - $lang = !isset($_GET['lang']) ? '' : lang_select($_GET['lang']); |
|
| 92 | - |
|
| 93 | - // Charger l'aiguilleur des traitements derogatoires |
|
| 94 | - // (action en base SQL, formulaires CVT, AJax) |
|
| 95 | - if (_request('action') or _request('var_ajax') or _request('formulaire_action')) { |
|
| 96 | - include_spip('public/aiguiller'); |
|
| 97 | - if ( |
|
| 98 | - // cas des appels actions ?action=xxx |
|
| 99 | - traiter_appels_actions() |
|
| 100 | - or |
|
| 101 | - // cas des hits ajax sur les inclusions ajax |
|
| 102 | - traiter_appels_inclusions_ajax() |
|
| 103 | - or |
|
| 104 | - // cas des formulaires charger/verifier/traiter |
|
| 105 | - traiter_formulaires_dynamiques() |
|
| 106 | - ) { |
|
| 107 | - // lancer les taches sur affichage final, comme le cron |
|
| 108 | - // mais sans rien afficher |
|
| 109 | - $GLOBALS['html'] = false; // ne rien afficher |
|
| 110 | - pipeline('affichage_final' . _PIPELINE_SUFFIX, ''); |
|
| 111 | - exit; // le hit est fini ! |
|
| 112 | - } |
|
| 113 | - } |
|
| 114 | - |
|
| 115 | - // Il y a du texte a produire, charger le metteur en page |
|
| 116 | - include_spip('public/assembler'); |
|
| 117 | - $page = assembler($fond, _request('connect')); |
|
| 118 | - |
|
| 119 | - if (isset($page['status'])) { |
|
| 120 | - include_spip('inc/headers'); |
|
| 121 | - http_status($page['status']); |
|
| 122 | - } |
|
| 123 | - |
|
| 124 | - // Content-Type ? |
|
| 125 | - if (!isset($page['entetes']['Content-Type'])) { |
|
| 126 | - $charset = isset($GLOBALS['meta']['charset']) ? $GLOBALS['meta']['charset'] : "utf-8"; |
|
| 127 | - $page['entetes']['Content-Type'] = 'text/html; charset=' . $charset; |
|
| 128 | - $html = true; |
|
| 129 | - } else { |
|
| 130 | - $html = preg_match(',^\s*text/html,', $page['entetes']['Content-Type']); |
|
| 131 | - } |
|
| 132 | - |
|
| 133 | - // Tester si on est admin et il y a des choses supplementaires a dire |
|
| 134 | - // type tableau pour y mettre des choses au besoin. |
|
| 135 | - $debug = ((_request('var_mode') == 'debug') or $tableau_des_temps) ? array(1) : array(); |
|
| 136 | - |
|
| 137 | - // affiche-t-on les boutons d'administration ? voir f_admin() |
|
| 138 | - $affiche_boutons_admin = ($html and ( |
|
| 139 | - (isset($_COOKIE['spip_admin']) and (!isset($flag_preserver) or !$flag_preserver)) |
|
| 140 | - or ($debug and include_spip('inc/autoriser') and autoriser('debug')) |
|
| 141 | - or (defined('_VAR_PREVIEW') and _VAR_PREVIEW) |
|
| 142 | - )); |
|
| 143 | - |
|
| 144 | - if ($affiche_boutons_admin) { |
|
| 145 | - include_spip('balise/formulaire_admin'); |
|
| 146 | - } |
|
| 147 | - |
|
| 148 | - |
|
| 149 | - // Execution de la page calculee |
|
| 150 | - |
|
| 151 | - // traitements sur les entetes avant envoi |
|
| 152 | - // peut servir pour le plugin de stats |
|
| 153 | - $page['entetes'] = pipeline('affichage_entetes_final' . _PIPELINE_SUFFIX, $page['entetes']); |
|
| 154 | - |
|
| 155 | - |
|
| 156 | - // eval $page et affecte $res |
|
| 157 | - include _ROOT_RESTREINT . "public/evaluer_page.php"; |
|
| 158 | - envoyer_entetes($page['entetes']); |
|
| 159 | - if ($res === false) { |
|
| 160 | - include_spip('inc/autoriser'); |
|
| 161 | - $err = _T('zbug_erreur_execution_page'); |
|
| 162 | - if (autoriser('webmestre')) { |
|
| 163 | - $err .= "\n<hr />\n" |
|
| 164 | - . highlight_string($page['codephp'], true) |
|
| 165 | - . "\n<hr />\n"; |
|
| 166 | - } |
|
| 167 | - $msg = array($err); |
|
| 168 | - erreur_squelette($msg); |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - // |
|
| 172 | - // Envoyer le resultat apres post-traitements |
|
| 173 | - // |
|
| 174 | - // (c'est ici qu'on fait var_recherche, validation, boutons d'admin, |
|
| 175 | - // cf. public/assembler.php) |
|
| 176 | - echo pipeline('affichage_final' . _PIPELINE_SUFFIX, $page['texte']); |
|
| 177 | - |
|
| 178 | - if ($lang) { |
|
| 179 | - lang_select(); |
|
| 180 | - } |
|
| 181 | - // l'affichage de la page a pu lever des erreurs (inclusion manquante) |
|
| 182 | - // il faut tester a nouveau |
|
| 183 | - $debug = ((_request('var_mode') == 'debug') or $tableau_des_temps) ? array(1) : array(); |
|
| 184 | - |
|
| 185 | - // Appel au debusqueur en cas d'erreurs ou de demande de trace |
|
| 186 | - // at last |
|
| 187 | - if ($debug) { |
|
| 188 | - // en cas d'erreur, retester l'affichage |
|
| 189 | - if ($html and ($affiche_boutons_admin or $debug)) { |
|
| 190 | - $var_mode_affiche = _request('var_mode_affiche'); |
|
| 191 | - $var_mode_objet = _request('var_mode_objet'); |
|
| 192 | - $GLOBALS['debug_objets'][$var_mode_affiche][$var_mode_objet . 'tout'] = ($var_mode_affiche == 'validation' ? $page['texte'] : ""); |
|
| 193 | - echo erreur_squelette(false); |
|
| 194 | - } |
|
| 195 | - } else { |
|
| 196 | - |
|
| 197 | - if (isset($GLOBALS['meta']['date_prochain_postdate']) |
|
| 198 | - and $GLOBALS['meta']['date_prochain_postdate'] <= time() |
|
| 199 | - ) { |
|
| 200 | - include_spip('inc/rubriques'); |
|
| 201 | - calculer_prochain_postdate(true); |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - // Effectuer une tache de fond ? |
|
| 205 | - // si _DIRECT_CRON_FORCE est present, on force l'appel |
|
| 206 | - if (defined('_DIRECT_CRON_FORCE')) { |
|
| 207 | - cron(); |
|
| 208 | - } |
|
| 209 | - |
|
| 210 | - // sauver le cache chemin si necessaire |
|
| 211 | - save_path_cache(); |
|
| 212 | - } |
|
| 29 | + $GLOBALS['_INC_PUBLIC'] = 1; |
|
| 30 | + define('_PIPELINE_SUFFIX', test_espace_prive() ? '_prive' : ''); |
|
| 31 | + |
|
| 32 | + // Faut-il initialiser SPIP ? (oui dans le cas general) |
|
| 33 | + if (!defined('_DIR_RESTREINT_ABS')) { |
|
| 34 | + if (defined('_DIR_RESTREINT') |
|
| 35 | + and @file_exists(_ROOT_RESTREINT . 'inc_version.php') |
|
| 36 | + ) { |
|
| 37 | + include_once _ROOT_RESTREINT . 'inc_version.php'; |
|
| 38 | + } else { |
|
| 39 | + die('inc_version absent ?'); |
|
| 40 | + } |
|
| 41 | + } // $fond defini dans le fichier d'appel ? |
|
| 42 | + |
|
| 43 | + else { |
|
| 44 | + if (isset($fond) and !_request('fond')) { |
|
| 45 | + } // fond demande dans l'url par page=xxxx ? |
|
| 46 | + else { |
|
| 47 | + if (isset($_GET[_SPIP_PAGE])) { |
|
| 48 | + $fond = (string)$_GET[_SPIP_PAGE]; |
|
| 49 | + |
|
| 50 | + // Securite |
|
| 51 | + if (strstr($fond, '/') |
|
| 52 | + and !( |
|
| 53 | + isset($GLOBALS['visiteur_session']) // pour eviter d'evaluer la suite pour les anonymes |
|
| 54 | + and include_spip('inc/autoriser') |
|
| 55 | + and autoriser('webmestre')) |
|
| 56 | + ) { |
|
| 57 | + include_spip('inc/minipres'); |
|
| 58 | + echo minipres(); |
|
| 59 | + exit; |
|
| 60 | + } |
|
| 61 | + // l'argument Page a priorite sur l'argument action |
|
| 62 | + // le cas se presente a cause des RewriteRule d'Apache |
|
| 63 | + // qui permettent d'ajouter un argument dans la QueryString |
|
| 64 | + // mais pas d'en retirer un en conservant les autres. |
|
| 65 | + if (isset($_GET['action']) and $_GET['action'] === $fond) { |
|
| 66 | + unset($_GET['action']); |
|
| 67 | + } |
|
| 68 | + # sinon, fond par defaut |
|
| 69 | + } else { |
|
| 70 | + // sinon fond par defaut (cf. assembler.php) |
|
| 71 | + $fond = pipeline('detecter_fond_par_defaut', ''); |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + $tableau_des_temps = array(); |
|
| 77 | + |
|
| 78 | + // Particularites de certains squelettes |
|
| 79 | + if ($fond == 'login') { |
|
| 80 | + $forcer_lang = true; |
|
| 81 | + } |
|
| 82 | + |
|
| 83 | + if (isset($forcer_lang) and $forcer_lang and ($forcer_lang !== 'non') |
|
| 84 | + and !_request('action') |
|
| 85 | + and $_SERVER['REQUEST_METHOD'] != 'POST' |
|
| 86 | + ) { |
|
| 87 | + include_spip('inc/lang'); |
|
| 88 | + verifier_lang_url(); |
|
| 89 | + } |
|
| 90 | + |
|
| 91 | + $lang = !isset($_GET['lang']) ? '' : lang_select($_GET['lang']); |
|
| 92 | + |
|
| 93 | + // Charger l'aiguilleur des traitements derogatoires |
|
| 94 | + // (action en base SQL, formulaires CVT, AJax) |
|
| 95 | + if (_request('action') or _request('var_ajax') or _request('formulaire_action')) { |
|
| 96 | + include_spip('public/aiguiller'); |
|
| 97 | + if ( |
|
| 98 | + // cas des appels actions ?action=xxx |
|
| 99 | + traiter_appels_actions() |
|
| 100 | + or |
|
| 101 | + // cas des hits ajax sur les inclusions ajax |
|
| 102 | + traiter_appels_inclusions_ajax() |
|
| 103 | + or |
|
| 104 | + // cas des formulaires charger/verifier/traiter |
|
| 105 | + traiter_formulaires_dynamiques() |
|
| 106 | + ) { |
|
| 107 | + // lancer les taches sur affichage final, comme le cron |
|
| 108 | + // mais sans rien afficher |
|
| 109 | + $GLOBALS['html'] = false; // ne rien afficher |
|
| 110 | + pipeline('affichage_final' . _PIPELINE_SUFFIX, ''); |
|
| 111 | + exit; // le hit est fini ! |
|
| 112 | + } |
|
| 113 | + } |
|
| 114 | + |
|
| 115 | + // Il y a du texte a produire, charger le metteur en page |
|
| 116 | + include_spip('public/assembler'); |
|
| 117 | + $page = assembler($fond, _request('connect')); |
|
| 118 | + |
|
| 119 | + if (isset($page['status'])) { |
|
| 120 | + include_spip('inc/headers'); |
|
| 121 | + http_status($page['status']); |
|
| 122 | + } |
|
| 123 | + |
|
| 124 | + // Content-Type ? |
|
| 125 | + if (!isset($page['entetes']['Content-Type'])) { |
|
| 126 | + $charset = isset($GLOBALS['meta']['charset']) ? $GLOBALS['meta']['charset'] : "utf-8"; |
|
| 127 | + $page['entetes']['Content-Type'] = 'text/html; charset=' . $charset; |
|
| 128 | + $html = true; |
|
| 129 | + } else { |
|
| 130 | + $html = preg_match(',^\s*text/html,', $page['entetes']['Content-Type']); |
|
| 131 | + } |
|
| 132 | + |
|
| 133 | + // Tester si on est admin et il y a des choses supplementaires a dire |
|
| 134 | + // type tableau pour y mettre des choses au besoin. |
|
| 135 | + $debug = ((_request('var_mode') == 'debug') or $tableau_des_temps) ? array(1) : array(); |
|
| 136 | + |
|
| 137 | + // affiche-t-on les boutons d'administration ? voir f_admin() |
|
| 138 | + $affiche_boutons_admin = ($html and ( |
|
| 139 | + (isset($_COOKIE['spip_admin']) and (!isset($flag_preserver) or !$flag_preserver)) |
|
| 140 | + or ($debug and include_spip('inc/autoriser') and autoriser('debug')) |
|
| 141 | + or (defined('_VAR_PREVIEW') and _VAR_PREVIEW) |
|
| 142 | + )); |
|
| 143 | + |
|
| 144 | + if ($affiche_boutons_admin) { |
|
| 145 | + include_spip('balise/formulaire_admin'); |
|
| 146 | + } |
|
| 147 | + |
|
| 148 | + |
|
| 149 | + // Execution de la page calculee |
|
| 150 | + |
|
| 151 | + // traitements sur les entetes avant envoi |
|
| 152 | + // peut servir pour le plugin de stats |
|
| 153 | + $page['entetes'] = pipeline('affichage_entetes_final' . _PIPELINE_SUFFIX, $page['entetes']); |
|
| 154 | + |
|
| 155 | + |
|
| 156 | + // eval $page et affecte $res |
|
| 157 | + include _ROOT_RESTREINT . "public/evaluer_page.php"; |
|
| 158 | + envoyer_entetes($page['entetes']); |
|
| 159 | + if ($res === false) { |
|
| 160 | + include_spip('inc/autoriser'); |
|
| 161 | + $err = _T('zbug_erreur_execution_page'); |
|
| 162 | + if (autoriser('webmestre')) { |
|
| 163 | + $err .= "\n<hr />\n" |
|
| 164 | + . highlight_string($page['codephp'], true) |
|
| 165 | + . "\n<hr />\n"; |
|
| 166 | + } |
|
| 167 | + $msg = array($err); |
|
| 168 | + erreur_squelette($msg); |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + // |
|
| 172 | + // Envoyer le resultat apres post-traitements |
|
| 173 | + // |
|
| 174 | + // (c'est ici qu'on fait var_recherche, validation, boutons d'admin, |
|
| 175 | + // cf. public/assembler.php) |
|
| 176 | + echo pipeline('affichage_final' . _PIPELINE_SUFFIX, $page['texte']); |
|
| 177 | + |
|
| 178 | + if ($lang) { |
|
| 179 | + lang_select(); |
|
| 180 | + } |
|
| 181 | + // l'affichage de la page a pu lever des erreurs (inclusion manquante) |
|
| 182 | + // il faut tester a nouveau |
|
| 183 | + $debug = ((_request('var_mode') == 'debug') or $tableau_des_temps) ? array(1) : array(); |
|
| 184 | + |
|
| 185 | + // Appel au debusqueur en cas d'erreurs ou de demande de trace |
|
| 186 | + // at last |
|
| 187 | + if ($debug) { |
|
| 188 | + // en cas d'erreur, retester l'affichage |
|
| 189 | + if ($html and ($affiche_boutons_admin or $debug)) { |
|
| 190 | + $var_mode_affiche = _request('var_mode_affiche'); |
|
| 191 | + $var_mode_objet = _request('var_mode_objet'); |
|
| 192 | + $GLOBALS['debug_objets'][$var_mode_affiche][$var_mode_objet . 'tout'] = ($var_mode_affiche == 'validation' ? $page['texte'] : ""); |
|
| 193 | + echo erreur_squelette(false); |
|
| 194 | + } |
|
| 195 | + } else { |
|
| 196 | + |
|
| 197 | + if (isset($GLOBALS['meta']['date_prochain_postdate']) |
|
| 198 | + and $GLOBALS['meta']['date_prochain_postdate'] <= time() |
|
| 199 | + ) { |
|
| 200 | + include_spip('inc/rubriques'); |
|
| 201 | + calculer_prochain_postdate(true); |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + // Effectuer une tache de fond ? |
|
| 205 | + // si _DIRECT_CRON_FORCE est present, on force l'appel |
|
| 206 | + if (defined('_DIRECT_CRON_FORCE')) { |
|
| 207 | + cron(); |
|
| 208 | + } |
|
| 209 | + |
|
| 210 | + // sauver le cache chemin si necessaire |
|
| 211 | + save_path_cache(); |
|
| 212 | + } |
|
| 213 | 213 | } |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | // Faut-il initialiser SPIP ? (oui dans le cas general) |
| 33 | 33 | if (!defined('_DIR_RESTREINT_ABS')) { |
| 34 | 34 | if (defined('_DIR_RESTREINT') |
| 35 | - and @file_exists(_ROOT_RESTREINT . 'inc_version.php') |
|
| 35 | + and @file_exists(_ROOT_RESTREINT.'inc_version.php') |
|
| 36 | 36 | ) { |
| 37 | - include_once _ROOT_RESTREINT . 'inc_version.php'; |
|
| 37 | + include_once _ROOT_RESTREINT.'inc_version.php'; |
|
| 38 | 38 | } else { |
| 39 | 39 | die('inc_version absent ?'); |
| 40 | 40 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | } // fond demande dans l'url par page=xxxx ? |
| 46 | 46 | else { |
| 47 | 47 | if (isset($_GET[_SPIP_PAGE])) { |
| 48 | - $fond = (string)$_GET[_SPIP_PAGE]; |
|
| 48 | + $fond = (string) $_GET[_SPIP_PAGE]; |
|
| 49 | 49 | |
| 50 | 50 | // Securite |
| 51 | 51 | if (strstr($fond, '/') |
@@ -107,7 +107,7 @@ discard block |
||
| 107 | 107 | // lancer les taches sur affichage final, comme le cron |
| 108 | 108 | // mais sans rien afficher |
| 109 | 109 | $GLOBALS['html'] = false; // ne rien afficher |
| 110 | - pipeline('affichage_final' . _PIPELINE_SUFFIX, ''); |
|
| 110 | + pipeline('affichage_final'._PIPELINE_SUFFIX, ''); |
|
| 111 | 111 | exit; // le hit est fini ! |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | // Content-Type ? |
| 125 | 125 | if (!isset($page['entetes']['Content-Type'])) { |
| 126 | 126 | $charset = isset($GLOBALS['meta']['charset']) ? $GLOBALS['meta']['charset'] : "utf-8"; |
| 127 | - $page['entetes']['Content-Type'] = 'text/html; charset=' . $charset; |
|
| 127 | + $page['entetes']['Content-Type'] = 'text/html; charset='.$charset; |
|
| 128 | 128 | $html = true; |
| 129 | 129 | } else { |
| 130 | 130 | $html = preg_match(',^\s*text/html,', $page['entetes']['Content-Type']); |
@@ -150,11 +150,11 @@ discard block |
||
| 150 | 150 | |
| 151 | 151 | // traitements sur les entetes avant envoi |
| 152 | 152 | // peut servir pour le plugin de stats |
| 153 | - $page['entetes'] = pipeline('affichage_entetes_final' . _PIPELINE_SUFFIX, $page['entetes']); |
|
| 153 | + $page['entetes'] = pipeline('affichage_entetes_final'._PIPELINE_SUFFIX, $page['entetes']); |
|
| 154 | 154 | |
| 155 | 155 | |
| 156 | 156 | // eval $page et affecte $res |
| 157 | - include _ROOT_RESTREINT . "public/evaluer_page.php"; |
|
| 157 | + include _ROOT_RESTREINT."public/evaluer_page.php"; |
|
| 158 | 158 | envoyer_entetes($page['entetes']); |
| 159 | 159 | if ($res === false) { |
| 160 | 160 | include_spip('inc/autoriser'); |
@@ -173,7 +173,7 @@ discard block |
||
| 173 | 173 | // |
| 174 | 174 | // (c'est ici qu'on fait var_recherche, validation, boutons d'admin, |
| 175 | 175 | // cf. public/assembler.php) |
| 176 | - echo pipeline('affichage_final' . _PIPELINE_SUFFIX, $page['texte']); |
|
| 176 | + echo pipeline('affichage_final'._PIPELINE_SUFFIX, $page['texte']); |
|
| 177 | 177 | |
| 178 | 178 | if ($lang) { |
| 179 | 179 | lang_select(); |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | if ($html and ($affiche_boutons_admin or $debug)) { |
| 190 | 190 | $var_mode_affiche = _request('var_mode_affiche'); |
| 191 | 191 | $var_mode_objet = _request('var_mode_objet'); |
| 192 | - $GLOBALS['debug_objets'][$var_mode_affiche][$var_mode_objet . 'tout'] = ($var_mode_affiche == 'validation' ? $page['texte'] : ""); |
|
| 192 | + $GLOBALS['debug_objets'][$var_mode_affiche][$var_mode_objet.'tout'] = ($var_mode_affiche == 'validation' ? $page['texte'] : ""); |
|
| 193 | 193 | echo erreur_squelette(false); |
| 194 | 194 | } |
| 195 | 195 | } else { |
@@ -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 | /** |
@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | * @return int |
| 28 | 28 | */ |
| 29 | 29 | function genie_mise_a_jour_dist($t) { |
| 30 | - include_spip('inc/meta'); |
|
| 31 | - $maj = info_maj('spip', 'SPIP', $GLOBALS['spip_version_branche']); |
|
| 32 | - ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche'] . "|$maj") : "", 'non'); |
|
| 30 | + include_spip('inc/meta'); |
|
| 31 | + $maj = info_maj('spip', 'SPIP', $GLOBALS['spip_version_branche']); |
|
| 32 | + ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche'] . "|$maj") : "", 'non'); |
|
| 33 | 33 | |
| 34 | - mise_a_jour_ecran_securite(); |
|
| 34 | + mise_a_jour_ecran_securite(); |
|
| 35 | 35 | |
| 36 | - spip_log("Verification version SPIP : " . ($maj ? $maj : "version a jour"), "verifie_maj"); |
|
| 36 | + spip_log("Verification version SPIP : " . ($maj ? $maj : "version a jour"), "verifie_maj"); |
|
| 37 | 37 | |
| 38 | - return 1; |
|
| 38 | + return 1; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | // TODO : fournir une URL sur spip.net pour maitriser la diffusion d'une nouvelle version de l'ecran via l'update auto |
@@ -52,45 +52,45 @@ discard block |
||
| 52 | 52 | * ou de ne repondre une 304 que si le md5 est bon |
| 53 | 53 | */ |
| 54 | 54 | function mise_a_jour_ecran_securite() { |
| 55 | - // TODO : url https avec verification du certificat |
|
| 56 | - return; |
|
| 57 | - |
|
| 58 | - // si l'ecran n'est pas deja present ou pas updatable, sortir |
|
| 59 | - if (!_URL_ECRAN_SECURITE |
|
| 60 | - or !file_exists($filename = _DIR_ETC . "ecran_securite.php") |
|
| 61 | - or !is_writable($filename) |
|
| 62 | - or !$last_modified = filemtime($filename) |
|
| 63 | - or !$md5 = md5_file($filename) |
|
| 64 | - ) { |
|
| 65 | - return false; |
|
| 66 | - } |
|
| 67 | - |
|
| 68 | - include_spip('inc/distant'); |
|
| 69 | - $tmp_file = _DIR_TMP . "ecran_securite.php"; |
|
| 70 | - $url = parametre_url(_URL_ECRAN_SECURITE, "md5", $md5); |
|
| 71 | - $url = parametre_url($url, "vspip", $GLOBALS['spip_version_branche']); |
|
| 72 | - $res = recuperer_url($url, array( |
|
| 73 | - 'if_modified_since' => $last_modified, |
|
| 74 | - 'file' => $tmp_file |
|
| 75 | - )); |
|
| 76 | - |
|
| 77 | - // si il y a une version plus recente que l'on a recu correctement |
|
| 78 | - if ($res['status'] == 200 |
|
| 79 | - and $res['length'] |
|
| 80 | - and $tmp_file = $res['file'] |
|
| 81 | - ) { |
|
| 82 | - |
|
| 83 | - if ($md5 !== md5_file($tmp_file)) { |
|
| 84 | - // on essaye de l'inclure pour verifier que ca ne fait pas erreur fatale |
|
| 85 | - include_once $tmp_file; |
|
| 86 | - // ok, on le copie a la place de l'ecran existant |
|
| 87 | - // en backupant l'ecran avant, au cas ou |
|
| 88 | - @copy($filename, $filename . "-bck-" . date('Y-m-d-His', $last_modified)); |
|
| 89 | - @rename($tmp_file, $filename); |
|
| 90 | - } else { |
|
| 91 | - @unlink($tmp_file); |
|
| 92 | - } |
|
| 93 | - } |
|
| 55 | + // TODO : url https avec verification du certificat |
|
| 56 | + return; |
|
| 57 | + |
|
| 58 | + // si l'ecran n'est pas deja present ou pas updatable, sortir |
|
| 59 | + if (!_URL_ECRAN_SECURITE |
|
| 60 | + or !file_exists($filename = _DIR_ETC . "ecran_securite.php") |
|
| 61 | + or !is_writable($filename) |
|
| 62 | + or !$last_modified = filemtime($filename) |
|
| 63 | + or !$md5 = md5_file($filename) |
|
| 64 | + ) { |
|
| 65 | + return false; |
|
| 66 | + } |
|
| 67 | + |
|
| 68 | + include_spip('inc/distant'); |
|
| 69 | + $tmp_file = _DIR_TMP . "ecran_securite.php"; |
|
| 70 | + $url = parametre_url(_URL_ECRAN_SECURITE, "md5", $md5); |
|
| 71 | + $url = parametre_url($url, "vspip", $GLOBALS['spip_version_branche']); |
|
| 72 | + $res = recuperer_url($url, array( |
|
| 73 | + 'if_modified_since' => $last_modified, |
|
| 74 | + 'file' => $tmp_file |
|
| 75 | + )); |
|
| 76 | + |
|
| 77 | + // si il y a une version plus recente que l'on a recu correctement |
|
| 78 | + if ($res['status'] == 200 |
|
| 79 | + and $res['length'] |
|
| 80 | + and $tmp_file = $res['file'] |
|
| 81 | + ) { |
|
| 82 | + |
|
| 83 | + if ($md5 !== md5_file($tmp_file)) { |
|
| 84 | + // on essaye de l'inclure pour verifier que ca ne fait pas erreur fatale |
|
| 85 | + include_once $tmp_file; |
|
| 86 | + // ok, on le copie a la place de l'ecran existant |
|
| 87 | + // en backupant l'ecran avant, au cas ou |
|
| 88 | + @copy($filename, $filename . "-bck-" . date('Y-m-d-His', $last_modified)); |
|
| 89 | + @rename($tmp_file, $filename); |
|
| 90 | + } else { |
|
| 91 | + @unlink($tmp_file); |
|
| 92 | + } |
|
| 93 | + } |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | /** |
@@ -108,52 +108,52 @@ discard block |
||
| 108 | 108 | * @return string |
| 109 | 109 | */ |
| 110 | 110 | function info_maj($dir, $file, $version) { |
| 111 | - include_spip('inc/plugin'); |
|
| 112 | - |
|
| 113 | - list($maj, $min, $rev) = preg_split('/\D+/', $version); |
|
| 114 | - |
|
| 115 | - $nom = _DIR_CACHE_XML . _VERSIONS_LISTE; |
|
| 116 | - $page = !file_exists($nom) ? '' : file_get_contents($nom); |
|
| 117 | - $page = info_maj_cache($nom, $dir, $page); |
|
| 118 | - |
|
| 119 | - // reperer toutes les versions de numero majeur superieur ou egal |
|
| 120 | - // (a revoir quand on arrivera a SPIP V10 ...) |
|
| 121 | - $p = substr("0123456789", intval($maj)); |
|
| 122 | - $p = ',/' . $file . '\D+([' . $p . ']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i'; |
|
| 123 | - preg_match_all($p, $page, $m, PREG_SET_ORDER); |
|
| 124 | - $page = $page_majeure = ''; |
|
| 125 | - |
|
| 126 | - // branche en cours d'utilisation |
|
| 127 | - $branche = implode('.', array_slice(explode('.', $version, 3), 0, 2)); |
|
| 128 | - |
|
| 129 | - foreach ($m as $v) { |
|
| 130 | - $v = array_pad($v, 5, 0); |
|
| 131 | - list(, $maj2, $min2, , $rev2) = $v; |
|
| 132 | - $branche_maj = $maj2 . '.' . $min2; |
|
| 133 | - $version_maj = $maj2 . '.' . $min2 . '.' . $rev2; |
|
| 134 | - // d'abord les mises à jour de la même branche |
|
| 135 | - if ((spip_version_compare($version, $version_maj, '<')) |
|
| 136 | - and (spip_version_compare($page, $version_maj, '<')) |
|
| 137 | - and spip_version_compare($branche, $branche_maj, '=') |
|
| 138 | - ) { |
|
| 139 | - $page = $version_maj; |
|
| 140 | - } |
|
| 141 | - // puis les mises à jours majeures |
|
| 142 | - if ((spip_version_compare($version, $version_maj, '<')) |
|
| 143 | - and (spip_version_compare($page, $version_maj, '<')) |
|
| 144 | - and spip_version_compare($branche, $branche_maj, '<') |
|
| 145 | - ) { |
|
| 146 | - $page_majeure = $version_maj; |
|
| 147 | - } |
|
| 148 | - } |
|
| 149 | - if (!$page and !$page_majeure) { |
|
| 150 | - return ""; |
|
| 151 | - } |
|
| 152 | - |
|
| 153 | - $message = $page ? _T('nouvelle_version_spip', array('version' => $page)) . ($page_majeure ? ' | ' : '') : ''; |
|
| 154 | - $message .= $page_majeure ? _T('nouvelle_version_spip_majeure', array('version' => $page_majeure)) : ''; |
|
| 155 | - |
|
| 156 | - return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>" . $message . '</a>'; |
|
| 111 | + include_spip('inc/plugin'); |
|
| 112 | + |
|
| 113 | + list($maj, $min, $rev) = preg_split('/\D+/', $version); |
|
| 114 | + |
|
| 115 | + $nom = _DIR_CACHE_XML . _VERSIONS_LISTE; |
|
| 116 | + $page = !file_exists($nom) ? '' : file_get_contents($nom); |
|
| 117 | + $page = info_maj_cache($nom, $dir, $page); |
|
| 118 | + |
|
| 119 | + // reperer toutes les versions de numero majeur superieur ou egal |
|
| 120 | + // (a revoir quand on arrivera a SPIP V10 ...) |
|
| 121 | + $p = substr("0123456789", intval($maj)); |
|
| 122 | + $p = ',/' . $file . '\D+([' . $p . ']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i'; |
|
| 123 | + preg_match_all($p, $page, $m, PREG_SET_ORDER); |
|
| 124 | + $page = $page_majeure = ''; |
|
| 125 | + |
|
| 126 | + // branche en cours d'utilisation |
|
| 127 | + $branche = implode('.', array_slice(explode('.', $version, 3), 0, 2)); |
|
| 128 | + |
|
| 129 | + foreach ($m as $v) { |
|
| 130 | + $v = array_pad($v, 5, 0); |
|
| 131 | + list(, $maj2, $min2, , $rev2) = $v; |
|
| 132 | + $branche_maj = $maj2 . '.' . $min2; |
|
| 133 | + $version_maj = $maj2 . '.' . $min2 . '.' . $rev2; |
|
| 134 | + // d'abord les mises à jour de la même branche |
|
| 135 | + if ((spip_version_compare($version, $version_maj, '<')) |
|
| 136 | + and (spip_version_compare($page, $version_maj, '<')) |
|
| 137 | + and spip_version_compare($branche, $branche_maj, '=') |
|
| 138 | + ) { |
|
| 139 | + $page = $version_maj; |
|
| 140 | + } |
|
| 141 | + // puis les mises à jours majeures |
|
| 142 | + if ((spip_version_compare($version, $version_maj, '<')) |
|
| 143 | + and (spip_version_compare($page, $version_maj, '<')) |
|
| 144 | + and spip_version_compare($branche, $branche_maj, '<') |
|
| 145 | + ) { |
|
| 146 | + $page_majeure = $version_maj; |
|
| 147 | + } |
|
| 148 | + } |
|
| 149 | + if (!$page and !$page_majeure) { |
|
| 150 | + return ""; |
|
| 151 | + } |
|
| 152 | + |
|
| 153 | + $message = $page ? _T('nouvelle_version_spip', array('version' => $page)) . ($page_majeure ? ' | ' : '') : ''; |
|
| 154 | + $message .= $page_majeure ? _T('nouvelle_version_spip_majeure', array('version' => $page_majeure)) : ''; |
|
| 155 | + |
|
| 156 | + return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>" . $message . '</a>'; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -174,25 +174,25 @@ discard block |
||
| 174 | 174 | * Contenu du fichier de cache de l'info de maj de SPIP. |
| 175 | 175 | */ |
| 176 | 176 | function info_maj_cache($nom, $dir, $page = '') { |
| 177 | - include_spip('inc/acces'); |
|
| 178 | - $alea_ephemere = charger_aleas(); |
|
| 179 | - $re = '<archives id="a' . $alea_ephemere . '">'; |
|
| 180 | - if (preg_match("/$re/", $page)) { |
|
| 181 | - return $page; |
|
| 182 | - } |
|
| 183 | - |
|
| 184 | - $url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE; |
|
| 185 | - $a = file_exists($nom) ? filemtime($nom) : ''; |
|
| 186 | - include_spip('inc/distant'); |
|
| 187 | - $res = recuperer_url_cache($url, array('if_modified_since' => $a)); |
|
| 188 | - // Si rien de neuf (ou inaccessible), garder l'ancienne |
|
| 189 | - if ($res) { |
|
| 190 | - $page = $res['page'] ? $res['page'] : $page; |
|
| 191 | - } |
|
| 192 | - // Placer l'indicateur de fraicheur |
|
| 193 | - $page = preg_replace('/^<archives.*?>/', $re, $page); |
|
| 194 | - sous_repertoire(_DIR_CACHE_XML); |
|
| 195 | - ecrire_fichier($nom, $page); |
|
| 196 | - |
|
| 197 | - return $page; |
|
| 177 | + include_spip('inc/acces'); |
|
| 178 | + $alea_ephemere = charger_aleas(); |
|
| 179 | + $re = '<archives id="a' . $alea_ephemere . '">'; |
|
| 180 | + if (preg_match("/$re/", $page)) { |
|
| 181 | + return $page; |
|
| 182 | + } |
|
| 183 | + |
|
| 184 | + $url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE; |
|
| 185 | + $a = file_exists($nom) ? filemtime($nom) : ''; |
|
| 186 | + include_spip('inc/distant'); |
|
| 187 | + $res = recuperer_url_cache($url, array('if_modified_since' => $a)); |
|
| 188 | + // Si rien de neuf (ou inaccessible), garder l'ancienne |
|
| 189 | + if ($res) { |
|
| 190 | + $page = $res['page'] ? $res['page'] : $page; |
|
| 191 | + } |
|
| 192 | + // Placer l'indicateur de fraicheur |
|
| 193 | + $page = preg_replace('/^<archives.*?>/', $re, $page); |
|
| 194 | + sous_repertoire(_DIR_CACHE_XML); |
|
| 195 | + ecrire_fichier($nom, $page); |
|
| 196 | + |
|
| 197 | + return $page; |
|
| 198 | 198 | } |
@@ -29,11 +29,11 @@ discard block |
||
| 29 | 29 | function genie_mise_a_jour_dist($t) { |
| 30 | 30 | include_spip('inc/meta'); |
| 31 | 31 | $maj = info_maj('spip', 'SPIP', $GLOBALS['spip_version_branche']); |
| 32 | - ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche'] . "|$maj") : "", 'non'); |
|
| 32 | + ecrire_meta('info_maj_spip', $maj ? ($GLOBALS['spip_version_branche']."|$maj") : "", 'non'); |
|
| 33 | 33 | |
| 34 | 34 | mise_a_jour_ecran_securite(); |
| 35 | 35 | |
| 36 | - spip_log("Verification version SPIP : " . ($maj ? $maj : "version a jour"), "verifie_maj"); |
|
| 36 | + spip_log("Verification version SPIP : ".($maj ? $maj : "version a jour"), "verifie_maj"); |
|
| 37 | 37 | |
| 38 | 38 | return 1; |
| 39 | 39 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | // si l'ecran n'est pas deja present ou pas updatable, sortir |
| 59 | 59 | if (!_URL_ECRAN_SECURITE |
| 60 | - or !file_exists($filename = _DIR_ETC . "ecran_securite.php") |
|
| 60 | + or !file_exists($filename = _DIR_ETC."ecran_securite.php") |
|
| 61 | 61 | or !is_writable($filename) |
| 62 | 62 | or !$last_modified = filemtime($filename) |
| 63 | 63 | or !$md5 = md5_file($filename) |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | include_spip('inc/distant'); |
| 69 | - $tmp_file = _DIR_TMP . "ecran_securite.php"; |
|
| 69 | + $tmp_file = _DIR_TMP."ecran_securite.php"; |
|
| 70 | 70 | $url = parametre_url(_URL_ECRAN_SECURITE, "md5", $md5); |
| 71 | 71 | $url = parametre_url($url, "vspip", $GLOBALS['spip_version_branche']); |
| 72 | 72 | $res = recuperer_url($url, array( |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | include_once $tmp_file; |
| 86 | 86 | // ok, on le copie a la place de l'ecran existant |
| 87 | 87 | // en backupant l'ecran avant, au cas ou |
| 88 | - @copy($filename, $filename . "-bck-" . date('Y-m-d-His', $last_modified)); |
|
| 88 | + @copy($filename, $filename."-bck-".date('Y-m-d-His', $last_modified)); |
|
| 89 | 89 | @rename($tmp_file, $filename); |
| 90 | 90 | } else { |
| 91 | 91 | @unlink($tmp_file); |
@@ -112,14 +112,14 @@ discard block |
||
| 112 | 112 | |
| 113 | 113 | list($maj, $min, $rev) = preg_split('/\D+/', $version); |
| 114 | 114 | |
| 115 | - $nom = _DIR_CACHE_XML . _VERSIONS_LISTE; |
|
| 115 | + $nom = _DIR_CACHE_XML._VERSIONS_LISTE; |
|
| 116 | 116 | $page = !file_exists($nom) ? '' : file_get_contents($nom); |
| 117 | 117 | $page = info_maj_cache($nom, $dir, $page); |
| 118 | 118 | |
| 119 | 119 | // reperer toutes les versions de numero majeur superieur ou egal |
| 120 | 120 | // (a revoir quand on arrivera a SPIP V10 ...) |
| 121 | 121 | $p = substr("0123456789", intval($maj)); |
| 122 | - $p = ',/' . $file . '\D+([' . $p . ']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i'; |
|
| 122 | + $p = ',/'.$file.'\D+(['.$p.']+)\D+(\d+)(\D+(\d+))?.*?[.]zip",i'; |
|
| 123 | 123 | preg_match_all($p, $page, $m, PREG_SET_ORDER); |
| 124 | 124 | $page = $page_majeure = ''; |
| 125 | 125 | |
@@ -128,9 +128,9 @@ discard block |
||
| 128 | 128 | |
| 129 | 129 | foreach ($m as $v) { |
| 130 | 130 | $v = array_pad($v, 5, 0); |
| 131 | - list(, $maj2, $min2, , $rev2) = $v; |
|
| 132 | - $branche_maj = $maj2 . '.' . $min2; |
|
| 133 | - $version_maj = $maj2 . '.' . $min2 . '.' . $rev2; |
|
| 131 | + list(, $maj2, $min2,, $rev2) = $v; |
|
| 132 | + $branche_maj = $maj2.'.'.$min2; |
|
| 133 | + $version_maj = $maj2.'.'.$min2.'.'.$rev2; |
|
| 134 | 134 | // d'abord les mises à jour de la même branche |
| 135 | 135 | if ((spip_version_compare($version, $version_maj, '<')) |
| 136 | 136 | and (spip_version_compare($page, $version_maj, '<')) |
@@ -150,10 +150,10 @@ discard block |
||
| 150 | 150 | return ""; |
| 151 | 151 | } |
| 152 | 152 | |
| 153 | - $message = $page ? _T('nouvelle_version_spip', array('version' => $page)) . ($page_majeure ? ' | ' : '') : ''; |
|
| 153 | + $message = $page ? _T('nouvelle_version_spip', array('version' => $page)).($page_majeure ? ' | ' : '') : ''; |
|
| 154 | 154 | $message .= $page_majeure ? _T('nouvelle_version_spip_majeure', array('version' => $page_majeure)) : ''; |
| 155 | 155 | |
| 156 | - return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>" . $message . '</a>'; |
|
| 156 | + return "<a class='info_maj_spip' href='https://www.spip.net/fr_update' title='$page'>".$message.'</a>'; |
|
| 157 | 157 | } |
| 158 | 158 | |
| 159 | 159 | /** |
@@ -176,12 +176,12 @@ discard block |
||
| 176 | 176 | function info_maj_cache($nom, $dir, $page = '') { |
| 177 | 177 | include_spip('inc/acces'); |
| 178 | 178 | $alea_ephemere = charger_aleas(); |
| 179 | - $re = '<archives id="a' . $alea_ephemere . '">'; |
|
| 179 | + $re = '<archives id="a'.$alea_ephemere.'">'; |
|
| 180 | 180 | if (preg_match("/$re/", $page)) { |
| 181 | 181 | return $page; |
| 182 | 182 | } |
| 183 | 183 | |
| 184 | - $url = _VERSIONS_SERVEUR . $dir . '/' . _VERSIONS_LISTE; |
|
| 184 | + $url = _VERSIONS_SERVEUR.$dir.'/'._VERSIONS_LISTE; |
|
| 185 | 185 | $a = file_exists($nom) ? filemtime($nom) : ''; |
| 186 | 186 | include_spip('inc/distant'); |
| 187 | 187 | $res = recuperer_url_cache($url, array('if_modified_since' => $a)); |
@@ -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,32 +32,32 @@ discard block |
||
| 32 | 32 | * @return int |
| 33 | 33 | */ |
| 34 | 34 | function genie_mail_dist($t) { |
| 35 | - $adresse_neuf = $GLOBALS['meta']['adresse_neuf']; |
|
| 36 | - $jours_neuf = $GLOBALS['meta']['jours_neuf']; |
|
| 37 | - |
|
| 38 | - $now = time(); |
|
| 39 | - if (!isset($GLOBALS['meta']['dernier_envoi_neuf'])) { |
|
| 40 | - ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now - (3600 * 24 * $jours_neuf))); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - $page = recuperer_fond('nouveautes', |
|
| 44 | - array('date' => $GLOBALS['meta']['dernier_envoi_neuf'], 'jours_neuf' => $jours_neuf), array('raw' => true)); |
|
| 45 | - |
|
| 46 | - if (strlen(trim($page['texte']))) { |
|
| 47 | - // recuperer les entetes envoyes par #HTTP_HEADER |
|
| 48 | - $headers = ""; |
|
| 49 | - if (isset($page['entetes']) and count($page['entetes'])) { |
|
| 50 | - foreach ($page['entetes'] as $k => $v) { |
|
| 51 | - $headers .= (strlen($v) ? "$k: $v" : $k) . "\n"; |
|
| 52 | - } |
|
| 53 | - } |
|
| 54 | - |
|
| 55 | - include_spip("inc/notifications"); |
|
| 56 | - notifications_envoyer_mails($adresse_neuf, $page['texte'], "", "", $headers); |
|
| 57 | - ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now)); |
|
| 58 | - } else { |
|
| 59 | - spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours"); |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - return 1; |
|
| 35 | + $adresse_neuf = $GLOBALS['meta']['adresse_neuf']; |
|
| 36 | + $jours_neuf = $GLOBALS['meta']['jours_neuf']; |
|
| 37 | + |
|
| 38 | + $now = time(); |
|
| 39 | + if (!isset($GLOBALS['meta']['dernier_envoi_neuf'])) { |
|
| 40 | + ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now - (3600 * 24 * $jours_neuf))); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + $page = recuperer_fond('nouveautes', |
|
| 44 | + array('date' => $GLOBALS['meta']['dernier_envoi_neuf'], 'jours_neuf' => $jours_neuf), array('raw' => true)); |
|
| 45 | + |
|
| 46 | + if (strlen(trim($page['texte']))) { |
|
| 47 | + // recuperer les entetes envoyes par #HTTP_HEADER |
|
| 48 | + $headers = ""; |
|
| 49 | + if (isset($page['entetes']) and count($page['entetes'])) { |
|
| 50 | + foreach ($page['entetes'] as $k => $v) { |
|
| 51 | + $headers .= (strlen($v) ? "$k: $v" : $k) . "\n"; |
|
| 52 | + } |
|
| 53 | + } |
|
| 54 | + |
|
| 55 | + include_spip("inc/notifications"); |
|
| 56 | + notifications_envoyer_mails($adresse_neuf, $page['texte'], "", "", $headers); |
|
| 57 | + ecrire_meta('dernier_envoi_neuf', date('Y-m-d H:i:s', $now)); |
|
| 58 | + } else { |
|
| 59 | + spip_log("mail nouveautes : rien de neuf depuis $jours_neuf jours"); |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + return 1; |
|
| 63 | 63 | } |
@@ -48,7 +48,7 @@ |
||
| 48 | 48 | $headers = ""; |
| 49 | 49 | if (isset($page['entetes']) and count($page['entetes'])) { |
| 50 | 50 | foreach ($page['entetes'] as $k => $v) { |
| 51 | - $headers .= (strlen($v) ? "$k: $v" : $k) . "\n"; |
|
| 51 | + $headers .= (strlen($v) ? "$k: $v" : $k)."\n"; |
|
| 52 | 52 | } |
| 53 | 53 | } |
| 54 | 54 | |
@@ -11,74 +11,74 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // Correction typographique francaise |
| 18 | 18 | |
| 19 | 19 | function typographie_fr_dist($letexte) { |
| 20 | 20 | |
| 21 | - static $trans; |
|
| 21 | + static $trans; |
|
| 22 | 22 | |
| 23 | - // Nettoyer 160 = nbsp ; 187 = raquo ; 171 = laquo ; 176 = deg ; |
|
| 24 | - // 147 = ldquo; 148 = rdquo; ' = zouli apostrophe |
|
| 25 | - if (!$trans) { |
|
| 26 | - $trans = array( |
|
| 27 | - "'" => '’', |
|
| 28 | - ' ' => '~', |
|
| 29 | - '»' => '»', |
|
| 30 | - '«' => '«', |
|
| 31 | - '”' => '”', |
|
| 32 | - '“' => '“', |
|
| 33 | - '°' => '°' |
|
| 34 | - ); |
|
| 35 | - $chars = array(160 => '~', 187 => '»', 171 => '«', 148 => '”', 147 => '“', 176 => '°'); |
|
| 36 | - $chars_trans = array_keys($chars); |
|
| 37 | - $chars = array_values($chars); |
|
| 38 | - $chars_trans = implode(' ', array_map('chr', $chars_trans)); |
|
| 39 | - $chars_trans = unicode2charset(charset2unicode($chars_trans, 'iso-8859-1', 'forcer')); |
|
| 40 | - $chars_trans = explode(' ', $chars_trans); |
|
| 41 | - foreach ($chars as $k => $r) { |
|
| 42 | - $trans[$chars_trans[$k]] = $r; |
|
| 43 | - } |
|
| 44 | - } |
|
| 23 | + // Nettoyer 160 = nbsp ; 187 = raquo ; 171 = laquo ; 176 = deg ; |
|
| 24 | + // 147 = ldquo; 148 = rdquo; ' = zouli apostrophe |
|
| 25 | + if (!$trans) { |
|
| 26 | + $trans = array( |
|
| 27 | + "'" => '’', |
|
| 28 | + ' ' => '~', |
|
| 29 | + '»' => '»', |
|
| 30 | + '«' => '«', |
|
| 31 | + '”' => '”', |
|
| 32 | + '“' => '“', |
|
| 33 | + '°' => '°' |
|
| 34 | + ); |
|
| 35 | + $chars = array(160 => '~', 187 => '»', 171 => '«', 148 => '”', 147 => '“', 176 => '°'); |
|
| 36 | + $chars_trans = array_keys($chars); |
|
| 37 | + $chars = array_values($chars); |
|
| 38 | + $chars_trans = implode(' ', array_map('chr', $chars_trans)); |
|
| 39 | + $chars_trans = unicode2charset(charset2unicode($chars_trans, 'iso-8859-1', 'forcer')); |
|
| 40 | + $chars_trans = explode(' ', $chars_trans); |
|
| 41 | + foreach ($chars as $k => $r) { |
|
| 42 | + $trans[$chars_trans[$k]] = $r; |
|
| 43 | + } |
|
| 44 | + } |
|
| 45 | 45 | |
| 46 | - $letexte = strtr($letexte, $trans); |
|
| 46 | + $letexte = strtr($letexte, $trans); |
|
| 47 | 47 | |
| 48 | - $cherche1 = array( |
|
| 49 | - /* 1 */ |
|
| 50 | - '/((?:^|[^\#0-9a-zA-Z\&])[\#0-9a-zA-Z]*)\;/S', |
|
| 51 | - /* 2 */ |
|
| 52 | - '/»| --?,|(?::(?!:)| %)(?:\W|$)/S', |
|
| 53 | - /* 3 */ |
|
| 54 | - '/([^[<(!?.])([!?][!?\.]*)/iS', |
|
| 55 | - /* 4 */ |
|
| 56 | - '/«|(?:M(?:M?\.|mes?|r\.?)|[MnN]°) /S' |
|
| 57 | - ); |
|
| 58 | - $remplace1 = array( |
|
| 59 | - /* 1 */ |
|
| 60 | - '\1~;', |
|
| 61 | - /* 2 */ |
|
| 62 | - '~\0', |
|
| 63 | - /* 3 */ |
|
| 64 | - '\1~\2', |
|
| 65 | - /* 4 */ |
|
| 66 | - '\0~' |
|
| 67 | - ); |
|
| 68 | - $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 69 | - $letexte = preg_replace('/ *~+ */S', '~', $letexte); |
|
| 48 | + $cherche1 = array( |
|
| 49 | + /* 1 */ |
|
| 50 | + '/((?:^|[^\#0-9a-zA-Z\&])[\#0-9a-zA-Z]*)\;/S', |
|
| 51 | + /* 2 */ |
|
| 52 | + '/»| --?,|(?::(?!:)| %)(?:\W|$)/S', |
|
| 53 | + /* 3 */ |
|
| 54 | + '/([^[<(!?.])([!?][!?\.]*)/iS', |
|
| 55 | + /* 4 */ |
|
| 56 | + '/«|(?:M(?:M?\.|mes?|r\.?)|[MnN]°) /S' |
|
| 57 | + ); |
|
| 58 | + $remplace1 = array( |
|
| 59 | + /* 1 */ |
|
| 60 | + '\1~;', |
|
| 61 | + /* 2 */ |
|
| 62 | + '~\0', |
|
| 63 | + /* 3 */ |
|
| 64 | + '\1~\2', |
|
| 65 | + /* 4 */ |
|
| 66 | + '\0~' |
|
| 67 | + ); |
|
| 68 | + $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 69 | + $letexte = preg_replace('/ *~+ */S', '~', $letexte); |
|
| 70 | 70 | |
| 71 | - $cherche2 = array( |
|
| 72 | - '/([^-\n]|^)--([^-]|$)/S', |
|
| 73 | - ',(' . _PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 74 | - '/~/' |
|
| 75 | - ); |
|
| 76 | - $remplace2 = array( |
|
| 77 | - '\1—\2', |
|
| 78 | - '\1\3\4', |
|
| 79 | - ' ' |
|
| 80 | - ); |
|
| 81 | - $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 71 | + $cherche2 = array( |
|
| 72 | + '/([^-\n]|^)--([^-]|$)/S', |
|
| 73 | + ',(' . _PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 74 | + '/~/' |
|
| 75 | + ); |
|
| 76 | + $remplace2 = array( |
|
| 77 | + '\1—\2', |
|
| 78 | + '\1\3\4', |
|
| 79 | + ' ' |
|
| 80 | + ); |
|
| 81 | + $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 82 | 82 | |
| 83 | - return $letexte; |
|
| 83 | + return $letexte; |
|
| 84 | 84 | } |
@@ -70,7 +70,7 @@ |
||
| 70 | 70 | |
| 71 | 71 | $cherche2 = array( |
| 72 | 72 | '/([^-\n]|^)--([^-]|$)/S', |
| 73 | - ',(' . _PROTOCOLES_STD . ')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 73 | + ',('._PROTOCOLES_STD.')~((://[^"\'\s\[\]\}\)<>]+)~([?]))?,S', |
|
| 74 | 74 | '/~/' |
| 75 | 75 | ); |
| 76 | 76 | $remplace2 = array( |
@@ -11,37 +11,37 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // rien sauf les "~" et "-," |
| 18 | 18 | |
| 19 | 19 | function typographie_en_dist($letexte) { |
| 20 | 20 | |
| 21 | - // zouli apostrophe |
|
| 22 | - $letexte = str_replace("'", '’', $letexte); |
|
| 21 | + // zouli apostrophe |
|
| 22 | + $letexte = str_replace("'", '’', $letexte); |
|
| 23 | 23 | |
| 24 | - $cherche1 = array( |
|
| 25 | - '/ --?,/S' |
|
| 26 | - ); |
|
| 27 | - $remplace1 = array( |
|
| 28 | - '~\0' |
|
| 29 | - ); |
|
| 30 | - $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 24 | + $cherche1 = array( |
|
| 25 | + '/ --?,/S' |
|
| 26 | + ); |
|
| 27 | + $remplace1 = array( |
|
| 28 | + '~\0' |
|
| 29 | + ); |
|
| 30 | + $letexte = preg_replace($cherche1, $remplace1, $letexte); |
|
| 31 | 31 | |
| 32 | - $letexte = str_replace(' ', '~', $letexte); |
|
| 33 | - $letexte = preg_replace('/ *~+ */', '~', $letexte); |
|
| 32 | + $letexte = str_replace(' ', '~', $letexte); |
|
| 33 | + $letexte = preg_replace('/ *~+ */', '~', $letexte); |
|
| 34 | 34 | |
| 35 | - $cherche2 = array( |
|
| 36 | - '/([^-\n]|^)--([^-]|$)/', |
|
| 37 | - '/~/' |
|
| 38 | - ); |
|
| 39 | - $remplace2 = array( |
|
| 40 | - '\1—\2', |
|
| 41 | - ' ' |
|
| 42 | - ); |
|
| 35 | + $cherche2 = array( |
|
| 36 | + '/([^-\n]|^)--([^-]|$)/', |
|
| 37 | + '/~/' |
|
| 38 | + ); |
|
| 39 | + $remplace2 = array( |
|
| 40 | + '\1—\2', |
|
| 41 | + ' ' |
|
| 42 | + ); |
|
| 43 | 43 | |
| 44 | - $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 44 | + $letexte = preg_replace($cherche2, $remplace2, $letexte); |
|
| 45 | 45 | |
| 46 | - return $letexte; |
|
| 46 | + return $letexte; |
|
| 47 | 47 | } |
@@ -73,5 +73,5 @@ |
||
| 73 | 73 | return ''; |
| 74 | 74 | } |
| 75 | 75 | |
| 76 | - return generer_url_action('logout', "logout=public&url=" . rawurlencode($cible ? $cible : self('&'))); |
|
| 76 | + return generer_url_action('logout', "logout=public&url=".rawurlencode($cible ? $cible : self('&'))); |
|
| 77 | 77 | } |
@@ -17,7 +17,7 @@ discard block |
||
| 17 | 17 | **/ |
| 18 | 18 | |
| 19 | 19 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 20 | - return; |
|
| 20 | + return; |
|
| 21 | 21 | } |
| 22 | 22 | |
| 23 | 23 | /** |
@@ -36,7 +36,7 @@ discard block |
||
| 36 | 36 | * Pile complétée du code compilé |
| 37 | 37 | **/ |
| 38 | 38 | function balise_URL_LOGOUT($p) { |
| 39 | - return calculer_balise_dynamique($p, 'URL_LOGOUT', array()); |
|
| 39 | + return calculer_balise_dynamique($p, 'URL_LOGOUT', array()); |
|
| 40 | 40 | } |
| 41 | 41 | |
| 42 | 42 | |
@@ -52,9 +52,9 @@ discard block |
||
| 52 | 52 | * Liste (url) des arguments collectés. |
| 53 | 53 | */ |
| 54 | 54 | function balise_URL_LOGOUT_stat($args, $context_compil) { |
| 55 | - $url = isset($args[0]) ? $args[0] : ''; |
|
| 55 | + $url = isset($args[0]) ? $args[0] : ''; |
|
| 56 | 56 | |
| 57 | - return array($url); |
|
| 57 | + return array($url); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | /** |
@@ -69,9 +69,9 @@ discard block |
||
| 69 | 69 | **/ |
| 70 | 70 | function balise_URL_LOGOUT_dyn($cible) { |
| 71 | 71 | |
| 72 | - if (empty($GLOBALS['visiteur_session']['login']) and empty($GLOBALS['visiteur_session']['statut'])) { |
|
| 73 | - return ''; |
|
| 74 | - } |
|
| 72 | + if (empty($GLOBALS['visiteur_session']['login']) and empty($GLOBALS['visiteur_session']['statut'])) { |
|
| 73 | + return ''; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - return generer_url_action('logout', "logout=public&url=" . rawurlencode($cible ? $cible : self('&'))); |
|
| 76 | + return generer_url_action('logout', "logout=public&url=" . rawurlencode($cible ? $cible : self('&'))); |
|
| 77 | 77 | } |
@@ -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 | /** |
@@ -40,21 +40,21 @@ discard block |
||
| 40 | 40 | * Pile complétée par le code à générer |
| 41 | 41 | */ |
| 42 | 42 | function balise_INFO__dist($p) { |
| 43 | - $info = $p->nom_champ; |
|
| 44 | - $type_objet = interprete_argument_balise(1, $p); |
|
| 45 | - $id_objet = interprete_argument_balise(2, $p); |
|
| 46 | - if ($info === 'INFO_' or !$type_objet or !$id_objet) { |
|
| 47 | - $msg = _T('zbug_balise_sans_argument', array('balise' => ' INFO_')); |
|
| 48 | - erreur_squelette($msg, $p); |
|
| 49 | - $p->interdire_scripts = true; |
|
| 43 | + $info = $p->nom_champ; |
|
| 44 | + $type_objet = interprete_argument_balise(1, $p); |
|
| 45 | + $id_objet = interprete_argument_balise(2, $p); |
|
| 46 | + if ($info === 'INFO_' or !$type_objet or !$id_objet) { |
|
| 47 | + $msg = _T('zbug_balise_sans_argument', array('balise' => ' INFO_')); |
|
| 48 | + erreur_squelette($msg, $p); |
|
| 49 | + $p->interdire_scripts = true; |
|
| 50 | 50 | |
| 51 | - return $p; |
|
| 52 | - } else { |
|
| 53 | - $info_sql = strtolower(substr($info, 5)); |
|
| 54 | - $code = "generer_info_entite($id_objet, $type_objet, '$info_sql'" . ($p->etoile ? "," . _q($p->etoile) : "") . ")"; |
|
| 55 | - $p->code = champ_sql($info, $p, $code); |
|
| 56 | - $p->interdire_scripts = true; |
|
| 51 | + return $p; |
|
| 52 | + } else { |
|
| 53 | + $info_sql = strtolower(substr($info, 5)); |
|
| 54 | + $code = "generer_info_entite($id_objet, $type_objet, '$info_sql'" . ($p->etoile ? "," . _q($p->etoile) : "") . ")"; |
|
| 55 | + $p->code = champ_sql($info, $p, $code); |
|
| 56 | + $p->interdire_scripts = true; |
|
| 57 | 57 | |
| 58 | - return $p; |
|
| 59 | - } |
|
| 58 | + return $p; |
|
| 59 | + } |
|
| 60 | 60 | } |
@@ -51,7 +51,7 @@ |
||
| 51 | 51 | return $p; |
| 52 | 52 | } else { |
| 53 | 53 | $info_sql = strtolower(substr($info, 5)); |
| 54 | - $code = "generer_info_entite($id_objet, $type_objet, '$info_sql'" . ($p->etoile ? "," . _q($p->etoile) : "") . ")"; |
|
| 54 | + $code = "generer_info_entite($id_objet, $type_objet, '$info_sql'".($p->etoile ? ","._q($p->etoile) : "").")"; |
|
| 55 | 55 | $p->code = champ_sql($info, $p, $code); |
| 56 | 56 | $p->interdire_scripts = true; |
| 57 | 57 | |