Renamed functions to make it more clear, ext-coupon continued:
authorRoland Häder <roland@mxchange.org>
Mon, 27 Jun 2011 15:52:10 +0000 (15:52 +0000)
committerRoland Häder <roland@mxchange.org>
Mon, 27 Jun 2011 15:52:10 +0000 (15:52 +0000)
- Extension ext-coupon continued: non-functional script added, template added
- Renamed all someFooTimestamp() functions to someFooEpocheTime() to make it
  clear that the Uni* epoche time meant and not TIMESTAMP from MySQL
- TODOs.txt updated

24 files changed:
.gitattributes
DOCS/TODOs.txt
inc/config-global.php
inc/extensions/ext-coupon.php
inc/filters.php
inc/functions.php
inc/language/coupon_de.php
inc/language/de.php
inc/libs/sponsor_functions.php
inc/libs/user_functions.php
inc/modules/admin.php
inc/modules/admin/admin-inc.php
inc/modules/admin/what-add_surfbar_url.php
inc/modules/admin/what-config_other.php
inc/modules/admin/what-config_register2.php
inc/modules/admin/what-edit_sponsor.php
inc/modules/admin/what-list_sponsor.php
inc/modules/admin/what-send_bonus.php
inc/modules/admin/what-send_coupon.php [new file with mode: 0644]
inc/modules/member/what-unconfirmed.php
inc/wrapper-functions.php
templates/de/html/admin/admin_login_msg.tpl
templates/de/html/admin/admin_send_bonus_form.tpl
templates/de/html/admin/admin_send_coupon.tpl [new file with mode: 0644]

index 527b183..4e793f2 100644 (file)
@@ -544,6 +544,7 @@ inc/modules/admin/what-repair_gmnu.php svneol=native#text/plain
 inc/modules/admin/what-repair_lang.php svneol=native#text/plain
 inc/modules/admin/what-repair_mmnu.php svneol=native#text/plain
 inc/modules/admin/what-send_bonus.php svneol=native#text/plain
+inc/modules/admin/what-send_coupon.php svneol=native#text/plain
 inc/modules/admin/what-send_newsletter.php svneol=native#text/plain
 inc/modules/admin/what-stats_mods.php svneol=native#text/plain
 inc/modules/admin/what-sub_points.php svneol=native#text/plain
@@ -1317,6 +1318,7 @@ templates/de/html/admin/admin_reset_password_form.tpl svneol=native#text/plain
 templates/de/html/admin/admin_reset_password_send_link.tpl svneol=native#text/plain
 templates/de/html/admin/admin_send_bonus_form.tpl svneol=native#text/plain
 templates/de/html/admin/admin_send_bonus_select.tpl svneol=native#text/plain
+templates/de/html/admin/admin_send_coupon.tpl svneol=native#text/plain
 templates/de/html/admin/admin_send_reset_link.tpl svneol=native#text/plain
 templates/de/html/admin/admin_send_yoomedia.tpl svneol=native#text/plain
 templates/de/html/admin/admin_settings_saved.tpl svneol=native#text/plain
index c1c290f..27afa7a 100644 (file)
 ./inc/extensions-functions.php:567:            // @TODO Extension is loaded, what next?
 ./inc/filter/bonus_filter.php:55:              // @TODO This query isn't right, it will only update if the user was for a longer time away!
 ./inc/filter/cache_filter.php:78:              // @TODO This should be rewritten not to load the cache file for just checking if it is there for save removal.
-./inc/functions.php:1217:                      // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
-./inc/functions.php:1305:                      // @TODO Are these convertions still required?
-./inc/functions.php:1323:// @TODO Rewrite this function to use readFromFile() and writeToFile()
+./inc/functions.php:1219:                      // @TODO Move this SQL code into a function, let's say 'getTimestampFromPoolId($id) ?
+./inc/functions.php:1307:                      // @TODO Are these convertions still required?
+./inc/functions.php:1325:// @TODO Rewrite this function to use readFromFile() and writeToFile()
 ./inc/functions.php:163:// @TODO Rewrite this to an extension 'smtp'
-./inc/functions.php:1905:      // @TODO Find a way to cache this
-./inc/functions.php:2006:      // @TODO This is still very static, rewrite it somehow
-./inc/functions.php:2186:      // @TODO Rename column data_type to e.g. mail_status
+./inc/functions.php:1907:      // @TODO Find a way to cache this
+./inc/functions.php:2008:      // @TODO This is still very static, rewrite it somehow
+./inc/functions.php:2188:      // @TODO Rename column data_type to e.g. mail_status
 ./inc/functions.php:92:                // @TODO Extension 'msg' does not exist
 ./inc/gen_sql_patches.php:95:// @TODO Rewrite this to a filter
 ./inc/install-functions.php:57:        // @TODO DEACTIVATED: changeDataInLocalConfigurationFile('OUTPUT-MODE', "setConfigEntry('OUTPUT_MODE', '", "');", postRequestParameter('omode'), 0);
 ./inc/modules/admin/overview-inc.php:426:                      // @TODO Try to move this in includes
 ./inc/modules/admin/overview-inc.php:43:// @TODO This function does also check for uncompleted tasks
 ./inc/modules/admin/what-add_guestnl_cat.php:47:       // @TODO Check if category does already exist
-./inc/modules/admin/what-add_surfbar_url.php:55:       // @TODO Find all convertSelectionsToTimestamp() calls and rewrite postRequestParameter() calls to $postData
+./inc/modules/admin/what-add_surfbar_url.php:55:       // @TODO Find all convertSelectionsToEpocheTime() calls and rewrite postRequestParameter() calls to $postData
 ./inc/modules/admin/what-admin_add.php:118:                            // @TODO This can be somehow rewritten to a function
 ./inc/modules/admin/what-admin_add.php:59:             // @TODO Cant this be rewritten?
 ./inc/modules/admin/what-admin_add.php:75:             // @TODO This can be somehow rewritten to a function
index 8fa172f..e4ad948 100644 (file)
@@ -107,6 +107,9 @@ setConfigEntry('DEBUG_TEMPLATE_CACHE', 'N');
 // CFG: SALT-LENGTH
 setConfigEntry('salt_length', 10);
 
+// CFG: MINIMUM-ADMIN-PASS-LENGTH
+setConfigEntry('minium_admin_pass_length', 4);
+
 // Connect to the database...
 loadIncludeOnce('inc/mysql-connect.php');
 
index c6b6a3e..ea480f4 100644 (file)
@@ -84,6 +84,9 @@ UNIQUE KEY (`coupon_code`)
                addConfigAddSql('coupon_default_time', 'BIGINT(20) NOT NULL DEFAULT ' . (getOneDay() * 7));
                addConfigAddSql('coupon_default_points', 'FLOAT(20,5) NOT NULL DEFAULT 100.00000');
 
+               // User data table
+               addExtensionSql("ALTER TABLE `{?_MYSQL_PREFIX?}_user_data` ADD `receiving_coupons` ENUM('Y','N') NOT NULL DEFAULT 'Y'");
+
                // Menu systems:
                //  - Admin entries
                addAdminMenuSql('coupon', NULL, 'Gutscheine', 'Einrichten und Versenden von Code-Gutscheinen, sowie per API (noch in Planung). Bei Code-Gutscheinen wird ein Code pro Mitglied erzeugt, der dann an das Mitglied ausgesandt wird. L&ouml;st das Mitglied den Gutschein ein, erh&auml;lt es die Gutschrift auf sein Konto gutgeschrieben. Ausgangseinstellung ist die Gutschrift auf das Werbeguthaben, was f&uuml;r Paidmailer von Wichtigkeit ist, dass Guthaben aus Gutscheinen nicht auszahlungsf&auml;hig ist.', 6);
index fec9bae..079efbc 100644 (file)
@@ -1073,7 +1073,7 @@ function FILTER_SET_CURRENT_DATE () {
        // Set current date
        setConfigEntry('CURRENT_DATE', generateDateTime(time(), '3'));
 
-       // Timestamp for yesterday, today ... all at 00:00 am
+       // Epoche time for yesterday, today ... all at 00:00 am
        setConfigEntry('START_YDAY', makeTime(0, 0, 0, time() - getOneDay()));
        setConfigEntry('START_TDAY', makeTime(0, 0, 0, time()));
 }
index bc39742..1b9710b 100644 (file)
@@ -717,7 +717,7 @@ function bigintval ($num, $castValue = true, $abortOnMismatch = true) {
 }
 
 // Creates a Uni* timestamp from given selection data and prefix
-function createTimestampFromSelections ($prefix, $postData) {
+function createEpocheTimeFromSelections ($prefix, $postData) {
        // Initial return value
        $ret = '0';
 
@@ -727,7 +727,9 @@ function createTimestampFromSelections ($prefix, $postData) {
        $M1   = getMonth();
 
        // If so and if current time is before 02/29 and estimated time is after 02/29 then add 86400 seconds (one day)
-       if ((floor($TEST) == $TEST) && ($M1 == '02') && ($postData[$prefix . '_mo'] > '02'))  $SWITCH = getOneDay();
+       if ((floor($TEST) == $TEST) && ($M1 == '02') && ($postData[$prefix . '_mo'] > '02'))  {
+               $SWITCH = getOneDay();
+       } // END - if
 
        // First add years...
        $ret += $postData[$prefix . '_ye'] * (31536000 + $SWITCH);
@@ -1458,7 +1460,7 @@ function handleExtraValues ($filterFunction, $value, $extraValue) {
 }
 
 // Converts timestamp selections into a timestamp
-function convertSelectionsToTimestamp (&$postData, &$DATA, &$id, &$skip) {
+function convertSelectionsToEpocheTime (array &$postData, array &$DATA, &$id, &$skip) {
        // Init test variable
        $skip  = false;
        $test2 = '';
@@ -1472,7 +1474,7 @@ function convertSelectionsToTimestamp (&$postData, &$DATA, &$id, &$skip) {
                $test = substr($id, 0, -3);
                if ((isset($postData[$test.'_ye'])) && (isset($postData[$test.'_mo'])) && (isset($postData[$test.'_we'])) && (isset($postData[$test.'_da'])) && (isset($postData[$test.'_ho'])) && (isset($postData[$test.'_mi'])) && (isset($postData[$test.'_se'])) && ($test != $test2)) {
                        // Generate timestamp
-                       $postData[$test] = createTimestampFromSelections($test, $postData);
+                       $postData[$test] = createEpocheTimeFromSelections($test, $postData);
                        $DATA[] = sprintf("`%s`='%s'", $test, $postData[$test]);
                        $GLOBALS['skip_config'][$test] = true;
 
index f183ad4..0c22a41 100644 (file)
@@ -45,6 +45,13 @@ addMessages(array(
        'ADMIN_CONFIG_COUPON_SETTINGS_TITLE' => "Allgemeine Einstellungen zu den Gutscheinen",
        'ADMIN_CONFIG_COUPON_DEFAULT_TIME' => "Zeit, bis Gutscheine ablaufen sollen. Sie k&ouml;nnen diesen Ausgangswert beim Erstellen von neuen Gutscheinen nachtr&auml;glich anpassen.",
        'ADMIN_CONFIG_COUPON_DEFAULT_POINTS' => "Ausgangsverg&uuml;tung in {?POINTS?}. Sie k&ouml;nnen diesen Ausgangswert beim Erstellen von neuen Gutscheinen nachtr&auml;glich anpassen.",
+       'ADMIN_SEND_COUPON_TITLE' => "Gutschein versenden (aktuell nur Code-Gutscheine)",
+       'ADMIN_SEND_COUPON_EXPIRATION_TIME' => "Ablaufzeit (ab Versandzeitpunkt)",
+       'ADMIN_SEND_COUPON_POINTS' => "Verg&uuml;tung f&uuml;r eingel&ouml;sten Gutschein",
+       'ADMIN_SEND_COUPON_ENTER_DESCRIPTION' => "Kurzbeschreibung/Hinweis des Gutscheins",
+       'ADMIN_SEND_COUPON' => "Gutschein versenden",
+       'ADMIN_SEND_COUPON_POINTS_NOT_ENTERED' => "Bitte geben Sie eine Verg&uuml;tung (in {?POINTS?}) ein.",
+       'ADMIN_SEND_COUPON_DESCRIPTION_NOT_ENTERED' => "Bitte geben Sie eine kurze Beschreibung (oder einen Hinweis an Ihre Mitglieder) ein.",
 ));
 
 // [EOF]
index a1a99a5..734c2c3 100644 (file)
@@ -77,9 +77,9 @@ addMessages(array(
        'ADMIN_NO_LOGIN' => "Sie haben keinen Loginnamen eingegeben.",
        'ADMIN_NO_PASS1' => "Sie haben kein Passwort eingegeben.",
        'ADMIN_NO_PASS2' => "Sie haben keine Passwortwiederholung eingegeben.",
-       'ADMIN_SHORT_PASS1' => "Das Passwort ist zu kurz! Mindestens 4 Zeichen.",
-       'ADMIN_SHORT_PASS2' => "Die Passwortwiederholung ist zu kurz! Mindestens 4 Zeichen.",
-       'ADMIN_SHORT_PASS' => "Ihr Administratorpasswort ist zu kurz! Mindestens 4 Zeichen",
+       'ADMIN_SHORT_PASS1' => "Das Passwort ist zu kurz! Mindestens {?minium_admin_pass_length?} Zeichen.",
+       'ADMIN_SHORT_PASS2' => "Die Passwortwiederholung ist zu kurz! Mindestens {?minium_admin_pass_length?} Zeichen.",
+       'ADMIN_SHORT_PASS' => "Ihr Administratorpasswort ist zu kurz! Mindestens {?minium_admin_pass_length?} Zeichen",
        'ADMIN_PASS1_MISMATCH' => "Das Passwort stimmt nicht mit der Wiederholung &uuml;berein.",
        'ADMIN_PASS2_MISMATCH' => "Die Passwortwiederholung stimmt nicht mit dem Passwort &uuml;berein.",
        'ADMIN_LOGIN_ALREADY_REG' => "Das von Ihnen eingegebene Admin-Login existiert bereits.",
@@ -92,7 +92,7 @@ addMessages(array(
        'ENTER_ADMIN_PASS' => "Passwort zum Admin-Account",
        'ADMIN_LOGIN_SUBMIT' => "Einloggen",
        'WRONG_PASS' => "Falsches Passwort.",
-       'ADMIN_ACCOUNT_404' => "Administrator-Account <span class=\"data\">%s</span> wurde nicht gefunden.",
+       'ADMIN_ACCOUNT_404' => "Administrator-Account <span class=\"data\">%s</span> nicht gefunden. Bitte pr&uuml;fen Sie Ihre Eingaben und versuchen Sie es erneut.",
        'ADMIN_LOGIN_FAILED' => "Einloggen in den Administrator-Bereich fehlgeschlagen.",
        'CANNOT_REGISTER_SESS' => "Konnte eine Sitzungsvariable nicht setzen! Vermutlich sind bei Ihnen Cookies deaktiviert.",
        'SELECT_TIMEOUT' => "G&uuml;tigkeitsdauer des Auto-Logins",
index b84281d..6135e91 100644 (file)
@@ -106,7 +106,7 @@ function handleSponsorRequest ($postData, $update=false, $messageArray=array(),
 
                                        default:
                                                // Test if there is are time selections
-                                               convertSelectionsToTimestamp($postData, $DATA, $k, $skip);
+                                               convertSelectionsToEpocheTime($postData, $DATA, $k, $skip);
                                                break;
                                } // END - switch
 
index 760bad3..838c8db 100644 (file)
@@ -475,7 +475,7 @@ function doNewUserPassword ($email, $userid) {
 }
 
 // Get timestamp for given stats type and data
-function getTimestampFromUserStats ($statsType, $statsData, $userid = '0') {
+function getEpocheTimeFromUserStats ($statsType, $statsData, $userid = '0') {
        // Default timestamp is zero
        $data['inserted'] = '0';
 
@@ -528,7 +528,7 @@ function insertUserStatsRecord ($userid, $statsType, $statsData) {
        } // END - if
 
        // Does it exist?
-       if ((!getTimestampFromUserStats($statsType, $statsData, $userid)) && (!is_array($statsData))) {
+       if ((!getEpocheTimeFromUserStats($statsType, $statsData, $userid)) && (!is_array($statsData))) {
                // Then insert it!
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_stats_data` (`userid`,`stats_type`,`stats_data`) VALUES (%s,'%s','%s')",
                        array(
index aa37923..5728884 100644 (file)
@@ -52,7 +52,7 @@ $ret = 'init';
 // Is no admin registered?
 if (!isAdminRegistered()) {
        // Admin is not registered so we have to inform the user
-       if ((isFormSent()) && ((!isPostRequestParameterSet('login')) || (!isPostRequestParameterSet('pass1')) || (strlen(postRequestParameter('pass1')) < 4) || (!isPostRequestParameterSet('pass2')) || (strlen(postRequestParameter('pass2')) < 4) || (postRequestParameter('pass1') != postRequestParameter('pass2')))) {
+       if ((isFormSent()) && ((!isPostRequestParameterSet('login')) || (!isPostRequestParameterSet('pass1')) || (strlen(postRequestParameter('pass1')) < getConfig('minium_admin_pass_length')) || (!isPostRequestParameterSet('pass2')) || (strlen(postRequestParameter('pass2')) < getConfig('minium_admin_pass_length')) || (postRequestParameter('pass1') != postRequestParameter('pass2')))) {
                setPostRequestParameter('ok', '***');
        } // END - if
 
@@ -147,14 +147,14 @@ if (!isAdminRegistered()) {
                        // No password 1 entered or to short?
                        if (!isPostRequestParameterSet('pass1')) {
                                $pass1Message = '{--ADMIN_NO_PASS1--}';
-                       } elseif (strlen(postRequestParameter('pass1')) < 4) {
+                       } elseif (strlen(postRequestParameter('pass1')) < getConfig('minium_admin_pass_length')) {
                                $pass1Message = '{--ADMIN_SHORT_PASS1--}';
                        }
 
                        // No password 2 entered or to short?
                        if (!isPostRequestParameterSet('pass2')) {
                                $pass2Message = '{--ADMIN_NO_PASS2--}';
-                       } elseif (strlen(postRequestParameter('pass2')) < 4) {
+                       } elseif (strlen(postRequestParameter('pass2')) < getConfig('minium_admin_pass_length')) {
                                $pass2Message = '{--ADMIN_SHORT_PASS2--}';
                        }
 
@@ -233,7 +233,7 @@ if (!isAdminRegistered()) {
        } // END - if
 
        // Check if the admin has submitted data or not
-       if ((isFormSent()) && ((!isPostRequestParameterSet('login')) || (!isPostRequestParameterSet('password')) || (strlen(postRequestParameter('password')) < 4))) {
+       if ((isFormSent()) && ((!isPostRequestParameterSet('login')) || (!isPostRequestParameterSet('password')) || (strlen(postRequestParameter('password')) < getConfig('minium_admin_pass_length')))) {
                setPostRequestParameter('ok', '***');
        } // END - if
 
@@ -299,34 +299,34 @@ if (!isAdminRegistered()) {
                        $loginMessage = '';
                        $passwdMessage = '';
 
-                       // No login entered?
+                       // Check for login
                        if (!isPostRequestParameterSet('login')) {
+                               // No login entered?
                                $loginMessage = '{--ADMIN_NO_LOGIN--}';
-                       } // END - if
-
-                       // An error comes back from login?
-                       if ((!empty($ret)) && (postRequestParameter('ok') == '404')) {
+                       } elseif ((!empty($ret)) && (postRequestParameter('ok') == '404')) {
+                               // An error comes back from login?
                                $loginMessage = $ret;
-                       } // END - if
+                       }
 
-                       // No password entered?
+                       // Check for password
                        if (!isPostRequestParameterSet('password')) {
+                               // No password entered?
                                $passwdMessage = '{--ADMIN_NO_PASS--}';
-                       } // END - if
-
-                       // Or password too short?
-                       if (strlen(postRequestParameter('password')) < 4) {
+                       } elseif (strlen(postRequestParameter('password')) < getConfig('minium_admin_pass_length')) {
+                               // Or password too short?
                                $passwdMessage = '{--ADMIN_SHORT_PASS--}';
-                       } // END - if
-
-                       // An error comes back from login?
-                       if ((!empty($ret)) && (postRequestParameter('ok') == 'password')) {
+                       } elseif ((!empty($ret)) && (postRequestParameter('ok') == 'password')) {
+                               // An error comes back from login?
                                $passwdMessage = $ret;
-                       } // END - if
+                       }
 
-                       // Load message template
-                       $content['login_message'] = loadTemplate('admin_login_msg', true, $loginMessage);
-                       $content['pass_message']  = loadTemplate('admin_login_msg', true, $passwdMessage);
+                       // Load message templates if the messages have been set
+                       if (!empty($loginMessage)) {
+                               $content['login_message'] = loadTemplate('admin_login_msg', true, $loginMessage);
+                       } // END - if
+                       if (!empty($passwdMessage)) {
+                               $content['pass_message']  = loadTemplate('admin_login_msg', true, $passwdMessage);
+                       } // END - if
                } // END - if
 
                // Load login form
index 4542f84..96aaca2 100644 (file)
@@ -489,7 +489,7 @@ function adminSaveSettings (&$postData, $tableName = '_config', $whereStatement
                // Process only formular field but not submit buttons ;)
                if ($id != 'ok') {
                        // Do not save the ok value
-                       convertSelectionsToTimestamp($postData, $tableData, $id, $skip);
+                       convertSelectionsToEpocheTime($postData, $tableData, $id, $skip);
 
                        // Shall we process this id? It muss not be empty, of course
                        if (($skip === false) && (!empty($id)) && ((!isset($GLOBALS['skip_config'][$id]))) || ($tableName != '_config')) {
index ba88edb..43d32d8 100644 (file)
@@ -52,8 +52,8 @@ if ((isFormSent('add')) && (isPostRequestParameterSet('url'))) {
        $postData = postRequestArray();
 
        // Convert the "reload selections"
-       // @TODO Find all convertSelectionsToTimestamp() calls and rewrite postRequestParameter() calls to $postData
-       convertSelectionsToTimestamp($postData, $DATA, $id, $skip);
+       // @TODO Find all convertSelectionsToEpocheTime() calls and rewrite postRequestParameter() calls to $postData
+       convertSelectionsToEpocheTime($postData, $DATA, $id, $skip);
 
        // Then add this URL
        if (SURFBAR_ADMIN_ADD_URL($postData['url'], $postData['limit'], $postData['reload'])) {
index f013cb1..84c277f 100644 (file)
@@ -52,11 +52,11 @@ if (!isExtensionActive('other')) {
 // Stop saving data if one input field is !isset
 if (isFormSent()) {
        // Calculate stamps and set calculated stamps
-       setPostRequestParameter('online_timeout'       , createTimestampFromSelections('ip_timeout'           , postRequestArray()));
-       setPostRequestParameter('url_tlock'            , createTimestampFromSelections('url_tlock'            , postRequestArray()));
-       setPostRequestParameter('profile_lock'         , createTimestampFromSelections('profile_lock'         , postRequestArray()));
-       setPostRequestParameter('profile_update'       , createTimestampFromSelections('profile_update'       , postRequestArray()));
-       setPostRequestParameter('resend_profile_update', createTimestampFromSelections('resend_profile_update', postRequestArray()));
+       setPostRequestParameter('online_timeout'       , createEpocheTimeFromSelections('ip_timeout'           , postRequestArray()));
+       setPostRequestParameter('url_tlock'            , createEpocheTimeFromSelections('url_tlock'            , postRequestArray()));
+       setPostRequestParameter('profile_lock'         , createEpocheTimeFromSelections('profile_lock'         , postRequestArray()));
+       setPostRequestParameter('profile_update'       , createEpocheTimeFromSelections('profile_update'       , postRequestArray()));
+       setPostRequestParameter('resend_profile_update', createEpocheTimeFromSelections('resend_profile_update', postRequestArray()));
 
        // Online-Timeout shall be > 0 or your database will crow and crow and crow...
        if (!isPostRequestParameterSet('online_timeout'))        { unsetPostRequestParameter('ok'); }
index 99ae08b..0dc37b8 100644 (file)
@@ -47,7 +47,7 @@ addYouAreHereLink('admin', __FILE__);
 
 if (isFormSent()) {
        // Calculate timestamp from selections...
-       setPostRequestParameter('ip_timeout', createTimestampFromSelections('ip_timeout', postRequestArray()));
+       setPostRequestParameter('ip_timeout', createEpocheTimeFromSelections('ip_timeout', postRequestArray()));
        setPostRequestParameter('least_cats', round(postRequestParameter('least_cats')));
 
        // Save settings
index d4e519a..9df887c 100644 (file)
@@ -138,7 +138,7 @@ LIMIT 1",
 
                                        // Convert time selection
                                        $DATA = array(); $id = 'warning_interval_ye'; $skip = false;
-                                       convertSelectionsToTimestamp(postRequestArray(), $DATA, $id, $skip);
+                                       convertSelectionsToEpocheTime(postRequestArray(), $DATA, $id, $skip);
 
                                        // Save the sponsor
                                        handleSponsorRequest(postRequestArray());
index b762286..713c121 100644 (file)
@@ -74,7 +74,7 @@ WHERE
                $content['id']              = getRequestParameter('id');
                //  Contact data
                $content['email_link']      = generateEmailLink($content['email'], 'sponsor_data');
-               //  Timestamps
+               //  Epoche times
                $content['sponsor_created'] = generateDateTime($content['sponsor_created'], 2);
                $content['last_online']     = generateDateTime($content['last_online'], 2);
                $content['last_change']     = generateDateTime($content['last_change'], 2);
index 523f00c..20514fd 100644 (file)
@@ -48,19 +48,16 @@ if (!isExtensionActive('order')) {
        return;
 } // END - if
 
-// Set empty mode to "select"
-if (!isGetRequestParameterSet('mode')) setGetRequestParameter('mode', 'select');
+// 'mode' is not set by default
+if (!isGetRequestParameterSet('mode')) {
+       // Set empty mode to "select"
+       setGetRequestParameter('mode', 'select');
+} // END - if
 
 if (isFormSent()) {
        // Deliver bonus mail
        addNewBonusMail(postRequestArray(), getRequestParameter('mode'));
 } else {
-       // Get all available users
-       $content['all'] = getRequestParameter('mode');
-
-       // Prepare option lines
-       $content['options_lines'] = getRequestParameter('mode');
-
        // Store send mode
        $content['mode'] = getRequestParameter('mode');
 
diff --git a/inc/modules/admin/what-send_coupon.php b/inc/modules/admin/what-send_coupon.php
new file mode 100644 (file)
index 0000000..2e4d66a
--- /dev/null
@@ -0,0 +1,67 @@
+<?php
+/************************************************************************
+ * Mailer v0.2.1-FINAL                                Start: 26/06/2011 *
+ * ===================                          Last change: 26/06/2011 *
+ *                                                                      *
+ * -------------------------------------------------------------------- *
+ * File              : what-send_coupon.php                             *
+ * -------------------------------------------------------------------- *
+ * Short description : Send out coupons                                 *
+ * -------------------------------------------------------------------- *
+ * Kurzbeschreibung  : Versenden von Gutscheinen                        *
+ * -------------------------------------------------------------------- *
+ * $Revision::                                                        $ *
+ * $Date::                                                            $ *
+ * $Tag:: 0.2.1-FINAL                                                 $ *
+ * $Author::                                                          $ *
+ * -------------------------------------------------------------------- *
+ * Copyright (c) 2003 - 2009 by Roland Haeder                           *
+ * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
+ * For more information visit: http://www.mxchange.org                  *
+ *                                                                      *
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or    *
+ * (at your option) any later version.                                  *
+ *                                                                      *
+ * This program is distributed in the hope that it will be useful,      *
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of       *
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the        *
+ * GNU General Public License for more details.                         *
+ *                                                                      *
+ * You should have received a copy of the GNU General Public License    *
+ * along with this program; if not, write to the Free Software          *
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston,               *
+ * MA  02110-1301  USA                                                  *
+ ************************************************************************/
+
+// Some security stuff...
+if ((!defined('__SECURITY')) || (!isAdmin())) {
+       die();
+} // END - if
+
+// Add description as navigation point
+addYouAreHereLink('admin', __FILE__);
+
+// Is the form sent?
+if (isFormSent()) {
+       // Are all required fields set?
+       if (!isPostRequestParameterSet('points')) {
+               // Points not entered
+               displayMessage('{--ADMIN_SEND_COUPON_POINTS_NOT_ENTERED--}');
+       } elseif (!isPostRequestParameterSet('description')) {
+               // Description not entered
+               displayMessage('{--ADMIN_SEND_COUPON_DESCRIPTION_NOT_ENTERED--}');
+       } else {
+               // All fields are set, so we can start looking for users who wants to receive coupons
+       }
+} else {
+       // Prepare some template data
+       $content['coupon_default_time_selection'] = createConfigurationTimeSelections('coupon_default_time', 'WDh');
+
+       // Load template
+       loadTemplate('admin_send_coupon', false, $content);
+}
+
+// [EOF]
+?>
index 2cad2b4..65abc76 100644 (file)
@@ -69,7 +69,7 @@ LIMIT 1",
        if (isExtensionInstalled('user')) {
                // Get timestamp from insert
                $content['user_status'] = getMaskedMessage('MEMBER_MAIL_BONUS_CONFIRMED_ON',
-                       generateDateTime(getTimestampFromUserStats('bonusid', $content['id']), 2)
+                       generateDateTime(getEpocheTimeFromUserStats('bonusid', $content['id']), 2)
                );
        } // END - if
 
@@ -110,7 +110,7 @@ LIMIT 1",
        if (isExtensionInstalled('user')) {
                // Get timestamp from insert
                $content['user_status'] = getMaskedMessage('MEMBER_MAIL_NORMAL_CONFIRMED_ON',
-                       generateDateTime(getTimestampFromUserStats('mailid', $content['id']), 2)
+                       generateDateTime(getEpocheTimeFromUserStats('mailid', $content['id']), 2)
                );
        } // END - if
 
index 9b27b66..02c2e4c 100644 (file)
@@ -1220,7 +1220,9 @@ function getYear ($timestamp = null) {
        // Is it cached?
        if (!isset($GLOBALS[__FUNCTION__][$timestamp])) {
                // null is time()
-               if (is_null($timestamp)) $timestamp = time();
+               if (is_null($timestamp)) {
+                       $timestamp = time();
+               } // END - if
 
                // Then create it
                $GLOBALS[__FUNCTION__][$timestamp] = date('Y', $timestamp);
index 8a7a59b..51d09b2 100644 (file)
@@ -1,5 +1,5 @@
 <tr>
-       <td colspan="2" class="fatal_error" align="center">
+       <td colspan="2" class="bottom fatal_error" align="center">
                <strong>$content</strong>
        </td>
 </tr>
index c242354..77206b7 100644 (file)
@@ -7,8 +7,8 @@
                <td>
                        <select name="cat" size="1" class="form_select">
                                <option value="X" disabled="disabled">{--PLEASE_SELECT--}</option>
-                               <option value="0">{--ALL_MEMBERS--} ({%pipe,getTotalReceivers,translateComma=$content[all]%})</option>
-                               {%pipe,generateCategoryOptionsList=$content[options_lines]%}
+                               <option value="0">{--ALL_MEMBERS--} ({%pipe,getTotalReceivers,translateComma=$content[mode]%})</option>
+                               {%pipe,generateCategoryOptionsList=$content[mode]%}
                        </select>
                </td>
        </tr>
diff --git a/templates/de/html/admin/admin_send_coupon.tpl b/templates/de/html/admin/admin_send_coupon.tpl
new file mode 100644 (file)
index 0000000..e077a0b
--- /dev/null
@@ -0,0 +1,36 @@
+<div align="center">
+<form accept-charset="UTF-8" action="{%url=modules.php?module=admin&amp;what=send_coupon%}" method="post">
+<table border="0" cellspacing="0" cellpadding="0" class="table dashed">
+       <tr>
+               <td class="table_header bottom" colspan="2" align="center">
+                       <strong>{--ADMIN_SEND_COUPON_TITLE--}:</strong>
+               </td>
+       </tr>
+       <tr>
+               <td class="bottom" align="right">{--ADMIN_SEND_COUPON_EXPIRATION_TIME--}:</td>
+               <td class="bottom" align="center">
+                       $content[coupon_default_time_selection]
+               </td>
+       </tr>
+       <tr>
+               <td class="bottom" align="right">{--ADMIN_SEND_COUPON_POINTS--}:</td>
+               <td class="bottom" align="center">
+                       <input type="input" name="points" class="form_field" value="{%config,translateComma=coupon_default_points%}" size="5" maxlength="20" />
+                       <span class="tiny">({?POINTS?})</span>
+               </td>
+       </tr>
+       <tr>
+               <td class="bottom" align="right" valign="top" style="padding-top:5px">{--ADMIN_SEND_COUPON_ENTER_DESCRIPTION--}:</td>
+               <td class="bottom" align="center">
+                       <textarea name="description" class="form_field" rows="10" cols="50"></textarea>
+               </td>
+       </tr>
+       <tr>
+               <td class="table_footer" colspan="2" align="center">
+                       <input type="reset" class="form_reset" value="{--CLEAR_FORM--}" />
+                       <input type="submit" class="form_submit" name="ok" value="{--ADMIN_SEND_COUPON--}" />
+               </td>
+       </tr>
+</table>
+</form>
+</div>