diff --git a/lib/WebGUI/DateTime.pm b/lib/WebGUI/DateTime.pm index 482f2fcec..556918681 100644 --- a/lib/WebGUI/DateTime.pm +++ b/lib/WebGUI/DateTime.pm @@ -484,14 +484,14 @@ Returns an array of time elements. The elements are: years, months, days, hours, =item epoch -The number of seconds since January 1, 1970. +The number of seconds since January 1, 1970. Defaults to now. =back =cut sub localtime { - return Date::Calc::Localtime($_[0]); + return Date::Calc::Localtime($_[0]||WebGUI::DateTime::time()); } #------------------------------------------------------------------- diff --git a/lib/WebGUI/Grouping.pm b/lib/WebGUI/Grouping.pm index db19142c6..b4a54d570 100755 --- a/lib/WebGUI/Grouping.pm +++ b/lib/WebGUI/Grouping.pm @@ -118,7 +118,7 @@ sub addUsersToGroups { my ($isIn) = WebGUI::SQL->quickArray("select count(*) from groupings where groupId=$gid and userId=$uid"); unless ($isIn) { WebGUI::SQL->write("insert into groupings (groupId,userId,expireDate) - values ($gid, $uid, ".(time()+$expireOffset).")"); + values ($gid, $uid, ".(WebGUI::DateTime::time()+$expireOffset).")"); } } } diff --git a/sbin/Hourly/EmptyTrash.pm b/sbin/Hourly/EmptyTrash.pm index 952415c7a..9500691fd 100644 --- a/sbin/Hourly/EmptyTrash.pm +++ b/sbin/Hourly/EmptyTrash.pm @@ -18,7 +18,7 @@ use WebGUI::SQL; #----------------------------------------- sub process { - my @date = WebGUI::DateTime::localtime(); + my @date = WebGUI::DateTime::localtime(WebGUI::DateTime::time()); if ($date[1] == $session{config}{EmptyTrash_day} && $date[4] == 1) { # only occurs at 1am on the day in question. WebGUI::ErrorHandler::audit("emptying system trash"); WebGUI::Operation::Trash::_recursePageTree(3); diff --git a/sbin/Hourly/NotifyExpiredGroupings.pm b/sbin/Hourly/NotifyExpiredGroupings.pm index ee70ebd3d..87d30411b 100644 --- a/sbin/Hourly/NotifyExpiredGroupings.pm +++ b/sbin/Hourly/NotifyExpiredGroupings.pm @@ -19,15 +19,16 @@ use WebGUI::SQL; #----------------------------------------- sub process { - my @date = WebGUI::DateTime::localtime(); + my @date = WebGUI::DateTime::localtime(WebGUI::DateTime::time()); if ($date[4] == 1) { # only occurs at 1am on the day in question. - my $now = time(); + my $now = WebGUI::DateTime::time(); my $a = WebGUI::SQL->read("select groupId,expireNotifyOffset,expireNotifyMessage from groups where expireNotify=1"); while (my $group = $a->hashRef) { my $start = $now + (86400 * $group->{expireNotifyOffset}); my $end = $start + 86400; - my $b = WebGUI::SQL->read("select userId from groupings where expireDate>=".$start." and expireDate<=".$end); + my $b = WebGUI::SQL->read("select userId from groupings where groupId=".$group->{groupId}." and + expireDate>=".$start." and expireDate<=".$end); while (my ($userId) = $b->array) { WebGUI::MessageLog::addEntry($userId,"",WebGUI::International::get(867),$group->{expireNotifyMessage}); } diff --git a/sbin/Hourly/SyncProfilesToLDAP.pm b/sbin/Hourly/SyncProfilesToLDAP.pm index 6653b52d5..942df435c 100644 --- a/sbin/Hourly/SyncProfilesToLDAP.pm +++ b/sbin/Hourly/SyncProfilesToLDAP.pm @@ -30,7 +30,7 @@ sub _alias { #------------------------------------------------------------------- sub process { my (@date, $userId, $u, $uri, $port, %args, $fieldName, $ldap, $search, $a, $b); - @date = WebGUI::DateTime::localtime(); + @date = WebGUI::DateTime::localtime(WebGUI::DateTime::time()); if ($date[3] == $session{config}{SyncProfilesToLDAP_hour}) { $a = WebGUI::SQL->read("select userId from users where authMethod='LDAP'"); while (($userId) = $a->array) {