@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | return $fichier; |
| 56 | 56 | } |
| 57 | 57 | if (!file_exists($fichier)) { |
| 58 | - $fichier = supprimer_timestamp($fichier); |
|
| 58 | + $fichier = supprimer_timestamp($fichier); |
|
| 59 | 59 | if (!file_exists($fichier)) { |
| 60 | 60 | return false; |
| 61 | 61 | } |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | function svg_change_balise_svg($svg, $old_balise_svg, $attributs) { |
| 146 | 146 | $new_balise_svg = '<svg'; |
| 147 | 147 | foreach ($attributs as $k => $v) { |
| 148 | - $new_balise_svg .= " $k=\"" . entites_html($v) . '"'; |
|
| 148 | + $new_balise_svg .= " $k=\"".entites_html($v).'"'; |
|
| 149 | 149 | } |
| 150 | 150 | $new_balise_svg .= '>'; |
| 151 | 151 | |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | function svg_insert_shapes($svg, $shapes, $start = true) { |
| 164 | 164 | |
| 165 | 165 | if ($start === false || $start === 'end') { |
| 166 | - $svg = str_replace('</svg>', $shapes . '</svg>', $svg); |
|
| 166 | + $svg = str_replace('</svg>', $shapes.'</svg>', $svg); |
|
| 167 | 167 | } |
| 168 | 168 | else { |
| 169 | 169 | $p = stripos($svg, '<svg'); |
@@ -184,10 +184,10 @@ discard block |
||
| 184 | 184 | */ |
| 185 | 185 | function svg_clip_in_box($svg, $x, $y, $width, $height) { |
| 186 | 186 | $rect = "<rect x=\"$x\" y=\"$y\" width=\"$width\" height=\"$height\" />"; |
| 187 | - $id = 'clip-' . substr(md5($rect . strlen($svg)), 0, 8); |
|
| 187 | + $id = 'clip-'.substr(md5($rect.strlen($svg)), 0, 8); |
|
| 188 | 188 | $clippath = "<clipPath id=\"$id\">$rect</clipPath>"; |
| 189 | 189 | $g = "<g clip-path=\"url(#$id)\">"; |
| 190 | - $svg = svg_insert_shapes($svg, $clippath . $g); |
|
| 190 | + $svg = svg_insert_shapes($svg, $clippath.$g); |
|
| 191 | 191 | return svg_insert_shapes($svg, '</g>', false); |
| 192 | 192 | } |
| 193 | 193 | |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | ) { |
| 206 | 206 | [$balise_svg, $attributs] = $svg_infos; |
| 207 | 207 | if (!isset($attributs['viewBox'])) { |
| 208 | - $attributs['viewBox'] = '0 0 ' . $attributs['width'] . ' ' . $attributs['height']; |
|
| 208 | + $attributs['viewBox'] = '0 0 '.$attributs['width'].' '.$attributs['height']; |
|
| 209 | 209 | } |
| 210 | 210 | $attributs['width'] = (string) $new_width; |
| 211 | 211 | $attributs['height'] = (string) $new_height; |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | else { |
| 229 | 229 | $couleur = couleur_html_to_hex($couleur); |
| 230 | 230 | } |
| 231 | - return '#' . ltrim($couleur, '#'); |
|
| 231 | + return '#'.ltrim($couleur, '#'); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | /** |
@@ -239,7 +239,7 @@ discard block |
||
| 239 | 239 | function svg_couleur_to_rgb($couleur) { |
| 240 | 240 | if (str_starts_with($couleur, 'rgb(')) { |
| 241 | 241 | $c = explode(',', substr($couleur, 4)); |
| 242 | - return ['red' => (int) $c[0],'green' => (int) $c[1],'blue' => (int) $c[2]]; |
|
| 242 | + return ['red' => (int) $c[0], 'green' => (int) $c[1], 'blue' => (int) $c[2]]; |
|
| 243 | 243 | } |
| 244 | 244 | return _couleur_hex_to_dec($couleur); |
| 245 | 245 | } |
@@ -453,7 +453,7 @@ discard block |
||
| 453 | 453 | $background_color = svg_couleur_to_hexa($background_color); |
| 454 | 454 | if (isset($attributs['viewBox'])) { |
| 455 | 455 | $viewBox = explode(' ', $attributs['viewBox']); |
| 456 | - $rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\"/>"; |
|
| 456 | + $rect = '<rect x="'.$viewBox[0].'" y="'.$viewBox[1].'" width="'.$viewBox[2].'" height="'.$viewBox[3]."\" fill=\"$background_color\"/>"; |
|
| 457 | 457 | } |
| 458 | 458 | else { |
| 459 | 459 | $rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>"; |
@@ -483,7 +483,7 @@ discard block |
||
| 483 | 483 | $background_color = svg_couleur_to_hexa($background_color); |
| 484 | 484 | if (isset($attributs['viewBox'])) { |
| 485 | 485 | $viewBox = explode(' ', $attributs['viewBox']); |
| 486 | - $rect = '<rect x="' . $viewBox[0] . '" y="' . $viewBox[1] . '" width="' . $viewBox[2] . '" height="' . $viewBox[3] . "\" fill=\"$background_color\" opacity=\"$opacity\"/>"; |
|
| 486 | + $rect = '<rect x="'.$viewBox[0].'" y="'.$viewBox[1].'" width="'.$viewBox[2].'" height="'.$viewBox[3]."\" fill=\"$background_color\" opacity=\"$opacity\"/>"; |
|
| 487 | 487 | } |
| 488 | 488 | else { |
| 489 | 489 | $rect = "<rect width=\"100%\" height=\"100%\" fill=\"$background_color\"/>"; |
@@ -512,7 +512,7 @@ discard block |
||
| 512 | 512 | $g = '<g'; |
| 513 | 513 | foreach ($attributs as $k => $v) { |
| 514 | 514 | if (strlen($v)) { |
| 515 | - $g .= " $k=\"" . attribut_html($v) . '"'; |
|
| 515 | + $g .= " $k=\"".attribut_html($v).'"'; |
|
| 516 | 516 | } |
| 517 | 517 | } |
| 518 | 518 | if (strlen($g) > 2) { |
@@ -540,10 +540,10 @@ discard block |
||
| 540 | 540 | ) { |
| 541 | 541 | if ($filter_def) { |
| 542 | 542 | [$balise_svg, ] = $svg_infos; |
| 543 | - $filter_id = 'filter-' . substr(md5($filter_def . strlen($svg)), 0, 8); |
|
| 543 | + $filter_id = 'filter-'.substr(md5($filter_def.strlen($svg)), 0, 8); |
|
| 544 | 544 | $filter = "<defs><filter id=\"$filter_id\">$filter_def</filter></defs>"; |
| 545 | 545 | $g = "<g filter=\"url(#$filter_id)\">"; |
| 546 | - $svg = svg_insert_shapes($svg, $filter . $g); |
|
| 546 | + $svg = svg_insert_shapes($svg, $filter.$g); |
|
| 547 | 547 | $svg = svg_insert_shapes($svg, '</g>', false); |
| 548 | 548 | } |
| 549 | 549 | return $svg; |
@@ -65,17 +65,17 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | $page_title = ($options['page_title'] ?? $GLOBALS['meta']['nom_site']); |
| 67 | 67 | $doctype = ($options['doctype'] ?? '<!DOCTYPE html>'); |
| 68 | - $doctype = trim($doctype) . "\n"; |
|
| 68 | + $doctype = trim($doctype)."\n"; |
|
| 69 | 69 | $charset = ($options['charset'] ?? 'utf-8'); |
| 70 | 70 | $all_inline = ($options['all_inline'] ?? true); |
| 71 | 71 | $onLoad = ($options['onLoad'] ?? ''); |
| 72 | 72 | if ($onLoad) { |
| 73 | - $onLoad = ' onload="' . attribut_html($onLoad) . '"'; |
|
| 73 | + $onLoad = ' onload="'.attribut_html($onLoad).'"'; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | # envoyer le charset |
| 77 | 77 | if (!headers_sent()) { |
| 78 | - header('Content-Type: text/html; charset=' . $charset); |
|
| 78 | + header('Content-Type: text/html; charset='.$charset); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | $css = ''; |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | . "--minipage-color-theme--s: $s;" |
| 95 | 95 | . "--minipage-color-theme--l: $l;}"; |
| 96 | 96 | $vars = file_get_contents(find_in_theme('minipage.vars.css')); |
| 97 | - $inline .= "\n" . trim($vars); |
|
| 97 | + $inline .= "\n".trim($vars); |
|
| 98 | 98 | if (function_exists('minifier')) { |
| 99 | 99 | $inline = minifier($inline, 'css'); |
| 100 | 100 | } |
@@ -121,31 +121,31 @@ discard block |
||
| 121 | 121 | } |
| 122 | 122 | $css = "$inline\n$css"; |
| 123 | 123 | if (!empty($options['css'])) { |
| 124 | - $css .= "\n" . $options['css']; |
|
| 124 | + $css .= "\n".$options['css']; |
|
| 125 | 125 | } |
| 126 | 126 | $css = "<style type='text/css'>$css</style>"; |
| 127 | 127 | } else { |
| 128 | 128 | $css = "<style type='text/css'>$inline</style>"; |
| 129 | 129 | foreach ($files as $name) { |
| 130 | 130 | $file = timestamp(direction_css($name)); |
| 131 | - $css .= "<link rel='stylesheet' href='" . attribut_html($file) . "' type='text/css' />\n"; |
|
| 131 | + $css .= "<link rel='stylesheet' href='".attribut_html($file)."' type='text/css' />\n"; |
|
| 132 | 132 | } |
| 133 | 133 | if (!empty($options['css'])) { |
| 134 | - $css .= "<style type='text/css'>" . $options['css'] . '</style>'; |
|
| 134 | + $css .= "<style type='text/css'>".$options['css'].'</style>'; |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
| 138 | - return $doctype . |
|
| 139 | - html_lang_attributes() . |
|
| 140 | - "<head>\n" . |
|
| 141 | - '<title>' . |
|
| 142 | - textebrut($page_title) . |
|
| 143 | - "</title>\n" . |
|
| 144 | - "<meta name=\"viewport\" content=\"width=device-width\" />\n" . |
|
| 145 | - $css . |
|
| 146 | - (empty($options['head']) ? '' : $options['head']) . |
|
| 147 | - "</head>\n" . |
|
| 148 | - "<body{$onLoad} class=\"minipage" . ($this::TYPE ? ' minipage--' . $this::TYPE : '') . "\">\n" . |
|
| 138 | + return $doctype. |
|
| 139 | + html_lang_attributes(). |
|
| 140 | + "<head>\n". |
|
| 141 | + '<title>'. |
|
| 142 | + textebrut($page_title). |
|
| 143 | + "</title>\n". |
|
| 144 | + "<meta name=\"viewport\" content=\"width=device-width\" />\n". |
|
| 145 | + $css. |
|
| 146 | + (empty($options['head']) ? '' : $options['head']). |
|
| 147 | + "</head>\n". |
|
| 148 | + "<body{$onLoad} class=\"minipage".($this::TYPE ? ' minipage--'.$this::TYPE : '')."\">\n". |
|
| 149 | 149 | "\t<div class=\"minipage-bloc\">\n"; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -156,16 +156,16 @@ discard block |
||
| 156 | 156 | */ |
| 157 | 157 | protected function ouvreCorps($options = []) { |
| 158 | 158 | $url_site = url_de_base(); |
| 159 | - $header = "<header>\n" . |
|
| 160 | - '<h1><a href="' . attribut_html($url_site) . '">' . interdire_scripts($GLOBALS['meta']['nom_site'] ?? '') . "</a></h1>\n"; |
|
| 159 | + $header = "<header>\n". |
|
| 160 | + '<h1><a href="'.attribut_html($url_site).'">'.interdire_scripts($GLOBALS['meta']['nom_site'] ?? '')."</a></h1>\n"; |
|
| 161 | 161 | |
| 162 | 162 | $titre = ($options['titre'] ?? ''); |
| 163 | 163 | if ($titre) { |
| 164 | - $header .= '<h2>' . interdire_scripts($titre) . '</h2>'; |
|
| 164 | + $header .= '<h2>'.interdire_scripts($titre).'</h2>'; |
|
| 165 | 165 | } |
| 166 | 166 | $header .= '</header>'; |
| 167 | 167 | |
| 168 | - return $header . "<div class='corps'>\n"; |
|
| 168 | + return $header."<div class='corps'>\n"; |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | /** |
@@ -179,13 +179,13 @@ discard block |
||
| 179 | 179 | if (isset($options['footer'])) { |
| 180 | 180 | $footer = $options['footer']; |
| 181 | 181 | } else { |
| 182 | - $footer = '<a href="' . attribut_html($url_site) . '">' . _T('retour') . "</a>\n"; |
|
| 182 | + $footer = '<a href="'.attribut_html($url_site).'">'._T('retour')."</a>\n"; |
|
| 183 | 183 | } |
| 184 | 184 | if (!empty($footer)) { |
| 185 | 185 | $footer = "<footer>\n{$footer}</footer>"; |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - return "</div>\n" . $footer; |
|
| 188 | + return "</div>\n".$footer; |
|
| 189 | 189 | } |
| 190 | 190 | |
| 191 | 191 | |
@@ -109,13 +109,13 @@ |
||
| 109 | 109 | // generer un marqueur qui n'existe pas dans le texte |
| 110 | 110 | do { |
| 111 | 111 | $this->markId = substr(md5(uniqid(static::class, 1)), 0, 7); |
| 112 | - $this->markId = '@|' . static::$markPrefix . $this->markId . '|'; |
|
| 112 | + $this->markId = '@|'.static::$markPrefix.$this->markId.'|'; |
|
| 113 | 113 | } while (str_contains($texte, $this->markId)); |
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | $offset_pos = 0; |
| 117 | 117 | foreach ($collection as $c) { |
| 118 | - $rempl = $this->markId . base64_encode($c['raw']) . '|@'; |
|
| 118 | + $rempl = $this->markId.base64_encode($c['raw']).'|@'; |
|
| 119 | 119 | $texte = substr_replace($texte, $rempl, $c['pos'] + $offset_pos, $c['length']); |
| 120 | 120 | $offset_pos += strlen($rempl) - $c['length']; |
| 121 | 121 | } |
@@ -39,7 +39,7 @@ discard block |
||
| 39 | 39 | $this->serveur = strtolower($serveur); |
| 40 | 40 | |
| 41 | 41 | if (!($this->link = _sqlite_link($this->serveur)) && (!defined('_ECRIRE_INSTALL') || !_ECRIRE_INSTALL)) { |
| 42 | - spip_log('Aucune connexion sqlite (link)', 'sqlite.' . _LOG_ERREUR); |
|
| 42 | + spip_log('Aucune connexion sqlite (link)', 'sqlite.'._LOG_ERREUR); |
|
| 43 | 43 | |
| 44 | 44 | return; |
| 45 | 45 | } |
@@ -85,17 +85,17 @@ discard block |
||
| 85 | 85 | try { |
| 86 | 86 | $r = $this->link->query($query); |
| 87 | 87 | } catch (\PDOException $e) { |
| 88 | - spip_log('PDOException: ' . $e->getMessage(), 'sqlite.' . _LOG_DEBUG); |
|
| 88 | + spip_log('PDOException: '.$e->getMessage(), 'sqlite.'._LOG_DEBUG); |
|
| 89 | 89 | $r = false; |
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | // loger les warnings/erreurs eventuels de sqlite remontant dans PHP |
| 93 | 93 | if ($e && $e instanceof \PDOException) { |
| 94 | - $err = strip_tags($e->getMessage()) . ' in ' . $e->getFile() . ' line ' . $e->getLine(); |
|
| 95 | - spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR); |
|
| 94 | + $err = strip_tags($e->getMessage()).' in '.$e->getFile().' line '.$e->getLine(); |
|
| 95 | + spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR); |
|
| 96 | 96 | } elseif (($err = (function_exists('error_get_last') ? error_get_last() : '')) && $err != $last_error) { |
| 97 | - $err = strip_tags($err['message']) . ' in ' . $err['file'] . ' line ' . $err['line']; |
|
| 98 | - spip_log("$err - " . $query, 'sqlite.' . _LOG_ERREUR); |
|
| 97 | + $err = strip_tags($err['message']).' in '.$err['file'].' line '.$err['line']; |
|
| 98 | + spip_log("$err - ".$query, 'sqlite.'._LOG_ERREUR); |
|
| 99 | 99 | } else { |
| 100 | 100 | $err = ''; |
| 101 | 101 | } |
@@ -48,15 +48,15 @@ discard block |
||
| 48 | 48 | // Correction Create Database |
| 49 | 49 | // Create Database -> requete ignoree |
| 50 | 50 | if (str_starts_with($this->query, 'CREATE DATABASE')) { |
| 51 | - spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.' . _LOG_AVERTISSEMENT); |
|
| 51 | + spip_log("Sqlite : requete non executee -> $this->query", 'sqlite.'._LOG_AVERTISSEMENT); |
|
| 52 | 52 | $this->query = 'SELECT 1'; |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | // Correction Insert Ignore |
| 56 | 56 | // INSERT IGNORE -> insert (tout court et pas 'insert or replace') |
| 57 | 57 | if (str_starts_with($this->query, 'INSERT IGNORE')) { |
| 58 | - spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.' . _LOG_DEBUG); |
|
| 59 | - $this->query = 'INSERT ' . substr($this->query, '13'); |
|
| 58 | + spip_log("Sqlite : requete transformee -> $this->query", 'sqlite.'._LOG_DEBUG); |
|
| 59 | + $this->query = 'INSERT '.substr($this->query, '13'); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | // Correction des dates avec INTERVAL |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | if (($this->sqlite_version == 2) && (str_contains($this->query, 'USING'))) { |
| 85 | 85 | spip_log( |
| 86 | 86 | "'USING (champ)' n'est pas reconnu en SQLite 2. Utilisez 'ON table1.champ = table2.champ'", |
| 87 | - 'sqlite.' . _LOG_ERREUR |
|
| 87 | + 'sqlite.'._LOG_ERREUR |
|
| 88 | 88 | ); |
| 89 | 89 | $this->query = preg_replace('/USING\s*\([^\)]*\)/', '', $this->query); |
| 90 | 90 | } |
@@ -107,8 +107,8 @@ discard block |
||
| 107 | 107 | } else { |
| 108 | 108 | $suite = ''; |
| 109 | 109 | } |
| 110 | - $pref = ($this->prefixe) ? $this->prefixe . '_' : ''; |
|
| 111 | - $this->query = preg_replace('/([,\s])spip_/S', '\1' . $pref, $this->query) . $suite; |
|
| 110 | + $pref = ($this->prefixe) ? $this->prefixe.'_' : ''; |
|
| 111 | + $this->query = preg_replace('/([,\s])spip_/S', '\1'.$pref, $this->query).$suite; |
|
| 112 | 112 | |
| 113 | 113 | // Correction zero AS x |
| 114 | 114 | // pg n'aime pas 0+x AS alias, sqlite, dans le meme style, |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | return $this->iter->{$nom}(); |
| 136 | 136 | } catch (Exception) { |
| 137 | 137 | // #GETCHILDREN sur un fichier de DirectoryIterator ... |
| 138 | - spip_log("Methode {$nom} en echec sur " . $this->iter::class); |
|
| 138 | + spip_log("Methode {$nom} en echec sur ".$this->iter::class); |
|
| 139 | 139 | spip_log("Cela peut être normal : retour d'une ligne de resultat ne pouvant pas calculer cette methode"); |
| 140 | 140 | |
| 141 | 141 | return ''; |
@@ -356,7 +356,7 @@ discard block |
||
| 356 | 356 | return null; |
| 357 | 357 | } |
| 358 | 358 | |
| 359 | - return '(' . implode(") {$operateur} (", $filtres_string) . ')'; |
|
| 359 | + return '('.implode(") {$operateur} (", $filtres_string).')'; |
|
| 360 | 360 | } |
| 361 | 361 | |
| 362 | 362 | /** |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | return $this->composer_filtre($v[1], $v[0], $v[2]); |
| 440 | 440 | } |
| 441 | 441 | |
| 442 | - return null; // sera ignore |
|
| 442 | + return null; // sera ignore |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | /** |
@@ -468,28 +468,28 @@ discard block |
||
| 468 | 468 | // if (!in_array($cle, array('cle', 'valeur'))) |
| 469 | 469 | // return; |
| 470 | 470 | |
| 471 | - $a = '$this->get_select(\'' . $cle . '\')'; |
|
| 471 | + $a = '$this->get_select(\''.$cle.'\')'; |
|
| 472 | 472 | |
| 473 | 473 | $filtre = ''; |
| 474 | 474 | |
| 475 | 475 | if ('REGEXP' == $op) { |
| 476 | - $filtre = 'filtrer("match", ' . $a . ', ' . str_replace('\"', '"', $valeur) . ')'; |
|
| 476 | + $filtre = 'filtrer("match", '.$a.', '.str_replace('\"', '"', $valeur).')'; |
|
| 477 | 477 | $op = ''; |
| 478 | 478 | } else { |
| 479 | 479 | if ('LIKE' == $op) { |
| 480 | 480 | $valeur = str_replace(['\"', '_', '%'], ['"', '.', '.*'], preg_quote($valeur)); |
| 481 | - $filtre = 'filtrer("match", ' . $a . ', ' . $valeur . ')'; |
|
| 481 | + $filtre = 'filtrer("match", '.$a.', '.$valeur.')'; |
|
| 482 | 482 | $op = ''; |
| 483 | 483 | } else { |
| 484 | 484 | if ('=' == $op) { |
| 485 | 485 | $op = '=='; |
| 486 | 486 | } else { |
| 487 | 487 | if ('IN' == $op) { |
| 488 | - $filtre = 'in_array(' . $a . ', array' . $valeur . ')'; |
|
| 488 | + $filtre = 'in_array('.$a.', array'.$valeur.')'; |
|
| 489 | 489 | $op = ''; |
| 490 | 490 | } else { |
| 491 | 491 | if (!in_array($op, ['<', '<=', '>', '>='])) { |
| 492 | - spip_log('operateur non reconnu ' . $op); // [todo] mettre une erreur de squelette |
|
| 492 | + spip_log('operateur non reconnu '.$op); // [todo] mettre une erreur de squelette |
|
| 493 | 493 | $op = ''; |
| 494 | 494 | } |
| 495 | 495 | } |
@@ -498,7 +498,7 @@ discard block |
||
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | if ($op) { |
| 501 | - $filtre = $a . $op . str_replace('\"', '"', $valeur); |
|
| 501 | + $filtre = $a.$op.str_replace('\"', '"', $valeur); |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | if ($not) { |
@@ -547,7 +547,7 @@ discard block |
||
| 547 | 547 | // Creer la fonction de filtrage sur $this |
| 548 | 548 | if ($this->filtre) { |
| 549 | 549 | if ($filtres = $this->assembler_filtres($this->filtre)) { |
| 550 | - $filtres = 'return ' . $filtres . ';'; |
|
| 550 | + $filtres = 'return '.$filtres.';'; |
|
| 551 | 551 | $this->func_filtre = fn () => eval($filtres); |
| 552 | 552 | } else { |
| 553 | 553 | $this->func_filtre = null; |
@@ -163,7 +163,7 @@ discard block |
||
| 163 | 163 | // Si a ce stade on n'a pas de table, il y a un bug |
| 164 | 164 | if (!is_array($this->tableau)) { |
| 165 | 165 | $this->err = true; |
| 166 | - spip_log('erreur datasource ' . var_export($command, true)); |
|
| 166 | + spip_log('erreur datasource '.var_export($command, true)); |
|
| 167 | 167 | } |
| 168 | 168 | |
| 169 | 169 | // {datapath query.results} |
@@ -205,7 +205,7 @@ discard block |
||
| 205 | 205 | isset($this->command['sourcemode']) |
| 206 | 206 | && !in_array($this->command['sourcemode'], ['table', 'array', 'tableau']) |
| 207 | 207 | ) { |
| 208 | - charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true); |
|
| 208 | + charger_fonction($this->command['sourcemode'].'_to_array', 'inc', true); |
|
| 209 | 209 | } |
| 210 | 210 | |
| 211 | 211 | # le premier argument peut etre un array, une URL etc. |
@@ -214,7 +214,7 @@ discard block |
||
| 214 | 214 | # avons-nous un cache dispo ? |
| 215 | 215 | $cle = null; |
| 216 | 216 | if (is_string($src)) { |
| 217 | - $cle = 'datasource_' . md5($this->command['sourcemode'] . ':' . var_export($this->command['source'], true)); |
|
| 217 | + $cle = 'datasource_'.md5($this->command['sourcemode'].':'.var_export($this->command['source'], true)); |
|
| 218 | 218 | } |
| 219 | 219 | |
| 220 | 220 | $cache = $this->cache_get($cle); |
@@ -266,7 +266,7 @@ discard block |
||
| 266 | 266 | } |
| 267 | 267 | if ( |
| 268 | 268 | !$this->err |
| 269 | - && ($data_to_array = charger_fonction($this->command['sourcemode'] . '_to_array', 'inc', true)) |
|
| 269 | + && ($data_to_array = charger_fonction($this->command['sourcemode'].'_to_array', 'inc', true)) |
|
| 270 | 270 | ) { |
| 271 | 271 | $args = $this->command['source']; |
| 272 | 272 | $args[0] = $data; |
@@ -401,12 +401,12 @@ discard block |
||
| 401 | 401 | $this->tableau = $v; |
| 402 | 402 | } else { |
| 403 | 403 | # {par valeur} ou {par valeur/xx/yy} |
| 404 | - $tv = $r[1] == 'valeur' ? '%s' : 'table_valeur(%s, ' . var_export($r[1], true) . ')'; |
|
| 404 | + $tv = $r[1] == 'valeur' ? '%s' : 'table_valeur(%s, '.var_export($r[1], true).')'; |
|
| 405 | 405 | $sortfunc .= ' |
| 406 | - $a = ' . sprintf($tv, '$aa') . '; |
|
| 407 | - $b = ' . sprintf($tv, '$bb') . '; |
|
| 406 | + $a = ' . sprintf($tv, '$aa').'; |
|
| 407 | + $b = ' . sprintf($tv, '$bb').'; |
|
| 408 | 408 | if ($a <> $b) |
| 409 | - return ($a ' . (empty($r[2]) ? '<' : '>') . ' $b) ? -1 : 1;'; |
|
| 409 | + return ($a ' . (empty($r[2]) ? '<' : '>').' $b) ? -1 : 1;'; |
|
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | } |
@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | $nonce = random_bytes(\SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); |
| 31 | 31 | $padded_message = sodium_pad($message, 16); |
| 32 | 32 | $encrypted = sodium_crypto_secretbox($padded_message, $nonce, $key); |
| 33 | - $encoded = base64_encode($salt . $nonce . $encrypted); |
|
| 33 | + $encoded = base64_encode($salt.$nonce.$encrypted); |
|
| 34 | 34 | sodium_memzero($key); |
| 35 | 35 | sodium_memzero($nonce); |
| 36 | 36 | sodium_memzero($salt); |
@@ -47,14 +47,14 @@ discard block |
||
| 47 | 47 | $decoded = base64_decode($encoded); |
| 48 | 48 | $salt = substr($decoded, 0, \SODIUM_CRYPTO_PWHASH_SALTBYTES); |
| 49 | 49 | $nonce = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES, \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); |
| 50 | - $encrypted = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES + \SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); |
|
| 50 | + $encrypted = substr($decoded, \SODIUM_CRYPTO_PWHASH_SALTBYTES +\SODIUM_CRYPTO_SECRETBOX_NONCEBYTES); |
|
| 51 | 51 | $key = self::deriveKeyFromPassword($key, $salt); |
| 52 | 52 | $padded_message = sodium_crypto_secretbox_open($encrypted, $nonce, $key); |
| 53 | 53 | sodium_memzero($key); |
| 54 | 54 | sodium_memzero($nonce); |
| 55 | 55 | sodium_memzero($salt); |
| 56 | 56 | if ($padded_message === false) { |
| 57 | - spip_log("dechiffrer() chiffre corrompu `$encoded`", 'chiffrer' . _LOG_DEBUG); |
|
| 57 | + spip_log("dechiffrer() chiffre corrompu `$encoded`", 'chiffrer'._LOG_DEBUG); |
|
| 58 | 58 | return null; |
| 59 | 59 | } |
| 60 | 60 | return sodium_unpad($padded_message, 16); |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | final class SpipCles { |
| 16 | 16 | private static array $instances = []; |
| 17 | 17 | |
| 18 | - private string $file = _DIR_ETC . 'cles.php'; |
|
| 18 | + private string $file = _DIR_ETC.'cles.php'; |
|
| 19 | 19 | private Cles $cles; |
| 20 | 20 | |
| 21 | 21 | public static function instance(string $file = ''): self { |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | !empty($cles_potentielles['secret_des_auth']) |
| 115 | 115 | && !Password::verifier($password_clair, $password_hash, $cles_potentielles['secret_des_auth']) |
| 116 | 116 | ) { |
| 117 | - spip_log("Restauration de la cle `secret_des_auth` par id_auteur $id_auteur erronnee, on ignore", 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 117 | + spip_log("Restauration de la cle `secret_des_auth` par id_auteur $id_auteur erronnee, on ignore", 'chiffrer'._LOG_INFO_IMPORTANTE); |
|
| 118 | 118 | unset($cles_potentielles['secret_des_auth']); |
| 119 | 119 | } |
| 120 | 120 | |
@@ -123,7 +123,7 @@ discard block |
||
| 123 | 123 | foreach ($cles_potentielles as $name => $key) { |
| 124 | 124 | if (!$this->cles->has($name)) { |
| 125 | 125 | $this->cles->set($name, $key); |
| 126 | - spip_log("Restauration de la cle $name par id_auteur $id_auteur", 'chiffrer' . _LOG_INFO_IMPORTANTE); |
|
| 126 | + spip_log("Restauration de la cle $name par id_auteur $id_auteur", 'chiffrer'._LOG_INFO_IMPORTANTE); |
|
| 127 | 127 | $restauration = true; |
| 128 | 128 | } |
| 129 | 129 | } |
@@ -141,7 +141,7 @@ discard block |
||
| 141 | 141 | return $this->cles->get($name); |
| 142 | 142 | } |
| 143 | 143 | // sinon loger et annule la cle generee car il ne faut pas l'utiliser |
| 144 | - spip_log('Echec ecriture du fichier cle ' . $this->file . " ; impossible de generer une cle $name", 'chiffrer' . _LOG_ERREUR); |
|
| 144 | + spip_log('Echec ecriture du fichier cle '.$this->file." ; impossible de generer une cle $name", 'chiffrer'._LOG_ERREUR); |
|
| 145 | 145 | $this->cles->delete($name); |
| 146 | 146 | } |
| 147 | 147 | return null; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | private function getMetaKey(string $name, bool $autoInit = true): ?string { |
| 151 | 151 | if (!isset($GLOBALS['meta'][$name])) { |
| 152 | 152 | include_spip('base/abstract_sql'); |
| 153 | - $GLOBALS['meta'][$name] = sql_getfetsel('valeur', 'spip_meta', 'nom = ' . sql_quote($name, '', 'string')); |
|
| 153 | + $GLOBALS['meta'][$name] = sql_getfetsel('valeur', 'spip_meta', 'nom = '.sql_quote($name, '', 'string')); |
|
| 154 | 154 | } |
| 155 | 155 | $key = base64_decode($GLOBALS['meta'][$name] ?? ''); |
| 156 | 156 | if (strlen($key) === \SODIUM_CRYPTO_SECRETBOX_KEYBYTES) { |