48 $db = $DIC->database();
53 $lng = $DIC->language();
124 $query =
"SELECT rdat.title role_title,odat.title object_title, " .
125 " oref.ref_id object_ref " .
126 "FROM object_data rdat " .
127 "JOIN rbac_fa fa ON fa.rol_id = rdat.obj_id " .
128 "JOIN tree rtree ON rtree.child = fa.parent " .
129 "JOIN object_reference oref ON oref.ref_id = rtree.child " .
130 "JOIN object_data odat ON odat.obj_id = oref.obj_id " .
131 "WHERE rdat.obj_id = " . $this->db->quote($this->roleId,
'integer') .
" " .
132 "AND fa.assign = 'y' ";
134 if (!
$row = $this->db->fetchObject(
$res)) {
138 $object_title =
$row->object_title;
139 $object_ref =
$row->object_ref;
140 $role_title =
$row->role_title;
146 $local_part = $role_title;
149 $q =
"SELECT COUNT(DISTINCT dat.obj_id) count " .
150 "FROM object_data dat " .
151 "JOIN object_reference ref ON ref.obj_id = dat.obj_id " .
152 "JOIN tree ON tree.child = ref.ref_id " .
153 "WHERE title = " . $this->db->quote($object_title,
'text') .
" " .
154 "AND tree.tree = 1 ";
155 $res = $this->db->query($q);
156 $row = $this->db->fetchObject(
$res);
159 if (
$row->count > 1) {
167 if (
$domain != null && preg_match(
'/[\[\]\\]|[\x00-\x1f]|[\x28-\x29]|[;]/',
$domain)) {
174 (preg_match(
'/[()<>@,;:\\".\[\]]/',
$domain) ||
175 preg_match(
'/[^\x21-\x8f]/',
$domain))
183 if (strpos($role_title,
'il_') === 0 &&
$domain != null) {
184 $unambiguous_role_title = $role_title;
186 $pos = strpos($role_title,
'_', 3) + 1;
187 $local_part = substr(
190 strrpos($role_title,
'_') - $pos
201 $q =
"SELECT COUNT(DISTINCT dat.obj_id) count " .
202 "FROM object_data dat " .
203 "JOIN object_reference ref ON ref.obj_id = dat.obj_id " .
204 "JOIN tree ON tree.child = ref.ref_id " .
205 "WHERE title = " . $this->db->quote($local_part,
'text') .
" " .
206 "AND tree.tree = 1 ";
208 $q =
"SELECT COUNT(rd.obj_id) count " .
209 "FROM object_data rd " .
210 "JOIN rbac_fa fa ON rd.obj_id = fa.rol_id " .
211 "JOIN tree t ON t.child = fa.parent " .
212 "WHERE fa.assign = 'y' " .
213 "AND t.child = " . $this->db->quote($object_ref,
'integer') .
" " .
214 "AND rd.title LIKE " . $this->db->quote(
215 '%' . preg_replace(
'/([_%])/',
'\\\\$1', $local_part) .
'%',
220 $res = $this->db->query($q);
221 $row = $this->db->fetchObject(
$res);
225 if (
$row->count > 1) {
226 $local_part = $unambiguous_role_title;
233 if (preg_match(
'/[\\"\x00-\x1f]/', $local_part)) {
234 $local_part = $unambiguous_role_title;
236 if (!preg_match(
'/^[\\x00-\\x7E]+$/i', $local_part)) {
238 $local_part = $unambiguous_role_title;
244 $local_part =
'#' . $local_part;
247 if (preg_match(
'/[()<>@,;:.\[\]\x20]/', $local_part)) {
248 $local_part =
'"' . $local_part .
'"';
255 if ($this->localize) {
256 if (substr($role_title, 0, 3) ==
'il_') {
257 $phrase = $this->lng->txt(substr($role_title, 0, strrpos($role_title,
'_')));
259 $phrase = $role_title;
266 $phrase = preg_replace(
'/\s\s+/',
' ', $phrase);
267 $phrase = preg_replace(
'/[()<>@,;:\\".\[\]]/',
'', $phrase);
269 $mailbox = $phrase .
' <' . $mailbox .
'>';
274 $parser = $this->parserFactory->getParser((
string) $mailbox);
279 $res = $this->db->query(
"SELECT title FROM object_data WHERE obj_id = " . $this->db->quote($this->roleId,
'integer'));
280 if (
$row = $this->db->fetchObject(
$res)) {
281 return '#' .
$row->title;
value()
Returns the mailbox address of a role.
Class ilRoleMailboxAddress.
__construct(int $roleId, bool $localize=true, \ilMailRfc822AddressParserFactory $parserFactory=null, \ilDBInterface $db=null, \ilLanguage $lng=null)
ilRoleMailboxAddress constructor.
Class ilMailRfc822AddressParserFactory.
foreach($_POST as $key=> $value) $res
if(!array_key_exists('domain', $_REQUEST)) $domain