42 define(
'SOCKET_TIMEOUT',5);
47 include_once
'./Services/Administration/classes/class.ilSetting.php';
54 include_once
'./Services/Logging/classes/class.ilLog.php';
61 function txt($language,
$key,$module =
'common')
63 include_once
'./Services/Language/classes/class.ilLanguage.php';
85 $two_weeks_in_seconds = 60 * 60 * 24 * 14;
87 $this->log->write(
'Cron: Start checkUserAccounts()');
88 $query =
"SELECT * FROM usr_data,usr_pref ".
89 "WHERE time_limit_message = ".$ilDB->quote(0,
"integer").
" ".
90 "AND time_limit_unlimited = ".$ilDB->quote(0,
"integer").
" ".
91 "AND time_limit_from < ".$ilDB->quote(time(),
"integer").
" ".
92 "AND time_limit_until > ".$ilDB->quote($two_weeks_in_seconds,
"integer").
" ".
93 "AND usr_data.usr_id = usr_pref.usr_id ".
94 "AND keyword = ".$ilDB->quote(
"language",
"text");
98 while(
$row = $ilDB->fetchObject(
$res))
100 include_once
'./Services/Mail/classes/class.ilMimeMail.php';
102 $data[
'expires'] =
$row->time_limit_until;
110 $query =
"SELECT email FROM usr_data WHERE usr_id = ".$ilDB->quote(
$data[
'owner'],
"integer");
112 $res2 = $this->db->query(
$query);
122 $mail->To(
$data[
'email']);
123 $mail->Subject($this->
txt(
$data[
'language'],
'account_expires_subject'));
124 $mail->Body($this->
txt(
$data[
'language'],
'account_expires_body').
" ".strftime(
'%Y-%m-%d %R',
$data[
'expires']));
128 $query =
"UPDATE usr_data SET time_limit_message = ".$ilDB->quote(1,
"integer").
129 " WHERE usr_id = ".$ilDB->quote(
$data[
'usr_id'],
"integer");
130 $ilDB->manipulate(
$query);
133 $this->log->write(
'Cron: (checkUserAccounts()) sent message to '.
$data[
'login'].
'.');
141 include_once
'./classes/class.ilLinkChecker.php';
144 $link_checker->setMailStatus(
true);
146 $invalid = $link_checker->checkLinks();
147 foreach($link_checker->getLogMessages() as $message)
149 $this->log->write($message);
157 return $this->setting->get($a_keyword);