@@ -16,7 +16,7 @@ discard block |
||
| 16 | 16 | * @package SPIP\Core\Queue |
| 17 | 17 | **/ |
| 18 | 18 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 19 | - return; |
|
| 19 | + return; |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | /** |
@@ -25,12 +25,12 @@ discard block |
||
| 25 | 25 | * @return void |
| 26 | 26 | */ |
| 27 | 27 | function action_purger_queue_dist() { |
| 28 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | - $securiser_action(); |
|
| 28 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 29 | + $securiser_action(); |
|
| 30 | 30 | |
| 31 | - if (autoriser('purger', 'queue')) { |
|
| 32 | - include_spip('inc/queue'); |
|
| 33 | - queue_purger(); |
|
| 34 | - } |
|
| 31 | + if (autoriser('purger', 'queue')) { |
|
| 32 | + include_spip('inc/queue'); |
|
| 33 | + queue_purger(); |
|
| 34 | + } |
|
| 35 | 35 | |
| 36 | 36 | } |
@@ -66,7 +66,7 @@ discard block |
||
| 66 | 66 | echo info_etape( |
| 67 | 67 | _T('titre_connexion_ldap'), |
| 68 | 68 | info_progression_etape(2, 'etape_ldap', 'install/') |
| 69 | - ), _T('info_connexion_ldap_ok'); |
|
| 69 | + ), _T('info_connexion_ldap_ok'); |
|
| 70 | 70 | echo generer_form_ecrire('install', ( |
| 71 | 71 | "\n<input type='hidden' name='etape' value='ldap3' />" |
| 72 | 72 | . "\n<input type='hidden' name='adresse_ldap' value=\"$adresse_ldap\" />" |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | . bouton_suivant())); |
| 79 | 79 | } else { |
| 80 | 80 | echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true), |
| 81 | - "<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>', |
|
| 82 | - '<p>' . _T('avis_connexion_ldap_echec_2') . |
|
| 83 | - "<br />\n" . _T('avis_connexion_ldap_echec_3') . |
|
| 84 | - '<br /><br />' . $erreur . '<b> ?</b></p></div>'; |
|
| 81 | + "<div class='error'><p>"._T('avis_connexion_ldap_echec_1').'</p>', |
|
| 82 | + '<p>'._T('avis_connexion_ldap_echec_2'). |
|
| 83 | + "<br />\n"._T('avis_connexion_ldap_echec_3'). |
|
| 84 | + '<br /><br />'.$erreur.'<b> ?</b></p></div>'; |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | echo install_fin_html(); |
@@ -11,77 +11,77 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // https://code.spip.net/@install_etape_ldap2_dist |
| 18 | 18 | function install_etape_ldap2_dist() { |
| 19 | - echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 19 | + echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 20 | 20 | |
| 21 | - $adresse_ldap = _request('adresse_ldap'); |
|
| 21 | + $adresse_ldap = _request('adresse_ldap'); |
|
| 22 | 22 | |
| 23 | - $port_ldap = _request('port_ldap'); |
|
| 23 | + $port_ldap = _request('port_ldap'); |
|
| 24 | 24 | |
| 25 | - $tls_ldap = _request('tls_ldap'); |
|
| 25 | + $tls_ldap = _request('tls_ldap'); |
|
| 26 | 26 | |
| 27 | - $protocole_ldap = _request('protocole_ldap'); |
|
| 27 | + $protocole_ldap = _request('protocole_ldap'); |
|
| 28 | 28 | |
| 29 | - $login_ldap = _request('login_ldap'); |
|
| 29 | + $login_ldap = _request('login_ldap'); |
|
| 30 | 30 | |
| 31 | - $pass_ldap = _request('pass_ldap'); |
|
| 31 | + $pass_ldap = _request('pass_ldap'); |
|
| 32 | 32 | |
| 33 | - $port_ldap = intval($port_ldap); |
|
| 33 | + $port_ldap = intval($port_ldap); |
|
| 34 | 34 | |
| 35 | - $tls = false; |
|
| 35 | + $tls = false; |
|
| 36 | 36 | |
| 37 | - if ($tls_ldap == 'oui') { |
|
| 38 | - if ($port_ldap == 636) { |
|
| 39 | - $adresse_ldap = "ldaps://$adresse_ldap"; |
|
| 40 | - } else { |
|
| 41 | - $tls = true; |
|
| 42 | - } |
|
| 43 | - } |
|
| 44 | - $ldap_link = ldap_connect($adresse_ldap, $port_ldap); |
|
| 45 | - $erreur = "ldap_connect($adresse_ldap, $port_ldap)"; |
|
| 37 | + if ($tls_ldap == 'oui') { |
|
| 38 | + if ($port_ldap == 636) { |
|
| 39 | + $adresse_ldap = "ldaps://$adresse_ldap"; |
|
| 40 | + } else { |
|
| 41 | + $tls = true; |
|
| 42 | + } |
|
| 43 | + } |
|
| 44 | + $ldap_link = ldap_connect($adresse_ldap, $port_ldap); |
|
| 45 | + $erreur = "ldap_connect($adresse_ldap, $port_ldap)"; |
|
| 46 | 46 | |
| 47 | - if ($ldap_link) { |
|
| 48 | - if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) { |
|
| 49 | - $protocole_ldap = 2; |
|
| 50 | - ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap); |
|
| 51 | - } |
|
| 52 | - if ($tls === true) { |
|
| 53 | - if (!ldap_start_tls($ldap_link)) { |
|
| 54 | - $erreur = "ldap_start_tls($ldap_link) $adresse_ldap, $port_ldap"; |
|
| 55 | - $ldap_link = false; |
|
| 56 | - } |
|
| 57 | - } |
|
| 58 | - if ($ldap_link) { |
|
| 59 | - $ldap_link = ldap_bind($ldap_link, $login_ldap, $pass_ldap); |
|
| 60 | - $erreur = "ldap_bind('$ldap_link', '$login_ldap', '$pass_ldap'): $adresse_ldap, $port_ldap"; |
|
| 61 | - } |
|
| 62 | - } |
|
| 47 | + if ($ldap_link) { |
|
| 48 | + if (!ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap)) { |
|
| 49 | + $protocole_ldap = 2; |
|
| 50 | + ldap_set_option($ldap_link, LDAP_OPT_PROTOCOL_VERSION, $protocole_ldap); |
|
| 51 | + } |
|
| 52 | + if ($tls === true) { |
|
| 53 | + if (!ldap_start_tls($ldap_link)) { |
|
| 54 | + $erreur = "ldap_start_tls($ldap_link) $adresse_ldap, $port_ldap"; |
|
| 55 | + $ldap_link = false; |
|
| 56 | + } |
|
| 57 | + } |
|
| 58 | + if ($ldap_link) { |
|
| 59 | + $ldap_link = ldap_bind($ldap_link, $login_ldap, $pass_ldap); |
|
| 60 | + $erreur = "ldap_bind('$ldap_link', '$login_ldap', '$pass_ldap'): $adresse_ldap, $port_ldap"; |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | - if ($ldap_link) { |
|
| 65 | - echo info_etape( |
|
| 66 | - _T('titre_connexion_ldap'), |
|
| 67 | - info_progression_etape(2, 'etape_ldap', 'install/') |
|
| 68 | - ), _T('info_connexion_ldap_ok'); |
|
| 69 | - echo generer_form_ecrire('install', ( |
|
| 70 | - "\n<input type='hidden' name='etape' value='ldap3' />" |
|
| 71 | - . "\n<input type='hidden' name='adresse_ldap' value=\"$adresse_ldap\" />" |
|
| 72 | - . "\n<input type='hidden' name='port_ldap' value=\"$port_ldap\" />" |
|
| 73 | - . "\n<input type='hidden' name='login_ldap' value=\"$login_ldap\" />" |
|
| 74 | - . "\n<input type='hidden' name='pass_ldap' value=\"$pass_ldap\" />" |
|
| 75 | - . "\n<input type='hidden' name='protocole_ldap' value=\"$protocole_ldap\" />" |
|
| 76 | - . "\n<input type='hidden' name='tls_ldap' value=\"$tls_ldap\" />" |
|
| 77 | - . bouton_suivant())); |
|
| 78 | - } else { |
|
| 79 | - echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true), |
|
| 80 | - "<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>', |
|
| 81 | - '<p>' . _T('avis_connexion_ldap_echec_2') . |
|
| 82 | - "<br />\n" . _T('avis_connexion_ldap_echec_3') . |
|
| 83 | - '<br /><br />' . $erreur . '<b> ?</b></p></div>'; |
|
| 84 | - } |
|
| 64 | + if ($ldap_link) { |
|
| 65 | + echo info_etape( |
|
| 66 | + _T('titre_connexion_ldap'), |
|
| 67 | + info_progression_etape(2, 'etape_ldap', 'install/') |
|
| 68 | + ), _T('info_connexion_ldap_ok'); |
|
| 69 | + echo generer_form_ecrire('install', ( |
|
| 70 | + "\n<input type='hidden' name='etape' value='ldap3' />" |
|
| 71 | + . "\n<input type='hidden' name='adresse_ldap' value=\"$adresse_ldap\" />" |
|
| 72 | + . "\n<input type='hidden' name='port_ldap' value=\"$port_ldap\" />" |
|
| 73 | + . "\n<input type='hidden' name='login_ldap' value=\"$login_ldap\" />" |
|
| 74 | + . "\n<input type='hidden' name='pass_ldap' value=\"$pass_ldap\" />" |
|
| 75 | + . "\n<input type='hidden' name='protocole_ldap' value=\"$protocole_ldap\" />" |
|
| 76 | + . "\n<input type='hidden' name='tls_ldap' value=\"$tls_ldap\" />" |
|
| 77 | + . bouton_suivant())); |
|
| 78 | + } else { |
|
| 79 | + echo info_etape(_T('titre_connexion_ldap')), info_progression_etape(1, 'etape_ldap', 'install/', true), |
|
| 80 | + "<div class='error'><p>" . _T('avis_connexion_ldap_echec_1') . '</p>', |
|
| 81 | + '<p>' . _T('avis_connexion_ldap_echec_2') . |
|
| 82 | + "<br />\n" . _T('avis_connexion_ldap_echec_3') . |
|
| 83 | + '<br /><br />' . $erreur . '<b> ?</b></p></div>'; |
|
| 84 | + } |
|
| 85 | 85 | |
| 86 | - echo install_fin_html(); |
|
| 86 | + echo install_fin_html(); |
|
| 87 | 87 | } |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $checked = false; |
| 46 | 46 | $res = ''; |
| 47 | 47 | if (is_array($info) and $info['count'] > 0) { |
| 48 | - $res .= '<p>' . _T('info_selection_chemin_acces') . '</p>'; |
|
| 48 | + $res .= '<p>'._T('info_selection_chemin_acces').'</p>'; |
|
| 49 | 49 | $res .= '<ul>'; |
| 50 | 50 | $n = 0; |
| 51 | 51 | for ($i = 0; $i < $info['count']; $i++) { |
@@ -53,18 +53,18 @@ discard block |
||
| 53 | 53 | if (is_array($names)) { |
| 54 | 54 | for ($j = 0; $j < $names['count']; $j++) { |
| 55 | 55 | $n++; |
| 56 | - $res .= '<li><input name="base_ldap" value="' . spip_htmlspecialchars($names[$j]) . "\" type='radio' id='tab$n'"; |
|
| 56 | + $res .= '<li><input name="base_ldap" value="'.spip_htmlspecialchars($names[$j])."\" type='radio' id='tab$n'"; |
|
| 57 | 57 | if (!$checked) { |
| 58 | 58 | $res .= ' checked="checked"'; |
| 59 | 59 | $checked = true; |
| 60 | 60 | } |
| 61 | 61 | $res .= ' />'; |
| 62 | - $res .= "<label for='tab$n'>" . spip_htmlspecialchars($names[$j]) . "</label></li>\n"; |
|
| 62 | + $res .= "<label for='tab$n'>".spip_htmlspecialchars($names[$j])."</label></li>\n"; |
|
| 63 | 63 | } |
| 64 | 64 | } |
| 65 | 65 | } |
| 66 | 66 | $res .= '</ul>'; |
| 67 | - $res .= _T('info_ou') . ' '; |
|
| 67 | + $res .= _T('info_ou').' '; |
|
| 68 | 68 | } |
| 69 | 69 | $res .= "<br />\n<input name=\"base_ldap\" value=\"\" type='radio' id='manuel'"; |
| 70 | 70 | if (!$checked) { |
@@ -73,7 +73,7 @@ discard block |
||
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | $res .= ' />' |
| 76 | - . "\n<label for='manuel'>" . _T('entree_chemin_acces') . '</label> ' |
|
| 76 | + . "\n<label for='manuel'>"._T('entree_chemin_acces').'</label> ' |
|
| 77 | 77 | . "\n<fieldset>" |
| 78 | 78 | . "<input type='text' name='base_ldap_text' class='text' value=\"$base_ldap_text\" size='40' />" |
| 79 | 79 | . "\n</fieldset>" |
@@ -11,76 +11,76 @@ |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | // https://code.spip.net/@install_etape_ldap3_dist |
| 18 | 18 | function install_etape_ldap3_dist() { |
| 19 | - $adresse_ldap = _request('adresse_ldap'); |
|
| 20 | - $login_ldap = _request('login_ldap'); |
|
| 21 | - $pass_ldap = _request('pass_ldap'); |
|
| 22 | - $port_ldap = _request('port_ldap'); |
|
| 19 | + $adresse_ldap = _request('adresse_ldap'); |
|
| 20 | + $login_ldap = _request('login_ldap'); |
|
| 21 | + $pass_ldap = _request('pass_ldap'); |
|
| 22 | + $port_ldap = _request('port_ldap'); |
|
| 23 | 23 | |
| 24 | - $base_ldap_text = defined('_INSTALL_BASE_LDAP') |
|
| 25 | - ? _INSTALL_BASE_LDAP |
|
| 26 | - : 'ou=users, dc=mon-domaine, dc=com'; |
|
| 24 | + $base_ldap_text = defined('_INSTALL_BASE_LDAP') |
|
| 25 | + ? _INSTALL_BASE_LDAP |
|
| 26 | + : 'ou=users, dc=mon-domaine, dc=com'; |
|
| 27 | 27 | |
| 28 | - echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 28 | + echo install_debut_html('AUTO', ' onload="document.getElementById(\'suivant\').focus();return false;"'); |
|
| 29 | 29 | |
| 30 | - echo info_etape( |
|
| 31 | - _T('info_chemin_acces_1'), |
|
| 32 | - info_progression_etape(3, 'etape_ldap', 'install/') |
|
| 33 | - ), |
|
| 34 | - _T('info_chemin_acces_2'); |
|
| 30 | + echo info_etape( |
|
| 31 | + _T('info_chemin_acces_1'), |
|
| 32 | + info_progression_etape(3, 'etape_ldap', 'install/') |
|
| 33 | + ), |
|
| 34 | + _T('info_chemin_acces_2'); |
|
| 35 | 35 | |
| 36 | - $ldap_link = @ldap_connect("$adresse_ldap", "$port_ldap"); |
|
| 37 | - if ($ldap_link) { |
|
| 38 | - @ldap_bind($ldap_link, "$login_ldap", "$pass_ldap"); |
|
| 39 | - $result = @ldap_read($ldap_link, '', 'objectclass=*', ['namingContexts']); |
|
| 40 | - $info = @ldap_get_entries($ldap_link, $result); |
|
| 41 | - @ldap_close($ldap_link); |
|
| 42 | - } |
|
| 36 | + $ldap_link = @ldap_connect("$adresse_ldap", "$port_ldap"); |
|
| 37 | + if ($ldap_link) { |
|
| 38 | + @ldap_bind($ldap_link, "$login_ldap", "$pass_ldap"); |
|
| 39 | + $result = @ldap_read($ldap_link, '', 'objectclass=*', ['namingContexts']); |
|
| 40 | + $info = @ldap_get_entries($ldap_link, $result); |
|
| 41 | + @ldap_close($ldap_link); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - $checked = false; |
|
| 45 | - $res = ''; |
|
| 46 | - if (is_array($info) and $info['count'] > 0) { |
|
| 47 | - $res .= '<p>' . _T('info_selection_chemin_acces') . '</p>'; |
|
| 48 | - $res .= '<ul>'; |
|
| 49 | - $n = 0; |
|
| 50 | - for ($i = 0; $i < $info['count']; $i++) { |
|
| 51 | - $names = $info[$i]['namingcontexts']; |
|
| 52 | - if (is_array($names)) { |
|
| 53 | - for ($j = 0; $j < $names['count']; $j++) { |
|
| 54 | - $n++; |
|
| 55 | - $res .= '<li><input name="base_ldap" value="' . spip_htmlspecialchars($names[$j]) . "\" type='radio' id='tab$n'"; |
|
| 56 | - if (!$checked) { |
|
| 57 | - $res .= ' checked="checked"'; |
|
| 58 | - $checked = true; |
|
| 59 | - } |
|
| 60 | - $res .= ' />'; |
|
| 61 | - $res .= "<label for='tab$n'>" . spip_htmlspecialchars($names[$j]) . "</label></li>\n"; |
|
| 62 | - } |
|
| 63 | - } |
|
| 64 | - } |
|
| 65 | - $res .= '</ul>'; |
|
| 66 | - $res .= _T('info_ou') . ' '; |
|
| 67 | - } |
|
| 68 | - $res .= "<br />\n<input name=\"base_ldap\" value=\"\" type='radio' id='manuel'"; |
|
| 69 | - if (!$checked) { |
|
| 70 | - $res .= ' checked="checked"'; |
|
| 71 | - $checked = true; |
|
| 72 | - } |
|
| 44 | + $checked = false; |
|
| 45 | + $res = ''; |
|
| 46 | + if (is_array($info) and $info['count'] > 0) { |
|
| 47 | + $res .= '<p>' . _T('info_selection_chemin_acces') . '</p>'; |
|
| 48 | + $res .= '<ul>'; |
|
| 49 | + $n = 0; |
|
| 50 | + for ($i = 0; $i < $info['count']; $i++) { |
|
| 51 | + $names = $info[$i]['namingcontexts']; |
|
| 52 | + if (is_array($names)) { |
|
| 53 | + for ($j = 0; $j < $names['count']; $j++) { |
|
| 54 | + $n++; |
|
| 55 | + $res .= '<li><input name="base_ldap" value="' . spip_htmlspecialchars($names[$j]) . "\" type='radio' id='tab$n'"; |
|
| 56 | + if (!$checked) { |
|
| 57 | + $res .= ' checked="checked"'; |
|
| 58 | + $checked = true; |
|
| 59 | + } |
|
| 60 | + $res .= ' />'; |
|
| 61 | + $res .= "<label for='tab$n'>" . spip_htmlspecialchars($names[$j]) . "</label></li>\n"; |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + $res .= '</ul>'; |
|
| 66 | + $res .= _T('info_ou') . ' '; |
|
| 67 | + } |
|
| 68 | + $res .= "<br />\n<input name=\"base_ldap\" value=\"\" type='radio' id='manuel'"; |
|
| 69 | + if (!$checked) { |
|
| 70 | + $res .= ' checked="checked"'; |
|
| 71 | + $checked = true; |
|
| 72 | + } |
|
| 73 | 73 | |
| 74 | - $res .= ' />' |
|
| 75 | - . "\n<label for='manuel'>" . _T('entree_chemin_acces') . '</label> ' |
|
| 76 | - . "\n<fieldset>" |
|
| 77 | - . "<input type='text' name='base_ldap_text' class='text' value=\"$base_ldap_text\" size='40' />" |
|
| 78 | - . "\n</fieldset>" |
|
| 79 | - . "\n<input type='hidden' name='etape' value='ldap4' />" |
|
| 80 | - . install_propager(['adresse_ldap', 'port_ldap', 'login_ldap', 'pass_ldap', 'protocole_ldap', 'tls_ldap']) |
|
| 81 | - . bouton_suivant(); |
|
| 74 | + $res .= ' />' |
|
| 75 | + . "\n<label for='manuel'>" . _T('entree_chemin_acces') . '</label> ' |
|
| 76 | + . "\n<fieldset>" |
|
| 77 | + . "<input type='text' name='base_ldap_text' class='text' value=\"$base_ldap_text\" size='40' />" |
|
| 78 | + . "\n</fieldset>" |
|
| 79 | + . "\n<input type='hidden' name='etape' value='ldap4' />" |
|
| 80 | + . install_propager(['adresse_ldap', 'port_ldap', 'login_ldap', 'pass_ldap', 'protocole_ldap', 'tls_ldap']) |
|
| 81 | + . bouton_suivant(); |
|
| 82 | 82 | |
| 83 | - echo generer_form_ecrire('install', $res); |
|
| 83 | + echo generer_form_ecrire('install', $res); |
|
| 84 | 84 | |
| 85 | - echo install_fin_html(); |
|
| 85 | + echo install_fin_html(); |
|
| 86 | 86 | } |
@@ -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 | } |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | # attention toutefois seuls '' et '=' figurent dans les modes de compatibilite |
| 24 | 24 | define('_separateur_urls_page', ''); |
| 25 | 25 | # on peut indiquer '' si on a installe le .htaccess |
| 26 | -define('_debut_urls_page', get_spip_script('./') . '?'); |
|
| 26 | +define('_debut_urls_page', get_spip_script('./').'?'); |
|
| 27 | 27 | ####### |
| 28 | 28 | |
| 29 | 29 | |
@@ -37,14 +37,14 @@ discard block |
||
| 37 | 37 | } |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - $url = _debut_urls_page . $type . _separateur_urls_page |
|
| 41 | - . $id . _terminaison_urls_page; |
|
| 40 | + $url = _debut_urls_page.$type._separateur_urls_page |
|
| 41 | + . $id._terminaison_urls_page; |
|
| 42 | 42 | |
| 43 | 43 | if ($args) { |
| 44 | 44 | $args = strpos($url, '?') ? "&$args" : "?$args"; |
| 45 | 45 | } |
| 46 | 46 | |
| 47 | - return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : ''); |
|
| 47 | + return _DIR_RACINE.$url.$args.($ancre ? "#$ancre" : ''); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // retrouve le fond et les parametres d'une URL abregee |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | define('URLS_PAGE_EXEMPLE', 'spip.php?article12'); |
@@ -30,74 +30,74 @@ discard block |
||
| 30 | 30 | // https://code.spip.net/@_generer_url_page |
| 31 | 31 | function _generer_url_page($type, $id, $args = '', $ancre = '') { |
| 32 | 32 | |
| 33 | - if ($generer_url_externe = charger_fonction("generer_url_$type", 'urls', true)) { |
|
| 34 | - $url = $generer_url_externe($id, $args, $ancre); |
|
| 35 | - if (null != $url) { |
|
| 36 | - return $url; |
|
| 37 | - } |
|
| 38 | - } |
|
| 33 | + if ($generer_url_externe = charger_fonction("generer_url_$type", 'urls', true)) { |
|
| 34 | + $url = $generer_url_externe($id, $args, $ancre); |
|
| 35 | + if (null != $url) { |
|
| 36 | + return $url; |
|
| 37 | + } |
|
| 38 | + } |
|
| 39 | 39 | |
| 40 | - $url = _debut_urls_page . $type . _separateur_urls_page |
|
| 41 | - . $id . _terminaison_urls_page; |
|
| 40 | + $url = _debut_urls_page . $type . _separateur_urls_page |
|
| 41 | + . $id . _terminaison_urls_page; |
|
| 42 | 42 | |
| 43 | - if ($args) { |
|
| 44 | - $args = strpos($url, '?') ? "&$args" : "?$args"; |
|
| 45 | - } |
|
| 43 | + if ($args) { |
|
| 44 | + $args = strpos($url, '?') ? "&$args" : "?$args"; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : ''); |
|
| 47 | + return _DIR_RACINE . $url . $args . ($ancre ? "#$ancre" : ''); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | // retrouve le fond et les parametres d'une URL abregee |
| 51 | 51 | // le contexte deja existant est fourni dans args sous forme de tableau ou query string |
| 52 | 52 | // https://code.spip.net/@urls_page_dist |
| 53 | 53 | function urls_page_dist($i, &$entite, $args = '', $ancre = '') { |
| 54 | - if (is_numeric($i)) { |
|
| 55 | - return _generer_url_page($entite, $i, $args, $ancre); |
|
| 56 | - } |
|
| 54 | + if (is_numeric($i)) { |
|
| 55 | + return _generer_url_page($entite, $i, $args, $ancre); |
|
| 56 | + } |
|
| 57 | 57 | |
| 58 | - // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23 |
|
| 59 | - if ($GLOBALS['profondeur_url'] > 0 and $entite == 'sommaire') { |
|
| 60 | - return [[], '404']; |
|
| 61 | - } |
|
| 58 | + // traiter les injections du type domaine.org/spip.php/cestnimportequoi/ou/encore/plus/rubrique23 |
|
| 59 | + if ($GLOBALS['profondeur_url'] > 0 and $entite == 'sommaire') { |
|
| 60 | + return [[], '404']; |
|
| 61 | + } |
|
| 62 | 62 | |
| 63 | - // voir s'il faut recuperer le id_* implicite et les &debut_xx; |
|
| 64 | - if (is_array($args)) { |
|
| 65 | - $contexte = $args; |
|
| 66 | - } else { |
|
| 67 | - parse_str($args, $contexte); |
|
| 68 | - } |
|
| 69 | - include_spip('inc/urls'); |
|
| 70 | - $r = nettoyer_url_page($i, $contexte); |
|
| 71 | - if ($r) { |
|
| 72 | - array_pop($r); // nettoyer_url_page renvoie un argument de plus inutile ici |
|
| 73 | - return $r; |
|
| 74 | - } |
|
| 63 | + // voir s'il faut recuperer le id_* implicite et les &debut_xx; |
|
| 64 | + if (is_array($args)) { |
|
| 65 | + $contexte = $args; |
|
| 66 | + } else { |
|
| 67 | + parse_str($args, $contexte); |
|
| 68 | + } |
|
| 69 | + include_spip('inc/urls'); |
|
| 70 | + $r = nettoyer_url_page($i, $contexte); |
|
| 71 | + if ($r) { |
|
| 72 | + array_pop($r); // nettoyer_url_page renvoie un argument de plus inutile ici |
|
| 73 | + return $r; |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | - /* |
|
| 76 | + /* |
|
| 77 | 77 | * Le bloc qui suit sert a faciliter les transitions depuis |
| 78 | 78 | * le mode 'urls-propres' vers les modes 'urls-standard' et 'url-html' |
| 79 | 79 | * Il est inutile de le recopier si vous personnalisez vos URLs |
| 80 | 80 | * et votre .htaccess |
| 81 | 81 | */ |
| 82 | - // Si on est revenu en mode html, mais c'est une ancienne url_propre |
|
| 83 | - // on ne redirige pas, on assume le nouveau contexte (si possible) |
|
| 84 | - $url = $i; |
|
| 85 | - $url_propre = isset($url) |
|
| 86 | - ? $url |
|
| 87 | - : (isset($_SERVER['REDIRECT_url_propre']) |
|
| 88 | - ? $_SERVER['REDIRECT_url_propre'] |
|
| 89 | - : (isset($_ENV['url_propre']) |
|
| 90 | - ? $_ENV['url_propre'] |
|
| 91 | - : '' |
|
| 92 | - )); |
|
| 93 | - if ($url_propre) { |
|
| 94 | - if ($GLOBALS['profondeur_url'] <= 0) { |
|
| 95 | - $urls_anciennes = charger_fonction('propres', 'urls', true); |
|
| 96 | - } else { |
|
| 97 | - $urls_anciennes = charger_fonction('arbo', 'urls', true); |
|
| 98 | - } |
|
| 82 | + // Si on est revenu en mode html, mais c'est une ancienne url_propre |
|
| 83 | + // on ne redirige pas, on assume le nouveau contexte (si possible) |
|
| 84 | + $url = $i; |
|
| 85 | + $url_propre = isset($url) |
|
| 86 | + ? $url |
|
| 87 | + : (isset($_SERVER['REDIRECT_url_propre']) |
|
| 88 | + ? $_SERVER['REDIRECT_url_propre'] |
|
| 89 | + : (isset($_ENV['url_propre']) |
|
| 90 | + ? $_ENV['url_propre'] |
|
| 91 | + : '' |
|
| 92 | + )); |
|
| 93 | + if ($url_propre) { |
|
| 94 | + if ($GLOBALS['profondeur_url'] <= 0) { |
|
| 95 | + $urls_anciennes = charger_fonction('propres', 'urls', true); |
|
| 96 | + } else { |
|
| 97 | + $urls_anciennes = charger_fonction('arbo', 'urls', true); |
|
| 98 | + } |
|
| 99 | 99 | |
| 100 | - return $urls_anciennes ? $urls_anciennes($url_propre, $entite, $contexte) : ''; |
|
| 101 | - } |
|
| 102 | - /* Fin du bloc compatibilite url-propres */ |
|
| 100 | + return $urls_anciennes ? $urls_anciennes($url_propre, $entite, $contexte) : ''; |
|
| 101 | + } |
|
| 102 | + /* Fin du bloc compatibilite url-propres */ |
|
| 103 | 103 | } |
@@ -23,23 +23,23 @@ |
||
| 23 | 23 | |
| 24 | 24 | define('_SUB_REGEXP_SYMBOL', '[\w_:.-]'); |
| 25 | 25 | |
| 26 | -define('_REGEXP_NMTOKEN', '/^' . _SUB_REGEXP_SYMBOL . '+$/'); |
|
| 26 | +define('_REGEXP_NMTOKEN', '/^'._SUB_REGEXP_SYMBOL.'+$/'); |
|
| 27 | 27 | |
| 28 | -define('_REGEXP_NMTOKENS', '/^(' . _SUB_REGEXP_SYMBOL . '+\s*)*$/'); |
|
| 28 | +define('_REGEXP_NMTOKENS', '/^('._SUB_REGEXP_SYMBOL.'+\s*)*$/'); |
|
| 29 | 29 | |
| 30 | -define('_REGEXP_ID', '/^[A-Za-z_:]' . _SUB_REGEXP_SYMBOL . '*$/'); |
|
| 30 | +define('_REGEXP_ID', '/^[A-Za-z_:]'._SUB_REGEXP_SYMBOL.'*$/'); |
|
| 31 | 31 | |
| 32 | -define('_REGEXP_ENTITY_USE', '/%(' . _SUB_REGEXP_SYMBOL . '+);/'); |
|
| 33 | -define('_REGEXP_ENTITY_DEF', '/^%(' . _SUB_REGEXP_SYMBOL . '+);/'); |
|
| 32 | +define('_REGEXP_ENTITY_USE', '/%('._SUB_REGEXP_SYMBOL.'+);/'); |
|
| 33 | +define('_REGEXP_ENTITY_DEF', '/^%('._SUB_REGEXP_SYMBOL.'+);/'); |
|
| 34 | 34 | define('_REGEXP_TYPE_XML', 'PUBLIC|SYSTEM|INCLUDE|IGNORE|CDATA'); |
| 35 | -define('_REGEXP_ENTITY_DECL', '/^<!ENTITY\s+(%?)\s*(' . |
|
| 36 | - _SUB_REGEXP_SYMBOL . |
|
| 37 | - '+;?)\s+(' . |
|
| 38 | - _REGEXP_TYPE_XML . |
|
| 39 | - ')?\s*(' . |
|
| 40 | - "('([^']*)')" . |
|
| 41 | - '|("([^"]*)")' . |
|
| 42 | - '|\s*(%' . _SUB_REGEXP_SYMBOL . '+;)\s*' . |
|
| 35 | +define('_REGEXP_ENTITY_DECL', '/^<!ENTITY\s+(%?)\s*('. |
|
| 36 | + _SUB_REGEXP_SYMBOL. |
|
| 37 | + '+;?)\s+('. |
|
| 38 | + _REGEXP_TYPE_XML. |
|
| 39 | + ')?\s*('. |
|
| 40 | + "('([^']*)')". |
|
| 41 | + '|("([^"]*)")'. |
|
| 42 | + '|\s*(%'._SUB_REGEXP_SYMBOL.'+;)\s*'. |
|
| 43 | 43 | ')\s*(--.*?--)?("([^"]*)")?\s*>\s*(.*)$/s'); |
| 44 | 44 | |
| 45 | 45 | define('_REGEXP_INCLUDE_USE', '/^<!\[\s*%\s*([^;]*);\s*\[\s*(.*)$/s'); |
@@ -11,12 +11,12 @@ discard block |
||
| 11 | 11 | \***************************************************************************/ |
| 12 | 12 | |
| 13 | 13 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 14 | - return; |
|
| 14 | + return; |
|
| 15 | 15 | } |
| 16 | 16 | |
| 17 | 17 | define( |
| 18 | - '_REGEXP_DOCTYPE', |
|
| 19 | - '/^((?:<\001?[?][^>]*>\s*)*(?:<!--.*?-->\s*)*)*<!DOCTYPE\s+(\w+)\s+(\w+)\s*([^>]*)>\s*/s' |
|
| 18 | + '_REGEXP_DOCTYPE', |
|
| 19 | + '/^((?:<\001?[?][^>]*>\s*)*(?:<!--.*?-->\s*)*)*<!DOCTYPE\s+(\w+)\s+(\w+)\s*([^>]*)>\s*/s' |
|
| 20 | 20 | ); |
| 21 | 21 | |
| 22 | 22 | define('_REGEXP_XML', '/^(\s*(?:<[?][^x>][^>]*>\s*)?(?:<[?]xml[^>]*>)?\s*(?:<!--.*?-->\s*)*)<(\w+)/s'); |
@@ -35,14 +35,14 @@ discard block |
||
| 35 | 35 | define('_REGEXP_ENTITY_DEF', '/^%(' . _SUB_REGEXP_SYMBOL . '+);/'); |
| 36 | 36 | define('_REGEXP_TYPE_XML', 'PUBLIC|SYSTEM|INCLUDE|IGNORE|CDATA'); |
| 37 | 37 | define('_REGEXP_ENTITY_DECL', '/^<!ENTITY\s+(%?)\s*(' . |
| 38 | - _SUB_REGEXP_SYMBOL . |
|
| 39 | - '+;?)\s+(' . |
|
| 40 | - _REGEXP_TYPE_XML . |
|
| 41 | - ')?\s*(' . |
|
| 42 | - "('([^']*)')" . |
|
| 43 | - '|("([^"]*)")' . |
|
| 44 | - '|\s*(%' . _SUB_REGEXP_SYMBOL . '+;)\s*' . |
|
| 45 | - ')\s*(--.*?--)?("([^"]*)")?\s*>\s*(.*)$/s'); |
|
| 38 | + _SUB_REGEXP_SYMBOL . |
|
| 39 | + '+;?)\s+(' . |
|
| 40 | + _REGEXP_TYPE_XML . |
|
| 41 | + ')?\s*(' . |
|
| 42 | + "('([^']*)')" . |
|
| 43 | + '|("([^"]*)")' . |
|
| 44 | + '|\s*(%' . _SUB_REGEXP_SYMBOL . '+;)\s*' . |
|
| 45 | + ')\s*(--.*?--)?("([^"]*)")?\s*>\s*(.*)$/s'); |
|
| 46 | 46 | |
| 47 | 47 | define('_REGEXP_INCLUDE_USE', '/^<!\[\s*%\s*([^;]*);\s*\[\s*(.*)$/s'); |
| 48 | 48 | |
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | * Document Type Compilation |
| 53 | 53 | **/ |
| 54 | 54 | class DTC { |
| 55 | - public $macros = []; |
|
| 56 | - public $elements = []; |
|
| 57 | - public $peres = []; |
|
| 58 | - public $attributs = []; |
|
| 59 | - public $entites = []; |
|
| 60 | - public $regles = []; |
|
| 61 | - public $pcdata = []; |
|
| 55 | + public $macros = []; |
|
| 56 | + public $elements = []; |
|
| 57 | + public $peres = []; |
|
| 58 | + public $attributs = []; |
|
| 59 | + public $entites = []; |
|
| 60 | + public $regles = []; |
|
| 61 | + public $pcdata = []; |
|
| 62 | 62 | } |
@@ -2884,8 +2884,7 @@ |
||
| 2884 | 2884 | $_const = interprete_argument_balise(1, $p); |
| 2885 | 2885 | if (!strlen($_const)) { |
| 2886 | 2886 | $p->code = "''"; |
| 2887 | - } |
|
| 2888 | - else { |
|
| 2887 | + } else { |
|
| 2889 | 2888 | $p->code = "(defined($_const)?constant($_const):'')"; |
| 2890 | 2889 | } |
| 2891 | 2890 | $p->interdire_scripts = false; |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | **/ |
| 27 | 27 | |
| 28 | 28 | if (!defined('_ECRIRE_INC_VERSION')) { |
| 29 | - return; |
|
| 29 | + return; |
|
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -48,16 +48,16 @@ discard block |
||
| 48 | 48 | * Code PHP si cet argument est présent, sinon null |
| 49 | 49 | **/ |
| 50 | 50 | function interprete_argument_balise($n, $p) { |
| 51 | - if (($p->param) && (!$p->param[0][0]) && (count($p->param[0]) > $n)) { |
|
| 52 | - return calculer_liste( |
|
| 53 | - $p->param[0][$n], |
|
| 54 | - $p->descr, |
|
| 55 | - $p->boucles, |
|
| 56 | - $p->id_boucle |
|
| 57 | - ); |
|
| 58 | - } else { |
|
| 59 | - return null; |
|
| 60 | - } |
|
| 51 | + if (($p->param) && (!$p->param[0][0]) && (count($p->param[0]) > $n)) { |
|
| 52 | + return calculer_liste( |
|
| 53 | + $p->param[0][$n], |
|
| 54 | + $p->descr, |
|
| 55 | + $p->boucles, |
|
| 56 | + $p->id_boucle |
|
| 57 | + ); |
|
| 58 | + } else { |
|
| 59 | + return null; |
|
| 60 | + } |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
@@ -77,10 +77,10 @@ discard block |
||
| 77 | 77 | * Pile complétée par le code à générer |
| 78 | 78 | **/ |
| 79 | 79 | function balise_NOM_SITE_SPIP_dist($p) { |
| 80 | - $p->code = "\$GLOBALS['meta']['nom_site']"; |
|
| 80 | + $p->code = "\$GLOBALS['meta']['nom_site']"; |
|
| 81 | 81 | |
| 82 | - #$p->interdire_scripts = true; |
|
| 83 | - return $p; |
|
| 82 | + #$p->interdire_scripts = true; |
|
| 83 | + return $p; |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | * Pile complétée par le code à générer |
| 97 | 97 | **/ |
| 98 | 98 | function balise_EMAIL_WEBMASTER_dist($p) { |
| 99 | - $p->code = "\$GLOBALS['meta']['email_webmaster']"; |
|
| 99 | + $p->code = "\$GLOBALS['meta']['email_webmaster']"; |
|
| 100 | 100 | |
| 101 | - #$p->interdire_scripts = true; |
|
| 102 | - return $p; |
|
| 101 | + #$p->interdire_scripts = true; |
|
| 102 | + return $p; |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | /** |
@@ -115,10 +115,10 @@ discard block |
||
| 115 | 115 | * Pile complétée par le code à générer |
| 116 | 116 | **/ |
| 117 | 117 | function balise_DESCRIPTIF_SITE_SPIP_dist($p) { |
| 118 | - $p->code = "\$GLOBALS['meta']['descriptif_site']"; |
|
| 118 | + $p->code = "\$GLOBALS['meta']['descriptif_site']"; |
|
| 119 | 119 | |
| 120 | - #$p->interdire_scripts = true; |
|
| 121 | - return $p; |
|
| 120 | + #$p->interdire_scripts = true; |
|
| 121 | + return $p; |
|
| 122 | 122 | } |
| 123 | 123 | |
| 124 | 124 | |
@@ -139,10 +139,10 @@ discard block |
||
| 139 | 139 | * Pile complétée par le code à générer |
| 140 | 140 | **/ |
| 141 | 141 | function balise_CHARSET_dist($p) { |
| 142 | - $p->code = "\$GLOBALS['meta']['charset']"; |
|
| 142 | + $p->code = "\$GLOBALS['meta']['charset']"; |
|
| 143 | 143 | |
| 144 | - #$p->interdire_scripts = true; |
|
| 145 | - return $p; |
|
| 144 | + #$p->interdire_scripts = true; |
|
| 145 | + return $p; |
|
| 146 | 146 | } |
| 147 | 147 | |
| 148 | 148 | /** |
@@ -167,11 +167,11 @@ discard block |
||
| 167 | 167 | * Pile complétée par le code à générer |
| 168 | 168 | **/ |
| 169 | 169 | function balise_LANG_LEFT_dist($p) { |
| 170 | - $_lang = champ_sql('lang', $p); |
|
| 171 | - $p->code = "lang_dir($_lang, 'left','right')"; |
|
| 172 | - $p->interdire_scripts = false; |
|
| 170 | + $_lang = champ_sql('lang', $p); |
|
| 171 | + $p->code = "lang_dir($_lang, 'left','right')"; |
|
| 172 | + $p->interdire_scripts = false; |
|
| 173 | 173 | |
| 174 | - return $p; |
|
| 174 | + return $p; |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | /** |
@@ -191,11 +191,11 @@ discard block |
||
| 191 | 191 | * Pile complétée par le code à générer |
| 192 | 192 | **/ |
| 193 | 193 | function balise_LANG_RIGHT_dist($p) { |
| 194 | - $_lang = champ_sql('lang', $p); |
|
| 195 | - $p->code = "lang_dir($_lang, 'right','left')"; |
|
| 196 | - $p->interdire_scripts = false; |
|
| 194 | + $_lang = champ_sql('lang', $p); |
|
| 195 | + $p->code = "lang_dir($_lang, 'right','left')"; |
|
| 196 | + $p->interdire_scripts = false; |
|
| 197 | 197 | |
| 198 | - return $p; |
|
| 198 | + return $p; |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | /** |
@@ -220,11 +220,11 @@ discard block |
||
| 220 | 220 | * Pile complétée par le code à générer |
| 221 | 221 | **/ |
| 222 | 222 | function balise_LANG_DIR_dist($p) { |
| 223 | - $_lang = champ_sql('lang', $p); |
|
| 224 | - $p->code = "lang_dir($_lang, 'ltr','rtl')"; |
|
| 225 | - $p->interdire_scripts = false; |
|
| 223 | + $_lang = champ_sql('lang', $p); |
|
| 224 | + $p->code = "lang_dir($_lang, 'ltr','rtl')"; |
|
| 225 | + $p->interdire_scripts = false; |
|
| 226 | 226 | |
| 227 | - return $p; |
|
| 227 | + return $p; |
|
| 228 | 228 | } |
| 229 | 229 | |
| 230 | 230 | |
@@ -241,10 +241,10 @@ discard block |
||
| 241 | 241 | * Pile complétée par le code à générer |
| 242 | 242 | **/ |
| 243 | 243 | function balise_PUCE_dist($p) { |
| 244 | - $p->code = 'definir_puce()'; |
|
| 245 | - $p->interdire_scripts = false; |
|
| 244 | + $p->code = 'definir_puce()'; |
|
| 245 | + $p->interdire_scripts = false; |
|
| 246 | 246 | |
| 247 | - return $p; |
|
| 247 | + return $p; |
|
| 248 | 248 | } |
| 249 | 249 | |
| 250 | 250 | |
@@ -268,12 +268,12 @@ discard block |
||
| 268 | 268 | * Pile completée du code PHP d'exécution de la balise |
| 269 | 269 | */ |
| 270 | 270 | function balise_DATE_dist($p) { |
| 271 | - $d = champ_sql('date', $p); |
|
| 271 | + $d = champ_sql('date', $p); |
|
| 272 | 272 | # if ($d === "@\$Pile[0]['date']") |
| 273 | 273 | # $d = "isset(\$Pile[0]['date']) ? $d : time()"; |
| 274 | - $p->code = $d; |
|
| 274 | + $p->code = $d; |
|
| 275 | 275 | |
| 276 | - return $p; |
|
| 276 | + return $p; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | |
@@ -293,13 +293,13 @@ discard block |
||
| 293 | 293 | * Pile completée du code PHP d'exécution de la balise |
| 294 | 294 | */ |
| 295 | 295 | function balise_DATE_REDAC_dist($p) { |
| 296 | - $d = champ_sql('date_redac', $p); |
|
| 296 | + $d = champ_sql('date_redac', $p); |
|
| 297 | 297 | # if ($d === "@\$Pile[0]['date_redac']") |
| 298 | 298 | # $d = "isset(\$Pile[0]['date_redac']) ? $d : time()"; |
| 299 | - $p->code = $d; |
|
| 300 | - $p->interdire_scripts = false; |
|
| 299 | + $p->code = $d; |
|
| 300 | + $p->interdire_scripts = false; |
|
| 301 | 301 | |
| 302 | - return $p; |
|
| 302 | + return $p; |
|
| 303 | 303 | } |
| 304 | 304 | |
| 305 | 305 | /** |
@@ -318,10 +318,10 @@ discard block |
||
| 318 | 318 | * Pile completée du code PHP d'exécution de la balise |
| 319 | 319 | */ |
| 320 | 320 | function balise_DATE_MODIF_dist($p) { |
| 321 | - $p->code = champ_sql('date_modif', $p); |
|
| 322 | - $p->interdire_scripts = false; |
|
| 321 | + $p->code = champ_sql('date_modif', $p); |
|
| 322 | + $p->interdire_scripts = false; |
|
| 323 | 323 | |
| 324 | - return $p; |
|
| 324 | + return $p; |
|
| 325 | 325 | } |
| 326 | 326 | |
| 327 | 327 | /** |
@@ -339,13 +339,13 @@ discard block |
||
| 339 | 339 | * Pile completée du code PHP d'exécution de la balise |
| 340 | 340 | */ |
| 341 | 341 | function balise_DATE_NOUVEAUTES_dist($p) { |
| 342 | - $p->code = "((\$GLOBALS['meta']['quoi_de_neuf'] == 'oui' |
|
| 342 | + $p->code = "((\$GLOBALS['meta']['quoi_de_neuf'] == 'oui' |
|
| 343 | 343 | AND isset(\$GLOBALS['meta']['dernier_envoi_neuf'])) ? |
| 344 | 344 | \$GLOBALS['meta']['dernier_envoi_neuf'] : |
| 345 | 345 | \"'0000-00-00'\")"; |
| 346 | - $p->interdire_scripts = false; |
|
| 346 | + $p->interdire_scripts = false; |
|
| 347 | 347 | |
| 348 | - return $p; |
|
| 348 | + return $p; |
|
| 349 | 349 | } |
| 350 | 350 | |
| 351 | 351 | |
@@ -363,11 +363,11 @@ discard block |
||
| 363 | 363 | * Pile completée du code PHP d'exécution de la balise |
| 364 | 364 | */ |
| 365 | 365 | function balise_DOSSIER_SQUELETTE_dist($p) { |
| 366 | - $code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE)); |
|
| 367 | - $p->code = "_DIR_RACINE . '$code'" . |
|
| 368 | - $p->interdire_scripts = false; |
|
| 366 | + $code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE)); |
|
| 367 | + $p->code = "_DIR_RACINE . '$code'" . |
|
| 368 | + $p->interdire_scripts = false; |
|
| 369 | 369 | |
| 370 | - return $p; |
|
| 370 | + return $p; |
|
| 371 | 371 | } |
| 372 | 372 | |
| 373 | 373 | /** |
@@ -382,11 +382,11 @@ discard block |
||
| 382 | 382 | * Pile completée du code PHP d'exécution de la balise |
| 383 | 383 | */ |
| 384 | 384 | function balise_SQUELETTE_dist($p) { |
| 385 | - $code = addslashes($p->descr['sourcefile']); |
|
| 386 | - $p->code = "'$code'" . |
|
| 387 | - $p->interdire_scripts = false; |
|
| 385 | + $code = addslashes($p->descr['sourcefile']); |
|
| 386 | + $p->code = "'$code'" . |
|
| 387 | + $p->interdire_scripts = false; |
|
| 388 | 388 | |
| 389 | - return $p; |
|
| 389 | + return $p; |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | /** |
@@ -405,10 +405,10 @@ discard block |
||
| 405 | 405 | * Pile completée du code PHP d'exécution de la balise |
| 406 | 406 | */ |
| 407 | 407 | function balise_SPIP_VERSION_dist($p) { |
| 408 | - $p->code = 'spip_version()'; |
|
| 409 | - $p->interdire_scripts = false; |
|
| 408 | + $p->code = 'spip_version()'; |
|
| 409 | + $p->interdire_scripts = false; |
|
| 410 | 410 | |
| 411 | - return $p; |
|
| 411 | + return $p; |
|
| 412 | 412 | } |
| 413 | 413 | |
| 414 | 414 | |
@@ -434,18 +434,18 @@ discard block |
||
| 434 | 434 | * Pile complétée par le code à générer |
| 435 | 435 | **/ |
| 436 | 436 | function balise_NOM_SITE_dist($p) { |
| 437 | - if (!$p->etoile) { |
|
| 438 | - $p->code = 'supprimer_numero(calculer_url(' . |
|
| 439 | - champ_sql('url_site', $p) . ',' . |
|
| 440 | - champ_sql('nom_site', $p) . |
|
| 441 | - ", 'titre', \$connect, false))"; |
|
| 442 | - } else { |
|
| 443 | - $p->code = champ_sql('nom_site', $p); |
|
| 444 | - } |
|
| 437 | + if (!$p->etoile) { |
|
| 438 | + $p->code = 'supprimer_numero(calculer_url(' . |
|
| 439 | + champ_sql('url_site', $p) . ',' . |
|
| 440 | + champ_sql('nom_site', $p) . |
|
| 441 | + ", 'titre', \$connect, false))"; |
|
| 442 | + } else { |
|
| 443 | + $p->code = champ_sql('nom_site', $p); |
|
| 444 | + } |
|
| 445 | 445 | |
| 446 | - $p->interdire_scripts = true; |
|
| 446 | + $p->interdire_scripts = true; |
|
| 447 | 447 | |
| 448 | - return $p; |
|
| 448 | + return $p; |
|
| 449 | 449 | } |
| 450 | 450 | |
| 451 | 451 | |
@@ -462,11 +462,11 @@ discard block |
||
| 462 | 462 | * Pile complétée par le code à générer |
| 463 | 463 | **/ |
| 464 | 464 | function balise_NOTES_dist($p) { |
| 465 | - // Recuperer les notes |
|
| 466 | - $p->code = 'calculer_notes()'; |
|
| 465 | + // Recuperer les notes |
|
| 466 | + $p->code = 'calculer_notes()'; |
|
| 467 | 467 | |
| 468 | - #$p->interdire_scripts = true; |
|
| 469 | - return $p; |
|
| 468 | + #$p->interdire_scripts = true; |
|
| 469 | + return $p; |
|
| 470 | 470 | } |
| 471 | 471 | |
| 472 | 472 | |
@@ -488,10 +488,10 @@ discard block |
||
| 488 | 488 | * Pile complétée par le code à générer |
| 489 | 489 | **/ |
| 490 | 490 | function balise_RECHERCHE_dist($p) { |
| 491 | - $p->code = 'entites_html(_request("recherche"))'; |
|
| 492 | - $p->interdire_scripts = false; |
|
| 491 | + $p->code = 'entites_html(_request("recherche"))'; |
|
| 492 | + $p->interdire_scripts = false; |
|
| 493 | 493 | |
| 494 | - return $p; |
|
| 494 | + return $p; |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | |
@@ -509,17 +509,17 @@ discard block |
||
| 509 | 509 | * Pile complétée par le code à générer |
| 510 | 510 | **/ |
| 511 | 511 | function balise_COMPTEUR_BOUCLE_dist($p) { |
| 512 | - $b = index_boucle_mere($p); |
|
| 513 | - if ($b === '') { |
|
| 514 | - $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 515 | - erreur_squelette($msg, $p); |
|
| 516 | - } else { |
|
| 517 | - $p->code = "\$Numrows['$b']['compteur_boucle']"; |
|
| 518 | - $p->boucles[$b]->cptrows = true; |
|
| 519 | - $p->interdire_scripts = false; |
|
| 512 | + $b = index_boucle_mere($p); |
|
| 513 | + if ($b === '') { |
|
| 514 | + $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 515 | + erreur_squelette($msg, $p); |
|
| 516 | + } else { |
|
| 517 | + $p->code = "\$Numrows['$b']['compteur_boucle']"; |
|
| 518 | + $p->boucles[$b]->cptrows = true; |
|
| 519 | + $p->interdire_scripts = false; |
|
| 520 | 520 | |
| 521 | - return $p; |
|
| 522 | - } |
|
| 521 | + return $p; |
|
| 522 | + } |
|
| 523 | 523 | } |
| 524 | 524 | |
| 525 | 525 | /** |
@@ -537,17 +537,17 @@ discard block |
||
| 537 | 537 | * Pile complétée par le code à générer |
| 538 | 538 | **/ |
| 539 | 539 | function balise_TOTAL_BOUCLE_dist($p) { |
| 540 | - $b = index_boucle_mere($p); |
|
| 541 | - if ($b === '') { |
|
| 542 | - $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 543 | - erreur_squelette($msg, $p); |
|
| 544 | - } else { |
|
| 545 | - $p->code = "\$Numrows['$b']['total']"; |
|
| 546 | - $p->boucles[$b]->numrows = true; |
|
| 547 | - $p->interdire_scripts = false; |
|
| 548 | - } |
|
| 540 | + $b = index_boucle_mere($p); |
|
| 541 | + if ($b === '') { |
|
| 542 | + $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 543 | + erreur_squelette($msg, $p); |
|
| 544 | + } else { |
|
| 545 | + $p->code = "\$Numrows['$b']['total']"; |
|
| 546 | + $p->boucles[$b]->numrows = true; |
|
| 547 | + $p->interdire_scripts = false; |
|
| 548 | + } |
|
| 549 | 549 | |
| 550 | - return $p; |
|
| 550 | + return $p; |
|
| 551 | 551 | } |
| 552 | 552 | |
| 553 | 553 | |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | * Pile complétée par le code à générer |
| 568 | 568 | **/ |
| 569 | 569 | function balise_POINTS_dist($p) { |
| 570 | - return rindex_pile($p, 'points', 'recherche'); |
|
| 570 | + return rindex_pile($p, 'points', 'recherche'); |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | |
@@ -588,12 +588,12 @@ discard block |
||
| 588 | 588 | * Pile complétée par le code à générer |
| 589 | 589 | **/ |
| 590 | 590 | function balise_POPULARITE_ABSOLUE_dist($p) { |
| 591 | - $p->code = 'ceil(' . |
|
| 592 | - champ_sql('popularite', $p) . |
|
| 593 | - ')'; |
|
| 594 | - $p->interdire_scripts = false; |
|
| 591 | + $p->code = 'ceil(' . |
|
| 592 | + champ_sql('popularite', $p) . |
|
| 593 | + ')'; |
|
| 594 | + $p->interdire_scripts = false; |
|
| 595 | 595 | |
| 596 | - return $p; |
|
| 596 | + return $p; |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | /** |
@@ -613,10 +613,10 @@ discard block |
||
| 613 | 613 | * Pile complétée par le code à générer |
| 614 | 614 | **/ |
| 615 | 615 | function balise_POPULARITE_SITE_dist($p) { |
| 616 | - $p->code = 'ceil($GLOBALS["meta"][\'popularite_total\'])'; |
|
| 617 | - $p->interdire_scripts = false; |
|
| 616 | + $p->code = 'ceil($GLOBALS["meta"][\'popularite_total\'])'; |
|
| 617 | + $p->interdire_scripts = false; |
|
| 618 | 618 | |
| 619 | - return $p; |
|
| 619 | + return $p; |
|
| 620 | 620 | } |
| 621 | 621 | |
| 622 | 622 | /** |
@@ -637,10 +637,10 @@ discard block |
||
| 637 | 637 | * Pile complétée par le code à générer |
| 638 | 638 | **/ |
| 639 | 639 | function balise_POPULARITE_MAX_dist($p) { |
| 640 | - $p->code = 'ceil($GLOBALS["meta"][\'popularite_max\'])'; |
|
| 641 | - $p->interdire_scripts = false; |
|
| 640 | + $p->code = 'ceil($GLOBALS["meta"][\'popularite_max\'])'; |
|
| 641 | + $p->interdire_scripts = false; |
|
| 642 | 642 | |
| 643 | - return $p; |
|
| 643 | + return $p; |
|
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | |
@@ -666,15 +666,15 @@ discard block |
||
| 666 | 666 | * Pile complétée par le code à générer |
| 667 | 667 | **/ |
| 668 | 668 | function balise_VALEUR_dist($p) { |
| 669 | - $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
|
| 670 | - $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b); |
|
| 669 | + $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
|
| 670 | + $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b); |
|
| 671 | 671 | ; |
| 672 | - if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 673 | - $p->code = 'table_valeur(' . $p->code . ', ' . $v . ')'; |
|
| 674 | - } |
|
| 675 | - $p->interdire_scripts = true; |
|
| 672 | + if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 673 | + $p->code = 'table_valeur(' . $p->code . ', ' . $v . ')'; |
|
| 674 | + } |
|
| 675 | + $p->interdire_scripts = true; |
|
| 676 | 676 | |
| 677 | - return $p; |
|
| 677 | + return $p; |
|
| 678 | 678 | } |
| 679 | 679 | |
| 680 | 680 | /** |
@@ -703,16 +703,16 @@ discard block |
||
| 703 | 703 | * Pile complétée par le code à générer |
| 704 | 704 | **/ |
| 705 | 705 | function balise_EXPOSE_dist($p) { |
| 706 | - $on = "'on'"; |
|
| 707 | - $off = "''"; |
|
| 708 | - if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 709 | - $on = $v; |
|
| 710 | - if (($v = interprete_argument_balise(2, $p)) !== null) { |
|
| 711 | - $off = $v; |
|
| 712 | - } |
|
| 713 | - } |
|
| 706 | + $on = "'on'"; |
|
| 707 | + $off = "''"; |
|
| 708 | + if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 709 | + $on = $v; |
|
| 710 | + if (($v = interprete_argument_balise(2, $p)) !== null) { |
|
| 711 | + $off = $v; |
|
| 712 | + } |
|
| 713 | + } |
|
| 714 | 714 | |
| 715 | - return calculer_balise_expose($p, $on, $off); |
|
| 715 | + return calculer_balise_expose($p, $on, $off); |
|
| 716 | 716 | } |
| 717 | 717 | |
| 718 | 718 | /** |
@@ -730,35 +730,35 @@ discard block |
||
| 730 | 730 | * Pile complétée par le code à générer |
| 731 | 731 | **/ |
| 732 | 732 | function calculer_balise_expose($p, $on, $off) { |
| 733 | - $b = index_boucle($p); |
|
| 734 | - if (empty($p->boucles[$b]->primary)) { |
|
| 735 | - $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 736 | - erreur_squelette($msg, $p); |
|
| 737 | - } else { |
|
| 738 | - $key = $p->boucles[$b]->primary; |
|
| 739 | - $type = $p->boucles[$p->id_boucle]->primary; |
|
| 740 | - $desc = $p->boucles[$b]->show; |
|
| 741 | - $connect = sql_quote($p->boucles[$b]->sql_serveur); |
|
| 733 | + $b = index_boucle($p); |
|
| 734 | + if (empty($p->boucles[$b]->primary)) { |
|
| 735 | + $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 736 | + erreur_squelette($msg, $p); |
|
| 737 | + } else { |
|
| 738 | + $key = $p->boucles[$b]->primary; |
|
| 739 | + $type = $p->boucles[$p->id_boucle]->primary; |
|
| 740 | + $desc = $p->boucles[$b]->show; |
|
| 741 | + $connect = sql_quote($p->boucles[$b]->sql_serveur); |
|
| 742 | 742 | |
| 743 | - // Ne pas utiliser champ_sql, on jongle avec le nom boucle explicite |
|
| 744 | - $c = index_pile($p->id_boucle, $type, $p->boucles); |
|
| 743 | + // Ne pas utiliser champ_sql, on jongle avec le nom boucle explicite |
|
| 744 | + $c = index_pile($p->id_boucle, $type, $p->boucles); |
|
| 745 | 745 | |
| 746 | - if (isset($desc['field']['id_parent'])) { |
|
| 747 | - $parent = 0; // pour if (!$parent) dans calculer_expose |
|
| 748 | - } elseif (isset($desc['field']['id_rubrique'])) { |
|
| 749 | - $parent = index_pile($p->id_boucle, 'id_rubrique', $p->boucles, $b); |
|
| 750 | - } elseif (isset($desc['field']['id_groupe'])) { |
|
| 751 | - $parent = index_pile($p->id_boucle, 'id_groupe', $p->boucles, $b); |
|
| 752 | - } else { |
|
| 753 | - $parent = "''"; |
|
| 754 | - } |
|
| 746 | + if (isset($desc['field']['id_parent'])) { |
|
| 747 | + $parent = 0; // pour if (!$parent) dans calculer_expose |
|
| 748 | + } elseif (isset($desc['field']['id_rubrique'])) { |
|
| 749 | + $parent = index_pile($p->id_boucle, 'id_rubrique', $p->boucles, $b); |
|
| 750 | + } elseif (isset($desc['field']['id_groupe'])) { |
|
| 751 | + $parent = index_pile($p->id_boucle, 'id_groupe', $p->boucles, $b); |
|
| 752 | + } else { |
|
| 753 | + $parent = "''"; |
|
| 754 | + } |
|
| 755 | 755 | |
| 756 | - $p->code = "(calcul_exposer($c, '$type', \$Pile[0], $parent, '$key', $connect) ? $on : $off)"; |
|
| 757 | - } |
|
| 756 | + $p->code = "(calcul_exposer($c, '$type', \$Pile[0], $parent, '$key', $connect) ? $on : $off)"; |
|
| 757 | + } |
|
| 758 | 758 | |
| 759 | - $p->interdire_scripts = false; |
|
| 759 | + $p->interdire_scripts = false; |
|
| 760 | 760 | |
| 761 | - return $p; |
|
| 761 | + return $p; |
|
| 762 | 762 | } |
| 763 | 763 | |
| 764 | 764 | |
@@ -798,46 +798,46 @@ discard block |
||
| 798 | 798 | **/ |
| 799 | 799 | function balise_INTRODUCTION_dist($p) { |
| 800 | 800 | |
| 801 | - $type_objet = $p->type_requete; |
|
| 802 | - $cle_objet = id_table_objet($type_objet); |
|
| 803 | - $_id_objet = champ_sql($cle_objet, $p); |
|
| 804 | - |
|
| 805 | - // Récupérer les valeurs sql nécessaires : descriptif, texte et chapo |
|
| 806 | - // ainsi que le longueur d'introduction donnée dans la description de l'objet. |
|
| 807 | - $_introduction_longueur = 'null'; |
|
| 808 | - $_ligne = 'array('; |
|
| 809 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 810 | - if ($desc = $trouver_table(table_objet_sql($type_objet))) { |
|
| 811 | - if (isset($desc['field']['descriptif'])) { |
|
| 812 | - $_ligne .= "'descriptif' => " . champ_sql('descriptif', $p) . ','; |
|
| 813 | - } |
|
| 814 | - if (isset($desc['field']['texte'])) { |
|
| 815 | - $_ligne .= "'texte' => " . champ_sql('texte', $p) . ','; |
|
| 816 | - } |
|
| 817 | - if (isset($desc['field']['chapo'])) { |
|
| 818 | - $_ligne .= "'chapo' => " . champ_sql('chapo', $p) . ','; |
|
| 819 | - } |
|
| 820 | - if (isset($desc['introduction_longueur'])) { |
|
| 821 | - $_introduction_longueur = "'" . $desc['introduction_longueur'] . "'"; |
|
| 822 | - } |
|
| 823 | - } |
|
| 824 | - $_ligne .= ')'; |
|
| 825 | - |
|
| 826 | - // Récupérer la longueur et la suite passés en paramètres |
|
| 827 | - $_longueur_ou_suite = 'null'; |
|
| 828 | - if (($v1 = interprete_argument_balise(1, $p)) !== null) { |
|
| 829 | - $_longueur_ou_suite = $v1; |
|
| 830 | - } |
|
| 831 | - $_suite = 'null'; |
|
| 832 | - if (($v2 = interprete_argument_balise(2, $p)) !== null) { |
|
| 833 | - $_suite = $v2; |
|
| 834 | - } |
|
| 835 | - |
|
| 836 | - $p->code = "generer_introduction_entite($_id_objet, '$type_objet', $_ligne, $_introduction_longueur, $_longueur_ou_suite, $_suite, \$connect)"; |
|
| 837 | - |
|
| 838 | - #$p->interdire_scripts = true; |
|
| 839 | - $p->etoile = '*'; // propre est deja fait dans le calcul de l'intro |
|
| 840 | - return $p; |
|
| 801 | + $type_objet = $p->type_requete; |
|
| 802 | + $cle_objet = id_table_objet($type_objet); |
|
| 803 | + $_id_objet = champ_sql($cle_objet, $p); |
|
| 804 | + |
|
| 805 | + // Récupérer les valeurs sql nécessaires : descriptif, texte et chapo |
|
| 806 | + // ainsi que le longueur d'introduction donnée dans la description de l'objet. |
|
| 807 | + $_introduction_longueur = 'null'; |
|
| 808 | + $_ligne = 'array('; |
|
| 809 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 810 | + if ($desc = $trouver_table(table_objet_sql($type_objet))) { |
|
| 811 | + if (isset($desc['field']['descriptif'])) { |
|
| 812 | + $_ligne .= "'descriptif' => " . champ_sql('descriptif', $p) . ','; |
|
| 813 | + } |
|
| 814 | + if (isset($desc['field']['texte'])) { |
|
| 815 | + $_ligne .= "'texte' => " . champ_sql('texte', $p) . ','; |
|
| 816 | + } |
|
| 817 | + if (isset($desc['field']['chapo'])) { |
|
| 818 | + $_ligne .= "'chapo' => " . champ_sql('chapo', $p) . ','; |
|
| 819 | + } |
|
| 820 | + if (isset($desc['introduction_longueur'])) { |
|
| 821 | + $_introduction_longueur = "'" . $desc['introduction_longueur'] . "'"; |
|
| 822 | + } |
|
| 823 | + } |
|
| 824 | + $_ligne .= ')'; |
|
| 825 | + |
|
| 826 | + // Récupérer la longueur et la suite passés en paramètres |
|
| 827 | + $_longueur_ou_suite = 'null'; |
|
| 828 | + if (($v1 = interprete_argument_balise(1, $p)) !== null) { |
|
| 829 | + $_longueur_ou_suite = $v1; |
|
| 830 | + } |
|
| 831 | + $_suite = 'null'; |
|
| 832 | + if (($v2 = interprete_argument_balise(2, $p)) !== null) { |
|
| 833 | + $_suite = $v2; |
|
| 834 | + } |
|
| 835 | + |
|
| 836 | + $p->code = "generer_introduction_entite($_id_objet, '$type_objet', $_ligne, $_introduction_longueur, $_longueur_ou_suite, $_suite, \$connect)"; |
|
| 837 | + |
|
| 838 | + #$p->interdire_scripts = true; |
|
| 839 | + $p->etoile = '*'; // propre est deja fait dans le calcul de l'intro |
|
| 840 | + return $p; |
|
| 841 | 841 | } |
| 842 | 842 | |
| 843 | 843 | |
@@ -857,15 +857,15 @@ discard block |
||
| 857 | 857 | * Pile complétée par le code à générer |
| 858 | 858 | **/ |
| 859 | 859 | function balise_LANG_dist($p) { |
| 860 | - $_lang = champ_sql('lang', $p); |
|
| 861 | - if (!$p->etoile) { |
|
| 862 | - $p->code = "spip_htmlentities($_lang ? $_lang : \$GLOBALS['spip_lang'])"; |
|
| 863 | - } else { |
|
| 864 | - $p->code = "spip_htmlentities($_lang)"; |
|
| 865 | - } |
|
| 866 | - $p->interdire_scripts = false; |
|
| 860 | + $_lang = champ_sql('lang', $p); |
|
| 861 | + if (!$p->etoile) { |
|
| 862 | + $p->code = "spip_htmlentities($_lang ? $_lang : \$GLOBALS['spip_lang'])"; |
|
| 863 | + } else { |
|
| 864 | + $p->code = "spip_htmlentities($_lang)"; |
|
| 865 | + } |
|
| 866 | + $p->interdire_scripts = false; |
|
| 867 | 867 | |
| 868 | - return $p; |
|
| 868 | + return $p; |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | 871 | /** |
@@ -887,48 +887,48 @@ discard block |
||
| 887 | 887 | * Pile complétée par le code à générer |
| 888 | 888 | */ |
| 889 | 889 | function balise_LESAUTEURS_dist($p) { |
| 890 | - // Cherche le champ 'lesauteurs' dans la pile |
|
| 891 | - $_lesauteurs = champ_sql('lesauteurs', $p, false); |
|
| 892 | - |
|
| 893 | - // Si le champ n'existe pas (cas de spip_articles), on applique |
|
| 894 | - // le modele lesauteurs.html en passant id_article dans le contexte; |
|
| 895 | - // dans le cas contraire on prend le champ 'lesauteurs' |
|
| 896 | - // (cf extension sites/) |
|
| 897 | - if ( |
|
| 898 | - $_lesauteurs |
|
| 899 | - and $_lesauteurs != '@$Pile[0][\'lesauteurs\']' |
|
| 900 | - ) { |
|
| 901 | - $p->code = "safehtml($_lesauteurs)"; |
|
| 902 | - // $p->interdire_scripts = true; |
|
| 903 | - } else { |
|
| 904 | - if (!$p->id_boucle) { |
|
| 905 | - $connect = ''; |
|
| 906 | - $objet = 'article'; |
|
| 907 | - $id_table_objet = 'id_article'; |
|
| 908 | - } else { |
|
| 909 | - $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
|
| 910 | - $connect = $p->boucles[$b]->sql_serveur; |
|
| 911 | - $type_boucle = $p->boucles[$b]->type_requete; |
|
| 912 | - $objet = objet_type($type_boucle); |
|
| 913 | - $id_table_objet = id_table_objet($type_boucle); |
|
| 914 | - } |
|
| 915 | - $c = memoriser_contexte_compil($p); |
|
| 916 | - |
|
| 917 | - $p->code = sprintf( |
|
| 918 | - CODE_RECUPERER_FOND, |
|
| 919 | - "'modeles/lesauteurs'", |
|
| 920 | - "array('objet'=>'" . $objet . |
|
| 921 | - "','id_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 922 | - ",'$id_table_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 923 | - ($objet == 'article' ? '' : ",'id_article' => " . champ_sql('id_article', $p)) . |
|
| 924 | - ')', |
|
| 925 | - "'trim'=>true, 'compil'=>array($c)", |
|
| 926 | - _q($connect) |
|
| 927 | - ); |
|
| 928 | - $p->interdire_scripts = false; // securite apposee par recuperer_fond() |
|
| 929 | - } |
|
| 930 | - |
|
| 931 | - return $p; |
|
| 890 | + // Cherche le champ 'lesauteurs' dans la pile |
|
| 891 | + $_lesauteurs = champ_sql('lesauteurs', $p, false); |
|
| 892 | + |
|
| 893 | + // Si le champ n'existe pas (cas de spip_articles), on applique |
|
| 894 | + // le modele lesauteurs.html en passant id_article dans le contexte; |
|
| 895 | + // dans le cas contraire on prend le champ 'lesauteurs' |
|
| 896 | + // (cf extension sites/) |
|
| 897 | + if ( |
|
| 898 | + $_lesauteurs |
|
| 899 | + and $_lesauteurs != '@$Pile[0][\'lesauteurs\']' |
|
| 900 | + ) { |
|
| 901 | + $p->code = "safehtml($_lesauteurs)"; |
|
| 902 | + // $p->interdire_scripts = true; |
|
| 903 | + } else { |
|
| 904 | + if (!$p->id_boucle) { |
|
| 905 | + $connect = ''; |
|
| 906 | + $objet = 'article'; |
|
| 907 | + $id_table_objet = 'id_article'; |
|
| 908 | + } else { |
|
| 909 | + $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
|
| 910 | + $connect = $p->boucles[$b]->sql_serveur; |
|
| 911 | + $type_boucle = $p->boucles[$b]->type_requete; |
|
| 912 | + $objet = objet_type($type_boucle); |
|
| 913 | + $id_table_objet = id_table_objet($type_boucle); |
|
| 914 | + } |
|
| 915 | + $c = memoriser_contexte_compil($p); |
|
| 916 | + |
|
| 917 | + $p->code = sprintf( |
|
| 918 | + CODE_RECUPERER_FOND, |
|
| 919 | + "'modeles/lesauteurs'", |
|
| 920 | + "array('objet'=>'" . $objet . |
|
| 921 | + "','id_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 922 | + ",'$id_table_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 923 | + ($objet == 'article' ? '' : ",'id_article' => " . champ_sql('id_article', $p)) . |
|
| 924 | + ')', |
|
| 925 | + "'trim'=>true, 'compil'=>array($c)", |
|
| 926 | + _q($connect) |
|
| 927 | + ); |
|
| 928 | + $p->interdire_scripts = false; // securite apposee par recuperer_fond() |
|
| 929 | + } |
|
| 930 | + |
|
| 931 | + return $p; |
|
| 932 | 932 | } |
| 933 | 933 | |
| 934 | 934 | |
@@ -955,76 +955,76 @@ discard block |
||
| 955 | 955 | * Pile complétée par le code à générer |
| 956 | 956 | */ |
| 957 | 957 | function balise_RANG_dist($p) { |
| 958 | - $b = index_boucle($p); |
|
| 959 | - if ($b === '') { |
|
| 960 | - $msg = [ |
|
| 961 | - 'zbug_champ_hors_boucle', |
|
| 962 | - ['champ' => '#RANG'] |
|
| 963 | - ]; |
|
| 964 | - erreur_squelette($msg, $p); |
|
| 965 | - } else { |
|
| 966 | - // chercher d'abord un champ sql rang (mais pas dans le env : defaut '' si on trouve pas de champ sql) |
|
| 967 | - // dans la boucle immediatement englobante uniquement |
|
| 968 | - // sinon on compose le champ calcule |
|
| 969 | - $_rang = champ_sql('rang', $p, '', false); |
|
| 970 | - |
|
| 971 | - // si pas trouve de champ sql rang : |
|
| 972 | - if (!$_rang or $_rang == "''") { |
|
| 973 | - $boucle = &$p->boucles[$b]; |
|
| 974 | - |
|
| 975 | - // on gere le cas ou #RANG est une extraction du numero dans le titre |
|
| 976 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 977 | - $desc = $trouver_table($boucle->id_table); |
|
| 978 | - $_titre = ''; # où extraire le numero ? |
|
| 979 | - |
|
| 980 | - if (isset($desc['titre'])) { |
|
| 981 | - $t = $desc['titre']; |
|
| 982 | - if ( |
|
| 983 | - // Soit on trouve avec la déclaration de la lang AVANT |
|
| 984 | - preg_match(';(?:lang\s*,)\s*(.*?titre)\s*(,|$);', $t, $m) |
|
| 985 | - // Soit on prend depuis le début |
|
| 986 | - or preg_match(';^(.*?titre)\s*(,|$);', $t, $m) |
|
| 987 | - ) { |
|
| 988 | - $m = preg_replace(',as\s+titre$,i', '', $m[1]); |
|
| 989 | - $m = trim($m); |
|
| 990 | - if ($m != "''") { |
|
| 991 | - if (!preg_match(',\W,', $m)) { |
|
| 992 | - $m = $boucle->id_table . ".$m"; |
|
| 993 | - } |
|
| 994 | - |
|
| 995 | - $m .= ' AS titre_rang'; |
|
| 996 | - |
|
| 997 | - $boucle->select[] = $m; |
|
| 998 | - $_titre = '$Pile[$SP][\'titre_rang\']'; |
|
| 999 | - } |
|
| 1000 | - } |
|
| 1001 | - } |
|
| 1002 | - |
|
| 1003 | - // si on n'a rien trouvé, on utilise le champ titre classique |
|
| 1004 | - if (!$_titre) { |
|
| 1005 | - $_titre = champ_sql('titre', $p); |
|
| 1006 | - } |
|
| 1007 | - |
|
| 1008 | - // et on recupere aussi les infos de liaison si on est en train d'editer les liens justement |
|
| 1009 | - // cas des formulaires xxx_lies utilises par #FORMULAIRE_EDITER_LIENS |
|
| 1010 | - $type_boucle = $boucle->type_requete; |
|
| 1011 | - $objet = objet_type($type_boucle); |
|
| 1012 | - $id_table_objet = id_table_objet($type_boucle); |
|
| 1013 | - $_primary = champ_sql($id_table_objet, $p, '', false); |
|
| 1014 | - $_env = '$Pile[0]'; |
|
| 1015 | - |
|
| 1016 | - if (!$_titre) {$_titre = "''"; |
|
| 1017 | - } |
|
| 1018 | - if (!$_primary) {$_primary = "''"; |
|
| 1019 | - } |
|
| 1020 | - $_rang = "calculer_rang_smart($_titre, '$objet', $_primary, $_env)"; |
|
| 1021 | - } |
|
| 1022 | - |
|
| 1023 | - $p->code = $_rang; |
|
| 1024 | - $p->interdire_scripts = false; |
|
| 1025 | - } |
|
| 1026 | - |
|
| 1027 | - return $p; |
|
| 958 | + $b = index_boucle($p); |
|
| 959 | + if ($b === '') { |
|
| 960 | + $msg = [ |
|
| 961 | + 'zbug_champ_hors_boucle', |
|
| 962 | + ['champ' => '#RANG'] |
|
| 963 | + ]; |
|
| 964 | + erreur_squelette($msg, $p); |
|
| 965 | + } else { |
|
| 966 | + // chercher d'abord un champ sql rang (mais pas dans le env : defaut '' si on trouve pas de champ sql) |
|
| 967 | + // dans la boucle immediatement englobante uniquement |
|
| 968 | + // sinon on compose le champ calcule |
|
| 969 | + $_rang = champ_sql('rang', $p, '', false); |
|
| 970 | + |
|
| 971 | + // si pas trouve de champ sql rang : |
|
| 972 | + if (!$_rang or $_rang == "''") { |
|
| 973 | + $boucle = &$p->boucles[$b]; |
|
| 974 | + |
|
| 975 | + // on gere le cas ou #RANG est une extraction du numero dans le titre |
|
| 976 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 977 | + $desc = $trouver_table($boucle->id_table); |
|
| 978 | + $_titre = ''; # où extraire le numero ? |
|
| 979 | + |
|
| 980 | + if (isset($desc['titre'])) { |
|
| 981 | + $t = $desc['titre']; |
|
| 982 | + if ( |
|
| 983 | + // Soit on trouve avec la déclaration de la lang AVANT |
|
| 984 | + preg_match(';(?:lang\s*,)\s*(.*?titre)\s*(,|$);', $t, $m) |
|
| 985 | + // Soit on prend depuis le début |
|
| 986 | + or preg_match(';^(.*?titre)\s*(,|$);', $t, $m) |
|
| 987 | + ) { |
|
| 988 | + $m = preg_replace(',as\s+titre$,i', '', $m[1]); |
|
| 989 | + $m = trim($m); |
|
| 990 | + if ($m != "''") { |
|
| 991 | + if (!preg_match(',\W,', $m)) { |
|
| 992 | + $m = $boucle->id_table . ".$m"; |
|
| 993 | + } |
|
| 994 | + |
|
| 995 | + $m .= ' AS titre_rang'; |
|
| 996 | + |
|
| 997 | + $boucle->select[] = $m; |
|
| 998 | + $_titre = '$Pile[$SP][\'titre_rang\']'; |
|
| 999 | + } |
|
| 1000 | + } |
|
| 1001 | + } |
|
| 1002 | + |
|
| 1003 | + // si on n'a rien trouvé, on utilise le champ titre classique |
|
| 1004 | + if (!$_titre) { |
|
| 1005 | + $_titre = champ_sql('titre', $p); |
|
| 1006 | + } |
|
| 1007 | + |
|
| 1008 | + // et on recupere aussi les infos de liaison si on est en train d'editer les liens justement |
|
| 1009 | + // cas des formulaires xxx_lies utilises par #FORMULAIRE_EDITER_LIENS |
|
| 1010 | + $type_boucle = $boucle->type_requete; |
|
| 1011 | + $objet = objet_type($type_boucle); |
|
| 1012 | + $id_table_objet = id_table_objet($type_boucle); |
|
| 1013 | + $_primary = champ_sql($id_table_objet, $p, '', false); |
|
| 1014 | + $_env = '$Pile[0]'; |
|
| 1015 | + |
|
| 1016 | + if (!$_titre) {$_titre = "''"; |
|
| 1017 | + } |
|
| 1018 | + if (!$_primary) {$_primary = "''"; |
|
| 1019 | + } |
|
| 1020 | + $_rang = "calculer_rang_smart($_titre, '$objet', $_primary, $_env)"; |
|
| 1021 | + } |
|
| 1022 | + |
|
| 1023 | + $p->code = $_rang; |
|
| 1024 | + $p->interdire_scripts = false; |
|
| 1025 | + } |
|
| 1026 | + |
|
| 1027 | + return $p; |
|
| 1028 | 1028 | } |
| 1029 | 1029 | |
| 1030 | 1030 | |
@@ -1046,12 +1046,12 @@ discard block |
||
| 1046 | 1046 | * Pile complétée par le code à générer |
| 1047 | 1047 | **/ |
| 1048 | 1048 | function balise_POPULARITE_dist($p) { |
| 1049 | - $_popularite = champ_sql('popularite', $p); |
|
| 1050 | - $p->code = "(ceil(min(100, 100 * $_popularite |
|
| 1049 | + $_popularite = champ_sql('popularite', $p); |
|
| 1050 | + $p->code = "(ceil(min(100, 100 * $_popularite |
|
| 1051 | 1051 | / max(1 , 0 + \$GLOBALS['meta']['popularite_max']))))"; |
| 1052 | - $p->interdire_scripts = false; |
|
| 1052 | + $p->interdire_scripts = false; |
|
| 1053 | 1053 | |
| 1054 | - return $p; |
|
| 1054 | + return $p; |
|
| 1055 | 1055 | } |
| 1056 | 1056 | |
| 1057 | 1057 | /** |
@@ -1062,8 +1062,8 @@ discard block |
||
| 1062 | 1062 | * l'absence peut-être due à une faute de frappe dans le contexte inclus. |
| 1063 | 1063 | */ |
| 1064 | 1064 | define( |
| 1065 | - 'CODE_PAGINATION', |
|
| 1066 | - '%s($Numrows["%s"]["grand_total"], |
|
| 1065 | + 'CODE_PAGINATION', |
|
| 1066 | + '%s($Numrows["%s"]["grand_total"], |
|
| 1067 | 1067 | %s, |
| 1068 | 1068 | isset($Pile[0][%4$s])?$Pile[0][%4$s]:intval(_request(%4$s)), |
| 1069 | 1069 | %5$s, %6$s, %7$s, %8$s, array(%9$s))' |
@@ -1100,75 +1100,75 @@ discard block |
||
| 1100 | 1100 | * Pile complétée par le code à générer |
| 1101 | 1101 | */ |
| 1102 | 1102 | function balise_PAGINATION_dist($p, $liste = 'true') { |
| 1103 | - $b = index_boucle_mere($p); |
|
| 1104 | - |
|
| 1105 | - // s'il n'y a pas de nom de boucle, on ne peut pas paginer |
|
| 1106 | - if ($b === '') { |
|
| 1107 | - $msg = [ |
|
| 1108 | - 'zbug_champ_hors_boucle', |
|
| 1109 | - ['champ' => $liste ? 'PAGINATION' : 'ANCRE_PAGINATION'] |
|
| 1110 | - ]; |
|
| 1111 | - erreur_squelette($msg, $p); |
|
| 1112 | - |
|
| 1113 | - return $p; |
|
| 1114 | - } |
|
| 1115 | - |
|
| 1116 | - // s'il n'y a pas de mode_partie, c'est qu'on se trouve |
|
| 1117 | - // dans un boucle recursive ou qu'on a oublie le critere {pagination} |
|
| 1118 | - if (!$p->boucles[$b]->mode_partie) { |
|
| 1119 | - if (!$p->boucles[$b]->table_optionnelle) { |
|
| 1120 | - $msg = [ |
|
| 1121 | - 'zbug_pagination_sans_critere', |
|
| 1122 | - ['champ' => '#PAGINATION'] |
|
| 1123 | - ]; |
|
| 1124 | - erreur_squelette($msg, $p); |
|
| 1125 | - } |
|
| 1126 | - |
|
| 1127 | - return $p; |
|
| 1128 | - } |
|
| 1129 | - |
|
| 1130 | - // a priori true |
|
| 1131 | - // si false, le compilo va bloquer sur des syntaxes avec un filtre sans argument qui suit la balise |
|
| 1132 | - // si true, les arguments simples (sans truc=chose) vont degager |
|
| 1133 | - $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false, false); |
|
| 1134 | - if (count($_contexte)) { |
|
| 1135 | - $key = key($_contexte); |
|
| 1136 | - if (is_numeric($key)) { |
|
| 1137 | - array_shift($_contexte); |
|
| 1138 | - $__modele = interprete_argument_balise(1, $p); |
|
| 1139 | - } |
|
| 1140 | - } |
|
| 1141 | - |
|
| 1142 | - if (count($_contexte)) { |
|
| 1143 | - $code_contexte = implode(',', $_contexte); |
|
| 1144 | - } else { |
|
| 1145 | - $code_contexte = ''; |
|
| 1146 | - } |
|
| 1147 | - |
|
| 1148 | - $connect = $p->boucles[$b]->sql_serveur; |
|
| 1149 | - $pas = $p->boucles[$b]->total_parties; |
|
| 1150 | - $f_pagination = chercher_filtre('pagination'); |
|
| 1151 | - $type = $p->boucles[$b]->modificateur['debut_nom']; |
|
| 1152 | - $modif = ($type[0] !== "'") ? "'debut'.$type" |
|
| 1153 | - : ("'debut" . substr($type, 1)); |
|
| 1154 | - |
|
| 1155 | - $p->code = sprintf( |
|
| 1156 | - CODE_PAGINATION, |
|
| 1157 | - $f_pagination, |
|
| 1158 | - $b, |
|
| 1159 | - $type, |
|
| 1160 | - $modif, |
|
| 1161 | - $pas, |
|
| 1162 | - $liste, |
|
| 1163 | - ((isset($__modele) and $__modele) ? $__modele : "''"), |
|
| 1164 | - _q($connect), |
|
| 1165 | - $code_contexte |
|
| 1166 | - ); |
|
| 1167 | - |
|
| 1168 | - $p->boucles[$b]->numrows = true; |
|
| 1169 | - $p->interdire_scripts = false; |
|
| 1170 | - |
|
| 1171 | - return $p; |
|
| 1103 | + $b = index_boucle_mere($p); |
|
| 1104 | + |
|
| 1105 | + // s'il n'y a pas de nom de boucle, on ne peut pas paginer |
|
| 1106 | + if ($b === '') { |
|
| 1107 | + $msg = [ |
|
| 1108 | + 'zbug_champ_hors_boucle', |
|
| 1109 | + ['champ' => $liste ? 'PAGINATION' : 'ANCRE_PAGINATION'] |
|
| 1110 | + ]; |
|
| 1111 | + erreur_squelette($msg, $p); |
|
| 1112 | + |
|
| 1113 | + return $p; |
|
| 1114 | + } |
|
| 1115 | + |
|
| 1116 | + // s'il n'y a pas de mode_partie, c'est qu'on se trouve |
|
| 1117 | + // dans un boucle recursive ou qu'on a oublie le critere {pagination} |
|
| 1118 | + if (!$p->boucles[$b]->mode_partie) { |
|
| 1119 | + if (!$p->boucles[$b]->table_optionnelle) { |
|
| 1120 | + $msg = [ |
|
| 1121 | + 'zbug_pagination_sans_critere', |
|
| 1122 | + ['champ' => '#PAGINATION'] |
|
| 1123 | + ]; |
|
| 1124 | + erreur_squelette($msg, $p); |
|
| 1125 | + } |
|
| 1126 | + |
|
| 1127 | + return $p; |
|
| 1128 | + } |
|
| 1129 | + |
|
| 1130 | + // a priori true |
|
| 1131 | + // si false, le compilo va bloquer sur des syntaxes avec un filtre sans argument qui suit la balise |
|
| 1132 | + // si true, les arguments simples (sans truc=chose) vont degager |
|
| 1133 | + $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false, false); |
|
| 1134 | + if (count($_contexte)) { |
|
| 1135 | + $key = key($_contexte); |
|
| 1136 | + if (is_numeric($key)) { |
|
| 1137 | + array_shift($_contexte); |
|
| 1138 | + $__modele = interprete_argument_balise(1, $p); |
|
| 1139 | + } |
|
| 1140 | + } |
|
| 1141 | + |
|
| 1142 | + if (count($_contexte)) { |
|
| 1143 | + $code_contexte = implode(',', $_contexte); |
|
| 1144 | + } else { |
|
| 1145 | + $code_contexte = ''; |
|
| 1146 | + } |
|
| 1147 | + |
|
| 1148 | + $connect = $p->boucles[$b]->sql_serveur; |
|
| 1149 | + $pas = $p->boucles[$b]->total_parties; |
|
| 1150 | + $f_pagination = chercher_filtre('pagination'); |
|
| 1151 | + $type = $p->boucles[$b]->modificateur['debut_nom']; |
|
| 1152 | + $modif = ($type[0] !== "'") ? "'debut'.$type" |
|
| 1153 | + : ("'debut" . substr($type, 1)); |
|
| 1154 | + |
|
| 1155 | + $p->code = sprintf( |
|
| 1156 | + CODE_PAGINATION, |
|
| 1157 | + $f_pagination, |
|
| 1158 | + $b, |
|
| 1159 | + $type, |
|
| 1160 | + $modif, |
|
| 1161 | + $pas, |
|
| 1162 | + $liste, |
|
| 1163 | + ((isset($__modele) and $__modele) ? $__modele : "''"), |
|
| 1164 | + _q($connect), |
|
| 1165 | + $code_contexte |
|
| 1166 | + ); |
|
| 1167 | + |
|
| 1168 | + $p->boucles[$b]->numrows = true; |
|
| 1169 | + $p->interdire_scripts = false; |
|
| 1170 | + |
|
| 1171 | + return $p; |
|
| 1172 | 1172 | } |
| 1173 | 1173 | |
| 1174 | 1174 | |
@@ -1195,11 +1195,11 @@ discard block |
||
| 1195 | 1195 | * Pile complétée par le code à générer |
| 1196 | 1196 | **/ |
| 1197 | 1197 | function balise_ANCRE_PAGINATION_dist($p) { |
| 1198 | - if ($f = charger_fonction('PAGINATION', 'balise', true)) { |
|
| 1199 | - return $f($p, $liste = 'false'); |
|
| 1200 | - } else { |
|
| 1201 | - return null; |
|
| 1202 | - } // ou une erreur ? |
|
| 1198 | + if ($f = charger_fonction('PAGINATION', 'balise', true)) { |
|
| 1199 | + return $f($p, $liste = 'false'); |
|
| 1200 | + } else { |
|
| 1201 | + return null; |
|
| 1202 | + } // ou une erreur ? |
|
| 1203 | 1203 | } |
| 1204 | 1204 | |
| 1205 | 1205 | |
@@ -1220,18 +1220,18 @@ discard block |
||
| 1220 | 1220 | * Pile complétée par le code à générer |
| 1221 | 1221 | **/ |
| 1222 | 1222 | function balise_GRAND_TOTAL_dist($p) { |
| 1223 | - $b = index_boucle_mere($p); |
|
| 1224 | - if ($b === '') { |
|
| 1225 | - $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 1226 | - erreur_squelette($msg, $p); |
|
| 1227 | - } else { |
|
| 1228 | - $p->code = "(isset(\$Numrows['$b']['grand_total']) |
|
| 1223 | + $b = index_boucle_mere($p); |
|
| 1224 | + if ($b === '') { |
|
| 1225 | + $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 1226 | + erreur_squelette($msg, $p); |
|
| 1227 | + } else { |
|
| 1228 | + $p->code = "(isset(\$Numrows['$b']['grand_total']) |
|
| 1229 | 1229 | ? \$Numrows['$b']['grand_total'] : \$Numrows['$b']['total'])"; |
| 1230 | - $p->boucles[$b]->numrows = true; |
|
| 1231 | - $p->interdire_scripts = false; |
|
| 1232 | - } |
|
| 1230 | + $p->boucles[$b]->numrows = true; |
|
| 1231 | + $p->interdire_scripts = false; |
|
| 1232 | + } |
|
| 1233 | 1233 | |
| 1234 | - return $p; |
|
| 1234 | + return $p; |
|
| 1235 | 1235 | } |
| 1236 | 1236 | |
| 1237 | 1237 | |
@@ -1259,10 +1259,10 @@ discard block |
||
| 1259 | 1259 | * Pile complétée par le code à générer |
| 1260 | 1260 | **/ |
| 1261 | 1261 | function balise_SELF_dist($p) { |
| 1262 | - $p->code = 'self()'; |
|
| 1263 | - $p->interdire_scripts = false; |
|
| 1262 | + $p->code = 'self()'; |
|
| 1263 | + $p->interdire_scripts = false; |
|
| 1264 | 1264 | |
| 1265 | - return $p; |
|
| 1265 | + return $p; |
|
| 1266 | 1266 | } |
| 1267 | 1267 | |
| 1268 | 1268 | |
@@ -1289,17 +1289,17 @@ discard block |
||
| 1289 | 1289 | * Pile complétée par le code à générer |
| 1290 | 1290 | **/ |
| 1291 | 1291 | function balise_CHEMIN_dist($p) { |
| 1292 | - $arg = interprete_argument_balise(1, $p); |
|
| 1293 | - if (!$arg) { |
|
| 1294 | - $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN']]; |
|
| 1295 | - erreur_squelette($msg, $p); |
|
| 1296 | - } else { |
|
| 1297 | - $p->code = 'find_in_path(' . $arg . ')'; |
|
| 1298 | - } |
|
| 1292 | + $arg = interprete_argument_balise(1, $p); |
|
| 1293 | + if (!$arg) { |
|
| 1294 | + $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN']]; |
|
| 1295 | + erreur_squelette($msg, $p); |
|
| 1296 | + } else { |
|
| 1297 | + $p->code = 'find_in_path(' . $arg . ')'; |
|
| 1298 | + } |
|
| 1299 | 1299 | |
| 1300 | - $p->interdire_scripts = false; |
|
| 1300 | + $p->interdire_scripts = false; |
|
| 1301 | 1301 | |
| 1302 | - return $p; |
|
| 1302 | + return $p; |
|
| 1303 | 1303 | } |
| 1304 | 1304 | |
| 1305 | 1305 | /** |
@@ -1324,16 +1324,16 @@ discard block |
||
| 1324 | 1324 | * Pile complétée par le code à générer |
| 1325 | 1325 | **/ |
| 1326 | 1326 | function balise_CHEMIN_IMAGE_dist($p) { |
| 1327 | - $arg = interprete_argument_balise(1, $p); |
|
| 1328 | - if (!$arg) { |
|
| 1329 | - $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN_IMAGE']]; |
|
| 1330 | - erreur_squelette($msg, $p); |
|
| 1331 | - } else { |
|
| 1332 | - $p->code = 'chemin_image(' . $arg . ')'; |
|
| 1333 | - } |
|
| 1327 | + $arg = interprete_argument_balise(1, $p); |
|
| 1328 | + if (!$arg) { |
|
| 1329 | + $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN_IMAGE']]; |
|
| 1330 | + erreur_squelette($msg, $p); |
|
| 1331 | + } else { |
|
| 1332 | + $p->code = 'chemin_image(' . $arg . ')'; |
|
| 1333 | + } |
|
| 1334 | 1334 | |
| 1335 | - $p->interdire_scripts = false; |
|
| 1336 | - return $p; |
|
| 1335 | + $p->interdire_scripts = false; |
|
| 1336 | + return $p; |
|
| 1337 | 1337 | } |
| 1338 | 1338 | |
| 1339 | 1339 | |
@@ -1371,36 +1371,36 @@ discard block |
||
| 1371 | 1371 | **/ |
| 1372 | 1372 | function balise_ENV_dist($p, $src = null) { |
| 1373 | 1373 | |
| 1374 | - // cle du tableau desiree |
|
| 1375 | - $_nom = interprete_argument_balise(1, $p); |
|
| 1376 | - // valeur par defaut |
|
| 1377 | - $_sinon = interprete_argument_balise(2, $p); |
|
| 1374 | + // cle du tableau desiree |
|
| 1375 | + $_nom = interprete_argument_balise(1, $p); |
|
| 1376 | + // valeur par defaut |
|
| 1377 | + $_sinon = interprete_argument_balise(2, $p); |
|
| 1378 | 1378 | |
| 1379 | - // $src est un tableau de donnees sources eventuellement transmis |
|
| 1380 | - // en absence, on utilise l'environnement du squelette $Pile[0] |
|
| 1379 | + // $src est un tableau de donnees sources eventuellement transmis |
|
| 1380 | + // en absence, on utilise l'environnement du squelette $Pile[0] |
|
| 1381 | 1381 | |
| 1382 | - if (!$_nom) { |
|
| 1383 | - // cas de #ENV sans argument : on retourne le serialize() du tableau |
|
| 1384 | - // une belle fonction [(#ENV|affiche_env)] serait pratique |
|
| 1385 | - if ($src) { |
|
| 1386 | - $p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")'; |
|
| 1387 | - } else { |
|
| 1388 | - $p->code = 'serialize($Pile[0]??[])'; |
|
| 1389 | - } |
|
| 1390 | - } else { |
|
| 1391 | - if (!$src) { |
|
| 1392 | - $src = '$Pile[0]??[]'; |
|
| 1393 | - } |
|
| 1394 | - if ($_sinon) { |
|
| 1395 | - $p->code = "sinon(table_valeur($src, (string)$_nom, null), $_sinon)"; |
|
| 1396 | - } else { |
|
| 1397 | - $p->code = "table_valeur($src, (string)$_nom, null)"; |
|
| 1398 | - } |
|
| 1399 | - } |
|
| 1382 | + if (!$_nom) { |
|
| 1383 | + // cas de #ENV sans argument : on retourne le serialize() du tableau |
|
| 1384 | + // une belle fonction [(#ENV|affiche_env)] serait pratique |
|
| 1385 | + if ($src) { |
|
| 1386 | + $p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")'; |
|
| 1387 | + } else { |
|
| 1388 | + $p->code = 'serialize($Pile[0]??[])'; |
|
| 1389 | + } |
|
| 1390 | + } else { |
|
| 1391 | + if (!$src) { |
|
| 1392 | + $src = '$Pile[0]??[]'; |
|
| 1393 | + } |
|
| 1394 | + if ($_sinon) { |
|
| 1395 | + $p->code = "sinon(table_valeur($src, (string)$_nom, null), $_sinon)"; |
|
| 1396 | + } else { |
|
| 1397 | + $p->code = "table_valeur($src, (string)$_nom, null)"; |
|
| 1398 | + } |
|
| 1399 | + } |
|
| 1400 | 1400 | |
| 1401 | - #$p->interdire_scripts = true; |
|
| 1401 | + #$p->interdire_scripts = true; |
|
| 1402 | 1402 | |
| 1403 | - return $p; |
|
| 1403 | + return $p; |
|
| 1404 | 1404 | } |
| 1405 | 1405 | |
| 1406 | 1406 | /** |
@@ -1430,16 +1430,16 @@ discard block |
||
| 1430 | 1430 | * Pile completée du code PHP d'exécution de la balise |
| 1431 | 1431 | */ |
| 1432 | 1432 | function balise_CONFIG_dist($p) { |
| 1433 | - if (!$arg = interprete_argument_balise(1, $p)) { |
|
| 1434 | - $arg = "''"; |
|
| 1435 | - } |
|
| 1436 | - $_sinon = interprete_argument_balise(2, $p); |
|
| 1437 | - $_unserialize = sinon(interprete_argument_balise(3, $p), 'false'); |
|
| 1433 | + if (!$arg = interprete_argument_balise(1, $p)) { |
|
| 1434 | + $arg = "''"; |
|
| 1435 | + } |
|
| 1436 | + $_sinon = interprete_argument_balise(2, $p); |
|
| 1437 | + $_unserialize = sinon(interprete_argument_balise(3, $p), 'false'); |
|
| 1438 | 1438 | |
| 1439 | - $p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' . |
|
| 1440 | - ($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')"; |
|
| 1439 | + $p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' . |
|
| 1440 | + ($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')"; |
|
| 1441 | 1441 | |
| 1442 | - return $p; |
|
| 1442 | + return $p; |
|
| 1443 | 1443 | } |
| 1444 | 1444 | |
| 1445 | 1445 | |
@@ -1462,10 +1462,10 @@ discard block |
||
| 1462 | 1462 | * Pile completée du code PHP d'exécution de la balise |
| 1463 | 1463 | */ |
| 1464 | 1464 | function balise_CONNECT_dist($p) { |
| 1465 | - $p->code = '($connect ? $connect : NULL)'; |
|
| 1466 | - $p->interdire_scripts = false; |
|
| 1465 | + $p->code = '($connect ? $connect : NULL)'; |
|
| 1466 | + $p->interdire_scripts = false; |
|
| 1467 | 1467 | |
| 1468 | - return $p; |
|
| 1468 | + return $p; |
|
| 1469 | 1469 | } |
| 1470 | 1470 | |
| 1471 | 1471 | |
@@ -1493,15 +1493,15 @@ discard block |
||
| 1493 | 1493 | * Pile completée du code PHP d'exécution de la balise |
| 1494 | 1494 | **/ |
| 1495 | 1495 | function balise_SESSION_dist($p) { |
| 1496 | - $p->descr['session'] = true; |
|
| 1496 | + $p->descr['session'] = true; |
|
| 1497 | 1497 | |
| 1498 | - $f = function_exists('balise_ENV') |
|
| 1499 | - ? 'balise_ENV' |
|
| 1500 | - : 'balise_ENV_dist'; |
|
| 1498 | + $f = function_exists('balise_ENV') |
|
| 1499 | + ? 'balise_ENV' |
|
| 1500 | + : 'balise_ENV_dist'; |
|
| 1501 | 1501 | |
| 1502 | - $p = $f($p, '$GLOBALS["visiteur_session"]??[]'); |
|
| 1502 | + $p = $f($p, '$GLOBALS["visiteur_session"]??[]'); |
|
| 1503 | 1503 | |
| 1504 | - return $p; |
|
| 1504 | + return $p; |
|
| 1505 | 1505 | } |
| 1506 | 1506 | |
| 1507 | 1507 | |
@@ -1524,18 +1524,18 @@ discard block |
||
| 1524 | 1524 | * Pile completée du code PHP d'exécution de la balise |
| 1525 | 1525 | **/ |
| 1526 | 1526 | function balise_SESSION_SET_dist($p) { |
| 1527 | - $_nom = interprete_argument_balise(1, $p); |
|
| 1528 | - $_val = interprete_argument_balise(2, $p); |
|
| 1529 | - if (!$_nom or !$_val) { |
|
| 1530 | - $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SESSION_SET']]; |
|
| 1531 | - erreur_squelette($err_b_s_a, $p); |
|
| 1532 | - } else { |
|
| 1533 | - $p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))'; |
|
| 1534 | - } |
|
| 1527 | + $_nom = interprete_argument_balise(1, $p); |
|
| 1528 | + $_val = interprete_argument_balise(2, $p); |
|
| 1529 | + if (!$_nom or !$_val) { |
|
| 1530 | + $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SESSION_SET']]; |
|
| 1531 | + erreur_squelette($err_b_s_a, $p); |
|
| 1532 | + } else { |
|
| 1533 | + $p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))'; |
|
| 1534 | + } |
|
| 1535 | 1535 | |
| 1536 | - $p->interdire_scripts = false; |
|
| 1536 | + $p->interdire_scripts = false; |
|
| 1537 | 1537 | |
| 1538 | - return $p; |
|
| 1538 | + return $p; |
|
| 1539 | 1539 | } |
| 1540 | 1540 | |
| 1541 | 1541 | |
@@ -1566,30 +1566,30 @@ discard block |
||
| 1566 | 1566 | * Pile completée du code PHP d'exécution de la balise |
| 1567 | 1567 | **/ |
| 1568 | 1568 | function balise_EVAL_dist($p) { |
| 1569 | - $php = interprete_argument_balise(1, $p); |
|
| 1570 | - if ($php) { |
|
| 1571 | - # optimisation sur les #EVAL{une expression sans #BALISE} |
|
| 1572 | - # attention au commentaire "// x signes" qui precede |
|
| 1573 | - if ( |
|
| 1574 | - preg_match( |
|
| 1575 | - ",^([[:space:]]*//[^\n]*\n)'([^']+)'$,ms", |
|
| 1576 | - $php, |
|
| 1577 | - $r |
|
| 1578 | - ) |
|
| 1579 | - ) { |
|
| 1580 | - $p->code = /* $r[1]. */ |
|
| 1581 | - '(' . $r[2] . ')'; |
|
| 1582 | - } else { |
|
| 1583 | - $p->code = "eval('return '.$php.';')"; |
|
| 1584 | - } |
|
| 1585 | - } else { |
|
| 1586 | - $msg = ['zbug_balise_sans_argument', ['balise' => ' EVAL']]; |
|
| 1587 | - erreur_squelette($msg, $p); |
|
| 1588 | - } |
|
| 1589 | - |
|
| 1590 | - #$p->interdire_scripts = true; |
|
| 1591 | - |
|
| 1592 | - return $p; |
|
| 1569 | + $php = interprete_argument_balise(1, $p); |
|
| 1570 | + if ($php) { |
|
| 1571 | + # optimisation sur les #EVAL{une expression sans #BALISE} |
|
| 1572 | + # attention au commentaire "// x signes" qui precede |
|
| 1573 | + if ( |
|
| 1574 | + preg_match( |
|
| 1575 | + ",^([[:space:]]*//[^\n]*\n)'([^']+)'$,ms", |
|
| 1576 | + $php, |
|
| 1577 | + $r |
|
| 1578 | + ) |
|
| 1579 | + ) { |
|
| 1580 | + $p->code = /* $r[1]. */ |
|
| 1581 | + '(' . $r[2] . ')'; |
|
| 1582 | + } else { |
|
| 1583 | + $p->code = "eval('return '.$php.';')"; |
|
| 1584 | + } |
|
| 1585 | + } else { |
|
| 1586 | + $msg = ['zbug_balise_sans_argument', ['balise' => ' EVAL']]; |
|
| 1587 | + erreur_squelette($msg, $p); |
|
| 1588 | + } |
|
| 1589 | + |
|
| 1590 | + #$p->interdire_scripts = true; |
|
| 1591 | + |
|
| 1592 | + return $p; |
|
| 1593 | 1593 | } |
| 1594 | 1594 | |
| 1595 | 1595 | |
@@ -1619,19 +1619,19 @@ discard block |
||
| 1619 | 1619 | **/ |
| 1620 | 1620 | function balise_CHAMP_SQL_dist($p) { |
| 1621 | 1621 | |
| 1622 | - if ( |
|
| 1623 | - $p->param |
|
| 1624 | - and isset($p->param[0][1][0]) |
|
| 1625 | - and $champ = ($p->param[0][1][0]->texte) |
|
| 1626 | - ) { |
|
| 1627 | - $p->code = champ_sql($champ, $p); |
|
| 1628 | - } else { |
|
| 1629 | - $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => ' CHAMP_SQL']]; |
|
| 1630 | - erreur_squelette($err_b_s_a, $p); |
|
| 1631 | - } |
|
| 1622 | + if ( |
|
| 1623 | + $p->param |
|
| 1624 | + and isset($p->param[0][1][0]) |
|
| 1625 | + and $champ = ($p->param[0][1][0]->texte) |
|
| 1626 | + ) { |
|
| 1627 | + $p->code = champ_sql($champ, $p); |
|
| 1628 | + } else { |
|
| 1629 | + $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => ' CHAMP_SQL']]; |
|
| 1630 | + erreur_squelette($err_b_s_a, $p); |
|
| 1631 | + } |
|
| 1632 | 1632 | |
| 1633 | - #$p->interdire_scripts = true; |
|
| 1634 | - return $p; |
|
| 1633 | + #$p->interdire_scripts = true; |
|
| 1634 | + return $p; |
|
| 1635 | 1635 | } |
| 1636 | 1636 | |
| 1637 | 1637 | /** |
@@ -1657,13 +1657,13 @@ discard block |
||
| 1657 | 1657 | * Pile complétée par le code à générer |
| 1658 | 1658 | **/ |
| 1659 | 1659 | function balise_VAL_dist($p) { |
| 1660 | - $p->code = interprete_argument_balise(1, $p); |
|
| 1661 | - if (!strlen($p->code)) { |
|
| 1662 | - $p->code = "''"; |
|
| 1663 | - } |
|
| 1664 | - $p->interdire_scripts = false; |
|
| 1660 | + $p->code = interprete_argument_balise(1, $p); |
|
| 1661 | + if (!strlen($p->code)) { |
|
| 1662 | + $p->code = "''"; |
|
| 1663 | + } |
|
| 1664 | + $p->interdire_scripts = false; |
|
| 1665 | 1665 | |
| 1666 | - return $p; |
|
| 1666 | + return $p; |
|
| 1667 | 1667 | } |
| 1668 | 1668 | |
| 1669 | 1669 | /** |
@@ -1692,10 +1692,10 @@ discard block |
||
| 1692 | 1692 | * Pile complétée par le code à générer |
| 1693 | 1693 | **/ |
| 1694 | 1694 | function balise_REM_dist($p) { |
| 1695 | - $p->code = "''"; |
|
| 1696 | - $p->interdire_scripts = false; |
|
| 1695 | + $p->code = "''"; |
|
| 1696 | + $p->interdire_scripts = false; |
|
| 1697 | 1697 | |
| 1698 | - return $p; |
|
| 1698 | + return $p; |
|
| 1699 | 1699 | } |
| 1700 | 1700 | |
| 1701 | 1701 | /** |
@@ -1705,10 +1705,10 @@ discard block |
||
| 1705 | 1705 | * @return mixed |
| 1706 | 1706 | */ |
| 1707 | 1707 | function balise_NULL_dist($p) { |
| 1708 | - $p->code = 'null'; |
|
| 1709 | - $p->interdire_scripts = false; |
|
| 1708 | + $p->code = 'null'; |
|
| 1709 | + $p->interdire_scripts = false; |
|
| 1710 | 1710 | |
| 1711 | - return $p; |
|
| 1711 | + return $p; |
|
| 1712 | 1712 | } |
| 1713 | 1713 | |
| 1714 | 1714 | |
@@ -1732,18 +1732,18 @@ discard block |
||
| 1732 | 1732 | **/ |
| 1733 | 1733 | function balise_HTTP_HEADER_dist($p) { |
| 1734 | 1734 | |
| 1735 | - $header = interprete_argument_balise(1, $p); |
|
| 1736 | - if (!$header) { |
|
| 1737 | - $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'HTTP_HEADER']]; |
|
| 1738 | - erreur_squelette($err_b_s_a, $p); |
|
| 1739 | - } else { |
|
| 1740 | - $p->code = "'<'.'?php header(' . _q(" |
|
| 1741 | - . $header |
|
| 1742 | - . ") . '); ?'.'>'"; |
|
| 1743 | - } |
|
| 1744 | - $p->interdire_scripts = false; |
|
| 1735 | + $header = interprete_argument_balise(1, $p); |
|
| 1736 | + if (!$header) { |
|
| 1737 | + $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'HTTP_HEADER']]; |
|
| 1738 | + erreur_squelette($err_b_s_a, $p); |
|
| 1739 | + } else { |
|
| 1740 | + $p->code = "'<'.'?php header(' . _q(" |
|
| 1741 | + . $header |
|
| 1742 | + . ") . '); ?'.'>'"; |
|
| 1743 | + } |
|
| 1744 | + $p->interdire_scripts = false; |
|
| 1745 | 1745 | |
| 1746 | - return $p; |
|
| 1746 | + return $p; |
|
| 1747 | 1747 | } |
| 1748 | 1748 | |
| 1749 | 1749 | |
@@ -1768,20 +1768,20 @@ discard block |
||
| 1768 | 1768 | * Pile complétée par le code à générer |
| 1769 | 1769 | **/ |
| 1770 | 1770 | function balise_FILTRE_dist($p) { |
| 1771 | - if ($p->param) { |
|
| 1772 | - $args = []; |
|
| 1773 | - foreach ($p->param as $i => $ignore) { |
|
| 1774 | - $args[] = interprete_argument_balise($i + 1, $p); |
|
| 1775 | - } |
|
| 1776 | - $p->code = "'<' . '" |
|
| 1777 | - . '?php header("X-Spip-Filtre: \'.' |
|
| 1778 | - . join('.\'|\'.', $args) |
|
| 1779 | - . " . '\"); ?'.'>'"; |
|
| 1771 | + if ($p->param) { |
|
| 1772 | + $args = []; |
|
| 1773 | + foreach ($p->param as $i => $ignore) { |
|
| 1774 | + $args[] = interprete_argument_balise($i + 1, $p); |
|
| 1775 | + } |
|
| 1776 | + $p->code = "'<' . '" |
|
| 1777 | + . '?php header("X-Spip-Filtre: \'.' |
|
| 1778 | + . join('.\'|\'.', $args) |
|
| 1779 | + . " . '\"); ?'.'>'"; |
|
| 1780 | 1780 | |
| 1781 | - $p->interdire_scripts = false; |
|
| 1781 | + $p->interdire_scripts = false; |
|
| 1782 | 1782 | |
| 1783 | - return $p; |
|
| 1784 | - } |
|
| 1783 | + return $p; |
|
| 1784 | + } |
|
| 1785 | 1785 | } |
| 1786 | 1786 | |
| 1787 | 1787 | |
@@ -1817,55 +1817,55 @@ discard block |
||
| 1817 | 1817 | **/ |
| 1818 | 1818 | function balise_CACHE_dist($p) { |
| 1819 | 1819 | |
| 1820 | - if ($p->param) { |
|
| 1821 | - $duree = valeur_numerique($p->param[0][1][0]->texte); |
|
| 1822 | - |
|
| 1823 | - // noter la duree du cache dans un entete proprietaire |
|
| 1824 | - |
|
| 1825 | - $code = "'<'.'" . '?php header("X-Spip-Cache: ' |
|
| 1826 | - . $duree |
|
| 1827 | - . '"); ?' . "'.'>'"; |
|
| 1828 | - |
|
| 1829 | - // Remplir le header Cache-Control |
|
| 1830 | - // cas #CACHE{0} |
|
| 1831 | - if ($duree == 0) { |
|
| 1832 | - $code .= ".'<'.'" |
|
| 1833 | - . '?php header("Cache-Control: no-cache, must-revalidate"); ?' |
|
| 1834 | - . "'.'><'.'" |
|
| 1835 | - . '?php header("Pragma: no-cache"); ?' |
|
| 1836 | - . "'.'>'"; |
|
| 1837 | - } |
|
| 1838 | - |
|
| 1839 | - // recuperer les parametres suivants |
|
| 1840 | - $i = 1; |
|
| 1841 | - while (isset($p->param[0][++$i])) { |
|
| 1842 | - $pa = ($p->param[0][$i][0]->texte); |
|
| 1843 | - |
|
| 1844 | - if ( |
|
| 1845 | - $pa == 'cache-client' |
|
| 1846 | - and $duree > 0 |
|
| 1847 | - ) { |
|
| 1848 | - $code .= ".'<'.'" . '?php header("Cache-Control: max-age=' |
|
| 1849 | - . $duree |
|
| 1850 | - . '"); ?' . "'.'>'"; |
|
| 1851 | - // il semble logique, si on cache-client, de ne pas invalider |
|
| 1852 | - $pa = 'statique'; |
|
| 1853 | - } |
|
| 1854 | - |
|
| 1855 | - if ( |
|
| 1856 | - $pa == 'statique' |
|
| 1857 | - and $duree > 0 |
|
| 1858 | - ) { |
|
| 1859 | - $code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'"; |
|
| 1860 | - } |
|
| 1861 | - } |
|
| 1862 | - } else { |
|
| 1863 | - $code = "''"; |
|
| 1864 | - } |
|
| 1865 | - $p->code = $code; |
|
| 1866 | - $p->interdire_scripts = false; |
|
| 1867 | - |
|
| 1868 | - return $p; |
|
| 1820 | + if ($p->param) { |
|
| 1821 | + $duree = valeur_numerique($p->param[0][1][0]->texte); |
|
| 1822 | + |
|
| 1823 | + // noter la duree du cache dans un entete proprietaire |
|
| 1824 | + |
|
| 1825 | + $code = "'<'.'" . '?php header("X-Spip-Cache: ' |
|
| 1826 | + . $duree |
|
| 1827 | + . '"); ?' . "'.'>'"; |
|
| 1828 | + |
|
| 1829 | + // Remplir le header Cache-Control |
|
| 1830 | + // cas #CACHE{0} |
|
| 1831 | + if ($duree == 0) { |
|
| 1832 | + $code .= ".'<'.'" |
|
| 1833 | + . '?php header("Cache-Control: no-cache, must-revalidate"); ?' |
|
| 1834 | + . "'.'><'.'" |
|
| 1835 | + . '?php header("Pragma: no-cache"); ?' |
|
| 1836 | + . "'.'>'"; |
|
| 1837 | + } |
|
| 1838 | + |
|
| 1839 | + // recuperer les parametres suivants |
|
| 1840 | + $i = 1; |
|
| 1841 | + while (isset($p->param[0][++$i])) { |
|
| 1842 | + $pa = ($p->param[0][$i][0]->texte); |
|
| 1843 | + |
|
| 1844 | + if ( |
|
| 1845 | + $pa == 'cache-client' |
|
| 1846 | + and $duree > 0 |
|
| 1847 | + ) { |
|
| 1848 | + $code .= ".'<'.'" . '?php header("Cache-Control: max-age=' |
|
| 1849 | + . $duree |
|
| 1850 | + . '"); ?' . "'.'>'"; |
|
| 1851 | + // il semble logique, si on cache-client, de ne pas invalider |
|
| 1852 | + $pa = 'statique'; |
|
| 1853 | + } |
|
| 1854 | + |
|
| 1855 | + if ( |
|
| 1856 | + $pa == 'statique' |
|
| 1857 | + and $duree > 0 |
|
| 1858 | + ) { |
|
| 1859 | + $code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'"; |
|
| 1860 | + } |
|
| 1861 | + } |
|
| 1862 | + } else { |
|
| 1863 | + $code = "''"; |
|
| 1864 | + } |
|
| 1865 | + $p->code = $code; |
|
| 1866 | + $p->interdire_scripts = false; |
|
| 1867 | + |
|
| 1868 | + return $p; |
|
| 1869 | 1869 | } |
| 1870 | 1870 | |
| 1871 | 1871 | |
@@ -1897,13 +1897,13 @@ discard block |
||
| 1897 | 1897 | * Pile complétée par le code à générer |
| 1898 | 1898 | */ |
| 1899 | 1899 | function balise_INSERT_HEAD_dist($p) { |
| 1900 | - $p->code = "'<'.'" |
|
| 1901 | - . '?php header("X-Spip-Filtre: insert_head_css_conditionnel"); ?' |
|
| 1902 | - . "'.'>'"; |
|
| 1903 | - $p->code .= ". pipeline('insert_head','<!-- insert_head -->')"; |
|
| 1904 | - $p->interdire_scripts = false; |
|
| 1900 | + $p->code = "'<'.'" |
|
| 1901 | + . '?php header("X-Spip-Filtre: insert_head_css_conditionnel"); ?' |
|
| 1902 | + . "'.'>'"; |
|
| 1903 | + $p->code .= ". pipeline('insert_head','<!-- insert_head -->')"; |
|
| 1904 | + $p->interdire_scripts = false; |
|
| 1905 | 1905 | |
| 1906 | - return $p; |
|
| 1906 | + return $p; |
|
| 1907 | 1907 | } |
| 1908 | 1908 | |
| 1909 | 1909 | /** |
@@ -1921,10 +1921,10 @@ discard block |
||
| 1921 | 1921 | * Pile complétée par le code à générer |
| 1922 | 1922 | */ |
| 1923 | 1923 | function balise_INSERT_HEAD_CSS_dist($p) { |
| 1924 | - $p->code = "pipeline('insert_head_css','<!-- insert_head_css -->')"; |
|
| 1925 | - $p->interdire_scripts = false; |
|
| 1924 | + $p->code = "pipeline('insert_head_css','<!-- insert_head_css -->')"; |
|
| 1925 | + $p->interdire_scripts = false; |
|
| 1926 | 1926 | |
| 1927 | - return $p; |
|
| 1927 | + return $p; |
|
| 1928 | 1928 | } |
| 1929 | 1929 | |
| 1930 | 1930 | /** |
@@ -1939,11 +1939,11 @@ discard block |
||
| 1939 | 1939 | * Pile complétée par le code à générer |
| 1940 | 1940 | **/ |
| 1941 | 1941 | function balise_INCLUDE_dist($p) { |
| 1942 | - if (function_exists('balise_INCLURE')) { |
|
| 1943 | - return balise_INCLURE($p); |
|
| 1944 | - } else { |
|
| 1945 | - return balise_INCLURE_dist($p); |
|
| 1946 | - } |
|
| 1942 | + if (function_exists('balise_INCLURE')) { |
|
| 1943 | + return balise_INCLURE($p); |
|
| 1944 | + } else { |
|
| 1945 | + return balise_INCLURE_dist($p); |
|
| 1946 | + } |
|
| 1947 | 1947 | } |
| 1948 | 1948 | |
| 1949 | 1949 | /** |
@@ -1977,66 +1977,66 @@ discard block |
||
| 1977 | 1977 | * Pile complétée par le code à générer |
| 1978 | 1978 | **/ |
| 1979 | 1979 | function balise_INCLURE_dist($p) { |
| 1980 | - $id_boucle = $p->id_boucle; |
|
| 1981 | - // la lang n'est pas passe de facon automatique par argumenter |
|
| 1982 | - // mais le sera pas recuperer_fond, sauf si etoile=>true est passe |
|
| 1983 | - // en option |
|
| 1984 | - |
|
| 1985 | - $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $id_boucle, false, false); |
|
| 1986 | - |
|
| 1987 | - // erreur de syntaxe = fond absent |
|
| 1988 | - // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 1989 | - if (!$_contexte) { |
|
| 1990 | - $contexte = []; |
|
| 1991 | - } |
|
| 1992 | - |
|
| 1993 | - if (isset($_contexte['fond'])) { |
|
| 1994 | - $f = $_contexte['fond']; |
|
| 1995 | - // toujours vrai : |
|
| 1996 | - if (preg_match('/^.fond.\s*=>(.*)$/s', $f, $r)) { |
|
| 1997 | - $f = $r[1]; |
|
| 1998 | - unset($_contexte['fond']); |
|
| 1999 | - } else { |
|
| 2000 | - spip_log('compilation de #INCLURE a revoir'); |
|
| 2001 | - } |
|
| 2002 | - |
|
| 2003 | - // #INCLURE{doublons} |
|
| 2004 | - if (isset($_contexte['doublons'])) { |
|
| 2005 | - $_contexte['doublons'] = "'doublons' => \$doublons"; |
|
| 2006 | - } |
|
| 2007 | - |
|
| 2008 | - // Critere d'inclusion {env} (et {self} pour compatibilite ascendante) |
|
| 2009 | - $flag_env = false; |
|
| 2010 | - if (isset($_contexte['env']) or isset($_contexte['self'])) { |
|
| 2011 | - $flag_env = true; |
|
| 2012 | - unset($_contexte['env']); |
|
| 2013 | - } |
|
| 2014 | - |
|
| 2015 | - $_options = []; |
|
| 2016 | - if (isset($_contexte['ajax'])) { |
|
| 2017 | - $_options[] = preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2018 | - unset($_contexte['ajax']); |
|
| 2019 | - } |
|
| 2020 | - if ($p->etoile) { |
|
| 2021 | - $_options[] = "'etoile'=>true"; |
|
| 2022 | - } |
|
| 2023 | - $_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ')'; |
|
| 2024 | - |
|
| 2025 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2026 | - if ($flag_env) { |
|
| 2027 | - $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2028 | - } |
|
| 2029 | - |
|
| 2030 | - $p->code = sprintf(CODE_RECUPERER_FOND, $f, $_l, join(',', $_options), "_request('connect')"); |
|
| 2031 | - } elseif (!isset($_contexte[1])) { |
|
| 2032 | - $msg = ['zbug_balise_sans_argument', ['balise' => ' INCLURE']]; |
|
| 2033 | - erreur_squelette($msg, $p); |
|
| 2034 | - } else { |
|
| 2035 | - $p->code = 'charge_scripts(' . $_contexte[1] . ',false)'; |
|
| 2036 | - } |
|
| 2037 | - |
|
| 2038 | - $p->interdire_scripts = false; // la securite est assuree par recuperer_fond |
|
| 2039 | - return $p; |
|
| 1980 | + $id_boucle = $p->id_boucle; |
|
| 1981 | + // la lang n'est pas passe de facon automatique par argumenter |
|
| 1982 | + // mais le sera pas recuperer_fond, sauf si etoile=>true est passe |
|
| 1983 | + // en option |
|
| 1984 | + |
|
| 1985 | + $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $id_boucle, false, false); |
|
| 1986 | + |
|
| 1987 | + // erreur de syntaxe = fond absent |
|
| 1988 | + // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 1989 | + if (!$_contexte) { |
|
| 1990 | + $contexte = []; |
|
| 1991 | + } |
|
| 1992 | + |
|
| 1993 | + if (isset($_contexte['fond'])) { |
|
| 1994 | + $f = $_contexte['fond']; |
|
| 1995 | + // toujours vrai : |
|
| 1996 | + if (preg_match('/^.fond.\s*=>(.*)$/s', $f, $r)) { |
|
| 1997 | + $f = $r[1]; |
|
| 1998 | + unset($_contexte['fond']); |
|
| 1999 | + } else { |
|
| 2000 | + spip_log('compilation de #INCLURE a revoir'); |
|
| 2001 | + } |
|
| 2002 | + |
|
| 2003 | + // #INCLURE{doublons} |
|
| 2004 | + if (isset($_contexte['doublons'])) { |
|
| 2005 | + $_contexte['doublons'] = "'doublons' => \$doublons"; |
|
| 2006 | + } |
|
| 2007 | + |
|
| 2008 | + // Critere d'inclusion {env} (et {self} pour compatibilite ascendante) |
|
| 2009 | + $flag_env = false; |
|
| 2010 | + if (isset($_contexte['env']) or isset($_contexte['self'])) { |
|
| 2011 | + $flag_env = true; |
|
| 2012 | + unset($_contexte['env']); |
|
| 2013 | + } |
|
| 2014 | + |
|
| 2015 | + $_options = []; |
|
| 2016 | + if (isset($_contexte['ajax'])) { |
|
| 2017 | + $_options[] = preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2018 | + unset($_contexte['ajax']); |
|
| 2019 | + } |
|
| 2020 | + if ($p->etoile) { |
|
| 2021 | + $_options[] = "'etoile'=>true"; |
|
| 2022 | + } |
|
| 2023 | + $_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ')'; |
|
| 2024 | + |
|
| 2025 | + $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2026 | + if ($flag_env) { |
|
| 2027 | + $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2028 | + } |
|
| 2029 | + |
|
| 2030 | + $p->code = sprintf(CODE_RECUPERER_FOND, $f, $_l, join(',', $_options), "_request('connect')"); |
|
| 2031 | + } elseif (!isset($_contexte[1])) { |
|
| 2032 | + $msg = ['zbug_balise_sans_argument', ['balise' => ' INCLURE']]; |
|
| 2033 | + erreur_squelette($msg, $p); |
|
| 2034 | + } else { |
|
| 2035 | + $p->code = 'charge_scripts(' . $_contexte[1] . ',false)'; |
|
| 2036 | + } |
|
| 2037 | + |
|
| 2038 | + $p->interdire_scripts = false; // la securite est assuree par recuperer_fond |
|
| 2039 | + return $p; |
|
| 2040 | 2040 | } |
| 2041 | 2041 | |
| 2042 | 2042 | |
@@ -2064,69 +2064,69 @@ discard block |
||
| 2064 | 2064 | **/ |
| 2065 | 2065 | function balise_MODELE_dist($p) { |
| 2066 | 2066 | |
| 2067 | - $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false); |
|
| 2068 | - |
|
| 2069 | - // erreur de syntaxe = fond absent |
|
| 2070 | - // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 2071 | - if (!$_contexte) { |
|
| 2072 | - $_contexte = []; |
|
| 2073 | - } |
|
| 2074 | - |
|
| 2075 | - if (!isset($_contexte[1])) { |
|
| 2076 | - $msg = ['zbug_balise_sans_argument', ['balise' => ' MODELE']]; |
|
| 2077 | - erreur_squelette($msg, $p); |
|
| 2078 | - } else { |
|
| 2079 | - $nom = $_contexte[1]; |
|
| 2080 | - unset($_contexte[1]); |
|
| 2081 | - |
|
| 2082 | - if (preg_match("/^\s*'[^']*'/s", $nom)) { |
|
| 2083 | - $nom = "'modeles/" . substr($nom, 1); |
|
| 2084 | - } else { |
|
| 2085 | - $nom = "'modeles/' . $nom"; |
|
| 2086 | - } |
|
| 2087 | - |
|
| 2088 | - $flag_env = false; |
|
| 2089 | - if (isset($_contexte['env'])) { |
|
| 2090 | - $flag_env = true; |
|
| 2091 | - unset($_contexte['env']); |
|
| 2092 | - } |
|
| 2093 | - |
|
| 2094 | - // Incoherence dans la syntaxe du contexte. A revoir. |
|
| 2095 | - // Reserver la cle primaire de la boucle courante si elle existe |
|
| 2096 | - if (isset($p->boucles[$p->id_boucle]->primary)) { |
|
| 2097 | - $primary = $p->boucles[$p->id_boucle]->primary; |
|
| 2098 | - if (!strpos($primary, ',')) { |
|
| 2099 | - $id = champ_sql($primary, $p); |
|
| 2100 | - $_contexte[] = "'$primary'=>" . $id; |
|
| 2101 | - $_contexte[] = "'id'=>" . $id; |
|
| 2102 | - } |
|
| 2103 | - } |
|
| 2104 | - $_contexte[] = "'recurs'=>(++\$recurs)"; |
|
| 2105 | - $connect = ''; |
|
| 2106 | - if (isset($p->boucles[$p->id_boucle])) { |
|
| 2107 | - $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2108 | - } |
|
| 2109 | - |
|
| 2110 | - $_options = memoriser_contexte_compil($p); |
|
| 2111 | - $_options = "'compil'=>array($_options), 'trim'=>true"; |
|
| 2112 | - if (isset($_contexte['ajax'])) { |
|
| 2113 | - $_options .= ', ' . preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2114 | - unset($_contexte['ajax']); |
|
| 2115 | - } |
|
| 2116 | - |
|
| 2117 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2118 | - if ($flag_env) { |
|
| 2119 | - $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2120 | - } |
|
| 2121 | - |
|
| 2122 | - $page = sprintf(CODE_RECUPERER_FOND, $nom, $_l, $_options, _q($connect)); |
|
| 2123 | - |
|
| 2124 | - $p->code = "\n\t(((\$recurs=(isset(\$Pile[0]['recurs'])?\$Pile[0]['recurs']:0))>=5)? '' :\n\t$page)\n"; |
|
| 2125 | - |
|
| 2126 | - $p->interdire_scripts = false; // securite assuree par le squelette |
|
| 2127 | - } |
|
| 2128 | - |
|
| 2129 | - return $p; |
|
| 2067 | + $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false); |
|
| 2068 | + |
|
| 2069 | + // erreur de syntaxe = fond absent |
|
| 2070 | + // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 2071 | + if (!$_contexte) { |
|
| 2072 | + $_contexte = []; |
|
| 2073 | + } |
|
| 2074 | + |
|
| 2075 | + if (!isset($_contexte[1])) { |
|
| 2076 | + $msg = ['zbug_balise_sans_argument', ['balise' => ' MODELE']]; |
|
| 2077 | + erreur_squelette($msg, $p); |
|
| 2078 | + } else { |
|
| 2079 | + $nom = $_contexte[1]; |
|
| 2080 | + unset($_contexte[1]); |
|
| 2081 | + |
|
| 2082 | + if (preg_match("/^\s*'[^']*'/s", $nom)) { |
|
| 2083 | + $nom = "'modeles/" . substr($nom, 1); |
|
| 2084 | + } else { |
|
| 2085 | + $nom = "'modeles/' . $nom"; |
|
| 2086 | + } |
|
| 2087 | + |
|
| 2088 | + $flag_env = false; |
|
| 2089 | + if (isset($_contexte['env'])) { |
|
| 2090 | + $flag_env = true; |
|
| 2091 | + unset($_contexte['env']); |
|
| 2092 | + } |
|
| 2093 | + |
|
| 2094 | + // Incoherence dans la syntaxe du contexte. A revoir. |
|
| 2095 | + // Reserver la cle primaire de la boucle courante si elle existe |
|
| 2096 | + if (isset($p->boucles[$p->id_boucle]->primary)) { |
|
| 2097 | + $primary = $p->boucles[$p->id_boucle]->primary; |
|
| 2098 | + if (!strpos($primary, ',')) { |
|
| 2099 | + $id = champ_sql($primary, $p); |
|
| 2100 | + $_contexte[] = "'$primary'=>" . $id; |
|
| 2101 | + $_contexte[] = "'id'=>" . $id; |
|
| 2102 | + } |
|
| 2103 | + } |
|
| 2104 | + $_contexte[] = "'recurs'=>(++\$recurs)"; |
|
| 2105 | + $connect = ''; |
|
| 2106 | + if (isset($p->boucles[$p->id_boucle])) { |
|
| 2107 | + $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2108 | + } |
|
| 2109 | + |
|
| 2110 | + $_options = memoriser_contexte_compil($p); |
|
| 2111 | + $_options = "'compil'=>array($_options), 'trim'=>true"; |
|
| 2112 | + if (isset($_contexte['ajax'])) { |
|
| 2113 | + $_options .= ', ' . preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2114 | + unset($_contexte['ajax']); |
|
| 2115 | + } |
|
| 2116 | + |
|
| 2117 | + $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2118 | + if ($flag_env) { |
|
| 2119 | + $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2120 | + } |
|
| 2121 | + |
|
| 2122 | + $page = sprintf(CODE_RECUPERER_FOND, $nom, $_l, $_options, _q($connect)); |
|
| 2123 | + |
|
| 2124 | + $p->code = "\n\t(((\$recurs=(isset(\$Pile[0]['recurs'])?\$Pile[0]['recurs']:0))>=5)? '' :\n\t$page)\n"; |
|
| 2125 | + |
|
| 2126 | + $p->interdire_scripts = false; // securite assuree par le squelette |
|
| 2127 | + } |
|
| 2128 | + |
|
| 2129 | + return $p; |
|
| 2130 | 2130 | } |
| 2131 | 2131 | |
| 2132 | 2132 | |
@@ -2150,21 +2150,21 @@ discard block |
||
| 2150 | 2150 | * Pile complétée par le code à générer |
| 2151 | 2151 | **/ |
| 2152 | 2152 | function balise_SET_dist($p) { |
| 2153 | - $_nom = interprete_argument_balise(1, $p); |
|
| 2154 | - $_val = interprete_argument_balise(2, $p); |
|
| 2153 | + $_nom = interprete_argument_balise(1, $p); |
|
| 2154 | + $_val = interprete_argument_balise(2, $p); |
|
| 2155 | 2155 | |
| 2156 | - if (!$_nom or !$_val) { |
|
| 2157 | - $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SET']]; |
|
| 2158 | - erreur_squelette($err_b_s_a, $p); |
|
| 2159 | - } |
|
| 2160 | - // affectation $_zzz inutile, mais permet de contourner un bug OpCode cache sous PHP 5.5.4 |
|
| 2161 | - // cf https://bugs.php.net/bug.php?id=65845 |
|
| 2162 | - else { |
|
| 2163 | - $p->code = "vide(\$Pile['vars'][\$_zzz=(string)$_nom] = $_val)"; |
|
| 2164 | - } |
|
| 2156 | + if (!$_nom or !$_val) { |
|
| 2157 | + $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SET']]; |
|
| 2158 | + erreur_squelette($err_b_s_a, $p); |
|
| 2159 | + } |
|
| 2160 | + // affectation $_zzz inutile, mais permet de contourner un bug OpCode cache sous PHP 5.5.4 |
|
| 2161 | + // cf https://bugs.php.net/bug.php?id=65845 |
|
| 2162 | + else { |
|
| 2163 | + $p->code = "vide(\$Pile['vars'][\$_zzz=(string)$_nom] = $_val)"; |
|
| 2164 | + } |
|
| 2165 | 2165 | |
| 2166 | - $p->interdire_scripts = false; // la balise ne renvoie rien |
|
| 2167 | - return $p; |
|
| 2166 | + $p->interdire_scripts = false; // la balise ne renvoie rien |
|
| 2167 | + return $p; |
|
| 2168 | 2168 | } |
| 2169 | 2169 | |
| 2170 | 2170 | |
@@ -2194,12 +2194,12 @@ discard block |
||
| 2194 | 2194 | * Pile complétée par le code à générer |
| 2195 | 2195 | **/ |
| 2196 | 2196 | function balise_GET_dist($p) { |
| 2197 | - $p->interdire_scripts = false; // le contenu vient de #SET, donc il est de confiance |
|
| 2198 | - if (function_exists('balise_ENV')) { |
|
| 2199 | - return balise_ENV($p, '$Pile["vars"]??[]'); |
|
| 2200 | - } else { |
|
| 2201 | - return balise_ENV_dist($p, '$Pile["vars"]??[]'); |
|
| 2202 | - } |
|
| 2197 | + $p->interdire_scripts = false; // le contenu vient de #SET, donc il est de confiance |
|
| 2198 | + if (function_exists('balise_ENV')) { |
|
| 2199 | + return balise_ENV($p, '$Pile["vars"]??[]'); |
|
| 2200 | + } else { |
|
| 2201 | + return balise_ENV_dist($p, '$Pile["vars"]??[]'); |
|
| 2202 | + } |
|
| 2203 | 2203 | } |
| 2204 | 2204 | |
| 2205 | 2205 | |
@@ -2222,22 +2222,22 @@ discard block |
||
| 2222 | 2222 | * Pile complétée par le code à générer |
| 2223 | 2223 | **/ |
| 2224 | 2224 | function balise_DOUBLONS_dist($p) { |
| 2225 | - if ($type = interprete_argument_balise(1, $p)) { |
|
| 2226 | - if ($famille = interprete_argument_balise(2, $p)) { |
|
| 2227 | - $type .= '.' . $famille; |
|
| 2228 | - } |
|
| 2229 | - $p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")'; |
|
| 2230 | - if (!$p->etoile) { |
|
| 2231 | - $p->code = 'array_filter(array_map("intval",explode(",",' |
|
| 2232 | - . $p->code . ')))'; |
|
| 2233 | - } |
|
| 2234 | - } else { |
|
| 2235 | - $p->code = '$doublons'; |
|
| 2236 | - } |
|
| 2225 | + if ($type = interprete_argument_balise(1, $p)) { |
|
| 2226 | + if ($famille = interprete_argument_balise(2, $p)) { |
|
| 2227 | + $type .= '.' . $famille; |
|
| 2228 | + } |
|
| 2229 | + $p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")'; |
|
| 2230 | + if (!$p->etoile) { |
|
| 2231 | + $p->code = 'array_filter(array_map("intval",explode(",",' |
|
| 2232 | + . $p->code . ')))'; |
|
| 2233 | + } |
|
| 2234 | + } else { |
|
| 2235 | + $p->code = '$doublons'; |
|
| 2236 | + } |
|
| 2237 | 2237 | |
| 2238 | - $p->interdire_scripts = false; |
|
| 2238 | + $p->interdire_scripts = false; |
|
| 2239 | 2239 | |
| 2240 | - return $p; |
|
| 2240 | + return $p; |
|
| 2241 | 2241 | } |
| 2242 | 2242 | |
| 2243 | 2243 | |
@@ -2260,18 +2260,18 @@ discard block |
||
| 2260 | 2260 | * Pile complétée par le code à générer |
| 2261 | 2261 | **/ |
| 2262 | 2262 | function balise_PIPELINE_dist($p) { |
| 2263 | - $_pipe = interprete_argument_balise(1, $p); |
|
| 2264 | - if (!$_pipe) { |
|
| 2265 | - $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'PIPELINE']]; |
|
| 2266 | - erreur_squelette($err_b_s_a, $p); |
|
| 2267 | - } else { |
|
| 2268 | - $_flux = interprete_argument_balise(2, $p); |
|
| 2269 | - $_flux = $_flux ? $_flux : "''"; |
|
| 2270 | - $p->code = "pipeline( $_pipe , $_flux )"; |
|
| 2271 | - $p->interdire_scripts = false; |
|
| 2272 | - } |
|
| 2263 | + $_pipe = interprete_argument_balise(1, $p); |
|
| 2264 | + if (!$_pipe) { |
|
| 2265 | + $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'PIPELINE']]; |
|
| 2266 | + erreur_squelette($err_b_s_a, $p); |
|
| 2267 | + } else { |
|
| 2268 | + $_flux = interprete_argument_balise(2, $p); |
|
| 2269 | + $_flux = $_flux ? $_flux : "''"; |
|
| 2270 | + $p->code = "pipeline( $_pipe , $_flux )"; |
|
| 2271 | + $p->interdire_scripts = false; |
|
| 2272 | + } |
|
| 2273 | 2273 | |
| 2274 | - return $p; |
|
| 2274 | + return $p; |
|
| 2275 | 2275 | } |
| 2276 | 2276 | |
| 2277 | 2277 | |
@@ -2296,10 +2296,10 @@ discard block |
||
| 2296 | 2296 | * Pile complétée par le code à générer |
| 2297 | 2297 | **/ |
| 2298 | 2298 | function balise_EDIT_dist($p) { |
| 2299 | - $p->code = "''"; |
|
| 2300 | - $p->interdire_scripts = false; |
|
| 2299 | + $p->code = "''"; |
|
| 2300 | + $p->interdire_scripts = false; |
|
| 2301 | 2301 | |
| 2302 | - return $p; |
|
| 2302 | + return $p; |
|
| 2303 | 2303 | } |
| 2304 | 2304 | |
| 2305 | 2305 | |
@@ -2322,11 +2322,11 @@ discard block |
||
| 2322 | 2322 | * Pile complétée par le code à générer |
| 2323 | 2323 | **/ |
| 2324 | 2324 | function balise_TOTAL_UNIQUE_dist($p) { |
| 2325 | - $_famille = interprete_argument_balise(1, $p); |
|
| 2326 | - $_famille = $_famille ? $_famille : "''"; |
|
| 2327 | - $p->code = "unique('', $_famille, true)"; |
|
| 2325 | + $_famille = interprete_argument_balise(1, $p); |
|
| 2326 | + $_famille = $_famille ? $_famille : "''"; |
|
| 2327 | + $p->code = "unique('', $_famille, true)"; |
|
| 2328 | 2328 | |
| 2329 | - return $p; |
|
| 2329 | + return $p; |
|
| 2330 | 2330 | } |
| 2331 | 2331 | |
| 2332 | 2332 | /** |
@@ -2349,19 +2349,19 @@ discard block |
||
| 2349 | 2349 | * Pile complétée par le code à générer |
| 2350 | 2350 | **/ |
| 2351 | 2351 | function balise_ARRAY_dist($p) { |
| 2352 | - $_code = []; |
|
| 2353 | - $n = 1; |
|
| 2354 | - do { |
|
| 2355 | - $_key = interprete_argument_balise($n++, $p); |
|
| 2356 | - $_val = interprete_argument_balise($n++, $p); |
|
| 2357 | - if ($_key and $_val) { |
|
| 2358 | - $_code[] = "$_key => $_val"; |
|
| 2359 | - } |
|
| 2360 | - } while ($_key && $_val); |
|
| 2361 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2362 | - $p->interdire_scripts = false; |
|
| 2352 | + $_code = []; |
|
| 2353 | + $n = 1; |
|
| 2354 | + do { |
|
| 2355 | + $_key = interprete_argument_balise($n++, $p); |
|
| 2356 | + $_val = interprete_argument_balise($n++, $p); |
|
| 2357 | + if ($_key and $_val) { |
|
| 2358 | + $_code[] = "$_key => $_val"; |
|
| 2359 | + } |
|
| 2360 | + } while ($_key && $_val); |
|
| 2361 | + $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2362 | + $p->interdire_scripts = false; |
|
| 2363 | 2363 | |
| 2364 | - return $p; |
|
| 2364 | + return $p; |
|
| 2365 | 2365 | } |
| 2366 | 2366 | |
| 2367 | 2367 | /** |
@@ -2380,15 +2380,15 @@ discard block |
||
| 2380 | 2380 | * Pile complétée par le code à générer |
| 2381 | 2381 | */ |
| 2382 | 2382 | function balise_LISTE_dist($p) { |
| 2383 | - $_code = []; |
|
| 2384 | - $n = 1; |
|
| 2385 | - while ($_val = interprete_argument_balise($n++, $p)) { |
|
| 2386 | - $_code[] = $_val; |
|
| 2387 | - } |
|
| 2388 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2389 | - $p->interdire_scripts = false; |
|
| 2383 | + $_code = []; |
|
| 2384 | + $n = 1; |
|
| 2385 | + while ($_val = interprete_argument_balise($n++, $p)) { |
|
| 2386 | + $_code[] = $_val; |
|
| 2387 | + } |
|
| 2388 | + $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2389 | + $p->interdire_scripts = false; |
|
| 2390 | 2390 | |
| 2391 | - return $p; |
|
| 2391 | + return $p; |
|
| 2392 | 2392 | } |
| 2393 | 2393 | |
| 2394 | 2394 | |
@@ -2422,21 +2422,21 @@ discard block |
||
| 2422 | 2422 | * Pile complétée par le code à générer |
| 2423 | 2423 | **/ |
| 2424 | 2424 | function balise_AUTORISER_dist($p) { |
| 2425 | - $_code = []; |
|
| 2426 | - $p->descr['session'] = true; // faire un cache par session |
|
| 2425 | + $_code = []; |
|
| 2426 | + $p->descr['session'] = true; // faire un cache par session |
|
| 2427 | 2427 | |
| 2428 | - $n = 1; |
|
| 2429 | - while ($_v = interprete_argument_balise($n++, $p)) { |
|
| 2430 | - $_code[] = $_v; |
|
| 2431 | - } |
|
| 2428 | + $n = 1; |
|
| 2429 | + while ($_v = interprete_argument_balise($n++, $p)) { |
|
| 2430 | + $_code[] = $_v; |
|
| 2431 | + } |
|
| 2432 | 2432 | |
| 2433 | - $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join( |
|
| 2434 | - ', ', |
|
| 2435 | - $_code |
|
| 2436 | - ) . ')?" ":"")'; |
|
| 2437 | - $p->interdire_scripts = false; |
|
| 2433 | + $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join( |
|
| 2434 | + ', ', |
|
| 2435 | + $_code |
|
| 2436 | + ) . ')?" ":"")'; |
|
| 2437 | + $p->interdire_scripts = false; |
|
| 2438 | 2438 | |
| 2439 | - return $p; |
|
| 2439 | + return $p; |
|
| 2440 | 2440 | } |
| 2441 | 2441 | |
| 2442 | 2442 | |
@@ -2460,15 +2460,15 @@ discard block |
||
| 2460 | 2460 | * Pile complétée par le code à générer |
| 2461 | 2461 | **/ |
| 2462 | 2462 | function balise_PLUGIN_dist($p) { |
| 2463 | - $plugin = interprete_argument_balise(1, $p); |
|
| 2464 | - $plugin = isset($plugin) ? str_replace('\'', '"', $plugin) : '""'; |
|
| 2465 | - $type_info = interprete_argument_balise(2, $p); |
|
| 2466 | - $type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"'; |
|
| 2463 | + $plugin = interprete_argument_balise(1, $p); |
|
| 2464 | + $plugin = isset($plugin) ? str_replace('\'', '"', $plugin) : '""'; |
|
| 2465 | + $type_info = interprete_argument_balise(2, $p); |
|
| 2466 | + $type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"'; |
|
| 2467 | 2467 | |
| 2468 | - $f = chercher_filtre('info_plugin'); |
|
| 2469 | - $p->code = $f . '(' . $plugin . ', ' . $type_info . ')'; |
|
| 2468 | + $f = chercher_filtre('info_plugin'); |
|
| 2469 | + $p->code = $f . '(' . $plugin . ', ' . $type_info . ')'; |
|
| 2470 | 2470 | |
| 2471 | - return $p; |
|
| 2471 | + return $p; |
|
| 2472 | 2472 | } |
| 2473 | 2473 | |
| 2474 | 2474 | /** |
@@ -2489,9 +2489,9 @@ discard block |
||
| 2489 | 2489 | * Pile complétée par le code à générer |
| 2490 | 2490 | **/ |
| 2491 | 2491 | function balise_AIDER_dist($p) { |
| 2492 | - $_motif = interprete_argument_balise(1, $p); |
|
| 2493 | - $p->code = "((\$aider=charger_fonction('aide','inc',true))?\$aider($_motif):'')"; |
|
| 2494 | - return $p; |
|
| 2492 | + $_motif = interprete_argument_balise(1, $p); |
|
| 2493 | + $p->code = "((\$aider=charger_fonction('aide','inc',true))?\$aider($_motif):'')"; |
|
| 2494 | + return $p; |
|
| 2495 | 2495 | } |
| 2496 | 2496 | |
| 2497 | 2497 | /** |
@@ -2517,16 +2517,16 @@ discard block |
||
| 2517 | 2517 | * Pile complétée par le code à générer |
| 2518 | 2518 | **/ |
| 2519 | 2519 | function balise_ACTION_FORMULAIRE($p) { |
| 2520 | - if (!$_url = interprete_argument_balise(1, $p)) { |
|
| 2521 | - $_url = "@\$Pile[0]['action']"; |
|
| 2522 | - } |
|
| 2523 | - if (!$_form = interprete_argument_balise(2, $p)) { |
|
| 2524 | - $_form = "@\$Pile[0]['form']"; |
|
| 2525 | - } |
|
| 2526 | - |
|
| 2527 | - // envoyer le nom du formulaire que l'on traite |
|
| 2528 | - // transmettre les eventuels args de la balise formulaire |
|
| 2529 | - $p->code = " '<span class=\"form-hidden\">' . |
|
| 2520 | + if (!$_url = interprete_argument_balise(1, $p)) { |
|
| 2521 | + $_url = "@\$Pile[0]['action']"; |
|
| 2522 | + } |
|
| 2523 | + if (!$_form = interprete_argument_balise(2, $p)) { |
|
| 2524 | + $_form = "@\$Pile[0]['form']"; |
|
| 2525 | + } |
|
| 2526 | + |
|
| 2527 | + // envoyer le nom du formulaire que l'on traite |
|
| 2528 | + // transmettre les eventuels args de la balise formulaire |
|
| 2529 | + $p->code = " '<span class=\"form-hidden\">' . |
|
| 2530 | 2530 | form_hidden($_url) . |
| 2531 | 2531 | '<input name=\'formulaire_action\' type=\'hidden\' |
| 2532 | 2532 | value=\'' . $_form . '\' />' . |
@@ -2535,9 +2535,9 @@ discard block |
||
| 2535 | 2535 | (!empty(\$Pile[0]['_hidden']) ? @\$Pile[0]['_hidden'] : '') . |
| 2536 | 2536 | '</span>'"; |
| 2537 | 2537 | |
| 2538 | - $p->interdire_scripts = false; |
|
| 2538 | + $p->interdire_scripts = false; |
|
| 2539 | 2539 | |
| 2540 | - return $p; |
|
| 2540 | + return $p; |
|
| 2541 | 2541 | } |
| 2542 | 2542 | |
| 2543 | 2543 | |
@@ -2578,25 +2578,25 @@ discard block |
||
| 2578 | 2578 | */ |
| 2579 | 2579 | function balise_BOUTON_ACTION_dist($p) { |
| 2580 | 2580 | |
| 2581 | - $args = []; |
|
| 2582 | - for ($k = 1; $k <= 6; $k++) { |
|
| 2583 | - $_a = interprete_argument_balise($k, $p); |
|
| 2584 | - if (!$_a) { |
|
| 2585 | - $_a = "''"; |
|
| 2586 | - } |
|
| 2587 | - $args[] = $_a; |
|
| 2588 | - } |
|
| 2589 | - // supprimer les args vides |
|
| 2590 | - while (end($args) == "''" and count($args) > 2) { |
|
| 2591 | - array_pop($args); |
|
| 2592 | - } |
|
| 2593 | - $args = implode(',', $args); |
|
| 2581 | + $args = []; |
|
| 2582 | + for ($k = 1; $k <= 6; $k++) { |
|
| 2583 | + $_a = interprete_argument_balise($k, $p); |
|
| 2584 | + if (!$_a) { |
|
| 2585 | + $_a = "''"; |
|
| 2586 | + } |
|
| 2587 | + $args[] = $_a; |
|
| 2588 | + } |
|
| 2589 | + // supprimer les args vides |
|
| 2590 | + while (end($args) == "''" and count($args) > 2) { |
|
| 2591 | + array_pop($args); |
|
| 2592 | + } |
|
| 2593 | + $args = implode(',', $args); |
|
| 2594 | 2594 | |
| 2595 | - $bouton_action = chercher_filtre('bouton_action'); |
|
| 2596 | - $p->code = "$bouton_action($args)"; |
|
| 2597 | - $p->interdire_scripts = false; |
|
| 2595 | + $bouton_action = chercher_filtre('bouton_action'); |
|
| 2596 | + $p->code = "$bouton_action($args)"; |
|
| 2597 | + $p->interdire_scripts = false; |
|
| 2598 | 2598 | |
| 2599 | - return $p; |
|
| 2599 | + return $p; |
|
| 2600 | 2600 | } |
| 2601 | 2601 | |
| 2602 | 2602 | |
@@ -2615,10 +2615,10 @@ discard block |
||
| 2615 | 2615 | * Pile complétée par le code à générer |
| 2616 | 2616 | */ |
| 2617 | 2617 | function balise_SLOGAN_SITE_SPIP_dist($p) { |
| 2618 | - $p->code = "\$GLOBALS['meta']['slogan_site']"; |
|
| 2618 | + $p->code = "\$GLOBALS['meta']['slogan_site']"; |
|
| 2619 | 2619 | |
| 2620 | - #$p->interdire_scripts = true; |
|
| 2621 | - return $p; |
|
| 2620 | + #$p->interdire_scripts = true; |
|
| 2621 | + return $p; |
|
| 2622 | 2622 | } |
| 2623 | 2623 | |
| 2624 | 2624 | |
@@ -2642,10 +2642,10 @@ discard block |
||
| 2642 | 2642 | * Pile complétée par le code à générer |
| 2643 | 2643 | */ |
| 2644 | 2644 | function balise_HTML5_dist($p) { |
| 2645 | - $p->code = html5_permis() ? "' '" : "''"; |
|
| 2646 | - $p->interdire_scripts = false; |
|
| 2645 | + $p->code = html5_permis() ? "' '" : "''"; |
|
| 2646 | + $p->interdire_scripts = false; |
|
| 2647 | 2647 | |
| 2648 | - return $p; |
|
| 2648 | + return $p; |
|
| 2649 | 2649 | } |
| 2650 | 2650 | |
| 2651 | 2651 | |
@@ -2671,61 +2671,61 @@ discard block |
||
| 2671 | 2671 | * Pile complétée par le code à générer |
| 2672 | 2672 | */ |
| 2673 | 2673 | function balise_TRI_dist($p, $liste = 'true') { |
| 2674 | - $b = index_boucle_mere($p); |
|
| 2675 | - // s'il n'y a pas de nom de boucle, on ne peut pas trier |
|
| 2676 | - if ($b === '') { |
|
| 2677 | - $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 2678 | - erreur_squelette($msg, $p); |
|
| 2679 | - $p->code = "''"; |
|
| 2674 | + $b = index_boucle_mere($p); |
|
| 2675 | + // s'il n'y a pas de nom de boucle, on ne peut pas trier |
|
| 2676 | + if ($b === '') { |
|
| 2677 | + $msg = ['zbug_champ_hors_boucle', ['champ' => zbug_presenter_champ($p)]]; |
|
| 2678 | + erreur_squelette($msg, $p); |
|
| 2679 | + $p->code = "''"; |
|
| 2680 | 2680 | |
| 2681 | - return $p; |
|
| 2682 | - } |
|
| 2683 | - $boucle = $p->boucles[$b]; |
|
| 2681 | + return $p; |
|
| 2682 | + } |
|
| 2683 | + $boucle = $p->boucles[$b]; |
|
| 2684 | 2684 | |
| 2685 | - // s'il n'y a pas de tri_champ, c'est qu'on se trouve |
|
| 2686 | - // dans un boucle recursive ou qu'on a oublie le critere {tri} |
|
| 2687 | - if (!isset($boucle->modificateur['tri_champ'])) { |
|
| 2688 | - $msg = ['zbug_champ_hors_critere', [ |
|
| 2689 | - 'champ' => zbug_presenter_champ($p), |
|
| 2690 | - 'critere' => 'tri' |
|
| 2691 | - ]]; |
|
| 2692 | - erreur_squelette($msg, $p); |
|
| 2693 | - $p->code = "''"; |
|
| 2685 | + // s'il n'y a pas de tri_champ, c'est qu'on se trouve |
|
| 2686 | + // dans un boucle recursive ou qu'on a oublie le critere {tri} |
|
| 2687 | + if (!isset($boucle->modificateur['tri_champ'])) { |
|
| 2688 | + $msg = ['zbug_champ_hors_critere', [ |
|
| 2689 | + 'champ' => zbug_presenter_champ($p), |
|
| 2690 | + 'critere' => 'tri' |
|
| 2691 | + ]]; |
|
| 2692 | + erreur_squelette($msg, $p); |
|
| 2693 | + $p->code = "''"; |
|
| 2694 | 2694 | |
| 2695 | - return $p; |
|
| 2696 | - } |
|
| 2695 | + return $p; |
|
| 2696 | + } |
|
| 2697 | 2697 | |
| 2698 | - $_champ = interprete_argument_balise(1, $p); |
|
| 2699 | - // si pas de champ, renvoyer le critere de tri utilise |
|
| 2700 | - if (!$_champ) { |
|
| 2701 | - $p->code = $boucle->modificateur['tri_champ']; |
|
| 2698 | + $_champ = interprete_argument_balise(1, $p); |
|
| 2699 | + // si pas de champ, renvoyer le critere de tri utilise |
|
| 2700 | + if (!$_champ) { |
|
| 2701 | + $p->code = $boucle->modificateur['tri_champ']; |
|
| 2702 | 2702 | |
| 2703 | - return $p; |
|
| 2704 | - } |
|
| 2705 | - // forcer la jointure si besoin, et si le champ est statique |
|
| 2706 | - if (preg_match(",^'([\w.]+)'$,i", $_champ, $m)) { |
|
| 2707 | - index_pile($b, $m[1], $p->boucles, '', null, true, false); |
|
| 2708 | - } |
|
| 2703 | + return $p; |
|
| 2704 | + } |
|
| 2705 | + // forcer la jointure si besoin, et si le champ est statique |
|
| 2706 | + if (preg_match(",^'([\w.]+)'$,i", $_champ, $m)) { |
|
| 2707 | + index_pile($b, $m[1], $p->boucles, '', null, true, false); |
|
| 2708 | + } |
|
| 2709 | 2709 | |
| 2710 | - $_libelle = interprete_argument_balise(2, $p); |
|
| 2711 | - $_libelle = $_libelle ? $_libelle : $_champ; |
|
| 2710 | + $_libelle = interprete_argument_balise(2, $p); |
|
| 2711 | + $_libelle = $_libelle ? $_libelle : $_champ; |
|
| 2712 | 2712 | |
| 2713 | - $_class = interprete_argument_balise(3, $p); |
|
| 2714 | - // si champ = ">" c'est un lien vers le tri croissant : de gauche a droite ==> 1 |
|
| 2715 | - // si champ = "<" c'est un lien vers le tri decroissant : (sens inverse) == -1 |
|
| 2716 | - $_issens = "in_array($_champ,array('>','<'))"; |
|
| 2717 | - $_sens = "(strpos('< >',$_champ)-1)"; |
|
| 2713 | + $_class = interprete_argument_balise(3, $p); |
|
| 2714 | + // si champ = ">" c'est un lien vers le tri croissant : de gauche a droite ==> 1 |
|
| 2715 | + // si champ = "<" c'est un lien vers le tri decroissant : (sens inverse) == -1 |
|
| 2716 | + $_issens = "in_array($_champ,array('>','<'))"; |
|
| 2717 | + $_sens = "(strpos('< >',$_champ)-1)"; |
|
| 2718 | 2718 | |
| 2719 | - $_variable = "((\$s=$_issens)?'sens':'tri')." . $boucle->modificateur['tri_nom']; |
|
| 2720 | - $_url = "parametre_url(self(),$_variable,\$s?$_sens:$_champ)"; |
|
| 2721 | - $_url = "parametre_url($_url,'var_memotri',strncmp(" . $boucle->modificateur['tri_nom'] . ",'session',7)==0?$_variable:'')"; |
|
| 2722 | - $_on = '$s?(' . $boucle->modificateur['tri_sens'] . "==$_sens" . '):(' . $boucle->modificateur['tri_champ'] . "==$_champ)"; |
|
| 2719 | + $_variable = "((\$s=$_issens)?'sens':'tri')." . $boucle->modificateur['tri_nom']; |
|
| 2720 | + $_url = "parametre_url(self(),$_variable,\$s?$_sens:$_champ)"; |
|
| 2721 | + $_url = "parametre_url($_url,'var_memotri',strncmp(" . $boucle->modificateur['tri_nom'] . ",'session',7)==0?$_variable:'')"; |
|
| 2722 | + $_on = '$s?(' . $boucle->modificateur['tri_sens'] . "==$_sens" . '):(' . $boucle->modificateur['tri_champ'] . "==$_champ)"; |
|
| 2723 | 2723 | |
| 2724 | - $p->code = "lien_ou_expose($_url,$_libelle,$_on" . ($_class ? ",$_class" : '') . ')'; |
|
| 2725 | - //$p->code = "''"; |
|
| 2726 | - $p->interdire_scripts = false; |
|
| 2724 | + $p->code = "lien_ou_expose($_url,$_libelle,$_on" . ($_class ? ",$_class" : '') . ')'; |
|
| 2725 | + //$p->code = "''"; |
|
| 2726 | + $p->interdire_scripts = false; |
|
| 2727 | 2727 | |
| 2728 | - return $p; |
|
| 2728 | + return $p; |
|
| 2729 | 2729 | } |
| 2730 | 2730 | |
| 2731 | 2731 | |
@@ -2746,22 +2746,22 @@ discard block |
||
| 2746 | 2746 | * Pile complétée par le code à générer |
| 2747 | 2747 | */ |
| 2748 | 2748 | function balise_SAUTER_dist($p) { |
| 2749 | - $id_boucle = $p->id_boucle; |
|
| 2749 | + $id_boucle = $p->id_boucle; |
|
| 2750 | 2750 | |
| 2751 | - if (empty($p->boucles[$id_boucle])) { |
|
| 2752 | - $msg = ['zbug_champ_hors_boucle', ['champ' => '#SAUTER']]; |
|
| 2753 | - erreur_squelette($msg, $p); |
|
| 2754 | - } else { |
|
| 2755 | - $boucle = $p->boucles[$id_boucle]; |
|
| 2756 | - $_saut = interprete_argument_balise(1, $p); |
|
| 2757 | - $_compteur = "\$Numrows['$id_boucle']['compteur_boucle']"; |
|
| 2758 | - $_total = "\$Numrows['$id_boucle']['total']"; |
|
| 2751 | + if (empty($p->boucles[$id_boucle])) { |
|
| 2752 | + $msg = ['zbug_champ_hors_boucle', ['champ' => '#SAUTER']]; |
|
| 2753 | + erreur_squelette($msg, $p); |
|
| 2754 | + } else { |
|
| 2755 | + $boucle = $p->boucles[$id_boucle]; |
|
| 2756 | + $_saut = interprete_argument_balise(1, $p); |
|
| 2757 | + $_compteur = "\$Numrows['$id_boucle']['compteur_boucle']"; |
|
| 2758 | + $_total = "\$Numrows['$id_boucle']['total']"; |
|
| 2759 | 2759 | |
| 2760 | - $p->code = "vide($_compteur=\$iter->skip($_saut,$_total))"; |
|
| 2761 | - } |
|
| 2762 | - $p->interdire_scripts = false; |
|
| 2760 | + $p->code = "vide($_compteur=\$iter->skip($_saut,$_total))"; |
|
| 2761 | + } |
|
| 2762 | + $p->interdire_scripts = false; |
|
| 2763 | 2763 | |
| 2764 | - return $p; |
|
| 2764 | + return $p; |
|
| 2765 | 2765 | } |
| 2766 | 2766 | |
| 2767 | 2767 | |
@@ -2783,22 +2783,22 @@ discard block |
||
| 2783 | 2783 | * Pile complétée par le code à générer |
| 2784 | 2784 | */ |
| 2785 | 2785 | function balise_PUBLIE_dist($p) { |
| 2786 | - if (!$_type = interprete_argument_balise(1, $p)) { |
|
| 2787 | - $_type = _q($p->type_requete); |
|
| 2788 | - $_id = champ_sql($p->boucles[$p->id_boucle]->primary, $p); |
|
| 2789 | - } else { |
|
| 2790 | - $_id = interprete_argument_balise(2, $p); |
|
| 2791 | - } |
|
| 2786 | + if (!$_type = interprete_argument_balise(1, $p)) { |
|
| 2787 | + $_type = _q($p->type_requete); |
|
| 2788 | + $_id = champ_sql($p->boucles[$p->id_boucle]->primary, $p); |
|
| 2789 | + } else { |
|
| 2790 | + $_id = interprete_argument_balise(2, $p); |
|
| 2791 | + } |
|
| 2792 | 2792 | |
| 2793 | - $connect = ''; |
|
| 2794 | - if (isset($p->boucles[$p->id_boucle])) { |
|
| 2795 | - $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2796 | - } |
|
| 2793 | + $connect = ''; |
|
| 2794 | + if (isset($p->boucles[$p->id_boucle])) { |
|
| 2795 | + $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2796 | + } |
|
| 2797 | 2797 | |
| 2798 | - $p->code = '(objet_test_si_publie(' . $_type . ',intval(' . $_id . '),' . _q($connect) . ")?' ':'')"; |
|
| 2799 | - $p->interdire_scripts = false; |
|
| 2798 | + $p->code = '(objet_test_si_publie(' . $_type . ',intval(' . $_id . '),' . _q($connect) . ")?' ':'')"; |
|
| 2799 | + $p->interdire_scripts = false; |
|
| 2800 | 2800 | |
| 2801 | - return $p; |
|
| 2801 | + return $p; |
|
| 2802 | 2802 | } |
| 2803 | 2803 | |
| 2804 | 2804 | /** |
@@ -2827,12 +2827,12 @@ discard block |
||
| 2827 | 2827 | * Pile complétée par le code à générer |
| 2828 | 2828 | */ |
| 2829 | 2829 | function balise_PRODUIRE_dist($p) { |
| 2830 | - $balise_inclure = charger_fonction('INCLURE', 'balise'); |
|
| 2831 | - $p = $balise_inclure($p); |
|
| 2830 | + $balise_inclure = charger_fonction('INCLURE', 'balise'); |
|
| 2831 | + $p = $balise_inclure($p); |
|
| 2832 | 2832 | |
| 2833 | - $p->code = str_replace('recuperer_fond(', 'produire_fond_statique(', $p->code); |
|
| 2833 | + $p->code = str_replace('recuperer_fond(', 'produire_fond_statique(', $p->code); |
|
| 2834 | 2834 | |
| 2835 | - return $p; |
|
| 2835 | + return $p; |
|
| 2836 | 2836 | } |
| 2837 | 2837 | |
| 2838 | 2838 | /** |
@@ -2851,13 +2851,13 @@ discard block |
||
| 2851 | 2851 | * Pile complétée par le code à générer |
| 2852 | 2852 | */ |
| 2853 | 2853 | function balise_LARGEUR_ECRAN_dist($p) { |
| 2854 | - $_class = interprete_argument_balise(1, $p); |
|
| 2855 | - if (!$_class) { |
|
| 2856 | - $_class = 'null'; |
|
| 2857 | - } |
|
| 2858 | - $p->code = "(is_string($_class)?vide(\$GLOBALS['largeur_ecran']=$_class):(isset(\$GLOBALS['largeur_ecran'])?\$GLOBALS['largeur_ecran']:''))"; |
|
| 2854 | + $_class = interprete_argument_balise(1, $p); |
|
| 2855 | + if (!$_class) { |
|
| 2856 | + $_class = 'null'; |
|
| 2857 | + } |
|
| 2858 | + $p->code = "(is_string($_class)?vide(\$GLOBALS['largeur_ecran']=$_class):(isset(\$GLOBALS['largeur_ecran'])?\$GLOBALS['largeur_ecran']:''))"; |
|
| 2859 | 2859 | |
| 2860 | - return $p; |
|
| 2860 | + return $p; |
|
| 2861 | 2861 | } |
| 2862 | 2862 | |
| 2863 | 2863 | |
@@ -2873,14 +2873,14 @@ discard block |
||
| 2873 | 2873 | * Pile complétée par le code à générer |
| 2874 | 2874 | **/ |
| 2875 | 2875 | function balise_CONST_dist($p) { |
| 2876 | - $_const = interprete_argument_balise(1, $p); |
|
| 2877 | - if (!strlen($_const)) { |
|
| 2878 | - $p->code = "''"; |
|
| 2879 | - } |
|
| 2880 | - else { |
|
| 2881 | - $p->code = "(defined($_const)?constant($_const):'')"; |
|
| 2882 | - } |
|
| 2883 | - $p->interdire_scripts = false; |
|
| 2884 | - |
|
| 2885 | - return $p; |
|
| 2876 | + $_const = interprete_argument_balise(1, $p); |
|
| 2877 | + if (!strlen($_const)) { |
|
| 2878 | + $p->code = "''"; |
|
| 2879 | + } |
|
| 2880 | + else { |
|
| 2881 | + $p->code = "(defined($_const)?constant($_const):'')"; |
|
| 2882 | + } |
|
| 2883 | + $p->interdire_scripts = false; |
|
| 2884 | + |
|
| 2885 | + return $p; |
|
| 2886 | 2886 | } |
@@ -364,7 +364,7 @@ discard block |
||
| 364 | 364 | */ |
| 365 | 365 | function balise_DOSSIER_SQUELETTE_dist($p) { |
| 366 | 366 | $code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE)); |
| 367 | - $p->code = "_DIR_RACINE . '$code'" . |
|
| 367 | + $p->code = "_DIR_RACINE . '$code'". |
|
| 368 | 368 | $p->interdire_scripts = false; |
| 369 | 369 | |
| 370 | 370 | return $p; |
@@ -383,7 +383,7 @@ discard block |
||
| 383 | 383 | */ |
| 384 | 384 | function balise_SQUELETTE_dist($p) { |
| 385 | 385 | $code = addslashes($p->descr['sourcefile']); |
| 386 | - $p->code = "'$code'" . |
|
| 386 | + $p->code = "'$code'". |
|
| 387 | 387 | $p->interdire_scripts = false; |
| 388 | 388 | |
| 389 | 389 | return $p; |
@@ -435,9 +435,9 @@ discard block |
||
| 435 | 435 | **/ |
| 436 | 436 | function balise_NOM_SITE_dist($p) { |
| 437 | 437 | if (!$p->etoile) { |
| 438 | - $p->code = 'supprimer_numero(calculer_url(' . |
|
| 439 | - champ_sql('url_site', $p) . ',' . |
|
| 440 | - champ_sql('nom_site', $p) . |
|
| 438 | + $p->code = 'supprimer_numero(calculer_url('. |
|
| 439 | + champ_sql('url_site', $p).','. |
|
| 440 | + champ_sql('nom_site', $p). |
|
| 441 | 441 | ", 'titre', \$connect, false))"; |
| 442 | 442 | } else { |
| 443 | 443 | $p->code = champ_sql('nom_site', $p); |
@@ -588,8 +588,8 @@ discard block |
||
| 588 | 588 | * Pile complétée par le code à générer |
| 589 | 589 | **/ |
| 590 | 590 | function balise_POPULARITE_ABSOLUE_dist($p) { |
| 591 | - $p->code = 'ceil(' . |
|
| 592 | - champ_sql('popularite', $p) . |
|
| 591 | + $p->code = 'ceil('. |
|
| 592 | + champ_sql('popularite', $p). |
|
| 593 | 593 | ')'; |
| 594 | 594 | $p->interdire_scripts = false; |
| 595 | 595 | |
@@ -670,7 +670,7 @@ discard block |
||
| 670 | 670 | $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b); |
| 671 | 671 | ; |
| 672 | 672 | if (($v = interprete_argument_balise(1, $p)) !== null) { |
| 673 | - $p->code = 'table_valeur(' . $p->code . ', ' . $v . ')'; |
|
| 673 | + $p->code = 'table_valeur('.$p->code.', '.$v.')'; |
|
| 674 | 674 | } |
| 675 | 675 | $p->interdire_scripts = true; |
| 676 | 676 | |
@@ -809,16 +809,16 @@ discard block |
||
| 809 | 809 | $trouver_table = charger_fonction('trouver_table', 'base'); |
| 810 | 810 | if ($desc = $trouver_table(table_objet_sql($type_objet))) { |
| 811 | 811 | if (isset($desc['field']['descriptif'])) { |
| 812 | - $_ligne .= "'descriptif' => " . champ_sql('descriptif', $p) . ','; |
|
| 812 | + $_ligne .= "'descriptif' => ".champ_sql('descriptif', $p).','; |
|
| 813 | 813 | } |
| 814 | 814 | if (isset($desc['field']['texte'])) { |
| 815 | - $_ligne .= "'texte' => " . champ_sql('texte', $p) . ','; |
|
| 815 | + $_ligne .= "'texte' => ".champ_sql('texte', $p).','; |
|
| 816 | 816 | } |
| 817 | 817 | if (isset($desc['field']['chapo'])) { |
| 818 | - $_ligne .= "'chapo' => " . champ_sql('chapo', $p) . ','; |
|
| 818 | + $_ligne .= "'chapo' => ".champ_sql('chapo', $p).','; |
|
| 819 | 819 | } |
| 820 | 820 | if (isset($desc['introduction_longueur'])) { |
| 821 | - $_introduction_longueur = "'" . $desc['introduction_longueur'] . "'"; |
|
| 821 | + $_introduction_longueur = "'".$desc['introduction_longueur']."'"; |
|
| 822 | 822 | } |
| 823 | 823 | } |
| 824 | 824 | $_ligne .= ')'; |
@@ -917,10 +917,10 @@ discard block |
||
| 917 | 917 | $p->code = sprintf( |
| 918 | 918 | CODE_RECUPERER_FOND, |
| 919 | 919 | "'modeles/lesauteurs'", |
| 920 | - "array('objet'=>'" . $objet . |
|
| 921 | - "','id_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 922 | - ",'$id_table_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 923 | - ($objet == 'article' ? '' : ",'id_article' => " . champ_sql('id_article', $p)) . |
|
| 920 | + "array('objet'=>'".$objet. |
|
| 921 | + "','id_objet' => ".champ_sql($id_table_objet, $p). |
|
| 922 | + ",'$id_table_objet' => ".champ_sql($id_table_objet, $p). |
|
| 923 | + ($objet == 'article' ? '' : ",'id_article' => ".champ_sql('id_article', $p)). |
|
| 924 | 924 | ')', |
| 925 | 925 | "'trim'=>true, 'compil'=>array($c)", |
| 926 | 926 | _q($connect) |
@@ -989,7 +989,7 @@ discard block |
||
| 989 | 989 | $m = trim($m); |
| 990 | 990 | if ($m != "''") { |
| 991 | 991 | if (!preg_match(',\W,', $m)) { |
| 992 | - $m = $boucle->id_table . ".$m"; |
|
| 992 | + $m = $boucle->id_table.".$m"; |
|
| 993 | 993 | } |
| 994 | 994 | |
| 995 | 995 | $m .= ' AS titre_rang'; |
@@ -1150,7 +1150,7 @@ discard block |
||
| 1150 | 1150 | $f_pagination = chercher_filtre('pagination'); |
| 1151 | 1151 | $type = $p->boucles[$b]->modificateur['debut_nom']; |
| 1152 | 1152 | $modif = ($type[0] !== "'") ? "'debut'.$type" |
| 1153 | - : ("'debut" . substr($type, 1)); |
|
| 1153 | + : ("'debut".substr($type, 1)); |
|
| 1154 | 1154 | |
| 1155 | 1155 | $p->code = sprintf( |
| 1156 | 1156 | CODE_PAGINATION, |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN']]; |
| 1295 | 1295 | erreur_squelette($msg, $p); |
| 1296 | 1296 | } else { |
| 1297 | - $p->code = 'find_in_path(' . $arg . ')'; |
|
| 1297 | + $p->code = 'find_in_path('.$arg.')'; |
|
| 1298 | 1298 | } |
| 1299 | 1299 | |
| 1300 | 1300 | $p->interdire_scripts = false; |
@@ -1329,7 +1329,7 @@ discard block |
||
| 1329 | 1329 | $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN_IMAGE']]; |
| 1330 | 1330 | erreur_squelette($msg, $p); |
| 1331 | 1331 | } else { |
| 1332 | - $p->code = 'chemin_image(' . $arg . ')'; |
|
| 1332 | + $p->code = 'chemin_image('.$arg.')'; |
|
| 1333 | 1333 | } |
| 1334 | 1334 | |
| 1335 | 1335 | $p->interdire_scripts = false; |
@@ -1383,7 +1383,7 @@ discard block |
||
| 1383 | 1383 | // cas de #ENV sans argument : on retourne le serialize() du tableau |
| 1384 | 1384 | // une belle fonction [(#ENV|affiche_env)] serait pratique |
| 1385 | 1385 | if ($src) { |
| 1386 | - $p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")'; |
|
| 1386 | + $p->code = '(is_array($a = ('.$src.')) ? serialize($a) : "")'; |
|
| 1387 | 1387 | } else { |
| 1388 | 1388 | $p->code = 'serialize($Pile[0]??[])'; |
| 1389 | 1389 | } |
@@ -1436,8 +1436,8 @@ discard block |
||
| 1436 | 1436 | $_sinon = interprete_argument_balise(2, $p); |
| 1437 | 1437 | $_unserialize = sinon(interprete_argument_balise(3, $p), 'false'); |
| 1438 | 1438 | |
| 1439 | - $p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' . |
|
| 1440 | - ($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')"; |
|
| 1439 | + $p->code = '(include_spip(\'inc/config\')?lire_config('.$arg.','. |
|
| 1440 | + ($_sinon && $_sinon != "''" ? $_sinon : 'null').','.$_unserialize."):'')"; |
|
| 1441 | 1441 | |
| 1442 | 1442 | return $p; |
| 1443 | 1443 | } |
@@ -1530,7 +1530,7 @@ discard block |
||
| 1530 | 1530 | $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SESSION_SET']]; |
| 1531 | 1531 | erreur_squelette($err_b_s_a, $p); |
| 1532 | 1532 | } else { |
| 1533 | - $p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))'; |
|
| 1533 | + $p->code = '(include_spip("inc/session") AND session_set('.$_nom.','.$_val.'))'; |
|
| 1534 | 1534 | } |
| 1535 | 1535 | |
| 1536 | 1536 | $p->interdire_scripts = false; |
@@ -1578,7 +1578,7 @@ discard block |
||
| 1578 | 1578 | ) |
| 1579 | 1579 | ) { |
| 1580 | 1580 | $p->code = /* $r[1]. */ |
| 1581 | - '(' . $r[2] . ')'; |
|
| 1581 | + '('.$r[2].')'; |
|
| 1582 | 1582 | } else { |
| 1583 | 1583 | $p->code = "eval('return '.$php.';')"; |
| 1584 | 1584 | } |
@@ -1822,9 +1822,9 @@ discard block |
||
| 1822 | 1822 | |
| 1823 | 1823 | // noter la duree du cache dans un entete proprietaire |
| 1824 | 1824 | |
| 1825 | - $code = "'<'.'" . '?php header("X-Spip-Cache: ' |
|
| 1825 | + $code = "'<'.'".'?php header("X-Spip-Cache: ' |
|
| 1826 | 1826 | . $duree |
| 1827 | - . '"); ?' . "'.'>'"; |
|
| 1827 | + . '"); ?'."'.'>'"; |
|
| 1828 | 1828 | |
| 1829 | 1829 | // Remplir le header Cache-Control |
| 1830 | 1830 | // cas #CACHE{0} |
@@ -1845,9 +1845,9 @@ discard block |
||
| 1845 | 1845 | $pa == 'cache-client' |
| 1846 | 1846 | and $duree > 0 |
| 1847 | 1847 | ) { |
| 1848 | - $code .= ".'<'.'" . '?php header("Cache-Control: max-age=' |
|
| 1848 | + $code .= ".'<'.'".'?php header("Cache-Control: max-age=' |
|
| 1849 | 1849 | . $duree |
| 1850 | - . '"); ?' . "'.'>'"; |
|
| 1850 | + . '"); ?'."'.'>'"; |
|
| 1851 | 1851 | // il semble logique, si on cache-client, de ne pas invalider |
| 1852 | 1852 | $pa = 'statique'; |
| 1853 | 1853 | } |
@@ -1856,7 +1856,7 @@ discard block |
||
| 1856 | 1856 | $pa == 'statique' |
| 1857 | 1857 | and $duree > 0 |
| 1858 | 1858 | ) { |
| 1859 | - $code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'"; |
|
| 1859 | + $code .= ".'<'.'".'?php header("X-Spip-Statique: oui"); ?'."'.'>'"; |
|
| 1860 | 1860 | } |
| 1861 | 1861 | } |
| 1862 | 1862 | } else { |
@@ -2020,9 +2020,9 @@ discard block |
||
| 2020 | 2020 | if ($p->etoile) { |
| 2021 | 2021 | $_options[] = "'etoile'=>true"; |
| 2022 | 2022 | } |
| 2023 | - $_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ')'; |
|
| 2023 | + $_options[] = "'compil'=>array(".memoriser_contexte_compil($p).')'; |
|
| 2024 | 2024 | |
| 2025 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2025 | + $_l = 'array('.join(",\n\t", $_contexte).')'; |
|
| 2026 | 2026 | if ($flag_env) { |
| 2027 | 2027 | $_l = "array_merge(\$Pile[0],$_l)"; |
| 2028 | 2028 | } |
@@ -2032,7 +2032,7 @@ discard block |
||
| 2032 | 2032 | $msg = ['zbug_balise_sans_argument', ['balise' => ' INCLURE']]; |
| 2033 | 2033 | erreur_squelette($msg, $p); |
| 2034 | 2034 | } else { |
| 2035 | - $p->code = 'charge_scripts(' . $_contexte[1] . ',false)'; |
|
| 2035 | + $p->code = 'charge_scripts('.$_contexte[1].',false)'; |
|
| 2036 | 2036 | } |
| 2037 | 2037 | |
| 2038 | 2038 | $p->interdire_scripts = false; // la securite est assuree par recuperer_fond |
@@ -2080,7 +2080,7 @@ discard block |
||
| 2080 | 2080 | unset($_contexte[1]); |
| 2081 | 2081 | |
| 2082 | 2082 | if (preg_match("/^\s*'[^']*'/s", $nom)) { |
| 2083 | - $nom = "'modeles/" . substr($nom, 1); |
|
| 2083 | + $nom = "'modeles/".substr($nom, 1); |
|
| 2084 | 2084 | } else { |
| 2085 | 2085 | $nom = "'modeles/' . $nom"; |
| 2086 | 2086 | } |
@@ -2097,8 +2097,8 @@ discard block |
||
| 2097 | 2097 | $primary = $p->boucles[$p->id_boucle]->primary; |
| 2098 | 2098 | if (!strpos($primary, ',')) { |
| 2099 | 2099 | $id = champ_sql($primary, $p); |
| 2100 | - $_contexte[] = "'$primary'=>" . $id; |
|
| 2101 | - $_contexte[] = "'id'=>" . $id; |
|
| 2100 | + $_contexte[] = "'$primary'=>".$id; |
|
| 2101 | + $_contexte[] = "'id'=>".$id; |
|
| 2102 | 2102 | } |
| 2103 | 2103 | } |
| 2104 | 2104 | $_contexte[] = "'recurs'=>(++\$recurs)"; |
@@ -2110,11 +2110,11 @@ discard block |
||
| 2110 | 2110 | $_options = memoriser_contexte_compil($p); |
| 2111 | 2111 | $_options = "'compil'=>array($_options), 'trim'=>true"; |
| 2112 | 2112 | if (isset($_contexte['ajax'])) { |
| 2113 | - $_options .= ', ' . preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2113 | + $_options .= ', '.preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2114 | 2114 | unset($_contexte['ajax']); |
| 2115 | 2115 | } |
| 2116 | 2116 | |
| 2117 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2117 | + $_l = 'array('.join(",\n\t", $_contexte).')'; |
|
| 2118 | 2118 | if ($flag_env) { |
| 2119 | 2119 | $_l = "array_merge(\$Pile[0],$_l)"; |
| 2120 | 2120 | } |
@@ -2224,12 +2224,12 @@ discard block |
||
| 2224 | 2224 | function balise_DOUBLONS_dist($p) { |
| 2225 | 2225 | if ($type = interprete_argument_balise(1, $p)) { |
| 2226 | 2226 | if ($famille = interprete_argument_balise(2, $p)) { |
| 2227 | - $type .= '.' . $famille; |
|
| 2227 | + $type .= '.'.$famille; |
|
| 2228 | 2228 | } |
| 2229 | - $p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")'; |
|
| 2229 | + $p->code = '(isset($doublons['.$type.']) ? $doublons['.$type.'] : "")'; |
|
| 2230 | 2230 | if (!$p->etoile) { |
| 2231 | 2231 | $p->code = 'array_filter(array_map("intval",explode(",",' |
| 2232 | - . $p->code . ')))'; |
|
| 2232 | + . $p->code.')))'; |
|
| 2233 | 2233 | } |
| 2234 | 2234 | } else { |
| 2235 | 2235 | $p->code = '$doublons'; |
@@ -2358,7 +2358,7 @@ discard block |
||
| 2358 | 2358 | $_code[] = "$_key => $_val"; |
| 2359 | 2359 | } |
| 2360 | 2360 | } while ($_key && $_val); |
| 2361 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2361 | + $p->code = 'array('.join(', ', $_code).')'; |
|
| 2362 | 2362 | $p->interdire_scripts = false; |
| 2363 | 2363 | |
| 2364 | 2364 | return $p; |
@@ -2385,7 +2385,7 @@ discard block |
||
| 2385 | 2385 | while ($_val = interprete_argument_balise($n++, $p)) { |
| 2386 | 2386 | $_code[] = $_val; |
| 2387 | 2387 | } |
| 2388 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2388 | + $p->code = 'array('.join(', ', $_code).')'; |
|
| 2389 | 2389 | $p->interdire_scripts = false; |
| 2390 | 2390 | |
| 2391 | 2391 | return $p; |
@@ -2430,10 +2430,10 @@ discard block |
||
| 2430 | 2430 | $_code[] = $_v; |
| 2431 | 2431 | } |
| 2432 | 2432 | |
| 2433 | - $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join( |
|
| 2433 | + $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser('.join( |
|
| 2434 | 2434 | ', ', |
| 2435 | 2435 | $_code |
| 2436 | - ) . ')?" ":"")'; |
|
| 2436 | + ).')?" ":"")'; |
|
| 2437 | 2437 | $p->interdire_scripts = false; |
| 2438 | 2438 | |
| 2439 | 2439 | return $p; |
@@ -2466,7 +2466,7 @@ discard block |
||
| 2466 | 2466 | $type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"'; |
| 2467 | 2467 | |
| 2468 | 2468 | $f = chercher_filtre('info_plugin'); |
| 2469 | - $p->code = $f . '(' . $plugin . ', ' . $type_info . ')'; |
|
| 2469 | + $p->code = $f.'('.$plugin.', '.$type_info.')'; |
|
| 2470 | 2470 | |
| 2471 | 2471 | return $p; |
| 2472 | 2472 | } |
@@ -2716,12 +2716,12 @@ discard block |
||
| 2716 | 2716 | $_issens = "in_array($_champ,array('>','<'))"; |
| 2717 | 2717 | $_sens = "(strpos('< >',$_champ)-1)"; |
| 2718 | 2718 | |
| 2719 | - $_variable = "((\$s=$_issens)?'sens':'tri')." . $boucle->modificateur['tri_nom']; |
|
| 2719 | + $_variable = "((\$s=$_issens)?'sens':'tri').".$boucle->modificateur['tri_nom']; |
|
| 2720 | 2720 | $_url = "parametre_url(self(),$_variable,\$s?$_sens:$_champ)"; |
| 2721 | - $_url = "parametre_url($_url,'var_memotri',strncmp(" . $boucle->modificateur['tri_nom'] . ",'session',7)==0?$_variable:'')"; |
|
| 2722 | - $_on = '$s?(' . $boucle->modificateur['tri_sens'] . "==$_sens" . '):(' . $boucle->modificateur['tri_champ'] . "==$_champ)"; |
|
| 2721 | + $_url = "parametre_url($_url,'var_memotri',strncmp(".$boucle->modificateur['tri_nom'].",'session',7)==0?$_variable:'')"; |
|
| 2722 | + $_on = '$s?('.$boucle->modificateur['tri_sens']."==$_sens".'):('.$boucle->modificateur['tri_champ']."==$_champ)"; |
|
| 2723 | 2723 | |
| 2724 | - $p->code = "lien_ou_expose($_url,$_libelle,$_on" . ($_class ? ",$_class" : '') . ')'; |
|
| 2724 | + $p->code = "lien_ou_expose($_url,$_libelle,$_on".($_class ? ",$_class" : '').')'; |
|
| 2725 | 2725 | //$p->code = "''"; |
| 2726 | 2726 | $p->interdire_scripts = false; |
| 2727 | 2727 | |
@@ -2795,7 +2795,7 @@ discard block |
||
| 2795 | 2795 | $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
| 2796 | 2796 | } |
| 2797 | 2797 | |
| 2798 | - $p->code = '(objet_test_si_publie(' . $_type . ',intval(' . $_id . '),' . _q($connect) . ")?' ':'')"; |
|
| 2798 | + $p->code = '(objet_test_si_publie('.$_type.',intval('.$_id.'),'._q($connect).")?' ':'')"; |
|
| 2799 | 2799 | $p->interdire_scripts = false; |
| 2800 | 2800 | |
| 2801 | 2801 | return $p; |
@@ -37,11 +37,11 @@ |
||
| 37 | 37 | include_spip('inc/filtres'); |
| 38 | 38 | |
| 39 | 39 | // Inserer le css d'admin |
| 40 | - $css = "<link rel='stylesheet' href='" . url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 40 | + $css = "<link rel='stylesheet' href='".url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 41 | 41 | . "' type='text/css' />\n"; |
| 42 | 42 | if ($f = find_in_path('spip_admin_perso.css')) { |
| 43 | 43 | $css .= "<link rel='stylesheet' href='" |
| 44 | - . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
|
| 44 | + . url_absolue(direction_css($f))."' type='text/css' />\n"; |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | ($pos = stripos($contenu, '</head>')) |
@@ -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 | /** |
@@ -34,33 +34,33 @@ discard block |
||
| 34 | 34 | * Contenu HTML, avec boutons d'administrations et sa CSS |
| 35 | 35 | **/ |
| 36 | 36 | function affiche_boutons_admin($contenu) { |
| 37 | - include_spip('inc/filtres'); |
|
| 37 | + include_spip('inc/filtres'); |
|
| 38 | 38 | |
| 39 | - // Inserer le css d'admin |
|
| 40 | - $css = "<link rel='stylesheet' href='" . url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 41 | - . "' type='text/css' />\n"; |
|
| 42 | - if ($f = find_in_path('spip_admin_perso.css')) { |
|
| 43 | - $css .= "<link rel='stylesheet' href='" |
|
| 44 | - . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
|
| 45 | - } |
|
| 39 | + // Inserer le css d'admin |
|
| 40 | + $css = "<link rel='stylesheet' href='" . url_absolue(direction_css(find_in_path('spip_admin.css'))) |
|
| 41 | + . "' type='text/css' />\n"; |
|
| 42 | + if ($f = find_in_path('spip_admin_perso.css')) { |
|
| 43 | + $css .= "<link rel='stylesheet' href='" |
|
| 44 | + . url_absolue(direction_css($f)) . "' type='text/css' />\n"; |
|
| 45 | + } |
|
| 46 | 46 | |
| 47 | - ($pos = stripos($contenu, '</head>')) |
|
| 48 | - || ($pos = stripos($contenu, '<body>')) |
|
| 49 | - || ($pos = 0); |
|
| 50 | - $contenu = substr_replace($contenu, $css, $pos, 0); |
|
| 47 | + ($pos = stripos($contenu, '</head>')) |
|
| 48 | + || ($pos = stripos($contenu, '<body>')) |
|
| 49 | + || ($pos = 0); |
|
| 50 | + $contenu = substr_replace($contenu, $css, $pos, 0); |
|
| 51 | 51 | |
| 52 | 52 | |
| 53 | - // Inserer la balise #FORMULAIRE_ADMIN, en float |
|
| 54 | - $boutons_admin = inclure_balise_dynamique( |
|
| 55 | - balise_FORMULAIRE_ADMIN_dyn('spip-admin-float'), |
|
| 56 | - false |
|
| 57 | - ); |
|
| 53 | + // Inserer la balise #FORMULAIRE_ADMIN, en float |
|
| 54 | + $boutons_admin = inclure_balise_dynamique( |
|
| 55 | + balise_FORMULAIRE_ADMIN_dyn('spip-admin-float'), |
|
| 56 | + false |
|
| 57 | + ); |
|
| 58 | 58 | |
| 59 | - ($pos = strripos($contenu, '</body>')) |
|
| 60 | - || ($pos = strripos($contenu, '</html>')) |
|
| 61 | - || ($pos = strlen($contenu)); |
|
| 62 | - $contenu = substr_replace($contenu, $boutons_admin, $pos, 0); |
|
| 59 | + ($pos = strripos($contenu, '</body>')) |
|
| 60 | + || ($pos = strripos($contenu, '</html>')) |
|
| 61 | + || ($pos = strlen($contenu)); |
|
| 62 | + $contenu = substr_replace($contenu, $boutons_admin, $pos, 0); |
|
| 63 | 63 | |
| 64 | 64 | |
| 65 | - return $contenu; |
|
| 65 | + return $contenu; |
|
| 66 | 66 | } |
@@ -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'); |
@@ -29,20 +29,20 @@ discard block |
||
| 29 | 29 | * @uses ajax_retour() |
| 30 | 30 | **/ |
| 31 | 31 | function exec_informer_dist() { |
| 32 | - $id = intval(_request('id')); |
|
| 33 | - $col = intval(_request('col')); |
|
| 34 | - $exclus = intval(_request('exclus')); |
|
| 35 | - $do = _request('do'); |
|
| 32 | + $id = intval(_request('id')); |
|
| 33 | + $col = intval(_request('col')); |
|
| 34 | + $exclus = intval(_request('exclus')); |
|
| 35 | + $do = _request('do'); |
|
| 36 | 36 | |
| 37 | - if (preg_match('/^\w*$/', $do)) { |
|
| 38 | - if (!$do) { |
|
| 39 | - $do = 'aff'; |
|
| 40 | - } |
|
| 37 | + if (preg_match('/^\w*$/', $do)) { |
|
| 38 | + if (!$do) { |
|
| 39 | + $do = 'aff'; |
|
| 40 | + } |
|
| 41 | 41 | |
| 42 | - $informer = charger_fonction('informer', 'inc'); |
|
| 43 | - $res = $informer($id, $col, $exclus, _request('rac'), _request('type'), $do); |
|
| 44 | - } else { |
|
| 45 | - $res = ''; |
|
| 46 | - } |
|
| 47 | - ajax_retour($res); |
|
| 42 | + $informer = charger_fonction('informer', 'inc'); |
|
| 43 | + $res = $informer($id, $col, $exclus, _request('rac'), _request('type'), $do); |
|
| 44 | + } else { |
|
| 45 | + $res = ''; |
|
| 46 | + } |
|
| 47 | + ajax_retour($res); |
|
| 48 | 48 | } |