]> git.mxchange.org Git - mailer.git/commitdiff
New wrapper functions introduced, TODOs.txt updated
authorRoland Häder <roland@mxchange.org>
Mon, 12 Jul 2010 13:04:46 +0000 (13:04 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 12 Jul 2010 13:04:46 +0000 (13:04 +0000)
DOCS/TODOs.txt
inc/extensions/ext-beg.php
inc/extensions/ext-bonus.php
inc/libs/beg_functions.php
inc/libs/bonus_functions.php
inc/libs/register_functions.php

index ed68af11d67d26ea00e08b2a0ea2e534ab8f4101..faa90f4b642b569bce6d151f173ff1c50e7c3471 100644 (file)
@@ -71,8 +71,8 @@
 ./inc/libs/rallye_functions.php:910:           // Load count @TODO Can't we rewrite this to our API?
 ./inc/libs/refback_functions.php:61:           // @TODO Try to rewrite the following unset()
 ./inc/libs/register_functions.php:292: // @TODO Rewrite these all to a single filter
-./inc/libs/register_functions.php:371: // @TODO Rewrite this to a filter
-./inc/libs/register_functions.php:378: // @TODO Wether the registration bonus should only be added to user directly or through referal system should be configurable
+./inc/libs/register_functions.php:365: // @TODO Rewrite this to a filter
+./inc/libs/register_functions.php:372: // @TODO Wether the registration bonus should only be added to user directly or through referal system should be configurable
 ./inc/libs/surfbar_functions.php:1540:         // @TODO This can be somehow rewritten
 ./inc/libs/surfbar_functions.php:712:// @TODO Can't we use our new expression language instead of this ugly code?
 ./inc/libs/surfbar_functions.php:953:  // @TODO Invalid salt should be refused
index e8a0107f50c9f0461eb08b06db5d03e1b9d22f04..fffd62d7279778fc5ef5986d79828e863aa81784 100644 (file)
@@ -292,7 +292,7 @@ PRIMARY KEY (id)
                $result_ext = SQL_QUERY("DELETE LOW_PRIORITY FROM `{?_MYSQL_PREFIX?}_beg_ips` WHERE `timeout` < (UNIX_TIMESTAMP() - ".($OLD + 60*60).")", __FILE__, __LINE__);
 
                // Check for beg rallye is active and send mails out
-               if ((isBegRallyeEnabled()) && (getConfig('beg_new_member_notify') == 'Y')) {
+               if ((isBegRallyeEnabled()) && (isBegNewMemberNotifyEnabled())) {
                        // Include file for sending out mails
                        addIncludeToPool('notify', 'inc/mails/beg_mails.php');
                } // END - if
index cb0bd0fab9f705e165d07cd23474e898817fa0f5..2e83eba753da03bd0c0d39a024fb5b3e6ecaee3a 100644 (file)
@@ -588,7 +588,7 @@ WHERE `last_online` < ".$mark." ORDER BY `userid` ASC");
 
        case 'init': // Do stuff when extension is initialized
                // Check for bonus rallye is active and send mails out
-               if ((isExtensionInstalledAndNewer('bonus', '0.9.1')) && (isBonusRallyeActive()) && (getConfig('bonus_new_member_notify') == 'Y')) {
+               if ((isBonusRallyeActive()) && (isBonusNewMemberNotifyEnabled())) {
                        // Include file for sending out mails
                        addIncludeToPool('notify', 'inc/mails/bonus_mails.php');
                } // END - if
index e7faa39850f1d5d08bb08421aec1d69673afda1d..4a22933c8fcf1f9f7bc3ae90aa465f7db925dd63 100644 (file)
@@ -79,6 +79,18 @@ function isBegRallyeEnabled () {
        return $GLOBALS['is_beg_rallye_enabled'];
 }
 
+// Checks wether beg_rallye is enabled
+function isBegNewMemberNotifyEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['is_beg_new_member_notify_enabled'])) {
+               // Determine it
+               $GLOBALS['is_beg_new_member_notify_enabled'] = ((isExtensionInstalledAndNewer('beg', '0.2.7')) && (getConfig('beg_new_member_notify') == 'Y'));
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['is_beg_new_member_notify_enabled'];
+}
+
 // "Getter" for beg_userid
 function getBegUserid () {
        // Do we have cache?
index 25a7974dde0fc8f4fb6b8007c8b8fff5e5325da5..556cb910184134fdab79b7b15db096a6cde2043c 100644 (file)
@@ -314,6 +314,10 @@ LIMIT 1',
        }
 }
 
+///////////////////////////////////////////////////////////////////////////////
+//                             Wrapper functions                             //
+///////////////////////////////////////////////////////////////////////////////
+
 // Determines wether the "bonus rallye" is active
 function isBonusRallyeActive () {
        // Do we have cache?
@@ -326,5 +330,17 @@ function isBonusRallyeActive () {
        return $GLOBALS['bonus_rallye_active'];
 }
 
+// Determines wether the "bonus new_member_notify" is active
+function isBonusNewMemberNotifyEnabled () {
+       // Do we have cache?
+       if (!isset($GLOBALS['bonus_new_member_notify_active'])) {
+               // Just determine it
+               $GLOBALS['bonus_new_member_notify_active'] = (getConfig('bonus_new_member_notify') == 'Y');
+       } // END - if
+
+       // Return cache
+       return $GLOBALS['bonus_new_member_notify_active'];
+}
+
 // [EOF]
 ?>
index cae47656e679cfbb7fb20b4719725843afbdfe95..8a3880c9405cd47ad2824b634de5d82f69e42eba 100644 (file)
@@ -294,28 +294,22 @@ function doRegistration () {
        $GLOBALS['register_sql_data'] = '';
        if (isExtensionInstalledAndNewer('theme', '0.0.8')) {
                // Okay, add design here
-               $GLOBALS['register_sql_columns'] = ', `curr_theme`';
-               $GLOBALS['register_sql_data'] = ", '" . getCurrentTheme() . "'";
+               $GLOBALS['register_sql_columns'] .= ', `curr_theme`';
+               $GLOBALS['register_sql_data']    .= ", '" . getCurrentTheme() . "'";
        } // END - if
 
        // Check if I shall disable sending mail to newly registered members out about active/begging rallye
        //
        // First comes first: begging rallye
-       if (isExtensionInstalledAndNewer('beg', '0.2.8')) {
-               // Okay, shall I disable now?
-               if (getConfig('beg_new_member_notify') != 'Y') {
-                       $GLOBALS['register_sql_columns'] .= ', `beg_rallye_enable_notify`, `beg_rallye_disable_notify`';
-                       $GLOBALS['register_sql_data']    .= ', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()';
-               } // END - if
+       if (!isBegNewMemberNotifyEnabled()) {
+               $GLOBALS['register_sql_columns'] .= ', `beg_rallye_enable_notify`, `beg_rallye_disable_notify`';
+               $GLOBALS['register_sql_data']    .= ', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()';
        } // END - if
 
        // Second: active rallye
-       if (isExtensionInstalledAndNewer('bonus', '0.9.2')) {
-               // Okay, shall I disable now?
-               if (getConfig('bonus_new_member_notify') != 'Y') {
-                       $GLOBALS['register_sql_columns'] .= ', `bonus_rallye_enable_notify`, `bonus_rallye_disable_notify`';
-                       $GLOBALS['register_sql_data']    .= ', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()';
-               } // END - if
+       if (!isBonusNewMemberNotifyEnabled()) {
+               $GLOBALS['register_sql_columns'] .= ', `bonus_rallye_enable_notify`, `bonus_rallye_disable_notify`';
+               $GLOBALS['register_sql_data']    .= ', UNIX_TIMESTAMP(), UNIX_TIMESTAMP()';
        } // END - if
 
        // Write user data to table