X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=inc%2Fmodules%2Fmember%2Fwhat-holiday.php;h=88bdb0064d0d98593b034e0bf8ecd259b1986000;hb=7831e749e7590c640837bda20512fd6dbc5bb966;hp=ef2b99b8f4ae0e82ef5020cd96ce2c5816ee889a;hpb=58bd7e0df5e4bee593b7ad46d66d3b1acbec2886;p=mailer.git diff --git a/inc/modules/member/what-holiday.php b/inc/modules/member/what-holiday.php index ef2b99b8f4..88bdb0064d 100644 --- a/inc/modules/member/what-holiday.php +++ b/inc/modules/member/what-holiday.php @@ -14,11 +14,9 @@ * $Date:: $ * * $Tag:: 0.2.1-FINAL $ * * $Author:: $ * - * Needs to be in all Files and every File needs "svn propset * - * svn:keywords Date Revision" (autoprobset!) at least!!!!!! * * -------------------------------------------------------------------- * * Copyright (c) 2003 - 2009 by Roland Haeder * - * Copyright (c) 2009, 2010 by Mailer Developer Team * + * 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 * @@ -45,7 +43,7 @@ if (!defined('__SECURITY')) { } // Add description as navigation point -addMenuDescription('member', __FILE__); +addYouAreHereLink('member', __FILE__); if ((!isExtensionActive('holiday')) && (!isAdmin())) { loadTemplate('admin_settings_saved', false, generateExtensionInactiveNotInstalledMessage('holiday')); @@ -78,7 +76,7 @@ ORDER BY LIMIT 1", array(getMemberId()), __FILE__, __LINE__); if ((SQL_NUMROWS($result1) == 1) || (SQL_NUMROWS($result2) == 1)) { - // Mail order found! + // Mail order found $content = merge_array($content, SQL_FETCHARRAY($result1)); $content = merge_array($content, SQL_FETCHARRAY($result2)); @@ -100,7 +98,7 @@ if ((SQL_NUMROWS($result1) == 1) || (SQL_NUMROWS($result2) == 1)) { } // Display message and exit here - loadTemplate('admin_settings_saved', false, getMaskedMessage('HOLIDAY_MEMBER_ORDER', generateDateTime($stamp, 1))); + loadTemplate('admin_settings_saved', false, getMaskedMessage('MEMBER_HOLIDAY_ORDER', generateDateTime($stamp, 1))); return; } } // END - if @@ -116,7 +114,7 @@ if (isFormSent()) { // Test both values $TEST = $content['holiday_end'] - $START; - if (($TEST < 0) || ($TEST > (getConfig('ONE_DAY') * getConfig('holiday_max'))) || ($START < time()) || ($content['holiday_end'] < time())) { + if (($TEST < 0) || ($TEST > (getOneDay() * getConfig('holiday_max'))) || ($START < time()) || ($content['holiday_end'] < time())) { // Time test failed unsetPostRequestParameter('ok'); } else { @@ -145,7 +143,7 @@ LIMIT 1", // Send mail to member $message = loadEmailTemplate('member_holiday_request', $content, getMemberId()); - sendEmail(getMemberId(), '{--HOLIDAY_MEMBER_SUBJECT--}', $message); + sendEmail(getMemberId(), '{--MEMBER_HOLIDAY_SUBJECT--}', $message); // Send mail to all admins sendAdminNotification('{--ADMIN_HOLIDAY_SUBJECT--}', 'admin_holiday_request', $content, getMemberId()); @@ -154,7 +152,7 @@ LIMIT 1", createNewTask('{--ADMIN_HOLIDAY_SUBJECT--}', $message, 'HOLIDAY_REQUEST', getMemberId()); // Display message - loadTemplate('admin_settings_saved', false, '{--HOLIDAY_IS_ACTIVATED_NOW--}'); + loadTemplate('admin_settings_saved', false, '{--MEMBER_HOLIDAY_IS_ACTIVATED_NOW--}'); } } // END - if @@ -213,21 +211,21 @@ LIMIT 1", sendAdminNotification('{--ADMIN_HOLIDAY_DEAC_SUBJECT--}', 'admin_holiday_deactivated', $content, getMemberId()); // Display message to user - loadTemplate('admin_settings_saved', false, '{--HOLIDAY_MEMBER_DEACTIVATED_NOW--}'); + loadTemplate('admin_settings_saved', false, '{--MEMBER_HOLIDAY_DEACTIVATED_NOW--}'); } else { // Display message to user - loadTemplate('admin_settings_saved', false, '{--HOLIDAY_MEMBER_CANNOT_DEACTIVATE--}'); + loadTemplate('admin_settings_saved', false, '{--MEMBER_HOLIDAY_CANNOT_DEACTIVATE--}'); } // Free result SQL_FREERESULT($result2); } elseif ($content['holiday_active'] == 'Y') { // To fast! - loadTemplate('admin_settings_saved', false, '{--HOLIDAY_MEMBER_LOCKED--}'); + loadTemplate('admin_settings_saved', false, '{--MEMBER_HOLIDAY_LOCKED--}'); } } else { // User not found - loadTemplate('admin_settings_saved', false, getMaskedMessage('HOLIDAY_MEMBER_NOT_STOPPED_404', getMemberId())); + loadTemplate('admin_settings_saved', false, getMaskedMessage('MEMBER_HOLIDAY_NOT_STOPPED_404', getMemberId())); } // Free result @@ -250,8 +248,7 @@ LIMIT 1", array(getMemberId()), __FILE__, __LINE__); // Check for lock if (($content['holiday_activated'] + getConfig('holiday_lock')) < time()) { // User can deactivate his holiday request - switch ($content['holiday_active']) - { + switch ($content['holiday_active']) { case 'Y': // Display deactivation form // Load starting and ending date $result = SQL_QUERY_ESC("SELECT @@ -283,7 +280,8 @@ SET `holiday_active`='N' WHERE `userid`=%s -LIMIT 1", array(getMemberId()), __FILE__, __LINE__); +LIMIT 1", + array(getMemberId()), __FILE__, __LINE__); redirectToUrl('modules.php?module=login&what=holiday'); return; } @@ -293,28 +291,27 @@ LIMIT 1", array(getMemberId()), __FILE__, __LINE__); break; case 'N': // Display activation form - // Starting day - $content['start_day'] = addSelectionBox('day' , date('d', (time() + getConfig('ONE_DAY'))), 'start'); - $content['start_month'] = addSelectionBox('month', date('m', (time() + getConfig('ONE_DAY'))), 'start'); - $content['start_year'] = addSelectionBox('year' , date('Y', (time() + getConfig('ONE_DAY'))), 'start'); + // Cache timestamps + $startingStamp = time() + getOneDay(); + $endingStamp = $startingStamp + (getOneDay() * getConfig('holiday_max')); - // Calcualte ending date - $D = date('d', time() + getConfig('ONE_DAY') + (getConfig('ONE_DAY') * getConfig('holiday_max'))); - $M = date('m', time() + getConfig('ONE_DAY') + (getConfig('ONE_DAY') * getConfig('holiday_max'))); - $Y = date('Y', time() + getConfig('ONE_DAY') + (getConfig('ONE_DAY') * 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'); // Ending day - $content['end_day'] = addSelectionBox('day' , $D, 'end'); - $content['end_month'] = addSelectionBox('month', $M, 'end'); - $content['end_year'] = addSelectionBox('year' , $Y, 'end'); + $content['end_day'] = addSelectionBox('day' , getDay($endingStamp) , 'end'); + $content['end_month'] = addSelectionBox('month', getMonth($endingStamp), 'end'); + $content['end_year'] = addSelectionBox('year' , getYear($endingStamp) , 'end'); // Output form loadTemplate('member_holiday_form', false, $content); break; - } + } // END - switch } else { // To fast! - loadTemplate('admin_settings_saved', false, '{--HOLIDAY_MEMBER_LOCKED--}'); + loadTemplate('admin_settings_saved', false, '{--MEMBER_HOLIDAY_LOCKED--}'); } } // END - if