@@ -23,18 +23,18 @@ discard block |
||
| 23 | 23 | * var_isbot=1 peut etre utilise pour monitorer la disponibilite pour les bots (sujets a 503 de delestage si |
| 24 | 24 | * le load depasse ECRAN_SECURITE_LOAD) |
| 25 | 25 | */ |
| 26 | -if (!defined('_IS_BOT') and isset($_GET['var_isbot'])){ |
|
| 26 | +if (!defined('_IS_BOT') and isset($_GET['var_isbot'])) { |
|
| 27 | 27 | define('_IS_BOT', $_GET['var_isbot'] ? true : false); |
| 28 | 28 | } |
| 29 | 29 | |
| 30 | 30 | /* |
| 31 | 31 | * Détecteur de robot d'indexation |
| 32 | 32 | */ |
| 33 | -if (!defined('_IS_BOT')){ |
|
| 33 | +if (!defined('_IS_BOT')) { |
|
| 34 | 34 | define('_IS_BOT', |
| 35 | 35 | isset($_SERVER['HTTP_USER_AGENT']) |
| 36 | 36 | and preg_match(',' |
| 37 | - . implode ('|', array( |
|
| 37 | + . implode('|', array( |
|
| 38 | 38 | // mots generiques |
| 39 | 39 | 'bot', |
| 40 | 40 | 'slurp', |
@@ -219,19 +219,19 @@ discard block |
||
| 219 | 219 | 'yats', |
| 220 | 220 | 'yeti', |
| 221 | 221 | 'zeerch' |
| 222 | - )) . ',i', |
|
| 223 | - (string)$_SERVER['HTTP_USER_AGENT']) |
|
| 222 | + )).',i', |
|
| 223 | + (string) $_SERVER['HTTP_USER_AGENT']) |
|
| 224 | 224 | ); |
| 225 | 225 | } |
| 226 | -if (!defined('_IS_BOT_FRIEND')){ |
|
| 226 | +if (!defined('_IS_BOT_FRIEND')) { |
|
| 227 | 227 | define('_IS_BOT_FRIEND', |
| 228 | 228 | isset($_SERVER['HTTP_USER_AGENT']) |
| 229 | - and preg_match(',' . implode ('|', array( |
|
| 229 | + and preg_match(','.implode('|', array( |
|
| 230 | 230 | 'facebookexternalhit', |
| 231 | 231 | 'flipboardproxy', |
| 232 | 232 | 'wordpress' |
| 233 | - )) . ',i', |
|
| 234 | - (string)$_SERVER['HTTP_USER_AGENT']) |
|
| 233 | + )).',i', |
|
| 234 | + (string) $_SERVER['HTTP_USER_AGENT']) |
|
| 235 | 235 | ); |
| 236 | 236 | } |
| 237 | 237 | |
@@ -242,19 +242,19 @@ discard block |
||
| 242 | 242 | * (sauf pour id_table, qui n'est pas numérique jusqu'à [5743]) |
| 243 | 243 | * (id_base est une variable de la config des widgets de WordPress) |
| 244 | 244 | */ |
| 245 | -$_exceptions = array('id_table','id_base','id_parent','id_article_pdf'); |
|
| 245 | +$_exceptions = array('id_table', 'id_base', 'id_parent', 'id_article_pdf'); |
|
| 246 | 246 | foreach ($_GET as $var => $val) |
| 247 | 247 | if ($_GET[$var] and strncmp($var, "id_", 3) == 0 |
| 248 | 248 | and !in_array($var, $_exceptions)) |
| 249 | - $_GET[$var] = is_array($_GET[$var])?@array_map('intval', $_GET[$var]):intval($_GET[$var]); |
|
| 249 | + $_GET[$var] = is_array($_GET[$var]) ? @array_map('intval', $_GET[$var]) : intval($_GET[$var]); |
|
| 250 | 250 | foreach ($_POST as $var => $val) |
| 251 | 251 | if ($_POST[$var] and strncmp($var, "id_", 3) == 0 |
| 252 | 252 | and !in_array($var, $_exceptions)) |
| 253 | - $_POST[$var] = is_array($_POST[$var])?@array_map('intval', $_POST[$var]):intval($_POST[$var]); |
|
| 253 | + $_POST[$var] = is_array($_POST[$var]) ? @array_map('intval', $_POST[$var]) : intval($_POST[$var]); |
|
| 254 | 254 | foreach ($GLOBALS as $var => $val) |
| 255 | 255 | if ($GLOBALS[$var] and strncmp($var, "id_", 3) == 0 |
| 256 | 256 | and !in_array($var, $_exceptions)) |
| 257 | - $GLOBALS[$var] = is_array($GLOBALS[$var])?@array_map('intval', $GLOBALS[$var]):intval($GLOBALS[$var]); |
|
| 257 | + $GLOBALS[$var] = is_array($GLOBALS[$var]) ? @array_map('intval', $GLOBALS[$var]) : intval($GLOBALS[$var]); |
|
| 258 | 258 | |
| 259 | 259 | /* |
| 260 | 260 | * Interdit la variable $cjpeg_command, qui était utilisée sans |
@@ -265,18 +265,18 @@ discard block |
||
| 265 | 265 | /* |
| 266 | 266 | * Contrôle de quelques variables (XSS) |
| 267 | 267 | */ |
| 268 | -foreach(array('lang', 'var_recherche', 'aide', 'var_lang_r', 'lang_r', 'var_ajax_ancre', 'nom_fichier') as $var) { |
|
| 268 | +foreach (array('lang', 'var_recherche', 'aide', 'var_lang_r', 'lang_r', 'var_ajax_ancre', 'nom_fichier') as $var) { |
|
| 269 | 269 | if (isset($_GET[$var])) |
| 270 | - $_REQUEST[$var] = $GLOBALS[$var] = $_GET[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_GET[$var]); |
|
| 270 | + $_REQUEST[$var] = $GLOBALS[$var] = $_GET[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string) $_GET[$var]); |
|
| 271 | 271 | if (isset($_POST[$var])) |
| 272 | - $_REQUEST[$var] = $GLOBALS[$var] = $_POST[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string)$_POST[$var]); |
|
| 272 | + $_REQUEST[$var] = $GLOBALS[$var] = $_POST[$var] = preg_replace(',[^\w\,/#&;-]+,', ' ', (string) $_POST[$var]); |
|
| 273 | 273 | } |
| 274 | 274 | |
| 275 | 275 | /* |
| 276 | 276 | * Filtre l'accès à spip_acces_doc (injection SQL en 1.8.2x) |
| 277 | 277 | */ |
| 278 | -if (preg_match(',^(.*/)?spip_acces_doc\.,', (string)$_SERVER['REQUEST_URI'])) { |
|
| 279 | - $file = addslashes((string)$_GET['file']); |
|
| 278 | +if (preg_match(',^(.*/)?spip_acces_doc\.,', (string) $_SERVER['REQUEST_URI'])) { |
|
| 279 | + $file = addslashes((string) $_GET['file']); |
|
| 280 | 280 | } |
| 281 | 281 | |
| 282 | 282 | /* |
@@ -291,28 +291,28 @@ discard block |
||
| 291 | 291 | * Agenda joue à l'injection php |
| 292 | 292 | */ |
| 293 | 293 | if (isset($_REQUEST['partie_cal']) |
| 294 | -and $_REQUEST['partie_cal'] !== htmlentities((string)$_REQUEST['partie_cal'])) |
|
| 294 | +and $_REQUEST['partie_cal'] !== htmlentities((string) $_REQUEST['partie_cal'])) |
|
| 295 | 295 | $ecran_securite_raison = "partie_cal"; |
| 296 | 296 | if (isset($_REQUEST['echelle']) |
| 297 | -and $_REQUEST['echelle'] !== htmlentities((string)$_REQUEST['echelle'])) |
|
| 297 | +and $_REQUEST['echelle'] !== htmlentities((string) $_REQUEST['echelle'])) |
|
| 298 | 298 | $ecran_securite_raison = "echelle"; |
| 299 | 299 | |
| 300 | 300 | /* |
| 301 | 301 | * Espace privé |
| 302 | 302 | */ |
| 303 | 303 | if (isset($_REQUEST['exec']) |
| 304 | -and !preg_match(',^[\w-]+$,', (string)$_REQUEST['exec'])) |
|
| 304 | +and !preg_match(',^[\w-]+$,', (string) $_REQUEST['exec'])) |
|
| 305 | 305 | $ecran_securite_raison = "exec"; |
| 306 | 306 | if (isset($_REQUEST['cherche_auteur']) |
| 307 | -and preg_match(',[<],', (string)$_REQUEST['cherche_auteur'])) |
|
| 307 | +and preg_match(',[<],', (string) $_REQUEST['cherche_auteur'])) |
|
| 308 | 308 | $ecran_securite_raison = "cherche_auteur"; |
| 309 | 309 | if (isset($_REQUEST['exec']) |
| 310 | 310 | and $_REQUEST['exec'] == 'auteurs' |
| 311 | -and preg_match(',[<],', (string)$_REQUEST['recherche'])) |
|
| 311 | +and preg_match(',[<],', (string) $_REQUEST['recherche'])) |
|
| 312 | 312 | $ecran_securite_raison = "recherche"; |
| 313 | 313 | if (isset($_REQUEST['exec']) |
| 314 | 314 | and $_REQUEST['exec'] == 'info_plugin' |
| 315 | -and preg_match(',[<],', (string)$_REQUEST['plugin'])) |
|
| 315 | +and preg_match(',[<],', (string) $_REQUEST['plugin'])) |
|
| 316 | 316 | $ecran_securite_raison = "plugin"; |
| 317 | 317 | if (isset($_REQUEST['exec']) |
| 318 | 318 | and $_REQUEST['exec'] == 'puce_statut' |
@@ -325,7 +325,7 @@ discard block |
||
| 325 | 325 | or @file_exists('ecrire/inc_version.php')) { |
| 326 | 326 | function action_configurer() { |
| 327 | 327 | include_spip('inc/autoriser'); |
| 328 | - if(!autoriser('configurer', _request('configuration'))) { |
|
| 328 | + if (!autoriser('configurer', _request('configuration'))) { |
|
| 329 | 329 | include_spip('inc/minipres'); |
| 330 | 330 | echo minipres(_T('info_acces_interdit')); |
| 331 | 331 | exit; |
@@ -338,7 +338,7 @@ discard block |
||
| 338 | 338 | if (isset($_REQUEST['action']) |
| 339 | 339 | and $_REQUEST['action'] == 'ordonner_liens_documents' |
| 340 | 340 | and isset($_REQUEST['ordre']) |
| 341 | -and is_string($_REQUEST['ordre'])){ |
|
| 341 | +and is_string($_REQUEST['ordre'])) { |
|
| 342 | 342 | $ecran_securite_raison = "ordre a la chaine"; |
| 343 | 343 | } |
| 344 | 344 | |
@@ -373,9 +373,9 @@ discard block |
||
| 373 | 373 | */ |
| 374 | 374 | if (_IS_BOT and ( |
| 375 | 375 | (isset($_REQUEST['echelle']) and isset($_REQUEST['partie_cal']) and isset($_REQUEST['type'])) |
| 376 | - or (strpos((string)$_SERVER['REQUEST_URI'], 'debut_') and preg_match(',[?&]debut_.*&debut_,', (string)$_SERVER['REQUEST_URI'])) |
|
| 377 | - or (isset($_REQUEST['calendrier_annee']) and strpos((string)$_SERVER['REQUEST_URI'], 'debut_') ) |
|
| 378 | - or (isset($_REQUEST['calendrier_annee']) and preg_match(',[?&]calendrier_annee=.*&calendrier_annee=,', (string)$_SERVER['REQUEST_URI'])) |
|
| 376 | + or (strpos((string) $_SERVER['REQUEST_URI'], 'debut_') and preg_match(',[?&]debut_.*&debut_,', (string) $_SERVER['REQUEST_URI'])) |
|
| 377 | + or (isset($_REQUEST['calendrier_annee']) and strpos((string) $_SERVER['REQUEST_URI'], 'debut_')) |
|
| 378 | + or (isset($_REQUEST['calendrier_annee']) and preg_match(',[?&]calendrier_annee=.*&calendrier_annee=,', (string) $_SERVER['REQUEST_URI'])) |
|
| 379 | 379 | ) |
| 380 | 380 | ) |
| 381 | 381 | $ecran_securite_raison = "robot agenda/double pagination"; |
@@ -387,7 +387,7 @@ discard block |
||
| 387 | 387 | if (isset($_REQUEST['page'])) { |
| 388 | 388 | if ($_REQUEST['page'] == 'test_cfg') |
| 389 | 389 | $ecran_securite_raison = "test_cfg"; |
| 390 | - if ($_REQUEST['page'] !== htmlspecialchars((string)$_REQUEST['page'])) |
|
| 390 | + if ($_REQUEST['page'] !== htmlspecialchars((string) $_REQUEST['page'])) |
|
| 391 | 391 | $ecran_securite_raison = "xsspage"; |
| 392 | 392 | if ($_REQUEST['page'] == '404' |
| 393 | 393 | and isset($_REQUEST['erreur'])) |
@@ -425,12 +425,12 @@ discard block |
||
| 425 | 425 | /* |
| 426 | 426 | * Outils XML mal sécurisés again |
| 427 | 427 | */ |
| 428 | -if (isset($_REQUEST['var_url']) and $_REQUEST['var_url'] and isset($_REQUEST['exec']) and $_REQUEST['exec']=='valider_xml'){ |
|
| 428 | +if (isset($_REQUEST['var_url']) and $_REQUEST['var_url'] and isset($_REQUEST['exec']) and $_REQUEST['exec'] == 'valider_xml') { |
|
| 429 | 429 | $url = trim($_REQUEST['var_url']); |
| 430 | - if (strncmp($url,'/',1)==0 |
|
| 431 | - or (($p=strpos($url,'..'))!==false AND strpos($url,'..',$p+3)!==false) |
|
| 432 | - or (($p=strpos($url,'..'))!==false AND strpos($url,'IMG',$p+3)!==false) |
|
| 433 | - or (strpos($url,'://')!==false or strpos($url,':\\')!==false)) { |
|
| 430 | + if (strncmp($url, '/', 1) == 0 |
|
| 431 | + or (($p = strpos($url, '..')) !== false AND strpos($url, '..', $p + 3) !== false) |
|
| 432 | + or (($p = strpos($url, '..')) !== false AND strpos($url, 'IMG', $p + 3) !== false) |
|
| 433 | + or (strpos($url, '://') !== false or strpos($url, ':\\') !== false)) { |
|
| 434 | 434 | $ecran_securite_raison = 'URL interdite pour var_url'; |
| 435 | 435 | } |
| 436 | 436 | } |
@@ -439,10 +439,10 @@ discard block |
||
| 439 | 439 | * Sauvegarde mal securisée < 2.0.9 |
| 440 | 440 | */ |
| 441 | 441 | if (isset($_REQUEST['nom_sauvegarde']) |
| 442 | -and strstr((string)$_REQUEST['nom_sauvegarde'], '/')) |
|
| 442 | +and strstr((string) $_REQUEST['nom_sauvegarde'], '/')) |
|
| 443 | 443 | $ecran_securite_raison = 'nom_sauvegarde manipulee'; |
| 444 | 444 | if (isset($_REQUEST['znom_sauvegarde']) |
| 445 | -and strstr((string)$_REQUEST['znom_sauvegarde'], '/')) |
|
| 445 | +and strstr((string) $_REQUEST['znom_sauvegarde'], '/')) |
|
| 446 | 446 | $ecran_securite_raison = 'znom_sauvegarde manipulee'; |
| 447 | 447 | |
| 448 | 448 | |
@@ -457,8 +457,8 @@ discard block |
||
| 457 | 457 | /* |
| 458 | 458 | * Forms & Table ne se méfiait pas assez des uploads de fichiers |
| 459 | 459 | */ |
| 460 | -if (count($_FILES)){ |
|
| 461 | - foreach($_FILES as $k => $v){ |
|
| 460 | +if (count($_FILES)) { |
|
| 461 | + foreach ($_FILES as $k => $v) { |
|
| 462 | 462 | if (preg_match(',^fichier_\d+$,', $k) |
| 463 | 463 | and preg_match(',\.php,i', $v['name'])) |
| 464 | 464 | unset($_FILES[$k]); |
@@ -468,7 +468,7 @@ discard block |
||
| 468 | 468 | * et Contact trop laxiste avec une variable externe |
| 469 | 469 | * on bloque pas le post pour eviter de perdre des donnees mais on unset la variable et c'est tout |
| 470 | 470 | */ |
| 471 | -if (isset($_REQUEST['pj_enregistrees_nom']) and $_REQUEST['pj_enregistrees_nom']){ |
|
| 471 | +if (isset($_REQUEST['pj_enregistrees_nom']) and $_REQUEST['pj_enregistrees_nom']) { |
|
| 472 | 472 | unset($_REQUEST['pj_enregistrees_nom']); |
| 473 | 473 | unset($_GET['pj_enregistrees_nom']); |
| 474 | 474 | unset($_POST['pj_enregistrees_nom']); |
@@ -514,7 +514,7 @@ discard block |
||
| 514 | 514 | /* |
| 515 | 515 | * Réinjection des clés en html dans l'admin r19561 |
| 516 | 516 | */ |
| 517 | -if (strpos($_SERVER['REQUEST_URI'], "ecrire/") !== false or isset($_REQUEST['var_memotri'])){ |
|
| 517 | +if (strpos($_SERVER['REQUEST_URI'], "ecrire/") !== false or isset($_REQUEST['var_memotri'])) { |
|
| 518 | 518 | $zzzz = implode("", array_keys($_REQUEST)); |
| 519 | 519 | if (strlen($zzzz) != strcspn($zzzz, '<>"\'')) |
| 520 | 520 | $ecran_securite_raison = 'Cle incorrecte en $_REQUEST'; |
@@ -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], array(), $boucles, $boucles[$idb]->id_parent); |
|
| 113 | + $nom .= ".".calculer_liste($crit->param[0], array(), $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]), array(), $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 | |
@@ -643,26 +640,26 @@ discard block |
||
| 643 | 640 | (false !== $i = strpos($boucle->order[$n - 1], 'ASC')) |
| 644 | 641 | OR (false !== $i = strpos($boucle->order[$n - 1], 'DESC')) |
| 645 | 642 | ) { |
| 646 | - $boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . " . $boucle->modificateur['collate'] . " . ' ", $i, 0); |
|
| 643 | + $boucle->order[$n - 1] = substr_replace($boucle->order[$n - 1], "' . ".$boucle->modificateur['collate']." . ' ", $i, 0); |
|
| 647 | 644 | } else { |
| 648 | - $boucle->order[$n - 1] .= " . " . $boucle->modificateur['collate']; |
|
| 645 | + $boucle->order[$n - 1] .= " . ".$boucle->modificateur['collate']; |
|
| 649 | 646 | } |
| 650 | 647 | } |
| 651 | 648 | } else { |
| 652 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . " " . count($boucles[$idb]->order)))); |
|
| 649 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op." ".count($boucles[$idb]->order)))); |
|
| 653 | 650 | } |
| 654 | 651 | } |
| 655 | 652 | |
| 656 | 653 | // http://code.spip.net/@calculer_critere_arg_dynamique |
| 657 | 654 | function calculer_critere_arg_dynamique($idb, &$boucles, $crit, $suffix = '') { |
| 658 | 655 | $boucle = $boucles[$idb]; |
| 659 | - $alt = "('" . $boucle->id_table . '.\' . $x' . $suffix . ')'; |
|
| 660 | - $var = '$champs_' . $idb; |
|
| 656 | + $alt = "('".$boucle->id_table.'.\' . $x'.$suffix.')'; |
|
| 657 | + $var = '$champs_'.$idb; |
|
| 661 | 658 | $desc = (strpos($boucle->in, "static $var =") !== false); |
| 662 | 659 | if (!$desc) { |
| 663 | 660 | $desc = $boucle->show['field']; |
| 664 | 661 | $desc = implode(',', array_map('_q', array_keys($desc))); |
| 665 | - $boucles[$idb]->in .= "\n\tstatic $var = array(" . $desc . ");"; |
|
| 662 | + $boucles[$idb]->in .= "\n\tstatic $var = array(".$desc.");"; |
|
| 666 | 663 | } |
| 667 | 664 | if ($desc) { |
| 668 | 665 | $alt = "(in_array(\$x, $var) ? $alt :(\$x$suffix))"; |
@@ -737,7 +734,7 @@ discard block |
||
| 737 | 734 | $sens = " . ' DESC'"; |
| 738 | 735 | } |
| 739 | 736 | if (isset($boucle->modificateur['collate'])) { |
| 740 | - $collecte = ' . ' . $boucle->modificateur['collate']; |
|
| 737 | + $collecte = ' . '.$boucle->modificateur['collate']; |
|
| 741 | 738 | } |
| 742 | 739 | |
| 743 | 740 | // Pour chaque paramètre du critère |
@@ -759,14 +756,14 @@ discard block |
||
| 759 | 756 | if (preg_match(",^(\w+)[\s]+(.*)$,", $par, $m)) { |
| 760 | 757 | $expression = trim($m[1]); |
| 761 | 758 | $champ = trim($m[2]); |
| 762 | - if (function_exists($f = 'calculer_critere_par_expression_' . $expression)) { |
|
| 759 | + if (function_exists($f = 'calculer_critere_par_expression_'.$expression)) { |
|
| 763 | 760 | $order = $f($idb, $boucles, $crit, $tri, $champ); |
| 764 | 761 | } else { |
| 765 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par")); |
|
| 762 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." $par")); |
|
| 766 | 763 | } |
| 767 | 764 | |
| 768 | 765 | // tris de la forme {par champ} ou {par FONCTION(champ)} |
| 769 | - } elseif (preg_match(",^" . CHAMP_SQL_PLUS_FONC . '$,is', $par, $match)) { |
|
| 766 | + } elseif (preg_match(",^".CHAMP_SQL_PLUS_FONC.'$,is', $par, $match)) { |
|
| 770 | 767 | // {par FONCTION(champ)} |
| 771 | 768 | if (count($match) > 2) { |
| 772 | 769 | $par = substr($match[2], 1, -1); |
@@ -776,7 +773,7 @@ discard block |
||
| 776 | 773 | if ($par == 'hasard') { |
| 777 | 774 | $order = calculer_critere_par_hasard($idb, $boucles, $crit); |
| 778 | 775 | } elseif ($par == 'date' and !empty($boucle->show['date'])) { |
| 779 | - $order = "'" . $boucle->id_table . "." . $boucle->show['date'] . "'"; |
|
| 776 | + $order = "'".$boucle->id_table.".".$boucle->show['date']."'"; |
|
| 780 | 777 | } else { |
| 781 | 778 | // cas général {par champ}, {par table.champ}, ... |
| 782 | 779 | $order = calculer_critere_par_champ($idb, $boucles, $crit, $par); |
@@ -785,7 +782,7 @@ discard block |
||
| 785 | 782 | |
| 786 | 783 | // on ne sait pas traiter… |
| 787 | 784 | else { |
| 788 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par")); |
|
| 785 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." $par")); |
|
| 789 | 786 | } |
| 790 | 787 | |
| 791 | 788 | // En cas d'erreur de squelette retournée par une fonction |
@@ -805,14 +802,14 @@ discard block |
||
| 805 | 802 | |
| 806 | 803 | if ($fct) { |
| 807 | 804 | if (preg_match("/^\s*'(.*)'\s*$/", $order, $r)) { |
| 808 | - $order = "'$fct(" . $r[1] . ")'"; |
|
| 805 | + $order = "'$fct(".$r[1].")'"; |
|
| 809 | 806 | } else { |
| 810 | 807 | $order = "'$fct(' . $order . ')'"; |
| 811 | 808 | } |
| 812 | 809 | } |
| 813 | - $t = $order . $collecte . $sens; |
|
| 810 | + $t = $order.$collecte.$sens; |
|
| 814 | 811 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 815 | - $t = $r[1] . $r[2]; |
|
| 812 | + $t = $r[1].$r[2]; |
|
| 816 | 813 | } |
| 817 | 814 | |
| 818 | 815 | $boucle->order[] = $t; |
@@ -862,16 +859,16 @@ discard block |
||
| 862 | 859 | function calculer_critere_par_expression_num($idb, &$boucles, $crit, $tri, $champ) { |
| 863 | 860 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 864 | 861 | if (is_array($_champ)) { |
| 865 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " num $champ")); |
|
| 862 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." num $champ")); |
|
| 866 | 863 | } |
| 867 | 864 | $boucle = &$boucles[$idb]; |
| 868 | - $texte = '0+' . $_champ; |
|
| 865 | + $texte = '0+'.$_champ; |
|
| 869 | 866 | $suite = calculer_liste($tri, array(), $boucles, $boucle->id_parent); |
| 870 | 867 | if ($suite !== "''") { |
| 871 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . " . \""; |
|
| 868 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')"." . \""; |
|
| 872 | 869 | } |
| 873 | - $as = 'num' . ($boucle->order ? count($boucle->order) : ""); |
|
| 874 | - $boucle->select[] = $texte . " AS $as"; |
|
| 870 | + $as = 'num'.($boucle->order ? count($boucle->order) : ""); |
|
| 871 | + $boucle->select[] = $texte." AS $as"; |
|
| 875 | 872 | $order = "'$as'"; |
| 876 | 873 | return $order; |
| 877 | 874 | } |
@@ -896,16 +893,16 @@ discard block |
||
| 896 | 893 | function calculer_critere_par_expression_sinum($idb, &$boucles, $crit, $tri, $champ) { |
| 897 | 894 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 898 | 895 | if (is_array($_champ)) { |
| 899 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " sinum $champ")); |
|
| 896 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." sinum $champ")); |
|
| 900 | 897 | } |
| 901 | 898 | $boucle = &$boucles[$idb]; |
| 902 | - $texte = '0+' . $_champ; |
|
| 899 | + $texte = '0+'.$_champ; |
|
| 903 | 900 | $suite = calculer_liste($tri, array(), $boucles, $boucle->id_parent); |
| 904 | 901 | if ($suite !== "''") { |
| 905 | - $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')" . " . \""; |
|
| 902 | + $texte = "\" . ((\$x = $suite) ? ('$texte' . \$x) : '0')"." . \""; |
|
| 906 | 903 | } |
| 907 | - $as = 'sinum' . ($boucle->order ? count($boucle->order) : ""); |
|
| 908 | - $boucle->select[] = 'CASE (' . $texte . ') WHEN 0 THEN 1 ELSE 0 END AS ' . $as; |
|
| 904 | + $as = 'sinum'.($boucle->order ? count($boucle->order) : ""); |
|
| 905 | + $boucle->select[] = 'CASE ('.$texte.') WHEN 0 THEN 1 ELSE 0 END AS '.$as; |
|
| 909 | 906 | $order = "'$as'"; |
| 910 | 907 | return $order; |
| 911 | 908 | } |
@@ -929,10 +926,10 @@ discard block |
||
| 929 | 926 | function calculer_critere_par_expression_multi($idb, &$boucles, $crit, $tri, $champ) { |
| 930 | 927 | $_champ = calculer_critere_par_champ($idb, $boucles, $crit, $champ, true); |
| 931 | 928 | if (is_array($_champ)) { |
| 932 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " multi $champ")); |
|
| 929 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." multi $champ")); |
|
| 933 | 930 | } |
| 934 | 931 | $boucle = &$boucles[$idb]; |
| 935 | - $boucle->select[] = "\".sql_multi('" . $_champ . "', \$GLOBALS['spip_lang']).\""; |
|
| 932 | + $boucle->select[] = "\".sql_multi('".$_champ."', \$GLOBALS['spip_lang']).\""; |
|
| 936 | 933 | $order = "'multi'"; |
| 937 | 934 | return $order; |
| 938 | 935 | } |
@@ -952,13 +949,13 @@ discard block |
||
| 952 | 949 | * @param bool $raw Retourne le champ pour le compilateur ("'alias.champ'") ou brut ('alias.champ') |
| 953 | 950 | * @return array|string |
| 954 | 951 | */ |
| 955 | -function calculer_critere_par_champ($idb, &$boucles, $crit, $par, $raw = false) { |
|
| 952 | +function calculer_critere_par_champ($idb, &$boucles, $crit, $par, $raw = false) { |
|
| 956 | 953 | $boucle = &$boucles[$idb]; |
| 957 | 954 | $desc = $boucle->show; |
| 958 | 955 | |
| 959 | 956 | // le champ existe dans la table, pas de souci (le plus commun) |
| 960 | 957 | if (isset($desc['field'][$par])) { |
| 961 | - $par = $boucle->id_table . "." . $par; |
|
| 958 | + $par = $boucle->id_table.".".$par; |
|
| 962 | 959 | } |
| 963 | 960 | // le champ est peut être une jointure |
| 964 | 961 | else { |
@@ -979,24 +976,24 @@ discard block |
||
| 979 | 976 | // Sinon on cherche le champ dans les tables possibles de jointures |
| 980 | 977 | // Si la table est déjà dans le from, on la réutilise. |
| 981 | 978 | if ($infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $table)) { |
| 982 | - $par = $infos['alias'] . "." . $champ; |
|
| 979 | + $par = $infos['alias'].".".$champ; |
|
| 983 | 980 | } elseif ( |
| 984 | 981 | $boucle->jointures_explicites |
| 985 | 982 | and $alias = trouver_jointure_champ($champ, $boucle, explode(' ', $boucle->jointures_explicites), false, $table) |
| 986 | 983 | ) { |
| 987 | - $par = $alias . "." . $champ; |
|
| 984 | + $par = $alias.".".$champ; |
|
| 988 | 985 | } elseif ($alias = trouver_jointure_champ($champ, $boucle, $boucle->jointures, false, $table)) { |
| 989 | - $par = $alias . "." . $champ; |
|
| 986 | + $par = $alias.".".$champ; |
|
| 990 | 987 | // en spécifiant directement l'alias {par L2.titre} (situation hasardeuse tout de même) |
| 991 | 988 | } elseif ( |
| 992 | 989 | $table_alias |
| 993 | 990 | and isset($boucle->from[$table_alias]) |
| 994 | 991 | and $infos = chercher_champ_dans_tables($champ, $boucle->from, $boucle->sql_serveur, $boucle->from[$table_alias]) |
| 995 | 992 | ) { |
| 996 | - $par = $infos['alias'] . "." . $champ; |
|
| 993 | + $par = $infos['alias'].".".$champ; |
|
| 997 | 994 | } elseif ($table) { |
| 998 | 995 | // On avait table + champ, mais on ne les a pas trouvés |
| 999 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " $par")); |
|
| 996 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." $par")); |
|
| 1000 | 997 | } else { |
| 1001 | 998 | // Sinon tant pis, ca doit etre un champ synthetise (cf points) |
| 1002 | 999 | } |
@@ -1020,7 +1017,7 @@ discard block |
||
| 1020 | 1017 | if (!$t) { |
| 1021 | 1018 | $t = trouver_jointure_champ($champ, $boucle); |
| 1022 | 1019 | } |
| 1023 | - return !$t ? '' : ("'" . $t . '.' . $champ . "'"); |
|
| 1020 | + return !$t ? '' : ("'".$t.'.'.$champ."'"); |
|
| 1024 | 1021 | } |
| 1025 | 1022 | |
| 1026 | 1023 | /** |
@@ -1065,9 +1062,9 @@ discard block |
||
| 1065 | 1062 | $boucle->default_order[] = ' DESC'; |
| 1066 | 1063 | } |
| 1067 | 1064 | } else { |
| 1068 | - $t = $boucle->order[$n - 1] . " . $order"; |
|
| 1065 | + $t = $boucle->order[$n - 1]." . $order"; |
|
| 1069 | 1066 | if (preg_match("/^(.*)'\s*\.\s*'([^']*')$/", $t, $r)) { |
| 1070 | - $t = $r[1] . $r[2]; |
|
| 1067 | + $t = $r[1].$r[2]; |
|
| 1071 | 1068 | } |
| 1072 | 1069 | $boucle->order[$n - 1] = $t; |
| 1073 | 1070 | } |
@@ -1079,7 +1076,7 @@ discard block |
||
| 1079 | 1076 | $params = $crit->param; |
| 1080 | 1077 | |
| 1081 | 1078 | if (count($params) < 1) { |
| 1082 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " ?")); |
|
| 1079 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." ?")); |
|
| 1083 | 1080 | } |
| 1084 | 1081 | |
| 1085 | 1082 | $boucle = &$boucles[$idb]; |
@@ -1100,7 +1097,7 @@ discard block |
||
| 1100 | 1097 | if ((count($date) == 1) and ($date[0]->type == 'texte')) { |
| 1101 | 1098 | $date = $date[0]->texte; |
| 1102 | 1099 | if (!isset($fields[$date])) { |
| 1103 | - return array('zbug_critere_inconnu', array('critere' => $crit->op . " " . $date)); |
|
| 1100 | + return array('zbug_critere_inconnu', array('critere' => $crit->op." ".$date)); |
|
| 1104 | 1101 | } |
| 1105 | 1102 | } else { |
| 1106 | 1103 | $a = calculer_liste($date, array(), $boucles, $parent); |
@@ -1112,38 +1109,38 @@ discard block |
||
| 1112 | 1109 | $date = "'.(($cond)\n?\$a:\"$defaut\").'"; |
| 1113 | 1110 | } |
| 1114 | 1111 | $annee = $params ? array_shift($params) : ""; |
| 1115 | - $annee = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1116 | - calculer_liste($annee, array(), $boucles, $parent) . |
|
| 1112 | + $annee = "\n".'sprintf("%04d", ($x = '. |
|
| 1113 | + calculer_liste($annee, array(), $boucles, $parent). |
|
| 1117 | 1114 | ') ? $x : date("Y"))'; |
| 1118 | 1115 | |
| 1119 | 1116 | $mois = $params ? array_shift($params) : ""; |
| 1120 | - $mois = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1121 | - calculer_liste($mois, array(), $boucles, $parent) . |
|
| 1117 | + $mois = "\n".'sprintf("%02d", ($x = '. |
|
| 1118 | + calculer_liste($mois, array(), $boucles, $parent). |
|
| 1122 | 1119 | ') ? $x : date("m"))'; |
| 1123 | 1120 | |
| 1124 | 1121 | $jour = $params ? array_shift($params) : ""; |
| 1125 | - $jour = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1126 | - calculer_liste($jour, array(), $boucles, $parent) . |
|
| 1122 | + $jour = "\n".'sprintf("%02d", ($x = '. |
|
| 1123 | + calculer_liste($jour, array(), $boucles, $parent). |
|
| 1127 | 1124 | ') ? $x : date("d"))'; |
| 1128 | 1125 | |
| 1129 | 1126 | $annee2 = $params ? array_shift($params) : ""; |
| 1130 | - $annee2 = "\n" . 'sprintf("%04d", ($x = ' . |
|
| 1131 | - calculer_liste($annee2, array(), $boucles, $parent) . |
|
| 1127 | + $annee2 = "\n".'sprintf("%04d", ($x = '. |
|
| 1128 | + calculer_liste($annee2, array(), $boucles, $parent). |
|
| 1132 | 1129 | ') ? $x : date("Y"))'; |
| 1133 | 1130 | |
| 1134 | 1131 | $mois2 = $params ? array_shift($params) : ""; |
| 1135 | - $mois2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1136 | - calculer_liste($mois2, array(), $boucles, $parent) . |
|
| 1132 | + $mois2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1133 | + calculer_liste($mois2, array(), $boucles, $parent). |
|
| 1137 | 1134 | ') ? $x : date("m"))'; |
| 1138 | 1135 | |
| 1139 | 1136 | $jour2 = $params ? array_shift($params) : ""; |
| 1140 | - $jour2 = "\n" . 'sprintf("%02d", ($x = ' . |
|
| 1141 | - calculer_liste($jour2, array(), $boucles, $parent) . |
|
| 1137 | + $jour2 = "\n".'sprintf("%02d", ($x = '. |
|
| 1138 | + calculer_liste($jour2, array(), $boucles, $parent). |
|
| 1142 | 1139 | ') ? $x : date("d"))'; |
| 1143 | 1140 | |
| 1144 | - $date = $boucle->id_table . ".$date"; |
|
| 1141 | + $date = $boucle->id_table.".$date"; |
|
| 1145 | 1142 | |
| 1146 | - $quote_end = ",'" . $boucle->sql_serveur . "','text'"; |
|
| 1143 | + $quote_end = ",'".$boucle->sql_serveur."','text'"; |
|
| 1147 | 1144 | if ($type == 'jour') { |
| 1148 | 1145 | $boucle->where[] = array( |
| 1149 | 1146 | "'='", |
@@ -1215,14 +1212,13 @@ discard block |
||
| 1215 | 1212 | list($a21, $a22) = calculer_critere_parties_aux($idb, $boucles, $a2); |
| 1216 | 1213 | |
| 1217 | 1214 | if (($op == ',') && (is_numeric($a11) && (is_numeric($a21)))) { |
| 1218 | - $boucle->limit = $a11 . ',' . $a21; |
|
| 1215 | + $boucle->limit = $a11.','.$a21; |
|
| 1219 | 1216 | } else { |
| 1220 | 1217 | // 3 dans {1/3}, {2,3} ou {1,n-3} |
| 1221 | 1218 | $boucle->total_parties = ($a21 != 'n') ? $a21 : $a22; |
| 1222 | 1219 | // 2 dans {2/3}, {2,5}, {n-2,1} |
| 1223 | 1220 | $partie = ($a11 != 'n') ? $a11 : $a12; |
| 1224 | - $mode = (($op == '/') ? '/' : |
|
| 1225 | - (($a11 == 'n') ? '-' : '+') . (($a21 == 'n') ? '-' : '+')); |
|
| 1221 | + $mode = (($op == '/') ? '/' : (($a11 == 'n') ? '-' : '+').(($a21 == 'n') ? '-' : '+')); |
|
| 1226 | 1222 | // cas simple {0,#ENV{truc}} compilons le en LIMIT : |
| 1227 | 1223 | if ($a11 !== 'n' and $a21 !== 'n' and $mode == "++" and $op == ',') { |
| 1228 | 1224 | $boucle->limit = |
@@ -1268,8 +1264,7 @@ discard block |
||
| 1268 | 1264 | // {1/3} |
| 1269 | 1265 | if ($op1 == '/') { |
| 1270 | 1266 | $pmoins1 = is_numeric($debut) ? ($debut - 1) : "($debut-1)"; |
| 1271 | - $totpos = is_numeric($total_parties) ? ($total_parties) : |
|
| 1272 | - "($total_parties ? $total_parties : 1)"; |
|
| 1267 | + $totpos = is_numeric($total_parties) ? ($total_parties) : "($total_parties ? $total_parties : 1)"; |
|
| 1273 | 1268 | $fin = "ceil(($nombre_boucle * $debut )/$totpos) - 1"; |
| 1274 | 1269 | $debut = !$pmoins1 ? 0 : "ceil(($nombre_boucle * $pmoins1)/$totpos);"; |
| 1275 | 1270 | } else { |
@@ -1280,15 +1275,13 @@ discard block |
||
| 1280 | 1275 | |
| 1281 | 1276 | // cas {x,n-1} |
| 1282 | 1277 | if ($op2 == '-') { |
| 1283 | - $fin = '$debut_boucle + ' . $nombre_boucle . ' - ' |
|
| 1284 | - . (is_numeric($total_parties) ? ($total_parties + 1) : |
|
| 1285 | - ($total_parties . ' - 1')); |
|
| 1278 | + $fin = '$debut_boucle + '.$nombre_boucle.' - ' |
|
| 1279 | + . (is_numeric($total_parties) ? ($total_parties + 1) : ($total_parties.' - 1')); |
|
| 1286 | 1280 | } else { |
| 1287 | 1281 | // {x,1} ou {pagination} |
| 1288 | 1282 | $fin = '$debut_boucle' |
| 1289 | 1283 | . (is_numeric($total_parties) ? |
| 1290 | - (($total_parties == 1) ? "" : (' + ' . ($total_parties - 1))) : |
|
| 1291 | - ('+' . $total_parties . ' - 1')); |
|
| 1284 | + (($total_parties == 1) ? "" : (' + '.($total_parties - 1))) : ('+'.$total_parties.' - 1')); |
|
| 1292 | 1285 | } |
| 1293 | 1286 | |
| 1294 | 1287 | // {pagination}, gerer le debut_xx=-1 pour tout voir |
@@ -1306,11 +1299,11 @@ discard block |
||
| 1306 | 1299 | // Utiliser min pour rabattre $fin_boucle sur total_boucle. |
| 1307 | 1300 | |
| 1308 | 1301 | $boucles[$id_boucle]->mode_partie = "\n\t" |
| 1309 | - . '$debut_boucle = ' . $debut . ";\n " |
|
| 1302 | + . '$debut_boucle = '.$debut.";\n " |
|
| 1310 | 1303 | . "\$debut_boucle = intval(\$debut_boucle);\n " |
| 1311 | - . '$fin_boucle = min(' . $fin . ", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1312 | - . '$Numrows[\'' . $id_boucle . "']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1313 | - . '$Numrows[\'' . $id_boucle . '\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1304 | + . '$fin_boucle = min('.$fin.", \$Numrows['$id_boucle']['total'] - 1);\n " |
|
| 1305 | + . '$Numrows[\''.$id_boucle."']['grand_total'] = \$Numrows['$id_boucle']['total'];\n " |
|
| 1306 | + . '$Numrows[\''.$id_boucle.'\']["total"] = max(0,$fin_boucle - $debut_boucle + 1);' |
|
| 1314 | 1307 | . "\n\tif (\$debut_boucle>0" |
| 1315 | 1308 | . " AND \$debut_boucle < \$Numrows['$id_boucle']['grand_total']" |
| 1316 | 1309 | . " AND \$iter->seek(\$debut_boucle,'continue'))" |
@@ -1395,16 +1388,16 @@ discard block |
||
| 1395 | 1388 | // critere personnalise ? |
| 1396 | 1389 | if ( |
| 1397 | 1390 | (!$serveur or |
| 1398 | - ((!function_exists($f = "critere_" . $serveur . "_" . $table . "_" . $critere)) |
|
| 1399 | - and (!function_exists($f = $f . "_dist")) |
|
| 1400 | - and (!function_exists($f = "critere_" . $serveur . "_" . $critere)) |
|
| 1401 | - and (!function_exists($f = $f . "_dist")) |
|
| 1391 | + ((!function_exists($f = "critere_".$serveur."_".$table."_".$critere)) |
|
| 1392 | + and (!function_exists($f = $f."_dist")) |
|
| 1393 | + and (!function_exists($f = "critere_".$serveur."_".$critere)) |
|
| 1394 | + and (!function_exists($f = $f."_dist")) |
|
| 1402 | 1395 | ) |
| 1403 | 1396 | ) |
| 1404 | - and (!function_exists($f = "critere_" . $table . "_" . $critere)) |
|
| 1405 | - and (!function_exists($f = $f . "_dist")) |
|
| 1406 | - and (!function_exists($f = "critere_" . $critere)) |
|
| 1407 | - and (!function_exists($f = $f . "_dist")) |
|
| 1397 | + and (!function_exists($f = "critere_".$table."_".$critere)) |
|
| 1398 | + and (!function_exists($f = $f."_dist")) |
|
| 1399 | + and (!function_exists($f = "critere_".$critere)) |
|
| 1400 | + and (!function_exists($f = $f."_dist")) |
|
| 1408 | 1401 | ) { |
| 1409 | 1402 | // fonction critere standard |
| 1410 | 1403 | $f = $defaut; |
@@ -1437,9 +1430,9 @@ discard block |
||
| 1437 | 1430 | */ |
| 1438 | 1431 | function kwote($lisp, $serveur = '', $type = '') { |
| 1439 | 1432 | if (preg_match(_CODE_QUOTE, $lisp, $r)) { |
| 1440 | - return $r[1] . "\"" . sql_quote(str_replace(array("\\'", "\\\\"), array("'", "\\"), $r[2]), $serveur, $type) . "\""; |
|
| 1433 | + return $r[1]."\"".sql_quote(str_replace(array("\\'", "\\\\"), array("'", "\\"), $r[2]), $serveur, $type)."\""; |
|
| 1441 | 1434 | } else { |
| 1442 | - return "sql_quote($lisp, '$serveur', '" . str_replace("'", "\\'", $type) . "')"; |
|
| 1435 | + return "sql_quote($lisp, '$serveur', '".str_replace("'", "\\'", $type)."')"; |
|
| 1443 | 1436 | } |
| 1444 | 1437 | } |
| 1445 | 1438 | |
@@ -1461,7 +1454,7 @@ discard block |
||
| 1461 | 1454 | function critere_IN_dist($idb, &$boucles, $crit) { |
| 1462 | 1455 | $r = calculer_critere_infixe($idb, $boucles, $crit); |
| 1463 | 1456 | if (!$r) { |
| 1464 | - return (array('zbug_critere_inconnu', array('critere' => $crit->op . " ?"))); |
|
| 1457 | + return (array('zbug_critere_inconnu', array('critere' => $crit->op." ?"))); |
|
| 1465 | 1458 | } |
| 1466 | 1459 | list($arg, $op, $val, $col, $where_complement) = $r; |
| 1467 | 1460 | |
@@ -1488,8 +1481,8 @@ discard block |
||
| 1488 | 1481 | "'NOT'", |
| 1489 | 1482 | array( |
| 1490 | 1483 | "'IN'", |
| 1491 | - "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", |
|
| 1492 | - array("'SELF'", "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", $where) |
|
| 1484 | + "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", |
|
| 1485 | + array("'SELF'", "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", $where) |
|
| 1493 | 1486 | ) |
| 1494 | 1487 | ); |
| 1495 | 1488 | } |
@@ -1508,22 +1501,22 @@ discard block |
||
| 1508 | 1501 | $descr = $boucles[$idb]->descr; |
| 1509 | 1502 | $cpt = &$num[$descr['nom']][$descr['gram']][$idb]; |
| 1510 | 1503 | |
| 1511 | - $var = '$in' . $cpt++; |
|
| 1504 | + $var = '$in'.$cpt++; |
|
| 1512 | 1505 | $x = "\n\t$var = array();"; |
| 1513 | 1506 | foreach ($val as $k => $v) { |
| 1514 | 1507 | if (preg_match(",^(\n//.*\n)?'(.*)'$,", $v, $r)) { |
| 1515 | 1508 | // optimiser le traitement des constantes |
| 1516 | 1509 | if (is_numeric($r[2])) { |
| 1517 | - $x .= "\n\t$var" . "[]= $r[2];"; |
|
| 1510 | + $x .= "\n\t$var"."[]= $r[2];"; |
|
| 1518 | 1511 | } else { |
| 1519 | - $x .= "\n\t$var" . "[]= " . sql_quote($r[2]) . ";"; |
|
| 1512 | + $x .= "\n\t$var"."[]= ".sql_quote($r[2]).";"; |
|
| 1520 | 1513 | } |
| 1521 | 1514 | } else { |
| 1522 | 1515 | // Pour permettre de passer des tableaux de valeurs |
| 1523 | 1516 | // on repere l'utilisation brute de #ENV**{X}, |
| 1524 | 1517 | // c'est-a-dire sa traduction en ($PILE[0][X]). |
| 1525 | 1518 | // et on deballe mais en rajoutant l'anti XSS |
| 1526 | - $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var" . "[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1519 | + $x .= "\n\tif (!(is_array(\$a = ($v))))\n\t\t$var"."[]= \$a;\n\telse $var = array_merge($var, \$a);"; |
|
| 1527 | 1520 | } |
| 1528 | 1521 | } |
| 1529 | 1522 | |
@@ -1537,7 +1530,7 @@ discard block |
||
| 1537 | 1530 | $boucles[$idb]->default_order[] = "((!\$zqv=sql_quote($var) OR \$zqv===\"''\") ? 0 : ('FIELD($arg,' . \$zqv . ')'))"; |
| 1538 | 1531 | } |
| 1539 | 1532 | |
| 1540 | - return "sql_in('$arg', $var" . ($crit2 == 'NOT' ? ",'NOT'" : "") . ")"; |
|
| 1533 | + return "sql_in('$arg', $var".($crit2 == 'NOT' ? ",'NOT'" : "").")"; |
|
| 1541 | 1534 | } |
| 1542 | 1535 | |
| 1543 | 1536 | /** |
@@ -1610,7 +1603,7 @@ discard block |
||
| 1610 | 1603 | $champs = array_diff($champs, array_keys($boucle->modificateur['criteres'])); |
| 1611 | 1604 | } |
| 1612 | 1605 | // nous aider en mode debug. |
| 1613 | - $boucle->debug[] = "id_ : " . implode(', ', $champs); |
|
| 1606 | + $boucle->debug[] = "id_ : ".implode(', ', $champs); |
|
| 1614 | 1607 | $boucle->modificateur['id_'] = $champs; |
| 1615 | 1608 | |
| 1616 | 1609 | // créer un critère {id_xxx?} de chaque champ retenu |
@@ -1651,7 +1644,7 @@ discard block |
||
| 1651 | 1644 | // Les champs id_xx de la table demandée |
| 1652 | 1645 | $champs = array_filter( |
| 1653 | 1646 | array_keys($desc['field']), |
| 1654 | - function($champ){ |
|
| 1647 | + function($champ) { |
|
| 1655 | 1648 | return |
| 1656 | 1649 | strpos($champ, 'id_') === 0 |
| 1657 | 1650 | or (in_array($champ, array('objet'))); |
@@ -1854,8 +1847,8 @@ discard block |
||
| 1854 | 1847 | "'NOT'", |
| 1855 | 1848 | array( |
| 1856 | 1849 | "'IN'", |
| 1857 | - "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", |
|
| 1858 | - array("'SELF'", "'" . $boucles[$idb]->id_table . "." . $boucles[$idb]->primary . "'", $where) |
|
| 1850 | + "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", |
|
| 1851 | + array("'SELF'", "'".$boucles[$idb]->id_table.".".$boucles[$idb]->primary."'", $where) |
|
| 1859 | 1852 | ) |
| 1860 | 1853 | ); |
| 1861 | 1854 | } |
@@ -1866,7 +1859,7 @@ discard block |
||
| 1866 | 1859 | if ($crit->cond) { |
| 1867 | 1860 | $pred = calculer_argument_precedent($idb, $col, $boucles); |
| 1868 | 1861 | if ($col == "date" or $col == "date_redac") { |
| 1869 | - if ($pred == "\$Pile[0]['" . $col . "']") { |
|
| 1862 | + if ($pred == "\$Pile[0]['".$col."']") { |
|
| 1870 | 1863 | $pred = "(\$Pile[0]['{$col}_default']?'':$pred)"; |
| 1871 | 1864 | } |
| 1872 | 1865 | } |
@@ -2027,7 +2020,7 @@ discard block |
||
| 2027 | 2020 | // defaire le quote des int et les passer dans sql_quote avec le bon type de champ si on le connait, int sinon |
| 2028 | 2021 | // prendre en compte le debug ou la valeur arrive avec un commentaire PHP en debut |
| 2029 | 2022 | if (preg_match(",^\\A(\s*//.*?$\s*)?\"'(-?\d+)'\"\\z,ms", $val[0], $r)) { |
| 2030 | - $val[0] = $r[1] . '"' . sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote) . '"'; |
|
| 2023 | + $val[0] = $r[1].'"'.sql_quote($r[2], $boucle->sql_serveur, $type_cast_quote).'"'; |
|
| 2031 | 2024 | } |
| 2032 | 2025 | // sinon expliciter les |
| 2033 | 2026 | // sql_quote(truc) en sql_quote(truc,'',type) |
@@ -2038,22 +2031,22 @@ discard block |
||
| 2038 | 2031 | // sql_quote(truc,'','varchar') |
| 2039 | 2032 | elseif (preg_match('/\Asql_quote[(](.*?)(,[^)]*?)?(,[^)]*(?:\(\d+\)[^)]*)?)?[)]\s*\z/ms', $val[0], $r) |
| 2040 | 2033 | // si pas deja un type |
| 2041 | - and (!isset($r[3]) or !$r[3] or !trim($r[3],", '")) |
|
| 2034 | + and (!isset($r[3]) or !$r[3] or !trim($r[3], ", '")) |
|
| 2042 | 2035 | ) { |
| 2043 | 2036 | $r = $r[1] |
| 2044 | 2037 | . ((isset($r[2]) and $r[2]) ? $r[2] : ",''") |
| 2045 | - . ",'" . addslashes($type_cast_quote) . "'"; |
|
| 2038 | + . ",'".addslashes($type_cast_quote)."'"; |
|
| 2046 | 2039 | $val[0] = "sql_quote($r)"; |
| 2047 | 2040 | } |
| 2048 | - elseif(strpos($val[0], '@@defaultcast@@') !== false |
|
| 2041 | + elseif (strpos($val[0], '@@defaultcast@@') !== false |
|
| 2049 | 2042 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r)) { |
| 2050 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'" . addslashes($type_cast_quote) . "')"; |
|
| 2043 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'".addslashes($type_cast_quote)."')"; |
|
| 2051 | 2044 | } |
| 2052 | 2045 | } |
| 2053 | 2046 | |
| 2054 | - if(strpos($val[0], '@@defaultcast@@') !== false |
|
| 2047 | + if (strpos($val[0], '@@defaultcast@@') !== false |
|
| 2055 | 2048 | and preg_match("/'@@defaultcast@@'\s*\)\s*\z/ms", $val[0], $r)) { |
| 2056 | - $val[0] = substr($val[0], 0, -strlen($r[0])) . "'char')"; |
|
| 2049 | + $val[0] = substr($val[0], 0, -strlen($r[0]))."'char')"; |
|
| 2057 | 2050 | } |
| 2058 | 2051 | |
| 2059 | 2052 | // Indicateur pour permettre aux fonctionx boucle_X de modifier |
@@ -2078,7 +2071,7 @@ discard block |
||
| 2078 | 2071 | // inserer le nom de la table SQL devant le nom du champ |
| 2079 | 2072 | if ($table) { |
| 2080 | 2073 | if ($col[0] == "`") { |
| 2081 | - $arg = "$table." . substr($col, 1, -1); |
|
| 2074 | + $arg = "$table.".substr($col, 1, -1); |
|
| 2082 | 2075 | } else { |
| 2083 | 2076 | $arg = "$table.$col"; |
| 2084 | 2077 | } |
@@ -2212,9 +2205,9 @@ discard block |
||
| 2212 | 2205 | **/ |
| 2213 | 2206 | function primary_doublee($decompose, $table) { |
| 2214 | 2207 | $e1 = reset($decompose); |
| 2215 | - $e2 = "sql_quote('" . end($decompose) . "')"; |
|
| 2208 | + $e2 = "sql_quote('".end($decompose)."')"; |
|
| 2216 | 2209 | |
| 2217 | - return array("'='", "'$table." . $e1 . "'", $e2); |
|
| 2210 | + return array("'='", "'$table.".$e1."'", $e2); |
|
| 2218 | 2211 | } |
| 2219 | 2212 | |
| 2220 | 2213 | /** |
@@ -2252,7 +2245,7 @@ discard block |
||
| 2252 | 2245 | if ($checkarrivee |
| 2253 | 2246 | and is_string($checkarrivee) |
| 2254 | 2247 | and $a = table_objet($checkarrivee) |
| 2255 | - and in_array($a . '_liens', $joints) |
|
| 2248 | + and in_array($a.'_liens', $joints) |
|
| 2256 | 2249 | ) { |
| 2257 | 2250 | if ($res = calculer_lien_externe_init($boucle, $joints, $col, $desc, $cond, $checkarrivee)) { |
| 2258 | 2251 | return $res; |
@@ -2272,12 +2265,12 @@ discard block |
||
| 2272 | 2265 | // la table est déjà dans le FROM, on vérifie si le champ est utilisé. |
| 2273 | 2266 | $joindre = false; |
| 2274 | 2267 | foreach ($cols as $col) { |
| 2275 | - $c = '/\b' . $t . ".$col" . '\b/'; |
|
| 2268 | + $c = '/\b'.$t.".$col".'\b/'; |
|
| 2276 | 2269 | if (trouver_champ($c, $boucle->where)) { |
| 2277 | 2270 | $joindre = true; |
| 2278 | 2271 | } else { |
| 2279 | 2272 | // mais ca peut etre dans le FIELD pour le Having |
| 2280 | - $c = "/FIELD.$t" . ".$col,/"; |
|
| 2273 | + $c = "/FIELD.$t".".$col,/"; |
|
| 2281 | 2274 | if (trouver_champ($c, $boucle->select)) { |
| 2282 | 2275 | $joindre = true; |
| 2283 | 2276 | } |
@@ -2324,7 +2317,7 @@ discard block |
||
| 2324 | 2317 | $primary_arrivee = id_table_objet($checkarrivee); |
| 2325 | 2318 | |
| 2326 | 2319 | // [FIXME] $checkarrivee peut-il arriver avec false ???? |
| 2327 | - $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee . "_liens"); |
|
| 2320 | + $intermediaire = trouver_champ_exterieur($primary_arrivee, $joints, $boucle, $checkarrivee."_liens"); |
|
| 2328 | 2321 | $arrivee = trouver_champ_exterieur($col, $joints, $boucle, $checkarrivee); |
| 2329 | 2322 | |
| 2330 | 2323 | if (!$intermediaire or !$arrivee) { |
@@ -2422,7 +2415,7 @@ discard block |
||
| 2422 | 2415 | } elseif ($crit->cond and ($col == "date" or $col == "date_redac")) { |
| 2423 | 2416 | // un critere conditionnel sur date est traite a part |
| 2424 | 2417 | // car la date est mise d'office par SPIP, |
| 2425 | - $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['" . $col . "'])"; |
|
| 2418 | + $defaut = "(\$Pile[0]['{$col}_default']?'':\$Pile[0]['".$col."'])"; |
|
| 2426 | 2419 | } |
| 2427 | 2420 | |
| 2428 | 2421 | $val = calculer_argument_precedent($idb, $val, $boucles, $defaut); |
@@ -2454,7 +2447,7 @@ discard block |
||
| 2454 | 2447 | and (($p == "'") or ($p == '"')) |
| 2455 | 2448 | and $params[0][1]->type == 'champ' |
| 2456 | 2449 | ) { |
| 2457 | - $val[] = "$p\\$p#" . $params[0][1]->nom_champ . "\\$p$p"; |
|
| 2450 | + $val[] = "$p\\$p#".$params[0][1]->nom_champ."\\$p$p"; |
|
| 2458 | 2451 | } else { |
| 2459 | 2452 | foreach ((($op != 'IN') ? $params : calculer_vieux_in($params)) as $p) { |
| 2460 | 2453 | $a = calculer_liste($p, $desc, $boucles, $parent); |
@@ -2470,7 +2463,7 @@ discard block |
||
| 2470 | 2463 | $fct = $args_sql = ''; |
| 2471 | 2464 | // fonction SQL ? |
| 2472 | 2465 | // chercher FONCTION(champ) tel que CONCAT(titre,descriptif) |
| 2473 | - if (preg_match('/^(.*)' . SQL_ARGS . '$/', $col, $m)) { |
|
| 2466 | + if (preg_match('/^(.*)'.SQL_ARGS.'$/', $col, $m)) { |
|
| 2474 | 2467 | $fct = $m[1]; |
| 2475 | 2468 | preg_match('/^\(([^,]*)(.*)\)$/', $m[2], $a); |
| 2476 | 2469 | $col = $a[1]; |
@@ -2560,7 +2553,7 @@ discard block |
||
| 2560 | 2553 | # si oui choisir ce champ, sinon choisir xxxx |
| 2561 | 2554 | |
| 2562 | 2555 | if (isset($table['field']["date$suite"])) { |
| 2563 | - $date_orig = 'date' . $suite; |
|
| 2556 | + $date_orig = 'date'.$suite; |
|
| 2564 | 2557 | } else { |
| 2565 | 2558 | $date_orig = substr($suite, 1); |
| 2566 | 2559 | } |
@@ -2571,12 +2564,12 @@ discard block |
||
| 2571 | 2564 | } |
| 2572 | 2565 | } |
| 2573 | 2566 | |
| 2574 | - $date_compare = "\"' . normaliser_date(" . |
|
| 2575 | - calculer_argument_precedent($idb, $pred, $boucles) . |
|
| 2567 | + $date_compare = "\"' . normaliser_date(". |
|
| 2568 | + calculer_argument_precedent($idb, $pred, $boucles). |
|
| 2576 | 2569 | ") . '\""; |
| 2577 | 2570 | |
| 2578 | 2571 | $col_vraie = $date_orig; |
| 2579 | - $date_orig = $boucle->id_table . '.' . $date_orig; |
|
| 2572 | + $date_orig = $boucle->id_table.'.'.$date_orig; |
|
| 2580 | 2573 | |
| 2581 | 2574 | switch ($col) { |
| 2582 | 2575 | case 'date': |
@@ -2596,26 +2589,26 @@ discard block |
||
| 2596 | 2589 | break; |
| 2597 | 2590 | case 'age': |
| 2598 | 2591 | $col = calculer_param_date("NOW()", $date_orig); |
| 2599 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2592 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2600 | 2593 | break; |
| 2601 | 2594 | case 'age_relatif': |
| 2602 | 2595 | $col = calculer_param_date($date_compare, $date_orig); |
| 2603 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2596 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2604 | 2597 | break; |
| 2605 | 2598 | case 'jour_relatif': |
| 2606 | - $col = "(TO_DAYS(" . $date_compare . ")-TO_DAYS(" . $date_orig . "))"; |
|
| 2607 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2599 | + $col = "(TO_DAYS(".$date_compare.")-TO_DAYS(".$date_orig."))"; |
|
| 2600 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2608 | 2601 | break; |
| 2609 | 2602 | case 'mois_relatif': |
| 2610 | - $col = "MONTH(" . $date_compare . ")-MONTH(" . |
|
| 2611 | - $date_orig . ")+12*(YEAR(" . $date_compare . |
|
| 2612 | - ")-YEAR(" . $date_orig . "))"; |
|
| 2613 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2603 | + $col = "MONTH(".$date_compare.")-MONTH(". |
|
| 2604 | + $date_orig.")+12*(YEAR(".$date_compare. |
|
| 2605 | + ")-YEAR(".$date_orig."))"; |
|
| 2606 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2614 | 2607 | break; |
| 2615 | 2608 | case 'annee_relatif': |
| 2616 | - $col = "YEAR(" . $date_compare . ")-YEAR(" . |
|
| 2617 | - $date_orig . ")"; |
|
| 2618 | - $col_vraie = "";// comparer a un int (par defaut) |
|
| 2609 | + $col = "YEAR(".$date_compare.")-YEAR(". |
|
| 2610 | + $date_orig.")"; |
|
| 2611 | + $col_vraie = ""; // comparer a un int (par defaut) |
|
| 2619 | 2612 | break; |
| 2620 | 2613 | } |
| 2621 | 2614 | |
@@ -2674,10 +2667,10 @@ discard block |
||
| 2674 | 2667 | } |
| 2675 | 2668 | |
| 2676 | 2669 | $boucle->hash .= ' |
| 2677 | - $command[\'sourcemode\'] = ' . array_shift($args) . ";\n"; |
|
| 2670 | + $command[\'sourcemode\'] = ' . array_shift($args).";\n"; |
|
| 2678 | 2671 | |
| 2679 | 2672 | $boucle->hash .= ' |
| 2680 | - $command[\'source\'] = array(' . join(', ', $args) . ");\n"; |
|
| 2673 | + $command[\'source\'] = array(' . join(', ', $args).");\n"; |
|
| 2681 | 2674 | } |
| 2682 | 2675 | |
| 2683 | 2676 | |
@@ -2695,8 +2688,8 @@ discard block |
||
| 2695 | 2688 | function critere_DATA_datasource_dist($idb, &$boucles, $crit) { |
| 2696 | 2689 | $boucle = &$boucles[$idb]; |
| 2697 | 2690 | $boucle->hash .= ' |
| 2698 | - $command[\'source\'] = array(' . calculer_liste($crit->param[0], array(), $boucles, $boucles[$idb]->id_parent) . '); |
|
| 2699 | - $command[\'sourcemode\'] = ' . calculer_liste($crit->param[1], array(), $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2691 | + $command[\'source\'] = array(' . calculer_liste($crit->param[0], array(), $boucles, $boucles[$idb]->id_parent).'); |
|
| 2692 | + $command[\'sourcemode\'] = ' . calculer_liste($crit->param[1], array(), $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2700 | 2693 | } |
| 2701 | 2694 | |
| 2702 | 2695 | |
@@ -2716,7 +2709,7 @@ discard block |
||
| 2716 | 2709 | function critere_DATA_datacache_dist($idb, &$boucles, $crit) { |
| 2717 | 2710 | $boucle = &$boucles[$idb]; |
| 2718 | 2711 | $boucle->hash .= ' |
| 2719 | - $command[\'datacache\'] = ' . calculer_liste($crit->param[0], array(), $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2712 | + $command[\'datacache\'] = ' . calculer_liste($crit->param[0], array(), $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2720 | 2713 | } |
| 2721 | 2714 | |
| 2722 | 2715 | |
@@ -2735,7 +2728,7 @@ discard block |
||
| 2735 | 2728 | $boucle->hash .= '$command[\'args\']=array();'; |
| 2736 | 2729 | foreach ($crit->param as $param) { |
| 2737 | 2730 | $boucle->hash .= ' |
| 2738 | - $command[\'args\'][] = ' . calculer_liste($param, array(), $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2731 | + $command[\'args\'][] = ' . calculer_liste($param, array(), $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2739 | 2732 | } |
| 2740 | 2733 | } |
| 2741 | 2734 | |
@@ -2754,10 +2747,10 @@ discard block |
||
| 2754 | 2747 | */ |
| 2755 | 2748 | function critere_DATA_liste_dist($idb, &$boucles, $crit) { |
| 2756 | 2749 | $boucle = &$boucles[$idb]; |
| 2757 | - $boucle->hash .= "\n\t" . '$command[\'liste\'] = array();' . "\n"; |
|
| 2750 | + $boucle->hash .= "\n\t".'$command[\'liste\'] = array();'."\n"; |
|
| 2758 | 2751 | foreach ($crit->param as $param) { |
| 2759 | - $boucle->hash .= "\t" . '$command[\'liste\'][] = ' . calculer_liste($param, array(), $boucles, |
|
| 2760 | - $boucles[$idb]->id_parent) . ";\n"; |
|
| 2752 | + $boucle->hash .= "\t".'$command[\'liste\'][] = '.calculer_liste($param, array(), $boucles, |
|
| 2753 | + $boucles[$idb]->id_parent).";\n"; |
|
| 2761 | 2754 | } |
| 2762 | 2755 | } |
| 2763 | 2756 | |
@@ -2784,10 +2777,10 @@ discard block |
||
| 2784 | 2777 | */ |
| 2785 | 2778 | function critere_DATA_enum_dist($idb, &$boucles, $crit) { |
| 2786 | 2779 | $boucle = &$boucles[$idb]; |
| 2787 | - $boucle->hash .= "\n\t" . '$command[\'enum\'] = array();' . "\n"; |
|
| 2780 | + $boucle->hash .= "\n\t".'$command[\'enum\'] = array();'."\n"; |
|
| 2788 | 2781 | foreach ($crit->param as $param) { |
| 2789 | - $boucle->hash .= "\t" . '$command[\'enum\'][] = ' . calculer_liste($param, array(), $boucles, |
|
| 2790 | - $boucles[$idb]->id_parent) . ";\n"; |
|
| 2782 | + $boucle->hash .= "\t".'$command[\'enum\'][] = '.calculer_liste($param, array(), $boucles, |
|
| 2783 | + $boucles[$idb]->id_parent).";\n"; |
|
| 2791 | 2784 | } |
| 2792 | 2785 | } |
| 2793 | 2786 | |
@@ -2806,7 +2799,7 @@ discard block |
||
| 2806 | 2799 | $boucle = &$boucles[$idb]; |
| 2807 | 2800 | foreach ($crit->param as $param) { |
| 2808 | 2801 | $boucle->hash .= ' |
| 2809 | - $command[\'datapath\'][] = ' . calculer_liste($param, array(), $boucles, $boucles[$idb]->id_parent) . ';'; |
|
| 2802 | + $command[\'datapath\'][] = ' . calculer_liste($param, array(), $boucles, $boucles[$idb]->id_parent).';'; |
|
| 2810 | 2803 | } |
| 2811 | 2804 | } |
| 2812 | 2805 | |
@@ -2847,7 +2840,7 @@ discard block |
||
| 2847 | 2840 | if ($crit->param) { |
| 2848 | 2841 | foreach ($crit->param as $param) { |
| 2849 | 2842 | $boucle->hash .= "\t\$command['si'][] = " |
| 2850 | - . calculer_liste($param, array(), $boucles, $boucles[$idb]->id_parent) . ";\n"; |
|
| 2843 | + . calculer_liste($param, array(), $boucles, $boucles[$idb]->id_parent).";\n"; |
|
| 2851 | 2844 | } |
| 2852 | 2845 | // interdire {si 0} aussi ! |
| 2853 | 2846 | } else { |
@@ -2870,7 +2863,7 @@ discard block |
||
| 2870 | 2863 | function critere_POUR_tableau_dist($idb, &$boucles, $crit) { |
| 2871 | 2864 | $boucle = &$boucles[$idb]; |
| 2872 | 2865 | $boucle->hash .= ' |
| 2873 | - $command[\'source\'] = array(' . calculer_liste($crit->param[0], array(), $boucles, $boucles[$idb]->id_parent) . '); |
|
| 2866 | + $command[\'source\'] = array(' . calculer_liste($crit->param[0], array(), $boucles, $boucles[$idb]->id_parent).'); |
|
| 2874 | 2867 | $command[\'sourcemode\'] = \'table\';'; |
| 2875 | 2868 | } |
| 2876 | 2869 | |
@@ -2903,11 +2896,10 @@ discard block |
||
| 2903 | 2896 | $table_sql = table_objet_sql(objet_type($table)); |
| 2904 | 2897 | |
| 2905 | 2898 | $id_parent = isset($GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent']) ? |
| 2906 | - $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : |
|
| 2907 | - 'id_parent'; |
|
| 2899 | + $GLOBALS['exceptions_des_tables'][$boucle->id_table]['id_parent'] : 'id_parent'; |
|
| 2908 | 2900 | |
| 2909 | 2901 | $in = "IN"; |
| 2910 | - $where = array("'IN'", "'$boucle->id_table." . "$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"); |
|
| 2902 | + $where = array("'IN'", "'$boucle->id_table."."$primary'", "'('.sql_get_select('$id_parent', '$table_sql').')'"); |
|
| 2911 | 2903 | if ($not) { |
| 2912 | 2904 | $where = array("'NOT'", $where); |
| 2913 | 2905 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | // si port est fourni mais pas host, c'est un socket -> compat avec vieille syntaxe de mysql_connect() et anciens fichiers connect.php |
| 49 | 49 | if ( |
| 50 | 50 | $port and !is_numeric($socket = $port) |
| 51 | - and (!$host or $host=='localhost')) { |
|
| 51 | + and (!$host or $host == 'localhost')) { |
|
| 52 | 52 | $link = @mysqli_connect($host, $login, $pass, '', null, $socket); |
| 53 | 53 | } |
| 54 | 54 | elseif ($port) { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | if (!$link) { |
| 62 | - spip_log('Echec mysqli_connect. Erreur : ' . mysqli_connect_error(), 'mysql.' . _LOG_HS); |
|
| 62 | + spip_log('Echec mysqli_connect. Erreur : '.mysqli_connect_error(), 'mysql.'._LOG_HS); |
|
| 63 | 63 | |
| 64 | 64 | return false; |
| 65 | 65 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - spip_log("Connexion MySQLi vers $host, base $db, prefixe $prefixe " . ($ok ? "operationnelle" : 'impossible'), |
|
| 79 | + spip_log("Connexion MySQLi vers $host, base $db, prefixe $prefixe ".($ok ? "operationnelle" : 'impossible'), |
|
| 80 | 80 | _LOG_DEBUG); |
| 81 | 81 | |
| 82 | 82 | return !$ok ? false : array( |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | function spip_mysql_set_charset($charset, $serveur = '', $requeter = true) { |
| 167 | 167 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 168 | - spip_log("changement de charset sql : " . "SET NAMES " . _q($charset), _LOG_DEBUG); |
|
| 168 | + spip_log("changement de charset sql : "."SET NAMES "._q($charset), _LOG_DEBUG); |
|
| 169 | 169 | |
| 170 | - return mysqli_query($connexion['link'], $connexion['last'] = "SET NAMES " . _q($charset)); |
|
| 170 | + return mysqli_query($connexion['link'], $connexion['last'] = "SET NAMES "._q($charset)); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | function spip_mysql_get_charset($charset = array(), $serveur = '', $requeter = true) { |
| 183 | 183 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 184 | 184 | $connexion['last'] = $c = "SHOW CHARACTER SET" |
| 185 | - . (!$charset ? '' : (" LIKE " . _q($charset['charset']))); |
|
| 185 | + . (!$charset ? '' : (" LIKE "._q($charset['charset']))); |
|
| 186 | 186 | |
| 187 | 187 | return spip_mysql_fetch(mysqli_query($connexion['link'], $c), null, $serveur); |
| 188 | 188 | } |
@@ -242,14 +242,14 @@ discard block |
||
| 242 | 242 | $debug = ''; |
| 243 | 243 | if (defined('_DEBUG_SLOW_QUERIES') and _DEBUG_SLOW_QUERIES) { |
| 244 | 244 | if (isset($GLOBALS['debug']['aucasou'])) { |
| 245 | - list(, $id, , $infos) = $GLOBALS['debug']['aucasou']; |
|
| 246 | - $debug .= "BOUCLE$id @ " . (isset($infos[0]) ? $infos[0] : '') . " | "; |
|
| 245 | + list(, $id,, $infos) = $GLOBALS['debug']['aucasou']; |
|
| 246 | + $debug .= "BOUCLE$id @ ".(isset($infos[0]) ? $infos[0] : '')." | "; |
|
| 247 | 247 | } |
| 248 | - $debug .= $_SERVER['REQUEST_URI'] . ' + ' . $GLOBALS['ip']; |
|
| 249 | - $debug = ' /* ' . mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)) . ' */'; |
|
| 248 | + $debug .= $_SERVER['REQUEST_URI'].' + '.$GLOBALS['ip']; |
|
| 249 | + $debug = ' /* '.mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)).' */'; |
|
| 250 | 250 | } |
| 251 | 251 | |
| 252 | - $r = mysqli_query($link, $query . $debug); |
|
| 252 | + $r = mysqli_query($link, $query.$debug); |
|
| 253 | 253 | |
| 254 | 254 | //Eviter de propager le GoneAway sur les autres requetes d'un même processus PHP |
| 255 | 255 | if ($e = spip_mysql_errno($serveur)) { // Log d'un Gone Away |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 263 | 263 | $link = $connexion['link']; |
| 264 | 264 | //On retente au cas où |
| 265 | - $r = mysqli_query($link, $query . $debug); |
|
| 265 | + $r = mysqli_query($link, $query.$debug); |
|
| 266 | 266 | } |
| 267 | 267 | } |
| 268 | 268 | |
@@ -290,7 +290,7 @@ discard block |
||
| 290 | 290 | // d'utiliser ceux-ci, copie-colle de phpmyadmin |
| 291 | 291 | $query = preg_replace(",^TABLE\s*`([^`]*)`,i", "TABLE \\1", $query); |
| 292 | 292 | |
| 293 | - return spip_mysql_query("ALTER " . $query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 293 | + return spip_mysql_query("ALTER ".$query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 294 | 294 | } |
| 295 | 295 | |
| 296 | 296 | |
@@ -303,7 +303,7 @@ discard block |
||
| 303 | 303 | * @return bool Toujours true |
| 304 | 304 | */ |
| 305 | 305 | function spip_mysql_optimize($table, $serveur = '', $requeter = true) { |
| 306 | - spip_mysql_query("OPTIMIZE TABLE " . $table); |
|
| 306 | + spip_mysql_query("OPTIMIZE TABLE ".$table); |
|
| 307 | 307 | |
| 308 | 308 | return true; |
| 309 | 309 | } |
@@ -326,7 +326,7 @@ discard block |
||
| 326 | 326 | $link = $connexion['link']; |
| 327 | 327 | $db = $connexion['db']; |
| 328 | 328 | |
| 329 | - $query = 'EXPLAIN ' . _mysql_traite_query($query, $db, $prefixe); |
|
| 329 | + $query = 'EXPLAIN '._mysql_traite_query($query, $db, $prefixe); |
|
| 330 | 330 | $r = mysqli_query($link, $query); |
| 331 | 331 | |
| 332 | 332 | return spip_mysql_fetch($r, null, $serveur); |
@@ -377,7 +377,7 @@ discard block |
||
| 377 | 377 | . calculer_mysql_expression('WHERE', $where) |
| 378 | 378 | . calculer_mysql_expression('GROUP BY', $groupby, ',') |
| 379 | 379 | . calculer_mysql_expression('HAVING', $having) |
| 380 | - . ($orderby ? ("\nORDER BY " . spip_mysql_order($orderby)) : '') |
|
| 380 | + . ($orderby ? ("\nORDER BY ".spip_mysql_order($orderby)) : '') |
|
| 381 | 381 | . ($limit ? "\nLIMIT $limit" : ''); |
| 382 | 382 | |
| 383 | 383 | // renvoyer la requete inerte si demandee |
@@ -467,12 +467,12 @@ discard block |
||
| 467 | 467 | $exp = "\n$expression "; |
| 468 | 468 | |
| 469 | 469 | if (!is_array($v)) { |
| 470 | - return $exp . $v; |
|
| 470 | + return $exp.$v; |
|
| 471 | 471 | } else { |
| 472 | 472 | if (strtoupper($join) === 'AND') { |
| 473 | - return $exp . join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 473 | + return $exp.join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 474 | 474 | } else { |
| 475 | - return $exp . join($join, $v); |
|
| 475 | + return $exp.join($join, $v); |
|
| 476 | 476 | } |
| 477 | 477 | } |
| 478 | 478 | } |
@@ -490,17 +490,17 @@ discard block |
||
| 490 | 490 | if (substr($k, -1) == '@') { |
| 491 | 491 | // c'est une jointure qui se refere au from precedent |
| 492 | 492 | // pas de virgule |
| 493 | - $res .= ' ' . $v; |
|
| 493 | + $res .= ' '.$v; |
|
| 494 | 494 | } else { |
| 495 | 495 | if (!is_numeric($k)) { |
| 496 | 496 | $p = strpos($v, " "); |
| 497 | 497 | if ($p) { |
| 498 | - $v = substr($v, 0, $p) . " AS `$k`" . substr($v, $p); |
|
| 498 | + $v = substr($v, 0, $p)." AS `$k`".substr($v, $p); |
|
| 499 | 499 | } else { |
| 500 | 500 | $v .= " AS `$k`"; |
| 501 | 501 | } |
| 502 | 502 | } |
| 503 | - $res .= ', ' . $v; |
|
| 503 | + $res .= ', '.$v; |
|
| 504 | 504 | } |
| 505 | 505 | } |
| 506 | 506 | |
@@ -529,13 +529,13 @@ discard block |
||
| 529 | 529 | function _mysql_traite_query($query, $db = '', $prefixe = '') { |
| 530 | 530 | |
| 531 | 531 | if ($GLOBALS['mysql_rappel_nom_base'] and $db) { |
| 532 | - $pref = '`' . $db . '`.'; |
|
| 532 | + $pref = '`'.$db.'`.'; |
|
| 533 | 533 | } else { |
| 534 | 534 | $pref = ''; |
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | if ($prefixe) { |
| 538 | - $pref .= $prefixe . "_"; |
|
| 538 | + $pref .= $prefixe."_"; |
|
| 539 | 539 | } |
| 540 | 540 | |
| 541 | 541 | if (!preg_match('/\s(SET|VALUES|WHERE|DATABASE)\s/i', $query, $regs)) { |
@@ -549,12 +549,12 @@ discard block |
||
| 549 | 549 | if (stripos($suite, "SELECT") !== false) { |
| 550 | 550 | list($suite, $textes) = query_echappe_textes($suite); |
| 551 | 551 | if (preg_match('/^(.*?)([(]\s*SELECT\b.*)$/si', $suite, $r)) { |
| 552 | - $suite = $r[1] . _mysql_traite_query($r[2], $db, $prefixe); |
|
| 552 | + $suite = $r[1]._mysql_traite_query($r[2], $db, $prefixe); |
|
| 553 | 553 | } |
| 554 | 554 | $suite = query_reinjecte_textes($suite, $textes); |
| 555 | 555 | } |
| 556 | 556 | } |
| 557 | - $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1' . $pref, $query) . $suite; |
|
| 557 | + $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1'.$pref, $query).$suite; |
|
| 558 | 558 | |
| 559 | 559 | // en option, remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
| 560 | 560 | if (defined('_MYSQL_NOPLANES') and _MYSQL_NOPLANES and lire_meta('charset_sql_connexion') == 'utf8') { |
@@ -584,7 +584,7 @@ discard block |
||
| 584 | 584 | $link = _mysql_link($serveur); |
| 585 | 585 | $ok = mysqli_select_db($link, $db); |
| 586 | 586 | if (!$ok) { |
| 587 | - spip_log('Echec mysqli_selectdb. Erreur : ' . mysqli_error($link), 'mysql.' . _LOG_CRITIQUE); |
|
| 587 | + spip_log('Echec mysqli_selectdb. Erreur : '.mysqli_error($link), 'mysql.'._LOG_CRITIQUE); |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | return $ok; |
@@ -674,10 +674,10 @@ discard block |
||
| 674 | 674 | |
| 675 | 675 | $character_set = ""; |
| 676 | 676 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 677 | - $character_set .= " CHARACTER SET " . $GLOBALS['meta']['charset_sql_base']; |
|
| 677 | + $character_set .= " CHARACTER SET ".$GLOBALS['meta']['charset_sql_base']; |
|
| 678 | 678 | } |
| 679 | 679 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 680 | - $character_set .= " COLLATE " . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 680 | + $character_set .= " COLLATE ".$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 681 | 681 | } |
| 682 | 682 | |
| 683 | 683 | foreach ($champs as $k => $v) { |
@@ -686,7 +686,7 @@ discard block |
||
| 686 | 686 | if (preg_match(',(char|text),i', $defs[1]) |
| 687 | 687 | and !preg_match(',(binary|CHARACTER|COLLATE),i', $v) |
| 688 | 688 | ) { |
| 689 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 689 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 690 | 690 | } |
| 691 | 691 | } |
| 692 | 692 | |
@@ -698,7 +698,7 @@ discard block |
||
| 698 | 698 | $s = ","; |
| 699 | 699 | } |
| 700 | 700 | $temporary = $temporary ? 'TEMPORARY' : ''; |
| 701 | - $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query" . ($keys ? ",$keys" : '') . ")" |
|
| 701 | + $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query".($keys ? ",$keys" : '').")" |
|
| 702 | 702 | . " ENGINE=MyISAM" |
| 703 | 703 | . ($character_set ? " DEFAULT $character_set" : "") |
| 704 | 704 | . "\n"; |
@@ -778,7 +778,7 @@ discard block |
||
| 778 | 778 | return false; |
| 779 | 779 | } |
| 780 | 780 | |
| 781 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 781 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 782 | 782 | |
| 783 | 783 | return spip_mysql_query($query, $serveur, $requeter); |
| 784 | 784 | } |
@@ -836,7 +836,7 @@ discard block |
||
| 836 | 836 | * Ressource à utiliser avec sql_fetch() |
| 837 | 837 | **/ |
| 838 | 838 | function spip_mysql_showbase($match, $serveur = '', $requeter = true) { |
| 839 | - return spip_mysql_query("SHOW TABLES LIKE " . _q($match), $serveur, $requeter); |
|
| 839 | + return spip_mysql_query("SHOW TABLES LIKE "._q($match), $serveur, $requeter); |
|
| 840 | 840 | } |
| 841 | 841 | |
| 842 | 842 | /** |
@@ -930,22 +930,22 @@ discard block |
||
| 930 | 930 | } |
| 931 | 931 | if ($val['Default'] === '0' || $val['Default']) { |
| 932 | 932 | if (preg_match('/[A-Z_]/', $val['Default'])) { |
| 933 | - $nfields[$val["Field"]] .= ' DEFAULT ' . $val['Default']; |
|
| 933 | + $nfields[$val["Field"]] .= ' DEFAULT '.$val['Default']; |
|
| 934 | 934 | } else { |
| 935 | - $nfields[$val["Field"]] .= " DEFAULT '" . $val['Default'] . "'"; |
|
| 935 | + $nfields[$val["Field"]] .= " DEFAULT '".$val['Default']."'"; |
|
| 936 | 936 | } |
| 937 | 937 | } |
| 938 | 938 | if ($val['Extra']) { |
| 939 | - $nfields[$val["Field"]] .= ' ' . $val['Extra']; |
|
| 939 | + $nfields[$val["Field"]] .= ' '.$val['Extra']; |
|
| 940 | 940 | } |
| 941 | 941 | if ($val['Key'] == 'PRI') { |
| 942 | 942 | $nkeys['PRIMARY KEY'] = $val["Field"]; |
| 943 | 943 | } else { |
| 944 | 944 | if ($val['Key'] == 'MUL') { |
| 945 | - $nkeys['KEY ' . $val["Field"]] = $val["Field"]; |
|
| 945 | + $nkeys['KEY '.$val["Field"]] = $val["Field"]; |
|
| 946 | 946 | } else { |
| 947 | 947 | if ($val['Key'] == 'UNI') { |
| 948 | - $nkeys['UNIQUE KEY ' . $val["Field"]] = $val["Field"]; |
|
| 948 | + $nkeys['UNIQUE KEY '.$val["Field"]] = $val["Field"]; |
|
| 949 | 949 | } |
| 950 | 950 | } |
| 951 | 951 | } |
@@ -1016,7 +1016,7 @@ discard block |
||
| 1016 | 1016 | $serveur = '', |
| 1017 | 1017 | $requeter = true |
| 1018 | 1018 | ) { |
| 1019 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1019 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1020 | 1020 | |
| 1021 | 1021 | $r = spip_mysql_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 1022 | 1022 | if (!$requeter) { |
@@ -1056,7 +1056,7 @@ discard block |
||
| 1056 | 1056 | if ($s) { |
| 1057 | 1057 | $trace = debug_backtrace(); |
| 1058 | 1058 | if ($trace[0]['function'] != "spip_mysql_error") { |
| 1059 | - spip_log("$s - $query - " . sql_error_backtrace(), 'mysql.' . _LOG_ERREUR); |
|
| 1059 | + spip_log("$s - $query - ".sql_error_backtrace(), 'mysql.'._LOG_ERREUR); |
|
| 1060 | 1060 | } |
| 1061 | 1061 | } |
| 1062 | 1062 | |
@@ -1214,7 +1214,7 @@ discard block |
||
| 1214 | 1214 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1215 | 1215 | } |
| 1216 | 1216 | |
| 1217 | - return spip_mysql_insert($table, "(" . join(',', array_keys($couples)) . ")", "(" . join(',', $couples) . ")", $desc, |
|
| 1217 | + return spip_mysql_insert($table, "(".join(',', array_keys($couples)).")", "(".join(',', $couples).")", $desc, |
|
| 1218 | 1218 | $serveur, $requeter); |
| 1219 | 1219 | } |
| 1220 | 1220 | |
@@ -1248,7 +1248,7 @@ discard block |
||
| 1248 | 1248 | } |
| 1249 | 1249 | $fields = isset($desc['field']) ? $desc['field'] : array(); |
| 1250 | 1250 | |
| 1251 | - $cles = "(" . join(',', array_keys(reset($tab_couples))) . ')'; |
|
| 1251 | + $cles = "(".join(',', array_keys(reset($tab_couples))).')'; |
|
| 1252 | 1252 | $valeurs = array(); |
| 1253 | 1253 | $r = false; |
| 1254 | 1254 | |
@@ -1257,7 +1257,7 @@ discard block |
||
| 1257 | 1257 | foreach ($couples as $champ => $val) { |
| 1258 | 1258 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1259 | 1259 | } |
| 1260 | - $valeurs[] = '(' . join(',', $couples) . ')'; |
|
| 1260 | + $valeurs[] = '('.join(',', $couples).')'; |
|
| 1261 | 1261 | if (count($valeurs) >= 100) { |
| 1262 | 1262 | $r = spip_mysql_insert($table, $cles, join(', ', $valeurs), $desc, $serveur, $requeter); |
| 1263 | 1263 | $valeurs = array(); |
@@ -1294,7 +1294,7 @@ discard block |
||
| 1294 | 1294 | function spip_mysql_update($table, $champs, $where = '', $desc = array(), $serveur = '', $requeter = true) { |
| 1295 | 1295 | $set = array(); |
| 1296 | 1296 | foreach ($champs as $champ => $val) { |
| 1297 | - $set[] = $champ . "=$val"; |
|
| 1297 | + $set[] = $champ."=$val"; |
|
| 1298 | 1298 | } |
| 1299 | 1299 | if (!empty($set)) { |
| 1300 | 1300 | return spip_mysql_query( |
@@ -1348,7 +1348,7 @@ discard block |
||
| 1348 | 1348 | } |
| 1349 | 1349 | $set = array(); |
| 1350 | 1350 | foreach ($champs as $champ => $val) { |
| 1351 | - $set[] = $champ . '=' . spip_mysql_cite($val, @$fields[$champ]); |
|
| 1351 | + $set[] = $champ.'='.spip_mysql_cite($val, @$fields[$champ]); |
|
| 1352 | 1352 | } |
| 1353 | 1353 | |
| 1354 | 1354 | return spip_mysql_query( |
@@ -1413,8 +1413,8 @@ discard block |
||
| 1413 | 1413 | * - False en cas d'erreur. |
| 1414 | 1414 | **/ |
| 1415 | 1415 | function spip_mysql_replace($table, $couples, $desc = array(), $serveur = '', $requeter = true) { |
| 1416 | - return spip_mysql_query("REPLACE $table (" . join(',', array_keys($couples)) . ') VALUES (' . join(',', |
|
| 1417 | - array_map('_q', $couples)) . ')', $serveur, $requeter); |
|
| 1416 | + return spip_mysql_query("REPLACE $table (".join(',', array_keys($couples)).') VALUES ('.join(',', |
|
| 1417 | + array_map('_q', $couples)).')', $serveur, $requeter); |
|
| 1418 | 1418 | } |
| 1419 | 1419 | |
| 1420 | 1420 | |
@@ -1443,10 +1443,10 @@ discard block |
||
| 1443 | 1443 | * - False en cas d'erreur. |
| 1444 | 1444 | **/ |
| 1445 | 1445 | function spip_mysql_replace_multi($table, $tab_couples, $desc = array(), $serveur = '', $requeter = true) { |
| 1446 | - $cles = "(" . join(',', array_keys($tab_couples[0])) . ')'; |
|
| 1446 | + $cles = "(".join(',', array_keys($tab_couples[0])).')'; |
|
| 1447 | 1447 | $valeurs = array(); |
| 1448 | 1448 | foreach ($tab_couples as $couples) { |
| 1449 | - $valeurs[] = '(' . join(',', array_map('_q', $couples)) . ')'; |
|
| 1449 | + $valeurs[] = '('.join(',', array_map('_q', $couples)).')'; |
|
| 1450 | 1450 | } |
| 1451 | 1451 | $valeurs = implode(', ', $valeurs); |
| 1452 | 1452 | |
@@ -1466,28 +1466,28 @@ discard block |
||
| 1466 | 1466 | */ |
| 1467 | 1467 | function spip_mysql_multi($objet, $lang) { |
| 1468 | 1468 | $lengthlang = strlen("[$lang]"); |
| 1469 | - $posmulti = "INSTR(" . $objet . ", '<multi>')"; |
|
| 1470 | - $posfinmulti = "INSTR(" . $objet . ", '</multi>')"; |
|
| 1471 | - $debutchaine = "LEFT(" . $objet . ", $posmulti-1)"; |
|
| 1472 | - $finchaine = "RIGHT(" . $objet . ", CHAR_LENGTH(" . $objet . ") -(7+$posfinmulti))"; |
|
| 1473 | - $chainemulti = "TRIM(SUBSTRING(" . $objet . ", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1474 | - $poslang = "INSTR($chainemulti,'[" . $lang . "]')"; |
|
| 1469 | + $posmulti = "INSTR(".$objet.", '<multi>')"; |
|
| 1470 | + $posfinmulti = "INSTR(".$objet.", '</multi>')"; |
|
| 1471 | + $debutchaine = "LEFT(".$objet.", $posmulti-1)"; |
|
| 1472 | + $finchaine = "RIGHT(".$objet.", CHAR_LENGTH(".$objet.") -(7+$posfinmulti))"; |
|
| 1473 | + $chainemulti = "TRIM(SUBSTRING(".$objet.", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1474 | + $poslang = "INSTR($chainemulti,'[".$lang."]')"; |
|
| 1475 | 1475 | $poslang = "IF($poslang=0,INSTR($chainemulti,']')+1,$poslang+$lengthlang)"; |
| 1476 | - $chainelang = "TRIM(SUBSTRING(" . $objet . ", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1477 | - $posfinlang = "INSTR(" . $chainelang . ", '[')"; |
|
| 1476 | + $chainelang = "TRIM(SUBSTRING(".$objet.", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1477 | + $posfinlang = "INSTR(".$chainelang.", '[')"; |
|
| 1478 | 1478 | $chainelang = "IF($posfinlang>0,LEFT($chainelang,$posfinlang-1),$chainelang)"; |
| 1479 | 1479 | //$chainelang = "LEFT($chainelang,$posfinlang-1)"; |
| 1480 | - $retour = "(TRIM(IF($posmulti = 0 , " . |
|
| 1481 | - " TRIM(" . $objet . "), " . |
|
| 1482 | - " CONCAT( " . |
|
| 1483 | - " $debutchaine, " . |
|
| 1484 | - " IF( " . |
|
| 1485 | - " $poslang = 0, " . |
|
| 1486 | - " $chainemulti, " . |
|
| 1487 | - " $chainelang" . |
|
| 1488 | - " ), " . |
|
| 1489 | - " $finchaine" . |
|
| 1490 | - " ) " . |
|
| 1480 | + $retour = "(TRIM(IF($posmulti = 0 , ". |
|
| 1481 | + " TRIM(".$objet."), ". |
|
| 1482 | + " CONCAT( ". |
|
| 1483 | + " $debutchaine, ". |
|
| 1484 | + " IF( ". |
|
| 1485 | + " $poslang = 0, ". |
|
| 1486 | + " $chainemulti, ". |
|
| 1487 | + " $chainelang". |
|
| 1488 | + " ), ". |
|
| 1489 | + " $finchaine". |
|
| 1490 | + " ) ". |
|
| 1491 | 1491 | "))) AS multi"; |
| 1492 | 1492 | |
| 1493 | 1493 | return $retour; |
@@ -1504,7 +1504,7 @@ discard block |
||
| 1504 | 1504 | * Valeur hexadécimale pour MySQL |
| 1505 | 1505 | **/ |
| 1506 | 1506 | function spip_mysql_hex($v) { |
| 1507 | - return "0x" . $v; |
|
| 1507 | + return "0x".$v; |
|
| 1508 | 1508 | } |
| 1509 | 1509 | |
| 1510 | 1510 | /** |
@@ -1594,7 +1594,7 @@ discard block |
||
| 1594 | 1594 | if (is_numeric($v)) { |
| 1595 | 1595 | return strval($v); |
| 1596 | 1596 | } |
| 1597 | - return "'" . addslashes($v) . "'"; |
|
| 1597 | + return "'".addslashes($v)."'"; |
|
| 1598 | 1598 | } |
| 1599 | 1599 | |
| 1600 | 1600 | if (is_null($v) |
@@ -1616,7 +1616,7 @@ discard block |
||
| 1616 | 1616 | } |
| 1617 | 1617 | } |
| 1618 | 1618 | |
| 1619 | - return ("'" . addslashes($v) . "'"); |
|
| 1619 | + return ("'".addslashes($v)."'"); |
|
| 1620 | 1620 | } |
| 1621 | 1621 | |
| 1622 | 1622 | |
@@ -1645,9 +1645,9 @@ discard block |
||
| 1645 | 1645 | $connexion = &$GLOBALS['connexions'][0]; |
| 1646 | 1646 | $bd = $connexion['db']; |
| 1647 | 1647 | $prefixe = $connexion['prefixe']; |
| 1648 | - $nom = "$bd:$prefixe:$nom" . _LOCK_TIME; |
|
| 1648 | + $nom = "$bd:$prefixe:$nom"._LOCK_TIME; |
|
| 1649 | 1649 | |
| 1650 | - $connexion['last'] = $q = "SELECT GET_LOCK(" . _q($nom) . ", $timeout) AS n"; |
|
| 1650 | + $connexion['last'] = $q = "SELECT GET_LOCK("._q($nom).", $timeout) AS n"; |
|
| 1651 | 1651 | |
| 1652 | 1652 | $q = @sql_fetch(mysqli_query(_mysql_link(), $q)); |
| 1653 | 1653 | if (!$q) { |
@@ -1674,9 +1674,9 @@ discard block |
||
| 1674 | 1674 | $connexion = &$GLOBALS['connexions'][0]; |
| 1675 | 1675 | $bd = $connexion['db']; |
| 1676 | 1676 | $prefixe = $connexion['prefixe']; |
| 1677 | - $nom = "$bd:$prefixe:$nom" . _LOCK_TIME; |
|
| 1677 | + $nom = "$bd:$prefixe:$nom"._LOCK_TIME; |
|
| 1678 | 1678 | |
| 1679 | - $connexion['last'] = $q = "SELECT RELEASE_LOCK(" . _q($nom) . ")"; |
|
| 1679 | + $connexion['last'] = $q = "SELECT RELEASE_LOCK("._q($nom).")"; |
|
| 1680 | 1680 | mysqli_query(_mysql_link(), $q); |
| 1681 | 1681 | } |
| 1682 | 1682 | |
@@ -1712,7 +1712,7 @@ discard block |
||
| 1712 | 1712 | } else { |
| 1713 | 1713 | $GLOBALS['mysql_rappel_nom_base'] = false; |
| 1714 | 1714 | |
| 1715 | - return "\$GLOBALS['mysql_rappel_nom_base'] = false; " . |
|
| 1715 | + return "\$GLOBALS['mysql_rappel_nom_base'] = false; ". |
|
| 1716 | 1716 | "/* echec de test_rappel_nom_base_mysql a l'installation. */\n"; |
| 1717 | 1717 | } |
| 1718 | 1718 | } |
@@ -64,27 +64,27 @@ discard block |
||
| 64 | 64 | // determiner le dossier de la base : $addr ou _DIR_DB |
| 65 | 65 | $f = _DIR_DB; |
| 66 | 66 | if ($addr and strpos($addr, '/') !== false) { |
| 67 | - $f = rtrim($addr, '/') . '/'; |
|
| 67 | + $f = rtrim($addr, '/').'/'; |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | // un nom de base demande et impossible d'obtenir la base, on s'en va : |
| 71 | 71 | // il faut que la base existe ou que le repertoire parent soit writable |
| 72 | - if ($db and !is_file($f .= $db . '.sqlite') and !is_writable(dirname($f))) { |
|
| 73 | - spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.' . _LOG_HS); |
|
| 72 | + if ($db and !is_file($f .= $db.'.sqlite') and !is_writable(dirname($f))) { |
|
| 73 | + spip_log("base $f non trouvee ou droits en ecriture manquants", 'sqlite.'._LOG_HS); |
|
| 74 | 74 | |
| 75 | 75 | return false; |
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | // charger les modules sqlite au besoin |
| 79 | 79 | if (!_sqlite_charger_version($sqlite_version)) { |
| 80 | - spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.' . _LOG_HS); |
|
| 80 | + spip_log("Impossible de trouver/charger le module SQLite ($sqlite_version)!", 'sqlite.'._LOG_HS); |
|
| 81 | 81 | |
| 82 | 82 | return false; |
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | // chargement des constantes |
| 86 | 86 | // il ne faut pas definir les constantes avant d'avoir charge les modules sqlite |
| 87 | - $define = "spip_sqlite" . $sqlite_version . "_constantes"; |
|
| 87 | + $define = "spip_sqlite".$sqlite_version."_constantes"; |
|
| 88 | 88 | $define(); |
| 89 | 89 | |
| 90 | 90 | $ok = false; |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | // si pas de db -> |
| 93 | 93 | // base temporaire tant qu'on ne connait pas son vrai nom |
| 94 | 94 | // pour tester la connexion |
| 95 | - $db = "_sqlite" . $sqlite_version . "_install"; |
|
| 96 | - $tmp = _DIR_DB . $db . ".sqlite"; |
|
| 95 | + $db = "_sqlite".$sqlite_version."_install"; |
|
| 96 | + $tmp = _DIR_DB.$db.".sqlite"; |
|
| 97 | 97 | $ok = $link = new \PDO("sqlite:$tmp"); |
| 98 | 98 | } else { |
| 99 | 99 | // Ouvrir (eventuellement creer la base) |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | if (!$ok) { |
| 104 | 104 | $e = _sqlite_last_error_from_link($link); |
| 105 | - spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.' . _LOG_HS); |
|
| 105 | + spip_log("Impossible d'ouvrir la base SQLite($sqlite_version) $f : $e", 'sqlite.'._LOG_HS); |
|
| 106 | 106 | |
| 107 | 107 | return false; |
| 108 | 108 | } |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | $table = $regs[3]; |
| 189 | 189 | $suite = $regs[4]; |
| 190 | 190 | } else { |
| 191 | - spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.' . _LOG_ERREUR); |
|
| 191 | + spip_log("SQLite : Probleme de ALTER TABLE mal forme dans $query", 'sqlite.'._LOG_ERREUR); |
|
| 192 | 192 | |
| 193 | 193 | return false; |
| 194 | 194 | } |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | $i = 0; |
| 206 | 206 | $ouverte = false; |
| 207 | 207 | while ($do = array_shift($todo)) { |
| 208 | - $todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . "," . $do : $do; |
|
| 208 | + $todo2[$i] = isset($todo2[$i]) ? $todo2[$i].",".$do : $do; |
|
| 209 | 209 | $o = (false !== strpos($do, "(")); |
| 210 | 210 | $f = (false !== strpos($do, ")")); |
| 211 | 211 | if ($o and !$f) { |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | . ')\s*([^\s]*)\s*(.*)?/i', $do, $matches) |
| 230 | 230 | ) { |
| 231 | 231 | spip_log("SQLite : Probleme de ALTER TABLE, utilisation non reconnue dans : $do \n(requete d'origine : $query)", |
| 232 | - 'sqlite.' . _LOG_ERREUR); |
|
| 232 | + 'sqlite.'._LOG_ERREUR); |
|
| 233 | 233 | |
| 234 | 234 | return false; |
| 235 | 235 | } |
@@ -316,10 +316,10 @@ discard block |
||
| 316 | 316 | |
| 317 | 317 | // pas geres en sqlite2 |
| 318 | 318 | case 'RENAME': |
| 319 | - $do = "RENAME TO" . substr($do, 6); |
|
| 319 | + $do = "RENAME TO".substr($do, 6); |
|
| 320 | 320 | case 'RENAME TO': |
| 321 | 321 | if (!spip_sqlite::executer_requete("$debut $do", $serveur)) { |
| 322 | - spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 322 | + spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.'._LOG_ERREUR); |
|
| 323 | 323 | |
| 324 | 324 | return false; |
| 325 | 325 | } |
@@ -375,12 +375,12 @@ discard block |
||
| 375 | 375 | |
| 376 | 376 | // pas geres en sqlite2 |
| 377 | 377 | case 'ADD COLUMN': |
| 378 | - $do = "ADD" . substr($do, 10); |
|
| 378 | + $do = "ADD".substr($do, 10); |
|
| 379 | 379 | case 'ADD': |
| 380 | 380 | default: |
| 381 | 381 | if (!preg_match(',primary\s+key,i', $do)) { |
| 382 | 382 | if (!spip_sqlite::executer_requete("$debut $do", $serveur)) { |
| 383 | - spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 383 | + spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR); |
|
| 384 | 384 | |
| 385 | 385 | return false; |
| 386 | 386 | } |
@@ -401,7 +401,7 @@ discard block |
||
| 401 | 401 | } |
| 402 | 402 | $opts['field'] = array($colonne_ajoutee => $def); |
| 403 | 403 | if (!_sqlite_modifier_table($table, array($colonne_ajoutee), $opts, $serveur)) { |
| 404 | - spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 404 | + spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR); |
|
| 405 | 405 | |
| 406 | 406 | return false; |
| 407 | 407 | } |
@@ -409,10 +409,10 @@ discard block |
||
| 409 | 409 | break; |
| 410 | 410 | } |
| 411 | 411 | // tout est bon, ouf ! |
| 412 | - spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.' . _LOG_INFO); |
|
| 412 | + spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.'._LOG_INFO); |
|
| 413 | 413 | } |
| 414 | 414 | |
| 415 | - spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.' . _LOG_INFO); |
|
| 415 | + spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.'._LOG_INFO); |
|
| 416 | 416 | |
| 417 | 417 | return true; |
| 418 | 418 | } |
@@ -481,9 +481,9 @@ discard block |
||
| 481 | 481 | * @return bool true si la base est créee. |
| 482 | 482 | **/ |
| 483 | 483 | function spip_sqlite_create_base($nom, $serveur = '', $option = true) { |
| 484 | - $f = $nom . '.sqlite'; |
|
| 484 | + $f = $nom.'.sqlite'; |
|
| 485 | 485 | if (strpos($nom, "/") === false) { |
| 486 | - $f = _DIR_DB . $f; |
|
| 486 | + $f = _DIR_DB.$f; |
|
| 487 | 487 | } |
| 488 | 488 | |
| 489 | 489 | $ok = new \PDO("sqlite:$f"); |
@@ -522,12 +522,12 @@ discard block |
||
| 522 | 522 | // vue deja presente |
| 523 | 523 | if (sql_showtable($nom, false, $serveur)) { |
| 524 | 524 | spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", |
| 525 | - 'sqlite.' . _LOG_ERREUR); |
|
| 525 | + 'sqlite.'._LOG_ERREUR); |
|
| 526 | 526 | |
| 527 | 527 | return false; |
| 528 | 528 | } |
| 529 | 529 | |
| 530 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 530 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 531 | 531 | |
| 532 | 532 | return spip_sqlite_query($query, $serveur, $requeter); |
| 533 | 533 | } |
@@ -552,15 +552,15 @@ discard block |
||
| 552 | 552 | */ |
| 553 | 553 | function spip_sqlite_create_index($nom, $table, $champs, $unique = '', $serveur = '', $requeter = true) { |
| 554 | 554 | if (!($nom or $table or $champs)) { |
| 555 | - spip_log("Champ manquant pour creer un index sqlite ($nom, $table, (" . join(',', $champs) . "))", |
|
| 556 | - 'sqlite.' . _LOG_ERREUR); |
|
| 555 | + spip_log("Champ manquant pour creer un index sqlite ($nom, $table, (".join(',', $champs)."))", |
|
| 556 | + 'sqlite.'._LOG_ERREUR); |
|
| 557 | 557 | |
| 558 | 558 | return false; |
| 559 | 559 | } |
| 560 | 560 | |
| 561 | 561 | // SQLite ne differentie pas noms des index en fonction des tables |
| 562 | 562 | // il faut donc creer des noms uniques d'index pour une base sqlite |
| 563 | - $nom = $table . '_' . $nom; |
|
| 563 | + $nom = $table.'_'.$nom; |
|
| 564 | 564 | // enlever d'eventuelles parentheses deja presentes sur champs |
| 565 | 565 | if (!is_array($champs)) { |
| 566 | 566 | if ($champs[0] == "(") { |
@@ -582,12 +582,12 @@ discard block |
||
| 582 | 582 | } else { |
| 583 | 583 | /* simuler le IF EXISTS - version 2 et sqlite < 3.3a */ |
| 584 | 584 | $a = spip_sqlite_showtable($table, $serveur); |
| 585 | - if (isset($a['key']['KEY ' . $nom])) { |
|
| 585 | + if (isset($a['key']['KEY '.$nom])) { |
|
| 586 | 586 | return true; |
| 587 | 587 | } |
| 588 | 588 | } |
| 589 | 589 | |
| 590 | - $query = "CREATE " . ($unique ? "UNIQUE " : "") . "INDEX$ifnotexists $nom ON $table (" . join(',', $champs) . ")"; |
|
| 590 | + $query = "CREATE ".($unique ? "UNIQUE " : "")."INDEX$ifnotexists $nom ON $table (".join(',', $champs).")"; |
|
| 591 | 591 | $res = spip_sqlite_query($query, $serveur, $requeter); |
| 592 | 592 | if (!$requeter) { |
| 593 | 593 | return $res; |
@@ -663,7 +663,7 @@ discard block |
||
| 663 | 663 | $serveur = '', |
| 664 | 664 | $requeter = true |
| 665 | 665 | ) { |
| 666 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 666 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 667 | 667 | $r = spip_sqlite_select("COUNT($c)", $from, $where, '', '', '', |
| 668 | 668 | $having, $serveur, $requeter); |
| 669 | 669 | if ((is_resource($r) or is_object($r)) && $requeter) { // ressource : sqlite2, object : sqlite3 |
@@ -761,14 +761,14 @@ discard block |
||
| 761 | 761 | */ |
| 762 | 762 | function spip_sqlite_drop_index($nom, $table, $serveur = '', $requeter = true) { |
| 763 | 763 | if (!($nom or $table)) { |
| 764 | - spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.' . _LOG_ERREUR); |
|
| 764 | + spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.'._LOG_ERREUR); |
|
| 765 | 765 | |
| 766 | 766 | return false; |
| 767 | 767 | } |
| 768 | 768 | |
| 769 | 769 | // SQLite ne differentie pas noms des index en fonction des tables |
| 770 | 770 | // il faut donc creer des noms uniques d'index pour une base sqlite |
| 771 | - $index = $table . '_' . $nom; |
|
| 771 | + $index = $table.'_'.$nom; |
|
| 772 | 772 | $exist = " IF EXISTS"; |
| 773 | 773 | |
| 774 | 774 | $query = "DROP INDEX$exist $index"; |
@@ -800,7 +800,7 @@ discard block |
||
| 800 | 800 | if ($s) { |
| 801 | 801 | $trace = debug_backtrace(); |
| 802 | 802 | if ($trace[0]['function'] != "spip_sqlite_error") { |
| 803 | - spip_log("$s - $query - " . sql_error_backtrace(), 'sqlite.' . _LOG_ERREUR); |
|
| 803 | + spip_log("$s - $query - ".sql_error_backtrace(), 'sqlite.'._LOG_ERREUR); |
|
| 804 | 804 | } |
| 805 | 805 | } |
| 806 | 806 | |
@@ -847,14 +847,14 @@ discard block |
||
| 847 | 847 | $t = $link->errorInfo(); |
| 848 | 848 | $s = ltrim($t[0], '0'); // 00000 si pas d'erreur |
| 849 | 849 | if ($s) { |
| 850 | - $s .= ' / ' . $t[1]; |
|
| 850 | + $s .= ' / '.$t[1]; |
|
| 851 | 851 | } // ajoute l'erreur du moteur SQLite |
| 852 | 852 | } else { |
| 853 | 853 | $s = ": aucune ressource sqlite (link)"; |
| 854 | 854 | } |
| 855 | 855 | |
| 856 | 856 | if ($s) { |
| 857 | - spip_log("Erreur sqlite $s", 'sqlite.' . _LOG_ERREUR); |
|
| 857 | + spip_log("Erreur sqlite $s", 'sqlite.'._LOG_ERREUR); |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | return $s ? $s : 0; |
@@ -878,7 +878,7 @@ discard block |
||
| 878 | 878 | } |
| 879 | 879 | |
| 880 | 880 | $query = spip_sqlite::traduire_requete($query, $serveur); |
| 881 | - $query = 'EXPLAIN ' . $query; |
|
| 881 | + $query = 'EXPLAIN '.$query; |
|
| 882 | 882 | if (!$requeter) { |
| 883 | 883 | return $query; |
| 884 | 884 | } |
@@ -1038,7 +1038,7 @@ discard block |
||
| 1038 | 1038 | **/ |
| 1039 | 1039 | function spip_sqlite_insert($table, $champs, $valeurs, $desc = array(), $serveur = '', $requeter = true) { |
| 1040 | 1040 | |
| 1041 | - $query = "INSERT INTO $table " . ($champs ? "$champs VALUES $valeurs" : "DEFAULT VALUES"); |
|
| 1041 | + $query = "INSERT INTO $table ".($champs ? "$champs VALUES $valeurs" : "DEFAULT VALUES"); |
|
| 1042 | 1042 | if ($r = spip_sqlite_query($query, $serveur, $requeter)) { |
| 1043 | 1043 | if (!$requeter) { |
| 1044 | 1044 | return $r; |
@@ -1094,8 +1094,8 @@ discard block |
||
| 1094 | 1094 | |
| 1095 | 1095 | $cles = $valeurs = ""; |
| 1096 | 1096 | if (count($couples)) { |
| 1097 | - $cles = "(" . join(',', array_keys($couples)) . ")"; |
|
| 1098 | - $valeurs = "(" . join(',', $couples) . ")"; |
|
| 1097 | + $cles = "(".join(',', array_keys($couples)).")"; |
|
| 1098 | + $valeurs = "(".join(',', $couples).")"; |
|
| 1099 | 1099 | } |
| 1100 | 1100 | |
| 1101 | 1101 | return spip_sqlite_insert($table, $cles, $valeurs, $desc, $serveur, $requeter); |
@@ -1155,11 +1155,11 @@ discard block |
||
| 1155 | 1155 | |
| 1156 | 1156 | $champs = $valeurs = ""; |
| 1157 | 1157 | if (count($couples)) { |
| 1158 | - $champs = "(" . join(',', array_keys($couples)) . ")"; |
|
| 1159 | - $valeurs = "(" . join(',', $couples) . ")"; |
|
| 1160 | - $query = $query_start . "$champs VALUES $valeurs"; |
|
| 1158 | + $champs = "(".join(',', array_keys($couples)).")"; |
|
| 1159 | + $valeurs = "(".join(',', $couples).")"; |
|
| 1160 | + $query = $query_start."$champs VALUES $valeurs"; |
|
| 1161 | 1161 | } else { |
| 1162 | - $query = $query_start . "DEFAULT VALUES"; |
|
| 1162 | + $query = $query_start."DEFAULT VALUES"; |
|
| 1163 | 1163 | } |
| 1164 | 1164 | |
| 1165 | 1165 | if ($requeter) { |
@@ -1291,7 +1291,7 @@ discard block |
||
| 1291 | 1291 | * @return string Texte de sélection pour la requête |
| 1292 | 1292 | */ |
| 1293 | 1293 | function spip_sqlite_multi($objet, $lang) { |
| 1294 | - $r = "EXTRAIRE_MULTI(" . $objet . ", '" . $lang . "') AS multi"; |
|
| 1294 | + $r = "EXTRAIRE_MULTI(".$objet.", '".$lang."') AS multi"; |
|
| 1295 | 1295 | |
| 1296 | 1296 | return $r; |
| 1297 | 1297 | } |
@@ -1362,7 +1362,7 @@ discard block |
||
| 1362 | 1362 | function spip_sqlite_date_proche($champ, $interval, $unite) { |
| 1363 | 1363 | $op = (($interval <= 0) ? '>' : '<'); |
| 1364 | 1364 | |
| 1365 | - return "($champ $op datetime('" . date("Y-m-d H:i:s") . "', '$interval $unite'))"; |
|
| 1365 | + return "($champ $op datetime('".date("Y-m-d H:i:s")."', '$interval $unite'))"; |
|
| 1366 | 1366 | } |
| 1367 | 1367 | |
| 1368 | 1368 | |
@@ -1392,7 +1392,7 @@ discard block |
||
| 1392 | 1392 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1393 | 1393 | ) { |
| 1394 | 1394 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT ''", $serveur); |
| 1395 | - spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE); |
|
| 1395 | + spip_log("ALTER $q", "repair"._LOG_INFO_IMPORTANTE); |
|
| 1396 | 1396 | } |
| 1397 | 1397 | if (preg_match(",^(INTEGER),i", $d) |
| 1398 | 1398 | and stripos($d, "NOT NULL") !== false |
@@ -1401,7 +1401,7 @@ discard block |
||
| 1401 | 1401 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1402 | 1402 | ) { |
| 1403 | 1403 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0'", $serveur); |
| 1404 | - spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE); |
|
| 1404 | + spip_log("ALTER $q", "repair"._LOG_INFO_IMPORTANTE); |
|
| 1405 | 1405 | } |
| 1406 | 1406 | if (preg_match(",^(datetime),i", $d) |
| 1407 | 1407 | and stripos($d, "NOT NULL") !== false |
@@ -1410,7 +1410,7 @@ discard block |
||
| 1410 | 1410 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1411 | 1411 | ) { |
| 1412 | 1412 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0000-00-00 00:00:00'", $serveur); |
| 1413 | - spip_log("ALTER $q", "repair" . _LOG_INFO_IMPORTANTE); |
|
| 1413 | + spip_log("ALTER $q", "repair"._LOG_INFO_IMPORTANTE); |
|
| 1414 | 1414 | } |
| 1415 | 1415 | } |
| 1416 | 1416 | |
@@ -1461,8 +1461,8 @@ discard block |
||
| 1461 | 1461 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
| 1462 | 1462 | $couples = _sqlite_ajouter_champs_timestamp($table, $couples, $desc, $serveur); |
| 1463 | 1463 | |
| 1464 | - return spip_sqlite_query("REPLACE INTO $table (" . join(',', array_keys($couples)) . ') VALUES (' . join(',', |
|
| 1465 | - $couples) . ')', $serveur); |
|
| 1464 | + return spip_sqlite_query("REPLACE INTO $table (".join(',', array_keys($couples)).') VALUES ('.join(',', |
|
| 1465 | + $couples).')', $serveur); |
|
| 1466 | 1466 | } |
| 1467 | 1467 | |
| 1468 | 1468 | |
@@ -1548,7 +1548,7 @@ discard block |
||
| 1548 | 1548 | . _sqlite_calculer_expression('WHERE', $where) |
| 1549 | 1549 | . _sqlite_calculer_expression('GROUP BY', $groupby, ',') |
| 1550 | 1550 | . _sqlite_calculer_expression('HAVING', $having) |
| 1551 | - . ($orderby ? ("\nORDER BY " . _sqlite_calculer_order($orderby)) : '') |
|
| 1551 | + . ($orderby ? ("\nORDER BY "._sqlite_calculer_order($orderby)) : '') |
|
| 1552 | 1552 | . ($limit ? "\nLIMIT $limit" : ''); |
| 1553 | 1553 | |
| 1554 | 1554 | // dans un select, on doit renvoyer la requête en cas d'erreur |
@@ -1585,10 +1585,10 @@ discard block |
||
| 1585 | 1585 | |
| 1586 | 1586 | // interdire la creation d'une nouvelle base, |
| 1587 | 1587 | // sauf si on est dans l'installation |
| 1588 | - if (!is_file($f = _DIR_DB . $db . '.sqlite') |
|
| 1588 | + if (!is_file($f = _DIR_DB.$db.'.sqlite') |
|
| 1589 | 1589 | && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL) |
| 1590 | 1590 | ) { |
| 1591 | - spip_log("Il est interdit de creer la base $db", 'sqlite.' . _LOG_HS); |
|
| 1591 | + spip_log("Il est interdit de creer la base $db", 'sqlite.'._LOG_HS); |
|
| 1592 | 1592 | |
| 1593 | 1593 | return false; |
| 1594 | 1594 | } |
@@ -1597,12 +1597,12 @@ discard block |
||
| 1597 | 1597 | // avec les identifiants connus |
| 1598 | 1598 | $index = $serveur ? $serveur : 0; |
| 1599 | 1599 | |
| 1600 | - if ($link = spip_connect_db('', '', '', '', '@selectdb@' . $db, $serveur, '', '')) { |
|
| 1600 | + if ($link = spip_connect_db('', '', '', '', '@selectdb@'.$db, $serveur, '', '')) { |
|
| 1601 | 1601 | if (($db == $link['db']) && $GLOBALS['connexions'][$index] = $link) { |
| 1602 | 1602 | return $db; |
| 1603 | 1603 | } |
| 1604 | 1604 | } else { |
| 1605 | - spip_log("Impossible de selectionner la base $db", 'sqlite.' . _LOG_HS); |
|
| 1605 | + spip_log("Impossible de selectionner la base $db", 'sqlite.'._LOG_HS); |
|
| 1606 | 1606 | |
| 1607 | 1607 | return false; |
| 1608 | 1608 | } |
@@ -1653,7 +1653,7 @@ discard block |
||
| 1653 | 1653 | $match = str_replace("[[POURCENT]]", "%", $match); |
| 1654 | 1654 | $match = "^$match$"; |
| 1655 | 1655 | |
| 1656 | - return spip_sqlite_query("SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP " . _q($match), |
|
| 1656 | + return spip_sqlite_query("SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP "._q($match), |
|
| 1657 | 1657 | $serveur, $requeter); |
| 1658 | 1658 | } |
| 1659 | 1659 | |
@@ -1741,7 +1741,7 @@ discard block |
||
| 1741 | 1741 | |
| 1742 | 1742 | # rustine pour DECIMAL(10,2) |
| 1743 | 1743 | if (false !== strpos($k, ')')) { |
| 1744 | - $fields[$k_precedent] .= ',' . $k . ' ' . $def; |
|
| 1744 | + $fields[$k_precedent] .= ','.$k.' '.$def; |
|
| 1745 | 1745 | continue; |
| 1746 | 1746 | } |
| 1747 | 1747 | |
@@ -1776,13 +1776,13 @@ discard block |
||
| 1776 | 1776 | . 'ORDER BY substr(type,2,1), name'; |
| 1777 | 1777 | $a = spip_sqlite_query($query, $serveur, $requeter); |
| 1778 | 1778 | while ($r = spip_sqlite_fetch($a, null, $serveur)) { |
| 1779 | - $key = str_replace($nom_table . '_', '', $r['name']); // enlever le nom de la table ajoute a l'index |
|
| 1779 | + $key = str_replace($nom_table.'_', '', $r['name']); // enlever le nom de la table ajoute a l'index |
|
| 1780 | 1780 | $keytype = "KEY"; |
| 1781 | 1781 | if (strpos($r['sql'], "UNIQUE INDEX") !== false) { |
| 1782 | 1782 | $keytype = "UNIQUE KEY"; |
| 1783 | 1783 | } |
| 1784 | 1784 | $colonnes = preg_replace(',.*\((.*)\).*,', '$1', $r['sql']); |
| 1785 | - $keys[$keytype . ' ' . $key] = $colonnes; |
|
| 1785 | + $keys[$keytype.' '.$key] = $colonnes; |
|
| 1786 | 1786 | } |
| 1787 | 1787 | } |
| 1788 | 1788 | |
@@ -1831,7 +1831,7 @@ discard block |
||
| 1831 | 1831 | |
| 1832 | 1832 | $set = array(); |
| 1833 | 1833 | foreach ($champs as $champ => $val) { |
| 1834 | - $set[] = $champ . "=$val"; |
|
| 1834 | + $set[] = $champ."=$val"; |
|
| 1835 | 1835 | } |
| 1836 | 1836 | if (!empty($set)) { |
| 1837 | 1837 | return spip_sqlite_query( |
@@ -1885,7 +1885,7 @@ discard block |
||
| 1885 | 1885 | |
| 1886 | 1886 | $set = array(); |
| 1887 | 1887 | foreach ($champs as $champ => $val) { |
| 1888 | - $set[] = $champ . '=' . _sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : ''); |
|
| 1888 | + $set[] = $champ.'='._sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : ''); |
|
| 1889 | 1889 | } |
| 1890 | 1890 | |
| 1891 | 1891 | return spip_sqlite_query( |
@@ -1911,7 +1911,7 @@ discard block |
||
| 1911 | 1911 | */ |
| 1912 | 1912 | function _sqlite_init() { |
| 1913 | 1913 | if (!defined('_DIR_DB')) { |
| 1914 | - define('_DIR_DB', _DIR_ETC . 'bases/'); |
|
| 1914 | + define('_DIR_DB', _DIR_ETC.'bases/'); |
|
| 1915 | 1915 | } |
| 1916 | 1916 | if (!defined('_SQLITE_CHMOD')) { |
| 1917 | 1917 | define('_SQLITE_CHMOD', _SPIP_CHMOD); |
@@ -2014,9 +2014,9 @@ discard block |
||
| 2014 | 2014 | } |
| 2015 | 2015 | |
| 2016 | 2016 | // echapper les ' en '' |
| 2017 | - spip_log("Pas de methode ->quote pour echapper", "sqlite." . _LOG_INFO_IMPORTANTE); |
|
| 2017 | + spip_log("Pas de methode ->quote pour echapper", "sqlite."._LOG_INFO_IMPORTANTE); |
|
| 2018 | 2018 | |
| 2019 | - return ("'" . str_replace("'", "''", $v) . "'"); |
|
| 2019 | + return ("'".str_replace("'", "''", $v)."'"); |
|
| 2020 | 2020 | } |
| 2021 | 2021 | |
| 2022 | 2022 | |
@@ -2039,12 +2039,12 @@ discard block |
||
| 2039 | 2039 | $exp = "\n$expression "; |
| 2040 | 2040 | |
| 2041 | 2041 | if (!is_array($v)) { |
| 2042 | - return $exp . $v; |
|
| 2042 | + return $exp.$v; |
|
| 2043 | 2043 | } else { |
| 2044 | 2044 | if (strtoupper($join) === 'AND') { |
| 2045 | - return $exp . join("\n\t$join ", array_map('_sqlite_calculer_where', $v)); |
|
| 2045 | + return $exp.join("\n\t$join ", array_map('_sqlite_calculer_where', $v)); |
|
| 2046 | 2046 | } else { |
| 2047 | - return $exp . join($join, $v); |
|
| 2047 | + return $exp.join($join, $v); |
|
| 2048 | 2048 | } |
| 2049 | 2049 | } |
| 2050 | 2050 | } |
@@ -2078,17 +2078,17 @@ discard block |
||
| 2078 | 2078 | if (substr($k, -1) == '@') { |
| 2079 | 2079 | // c'est une jointure qui se refere au from precedent |
| 2080 | 2080 | // pas de virgule |
| 2081 | - $res .= ' ' . $v; |
|
| 2081 | + $res .= ' '.$v; |
|
| 2082 | 2082 | } else { |
| 2083 | 2083 | if (!is_numeric($k)) { |
| 2084 | 2084 | $p = strpos($v, " "); |
| 2085 | 2085 | if ($p) { |
| 2086 | - $v = substr($v, 0, $p) . " AS '$k'" . substr($v, $p); |
|
| 2086 | + $v = substr($v, 0, $p)." AS '$k'".substr($v, $p); |
|
| 2087 | 2087 | } else { |
| 2088 | 2088 | $v .= " AS '$k'"; |
| 2089 | 2089 | } |
| 2090 | 2090 | } |
| 2091 | - $res .= ', ' . $v; |
|
| 2091 | + $res .= ', '.$v; |
|
| 2092 | 2092 | } |
| 2093 | 2093 | } |
| 2094 | 2094 | |
@@ -2226,13 +2226,13 @@ discard block |
||
| 2226 | 2226 | |
| 2227 | 2227 | $def_origine = sql_showtable($table_origine, false, $serveur); |
| 2228 | 2228 | if (!$def_origine or !isset($def_origine['field'])) { |
| 2229 | - spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite' . _LOG_ERREUR); |
|
| 2229 | + spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite'._LOG_ERREUR); |
|
| 2230 | 2230 | |
| 2231 | 2231 | return false; |
| 2232 | 2232 | } |
| 2233 | 2233 | |
| 2234 | 2234 | |
| 2235 | - $table_tmp = $table_origine . '_tmp'; |
|
| 2235 | + $table_tmp = $table_origine.'_tmp'; |
|
| 2236 | 2236 | |
| 2237 | 2237 | // 1) creer une table temporaire avec les modifications |
| 2238 | 2238 | // - DROP : suppression de la colonne |
@@ -2318,7 +2318,7 @@ discard block |
||
| 2318 | 2318 | } else { |
| 2319 | 2319 | // enlever KEY |
| 2320 | 2320 | $k = substr($k, 4); |
| 2321 | - $queries[] = "CREATE INDEX $table_destination" . "_$k ON $table_destination ($v)"; |
|
| 2321 | + $queries[] = "CREATE INDEX $table_destination"."_$k ON $table_destination ($v)"; |
|
| 2322 | 2322 | } |
| 2323 | 2323 | } |
| 2324 | 2324 | |
@@ -2418,26 +2418,26 @@ discard block |
||
| 2418 | 2418 | $enum = "(\s*\([^\)]*\))?"; |
| 2419 | 2419 | |
| 2420 | 2420 | $remplace = array( |
| 2421 | - '/enum' . $enum . '/is' => 'VARCHAR(255)', |
|
| 2421 | + '/enum'.$enum.'/is' => 'VARCHAR(255)', |
|
| 2422 | 2422 | '/COLLATE \w+_bin/is' => 'COLLATE BINARY', |
| 2423 | 2423 | '/COLLATE \w+_ci/is' => 'COLLATE NOCASE', |
| 2424 | 2424 | '/auto_increment/is' => '', |
| 2425 | 2425 | '/(timestamp .* )ON .*$/is' => '\\1', |
| 2426 | 2426 | '/character set \w+/is' => '', |
| 2427 | - '/((big|small|medium|tiny)?int(eger)?)' . $num . '\s*unsigned/is' => '\\1 UNSIGNED', |
|
| 2427 | + '/((big|small|medium|tiny)?int(eger)?)'.$num.'\s*unsigned/is' => '\\1 UNSIGNED', |
|
| 2428 | 2428 | '/(text\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
| 2429 | - '/((char|varchar)' . $num . '\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
|
| 2429 | + '/((char|varchar)'.$num.'\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
|
| 2430 | 2430 | '/(datetime\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00 00:00:00'", |
| 2431 | 2431 | '/(date\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00'", |
| 2432 | 2432 | ); |
| 2433 | 2433 | |
| 2434 | 2434 | // pour l'autoincrement, il faut des INTEGER NOT NULL PRIMARY KEY |
| 2435 | 2435 | $remplace_autocinc = array( |
| 2436 | - '/(big|small|medium|tiny)?int(eger)?' . $num . '/is' => 'INTEGER' |
|
| 2436 | + '/(big|small|medium|tiny)?int(eger)?'.$num.'/is' => 'INTEGER' |
|
| 2437 | 2437 | ); |
| 2438 | 2438 | // pour les int non autoincrement, il faut un DEFAULT |
| 2439 | 2439 | $remplace_nonautocinc = array( |
| 2440 | - '/((big|small|medium|tiny)?int(eger)?' . $num . '\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0", |
|
| 2440 | + '/((big|small|medium|tiny)?int(eger)?'.$num.'\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0", |
|
| 2441 | 2441 | ); |
| 2442 | 2442 | |
| 2443 | 2443 | if (is_string($query)) { |
@@ -2479,7 +2479,7 @@ discard block |
||
| 2479 | 2479 | return str_ireplace("BINARY", "COLLATE BINARY", $champ); |
| 2480 | 2480 | } |
| 2481 | 2481 | if (preg_match(",^(char|varchar|(long|small|medium|tiny)?text),i", $champ)) { |
| 2482 | - return $champ . " COLLATE NOCASE"; |
|
| 2482 | + return $champ." COLLATE NOCASE"; |
|
| 2483 | 2483 | } |
| 2484 | 2484 | |
| 2485 | 2485 | return $champ; |
@@ -2566,7 +2566,7 @@ discard block |
||
| 2566 | 2566 | } else { |
| 2567 | 2567 | /* simuler le IF EXISTS - version 2 et sqlite < 3.3a */ |
| 2568 | 2568 | $a = spip_sqlite_showtable($nom, $serveur); |
| 2569 | - if (isset($a['key']['KEY ' . $nom])) { |
|
| 2569 | + if (isset($a['key']['KEY '.$nom])) { |
|
| 2570 | 2570 | return true; |
| 2571 | 2571 | } |
| 2572 | 2572 | } |
@@ -2574,7 +2574,7 @@ discard block |
||
| 2574 | 2574 | } |
| 2575 | 2575 | |
| 2576 | 2576 | $temporary = $temporary ? ' TEMPORARY' : ''; |
| 2577 | - $q = "CREATE$temporary TABLE$ifnotexists $nom ($query" . ($keys ? ",$keys" : '') . ")\n"; |
|
| 2577 | + $q = "CREATE$temporary TABLE$ifnotexists $nom ($query".($keys ? ",$keys" : '').")\n"; |
|
| 2578 | 2578 | |
| 2579 | 2579 | return $q; |
| 2580 | 2580 | } |
@@ -2787,7 +2787,7 @@ discard block |
||
| 2787 | 2787 | $this->serveur = strtolower($serveur); |
| 2788 | 2788 | |
| 2789 | 2789 | if (!($this->link = _sqlite_link($this->serveur)) && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL)) { |
| 2790 | - spip_log("Aucune connexion sqlite (link)", 'sqlite.' . _LOG_ERREUR); |
|
| 2790 | + spip_log("Aucune connexion sqlite (link)", 'sqlite.'._LOG_ERREUR); |
|
| 2791 | 2791 | |
| 2792 | 2792 | return false; |
| 2793 | 2793 | } |
@@ -2848,8 +2848,8 @@ discard block |
||
| 2848 | 2848 | |
| 2849 | 2849 | // loger les warnings/erreurs eventuels de sqlite remontant dans PHP |
| 2850 | 2850 | if ($err = (function_exists('error_get_last') ? error_get_last() : "") and $err != $e) { |
| 2851 | - $err = strip_tags($err['message']) . " in " . $err['file'] . " line " . $err['line']; |
|
| 2852 | - spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR); |
|
| 2851 | + $err = strip_tags($err['message'])." in ".$err['file']." line ".$err['line']; |
|
| 2852 | + spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR); |
|
| 2853 | 2853 | } else { |
| 2854 | 2854 | $err = ""; |
| 2855 | 2855 | } |
@@ -2928,15 +2928,15 @@ discard block |
||
| 2928 | 2928 | // Correction Create Database |
| 2929 | 2929 | // Create Database -> requete ignoree |
| 2930 | 2930 | if (strpos($this->query, 'CREATE DATABASE') === 0) { |
| 2931 | - spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.' . _LOG_AVERTISSEMENT); |
|
| 2931 | + spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.'._LOG_AVERTISSEMENT); |
|
| 2932 | 2932 | $this->query = "SELECT 1"; |
| 2933 | 2933 | } |
| 2934 | 2934 | |
| 2935 | 2935 | // Correction Insert Ignore |
| 2936 | 2936 | // INSERT IGNORE -> insert (tout court et pas 'insert or replace') |
| 2937 | 2937 | if (strpos($this->query, 'INSERT IGNORE') === 0) { |
| 2938 | - spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.' . _LOG_DEBUG); |
|
| 2939 | - $this->query = 'INSERT ' . substr($this->query, '13'); |
|
| 2938 | + spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.'._LOG_DEBUG); |
|
| 2939 | + $this->query = 'INSERT '.substr($this->query, '13'); |
|
| 2940 | 2940 | } |
| 2941 | 2941 | |
| 2942 | 2942 | // Correction des dates avec INTERVAL |
@@ -2961,7 +2961,7 @@ discard block |
||
| 2961 | 2961 | // problematique car la jointure ne se fait pas du coup. |
| 2962 | 2962 | if (($this->sqlite_version == 2) && (strpos($this->query, "USING") !== false)) { |
| 2963 | 2963 | spip_log("'USING (champ)' n'est pas reconnu en SQLite 2. Utilisez 'ON table1.champ = table2.champ'", |
| 2964 | - 'sqlite.' . _LOG_ERREUR); |
|
| 2964 | + 'sqlite.'._LOG_ERREUR); |
|
| 2965 | 2965 | $this->query = preg_replace('/USING\s*\([^\)]*\)/', '', $this->query); |
| 2966 | 2966 | } |
| 2967 | 2967 | |
@@ -2981,8 +2981,8 @@ discard block |
||
| 2981 | 2981 | } else { |
| 2982 | 2982 | $suite = ''; |
| 2983 | 2983 | } |
| 2984 | - $pref = ($this->prefixe) ? $this->prefixe . "_" : ""; |
|
| 2985 | - $this->query = preg_replace('/([,\s])spip_/S', '\1' . $pref, $this->query) . $suite; |
|
| 2984 | + $pref = ($this->prefixe) ? $this->prefixe."_" : ""; |
|
| 2985 | + $this->query = preg_replace('/([,\s])spip_/S', '\1'.$pref, $this->query).$suite; |
|
| 2986 | 2986 | |
| 2987 | 2987 | // Correction zero AS x |
| 2988 | 2988 | // pg n'aime pas 0+x AS alias, sqlite, dans le meme style, |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | |
| 54 | 54 | if ($compil_info) { |
| 55 | 55 | $contexte_compil = array( |
| 56 | - $trace[0]['file'],// sourcefile |
|
| 56 | + $trace[0]['file'], // sourcefile |
|
| 57 | 57 | '', //nom |
| 58 | - (isset($trace[1]) ? $trace[1]['function'] . "(){\n" : '') |
|
| 59 | - . $trace[0]['function'] . "();" |
|
| 58 | + (isset($trace[1]) ? $trace[1]['function']."(){\n" : '') |
|
| 59 | + . $trace[0]['function']."();" |
|
| 60 | 60 | . (isset($trace[1]) ? "\n}" : ''), //id_boucle |
| 61 | 61 | $trace[0]['line'], // ligne |
| 62 | 62 | $GLOBALS['spip_lang'], // lang |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | return $contexte_compil; |
| 66 | 66 | } |
| 67 | 67 | |
| 68 | - $message = count($trace) ? $trace[0]['file'] . " L" . $trace[0]['line'] : ""; |
|
| 68 | + $message = count($trace) ? $trace[0]['file']." L".$trace[0]['line'] : ""; |
|
| 69 | 69 | $f = array(); |
| 70 | 70 | while (count($trace) and $t = array_shift($trace)) { |
| 71 | 71 | if (in_array($t['function'], array('include_once', 'include_spip', 'find_in_path'))) { |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | $f[] = $t['function']; |
| 75 | 75 | } |
| 76 | 76 | if (count($f)) { |
| 77 | - $message .= " [" . implode("(),", $f) . "()]"; |
|
| 77 | + $message .= " [".implode("(),", $f)."()]"; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | return $message; |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | } |
| 256 | 256 | // le debug, c'est pour ce qui a ete produit par le compilateur |
| 257 | 257 | if (isset($GLOBALS['debug']['aucasou'])) { |
| 258 | - list($table, $id, ) = $GLOBALS['debug']['aucasou']; |
|
| 259 | - $nom = $GLOBALS['debug_objets']['courant'] . $id; |
|
| 258 | + list($table, $id,) = $GLOBALS['debug']['aucasou']; |
|
| 259 | + $nom = $GLOBALS['debug_objets']['courant'].$id; |
|
| 260 | 260 | $GLOBALS['debug_objets']['requete'][$nom] = $query; |
| 261 | 261 | } |
| 262 | 262 | $res = $f($select, $from, $where, $groupby, $orderby, $limit, $having, $serveur, true); |
@@ -1133,7 +1133,7 @@ discard block |
||
| 1133 | 1133 | // la globale n'est remplie qu'apres l'appel de sql_serveur. |
| 1134 | 1134 | if ($spip == null) { |
| 1135 | 1135 | $connexion = $GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 1136 | - $spip = $connexion['prefixe'] . '\_%'; |
|
| 1136 | + $spip = $connexion['prefixe'].'\_%'; |
|
| 1137 | 1137 | } |
| 1138 | 1138 | |
| 1139 | 1139 | return $f($spip, $serveur, $option !== false); |
@@ -2016,7 +2016,7 @@ discard block |
||
| 2016 | 2016 | **/ |
| 2017 | 2017 | function sql_in($val, $valeurs, $not = '', $serveur = '', $option = true) { |
| 2018 | 2018 | if (is_string($valeurs)) { |
| 2019 | - if(isset($valeurs[0]) and $valeurs[0] === ',') { |
|
| 2019 | + if (isset($valeurs[0]) and $valeurs[0] === ',') { |
|
| 2020 | 2020 | $valeurs = substr($valeurs, 1); |
| 2021 | 2021 | } |
| 2022 | 2022 | // on explode en tableau pour pouvoir securiser le contenu |
@@ -2220,9 +2220,9 @@ discard block |
||
| 2220 | 2220 | $jour = 0; |
| 2221 | 2221 | } |
| 2222 | 2222 | |
| 2223 | - return sprintf("%04u", $annee) . '-' . sprintf("%02u", $mois) . '-' |
|
| 2224 | - . sprintf("%02u", $jour) . ' ' . sprintf("%02u", $h) . ':' |
|
| 2225 | - . sprintf("%02u", $m) . ':' . sprintf("%02u", $s); |
|
| 2223 | + return sprintf("%04u", $annee).'-'.sprintf("%02u", $mois).'-' |
|
| 2224 | + . sprintf("%02u", $jour).' '.sprintf("%02u", $h).':' |
|
| 2225 | + . sprintf("%02u", $m).':'.sprintf("%02u", $s); |
|
| 2226 | 2226 | } |
| 2227 | 2227 | |
| 2228 | 2228 | |
@@ -2284,7 +2284,7 @@ discard block |
||
| 2284 | 2284 | */ |
| 2285 | 2285 | function prefixer_table_spip($table, $prefixe) { |
| 2286 | 2286 | if ($prefixe) { |
| 2287 | - $table = preg_replace('/^spip_/', $prefixe . '_', $table); |
|
| 2287 | + $table = preg_replace('/^spip_/', $prefixe.'_', $table); |
|
| 2288 | 2288 | } |
| 2289 | 2289 | return $table; |
| 2290 | 2290 | } |
| 2291 | 2291 | \ No newline at end of file |