From: Pierre Habouzit (MadCoder Date: Tue, 28 Dec 2004 17:35:42 +0000 (+0000) Subject: plugins are now ok too X-Git-Tag: xorg/old~586 X-Git-Url: http://git.polytechnique.org/?a=commitdiff_plain;h=9fa5bd067a1ddafceac3c1caf8c9c525b938099f;p=platal.git plugins are now ok too git-archimport-id: opensource@polytechnique.org--2005/platal--mainline--0.9--patch-162 --- diff --git a/plugins/function.select_db_table.php b/plugins/function.select_db_table.php index c5a9d13..b9b948d 100644 --- a/plugins/function.select_db_table.php +++ b/plugins/function.select_db_table.php @@ -23,18 +23,17 @@ function select_options($table,$valeur,$champ="text",$pad=false,$where="") { global $globals; $sql = "SELECT id,$champ FROM $table $where ORDER BY $champ"; - $result = $globals->db->query($sql); - + $res = $globals->xdb->iterRow($sql); $sel = ' selected="selected"'; // on ajoute une entree vide si $pad est vrai $html = ""; - if ($pad) + if ($pad) { $html.= '\n"; - while (list($my_id,$my_text) = mysql_fetch_row($result)) { + } + while (list($my_id,$my_text) = $res->next()) { $html .= sprintf("\n",$my_id,($valeur==$my_id?$sel:""),$my_text); } - mysql_free_result($result); return $html; } diff --git a/plugins/function.select_nat.php b/plugins/function.select_nat.php index aae62aa..c581722 100644 --- a/plugins/function.select_nat.php +++ b/plugins/function.select_nat.php @@ -23,18 +23,17 @@ function select_nat($valeur,$pad=false) { global $globals; $sql = "SELECT a2 AS id,IF(nat='',pays,nat) AS text FROM geoloc_pays ORDER BY text"; - $result = $globals->db->query($sql); - + $res = $globals->xdb->iterRow($sql); $sel = ' selected="selected"'; // on ajoute une entree vide si $pad est vrai $html = ""; - if ($pad) + if ($pad) { $html.= '\n"; - while (list($my_id,$my_text) = mysql_fetch_row($result)) { + } + while (list($my_id,$my_text) = $res->next()) { $html .= sprintf("\n",$my_id,($valeur==$my_id?$sel:""),$my_text); } - mysql_free_result($result); return $html; } diff --git a/plugins/insert.getName.php b/plugins/insert.getName.php index 82b59fb..a1db78a 100644 --- a/plugins/insert.getName.php +++ b/plugins/insert.getName.php @@ -26,12 +26,8 @@ function smarty_insert_getName() if ($uid < 0) { return ""; } - $res = $globals->db->query("SELECT prenom FROM auth_user_md5 WHERE user_id=$uid"); - if (list($prenom) = mysql_fetch_row($res)) { - mysql_free_result($res); - return $prenom; - } - return ""; + $res = $globals->xdb->query("SELECT prenom FROM auth_user_md5 WHERE user_id={?}", $uid); + return $res->fetchOneCell(); } ?> diff --git a/plugins/insert.getUserName.php b/plugins/insert.getUserName.php index f33c263..c70c54b 100644 --- a/plugins/insert.getUserName.php +++ b/plugins/insert.getUserName.php @@ -30,13 +30,8 @@ function smarty_insert_getUsername() return ""; } - $res = $globals->db->query("SELECT alias - FROM aliases - WHERE id='$id' AND (type IN ('a_vie','alias') AND FIND_IN_SET('bestalias', flags))"); - if (list($uname) = mysql_fetch_row($res)) { - mysql_free_result($res); - return $uname; - } - return ""; + $res = $globals->xdb->query("SELECT alias FROM aliases + WHERE id={?} AND (type IN ('a_vie','alias') AND FIND_IN_SET('bestalias', flags))", $id); + return $res->fetchOneCell(); } ?>