@@ -54,15 +54,15 @@ discard block |
||
| 54 | 54 | function maj_1_934() { |
| 55 | 55 | // attention, en cas de mutualisation _DIR_IMG contient quelque chose comme sites/urldusite/IMG/ |
| 56 | 56 | // essayons en ne prenant que le dernier segment |
| 57 | - $dir_img = basename(_DIR_IMG) . '/'; |
|
| 58 | - $res = sql_query("SELECT fichier FROM spip_documents WHERE fichier LIKE " . sql_quote($dir_img . '%') . " LIMIT 0,1"); |
|
| 57 | + $dir_img = basename(_DIR_IMG).'/'; |
|
| 58 | + $res = sql_query("SELECT fichier FROM spip_documents WHERE fichier LIKE ".sql_quote($dir_img.'%')." LIMIT 0,1"); |
|
| 59 | 59 | if (!$row = sql_fetch($res)) { |
| 60 | 60 | // sinon on essaye avec le chemin complet |
| 61 | 61 | // il faut donc verifier qu'on a bien le bon nom de repertoire |
| 62 | 62 | $dir_img = substr(_DIR_IMG, strlen(_DIR_RACINE)); |
| 63 | 63 | } |
| 64 | 64 | $n = strlen($dir_img) + 1; |
| 65 | - sql_query("UPDATE spip_documents SET `fichier`=substring(fichier,$n) WHERE `fichier` LIKE " . sql_quote($dir_img . '%')); |
|
| 65 | + sql_query("UPDATE spip_documents SET `fichier`=substring(fichier,$n) WHERE `fichier` LIKE ".sql_quote($dir_img.'%')); |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | $GLOBALS['maj'][1934] = array(array('maj_1_934')); |
@@ -77,15 +77,15 @@ discard block |
||
| 77 | 77 | 'rubrique' => 'id_rubrique', |
| 78 | 78 | 'breve' => 'id_breve' |
| 79 | 79 | ) as $type => $id_table_objet) { |
| 80 | - $table_objet = "$type" . "s"; |
|
| 80 | + $table_objet = "$type"."s"; |
|
| 81 | 81 | $chapo = $type == 'article' ? ",a.chapo" : ""; |
| 82 | 82 | $res = sql_query("SELECT a.$id_table_objet,a.texte $chapo FROM spip_documents_$table_objet AS d JOIN spip_$table_objet AS a ON a.$id_table_objet=d.$id_table_objet GROUP BY $id_table_objet"); |
| 83 | 83 | while ($row = sql_fetch($res)) { |
| 84 | 84 | $GLOBALS['doublons_documents_inclus'] = array(); |
| 85 | - traiter_modeles(($chapo ? $row['chapo'] : "") . $row['texte'], true); // detecter les doublons |
|
| 85 | + traiter_modeles(($chapo ? $row['chapo'] : "").$row['texte'], true); // detecter les doublons |
|
| 86 | 86 | if (count($GLOBALS['doublons_documents_inclus'])) { |
| 87 | 87 | $id = $row[$id_table_objet]; |
| 88 | - $liste = "(" . implode(",$id,'oui'),(", $GLOBALS['doublons_documents_inclus']) . ",$id,'oui')"; |
|
| 88 | + $liste = "(".implode(",$id,'oui'),(", $GLOBALS['doublons_documents_inclus']).",$id,'oui')"; |
|
| 89 | 89 | sql_query("REPLACE INTO spip_documents_$table_objet (`id_document`,`$id_table_objet`,`vu`) VALUES $liste"); |
| 90 | 90 | } |
| 91 | 91 | } |
@@ -112,12 +112,12 @@ discard block |
||
| 112 | 112 | // et il faut qu'il corresponde au charset de la connexion qui est celui |
| 113 | 113 | // dans lequel on a ecrit le champ en blob |
| 114 | 114 | if ($charset = sql_getfetsel('@@character_set_connection')) { |
| 115 | - sql_alter("TABLE $table DEFAULT CHARACTER SET " . $charset); |
|
| 115 | + sql_alter("TABLE $table DEFAULT CHARACTER SET ".$charset); |
|
| 116 | 116 | } |
| 117 | 117 | $res = sql_query("SHOW FULL COLUMNS FROM $table LIKE '$champ'"); |
| 118 | 118 | if ($row = sql_fetch($res)) { |
| 119 | 119 | if (strtolower($row['Type']) != strtolower($type)) { |
| 120 | - $default = $row['Default'] ? (" DEFAULT " . sql_quote($row['Default'])) : ""; |
|
| 120 | + $default = $row['Default'] ? (" DEFAULT ".sql_quote($row['Default'])) : ""; |
|
| 121 | 121 | $notnull = ($row['Null'] == 'YES') ? "" : " NOT NULL"; |
| 122 | 122 | sql_alter("TABLE $table CHANGE $champ $champ $type $default $notnull"); |
| 123 | 123 | } |
@@ -158,12 +158,12 @@ discard block |
||
| 158 | 158 | $repli = true; |
| 159 | 159 | } |
| 160 | 160 | |
| 161 | - $s = sql_select('extension' . ($repli ? '' : ',id_type'), 'spip_types_documents'); |
|
| 161 | + $s = sql_select('extension'.($repli ? '' : ',id_type'), 'spip_types_documents'); |
|
| 162 | 162 | while ($t = sql_fetch($s)) { |
| 163 | 163 | if (isset($t['id_type'])) { |
| 164 | - sql_query("UPDATE spip_documents SET `extension`=" . sql_quote($t['extension']) . " WHERE `id_type`=" . sql_quote($t['id_type'])); |
|
| 164 | + sql_query("UPDATE spip_documents SET `extension`=".sql_quote($t['extension'])." WHERE `id_type`=".sql_quote($t['id_type'])); |
|
| 165 | 165 | } else { |
| 166 | - sql_query("UPDATE spip_documents SET `extension`=" . sql_quote($t['extension']) . " WHERE fichier LIKE " . sql_quote("%." . $t['extension'])); |
|
| 166 | + sql_query("UPDATE spip_documents SET `extension`=".sql_quote($t['extension'])." WHERE fichier LIKE ".sql_quote("%.".$t['extension'])); |
|
| 167 | 167 | } |
| 168 | 168 | } |
| 169 | 169 | $res = sql_select('extension', 'spip_documents', "extension='' OR extension is NULL"); |
@@ -408,10 +408,8 @@ discard block |
||
| 408 | 408 | 'mot' => 'id_mot', |
| 409 | 409 | 'syndic' => 'id_syndic' |
| 410 | 410 | ) as $type => $id_objet) { |
| 411 | - $table = ($type == 'syndic') ? $type : ($type . "s"); |
|
| 412 | - $date = ($type == 'breve') ? 'date_heure' : |
|
| 413 | - (($type == 'auteur') ? 'maj' : |
|
| 414 | - (($type == 'mot') ? 'maj' : 'date')); |
|
| 411 | + $table = ($type == 'syndic') ? $type : ($type."s"); |
|
| 412 | + $date = ($type == 'breve') ? 'date_heure' : (($type == 'auteur') ? 'maj' : (($type == 'mot') ? 'maj' : 'date')); |
|
| 415 | 413 | $q = @sql_select("url_propre AS url, $id_objet AS id_objet, '$type' AS type, $date as date", "spip_$table", |
| 416 | 414 | "url_propre<>''"); |
| 417 | 415 | if (!$q) { |
@@ -420,7 +418,7 @@ discard block |
||
| 420 | 418 | while ($r = sql_fetch($q)) { |
| 421 | 419 | sql_replace('spip_urls', $r); |
| 422 | 420 | } |
| 423 | - spip_log("table $table : " . sql_count($q) . " urls propres copiees"); |
|
| 421 | + spip_log("table $table : ".sql_count($q)." urls propres copiees"); |
|
| 424 | 422 | sql_alter("TABLE spip_$table DROP INDEX `url_propre`"); |
| 425 | 423 | sql_alter("TABLE spip_$table DROP `url_propre`"); |
| 426 | 424 | } |
@@ -461,7 +459,7 @@ discard block |
||
| 461 | 459 | } |
| 462 | 460 | |
| 463 | 461 | $ok &= sql_query("UPDATE spip_documents SET `mode`='image' WHERE `mode`='vignette'"); |
| 464 | - $ok &= sql_query("UPDATE spip_documents SET `mode`='vignette' WHERE `mode`='image' AND " . sql_in('id_document', |
|
| 462 | + $ok &= sql_query("UPDATE spip_documents SET `mode`='vignette' WHERE `mode`='image' AND ".sql_in('id_document', |
|
| 465 | 463 | $vignettes)); |
| 466 | 464 | } |
| 467 | 465 | if (!$ok) { |
@@ -84,7 +84,7 @@ |
||
| 84 | 84 | "fille.id_parent = maman.id_forum AND fille.id_thread <> maman.id_thread", '', "thread"); |
| 85 | 85 | while ($row = sql_fetch($r)) { |
| 86 | 86 | if ($row['thread'] == $precedent) { |
| 87 | - $discussion .= "," . $row['id']; |
|
| 87 | + $discussion .= ",".$row['id']; |
|
| 88 | 88 | } else { |
| 89 | 89 | if ($precedent) { |
| 90 | 90 | sql_updateq("spip_forum", array("id_thread" => $precedent), "id_forum IN ($discussion)"); |
@@ -55,7 +55,7 @@ |
||
| 55 | 55 | $prefs = unserialize($row['prefs']); |
| 56 | 56 | $l = $prefs['spip_lang']; |
| 57 | 57 | unset($prefs['spip_lang']); |
| 58 | - sql_query("UPDATE spip_auteurs SET lang=" . sql_quote($l) . ", prefs='" . sql_quote(serialize($prefs)) . "' WHERE id_auteur=" . $row['id_auteur']); |
|
| 58 | + sql_query("UPDATE spip_auteurs SET lang=".sql_quote($l).", prefs='".sql_quote(serialize($prefs))."' WHERE id_auteur=".$row['id_auteur']); |
|
| 59 | 59 | } |
| 60 | 60 | $u = sql_query("SELECT lang FROM spip_auteurs"); |
| 61 | 61 | maj_version(1.604, $u); |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | unset($forums_article); |
| 66 | 66 | $id_article = $row['id_article']; |
| 67 | 67 | $result2 = sql_query("SELECT id_forum FROM spip_forum WHERE id_article=$id_article"); |
| 68 | - for (; ;) { |
|
| 68 | + for (;;) { |
|
| 69 | 69 | unset($forums); |
| 70 | 70 | while ($row2 = sql_fetch($result2)) { |
| 71 | 71 | $forums[] = $row2['id_forum']; |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | unset($forums_breve); |
| 88 | 88 | $id_breve = $row['id_breve']; |
| 89 | 89 | $result2 = sql_query("SELECT id_forum FROM spip_forum WHERE id_breve=$id_breve"); |
| 90 | - for (; ;) { |
|
| 90 | + for (;;) { |
|
| 91 | 91 | unset($forums); |
| 92 | 92 | while ($row2 = sql_fetch($result2)) { |
| 93 | 93 | $forums[] = $row2['id_forum']; |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | unset($forums_rubrique); |
| 110 | 110 | $id_rubrique = $row['id_rubrique']; |
| 111 | 111 | $result2 = sql_query("SELECT id_forum FROM spip_forum WHERE id_rubrique=$id_rubrique"); |
| 112 | - for (; ;) { |
|
| 112 | + for (;;) { |
|
| 113 | 113 | |
| 114 | 114 | unset($forums); |
| 115 | 115 | while ($row2 = sql_fetch($result2)) { |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | while ($r = sql_fetch($result)) { |
| 144 | 144 | $htpass = generer_htpass($r['pass']); |
| 145 | 145 | $pass = md5($pass); |
| 146 | - sql_query("UPDATE spip_auteurs SET pass='$pass', htpass='$htpass' WHERE id_auteur=" . $r['id_auteur']); |
|
| 146 | + sql_query("UPDATE spip_auteurs SET pass='$pass', htpass='$htpass' WHERE id_auteur=".$r['id_auteur']); |
|
| 147 | 147 | } |
| 148 | 148 | maj_version(0.999); |
| 149 | 149 | } |
@@ -75,7 +75,7 @@ |
||
| 75 | 75 | preg_match(",-([0-9]+)\.(gif|jpg|png)$,i", $fichier, $match); |
| 76 | 76 | $id_type = intval($types[$match[2]]); |
| 77 | 77 | $num_img = $match[1]; |
| 78 | - $fichier = _DIR_IMG . $fichier; |
|
| 78 | + $fichier = _DIR_IMG.$fichier; |
|
| 79 | 79 | $taille = @filesize($fichier); |
| 80 | 80 | // ici on n'a pas les fonctions absctract ! |
| 81 | 81 | sql_query("INSERT INTO spip_documents (titre, id_type, fichier, mode, largeur, hauteur, taille) VALUES ('image $largeur x $hauteur', $id_type, '$fichier', 'vignette', '$largeur', '$hauteur', '$taille')"); |
@@ -167,12 +167,12 @@ discard block |
||
| 167 | 167 | // Le logo du site n'est plus le logo par defaut des rubriques |
| 168 | 168 | // mais pour assurer la compatibilite ascendante, on le duplique |
| 169 | 169 | if (upgrade_vers(1.912, $version_installee, $version_cible)) { |
| 170 | - @copy(_DIR_LOGOS . 'rubon0.gif', _DIR_LOGOS . 'siteon0.gif'); |
|
| 171 | - @copy(_DIR_LOGOS . 'ruboff0.gif', _DIR_LOGOS . 'siteoff0.gif'); |
|
| 172 | - @copy(_DIR_LOGOS . 'rubon0.jpg', _DIR_LOGOS . 'siteon0.jpg'); |
|
| 173 | - @copy(_DIR_LOGOS . 'ruboff0.jpg', _DIR_LOGOS . 'siteoff0.jpg'); |
|
| 174 | - @copy(_DIR_LOGOS . 'rubon0.png', _DIR_LOGOS . 'siteon0.png'); |
|
| 175 | - @copy(_DIR_LOGOS . 'ruboff0.png', _DIR_LOGOS . 'siteoff0.png'); |
|
| 170 | + @copy(_DIR_LOGOS.'rubon0.gif', _DIR_LOGOS.'siteon0.gif'); |
|
| 171 | + @copy(_DIR_LOGOS.'ruboff0.gif', _DIR_LOGOS.'siteoff0.gif'); |
|
| 172 | + @copy(_DIR_LOGOS.'rubon0.jpg', _DIR_LOGOS.'siteon0.jpg'); |
|
| 173 | + @copy(_DIR_LOGOS.'ruboff0.jpg', _DIR_LOGOS.'siteoff0.jpg'); |
|
| 174 | + @copy(_DIR_LOGOS.'rubon0.png', _DIR_LOGOS.'siteon0.png'); |
|
| 175 | + @copy(_DIR_LOGOS.'ruboff0.png', _DIR_LOGOS.'siteoff0.png'); |
|
| 176 | 176 | maj_version(1.912); |
| 177 | 177 | } |
| 178 | 178 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | 'plugin' |
| 258 | 258 | ); |
| 259 | 259 | foreach ($meta_serveur as $nom) { |
| 260 | - sql_query("UPDATE spip_meta SET `impt`='non' WHERE `nom`=" . sql_quote($nom)); |
|
| 260 | + sql_query("UPDATE spip_meta SET `impt`='non' WHERE `nom`=".sql_quote($nom)); |
|
| 261 | 261 | } |
| 262 | 262 | maj_version('1.922'); |
| 263 | 263 | } |
@@ -285,19 +285,19 @@ discard block |
||
| 285 | 285 | $f_session = preg_files('data', 'session_'); |
| 286 | 286 | $repertoire = _DIR_SESSIONS; |
| 287 | 287 | if (!@file_exists($repertoire)) { |
| 288 | - $repertoire = preg_replace(',' . _DIR_TMP . ',', '', $repertoire); |
|
| 288 | + $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
|
| 289 | 289 | $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
| 290 | 290 | } |
| 291 | 291 | foreach ($f_session as $f) { |
| 292 | 292 | $d = basename($f); |
| 293 | - @copy($f, $repertoire . $d); |
|
| 293 | + @copy($f, $repertoire.$d); |
|
| 294 | 294 | } |
| 295 | 295 | /* deplacement des visites */ |
| 296 | 296 | $f_visites = preg_files('data/visites'); |
| 297 | 297 | $repertoire = sous_repertoire(_DIR_TMP, 'visites'); |
| 298 | 298 | foreach ($f_visites as $f) { |
| 299 | 299 | $d = basename($f); |
| 300 | - @copy($f, $repertoire . $d); |
|
| 300 | + @copy($f, $repertoire.$d); |
|
| 301 | 301 | } |
| 302 | 302 | /* deplacement des upload */ |
| 303 | 303 | $auteurs = array(); |
@@ -308,27 +308,27 @@ discard block |
||
| 308 | 308 | $f_upload = preg_files('upload', -1, 10000, $auteurs); |
| 309 | 309 | $repertoire = _DIR_TRANSFERT; |
| 310 | 310 | if (!@file_exists($repertoire)) { |
| 311 | - $repertoire = preg_replace(',' . _DIR_TMP . ',', '', $repertoire); |
|
| 311 | + $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
|
| 312 | 312 | $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
| 313 | 313 | } |
| 314 | 314 | foreach ($auteurs as $login) { |
| 315 | - if (is_dir('upload/' . $login)) { |
|
| 315 | + if (is_dir('upload/'.$login)) { |
|
| 316 | 316 | $sous_repertoire = sous_repertoire(_DIR_TRANSFERT, $login); |
| 317 | 317 | } |
| 318 | 318 | } |
| 319 | 319 | foreach ($f_upload as $f) { |
| 320 | - @copy($f, _DIR_TMP . $f); |
|
| 320 | + @copy($f, _DIR_TMP.$f); |
|
| 321 | 321 | } |
| 322 | 322 | /* deplacement des dumps */ |
| 323 | 323 | $f_session = preg_files('data', 'dump'); |
| 324 | 324 | $repertoire = _DIR_DUMP; |
| 325 | 325 | if (!@file_exists($repertoire)) { |
| 326 | - $repertoire = preg_replace(',' . _DIR_TMP . ',', '', $repertoire); |
|
| 326 | + $repertoire = preg_replace(','._DIR_TMP.',', '', $repertoire); |
|
| 327 | 327 | $repertoire = sous_repertoire(_DIR_TMP, $repertoire); |
| 328 | 328 | } |
| 329 | 329 | foreach ($f_session as $f) { |
| 330 | 330 | $d = basename($f); |
| 331 | - @copy($f, $repertoire . $d); |
|
| 331 | + @copy($f, $repertoire.$d); |
|
| 332 | 332 | } |
| 333 | 333 | maj_version('1.925'); |
| 334 | 334 | } |
@@ -23,6 +23,6 @@ |
||
| 23 | 23 | } |
| 24 | 24 | |
| 25 | 25 | $GLOBALS['maj'][2021021800] = [ |
| 26 | - ['sql_alter', "TABLE spip_auteurs CHANGE imessage imessage VARCHAR(3) DEFAULT '' NOT NULL" ], |
|
| 27 | - ['sql_updateq', "spip_auteurs", ['imessage' => 'oui'], "imessage != 'non' OR imessage IS NULL" ], |
|
| 26 | + ['sql_alter', "TABLE spip_auteurs CHANGE imessage imessage VARCHAR(3) DEFAULT '' NOT NULL"], |
|
| 27 | + ['sql_updateq', "spip_auteurs", ['imessage' => 'oui'], "imessage != 'non' OR imessage IS NULL"], |
|
| 28 | 28 | ]; |
@@ -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 | } |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | $colonnes = substr($colonne_origine, 1, -1); |
| 361 | 361 | if (false !== strpos(",", $colonnes)) { |
| 362 | 362 | spip_log("SQLite : Erreur, impossible de creer un index sur plusieurs colonnes" |
| 363 | - . " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.' . _LOG_ERREUR); |
|
| 363 | + . " sans qu'il ait de nom ($table, ($colonnes))", 'sqlite.'._LOG_ERREUR); |
|
| 364 | 364 | break; |
| 365 | 365 | } else { |
| 366 | 366 | $nom_index = $colonnes; |
@@ -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 | |
@@ -1743,7 +1743,7 @@ discard block |
||
| 1743 | 1743 | // s'il y a une parenthèse fermante dans la clé |
| 1744 | 1744 | // ou dans la définition sans qu'il n'y ait une ouverture avant |
| 1745 | 1745 | if (false !== strpos($k, ')') or preg_match('/^[^\(]*\)/', $def)) { |
| 1746 | - $fields[$k_precedent] .= ',' . $k . ' ' . $def; |
|
| 1746 | + $fields[$k_precedent] .= ','.$k.' '.$def; |
|
| 1747 | 1747 | continue; |
| 1748 | 1748 | } |
| 1749 | 1749 | |
@@ -1778,13 +1778,13 @@ discard block |
||
| 1778 | 1778 | . 'ORDER BY substr(type,2,1), name'; |
| 1779 | 1779 | $a = spip_sqlite_query($query, $serveur, $requeter); |
| 1780 | 1780 | while ($r = spip_sqlite_fetch($a, null, $serveur)) { |
| 1781 | - $key = str_replace($nom_table . '_', '', $r['name']); // enlever le nom de la table ajoute a l'index |
|
| 1781 | + $key = str_replace($nom_table.'_', '', $r['name']); // enlever le nom de la table ajoute a l'index |
|
| 1782 | 1782 | $keytype = "KEY"; |
| 1783 | 1783 | if (strpos($r['sql'], "UNIQUE INDEX") !== false) { |
| 1784 | 1784 | $keytype = "UNIQUE KEY"; |
| 1785 | 1785 | } |
| 1786 | 1786 | $colonnes = preg_replace(',.*\((.*)\).*,', '$1', $r['sql']); |
| 1787 | - $keys[$keytype . ' ' . $key] = $colonnes; |
|
| 1787 | + $keys[$keytype.' '.$key] = $colonnes; |
|
| 1788 | 1788 | } |
| 1789 | 1789 | } |
| 1790 | 1790 | |
@@ -1833,7 +1833,7 @@ discard block |
||
| 1833 | 1833 | |
| 1834 | 1834 | $set = array(); |
| 1835 | 1835 | foreach ($champs as $champ => $val) { |
| 1836 | - $set[] = $champ . "=$val"; |
|
| 1836 | + $set[] = $champ."=$val"; |
|
| 1837 | 1837 | } |
| 1838 | 1838 | if (!empty($set)) { |
| 1839 | 1839 | return spip_sqlite_query( |
@@ -1887,7 +1887,7 @@ discard block |
||
| 1887 | 1887 | |
| 1888 | 1888 | $set = array(); |
| 1889 | 1889 | foreach ($champs as $champ => $val) { |
| 1890 | - $set[] = $champ . '=' . _sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : ''); |
|
| 1890 | + $set[] = $champ.'='._sqlite_calculer_cite($val, isset($fields[$champ]) ? $fields[$champ] : ''); |
|
| 1891 | 1891 | } |
| 1892 | 1892 | |
| 1893 | 1893 | return spip_sqlite_query( |
@@ -1913,7 +1913,7 @@ discard block |
||
| 1913 | 1913 | */ |
| 1914 | 1914 | function _sqlite_init() { |
| 1915 | 1915 | if (!defined('_DIR_DB')) { |
| 1916 | - define('_DIR_DB', _DIR_ETC . 'bases/'); |
|
| 1916 | + define('_DIR_DB', _DIR_ETC.'bases/'); |
|
| 1917 | 1917 | } |
| 1918 | 1918 | if (!defined('_SQLITE_CHMOD')) { |
| 1919 | 1919 | define('_SQLITE_CHMOD', _SPIP_CHMOD); |
@@ -2016,9 +2016,9 @@ discard block |
||
| 2016 | 2016 | } |
| 2017 | 2017 | |
| 2018 | 2018 | // echapper les ' en '' |
| 2019 | - spip_log("Pas de methode ->quote pour echapper", "sqlite." . _LOG_INFO_IMPORTANTE); |
|
| 2019 | + spip_log("Pas de methode ->quote pour echapper", "sqlite."._LOG_INFO_IMPORTANTE); |
|
| 2020 | 2020 | |
| 2021 | - return ("'" . str_replace("'", "''", $v) . "'"); |
|
| 2021 | + return ("'".str_replace("'", "''", $v)."'"); |
|
| 2022 | 2022 | } |
| 2023 | 2023 | |
| 2024 | 2024 | |
@@ -2041,12 +2041,12 @@ discard block |
||
| 2041 | 2041 | $exp = "\n$expression "; |
| 2042 | 2042 | |
| 2043 | 2043 | if (!is_array($v)) { |
| 2044 | - return $exp . $v; |
|
| 2044 | + return $exp.$v; |
|
| 2045 | 2045 | } else { |
| 2046 | 2046 | if (strtoupper($join) === 'AND') { |
| 2047 | - return $exp . join("\n\t$join ", array_map('_sqlite_calculer_where', $v)); |
|
| 2047 | + return $exp.join("\n\t$join ", array_map('_sqlite_calculer_where', $v)); |
|
| 2048 | 2048 | } else { |
| 2049 | - return $exp . join($join, $v); |
|
| 2049 | + return $exp.join($join, $v); |
|
| 2050 | 2050 | } |
| 2051 | 2051 | } |
| 2052 | 2052 | } |
@@ -2080,17 +2080,17 @@ discard block |
||
| 2080 | 2080 | if (substr($k, -1) == '@') { |
| 2081 | 2081 | // c'est une jointure qui se refere au from precedent |
| 2082 | 2082 | // pas de virgule |
| 2083 | - $res .= ' ' . $v; |
|
| 2083 | + $res .= ' '.$v; |
|
| 2084 | 2084 | } else { |
| 2085 | 2085 | if (!is_numeric($k)) { |
| 2086 | 2086 | $p = strpos($v, " "); |
| 2087 | 2087 | if ($p) { |
| 2088 | - $v = substr($v, 0, $p) . " AS '$k'" . substr($v, $p); |
|
| 2088 | + $v = substr($v, 0, $p)." AS '$k'".substr($v, $p); |
|
| 2089 | 2089 | } else { |
| 2090 | 2090 | $v .= " AS '$k'"; |
| 2091 | 2091 | } |
| 2092 | 2092 | } |
| 2093 | - $res .= ', ' . $v; |
|
| 2093 | + $res .= ', '.$v; |
|
| 2094 | 2094 | } |
| 2095 | 2095 | } |
| 2096 | 2096 | |
@@ -2228,13 +2228,13 @@ discard block |
||
| 2228 | 2228 | |
| 2229 | 2229 | $def_origine = sql_showtable($table_origine, false, $serveur); |
| 2230 | 2230 | if (!$def_origine or !isset($def_origine['field'])) { |
| 2231 | - spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite' . _LOG_ERREUR); |
|
| 2231 | + spip_log("Alter table impossible sur $table_origine : table non trouvee", 'sqlite'._LOG_ERREUR); |
|
| 2232 | 2232 | |
| 2233 | 2233 | return false; |
| 2234 | 2234 | } |
| 2235 | 2235 | |
| 2236 | 2236 | |
| 2237 | - $table_tmp = $table_origine . '_tmp'; |
|
| 2237 | + $table_tmp = $table_origine.'_tmp'; |
|
| 2238 | 2238 | |
| 2239 | 2239 | // 1) creer une table temporaire avec les modifications |
| 2240 | 2240 | // - DROP : suppression de la colonne |
@@ -2320,7 +2320,7 @@ discard block |
||
| 2320 | 2320 | } else { |
| 2321 | 2321 | // enlever KEY |
| 2322 | 2322 | $k = substr($k, 4); |
| 2323 | - $queries[] = "CREATE INDEX $table_destination" . "_$k ON $table_destination ($v)"; |
|
| 2323 | + $queries[] = "CREATE INDEX $table_destination"."_$k ON $table_destination ($v)"; |
|
| 2324 | 2324 | } |
| 2325 | 2325 | } |
| 2326 | 2326 | |
@@ -2331,7 +2331,7 @@ discard block |
||
| 2331 | 2331 | foreach ($queries as $q) { |
| 2332 | 2332 | if (!spip_sqlite::executer_requete($q, $serveur)) { |
| 2333 | 2333 | spip_log("SQLite : ALTER TABLE table :" |
| 2334 | - . " Erreur a l'execution de la requete : $q", 'sqlite.' . _LOG_ERREUR); |
|
| 2334 | + . " Erreur a l'execution de la requete : $q", 'sqlite.'._LOG_ERREUR); |
|
| 2335 | 2335 | spip_sqlite::annuler_transaction($serveur); |
| 2336 | 2336 | |
| 2337 | 2337 | return false; |
@@ -2420,27 +2420,27 @@ discard block |
||
| 2420 | 2420 | $enum = "(\s*\([^\)]*\))?"; |
| 2421 | 2421 | |
| 2422 | 2422 | $remplace = array( |
| 2423 | - '/enum' . $enum . '/is' => 'VARCHAR(255)', |
|
| 2423 | + '/enum'.$enum.'/is' => 'VARCHAR(255)', |
|
| 2424 | 2424 | '/COLLATE \w+_bin/is' => 'COLLATE BINARY', |
| 2425 | 2425 | '/COLLATE \w+_ci/is' => 'COLLATE NOCASE', |
| 2426 | 2426 | '/auto_increment/is' => '', |
| 2427 | 2427 | '/current_timestamp\(\)/is' => 'CURRENT_TIMESTAMP', // Fix export depuis mariaDB #4374 |
| 2428 | 2428 | '/(timestamp .* )ON .*$/is' => '\\1', |
| 2429 | 2429 | '/character set \w+/is' => '', |
| 2430 | - '/((big|small|medium|tiny)?int(eger)?)' . $num . '\s*unsigned/is' => '\\1 UNSIGNED', |
|
| 2430 | + '/((big|small|medium|tiny)?int(eger)?)'.$num.'\s*unsigned/is' => '\\1 UNSIGNED', |
|
| 2431 | 2431 | '/(text\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
| 2432 | - '/((char|varchar)' . $num . '\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
|
| 2432 | + '/((char|varchar)'.$num.'\s+not\s+null(\s+collate\s+\w+)?)\s*$/is' => "\\1 DEFAULT ''", |
|
| 2433 | 2433 | '/(datetime\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00 00:00:00'", |
| 2434 | 2434 | '/(date\s+not\s+null)\s*$/is' => "\\1 DEFAULT '0000-00-00'", |
| 2435 | 2435 | ); |
| 2436 | 2436 | |
| 2437 | 2437 | // pour l'autoincrement, il faut des INTEGER NOT NULL PRIMARY KEY |
| 2438 | 2438 | $remplace_autocinc = array( |
| 2439 | - '/(big|small|medium|tiny)?int(eger)?' . $num . '/is' => 'INTEGER' |
|
| 2439 | + '/(big|small|medium|tiny)?int(eger)?'.$num.'/is' => 'INTEGER' |
|
| 2440 | 2440 | ); |
| 2441 | 2441 | // pour les int non autoincrement, il faut un DEFAULT |
| 2442 | 2442 | $remplace_nonautocinc = array( |
| 2443 | - '/((big|small|medium|tiny)?int(eger)?' . $num . '\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0", |
|
| 2443 | + '/((big|small|medium|tiny)?int(eger)?'.$num.'\s+not\s+null)\s*$/is' => "\\1 DEFAULT 0", |
|
| 2444 | 2444 | ); |
| 2445 | 2445 | |
| 2446 | 2446 | if (is_string($query)) { |
@@ -2482,7 +2482,7 @@ discard block |
||
| 2482 | 2482 | return str_ireplace("BINARY", "COLLATE BINARY", $champ); |
| 2483 | 2483 | } |
| 2484 | 2484 | if (preg_match(",^(char|varchar|(long|small|medium|tiny)?text),i", $champ)) { |
| 2485 | - return $champ . " COLLATE NOCASE"; |
|
| 2485 | + return $champ." COLLATE NOCASE"; |
|
| 2486 | 2486 | } |
| 2487 | 2487 | |
| 2488 | 2488 | return $champ; |
@@ -2569,7 +2569,7 @@ discard block |
||
| 2569 | 2569 | } else { |
| 2570 | 2570 | /* simuler le IF EXISTS - version 2 et sqlite < 3.3a */ |
| 2571 | 2571 | $a = spip_sqlite_showtable($nom, $serveur); |
| 2572 | - if (isset($a['key']['KEY ' . $nom])) { |
|
| 2572 | + if (isset($a['key']['KEY '.$nom])) { |
|
| 2573 | 2573 | return true; |
| 2574 | 2574 | } |
| 2575 | 2575 | } |
@@ -2577,7 +2577,7 @@ discard block |
||
| 2577 | 2577 | } |
| 2578 | 2578 | |
| 2579 | 2579 | $temporary = $temporary ? ' TEMPORARY' : ''; |
| 2580 | - $q = "CREATE$temporary TABLE$ifnotexists $nom ($query" . ($keys ? ",$keys" : '') . ")\n"; |
|
| 2580 | + $q = "CREATE$temporary TABLE$ifnotexists $nom ($query".($keys ? ",$keys" : '').")\n"; |
|
| 2581 | 2581 | |
| 2582 | 2582 | return $q; |
| 2583 | 2583 | } |
@@ -2791,7 +2791,7 @@ discard block |
||
| 2791 | 2791 | $this->serveur = strtolower($serveur); |
| 2792 | 2792 | |
| 2793 | 2793 | if (!($this->link = _sqlite_link($this->serveur)) && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL)) { |
| 2794 | - spip_log("Aucune connexion sqlite (link)", 'sqlite.' . _LOG_ERREUR); |
|
| 2794 | + spip_log("Aucune connexion sqlite (link)", 'sqlite.'._LOG_ERREUR); |
|
| 2795 | 2795 | |
| 2796 | 2796 | return false; |
| 2797 | 2797 | } |
@@ -2837,7 +2837,7 @@ discard block |
||
| 2837 | 2837 | try { |
| 2838 | 2838 | $r = $this->link->query($query); |
| 2839 | 2839 | } catch (\PDOException $e) { |
| 2840 | - spip_log("PDOException: " . $e->getMessage(), 'sqlite.' . _LOG_DEBUG); |
|
| 2840 | + spip_log("PDOException: ".$e->getMessage(), 'sqlite.'._LOG_DEBUG); |
|
| 2841 | 2841 | $r = false; |
| 2842 | 2842 | } |
| 2843 | 2843 | // sauvegarde de la requete (elle y est deja dans $r->queryString) |
@@ -2858,11 +2858,11 @@ discard block |
||
| 2858 | 2858 | |
| 2859 | 2859 | // loger les warnings/erreurs eventuels de sqlite remontant dans PHP |
| 2860 | 2860 | if ($e and $e instanceof \PDOException) { |
| 2861 | - $err = strip_tags($e->getMessage()) . " in " . $e->getFile() . " line " . $e->getLine(); |
|
| 2862 | - spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR); |
|
| 2861 | + $err = strip_tags($e->getMessage())." in ".$e->getFile()." line ".$e->getLine(); |
|
| 2862 | + spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR); |
|
| 2863 | 2863 | } elseif ($err = (function_exists('error_get_last') ? error_get_last() : "") and $err != $last_error) { |
| 2864 | - $err = strip_tags($err['message']) . " in " . $err['file'] . " line " . $err['line']; |
|
| 2865 | - spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR); |
|
| 2864 | + $err = strip_tags($err['message'])." in ".$err['file']." line ".$err['line']; |
|
| 2865 | + spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR); |
|
| 2866 | 2866 | } else { |
| 2867 | 2867 | $err = ""; |
| 2868 | 2868 | } |
@@ -2941,15 +2941,15 @@ discard block |
||
| 2941 | 2941 | // Correction Create Database |
| 2942 | 2942 | // Create Database -> requete ignoree |
| 2943 | 2943 | if (strpos($this->query, 'CREATE DATABASE') === 0) { |
| 2944 | - spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.' . _LOG_AVERTISSEMENT); |
|
| 2944 | + spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.'._LOG_AVERTISSEMENT); |
|
| 2945 | 2945 | $this->query = "SELECT 1"; |
| 2946 | 2946 | } |
| 2947 | 2947 | |
| 2948 | 2948 | // Correction Insert Ignore |
| 2949 | 2949 | // INSERT IGNORE -> insert (tout court et pas 'insert or replace') |
| 2950 | 2950 | if (strpos($this->query, 'INSERT IGNORE') === 0) { |
| 2951 | - spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.' . _LOG_DEBUG); |
|
| 2952 | - $this->query = 'INSERT ' . substr($this->query, '13'); |
|
| 2951 | + spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.'._LOG_DEBUG); |
|
| 2952 | + $this->query = 'INSERT '.substr($this->query, '13'); |
|
| 2953 | 2953 | } |
| 2954 | 2954 | |
| 2955 | 2955 | // Correction des dates avec INTERVAL |
@@ -2974,7 +2974,7 @@ discard block |
||
| 2974 | 2974 | // problematique car la jointure ne se fait pas du coup. |
| 2975 | 2975 | if (($this->sqlite_version == 2) && (strpos($this->query, "USING") !== false)) { |
| 2976 | 2976 | spip_log("'USING (champ)' n'est pas reconnu en SQLite 2. Utilisez 'ON table1.champ = table2.champ'", |
| 2977 | - 'sqlite.' . _LOG_ERREUR); |
|
| 2977 | + 'sqlite.'._LOG_ERREUR); |
|
| 2978 | 2978 | $this->query = preg_replace('/USING\s*\([^\)]*\)/', '', $this->query); |
| 2979 | 2979 | } |
| 2980 | 2980 | |
@@ -2994,8 +2994,8 @@ discard block |
||
| 2994 | 2994 | } else { |
| 2995 | 2995 | $suite = ''; |
| 2996 | 2996 | } |
| 2997 | - $pref = ($this->prefixe) ? $this->prefixe . "_" : ""; |
|
| 2998 | - $this->query = preg_replace('/([,\s])spip_/S', '\1' . $pref, $this->query) . $suite; |
|
| 2997 | + $pref = ($this->prefixe) ? $this->prefixe."_" : ""; |
|
| 2998 | + $this->query = preg_replace('/([,\s])spip_/S', '\1'.$pref, $this->query).$suite; |
|
| 2999 | 2999 | |
| 3000 | 3000 | // Correction zero AS x |
| 3001 | 3001 | // pg n'aime pas 0+x AS alias, sqlite, dans le meme style, |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | // celle du texte) et public (spip_lang est la langue du texte) |
| 45 | 45 | $dir = _DIR_RESTREINT ? lang_dir() : lang_dir($GLOBALS['spip_lang']); |
| 46 | 46 | |
| 47 | - $p = 'puce' . (test_espace_prive() ? '_prive' : ''); |
|
| 47 | + $p = 'puce'.(test_espace_prive() ? '_prive' : ''); |
|
| 48 | 48 | if ($dir == 'rtl') { |
| 49 | 49 | $p .= '_rtl'; |
| 50 | 50 | } |
@@ -67,7 +67,7 @@ discard block |
||
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | if (!defined('_BALISES_BLOCS_REGEXP')) { |
| 70 | - define('_BALISES_BLOCS_REGEXP', ',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS'); |
|
| 70 | + define('_BALISES_BLOCS_REGEXP', ',</?('._BALISES_BLOCS.')[>[:space:]],iS'); |
|
| 71 | 71 | } |
| 72 | 72 | |
| 73 | 73 | // |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | |
| 86 | 86 | // Tester si on echappe en span ou en div |
| 87 | 87 | if (is_null($mode) or !in_array($mode, array('div', 'span'))) { |
| 88 | - $mode = preg_match(',</?(' . _BALISES_BLOCS . ')[>[:space:]],iS', $rempl) ? 'div' : 'span'; |
|
| 88 | + $mode = preg_match(',</?('._BALISES_BLOCS.')[>[:space:]],iS', $rempl) ? 'div' : 'span'; |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | // Decouper en morceaux, base64 a des probleme selon la taille de la pile |
@@ -117,11 +117,11 @@ discard block |
||
| 117 | 117 | // echapper les < dans <code> |
| 118 | 118 | // on utilise _PROTEGE_BLOCS pour simplifier le code et la maintenance, mais on est interesse que par <code> |
| 119 | 119 | if (strpos($pre, "<") !== false |
| 120 | - and preg_match_all(_PROTEGE_BLOCS, $pre, $matches, PREG_SET_ORDER)){ |
|
| 120 | + and preg_match_all(_PROTEGE_BLOCS, $pre, $matches, PREG_SET_ORDER)) { |
|
| 121 | 121 | |
| 122 | - foreach ($matches as $m){ |
|
| 123 | - if ($m[1]==='code'){ |
|
| 124 | - $code = "<code" . $m[2] . ">" . spip_htmlspecialchars($m[3]) . "</code>"; |
|
| 122 | + foreach ($matches as $m) { |
|
| 123 | + if ($m[1] === 'code') { |
|
| 124 | + $code = "<code".$m[2].">".spip_htmlspecialchars($m[3])."</code>"; |
|
| 125 | 125 | $pre = str_replace($m[0], $code, $pre); |
| 126 | 126 | } |
| 127 | 127 | } |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | // Echapper les <code>...</ code> |
| 133 | 133 | // https://code.spip.net/@traiter_echap_code_dist |
| 134 | 134 | function traiter_echap_code_dist($regs) { |
| 135 | - list(, , $att, $corps) = $regs; |
|
| 135 | + list(,, $att, $corps) = $regs; |
|
| 136 | 136 | $echap = spip_htmlspecialchars($corps); // il ne faut pas passer dans entites_html, ne pas transformer les &#xxx; du code ! |
| 137 | 137 | |
| 138 | 138 | // ne pas mettre le <div...> s'il n'y a qu'une ligne |
@@ -143,9 +143,9 @@ discard block |
||
| 143 | 143 | $echap = nl2br($echap); |
| 144 | 144 | $echap = "<div style='text-align: left;' " |
| 145 | 145 | . "class='spip_code' dir='ltr'><code$att>" |
| 146 | - . $echap . "</code></div>"; |
|
| 146 | + . $echap."</code></div>"; |
|
| 147 | 147 | } else { |
| 148 | - $echap = "<code$att class='spip_code' dir='ltr'>" . $echap . "</code>"; |
|
| 148 | + $echap = "<code$att class='spip_code' dir='ltr'>".$echap."</code>"; |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | $echap = str_replace("\t", " ", $echap); |
@@ -222,10 +222,10 @@ discard block |
||
| 222 | 222 | $echap = $regs[0]; |
| 223 | 223 | } // sinon les traiter selon le cas |
| 224 | 224 | else { |
| 225 | - if (function_exists($f = 'traiter_echap_' . strtolower($regs[1]))) { |
|
| 225 | + if (function_exists($f = 'traiter_echap_'.strtolower($regs[1]))) { |
|
| 226 | 226 | $echap = $f($regs); |
| 227 | 227 | } else { |
| 228 | - if (function_exists($f = $f . '_dist')) { |
|
| 228 | + if (function_exists($f = $f.'_dist')) { |
|
| 229 | 229 | $echap = $f($regs); |
| 230 | 230 | } |
| 231 | 231 | } |
@@ -245,7 +245,7 @@ discard block |
||
| 245 | 245 | // (derogatoire car on ne peut pas faire passer < ? ... ? > |
| 246 | 246 | // dans une callback autonommee |
| 247 | 247 | if (strpos($preg ? $preg : _PROTEGE_BLOCS, 'script') !== false) { |
| 248 | - if (strpos($letexte, "<" . "?") !== false and preg_match_all(',<[?].*($|[?]>),UisS', |
|
| 248 | + if (strpos($letexte, "<"."?") !== false and preg_match_all(',<[?].*($|[?]>),UisS', |
|
| 249 | 249 | $letexte, $matches, PREG_SET_ORDER) |
| 250 | 250 | ) { |
| 251 | 251 | foreach ($matches as $regs) { |
@@ -270,7 +270,7 @@ discard block |
||
| 270 | 270 | $max_prof = 5; |
| 271 | 271 | while (strpos($letexte, "<") !== false |
| 272 | 272 | and |
| 273 | - preg_match_all(',<(span|div)\sclass=[\'"]base64' . $source . '[\'"]\s(.*)>\s*</\1>,UmsS', |
|
| 273 | + preg_match_all(',<(span|div)\sclass=[\'"]base64'.$source.'[\'"]\s(.*)>\s*</\1>,UmsS', |
|
| 274 | 274 | $letexte, $regs, PREG_SET_ORDER) |
| 275 | 275 | and $max_prof--) { |
| 276 | 276 | foreach ($regs as $reg) { |
@@ -283,7 +283,7 @@ discard block |
||
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | if ($at) { |
| 286 | - $rempl = '<' . $reg[1] . '>' . $rempl . '</' . $reg[1] . '>'; |
|
| 286 | + $rempl = '<'.$reg[1].'>'.$rempl.'</'.$reg[1].'>'; |
|
| 287 | 287 | foreach ($at as $attr => $a) { |
| 288 | 288 | $rempl = inserer_attribut($rempl, $attr, $a); |
| 289 | 289 | } |
@@ -362,8 +362,8 @@ discard block |
||
| 362 | 362 | $texte = nettoyer_raccourcis_typo($texte); |
| 363 | 363 | |
| 364 | 364 | // balises de sauts de ligne et paragraphe |
| 365 | - $texte = preg_replace("/<p( [^>]*)?" . ">/", "\r", $texte); |
|
| 366 | - $texte = preg_replace("/<br( [^>]*)?" . ">/", "\n", $texte); |
|
| 365 | + $texte = preg_replace("/<p( [^>]*)?".">/", "\r", $texte); |
|
| 366 | + $texte = preg_replace("/<br( [^>]*)?".">/", "\n", $texte); |
|
| 367 | 367 | |
| 368 | 368 | // on repasse les doubles \n en \r que nettoyer_raccourcis_typo() a pu modifier |
| 369 | 369 | $texte = str_replace("\n\n", "\r", $texte); |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | // supprimer les tags |
| 372 | 372 | $texte = supprimer_tags($texte); |
| 373 | 373 | $texte = trim(str_replace("\n", " ", $texte)); |
| 374 | - $texte .= "\n"; // marquer la fin |
|
| 374 | + $texte .= "\n"; // marquer la fin |
|
| 375 | 375 | |
| 376 | 376 | // corriger la longueur de coupe |
| 377 | 377 | // en fonction de la presence de caracteres utf |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | // couper au mot precedent |
| 387 | 387 | $long = spip_substr($texte, 0, max($taille - 4, 1)); |
| 388 | 388 | $u = $GLOBALS['meta']['pcre_u']; |
| 389 | - $court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long); |
|
| 389 | + $court = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long); |
|
| 390 | 390 | if (is_null($suite)) { |
| 391 | 391 | $suite = (defined('_COUPER_SUITE') ? _COUPER_SUITE : ' (...)'); |
| 392 | 392 | } |
@@ -396,7 +396,7 @@ discard block |
||
| 396 | 396 | if (spip_strlen($court) < max(0.75 * $taille, 2)) { |
| 397 | 397 | $points = ''; |
| 398 | 398 | $long = spip_substr($texte, 0, $taille); |
| 399 | - $texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/" . $u, "\\1", $long); |
|
| 399 | + $texte = preg_replace("/([^\s][\s]+)[^\s]*\n?$/".$u, "\\1", $long); |
|
| 400 | 400 | // encore trop court ? couper au caractere |
| 401 | 401 | if (spip_strlen($texte) < 0.75 * $taille) { |
| 402 | 402 | $texte = $long; |
@@ -416,7 +416,7 @@ discard block |
||
| 416 | 416 | // supprimer l'eventuelle entite finale mal coupee |
| 417 | 417 | $texte = preg_replace('/&#?[a-z0-9]*$/S', '', $texte); |
| 418 | 418 | |
| 419 | - return quote_amp(trim($texte)) . $points; |
|
| 419 | + return quote_amp(trim($texte)).$points; |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | |
@@ -429,16 +429,16 @@ discard block |
||
| 429 | 429 | define('_PROTEGE_JS_MODELES', creer_uniqid()); |
| 430 | 430 | } |
| 431 | 431 | foreach ($r as $regs) { |
| 432 | - $t = str_replace($regs[0], code_echappement($regs[0], 'javascript' . _PROTEGE_JS_MODELES), $t); |
|
| 432 | + $t = str_replace($regs[0], code_echappement($regs[0], 'javascript'._PROTEGE_JS_MODELES), $t); |
|
| 433 | 433 | } |
| 434 | 434 | } |
| 435 | - if (preg_match_all(',<\?php.*?($|\?' . '>),isS', $t, $r, PREG_SET_ORDER)) { |
|
| 435 | + if (preg_match_all(',<\?php.*?($|\?'.'>),isS', $t, $r, PREG_SET_ORDER)) { |
|
| 436 | 436 | if (!defined('_PROTEGE_PHP_MODELES')) { |
| 437 | 437 | include_spip('inc/acces'); |
| 438 | 438 | define('_PROTEGE_PHP_MODELES', creer_uniqid()); |
| 439 | 439 | } |
| 440 | 440 | foreach ($r as $regs) { |
| 441 | - $t = str_replace($regs[0], code_echappement($regs[0], 'php' . _PROTEGE_PHP_MODELES), $t); |
|
| 441 | + $t = str_replace($regs[0], code_echappement($regs[0], 'php'._PROTEGE_PHP_MODELES), $t); |
|
| 442 | 442 | } |
| 443 | 443 | } |
| 444 | 444 | } |
@@ -473,7 +473,7 @@ discard block |
||
| 473 | 473 | * @param bool $strict |
| 474 | 474 | * @return string |
| 475 | 475 | */ |
| 476 | -function echapper_html_suspect($texte, $strict=true) { |
|
| 476 | +function echapper_html_suspect($texte, $strict = true) { |
|
| 477 | 477 | static $echapper_html_suspect; |
| 478 | 478 | if (!$texte or !is_string($texte)) { |
| 479 | 479 | return $texte; |
@@ -495,8 +495,8 @@ discard block |
||
| 495 | 495 | // quand c'est du texte qui passe par propre on est plus coulant tant qu'il y a pas d'attribut du type onxxx= |
| 496 | 496 | // car sinon on declenche sur les modeles ou ressources |
| 497 | 497 | if (!$strict and |
| 498 | - (strpos($texte,'on') === false or !preg_match(",<\w+.*\bon\w+\s*=,UimsS", $texte)) |
|
| 499 | - ){ |
|
| 498 | + (strpos($texte, 'on') === false or !preg_match(",<\w+.*\bon\w+\s*=,UimsS", $texte)) |
|
| 499 | + ) { |
|
| 500 | 500 | return $texte; |
| 501 | 501 | } |
| 502 | 502 | |
@@ -575,9 +575,9 @@ discard block |
||
| 575 | 575 | **/ |
| 576 | 576 | function supprime_img($letexte, $message = null) { |
| 577 | 577 | if ($message === null) { |
| 578 | - $message = '(' . _T('img_indisponible') . ')'; |
|
| 578 | + $message = '('._T('img_indisponible').')'; |
|
| 579 | 579 | } |
| 580 | 580 | |
| 581 | - return preg_replace(',<(img|doc|emb)([0-9]+)(\|([^>]*))?' . '\s*/?' . '>,i', |
|
| 581 | + return preg_replace(',<(img|doc|emb)([0-9]+)(\|([^>]*))?'.'\s*/?'.'>,i', |
|
| 582 | 582 | $message, $letexte); |
| 583 | 583 | } |