Hello,
I added in a function to provide server side sorting on searches. This is
a LDAP version 3 specific function, and uses the Netscape API so I have
ifdef'ed the new function. It adds a sortstr attriubte to the
ldap_search() function that already exists in php. There might be a better
way to incorporate the code into php, but here is my first attempt.
proto int ldap_sort_search(int link, string base_dn, string filter
[, array attrs [, string sortstr [, int attrsonly [, int sizelimit
[, int timelimit [, int deref])
Thanks,
David Giffin
/*
+--+
| PHP version 4.0 |
+--+
| Copyright (c) 1997-2001 The PHP Group|
+--+
| This source file is subject to version 2.02 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is|
| available at through the world-wide-web at |
| http://www.php.net/license/2_02.txt. |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [EMAIL PROTECTED] so we can mail you a copy immediately. |
+--+
| Authors: Amitay Isaacs [EMAIL PROTECTED] |
| Eric Warnke[EMAIL PROTECTED] |
| Rasmus Lerdorf [EMAIL PROTECTED] |
| Gerrit Thomson [EMAIL PROTECTED] |
| Jani Taskinen [EMAIL PROTECTED] |
| Stig Venaas[EMAIL PROTECTED] |
| PHP 4.0 updates: Zeev Suraski [EMAIL PROTECTED] |
+--+
*/
/* $Id: ldap.c,v 1.82 2001/02/26 06:07:01 andi Exp $ */
#define IS_EXT_MODULE
#define HAVE_NSLDAP 1
#define LDAP_API_VERSION 3000
#include php.h
#include php_ini.h
#include ext/standard/dl.h
#include php_ldap.h
#ifdef PHP_WIN32
#include string.h
#if HAVE_NSLDAP
#include winsock.h
#endif
#define strdup _strdup
#undef WINDOWS
#undef strcasecmp
#undef strncasecmp
#define WINSOCK 1
#define __STDC__ 1
#endif
#include ext/standard/php_string.h
#include ext/standard/info.h
ZEND_DECLARE_MODULE_GLOBALS(ldap)
static unsigned char third_argument_force_ref[] = { 3, BYREF_NONE, BYREF_NONE,
BYREF_FORCE };
static unsigned char arg3to6of6_force_ref[] = { 6, BYREF_NONE, BYREF_NONE,
BYREF_FORCE, BYREF_FORCE, BYREF_FORCE, BYREF_FORCE };
static int le_result, le_result_entry, le_ber_entry;
static int le_link;
/*
This is just a small subset of the functionality provided by the LDAP library.
All the
operations are synchronous. Referrals are not handled automatically.
*/
function_entry ldap_functions[] = {
PHP_FE(ldap_connect,NULL)
PHP_FALIAS(ldap_close, ldap_unbind,NULL)
PHP_FE(ldap_bind,
NULL)
PHP_FE(ldap_unbind,
NULL)
PHP_FE(ldap_read,
NULL)
PHP_FE(ldap_list,
NULL)
PHP_FE(ldap_search,
NULL)
/* additional function for server side sorting, David Giffin */
PHP_FE(ldap_sort_search,
NULL)
/* end dlg mod */
PHP_FE(ldap_free_result,NULL)
PHP_FE(ldap_count_entries, NULL)
PHP_FE(ldap_first_entry,NULL)
PHP_FE(ldap_next_entry, NULL)
PHP_FE(ldap_get_entries,NULL)
PHP_FE(ldap_first_attribute,third_argument_force_ref)
PHP_FE(ldap_next_attribute, third_argument_force_ref)
PHP_FE(ldap_get_attributes, NULL)
PHP_FE(ldap_get_values, NULL)
PHP_FE(ldap_get_values_len, NULL)
PHP_FE(ldap_get_dn,
NULL