LDAPAccountManager/lam-web/developers/phpdoc/lists/tree/_lib_tree_inc.html

1022 lines
60 KiB
HTML

<html>
<head>
<title>Docs for page tree.inc</title>
<link rel="stylesheet" type="text/css" href="../../media/style.css">
</head>
<body>
<table border="0" cellspacing="0" cellpadding="0" height="48" width="100%">
<tr>
<td class="header_top">lists</td>
</tr>
<tr><td class="header_line"><img src="../../media/empty.png" width="1" height="1" border="0" alt="" /></td></tr>
<tr>
<td class="header_menu">
[ <a href="../../classtrees_lists.html" class="menu">class tree: lists</a> ]
[ <a href="../../elementindex_lists.html" class="menu">index: lists</a> ]
[ <a href="../../elementindex.html" class="menu">all elements</a> ]
</td>
</tr>
<tr><td class="header_line"><img src="../../media/empty.png" width="1" height="1" border="0" alt="" /></td></tr>
</table>
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<tr valign="top">
<td width="200" class="menu">
<div id="ric">
<p><a href="../../ric_README.html">README</a></p>
<p><a href="../../ric_INSTALL.html">INSTALL</a></p>
</div>
<b>Packages:</b><br />
<a href="../../li_configuration.html">configuration</a><br />
<a href="../../li_Help.html">Help</a><br />
<a href="../../li_LDAP.html">LDAP</a><br />
<a href="../../li_lib.html">lib</a><br />
<a href="../../li_lists.html">lists</a><br />
<a href="../../li_main.html">main</a><br />
<a href="../../li_modules.html">modules</a><br />
<a href="../../li_PDF.html">PDF</a><br />
<a href="../../li_profiles.html">profiles</a><br />
<a href="../../li_selfService.html">selfService</a><br />
<a href="../../li_tests.html">tests</a><br />
<a href="../../li_tools.html">tools</a><br />
<a href="../../li_types.html">types</a><br />
<br /><br />
<b>Files:</b><br />
<div class="package">
<a href="../../lists/_templates_lists_list_php.html"> list.php
</a><br>
<a href="../../lists/_lib_lists_inc.html"> lists.inc
</a><br>
<a href="../../lists/_templates_lists_userlink_php.html"> userlink.php
</a><br>
</div><br />
subpackage <b>tree</b><br> <div class="package">
<a href="../../lists/tree/_templates_tree_add_attr_php.html"> add_attr.php
</a><br>
<a href="../../lists/tree/_templates_tree_add_attr_form_php.html"> add_attr_form.php
</a><br>
<a href="../../lists/tree/_templates_tree_add_oclass_php.html"> add_oclass.php
</a><br>
<a href="../../lists/tree/_templates_tree_add_oclass_form_php.html"> add_oclass_form.php
</a><br>
<a href="../../lists/tree/_templates_tree_add_value_php.html"> add_value.php
</a><br>
<a href="../../lists/tree/_templates_tree_add_value_form_php.html"> add_value_form.php
</a><br>
<a href="../../lists/tree/_templates_tree_collapse_php.html"> collapse.php
</a><br>
<a href="../../lists/tree/_templates_tree_create_php.html"> create.php
</a><br>
<a href="../../lists/tree/_templates_tree_create_form_php.html"> create_form.php
</a><br>
<a href="../../lists/tree/_templates_tree_creation_template_php.html"> creation_template.php
</a><br>
<a href="../../lists/tree/_templates_tree_templates_creation_custom_php.html"> custom.php
</a><br>
<a href="../../lists/tree/_templates_tree_delete_php.html"> delete.php
</a><br>
<a href="../../lists/tree/_templates_tree_delete_attr_php.html"> delete_attr.php
</a><br>
<a href="../../lists/tree/_templates_tree_delete_form_php.html"> delete_form.php
</a><br>
<a href="../../lists/tree/_templates_tree_download_binary_attr_php.html"> download_binary_attr.php
</a><br>
<a href="../../lists/tree/_templates_tree_edit_php.html"> edit.php
</a><br>
<a href="../../lists/tree/_templates_tree_expand_php.html"> expand.php
</a><br>
<a href="../../lists/tree/_templates_tree_export_php.html"> export.php
</a><br>
<a href="../../lists/tree/_templates_tree_export_form_php.html"> export_form.php
</a><br>
<a href="../../lists/tree/_templates_tree_templates_creation_new_ou_template_php.html"> new_ou_template.php
</a><br>
<a href="../../lists/tree/_templates_tree_rdelete_php.html"> rdelete.php
</a><br>
<a href="../../lists/tree/_templates_tree_refresh_php.html"> refresh.php
</a><br>
<a href="../../lists/tree/_templates_tree_templates_templates_inc.html"> templates.inc
</a><br>
<a href="../../lists/tree/_lib_tree_inc.html"> tree.inc
</a><br>
<a href="../../lists/tree/_templates_tree_tree_php.html"> tree.php
</a><br>
<a href="../../lists/tree/_templates_tree_tree_view_php.html"> tree_view.php
</a><br>
<a href="../../lists/tree/_templates_tree_update_php.html"> update.php
</a><br>
<a href="../../lists/tree/_templates_tree_update_confirm_php.html"> update_confirm.php
</a><br>
</div><br />
<b>Classes:</b><br />
<div class="package">
<a href="../../lists/lamGroupList.html">lamGroupList</a><br />
<a href="../../lists/lamHostList.html">lamHostList</a><br />
<a href="../../lists/lamList.html">lamList</a><br />
<a href="../../lists/lamMailAliasList.html">lamMailAliasList</a><br />
<a href="../../lists/lamSmbDomainList.html">lamSmbDomainList</a><br />
<a href="../../lists/lamUserList.html">lamUserList</a><br />
</div>
</td>
<td>
<table cellpadding="10" cellspacing="0" width="100%" border="0"><tr><td valign="top">
<h1>Procedural File: tree.inc</h1>
Source Location: /lib/tree.inc<br /><br />
<br>
<br>
<h2>Page Details:</h2>
This function displays the LDAP tree for all the servers that you have<br /><br /><p>in config.php. We read the session variable 'tree' to know which dns are expanded or collapsed. No query string parameters are expected, however, you can use a '#' offset to scroll to a given dn. The syntax is tree.php#&lt;rawurlencoded dn&gt;, so if I wanted to scroll to dc=example,dc=com for server 3, the URL would be: tree.php#3_dc%3Dexample%2Cdc%3Dcom</p><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>author:</b>&nbsp;&nbsp;</td><td>Roland Gruber</td>
</tr>
<tr>
<td><b>author:</b>&nbsp;&nbsp;</td><td>David Smith</td>
</tr>
</table>
</div>
<br /><br />
<br /><br />
<br /><br />
<br />
<hr />
<a name="functionarrayLower"></a>
<h3>arrayLower <span class="smalllinenumber">[line 911]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void arrayLower(
mixed $array)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionbuild_initial_tree_icons"></a>
<h3>build_initial_tree_icons <span class="smalllinenumber">[line 180]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void build_initial_tree_icons(
)</code>
</td></tr></table>
</td></tr></table><br />
Builds the initial array that stores the icon-lookup for each server's DN in the tree browser. The returned<br /><br /><p>array is then stored in the current session. The structure of the returned array is simple, and looks like this: <pre><br />1 <span class="src-key">Array</span><br />2 <span class="src-sym">(</span><br />3 <span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span> =&gt; <span class="src-key">Array</span><br />4 <span class="src-sym">(</span><br />5 <span class="src-sym">[</span><span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">com</span><span class="src-sym">]</span> =&gt; <span class="src-str">&quot;dcobject.png&quot;</span><br />6 <span class="src-sym">)</span><br />7 <span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span> =&gt; <span class="src-key">Array</span><br />8 <span class="src-sym">[</span><span class="src-id">o</span>=<span class="src-id">Corporation</span><span class="src-sym">]</span> =&gt; <span class="src-str">&quot;o.png&quot;</span><br />9 <span class="src-sym">)</span><br />10 <span class="src-sym">)</span></pre> This function is not meant as a user-callable function, but rather a convenient, automated method for setting up the initial data structure for the tree viewer's icon cache.</p><br /> <br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functiondn_exists"></a>
<h3>dn_exists <span class="smalllinenumber">[line 199]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>bool dn_exists(
string $dn)</code>
</td></tr></table>
</td></tr></table><br />
Gets whether an entry exists based on its DN. If the entry exists, returns true. Otherwise returns false.<br /><br /> <br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$dn</b>&nbsp;&nbsp;</td>
<td>The DN of the entry of interest.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functiondraw_formatted_dn"></a>
<h3>draw_formatted_dn <span class="smalllinenumber">[line 647]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void draw_formatted_dn(
mixed $dn)</code>
</td></tr></table>
</td></tr></table><br />
Gets a DN string using the user-configured tree_display_format string to format it.<br /><br /> <br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functiondraw_jpeg_photos"></a>
<h3>draw_jpeg_photos <span class="smalllinenumber">[line 1122]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void draw_jpeg_photos(
string $dn, [string $attr_name = &#039;jpegPhoto&#039;], [bool $draw_delete_buttons = false], [bool $draw_bytes_and_size = true], [string $table_html_attrs = &#039;align=&quot;left&quot;&#039;], [mixed $img_html_attrs = &#039;&#039;])</code>
</td></tr></table>
</td></tr></table><br />
Draw the jpegPhoto image(s) for an entry wrapped in HTML. Many options are available to specify how the images are to be displayed.<br /><br /><p>Usage Examples: <pre><br />1 <a href="../../lists/tree/_lib_tree_inc.html#functiondraw_jpeg_photos">draw_jpeg_photos</a><span class="src-sym">(</span> <span class="src-num">0</span><span class="src-sym">,</span> <span class="src-str">&quot;cn=Bob,ou=People,dc=example,dc=com&quot;</span><span class="src-sym">,</span> <span class="src-str">&quot;jpegPhoto&quot;</span> <span class="src-id">true</span><span class="src-sym">,</span> <span class="src-id">false</span><span class="src-sym">,</span> <span class="src-str">&quot;border: 1px; width: 150px&quot;</span> <span class="src-sym">)</span>;<br />2 <a href="../../lists/tree/_lib_tree_inc.html#functiondraw_jpeg_photos">draw_jpeg_photos</a><span class="src-sym">(</span> <span class="src-num">1</span><span class="src-sym">,</span> <span class="src-str">&quot;cn=Fred,ou=People,dc=example,dc=com&quot;</span> <span class="src-sym">)</span>;</pre></p><br /> <br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$dn</b>&nbsp;&nbsp;</td>
<td>The DN of the entry that contains the jpeg attribute you want to draw.</td>
</tr>
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$attr_name</b>&nbsp;&nbsp;</td>
<td>The name of the attribute containing the jpeg data (usually 'jpegPhoto').</td>
</tr>
<tr>
<td class="type">bool&nbsp;&nbsp;</td>
<td><b>$draw_delete_buttons</b>&nbsp;&nbsp;</td>
<td>If true, draws a button beneath the image titled 'Delete' allowing the user to delete the jpeg attribute by calling JavaScript function deleteAttribute() provided in the default modification template.</td>
</tr>
<tr>
<td class="type">bool&nbsp;&nbsp;</td>
<td><b>$draw_bytes_and_size</b>&nbsp;&nbsp;</td>
<td>If true, draw text below the image indicating the byte size and dimensions.</td>
</tr>
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$table_html_attrs</b>&nbsp;&nbsp;</td>
<td>Specifies optional CSS style attributes for the table tag.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functiondraw_server_tree"></a>
<h3>draw_server_tree <span class="smalllinenumber">[line 49]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void draw_server_tree(
)</code>
</td></tr></table>
</td></tr></table><br />
Prints the HTML of the tree view.<br /><br /> <br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionget_container"></a>
<h3>get_container <span class="smalllinenumber">[line 1300]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string get_container(
string $dn)</code>
</td></tr></table>
</td></tr></table><br />
Given a DN string, this returns the parent container portion of the string.<br /><br /><p>For example. given 'cn=Manager,dc=example,dc=com', this function returns 'dc=example,dc=com'.</p><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b>&nbsp;&nbsp;</td><td>The container</td>
</tr>
<tr>
<td><b>see:</b>&nbsp;&nbsp;</td><td><a href="../../lists/tree/_lib_tree_inc.html#functionget_rdn">get_rdn()</a></td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$dn</b>&nbsp;&nbsp;</td>
<td>The DN whose container string to return.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionget_container_contents"></a>
<h3>get_container_contents <span class="smalllinenumber">[line 245]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>array get_container_contents(
string $dn, [int $size_limit = 0], [string $filter = &#039;(objectClass=*)&#039;])</code>
</td></tr></table>
</td></tr></table><br />
Gets a list of child entries for an entry. Given a DN, this function fetches the list of DNs of child entries one level beneath the parent. For example, for the following tree:<br /><br /><p><pre><br />1 <span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">com</span><br />2 <span class="src-id">ou</span>=<span class="src-id">People</span><br />3 <span class="src-id">cn</span>=<span class="src-id">Dave</span><br />4 <span class="src-id">cn</span>=<span class="src-id">Fred</span><br />5 <span class="src-id">cn</span>=<span class="src-id">Joe</span><br />6 <span class="src-id">ou</span>=<span class="src-id">More</span> <span class="src-id">People</span><br />7 <span class="src-id">cn</span>=<span class="src-id">Mark</span><br />8 <span class="src-id">cn</span>=<span class="src-id">Bob</span></pre></p><p>Calling <pre><br />1 <a href="../../lists/tree/_lib_tree_inc.html#functionget_container_contents">get_container_contents</a><span class="src-sym">(</span> <span class="src-str">&quot;ou=people,dc=example,dc=com&quot;</span> <span class="src-sym">)</span></pre> would return the following list:</p><p><pre><br />1 <span class="src-id">cn</span>=<span class="src-id">Dave</span><br />2 <span class="src-id">cn</span>=<span class="src-id">Fred</span><br />3 <span class="src-id">cn</span>=<span class="src-id">Joe</span><br />4 <span class="src-id">ou</span>=<span class="src-id">More</span> <span class="src-id">People</span></pre></p><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b>&nbsp;&nbsp;</td><td>An array of DN strings listing the immediate children of the specified entry.</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$dn</b>&nbsp;&nbsp;</td>
<td>The DN of the entry whose children to return.</td>
</tr>
<tr>
<td class="type">int&nbsp;&nbsp;</td>
<td><b>$size_limit</b>&nbsp;&nbsp;</td>
<td>(optional) The maximum number of entries to return. If unspecified, no limit is applied to the number of entries in the returned.</td>
</tr>
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$filter</b>&nbsp;&nbsp;</td>
<td>(optional) An LDAP filter to apply when fetching children, example: &quot;(objectClass=inetOrgPerson)&quot;</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionget_enc_type"></a>
<h3>get_enc_type <span class="smalllinenumber">[line 1092]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void get_enc_type(
mixed $user_password)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionget_entry_system_attrs"></a>
<h3>get_entry_system_attrs <span class="smalllinenumber">[line 883]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>array get_entry_system_attrs(
string $dn, [int $deref = LDAP_DEREF_NEVER])</code>
</td></tr></table>
</td></tr></table><br />
Gets the operational attributes for an entry. Given a DN, this function fetches that entry's<br /><br /><p>operational (ie, system or internal) attributes. These attributes include &quot;createTimeStamp&quot;, &quot;creatorsName&quot;, and any other attribute that the LDAP server sets automatically. The returned associative array is of this form: <pre><br />1 <span class="src-key">Array</span><br />2 <span class="src-sym">(</span><br />3 <span class="src-sym">[</span><span class="src-id">creatorsName</span><span class="src-sym">]</span> =&gt; <span class="src-key">Array</span><br />4 <span class="src-sym">(</span><br />5 <span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span> =&gt; <span class="src-str">&quot;cn=Admin,dc=example,dc=com&quot;</span><br />6 <span class="src-sym">)</span><br />7 <span class="src-sym">[</span><span class="src-id">createTimeStamp</span><span class="src-sym">]</span>=&gt; <span class="src-key">Array</span><br />8 <span class="src-sym">(</span><br />9 <span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span> =&gt; <span class="src-str">&quot;10401040130&quot;</span><br />10 <span class="src-sym">)</span><br />11 <span class="src-sym">[</span><span class="src-id">hasSubordinates</span><span class="src-sym">]</span> =&gt; <span class="src-key">Array</span><br />12 <span class="src-sym">(</span><br />13 <span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span> =&gt; <span class="src-str">&quot;FALSE&quot;</span><br />14 <span class="src-sym">)</span><br />15 <span class="src-sym">)</span></pre></p><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b>&nbsp;&nbsp;</td><td>An associative array whose keys are attribute names and whose values are arrays of values for the aforementioned attribute.</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$dn</b>&nbsp;&nbsp;</td>
<td>The DN of the entry whose interal attributes are desired.</td>
</tr>
<tr>
<td class="type">int&nbsp;&nbsp;</td>
<td><b>$deref</b>&nbsp;&nbsp;</td>
<td>For aliases and referrals, this parameter specifies whether to follow references to the referenced DN or to fetch the attributes for the referencing DN. See http://php.net/ldap_search for the 4 valid options.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionget_icon"></a>
<h3>get_icon <span class="smalllinenumber">[line 282]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string get_icon(
string $dn)</code>
</td></tr></table>
</td></tr></table><br />
Given a DN and server ID, this function reads the DN's objectClasses and<br /><br /><p>determines which icon best represents the entry. The results of this query are cached in a session variable so it is not run every time the tree browser changes, just when exposing new DNs that were not displayed previously. That means we can afford a little bit of inefficiency here in favor of coolness. :)</p><p>This function returns a string like &quot;country.png&quot;. All icon files are assumed to be contained in the /../../graphics/ directory of phpLDAPadmin.</p><p>Developers are encouraged to add new icons to the images directory and modify this function as needed to suit their types of LDAP entries. If the modifications are general to an LDAP audience, the phpLDAPadmin team will gladly accept them as a patch.</p><br /> <br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$dn</b>&nbsp;&nbsp;</td>
<td>The DN of the entry whose icon you wish to fetch.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionget_object_attr"></a>
<h3>get_object_attr <span class="smalllinenumber">[line 426]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void get_object_attr(
string $dn, string $attr, bool $lower_case_attr_names)</code>
</td></tr></table>
</td></tr></table><br />
Much like get_object_attrs(), but only returns the values for one attribute of an object. Example calls:<br /><br /><p><pre><br />1 <a href="http://www.php.net/print_r">print_r</a><span class="src-sym">(</span> <a href="../../lists/tree/_lib_tree_inc.html#functionget_object_attr">get_object_attr</a><span class="src-sym">(</span> <span class="src-num">0</span><span class="src-sym">,</span> <span class="src-str">&quot;cn=Bob,ou=people,dc=example,dc=com&quot;</span><span class="src-sym">,</span> <span class="src-str">&quot;sn&quot;</span> <span class="src-sym">)</span> <span class="src-sym">)</span>;<br />2 <span class="src-comm">// prints:</span><br />3 <span class="src-comm">// Array</span><br />4 <span class="src-comm">// (</span><br />5 <span class="src-comm">// [0] =&gt; &quot;Smith&quot;</span><br />6 <span class="src-comm">// )</span><br />7 <br />8 <a href="http://www.php.net/print_r">print_r</a><span class="src-sym">(</span> <a href="../../lists/tree/_lib_tree_inc.html#functionget_object_attr">get_object_attr</a><span class="src-sym">(</span> <span class="src-num">0</span><span class="src-sym">,</span> <span class="src-str">&quot;cn=Bob,ou=people,dc=example,dc=com&quot;</span><span class="src-sym">,</span> <span class="src-str">&quot;objectClass&quot;</span> <span class="src-sym">)</span> <span class="src-sym">)</span>;<br />9 <span class="src-comm">// prints:</span><br />10 <span class="src-comm">// Array</span><br />11 <span class="src-comm">// (</span><br />12 <span class="src-comm">// [0] =&gt; &quot;top&quot;</span><br />13 <span class="src-comm">// [1] =&gt; &quot;person&quot;</span><br />14 <span class="src-comm">// )</span></pre></p><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>see:</b>&nbsp;&nbsp;</td><td><a href="../../lists/tree/_lib_tree_inc.html#functionget_object_attrs">get_object_attrs()</a></td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$dn</b>&nbsp;&nbsp;</td>
<td>The distinguished name (DN) of the entry whose attributes/values to fetch.</td>
</tr>
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$attr</b>&nbsp;&nbsp;</td>
<td>The attribute whose value(s) to return (ie, &quot;objectClass&quot;, &quot;cn&quot;, &quot;userPassword&quot;)</td>
</tr>
<tr>
<td class="type">bool&nbsp;&nbsp;</td>
<td><b>$lower_case_attr_names</b>&nbsp;&nbsp;</td>
<td>(optional) If true, all keys of the returned associative array will be lower case. Otherwise, they will be cased as the LDAP server returns them.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionget_object_attrs"></a>
<h3>get_object_attrs <span class="smalllinenumber">[line 721]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>array get_object_attrs(
string $dn, [bool $lower_case_attr_names = false], [int $deref = LDAP_DEREF_NEVER])</code>
</td></tr></table>
</td></tr></table><br />
Gets the attributes/values of an entry. Returns an associative array whose<br /><br /><p>keys are attribute value names and whose values are arrays of values for said attribute. Optionally, callers may specify true for the parameter $lower_case_attr_names to force all keys in the associate array (attribute names) to be lower case.</p><p>Sample return value of <pre><br />1 <a href="../../lists/tree/_lib_tree_inc.html#functionget_object_attrs">get_object_attrs</a><span class="src-sym">(</span> <span class="src-num">0</span><span class="src-sym">,</span> <span class="src-str">&quot;cn=Bob,ou=pepole,dc=example,dc=com&quot;</span> <span class="src-sym">)</span></pre></p><p><pre><br />1 <span class="src-key">Array</span><br />2 <span class="src-sym">(</span><br />3 <span class="src-sym">[</span><span class="src-id">objectClass</span><span class="src-sym">]</span> =&gt; <span class="src-key">Array</span><br />4 <span class="src-sym">(</span><br />5 <span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span> =&gt; <span class="src-id">person</span><br />6 <span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span> =&gt; <span class="src-id">top</span><br />7 <span class="src-sym">)</span><br />8 <span class="src-sym">[</span><span class="src-id">cn</span><span class="src-sym">]</span> =&gt; <span class="src-key">Array</span><br />9 <span class="src-sym">(</span><br />10 <span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span> =&gt; <span class="src-id">Bob</span><br />11 <span class="src-sym">)</span><br />12 <span class="src-sym">[</span><span class="src-id">sn</span><span class="src-sym">]</span> =&gt; <span class="src-key">Array</span><br />13 <span class="src-sym">(</span><br />14 <span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span> =&gt; <span class="src-id">Jones</span><br />15 <span class="src-sym">)</span><br />16 <span class="src-sym">[</span><span class="src-id">dn</span><span class="src-sym">]</span> =&gt; <span class="src-key">Array</span><br />17 <span class="src-sym">(</span><br />18 <span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span> =&gt; <span class="src-id">cn</span>=<span class="src-id">Bob</span><span class="src-sym">,</span><span class="src-id">ou</span>=<span class="src-id">pepole</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">com</span><br />19 <span class="src-sym">)</span><br />20 <span class="src-sym">)</span></pre></p><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>see:</b>&nbsp;&nbsp;</td><td><a href="../../lists/tree/_lib_tree_inc.html#functionget_object_attr">get_object_attr()</a></td>
</tr>
<tr>
<td><b>see:</b>&nbsp;&nbsp;</td><td><a href="../../lists/tree/_lib_tree_inc.html#functionget_entry_system_attrs">get_entry_system_attrs()</a></td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$dn</b>&nbsp;&nbsp;</td>
<td>The distinguished name (DN) of the entry whose attributes/values to fetch.</td>
</tr>
<tr>
<td class="type">bool&nbsp;&nbsp;</td>
<td><b>$lower_case_attr_names</b>&nbsp;&nbsp;</td>
<td>(optional) If true, all keys of the returned associative array will be lower case. Otherwise, they will be cased as the LDAP server returns them.</td>
</tr>
<tr>
<td class="type">int&nbsp;&nbsp;</td>
<td><b>$deref</b>&nbsp;&nbsp;</td>
<td>For aliases and referrals, this parameter specifies whether to follow references to the referenced DN or to fetch the attributes for the referencing DN. See http://php.net/ldap_search for the 4 valid options.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionget_rdn"></a>
<h3>get_rdn <span class="smalllinenumber">[line 460]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string get_rdn(
string $dn, [bool $include_attrs = 0])</code>
</td></tr></table>
</td></tr></table><br />
Given a DN string, this returns the 'RDN' portion of the string.<br /><br /><p>For example. given 'cn=Manager,dc=example,dc=com', this function returns 'cn=Manager' (it is really the exact opposite of get_container()).</p><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b>&nbsp;&nbsp;</td><td>The RDN</td>
</tr>
<tr>
<td><b>see:</b>&nbsp;&nbsp;</td><td><a href="../../lists/tree/_lib_tree_inc.html#functionget_container">get_container()</a></td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$dn</b>&nbsp;&nbsp;</td>
<td>The DN whose RDN to return.</td>
</tr>
<tr>
<td class="type">bool&nbsp;&nbsp;</td>
<td><b>$include_attrs</b>&nbsp;&nbsp;</td>
<td>If true, include attributes in the RDN string. See http://php.net/ldap_explode_dn for details</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functioninitialize_session_tree"></a>
<h3>initialize_session_tree <span class="smalllinenumber">[line 143]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void initialize_session_tree(
)</code>
</td></tr></table>
</td></tr></table><br />
Checks and fixes an initial session's tree cache if needed.<br /><br /><p>This function is not meant as a user-callable function, but rather a convenient, automated method for checking the initial data structure of the session.</p><br /> <br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionis_attr_binary"></a>
<h3>is_attr_binary <span class="smalllinenumber">[line 773]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>bool is_attr_binary(
string $attr_name)</code>
</td></tr></table>
</td></tr></table><br />
Given an attribute name and server ID number, this function returns whether the attrbiute may contain binary data. This is useful for developers who wish to display the contents of an arbitrary attribute but don't want to dump binary data on the page.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>see:</b>&nbsp;&nbsp;</td><td><a href="../../lists/tree/_lib_tree_inc.html#functionis_jpeg_photo">is_jpeg_photo()</a></td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$attr_name</b>&nbsp;&nbsp;</td>
<td>The name of the attribute to test.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionis_attr_boolean"></a>
<h3>is_attr_boolean <span class="smalllinenumber">[line 959]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>bool is_attr_boolean(
string $attr_name)</code>
</td></tr></table>
</td></tr></table><br />
Given an attribute name and server ID number, this function returns whether the attrbiute contains boolean data. This is useful for developers who wish to display the contents of a boolean attribute with a drop-down.<br /><br /> <br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$attr_name</b>&nbsp;&nbsp;</td>
<td>The name of the attribute to test.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionis_dn_attr"></a>
<h3>is_dn_attr <span class="smalllinenumber">[line 1066]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>bool is_dn_attr(
string $attr_name)</code>
</td></tr></table>
</td></tr></table><br />
Returns true if the attribute specified is required to take as input a DN.<br /><br /><p>Some examples include 'distinguishedName', 'member' and 'uniqueMember'.</p><br /> <br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$attr_name</b>&nbsp;&nbsp;</td>
<td>The name of the attribute of interest (case insensitive)</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionis_jpeg_photo"></a>
<h3>is_jpeg_photo <span class="smalllinenumber">[line 927]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>bool is_jpeg_photo(
string $attr_name)</code>
</td></tr></table>
</td></tr></table><br />
Used to determine if the specified attribute is indeed a jpegPhoto. If the specified attribute is one that houses jpeg data, true is returned. Otherwise this function returns false.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>see:</b>&nbsp;&nbsp;</td><td><a href="../../lists/tree/_lib_tree_inc.html#functiondraw_jpeg_photos">draw_jpeg_photos()</a></td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$attr_name</b>&nbsp;&nbsp;</td>
<td>The name of the attribute to test.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionis_mail_string"></a>
<h3>is_mail_string <span class="smalllinenumber">[line 979]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>bool is_mail_string(
string $str)</code>
</td></tr></table>
</td></tr></table><br />
Get whether a string looks like an email address (user@example.com).<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b>&nbsp;&nbsp;</td><td>Returns true if the specified string looks like an email address or false otherwise.</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$str</b>&nbsp;&nbsp;</td>
<td>The string to analyze.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionis_multi_line_attr"></a>
<h3>is_multi_line_attr <span class="smalllinenumber">[line 1027]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>bool is_multi_line_attr(
string $attr_name, [string $val = null])</code>
</td></tr></table>
</td></tr></table><br />
Determines if an attribute's value can contain multiple lines. Attributes that fall in this multi-line category may be configured in config.php. Hence, this function accesses the global variable $multi_line_attributes;<br /><br /><p>Usage example: <pre><br />1 <span class="src-key">if</span><span class="src-sym">(</span> <span class="src-id">is_muli_line_attr</span><span class="src-sym">(</span> <span class="src-str">&quot;postalAddress&quot;</span> <span class="src-sym">)</span> <span class="src-sym">)</span><br />2 echo <span class="src-str">&quot;&lt;textarea name=\&quot;postalAddress\&quot;&gt;&lt;/textarea&gt;&quot;</span>;<br />3 <span class="src-key">else</span><br />4 echo <span class="src-str">&quot;&lt;input name=\&quot;postalAddress\&quot; type=\&quot;text\&quot;&gt;&quot;</span>;</pre></p><br /> <br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$attr_name</b>&nbsp;&nbsp;</td>
<td>The name of the attribute of interestd (case insensivite)</td>
</tr>
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$val</b>&nbsp;&nbsp;</td>
<td>(optional) The current value of the attribute (speeds up the process by searching for carriage returns already in the attribute value)</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionis_url_string"></a>
<h3>is_url_string <span class="smalllinenumber">[line 995]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>bool is_url_string(
string $str)</code>
</td></tr></table>
</td></tr></table><br />
Get whether a string looks like a web URL (http://www.example.com/)<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b>&nbsp;&nbsp;</td><td>Returns true if the specified string looks like a web URL or false otherwise.</td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$str</b>&nbsp;&nbsp;</td>
<td>The string to analyze.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionpla_compare_dns"></a>
<h3>pla_compare_dns <span class="smalllinenumber">[line 562]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>int pla_compare_dns(
string $dn1, string $dn2)</code>
</td></tr></table>
</td></tr></table><br />
Compares 2 DNs. If they are equivelant, returns 0, otherwise, returns their sorting order (similar to strcmp()): Returns &lt; 0 if dn1 is less than dn2.<br /><br /><p>Returns &gt; 0 if dn1 is greater than dn2.</p><p>The comparison is performed starting with the top-most element of the DN. Thus, the following list: <pre><br />1 <span class="src-id">ou</span>=<span class="src-id">people</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">com</span><br />2 <span class="src-id">cn</span>=<span class="src-id">Admin</span><span class="src-sym">,</span><span class="src-id">ou</span>=<span class="src-id">People</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">com</span><br />3 <span class="src-id">cn</span>=<span class="src-id">Joe</span><span class="src-sym">,</span><span class="src-id">ou</span>=<span class="src-id">people</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">com</span><br />4 <span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">com</span><br />5 <span class="src-id">cn</span>=<span class="src-id">Fred</span><span class="src-sym">,</span><span class="src-id">ou</span>=<span class="src-id">people</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">org</span><br />6 <span class="src-id">cn</span>=<span class="src-id">Dave</span><span class="src-sym">,</span><span class="src-id">ou</span>=<span class="src-id">people</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">org</span></pre> Will be sorted thus using usort( $list, &quot;pla_compare_dns&quot; ): <pre><br />1 <span class="src-id">dc</span>=<span class="src-id">com</span><br />2 <span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">com</span><br />3 <span class="src-id">ou</span>=<span class="src-id">people</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">com</span><br />4 <span class="src-id">cn</span>=<span class="src-id">Admin</span><span class="src-sym">,</span><span class="src-id">ou</span>=<span class="src-id">People</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">com</span><br />5 <span class="src-id">cn</span>=<span class="src-id">Joe</span><span class="src-sym">,</span><span class="src-id">ou</span>=<span class="src-id">people</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">com</span><br />6 <span class="src-id">cn</span>=<span class="src-id">Dave</span><span class="src-sym">,</span><span class="src-id">ou</span>=<span class="src-id">people</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">org</span><br />7 <span class="src-id">cn</span>=<span class="src-id">Fred</span><span class="src-sym">,</span><span class="src-id">ou</span>=<span class="src-id">people</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">org</span></pre></p><br /> <br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$dn1</b>&nbsp;&nbsp;</td>
<td>The first of two DNs to compare</td>
</tr>
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$dn2</b>&nbsp;&nbsp;</td>
<td>The second of two DNs to compare</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionpla_explode_dn"></a>
<h3>pla_explode_dn <span class="smalllinenumber">[line 492]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>array pla_explode_dn(
string $dn, [mixed $with_attributes = 0], int $with_attriutes)</code>
</td></tr></table>
</td></tr></table><br />
Explode a DN into an array of its RDN parts. This function is UTF-8 safe and replaces the buggy PHP ldap_explode_dn() which does not properly handle UTF-8 DNs and also causes segmentation faults with some inputs.<br /><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b>&nbsp;&nbsp;</td><td>An array of RDN parts of this format: <pre><br />1 <span class="src-key">Array</span><br />2 <span class="src-sym">(</span><br />3 <span class="src-sym">[</span><span class="src-num">0</span><span class="src-sym">]</span> =&gt; <span class="src-id">uid</span>=<span class="src-id">ppratt</span><br />4 <span class="src-sym">[</span><span class="src-num">1</span><span class="src-sym">]</span> =&gt; <span class="src-id">ou</span>=<span class="src-id">People</span><br />5 <span class="src-sym">[</span><span class="src-num">2</span><span class="src-sym">]</span> =&gt; <span class="src-id">dc</span>=<span class="src-id">example</span><br />6 <span class="src-sym">[</span><span class="src-num">3</span><span class="src-sym">]</span> =&gt; <span class="src-id">dc</span>=<span class="src-id">com</span><br />7 <span class="src-sym">)</span></pre></td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$dn</b>&nbsp;&nbsp;</td>
<td>The DN to explode.</td>
</tr>
<tr>
<td class="type">int&nbsp;&nbsp;</td>
<td><b>$with_attriutes</b>&nbsp;&nbsp;</td>
<td>(optional) Whether to include attribute names (see http://php.net/ldap_explode_dn for details)</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionpla_ldap_search"></a>
<h3>pla_ldap_search <span class="smalllinenumber">[line 1226]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void pla_ldap_search(
string $filter, [string $base_dn = null], [array $attrs = array()], [string $scope = &#039;sub&#039;], [bool $sort_results = true], [int $deref = LDAP_DEREF_ALWAYS])</code>
</td></tr></table>
</td></tr></table><br />
A handy ldap searching function very similar to PHP's ldap_search() with the following exceptions: Callers may specify a search scope and the return value is an array containing the search results rather than an LDAP result resource.<br /><br /><p>Example usage: <pre><br />1 <span class="src-var">$samba_users</span> = <a href="http://www.php.net/ldap_search">ldap_search</a><span class="src-sym">(</span> <span class="src-num">0</span><span class="src-sym">,</span> <span class="src-str">&quot;(&amp;(objectClass=sambaAccount)(objectClass=posixAccount))&quot;</span><span class="src-sym">,</span><br />2 <span class="src-str">&quot;ou=People,dc=example,dc=com&quot;</span><span class="src-sym">,</span> <span class="src-key">array</span><span class="src-sym">(</span> <span class="src-str">&quot;uid&quot;</span><span class="src-sym">,</span> <span class="src-str">&quot;homeDirectory&quot;</span> <span class="src-sym">)</span> <span class="src-sym">)</span>;<br />3 <a href="http://www.php.net/print_r">print_r</a><span class="src-sym">(</span> <span class="src-var">$samba_users</span> <span class="src-sym">)</span>;<br />4 <span class="src-comm">// prints (for example):</span><br />5 <span class="src-comm">// Array</span><br />6 <span class="src-comm">// (</span><br />7 <span class="src-comm">// [uid=jsmith,ou=People,dc=example,dc=com] =&gt; Array</span><br />8 <span class="src-comm">// (</span><br />9 <span class="src-comm">// [dn] =&gt; &quot;uid=jsmith,ou=People,dc=example,dc=com&quot;</span><br />10 <span class="src-comm">// [uid] =&gt; &quot;jsmith&quot;</span><br />11 <span class="src-comm">// [homeDirectory] =&gt; &quot;\\server\jsmith&quot;</span><br />12 <span class="src-comm">// )</span><br />13 <span class="src-comm">// [uid=byoung,ou=People,dc=example,dc=com] =&gt; Array</span><br />14 <span class="src-comm">// (</span><br />15 <span class="src-comm">// [dn] =&gt; &quot;uid=byoung,ou=Samba,ou=People,dc=example,dc=com&quot;</span><br />16 <span class="src-comm">// [uid] =&gt; &quot;byoung&quot;</span><br />17 <span class="src-comm">// [homeDirectory] =&gt; &quot;\\server\byoung&quot;</span><br />18 <span class="src-comm">// )</span><br />19 <span class="src-comm">// )</span></pre></p><p>WARNING: This function will use a lot of memory on large searches since the entire result set is stored in a single array. For large searches, you should consider sing the less memory intensive PHP LDAP API directly (ldap_search(), ldap_next_entry(), ldap_next_attribute(), etc).</p><br /> <br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$filter</b>&nbsp;&nbsp;</td>
<td>The LDAP filter to use when searching (example: &quot;(objectClass=*)&quot;) (see RFC 2254)</td>
</tr>
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$base_dn</b>&nbsp;&nbsp;</td>
<td>The DN of the base of search.</td>
</tr>
<tr>
<td class="type">array&nbsp;&nbsp;</td>
<td><b>$attrs</b>&nbsp;&nbsp;</td>
<td>An array of attributes to include in the search result (example: array( &quot;objectClass&quot;, &quot;uid&quot;, &quot;sn&quot; )).</td>
</tr>
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$scope</b>&nbsp;&nbsp;</td>
<td>The LDAP search scope. Must be one of &quot;base&quot;, &quot;one&quot;, or &quot;sub&quot;. Standard LDAP search scope.</td>
</tr>
<tr>
<td class="type">bool&nbsp;&nbsp;</td>
<td><b>$sort_results</b>&nbsp;&nbsp;</td>
<td>Specify false to not sort results by DN or true to have the returned array sorted by DN (uses ksort)</td>
</tr>
<tr>
<td class="type">int&nbsp;&nbsp;</td>
<td><b>$deref</b>&nbsp;&nbsp;</td>
<td>When handling aliases or referrals, this specifies whether to follow referrals. Must be one of LDAP_DEREF_ALWAYS, LDAP_DEREF_NEVER, LDAP_DEREF_SEARCHING, or LDAP_DEREF_FINDING. See the PHP LDAP API for details.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionpla_reverse_dn"></a>
<h3>pla_reverse_dn <span class="smalllinenumber">[line 628]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string pla_reverse_dn(
string $dn)</code>
</td></tr></table>
</td></tr></table><br />
Reverses a DN such that the top-level RDN is first and the bottom-level RDN is last<br /><br /><p>For example: <pre><br />1 <span class="src-id">cn</span>=<span class="src-id">Brigham</span><span class="src-sym">,</span><span class="src-id">ou</span>=<span class="src-id">People</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">com</span></pre> Becomes: <pre><br />1 <span class="src-id">dc</span>=<span class="src-id">com</span><span class="src-sym">,</span><span class="src-id">dc</span>=<span class="src-id">example</span><span class="src-sym">,</span><span class="src-id">ou</span>=<span class="src-id">People</span><span class="src-sym">,</span><span class="src-id">cn</span>=<span class="src-id">Brigham</span></pre> This makes it possible to sort lists of DNs such that they are grouped by container.</p><br /><br /><br />
<h4>Tags:</h4>
<div class="tags">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td><b>return:</b>&nbsp;&nbsp;</td><td>The reversed DN</td>
</tr>
<tr>
<td><b>see:</b>&nbsp;&nbsp;</td><td><a href="../../lists/tree/_lib_tree_inc.html#functionpla_compare_dns">pla_compare_dns()</a></td>
</tr>
</table>
</div>
<br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$dn</b>&nbsp;&nbsp;</td>
<td>The DN to reverse</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionpretty_print_dn"></a>
<h3>pretty_print_dn <span class="smalllinenumber">[line 517]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string pretty_print_dn(
string $dn)</code>
</td></tr></table>
</td></tr></table><br />
Returns an HTML-beautified version of a DN.<br /><br /><p>Internally, this function makes use of pla_explode_dn() to break the the DN into its components. It then glues them back together with &quot;pretty&quot; HTML. The returned HTML is NOT to be used as a real DN, but simply displayed.</p><br /> <br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$dn</b>&nbsp;&nbsp;</td>
<td>The DN to pretty-print.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionreal_attr_name"></a>
<h3>real_attr_name <span class="smalllinenumber">[line 846]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>string real_attr_name(
string $attr_name)</code>
</td></tr></table>
</td></tr></table><br />
Prunes off anything after the &quot;;&quot; in an attr name. This is useful for attributes that may have &quot;;binary&quot; appended to their names. With real_attr_name(), you can more easily fetch these attributes' schema with their &quot;real&quot; attribute name.<br /><br /> <br /><br />
<h4>Parameters</h4>
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="type">string&nbsp;&nbsp;</td>
<td><b>$attr_name</b>&nbsp;&nbsp;</td>
<td>The name of the attribute to examine.</td>
</tr>
</table>
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<hr />
<a name="functionsortAttrs"></a>
<h3>sortAttrs <span class="smalllinenumber">[line 1005]</span></h3>
<div class="function">
<table width="90%" border="0" cellspacing="0" cellpadding="1"><tr><td class="code_border">
<table width="100%" border="0" cellspacing="0" cellpadding="2"><tr><td class="code">
<code>void sortAttrs(
mixed $a, mixed $b)</code>
</td></tr></table>
</td></tr></table><br />
<br /><br />
<div class="top">[ <a href="#top">Top</a> ]</div><br /><br />
</div>
<div class="credit">
<hr />
Documentation generated on Wed, 15 Nov 2006 18:01:09 +0100 by <a href="http://www.phpdoc.org">phpDocumentor 1.2.3</a>
</div>
</td></tr></table>
</td>
</tr>
</table>
</body>
</html>