@@ -40,7 +40,7 @@ discard block |
||
| 40 | 40 | $mode = preg_replace(",\W,", '', $mode); |
| 41 | 41 | if ($mode) { |
| 42 | 42 | // chercher dans la base |
| 43 | - $mode_document = 'logo' . $mode; |
|
| 43 | + $mode_document = 'logo'.$mode; |
|
| 44 | 44 | $objet = objet_type($_id_objet); |
| 45 | 45 | $doc = sql_fetsel('D.*', 'spip_documents AS D JOIN spip_documents_liens AS L ON L.id_document=D.id_document', "D.mode=".sql_quote($mode_document)." AND L.objet=".sql_quote($objet)." AND id_objet=".intval($id)); |
| 46 | 46 | if ($doc) { |
@@ -52,10 +52,10 @@ discard block |
||
| 52 | 52 | if ($compat_old_logos) { |
| 53 | 53 | # attention au cas $id = '0' pour LOGO_SITE_SPIP : utiliser intval() |
| 54 | 54 | $type = type_du_logo($_id_objet); |
| 55 | - $nom = $type . $mode . intval($id); |
|
| 55 | + $nom = $type.$mode.intval($id); |
|
| 56 | 56 | |
| 57 | 57 | foreach ($GLOBALS['formats_logos'] as $format) { |
| 58 | - if (@file_exists($d = (_DIR_LOGOS . $nom . '.' . $format))) { |
|
| 58 | + if (@file_exists($d = (_DIR_LOGOS.$nom.'.'.$format))) { |
|
| 59 | 59 | return array($d, _DIR_LOGOS, $nom, $format, @filemtime($d)); |
| 60 | 60 | } |
| 61 | 61 | } |
@@ -70,10 +70,10 @@ discard block |
||
| 70 | 70 | function maj_11388() { |
| 71 | 71 | $s = sql_select('referer_md5', 'spip_referers_articles', "referer='' OR referer IS NULL"); |
| 72 | 72 | while ($t = sql_fetch($s)) { |
| 73 | - $k = sql_fetsel('referer', 'spip_referers', 'referer_md5=' . sql_quote($t['referer_md5'])); |
|
| 73 | + $k = sql_fetsel('referer', 'spip_referers', 'referer_md5='.sql_quote($t['referer_md5'])); |
|
| 74 | 74 | if ($k['referer']) { |
| 75 | 75 | sql_query('UPDATE spip_referers_articles |
| 76 | - SET referer=' . sql_quote($k['referer']) . ' |
|
| 76 | + SET referer=' . sql_quote($k['referer']).' |
|
| 77 | 77 | WHERE referer_md5=' . sql_quote($t['referer_md5']) |
| 78 | 78 | . " AND (referer='' OR referer IS NULL)" |
| 79 | 79 | ); |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | // mise a jour de ces mots la |
| 99 | 99 | if ($res) { |
| 100 | 100 | while ($r = sql_fetch($res)) { |
| 101 | - sql_updateq('spip_mots', array('type' => $r['type']), 'id_mot=' . sql_quote($r['id_mot'])); |
|
| 101 | + sql_updateq('spip_mots', array('type' => $r['type']), 'id_mot='.sql_quote($r['id_mot'])); |
|
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | } |
@@ -173,8 +173,8 @@ discard block |
||
| 173 | 173 | |
| 174 | 174 | // Recopier les donnees |
| 175 | 175 | foreach (array('article', 'breve', 'rubrique', 'auteur', 'forum') as $l) { |
| 176 | - if ($s = sql_select('*', 'spip_documents_' . $l . 's') |
|
| 177 | - or $s = sql_select('*', 'spip_documents_' . $l) |
|
| 176 | + if ($s = sql_select('*', 'spip_documents_'.$l.'s') |
|
| 177 | + or $s = sql_select('*', 'spip_documents_'.$l) |
|
| 178 | 178 | ) { |
| 179 | 179 | $tampon = array(); |
| 180 | 180 | while ($t = sql_fetch($s)) { |
@@ -378,9 +378,9 @@ discard block |
||
| 378 | 378 | $exceptions_pluriel = array('forum' => 'forum', 'syndic' => 'syndic'); |
| 379 | 379 | |
| 380 | 380 | $pivot = preg_replace(',[^\w],', '', $pivot); // securite |
| 381 | - $pivots = (isset($exceptions_pluriel[$pivot]) ? $exceptions_pluriel[$pivot] : $pivot . "s"); |
|
| 382 | - $liens = "spip_" . $pivots . "_liens"; |
|
| 383 | - $id_pivot = "id_" . $pivot; |
|
| 381 | + $pivots = (isset($exceptions_pluriel[$pivot]) ? $exceptions_pluriel[$pivot] : $pivot."s"); |
|
| 382 | + $liens = "spip_".$pivots."_liens"; |
|
| 383 | + $id_pivot = "id_".$pivot; |
|
| 384 | 384 | // Creer spip_auteurs_liens |
| 385 | 385 | global $tables_auxiliaires; |
| 386 | 386 | if (!$l) { |
@@ -392,8 +392,8 @@ discard block |
||
| 392 | 392 | $l = preg_replace(',[^\w],', '', $l); // securite |
| 393 | 393 | $primary = "id_$l"; |
| 394 | 394 | $objet = ($l == 'syndic' ? 'site' : $l); |
| 395 | - $ls = (isset($exceptions_pluriel[$l]) ? $exceptions_pluriel[$l] : $l . "s"); |
|
| 396 | - $ancienne_table = 'spip_' . $pivots . '_' . $ls; |
|
| 395 | + $ls = (isset($exceptions_pluriel[$l]) ? $exceptions_pluriel[$l] : $l."s"); |
|
| 396 | + $ancienne_table = 'spip_'.$pivots.'_'.$ls; |
|
| 397 | 397 | $pool = 400; |
| 398 | 398 | |
| 399 | 399 | $trouver_table = charger_fonction('trouver_table', 'base'); |
@@ -429,12 +429,12 @@ discard block |
||
| 429 | 429 | while ($ids = array_map('reset', sql_allfetsel("$primary", $ancienne_table, '', '', '', "0,$sub_pool"))) { |
| 430 | 430 | $insert = array(); |
| 431 | 431 | foreach ($ids as $id) { |
| 432 | - $n = sql_countsel($liens, "objet='$objet' AND id_objet=" . intval($id)); |
|
| 433 | - while ($t = sql_allfetsel($champs, $ancienne_table, "$primary=" . intval($id), '', $id_pivot, "$n,$pool")) { |
|
| 432 | + $n = sql_countsel($liens, "objet='$objet' AND id_objet=".intval($id)); |
|
| 433 | + while ($t = sql_allfetsel($champs, $ancienne_table, "$primary=".intval($id), '', $id_pivot, "$n,$pool")) { |
|
| 434 | 434 | $n += count($t); |
| 435 | 435 | // empiler en s'assurant a minima de l'unicite |
| 436 | 436 | while ($r = array_shift($t)) { |
| 437 | - $insert[$r[$id_pivot] . ':' . $r['id_objet']] = $r; |
|
| 437 | + $insert[$r[$id_pivot].':'.$r['id_objet']] = $r; |
|
| 438 | 438 | } |
| 439 | 439 | if (count($insert) >= $sub_pool) { |
| 440 | 440 | maj_liens_insertq_multi_check($liens, $insert, $tables_auxiliaires[$liens]); |
@@ -581,13 +581,13 @@ discard block |
||
| 581 | 581 | |
| 582 | 582 | // cas particulier spip_auteurs : retablir le collate binary sur le login |
| 583 | 583 | $desc = $trouver_table("spip_auteurs"); |
| 584 | - spip_log("spip_auteurs : " . var_export($desc['field'], true), "maj." . _LOG_INFO_IMPORTANTE); |
|
| 584 | + spip_log("spip_auteurs : ".var_export($desc['field'], true), "maj."._LOG_INFO_IMPORTANTE); |
|
| 585 | 585 | if (stripos($desc['field']['login'], "BINARY") === false) { |
| 586 | 586 | spip_log("Retablir champ login BINARY sur table spip_auteurs", "maj"); |
| 587 | 587 | sql_alter("table spip_auteurs change login login VARCHAR(255) BINARY"); |
| 588 | 588 | $trouver_table(''); |
| 589 | 589 | $new_desc = $trouver_table("spip_auteurs"); |
| 590 | - spip_log("Apres conversion spip_auteurs : " . var_export($new_desc['field'], true), "maj." . _LOG_INFO_IMPORTANTE); |
|
| 590 | + spip_log("Apres conversion spip_auteurs : ".var_export($new_desc['field'], true), "maj."._LOG_INFO_IMPORTANTE); |
|
| 591 | 591 | } |
| 592 | 592 | |
| 593 | 593 | foreach ($tables as $table) { |
@@ -606,24 +606,24 @@ discard block |
||
| 606 | 606 | $data = sql_allfetsel("*", "spip_urls", '', '', 'date DESC'); |
| 607 | 607 | $urls = array(); |
| 608 | 608 | foreach ($data as $d) { |
| 609 | - $key = $d['id_parent'] . "::" . strtolower($d['url']); |
|
| 609 | + $key = $d['id_parent']."::".strtolower($d['url']); |
|
| 610 | 610 | if (!isset($urls[$key])) { |
| 611 | 611 | $urls[$key] = true; |
| 612 | 612 | } else { |
| 613 | - spip_log("Suppression doublon dans spip_urls avant conversion : " . serialize($d), |
|
| 614 | - "maj." . _LOG_INFO_IMPORTANTE); |
|
| 615 | - sql_delete("spip_urls", "id_parent=" . sql_quote($d['id_parent']) . " AND url=" . sql_quote($d['url'])); |
|
| 613 | + spip_log("Suppression doublon dans spip_urls avant conversion : ".serialize($d), |
|
| 614 | + "maj."._LOG_INFO_IMPORTANTE); |
|
| 615 | + sql_delete("spip_urls", "id_parent=".sql_quote($d['id_parent'])." AND url=".sql_quote($d['url'])); |
|
| 616 | 616 | } |
| 617 | 617 | } |
| 618 | 618 | } |
| 619 | 619 | foreach ($desc['field'] as $field => $type) { |
| 620 | 620 | if ($desc['field'][$field] !== $desc_collate[$field]) { |
| 621 | - spip_log("Conversion COLLATE table $table", "maj." . _LOG_INFO_IMPORTANTE); |
|
| 622 | - sql_alter("table $table change $field $field " . $desc_collate[$field]); |
|
| 621 | + spip_log("Conversion COLLATE table $table", "maj."._LOG_INFO_IMPORTANTE); |
|
| 622 | + sql_alter("table $table change $field $field ".$desc_collate[$field]); |
|
| 623 | 623 | $trouver_table(''); |
| 624 | 624 | $new_desc = $trouver_table($table); |
| 625 | - spip_log("Apres conversion $table : " . var_export($new_desc['field'], true), |
|
| 626 | - "maj." . _LOG_INFO_IMPORTANTE); |
|
| 625 | + spip_log("Apres conversion $table : ".var_export($new_desc['field'], true), |
|
| 626 | + "maj."._LOG_INFO_IMPORTANTE); |
|
| 627 | 627 | continue 2; // inutile de continuer pour cette table : un seul alter remet tout a jour en sqlite |
| 628 | 628 | } |
| 629 | 629 | } |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | |
| 640 | 640 | $GLOBALS['maj'][19236] = array( |
| 641 | 641 | array('sql_updateq', 'spip_meta', array('impt' => 'oui'), "nom='version_installee'"), // version base principale |
| 642 | - array('sql_updateq', 'spip_meta', array('impt' => 'oui'), "nom LIKE '%_base_version'"), // version base plugins |
|
| 642 | + array('sql_updateq', 'spip_meta', array('impt' => 'oui'), "nom LIKE '%_base_version'"), // version base plugins |
|
| 643 | 643 | array('maj_collation_sqlite'), |
| 644 | 644 | ); |
| 645 | 645 | |
@@ -656,7 +656,7 @@ discard block |
||
| 656 | 656 | spip_log("supprimer sessions auteur"); |
| 657 | 657 | if ($dir = opendir(_DIR_SESSIONS)) { |
| 658 | 658 | while (($f = readdir($dir)) !== false) { |
| 659 | - spip_unlink(_DIR_SESSIONS . $f); |
|
| 659 | + spip_unlink(_DIR_SESSIONS.$f); |
|
| 660 | 660 | if (time() >= _TIME_OUT) { |
| 661 | 661 | return; |
| 662 | 662 | } |
@@ -675,17 +675,17 @@ discard block |
||
| 675 | 675 | */ |
| 676 | 676 | function ranger_cache_gd2() { |
| 677 | 677 | spip_log("ranger_cache_gd2"); |
| 678 | - $base = _DIR_VAR . "cache-gd2/"; |
|
| 678 | + $base = _DIR_VAR."cache-gd2/"; |
|
| 679 | 679 | if (is_dir($base) and is_readable($base)) { |
| 680 | 680 | if ($dir = opendir($base)) { |
| 681 | 681 | while (($f = readdir($dir)) !== false) { |
| 682 | - if (!is_dir($base . $f) and strncmp($f, ".", 1) !== 0 |
|
| 682 | + if (!is_dir($base.$f) and strncmp($f, ".", 1) !== 0 |
|
| 683 | 683 | and preg_match(",[0-9a-f]{32}\.\w+,", $f) |
| 684 | 684 | ) { |
| 685 | 685 | $sub = substr($f, 0, 2); |
| 686 | 686 | $sub = sous_repertoire($base, $sub); |
| 687 | - @rename($base . $f, $sub . substr($f, 2)); |
|
| 688 | - @unlink($base . $f); // au cas ou le rename a foire (collision) |
|
| 687 | + @rename($base.$f, $sub.substr($f, 2)); |
|
| 688 | + @unlink($base.$f); // au cas ou le rename a foire (collision) |
|
| 689 | 689 | } |
| 690 | 690 | if (time() >= _TIME_OUT) { |
| 691 | 691 | return; |
@@ -712,6 +712,6 @@ discard block |
||
| 712 | 712 | // upgrade des logos |
| 713 | 713 | $GLOBALS['maj'][24351] = []; |
| 714 | 714 | $tables_objets_sql = lister_tables_objets_sql(); |
| 715 | -foreach(array_keys($tables_objets_sql) as $table) { |
|
| 715 | +foreach (array_keys($tables_objets_sql) as $table) { |
|
| 716 | 716 | $GLOBALS['maj'][24351][] = ['upgrade_logo_objet', objet_type($table)]; |
| 717 | 717 | }; |
| 718 | 718 | \ No newline at end of file |
@@ -81,14 +81,14 @@ discard block |
||
| 81 | 81 | include_spip('inc/chercher_logo'); |
| 82 | 82 | |
| 83 | 83 | $mode = preg_replace(",\W,", '', $etat); |
| 84 | - if (!$mode){ |
|
| 84 | + if (!$mode) { |
|
| 85 | 85 | spip_log("logo_modifier : etat $etat invalide", 'logo'); |
| 86 | 86 | $erreur = 'etat invalide'; |
| 87 | 87 | |
| 88 | 88 | return $erreur; |
| 89 | 89 | } |
| 90 | 90 | // chercher dans la base |
| 91 | - $mode_document = 'logo' . $mode; |
|
| 91 | + $mode_document = 'logo'.$mode; |
|
| 92 | 92 | |
| 93 | 93 | include_spip('inc/documents'); |
| 94 | 94 | $erreur = ''; |
@@ -105,7 +105,7 @@ discard block |
||
| 105 | 105 | $tmp_name = false; |
| 106 | 106 | if (file_exists($source)) { |
| 107 | 107 | $tmp_name = $source; |
| 108 | - } elseif (file_exists($f = determine_upload() . $source)) { |
|
| 108 | + } elseif (file_exists($f = determine_upload().$source)) { |
|
| 109 | 109 | $tmp_name = $f; |
| 110 | 110 | } |
| 111 | 111 | if (!$tmp_name) { |
@@ -160,27 +160,27 @@ discard block |
||
| 160 | 160 | $type = type_du_logo($_id_objet); |
| 161 | 161 | |
| 162 | 162 | foreach (['on', 'off'] as $mode) { |
| 163 | - $nom_base = $type . $mode; |
|
| 163 | + $nom_base = $type.$mode; |
|
| 164 | 164 | $dir = (defined('_DIR_LOGOS') ? _DIR_LOGOS : _DIR_IMG); |
| 165 | 165 | |
| 166 | 166 | $deja = array(); |
| 167 | - $files = glob($dir . $nom_base . "*"); |
|
| 167 | + $files = glob($dir.$nom_base."*"); |
|
| 168 | 168 | |
| 169 | 169 | foreach ($files as $file) { |
| 170 | - $logo = substr($file, strlen($dir . $nom_base)); |
|
| 170 | + $logo = substr($file, strlen($dir.$nom_base)); |
|
| 171 | 171 | $logo = explode('.', $logo); |
| 172 | 172 | if (is_numeric($logo[0]) |
| 173 | 173 | and $id_objet = intval($logo[0])) { |
| 174 | 174 | if (!isset($deja[$id_objet])) { |
| 175 | 175 | $logo = $chercher_logo($id_objet, $_id_objet, $mode); |
| 176 | 176 | // if no logo in base |
| 177 | - if (!$logo or count($logo)<6) { |
|
| 177 | + if (!$logo or count($logo) < 6) { |
|
| 178 | 178 | foreach ($formats_logos as $format) { |
| 179 | - if (@file_exists($d = ($dir . ($nom = $nom_base . intval($id_objet) . '.' . $format)))) { |
|
| 179 | + if (@file_exists($d = ($dir.($nom = $nom_base.intval($id_objet).'.'.$format)))) { |
|
| 180 | 180 | // logo_modifier commence par supprimer le logo existant, donc on le deplace pour pas le perdre |
| 181 | - @rename($d, $dir_logos . $nom); |
|
| 181 | + @rename($d, $dir_logos.$nom); |
|
| 182 | 182 | // et on le declare comme nouveau logo |
| 183 | - logo_modifier($objet, $id_objet, $mode, $dir_logos . $nom); |
|
| 183 | + logo_modifier($objet, $id_objet, $mode, $dir_logos.$nom); |
|
| 184 | 184 | break; |
| 185 | 185 | } |
| 186 | 186 | } |
@@ -190,7 +190,7 @@ discard block |
||
| 190 | 190 | } |
| 191 | 191 | // si le fichier est encore la on le move : rien a faire ici |
| 192 | 192 | if (file_exists($file)) { |
| 193 | - @rename($file, $dir_logos_erreurs . basename($file)); |
|
| 193 | + @rename($file, $dir_logos_erreurs.basename($file)); |
|
| 194 | 194 | } |
| 195 | 195 | |
| 196 | 196 | if ($time_limit and time() > $time_limit) { |