コード例 #1
0
			<tr class="row2">
		<?php 
            }
            ?>
		<td class="attr"><b><?php 
            // is there a user-friendly translation available for this attribute?
            if (isset($friendly_attrs[strtolower($attr)])) {
                $attr_display = "<acronym title=\"Alias for " . htmlspecialchars($attr) . "\">" . htmlspecialchars($friendly_attrs[strtolower($attr)]) . "</acronym>";
            } else {
                $attr_display = htmlspecialchars($attr);
            }
            echo $attr_display;
            ?>
</b></td>
		<td class="val"><input 	type="<?php 
            echo is_attr_binary($server_id, $attr) ? "file" : "text";
            ?>
"
					name="required_attrs[<?php 
            echo htmlspecialchars($attr);
            ?>
]"
					value="<?php 
            echo $attr == $rdn_attr ? $rdn_value : '';
            ?>
" size="40" />
	</tr>
	<?php 
        }
    }
    ?>
コード例 #2
0
     */
    if (is_jpeg_photo($server_id, $attr)) {
        // Don't draw the delete buttons if there is more than one jpegPhoto
        // 	(phpLDAPadmin can't handle this case yet)
        if (is_server_read_only($server_id)) {
            draw_jpeg_photos($server_id, $dn, false);
        } else {
            draw_jpeg_photos($server_id, $dn, true);
        }
        // proceed to the next attribute
        continue;
    }
    /*
     * Is this attribute binary?
     */
    if (is_attr_binary($server_id, $attr)) {
        $href = "download_binary_attr.php?server_id={$server_id}&amp;dn={$encoded_dn}&amp;attr={$attr}";
        ?>

		<small>
		<?php 
        echo $lang['binary_value'];
        ?>
<br />
		<?php 
        if (count($vals) > 1) {
            for ($i = 1; $i <= count($vals); $i++) {
                ?>
			<a href="<?php 
                echo $href . "&amp;value_num={$i}";
                ?>
コード例 #3
0
function pla_ldap_search($server_id, $filter, $base_dn = null, $attrs = array(), $scope = 'sub', $sort_results = true)
{
    global $servers;
    if (!check_server_id($server_id)) {
        return false;
    }
    if ($base_dn == null) {
        $base_dn = $servers[$server_id]['base'];
    }
    $ds = pla_ldap_connect($server_id);
    if (!$ds) {
        return false;
    }
    switch ($scope) {
        case 'base':
            $search = @ldap_read($ds, $base_dn, $filter, $attrs, 0, 200, 0, LDAP_DEREF_ALWAYS);
            break;
        case 'one':
            $search = @ldap_list($ds, $base_dn, $filter, $attrs, 0, 200, 0, LDAP_DEREF_ALWAYS);
            break;
        case 'sub':
        default:
            $search = @ldap_search($ds, $base_dn, $filter, $attrs, 0, 200, 0, LDAP_DEREF_ALWAYS);
            break;
    }
    if (!$search) {
        return array();
    }
    //get the first entry identifier
    if ($entry_id = ldap_first_entry($ds, $search)) {
        //iterate over the entries
        while ($entry_id) {
            //get the distinguished name of the entry
            $dn = ldap_get_dn($ds, $entry_id);
            //get the attributes of the entry
            $attrs = ldap_get_attributes($ds, $entry_id);
            $return[$dn]['dn'] = $dn;
            //get the first attribute of the entry
            if ($attr = ldap_first_attribute($ds, $entry_id, $attrs)) {
                //iterate over the attributes
                while ($attr) {
                    if (is_attr_binary($server_id, $attr)) {
                        $values = ldap_get_values_len($ds, $entry_id, $attr);
                    } else {
                        $values = ldap_get_values($ds, $entry_id, $attr);
                    }
                    //get the number of values for this attribute
                    $count = $values['count'];
                    unset($values['count']);
                    if ($count == 1) {
                        $return[$dn][$attr] = $values[0];
                    } else {
                        $return[$dn][$attr] = $values;
                    }
                    $attr = ldap_next_attribute($ds, $entry_id, $attrs);
                }
            }
            // end while attr
            $entry_id = ldap_next_entry($ds, $entry_id);
        }
    }
    // end while entry_id
    if ($sort_results && is_array($return)) {
        ksort($return);
    }
    return $return;
}