@@ -45,8 +45,8 @@ |
||
| 45 | 45 | |
| 46 | 46 | echo debut_grand_cadre(true); |
| 47 | 47 | echo boite_ouvrir(_T('info_message_technique'), 'notice'); |
| 48 | - echo '<p>' . _T('info_procedure_maj_version') . '</p>', |
|
| 49 | - '<p>' . _T('info_administrateur_site_01') . '</p>'; |
|
| 48 | + echo '<p>'._T('info_procedure_maj_version').'</p>', |
|
| 49 | + '<p>'._T('info_administrateur_site_01').'</p>'; |
|
| 50 | 50 | echo bouton_action(_T('bouton_mettre_a_jour_base'), generer_url_ecrire('upgrade', 'reinstall=non')); |
| 51 | 51 | echo boite_fermer(); |
| 52 | 52 | // masquer les erreurs sql sur cette page car proviennent de la base pas a jour ! |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | $message = _T('avis_acces_interdit_prive', ['exec' => _request('exec')]); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | - $contenu = "<h1 class='grostitre'>" . _T('info_acces_interdit') . '</h1>' . $message; |
|
| 40 | + $contenu = "<h1 class='grostitre'>"._T('info_acces_interdit').'</h1>'.$message; |
|
| 41 | 41 | |
| 42 | 42 | if (_request('var_zajax')) { |
| 43 | 43 | include_spip('inc/actions'); |
@@ -42,7 +42,7 @@ |
||
| 42 | 42 | echo pipeline('affiche_droite', ['args' => ['exec' => '404', 'exec_erreur' => $exec], 'data' => '']); |
| 43 | 43 | |
| 44 | 44 | echo debut_droite('404', true); |
| 45 | - echo "<h1 class='grostitre'>" . _T('fichier_introuvable', ['fichier' => $exec]) . '</h1>'; |
|
| 45 | + echo "<h1 class='grostitre'>"._T('fichier_introuvable', ['fichier' => $exec]).'</h1>'; |
|
| 46 | 46 | echo pipeline('affiche_milieu', ['args' => ['exec' => '404', 'exec_erreur' => $exec], 'data' => '']); |
| 47 | 47 | |
| 48 | 48 | echo fin_gauche(), fin_page(); |
@@ -68,15 +68,15 @@ discard block |
||
| 68 | 68 | $where = preg_split(',\s+,', $type); |
| 69 | 69 | if ($where) { |
| 70 | 70 | foreach ($where as $k => $v) { |
| 71 | - $where[$k] = "'%" . substr(str_replace('%', '\%', sql_quote($v, '', 'string')), 1, -1) . "%'"; |
|
| 71 | + $where[$k] = "'%".substr(str_replace('%', '\%', sql_quote($v, '', 'string')), 1, -1)."%'"; |
|
| 72 | 72 | } |
| 73 | - $where_titre = ('(titre LIKE ' . join(' AND titre LIKE ', $where) . ')'); |
|
| 74 | - $where_desc = ('(descriptif LIKE ' . join(' AND descriptif LIKE ', $where) . ')'); |
|
| 75 | - $where_id = ('(id_rubrique = ' . intval($type) . ')'); |
|
| 73 | + $where_titre = ('(titre LIKE '.join(' AND titre LIKE ', $where).')'); |
|
| 74 | + $where_desc = ('(descriptif LIKE '.join(' AND descriptif LIKE ', $where).')'); |
|
| 75 | + $where_id = ('(id_rubrique = '.intval($type).')'); |
|
| 76 | 76 | |
| 77 | 77 | if ($exclus) { |
| 78 | 78 | include_spip('inc/rubriques'); |
| 79 | - $where_exclus = ' AND ' . sql_in('id_rubrique', calcul_branche_in($exclus), 'NOT'); |
|
| 79 | + $where_exclus = ' AND '.sql_in('id_rubrique', calcul_branche_in($exclus), 'NOT'); |
|
| 80 | 80 | } else { |
| 81 | 81 | $where_exclus = ''; |
| 82 | 82 | } |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | |
| 107 | 107 | if ($points) { |
| 108 | 108 | arsort($points); |
| 109 | - $style = " style='background-image: url(" . chemin_image('secteur-12.png') . ")'"; |
|
| 109 | + $style = " style='background-image: url(".chemin_image('secteur-12.png').")'"; |
|
| 110 | 110 | foreach ($rub as $k => $v) { |
| 111 | 111 | $rub[$k]['atts'] = ($v['id_parent'] ? $style : '') |
| 112 | 112 | . " class='petite-rubrique'"; |
@@ -139,13 +139,13 @@ discard block |
||
| 139 | 139 | if (!$ids) { |
| 140 | 140 | return "<br /><br /><div style='padding: 5px; color: red;'><b>" |
| 141 | 141 | . spip_htmlentities($type) |
| 142 | - . '</b> : ' . _T('avis_aucun_resultat') . '</div>'; |
|
| 142 | + . '</b> : '._T('avis_aucun_resultat').'</div>'; |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | $ret = ''; |
| 146 | 146 | $info = generer_url_ecrire('informer', "type=rubrique&rac=$rac&id="); |
| 147 | 147 | |
| 148 | - $onClick = "aff_selection(this.firstChild.title,'$rac" . "_selection','$info', event)"; |
|
| 148 | + $onClick = "aff_selection(this.firstChild.title,'$rac"."_selection','$info', event)"; |
|
| 149 | 149 | |
| 150 | 150 | $ondbClick = "$do(this.firstChild.firstChild.nodeValue,this.firstChild.title,'selection_rubrique', 'id_parent');"; |
| 151 | 151 | |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | . '</b><p> ' |
| 45 | 45 | . _T( |
| 46 | 46 | 'texte_nouvelle_version_spip_2', |
| 47 | - ['connect' => '<tt>' . _FILE_CONNECT . '</tt>'] |
|
| 47 | + ['connect' => '<tt>'._FILE_CONNECT.'</tt>'] |
|
| 48 | 48 | ) |
| 49 | 49 | . generer_form_ecrire( |
| 50 | 50 | 'upgrade', |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | $GLOBALS['meta']['version_installee'] = 0.0; |
| 66 | 66 | } else { |
| 67 | 67 | $GLOBALS['meta']['version_installee'] = |
| 68 | - (double)str_replace(',', '.', $GLOBALS['meta']['version_installee']); |
|
| 68 | + (double) str_replace(',', '.', $GLOBALS['meta']['version_installee']); |
|
| 69 | 69 | } |
| 70 | 70 | # NB: str_replace car, sur club-internet, il semble que version_installe soit |
| 71 | 71 | # enregistree au format '1,812' et non '1.812' |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | $commentaire = _T('texte_mise_a_niveau_base_1'); |
| 80 | 80 | } |
| 81 | 81 | |
| 82 | - $commentaire .= '<br />[' . $GLOBALS['meta']['version_installee'] . '/' . $GLOBALS['spip_version_base'] . ']'; |
|
| 82 | + $commentaire .= '<br />['.$GLOBALS['meta']['version_installee'].'/'.$GLOBALS['spip_version_base'].']'; |
|
| 83 | 83 | |
| 84 | 84 | $_POST['reinstall'] = 'non'; // pour copy_request dans admin |
| 85 | 85 | include_spip('inc/headers'); |
@@ -144,11 +144,11 @@ discard block |
||
| 144 | 144 | if ($quoi !== 'actifs') { |
| 145 | 145 | $lpf = liste_plugin_files(); |
| 146 | 146 | if ($lpf) { |
| 147 | - echo '<p>' . _T('texte_presente_plugin') . '</p>'; |
|
| 147 | + echo '<p>'._T('texte_presente_plugin').'</p>'; |
|
| 148 | 148 | } else { |
| 149 | 149 | if (!@is_dir(_DIR_PLUGINS)) { |
| 150 | - echo '<p>' . _T('plugin_info_automatique_ftp', ['rep' => joli_repertoire(_DIR_PLUGINS)]) |
|
| 151 | - . ' — ' . _T('plugin_info_automatique_creer') . '</p>'; |
|
| 150 | + echo '<p>'._T('plugin_info_automatique_ftp', ['rep' => joli_repertoire(_DIR_PLUGINS)]) |
|
| 151 | + . ' — '._T('plugin_info_automatique_creer').'</p>'; |
|
| 152 | 152 | } |
| 153 | 153 | } |
| 154 | 154 | $lcpaffiche = $lpf; |
@@ -169,10 +169,10 @@ discard block |
||
| 169 | 169 | if (defined('_DIR_PLUGINS_SUPPL')) { |
| 170 | 170 | $nb += count($lcpas); |
| 171 | 171 | } |
| 172 | - echo '<h3>' . sinon( |
|
| 172 | + echo '<h3>'.sinon( |
|
| 173 | 173 | singulier_ou_pluriel($nb, 'plugins_actif_un', 'plugins_actifs', 'count'), |
| 174 | 174 | _T('plugins_actif_aucun') |
| 175 | - ) . '</h3>'; |
|
| 175 | + ).'</h3>'; |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | if (empty($format)) { |
@@ -189,7 +189,7 @@ discard block |
||
| 189 | 189 | |
| 190 | 190 | if ($corps) { |
| 191 | 191 | $corps .= "\n<div class='boutons' style='display:none;'>" |
| 192 | - . "<input type='submit' class='submit save' value='" . _T('bouton_enregistrer') |
|
| 192 | + . "<input type='submit' class='submit save' value='"._T('bouton_enregistrer') |
|
| 193 | 193 | . "' />" |
| 194 | 194 | . '</div>'; |
| 195 | 195 | } |
@@ -263,7 +263,7 @@ discard block |
||
| 263 | 263 | . debut_cadre_trait_couleur('', true, '', _T('plugins_liste_dist'), 'liste_plugins_dist') |
| 264 | 264 | . '<p>' |
| 265 | 265 | . _T('plugin_info_plugins_dist_1', ['plugins_dist' => joli_repertoire(_DIR_PLUGINS_DIST)]) |
| 266 | - . '<br />' . _T('plugin_info_plugins_dist_2') |
|
| 266 | + . '<br />'._T('plugin_info_plugins_dist_2') |
|
| 267 | 267 | . '</p>' |
| 268 | 268 | . $liste |
| 269 | 269 | . fin_cadre_trait_couleur(true) |
@@ -286,7 +286,7 @@ discard block |
||
| 286 | 286 | $res = debut_cadre_enfonce('', true, '', _T('plugin_librairies_installees')); |
| 287 | 287 | $res .= '<dl>'; |
| 288 | 288 | foreach ($libs as $lib => $rep) { |
| 289 | - $res .= "<dt>$lib</dt><dd>" . joli_repertoire($rep) . "</dd>\n"; |
|
| 289 | + $res .= "<dt>$lib</dt><dd>".joli_repertoire($rep)."</dd>\n"; |
|
| 290 | 290 | } |
| 291 | 291 | $res .= '</dl>'; |
| 292 | 292 | $res .= fin_cadre_enfonce(true); |
@@ -305,7 +305,7 @@ discard block |
||
| 305 | 305 | $libs = []; |
| 306 | 306 | foreach (array_reverse(creer_chemin()) as $d) { |
| 307 | 307 | if ( |
| 308 | - is_dir($dir = $d . 'lib/') |
|
| 308 | + is_dir($dir = $d.'lib/') |
|
| 309 | 309 | and $t = opendir($dir) |
| 310 | 310 | ) { |
| 311 | 311 | while (($f = readdir($t)) !== false) { |
@@ -36,13 +36,13 @@ |
||
| 36 | 36 | spip_log('Erreur base de donnees'); |
| 37 | 37 | echo minipres( |
| 38 | 38 | _T('info_travaux_titre'), |
| 39 | - _T('titre_probleme_technique') . '<p><tt>' . sql_errno() . ' ' . sql_error() . '</tt></p>' |
|
| 39 | + _T('titre_probleme_technique').'<p><tt>'.sql_errno().' '.sql_error().'</tt></p>' |
|
| 40 | 40 | ); |
| 41 | 41 | } else { |
| 42 | 42 | $res = base_saisie_tables('delete', $res); |
| 43 | 43 | include_spip('inc/headers'); |
| 44 | - $res = "\n<ol style='text-align:left'><li>\n" . |
|
| 45 | - join("</li>\n<li>", $res) . |
|
| 44 | + $res = "\n<ol style='text-align:left'><li>\n". |
|
| 45 | + join("</li>\n<li>", $res). |
|
| 46 | 46 | '</li></ol>'; |
| 47 | 47 | $admin = charger_fonction('admin', 'inc'); |
| 48 | 48 | $res = $admin('delete_all', _T('titre_page_delete_all'), $res); |
@@ -26,7 +26,7 @@ |
||
| 26 | 26 | |
| 27 | 27 | |
| 28 | 28 | $fond = _request('exec'); |
| 29 | -$GLOBALS['delais'] = 0;// pas de cache ! |
|
| 29 | +$GLOBALS['delais'] = 0; // pas de cache ! |
|
| 30 | 30 | // Securite |
| 31 | 31 | if (strstr($fond, '/')) { |
| 32 | 32 | if ( |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | if (!$link) { |
| 66 | 66 | $erreurs[] = pg_last_error(); |
| 67 | 67 | foreach ($erreurs as $e) { |
| 68 | - spip_log('Echec pg_connect. Erreur : ' . $e, 'pg.' . _LOG_HS); |
|
| 68 | + spip_log('Echec pg_connect. Erreur : '.$e, 'pg.'._LOG_HS); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | return false; |
@@ -83,8 +83,8 @@ discard block |
||
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | spip_log( |
| 86 | - "Connexion vers $host, base $db, prefixe $prefixe " . ($link ? 'operationnelle' : 'impossible'), |
|
| 87 | - 'pg.' . _LOG_DEBUG |
|
| 86 | + "Connexion vers $host, base $db, prefixe $prefixe ".($link ? 'operationnelle' : 'impossible'), |
|
| 87 | + 'pg.'._LOG_DEBUG |
|
| 88 | 88 | ); |
| 89 | 89 | |
| 90 | 90 | return !$link ? false : [ |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | } else { |
| 175 | 175 | $suite = ''; |
| 176 | 176 | } |
| 177 | - $query = preg_replace('/([,\s])spip_/', '\1' . $prefixe . '_', $query) . $suite; |
|
| 177 | + $query = preg_replace('/([,\s])spip_/', '\1'.$prefixe.'_', $query).$suite; |
|
| 178 | 178 | |
| 179 | 179 | // renvoyer la requete inerte si demandee |
| 180 | 180 | if (!$requeter) { |
@@ -243,7 +243,7 @@ discard block |
||
| 243 | 243 | // ou revoir l'api de sql_alter en creant un |
| 244 | 244 | // sql_alter_table($table,array($actions)); |
| 245 | 245 | if (!preg_match('/\s*((\s*IGNORE)?\s*TABLE\s*([^\s]*))\s*(.*)?/is', $query, $regs)) { |
| 246 | - spip_log("$query mal comprise", 'pg.' . _LOG_ERREUR); |
|
| 246 | + spip_log("$query mal comprise", 'pg.'._LOG_ERREUR); |
|
| 247 | 247 | |
| 248 | 248 | return false; |
| 249 | 249 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | $i = 0; |
| 257 | 257 | $ouverte = false; |
| 258 | 258 | while ($do = array_shift($todo)) { |
| 259 | - $todo2[$i] = isset($todo2[$i]) ? $todo2[$i] . ',' . $do : $do; |
|
| 259 | + $todo2[$i] = isset($todo2[$i]) ? $todo2[$i].','.$do : $do; |
|
| 260 | 260 | $o = (false !== strpos($do, '(')); |
| 261 | 261 | $f = (false !== strpos($do, ')')); |
| 262 | 262 | if ($o and !$f) { |
@@ -269,34 +269,34 @@ discard block |
||
| 269 | 269 | } |
| 270 | 270 | } |
| 271 | 271 | $todo = $todo2; |
| 272 | - $query = $debut . ' ' . array_shift($todo); |
|
| 272 | + $query = $debut.' '.array_shift($todo); |
|
| 273 | 273 | |
| 274 | 274 | if (!preg_match('/^\s*(IGNORE\s*)?TABLE\s+(\w+)\s+(ADD|DROP|CHANGE|MODIFY|RENAME)\s*(.*)$/is', $query, $r)) { |
| 275 | - spip_log("$query incompris", 'pg.' . _LOG_ERREUR); |
|
| 275 | + spip_log("$query incompris", 'pg.'._LOG_ERREUR); |
|
| 276 | 276 | } else { |
| 277 | 277 | if ($r[1]) { |
| 278 | - spip_log("j'ignore IGNORE dans $query", 'pg.' . _LOG_AVERTISSEMENT); |
|
| 278 | + spip_log("j'ignore IGNORE dans $query", 'pg.'._LOG_AVERTISSEMENT); |
|
| 279 | 279 | } |
| 280 | - $f = 'spip_pg_alter_' . strtolower($r[3]); |
|
| 280 | + $f = 'spip_pg_alter_'.strtolower($r[3]); |
|
| 281 | 281 | if (function_exists($f)) { |
| 282 | 282 | $f($r[2], $r[4], $serveur, $requeter); |
| 283 | 283 | } else { |
| 284 | - spip_log("$query non prevu", 'pg.' . _LOG_ERREUR); |
|
| 284 | + spip_log("$query non prevu", 'pg.'._LOG_ERREUR); |
|
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | // Alter a plusieurs args. Faudrait optimiser. |
| 288 | 288 | if ($todo) { |
| 289 | - spip_pg_alter("TABLE $table " . join(',', $todo)); |
|
| 289 | + spip_pg_alter("TABLE $table ".join(',', $todo)); |
|
| 290 | 290 | } |
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | // https://code.spip.net/@spip_pg_alter_change |
| 294 | 294 | function spip_pg_alter_change($table, $arg, $serveur = '', $requeter = true) { |
| 295 | 295 | if (!preg_match('/^`?(\w+)`?\s+`?(\w+)`?\s+(.*?)\s*(DEFAULT .*?)?(NOT\s+NULL)?\s*(DEFAULT .*?)?$/i', $arg, $r)) { |
| 296 | - spip_log("alter change: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 296 | + spip_log("alter change: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 297 | 297 | } else { |
| 298 | 298 | list(, $old, $new, $type, $default, $null, $def2) = $r; |
| 299 | - $actions = ["ALTER $old TYPE " . mysql2pg_type($type)]; |
|
| 299 | + $actions = ["ALTER $old TYPE ".mysql2pg_type($type)]; |
|
| 300 | 300 | if ($null) { |
| 301 | 301 | $actions[] = "ALTER $old SET NOT NULL"; |
| 302 | 302 | } else { |
@@ -309,7 +309,7 @@ discard block |
||
| 309 | 309 | $actions[] = "ALTER $old DROP DEFAULT"; |
| 310 | 310 | } |
| 311 | 311 | |
| 312 | - spip_pg_query("ALTER TABLE $table " . join(', ', $actions)); |
|
| 312 | + spip_pg_query("ALTER TABLE $table ".join(', ', $actions)); |
|
| 313 | 313 | |
| 314 | 314 | if ($old != $new) { |
| 315 | 315 | spip_pg_query("ALTER TABLE $table RENAME $old TO $new", $serveur); |
@@ -320,7 +320,7 @@ discard block |
||
| 320 | 320 | // https://code.spip.net/@spip_pg_alter_add |
| 321 | 321 | function spip_pg_alter_add($table, $arg, $serveur = '', $requeter = true) { |
| 322 | 322 | if (!preg_match('/^(COLUMN|INDEX|KEY|PRIMARY\s+KEY|)\s*(.*)$/', $arg, $r)) { |
| 323 | - spip_log("alter add $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 323 | + spip_log("alter add $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 324 | 324 | |
| 325 | 325 | return null; |
| 326 | 326 | } |
@@ -330,14 +330,14 @@ discard block |
||
| 330 | 330 | $m[2] = $n[1]; |
| 331 | 331 | } |
| 332 | 332 | |
| 333 | - return spip_pg_query("ALTER TABLE $table ADD " . $m[1] . ' ' . mysql2pg_type($m[2]), $serveur, $requeter); |
|
| 333 | + return spip_pg_query("ALTER TABLE $table ADD ".$m[1].' '.mysql2pg_type($m[2]), $serveur, $requeter); |
|
| 334 | 334 | } elseif ($r[1][0] == 'P') { |
| 335 | 335 | // la primary peut etre sur plusieurs champs |
| 336 | 336 | $r[2] = trim(str_replace('`', '', $r[2])); |
| 337 | 337 | $m = ($r[2][0] == '(') ? substr($r[2], 1, -1) : $r[2]; |
| 338 | 338 | |
| 339 | 339 | return spip_pg_query( |
| 340 | - "ALTER TABLE $table ADD CONSTRAINT $table" . '_pkey PRIMARY KEY (' . $m . ')', |
|
| 340 | + "ALTER TABLE $table ADD CONSTRAINT $table".'_pkey PRIMARY KEY ('.$m.')', |
|
| 341 | 341 | $serveur, |
| 342 | 342 | $requeter |
| 343 | 343 | ); |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | $colonnes = substr($m[1], 1, -1); |
| 357 | 357 | if (false !== strpos(',', $colonnes)) { |
| 358 | 358 | spip_log('PG : Erreur, impossible de creer un index sur plusieurs colonnes' |
| 359 | - . " sans qu'il ait de nom ($table, ($colonnes))", 'pg.' . _LOG_ERREUR); |
|
| 359 | + . " sans qu'il ait de nom ($table, ($colonnes))", 'pg.'._LOG_ERREUR); |
|
| 360 | 360 | } else { |
| 361 | 361 | $nom_index = $colonnes; |
| 362 | 362 | } |
@@ -373,23 +373,23 @@ discard block |
||
| 373 | 373 | // https://code.spip.net/@spip_pg_alter_drop |
| 374 | 374 | function spip_pg_alter_drop($table, $arg, $serveur = '', $requeter = true) { |
| 375 | 375 | if (!preg_match('/^(COLUMN|INDEX|KEY|PRIMARY\s+KEY|)\s*`?(\w*)`?/', $arg, $r)) { |
| 376 | - spip_log("alter drop: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 376 | + spip_log("alter drop: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 377 | 377 | } else { |
| 378 | 378 | if (!$r[1] or $r[1] == 'COLUMN') { |
| 379 | - return spip_pg_query("ALTER TABLE $table DROP " . $r[2], $serveur); |
|
| 379 | + return spip_pg_query("ALTER TABLE $table DROP ".$r[2], $serveur); |
|
| 380 | 380 | } elseif ($r[1][0] == 'P') { |
| 381 | - return spip_pg_query("ALTER TABLE $table DROP CONSTRAINT $table" . '_pkey', $serveur); |
|
| 381 | + return spip_pg_query("ALTER TABLE $table DROP CONSTRAINT $table".'_pkey', $serveur); |
|
| 382 | 382 | } else { |
| 383 | - return spip_pg_query('DROP INDEX ' . $table . '_' . $r[2], $serveur); |
|
| 383 | + return spip_pg_query('DROP INDEX '.$table.'_'.$r[2], $serveur); |
|
| 384 | 384 | } |
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | function spip_pg_alter_modify($table, $arg, $serveur = '', $requeter = true) { |
| 389 | 389 | if (!preg_match('/^`?(\w+)`?\s+(.*)$/', $arg, $r)) { |
| 390 | - spip_log("alter modify: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 390 | + spip_log("alter modify: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 391 | 391 | } else { |
| 392 | - return spip_pg_alter_change($table, $r[1] . ' ' . $arg, $serveur = '', $requeter = true); |
|
| 392 | + return spip_pg_alter_change($table, $r[1].' '.$arg, $serveur = '', $requeter = true); |
|
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | 395 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | } elseif (preg_match('/^(TO)\s*`?(\w*)`?/', $arg, $r)) { |
| 406 | 406 | $rename = $r[2]; |
| 407 | 407 | } else { |
| 408 | - spip_log("alter rename: $arg incompris", 'pg.' . _LOG_ERREUR); |
|
| 408 | + spip_log("alter rename: $arg incompris", 'pg.'._LOG_ERREUR); |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | return $rename ? spip_pg_query("ALTER TABLE $table RENAME TO $rename") : false; |
@@ -426,8 +426,8 @@ discard block |
||
| 426 | 426 | function spip_pg_create_index($nom, $table, $champs, $serveur = '', $requeter = true) { |
| 427 | 427 | if (!($nom or $table or $champs)) { |
| 428 | 428 | spip_log( |
| 429 | - "Champ manquant pour creer un index pg ($nom, $table, (" . @join(',', $champs) . '))', |
|
| 430 | - 'pg.' . _LOG_ERREUR |
|
| 429 | + "Champ manquant pour creer un index pg ($nom, $table, (".@join(',', $champs).'))', |
|
| 430 | + 'pg.'._LOG_ERREUR |
|
| 431 | 431 | ); |
| 432 | 432 | |
| 433 | 433 | return false; |
@@ -438,7 +438,7 @@ discard block |
||
| 438 | 438 | |
| 439 | 439 | // PG ne differentie pas noms des index en fonction des tables |
| 440 | 440 | // il faut donc creer des noms uniques d'index pour une base pg |
| 441 | - $nom = $table . '_' . $nom; |
|
| 441 | + $nom = $table.'_'.$nom; |
|
| 442 | 442 | // enlever d'eventuelles parentheses deja presentes sur champs |
| 443 | 443 | if (!is_array($champs)) { |
| 444 | 444 | if ($champs[0] == '(') { |
@@ -446,7 +446,7 @@ discard block |
||
| 446 | 446 | } |
| 447 | 447 | $champs = [$champs]; |
| 448 | 448 | } |
| 449 | - $query = "CREATE INDEX $nom ON $table (" . join(',', $champs) . ')'; |
|
| 449 | + $query = "CREATE INDEX $nom ON $table (".join(',', $champs).')'; |
|
| 450 | 450 | if (!$requeter) { |
| 451 | 451 | return $query; |
| 452 | 452 | } |
@@ -470,7 +470,7 @@ discard block |
||
| 470 | 470 | } else { |
| 471 | 471 | $suite = ''; |
| 472 | 472 | } |
| 473 | - $query = 'EXPLAIN ' . preg_replace('/([,\s])spip_/', '\1' . $prefixe . '_', $query) . $suite; |
|
| 473 | + $query = 'EXPLAIN '.preg_replace('/([,\s])spip_/', '\1'.$prefixe.'_', $query).$suite; |
|
| 474 | 474 | |
| 475 | 475 | if (!$requeter) { |
| 476 | 476 | return $query; |
@@ -565,16 +565,16 @@ discard block |
||
| 565 | 565 | } |
| 566 | 566 | } |
| 567 | 567 | $from = spip_pg_from($from, $prefixe); |
| 568 | - $query = 'SELECT ' . $select |
|
| 568 | + $query = 'SELECT '.$select |
|
| 569 | 569 | . (!$from ? '' : "\nFROM $from") |
| 570 | - . (!$where ? '' : ("\nWHERE " . (!is_array($where) ? calculer_pg_where($where) : (join( |
|
| 570 | + . (!$where ? '' : ("\nWHERE ".(!is_array($where) ? calculer_pg_where($where) : (join( |
|
| 571 | 571 | "\n\tAND ", |
| 572 | 572 | array_map('calculer_pg_where', $where) |
| 573 | 573 | ))))) |
| 574 | 574 | . spip_pg_groupby($groupby, $from, $select) |
| 575 | 575 | . (!$having ? '' : "\nHAVING $having") |
| 576 | 576 | . ($orderby ? ("\nORDER BY $orderby") : '') |
| 577 | - . (!$limit ? '' : (" LIMIT $count" . (!$offset ? '' : " OFFSET $offset"))); |
|
| 577 | + . (!$limit ? '' : (" LIMIT $count".(!$offset ? '' : " OFFSET $offset"))); |
|
| 578 | 578 | |
| 579 | 579 | // renvoyer la requete inerte si demandee |
| 580 | 580 | if ($requeter === false) { |
@@ -596,7 +596,7 @@ discard block |
||
| 596 | 596 | $from = spip_pg_select_as($from); |
| 597 | 597 | } |
| 598 | 598 | |
| 599 | - return !$prefixe ? $from : preg_replace('/(\b)spip_/', '\1' . $prefixe . '_', $from); |
|
| 599 | + return !$prefixe ? $from : preg_replace('/(\b)spip_/', '\1'.$prefixe.'_', $from); |
|
| 600 | 600 | } |
| 601 | 601 | |
| 602 | 602 | // https://code.spip.net/@spip_pg_orderby |
@@ -605,7 +605,7 @@ discard block |
||
| 605 | 605 | $arg = (is_array($order) ? $order : preg_split('/\s*,\s*/', $order)); |
| 606 | 606 | |
| 607 | 607 | foreach ($arg as $v) { |
| 608 | - if (preg_match('/(case\s+.*?else\s+0\s+end)\s*AS\s+' . $v . '/', $select, $m)) { |
|
| 608 | + if (preg_match('/(case\s+.*?else\s+0\s+end)\s*AS\s+'.$v.'/', $select, $m)) { |
|
| 609 | 609 | $res[] = $m[1]; |
| 610 | 610 | } else { |
| 611 | 611 | $res[] = $v; |
@@ -786,7 +786,7 @@ discard block |
||
| 786 | 786 | $n++; |
| 787 | 787 | $res .= "\nwhen $index=$v then $n"; |
| 788 | 788 | } |
| 789 | - $arg = $m[1] . "case $res else 0 end " |
|
| 789 | + $arg = $m[1]."case $res else 0 end " |
|
| 790 | 790 | . substr($arg, strlen($m[0])); |
| 791 | 791 | } |
| 792 | 792 | |
@@ -831,9 +831,9 @@ discard block |
||
| 831 | 831 | } |
| 832 | 832 | |
| 833 | 833 | if (strtoupper($join) === 'AND') { |
| 834 | - return $exp . join("\n\t$join ", array_map('calculer_pg_where', $v)); |
|
| 834 | + return $exp.join("\n\t$join ", array_map('calculer_pg_where', $v)); |
|
| 835 | 835 | } else { |
| 836 | - return $exp . join($join, $v); |
|
| 836 | + return $exp.join($join, $v); |
|
| 837 | 837 | } |
| 838 | 838 | } |
| 839 | 839 | |
@@ -844,7 +844,7 @@ discard block |
||
| 844 | 844 | if (substr($k, -1) == '@') { |
| 845 | 845 | // c'est une jointure qui se refere au from precedent |
| 846 | 846 | // pas de virgule |
| 847 | - $argsas .= ' ' . $v; |
|
| 847 | + $argsas .= ' '.$v; |
|
| 848 | 848 | } else { |
| 849 | 849 | $as = ''; |
| 850 | 850 | // spip_log("$k : $v", _LOG_DEBUG); |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | } elseif ($v != $k) { |
| 855 | 855 | $p = strpos($v, ' '); |
| 856 | 856 | if ($p) { |
| 857 | - $v = substr($v, 0, $p) . " AS $k" . substr($v, $p); |
|
| 857 | + $v = substr($v, 0, $p)." AS $k".substr($v, $p); |
|
| 858 | 858 | } else { |
| 859 | 859 | $as = " AS $k"; |
| 860 | 860 | } |
@@ -862,7 +862,7 @@ discard block |
||
| 862 | 862 | } |
| 863 | 863 | // spip_log("subs $k : $v avec $as", _LOG_DEBUG); |
| 864 | 864 | // if (strpos($v, 'JOIN') === false) $argsas .= ', '; |
| 865 | - $argsas .= ', ' . $v . $as; |
|
| 865 | + $argsas .= ', '.$v.$as; |
|
| 866 | 866 | } |
| 867 | 867 | } |
| 868 | 868 | |
@@ -895,7 +895,7 @@ discard block |
||
| 895 | 895 | $serveur = '', |
| 896 | 896 | $requeter = true |
| 897 | 897 | ) { |
| 898 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 898 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 899 | 899 | $r = spip_pg_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 900 | 900 | if (!$requeter) { |
| 901 | 901 | return $r; |
@@ -1001,8 +1001,8 @@ discard block |
||
| 1001 | 1001 | |
| 1002 | 1002 | return spip_pg_insert( |
| 1003 | 1003 | $table, |
| 1004 | - '(' . join(',', array_keys($couples)) . ')', |
|
| 1005 | - '(' . join(',', $couples) . ')', |
|
| 1004 | + '('.join(',', array_keys($couples)).')', |
|
| 1005 | + '('.join(',', $couples).')', |
|
| 1006 | 1006 | $desc, |
| 1007 | 1007 | $serveur, |
| 1008 | 1008 | $requeter |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | $c = isset($tab_couples[0]) ? $tab_couples[0] : []; |
| 1027 | 1027 | $les_cles = spip_pg_ajouter_champs_timestamp($table, $c, $desc, $serveur); |
| 1028 | 1028 | |
| 1029 | - $cles = '(' . join(',', array_keys($les_cles)) . ')'; |
|
| 1029 | + $cles = '('.join(',', array_keys($les_cles)).')'; |
|
| 1030 | 1030 | $valeurs = []; |
| 1031 | 1031 | foreach ($tab_couples as $couples) { |
| 1032 | 1032 | foreach ($couples as $champ => $val) { |
@@ -1035,7 +1035,7 @@ discard block |
||
| 1035 | 1035 | // recherche de champs 'timestamp' pour mise a jour auto de ceux-ci |
| 1036 | 1036 | $couples = spip_pg_ajouter_champs_timestamp($table, $couples, $desc, $serveur); |
| 1037 | 1037 | |
| 1038 | - $valeurs[] = '(' . join(',', $couples) . ')'; |
|
| 1038 | + $valeurs[] = '('.join(',', $couples).')'; |
|
| 1039 | 1039 | } |
| 1040 | 1040 | $valeurs = implode(', ', $valeurs); |
| 1041 | 1041 | |
@@ -1057,7 +1057,7 @@ discard block |
||
| 1057 | 1057 | |
| 1058 | 1058 | $set = []; |
| 1059 | 1059 | foreach ($couples as $champ => $val) { |
| 1060 | - $set[] = $champ . '=' . $val; |
|
| 1060 | + $set[] = $champ.'='.$val; |
|
| 1061 | 1061 | } |
| 1062 | 1062 | |
| 1063 | 1063 | $query = calculer_pg_expression('UPDATE', $table, ',') |
@@ -1094,7 +1094,7 @@ discard block |
||
| 1094 | 1094 | // https://code.spip.net/@spip_pg_replace |
| 1095 | 1095 | function spip_pg_replace($table, $values, $desc, $serveur = '', $requeter = true) { |
| 1096 | 1096 | if (!$values) { |
| 1097 | - spip_log("replace vide $table", 'pg.' . _LOG_AVERTISSEMENT); |
|
| 1097 | + spip_log("replace vide $table", 'pg.'._LOG_AVERTISSEMENT); |
|
| 1098 | 1098 | |
| 1099 | 1099 | return 0; |
| 1100 | 1100 | } |
@@ -1128,8 +1128,8 @@ discard block |
||
| 1128 | 1128 | if (!$where) { |
| 1129 | 1129 | return spip_pg_insert( |
| 1130 | 1130 | $table, |
| 1131 | - '(' . join(',', array_keys($values)) . ')', |
|
| 1132 | - '(' . join(',', $values) . ')', |
|
| 1131 | + '('.join(',', array_keys($values)).')', |
|
| 1132 | + '('.join(',', $values).')', |
|
| 1133 | 1133 | $desc, |
| 1134 | 1134 | $serveur |
| 1135 | 1135 | ); |
@@ -1150,12 +1150,11 @@ discard block |
||
| 1150 | 1150 | $couples = pg_affected_rows($couples); |
| 1151 | 1151 | } |
| 1152 | 1152 | if (!$couples) { |
| 1153 | - $ret = !$seq ? '' : |
|
| 1154 | - (" RETURNING nextval('$seq') < $prim"); |
|
| 1155 | - $connexion['last'] = $q = "INSERT INTO $table (" . join(',', array_keys($values)) . ') VALUES (' . join( |
|
| 1153 | + $ret = !$seq ? '' : (" RETURNING nextval('$seq') < $prim"); |
|
| 1154 | + $connexion['last'] = $q = "INSERT INTO $table (".join(',', array_keys($values)).') VALUES ('.join( |
|
| 1156 | 1155 | ',', |
| 1157 | 1156 | $values |
| 1158 | - ) . ")$ret"; |
|
| 1157 | + ).")$ret"; |
|
| 1159 | 1158 | $couples = spip_pg_query_simple($link, $q); |
| 1160 | 1159 | if (!$couples) { |
| 1161 | 1160 | return false; |
@@ -1204,7 +1203,7 @@ discard block |
||
| 1204 | 1203 | ) { |
| 1205 | 1204 | return ''; |
| 1206 | 1205 | } else { |
| 1207 | - return $raw ? $prim : $table . '_' . $prim . '_seq'; |
|
| 1206 | + return $raw ? $prim : $table.'_'.$prim.'_seq'; |
|
| 1208 | 1207 | } |
| 1209 | 1208 | } |
| 1210 | 1209 | |
@@ -1222,22 +1221,22 @@ discard block |
||
| 1222 | 1221 | return spip_pg_frommysql($v); |
| 1223 | 1222 | } else { |
| 1224 | 1223 | if (strncmp($v, '0000', 4) == 0) { |
| 1225 | - $v = '0001' . substr($v, 4); |
|
| 1224 | + $v = '0001'.substr($v, 4); |
|
| 1226 | 1225 | } |
| 1227 | 1226 | if (strpos($v, '-00-00') === 4) { |
| 1228 | - $v = substr($v, 0, 4) . '-01-01' . substr($v, 10); |
|
| 1227 | + $v = substr($v, 0, 4).'-01-01'.substr($v, 10); |
|
| 1229 | 1228 | } |
| 1230 | 1229 | |
| 1231 | 1230 | return "timestamp '$v'"; |
| 1232 | 1231 | } |
| 1233 | 1232 | } elseif (!sql_test_int($t)) { |
| 1234 | - return ("'" . pg_escape_string($v) . "'"); |
|
| 1233 | + return ("'".pg_escape_string($v)."'"); |
|
| 1235 | 1234 | } elseif (is_numeric($v) or (strpos($v, 'CAST(') === 0)) { |
| 1236 | 1235 | return $v; |
| 1237 | 1236 | } elseif ($v[0] == '0' and $v[1] !== 'x' and ctype_xdigit(substr($v, 1))) { |
| 1238 | 1237 | return substr($v, 1); |
| 1239 | 1238 | } else { |
| 1240 | - spip_log("Warning: '$v' n'est pas de type $t", 'pg.' . _LOG_AVERTISSEMENT); |
|
| 1239 | + spip_log("Warning: '$v' n'est pas de type $t", 'pg.'._LOG_AVERTISSEMENT); |
|
| 1241 | 1240 | |
| 1242 | 1241 | return intval($v); |
| 1243 | 1242 | } |
@@ -1245,7 +1244,7 @@ discard block |
||
| 1245 | 1244 | |
| 1246 | 1245 | // https://code.spip.net/@spip_pg_hex |
| 1247 | 1246 | function spip_pg_hex($v) { |
| 1248 | - return "CAST(x'" . $v . "' as bigint)"; |
|
| 1247 | + return "CAST(x'".$v."' as bigint)"; |
|
| 1249 | 1248 | } |
| 1250 | 1249 | |
| 1251 | 1250 | function spip_pg_quote($v, $type = '') { |
@@ -1284,15 +1283,15 @@ discard block |
||
| 1284 | 1283 | return $not ? '0=0' : '0=1'; |
| 1285 | 1284 | } |
| 1286 | 1285 | if (strpos($valeurs, "CAST(x'") !== false) { |
| 1287 | - return "($val=" . join("OR $val=", explode(',', $valeurs)) . ')'; |
|
| 1286 | + return "($val=".join("OR $val=", explode(',', $valeurs)).')'; |
|
| 1288 | 1287 | } |
| 1289 | 1288 | $n = $i = 0; |
| 1290 | 1289 | $in_sql = ''; |
| 1291 | 1290 | while ($n = strpos($valeurs, ',', $n + 1)) { |
| 1292 | 1291 | if ((++$i) >= 255) { |
| 1293 | - $in_sql .= "($val $not IN (" . |
|
| 1294 | - substr($valeurs, 0, $n) . |
|
| 1295 | - "))\n" . |
|
| 1292 | + $in_sql .= "($val $not IN (". |
|
| 1293 | + substr($valeurs, 0, $n). |
|
| 1294 | + "))\n". |
|
| 1296 | 1295 | ($not ? "AND\t" : "OR\t"); |
| 1297 | 1296 | $valeurs = substr($valeurs, $n + 1); |
| 1298 | 1297 | $i = $n = 0; |
@@ -1309,7 +1308,7 @@ discard block |
||
| 1309 | 1308 | $s = $link ? pg_last_error($link) : pg_last_error(); |
| 1310 | 1309 | if ($s) { |
| 1311 | 1310 | $s = str_replace('ERROR', 'errcode: 1000 ', $s); |
| 1312 | - spip_log("$s - $query", 'pg.' . _LOG_ERREUR); |
|
| 1311 | + spip_log("$s - $query", 'pg.'._LOG_ERREUR); |
|
| 1313 | 1312 | } |
| 1314 | 1313 | |
| 1315 | 1314 | return $s; |
@@ -1360,7 +1359,7 @@ discard block |
||
| 1360 | 1359 | function spip_pg_showbase($match, $serveur = '', $requeter = true) { |
| 1361 | 1360 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 1362 | 1361 | $link = $connexion['link']; |
| 1363 | - $connexion['last'] = $q = 'SELECT tablename FROM pg_tables WHERE tablename ILIKE ' . _q($match); |
|
| 1362 | + $connexion['last'] = $q = 'SELECT tablename FROM pg_tables WHERE tablename ILIKE '._q($match); |
|
| 1364 | 1363 | |
| 1365 | 1364 | return spip_pg_query_simple($link, $q); |
| 1366 | 1365 | } |
@@ -1369,7 +1368,7 @@ discard block |
||
| 1369 | 1368 | function spip_pg_showtable($nom_table, $serveur = '', $requeter = true) { |
| 1370 | 1369 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 1371 | 1370 | $link = $connexion['link']; |
| 1372 | - $connexion['last'] = $q = 'SELECT column_name, column_default, data_type FROM information_schema.columns WHERE table_name ILIKE ' . _q($nom_table); |
|
| 1371 | + $connexion['last'] = $q = 'SELECT column_name, column_default, data_type FROM information_schema.columns WHERE table_name ILIKE '._q($nom_table); |
|
| 1373 | 1372 | |
| 1374 | 1373 | $res = spip_pg_query_simple($link, $q); |
| 1375 | 1374 | if (!$res) { |
@@ -1380,15 +1379,15 @@ discard block |
||
| 1380 | 1379 | // il faut en tenir compte dans le return |
| 1381 | 1380 | $fields = []; |
| 1382 | 1381 | while ($field = pg_fetch_array($res, null, PGSQL_NUM)) { |
| 1383 | - $fields[$field[0]] = $field[2] . (!$field[1] ? '' : (' DEFAULT ' . $field[1])); |
|
| 1382 | + $fields[$field[0]] = $field[2].(!$field[1] ? '' : (' DEFAULT '.$field[1])); |
|
| 1384 | 1383 | } |
| 1385 | - $connexion['last'] = $q = 'SELECT indexdef FROM pg_indexes WHERE tablename ILIKE ' . _q($nom_table); |
|
| 1384 | + $connexion['last'] = $q = 'SELECT indexdef FROM pg_indexes WHERE tablename ILIKE '._q($nom_table); |
|
| 1386 | 1385 | $res = spip_pg_query_simple($link, $q); |
| 1387 | 1386 | $keys = []; |
| 1388 | 1387 | while ($index = pg_fetch_array($res, null, PGSQL_NUM)) { |
| 1389 | 1388 | if (preg_match('/CREATE\s+(UNIQUE\s+)?INDEX\s([^\s]+).*\((.*)\)$/', $index[0], $r)) { |
| 1390 | - $nom = str_replace($nom_table . '_', '', $r[2]); |
|
| 1391 | - $keys[($r[1] ? 'PRIMARY KEY' : ('KEY ' . $nom))] = $r[3]; |
|
| 1389 | + $nom = str_replace($nom_table.'_', '', $r[2]); |
|
| 1390 | + $keys[($r[1] ? 'PRIMARY KEY' : ('KEY '.$nom))] = $r[3]; |
|
| 1392 | 1391 | } |
| 1393 | 1392 | } |
| 1394 | 1393 | |
@@ -1421,16 +1420,16 @@ discard block |
||
| 1421 | 1420 | if (strpos($k, 'KEY ') === 0) { |
| 1422 | 1421 | $n = str_replace('`', '', $k); |
| 1423 | 1422 | $v = str_replace('`', '"', $v); |
| 1424 | - $i = $nom . preg_replace('/KEY +/', '_', $n); |
|
| 1423 | + $i = $nom.preg_replace('/KEY +/', '_', $n); |
|
| 1425 | 1424 | if ($k != $n) { |
| 1426 | 1425 | $i = "\"$i\""; |
| 1427 | 1426 | } |
| 1428 | 1427 | $keys[] = "CREATE INDEX $i ON $nom ($v);"; |
| 1429 | 1428 | } elseif (strpos($k, 'UNIQUE ') === 0) { |
| 1430 | 1429 | $k = preg_replace('/^UNIQUE +/', '', $k); |
| 1431 | - $prim .= "$s\n\t\tCONSTRAINT " . str_replace('`', '"', $k) . " UNIQUE ($v)"; |
|
| 1430 | + $prim .= "$s\n\t\tCONSTRAINT ".str_replace('`', '"', $k)." UNIQUE ($v)"; |
|
| 1432 | 1431 | } else { |
| 1433 | - $prim .= "$s\n\t\t" . str_replace('`', '"', $k) . " ($v)"; |
|
| 1432 | + $prim .= "$s\n\t\t".str_replace('`', '"', $k)." ($v)"; |
|
| 1434 | 1433 | } |
| 1435 | 1434 | if ($k == 'PRIMARY KEY') { |
| 1436 | 1435 | $prim_name = $v; |
@@ -1441,17 +1440,17 @@ discard block |
||
| 1441 | 1440 | |
| 1442 | 1441 | $character_set = ''; |
| 1443 | 1442 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 1444 | - $character_set .= ' CHARACTER SET ' . $GLOBALS['meta']['charset_sql_base']; |
|
| 1443 | + $character_set .= ' CHARACTER SET '.$GLOBALS['meta']['charset_sql_base']; |
|
| 1445 | 1444 | } |
| 1446 | 1445 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 1447 | - $character_set .= ' COLLATE ' . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 1446 | + $character_set .= ' COLLATE '.$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 1448 | 1447 | } |
| 1449 | 1448 | |
| 1450 | 1449 | foreach ($champs as $k => $v) { |
| 1451 | 1450 | $k = str_replace('`', '"', $k); |
| 1452 | 1451 | if (preg_match(',([a-z]*\s*(\(\s*[0-9]*\s*\))?(\s*binary)?),i', $v, $defs)) { |
| 1453 | 1452 | if (preg_match(',(char|text),i', $defs[1]) and !preg_match(',binary,i', $defs[1])) { |
| 1454 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 1453 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 1455 | 1454 | } |
| 1456 | 1455 | } |
| 1457 | 1456 | |
@@ -1466,7 +1465,7 @@ discard block |
||
| 1466 | 1465 | |
| 1467 | 1466 | // En l'absence de "if not exists" en PG, on neutralise les erreurs |
| 1468 | 1467 | |
| 1469 | - $q = "CREATE $temporary TABLE $nom ($query" . ($prim ? ",$prim" : '') . ')' . |
|
| 1468 | + $q = "CREATE $temporary TABLE $nom ($query".($prim ? ",$prim" : '').')'. |
|
| 1470 | 1469 | ($character_set ? " DEFAULT $character_set" : '') |
| 1471 | 1470 | . "\n"; |
| 1472 | 1471 | |
@@ -1477,7 +1476,7 @@ discard block |
||
| 1477 | 1476 | $r = @pg_query($link, $q); |
| 1478 | 1477 | |
| 1479 | 1478 | if (!$r) { |
| 1480 | - spip_log("Impossible de creer cette table: $q", 'pg.' . _LOG_ERREUR); |
|
| 1479 | + spip_log("Impossible de creer cette table: $q", 'pg.'._LOG_ERREUR); |
|
| 1481 | 1480 | } else { |
| 1482 | 1481 | foreach ($keys as $index) { |
| 1483 | 1482 | pg_query($link, $index); |
@@ -1501,13 +1500,13 @@ discard block |
||
| 1501 | 1500 | // vue deja presente |
| 1502 | 1501 | if (sql_showtable($nom, false, $serveur)) { |
| 1503 | 1502 | if ($requeter) { |
| 1504 | - spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", 'pg.' . _LOG_ERREUR); |
|
| 1503 | + spip_log("Echec creation d'une vue sql ($nom) car celle-ci existe deja (serveur:$serveur)", 'pg.'._LOG_ERREUR); |
|
| 1505 | 1504 | } |
| 1506 | 1505 | |
| 1507 | 1506 | return false; |
| 1508 | 1507 | } |
| 1509 | 1508 | |
| 1510 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 1509 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 1511 | 1510 | |
| 1512 | 1511 | return spip_pg_query($query, $serveur, $requeter); |
| 1513 | 1512 | } |
@@ -1515,7 +1514,7 @@ discard block |
||
| 1515 | 1514 | |
| 1516 | 1515 | // https://code.spip.net/@spip_pg_set_connect_charset |
| 1517 | 1516 | function spip_pg_set_connect_charset($charset, $serveur = '', $requeter = true) { |
| 1518 | - spip_log('changement de charset sql a ecrire en PG', 'pg.' . _LOG_ERREUR); |
|
| 1517 | + spip_log('changement de charset sql a ecrire en PG', 'pg.'._LOG_ERREUR); |
|
| 1519 | 1518 | } |
| 1520 | 1519 | |
| 1521 | 1520 | |
@@ -1529,7 +1528,7 @@ discard block |
||
| 1529 | 1528 | **/ |
| 1530 | 1529 | // https://code.spip.net/@spip_sqlite_optimize |
| 1531 | 1530 | function spip_pg_optimize($table, $serveur = '', $requeter = true) { |
| 1532 | - return spip_pg_query('VACUUM ' . $table, $serveur, $requeter); |
|
| 1531 | + return spip_pg_query('VACUUM '.$table, $serveur, $requeter); |
|
| 1533 | 1532 | } |
| 1534 | 1533 | |
| 1535 | 1534 | // Selectionner la sous-chaine dans $objet |