X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-holiday.php;h=a18cde4e14bfae13166c59e9f9a19493bd13668a;hb=cd7d344ea7007cfa20413acd3e03e50f0ab86d86;hp=e1b6872cff5cec7351aa1fc30a4d1929112dd5a1;hpb=596c8ab32594401ca84abfbfe35513ddfff31bec;p=mailer.git diff --git a/inc/modules/member/what-holiday.php b/inc/modules/member/what-holiday.php index e1b6872cff..a18cde4e14 100644 --- a/inc/modules/member/what-holiday.php +++ b/inc/modules/member/what-holiday.php @@ -16,7 +16,7 @@ * $Author:: $ * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009 - 2012 by Mailer Developer Team * + * Copyright (c) 2009 - 2013 by Mailer Developer Team * * For more information visit: http://mxchange.org * * * * This program is free software; you can redistribute it and/or modify * @@ -84,12 +84,12 @@ if ((SQL_NUMROWS($result1) == 1) || (SQL_NUMROWS($result2) == 1)) { 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())) { + if ((($content['timestamp'] + getHolidayLock()) > time()) || (($content['timestamp_ordered'] + getHolidayLock()) > time())) { // Mail order is to close away! unsetPostRequestElement('ok'); unsetPostRequestElement('stop'); - if (($content['timestamp'] + getConfig('holiday_lock')) > time()) { + if (($content['timestamp'] + getHolidayLock()) > time()) { // Mail found in pool $stamp = $content['timestamp']; } else { @@ -109,18 +109,23 @@ 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') ); + $content['holiday_start'] = mktime(0, 0, 0, postRequestElement('start_mo'), postRequestElement('start_da'), postRequestElement('start_ye')); + $content['holiday_end'] = mktime(0, 0, 0, postRequestElement('end_mo') , postRequestElement('end_da') , postRequestElement('end_ye') ); // Test both values - $TEST = $content['holiday_end'] - $START; - if (($TEST < 0) || ($TEST > (getOneDay() * getConfig('holiday_max'))) || ($START < time()) || ($content['holiday_end'] < time())) { + $TEST = $content['holiday_end'] - $content['holiday_start']; + if (($TEST < 0) || ($TEST > (getOneDay() * getConfig('holiday_max'))) || ($content['holiday_start'] < time()) || ($content['holiday_end'] < time())) { // Time test failed 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')", - array(getMemberId(), $START, $content['holiday_end'], postRequestElement('comments')), __FILE__, __LINE__); + array( + getMemberId(), + $content['holiday_start'], + $content['holiday_end'], + postRequestElement('comments') + ), __FILE__, __LINE__); // Activate holiday system SQL_QUERY_ESC("UPDATE @@ -174,7 +179,7 @@ LIMIT 1", array(getMemberId()), __FILE__, __LINE__); // Merge arrays $content = merge_array($content, SQL_FETCHARRAY($result)); - if (($content['holiday_active'] == 'Y') && (($content['holiday_activated'] + getConfig('holiday_lock')) < time())) { + if (($content['holiday_active'] == 'Y') && (($content['holiday_activated'] + getHolidayLock()) < time())) { // Load data $result2 = SQL_QUERY_ESC("SELECT `holiday_start`, @@ -251,7 +256,7 @@ LIMIT 1", array(getMemberId()), __FILE__, __LINE__); SQL_FREERESULT($result); // Check for lock - if (($content['holiday_activated'] + getConfig('holiday_lock')) < time()) { + if (($content['holiday_activated'] + getHolidayLock()) < time()) { // User can deactivate his holiday request switch ($content['holiday_active']) { case 'Y': // Display deactivation form @@ -302,14 +307,14 @@ LIMIT 1", $endingStamp = $startingStamp + (getOneDay() * getConfig('holiday_max')); // Starting day - $content['start_day'] = addSelectionBox('day' , getDay($startingStamp) , 'start'); - $content['start_month'] = addSelectionBox('month', getMonth($startingStamp), 'start'); - $content['start_year'] = addSelectionBox('year' , getYear($startingStamp) , 'start'); + $content['start_day'] = addSelectionBox('da', getDay($startingStamp) , 'start'); + $content['start_month'] = addSelectionBox('mo', getMonth($startingStamp), 'start'); + $content['start_year'] = addSelectionBox('ye', getYear($startingStamp) , 'start'); // Ending day - $content['end_day'] = addSelectionBox('day' , getDay($endingStamp) , 'end'); - $content['end_month'] = addSelectionBox('month', getMonth($endingStamp), 'end'); - $content['end_year'] = addSelectionBox('year' , getYear($endingStamp) , 'end'); + $content['end_day'] = addSelectionBox('da', getDay($endingStamp) , 'end'); + $content['end_month'] = addSelectionBox('mo', getMonth($endingStamp), 'end'); + $content['end_year'] = addSelectionBox('ye', getYear($endingStamp) , 'end'); // Output form loadTemplate('member_holiday_form', FALSE, $content);