Replace hard coded timezone with function from date module
This commit is contained in:
@@ -122,15 +122,6 @@ function booking_admin() {
|
||||
'#default_value' => variable_get('booking_default_country', 'Australia'),
|
||||
);
|
||||
|
||||
$form['misc']['booking_local_timezone'] = array (
|
||||
'#type' => 'select',
|
||||
'#title' => t('Select Local Time Zone'),
|
||||
'#description' => t('Select time zone to use when calculating dates and times. This should match drupal\'s timezone definition'),
|
||||
'#options' => _booking_country_options(),
|
||||
'#default_value' => variable_get('booking_default_country', 'Australia'),
|
||||
);
|
||||
|
||||
|
||||
$form['misc']['booking_default_gender'] = array (
|
||||
'#type' => 'select',
|
||||
'#title' => t('Select Default Gender'),
|
||||
|
@@ -170,8 +170,8 @@ function _booking_change_status($nid, $status_id)
|
||||
|
||||
function _datearray_to_ts($date)
|
||||
{
|
||||
date_default_timezone_set(TIMEZONE);
|
||||
$tz = new DateTimeZone(TIMEZONE);
|
||||
date_default_timezone_set(date_default_timezone(FALSE));
|
||||
$tz = new DateTimeZone(date_default_timezone(FALSE));
|
||||
|
||||
if (empty($date) || ($date['month'] == '' && $date['day'] == '' && $date['year'] == ''))
|
||||
return 0;
|
||||
@@ -188,8 +188,8 @@ function _datearray_to_ts($date)
|
||||
function _datetime_array_to_ts($date)
|
||||
{
|
||||
//watchdog('booking', 'Date-time Conversion: @info', array('@info' => var_export($date, TRUE)));
|
||||
date_default_timezone_set(TIMEZONE);
|
||||
$tz = new DateTimeZone(TIMEZONE);
|
||||
date_default_timezone_set(date_default_timezone(FALSE));
|
||||
$tz = new DateTimeZone(date_default_timezone(FALSE));
|
||||
|
||||
if (empty($date) || ($date['month'] == '' && $date['day'] == '' && $date['year'] == ''))
|
||||
return 0;
|
||||
@@ -207,8 +207,8 @@ function _datetime_array_to_ts($date)
|
||||
function _date_to_ts($date) {
|
||||
$date_split = _booking_split_date($date);
|
||||
|
||||
date_default_timezone_set(TIMEZONE);
|
||||
$tz = new DateTimeZone(TIMEZONE);
|
||||
date_default_timezone_set(date_default_timezone(FALSE));
|
||||
$tz = new DateTimeZone(date_default_timezone(FALSE));
|
||||
|
||||
if ($date_split[0] == '-1' )
|
||||
return 0;
|
||||
@@ -226,8 +226,8 @@ function _date_to_ts($date) {
|
||||
function _datetime_to_ts($date) {
|
||||
$date_split = _booking_split_date($date);
|
||||
|
||||
date_default_timezone_set(TIMEZONE);
|
||||
$tz = new DateTimeZone(TIMEZONE);
|
||||
date_default_timezone_set(date_default_timezone(FALSE));
|
||||
$tz = new DateTimeZone(date_default_timezone(FALSE));
|
||||
|
||||
if ($date_split[0] == '-1' )
|
||||
return 0;
|
||||
@@ -268,8 +268,8 @@ function _datetime_to_ts_nonstrict($date) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
date_default_timezone_set(TIMEZONE);
|
||||
$tz = new DateTimeZone(TIMEZONE);
|
||||
date_default_timezone_set(date_default_timezone(FALSE));
|
||||
$tz = new DateTimeZone(date_default_timezone(FALSE));
|
||||
|
||||
//$gmt_ts = mktime($date_split[5], $date_split[6], 0, $date_split[2], $date_split[1], $date_split[3]);
|
||||
$gmt_ts = mktime($hour, $minute, $second, $month, $day, $year);
|
||||
@@ -315,8 +315,8 @@ function _arrange_date($date) {
|
||||
function _booking_convert_ts($timestamp)
|
||||
{
|
||||
//load the timestamp
|
||||
date_default_timezone_set(TIMEZONE);
|
||||
$tz = new DateTimeZone(TIMEZONE);
|
||||
date_default_timezone_set(date_default_timezone(FALSE));
|
||||
$tz = new DateTimeZone(date_default_timezone(FALSE));
|
||||
|
||||
$date = new DateTime("@$timestamp");
|
||||
$date->setTimezone($tz);
|
||||
|
@@ -19,7 +19,7 @@ define('EVENTID', 1);
|
||||
define('BOOKING_PAYPAL_SUBMIT_URL', 'https://www.paypal.com/cgi-bin/webscr');
|
||||
define('BOOKING_PAYPAL_SUBMIT_URL_SANDBOX', 'https://www.sandbox.paypal.com/cgi-bin/webscr');
|
||||
define('BOOKING_PAYPAL_IPN_PATH', 'system/booking_paypal/ipn');
|
||||
define('TIMEZONE', 'Australia/Sydney');
|
||||
define('date_default_timezone(FALSE)', 'Australia/Sydney');
|
||||
define('BOOKING_DEFAULT_STATE', 'NSW');
|
||||
//define('CUSTOM_EMAIL_COUNT', 10);
|
||||
//define('STUDYGROUP_COUNT', 7);
|
||||
@@ -68,7 +68,7 @@ module_load_include('inc', 'booking', 'booking.rooms');
|
||||
module_load_include('inc', 'booking', 'booking.rooms_admin');
|
||||
|
||||
function booking_init() {
|
||||
date_default_timezone_set(TIMEZONE);
|
||||
date_default_timezone_set(date_default_timezone(FALSE));
|
||||
global $event;
|
||||
|
||||
//reference - http://www.devdaily.com/drupal/drupal-7-sql-cheat-sheet-function-examples
|
||||
|
@@ -56,7 +56,7 @@ function booking_form($node, &$form_state, $inserting = FALSE) {
|
||||
$status_options = array();
|
||||
$payment_type_options = array();
|
||||
$partner_options = array();
|
||||
date_default_timezone_set(TIMEZONE);
|
||||
date_default_timezone_set(date_default_timezone(FALSE));
|
||||
|
||||
if (!empty($node))
|
||||
{
|
||||
|
Reference in New Issue
Block a user