thomascube
2012-02-01 7fb577bc8f7c0fd24c7d6119bdf87f3cee4a1418
program/include/rcube_ldap.php
@@ -107,7 +107,7 @@
            list($col, $type) = explode(':', $col);
            if (!is_array($this->coltypes[$col])) {
                $subtypes = $type ? array($type) : null;
                $this->coltypes[$col] = array('limit' => 2, 'subtypes' => $subtypes);
                $this->coltypes[$col] = array('limit' => 1, 'subtypes' => $subtypes);
            }
            elseif ($type) {
                $this->coltypes[$col]['subtypes'][] = $type;
@@ -117,8 +117,15 @@
                $this->fieldmap[$col] = $lf;
        }
        if ($this->fieldmap['street'] && $this->fieldmap['locality'])
            $this->coltypes['address'] = array('limit' => 1);
        if ($this->fieldmap['street'] && $this->fieldmap['locality']) {
            $this->coltypes['address'] = array('limit' => max(1, $this->coltypes['locality']['limit']), 'subtypes' => $this->coltypes['locality']['subtypes'], 'childs' => array());
            foreach (array('street','locality','zipcode','region','country') as $childcol) {
                if ($this->fieldmap[$childcol]) {
                    $this->coltypes['address']['childs'][$childcol] = array('type' => 'text');
                    unset($this->coltypes[$childcol]);  // remove address child col from global coltypes list
                }
            }
        }
        else if ($this->coltypes['address'])
            $this->coltypes['address'] = array('type' => 'textarea', 'childs' => null, 'limit' => 1, 'size' => 40);
@@ -1227,9 +1234,9 @@
                $attrs, 0, (int)$this->prop['sizelimit'], (int)$this->prop['timelimit'])
            ) {
                $entries_count = ldap_count_entries($this->conn, $this->ldap_result);
                $this->_debug("S: $count_entries record(s)");
                $this->_debug("S: $entries_count record(s)");
                return $count ? $count_entries : true;
                return $count ? $entries_count : true;
            }
            else {
                $this->_debug("S: ".ldap_error($this->conn));