]> git.mxchange.org Git - mailer.git/blobdiff - inc/modules/member/what-holiday.php
Some improvements:
[mailer.git] / inc / modules / member / what-holiday.php
index 082004c4d91ed419d29acd4b82359270b35e2c77..e1b6872cff5cec7351aa1fc30a4d1929112dd5a1 100644 (file)
@@ -16,8 +16,8 @@
  * $Author::                                                          $ *
  * -------------------------------------------------------------------- *
  * Copyright (c) 2003 - 2009 by Roland Haeder                           *
- * Copyright (c) 2009 - 2011 by Mailer Developer Team                   *
- * For more information visit: http://www.mxchange.org                  *
+ * Copyright (c) 2009 - 2012 by Mailer Developer Team                   *
+ * For more information visit: http://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 *
@@ -37,7 +37,7 @@
 
 // Some security stuff...
 if (!defined('__SECURITY')) {
-       die();
+       exit();
 } elseif (!isMember()) {
        redirectToIndexMemberOnlyModule();
 }
@@ -119,14 +119,15 @@ if (isFormSent()) {
                unsetPostRequestElement('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')",
+               SQL_QUERY_ESC("INSERT INTO `{?_MYSQL_PREFIX?}_user_holidays` (`userid`, `holiday_start`, `holiday_end`, `comments`) VALUES ('%s','%s','%s','%s')",
                        array(getMemberId(), $START, $content['holiday_end'], postRequestElement('comments')), __FILE__, __LINE__);
 
                // Activate holiday system
                SQL_QUERY_ESC("UPDATE
        `{?_MYSQL_PREFIX?}_user_data`
 SET
-       `holiday_active`='N', `holiday_activated`=UNIX_TIMESTAMP()
+       `holiday_active`='N',
+       `holiday_activated`=UNIX_TIMESTAMP()
 WHERE
        `userid`=%s
 LIMIT 1",
@@ -160,14 +161,15 @@ LIMIT 1",
 if (isPostRequestElementSet('stop')) {
        // Okay, end the holiday here...
        $result = SQL_QUERY_ESC("SELECT
-       `holiday_active`,`holiday_activated`
+       `holiday_active`,
+       `holiday_activated`
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
        `userid`=%s
 LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
 
-       // Do we have an entry?
+       // Is there an entry?
        if (SQL_NUMROWS($result) == 1) {
                // Merge arrays
                $content = merge_array($content, SQL_FETCHARRAY($result));
@@ -175,7 +177,8 @@ LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
                if (($content['holiday_active'] == 'Y') && (($content['holiday_activated'] + getConfig('holiday_lock')) < time())) {
                        // Load data
                        $result2 = SQL_QUERY_ESC("SELECT
-       `holiday_start`,`holiday_end`
+       `holiday_start`,
+       `holiday_end`
 FROM
        `{?_MYSQL_PREFIX?}_user_holidays`
 WHERE
@@ -190,7 +193,8 @@ LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
                                $content['end']   = generateDateTime($content['holiday_end']  , 3);
 
                                // Deactivate it now
-                               SQL_QUERY_ESC("UPDATE `{?_MYSQL_PREFIX?}_user_data`
+                               SQL_QUERY_ESC("UPDATE
+       `{?_MYSQL_PREFIX?}_user_data`
 SET
        `holiday_active`='N',
        `holiday_activated`=0
@@ -236,7 +240,8 @@ LIMIT 1",
 if ((!isFormSent()) && (!isPostRequestElementSet('stop'))) {
        // Check if user is in holiday...
        $result = SQL_QUERY_ESC("SELECT
-       `holiday_active`,`holiday_activated`
+       `holiday_active`,
+       `holiday_activated`
 FROM
        `{?_MYSQL_PREFIX?}_user_data`
 WHERE
@@ -252,7 +257,8 @@ LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
                        case 'Y': // Display deactivation form
                                // Load starting and ending date
                                $result = SQL_QUERY_ESC("SELECT
-       `holiday_start`,`holiday_end`
+       `holiday_start`,
+       `holiday_end`
 FROM
        `{?_MYSQL_PREFIX?}_user_holidays`
 WHERE
@@ -268,7 +274,7 @@ LIMIT 1", array(getMemberId()), __FILE__, __LINE__);
                                        $content['lock']  = generateDateTime($content['holiday_activated'], 1);
 
                                        // Load template
-                                       loadTemplate('member_holiday_deactivate', false, $content);
+                                       loadTemplate('member_holiday_deactivate', FALSE, $content);
                                } else {
                                        // Free memory
                                        SQL_FREERESULT($result);
@@ -306,7 +312,7 @@ LIMIT 1",
                                $content['end_year']  = addSelectionBox('year' , getYear($endingStamp) , 'end');
 
                                // Output form
-                               loadTemplate('member_holiday_form', false, $content);
+                               loadTemplate('member_holiday_form', FALSE, $content);
                                break;
                } // END - switch
        } else {