]> git.mxchange.org Git - mailer.git/blobdiff - inc/mysql-manager.php
SQL fix #3
[mailer.git] / inc / mysql-manager.php
index 7088fec5ae0bc4740908ed26e467a4db9ac98fb7..47366597c9ddf5569228a3f84ed4a31892459efe 100644 (file)
@@ -641,7 +641,7 @@ function isMember () {
 function isAdmin ($admin = '') {
        // Init variables
        $ret = false; $passCookie = ''; $valPass = '';
-       //* DEBUG: */ print(__FUNCTION__.':'.$admin."<br />");
+       //* DEBUG: */ print(__FUNCTION__.':'.$admin.'<br />');
 
        // If admin login is not given take current from cookies...
        if ((empty($admin)) && (isSessionVariableSet('admin_login')) && (isSessionVariableSet('admin_md5'))) {
@@ -649,7 +649,7 @@ function isAdmin ($admin = '') {
                $admin = getSession('admin_login');
                $passCookie = getSession('admin_md5');
        } // END - if
-       //* DEBUG: */ print(__FUNCTION__.':'.$admin.'/'.$passCookie."<br />");
+       //* DEBUG: */ print(__FUNCTION__.':'.$admin.'/'.$passCookie.'<br />');
 
        // Search in array for entry
        if (isset($GLOBALS['admin_hash'])) {
@@ -965,7 +965,7 @@ function getModeAction ($mode, $what) {
                // Get it directly from URL
                return getAction();
        }
-       //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ret=".$ret."<br />");
+       //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>): ret=".$ret.'<br />');
 
        // Does the module have a menu?
        if (ifModuleHasMenu($mode)) {
@@ -1343,7 +1343,7 @@ function updateReferalCounter ($userid) {
                array(bigintval($userid), $GLOBALS['cache_array']['ref_level'][$userid]), __FUNCTION__, __LINE__);
 
        // When no entry was updated then we have to create it here
-       //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):updated=".SQL_AFFECTEDROWS()."<br />");
+       //* DEBUG: */ print(__FUNCTION__."(<font color=\"#0000aa\">".__LINE__."</font>):updated=".SQL_AFFECTEDROWS().'<br />');
        if (SQL_AFFECTEDROWS() < 1) {
                // First count!
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_refsystem` (`userid`, `level`, `counter`) VALUES (%s,%s,1)",
@@ -1919,7 +1919,7 @@ VALUES ('%s','%s','%s','%s','%s','NEW', UNIX_TIMESTAMP(),'%s','%s','%s','%s')",
 // Generate a receiver list for given category and maximum receivers
 function generateReceiverList ($cat, $receiver, $mode = '') {
        // Init variables
-       $CAT_TABS     = "%s";
+       $CAT_TABS     = '';
        $CAT_WHERE    = '';
        $receiverList = '';
        $result       = false;
@@ -1938,7 +1938,7 @@ function generateReceiverList ($cat, $receiver, $mode = '') {
        if ($cat > 0) {
                // Select category
                $CAT_TABS  = "LEFT JOIN `{?_MYSQL_PREFIX?}_user_cats` AS c ON d.userid=c.userid";
-               $CAT_WHERE = " AND c.cat_id=%s";
+               $CAT_WHERE = sprintf(" AND c.cat_id=%s", $cat);
        } // END - if
 
        // Exclude users in holiday?
@@ -1951,14 +1951,12 @@ function generateReceiverList ($cat, $receiver, $mode = '') {
                // Only include HTML receivers
                $result = SQL_QUERY_ESC("SELECT d.userid FROM `{?_MYSQL_PREFIX?}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED' AND d.`html`='Y'".$CAT_WHERE." ORDER BY d.{?order_select?} {?order_mode?} LIMIT %s",
                        array(
-                               $cat,
                                $receiver
                        ), __FUNCTION__, __LINE__);
        } else {
                // Include all
                $result = SQL_QUERY_ESC("SELECT d.userid FROM `{?_MYSQL_PREFIX?}_user_data` AS d ".$CAT_TABS." WHERE d.`status`='CONFIRMED'".$CAT_WHERE." ORDER BY d.{?order_select?} {?order_mode?} LIMIT %s",
                        array(
-                               $cat,
                                $receiver
                        ), __FUNCTION__, __LINE__);
        }