mirror of
https://bitbucket.org/jsuto/piler.git
synced 2025-06-13 00:37:02 +02:00
Improved the ldap group email detection and display
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
@ -489,12 +489,10 @@ class ModelSearchSearch extends Model {
|
||||
|
||||
if(isset($query->rows)) {
|
||||
foreach($query->rows as $r) {
|
||||
if(!isset($rcpt[$r['id']]) && !in_array($r['to'], $SUPPRESS_RECIPIENTS)) {
|
||||
$srcpt[$r['id']] = $r['to'];
|
||||
$rcpt[$r['id']] = $r['to'];
|
||||
}
|
||||
else {
|
||||
if(Registry::get('auditor_user') == 1) { $rcpt[$r['id']] .= ",\n" . $r['to']; }
|
||||
if(!isset($rcpt[$r['id']])) { $rcpt[$r['id']] = []; }
|
||||
|
||||
if(Registry::get('auditor_user') == 1 || !in_array($r['to'], $SUPPRESS_RECIPIENTS)) {
|
||||
array_push($rcpt[$r['id']], $r['to']);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -542,8 +540,8 @@ class ModelSearchSearch extends Model {
|
||||
$m['shortfrom'] = make_short_string($m['from'], MAX_CGI_FROM_SUBJ_LEN);
|
||||
$m['from'] = escape_gt_lt_quote_symbols($m['from']);
|
||||
|
||||
isset($srcpt[$m['id']]) ? $m['shortto'] = $srcpt[$m['id']] : $m['shortto'] = '';
|
||||
isset($rcpt[$m['id']]) ? $m['to'] = $rcpt[$m['id']] : $m['to'] = '';
|
||||
$m['shortto'] = make_short_string($this->get_preferred_recipient($rcpt[$m['id']]), MAX_CGI_FROM_SUBJ_LEN);
|
||||
$m['to'] = escape_gt_lt_quote_symbols($m['to']);
|
||||
|
||||
|
||||
@ -586,6 +584,26 @@ class ModelSearchSearch extends Model {
|
||||
}
|
||||
|
||||
|
||||
private function get_preferred_recipient($arr = []) {
|
||||
$result = '';
|
||||
|
||||
$session = Registry::get('session');
|
||||
$group_emails = $session->get('group_emails');
|
||||
$user_emails = $session->get('user_emails');
|
||||
|
||||
if(count($arr) < 2 || (!$group_emails && !$user_emails) ) { return $arr[0]; }
|
||||
|
||||
foreach ($arr as $a) {
|
||||
if($result == '' && in_array($a, $group_emails)) { $result = $a; }
|
||||
if(in_array($a, $user_emails)) { $result = $a; }
|
||||
}
|
||||
|
||||
if($result == '') { $result = $arr[0]; }
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
public function get_message_addresses_in_my_domain($id = '') {
|
||||
$addr = array();
|
||||
$domains = array();
|
||||
|
Reference in New Issue
Block a user