46 $two_weeks_in_seconds = 60 * 60 * 24 * 14;
48 $this->log->write(
'Cron: Start ilCronCheckUserAccounts::check()');
50 $query =
"SELECT * FROM usr_data,usr_pref ".
51 "WHERE time_limit_message = '0' ".
52 "AND time_limit_unlimited = '0' ".
53 "AND time_limit_from < '".time().
"' ".
54 "AND time_limit_until > '".$two_weeks_in_seconds.
"' ".
55 "AND usr_data.usr_id = usr_pref.usr_id ".
56 "AND keyword = 'language'";
58 $res = $this->db->query($query);
62 include_once
'Services/Mail/classes/class.ilMimeMail.php';
64 $data[
'expires'] = $row->time_limit_until;
65 $data[
'email'] = $row->email;
66 $data[
'login'] = $row->login;
67 $data[
'usr_id'] = $row->usr_id;
68 $data[
'language'] = $row->value;
69 $data[
'owner'] = $row->time_limit_owner;
74 $mail->From(
'noreply');
75 $mail->To(
$data[
'email']);
76 $mail->Subject($this->
txt(
$data[
'language'],
'account_expires_subject'));
77 $mail->Body($this->
txt(
$data[
'language'],
'account_expires_body').
" ".strftime(
'%Y-%m-%d %R',
$data[
'expires']));
81 $query =
"UPDATE usr_data SET time_limit_message = '1' WHERE usr_id = '".$data[
'usr_id'].
"'";
82 $this->db->query($query);
85 $this->log->write(
'Cron: (checkUserAccounts()) sent message to '.
$data[
'login'].
'.');
90 $this->log->write(
'Cron: End ilCronCheckUserAccounts::check()');
92 function txt($language,$key,$module =
'common')
94 $query =
"SELECT value FROM lng_data ".
95 "WHERE module = '".$module.
"' ".
96 "AND identifier = '".$key.
"' ".
97 "AND lang_key = '".$language.
"'";
99 $res = $this->db->query($query);
102 $value = $row->value;
104 return $value ? $value : $key;