inc-criteres.php3 1.5 1.6

Update of /home/spip-cvs/spip
In directory alan:/tmp/cvs-serv29362

Modified Files:
  inc-criteres.php3
Log Message:
introduction de critère acceptant une fonction SQL: length(champ)>10 (pour Fil)

Index: inc-criteres.php3

RCS file: /home/spip-cvs/spip/inc-criteres.php3,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- inc-criteres.php3 4 Sep 2004 22:06:38 -0000 1.5
+++ inc-criteres.php3 7 Sep 2004 17:18:13 -0000 1.6
@@ -380,9 +380,15 @@
     }

     // Restriction de valeurs (implicite ou explicite)
- else if (eregi('^([a-z_]+) *(\??)((!?)(<=?|>=?|==?|IN) *"?([^<>=!"]*))?"?$', $param, $match)) {
+ else if (eregi('^([a-z_]+\(?[a-z_]*\)?) *(\??)((!?)(<=?|>=?|==?|IN) *"?([^<>=!"]*))?"?$', $param, $match)) {
       // Variable comparee
       $col = $match[1];
+ $fct = '';
+ if (ereg("([a-z_]+)\(([a-z_]+)\)", $col,$match3))
+ {
+ $col = $match3[2];
+ $fct = $match3[1];
+ }
       $col_table = $id_table;
       // Valeur de comparaison
       if ($match[3]) {
@@ -559,6 +565,7 @@
         $col = "$col_table.$col";

       if ($op) {
+ if ($fct) $col = "$fct($col)";
         if ($match[4] == '!')
           $where = "NOT ($col $op '$val')";
         else