-
- // Prepare it for the template
- define('__HOLIDAY_START', MAKE_DATETIME($start , "3"));
- define('__HOLIDAY_END' , MAKE_DATETIME($end , "3"));
- define('__HOLIDAY_LOCK' , MAKE_DATETIME($locked, "1"));
-
- // Load template
- LOAD_TEMPLATE("member_holiday_deactivate");
- }
- else
- {
- // Free memory
- SQL_FREERESULT($result);
-
- // Remove entry and reload URL
- $result = SQL_QUERY_ESC("UPDATE "._MYSQL_PREFIX."_user_data
-SET holiday_active='N'
-WHERE userid=%s LIMIT 1", array($GLOBALS['userid']), __FILE__, __LINE__);
- LOAD_URL("modules.php?module=login&what=holiday");
- return;
- }
- break;
-
- case 'N': // Display activation form
- // Starting day
- define('_START_DAY' , ADD_SELECTION("day" , date("d", (time() + ONE_DAY)), "start"));
- define('_START_MONTH', ADD_SELECTION("month", date("m", (time() + ONE_DAY)), "start"));
- define('_START_YEAR' , ADD_SELECTION("year" , date('Y', (time() + ONE_DAY)), "start"));
-
- // Calcualte ending date
- $D = date("d", time() + ONE_DAY + (ONE_DAY * $_CONFIG['holiday_max']));
- $M = date("m", time() + ONE_DAY + (ONE_DAY * $_CONFIG['holiday_max']));
- $Y = date('Y', time() + ONE_DAY + (ONE_DAY * $_CONFIG['holiday_max']));
-
- // Ending day
- define('_END_DAY' , ADD_SELECTION("day" , $D, "end"));
- define('_END_MONTH', ADD_SELECTION("month", $M, "end"));
- define('_END_YEAR' , ADD_SELECTION("year" , $Y, "end"));
-
- // Copy value from configuration
- define('__HOLIDAY_MAX', $_CONFIG['holiday_max']);
-
- // Output form
- LOAD_TEMPLATE("member_holiday_form");
- break;
+ break;
+
+ case 'N': // Display activation form
+ // Cache timestamps
+ $startingStamp = time() + getConfig('ONE_DAY');
+ $endingStamp = $startingStamp + (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' , 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;