Even more rewrites/fixes from EL branch (please report any broken part after you...
[mailer.git] / inc / libs / doubler_functions.php
index 6333ababde6c017e22cc9ef13c6eee8c8decd204..b6eddaf4432c2349b6baacf6ab2f3428feb7ccb3 100644 (file)
@@ -70,15 +70,21 @@ function generateDoublerTable ($userid = '0', $done = 'N', $ref = 'N', $sort = '
        }
 
        // List entries
-       $result = SQL_QUERY("SELECT
+       $result = SQL_QUERY_ESC("SELECT
        `userid`, `refid`, `points`, `timemark`
 FROM
        `{?_MYSQL_PREFIX?}_doubler`
 WHERE
-       `completed`='".$done."' AND `is_ref`='".$ref."'".$add."
+       `completed`='%s' AND `is_ref`='%s'" . $add . "
 ORDER BY
-       `timemark` ".$sort."
-LIMIT ".$limit, __FUNCTION__, __LINE__);
+       `timemark` %s
+LIMIT %s",
+               array(
+                       $done,
+                       $ref,
+                       $sort,
+                       $limit
+               ), __FUNCTION__, __LINE__);
 
        if (SQL_NUMROWS($result) > 0) {
                // List entries