diff --git a/ecrire/base/connect_sql.php b/ecrire/base/connect_sql.php index 06e1b5c9bd10aa257901b55e1627497b0f1394fd..1aaffbb72408e41ffbfda910b1ba1a6d5389e07f 100644 --- a/ecrire/base/connect_sql.php +++ b/ecrire/base/connect_sql.php @@ -399,14 +399,14 @@ function _q($a) { * @param string $query * @return array */ -function query_echappe_textes($query, $uniqid=null) { +function query_echappe_textes($query, $uniqid = null) { static $codeEchappements = null; if (is_null($codeEchappements) or $uniqid) { if (is_null($uniqid)) { $uniqid = uniqid(); } $uniqid = substr(md5($uniqid), 0, 4); - $codeEchappements = ["\\\\" => "\x1@#{$uniqid}#@\x1", "\\'" => "\x2@#{$uniqid}#@\x2", '\\"' => "\x3@#{$uniqid}#@\x3"]; + $codeEchappements = ['\\\\' => "\x1@#{$uniqid}#@\x1", "\\'" => "\x2@#{$uniqid}#@\x2", '\\"' => "\x3@#{$uniqid}#@\x3"]; } if ($query === null) { return $codeEchappements; diff --git a/ecrire/inc/distant.php b/ecrire/inc/distant.php index c219af9211994d8d47d9767090f27836d7d7354d..451b3cfe7dbabce087bd8547ccfa5fab13a06cc7 100644 --- a/ecrire/inc/distant.php +++ b/ecrire/inc/distant.php @@ -124,8 +124,10 @@ function copie_locale($source, $mode = 'auto', $local = null, $taille_max = null spip_log("copie_locale : recuperation $source sur $localrac taille " . $res['length'] . ' OK', 'distant'); // si on retrouve l'extension - if (!empty($res['headers']) - and $extension = distant_trouver_extension_selon_headers($source, $res['headers'])) { + if ( + !empty($res['headers']) + and $extension = distant_trouver_extension_selon_headers($source, $res['headers']) + ) { if ($sanitizer = charger_fonction($extension, 'sanitizer', true)) { $sanitizer($localrac); } diff --git a/ecrire/inc/documents.php b/ecrire/inc/documents.php index 7a33df6502ea8f229673e5692b6afc77d6321e49..ad4a9ea652cec599b443d19a6eb28e46ea1abaf0 100644 --- a/ecrire/inc/documents.php +++ b/ecrire/inc/documents.php @@ -141,24 +141,26 @@ function copier_document($ext, $orig, $source, $subdir = null) { $dir = creer_repertoire_documents($subdir ? $subdir : $ext); $dest = preg_replace('/<[^>]*>/', '', basename($orig)); - $dest = preg_replace('/\.([^.]+)$/','', $dest); + $dest = preg_replace('/\.([^.]+)$/', '', $dest); $dest = translitteration($dest); - $dest = preg_replace('/[^.=\w-]+/','_', $dest); + $dest = preg_replace('/[^.=\w-]+/', '_', $dest); // ne pas accepter de noms de la forme -r90.jpg qui sont reserves // pour les images transformees par rotation (action/documenter) $dest = preg_replace(',-r(90|180|270)$,', '', $dest); - while (preg_match(",\.(\w+)$,", $dest, $m)) { - if (!function_exists('verifier_upload_autorise') - or !$r = verifier_upload_autorise($dest) - or $r['autozip']) { + while (preg_match(',\.(\w+)$,', $dest, $m)) { + if ( + !function_exists('verifier_upload_autorise') + or !$r = verifier_upload_autorise($dest) + or $r['autozip'] + ) { $dest = substr($dest, 0, -strlen($m[0])) . '_' . $m[1]; break; } else { $dest = substr($dest, 0, -strlen($m[0])); - $ext = $m[1] . "." . $ext; + $ext = $m[1] . '.' . $ext; } } diff --git a/ecrire/inc/filtres.php b/ecrire/inc/filtres.php index 64194f4d1b378747d7c24934c790b7c59cfd6ede..3a87b4c493fbc472aad061fa147e3fb7f8feb34e 100644 --- a/ecrire/inc/filtres.php +++ b/ecrire/inc/filtres.php @@ -3710,9 +3710,11 @@ function filtre_balise_svg_dist($img, $alt = '', $class = null, $size = null) { $img_file = ($fichier ? _DIR_RACINE . $fichier : $img_file); } - if (!$img_file + if ( + !$img_file or !file_exists($img_file) - or !$svg = file_get_contents($img_file)) { + or !$svg = file_get_contents($img_file) + ) { return ''; } } diff --git a/ecrire/inc/filtres_images_lib_mini.php b/ecrire/inc/filtres_images_lib_mini.php index 672c05bf9b7cc1b3c9d0ff4e525a8cc823998075..aade3aec3056d71f6f332318cc53fbbeb509d85d 100644 --- a/ecrire/inc/filtres_images_lib_mini.php +++ b/ecrire/inc/filtres_images_lib_mini.php @@ -342,8 +342,10 @@ function _image_valeurs_trans($img, $effet, $forcer_format = false, $fonction_cr if (!$fichier) { return ''; } - if ($extension = _image_trouver_extension($fichier) - and $sanitizer = charger_fonction($extension, 'sanitizer', true)) { + if ( + $extension = _image_trouver_extension($fichier) + and $sanitizer = charger_fonction($extension, 'sanitizer', true) + ) { $sanitizer($fichier); } } else { diff --git a/ecrire/public/interfaces.php b/ecrire/public/interfaces.php index 741f6740c5e205ddfd681b657e9ec2467bc6f21f..2403dd725f9fbbcee32a3b0abb7eb303e72295b0 100644 --- a/ecrire/public/interfaces.php +++ b/ecrire/public/interfaces.php @@ -975,7 +975,7 @@ function declarer_interfaces() { if (!defined('_TRAITEMENT_TYPO_SANS_NUMERO')) { define('_TRAITEMENT_TYPO_SANS_NUMERO', 'supprimer_numero(typo(%s, "TYPO", $connect, $Pile[0]))'); } - $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml('._TRAITEMENT_RACCOURCIS.')'; + $GLOBALS['table_des_traitements']['BIO'][] = 'safehtml(' . _TRAITEMENT_RACCOURCIS . ')'; $GLOBALS['table_des_traitements']['NOM_SITE']['spip_auteurs'] = 'entites_html(%s)'; $GLOBALS['table_des_traitements']['NOM']['spip_auteurs'] = 'safehtml(%s)'; $GLOBALS['table_des_traitements']['CHAPO'][] = _TRAITEMENT_RACCOURCIS; diff --git a/ecrire/req/sqlite_fonctions.php b/ecrire/req/sqlite_fonctions.php index 5c198135e3d3042675ddc2eaf841d31f8a1e3a8a..7b0fa7c9a28a7e122c8aa56739ff053dd41c61e3 100644 --- a/ecrire/req/sqlite_fonctions.php +++ b/ecrire/req/sqlite_fonctions.php @@ -13,9 +13,9 @@ /** * Ce fichier déclare des fonctions étendant les fonctions natives de SQLite * - * On mappe des fonctions absentes de sqlite (notamment donc des fonctions présentes dans mysql) + * On mappe des fonctions absentes de sqlite (notamment donc des fonctions présentes dans mysql) * à des fonctions équivalentes php, que sqlite exécutera si besoin. - * + * * entre autre auteurs : mlebas * * @package SPIP\Core\SQL\SQLite\Fonctions @@ -177,7 +177,7 @@ function _sqlite_func_concat(...$args) { * Mapping de `DAYOFMONTH` pour SQLite * * @uses _sqlite_func_date() - * + * * @param string $d * @return int */ @@ -234,7 +234,7 @@ function _sqlite_func_if($bool, $oui, $non) { * * Retourne une chaine de caractères à partir d'une chaine dans laquelle "chaine" * à été inserée à la position "index" en remplacant "longueur" caractères. - * + * * @param string $s * @param int $index * @param int $longueur @@ -315,7 +315,7 @@ function _sqlite_func_now($force_refresh = false) { * Mapping de `MONTH` pour SQLite * * @uses _sqlite_func_date() - * + * * @param string $d * @return int */ @@ -341,7 +341,7 @@ function _sqlite_func_preg_replace($quoi, $cherche, $remplace) { /** * Mapping pour `EXTRAIRE_MULTI` de SPIP pour SQLite - * + * * Extrait une langue d'un texte <multi>[fr] xxx [en] yyy</multi> * * @param string $quoi le texte contenant ou non un multi @@ -418,7 +418,7 @@ function _sqlite_func_regexp_match($cherche, $quoi) { /** * Mapping de `DATE_FORMAT` pour SQLite - * + * * Transforme un un appel à DATE_FORMAT() via strftime de PHP, mais les motifs de remplacements * ne sont pas toujours identiques. On essaie de les contertir. * @@ -470,7 +470,7 @@ function _sqlite_func_strftime_format_converter(string $conv): string { /** * Mapping de `DAYS` pour SQLite - * + * * Nombre de jour entre 0000-00-00 et $d * * @link http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_to-days @@ -506,7 +506,7 @@ function _sqlite_func_substring($string, $start, $len = null) { /** * Mapping de `TIMESTAMPDIFF` pour SQLite - * + * * Calcul de la difference entre 2 timestamp, exprimes dans l'unite fournie en premier argument * * @link https://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_timestampdiff @@ -578,7 +578,7 @@ function _sqlite_func_unix_timestamp($d) { * Mapping de `YEAR` pour SQLite * * @uses _sqlite_func_date() - * + * * @param string $d * @return int */