diff --git a/api/src/Mail/Account.php b/api/src/Mail/Account.php index e256af5a5bb..f35609cae08 100644 --- a/api/src/Mail/Account.php +++ b/api/src/Mail/Account.php @@ -1483,9 +1483,10 @@ public static function delete($acc_id, $account_id=null) * @param int|boolean $offset =false offset or false to return all * @param int $num_rows =0 number of rows to return, 0=default from prefs (if $offset !== false) * @param boolean $replace_placeholders =true should placeholders like {{n_fn}} be replaced + * @param boolean $only_visible = false if set to true it skips the accounts with a name starting with a dot(.) * @return \Iterator with acc_id => acc_name or Account objects */ - public static function search($only_current_user=true, $just_name=true, $order_by=null, $offset=false, $num_rows=0, $replace_placeholders=true) + public static function search($only_current_user=true, $just_name=true, $order_by=null, $offset=false, $num_rows=0, $replace_placeholders=true, $only_visible = false) { //error_log(__METHOD__."($only_current_user, $just_name, '$order_by', $offset, $num_rows)"); $where = array(); @@ -1501,6 +1502,9 @@ public static function search($only_current_user=true, $just_name=true, $order_b 'account_id' => $account_id ? self::memberships($account_id) : 0 )); } + if($only_visible){ + $where[] = self::$db->strpos("egw_ea_accounts.acc_name","'.'" )." NOT IN (1) "; + } if (empty($order_by) || !preg_match('/^[a-z_]+ (ASC|DESC)$/i', $order_by)) { // for current user prefer account with ident_email matching user email or domain diff --git a/mail/inc/class.mail_tree.inc.php b/mail/inc/class.mail_tree.inc.php index 52c04094dd0..0d3dbc7dd4f 100644 --- a/mail/inc/class.mail_tree.inc.php +++ b/mail/inc/class.mail_tree.inc.php @@ -479,7 +479,7 @@ static function getAccountsRootNode($_profileID = null, $_noCheckbox = false, $_ { $roots = array(Tree::ID => 0, Tree::CHILDREN => array()); - foreach(Mail\Account::search(true, 'params') as $acc_id => $params) + foreach(Mail\Account::search(true, 'params', null, false, 0, true, true) as $acc_id => $params) { try { $accObj = new Mail\Account($params);