Old config.php is now automatically updated to new config-local.php format, several...
[mailer.git] / inc / libs / surfbar_functions.php
index 82ae305ab19236c64445d92560b69567ddd75947..d9585d024b8677874ec192ce614615a5a09dcf67 100644 (file)
@@ -193,11 +193,11 @@ function SURFBAR_MEMBER_ACTIONS ($urlId, $status) {
        foreach ($actionArray as $actionId => $action) {
                // Add form for this action
                $OUT .= sprintf(LOAD_TEMPLATE('member_surfbar_list_form', true),
-                       $width,
-                       bigintval($urlId),
-                       strtolower($action),
-                       strtoupper($action),
-                       strtoupper($action)
+               $width,
+               bigintval($urlId),
+               strtolower($action),
+               strtoupper($action),
+               strtoupper($action)
                );
        } // END - foreach
 
@@ -265,7 +265,7 @@ function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) {
 function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) {
        // Search for the requested action/status combination in database
        $result = SQL_QUERY_ESC("SELECT new_status FROM `{!_MYSQL_PREFIX!}_surfbar_actions` WHERE `action`='%s' AND `status`='%s' LIMIT 1",
-               array($action, $status), __FUNCTION__, __LINE__);
+       array($action, $status), __FUNCTION__, __LINE__);
 
        // Is the entry there?
        $isValid = (SQL_NUMROWS($result) == 1);
@@ -292,7 +292,7 @@ function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) {
 function SURFBAR_MEMBER_RETREAT_ACTION ($urlData) {
        // Create the data array for next function call
        $data = array(
-               $urlData['id'] => $urlData
+       $urlData['id'] => $urlData
        );
 
        // Simply change the status here
@@ -303,7 +303,7 @@ function SURFBAR_MEMBER_RETREAT_ACTION ($urlData) {
 function SURFBAR_MEMBER_BOOKNOW_ACTION ($urlData) {
        // Create the data array for next function call
        $data = array(
-               $urlData['id'] => $urlData
+       $urlData['id'] => $urlData
        );
 
        // Simply change the status here
@@ -439,10 +439,10 @@ function SURFBAR_MEMBER_EXECUTE_EDIT_ACTION ($urlData) {
 
        // Has the URL or limit changed?
        if (true) {
-       //if (($urlData['views_allowed'] != $urlData['edit']['limit']) || ($url1 != $url2)) {
+               //if (($urlData['views_allowed'] != $urlData['edit']['limit']) || ($url1 != $url2)) {
                // Run the query
                SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET url='%s', views_allowed=%s, views_max=%s WHERE `id`=%s AND `status`='%s' LIMIT 1",
-                       array($urlData['url'], $urlData['edit']['limit'], $urlData['edit']['limit'], $urlData['id'], $urlData['status']), __FUNCTION__, __LINE__);
+               array($urlData['url'], $urlData['edit']['limit'], $urlData['edit']['limit'], $urlData['id'], $urlData['status']), __FUNCTION__, __LINE__);
 
                // All fine
                $status = true;
@@ -513,7 +513,7 @@ function SURFBAR_HANDLE_LOW_POINTS () {
 
                        // Update last notified
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET surfbar_low_notified=NOW() WHERE userid=%s LIMIT 1",
-                               array($uid), __FUNCTION__, __LINE__);
+                       array($uid), __FUNCTION__, __LINE__);
                } // END - if
        } // END - foreach
 }
@@ -556,7 +556,7 @@ FROM `{!_MYSQL_PREFIX!}_surfbar_urls`
 WHERE %s='%s'".$add."
 ORDER BY %s %s
 %s",
-               array($column, $searchTerm, $order, $sort, $limit), __FUNCTION__, __LINE__);
+       array($column, $searchTerm, $order, $sort, $limit), __FUNCTION__, __LINE__);
 
        // Is there at least one record?
        if (SQL_NUMROWS($result) > 0) {
@@ -632,14 +632,14 @@ function SURFBAR_INSERT_URL_BY_ARRAY ($urlData) {
 
        // Just run the insert query for now
        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_surfbar_urls` (userid,url,status,views_max,views_allowed,fixed_reload) VALUES (%s,'%s','%s',%s,%s,%s)",
-               array(
-                       $uid,
-                       $urlData['url'],
-                       $urlData['status'],
-                       $urlData['limit'],
-                       $urlData['limit'],
-                       $urlData['reload']
-               ), __FUNCTION__, __LINE__
+       array(
+       $uid,
+       $urlData['url'],
+       $urlData['status'],
+       $urlData['limit'],
+       $urlData['limit'],
+       $urlData['reload']
+       ), __FUNCTION__, __LINE__
        );
 
        // Return insert id
@@ -653,7 +653,7 @@ function SURFBAR_NOTIFY_ADMIN ($messageType, $content) {
 
        // Prepare subject
        $subject = getMessage(sprintf("ADMIN_SURFBAR_NOTIFY_%s_SUBJECT",
-               strtoupper($messageType)
+       strtoupper($messageType)
        ));
 
        // Is the subject line there?
@@ -686,7 +686,7 @@ function SURFBAR_NOTIFY_USER ($messageType, $content) {
 
        // Prepare subject
        $subject = getMessage(sprintf("MEMBER_SURFBAR_NOTIFY_%s_SUBJECT",
-               strtoupper($messageType)
+       strtoupper($messageType)
        ));
 
        // Is the subject line there?
@@ -800,7 +800,7 @@ function SURFBAR_DETERMINE_TEMPLATE_NAME() {
        if (REQUEST_ISSET_GET(('frame'))) {
                // Use the frame as a template name part... ;-)
                $templateName = sprintf("surfbar_frame_%s",
-                       REQUEST_GET(('frame'))
+               REQUEST_GET(('frame'))
                );
        } // END - if
 
@@ -830,7 +830,7 @@ INNER JOIN `{!_MYSQL_PREFIX!}_surfbar_urls` AS u
 ON u.id=l.url_id
 WHERE l.userid=%s AND (UNIX_TIMESTAMP() - ".SURFBAR_GET_SURF_LOCK().") < UNIX_TIMESTAMP(l.last_surfed) AND (((UNIX_TIMESTAMP(l.last_surfed) - u.fixed_reload) < 0 AND u.fixed_reload > 0) OR u.fixed_reload = 0)
 LIMIT 1",
-               array(getUserId()), __FUNCTION__, __LINE__
+       array(getUserId()), __FUNCTION__, __LINE__
        );
 
        // Fetch row
@@ -871,7 +871,7 @@ function SURFBAR_GET_TOTAL_URLS ($status = 'ACTIVE', $excludeUserId = 0) {
        $result = SQL_QUERY_ESC("SELECT COUNT(id) AS cnt
 FROM `{!_MYSQL_PREFIX!}_surfbar_urls`
 WHERE userid NOT IN (".implode(',', $UIDs['uid']).") AND `status`='%s'",
-               array($status), __FUNCTION__, __LINE__
+       array($status), __FUNCTION__, __LINE__
        );
 
        // Fetch row
@@ -924,7 +924,7 @@ function SURFBAR_GET_TOTAL_USER_URLS ($uid=0, $status = '',$exclude = '') {
 FROM `{!_MYSQL_PREFIX!}_surfbar_urls`
 WHERE userid=%s".$add."
 LIMIT %s",
-               array($uid, getConfig('surfbar_max_order')), __FUNCTION__, __LINE__
+       array($uid, getConfig('surfbar_max_order')), __FUNCTION__, __LINE__
        );
 
        // Fetch row
@@ -998,11 +998,11 @@ function SURFBAR_LOCKDOWN_ID ($urlId) {
        ///* DEBUG: */ return;
        // Just add it to the database
        SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_surfbar_locks` (userid, url_id) VALUES (%s, %s)",
-               array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__);
+       array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__);
 
        // Remove the salt from database
        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM `{!_MYSQL_PREFIX!}_surfbar_salts` WHERE url_id=%s AND `userid`=%s LIMIT 1",
-               array(bigintval($urlId), getUserId()), __FUNCTION__, __LINE__);
+       array(bigintval($urlId), getUserId()), __FUNCTION__, __LINE__);
 }
 
 // Pay points to the user and remove it from the sender if userid is given else it is a "sponsored surf"
@@ -1034,17 +1034,17 @@ function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
 
        // Update URL stats
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET views_total=views_total+1".$add." WHERE `id`=%s LIMIT 1",
-               array(SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
+       array(SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
 
        // Update the stats entry
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_stats` SET count=count+1 WHERE userid=%s AND url_id=%s LIMIT 1",
-               array(getUserId(), SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
+       array(getUserId(), SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
 
        // Was that update okay?
        if (SQL_AFFECTEDROWS() < 1) {
                // No, then insert entry
                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_surfbar_stats` (userid,url_id,count) VALUES (%s,%s,1)",
-                       array(getUserId(), SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
+               array(getUserId(), SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
        } // END - if
 
        // Update total/daily/weekly/monthly counter
@@ -1064,7 +1064,7 @@ function SURFBAR_UPDATE_SALT_STATS () {
 
        // Simply store the salt from cache away in database...
        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_salts` SET last_salt='%s' WHERE url_id=%s AND `userid`=%s LIMIT 1",
-               array(SURFBAR_GET_SALT(), SURFBAR_GET_ID(), getUserId()), __FUNCTION__, __LINE__);
+       array(SURFBAR_GET_SALT(), SURFBAR_GET_ID(), getUserId()), __FUNCTION__, __LINE__);
 
        // Debug message
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "salt=".SURFBAR_GET_SALT().",id=".SURFBAR_GET_ID().",uid=".getUserId()."", false);
@@ -1073,7 +1073,7 @@ function SURFBAR_UPDATE_SALT_STATS () {
        if (SQL_AFFECTEDROWS() < 1) {
                // Insert missing entry!
                SQL_QUERY_ESC("INSERT INTO `{!_MYSQL_PREFIX!}_surfbar_salts` (url_id,userid,last_salt) VALUES (%s, %s, '%s')",
-                       array(SURFBAR_GET_ID(), getUserId(), SURFBAR_GET_SALT()), __FUNCTION__, __LINE__);
+               array(SURFBAR_GET_ID(), getUserId(), SURFBAR_GET_SALT()), __FUNCTION__, __LINE__);
        } // END - if
 
        // Debug message
@@ -1092,7 +1092,7 @@ FROM `{!_MYSQL_PREFIX!}_surfbar_locks`
 WHERE userid=%s AND url_id=%s AND (UNIX_TIMESTAMP() - ".SURFBAR_GET_SURF_LOCK().") < UNIX_TIMESTAMP(last_surfed)
 ORDER BY last_surfed ASC
 LIMIT 1",
-               array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__
+       array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__
        );
 
        // Fetch counter
@@ -1130,7 +1130,7 @@ ON u.userid=d.userid
 WHERE u.userid NOT IN (%s,0) AND u.`status`='ACTIVE'
 GROUP BY u.userid
 ORDER BY u.userid ASC",
-                       array(getUserId()), __FUNCTION__, __LINE__);
+               array(getUserId()), __FUNCTION__, __LINE__);
        } else {
                // Get all userid
                $result = SQL_QUERY("SELECT u.userid, UNIX_TIMESTAMP(d.surfbar_low_notified) AS notified
@@ -1175,7 +1175,7 @@ function SURFBAR_DETERMINE_TOTAL_ONLINE () {
 FROM `{!_MYSQL_PREFIX!}_surfbar_stats`
 WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(last_online)) <= %s
 GROUP BY userid",
-               array(getConfig('online_timeout')), __FUNCTION__, __LINE__);
+       array(getConfig('online_timeout')), __FUNCTION__, __LINE__);
 
        // Fetch count
        $cnt = SQL_NUMROWS($result);
@@ -1187,7 +1187,7 @@ GROUP BY userid",
        return $cnt;
 }
 
-// Determine waiting time for one URL 
+// Determine waiting time for one URL
 function SURFBAR_DETERMINE_WAIT_TIME () {
        // Get fixed reload lock
        $fixed = SURFBAR_GET_FIXED_RELOAD();
@@ -1362,7 +1362,7 @@ WHERE
        userid=%s
 ORDER BY
        id ASC", array(getUserId()),
-               __FUNCTION__, __LINE__);
+       __FUNCTION__, __LINE__);
 
        // Load all entries
        while ($content = SQL_FETCHARRAY($result)) {
@@ -1436,7 +1436,7 @@ function SURFBAR_GET_USER_URLS () {
 FROM `{!_MYSQL_PREFIX!}_surfbar_urls` AS u
 WHERE u.userid=%s AND u.status != 'DELETED'
 ORDER BY u.id ASC",
-               array(getUserId()), __FUNCTION__, __LINE__);
+       array(getUserId()), __FUNCTION__, __LINE__);
 
        // Are there entries?
        if (SQL_NUMROWS($result) > 0) {
@@ -1461,7 +1461,7 @@ function SURFBAR_getModeAction_ARRAY ($status) {
 
        // Get all assigned actions
        $result = SQL_QUERY_ESC("SELECT action FROM `{!_MYSQL_PREFIX!}_surfbar_actions` WHERE `status`='%s' ORDER BY `id` ASC",
-               array($status), __FUNCTION__, __LINE__);
+       array($status), __FUNCTION__, __LINE__);
 
        // Some entries there?
        if (SQL_NUMROWS($result) > 0) {
@@ -1541,7 +1541,7 @@ WHERE sbu.userid NOT IN (".implode(',', $UIDs['uid']).") AND sbu.`status`='ACTIV
 GROUP BY sbu.id
 ORDER BY l.last_surfed ASC, sbu.id ASC
 LIMIT %s,1",
-                       array($randNum), __FUNCTION__, __LINE__
+               array($randNum), __FUNCTION__, __LINE__
                );
        } else {
                // Get data from specified id number
@@ -1553,7 +1553,7 @@ LEFT JOIN `{!_MYSQL_PREFIX!}_surfbar_locks` AS l
 ON sbu.id=l.url_id
 WHERE sbu.userid != %s AND sbu.`status`='ACTIVE' AND sbu.id=%s AND (sbu.views_allowed=0 OR (sbu.views_allowed > 0 AND sbu.views_max > 0))
 LIMIT 1",
-                       array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__
+               array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__
                );
        }