]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-holiday.php
Fixes for unset config entries and ['header'] entry
[mailer.git] / inc / modules / member / what-holiday.php
index c7fdc9d51b2b8b9ea3507c25a93d3adf52769047..3c9344564add25c726df6043c85e3a9a880a05af 100644 (file)
@@ -1,7 +1,7 @@
 <?php
 /************************************************************************
- * MXChange v0.2.1                                    Start: 07/24/2004 *
- * ================                             Last change: 07/31/2004 *
+ * Mailer v0.2.1-FINAL                                Start: 07/24/2004 *
+ * ===================                          Last change: 07/31/2004 *
  *                                                                      *
  * -------------------------------------------------------------------- *
  * File              : what-holiday.php                                 *
@@ -63,7 +63,7 @@ WHERE
        `sender`=%s
 ORDER BY
        `timestamp` DESC
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
 
 // Check for sent mail orders in stats
 $result2 = SQL_QUERY_ESC("SELECT
@@ -74,7 +74,7 @@ WHERE
        `userid`=%s
 ORDER BY
        `timestamp_ordered` DESC
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
 
 if ((SQL_NUMROWS($result1) == 1) || (SQL_NUMROWS($result2) == 1)) {
        // Mail order found!
@@ -82,13 +82,13 @@ if ((SQL_NUMROWS($result1) == 1) || (SQL_NUMROWS($result2) == 1)) {
        $content = merge_array($content, SQL_FETCHARRAY($result2));
 
        // Fix missing entries
-       if (empty($content['timestamp'])) $content['timestamp'] = 0;
-       if (empty($content['timestamp_ordered'])) $content['timestamp_ordered'] = 0;
+       if (empty($content['timestamp'])) $content['timestamp'] = '0';
+       if (empty($content['timestamp_ordered'])) $content['timestamp_ordered'] = '0';
 
        if ((($content['timestamp'] + getConfig('holiday_lock')) > time()) || (($content['timestamp_ordered'] + getConfig('holiday_lock')) > time())) {
                // Mail order is to close away!
-               unsetPostRequestElement('ok');
-               unsetPostRequestElement('stop');
+               unsetPostRequestParameter('ok');
+               unsetPostRequestParameter('stop');
 
                if (($content['timestamp'] + getConfig('holiday_lock')) > time()) {
                        // Mail found in pool
@@ -99,7 +99,7 @@ if ((SQL_NUMROWS($result1) == 1) || (SQL_NUMROWS($result2) == 1)) {
                }
 
                // Display message and exit here
-               loadTemplate('admin_settings_saved', false, sprintf(getMessage('HOLIDAY_MEMBER_ORDER'), generateDateTime($stamp, 1)));
+               loadTemplate('admin_settings_saved', false, getMaskedMessage('HOLIDAY_MEMBER_ORDER', generateDateTime($stamp, 1)));
                return;
        }
 } // END - if
@@ -110,18 +110,18 @@ SQL_FREERESULT($result2);
 
 if (isFormSent()) {
        // Check holiday request...
-       $START = mktime(0, 0, 0, postRequestElement('start_month'), postRequestElement('start_day'), postRequestElement('start_year'));
-       $content['holiday_end']   = mktime(0, 0, 0, postRequestElement('end_month')  , postRequestElement('end_day')  , postRequestElement('end_year')  );
+       $START = mktime(0, 0, 0, postRequestParameter('start_month'), postRequestParameter('start_day'), postRequestParameter('start_year'));
+       $content['holiday_end']   = mktime(0, 0, 0, postRequestParameter('end_month')  , postRequestParameter('end_day')  , postRequestParameter('end_year')  );
 
        // Test both values
        $TEST = $content['holiday_end'] - $START;
        if (($TEST < 0) || ($TEST > (getConfig('ONE_DAY') * getConfig('holiday_max'))) || ($START < time()) || ($content['holiday_end'] < time())) {
                // Time test failed
-               unsetPostRequestElement('ok');
+               unsetPostRequestParameter('ok');
        } else {
                // Everything went okay so let's store his request and send mails
                SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_holidays` (`userid`, `holiday_start`, `holiday_end`, `comments`) VALUES ('%s','%s','%s','%s')",
-                       array(getUserId(), $START, $content['holiday_end'], postRequestElement('comments')), __FILE__, __LINE__);
+                       array(getMemberId(), $START, $content['holiday_end'], postRequestParameter('comments')), __FILE__, __LINE__);
 
                // Activate holiday system
                SQL_QUERY_ESC("UPDATE
@@ -131,26 +131,26 @@ SET
 WHERE
        `userid`=%s
 LIMIT 1",
-                       array(getUserId()), __FILE__, __LINE__);
+                       array(getMemberId()), __FILE__, __LINE__);
 
                // Prepare constants
-               $content['start_day']   = bigintval(postRequestElement('start_day'));
-               $content['start_month'] = $GLOBALS['month_descr'][postRequestElement('start_month')];
-               $content['start_year']  = bigintval(postRequestElement('start_year'));
-               $content['end_day']     = bigintval(postRequestElement('end_day'));
-               $content['end_month']   = $GLOBALS['month_descr'][postRequestElement('end_month')];
-               $content['end_year']    = bigintval(postRequestElement('end_year'));
-               $content['comments']    = secureString(postRequestElement('comments'));
+               $content['start_day']   = bigintval(postRequestParameter('start_day'));
+               $content['start_month'] = $GLOBALS['month_descr'][postRequestParameter('start_month')];
+               $content['start_year']  = bigintval(postRequestParameter('start_year'));
+               $content['end_day']     = bigintval(postRequestParameter('end_day'));
+               $content['end_month']   = $GLOBALS['month_descr'][postRequestParameter('end_month')];
+               $content['end_year']    = bigintval(postRequestParameter('end_year'));
+               $content['comments']    = secureString(postRequestParameter('comments'));
 
                // Send mail to member
-               $message = loadEmailTemplate('member_holiday_request', $content, getUserId());
-               sendEmail(getUserId(), getMessage('HOLIDAY_MEMBER_SUBJECT'), $message);
+               $message = loadEmailTemplate('member_holiday_request', $content, getMemberId());
+               sendEmail(getMemberId(), getMessage('HOLIDAY_MEMBER_SUBJECT'), $message);
 
                // Send mail to all admins
-               sendAdminNotification(getMessage('HOLIDAY_ADMIN_SUBJECT'), 'admin_holiday_request', $content, getUserId());
+               sendAdminNotification(getMessage('HOLIDAY_ADMIN_SUBJECT'), 'admin_holiday_request', $content, getMemberId());
 
                // Create task
-               createNewTask('{--HOLIDAY_ADMIN_SUBJECT--}', $message, 'HOLIDAY_REQUEST', getUserId());
+               createNewTask('{--HOLIDAY_ADMIN_SUBJECT--}', $message, 'HOLIDAY_REQUEST', getMemberId());
 
                // Display message
                loadTemplate('admin_settings_saved', false, getMessage('HOLIDAY_IS_ACTIVATED_NOW'));
@@ -158,7 +158,7 @@ LIMIT 1",
 } // END - if
 
 // Holiday shall be ended now
-if (isPostRequestElementSet('stop')) {
+if (isPostRequestParameterSet('stop')) {
        // Okay, end the holiday here...
        $result = SQL_QUERY_ESC("SELECT
        `holiday_active`, `holiday_activated`
@@ -166,7 +166,7 @@ FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
        `userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
        $content = merge_array($content, SQL_FETCHARRAY($result));
        SQL_FREERESULT($result);
 
@@ -178,7 +178,7 @@ FROM
        `{?_MYSQL_PREFIX?}_user_holidays`
 WHERE
        `userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
                if (SQL_NUMROWS($result) == 1) {
                        // Data was found
                        $content = merge_array($content, SQL_FETCHARRAY($result));
@@ -196,7 +196,7 @@ SET
 WHERE
        `userid`=%s
 LIMIT 1",
-                               array(getUserId()), __FILE__, __LINE__);
+                               array(getMemberId()), __FILE__, __LINE__);
 
                        // Remove entry
                        SQL_QUERY_ESC("DELETE LOW_PRIORITY FROM
@@ -204,10 +204,10 @@ LIMIT 1",
 WHERE
        `userid`=%s
 LIMIT 1",
-                               array(getUserId()), __FILE__, __LINE__);
+                               array(getMemberId()), __FILE__, __LINE__);
 
                        // Send email to admin
-                       sendAdminNotification(getMessage('HOLIDAY_ADMIN_DEAC_SUBJ'), 'admin_holiday_deactivated', $content, getUserId());
+                       sendAdminNotification(getMessage('HOLIDAY_ADMIN_DEAC_SUBJ'), 'admin_holiday_deactivated', $content, getMemberId());
 
                        // Display message to user
                        loadTemplate('admin_settings_saved', false, getMessage('HOLIDAY_MEMBER_DEACTIVATED_NOW'));
@@ -222,7 +222,7 @@ LIMIT 1",
 } // END - if
 
 // If something is wrong or link in menu is just clicked display form
-if ((!isFormSent()) && (!isPostRequestElementSet('stop'))) {
+if ((!isFormSent()) && (!isPostRequestParameterSet('stop'))) {
        // Check if user is in holiday...
        $result = SQL_QUERY_ESC("SELECT
        `holiday_active`, `holiday_activated`
@@ -230,7 +230,7 @@ FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
        `userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
        $content = SQL_FETCHARRAY($result);
        SQL_FREERESULT($result);
 
@@ -247,7 +247,7 @@ FROM
        `{?_MYSQL_PREFIX?}_user_holidays`
 WHERE
        `userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
                                if (SQL_NUMROWS($result) == 1) {
                                        // Data was found
                                        $content = merge_array($content, SQL_FETCHARRAY($result));
@@ -271,7 +271,7 @@ SET
        `holiday_active`='N'
 WHERE
        `userid`=%s
-LIMIT 1", array(getUserId()), __FILE__, __LINE__);
+LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
                                        redirectToUrl('modules.php?module=login&amp;what=holiday');
                                        return;
                                }