本文整理汇总了PHP中get_rdn函数的典型用法代码示例。如果您正苦于以下问题:PHP get_rdn函数的具体用法?PHP get_rdn怎么用?PHP get_rdn使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了get_rdn函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRDN
/**
* Get the RDN of this tree items DN.
*
* @return RDN The RDN of this items DN.
*/
public function getRDN()
{
if (DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) {
debug_log('Entered (%%)', 33, 0, __FILE__, __LINE__, __METHOD__, $fargs);
}
return get_rdn($this->getDn(), 0, true);
}
示例2: array
* @subpackage Page
* @see update.php
*/
/**
*/
require './common.php';
$request = array();
$request['dn'] = get_request('dn', 'REQUEST', true);
if (!$request['dn'] || !$app['server']->dnExists($request['dn'])) {
error(sprintf(_('The entry (%s) does not exist.'), $request['dn']), 'error', 'index.php');
}
$request['page'] = new PageRender($app['server']->getIndex(), get_request('template', 'REQUEST', false, 'none'));
$request['page']->setDN($request['dn']);
$request['page']->accept();
$request['template'] = $request['page']->getTemplate();
$request['page']->drawTitle(get_rdn($request['template']->getDN()));
$request['page']->drawSubTitle();
# Confirm the updates
if (count($request['template']->getLDAPmodify(true))) {
echo '<center>';
echo _('Do you want to make these changes?');
echo '<br /><br />';
echo "\n\n";
echo '<form action="cmd.php" method="post">';
echo '<input type="hidden" name="cmd" value="update" />';
printf('<input type="hidden" name="server_id" value="%s" />', $app['server']->getIndex());
printf('<input type="hidden" name="dn" value="%s" />', htmlspecialchars($request['dn']));
echo "\n";
$request['page']->drawHiddenAttributes();
echo '<table class="result_table">';
echo "\n";
示例3: pla_error
* Variables that come in via GET variables
* - dn (rawurlencoded)
*
* @package phpLDAPadmin
*/
/**
*/
require './common.php';
if ($ldapserver->isReadOnly()) {
pla_error(_('You cannot perform updates while server is in read-only mode'));
}
if (!$ldapserver->haveAuthInfo()) {
pla_error(_('Not enough information to login to server. Please check your configuration.'));
}
$dn = $_GET['dn'];
$rdn = get_rdn($dn);
$attrs = $ldapserver->getDNAttrs($dn);
$select_server_html = server_select_list($ldapserver->server_id, true, 'dest_server_id');
$children = $ldapserver->getContainerContents($dn);
include './header.php';
# Draw some javaScrpt to enable/disable the filter field if this may be a recursive copy
if (is_array($children) && count($children) > 0) {
?>
<script type="text/javascript" language="javascript">
//<!--
function toggle_disable_filter_field(recursive_checkbox)
{
if (recursive_checkbox.checked) {
recursive_checkbox.form.remove.disabled = false;
recursive_checkbox.form.filter.disabled = false;
示例4: copy_dn
function copy_dn($ldapserver_src, $ldapserver_dst, $dn_src, $dn_dst)
{
if (DEBUG_ENABLED) {
debug_log('copy_dn: Entered with (%s,%s,%s,%s)', 17, $ldapserver_src->server_id, $ldapserver_dst->server_id, $dn_src, $dn_dst);
}
$new_entry = $ldapserver_src->getDNAttrs($dn_src);
# modify the prefix-value (ie "bob" in cn=bob) to match the destination DN's value.
$rdn_attr = substr($dn_dst, 0, strpos($dn_dst, '='));
$rdn_value = get_rdn($dn_dst);
$rdn_value = substr($rdn_value, strpos($rdn_value, '=') + 1);
$new_entry[$rdn_attr] = $rdn_value;
# don't need a dn attribute in the new entry
unset($new_entry['dn']);
# Check the user-defined custom call back first
if (run_hook('pre_entry_create', array('server_id' => $ldapserver_dst->server_id, 'dn' => $dn_dst, 'attrs' => $new_entry))) {
$add_result = $ldapserver_dst->add($dn_dst, $new_entry);
if (!$add_result) {
run_hook('post_entry_create', array('server_id' => $ldapserver_dst->server_id, 'dn' => $dn_dst, 'attrs' => $new_entry));
echo '</small><br /><br />';
pla_error(_('Failed to copy DN: ') . $dn_dst, $ldapserver_dst->error(), $ldapserver_dst->errno());
}
return $add_result;
} else {
return false;
}
}
示例5: copy_dn
function copy_dn($serverSRC, $serverDST, $dnSRC, $dnDST, $remove)
{
if (DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) {
debug_log('Entered (%%)', 1, 0, __FILE__, __LINE__, __METHOD__, $fargs);
}
$request = array();
$request['pageSRC'] = new PageRender($serverSRC->getIndex(), get_request('template', 'REQUEST', false, 'none'));
$request['pageSRC']->setDN($dnSRC);
$request['pageSRC']->accept();
$request['pageDST'] = new PageRender($serverDST->getIndex(), get_request('template', 'REQUEST', false, 'none'));
$request['pageDST']->setContainer($serverDST->getContainer($dnDST));
$request['pageDST']->accept();
$request['templateSRC'] = $request['pageSRC']->getTemplate();
$request['templateDST'] = $request['pageDST']->getTemplate();
$request['templateDST']->copy($request['pageSRC']->getTemplate(), get_rdn($dnDST, 0));
# Create of move the entry
if ($remove) {
return $serverDST->rename($request['templateSRC']->getDN(), $request['templateDST']->getRDN(), $serverDST->getContainer($dnDST), true);
} else {
return $serverDST->add($request['templateDST']->getDN(), $request['templateDST']->getLDAPadd());
}
}
示例6: draw_item
/**
* Recursively descend on the given dn and draw the tree in html
*
* @param dn $dn Current dn.
* @param int $level Level to start drawing (start to -1)
*/
protected function draw_item($item, $level)
{
if (DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) {
debug_log('Entered (%%)', 33, 0, __FILE__, __LINE__, __METHOD__, $fargs);
}
$server = $this->getServer();
# Get entry to display as node
$entry = $this->getEntry($item);
# If the entry doesnt exist, we'll add it.
if (!$entry) {
$this->addEntry($item);
$entry = $this->getEntry($item);
}
# If the entry doesnt exist in the server, then return here with an empty string.
if (!$entry) {
return;
}
# Get our children.
$child_count = $this->readChildrenNumber($item);
$rdn = get_rdn($item);
$dnENCODE = rawurlencode($item);
$href['expand'] = htmlspecialchars(sprintf('cmd.php?cmd=expand&server_id=%s&dn=%s', $server->getIndex(), $dnENCODE));
$href['collapse'] = htmlspecialchars(sprintf('cmd.php?cmd=collapse&server_id=%s&dn=%s', $server->getIndex(), $dnENCODE));
$href['edit'] = htmlspecialchars(sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s', $server->getIndex(), $dnENCODE));
echo '<tr class="option">';
printf('<td class="spacer" colspan=%s></td>', $level + 2);
# Is this node expanded? (deciding whether to draw "+" or "-")
if ($entry->isOpened()) {
if (!$child_count && !$this->getServer()->isShowCreateEnabled()) {
printf('<td class="expander"><img src="%s/minus.png" alt="-" /></td>', IMGDIR);
} else {
printf('<td class="expander"><a href="%s"><img src="%s/minus.png" alt="-" /></a></td>', $href['collapse'], IMGDIR);
}
} else {
if ($child_count !== false && !$child_count && !$this->getServer()->isShowCreateEnabled()) {
printf('<td class="expander"><img src="%s/minus.png" alt="-" /></td>', IMGDIR);
} else {
printf('<td class="expander"><a href="%s"><img src="%s/plus.png" alt="+" /></a></td>', $href['expand'], IMGDIR);
}
}
printf('<td class="icon"><a href="%s" id="node_%s_%s"><img src="%s/%s" alt="img" /></a></td>', $href['edit'], $server->getIndex(), preg_replace('/=/', '_', base64_encode($item)), IMGDIR, $entry->getIcon());
printf('<td class="phplm" width=100%% colspan="%s"><span style="white-space: nowrap;">', $this->getDepth() + 3 - $level);
printf('<a href="%s">%s</a>', $href['edit'], $this->get_formatted_dn($entry, $level));
if ($child_count) {
printf(' <span class="count">(%s)</span>', $child_count);
}
echo '</span></td></tr>';
if ($entry->isOpened()) {
/* Draw the "create new" link at the top of the tree list if there are more than 10
* entries in the listing for this node.
*/
if (!$server->isReadOnly() && count($entry->getChildren()) > 10 && $this->getServer()->isShowCreateEnabled()) {
$this->draw_create_link($rdn, $level, $dnENCODE);
}
foreach ($entry->getChildren() as $dnChildEntry) {
$this->draw_item($dnChildEntry, $level + 1);
}
# Always draw the "create new" link at the bottom of the listing
if (!$server->isReadOnly() && !$entry->isLeaf() && $this->getServer()->isShowCreateEnabled()) {
$this->draw_create_link($rdn, $level, $dnENCODE);
}
}
if (DEBUG_ENABLED) {
debug_log('Leaving (%s,%s)', 33, 0, __FILE__, __LINE__, __METHOD__, $item, $level);
}
}
示例7: array
$query['filter'] = $_SESSION[APPCONFIG]->getValue('modify_member', 'posixfilter');
$attr = $_SESSION[APPCONFIG]->getValue('modify_member', 'posixattr');
} else {
$query['filter'] = $_SESSION[APPCONFIG]->getValue('modify_member', 'filter');
$attr = $_SESSION[APPCONFIG]->getValue('modify_member', 'attr');
}
$query['attrs'] = array($attr);
$possible_values = array();
foreach ($app['server']->getBaseDN() as $base) {
$query['base'] = $base;
$possible_values = array_merge($possible_values, $app['server']->query($query, null));
}
usort($possible_values, 'pla_compare_dns');
$request['page']->drawTitle(sprintf('%s <b>%s</b>', _('Modify group'), get_rdn($request['dn'])));
$request['page']->drawSubTitle();
printf('%s <b>%s</b> %s <b>%s</b>:', _('There are'), count($current_members), _('members in group'), htmlspecialchars(get_rdn($request['dn'])));
$possible_members = array();
for ($i = 0; $i < count($possible_values); $i++) {
if (preg_match("/^" . $request['attr'] . "\$/i", $_SESSION[APPCONFIG]->getValue('modify_member', 'posixgroupattr'))) {
$possible_members[$i] = $possible_values[$i][$_SESSION[APPCONFIG]->getValue('modify_member', 'posixattr')][0];
} else {
$possible_members[$i] = $possible_values[$i][$_SESSION[APPCONFIG]->getValue('modify_member', 'attr')];
}
}
# Show only user that are not already in group.
$possible_members = array_diff($possible_members, $current_members);
usort($possible_members, 'pla_compare_dns');
/* Draw form with select boxes, left for all possible members and
* right one for those that belong to group */
# Modifications will be sent to update_confirm which takes care of rest of the processing
echo '<br />';
示例8: error
# Check if the entry exists.
if (!$request['dn'] || !$app['server']->dnExists($request['dn'])) {
error(sprintf(_('The entry (%s) does not exist.'), $request['dn']), 'error', 'index.php');
}
$request['page'] = new TemplateRender($app['server']->getIndex(), get_request('template', 'REQUEST', false, 'none'));
$request['page']->setDN($request['dn']);
$request['page']->accept(true);
$request['template'] = $request['page']->getTemplate();
/*
if ($request['attribute']->isReadOnly())
error(sprintf(_('The attribute (%s) is in readonly mode.'),$request['attr']),'error','index.php');
*/
# Render the form
if (get_request('meth', 'REQUEST') != 'ajax') {
# Render the form.
$request['page']->drawTitle(sprintf('%s <b>%s</b> %s <b>%s</b>', _('Add new'), $request['attr'], _('value to'), get_rdn($request['dn'])));
$request['page']->drawSubTitle();
if (!strcasecmp($request['attr'], 'objectclass')) {
echo '<form action="cmd.php" method="post" class="new_value" name="entry_form">';
echo '<input type="hidden" name="cmd" value="add_oclass_form" />';
} else {
echo '<form action="cmd.php" method="post" class="new_value" name="entry_form" enctype="multipart/form-data" onSubmit="return submitForm(this)">';
if ($_SESSION[APPCONFIG]->getValue('confirm', 'update')) {
echo '<input type="hidden" name="cmd" value="update_confirm" />';
} else {
echo '<input type="hidden" name="cmd" value="update" />';
}
}
printf('<input type="hidden" name="server_id" value="%s" />', $app['server']->getIndex());
printf('<input type="hidden" name="dn" value="%s" />', htmlspecialchars($request['dn']));
echo '<center>';
示例9: array
/**
* Displays a form for renaming an LDAP entry.
*
* @package phpLDAPadmin
* @subpackage Page
*/
/**
*/
require './common.php';
# The DN we are working with
$request = array();
$request['dn'] = get_request('dn', 'GET');
$request['template'] = get_request('template', 'GET');
$request['page'] = new PageRender($app['server']->getIndex(), get_request('template', 'REQUEST', false, 'none'));
$request['page']->setDN($request['dn']);
$request['page']->accept();
# Render the form
$request['page']->drawTitle(sprintf('%s <b>%s</b>', _('Rename'), get_rdn($request['dn'])));
$request['page']->drawSubTitle();
echo '<center>';
printf('%s <b>%s</b> %s:<br /><br />', _('Rename'), get_rdn($request['dn']), _('to a new object'));
echo '<form action="cmd.php?cmd=rename" method="post" />';
printf('<input type="hidden" name="server_id" value="%s" />', $app['server']->getIndex());
printf('<input type="hidden" name="dn" value="%s" />', rawurlencode($request['dn']));
printf('<input type="hidden" name="template" value="%s" />', $request['template']);
printf('<input type="text" name="new_rdn" size="30" value="%s" />', get_rdn($request['dn']));
printf('<input type="submit" value="%s" />', _('Rename'));
echo '</form>';
echo '</center>';
echo "\n";
示例10: drawTitle
public function drawTitle($title = null)
{
if (DEBUGTMP) {
printf('<font size=-2>%s</font><br />', __METHOD__);
}
if (is_null($title)) {
switch ($this->getMode()) {
case 'creation':
$title = _('Create Object');
break;
case 'modification':
$title = htmlspecialchars(get_rdn($this->dn));
break;
default:
$title = 'Title';
}
}
parent::drawTitle($title);
}
示例11: pla_error
if ($ldapserver->isReadOnly()) {
pla_error(_('You cannot perform updates while server is in read-only mode'));
}
if (!$ldapserver->haveAuthInfo()) {
pla_error(_('Not enough information to login to server. Please check your configuration.'));
}
$dn = $_POST['dn'];
if (!$dn) {
pla_error(_('You must specify a DN'));
}
if (!$ldapserver->dnExists($dn)) {
pla_error(sprintf(_('No such entry: %s'), htmlspecialchars($dn)));
}
include './header.php';
echo '<body>';
printf('<h3 class="title">' . _('Deleting %s') . '</h3>', htmlspecialchars(get_rdn($dn)));
printf('<h3 class="subtitle">%s</h3>', _('Recursive delete progress'));
echo '<br /><br />';
echo '<small>';
flush();
# prevent script from bailing early on a long delete
@set_time_limit(0);
$del_result = pla_rdelete($ldapserver, $dn);
echo '</small><br />';
if ($del_result) {
echo '<script language="javascript">parent.left_frame.location.reload();</script>';
printf(_('Entry %s and sub-tree deleted successfully.'), '<b>' . htmlspecialchars($dn) . '</b>');
} else {
pla_error(sprintf(_('Could not delete the entry: %s'), htmlspecialchars($dn)), $ldapserver->error(), $ldapserver->errno());
}
function pla_rdelete($ldapserver, $dn)
示例12: array_unique
}
$ldap['attrs']['must'] = array_unique($ldap['attrs']['must']);
/* Build a list of the attributes that this new objectClass requires,
* but that the object does not currently contain */
$ldap['attrs']['need'] = array();
foreach ($ldap['attrs']['must'] as $attr) {
if (is_null($request['template']->getAttribute($attr))) {
array_push($ldap['attrs']['need'], $attribute_factory->newAttribute($attr, array('values' => array()), $app['server']->getIndex()));
}
}
# Mark all the need attributes as shown
foreach ($ldap['attrs']['need'] as $index => $values) {
$ldap['attrs']['need'][$index]->show();
}
if (count($ldap['attrs']['need']) > 0) {
$request['page']->drawTitle(sprintf('%s <b>%s</b>', _('Add new objectClass to'), get_rdn($request['dn'])));
$request['page']->drawSubTitle();
echo '<div style="text-align: center">';
printf('<small><b>%s: </b>%s <b>%s</b> %s %s</small>', _('Instructions'), _('In order to add these objectClass(es) to this entry, you must specify'), count($ldap['attrs']['need']), _('new attributes'), _('that this objectClass requires.'));
echo '<br /><br />';
echo '<form action="cmd.php" method="post" id="entry_form">';
echo '<div>';
if ($_SESSION[APPCONFIG]->getValue('confirm', 'update')) {
echo '<input type="hidden" name="cmd" value="update_confirm" />';
} else {
echo '<input type="hidden" name="cmd" value="update" />';
}
printf('<input type="hidden" name="server_id" value="%s" />', $app['server']->getIndex());
printf('<input type="hidden" name="dn" value="%s" />', htmlspecialchars($request['dn']));
echo '</div>';
echo '<table class="entry" cellspacing="0" border="0" style="margin-left: auto; margin-right: auto;">';
示例13: error
# Check if the entry exists.
if (!$request['dn'] || !$app['server']->dnExists($request['dn'])) {
error(sprintf(_('The entry (%s) does not exist.'), $request['dn']), 'error', 'index.php');
}
$request['page'] = new TemplateRender($app['server']->getIndex(), get_request('template', 'REQUEST', false, null));
$request['page']->setDN($request['dn']);
$request['page']->accept(true);
$request['template'] = $request['page']->getTemplate();
/*
if ($request['attribute']->isReadOnly())
error(sprintf(_('The attribute (%s) is in readonly mode.'),$request['attr']),'error','index.php');
*/
# Render the form
if (!strcasecmp($request['attr'], 'objectclass') || get_request('meth', 'REQUEST') != 'ajax') {
# Render the form.
$request['page']->drawTitle(sprintf('%s <b>%s</b> %s <b>%s</b>', _('Add new'), htmlspecialchars($request['attr']), _('value to'), htmlspecialchars(get_rdn($request['dn']))));
$request['page']->drawSubTitle();
if (!strcasecmp($request['attr'], 'objectclass')) {
echo '<form action="cmd.php" method="post" class="new_value" id="entry_form">';
echo '<div>';
echo '<input type="hidden" name="cmd" value="add_oclass_form" />';
} else {
echo '<form action="cmd.php" method="post" class="new_value" id="entry_form" enctype="multipart/form-data" onsubmit="return submitForm(this)">';
echo '<div>';
if ($_SESSION[APPCONFIG]->getValue('confirm', 'update')) {
echo '<input type="hidden" name="cmd" value="update_confirm" />';
} else {
echo '<input type="hidden" name="cmd" value="update" />';
}
}
printf('<input type="hidden" name="server_id" value="%s" />', $app['server']->getIndex());
示例14: rawurldecode
*/
require 'common.php';
$dn = rawurldecode($_GET['dn']);
$server_id = $_GET['server_id'];
$format = $_GET['format'];
$scope = $_GET['scope'] ? $_GET['scope'] : 'base';
check_server_id($server_id) or pla_error("Bad server_id: " . htmlspecialchars($server_id));
have_auth_info($server_id) or pla_error("Not enough information to login to server. Please check your configuration.");
$objects = pla_ldap_search($server_id, 'objectClass=*', $dn, array(), $scope, false);
$server_name = $servers[$server_id]['name'];
$server_host = $servers[$server_id]['host'];
//echo "<pre>";
//print_r( $objects );
//exit;
$rdn = get_rdn($dn);
$friendly_rdn = get_rdn($dn, 1);
switch ($format) {
case 'win':
$br = "\r\n";
break;
case 'mac':
$br = "\r";
break;
case 'unix':
default:
$br = "\n";
break;
}
if (!$objects) {
pla_error("Search on dn (" . htmlspecialchars($dn) . ") came back empty");
}
示例15: preg_replace
if (isset($_POST['filter'])) {
preg_replace('/\\s+/', '', $_POST['filter']);
$attributes = split(',', preg_replace('/\\s+/', '', $_POST['attributes']));
} else {
$attributes = array();
}
# add system attributes if needed
if (isset($_POST['sys_attr'])) {
array_push($attributes, '*');
array_push($attributes, '+');
}
isset($_POST['exporter_id']) or pla_error(_('You must choose an export format.'));
$exporter_id = $_POST['exporter_id'];
isset($exporters[$exporter_id]) or pla_error(_('Invalid export format'));
# Initialisation of other variables
$friendly_rdn = get_rdn($base_dn, 1);
$extension = $exporters[$exporter_id]['extension'];
# default case not really needed
switch ($format) {
case 'win':
$br = "\r\n";
break;
case 'mac':
$br = "\r";
break;
case 'unix':
default:
$br = "\n";
}
# get the decoree,ie the source
$plaLdapExporter = new PlaLdapExporter($ldapserver->server_id, $filter, $base_dn, $scope, $attributes);