@@ -29,7 +29,7 @@ discard block |
||
| 29 | 29 | $type .= ($struct->type_requete ?: $struct->table_optionnelle); |
| 30 | 30 | |
| 31 | 31 | if ($struct->jointures_explicites) { |
| 32 | - $type .= ' ' . $struct->jointures_explicites; |
|
| 32 | + $type .= ' '.$struct->jointures_explicites; |
|
| 33 | 33 | } |
| 34 | 34 | if ($struct->table_optionnelle) { |
| 35 | 35 | $type .= '?'; |
@@ -38,11 +38,11 @@ discard block |
||
| 38 | 38 | |
| 39 | 39 | $crit = $struct->param; |
| 40 | 40 | if ($crit and !is_array($crit[0])) { |
| 41 | - $type = strtolower($type) . array_shift($crit); |
|
| 41 | + $type = strtolower($type).array_shift($crit); |
|
| 42 | 42 | } |
| 43 | 43 | $crit = decompiler_criteres($struct, $fmt, $prof); |
| 44 | 44 | |
| 45 | - $f = 'format_boucle_' . $fmt; |
|
| 45 | + $f = 'format_boucle_'.$fmt; |
|
| 46 | 46 | |
| 47 | 47 | return $f($preaff, $avant, $nom, $type, $crit, $milieu, $apres, $altern, $postaff, $prof); |
| 48 | 48 | } |
@@ -55,21 +55,20 @@ discard block |
||
| 55 | 55 | $res[] = decompiler_($v, $fmt, $prof); |
| 56 | 56 | } |
| 57 | 57 | } |
| 58 | - $file = is_string($struct->texte) ? $struct->texte : |
|
| 59 | - decompiler_($struct->texte, $fmt, $prof); |
|
| 60 | - $f = 'format_inclure_' . $fmt; |
|
| 58 | + $file = is_string($struct->texte) ? $struct->texte : decompiler_($struct->texte, $fmt, $prof); |
|
| 59 | + $f = 'format_inclure_'.$fmt; |
|
| 61 | 60 | |
| 62 | 61 | return $f($file, $res, $prof); |
| 63 | 62 | } |
| 64 | 63 | |
| 65 | 64 | function decompiler_texte($struct, $fmt = '', $prof = 0) { |
| 66 | - $f = 'format_texte_' . $fmt; |
|
| 65 | + $f = 'format_texte_'.$fmt; |
|
| 67 | 66 | |
| 68 | 67 | return strlen($struct->texte) ? $f($struct->texte, $prof) : ''; |
| 69 | 68 | } |
| 70 | 69 | |
| 71 | 70 | function decompiler_polyglotte($struct, $fmt = '', $prof = 0) { |
| 72 | - $f = 'format_polyglotte_' . $fmt; |
|
| 71 | + $f = 'format_polyglotte_'.$fmt; |
|
| 73 | 72 | |
| 74 | 73 | return $f($struct->traductions, $prof); |
| 75 | 74 | } |
@@ -82,7 +81,7 @@ discard block |
||
| 82 | 81 | |
| 83 | 82 | $filtres = decompiler_liste($struct->param, $fmt, $prof); |
| 84 | 83 | |
| 85 | - $f = 'format_idiome_' . $fmt; |
|
| 84 | + $f = 'format_idiome_'.$fmt; |
|
| 86 | 85 | |
| 87 | 86 | return $f($struct->nom_champ, $struct->module, $args, $filtres, $prof); |
| 88 | 87 | } |
@@ -97,7 +96,7 @@ discard block |
||
| 97 | 96 | } |
| 98 | 97 | $filtres = decompiler_liste($p, $fmt, $prof); |
| 99 | 98 | } |
| 100 | - $f = 'format_champ_' . $fmt; |
|
| 99 | + $f = 'format_champ_'.$fmt; |
|
| 101 | 100 | |
| 102 | 101 | return $f($struct->nom_champ, $struct->nom_boucle, $struct->etoile, $avant, $apres, $args, $filtres, $prof); |
| 103 | 102 | } |
@@ -106,7 +105,7 @@ discard block |
||
| 106 | 105 | if (!is_array($sources)) { |
| 107 | 106 | return ''; |
| 108 | 107 | } |
| 109 | - $f = 'format_liste_' . $fmt; |
|
| 108 | + $f = 'format_liste_'.$fmt; |
|
| 110 | 109 | $res = ''; |
| 111 | 110 | foreach ($sources as $arg) { |
| 112 | 111 | if (!is_array($arg)) { |
@@ -123,7 +122,7 @@ discard block |
||
| 123 | 122 | and (strlen($v[0]->apres) == 1) |
| 124 | 123 | and $v[0]->apres == $v[0]->avant |
| 125 | 124 | ) { |
| 126 | - $args[] = $v[0]->avant . $v[0]->texte . $v[0]->apres; |
|
| 125 | + $args[] = $v[0]->avant.$v[0]->texte.$v[0]->apres; |
|
| 127 | 126 | } else { |
| 128 | 127 | $args[] = decompiler_($v, $fmt, 0 - $prof); |
| 129 | 128 | } |
@@ -146,7 +145,7 @@ discard block |
||
| 146 | 145 | return ''; |
| 147 | 146 | } |
| 148 | 147 | $res = ''; |
| 149 | - $f = 'format_critere_' . $fmt; |
|
| 148 | + $f = 'format_critere_'.$fmt; |
|
| 150 | 149 | foreach ($sources as $crit) { |
| 151 | 150 | if (!is_array($crit)) { |
| 152 | 151 | continue; |
@@ -159,13 +158,13 @@ discard block |
||
| 159 | 158 | and $v[0]->type == 'texte' |
| 160 | 159 | and $v[0]->apres |
| 161 | 160 | ) { |
| 162 | - $args[] = [['texte', ($v[0]->apres . $v[0]->texte . $v[0]->apres)]]; |
|
| 161 | + $args[] = [['texte', ($v[0]->apres.$v[0]->texte.$v[0]->apres)]]; |
|
| 163 | 162 | } else { |
| 164 | 163 | $res2 = []; |
| 165 | 164 | foreach ($v as $k => $p) { |
| 166 | 165 | if ( |
| 167 | 166 | isset($p->type) |
| 168 | - and function_exists($d = 'decompiler_' . $p->type) |
|
| 167 | + and function_exists($d = 'decompiler_'.$p->type) |
|
| 169 | 168 | ) { |
| 170 | 169 | $r = $d($p, $fmt, (0 - $prof)); |
| 171 | 170 | $res2[] = [$p->type, $r]; |
@@ -193,7 +192,7 @@ discard block |
||
| 193 | 192 | if (!isset($p->type)) { |
| 194 | 193 | continue; |
| 195 | 194 | } #?????? |
| 196 | - $d = 'decompiler_' . $p->type; |
|
| 195 | + $d = 'decompiler_'.$p->type; |
|
| 197 | 196 | $next = $liste[$k + 1] ?? false; |
| 198 | 197 | // Forcer le champ etendu si son source (pas les reecritures) |
| 199 | 198 | // contenait des args et s'il est suivi d'espaces, |
@@ -218,16 +217,16 @@ discard block |
||
| 218 | 217 | } |
| 219 | 218 | $contenu[] = [$d($p, $fmt, $prof2), $p->type]; |
| 220 | 219 | } |
| 221 | - $f = 'format_suite_' . $fmt; |
|
| 220 | + $f = 'format_suite_'.$fmt; |
|
| 222 | 221 | |
| 223 | 222 | return $f($contenu); |
| 224 | 223 | } |
| 225 | 224 | |
| 226 | 225 | function public_decompiler($liste, $fmt = '', $prof = 0, $quoi = '') { |
| 227 | - if (!include_spip('public/format_' . $fmt)) { |
|
| 226 | + if (!include_spip('public/format_'.$fmt)) { |
|
| 228 | 227 | return "'$fmt'?"; |
| 229 | 228 | } |
| 230 | - $f = 'decompiler_' . $quoi; |
|
| 229 | + $f = 'decompiler_'.$quoi; |
|
| 231 | 230 | |
| 232 | 231 | return $f($liste, $fmt, $prof); |
| 233 | 232 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | $md5args = md5($arguments); |
| 71 | 71 | |
| 72 | 72 | // si pas de date programee, des que possible |
| 73 | - $duplicate_where = 'status=' . intval(_JQ_SCHEDULED) . ' AND '; |
|
| 73 | + $duplicate_where = 'status='.intval(_JQ_SCHEDULED).' AND '; |
|
| 74 | 74 | if (!$time) { |
| 75 | 75 | $time = time(); |
| 76 | 76 | $duplicate_where = ''; // ne pas dupliquer si deja le meme job en cours d'execution |
@@ -96,9 +96,8 @@ discard block |
||
| 96 | 96 | 'id_job', |
| 97 | 97 | 'spip_jobs', |
| 98 | 98 | $duplicate_where = |
| 99 | - $duplicate_where . 'fonction=' . sql_quote($function) |
|
| 100 | - . (($no_duplicate === 'function_only') ? '' : |
|
| 101 | - ' AND md5args=' . sql_quote($md5args) . ' AND inclure=' . sql_quote($file)) |
|
| 99 | + $duplicate_where.'fonction='.sql_quote($function) |
|
| 100 | + . (($no_duplicate === 'function_only') ? '' : ' AND md5args='.sql_quote($md5args).' AND inclure='.sql_quote($file)) |
|
| 102 | 101 | ) |
| 103 | 102 | ) { |
| 104 | 103 | return $id_job; |
@@ -111,9 +110,9 @@ discard block |
||
| 111 | 110 | if ( |
| 112 | 111 | $no_duplicate |
| 113 | 112 | and |
| 114 | - $id_prev = sql_getfetsel('id_job', 'spip_jobs', 'id_job<' . intval($id_job) . " AND $duplicate_where") |
|
| 113 | + $id_prev = sql_getfetsel('id_job', 'spip_jobs', 'id_job<'.intval($id_job)." AND $duplicate_where") |
|
| 115 | 114 | ) { |
| 116 | - sql_delete('spip_jobs', 'id_job=' . intval($id_job)); |
|
| 115 | + sql_delete('spip_jobs', 'id_job='.intval($id_job)); |
|
| 117 | 116 | |
| 118 | 117 | return $id_prev; |
| 119 | 118 | } |
@@ -125,9 +124,9 @@ discard block |
||
| 125 | 124 | // ie cas d'un char non acceptables sur certains type de champs |
| 126 | 125 | // qui coupe la valeur |
| 127 | 126 | if (defined('_JQ_INSERT_CHECK_ARGS') and $id_job) { |
| 128 | - $args = sql_getfetsel('args', 'spip_jobs', 'id_job=' . intval($id_job)); |
|
| 127 | + $args = sql_getfetsel('args', 'spip_jobs', 'id_job='.intval($id_job)); |
|
| 129 | 128 | if ($args !== $arguments) { |
| 130 | - spip_log('arguments job errones / longueur ' . strlen($args) . ' vs ' . strlen($arguments) . ' / valeur : ' . var_export( |
|
| 129 | + spip_log('arguments job errones / longueur '.strlen($args).' vs '.strlen($arguments).' / valeur : '.var_export( |
|
| 131 | 130 | $arguments, |
| 132 | 131 | true |
| 133 | 132 | ), 'queue'); |
@@ -157,7 +156,7 @@ discard block |
||
| 157 | 156 | function queue_purger() { |
| 158 | 157 | include_spip('base/abstract_sql'); |
| 159 | 158 | sql_delete('spip_jobs'); |
| 160 | - sql_delete('spip_jobs_liens', 'id_job NOT IN (' . sql_get_select('id_job', 'spip_jobs') . ')'); |
|
| 159 | + sql_delete('spip_jobs_liens', 'id_job NOT IN ('.sql_get_select('id_job', 'spip_jobs').')'); |
|
| 161 | 160 | include_spip('inc/genie'); |
| 162 | 161 | genie_queue_watch_dist(); |
| 163 | 162 | } |
@@ -173,8 +172,8 @@ discard block |
||
| 173 | 172 | include_spip('base/abstract_sql'); |
| 174 | 173 | |
| 175 | 174 | if ( |
| 176 | - $row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job=' . intval($id_job)) |
|
| 177 | - and $res = sql_delete('spip_jobs', 'id_job=' . intval($id_job)) |
|
| 175 | + $row = sql_fetsel('fonction,inclure,date', 'spip_jobs', 'id_job='.intval($id_job)) |
|
| 176 | + and $res = sql_delete('spip_jobs', 'id_job='.intval($id_job)) |
|
| 178 | 177 | ) { |
| 179 | 178 | queue_unlink_job($id_job); |
| 180 | 179 | // est-ce une tache cron qu'il faut relancer ? |
@@ -224,7 +223,7 @@ discard block |
||
| 224 | 223 | * resultat du sql_delete |
| 225 | 224 | */ |
| 226 | 225 | function queue_unlink_job($id_job) { |
| 227 | - return sql_delete('spip_jobs_liens', 'id_job=' . intval($id_job)); |
|
| 226 | + return sql_delete('spip_jobs_liens', 'id_job='.intval($id_job)); |
|
| 228 | 227 | } |
| 229 | 228 | |
| 230 | 229 | /** |
@@ -240,7 +239,7 @@ discard block |
||
| 240 | 239 | // deserialiser les arguments |
| 241 | 240 | $args = unserialize($row['args']); |
| 242 | 241 | if (!is_array($args)) { |
| 243 | - spip_log('arguments job errones ' . var_export($row, true), 'queue'); |
|
| 242 | + spip_log('arguments job errones '.var_export($row, true), 'queue'); |
|
| 244 | 243 | $args = []; |
| 245 | 244 | } |
| 246 | 245 | |
@@ -257,14 +256,14 @@ discard block |
||
| 257 | 256 | } |
| 258 | 257 | |
| 259 | 258 | if (!function_exists($fonction)) { |
| 260 | - spip_log("fonction $fonction ($inclure) inexistante " . var_export($row, true), 'queue'); |
|
| 259 | + spip_log("fonction $fonction ($inclure) inexistante ".var_export($row, true), 'queue'); |
|
| 261 | 260 | |
| 262 | 261 | return false; |
| 263 | 262 | } |
| 264 | 263 | |
| 265 | - spip_log('queue [' . $row['id_job'] . "]: $fonction() start", 'queue'); |
|
| 264 | + spip_log('queue ['.$row['id_job']."]: $fonction() start", 'queue'); |
|
| 266 | 265 | $res = $fonction(...$args); |
| 267 | - spip_log('queue [' . $row['id_job'] . "]: $fonction() end", 'queue'); |
|
| 266 | + spip_log('queue ['.$row['id_job']."]: $fonction() end", 'queue'); |
|
| 268 | 267 | |
| 269 | 268 | return $res; |
| 270 | 269 | } |
@@ -295,14 +294,14 @@ discard block |
||
| 295 | 294 | function queue_schedule($force_jobs = null) { |
| 296 | 295 | $time = time(); |
| 297 | 296 | if (defined('_DEBUG_BLOCK_QUEUE')) { |
| 298 | - spip_log('_DEBUG_BLOCK_QUEUE : schedule stop', 'jq' . _LOG_DEBUG); |
|
| 297 | + spip_log('_DEBUG_BLOCK_QUEUE : schedule stop', 'jq'._LOG_DEBUG); |
|
| 299 | 298 | |
| 300 | 299 | return; |
| 301 | 300 | } |
| 302 | 301 | |
| 303 | 302 | // rien a faire si le prochain job est encore dans le futur |
| 304 | 303 | if (queue_sleep_time_to_next_job() > 0 and (!$force_jobs or !count($force_jobs))) { |
| 305 | - spip_log('queue_sleep_time_to_next_job', 'jq' . _LOG_DEBUG); |
|
| 304 | + spip_log('queue_sleep_time_to_next_job', 'jq'._LOG_DEBUG); |
|
| 306 | 305 | |
| 307 | 306 | return; |
| 308 | 307 | } |
@@ -323,7 +322,7 @@ discard block |
||
| 323 | 322 | } |
| 324 | 323 | $end_time = $time + _JQ_MAX_JOBS_TIME_TO_EXECUTE; |
| 325 | 324 | |
| 326 | - spip_log("JQ schedule $time / $end_time", 'jq' . _LOG_DEBUG); |
|
| 325 | + spip_log("JQ schedule $time / $end_time", 'jq'._LOG_DEBUG); |
|
| 327 | 326 | |
| 328 | 327 | if (!defined('_JQ_MAX_JOBS_EXECUTE')) { |
| 329 | 328 | define('_JQ_MAX_JOBS_EXECUTE', 200); |
@@ -337,19 +336,19 @@ discard block |
||
| 337 | 336 | // lorsqu'un job cron n'a pas fini, sa priorite est descendue |
| 338 | 337 | // pour qu'il ne bloque pas les autres jobs en attente |
| 339 | 338 | if (is_array($force_jobs) and count($force_jobs)) { |
| 340 | - $cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND ' . sql_in('id_job', $force_jobs); |
|
| 339 | + $cond = 'status='.intval(_JQ_SCHEDULED).' AND '.sql_in('id_job', $force_jobs); |
|
| 341 | 340 | } else { |
| 342 | 341 | $now = date('Y-m-d H:i:s', $time); |
| 343 | - $cond = 'status=' . intval(_JQ_SCHEDULED) . ' AND date<=' . sql_quote($now); |
|
| 342 | + $cond = 'status='.intval(_JQ_SCHEDULED).' AND date<='.sql_quote($now); |
|
| 344 | 343 | } |
| 345 | 344 | |
| 346 | 345 | register_shutdown_function('queue_error_handler'); // recuperer les erreurs auant que possible |
| 347 | - $res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,' . (_JQ_MAX_JOBS_EXECUTE + 1)); |
|
| 346 | + $res = sql_allfetsel('*', 'spip_jobs', $cond, '', 'priorite DESC,date', '0,'.(_JQ_MAX_JOBS_EXECUTE + 1)); |
|
| 348 | 347 | do { |
| 349 | 348 | if ($row = array_shift($res)) { |
| 350 | 349 | $nbj++; |
| 351 | 350 | // il faut un verrou, a base de sql_delete |
| 352 | - if (sql_delete('spip_jobs', 'id_job=' . intval($row['id_job']) . ' AND status=' . intval(_JQ_SCHEDULED))) { |
|
| 351 | + if (sql_delete('spip_jobs', 'id_job='.intval($row['id_job']).' AND status='.intval(_JQ_SCHEDULED))) { |
|
| 353 | 352 | #spip_log("JQ schedule job ".$nbj." OK",'jq'); |
| 354 | 353 | // on reinsert dans la base aussitot avec un status=_JQ_PENDING |
| 355 | 354 | $row['status'] = _JQ_PENDING; |
@@ -364,13 +363,13 @@ discard block |
||
| 364 | 363 | queue_close_job($row, $time, $result); |
| 365 | 364 | } |
| 366 | 365 | } |
| 367 | - spip_log('JQ schedule job end time ' . $time, 'jq' . _LOG_DEBUG); |
|
| 366 | + spip_log('JQ schedule job end time '.$time, 'jq'._LOG_DEBUG); |
|
| 368 | 367 | } while ($nbj < _JQ_MAX_JOBS_EXECUTE and $row and $time < $end_time); |
| 369 | - spip_log('JQ schedule end time ' . time(), 'jq' . _LOG_DEBUG); |
|
| 368 | + spip_log('JQ schedule end time '.time(), 'jq'._LOG_DEBUG); |
|
| 370 | 369 | |
| 371 | 370 | if ($row = array_shift($res)) { |
| 372 | 371 | queue_update_next_job_time(0); // on sait qu'il y a encore des jobs a lancer ASAP |
| 373 | - spip_log('JQ encore !', 'jq' . _LOG_DEBUG); |
|
| 372 | + spip_log('JQ encore !', 'jq'._LOG_DEBUG); |
|
| 374 | 373 | } else { |
| 375 | 374 | queue_update_next_job_time(); |
| 376 | 375 | } |
@@ -405,9 +404,9 @@ discard block |
||
| 405 | 404 | } |
| 406 | 405 | } |
| 407 | 406 | // purger ses liens eventuels avec des objets |
| 408 | - sql_delete('spip_jobs_liens', 'id_job=' . intval($row['id_job'])); |
|
| 407 | + sql_delete('spip_jobs_liens', 'id_job='.intval($row['id_job'])); |
|
| 409 | 408 | // supprimer le job fini |
| 410 | - sql_delete('spip_jobs', 'id_job=' . intval($row['id_job'])); |
|
| 409 | + sql_delete('spip_jobs', 'id_job='.intval($row['id_job'])); |
|
| 411 | 410 | } |
| 412 | 411 | |
| 413 | 412 | /** |
@@ -480,18 +479,18 @@ discard block |
||
| 480 | 479 | $res = sql_allfetsel( |
| 481 | 480 | '*', |
| 482 | 481 | 'spip_jobs', |
| 483 | - 'status=' . intval(_JQ_PENDING) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time - 180)) |
|
| 482 | + 'status='.intval(_JQ_PENDING).' AND date<'.sql_quote(date('Y-m-d H:i:s', $time - 180)) |
|
| 484 | 483 | ); |
| 485 | 484 | if (is_array($res)) { |
| 486 | 485 | foreach ($res as $row) { |
| 487 | 486 | queue_close_job($row, $time); |
| 488 | - spip_log('queue_close_job car _JQ_PENDING depuis +180s : ' . print_r($row, 1), 'job_mort' . _LOG_ERREUR); |
|
| 487 | + spip_log('queue_close_job car _JQ_PENDING depuis +180s : '.print_r($row, 1), 'job_mort'._LOG_ERREUR); |
|
| 489 | 488 | } |
| 490 | 489 | } |
| 491 | 490 | |
| 492 | 491 | // chercher la date du prochain job si pas connu |
| 493 | 492 | if (is_null($next) or is_null(queue_sleep_time_to_next_job())) { |
| 494 | - $date = sql_getfetsel('date', 'spip_jobs', 'status=' . intval(_JQ_SCHEDULED), '', 'date', '0,1'); |
|
| 493 | + $date = sql_getfetsel('date', 'spip_jobs', 'status='.intval(_JQ_SCHEDULED), '', 'date', '0,1'); |
|
| 495 | 494 | $next = strtotime($date); |
| 496 | 495 | } |
| 497 | 496 | if (!is_null($next_time)) { |
@@ -504,7 +503,7 @@ discard block |
||
| 504 | 503 | if (is_null($nb_jobs_scheduled)) { |
| 505 | 504 | $nb_jobs_scheduled = sql_countsel( |
| 506 | 505 | 'spip_jobs', |
| 507 | - 'status=' . intval(_JQ_SCHEDULED) . ' AND date<' . sql_quote(date('Y-m-d H:i:s', $time)) |
|
| 506 | + 'status='.intval(_JQ_SCHEDULED).' AND date<'.sql_quote(date('Y-m-d H:i:s', $time)) |
|
| 508 | 507 | ); |
| 509 | 508 | } elseif ($next <= $time) { |
| 510 | 509 | $nb_jobs_scheduled++; |
@@ -573,7 +572,7 @@ discard block |
||
| 573 | 572 | } |
| 574 | 573 | |
| 575 | 574 | // ne pas relancer si on vient de lancer dans la meme seconde par un hit concurent |
| 576 | - if (file_exists($lock = _DIR_TMP . 'cron.lock') and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) { |
|
| 575 | + if (file_exists($lock = _DIR_TMP.'cron.lock') and !(@filemtime($lock) < $_SERVER['REQUEST_TIME'])) { |
|
| 577 | 576 | return $texte; |
| 578 | 577 | } |
| 579 | 578 | |
@@ -645,7 +644,7 @@ discard block |
||
| 645 | 644 | $port = 80; |
| 646 | 645 | } |
| 647 | 646 | $fp = @fsockopen( |
| 648 | - $scheme . $parts['host'], |
|
| 647 | + $scheme.$parts['host'], |
|
| 649 | 648 | $parts['port'] ?? $port, |
| 650 | 649 | $errno, |
| 651 | 650 | $errstr, |
@@ -655,13 +654,13 @@ discard block |
||
| 655 | 654 | if ($fp) { |
| 656 | 655 | $host_sent = $parts['host']; |
| 657 | 656 | if (isset($parts['port']) and $parts['port'] !== $port) { |
| 658 | - $host_sent .= ':' . $parts['port']; |
|
| 657 | + $host_sent .= ':'.$parts['port']; |
|
| 659 | 658 | } |
| 660 | 659 | $timeout = 200; // ms |
| 661 | 660 | stream_set_timeout($fp, 0, $timeout * 1000); |
| 662 | - $query = $parts['path'] . ($parts['query'] ? '?' . $parts['query'] : ''); |
|
| 663 | - $out = 'GET ' . $query . " HTTP/1.1\r\n"; |
|
| 664 | - $out .= 'Host: ' . $host_sent . "\r\n"; |
|
| 661 | + $query = $parts['path'].($parts['query'] ? '?'.$parts['query'] : ''); |
|
| 662 | + $out = 'GET '.$query." HTTP/1.1\r\n"; |
|
| 663 | + $out .= 'Host: '.$host_sent."\r\n"; |
|
| 665 | 664 | $out .= "Connection: Close\r\n\r\n"; |
| 666 | 665 | fwrite($fp, $out); |
| 667 | 666 | spip_timer('read'); |
@@ -358,7 +358,7 @@ discard block |
||
| 358 | 358 | */ |
| 359 | 359 | function balise_DOSSIER_SQUELETTE_dist($p) { |
| 360 | 360 | $code = substr(addslashes(dirname($p->descr['sourcefile'])), strlen(_DIR_RACINE)); |
| 361 | - $p->code = "_DIR_RACINE . '$code'" . |
|
| 361 | + $p->code = "_DIR_RACINE . '$code'". |
|
| 362 | 362 | $p->interdire_scripts = false; |
| 363 | 363 | |
| 364 | 364 | return $p; |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | */ |
| 378 | 378 | function balise_SQUELETTE_dist($p) { |
| 379 | 379 | $code = addslashes($p->descr['sourcefile']); |
| 380 | - $p->code = "'$code'" . |
|
| 380 | + $p->code = "'$code'". |
|
| 381 | 381 | $p->interdire_scripts = false; |
| 382 | 382 | |
| 383 | 383 | return $p; |
@@ -429,9 +429,9 @@ discard block |
||
| 429 | 429 | **/ |
| 430 | 430 | function balise_NOM_SITE_dist($p) { |
| 431 | 431 | if (!$p->etoile) { |
| 432 | - $p->code = 'supprimer_numero(calculer_url(' . |
|
| 433 | - champ_sql('url_site', $p) . ',' . |
|
| 434 | - champ_sql('nom_site', $p) . |
|
| 432 | + $p->code = 'supprimer_numero(calculer_url('. |
|
| 433 | + champ_sql('url_site', $p).','. |
|
| 434 | + champ_sql('nom_site', $p). |
|
| 435 | 435 | ", 'titre', \$connect, false))"; |
| 436 | 436 | } else { |
| 437 | 437 | $p->code = champ_sql('nom_site', $p); |
@@ -582,8 +582,8 @@ discard block |
||
| 582 | 582 | * Pile complétée par le code à générer |
| 583 | 583 | **/ |
| 584 | 584 | function balise_POPULARITE_ABSOLUE_dist($p) { |
| 585 | - $p->code = 'ceil(' . |
|
| 586 | - champ_sql('popularite', $p) . |
|
| 585 | + $p->code = 'ceil('. |
|
| 586 | + champ_sql('popularite', $p). |
|
| 587 | 587 | ')'; |
| 588 | 588 | $p->interdire_scripts = false; |
| 589 | 589 | |
@@ -664,7 +664,7 @@ discard block |
||
| 664 | 664 | $p->code = index_pile($p->id_boucle, 'valeur', $p->boucles, $b); |
| 665 | 665 | ; |
| 666 | 666 | if (($v = interprete_argument_balise(1, $p)) !== null) { |
| 667 | - $p->code = 'table_valeur(' . $p->code . ', ' . $v . ')'; |
|
| 667 | + $p->code = 'table_valeur('.$p->code.', '.$v.')'; |
|
| 668 | 668 | } |
| 669 | 669 | $p->interdire_scripts = true; |
| 670 | 670 | |
@@ -804,16 +804,16 @@ discard block |
||
| 804 | 804 | $trouver_table = charger_fonction('trouver_table', 'base'); |
| 805 | 805 | if ($desc = $trouver_table(table_objet_sql($type_objet))) { |
| 806 | 806 | if (isset($desc['field']['descriptif'])) { |
| 807 | - $_ligne .= "'descriptif' => " . champ_sql('descriptif', $p) . ','; |
|
| 807 | + $_ligne .= "'descriptif' => ".champ_sql('descriptif', $p).','; |
|
| 808 | 808 | } |
| 809 | 809 | if (isset($desc['field']['texte'])) { |
| 810 | - $_ligne .= "'texte' => " . champ_sql('texte', $p) . ','; |
|
| 810 | + $_ligne .= "'texte' => ".champ_sql('texte', $p).','; |
|
| 811 | 811 | } |
| 812 | 812 | if (isset($desc['field']['chapo'])) { |
| 813 | - $_ligne .= "'chapo' => " . champ_sql('chapo', $p) . ','; |
|
| 813 | + $_ligne .= "'chapo' => ".champ_sql('chapo', $p).','; |
|
| 814 | 814 | } |
| 815 | 815 | if (isset($desc['introduction_longueur'])) { |
| 816 | - $_introduction_longueur = "'" . $desc['introduction_longueur'] . "'"; |
|
| 816 | + $_introduction_longueur = "'".$desc['introduction_longueur']."'"; |
|
| 817 | 817 | } |
| 818 | 818 | } |
| 819 | 819 | $_ligne .= ')'; |
@@ -909,10 +909,10 @@ discard block |
||
| 909 | 909 | $p->code = sprintf( |
| 910 | 910 | CODE_RECUPERER_FOND, |
| 911 | 911 | "'modeles/lesauteurs'", |
| 912 | - "array('objet'=>'" . $objet . |
|
| 913 | - "','id_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 914 | - ",'$id_table_objet' => " . champ_sql($id_table_objet, $p) . |
|
| 915 | - ($objet == 'article' ? '' : ",'id_article' => " . champ_sql('id_article', $p)) . |
|
| 912 | + "array('objet'=>'".$objet. |
|
| 913 | + "','id_objet' => ".champ_sql($id_table_objet, $p). |
|
| 914 | + ",'$id_table_objet' => ".champ_sql($id_table_objet, $p). |
|
| 915 | + ($objet == 'article' ? '' : ",'id_article' => ".champ_sql('id_article', $p)). |
|
| 916 | 916 | ')', |
| 917 | 917 | "'trim'=>true, 'compil'=>array($c)", |
| 918 | 918 | _q($connect) |
@@ -981,7 +981,7 @@ discard block |
||
| 981 | 981 | $m = trim($m); |
| 982 | 982 | if ($m != "''") { |
| 983 | 983 | if (!preg_match(',\W,', $m)) { |
| 984 | - $m = $boucle->id_table . ".$m"; |
|
| 984 | + $m = $boucle->id_table.".$m"; |
|
| 985 | 985 | } |
| 986 | 986 | |
| 987 | 987 | $m .= ' AS titre_rang'; |
@@ -1142,7 +1142,7 @@ discard block |
||
| 1142 | 1142 | $f_pagination = chercher_filtre('pagination'); |
| 1143 | 1143 | $type = $p->boucles[$b]->modificateur['debut_nom']; |
| 1144 | 1144 | $modif = ($type[0] !== "'") ? "'debut'.$type" |
| 1145 | - : ("'debut" . substr($type, 1)); |
|
| 1145 | + : ("'debut".substr($type, 1)); |
|
| 1146 | 1146 | |
| 1147 | 1147 | $p->code = sprintf( |
| 1148 | 1148 | CODE_PAGINATION, |
@@ -1285,7 +1285,7 @@ discard block |
||
| 1285 | 1285 | $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN']]; |
| 1286 | 1286 | erreur_squelette($msg, $p); |
| 1287 | 1287 | } else { |
| 1288 | - $p->code = 'find_in_path((string)' . $arg . ')'; |
|
| 1288 | + $p->code = 'find_in_path((string)'.$arg.')'; |
|
| 1289 | 1289 | } |
| 1290 | 1290 | |
| 1291 | 1291 | $p->interdire_scripts = false; |
@@ -1320,7 +1320,7 @@ discard block |
||
| 1320 | 1320 | $msg = ['zbug_balise_sans_argument', ['balise' => ' CHEMIN_IMAGE']]; |
| 1321 | 1321 | erreur_squelette($msg, $p); |
| 1322 | 1322 | } else { |
| 1323 | - $p->code = 'chemin_image((string)' . $arg . ')'; |
|
| 1323 | + $p->code = 'chemin_image((string)'.$arg.')'; |
|
| 1324 | 1324 | } |
| 1325 | 1325 | |
| 1326 | 1326 | $p->interdire_scripts = false; |
@@ -1374,7 +1374,7 @@ discard block |
||
| 1374 | 1374 | // cas de #ENV sans argument : on retourne le serialize() du tableau |
| 1375 | 1375 | // une belle fonction [(#ENV|affiche_env)] serait pratique |
| 1376 | 1376 | if ($src) { |
| 1377 | - $p->code = '(is_array($a = (' . $src . ')) ? serialize($a) : "")'; |
|
| 1377 | + $p->code = '(is_array($a = ('.$src.')) ? serialize($a) : "")'; |
|
| 1378 | 1378 | } else { |
| 1379 | 1379 | $p->code = 'serialize($Pile[0]??[])'; |
| 1380 | 1380 | } |
@@ -1427,8 +1427,8 @@ discard block |
||
| 1427 | 1427 | $_sinon = interprete_argument_balise(2, $p); |
| 1428 | 1428 | $_unserialize = sinon(interprete_argument_balise(3, $p), 'false'); |
| 1429 | 1429 | |
| 1430 | - $p->code = '(include_spip(\'inc/config\')?lire_config(' . $arg . ',' . |
|
| 1431 | - ($_sinon && $_sinon != "''" ? $_sinon : 'null') . ',' . $_unserialize . "):'')"; |
|
| 1430 | + $p->code = '(include_spip(\'inc/config\')?lire_config('.$arg.','. |
|
| 1431 | + ($_sinon && $_sinon != "''" ? $_sinon : 'null').','.$_unserialize."):'')"; |
|
| 1432 | 1432 | |
| 1433 | 1433 | return $p; |
| 1434 | 1434 | } |
@@ -1521,7 +1521,7 @@ discard block |
||
| 1521 | 1521 | $err_b_s_a = ['zbug_balise_sans_argument', ['balise' => 'SESSION_SET']]; |
| 1522 | 1522 | erreur_squelette($err_b_s_a, $p); |
| 1523 | 1523 | } else { |
| 1524 | - $p->code = '(include_spip("inc/session") AND session_set(' . $_nom . ',' . $_val . '))'; |
|
| 1524 | + $p->code = '(include_spip("inc/session") AND session_set('.$_nom.','.$_val.'))'; |
|
| 1525 | 1525 | } |
| 1526 | 1526 | |
| 1527 | 1527 | $p->interdire_scripts = false; |
@@ -1569,7 +1569,7 @@ discard block |
||
| 1569 | 1569 | ) |
| 1570 | 1570 | ) { |
| 1571 | 1571 | $p->code = /* $r[1]. */ |
| 1572 | - '(' . $r[2] . ')'; |
|
| 1572 | + '('.$r[2].')'; |
|
| 1573 | 1573 | } else { |
| 1574 | 1574 | $p->code = "eval('return '.$php.';')"; |
| 1575 | 1575 | } |
@@ -1813,9 +1813,9 @@ discard block |
||
| 1813 | 1813 | |
| 1814 | 1814 | // noter la duree du cache dans un entete proprietaire |
| 1815 | 1815 | |
| 1816 | - $code = "'<'.'" . '?php header("X-Spip-Cache: ' |
|
| 1816 | + $code = "'<'.'".'?php header("X-Spip-Cache: ' |
|
| 1817 | 1817 | . $duree |
| 1818 | - . '"); ?' . "'.'>'"; |
|
| 1818 | + . '"); ?'."'.'>'"; |
|
| 1819 | 1819 | |
| 1820 | 1820 | // Remplir le header Cache-Control |
| 1821 | 1821 | // cas #CACHE{0} |
@@ -1836,9 +1836,9 @@ discard block |
||
| 1836 | 1836 | $pa == 'cache-client' |
| 1837 | 1837 | and $duree > 0 |
| 1838 | 1838 | ) { |
| 1839 | - $code .= ".'<'.'" . '?php header("Cache-Control: max-age=' |
|
| 1839 | + $code .= ".'<'.'".'?php header("Cache-Control: max-age=' |
|
| 1840 | 1840 | . $duree |
| 1841 | - . '"); ?' . "'.'>'"; |
|
| 1841 | + . '"); ?'."'.'>'"; |
|
| 1842 | 1842 | // il semble logique, si on cache-client, de ne pas invalider |
| 1843 | 1843 | $pa = 'statique'; |
| 1844 | 1844 | } |
@@ -1847,7 +1847,7 @@ discard block |
||
| 1847 | 1847 | $pa == 'statique' |
| 1848 | 1848 | and $duree > 0 |
| 1849 | 1849 | ) { |
| 1850 | - $code .= ".'<'.'" . '?php header("X-Spip-Statique: oui"); ?' . "'.'>'"; |
|
| 1850 | + $code .= ".'<'.'".'?php header("X-Spip-Statique: oui"); ?'."'.'>'"; |
|
| 1851 | 1851 | } |
| 1852 | 1852 | } |
| 1853 | 1853 | } else { |
@@ -2011,9 +2011,9 @@ discard block |
||
| 2011 | 2011 | if ($p->etoile) { |
| 2012 | 2012 | $_options[] = "'etoile'=>true"; |
| 2013 | 2013 | } |
| 2014 | - $_options[] = "'compil'=>array(" . memoriser_contexte_compil($p) . ')'; |
|
| 2014 | + $_options[] = "'compil'=>array(".memoriser_contexte_compil($p).')'; |
|
| 2015 | 2015 | |
| 2016 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2016 | + $_l = 'array('.join(",\n\t", $_contexte).')'; |
|
| 2017 | 2017 | if ($flag_env) { |
| 2018 | 2018 | $_l = "array_merge(\$Pile[0],$_l)"; |
| 2019 | 2019 | } |
@@ -2023,7 +2023,7 @@ discard block |
||
| 2023 | 2023 | $msg = ['zbug_balise_sans_argument', ['balise' => ' INCLURE']]; |
| 2024 | 2024 | erreur_squelette($msg, $p); |
| 2025 | 2025 | } else { |
| 2026 | - $p->code = 'charge_scripts(' . $_contexte[1] . ',false)'; |
|
| 2026 | + $p->code = 'charge_scripts('.$_contexte[1].',false)'; |
|
| 2027 | 2027 | } |
| 2028 | 2028 | |
| 2029 | 2029 | $p->interdire_scripts = false; // la securite est assuree par recuperer_fond |
@@ -2071,7 +2071,7 @@ discard block |
||
| 2071 | 2071 | unset($_contexte[1]); |
| 2072 | 2072 | |
| 2073 | 2073 | if (preg_match("/^\s*'[^']*'/s", $nom)) { |
| 2074 | - $nom = "'modeles/" . substr($nom, 1); |
|
| 2074 | + $nom = "'modeles/".substr($nom, 1); |
|
| 2075 | 2075 | } else { |
| 2076 | 2076 | $nom = "'modeles/' . $nom"; |
| 2077 | 2077 | } |
@@ -2088,8 +2088,8 @@ discard block |
||
| 2088 | 2088 | $primary = $p->boucles[$p->id_boucle]->primary; |
| 2089 | 2089 | if (!strpos($primary, ',')) { |
| 2090 | 2090 | $id = champ_sql($primary, $p); |
| 2091 | - $_contexte[] = "'$primary'=>" . $id; |
|
| 2092 | - $_contexte[] = "'id'=>" . $id; |
|
| 2091 | + $_contexte[] = "'$primary'=>".$id; |
|
| 2092 | + $_contexte[] = "'id'=>".$id; |
|
| 2093 | 2093 | } |
| 2094 | 2094 | } |
| 2095 | 2095 | $_contexte[] = "'recurs'=>(++\$recurs)"; |
@@ -2101,11 +2101,11 @@ discard block |
||
| 2101 | 2101 | $_options = memoriser_contexte_compil($p); |
| 2102 | 2102 | $_options = "'compil'=>array($_options), 'trim'=>true"; |
| 2103 | 2103 | if (isset($_contexte['ajax'])) { |
| 2104 | - $_options .= ', ' . preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2104 | + $_options .= ', '.preg_replace(',=>(.*)$,ims', '=> ($v=(\\1))?$v:true', $_contexte['ajax']); |
|
| 2105 | 2105 | unset($_contexte['ajax']); |
| 2106 | 2106 | } |
| 2107 | 2107 | |
| 2108 | - $_l = 'array(' . join(",\n\t", $_contexte) . ')'; |
|
| 2108 | + $_l = 'array('.join(",\n\t", $_contexte).')'; |
|
| 2109 | 2109 | if ($flag_env) { |
| 2110 | 2110 | $_l = "array_merge(\$Pile[0],$_l)"; |
| 2111 | 2111 | } |
@@ -2215,12 +2215,12 @@ discard block |
||
| 2215 | 2215 | function balise_DOUBLONS_dist($p) { |
| 2216 | 2216 | if ($type = interprete_argument_balise(1, $p)) { |
| 2217 | 2217 | if ($famille = interprete_argument_balise(2, $p)) { |
| 2218 | - $type .= '.' . $famille; |
|
| 2218 | + $type .= '.'.$famille; |
|
| 2219 | 2219 | } |
| 2220 | - $p->code = '(isset($doublons[' . $type . ']) ? $doublons[' . $type . '] : "")'; |
|
| 2220 | + $p->code = '(isset($doublons['.$type.']) ? $doublons['.$type.'] : "")'; |
|
| 2221 | 2221 | if (!$p->etoile) { |
| 2222 | 2222 | $p->code = 'array_filter(array_map("intval",explode(",",' |
| 2223 | - . $p->code . ')))'; |
|
| 2223 | + . $p->code.')))'; |
|
| 2224 | 2224 | } |
| 2225 | 2225 | } else { |
| 2226 | 2226 | $p->code = '$doublons'; |
@@ -2349,7 +2349,7 @@ discard block |
||
| 2349 | 2349 | $_code[] = "$_key => $_val"; |
| 2350 | 2350 | } |
| 2351 | 2351 | } while ($_key && $_val); |
| 2352 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2352 | + $p->code = 'array('.join(', ', $_code).')'; |
|
| 2353 | 2353 | $p->interdire_scripts = false; |
| 2354 | 2354 | |
| 2355 | 2355 | return $p; |
@@ -2376,7 +2376,7 @@ discard block |
||
| 2376 | 2376 | while ($_val = interprete_argument_balise($n++, $p)) { |
| 2377 | 2377 | $_code[] = $_val; |
| 2378 | 2378 | } |
| 2379 | - $p->code = 'array(' . join(', ', $_code) . ')'; |
|
| 2379 | + $p->code = 'array('.join(', ', $_code).')'; |
|
| 2380 | 2380 | $p->interdire_scripts = false; |
| 2381 | 2381 | |
| 2382 | 2382 | return $p; |
@@ -2421,10 +2421,10 @@ discard block |
||
| 2421 | 2421 | $_code[] = $_v; |
| 2422 | 2422 | } |
| 2423 | 2423 | |
| 2424 | - $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser(' . join( |
|
| 2424 | + $p->code = '((function_exists("autoriser")||include_spip("inc/autoriser"))&&autoriser('.join( |
|
| 2425 | 2425 | ', ', |
| 2426 | 2426 | $_code |
| 2427 | - ) . ')?" ":"")'; |
|
| 2427 | + ).')?" ":"")'; |
|
| 2428 | 2428 | $p->interdire_scripts = false; |
| 2429 | 2429 | |
| 2430 | 2430 | return $p; |
@@ -2457,7 +2457,7 @@ discard block |
||
| 2457 | 2457 | $type_info = isset($type_info) ? str_replace('\'', '"', $type_info) : '"est_actif"'; |
| 2458 | 2458 | |
| 2459 | 2459 | $f = chercher_filtre('info_plugin'); |
| 2460 | - $p->code = $f . '(' . $plugin . ', ' . $type_info . ')'; |
|
| 2460 | + $p->code = $f.'('.$plugin.', '.$type_info.')'; |
|
| 2461 | 2461 | |
| 2462 | 2462 | return $p; |
| 2463 | 2463 | } |
@@ -2709,12 +2709,12 @@ discard block |
||
| 2709 | 2709 | $_issens = "in_array($_champ,array('>','<'))"; |
| 2710 | 2710 | $_sens = "(strpos('< >',$_champ)-1)"; |
| 2711 | 2711 | |
| 2712 | - $_variable = "((\$s=$_issens)?'sens':'tri')." . $boucle->modificateur['tri_nom']; |
|
| 2712 | + $_variable = "((\$s=$_issens)?'sens':'tri').".$boucle->modificateur['tri_nom']; |
|
| 2713 | 2713 | $_url = "parametre_url(self(),$_variable,\$s?$_sens:$_champ)"; |
| 2714 | - $_url = "parametre_url($_url,'var_memotri',strncmp(" . $boucle->modificateur['tri_nom'] . ",'session',7)==0?$_variable:'')"; |
|
| 2715 | - $_on = '$s?(' . $boucle->modificateur['tri_sens'] . "==$_sens" . '):(' . $boucle->modificateur['tri_champ'] . "==$_champ)"; |
|
| 2714 | + $_url = "parametre_url($_url,'var_memotri',strncmp(".$boucle->modificateur['tri_nom'].",'session',7)==0?$_variable:'')"; |
|
| 2715 | + $_on = '$s?('.$boucle->modificateur['tri_sens']."==$_sens".'):('.$boucle->modificateur['tri_champ']."==$_champ)"; |
|
| 2716 | 2716 | |
| 2717 | - $p->code = "lien_ou_expose($_url,$_libelle,$_on" . ($_class ? ",$_class" : '') . ')'; |
|
| 2717 | + $p->code = "lien_ou_expose($_url,$_libelle,$_on".($_class ? ",$_class" : '').')'; |
|
| 2718 | 2718 | //$p->code = "''"; |
| 2719 | 2719 | $p->interdire_scripts = false; |
| 2720 | 2720 | |
@@ -2787,7 +2787,7 @@ discard block |
||
| 2787 | 2787 | $connect = $p->boucles[$p->id_boucle]->sql_serveur; |
| 2788 | 2788 | } |
| 2789 | 2789 | |
| 2790 | - $p->code = '(objet_test_si_publie(' . $_type . ',intval(' . $_id . '),' . _q($connect) . ")?' ':'')"; |
|
| 2790 | + $p->code = '(objet_test_si_publie('.$_type.',intval('.$_id.'),'._q($connect).")?' ':'')"; |
|
| 2791 | 2791 | $p->interdire_scripts = false; |
| 2792 | 2792 | |
| 2793 | 2793 | return $p; |
@@ -31,11 +31,11 @@ discard block |
||
| 31 | 31 | $nonce = random_bytes(\SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); |
| 32 | 32 | $padded_message = sodium_pad($message, 16); |
| 33 | 33 | $encrypted = sodium_crypto_secretbox($padded_message, $nonce, $key); |
| 34 | - $encoded = base64_encode($salt . $nonce . $encrypted); |
|
| 34 | + $encoded = base64_encode($salt.$nonce.$encrypted); |
|
| 35 | 35 | sodium_memzero($key); |
| 36 | 36 | sodium_memzero($nonce); |
| 37 | 37 | sodium_memzero($salt); |
| 38 | - spip_log("chiffrer($message)=$encoded", 'chiffrer' . _LOG_DEBUG); |
|
| 38 | + spip_log("chiffrer($message)=$encoded", 'chiffrer'._LOG_DEBUG); |
|
| 39 | 39 | return $encoded; |
| 40 | 40 | } |
| 41 | 41 | |
@@ -48,18 +48,18 @@ discard block |
||
| 48 | 48 | $decoded = base64_decode($encoded); |
| 49 | 49 | $salt = substr($decoded, 0, \SODIUM_CRYPTO_PWHASH_SALTBYTES); |
| 50 | 50 | $nonce = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES, \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); |
| 51 | - $encrypted = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES + \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); |
|
| 51 | + $encrypted = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES +\SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); |
|
| 52 | 52 | $key = self::deriveKeyFromPassword($key, $salt); |
| 53 | 53 | $padded_message = sodium_crypto_secretbox_open($encrypted, $nonce, $key); |
| 54 | 54 | sodium_memzero($key); |
| 55 | 55 | sodium_memzero($nonce); |
| 56 | 56 | sodium_memzero($salt); |
| 57 | 57 | if ($padded_message === false) { |
| 58 | - spip_log("dechiffrer() chiffre corrompu `$encoded`", 'chiffrer' . _LOG_DEBUG); |
|
| 58 | + spip_log("dechiffrer() chiffre corrompu `$encoded`", 'chiffrer'._LOG_DEBUG); |
|
| 59 | 59 | return null; |
| 60 | 60 | } |
| 61 | 61 | $message = sodium_unpad($padded_message, 16); |
| 62 | - spip_log("dechiffrer($encoded)=$message", 'chiffrer' . _LOG_DEBUG); |
|
| 62 | + spip_log("dechiffrer($encoded)=$message", 'chiffrer'._LOG_DEBUG); |
|
| 63 | 63 | return $message; |
| 64 | 64 | } |
| 65 | 65 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | if (!$fonc) { |
| 139 | 139 | $fonc = $GLOBALS['debug_objets']['principal']; |
| 140 | 140 | } |
| 141 | - $titre = !$mode ? $fonc : ($mode . (isset($GLOBALS['debug_objets']['sourcefile'][$fonc]) ? ' ' . $GLOBALS['debug_objets']['sourcefile'][$fonc] : '')); |
|
| 141 | + $titre = !$mode ? $fonc : ($mode.(isset($GLOBALS['debug_objets']['sourcefile'][$fonc]) ? ' '.$GLOBALS['debug_objets']['sourcefile'][$fonc] : '')); |
|
| 142 | 142 | } |
| 143 | 143 | if ($message === false) { |
| 144 | 144 | lang_select(); |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | $fond = $GLOBALS['fond'] ?? ''; |
| 168 | 168 | // une erreur critique sort $message en array |
| 169 | 169 | $debug = is_array($msg) ? $msg[1] : $msg; |
| 170 | - spip_log('Debug: ' . $debug . ' (' . $fond . ')'); |
|
| 170 | + spip_log('Debug: '.$debug.' ('.$fond.')'); |
|
| 171 | 171 | |
| 172 | 172 | return $msg; |
| 173 | 173 | } |
@@ -175,7 +175,7 @@ discard block |
||
| 175 | 175 | function debusquer_bandeau($erreurs) { |
| 176 | 176 | |
| 177 | 177 | if (!empty($erreurs)) { |
| 178 | - $n = [(is_countable($erreurs) ? count($erreurs) : 0) . ' ' . _T('zbug_erreur_squelette')]; |
|
| 178 | + $n = [(is_countable($erreurs) ? count($erreurs) : 0).' '._T('zbug_erreur_squelette')]; |
|
| 179 | 179 | |
| 180 | 180 | return debusquer_navigation($erreurs, $n); |
| 181 | 181 | } elseif (!empty($GLOBALS['tableau_des_temps'])) { |
@@ -208,25 +208,25 @@ discard block |
||
| 208 | 208 | $valeur_simple = []; |
| 209 | 209 | foreach ($valeur as $v) { |
| 210 | 210 | if (is_array($v)) { |
| 211 | - $valeur_simple[] = 'array:' . count($v); |
|
| 211 | + $valeur_simple[] = 'array:'.count($v); |
|
| 212 | 212 | } elseif (is_object($v)) { |
| 213 | 213 | $valeur_simple[] = get_class($v); |
| 214 | 214 | } elseif (is_string($v)) { |
| 215 | - $valeur_simple[] = "'" . $v . "'"; |
|
| 215 | + $valeur_simple[] = "'".$v."'"; |
|
| 216 | 216 | } else { |
| 217 | 217 | $valeur_simple[] = $v; |
| 218 | 218 | } |
| 219 | 219 | } |
| 220 | 220 | $n = count($valeur); |
| 221 | - $valeur = (($n > 3) ? 'array:' . $n . ' ' : ''); |
|
| 222 | - $valeur .= '[' . join(', ', $valeur_simple) . ']'; |
|
| 221 | + $valeur = (($n > 3) ? 'array:'.$n.' ' : ''); |
|
| 222 | + $valeur .= '['.join(', ', $valeur_simple).']'; |
|
| 223 | 223 | } elseif (is_object($valeur)) { |
| 224 | 224 | $valeur = get_class($valeur); |
| 225 | 225 | } elseif (is_string($valeur)) { |
| 226 | - $valeur = "'" . $valeur . "'"; |
|
| 226 | + $valeur = "'".$valeur."'"; |
|
| 227 | 227 | } |
| 228 | - $res .= "\n<tr><td><strong>" . nl2br((string) entites_html($nom)) |
|
| 229 | - . '</strong></td><td>: ' . nl2br((string) entites_html($valeur)) |
|
| 228 | + $res .= "\n<tr><td><strong>".nl2br((string) entites_html($nom)) |
|
| 229 | + . '</strong></td><td>: '.nl2br((string) entites_html($valeur)) |
|
| 230 | 230 | . "</td></tr>\n"; |
| 231 | 231 | } |
| 232 | 232 | |
@@ -254,10 +254,10 @@ discard block |
||
| 254 | 254 | $nom_code = $lieu->descr['nom']; |
| 255 | 255 | $skel = $lieu->descr['sourcefile']; |
| 256 | 256 | $h2 = parametre_url($href, 'var_mode_objet', $nom_code); |
| 257 | - $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette') . '#L' . $ligne; |
|
| 257 | + $h3 = parametre_url($h2, 'var_mode_affiche', 'squelette').'#L'.$ligne; |
|
| 258 | 258 | $skel = "<a href='$h3'><b>$skel</b></a>"; |
| 259 | 259 | if ($boucle) { |
| 260 | - $h3 = parametre_url($h2 . $boucle, 'var_mode_affiche', 'boucle'); |
|
| 260 | + $h3 = parametre_url($h2.$boucle, 'var_mode_affiche', 'boucle'); |
|
| 261 | 261 | $boucle = "<a href='$h3'><b>$boucle</b></a>"; |
| 262 | 262 | } |
| 263 | 263 | } |
@@ -346,7 +346,7 @@ discard block |
||
| 346 | 346 | } |
| 347 | 347 | |
| 348 | 348 | // Requete erronee |
| 349 | - $err = '<b>' . _T('avis_erreur_mysql') . " $errno</b><br /><tt>\n" |
|
| 349 | + $err = '<b>'._T('avis_erreur_mysql')." $errno</b><br /><tt>\n" |
|
| 350 | 350 | . spip_htmlspecialchars($msg) |
| 351 | 351 | . "\n<br /><span style='color: red'><b>" |
| 352 | 352 | . spip_htmlspecialchars($query) |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | |
| 361 | 361 | function trouve_boucle_debug($n, $nom, $debut = 0, $boucle = '') { |
| 362 | 362 | |
| 363 | - $id = $nom . $boucle; |
|
| 363 | + $id = $nom.$boucle; |
|
| 364 | 364 | if (is_array($GLOBALS['debug_objets']['sequence'][$id])) { |
| 365 | 365 | foreach ($GLOBALS['debug_objets']['sequence'][$id] as $v) { |
| 366 | 366 | if (!preg_match('/^(.*)(<\?.*\?>)(.*)$/s', $v[0], $r)) { |
@@ -406,7 +406,7 @@ discard block |
||
| 406 | 406 | } |
| 407 | 407 | } |
| 408 | 408 | } |
| 409 | - $incl = ',' . $reg[1] . '[.]\w$,'; |
|
| 409 | + $incl = ','.$reg[1].'[.]\w$,'; |
|
| 410 | 410 | |
| 411 | 411 | foreach ($GLOBALS['debug_objets']['sourcefile'] as $k => $v) { |
| 412 | 412 | if (preg_match($incl, $v)) { |
@@ -421,16 +421,13 @@ discard block |
||
| 421 | 421 | [$skel, $boucle, $ligne] = trouve_boucle_debug($n, $nom); |
| 422 | 422 | |
| 423 | 423 | if (!$boucle) { |
| 424 | - return !$ligne ? '' : |
|
| 425 | - (' (' . |
|
| 426 | - (($nom != $skel) ? _T('squelette_inclus_ligne') : |
|
| 427 | - _T('squelette_ligne')) . |
|
| 424 | + return !$ligne ? '' : (' ('. |
|
| 425 | + (($nom != $skel) ? _T('squelette_inclus_ligne') : _T('squelette_ligne')). |
|
| 428 | 426 | " <a href='$self&var_mode_objet=$skel&var_mode_affiche=squelette&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"); |
| 429 | 427 | } else { |
| 430 | 428 | $self .= "&var_mode_objet=$skel$boucle&var_mode_affiche=boucle"; |
| 431 | 429 | |
| 432 | - return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : |
|
| 433 | - " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 430 | + return !$ligne ? " (boucle\n<a href='$self#$skel$boucle'>$boucle</a>)" : " (boucle $boucle ligne\n<a href='$self&var_mode_ligne=$ligne#L$ligne'>$ligne</a>)"; |
|
| 434 | 431 | } |
| 435 | 432 | } |
| 436 | 433 | |
@@ -452,14 +449,14 @@ discard block |
||
| 452 | 449 | |
| 453 | 450 | $s = preg_replace( |
| 454 | 451 | ',<(\w[^<>]*)>([^<]*)<br />([^<]*)</\1>,', |
| 455 | - '<\1>\2</\1><br />' . "\n" . '<\1>\3</\1>', |
|
| 452 | + '<\1>\2</\1><br />'."\n".'<\1>\3</\1>', |
|
| 456 | 453 | $s |
| 457 | 454 | ); |
| 458 | 455 | |
| 459 | 456 | |
| 460 | 457 | $tableau = explode('<br />', $s); |
| 461 | 458 | |
| 462 | - $format = "<span style='float:left;display:block;width:50px;height:1px'><a id='L%d' style='background-color: white; visibility: " . ($nocpt ? 'hidden' : 'visible') . ";%s' href='#T%s' title=\"%s\">%0" . strval(@strlen(count($tableau))) . "d</a></span> %s<br />\n"; |
|
| 459 | + $format = "<span style='float:left;display:block;width:50px;height:1px'><a id='L%d' style='background-color: white; visibility: ".($nocpt ? 'hidden' : 'visible').";%s' href='#T%s' title=\"%s\">%0".strval(@strlen(count($tableau)))."d</a></span> %s<br />\n"; |
|
| 463 | 460 | |
| 464 | 461 | $format10 = str_replace('white', 'lightgrey', $format); |
| 465 | 462 | $formaterr = 'color: red;'; |
@@ -503,7 +500,7 @@ discard block |
||
| 503 | 500 | . '" style="cursor: pointer;">' |
| 504 | 501 | . ($nocpt ? '' : _T('info_numero_abbreviation')) |
| 505 | 502 | . '</div> |
| 506 | - ' . $res . "</div>\n"; |
|
| 503 | + ' . $res."</div>\n"; |
|
| 507 | 504 | } |
| 508 | 505 | |
| 509 | 506 | // l'environnement graphique du debuggueur |
@@ -525,14 +522,14 @@ discard block |
||
| 525 | 522 | if (!empty($GLOBALS['debug_objets'][$mode][$fonc])) { |
| 526 | 523 | [$legend, $texte, $res2] = debusquer_source($fonc, $mode); |
| 527 | 524 | $texte .= $res2; |
| 528 | - } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc . 'tout'])) { |
|
| 529 | - $legend = _T('zbug_' . $mode); |
|
| 530 | - $texte = $GLOBALS['debug_objets'][$mode][$fonc . 'tout']; |
|
| 525 | + } elseif (!empty($GLOBALS['debug_objets'][$mode][$fonc.'tout'])) { |
|
| 526 | + $legend = _T('zbug_'.$mode); |
|
| 527 | + $texte = $GLOBALS['debug_objets'][$mode][$fonc.'tout']; |
|
| 531 | 528 | $texte = ancre_texte($texte, ['', '']); |
| 532 | 529 | } |
| 533 | 530 | } else { |
| 534 | 531 | if (strlen(trim($res))) { |
| 535 | - return "<img src='" . chemin_image('debug-xx.svg') . "' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res</div>"; |
|
| 532 | + return "<img src='".chemin_image('debug-xx.svg')."' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res</div>"; |
|
| 536 | 533 | } else { |
| 537 | 534 | // cas de l'appel sur erreur: montre la page |
| 538 | 535 | return $GLOBALS['debug_objets']['resultat']['tout'] ?? ''; |
@@ -540,7 +537,7 @@ discard block |
||
| 540 | 537 | } |
| 541 | 538 | } else { |
| 542 | 539 | $valider = charger_fonction('valider', 'xml'); |
| 543 | - $val = $valider($GLOBALS['debug_objets']['validation'][$fonc . 'tout']); |
|
| 540 | + $val = $valider($GLOBALS['debug_objets']['validation'][$fonc.'tout']); |
|
| 544 | 541 | // Si erreur, signaler leur nombre dans le formulaire admin |
| 545 | 542 | $GLOBALS['debug_objets']['validation'] = $val->err ? count($val->err) : ''; |
| 546 | 543 | [$texte, $err] = emboite_texte($val, $fonc, $self); |
@@ -551,14 +548,14 @@ discard block |
||
| 551 | 548 | } else { |
| 552 | 549 | $err = ": $err"; |
| 553 | 550 | } |
| 554 | - $legend = _T('validation') . ' ' . $err; |
|
| 551 | + $legend = _T('validation').' '.$err; |
|
| 555 | 552 | $res = $id = ''; |
| 556 | 553 | } |
| 557 | 554 | |
| 558 | 555 | return !trim($texte) ? '' : ( |
| 559 | - "<img src='" . chemin_image('debug-xx.svg') . "' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res" |
|
| 556 | + "<img src='".chemin_image('debug-xx.svg')."' alt='afficher-masquer le debug' id='spip-debug-toggle' onclick=\"var x = document.getElementById('spip-debug'); (x.style.display == '' ? x.style.display = 'none' : x.style.display = '');\" /><div id='spip-debug'>$res" |
|
| 560 | 557 | . "<div id='debug_boucle'><fieldset$id><legend>" |
| 561 | - . "<a href='" . $self . '#f_' . substr($fonc, 0, 37) . "'> ↑ " |
|
| 558 | + . "<a href='".$self.'#f_'.substr($fonc, 0, 37)."'> ↑ " |
|
| 562 | 559 | . ($legend ?: $mode) |
| 563 | 560 | . '</a></legend>' |
| 564 | 561 | . $texte |
@@ -569,7 +566,7 @@ discard block |
||
| 569 | 566 | |
| 570 | 567 | function emboite_texte($res, $fonc = '', $self = '') { |
| 571 | 568 | $errs = $res->err; |
| 572 | - $texte = $res->entete . ($errs ? '' : $res->page); |
|
| 569 | + $texte = $res->entete.($errs ? '' : $res->page); |
|
| 573 | 570 | |
| 574 | 571 | if (!$texte and !$errs) { |
| 575 | 572 | return [ancre_texte('', ['', '']), false]; |
@@ -625,7 +622,7 @@ discard block |
||
| 625 | 622 | $err = "<h2 style='text-align: center'>" |
| 626 | 623 | . $i |
| 627 | 624 | . "<a href='#fin_err'>" |
| 628 | - . ' ' . _T('erreur_texte') |
|
| 625 | + . ' '._T('erreur_texte') |
|
| 629 | 626 | . "</a></h2><table id='debut_err' style='width: 100%'>" |
| 630 | 627 | . $err |
| 631 | 628 | . " </table><a id='fin_err'></a>"; |
@@ -635,9 +632,9 @@ discard block |
||
| 635 | 632 | [$msg, $fermant, $ouvrant] = $errs[0]; |
| 636 | 633 | $rf = reference_boucle_debug($fermant, $fonc, $self); |
| 637 | 634 | $ro = reference_boucle_debug($ouvrant, $fonc, $self); |
| 638 | - $err = $msg . |
|
| 639 | - "<a href='#L" . $fermant . "'>$fermant</a>$rf<br />" . |
|
| 640 | - "<a href='#L" . $ouvrant . "'>$ouvrant</a>$ro"; |
|
| 635 | + $err = $msg. |
|
| 636 | + "<a href='#L".$fermant."'>$fermant</a>$rf<br />". |
|
| 637 | + "<a href='#L".$ouvrant."'>$ouvrant</a>$ro"; |
|
| 641 | 638 | |
| 642 | 639 | return [ancre_texte($texte, [[$ouvrant], [$fermant]]), $err]; |
| 643 | 640 | } |
@@ -670,7 +667,7 @@ discard block |
||
| 670 | 667 | ['time' => $GLOBALS['debug_objets']['profile'][$sourcefile]] |
| 671 | 668 | ); |
| 672 | 669 | |
| 673 | - $res .= "<fieldset id='f_" . $nom . "'><legend>" |
|
| 670 | + $res .= "<fieldset id='f_".$nom."'><legend>" |
|
| 674 | 671 | . $t_skel |
| 675 | 672 | . ' ' |
| 676 | 673 | . $sourcefile |
@@ -685,7 +682,7 @@ discard block |
||
| 685 | 682 | . "'>" |
| 686 | 683 | . _T('zbug_calcul') |
| 687 | 684 | . '</a></legend>' |
| 688 | - . (!$temps ? '' : ("\n<span style='display:block;float:" . $GLOBALS['spip_lang_right'] . "'>$temps</span><br />")) |
|
| 685 | + . (!$temps ? '' : ("\n<span style='display:block;float:".$GLOBALS['spip_lang_right']."'>$temps</span><br />")) |
|
| 689 | 686 | . debusquer_contexte($contexte[$sourcefile]) |
| 690 | 687 | . (!$nav ? '' : ("<table width='100%'>\n$nav</table>\n")) |
| 691 | 688 | . "</fieldset>\n"; |
@@ -706,33 +703,33 @@ discard block |
||
| 706 | 703 | $nom = $boucle->id_boucle; |
| 707 | 704 | $req = $boucle->type_requete; |
| 708 | 705 | $crit = public_decompiler($boucle, $gram, 0, 'criteres'); |
| 709 | - $self2 = $self . '&var_mode_objet=' . $objet; |
|
| 710 | - |
|
| 711 | - $res .= "\n<tr style='background-color: " . |
|
| 712 | - ($i % 2 ? '#e0e0f0' : '#f8f8ff') . |
|
| 713 | - "'><td align='right'>$i</td><td>\n" . |
|
| 714 | - "<a class='debug_link_boucle' href='" . |
|
| 715 | - $self2 . |
|
| 716 | - "&var_mode_affiche=boucle#f_$nom_skel'>" . |
|
| 717 | - _T('zbug_boucle') . |
|
| 718 | - "</a></td><td>\n<a class='debug_link_boucle' href='" . |
|
| 719 | - $self2 . |
|
| 720 | - "&var_mode_affiche=resultat#f_$nom_skel'>" . |
|
| 721 | - _T('zbug_resultat') . |
|
| 722 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 723 | - $self2 . |
|
| 724 | - "&var_mode_affiche=code#f_$nom_skel'>" . |
|
| 725 | - _T('zbug_code') . |
|
| 726 | - "</a></td><td>\n<a class='debug_link_resultat' href='" . |
|
| 727 | - str_replace('var_mode=', 'var_profile=', $self2) . |
|
| 728 | - "'>" . |
|
| 729 | - _T('zbug_calcul') . |
|
| 730 | - "</a></td><td>\n" . |
|
| 731 | - (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom) . |
|
| 732 | - "</td><td>\n" . |
|
| 733 | - $req . |
|
| 734 | - "</td><td>\n" . |
|
| 735 | - spip_htmlspecialchars($crit) . |
|
| 706 | + $self2 = $self.'&var_mode_objet='.$objet; |
|
| 707 | + |
|
| 708 | + $res .= "\n<tr style='background-color: ". |
|
| 709 | + ($i % 2 ? '#e0e0f0' : '#f8f8ff'). |
|
| 710 | + "'><td align='right'>$i</td><td>\n". |
|
| 711 | + "<a class='debug_link_boucle' href='". |
|
| 712 | + $self2. |
|
| 713 | + "&var_mode_affiche=boucle#f_$nom_skel'>". |
|
| 714 | + _T('zbug_boucle'). |
|
| 715 | + "</a></td><td>\n<a class='debug_link_boucle' href='". |
|
| 716 | + $self2. |
|
| 717 | + "&var_mode_affiche=resultat#f_$nom_skel'>". |
|
| 718 | + _T('zbug_resultat'). |
|
| 719 | + "</a></td><td>\n<a class='debug_link_resultat' href='". |
|
| 720 | + $self2. |
|
| 721 | + "&var_mode_affiche=code#f_$nom_skel'>". |
|
| 722 | + _T('zbug_code'). |
|
| 723 | + "</a></td><td>\n<a class='debug_link_resultat' href='". |
|
| 724 | + str_replace('var_mode=', 'var_profile=', $self2). |
|
| 725 | + "'>". |
|
| 726 | + _T('zbug_calcul'). |
|
| 727 | + "</a></td><td>\n". |
|
| 728 | + (($var_mode_objet == $objet) ? "<b>$nom</b>" : $nom). |
|
| 729 | + "</td><td>\n". |
|
| 730 | + $req. |
|
| 731 | + "</td><td>\n". |
|
| 732 | + spip_htmlspecialchars($crit). |
|
| 736 | 733 | '</td></tr>'; |
| 737 | 734 | } |
| 738 | 735 | } |
@@ -759,7 +756,7 @@ discard block |
||
| 759 | 756 | } |
| 760 | 757 | // permettre le copier/coller facile |
| 761 | 758 | // $res = ancre_texte($req, array(), true); |
| 762 | - $res = "<div id='T" . md5($req) . "'>\n<pre>\n" . $req . "</pre>\n</div>\n"; |
|
| 759 | + $res = "<div id='T".md5($req)."'>\n<pre>\n".$req."</pre>\n</div>\n"; |
|
| 763 | 760 | // formatage et affichage des resultats bruts de la requete |
| 764 | 761 | $ress_req = spip_query($req); |
| 765 | 762 | $brut_sql = ''; |
@@ -769,10 +766,10 @@ discard block |
||
| 769 | 766 | $max_aff = defined('_MAX_DEBUG_AFF') ? _MAX_DEBUG_AFF : 50; |
| 770 | 767 | while ($retours_sql = sql_fetch($ress_req)) { |
| 771 | 768 | if ($num <= $max_aff) { |
| 772 | - $brut_sql .= '<h3>' . ($num == 1 ? $num . ' sur ' . sql_count($ress_req) : $num) . '</h3>'; |
|
| 769 | + $brut_sql .= '<h3>'.($num == 1 ? $num.' sur '.sql_count($ress_req) : $num).'</h3>'; |
|
| 773 | 770 | $brut_sql .= '<p>'; |
| 774 | 771 | foreach ($retours_sql as $key => $val) { |
| 775 | - $brut_sql .= '<strong>' . $key . '</strong> => ' . spip_htmlspecialchars(couper($val, 150)) . "<br />\n"; |
|
| 772 | + $brut_sql .= '<strong>'.$key.'</strong> => '.spip_htmlspecialchars(couper($val, 150))."<br />\n"; |
|
| 776 | 773 | } |
| 777 | 774 | $brut_sql .= '</p>'; |
| 778 | 775 | } |
@@ -783,14 +780,14 @@ discard block |
||
| 783 | 780 | // ne pas afficher les $contexte_inclus |
| 784 | 781 | $view = preg_replace(',<\?php.+\?[>],Uims', '', $view); |
| 785 | 782 | if ($view) { |
| 786 | - $res2 .= "\n<br /><fieldset>" . interdire_scripts($view) . '</fieldset>'; |
|
| 783 | + $res2 .= "\n<br /><fieldset>".interdire_scripts($view).'</fieldset>'; |
|
| 787 | 784 | } |
| 788 | 785 | } |
| 789 | 786 | } elseif ($affiche == 'code') { |
| 790 | 787 | $legend = $nom; |
| 791 | - $res = ancre_texte('<' . "?php\n" . $quoi . "\n?" . '>'); |
|
| 788 | + $res = ancre_texte('<'."?php\n".$quoi."\n?".'>'); |
|
| 792 | 789 | } elseif ($affiche == 'boucle') { |
| 793 | - $legend = _T('zbug_boucle') . ' ' . $nom; |
|
| 790 | + $legend = _T('zbug_boucle').' '.$nom; |
|
| 794 | 791 | // Le compilateur prefixe le nom des boucles par l'extension du fichier source. |
| 795 | 792 | $gram = preg_match('/^([^_]+)_/', $objet, $r) ? $r[1] : ''; |
| 796 | 793 | $res = ancre_texte(public_decompiler($quoi, $gram, 0, 'boucle')); |
@@ -808,23 +805,23 @@ discard block |
||
| 808 | 805 | include_spip('public/assembler'); // pour inclure_balise_dynamique |
| 809 | 806 | include_spip('inc/texte'); // pour corriger_typo |
| 810 | 807 | |
| 811 | - return _DOCTYPE_ECRIRE . |
|
| 812 | - html_lang_attributes() . |
|
| 813 | - "<head>\n<title>" . |
|
| 814 | - ('SPIP ' . $GLOBALS['spip_version_affichee'] . ' ' . |
|
| 815 | - _T('admin_debug') . ' ' . spip_htmlspecialchars($titre) . ' (' . |
|
| 816 | - supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))) . |
|
| 817 | - ")</title>\n" . |
|
| 818 | - "<meta http-equiv='Content-Type' content='text/html" . |
|
| 819 | - (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : '') . |
|
| 820 | - "' />\n" . |
|
| 808 | + return _DOCTYPE_ECRIRE. |
|
| 809 | + html_lang_attributes(). |
|
| 810 | + "<head>\n<title>". |
|
| 811 | + ('SPIP '.$GLOBALS['spip_version_affichee'].' '. |
|
| 812 | + _T('admin_debug').' '.spip_htmlspecialchars($titre).' ('. |
|
| 813 | + supprimer_tags(corriger_typo($GLOBALS['meta']['nom_site']))). |
|
| 814 | + ")</title>\n". |
|
| 815 | + "<meta http-equiv='Content-Type' content='text/html". |
|
| 816 | + (($c = $GLOBALS['meta']['charset']) ? "; charset=$c" : ''). |
|
| 817 | + "' />\n". |
|
| 821 | 818 | http_script('', 'jquery.js') |
| 822 | - . "<link rel='stylesheet' href='" . url_absolue(find_in_path('spip_admin.css')) |
|
| 823 | - . "' type='text/css' />" . |
|
| 824 | - "</head>\n" . |
|
| 825 | - "<body style='margin:0 10px;'>\n" . |
|
| 826 | - "<div id='spip-debug-header'>" . |
|
| 827 | - $corps . |
|
| 828 | - inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false) . |
|
| 819 | + . "<link rel='stylesheet' href='".url_absolue(find_in_path('spip_admin.css')) |
|
| 820 | + . "' type='text/css' />". |
|
| 821 | + "</head>\n". |
|
| 822 | + "<body style='margin:0 10px;'>\n". |
|
| 823 | + "<div id='spip-debug-header'>". |
|
| 824 | + $corps. |
|
| 825 | + inclure_balise_dynamique(balise_FORMULAIRE_ADMIN_dyn('spip-admin-float', $GLOBALS['debug_objets']), false). |
|
| 829 | 826 | '</div></body></html>'; |
| 830 | 827 | } |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | |
| 106 | 106 | // in fine renommer le prefixe si besoin |
| 107 | 107 | if (strpos($name, 'spip_') === 0) { |
| 108 | - $name = $GLOBALS['cookie_prefix'] . '_' . substr($name, 5); |
|
| 108 | + $name = $GLOBALS['cookie_prefix'].'_'.substr($name, 5); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | #spip_log("cookie('$name', '$value', " . json_encode($options, true) . ")", "cookies"); |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | } |
| 164 | 164 | foreach ($_COOKIE as $name => $value) { |
| 165 | 165 | if (substr($name, 0, $prefix_long) == $cookie_prefix) { |
| 166 | - $spipname = preg_replace('/^' . $cookie_prefix . '_/', 'spip_', $name); |
|
| 166 | + $spipname = preg_replace('/^'.$cookie_prefix.'_/', 'spip_', $name); |
|
| 167 | 167 | $_COOKIE[$spipname] = $value; |
| 168 | 168 | $GLOBALS[$spipname] = $value; |
| 169 | 169 | } |
@@ -120,7 +120,7 @@ discard block |
||
| 120 | 120 | // mais apres la fonction autoriser() |
| 121 | 121 | if ($f = find_in_path('mes_fonctions.php')) { |
| 122 | 122 | global $dossier_squelettes; |
| 123 | - include_once(_ROOT_CWD . $f); |
|
| 123 | + include_once(_ROOT_CWD.$f); |
|
| 124 | 124 | } |
| 125 | 125 | |
| 126 | 126 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | $qui = $GLOBALS['visiteur_session'] ?: []; |
| 163 | 163 | $qui = array_merge(['statut' => '', 'id_auteur' => 0, 'webmestre' => 'non'], $qui); |
| 164 | 164 | } elseif (is_numeric($qui)) { |
| 165 | - $qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur=' . $qui); |
|
| 165 | + $qui = sql_fetsel('*', 'spip_auteurs', 'id_auteur='.$qui); |
|
| 166 | 166 | } |
| 167 | 167 | |
| 168 | 168 | // Admins restreints, on construit ici (pas generique mais...) |
@@ -172,8 +172,8 @@ discard block |
||
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | spip_log( |
| 175 | - "autoriser $faire $type $id (" . ($qui['nom'] ?? '') . ') ?', |
|
| 176 | - 'autoriser' . _LOG_DEBUG |
|
| 175 | + "autoriser $faire $type $id (".($qui['nom'] ?? '').') ?', |
|
| 176 | + 'autoriser'._LOG_DEBUG |
|
| 177 | 177 | ); |
| 178 | 178 | |
| 179 | 179 | // passer par objet_type pour avoir les alias |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | (isset($GLOBALS['autoriser_exception'][$faire][$type][$id]) and autoriser_exception($faire, $type, $id, 'verifier')) |
| 190 | 190 | or (isset($GLOBALS['autoriser_exception'][$faire][$type]['*']) and autoriser_exception($faire, $type, '*', 'verifier')) |
| 191 | 191 | ) { |
| 192 | - spip_log("autoriser ($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : OK Exception', 'autoriser' . _LOG_DEBUG); |
|
| 192 | + spip_log("autoriser ($faire, $type, $id, ".($qui['nom'] ?? '').') : OK Exception', 'autoriser'._LOG_DEBUG); |
|
| 193 | 193 | return true; |
| 194 | 194 | } |
| 195 | 195 | |
@@ -198,18 +198,18 @@ discard block |
||
| 198 | 198 | // autoriser_faire[_dist], autoriser_defaut[_dist] |
| 199 | 199 | $fonctions = $type |
| 200 | 200 | ? [ |
| 201 | - 'autoriser_' . $type . '_' . $faire, |
|
| 202 | - 'autoriser_' . $type . '_' . $faire . '_dist', |
|
| 203 | - 'autoriser_' . $type, |
|
| 204 | - 'autoriser_' . $type . '_dist', |
|
| 205 | - 'autoriser_' . $faire, |
|
| 206 | - 'autoriser_' . $faire . '_dist', |
|
| 201 | + 'autoriser_'.$type.'_'.$faire, |
|
| 202 | + 'autoriser_'.$type.'_'.$faire.'_dist', |
|
| 203 | + 'autoriser_'.$type, |
|
| 204 | + 'autoriser_'.$type.'_dist', |
|
| 205 | + 'autoriser_'.$faire, |
|
| 206 | + 'autoriser_'.$faire.'_dist', |
|
| 207 | 207 | 'autoriser_defaut', |
| 208 | 208 | 'autoriser_defaut_dist' |
| 209 | 209 | ] |
| 210 | 210 | : [ |
| 211 | - 'autoriser_' . $faire, |
|
| 212 | - 'autoriser_' . $faire . '_dist', |
|
| 211 | + 'autoriser_'.$faire, |
|
| 212 | + 'autoriser_'.$faire.'_dist', |
|
| 213 | 213 | 'autoriser_defaut', |
| 214 | 214 | 'autoriser_defaut_dist' |
| 215 | 215 | ]; |
@@ -222,8 +222,8 @@ discard block |
||
| 222 | 222 | } |
| 223 | 223 | |
| 224 | 224 | spip_log( |
| 225 | - "$f($faire, $type, $id, " . ($qui['nom'] ?? '') . ') : ' . ($a ? 'OK' : 'niet'), |
|
| 226 | - 'autoriser' . _LOG_DEBUG |
|
| 225 | + "$f($faire, $type, $id, ".($qui['nom'] ?? '').') : '.($a ? 'OK' : 'niet'), |
|
| 226 | + 'autoriser'._LOG_DEBUG |
|
| 227 | 227 | ); |
| 228 | 228 | |
| 229 | 229 | return $a; |
@@ -372,7 +372,7 @@ discard block |
||
| 372 | 372 | function autoriser_previsualiser_dist(string $faire, string $type, $id, array $qui, array $opt): bool { |
| 373 | 373 | |
| 374 | 374 | // Le visiteur a-t-il un statut prevu par la config ? |
| 375 | - if (strpos($GLOBALS['meta']['preview'], ',' . $qui['statut'] . ',') !== false) { |
|
| 375 | + if (strpos($GLOBALS['meta']['preview'], ','.$qui['statut'].',') !== false) { |
|
| 376 | 376 | return test_previsualiser_objet_champ($type, $id, $qui, $opt); |
| 377 | 377 | } |
| 378 | 378 | |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | } // pas de champ passe a la demande => NIET |
| 431 | 431 | $previsu = explode(',', $c['previsu']); |
| 432 | 432 | // regarder si ce statut est autorise pour l'auteur |
| 433 | - if (in_array($opt[$champ] . '/auteur', $previsu)) { |
|
| 433 | + if (in_array($opt[$champ].'/auteur', $previsu)) { |
|
| 434 | 434 | // retrouver l’id_auteur qui a filé un lien de prévisu éventuellement, |
| 435 | 435 | // sinon l’auteur en session |
| 436 | 436 | include_spip('inc/securiser_action'); |
@@ -444,12 +444,12 @@ discard block |
||
| 444 | 444 | |
| 445 | 445 | if (!$id_auteur) { |
| 446 | 446 | return false; |
| 447 | - } elseif (autoriser('previsualiser' . $opt[$champ], $type, 0, $id_auteur)) { |
|
| 447 | + } elseif (autoriser('previsualiser'.$opt[$champ], $type, 0, $id_auteur)) { |
|
| 448 | 448 | // dans ce cas (admin en general), pas de filtrage sur ce statut |
| 449 | 449 | } elseif ( |
| 450 | 450 | !sql_countsel( |
| 451 | 451 | 'spip_auteurs_liens', |
| 452 | - 'id_auteur=' . intval($id_auteur) . ' AND objet=' . sql_quote($type) . ' AND id_objet=' . intval($id) |
|
| 452 | + 'id_auteur='.intval($id_auteur).' AND objet='.sql_quote($type).' AND id_objet='.intval($id) |
|
| 453 | 453 | ) |
| 454 | 454 | ) { |
| 455 | 455 | return false; |
@@ -494,16 +494,16 @@ discard block |
||
| 494 | 494 | // multilinguisme par secteur et objet rattaché à une rubrique |
| 495 | 495 | $primary = id_table_objet($type); |
| 496 | 496 | if ($table != 'spip_rubriques') { |
| 497 | - $id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=" . intval($id)); |
|
| 497 | + $id_rubrique = sql_getfetsel('id_rubrique', "$table", "$primary=".intval($id)); |
|
| 498 | 498 | } else { |
| 499 | 499 | $id_rubrique = $id; |
| 500 | 500 | } |
| 501 | - $id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique=' . intval($id_rubrique)); |
|
| 501 | + $id_secteur = sql_getfetsel('id_secteur', 'spip_rubriques', 'id_rubrique='.intval($id_rubrique)); |
|
| 502 | 502 | if (!$id_secteur > 0) { |
| 503 | 503 | $id_secteur = $id_rubrique; |
| 504 | 504 | } |
| 505 | - $langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique=' . intval($id_secteur)); |
|
| 506 | - $langue_objet = sql_getfetsel('lang', "$table", "$primary=" . intval($id)); |
|
| 505 | + $langue_secteur = sql_getfetsel('lang', 'spip_rubriques', 'id_rubrique='.intval($id_secteur)); |
|
| 506 | + $langue_objet = sql_getfetsel('lang', "$table", "$primary=".intval($id)); |
|
| 507 | 507 | if ($langue_secteur != $langue_objet) { |
| 508 | 508 | // configuration incohérente, on laisse l'utilisateur corriger la situation |
| 509 | 509 | return true; |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | if ($table != 'spip_rubriques') { // le choix de la langue se fait seulement sur les rubriques |
| 512 | 512 | return false; |
| 513 | 513 | } else { |
| 514 | - $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique=' . intval($id)); |
|
| 514 | + $id_parent = sql_getfetsel('id_parent', 'spip_rubriques', 'id_rubrique='.intval($id)); |
|
| 515 | 515 | if ($id_parent != 0) { |
| 516 | 516 | // sous-rubriques : pas de choix de langue |
| 517 | 517 | return false; |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | |
| 564 | 564 | if (!isset($opt['statut'])) { |
| 565 | 565 | if (isset($desc['field']['statut'])) { |
| 566 | - $statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type) . '=' . intval($id)); |
|
| 566 | + $statut = sql_getfetsel('statut', $desc['table'], id_table_objet($type).'='.intval($id)); |
|
| 567 | 567 | } else { |
| 568 | 568 | $statut = 'publie'; |
| 569 | 569 | } // pas de statut => publie |
@@ -737,11 +737,11 @@ discard block |
||
| 737 | 737 | return false; |
| 738 | 738 | } |
| 739 | 739 | |
| 740 | - if (sql_countsel('spip_rubriques', 'id_parent=' . intval($id))) { |
|
| 740 | + if (sql_countsel('spip_rubriques', 'id_parent='.intval($id))) { |
|
| 741 | 741 | return false; |
| 742 | 742 | } |
| 743 | 743 | |
| 744 | - if (sql_countsel('spip_articles', 'id_rubrique=' . intval($id) . " AND (statut<>'poubelle')")) { |
|
| 744 | + if (sql_countsel('spip_articles', 'id_rubrique='.intval($id)." AND (statut<>'poubelle')")) { |
|
| 745 | 745 | return false; |
| 746 | 746 | } |
| 747 | 747 | |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | if (!$id) { |
| 779 | 779 | return false; |
| 780 | 780 | } |
| 781 | - $r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article=' . sql_quote($id)); |
|
| 781 | + $r = sql_fetsel('id_rubrique,statut', 'spip_articles', 'id_article='.sql_quote($id)); |
|
| 782 | 782 | |
| 783 | 783 | return |
| 784 | 784 | $r |
@@ -789,7 +789,7 @@ discard block |
||
| 789 | 789 | (!isset($opt['statut']) or !in_array($opt['statut'], ['publie', 'refuse'], true)) |
| 790 | 790 | and in_array($qui['statut'], ['0minirezo', '1comite']) |
| 791 | 791 | and in_array($r['statut'], ['prop', 'prepa', 'poubelle']) |
| 792 | - and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur']) |
|
| 792 | + and auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur']) |
|
| 793 | 793 | ) |
| 794 | 794 | ); |
| 795 | 795 | } |
@@ -847,7 +847,7 @@ discard block |
||
| 847 | 847 | if (!$id) { |
| 848 | 848 | return false; |
| 849 | 849 | } |
| 850 | - $statut = sql_getfetsel('statut', 'spip_articles', 'id_article=' . intval($id)); |
|
| 850 | + $statut = sql_getfetsel('statut', 'spip_articles', 'id_article='.intval($id)); |
|
| 851 | 851 | } |
| 852 | 852 | |
| 853 | 853 | return |
@@ -858,7 +858,7 @@ discard block |
||
| 858 | 858 | or |
| 859 | 859 | ($id |
| 860 | 860 | and $qui['id_auteur'] |
| 861 | - and auteurs_objet('article', $id, 'id_auteur=' . $qui['id_auteur'])); |
|
| 861 | + and auteurs_objet('article', $id, 'id_auteur='.$qui['id_auteur'])); |
|
| 862 | 862 | } |
| 863 | 863 | |
| 864 | 864 | |
@@ -879,8 +879,8 @@ discard block |
||
| 879 | 879 | function autoriser_voir_dist(string $faire, string $type, $id, array $qui, array $opt): bool { |
| 880 | 880 | # securite, mais on aurait pas du arriver ici ! |
| 881 | 881 | if ( |
| 882 | - function_exists($f = 'autoriser_' . $type . '_voir') |
|
| 883 | - or function_exists($f = 'autoriser_' . $type . '_voir_dist') |
|
| 882 | + function_exists($f = 'autoriser_'.$type.'_voir') |
|
| 883 | + or function_exists($f = 'autoriser_'.$type.'_voir_dist') |
|
| 884 | 884 | ) { |
| 885 | 885 | return $f($faire, $type, $id, $qui, $opt); |
| 886 | 886 | } |
@@ -1011,7 +1011,7 @@ discard block |
||
| 1011 | 1011 | $n = sql_fetsel( |
| 1012 | 1012 | 'A.id_article', |
| 1013 | 1013 | 'spip_auteurs_liens AS L LEFT JOIN spip_articles AS A ON (L.objet=\'article\' AND L.id_objet=A.id_article)', |
| 1014 | - "A.statut='publie' AND L.id_auteur=" . sql_quote($id) |
|
| 1014 | + "A.statut='publie' AND L.id_auteur=".sql_quote($id) |
|
| 1015 | 1015 | ); |
| 1016 | 1016 | |
| 1017 | 1017 | return $n ? true : false; |
@@ -1223,7 +1223,7 @@ discard block |
||
| 1223 | 1223 | and $r = sql_allfetsel( |
| 1224 | 1224 | 'id_objet', |
| 1225 | 1225 | 'spip_auteurs_liens', |
| 1226 | - 'id_auteur=' . intval($id_auteur) . " AND objet='rubrique' AND id_objet!=0" |
|
| 1226 | + 'id_auteur='.intval($id_auteur)." AND objet='rubrique' AND id_objet!=0" |
|
| 1227 | 1227 | ) |
| 1228 | 1228 | and is_countable($r) ? count($r) : 0 |
| 1229 | 1229 | ) { |
@@ -1908,8 +1908,8 @@ discard block |
||
| 1908 | 1908 | function auteurs_objet($objet, $id_objet, $cond = '') { |
| 1909 | 1909 | $objet = objet_type($objet); |
| 1910 | 1910 | $where = [ |
| 1911 | - 'objet=' . sql_quote($objet), |
|
| 1912 | - 'id_objet=' . intval($id_objet) |
|
| 1911 | + 'objet='.sql_quote($objet), |
|
| 1912 | + 'id_objet='.intval($id_objet) |
|
| 1913 | 1913 | ]; |
| 1914 | 1914 | if (!empty($cond)) { |
| 1915 | 1915 | if (is_array($cond)) { |
@@ -1944,7 +1944,7 @@ discard block |
||
| 1944 | 1944 | return sql_allfetsel( |
| 1945 | 1945 | 'id_auteur', |
| 1946 | 1946 | 'spip_auteurs_liens', |
| 1947 | - "objet='article' AND id_objet=" . intval($id_article) . ($cond ? " AND $cond" : '') |
|
| 1947 | + "objet='article' AND id_objet=".intval($id_article).($cond ? " AND $cond" : '') |
|
| 1948 | 1948 | ); |
| 1949 | 1949 | } |
| 1950 | 1950 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | ]; |
| 44 | 44 | $options = array_merge($defaut, $options); |
| 45 | 45 | if (is_numeric($options['expires']) and $options['expires'] > 0) { |
| 46 | - $options['expires'] = gmdate('D, d M Y H:i:s', time() + $options['expires']) . ' GMT'; |
|
| 46 | + $options['expires'] = gmdate('D, d M Y H:i:s', time() + $options['expires']).' GMT'; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | if (is_null($options) and isset($_SERVER['HTTP_RANGE'])) { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | function spip_livrer_fichier_entetes($fichier, $content_type = 'application/octet-stream', $attachment = false, $expires = 0) { |
| 73 | 73 | // toujours envoyer un content type, meme vide ! |
| 74 | 74 | header('Accept-Ranges: bytes'); |
| 75 | - header('Content-Type: ' . $content_type); |
|
| 75 | + header('Content-Type: '.$content_type); |
|
| 76 | 76 | |
| 77 | 77 | if ($attachment) { |
| 78 | 78 | $f = basename($fichier); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | else { |
| 91 | 91 | $f = basename($fichier); |
| 92 | 92 | header("Content-Disposition: inline; filename=\"$f\";"); |
| 93 | - header('Expires: ' . $expires); // set expiration time |
|
| 93 | + header('Expires: '.$expires); // set expiration time |
|
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
@@ -142,12 +142,12 @@ discard block |
||
| 142 | 142 | // Parse Content-Range header for byte offsets, looks like "bytes=11525-" OR "bytes=11525-12451" |
| 143 | 143 | if ($range and preg_match('%bytes=(\d+)-(\d+)?%i', $range, $match)) { |
| 144 | 144 | ### Offset signifies where we should begin to read the file |
| 145 | - $byteOffset = (int)$match[1]; |
|
| 145 | + $byteOffset = (int) $match[1]; |
|
| 146 | 146 | |
| 147 | 147 | |
| 148 | 148 | ### Length is for how long we should read the file according to the browser, and can never go beyond the file size |
| 149 | 149 | if (isset($match[2])) { |
| 150 | - $finishBytes = (int)$match[2]; |
|
| 150 | + $finishBytes = (int) $match[2]; |
|
| 151 | 151 | $byteLength = $finishBytes + 1; |
| 152 | 152 | } else { |
| 153 | 153 | $finishBytes = $fileSize - 1; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | // partial content |
| 170 | 170 | header('HTTP/1.1 206 Partial content'); |
| 171 | - header($cr_header); ### Decrease by 1 on byte-length since this definition is zero-based index of bytes being sent |
|
| 171 | + header($cr_header); ### Decrease by 1 on byte-length since this definition is zero-based index of bytes being sent |
|
| 172 | 172 | |
| 173 | 173 | |
| 174 | 174 | $byteRange = $byteLength - $byteOffset; |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @return void |
| 44 | 44 | **/ |
| 45 | 45 | function install_fichier_connexion($nom, $texte) { |
| 46 | - $texte = '<' . "?php\n" |
|
| 46 | + $texte = '<'."?php\n" |
|
| 47 | 47 | . "if (!defined(\"_ECRIRE_INC_VERSION\")) return;\n" |
| 48 | 48 | . $texte; |
| 49 | 49 | |
@@ -112,10 +112,10 @@ discard block |
||
| 112 | 112 | return $regs; |
| 113 | 113 | } else { |
| 114 | 114 | $ar = '\s*\'([^\']*)\''; |
| 115 | - $r = '\s*,' . $ar; |
|
| 115 | + $r = '\s*,'.$ar; |
|
| 116 | 116 | $r = "#spip_connect_db[(]$ar$r$r$r$r(?:$r(?:$r(?:$r(?:$r)?)?)?)?#"; |
| 117 | 117 | if (preg_match($r, $s, $regs)) { |
| 118 | - $regs[2] = $regs[1] . (!$regs[2] ? '' : ':' . $regs[2] . ';'); |
|
| 118 | + $regs[2] = $regs[1].(!$regs[2] ? '' : ':'.$regs[2].';'); |
|
| 119 | 119 | array_shift($regs); |
| 120 | 120 | array_shift($regs); |
| 121 | 121 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | // Si on n'a pas la bonne version de PHP, c'est la fin |
| 181 | 181 | if ($err) { |
| 182 | 182 | die("<div class='error'>" |
| 183 | - . '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>" |
|
| 183 | + . '<h3>'._T('avis_attention').'</h3><p>'._T('install_echec_annonce')."</p><ul class='spip'>" |
|
| 184 | 184 | . "<li><strong>{$err[0]}</strong></li>\n</ul></div>"); |
| 185 | 185 | } |
| 186 | 186 | |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | |
| 202 | 202 | if ($err) { |
| 203 | 203 | echo "<div class='error'>" |
| 204 | - . '<h3>' . _T('avis_attention') . '</h3><p>' . _T('install_echec_annonce') . "</p><ul class='spip'>"; |
|
| 204 | + . '<h3>'._T('avis_attention').'</h3><p>'._T('install_echec_annonce')."</p><ul class='spip'>"; |
|
| 205 | 205 | foreach ($err as $e) { |
| 206 | 206 | echo "<li><strong>$e</strong></li>\n"; |
| 207 | 207 | } |
@@ -234,8 +234,8 @@ discard block |
||
| 234 | 234 | |
| 235 | 235 | |
| 236 | 236 | function info_etape($titre, $complement = '') { |
| 237 | - return '<h2>' . $titre . "</h2>\n" . |
|
| 238 | - ($complement ? '' . $complement . "\n" : ''); |
|
| 237 | + return '<h2>'.$titre."</h2>\n". |
|
| 238 | + ($complement ? ''.$complement."\n" : ''); |
|
| 239 | 239 | } |
| 240 | 240 | |
| 241 | 241 | /** |
@@ -249,18 +249,18 @@ discard block |
||
| 249 | 249 | $code = _T('bouton_suivant'); |
| 250 | 250 | } |
| 251 | 251 | static $suivant = 0; |
| 252 | - $id = 'suivant' . (($suivant > 0) ? strval($suivant) : ''); |
|
| 252 | + $id = 'suivant'.(($suivant > 0) ? strval($suivant) : ''); |
|
| 253 | 253 | $suivant += 1; |
| 254 | 254 | |
| 255 | - return "\n<p class='boutons suivant'><input id='" . $id . "' type='submit'\nvalue=\"" . |
|
| 256 | - $code . |
|
| 255 | + return "\n<p class='boutons suivant'><input id='".$id."' type='submit'\nvalue=\"". |
|
| 256 | + $code. |
|
| 257 | 257 | " >>\" /></p>\n"; |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | 260 | function info_progression_etape($en_cours, $phase, $dir, $erreur = false) { |
| 261 | 261 | $intitule_etat = []; |
| 262 | 262 | //$en_cours = _request('etape')?_request('etape'):""; |
| 263 | - $liste = find_all_in_path($dir, $phase . '(([0-9])+|fin)[.]php$'); |
|
| 263 | + $liste = find_all_in_path($dir, $phase.'(([0-9])+|fin)[.]php$'); |
|
| 264 | 264 | $debut = 1; |
| 265 | 265 | $etat = 'ok'; |
| 266 | 266 | $last = count($liste); |
@@ -299,7 +299,7 @@ discard block |
||
| 299 | 299 | |
| 300 | 300 | $aff_etapes .= "<li class='$class'><div class='fond'>"; |
| 301 | 301 | $aff_etapes .= ($debut == $en_cours) ? '<strong>' : ''; |
| 302 | - $aff_etapes .= '<em>' . _T('etape') . " </em><span class='numero_etape'>$debut</span><em> : </em>"; |
|
| 302 | + $aff_etapes .= '<em>'._T('etape')." </em><span class='numero_etape'>$debut</span><em> : </em>"; |
|
| 303 | 303 | $aff_etapes .= $intitule_etat["$phase"][$debut]; |
| 304 | 304 | $aff_etapes .= ($debut == $en_cours) ? '</strong>' : ''; |
| 305 | 305 | $aff_etapes .= '</div></li>'; |
@@ -314,11 +314,11 @@ discard block |
||
| 314 | 314 | |
| 315 | 315 | |
| 316 | 316 | function fieldset($legend, $champs = [], $apres = '', $avant = '') { |
| 317 | - return "<fieldset>\n" . |
|
| 318 | - $avant . |
|
| 319 | - ($legend ? '<legend>' . $legend . "</legend>\n" : '') . |
|
| 320 | - fieldset_champs($champs) . |
|
| 321 | - $apres . |
|
| 317 | + return "<fieldset>\n". |
|
| 318 | + $avant. |
|
| 319 | + ($legend ? '<legend>'.$legend."</legend>\n" : ''). |
|
| 320 | + fieldset_champs($champs). |
|
| 321 | + $apres. |
|
| 322 | 322 | "</fieldset>\n"; |
| 323 | 323 | } |
| 324 | 324 | |
@@ -328,18 +328,18 @@ discard block |
||
| 328 | 328 | $type = isset($contenu['hidden']) ? 'hidden' : (preg_match(',^pass,', $nom) ? 'password' : 'text'); |
| 329 | 329 | $class = isset($contenu['hidden']) ? '' : "class='formo' size='40' "; |
| 330 | 330 | if (isset($contenu['alternatives'])) { |
| 331 | - $fieldset .= $contenu['label'] . "\n"; |
|
| 331 | + $fieldset .= $contenu['label']."\n"; |
|
| 332 | 332 | foreach ($contenu['alternatives'] as $valeur => $label) { |
| 333 | - $fieldset .= "<input type='radio' name='" . $nom . |
|
| 333 | + $fieldset .= "<input type='radio' name='".$nom. |
|
| 334 | 334 | "' id='$nom-$valeur' value='$valeur'" |
| 335 | 335 | . (($valeur == $contenu['valeur']) ? "\nchecked='checked'" : '') |
| 336 | 336 | . "/>\n"; |
| 337 | - $fieldset .= "<label for='$nom-$valeur'>" . $label . "</label>\n"; |
|
| 337 | + $fieldset .= "<label for='$nom-$valeur'>".$label."</label>\n"; |
|
| 338 | 338 | } |
| 339 | 339 | $fieldset .= "<br />\n"; |
| 340 | 340 | } else { |
| 341 | - $fieldset .= "<label for='" . $nom . "'>" . $contenu['label'] . "</label>\n"; |
|
| 342 | - $fieldset .= '<input ' . $class . "type='" . $type . "' id='" . $nom . "' name='" . $nom . "'\nvalue='" . $contenu['valeur'] . "'" |
|
| 341 | + $fieldset .= "<label for='".$nom."'>".$contenu['label']."</label>\n"; |
|
| 342 | + $fieldset .= '<input '.$class."type='".$type."' id='".$nom."' name='".$nom."'\nvalue='".$contenu['valeur']."'" |
|
| 343 | 343 | . (preg_match(',^(pass|login),', $nom) ? " autocomplete='off'" : '') |
| 344 | 344 | . ((isset($contenu['required']) and $contenu['required']) ? " required='required'" : '') |
| 345 | 345 | . " />\n"; |
@@ -351,7 +351,7 @@ discard block |
||
| 351 | 351 | |
| 352 | 352 | function install_select_serveur() { |
| 353 | 353 | $options = []; |
| 354 | - $dir = _DIR_RESTREINT . 'req/'; |
|
| 354 | + $dir = _DIR_RESTREINT.'req/'; |
|
| 355 | 355 | $d = opendir($dir); |
| 356 | 356 | if (!$d) { |
| 357 | 357 | return []; |
@@ -359,17 +359,17 @@ discard block |
||
| 359 | 359 | while (($f = readdir($d)) !== false) { |
| 360 | 360 | if ( |
| 361 | 361 | (preg_match('/^(.*)[.]php$/', $f, $s)) |
| 362 | - and is_readable($f = $dir . $f) |
|
| 362 | + and is_readable($f = $dir.$f) |
|
| 363 | 363 | ) { |
| 364 | 364 | require_once($f); |
| 365 | 365 | $s = $s[1]; |
| 366 | - $v = 'spip_versions_' . $s; |
|
| 366 | + $v = 'spip_versions_'.$s; |
|
| 367 | 367 | if (function_exists($v) and $v()) { |
| 368 | 368 | $titre = _T("install_select_type_$s"); |
| 369 | 369 | // proposer mysql par defaut si dispo |
| 370 | 370 | $checked = ($s == 'mysql' ? " checked='checked'" : ''); |
| 371 | 371 | $options[$s] = "<li><input type='radio' id='$s' value='$s' name='server_db'$checked>" |
| 372 | - . "<label for='$s'>" . ($titre ?: $s) . '</label></li>'; |
|
| 372 | + . "<label for='$s'>".($titre ?: $s).'</label></li>'; |
|
| 373 | 373 | } else { |
| 374 | 374 | spip_log("$s: portage indisponible"); |
| 375 | 375 | } |
@@ -387,8 +387,8 @@ discard block |
||
| 387 | 387 | "\n<input type='hidden' name='etape' value='$etape' />" |
| 388 | 388 | . $hidden |
| 389 | 389 | . (_request('echec') ? |
| 390 | - ('<p><b>' . _T('avis_connexion_echec_1') . |
|
| 391 | - '</b></p><p>' . _T('avis_connexion_echec_2') . "</p><p style='font-size: small;'>" . _T('avis_connexion_echec_3') . '</p>') |
|
| 390 | + ('<p><b>'._T('avis_connexion_echec_1'). |
|
| 391 | + '</b></p><p>'._T('avis_connexion_echec_2')."</p><p style='font-size: small;'>"._T('avis_connexion_echec_3').'</p>') |
|
| 392 | 392 | : '') |
| 393 | 393 | |
| 394 | 394 | . ($jquery ? http_script('', 'jquery.js') : '') |
@@ -426,9 +426,9 @@ discard block |
||
| 426 | 426 | });') |
| 427 | 427 | |
| 428 | 428 | . ($server_db |
| 429 | - ? '<input type="hidden" name="server_db" value="' . $server_db . '" />' |
|
| 429 | + ? '<input type="hidden" name="server_db" value="'.$server_db.'" />' |
|
| 430 | 430 | . (($predef[0]) |
| 431 | - ? ('<h3>' . _T('install_serveur_hebergeur') . '</h3>') |
|
| 431 | + ? ('<h3>'._T('install_serveur_hebergeur').'</h3>') |
|
| 432 | 432 | : '') |
| 433 | 433 | : ('<fieldset><legend>' |
| 434 | 434 | . _T('install_select_type_db') |
@@ -443,9 +443,9 @@ discard block |
||
| 443 | 443 | . "\n</ul>\n</div></fieldset>") |
| 444 | 444 | ) |
| 445 | 445 | . '<div id="install_adresse_base_hebergeur">' |
| 446 | - . '<p>' . _T('texte_connexion_mysql') . '</p>' |
|
| 446 | + . '<p>'._T('texte_connexion_mysql').'</p>' |
|
| 447 | 447 | . ($predef[1] |
| 448 | - ? '<h3>' . _T('install_adresse_base_hebergeur') . '</h3>' |
|
| 448 | + ? '<h3>'._T('install_adresse_base_hebergeur').'</h3>' |
|
| 449 | 449 | : fieldset( |
| 450 | 450 | _T('entree_base_donnee_1'), |
| 451 | 451 | [ |
@@ -460,7 +460,7 @@ discard block |
||
| 460 | 460 | |
| 461 | 461 | . '<div id="install_login_base_hebergeur">' |
| 462 | 462 | . ($predef[2] |
| 463 | - ? '<h3>' . _T('install_login_base_hebergeur') . '</h3>' |
|
| 463 | + ? '<h3>'._T('install_login_base_hebergeur').'</h3>' |
|
| 464 | 464 | : fieldset( |
| 465 | 465 | _T('entree_login_connexion_1'), |
| 466 | 466 | [ |
@@ -475,7 +475,7 @@ discard block |
||
| 475 | 475 | |
| 476 | 476 | . '<div id="install_pass_base_hebergeur">' |
| 477 | 477 | . ($predef[3] |
| 478 | - ? '<h3>' . _T('install_pass_base_hebergeur') . '</h3>' |
|
| 478 | + ? '<h3>'._T('install_pass_base_hebergeur').'</h3>' |
|
| 479 | 479 | : fieldset( |
| 480 | 480 | _T('entree_mot_passe_1'), |
| 481 | 481 | [ |
@@ -497,20 +497,20 @@ discard block |
||
| 497 | 497 | function predef_ou_cache($adresse_db, $login_db, $pass_db, $server_db) { |
| 498 | 498 | return ((defined('_INSTALL_HOST_DB')) |
| 499 | 499 | ? '' |
| 500 | - : "\n<input type='hidden' name='adresse_db' value=\"" . spip_htmlspecialchars($adresse_db) . '" />' |
|
| 500 | + : "\n<input type='hidden' name='adresse_db' value=\"".spip_htmlspecialchars($adresse_db).'" />' |
|
| 501 | 501 | ) |
| 502 | 502 | . ((defined('_INSTALL_USER_DB')) |
| 503 | 503 | ? '' |
| 504 | - : "\n<input type='hidden' name='login_db' value=\"" . spip_htmlspecialchars($login_db) . '" />' |
|
| 504 | + : "\n<input type='hidden' name='login_db' value=\"".spip_htmlspecialchars($login_db).'" />' |
|
| 505 | 505 | ) |
| 506 | 506 | . ((defined('_INSTALL_PASS_DB')) |
| 507 | 507 | ? '' |
| 508 | - : "\n<input type='hidden' name='pass_db' value=\"" . spip_htmlspecialchars($pass_db) . '" />' |
|
| 508 | + : "\n<input type='hidden' name='pass_db' value=\"".spip_htmlspecialchars($pass_db).'" />' |
|
| 509 | 509 | ) |
| 510 | 510 | |
| 511 | 511 | . ((defined('_INSTALL_SERVER_DB')) |
| 512 | 512 | ? '' |
| 513 | - : "\n<input type='hidden' name='server_db' value=\"" . spip_htmlspecialchars($server_db) . '" />' |
|
| 513 | + : "\n<input type='hidden' name='server_db' value=\"".spip_htmlspecialchars($server_db).'" />' |
|
| 514 | 514 | ); |
| 515 | 515 | } |
| 516 | 516 | |