@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | * @param string|null $source |
| 86 | 86 | * D'où provient l'auteur créé ? par défaut 'spip', mais peut être 'ldap' ou autre. |
| 87 | 87 | * @param array|null $set |
| 88 | - * @return int |
|
| 88 | + * @return boolean|string |
|
| 89 | 89 | * Identifiant de l'auteur créé |
| 90 | 90 | */ |
| 91 | 91 | function auteur_inserer($source = null, $set = null) { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @param bool $force_update |
| 141 | 141 | * Permet de forcer la maj en base des champs fournis, sans passer par instancier. |
| 142 | 142 | * Utilise par auth/spip |
| 143 | - * @return string|null |
|
| 143 | + * @return string|false |
|
| 144 | 144 | * |
| 145 | 145 | * - Chaîne vide si aucune erreur, |
| 146 | 146 | * - Chaîne contenant un texte d'erreur sinon. |
@@ -304,7 +304,7 @@ discard block |
||
| 304 | 304 | * Couples (colonne => valeur) des données à instituer |
| 305 | 305 | * @param bool $force_webmestre |
| 306 | 306 | * Autoriser un auteur à passer webmestre (force l'autorisation) |
| 307 | - * @return bool|string |
|
| 307 | + * @return false|string |
|
| 308 | 308 | */ |
| 309 | 309 | function auteur_instituer($id_auteur, $c, $force_webmestre = false) { |
| 310 | 310 | if (!$id_auteur = intval($id_auteur)) { |
@@ -449,7 +449,7 @@ discard block |
||
| 449 | 449 | * @see auteur_inserer() |
| 450 | 450 | * |
| 451 | 451 | * @param string|null $source |
| 452 | - * @return int |
|
| 452 | + * @return boolean|string |
|
| 453 | 453 | */ |
| 454 | 454 | function insert_auteur($source = null) { |
| 455 | 455 | return auteur_inserer($source); |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | * |
| 464 | 464 | * @param int $id_auteur |
| 465 | 465 | * @param array|null $set |
| 466 | - * @return string|null |
|
| 466 | + * @return string|false |
|
| 467 | 467 | */ |
| 468 | 468 | function auteurs_set($id_auteur, $set = null) { |
| 469 | 469 | return auteur_modifier($id_auteur, $set); |
@@ -478,7 +478,7 @@ discard block |
||
| 478 | 478 | * @param int $id_auteur |
| 479 | 479 | * @param array $c |
| 480 | 480 | * @param bool $force_webmestre |
| 481 | - * @return bool|string |
|
| 481 | + * @return false|string |
|
| 482 | 482 | */ |
| 483 | 483 | function instituer_auteur($id_auteur, $c, $force_webmestre = false) { |
| 484 | 484 | return auteur_instituer($id_auteur, $c, $force_webmestre); |
@@ -492,7 +492,7 @@ discard block |
||
| 492 | 492 | * |
| 493 | 493 | * @param int $id_auteur |
| 494 | 494 | * @param array $c |
| 495 | - * @return string|null |
|
| 495 | + * @return string|false |
|
| 496 | 496 | */ |
| 497 | 497 | function revision_auteur($id_auteur, $c = false) { |
| 498 | 498 | return auteur_modifier($id_auteur, $c); |
@@ -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 | /** |
@@ -37,43 +37,43 @@ discard block |
||
| 37 | 37 | */ |
| 38 | 38 | function action_editer_auteur_dist($arg = null) { |
| 39 | 39 | |
| 40 | - if (is_null($arg)) { |
|
| 41 | - $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 42 | - $arg = $securiser_action(); |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - |
|
| 46 | - // si id_auteur n'est pas un nombre, c'est une creation |
|
| 47 | - if (!$id_auteur = intval($arg)) { |
|
| 48 | - |
|
| 49 | - if (($id_auteur = auteur_inserer()) > 0) { |
|
| 50 | - |
|
| 51 | - # cf. GROS HACK |
|
| 52 | - # recuperer l'eventuel logo charge avant la creation |
|
| 53 | - # ils ont un id = 0-id_auteur de la session |
|
| 54 | - $id_hack = 0 - $GLOBALS['visiteur_session']['id_auteur']; |
|
| 55 | - $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 56 | - foreach (array('on', 'off') as $type) { |
|
| 57 | - if ($logo = $chercher_logo($id_hack, 'id_auteur', $type)) { |
|
| 58 | - if ($logo = reset($logo)) { |
|
| 59 | - rename($logo, str_replace($id_hack, $id_auteur, $logo)); |
|
| 60 | - } |
|
| 61 | - } |
|
| 62 | - } |
|
| 63 | - } |
|
| 64 | - } |
|
| 65 | - |
|
| 66 | - // Enregistre l'envoi dans la BD |
|
| 67 | - $err = ""; |
|
| 68 | - if ($id_auteur > 0) { |
|
| 69 | - $err = auteur_modifier($id_auteur); |
|
| 70 | - } |
|
| 71 | - |
|
| 72 | - if ($err) { |
|
| 73 | - spip_log("echec editeur auteur: $err", _LOG_ERREUR); |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - return array($id_auteur, $err); |
|
| 40 | + if (is_null($arg)) { |
|
| 41 | + $securiser_action = charger_fonction('securiser_action', 'inc'); |
|
| 42 | + $arg = $securiser_action(); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + |
|
| 46 | + // si id_auteur n'est pas un nombre, c'est une creation |
|
| 47 | + if (!$id_auteur = intval($arg)) { |
|
| 48 | + |
|
| 49 | + if (($id_auteur = auteur_inserer()) > 0) { |
|
| 50 | + |
|
| 51 | + # cf. GROS HACK |
|
| 52 | + # recuperer l'eventuel logo charge avant la creation |
|
| 53 | + # ils ont un id = 0-id_auteur de la session |
|
| 54 | + $id_hack = 0 - $GLOBALS['visiteur_session']['id_auteur']; |
|
| 55 | + $chercher_logo = charger_fonction('chercher_logo', 'inc'); |
|
| 56 | + foreach (array('on', 'off') as $type) { |
|
| 57 | + if ($logo = $chercher_logo($id_hack, 'id_auteur', $type)) { |
|
| 58 | + if ($logo = reset($logo)) { |
|
| 59 | + rename($logo, str_replace($id_hack, $id_auteur, $logo)); |
|
| 60 | + } |
|
| 61 | + } |
|
| 62 | + } |
|
| 63 | + } |
|
| 64 | + } |
|
| 65 | + |
|
| 66 | + // Enregistre l'envoi dans la BD |
|
| 67 | + $err = ""; |
|
| 68 | + if ($id_auteur > 0) { |
|
| 69 | + $err = auteur_modifier($id_auteur); |
|
| 70 | + } |
|
| 71 | + |
|
| 72 | + if ($err) { |
|
| 73 | + spip_log("echec editeur auteur: $err", _LOG_ERREUR); |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + return array($id_auteur, $err); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | /** |
@@ -90,42 +90,42 @@ discard block |
||
| 90 | 90 | */ |
| 91 | 91 | function auteur_inserer($source = null, $set = null) { |
| 92 | 92 | |
| 93 | - // Ce qu'on va demander comme modifications |
|
| 94 | - $champs = array(); |
|
| 95 | - $champs['source'] = $source ? $source : 'spip'; |
|
| 96 | - |
|
| 97 | - $champs['login'] = ''; |
|
| 98 | - $champs['statut'] = '5poubelle'; // inutilisable tant qu'il n'a pas ete renseigne et institue |
|
| 99 | - $champs['webmestre'] = 'non'; |
|
| 100 | - if (empty($champs['imessage'])) { |
|
| 101 | - $champs['imessage'] = 'oui'; |
|
| 102 | - } |
|
| 103 | - |
|
| 104 | - if ($set) { |
|
| 105 | - $champs = array_merge($champs, $set); |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - // Envoyer aux plugins |
|
| 109 | - $champs = pipeline('pre_insertion', |
|
| 110 | - array( |
|
| 111 | - 'args' => array( |
|
| 112 | - 'table' => 'spip_auteurs', |
|
| 113 | - ), |
|
| 114 | - 'data' => $champs |
|
| 115 | - ) |
|
| 116 | - ); |
|
| 117 | - $id_auteur = sql_insertq("spip_auteurs", $champs); |
|
| 118 | - pipeline('post_insertion', |
|
| 119 | - array( |
|
| 120 | - 'args' => array( |
|
| 121 | - 'table' => 'spip_auteurs', |
|
| 122 | - 'id_objet' => $id_auteur |
|
| 123 | - ), |
|
| 124 | - 'data' => $champs |
|
| 125 | - ) |
|
| 126 | - ); |
|
| 127 | - |
|
| 128 | - return $id_auteur; |
|
| 93 | + // Ce qu'on va demander comme modifications |
|
| 94 | + $champs = array(); |
|
| 95 | + $champs['source'] = $source ? $source : 'spip'; |
|
| 96 | + |
|
| 97 | + $champs['login'] = ''; |
|
| 98 | + $champs['statut'] = '5poubelle'; // inutilisable tant qu'il n'a pas ete renseigne et institue |
|
| 99 | + $champs['webmestre'] = 'non'; |
|
| 100 | + if (empty($champs['imessage'])) { |
|
| 101 | + $champs['imessage'] = 'oui'; |
|
| 102 | + } |
|
| 103 | + |
|
| 104 | + if ($set) { |
|
| 105 | + $champs = array_merge($champs, $set); |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + // Envoyer aux plugins |
|
| 109 | + $champs = pipeline('pre_insertion', |
|
| 110 | + array( |
|
| 111 | + 'args' => array( |
|
| 112 | + 'table' => 'spip_auteurs', |
|
| 113 | + ), |
|
| 114 | + 'data' => $champs |
|
| 115 | + ) |
|
| 116 | + ); |
|
| 117 | + $id_auteur = sql_insertq("spip_auteurs", $champs); |
|
| 118 | + pipeline('post_insertion', |
|
| 119 | + array( |
|
| 120 | + 'args' => array( |
|
| 121 | + 'table' => 'spip_auteurs', |
|
| 122 | + 'id_objet' => $id_auteur |
|
| 123 | + ), |
|
| 124 | + 'data' => $champs |
|
| 125 | + ) |
|
| 126 | + ); |
|
| 127 | + |
|
| 128 | + return $id_auteur; |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | |
@@ -150,66 +150,66 @@ discard block |
||
| 150 | 150 | */ |
| 151 | 151 | function auteur_modifier($id_auteur, $set = null, $force_update = false) { |
| 152 | 152 | |
| 153 | - include_spip('inc/modifier'); |
|
| 154 | - include_spip('inc/filtres'); |
|
| 155 | - $c = collecter_requests( |
|
| 156 | - // white list |
|
| 157 | - objet_info('auteur', 'champs_editables'), |
|
| 158 | - // black list |
|
| 159 | - $force_update ? array() : array('webmestre', 'pass', 'login'), |
|
| 160 | - // donnees eventuellement fournies |
|
| 161 | - $set |
|
| 162 | - ); |
|
| 163 | - |
|
| 164 | - if ($err = objet_modifier_champs('auteur', $id_auteur, |
|
| 165 | - array( |
|
| 166 | - 'data' => $set, |
|
| 167 | - 'nonvide' => array('nom' => _T('ecrire:item_nouvel_auteur')) |
|
| 168 | - ), |
|
| 169 | - $c) |
|
| 170 | - ) { |
|
| 171 | - return $err; |
|
| 172 | - } |
|
| 173 | - $session = $c; |
|
| 174 | - |
|
| 175 | - $err = ''; |
|
| 176 | - if (!$force_update) { |
|
| 177 | - // Modification de statut, changement de rubrique ? |
|
| 178 | - $c = collecter_requests( |
|
| 179 | - // white list |
|
| 180 | - array( |
|
| 181 | - 'statut', |
|
| 182 | - 'new_login', |
|
| 183 | - 'new_pass', |
|
| 184 | - 'login', |
|
| 185 | - 'pass', |
|
| 186 | - 'webmestre', |
|
| 187 | - 'restreintes', |
|
| 188 | - 'id_parent' |
|
| 189 | - ), |
|
| 190 | - // black list |
|
| 191 | - array(), |
|
| 192 | - // donnees eventuellement fournies |
|
| 193 | - $set |
|
| 194 | - ); |
|
| 195 | - if (isset($c['new_login']) and !isset($c['login'])) { |
|
| 196 | - $c['login'] = $c['new_login']; |
|
| 197 | - } |
|
| 198 | - if (isset($c['new_pass']) and !isset($c['pass'])) { |
|
| 199 | - $c['pass'] = $c['new_pass']; |
|
| 200 | - } |
|
| 201 | - $err = auteur_instituer($id_auteur, $c); |
|
| 202 | - $session = array_merge($session, $c); |
|
| 203 | - } |
|
| 204 | - |
|
| 205 | - // .. mettre a jour les sessions de cet auteur |
|
| 206 | - include_spip('inc/session'); |
|
| 207 | - $session['id_auteur'] = $id_auteur; |
|
| 208 | - unset($session['new_login']); |
|
| 209 | - unset($session['new_pass']); |
|
| 210 | - actualiser_sessions($session); |
|
| 211 | - |
|
| 212 | - return $err; |
|
| 153 | + include_spip('inc/modifier'); |
|
| 154 | + include_spip('inc/filtres'); |
|
| 155 | + $c = collecter_requests( |
|
| 156 | + // white list |
|
| 157 | + objet_info('auteur', 'champs_editables'), |
|
| 158 | + // black list |
|
| 159 | + $force_update ? array() : array('webmestre', 'pass', 'login'), |
|
| 160 | + // donnees eventuellement fournies |
|
| 161 | + $set |
|
| 162 | + ); |
|
| 163 | + |
|
| 164 | + if ($err = objet_modifier_champs('auteur', $id_auteur, |
|
| 165 | + array( |
|
| 166 | + 'data' => $set, |
|
| 167 | + 'nonvide' => array('nom' => _T('ecrire:item_nouvel_auteur')) |
|
| 168 | + ), |
|
| 169 | + $c) |
|
| 170 | + ) { |
|
| 171 | + return $err; |
|
| 172 | + } |
|
| 173 | + $session = $c; |
|
| 174 | + |
|
| 175 | + $err = ''; |
|
| 176 | + if (!$force_update) { |
|
| 177 | + // Modification de statut, changement de rubrique ? |
|
| 178 | + $c = collecter_requests( |
|
| 179 | + // white list |
|
| 180 | + array( |
|
| 181 | + 'statut', |
|
| 182 | + 'new_login', |
|
| 183 | + 'new_pass', |
|
| 184 | + 'login', |
|
| 185 | + 'pass', |
|
| 186 | + 'webmestre', |
|
| 187 | + 'restreintes', |
|
| 188 | + 'id_parent' |
|
| 189 | + ), |
|
| 190 | + // black list |
|
| 191 | + array(), |
|
| 192 | + // donnees eventuellement fournies |
|
| 193 | + $set |
|
| 194 | + ); |
|
| 195 | + if (isset($c['new_login']) and !isset($c['login'])) { |
|
| 196 | + $c['login'] = $c['new_login']; |
|
| 197 | + } |
|
| 198 | + if (isset($c['new_pass']) and !isset($c['pass'])) { |
|
| 199 | + $c['pass'] = $c['new_pass']; |
|
| 200 | + } |
|
| 201 | + $err = auteur_instituer($id_auteur, $c); |
|
| 202 | + $session = array_merge($session, $c); |
|
| 203 | + } |
|
| 204 | + |
|
| 205 | + // .. mettre a jour les sessions de cet auteur |
|
| 206 | + include_spip('inc/session'); |
|
| 207 | + $session['id_auteur'] = $id_auteur; |
|
| 208 | + unset($session['new_login']); |
|
| 209 | + unset($session['new_pass']); |
|
| 210 | + actualiser_sessions($session); |
|
| 211 | + |
|
| 212 | + return $err; |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | /** |
@@ -230,9 +230,9 @@ discard block |
||
| 230 | 230 | * @return string |
| 231 | 231 | */ |
| 232 | 232 | function auteur_associer($id_auteur, $objets, $qualif = null) { |
| 233 | - include_spip('action/editer_liens'); |
|
| 233 | + include_spip('action/editer_liens'); |
|
| 234 | 234 | |
| 235 | - return objet_associer(array('auteur' => $id_auteur), $objets, $qualif); |
|
| 235 | + return objet_associer(array('auteur' => $id_auteur), $objets, $qualif); |
|
| 236 | 236 | } |
| 237 | 237 | |
| 238 | 238 | /** |
@@ -251,9 +251,9 @@ discard block |
||
| 251 | 251 | * @return string |
| 252 | 252 | */ |
| 253 | 253 | function auteur_dissocier($id_auteur, $objets) { |
| 254 | - include_spip('action/editer_liens'); |
|
| 254 | + include_spip('action/editer_liens'); |
|
| 255 | 255 | |
| 256 | - return objet_dissocier(array('auteur' => $id_auteur), $objets); |
|
| 256 | + return objet_dissocier(array('auteur' => $id_auteur), $objets); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | /** |
@@ -274,9 +274,9 @@ discard block |
||
| 274 | 274 | * @return bool|int |
| 275 | 275 | */ |
| 276 | 276 | function auteur_qualifier($id_auteur, $objets, $qualif) { |
| 277 | - include_spip('action/editer_liens'); |
|
| 277 | + include_spip('action/editer_liens'); |
|
| 278 | 278 | |
| 279 | - return objet_qualifier_liens(array('auteur' => $id_auteur), $objets, $qualif); |
|
| 279 | + return objet_qualifier_liens(array('auteur' => $id_auteur), $objets, $qualif); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | |
@@ -295,133 +295,133 @@ discard block |
||
| 295 | 295 | * @return bool|string |
| 296 | 296 | */ |
| 297 | 297 | function auteur_instituer($id_auteur, $c, $force_webmestre = false) { |
| 298 | - if (!$id_auteur = intval($id_auteur)) { |
|
| 299 | - return false; |
|
| 300 | - } |
|
| 301 | - $erreurs = array(); // contiendra les differentes erreurs a traduire par _T() |
|
| 302 | - $champs = array(); |
|
| 303 | - |
|
| 304 | - // les memoriser pour les faire passer dans le pipeline pre_edition |
|
| 305 | - if (isset($c['login']) and strlen($c['login'])) { |
|
| 306 | - $champs['login'] = $c['login']; |
|
| 307 | - } |
|
| 308 | - if (isset($c['pass']) and strlen($c['pass'])) { |
|
| 309 | - $champs['pass'] = $c['pass']; |
|
| 310 | - } |
|
| 311 | - |
|
| 312 | - $statut = $statut_ancien = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 313 | - |
|
| 314 | - if (isset($c['statut']) |
|
| 315 | - and (autoriser('modifier', 'auteur', $id_auteur, null, array('statut' => $c['statut']))) |
|
| 316 | - ) { |
|
| 317 | - $statut = $champs['statut'] = $c['statut']; |
|
| 318 | - } |
|
| 319 | - |
|
| 320 | - // Restreindre avant de declarer l'auteur |
|
| 321 | - // (section critique sur les droits) |
|
| 322 | - if (isset($c['id_parent']) and $c['id_parent']) { |
|
| 323 | - if (is_array($c['restreintes'])) { |
|
| 324 | - $c['restreintes'][] = $c['id_parent']; |
|
| 325 | - } else { |
|
| 326 | - $c['restreintes'] = array($c['id_parent']); |
|
| 327 | - } |
|
| 328 | - } |
|
| 329 | - |
|
| 330 | - if (isset($c['webmestre']) |
|
| 331 | - and ($force_webmestre or autoriser('modifier', 'auteur', $id_auteur, null, array('webmestre' => '?'))) |
|
| 332 | - ) { |
|
| 333 | - $champs['webmestre'] = $c['webmestre'] == 'oui' ? 'oui' : 'non'; |
|
| 334 | - } |
|
| 335 | - |
|
| 336 | - // si statut change et n'est pas 0minirezo, on force webmestre a non |
|
| 337 | - if (isset($c['statut']) and $c['statut'] !== '0minirezo') { |
|
| 338 | - $champs['webmestre'] = $c['webmestre'] = 'non'; |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - // Envoyer aux plugins |
|
| 342 | - $champs = pipeline('pre_edition', |
|
| 343 | - array( |
|
| 344 | - 'args' => array( |
|
| 345 | - 'table' => 'spip_auteurs', |
|
| 346 | - 'id_objet' => $id_auteur, |
|
| 347 | - 'action' => 'instituer', |
|
| 348 | - 'statut_ancien' => $statut_ancien, |
|
| 349 | - ), |
|
| 350 | - 'data' => $champs |
|
| 351 | - ) |
|
| 352 | - ); |
|
| 353 | - |
|
| 354 | - if (isset($c['restreintes']) and is_array($c['restreintes']) |
|
| 355 | - and autoriser('modifier', 'auteur', $id_auteur, null, array('restreint' => $c['restreintes'])) |
|
| 356 | - ) { |
|
| 357 | - $rubriques = array_map('intval', $c['restreintes']); |
|
| 358 | - $rubriques = array_unique($rubriques); |
|
| 359 | - $rubriques = array_diff($rubriques, array(0)); |
|
| 360 | - auteur_dissocier($id_auteur, array('rubrique' => '*')); |
|
| 361 | - auteur_associer($id_auteur, array('rubrique' => $rubriques)); |
|
| 362 | - } |
|
| 363 | - |
|
| 364 | - $flag_ecrire_acces = false; |
|
| 365 | - // commencer par traiter les cas particuliers des logins et pass |
|
| 366 | - // avant les autres ecritures en base |
|
| 367 | - if (isset($champs['login']) or isset($champs['pass'])) { |
|
| 368 | - $auth_methode = sql_getfetsel('source', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 369 | - include_spip('inc/auth'); |
|
| 370 | - if (isset($champs['login']) and strlen($champs['login'])) { |
|
| 371 | - if (!auth_modifier_login($auth_methode, $champs['login'], $id_auteur)) { |
|
| 372 | - $erreurs[] = 'ecrire:impossible_modifier_login_auteur'; |
|
| 373 | - } |
|
| 374 | - } |
|
| 375 | - if (isset($champs['pass']) and strlen($champs['pass'])) { |
|
| 376 | - $champs['login'] = sql_getfetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 377 | - if (!auth_modifier_pass($auth_methode, $champs['login'], $champs['pass'], $id_auteur)) { |
|
| 378 | - $erreurs[] = 'ecrire:impossible_modifier_pass_auteur'; |
|
| 379 | - } |
|
| 380 | - } |
|
| 381 | - unset($champs['login']); |
|
| 382 | - unset($champs['pass']); |
|
| 383 | - $flag_ecrire_acces = true; |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - if (!count($champs)) { |
|
| 387 | - return implode(' ', array_map('_T', $erreurs)); |
|
| 388 | - } |
|
| 389 | - sql_updateq('spip_auteurs', $champs, 'id_auteur=' . $id_auteur); |
|
| 390 | - |
|
| 391 | - // .. mettre a jour les fichiers .htpasswd et .htpasswd-admin |
|
| 392 | - if ($flag_ecrire_acces |
|
| 393 | - or isset($champs['statut']) |
|
| 394 | - ) { |
|
| 395 | - include_spip('inc/acces'); |
|
| 396 | - ecrire_acces(); |
|
| 397 | - } |
|
| 398 | - |
|
| 399 | - // Invalider les caches |
|
| 400 | - include_spip('inc/invalideur'); |
|
| 401 | - suivre_invalideur("id='auteur/$id_auteur'"); |
|
| 402 | - |
|
| 403 | - // Pipeline |
|
| 404 | - pipeline('post_edition', |
|
| 405 | - array( |
|
| 406 | - 'args' => array( |
|
| 407 | - 'table' => 'spip_auteurs', |
|
| 408 | - 'id_objet' => $id_auteur, |
|
| 409 | - 'action' => 'instituer', |
|
| 410 | - 'statut_ancien' => $statut_ancien, |
|
| 411 | - ), |
|
| 412 | - 'data' => $champs |
|
| 413 | - ) |
|
| 414 | - ); |
|
| 415 | - |
|
| 416 | - |
|
| 417 | - // Notifications |
|
| 418 | - if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 419 | - $notifications('instituerauteur', $id_auteur, |
|
| 420 | - array('statut' => $statut, 'statut_ancien' => $statut_ancien) |
|
| 421 | - ); |
|
| 422 | - } |
|
| 423 | - |
|
| 424 | - return implode(' ', array_map('_T', $erreurs)); |
|
| 298 | + if (!$id_auteur = intval($id_auteur)) { |
|
| 299 | + return false; |
|
| 300 | + } |
|
| 301 | + $erreurs = array(); // contiendra les differentes erreurs a traduire par _T() |
|
| 302 | + $champs = array(); |
|
| 303 | + |
|
| 304 | + // les memoriser pour les faire passer dans le pipeline pre_edition |
|
| 305 | + if (isset($c['login']) and strlen($c['login'])) { |
|
| 306 | + $champs['login'] = $c['login']; |
|
| 307 | + } |
|
| 308 | + if (isset($c['pass']) and strlen($c['pass'])) { |
|
| 309 | + $champs['pass'] = $c['pass']; |
|
| 310 | + } |
|
| 311 | + |
|
| 312 | + $statut = $statut_ancien = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 313 | + |
|
| 314 | + if (isset($c['statut']) |
|
| 315 | + and (autoriser('modifier', 'auteur', $id_auteur, null, array('statut' => $c['statut']))) |
|
| 316 | + ) { |
|
| 317 | + $statut = $champs['statut'] = $c['statut']; |
|
| 318 | + } |
|
| 319 | + |
|
| 320 | + // Restreindre avant de declarer l'auteur |
|
| 321 | + // (section critique sur les droits) |
|
| 322 | + if (isset($c['id_parent']) and $c['id_parent']) { |
|
| 323 | + if (is_array($c['restreintes'])) { |
|
| 324 | + $c['restreintes'][] = $c['id_parent']; |
|
| 325 | + } else { |
|
| 326 | + $c['restreintes'] = array($c['id_parent']); |
|
| 327 | + } |
|
| 328 | + } |
|
| 329 | + |
|
| 330 | + if (isset($c['webmestre']) |
|
| 331 | + and ($force_webmestre or autoriser('modifier', 'auteur', $id_auteur, null, array('webmestre' => '?'))) |
|
| 332 | + ) { |
|
| 333 | + $champs['webmestre'] = $c['webmestre'] == 'oui' ? 'oui' : 'non'; |
|
| 334 | + } |
|
| 335 | + |
|
| 336 | + // si statut change et n'est pas 0minirezo, on force webmestre a non |
|
| 337 | + if (isset($c['statut']) and $c['statut'] !== '0minirezo') { |
|
| 338 | + $champs['webmestre'] = $c['webmestre'] = 'non'; |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + // Envoyer aux plugins |
|
| 342 | + $champs = pipeline('pre_edition', |
|
| 343 | + array( |
|
| 344 | + 'args' => array( |
|
| 345 | + 'table' => 'spip_auteurs', |
|
| 346 | + 'id_objet' => $id_auteur, |
|
| 347 | + 'action' => 'instituer', |
|
| 348 | + 'statut_ancien' => $statut_ancien, |
|
| 349 | + ), |
|
| 350 | + 'data' => $champs |
|
| 351 | + ) |
|
| 352 | + ); |
|
| 353 | + |
|
| 354 | + if (isset($c['restreintes']) and is_array($c['restreintes']) |
|
| 355 | + and autoriser('modifier', 'auteur', $id_auteur, null, array('restreint' => $c['restreintes'])) |
|
| 356 | + ) { |
|
| 357 | + $rubriques = array_map('intval', $c['restreintes']); |
|
| 358 | + $rubriques = array_unique($rubriques); |
|
| 359 | + $rubriques = array_diff($rubriques, array(0)); |
|
| 360 | + auteur_dissocier($id_auteur, array('rubrique' => '*')); |
|
| 361 | + auteur_associer($id_auteur, array('rubrique' => $rubriques)); |
|
| 362 | + } |
|
| 363 | + |
|
| 364 | + $flag_ecrire_acces = false; |
|
| 365 | + // commencer par traiter les cas particuliers des logins et pass |
|
| 366 | + // avant les autres ecritures en base |
|
| 367 | + if (isset($champs['login']) or isset($champs['pass'])) { |
|
| 368 | + $auth_methode = sql_getfetsel('source', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 369 | + include_spip('inc/auth'); |
|
| 370 | + if (isset($champs['login']) and strlen($champs['login'])) { |
|
| 371 | + if (!auth_modifier_login($auth_methode, $champs['login'], $id_auteur)) { |
|
| 372 | + $erreurs[] = 'ecrire:impossible_modifier_login_auteur'; |
|
| 373 | + } |
|
| 374 | + } |
|
| 375 | + if (isset($champs['pass']) and strlen($champs['pass'])) { |
|
| 376 | + $champs['login'] = sql_getfetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 377 | + if (!auth_modifier_pass($auth_methode, $champs['login'], $champs['pass'], $id_auteur)) { |
|
| 378 | + $erreurs[] = 'ecrire:impossible_modifier_pass_auteur'; |
|
| 379 | + } |
|
| 380 | + } |
|
| 381 | + unset($champs['login']); |
|
| 382 | + unset($champs['pass']); |
|
| 383 | + $flag_ecrire_acces = true; |
|
| 384 | + } |
|
| 385 | + |
|
| 386 | + if (!count($champs)) { |
|
| 387 | + return implode(' ', array_map('_T', $erreurs)); |
|
| 388 | + } |
|
| 389 | + sql_updateq('spip_auteurs', $champs, 'id_auteur=' . $id_auteur); |
|
| 390 | + |
|
| 391 | + // .. mettre a jour les fichiers .htpasswd et .htpasswd-admin |
|
| 392 | + if ($flag_ecrire_acces |
|
| 393 | + or isset($champs['statut']) |
|
| 394 | + ) { |
|
| 395 | + include_spip('inc/acces'); |
|
| 396 | + ecrire_acces(); |
|
| 397 | + } |
|
| 398 | + |
|
| 399 | + // Invalider les caches |
|
| 400 | + include_spip('inc/invalideur'); |
|
| 401 | + suivre_invalideur("id='auteur/$id_auteur'"); |
|
| 402 | + |
|
| 403 | + // Pipeline |
|
| 404 | + pipeline('post_edition', |
|
| 405 | + array( |
|
| 406 | + 'args' => array( |
|
| 407 | + 'table' => 'spip_auteurs', |
|
| 408 | + 'id_objet' => $id_auteur, |
|
| 409 | + 'action' => 'instituer', |
|
| 410 | + 'statut_ancien' => $statut_ancien, |
|
| 411 | + ), |
|
| 412 | + 'data' => $champs |
|
| 413 | + ) |
|
| 414 | + ); |
|
| 415 | + |
|
| 416 | + |
|
| 417 | + // Notifications |
|
| 418 | + if ($notifications = charger_fonction('notifications', 'inc')) { |
|
| 419 | + $notifications('instituerauteur', $id_auteur, |
|
| 420 | + array('statut' => $statut, 'statut_ancien' => $statut_ancien) |
|
| 421 | + ); |
|
| 422 | + } |
|
| 423 | + |
|
| 424 | + return implode(' ', array_map('_T', $erreurs)); |
|
| 425 | 425 | |
| 426 | 426 | } |
| 427 | 427 | |
@@ -440,7 +440,7 @@ discard block |
||
| 440 | 440 | * @return int |
| 441 | 441 | */ |
| 442 | 442 | function insert_auteur($source = null) { |
| 443 | - return auteur_inserer($source); |
|
| 443 | + return auteur_inserer($source); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | /** |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | * @return string|null |
| 455 | 455 | */ |
| 456 | 456 | function auteurs_set($id_auteur, $set = null) { |
| 457 | - return auteur_modifier($id_auteur, $set); |
|
| 457 | + return auteur_modifier($id_auteur, $set); |
|
| 458 | 458 | } |
| 459 | 459 | |
| 460 | 460 | /** |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | * @return bool|string |
| 470 | 470 | */ |
| 471 | 471 | function instituer_auteur($id_auteur, $c, $force_webmestre = false) { |
| 472 | - return auteur_instituer($id_auteur, $c, $force_webmestre); |
|
| 472 | + return auteur_instituer($id_auteur, $c, $force_webmestre); |
|
| 473 | 473 | } |
| 474 | 474 | |
| 475 | 475 | /** |
@@ -483,5 +483,5 @@ discard block |
||
| 483 | 483 | * @return string|null |
| 484 | 484 | */ |
| 485 | 485 | function revision_auteur($id_auteur, $c = false) { |
| 486 | - return auteur_modifier($id_auteur, $c); |
|
| 486 | + return auteur_modifier($id_auteur, $c); |
|
| 487 | 487 | } |
@@ -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,14 +48,14 @@ 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($p->param[0][$n], |
|
| 53 | - $p->descr, |
|
| 54 | - $p->boucles, |
|
| 55 | - $p->id_boucle); |
|
| 56 | - } else { |
|
| 57 | - return null; |
|
| 58 | - } |
|
| 51 | + if (($p->param) && (!$p->param[0][0]) && (count($p->param[0]) > $n)) { |
|
| 52 | + return calculer_liste($p->param[0][$n], |
|
| 53 | + $p->descr, |
|
| 54 | + $p->boucles, |
|
| 55 | + $p->id_boucle); |
|
| 56 | + } else { |
|
| 57 | + return null; |
|
| 58 | + } |
|
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | |
@@ -75,10 +75,10 @@ discard block |
||
| 75 | 75 | * Pile complétée par le code à générer |
| 76 | 76 | **/ |
| 77 | 77 | function balise_NOM_SITE_SPIP_dist($p) { |
| 78 | - $p->code = "\$GLOBALS['meta']['nom_site']"; |
|
| 78 | + $p->code = "\$GLOBALS['meta']['nom_site']"; |
|
| 79 | 79 | |
| 80 | - #$p->interdire_scripts = true; |
|
| 81 | - return $p; |
|
| 80 | + #$p->interdire_scripts = true; |
|
| 81 | + return $p; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -94,10 +94,10 @@ discard block |
||
| 94 | 94 | * Pile complétée par le code à générer |
| 95 | 95 | **/ |
| 96 | 96 | function balise_EMAIL_WEBMASTER_dist($p) { |
| 97 | - $p->code = "\$GLOBALS['meta']['email_webmaster']"; |
|
| 97 | + $p->code = "\$GLOBALS['meta']['email_webmaster']"; |
|
| 98 | 98 | |
| 99 | - #$p->interdire_scripts = true; |
|
| 100 | - return $p; |
|
| 99 | + #$p->interdire_scripts = true; |
|
| 100 | + return $p; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | /** |
@@ -113,10 +113,10 @@ discard block |
||
| 113 | 113 | * Pile complétée par le code à générer |
| 114 | 114 | **/ |
| 115 | 115 | function balise_DESCRIPTIF_SITE_SPIP_dist($p) { |
| 116 | - $p->code = "\$GLOBALS['meta']['descriptif_site']"; |
|
| 116 | + $p->code = "\$GLOBALS['meta']['descriptif_site']"; |
|
| 117 | 117 | |
| 118 | - #$p->interdire_scripts = true; |
|
| 119 | - return $p; |
|
| 118 | + #$p->interdire_scripts = true; |
|
| 119 | + return $p; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
@@ -137,10 +137,10 @@ discard block |
||
| 137 | 137 | * Pile complétée par le code à générer |
| 138 | 138 | **/ |
| 139 | 139 | function balise_CHARSET_dist($p) { |
| 140 | - $p->code = "\$GLOBALS['meta']['charset']"; |
|
| 140 | + $p->code = "\$GLOBALS['meta']['charset']"; |
|
| 141 | 141 | |
| 142 | - #$p->interdire_scripts = true; |
|
| 143 | - return $p; |
|
| 142 | + #$p->interdire_scripts = true; |
|
| 143 | + return $p; |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -165,11 +165,11 @@ discard block |
||
| 165 | 165 | * Pile complétée par le code à générer |
| 166 | 166 | **/ |
| 167 | 167 | function balise_LANG_LEFT_dist($p) { |
| 168 | - $_lang = champ_sql('lang', $p); |
|
| 169 | - $p->code = "lang_dir($_lang, 'left','right')"; |
|
| 170 | - $p->interdire_scripts = false; |
|
| 168 | + $_lang = champ_sql('lang', $p); |
|
| 169 | + $p->code = "lang_dir($_lang, 'left','right')"; |
|
| 170 | + $p->interdire_scripts = false; |
|
| 171 | 171 | |
| 172 | - return $p; |
|
| 172 | + return $p; |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | /** |
@@ -189,11 +189,11 @@ discard block |
||
| 189 | 189 | * Pile complétée par le code à générer |
| 190 | 190 | **/ |
| 191 | 191 | function balise_LANG_RIGHT_dist($p) { |
| 192 | - $_lang = champ_sql('lang', $p); |
|
| 193 | - $p->code = "lang_dir($_lang, 'right','left')"; |
|
| 194 | - $p->interdire_scripts = false; |
|
| 192 | + $_lang = champ_sql('lang', $p); |
|
| 193 | + $p->code = "lang_dir($_lang, 'right','left')"; |
|
| 194 | + $p->interdire_scripts = false; |
|
| 195 | 195 | |
| 196 | - return $p; |
|
| 196 | + return $p; |
|
| 197 | 197 | } |
| 198 | 198 | |
| 199 | 199 | /** |
@@ -218,11 +218,11 @@ discard block |
||
| 218 | 218 | * Pile complétée par le code à générer |
| 219 | 219 | **/ |
| 220 | 220 | function balise_LANG_DIR_dist($p) { |
| 221 | - $_lang = champ_sql('lang', $p); |
|
| 222 | - $p->code = "lang_dir($_lang, 'ltr','rtl')"; |
|
| 223 | - $p->interdire_scripts = false; |
|
| 221 | + $_lang = champ_sql('lang', $p); |
|
| 222 | + $p->code = "lang_dir($_lang, 'ltr','rtl')"; |
|
| 223 | + $p->interdire_scripts = false; |
|
| 224 | 224 | |
| 225 | - return $p; |
|
| 225 | + return $p; |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | |
@@ -239,10 +239,10 @@ discard block |
||
| 239 | 239 | * Pile complétée par le code à générer |
| 240 | 240 | **/ |
| 241 | 241 | function balise_PUCE_dist($p) { |
| 242 | - $p->code = "definir_puce()"; |
|
| 243 | - $p->interdire_scripts = false; |
|
| 242 | + $p->code = "definir_puce()"; |
|
| 243 | + $p->interdire_scripts = false; |
|
| 244 | 244 | |
| 245 | - return $p; |
|
| 245 | + return $p; |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | |
@@ -266,12 +266,12 @@ discard block |
||
| 266 | 266 | * Pile completée du code PHP d'exécution de la balise |
| 267 | 267 | */ |
| 268 | 268 | function balise_DATE_dist($p) { |
| 269 | - $d = champ_sql('date', $p); |
|
| 269 | + $d = champ_sql('date', $p); |
|
| 270 | 270 | # if ($d === "@\$Pile[0]['date']") |
| 271 | 271 | # $d = "isset(\$Pile[0]['date']) ? $d : time()"; |
| 272 | - $p->code = $d; |
|
| 272 | + $p->code = $d; |
|
| 273 | 273 | |
| 274 | - return $p; |
|
| 274 | + return $p; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | |
@@ -291,13 +291,13 @@ discard block |
||
| 291 | 291 | * Pile completée du code PHP d'exécution de la balise |
| 292 | 292 | */ |
| 293 | 293 | function balise_DATE_REDAC_dist($p) { |
| 294 | - $d = champ_sql('date_redac', $p); |
|
| 294 | + $d = champ_sql('date_redac', $p); |
|
| 295 | 295 | # if ($d === "@\$Pile[0]['date_redac']") |
| 296 | 296 | # $d = "isset(\$Pile[0]['date_redac']) ? $d : time()"; |
| 297 | - $p->code = $d; |
|
| 298 | - $p->interdire_scripts = false; |
|
| 297 | + $p->code = $d; |
|
| 298 | + $p->interdire_scripts = false; |
|
| 299 | 299 | |
| 300 | - return $p; |
|
| 300 | + return $p; |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | /** |
@@ -316,10 +316,10 @@ discard block |
||
| 316 | 316 | * Pile completée du code PHP d'exécution de la balise |
| 317 | 317 | */ |
| 318 | 318 | function balise_DATE_MODIF_dist($p) { |
| 319 | - $p->code = champ_sql('date_modif', $p); |
|
| 320 | - $p->interdire_scripts = false; |
|
| 319 | + $p->code = champ_sql('date_modif', $p); |
|
| 320 | + $p->interdire_scripts = false; |
|
| 321 | 321 | |
| 322 | - return $p; |
|
| 322 | + return $p; |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | /** |
@@ -337,13 +337,13 @@ discard block |
||
| 337 | 337 | * Pile completée du code PHP d'exécution de la balise |
| 338 | 338 | */ |
| 339 | 339 | function balise_DATE_NOUVEAUTES_dist($p) { |
| 340 | - $p->code = "((\$GLOBALS['meta']['quoi_de_neuf'] == 'oui' |
|
| 340 | + $p->code = "((\$GLOBALS['meta']['quoi_de_neuf'] == 'oui' |
|
| 341 | 341 | AND isset(\$GLOBALS['meta']['dernier_envoi_neuf'])) ? |
| 342 | 342 | \$GLOBALS['meta']['dernier_envoi_neuf'] : |
| 343 | 343 | \"'0000-00-00'\")"; |
| 344 | - $p->interdire_scripts = false; |
|
| 344 | + $p->interdire_scripts = false; |
|
| 345 | 345 | |
| 346 | - return $p; |
|
| 346 | + return $p; |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | |
@@ -362,11 +362,11 @@ discard block |
||
| 362 | 362 | * Pile completée du code PHP d'exécution de la balise |
| 363 | 363 | */ |
| 364 | 364 | function balise_DOSSIER_SQUELETTE_dist($p) { |
| 365 | - $code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE)); |
|
| 366 | - $p->code = "_DIR_RACINE . '$code'" . |
|
| 367 | - $p->interdire_scripts = false; |
|
| 365 | + $code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE)); |
|
| 366 | + $p->code = "_DIR_RACINE . '$code'" . |
|
| 367 | + $p->interdire_scripts = false; |
|
| 368 | 368 | |
| 369 | - return $p; |
|
| 369 | + return $p; |
|
| 370 | 370 | } |
| 371 | 371 | |
| 372 | 372 | /** |
@@ -381,11 +381,11 @@ discard block |
||
| 381 | 381 | * Pile completée du code PHP d'exécution de la balise |
| 382 | 382 | */ |
| 383 | 383 | function balise_SQUELETTE_dist($p) { |
| 384 | - $code = addslashes($p->descr['sourcefile']); |
|
| 385 | - $p->code = "'$code'" . |
|
| 386 | - $p->interdire_scripts = false; |
|
| 384 | + $code = addslashes($p->descr['sourcefile']); |
|
| 385 | + $p->code = "'$code'" . |
|
| 386 | + $p->interdire_scripts = false; |
|
| 387 | 387 | |
| 388 | - return $p; |
|
| 388 | + return $p; |
|
| 389 | 389 | } |
| 390 | 390 | |
| 391 | 391 | /** |
@@ -404,10 +404,10 @@ discard block |
||
| 404 | 404 | * Pile completée du code PHP d'exécution de la balise |
| 405 | 405 | */ |
| 406 | 406 | function balise_SPIP_VERSION_dist($p) { |
| 407 | - $p->code = "spip_version()"; |
|
| 408 | - $p->interdire_scripts = false; |
|
| 407 | + $p->code = "spip_version()"; |
|
| 408 | + $p->interdire_scripts = false; |
|
| 409 | 409 | |
| 410 | - return $p; |
|
| 410 | + return $p; |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | |
@@ -433,18 +433,18 @@ discard block |
||
| 433 | 433 | * Pile complétée par le code à générer |
| 434 | 434 | **/ |
| 435 | 435 | function balise_NOM_SITE_dist($p) { |
| 436 | - if (!$p->etoile) { |
|
| 437 | - $p->code = "supprimer_numero(calculer_url(" . |
|
| 438 | - champ_sql('url_site', $p) . "," . |
|
| 439 | - champ_sql('nom_site', $p) . |
|
| 440 | - ", 'titre', \$connect, false))"; |
|
| 441 | - } else { |
|
| 442 | - $p->code = champ_sql('nom_site', $p); |
|
| 443 | - } |
|
| 436 | + if (!$p->etoile) { |
|
| 437 | + $p->code = "supprimer_numero(calculer_url(" . |
|
| 438 | + champ_sql('url_site', $p) . "," . |
|
| 439 | + champ_sql('nom_site', $p) . |
|
| 440 | + ", 'titre', \$connect, false))"; |
|
| 441 | + } else { |
|
| 442 | + $p->code = champ_sql('nom_site', $p); |
|
| 443 | + } |
|
| 444 | 444 | |
| 445 | - $p->interdire_scripts = true; |
|
| 445 | + $p->interdire_scripts = true; |
|
| 446 | 446 | |
| 447 | - return $p; |
|
| 447 | + return $p; |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | |
@@ -461,11 +461,11 @@ discard block |
||
| 461 | 461 | * Pile complétée par le code à générer |
| 462 | 462 | **/ |
| 463 | 463 | function balise_NOTES_dist($p) { |
| 464 | - // Recuperer les notes |
|
| 465 | - $p->code = 'calculer_notes()'; |
|
| 464 | + // Recuperer les notes |
|
| 465 | + $p->code = 'calculer_notes()'; |
|
| 466 | 466 | |
| 467 | - #$p->interdire_scripts = true; |
|
| 468 | - return $p; |
|
| 467 | + #$p->interdire_scripts = true; |
|
| 468 | + return $p; |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | |
@@ -487,10 +487,10 @@ discard block |
||
| 487 | 487 | * Pile complétée par le code à générer |
| 488 | 488 | **/ |
| 489 | 489 | function balise_RECHERCHE_dist($p) { |
| 490 | - $p->code = 'entites_html(_request("recherche"))'; |
|
| 491 | - $p->interdire_scripts = false; |
|
| 490 | + $p->code = 'entites_html(_request("recherche"))'; |
|
| 491 | + $p->interdire_scripts = false; |
|
| 492 | 492 | |
| 493 | - return $p; |
|
| 493 | + return $p; |
|
| 494 | 494 | } |
| 495 | 495 | |
| 496 | 496 | |
@@ -508,17 +508,17 @@ discard block |
||
| 508 | 508 | * Pile complétée par le code à générer |
| 509 | 509 | **/ |
| 510 | 510 | function balise_COMPTEUR_BOUCLE_dist($p) { |
| 511 | - $b = index_boucle_mere($p); |
|
| 512 | - if ($b === '') { |
|
| 513 | - $msg = array('zbug_champ_hors_boucle', array('champ' => zbug_presenter_champ($p))); |
|
| 514 | - erreur_squelette($msg, $p); |
|
| 515 | - } else { |
|
| 516 | - $p->code = "\$Numrows['$b']['compteur_boucle']"; |
|
| 517 | - $p->boucles[$b]->cptrows = true; |
|
| 518 | - $p->interdire_scripts = false; |
|
| 511 | + $b = index_boucle_mere($p); |
|
| 512 | + if ($b === '') { |
|
| 513 | + $msg = array('zbug_champ_hors_boucle', array('champ' => zbug_presenter_champ($p))); |
|
| 514 | + erreur_squelette($msg, $p); |
|
| 515 | + } else { |
|
| 516 | + $p->code = "\$Numrows['$b']['compteur_boucle']"; |
|
| 517 | + $p->boucles[$b]->cptrows = true; |
|
| 518 | + $p->interdire_scripts = false; |
|
| 519 | 519 | |
| 520 | - return $p; |
|
| 521 | - } |
|
| 520 | + return $p; |
|
| 521 | + } |
|
| 522 | 522 | } |
| 523 | 523 | |
| 524 | 524 | /** |
@@ -536,17 +536,17 @@ discard block |
||
| 536 | 536 | * Pile complétée par le code à générer |
| 537 | 537 | **/ |
| 538 | 538 | function balise_TOTAL_BOUCLE_dist($p) { |
| 539 | - $b = index_boucle_mere($p); |
|
| 540 | - if ($b === '') { |
|
| 541 | - $msg = array('zbug_champ_hors_boucle', array('champ' => zbug_presenter_champ($p))); |
|
| 542 | - erreur_squelette($msg, $p); |
|
| 543 | - } else { |
|
| 544 | - $p->code = "\$Numrows['$b']['total']"; |
|
| 545 | - $p->boucles[$b]->numrows = true; |
|
| 546 | - $p->interdire_scripts = false; |
|
| 547 | - } |
|
| 539 | + $b = index_boucle_mere($p); |
|
| 540 | + if ($b === '') { |
|
| 541 | + $msg = array('zbug_champ_hors_boucle', array('champ' => zbug_presenter_champ($p))); |
|
| 542 | + erreur_squelette($msg, $p); |
|
| 543 | + } else { |
|
| 544 | + $p->code = "\$Numrows['$b']['total']"; |
|
| 545 | + $p->boucles[$b]->numrows = true; |
|
| 546 | + $p->interdire_scripts = false; |
|
| 547 | + } |
|
| 548 | 548 | |
| 549 | - return $p; |
|
| 549 | + return $p; |
|
| 550 | 550 | } |
| 551 | 551 | |
| 552 | 552 | |
@@ -566,7 +566,7 @@ discard block |
||
| 566 | 566 | * Pile complétée par le code à générer |
| 567 | 567 | **/ |
| 568 | 568 | function balise_POINTS_dist($p) { |
| 569 | - return rindex_pile($p, 'points', 'recherche'); |
|
| 569 | + return rindex_pile($p, 'points', 'recherche'); |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | |
@@ -587,12 +587,12 @@ discard block |
||
| 587 | 587 | * Pile complétée par le code à générer |
| 588 | 588 | **/ |
| 589 | 589 | function balise_POPULARITE_ABSOLUE_dist($p) { |
| 590 | - $p->code = 'ceil(' . |
|
| 591 | - champ_sql('popularite', $p) . |
|
| 592 | - ')'; |
|
| 593 | - $p->interdire_scripts = false; |
|
| 590 | + $p->code = 'ceil(' . |
|
| 591 | + champ_sql('popularite', $p) . |
|
| 592 | + ')'; |
|
| 593 | + $p->interdire_scripts = false; |
|
| 594 | 594 | |
| 595 | - return $p; |
|
| 595 | + return $p; |
|
| 596 | 596 | } |
| 597 | 597 | |
| 598 | 598 | /** |
@@ -612,10 +612,10 @@ discard block |
||
| 612 | 612 | * Pile complétée par le code à générer |
| 613 | 613 | **/ |
| 614 | 614 | function balise_POPULARITE_SITE_dist($p) { |
| 615 | - $p->code = 'ceil($GLOBALS["meta"][\'popularite_total\'])'; |
|
| 616 | - $p->interdire_scripts = false; |
|
| 615 | + $p->code = 'ceil($GLOBALS["meta"][\'popularite_total\'])'; |
|
| 616 | + $p->interdire_scripts = false; |
|
| 617 | 617 | |
| 618 | - return $p; |
|
| 618 | + return $p; |
|
| 619 | 619 | } |
| 620 | 620 | |
| 621 | 621 | /** |
@@ -636,10 +636,10 @@ discard block |
||
| 636 | 636 | * Pile complétée par le code à générer |
| 637 | 637 | **/ |
| 638 | 638 | function balise_POPULARITE_MAX_dist($p) { |
| 639 | - $p->code = 'ceil($GLOBALS["meta"][\'popularite_max\'])'; |
|
| 640 | - $p->interdire_scripts = false; |
|
| 639 | + $p->code = 'ceil($GLOBALS["meta"][\'popularite_max\'])'; |
|
| 640 | + $p->interdire_scripts = false; |
|
| 641 | 641 | |
| 642 | - return $p; |
|
| 642 | + return $p; |
|
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | |
@@ -665,14 +665,14 @@ discard block |
||
| 665 | 665 | * Pile complétée par le code à générer |
| 666 | 666 | **/ |
| 667 | 667 | function balise_VALEUR_dist($p) { |
| 668 | - $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
|
| 669 | - $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b);; |
|
| 670 | - if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 671 | - $p->code = 'table_valeur(' . $p->code . ', ' . $v . ')'; |
|
| 672 | - } |
|
| 673 | - $p->interdire_scripts = true; |
|
| 668 | + $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
|
| 669 | + $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b);; |
|
| 670 | + if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 671 | + $p->code = 'table_valeur(' . $p->code . ', ' . $v . ')'; |
|
| 672 | + } |
|
| 673 | + $p->interdire_scripts = true; |
|
| 674 | 674 | |
| 675 | - return $p; |
|
| 675 | + return $p; |
|
| 676 | 676 | } |
| 677 | 677 | |
| 678 | 678 | /** |
@@ -701,17 +701,17 @@ discard block |
||
| 701 | 701 | * Pile complétée par le code à générer |
| 702 | 702 | **/ |
| 703 | 703 | function balise_EXPOSE_dist($p) { |
| 704 | - $on = "'on'"; |
|
| 705 | - $off = "''"; |
|
| 706 | - if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 707 | - $on = $v; |
|
| 708 | - if (($v = interprete_argument_balise(2, $p)) !== null) { |
|
| 709 | - $off = $v; |
|
| 710 | - } |
|
| 704 | + $on = "'on'"; |
|
| 705 | + $off = "''"; |
|
| 706 | + if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 707 | + $on = $v; |
|
| 708 | + if (($v = interprete_argument_balise(2, $p)) !== null) { |
|
| 709 | + $off = $v; |
|
| 710 | + } |
|
| 711 | 711 | |
| 712 | - } |
|
| 712 | + } |
|
| 713 | 713 | |
| 714 | - return calculer_balise_expose($p, $on, $off); |
|
| 714 | + return calculer_balise_expose($p, $on, $off); |
|
| 715 | 715 | } |
| 716 | 716 | |
| 717 | 717 | /** |
@@ -729,36 +729,36 @@ discard block |
||
| 729 | 729 | * Pile complétée par le code à générer |
| 730 | 730 | **/ |
| 731 | 731 | function calculer_balise_expose($p, $on, $off) { |
| 732 | - $b = index_boucle($p); |
|
| 733 | - if (empty($p->boucles[$b]->primary)) { |
|
| 734 | - $msg = array('zbug_champ_hors_boucle', array('champ' => zbug_presenter_champ($p))); |
|
| 735 | - erreur_squelette($msg, $p); |
|
| 736 | - } else { |
|
| 732 | + $b = index_boucle($p); |
|
| 733 | + if (empty($p->boucles[$b]->primary)) { |
|
| 734 | + $msg = array('zbug_champ_hors_boucle', array('champ' => zbug_presenter_champ($p))); |
|
| 735 | + erreur_squelette($msg, $p); |
|
| 736 | + } else { |
|
| 737 | 737 | |
| 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); |
|
| 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 | |
@@ -796,47 +796,47 @@ discard block |
||
| 796 | 796 | **/ |
| 797 | 797 | function balise_INTRODUCTION_dist($p) { |
| 798 | 798 | |
| 799 | - $type = $p->type_requete; |
|
| 800 | - |
|
| 801 | - $_texte = champ_sql('texte', $p); |
|
| 802 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 803 | - $desc = $trouver_table(table_objet_sql($type)); |
|
| 804 | - $_descriptif = "''"; |
|
| 805 | - if ($desc and isset($desc['field']['descriptif'])) { |
|
| 806 | - // notamment articles et rubriques mais aussi tout nouvel objet concerne |
|
| 807 | - $_descriptif = champ_sql('descriptif', $p); |
|
| 808 | - } |
|
| 809 | - |
|
| 810 | - // notamment les articles mais aussi tout nouvel objet concerne |
|
| 811 | - if ($desc and isset($desc['field']['chapo'])) { |
|
| 812 | - $_chapo = champ_sql('chapo', $p); |
|
| 813 | - $_texte = "(strlen($_descriptif)) |
|
| 799 | + $type = $p->type_requete; |
|
| 800 | + |
|
| 801 | + $_texte = champ_sql('texte', $p); |
|
| 802 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 803 | + $desc = $trouver_table(table_objet_sql($type)); |
|
| 804 | + $_descriptif = "''"; |
|
| 805 | + if ($desc and isset($desc['field']['descriptif'])) { |
|
| 806 | + // notamment articles et rubriques mais aussi tout nouvel objet concerne |
|
| 807 | + $_descriptif = champ_sql('descriptif', $p); |
|
| 808 | + } |
|
| 809 | + |
|
| 810 | + // notamment les articles mais aussi tout nouvel objet concerne |
|
| 811 | + if ($desc and isset($desc['field']['chapo'])) { |
|
| 812 | + $_chapo = champ_sql('chapo', $p); |
|
| 813 | + $_texte = "(strlen($_descriptif)) |
|
| 814 | 814 | ? '' |
| 815 | 815 | : $_chapo . \"\\n\\n\" . $_texte"; |
| 816 | - } |
|
| 816 | + } |
|
| 817 | 817 | |
| 818 | - // longueur en parametre, ou valeur par defaut |
|
| 819 | - $longueur_defaut = objet_info($type, 'introduction_longueur'); |
|
| 820 | - if (!$longueur_defaut) { |
|
| 821 | - $longueur_defaut = 600; |
|
| 822 | - } |
|
| 818 | + // longueur en parametre, ou valeur par defaut |
|
| 819 | + $longueur_defaut = objet_info($type, 'introduction_longueur'); |
|
| 820 | + if (!$longueur_defaut) { |
|
| 821 | + $longueur_defaut = 600; |
|
| 822 | + } |
|
| 823 | 823 | |
| 824 | - $_suite = 'null'; |
|
| 825 | - $_longueur = $longueur_defaut; |
|
| 826 | - if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 827 | - $_longueur = 'is_numeric(' . $v . ')?intval(' . $v . '):' . $longueur_defaut; |
|
| 828 | - $_suite = '!is_numeric(' . $v . ')?' . $v . ':null'; |
|
| 829 | - } |
|
| 830 | - if (($v2 = interprete_argument_balise(2, $p)) !== null) { |
|
| 831 | - $_suite = $v2; |
|
| 832 | - } |
|
| 824 | + $_suite = 'null'; |
|
| 825 | + $_longueur = $longueur_defaut; |
|
| 826 | + if (($v = interprete_argument_balise(1, $p)) !== null) { |
|
| 827 | + $_longueur = 'is_numeric(' . $v . ')?intval(' . $v . '):' . $longueur_defaut; |
|
| 828 | + $_suite = '!is_numeric(' . $v . ')?' . $v . ':null'; |
|
| 829 | + } |
|
| 830 | + if (($v2 = interprete_argument_balise(2, $p)) !== null) { |
|
| 831 | + $_suite = $v2; |
|
| 832 | + } |
|
| 833 | 833 | |
| 834 | - $f = chercher_filtre('introduction'); |
|
| 835 | - $p->code = "$f($_descriptif, $_texte, $_longueur, \$connect, $_suite)"; |
|
| 834 | + $f = chercher_filtre('introduction'); |
|
| 835 | + $p->code = "$f($_descriptif, $_texte, $_longueur, \$connect, $_suite)"; |
|
| 836 | 836 | |
| 837 | - #$p->interdire_scripts = true; |
|
| 838 | - $p->etoile = '*'; // propre est deja fait dans le calcul de l'intro |
|
| 839 | - return $p; |
|
| 837 | + #$p->interdire_scripts = true; |
|
| 838 | + $p->etoile = '*'; // propre est deja fait dans le calcul de l'intro |
|
| 839 | + return $p; |
|
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | |
@@ -856,15 +856,15 @@ discard block |
||
| 856 | 856 | * Pile complétée par le code à générer |
| 857 | 857 | **/ |
| 858 | 858 | function balise_LANG_dist($p) { |
| 859 | - $_lang = champ_sql('lang', $p); |
|
| 860 | - if (!$p->etoile) { |
|
| 861 | - $p->code = "spip_htmlentities($_lang ? $_lang : \$GLOBALS['spip_lang'])"; |
|
| 862 | - } else { |
|
| 863 | - $p->code = "spip_htmlentities($_lang)"; |
|
| 864 | - } |
|
| 865 | - $p->interdire_scripts = false; |
|
| 859 | + $_lang = champ_sql('lang', $p); |
|
| 860 | + if (!$p->etoile) { |
|
| 861 | + $p->code = "spip_htmlentities($_lang ? $_lang : \$GLOBALS['spip_lang'])"; |
|
| 862 | + } else { |
|
| 863 | + $p->code = "spip_htmlentities($_lang)"; |
|
| 864 | + } |
|
| 865 | + $p->interdire_scripts = false; |
|
| 866 | 866 | |
| 867 | - return $p; |
|
| 867 | + return $p; |
|
| 868 | 868 | } |
| 869 | 869 | |
| 870 | 870 | /** |
@@ -886,44 +886,44 @@ discard block |
||
| 886 | 886 | * Pile complétée par le code à générer |
| 887 | 887 | */ |
| 888 | 888 | function balise_LESAUTEURS_dist($p) { |
| 889 | - // Cherche le champ 'lesauteurs' dans la pile |
|
| 890 | - $_lesauteurs = champ_sql('lesauteurs', $p, false); |
|
| 891 | - |
|
| 892 | - // Si le champ n'existe pas (cas de spip_articles), on applique |
|
| 893 | - // le modele lesauteurs.html en passant id_article dans le contexte; |
|
| 894 | - // dans le cas contraire on prend le champ 'lesauteurs' |
|
| 895 | - // (cf extension sites/) |
|
| 896 | - if ($_lesauteurs |
|
| 897 | - and $_lesauteurs != '@$Pile[0][\'lesauteurs\']' |
|
| 898 | - ) { |
|
| 899 | - $p->code = "safehtml($_lesauteurs)"; |
|
| 900 | - // $p->interdire_scripts = true; |
|
| 901 | - } else { |
|
| 902 | - if (!$p->id_boucle) { |
|
| 903 | - $connect = ''; |
|
| 904 | - $objet = 'article'; |
|
| 905 | - $id_table_objet = 'id_article'; |
|
| 906 | - } else { |
|
| 907 | - $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
|
| 908 | - $connect = $p->boucles[$b]->sql_serveur; |
|
| 909 | - $type_boucle = $p->boucles[$b]->type_requete; |
|
| 910 | - $objet = objet_type($type_boucle); |
|
| 911 | - $id_table_objet = id_table_objet($type_boucle); |
|
| 912 | - } |
|
| 913 | - $c = memoriser_contexte_compil($p); |
|
| 914 | - |
|
| 915 | - $p->code = sprintf(CODE_RECUPERER_FOND, "'modeles/lesauteurs'", |
|
| 916 | - "array('objet'=>'" . $objet . |
|
| 917 | - "','id_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 918 | - ",'$id_table_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 919 | - ($objet == 'article' ? "" : ",'id_article' => " . champ_sql('id_article', $p)) . |
|
| 920 | - ")", |
|
| 921 | - "'trim'=>true, 'compil'=>array($c)", |
|
| 922 | - _q($connect)); |
|
| 923 | - $p->interdire_scripts = false; // securite apposee par recuperer_fond() |
|
| 924 | - } |
|
| 925 | - |
|
| 926 | - return $p; |
|
| 889 | + // Cherche le champ 'lesauteurs' dans la pile |
|
| 890 | + $_lesauteurs = champ_sql('lesauteurs', $p, false); |
|
| 891 | + |
|
| 892 | + // Si le champ n'existe pas (cas de spip_articles), on applique |
|
| 893 | + // le modele lesauteurs.html en passant id_article dans le contexte; |
|
| 894 | + // dans le cas contraire on prend le champ 'lesauteurs' |
|
| 895 | + // (cf extension sites/) |
|
| 896 | + if ($_lesauteurs |
|
| 897 | + and $_lesauteurs != '@$Pile[0][\'lesauteurs\']' |
|
| 898 | + ) { |
|
| 899 | + $p->code = "safehtml($_lesauteurs)"; |
|
| 900 | + // $p->interdire_scripts = true; |
|
| 901 | + } else { |
|
| 902 | + if (!$p->id_boucle) { |
|
| 903 | + $connect = ''; |
|
| 904 | + $objet = 'article'; |
|
| 905 | + $id_table_objet = 'id_article'; |
|
| 906 | + } else { |
|
| 907 | + $b = $p->nom_boucle ? $p->nom_boucle : $p->id_boucle; |
|
| 908 | + $connect = $p->boucles[$b]->sql_serveur; |
|
| 909 | + $type_boucle = $p->boucles[$b]->type_requete; |
|
| 910 | + $objet = objet_type($type_boucle); |
|
| 911 | + $id_table_objet = id_table_objet($type_boucle); |
|
| 912 | + } |
|
| 913 | + $c = memoriser_contexte_compil($p); |
|
| 914 | + |
|
| 915 | + $p->code = sprintf(CODE_RECUPERER_FOND, "'modeles/lesauteurs'", |
|
| 916 | + "array('objet'=>'" . $objet . |
|
| 917 | + "','id_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 918 | + ",'$id_table_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 919 | + ($objet == 'article' ? "" : ",'id_article' => " . champ_sql('id_article', $p)) . |
|
| 920 | + ")", |
|
| 921 | + "'trim'=>true, 'compil'=>array($c)", |
|
| 922 | + _q($connect)); |
|
| 923 | + $p->interdire_scripts = false; // securite apposee par recuperer_fond() |
|
| 924 | + } |
|
| 925 | + |
|
| 926 | + return $p; |
|
| 927 | 927 | } |
| 928 | 928 | |
| 929 | 929 | |
@@ -950,75 +950,75 @@ discard block |
||
| 950 | 950 | * Pile complétée par le code à générer |
| 951 | 951 | */ |
| 952 | 952 | function balise_RANG_dist($p) { |
| 953 | - $b = index_boucle($p); |
|
| 954 | - if ($b === '') { |
|
| 955 | - $msg = array( |
|
| 956 | - 'zbug_champ_hors_boucle', |
|
| 957 | - array('champ' => '#RANG') |
|
| 958 | - ); |
|
| 959 | - erreur_squelette($msg, $p); |
|
| 960 | - } else { |
|
| 961 | - // chercher d'abord un champ sql rang (mais pas dans le env : defaut '' si on trouve pas de champ sql) |
|
| 962 | - // dans la boucle immediatement englobante uniquement |
|
| 963 | - // sinon on compose le champ calcule |
|
| 964 | - $_rang = champ_sql('rang', $p, '', false); |
|
| 965 | - |
|
| 966 | - // si pas trouve de champ sql rang : |
|
| 967 | - if (!$_rang or $_rang == "''") { |
|
| 968 | - $boucle = &$p->boucles[$b]; |
|
| 969 | - |
|
| 970 | - // on gere le cas ou #RANG est une extraction du numero dans le titre |
|
| 971 | - $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 972 | - $desc = $trouver_table($boucle->id_table); |
|
| 973 | - $_titre = ''; # où extraire le numero ? |
|
| 953 | + $b = index_boucle($p); |
|
| 954 | + if ($b === '') { |
|
| 955 | + $msg = array( |
|
| 956 | + 'zbug_champ_hors_boucle', |
|
| 957 | + array('champ' => '#RANG') |
|
| 958 | + ); |
|
| 959 | + erreur_squelette($msg, $p); |
|
| 960 | + } else { |
|
| 961 | + // chercher d'abord un champ sql rang (mais pas dans le env : defaut '' si on trouve pas de champ sql) |
|
| 962 | + // dans la boucle immediatement englobante uniquement |
|
| 963 | + // sinon on compose le champ calcule |
|
| 964 | + $_rang = champ_sql('rang', $p, '', false); |
|
| 965 | + |
|
| 966 | + // si pas trouve de champ sql rang : |
|
| 967 | + if (!$_rang or $_rang == "''") { |
|
| 968 | + $boucle = &$p->boucles[$b]; |
|
| 969 | + |
|
| 970 | + // on gere le cas ou #RANG est une extraction du numero dans le titre |
|
| 971 | + $trouver_table = charger_fonction('trouver_table', 'base'); |
|
| 972 | + $desc = $trouver_table($boucle->id_table); |
|
| 973 | + $_titre = ''; # où extraire le numero ? |
|
| 974 | 974 | |
| 975 | - if (isset($desc['titre'])) { |
|
| 976 | - $t = $desc['titre']; |
|
| 977 | - if ( |
|
| 978 | - // Soit on trouve avec la déclaration de la lang AVANT |
|
| 979 | - preg_match(';(?:lang\s*,)\s*(.*?titre)\s*(,|$);', $t, $m) |
|
| 980 | - // Soit on prend depuis le début |
|
| 981 | - or preg_match(';^(.*?titre)\s*(,|$);', $t, $m) |
|
| 982 | - ) { |
|
| 983 | - $m = preg_replace(',as\s+titre$,i', '', $m[1]); |
|
| 984 | - $m = trim($m); |
|
| 985 | - if ($m != "''") { |
|
| 986 | - if (!preg_match(",\W,", $m)) { |
|
| 987 | - $m = $boucle->id_table . ".$m"; |
|
| 988 | - } |
|
| 975 | + if (isset($desc['titre'])) { |
|
| 976 | + $t = $desc['titre']; |
|
| 977 | + if ( |
|
| 978 | + // Soit on trouve avec la déclaration de la lang AVANT |
|
| 979 | + preg_match(';(?:lang\s*,)\s*(.*?titre)\s*(,|$);', $t, $m) |
|
| 980 | + // Soit on prend depuis le début |
|
| 981 | + or preg_match(';^(.*?titre)\s*(,|$);', $t, $m) |
|
| 982 | + ) { |
|
| 983 | + $m = preg_replace(',as\s+titre$,i', '', $m[1]); |
|
| 984 | + $m = trim($m); |
|
| 985 | + if ($m != "''") { |
|
| 986 | + if (!preg_match(",\W,", $m)) { |
|
| 987 | + $m = $boucle->id_table . ".$m"; |
|
| 988 | + } |
|
| 989 | 989 | |
| 990 | - $m .= " AS titre_rang"; |
|
| 991 | - |
|
| 992 | - $boucle->select[] = $m; |
|
| 993 | - $_titre = '$Pile[$SP][\'titre_rang\']'; |
|
| 994 | - } |
|
| 995 | - } |
|
| 996 | - } |
|
| 997 | - |
|
| 998 | - // si on n'a rien trouvé, on utilise le champ titre classique |
|
| 999 | - if (!$_titre) { |
|
| 1000 | - $_titre = champ_sql('titre', $p); |
|
| 1001 | - } |
|
| 1002 | - |
|
| 1003 | - // et on recupere aussi les infos de liaison si on est en train d'editer les liens justement |
|
| 1004 | - // cas des formulaires xxx_lies utilises par #FORMULAIRE_EDITER_LIENS |
|
| 1005 | - $type_boucle = $boucle->type_requete; |
|
| 1006 | - $objet = objet_type($type_boucle); |
|
| 1007 | - $id_table_objet = id_table_objet($type_boucle); |
|
| 1008 | - $_primary = champ_sql($id_table_objet, $p, '', false); |
|
| 1009 | - $_env = '$Pile[0]'; |
|
| 1010 | - |
|
| 1011 | - if (!$_titre) {$_titre = "''";} |
|
| 1012 | - if (!$_primary) {$_primary = "''";} |
|
| 1013 | - $_rang = "calculer_rang_smart($_titre, '$objet', $_primary, $_env)"; |
|
| 1014 | - |
|
| 1015 | - } |
|
| 990 | + $m .= " AS titre_rang"; |
|
| 991 | + |
|
| 992 | + $boucle->select[] = $m; |
|
| 993 | + $_titre = '$Pile[$SP][\'titre_rang\']'; |
|
| 994 | + } |
|
| 995 | + } |
|
| 996 | + } |
|
| 997 | + |
|
| 998 | + // si on n'a rien trouvé, on utilise le champ titre classique |
|
| 999 | + if (!$_titre) { |
|
| 1000 | + $_titre = champ_sql('titre', $p); |
|
| 1001 | + } |
|
| 1002 | + |
|
| 1003 | + // et on recupere aussi les infos de liaison si on est en train d'editer les liens justement |
|
| 1004 | + // cas des formulaires xxx_lies utilises par #FORMULAIRE_EDITER_LIENS |
|
| 1005 | + $type_boucle = $boucle->type_requete; |
|
| 1006 | + $objet = objet_type($type_boucle); |
|
| 1007 | + $id_table_objet = id_table_objet($type_boucle); |
|
| 1008 | + $_primary = champ_sql($id_table_objet, $p, '', false); |
|
| 1009 | + $_env = '$Pile[0]'; |
|
| 1010 | + |
|
| 1011 | + if (!$_titre) {$_titre = "''";} |
|
| 1012 | + if (!$_primary) {$_primary = "''";} |
|
| 1013 | + $_rang = "calculer_rang_smart($_titre, '$objet', $_primary, $_env)"; |
|
| 1014 | + |
|
| 1015 | + } |
|
| 1016 | 1016 | |
| 1017 | - $p->code = $_rang; |
|
| 1018 | - $p->interdire_scripts = false; |
|
| 1019 | - } |
|
| 1017 | + $p->code = $_rang; |
|
| 1018 | + $p->interdire_scripts = false; |
|
| 1019 | + } |
|
| 1020 | 1020 | |
| 1021 | - return $p; |
|
| 1021 | + return $p; |
|
| 1022 | 1022 | } |
| 1023 | 1023 | |
| 1024 | 1024 | |
@@ -1040,12 +1040,12 @@ discard block |
||
| 1040 | 1040 | * Pile complétée par le code à générer |
| 1041 | 1041 | **/ |
| 1042 | 1042 | function balise_POPULARITE_dist($p) { |
| 1043 | - $_popularite = champ_sql('popularite', $p); |
|
| 1044 | - $p->code = "(ceil(min(100, 100 * $_popularite |
|
| 1043 | + $_popularite = champ_sql('popularite', $p); |
|
| 1044 | + $p->code = "(ceil(min(100, 100 * $_popularite |
|
| 1045 | 1045 | / max(1 , 0 + \$GLOBALS['meta']['popularite_max']))))"; |
| 1046 | - $p->interdire_scripts = false; |
|
| 1046 | + $p->interdire_scripts = false; |
|
| 1047 | 1047 | |
| 1048 | - return $p; |
|
| 1048 | + return $p; |
|
| 1049 | 1049 | } |
| 1050 | 1050 | |
| 1051 | 1051 | /** |
@@ -1092,65 +1092,65 @@ discard block |
||
| 1092 | 1092 | * Pile complétée par le code à générer |
| 1093 | 1093 | */ |
| 1094 | 1094 | function balise_PAGINATION_dist($p, $liste = 'true') { |
| 1095 | - $b = index_boucle_mere($p); |
|
| 1096 | - |
|
| 1097 | - // s'il n'y a pas de nom de boucle, on ne peut pas paginer |
|
| 1098 | - if ($b === '') { |
|
| 1099 | - $msg = array( |
|
| 1100 | - 'zbug_champ_hors_boucle', |
|
| 1101 | - array('champ' => $liste ? 'PAGINATION' : 'ANCRE_PAGINATION') |
|
| 1102 | - ); |
|
| 1103 | - erreur_squelette($msg, $p); |
|
| 1104 | - |
|
| 1105 | - return $p; |
|
| 1106 | - } |
|
| 1107 | - |
|
| 1108 | - // s'il n'y a pas de mode_partie, c'est qu'on se trouve |
|
| 1109 | - // dans un boucle recursive ou qu'on a oublie le critere {pagination} |
|
| 1110 | - if (!$p->boucles[$b]->mode_partie) { |
|
| 1111 | - if (!$p->boucles[$b]->table_optionnelle) { |
|
| 1112 | - $msg = array( |
|
| 1113 | - 'zbug_pagination_sans_critere', |
|
| 1114 | - array('champ' => '#PAGINATION') |
|
| 1115 | - ); |
|
| 1116 | - erreur_squelette($msg, $p); |
|
| 1117 | - } |
|
| 1118 | - |
|
| 1119 | - return $p; |
|
| 1120 | - } |
|
| 1121 | - |
|
| 1122 | - // a priori true |
|
| 1123 | - // si false, le compilo va bloquer sur des syntaxes avec un filtre sans argument qui suit la balise |
|
| 1124 | - // si true, les arguments simples (sans truc=chose) vont degager |
|
| 1125 | - $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false, false); |
|
| 1126 | - if (count($_contexte)) { |
|
| 1127 | - $key = key($_contexte); |
|
| 1128 | - if (is_numeric($key)) { |
|
| 1129 | - array_shift($_contexte); |
|
| 1130 | - $__modele = interprete_argument_balise(1, $p); |
|
| 1131 | - } |
|
| 1132 | - } |
|
| 1133 | - |
|
| 1134 | - if (count($_contexte)) { |
|
| 1135 | - $code_contexte = implode(',', $_contexte); |
|
| 1136 | - } else { |
|
| 1137 | - $code_contexte = ''; |
|
| 1138 | - } |
|
| 1139 | - |
|
| 1140 | - $connect = $p->boucles[$b]->sql_serveur; |
|
| 1141 | - $pas = $p->boucles[$b]->total_parties; |
|
| 1142 | - $f_pagination = chercher_filtre('pagination'); |
|
| 1143 | - $type = $p->boucles[$b]->modificateur['debut_nom']; |
|
| 1144 | - $modif = ($type[0] !== "'") ? "'debut'.$type" |
|
| 1145 | - : ("'debut" . substr($type, 1)); |
|
| 1146 | - |
|
| 1147 | - $p->code = sprintf(CODE_PAGINATION, $f_pagination, $b, $type, $modif, $pas, $liste, |
|
| 1148 | - ((isset($__modele) and $__modele) ? $__modele : "''"), _q($connect), $code_contexte); |
|
| 1149 | - |
|
| 1150 | - $p->boucles[$b]->numrows = true; |
|
| 1151 | - $p->interdire_scripts = false; |
|
| 1152 | - |
|
| 1153 | - return $p; |
|
| 1095 | + $b = index_boucle_mere($p); |
|
| 1096 | + |
|
| 1097 | + // s'il n'y a pas de nom de boucle, on ne peut pas paginer |
|
| 1098 | + if ($b === '') { |
|
| 1099 | + $msg = array( |
|
| 1100 | + 'zbug_champ_hors_boucle', |
|
| 1101 | + array('champ' => $liste ? 'PAGINATION' : 'ANCRE_PAGINATION') |
|
| 1102 | + ); |
|
| 1103 | + erreur_squelette($msg, $p); |
|
| 1104 | + |
|
| 1105 | + return $p; |
|
| 1106 | + } |
|
| 1107 | + |
|
| 1108 | + // s'il n'y a pas de mode_partie, c'est qu'on se trouve |
|
| 1109 | + // dans un boucle recursive ou qu'on a oublie le critere {pagination} |
|
| 1110 | + if (!$p->boucles[$b]->mode_partie) { |
|
| 1111 | + if (!$p->boucles[$b]->table_optionnelle) { |
|
| 1112 | + $msg = array( |
|
| 1113 | + 'zbug_pagination_sans_critere', |
|
| 1114 | + array('champ' => '#PAGINATION') |
|
| 1115 | + ); |
|
| 1116 | + erreur_squelette($msg, $p); |
|
| 1117 | + } |
|
| 1118 | + |
|
| 1119 | + return $p; |
|
| 1120 | + } |
|
| 1121 | + |
|
| 1122 | + // a priori true |
|
| 1123 | + // si false, le compilo va bloquer sur des syntaxes avec un filtre sans argument qui suit la balise |
|
| 1124 | + // si true, les arguments simples (sans truc=chose) vont degager |
|
| 1125 | + $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false, false); |
|
| 1126 | + if (count($_contexte)) { |
|
| 1127 | + $key = key($_contexte); |
|
| 1128 | + if (is_numeric($key)) { |
|
| 1129 | + array_shift($_contexte); |
|
| 1130 | + $__modele = interprete_argument_balise(1, $p); |
|
| 1131 | + } |
|
| 1132 | + } |
|
| 1133 | + |
|
| 1134 | + if (count($_contexte)) { |
|
| 1135 | + $code_contexte = implode(',', $_contexte); |
|
| 1136 | + } else { |
|
| 1137 | + $code_contexte = ''; |
|
| 1138 | + } |
|
| 1139 | + |
|
| 1140 | + $connect = $p->boucles[$b]->sql_serveur; |
|
| 1141 | + $pas = $p->boucles[$b]->total_parties; |
|
| 1142 | + $f_pagination = chercher_filtre('pagination'); |
|
| 1143 | + $type = $p->boucles[$b]->modificateur['debut_nom']; |
|
| 1144 | + $modif = ($type[0] !== "'") ? "'debut'.$type" |
|
| 1145 | + : ("'debut" . substr($type, 1)); |
|
| 1146 | + |
|
| 1147 | + $p->code = sprintf(CODE_PAGINATION, $f_pagination, $b, $type, $modif, $pas, $liste, |
|
| 1148 | + ((isset($__modele) and $__modele) ? $__modele : "''"), _q($connect), $code_contexte); |
|
| 1149 | + |
|
| 1150 | + $p->boucles[$b]->numrows = true; |
|
| 1151 | + $p->interdire_scripts = false; |
|
| 1152 | + |
|
| 1153 | + return $p; |
|
| 1154 | 1154 | } |
| 1155 | 1155 | |
| 1156 | 1156 | |
@@ -1177,11 +1177,11 @@ discard block |
||
| 1177 | 1177 | * Pile complétée par le code à générer |
| 1178 | 1178 | **/ |
| 1179 | 1179 | function balise_ANCRE_PAGINATION_dist($p) { |
| 1180 | - if ($f = charger_fonction('PAGINATION', 'balise', true)) { |
|
| 1181 | - return $f($p, $liste = 'false'); |
|
| 1182 | - } else { |
|
| 1183 | - return null; |
|
| 1184 | - } // ou une erreur ? |
|
| 1180 | + if ($f = charger_fonction('PAGINATION', 'balise', true)) { |
|
| 1181 | + return $f($p, $liste = 'false'); |
|
| 1182 | + } else { |
|
| 1183 | + return null; |
|
| 1184 | + } // ou une erreur ? |
|
| 1185 | 1185 | } |
| 1186 | 1186 | |
| 1187 | 1187 | |
@@ -1202,18 +1202,18 @@ discard block |
||
| 1202 | 1202 | * Pile complétée par le code à générer |
| 1203 | 1203 | **/ |
| 1204 | 1204 | function balise_GRAND_TOTAL_dist($p) { |
| 1205 | - $b = index_boucle_mere($p); |
|
| 1206 | - if ($b === '') { |
|
| 1207 | - $msg = array('zbug_champ_hors_boucle', array('champ' => zbug_presenter_champ($p))); |
|
| 1208 | - erreur_squelette($msg, $p); |
|
| 1209 | - } else { |
|
| 1210 | - $p->code = "(isset(\$Numrows['$b']['grand_total']) |
|
| 1205 | + $b = index_boucle_mere($p); |
|
| 1206 | + if ($b === '') { |
|
| 1207 | + $msg = array('zbug_champ_hors_boucle', array('champ' => zbug_presenter_champ($p))); |
|
| 1208 | + erreur_squelette($msg, $p); |
|
| 1209 | + } else { |
|
| 1210 | + $p->code = "(isset(\$Numrows['$b']['grand_total']) |
|
| 1211 | 1211 | ? \$Numrows['$b']['grand_total'] : \$Numrows['$b']['total'])"; |
| 1212 | - $p->boucles[$b]->numrows = true; |
|
| 1213 | - $p->interdire_scripts = false; |
|
| 1214 | - } |
|
| 1212 | + $p->boucles[$b]->numrows = true; |
|
| 1213 | + $p->interdire_scripts = false; |
|
| 1214 | + } |
|
| 1215 | 1215 | |
| 1216 | - return $p; |
|
| 1216 | + return $p; |
|
| 1217 | 1217 | } |
| 1218 | 1218 | |
| 1219 | 1219 | |
@@ -1241,10 +1241,10 @@ discard block |
||
| 1241 | 1241 | * Pile complétée par le code à générer |
| 1242 | 1242 | **/ |
| 1243 | 1243 | function balise_SELF_dist($p) { |
| 1244 | - $p->code = 'self()'; |
|
| 1245 | - $p->interdire_scripts = false; |
|
| 1244 | + $p->code = 'self()'; |
|
| 1245 | + $p->interdire_scripts = false; |
|
| 1246 | 1246 | |
| 1247 | - return $p; |
|
| 1247 | + return $p; |
|
| 1248 | 1248 | } |
| 1249 | 1249 | |
| 1250 | 1250 | |
@@ -1271,17 +1271,17 @@ discard block |
||
| 1271 | 1271 | * Pile complétée par le code à générer |
| 1272 | 1272 | **/ |
| 1273 | 1273 | function balise_CHEMIN_dist($p) { |
| 1274 | - $arg = interprete_argument_balise(1, $p); |
|
| 1275 | - if (!$arg) { |
|
| 1276 | - $msg = array('zbug_balise_sans_argument', array('balise' => ' CHEMIN')); |
|
| 1277 | - erreur_squelette($msg, $p); |
|
| 1278 | - } else { |
|
| 1279 | - $p->code = 'find_in_path(' . $arg . ')'; |
|
| 1280 | - } |
|
| 1274 | + $arg = interprete_argument_balise(1, $p); |
|
| 1275 | + if (!$arg) { |
|
| 1276 | + $msg = array('zbug_balise_sans_argument', array('balise' => ' CHEMIN')); |
|
| 1277 | + erreur_squelette($msg, $p); |
|
| 1278 | + } else { |
|
| 1279 | + $p->code = 'find_in_path(' . $arg . ')'; |
|
| 1280 | + } |
|
| 1281 | 1281 | |
| 1282 | - $p->interdire_scripts = false; |
|
| 1282 | + $p->interdire_scripts = false; |
|
| 1283 | 1283 | |
| 1284 | - return $p; |
|
| 1284 | + return $p; |
|
| 1285 | 1285 | } |
| 1286 | 1286 | |
| 1287 | 1287 | /** |
@@ -1306,16 +1306,16 @@ discard block |
||
| 1306 | 1306 | * Pile complétée par le code à générer |
| 1307 | 1307 | **/ |
| 1308 | 1308 | function balise_CHEMIN_IMAGE_dist($p) { |
| 1309 | - $arg = interprete_argument_balise(1, $p); |
|
| 1310 | - if (!$arg) { |
|
| 1311 | - $msg = array('zbug_balise_sans_argument', array('balise' => ' CHEMIN_IMAGE')); |
|
| 1312 | - erreur_squelette($msg, $p); |
|
| 1313 | - } else { |
|
| 1314 | - $p->code = 'chemin_image(' . $arg . ')'; |
|
| 1315 | - } |
|
| 1309 | + $arg = interprete_argument_balise(1, $p); |
|
| 1310 | + if (!$arg) { |
|
| 1311 | + $msg = array('zbug_balise_sans_argument', array('balise' => ' CHEMIN_IMAGE')); |
|
| 1312 | + erreur_squelette($msg, $p); |
|
| 1313 | + } else { |
|
| 1314 | + $p->code = 'chemin_image(' . $arg . ')'; |
|
| 1315 | + } |
|
| 1316 | 1316 | |
| 1317 | - $p->interdire_scripts = false; |
|
| 1318 | - return $p; |
|
| 1317 | + $p->interdire_scripts = false; |
|
| 1318 | + return $p; |
|
| 1319 | 1319 | } |
| 1320 | 1320 | |
| 1321 | 1321 | |
@@ -1353,36 +1353,36 @@ discard block |
||
| 1353 | 1353 | **/ |
| 1354 | 1354 | function balise_ENV_dist($p, $src = null) { |
| 1355 | 1355 | |
| 1356 | - // cle du tableau desiree |
|
| 1357 | - $_nom = interprete_argument_balise(1, $p); |
|
| 1358 | - // valeur par defaut |
|
| 1359 | - $_sinon = interprete_argument_balise(2, $p); |
|
| 1356 | + // cle du tableau desiree |
|
| 1357 | + $_nom = interprete_argument_balise(1, $p); |
|
| 1358 | + // valeur par defaut |
|
| 1359 | + $_sinon = interprete_argument_balise(2, $p); |
|
| 1360 | 1360 | |
| 1361 | - // $src est un tableau de donnees sources eventuellement transmis |
|
| 1362 | - // en absence, on utilise l'environnement du squelette $Pile[0] |
|
| 1361 | + // $src est un tableau de donnees sources eventuellement transmis |
|
| 1362 | + // en absence, on utilise l'environnement du squelette $Pile[0] |
|
| 1363 | 1363 | |
| 1364 | - if (!$_nom) { |
|
| 1365 | - // cas de #ENV sans argument : on retourne le serialize() du tableau |
|
| 1366 | - // une belle fonction [(#ENV|affiche_env)] serait pratique |
|
| 1367 | - if ($src) { |
|
| 1368 | - $p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")'; |
|
| 1369 | - } else { |
|
| 1370 | - $p->code = '@serialize($Pile[0])'; |
|
| 1371 | - } |
|
| 1372 | - } else { |
|
| 1373 | - if (!$src) { |
|
| 1374 | - $src = '@$Pile[0]'; |
|
| 1375 | - } |
|
| 1376 | - if ($_sinon) { |
|
| 1377 | - $p->code = "sinon(table_valeur($src, (string)$_nom, null), $_sinon)"; |
|
| 1378 | - } else { |
|
| 1379 | - $p->code = "table_valeur($src, (string)$_nom, null)"; |
|
| 1380 | - } |
|
| 1381 | - } |
|
| 1364 | + if (!$_nom) { |
|
| 1365 | + // cas de #ENV sans argument : on retourne le serialize() du tableau |
|
| 1366 | + // une belle fonction [(#ENV|affiche_env)] serait pratique |
|
| 1367 | + if ($src) { |
|
| 1368 | + $p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")'; |
|
| 1369 | + } else { |
|
| 1370 | + $p->code = '@serialize($Pile[0])'; |
|
| 1371 | + } |
|
| 1372 | + } else { |
|
| 1373 | + if (!$src) { |
|
| 1374 | + $src = '@$Pile[0]'; |
|
| 1375 | + } |
|
| 1376 | + if ($_sinon) { |
|
| 1377 | + $p->code = "sinon(table_valeur($src, (string)$_nom, null), $_sinon)"; |
|
| 1378 | + } else { |
|
| 1379 | + $p->code = "table_valeur($src, (string)$_nom, null)"; |
|
| 1380 | + } |
|
| 1381 | + } |
|
| 1382 | 1382 | |
| 1383 | - #$p->interdire_scripts = true; |
|
| 1383 | + #$p->interdire_scripts = true; |
|
| 1384 | 1384 | |
| 1385 | - return $p; |
|
| 1385 | + return $p; |
|
| 1386 | 1386 | } |
| 1387 | 1387 | |
| 1388 | 1388 | /** |
@@ -1412,16 +1412,16 @@ discard block |
||
| 1412 | 1412 | * Pile completée du code PHP d'exécution de la balise |
| 1413 | 1413 | */ |
| 1414 | 1414 | function balise_CONFIG_dist($p) { |
| 1415 | - if (!$arg = interprete_argument_balise(1, $p)) { |
|
| 1416 | - $arg = "''"; |
|
| 1417 | - } |
|
| 1418 | - $_sinon = interprete_argument_balise(2, $p); |
|
| 1419 | - $_unserialize = sinon(interprete_argument_balise(3, $p), "false"); |
|
| 1415 | + if (!$arg = interprete_argument_balise(1, $p)) { |
|
| 1416 | + $arg = "''"; |
|
| 1417 | + } |
|
| 1418 | + $_sinon = interprete_argument_balise(2, $p); |
|
| 1419 | + $_unserialize = sinon(interprete_argument_balise(3, $p), "false"); |
|
| 1420 | 1420 | |
| 1421 | - $p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' . |
|
| 1422 | - ($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')"; |
|
| 1421 | + $p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' . |
|
| 1422 | + ($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')"; |
|
| 1423 | 1423 | |
| 1424 | - return $p; |
|
| 1424 | + return $p; |
|
| 1425 | 1425 | } |
| 1426 | 1426 | |
| 1427 | 1427 | |
@@ -1444,10 +1444,10 @@ discard block |
||
| 1444 | 1444 | * Pile completée du code PHP d'exécution de la balise |
| 1445 | 1445 | */ |
| 1446 | 1446 | function balise_CONNECT_dist($p) { |
| 1447 | - $p->code = '($connect ? $connect : NULL)'; |
|
| 1448 | - $p->interdire_scripts = false; |
|
| 1447 | + $p->code = '($connect ? $connect : NULL)'; |
|
| 1448 | + $p->interdire_scripts = false; |
|
| 1449 | 1449 | |
| 1450 | - return $p; |
|
| 1450 | + return $p; |
|
| 1451 | 1451 | } |
| 1452 | 1452 | |
| 1453 | 1453 | |
@@ -1475,15 +1475,15 @@ discard block |
||
| 1475 | 1475 | * Pile completée du code PHP d'exécution de la balise |
| 1476 | 1476 | **/ |
| 1477 | 1477 | function balise_SESSION_dist($p) { |
| 1478 | - $p->descr['session'] = true; |
|
| 1478 | + $p->descr['session'] = true; |
|
| 1479 | 1479 | |
| 1480 | - $f = function_exists('balise_ENV') |
|
| 1481 | - ? 'balise_ENV' |
|
| 1482 | - : 'balise_ENV_dist'; |
|
| 1480 | + $f = function_exists('balise_ENV') |
|
| 1481 | + ? 'balise_ENV' |
|
| 1482 | + : 'balise_ENV_dist'; |
|
| 1483 | 1483 | |
| 1484 | - $p = $f($p, '$GLOBALS["visiteur_session"]'); |
|
| 1484 | + $p = $f($p, '$GLOBALS["visiteur_session"]'); |
|
| 1485 | 1485 | |
| 1486 | - return $p; |
|
| 1486 | + return $p; |
|
| 1487 | 1487 | } |
| 1488 | 1488 | |
| 1489 | 1489 | |
@@ -1506,18 +1506,18 @@ discard block |
||
| 1506 | 1506 | * Pile completée du code PHP d'exécution de la balise |
| 1507 | 1507 | **/ |
| 1508 | 1508 | function balise_SESSION_SET_dist($p) { |
| 1509 | - $_nom = interprete_argument_balise(1, $p); |
|
| 1510 | - $_val = interprete_argument_balise(2, $p); |
|
| 1511 | - if (!$_nom or !$_val) { |
|
| 1512 | - $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'SESSION_SET')); |
|
| 1513 | - erreur_squelette($err_b_s_a, $p); |
|
| 1514 | - } else { |
|
| 1515 | - $p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))'; |
|
| 1516 | - } |
|
| 1509 | + $_nom = interprete_argument_balise(1, $p); |
|
| 1510 | + $_val = interprete_argument_balise(2, $p); |
|
| 1511 | + if (!$_nom or !$_val) { |
|
| 1512 | + $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'SESSION_SET')); |
|
| 1513 | + erreur_squelette($err_b_s_a, $p); |
|
| 1514 | + } else { |
|
| 1515 | + $p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))'; |
|
| 1516 | + } |
|
| 1517 | 1517 | |
| 1518 | - $p->interdire_scripts = false; |
|
| 1518 | + $p->interdire_scripts = false; |
|
| 1519 | 1519 | |
| 1520 | - return $p; |
|
| 1520 | + return $p; |
|
| 1521 | 1521 | } |
| 1522 | 1522 | |
| 1523 | 1523 | |
@@ -1548,25 +1548,25 @@ discard block |
||
| 1548 | 1548 | * Pile completée du code PHP d'exécution de la balise |
| 1549 | 1549 | **/ |
| 1550 | 1550 | function balise_EVAL_dist($p) { |
| 1551 | - $php = interprete_argument_balise(1, $p); |
|
| 1552 | - if ($php) { |
|
| 1553 | - # optimisation sur les #EVAL{une expression sans #BALISE} |
|
| 1554 | - # attention au commentaire "// x signes" qui precede |
|
| 1555 | - if (preg_match(",^([[:space:]]*//[^\n]*\n)'([^']+)'$,ms", |
|
| 1556 | - $php, $r)) { |
|
| 1557 | - $p->code = /* $r[1]. */ |
|
| 1558 | - '(' . $r[2] . ')'; |
|
| 1559 | - } else { |
|
| 1560 | - $p->code = "eval('return '.$php.';')"; |
|
| 1561 | - } |
|
| 1562 | - } else { |
|
| 1563 | - $msg = array('zbug_balise_sans_argument', array('balise' => ' EVAL')); |
|
| 1564 | - erreur_squelette($msg, $p); |
|
| 1565 | - } |
|
| 1551 | + $php = interprete_argument_balise(1, $p); |
|
| 1552 | + if ($php) { |
|
| 1553 | + # optimisation sur les #EVAL{une expression sans #BALISE} |
|
| 1554 | + # attention au commentaire "// x signes" qui precede |
|
| 1555 | + if (preg_match(",^([[:space:]]*//[^\n]*\n)'([^']+)'$,ms", |
|
| 1556 | + $php, $r)) { |
|
| 1557 | + $p->code = /* $r[1]. */ |
|
| 1558 | + '(' . $r[2] . ')'; |
|
| 1559 | + } else { |
|
| 1560 | + $p->code = "eval('return '.$php.';')"; |
|
| 1561 | + } |
|
| 1562 | + } else { |
|
| 1563 | + $msg = array('zbug_balise_sans_argument', array('balise' => ' EVAL')); |
|
| 1564 | + erreur_squelette($msg, $p); |
|
| 1565 | + } |
|
| 1566 | 1566 | |
| 1567 | - #$p->interdire_scripts = true; |
|
| 1567 | + #$p->interdire_scripts = true; |
|
| 1568 | 1568 | |
| 1569 | - return $p; |
|
| 1569 | + return $p; |
|
| 1570 | 1570 | } |
| 1571 | 1571 | |
| 1572 | 1572 | |
@@ -1596,18 +1596,18 @@ discard block |
||
| 1596 | 1596 | **/ |
| 1597 | 1597 | function balise_CHAMP_SQL_dist($p) { |
| 1598 | 1598 | |
| 1599 | - if ($p->param |
|
| 1600 | - and isset($p->param[0][1][0]) |
|
| 1601 | - and $champ = ($p->param[0][1][0]->texte) |
|
| 1602 | - ) { |
|
| 1603 | - $p->code = champ_sql($champ, $p); |
|
| 1604 | - } else { |
|
| 1605 | - $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => ' CHAMP_SQL')); |
|
| 1606 | - erreur_squelette($err_b_s_a, $p); |
|
| 1607 | - } |
|
| 1599 | + if ($p->param |
|
| 1600 | + and isset($p->param[0][1][0]) |
|
| 1601 | + and $champ = ($p->param[0][1][0]->texte) |
|
| 1602 | + ) { |
|
| 1603 | + $p->code = champ_sql($champ, $p); |
|
| 1604 | + } else { |
|
| 1605 | + $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => ' CHAMP_SQL')); |
|
| 1606 | + erreur_squelette($err_b_s_a, $p); |
|
| 1607 | + } |
|
| 1608 | 1608 | |
| 1609 | - #$p->interdire_scripts = true; |
|
| 1610 | - return $p; |
|
| 1609 | + #$p->interdire_scripts = true; |
|
| 1610 | + return $p; |
|
| 1611 | 1611 | } |
| 1612 | 1612 | |
| 1613 | 1613 | /** |
@@ -1633,13 +1633,13 @@ discard block |
||
| 1633 | 1633 | * Pile complétée par le code à générer |
| 1634 | 1634 | **/ |
| 1635 | 1635 | function balise_VAL_dist($p) { |
| 1636 | - $p->code = interprete_argument_balise(1, $p); |
|
| 1637 | - if (!strlen($p->code)) { |
|
| 1638 | - $p->code = "''"; |
|
| 1639 | - } |
|
| 1640 | - $p->interdire_scripts = false; |
|
| 1636 | + $p->code = interprete_argument_balise(1, $p); |
|
| 1637 | + if (!strlen($p->code)) { |
|
| 1638 | + $p->code = "''"; |
|
| 1639 | + } |
|
| 1640 | + $p->interdire_scripts = false; |
|
| 1641 | 1641 | |
| 1642 | - return $p; |
|
| 1642 | + return $p; |
|
| 1643 | 1643 | } |
| 1644 | 1644 | |
| 1645 | 1645 | /** |
@@ -1685,10 +1685,10 @@ discard block |
||
| 1685 | 1685 | * Pile complétée par le code à générer |
| 1686 | 1686 | **/ |
| 1687 | 1687 | function balise_REM_dist($p) { |
| 1688 | - $p->code = "''"; |
|
| 1689 | - $p->interdire_scripts = false; |
|
| 1688 | + $p->code = "''"; |
|
| 1689 | + $p->interdire_scripts = false; |
|
| 1690 | 1690 | |
| 1691 | - return $p; |
|
| 1691 | + return $p; |
|
| 1692 | 1692 | } |
| 1693 | 1693 | |
| 1694 | 1694 | /** |
@@ -1698,10 +1698,10 @@ discard block |
||
| 1698 | 1698 | * @return mixed |
| 1699 | 1699 | */ |
| 1700 | 1700 | function balise_NULL_dist($p) { |
| 1701 | - $p->code = "null"; |
|
| 1702 | - $p->interdire_scripts = false; |
|
| 1701 | + $p->code = "null"; |
|
| 1702 | + $p->interdire_scripts = false; |
|
| 1703 | 1703 | |
| 1704 | - return $p; |
|
| 1704 | + return $p; |
|
| 1705 | 1705 | } |
| 1706 | 1706 | |
| 1707 | 1707 | |
@@ -1725,18 +1725,18 @@ discard block |
||
| 1725 | 1725 | **/ |
| 1726 | 1726 | function balise_HTTP_HEADER_dist($p) { |
| 1727 | 1727 | |
| 1728 | - $header = interprete_argument_balise(1, $p); |
|
| 1729 | - if (!$header) { |
|
| 1730 | - $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'HTTP_HEADER')); |
|
| 1731 | - erreur_squelette($err_b_s_a, $p); |
|
| 1732 | - } else { |
|
| 1733 | - $p->code = "'<'.'?php header(' . _q(" |
|
| 1734 | - . $header |
|
| 1735 | - . ") . '); ?'.'>'"; |
|
| 1736 | - } |
|
| 1737 | - $p->interdire_scripts = false; |
|
| 1728 | + $header = interprete_argument_balise(1, $p); |
|
| 1729 | + if (!$header) { |
|
| 1730 | + $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'HTTP_HEADER')); |
|
| 1731 | + erreur_squelette($err_b_s_a, $p); |
|
| 1732 | + } else { |
|
| 1733 | + $p->code = "'<'.'?php header(' . _q(" |
|
| 1734 | + . $header |
|
| 1735 | + . ") . '); ?'.'>'"; |
|
| 1736 | + } |
|
| 1737 | + $p->interdire_scripts = false; |
|
| 1738 | 1738 | |
| 1739 | - return $p; |
|
| 1739 | + return $p; |
|
| 1740 | 1740 | } |
| 1741 | 1741 | |
| 1742 | 1742 | |
@@ -1761,20 +1761,20 @@ discard block |
||
| 1761 | 1761 | * Pile complétée par le code à générer |
| 1762 | 1762 | **/ |
| 1763 | 1763 | function balise_FILTRE_dist($p) { |
| 1764 | - if ($p->param) { |
|
| 1765 | - $args = array(); |
|
| 1766 | - foreach ($p->param as $i => $ignore) { |
|
| 1767 | - $args[] = interprete_argument_balise($i + 1, $p); |
|
| 1768 | - } |
|
| 1769 | - $p->code = "'<' . '" |
|
| 1770 | - . '?php header("X-Spip-Filtre: \'.' |
|
| 1771 | - . join('.\'|\'.', $args) |
|
| 1772 | - . " . '\"); ?'.'>'"; |
|
| 1764 | + if ($p->param) { |
|
| 1765 | + $args = array(); |
|
| 1766 | + foreach ($p->param as $i => $ignore) { |
|
| 1767 | + $args[] = interprete_argument_balise($i + 1, $p); |
|
| 1768 | + } |
|
| 1769 | + $p->code = "'<' . '" |
|
| 1770 | + . '?php header("X-Spip-Filtre: \'.' |
|
| 1771 | + . join('.\'|\'.', $args) |
|
| 1772 | + . " . '\"); ?'.'>'"; |
|
| 1773 | 1773 | |
| 1774 | - $p->interdire_scripts = false; |
|
| 1774 | + $p->interdire_scripts = false; |
|
| 1775 | 1775 | |
| 1776 | - return $p; |
|
| 1777 | - } |
|
| 1776 | + return $p; |
|
| 1777 | + } |
|
| 1778 | 1778 | } |
| 1779 | 1779 | |
| 1780 | 1780 | |
@@ -1810,53 +1810,53 @@ discard block |
||
| 1810 | 1810 | **/ |
| 1811 | 1811 | function balise_CACHE_dist($p) { |
| 1812 | 1812 | |
| 1813 | - if ($p->param) { |
|
| 1814 | - $duree = valeur_numerique($p->param[0][1][0]->texte); |
|
| 1815 | - |
|
| 1816 | - // noter la duree du cache dans un entete proprietaire |
|
| 1817 | - |
|
| 1818 | - $code = "'<'.'" . '?php header("X-Spip-Cache: ' |
|
| 1819 | - . $duree |
|
| 1820 | - . '"); ?' . "'.'>'"; |
|
| 1821 | - |
|
| 1822 | - // Remplir le header Cache-Control |
|
| 1823 | - // cas #CACHE{0} |
|
| 1824 | - if ($duree == 0) { |
|
| 1825 | - $code .= ".'<'.'" |
|
| 1826 | - . '?php header("Cache-Control: no-cache, must-revalidate"); ?' |
|
| 1827 | - . "'.'><'.'" |
|
| 1828 | - . '?php header("Pragma: no-cache"); ?' |
|
| 1829 | - . "'.'>'"; |
|
| 1830 | - } |
|
| 1831 | - |
|
| 1832 | - // recuperer les parametres suivants |
|
| 1833 | - $i = 1; |
|
| 1834 | - while (isset($p->param[0][++$i])) { |
|
| 1835 | - $pa = ($p->param[0][$i][0]->texte); |
|
| 1836 | - |
|
| 1837 | - if ($pa == 'cache-client' |
|
| 1838 | - and $duree > 0 |
|
| 1839 | - ) { |
|
| 1840 | - $code .= ".'<'.'" . '?php header("Cache-Control: max-age=' |
|
| 1841 | - . $duree |
|
| 1842 | - . '"); ?' . "'.'>'"; |
|
| 1843 | - // il semble logique, si on cache-client, de ne pas invalider |
|
| 1844 | - $pa = 'statique'; |
|
| 1845 | - } |
|
| 1846 | - |
|
| 1847 | - if ($pa == 'statique' |
|
| 1848 | - and $duree > 0 |
|
| 1849 | - ) { |
|
| 1850 | - $code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'"; |
|
| 1851 | - } |
|
| 1852 | - } |
|
| 1853 | - } else { |
|
| 1854 | - $code = "''"; |
|
| 1855 | - } |
|
| 1856 | - $p->code = $code; |
|
| 1857 | - $p->interdire_scripts = false; |
|
| 1858 | - |
|
| 1859 | - return $p; |
|
| 1813 | + if ($p->param) { |
|
| 1814 | + $duree = valeur_numerique($p->param[0][1][0]->texte); |
|
| 1815 | + |
|
| 1816 | + // noter la duree du cache dans un entete proprietaire |
|
| 1817 | + |
|
| 1818 | + $code = "'<'.'" . '?php header("X-Spip-Cache: ' |
|
| 1819 | + . $duree |
|
| 1820 | + . '"); ?' . "'.'>'"; |
|
| 1821 | + |
|
| 1822 | + // Remplir le header Cache-Control |
|
| 1823 | + // cas #CACHE{0} |
|
| 1824 | + if ($duree == 0) { |
|
| 1825 | + $code .= ".'<'.'" |
|
| 1826 | + . '?php header("Cache-Control: no-cache, must-revalidate"); ?' |
|
| 1827 | + . "'.'><'.'" |
|
| 1828 | + . '?php header("Pragma: no-cache"); ?' |
|
| 1829 | + . "'.'>'"; |
|
| 1830 | + } |
|
| 1831 | + |
|
| 1832 | + // recuperer les parametres suivants |
|
| 1833 | + $i = 1; |
|
| 1834 | + while (isset($p->param[0][++$i])) { |
|
| 1835 | + $pa = ($p->param[0][$i][0]->texte); |
|
| 1836 | + |
|
| 1837 | + if ($pa == 'cache-client' |
|
| 1838 | + and $duree > 0 |
|
| 1839 | + ) { |
|
| 1840 | + $code .= ".'<'.'" . '?php header("Cache-Control: max-age=' |
|
| 1841 | + . $duree |
|
| 1842 | + . '"); ?' . "'.'>'"; |
|
| 1843 | + // il semble logique, si on cache-client, de ne pas invalider |
|
| 1844 | + $pa = 'statique'; |
|
| 1845 | + } |
|
| 1846 | + |
|
| 1847 | + if ($pa == 'statique' |
|
| 1848 | + and $duree > 0 |
|
| 1849 | + ) { |
|
| 1850 | + $code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'"; |
|
| 1851 | + } |
|
| 1852 | + } |
|
| 1853 | + } else { |
|
| 1854 | + $code = "''"; |
|
| 1855 | + } |
|
| 1856 | + $p->code = $code; |
|
| 1857 | + $p->interdire_scripts = false; |
|
| 1858 | + |
|
| 1859 | + return $p; |
|
| 1860 | 1860 | } |
| 1861 | 1861 | |
| 1862 | 1862 | |
@@ -1888,13 +1888,13 @@ discard block |
||
| 1888 | 1888 | * Pile complétée par le code à générer |
| 1889 | 1889 | */ |
| 1890 | 1890 | function balise_INSERT_HEAD_dist($p) { |
| 1891 | - $p->code = "'<'.'" |
|
| 1892 | - . '?php header("X-Spip-Filtre: insert_head_css_conditionnel"); ?' |
|
| 1893 | - . "'.'>'"; |
|
| 1894 | - $p->code .= ". pipeline('insert_head','<!-- insert_head -->')"; |
|
| 1895 | - $p->interdire_scripts = false; |
|
| 1891 | + $p->code = "'<'.'" |
|
| 1892 | + . '?php header("X-Spip-Filtre: insert_head_css_conditionnel"); ?' |
|
| 1893 | + . "'.'>'"; |
|
| 1894 | + $p->code .= ". pipeline('insert_head','<!-- insert_head -->')"; |
|
| 1895 | + $p->interdire_scripts = false; |
|
| 1896 | 1896 | |
| 1897 | - return $p; |
|
| 1897 | + return $p; |
|
| 1898 | 1898 | } |
| 1899 | 1899 | |
| 1900 | 1900 | /** |
@@ -1912,10 +1912,10 @@ discard block |
||
| 1912 | 1912 | * Pile complétée par le code à générer |
| 1913 | 1913 | */ |
| 1914 | 1914 | function balise_INSERT_HEAD_CSS_dist($p) { |
| 1915 | - $p->code = "pipeline('insert_head_css','<!-- insert_head_css -->')"; |
|
| 1916 | - $p->interdire_scripts = false; |
|
| 1915 | + $p->code = "pipeline('insert_head_css','<!-- insert_head_css -->')"; |
|
| 1916 | + $p->interdire_scripts = false; |
|
| 1917 | 1917 | |
| 1918 | - return $p; |
|
| 1918 | + return $p; |
|
| 1919 | 1919 | } |
| 1920 | 1920 | |
| 1921 | 1921 | /** |
@@ -1930,11 +1930,11 @@ discard block |
||
| 1930 | 1930 | * Pile complétée par le code à générer |
| 1931 | 1931 | **/ |
| 1932 | 1932 | function balise_INCLUDE_dist($p) { |
| 1933 | - if (function_exists('balise_INCLURE')) { |
|
| 1934 | - return balise_INCLURE($p); |
|
| 1935 | - } else { |
|
| 1936 | - return balise_INCLURE_dist($p); |
|
| 1937 | - } |
|
| 1933 | + if (function_exists('balise_INCLURE')) { |
|
| 1934 | + return balise_INCLURE($p); |
|
| 1935 | + } else { |
|
| 1936 | + return balise_INCLURE_dist($p); |
|
| 1937 | + } |
|
| 1938 | 1938 | } |
| 1939 | 1939 | |
| 1940 | 1940 | /** |
@@ -1968,68 +1968,68 @@ discard block |
||
| 1968 | 1968 | * Pile complétée par le code à générer |
| 1969 | 1969 | **/ |
| 1970 | 1970 | function balise_INCLURE_dist($p) { |
| 1971 | - $id_boucle = $p->id_boucle; |
|
| 1972 | - // la lang n'est pas passe de facon automatique par argumenter |
|
| 1973 | - // mais le sera pas recuperer_fond, sauf si etoile=>true est passe |
|
| 1974 | - // en option |
|
| 1975 | - |
|
| 1976 | - $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $id_boucle, false, false); |
|
| 1977 | - |
|
| 1978 | - // erreur de syntaxe = fond absent |
|
| 1979 | - // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 1980 | - if (!$_contexte) { |
|
| 1981 | - $contexte = array(); |
|
| 1982 | - } |
|
| 1983 | - |
|
| 1984 | - if (isset($_contexte['fond'])) { |
|
| 1985 | - |
|
| 1986 | - $f = $_contexte['fond']; |
|
| 1987 | - // toujours vrai : |
|
| 1988 | - if (preg_match('/^.fond.\s*=>(.*)$/s', $f, $r)) { |
|
| 1989 | - $f = $r[1]; |
|
| 1990 | - unset($_contexte['fond']); |
|
| 1991 | - } else { |
|
| 1992 | - spip_log("compilation de #INCLURE a revoir"); |
|
| 1993 | - } |
|
| 1994 | - |
|
| 1995 | - // #INCLURE{doublons} |
|
| 1996 | - if (isset($_contexte['doublons'])) { |
|
| 1997 | - $_contexte['doublons'] = "'doublons' => \$doublons"; |
|
| 1998 | - } |
|
| 1999 | - |
|
| 2000 | - // Critere d'inclusion {env} (et {self} pour compatibilite ascendante) |
|
| 2001 | - $flag_env = false; |
|
| 2002 | - if (isset($_contexte['env']) or isset($_contexte['self'])) { |
|
| 2003 | - $flag_env = true; |
|
| 2004 | - unset($_contexte['env']); |
|
| 2005 | - } |
|
| 2006 | - |
|
| 2007 | - $_options = array(); |
|
| 2008 | - if (isset($_contexte['ajax'])) { |
|
| 2009 | - $_options[] = preg_replace(",=>(.*)$,ims", '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2010 | - unset($_contexte['ajax']); |
|
| 2011 | - } |
|
| 2012 | - if ($p->etoile) { |
|
| 2013 | - $_options[] = "'etoile'=>true"; |
|
| 2014 | - } |
|
| 2015 | - $_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ")"; |
|
| 2016 | - |
|
| 2017 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2018 | - if ($flag_env) { |
|
| 2019 | - $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2020 | - } |
|
| 2021 | - |
|
| 2022 | - $p->code = sprintf(CODE_RECUPERER_FOND, $f, $_l, join(',', $_options), "_request('connect')"); |
|
| 2023 | - |
|
| 2024 | - } elseif (!isset($_contexte[1])) { |
|
| 2025 | - $msg = array('zbug_balise_sans_argument', array('balise' => ' INCLURE')); |
|
| 2026 | - erreur_squelette($msg, $p); |
|
| 2027 | - } else { |
|
| 2028 | - $p->code = 'charge_scripts(' . $_contexte[1] . ',false)'; |
|
| 2029 | - } |
|
| 2030 | - |
|
| 2031 | - $p->interdire_scripts = false; // la securite est assuree par recuperer_fond |
|
| 2032 | - return $p; |
|
| 1971 | + $id_boucle = $p->id_boucle; |
|
| 1972 | + // la lang n'est pas passe de facon automatique par argumenter |
|
| 1973 | + // mais le sera pas recuperer_fond, sauf si etoile=>true est passe |
|
| 1974 | + // en option |
|
| 1975 | + |
|
| 1976 | + $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $id_boucle, false, false); |
|
| 1977 | + |
|
| 1978 | + // erreur de syntaxe = fond absent |
|
| 1979 | + // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 1980 | + if (!$_contexte) { |
|
| 1981 | + $contexte = array(); |
|
| 1982 | + } |
|
| 1983 | + |
|
| 1984 | + if (isset($_contexte['fond'])) { |
|
| 1985 | + |
|
| 1986 | + $f = $_contexte['fond']; |
|
| 1987 | + // toujours vrai : |
|
| 1988 | + if (preg_match('/^.fond.\s*=>(.*)$/s', $f, $r)) { |
|
| 1989 | + $f = $r[1]; |
|
| 1990 | + unset($_contexte['fond']); |
|
| 1991 | + } else { |
|
| 1992 | + spip_log("compilation de #INCLURE a revoir"); |
|
| 1993 | + } |
|
| 1994 | + |
|
| 1995 | + // #INCLURE{doublons} |
|
| 1996 | + if (isset($_contexte['doublons'])) { |
|
| 1997 | + $_contexte['doublons'] = "'doublons' => \$doublons"; |
|
| 1998 | + } |
|
| 1999 | + |
|
| 2000 | + // Critere d'inclusion {env} (et {self} pour compatibilite ascendante) |
|
| 2001 | + $flag_env = false; |
|
| 2002 | + if (isset($_contexte['env']) or isset($_contexte['self'])) { |
|
| 2003 | + $flag_env = true; |
|
| 2004 | + unset($_contexte['env']); |
|
| 2005 | + } |
|
| 2006 | + |
|
| 2007 | + $_options = array(); |
|
| 2008 | + if (isset($_contexte['ajax'])) { |
|
| 2009 | + $_options[] = preg_replace(",=>(.*)$,ims", '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2010 | + unset($_contexte['ajax']); |
|
| 2011 | + } |
|
| 2012 | + if ($p->etoile) { |
|
| 2013 | + $_options[] = "'etoile'=>true"; |
|
| 2014 | + } |
|
| 2015 | + $_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ")"; |
|
| 2016 | + |
|
| 2017 | + $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2018 | + if ($flag_env) { |
|
| 2019 | + $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2020 | + } |
|
| 2021 | + |
|
| 2022 | + $p->code = sprintf(CODE_RECUPERER_FOND, $f, $_l, join(',', $_options), "_request('connect')"); |
|
| 2023 | + |
|
| 2024 | + } elseif (!isset($_contexte[1])) { |
|
| 2025 | + $msg = array('zbug_balise_sans_argument', array('balise' => ' INCLURE')); |
|
| 2026 | + erreur_squelette($msg, $p); |
|
| 2027 | + } else { |
|
| 2028 | + $p->code = 'charge_scripts(' . $_contexte[1] . ',false)'; |
|
| 2029 | + } |
|
| 2030 | + |
|
| 2031 | + $p->interdire_scripts = false; // la securite est assuree par recuperer_fond |
|
| 2032 | + return $p; |
|
| 2033 | 2033 | } |
| 2034 | 2034 | |
| 2035 | 2035 | |
@@ -2057,69 +2057,69 @@ discard block |
||
| 2057 | 2057 | **/ |
| 2058 | 2058 | function balise_MODELE_dist($p) { |
| 2059 | 2059 | |
| 2060 | - $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false); |
|
| 2061 | - |
|
| 2062 | - // erreur de syntaxe = fond absent |
|
| 2063 | - // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 2064 | - if (!$_contexte) { |
|
| 2065 | - $_contexte = array(); |
|
| 2066 | - } |
|
| 2067 | - |
|
| 2068 | - if (!isset($_contexte[1])) { |
|
| 2069 | - $msg = array('zbug_balise_sans_argument', array('balise' => ' MODELE')); |
|
| 2070 | - erreur_squelette($msg, $p); |
|
| 2071 | - } else { |
|
| 2072 | - $nom = $_contexte[1]; |
|
| 2073 | - unset($_contexte[1]); |
|
| 2074 | - |
|
| 2075 | - if (preg_match("/^\s*'[^']*'/s", $nom)) { |
|
| 2076 | - $nom = "'modeles/" . substr($nom, 1); |
|
| 2077 | - } else { |
|
| 2078 | - $nom = "'modeles/' . $nom"; |
|
| 2079 | - } |
|
| 2080 | - |
|
| 2081 | - $flag_env = false; |
|
| 2082 | - if (isset($_contexte['env'])) { |
|
| 2083 | - $flag_env = true; |
|
| 2084 | - unset($_contexte['env']); |
|
| 2085 | - } |
|
| 2086 | - |
|
| 2087 | - // Incoherence dans la syntaxe du contexte. A revoir. |
|
| 2088 | - // Reserver la cle primaire de la boucle courante si elle existe |
|
| 2089 | - if (isset($p->boucles[$p->id_boucle]->primary)) { |
|
| 2090 | - $primary = $p->boucles[$p->id_boucle]->primary; |
|
| 2091 | - if (!strpos($primary, ',')) { |
|
| 2092 | - $id = champ_sql($primary, $p); |
|
| 2093 | - $_contexte[] = "'$primary'=>" . $id; |
|
| 2094 | - $_contexte[] = "'id'=>" . $id; |
|
| 2095 | - } |
|
| 2096 | - } |
|
| 2097 | - $_contexte[] = "'recurs'=>(++\$recurs)"; |
|
| 2098 | - $connect = ''; |
|
| 2099 | - if (isset($p->boucles[$p->id_boucle])) { |
|
| 2100 | - $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2101 | - } |
|
| 2102 | - |
|
| 2103 | - $_options = memoriser_contexte_compil($p); |
|
| 2104 | - $_options = "'compil'=>array($_options), 'trim'=>true"; |
|
| 2105 | - if (isset($_contexte['ajax'])) { |
|
| 2106 | - $_options .= ", " . preg_replace(",=>(.*)$,ims", '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2107 | - unset($_contexte['ajax']); |
|
| 2108 | - } |
|
| 2109 | - |
|
| 2110 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2111 | - if ($flag_env) { |
|
| 2112 | - $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2113 | - } |
|
| 2114 | - |
|
| 2115 | - $page = sprintf(CODE_RECUPERER_FOND, $nom, $_l, $_options, _q($connect)); |
|
| 2116 | - |
|
| 2117 | - $p->code = "\n\t(((\$recurs=(isset(\$Pile[0]['recurs'])?\$Pile[0]['recurs']:0))>=5)? '' :\n\t$page)\n"; |
|
| 2118 | - |
|
| 2119 | - $p->interdire_scripts = false; // securite assuree par le squelette |
|
| 2120 | - } |
|
| 2121 | - |
|
| 2122 | - return $p; |
|
| 2060 | + $_contexte = argumenter_inclure($p->param, true, $p, $p->boucles, $p->id_boucle, false); |
|
| 2061 | + |
|
| 2062 | + // erreur de syntaxe = fond absent |
|
| 2063 | + // (2 messages d'erreur SPIP pour le prix d'un, mais pas d'erreur PHP |
|
| 2064 | + if (!$_contexte) { |
|
| 2065 | + $_contexte = array(); |
|
| 2066 | + } |
|
| 2067 | + |
|
| 2068 | + if (!isset($_contexte[1])) { |
|
| 2069 | + $msg = array('zbug_balise_sans_argument', array('balise' => ' MODELE')); |
|
| 2070 | + erreur_squelette($msg, $p); |
|
| 2071 | + } else { |
|
| 2072 | + $nom = $_contexte[1]; |
|
| 2073 | + unset($_contexte[1]); |
|
| 2074 | + |
|
| 2075 | + if (preg_match("/^\s*'[^']*'/s", $nom)) { |
|
| 2076 | + $nom = "'modeles/" . substr($nom, 1); |
|
| 2077 | + } else { |
|
| 2078 | + $nom = "'modeles/' . $nom"; |
|
| 2079 | + } |
|
| 2080 | + |
|
| 2081 | + $flag_env = false; |
|
| 2082 | + if (isset($_contexte['env'])) { |
|
| 2083 | + $flag_env = true; |
|
| 2084 | + unset($_contexte['env']); |
|
| 2085 | + } |
|
| 2086 | + |
|
| 2087 | + // Incoherence dans la syntaxe du contexte. A revoir. |
|
| 2088 | + // Reserver la cle primaire de la boucle courante si elle existe |
|
| 2089 | + if (isset($p->boucles[$p->id_boucle]->primary)) { |
|
| 2090 | + $primary = $p->boucles[$p->id_boucle]->primary; |
|
| 2091 | + if (!strpos($primary, ',')) { |
|
| 2092 | + $id = champ_sql($primary, $p); |
|
| 2093 | + $_contexte[] = "'$primary'=>" . $id; |
|
| 2094 | + $_contexte[] = "'id'=>" . $id; |
|
| 2095 | + } |
|
| 2096 | + } |
|
| 2097 | + $_contexte[] = "'recurs'=>(++\$recurs)"; |
|
| 2098 | + $connect = ''; |
|
| 2099 | + if (isset($p->boucles[$p->id_boucle])) { |
|
| 2100 | + $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2101 | + } |
|
| 2102 | + |
|
| 2103 | + $_options = memoriser_contexte_compil($p); |
|
| 2104 | + $_options = "'compil'=>array($_options), 'trim'=>true"; |
|
| 2105 | + if (isset($_contexte['ajax'])) { |
|
| 2106 | + $_options .= ", " . preg_replace(",=>(.*)$,ims", '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2107 | + unset($_contexte['ajax']); |
|
| 2108 | + } |
|
| 2109 | + |
|
| 2110 | + $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2111 | + if ($flag_env) { |
|
| 2112 | + $_l = "array_merge(\$Pile[0],$_l)"; |
|
| 2113 | + } |
|
| 2114 | + |
|
| 2115 | + $page = sprintf(CODE_RECUPERER_FOND, $nom, $_l, $_options, _q($connect)); |
|
| 2116 | + |
|
| 2117 | + $p->code = "\n\t(((\$recurs=(isset(\$Pile[0]['recurs'])?\$Pile[0]['recurs']:0))>=5)? '' :\n\t$page)\n"; |
|
| 2118 | + |
|
| 2119 | + $p->interdire_scripts = false; // securite assuree par le squelette |
|
| 2120 | + } |
|
| 2121 | + |
|
| 2122 | + return $p; |
|
| 2123 | 2123 | } |
| 2124 | 2124 | |
| 2125 | 2125 | |
@@ -2143,21 +2143,21 @@ discard block |
||
| 2143 | 2143 | * Pile complétée par le code à générer |
| 2144 | 2144 | **/ |
| 2145 | 2145 | function balise_SET_dist($p) { |
| 2146 | - $_nom = interprete_argument_balise(1, $p); |
|
| 2147 | - $_val = interprete_argument_balise(2, $p); |
|
| 2146 | + $_nom = interprete_argument_balise(1, $p); |
|
| 2147 | + $_val = interprete_argument_balise(2, $p); |
|
| 2148 | 2148 | |
| 2149 | - if (!$_nom or !$_val) { |
|
| 2150 | - $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'SET')); |
|
| 2151 | - erreur_squelette($err_b_s_a, $p); |
|
| 2152 | - } |
|
| 2153 | - // affectation $_zzz inutile, mais permet de contourner un bug OpCode cache sous PHP 5.5.4 |
|
| 2154 | - // cf https://bugs.php.net/bug.php?id=65845 |
|
| 2155 | - else { |
|
| 2156 | - $p->code = "vide(\$Pile['vars'][\$_zzz=(string)$_nom] = $_val)"; |
|
| 2157 | - } |
|
| 2149 | + if (!$_nom or !$_val) { |
|
| 2150 | + $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'SET')); |
|
| 2151 | + erreur_squelette($err_b_s_a, $p); |
|
| 2152 | + } |
|
| 2153 | + // affectation $_zzz inutile, mais permet de contourner un bug OpCode cache sous PHP 5.5.4 |
|
| 2154 | + // cf https://bugs.php.net/bug.php?id=65845 |
|
| 2155 | + else { |
|
| 2156 | + $p->code = "vide(\$Pile['vars'][\$_zzz=(string)$_nom] = $_val)"; |
|
| 2157 | + } |
|
| 2158 | 2158 | |
| 2159 | - $p->interdire_scripts = false; // la balise ne renvoie rien |
|
| 2160 | - return $p; |
|
| 2159 | + $p->interdire_scripts = false; // la balise ne renvoie rien |
|
| 2160 | + return $p; |
|
| 2161 | 2161 | } |
| 2162 | 2162 | |
| 2163 | 2163 | |
@@ -2187,12 +2187,12 @@ discard block |
||
| 2187 | 2187 | * Pile complétée par le code à générer |
| 2188 | 2188 | **/ |
| 2189 | 2189 | function balise_GET_dist($p) { |
| 2190 | - $p->interdire_scripts = false; // le contenu vient de #SET, donc il est de confiance |
|
| 2191 | - if (function_exists('balise_ENV')) { |
|
| 2192 | - return balise_ENV($p, '$Pile["vars"]'); |
|
| 2193 | - } else { |
|
| 2194 | - return balise_ENV_dist($p, '$Pile["vars"]'); |
|
| 2195 | - } |
|
| 2190 | + $p->interdire_scripts = false; // le contenu vient de #SET, donc il est de confiance |
|
| 2191 | + if (function_exists('balise_ENV')) { |
|
| 2192 | + return balise_ENV($p, '$Pile["vars"]'); |
|
| 2193 | + } else { |
|
| 2194 | + return balise_ENV_dist($p, '$Pile["vars"]'); |
|
| 2195 | + } |
|
| 2196 | 2196 | } |
| 2197 | 2197 | |
| 2198 | 2198 | |
@@ -2215,22 +2215,22 @@ discard block |
||
| 2215 | 2215 | * Pile complétée par le code à générer |
| 2216 | 2216 | **/ |
| 2217 | 2217 | function balise_DOUBLONS_dist($p) { |
| 2218 | - if ($type = interprete_argument_balise(1, $p)) { |
|
| 2219 | - if ($famille = interprete_argument_balise(2, $p)) { |
|
| 2220 | - $type .= '.' . $famille; |
|
| 2221 | - } |
|
| 2222 | - $p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")'; |
|
| 2223 | - if (!$p->etoile) { |
|
| 2224 | - $p->code = 'array_filter(array_map("intval",explode(",",' |
|
| 2225 | - . $p->code . ')))'; |
|
| 2226 | - } |
|
| 2227 | - } else { |
|
| 2228 | - $p->code = '$doublons'; |
|
| 2229 | - } |
|
| 2218 | + if ($type = interprete_argument_balise(1, $p)) { |
|
| 2219 | + if ($famille = interprete_argument_balise(2, $p)) { |
|
| 2220 | + $type .= '.' . $famille; |
|
| 2221 | + } |
|
| 2222 | + $p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")'; |
|
| 2223 | + if (!$p->etoile) { |
|
| 2224 | + $p->code = 'array_filter(array_map("intval",explode(",",' |
|
| 2225 | + . $p->code . ')))'; |
|
| 2226 | + } |
|
| 2227 | + } else { |
|
| 2228 | + $p->code = '$doublons'; |
|
| 2229 | + } |
|
| 2230 | 2230 | |
| 2231 | - $p->interdire_scripts = false; |
|
| 2231 | + $p->interdire_scripts = false; |
|
| 2232 | 2232 | |
| 2233 | - return $p; |
|
| 2233 | + return $p; |
|
| 2234 | 2234 | } |
| 2235 | 2235 | |
| 2236 | 2236 | |
@@ -2253,18 +2253,18 @@ discard block |
||
| 2253 | 2253 | * Pile complétée par le code à générer |
| 2254 | 2254 | **/ |
| 2255 | 2255 | function balise_PIPELINE_dist($p) { |
| 2256 | - $_pipe = interprete_argument_balise(1, $p); |
|
| 2257 | - if (!$_pipe) { |
|
| 2258 | - $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'PIPELINE')); |
|
| 2259 | - erreur_squelette($err_b_s_a, $p); |
|
| 2260 | - } else { |
|
| 2261 | - $_flux = interprete_argument_balise(2, $p); |
|
| 2262 | - $_flux = $_flux ? $_flux : "''"; |
|
| 2263 | - $p->code = "pipeline( $_pipe , $_flux )"; |
|
| 2264 | - $p->interdire_scripts = false; |
|
| 2265 | - } |
|
| 2256 | + $_pipe = interprete_argument_balise(1, $p); |
|
| 2257 | + if (!$_pipe) { |
|
| 2258 | + $err_b_s_a = array('zbug_balise_sans_argument', array('balise' => 'PIPELINE')); |
|
| 2259 | + erreur_squelette($err_b_s_a, $p); |
|
| 2260 | + } else { |
|
| 2261 | + $_flux = interprete_argument_balise(2, $p); |
|
| 2262 | + $_flux = $_flux ? $_flux : "''"; |
|
| 2263 | + $p->code = "pipeline( $_pipe , $_flux )"; |
|
| 2264 | + $p->interdire_scripts = false; |
|
| 2265 | + } |
|
| 2266 | 2266 | |
| 2267 | - return $p; |
|
| 2267 | + return $p; |
|
| 2268 | 2268 | } |
| 2269 | 2269 | |
| 2270 | 2270 | |
@@ -2289,10 +2289,10 @@ discard block |
||
| 2289 | 2289 | * Pile complétée par le code à générer |
| 2290 | 2290 | **/ |
| 2291 | 2291 | function balise_EDIT_dist($p) { |
| 2292 | - $p->code = "''"; |
|
| 2293 | - $p->interdire_scripts = false; |
|
| 2292 | + $p->code = "''"; |
|
| 2293 | + $p->interdire_scripts = false; |
|
| 2294 | 2294 | |
| 2295 | - return $p; |
|
| 2295 | + return $p; |
|
| 2296 | 2296 | } |
| 2297 | 2297 | |
| 2298 | 2298 | |
@@ -2315,11 +2315,11 @@ discard block |
||
| 2315 | 2315 | * Pile complétée par le code à générer |
| 2316 | 2316 | **/ |
| 2317 | 2317 | function balise_TOTAL_UNIQUE_dist($p) { |
| 2318 | - $_famille = interprete_argument_balise(1, $p); |
|
| 2319 | - $_famille = $_famille ? $_famille : "''"; |
|
| 2320 | - $p->code = "unique('', $_famille, true)"; |
|
| 2318 | + $_famille = interprete_argument_balise(1, $p); |
|
| 2319 | + $_famille = $_famille ? $_famille : "''"; |
|
| 2320 | + $p->code = "unique('', $_famille, true)"; |
|
| 2321 | 2321 | |
| 2322 | - return $p; |
|
| 2322 | + return $p; |
|
| 2323 | 2323 | } |
| 2324 | 2324 | |
| 2325 | 2325 | /** |
@@ -2342,19 +2342,19 @@ discard block |
||
| 2342 | 2342 | * Pile complétée par le code à générer |
| 2343 | 2343 | **/ |
| 2344 | 2344 | function balise_ARRAY_dist($p) { |
| 2345 | - $_code = array(); |
|
| 2346 | - $n = 1; |
|
| 2347 | - do { |
|
| 2348 | - $_key = interprete_argument_balise($n++, $p); |
|
| 2349 | - $_val = interprete_argument_balise($n++, $p); |
|
| 2350 | - if ($_key and $_val) { |
|
| 2351 | - $_code[] = "$_key => $_val"; |
|
| 2352 | - } |
|
| 2353 | - } while ($_key && $_val); |
|
| 2354 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2355 | - $p->interdire_scripts = false; |
|
| 2345 | + $_code = array(); |
|
| 2346 | + $n = 1; |
|
| 2347 | + do { |
|
| 2348 | + $_key = interprete_argument_balise($n++, $p); |
|
| 2349 | + $_val = interprete_argument_balise($n++, $p); |
|
| 2350 | + if ($_key and $_val) { |
|
| 2351 | + $_code[] = "$_key => $_val"; |
|
| 2352 | + } |
|
| 2353 | + } while ($_key && $_val); |
|
| 2354 | + $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2355 | + $p->interdire_scripts = false; |
|
| 2356 | 2356 | |
| 2357 | - return $p; |
|
| 2357 | + return $p; |
|
| 2358 | 2358 | } |
| 2359 | 2359 | |
| 2360 | 2360 | /** |
@@ -2373,15 +2373,15 @@ discard block |
||
| 2373 | 2373 | * Pile complétée par le code à générer |
| 2374 | 2374 | */ |
| 2375 | 2375 | function balise_LISTE_dist($p) { |
| 2376 | - $_code = array(); |
|
| 2377 | - $n = 1; |
|
| 2378 | - while ($_val = interprete_argument_balise($n++, $p)) { |
|
| 2379 | - $_code[] = $_val; |
|
| 2380 | - } |
|
| 2381 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2382 | - $p->interdire_scripts = false; |
|
| 2376 | + $_code = array(); |
|
| 2377 | + $n = 1; |
|
| 2378 | + while ($_val = interprete_argument_balise($n++, $p)) { |
|
| 2379 | + $_code[] = $_val; |
|
| 2380 | + } |
|
| 2381 | + $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2382 | + $p->interdire_scripts = false; |
|
| 2383 | 2383 | |
| 2384 | - return $p; |
|
| 2384 | + return $p; |
|
| 2385 | 2385 | } |
| 2386 | 2386 | |
| 2387 | 2387 | |
@@ -2415,19 +2415,19 @@ discard block |
||
| 2415 | 2415 | * Pile complétée par le code à générer |
| 2416 | 2416 | **/ |
| 2417 | 2417 | function balise_AUTORISER_dist($p) { |
| 2418 | - $_code = array(); |
|
| 2419 | - $p->descr['session'] = true; // faire un cache par session |
|
| 2418 | + $_code = array(); |
|
| 2419 | + $p->descr['session'] = true; // faire un cache par session |
|
| 2420 | 2420 | |
| 2421 | - $n = 1; |
|
| 2422 | - while ($_v = interprete_argument_balise($n++, $p)) { |
|
| 2423 | - $_code[] = $_v; |
|
| 2424 | - } |
|
| 2421 | + $n = 1; |
|
| 2422 | + while ($_v = interprete_argument_balise($n++, $p)) { |
|
| 2423 | + $_code[] = $_v; |
|
| 2424 | + } |
|
| 2425 | 2425 | |
| 2426 | - $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join(', ', |
|
| 2427 | - $_code) . ')?" ":"")'; |
|
| 2428 | - $p->interdire_scripts = false; |
|
| 2426 | + $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join(', ', |
|
| 2427 | + $_code) . ')?" ":"")'; |
|
| 2428 | + $p->interdire_scripts = false; |
|
| 2429 | 2429 | |
| 2430 | - return $p; |
|
| 2430 | + return $p; |
|
| 2431 | 2431 | } |
| 2432 | 2432 | |
| 2433 | 2433 | |
@@ -2451,15 +2451,15 @@ discard block |
||
| 2451 | 2451 | * Pile complétée par le code à générer |
| 2452 | 2452 | **/ |
| 2453 | 2453 | function balise_PLUGIN_dist($p) { |
| 2454 | - $plugin = interprete_argument_balise(1, $p); |
|
| 2455 | - $plugin = isset($plugin) ? str_replace('\'', '"', $plugin) : '""'; |
|
| 2456 | - $type_info = interprete_argument_balise(2, $p); |
|
| 2457 | - $type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"'; |
|
| 2454 | + $plugin = interprete_argument_balise(1, $p); |
|
| 2455 | + $plugin = isset($plugin) ? str_replace('\'', '"', $plugin) : '""'; |
|
| 2456 | + $type_info = interprete_argument_balise(2, $p); |
|
| 2457 | + $type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"'; |
|
| 2458 | 2458 | |
| 2459 | - $f = chercher_filtre('info_plugin'); |
|
| 2460 | - $p->code = $f . '(' . $plugin . ', ' . $type_info . ')'; |
|
| 2459 | + $f = chercher_filtre('info_plugin'); |
|
| 2460 | + $p->code = $f . '(' . $plugin . ', ' . $type_info . ')'; |
|
| 2461 | 2461 | |
| 2462 | - return $p; |
|
| 2462 | + return $p; |
|
| 2463 | 2463 | } |
| 2464 | 2464 | |
| 2465 | 2465 | /** |
@@ -2480,9 +2480,9 @@ discard block |
||
| 2480 | 2480 | * Pile complétée par le code à générer |
| 2481 | 2481 | **/ |
| 2482 | 2482 | function balise_AIDER_dist($p) { |
| 2483 | - $_motif = interprete_argument_balise(1, $p); |
|
| 2484 | - $p->code = "((\$aider=charger_fonction('aide','inc',true))?\$aider($_motif):'')"; |
|
| 2485 | - return $p; |
|
| 2483 | + $_motif = interprete_argument_balise(1, $p); |
|
| 2484 | + $p->code = "((\$aider=charger_fonction('aide','inc',true))?\$aider($_motif):'')"; |
|
| 2485 | + return $p; |
|
| 2486 | 2486 | } |
| 2487 | 2487 | |
| 2488 | 2488 | /** |
@@ -2508,16 +2508,16 @@ discard block |
||
| 2508 | 2508 | * Pile complétée par le code à générer |
| 2509 | 2509 | **/ |
| 2510 | 2510 | function balise_ACTION_FORMULAIRE($p) { |
| 2511 | - if (!$_url = interprete_argument_balise(1, $p)) { |
|
| 2512 | - $_url = "@\$Pile[0]['action']"; |
|
| 2513 | - } |
|
| 2514 | - if (!$_form = interprete_argument_balise(2, $p)) { |
|
| 2515 | - $_form = "@\$Pile[0]['form']"; |
|
| 2516 | - } |
|
| 2517 | - |
|
| 2518 | - // envoyer le nom du formulaire que l'on traite |
|
| 2519 | - // transmettre les eventuels args de la balise formulaire |
|
| 2520 | - $p->code = " '<span class=\"form-hidden\">' . |
|
| 2511 | + if (!$_url = interprete_argument_balise(1, $p)) { |
|
| 2512 | + $_url = "@\$Pile[0]['action']"; |
|
| 2513 | + } |
|
| 2514 | + if (!$_form = interprete_argument_balise(2, $p)) { |
|
| 2515 | + $_form = "@\$Pile[0]['form']"; |
|
| 2516 | + } |
|
| 2517 | + |
|
| 2518 | + // envoyer le nom du formulaire que l'on traite |
|
| 2519 | + // transmettre les eventuels args de la balise formulaire |
|
| 2520 | + $p->code = " '<span class=\"form-hidden\">' . |
|
| 2521 | 2521 | form_hidden($_url) . |
| 2522 | 2522 | '<input name=\'formulaire_action\' type=\'hidden\' |
| 2523 | 2523 | value=\'' . $_form . '\' />' . |
@@ -2526,9 +2526,9 @@ discard block |
||
| 2526 | 2526 | (!empty(\$Pile[0]['_hidden']) ? @\$Pile[0]['_hidden'] : '') . |
| 2527 | 2527 | '</span>'"; |
| 2528 | 2528 | |
| 2529 | - $p->interdire_scripts = false; |
|
| 2529 | + $p->interdire_scripts = false; |
|
| 2530 | 2530 | |
| 2531 | - return $p; |
|
| 2531 | + return $p; |
|
| 2532 | 2532 | } |
| 2533 | 2533 | |
| 2534 | 2534 | |
@@ -2569,25 +2569,25 @@ discard block |
||
| 2569 | 2569 | */ |
| 2570 | 2570 | function balise_BOUTON_ACTION_dist($p) { |
| 2571 | 2571 | |
| 2572 | - $args = array(); |
|
| 2573 | - for ($k = 1; $k <= 6; $k++) { |
|
| 2574 | - $_a = interprete_argument_balise($k, $p); |
|
| 2575 | - if (!$_a) { |
|
| 2576 | - $_a = "''"; |
|
| 2577 | - } |
|
| 2578 | - $args[] = $_a; |
|
| 2579 | - } |
|
| 2580 | - // supprimer les args vides |
|
| 2581 | - while (end($args) == "''" and count($args) > 2) { |
|
| 2582 | - array_pop($args); |
|
| 2583 | - } |
|
| 2584 | - $args = implode(",", $args); |
|
| 2572 | + $args = array(); |
|
| 2573 | + for ($k = 1; $k <= 6; $k++) { |
|
| 2574 | + $_a = interprete_argument_balise($k, $p); |
|
| 2575 | + if (!$_a) { |
|
| 2576 | + $_a = "''"; |
|
| 2577 | + } |
|
| 2578 | + $args[] = $_a; |
|
| 2579 | + } |
|
| 2580 | + // supprimer les args vides |
|
| 2581 | + while (end($args) == "''" and count($args) > 2) { |
|
| 2582 | + array_pop($args); |
|
| 2583 | + } |
|
| 2584 | + $args = implode(",", $args); |
|
| 2585 | 2585 | |
| 2586 | - $bouton_action = chercher_filtre("bouton_action"); |
|
| 2587 | - $p->code = "$bouton_action($args)"; |
|
| 2588 | - $p->interdire_scripts = false; |
|
| 2586 | + $bouton_action = chercher_filtre("bouton_action"); |
|
| 2587 | + $p->code = "$bouton_action($args)"; |
|
| 2588 | + $p->interdire_scripts = false; |
|
| 2589 | 2589 | |
| 2590 | - return $p; |
|
| 2590 | + return $p; |
|
| 2591 | 2591 | } |
| 2592 | 2592 | |
| 2593 | 2593 | |
@@ -2606,10 +2606,10 @@ discard block |
||
| 2606 | 2606 | * Pile complétée par le code à générer |
| 2607 | 2607 | */ |
| 2608 | 2608 | function balise_SLOGAN_SITE_SPIP_dist($p) { |
| 2609 | - $p->code = "\$GLOBALS['meta']['slogan_site']"; |
|
| 2609 | + $p->code = "\$GLOBALS['meta']['slogan_site']"; |
|
| 2610 | 2610 | |
| 2611 | - #$p->interdire_scripts = true; |
|
| 2612 | - return $p; |
|
| 2611 | + #$p->interdire_scripts = true; |
|
| 2612 | + return $p; |
|
| 2613 | 2613 | } |
| 2614 | 2614 | |
| 2615 | 2615 | |
@@ -2633,10 +2633,10 @@ discard block |
||
| 2633 | 2633 | * Pile complétée par le code à générer |
| 2634 | 2634 | */ |
| 2635 | 2635 | function balise_HTML5_dist($p) { |
| 2636 | - $p->code = html5_permis() ? "' '" : "''"; |
|
| 2637 | - $p->interdire_scripts = false; |
|
| 2636 | + $p->code = html5_permis() ? "' '" : "''"; |
|
| 2637 | + $p->interdire_scripts = false; |
|
| 2638 | 2638 | |
| 2639 | - return $p; |
|
| 2639 | + return $p; |
|
| 2640 | 2640 | } |
| 2641 | 2641 | |
| 2642 | 2642 | |
@@ -2662,61 +2662,61 @@ discard block |
||
| 2662 | 2662 | * Pile complétée par le code à générer |
| 2663 | 2663 | */ |
| 2664 | 2664 | function balise_TRI_dist($p, $liste = 'true') { |
| 2665 | - $b = index_boucle_mere($p); |
|
| 2666 | - // s'il n'y a pas de nom de boucle, on ne peut pas trier |
|
| 2667 | - if ($b === '') { |
|
| 2668 | - $msg = array('zbug_champ_hors_boucle', array('champ' => zbug_presenter_champ($p))); |
|
| 2669 | - erreur_squelette($msg, $p); |
|
| 2670 | - $p->code = "''"; |
|
| 2665 | + $b = index_boucle_mere($p); |
|
| 2666 | + // s'il n'y a pas de nom de boucle, on ne peut pas trier |
|
| 2667 | + if ($b === '') { |
|
| 2668 | + $msg = array('zbug_champ_hors_boucle', array('champ' => zbug_presenter_champ($p))); |
|
| 2669 | + erreur_squelette($msg, $p); |
|
| 2670 | + $p->code = "''"; |
|
| 2671 | 2671 | |
| 2672 | - return $p; |
|
| 2673 | - } |
|
| 2674 | - $boucle = $p->boucles[$b]; |
|
| 2672 | + return $p; |
|
| 2673 | + } |
|
| 2674 | + $boucle = $p->boucles[$b]; |
|
| 2675 | 2675 | |
| 2676 | - // s'il n'y a pas de tri_champ, c'est qu'on se trouve |
|
| 2677 | - // dans un boucle recursive ou qu'on a oublie le critere {tri} |
|
| 2678 | - if (!isset($boucle->modificateur['tri_champ'])) { |
|
| 2679 | - $msg = array('zbug_champ_hors_critere', array( |
|
| 2680 | - 'champ' => zbug_presenter_champ($p), |
|
| 2681 | - 'critere' => 'tri' |
|
| 2682 | - )); |
|
| 2683 | - erreur_squelette($msg, $p); |
|
| 2684 | - $p->code = "''"; |
|
| 2676 | + // s'il n'y a pas de tri_champ, c'est qu'on se trouve |
|
| 2677 | + // dans un boucle recursive ou qu'on a oublie le critere {tri} |
|
| 2678 | + if (!isset($boucle->modificateur['tri_champ'])) { |
|
| 2679 | + $msg = array('zbug_champ_hors_critere', array( |
|
| 2680 | + 'champ' => zbug_presenter_champ($p), |
|
| 2681 | + 'critere' => 'tri' |
|
| 2682 | + )); |
|
| 2683 | + erreur_squelette($msg, $p); |
|
| 2684 | + $p->code = "''"; |
|
| 2685 | 2685 | |
| 2686 | - return $p; |
|
| 2687 | - } |
|
| 2686 | + return $p; |
|
| 2687 | + } |
|
| 2688 | 2688 | |
| 2689 | - $_champ = interprete_argument_balise(1, $p); |
|
| 2690 | - // si pas de champ, renvoyer le critere de tri utilise |
|
| 2691 | - if (!$_champ) { |
|
| 2692 | - $p->code = $boucle->modificateur['tri_champ']; |
|
| 2689 | + $_champ = interprete_argument_balise(1, $p); |
|
| 2690 | + // si pas de champ, renvoyer le critere de tri utilise |
|
| 2691 | + if (!$_champ) { |
|
| 2692 | + $p->code = $boucle->modificateur['tri_champ']; |
|
| 2693 | 2693 | |
| 2694 | - return $p; |
|
| 2695 | - } |
|
| 2696 | - // forcer la jointure si besoin, et si le champ est statique |
|
| 2697 | - if (preg_match(",^'([\w.]+)'$,i", $_champ, $m)) { |
|
| 2698 | - index_pile($b, $m[1], $p->boucles, '', null, true, false); |
|
| 2699 | - } |
|
| 2694 | + return $p; |
|
| 2695 | + } |
|
| 2696 | + // forcer la jointure si besoin, et si le champ est statique |
|
| 2697 | + if (preg_match(",^'([\w.]+)'$,i", $_champ, $m)) { |
|
| 2698 | + index_pile($b, $m[1], $p->boucles, '', null, true, false); |
|
| 2699 | + } |
|
| 2700 | 2700 | |
| 2701 | - $_libelle = interprete_argument_balise(2, $p); |
|
| 2702 | - $_libelle = $_libelle ? $_libelle : $_champ; |
|
| 2701 | + $_libelle = interprete_argument_balise(2, $p); |
|
| 2702 | + $_libelle = $_libelle ? $_libelle : $_champ; |
|
| 2703 | 2703 | |
| 2704 | - $_class = interprete_argument_balise(3, $p); |
|
| 2705 | - // si champ = ">" c'est un lien vers le tri croissant : de gauche a droite ==> 1 |
|
| 2706 | - // si champ = "<" c'est un lien vers le tri decroissant : (sens inverse) == -1 |
|
| 2707 | - $_issens = "in_array($_champ,array('>','<'))"; |
|
| 2708 | - $_sens = "(strpos('< >',$_champ)-1)"; |
|
| 2704 | + $_class = interprete_argument_balise(3, $p); |
|
| 2705 | + // si champ = ">" c'est un lien vers le tri croissant : de gauche a droite ==> 1 |
|
| 2706 | + // si champ = "<" c'est un lien vers le tri decroissant : (sens inverse) == -1 |
|
| 2707 | + $_issens = "in_array($_champ,array('>','<'))"; |
|
| 2708 | + $_sens = "(strpos('< >',$_champ)-1)"; |
|
| 2709 | 2709 | |
| 2710 | - $_variable = "((\$s=$_issens)?'sens':'tri')." . $boucle->modificateur['tri_nom']; |
|
| 2711 | - $_url = "parametre_url(self(),$_variable,\$s?$_sens:$_champ)"; |
|
| 2712 | - $_url = "parametre_url($_url,'var_memotri',strncmp(" . $boucle->modificateur['tri_nom'] . ",'session',7)==0?$_variable:'')"; |
|
| 2713 | - $_on = "\$s?(" . $boucle->modificateur['tri_sens'] . "==$_sens" . '):(' . $boucle->modificateur['tri_champ'] . "==$_champ)"; |
|
| 2710 | + $_variable = "((\$s=$_issens)?'sens':'tri')." . $boucle->modificateur['tri_nom']; |
|
| 2711 | + $_url = "parametre_url(self(),$_variable,\$s?$_sens:$_champ)"; |
|
| 2712 | + $_url = "parametre_url($_url,'var_memotri',strncmp(" . $boucle->modificateur['tri_nom'] . ",'session',7)==0?$_variable:'')"; |
|
| 2713 | + $_on = "\$s?(" . $boucle->modificateur['tri_sens'] . "==$_sens" . '):(' . $boucle->modificateur['tri_champ'] . "==$_champ)"; |
|
| 2714 | 2714 | |
| 2715 | - $p->code = "lien_ou_expose($_url,$_libelle,$_on" . ($_class ? ",$_class" : "") . ")"; |
|
| 2716 | - //$p->code = "''"; |
|
| 2717 | - $p->interdire_scripts = false; |
|
| 2715 | + $p->code = "lien_ou_expose($_url,$_libelle,$_on" . ($_class ? ",$_class" : "") . ")"; |
|
| 2716 | + //$p->code = "''"; |
|
| 2717 | + $p->interdire_scripts = false; |
|
| 2718 | 2718 | |
| 2719 | - return $p; |
|
| 2719 | + return $p; |
|
| 2720 | 2720 | } |
| 2721 | 2721 | |
| 2722 | 2722 | |
@@ -2737,22 +2737,22 @@ discard block |
||
| 2737 | 2737 | * Pile complétée par le code à générer |
| 2738 | 2738 | */ |
| 2739 | 2739 | function balise_SAUTER_dist($p) { |
| 2740 | - $id_boucle = $p->id_boucle; |
|
| 2740 | + $id_boucle = $p->id_boucle; |
|
| 2741 | 2741 | |
| 2742 | - if (empty($p->boucles[$id_boucle])) { |
|
| 2743 | - $msg = array('zbug_champ_hors_boucle', array('champ' => '#SAUTER')); |
|
| 2744 | - erreur_squelette($msg, $p); |
|
| 2745 | - } else { |
|
| 2746 | - $boucle = $p->boucles[$id_boucle]; |
|
| 2747 | - $_saut = interprete_argument_balise(1, $p); |
|
| 2748 | - $_compteur = "\$Numrows['$id_boucle']['compteur_boucle']"; |
|
| 2749 | - $_total = "\$Numrows['$id_boucle']['total']"; |
|
| 2742 | + if (empty($p->boucles[$id_boucle])) { |
|
| 2743 | + $msg = array('zbug_champ_hors_boucle', array('champ' => '#SAUTER')); |
|
| 2744 | + erreur_squelette($msg, $p); |
|
| 2745 | + } else { |
|
| 2746 | + $boucle = $p->boucles[$id_boucle]; |
|
| 2747 | + $_saut = interprete_argument_balise(1, $p); |
|
| 2748 | + $_compteur = "\$Numrows['$id_boucle']['compteur_boucle']"; |
|
| 2749 | + $_total = "\$Numrows['$id_boucle']['total']"; |
|
| 2750 | 2750 | |
| 2751 | - $p->code = "vide($_compteur=\$iter->skip($_saut,$_total))"; |
|
| 2752 | - } |
|
| 2753 | - $p->interdire_scripts = false; |
|
| 2751 | + $p->code = "vide($_compteur=\$iter->skip($_saut,$_total))"; |
|
| 2752 | + } |
|
| 2753 | + $p->interdire_scripts = false; |
|
| 2754 | 2754 | |
| 2755 | - return $p; |
|
| 2755 | + return $p; |
|
| 2756 | 2756 | } |
| 2757 | 2757 | |
| 2758 | 2758 | |
@@ -2774,22 +2774,22 @@ discard block |
||
| 2774 | 2774 | * Pile complétée par le code à générer |
| 2775 | 2775 | */ |
| 2776 | 2776 | function balise_PUBLIE_dist($p) { |
| 2777 | - if (!$_type = interprete_argument_balise(1, $p)) { |
|
| 2778 | - $_type = _q($p->type_requete); |
|
| 2779 | - $_id = champ_sql($p->boucles[$p->id_boucle]->primary, $p); |
|
| 2780 | - } else { |
|
| 2781 | - $_id = interprete_argument_balise(2, $p); |
|
| 2782 | - } |
|
| 2777 | + if (!$_type = interprete_argument_balise(1, $p)) { |
|
| 2778 | + $_type = _q($p->type_requete); |
|
| 2779 | + $_id = champ_sql($p->boucles[$p->id_boucle]->primary, $p); |
|
| 2780 | + } else { |
|
| 2781 | + $_id = interprete_argument_balise(2, $p); |
|
| 2782 | + } |
|
| 2783 | 2783 | |
| 2784 | - $connect = ''; |
|
| 2785 | - if (isset($p->boucles[$p->id_boucle])) { |
|
| 2786 | - $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2787 | - } |
|
| 2784 | + $connect = ''; |
|
| 2785 | + if (isset($p->boucles[$p->id_boucle])) { |
|
| 2786 | + $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
|
| 2787 | + } |
|
| 2788 | 2788 | |
| 2789 | - $p->code = "(objet_test_si_publie(" . $_type . ",intval(" . $_id . ")," . _q($connect) . ")?' ':'')"; |
|
| 2790 | - $p->interdire_scripts = false; |
|
| 2789 | + $p->code = "(objet_test_si_publie(" . $_type . ",intval(" . $_id . ")," . _q($connect) . ")?' ':'')"; |
|
| 2790 | + $p->interdire_scripts = false; |
|
| 2791 | 2791 | |
| 2792 | - return $p; |
|
| 2792 | + return $p; |
|
| 2793 | 2793 | } |
| 2794 | 2794 | |
| 2795 | 2795 | /** |
@@ -2818,12 +2818,12 @@ discard block |
||
| 2818 | 2818 | * Pile complétée par le code à générer |
| 2819 | 2819 | */ |
| 2820 | 2820 | function balise_PRODUIRE_dist($p) { |
| 2821 | - $balise_inclure = charger_fonction('INCLURE', 'balise'); |
|
| 2822 | - $p = $balise_inclure($p); |
|
| 2821 | + $balise_inclure = charger_fonction('INCLURE', 'balise'); |
|
| 2822 | + $p = $balise_inclure($p); |
|
| 2823 | 2823 | |
| 2824 | - $p->code = str_replace('recuperer_fond(', 'produire_fond_statique(', $p->code); |
|
| 2824 | + $p->code = str_replace('recuperer_fond(', 'produire_fond_statique(', $p->code); |
|
| 2825 | 2825 | |
| 2826 | - return $p; |
|
| 2826 | + return $p; |
|
| 2827 | 2827 | } |
| 2828 | 2828 | |
| 2829 | 2829 | /** |
@@ -2842,13 +2842,13 @@ discard block |
||
| 2842 | 2842 | * Pile complétée par le code à générer |
| 2843 | 2843 | */ |
| 2844 | 2844 | function balise_LARGEUR_ECRAN_dist($p) { |
| 2845 | - $_class = interprete_argument_balise(1, $p); |
|
| 2846 | - if (!$_class) { |
|
| 2847 | - $_class = 'null'; |
|
| 2848 | - } |
|
| 2849 | - $p->code = "(is_string($_class)?vide(\$GLOBALS['largeur_ecran']=$_class):(isset(\$GLOBALS['largeur_ecran'])?\$GLOBALS['largeur_ecran']:''))"; |
|
| 2845 | + $_class = interprete_argument_balise(1, $p); |
|
| 2846 | + if (!$_class) { |
|
| 2847 | + $_class = 'null'; |
|
| 2848 | + } |
|
| 2849 | + $p->code = "(is_string($_class)?vide(\$GLOBALS['largeur_ecran']=$_class):(isset(\$GLOBALS['largeur_ecran'])?\$GLOBALS['largeur_ecran']:''))"; |
|
| 2850 | 2850 | |
| 2851 | - return $p; |
|
| 2851 | + return $p; |
|
| 2852 | 2852 | } |
| 2853 | 2853 | |
| 2854 | 2854 | |
@@ -2864,14 +2864,14 @@ discard block |
||
| 2864 | 2864 | * Pile complétée par le code à générer |
| 2865 | 2865 | **/ |
| 2866 | 2866 | function balise_CONST_dist($p) { |
| 2867 | - $_const = interprete_argument_balise(1, $p); |
|
| 2868 | - if (!strlen($_const)) { |
|
| 2869 | - $p->code = "''"; |
|
| 2870 | - } |
|
| 2871 | - else { |
|
| 2872 | - $p->code = "(defined($_const)?constant($_const):'')"; |
|
| 2873 | - } |
|
| 2874 | - $p->interdire_scripts = false; |
|
| 2875 | - |
|
| 2876 | - return $p; |
|
| 2867 | + $_const = interprete_argument_balise(1, $p); |
|
| 2868 | + if (!strlen($_const)) { |
|
| 2869 | + $p->code = "''"; |
|
| 2870 | + } |
|
| 2871 | + else { |
|
| 2872 | + $p->code = "(defined($_const)?constant($_const):'')"; |
|
| 2873 | + } |
|
| 2874 | + $p->interdire_scripts = false; |
|
| 2875 | + |
|
| 2876 | + return $p; |
|
| 2877 | 2877 | } |