+ // Return result
+ return $UIDs;
+}
+// Determine how many users are Online in surfbar
+function SURFBAR_DETERMINE_TOTAL_ONLINE () {
+ global $_CONFIG;
+
+ // Count all users in surfbar modue and return the value
+ $result = SQL_QUERY_ESC("SELECT id
+FROM "._MYSQL_PREFIX."_surfbar_stats
+WHERE (UNIX_TIMESTAMP() - UNIX_TIMESTAMP(last_online)) <= %s
+GROUP BY userid",
+ array($_CONFIG['online_timeout']), __FILE__, __LINE__);
+
+ // Fetch count
+ $cnt = SQL_NUMROWS($result);
+
+ // Free result
+ SQL_FREERESULT($result);
+
+ // Return result
+ return $cnt;
+}
+// Determine waiting time for one URL
+function SURFBAR_DETERMINE_WAIT_TIME () {
+ global $_CONFIG;
+
+ // Init time
+ $time = 0;
+
+ // Which payment model do we have?
+ if ($_CONFIG['surfbar_pay_model'] == "STATIC") {
+ // Static model
+ $time = $_CONFIG['surfbar_static_time'];
+ } else {
+ // Dynamic
+ die("DYNAMIC payment model not yet finished!");
+ }
+
+ // Return value
+ return $time;
+}
+// Changes the status of an URL from given to other
+function SURFBAR_CHANGE_STATUS ($id, $prevStatus, $newStatus) {
+ // Get URL data for status comparison
+ $data = SURFBAR_GET_URL_DATA($id);
+
+ // Is the status like prevStatus is saying?
+ if ($data[$id]['status'] != $prevStatus) {
+ // No, then abort here
+ return false;
+ } // END - if
+
+ // Update the status now
+ SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_surfbar_urls SET status='%s' WHERE id=%s LIMIT 1",
+ array($newStatus, bigintval($id)), __FILE__, __LINE__);
+
+ // Was that fine?
+ if (SQL_AFFECTEDROWS() != 1) {
+ // No, something went wrong
+ return false;
+ } // END - if
+
+ // Prepare content for notification routines
+ $data[$id]['uid'] = $data[$id]['userid'];
+ $data[$id]['frametester'] = FRAMETESTER($data[$id]['url']);
+ $data[$id]['reward'] = TRANSLATE_COMMA($data[$id]['reward']);
+ $data[$id]['costs'] = TRANSLATE_COMMA($data[$id]['costs']);
+ $data[$id]['status'] = SURFBAR_TRANSLATE_STATUS($newStatus);
+ $data[$id]['registered'] = MAKE_DATETIME($data[$id]['registered'], "2");
+ $newStatus = strtolower($newStatus);
+
+ // Send admin notification
+ SURFBAR_NOTIFY_ADMIN("url_{$newStatus}", $data[$id]);
+
+ // Send user notification
+ SURFBAR_NOTIFY_USER("url_{$newStatus}", $data[$id]);
+
+ // All done!
+ return true;
+}
+// "Getter" for lock ids array
+function SURFBAR_GET_LOCK_IDS () {
+ // Prepare some arrays
+ $IDs = array();
+ $USE = array();
+ $ignored = array();
+
+ // Get all id from locks within the timestamp
+ $result = SQL_QUERY_ESC("SELECT id, url_id, UNIX_TIMESTAMP(last_surfed) AS last