]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/surfbar_functions.php
Reset rewritten, SQL fixed, zeros are now numeric
[mailer.git] / inc / libs / surfbar_functions.php
index 2104068759b7e296545acb58cacf0577a82091ce..8b491c650acadd8365588e92f1ac3e3f6ffeb09e 100644 (file)
@@ -101,7 +101,7 @@ function SURFBAR_MEMBER_ADD_URL ($url) {
        global $_CONFIG;
 
        // Do some pre-checks
-       if (!IS_LOGGED_IN()) {
+       if (!IS_MEMBER()) {
                // Not a member
                return false;
        } elseif (!VALIDATE_URL($url)) {
@@ -225,7 +225,7 @@ function SURFBAR_INSERT_URL_BY_ARRAY ($urlData) {
        $uid = bigintval($urlData['uid']);
 
        // Is the id set?
-       if (empty($uid)) $uid = "0";
+       if (empty($uid)) $uid = 0;
 
        // Just run the insert query for now
        SQL_QUERY_ESC("INSERT INTO "._MYSQL_PREFIX."_surfbar_urls (userid, url, reward, costs, status) VALUES('%s', '%s', %s, %s, '%s')",
@@ -253,10 +253,15 @@ function SURFBAR_NOTIFY_ADMIN ($messageType, $content) {
        eval($eval);
 
        // Send the notification out
-       SEND_ADMIN_NOTIFICATION($subject, $templateName, $content, $content['uid']);
+       return SEND_ADMIN_NOTIFICATION($subject, $templateName, $content, $content['uid']);
 }
 // Notify the user about the performed action
 function SURFBAR_NOTIFY_USER ($messageType, $content) {
+       // Skip notification if userid is zero
+       if ($content['uid'] == 0) {
+               return false;
+       } // END - if
+
        // Prepare template name
        $templateName = sprintf("member_surfbar_%s", $messageType);
 
@@ -270,7 +275,7 @@ function SURFBAR_NOTIFY_USER ($messageType, $content) {
        $mailText = LOAD_EMAIL_TEMPLATE($templateName, $content);
 
        // Send the email
-       SEND_EMAIL($content['uid'], $subject, $mailText);
+       return SEND_EMAIL($content['uid'], $subject, $mailText);
 }
 // Translate the URL status
 function SURFBAR_TRANSLATE_STATUS ($status) {
@@ -416,7 +421,7 @@ function SURFBAR_GET_TOTAL_USER_URLS ($uid=0) {
        global $_CONFIG;
 
        // Is the user 0 and user is logged in?
-       if (($uid == 0) && (IS_LOGGED_IN())) {
+       if (($uid == 0) && (IS_MEMBER())) {
                // Then use this userid
                $uid = $GLOBALS['userid'];
        } elseif ($uid == 0) {
@@ -592,7 +597,7 @@ function SURFBAR_DETERMINE_DEPLETED_USERIDS() {
        $UIDs = array();
 
        // Do we have a current user id?
-       if (IS_LOGGED_IN()) {
+       if (IS_MEMBER()) {
                // Then add this as well
                $UIDs[] = $GLOBALS['userid'];
 
@@ -778,7 +783,7 @@ WHERE sbu.userid NOT IN (".implode(",", $UIDs).") AND sbu.status='CONFIRMED'".$A
 GROUP BY sbu.id", __FILE__, __LINE__);
 
        // Log last query
-       //DEBUG_LOG(__FUNCTION__.":lastQuery=".$_CONFIG['db_last_query']."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS($result)."");
+       //DEBUG_LOG(__FUNCTION__.":lastQuery=".$_CONFIG['db_last_query']."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS()."");
 
        // Fetch max rand
        $maxRand = SQL_NUMROWS($result);
@@ -858,7 +863,7 @@ LIMIT 1",
        }
 
        // Is there an id number?
-       //DEBUG_LOG(__FUNCTION__.":lastQuery=".$_CONFIG['db_last_query']."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS($result)."");
+       //DEBUG_LOG(__FUNCTION__.":lastQuery=".$_CONFIG['db_last_query']."|numRows=".SQL_NUMROWS($result)."|Affected=".SQL_AFFECTEDROWS()."");
        if (SQL_NUMROWS($result) == 1) {
                // Load/cache data
                //DEBUG_LOG(__FUNCTION__.":count(".count($SURFBAR_CACHE).") - BEFORE");
@@ -879,7 +884,7 @@ LIMIT 1",
                if ((!isset($SURFBAR_CACHE['last_surfed'])) || (is_null($SURFBAR_CACHE['last_surfed']))) {
                        // Fix it here
                        //DEBUG_LOG(__FUNCTION__.":last_surfed - FIXED!");
-                       $SURFBAR_CACHE['last_surfed'] = "0";
+                       $SURFBAR_CACHE['last_surfed'] = 0;
                } // END - if
 
                // Get base/fixed reward and costs