Surfbar extended with member notification
authorRoland Häder <roland@mxchange.org>
Wed, 3 Sep 2008 15:35:46 +0000 (15:35 +0000)
committerRoland Häder <roland@mxchange.org>
Wed, 3 Sep 2008 15:35:46 +0000 (15:35 +0000)
inc/language/surfbar_de.php
inc/libs/surfbar_functions.php
templates/de/emails/order_accept_sb.tpl

index 6d71bb1e2e09ab39d93d19d13e27d7f97ff571b6..39416c14223527ec1365c4144fbd428651ae87d1 100644 (file)
@@ -37,7 +37,7 @@ if (basename($_SERVER['PHP_SELF']) == basename(__FILE__)) {
        require($INC);
 }
 
-// Language definitions
+// General admin text
 define('ADMIN_CONFIG_SURFBAR_TITLE', "Konfiguration der Surfbar");
 define('ADMIN_CONFIG_SURFBAR_STATIC_REWARD', "Statische Verg&uuml;tung in {!POINTS!}:");
 define('ADMIN_CONFIG_SURFBAR_STATIC_TIME', "Statische Verweildauer bis n&auml;chste Seite geladen wird in Sekunden:");
@@ -51,5 +51,13 @@ define('ADMIN_SURFBAR_NOTIFY_UNLOCK_NO', "Nein, nicht informieren.");
 define('ADMIN_SURFBAR_NO_REF_LEVELS_FOUND', "Zur Zeit sind keine Referal-Ebenen f&uuml;r die Surfbar eingestellt.<br />\nBitte installieren Sie die Erweiterung <strong>surfbar</strong> neu.");
 define('ADMIN_SURFBAR_ADD_NEW_REFDEPTH', "Neue Referal-Ebene zur Surfbar hinzuf&uuml;gen");
 
+// Subject lines for admins
+define('ADMIN_SURFBAR_NOTIFY_URL_UNLOCK_SUBJECT', "URL in Surfbar gebucht");
+define('ADMIN_SURFBAR_NOTIFY_URL_REG_SUBJECT', "Mitglied hat URL in Surfbar gebucht");
+
+// Subhect lines for members
+define('MEMBER_SURFBAR_NOTIFY_URL_UNLOCK_SUBJECT', "Ihre URL wurde in die Surfbar aufgenommen");
+define('MEMBER_SURFBAR_NOTIFY_URL_REG_SUBJECT', "Ihre URL in der Surfbar wartet auf Freischaltung");
+
 //
 ?>
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);
 }
 //
 ?>
index 7f431b8bd28638dd46be3c81a132943cdaaf7612..a8792904bf8164299c5a273761fe9ea2fa22dd78 100644 (file)
@@ -3,9 +3,9 @@ Hallo $salut $surname, $family,
 Einer unserer Administratoren hat soeben Ihre Mailbuchung freigegeben. Sie wird von unserem System automatisch versendet! Bitte beachten Sie, dass dies ggf. zeitversetzt zu dieser Mail versendet wird. Hier sind nochmals URL und Betreff Ihrer Mailbuchung:
 
 -----------------------------
-Beworbene URL: $TARGET_URL
+Beworbene URL: $DATA[url]
 -----------------------------
-Betreffzeile: $SUBJECT
+Betreffzeile: $DATA[subject]
 -----------------------------
 
 Sie koennen den Versand-Fortschritt im Mitgliedsmenue unter "Unbestaetigte Mails" verfolgen. Sobald die Mail vollstaendig versendet wurde, erhalten Sie eine weitere Mail!