Version 4.5.0

This commit is contained in:
Neo committed 2025-12-19 05:51:58 -08:00
1 parent 1a0c7fd3c2
commit f79dcf067a
3791 files changed
+248032 -76372

No files matched your search

+20 -8
View File
@@ -12,7 +12,7 @@
namespace IPS\calendar;
/* To prevent PHP errors (extending class does not exist) revealing path */
if ( !defined( '\IPS\SUITE_UNIQUE_KEY' ) )
if ( !\defined( '\IPS\SUITE_UNIQUE_KEY' ) )
{
header( ( isset( $_SERVER['SERVER_PROTOCOL'] ) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0' ) . ' 403 Forbidden' );
exit;
@@ -233,7 +233,7 @@ class _Date extends \IPS\DateTime
else
{
$validTimezone = TRUE;
if( in_array( \IPS\Member::loggedIn()->timezone, static::getTimezoneIdentifiers() ) )
if( \in_array( \IPS\Member::loggedIn()->timezone, static::getTimezoneIdentifiers() ) )
{
try
{
@@ -268,7 +268,7 @@ class _Date extends \IPS\DateTime
$datetime = new \IPS\DateTime( $datetime, $timezone );
/* Now correct it back if necessary */
if( $forceUTC === TRUE AND \IPS\Member::loggedIn()->timezone )
if( $forceUTC === TRUE AND \IPS\Dispatcher::hasInstance() AND \IPS\Member::loggedIn()->timezone )
{
$datetime->setTimezone( new \DateTimeZone( \IPS\Member::loggedIn()->timezone ) );
}
@@ -291,6 +291,11 @@ class _Date extends \IPS\DateTime
return static::getDate( gmdate( 'Y', $datetime->getTimestamp() ), gmdate( 'm', $datetime->getTimestamp() ), gmdate( 'd', $datetime->getTimestamp() ), gmdate( 'H', $datetime->getTimestamp() ), gmdate( 'i', $datetime->getTimestamp() ), gmdate( 's', $datetime->getTimestamp() ) );
}
/**
* @brief Cache results of getDayNames() for performance
*/
protected static $cachedDayNames = NULL;
/**
* Get the localized day names in correct order
*
@@ -299,6 +304,11 @@ class _Date extends \IPS\DateTime
*/
public static function getDayNames()
{
if( static::$cachedDayNames !== NULL )
{
return static::$cachedDayNames;
}
$dayNames = array();
$startDay = \IPS\Settings::i()->ipb_calendar_mon ? 'Monday' : 'Sunday';
@@ -310,6 +320,8 @@ class _Date extends \IPS\DateTime
$dayNames[] = array( 'full' => \IPS\Member::loggedIn()->language()->convertString( strftime( '%A', $_time ) ), 'english' => date( 'l', $_time ), 'abbreviated' => $_abbr, 'letter' => mb_substr( $_abbr, 0, 1 ), 'ical' => mb_strtoupper( mb_substr( date( 'D', $_time ), 0, 2 ) ) );
}
static::$cachedDayNames = $dayNames;
return $dayNames;
}
@@ -422,9 +434,9 @@ class _Date extends \IPS\DateTime
/* Make sure we have 3 pieces and that all are 2 digits */
$_timeBits = explode( ':', $time );
if ( count( $_timeBits ) < 3 )
if ( \count( $_timeBits ) < 3 )
{
while( count( $_timeBits ) < 3 )
while( \count( $_timeBits ) < 3 )
{
$_timeBits[] = '00';
}
@@ -768,7 +780,7 @@ class _Date extends \IPS\DateTime
* Returns whether the current locale uses AM/PM or 24 hour format
*
* @return bool
* @link <a href='http://stackoverflow.com/questions/6871258/how-to-determine-if-current-locale-has-24-hour-or-12-hour-time-format-in-php'>Check for 24 hour locale use</a>
* @see <a href='http://stackoverflow.com/questions/6871258/how-to-determine-if-current-locale-has-24-hour-or-12-hour-time-format-in-php'>Check for 24 hour locale use</a>
*/
public static function usesAmPm()
{
@@ -778,7 +790,7 @@ class _Date extends \IPS\DateTime
/**
* Get the 12 hour version of an hour value
*
* @param int Hour The hour value between 0 and 23
* @param int $hour The hour value between 0 and 23
* @return int
*/
public static function getTwelveHour( $hour )
@@ -800,7 +812,7 @@ class _Date extends \IPS\DateTime
/**
* Get the AM/PM value for the current locale
*
* @param int Hour The hour value between 0 and 23
* @param int $hour The hour value between 0 and 23
* @return string
*/
public static function getAmPm( $hour )