@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | |
| 40 | 40 | if ($notification = charger_fonction($quoi, 'notifications', true)) { |
| 41 | 41 | spip_log("$notification($quoi,$id" |
| 42 | - . ($options ? "," . serialize($options) : "") |
|
| 42 | + . ($options ? ",".serialize($options) : "") |
|
| 43 | 43 | . ")", 'notifications'); |
| 44 | 44 | $notification($quoi, $id, $options); |
| 45 | 45 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | ); |
| 156 | 156 | $email = $envoi['email']; |
| 157 | 157 | |
| 158 | - job_queue_add('envoyer_mail', ">$email : " . $envoi['sujet'], |
|
| 158 | + job_queue_add('envoyer_mail', ">$email : ".$envoi['sujet'], |
|
| 159 | 159 | array($email, $envoi['sujet'], $envoi['texte'], $envoi['from'], $envoi['headers']), 'inc/'); |
| 160 | 160 | } |
| 161 | 161 | |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | static $dirs = array(); |
| 42 | 42 | $liste = array(); |
| 43 | 43 | foreach (creer_chemin() as $dir) { |
| 44 | - if (!isset($dirs[$a = $dir . $dirname])) { |
|
| 44 | + if (!isset($dirs[$a = $dir.$dirname])) { |
|
| 45 | 45 | $dirs[$a] = (is_dir($a) || !$a); |
| 46 | 46 | } |
| 47 | 47 | if ($dirs[$a]) { |
@@ -67,20 +67,20 @@ discard block |
||
| 67 | 67 | **/ |
| 68 | 68 | function chercher_module_lang($module, $lang = '') { |
| 69 | 69 | if ($lang) { |
| 70 | - $lang = '_' . $lang; |
|
| 70 | + $lang = '_'.$lang; |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // 1) dans un repertoire nomme lang/ se trouvant sur le chemin |
| 74 | 74 | if ($f = ($module == 'local' |
| 75 | - ? find_in_path($module . $lang . '.php', 'lang/') |
|
| 76 | - : find_langs_in_path($module . $lang . '.php', 'lang/')) |
|
| 75 | + ? find_in_path($module.$lang.'.php', 'lang/') |
|
| 76 | + : find_langs_in_path($module.$lang.'.php', 'lang/')) |
|
| 77 | 77 | ) { |
| 78 | 78 | return is_array($f) ? $f : array($f); |
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | // 2) directement dans le chemin (old style, uniquement pour local) |
| 82 | 82 | return (($module == 'local') or strpos($module, '/')) |
| 83 | - ? (($f = find_in_path($module . $lang . '.php')) ? array($f) : false) |
|
| 83 | + ? (($f = find_in_path($module.$lang.'.php')) ? array($f) : false) |
|
| 84 | 84 | : false; |
| 85 | 85 | } |
| 86 | 86 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | **/ |
| 105 | 105 | function charger_langue($lang, $module = 'spip') { |
| 106 | 106 | static $langs = array(); |
| 107 | - $var = 'i18n_' . $module . '_' . $lang; |
|
| 107 | + $var = 'i18n_'.$module.'_'.$lang; |
|
| 108 | 108 | if (!isset($langs[$lang])) { |
| 109 | 109 | $langs[$lang] = array(); |
| 110 | 110 | if ($lang) { |
@@ -119,13 +119,13 @@ discard block |
||
| 119 | 119 | } |
| 120 | 120 | foreach ($langs[$lang] as $l) { |
| 121 | 121 | if ($fichiers_lang = chercher_module_lang($module, $l)) { |
| 122 | - $GLOBALS['idx_lang'] = 'i18n_' . $module . '_' . $l; |
|
| 122 | + $GLOBALS['idx_lang'] = 'i18n_'.$module.'_'.$l; |
|
| 123 | 123 | include(array_shift($fichiers_lang)); |
| 124 | 124 | surcharger_langue($fichiers_lang); |
| 125 | 125 | if ($l !== $lang) { |
| 126 | - $GLOBALS[$var] = &$GLOBALS['i18n_' . $module . '_' . $l]; |
|
| 126 | + $GLOBALS[$var] = &$GLOBALS['i18n_'.$module.'_'.$l]; |
|
| 127 | 127 | } |
| 128 | - $GLOBALS['lang_' . $var] = $l; |
|
| 128 | + $GLOBALS['lang_'.$var] = $l; |
|
| 129 | 129 | #spip_log("module de langue : ${module}_$l.php", 'traduire'); |
| 130 | 130 | break; |
| 131 | 131 | } |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | foreach ($fichiers as $fichier) { |
| 164 | 164 | if (!isset($surcharges[$fichier])) { |
| 165 | 165 | $idx_lang_normal = $GLOBALS['idx_lang']; |
| 166 | - $GLOBALS['idx_lang'] = $GLOBALS['idx_lang'] . '@temporaire'; |
|
| 166 | + $GLOBALS['idx_lang'] = $GLOBALS['idx_lang'].'@temporaire'; |
|
| 167 | 167 | include($fichier); |
| 168 | 168 | $surcharges[$fichier] = $GLOBALS[$GLOBALS['idx_lang']]; |
| 169 | 169 | unset($GLOBALS[$GLOBALS['idx_lang']]); |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | } |
| 172 | 172 | if (is_array($surcharges[$fichier])) { |
| 173 | 173 | $GLOBALS[$GLOBALS['idx_lang']] = array_merge( |
| 174 | - (isset($GLOBALS[$GLOBALS['idx_lang']]) ? (array)$GLOBALS[$GLOBALS['idx_lang']] : array()), |
|
| 174 | + (isset($GLOBALS[$GLOBALS['idx_lang']]) ? (array) $GLOBALS[$GLOBALS['idx_lang']] : array()), |
|
| 175 | 175 | $surcharges[$fichier] |
| 176 | 176 | ); |
| 177 | 177 | } |
@@ -249,27 +249,27 @@ discard block |
||
| 249 | 249 | } else { |
| 250 | 250 | $modules = array('spip', 'ecrire'); |
| 251 | 251 | $code = $ori; |
| 252 | - $ori_complet = implode('|', $modules) . ':' . $ori; |
|
| 252 | + $ori_complet = implode('|', $modules).':'.$ori; |
|
| 253 | 253 | } |
| 254 | 254 | |
| 255 | 255 | $desc = new SPIP_Traductions_Description(); |
| 256 | 256 | |
| 257 | 257 | // parcourir tous les modules jusqu'a ce qu'on trouve |
| 258 | 258 | foreach ($modules as $module) { |
| 259 | - $var = "i18n_" . $module . "_" . $lang; |
|
| 259 | + $var = "i18n_".$module."_".$lang; |
|
| 260 | 260 | |
| 261 | 261 | if (empty($GLOBALS[$var])) { |
| 262 | 262 | charger_langue($lang, $module); |
| 263 | 263 | // surcharges persos -- on cherche |
| 264 | 264 | // (lang/)local_xx.php et/ou (lang/)local.php ... |
| 265 | - if (!isset($local['local_' . $lang])) { |
|
| 265 | + if (!isset($local['local_'.$lang])) { |
|
| 266 | 266 | // redéfinir la langue en cours pour les surcharges (chercher_langue a pu le changer) |
| 267 | 267 | $GLOBALS['idx_lang'] = $var; |
| 268 | 268 | // ... (lang/)local_xx.php |
| 269 | - $local['local_' . $lang] = chercher_module_lang('local', $lang); |
|
| 269 | + $local['local_'.$lang] = chercher_module_lang('local', $lang); |
|
| 270 | 270 | } |
| 271 | - if ($local['local_' . $lang]) { |
|
| 272 | - surcharger_langue($local['local_' . $lang]); |
|
| 271 | + if ($local['local_'.$lang]) { |
|
| 272 | + surcharger_langue($local['local_'.$lang]); |
|
| 273 | 273 | } |
| 274 | 274 | // ... puis (lang/)local.php |
| 275 | 275 | if (!isset($local['local'])) { |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | if (isset($GLOBALS[$var][$code])) { |
| 284 | 284 | $desc->code = $code; |
| 285 | 285 | $desc->module = $module; |
| 286 | - $desc->langue = $GLOBALS['lang_' . $var]; |
|
| 286 | + $desc->langue = $GLOBALS['lang_'.$var]; |
|
| 287 | 287 | $desc->texte = $GLOBALS[$var][$code]; |
| 288 | 288 | break; |
| 289 | 289 | } |
@@ -337,13 +337,13 @@ discard block |
||
| 337 | 337 | if (!$desc->mode and $desc->texte) { |
| 338 | 338 | // ne pas modifier 2 fois l'affichage |
| 339 | 339 | $desc->mode = 'traduction'; |
| 340 | - $classe = 'debug-traduction' . ($desc->module == 'ecrire' ? '-prive' : ''); |
|
| 340 | + $classe = 'debug-traduction'.($desc->module == 'ecrire' ? '-prive' : ''); |
|
| 341 | 341 | $desc->texte = '<span ' |
| 342 | - . 'lang=' . $desc->langue |
|
| 343 | - . ' class=' . $classe |
|
| 344 | - . ' data-module=' . $desc->module |
|
| 345 | - . ' data-code=' . $desc->code |
|
| 346 | - . ' title=' . $modules . '(' . $desc->langue . ')>' |
|
| 342 | + . 'lang='.$desc->langue |
|
| 343 | + . ' class='.$classe |
|
| 344 | + . ' data-module='.$desc->module |
|
| 345 | + . ' data-code='.$desc->code |
|
| 346 | + . ' title='.$modules.'('.$desc->langue.')>' |
|
| 347 | 347 | . $desc->texte |
| 348 | 348 | . '</span>'; |
| 349 | 349 | $desc->texte = str_replace( |
@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | function generer_nom_fichier_cache($contexte, $page) { |
| 30 | 30 | $u = md5(var_export(array($contexte, $page), true)); |
| 31 | 31 | |
| 32 | - return $u . ".cache"; |
|
| 32 | + return $u.".cache"; |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | /** |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | function cache_chemin_fichier($nom_cache, $ecrire = false) { |
| 48 | 48 | static $l1, $l2; |
| 49 | 49 | if (is_null($l1)) { |
| 50 | - $length = (defined('_CACHE_PROFONDEUR_STOCKAGE') ? min(8,max(_CACHE_PROFONDEUR_STOCKAGE,2)) : 4); |
|
| 50 | + $length = (defined('_CACHE_PROFONDEUR_STOCKAGE') ? min(8, max(_CACHE_PROFONDEUR_STOCKAGE, 2)) : 4); |
|
| 51 | 51 | $l1 = intval(floor($length / 2)); |
| 52 | 52 | $l2 = $length - $l1; |
| 53 | 53 | } |
@@ -61,10 +61,10 @@ discard block |
||
| 61 | 61 | } |
| 62 | 62 | else { |
| 63 | 63 | // en lecture on essaye pa de creer les repertoires, on va au plus vite |
| 64 | - $rep = _DIR_CACHE . "$d/"; |
|
| 64 | + $rep = _DIR_CACHE."$d/"; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - return $rep . $u . ".cache"; |
|
| 67 | + return $rep.$u.".cache"; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | /** |
@@ -111,7 +111,7 @@ discard block |
||
| 111 | 111 | ), 'non'); |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - return crc32($GLOBALS['meta']['cache_signature'] . $page['texte']); |
|
| 114 | + return crc32($GLOBALS['meta']['cache_signature'].$page['texte']); |
|
| 115 | 115 | } |
| 116 | 116 | |
| 117 | 117 | /** |
@@ -265,7 +265,7 @@ discard block |
||
| 265 | 265 | // "cache sessionne" ; sa date indique la date de validite |
| 266 | 266 | // des caches sessionnes |
| 267 | 267 | if (!$tmp = lire_cache($chemin_cache)) { |
| 268 | - spip_log('Creation cache sessionne ' . $chemin_cache); |
|
| 268 | + spip_log('Creation cache sessionne '.$chemin_cache); |
|
| 269 | 269 | $tmp = array( |
| 270 | 270 | 'invalideurs' => array('session' => ''), |
| 271 | 271 | 'lastmodified' => $_SERVER['REQUEST_TIME'] |
@@ -289,8 +289,8 @@ discard block |
||
| 289 | 289 | // l'enregistrer, compresse ou non... |
| 290 | 290 | $ok = ecrire_cache($chemin_cache, $pagez); |
| 291 | 291 | |
| 292 | - spip_log((_IS_BOT ? "Bot:" : "") . "Creation du cache $chemin_cache pour " |
|
| 293 | - . $page['entetes']['X-Spip-Cache'] . " secondes" . ($ok ? '' : ' (erreur!)'), _LOG_INFO); |
|
| 292 | + spip_log((_IS_BOT ? "Bot:" : "")."Creation du cache $chemin_cache pour " |
|
| 293 | + . $page['entetes']['X-Spip-Cache']." secondes".($ok ? '' : ' (erreur!)'), _LOG_INFO); |
|
| 294 | 294 | |
| 295 | 295 | // Inserer ses invalideurs |
| 296 | 296 | include_spip('inc/invalideur'); |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | function nettoyer_petit_cache($prefix, $duree = 300) { |
| 313 | 313 | // determiner le repertoire a purger : 'tmp/CACHE/rech/' |
| 314 | 314 | $dircache = sous_repertoire(_DIR_CACHE, $prefix); |
| 315 | - if (spip_touch($dircache . 'purger_' . $prefix, $duree, true)) { |
|
| 315 | + if (spip_touch($dircache.'purger_'.$prefix, $duree, true)) { |
|
| 316 | 316 | foreach (preg_files($dircache, '[.]txt$') as $f) { |
| 317 | 317 | if ($_SERVER['REQUEST_TIME'] - (@file_exists($f) ? @filemtime($f) : 0) > $duree) { |
| 318 | 318 | spip_unlink($f); |
@@ -402,9 +402,9 @@ discard block |
||
| 402 | 402 | if (spip_connect()) { |
| 403 | 403 | include_spip('inc/invalideur'); |
| 404 | 404 | retire_caches($chemin_cache); # API invalideur inutile |
| 405 | - supprimer_fichier(_DIR_CACHE . $chemin_cache); |
|
| 405 | + supprimer_fichier(_DIR_CACHE.$chemin_cache); |
|
| 406 | 406 | if (isset($chemin_cache_session) and $chemin_cache_session) { |
| 407 | - supprimer_fichier(_DIR_CACHE . $chemin_cache_session); |
|
| 407 | + supprimer_fichier(_DIR_CACHE.$chemin_cache_session); |
|
| 408 | 408 | } |
| 409 | 409 | } |
| 410 | 410 | } |
@@ -419,9 +419,9 @@ discard block |
||
| 419 | 419 | $page = array('contexte_implicite' => $contexte_implicite); // ignorer le cache deja lu |
| 420 | 420 | include_spip('inc/invalideur'); |
| 421 | 421 | retire_caches($chemin_cache); # API invalideur inutile |
| 422 | - supprimer_fichier(_DIR_CACHE . $chemin_cache); |
|
| 422 | + supprimer_fichier(_DIR_CACHE.$chemin_cache); |
|
| 423 | 423 | if (isset($chemin_cache_session) and $chemin_cache_session) { |
| 424 | - supprimer_fichier(_DIR_CACHE . $chemin_cache_session); |
|
| 424 | + supprimer_fichier(_DIR_CACHE.$chemin_cache_session); |
|
| 425 | 425 | } |
| 426 | 426 | } |
| 427 | 427 | |
@@ -38,7 +38,7 @@ discard block |
||
| 38 | 38 | $champ = preg_replace(',[\s]+,ms', ' ', $champ); |
| 39 | 39 | $champ = str_replace('"', '""', $champ); |
| 40 | 40 | |
| 41 | - return '"' . $champ . '"'; |
|
| 41 | + return '"'.$champ.'"'; |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
@@ -54,11 +54,11 @@ discard block |
||
| 54 | 54 | * @param callable $callback |
| 55 | 55 | * @return string |
| 56 | 56 | */ |
| 57 | -function exporter_csv_ligne_numerotee($nb, $ligne, $delim = ',', $importer_charset = null, $callback=null) { |
|
| 57 | +function exporter_csv_ligne_numerotee($nb, $ligne, $delim = ',', $importer_charset = null, $callback = null) { |
|
| 58 | 58 | if ($callback) { |
| 59 | 59 | $ligne = call_user_func($callback, $nb, $ligne, $delim, $importer_charset); |
| 60 | 60 | } |
| 61 | - $output = join($delim, array_map('exporter_csv_champ', $ligne)) . "\r\n"; |
|
| 61 | + $output = join($delim, array_map('exporter_csv_champ', $ligne))."\r\n"; |
|
| 62 | 62 | if ($importer_charset) { |
| 63 | 63 | $output = str_replace('’', '\'', $output); |
| 64 | 64 | $output = unicode2charset(html2unicode(charset2unicode($output)), $importer_charset); |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | * @param null $importer_charset |
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | -function exporter_csv_ligne($ligne, $delim = ',', $importer_charset = null){ |
|
| 77 | +function exporter_csv_ligne($ligne, $delim = ',', $importer_charset = null) { |
|
| 78 | 78 | return exporter_csv_ligne_numerotee(null, $ligne, $delim, $importer_charset); |
| 79 | 79 | } |
| 80 | 80 | |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | $fichier = "php://output"; |
| 176 | 176 | } |
| 177 | 177 | else { |
| 178 | - $fichier = sous_repertoire(_DIR_CACHE, 'export') . $filename; |
|
| 178 | + $fichier = sous_repertoire(_DIR_CACHE, 'export').$filename; |
|
| 179 | 179 | } |
| 180 | 180 | |
| 181 | 181 | $fp = fopen($fichier, 'w'); |
@@ -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; |
@@ -46,10 +46,9 @@ discard block |
||
| 46 | 46 | $not = $crit->not; |
| 47 | 47 | $boucle = &$boucles[$idb]; |
| 48 | 48 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 49 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 50 | - 'id_parent'; |
|
| 49 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 51 | 50 | |
| 52 | - $c = array("'='", "'$boucle->id_table." . "$id_parent'", 0); |
|
| 51 | + $c = array("'='", "'$boucle->id_table."."$id_parent'", 0); |
|
| 53 | 52 | $boucle->where[] = ($crit->not ? array("'NOT'", $c) : $c); |
| 54 | 53 | } |
| 55 | 54 | |
@@ -72,10 +71,10 @@ discard block |
||
| 72 | 71 | $id = $boucle->primary; |
| 73 | 72 | |
| 74 | 73 | if ($not or !$id) { |
| 75 | - return (array('zbug_critere_inconnu', array('critere' => $not . $crit->op))); |
|
| 74 | + return (array('zbug_critere_inconnu', array('critere' => $not.$crit->op))); |
|
| 76 | 75 | } |
| 77 | 76 | $arg = kwote(calculer_argument_precedent($idb, $id, $boucles)); |
| 78 | - $boucle->where[] = array("'!='", "'$boucle->id_table." . "$id'", $arg); |
|
| 77 | + $boucle->where[] = array("'!='", "'$boucle->id_table."."$id'", $arg); |
|
| 79 | 78 | } |
| 80 | 79 | |
| 81 | 80 | |
@@ -106,12 +105,12 @@ discard block |
||
| 106 | 105 | $not = ($crit->not ? '' : 'NOT'); |
| 107 | 106 | |
| 108 | 107 | // le doublon s'applique sur un type de boucle (article) |
| 109 | - $nom = "'" . $boucle->type_requete . "'"; |
|
| 108 | + $nom = "'".$boucle->type_requete."'"; |
|
| 110 | 109 | |
| 111 | 110 | // compléter le nom avec un nom précisé {doublons nom} |
| 112 | 111 | // on obtient $nom = "'article' . 'nom'" |
| 113 | 112 | if (isset($crit->param[0])) { |
| 114 | - $nom .= "." . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent); |
|
| 113 | + $nom .= ".".calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent); |
|
| 115 | 114 | } |
| 116 | 115 | |
| 117 | 116 | // code qui déclarera l'index du stockage de nos doublons (pour éviter une notice PHP) |
@@ -123,13 +122,13 @@ discard block |
||
| 123 | 122 | // $doublons et son index, ici $nom |
| 124 | 123 | |
| 125 | 124 | // debut du code "sql_in('articles.id_article', " |
| 126 | - $debut_in = "sql_in('" . $boucle->id_table . '.' . $primary . "', "; |
|
| 125 | + $debut_in = "sql_in('".$boucle->id_table.'.'.$primary."', "; |
|
| 127 | 126 | // lecture des données du doublon "$doublons[$doublon_index[] = " |
| 128 | 127 | // Attention : boucle->doublons désigne une variable qu'on affecte |
| 129 | - $debut_doub = '$doublons[' . (!$not ? '' : ($boucle->doublons . "[]= ")); |
|
| 128 | + $debut_doub = '$doublons['.(!$not ? '' : ($boucle->doublons."[]= ")); |
|
| 130 | 129 | |
| 131 | 130 | // le debut complet du code des doublons |
| 132 | - $debut_doub = $debut_in . $debut_doub; |
|
| 131 | + $debut_doub = $debut_in.$debut_doub; |
|
| 133 | 132 | |
| 134 | 133 | // nom du doublon "('article' . 'nom')]" |
| 135 | 134 | $fin_doub = "($nom)]"; |
@@ -139,22 +138,22 @@ discard block |
||
| 139 | 138 | foreach ($boucle->where as $k => $w) { |
| 140 | 139 | if (strpos($w[0], $debut_doub) === 0) { |
| 141 | 140 | // fusionner le sql_in (du where) |
| 142 | - $boucle->where[$k][0] = $debut_doub . $fin_doub . ' . ' . substr($w[0], strlen($debut_in)); |
|
| 141 | + $boucle->where[$k][0] = $debut_doub.$fin_doub.' . '.substr($w[0], strlen($debut_in)); |
|
| 143 | 142 | // fusionner l'initialisation (du hash) pour faire plus joli |
| 144 | 143 | $x = strpos($boucle->hash, $init_comment); |
| 145 | 144 | $len = strlen($init_comment); |
| 146 | 145 | $boucle->hash = |
| 147 | - substr($boucle->hash, 0, $x + $len) . $init_code . substr($boucle->hash, $x + $len); |
|
| 146 | + substr($boucle->hash, 0, $x + $len).$init_code.substr($boucle->hash, $x + $len); |
|
| 148 | 147 | |
| 149 | 148 | return; |
| 150 | 149 | } |
| 151 | 150 | } |
| 152 | 151 | |
| 153 | 152 | // mettre l'ensemble dans un tableau pour que ce ne soit pas vu comme une constante |
| 154 | - $boucle->where[] = array($debut_doub . $fin_doub . ", '" . $not . "')"); |
|
| 153 | + $boucle->where[] = array($debut_doub.$fin_doub.", '".$not."')"); |
|
| 155 | 154 | |
| 156 | 155 | // déclarer le doublon s'il n'existe pas encore |
| 157 | - $boucle->hash .= $init_comment . $init_code; |
|
| 156 | + $boucle->hash .= $init_comment.$init_code; |
|
| 158 | 157 | |
| 159 | 158 | |
| 160 | 159 | # la ligne suivante avait l'intention d'eviter une collecte deja faite |
@@ -215,10 +214,10 @@ discard block |
||
| 215 | 214 | $un = $un[0]->texte; |
| 216 | 215 | $deux = $deux[0]->texte; |
| 217 | 216 | if ($deux) { |
| 218 | - $boucles[$idb]->limit = 'intval($Pile[0]["debut' . |
|
| 219 | - $un . |
|
| 220 | - '"]) . ",' . |
|
| 221 | - $deux . |
|
| 217 | + $boucles[$idb]->limit = 'intval($Pile[0]["debut'. |
|
| 218 | + $un. |
|
| 219 | + '"]) . ",'. |
|
| 220 | + $deux. |
|
| 222 | 221 | '"'; |
| 223 | 222 | } else { |
| 224 | 223 | calculer_critere_DEFAUT_dist($idb, $boucles, $crit); |
@@ -281,26 +280,26 @@ discard block |
||
| 281 | 280 | $type = calculer_liste(array($crit->param[1][0]), $idb, $boucles, $boucle->id_parent); |
| 282 | 281 | } |
| 283 | 282 | |
| 284 | - $debut = ($type[0] !== "'") ? "'debut'.$type" : ("'debut" . substr($type, 1)); |
|
| 283 | + $debut = ($type[0] !== "'") ? "'debut'.$type" : ("'debut".substr($type, 1)); |
|
| 285 | 284 | $boucle->modificateur['debut_nom'] = $type; |
| 286 | 285 | $partie = |
| 287 | 286 | // tester si le numero de page demande est de la forme '@yyy' |
| 288 | - 'isset($Pile[0][' . $debut . ']) ? $Pile[0][' . $debut . '] : _request(' . $debut . ");\n" |
|
| 287 | + 'isset($Pile[0]['.$debut.']) ? $Pile[0]['.$debut.'] : _request('.$debut.");\n" |
|
| 289 | 288 | . "\tif(substr(\$debut_boucle,0,1)=='@'){\n" |
| 290 | - . "\t\t" . '$debut_boucle = $Pile[0][' . $debut . '] = quete_debut_pagination(\'' . $boucle->primary . '\',$Pile[0][\'@' . $boucle->primary . '\'] = substr($debut_boucle,1),' . $pas . ',$iter);' . "\n" |
|
| 291 | - . "\t\t" . '$iter->seek(0);' . "\n" |
|
| 289 | + . "\t\t".'$debut_boucle = $Pile[0]['.$debut.'] = quete_debut_pagination(\''.$boucle->primary.'\',$Pile[0][\'@'.$boucle->primary.'\'] = substr($debut_boucle,1),'.$pas.',$iter);'."\n" |
|
| 290 | + . "\t\t".'$iter->seek(0);'."\n" |
|
| 292 | 291 | . "\t}\n" |
| 293 | - . "\t" . '$debut_boucle = intval($debut_boucle)'; |
|
| 292 | + . "\t".'$debut_boucle = intval($debut_boucle)'; |
|
| 294 | 293 | |
| 295 | 294 | $boucle->hash .= ' |
| 296 | - $command[\'pagination\'] = array((isset($Pile[0][' . $debut . ']) ? $Pile[0][' . $debut . '] : null), ' . $pas . ');'; |
|
| 295 | + $command[\'pagination\'] = array((isset($Pile[0][' . $debut.']) ? $Pile[0]['.$debut.'] : null), '.$pas.');'; |
|
| 297 | 296 | |
| 298 | 297 | $boucle->total_parties = $pas; |
| 299 | 298 | calculer_parties($boucles, $idb, $partie, 'p+'); |
| 300 | 299 | // ajouter la cle primaire dans le select pour pouvoir gerer la pagination referencee par @id |
| 301 | 300 | // sauf si pas de primaire, ou si primaire composee |
| 302 | 301 | // dans ce cas, on ne sait pas gerer une pagination indirecte |
| 303 | - $t = $boucle->id_table . '.' . $boucle->primary; |
|
| 302 | + $t = $boucle->id_table.'.'.$boucle->primary; |
|
| 304 | 303 | if ($boucle->primary |
| 305 | 304 | and !preg_match('/[,\s]/', $boucle->primary) |
| 306 | 305 | and !in_array($t, $boucle->select) |
@@ -346,24 +345,24 @@ discard block |
||
| 346 | 345 | $boucle->hash .= ' |
| 347 | 346 | // RECHERCHE' |
| 348 | 347 | . ($crit->cond ? ' |
| 349 | - if (!strlen(' . $quoi . ')){ |
|
| 348 | + if (!strlen(' . $quoi.')){ |
|
| 350 | 349 | list($rech_select, $rech_where) = array("0 as points",""); |
| 351 | - } else' : '') . ' |
|
| 350 | + } else' : '').' |
|
| 352 | 351 | { |
| 353 | 352 | $prepare_recherche = charger_fonction(\'prepare_recherche\', \'inc\'); |
| 354 | - list($rech_select, $rech_where) = $prepare_recherche(' . $quoi . ', "' . $boucle->id_table . '", "' . $crit->cond . '","' . $boucle->sql_serveur . '",' . $_modificateur . ',"' . $boucle->primary . '"); |
|
| 353 | + list($rech_select, $rech_where) = $prepare_recherche(' . $quoi.', "'.$boucle->id_table.'", "'.$crit->cond.'","'.$boucle->sql_serveur.'",'.$_modificateur.',"'.$boucle->primary.'"); |
|
| 355 | 354 | } |
| 356 | 355 | '; |
| 357 | 356 | |
| 358 | 357 | |
| 359 | - $t = $boucle->id_table . '.' . $boucle->primary; |
|
| 358 | + $t = $boucle->id_table.'.'.$boucle->primary; |
|
| 360 | 359 | if (!in_array($t, $boucles[$idb]->select)) { |
| 361 | 360 | $boucle->select[] = $t; |
| 362 | 361 | } # pour postgres, neuneu ici |
| 363 | 362 | // jointure uniquement sur le serveur principal |
| 364 | 363 | // (on ne peut joindre une table d'un serveur distant avec la table des resultats du serveur principal) |
| 365 | 364 | if (!$boucle->sql_serveur) { |
| 366 | - $boucle->join['resultats'] = array("'" . $boucle->id_table . "'", "'id'", "'" . $boucle->primary . "'"); |
|
| 365 | + $boucle->join['resultats'] = array("'".$boucle->id_table."'", "'id'", "'".$boucle->primary."'"); |
|
| 367 | 366 | $boucle->from['resultats'] = 'spip_resultats'; |
| 368 | 367 | } |
| 369 | 368 | $boucle->select[] = '$rech_select'; |
@@ -430,7 +429,7 @@ discard block |
||
| 430 | 429 | $c = |
| 431 | 430 | array( |
| 432 | 431 | "'OR'", |
| 433 | - array("'='", "'$table." . "id_trad'", "'$table.$prim'"), |
|
| 432 | + array("'='", "'$table."."id_trad'", "'$table.$prim'"), |
|
| 434 | 433 | array("'='", "'$table.id_trad'", "'0'") |
| 435 | 434 | ); |
| 436 | 435 | $boucle->where[] = ($crit->not ? array("'NOT'", $c) : $c); |
@@ -453,16 +452,15 @@ discard block |
||
| 453 | 452 | $boucle = &$boucles[$idb]; |
| 454 | 453 | $arg = kwote(calculer_argument_precedent($idb, 'id_parent', $boucles)); |
| 455 | 454 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 456 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 457 | - 'id_parent'; |
|
| 458 | - $mparent = $boucle->id_table . '.' . $id_parent; |
|
| 455 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 456 | + $mparent = $boucle->id_table.'.'.$id_parent; |
|
| 459 | 457 | |
| 460 | 458 | if ($boucle->type_requete == 'rubriques' or isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'])) { |
| 461 | 459 | $boucle->where[] = array("'='", "'$mparent'", $arg); |
| 462 | 460 | |
| 463 | 461 | } // le cas FORUMS est gere dans le plugin forum, dans la fonction critere_FORUMS_meme_parent_dist() |
| 464 | 462 | else { |
| 465 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . ' ' . $boucle->type_requete))); |
|
| 463 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op.' '.$boucle->type_requete))); |
|
| 466 | 464 | } |
| 467 | 465 | } |
| 468 | 466 | |
@@ -515,16 +513,15 @@ discard block |
||
| 515 | 513 | if (count(trouver_champs_decomposes($champ, $desc)) > 1) { |
| 516 | 514 | $decompose = decompose_champ_id_objet($champ); |
| 517 | 515 | $champ = array_shift($decompose); |
| 518 | - $boucle->where[] = array("'='", _q($cle . "." . reset($decompose)), '"' . sql_quote(end($decompose)) . '"'); |
|
| 516 | + $boucle->where[] = array("'='", _q($cle.".".reset($decompose)), '"'.sql_quote(end($decompose)).'"'); |
|
| 519 | 517 | } |
| 520 | 518 | } else { |
| 521 | 519 | $cle = $boucle->id_table; |
| 522 | 520 | } |
| 523 | 521 | |
| 524 | - $c = "sql_in('$cle" . ".$champ', calcul_branche_in($arg)" |
|
| 525 | - . ($not ? ", 'NOT'" : '') . ")"; |
|
| 526 | - $boucle->where[] = !$crit->cond ? $c : |
|
| 527 | - ("($arg ? $c : " . ($not ? "'0=1'" : "'1=1'") . ')'); |
|
| 522 | + $c = "sql_in('$cle".".$champ', calcul_branche_in($arg)" |
|
| 523 | + . ($not ? ", 'NOT'" : '').")"; |
|
| 524 | + $boucle->where[] = !$crit->cond ? $c : ("($arg ? $c : ".($not ? "'0=1'" : "'1=1'").')'); |
|
| 528 | 525 | } |
| 529 | 526 | |
| 530 | 527 | /** |
@@ -544,9 +541,9 @@ discard block |
||
| 544 | 541 | $not = ($crit->not ? 'NOT' : ''); |
| 545 | 542 | $serveur = $boucle->sql_serveur; |
| 546 | 543 | |
| 547 | - $c = "sql_in('" . |
|
| 548 | - $boucle->id_table . '.' . $boucle->primary |
|
| 549 | - . "', lister_objets_avec_logos('" . $boucle->primary . "'), '$not', '$serveur')"; |
|
| 544 | + $c = "sql_in('". |
|
| 545 | + $boucle->id_table.'.'.$boucle->primary |
|
| 546 | + . "', lister_objets_avec_logos('".$boucle->primary."'), '$not', '$serveur')"; |
|
| 550 | 547 | |
| 551 | 548 | $boucle->where[] = $c; |
| 552 | 549 | } |
@@ -578,7 +575,7 @@ discard block |
||
| 578 | 575 | $t = table_objet_sql($r[1]); |
| 579 | 576 | $t = array_search($t, $boucles[$idb]->from); |
| 580 | 577 | if ($t) { |
| 581 | - $t .= '.' . $r[2]; |
|
| 578 | + $t .= '.'.$r[2]; |
|
| 582 | 579 | } |
| 583 | 580 | } |
| 584 | 581 | } else { |
@@ -593,7 +590,7 @@ discard block |
||
| 593 | 590 | $boucles[$idb]->select[] = $t; |
| 594 | 591 | } |
| 595 | 592 | } else { |
| 596 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . ' ?'))); |
|
| 593 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op.' ?'))); |
|
| 597 | 594 | } |
| 598 | 595 | } |
| 599 | 596 | |
@@ -613,7 +610,7 @@ discard block |
||
| 613 | 610 | * @param Critere $crit Paramètres du critère dans cette boucle |
| 614 | 611 | * @return void |
| 615 | 612 | **/ |
| 616 | -function critere_fusion_supprimer_dist($idb, &$boucles, $crit){ |
|
| 613 | +function critere_fusion_supprimer_dist($idb, &$boucles, $crit) { |
|
| 617 | 614 | $boucles[$idb]->group = array(); |
| 618 | 615 | } |
| 619 | 616 | |
@@ -663,26 +660,26 @@ discard block |
||
| 663 | 660 | (false !== $i = strpos($boucle->order[$n - 1], 'ASC')) |
| 664 | 661 | OR (false !== $i = strpos($boucle->order[$n - 1], 'DESC')) |
| 665 | 662 | ) { |
| 666 | - $boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . " . $boucle->modificateur['collate'] . " . ' ", $i, 0); |
|
| 663 | + $boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . ".$boucle->modificateur['collate']." . ' ", $i, 0); |
|
| 667 | 664 | } else { |
| 668 | - $boucle->order[$n - 1] .= " . " . $boucle->modificateur['collate']; |
|
| 665 | + $boucle->order[$n - 1] .= " . ".$boucle->modificateur['collate']; |
|
| 669 | 666 | } |
| 670 | 667 | } |
| 671 | 668 | } else { |
| 672 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . " " . count($boucles[$idb]->order)))); |
|
| 669 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op." ".count($boucles[$idb]->order)))); |
|
| 673 | 670 | } |
| 674 | 671 | } |
| 675 | 672 | |
| 676 | 673 | // https://code.spip.net/@calculer_critere_arg_dynamique |
| 677 | 674 | function calculer_critere_arg_dynamique($idb, &$boucles, $crit, $suffix = '') { |
| 678 | 675 | $boucle = $boucles[$idb]; |
| 679 | - $alt = "('" . $boucle->id_table . '.\' . $x' . $suffix . ')'; |
|
| 680 | - $var = '$champs_' . $idb; |
|
| 676 | + $alt = "('".$boucle->id_table.'.\' . $x'.$suffix.')'; |
|
| 677 | + $var = '$champs_'.$idb; |
|
| 681 | 678 | $desc = (strpos($boucle->in, "static $var =") !== false); |
| 682 | 679 | if (!$desc) { |
| 683 | 680 | $desc = $boucle->show['field']; |
| 684 | 681 | $desc = implode(',', array_map('_q', array_keys($desc))); |
| 685 | - $boucles[$idb]->in .= "\n\tstatic $var = array(" . $desc . ");"; |
|
| 682 | + $boucles[$idb]->in .= "\n\tstatic $var = array(".$desc.");"; |
|
| 686 | 683 | } |
| 687 | 684 | if ($desc) { |
| 688 | 685 | $alt = "(in_array(\$x, $var) ? $alt :(\$x$suffix))"; |
@@ -757,7 +754,7 @@ discard block |
||
| 757 | 754 | $sens = " . ' DESC'"; |
| 758 | 755 | } |
| 759 | 756 | if (isset($boucle->modificateur['collate'])) { |
| 760 | - $collecte = ' . ' . $boucle->modificateur['collate']; |
|
| 757 | + $collecte = ' . '.$boucle->modificateur['collate']; |
|
| 761 | 758 | } |
| 762 | 759 | |
| 763 | 760 | // Pour chaque paramètre du critère |
@@ -779,14 +776,14 @@ discard block |
||
| 779 | 776 | if (preg_match(",^(\w+)[\s]+(.*)$,", $par, $m)) { |
| 780 | 777 | $expression = trim($m[1]); |
| 781 | 778 | $champ = trim($m[2]); |
| 782 | - if (function_exists($f = 'calculer_critere_par_expression_' . $expression)) { |
|
| 779 | + if (function_exists($f = 'calculer_critere_par_expression_'.$expression)) { |
|
| 783 | 780 | $order = $f($idb, $boucles, $crit, $tri, $champ); |
| 784 | 781 | } else { |
| 785 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par")); |
|
| 782 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." $par")); |
|
| 786 | 783 | } |
| 787 | 784 | |
| 788 | 785 | // tris de la forme {par champ} ou {par FONCTION(champ)} |
| 789 | - } elseif (preg_match(",^" . CHAMP_SQL_PLUS_FONC . '$,is', $par, $match)) { |
|
| 786 | + } elseif (preg_match(",^".CHAMP_SQL_PLUS_FONC.'$,is', $par, $match)) { |
|
| 790 | 787 | // {par FONCTION(champ)} |
| 791 | 788 | if (count($match) > 2) { |
| 792 | 789 | $par = substr($match[2], 1, -1); |
@@ -796,7 +793,7 @@ discard block |
||
| 796 | 793 | if ($par == 'hasard') { |
| 797 | 794 | $order = calculer_critere_par_hasard($idb, $boucles, $crit); |
| 798 | 795 | } elseif ($par == 'date' and !empty($boucle->show['date'])) { |
| 799 | - $order = "'" . $boucle->id_table . "." . $boucle->show['date'] . "'"; |
|
| 796 | + $order = "'".$boucle->id_table.".".$boucle->show['date']."'"; |
|
| 800 | 797 | } else { |
| 801 | 798 | // cas général {par champ}, {par table.champ}, ... |
| 802 | 799 | $order = calculer_critere_par_champ($idb, $boucles, $crit, $par); |
@@ -805,7 +802,7 @@ discard block |
||
| 805 | 802 | |
| 806 | 803 | // on ne sait pas traiter… |
| 807 | 804 | else { |
| 808 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par")); |
|
| 805 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." $par")); |
|
| 809 | 806 | } |
| 810 | 807 | |
| 811 | 808 | // En cas d'erreur de squelette retournée par une fonction |
@@ -825,14 +822,14 @@ discard block |
||
| 825 | 822 | |
| 826 | 823 | if ($fct) { |
| 827 | 824 | if (preg_match("/^\s*'(.*)'\s*$/", $order, $r)) { |
| 828 | - $order = "'$fct(" . $r[1] . ")'"; |
|
| 825 | + $order = "'$fct(".$r[1].")'"; |
|
| 829 | 826 | } else { |
| 830 | 827 | $order = "'$fct(' . $order . ')'"; |
| 831 | 828 | } |
| 832 | 829 | } |
| 833 | - $t = $order . $collecte . $sens; |
|
| 830 | + $t = $order.$collecte.$sens; |
|
| 834 | 831 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 835 | - $t = $r[1] . $r[2]; |
|
| 832 | + $t = $r[1].$r[2]; |
|
| 836 | 833 | } |
| 837 | 834 | |
| 838 | 835 | $boucle->order[] = $t; |
@@ -882,16 +879,16 @@ discard block |
||
| 882 | 879 | function calculer_critere_par_expression_num($idb, &$boucles, $crit, $tri, $champ) { |
| 883 | 880 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 884 | 881 | if (is_array($_champ)) { |
| 885 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " num $champ")); |
|
| 882 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." num $champ")); |
|
| 886 | 883 | } |
| 887 | 884 | $boucle = &$boucles[$idb]; |
| 888 | - $texte = '0+' . $_champ; |
|
| 885 | + $texte = '0+'.$_champ; |
|
| 889 | 886 | $suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent); |
| 890 | 887 | if ($suite !== "''") { |
| 891 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . " . \""; |
|
| 888 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')"." . \""; |
|
| 892 | 889 | } |
| 893 | - $as = 'num' . ($boucle->order ? count($boucle->order) : ""); |
|
| 894 | - $boucle->select[] = $texte . " AS $as"; |
|
| 890 | + $as = 'num'.($boucle->order ? count($boucle->order) : ""); |
|
| 891 | + $boucle->select[] = $texte." AS $as"; |
|
| 895 | 892 | $order = "'$as'"; |
| 896 | 893 | return $order; |
| 897 | 894 | } |
@@ -916,16 +913,16 @@ discard block |
||
| 916 | 913 | function calculer_critere_par_expression_sinum($idb, &$boucles, $crit, $tri, $champ) { |
| 917 | 914 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 918 | 915 | if (is_array($_champ)) { |
| 919 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " sinum $champ")); |
|
| 916 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." sinum $champ")); |
|
| 920 | 917 | } |
| 921 | 918 | $boucle = &$boucles[$idb]; |
| 922 | - $texte = '0+' . $_champ; |
|
| 919 | + $texte = '0+'.$_champ; |
|
| 923 | 920 | $suite = calculer_liste($tri, $idb, $boucles, $boucle->id_parent); |
| 924 | 921 | if ($suite !== "''") { |
| 925 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . " . \""; |
|
| 922 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')"." . \""; |
|
| 926 | 923 | } |
| 927 | - $as = 'sinum' . ($boucle->order ? count($boucle->order) : ""); |
|
| 928 | - $boucle->select[] = 'CASE (' . $texte . ') WHEN 0 THEN 1 ELSE 0 END AS ' . $as; |
|
| 924 | + $as = 'sinum'.($boucle->order ? count($boucle->order) : ""); |
|
| 925 | + $boucle->select[] = 'CASE ('.$texte.') WHEN 0 THEN 1 ELSE 0 END AS '.$as; |
|
| 929 | 926 | $order = "'$as'"; |
| 930 | 927 | return $order; |
| 931 | 928 | } |
@@ -949,10 +946,10 @@ discard block |
||
| 949 | 946 | function calculer_critere_par_expression_multi($idb, &$boucles, $crit, $tri, $champ) { |
| 950 | 947 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 951 | 948 | if (is_array($_champ)) { |
| 952 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " multi $champ")); |
|
| 949 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." multi $champ")); |
|
| 953 | 950 | } |
| 954 | 951 | $boucle = &$boucles[$idb]; |
| 955 | - $boucle->select[] = "\".sql_multi('" . $_champ . "', \$GLOBALS['spip_lang']).\""; |
|
| 952 | + $boucle->select[] = "\".sql_multi('".$_champ."', \$GLOBALS['spip_lang']).\""; |
|
| 956 | 953 | $order = "'multi'"; |
| 957 | 954 | return $order; |
| 958 | 955 | } |
@@ -972,13 +969,13 @@ discard block |
||
| 972 | 969 | * @param bool $raw Retourne le champ pour le compilateur ("'alias.champ'") ou brut ('alias.champ') |
| 973 | 970 | * @return array|string |
| 974 | 971 | */ |
| 975 | -function calculer_critere_par_champ($idb, &$boucles, $crit, $par, $raw = false) { |
|
| 972 | +function calculer_critere_par_champ($idb, &$boucles, $crit, $par, $raw = false) { |
|
| 976 | 973 | $boucle = &$boucles[$idb]; |
| 977 | 974 | $desc = $boucle->show; |
| 978 | 975 | |
| 979 | 976 | // le champ existe dans la table, pas de souci (le plus commun) |
| 980 | 977 | if (isset($desc['field'][$par])) { |
| 981 | - $par = $boucle->id_table . "." . $par; |
|
| 978 | + $par = $boucle->id_table.".".$par; |
|
| 982 | 979 | } |
| 983 | 980 | // le champ est peut être une jointure |
| 984 | 981 | else { |
@@ -999,24 +996,24 @@ discard block |
||
| 999 | 996 | // Sinon on cherche le champ dans les tables possibles de jointures |
| 1000 | 997 | // Si la table est déjà dans le from, on la réutilise. |
| 1001 | 998 | if ($infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $table)) { |
| 1002 | - $par = $infos['alias'] . "." . $champ; |
|
| 999 | + $par = $infos['alias'].".".$champ; |
|
| 1003 | 1000 | } elseif ( |
| 1004 | 1001 | $boucle->jointures_explicites |
| 1005 | 1002 | and $alias = trouver_jointure_champ($champ, $boucle, explode(' ', $boucle->jointures_explicites), false, $table) |
| 1006 | 1003 | ) { |
| 1007 | - $par = $alias . "." . $champ; |
|
| 1004 | + $par = $alias.".".$champ; |
|
| 1008 | 1005 | } elseif ($alias = trouver_jointure_champ($champ, $boucle, $boucle->jointures, false, $table)) { |
| 1009 | - $par = $alias . "." . $champ; |
|
| 1006 | + $par = $alias.".".$champ; |
|
| 1010 | 1007 | // en spécifiant directement l'alias {par L2.titre} (situation hasardeuse tout de même) |
| 1011 | 1008 | } elseif ( |
| 1012 | 1009 | $table_alias |
| 1013 | 1010 | and isset($boucle->from[$table_alias]) |
| 1014 | 1011 | and $infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $boucle->from[$table_alias]) |
| 1015 | 1012 | ) { |
| 1016 | - $par = $infos['alias'] . "." . $champ; |
|
| 1013 | + $par = $infos['alias'].".".$champ; |
|
| 1017 | 1014 | } elseif ($table) { |
| 1018 | 1015 | // On avait table + champ, mais on ne les a pas trouvés |
| 1019 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par")); |
|
| 1016 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." $par")); |
|
| 1020 | 1017 | } else { |
| 1021 | 1018 | // Sinon tant pis, ca doit etre un champ synthetise (cf points) |
| 1022 | 1019 | } |
@@ -1040,7 +1037,7 @@ discard block |
||
| 1040 | 1037 | if (!$t) { |
| 1041 | 1038 | $t = trouver_jointure_champ($champ, $boucle); |
| 1042 | 1039 | } |
| 1043 | - return !$t ? '' : ("'" . $t . '.' . $champ . "'"); |
|
| 1040 | + return !$t ? '' : ("'".$t.'.'.$champ."'"); |
|
| 1044 | 1041 | } |
| 1045 | 1042 | |
| 1046 | 1043 | /** |
@@ -1085,9 +1082,9 @@ discard block |
||
| 1085 | 1082 | $boucle->default_order[] = ' DESC'; |
| 1086 | 1083 | } |
| 1087 | 1084 | } else { |
| 1088 | - $t = $boucle->order[$n - 1] . " . $order"; |
|
| 1085 | + $t = $boucle->order[$n - 1]." . $order"; |
|
| 1089 | 1086 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 1090 | - $t = $r[1] . $r[2]; |
|
| 1087 | + $t = $r[1].$r[2]; |
|
| 1091 | 1088 | } |
| 1092 | 1089 | $boucle->order[$n - 1] = $t; |
| 1093 | 1090 | } |
@@ -1101,11 +1098,11 @@ discard block |
||
| 1101 | 1098 | * @param $crit |
| 1102 | 1099 | * @return array|string |
| 1103 | 1100 | */ |
| 1104 | -function critere_par_ordre_liste_dist($idb, &$boucles, $crit){ |
|
| 1101 | +function critere_par_ordre_liste_dist($idb, &$boucles, $crit) { |
|
| 1105 | 1102 | $boucle = &$boucles[$idb]; |
| 1106 | 1103 | |
| 1107 | 1104 | $sens = $collecte = ''; |
| 1108 | - if ($crit->not){ |
|
| 1105 | + if ($crit->not) { |
|
| 1109 | 1106 | $sens = " . ' DESC'"; |
| 1110 | 1107 | } |
| 1111 | 1108 | |
@@ -1115,14 +1112,14 @@ discard block |
||
| 1115 | 1112 | $res = critere_parinverse($idb, $boucles, $crit2); |
| 1116 | 1113 | |
| 1117 | 1114 | // erreur ? |
| 1118 | - if (is_array($res)){ |
|
| 1115 | + if (is_array($res)) { |
|
| 1119 | 1116 | return $res; |
| 1120 | 1117 | } |
| 1121 | 1118 | |
| 1122 | 1119 | $_order = array_pop($boucle->order); |
| 1123 | 1120 | |
| 1124 | 1121 | $_liste = calculer_liste($crit->param[1], array(), $boucles, $boucles[$idb]->id_parent); |
| 1125 | - $boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'" . $boucle->sql_serveur . "')) ? \$zl : '0').')'$sens"; |
|
| 1122 | + $boucle->order[] = "'FIELD(' . $_order . ',' . ((\$zl=formate_liste_critere_par_ordre_liste($_liste,'".$boucle->sql_serveur."')) ? \$zl : '0').')'$sens"; |
|
| 1126 | 1123 | } |
| 1127 | 1124 | |
| 1128 | 1125 | |
@@ -1131,7 +1128,7 @@ discard block |
||
| 1131 | 1128 | $params = $crit->param; |
| 1132 | 1129 | |
| 1133 | 1130 | if (count($params) < 1) { |
| 1134 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " ?")); |
|
| 1131 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." ?")); |
|
| 1135 | 1132 | } |
| 1136 | 1133 | |
| 1137 | 1134 | $boucle = &$boucles[$idb]; |
@@ -1152,7 +1149,7 @@ discard block |
||
| 1152 | 1149 | if ((count($date) == 1) and ($date[0]->type == 'texte')) { |
| 1153 | 1150 | $date = $date[0]->texte; |
| 1154 | 1151 | if (!isset($fields[$date])) { |
| 1155 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " " . $date)); |
|
| 1152 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." ".$date)); |
|
| 1156 | 1153 | } |
| 1157 | 1154 | } else { |
| 1158 | 1155 | $a = calculer_liste($date, $idb, $boucles, $parent); |
@@ -1164,38 +1161,38 @@ discard block |
||
| 1164 | 1161 | $date = "'.(($cond)\n?\$a:\"$defaut\").'"; |
| 1165 | 1162 | } |
| 1166 | 1163 | $annee = $params ? array_shift($params) : ""; |
| 1167 | - $annee = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1168 | - calculer_liste($annee, $idb, $boucles, $parent) . |
|
| 1164 | + $annee = "\n".'sprintf("%04d", ($x = '. |
|
| 1165 | + calculer_liste($annee, $idb, $boucles, $parent). |
|
| 1169 | 1166 | ') ? $x : date("Y"))'; |
| 1170 | 1167 | |
| 1171 | 1168 | $mois = $params ? array_shift($params) : ""; |
| 1172 | - $mois = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1173 | - calculer_liste($mois, $idb, $boucles, $parent) . |
|
| 1169 | + $mois = "\n".'sprintf("%02d", ($x = '. |
|
| 1170 | + calculer_liste($mois, $idb, $boucles, $parent). |
|
| 1174 | 1171 | ') ? $x : date("m"))'; |
| 1175 | 1172 | |
| 1176 | 1173 | $jour = $params ? array_shift($params) : ""; |
| 1177 | - $jour = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1178 | - calculer_liste($jour, $idb, $boucles, $parent) . |
|
| 1174 | + $jour = "\n".'sprintf("%02d", ($x = '. |
|
| 1175 | + calculer_liste($jour, $idb, $boucles, $parent). |
|
| 1179 | 1176 | ') ? $x : date("d"))'; |
| 1180 | 1177 | |
| 1181 | 1178 | $annee2 = $params ? array_shift($params) : ""; |
| 1182 | - $annee2 = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1183 | - calculer_liste($annee2, $idb, $boucles, $parent) . |
|
| 1179 | + $annee2 = "\n".'sprintf("%04d", ($x = '. |
|
| 1180 | + calculer_liste($annee2, $idb, $boucles, $parent). |
|
| 1184 | 1181 | ') ? $x : date("Y"))'; |
| 1185 | 1182 | |
| 1186 | 1183 | $mois2 = $params ? array_shift($params) : ""; |
| 1187 | - $mois2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1188 | - calculer_liste($mois2, $idb, $boucles, $parent) . |
|
| 1184 | + $mois2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1185 | + calculer_liste($mois2, $idb, $boucles, $parent). |
|
| 1189 | 1186 | ') ? $x : date("m"))'; |
| 1190 | 1187 | |
| 1191 | 1188 | $jour2 = $params ? array_shift($params) : ""; |
| 1192 | - $jour2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1193 | - calculer_liste($jour2, $idb, $boucles, $parent) . |
|
| 1189 | + $jour2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1190 | + calculer_liste($jour2, $idb, $boucles, $parent). |
|
| 1194 | 1191 | ') ? $x : date("d"))'; |
| 1195 | 1192 | |
| 1196 | - $date = $boucle->id_table . ".$date"; |
|
| 1193 | + $date = $boucle->id_table.".$date"; |
|
| 1197 | 1194 | |
| 1198 | - $quote_end = ",'" . $boucle->sql_serveur . "','text'"; |
|
| 1195 | + $quote_end = ",'".$boucle->sql_serveur."','text'"; |
|
| 1199 | 1196 | if ($type == 'jour') { |
| 1200 | 1197 | $boucle->where[] = array( |
| 1201 | 1198 | "'='", |
@@ -1267,14 +1264,13 @@ discard block |
||
| 1267 | 1264 | list($a21, $a22) = calculer_critere_parties_aux($idb, $boucles, $a2); |
| 1268 | 1265 | |
| 1269 | 1266 | if (($op == ',') && (is_numeric($a11) && (is_numeric($a21)))) { |
| 1270 | - $boucle->limit = $a11 . ',' . $a21; |
|
| 1267 | + $boucle->limit = $a11.','.$a21; |
|
| 1271 | 1268 | } else { |
| 1272 | 1269 | // 3 dans {1/3}, {2,3} ou {1,n-3} |
| 1273 | 1270 | $boucle->total_parties = ($a21 != 'n') ? $a21 : $a22; |
| 1274 | 1271 | // 2 dans {2/3}, {2,5}, {n-2,1} |
| 1275 | 1272 | $partie = ($a11 != 'n') ? $a11 : $a12; |
| 1276 | - $mode = (($op == '/') ? '/' : |
|
| 1277 | - (($a11 == 'n') ? '-' : '+') . (($a21 == 'n') ? '-' : '+')); |
|
| 1273 | + $mode = (($op == '/') ? '/' : (($a11 == 'n') ? '-' : '+').(($a21 == 'n') ? '-' : '+')); |
|
| 1278 | 1274 | // cas simple {0,#ENV{truc}} compilons le en LIMIT : |
| 1279 | 1275 | if ($a11 !== 'n' and $a21 !== 'n' and $mode == "++" and $op == ',') { |
| 1280 | 1276 | $boucle->limit = |
@@ -1320,8 +1316,7 @@ discard block |
||
| 1320 | 1316 | // {1/3} |
| 1321 | 1317 | if ($op1 == '/') { |
| 1322 | 1318 | $pmoins1 = is_numeric($debut) ? ($debut - 1) : "($debut-1)"; |
| 1323 | - $totpos = is_numeric($total_parties) ? ($total_parties) : |
|
| 1324 | - "($total_parties ? $total_parties : 1)"; |
|
| 1319 | + $totpos = is_numeric($total_parties) ? ($total_parties) : "($total_parties ? $total_parties : 1)"; |
|
| 1325 | 1320 | $fin = "ceil(($nombre_boucle * $debut )/$totpos) - 1"; |
| 1326 | 1321 | $debut = !$pmoins1 ? 0 : "ceil(($nombre_boucle * $pmoins1)/$totpos);"; |
| 1327 | 1322 | } else { |
@@ -1332,15 +1327,13 @@ discard block |
||
| 1332 | 1327 | |
| 1333 | 1328 | // cas {x,n-1} |
| 1334 | 1329 | if ($op2 == '-') { |
| 1335 | - $fin = '$debut_boucle + ' . $nombre_boucle . ' - ' |
|
| 1336 | - . (is_numeric($total_parties) ? ($total_parties + 1) : |
|
| 1337 | - ($total_parties . ' - 1')); |
|
| 1330 | + $fin = '$debut_boucle + '.$nombre_boucle.' - ' |
|
| 1331 | + . (is_numeric($total_parties) ? ($total_parties + 1) : ($total_parties.' - 1')); |
|
| 1338 | 1332 | } else { |
| 1339 | 1333 | // {x,1} ou {pagination} |
| 1340 | 1334 | $fin = '$debut_boucle' |
| 1341 | 1335 | . (is_numeric($total_parties) ? |
| 1342 | - (($total_parties == 1) ? "" : (' + ' . ($total_parties - 1))) : |
|
| 1343 | - ('+' . $total_parties . ' - 1')); |
|
| 1336 | + (($total_parties == 1) ? "" : (' + '.($total_parties - 1))) : ('+'.$total_parties.' - 1')); |
|
| 1344 | 1337 | } |
| 1345 | 1338 | |
| 1346 | 1339 | // {pagination}, gerer le debut_xx=-1 pour tout voir |
@@ -1358,11 +1351,11 @@ discard block |
||
| 1358 | 1351 | // Utiliser min pour rabattre $fin_boucle sur total_boucle. |
| 1359 | 1352 | |
| 1360 | 1353 | $boucles[$id_boucle]->mode_partie = "\n\t" |
| 1361 | - . '$debut_boucle = ' . $debut . ";\n " |
|
| 1354 | + . '$debut_boucle = '.$debut.";\n " |
|
| 1362 | 1355 | . "\$debut_boucle = intval(\$debut_boucle);\n " |
| 1363 | - . '$fin_boucle = min(' . $fin . ", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1364 | - . '$Numrows[\'' . $id_boucle . "']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1365 | - . '$Numrows[\'' . $id_boucle . '\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1356 | + . '$fin_boucle = min('.$fin.", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1357 | + . '$Numrows[\''.$id_boucle."']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1358 | + . '$Numrows[\''.$id_boucle.'\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1366 | 1359 | . "\n\tif (\$debut_boucle>0" |
| 1367 | 1360 | . " AND \$debut_boucle < \$Numrows['$id_boucle']['grand_total']" |
| 1368 | 1361 | . " AND \$iter->seek(\$debut_boucle,'continue'))" |
@@ -1447,16 +1440,16 @@ discard block |
||
| 1447 | 1440 | // critere personnalise ? |
| 1448 | 1441 | if ( |
| 1449 | 1442 | (!$serveur or |
| 1450 | - ((!function_exists($f = "critere_" . $serveur . "_" . $table . "_" . $critere)) |
|
| 1451 | - and (!function_exists($f = $f . "_dist")) |
|
| 1452 | - and (!function_exists($f = "critere_" . $serveur . "_" . $critere)) |
|
| 1453 | - and (!function_exists($f = $f . "_dist")) |
|
| 1443 | + ((!function_exists($f = "critere_".$serveur."_".$table."_".$critere)) |
|
| 1444 | + and (!function_exists($f = $f."_dist")) |
|
| 1445 | + and (!function_exists($f = "critere_".$serveur."_".$critere)) |
|
| 1446 | + and (!function_exists($f = $f."_dist")) |
|
| 1454 | 1447 | ) |
| 1455 | 1448 | ) |
| 1456 | - and (!function_exists($f = "critere_" . $table . "_" . $critere)) |
|
| 1457 | - and (!function_exists($f = $f . "_dist")) |
|
| 1458 | - and (!function_exists($f = "critere_" . $critere)) |
|
| 1459 | - and (!function_exists($f = $f . "_dist")) |
|
| 1449 | + and (!function_exists($f = "critere_".$table."_".$critere)) |
|
| 1450 | + and (!function_exists($f = $f."_dist")) |
|
| 1451 | + and (!function_exists($f = "critere_".$critere)) |
|
| 1452 | + and (!function_exists($f = $f."_dist")) |
|
| 1460 | 1453 | ) { |
| 1461 | 1454 | // fonction critere standard |
| 1462 | 1455 | $f = $defaut; |
@@ -1489,9 +1482,9 @@ discard block |
||
| 1489 | 1482 | */ |
| 1490 | 1483 | function kwote($lisp, $serveur = '', $type = '') { |
| 1491 | 1484 | if (preg_match(_CODE_QUOTE, $lisp, $r)) { |
| 1492 | - return $r[1] . "\"" . sql_quote(str_replace(array("\\'", "\\\\"), array("'", "\\"), $r[2]), $serveur, $type) . "\""; |
|
| 1485 | + return $r[1]."\"".sql_quote(str_replace(array("\\'", "\\\\"), array("'", "\\"), $r[2]), $serveur, $type)."\""; |
|
| 1493 | 1486 | } else { |
| 1494 | - return "sql_quote($lisp, '$serveur', '" . str_replace("'", "\\'", $type) . "')"; |
|
| 1487 | + return "sql_quote($lisp, '$serveur', '".str_replace("'", "\\'", $type)."')"; |
|
| 1495 | 1488 | } |
| 1496 | 1489 | } |
| 1497 | 1490 | |
@@ -1513,7 +1506,7 @@ discard block |
||
| 1513 | 1506 | function critere_IN_dist($idb, &$boucles, $crit) { |
| 1514 | 1507 | $r = calculer_critere_infixe($idb, $boucles, $crit); |
| 1515 | 1508 | if (!$r) { |
| 1516 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . " ?"))); |
|
| 1509 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op." ?"))); |
|
| 1517 | 1510 | } |
| 1518 | 1511 | list($arg, $op, $val, $col, $where_complement) = $r; |
| 1519 | 1512 | |
@@ -1540,8 +1533,8 @@ discard block |
||
| 1540 | 1533 | "'NOT'", |
| 1541 | 1534 | array( |
| 1542 | 1535 | "'IN'", |
| 1543 | - "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", |
|
| 1544 | - array("'SELF'", "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", $where) |
|
| 1536 | + "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", |
|
| 1537 | + array("'SELF'", "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", $where) |
|
| 1545 | 1538 | ) |
| 1546 | 1539 | ); |
| 1547 | 1540 | } |
@@ -1560,22 +1553,22 @@ discard block |
||
| 1560 | 1553 | $descr = $boucles[$idb]->descr; |
| 1561 | 1554 | $cpt = &$num[$descr['nom']][$descr['gram']][$idb]; |
| 1562 | 1555 | |
| 1563 | - $var = '$in' . $cpt++; |
|
| 1556 | + $var = '$in'.$cpt++; |
|
| 1564 | 1557 | $x = "\n\t$var = array();"; |
| 1565 | 1558 | foreach ($val as $k => $v) { |
| 1566 | 1559 | if (preg_match(",^(\n//.*\n)?'(.*)'$,", $v, $r)) { |
| 1567 | 1560 | // optimiser le traitement des constantes |
| 1568 | 1561 | if (is_numeric($r[2])) { |
| 1569 | - $x .= "\n\t$var" . "[]= $r[2];"; |
|
| 1562 | + $x .= "\n\t$var"."[]= $r[2];"; |
|
| 1570 | 1563 | } else { |
| 1571 | - $x .= "\n\t$var" . "[]= " . sql_quote($r[2]) . ";"; |
|
| 1564 | + $x .= "\n\t$var"."[]= ".sql_quote($r[2]).";"; |
|
| 1572 | 1565 | } |
| 1573 | 1566 | } else { |
| 1574 | 1567 | // Pour permettre de passer des tableaux de valeurs |
| 1575 | 1568 | // on repere l'utilisation brute de #ENV**{X}, |
| 1576 | 1569 | // c'est-a-dire sa traduction en ($PILE[0][X]). |
| 1577 | 1570 | // et on deballe mais en rajoutant l'anti XSS |
| 1578 | - $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var" . "[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1571 | + $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var"."[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1579 | 1572 | } |
| 1580 | 1573 | } |
| 1581 | 1574 | |
@@ -1589,7 +1582,7 @@ discard block |
||
| 1589 | 1582 | $boucles[$idb]->default_order[] = "((!\$zqv=sql_quote($var) OR \$zqv===\"''\") ? 0 : ('FIELD($arg,' . \$zqv . ')'))"; |
| 1590 | 1583 | } |
| 1591 | 1584 | |
| 1592 | - return "sql_in('$arg', $var" . ($crit2 == 'NOT' ? ",'NOT'" : "") . ")"; |
|
| 1585 | + return "sql_in('$arg', $var".($crit2 == 'NOT' ? ",'NOT'" : "").")"; |
|
| 1593 | 1586 | } |
| 1594 | 1587 | |
| 1595 | 1588 | /** |
@@ -1662,7 +1655,7 @@ discard block |
||
| 1662 | 1655 | $champs = array_diff($champs, array_keys($boucle->modificateur['criteres'])); |
| 1663 | 1656 | } |
| 1664 | 1657 | // nous aider en mode debug. |
| 1665 | - $boucle->debug[] = "id_ : " . implode(', ', $champs); |
|
| 1658 | + $boucle->debug[] = "id_ : ".implode(', ', $champs); |
|
| 1666 | 1659 | $boucle->modificateur['id_'] = $champs; |
| 1667 | 1660 | |
| 1668 | 1661 | // créer un critère {id_xxx?} de chaque champ retenu |
@@ -1703,7 +1696,7 @@ discard block |
||
| 1703 | 1696 | // Les champs id_xx de la table demandée |
| 1704 | 1697 | $champs = array_filter( |
| 1705 | 1698 | array_keys($desc['field']), |
| 1706 | - function($champ){ |
|
| 1699 | + function($champ) { |
|
| 1707 | 1700 | return |
| 1708 | 1701 | strpos($champ, 'id_') === 0 |
| 1709 | 1702 | or (in_array($champ, array('objet'))); |
@@ -1918,8 +1911,8 @@ discard block |
||
| 1918 | 1911 | "'NOT'", |
| 1919 | 1912 | array( |
| 1920 | 1913 | "'IN'", |
| 1921 | - "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", |
|
| 1922 | - array("'SELF'", "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", $where) |
|
| 1914 | + "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", |
|
| 1915 | + array("'SELF'", "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", $where) |
|
| 1923 | 1916 | ) |
| 1924 | 1917 | ); |
| 1925 | 1918 | } |
@@ -1930,7 +1923,7 @@ discard block |
||
| 1930 | 1923 | if ($crit->cond) { |
| 1931 | 1924 | $pred = calculer_argument_precedent($idb, $col, $boucles); |
| 1932 | 1925 | if ($col == "date" or $col == "date_redac") { |
| 1933 | - if ($pred == "\$Pile[0]['" . $col . "']") { |
|
| 1926 | + if ($pred == "\$Pile[0]['".$col."']") { |
|
| 1934 | 1927 | $pred = "(\$Pile[0]['{$col}_default']?'':$pred)"; |
| 1935 | 1928 | } |
| 1936 | 1929 | } |
@@ -2091,7 +2084,7 @@ discard block |
||
| 2091 | 2084 | // defaire le quote des int et les passer dans sql_quote avec le bon type de champ si on le connait, int sinon |
| 2092 | 2085 | // prendre en compte le debug ou la valeur arrive avec un commentaire PHP en debut |
| 2093 | 2086 | if (preg_match(",^\\A(\s*//.*?$\s*)?\"'(-?\d+)'\"\\z,ms", $val[0], $r)) { |
| 2094 | - $val[0] = $r[1] . '"' . sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote) . '"'; |
|
| 2087 | + $val[0] = $r[1].'"'.sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote).'"'; |
|
| 2095 | 2088 | } |
| 2096 | 2089 | // sinon expliciter les |
| 2097 | 2090 | // sql_quote(truc) en sql_quote(truc,'',type) |
@@ -2102,22 +2095,22 @@ discard block |
||
| 2102 | 2095 | // sql_quote(truc,'','varchar') |
| 2103 | 2096 | elseif (preg_match('/\Asql_quote[(](.*?)(,[^)]*?)?(,[^)]*(?:\(\d+\)[^)]*)?)?[)]\s*\z/ms', $val[0], $r) |
| 2104 | 2097 | // si pas deja un type |
| 2105 | - and (!isset($r[3]) or !$r[3] or !trim($r[3],", '")) |
|
| 2098 | + and (!isset($r[3]) or !$r[3] or !trim($r[3], ", '")) |
|
| 2106 | 2099 | ) { |
| 2107 | 2100 | $r = $r[1] |
| 2108 | 2101 | . ((isset($r[2]) and $r[2]) ? $r[2] : ",''") |
| 2109 | - . ",'" . addslashes($type_cast_quote) . "'"; |
|
| 2102 | + . ",'".addslashes($type_cast_quote)."'"; |
|
| 2110 | 2103 | $val[0] = "sql_quote($r)"; |
| 2111 | 2104 | } |
| 2112 | - elseif(strpos($val[0], '@@defaultcast@@') !== false |
|
| 2105 | + elseif (strpos($val[0], '@@defaultcast@@') !== false |
|
| 2113 | 2106 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r)) { |
| 2114 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'" . addslashes($type_cast_quote) . "')"; |
|
| 2107 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'".addslashes($type_cast_quote)."')"; |
|
| 2115 | 2108 | } |
| 2116 | 2109 | } |
| 2117 | 2110 | |
| 2118 | - if(strpos($val[0], '@@defaultcast@@') !== false |
|
| 2111 | + if (strpos($val[0], '@@defaultcast@@') !== false |
|
| 2119 | 2112 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r)) { |
| 2120 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'char')"; |
|
| 2113 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'char')"; |
|
| 2121 | 2114 | } |
| 2122 | 2115 | |
| 2123 | 2116 | // Indicateur pour permettre aux fonctionx boucle_X de modifier |
@@ -2142,7 +2135,7 @@ discard block |
||
| 2142 | 2135 | // inserer le nom de la table SQL devant le nom du champ |
| 2143 | 2136 | if ($table) { |
| 2144 | 2137 | if ($col[0] == "`") { |
| 2145 | - $arg = "$table." . substr($col, 1, -1); |
|
| 2138 | + $arg = "$table.".substr($col, 1, -1); |
|
| 2146 | 2139 | } else { |
| 2147 | 2140 | $arg = "$table.$col"; |
| 2148 | 2141 | } |
@@ -2276,9 +2269,9 @@ discard block |
||
| 2276 | 2269 | **/ |
| 2277 | 2270 | function primary_doublee($decompose, $table) { |
| 2278 | 2271 | $e1 = reset($decompose); |
| 2279 | - $e2 = "sql_quote('" . end($decompose) . "')"; |
|
| 2272 | + $e2 = "sql_quote('".end($decompose)."')"; |
|
| 2280 | 2273 | |
| 2281 | - return array("'='", "'$table." . $e1 . "'", $e2); |
|
| 2274 | + return array("'='", "'$table.".$e1."'", $e2); |
|
| 2282 | 2275 | } |
| 2283 | 2276 | |
| 2284 | 2277 | /** |
@@ -2316,7 +2309,7 @@ discard block |
||
| 2316 | 2309 | if ($checkarrivee |
| 2317 | 2310 | and is_string($checkarrivee) |
| 2318 | 2311 | and $a = table_objet($checkarrivee) |
| 2319 | - and in_array($a . '_liens', $joints) |
|
| 2312 | + and in_array($a.'_liens', $joints) |
|
| 2320 | 2313 | ) { |
| 2321 | 2314 | if ($res = calculer_lien_externe_init($boucle, $joints, $col, $desc, $cond, $checkarrivee)) { |
| 2322 | 2315 | return $res; |
@@ -2336,12 +2329,12 @@ discard block |
||
| 2336 | 2329 | // la table est déjà dans le FROM, on vérifie si le champ est utilisé. |
| 2337 | 2330 | $joindre = false; |
| 2338 | 2331 | foreach ($cols as $col) { |
| 2339 | - $c = '/\b' . $t . ".$col" . '\b/'; |
|
| 2332 | + $c = '/\b'.$t.".$col".'\b/'; |
|
| 2340 | 2333 | if (trouver_champ($c, $boucle->where)) { |
| 2341 | 2334 | $joindre = true; |
| 2342 | 2335 | } else { |
| 2343 | 2336 | // mais ca peut etre dans le FIELD pour le Having |
| 2344 | - $c = "/FIELD.$t" . ".$col,/"; |
|
| 2337 | + $c = "/FIELD.$t".".$col,/"; |
|
| 2345 | 2338 | if (trouver_champ($c, $boucle->select)) { |
| 2346 | 2339 | $joindre = true; |
| 2347 | 2340 | } |
@@ -2388,7 +2381,7 @@ discard block |
||
| 2388 | 2381 | $primary_arrivee = id_table_objet($checkarrivee); |
| 2389 | 2382 | |
| 2390 | 2383 | // [FIXME] $checkarrivee peut-il arriver avec false ???? |
| 2391 | - $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee . "_liens"); |
|
| 2384 | + $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee."_liens"); |
|
| 2392 | 2385 | $arrivee = trouver_champ_exterieur($col, $joints, $boucle, $checkarrivee); |
| 2393 | 2386 | |
| 2394 | 2387 | if (!$intermediaire or !$arrivee) { |
@@ -2486,7 +2479,7 @@ discard block |
||
| 2486 | 2479 | } elseif ($crit->cond and ($col == "date" or $col == "date_redac")) { |
| 2487 | 2480 | // un critere conditionnel sur date est traite a part |
| 2488 | 2481 | // car la date est mise d'office par SPIP, |
| 2489 | - $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['" . $col . "'])"; |
|
| 2482 | + $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['".$col."'])"; |
|
| 2490 | 2483 | } |
| 2491 | 2484 | |
| 2492 | 2485 | $val = calculer_argument_precedent($idb, $val, $boucles, $defaut); |
@@ -2517,7 +2510,7 @@ discard block |
||
| 2517 | 2510 | and (($p == "'") or ($p == '"')) |
| 2518 | 2511 | and $params[0][1]->type == 'champ' |
| 2519 | 2512 | ) { |
| 2520 | - $val[] = "$p\\$p#" . $params[0][1]->nom_champ . "\\$p$p"; |
|
| 2513 | + $val[] = "$p\\$p#".$params[0][1]->nom_champ."\\$p$p"; |
|
| 2521 | 2514 | } else { |
| 2522 | 2515 | foreach ((($op != 'IN') ? $params : calculer_vieux_in($params)) as $p) { |
| 2523 | 2516 | $a = calculer_liste($p, $idb, $boucles, $parent); |
@@ -2533,7 +2526,7 @@ discard block |
||
| 2533 | 2526 | $fct = $args_sql = ''; |
| 2534 | 2527 | // fonction SQL ? |
| 2535 | 2528 | // chercher FONCTION(champ) tel que CONCAT(titre,descriptif) |
| 2536 | - if (preg_match('/^(.*)' . SQL_ARGS . '$/', $col, $m)) { |
|
| 2529 | + if (preg_match('/^(.*)'.SQL_ARGS.'$/', $col, $m)) { |
|
| 2537 | 2530 | $fct = $m[1]; |
| 2538 | 2531 | preg_match('/^\(([^,]*)(.*)\)$/', $m[2], $a); |
| 2539 | 2532 | $col = $a[1]; |
@@ -2623,7 +2616,7 @@ discard block |
||
| 2623 | 2616 | # si oui choisir ce champ, sinon choisir xxxx |
| 2624 | 2617 | |
| 2625 | 2618 | if (isset($table['field']["date$suite"])) { |
| 2626 | - $date_orig = 'date' . $suite; |
|
| 2619 | + $date_orig = 'date'.$suite; |
|
| 2627 | 2620 | } else { |
| 2628 | 2621 | $date_orig = substr($suite, 1); |
| 2629 | 2622 | } |
@@ -2634,12 +2627,12 @@ discard block |
||
| 2634 | 2627 | } |
| 2635 | 2628 | } |
| 2636 | 2629 | |
| 2637 | - $date_compare = "\"' . normaliser_date(" . |
|
| 2638 | - calculer_argument_precedent($idb, $pred, $boucles) . |
|
| 2630 | + $date_compare = "\"' . normaliser_date(". |
|
| 2631 | + calculer_argument_precedent($idb, $pred, $boucles). |
|
| 2639 | 2632 | ") . '\""; |
| 2640 | 2633 | |
| 2641 | 2634 | $col_vraie = $date_orig; |
| 2642 | - $date_orig = $boucle->id_table . '.' . $date_orig; |
|
| 2635 | + $date_orig = $boucle->id_table.'.'.$date_orig; |
|
| 2643 | 2636 | |
| 2644 | 2637 | switch ($col) { |
| 2645 | 2638 | case 'date': |
@@ -2659,26 +2652,26 @@ discard block |
||
| 2659 | 2652 | break; |
| 2660 | 2653 | case 'age': |
| 2661 | 2654 | $col = calculer_param_date("\'' . date('Y-m-d H:i:00') . '\'", $date_orig); |
| 2662 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2655 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2663 | 2656 | break; |
| 2664 | 2657 | case 'age_relatif': |
| 2665 | 2658 | $col = calculer_param_date($date_compare, $date_orig); |
| 2666 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2659 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2667 | 2660 | break; |
| 2668 | 2661 | case 'jour_relatif': |
| 2669 | - $col = "(TO_DAYS(" . $date_compare . ")-TO_DAYS(" . $date_orig . "))"; |
|
| 2670 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2662 | + $col = "(TO_DAYS(".$date_compare.")-TO_DAYS(".$date_orig."))"; |
|
| 2663 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2671 | 2664 | break; |
| 2672 | 2665 | case 'mois_relatif': |
| 2673 | - $col = "MONTH(" . $date_compare . ")-MONTH(" . |
|
| 2674 | - $date_orig . ")+12*(YEAR(" . $date_compare . |
|
| 2675 | - ")-YEAR(" . $date_orig . "))"; |
|
| 2676 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2666 | + $col = "MONTH(".$date_compare.")-MONTH(". |
|
| 2667 | + $date_orig.")+12*(YEAR(".$date_compare. |
|
| 2668 | + ")-YEAR(".$date_orig."))"; |
|
| 2669 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2677 | 2670 | break; |
| 2678 | 2671 | case 'annee_relatif': |
| 2679 | - $col = "YEAR(" . $date_compare . ")-YEAR(" . |
|
| 2680 | - $date_orig . ")"; |
|
| 2681 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2672 | + $col = "YEAR(".$date_compare.")-YEAR(". |
|
| 2673 | + $date_orig.")"; |
|
| 2674 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2682 | 2675 | break; |
| 2683 | 2676 | } |
| 2684 | 2677 | |
@@ -2737,10 +2730,10 @@ discard block |
||
| 2737 | 2730 | } |
| 2738 | 2731 | |
| 2739 | 2732 | $boucle->hash .= ' |
| 2740 | - $command[\'sourcemode\'] = ' . array_shift($args) . ";\n"; |
|
| 2733 | + $command[\'sourcemode\'] = ' . array_shift($args).";\n"; |
|
| 2741 | 2734 | |
| 2742 | 2735 | $boucle->hash .= ' |
| 2743 | - $command[\'source\'] = array(' . join(', ', $args) . ");\n"; |
|
| 2736 | + $command[\'source\'] = array(' . join(', ', $args).");\n"; |
|
| 2744 | 2737 | } |
| 2745 | 2738 | |
| 2746 | 2739 | |
@@ -2758,8 +2751,8 @@ discard block |
||
| 2758 | 2751 | function critere_DATA_datasource_dist($idb, &$boucles, $crit) { |
| 2759 | 2752 | $boucle = &$boucles[$idb]; |
| 2760 | 2753 | $boucle->hash .= ' |
| 2761 | - $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . '); |
|
| 2762 | - $command[\'sourcemode\'] = ' . calculer_liste($crit->param[1], $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2754 | + $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).'); |
|
| 2755 | + $command[\'sourcemode\'] = ' . calculer_liste($crit->param[1], $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2763 | 2756 | } |
| 2764 | 2757 | |
| 2765 | 2758 | |
@@ -2779,7 +2772,7 @@ discard block |
||
| 2779 | 2772 | function critere_DATA_datacache_dist($idb, &$boucles, $crit) { |
| 2780 | 2773 | $boucle = &$boucles[$idb]; |
| 2781 | 2774 | $boucle->hash .= ' |
| 2782 | - $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2775 | + $command[\'datacache\'] = ' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2783 | 2776 | } |
| 2784 | 2777 | |
| 2785 | 2778 | |
@@ -2798,7 +2791,7 @@ discard block |
||
| 2798 | 2791 | $boucle->hash .= '$command[\'args\']=array();'; |
| 2799 | 2792 | foreach ($crit->param as $param) { |
| 2800 | 2793 | $boucle->hash .= ' |
| 2801 | - $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2794 | + $command[\'args\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2802 | 2795 | } |
| 2803 | 2796 | } |
| 2804 | 2797 | |
@@ -2817,10 +2810,10 @@ discard block |
||
| 2817 | 2810 | */ |
| 2818 | 2811 | function critere_DATA_liste_dist($idb, &$boucles, $crit) { |
| 2819 | 2812 | $boucle = &$boucles[$idb]; |
| 2820 | - $boucle->hash .= "\n\t" . '$command[\'liste\'] = array();' . "\n"; |
|
| 2813 | + $boucle->hash .= "\n\t".'$command[\'liste\'] = array();'."\n"; |
|
| 2821 | 2814 | foreach ($crit->param as $param) { |
| 2822 | - $boucle->hash .= "\t" . '$command[\'liste\'][] = ' . calculer_liste($param, $idb, $boucles, |
|
| 2823 | - $boucles[$idb]->id_parent) . ";\n"; |
|
| 2815 | + $boucle->hash .= "\t".'$command[\'liste\'][] = '.calculer_liste($param, $idb, $boucles, |
|
| 2816 | + $boucles[$idb]->id_parent).";\n"; |
|
| 2824 | 2817 | } |
| 2825 | 2818 | } |
| 2826 | 2819 | |
@@ -2847,10 +2840,10 @@ discard block |
||
| 2847 | 2840 | */ |
| 2848 | 2841 | function critere_DATA_enum_dist($idb, &$boucles, $crit) { |
| 2849 | 2842 | $boucle = &$boucles[$idb]; |
| 2850 | - $boucle->hash .= "\n\t" . '$command[\'enum\'] = array();' . "\n"; |
|
| 2843 | + $boucle->hash .= "\n\t".'$command[\'enum\'] = array();'."\n"; |
|
| 2851 | 2844 | foreach ($crit->param as $param) { |
| 2852 | - $boucle->hash .= "\t" . '$command[\'enum\'][] = ' . calculer_liste($param, $idb, $boucles, |
|
| 2853 | - $boucles[$idb]->id_parent) . ";\n"; |
|
| 2845 | + $boucle->hash .= "\t".'$command[\'enum\'][] = '.calculer_liste($param, $idb, $boucles, |
|
| 2846 | + $boucles[$idb]->id_parent).";\n"; |
|
| 2854 | 2847 | } |
| 2855 | 2848 | } |
| 2856 | 2849 | |
@@ -2869,7 +2862,7 @@ discard block |
||
| 2869 | 2862 | $boucle = &$boucles[$idb]; |
| 2870 | 2863 | foreach ($crit->param as $param) { |
| 2871 | 2864 | $boucle->hash .= ' |
| 2872 | - $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2865 | + $command[\'datapath\'][] = ' . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2873 | 2866 | } |
| 2874 | 2867 | } |
| 2875 | 2868 | |
@@ -2910,7 +2903,7 @@ discard block |
||
| 2910 | 2903 | if ($crit->param) { |
| 2911 | 2904 | foreach ($crit->param as $param) { |
| 2912 | 2905 | $boucle->hash .= "\t\$command['si'][] = " |
| 2913 | - . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent) . ";\n"; |
|
| 2906 | + . calculer_liste($param, $idb, $boucles, $boucles[$idb]->id_parent).";\n"; |
|
| 2914 | 2907 | } |
| 2915 | 2908 | // interdire {si 0} aussi ! |
| 2916 | 2909 | } else { |
@@ -2933,7 +2926,7 @@ discard block |
||
| 2933 | 2926 | function critere_POUR_tableau_dist($idb, &$boucles, $crit) { |
| 2934 | 2927 | $boucle = &$boucles[$idb]; |
| 2935 | 2928 | $boucle->hash .= ' |
| 2936 | - $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent) . '); |
|
| 2929 | + $command[\'source\'] = array(' . calculer_liste($crit->param[0], $idb, $boucles, $boucles[$idb]->id_parent).'); |
|
| 2937 | 2930 | $command[\'sourcemode\'] = \'table\';'; |
| 2938 | 2931 | } |
| 2939 | 2932 | |
@@ -2966,11 +2959,10 @@ discard block |
||
| 2966 | 2959 | $table_sql = table_objet_sql(objet_type($table)); |
| 2967 | 2960 | |
| 2968 | 2961 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 2969 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 2970 | - 'id_parent'; |
|
| 2962 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 2971 | 2963 | |
| 2972 | 2964 | $in = "IN"; |
| 2973 | - $where = array("'IN'", "'$boucle->id_table." . "$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"); |
|
| 2965 | + $where = array("'IN'", "'$boucle->id_table."."$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"); |
|
| 2974 | 2966 | if ($not) { |
| 2975 | 2967 | $where = array("'NOT'", $where); |
| 2976 | 2968 | } |
@@ -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 |