27 $this->allow_smtp = $rbacsystem->checkAccess(
'smtp_mail', MAIL_SETTINGS_ID);
28 $this->user_id = $ilUser->getId();
30 $this->result = array();
41 private function addResult($login, $firstname, $lastname, $type)
43 if(count($this->result) > $this->max_entries)
48 if (isset($this->setMap[$login]))
51 $tmp =
new stdClass();
55 if($firstname && $lastname)
57 $label .=
" [" . $firstname .
", " . $lastname .
"]";
61 $this->result[] = $tmp;
63 $this->setMap[$login] = 1;
83 abook.firstname firstname,
84 abook.lastname lastname,
86 FROM addressbook abook
87 WHERE abook.user_id = ".$ilDB->quote($this->user_id,
'integer').
"
88 AND abook.login IS NOT NULL
89 AND (". $ilDB->like(
'abook.login',
'text', $a_search).
"
90 OR ".$ilDB->like(
'abook.firstname',
'text', $a_search).
"
91 OR ".$ilDB->like(
'abook.lastname',
'text', $a_search).
"
94 $union_query_1 =
"SELECT DISTINCT
96 abook.firstname firstname,
97 abook.lastname lastname,
99 FROM addressbook abook
100 WHERE abook.user_id = ".$ilDB->quote($this->user_id,
'integer').
"
101 AND abook.login IS NULL
102 AND (".$ilDB->like(
'abook.email',
'text', $a_search).
"
103 OR ".$ilDB->like(
'abook.firstname',
'text', $a_search).
"
104 OR ".$ilDB->like(
'abook.lastname',
'text', $a_search).
"
107 $union_query_2 =
"SELECT DISTINCT
113 WHERE ".$ilDB->like(
'mail.rcp_to',
'text', $a_search).
"
114 AND sender_id = ".$ilDB->quote($this->user_id,
'integer').
"
115 AND mail.sender_id = mail.user_id";
118 'addressbook_1' =>
$query,
119 'mail' => $union_query_2
122 if($this->allow_smtp == 1)
123 $queries[
'addressbook_2'] = $union_query_1;
125 include_once
'Services/Utilities/classes/class.ilStr.php';
130 if($ilDB->getDbType() !=
'oracle')
131 $queries[
'all'] = implode(
' UNION ', $queries);
133 foreach($queries as $type =>
$query)
136 if(
'mail' == $type && $ilDB->getDbType() ==
'oracle')
141 $ilDB->setLimit(0,20);
142 $query_res = $ilDB->query(
$query );
144 while(
$row = $ilDB->fetchObject($query_res))
146 if(
$row->type ==
'mail')
148 if(strpos(
$row->login,
',') || strpos(
$row->login,
';'))
150 $parts = preg_split(
"/[ ]*[;,][ ]*/", trim(
$row->login));
151 foreach($parts as $part)