PHP_FE(ldap_err2str, NULL)
PHP_FE(ldap_error, NULL)
PHP_FE(ldap_compare, NULL)
+
+#ifdef STR_TRANSLATION
+ PHP_FE(ldap_t61_to_8859, NULL)
+ PHP_FE(ldap_8859_to_t61, NULL)
+#endif
+
{NULL, NULL, NULL}
};
}
/* }}} */
+
+#ifdef STR_TRANSLATION
+static void php_ldap_do_translate(INTERNAL_FUNCTION_PARAMETERS, int way) {
+ zval **value;
+ char *ldap_buf;
+ unsigned long ldap_len;
+ int result;
+
+ if (ZEND_NUM_ARGS() != 1 || zend_get_parameters_ex(1, &value) == FAILURE) {
+ WRONG_PARAM_COUNT;
+ }
+
+ convert_to_string_ex(value);
+ ldap_buf = (*value)->value.str.val;
+ ldap_len = (*value)->value.str.len;
+
+ if(ldap_len == 0) {
+ RETURN_FALSE;
+ }
+
+ if(way == 1) {
+ result = ldap_8859_to_t61(&ldap_buf, &ldap_len, 0);
+ } else {
+ result = ldap_t61_to_8859(&ldap_buf, &ldap_len, 0);
+ }
+
+ if (result == LDAP_SUCCESS) {
+ RETVAL_STRINGL(ldap_buf,ldap_len,1);
+ free(ldap_buf);
+ } else {
+ php_error(E_ERROR, "LDAP: Conversion from iso-8859-1 to t61 failed.");
+ RETVAL_FALSE;
+ }
+
+ return;
+}
+
+
+/* {{{ proto string ldap_t61_to_8859(string value)
+ Translate t61 characters to 8859 characters */
+PHP_FUNCTION(ldap_t61_to_8859) {
+ php_ldap_do_translate(INTERNAL_FUNCTION_PARAM_PASSTHRU, 0);
+}
+/* }}} */
+
+
+/* {{{ proto string ldap_8859_to_t61(string value)
+ Translate 8859 characters to t61 characters */
+PHP_FUNCTION(ldap_8859_to_t61) {
+ php_ldap_do_translate(INTERNAL_FUNCTION_PARAM_PASSTHRU, 1);
+}
+/* }}} */
+#endif