Преглед изворни кода

[ZF-7476]Line endings in Zend/Ldap

git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@17418 44c647ce-9c0f-0410-b52a-842ac1e357ba
yoshida@zend.co.jp пре 16 година
родитељ
комит
806ca2d590

+ 318 - 318
library/Zend/Ldap/Attribute.php

@@ -1,104 +1,104 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/**
- * Zend_Ldap_Attribute is a collection of LDAP attribute related functions.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Attribute
-{
-    const PASSWORD_HASH_MD5 = 'md5';
-    const PASSWORD_HASH_SHA = 'sha1';
-
-    /**
-     * Sets a LDAP attribute.
-     *
-     * @param  array $data
-     * @param  string $attribName
-     * @param  mixed $value
-     * @param  boolean $append
-     * @return void
-     */
-    public static function setAttribute(array &$data, $attribName, $value, $append = false)
-    {
-        $attribName = strtolower($attribName);
-        $valArray = array();
-        if (is_array($value) || ($value instanceof Traversable))
-        {
-            foreach ($value as $v)
-            {
-                $v = self::_valueToLdap($v);
-                if (!is_null($v)) $valArray[] = $v;
-            }
-        }
-        else if (!is_null($value))
-        {
-            $value = self::_valueToLdap($value);
-            if (!is_null($value)) $valArray[] = $value;
-        }
-
-        if ($append === true && isset($data[$attribName]))
-        {
-            if (is_string($data[$attribName])) $data[$attribName] = array($data[$attribName]);
-            $data[$attribName] = array_merge($data[$attribName], $valArray);
-        }
-        else
-        {
-            $data[$attribName] = $valArray;
-        }
-    }
-
-    /**
-     * Gets a LDAP attribute.
-     *
-     * @param  array $data
-     * @param  string $attribName
-     * @param  integer $index
-     * @return array|mixed
-     */
-    public static function getAttribute(array $data, $attribName, $index = null)
-    {
-        $attribName = strtolower($attribName);
-        if (is_null($index)) {
-            if (!isset($data[$attribName])) return array();
-            $retArray = array();
-            foreach ($data[$attribName] as $v)
-            {
-                $retArray[] = self::_valueFromLdap($v);
-            }
-            return $retArray;
-        } else if (is_int($index)) {
-            if (!isset($data[$attribName])) {
-                return null;
-            } else if ($index >= 0 && $index<count($data[$attribName])) {
-                return self::_valueFromLdap($data[$attribName][$index]);
-            } else {
-                return null;
-            }
-        }
-        return null;
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * Zend_Ldap_Attribute is a collection of LDAP attribute related functions.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Attribute
+{
+    const PASSWORD_HASH_MD5 = 'md5';
+    const PASSWORD_HASH_SHA = 'sha1';
+
+    /**
+     * Sets a LDAP attribute.
+     *
+     * @param  array $data
+     * @param  string $attribName
+     * @param  mixed $value
+     * @param  boolean $append
+     * @return void
+     */
+    public static function setAttribute(array &$data, $attribName, $value, $append = false)
+    {
+        $attribName = strtolower($attribName);
+        $valArray = array();
+        if (is_array($value) || ($value instanceof Traversable))
+        {
+            foreach ($value as $v)
+            {
+                $v = self::_valueToLdap($v);
+                if (!is_null($v)) $valArray[] = $v;
+            }
+        }
+        else if (!is_null($value))
+        {
+            $value = self::_valueToLdap($value);
+            if (!is_null($value)) $valArray[] = $value;
+        }
+
+        if ($append === true && isset($data[$attribName]))
+        {
+            if (is_string($data[$attribName])) $data[$attribName] = array($data[$attribName]);
+            $data[$attribName] = array_merge($data[$attribName], $valArray);
+        }
+        else
+        {
+            $data[$attribName] = $valArray;
+        }
+    }
+
+    /**
+     * Gets a LDAP attribute.
+     *
+     * @param  array $data
+     * @param  string $attribName
+     * @param  integer $index
+     * @return array|mixed
+     */
+    public static function getAttribute(array $data, $attribName, $index = null)
+    {
+        $attribName = strtolower($attribName);
+        if (is_null($index)) {
+            if (!isset($data[$attribName])) return array();
+            $retArray = array();
+            foreach ($data[$attribName] as $v)
+            {
+                $retArray[] = self::_valueFromLdap($v);
+            }
+            return $retArray;
+        } else if (is_int($index)) {
+            if (!isset($data[$attribName])) {
+                return null;
+            } else if ($index >= 0 && $index<count($data[$attribName])) {
+                return self::_valueFromLdap($data[$attribName][$index]);
+            } else {
+                return null;
+            }
+        }
+        return null;
     }
 
     /**
@@ -139,226 +139,226 @@ class Zend_Ldap_Attribute
         $attribName = strtolower($attribName);
         if (!isset($data[$attribName])) return;
         $data[$attribName] = array_values(array_unique($data[$attribName]));
-    }
-
-    /**
-     * Remove given values from a LDAP attribute
-     *
-     * @param array $data
-     * @param string $attribName
-     * @param mixed|array $value
-     * @return void
-     */
-    public static function removeFromAttribute(array &$data, $attribName, $value)
-    {
-        $attribName = strtolower($attribName);
+    }
+
+    /**
+     * Remove given values from a LDAP attribute
+     *
+     * @param array $data
+     * @param string $attribName
+     * @param mixed|array $value
+     * @return void
+     */
+    public static function removeFromAttribute(array &$data, $attribName, $value)
+    {
+        $attribName = strtolower($attribName);
         if (!isset($data[$attribName])) return;
 
         if (is_scalar($value)) {
             $value = array($value);
-        }
-
-        $valArray = array();
-        foreach ($value as $v)
-        {
-            $v = self::_valueToLdap($v);
-            if ($v !== null) $valArray[] = $v;
-        }
-
-        $resultArray = $data[$attribName];
-        foreach ($valArray as $rv) {
-            $keys = array_keys($resultArray, $rv);
-            foreach ($keys as $k) {
-                unset($resultArray[$k]);
-            }
-        }
-        $resultArray = array_values($resultArray);
-        $data[$attribName] = $resultArray;
-    }
-
-    private static function _valueToLdap($value)
-    {
-        if (is_string($value)) return $value;
-        else if (is_int($value) || is_float($value)) return (string)$value;
-        else if (is_bool($value)) return ($value === true) ? 'TRUE' : 'FALSE';
-        else if (is_object($value) || is_array($value)) return serialize($value);
-        else if (is_resource($value) && get_resource_type($value) === 'stream')
-            return stream_get_contents($value);
-        else return null;
-    }
-
-    private static function _valueFromLdap($value)
-    {
-        $value = (string)$value;
-        if ($value === 'TRUE') return true;
-        else if ($value === 'FALSE') return false;
-        else return $value;
-    }
-
-    /**
-     * Converts a PHP data type into its LDAP representation
-     *
-     * @param mixed $value
-     * @return string|null - null if the PHP data type cannot be converted.
-     */
-    public static function convertToLdapValue($value)
-    {
-        return self::_valueToLdap($value);
-    }
-
-    /**
-     * Converts an LDAP value into its PHP data type
-     *
-     * @param string $value
-     * @return mixed
-     */
-    public static function convertFromLdapValue($value)
-    {
-        return self::_valueFromLdap($value);
-    }
-
-    /**
-     * Converts a timestamp into its LDAP date/time representation
-     *
-     * @param integer $value
-     * @param boolean $utc
-     * @return string|null - null if the value cannot be converted.
-     */
-    public static function convertToLdapDateTimeValue($value, $utc = false)
-    {
-        return self::_valueToLdapDateTime($value, $utc);
-    }
-
-    /**
-     * Converts LDAP date/time representation into a timestamp
-     *
-     * @param string $value
-     * @return integer|null - null if the value cannot be converted.
-     */
-    public static function convertFromLdapDateTimeValue($value)
-    {
-        return self::_valueFromLdapDateTime($value);
-    }
-
-    /**
-     * Sets a LDAP password.
-     *
-     * @param  array $data
-     * @param  string $password
-     * @param  string $hashType
-     * @param  string $attribName
-     * @return null
-     */
-    public static function setPassword(array &$data, $password, $hashType = self::PASSWORD_HASH_MD5,
-        $attribName = 'userPassword')
-    {
+        }
+
+        $valArray = array();
+        foreach ($value as $v)
+        {
+            $v = self::_valueToLdap($v);
+            if ($v !== null) $valArray[] = $v;
+        }
+
+        $resultArray = $data[$attribName];
+        foreach ($valArray as $rv) {
+            $keys = array_keys($resultArray, $rv);
+            foreach ($keys as $k) {
+                unset($resultArray[$k]);
+            }
+        }
+        $resultArray = array_values($resultArray);
+        $data[$attribName] = $resultArray;
+    }
+
+    private static function _valueToLdap($value)
+    {
+        if (is_string($value)) return $value;
+        else if (is_int($value) || is_float($value)) return (string)$value;
+        else if (is_bool($value)) return ($value === true) ? 'TRUE' : 'FALSE';
+        else if (is_object($value) || is_array($value)) return serialize($value);
+        else if (is_resource($value) && get_resource_type($value) === 'stream')
+            return stream_get_contents($value);
+        else return null;
+    }
+
+    private static function _valueFromLdap($value)
+    {
+        $value = (string)$value;
+        if ($value === 'TRUE') return true;
+        else if ($value === 'FALSE') return false;
+        else return $value;
+    }
+
+    /**
+     * Converts a PHP data type into its LDAP representation
+     *
+     * @param mixed $value
+     * @return string|null - null if the PHP data type cannot be converted.
+     */
+    public static function convertToLdapValue($value)
+    {
+        return self::_valueToLdap($value);
+    }
+
+    /**
+     * Converts an LDAP value into its PHP data type
+     *
+     * @param string $value
+     * @return mixed
+     */
+    public static function convertFromLdapValue($value)
+    {
+        return self::_valueFromLdap($value);
+    }
+
+    /**
+     * Converts a timestamp into its LDAP date/time representation
+     *
+     * @param integer $value
+     * @param boolean $utc
+     * @return string|null - null if the value cannot be converted.
+     */
+    public static function convertToLdapDateTimeValue($value, $utc = false)
+    {
+        return self::_valueToLdapDateTime($value, $utc);
+    }
+
+    /**
+     * Converts LDAP date/time representation into a timestamp
+     *
+     * @param string $value
+     * @return integer|null - null if the value cannot be converted.
+     */
+    public static function convertFromLdapDateTimeValue($value)
+    {
+        return self::_valueFromLdapDateTime($value);
+    }
+
+    /**
+     * Sets a LDAP password.
+     *
+     * @param  array $data
+     * @param  string $password
+     * @param  string $hashType
+     * @param  string $attribName
+     * @return null
+     */
+    public static function setPassword(array &$data, $password, $hashType = self::PASSWORD_HASH_MD5,
+        $attribName = 'userPassword')
+    {
         $hash = self::createPassword($password, $hashType);
-        self::setAttribute($data, $attribName, $hash, false);
-    }
-
-    /**
-     * Creates a LDAP password.
-     *
-     * @param  string $password
-     * @param  string $hashType
-     * @return string
-     */
-    public static function createPassword($password, $hashType = self::PASSWORD_HASH_MD5)
-    {
-        switch ($hashType) {
-            case self::PASSWORD_HASH_SHA:
-                $rawHash = sha1($password, true);
-                $method = '{SHA}';
-                break;
-            case self::PASSWORD_HASH_MD5:
-            default:
-                $rawHash = md5($password, true);
-                $method = '{MD5}';
-                break;
-        }
-        return $method . base64_encode($rawHash);
-    }
-
-    /**
-     * Sets a LDAP date/time attribute.
-     *
-     * @param  array $data
-     * @param  string $attribName
-     * @param  integer|array $value
-     * @param  boolean $utc
-     * @param  boolean $append
-     * @return null
-     */
-    public static function setDateTimeAttribute(array &$data, $attribName, $value, $utc = false,
-        $append = false)
-    {
-        $convertedValues = array();
-        if (is_array($value) || ($value instanceof Traversable))
-        {
-            foreach ($value as $v) {
-                $v = self::_valueToLdapDateTime($v, $utc);
-                if (!is_null($v)) $convertedValues[] = $v;
-            }
-        }
-        else if (!is_null($value)) {
-            $value = self::_valueToLdapDateTime($value, $utc);
-            if (!is_null($value)) $convertedValues[] = $value;
-        }
-        self::setAttribute($data, $attribName, $convertedValues, $append);
-    }
-
-    private static function _valueToLdapDateTime($value, $utc)
-    {
-        if (is_int($value)) {
-            if ($utc === true) return gmdate('YmdHis', $value) . 'Z';
-            else return date('YmdHisO', $value);
-        }
-        else return null;
-    }
-
-    /**
-     * Gets a LDAP date/time attribute.
-     *
-     * @param  array $data
-     * @param  string $attribName
-     * @param  integer $index
-     * @return array|integer
-     */
-    public static function getDateTimeAttribute(array $data, $attribName, $index = null)
-    {
-        $values = self::getAttribute($data, $attribName, $index);
-        if (is_array($values)) {
-            for ($i = 0; $i<count($values); $i++) {
-                $newVal = self::_valueFromLdapDateTime($values[$i]);
-                if (!is_null($newVal)) $values[$i] = $newVal;
-            }
-        }
-        else $values = self::_valueFromLdapDateTime($values);
-        return $values;
-    }
-
-    private static function _valueFromLdapDateTime($value)
-    {
-        $matches = array();
-        if (preg_match('/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})([+-]\d{4}|Z)$/', $value, $matches)) {
-            $year = $matches[1];
-            $month = $matches[2];
-            $day = $matches[3];
-            $hour = $matches[4];
-            $minute = $matches[5];
-            $second = $matches[6];
-            $timezone = $matches[7];
-            $date = gmmktime($hour, $minute, $second, $month, $day, $year);
-            if ($timezone !== 'Z') {
-                $tzDirection = substr($timezone, 0, 1);
-                $tzOffsetHour = substr($timezone, 1, 2);
-                $tzOffsetMinute = substr($timezone, 3, 2);
-                $tzOffset = ($tzOffsetHour*60*60) + ($tzOffsetMinute*60);
-                if ($tzDirection == '+') $date -= $tzOffset;
-                else if ($tzDirection == '-') $date += $tzOffset;
-            }
-            return $date;
-        }
-        else return null;
-    }
+        self::setAttribute($data, $attribName, $hash, false);
+    }
+
+    /**
+     * Creates a LDAP password.
+     *
+     * @param  string $password
+     * @param  string $hashType
+     * @return string
+     */
+    public static function createPassword($password, $hashType = self::PASSWORD_HASH_MD5)
+    {
+        switch ($hashType) {
+            case self::PASSWORD_HASH_SHA:
+                $rawHash = sha1($password, true);
+                $method = '{SHA}';
+                break;
+            case self::PASSWORD_HASH_MD5:
+            default:
+                $rawHash = md5($password, true);
+                $method = '{MD5}';
+                break;
+        }
+        return $method . base64_encode($rawHash);
+    }
+
+    /**
+     * Sets a LDAP date/time attribute.
+     *
+     * @param  array $data
+     * @param  string $attribName
+     * @param  integer|array $value
+     * @param  boolean $utc
+     * @param  boolean $append
+     * @return null
+     */
+    public static function setDateTimeAttribute(array &$data, $attribName, $value, $utc = false,
+        $append = false)
+    {
+        $convertedValues = array();
+        if (is_array($value) || ($value instanceof Traversable))
+        {
+            foreach ($value as $v) {
+                $v = self::_valueToLdapDateTime($v, $utc);
+                if (!is_null($v)) $convertedValues[] = $v;
+            }
+        }
+        else if (!is_null($value)) {
+            $value = self::_valueToLdapDateTime($value, $utc);
+            if (!is_null($value)) $convertedValues[] = $value;
+        }
+        self::setAttribute($data, $attribName, $convertedValues, $append);
+    }
+
+    private static function _valueToLdapDateTime($value, $utc)
+    {
+        if (is_int($value)) {
+            if ($utc === true) return gmdate('YmdHis', $value) . 'Z';
+            else return date('YmdHisO', $value);
+        }
+        else return null;
+    }
+
+    /**
+     * Gets a LDAP date/time attribute.
+     *
+     * @param  array $data
+     * @param  string $attribName
+     * @param  integer $index
+     * @return array|integer
+     */
+    public static function getDateTimeAttribute(array $data, $attribName, $index = null)
+    {
+        $values = self::getAttribute($data, $attribName, $index);
+        if (is_array($values)) {
+            for ($i = 0; $i<count($values); $i++) {
+                $newVal = self::_valueFromLdapDateTime($values[$i]);
+                if (!is_null($newVal)) $values[$i] = $newVal;
+            }
+        }
+        else $values = self::_valueFromLdapDateTime($values);
+        return $values;
+    }
+
+    private static function _valueFromLdapDateTime($value)
+    {
+        $matches = array();
+        if (preg_match('/^(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})([+-]\d{4}|Z)$/', $value, $matches)) {
+            $year = $matches[1];
+            $month = $matches[2];
+            $day = $matches[3];
+            $hour = $matches[4];
+            $minute = $matches[5];
+            $second = $matches[6];
+            $timezone = $matches[7];
+            $date = gmmktime($hour, $minute, $second, $month, $day, $year);
+            if ($timezone !== 'Z') {
+                $tzDirection = substr($timezone, 0, 1);
+                $tzOffsetHour = substr($timezone, 1, 2);
+                $tzOffsetMinute = substr($timezone, 3, 2);
+                $tzOffset = ($tzOffsetHour*60*60) + ($tzOffsetMinute*60);
+                if ($tzDirection == '+') $date -= $tzOffset;
+                else if ($tzDirection == '-') $date += $tzOffset;
+            }
+            return $date;
+        }
+        else return null;
+    }
 }

+ 173 - 173
library/Zend/Ldap/Collection.php

@@ -1,54 +1,54 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/**
- * Zend_Ldap_Collection wraps a list of LDAP entries.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Collection implements Iterator, Countable
-{
-    /**
-     * Iterator
-     *
-     * @var Zend_Ldap_Collection_Iterator_Interface
-     */
-    protected $_iterator = null;
-
-    /**
-     * Current item number
-     *
-     * @var integer
-     */
-    protected $_currentNumber = -1;
-
-    /**
-     * Container for item caching to speed up multiple iterations
-     *
-     * @var array
-     */
-    protected $_cache = array();
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * Zend_Ldap_Collection wraps a list of LDAP entries.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Collection implements Iterator, Countable
+{
+    /**
+     * Iterator
+     *
+     * @var Zend_Ldap_Collection_Iterator_Interface
+     */
+    protected $_iterator = null;
+
+    /**
+     * Current item number
+     *
+     * @var integer
+     */
+    protected $_currentNumber = -1;
+
+    /**
+     * Container for item caching to speed up multiple iterations
+     *
+     * @var array
+     */
+    protected $_cache = array();
 
     /**
      * Constructor.
@@ -56,81 +56,81 @@ class Zend_Ldap_Collection implements Iterator, Countable
      * @param Zend_Ldap $ldap
      * @param Zend_Ldap_Collection_Iterator_Interface $iterator
      * @return void
-     */
-    public function __construct(Zend_Ldap_Collection_Iterator_Interface $iterator)
-    {
-        $this->_iterator = $iterator;
-    }
-
-    public function __destruct()
-    {
-        $this->close();
-    }
-
-    /**
-     * Closes the current result set
-     *
-     * @return boolean
-     */
-    public function close()
-    {
-        return $this->_iterator->close();
-    }
-
-    /**
-     * Get all entries as an array
-     *
-     * @return array
-     */
-    public function toArray()
-    {
-        $data = array();
-        foreach ($this as $item) {
-            $data[] = $item;
-        }
-        return $data;
-    }
-
-    /**
-     * Get first entry
-     *
-     * @return array
-     */
-    public function getFirst()
-    {
-        if ($this->count()>0) {
-            $this->rewind();
-            return $this->current();
-        }
-        else return null;
-    }
-
-    /**
-     * Returns the number of items in current result
-     * Implements Countable
-     *
-     * @return int
-     */
-    public function count()
-    {
-        return $this->_iterator->count();
-    }
-
-    /**
-     * Return the current result item
-     * Implements Iterator
-     *
-     * @return array
-     * @throws Zend_Ldap_Exception
-     */
-    public function current()
-    {
-        if (!array_key_exists($this->_currentNumber, $this->_cache))
-        {
+     */
+    public function __construct(Zend_Ldap_Collection_Iterator_Interface $iterator)
+    {
+        $this->_iterator = $iterator;
+    }
+
+    public function __destruct()
+    {
+        $this->close();
+    }
+
+    /**
+     * Closes the current result set
+     *
+     * @return boolean
+     */
+    public function close()
+    {
+        return $this->_iterator->close();
+    }
+
+    /**
+     * Get all entries as an array
+     *
+     * @return array
+     */
+    public function toArray()
+    {
+        $data = array();
+        foreach ($this as $item) {
+            $data[] = $item;
+        }
+        return $data;
+    }
+
+    /**
+     * Get first entry
+     *
+     * @return array
+     */
+    public function getFirst()
+    {
+        if ($this->count()>0) {
+            $this->rewind();
+            return $this->current();
+        }
+        else return null;
+    }
+
+    /**
+     * Returns the number of items in current result
+     * Implements Countable
+     *
+     * @return int
+     */
+    public function count()
+    {
+        return $this->_iterator->count();
+    }
+
+    /**
+     * Return the current result item
+     * Implements Iterator
+     *
+     * @return array
+     * @throws Zend_Ldap_Exception
+     */
+    public function current()
+    {
+        if (!array_key_exists($this->_currentNumber, $this->_cache))
+        {
             $this->_cache[$this->_currentNumber] =
-                $this->_createEntry($this->_iterator->current());
-        }
-        return $this->_cache[$this->_currentNumber];
+                $this->_createEntry($this->_iterator->current());
+        }
+        return $this->_cache[$this->_currentNumber];
     }
 
     /**
@@ -142,56 +142,56 @@ class Zend_Ldap_Collection implements Iterator, Countable
     protected function _createEntry(array $data)
     {
         return $data;
-    }
-
-    /**
-     * Return the result item key
-     * Implements Iterator
-     *
-     * @return int
-     */
-    public function key()
-    {
-        return $this->_currentNumber;
-    }
-
-    /**
-     * Move forward to next result item
-     * Implements Iterator
-     *
-     * @throws Zend_Ldap_Exception
-     */
-    public function next()
-    {
-        $this->_iterator->next();
-        $this->_currentNumber++;
-    }
-
-    /**
-     * Rewind the Iterator to the first result item
-     * Implements Iterator
-     *
-     * @throws Zend_Ldap_Exception
-     */
-    public function rewind()
-    {
-        $this->_iterator->rewind();
-        $this->_currentNumber = 0;
-    }
-
-    /**
-     * Check if there is a current result item
-     * after calls to rewind() or next()
-     * Implements Iterator
-     *
-     * @return boolean
-     */
-    public function valid()
+    }
+
+    /**
+     * Return the result item key
+     * Implements Iterator
+     *
+     * @return int
+     */
+    public function key()
+    {
+        return $this->_currentNumber;
+    }
+
+    /**
+     * Move forward to next result item
+     * Implements Iterator
+     *
+     * @throws Zend_Ldap_Exception
+     */
+    public function next()
+    {
+        $this->_iterator->next();
+        $this->_currentNumber++;
+    }
+
+    /**
+     * Rewind the Iterator to the first result item
+     * Implements Iterator
+     *
+     * @throws Zend_Ldap_Exception
+     */
+    public function rewind()
+    {
+        $this->_iterator->rewind();
+        $this->_currentNumber = 0;
+    }
+
+    /**
+     * Check if there is a current result item
+     * after calls to rewind() or next()
+     * Implements Iterator
+     *
+     * @return boolean
+     */
+    public function valid()
     {
         if (isset($this->_cache[$this->_currentNumber])) {
             return true;
-        } else {
+        } else {
             return $this->_iterator->valid();
-        }
-    }
+        }
+    }
 }

+ 32 - 32
library/Zend/Ldap/Collection/Iterator/Default.php

@@ -1,40 +1,40 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
  */
 
 /**
  * @see Zend_Ldap_Collection_Iterator_Interface
  */
-require_once 'Zend/Ldap/Collection/Iterator/Interface.php';
-
-/**
+require_once 'Zend/Ldap/Collection/Iterator/Interface.php';
+
+/**
  * Zend_Ldap_Collection_Iterator_Default is the default collection iterator implementation
- * using ext/ldap
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Collection_Iterator_Default implements Zend_Ldap_Collection_Iterator_Interface
-{
+ * using ext/ldap
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Collection_Iterator_Default implements Zend_Ldap_Collection_Iterator_Interface
+{
     /**
      * LDAP Connection
      *
@@ -249,5 +249,5 @@ class Zend_Ldap_Collection_Iterator_Default implements Zend_Ldap_Collection_Iter
     {
         return (is_resource($this->_current) && is_string($this->_currentDn));
     }
-
+
 }

+ 30 - 30
library/Zend/Ldap/Collection/Iterator/Interface.php

@@ -1,34 +1,34 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/**
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
  * Zend_Ldap_Collection_Iterator_Interface provides a contract for
- * adapter specific collection iterators
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-interface Zend_Ldap_Collection_Iterator_Interface extends Iterator, Countable
+ * adapter specific collection iterators
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+interface Zend_Ldap_Collection_Iterator_Interface extends Iterator, Countable
 {
     /**
      * Closes the current result set

+ 69 - 69
library/Zend/Ldap/Converter.php

@@ -1,71 +1,71 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
 
-/**
- * Zend_Ldap_Converter is a collection of useful LDAP related conversion functions.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Converter
-{
-    /**
-     * Converts all ASCII chars < 32 to "\HEX"
-     *
-     * @see Net_LDAP2_Util::asc2hex32() from Benedikt Hallinger <beni@php.net>
-     * @link http://pear.php.net/package/Net_LDAP2
-     * @author Benedikt Hallinger <beni@php.net>
-     *
-     * @param  string $string String to convert
-     * @return string
-     */
-    public static function ascToHex32($string)
-    {
-        for ($i = 0; $i<strlen($string); $i++) {
-            $char = substr($string, $i, 1);
-            if (ord($char)<32) {
-                $hex = dechex(ord($char));
-                if (strlen($hex) == 1) $hex = '0' . $hex;
-                $string = str_replace($char, '\\' . $hex, $string);
-            }
-        }
-        return $string;
-    }
-
-    /**
-     * Converts all Hex expressions ("\HEX") to their original ASCII characters
-     *
-     * @see Net_LDAP2_Util::hex2asc() from Benedikt Hallinger <beni@php.net>,
-     * heavily based on work from DavidSmith@byu.net
-     * @link http://pear.php.net/package/Net_LDAP2
-     * @author Benedikt Hallinger <beni@php.net>, heavily based on work from DavidSmith@byu.net
-     *
-     * @param  string $string String to convert
-     * @return string
-     */
-    public static function hex32ToAsc($string)
-    {
-        $string = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''", $string);
-        return $string;
-    }
+/**
+ * Zend_Ldap_Converter is a collection of useful LDAP related conversion functions.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Converter
+{
+    /**
+     * Converts all ASCII chars < 32 to "\HEX"
+     *
+     * @see Net_LDAP2_Util::asc2hex32() from Benedikt Hallinger <beni@php.net>
+     * @link http://pear.php.net/package/Net_LDAP2
+     * @author Benedikt Hallinger <beni@php.net>
+     *
+     * @param  string $string String to convert
+     * @return string
+     */
+    public static function ascToHex32($string)
+    {
+        for ($i = 0; $i<strlen($string); $i++) {
+            $char = substr($string, $i, 1);
+            if (ord($char)<32) {
+                $hex = dechex(ord($char));
+                if (strlen($hex) == 1) $hex = '0' . $hex;
+                $string = str_replace($char, '\\' . $hex, $string);
+            }
+        }
+        return $string;
+    }
+
+    /**
+     * Converts all Hex expressions ("\HEX") to their original ASCII characters
+     *
+     * @see Net_LDAP2_Util::hex2asc() from Benedikt Hallinger <beni@php.net>,
+     * heavily based on work from DavidSmith@byu.net
+     * @link http://pear.php.net/package/Net_LDAP2
+     * @author Benedikt Hallinger <beni@php.net>, heavily based on work from DavidSmith@byu.net
+     *
+     * @param  string $string String to convert
+     * @return string
+     */
+    public static function hex32ToAsc($string)
+    {
+        $string = preg_replace("/\\\([0-9A-Fa-f]{2})/e", "''.chr(hexdec('\\1')).''", $string);
+        return $string;
+    }
 }

Разлика између датотеке није приказан због своје велике величине
+ 662 - 662
library/Zend/Ldap/Dn.php


+ 264 - 264
library/Zend/Ldap/Filter.php

@@ -1,265 +1,265 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/**
- * @see Zend_Ldap_Filter_String
- */
-require_once 'Zend/Ldap/Filter/String.php';
-
-/**
- * Zend_Ldap_Filter.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Filter extends Zend_Ldap_Filter_String
-{
-    const TYPE_EQUALS = '=';
-    const TYPE_GREATER = '>';
-    const TYPE_GREATEROREQUAL = '>=';
-    const TYPE_LESS = '<';
-    const TYPE_LESSOREQUAL = '<=';
-    const TYPE_APPROX = '~=';
-
-    /**
-     * Creates an 'equals' filter.
-     * (attr=value)
-     *
-     * @param  string $attr
-     * @param  string $value
-     * @return Zend_Ldap_Filter
-     */
-    public static function equals($attr, $value)
-    {
-        return new self($attr, $value, self::TYPE_EQUALS, null, null);
-    }
-
-    /**
-     * Creates a 'begins with' filter.
-     * (attr=value*)
-     *
-     * @param  string $attr
-     * @param  string $value
-     * @return Zend_Ldap_Filter
-     */
-    public static function begins($attr, $value)
-    {
-        return new self($attr, $value, self::TYPE_EQUALS, null, '*');
-    }
-
-    /**
-     * Creates an 'ends with' filter.
-     * (attr=*value)
-     *
-     * @param  string $attr
-     * @param  string $value
-     * @return Zend_Ldap_Filter
-     */
-    public static function ends($attr, $value)
-    {
-        return new self($attr, $value, self::TYPE_EQUALS, '*', null);
-    }
-
-    /**
-     * Creates a 'contains' filter.
-     * (attr=*value*)
-     *
-     * @param  string $attr
-     * @param  string $value
-     * @return Zend_Ldap_Filter
-     */
-    public static function contains($attr, $value)
-    {
-        return new self($attr, $value, self::TYPE_EQUALS, '*', '*');
-    }
-
-    /**
-     * Creates a 'greater' filter.
-     * (attr>value)
-     *
-     * @param  string $attr
-     * @param  string $value
-     * @return Zend_Ldap_Filter
-     */
-    public static function greater($attr, $value)
-    {
-        return new self($attr, $value, self::TYPE_GREATER, null, null);
-    }
-
-    /**
-     * Creates a 'greater or equal' filter.
-     * (attr>=value)
-     *
-     * @param  string $attr
-     * @param  string $value
-     * @return Zend_Ldap_Filter
-     */
-    public static function greaterOrEqual($attr, $value)
-    {
-        return new self($attr, $value, self::TYPE_GREATEROREQUAL, null, null);
-    }
-
-    /**
-     * Creates a 'less' filter.
-     * (attr<value)
-     *
-     * @param  string $attr
-     * @param  string $value
-     * @return Zend_Ldap_Filter
-     */
-    public static function less($attr, $value)
-    {
-        return new self($attr, $value, self::TYPE_LESS, null, null);
-    }
-
-    /**
-     * Creates an 'less or equal' filter.
-     * (attr<=value)
-     *
-     * @param  string $attr
-     * @param  string $value
-     * @return Zend_Ldap_Filter
-     */
-    public static function lessOrEqual($attr, $value)
-    {
-        return new self($attr, $value, self::TYPE_LESSOREQUAL, null, null);
-    }
-
-    /**
-     * Creates an 'approx' filter.
-     * (attr~=value)
-     *
-     * @param  string $attr
-     * @param  string $value
-     * @return Zend_Ldap_Filter
-     */
-    public static function approx($attr, $value)
-    {
-        return new self($attr, $value, self::TYPE_APPROX, null, null);
-    }
-
-    /**
-     * Creates an 'any' filter.
-     * (attr=*)
-     *
-     * @param  string $attr
-     * @return Zend_Ldap_Filter
-     */
-    public static function any($attr)
-    {
-        return new self($attr, '', self::TYPE_EQUALS, '*', null);
-    }
-
-    /**
-     * Creates a simple custom string filter.
-     *
-     * @param  string $filter
-     * @return Zend_Ldap_Filter_String
-     */
-    public static function string($filter)
-    {
-        return new Zend_Ldap_Filter_String($filter);
-    }
-
-    /**
-     * Creates a simple string filter to be used with a mask.
-     *
-     * @param string $mask
-     * @param string $value
-     * @return Zend_Ldap_Filter_Mask
-     */
-    public static function mask($mask, $value)
-    {
-        /**
-         * Zend_Ldap_Filter_Mask
-         */
-        require_once 'Zend/Ldap/Filter/Mask.php';
-        return new Zend_Ldap_Filter_Mask($mask, $value);
-    }
-
-    /**
-     * Creates an 'and' filter.
-     *
-     * @param  Zend_Ldap_Filter_Abstract $filter,...
-     * @return Zend_Ldap_Filter_And
-     */
-    public static function andFilter($filter)
-    {
-        /**
-         * Zend_Ldap_Filter_And
-         */
-        require_once 'Zend/Ldap/Filter/And.php';
-        return new Zend_Ldap_Filter_And(func_get_args());
-    }
-
-    /**
-     * Creates an 'or' filter.
-     *
-     * @param  Zend_Ldap_Filter_Abstract $filter,...
-     * @return Zend_Ldap_Filter_Or
-     */
-    public static function orFilter($filter)
-    {
-        /**
-         * Zend_Ldap_Filter_Or
-         */
-        require_once 'Zend/Ldap/Filter/Or.php';
-        return new Zend_Ldap_Filter_Or(func_get_args());
-    }
-
-    /**
-     * Create a filter string.
-     *
-     * @param  string $attr
-     * @param  string $value
-     * @param  string $filtertype
-     * @param  string $prepend
-     * @param  string $append
-     * @return string
-     */
-    private static function _createFilterString($attr, $value, $filtertype, $prepend = null, $append = null)
-    {
-        $str = $attr . $filtertype;
-        if (!is_null($prepend)) $str .= $prepend;
-        $str .= self::escapeValue($value);
-        if (!is_null($append)) $str .= $append;
-        return $str;
-    }
-
-    /**
-     * Creates a new Zend_Ldap_Filter.
-     *
-     * @param string $attr
-     * @param string $value
-     * @param string $filtertype
-     * @param string $prepend
-     * @param string $append
-     */
-    public function __construct($attr, $value, $filtertype, $prepend = null, $append = null)
-    {
-        $filter = self::_createFilterString($attr, $value, $filtertype, $prepend, $append);
-        parent::__construct($filter);
-    }
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Ldap_Filter_String
+ */
+require_once 'Zend/Ldap/Filter/String.php';
+
+/**
+ * Zend_Ldap_Filter.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Filter extends Zend_Ldap_Filter_String
+{
+    const TYPE_EQUALS = '=';
+    const TYPE_GREATER = '>';
+    const TYPE_GREATEROREQUAL = '>=';
+    const TYPE_LESS = '<';
+    const TYPE_LESSOREQUAL = '<=';
+    const TYPE_APPROX = '~=';
+
+    /**
+     * Creates an 'equals' filter.
+     * (attr=value)
+     *
+     * @param  string $attr
+     * @param  string $value
+     * @return Zend_Ldap_Filter
+     */
+    public static function equals($attr, $value)
+    {
+        return new self($attr, $value, self::TYPE_EQUALS, null, null);
+    }
+
+    /**
+     * Creates a 'begins with' filter.
+     * (attr=value*)
+     *
+     * @param  string $attr
+     * @param  string $value
+     * @return Zend_Ldap_Filter
+     */
+    public static function begins($attr, $value)
+    {
+        return new self($attr, $value, self::TYPE_EQUALS, null, '*');
+    }
+
+    /**
+     * Creates an 'ends with' filter.
+     * (attr=*value)
+     *
+     * @param  string $attr
+     * @param  string $value
+     * @return Zend_Ldap_Filter
+     */
+    public static function ends($attr, $value)
+    {
+        return new self($attr, $value, self::TYPE_EQUALS, '*', null);
+    }
+
+    /**
+     * Creates a 'contains' filter.
+     * (attr=*value*)
+     *
+     * @param  string $attr
+     * @param  string $value
+     * @return Zend_Ldap_Filter
+     */
+    public static function contains($attr, $value)
+    {
+        return new self($attr, $value, self::TYPE_EQUALS, '*', '*');
+    }
+
+    /**
+     * Creates a 'greater' filter.
+     * (attr>value)
+     *
+     * @param  string $attr
+     * @param  string $value
+     * @return Zend_Ldap_Filter
+     */
+    public static function greater($attr, $value)
+    {
+        return new self($attr, $value, self::TYPE_GREATER, null, null);
+    }
+
+    /**
+     * Creates a 'greater or equal' filter.
+     * (attr>=value)
+     *
+     * @param  string $attr
+     * @param  string $value
+     * @return Zend_Ldap_Filter
+     */
+    public static function greaterOrEqual($attr, $value)
+    {
+        return new self($attr, $value, self::TYPE_GREATEROREQUAL, null, null);
+    }
+
+    /**
+     * Creates a 'less' filter.
+     * (attr<value)
+     *
+     * @param  string $attr
+     * @param  string $value
+     * @return Zend_Ldap_Filter
+     */
+    public static function less($attr, $value)
+    {
+        return new self($attr, $value, self::TYPE_LESS, null, null);
+    }
+
+    /**
+     * Creates an 'less or equal' filter.
+     * (attr<=value)
+     *
+     * @param  string $attr
+     * @param  string $value
+     * @return Zend_Ldap_Filter
+     */
+    public static function lessOrEqual($attr, $value)
+    {
+        return new self($attr, $value, self::TYPE_LESSOREQUAL, null, null);
+    }
+
+    /**
+     * Creates an 'approx' filter.
+     * (attr~=value)
+     *
+     * @param  string $attr
+     * @param  string $value
+     * @return Zend_Ldap_Filter
+     */
+    public static function approx($attr, $value)
+    {
+        return new self($attr, $value, self::TYPE_APPROX, null, null);
+    }
+
+    /**
+     * Creates an 'any' filter.
+     * (attr=*)
+     *
+     * @param  string $attr
+     * @return Zend_Ldap_Filter
+     */
+    public static function any($attr)
+    {
+        return new self($attr, '', self::TYPE_EQUALS, '*', null);
+    }
+
+    /**
+     * Creates a simple custom string filter.
+     *
+     * @param  string $filter
+     * @return Zend_Ldap_Filter_String
+     */
+    public static function string($filter)
+    {
+        return new Zend_Ldap_Filter_String($filter);
+    }
+
+    /**
+     * Creates a simple string filter to be used with a mask.
+     *
+     * @param string $mask
+     * @param string $value
+     * @return Zend_Ldap_Filter_Mask
+     */
+    public static function mask($mask, $value)
+    {
+        /**
+         * Zend_Ldap_Filter_Mask
+         */
+        require_once 'Zend/Ldap/Filter/Mask.php';
+        return new Zend_Ldap_Filter_Mask($mask, $value);
+    }
+
+    /**
+     * Creates an 'and' filter.
+     *
+     * @param  Zend_Ldap_Filter_Abstract $filter,...
+     * @return Zend_Ldap_Filter_And
+     */
+    public static function andFilter($filter)
+    {
+        /**
+         * Zend_Ldap_Filter_And
+         */
+        require_once 'Zend/Ldap/Filter/And.php';
+        return new Zend_Ldap_Filter_And(func_get_args());
+    }
+
+    /**
+     * Creates an 'or' filter.
+     *
+     * @param  Zend_Ldap_Filter_Abstract $filter,...
+     * @return Zend_Ldap_Filter_Or
+     */
+    public static function orFilter($filter)
+    {
+        /**
+         * Zend_Ldap_Filter_Or
+         */
+        require_once 'Zend/Ldap/Filter/Or.php';
+        return new Zend_Ldap_Filter_Or(func_get_args());
+    }
+
+    /**
+     * Create a filter string.
+     *
+     * @param  string $attr
+     * @param  string $value
+     * @param  string $filtertype
+     * @param  string $prepend
+     * @param  string $append
+     * @return string
+     */
+    private static function _createFilterString($attr, $value, $filtertype, $prepend = null, $append = null)
+    {
+        $str = $attr . $filtertype;
+        if (!is_null($prepend)) $str .= $prepend;
+        $str .= self::escapeValue($value);
+        if (!is_null($append)) $str .= $append;
+        return $str;
+    }
+
+    /**
+     * Creates a new Zend_Ldap_Filter.
+     *
+     * @param string $attr
+     * @param string $value
+     * @param string $filtertype
+     * @param string $prepend
+     * @param string $append
+     */
+    public function __construct($attr, $value, $filtertype, $prepend = null, $append = null)
+    {
+        $filter = self::_createFilterString($attr, $value, $filtertype, $prepend, $append);
+        parent::__construct($filter);
+    }
 }

+ 156 - 156
library/Zend/Ldap/Filter/Abstract.php

@@ -1,157 +1,157 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/**
- * Zend_Ldap_Filter_Abstract provides a base implementation for filters.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-abstract class Zend_Ldap_Filter_Abstract
-{
-    /**
-     * Returns a string representation of the filter.
-     *
-     * @return string
-     */
-    abstract public function toString();
-
-    /**
-     * Returns a string representation of the filter.
-     * @see toString()
-     *
-     * @return string
-     */
-    public function __toString()
-    {
-        return $this->toString();
-    }
-
-    /**
-     * Negates the filter.
-     *
-     * @return Zend_Ldap_Filter_Abstract
-     */
-    public function negate()
-    {
-        /**
-         * Zend_Ldap_Filter_Not
-         */
-        require_once 'Zend/Ldap/Filter/Not.php';
-        return new Zend_Ldap_Filter_Not($this);
-    }
-
-    /**
-     * Creates an 'and' filter.
-     *
-     * @param  Zend_Ldap_Filter_Abstract $filter,...
-     * @return Zend_Ldap_Filter_And
-     */
-    public function addAnd($filter)
-    {
-        /**
-         * Zend_Ldap_Filter_And
-         */
-        require_once 'Zend/Ldap/Filter/And.php';
-        $fa = func_get_args();
-        $args = array_merge(array($this), $fa);
-        return new Zend_Ldap_Filter_And($args);
-    }
-
-    /**
-     * Creates an 'or' filter.
-     *
-     * @param  Zend_Ldap_Filter_Abstract $filter,...
-     * @return Zend_Ldap_Filter_Or
-     */
-    public function addOr($filter)
-    {
-        /**
-         * Zend_Ldap_Filter_Or
-         */
-        require_once 'Zend/Ldap/Filter/Or.php';
-        $fa = func_get_args();
-        $args = array_merge(array($this), $fa);
-        return new Zend_Ldap_Filter_Or($args);
-    }
-
-    /**
-     * Escapes the given VALUES according to RFC 2254 so that they can be safely used in LDAP filters.
-     *
-     * Any control characters with an ACII code < 32 as well as the characters with special meaning in
-     * LDAP filters "*", "(", ")", and "\" (the backslash) are converted into the representation of a
-     * backslash followed by two hex digits representing the hexadecimal value of the character.
-     * @see Net_LDAP2_Util::escape_filter_value() from Benedikt Hallinger <beni@php.net>
-     * @link http://pear.php.net/package/Net_LDAP2
-     * @author Benedikt Hallinger <beni@php.net>
-     *
-     * @param  string|array $values Array of values to escape
-     * @return array Array $values, but escaped
-     */
-    public static function escapeValue($values = array())
-    {
-        /**
-         * @see Zend_Ldap_Converter
-         */
-        require_once 'Zend/Ldap/Converter.php';
-
-        if (!is_array($values)) $values = array($values);
-        foreach ($values as $key => $val) {
-            // Escaping of filter meta characters
-            $val = str_replace(array('\\', '*', '(', ')'), array('\5c', '\2a', '\28', '\29'), $val);
-            // ASCII < 32 escaping
-            $val = Zend_Ldap_Converter::ascToHex32($val);
-            if (null === $val) $val = '\0';  // apply escaped "null" if string is empty
-            $values[$key] = $val;
-        }
-        return (count($values) == 1) ? $values[0] : $values;
-    }
-
-    /**
-     * Undoes the conversion done by {@link escapeValue()}.
-     *
-     * Converts any sequences of a backslash followed by two hex digits into the corresponding character.
-     * @see Net_LDAP2_Util::escape_filter_value() from Benedikt Hallinger <beni@php.net>
-     * @link http://pear.php.net/package/Net_LDAP2
-     * @author Benedikt Hallinger <beni@php.net>
-     *
-     * @param  string|array $values Array of values to escape
-     * @return array Array $values, but unescaped
-     */
-    public static function unescapeValue($values = array())
-    {
-        /**
-         * @see Zend_Ldap_Converter
-         */
-        require_once 'Zend/Ldap/Converter.php';
-
-        if (!is_array($values)) $values = array($values);
-        foreach ($values as $key => $value) {
-            // Translate hex code into ascii
-            $values[$key] = Zend_Ldap_Converter::hex32ToAsc($value);
-        }
-        return (count($values) == 1) ? $values[0] : $values;
-    }
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * Zend_Ldap_Filter_Abstract provides a base implementation for filters.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+abstract class Zend_Ldap_Filter_Abstract
+{
+    /**
+     * Returns a string representation of the filter.
+     *
+     * @return string
+     */
+    abstract public function toString();
+
+    /**
+     * Returns a string representation of the filter.
+     * @see toString()
+     *
+     * @return string
+     */
+    public function __toString()
+    {
+        return $this->toString();
+    }
+
+    /**
+     * Negates the filter.
+     *
+     * @return Zend_Ldap_Filter_Abstract
+     */
+    public function negate()
+    {
+        /**
+         * Zend_Ldap_Filter_Not
+         */
+        require_once 'Zend/Ldap/Filter/Not.php';
+        return new Zend_Ldap_Filter_Not($this);
+    }
+
+    /**
+     * Creates an 'and' filter.
+     *
+     * @param  Zend_Ldap_Filter_Abstract $filter,...
+     * @return Zend_Ldap_Filter_And
+     */
+    public function addAnd($filter)
+    {
+        /**
+         * Zend_Ldap_Filter_And
+         */
+        require_once 'Zend/Ldap/Filter/And.php';
+        $fa = func_get_args();
+        $args = array_merge(array($this), $fa);
+        return new Zend_Ldap_Filter_And($args);
+    }
+
+    /**
+     * Creates an 'or' filter.
+     *
+     * @param  Zend_Ldap_Filter_Abstract $filter,...
+     * @return Zend_Ldap_Filter_Or
+     */
+    public function addOr($filter)
+    {
+        /**
+         * Zend_Ldap_Filter_Or
+         */
+        require_once 'Zend/Ldap/Filter/Or.php';
+        $fa = func_get_args();
+        $args = array_merge(array($this), $fa);
+        return new Zend_Ldap_Filter_Or($args);
+    }
+
+    /**
+     * Escapes the given VALUES according to RFC 2254 so that they can be safely used in LDAP filters.
+     *
+     * Any control characters with an ACII code < 32 as well as the characters with special meaning in
+     * LDAP filters "*", "(", ")", and "\" (the backslash) are converted into the representation of a
+     * backslash followed by two hex digits representing the hexadecimal value of the character.
+     * @see Net_LDAP2_Util::escape_filter_value() from Benedikt Hallinger <beni@php.net>
+     * @link http://pear.php.net/package/Net_LDAP2
+     * @author Benedikt Hallinger <beni@php.net>
+     *
+     * @param  string|array $values Array of values to escape
+     * @return array Array $values, but escaped
+     */
+    public static function escapeValue($values = array())
+    {
+        /**
+         * @see Zend_Ldap_Converter
+         */
+        require_once 'Zend/Ldap/Converter.php';
+
+        if (!is_array($values)) $values = array($values);
+        foreach ($values as $key => $val) {
+            // Escaping of filter meta characters
+            $val = str_replace(array('\\', '*', '(', ')'), array('\5c', '\2a', '\28', '\29'), $val);
+            // ASCII < 32 escaping
+            $val = Zend_Ldap_Converter::ascToHex32($val);
+            if (null === $val) $val = '\0';  // apply escaped "null" if string is empty
+            $values[$key] = $val;
+        }
+        return (count($values) == 1) ? $values[0] : $values;
+    }
+
+    /**
+     * Undoes the conversion done by {@link escapeValue()}.
+     *
+     * Converts any sequences of a backslash followed by two hex digits into the corresponding character.
+     * @see Net_LDAP2_Util::escape_filter_value() from Benedikt Hallinger <beni@php.net>
+     * @link http://pear.php.net/package/Net_LDAP2
+     * @author Benedikt Hallinger <beni@php.net>
+     *
+     * @param  string|array $values Array of values to escape
+     * @return array Array $values, but unescaped
+     */
+    public static function unescapeValue($values = array())
+    {
+        /**
+         * @see Zend_Ldap_Converter
+         */
+        require_once 'Zend/Ldap/Converter.php';
+
+        if (!is_array($values)) $values = array($values);
+        foreach ($values as $key => $value) {
+            // Translate hex code into ascii
+            $values[$key] = Zend_Ldap_Converter::hex32ToAsc($value);
+        }
+        return (count($values) == 1) ? $values[0] : $values;
+    }
 }

+ 47 - 47
library/Zend/Ldap/Filter/And.php

@@ -1,48 +1,48 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/**
- * @see Zend_Ldap_Filter_Logical
- */
-require_once 'Zend/Ldap/Filter/Logical.php';
-
-/**
- * Zend_Ldap_Filter_And provides an 'and' filter.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Filter_And extends Zend_Ldap_Filter_Logical  
-{
-    /**
-     * Creates an 'and' grouping filter.
-     *
-     * @param array $subfilters
-     */
-    public function __construct(array $subfilters)
-    {
-        parent::__construct($subfilters, self::TYPE_AND);
-    }
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Ldap_Filter_Logical
+ */
+require_once 'Zend/Ldap/Filter/Logical.php';
+
+/**
+ * Zend_Ldap_Filter_And provides an 'and' filter.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Filter_And extends Zend_Ldap_Filter_Logical
+{
+    /**
+     * Creates an 'and' grouping filter.
+     *
+     * @param array $subfilters
+     */
+    public function __construct(array $subfilters)
+    {
+        parent::__construct($subfilters, self::TYPE_AND);
+    }
 }

+ 36 - 36
library/Zend/Ldap/Filter/Exception.php

@@ -1,37 +1,37 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/**
- * @see Zend_Exception
- */
-require_once 'Zend/Exception.php';
-
-/**
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Filter_Exception extends Zend_Exception
-{
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Exception
+ */
+require_once 'Zend/Exception.php';
+
+/**
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Filter_Exception extends Zend_Exception
+{
 }

+ 106 - 106
library/Zend/Ldap/Filter/Logical.php

@@ -1,107 +1,107 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/** 
- * @see Zend_Ldap_Filter_Abstract
- */
-require_once 'Zend/Ldap/Filter/Abstract.php';
-/** 
- * @see Zend_Ldap_Filter_String
- */
-require_once 'Zend/Ldap/Filter/String.php';
-
-/**
- * Zend_Ldap_Filter_Logical provides a base implementation for a grouping filter.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-abstract class Zend_Ldap_Filter_Logical extends Zend_Ldap_Filter_Abstract  
-{
-    const TYPE_AND = '&';
-    const TYPE_OR = '|';
-    
-    /**
-     * All the sub-filters for this grouping filter.
-     *
-     * @var array
-     */
-    private $_subfilters;
-    
-    /**
-     * The grouping symbol.
-     *
-     * @var string
-     */
-    private $_symbol;
-    
-    /**
-     * Creates a new grouping filter.
-     *
-     * @param array $subfilters
-     * @param string $symbol
-     */
-    protected function __construct(array $subfilters, $symbol)
-    {
-        foreach ($subfilters as $key => $s) {
-            if (is_string($s)) $subfilters[$key] = new Zend_Ldap_Filter_String($s);
-            else if (!($s instanceof Zend_Ldap_Filter_Abstract)) {
-                /** 
-                 * @see Zend_Ldap_Filter_Exception
-                 */
-                require_once 'Zend/Ldap/Filter/Exception.php';
-                throw new Zend_Ldap_Filter_Exception('Only strings or Zend_Ldap_Filter_Abstract allowed.');
-            }
-        }
-        $this->_subfilters = $subfilters;
-        $this->_symbol = $symbol;
-    }
-    
-    /**
-     * Adds a filter to this grouping filter.
-     *
-     * @param Zend_Ldap_Filter_Abstract $filter
-     * @return Zend_Ldap_Filter_Logical 
-     */
-    public function addFilter(Zend_Ldap_Filter_Abstract $filter)
-    {
-        $new = clone $this;
-        $new->_subfilters[] = $filter;
-        return $new;         
-    }
-    
-    /**
-     * Returns a string representation of the filter.
-     *
-     * @return string
-     */
-    public function toString()
-    {
-        $return = '(' . $this->_symbol;
-        foreach ($this->_subfilters as $sub) $return .= $sub->toString();
-        $return .= ')';
-        return $return;
-    }
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Ldap_Filter_Abstract
+ */
+require_once 'Zend/Ldap/Filter/Abstract.php';
+/**
+ * @see Zend_Ldap_Filter_String
+ */
+require_once 'Zend/Ldap/Filter/String.php';
+
+/**
+ * Zend_Ldap_Filter_Logical provides a base implementation for a grouping filter.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+abstract class Zend_Ldap_Filter_Logical extends Zend_Ldap_Filter_Abstract
+{
+    const TYPE_AND = '&';
+    const TYPE_OR = '|';
+
+    /**
+     * All the sub-filters for this grouping filter.
+     *
+     * @var array
+     */
+    private $_subfilters;
+
+    /**
+     * The grouping symbol.
+     *
+     * @var string
+     */
+    private $_symbol;
+
+    /**
+     * Creates a new grouping filter.
+     *
+     * @param array $subfilters
+     * @param string $symbol
+     */
+    protected function __construct(array $subfilters, $symbol)
+    {
+        foreach ($subfilters as $key => $s) {
+            if (is_string($s)) $subfilters[$key] = new Zend_Ldap_Filter_String($s);
+            else if (!($s instanceof Zend_Ldap_Filter_Abstract)) {
+                /**
+                 * @see Zend_Ldap_Filter_Exception
+                 */
+                require_once 'Zend/Ldap/Filter/Exception.php';
+                throw new Zend_Ldap_Filter_Exception('Only strings or Zend_Ldap_Filter_Abstract allowed.');
+            }
+        }
+        $this->_subfilters = $subfilters;
+        $this->_symbol = $symbol;
+    }
+
+    /**
+     * Adds a filter to this grouping filter.
+     *
+     * @param Zend_Ldap_Filter_Abstract $filter
+     * @return Zend_Ldap_Filter_Logical
+     */
+    public function addFilter(Zend_Ldap_Filter_Abstract $filter)
+    {
+        $new = clone $this;
+        $new->_subfilters[] = $filter;
+        return $new;
+    }
+
+    /**
+     * Returns a string representation of the filter.
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        $return = '(' . $this->_symbol;
+        foreach ($this->_subfilters as $sub) $return .= $sub->toString();
+        $return .= ')';
+        return $return;
+    }
 }

+ 64 - 64
library/Zend/Ldap/Filter/Mask.php

@@ -1,66 +1,66 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/**
- * @see Zend_Ldap_Filter_String
- */
-require_once 'Zend/Ldap/Filter/String.php';
-
-
-/**
- * Zend_Ldap_Filter_Mask provides a simple string filter to be used with a mask.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Filter_Mask extends Zend_Ldap_Filter_String
-{
-    /**
-     * Creates a Zend_Ldap_Filter_String.
-     *
-     * @param string $mask
-     * @param string $value,...
-     */
-    public function __construct($mask, $value)
-    {
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Ldap_Filter_String
+ */
+require_once 'Zend/Ldap/Filter/String.php';
+
+
+/**
+ * Zend_Ldap_Filter_Mask provides a simple string filter to be used with a mask.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Filter_Mask extends Zend_Ldap_Filter_String
+{
+    /**
+     * Creates a Zend_Ldap_Filter_String.
+     *
+     * @param string $mask
+     * @param string $value,...
+     */
+    public function __construct($mask, $value)
+    {
         $args = func_get_args();
-        array_shift($args);
-        for ($i = 0; $i<count($args); $i++) {
-            $args[$i] = self::escapeValue($args[$i]);
-        }
-        $filter = vsprintf($mask, $args);
-        parent::__construct($filter);
-    }
-
-    /**
-     * Returns a string representation of the filter.
-     *
-     * @return string
-     */
-    public function toString()
-    {
-        return $this->_filter;
-    }
+        array_shift($args);
+        for ($i = 0; $i<count($args); $i++) {
+            $args[$i] = self::escapeValue($args[$i]);
+        }
+        $filter = vsprintf($mask, $args);
+        parent::__construct($filter);
+    }
+
+    /**
+     * Returns a string representation of the filter.
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return $this->_filter;
+    }
 }

+ 74 - 74
library/Zend/Ldap/Filter/Not.php

@@ -1,75 +1,75 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/**
- * @see Zend_Ldap_Filter_Abstract
- */
-require_once 'Zend/Ldap/Filter/Abstract.php';
-
-/**
- * Zend_Ldap_Filter_Not provides a negation filter.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Filter_Not extends Zend_Ldap_Filter_Abstract
-{
-    /**
-     * The underlying filter.
-     *
-     * @var Zend_Ldap_Filter_Abstract
-     */
-    private $_filter;
-
-    /**
-     * Creates a Zend_Ldap_Filter_Not.
-     *
-     * @param Zend_Ldap_Filter_Abstract $filter
-     */
-    public function __construct(Zend_Ldap_Filter_Abstract $filter)
-    {
-        $this->_filter = $filter;
-    }
-
-    /**
-     * Negates the filter.
-     *
-     * @return Zend_Ldap_Filter_Abstract
-     */
-    public function negate()
-    {
-        return $this->_filter;
-    }
-
-    /**
-     * Returns a string representation of the filter.
-     *
-     * @return string
-     */
-    public function toString()
-    {
-        return '(!' . $this->_filter->toString() . ')';
-    }
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Ldap_Filter_Abstract
+ */
+require_once 'Zend/Ldap/Filter/Abstract.php';
+
+/**
+ * Zend_Ldap_Filter_Not provides a negation filter.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Filter_Not extends Zend_Ldap_Filter_Abstract
+{
+    /**
+     * The underlying filter.
+     *
+     * @var Zend_Ldap_Filter_Abstract
+     */
+    private $_filter;
+
+    /**
+     * Creates a Zend_Ldap_Filter_Not.
+     *
+     * @param Zend_Ldap_Filter_Abstract $filter
+     */
+    public function __construct(Zend_Ldap_Filter_Abstract $filter)
+    {
+        $this->_filter = $filter;
+    }
+
+    /**
+     * Negates the filter.
+     *
+     * @return Zend_Ldap_Filter_Abstract
+     */
+    public function negate()
+    {
+        return $this->_filter;
+    }
+
+    /**
+     * Returns a string representation of the filter.
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return '(!' . $this->_filter->toString() . ')';
+    }
 }

+ 47 - 47
library/Zend/Ldap/Filter/Or.php

@@ -1,48 +1,48 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/** 
- * @see Zend_Ldap_Filter_Logical
- */
-require_once 'Zend/Ldap/Filter/Logical.php';
-
-/**
- * Zend_Ldap_Filter_Or provides an 'or' filter.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Filter_Or extends Zend_Ldap_Filter_Logical  
-{
-    /**
-     * Creates an 'or' grouping filter.
-     *
-     * @param array $subfilters
-     */
-    public function __construct(array $subfilters)
-    {
-        parent::__construct($subfilters, self::TYPE_OR);
-    }
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Ldap_Filter_Logical
+ */
+require_once 'Zend/Ldap/Filter/Logical.php';
+
+/**
+ * Zend_Ldap_Filter_Or provides an 'or' filter.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Filter_Or extends Zend_Ldap_Filter_Logical
+{
+    /**
+     * Creates an 'or' grouping filter.
+     *
+     * @param array $subfilters
+     */
+    public function __construct(array $subfilters)
+    {
+        parent::__construct($subfilters, self::TYPE_OR);
+    }
 }

+ 64 - 64
library/Zend/Ldap/Filter/String.php

@@ -1,65 +1,65 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/** 
- * @see Zend_Ldap_Filter_Abstract
- */
-require_once 'Zend/Ldap/Filter/Abstract.php';
-
-/**
- * Zend_Ldap_Filter_String provides a simple custom string filter.
- *
- * @category   Zend
- * @package    Zend_Ldap
- * @subpackage Filter
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Filter_String extends Zend_Ldap_Filter_Abstract  
-{
-    /**
-     * The filter.
-     *
-     * @var string
-     */
-    protected $_filter;
-    
-    /**
-     * Creates a Zend_Ldap_Filter_String.
-     *
-     * @param string $filter
-     */
-    public function __construct($filter)
-    {
-        $this->_filter = $filter;
-    }
-    
-    /**
-     * Returns a string representation of the filter.
-     *
-     * @return string
-     */
-    public function toString()
-    {
-        return '(' . $this->_filter . ')';
-    }
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Ldap_Filter_Abstract
+ */
+require_once 'Zend/Ldap/Filter/Abstract.php';
+
+/**
+ * Zend_Ldap_Filter_String provides a simple custom string filter.
+ *
+ * @category   Zend
+ * @package    Zend_Ldap
+ * @subpackage Filter
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Filter_String extends Zend_Ldap_Filter_Abstract
+{
+    /**
+     * The filter.
+     *
+     * @var string
+     */
+    protected $_filter;
+
+    /**
+     * Creates a Zend_Ldap_Filter_String.
+     *
+     * @param string $filter
+     */
+    public function __construct($filter)
+    {
+        $this->_filter = $filter;
+    }
+
+    /**
+     * Returns a string representation of the filter.
+     *
+     * @return string
+     */
+    public function toString()
+    {
+        return '(' . $this->_filter . ')';
+    }
 }

+ 31 - 31
library/Zend/Ldap/Ldif/Encoder.php

@@ -1,35 +1,35 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
  * @package    Zend_Ldap
- * @subpackage Ldif
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/**
- * Zend_Ldap_Ldif_Encoder provides methods to encode and decode LDAP data into/from LDIF.
- *
- * @category   Zend
+ * @subpackage Ldif
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * Zend_Ldap_Ldif_Encoder provides methods to encode and decode LDAP data into/from LDIF.
+ *
+ * @category   Zend
  * @package    Zend_Ldap
- * @subpackage Ldif
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Ldif_Encoder
+ * @subpackage Ldif
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Ldif_Encoder
 {
     /**
      * Additional options used during encoding
@@ -43,7 +43,7 @@ class Zend_Ldap_Ldif_Encoder
     );
 
     protected $_versionWritten = false;
-
+
     /**
      * Constructor.
      *

Разлика између датотеке није приказан због своје велике величине
+ 445 - 445
library/Zend/Ldap/Node.php


+ 32 - 32
library/Zend/Ldap/Node/Abstract.php

@@ -1,23 +1,23 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
  * @package    Zend_Ldap
- * @subpackage Node
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
+ * @subpackage Node
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
  */
 
 /**
@@ -27,19 +27,19 @@ require_once 'Zend/Ldap/Attribute.php';
 /**
  * @see Zend_Ldap_Dn
  */
-require_once 'Zend/Ldap/Dn.php';
-
-/**
- * Zend_Ldap_Node_Abstract provides a bas eimplementation for LDAP nodes
- *
- * @category   Zend
+require_once 'Zend/Ldap/Dn.php';
+
+/**
+ * Zend_Ldap_Node_Abstract provides a bas eimplementation for LDAP nodes
+ *
+ * @category   Zend
  * @package    Zend_Ldap
- * @subpackage Node
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-abstract class Zend_Ldap_Node_Abstract implements ArrayAccess, Countable
-{
+ * @subpackage Node
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+abstract class Zend_Ldap_Node_Abstract implements ArrayAccess, Countable
+{
     protected static $_systemAttributes=array('createtimestamp', 'creatorsname',
         'entrycsn', 'entrydn', 'entryuuid', 'hassubordinates', 'modifiersname',
         'modifytimestamp', 'structuralobjectclass', 'subschemasubentry',
@@ -481,5 +481,5 @@ abstract class Zend_Ldap_Node_Abstract implements ArrayAccess, Countable
     public function count()
     {
         return count($this->_currentData);
-    }
+    }
 }

+ 49 - 49
library/Zend/Ldap/Node/Collection.php

@@ -1,42 +1,42 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
  * @package    Zend_Ldap
- * @subpackage Node
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
- */
-
-/**
- * @see Zend_Ldap_Collection
- */
-require_once 'Zend/Ldap/Collection.php';
-
-
-/**
- * Zend_Ldap_Node_Collection provides a collecion of nodes.
- *
- * @category   Zend
+ * @subpackage Node
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
+ */
+
+/**
+ * @see Zend_Ldap_Collection
+ */
+require_once 'Zend/Ldap/Collection.php';
+
+
+/**
+ * Zend_Ldap_Node_Collection provides a collecion of nodes.
+ *
+ * @category   Zend
  * @package    Zend_Ldap
- * @subpackage Node
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Node_Collection extends Zend_Ldap_Collection
-{
+ * @subpackage Node
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Node_Collection extends Zend_Ldap_Collection
+{
     /**
      * Creates the data structure for the given entry data
      *
@@ -52,16 +52,16 @@ class Zend_Ldap_Node_Collection extends Zend_Ldap_Collection
         $node = Zend_Ldap_Node::fromArray($data, true);
         $node->attachLdap($this->_iterator->getLdap());
         return $node;
-    }
-
-    /**
-     * Return the child key (DN).
-     * Implements Iterator and RecursiveIterator
-     *
-     * @return string
-     */
-    public function key()
-    {
-        return $this->_iterator->key();
-    }
+    }
+
+    /**
+     * Return the child key (DN).
+     * Implements Iterator and RecursiveIterator
+     *
+     * @return string
+     */
+    public function key()
+    {
+        return $this->_iterator->key();
+    }
 }

+ 31 - 31
library/Zend/Ldap/Node/RootDse.php

@@ -1,46 +1,46 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
  * @package    Zend_Ldap
- * @subpackage RootDSE
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
+ * @subpackage RootDSE
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
  */
 
 /**
  * @see Zend_Ldap_Node_Abstract
  */
-require_once 'Zend/Ldap/Node/Abstract.php';
-
-/**
- * Zend_Ldap_Node_RootDse provides a simple data-container for the RootDSE node.
- *
- * @category   Zend
+require_once 'Zend/Ldap/Node/Abstract.php';
+
+/**
+ * Zend_Ldap_Node_RootDse provides a simple data-container for the RootDSE node.
+ *
+ * @category   Zend
  * @package    Zend_Ldap
- * @subpackage RootDSE
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Node_RootDse extends Zend_Ldap_Node_Abstract
+ * @subpackage RootDSE
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Node_RootDse extends Zend_Ldap_Node_Abstract
 {
     const SERVER_TYPE_GENERIC         = 1;
     const SERVER_TYPE_OPENLDAP        = 2;
     const SERVER_TYPE_ACTIVEDIRECTORY = 3;
     const SERVER_TYPE_EDIRECTORY      = 4;
-
+
     /**
      * Factory method to create the RootDSE.
      *

+ 30 - 30
library/Zend/Ldap/Node/Schema.php

@@ -1,40 +1,40 @@
-<?php
-/**
- * Zend Framework
- *
- * LICENSE
- *
- * This source file is subject to the new BSD license that is bundled
- * with this package in the file LICENSE.txt.
- * It is also available through the world-wide-web at this URL:
- * http://framework.zend.com/license/new-bsd
- * If you did not receive a copy of the license and are unable to
- * obtain it through the world-wide-web, please send an email
- * to license@zend.com so we can send you a copy immediately.
- *
- * @category   Zend
+<?php
+/**
+ * Zend Framework
+ *
+ * LICENSE
+ *
+ * This source file is subject to the new BSD license that is bundled
+ * with this package in the file LICENSE.txt.
+ * It is also available through the world-wide-web at this URL:
+ * http://framework.zend.com/license/new-bsd
+ * If you did not receive a copy of the license and are unable to
+ * obtain it through the world-wide-web, please send an email
+ * to license@zend.com so we can send you a copy immediately.
+ *
+ * @category   Zend
  * @package    Zend_Ldap
- * @subpackage Schema
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- * @version    $Id$
+ * @subpackage Schema
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ * @version    $Id$
  */
 
 /**
  * @see Zend_Ldap_Node_Abstract
  */
-require_once 'Zend/Ldap/Node/Abstract.php';
-
-/**
- * Zend_Ldap_Node_Schema provides a simple data-container for the Schema node.
- *
- * @category   Zend
+require_once 'Zend/Ldap/Node/Abstract.php';
+
+/**
+ * Zend_Ldap_Node_Schema provides a simple data-container for the Schema node.
+ *
+ * @category   Zend
  * @package    Zend_Ldap
- * @subpackage Schema
- * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
- * @license    http://framework.zend.com/license/new-bsd     New BSD License
- */
-class Zend_Ldap_Node_Schema extends Zend_Ldap_Node_Abstract
+ * @subpackage Schema
+ * @copyright  Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
+ * @license    http://framework.zend.com/license/new-bsd     New BSD License
+ */
+class Zend_Ldap_Node_Schema extends Zend_Ldap_Node_Abstract
 {
     const OBJECTCLASS_TYPE_UNKNOWN    = 0;
     const OBJECTCLASS_TYPE_STRUCTURAL = 1;

Неке датотеке нису приказане због велике количине промена