X-Git-Url: http://git.cyclocoop.org/?p=lhc%2Fweb%2Fclavette_www.git;a=blobdiff_plain;f=www%2Fecrire%2Freq%2Fmysql.php;fp=www%2Fecrire%2Freq%2Fmysql.php;h=89d66fae3bba8f7e74eb19f4210a017045e18eb8;hp=9a450aac61b5ad2def2ddef0828cd0efebdc1791;hb=cc641eb476987612f6d6df1a5417c1c5582a8ab8;hpb=7d84a490677fb716a1fd4df260f8eab35f6a8506 diff --git a/www/ecrire/req/mysql.php b/www/ecrire/req/mysql.php index 9a450aa..89d66fa 100644 --- a/www/ecrire/req/mysql.php +++ b/www/ecrire/req/mysql.php @@ -3,7 +3,7 @@ /* *************************************************************************\ * SPIP, Systeme de publication pour l'internet * * * - * Copyright (c) 2001-2014 * + * Copyright (c) 2001-2016 * * Arnaud Martin, Antoine Pitrou, Philippe Riviere, Emmanuel Saint-James * * * * Ce programme est un logiciel libre distribue sous licence GNU/GPL. * @@ -112,28 +112,29 @@ $GLOBALS['spip_mysql_functions_1'] = array( 'utf-8'=>array('charset'=>'utf8','collation'=>'utf8_general_ci')) ); -// http://doc.spip.org/@spip_mysql_set_charset + /** - * @param $charset - * @param string $serveur - * @param bool $requeter - * @param bool $requeter - * @return resource + * Définit un charset pour la connexion avec Mysql + * + * @param string $charset Charset à appliquer + * @param string $serveur Nom de la connexion + * @param bool $requeter inutilisé + * @return resource Ressource de résultats pour fetch() */ -function spip_mysql_set_charset($charset, $serveur='',$requeter=true,$requeter=true){ +function spip_mysql_set_charset($charset, $serveur='',$requeter=true){ $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; spip_log("changement de charset sql : "."SET NAMES "._q($charset), _LOG_DEBUG); return mysql_query($connexion['last'] = "SET NAMES "._q($charset)); } -// http://doc.spip.org/@spip_mysql_get_charset -/** - * @param array $charset - * @param string $serveur - * @param bool $requeter - * @return array - * +/** + * Teste si le charset indiqué est disponible sur le serveur SQL + * + * @param array|string $charset Nom du charset à tester. + * @param string $serveur Nom de la connexion + * @param bool $requeter inutilisé + * @return array Description du charset (son nom est dans 'charset') */ function spip_mysql_get_charset($charset=array(), $serveur='',$requeter=true){ $connexion = &$GLOBALS['connexions'][$serveur ? strtolower($serveur) : 0]; @@ -184,10 +185,10 @@ function spip_mysql_query($query, $serveur='',$requeter=true) { if (defined('_DEBUG_SLOW_QUERIES') AND _DEBUG_SLOW_QUERIES){ if(isset($GLOBALS['debug']['aucasou'])){ list(,$id,, $infos) = $GLOBALS['debug']['aucasou']; - $debug .= " BOUCLE$id @ ".$infos[0] ." | "; + $debug .= "BOUCLE$id @ ".$infos[0] ." | "; } - $debug .= " " . $_SERVER['REQUEST_URI'].' + '.$GLOBALS['ip']; - $debug = ' /*'.str_replace('*/','@/',$debug).' */'; + $debug .= $_SERVER['REQUEST_URI'].' + '.$GLOBALS['ip']; + $debug = ' /* '. mysql_real_escape_string(str_replace('*/','@/',$debug)). ' */'; } $r = $link ? mysql_query($query.$debug, $link) : mysql_query($query.$debug);