roundcubemail/program/lib/Roundcube/rcube_addressbook.php
protected function compare_search_value($colname, $value, $search, $mode)
    {
        // The value is a date string, for date we'll
        // use only strict comparison (mode = 1)
        // @TODO: partial search, e.g. match only day and month
        if (in_array($colname, $this->date_cols)) {
            return (($value = rcube_utils::anytodatetime($value))
                && ($search = rcube_utils::anytodatetime($search))
                && $value->format('Ymd') == $search->format('Ymd'));
        }

        // Gender is a special value, must use strict comparison (#5757)
        if ($colname == 'gender') {
            $mode = self::SEARCH_STRICT;
        }

        // composite field, e.g. address
        foreach ((array)$value as $val) {
            $val = mb_strtolower($val);

            if ($mode & self::SEARCH_STRICT) {
                $got = ($val == $search);
            }
            else if ($mode & self::SEARCH_PREFIX) {
                $got = ($search == substr($val, 0, strlen($search)));
            }
            else {
                $got = (strpos($val, $search) !== false);
            }

            if ($got) {
                return true;
            }
        }

        return false;
    }
protected function compare_search_value($colname, $value, $search, $mode)
    {
        // The value is a date string, for date we'll
        // use only strict comparison (mode = 1)
        // @TODO: partial search, e.g. match only day and month
        if (in_array($colname, $this->date_cols)) {
            return (($value = rcube_utils::anytodatetime($value))
                && ($search = rcube_utils::anytodatetime($search))
                && $value->format('Ymd') == $search->format('Ymd'));
        }

        // Gender is a special value, must use strict comparison (#5757)
        if ($colname == 'gender') {
            $mode = self::SEARCH_STRICT;
        }

        // composite field, e.g. address
        foreach ((array)$value as $val) {
            $val = mb_strtolower($val);

            if ($mode & self::SEARCH_STRICT) {
                $got = ($val == $search);
            }
            else if ($mode & self::SEARCH_PREFIX) {
                $got = ($search == substr($val, 0, strlen($search)));
            }
            else {
                $got = (strpos($val, $search) !== false);
            }

            if ($got) {
                return true;
            }
        }

        return false;
    }
protected function compare_search_value ( $ colname , $ value , $ search , $ mode ) { // The value is a date string, for date we'll // use only strict comparison (mode = 1) // @TODO: partial search, e.g. match only day and month if ( in_array ( $ colname , $ this -> date_cols ) ) { return ( ( $ value = rcube_utils :: anytodatetime ( $ value ) ) && ( $ search = rcube_utils :: anytodatetime ( $ search ) ) && $ value -> format ( 'Ymd' ) == $ search -> format ( 'Ymd' ) ) ; } // Gender is a special value, must use strict comparison (#5757) if ( $ colname == 'gender' ) { $ mode = self :: SEARCH_STRICT ; } // composite field, e.g. address foreach ( ( array ) $ value as $ val ) { $ val = mb_strtolower ( $ val ) ; if ( $ mode & self :: SEARCH_STRICT ) { $ got = ( $ val == $ search ) ; } else if ( $ mode & self :: SEARCH_PREFIX ) { $ got = ( $ search == substr ( $ val , 0 , strlen ( $ search ) ) ) ; } else { $ got = ( strpos ( $ val , $ search ) !== false ) ; } if ( $ got ) { return true ; } } return false ; }
Compare search value with contact data

@param string       $colname Data name
@param string|array $value   Data value
@param string       $search  Search value
@param int          $mode    Search mode

@return bool Comparison result
Compare search value with contact data