Deprecate former Horde_LDAP library
authorBen Klang <ben@alkaloid.net>
Wed, 30 Dec 2009 23:48:06 +0000 (18:48 -0500)
committerGunnar Wrobel <wrobel@temple.(none)>
Fri, 12 Feb 2010 21:00:30 +0000 (22:00 +0100)
framework/Ldap/lib/Horde/Ldap.php [deleted file]
framework/Ldap/package.xml [deleted file]
framework/Ldap/test/Horde/Ldap/quoteDN.phpt [deleted file]

diff --git a/framework/Ldap/lib/Horde/Ldap.php b/framework/Ldap/lib/Horde/Ldap.php
deleted file mode 100644 (file)
index 08d4b48..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-<?php
-/**
- * This is a utility class, every method is static.
- *
- * Copyright 1999-2010 The Horde Project (http://www.horde.org/)
- *
- * See the enclosed file COPYING for license information (LGPL). If you
- * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html.
- *
- * @author   Chuck Hagenbuch <chuck@horde.org>
- * @category Horde
- * @package  Horde_Ldap
- */
-class Horde_Ldap
-{
-    /**
-     * Return a boolean expression using the specified operator.
-     *
-     * @param string $lhs    The attribute to test.
-     * @param string $op     The operator.
-     * @param string $rhs    The comparison value.
-     * @param array $params  Any additional parameters for the operator.
-     *
-     * @return string  The LDAP search fragment.
-     */
-    static public function buildClause($lhs, $op, $rhs, $params = array())
-    {
-        switch ($op) {
-        case 'LIKE':
-            if (empty($rhs)) {
-                return '(' . $lhs . '=*)';
-            } elseif (!empty($params['begin'])) {
-                return sprintf('(|(%s=%s*)(%s=* %s*))', $lhs, self::quote($rhs), $lhs, self::quote($rhs));
-            } elseif (!empty($params['approximate'])) {
-                return sprintf('(%s=~%s)', $lhs, self::quote($rhs));
-            }
-            return sprintf('(%s=*%s*)', $lhs, self::quote($rhs));
-
-        default:
-            return sprintf('(%s%s%s)', $lhs, $op, self::quote($rhs));
-        }
-    }
-
-    /**
-     * Escape characters with special meaning in LDAP searches.
-     *
-     * @param string $clause  The string to escape.
-     *
-     * @return string  The escaped string.
-     */
-    static public function quote($clause)
-    {
-        return str_replace(array('\\',   '(',  ')',  '*',  "\0"),
-                           array('\\5c', '\(', '\)', '\*', "\\00"),
-                           $clause);
-    }
-
-    /**
-     * Take an array of DN elements and properly quote it according to RFC
-     * 1485.
-     *
-     * @param array $parts  An array of tuples containing the attribute
-     *                      name and that attribute's value which make
-     *                      up the DN. Example:
-     * <pre>
-     * $parts = array(
-     *     0 => array('cn', 'John Smith'),
-     *     1 => array('dc', 'example'),
-     *     2 => array('dc', 'com')
-     * );
-     * </pre>
-     *
-     * @return string  The properly quoted string DN.
-     */
-    static public function quoteDN($parts)
-    {
-        $dn = '';
-
-        for ($i = 0, $cnt = count($parts); $i < $cnt; ++$i) {
-            if ($i > 0) {
-                $dn .= ',';
-            }
-            $dn .= $parts[$i][0] . '=';
-
-            // See if we need to quote the value.
-            if (preg_match('/^\s|\s$|\s\s|[,+="\r\n<>#;]/', $parts[$i][1])) {
-                $dn .= '"' . str_replace('"', '\\"', $parts[$i][1]) . '"';
-            } else {
-                $dn .= $parts[$i][1];
-            }
-        }
-
-        return $dn;
-    }
-
-}
diff --git a/framework/Ldap/package.xml b/framework/Ldap/package.xml
deleted file mode 100644 (file)
index 52e4a28..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<package packagerversion="1.4.9" version="2.0" xmlns="http://pear.php.net/dtd/package-2.0" xmlns:tasks="http://pear.php.net/dtd/tasks-1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://pear.php.net/dtd/tasks-1.0
-http://pear.php.net/dtd/tasks-1.0.xsd
-http://pear.php.net/dtd/package-2.0
-http://pear.php.net/dtd/package-2.0.xsd">
- <name>Ldap</name>
- <channel>pear.horde.org</channel>
- <summary>Ldap Utility Class</summary>
- <description>This package contains utility functions for dealing with LDAP servers and data.
- </description>
- <lead>
-  <name>Chuck Hagenbuch</name>
-  <user>chuck</user>
-  <email>chuck@horde.org</email>
-  <active>yes</active>
- </lead>
- <date>2010-02-02</date>
- <version>
-  <release>0.1.0</release>
-  <api>0.1.0</api>
- </version>
- <stability>
-  <release>beta</release>
-  <api>beta</api>
- </stability>
- <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
- <notes>* Initial Horde 4 package.
- </notes>
- <contents>
-  <dir name="/">
-   <dir name="lib">
-    <dir name="Horde">
-     <file name="Ldap.php" role="php" />
-    </dir> <!-- /lib/Horde -->
-   </dir> <!-- /lib -->
-   <dir name="test">
-    <dir name="Horde">
-     <dir name="Ldap">
-      <file name="quoteDN.phpt" role="test" />
-     </dir> <!-- /test/Horde/Ldap -->
-    </dir> <!-- /test/Horde -->
-   </dir> <!-- /test -->
-  </dir> <!-- / -->
- </contents>
- <dependencies>
-  <required>
-   <php>
-    <min>5.2.0</min>
-   </php>
-   <pearinstaller>
-    <min>1.5.0</min>
-   </pearinstaller>
-  </required>
- </dependencies>
- <phprelease>
-  <filelist>
-   <install name="lib/Horde/Ldap.php" as="Horde/Ldap.php" />
-  </filelist>
- </phprelease>
- <changelog>
-  <release>
-   <date>2006-05-08</date>
-   <time>22:19:35</time>
-   <version>
-    <release>0.0.2</release>
-    <api>0.0.2</api>
-   </version>
-   <stability>
-    <release>alpha</release>
-    <api>alpha</api>
-   </stability>
-   <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
-   <notes>* Converted to package.xml 2.0 for pear.horde.org
-   * Support approximate LDAP searches (requires openldap or another supported server).
-   </notes>
-  </release>
-  <release>
-   <version>
-    <release>0.0.1</release>
-    <api>0.0.1</api>
-   </version>
-   <stability>
-    <release>alpha</release>
-    <api>alpha</api>
-   </stability>
-   <date>2004-01-12</date>
-   <license uri="http://www.gnu.org/copyleft/lesser.html">LGPL</license>
-   <notes>Initial release as a PEAR package
-   </notes>
-  </release>
- </changelog>
-</package>
diff --git a/framework/Ldap/test/Horde/Ldap/quoteDN.phpt b/framework/Ldap/test/Horde/Ldap/quoteDN.phpt
deleted file mode 100644 (file)
index a58ffcb..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
---TEST--
-Horde_Ldap::quoteDN() tests
---FILE--
-<?php
-
-require_once dirname(__FILE__) . '/../../../lib/Horde/Ldap.php';
-
-echo Horde_Ldap::quoteDN(array(array('cn', 'John Smith'),
-                               array('dc', 'example'),
-                               array('dc', 'com'))) . "\n";
-
-echo Horde_Ldap::quoteDN(array(array('cn', 'Smith, John'),
-                               array('dc', 'example'),
-                               array('dc', 'com'))) . "\n";
-
-echo Horde_Ldap::quoteDN(array(array('cn', ' John Smith'),
-                               array('dc', 'example'),
-                               array('dc', 'com'))) . "\n";
-
-echo Horde_Ldap::quoteDN(array(array('cn', 'John Smith '),
-                               array('dc', 'example'),
-                               array('dc', 'com'))) . "\n";
-
-echo Horde_Ldap::quoteDN(array(array('cn', 'John  Smith'),
-                               array('dc', 'example'),
-                               array('dc', 'com'))) . "\n";
-
-echo Horde_Ldap::quoteDN(array(array('cn', 'John+Smith'),
-                               array('dc', 'example'),
-                               array('dc', 'com'))) . "\n";
-
-echo Horde_Ldap::quoteDN(array(array('cn', 'John "Bugsy" Smith'),
-                               array('dc', 'example'),
-                               array('dc', 'com'))) . "\n";
-
-?>
---EXPECT--
-cn=John Smith,dc=example,dc=com
-cn="Smith, John",dc=example,dc=com
-cn=" John Smith",dc=example,dc=com
-cn="John Smith ",dc=example,dc=com
-cn="John  Smith",dc=example,dc=com
-cn="John+Smith",dc=example,dc=com
-cn="John \"Bugsy\" Smith",dc=example,dc=com