mirror of
https://github.com/moodle/moodle.git
synced 2025-01-19 14:27:22 +01:00
Checking for the $CFG->timezone value as a last resort in the various user
date/time functions didn't work because there was no global $CFG; :O
This commit is contained in:
parent
516a684ad7
commit
d8ba183c39
@ -283,7 +283,7 @@ function usergetdate($date, $timezone=99) {
|
||||
/// Given a $date timestamp in GMT, returns an array
|
||||
/// that represents the date in user time
|
||||
|
||||
global $USER;
|
||||
global $USER, $CFG;
|
||||
|
||||
if ($timezone == 99) { // Work out the best timezone to use
|
||||
if (isset($USER->timezone)) { // A user is logged in
|
||||
@ -313,7 +313,7 @@ function usergetdate($date, $timezone=99) {
|
||||
function usertime($date, $timezone=99) {
|
||||
/// Given a GMT timestamp (seconds since epoch), offsets it by
|
||||
/// the timezone. eg 3pm in India is 3pm GMT - 7 * 3600 seconds
|
||||
global $USER;
|
||||
global $USER, $CFG;
|
||||
|
||||
if ($timezone == 99) { // Work out the best timezone to use
|
||||
if (isset($USER->timezone)) { // A user is logged in
|
||||
@ -331,7 +331,7 @@ function usertime($date, $timezone=99) {
|
||||
function usergetmidnight($date, $timezone=99) {
|
||||
/// Given a time, return the GMT timestamp of the most recent midnight
|
||||
/// for the current user.
|
||||
global $USER;
|
||||
global $USER, $CFG;
|
||||
|
||||
if ($timezone == 99) { // Work out the best timezone to use
|
||||
if (isset($USER->timezone)) { // A user is logged in
|
||||
@ -354,7 +354,7 @@ function usergetmidnight($date, $timezone=99) {
|
||||
|
||||
function usertimezone($timezone=99) {
|
||||
/// Returns a string that prints the user's timezone
|
||||
global $USER;
|
||||
global $USER, $CFG;
|
||||
|
||||
if ($timezone == 99) { // Work out the best timezone to use
|
||||
if (isset($USER->timezone)) { // A user is logged in
|
||||
|
Loading…
x
Reference in New Issue
Block a user