Aleksander Machniak
2013-10-17 197203727417a03d87053a47e5aa5175a76e3e0b
program/include/rcube_ldap.php
@@ -770,24 +770,26 @@
            for ($i = 0; $i < $entries['count']; $i++) {
                $rec = $this->_ldap2result($entries[$i]);
                foreach (array('email', 'name') as $f) {
                    $val = mb_strtolower($rec[$f]);
                    switch ($mode) {
                    case 1:
                        $got = ($val == $search);
                        break;
                    case 2:
                        $got = ($search == substr($val, 0, strlen($search)));
                        break;
                    default:
                        $got = (strpos($val, $search) !== false);
                        break;
                    }
                foreach ($fields as $f) {
                    foreach ((array)$rec[$f] as $val) {
                        $val = mb_strtolower($val);
                        switch ($mode) {
                        case 1:
                            $got = ($val == $search);
                            break;
                        case 2:
                            $got = ($search == substr($val, 0, strlen($search)));
                            break;
                        default:
                            $got = (strpos($val, $search) !== false);
                            break;
                        }
                    if ($got) {
                        $this->result->add($rec);
                        $this->result->count++;
                        break;
                        if ($got) {
                            $this->result->add($rec);
                            $this->result->count++;
                            break 2;
                        }
                    }
                }
            }