+ // Begin the query
+ $result = SQL_QUERY_ESC("SELECT u.id, u.userid, u.url, u.views_total, u.status, UNIX_TIMESTAMP(u.registered) AS registered, UNIX_TIMESTAMP(u.last_locked) AS last_locked, u.lock_reason AS lock_reason
+FROM "._MYSQL_PREFIX."_surfbar_urls AS u
+WHERE u.userid=%s AND u.status != 'DELETED'
+ORDER BY u.id ASC",
+ array($GLOBALS['userid']), __FILE__, __LINE__);
+
+ // Are there entries?
+ if (SQL_NUMROWS($result) > 0) {
+ // Load all rows
+ while ($row = SQL_FETCHARRAY($result)) {
+ // Add the row
+ $URLs[$row['id']] = $row;
+ } // END - while
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+
+ // Return the array
+ return $URLs;
+}
+// "Getter" for member action array for given status
+function SURFBAR_GET_ACTION_ARRAY ($status) {
+ // Init array
+ $returnArray = array();
+
+ // Get all assigned actions
+ $result = SQL_QUERY_ESC("SELECT action FROM "._MYSQL_PREFIX."_surfbar_actions WHERE status='%s' ORDER BY id ASC",
+ array($status), __FILE__, __LINE__);
+
+ // Some entries there?
+ if (SQL_NUMROWS($result) > 0) {
+ // Load all actions
+ while (list($action) = SQL_FETCHROW($result)) {
+ $returnArray[] = $action;
+ } // END - if
+ } // END - if
+
+ // Free result
+ SQL_FREERESULT($result);
+
+ // Return result
+ return $returnArray;
+}
+// Reload to configured stop page
+function SURFBAR_RELOAD_TO_STOP_PAGE($page="stop") {
+ global $_CONFIG;
+
+ // Internal or external?
+ if (($_CONFIG['surfbar_pause_mode'] == "INTERNAL") || (empty($_CONFIG['surfbar_pause_url']))) {
+ // Reload to internal page
+ LOAD_URL("surfbar.php?frame=".$page);
+ } else {
+ // Reload to external page
+ LOAD_URL($_CONFIG['surfbar_pause_url']);
+ }
+}
+
+// Determine next id for surfbar or get data for given id, always call this before you call other
+// getters below this function!!!
+function SURFBAR_DETERMINE_NEXT_ID ($urlId = 0) {
+ global $SURFBAR_CACHE, $_CONFIG;
+
+ // Default is no id and no random number
+ $nextId = 0;
+ $randNum = 0;
+
+ // Is the ID set?
+ if ($urlId == 0) {
+ // Get array with lock ids
+ $USE = SURFBAR_GET_LOCK_IDS();
+
+ // Shall we add some URL ids to ignore?
+ $ADD = "";
+ if (count($USE) > 0) {
+ // Ignore some!
+ $ADD = " AND sbu.id NOT IN (";
+ foreach ($USE as $url_id => $lid) {
+ // Add URL id
+ $ADD .= $url_id.",";
+ } // END - foreach
+
+ // Add closing bracket
+ $ADD = substr($ADD, 0, -1) . ")";
+ } // END - if
+
+ // Determine depleted user account
+ $UIDs = SURFBAR_DETERMINE_DEPLETED_USERIDS();
+
+ // Get maximum randomness factor
+ $maxRand = SURFBAR_GET_MAX_RANDOM($UIDs['uid'], $ADD);