]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/surfbar_functions.php
New naming convention applied to many functions, see #118 for details
[mailer.git] / inc / libs / surfbar_functions.php
index 131ab3b23ff406362b3c76f3c64eed0cb6e87c28..7c9f58af84b22c6dfbfbe5a8c8829127232a3856 100644 (file)
@@ -52,33 +52,34 @@ function SURFBAR_ADMIN_ADD_URL ($url, $limit, $reload) {
        if (!IS_ADMIN()) {
                // Not an admin
                return false;
        if (!IS_ADMIN()) {
                // Not an admin
                return false;
-       } elseif (!VALIDATE_URL($url)) {
+       } elseif (!isUrlValid($url)) {
                // URL invalid
                return false;
                // URL invalid
                return false;
-       } elseif (SURFBAR_LOOKUP_BY_URL($url, "0")) {
+       } elseif (SURFBAR_LOOKUP_BY_URL($url, '0')) {
                // URL already found in surfbar!
                return false;
        } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS()) {
                // No more allowed!
                return false;
                // URL already found in surfbar!
                return false;
        } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS()) {
                // No more allowed!
                return false;
-       } elseif ("".($limit + 0)."" != "".$limit."") {
+       } elseif (''.($limit + 0).'' != ''.$limit.'') {
                // Invalid amount entered
                return false;
                // Invalid amount entered
                return false;
-       } elseif ("".($reload + 0)."" != "".$reload."") {
+       } elseif (''.($reload + 0).'' != ''.$reload.'') {
                // Invalid amount entered
                return false;
        }
 
        // Register the new URL
                // Invalid amount entered
                return false;
        }
 
        // Register the new URL
-       return SURFBAR_REGISTER_URL($url, "0", "ACTIVE", "unlock", array('limit' => $limit, 'reload' => $reload));
+       return SURFBAR_REGISTER_URL($url, '0', 'ACTIVE', 'unlock', array('limit' => $limit, 'reload' => $reload));
 }
 }
+
 // Admin unlocked an email so we can migrate the URL
 function SURFBAR_ADMIN_MIGRATE_URL ($url, $uid) {
        // Do some pre-checks
        if (!IS_ADMIN()) {
                // Not an admin
                return false;
 // Admin unlocked an email so we can migrate the URL
 function SURFBAR_ADMIN_MIGRATE_URL ($url, $uid) {
        // Do some pre-checks
        if (!IS_ADMIN()) {
                // Not an admin
                return false;
-       } elseif (!VALIDATE_URL($url)) {
+       } elseif (!isUrlValid($url)) {
                // URL invalid
                return false;
        } elseif (SURFBAR_LOOKUP_BY_URL($url, $uid)) {
                // URL invalid
                return false;
        } elseif (SURFBAR_LOOKUP_BY_URL($url, $uid)) {
@@ -90,8 +91,9 @@ function SURFBAR_ADMIN_MIGRATE_URL ($url, $uid) {
        }
 
        // Register the new URL
        }
 
        // Register the new URL
-       return SURFBAR_REGISTER_URL($url, $uid, "MIGRATED", "migrate");
+       return SURFBAR_REGISTER_URL($url, $uid, 'MIGRATED', 'migrate');
 }
 }
+
 // Admin function for unlocking URLs
 function SURFBAR_ADMIN_UNLOCK_URL_IDS ($IDs) {
        // Is this an admin or invalid array?
 // Admin function for unlocking URLs
 function SURFBAR_ADMIN_UNLOCK_URL_IDS ($IDs) {
        // Is this an admin or invalid array?
@@ -112,12 +114,13 @@ function SURFBAR_ADMIN_UNLOCK_URL_IDS ($IDs) {
        // Update the status for all ids
        foreach ($IDs as $id => $dummy) {
                // Test all ids through (ignores failed)
        // Update the status for all ids
        foreach ($IDs as $id => $dummy) {
                // Test all ids through (ignores failed)
-               $done = (($done) && (SURFBAR_CHANGE_STATUS($id, "PENDING", "ACTIVE")));
+               $done = (($done) && (SURFBAR_CHANGE_STATUS($id, 'PENDING', 'ACTIVE')));
        } // END - if
 
        // Return total status
        return $done;
 }
        } // END - if
 
        // Return total status
        return $done;
 }
+
 // Admin function for rejecting URLs
 function SURFBAR_ADMIN_REJECT_URL_IDS ($IDs) {
        // Is this an admin or invalid array?
 // Admin function for rejecting URLs
 function SURFBAR_ADMIN_REJECT_URL_IDS ($IDs) {
        // Is this an admin or invalid array?
@@ -138,12 +141,13 @@ function SURFBAR_ADMIN_REJECT_URL_IDS ($IDs) {
        // Update the status for all ids
        foreach ($IDs as $id => $dummy) {
                // Test all ids through (ignores failed)
        // Update the status for all ids
        foreach ($IDs as $id => $dummy) {
                // Test all ids through (ignores failed)
-               $done = (($done) && (SURFBAR_CHANGE_STATUS($id, "PENDING", "REJECTED")));
+               $done = (($done) && (SURFBAR_CHANGE_STATUS($id, 'PENDING', 'REJECTED')));
        } // END - if
 
        // Return total status
        return $done;
 }
        } // END - if
 
        // Return total status
        return $done;
 }
+
 //
 // -----------------------------------------------------------------------------
 //                               Member functions
 //
 // -----------------------------------------------------------------------------
 //                               Member functions
@@ -155,7 +159,7 @@ function SURFBAR_MEMBER_ADD_URL ($url, $limit) {
        if (!IS_MEMBER()) {
                // Not a member
                return false;
        if (!IS_MEMBER()) {
                // Not a member
                return false;
-       } elseif (!VALIDATE_URL($url)) {
+       } elseif (!isUrlValid($url)) {
                // URL invalid
                return false;
        } elseif (SURFBAR_LOOKUP_BY_URL($url, getUserId())) {
                // URL invalid
                return false;
        } elseif (SURFBAR_LOOKUP_BY_URL($url, getUserId())) {
@@ -164,18 +168,19 @@ function SURFBAR_MEMBER_ADD_URL ($url, $limit) {
        } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS(getUserId())) {
                // No more allowed!
                return false;
        } elseif (!SURFBAR_IF_USER_BOOK_MORE_URLS(getUserId())) {
                // No more allowed!
                return false;
-       } elseif ("".($limit + 0)."" != "".$limit."") {
+       } elseif (''.($limit + 0).'' != ''.$limit.'') {
                // Invalid amount entered
                return false;
        }
 
        // Register the new URL
                // Invalid amount entered
                return false;
        }
 
        // Register the new URL
-       return SURFBAR_REGISTER_URL($url, getUserId(), "PENDING", "reg", array('limit' => $limit));
+       return SURFBAR_REGISTER_URL($url, getUserId(), 'PENDING', 'reg', array('limit' => $limit));
 }
 }
+
 // Create list of actions depending on status for the user
 function SURFBAR_MEMBER_ACTIONS ($urlId, $status) {
        // Load all actions in an array for given status
 // Create list of actions depending on status for the user
 function SURFBAR_MEMBER_ACTIONS ($urlId, $status) {
        // Load all actions in an array for given status
-       $actionArray = SURFBAR_GET_ACTION_ARRAY($status);
+       $actionArray = SURFBAR_getModeAction_ARRAY($status);
 
        // Init HTML code
        $OUT = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\">
 
        // Init HTML code
        $OUT = "<table border=\"0\" cellspacing=\"0\" cellpadding=\"1\" width=\"100%\">
@@ -185,9 +190,9 @@ function SURFBAR_MEMBER_ACTIONS ($urlId, $status) {
        $width = round(100 / count($actionArray));
 
        // "Walk" through all actions and create forms
        $width = round(100 / count($actionArray));
 
        // "Walk" through all actions and create forms
-       foreach ($actionArray as $actionId=>$action) {
+       foreach ($actionArray as $actionId => $action) {
                // Add form for this action
                // Add form for this action
-               $OUT .= sprintf(LOAD_TEMPLATE("member_surfbar_list_form", true),
+               $OUT .= sprintf(LOAD_TEMPLATE('member_surfbar_list_form', true),
                        $width,
                        bigintval($urlId),
                        strtolower($action),
                        $width,
                        bigintval($urlId),
                        strtolower($action),
@@ -203,6 +208,7 @@ function SURFBAR_MEMBER_ACTIONS ($urlId, $status) {
        // Return code
        return $OUT;
 }
        // Return code
        return $OUT;
 }
+
 // Do the member form request
 function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) {
        // By default no action is performed
 // Do the member form request
 function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) {
        // By default no action is performed
@@ -254,6 +260,7 @@ function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) {
        // Return status
        return $performed;
 }
        // Return status
        return $performed;
 }
+
 // Validate if the requested action can be performed on current URL status
 function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) {
        // Search for the requested action/status combination in database
 // Validate if the requested action can be performed on current URL status
 function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) {
        // Search for the requested action/status combination in database
@@ -275,6 +282,7 @@ function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) {
        // Return status
        return $isValid;
 }
        // Return status
        return $isValid;
 }
+
 //
 // -----------------------------------------------------------------------------
 //                               Member actions
 //
 // -----------------------------------------------------------------------------
 //                               Member actions
@@ -290,6 +298,7 @@ function SURFBAR_MEMBER_RETREAT_ACTION ($urlData) {
        // Simply change the status here
        return SURFBAR_CHANGE_STATUS ($urlData['id'], $urlData['status'], $urlData['new_status'], $data);
 }
        // Simply change the status here
        return SURFBAR_CHANGE_STATUS ($urlData['id'], $urlData['status'], $urlData['new_status'], $data);
 }
+
 // Book an URL now (from migration)
 function SURFBAR_MEMBER_BOOKNOW_ACTION ($urlData) {
        // Create the data array for next function call
 // Book an URL now (from migration)
 function SURFBAR_MEMBER_BOOKNOW_ACTION ($urlData) {
        // Create the data array for next function call
@@ -300,32 +309,36 @@ function SURFBAR_MEMBER_BOOKNOW_ACTION ($urlData) {
        // Simply change the status here
        return SURFBAR_CHANGE_STATUS ($urlData['id'], $urlData['status'], $urlData['new_status'], $data);
 }
        // Simply change the status here
        return SURFBAR_CHANGE_STATUS ($urlData['id'], $urlData['status'], $urlData['new_status'], $data);
 }
+
 // Show edit form or do the changes
 function SURFBAR_MEMBER_EDIT_ACTION ($urlData) {
        // Is the "execute" flag there?
        if (isset($urlData['edit']['execute'])) {
                // Execute the changes
 // Show edit form or do the changes
 function SURFBAR_MEMBER_EDIT_ACTION ($urlData) {
        // Is the "execute" flag there?
        if (isset($urlData['edit']['execute'])) {
                // Execute the changes
-               return SURFBAR_MEMBER_EXECUTE_ACTION("edit", $urlData);
+               return SURFBAR_MEMBER_EXECUTE_ACTION('edit', $urlData);
        } // END - if
 
        // Display form
        } // END - if
 
        // Display form
-       return SURFBAR_MEMBER_DISPLAY_ACTION_FORM("edit", $urlData);
+       return SURFBAR_MEMBER_DISPLAY_ACTION_FORM('edit', $urlData);
 }
 }
+
 // Show delete form or do the changes
 function SURFBAR_MEMBER_DELETE_ACTION ($urlData) {
        // Is the "execute" flag there?
        if (isset($urlData['delete']['execute'])) {
                // Execute the changes
 // Show delete form or do the changes
 function SURFBAR_MEMBER_DELETE_ACTION ($urlData) {
        // Is the "execute" flag there?
        if (isset($urlData['delete']['execute'])) {
                // Execute the changes
-               return SURFBAR_MEMBER_EXECUTE_ACTION("delete", $urlData);
+               return SURFBAR_MEMBER_EXECUTE_ACTION('delete', $urlData);
        } // END - if
 
        // Display form
        } // END - if
 
        // Display form
-       return SURFBAR_MEMBER_DISPLAY_ACTION_FORM("delete", $urlData);
+       return SURFBAR_MEMBER_DISPLAY_ACTION_FORM('delete', $urlData);
 }
 }
+
 // Pause active banner
 function SURFBAR_MEMBER_PAUSE_ACTION ($urlData) {
        return SURFBAR_CHANGE_STATUS($urlData['id'], $urlData['status'], $urlData['new_status'], array($urlData['id'] => $urlData));
 }
 // Pause active banner
 function SURFBAR_MEMBER_PAUSE_ACTION ($urlData) {
        return SURFBAR_CHANGE_STATUS($urlData['id'], $urlData['status'], $urlData['new_status'], array($urlData['id'] => $urlData));
 }
+
 // Unpause stopped banner
 function SURFBAR_MEMBER_UNPAUSE_ACTION ($urlData) {
        // Fix missing entry for template
 // Unpause stopped banner
 function SURFBAR_MEMBER_UNPAUSE_ACTION ($urlData) {
        // Fix missing entry for template
@@ -336,18 +349,20 @@ function SURFBAR_MEMBER_UNPAUSE_ACTION ($urlData) {
        // Return status change
        return SURFBAR_CHANGE_STATUS($urlData['id'], $urlData['status'], $urlData['new_status'], array($urlData['id'] => $urlData));
 }
        // Return status change
        return SURFBAR_CHANGE_STATUS($urlData['id'], $urlData['status'], $urlData['new_status'], array($urlData['id'] => $urlData));
 }
+
 // Resubmit locked URL
 function SURFBAR_MEMBER_RESUBMIT_ACTION ($urlData) {
        return SURFBAR_CHANGE_STATUS($urlData['id'], $urlData['status'], $urlData['new_status'], array($urlData['id'] => $urlData));
 }
 // Resubmit locked URL
 function SURFBAR_MEMBER_RESUBMIT_ACTION ($urlData) {
        return SURFBAR_CHANGE_STATUS($urlData['id'], $urlData['status'], $urlData['new_status'], array($urlData['id'] => $urlData));
 }
+
 // Display selected "action form"
 function SURFBAR_MEMBER_DISPLAY_ACTION_FORM ($action, $urlData) {
        // Translate some data
 // Display selected "action form"
 function SURFBAR_MEMBER_DISPLAY_ACTION_FORM ($action, $urlData) {
        // Translate some data
-       $urlData['registered']    = MAKE_DATETIME($urlData['registered'], "2");
-       $urlData['views_total']   = TRANSLATE_COMMA($urlData['views_total']);
-       $urlData['views_max']     = TRANSLATE_COMMA($urlData['views_max']);
-       $urlData['views_allowed'] = TRANSLATE_COMMA($urlData['views_allowed']);
-       $urlData['last_locked']   = MAKE_DATETIME($urlData['last_locked'], "2");
+       $urlData['registered']    = generateDateTime($urlData['registered'], '2');
+       $urlData['views_total']   = translateComma($urlData['views_total']);
+       $urlData['views_max']     = translateComma($urlData['views_max']);
+       $urlData['views_allowed'] = translateComma($urlData['views_allowed']);
+       $urlData['last_locked']   = generateDateTime($urlData['last_locked'], '2');
 
        // Is the lock reason empty?
        if (empty($urlData['lock_reason'])) {
 
        // Is the lock reason empty?
        if (empty($urlData['lock_reason'])) {
@@ -356,18 +371,18 @@ function SURFBAR_MEMBER_DISPLAY_ACTION_FORM ($action, $urlData) {
        } // END - if
 
        // Include fields only for action 'edit'
        } // END - if
 
        // Include fields only for action 'edit'
-       if ($action == "edit") {
+       if ($action == 'edit') {
                // Default is not limited
                $urlData['limited_yes'] = '';
                $urlData['limited_no']  = ' chkecked="checked"';
                // Default is not limited
                $urlData['limited_yes'] = '';
                $urlData['limited_no']  = ' chkecked="checked"';
-               $urlData['limited']     = "false";
+               $urlData['limited']     = 'false';
 
                // Is this URL limited?
                if ($urlData['views_max'] > 0) {
                        // Then rewrite form data
                        $urlData['limited_yes'] = ' chkecked="checked"';
                        $urlData['limited_no']  = '';
 
                // Is this URL limited?
                if ($urlData['views_max'] > 0) {
                        // Then rewrite form data
                        $urlData['limited_yes'] = ' chkecked="checked"';
                        $urlData['limited_no']  = '';
-                       $urlData['limited']     = "true";
+                       $urlData['limited']     = 'true';
                } // END - if
        } // END - if
 
                } // END - if
        } // END - if
 
@@ -377,6 +392,7 @@ function SURFBAR_MEMBER_DISPLAY_ACTION_FORM ($action, $urlData) {
        // All fine by default ... ;-)
        return true;
 }
        // All fine by default ... ;-)
        return true;
 }
+
 // Execute choosen action
 function SURFBAR_MEMBER_EXECUTE_ACTION ($action, $urlData) {
        // By default nothing is executed
 // Execute choosen action
 function SURFBAR_MEMBER_EXECUTE_ACTION ($action, $urlData) {
        // By default nothing is executed
@@ -425,7 +441,7 @@ function SURFBAR_MEMBER_EXECUTE_EDIT_ACTION ($urlData) {
        if (true) {
        //if (($urlData['views_allowed'] != $urlData['edit']['limit']) || ($url1 != $url2)) {
                // Run the query
        if (true) {
        //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",
+               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__);
 
                // All fine
                        array($urlData['url'], $urlData['edit']['limit'], $urlData['edit']['limit'], $urlData['id'], $urlData['status']), __FUNCTION__, __LINE__);
 
                // All fine
@@ -456,7 +472,7 @@ function SURFBAR_HANDLE_SELF_MAINTENANCE () {
 // Handle URLs which limit has depleted
 function SURFBAR_HANDLE_DEPLETED_VIEWS () {
        // Get all URLs
 // Handle URLs which limit has depleted
 function SURFBAR_HANDLE_DEPLETED_VIEWS () {
        // Get all URLs
-       $urlArray = SURFBAR_GET_URL_DATA("0", "views_max", "id", "ASC", "id", " AND views_allowed>0 AND `status`='ACTIVE'");
+       $urlArray = SURFBAR_GET_URL_DATA('0', 'views_max', 'id', 'ASC', 'id', " AND views_allowed>0 AND `status`='ACTIVE'");
 
        // Do we have some entries?
        if (count($urlArray) > 0) {
 
        // Do we have some entries?
        if (count($urlArray) > 0) {
@@ -469,7 +485,7 @@ function SURFBAR_HANDLE_DEPLETED_VIEWS () {
                        $urlData[$id] = $data;
 
                        // Handle the status
                        $urlData[$id] = $data;
 
                        // Handle the status
-                       SURFBAR_CHANGE_STATUS($id, "ACTIVE", "DEPLETED", $urlData);
+                       SURFBAR_CHANGE_STATUS($id, 'ACTIVE', 'DEPLETED', $urlData);
                } // END - foreach
        } // END - if
 }
                } // END - foreach
        } // END - if
 }
@@ -486,14 +502,14 @@ function SURFBAR_HANDLE_LOW_POINTS () {
                        // Prepare content
                        $content = array(
                                'uid'      => $uid,
                        // Prepare content
                        $content = array(
                                'uid'      => $uid,
-                               'low'      => TRANSLATE_COMMA(getConfig('surfbar_warn_low_points')),
-                               'points'   => TRANSLATE_COMMA($UIDs['points'][$uid]),
-                               'notified' => MAKE_DATETIME($UIDs['notified'][$uid]),
-                               'interval' => CREATE_FANCY_TIME(getConfig('surfbar_low_interval'))
+                               'low'      => translateComma(getConfig('surfbar_warn_low_points')),
+                               'points'   => translateComma($UIDs['points'][$uid]),
+                               'notified' => generateDateTime($UIDs['notified'][$uid]),
+                               'interval' => createFancyTime(getConfig('surfbar_low_interval'))
                        );
 
                        // Notify this user
                        );
 
                        // Notify this user
-                       SURFBAR_NOTIFY_USER("low_points", $content);
+                       SURFBAR_NOTIFY_USER('low_points', $content);
 
                        // Update last notified
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET surfbar_low_notified=NOW() WHERE userid=%s LIMIT 1",
 
                        // Update last notified
                        SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_user_data` SET surfbar_low_notified=NOW() WHERE userid=%s LIMIT 1",
@@ -511,14 +527,14 @@ function SURFBAR_HANDLE_LOW_POINTS () {
 // Looks up by an URL
 function SURFBAR_LOOKUP_BY_URL ($url, $uid) {
        // Now lookup that given URL by itself
 // Looks up by an URL
 function SURFBAR_LOOKUP_BY_URL ($url, $uid) {
        // Now lookup that given URL by itself
-       $urlArray = SURFBAR_GET_URL_DATA($url, "url", "id", "ASC", "id", sprintf(" AND userid=%s", bigintval($uid)));
+       $urlArray = SURFBAR_GET_URL_DATA($url, 'url', 'id', 'ASC', 'id', sprintf(" AND `userid`=%s", bigintval($uid)));
 
        // Was it found?
        return (count($urlArray) > 0);
 }
 
 // Load URL data by given search term and column
 
        // Was it found?
        return (count($urlArray) > 0);
 }
 
 // Load URL data by given search term and column
-function SURFBAR_GET_URL_DATA ($searchTerm, $column="id", $order="id", $sort="ASC", $group="id", $add="") {
+function SURFBAR_GET_URL_DATA ($searchTerm, $column="id", $order="id", $sort="ASC", $group="id", $add = '') {
        // By default nothing is found
        $GLOBALS['last_url_data'] = array();
 
        // By default nothing is found
        $GLOBALS['last_url_data'] = array();
 
@@ -591,7 +607,7 @@ function SURFBAR_REGISTER_URL ($url, $uid, $status="PENDING", $addMode="reg", $e
        } // END - if
 
        // Translate status and limit
        } // END - if
 
        // Translate status and limit
-       $content['limit'] = SURFBAR_TRANSLATE_LIMIT($content['limit']);
+       $content['limit'] = surfbarTranslateLimit($content['limit']);
 
        // If in reg-mode we notify admin
        if (($addMode == "reg") || (getConfig('surfbar_notify_admin_unlock') == 'Y')) {
 
        // If in reg-mode we notify admin
        if (($addMode == "reg") || (getConfig('surfbar_notify_admin_unlock') == 'Y')) {
@@ -641,21 +657,21 @@ function SURFBAR_NOTIFY_ADMIN ($messageType, $content) {
        ));
 
        // Is the subject line there?
        ));
 
        // Is the subject line there?
-       if ((substr($subject, 0, 1) == "!") && (substr($subject, -1, 1) == "!")) {
+       if ((substr($subject, 0, 1) == '!') && (substr($subject, -1, 1) == '!')) {
                // Set default subject if following eval() wents wrong
                $subject = getMessage('ADMIN_SURFBAR_NOTIFY_DEFAULT_SUBJECT');
        } // END - if
 
        // Translate some data if present
                // Set default subject if following eval() wents wrong
                $subject = getMessage('ADMIN_SURFBAR_NOTIFY_DEFAULT_SUBJECT');
        } // END - if
 
        // Translate some data if present
-       if (isset($content['status']))        $content['status']        = SURFBAR_TRANSLATE_STATUS($content['status']);
-       if (isset($content['registered']))    $content['registered']    = MAKE_DATETIME($content['registered'], "2");
-       if (isset($content['last_locked']))   $content['last_locked']   = MAKE_DATETIME($content['last_locked'], "2");
-       if (isset($content['views_total']))   $content['views_total']   = TRANSLATE_COMMA($content['views_total']);
-       if (isset($content['views_allowed'])) $content['views_allowed'] = TRANSLATE_COMMA($content['views_allowed']);
-       if (isset($content['views_max']))     $content['views_max']     = TRANSLATE_COMMA($content['views_max']);
+       if (isset($content['status']))        $content['status']        = surfbarTranslateUserStatus($content['status']);
+       if (isset($content['registered']))    $content['registered']    = generateDateTime($content['registered'], "2");
+       if (isset($content['last_locked']))   $content['last_locked']   = generateDateTime($content['last_locked'], "2");
+       if (isset($content['views_total']))   $content['views_total']   = translateComma($content['views_total']);
+       if (isset($content['views_allowed'])) $content['views_allowed'] = translateComma($content['views_allowed']);
+       if (isset($content['views_max']))     $content['views_max']     = translateComma($content['views_max']);
 
        // Send the notification out
 
        // Send the notification out
-       return SEND_ADMIN_NOTIFICATION($subject, $templateName, $content, $content['uid']);
+       return sendAdminNotification($subject, $templateName, $content, $content['uid']);
 }
 
 // Notify the user about the performed action
 }
 
 // Notify the user about the performed action
@@ -674,46 +690,48 @@ function SURFBAR_NOTIFY_USER ($messageType, $content) {
        ));
 
        // Is the subject line there?
        ));
 
        // Is the subject line there?
-       if ((substr($subject, 0, 1) == "!") && (substr($subject, -1, 1) == "!")) {
+       if ((substr($subject, 0, 1) == '!') && (substr($subject, -1, 1) == '!')) {
                // Set default subject if following eval() wents wrong
                $subject = getMessage('MEMBER_SURFBAR_NOTIFY_DEFAULT_SUBJECT');
        } // END - if
 
        // Translate some data if present
                // Set default subject if following eval() wents wrong
                $subject = getMessage('MEMBER_SURFBAR_NOTIFY_DEFAULT_SUBJECT');
        } // END - if
 
        // Translate some data if present
-       if (isset($content['status']))        $content['status']        = SURFBAR_TRANSLATE_STATUS($content['status']);
-       if (isset($content['registered']))    $content['registered']    = MAKE_DATETIME($content['registered'], "2");
-       if (isset($content['last_locked']))   $content['last_locked']   = MAKE_DATETIME($content['last_locked'], "2");
-       if (isset($content['views_total']))   $content['views_total']   = TRANSLATE_COMMA($content['views_total']);
-       if (isset($content['views_allowed'])) $content['views_allowed'] = TRANSLATE_COMMA($content['views_allowed']);
-       if (isset($content['views_max']))     $content['views_max']     = TRANSLATE_COMMA($content['views_max']);
+       if (isset($content['status']))        $content['status']        = surfbarTranslateUserStatus($content['status']);
+       if (isset($content['registered']))    $content['registered']    = generateDateTime($content['registered'], "2");
+       if (isset($content['last_locked']))   $content['last_locked']   = generateDateTime($content['last_locked'], "2");
+       if (isset($content['views_total']))   $content['views_total']   = translateComma($content['views_total']);
+       if (isset($content['views_allowed'])) $content['views_allowed'] = translateComma($content['views_allowed']);
+       if (isset($content['views_max']))     $content['views_max']     = translateComma($content['views_max']);
 
        // Load template
        $mailText = LOAD_EMAIL_TEMPLATE($templateName, $content, $content['uid']);
 
        // Send the email
 
        // Load template
        $mailText = LOAD_EMAIL_TEMPLATE($templateName, $content, $content['uid']);
 
        // Send the email
-       return SEND_EMAIL($content['uid'], $subject, $mailText);
+       return sendEmail($content['uid'], $subject, $mailText);
 }
 }
+
 // Translates the limit
 // Translates the limit
-function SURFBAR_TRANSLATE_LIMIT ($limit) {
+function surfbarTranslateLimit ($limit) {
        // Is this zero?
        if ($limit == 0) {
                // Unlimited!
        // Is this zero?
        if ($limit == 0) {
                // Unlimited!
-               $return = MEMBER_SURFBAR_UNLIMITED_VIEWS;
+               $return = getMessage('MEMBER_SURFBAR_UNLIMITED_VIEWS');
        } else {
                // Translate comma
        } else {
                // Translate comma
-               $return = TRANSLATE_COMMA($limit);
+               $return = translateComma($limit);
        }
 
        // Return value
        return $return;
 }
        }
 
        // Return value
        return $return;
 }
+
 // Translate the URL status
 // Translate the URL status
-function SURFBAR_TRANSLATE_STATUS ($status) {
+function surfbarTranslateUserStatus ($status) {
        // Create constant name
        $constantName = sprintf("SURFBAR_URL_STATUS_%s", strtoupper($status));
 
        // Set default translated status
        // Create constant name
        $constantName = sprintf("SURFBAR_URL_STATUS_%s", strtoupper($status));
 
        // Set default translated status
-       $statusTranslated = "!".$constantName."!";
+       $statusTranslated = '!'.$constantName.'!';
 
        // Is the constant there?
        if (defined($constantName)) {
 
        // Is the constant there?
        if (defined($constantName)) {
@@ -724,13 +742,14 @@ function SURFBAR_TRANSLATE_STATUS ($status) {
        // Return result
        return $statusTranslated;
 }
        // Return result
        return $statusTranslated;
 }
+
 // Determine reward
 function SURFBAR_DETERMINE_REWARD ($onlyMin=false) {
        // Static values are default
        $reward = getConfig('surfbar_static_reward');
 
        // Do we have static or dynamic?
 // Determine reward
 function SURFBAR_DETERMINE_REWARD ($onlyMin=false) {
        // Static values are default
        $reward = getConfig('surfbar_static_reward');
 
        // Do we have static or dynamic?
-       if (getConfig('surfbar_pay_model') == "DYNAMIC") {
+       if (getConfig('surfbar_pay_model') == 'DYNAMIC') {
                // "Calculate" dynamic reward
                if ($onlyMin) {
                        $reward += SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE();
                // "Calculate" dynamic reward
                if ($onlyMin) {
                        $reward += SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE();
@@ -742,13 +761,14 @@ function SURFBAR_DETERMINE_REWARD ($onlyMin=false) {
        // Return reward
        return $reward;
 }
        // Return reward
        return $reward;
 }
+
 // Determine costs
 function SURFBAR_DETERMINE_COSTS ($onlyMin=false) {
        // Static costs is default
        $costs  = getConfig('surfbar_static_costs');
 
        // Do we have static or dynamic?
 // Determine costs
 function SURFBAR_DETERMINE_COSTS ($onlyMin=false) {
        // Static costs is default
        $costs  = getConfig('surfbar_static_costs');
 
        // Do we have static or dynamic?
-       if (getConfig('surfbar_pay_model') == "DYNAMIC") {
+       if (getConfig('surfbar_pay_model') == 'DYNAMIC') {
                // "Calculate" dynamic costs
                if ($onlyMin) {
                        $costs += SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE();
                // "Calculate" dynamic costs
                if ($onlyMin) {
                        $costs += SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE();
@@ -760,6 +780,7 @@ function SURFBAR_DETERMINE_COSTS ($onlyMin=false) {
        // Return costs
        return $costs;
 }
        // Return costs
        return $costs;
 }
+
 // "Calculate" dynamic add
 function SURFBAR_CALCULATE_DYNAMIC_ADD () {
        // Get min/max values
 // "Calculate" dynamic add
 function SURFBAR_CALCULATE_DYNAMIC_ADD () {
        // Get min/max values
@@ -769,6 +790,7 @@ function SURFBAR_CALCULATE_DYNAMIC_ADD () {
        // "Calculate" dynamic part and return it
        return mt_rand($min, $max);
 }
        // "Calculate" dynamic part and return it
        return mt_rand($min, $max);
 }
+
 // Determine right template name
 function SURFBAR_DETERMINE_TEMPLATE_NAME() {
        // Default is the frameset
 // Determine right template name
 function SURFBAR_DETERMINE_TEMPLATE_NAME() {
        // Default is the frameset
@@ -785,6 +807,7 @@ function SURFBAR_DETERMINE_TEMPLATE_NAME() {
        // Return result
        return $templateName;
 }
        // Return result
        return $templateName;
 }
+
 // Check if the "reload lock" of the current user is full, call this function
 // before you call SURFBAR_CHECK_RELOAD_LOCK().
 function SURFBAR_CHECK_RELOAD_FULL() {
 // Check if the "reload lock" of the current user is full, call this function
 // before you call SURFBAR_CHECK_RELOAD_LOCK().
 function SURFBAR_CHECK_RELOAD_FULL() {
@@ -796,7 +819,7 @@ function SURFBAR_CHECK_RELOAD_FULL() {
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Fixed surf lock is ".getConfig('surfbar_static_lock')."", false);
 
        // Do we have dynamic model?
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "Fixed surf lock is ".getConfig('surfbar_static_lock')."", false);
 
        // Do we have dynamic model?
-       if (getConfig('surfbar_pay_model') == "DYNAMIC") {
+       if (getConfig('surfbar_pay_model') == 'DYNAMIC') {
                // "Calculate" dynamic lock
                $GLOBALS['cache_array']['surfbar']['surf_lock'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
        } // END - if
                // "Calculate" dynamic lock
                $GLOBALS['cache_array']['surfbar']['surf_lock'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
        } // END - if
@@ -832,8 +855,9 @@ LIMIT 1",
        // Return result
        return $isFull;
 }
        // Return result
        return $isFull;
 }
+
 // Get total amount of URLs of given status for current user or of ACTIVE URLs by default
 // Get total amount of URLs of given status for current user or of ACTIVE URLs by default
-function SURFBAR_GET_TOTAL_URLS ($status="ACTIVE", $excludeUserId=0) {
+function SURFBAR_GET_TOTAL_URLS ($status = 'ACTIVE', $excludeUserId = 0) {
        // Determine depleted user account
        $UIDs = SURFBAR_DETERMINE_DEPLETED_USERIDS();
 
        // Determine depleted user account
        $UIDs = SURFBAR_DETERMINE_DEPLETED_USERIDS();
 
@@ -859,13 +883,15 @@ WHERE userid NOT IN (".implode(",", $UIDs['uid']).") AND `status`='%s'",
        // Return result
        return $cnt;
 }
        // Return result
        return $cnt;
 }
+
 // Check wether the user is allowed to book more URLs
 function SURFBAR_IF_USER_BOOK_MORE_URLS ($uid=0) {
        // Is this admin and userid is zero or does the user has some URLs left to book?
        return ((($uid == 0) && (IS_ADMIN())) || (SURFBAR_GET_TOTAL_USER_URLS($uid, '', array("REJECTED")) < getConfig('surfbar_max_order')));
 }
 // Check wether the user is allowed to book more URLs
 function SURFBAR_IF_USER_BOOK_MORE_URLS ($uid=0) {
        // Is this admin and userid is zero or does the user has some URLs left to book?
        return ((($uid == 0) && (IS_ADMIN())) || (SURFBAR_GET_TOTAL_USER_URLS($uid, '', array("REJECTED")) < getConfig('surfbar_max_order')));
 }
+
 // Get total amount of URLs of given status for current user
 // Get total amount of URLs of given status for current user
-function SURFBAR_GET_TOTAL_USER_URLS ($uid=0, $status="",$exclude="") {
+function SURFBAR_GET_TOTAL_USER_URLS ($uid=0, $status = '',$exclude = '') {
        // Is the user 0 and user is logged in?
        if (($uid == 0) && (IS_MEMBER())) {
                // Then use this userid
        // Is the user 0 and user is logged in?
        if (($uid == 0) && (IS_MEMBER())) {
                // Then use this userid
@@ -910,8 +936,9 @@ LIMIT %s",
        // Return result
        return $cnt;
 }
        // Return result
        return $cnt;
 }
+
 // Generate a validation code for the given id number
 // Generate a validation code for the given id number
-function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") {
+function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt = '') {
        // @TODO Invalid salt should be refused
        $GLOBALS['cache_array']['surfbar']['salt'] = "INVALID";
 
        // @TODO Invalid salt should be refused
        $GLOBALS['cache_array']['surfbar']['salt'] = "INVALID";
 
@@ -927,7 +954,7 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") {
                // Is the salt set?
                if (empty($salt)) {
                        // Generate random hashed string
                // Is the salt set?
                if (empty($salt)) {
                        // Generate random hashed string
-                       $GLOBALS['cache_array']['surfbar']['salt'] = sha1(GEN_PASS(255));
+                       $GLOBALS['cache_array']['surfbar']['salt'] = sha1(generatePassword(255));
                        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "newSalt=".SURFBAR_GET_SALT()."", false);
                } else {
                        // Use this as salt!
                        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "newSalt=".SURFBAR_GET_SALT()."", false);
                } else {
                        // Use this as salt!
@@ -936,7 +963,7 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") {
                }
 
                // ... and now the validation code
                }
 
                // ... and now the validation code
-               $valCode = generateRandomCodde($length, sha1(SURFBAR_GET_SALT().":".$urlId), getUserId());
+               $valCode = generateRandomCodde($length, sha1(SURFBAR_GET_SALT().':'.$urlId), getUserId());
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "valCode={$valCode}", false);
        } // END - while
 
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "valCode={$valCode}", false);
        } // END - while
 
@@ -950,6 +977,7 @@ function SURFBAR_GENERATE_VALIDATION_CODE ($urlId, $salt="") {
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "finalValCode={$valHashedCode}", false);
        return $valHashedCode;
 }
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "finalValCode={$valHashedCode}", false);
        return $valHashedCode;
 }
+
 // Check validation code
 function SURFBAR_CHECK_VALIDATION_CODE ($urlId, $check, $salt) {
        // Secure id number
 // Check validation code
 function SURFBAR_CHECK_VALIDATION_CODE ($urlId, $check, $salt) {
        // Secure id number
@@ -963,6 +991,7 @@ function SURFBAR_CHECK_VALIDATION_CODE ($urlId, $check, $salt) {
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "+++".$salt."|".SURFBAR_GET_DATA('last_salt')."+++", false);
        return (($code == $check) && ($salt == SURFBAR_GET_DATA('last_salt')));
 }
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "+++".$salt."|".SURFBAR_GET_DATA('last_salt')."+++", false);
        return (($code == $check) && ($salt == SURFBAR_GET_DATA('last_salt')));
 }
+
 // Lockdown the userid/id combination (reload lock)
 function SURFBAR_LOCKDOWN_ID ($urlId) {
        //* DEBUG: */ print "LOCK!");
 // Lockdown the userid/id combination (reload lock)
 function SURFBAR_LOCKDOWN_ID ($urlId) {
        //* DEBUG: */ print "LOCK!");
@@ -972,9 +1001,10 @@ function SURFBAR_LOCKDOWN_ID ($urlId) {
                array(getUserId(), bigintval($urlId)), __FUNCTION__, __LINE__);
 
        // Remove the salt from database
                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",
+       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"
 function SURFBAR_PAY_POINTS () {
        // Remove it from the URL owner
 // Pay points to the user and remove it from the sender if userid is given else it is a "sponsored surf"
 function SURFBAR_PAY_POINTS () {
        // Remove it from the URL owner
@@ -987,6 +1017,7 @@ function SURFBAR_PAY_POINTS () {
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "uid=".getUserId().",reward=".SURFBAR_GET_REWARD()."", false);
        ADD_POINTS_REFSYSTEM(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), getUserId(), SURFBAR_GET_DATA('reward'));
 }
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "uid=".getUserId().",reward=".SURFBAR_GET_REWARD()."", false);
        ADD_POINTS_REFSYSTEM(sprintf("surfbar_%s", getConfig('surfbar_pay_model')), getUserId(), SURFBAR_GET_DATA('reward'));
 }
+
 // Updates the statistics of current URL/userid
 function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
        // Init add
 // Updates the statistics of current URL/userid
 function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
        // Init add
@@ -1002,7 +1033,7 @@ function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
        } // END - if
 
        // Update URL stats
        } // END - if
 
        // Update URL stats
-       SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET views_total=views_total+1".$add." WHERE id=%s LIMIT 1",
+       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__);
 
        // Update the stats entry
                array(SURFBAR_GET_ID()), __FUNCTION__, __LINE__);
 
        // Update the stats entry
@@ -1023,15 +1054,16 @@ function SURFBAR_UPDATE_INSERT_STATS_RECORD () {
        incrementConfigEntry('surfbar_monthly_counter');
 
        // Update config as well
        incrementConfigEntry('surfbar_monthly_counter');
 
        // Update config as well
-       UPDATE_CONFIG(array("surfbar_total_counter", "surfbar_daily_counter", "surfbar_weekly_counter", "surfbar_monthly_counter"), array(1,1,1,1), "+");
+       updateConfiguration(array('surfbar_total_counter', 'surfbar_daily_counter', 'surfbar_weekly_counter', 'surfbar_monthly_counter'), array(1,1,1,1), '+');
 }
 }
+
 // Update the salt for validation and statistics
 function SURFBAR_UPDATE_SALT_STATS () {
        // Update statistics record
        SURFBAR_UPDATE_INSERT_STATS_RECORD();
 
        // Simply store the salt from cache away in database...
 // Update the salt for validation and statistics
 function SURFBAR_UPDATE_SALT_STATS () {
        // Update statistics record
        SURFBAR_UPDATE_INSERT_STATS_RECORD();
 
        // 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",
+       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__);
 
        // Debug message
                array(SURFBAR_GET_SALT(), SURFBAR_GET_ID(), getUserId()), __FUNCTION__, __LINE__);
 
        // Debug message
@@ -1050,6 +1082,7 @@ function SURFBAR_UPDATE_SALT_STATS () {
        // Return if the update was okay
        return (SQL_AFFECTEDROWS() == 1);
 }
        // Return if the update was okay
        return (SQL_AFFECTEDROWS() == 1);
 }
+
 // Check if the reload lock is active for given id
 function SURFBAR_CHECK_RELOAD_LOCK ($urlId) {
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "id={$urlId}", false);
 // Check if the reload lock is active for given id
 function SURFBAR_CHECK_RELOAD_LOCK ($urlId) {
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "id={$urlId}", false);
@@ -1072,6 +1105,7 @@ LIMIT 1",
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "cnt={$cnt},".SURFBAR_GET_SURF_LOCK()."", false);
        return ($cnt == 1);
 }
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "cnt={$cnt},".SURFBAR_GET_SURF_LOCK()."", false);
        return ($cnt == 1);
 }
+
 // Determine which user hash no more points left
 function SURFBAR_DETERMINE_DEPLETED_USERIDS ($limit=0) {
        // Init array
 // Determine which user hash no more points left
 function SURFBAR_DETERMINE_DEPLETED_USERIDS ($limit=0) {
        // Init array
@@ -1133,6 +1167,7 @@ ORDER BY u.userid ASC", __FUNCTION__, __LINE__);
        // Return result
        return $UIDs;
 }
        // Return result
        return $UIDs;
 }
+
 // Determine how many users are Online in surfbar
 function SURFBAR_DETERMINE_TOTAL_ONLINE () {
        // Count all users in surfbar modue and return the value
 // Determine how many users are Online in surfbar
 function SURFBAR_DETERMINE_TOTAL_ONLINE () {
        // Count all users in surfbar modue and return the value
@@ -1151,6 +1186,7 @@ GROUP BY userid",
        // Return result
        return $cnt;
 }
        // Return result
        return $cnt;
 }
+
 // Determine waiting time for one URL 
 function SURFBAR_DETERMINE_WAIT_TIME () {
        // Get fixed reload lock
 // Determine waiting time for one URL 
 function SURFBAR_DETERMINE_WAIT_TIME () {
        // Get fixed reload lock
@@ -1166,7 +1202,7 @@ function SURFBAR_DETERMINE_WAIT_TIME () {
        $time = getConfig('surfbar_static_time');
 
        // Which payment model do we have?
        $time = getConfig('surfbar_static_time');
 
        // Which payment model do we have?
-       if (getConfig('surfbar_pay_model') == "DYNAMIC") {
+       if (getConfig('surfbar_pay_model') == 'DYNAMIC') {
                // "Calculate" dynamic time
                $time += SURFBAR_CALCULATE_DYNAMIC_ADD();
        } // END - if
                // "Calculate" dynamic time
                $time += SURFBAR_CALCULATE_DYNAMIC_ADD();
        } // END - if
@@ -1174,6 +1210,7 @@ function SURFBAR_DETERMINE_WAIT_TIME () {
        // Return value
        return $time;
 }
        // Return value
        return $time;
 }
+
 // Changes the status of an URL from given to other
 function SURFBAR_CHANGE_STATUS ($urlId, $prevStatus, $newStatus, $data=array()) {
        // Make new status always lower-case
 // Changes the status of an URL from given to other
 function SURFBAR_CHANGE_STATUS ($urlId, $prevStatus, $newStatus, $data=array()) {
        // Make new status always lower-case
@@ -1200,7 +1237,7 @@ function SURFBAR_CHANGE_STATUS ($urlId, $prevStatus, $newStatus, $data=array())
 
        // Update the status now
        // ---------- Comment out for debugging/developing member actions! ---------
 
        // Update the status now
        // ---------- Comment out for debugging/developing member actions! ---------
-       //SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET `status`='%s' WHERE id=%s LIMIT 1",
+       //SQL_QUERY_ESC("UPDATE `{!_MYSQL_PREFIX!}_surfbar_urls` SET `status`='%s' WHERE `id`=%s LIMIT 1",
        //      array($newStatus, bigintval($urlId)), __FUNCTION__, __LINE__);
        // ---------- Comment out for debugging/developing member actions! ---------
 
        //      array($newStatus, bigintval($urlId)), __FUNCTION__, __LINE__);
        // ---------- Comment out for debugging/developing member actions! ---------
 
@@ -1215,13 +1252,13 @@ function SURFBAR_CHANGE_STATUS ($urlId, $prevStatus, $newStatus, $data=array())
        // Prepare content for notification routines
        $data[$urlId]['uid']         = $data[$urlId]['userid'];
        $data[$urlId]['frametester'] = FRAMETESTER($data[$urlId]['url']);
        // Prepare content for notification routines
        $data[$urlId]['uid']         = $data[$urlId]['userid'];
        $data[$urlId]['frametester'] = FRAMETESTER($data[$urlId]['url']);
-       $data[$urlId]['reward']      = TRANSLATE_COMMA(getConfig('surfbar_static_reward'));
-       $data[$urlId]['costs']       = TRANSLATE_COMMA(getConfig('surfbar_static_costs'));
+       $data[$urlId]['reward']      = translateComma(getConfig('surfbar_static_reward'));
+       $data[$urlId]['costs']       = translateComma(getConfig('surfbar_static_costs'));
 
        // Do some dirty fixing here:
 
        // Do some dirty fixing here:
-       if (($data[$urlId]['status'] == "STOPPED") && ($newStatus == "pending")) {
+       if (($data[$urlId]['status'] == 'STOPPED') && ($newStatus == 'pending')) {
                // Fix for template change
                // Fix for template change
-               $newStatus = "continued";
+               $newStatus = 'continued';
        } // END - if
 
        // Send admin notification
        } // END - if
 
        // Send admin notification
@@ -1233,6 +1270,7 @@ function SURFBAR_CHANGE_STATUS ($urlId, $prevStatus, $newStatus, $data=array())
        // All done!
        return true;
 }
        // All done!
        return true;
 }
+
 // Calculate minimum value for dynamic payment model
 function SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE () {
        // Addon is zero by default
 // Calculate minimum value for dynamic payment model
 function SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE () {
        // Addon is zero by default
@@ -1242,7 +1280,7 @@ function SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE () {
        $percent = abs(log(getConfig('surfbar_dynamic_percent') / 100 + 1));
 
        // Get total users
        $percent = abs(log(getConfig('surfbar_dynamic_percent') / 100 + 1));
 
        // Get total users
-       $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", 'userid', "status", true);
+       $totalUsers = GET_TOTAL_DATA('CONFIRMED', 'user_data', 'userid', 'status', true);
 
        // Get online users
        $onlineUsers = SURFBAR_DETERMINE_TOTAL_ONLINE();
 
        // Get online users
        $onlineUsers = SURFBAR_DETERMINE_TOTAL_ONLINE();
@@ -1251,10 +1289,10 @@ function SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE () {
        $addon += abs(log($onlineUsers / $totalUsers + 1) * $percent * $totalUsers);
 
        // Get total URLs
        $addon += abs(log($onlineUsers / $totalUsers + 1) * $percent * $totalUsers);
 
        // Get total URLs
-       $totalUrls = SURFBAR_GET_TOTAL_URLS("ACTIVE", "0");
+       $totalUrls = SURFBAR_GET_TOTAL_URLS('ACTIVE', '0');
 
        // Get user's total URLs
 
        // Get user's total URLs
-       $userUrls = SURFBAR_GET_TOTAL_USER_URLS(0, "ACTIVE");
+       $userUrls = SURFBAR_GET_TOTAL_USER_URLS(0, 'ACTIVE');
 
        // Calculate addon
        if ($totalUrls > 0) {
 
        // Calculate addon
        if ($totalUrls > 0) {
@@ -1266,6 +1304,7 @@ function SURFBAR_CALCULATE_DYNAMIC_MIN_VALUE () {
        // Return addon
        return $addon;
 }
        // Return addon
        return $addon;
 }
+
 // Calculate maximum value for dynamic payment model
 function SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE () {
        // Addon is zero by default
 // Calculate maximum value for dynamic payment model
 function SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE () {
        // Addon is zero by default
@@ -1278,13 +1317,13 @@ function SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE () {
        $percent = abs(log(getConfig('surfbar_dynamic_percent') / 100 + 1));
 
        // Get total users
        $percent = abs(log(getConfig('surfbar_dynamic_percent') / 100 + 1));
 
        // Get total users
-       $totalUsers = GET_TOTAL_DATA("CONFIRMED", "user_data", 'userid', "status", true);
+       $totalUsers = GET_TOTAL_DATA('CONFIRMED', 'user_data', 'userid', 'status', true);
 
        // Calculate addon
        $addon += abs($max * $percent * $totalUsers);
 
        // Get total URLs
 
        // Calculate addon
        $addon += abs($max * $percent * $totalUsers);
 
        // Get total URLs
-       $totalUrls = SURFBAR_GET_TOTAL_URLS("ACTIVE", "0");
+       $totalUrls = SURFBAR_GET_TOTAL_URLS('ACTIVE', '0');
 
        // Calculate addon
        $addon += abs($max * $percent * $totalUrls);
 
        // Calculate addon
        $addon += abs($max * $percent * $totalUrls);
@@ -1292,6 +1331,7 @@ function SURFBAR_CALCULATE_DYNAMIC_MAX_VALUE () {
        // Return addon
        return $addon;
 }
        // Return addon
        return $addon;
 }
+
 // Calculate dynamic lock
 function SURFBAR_CALCULATE_DYNAMIC_LOCK () {
        // Default lock is 30 seconds
 // Calculate dynamic lock
 function SURFBAR_CALCULATE_DYNAMIC_LOCK () {
        // Default lock is 30 seconds
@@ -1306,6 +1346,7 @@ function SURFBAR_CALCULATE_DYNAMIC_LOCK () {
        // Return value
        return $addon;
 }
        // Return value
        return $addon;
 }
+
 // "Getter" for lock ids array
 function SURFBAR_GET_LOCK_IDS () {
        // Prepare some arrays
 // "Getter" for lock ids array
 function SURFBAR_GET_LOCK_IDS () {
        // Prepare some arrays
@@ -1326,7 +1367,7 @@ ORDER BY
        // Load all entries
        while ($content = SQL_FETCHARRAY($result)) {
                // Debug message
        // Load all entries
        while ($content = SQL_FETCHARRAY($result)) {
                // Debug message
-               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "next - lid={$content['id']},url={$content['url_id']},rest=".(time() - $last)."/".SURFBAR_GET_SURF_LOCK()."", false);
+               //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "next - lid={$content['id']},url={$content['url_id']},rest=".(time() - $last).'/'.SURFBAR_GET_SURF_LOCK()."", false);
 
                // Skip entries that are too old
                if (($last > (time() - SURFBAR_GET_SURF_LOCK())) && (!in_array($content['url_id'], $ignored))) {
 
                // Skip entries that are too old
                if (($last > (time() - SURFBAR_GET_SURF_LOCK())) && (!in_array($content['url_id'], $ignored))) {
@@ -1359,6 +1400,7 @@ ORDER BY
        // Return array
        return $USE;
 }
        // Return array
        return $USE;
 }
+
 // "Getter" for maximum random number
 function SURFBAR_GET_MAX_RANDOM ($UIDs, $add) {
        // Count max availabe entries
 // "Getter" for maximum random number
 function SURFBAR_GET_MAX_RANDOM ($UIDs, $add) {
        // Count max availabe entries
@@ -1383,6 +1425,7 @@ GROUP BY sbu.id", __FUNCTION__, __LINE__);
        // Return value
        return $maxRand;
 }
        // Return value
        return $maxRand;
 }
+
 // Load all URLs of the current user and return it as an array
 function SURFBAR_GET_USER_URLS () {
        // Init array
 // Load all URLs of the current user and return it as an array
 function SURFBAR_GET_USER_URLS () {
        // Init array
@@ -1410,8 +1453,9 @@ ORDER BY u.id ASC",
        // Return the array
        return $URLs;
 }
        // Return the array
        return $URLs;
 }
+
 // "Getter" for member action array for given status
 // "Getter" for member action array for given status
-function SURFBAR_GET_ACTION_ARRAY ($status) {
+function SURFBAR_getModeAction_ARRAY ($status) {
        // Init array
        $returnArray = array();
 
        // Init array
        $returnArray = array();
 
@@ -1434,12 +1478,13 @@ function SURFBAR_GET_ACTION_ARRAY ($status) {
        // Return result
        return $returnArray;
 }
        // Return result
        return $returnArray;
 }
+
 // Reload to configured stop page
 // Reload to configured stop page
-function SURFBAR_RELOAD_TO_STOP_PAGE($page="stop") {
+function SURFBAR_RELOAD_TO_STOP_PAGE ($page="stop") {
        // Internal or external?
        // Internal or external?
-       if ((getConfig('surfbar_pause_mode') == "INTERNAL") || (getConfig('surfbar_pause_url') == "")) {
+       if ((getConfig('surfbar_pause_mode') == 'INTERNAL') || (getConfig('surfbar_pause_url') == '')) {
                // Reload to internal page
                // Reload to internal page
-               LOAD_URL("surfbar.php?frame=".$page);
+               redirectToUrl("surfbar.php?frame=".$page);
        } else {
                // Reload to external page
                LOAD_CONFIGURED_URL('surfbar_pause_url');
        } else {
                // Reload to external page
                LOAD_CONFIGURED_URL('surfbar_pause_url');
@@ -1543,7 +1588,7 @@ LIMIT 1",
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "BASE/STATIC - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."", false);
 
                // Only in dynamic model add the dynamic bonus!
                //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "BASE/STATIC - reward=".SURFBAR_GET_REWARD()."|costs=".SURFBAR_GET_COSTS()."", false);
 
                // Only in dynamic model add the dynamic bonus!
-               if (getConfig('surfbar_pay_model') == "DYNAMIC") {
+               if (getConfig('surfbar_pay_model') == 'DYNAMIC') {
                        // Calculate dynamic reward/costs and add it
                        $GLOBALS['cache_array']['surfbar']['reward'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
                        $GLOBALS['cache_array']['surfbar']['costs']  += SURFBAR_CALCULATE_DYNAMIC_ADD();
                        // Calculate dynamic reward/costs and add it
                        $GLOBALS['cache_array']['surfbar']['reward'] += SURFBAR_CALCULATE_DYNAMIC_ADD();
                        $GLOBALS['cache_array']['surfbar']['costs']  += SURFBAR_CALCULATE_DYNAMIC_ADD();
@@ -1561,6 +1606,7 @@ LIMIT 1",
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "nextId={$nextId}", false);
        return $nextId;
 }
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "nextId={$nextId}", false);
        return $nextId;
 }
+
 // -----------------------------------------------------------------------------
 // PLEASE DO NOT ADD ANY OTHER FUNCTIONS BELOW THIS LINE IF THEY DON'T "WRAP"
 // THE $GLOBALS['cache_array']['surfbar'] ARRAY!
 // -----------------------------------------------------------------------------
 // PLEASE DO NOT ADD ANY OTHER FUNCTIONS BELOW THIS LINE IF THEY DON'T "WRAP"
 // THE $GLOBALS['cache_array']['surfbar'] ARRAY!
@@ -1587,60 +1633,72 @@ function SURFBAR_GET_DATA ($element) {
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "element[$element]={$data}", false);
        return $data;
 }
        //* DEBUG: */ DEBUG_LOG(__FUNCTION__, __LINE__, "element[$element]={$data}", false);
        return $data;
 }
+
 // Getter for reward from cache
 function SURFBAR_GET_REWARD () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('reward');
 }
 // Getter for reward from cache
 function SURFBAR_GET_REWARD () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('reward');
 }
+
 // Getter for costs from cache
 function SURFBAR_GET_COSTS () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('costs');
 }
 // Getter for costs from cache
 function SURFBAR_GET_COSTS () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('costs');
 }
+
 // Getter for URL from cache
 function SURFBAR_GET_URL () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('url');
 }
 // Getter for URL from cache
 function SURFBAR_GET_URL () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('url');
 }
+
 // Getter for salt from cache
 function SURFBAR_GET_SALT () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('salt');
 }
 // Getter for salt from cache
 function SURFBAR_GET_SALT () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('salt');
 }
+
 // Getter for id from cache
 function SURFBAR_GET_ID () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('id');
 }
 // Getter for id from cache
 function SURFBAR_GET_ID () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('id');
 }
+
 // Getter for userid from cache
 function SURFBAR_GET_USERID () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('userid');
 }
 // Getter for userid from cache
 function SURFBAR_GET_USERID () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('userid');
 }
+
 // Getter for user reload locks
 function SURFBAR_GET_USER_LOCKS () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('user_locks');
 }
 // Getter for user reload locks
 function SURFBAR_GET_USER_LOCKS () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('user_locks');
 }
+
 // Getter for reload time
 function SURFBAR_GET_RELOAD_TIME () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('time');
 }
 // Getter for reload time
 function SURFBAR_GET_RELOAD_TIME () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('time');
 }
+
 // Getter for allowed views
 function SURFBAR_GET_VIEWS_ALLOWED () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('views_allowed');
 }
 // Getter for allowed views
 function SURFBAR_GET_VIEWS_ALLOWED () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('views_allowed');
 }
+
 // Getter for fixed reload
 function SURFBAR_GET_FIXED_RELOAD () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('fixed_reload');
 }
 // Getter for fixed reload
 function SURFBAR_GET_FIXED_RELOAD () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('fixed_reload');
 }
+
 // Getter for surf lock
 function SURFBAR_GET_SURF_LOCK () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('surf_lock');
 }
 // Getter for surf lock
 function SURFBAR_GET_SURF_LOCK () {
        // Get data element and return its contents
        return SURFBAR_GET_DATA('surf_lock');
 }
-//
+
+// [EOF]
 ?>
 ?>