+ return SURFBAR_CHANGE_STATUS ($urlData['id'], $urlData['url_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
+ return SURFBAR_MEMBER_EXECUTE_ACTION('edit', $urlData);
+ } // END - if
+
+ // Display form
+ 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
+ return SURFBAR_MEMBER_EXECUTE_ACTION('delete', $urlData);
+ } // END - if
+
+ // Display form
+ return SURFBAR_MEMBER_DISPLAY_ACTION_FORM('delete', $urlData);
+}
+
+// Pause active banner
+function SURFBAR_MEMBER_PAUSE_ACTION ($urlData) {
+ return SURFBAR_CHANGE_STATUS($urlData['id'], $urlData['url_status'], $urlData['new_status'], array($urlData['id'] => $urlData));
+}
+
+// Unpause stopped banner
+function SURFBAR_MEMBER_UNPAUSE_ACTION ($urlData) {
+ // Fix missing entry for template
+ $urlData['edit'] = $urlData['unpause'];
+ $urlData['edit']['url'] = $urlData['url'];
+ $urlData['edit']['limit'] = SURFBAR_GET_VIEWS_MAX();
+
+ // Return status change
+ return SURFBAR_CHANGE_STATUS($urlData['id'], $urlData['url_status'], $urlData['new_status'], array($urlData['id'] => $urlData));
+}
+
+// Resubmit locked URL
+function SURFBAR_MEMBER_RESUBMIT_ACTION ($urlData) {
+ return SURFBAR_CHANGE_STATUS($urlData['id'], $urlData['url_status'], $urlData['new_status'], array($urlData['id'] => $urlData));
+}
+
+// Display selected "action form"
+function SURFBAR_MEMBER_DISPLAY_ACTION_FORM ($action, $urlData) {
+ // Translate some data if present
+ $content = SURFBAR_PREPARE_CONTENT_FOR_TEMPLATE($content);
+
+ // Include fields only for action 'edit'
+ if ($action == 'edit') {
+ // Default is not limited
+ $urlData['limited_y'] = '';
+ $urlData['limited_n'] = ' checked="checked"';
+ $urlData['limited'] = 'false';
+
+ // Is this URL limited?
+ if (SURFBAR_GET_VIEWS_MAX() > 0) {
+ // Then rewrite form data
+ $urlData['limited_y'] = ' checked="checked"';
+ $urlData['limited_n'] = '';
+ $urlData['limited'] = 'true';
+ } // END - if
+ } // END - if
+
+ // Load the form and display it
+ loadTemplate(sprintf("member_surfbar_%s_action_form", $action), false, $urlData);
+
+ // All fine by default ... ;-)
+ return true;
+}
+
+// Execute choosen action
+function SURFBAR_MEMBER_EXECUTE_ACTION ($action, $urlData) {
+ // By default nothing is executed
+ $executed = false;
+
+ // Is limitation "no" and "limit" is > 0?
+ if ((isset($urlData[$action]['limited'])) && ($urlData[$action]['limited'] != 'Y') && ((isset($urlData[$action]['limit'])) && ($urlData[$action]['limit'] > 0)) || (!isset($urlData[$action]['limit']))) {
+ // Set it to unlimited
+ $urlData[$action]['limit'] = '0';
+ } // END - if
+
+ // Construct function name
+ $functionName = sprintf("SURFBAR_MEMBER_EXECUTE_%s_ACTION", strtoupper($action));
+
+ // Is that function there?
+ if (function_exists($functionName)) {
+ // Execute the function
+ if (call_user_func_array($functionName, array($urlData)) == true) {
+ // Update status as well
+ $executed = SURFBAR_CHANGE_STATUS($urlData['id'], $urlData['url_status'], $urlData['new_status'], array($urlData['id'] => $urlData));
+ } // END - if
+ } else {
+ // Not found!
+ addFatalMessage(__FUNCTION__, __LINE__, '{--MEMBER_SURFBAR_EXECUTE_ACTION_404--}', $functionName);
+ }
+
+ // Return status
+ return $executed;
+}
+// "Execute edit" function: Update changed data
+function SURFBAR_MEMBER_EXECUTE_EDIT_ACTION ($urlData) {
+ // Default is nothing done
+ $status = false;
+
+ // Has the URL or limit changed?
+ if (true) {
+ //if (($urlData['url_views_allowed'] != $urlData['edit']['limit']) || ($url1 != $url2)) {
+ // Run the query
+ SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_surfbar_urls` SET `url`='%s', `url_views_allowed`=%s, `url_views_max`=%s WHERE `url_id`=%s AND `status`='%s' LIMIT 1",
+ array($urlData['url'], $urlData['edit']['limit'], $urlData['edit']['limit'], $urlData['id'], $urlData['url_status']), __FUNCTION__, __LINE__);
+
+ // All fine
+ $status = true;
+ } // END - if
+
+ // Return status
+ return $status;
+}
+// "Execute delete" function: Does nothing...
+function SURFBAR_MEMBER_EXECUTE_DELETE_ACTION ($urlData) {
+ // Nothing special to do (see above function for such "special actions" to perform)
+ return true;