@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | if ($s = trouver_nom_serveur_distant($p)) { |
| 77 | 77 | |
| 78 | 78 | // si une fonction de generation des url a ete definie pour ce connect l'utiliser |
| 79 | - if (function_exists($f = 'generer_generer_url_' . $s)) { |
|
| 79 | + if (function_exists($f = 'generer_generer_url_'.$s)) { |
|
| 80 | 80 | return $f($type, $_id, $s); |
| 81 | 81 | } |
| 82 | 82 | if (!$GLOBALS['connexions'][strtolower($s)]['spip_connect_version']) { |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | # exception des urls de documents sur un serveur distant... |
| 87 | 87 | if ($type == 'document') { |
| 88 | 88 | return |
| 89 | - "quete_meta('adresse_site', $s) . '/' .\n\t" . |
|
| 90 | - "quete_meta('dir_img', $s) . \n\t" . |
|
| 89 | + "quete_meta('adresse_site', $s) . '/' .\n\t". |
|
| 90 | + "quete_meta('dir_img', $s) . \n\t". |
|
| 91 | 91 | "quete_fichier($_id,$s)"; |
| 92 | 92 | } |
| 93 | 93 | $s = ", '', '', $s, quete_meta('type_urls', $s)"; |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | */ |
| 232 | 232 | function balise_URL_SITE_SPIP_dist($p) { |
| 233 | 233 | $p->code = "sinon(\$GLOBALS['meta']['adresse_site'],'.')"; |
| 234 | - $p->code = "spip_htmlspecialchars(" . $p->code . ")"; |
|
| 234 | + $p->code = "spip_htmlspecialchars(".$p->code.")"; |
|
| 235 | 235 | $p->interdire_scripts = false; |
| 236 | 236 | |
| 237 | 237 | return $p; |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | if ($s = trouver_nom_serveur_distant($p)) { |
| 273 | 273 | // si une fonction de generation des url a ete definie pour ce connect l'utiliser |
| 274 | 274 | // elle devra aussi traiter le cas derogatoire type=page |
| 275 | - if (function_exists($f = 'generer_generer_url_' . $s)) { |
|
| 275 | + if (function_exists($f = 'generer_generer_url_'.$s)) { |
|
| 276 | 276 | if ($args and $args !== "''") { |
| 277 | 277 | $code .= ", $args"; |
| 278 | 278 | } |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | $p->code = $code; |
| 281 | 281 | return $p; |
| 282 | 282 | } |
| 283 | - $s = 'connect=' . addslashes($s); |
|
| 283 | + $s = 'connect='.addslashes($s); |
|
| 284 | 284 | $args = (($args and $args !== "''") ? "$args . '&$s'" : "'$s'"); |
| 285 | 285 | } |
| 286 | 286 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | $code = "generer_url_public($code, $args$noentities)"; |
| 296 | 296 | } |
| 297 | 297 | $p->code = $code; |
| 298 | - spip_log("Calcul url page : connect vaut $s ca donne :" . $p->code . " args $args", _LOG_INFO); |
|
| 298 | + spip_log("Calcul url page : connect vaut $s ca donne :".$p->code." args $args", _LOG_INFO); |
|
| 299 | 299 | |
| 300 | 300 | #$p->interdire_scripts = true; |
| 301 | 301 | return $p; |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | $fonc .= ",$args$noentities"; |
| 340 | 340 | } |
| 341 | 341 | } |
| 342 | - $p->code = 'generer_url_ecrire(' . $fonc . ')'; |
|
| 342 | + $p->code = 'generer_url_ecrire('.$fonc.')'; |
|
| 343 | 343 | $p->interdire_scripts = false; |
| 344 | 344 | |
| 345 | 345 | return $p; |
@@ -374,17 +374,17 @@ discard block |
||
| 374 | 374 | |
| 375 | 375 | $args = interprete_argument_balise(2, $p); |
| 376 | 376 | if ($args != "''" && $args !== null) { |
| 377 | - $p->code .= "," . $args; |
|
| 377 | + $p->code .= ",".$args; |
|
| 378 | 378 | } |
| 379 | 379 | $redirect = interprete_argument_balise(3, $p); |
| 380 | 380 | if ($redirect != "''" && $redirect !== null) { |
| 381 | 381 | if ($args == "''" || $args === null) { |
| 382 | 382 | $p->code .= ",''"; |
| 383 | 383 | } |
| 384 | - $p->code .= "," . $redirect; |
|
| 384 | + $p->code .= ",".$redirect; |
|
| 385 | 385 | } |
| 386 | 386 | |
| 387 | - $p->code = "generer_action_auteur(" . $p->code . ")"; |
|
| 387 | + $p->code = "generer_action_auteur(".$p->code.")"; |
|
| 388 | 388 | $p->interdire_scripts = false; |
| 389 | 389 | |
| 390 | 390 | return $p; |
@@ -134,7 +134,7 @@ discard block |
||
| 134 | 134 | |
| 135 | 135 | // Si on est connecte, appeler traiter() |
| 136 | 136 | // et lancer la redirection si besoin |
| 137 | - if (!$valeurs['editable'] and $loge and _request('formulaire_action')!=='login') { |
|
| 137 | + if (!$valeurs['editable'] and $loge and _request('formulaire_action') !== 'login') { |
|
| 138 | 138 | $traiter = charger_fonction('traiter', 'formulaires/login'); |
| 139 | 139 | $res = $traiter($cible, $login, $prive); |
| 140 | 140 | $valeurs = array_merge($valeurs, $res); |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | # preparer un lien pour quand redirige_formulaire ne fonctionne pas |
| 145 | 145 | $m = redirige_formulaire($res['redirect']); |
| 146 | 146 | $valeurs['_deja_loge'] = inserer_attribut( |
| 147 | - '<a>' . _T('login_par_ici') . "</a>$m", |
|
| 147 | + '<a>'._T('login_par_ici')."</a>$m", |
|
| 148 | 148 | 'href', |
| 149 | 149 | $res['redirect'] |
| 150 | 150 | ); |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | function login_autoriser() { |
| 291 | 291 | include_spip('inc/autoriser'); |
| 292 | 292 | if (!autoriser('ecrire')) { |
| 293 | - $h = generer_url_action('logout', 'logout=prive&url=' . urlencode(self())); |
|
| 293 | + $h = generer_url_action('logout', 'logout=prive&url='.urlencode(self())); |
|
| 294 | 294 | |
| 295 | 295 | return array( |
| 296 | 296 | 'message_erreur' => '<h1>' |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | . '</h1><p>' |
| 299 | 299 | . _T('texte_erreur_visiteur') |
| 300 | 300 | . "</p><p class='retour'>[<a href='$h'>" |
| 301 | - . _T('icone_deconnecter') . '</a>]</p>' |
|
| 301 | + . _T('icone_deconnecter').'</a>]</p>' |
|
| 302 | 302 | ); |
| 303 | 303 | } |
| 304 | 304 | |
@@ -350,7 +350,7 @@ discard block |
||
| 350 | 350 | // transformer la cible absolue en cible relative |
| 351 | 351 | // pour pas echouer quand la meta adresse_site est foireuse |
| 352 | 352 | if (strncmp($cible, $u = url_de_base(), strlen($u)) == 0) { |
| 353 | - $cible = './' . substr($cible, strlen($u)); |
|
| 353 | + $cible = './'.substr($cible, strlen($u)); |
|
| 354 | 354 | } elseif (tester_url_absolue($cible) and !defined('_AUTORISER_LOGIN_ABS_REDIRECT')) { |
| 355 | 355 | // si c'est une url absolue, refuser la redirection |
| 356 | 356 | // sauf si cette securite est levee volontairement par le webmestre |
@@ -362,7 +362,7 @@ discard block |
||
| 362 | 362 | if ($cible and ($cible != self('&')) and ($cible != self())) { |
| 363 | 363 | $res['redirect'] = $cible; |
| 364 | 364 | $res['message_ok'] = inserer_attribut( |
| 365 | - '<a>' . _T('login_par_ici') . '</a>', |
|
| 365 | + '<a>'._T('login_par_ici').'</a>', |
|
| 366 | 366 | 'href', |
| 367 | 367 | $cible |
| 368 | 368 | ); |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | // mais apres la fonction autoriser() |
| 115 | 115 | if ($f = find_in_path('mes_fonctions.php')) { |
| 116 | 116 | global $dossier_squelettes; |
| 117 | - include_once(_ROOT_CWD . $f); |
|
| 117 | + include_once(_ROOT_CWD.$f); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | $qui = $GLOBALS['visiteur_session'] ? $GLOBALS['visiteur_session'] : array(); |
| 149 | 149 | $qui = array_merge(array('statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'), $qui); |
| 150 | 150 | } elseif (is_numeric($qui)) { |
| 151 | - $qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui); |
|
| 151 | + $qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur='.$qui); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | // Admins restreints, on construit ici (pas generique mais...) |
@@ -158,8 +158,8 @@ discard block |
||
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | spip_log( |
| 161 | - "autoriser $faire $type $id (" . (isset($qui['nom']) ? $qui['nom'] : '') . ') ?', |
|
| 162 | - 'autoriser' . _LOG_DEBUG |
|
| 161 | + "autoriser $faire $type $id (".(isset($qui['nom']) ? $qui['nom'] : '').') ?', |
|
| 162 | + 'autoriser'._LOG_DEBUG |
|
| 163 | 163 | ); |
| 164 | 164 | |
| 165 | 165 | // passer par objet_type pour avoir les alias |
@@ -170,7 +170,7 @@ discard block |
||
| 170 | 170 | if ((isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) and autoriser_exception($faire, $type, $id, 'verifier')) |
| 171 | 171 | or (isset($GLOBALS['autoriser_exception'][$faire][$type]['*']) and autoriser_exception($faire, $type, '*', 'verifier')) |
| 172 | 172 | ) { |
| 173 | - spip_log("autoriser ($faire, $type, $id, " . (isset($qui['nom']) ? $qui['nom'] : '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG); |
|
| 173 | + spip_log("autoriser ($faire, $type, $id, ".(isset($qui['nom']) ? $qui['nom'] : '').') : OK Exception', 'autoriser'._LOG_DEBUG); |
|
| 174 | 174 | return true; |
| 175 | 175 | } |
| 176 | 176 | |
@@ -179,18 +179,18 @@ discard block |
||
| 179 | 179 | // autoriser_faire[_dist], autoriser_defaut[_dist] |
| 180 | 180 | $fonctions = $type |
| 181 | 181 | ? array( |
| 182 | - 'autoriser_' . $type . '_' . $faire, |
|
| 183 | - 'autoriser_' . $type . '_' . $faire . '_dist', |
|
| 184 | - 'autoriser_' . $type, |
|
| 185 | - 'autoriser_' . $type . '_dist', |
|
| 186 | - 'autoriser_' . $faire, |
|
| 187 | - 'autoriser_' . $faire . '_dist', |
|
| 182 | + 'autoriser_'.$type.'_'.$faire, |
|
| 183 | + 'autoriser_'.$type.'_'.$faire.'_dist', |
|
| 184 | + 'autoriser_'.$type, |
|
| 185 | + 'autoriser_'.$type.'_dist', |
|
| 186 | + 'autoriser_'.$faire, |
|
| 187 | + 'autoriser_'.$faire.'_dist', |
|
| 188 | 188 | 'autoriser_defaut', |
| 189 | 189 | 'autoriser_defaut_dist' |
| 190 | 190 | ) |
| 191 | 191 | : array( |
| 192 | - 'autoriser_' . $faire, |
|
| 193 | - 'autoriser_' . $faire . '_dist', |
|
| 192 | + 'autoriser_'.$faire, |
|
| 193 | + 'autoriser_'.$faire.'_dist', |
|
| 194 | 194 | 'autoriser_defaut', |
| 195 | 195 | 'autoriser_defaut_dist' |
| 196 | 196 | ); |
@@ -203,8 +203,8 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | spip_log( |
| 206 | - "$f($faire, $type, $id, " . (isset($qui['nom']) ? $qui['nom'] : '') . ') : ' . ($a ? 'OK' : 'niet'), |
|
| 207 | - 'autoriser' . _LOG_DEBUG |
|
| 206 | + "$f($faire, $type, $id, ".(isset($qui['nom']) ? $qui['nom'] : '').') : '.($a ? 'OK' : 'niet'), |
|
| 207 | + 'autoriser'._LOG_DEBUG |
|
| 208 | 208 | ); |
| 209 | 209 | |
| 210 | 210 | return $a; |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | function autoriser_previsualiser_dist($faire, $type, $id, $qui, $opt) { |
| 333 | 333 | |
| 334 | 334 | // Le visiteur a-t-il un statut prevu par la config ? |
| 335 | - if (strpos($GLOBALS['meta']['preview'], ',' . $qui['statut'] . ',') !== false) { |
|
| 335 | + if (strpos($GLOBALS['meta']['preview'], ','.$qui['statut'].',') !== false) { |
|
| 336 | 336 | return test_previsualiser_objet_champ($type, $id, $qui, $opt); |
| 337 | 337 | } |
| 338 | 338 | |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | } // pas de champ passe a la demande => NIET |
| 390 | 390 | $previsu = explode(',', $c['previsu']); |
| 391 | 391 | // regarder si ce statut est autorise pour l'auteur |
| 392 | - if (in_array($opt[$champ] . '/auteur', $previsu)) { |
|
| 392 | + if (in_array($opt[$champ].'/auteur', $previsu)) { |
|
| 393 | 393 | |
| 394 | 394 | // retrouver l’id_auteur qui a filé un lien de prévisu éventuellement, |
| 395 | 395 | // sinon l’auteur en session |
@@ -404,11 +404,11 @@ discard block |
||
| 404 | 404 | |
| 405 | 405 | if (!$id_auteur) { |
| 406 | 406 | return false; |
| 407 | - } elseif(autoriser('previsualiser' . $opt[$champ], $type, '', $id_auteur)) { |
|
| 407 | + } elseif (autoriser('previsualiser'.$opt[$champ], $type, '', $id_auteur)) { |
|
| 408 | 408 | // dans ce cas (admin en general), pas de filtrage sur ce statut |
| 409 | 409 | } elseif (!sql_countsel( |
| 410 | 410 | 'spip_auteurs_liens', |
| 411 | - 'id_auteur=' . intval($id_auteur) . ' AND objet=' . sql_quote($type) . ' AND id_objet=' . intval($id) |
|
| 411 | + 'id_auteur='.intval($id_auteur).' AND objet='.sql_quote($type).' AND id_objet='.intval($id) |
|
| 412 | 412 | )) { |
| 413 | 413 | return false; |
| 414 | 414 | } // pas auteur de cet objet => NIET |
@@ -446,16 +446,16 @@ discard block |
||
| 446 | 446 | // multilinguisme par secteur et objet rattaché à une rubrique |
| 447 | 447 | $primary = id_table_objet($type); |
| 448 | 448 | if ($table != 'spip_rubriques') { |
| 449 | - $id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=" . intval($id)); |
|
| 449 | + $id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=".intval($id)); |
|
| 450 | 450 | } else { |
| 451 | 451 | $id_rubrique = $id; |
| 452 | 452 | } |
| 453 | - $id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 453 | + $id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique='.intval($id_rubrique)); |
|
| 454 | 454 | if (!$id_secteur > 0) { |
| 455 | 455 | $id_secteur = $id_rubrique; |
| 456 | 456 | } |
| 457 | - $langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_secteur)); |
|
| 458 | - $langue_objet = sql_getfetsel('lang', "$table", "$primary=" . intval($id)); |
|
| 457 | + $langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique='.intval($id_secteur)); |
|
| 458 | + $langue_objet = sql_getfetsel('lang', "$table", "$primary=".intval($id)); |
|
| 459 | 459 | if ($langue_secteur != $langue_objet) { |
| 460 | 460 | // configuration incohérente, on laisse l'utilisateur corriger la situation |
| 461 | 461 | return true; |
@@ -463,7 +463,7 @@ discard block |
||
| 463 | 463 | if ($table != 'spip_rubriques') { // le choix de la langue se fait seulement sur les rubriques |
| 464 | 464 | return false; |
| 465 | 465 | } else { |
| 466 | - $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id)); |
|
| 466 | + $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique='.intval($id)); |
|
| 467 | 467 | if ($id_parent != 0) { |
| 468 | 468 | // sous-rubriques : pas de choix de langue |
| 469 | 469 | return false; |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | |
| 512 | 512 | if (!isset($opt['statut'])) { |
| 513 | 513 | if (isset($desc['field']['statut'])) { |
| 514 | - $statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . intval($id)); |
|
| 514 | + $statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type).'='.intval($id)); |
|
| 515 | 515 | } else { |
| 516 | 516 | $statut = 'publie'; |
| 517 | 517 | } // pas de statut => publie |
@@ -669,11 +669,11 @@ discard block |
||
| 669 | 669 | return false; |
| 670 | 670 | } |
| 671 | 671 | |
| 672 | - if (sql_countsel('spip_rubriques', 'id_parent=' . intval($id))) { |
|
| 672 | + if (sql_countsel('spip_rubriques', 'id_parent='.intval($id))) { |
|
| 673 | 673 | return false; |
| 674 | 674 | } |
| 675 | 675 | |
| 676 | - if (sql_countsel('spip_articles', 'id_rubrique=' . intval($id) . " AND (statut<>'poubelle')")) { |
|
| 676 | + if (sql_countsel('spip_articles', 'id_rubrique='.intval($id)." AND (statut<>'poubelle')")) { |
|
| 677 | 677 | return false; |
| 678 | 678 | } |
| 679 | 679 | |
@@ -705,7 +705,7 @@ discard block |
||
| 705 | 705 | * @return bool true s'il a le droit, false sinon |
| 706 | 706 | **/ |
| 707 | 707 | function autoriser_article_modifier_dist($faire, $type, $id, $qui, $opt) { |
| 708 | - $r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article=' . sql_quote($id)); |
|
| 708 | + $r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article='.sql_quote($id)); |
|
| 709 | 709 | |
| 710 | 710 | return |
| 711 | 711 | $r |
@@ -716,7 +716,7 @@ discard block |
||
| 716 | 716 | (!isset($opt['statut']) or $opt['statut'] !== 'publie') |
| 717 | 717 | and in_array($qui['statut'], array('0minirezo', '1comite')) |
| 718 | 718 | and in_array($r['statut'], array('prop', 'prepa', 'poubelle')) |
| 719 | - and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']) |
|
| 719 | + and auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur']) |
|
| 720 | 720 | ) |
| 721 | 721 | ); |
| 722 | 722 | } |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | if (!$id) { |
| 765 | 765 | return false; |
| 766 | 766 | } |
| 767 | - $statut = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id)); |
|
| 767 | + $statut = sql_getfetsel('statut', 'spip_articles', 'id_article='.intval($id)); |
|
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | return |
@@ -775,7 +775,7 @@ discard block |
||
| 775 | 775 | or |
| 776 | 776 | ($id |
| 777 | 777 | and $qui['id_auteur'] |
| 778 | - and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur'])); |
|
| 778 | + and auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur'])); |
|
| 779 | 779 | } |
| 780 | 780 | |
| 781 | 781 | |
@@ -793,8 +793,8 @@ discard block |
||
| 793 | 793 | **/ |
| 794 | 794 | function autoriser_voir_dist($faire, $type, $id, $qui, $opt) { |
| 795 | 795 | # securite, mais on aurait pas du arriver ici ! |
| 796 | - if (function_exists($f = 'autoriser_' . $type . '_voir') |
|
| 797 | - or function_exists($f = 'autoriser_' . $type . '_voir_dist')) { |
|
| 796 | + if (function_exists($f = 'autoriser_'.$type.'_voir') |
|
| 797 | + or function_exists($f = 'autoriser_'.$type.'_voir_dist')) { |
|
| 798 | 798 | return $f($faire, $type, $id, $qui, $opt); |
| 799 | 799 | } |
| 800 | 800 | |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | $n = sql_fetsel( |
| 913 | 913 | 'A.id_article', |
| 914 | 914 | 'spip_auteurs_liens AS L LEFT JOIN spip_articles AS A ON (L.objet=\'article\' AND L.id_objet=A.id_article)', |
| 915 | - "A.statut='publie' AND L.id_auteur=" . sql_quote($id) |
|
| 915 | + "A.statut='publie' AND L.id_auteur=".sql_quote($id) |
|
| 916 | 916 | ); |
| 917 | 917 | |
| 918 | 918 | return $n ? true : false; |
@@ -1118,7 +1118,7 @@ discard block |
||
| 1118 | 1118 | and $r = sql_allfetsel( |
| 1119 | 1119 | 'id_objet', |
| 1120 | 1120 | 'spip_auteurs_liens', |
| 1121 | - 'id_auteur=' . intval($id_auteur) . " AND objet='rubrique' AND id_objet!=0" |
|
| 1121 | + 'id_auteur='.intval($id_auteur)." AND objet='rubrique' AND id_objet!=0" |
|
| 1122 | 1122 | ) |
| 1123 | 1123 | and count($r) |
| 1124 | 1124 | ) { |
@@ -1733,8 +1733,8 @@ discard block |
||
| 1733 | 1733 | function auteurs_objet($objet, $id_objet, $cond = '') { |
| 1734 | 1734 | $objet = objet_type($objet); |
| 1735 | 1735 | $where = array( |
| 1736 | - 'objet=' . sql_quote($objet), |
|
| 1737 | - 'id_objet=' . intval($id_objet) |
|
| 1736 | + 'objet='.sql_quote($objet), |
|
| 1737 | + 'id_objet='.intval($id_objet) |
|
| 1738 | 1738 | ); |
| 1739 | 1739 | if (!empty($cond)) { |
| 1740 | 1740 | if (is_array($cond)) { |
@@ -1768,7 +1768,7 @@ discard block |
||
| 1768 | 1768 | return sql_allfetsel( |
| 1769 | 1769 | 'id_auteur', |
| 1770 | 1770 | 'spip_auteurs_liens', |
| 1771 | - "objet='article' AND id_objet=" . intval($id_article) . ($cond ? " AND $cond" : '') |
|
| 1771 | + "objet='article' AND id_objet=".intval($id_article).($cond ? " AND $cond" : '') |
|
| 1772 | 1772 | ); |
| 1773 | 1773 | } |
| 1774 | 1774 | |
@@ -51,9 +51,9 @@ discard block |
||
| 51 | 51 | */ |
| 52 | 52 | function optimiser_caches_contextes() { |
| 53 | 53 | sous_repertoire(_DIR_CACHE, 'contextes'); |
| 54 | - if (is_dir( $d = _DIR_CACHE . 'contextes')) { |
|
| 54 | + if (is_dir($d = _DIR_CACHE.'contextes')) { |
|
| 55 | 55 | include_spip('inc/invalideur'); |
| 56 | - purger_repertoire($d, ['mtime' => time() - 48*24*3600, 'limit' => 10000]); |
|
| 56 | + purger_repertoire($d, ['mtime' => time() - 48 * 24 * 3600, 'limit' => 10000]); |
|
| 57 | 57 | } |
| 58 | 58 | } |
| 59 | 59 | |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | sql_free($sel); |
| 141 | 141 | |
| 142 | 142 | if ($in) { |
| 143 | - sql_delete($table, sql_in($id, array_keys($in)) . ($and ? " AND $and" : '')); |
|
| 144 | - spip_log("optimiser_sansref: Numeros des entrees $id supprimees dans la table $table: " . implode(', ', array_keys($in)), 'genie'._LOG_DEBUG); |
|
| 143 | + sql_delete($table, sql_in($id, array_keys($in)).($and ? " AND $and" : '')); |
|
| 144 | + spip_log("optimiser_sansref: Numeros des entrees $id supprimees dans la table $table: ".implode(', ', array_keys($in)), 'genie'._LOG_DEBUG); |
|
| 145 | 145 | } |
| 146 | 146 | |
| 147 | 147 | return count($in); |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | if (!defined('_AUTEURS_DELAI_REJET_NOUVEAU')) { |
| 218 | 218 | define('_AUTEURS_DELAI_REJET_NOUVEAU', 45 * 24 * 3600); |
| 219 | 219 | } |
| 220 | - sql_delete("spip_auteurs", "statut='nouveau' AND maj < " . sql_quote(date('Y-m-d', time() - intval(_AUTEURS_DELAI_REJET_NOUVEAU)))); |
|
| 220 | + sql_delete("spip_auteurs", "statut='nouveau' AND maj < ".sql_quote(date('Y-m-d', time() - intval(_AUTEURS_DELAI_REJET_NOUVEAU)))); |
|
| 221 | 221 | |
| 222 | 222 | /** |
| 223 | 223 | * Permet aux plugins de compléter l'optimisation suite aux éléments disparus |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | $champs['source'] = $source ? $source : 'spip'; |
| 96 | 96 | |
| 97 | 97 | $champs['login'] = ''; |
| 98 | - $champs['statut'] = '5poubelle'; // inutilisable tant qu'il n'a pas ete renseigne et institue |
|
| 98 | + $champs['statut'] = '5poubelle'; // inutilisable tant qu'il n'a pas ete renseigne et institue |
|
| 99 | 99 | $champs['webmestre'] = 'non'; |
| 100 | 100 | if (empty($champs['imessage'])) { |
| 101 | 101 | $champs['imessage'] = 'oui'; |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | $champs['pass'] = $c['pass']; |
| 325 | 325 | } |
| 326 | 326 | |
| 327 | - $statut = $statut_ancien = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 327 | + $statut = $statut_ancien = sql_getfetsel('statut', 'spip_auteurs', 'id_auteur='.intval($id_auteur)); |
|
| 328 | 328 | |
| 329 | 329 | if (isset($c['statut']) |
| 330 | 330 | and (autoriser('modifier', 'auteur', $id_auteur, null, array('statut' => $c['statut']))) |
@@ -380,7 +380,7 @@ discard block |
||
| 380 | 380 | // commencer par traiter les cas particuliers des logins et pass |
| 381 | 381 | // avant les autres ecritures en base |
| 382 | 382 | if (isset($champs['login']) or isset($champs['pass'])) { |
| 383 | - $auth_methode = sql_getfetsel('source', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 383 | + $auth_methode = sql_getfetsel('source', 'spip_auteurs', 'id_auteur='.intval($id_auteur)); |
|
| 384 | 384 | include_spip('inc/auth'); |
| 385 | 385 | if (isset($champs['login']) and strlen($champs['login'])) { |
| 386 | 386 | if (!auth_modifier_login($auth_methode, $champs['login'], $id_auteur)) { |
@@ -388,7 +388,7 @@ discard block |
||
| 388 | 388 | } |
| 389 | 389 | } |
| 390 | 390 | if (isset($champs['pass']) and strlen($champs['pass'])) { |
| 391 | - $champs['login'] = sql_getfetsel('login', 'spip_auteurs', 'id_auteur=' . intval($id_auteur)); |
|
| 391 | + $champs['login'] = sql_getfetsel('login', 'spip_auteurs', 'id_auteur='.intval($id_auteur)); |
|
| 392 | 392 | if (!auth_modifier_pass($auth_methode, $champs['login'], $champs['pass'], $id_auteur)) { |
| 393 | 393 | $erreurs[] = 'ecrire:impossible_modifier_pass_auteur'; |
| 394 | 394 | } |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | if (!count($champs)) { |
| 402 | 402 | return implode(' ', array_map('_T', $erreurs)); |
| 403 | 403 | } |
| 404 | - sql_updateq('spip_auteurs', $champs, 'id_auteur=' . $id_auteur); |
|
| 404 | + sql_updateq('spip_auteurs', $champs, 'id_auteur='.$id_auteur); |
|
| 405 | 405 | |
| 406 | 406 | // .. mettre a jour les fichiers .htpasswd et .htpasswd-admin |
| 407 | 407 | if ($flag_ecrire_acces |
@@ -23,6 +23,6 @@ |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $GLOBALS['maj'][2021021800] = [ |
| 26 | - ['sql_alter', "TABLE spip_auteurs CHANGE imessage imessage VARCHAR(3) DEFAULT '' NOT NULL" ], |
|
| 27 | - ['sql_updateq', "spip_auteurs", ['imessage' => 'oui'], "imessage != 'non' OR imessage IS NULL" ], |
|
| 26 | + ['sql_alter', "TABLE spip_auteurs CHANGE imessage imessage VARCHAR(3) DEFAULT '' NOT NULL"], |
|
| 27 | + ['sql_updateq', "spip_auteurs", ['imessage' => 'oui'], "imessage != 'non' OR imessage IS NULL"], |
|
| 28 | 28 | ]; |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | // celle du texte) et public (spip_lang est la langue du texte) |
| 45 | 45 | $dir = _DIR_RESTREINT ? lang_dir() : lang_dir($GLOBALS['spip_lang']); |
| 46 | 46 | |
| 47 | - $p = 'puce' . (test_espace_prive() ? '_prive' : ''); |
|
| 47 | + $p = 'puce'.(test_espace_prive() ? '_prive' : ''); |
|
| 48 | 48 | if ($dir == 'rtl') { |
| 49 | 49 | $p .= '_rtl'; |
| 50 | 50 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | if (!defined('_BALISES_BLOCS_REGEXP')) { |
| 70 | - define('_BALISES_BLOCS_REGEXP', ',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS'); |
|
| 70 | + define('_BALISES_BLOCS_REGEXP', ',</?('._BALISES_BLOCS.')[>[:space:]],iS'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | // Tester si on echappe en span ou en div |
| 87 | 87 | if (is_null($mode) or !in_array($mode, array('div', 'span'))) { |
| 88 | - $mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $rempl) ? 'div' : 'span'; |
|
| 88 | + $mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $rempl) ? 'div' : 'span'; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // Decouper en morceaux, base64 a des probleme selon la taille de la pile |
@@ -117,11 +117,11 @@ discard block |
||
| 117 | 117 | // echapper les < dans <code> |
| 118 | 118 | // on utilise _PROTEGE_BLOCS pour simplifier le code et la maintenance, mais on est interesse que par <code> |
| 119 | 119 | if (strpos($pre, "<") !== false |
| 120 | - and preg_match_all(_PROTEGE_BLOCS, $pre, $matches, PREG_SET_ORDER)){ |
|
| 120 | + and preg_match_all(_PROTEGE_BLOCS, $pre, $matches, PREG_SET_ORDER)) { |
|
| 121 | 121 | |
| 122 | - foreach ($matches as $m){ |
|
| 123 | - if ($m[1]==='code'){ |
|
| 124 | - $code = "<code" . $m[2] . ">" . spip_htmlspecialchars($m[3]) . "</code>"; |
|
| 122 | + foreach ($matches as $m) { |
|
| 123 | + if ($m[1] === 'code') { |
|
| 124 | + $code = "<code".$m[2].">".spip_htmlspecialchars($m[3])."</code>"; |
|
| 125 | 125 | $pre = str_replace($m[0], $code, $pre); |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | // Echapper les <code>...</ code> |
| 133 | 133 | // https://code.spip.net/@traiter_echap_code_dist |
| 134 | 134 | function traiter_echap_code_dist($regs) { |
| 135 | - list(, , $att, $corps) = $regs; |
|
| 135 | + list(,, $att, $corps) = $regs; |
|
| 136 | 136 | $echap = spip_htmlspecialchars($corps); // il ne faut pas passer dans entites_html, ne pas transformer les &#xxx; du code ! |
| 137 | 137 | |
| 138 | 138 | // ne pas mettre le <div...> s'il n'y a qu'une ligne |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | $echap = nl2br($echap); |
| 144 | 144 | $echap = "<div style='text-align: left;' " |
| 145 | 145 | . "class='spip_code' dir='ltr'><code$att>" |
| 146 | - . $echap . "</code></div>"; |
|
| 146 | + . $echap."</code></div>"; |
|
| 147 | 147 | } else { |
| 148 | - $echap = "<code$att class='spip_code' dir='ltr'>" . $echap . "</code>"; |
|
| 148 | + $echap = "<code$att class='spip_code' dir='ltr'>".$echap."</code>"; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $echap = str_replace("\t", " ", $echap); |
@@ -222,10 +222,10 @@ discard block |
||
| 222 | 222 | $echap = $regs[0]; |
| 223 | 223 | } // sinon les traiter selon le cas |
| 224 | 224 | else { |
| 225 | - if (function_exists($f = 'traiter_echap_' . strtolower($regs[1]))) { |
|
| 225 | + if (function_exists($f = 'traiter_echap_'.strtolower($regs[1]))) { |
|
| 226 | 226 | $echap = $f($regs); |
| 227 | 227 | } else { |
| 228 | - if (function_exists($f = $f . '_dist')) { |
|
| 228 | + if (function_exists($f = $f.'_dist')) { |
|
| 229 | 229 | $echap = $f($regs); |
| 230 | 230 | } |
| 231 | 231 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | // (derogatoire car on ne peut pas faire passer < ? ... ? > |
| 246 | 246 | // dans une callback autonommee |
| 247 | 247 | if (strpos($preg ? $preg : _PROTEGE_BLOCS, 'script') !== false) { |
| 248 | - if (strpos($letexte, "<" . "?") !== false and preg_match_all(',<[?].*($|[?]>),UisS', |
|
| 248 | + if (strpos($letexte, "<"."?") !== false and preg_match_all(',<[?].*($|[?]>),UisS', |
|
| 249 | 249 | $letexte, $matches, PREG_SET_ORDER) |
| 250 | 250 | ) { |
| 251 | 251 | foreach ($matches as $regs) { |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $max_prof = 5; |
| 271 | 271 | while (strpos($letexte, "<") !== false |
| 272 | 272 | and |
| 273 | - preg_match_all(',<(span|div)\sclass=[\'"]base64' . $source . '[\'"]\s(.*)>\s*</\1>,UmsS', |
|
| 273 | + preg_match_all(',<(span|div)\sclass=[\'"]base64'.$source.'[\'"]\s(.*)>\s*</\1>,UmsS', |
|
| 274 | 274 | $letexte, $regs, PREG_SET_ORDER) |
| 275 | 275 | and $max_prof--) { |
| 276 | 276 | foreach ($regs as $reg) { |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | if ($at) { |
| 286 | - $rempl = '<' . $reg[1] . '>' . $rempl . '</' . $reg[1] . '>'; |
|
| 286 | + $rempl = '<'.$reg[1].'>'.$rempl.'</'.$reg[1].'>'; |
|
| 287 | 287 | foreach ($at as $attr => $a) { |
| 288 | 288 | $rempl = inserer_attribut($rempl, $attr, $a); |
| 289 | 289 | } |
@@ -362,8 +362,8 @@ discard block |
||
| 362 | 362 | $texte = nettoyer_raccourcis_typo($texte); |
| 363 | 363 | |
| 364 | 364 | // balises de sauts de ligne et paragraphe |
| 365 | - $texte = preg_replace("/<p( [^>]*)?" . ">/", "\r", $texte); |
|
| 366 | - $texte = preg_replace("/<br( [^>]*)?" . ">/", "\n", $texte); |
|
| 365 | + $texte = preg_replace("/<p( [^>]*)?".">/", "\r", $texte); |
|
| 366 | + $texte = preg_replace("/<br( [^>]*)?".">/", "\n", $texte); |
|
| 367 | 367 | |
| 368 | 368 | // on repasse les doubles \n en \r que nettoyer_raccourcis_typo() a pu modifier |
| 369 | 369 | $texte = str_replace("\n\n", "\r", $texte); |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | // supprimer les tags |
| 372 | 372 | $texte = supprimer_tags($texte); |
| 373 | 373 | $texte = trim(str_replace("\n", " ", $texte)); |
| 374 | - $texte .= "\n"; // marquer la fin |
|
| 374 | + $texte .= "\n"; // marquer la fin |
|
| 375 | 375 | |
| 376 | 376 | // corriger la longueur de coupe |
| 377 | 377 | // en fonction de la presence de caracteres utf |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | // couper au mot precedent |
| 387 | 387 | $long = spip_substr($texte, 0, max($taille - 4, 1)); |
| 388 | 388 | $u = $GLOBALS['meta']['pcre_u']; |
| 389 | - $court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long); |
|
| 389 | + $court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long); |
|
| 390 | 390 | if (is_null($suite)) { |
| 391 | 391 | $suite = (defined('_COUPER_SUITE') ? _COUPER_SUITE : ' (...)'); |
| 392 | 392 | } |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | if (spip_strlen($court) < max(0.75 * $taille, 2)) { |
| 397 | 397 | $points = ''; |
| 398 | 398 | $long = spip_substr($texte, 0, $taille); |
| 399 | - $texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long); |
|
| 399 | + $texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long); |
|
| 400 | 400 | // encore trop court ? couper au caractere |
| 401 | 401 | if (spip_strlen($texte) < 0.75 * $taille) { |
| 402 | 402 | $texte = $long; |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | // supprimer l'eventuelle entite finale mal coupee |
| 417 | 417 | $texte = preg_replace('/&#?[a-z0-9]*$/S', '', $texte); |
| 418 | 418 | |
| 419 | - return quote_amp(trim($texte)) . $points; |
|
| 419 | + return quote_amp(trim($texte)).$points; |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | |
@@ -429,16 +429,16 @@ discard block |
||
| 429 | 429 | define('_PROTEGE_JS_MODELES', creer_uniqid()); |
| 430 | 430 | } |
| 431 | 431 | foreach ($r as $regs) { |
| 432 | - $t = str_replace($regs[0], code_echappement($regs[0], 'javascript' . _PROTEGE_JS_MODELES), $t); |
|
| 432 | + $t = str_replace($regs[0], code_echappement($regs[0], 'javascript'._PROTEGE_JS_MODELES), $t); |
|
| 433 | 433 | } |
| 434 | 434 | } |
| 435 | - if (preg_match_all(',<\?php.*?($|\?' . '>),isS', $t, $r, PREG_SET_ORDER)) { |
|
| 435 | + if (preg_match_all(',<\?php.*?($|\?'.'>),isS', $t, $r, PREG_SET_ORDER)) { |
|
| 436 | 436 | if (!defined('_PROTEGE_PHP_MODELES')) { |
| 437 | 437 | include_spip('inc/acces'); |
| 438 | 438 | define('_PROTEGE_PHP_MODELES', creer_uniqid()); |
| 439 | 439 | } |
| 440 | 440 | foreach ($r as $regs) { |
| 441 | - $t = str_replace($regs[0], code_echappement($regs[0], 'php' . _PROTEGE_PHP_MODELES), $t); |
|
| 441 | + $t = str_replace($regs[0], code_echappement($regs[0], 'php'._PROTEGE_PHP_MODELES), $t); |
|
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | } |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | * @param bool $strict |
| 474 | 474 | * @return string |
| 475 | 475 | */ |
| 476 | -function echapper_html_suspect($texte, $strict=true) { |
|
| 476 | +function echapper_html_suspect($texte, $strict = true) { |
|
| 477 | 477 | static $echapper_html_suspect; |
| 478 | 478 | if (!$texte or !is_string($texte)) { |
| 479 | 479 | return $texte; |
@@ -495,8 +495,8 @@ discard block |
||
| 495 | 495 | // quand c'est du texte qui passe par propre on est plus coulant tant qu'il y a pas d'attribut du type onxxx= |
| 496 | 496 | // car sinon on declenche sur les modeles ou ressources |
| 497 | 497 | if (!$strict and |
| 498 | - (strpos($texte,'on') === false or !preg_match(",<\w+.*\bon\w+\s*=,UimsS", $texte)) |
|
| 499 | - ){ |
|
| 498 | + (strpos($texte, 'on') === false or !preg_match(",<\w+.*\bon\w+\s*=,UimsS", $texte)) |
|
| 499 | + ) { |
|
| 500 | 500 | return $texte; |
| 501 | 501 | } |
| 502 | 502 | |
@@ -575,9 +575,9 @@ discard block |
||
| 575 | 575 | **/ |
| 576 | 576 | function supprime_img($letexte, $message = null) { |
| 577 | 577 | if ($message === null) { |
| 578 | - $message = '(' . _T('img_indisponible') . ')'; |
|
| 578 | + $message = '('._T('img_indisponible').')'; |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | - return preg_replace(',<(img|doc|emb)([0-9]+)(\|([^>]*))?' . '\s*/?' . '>,i', |
|
| 581 | + return preg_replace(',<(img|doc|emb)([0-9]+)(\|([^>]*))?'.'\s*/?'.'>,i', |
|
| 582 | 582 | $message, $letexte); |
| 583 | 583 | } |
@@ -48,19 +48,19 @@ discard block |
||
| 48 | 48 | * Nom d'une balise #TOTO |
| 49 | 49 | * |
| 50 | 50 | * Écriture alambiquée pour rester compatible avec les hexadecimaux des vieux squelettes */ |
| 51 | -define('NOM_DE_CHAMP', "#((" . NOM_DE_BOUCLE . "):)?(([A-F]*[G-Z_][A-Z_0-9]*)|[A-Z_]+)\b(\*{0,2})"); |
|
| 51 | +define('NOM_DE_CHAMP', "#((".NOM_DE_BOUCLE."):)?(([A-F]*[G-Z_][A-Z_0-9]*)|[A-Z_]+)\b(\*{0,2})"); |
|
| 52 | 52 | /** Balise complète [...(#TOTO) ... ] */ |
| 53 | -define('CHAMP_ETENDU', '/\[([^]\[]*)\(' . NOM_DE_CHAMP . '([^[)]*\)[^]\[]*)\]/S'); |
|
| 53 | +define('CHAMP_ETENDU', '/\[([^]\[]*)\('.NOM_DE_CHAMP.'([^[)]*\)[^]\[]*)\]/S'); |
|
| 54 | 54 | |
| 55 | 55 | define('BALISE_INCLURE', '/<INCLU[DR]E[[:space:]]*(\(([^)]*)\))?/S'); |
| 56 | 56 | define('BALISE_POLYGLOTTE', ',<multi>(.*)</multi>,Uims'); |
| 57 | 57 | define('BALISE_IDIOMES', ',<:(([a-z0-9_]+):)?([a-z0-9_]*)({([^\|=>]*=[^\|>]*)})?((\|[^>]*)?:/?>),iS'); |
| 58 | -define('BALISE_IDIOMES_ARGS', '@^\s*([^= ]*)\s*=\s*((' . NOM_DE_CHAMP . '[{][^}]*})?[^,]*)\s*,?\s*@s'); |
|
| 58 | +define('BALISE_IDIOMES_ARGS', '@^\s*([^= ]*)\s*=\s*(('.NOM_DE_CHAMP.'[{][^}]*})?[^,]*)\s*,?\s*@s'); |
|
| 59 | 59 | |
| 60 | 60 | /** Champ sql dans parenthèse ex: (id_article) */ |
| 61 | 61 | define('SQL_ARGS', '(\([^)]*\))'); |
| 62 | 62 | /** Fonction SQL sur un champ ex: SUM(visites) */ |
| 63 | -define('CHAMP_SQL_PLUS_FONC', '`?([A-Z_\/][A-Z_\/0-9.]*)' . SQL_ARGS . '?`?'); |
|
| 63 | +define('CHAMP_SQL_PLUS_FONC', '`?([A-Z_\/][A-Z_\/0-9.]*)'.SQL_ARGS.'?`?'); |
|
| 64 | 64 | |
| 65 | 65 | // https://code.spip.net/@phraser_inclure |
| 66 | 66 | function phraser_inclure($texte, $ligne, $result) { |
@@ -217,7 +217,7 @@ discard block |
||
| 217 | 217 | * @return array |
| 218 | 218 | **/ |
| 219 | 219 | function phraser_champs($texte, $ligne, $result) { |
| 220 | - while (preg_match("/" . NOM_DE_CHAMP . "/S", $texte, $match)) { |
|
| 220 | + while (preg_match("/".NOM_DE_CHAMP."/S", $texte, $match)) { |
|
| 221 | 221 | $p = strpos($texte, $match[0]); |
| 222 | 222 | // texte après la balise |
| 223 | 223 | $suite = substr($texte, $p + strlen($match[0])); |
@@ -369,7 +369,7 @@ discard block |
||
| 369 | 369 | $collecte[] = $champ; |
| 370 | 370 | $args = ltrim($regs[count($regs) - 1]); |
| 371 | 371 | } else { |
| 372 | - if (!preg_match("/" . NOM_DE_CHAMP . "([{|])/", $arg, $r)) { |
|
| 372 | + if (!preg_match("/".NOM_DE_CHAMP."([{|])/", $arg, $r)) { |
|
| 373 | 373 | // 0 est un aveu d'impuissance. A completer |
| 374 | 374 | $arg = phraser_champs_exterieurs($arg, 0, $sep, $result); |
| 375 | 375 | |
@@ -454,7 +454,7 @@ discard block |
||
| 454 | 454 | function phraser_champs_exterieurs($texte, $ligne, $sep, $nested) { |
| 455 | 455 | $res = array(); |
| 456 | 456 | while (($p = strpos($texte, "%$sep")) !== false) { |
| 457 | - if (!preg_match(',^%' . preg_quote($sep) . '([0-9]+)@,', substr($texte, $p), $m)) { |
|
| 457 | + if (!preg_match(',^%'.preg_quote($sep).'([0-9]+)@,', substr($texte, $p), $m)) { |
|
| 458 | 458 | break; |
| 459 | 459 | } |
| 460 | 460 | $debut = substr($texte, 0, $p); |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | $pos_apres = 0; |
| 496 | 496 | $result = phraser_args($match[7], ")", $sep, $result, $champ, $pos_apres); |
| 497 | 497 | phraser_vieux($champ); |
| 498 | - $champ->avant = phraser_champs_exterieurs($match[1], $n, $sep, $result); |
|
| 498 | + $champ->avant = phraser_champs_exterieurs($match[1], $n, $sep, $result); |
|
| 499 | 499 | $debut = substr($match[7], $pos_apres + 1); |
| 500 | 500 | if (!empty($debut)) { |
| 501 | 501 | $n += substr_count(substr($texte, 0, strpos($texte, $debut)), "\n"); |
@@ -625,7 +625,7 @@ discard block |
||
| 625 | 625 | // une maniere tres sale de supprimer les "' autour de {critere "xxx","yyy"} |
| 626 | 626 | if (preg_match(',^(["\'])(.*)\1$,', $m[4])) { |
| 627 | 627 | $c = null; |
| 628 | - eval('$c = ' . $m[4] . ';'); |
|
| 628 | + eval('$c = '.$m[4].';'); |
|
| 629 | 629 | if (isset($c)) { |
| 630 | 630 | $m[4] = $c; |
| 631 | 631 | } |
@@ -703,7 +703,7 @@ discard block |
||
| 703 | 703 | |
| 704 | 704 | if (preg_match(',^ *([0-9-]+) *(/) *(.+) *$,', $param, $m)) { |
| 705 | 705 | $crit = phraser_critere_infixe($m[1], $m[3], $v, '/', '', ''); |
| 706 | - } elseif (preg_match(',^([!]?)(' . CHAMP_SQL_PLUS_FONC . |
|
| 706 | + } elseif (preg_match(',^([!]?)('.CHAMP_SQL_PLUS_FONC. |
|
| 707 | 707 | ')[[:space:]]*(\??)(!?)(<=?|>=?|==?|\b(?:IN|LIKE)\b)(.*)$,is', $param, $m)) { |
| 708 | 708 | $a2 = trim($m[8]); |
| 709 | 709 | if ($a2 and ($a2[0] == "'" or $a2[0] == '"') and ($a2[0] == substr($a2, -1))) { |
@@ -713,8 +713,8 @@ discard block |
||
| 713 | 713 | (($m[2] == 'lang_select') ? $m[2] : $m[7]), |
| 714 | 714 | $m[6], $m[5]); |
| 715 | 715 | $crit->exclus = $m[1]; |
| 716 | - } elseif (preg_match("/^([!]?)\s*(" . |
|
| 717 | - CHAMP_SQL_PLUS_FONC . |
|
| 716 | + } elseif (preg_match("/^([!]?)\s*(". |
|
| 717 | + CHAMP_SQL_PLUS_FONC. |
|
| 718 | 718 | ")\s*(\??)(.*)$/is", $param, $m)) { |
| 719 | 719 | // contient aussi les comparaisons implicites ! |
| 720 | 720 | // Comme ci-dessus: |
@@ -816,11 +816,11 @@ discard block |
||
| 816 | 816 | $current_pos = $pos_debut_texte; |
| 817 | 817 | while (($pos_boucle = strpos($texte, BALISE_BOUCLE, $current_pos)) !== false) { |
| 818 | 818 | $current_pos = $pos_boucle + 1; |
| 819 | - $pos_parent = strpos($texte,'(', $pos_boucle); |
|
| 819 | + $pos_parent = strpos($texte, '(', $pos_boucle); |
|
| 820 | 820 | |
| 821 | 821 | $id_boucle = ''; |
| 822 | 822 | if ($pos_parent !== false) { |
| 823 | - $id_boucle = trim(substr($texte,$pos_boucle + strlen(BALISE_BOUCLE), $pos_parent - $pos_boucle - strlen(BALISE_BOUCLE))); |
|
| 823 | + $id_boucle = trim(substr($texte, $pos_boucle + strlen(BALISE_BOUCLE), $pos_parent - $pos_boucle - strlen(BALISE_BOUCLE))); |
|
| 824 | 824 | } |
| 825 | 825 | if ($pos_parent === false |
| 826 | 826 | or (strlen($id_boucle) and !(is_numeric($id_boucle) or strpos($id_boucle, '_') === 0))) { |
@@ -831,7 +831,7 @@ discard block |
||
| 831 | 831 | |
| 832 | 832 | // un id_boucle pour l'affichage de l'erreur |
| 833 | 833 | if (!strlen($id_boucle)) { |
| 834 | - $id_boucle = substr($texte,$pos_boucle + strlen(BALISE_BOUCLE), 15); |
|
| 834 | + $id_boucle = substr($texte, $pos_boucle + strlen(BALISE_BOUCLE), 15); |
|
| 835 | 835 | } |
| 836 | 836 | $result->id_boucle = $id_boucle; |
| 837 | 837 | $err_b = array('zbug_erreur_boucle_syntaxe', array('id' => $id_boucle)); |
@@ -854,11 +854,11 @@ discard block |
||
| 854 | 854 | |
| 855 | 855 | // un id_boucle pour l'affichage de l'erreur sur les boucle anonymes |
| 856 | 856 | if (!strlen($id_boucle)) { |
| 857 | - $boucle['id_boucle_err'] = substr($texte,$pos_boucle + strlen(BALISE_BOUCLE), 15); |
|
| 857 | + $boucle['id_boucle_err'] = substr($texte, $pos_boucle + strlen(BALISE_BOUCLE), 15); |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | // trouver sa position de depart reelle : au <Bxx> ou au <BBxx> |
| 861 | - $precond_boucle = BALISE_PRECOND_BOUCLE . $id_boucle . '>'; |
|
| 861 | + $precond_boucle = BALISE_PRECOND_BOUCLE.$id_boucle.'>'; |
|
| 862 | 862 | $pos_precond = strpos($texte, $precond_boucle, $id_boucle ? $pos_debut_texte : $pos_derniere_boucle_anonyme); |
| 863 | 863 | if ($pos_precond !== false |
| 864 | 864 | and $pos_precond < $boucle['debut_boucle']) { |
@@ -867,7 +867,7 @@ discard block |
||
| 867 | 867 | $boucle['pos_precond_inside'] = $pos_precond + strlen($precond_boucle); |
| 868 | 868 | } |
| 869 | 869 | |
| 870 | - $preaff_boucle = BALISE_PREAFF_BOUCLE . $id_boucle . '>'; |
|
| 870 | + $preaff_boucle = BALISE_PREAFF_BOUCLE.$id_boucle.'>'; |
|
| 871 | 871 | $pos_preaff = strpos($texte, $preaff_boucle, $id_boucle ? $pos_debut_texte : $pos_derniere_boucle_anonyme); |
| 872 | 872 | if ($pos_preaff !== false |
| 873 | 873 | and $pos_preaff < $boucle['debut_boucle']) { |
@@ -913,26 +913,26 @@ discard block |
||
| 913 | 913 | $pos_anonyme_next = null; |
| 914 | 914 | // si c'est une boucle anonyme, chercher la position de la prochaine boucle anonyme |
| 915 | 915 | if (!strlen($id_boucle)) { |
| 916 | - $pos_anonyme_next = strpos($texte, BALISE_BOUCLE . '(', $pos_courante); |
|
| 916 | + $pos_anonyme_next = strpos($texte, BALISE_BOUCLE.'(', $pos_courante); |
|
| 917 | 917 | } |
| 918 | 918 | |
| 919 | 919 | // |
| 920 | 920 | // 1. Recuperer la partie conditionnelle apres |
| 921 | 921 | // |
| 922 | - $apres_boucle = BALISE_POSTCOND_BOUCLE . $id_boucle . ">"; |
|
| 922 | + $apres_boucle = BALISE_POSTCOND_BOUCLE.$id_boucle.">"; |
|
| 923 | 923 | $pos_apres = strpos($texte, $apres_boucle, $pos_courante); |
| 924 | 924 | if ($pos_apres !== false |
| 925 | 925 | and (!$pos_anonyme_next or $pos_apres < $pos_anonyme_next)) { |
| 926 | 926 | $boucle['pos_postcond'] = $pos_apres; |
| 927 | 927 | $pos_apres += strlen($apres_boucle); |
| 928 | 928 | $boucle['pos_postcond_inside'] = $pos_apres; |
| 929 | - $pos_courante = $pos_apres ; |
|
| 929 | + $pos_courante = $pos_apres; |
|
| 930 | 930 | } |
| 931 | 931 | |
| 932 | 932 | // |
| 933 | 933 | // 2. Récuperer la partie alternative apres |
| 934 | 934 | // |
| 935 | - $altern_boucle = BALISE_ALT_BOUCLE . $id_boucle . ">"; |
|
| 935 | + $altern_boucle = BALISE_ALT_BOUCLE.$id_boucle.">"; |
|
| 936 | 936 | $pos_altern = strpos($texte, $altern_boucle, $pos_courante); |
| 937 | 937 | if ($pos_altern !== false |
| 938 | 938 | and (!$pos_anonyme_next or $pos_altern < $pos_anonyme_next)) { |
@@ -945,14 +945,14 @@ discard block |
||
| 945 | 945 | // |
| 946 | 946 | // 3. Recuperer la partie footer non alternative |
| 947 | 947 | // |
| 948 | - $postaff_boucle = BALISE_POSTAFF_BOUCLE . $id_boucle . ">"; |
|
| 948 | + $postaff_boucle = BALISE_POSTAFF_BOUCLE.$id_boucle.">"; |
|
| 949 | 949 | $pos_postaff = strpos($texte, $postaff_boucle, $pos_courante); |
| 950 | 950 | if ($pos_postaff !== false |
| 951 | 951 | and (!$pos_anonyme_next or $pos_postaff < $pos_anonyme_next)) { |
| 952 | 952 | $boucle['pos_postaff'] = $pos_postaff; |
| 953 | 953 | $pos_postaff += strlen($postaff_boucle); |
| 954 | 954 | $boucle['pos_postaff_inside'] = $pos_postaff; |
| 955 | - $pos_courante = $pos_postaff ; |
|
| 955 | + $pos_courante = $pos_postaff; |
|
| 956 | 956 | } |
| 957 | 957 | |
| 958 | 958 | return $boucle; |
@@ -964,7 +964,7 @@ discard block |
||
| 964 | 964 | * @param null|string $boucle_placeholder |
| 965 | 965 | * @param null|object $boucle |
| 966 | 966 | */ |
| 967 | -function phraser_boucle_placeholder(&$champ, $boucle_placeholder=null, $boucle = null) { |
|
| 967 | +function phraser_boucle_placeholder(&$champ, $boucle_placeholder = null, $boucle = null) { |
|
| 968 | 968 | static $boucles_connues = array(); |
| 969 | 969 | // si c'est un appel pour memoriser une boucle, memorisons la |
| 970 | 970 | if (is_string($champ) and !empty($boucle_placeholder) and !empty($boucle)) { |
@@ -992,7 +992,7 @@ discard block |
||
| 992 | 992 | * @return string |
| 993 | 993 | */ |
| 994 | 994 | function public_generer_boucle_placeholder($id_boucle, &$boucle, $boucle_placeholder, $nb_lignes) { |
| 995 | - $placeholder = "[(#{$boucle_placeholder}{" . $id_boucle . '})' . str_pad("", $nb_lignes, "\n") . "]"; |
|
| 995 | + $placeholder = "[(#{$boucle_placeholder}{".$id_boucle.'})'.str_pad("", $nb_lignes, "\n")."]"; |
|
| 996 | 996 | //memoriser la boucle a reinjecter |
| 997 | 997 | $id_boucle = "$id_boucle"; |
| 998 | 998 | phraser_boucle_placeholder($id_boucle, $boucle_placeholder, $boucle); |
@@ -1005,7 +1005,7 @@ discard block |
||
| 1005 | 1005 | // definir un placholder pour les boucles dont on est sur d'avoir aucune occurence dans le squelette |
| 1006 | 1006 | if (is_null($boucle_placeholder)) { |
| 1007 | 1007 | do { |
| 1008 | - $boucle_placeholder = "BOUCLE_PLACEHOLDER_" . strtoupper(md5(uniqid())); |
|
| 1008 | + $boucle_placeholder = "BOUCLE_PLACEHOLDER_".strtoupper(md5(uniqid())); |
|
| 1009 | 1009 | } while (strpos($texte, $boucle_placeholder) !== false); |
| 1010 | 1010 | } |
| 1011 | 1011 | |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | |
| 1026 | 1026 | // boucle anonyme ? |
| 1027 | 1027 | if (!strlen($id_boucle)) { |
| 1028 | - $id_boucle = '_anon_L' . $ligne_milieu . '_' . substr(md5('anonyme:' .$id_parent.':'. json_encode($boucle)), 0, 8); |
|
| 1028 | + $id_boucle = '_anon_L'.$ligne_milieu.'_'.substr(md5('anonyme:'.$id_parent.':'.json_encode($boucle)), 0, 8); |
|
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | $pos_debut_boucle = $pos_courante; |
@@ -1039,7 +1039,7 @@ discard block |
||
| 1039 | 1039 | |
| 1040 | 1040 | $pos_avant = $boucle['pos_precond_inside']; |
| 1041 | 1041 | $result->avant = substr($texte, $pos_avant, $pos_courante - $pos_avant); |
| 1042 | - $ligne_avant = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_avant); |
|
| 1042 | + $ligne_avant = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_avant); |
|
| 1043 | 1043 | } |
| 1044 | 1044 | |
| 1045 | 1045 | // Regarder si on a une partie inconditionnelle avant <BB_xxx> |
@@ -1049,7 +1049,7 @@ discard block |
||
| 1049 | 1049 | |
| 1050 | 1050 | $pos_preaff = $boucle['pos_preaff_inside']; |
| 1051 | 1051 | $result->preaff = substr($texte, $pos_preaff, $end_preaff - $pos_preaff); |
| 1052 | - $ligne_preaff = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_preaff); |
|
| 1052 | + $ligne_preaff = $ligne_debut_texte + public_compte_ligne($texte, $pos_debut_texte, $pos_preaff); |
|
| 1053 | 1053 | } |
| 1054 | 1054 | |
| 1055 | 1055 | $result->id_boucle = $id_boucle; |
@@ -1105,7 +1105,7 @@ discard block |
||
| 1105 | 1105 | } else { |
| 1106 | 1106 | $pos_milieu += 1; |
| 1107 | 1107 | |
| 1108 | - $fin_boucle = BALISE_FIN_BOUCLE . $id_boucle_search . ">"; |
|
| 1108 | + $fin_boucle = BALISE_FIN_BOUCLE.$id_boucle_search.">"; |
|
| 1109 | 1109 | $pos_fin = strpos($texte, $fin_boucle, $pos_milieu); |
| 1110 | 1110 | if ($pos_fin === false) { |
| 1111 | 1111 | $err_b = array( |
@@ -1118,7 +1118,7 @@ discard block |
||
| 1118 | 1118 | else { |
| 1119 | 1119 | // verifier une eventuelle imbrication d'une boucle homonyme |
| 1120 | 1120 | // (interdite, generera une erreur plus loin, mais permet de signaler la bonne erreur) |
| 1121 | - $search_debut_boucle = BALISE_BOUCLE . $id_boucle_search . '('; |
|
| 1121 | + $search_debut_boucle = BALISE_BOUCLE.$id_boucle_search.'('; |
|
| 1122 | 1122 | $search_from = $pos_milieu; |
| 1123 | 1123 | $nb_open = 1; |
| 1124 | 1124 | $nb_close = 1; |
@@ -1138,7 +1138,7 @@ discard block |
||
| 1138 | 1138 | $nb_open++; |
| 1139 | 1139 | $search_from = $p + 1; |
| 1140 | 1140 | } |
| 1141 | - } while($nb_close < $nb_open and $maxiter++ < 5); |
|
| 1141 | + } while ($nb_close < $nb_open and $maxiter++ < 5); |
|
| 1142 | 1142 | |
| 1143 | 1143 | $pos_courante = $pos_fin + strlen($fin_boucle); |
| 1144 | 1144 | } |
@@ -1154,7 +1154,7 @@ discard block |
||
| 1154 | 1154 | if ($boucle['pos_postcond']) { |
| 1155 | 1155 | $result->apres = substr($texte, $pos_courante, $boucle['pos_postcond'] - $pos_courante); |
| 1156 | 1156 | $ligne_suite += public_compte_ligne($texte, $pos_courante, $boucle['pos_postcond_inside']); |
| 1157 | - $pos_courante = $boucle['pos_postcond_inside'] ; |
|
| 1157 | + $pos_courante = $boucle['pos_postcond_inside']; |
|
| 1158 | 1158 | } |
| 1159 | 1159 | |
| 1160 | 1160 | |
@@ -1210,7 +1210,7 @@ discard block |
||
| 1210 | 1210 | // reserver la place dans la pile des boucles pour compiler ensuite dans le bon ordre |
| 1211 | 1211 | // ie les boucles qui apparaissent dans les partie conditionnelles doivent etre compilees apres cette boucle |
| 1212 | 1212 | // si il y a deja une boucle de ce nom, cela declenchera une erreur ensuite |
| 1213 | - if (empty($boucles[$id_boucle])){ |
|
| 1213 | + if (empty($boucles[$id_boucle])) { |
|
| 1214 | 1214 | $boucles[$id_boucle] = null; |
| 1215 | 1215 | } |
| 1216 | 1216 | $result->preaff = public_phraser_html_dist($result->preaff, $id_parent, $boucles, $descr, $ligne_preaff, $boucle_placeholder); |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | preg_match(",^([^=]*)(=?)(.*)$,m", $var->texte, $m); |
| 98 | 98 | $m = array_pad($m, 3, null); |
| 99 | 99 | $var = $m[1]; |
| 100 | - $auto = false;; |
|
| 100 | + $auto = false; ; |
|
| 101 | 101 | if ($m[2]) { |
| 102 | 102 | $v = $m[3]; |
| 103 | 103 | if (preg_match(',^[\'"](.*)[\'"]$,', $v, $m)) { |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | : calculer_liste($val, $p->descr, $boucles, $id_boucle); |
| 122 | 122 | if ($var !== 1) { |
| 123 | 123 | $val = ($echap ? "\'$var\' => ' . argumenter_squelette(" : "'$var' => ") |
| 124 | - . $val . ($echap ? ") . '" : " "); |
|
| 124 | + . $val.($echap ? ") . '" : " "); |
|
| 125 | 125 | } else { |
| 126 | 126 | $val = $echap ? "'.$val.'" : $val; |
| 127 | 127 | } |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | if (!$lang) { |
| 143 | 143 | $lang = '$GLOBALS["spip_lang"]'; |
| 144 | 144 | } |
| 145 | - $l['lang'] = ($echap ? "\'lang\' => ' . argumenter_squelette(" : "'lang' => ") . $lang . ($echap ? ") . '" : " "); |
|
| 145 | + $l['lang'] = ($echap ? "\'lang\' => ' . argumenter_squelette(" : "'lang' => ").$lang.($echap ? ") . '" : " "); |
|
| 146 | 146 | |
| 147 | 147 | return $l; |
| 148 | 148 | } |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | $_contexte = argumenter_inclure($p->param, false, $p, $boucles, $id_boucle, true, '', true); |
| 172 | 172 | if (is_string($p->texte)) { |
| 173 | 173 | $fichier = $p->texte; |
| 174 | - $code = "\"".str_replace('"','\"',$fichier)."\""; |
|
| 174 | + $code = "\"".str_replace('"', '\"', $fichier)."\""; |
|
| 175 | 175 | |
| 176 | 176 | } else { |
| 177 | 177 | $code = calculer_liste($p->texte, $p->descr, $boucles, $id_boucle); |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | $trace = $p->fonctions; |
| 186 | 186 | while (is_array($trace) |
| 187 | 187 | and $trace = array_filter($trace) |
| 188 | - and count($trace)==1) { |
|
| 188 | + and count($trace) == 1) { |
|
| 189 | 189 | $trace = reset($trace); |
| 190 | 190 | } |
| 191 | 191 | $erreur_p_i_i = array( |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | return false; |
| 220 | 220 | } // j'aurais voulu toucher le fond ... |
| 221 | 221 | |
| 222 | - $contexte = 'array(' . $_contexte . ')'; |
|
| 222 | + $contexte = 'array('.$_contexte.')'; |
|
| 223 | 223 | |
| 224 | 224 | if ($env) { |
| 225 | 225 | $contexte = "array_merge('.var_export(\$Pile[0],1).',$contexte)"; |
@@ -234,11 +234,11 @@ discard block |
||
| 234 | 234 | $_options[] = $ajax; |
| 235 | 235 | } |
| 236 | 236 | $code = " ' . argumenter_squelette($code) . '"; |
| 237 | - $code = "echo " . sprintf(CODE_RECUPERER_FOND, $code, $contexte, implode(',', $_options), |
|
| 238 | - "_request(\"connect\")") . ';'; |
|
| 237 | + $code = "echo ".sprintf(CODE_RECUPERER_FOND, $code, $contexte, implode(',', $_options), |
|
| 238 | + "_request(\"connect\")").';'; |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | - return "\n'<'.'" . "?php " . $code . "\n?'." . "'>'"; |
|
| 241 | + return "\n'<'.'"."?php ".$code."\n?'."."'>'"; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | |
@@ -318,17 +318,17 @@ discard block |
||
| 318 | 318 | $id = $id_table; |
| 319 | 319 | $statut = preg_replace(',\W,', '', $s['champ']); // securite |
| 320 | 320 | } |
| 321 | - $mstatut = $id . '.' . $statut; |
|
| 321 | + $mstatut = $id.'.'.$statut; |
|
| 322 | 322 | |
| 323 | 323 | $arg_ignore_previsu = ($ignore_previsu ? ",true" : ''); |
| 324 | 324 | include_spip('public/quete'); |
| 325 | 325 | if (isset($s['post_date']) and $s['post_date'] |
| 326 | 326 | and $GLOBALS['meta']["post_dates"] == 'non' |
| 327 | 327 | ) { |
| 328 | - $date = $id . '.' . preg_replace(',\W,', '', $s['post_date']); // securite |
|
| 328 | + $date = $id.'.'.preg_replace(',\W,', '', $s['post_date']); // securite |
|
| 329 | 329 | array_unshift($boucle->where, |
| 330 | 330 | $echapper ? |
| 331 | - "\nquete_condition_postdates('$date'," . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 331 | + "\nquete_condition_postdates('$date',"._q($boucle->sql_serveur)."$arg_ignore_previsu)" |
|
| 332 | 332 | : |
| 333 | 333 | quete_condition_postdates($date, $boucle->sql_serveur, $ignore_previsu) |
| 334 | 334 | ); |
@@ -336,9 +336,9 @@ discard block |
||
| 336 | 336 | array_unshift($boucle->where, |
| 337 | 337 | $echapper ? |
| 338 | 338 | "\nquete_condition_statut('$mstatut'," |
| 339 | - . _q($s['previsu']) . "," |
|
| 340 | - . _q($s['publie']) . "," |
|
| 341 | - . _q($boucle->sql_serveur) . "$arg_ignore_previsu)" |
|
| 339 | + . _q($s['previsu'])."," |
|
| 340 | + . _q($s['publie'])."," |
|
| 341 | + . _q($boucle->sql_serveur)."$arg_ignore_previsu)" |
|
| 342 | 342 | : |
| 343 | 343 | quete_condition_statut($mstatut, $s['previsu'], $s['publie'], $boucle->sql_serveur, $ignore_previsu) |
| 344 | 344 | ); |
@@ -372,14 +372,14 @@ discard block |
||
| 372 | 372 | if (_request('var_mode_affiche') != 'resultat') { |
| 373 | 373 | $trace = ''; |
| 374 | 374 | } else { |
| 375 | - $_trace = $boucles[$id_boucle]->descr['nom'] . $id_boucle; |
|
| 375 | + $_trace = $boucles[$id_boucle]->descr['nom'].$id_boucle; |
|
| 376 | 376 | $_trace = "\$GLOBALS['debug_objets']['resultat']['$_trace']"; |
| 377 | 377 | $trace = " |
| 378 | 378 | if (empty($_trace)) { |
| 379 | 379 | $_trace = []; |
| 380 | 380 | } |
| 381 | 381 | if (count($_trace) < 3) { |
| 382 | - $_trace" . "[] = \$t0; |
|
| 382 | + $_trace"."[] = \$t0; |
|
| 383 | 383 | }"; |
| 384 | 384 | } |
| 385 | 385 | |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | return |
| 414 | 414 | // Numrows[$nom] peut ne pas être encore defini |
| 415 | 415 | "\n\t\$save_numrows = (isset(\$Numrows['$nom']) ? \$Numrows['$nom'] : array());" |
| 416 | - . "\n\t\$t0 = " . $boucles[$id_boucle]->return . ";" |
|
| 416 | + . "\n\t\$t0 = ".$boucles[$id_boucle]->return.";" |
|
| 417 | 417 | . "\n\t\$Numrows['$nom'] = (\$save_numrows);" |
| 418 | 418 | . $trace |
| 419 | 419 | . "\n\treturn \$t0;"; |
@@ -481,7 +481,7 @@ discard block |
||
| 481 | 481 | // faudrait expanser le foreach a la compil, car y en a souvent qu'un |
| 482 | 482 | // et puis faire un [] plutot qu'un "','." |
| 483 | 483 | if ($boucle->doublons) { |
| 484 | - $corps .= "\n\t\t\tforeach(" . $boucle->doublons . ' as $k) $doublons[$k] .= "," . ' . |
|
| 484 | + $corps .= "\n\t\t\tforeach(".$boucle->doublons.' as $k) $doublons[$k] .= "," . '. |
|
| 485 | 485 | index_pile($id_boucle, $primary, $boucles) |
| 486 | 486 | . "; // doublons\n"; |
| 487 | 487 | } |
@@ -508,13 +508,13 @@ discard block |
||
| 508 | 508 | $corps .= |
| 509 | 509 | "\n\t\tlang_select_public(" |
| 510 | 510 | . index_pile($id_boucle, 'lang', $boucles) |
| 511 | - . ", '" . $boucle->lang_select . "'" |
|
| 511 | + . ", '".$boucle->lang_select."'" |
|
| 512 | 512 | . (in_array($type_boucle, array( |
| 513 | 513 | 'articles', |
| 514 | 514 | 'rubriques', |
| 515 | 515 | 'hierarchie', |
| 516 | 516 | 'breves' |
| 517 | - )) ? ', ' . index_pile($id_boucle, 'titre', $boucles) : '') |
|
| 517 | + )) ? ', '.index_pile($id_boucle, 'titre', $boucles) : '') |
|
| 518 | 518 | . ');'; |
| 519 | 519 | } else { |
| 520 | 520 | $init_lang = ''; |
@@ -535,26 +535,22 @@ discard block |
||
| 535 | 535 | |
| 536 | 536 | // gestion optimale des separateurs et des boucles constantes |
| 537 | 537 | if (count($boucle->separateur)) { |
| 538 | - $code_sep = ("'" . str_replace("'", "\'", join('', $boucle->separateur)) . "'"); |
|
| 538 | + $code_sep = ("'".str_replace("'", "\'", join('', $boucle->separateur))."'"); |
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | $corps .= |
| 542 | 542 | ((!$boucle->separateur) ? |
| 543 | - (($constant && !$corps && !$flag_cpt) ? $return : |
|
| 544 | - (($return === "''") ? '' : |
|
| 545 | - ("\n\t\t" . '$t0 .= ' . $return . ";"))) : |
|
| 546 | - ("\n\t\t\$t1 " . |
|
| 543 | + (($constant && !$corps && !$flag_cpt) ? $return : (($return === "''") ? '' : ("\n\t\t".'$t0 .= '.$return.";"))) : ("\n\t\t\$t1 ". |
|
| 547 | 544 | ((strpos($return, '$t1.') === 0) ? |
| 548 | - (".=" . substr($return, 4)) : |
|
| 549 | - ('= ' . $return)) . |
|
| 550 | - ";\n\t\t" . |
|
| 551 | - '$t0 .= ((strlen($t1) && strlen($t0)) ? ' . $code_sep . " : '') . \$t1;")); |
|
| 545 | + (".=".substr($return, 4)) : ('= '.$return)). |
|
| 546 | + ";\n\t\t". |
|
| 547 | + '$t0 .= ((strlen($t1) && strlen($t0)) ? '.$code_sep." : '') . \$t1;")); |
|
| 552 | 548 | |
| 553 | 549 | // Calculer les invalideurs si c'est une boucle non constante et si on |
| 554 | 550 | // souhaite invalider ces elements |
| 555 | 551 | if (!$constant and $primary) { |
| 556 | 552 | include_spip('inc/invalideur'); |
| 557 | - $corps = calcul_invalideurs($corps, $primary,$boucles, $id_boucle); |
|
| 553 | + $corps = calcul_invalideurs($corps, $primary, $boucles, $id_boucle); |
|
| 558 | 554 | } |
| 559 | 555 | |
| 560 | 556 | // gerer le compteur de boucle |
@@ -629,7 +625,7 @@ discard block |
||
| 629 | 625 | $corps, |
| 630 | 626 | $fin_lang, |
| 631 | 627 | $trace, |
| 632 | - 'BOUCLE' . $id_boucle . ' @ ' . ($boucle->descr['sourcefile']) |
|
| 628 | + 'BOUCLE'.$id_boucle.' @ '.($boucle->descr['sourcefile']) |
|
| 633 | 629 | ); |
| 634 | 630 | |
| 635 | 631 | # var_dump($a);exit; |
@@ -650,20 +646,20 @@ discard block |
||
| 650 | 646 | **/ |
| 651 | 647 | function calculer_requete_sql($boucle) { |
| 652 | 648 | $init = array(); |
| 653 | - $init[] = calculer_dec('table', "'" . $boucle->id_table . "'"); |
|
| 654 | - $init[] = calculer_dec('id', "'" . $boucle->id_boucle . "'"); |
|
| 649 | + $init[] = calculer_dec('table', "'".$boucle->id_table."'"); |
|
| 650 | + $init[] = calculer_dec('id', "'".$boucle->id_boucle."'"); |
|
| 655 | 651 | # En absence de champ c'est un decompte : |
| 656 | 652 | $init[] = calculer_dec('from', calculer_from($boucle)); |
| 657 | 653 | $init[] = calculer_dec('type', calculer_from_type($boucle)); |
| 658 | 654 | $init[] = calculer_dec('groupby', |
| 659 | - 'array(' . (($g = join("\",\n\t\t\"", $boucle->group)) ? '"' . $g . '"' : '') . ")"); |
|
| 660 | - $init[] = calculer_dec('select', 'array("' . join("\",\n\t\t\"", $boucle->select) . "\")"); |
|
| 661 | - $init[] = calculer_dec('orderby', 'array(' . calculer_order($boucle) . ")"); |
|
| 655 | + 'array('.(($g = join("\",\n\t\t\"", $boucle->group)) ? '"'.$g.'"' : '').")"); |
|
| 656 | + $init[] = calculer_dec('select', 'array("'.join("\",\n\t\t\"", $boucle->select)."\")"); |
|
| 657 | + $init[] = calculer_dec('orderby', 'array('.calculer_order($boucle).")"); |
|
| 662 | 658 | $init[] = calculer_dec('where', calculer_dump_array($boucle->where)); |
| 663 | 659 | $init[] = calculer_dec('join', calculer_dump_join($boucle->join)); |
| 664 | 660 | $init[] = calculer_dec('limit', |
| 665 | 661 | (strpos($boucle->limit, 'intval') === false ? |
| 666 | - "'" . $boucle->limit . "'" |
|
| 662 | + "'".$boucle->limit."'" |
|
| 667 | 663 | : |
| 668 | 664 | $boucle->limit)); |
| 669 | 665 | $init[] = calculer_dec('having', calculer_dump_array($boucle->having)); |
@@ -672,17 +668,17 @@ discard block |
||
| 672 | 668 | // ou recalculée à chaque passage (vide) |
| 673 | 669 | foreach ($init as $i) { |
| 674 | 670 | if (reset($i)) { |
| 675 | - $s .= "\n\t\t" . end($i); |
|
| 671 | + $s .= "\n\t\t".end($i); |
|
| 676 | 672 | } # statique |
| 677 | 673 | else { |
| 678 | - $d .= "\n\t" . end($i); |
|
| 674 | + $d .= "\n\t".end($i); |
|
| 679 | 675 | } # dynamique |
| 680 | 676 | } |
| 681 | 677 | |
| 682 | 678 | return ($boucle->hierarchie ? "\n\t$boucle->hierarchie" : '') |
| 683 | 679 | . $boucle->in |
| 684 | 680 | . $boucle->hash |
| 685 | - . "\n\t" . 'if (!isset($command[\'table\'])) {' |
|
| 681 | + . "\n\t".'if (!isset($command[\'table\'])) {' |
|
| 686 | 682 | . $s |
| 687 | 683 | . "\n\t}" |
| 688 | 684 | . $d; |
@@ -765,7 +761,7 @@ discard block |
||
| 765 | 761 | * - index 1 : Code de l'affectation |
| 766 | 762 | **/ |
| 767 | 763 | function calculer_dec($nom, $val) { |
| 768 | - $static = 'if (!isset($command[\'' . $nom . '\'])) '; |
|
| 764 | + $static = 'if (!isset($command[\''.$nom.'\'])) '; |
|
| 769 | 765 | // si une variable apparait dans le calcul de la clause |
| 770 | 766 | // il faut la re-evaluer a chaque passage |
| 771 | 767 | if ( |
@@ -782,7 +778,7 @@ discard block |
||
| 782 | 778 | $static = ""; |
| 783 | 779 | } |
| 784 | 780 | |
| 785 | - return array($static, '$command[\'' . $nom . '\'] = ' . $val . ';'); |
|
| 781 | + return array($static, '$command[\''.$nom.'\'] = '.$val.';'); |
|
| 786 | 782 | } |
| 787 | 783 | |
| 788 | 784 | /** |
@@ -807,17 +803,17 @@ discard block |
||
| 807 | 803 | } |
| 808 | 804 | $res = ""; |
| 809 | 805 | if ($a and $a[0] == "'?'") { |
| 810 | - return ("(" . calculer_dump_array($a[1]) . |
|
| 811 | - " ? " . calculer_dump_array($a[2]) . |
|
| 812 | - " : " . calculer_dump_array($a[3]) . |
|
| 806 | + return ("(".calculer_dump_array($a[1]). |
|
| 807 | + " ? ".calculer_dump_array($a[2]). |
|
| 808 | + " : ".calculer_dump_array($a[3]). |
|
| 813 | 809 | ")"); |
| 814 | 810 | } else { |
| 815 | 811 | foreach ($a as $k => $v) { |
| 816 | - $showk = (is_numeric($k) ? '' : sql_quote($k) . ' => '); |
|
| 817 | - $res .= ", " . $showk . calculer_dump_array($v); |
|
| 812 | + $showk = (is_numeric($k) ? '' : sql_quote($k).' => '); |
|
| 813 | + $res .= ", ".$showk.calculer_dump_array($v); |
|
| 818 | 814 | } |
| 819 | 815 | |
| 820 | - return "\n\t\t\tarray(" . substr($res, 2) . ')'; |
|
| 816 | + return "\n\t\t\tarray(".substr($res, 2).')'; |
|
| 821 | 817 | } |
| 822 | 818 | } |
| 823 | 819 | |
@@ -825,10 +821,10 @@ discard block |
||
| 825 | 821 | function calculer_dump_join($a) { |
| 826 | 822 | $res = ""; |
| 827 | 823 | foreach ($a as $k => $v) { |
| 828 | - $res .= ", '$k' => array(" . implode(',', $v) . ")"; |
|
| 824 | + $res .= ", '$k' => array(".implode(',', $v).")"; |
|
| 829 | 825 | } |
| 830 | 826 | |
| 831 | - return 'array(' . substr($res, 2) . ')'; |
|
| 827 | + return 'array('.substr($res, 2).')'; |
|
| 832 | 828 | } |
| 833 | 829 | |
| 834 | 830 | /** |
@@ -845,7 +841,7 @@ discard block |
||
| 845 | 841 | $res .= ",'$k' => '$v'"; |
| 846 | 842 | } |
| 847 | 843 | |
| 848 | - return 'array(' . substr($res, 1) . ')'; |
|
| 844 | + return 'array('.substr($res, 1).')'; |
|
| 849 | 845 | } |
| 850 | 846 | |
| 851 | 847 | /** |
@@ -863,7 +859,7 @@ discard block |
||
| 863 | 859 | $res .= ",'$k' => '$v'"; |
| 864 | 860 | } |
| 865 | 861 | |
| 866 | - return 'array(' . substr($res, 1) . ')'; |
|
| 862 | + return 'array('.substr($res, 1).')'; |
|
| 867 | 863 | } |
| 868 | 864 | |
| 869 | 865 | // https://code.spip.net/@calculer_order |
@@ -932,17 +928,17 @@ discard block |
||
| 932 | 928 | ) { |
| 933 | 929 | $res .= " .\n$tab$code"; |
| 934 | 930 | } else { |
| 935 | - $res = substr($res, 0, -1) . substr($code, 1); |
|
| 931 | + $res = substr($res, 0, -1).substr($code, 1); |
|
| 936 | 932 | } |
| 937 | 933 | } |
| 938 | 934 | |
| 939 | - return '(' . substr($res, 2 + $descr['niv']) . ')'; |
|
| 935 | + return '('.substr($res, 2 + $descr['niv']).')'; |
|
| 940 | 936 | } |
| 941 | 937 | } else { |
| 942 | - $nom = $descr['nom'] . $id_boucle . ($descr['niv'] ? $descr['niv'] : ''); |
|
| 938 | + $nom = $descr['nom'].$id_boucle.($descr['niv'] ? $descr['niv'] : ''); |
|
| 943 | 939 | |
| 944 | - return "join('', array_map('array_shift', \$GLOBALS['debug_objets']['sequence']['$nom'] = array(" . join(" ,\n$tab", |
|
| 945 | - $codes) . ")))"; |
|
| 940 | + return "join('', array_map('array_shift', \$GLOBALS['debug_objets']['sequence']['$nom'] = array(".join(" ,\n$tab", |
|
| 941 | + $codes).")))"; |
|
| 946 | 942 | } |
| 947 | 943 | } |
| 948 | 944 | |
@@ -971,7 +967,7 @@ discard block |
||
| 971 | 967 | // texte seul |
| 972 | 968 | case 'texte': |
| 973 | 969 | $code = sandbox_composer_texte($p->texte, $p); |
| 974 | - $commentaire = strlen($p->texte) . " signes"; |
|
| 970 | + $commentaire = strlen($p->texte)." signes"; |
|
| 975 | 971 | $avant = ''; |
| 976 | 972 | $apres = ''; |
| 977 | 973 | $altern = "''"; |
@@ -980,14 +976,14 @@ discard block |
||
| 980 | 976 | case 'polyglotte': |
| 981 | 977 | $code = ""; |
| 982 | 978 | foreach ($p->traductions as $k => $v) { |
| 983 | - $code .= ",'" . |
|
| 984 | - str_replace(array("\\", "'"), array("\\\\", "\\'"), $k) . |
|
| 985 | - "' => '" . |
|
| 986 | - str_replace(array("\\", "'"), array("\\\\", "\\'"), $v) . |
|
| 979 | + $code .= ",'". |
|
| 980 | + str_replace(array("\\", "'"), array("\\\\", "\\'"), $k). |
|
| 981 | + "' => '". |
|
| 982 | + str_replace(array("\\", "'"), array("\\\\", "\\'"), $v). |
|
| 987 | 983 | "'"; |
| 988 | 984 | } |
| 989 | - $code = "choisir_traduction(array(" . |
|
| 990 | - substr($code, 1) . |
|
| 985 | + $code = "choisir_traduction(array(". |
|
| 986 | + substr($code, 1). |
|
| 991 | 987 | "))"; |
| 992 | 988 | $commentaire = '&'; |
| 993 | 989 | $avant = ''; |
@@ -1003,7 +999,7 @@ discard block |
||
| 1003 | 999 | $err_e_c = true; |
| 1004 | 1000 | $code = "''"; |
| 1005 | 1001 | } else { |
| 1006 | - $commentaire = '<INCLURE ' . addslashes(str_replace("\n", ' ', $code)) . '>'; |
|
| 1002 | + $commentaire = '<INCLURE '.addslashes(str_replace("\n", ' ', $code)).'>'; |
|
| 1007 | 1003 | $avant = ''; |
| 1008 | 1004 | $apres = ''; |
| 1009 | 1005 | $altern = "''"; |
@@ -1030,8 +1026,8 @@ discard block |
||
| 1030 | 1026 | $err_e_c = true; |
| 1031 | 1027 | $code = "''"; |
| 1032 | 1028 | } else { |
| 1033 | - $code = 'BOUCLE' . |
|
| 1034 | - str_replace("-", "_", $nom) . $descr['nom'] . |
|
| 1029 | + $code = 'BOUCLE'. |
|
| 1030 | + str_replace("-", "_", $nom).$descr['nom']. |
|
| 1035 | 1031 | '($Cache, $Pile, $doublons, $Numrows, $SP)'; |
| 1036 | 1032 | $commentaire = "?$nom"; |
| 1037 | 1033 | if (!$boucles[$nom]->milieu |
@@ -1072,24 +1068,22 @@ discard block |
||
| 1072 | 1068 | foreach ($p->arg as $k => $v) { |
| 1073 | 1069 | $_v = calculer_liste($v, $descr, $boucles, $id_boucle); |
| 1074 | 1070 | if ($k) { |
| 1075 | - $l[] = _q($k) . ' => ' . $_v; |
|
| 1071 | + $l[] = _q($k).' => '.$_v; |
|
| 1076 | 1072 | } else { |
| 1077 | 1073 | $code = $_v; |
| 1078 | 1074 | } |
| 1079 | 1075 | } |
| 1080 | 1076 | // Si le module n'est pas fourni, l'expliciter sauf si calculé |
| 1081 | 1077 | if ($p->module) { |
| 1082 | - $m = $p->module . ':' . $p->nom_champ; |
|
| 1078 | + $m = $p->module.':'.$p->nom_champ; |
|
| 1083 | 1079 | } elseif ($p->nom_champ) { |
| 1084 | - $m = MODULES_IDIOMES . ':' . $p->nom_champ; |
|
| 1080 | + $m = MODULES_IDIOMES.':'.$p->nom_champ; |
|
| 1085 | 1081 | } else { |
| 1086 | 1082 | $m = ''; |
| 1087 | 1083 | } |
| 1088 | 1084 | |
| 1089 | - $code = (!$code ? "'$m'" : |
|
| 1090 | - ($m ? "'$m' . $code" : |
|
| 1091 | - ("(strpos(\$x=$code, ':') ? \$x : ('" . MODULES_IDIOMES . ":' . \$x))"))) |
|
| 1092 | - . (!$l ? '' : (", array(" . implode(",\n", $l) . ")")); |
|
| 1085 | + $code = (!$code ? "'$m'" : ($m ? "'$m' . $code" : ("(strpos(\$x=$code, ':') ? \$x : ('".MODULES_IDIOMES.":' . \$x))"))) |
|
| 1086 | + . (!$l ? '' : (", array(".implode(",\n", $l).")")); |
|
| 1093 | 1087 | $code = "_T($code)"; |
| 1094 | 1088 | if ($p->param) { |
| 1095 | 1089 | $p->id_boucle = $id_boucle; |
@@ -1112,7 +1106,7 @@ discard block |
||
| 1112 | 1106 | $p->type_requete = $type; |
| 1113 | 1107 | |
| 1114 | 1108 | $code = calculer_champ($p); |
| 1115 | - $commentaire = '#' . $p->nom_champ . $p->etoile; |
|
| 1109 | + $commentaire = '#'.$p->nom_champ.$p->etoile; |
|
| 1116 | 1110 | $avant = calculer_liste($p->avant, |
| 1117 | 1111 | $descr, $boucles, $id_boucle); |
| 1118 | 1112 | $apres = calculer_liste($p->apres, |
@@ -1143,10 +1137,9 @@ discard block |
||
| 1143 | 1137 | if ($code != "''") { |
| 1144 | 1138 | $code = compile_retour($code, $avant, $apres, $altern, $tab, $descr['niv']); |
| 1145 | 1139 | $codes[] = (($mode == 'validation') ? |
| 1146 | - "array($code, '$commentaire', " . $p->ligne . ")" |
|
| 1140 | + "array($code, '$commentaire', ".$p->ligne.")" |
|
| 1147 | 1141 | : (($mode == 'code') ? |
| 1148 | - "\n// $commentaire\n$code" : |
|
| 1149 | - $code)); |
|
| 1142 | + "\n// $commentaire\n$code" : $code)); |
|
| 1150 | 1143 | } |
| 1151 | 1144 | } // foreach |
| 1152 | 1145 | |
@@ -1197,28 +1190,28 @@ discard block |
||
| 1197 | 1190 | if ($apres === "''") { |
| 1198 | 1191 | $apres = ''; |
| 1199 | 1192 | } |
| 1200 | - if ($avant or $apres or ($altern !== "''")){ |
|
| 1201 | - if (preg_match(_REGEXP_CONCAT_NON_VIDE, $code)){ |
|
| 1193 | + if ($avant or $apres or ($altern !== "''")) { |
|
| 1194 | + if (preg_match(_REGEXP_CONCAT_NON_VIDE, $code)) { |
|
| 1202 | 1195 | $t = $code; |
| 1203 | 1196 | $cond = ''; |
| 1204 | 1197 | } elseif (preg_match(_REGEXP_COND_VIDE_NONVIDE, $code, $r)) { |
| 1205 | 1198 | $t = $r[2]; |
| 1206 | - $cond = '!' . $r[1]; |
|
| 1199 | + $cond = '!'.$r[1]; |
|
| 1207 | 1200 | } else { |
| 1208 | - if (preg_match(_REGEXP_COND_NONVIDE_VIDE, $code, $r)){ |
|
| 1201 | + if (preg_match(_REGEXP_COND_NONVIDE_VIDE, $code, $r)) { |
|
| 1209 | 1202 | $t = $r[2]; |
| 1210 | 1203 | $cond = $r[1]; |
| 1211 | 1204 | } else { |
| 1212 | - $t = '$t' . $n; |
|
| 1205 | + $t = '$t'.$n; |
|
| 1213 | 1206 | $cond = "($t = $code)!==''"; |
| 1214 | 1207 | } |
| 1215 | 1208 | } |
| 1216 | 1209 | |
| 1217 | - $res = (!$avant ? "" : "$avant . ") . |
|
| 1218 | - $t . |
|
| 1210 | + $res = (!$avant ? "" : "$avant . "). |
|
| 1211 | + $t. |
|
| 1219 | 1212 | (!$apres ? "" : " . $apres"); |
| 1220 | 1213 | |
| 1221 | - if ($res!==$t){ |
|
| 1214 | + if ($res !== $t) { |
|
| 1222 | 1215 | $res = "($res)"; |
| 1223 | 1216 | } |
| 1224 | 1217 | |
@@ -1268,12 +1261,12 @@ discard block |
||
| 1268 | 1261 | |
| 1269 | 1262 | // rendre inertes les echappements de #[](){}<> |
| 1270 | 1263 | $i = 0; |
| 1271 | - while (false !== strpos($squelette, $inerte = '-INERTE' . $i)) { |
|
| 1264 | + while (false !== strpos($squelette, $inerte = '-INERTE'.$i)) { |
|
| 1272 | 1265 | $i++; |
| 1273 | 1266 | } |
| 1274 | 1267 | $squelette = preg_replace_callback(',\\\\([#[()\]{}<>]),', |
| 1275 | 1268 | function($a) use ($inerte) { |
| 1276 | - return "$inerte-" . ord($a[1]) . '-'; |
|
| 1269 | + return "$inerte-".ord($a[1]).'-'; |
|
| 1277 | 1270 | }, |
| 1278 | 1271 | $squelette, |
| 1279 | 1272 | -1, |
@@ -1290,7 +1283,7 @@ discard block |
||
| 1290 | 1283 | // Phraser le squelette, selon sa grammaire |
| 1291 | 1284 | |
| 1292 | 1285 | $boucles = array(); |
| 1293 | - $f = charger_fonction('phraser_' . $gram, 'public'); |
|
| 1286 | + $f = charger_fonction('phraser_'.$gram, 'public'); |
|
| 1294 | 1287 | |
| 1295 | 1288 | $squelette = $f($squelette, '', $boucles, $descr); |
| 1296 | 1289 | |
@@ -1309,7 +1302,7 @@ discard block |
||
| 1309 | 1302 | $boucles[$i]->descr['squelette'] = preg_replace_callback( |
| 1310 | 1303 | ",$inerte-(\d+)-,", |
| 1311 | 1304 | function($a) { |
| 1312 | - return "\\\\" . chr($a[1]); |
|
| 1305 | + return "\\\\".chr($a[1]); |
|
| 1313 | 1306 | }, |
| 1314 | 1307 | $boucle->descr['squelette'] |
| 1315 | 1308 | ); |
@@ -1321,19 +1314,19 @@ discard block |
||
| 1321 | 1314 | include_spip('public/decompiler'); |
| 1322 | 1315 | foreach ($boucles as $id => $boucle) { |
| 1323 | 1316 | if ($id) { |
| 1324 | - $decomp = "\n/* BOUCLE " . |
|
| 1325 | - $boucle->type_requete . |
|
| 1326 | - " " . |
|
| 1327 | - str_replace('*/', '* /', public_decompiler($boucle, $gram, 0, 'criteres')) . |
|
| 1328 | - ($boucle->debug ? "\n *\n * " . implode("\n * ", $boucle->debug) . "\n" : '') . |
|
| 1317 | + $decomp = "\n/* BOUCLE ". |
|
| 1318 | + $boucle->type_requete. |
|
| 1319 | + " ". |
|
| 1320 | + str_replace('*/', '* /', public_decompiler($boucle, $gram, 0, 'criteres')). |
|
| 1321 | + ($boucle->debug ? "\n *\n * ".implode("\n * ", $boucle->debug)."\n" : ''). |
|
| 1329 | 1322 | " */\n"; |
| 1330 | 1323 | } else { |
| 1331 | - $decomp = ("\n/*\n" . |
|
| 1324 | + $decomp = ("\n/*\n". |
|
| 1332 | 1325 | str_replace('*/', '* /', public_decompiler($squelette, $gram)) |
| 1333 | 1326 | . "\n*/"); |
| 1334 | 1327 | } |
| 1335 | - $boucles[$id]->return = $decomp . $boucle->return; |
|
| 1336 | - $GLOBALS['debug_objets']['code'][$nom . $id] = $boucle->return; |
|
| 1328 | + $boucles[$id]->return = $decomp.$boucle->return; |
|
| 1329 | + $GLOBALS['debug_objets']['code'][$nom.$id] = $boucle->return; |
|
| 1337 | 1330 | } |
| 1338 | 1331 | } |
| 1339 | 1332 | |
@@ -1356,7 +1349,7 @@ discard block |
||
| 1356 | 1349 | } |
| 1357 | 1350 | } |
| 1358 | 1351 | foreach ($boucles as $id => $boucle) { |
| 1359 | - $GLOBALS['debug_objets']['boucle'][$nom . $id] = $boucle; |
|
| 1352 | + $GLOBALS['debug_objets']['boucle'][$nom.$id] = $boucle; |
|
| 1360 | 1353 | } |
| 1361 | 1354 | $descr['documents'] = compile_inclure_doublons($squelette); |
| 1362 | 1355 | |
@@ -1440,8 +1433,7 @@ discard block |
||
| 1440 | 1433 | } else { |
| 1441 | 1434 | $boucles[$id]->type_requete = false; |
| 1442 | 1435 | $boucle = $boucles[$id]; |
| 1443 | - $x = (!$boucle->sql_serveur ? '' : |
|
| 1444 | - ($boucle->sql_serveur . ":")) . |
|
| 1436 | + $x = (!$boucle->sql_serveur ? '' : ($boucle->sql_serveur.":")). |
|
| 1445 | 1437 | $type; |
| 1446 | 1438 | $msg = array( |
| 1447 | 1439 | 'zbug_table_inconnue', |
@@ -1527,13 +1519,13 @@ discard block |
||
| 1527 | 1519 | if ( |
| 1528 | 1520 | // fonction de boucle avec serveur & table |
| 1529 | 1521 | (!$serveur or |
| 1530 | - ((!function_exists($f = "boucle_" . $serveur . "_" . $table)) |
|
| 1531 | - and (!function_exists($f = $f . "_dist")) |
|
| 1522 | + ((!function_exists($f = "boucle_".$serveur."_".$table)) |
|
| 1523 | + and (!function_exists($f = $f."_dist")) |
|
| 1532 | 1524 | ) |
| 1533 | 1525 | ) |
| 1534 | 1526 | // fonction de boucle avec table |
| 1535 | - and (!function_exists($f = "boucle_" . $table)) |
|
| 1536 | - and (!function_exists($f = $f . "_dist")) |
|
| 1527 | + and (!function_exists($f = "boucle_".$table)) |
|
| 1528 | + and (!function_exists($f = $f."_dist")) |
|
| 1537 | 1529 | ) { |
| 1538 | 1530 | // fonction de boucle standard |
| 1539 | 1531 | if (!function_exists($f = 'boucle_DEFAUT')) { |
@@ -1541,20 +1533,20 @@ discard block |
||
| 1541 | 1533 | } |
| 1542 | 1534 | } |
| 1543 | 1535 | |
| 1544 | - $req = "\n\n\tstatic \$command = array();\n\t" . |
|
| 1545 | - "static \$connect;\n\t" . |
|
| 1546 | - "\$command['connect'] = \$connect = " . |
|
| 1547 | - _q($boucle->sql_serveur) . |
|
| 1548 | - ";" . |
|
| 1536 | + $req = "\n\n\tstatic \$command = array();\n\t". |
|
| 1537 | + "static \$connect;\n\t". |
|
| 1538 | + "\$command['connect'] = \$connect = ". |
|
| 1539 | + _q($boucle->sql_serveur). |
|
| 1540 | + ";". |
|
| 1549 | 1541 | $f($id, $boucles); |
| 1550 | 1542 | } else { |
| 1551 | 1543 | $req = ("\n\treturn '';"); |
| 1552 | 1544 | } |
| 1553 | 1545 | |
| 1554 | 1546 | $boucles[$id]->return = |
| 1555 | - "\n\nfunction BOUCLE" . strtr($id, "-", "_") . $nom . |
|
| 1556 | - '(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {' . |
|
| 1557 | - $req . |
|
| 1547 | + "\n\nfunction BOUCLE".strtr($id, "-", "_").$nom. |
|
| 1548 | + '(&$Cache, &$Pile, &$doublons, &$Numrows, $SP) {'. |
|
| 1549 | + $req. |
|
| 1558 | 1550 | "\n}\n"; |
| 1559 | 1551 | } |
| 1560 | 1552 | |
@@ -1564,7 +1556,7 @@ discard block |
||
| 1564 | 1556 | return false; |
| 1565 | 1557 | } |
| 1566 | 1558 | |
| 1567 | - $principal = "\nfunction " . $nom . '($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { |
|
| 1559 | + $principal = "\nfunction ".$nom.'($Cache, $Pile, $doublons = array(), $Numrows = array(), $SP = 0) { |
|
| 1568 | 1560 | ' |
| 1569 | 1561 | // reporter de maniere securisee les doublons inclus |
| 1570 | 1562 | . ' |
@@ -1572,15 +1564,15 @@ discard block |
||
| 1572 | 1564 | $doublons = nettoyer_env_doublons($Pile[0]["doublons"]); |
| 1573 | 1565 | |
| 1574 | 1566 | $connect = ' . |
| 1575 | - _q($connect) . '; |
|
| 1567 | + _q($connect).'; |
|
| 1576 | 1568 | $page = ' . |
| 1577 | 1569 | // ATTENTION, le calcul de l'expression $corps affectera $Cache |
| 1578 | 1570 | // c'est pourquoi on l'affecte a la variable auxiliaire $page. |
| 1579 | 1571 | // avant de referencer $Cache |
| 1580 | - $corps . "; |
|
| 1572 | + $corps."; |
|
| 1581 | 1573 | |
| 1582 | 1574 | return analyse_resultat_skel(" . var_export($nom, true) |
| 1583 | - . ", \$Cache, \$page, " . var_export($sourcefile, true) . "); |
|
| 1575 | + . ", \$Cache, \$page, ".var_export($sourcefile, true)."); |
|
| 1584 | 1576 | }"; |
| 1585 | 1577 | |
| 1586 | 1578 | $secondes = spip_timer('calcul_skel'); |
@@ -1594,10 +1586,10 @@ discard block |
||
| 1594 | 1586 | $code->return = ' |
| 1595 | 1587 | // |
| 1596 | 1588 | // Fonction principale du squelette ' . |
| 1597 | - $sourcefile . |
|
| 1598 | - ($connect ? " pour $connect" : '') . |
|
| 1599 | - (!CODE_COMMENTE ? '' : "\n// Temps de compilation total: $secondes") . |
|
| 1600 | - "\n//\n" . |
|
| 1589 | + $sourcefile. |
|
| 1590 | + ($connect ? " pour $connect" : ''). |
|
| 1591 | + (!CODE_COMMENTE ? '' : "\n// Temps de compilation total: $secondes"). |
|
| 1592 | + "\n//\n". |
|
| 1601 | 1593 | $principal; |
| 1602 | 1594 | |
| 1603 | 1595 | $boucles[''] = $code; |
@@ -1649,7 +1641,7 @@ discard block |
||
| 1649 | 1641 | **/ |
| 1650 | 1642 | function requeteur_data_dist(&$boucles, &$boucle, &$id) { |
| 1651 | 1643 | include_spip('iterateur/data'); |
| 1652 | - if ($h = charger_fonction($boucle->type_requete . '_to_array', 'inc', true)) { |
|
| 1644 | + if ($h = charger_fonction($boucle->type_requete.'_to_array', 'inc', true)) { |
|
| 1653 | 1645 | $g = charger_fonction('data', 'iterateur'); |
| 1654 | 1646 | $boucles[$id] = $g($boucle); |
| 1655 | 1647 | // from[0] stocke le type de data (rss, yql, ...) |