//*****************************************
The php calendar component
written by TJ @triconsole
//*****************************************
Localization version & support by ciprianmp
- it includes all the updates/fixes in the
corresponding version of the original class
//*****************************************

//*****************************************
version 3.80 (12 Jun 2024)

fixed: code revamp for php8.3 compatibility
	- thanks ciprianmp

//*****************************************
version 3.79 (11 Jun 2022)

fixed: PHP Deprecated : Passing null to parameter - on php8.1 with function trim() and is_file()
	- thanks ciprianmp

//*****************************************
version 3.78-loc (20 Mar 2021)
//*****************************************

fixed: possible vulnerabilities on boolean input variables
    - thanks Patrick O'Keeffe

//*****************************************
version 3.77-loc (20 Feb 2021)
//*****************************************
fixed: deprecated issue found on php8
    - thanks Guy Snelling

add on: encapsulate functions on php classes
    - thanks Tri

updated: constructor on tc_date.php and tc_date_main.php
    - thanks Tri

//*****************************************
version 3.76-loc (14 Feb 2021)
//*****************************************
fixed: XSS on PHP_SELF server variable
	- thanks Akash Chathoth

//*****************************************
version 3.75-loc (07 January 2017)
//*****************************************
updated: Date.prototype function in calendar.js
	- thanks ciprianmp

fixed a bug which caused a strange behaviour for date 30 when there is no selection (selectable but warned as disabled even when not, disabled in dropdowns and an empty tooltip showing up)
	- thanks Tri

fixed a bug which allowed negative values to be sent from outside the class (probably by code injection/hacking attempts)
	- thanks Tri

fixed a layout bug when show_fb_info is set to false
	- thanks ciprianmp

fixed: check_internet_connection() script
	- thanks ciprianmp

add on: Uzbek language added
	- thanks Akbar Mirsidikov

fixed: tc_date and tc_date_main classes for broader php compatibility
	- thanks ciprianmp

add on: Finish language added
	- thanks Ilja Mäki

add on: Lithuanian language added
	- thanks Martynas Vanagas

add on: automatic read of available themes
	- thanks ciprianmp

updated: Date.prototype function in calendar.js
	- thanks ciprianmp

add on: calendar theme ('theme1', 'theme2', 'theme3') - function setTheme(theme_name)
	- thanks Tri

add on: buffer calendar output for print on screen later - function getScript()
	- thanks Tri

fixed: calendar auto hide glitch on Internet Explorer and Opera browser
	- thanks Sébastien

fixed: javascript split array support for Safari
	- thanks Tri

add on: month dropdown options use colors to differentiate between month statuses (enabled/disabled)
	- thanks ciprianmp

add on: disabled months cannot be selected in month dropdown anymore (option disabled, less annoying)
	- thanks ciprianmp

add on: day dropdown options use colors to differentiate between day statuses (weekday enabled/disabled, weekday, weekend)
	- thanks ciprianmp

add on: disabled days cannot be selected in day dropdown anymore (option disabled, less annoying)
	- thanks ciprianmp

//*****************************************
version 3.74 (29 January 2015)
//*****************************************
add lang: "Server Timezone:"
	- thanks ciprianmp

updated: optimized and add functions to reduce parameter sending over calendar pages
	- thanks Tri

fixed: minor bug fixed, error on function checkSpecifyDate() and prevent date-allow input errors
	- thanks ciprianmp

fixed: checkdate() function generated an error on some php servers
	- thanks Tri

fixed: major bug fixed, for dropdown selection, only picked 2 values out of 3 (year null after selection)
	- thanks Tri and ciprianmp

//*****************************************
version 3.73 (7 October 2014)
//*****************************************
fixed: applied a Turkish fix for i vs I usage in function names php<5.5 on Linux bug (http://trac.roundcube.net/ticket/1485470)
	- thanks ciprianmp and Tri

add on: Timezone function
	- thanks Tri

updated: vulnerabilities update on REQUEST parameter
	- thanks Arvid V.

fixed: minor bugs fixed on unset calendar value
	- thanks Tri

fixed: tooltips are not displayed on Safari browser (windows)
	- thanks Larry

fixed: an error when choose day and month, and year dropdown to null (first item on dropdown)
	- thanks Marco

add on: an event colors specified on calendar.css, alternative to the tooltip icons or use both
	- thanks Larry

fixed: the year interval limitation (1970/2038) has been eliminated for the entire class (timestamps not used anymore)
	- thanks Tri

fixed: recursive tooltips can now be set outside the limited interval 1970-2037
	- thanks ciprianmp

add on: Tooltips function
	- thanks ciprianmp

//*****************************************
version 3.72 (25 July 2014)
//*****************************************
add on: automatic check for an updated version available
	- thanks Tri

add on: built the FB page of the class and embedded the Like action button in the About section
	- thanks ciprianmp

add on: About icon, credits & version info displayed on hovering the About icon
	- thanks Tri and ciprianmp

add on: implemented the setToolTips() function to display infos for any date on calendar form
	- thanks ciprianmp and TJ

fixed: checkdate() function generated an error on some php servers
	- thanks Tri

add on: implemented the genitive month names in date long formats, for languages that require that approach (CZ, GR, FI, PL, RU, SK, SR, UK)
	- thanks ciprianmp

add on: all digits are now converted into indic/arabic/thai versions, optionally
	- thanks ciprianmp

adjust: most images converted to gif for smaller sizes (except the pngs that need transparency)
	- thanks ciprianmp

fixed: Incorrect next month display show on 'February 2008'
	- thanks Neeraj Jain for bug report

fixed: Incorrect month comparable on calendar_form.php line 113
	- thanks Djenan Ganic, Ian Parsons, Jesse Davis for bug report

add on: date on calendar form change upon textbox in datepicker mode
add on: validate date enter from dropdown and textbox

fixed: Calendar path not valid when select date from dropdown
	- thanks yamba for bug report

adjust: add new function setWidth and deprecate getDayNum function

fixed: year combo box display not correct when extend its value
	- thanks Luiz Augusto for bug report

fixed on date and month value return that is not leading by '0'

adjust: change php short open tag (<?=) to normal tag (<?php)
	- thanks Michael Lynch

add on: getMonthNames() function to make custom month names on each language
	- thanks Jean-Francois Harrington

add on: button close on datepicker on the top-right corner of calendar
	- thanks denis

fixed: hide javascript alert when default date not defined
	- thanks jon-b

fixed: incorrect layout when select part of date
	- thanks simonzebu (I just got what you said :) )

fixed: not support date('N') for php version lower 5.0.1 so change to date('w') instead
	- thanks simonzebu, Kamil, greensilver for bug report
	- thanks Paul for the solution

add on: setHeight() function to set the height of iframe container of calendar
	- thanks Nolochemcial

add on: startMonday() function to set calendar display first day of week on Monday - deprecated since 3.61 and replaced by startDate()

fixed: don't display year when not in year interval

fixed: day combobox not update when select date from calendar
	- thanks ciprianmp

add on: disabledDay() function to let the calendar disabled on specified day
	- thanks Jim R.

fixed: total number of days startup incorrect
	- thanks Francois du Toit, ciprianmp

add on: setAlignment() and setDatePair() function
	- thanks ciprianmp and many guys guiding this :)

fixed: the header of calendar looks tight when day's header more than 2 characters, this can be adjusted by increasing width on calendar.css [#calendar-body td div { width: 15px; }]
	- thanks ciprianmp

add on: setSpecificDate() to enable or disable specific date
	- thanks ciprianmp, phillip, and Steve to suggest this

utilizing and cleaning up some codes on tc_calendar.php, calendar_form.php, and calendar.js
	- thanks Peter

added: 2 functions for php version that does not support json
	- thanks Steve

fixed: javascript error on datepair function on v3.50 and 3.51
	- thanks ciprianmp

fixed: writeYear bug from $date_allow1 & 2 must be changed to $time_allow1 & 2
	- thanks ciprianmp again :(

updated: setSpecificDate can be set month, year, and no recursive simultaneously
	- thanks ciprianmp, Steve

add on: setOnChange to handling javascript onChange event

fixed: dateAllow contains error on calendar_form.php
	- thanks matthijs

fixed: error on calendar.js function checkSpecifyDate
	- thanks Todd

fixed: the value of calendar is not restored when using back button on browser
	- thanks Nicolai

add on: add X as background of disabled days
	- thanks SanSar

fixed: 'Day' combobox contain no list dropdown when not call setDate() on initialization
	- thanks Fulin

fixed: Fixed display style still have the default value in case the date is disabled.
	- thanks ciprianmp

fixed: today date color disappear when date is disabled.
	- thanks ciprianmp

fixed: javascript error from IE compatible not support for JSON
	- thanks ciprianmp

adjusted: change the color of today date to green with border
	- thanks ciprianmp

adjusted: rearrange source code on calendar_form.php for future use

add on: showWeeks function
	- thanks Michael

add on: support for RTL (right-to-left output)
	- thanks ciprianmp

add on: startDate function and will be used instead of startMonday

changed: make the DatePair function selectable on any dates. Date-from must be before Date-to, and on the other hand, otherwise it will be reset
	- thanks Chris, Rickard, ciprianmp

fixed: incorrect parameter submited on javascript that caused an invalid date returned
	- thanks ciprianmp

fixed: date selected hilight error
	- thanks John

add on: auto hide calendar
	- thanks Wayne, Chris

add on: auto focus an overlapping calendar to the top

fixed: json checking function return error when server does not support for json
	- thanks strangeplant

fixed: javascript possible error on Date.parse
fixed: add on-change javascript in dropdown datepicker mode (missing previously)
	- thanks Alex

fixed: 1st and 31st are always disabled when running with php4
	- thanks dl

changed: use DateTime php class for php version >= 5.3.0 to support year 2038 and later

fixed: valid today date checked with date allow
	- thanks ciprianmp

updated: calendar.js on Date.prototype.format
	- thanks Haravikk