]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/surfbar_functions.php
Mail templates for undelete in surfbar added
[mailer.git] / inc / libs / surfbar_functions.php
index 2af19cbbb5d65f1779bdfae32f846e40a7be1766..7bef4431ce29075100aa8b753775dce5469ed24e 100644 (file)
@@ -241,6 +241,7 @@ function SURFBAR_MEMBER_DO_FORM ($formData, $URLs) {
        } else {
                // Log invalid request
                DEBUG_LOG(__FUNCTION__, __LINE__, " action={$formData['action']},id={$formData['id']},function={$functionName}");
+               ADD_FATAL(sprintf("Invalid member action! action=%s,id=%s,function=%s", $formData['action'], $formData['id'], $functionName));
        }
 
        // Return status
@@ -259,6 +260,7 @@ function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) {
 
        // Fetch the new status if found
        if ($isValid) {
+               // Load new status
                list($SURFBAR_CACHE['new_status']) = SQL_FETCHROW($result);
        } // END - if
 
@@ -273,7 +275,7 @@ function SURFBAR_VALIDATE_MEMBER_ACTION_STATUS ($action, $status) {
 //                               Member actions
 // -----------------------------------------------------------------------------
 //
-// Retreat an URL
+// Retreat a booked URL
 function SURFBAR_MEMBER_RETREAT_ACTION ($urlData) {
        // Create the data array for next function call
        $data = array(
@@ -293,6 +295,40 @@ function SURFBAR_MEMBER_BOOKNOW_ACTION ($urlData) {
        // 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['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['execute'])) {
+               // Execute the changes
+               return SURFBAR_MEMBER_EXECUTE_ACTION("del", $urlData);
+       } // END - if
+
+       // Display form
+       return SURFBAR_MEMBER_DISPLAY_ACTION_FORM("del", $urlData);
+}
+// 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']);
+
+       // Load the form and display it
+       LOAD_TEMPLATE(sprintf("member_surfbar_%s_action_form", $action), false, $urlData);
+
+       // All fine by default ... ;-)
+       return true;
+}
 //
 // -----------------------------------------------------------------------------
 //                           Self-maintenance functions
@@ -541,10 +577,10 @@ function SURFBAR_TRANSLATE_STATUS ($status) {
        // Set default translated status
        $statusTranslated = "!".$constantName."!";
 
-       // Generate eval() command
+       // Is the constant there?
        if (defined($constantName)) {
-               $eval = "\$statusTranslated = ".$constantName.";";
-               eval($eval);
+               // Then get it's value
+               $statusTranslated = constant($constantName);
        } // END - if
 
        // Return result
@@ -1014,7 +1050,8 @@ function SURFBAR_CHANGE_STATUS ($urlId, $prevStatus, $newStatus, $data=array())
        global $_CONFIG;
 
        // Get URL data for status comparison if missing
-       if (count($data) == 0) {
+       if ((!is_array($data)) || (count($data) == 0)) {
+               // Fetch missing URL data
                $data = SURFBAR_GET_URL_DATA($urlId);
        } // END - if
 
@@ -1026,10 +1063,10 @@ function SURFBAR_CHANGE_STATUS ($urlId, $prevStatus, $newStatus, $data=array())
 
 
        // Update the status now
-       // ---------------------- Commented out for debugging member actions! -----------------------
+       // ---------- Comment out for debugging/developing member actions! ---------
        //SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_surfbar_urls SET status='%s' WHERE id=%s LIMIT 1",
        //      array($newStatus, bigintval($urlId)), __FILE__, __LINE__);
-       // ---------------------- Commented out for debugging member actions! -----------------------
+       // ---------- Comment out for debugging/developing member actions! ---------
 
        // Was that fine?
        if (SQL_AFFECTEDROWS() != 1) {