@@ -43,9 +43,9 @@ discard block |
||
| 43 | 43 | ); |
| 44 | 44 | $style_titre_mapping = array('couleur' => 'topper', 'trait-couleur' => 'section'); |
| 45 | 45 | $c = isset($style_mapping[$style]) ? $style_mapping[$style] : 'simple'; |
| 46 | - $class = $c . ($class ? " $class" : ""); |
|
| 46 | + $class = $c.($class ? " $class" : ""); |
|
| 47 | 47 | if (!$padding) { |
| 48 | - $class .= ($class ? " " : "") . "no-padding"; |
|
| 48 | + $class .= ($class ? " " : "")."no-padding"; |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | //($id?"id='$id' ":"") |
@@ -60,12 +60,12 @@ discard block |
||
| 60 | 60 | if ($fonction) { |
| 61 | 61 | // 2 images pour composer l'icone : le fond (article) en background, |
| 62 | 62 | // la fonction (new) en image |
| 63 | - $icone = http_img_pack($fonction, "", "class='cadre-icone' width='$size' height='$size'\n" . |
|
| 63 | + $icone = http_img_pack($fonction, "", "class='cadre-icone' width='$size' height='$size'\n". |
|
| 64 | 64 | http_style_background($fond, "no-repeat center center", $size)); |
| 65 | 65 | } else { |
| 66 | 66 | $icone = http_img_pack($fond, "", "class='cadre-icone' width='$size' height='$size'"); |
| 67 | 67 | } |
| 68 | - $titre = $icone . $titre; |
|
| 68 | + $titre = $icone.$titre; |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | return boite_ouvrir($titre, $class, isset($style_titre_mapping[$style]) ? $style_titre_mapping[$style] : '', $id); |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | $titre, |
| 160 | 160 | $ze_logo = '' |
| 161 | 161 | ) { |
| 162 | - return "<h1 class = 'grostitre'>" . $ze_logo . ' ' . typo($titre) . "</h1>\n"; |
|
| 162 | + return "<h1 class = 'grostitre'>".$ze_logo.' '.typo($titre)."</h1>\n"; |
|
| 163 | 163 | } |
| 164 | 164 | |
| 165 | 165 | // La boite des raccourcis |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | // https://code.spip.net/@bloc_des_raccourcis |
| 168 | 168 | function bloc_des_raccourcis($bloc) { |
| 169 | 169 | return creer_colonne_droite() |
| 170 | - . boite_ouvrir(_T('titre_cadre_raccourcis'), 'raccourcis') . $bloc . boite_fermer(); |
|
| 170 | + . boite_ouvrir(_T('titre_cadre_raccourcis'), 'raccourcis').$bloc.boite_fermer(); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | // |
@@ -56,14 +56,14 @@ discard block |
||
| 56 | 56 | $class_li .= " error"; |
| 57 | 57 | $erreur = http_img_pack("plugin-err-32.png", _T('plugin_info_erreur_xml'), " class='picto_err'", |
| 58 | 58 | _T('plugin_info_erreur_xml')) |
| 59 | - . "<div class='erreur'>" . join('<br >', $info['erreur']) . "</div>"; |
|
| 59 | + . "<div class='erreur'>".join('<br >', $info['erreur'])."</div>"; |
|
| 60 | 60 | $checkable = false; |
| 61 | - } elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file])) { |
|
| 61 | + } elseif (isset($GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file])) { |
|
| 62 | 62 | $class_li .= " error"; |
| 63 | 63 | $erreur = http_img_pack("plugin-err-32.png", _T('plugin_impossible_activer', array('plugin' => $nom)), |
| 64 | 64 | " class='picto_err'", _T('plugin_impossible_activer', array('plugin' => $nom))) |
| 65 | - . "<div class='erreur'>" . implode("<br />", |
|
| 66 | - $GLOBALS['erreurs_activation_raw'][$dir_plugins . $plug_file]) . "</div>"; |
|
| 65 | + . "<div class='erreur'>".implode("<br />", |
|
| 66 | + $GLOBALS['erreurs_activation_raw'][$dir_plugins.$plug_file])."</div>"; |
|
| 67 | 67 | } else { |
| 68 | 68 | $cfg = $actif ? plugin_bouton_config($plug_file, $info, $dir_plugins) : ""; |
| 69 | 69 | } |
@@ -71,11 +71,11 @@ discard block |
||
| 71 | 71 | // numerotons les occurrences d'un meme prefix |
| 72 | 72 | $versions[$prefix] = $id = isset($versions[$prefix]) ? intval($versions[$prefix]) + 1 : ''; |
| 73 | 73 | |
| 74 | - $class_li .= ($actif ? " actif" : "") . ($expose ? " on" : ""); |
|
| 74 | + $class_li .= ($actif ? " actif" : "").($expose ? " on" : ""); |
|
| 75 | 75 | |
| 76 | 76 | return "<li id='$prefix$id' class='$class_li'>" |
| 77 | 77 | . ((!$checkable and !$checked) |
| 78 | - ? '' : plugin_checkbox(++$id_input, $dir_plugins . $plug_file, $checked)) |
|
| 78 | + ? '' : plugin_checkbox(++$id_input, $dir_plugins.$plug_file, $checked)) |
|
| 79 | 79 | . plugin_resume($info, $dir_plugins, $plug_file, $url_page) |
| 80 | 80 | . $cfg |
| 81 | 81 | . $erreur |
@@ -93,9 +93,9 @@ discard block |
||
| 93 | 93 | $prefix = strtolower($infos['prefix']); |
| 94 | 94 | // si paquet.xml fournit un squelette, le prendre |
| 95 | 95 | if (isset($infos['config']) and $infos['config']) { |
| 96 | - return recuperer_fond("$dir$nom/" . $infos['config'], |
|
| 96 | + return recuperer_fond("$dir$nom/".$infos['config'], |
|
| 97 | 97 | array( |
| 98 | - 'script' => 'configurer_' . $prefix, |
|
| 98 | + 'script' => 'configurer_'.$prefix, |
|
| 99 | 99 | 'nom' => $nom |
| 100 | 100 | )); |
| 101 | 101 | } |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | // sinon prendre le squelette std sur le nom std |
| 114 | 114 | return recuperer_fond("prive/squelettes/inclure/cfg", |
| 115 | 115 | array( |
| 116 | - 'script' => 'configurer_' . $prefix, |
|
| 116 | + 'script' => 'configurer_'.$prefix, |
|
| 117 | 117 | 'nom' => $nom |
| 118 | 118 | )); |
| 119 | 119 | } |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | . "<input type='checkbox' name='s$name' id='label_$id_input'" |
| 129 | 129 | . ($actif ? " checked='checked'" : "") |
| 130 | 130 | . " class='checkbox' value='O' />" |
| 131 | - . "\n<label for='label_$id_input'>" . _T('activer_plugin') . "</label>" |
|
| 131 | + . "\n<label for='label_$id_input'>"._T('activer_plugin')."</label>" |
|
| 132 | 132 | . "</div>"; |
| 133 | 133 | } |
| 134 | 134 | |
@@ -176,11 +176,11 @@ discard block |
||
| 176 | 176 | . "<h3><a href='$url' rel='info'>" |
| 177 | 177 | . $nom |
| 178 | 178 | . "</a></h3>" |
| 179 | - . " <span class='version'>" . $info['version'] . "</span>" |
|
| 179 | + . " <span class='version'>".$info['version']."</span>" |
|
| 180 | 180 | . " <span class='etat'> - " |
| 181 | 181 | . plugin_etat_en_clair($info['etat']) |
| 182 | 182 | . "</span>" |
| 183 | - . "<div class='short'>" . $slogan . "</div>" |
|
| 183 | + . "<div class='short'>".$slogan."</div>" |
|
| 184 | 184 | . $i |
| 185 | 185 | . "</div>"; |
| 186 | 186 | } |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | $text2 = _T('info_desinstaller_plugin'); |
| 196 | 196 | $file = basename($plug_file); |
| 197 | 197 | |
| 198 | - return "<div class='actions'>[" . |
|
| 198 | + return "<div class='actions'>[". |
|
| 199 | 199 | "<a href='$action' |
| 200 | 200 | onclick='return confirm(\"$text $nom ?\\n$text2\")'>" |
| 201 | 201 | . $text |
@@ -217,17 +217,17 @@ discard block |
||
| 217 | 217 | $etat = 'developpement'; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - return _T('plugin_etat_' . $etat); |
|
| 220 | + return _T('plugin_etat_'.$etat); |
|
| 221 | 221 | } |
| 222 | 222 | |
| 223 | 223 | // https://code.spip.net/@plugin_propre |
| 224 | -function plugin_propre($texte, $module = '',$propre='propre') { |
|
| 224 | +function plugin_propre($texte, $module = '', $propre = 'propre') { |
|
| 225 | 225 | // retirer le retour a la racine du module, car le find_in_path se fait depuis la racine |
| 226 | 226 | if (_DIR_RACINE and strncmp($module, _DIR_RACINE, strlen(_DIR_RACINE)) == 0) { |
| 227 | 227 | $module = substr($module, strlen(_DIR_RACINE)); |
| 228 | 228 | } |
| 229 | 229 | if (preg_match("|^\w+_[\w_]+$|", $texte)) { |
| 230 | - $texte = _T(($module ? "$module:" : '') . $texte, array(), array('force' => false)); |
|
| 230 | + $texte = _T(($module ? "$module:" : '').$texte, array(), array('force' => false)); |
|
| 231 | 231 | } |
| 232 | 232 | |
| 233 | 233 | return $propre($texte); |
@@ -259,9 +259,9 @@ discard block |
||
| 259 | 259 | if (isset($info['documentation']) |
| 260 | 260 | and $lien = $info['documentation'] |
| 261 | 261 | ) { |
| 262 | - $description .= "<p><em class='site'><a href='$lien' class='spip_out'>" . _T('en_savoir_plus') . '</a></em></p>'; |
|
| 262 | + $description .= "<p><em class='site'><a href='$lien' class='spip_out'>"._T('en_savoir_plus').'</a></em></p>'; |
|
| 263 | 263 | } |
| 264 | - $s .= "<dd class='desc'>" . $description . "</dd>\n"; |
|
| 264 | + $s .= "<dd class='desc'>".$description."</dd>\n"; |
|
| 265 | 265 | |
| 266 | 266 | if (isset($info['auteur'])) { |
| 267 | 267 | if (is_array($info['auteur'])) { |
@@ -271,15 +271,15 @@ discard block |
||
| 271 | 271 | $a = trim($info['auteur']); |
| 272 | 272 | } |
| 273 | 273 | if ($a) { |
| 274 | - $s .= "<dt class='auteurs'>" . _T('public:par_auteur') . "</dt><dd class='auteurs'>" . PtoBR(propre($a, |
|
| 275 | - $dir)) . "</dd>\n"; |
|
| 274 | + $s .= "<dt class='auteurs'>"._T('public:par_auteur')."</dt><dd class='auteurs'>".PtoBR(propre($a, |
|
| 275 | + $dir))."</dd>\n"; |
|
| 276 | 276 | } |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | if (isset($info['credit'])) { |
| 280 | 280 | if ($a = formater_credits($info['credit'], ', ')) { |
| 281 | - $s .= "<dt class='credits'>" . _T('plugin_info_credit') . "</dt><dd class='credits'>" . PtoBR(propre($a, |
|
| 282 | - $dir)) . "</dd>\n"; |
|
| 281 | + $s .= "<dt class='credits'>"._T('plugin_info_credit')."</dt><dd class='credits'>".PtoBR(propre($a, |
|
| 282 | + $dir))."</dd>\n"; |
|
| 283 | 283 | } |
| 284 | 284 | } |
| 285 | 285 | |
@@ -291,8 +291,8 @@ discard block |
||
| 291 | 291 | $a = trim($info['licence']); |
| 292 | 292 | } |
| 293 | 293 | if ($a) { |
| 294 | - $s .= "<dt class='licence'>" . _T('intitule_licence') . "</dt><dd class='licence'>" . PtoBR(propre($a, |
|
| 295 | - $dir)) . "</dd>\n"; |
|
| 294 | + $s .= "<dt class='licence'>"._T('intitule_licence')."</dt><dd class='licence'>".PtoBR(propre($a, |
|
| 295 | + $dir))."</dd>\n"; |
|
| 296 | 296 | } |
| 297 | 297 | } |
| 298 | 298 | |
@@ -303,23 +303,22 @@ discard block |
||
| 303 | 303 | // |
| 304 | 304 | $infotech = array(); |
| 305 | 305 | |
| 306 | - $version = "<dt>" . _T('version') . "</dt><dd>" . $info['version']; |
|
| 306 | + $version = "<dt>"._T('version')."</dt><dd>".$info['version']; |
|
| 307 | 307 | // Version VCS |
| 308 | - if ($vcs = version_vcs_courante($dir_plugins . $plug_file)) { |
|
| 309 | - $version .= ' ' . $vcs; |
|
| 308 | + if ($vcs = version_vcs_courante($dir_plugins.$plug_file)) { |
|
| 309 | + $version .= ' '.$vcs; |
|
| 310 | 310 | } |
| 311 | 311 | $version .= "</dd>"; |
| 312 | 312 | $infotech[] = $version; |
| 313 | - $infotech[] = "<dt>" . _T('repertoire_plugins') . "</dt><dd>" . joli_repertoire("$dir_plugins$plug_file") . "</dd>"; |
|
| 313 | + $infotech[] = "<dt>"._T('repertoire_plugins')."</dt><dd>".joli_repertoire("$dir_plugins$plug_file")."</dd>"; |
|
| 314 | 314 | // source zip le cas echeant |
| 315 | - $infotech[] = (lire_fichier($dir_plugins . $plug_file . '/install.log', $log) |
|
| 315 | + $infotech[] = (lire_fichier($dir_plugins.$plug_file.'/install.log', $log) |
|
| 316 | 316 | and preg_match(',^source:(.*)$,m', $log, $r)) |
| 317 | - ? '<dt>' . _T('plugin_source') . '</dt><dd>' . trim($r[1]) . "</dd>" |
|
| 317 | + ? '<dt>'._T('plugin_source').'</dt><dd>'.trim($r[1])."</dd>" |
|
| 318 | 318 | : ''; |
| 319 | 319 | |
| 320 | - $infotech[] = !$info['necessite'] ? '' : |
|
| 321 | - ('<dt>' . _T('plugin_info_necessite') . '</dt><dd>' . join(' ', |
|
| 322 | - array_map('array_shift', $info['necessite'])) . '</dd>'); |
|
| 320 | + $infotech[] = !$info['necessite'] ? '' : ('<dt>'._T('plugin_info_necessite').'</dt><dd>'.join(' ', |
|
| 321 | + array_map('array_shift', $info['necessite'])).'</dd>'); |
|
| 323 | 322 | |
| 324 | 323 | $s .= "<dl class='tech'>" |
| 325 | 324 | . join('', $infotech) |
@@ -340,8 +339,8 @@ discard block |
||
| 340 | 339 | $texte .= |
| 341 | 340 | (!is_array($_credit)) |
| 342 | 341 | ? PtoBR(propre($_credit)) |
| 343 | - : ($_credit['url'] ? '<a href="' . $_credit['url'] . '">' : '') . |
|
| 344 | - $_credit['nom'] . |
|
| 342 | + : ($_credit['url'] ? '<a href="'.$_credit['url'].'">' : ''). |
|
| 343 | + $_credit['nom']. |
|
| 345 | 344 | ($_credit['url'] ? '</a>' : ''); |
| 346 | 345 | } |
| 347 | 346 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | = spip_connect_db($adresse_db, $port, $login_db, $pass_db, '', $server_db); |
| 46 | 46 | |
| 47 | 47 | $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
| 48 | - = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 48 | + = $GLOBALS['spip_'.$server_db.'_functions_'.$GLOBALS['spip_sql_version']]; |
|
| 49 | 49 | |
| 50 | 50 | $fquery = sql_serveur('query', $server_db); |
| 51 | 51 | if ($choix_db == 'new_spip') { |
@@ -55,13 +55,13 @@ discard block |
||
| 55 | 55 | if (!$ok) { |
| 56 | 56 | $re = "Impossible de creer la base $re"; |
| 57 | 57 | spip_log($re); |
| 58 | - return '<p>' . _T('avis_connexion_erreur_creer_base') . "</p><!--\n$re\n-->"; |
|
| 58 | + return '<p>'._T('avis_connexion_erreur_creer_base')."</p><!--\n$re\n-->"; |
|
| 59 | 59 | } |
| 60 | 60 | } else { |
| 61 | 61 | $re = "Le nom de la base doit correspondre a $re"; |
| 62 | 62 | spip_log($re); |
| 63 | 63 | |
| 64 | - return '<p>' . _T('avis_connexion_erreur_nom_base') . "</p><!--\n$re\n-->"; |
|
| 64 | + return '<p>'._T('avis_connexion_erreur_nom_base')."</p><!--\n$re\n-->"; |
|
| 65 | 65 | } |
| 66 | 66 | } |
| 67 | 67 | |
@@ -72,14 +72,14 @@ discard block |
||
| 72 | 72 | = spip_connect_db($adresse_db, $port, $login_db, $pass_db, $sel_db, $server_db); |
| 73 | 73 | |
| 74 | 74 | $GLOBALS['connexions'][$server_db][$GLOBALS['spip_sql_version']] |
| 75 | - = $GLOBALS['spip_' . $server_db . '_functions_' . $GLOBALS['spip_sql_version']]; |
|
| 75 | + = $GLOBALS['spip_'.$server_db.'_functions_'.$GLOBALS['spip_sql_version']]; |
|
| 76 | 76 | |
| 77 | 77 | // Completer le tableau decrivant la connexion |
| 78 | 78 | |
| 79 | 79 | $GLOBALS['connexions'][$server_db]['prefixe'] = $table_prefix; |
| 80 | 80 | $GLOBALS['connexions'][$server_db]['db'] = $sel_db; |
| 81 | 81 | |
| 82 | - $old = sql_showbase($table_prefix . '_meta', $server_db); |
|
| 82 | + $old = sql_showbase($table_prefix.'_meta', $server_db); |
|
| 83 | 83 | if ($old) { |
| 84 | 84 | $old = sql_fetch($old, $server_db); |
| 85 | 85 | } |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | $charset['charset']; |
| 99 | 99 | $charsetbase = $charset['charset']; |
| 100 | 100 | } else { |
| 101 | - spip_log(_DEFAULT_CHARSET . ' inconnu du serveur SQL'); |
|
| 101 | + spip_log(_DEFAULT_CHARSET.' inconnu du serveur SQL'); |
|
| 102 | 102 | $charsetbase = 'standard'; |
| 103 | 103 | } |
| 104 | 104 | spip_log("Creation des tables. Codage $charsetbase"); |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | if ($r) { |
| 149 | 149 | $r = sql_fetch($r, $server_db); |
| 150 | 150 | } |
| 151 | - $version_installee = !$r ? 0 : (double)$r['valeur']; |
|
| 151 | + $version_installee = !$r ? 0 : (double) $r['valeur']; |
|
| 152 | 152 | if (!$version_installee or ($GLOBALS['spip_version_base'] < $version_installee)) { |
| 153 | 153 | $fupdateq( |
| 154 | 154 | 'spip_meta', |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | '', |
| 158 | 158 | $server_db |
| 159 | 159 | ); |
| 160 | - spip_log('nouvelle version installee: ' . $GLOBALS['spip_version_base']); |
|
| 160 | + spip_log('nouvelle version installee: '.$GLOBALS['spip_version_base']); |
|
| 161 | 161 | } |
| 162 | 162 | // eliminer la derniere operation d'admin mal terminee |
| 163 | 163 | // notamment la mise a jour |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | if ($chmod_db) { |
| 185 | 185 | install_fichier_connexion( |
| 186 | 186 | _FILE_CHMOD_TMP, |
| 187 | - "if (!defined('_SPIP_CHMOD')) define('_SPIP_CHMOD', " . sprintf('0%3o', $chmod_db) . ");\n" |
|
| 187 | + "if (!defined('_SPIP_CHMOD')) define('_SPIP_CHMOD', ".sprintf('0%3o', $chmod_db).");\n" |
|
| 188 | 188 | ); |
| 189 | 189 | } |
| 190 | 190 | |
@@ -249,16 +249,16 @@ discard block |
||
| 249 | 249 | |
| 250 | 250 | // https://code.spip.net/@install_premier_auteur |
| 251 | 251 | function install_premier_auteur($email, $login, $nom, $pass, $hidden, $auteur_obligatoire) { |
| 252 | - return info_progression_etape(3, 'etape_', 'install/') . |
|
| 252 | + return info_progression_etape(3, 'etape_', 'install/'). |
|
| 253 | 253 | info_etape( |
| 254 | 254 | _T('info_informations_personnelles'), |
| 255 | - '<b>' . _T('texte_informations_personnelles_1') . '</b>' . |
|
| 256 | - aider('install5', true) . |
|
| 257 | - '<p>' . |
|
| 255 | + '<b>'._T('texte_informations_personnelles_1').'</b>'. |
|
| 256 | + aider('install5', true). |
|
| 257 | + '<p>'. |
|
| 258 | 258 | ($auteur_obligatoire ? |
| 259 | 259 | '' |
| 260 | 260 | : |
| 261 | - _T('texte_informations_personnelles_2') . ' ' . _T('info_laisser_champs_vides') |
|
| 261 | + _T('texte_informations_personnelles_2').' '._T('info_laisser_champs_vides') |
|
| 262 | 262 | ) |
| 263 | 263 | ) |
| 264 | 264 | . generer_form_ecrire('install', ( |
@@ -268,12 +268,12 @@ discard block |
||
| 268 | 268 | _T('info_identification_publique'), |
| 269 | 269 | array( |
| 270 | 270 | 'nom' => array( |
| 271 | - 'label' => '<b>' . _T('entree_signature') . "</b><br />\n" . _T('entree_nom_pseudo_1') . "\n", |
|
| 271 | + 'label' => '<b>'._T('entree_signature')."</b><br />\n"._T('entree_nom_pseudo_1')."\n", |
|
| 272 | 272 | 'valeur' => $nom, |
| 273 | 273 | 'required' => $auteur_obligatoire, |
| 274 | 274 | ), |
| 275 | 275 | 'email' => array( |
| 276 | - 'label' => '<b>' . _T('entree_adresse_email') . "</b>\n", |
|
| 276 | + 'label' => '<b>'._T('entree_adresse_email')."</b>\n", |
|
| 277 | 277 | 'valeur' => $email, |
| 278 | 278 | ) |
| 279 | 279 | ) |
@@ -283,23 +283,23 @@ discard block |
||
| 283 | 283 | _T('entree_identifiants_connexion'), |
| 284 | 284 | array( |
| 285 | 285 | 'login' => array( |
| 286 | - 'label' => '<b>' . _T('entree_login') . "</b><br />\n" . _T( |
|
| 286 | + 'label' => '<b>'._T('entree_login')."</b><br />\n"._T( |
|
| 287 | 287 | 'info_login_trop_court_car_pluriel', |
| 288 | 288 | array('nb' => _LOGIN_TROP_COURT) |
| 289 | - ) . "\n", |
|
| 289 | + )."\n", |
|
| 290 | 290 | 'valeur' => $login, |
| 291 | 291 | 'required' => $auteur_obligatoire, |
| 292 | 292 | ), |
| 293 | 293 | 'pass' => array( |
| 294 | - 'label' => '<b>' . _T('entree_mot_passe') . "</b><br />\n" . _T( |
|
| 294 | + 'label' => '<b>'._T('entree_mot_passe')."</b><br />\n"._T( |
|
| 295 | 295 | 'info_passe_trop_court_car_pluriel', |
| 296 | 296 | array('nb' => _PASS_LONGUEUR_MINI) |
| 297 | - ) . "\n", |
|
| 297 | + )."\n", |
|
| 298 | 298 | 'valeur' => $pass, |
| 299 | 299 | 'required' => $auteur_obligatoire, |
| 300 | 300 | ), |
| 301 | 301 | 'pass_verif' => array( |
| 302 | - 'label' => '<b>' . _T('info_confirmer_passe') . "</b><br />\n", |
|
| 302 | + 'label' => '<b>'._T('info_confirmer_passe')."</b><br />\n", |
|
| 303 | 303 | 'valeur' => $pass, |
| 304 | 304 | 'required' => $auteur_obligatoire, |
| 305 | 305 | ) |
@@ -344,9 +344,9 @@ discard block |
||
| 344 | 344 | |
| 345 | 345 | if ($res) { |
| 346 | 346 | $res = info_progression_etape(2, 'etape_', 'install/', true) |
| 347 | - . "<div class='error'><h3>" . _T('avis_operation_echec') . '</h3>' |
|
| 347 | + . "<div class='error'><h3>"._T('avis_operation_echec').'</h3>' |
|
| 348 | 348 | . $res |
| 349 | - . '<p>' . _T('texte_operation_echec') . '</p>' |
|
| 349 | + . '<p>'._T('texte_operation_echec').'</p>' |
|
| 350 | 350 | . '</div>'; |
| 351 | 351 | } |
| 352 | 352 | } else { |
@@ -40,8 +40,8 @@ discard block |
||
| 40 | 40 | if ($fail) { |
| 41 | 41 | echo info_etape(_T('info_chemin_acces_annuaire')), |
| 42 | 42 | info_progression_etape(3, 'etape_ldap', 'install/', true), |
| 43 | - "<div class='error'><p><b>" . _T('avis_operation_echec') . '</b></p><p>' . _T('avis_chemin_invalide_1'), |
|
| 44 | - ' (<tt>' . spip_htmlspecialchars($base_ldap) . '</tt>) ' . _T('avis_chemin_invalide_2') . '</p></div>'; |
|
| 43 | + "<div class='error'><p><b>"._T('avis_operation_echec').'</b></p><p>'._T('avis_chemin_invalide_1'), |
|
| 44 | + ' (<tt>'.spip_htmlspecialchars($base_ldap).'</tt>) '._T('avis_chemin_invalide_2').'</p></div>'; |
|
| 45 | 45 | } else { |
| 46 | 46 | info_etape(_T('info_reglage_ldap')); |
| 47 | 47 | echo info_progression_etape(4, 'etape_ldap', 'install/'); |
@@ -54,12 +54,12 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | $res = install_propager(array('adresse_ldap', 'port_ldap', 'login_ldap', 'pass_ldap', 'protocole_ldap', 'tls_ldap')) |
| 56 | 56 | . "<input type='hidden' name='etape' value='ldap5' />" |
| 57 | - . "<input type='hidden' name='base_ldap' value='" . spip_htmlentities($base_ldap) . "' />" |
|
| 57 | + . "<input type='hidden' name='base_ldap' value='".spip_htmlentities($base_ldap)."' />" |
|
| 58 | 58 | . fieldset( |
| 59 | 59 | _T('info_statut_utilisateurs_1'), |
| 60 | 60 | array( |
| 61 | 61 | 'statut_ldap' => array( |
| 62 | - 'label' => _T('info_statut_utilisateurs_2') . '<br />', |
|
| 62 | + 'label' => _T('info_statut_utilisateurs_2').'<br />', |
|
| 63 | 63 | 'valeur' => $statut_ldap, |
| 64 | 64 | 'alternatives' => $statuts |
| 65 | 65 | ) |
@@ -77,9 +77,9 @@ discard block |
||
| 77 | 77 | // https://code.spip.net/@liste_statuts_ldap |
| 78 | 78 | function liste_statuts_ldap() { |
| 79 | 79 | $recom = array( |
| 80 | - 'info_administrateurs' => ('<b>' . _T('info_administrateur_1') . '</b> ' . _T('info_administrateur_2') . '<br />'), |
|
| 81 | - 'info_redacteurs' => ('<b>' . _T('info_redacteur_1') . '</b> ' . _T('info_redacteur_2') . '<br />'), |
|
| 82 | - 'info_visiteurs' => ('<b>' . _T('info_visiteur_1') . '</b> ' . _T('info_visiteur_2') . '<br />') |
|
| 80 | + 'info_administrateurs' => ('<b>'._T('info_administrateur_1').'</b> '._T('info_administrateur_2').'<br />'), |
|
| 81 | + 'info_redacteurs' => ('<b>'._T('info_redacteur_1').'</b> '._T('info_redacteur_2').'<br />'), |
|
| 82 | + 'info_visiteurs' => ('<b>'._T('info_visiteur_1').'</b> '._T('info_visiteur_2').'<br />') |
|
| 83 | 83 | ); |
| 84 | 84 | |
| 85 | 85 | $res = array(); |
@@ -95,14 +95,14 @@ discard block |
||
| 95 | 95 | function install_ldap_correspondances() { |
| 96 | 96 | $champs = array(); |
| 97 | 97 | foreach (is_array($GLOBALS['ldap_attributes']) ? $GLOBALS['ldap_attributes'] : array() as $champ => $v) { |
| 98 | - $nom = 'ldap_' . $champ; |
|
| 98 | + $nom = 'ldap_'.$champ; |
|
| 99 | 99 | $val = is_array($v) ? join(',', $v) : strval($v); |
| 100 | 100 | $champs[$nom] = array( |
| 101 | - 'label' => _T('ldap_correspondance', array('champ' => "<tt>$champ</tt>")) . '<br />', |
|
| 101 | + 'label' => _T('ldap_correspondance', array('champ' => "<tt>$champ</tt>")).'<br />', |
|
| 102 | 102 | 'valeur' => $val |
| 103 | 103 | ); |
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | return !$champs ? |
| 107 | - '' : fieldset(_T('ldap_correspondance_1'), $champs, '', _T('ldap_correspondance_2') . '<br /><br />'); |
|
| 107 | + '' : fieldset(_T('ldap_correspondance_1'), $champs, '', _T('ldap_correspondance_2').'<br /><br />'); |
|
| 108 | 108 | } |
@@ -85,7 +85,7 @@ discard block |
||
| 85 | 85 | #if (!$sql_desc) $sql_desc = false; |
| 86 | 86 | #spip_log("Resultat table=$table sql_desc:$sql_desc","dbinstall"._LOG_INFO_IMPORTANTE); |
| 87 | 87 | if (!$sql_desc) { |
| 88 | - spip_log("Echec creation table $table", "maj" . _LOG_CRITIQUE); |
|
| 88 | + spip_log("Echec creation table $table", "maj"._LOG_CRITIQUE); |
|
| 89 | 89 | } |
| 90 | 90 | } |
| 91 | 91 | } else { |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | if (isset($desc['field'])) { |
| 98 | 98 | foreach ($desc['field'] as $field => $type) { |
| 99 | 99 | if (!isset($sql_desc['field'][$field])) { |
| 100 | - sql_alter("TABLE $table ADD $field $type" . ($last ? " AFTER $last" : ""), $serveur); |
|
| 100 | + sql_alter("TABLE $table ADD $field $type".($last ? " AFTER $last" : ""), $serveur); |
|
| 101 | 101 | } |
| 102 | 102 | $last = $field; |
| 103 | 103 | } |
@@ -48,7 +48,7 @@ discard block |
||
| 48 | 48 | // si port est fourni mais pas host, c'est un socket -> compat avec vieille syntaxe de mysql_connect() et anciens fichiers connect.php |
| 49 | 49 | if ( |
| 50 | 50 | $port and !is_numeric($socket = $port) |
| 51 | - and (!$host or $host=='localhost')) { |
|
| 51 | + and (!$host or $host == 'localhost')) { |
|
| 52 | 52 | $link = @mysqli_connect($host, $login, $pass, '', null, $socket); |
| 53 | 53 | } |
| 54 | 54 | elseif ($port) { |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | } |
| 60 | 60 | |
| 61 | 61 | if (!$link) { |
| 62 | - spip_log('Echec mysqli_connect. Erreur : ' . mysqli_connect_error(), 'mysql.' . _LOG_HS); |
|
| 62 | + spip_log('Echec mysqli_connect. Erreur : '.mysqli_connect_error(), 'mysql.'._LOG_HS); |
|
| 63 | 63 | |
| 64 | 64 | return false; |
| 65 | 65 | } |
@@ -76,7 +76,7 @@ discard block |
||
| 76 | 76 | } |
| 77 | 77 | } |
| 78 | 78 | |
| 79 | - spip_log("Connexion MySQLi vers $host, base $db, prefixe $prefixe " . ($ok ? "operationnelle" : 'impossible'), |
|
| 79 | + spip_log("Connexion MySQLi vers $host, base $db, prefixe $prefixe ".($ok ? "operationnelle" : 'impossible'), |
|
| 80 | 80 | _LOG_DEBUG); |
| 81 | 81 | |
| 82 | 82 | return !$ok ? false : array( |
@@ -165,9 +165,9 @@ discard block |
||
| 165 | 165 | */ |
| 166 | 166 | function spip_mysql_set_charset($charset, $serveur = '', $requeter = true) { |
| 167 | 167 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 168 | - spip_log("changement de charset sql : " . "SET NAMES " . _q($charset), _LOG_DEBUG); |
|
| 168 | + spip_log("changement de charset sql : "."SET NAMES "._q($charset), _LOG_DEBUG); |
|
| 169 | 169 | |
| 170 | - return mysqli_query($connexion['link'], $connexion['last'] = "SET NAMES " . _q($charset)); |
|
| 170 | + return mysqli_query($connexion['link'], $connexion['last'] = "SET NAMES "._q($charset)); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | function spip_mysql_get_charset($charset = array(), $serveur = '', $requeter = true) { |
| 183 | 183 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 184 | 184 | $connexion['last'] = $c = "SHOW CHARACTER SET" |
| 185 | - . (!$charset ? '' : (" LIKE " . _q($charset['charset']))); |
|
| 185 | + . (!$charset ? '' : (" LIKE "._q($charset['charset']))); |
|
| 186 | 186 | |
| 187 | 187 | return spip_mysql_fetch(mysqli_query($connexion['link'], $c), null, $serveur); |
| 188 | 188 | } |
@@ -242,19 +242,19 @@ discard block |
||
| 242 | 242 | $debug = ''; |
| 243 | 243 | if (defined('_DEBUG_SLOW_QUERIES') and _DEBUG_SLOW_QUERIES) { |
| 244 | 244 | if (isset($GLOBALS['debug']['aucasou'])) { |
| 245 | - list(, $id, , $infos) = $GLOBALS['debug']['aucasou']; |
|
| 246 | - $debug .= "BOUCLE$id @ " . (isset($infos[0]) ? $infos[0] : '') . " | "; |
|
| 245 | + list(, $id,, $infos) = $GLOBALS['debug']['aucasou']; |
|
| 246 | + $debug .= "BOUCLE$id @ ".(isset($infos[0]) ? $infos[0] : '')." | "; |
|
| 247 | 247 | } |
| 248 | 248 | if (isset($_SERVER['REQUEST_URI'])) { |
| 249 | 249 | $debug .= $_SERVER['REQUEST_URI']; |
| 250 | 250 | } |
| 251 | 251 | if (!empty($GLOBALS['ip'])) { |
| 252 | - $debug .= ' + ' . $GLOBALS['ip']; |
|
| 252 | + $debug .= ' + '.$GLOBALS['ip']; |
|
| 253 | 253 | } |
| 254 | - $debug = ' /* ' . mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)) . ' */'; |
|
| 254 | + $debug = ' /* '.mysqli_real_escape_string($link, str_replace('*/', '@/', $debug)).' */'; |
|
| 255 | 255 | } |
| 256 | 256 | |
| 257 | - $r = mysqli_query($link, $query . $debug); |
|
| 257 | + $r = mysqli_query($link, $query.$debug); |
|
| 258 | 258 | |
| 259 | 259 | //Eviter de propager le GoneAway sur les autres requetes d'un même processus PHP |
| 260 | 260 | if ($e = spip_mysql_errno($serveur)) { // Log d'un Gone Away |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; |
| 268 | 268 | $link = $connexion['link']; |
| 269 | 269 | //On retente au cas où |
| 270 | - $r = mysqli_query($link, $query . $debug); |
|
| 270 | + $r = mysqli_query($link, $query.$debug); |
|
| 271 | 271 | } |
| 272 | 272 | } |
| 273 | 273 | |
@@ -295,7 +295,7 @@ discard block |
||
| 295 | 295 | // d'utiliser ceux-ci, copie-colle de phpmyadmin |
| 296 | 296 | $query = preg_replace(",^TABLE\s*`([^`]*)`,i", "TABLE \\1", $query); |
| 297 | 297 | |
| 298 | - return spip_mysql_query("ALTER " . $query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 298 | + return spip_mysql_query("ALTER ".$query, $serveur, $requeter); # i.e. que PG se debrouille |
|
| 299 | 299 | } |
| 300 | 300 | |
| 301 | 301 | |
@@ -308,7 +308,7 @@ discard block |
||
| 308 | 308 | * @return bool Toujours true |
| 309 | 309 | */ |
| 310 | 310 | function spip_mysql_optimize($table, $serveur = '', $requeter = true) { |
| 311 | - spip_mysql_query("OPTIMIZE TABLE " . $table); |
|
| 311 | + spip_mysql_query("OPTIMIZE TABLE ".$table); |
|
| 312 | 312 | |
| 313 | 313 | return true; |
| 314 | 314 | } |
@@ -331,7 +331,7 @@ discard block |
||
| 331 | 331 | $link = $connexion['link']; |
| 332 | 332 | $db = $connexion['db']; |
| 333 | 333 | |
| 334 | - $query = 'EXPLAIN ' . _mysql_traite_query($query, $db, $prefixe); |
|
| 334 | + $query = 'EXPLAIN '._mysql_traite_query($query, $db, $prefixe); |
|
| 335 | 335 | $r = mysqli_query($link, $query); |
| 336 | 336 | |
| 337 | 337 | return spip_mysql_fetch($r, null, $serveur); |
@@ -382,7 +382,7 @@ discard block |
||
| 382 | 382 | . calculer_mysql_expression('WHERE', $where) |
| 383 | 383 | . calculer_mysql_expression('GROUP BY', $groupby, ',') |
| 384 | 384 | . calculer_mysql_expression('HAVING', $having) |
| 385 | - . ($orderby ? ("\nORDER BY " . spip_mysql_order($orderby)) : '') |
|
| 385 | + . ($orderby ? ("\nORDER BY ".spip_mysql_order($orderby)) : '') |
|
| 386 | 386 | . ($limit ? "\nLIMIT $limit" : ''); |
| 387 | 387 | |
| 388 | 388 | // renvoyer la requete inerte si demandee |
@@ -472,12 +472,12 @@ discard block |
||
| 472 | 472 | $exp = "\n$expression "; |
| 473 | 473 | |
| 474 | 474 | if (!is_array($v)) { |
| 475 | - return $exp . $v; |
|
| 475 | + return $exp.$v; |
|
| 476 | 476 | } else { |
| 477 | 477 | if (strtoupper($join) === 'AND') { |
| 478 | - return $exp . join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 478 | + return $exp.join("\n\t$join ", array_map('calculer_mysql_where', $v)); |
|
| 479 | 479 | } else { |
| 480 | - return $exp . join($join, $v); |
|
| 480 | + return $exp.join($join, $v); |
|
| 481 | 481 | } |
| 482 | 482 | } |
| 483 | 483 | } |
@@ -495,17 +495,17 @@ discard block |
||
| 495 | 495 | if (substr($k, -1) == '@') { |
| 496 | 496 | // c'est une jointure qui se refere au from precedent |
| 497 | 497 | // pas de virgule |
| 498 | - $res .= ' ' . $v; |
|
| 498 | + $res .= ' '.$v; |
|
| 499 | 499 | } else { |
| 500 | 500 | if (!is_numeric($k)) { |
| 501 | 501 | $p = strpos($v, " "); |
| 502 | 502 | if ($p) { |
| 503 | - $v = substr($v, 0, $p) . " AS `$k`" . substr($v, $p); |
|
| 503 | + $v = substr($v, 0, $p)." AS `$k`".substr($v, $p); |
|
| 504 | 504 | } else { |
| 505 | 505 | $v .= " AS `$k`"; |
| 506 | 506 | } |
| 507 | 507 | } |
| 508 | - $res .= ', ' . $v; |
|
| 508 | + $res .= ', '.$v; |
|
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | |
@@ -534,13 +534,13 @@ discard block |
||
| 534 | 534 | function _mysql_traite_query($query, $db = '', $prefixe = '') { |
| 535 | 535 | |
| 536 | 536 | if ($GLOBALS['mysql_rappel_nom_base'] and $db) { |
| 537 | - $pref = '`' . $db . '`.'; |
|
| 537 | + $pref = '`'.$db.'`.'; |
|
| 538 | 538 | } else { |
| 539 | 539 | $pref = ''; |
| 540 | 540 | } |
| 541 | 541 | |
| 542 | 542 | if ($prefixe) { |
| 543 | - $pref .= $prefixe . "_"; |
|
| 543 | + $pref .= $prefixe."_"; |
|
| 544 | 544 | } |
| 545 | 545 | |
| 546 | 546 | if (!preg_match('/\s(SET|VALUES|WHERE|DATABASE)\s/i', $query, $regs)) { |
@@ -554,12 +554,12 @@ discard block |
||
| 554 | 554 | if (stripos($suite, "SELECT") !== false) { |
| 555 | 555 | list($suite, $textes) = query_echappe_textes($suite); |
| 556 | 556 | if (preg_match('/^(.*?)([(]\s*SELECT\b.*)$/si', $suite, $r)) { |
| 557 | - $suite = $r[1] . _mysql_traite_query($r[2], $db, $prefixe); |
|
| 557 | + $suite = $r[1]._mysql_traite_query($r[2], $db, $prefixe); |
|
| 558 | 558 | } |
| 559 | 559 | $suite = query_reinjecte_textes($suite, $textes); |
| 560 | 560 | } |
| 561 | 561 | } |
| 562 | - $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1' . $pref, $query) . $suite; |
|
| 562 | + $r = preg_replace(_SQL_PREFIXE_TABLE_MYSQL, '\1'.$pref, $query).$suite; |
|
| 563 | 563 | |
| 564 | 564 | // en option, remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
| 565 | 565 | // remplacer les emoji (que mysql ne sait pas gérer) en 💩 |
@@ -593,7 +593,7 @@ discard block |
||
| 593 | 593 | $link = _mysql_link($serveur); |
| 594 | 594 | $ok = mysqli_select_db($link, $db); |
| 595 | 595 | if (!$ok) { |
| 596 | - spip_log('Echec mysqli_selectdb. Erreur : ' . mysqli_error($link), 'mysql.' . _LOG_CRITIQUE); |
|
| 596 | + spip_log('Echec mysqli_selectdb. Erreur : '.mysqli_error($link), 'mysql.'._LOG_CRITIQUE); |
|
| 597 | 597 | } |
| 598 | 598 | |
| 599 | 599 | return $ok; |
@@ -683,10 +683,10 @@ discard block |
||
| 683 | 683 | |
| 684 | 684 | $character_set = ""; |
| 685 | 685 | if (@$GLOBALS['meta']['charset_sql_base']) { |
| 686 | - $character_set .= " CHARACTER SET " . $GLOBALS['meta']['charset_sql_base']; |
|
| 686 | + $character_set .= " CHARACTER SET ".$GLOBALS['meta']['charset_sql_base']; |
|
| 687 | 687 | } |
| 688 | 688 | if (@$GLOBALS['meta']['charset_collation_sql_base']) { |
| 689 | - $character_set .= " COLLATE " . $GLOBALS['meta']['charset_collation_sql_base']; |
|
| 689 | + $character_set .= " COLLATE ".$GLOBALS['meta']['charset_collation_sql_base']; |
|
| 690 | 690 | } |
| 691 | 691 | |
| 692 | 692 | foreach ($champs as $k => $v) { |
@@ -695,7 +695,7 @@ discard block |
||
| 695 | 695 | if (preg_match(',(char|text),i', $defs[1]) |
| 696 | 696 | and !preg_match(',(binary|CHARACTER|COLLATE),i', $v) |
| 697 | 697 | ) { |
| 698 | - $v = $defs[1] . $character_set . ' ' . substr($v, strlen($defs[1])); |
|
| 698 | + $v = $defs[1].$character_set.' '.substr($v, strlen($defs[1])); |
|
| 699 | 699 | } |
| 700 | 700 | } |
| 701 | 701 | |
@@ -707,7 +707,7 @@ discard block |
||
| 707 | 707 | $s = ","; |
| 708 | 708 | } |
| 709 | 709 | $temporary = $temporary ? 'TEMPORARY' : ''; |
| 710 | - $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query" . ($keys ? ",$keys" : '') . ")" |
|
| 710 | + $q = "CREATE $temporary TABLE IF NOT EXISTS $nom ($query".($keys ? ",$keys" : '').")" |
|
| 711 | 711 | . " ENGINE=MyISAM" |
| 712 | 712 | . ($character_set ? " DEFAULT $character_set" : "") |
| 713 | 713 | . "\n"; |
@@ -787,7 +787,7 @@ discard block |
||
| 787 | 787 | return false; |
| 788 | 788 | } |
| 789 | 789 | |
| 790 | - $query = "CREATE VIEW $nom AS " . $query_select; |
|
| 790 | + $query = "CREATE VIEW $nom AS ".$query_select; |
|
| 791 | 791 | |
| 792 | 792 | return spip_mysql_query($query, $serveur, $requeter); |
| 793 | 793 | } |
@@ -845,7 +845,7 @@ discard block |
||
| 845 | 845 | * Ressource à utiliser avec sql_fetch() |
| 846 | 846 | **/ |
| 847 | 847 | function spip_mysql_showbase($match, $serveur = '', $requeter = true) { |
| 848 | - return spip_mysql_query("SHOW TABLES LIKE " . _q($match), $serveur, $requeter); |
|
| 848 | + return spip_mysql_query("SHOW TABLES LIKE "._q($match), $serveur, $requeter); |
|
| 849 | 849 | } |
| 850 | 850 | |
| 851 | 851 | /** |
@@ -939,22 +939,22 @@ discard block |
||
| 939 | 939 | } |
| 940 | 940 | if ($val['Default'] === '0' || $val['Default']) { |
| 941 | 941 | if (preg_match('/[A-Z_]/', $val['Default'])) { |
| 942 | - $nfields[$val["Field"]] .= ' DEFAULT ' . $val['Default']; |
|
| 942 | + $nfields[$val["Field"]] .= ' DEFAULT '.$val['Default']; |
|
| 943 | 943 | } else { |
| 944 | - $nfields[$val["Field"]] .= " DEFAULT '" . $val['Default'] . "'"; |
|
| 944 | + $nfields[$val["Field"]] .= " DEFAULT '".$val['Default']."'"; |
|
| 945 | 945 | } |
| 946 | 946 | } |
| 947 | 947 | if ($val['Extra']) { |
| 948 | - $nfields[$val["Field"]] .= ' ' . $val['Extra']; |
|
| 948 | + $nfields[$val["Field"]] .= ' '.$val['Extra']; |
|
| 949 | 949 | } |
| 950 | 950 | if ($val['Key'] == 'PRI') { |
| 951 | 951 | $nkeys['PRIMARY KEY'] = $val["Field"]; |
| 952 | 952 | } else { |
| 953 | 953 | if ($val['Key'] == 'MUL') { |
| 954 | - $nkeys['KEY ' . $val["Field"]] = $val["Field"]; |
|
| 954 | + $nkeys['KEY '.$val["Field"]] = $val["Field"]; |
|
| 955 | 955 | } else { |
| 956 | 956 | if ($val['Key'] == 'UNI') { |
| 957 | - $nkeys['UNIQUE KEY ' . $val["Field"]] = $val["Field"]; |
|
| 957 | + $nkeys['UNIQUE KEY '.$val["Field"]] = $val["Field"]; |
|
| 958 | 958 | } |
| 959 | 959 | } |
| 960 | 960 | } |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | $serveur = '', |
| 1026 | 1026 | $requeter = true |
| 1027 | 1027 | ) { |
| 1028 | - $c = !$groupby ? '*' : ('DISTINCT ' . (is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1028 | + $c = !$groupby ? '*' : ('DISTINCT '.(is_string($groupby) ? $groupby : join(',', $groupby))); |
|
| 1029 | 1029 | |
| 1030 | 1030 | $r = spip_mysql_select("COUNT($c)", $from, $where, '', '', '', $having, $serveur, $requeter); |
| 1031 | 1031 | if (!$requeter) { |
@@ -1065,7 +1065,7 @@ discard block |
||
| 1065 | 1065 | if ($s) { |
| 1066 | 1066 | $trace = debug_backtrace(); |
| 1067 | 1067 | if ($trace[0]['function'] != "spip_mysql_error") { |
| 1068 | - spip_log("$s - $query - " . sql_error_backtrace(), 'mysql.' . _LOG_ERREUR); |
|
| 1068 | + spip_log("$s - $query - ".sql_error_backtrace(), 'mysql.'._LOG_ERREUR); |
|
| 1069 | 1069 | } |
| 1070 | 1070 | } |
| 1071 | 1071 | |
@@ -1232,7 +1232,7 @@ discard block |
||
| 1232 | 1232 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1233 | 1233 | } |
| 1234 | 1234 | |
| 1235 | - return spip_mysql_insert($table, "(" . join(',', array_keys($couples)) . ")", "(" . join(',', $couples) . ")", $desc, |
|
| 1235 | + return spip_mysql_insert($table, "(".join(',', array_keys($couples)).")", "(".join(',', $couples).")", $desc, |
|
| 1236 | 1236 | $serveur, $requeter); |
| 1237 | 1237 | } |
| 1238 | 1238 | |
@@ -1266,7 +1266,7 @@ discard block |
||
| 1266 | 1266 | } |
| 1267 | 1267 | $fields = isset($desc['field']) ? $desc['field'] : array(); |
| 1268 | 1268 | |
| 1269 | - $cles = "(" . join(',', array_keys(reset($tab_couples))) . ')'; |
|
| 1269 | + $cles = "(".join(',', array_keys(reset($tab_couples))).')'; |
|
| 1270 | 1270 | $valeurs = array(); |
| 1271 | 1271 | $r = false; |
| 1272 | 1272 | |
@@ -1275,7 +1275,7 @@ discard block |
||
| 1275 | 1275 | foreach ($couples as $champ => $val) { |
| 1276 | 1276 | $couples[$champ] = spip_mysql_cite($val, $fields[$champ]); |
| 1277 | 1277 | } |
| 1278 | - $valeurs[] = '(' . join(',', $couples) . ')'; |
|
| 1278 | + $valeurs[] = '('.join(',', $couples).')'; |
|
| 1279 | 1279 | if (count($valeurs) >= 100) { |
| 1280 | 1280 | $r = spip_mysql_insert($table, $cles, join(', ', $valeurs), $desc, $serveur, $requeter); |
| 1281 | 1281 | $valeurs = array(); |
@@ -1312,7 +1312,7 @@ discard block |
||
| 1312 | 1312 | function spip_mysql_update($table, $champs, $where = '', $desc = array(), $serveur = '', $requeter = true) { |
| 1313 | 1313 | $set = array(); |
| 1314 | 1314 | foreach ($champs as $champ => $val) { |
| 1315 | - $set[] = $champ . "=$val"; |
|
| 1315 | + $set[] = $champ."=$val"; |
|
| 1316 | 1316 | } |
| 1317 | 1317 | if (!empty($set)) { |
| 1318 | 1318 | return spip_mysql_query( |
@@ -1366,7 +1366,7 @@ discard block |
||
| 1366 | 1366 | } |
| 1367 | 1367 | $set = array(); |
| 1368 | 1368 | foreach ($champs as $champ => $val) { |
| 1369 | - $set[] = $champ . '=' . spip_mysql_cite($val, @$fields[$champ]); |
|
| 1369 | + $set[] = $champ.'='.spip_mysql_cite($val, @$fields[$champ]); |
|
| 1370 | 1370 | } |
| 1371 | 1371 | |
| 1372 | 1372 | return spip_mysql_query( |
@@ -1431,8 +1431,8 @@ discard block |
||
| 1431 | 1431 | * - False en cas d'erreur. |
| 1432 | 1432 | **/ |
| 1433 | 1433 | function spip_mysql_replace($table, $couples, $desc = array(), $serveur = '', $requeter = true) { |
| 1434 | - return spip_mysql_query("REPLACE $table (" . join(',', array_keys($couples)) . ') VALUES (' . join(',', |
|
| 1435 | - array_map('_q', $couples)) . ')', $serveur, $requeter); |
|
| 1434 | + return spip_mysql_query("REPLACE $table (".join(',', array_keys($couples)).') VALUES ('.join(',', |
|
| 1435 | + array_map('_q', $couples)).')', $serveur, $requeter); |
|
| 1436 | 1436 | } |
| 1437 | 1437 | |
| 1438 | 1438 | |
@@ -1461,10 +1461,10 @@ discard block |
||
| 1461 | 1461 | * - False en cas d'erreur. |
| 1462 | 1462 | **/ |
| 1463 | 1463 | function spip_mysql_replace_multi($table, $tab_couples, $desc = array(), $serveur = '', $requeter = true) { |
| 1464 | - $cles = "(" . join(',', array_keys($tab_couples[0])) . ')'; |
|
| 1464 | + $cles = "(".join(',', array_keys($tab_couples[0])).')'; |
|
| 1465 | 1465 | $valeurs = array(); |
| 1466 | 1466 | foreach ($tab_couples as $couples) { |
| 1467 | - $valeurs[] = '(' . join(',', array_map('_q', $couples)) . ')'; |
|
| 1467 | + $valeurs[] = '('.join(',', array_map('_q', $couples)).')'; |
|
| 1468 | 1468 | } |
| 1469 | 1469 | $valeurs = implode(', ', $valeurs); |
| 1470 | 1470 | |
@@ -1484,28 +1484,28 @@ discard block |
||
| 1484 | 1484 | */ |
| 1485 | 1485 | function spip_mysql_multi($objet, $lang) { |
| 1486 | 1486 | $lengthlang = strlen("[$lang]"); |
| 1487 | - $posmulti = "INSTR(" . $objet . ", '<multi>')"; |
|
| 1488 | - $posfinmulti = "INSTR(" . $objet . ", '</multi>')"; |
|
| 1489 | - $debutchaine = "LEFT(" . $objet . ", $posmulti-1)"; |
|
| 1490 | - $finchaine = "RIGHT(" . $objet . ", CHAR_LENGTH(" . $objet . ") -(7+$posfinmulti))"; |
|
| 1491 | - $chainemulti = "TRIM(SUBSTRING(" . $objet . ", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1492 | - $poslang = "INSTR($chainemulti,'[" . $lang . "]')"; |
|
| 1487 | + $posmulti = "INSTR(".$objet.", '<multi>')"; |
|
| 1488 | + $posfinmulti = "INSTR(".$objet.", '</multi>')"; |
|
| 1489 | + $debutchaine = "LEFT(".$objet.", $posmulti-1)"; |
|
| 1490 | + $finchaine = "RIGHT(".$objet.", CHAR_LENGTH(".$objet.") -(7+$posfinmulti))"; |
|
| 1491 | + $chainemulti = "TRIM(SUBSTRING(".$objet.", $posmulti+7, $posfinmulti -(7+$posmulti)))"; |
|
| 1492 | + $poslang = "INSTR($chainemulti,'[".$lang."]')"; |
|
| 1493 | 1493 | $poslang = "IF($poslang=0,INSTR($chainemulti,']')+1,$poslang+$lengthlang)"; |
| 1494 | - $chainelang = "TRIM(SUBSTRING(" . $objet . ", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1495 | - $posfinlang = "INSTR(" . $chainelang . ", '[')"; |
|
| 1494 | + $chainelang = "TRIM(SUBSTRING(".$objet.", $posmulti+7+$poslang-1,$posfinmulti -($posmulti+7+$poslang-1) ))"; |
|
| 1495 | + $posfinlang = "INSTR(".$chainelang.", '[')"; |
|
| 1496 | 1496 | $chainelang = "IF($posfinlang>0,LEFT($chainelang,$posfinlang-1),$chainelang)"; |
| 1497 | 1497 | //$chainelang = "LEFT($chainelang,$posfinlang-1)"; |
| 1498 | - $retour = "(TRIM(IF($posmulti = 0 , " . |
|
| 1499 | - " TRIM(" . $objet . "), " . |
|
| 1500 | - " CONCAT( " . |
|
| 1501 | - " $debutchaine, " . |
|
| 1502 | - " IF( " . |
|
| 1503 | - " $poslang = 0, " . |
|
| 1504 | - " $chainemulti, " . |
|
| 1505 | - " $chainelang" . |
|
| 1506 | - " ), " . |
|
| 1507 | - " $finchaine" . |
|
| 1508 | - " ) " . |
|
| 1498 | + $retour = "(TRIM(IF($posmulti = 0 , ". |
|
| 1499 | + " TRIM(".$objet."), ". |
|
| 1500 | + " CONCAT( ". |
|
| 1501 | + " $debutchaine, ". |
|
| 1502 | + " IF( ". |
|
| 1503 | + " $poslang = 0, ". |
|
| 1504 | + " $chainemulti, ". |
|
| 1505 | + " $chainelang". |
|
| 1506 | + " ), ". |
|
| 1507 | + " $finchaine". |
|
| 1508 | + " ) ". |
|
| 1509 | 1509 | "))) AS multi"; |
| 1510 | 1510 | |
| 1511 | 1511 | return $retour; |
@@ -1522,7 +1522,7 @@ discard block |
||
| 1522 | 1522 | * Valeur hexadécimale pour MySQL |
| 1523 | 1523 | **/ |
| 1524 | 1524 | function spip_mysql_hex($v) { |
| 1525 | - return "0x" . $v; |
|
| 1525 | + return "0x".$v; |
|
| 1526 | 1526 | } |
| 1527 | 1527 | |
| 1528 | 1528 | /** |
@@ -1562,7 +1562,7 @@ discard block |
||
| 1562 | 1562 | * Expression SQL |
| 1563 | 1563 | **/ |
| 1564 | 1564 | function spip_mysql_date_proche($champ, $interval, $unite) { |
| 1565 | - $use_now = ( ($champ === 'maj' or strpos($champ, '.maj')) ? true : false ); |
|
| 1565 | + $use_now = (($champ === 'maj' or strpos($champ, '.maj')) ? true : false); |
|
| 1566 | 1566 | return '(' |
| 1567 | 1567 | . $champ |
| 1568 | 1568 | . (($interval <= 0) ? '>' : '<') |
@@ -1613,7 +1613,7 @@ discard block |
||
| 1613 | 1613 | if (is_numeric($v)) { |
| 1614 | 1614 | return strval($v); |
| 1615 | 1615 | } |
| 1616 | - return "'" . addslashes($v) . "'"; |
|
| 1616 | + return "'".addslashes($v)."'"; |
|
| 1617 | 1617 | } |
| 1618 | 1618 | |
| 1619 | 1619 | if (is_null($v) |
@@ -1635,7 +1635,7 @@ discard block |
||
| 1635 | 1635 | } |
| 1636 | 1636 | } |
| 1637 | 1637 | |
| 1638 | - return ("'" . addslashes($v) . "'"); |
|
| 1638 | + return ("'".addslashes($v)."'"); |
|
| 1639 | 1639 | } |
| 1640 | 1640 | |
| 1641 | 1641 | |
@@ -1664,9 +1664,9 @@ discard block |
||
| 1664 | 1664 | $connexion = &$GLOBALS['connexions'][0]; |
| 1665 | 1665 | $bd = $connexion['db']; |
| 1666 | 1666 | $prefixe = $connexion['prefixe']; |
| 1667 | - $nom = "$bd:$prefixe:$nom" . _LOCK_TIME; |
|
| 1667 | + $nom = "$bd:$prefixe:$nom"._LOCK_TIME; |
|
| 1668 | 1668 | |
| 1669 | - $connexion['last'] = $q = "SELECT GET_LOCK(" . _q($nom) . ", $timeout) AS n"; |
|
| 1669 | + $connexion['last'] = $q = "SELECT GET_LOCK("._q($nom).", $timeout) AS n"; |
|
| 1670 | 1670 | |
| 1671 | 1671 | $q = @sql_fetch(mysqli_query(_mysql_link(), $q)); |
| 1672 | 1672 | if (!$q) { |
@@ -1693,9 +1693,9 @@ discard block |
||
| 1693 | 1693 | $connexion = &$GLOBALS['connexions'][0]; |
| 1694 | 1694 | $bd = $connexion['db']; |
| 1695 | 1695 | $prefixe = $connexion['prefixe']; |
| 1696 | - $nom = "$bd:$prefixe:$nom" . _LOCK_TIME; |
|
| 1696 | + $nom = "$bd:$prefixe:$nom"._LOCK_TIME; |
|
| 1697 | 1697 | |
| 1698 | - $connexion['last'] = $q = "SELECT RELEASE_LOCK(" . _q($nom) . ")"; |
|
| 1698 | + $connexion['last'] = $q = "SELECT RELEASE_LOCK("._q($nom).")"; |
|
| 1699 | 1699 | mysqli_query(_mysql_link(), $q); |
| 1700 | 1700 | } |
| 1701 | 1701 | |
@@ -1731,7 +1731,7 @@ discard block |
||
| 1731 | 1731 | } else { |
| 1732 | 1732 | $GLOBALS['mysql_rappel_nom_base'] = false; |
| 1733 | 1733 | |
| 1734 | - return "\$GLOBALS['mysql_rappel_nom_base'] = false; " . |
|
| 1734 | + return "\$GLOBALS['mysql_rappel_nom_base'] = false; ". |
|
| 1735 | 1735 | "/* echec de test_rappel_nom_base_mysql a l'installation. */\n"; |
| 1736 | 1736 | } |
| 1737 | 1737 | } |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | // Si a ce stade on n'a pas de table, il y a un bug |
| 232 | 232 | if (!is_array($this->tableau)) { |
| 233 | 233 | $this->err = true; |
| 234 | - spip_log("erreur datasource " . var_export($command, true)); |
|
| 234 | + spip_log("erreur datasource ".var_export($command, true)); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | // {datapath query.results} |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | if (isset($this->command['sourcemode']) |
| 272 | 272 | and !in_array($this->command['sourcemode'], array('table', 'array', 'tableau')) |
| 273 | 273 | ) { |
| 274 | - charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true); |
|
| 274 | + charger_fonction($this->command['sourcemode'].'_to_array', 'inc', true); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | # le premier argument peut etre un array, une URL etc. |
@@ -280,7 +280,7 @@ discard block |
||
| 280 | 280 | # avons-nous un cache dispo ? |
| 281 | 281 | $cle = null; |
| 282 | 282 | if (is_string($src)) { |
| 283 | - $cle = 'datasource_' . md5($this->command['sourcemode'] . ':' . var_export($this->command['source'], true)); |
|
| 283 | + $cle = 'datasource_'.md5($this->command['sourcemode'].':'.var_export($this->command['source'], true)); |
|
| 284 | 284 | } |
| 285 | 285 | |
| 286 | 286 | $cache = $this->cache_get($cle); |
@@ -332,7 +332,7 @@ discard block |
||
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | if (!$this->err |
| 335 | - and $data_to_array = charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true) |
|
| 335 | + and $data_to_array = charger_fonction($this->command['sourcemode'].'_to_array', 'inc', true) |
|
| 336 | 336 | ) { |
| 337 | 337 | $args = $this->command['source']; |
| 338 | 338 | $args[0] = $data; |
@@ -467,13 +467,13 @@ discard block |
||
| 467 | 467 | $tv = '%s'; |
| 468 | 468 | } # {par valeur/xx/yy} ?? |
| 469 | 469 | else { |
| 470 | - $tv = 'table_valeur(%s, ' . var_export($r[1], true) . ')'; |
|
| 470 | + $tv = 'table_valeur(%s, '.var_export($r[1], true).')'; |
|
| 471 | 471 | } |
| 472 | 472 | $sortfunc .= ' |
| 473 | - $a = ' . sprintf($tv, '$aa') . '; |
|
| 474 | - $b = ' . sprintf($tv, '$bb') . '; |
|
| 473 | + $a = ' . sprintf($tv, '$aa').'; |
|
| 474 | + $b = ' . sprintf($tv, '$bb').'; |
|
| 475 | 475 | if ($a <> $b) |
| 476 | - return ($a ' . (!empty($r[2]) ? '>' : '<') . ' $b) ? -1 : 1;'; |
|
| 476 | + return ($a ' . (!empty($r[2]) ? '>' : '<').' $b) ? -1 : 1;'; |
|
| 477 | 477 | } |
| 478 | 478 | } |
| 479 | 479 | } |
@@ -626,7 +626,7 @@ discard block |
||
| 626 | 626 | function inc_sql_to_array_dist($data) { |
| 627 | 627 | # sortir le connecteur de $data |
| 628 | 628 | preg_match(',^(?:(\w+):)?(.*)$,Sm', $data, $v); |
| 629 | - $serveur = (string)$v[1]; |
|
| 629 | + $serveur = (string) $v[1]; |
|
| 630 | 630 | $req = trim($v[2]); |
| 631 | 631 | if ($s = sql_query($req, $serveur)) { |
| 632 | 632 | $r = array(); |
@@ -648,7 +648,7 @@ discard block |
||
| 648 | 648 | */ |
| 649 | 649 | function inc_json_to_array_dist($data) { |
| 650 | 650 | if (is_array($json = json_decode($data, true))) { |
| 651 | - return (array)$json; |
|
| 651 | + return (array) $json; |
|
| 652 | 652 | } |
| 653 | 653 | } |
| 654 | 654 | |
@@ -667,13 +667,13 @@ discard block |
||
| 667 | 667 | $i = 1; |
| 668 | 668 | foreach ($entete as $k => $v) { |
| 669 | 669 | if (trim($v) == "") { |
| 670 | - $v = "col" . $i; |
|
| 670 | + $v = "col".$i; |
|
| 671 | 671 | } // reperer des eventuelles cases vides |
| 672 | 672 | if (is_numeric($v) and $v < 0) { |
| 673 | - $v = "__" . $v; |
|
| 673 | + $v = "__".$v; |
|
| 674 | 674 | } // ne pas risquer d'ecraser une cle numerique |
| 675 | 675 | if (is_numeric($v)) { |
| 676 | - $v = "_" . $v; |
|
| 676 | + $v = "_".$v; |
|
| 677 | 677 | } // ne pas risquer d'ecraser une cle numerique |
| 678 | 678 | $v = strtolower(preg_replace(',\W+,', '_', translitteration($v))); |
| 679 | 679 | foreach ($csv as &$item) { |
@@ -757,7 +757,7 @@ discard block |
||
| 757 | 757 | * @return array|bool |
| 758 | 758 | */ |
| 759 | 759 | function inc_pregfiles_to_array_dist($dir, $regexp = -1, $limit = 10000) { |
| 760 | - return (array)preg_files($dir, $regexp, $limit); |
|
| 760 | + return (array) preg_files($dir, $regexp, $limit); |
|
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | /** |
@@ -772,13 +772,13 @@ discard block |
||
| 772 | 772 | $glob_to_array = charger_fonction('glob_to_array', 'inc'); |
| 773 | 773 | $a = $glob_to_array($data); |
| 774 | 774 | foreach ($a as &$v) { |
| 775 | - $b = (array)@stat($v); |
|
| 775 | + $b = (array) @stat($v); |
|
| 776 | 776 | foreach ($b as $k => $ignore) { |
| 777 | 777 | if (is_numeric($k)) { |
| 778 | 778 | unset($b[$k]); |
| 779 | 779 | } |
| 780 | 780 | } |
| 781 | - $b['file'] = preg_replace('`/$`','',$v) ; |
|
| 781 | + $b['file'] = preg_replace('`/$`', '', $v); |
|
| 782 | 782 | $v = array_merge( |
| 783 | 783 | pathinfo($v), |
| 784 | 784 | $b |
@@ -798,7 +798,7 @@ discard block |
||
| 798 | 798 | $xml_array = array(); |
| 799 | 799 | for ($object->rewind(); $object->valid(); $object->next()) { |
| 800 | 800 | if (array_key_exists($key = $object->key(), $xml_array)) { |
| 801 | - $key .= '-' . uniqid(); |
|
| 801 | + $key .= '-'.uniqid(); |
|
| 802 | 802 | } |
| 803 | 803 | $vars = get_object_vars($object->current()); |
| 804 | 804 | if (isset($vars['@attributes'])) { |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | } else { |
| 44 | 44 | # Attention GD sait lire le gif mais pas forcement l'ecrire |
| 45 | 45 | if (function_exists('ImageCreateFromGIF')) { |
| 46 | - $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . "test.gif"); |
|
| 46 | + $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK."test.gif"); |
|
| 47 | 47 | if ($srcImage) { |
| 48 | 48 | $gd_formats_read_gif = ",gif"; |
| 49 | 49 | ImageDestroy($srcImage); |
@@ -67,28 +67,28 @@ discard block |
||
| 67 | 67 | # les formats disponibles en ecriture... (cf. inc_logos) |
| 68 | 68 | |
| 69 | 69 | if (function_exists('ImageCreateFromJPEG')) { |
| 70 | - $srcImage = @ImageCreateFromJPEG(_ROOT_IMG_PACK . "test.jpg"); |
|
| 70 | + $srcImage = @ImageCreateFromJPEG(_ROOT_IMG_PACK."test.jpg"); |
|
| 71 | 71 | if ($srcImage) { |
| 72 | 72 | $gd_formats[] = "jpg"; |
| 73 | 73 | ImageDestroy($srcImage); |
| 74 | 74 | } |
| 75 | 75 | } |
| 76 | 76 | if (function_exists('ImageCreateFromGIF')) { |
| 77 | - $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK . "test.gif"); |
|
| 77 | + $srcImage = @ImageCreateFromGIF(_ROOT_IMG_PACK."test.gif"); |
|
| 78 | 78 | if ($srcImage) { |
| 79 | 79 | $gd_formats[] = "gif"; |
| 80 | 80 | ImageDestroy($srcImage); |
| 81 | 81 | } |
| 82 | 82 | } |
| 83 | 83 | if (function_exists('ImageCreateFromPNG')) { |
| 84 | - $srcImage = @ImageCreateFromPNG(_ROOT_IMG_PACK . "test.png"); |
|
| 84 | + $srcImage = @ImageCreateFromPNG(_ROOT_IMG_PACK."test.png"); |
|
| 85 | 85 | if ($srcImage) { |
| 86 | 86 | $gd_formats[] = "png"; |
| 87 | 87 | ImageDestroy($srcImage); |
| 88 | 88 | } |
| 89 | 89 | } |
| 90 | 90 | if (function_exists('ImageCreateFromWEBP')) { |
| 91 | - $srcImage = @ImageCreateFromWEBP(_ROOT_IMG_PACK . "test.webp"); |
|
| 91 | + $srcImage = @ImageCreateFromWEBP(_ROOT_IMG_PACK."test.webp"); |
|
| 92 | 92 | if ($srcImage) { |
| 93 | 93 | $gd_formats[] = "webp"; |
| 94 | 94 | ImageDestroy($srcImage); |
@@ -96,10 +96,10 @@ discard block |
||
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | |
| 99 | - if (! empty($gd_formats)) { |
|
| 99 | + if (!empty($gd_formats)) { |
|
| 100 | 100 | $gd_formats = join(",", $gd_formats); |
| 101 | 101 | } |
| 102 | - ecrire_meta("gd_formats_read", $gd_formats . $gd_formats_read_gif); |
|
| 102 | + ecrire_meta("gd_formats_read", $gd_formats.$gd_formats_read_gif); |
|
| 103 | 103 | ecrire_meta("gd_formats", $gd_formats); |
| 104 | 104 | } // verifier les formats netpbm |
| 105 | 105 | else { |
@@ -117,9 +117,9 @@ discard block |
||
| 117 | 117 | $pnmtojpeg_command = str_replace("pnmscale", |
| 118 | 118 | "pnmtojpeg", _PNMSCALE_COMMAND); |
| 119 | 119 | |
| 120 | - $vignette = _ROOT_IMG_PACK . "test.jpg"; |
|
| 121 | - $dest = _DIR_VAR . "test-jpg.jpg"; |
|
| 122 | - $commande = "$jpegtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest"; |
|
| 120 | + $vignette = _ROOT_IMG_PACK."test.jpg"; |
|
| 121 | + $dest = _DIR_VAR."test-jpg.jpg"; |
|
| 122 | + $commande = "$jpegtopnm_command $vignette | "._PNMSCALE_COMMAND." -width 10 | $pnmtojpeg_command > $dest"; |
|
| 123 | 123 | spip_log($commande); |
| 124 | 124 | exec($commande); |
| 125 | 125 | if ($taille = @getimagesize($dest)) { |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | } |
| 130 | 130 | $giftopnm_command = str_replace("pnmscale", "giftopnm", _PNMSCALE_COMMAND); |
| 131 | 131 | $pnmtojpeg_command = str_replace("pnmscale", "pnmtojpeg", _PNMSCALE_COMMAND); |
| 132 | - $vignette = _ROOT_IMG_PACK . "test.gif"; |
|
| 133 | - $dest = _DIR_VAR . "test-gif.jpg"; |
|
| 134 | - $commande = "$giftopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest"; |
|
| 132 | + $vignette = _ROOT_IMG_PACK."test.gif"; |
|
| 133 | + $dest = _DIR_VAR."test-gif.jpg"; |
|
| 134 | + $commande = "$giftopnm_command $vignette | "._PNMSCALE_COMMAND." -width 10 | $pnmtojpeg_command > $dest"; |
|
| 135 | 135 | spip_log($commande); |
| 136 | 136 | exec($commande); |
| 137 | 137 | if ($taille = @getimagesize($dest)) { |
@@ -141,9 +141,9 @@ discard block |
||
| 141 | 141 | } |
| 142 | 142 | |
| 143 | 143 | $pngtopnm_command = str_replace("pnmscale", "pngtopnm", _PNMSCALE_COMMAND); |
| 144 | - $vignette = _ROOT_IMG_PACK . "test.png"; |
|
| 145 | - $dest = _DIR_VAR . "test-gif.jpg"; |
|
| 146 | - $commande = "$pngtopnm_command $vignette | " . _PNMSCALE_COMMAND . " -width 10 | $pnmtojpeg_command > $dest"; |
|
| 144 | + $vignette = _ROOT_IMG_PACK."test.png"; |
|
| 145 | + $dest = _DIR_VAR."test-gif.jpg"; |
|
| 146 | + $commande = "$pngtopnm_command $vignette | "._PNMSCALE_COMMAND." -width 10 | $pnmtojpeg_command > $dest"; |
|
| 147 | 147 | spip_log($commande); |
| 148 | 148 | exec($commande); |
| 149 | 149 | if ($taille = @getimagesize($dest)) { |
@@ -167,9 +167,9 @@ discard block |
||
| 167 | 167 | include_spip('inc/filtres'); |
| 168 | 168 | include_spip('inc/filtres_images_mini'); |
| 169 | 169 | $taille_preview = 150; |
| 170 | - $image = _image_valeurs_trans(_DIR_IMG_PACK . 'test_image.jpg', "reduire-$taille_preview-$taille_preview", 'jpg'); |
|
| 170 | + $image = _image_valeurs_trans(_DIR_IMG_PACK.'test_image.jpg', "reduire-$taille_preview-$taille_preview", 'jpg'); |
|
| 171 | 171 | |
| 172 | - $image['fichier_dest'] = _DIR_VAR . "test_$arg"; |
|
| 172 | + $image['fichier_dest'] = _DIR_VAR."test_$arg"; |
|
| 173 | 173 | |
| 174 | 174 | if ($preview = _image_creer_vignette($image, $taille_preview, $taille_preview, $arg, true) |
| 175 | 175 | and ($preview['width'] * $preview['height'] > 0) |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | define('_INC_DISTANT_CONTENT_ENCODING', 'gzip'); |
| 27 | 27 | } |
| 28 | 28 | if (!defined('_INC_DISTANT_USER_AGENT')) { |
| 29 | - define('_INC_DISTANT_USER_AGENT', 'SPIP-' . $GLOBALS['spip_version_affichee'] . ' (' . $GLOBALS['home_server'] . ')'); |
|
| 29 | + define('_INC_DISTANT_USER_AGENT', 'SPIP-'.$GLOBALS['spip_version_affichee'].' ('.$GLOBALS['home_server'].')'); |
|
| 30 | 30 | } |
| 31 | 31 | if (!defined('_INC_DISTANT_MAX_SIZE')) { |
| 32 | 32 | define('_INC_DISTANT_MAX_SIZE', 2097152); |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | define('_INC_DISTANT_CONNECT_TIMEOUT', 10); |
| 36 | 36 | } |
| 37 | 37 | |
| 38 | -define('_REGEXP_COPIE_LOCALE', ',' . |
|
| 38 | +define('_REGEXP_COPIE_LOCALE', ','. |
|
| 39 | 39 | preg_replace( |
| 40 | 40 | '@^https?:@', |
| 41 | 41 | 'https?:', |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | |
| 71 | 71 | // si c'est la protection de soi-meme, retourner le path |
| 72 | 72 | if ($mode !== 'force' and preg_match(_REGEXP_COPIE_LOCALE, $source, $match)) { |
| 73 | - $source = substr(_DIR_IMG, strlen(_DIR_RACINE)) . urldecode($match[1]); |
|
| 73 | + $source = substr(_DIR_IMG, strlen(_DIR_RACINE)).urldecode($match[1]); |
|
| 74 | 74 | |
| 75 | 75 | return @file_exists($source) ? $source : false; |
| 76 | 76 | } |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | return false; |
| 91 | 91 | } |
| 92 | 92 | |
| 93 | - $localrac = _DIR_RACINE . $local; |
|
| 93 | + $localrac = _DIR_RACINE.$local; |
|
| 94 | 94 | $t = ($mode == 'force') ? false : @file_exists($localrac); |
| 95 | 95 | |
| 96 | 96 | // test d'existence du fichier |
@@ -115,13 +115,13 @@ discard block |
||
| 115 | 115 | array('file' => $localrac, 'taille_max' => $taille_max, 'if_modified_since' => $t ? filemtime($localrac) : '') |
| 116 | 116 | ); |
| 117 | 117 | if (!$res or (!$res['length'] and $res['status'] != 304)) { |
| 118 | - spip_log("copie_locale : Echec recuperation $source sur $localrac status : " . $res['status'], 'distant' . _LOG_INFO_IMPORTANTE); |
|
| 118 | + spip_log("copie_locale : Echec recuperation $source sur $localrac status : ".$res['status'], 'distant'._LOG_INFO_IMPORTANTE); |
|
| 119 | 119 | } |
| 120 | 120 | if (!$res['length']) { |
| 121 | 121 | // si $t c'est sans doute juste un not-modified-since |
| 122 | 122 | return $t ? $local : false; |
| 123 | 123 | } |
| 124 | - spip_log("copie_locale : recuperation $source sur $localrac taille " . $res['length'] . ' OK', 'distant'); |
|
| 124 | + spip_log("copie_locale : recuperation $source sur $localrac taille ".$res['length'].' OK', 'distant'); |
|
| 125 | 125 | |
| 126 | 126 | // pour une eventuelle indexation |
| 127 | 127 | pipeline( |
@@ -153,7 +153,7 @@ discard block |
||
| 153 | 153 | * url ou false en cas d'echec |
| 154 | 154 | */ |
| 155 | 155 | function valider_url_distante($url, $known_hosts = array()) { |
| 156 | - if (!function_exists('protocole_verifier')){ |
|
| 156 | + if (!function_exists('protocole_verifier')) { |
|
| 157 | 157 | include_spip('inc/filtres_mini'); |
| 158 | 158 | } |
| 159 | 159 | |
@@ -162,7 +162,7 @@ discard block |
||
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | $parsed_url = parse_url($url); |
| 165 | - if (!$parsed_url or empty($parsed_url['host']) ) { |
|
| 165 | + if (!$parsed_url or empty($parsed_url['host'])) { |
|
| 166 | 166 | return false; |
| 167 | 167 | } |
| 168 | 168 | |
@@ -203,10 +203,10 @@ discard block |
||
| 203 | 203 | } |
| 204 | 204 | } |
| 205 | 205 | if ($ip) { |
| 206 | - $parts = array_map('intval', explode( '.', $ip )); |
|
| 206 | + $parts = array_map('intval', explode('.', $ip)); |
|
| 207 | 207 | if (127 === $parts[0] or 10 === $parts[0] or 0 === $parts[0] |
| 208 | - or ( 172 === $parts[0] and 16 <= $parts[1] and 31 >= $parts[1] ) |
|
| 209 | - or ( 192 === $parts[0] && 168 === $parts[1] ) |
|
| 208 | + or (172 === $parts[0] and 16 <= $parts[1] and 31 >= $parts[1]) |
|
| 209 | + or (192 === $parts[0] && 168 === $parts[1]) |
|
| 210 | 210 | ) { |
| 211 | 211 | return false; |
| 212 | 212 | } |
@@ -218,7 +218,7 @@ discard block |
||
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | $port = $parsed_url['port']; |
| 221 | - if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 221 | + if ($port === 80 or $port === 443 or $port === 8080) { |
|
| 222 | 222 | return $url; |
| 223 | 223 | } |
| 224 | 224 | |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | } |
| 286 | 286 | } |
| 287 | 287 | if ($taille > 500) { |
| 288 | - $boundary = substr(md5(rand() . 'spip'), 0, 8); |
|
| 288 | + $boundary = substr(md5(rand().'spip'), 0, 8); |
|
| 289 | 289 | } |
| 290 | 290 | } |
| 291 | 291 | |
@@ -313,16 +313,16 @@ discard block |
||
| 313 | 313 | } |
| 314 | 314 | } else { |
| 315 | 315 | // fabrique une chaine HTTP simple pour un POST |
| 316 | - $entete = 'Content-Type: application/x-www-form-urlencoded' . "\r\n"; |
|
| 316 | + $entete = 'Content-Type: application/x-www-form-urlencoded'."\r\n"; |
|
| 317 | 317 | $chaine = array(); |
| 318 | 318 | if (is_array($donnees)) { |
| 319 | 319 | foreach ($donnees as $cle => $valeur) { |
| 320 | 320 | if (is_array($valeur)) { |
| 321 | 321 | foreach ($valeur as $val2) { |
| 322 | - $chaine[] = rawurlencode($cle) . '[]=' . rawurlencode($val2); |
|
| 322 | + $chaine[] = rawurlencode($cle).'[]='.rawurlencode($val2); |
|
| 323 | 323 | } |
| 324 | 324 | } else { |
| 325 | - $chaine[] = rawurlencode($cle) . '=' . rawurlencode($valeur); |
|
| 325 | + $chaine[] = rawurlencode($cle).'='.rawurlencode($valeur); |
|
| 326 | 326 | } |
| 327 | 327 | } |
| 328 | 328 | $chaine = implode('&', $chaine); |
@@ -423,9 +423,9 @@ discard block |
||
| 423 | 423 | if (!empty($options['datas'])) { |
| 424 | 424 | list($head, $postdata) = prepare_donnees_post($options['datas'], $options['boundary']); |
| 425 | 425 | if (stripos($head, 'Content-Length:') === false) { |
| 426 | - $head .= 'Content-Length: ' . strlen($postdata); |
|
| 426 | + $head .= 'Content-Length: '.strlen($postdata); |
|
| 427 | 427 | } |
| 428 | - $options['datas'] = $head . "\r\n\r\n" . $postdata; |
|
| 428 | + $options['datas'] = $head."\r\n\r\n".$postdata; |
|
| 429 | 429 | if (strlen($postdata)) { |
| 430 | 430 | $options['methode'] = 'POST'; |
| 431 | 431 | } |
@@ -434,9 +434,9 @@ discard block |
||
| 434 | 434 | // Accepter les URLs au format feed:// ou qui ont oublie le http:// ou les urls relatives au protocole |
| 435 | 435 | $url = preg_replace(',^feed://,i', 'http://', $url); |
| 436 | 436 | if (!tester_url_absolue($url)) { |
| 437 | - $url = 'http://' . $url; |
|
| 437 | + $url = 'http://'.$url; |
|
| 438 | 438 | } elseif (strncmp($url, '//', 2) == 0) { |
| 439 | - $url = 'http:' . $url; |
|
| 439 | + $url = 'http:'.$url; |
|
| 440 | 440 | } |
| 441 | 441 | |
| 442 | 442 | $url = url_to_ascii($url); |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | $options['if_modified_since'] |
| 466 | 466 | ); |
| 467 | 467 | if (!$handle) { |
| 468 | - spip_log("ECHEC init_http $url", 'distant' . _LOG_ERREUR); |
|
| 468 | + spip_log("ECHEC init_http $url", 'distant'._LOG_ERREUR); |
|
| 469 | 469 | |
| 470 | 470 | return false; |
| 471 | 471 | } |
@@ -494,7 +494,7 @@ discard block |
||
| 494 | 494 | 'status' => 200, |
| 495 | 495 | ); |
| 496 | 496 | } else { |
| 497 | - spip_log("ECHEC chinoiserie $url", 'distant' . _LOG_ERREUR); |
|
| 497 | + spip_log("ECHEC chinoiserie $url", 'distant'._LOG_ERREUR); |
|
| 498 | 498 | return false; |
| 499 | 499 | } |
| 500 | 500 | } elseif ($res['location'] and $options['follow_location']) { |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | |
| 507 | 507 | return recuperer_url($url, $options); |
| 508 | 508 | } elseif ($res['status'] !== 200) { |
| 509 | - spip_log('HTTP status ' . $res['status'] . " pour $url", 'distant'); |
|
| 509 | + spip_log('HTTP status '.$res['status']." pour $url", 'distant'); |
|
| 510 | 510 | } |
| 511 | 511 | $result['status'] = $res['status']; |
| 512 | 512 | if (isset($res['headers'])) { |
@@ -531,7 +531,7 @@ discard block |
||
| 531 | 531 | |
| 532 | 532 | $gz = false; |
| 533 | 533 | if (preg_match(",\bContent-Encoding: .*gzip,is", $result['headers'])) { |
| 534 | - $gz = (_DIR_TMP . md5(uniqid(mt_rand())) . '.tmp.gz'); |
|
| 534 | + $gz = (_DIR_TMP.md5(uniqid(mt_rand())).'.tmp.gz'); |
|
| 535 | 535 | } |
| 536 | 536 | |
| 537 | 537 | // si on a pas deja recuperer le contenu par une methode detournee |
@@ -617,7 +617,7 @@ discard block |
||
| 617 | 617 | $sig['url'] = $url; |
| 618 | 618 | |
| 619 | 619 | $dir = sous_repertoire(_DIR_CACHE, 'curl'); |
| 620 | - $cache = md5(serialize($sig)) . '-' . substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 620 | + $cache = md5(serialize($sig)).'-'.substr(preg_replace(',\W+,', '_', $url), 0, 80); |
|
| 621 | 621 | $sub = sous_repertoire($dir, substr($cache, 0, 2)); |
| 622 | 622 | $cache = "$sub$cache"; |
| 623 | 623 | |
@@ -726,7 +726,7 @@ discard block |
||
| 726 | 726 | return false; |
| 727 | 727 | } |
| 728 | 728 | if ($get_headers) { |
| 729 | - return $res['headers'] . "\n" . $res['page']; |
|
| 729 | + return $res['headers']."\n".$res['page']; |
|
| 730 | 730 | } |
| 731 | 731 | |
| 732 | 732 | return $res['page']; |
@@ -830,7 +830,7 @@ discard block |
||
| 830 | 830 | $fp = false; |
| 831 | 831 | if ($fichier) { |
| 832 | 832 | include_spip('inc/acces'); |
| 833 | - $tmpfile = "$fichier." . creer_uniqid() . '.tmp'; |
|
| 833 | + $tmpfile = "$fichier.".creer_uniqid().'.tmp'; |
|
| 834 | 834 | $fp = spip_fopen_lock($tmpfile, 'w', LOCK_EX); |
| 835 | 835 | if (!$fp and file_exists($fichier)) { |
| 836 | 836 | return filesize($fichier); |
@@ -889,7 +889,7 @@ discard block |
||
| 889 | 889 | } |
| 890 | 890 | $result['status'] = intval($r[1]); |
| 891 | 891 | while ($s = trim(fgets($handle, 16384))) { |
| 892 | - $result['headers'][] = $s . "\n"; |
|
| 892 | + $result['headers'][] = $s."\n"; |
|
| 893 | 893 | preg_match(',^([^:]*): *(.*)$,i', $s, $r); |
| 894 | 894 | list(, $d, $v) = $r; |
| 895 | 895 | if (strtolower(trim($d)) == 'location' and $result['status'] >= 300 and $result['status'] < 400) { |
@@ -972,13 +972,13 @@ discard block |
||
| 972 | 972 | |
| 973 | 973 | // on se place tout le temps comme si on etait a la racine |
| 974 | 974 | if (_DIR_RACINE) { |
| 975 | - $d = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $d); |
|
| 975 | + $d = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $d); |
|
| 976 | 976 | } |
| 977 | 977 | |
| 978 | 978 | $m = md5($source); |
| 979 | 979 | |
| 980 | 980 | return $d |
| 981 | - . substr(preg_replace(',[^\w-],', '', basename($source)) . '-' . $m, 0, 12) |
|
| 981 | + . substr(preg_replace(',[^\w-],', '', basename($source)).'-'.$m, 0, 12) |
|
| 982 | 982 | . substr($m, 0, 4) |
| 983 | 983 | . ".$extension"; |
| 984 | 984 | } |
@@ -1001,7 +1001,7 @@ discard block |
||
| 1001 | 1001 | // Si c'est deja local pas de souci |
| 1002 | 1002 | if (!tester_url_absolue($source)) { |
| 1003 | 1003 | if (_DIR_RACINE) { |
| 1004 | - $source = preg_replace(',^' . preg_quote(_DIR_RACINE) . ',', '', $source); |
|
| 1004 | + $source = preg_replace(',^'.preg_quote(_DIR_RACINE).',', '', $source); |
|
| 1005 | 1005 | } |
| 1006 | 1006 | |
| 1007 | 1007 | return $source; |
@@ -1018,7 +1018,7 @@ discard block |
||
| 1018 | 1018 | if ($ext |
| 1019 | 1019 | and preg_match(',^\w+$,', $ext) // pas de php?truc=1&... |
| 1020 | 1020 | and $f = nom_fichier_copie_locale($source, $ext) |
| 1021 | - and file_exists(_DIR_RACINE . $f) |
|
| 1021 | + and file_exists(_DIR_RACINE.$f) |
|
| 1022 | 1022 | ) { |
| 1023 | 1023 | return $f; |
| 1024 | 1024 | } |
@@ -1026,7 +1026,7 @@ discard block |
||
| 1026 | 1026 | |
| 1027 | 1027 | // Si c'est deja dans la table des documents, |
| 1028 | 1028 | // ramener le nom de sa copie potentielle |
| 1029 | - $ext = sql_getfetsel('extension', 'spip_documents', 'fichier=' . sql_quote($source) . " AND distant='oui' AND extension <> ''"); |
|
| 1029 | + $ext = sql_getfetsel('extension', 'spip_documents', 'fichier='.sql_quote($source)." AND distant='oui' AND extension <> ''"); |
|
| 1030 | 1030 | |
| 1031 | 1031 | if ($ext) { |
| 1032 | 1032 | return nom_fichier_copie_locale($source, $ext); |
@@ -1037,9 +1037,9 @@ discard block |
||
| 1037 | 1037 | |
| 1038 | 1038 | $ext = $path_parts ? $path_parts['extension'] : ''; |
| 1039 | 1039 | |
| 1040 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 1040 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 1041 | 1041 | $f = nom_fichier_copie_locale($source, $ext); |
| 1042 | - if (file_exists(_DIR_RACINE . $f)) { |
|
| 1042 | + if (file_exists(_DIR_RACINE.$f)) { |
|
| 1043 | 1043 | return $f; |
| 1044 | 1044 | } |
| 1045 | 1045 | } |
@@ -1047,7 +1047,7 @@ discard block |
||
| 1047 | 1047 | // Ping pour voir si son extension est connue et autorisee |
| 1048 | 1048 | // avec mise en cache du resultat du ping |
| 1049 | 1049 | |
| 1050 | - $cache = sous_repertoire(_DIR_CACHE, 'rid') . md5($source); |
|
| 1050 | + $cache = sous_repertoire(_DIR_CACHE, 'rid').md5($source); |
|
| 1051 | 1051 | if (!@file_exists($cache) |
| 1052 | 1052 | or !$path_parts = @unserialize(spip_file_get_contents($cache)) |
| 1053 | 1053 | or _request('var_mode') == 'recalcul' |
@@ -1056,10 +1056,10 @@ discard block |
||
| 1056 | 1056 | ecrire_fichier($cache, serialize($path_parts)); |
| 1057 | 1057 | } |
| 1058 | 1058 | $ext = !empty($path_parts['extension']) ? $path_parts['extension'] : ''; |
| 1059 | - if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($ext))) { |
|
| 1059 | + if ($ext and sql_getfetsel('extension', 'spip_types_documents', 'extension='.sql_quote($ext))) { |
|
| 1060 | 1060 | return nom_fichier_copie_locale($source, $ext); |
| 1061 | 1061 | } |
| 1062 | - spip_log("pas de copie locale pour $source", 'distant' . _LOG_ERREUR); |
|
| 1062 | + spip_log("pas de copie locale pour $source", 'distant'._LOG_ERREUR); |
|
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | 1065 | |
@@ -1124,19 +1124,19 @@ discard block |
||
| 1124 | 1124 | if (!$t |
| 1125 | 1125 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1126 | 1126 | ) { |
| 1127 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1127 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1128 | 1128 | } |
| 1129 | 1129 | if (!$t |
| 1130 | 1130 | and preg_match(',^Content-Disposition:\s*attachment;\s*filename=(.*)$,Uims', $headers, $m) |
| 1131 | 1131 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $m[1], $rext) |
| 1132 | 1132 | ) { |
| 1133 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1133 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1134 | 1134 | } |
| 1135 | 1135 | } |
| 1136 | 1136 | |
| 1137 | 1137 | // Autre mime/type (ou text/plain avec fichier d'extension inconnue) |
| 1138 | 1138 | if (!$t) { |
| 1139 | - $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type=' . sql_quote($mime_type)); |
|
| 1139 | + $t = sql_fetsel('extension', 'spip_types_documents', 'mime_type='.sql_quote($mime_type)); |
|
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | // Toujours rien ? (ex: audio/x-ogg au lieu de application/ogg) |
@@ -1146,11 +1146,11 @@ discard block |
||
| 1146 | 1146 | and preg_match(',\.([a-z0-9]+)(\?.*)?$,i', $source, $rext) |
| 1147 | 1147 | ) { |
| 1148 | 1148 | # eviter xxx.3 => 3gp (> SPIP 3) |
| 1149 | - $t = sql_fetsel('extension', 'spip_types_documents', 'extension=' . sql_quote($rext[1], '', 'text')); |
|
| 1149 | + $t = sql_fetsel('extension', 'spip_types_documents', 'extension='.sql_quote($rext[1], '', 'text')); |
|
| 1150 | 1150 | } |
| 1151 | 1151 | |
| 1152 | 1152 | if ($t) { |
| 1153 | - spip_log("mime-type $mime_type ok, extension " . $t['extension'], 'distant'); |
|
| 1153 | + spip_log("mime-type $mime_type ok, extension ".$t['extension'], 'distant'); |
|
| 1154 | 1154 | $a['extension'] = $t['extension']; |
| 1155 | 1155 | } else { |
| 1156 | 1156 | # par defaut on retombe sur '.bin' si c'est autorise |
@@ -1192,7 +1192,7 @@ discard block |
||
| 1192 | 1192 | } else { |
| 1193 | 1193 | if ($a['body']) { |
| 1194 | 1194 | $a['extension'] = $extension; |
| 1195 | - $a['fichier'] = _DIR_RACINE . nom_fichier_copie_locale($source, $extension); |
|
| 1195 | + $a['fichier'] = _DIR_RACINE.nom_fichier_copie_locale($source, $extension); |
|
| 1196 | 1196 | ecrire_fichier($a['fichier'], $a['body']); |
| 1197 | 1197 | $size_image = @spip_getimagesize($a['fichier']); |
| 1198 | 1198 | $a['largeur'] = intval($size_image[0]); |
@@ -1317,7 +1317,7 @@ discard block |
||
| 1317 | 1317 | } |
| 1318 | 1318 | } else { |
| 1319 | 1319 | $scheme = $t['scheme']; |
| 1320 | - $noproxy = $scheme . '://'; |
|
| 1320 | + $noproxy = $scheme.'://'; |
|
| 1321 | 1321 | } |
| 1322 | 1322 | if (isset($t['user'])) { |
| 1323 | 1323 | $user = array($t['user'], $t['pass']); |
@@ -1331,7 +1331,7 @@ discard block |
||
| 1331 | 1331 | } |
| 1332 | 1332 | |
| 1333 | 1333 | if (!empty($t['query'])) { |
| 1334 | - $path .= '?' . $t['query']; |
|
| 1334 | + $path .= '?'.$t['query']; |
|
| 1335 | 1335 | } |
| 1336 | 1336 | |
| 1337 | 1337 | $f = lance_requete($method, $scheme, $user, $host, $path, $port, $noproxy, $refuse_gz, $referer, $datas, $vers, $date); |
@@ -1404,20 +1404,20 @@ discard block |
||
| 1404 | 1404 | $proxy_user = ''; |
| 1405 | 1405 | $http_proxy = need_proxy($host); |
| 1406 | 1406 | if ($user) { |
| 1407 | - $user = urlencode($user[0]) . ':' . urlencode($user[1]); |
|
| 1407 | + $user = urlencode($user[0]).':'.urlencode($user[1]); |
|
| 1408 | 1408 | } |
| 1409 | 1409 | |
| 1410 | 1410 | $connect = ''; |
| 1411 | 1411 | if ($http_proxy) { |
| 1412 | - if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme , array('tls','ssl'))) { |
|
| 1413 | - $path_host = (!$user ? '' : "$user@") . $host . (($port != 80) ? ":$port" : ''); |
|
| 1414 | - $connect = 'CONNECT ' . $path_host . " $vers\r\n" |
|
| 1412 | + if (!defined('_PROXY_HTTPS_NOT_VIA_CONNECT') and in_array($scheme, array('tls', 'ssl'))) { |
|
| 1413 | + $path_host = (!$user ? '' : "$user@").$host.(($port != 80) ? ":$port" : ''); |
|
| 1414 | + $connect = 'CONNECT '.$path_host." $vers\r\n" |
|
| 1415 | 1415 | . "Host: $path_host\r\n" |
| 1416 | 1416 | . "Proxy-Connection: Keep-Alive\r\n"; |
| 1417 | 1417 | } else { |
| 1418 | - $path = (in_array($scheme , array('tls','ssl')) ? 'https://' : "$scheme://") |
|
| 1418 | + $path = (in_array($scheme, array('tls', 'ssl')) ? 'https://' : "$scheme://") |
|
| 1419 | 1419 | . (!$user ? '' : "$user@") |
| 1420 | - . "$host" . (($port != 80) ? ":$port" : '') . $path; |
|
| 1420 | + . "$host".(($port != 80) ? ":$port" : '').$path; |
|
| 1421 | 1421 | } |
| 1422 | 1422 | $t2 = @parse_url($http_proxy); |
| 1423 | 1423 | $first_host = $t2['host']; |
@@ -1425,10 +1425,10 @@ discard block |
||
| 1425 | 1425 | $port = 80; |
| 1426 | 1426 | } |
| 1427 | 1427 | if ($t2['user']) { |
| 1428 | - $proxy_user = base64_encode($t2['user'] . ':' . $t2['pass']); |
|
| 1428 | + $proxy_user = base64_encode($t2['user'].':'.$t2['pass']); |
|
| 1429 | 1429 | } |
| 1430 | 1430 | } else { |
| 1431 | - $first_host = $noproxy . $host; |
|
| 1431 | + $first_host = $noproxy.$host; |
|
| 1432 | 1432 | } |
| 1433 | 1433 | |
| 1434 | 1434 | if ($connect) { |
@@ -1453,7 +1453,7 @@ discard block |
||
| 1453 | 1453 | ); |
| 1454 | 1454 | spip_log("Recuperer $path sur $first_host:$port par $f (via CONNECT)", 'connect'); |
| 1455 | 1455 | if (!$f) { |
| 1456 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1456 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1457 | 1457 | return $errno; |
| 1458 | 1458 | } |
| 1459 | 1459 | stream_set_timeout($f, _INC_DISTANT_CONNECT_TIMEOUT); |
@@ -1465,7 +1465,7 @@ discard block |
||
| 1465 | 1465 | or !count($res = explode(' ', $res)) |
| 1466 | 1466 | or $res[1] !== '200' |
| 1467 | 1467 | ) { |
| 1468 | - spip_log("Echec CONNECT sur $first_host:$port", 'connect' . _LOG_INFO_IMPORTANTE); |
|
| 1468 | + spip_log("Echec CONNECT sur $first_host:$port", 'connect'._LOG_INFO_IMPORTANTE); |
|
| 1469 | 1469 | fclose($f); |
| 1470 | 1470 | |
| 1471 | 1471 | return false; |
@@ -1482,7 +1482,7 @@ discard block |
||
| 1482 | 1482 | } while (!$f and $ntry-- and $errno !== 110 and sleep(1)); |
| 1483 | 1483 | spip_log("Recuperer $path sur $first_host:$port par $f"); |
| 1484 | 1484 | if (!$f) { |
| 1485 | - spip_log("Erreur connexion $errno $errstr", 'distant' . _LOG_ERREUR); |
|
| 1485 | + spip_log("Erreur connexion $errno $errstr", 'distant'._LOG_ERREUR); |
|
| 1486 | 1486 | |
| 1487 | 1487 | return $errno; |
| 1488 | 1488 | } |
@@ -1492,16 +1492,16 @@ discard block |
||
| 1492 | 1492 | $site = isset($GLOBALS['meta']['adresse_site']) ? $GLOBALS['meta']['adresse_site'] : ''; |
| 1493 | 1493 | |
| 1494 | 1494 | $host_port = $host; |
| 1495 | - if ($port != (in_array($scheme , array('tls','ssl')) ? 443 : 80)) { |
|
| 1495 | + if ($port != (in_array($scheme, array('tls', 'ssl')) ? 443 : 80)) { |
|
| 1496 | 1496 | $host_port .= ":$port"; |
| 1497 | 1497 | } |
| 1498 | 1498 | $req = "$method $path $vers\r\n" |
| 1499 | 1499 | . "Host: $host_port\r\n" |
| 1500 | - . 'User-Agent: ' . _INC_DISTANT_USER_AGENT . "\r\n" |
|
| 1501 | - . ($refuse_gz ? '' : ('Accept-Encoding: ' . _INC_DISTANT_CONTENT_ENCODING . "\r\n")) |
|
| 1500 | + . 'User-Agent: '._INC_DISTANT_USER_AGENT."\r\n" |
|
| 1501 | + . ($refuse_gz ? '' : ('Accept-Encoding: '._INC_DISTANT_CONTENT_ENCODING."\r\n")) |
|
| 1502 | 1502 | . (!$site ? '' : "Referer: $site/$referer\r\n") |
| 1503 | - . (!$date ? '' : 'If-Modified-Since: ' . (gmdate('D, d M Y H:i:s', $date) . " GMT\r\n")) |
|
| 1504 | - . (!$user ? '' : ('Authorization: Basic ' . base64_encode($user) . "\r\n")) |
|
| 1503 | + . (!$date ? '' : 'If-Modified-Since: '.(gmdate('D, d M Y H:i:s', $date)." GMT\r\n")) |
|
| 1504 | + . (!$user ? '' : ('Authorization: Basic '.base64_encode($user)."\r\n")) |
|
| 1505 | 1505 | . (!$proxy_user ? '' : "Proxy-Authorization: Basic $proxy_user\r\n") |
| 1506 | 1506 | . (!strpos($vers, '1.1') ? '' : "Keep-Alive: 300\r\nConnection: keep-alive\r\n"); |
| 1507 | 1507 | |