@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | $l = ''; |
| 54 | 54 | if ( |
| 55 | 55 | $primary = id_table_objet($objet) |
| 56 | - and $trouver_table($l = $table_sql . '_liens', '', true, ['log_missing' => false]) |
|
| 56 | + and $trouver_table($l = $table_sql.'_liens', '', true, ['log_missing' => false]) |
|
| 57 | 57 | and !preg_match(',[^\w],', $primary) |
| 58 | 58 | and !preg_match(',[^\w],', $l) |
| 59 | 59 | ) { |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * @return int |
| 213 | 213 | */ |
| 214 | 214 | function objet_optimiser_liens($objets_source, $objets_lies) { |
| 215 | - spip_log('objet_optimiser_liens : ' . json_encode($objets_source) . ', ' . json_encode($objets_lies), 'genie' . _LOG_DEBUG); |
|
| 215 | + spip_log('objet_optimiser_liens : '.json_encode($objets_source).', '.json_encode($objets_lies), 'genie'._LOG_DEBUG); |
|
| 216 | 216 | return objet_traiter_liaisons('lien_optimise', $objets_source, $objets_lies); |
| 217 | 217 | } |
| 218 | 218 | |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | $where_meme_lien = implode(' AND ', $where_meme_lien); |
| 447 | 447 | // on decale les liens de rang_lien>=la valeur inseree pour faire la place |
| 448 | 448 | // sauf sur le meme lien avec un role eventuellement different |
| 449 | - $w = lien_rang_where($table_lien, $primary, $id, $objet, $id_objet, ['rang_lien>=' . intval($insertions['rang_lien']), "NOT($where_meme_lien)"]); |
|
| 449 | + $w = lien_rang_where($table_lien, $primary, $id, $objet, $id_objet, ['rang_lien>='.intval($insertions['rang_lien']), "NOT($where_meme_lien)"]); |
|
| 450 | 450 | sql_update($table_lien, ['rang_lien' => 'rang_lien+1'], $w); |
| 451 | 451 | } |
| 452 | 452 | |
@@ -511,7 +511,7 @@ discard block |
||
| 511 | 511 | $rang = 1; |
| 512 | 512 | foreach ($liens as $lien) { |
| 513 | 513 | if (empty($deja_reordonne[$lien[$primary]][$lien['objet']][$lien['id_objet']])) { |
| 514 | - $where = lien_where($primary, $lien[$primary], $lien['objet'], $lien['id_objet'], ['rang_lien!=' . intval($rang)]); |
|
| 514 | + $where = lien_where($primary, $lien[$primary], $lien['objet'], $lien['id_objet'], ['rang_lien!='.intval($rang)]); |
|
| 515 | 515 | sql_updateq($table_lien, ['rang_lien' => $rang], $where); |
| 516 | 516 | |
| 517 | 517 | if (empty($deja_reordonne[$lien[$primary]])) { |
@@ -587,7 +587,7 @@ discard block |
||
| 587 | 587 | addslashes($primary), |
| 588 | 588 | array_map('intval', $id_source), |
| 589 | 589 | $not |
| 590 | - ) : addslashes($primary) . ($not ? '<>' : '=') . intval($id_source)); |
|
| 590 | + ) : addslashes($primary).($not ? '<>' : '=').intval($id_source)); |
|
| 591 | 591 | } elseif ($not) { |
| 592 | 592 | $where[] = '0=1'; |
| 593 | 593 | } // idiot mais quand meme |
@@ -599,14 +599,14 @@ discard block |
||
| 599 | 599 | } |
| 600 | 600 | |
| 601 | 601 | if ($objet !== '*') { |
| 602 | - $where[] = 'objet=' . sql_quote($objet); |
|
| 602 | + $where[] = 'objet='.sql_quote($objet); |
|
| 603 | 603 | } |
| 604 | 604 | if ($id_objet !== '*') { |
| 605 | 605 | $where[] = (is_array($id_objet) ? sql_in( |
| 606 | 606 | 'id_objet', |
| 607 | 607 | array_map('intval', $id_objet), |
| 608 | 608 | $not |
| 609 | - ) : 'id_objet' . ($not ? '<>' : '=') . intval($id_objet)); |
|
| 609 | + ) : 'id_objet'.($not ? '<>' : '=').intval($id_objet)); |
|
| 610 | 610 | } elseif ($not) { |
| 611 | 611 | $where[] = '0=1'; |
| 612 | 612 | } // idiot mais quand meme |
@@ -627,7 +627,7 @@ discard block |
||
| 627 | 627 | function lien_rang_where($table_lien, $primary, $id_source, $objet, $id_objet, $cond = []) { |
| 628 | 628 | |
| 629 | 629 | // si on veut compter les rangs autrement que le core ne le fait par defaut, fournir le where adhoc |
| 630 | - if (function_exists($f = 'lien_rang_where_' . $table_lien)) { |
|
| 630 | + if (function_exists($f = 'lien_rang_where_'.$table_lien)) { |
|
| 631 | 631 | return $f($primary, $id_source, $objet, $id_objet, $cond); |
| 632 | 632 | } |
| 633 | 633 | |
@@ -792,8 +792,8 @@ discard block |
||
| 792 | 792 | // il faut les eliminier en repetant la condition dans le where L.objet='xxx' |
| 793 | 793 | "$table_lien AS L |
| 794 | 794 | LEFT JOIN $spip_table_objet AS O |
| 795 | - ON (O.$id_table_objet=L.id_objet AND L.objet=" . sql_quote($type) . ')', |
|
| 796 | - 'L.objet=' . sql_quote($type) . " AND O.$id_table_objet IS NULL" |
|
| 795 | + ON (O.$id_table_objet=L.id_objet AND L.objet=".sql_quote($type).')', |
|
| 796 | + 'L.objet='.sql_quote($type)." AND O.$id_table_objet IS NULL" |
|
| 797 | 797 | ); |
| 798 | 798 | // sur une cle primaire composee, pas d'autres solutions que de virer un a un |
| 799 | 799 | while ($row = sql_fetch($res)) { |
@@ -802,13 +802,13 @@ discard block |
||
| 802 | 802 | } |
| 803 | 803 | $e = sql_delete( |
| 804 | 804 | $table_lien, |
| 805 | - ["$primary=" . $row['id'], 'id_objet=' . $row['id_objet'], 'objet=' . sql_quote($type)] |
|
| 805 | + ["$primary=".$row['id'], 'id_objet='.$row['id_objet'], 'objet='.sql_quote($type)] |
|
| 806 | 806 | ); |
| 807 | 807 | if ($e != false) { |
| 808 | 808 | $dels += $e; |
| 809 | 809 | spip_log( |
| 810 | - 'lien_optimise: Entree ' . $row['id'] . '/' . $row['id_objet'] . "/$type supprimee dans la table $table_lien", |
|
| 811 | - 'genie' . _LOG_INFO_IMPORTANTE |
|
| 810 | + 'lien_optimise: Entree '.$row['id'].'/'.$row['id_objet']."/$type supprimee dans la table $table_lien", |
|
| 811 | + 'genie'._LOG_INFO_IMPORTANTE |
|
| 812 | 812 | ); |
| 813 | 813 | } |
| 814 | 814 | } |
@@ -912,7 +912,7 @@ discard block |
||
| 912 | 912 | // sauf sur le meme lien avec un role eventuellement different |
| 913 | 913 | $where_meme_lien = lien_where($primary, $id, $objet, $id_objet); |
| 914 | 914 | $where_meme_lien = implode(' AND ', $where_meme_lien); |
| 915 | - $w = lien_rang_where($table_lien, $primary, $id, $objet, $id_objet, ['rang_lien>=' . intval($qualif['rang_lien']), "NOT($where_meme_lien)"]); |
|
| 915 | + $w = lien_rang_where($table_lien, $primary, $id, $objet, $id_objet, ['rang_lien>='.intval($qualif['rang_lien']), "NOT($where_meme_lien)"]); |
|
| 916 | 916 | sql_update($table_lien, ['rang_lien' => 'rang_lien+1'], $w); |
| 917 | 917 | } |
| 918 | 918 | // tous les liens de même rôle recoivent le rang indiqué aussi |
@@ -1004,7 +1004,7 @@ discard block |
||
| 1004 | 1004 | */ |
| 1005 | 1005 | function lien_propage_date_modif($objet, $ids) { |
| 1006 | 1006 | static $done = []; |
| 1007 | - $hash = md5($objet . serialize($ids)); |
|
| 1007 | + $hash = md5($objet.serialize($ids)); |
|
| 1008 | 1008 | |
| 1009 | 1009 | // sql_updateq, peut être un rien lent. |
| 1010 | 1010 | // On évite de l'appeler 2 fois sur les mêmes choses |
@@ -1020,7 +1020,7 @@ discard block |
||
| 1020 | 1020 | and isset($desc['field']['date_modif']) |
| 1021 | 1021 | ) { |
| 1022 | 1022 | $primary = id_table_objet($objet); |
| 1023 | - $where = (is_array($ids) ? sql_in($primary, array_map('intval', $ids)) : "$primary=" . intval($ids)); |
|
| 1023 | + $where = (is_array($ids) ? sql_in($primary, array_map('intval', $ids)) : "$primary=".intval($ids)); |
|
| 1024 | 1024 | sql_updateq($table, ['date_modif' => date('Y-m-d H:i:s')], $where); |
| 1025 | 1025 | } |
| 1026 | 1026 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | ]; |
| 44 | 44 | $options = array_merge($defaut, $options); |
| 45 | 45 | if (is_numeric($options['expire']) and $options['expire'] > 0) { |
| 46 | - $options['expire'] = gmdate('D, d M Y H:i:s', time() + $options['expires']) . ' GMT'; |
|
| 46 | + $options['expire'] = gmdate('D, d M Y H:i:s', time() + $options['expires']).' GMT'; |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | if (is_null($options) and isset($_SERVER['HTTP_RANGE'])) { |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | function spip_livrer_fichier_entetes($fichier, $content_type = 'application/octet-stream', $attachment = false, $expires = 0) { |
| 73 | 73 | // toujours envoyer un content type, meme vide ! |
| 74 | 74 | header('Accept-Ranges: bytes'); |
| 75 | - header('Content-Type: ' . $content_type); |
|
| 75 | + header('Content-Type: '.$content_type); |
|
| 76 | 76 | |
| 77 | 77 | if ($attachment) { |
| 78 | 78 | $f = basename($fichier); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | else { |
| 91 | 91 | $f = basename($fichier); |
| 92 | 92 | header("Content-Disposition: inline; filename=\"$f\";"); |
| 93 | - header('Expires: ' . $expires); // set expiration time |
|
| 93 | + header('Expires: '.$expires); // set expiration time |
|
| 94 | 94 | } |
| 95 | 95 | } |
| 96 | 96 | |
@@ -142,12 +142,12 @@ discard block |
||
| 142 | 142 | // Parse Content-Range header for byte offsets, looks like "bytes=11525-" OR "bytes=11525-12451" |
| 143 | 143 | if ($range and preg_match('%bytes=(\d+)-(\d+)?%i', $range, $match)) { |
| 144 | 144 | ### Offset signifies where we should begin to read the file |
| 145 | - $byteOffset = (int)$match[1]; |
|
| 145 | + $byteOffset = (int) $match[1]; |
|
| 146 | 146 | |
| 147 | 147 | |
| 148 | 148 | ### Length is for how long we should read the file according to the browser, and can never go beyond the file size |
| 149 | 149 | if (isset($match[2])) { |
| 150 | - $finishBytes = (int)$match[2]; |
|
| 150 | + $finishBytes = (int) $match[2]; |
|
| 151 | 151 | $byteLength = $finishBytes + 1; |
| 152 | 152 | } else { |
| 153 | 153 | $finishBytes = $fileSize - 1; |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | |
| 169 | 169 | // partial content |
| 170 | 170 | header('HTTP/1.1 206 Partial content'); |
| 171 | - header($cr_header); ### Decrease by 1 on byte-length since this definition is zero-based index of bytes being sent |
|
| 171 | + header($cr_header); ### Decrease by 1 on byte-length since this definition is zero-based index of bytes being sent |
|
| 172 | 172 | |
| 173 | 173 | |
| 174 | 174 | $byteRange = $byteLength - $byteOffset; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | if (!$max_age) { |
| 107 | 107 | $max_age = _DEFAULT_LOCKTIME; |
| 108 | 108 | } |
| 109 | - $lock_file = _DIR_TMP . _NAME_LOCK . '-' . substr(md5($fichier), 0, 8); |
|
| 109 | + $lock_file = _DIR_TMP._NAME_LOCK.'-'.substr(md5($fichier), 0, 8); |
|
| 110 | 110 | |
| 111 | 111 | |
| 112 | 112 | /* |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | */ |
| 116 | 116 | |
| 117 | 117 | $id = creer_uniqid(); |
| 118 | - $tpath = _DIR_TMP . "slock.$id"; |
|
| 118 | + $tpath = _DIR_TMP."slock.$id"; |
|
| 119 | 119 | $tmpfd = @fopen($tpath, 'w'); // hum, le 'x' necessite php4,3,2 ... |
| 120 | 120 | if (!$tmpfd) { /* open failed */ |
| 121 | 121 | @fclose($tmpfd); |
@@ -241,7 +241,7 @@ discard block |
||
| 241 | 241 | * thinks the current time is (our_tmp.st_ctime).. |
| 242 | 242 | */ |
| 243 | 243 | |
| 244 | - $tpath = _DIR_TMP . "stime.$id"; |
|
| 244 | + $tpath = _DIR_TMP."stime.$id"; |
|
| 245 | 245 | $tmpfd = @fopen($tpath, 'w'); |
| 246 | 246 | if ( |
| 247 | 247 | (!$tmpfd) |
@@ -255,14 +255,14 @@ discard block |
||
| 255 | 255 | return false; //(NFSL_SYSF); |
| 256 | 256 | } |
| 257 | 257 | |
| 258 | - @fclose($tmpfd); /* We don't need this once we have our_tmp.st_ctime. */ |
|
| 258 | + @fclose($tmpfd); /* We don't need this once we have our_tmp.st_ctime. */ |
|
| 259 | 259 | spip_unlink($tpath); |
| 260 | 260 | |
| 261 | 261 | /* |
| 262 | 262 | * 2. make fullpath, a buffer for the full pathname of the lock file |
| 263 | 263 | */ |
| 264 | 264 | |
| 265 | - $lock_file = _DIR_TMP . _NAME_LOCK . '-' . substr(md5($fichier), 0, 8); |
|
| 265 | + $lock_file = _DIR_TMP._NAME_LOCK.'-'.substr(md5($fichier), 0, 8); |
|
| 266 | 266 | |
| 267 | 267 | /* |
| 268 | 268 | * 3. If the ctime hasn't been modified, unlink the file and return. If the |
@@ -282,10 +282,10 @@ discard block |
||
| 282 | 282 | if (!$test) { |
| 283 | 283 | return false; |
| 284 | 284 | } //(NFSL_LOST); |
| 285 | - sleep(1 + (rand(0, 4))); /* so sleep a bit */ |
|
| 285 | + sleep(1 + (rand(0, 4))); /* so sleep a bit */ |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | - return true;//(NFSL_OK); /* success */ |
|
| 288 | + return true; //(NFSL_OK); /* success */ |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /* |
@@ -147,7 +147,7 @@ discard block |
||
| 147 | 147 | // donc si on est dans le public avec un cache on va perdre le dynamisme |
| 148 | 148 | // et on risque de mettre en cache les valeurs pre-remplies du formulaire |
| 149 | 149 | // on injecte donc le PHP qui va appeler la fonction pour generer le formulaire au lieu de directement la fonction |
| 150 | - $p->code = "'<'.'?php echo (" . texte_script($p->code) . "); ?'.'>'"; |
|
| 150 | + $p->code = "'<'.'?php echo (".texte_script($p->code)."); ?'.'>'"; |
|
| 151 | 151 | // dans l'espace prive on a pas de cache, donc pas de soucis (et un leak serait moins grave) |
| 152 | 152 | } |
| 153 | 153 | return $p; |
@@ -327,7 +327,7 @@ discard block |
||
| 327 | 327 | foreach ($erreurs as $k => $v) { |
| 328 | 328 | if (is_string($v) and strlen(trim($v)) and strpos($k, '_') !== 0) { |
| 329 | 329 | // on encapsule dans un span car ces messages sont en general simple, juste du texte, et deja dans un span dans le form |
| 330 | - $valeurs['erreurs'][$k] = "<span role='alert'>" . $erreurs[$k] . '</span>'; |
|
| 330 | + $valeurs['erreurs'][$k] = "<span role='alert'>".$erreurs[$k].'</span>'; |
|
| 331 | 331 | } |
| 332 | 332 | } |
| 333 | 333 | } |
@@ -975,9 +975,9 @@ |
||
| 975 | 975 | if (!defined('_TRAITEMENT_TYPO_SANS_NUMERO')) { |
| 976 | 976 | define('_TRAITEMENT_TYPO_SANS_NUMERO', 'supprimer_numero(typo(%s, "TYPO", $connect, $Pile[0]))'); |
| 977 | 977 | } |
| 978 | - $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml(' . _TRAITEMENT_RACCOURCIS . ')'; |
|
| 978 | + $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml('._TRAITEMENT_RACCOURCIS.')'; |
|
| 979 | 979 | $GLOBALS['table_des_traitements']['NOM_SITE']['spip_auteurs'] = 'entites_html(%s)'; |
| 980 | - $GLOBALS['table_des_traitements']['NOM']['spip_auteurs'] = 'safehtml(' . _TRAITEMENT_TYPO_SANS_NUMERO . ')'; |
|
| 980 | + $GLOBALS['table_des_traitements']['NOM']['spip_auteurs'] = 'safehtml('._TRAITEMENT_TYPO_SANS_NUMERO.')'; |
|
| 981 | 981 | $GLOBALS['table_des_traitements']['CHAPO'][] = _TRAITEMENT_RACCOURCIS; |
| 982 | 982 | $GLOBALS['table_des_traitements']['DATE'][] = 'normaliser_date(%s)'; |
| 983 | 983 | $GLOBALS['table_des_traitements']['DATE_REDAC'][] = 'normaliser_date(%s)'; |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | // chercher la classe d'iterateur |
| 79 | 79 | // IterateurXXX |
| 80 | 80 | // definie dans le fichier iterateurs/xxx.php |
| 81 | - $class = 'Iterateur' . $iterateur; |
|
| 81 | + $class = 'Iterateur'.$iterateur; |
|
| 82 | 82 | if (!class_exists($class)) { |
| 83 | 83 | if ( |
| 84 | - !include_spip('iterateur/' . strtolower($iterateur)) |
|
| 84 | + !include_spip('iterateur/'.strtolower($iterateur)) |
|
| 85 | 85 | or !class_exists($class) |
| 86 | 86 | ) { |
| 87 | 87 | die("Iterateur $iterateur non trouvé"); |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | return $this->iter->$nom(); |
| 210 | 210 | } catch (Exception $e) { |
| 211 | 211 | // #GETCHILDREN sur un fichier de DirectoryIterator ... |
| 212 | - spip_log("Methode $nom en echec sur " . get_class($this->iter)); |
|
| 212 | + spip_log("Methode $nom en echec sur ".get_class($this->iter)); |
|
| 213 | 213 | spip_log("Cela peut être normal : retour d'une ligne de resultat ne pouvant pas calculer cette methode"); |
| 214 | 214 | |
| 215 | 215 | return ''; |
@@ -258,8 +258,8 @@ discard block |
||
| 258 | 258 | // Creer la fonction de filtrage sur $this |
| 259 | 259 | if ($this->filtre) { |
| 260 | 260 | if ($filtres = $this->assembler_filtres($this->filtre)) { |
| 261 | - $filtres = 'return ' . $filtres . ';'; |
|
| 262 | - $this->func_filtre = function () use ($filtres) { |
|
| 261 | + $filtres = 'return '.$filtres.';'; |
|
| 262 | + $this->func_filtre = function() use ($filtres) { |
|
| 263 | 263 | return eval($filtres); |
| 264 | 264 | }; |
| 265 | 265 | } |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | return null; |
| 296 | 296 | } |
| 297 | 297 | |
| 298 | - return '(' . implode(") $operateur (", $filtres_string) . ')'; |
|
| 298 | + return '('.implode(") $operateur (", $filtres_string).')'; |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | /** |
@@ -376,7 +376,7 @@ discard block |
||
| 376 | 376 | return $this->composer_filtre($v[1], $v[0], $v[2]); |
| 377 | 377 | } |
| 378 | 378 | |
| 379 | - return null; // sera ignore |
|
| 379 | + return null; // sera ignore |
|
| 380 | 380 | } |
| 381 | 381 | |
| 382 | 382 | /** |
@@ -402,28 +402,28 @@ discard block |
||
| 402 | 402 | # if (!in_array($cle, array('cle', 'valeur'))) |
| 403 | 403 | # return; |
| 404 | 404 | |
| 405 | - $a = '$this->get_select(\'' . $cle . '\')'; |
|
| 405 | + $a = '$this->get_select(\''.$cle.'\')'; |
|
| 406 | 406 | |
| 407 | 407 | $filtre = ''; |
| 408 | 408 | |
| 409 | 409 | if ($op == 'REGEXP') { |
| 410 | - $filtre = 'filtrer("match", ' . $a . ', ' . str_replace('\"', '"', $valeur) . ')'; |
|
| 410 | + $filtre = 'filtrer("match", '.$a.', '.str_replace('\"', '"', $valeur).')'; |
|
| 411 | 411 | $op = ''; |
| 412 | 412 | } else { |
| 413 | 413 | if ($op == 'LIKE') { |
| 414 | 414 | $valeur = str_replace(['\"', '_', '%'], ['"', '.', '.*'], preg_quote($valeur)); |
| 415 | - $filtre = 'filtrer("match", ' . $a . ', ' . $valeur . ')'; |
|
| 415 | + $filtre = 'filtrer("match", '.$a.', '.$valeur.')'; |
|
| 416 | 416 | $op = ''; |
| 417 | 417 | } else { |
| 418 | 418 | if ($op == '=') { |
| 419 | 419 | $op = '=='; |
| 420 | 420 | } else { |
| 421 | 421 | if ($op == 'IN') { |
| 422 | - $filtre = 'in_array(' . $a . ', array' . $valeur . ')'; |
|
| 422 | + $filtre = 'in_array('.$a.', array'.$valeur.')'; |
|
| 423 | 423 | $op = ''; |
| 424 | 424 | } else { |
| 425 | 425 | if (!in_array($op, ['<', '<=', '>', '>='])) { |
| 426 | - spip_log('operateur non reconnu ' . $op); // [todo] mettre une erreur de squelette |
|
| 426 | + spip_log('operateur non reconnu '.$op); // [todo] mettre une erreur de squelette |
|
| 427 | 427 | $op = ''; |
| 428 | 428 | } |
| 429 | 429 | } |
@@ -432,7 +432,7 @@ discard block |
||
| 432 | 432 | } |
| 433 | 433 | |
| 434 | 434 | if ($op) { |
| 435 | - $filtre = $a . $op . str_replace('\"', '"', $valeur); |
|
| 435 | + $filtre = $a.$op.str_replace('\"', '"', $valeur); |
|
| 436 | 436 | } |
| 437 | 437 | |
| 438 | 438 | if ($not) { |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | $n = 0; |
| 46 | 46 | $time = isset($GLOBALS['meta']['cache_mark']) ? $GLOBALS['meta']['cache_mark'] : 0; |
| 47 | 47 | for ($i = 0; $i < 256; $i++) { |
| 48 | - $dir = _DIR_CACHE . sprintf('%02s', dechex($i)); |
|
| 48 | + $dir = _DIR_CACHE.sprintf('%02s', dechex($i)); |
|
| 49 | 49 | if (@is_dir($dir) and is_readable($dir) and $d = opendir($dir)) { |
| 50 | 50 | while (($f = readdir($d)) !== false) { |
| 51 | 51 | if (preg_match(',^[[0-9a-f]+\.cache$,S', $f) and $a = stat("$dir/$f")) { |
@@ -102,7 +102,7 @@ discard block |
||
| 102 | 102 | |
| 103 | 103 | // stocker la date_modif_$objet (ne sert a rien pour le moment) |
| 104 | 104 | if (isset($objet)) { |
| 105 | - ecrire_meta('derniere_modif_' . $objet, time()); |
|
| 105 | + ecrire_meta('derniere_modif_'.$objet, time()); |
|
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | // si $derniere_modif_invalide est un array('article', 'rubrique') |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | |
| 146 | 146 | // sur certains sites on veut absolument garder certains caches référencés dans un CDN |
| 147 | 147 | // on peut donc inhiber la purge de ces répertoires pour eviter tout probleme |
| 148 | - if (file_exists(rtrim($dir, '/') . '/inhib_purger_repertoire.txt')) { |
|
| 148 | + if (file_exists(rtrim($dir, '/').'/inhib_purger_repertoire.txt')) { |
|
| 149 | 149 | return 0; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | ) |
| 209 | 209 | ) { |
| 210 | 210 | // supprimer le fichier (de facon propre) |
| 211 | - supprimer_fichier(_DIR_CACHE . $cache); |
|
| 211 | + supprimer_fichier(_DIR_CACHE.$cache); |
|
| 212 | 212 | } else { |
| 213 | 213 | spip_log("Nom de fichier cache incorrect : $cache"); |
| 214 | 214 | } |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | return $erreur; |
| 90 | 90 | } |
| 91 | 91 | // chercher dans la base |
| 92 | - $mode_document = 'logo' . $mode; |
|
| 92 | + $mode_document = 'logo'.$mode; |
|
| 93 | 93 | |
| 94 | 94 | include_spip('inc/documents'); |
| 95 | 95 | $erreur = ''; |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $tmp_name = false; |
| 107 | 107 | if (file_exists($source)) { |
| 108 | 108 | $tmp_name = $source; |
| 109 | - } elseif (file_exists($f = determine_upload() . $source)) { |
|
| 109 | + } elseif (file_exists($f = determine_upload().$source)) { |
|
| 110 | 110 | $tmp_name = $f; |
| 111 | 111 | } |
| 112 | 112 | if (!$tmp_name) { |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | |
| 141 | 141 | if (!is_numeric($id_document)) { |
| 142 | 142 | $erreur = ($id_document ? $id_document : 'Erreur inconnue'); |
| 143 | - spip_log("Erreur ajout logo : $erreur pour source=" . json_encode($source), 'logo'); |
|
| 143 | + spip_log("Erreur ajout logo : $erreur pour source=".json_encode($source), 'logo'); |
|
| 144 | 144 | return $erreur; |
| 145 | 145 | } |
| 146 | 146 | |
@@ -166,23 +166,23 @@ discard block |
||
| 166 | 166 | $desc = $trouver_table($table); |
| 167 | 167 | |
| 168 | 168 | foreach (['on', 'off'] as $mode) { |
| 169 | - $nom_base = $type . $mode; |
|
| 169 | + $nom_base = $type.$mode; |
|
| 170 | 170 | $dir = (defined('_DIR_LOGOS') ? _DIR_LOGOS : _DIR_IMG); |
| 171 | 171 | |
| 172 | - $files = glob($dir . $nom_base . '*'); |
|
| 172 | + $files = glob($dir.$nom_base.'*'); |
|
| 173 | 173 | // est-ce que c'est une nouvelle tentative de migration ? |
| 174 | 174 | // dans ce cas les logos sont deja dans IMG/logo/ |
| 175 | 175 | if (!count($files)) { |
| 176 | - $files = glob($dir_logos . $nom_base . '*'); |
|
| 176 | + $files = glob($dir_logos.$nom_base.'*'); |
|
| 177 | 177 | if (count($files)) { |
| 178 | 178 | // mais il faut verifier si ils ont pas deja ete migres pour tout ou partie |
| 179 | 179 | $filescheck = []; |
| 180 | 180 | foreach ($files as $file) { |
| 181 | - $short = basename(dirname($file)) . DIRECTORY_SEPARATOR . basename($file); |
|
| 181 | + $short = basename(dirname($file)).DIRECTORY_SEPARATOR.basename($file); |
|
| 182 | 182 | $filescheck[$short] = $file; |
| 183 | 183 | } |
| 184 | 184 | // trouver ceux deja migres |
| 185 | - $deja = sql_allfetsel('fichier', 'spip_documents', sql_in('fichier', array_keys($filescheck)) . " AND mode LIKE 'logo%'"); |
|
| 185 | + $deja = sql_allfetsel('fichier', 'spip_documents', sql_in('fichier', array_keys($filescheck))." AND mode LIKE 'logo%'"); |
|
| 186 | 186 | if (count($deja)) { |
| 187 | 187 | $deja = array_column($deja, 'fichier'); |
| 188 | 188 | $restant = array_diff(array_keys($filescheck), $deja); |
@@ -201,11 +201,11 @@ discard block |
||
| 201 | 201 | } |
| 202 | 202 | } |
| 203 | 203 | |
| 204 | - spip_log("logo_migrer_en_base $objet $mode : " . count($files) . ' logos restant', 'maj' . _LOG_INFO_IMPORTANTE); |
|
| 204 | + spip_log("logo_migrer_en_base $objet $mode : ".count($files).' logos restant', 'maj'._LOG_INFO_IMPORTANTE); |
|
| 205 | 205 | |
| 206 | 206 | $deja = []; |
| 207 | 207 | foreach ($files as $file) { |
| 208 | - $logo = substr($file, strlen($dir . $nom_base)); |
|
| 208 | + $logo = substr($file, strlen($dir.$nom_base)); |
|
| 209 | 209 | $logo = explode('.', $logo); |
| 210 | 210 | if ( |
| 211 | 211 | is_numeric($logo[0]) |
@@ -216,16 +216,16 @@ discard block |
||
| 216 | 216 | // if no logo in base |
| 217 | 217 | if (!$logo or count($logo) < 6) { |
| 218 | 218 | foreach ($formats_logos as $format) { |
| 219 | - if (@file_exists($d = ($dir . ($nom = $nom_base . intval($id_objet) . '.' . $format)))) { |
|
| 219 | + if (@file_exists($d = ($dir.($nom = $nom_base.intval($id_objet).'.'.$format)))) { |
|
| 220 | 220 | if (isset($desc['field']['date_modif'])) { |
| 221 | 221 | $date_modif = sql_getfetsel('date_modif', $table, "$_id_objet=$id_objet"); |
| 222 | 222 | } else { |
| 223 | 223 | $date_modif = null; |
| 224 | 224 | } |
| 225 | 225 | // logo_modifier commence par supprimer le logo existant, donc on le deplace pour pas le perdre |
| 226 | - @rename($d, $dir_logos . $nom); |
|
| 226 | + @rename($d, $dir_logos.$nom); |
|
| 227 | 227 | // et on le declare comme nouveau logo |
| 228 | - logo_modifier($objet, $id_objet, $mode, $dir_logos . $nom); |
|
| 228 | + logo_modifier($objet, $id_objet, $mode, $dir_logos.$nom); |
|
| 229 | 229 | if ($date_modif) { |
| 230 | 230 | sql_updateq($table, ['date_modif' => $date_modif], "$_id_objet=$id_objet"); |
| 231 | 231 | } |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | // si le fichier est encore la on le move : rien a faire ici |
| 240 | 240 | // (sauf si c'est une re-migration : il est deja dans logo/ donc il bouge pas) |
| 241 | 241 | if ($dir !== $dir_logos and file_exists($file)) { |
| 242 | - @rename($file, $dir_logos_erreurs . basename($file)); |
|
| 242 | + @rename($file, $dir_logos_erreurs.basename($file)); |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | if ($time_limit and time() > $time_limit) { |
@@ -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) { |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | ) { |
| 232 | 232 | spip_log( |
| 233 | 233 | "SQLite : Probleme de ALTER TABLE, utilisation non reconnue dans : $do \n(requete d'origine : $query)", |
| 234 | - 'sqlite.' . _LOG_ERREUR |
|
| 234 | + 'sqlite.'._LOG_ERREUR |
|
| 235 | 235 | ); |
| 236 | 236 | |
| 237 | 237 | return false; |
@@ -327,10 +327,10 @@ discard block |
||
| 327 | 327 | |
| 328 | 328 | // pas geres en sqlite2 |
| 329 | 329 | case 'RENAME': |
| 330 | - $do = 'RENAME TO' . substr($do, 6); |
|
| 330 | + $do = 'RENAME TO'.substr($do, 6); |
|
| 331 | 331 | case 'RENAME TO': |
| 332 | 332 | if (!spip_sqlite::executer_requete("$debut $do", $serveur)) { |
| 333 | - spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 333 | + spip_log("SQLite : Erreur ALTER TABLE / RENAME : $query", 'sqlite.'._LOG_ERREUR); |
|
| 334 | 334 | |
| 335 | 335 | return false; |
| 336 | 336 | } |
@@ -373,7 +373,7 @@ discard block |
||
| 373 | 373 | $colonnes = substr($colonne_origine, 1, -1); |
| 374 | 374 | if (false !== strpos(',', $colonnes)) { |
| 375 | 375 | spip_log('SQLite : Erreur, impossible de creer un index sur plusieurs colonnes' |
| 376 | - . " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.' . _LOG_ERREUR); |
|
| 376 | + . " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.'._LOG_ERREUR); |
|
| 377 | 377 | break; |
| 378 | 378 | } else { |
| 379 | 379 | $nom_index = $colonnes; |
@@ -388,12 +388,12 @@ discard block |
||
| 388 | 388 | |
| 389 | 389 | // pas geres en sqlite2 |
| 390 | 390 | case 'ADD COLUMN': |
| 391 | - $do = 'ADD' . substr($do, 10); |
|
| 391 | + $do = 'ADD'.substr($do, 10); |
|
| 392 | 392 | case 'ADD': |
| 393 | 393 | default: |
| 394 | 394 | if (!preg_match(',primary\s+key,i', $do)) { |
| 395 | 395 | if (!spip_sqlite::executer_requete("$debut $do", $serveur)) { |
| 396 | - spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 396 | + spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR); |
|
| 397 | 397 | |
| 398 | 398 | return false; |
| 399 | 399 | } |
@@ -413,7 +413,7 @@ discard block |
||
| 413 | 413 | } |
| 414 | 414 | $opts['field'] = [$colonne_ajoutee => $def]; |
| 415 | 415 | if (!_sqlite_modifier_table($table, [$colonne_ajoutee], $opts, $serveur)) { |
| 416 | - spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.' . _LOG_ERREUR); |
|
| 416 | + spip_log("SQLite : Erreur ALTER TABLE / ADD : $query", 'sqlite.'._LOG_ERREUR); |
|
| 417 | 417 | |
| 418 | 418 | return false; |
| 419 | 419 | } |
@@ -421,10 +421,10 @@ discard block |
||
| 421 | 421 | break; |
| 422 | 422 | } |
| 423 | 423 | // tout est bon, ouf ! |
| 424 | - spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.' . _LOG_INFO); |
|
| 424 | + spip_log("SQLite ($serveur) : Changements OK : $debut $do", 'sqlite.'._LOG_INFO); |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | - spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.' . _LOG_INFO); |
|
| 427 | + spip_log("SQLite ($serveur) : fin ALTER TABLE OK !", 'sqlite.'._LOG_INFO); |
|
| 428 | 428 | |
| 429 | 429 | return true; |
| 430 | 430 | } |
@@ -493,9 +493,9 @@ discard block |
||
| 493 | 493 | * @return bool true si la base est créee. |
| 494 | 494 | **/ |
| 495 | 495 | function spip_sqlite_create_base($nom, $serveur = '', $option = true) { |
| 496 | - $f = $nom . '.sqlite'; |
|
| 496 | + $f = $nom.'.sqlite'; |
|
| 497 | 497 | if (strpos($nom, '/') === false) { |
| 498 | - $f = _DIR_DB . $f; |
|
| 498 | + $f = _DIR_DB.$f; |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | $ok = new \PDO("sqlite:$f"); |
@@ -535,13 +535,13 @@ discard block |
||
| 535 | 535 | if (sql_showtable($nom, false, $serveur)) { |
| 536 | 536 | spip_log( |
| 537 | 537 | "Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", |
| 538 | - 'sqlite.' . _LOG_ERREUR |
|
| 538 | + 'sqlite.'._LOG_ERREUR |
|
| 539 | 539 | ); |
| 540 | 540 | |
| 541 | 541 | return false; |
| 542 | 542 | } |
| 543 | 543 | |
| 544 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 544 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 545 | 545 | |
| 546 | 546 | return spip_sqlite_query($query, $serveur, $requeter); |
| 547 | 547 | } |
@@ -567,8 +567,8 @@ discard block |
||
| 567 | 567 | function spip_sqlite_create_index($nom, $table, $champs, $unique = '', $serveur = '', $requeter = true) { |
| 568 | 568 | if (!($nom or $table or $champs)) { |
| 569 | 569 | spip_log( |
| 570 | - "Champ manquant pour creer un index sqlite ($nom, $table, (" . join(',', $champs) . '))', |
|
| 571 | - 'sqlite.' . _LOG_ERREUR |
|
| 570 | + "Champ manquant pour creer un index sqlite ($nom, $table, (".join(',', $champs).'))', |
|
| 571 | + 'sqlite.'._LOG_ERREUR |
|
| 572 | 572 | ); |
| 573 | 573 | |
| 574 | 574 | return false; |
@@ -576,7 +576,7 @@ discard block |
||
| 576 | 576 | |
| 577 | 577 | // SQLite ne differentie pas noms des index en fonction des tables |
| 578 | 578 | // il faut donc creer des noms uniques d'index pour une base sqlite |
| 579 | - $nom = $table . '_' . $nom; |
|
| 579 | + $nom = $table.'_'.$nom; |
|
| 580 | 580 | // enlever d'eventuelles parentheses deja presentes sur champs |
| 581 | 581 | if (!is_array($champs)) { |
| 582 | 582 | if ($champs[0] == '(') { |
@@ -598,12 +598,12 @@ discard block |
||
| 598 | 598 | } else { |
| 599 | 599 | /* simuler le IF EXISTS - version 2 et sqlite < 3.3a */ |
| 600 | 600 | $a = spip_sqlite_showtable($table, $serveur); |
| 601 | - if (isset($a['key']['KEY ' . $nom])) { |
|
| 601 | + if (isset($a['key']['KEY '.$nom])) { |
|
| 602 | 602 | return true; |
| 603 | 603 | } |
| 604 | 604 | } |
| 605 | 605 | |
| 606 | - $query = 'CREATE ' . ($unique ? 'UNIQUE ' : '') . "INDEX$ifnotexists $nom ON $table (" . join(',', $champs) . ')'; |
|
| 606 | + $query = 'CREATE '.($unique ? 'UNIQUE ' : '')."INDEX$ifnotexists $nom ON $table (".join(',', $champs).')'; |
|
| 607 | 607 | $res = spip_sqlite_query($query, $serveur, $requeter); |
| 608 | 608 | if (!$requeter) { |
| 609 | 609 | return $res; |
@@ -679,7 +679,7 @@ discard block |
||
| 679 | 679 | $serveur = '', |
| 680 | 680 | $requeter = true |
| 681 | 681 | ) { |
| 682 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 682 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 683 | 683 | $r = spip_sqlite_select( |
| 684 | 684 | "COUNT($c)", |
| 685 | 685 | $from, |
@@ -788,14 +788,14 @@ discard block |
||
| 788 | 788 | */ |
| 789 | 789 | function spip_sqlite_drop_index($nom, $table, $serveur = '', $requeter = true) { |
| 790 | 790 | if (!($nom or $table)) { |
| 791 | - spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.' . _LOG_ERREUR); |
|
| 791 | + spip_log("Champ manquant pour supprimer un index sqlite ($nom, $table)", 'sqlite.'._LOG_ERREUR); |
|
| 792 | 792 | |
| 793 | 793 | return false; |
| 794 | 794 | } |
| 795 | 795 | |
| 796 | 796 | // SQLite ne differentie pas noms des index en fonction des tables |
| 797 | 797 | // il faut donc creer des noms uniques d'index pour une base sqlite |
| 798 | - $index = $table . '_' . $nom; |
|
| 798 | + $index = $table.'_'.$nom; |
|
| 799 | 799 | $exist = ' IF EXISTS'; |
| 800 | 800 | |
| 801 | 801 | $query = "DROP INDEX$exist $index"; |
@@ -827,7 +827,7 @@ discard block |
||
| 827 | 827 | if ($s) { |
| 828 | 828 | $trace = debug_backtrace(); |
| 829 | 829 | if ($trace[0]['function'] != 'spip_sqlite_error') { |
| 830 | - spip_log("$s - $query - " . sql_error_backtrace(), 'sqlite.' . _LOG_ERREUR); |
|
| 830 | + spip_log("$s - $query - ".sql_error_backtrace(), 'sqlite.'._LOG_ERREUR); |
|
| 831 | 831 | } |
| 832 | 832 | } |
| 833 | 833 | |
@@ -874,14 +874,14 @@ discard block |
||
| 874 | 874 | $t = $link->errorInfo(); |
| 875 | 875 | $s = ltrim($t[0], '0'); // 00000 si pas d'erreur |
| 876 | 876 | if ($s) { |
| 877 | - $s .= ' / ' . $t[1]; |
|
| 877 | + $s .= ' / '.$t[1]; |
|
| 878 | 878 | } // ajoute l'erreur du moteur SQLite |
| 879 | 879 | } else { |
| 880 | 880 | $s = ': aucune ressource sqlite (link)'; |
| 881 | 881 | } |
| 882 | 882 | |
| 883 | 883 | if ($s) { |
| 884 | - spip_log("Erreur sqlite $s", 'sqlite.' . _LOG_ERREUR); |
|
| 884 | + spip_log("Erreur sqlite $s", 'sqlite.'._LOG_ERREUR); |
|
| 885 | 885 | } |
| 886 | 886 | |
| 887 | 887 | return $s ? $s : 0; |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | } |
| 906 | 906 | |
| 907 | 907 | $query = spip_sqlite::traduire_requete($query, $serveur); |
| 908 | - $query = 'EXPLAIN ' . $query; |
|
| 908 | + $query = 'EXPLAIN '.$query; |
|
| 909 | 909 | if (!$requeter) { |
| 910 | 910 | return $query; |
| 911 | 911 | } |
@@ -1066,7 +1066,7 @@ discard block |
||
| 1066 | 1066 | **/ |
| 1067 | 1067 | function spip_sqlite_insert($table, $champs, $valeurs, $desc = [], $serveur = '', $requeter = true) { |
| 1068 | 1068 | |
| 1069 | - $query = "INSERT INTO $table " . ($champs ? "$champs VALUES $valeurs" : 'DEFAULT VALUES'); |
|
| 1069 | + $query = "INSERT INTO $table ".($champs ? "$champs VALUES $valeurs" : 'DEFAULT VALUES'); |
|
| 1070 | 1070 | if ($r = spip_sqlite_query($query, $serveur, $requeter)) { |
| 1071 | 1071 | if (!$requeter) { |
| 1072 | 1072 | return $r; |
@@ -1121,8 +1121,8 @@ discard block |
||
| 1121 | 1121 | |
| 1122 | 1122 | $cles = $valeurs = ''; |
| 1123 | 1123 | if (count($couples)) { |
| 1124 | - $cles = '(' . join(',', array_keys($couples)) . ')'; |
|
| 1125 | - $valeurs = '(' . join(',', $couples) . ')'; |
|
| 1124 | + $cles = '('.join(',', array_keys($couples)).')'; |
|
| 1125 | + $valeurs = '('.join(',', $couples).')'; |
|
| 1126 | 1126 | } |
| 1127 | 1127 | |
| 1128 | 1128 | return spip_sqlite_insert($table, $cles, $valeurs, $desc, $serveur, $requeter); |
@@ -1182,11 +1182,11 @@ discard block |
||
| 1182 | 1182 | |
| 1183 | 1183 | $champs = $valeurs = ''; |
| 1184 | 1184 | if (count($couples)) { |
| 1185 | - $champs = '(' . join(',', array_keys($couples)) . ')'; |
|
| 1186 | - $valeurs = '(' . join(',', $couples) . ')'; |
|
| 1187 | - $query = $query_start . "$champs VALUES $valeurs"; |
|
| 1185 | + $champs = '('.join(',', array_keys($couples)).')'; |
|
| 1186 | + $valeurs = '('.join(',', $couples).')'; |
|
| 1187 | + $query = $query_start."$champs VALUES $valeurs"; |
|
| 1188 | 1188 | } else { |
| 1189 | - $query = $query_start . 'DEFAULT VALUES'; |
|
| 1189 | + $query = $query_start.'DEFAULT VALUES'; |
|
| 1190 | 1190 | } |
| 1191 | 1191 | |
| 1192 | 1192 | if ($requeter) { |
@@ -1318,7 +1318,7 @@ discard block |
||
| 1318 | 1318 | * @return string Texte de sélection pour la requête |
| 1319 | 1319 | */ |
| 1320 | 1320 | function spip_sqlite_multi($objet, $lang) { |
| 1321 | - $r = 'EXTRAIRE_MULTI(' . $objet . ", '" . $lang . "') AS multi"; |
|
| 1321 | + $r = 'EXTRAIRE_MULTI('.$objet.", '".$lang."') AS multi"; |
|
| 1322 | 1322 | |
| 1323 | 1323 | return $r; |
| 1324 | 1324 | } |
@@ -1389,7 +1389,7 @@ discard block |
||
| 1389 | 1389 | function spip_sqlite_date_proche($champ, $interval, $unite) { |
| 1390 | 1390 | $op = (($interval <= 0) ? '>' : '<'); |
| 1391 | 1391 | |
| 1392 | - return "($champ $op datetime('" . date('Y-m-d H:i:s') . "', '$interval $unite'))"; |
|
| 1392 | + return "($champ $op datetime('".date('Y-m-d H:i:s')."', '$interval $unite'))"; |
|
| 1393 | 1393 | } |
| 1394 | 1394 | |
| 1395 | 1395 | |
@@ -1421,7 +1421,7 @@ discard block |
||
| 1421 | 1421 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1422 | 1422 | ) { |
| 1423 | 1423 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT ''", $serveur); |
| 1424 | - spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE); |
|
| 1424 | + spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE); |
|
| 1425 | 1425 | } |
| 1426 | 1426 | if ( |
| 1427 | 1427 | preg_match(',^(INTEGER),i', $d) |
@@ -1431,7 +1431,7 @@ discard block |
||
| 1431 | 1431 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1432 | 1432 | ) { |
| 1433 | 1433 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0'", $serveur); |
| 1434 | - spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE); |
|
| 1434 | + spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE); |
|
| 1435 | 1435 | } |
| 1436 | 1436 | if ( |
| 1437 | 1437 | preg_match(',^(datetime),i', $d) |
@@ -1441,7 +1441,7 @@ discard block |
||
| 1441 | 1441 | and (!isset($desc['key']['PRIMARY KEY']) or $desc['key']['PRIMARY KEY'] !== $c) |
| 1442 | 1442 | ) { |
| 1443 | 1443 | spip_sqlite_alter($q = "TABLE $table CHANGE $c $c $d DEFAULT '0000-00-00 00:00:00'", $serveur); |
| 1444 | - spip_log("ALTER $q", 'repair' . _LOG_INFO_IMPORTANTE); |
|
| 1444 | + spip_log("ALTER $q", 'repair'._LOG_INFO_IMPORTANTE); |
|
| 1445 | 1445 | } |
| 1446 | 1446 | } |
| 1447 | 1447 | |
@@ -1492,10 +1492,10 @@ discard block |
||
| 1492 | 1492 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
| 1493 | 1493 | $couples = _sqlite_ajouter_champs_timestamp($table, $couples, $desc, $serveur); |
| 1494 | 1494 | |
| 1495 | - return spip_sqlite_query("REPLACE INTO $table (" . join(',', array_keys($couples)) . ') VALUES (' . join( |
|
| 1495 | + return spip_sqlite_query("REPLACE INTO $table (".join(',', array_keys($couples)).') VALUES ('.join( |
|
| 1496 | 1496 | ',', |
| 1497 | 1497 | $couples |
| 1498 | - ) . ')', $serveur); |
|
| 1498 | + ).')', $serveur); |
|
| 1499 | 1499 | } |
| 1500 | 1500 | |
| 1501 | 1501 | |
@@ -1581,7 +1581,7 @@ discard block |
||
| 1581 | 1581 | . _sqlite_calculer_expression('WHERE', $where) |
| 1582 | 1582 | . _sqlite_calculer_expression('GROUP BY', $groupby, ',') |
| 1583 | 1583 | . _sqlite_calculer_expression('HAVING', $having) |
| 1584 | - . ($orderby ? ("\nORDER BY " . _sqlite_calculer_order($orderby)) : '') |
|
| 1584 | + . ($orderby ? ("\nORDER BY "._sqlite_calculer_order($orderby)) : '') |
|
| 1585 | 1585 | . ($limit ? "\nLIMIT $limit" : ''); |
| 1586 | 1586 | |
| 1587 | 1587 | // dans un select, on doit renvoyer la requête en cas d'erreur |
@@ -1619,10 +1619,10 @@ discard block |
||
| 1619 | 1619 | // interdire la creation d'une nouvelle base, |
| 1620 | 1620 | // sauf si on est dans l'installation |
| 1621 | 1621 | if ( |
| 1622 | - !is_file($f = _DIR_DB . $db . '.sqlite') |
|
| 1622 | + !is_file($f = _DIR_DB.$db.'.sqlite') |
|
| 1623 | 1623 | && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL) |
| 1624 | 1624 | ) { |
| 1625 | - spip_log("Il est interdit de creer la base $db", 'sqlite.' . _LOG_HS); |
|
| 1625 | + spip_log("Il est interdit de creer la base $db", 'sqlite.'._LOG_HS); |
|
| 1626 | 1626 | |
| 1627 | 1627 | return false; |
| 1628 | 1628 | } |
@@ -1631,12 +1631,12 @@ discard block |
||
| 1631 | 1631 | // avec les identifiants connus |
| 1632 | 1632 | $index = $serveur ? $serveur : 0; |
| 1633 | 1633 | |
| 1634 | - if ($link = spip_connect_db('', '', '', '', '@selectdb@' . $db, $serveur, '', '')) { |
|
| 1634 | + if ($link = spip_connect_db('', '', '', '', '@selectdb@'.$db, $serveur, '', '')) { |
|
| 1635 | 1635 | if (($db == $link['db']) && $GLOBALS['connexions'][$index] = $link) { |
| 1636 | 1636 | return $db; |
| 1637 | 1637 | } |
| 1638 | 1638 | } else { |
| 1639 | - spip_log("Impossible de selectionner la base $db", 'sqlite.' . _LOG_HS); |
|
| 1639 | + spip_log("Impossible de selectionner la base $db", 'sqlite.'._LOG_HS); |
|
| 1640 | 1640 | |
| 1641 | 1641 | return false; |
| 1642 | 1642 | } |
@@ -1687,7 +1687,7 @@ discard block |
||
| 1687 | 1687 | $match = "^$match$"; |
| 1688 | 1688 | |
| 1689 | 1689 | return spip_sqlite_query( |
| 1690 | - "SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP " . _q($match), |
|
| 1690 | + "SELECT name FROM sqlite_master WHERE type='table' AND tbl_name REGEXP "._q($match), |
|
| 1691 | 1691 | $serveur, |
| 1692 | 1692 | $requeter |
| 1693 | 1693 | ); |
@@ -1710,7 +1710,7 @@ discard block |
||
| 1710 | 1710 | $r = spip_sqlite_query( |
| 1711 | 1711 | 'SELECT name FROM sqlite_master WHERE' |
| 1712 | 1712 | . ' type=\'table\'' |
| 1713 | - . ' AND name=' . spip_sqlite_quote($table, 'string') |
|
| 1713 | + . ' AND name='.spip_sqlite_quote($table, 'string') |
|
| 1714 | 1714 | . ' AND name NOT LIKE \'sqlite_%\'', |
| 1715 | 1715 | $serveur, |
| 1716 | 1716 | $requeter |
@@ -1807,7 +1807,7 @@ discard block |
||
| 1807 | 1807 | // s'il y a une parenthèse fermante dans la clé |
| 1808 | 1808 | // ou dans la définition sans qu'il n'y ait une ouverture avant |
| 1809 | 1809 | if (false !== strpos($k, ')') or preg_match('/^[^\(]*\)/', $def)) { |
| 1810 | - $fields[$k_precedent] .= ',' . $k . ' ' . $def; |
|
| 1810 | + $fields[$k_precedent] .= ','.$k.' '.$def; |
|
| 1811 | 1811 | continue; |
| 1812 | 1812 | } |
| 1813 | 1813 | |
@@ -1842,13 +1842,13 @@ discard block |
||
| 1842 | 1842 | . 'ORDER BY substr(type,2,1), name'; |
| 1843 | 1843 | $a = spip_sqlite_query($query, $serveur, $requeter); |
| 1844 | 1844 | while ($r = spip_sqlite_fetch($a, null, $serveur)) { |
| 1845 | - $key = str_replace($nom_table . '_', '', $r['name']); // enlever le nom de la table ajoute a l'index |
|
| 1845 | + $key = str_replace($nom_table.'_', '', $r['name']); // enlever le nom de la table ajoute a l'index |
|
| 1846 | 1846 | $keytype = 'KEY'; |
| 1847 | 1847 | if (strpos($r['sql'], 'UNIQUE INDEX') !== false) { |
| 1848 | 1848 | $keytype = 'UNIQUE KEY'; |
| 1849 | 1849 | } |
| 1850 | 1850 | $colonnes = preg_replace(',.*\((.*)\).*,', '$1', $r['sql']); |
| 1851 | - $keys[$keytype . ' ' . $key] = $colonnes; |
|
| 1851 | + $keys[$keytype.' '.$key] = $colonnes; |
|
| 1852 | 1852 | } |
| 1853 | 1853 | } |
| 1854 | 1854 | } // c'est une vue, on liste les champs disponibles simplement |
@@ -1895,7 +1895,7 @@ discard block |
||
| 1895 | 1895 | |
| 1896 | 1896 | $set = []; |
| 1897 | 1897 | foreach ($champs as $champ => $val) { |
| 1898 | - $set[] = $champ . "=$val"; |
|
| 1898 | + $set[] = $champ."=$val"; |
|
| 1899 | 1899 | } |
| 1900 | 1900 | if (!empty($set)) { |
| 1901 | 1901 | return spip_sqlite_query( |
@@ -1948,7 +1948,7 @@ discard block |
||
| 1948 | 1948 | |
| 1949 | 1949 | $set = []; |
| 1950 | 1950 | foreach ($champs as $champ => $val) { |
| 1951 | - $set[$champ] = $champ . '=' . _sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : ''); |
|
| 1951 | + $set[$champ] = $champ.'='._sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : ''); |
|
| 1952 | 1952 | } |
| 1953 | 1953 | |
| 1954 | 1954 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
@@ -1956,7 +1956,7 @@ discard block |
||
| 1956 | 1956 | $maj = _sqlite_ajouter_champs_timestamp($table, [], $desc, $serveur); |
| 1957 | 1957 | foreach ($maj as $champ => $val) { |
| 1958 | 1958 | if (!isset($set[$champ])) { |
| 1959 | - $set[$champ] = $champ . '=' . $val; |
|
| 1959 | + $set[$champ] = $champ.'='.$val; |
|
| 1960 | 1960 | } |
| 1961 | 1961 | } |
| 1962 | 1962 | |
@@ -1985,7 +1985,7 @@ discard block |
||
| 1985 | 1985 | */ |
| 1986 | 1986 | function _sqlite_init() { |
| 1987 | 1987 | if (!defined('_DIR_DB')) { |
| 1988 | - define('_DIR_DB', _DIR_ETC . 'bases/'); |
|
| 1988 | + define('_DIR_DB', _DIR_ETC.'bases/'); |
|
| 1989 | 1989 | } |
| 1990 | 1990 | if (!defined('_SQLITE_CHMOD')) { |
| 1991 | 1991 | define('_SQLITE_CHMOD', _SPIP_CHMOD); |
@@ -2092,9 +2092,9 @@ discard block |
||
| 2092 | 2092 | } |
| 2093 | 2093 | |
| 2094 | 2094 | // echapper les ' en '' |
| 2095 | - spip_log('Pas de methode ->quote pour echapper', 'sqlite.' . _LOG_INFO_IMPORTANTE); |
|
| 2095 | + spip_log('Pas de methode ->quote pour echapper', 'sqlite.'._LOG_INFO_IMPORTANTE); |
|
| 2096 | 2096 | |
| 2097 | - return ("'" . str_replace("'", "''", $v) . "'"); |
|
| 2097 | + return ("'".str_replace("'", "''", $v)."'"); |
|
| 2098 | 2098 | } |
| 2099 | 2099 | |
| 2100 | 2100 | |
@@ -2117,12 +2117,12 @@ discard block |
||
| 2117 | 2117 | $exp = "\n$expression "; |
| 2118 | 2118 | |
| 2119 | 2119 | if (!is_array($v)) { |
| 2120 | - return $exp . $v; |
|
| 2120 | + return $exp.$v; |
|
| 2121 | 2121 | } else { |
| 2122 | 2122 | if (strtoupper($join) === 'AND') { |
| 2123 | - return $exp . join("\n\t$join ", array_map('_sqlite_calculer_where', $v)); |
|
| 2123 | + return $exp.join("\n\t$join ", array_map('_sqlite_calculer_where', $v)); |
|
| 2124 | 2124 | } else { |
| 2125 | - return $exp . join($join, $v); |
|
| 2125 | + return $exp.join($join, $v); |
|
| 2126 | 2126 | } |
| 2127 | 2127 | } |
| 2128 | 2128 | } |
@@ -2156,17 +2156,17 @@ discard block |
||
| 2156 | 2156 | if (substr($k, -1) == '@') { |
| 2157 | 2157 | // c'est une jointure qui se refere au from precedent |
| 2158 | 2158 | // pas de virgule |
| 2159 | - $res .= ' ' . $v; |
|
| 2159 | + $res .= ' '.$v; |
|
| 2160 | 2160 | } else { |
| 2161 | 2161 | if (!is_numeric($k)) { |
| 2162 | 2162 | $p = strpos($v, ' '); |
| 2163 | 2163 | if ($p) { |
| 2164 | - $v = substr($v, 0, $p) . " AS '$k'" . substr($v, $p); |
|
| 2164 | + $v = substr($v, 0, $p)." AS '$k'".substr($v, $p); |
|
| 2165 | 2165 | } else { |
| 2166 | 2166 | $v .= " AS '$k'"; |
| 2167 | 2167 | } |
| 2168 | 2168 | } |
| 2169 | - $res .= ', ' . $v; |
|
| 2169 | + $res .= ', '.$v; |
|
| 2170 | 2170 | } |
| 2171 | 2171 | } |
| 2172 | 2172 | |
@@ -2304,13 +2304,13 @@ discard block |
||
| 2304 | 2304 | |
| 2305 | 2305 | $def_origine = sql_showtable($table_origine, false, $serveur); |
| 2306 | 2306 | if (!$def_origine or !isset($def_origine['field'])) { |
| 2307 | - spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite' . _LOG_ERREUR); |
|
| 2307 | + spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite'._LOG_ERREUR); |
|
| 2308 | 2308 | |
| 2309 | 2309 | return false; |
| 2310 | 2310 | } |
| 2311 | 2311 | |
| 2312 | 2312 | |
| 2313 | - $table_tmp = $table_origine . '_tmp'; |
|
| 2313 | + $table_tmp = $table_origine.'_tmp'; |
|
| 2314 | 2314 | |
| 2315 | 2315 | // 1) creer une table temporaire avec les modifications |
| 2316 | 2316 | // - DROP : suppression de la colonne |
@@ -2397,7 +2397,7 @@ discard block |
||
| 2397 | 2397 | } else { |
| 2398 | 2398 | // enlever KEY |
| 2399 | 2399 | $k = substr($k, 4); |
| 2400 | - $queries[] = "CREATE INDEX $table_destination" . "_$k ON $table_destination ($v)"; |
|
| 2400 | + $queries[] = "CREATE INDEX $table_destination"."_$k ON $table_destination ($v)"; |
|
| 2401 | 2401 | } |
| 2402 | 2402 | } |
| 2403 | 2403 | |
@@ -2408,7 +2408,7 @@ discard block |
||
| 2408 | 2408 | foreach ($queries as $q) { |
| 2409 | 2409 | if (!spip_sqlite::executer_requete($q, $serveur)) { |
| 2410 | 2410 | spip_log('SQLite : ALTER TABLE table :' |
| 2411 | - . " Erreur a l'execution de la requete : $q", 'sqlite.' . _LOG_ERREUR); |
|
| 2411 | + . " Erreur a l'execution de la requete : $q", 'sqlite.'._LOG_ERREUR); |
|
| 2412 | 2412 | spip_sqlite::annuler_transaction($serveur); |
| 2413 | 2413 | |
| 2414 | 2414 | return false; |
@@ -2498,27 +2498,27 @@ discard block |
||
| 2498 | 2498 | $enum = '(\s*\([^\)]*\))?'; |
| 2499 | 2499 | |
| 2500 | 2500 | $remplace = [ |
| 2501 | - '/enum' . $enum . '/is' => 'VARCHAR(255)', |
|
| 2501 | + '/enum'.$enum.'/is' => 'VARCHAR(255)', |
|
| 2502 | 2502 | '/COLLATE \w+_bin/is' => 'COLLATE BINARY', |
| 2503 | 2503 | '/COLLATE \w+_ci/is' => 'COLLATE NOCASE', |
| 2504 | 2504 | '/auto_increment/is' => '', |
| 2505 | 2505 | '/current_timestamp\(\)/is' => 'CURRENT_TIMESTAMP', // Fix export depuis mariaDB #4374 |
| 2506 | 2506 | '/(timestamp .* )ON .*$/is' => '\\1', |
| 2507 | 2507 | '/character set \w+/is' => '', |
| 2508 | - '/((big|small|medium|tiny)?int(eger)?)' . $num . '\s*unsigned/is' => '\\1 UNSIGNED', |
|
| 2508 | + '/((big|small|medium|tiny)?int(eger)?)'.$num.'\s*unsigned/is' => '\\1 UNSIGNED', |
|
| 2509 | 2509 | '/(text\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
| 2510 | - '/((char|varchar)' . $num . '\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
|
| 2510 | + '/((char|varchar)'.$num.'\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
|
| 2511 | 2511 | '/(datetime\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00 00:00:00'", |
| 2512 | 2512 | '/(date\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00'", |
| 2513 | 2513 | ]; |
| 2514 | 2514 | |
| 2515 | 2515 | // pour l'autoincrement, il faut des INTEGER NOT NULL PRIMARY KEY |
| 2516 | 2516 | $remplace_autocinc = [ |
| 2517 | - '/(big|small|medium|tiny)?int(eger)?' . $num . '/is' => 'INTEGER' |
|
| 2517 | + '/(big|small|medium|tiny)?int(eger)?'.$num.'/is' => 'INTEGER' |
|
| 2518 | 2518 | ]; |
| 2519 | 2519 | // pour les int non autoincrement, il faut un DEFAULT |
| 2520 | 2520 | $remplace_nonautocinc = [ |
| 2521 | - '/((big|small|medium|tiny)?int(eger)?' . $num . '\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0", |
|
| 2521 | + '/((big|small|medium|tiny)?int(eger)?'.$num.'\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0", |
|
| 2522 | 2522 | ]; |
| 2523 | 2523 | |
| 2524 | 2524 | if (is_string($query)) { |
@@ -2560,7 +2560,7 @@ discard block |
||
| 2560 | 2560 | return str_ireplace('BINARY', 'COLLATE BINARY', $champ); |
| 2561 | 2561 | } |
| 2562 | 2562 | if (preg_match(',^(char|varchar|(long|small|medium|tiny)?text),i', $champ)) { |
| 2563 | - return $champ . ' COLLATE NOCASE'; |
|
| 2563 | + return $champ.' COLLATE NOCASE'; |
|
| 2564 | 2564 | } |
| 2565 | 2565 | |
| 2566 | 2566 | return $champ; |
@@ -2650,14 +2650,14 @@ discard block |
||
| 2650 | 2650 | } else { |
| 2651 | 2651 | /* simuler le IF EXISTS - version 2 et sqlite < 3.3a */ |
| 2652 | 2652 | $a = spip_sqlite_showtable($nom, $serveur); |
| 2653 | - if (isset($a['key']['KEY ' . $nom])) { |
|
| 2653 | + if (isset($a['key']['KEY '.$nom])) { |
|
| 2654 | 2654 | return true; |
| 2655 | 2655 | } |
| 2656 | 2656 | } |
| 2657 | 2657 | } |
| 2658 | 2658 | |
| 2659 | 2659 | $temporary = $temporary ? ' TEMPORARY' : ''; |
| 2660 | - $q = "CREATE$temporary TABLE$ifnotexists $nom ($query" . ($keys ? ",$keys" : '') . ")\n"; |
|
| 2660 | + $q = "CREATE$temporary TABLE$ifnotexists $nom ($query".($keys ? ",$keys" : '').")\n"; |
|
| 2661 | 2661 | |
| 2662 | 2662 | return $q; |
| 2663 | 2663 | } |
@@ -2878,7 +2878,7 @@ discard block |
||
| 2878 | 2878 | $this->serveur = strtolower($serveur); |
| 2879 | 2879 | |
| 2880 | 2880 | if (!($this->link = _sqlite_link($this->serveur)) && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL)) { |
| 2881 | - spip_log('Aucune connexion sqlite (link)', 'sqlite.' . _LOG_ERREUR); |
|
| 2881 | + spip_log('Aucune connexion sqlite (link)', 'sqlite.'._LOG_ERREUR); |
|
| 2882 | 2882 | |
| 2883 | 2883 | return false; |
| 2884 | 2884 | } |
@@ -2924,7 +2924,7 @@ discard block |
||
| 2924 | 2924 | try { |
| 2925 | 2925 | $r = $this->link->query($query); |
| 2926 | 2926 | } catch (\PDOException $e) { |
| 2927 | - spip_log('PDOException: ' . $e->getMessage(), 'sqlite.' . _LOG_DEBUG); |
|
| 2927 | + spip_log('PDOException: '.$e->getMessage(), 'sqlite.'._LOG_DEBUG); |
|
| 2928 | 2928 | $r = false; |
| 2929 | 2929 | } |
| 2930 | 2930 | // sauvegarde de la requete (elle y est deja dans $r->queryString) |
@@ -2945,11 +2945,11 @@ discard block |
||
| 2945 | 2945 | |
| 2946 | 2946 | // loger les warnings/erreurs eventuels de sqlite remontant dans PHP |
| 2947 | 2947 | if ($e and $e instanceof \PDOException) { |
| 2948 | - $err = strip_tags($e->getMessage()) . ' in ' . $e->getFile() . ' line ' . $e->getLine(); |
|
| 2949 | - spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR); |
|
| 2948 | + $err = strip_tags($e->getMessage()).' in '.$e->getFile().' line '.$e->getLine(); |
|
| 2949 | + spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR); |
|
| 2950 | 2950 | } elseif ($err = (function_exists('error_get_last') ? error_get_last() : '') and $err != $last_error) { |
| 2951 | - $err = strip_tags($err['message']) . ' in ' . $err['file'] . ' line ' . $err['line']; |
|
| 2952 | - spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR); |
|
| 2951 | + $err = strip_tags($err['message']).' in '.$err['file'].' line '.$err['line']; |
|
| 2952 | + spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR); |
|
| 2953 | 2953 | } else { |
| 2954 | 2954 | $err = ''; |
| 2955 | 2955 | } |
@@ -3027,15 +3027,15 @@ discard block |
||
| 3027 | 3027 | // Correction Create Database |
| 3028 | 3028 | // Create Database -> requete ignoree |
| 3029 | 3029 | if (strpos($this->query, 'CREATE DATABASE') === 0) { |
| 3030 | - spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.' . _LOG_AVERTISSEMENT); |
|
| 3030 | + spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.'._LOG_AVERTISSEMENT); |
|
| 3031 | 3031 | $this->query = 'SELECT 1'; |
| 3032 | 3032 | } |
| 3033 | 3033 | |
| 3034 | 3034 | // Correction Insert Ignore |
| 3035 | 3035 | // INSERT IGNORE -> insert (tout court et pas 'insert or replace') |
| 3036 | 3036 | if (strpos($this->query, 'INSERT IGNORE') === 0) { |
| 3037 | - spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.' . _LOG_DEBUG); |
|
| 3038 | - $this->query = 'INSERT ' . substr($this->query, '13'); |
|
| 3037 | + spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.'._LOG_DEBUG); |
|
| 3038 | + $this->query = 'INSERT '.substr($this->query, '13'); |
|
| 3039 | 3039 | } |
| 3040 | 3040 | |
| 3041 | 3041 | // Correction des dates avec INTERVAL |
@@ -3063,7 +3063,7 @@ discard block |
||
| 3063 | 3063 | if (($this->sqlite_version == 2) && (strpos($this->query, 'USING') !== false)) { |
| 3064 | 3064 | spip_log( |
| 3065 | 3065 | "'USING (champ)' n'est pas reconnu en SQLite 2. Utilisez 'ON table1.champ = table2.champ'", |
| 3066 | - 'sqlite.' . _LOG_ERREUR |
|
| 3066 | + 'sqlite.'._LOG_ERREUR |
|
| 3067 | 3067 | ); |
| 3068 | 3068 | $this->query = preg_replace('/USING\s*\([^\)]*\)/', '', $this->query); |
| 3069 | 3069 | } |
@@ -3086,8 +3086,8 @@ discard block |
||
| 3086 | 3086 | } else { |
| 3087 | 3087 | $suite = ''; |
| 3088 | 3088 | } |
| 3089 | - $pref = ($this->prefixe) ? $this->prefixe . '_' : ''; |
|
| 3090 | - $this->query = preg_replace('/([,\s])spip_/S', '\1' . $pref, $this->query) . $suite; |
|
| 3089 | + $pref = ($this->prefixe) ? $this->prefixe.'_' : ''; |
|
| 3090 | + $this->query = preg_replace('/([,\s])spip_/S', '\1'.$pref, $this->query).$suite; |
|
| 3091 | 3091 | |
| 3092 | 3092 | // Correction zero AS x |
| 3093 | 3093 | // pg n'aime pas 0+x AS alias, sqlite, dans le meme style, |