mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 08:00:12 +01:00
auditor can restore emails only to mydomain addresses
This commit is contained in:
parent
acee4749e0
commit
1744ff986d
@ -42,7 +42,7 @@ class ControllerMessageRestore extends Controller {
|
||||
|
||||
/* send the email to all the recipients of the original email if we are admin or auditor users */
|
||||
|
||||
if(Registry::get('admin_user') == 1 || Registry::get('auditor_user') == 1) {
|
||||
if(Registry::get('auditor_user') == 1) {
|
||||
$rcpt = $this->model_search_search->get_message_recipients($this->data['id']);
|
||||
}
|
||||
else {
|
||||
|
@ -405,14 +405,28 @@ class ModelSearchSearch extends Model {
|
||||
|
||||
public function get_message_recipients($id = '') {
|
||||
$rcpt = array();
|
||||
$domains = array();
|
||||
|
||||
if(Registry::get('auditor_user') == 0) { return $rcpt; }
|
||||
|
||||
$query = $this->db->query("SELECT `domain` FROM " . TABLE_DOMAIN);
|
||||
foreach($query->rows as $q) {
|
||||
array_push($domains, $q['domain']);
|
||||
}
|
||||
|
||||
$query = $this->db->query("SELECT `to` FROM " . VIEW_MESSAGES . " WHERE piler_id=?", array($id));
|
||||
|
||||
foreach($query->rows as $q) {
|
||||
$mydomain = 0;
|
||||
|
||||
foreach ($domains as $domain) {
|
||||
if(preg_match("/\@$domain$/", $q['to'])) { $mydomain = 1; break; }
|
||||
}
|
||||
|
||||
if($mydomain == 1) {
|
||||
array_push($rcpt, $q['to']);
|
||||
}
|
||||
}
|
||||
|
||||
return $rcpt;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user