From: Roland Häder Date: Mon, 29 Sep 2008 23:00:19 +0000 (+0000) Subject: Email support added to refback extension X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3cac3f2c96d0f9737a9df56b5236f379c4c75a44;p=mailer.git Email support added to refback extension --- diff --git a/.gitattributes b/.gitattributes index 51a12c4cc3..8c37b468b2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -619,6 +619,7 @@ templates/de/emails/admin/admin_rallye_expired_no.tpl -text templates/de/emails/admin/admin_rallye_no_notify.tpl -text templates/de/emails/admin/admin_rallye_notify.tpl -text templates/de/emails/admin/admin_rallye_purged.tpl -text +templates/de/emails/admin/admin_refback.tpl -text templates/de/emails/admin/admin_reset_password.tpl -text templates/de/emails/admin/admin_sponsor_change_data.tpl -text templates/de/emails/admin/admin_sponsor_change_email.tpl -text @@ -697,6 +698,7 @@ templates/de/emails/member/member_rallye_expired_bronce.tpl -text templates/de/emails/member/member_rallye_expired_gold.tpl -text templates/de/emails/member/member_rallye_expired_silver.tpl -text templates/de/emails/member/member_rallye_notify.tpl -text +templates/de/emails/member/member_refback.tpl -text templates/de/emails/member/member_stats_bonus.tpl -text templates/de/emails/member/member_support-order.tpl -text templates/de/emails/member/member_support-ordr.tpl -text diff --git a/inc/databases.php b/inc/databases.php index f588661844..94369d9c62 100644 --- a/inc/databases.php +++ b/inc/databases.php @@ -113,7 +113,7 @@ define('USAGE_BASE', "usage"); define('SERVER_URL', "http://www.mxchange.org"); // This current patch level -define('CURR_SVN_REVISION', "413"); +define('CURR_SVN_REVISION', "415"); // Take a prime number which is long (if you know a longer one please try it out!) define('_PRIME', 591623); diff --git a/inc/language/refback_de.php b/inc/language/refback_de.php index f85bb270e1..6b98f619e7 100644 --- a/inc/language/refback_de.php +++ b/inc/language/refback_de.php @@ -66,5 +66,9 @@ define('MEMBER_REFBACK_ERROR_ID_MISMATCH', "Die ausgewählte Ref-Back ID geh define('MEMBER_REFBACK_ERROR_NOT_UPDATED', "Ref-Back nicht aktualisiert."); define('MEMBER_REFBACK_DONE', "Ref-Back eingestellt. Dieser ist ab jetzt gültig."); +// Subject lines +define('ADMIN_REFBACK_SUBJECT', "Es wurde Ref-Back eingestellt"); +define('MEMBER_REFBACK_SUBJECT', "Für Sie wurde Ref-Back eingestellt"); + // ?> diff --git a/inc/libs/refback_functions.php b/inc/libs/refback_functions.php index 1009819e4f..6e5c9112ba 100644 --- a/inc/libs/refback_functions.php +++ b/inc/libs/refback_functions.php @@ -307,7 +307,7 @@ function GET_USER_REF_ENTRY ($id) { $id = bigintval($id); // Get entry from database - $result = SQL_QUERY_ESC("SELECT id, refid, refback FROM "._MYSQL_PREFIX."_user_refs WHERE id=%s AND userid=%s LIMIT 1", + $result = SQL_QUERY_ESC("SELECT id, refid, refback, level FROM "._MYSQL_PREFIX."_user_refs WHERE id=%s AND userid=%s LIMIT 1", array($id, $GLOBALS['userid']), __FILE__, __LINE__); // Is there an entry? @@ -336,11 +336,11 @@ function REFBACK_CHANGE_MEMBER_PERCENTS ($id, $percents) { return $status; } elseif ("".$id."" != "".bigintval($id)."") { // No number! - $status['message'] = MEMBER_REFBACK_INVALID_ID_NUMBER; + $status['message'] = MEMBER_REFBACK_ERROR_INVALID_ID_NUMBER; return $status; } elseif (($percents < 0) || ($percents > 100)) { // Percentage is not valid! - $status['message'] = MEMBER_REFBACK_INVALID_PERCENTAGE; + $status['message'] = MEMBER_REFBACK_ERROR_INVALID_PERCENTAGE; return $status; } @@ -350,7 +350,7 @@ function REFBACK_CHANGE_MEMBER_PERCENTS ($id, $percents) { // Is this valid? if (count($dummy) == 0) { // ID does not belong to user! - $status['message'] = MEMBER_REFBACK_ID_MISMATCH; + $status['message'] = MEMBER_REFBACK_ERROR_ID_MISMATCH; return $status; } // END - if @@ -364,10 +364,26 @@ function REFBACK_CHANGE_MEMBER_PERCENTS ($id, $percents) { // Entry updated? if (SQL_AFFECTEDROWS() < 1) { // Entry not updated! - $status['message'] = MEMBER_REFBACK_NOT_UPDATED;; + $status['message'] = MEMBER_REFBACK_ERROR_NOT_UPDATED;; return $status; } // END - if + // Prepare email content + $content = array( + 'percents' => TRANSLATE_COMMA($percents), + 'refid' => $dummy['refid'], + 'level' => $dummy['level'] + ); + + // Load member email template + $mail = LOAD_EMAIL_TEMPLATE("member_refback", $content, $GLOBALS['userid']); + + // Send email to user + SEND_EMAIL($dummy['refid'], MEMBER_REFBACK_SUBJECT, $mail); + + // Send admin notification + SEND_ADMIN_NOTIFICATION(ADMIN_REFBACK_SUBJECT, "admin_refback", $content, $GLOBALS['userid']); + // All fine! $status['ok'] = true; diff --git a/templates/de/emails/admin/admin_refback.tpl b/templates/de/emails/admin/admin_refback.tpl new file mode 100644 index 0000000000..1d4bea773e --- /dev/null +++ b/templates/de/emails/admin/admin_refback.tpl @@ -0,0 +1,14 @@ +Hallo Administrator, + +Das Mitglied $UID hat soeben Ref-Back für ein anderes Mitglied eingestellt. + +------------------------------ +Mitglied-ID: $content[refid] (der den Ref-Back bekommt) +------------------------------ +Ref-Back: $content[percents]% +------------------------------ + +Mit freundlichem Gruss, + Ihr {!MAIN_TITLE!} Team + +{!URL!}/login.php ({!WEBMASTER!}) diff --git a/templates/de/emails/member/member_refback.tpl b/templates/de/emails/member/member_refback.tpl new file mode 100644 index 0000000000..ffc6432163 --- /dev/null +++ b/templates/de/emails/member/member_refback.tpl @@ -0,0 +1,14 @@ +Hallo $content[gender] $content[surname] $content[family], + +Das Mitglied $UID hat Ihnen soeben Ref-Back eingestellt. Sie erhalten also anteilig {!POINTS!} von seinen Referal-Gutschriften die Sie ihm/ihr bringen ebenfalls gutgeschrieben. + +------------------------------ +Ihr Mitglieder-ID ist: $content[refid] +------------------------------ +Ref-Back: $content[percents]% +------------------------------ + +Mit freundlichem Gruss, + Ihr {!MAIN_TITLE!} Team + +{!URL!}/login.php ({!WEBMASTER!}) \ No newline at end of file