1<?
php declare(strict_types=1);
59 $this->db =
$DIC->database();
77 if (strlen($this->
settings->get(
'mail_incoming_mail',
'')) > 0) {
78 $this->incomingType = (int) $this->
settings->get(
'mail_incoming_mail');
82 if (strlen($this->
settings->get(
'mail_address_option',
'')) > 0) {
83 $this->emailAddressMode = (int) $this->
settings->get(
'mail_address_option');
88 $this->signature =
'';
91 $this->table_mail_options,
93 'user_id' => [
'integer', $this->usrId],
96 'linebreak' => [
'integer', $this->linebreak],
97 'signature' => [
'text', $this->signature],
98 'incoming_type' => [
'integer', $this->incomingType],
99 'mail_address_option' => [
'integer', $this->emailAddressMode],
105 protected function read() : void
108 'SELECT mail_options.cronjob_notification,',
109 'mail_options.signature, mail_options.linebreak, mail_options.incoming_type,',
110 'mail_options.mail_address_option, usr_data.email, usr_data.second_email',
112 'LEFT JOIN usr_data ON mail_options.user_id = usr_data.usr_id',
113 'WHERE mail_options.user_id = %s',
115 $res = $this->db->queryF(
120 $row = $this->db->fetchObject(
$res);
123 $this->signature = (
string) $row->signature;
124 $this->linebreak = (int) $row->linebreak;
125 $this->incomingType = (
int) $row->incoming_type;
126 $this->emailAddressMode = (int) $row->mail_address_option;
128 if (
false === filter_var(
131 [
'options' => [
'min_range' => self::INCOMING_LOCAL,
'max_range' => self::INCOMING_BOTH]]
136 if (
false === filter_var(
137 $this->emailAddressMode,
139 [
'options' => [
'min_range' => self::FIRST_EMAIL,
'max_range' => self::BOTH_EMAIL]]
144 $this->firstEmailAddress = (string) $row->email;
145 $this->secondEmailAddress = (
string) $row->second_email;
147 $this->mailTransportSettings->adjust($this->firstEmailAddress, $this->secondEmailAddress);
155 'linebreak' => [
'integer', (int) $this->
getLinebreak()],
160 if ($this->
settings->get(
'mail_notification')) {
163 $data[
'cronjob_notification'] = [
'integer', (int) self::lookupNotificationSetting($this->usrId)];
166 return $this->db->replace(
167 $this->table_mail_options,
169 'user_id' => [
'integer', $this->usrId]
263 $row =
$DIC->database()->fetchAssoc(
$DIC->database()->queryF(
264 'SELECT cronjob_notification FROM mail_options WHERE user_id = %s',
269 return (
int) $row[
'cronjob_notification'];
277 $emailAddresses = [];
281 if (strlen($this->secondEmailAddress)) {
283 } elseif (strlen($this->firstEmailAddress)) {
290 if (strlen($this->firstEmailAddress)) {
293 if (strlen($this->secondEmailAddress)) {
300 if (strlen($this->firstEmailAddress)) {
302 } elseif (strlen($this->secondEmailAddress)) {
309 return $emailAddresses;
An exception for terminatinating execution or to throw for unit testing.
Class ilMailOptions this class handles user mails.
setSignature(string $signature)
createMailOptionsEntry()
create entry in table_mail_options for a new user this method should only be called from createUser()
setEmailAddressMode(int $emailAddressMode)
static lookupNotificationSetting(int $usrId)
setLinebreak(int $linebreak)
setIsCronJobNotificationStatus(bool $isCronJobNotificationEnabled)
isCronJobNotificationEnabled()
$isCronJobNotificationEnabled
setIncomingType(int $incomingType)
__construct(int $usrId, ilMailTransportSettings $mailTransportSettings=null)
getExternalEmailAddresses()
if(!file_exists(getcwd() . '/ilias.ini.php'))
registration confirmation script for ilias
foreach($_POST as $key=> $value) $res