]> git.mxchange.org Git - mailer.git/blobdiff - inc/libs/surfbar_functions.php
Surfbar extended with member notification
[mailer.git] / inc / libs / surfbar_functions.php
index 64d5ea0ec7207c049592ea30128ab3fe0ba3b352..f00ee9abe9ee37e1a11d3d6483ec498dfc808e8f 100644 (file)
@@ -123,13 +123,10 @@ function SURFBAR_REGISTER_URL ($url, $uid, $reward, $status="PENDING", $addMode=
        $content['insert_id'] = SURFBAR_INSERT_URL_BY_ARRAY($content);
 
        // If in reg-mode we notify admin
-       if ($addMode == "reg") {
-               // Notify admin of newly added URL in surfbar
-               SURFBAR_NOTIFY_ADMIN("url_reg", $content);
-       } elseif ($_CONFIG['surfbar_notify_admin_unlock'] == "Y") {
+       if (($addMode == "reg") || ($_CONFIG['surfbar_notify_admin_unlock'] == "Y")) {
                // Notify admin even when he as unlocked an email
-               SURFBAR_NOTIFY_ADMIN("url_unlock", $content);
-       }
+               SURFBAR_NOTIFY_ADMIN("url_{$addMode}", $content);
+       } // END - if
 
        // Send mail to user
        SURFBAR_NOTIFY_USER("url_{$addMode}", $content);
@@ -157,7 +154,33 @@ function SURFBAR_INSERT_URL_BY_ARRAY ($urlData) {
 // Notify admin(s) with a selected message and content
 function SURFBAR_NOTIFY_ADMIN ($messageType, $content) {
        // Prepare template name
-       $template = sprintf("admin_surfbar_%s", $messageType);
+       $templateName = sprintf("admin_surfbar_%s", $messageType);
+
+       // Prepare subject
+       $eval = sprintf("\$subject = ADMIN_SURFBAR_NOTIFY_%s_SUBJECT;",
+               strtoupper($messageType)
+       );
+       eval($eval);
+
+       // Send the notification out
+       SEND_ADMIN_NOTIFICATION($subject, $templateName, $content, $content['uid']);
+}
+// Notify the user about the performed action
+function SURFBAR_NOTIFY_USER ($messageType, $content) {
+       // Prepare template name
+       $templateName = sprintf("admin_surfbar_%s", $messageType);
+
+       // Prepare subject
+       $eval = sprintf("\$subject = MEMBER_SURFBAR_NOTIFY_%s_SUBJECT;",
+               strtoupper($messageType)
+       );
+       eval($eval);
+
+       // Load template
+       $mailText = LOAD_EMAIL_TEMPLATE($templateName, $content);
+
+       // Send the email
+       SEND_EMAIL($content['uid'], $subject, $mailText);
 }
 //
 ?>