new PLA release
|
@ -0,0 +1,185 @@
|
|||
<?php
|
||||
/**
|
||||
* Displays a form for adding an attribute/value to an LDAP entry.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
|
||||
# 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();
|
||||
|
||||
# Render the form
|
||||
if (get_request('meth','REQUEST') != 'ajax') {
|
||||
$request['page']->drawTitle(sprintf('%s <b>%s</b>',_('Add new attribute'),get_rdn($request['dn'])));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
echo '<div style="text-align: center;">';
|
||||
if (count($request['template']->getAvailAttrs())) {
|
||||
# If we have more than the configured entries, we'll separate our input to the old ways.
|
||||
if (count($request['template']->getAvailAttrs()) > $_SESSION[APPCONFIG]->getValue('appearance','max_add_attrs')) {
|
||||
$attr = array();
|
||||
$attr['avail'] = array();
|
||||
$attr['binary'] = array();
|
||||
|
||||
foreach ($request['template']->getAvailAttrs() as $attribute)
|
||||
if ($app['server']->isAttrBinary($attribute->getName()))
|
||||
array_push($attr['binary'],$attribute);
|
||||
else
|
||||
array_push($attr['avail'],$attribute);
|
||||
|
||||
if (count($attr['avail']) > 0) {
|
||||
echo '<br />';
|
||||
echo _('Add new attribute');
|
||||
echo '<br />';
|
||||
echo '<br />';
|
||||
|
||||
echo '<form action="cmd.php" method="post">';
|
||||
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 '<select name="single_item_attr">';
|
||||
|
||||
foreach ($attr['avail'] as $attribute) {
|
||||
# Is there a user-friendly translation available for this attribute?
|
||||
if ($attribute->haveFriendlyName())
|
||||
$attr_display = sprintf('%s (%s)',$attribute->getFriendlyName(),$attribute->getName(false));
|
||||
else
|
||||
$attr_display = $attribute->getName(false);
|
||||
|
||||
printf('<option value="%s">%s</option>',htmlspecialchars($attribute->getName()),$attr_display);
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
|
||||
echo '<input type="text" name="single_item_value" size="20" />';
|
||||
printf('<input type="submit" name="submit" value="%s" class="update_dn" />',_('Add'));
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
} else {
|
||||
echo '<br />';
|
||||
printf('<small>(%s)</small>',_('no new attributes available for this entry'));
|
||||
}
|
||||
|
||||
if (count($attr['binary']) > 0) {
|
||||
echo '<br />';
|
||||
echo _('Add new binary attribute');
|
||||
echo '<br />';
|
||||
echo '<br />';
|
||||
|
||||
echo '<!-- Form to add a new BINARY attribute to this entry -->';
|
||||
echo '<form action="cmd.php" method="post" enctype="multipart/form-data">';
|
||||
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" />',$request['dn']);
|
||||
echo '<input type="hidden" name="binary" value="true" />';
|
||||
|
||||
echo '<select name="single_item_attr">';
|
||||
|
||||
foreach ($attr['binary'] as $attribute) {
|
||||
# Is there a user-friendly translation available for this attribute?
|
||||
if ($attribute->haveFriendlyName())
|
||||
$attr_display = sprintf('%s (%s)',$attribute->getFriendlyName(),$attribute->getName(false));
|
||||
else
|
||||
$attr_display = $attribute->getName(false);
|
||||
|
||||
printf('<option value="%s">%s</option>',htmlspecialchars($attribute->getName()),$attr_display);
|
||||
}
|
||||
|
||||
echo '</select>';
|
||||
|
||||
echo '<input type="file" name="single_item_value" size="20" />';
|
||||
printf('<input type="submit" name="submit" value="%s" class="update_dn" />',_('Add'));
|
||||
|
||||
if (! ini_get('file_uploads'))
|
||||
printf('<br /><small><b>%s</b></small><br />',
|
||||
_('Your PHP configuration has disabled file uploads. Please check php.ini before proceeding.'));
|
||||
|
||||
else
|
||||
printf('<br /><small><b>%s: %s</b></small><br />',_('Maximum file size'),ini_get('upload_max_filesize'));
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
} else {
|
||||
echo '<br />';
|
||||
printf('<small>(%s)</small>',_('no new binary attributes available for this entry'));
|
||||
}
|
||||
|
||||
} else {
|
||||
echo '<br />';
|
||||
|
||||
$request['page']->drawFormStart();
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($request['dn']));
|
||||
|
||||
echo '<table class="entry" cellspacing="0" align="center" border="0">';
|
||||
|
||||
foreach ($request['template']->getAvailAttrs() as $attribute)
|
||||
$request['page']->draw('Template',$attribute);
|
||||
|
||||
$request['page']->drawFormSubmitButton();
|
||||
echo '</table>';
|
||||
|
||||
$request['page']->drawFormEnd();
|
||||
}
|
||||
|
||||
} else {
|
||||
printf('<small>(%s)</small>',_('no new attributes available for this entry'));
|
||||
}
|
||||
|
||||
echo '</div>';
|
||||
|
||||
# The ajax addition (it is going into an existing TemplateRendered page
|
||||
} else {
|
||||
# Put our DIV there for the callback
|
||||
echo '<fieldset>';
|
||||
printf('<legend>%s</legend>',_('Add Attribute'));
|
||||
echo '<div id="ajADDATTR">';
|
||||
echo '<table class="entry" cellspacing="0" align="center" border="0">';
|
||||
echo '<td valign="top" align="center">';
|
||||
|
||||
printf('<select name="attr" onchange="ajDISPLAY(\'%s\',\'cmd=add_value_form&server_id=%s&dn=%s&attr=\'+this.value,\'%s\',\'append\');">',
|
||||
'ADDATTR',$app['server']->getIndex(),$request['template']->getDNEncode(),_('Please Wait'));
|
||||
|
||||
printf('<option value="%s">%s</option>','','');
|
||||
foreach ($request['template']->getAvailAttrs() as $attribute)
|
||||
printf('<option value="%s">%s</option>',htmlspecialchars($attribute->getName()),$attribute->getFriendlyName());
|
||||
|
||||
echo '</select>';
|
||||
|
||||
echo '</td>';
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
echo '</fieldset>';
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,117 @@
|
|||
<?php
|
||||
/**
|
||||
* This page will allow the adding of additional ObjectClasses to an item.
|
||||
* + If the ObjectClass to be added requires additional MUST attributes to be
|
||||
* defined, then they will be prompted for.
|
||||
* + If the ObjectClass doesnt need any additional MUST attributes, then it
|
||||
* will be silently added to the object.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DN and OBJECTCLASS we are working with.
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST',true);
|
||||
|
||||
# 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();
|
||||
|
||||
$attribute_factory = new AttributeFactory();
|
||||
|
||||
# Grab the required attributes for the new objectClass
|
||||
$ldap = array();
|
||||
$ldap['attrs']['must'] = array();
|
||||
|
||||
foreach ($request['template']->getAttribute('objectclass')->getValues() as $oclass_name) {
|
||||
# Exclude "top" if its there.
|
||||
if (! strcasecmp('top',$oclass_name))
|
||||
continue;
|
||||
|
||||
if ($soc = $app['server']->getSchemaObjectClass($oclass_name))
|
||||
$ldap['attrs']['must'] = array_merge($ldap['attrs']['must'],$soc->getMustAttrNames(true));
|
||||
}
|
||||
|
||||
$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;">';
|
||||
printf('<tr><th colspan="2">%s</th></tr>',_('New Required Attributes'));
|
||||
|
||||
$counter = 0;
|
||||
echo '<tr><td colspan="2">';
|
||||
foreach ($request['template']->getAttribute('objectclass')->getValues() as $value)
|
||||
$request['page']->draw('HiddenValue',$request['template']->getAttribute('objectclass'),$counter++);
|
||||
echo '</td></tr>';
|
||||
|
||||
foreach ($ldap['attrs']['need'] as $count => $attr)
|
||||
$request['page']->draw('Template',$attr);
|
||||
|
||||
echo '</table>';
|
||||
|
||||
printf('<div style="text-align: center;"><br /><input type="submit" value="%s" /></div>',_('Add ObjectClass and Attributes'));
|
||||
echo '</form>';
|
||||
echo '</div>';
|
||||
|
||||
# There are no other required attributes, so we just need to add the objectclass to the DN.
|
||||
} else {
|
||||
$result = $app['server']->modify($request['dn'],$request['template']->getLDAPmodify());
|
||||
|
||||
if ($result) {
|
||||
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s&modified_attrs[]=objectclass',
|
||||
$app['server']->getIndex(),rawurlencode($request['dn']));
|
||||
|
||||
if (get_request('meth','REQUEST') == 'ajax')
|
||||
$href .= '&meth=ajax';
|
||||
|
||||
header(sprintf('Location: %s',$href));
|
||||
die();
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,173 @@
|
|||
<?php
|
||||
/**
|
||||
* Displays a form to allow the user to enter a new value to add
|
||||
* to the existing list of values for a multi-valued attribute.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DN and ATTR we are working with.
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET',true);
|
||||
$request['attr'] = get_request('attr','GET',true);
|
||||
|
||||
# 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'),$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" 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());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',htmlspecialchars($request['dn']));
|
||||
echo '</div>';
|
||||
|
||||
echo '<table class="forminput" border="0" style="margin-left: auto; margin-right: auto;">';
|
||||
echo '<tr>';
|
||||
|
||||
$request['attribute'] = $request['template']->getAttribute($request['attr']);
|
||||
$request['count'] = $request['attribute']->getValueCount();
|
||||
|
||||
if ($request['count']) {
|
||||
printf('<td class="top">%s <b>%s</b> %s <b>%s</b>:</td>',
|
||||
_('Current list of'),$request['count'],_('values for attribute'),$request['attribute']->getFriendlyName());
|
||||
|
||||
echo '<td>';
|
||||
|
||||
# Display current attribute values
|
||||
echo '<table border="0"><tr><td>';
|
||||
for ($i=0;$i<$request['count'];$i++) {
|
||||
if ($i > 0)
|
||||
echo '<br/>';
|
||||
$request['page']->draw('CurrentValue',$request['attribute'],$i);
|
||||
$request['page']->draw('HiddenValue',$request['attribute'],$i);
|
||||
}
|
||||
echo '</td></tr></table>';
|
||||
|
||||
echo '</td>';
|
||||
|
||||
} else {
|
||||
printf('<td>%s <b>%s</b>.</td>',
|
||||
_('No current value for attribute'),$request['attribute']->getFriendlyName());
|
||||
echo '<td><br /><br /></td>';
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td class="top">%s</td>',_('Enter the value(s) you would like to add:'));
|
||||
echo '<td>';
|
||||
|
||||
if (! strcasecmp($request['attr'],'objectclass')) {
|
||||
# If our attr is an objectClass, fetch all available objectClasses and remove those from the list that are already defined in the entry
|
||||
$socs = $app['server']->SchemaObjectClasses();
|
||||
|
||||
foreach ($request['attribute']->getValues() as $oclass)
|
||||
unset($socs[strtolower($oclass)]);
|
||||
|
||||
# Draw objectClass selection
|
||||
echo '<table border="0">';
|
||||
echo '<tr><td>';
|
||||
echo '<select name="new_values[objectclass][]" multiple="multiple" size="15">';
|
||||
foreach ($socs as $name => $oclass) {
|
||||
# Exclude any structural ones, that are not in the heirachy, as they'll only generate an LDAP_OBJECT_CLASS_VIOLATION
|
||||
if (($oclass->getType() == 'structural') && ! $oclass->isRelated($request['attribute']->getValues()))
|
||||
continue;
|
||||
|
||||
printf('<option value="%s">%s</option>',$oclass->getName(false),$oclass->getName(false));
|
||||
}
|
||||
echo '</select>';
|
||||
echo '</td></tr><tr><td>';
|
||||
|
||||
echo '<br />';
|
||||
printf('<input id="save_button" type="submit" value="%s" %s />',
|
||||
_('Add new ObjectClass'),
|
||||
(isAjaxEnabled() ? sprintf('onclick="return ajSUBMIT(\'BODY\',document.getElementById(\'entry_form\'),\'%s\');"',_('Updating Object')) : ''));
|
||||
echo '</td></tr></table>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
if ($_SESSION[APPCONFIG]->getValue('appearance','show_hints'))
|
||||
printf('<tr><td colspan="2"><small><br /><img src="%s/light.png" alt="Hint" /><span class="hint">%s</span></small></td></tr>',
|
||||
IMGDIR,_('Note: You may be required to enter new attributes that these objectClass(es) require'));
|
||||
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
} else {
|
||||
# Draw a blank field
|
||||
echo '<table border="0"><tr><td>';
|
||||
$request['page']->draw('FormValue',$request['attribute'],$request['count']);
|
||||
echo '</td></tr><tr><td>';
|
||||
|
||||
$sattr = $app['server']->getSchemaAttribute($request['attr']);
|
||||
|
||||
if ($sattr->getDescription())
|
||||
printf('<small><b>%s:</b> %s</small><br />',_('Description'),$sattr->getDescription());
|
||||
|
||||
if ($sattr->getType())
|
||||
printf('<small><b>%s:</b> %s</small><br />',_('Syntax'),$sattr->getType());
|
||||
|
||||
if ($sattr->getMaxLength())
|
||||
printf('<small><b>%s:</b> %s %s</small><br />',
|
||||
_('Maximum Length'),number_format($sattr->getMaxLength()),_('characters'));
|
||||
|
||||
echo '<br />';
|
||||
printf('<input type="submit" id="save_button" name="submit" value="%s" />',_('Add New Value'));
|
||||
echo '</td></tr></table>';
|
||||
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
} else {
|
||||
if (is_null($attribute = $request['template']->getAttribute($request['attr']))) {
|
||||
$request['template']->addAttribute($request['attr'],array('values'=>array()));
|
||||
$attribute = $request['template']->getAttribute($request['attr']);
|
||||
$attribute->show();
|
||||
|
||||
echo '<table class="entry" cellspacing="0" align="center" border="0">';
|
||||
$request['page']->draw('Template',$attribute);
|
||||
$request['page']->draw('Javascript',$attribute);
|
||||
echo '</table>';
|
||||
|
||||
} else {
|
||||
$request['count'] = $attribute->getValueCount();
|
||||
$request['page']->draw('FormReadWriteValue',$attribute,$request['count']);
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,83 @@
|
|||
<?php
|
||||
/**
|
||||
* Main command page for phpLDAPadmin
|
||||
* All pages are rendered through this script.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require_once './common.php';
|
||||
|
||||
$www = array();
|
||||
$www['cmd'] = get_request('cmd','REQUEST');
|
||||
$www['meth'] = get_request('meth','REQUEST');
|
||||
|
||||
ob_start();
|
||||
|
||||
switch ($www['cmd']) {
|
||||
case '_debug':
|
||||
debug_dump($_REQUEST,1);
|
||||
break;
|
||||
|
||||
default:
|
||||
if (defined('HOOKSDIR') && file_exists(HOOKSDIR.$www['cmd'].'.php'))
|
||||
$app['script_cmd'] = HOOKSDIR.$www['cmd'].'.php';
|
||||
|
||||
elseif (defined('HTDOCDIR') && file_exists(HTDOCDIR.$www['cmd'].'.php'))
|
||||
$app['script_cmd'] = HTDOCDIR.$www['cmd'].'.php';
|
||||
|
||||
elseif (file_exists('welcome.php'))
|
||||
$app['script_cmd'] = 'welcome.php';
|
||||
|
||||
else
|
||||
$app['script_cmd'] = null;
|
||||
}
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Ready to render page for command [%s,%s].',128,0,__FILE__,__LINE__,__METHOD__,$www['cmd'],$app['script_cmd']);
|
||||
|
||||
# Create page.
|
||||
# Set the index so that we render the right server tree.
|
||||
$www['page'] = new page($app['server']->getIndex());
|
||||
|
||||
# See if we can render the command
|
||||
if (trim($www['cmd'])) {
|
||||
# If this is a READ-WRITE operation, the LDAP server must not be in READ-ONLY mode.
|
||||
if ($app['server']->isReadOnly() && ! in_array(get_request('cmd','REQUEST'),$app['readwrite_cmds']))
|
||||
error(_('You cannot perform updates while server is in read-only mode'),'error','index.php');
|
||||
|
||||
# If this command has been disabled by the config.
|
||||
if (! $_SESSION[APPCONFIG]->isCommandAvailable('script',$www['cmd'])) {
|
||||
system_message(array('title'=>_('Command disabled by the server configuration'),
|
||||
_('Error'),'body'=>sprintf('%s: <b>%s</b>.',_('The command could not be run'),htmlspecialchars($www['cmd'])),'type'=>'error'),'index.php');
|
||||
|
||||
$app['script_cmd'] = null;
|
||||
}
|
||||
}
|
||||
|
||||
if ($app['script_cmd'])
|
||||
include $app['script_cmd'];
|
||||
|
||||
# Refresh a frame - this is so that one frame can trigger another frame to be refreshed.
|
||||
if (isAjaxEnabled() && get_request('refresh','REQUEST') && get_request('refresh','REQUEST') != get_request('frame','REQUEST')) {
|
||||
echo '<script type="text/javascript" language="javascript">';
|
||||
printf("ajDISPLAY('%s','cmd=refresh&server_id=%s&noheader=%s','%s');",
|
||||
get_request('refresh','REQUEST'),$app['server']->getIndex(),get_request('noheader','REQUEST',false,0),_('Auto refresh'));
|
||||
echo '</script>';
|
||||
}
|
||||
|
||||
# Capture the output and put into the body of the page.
|
||||
$www['body'] = new block();
|
||||
$www['body']->SetBody(ob_get_contents());
|
||||
$www['page']->block_add('body',$www['body']);
|
||||
ob_end_clean();
|
||||
|
||||
if ($www['meth'] == 'ajax')
|
||||
$www['page']->show(get_request('frame','REQUEST',false,'BODY'),true,get_request('raw','REQUEST',false,false));
|
||||
else
|
||||
$www['page']->display();
|
||||
?>
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* This script alters the session variable 'tree', collapsing it
|
||||
* at the dn specified in the query string.
|
||||
*
|
||||
* Note: this script is equal and opposite to expand.php
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Tree
|
||||
* @see expand.php
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn = get_request('dn','GET',true);
|
||||
$tree = get_cached_item($app['server']->getIndex(),'tree');
|
||||
$entry = $tree->getEntry($dn);
|
||||
$entry->close();
|
||||
set_cached_item($app['server']->getIndex(),'tree','null',$tree);
|
||||
|
||||
header(sprintf('Location:index.php?server_id=%s&junk=%s#%s',
|
||||
$app['server']->getIndex(),random_junk(),htmlid($app['server']->getIndex(),$dn)));
|
||||
die();
|
||||
?>
|
|
@ -0,0 +1,14 @@
|
|||
<?php
|
||||
/**
|
||||
* This script provides a convienent method to call the proper common.php
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
if (! defined('LIBDIR'))
|
||||
define('LIBDIR',sprintf('%s/',realpath('../lib/')));
|
||||
require_once LIBDIR.'common.php';
|
||||
?>
|
|
@ -0,0 +1,188 @@
|
|||
<?php
|
||||
/**
|
||||
* Compares two DN entries side by side.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DNs we are working with
|
||||
$request = array();
|
||||
$request['dnSRC'] = get_request('dn_src');
|
||||
$request['dnDST'] = get_request('dn_dst');
|
||||
|
||||
$ldap = array();
|
||||
$ldap['SRC'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_src'));
|
||||
$ldap['DST'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_dst'));
|
||||
|
||||
if (! $ldap['SRC']->dnExists($request['dnSRC']))
|
||||
error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($request['dnSRC'])),'error','index.php');
|
||||
|
||||
if (! $ldap['DST']->dnExists($request['dnDST']))
|
||||
error(sprintf('%s (%s)',_('No such entry.'),pretty_print_dn($request['dnDST'])),'error','index.php');
|
||||
|
||||
$request['pageSRC'] = new PageRender($ldap['SRC']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['pageSRC']->setDN($request['dnSRC']);
|
||||
$request['pageSRC']->accept();
|
||||
$request['templateSRC'] = $request['pageSRC']->getTemplate();
|
||||
|
||||
$request['pageDST'] = new PageRender($ldap['DST']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['pageDST']->setDN($request['dnDST']);
|
||||
$request['pageDST']->accept();
|
||||
$request['templateDST'] = $request['pageDST']->getTemplate();
|
||||
|
||||
# Get a list of all attributes.
|
||||
$attrs_all = array_unique(array_merge($request['templateSRC']->getAttributeNames(),$request['templateDST']->getAttributeNames()));
|
||||
|
||||
$request['pageSRC']->drawTitle(_('Comparing the following DNs'));
|
||||
|
||||
echo '<br/>';
|
||||
|
||||
echo '<table class="entry" width="100%" border="0">';
|
||||
echo '<tr class="heading">';
|
||||
|
||||
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
|
||||
$ldap['SRC']->getIndex(),rawurlencode($request['dnSRC']));
|
||||
printf('<td colspan="2" style="width: 40%%;">%s: <b><a href="%s">%s</a></b></td>',
|
||||
_('DN'),
|
||||
htmlspecialchars($href),$request['dnSRC']);
|
||||
|
||||
$href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
|
||||
$ldap['DST']->getIndex(),rawurlencode($request['dnDST']));
|
||||
printf('<td colspan="2" style="width: 40%%;">%s: <b><a href="%s">%s</a></b></td>',
|
||||
_('DN'),
|
||||
htmlspecialchars($href),$request['dnDST']);
|
||||
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td colspan="4" style="text-align: right;">';
|
||||
echo '<form action="cmd.php?cmd=compare" method="post">';
|
||||
echo '<div>';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="server_id_src" value="%s" />',$ldap['DST']->getIndex());
|
||||
printf('<input type="hidden" name="server_id_dst" value="%s" />',$ldap['SRC']->getIndex());
|
||||
printf('<input type="hidden" name="dn_src" value="%s" />',htmlspecialchars($request['dnDST']));
|
||||
printf('<input type="hidden" name="dn_dst" value="%s" />',htmlspecialchars($request['dnSRC']));
|
||||
printf('<input type="submit" value="%s" />',_('Switch Entry'));
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
|
||||
if (! is_array($attrs_all) || ! count($attrs_all)) {
|
||||
printf('<tr><td colspan="4">(%s)</td></tr>',_('This entry has no attributes'));
|
||||
print '</table>';
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
sort($attrs_all);
|
||||
|
||||
# Work through each of the attributes.
|
||||
foreach ($attrs_all as $attr) {
|
||||
# Has the config.php specified that this attribute is to be hidden or shown?
|
||||
if ($ldap['SRC']->isAttrHidden($attr) || $ldap['DST']->isAttrHidden($attr))
|
||||
continue;
|
||||
|
||||
$attributeSRC = $request['templateSRC']->getAttribute($attr);
|
||||
$attributeDST = $request['templateDST']->getAttribute($attr);
|
||||
|
||||
# Get the values and see if they are the same.
|
||||
if ($attributeSRC && $attributeDST && ($attributeSRC->getValues() == $attributeDST->getValues()))
|
||||
echo '<tr>';
|
||||
else
|
||||
echo '<tr>';
|
||||
|
||||
foreach (array('src','dst') as $side) {
|
||||
# If we are on the source side, show the attribute name.
|
||||
switch ($side) {
|
||||
case 'src':
|
||||
if ($attributeSRC) {
|
||||
echo '<td class="title">';
|
||||
$request['pageSRC']->draw('Name',$attributeSRC);
|
||||
echo '</td>';
|
||||
|
||||
if ($request['pageSRC']->getServerID() == $request['pageDST']->getServerID())
|
||||
echo '<td class="title"> </td>';
|
||||
|
||||
else {
|
||||
echo '<td class="note" style="text-align: right;">';
|
||||
$request['pageSRC']->draw('Notes',$attributeSRC);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
} else {
|
||||
echo '<td colspan="2"> </td>';
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 'dst':
|
||||
if ($attributeDST) {
|
||||
if ($attributeSRC && ($request['pageSRC']->getServerID() == $request['pageDST']->getServerID()))
|
||||
echo '<td class="title"> </td>';
|
||||
|
||||
else {
|
||||
echo '<td class="title" >';
|
||||
$request['pageDST']->draw('Name',$attributeDST);
|
||||
echo '</td>';
|
||||
}
|
||||
|
||||
echo '<td class="note" style="text-align: right;">';
|
||||
$request['pageDST']->draw('Notes',$attributeDST);
|
||||
echo '</td>';
|
||||
|
||||
} else {
|
||||
echo '<td colspan="2"> </td>';
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
echo "\n\n";
|
||||
|
||||
# Get the values and see if they are the same.
|
||||
if ($attributeSRC && $attributeDST && ($attributeSRC->getValues() == $attributeDST->getValues()))
|
||||
echo '<tr style="background-color: #F0F0F0;">';
|
||||
else
|
||||
echo '<tr>';
|
||||
|
||||
foreach (array('src','dst') as $side) {
|
||||
echo '<td class="value" colspan="2"><table border="0">';
|
||||
echo '<tr><td>';
|
||||
|
||||
switch ($side) {
|
||||
case 'src':
|
||||
|
||||
if ($attributeSRC && count($attributeSRC->getValues()))
|
||||
$request['pageSRC']->draw('CurrentValues',$attributeSRC);
|
||||
else
|
||||
echo ' ';
|
||||
|
||||
break;
|
||||
|
||||
case 'dst':
|
||||
if ($attributeDST && count($attributeDST->getValues()))
|
||||
$request['pageDST']->draw('CurrentValues',$attributeDST);
|
||||
else
|
||||
echo ' ';
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
echo '</td></tr>';
|
||||
echo '</table></td>';
|
||||
}
|
||||
|
||||
echo '</tr>';
|
||||
}
|
||||
echo '</table>';
|
||||
?>
|
|
@ -0,0 +1,65 @@
|
|||
<?php
|
||||
/**
|
||||
* Compares two DN entries side by side.
|
||||
* This is the entry form to determine which DN to compare this DN with.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
|
||||
# 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 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>',_('Compare another DN with'),get_rdn($request['dn'])));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
printf('<script type="text/javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
echo '<div style="text-align: center;">';
|
||||
printf('%s <b>%s</b> %s<br />',_('Compare'),get_rdn($request['dn']),_('with '));
|
||||
echo '</div>';
|
||||
|
||||
echo '<form action="cmd.php" method="post" id="compare_form">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="cmd" value="compare" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="server_id_src" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn_src" value="%s" />',htmlspecialchars($request['dn']));
|
||||
echo '</div>';
|
||||
echo "\n";
|
||||
|
||||
echo '<table border="0" style="border-spacing: 10px; margin-left: auto; margin-right: auto;">';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym>:</td>',
|
||||
_('Compare this DN with another'),_('Destination DN'));
|
||||
echo '<td>';
|
||||
echo '<input type="text" name="dn_dst" size="45" value="" />';
|
||||
draw_chooser_link('compare_form','dn_dst','true','');
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td></td><td>%s</td></tr>',server_select_list($app['server']->getIndex(),true,'server_id_dst'));
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td colspan="2" style="text-align: center;"><input type="submit" value="%s" /></td></tr>',_('Compare'));
|
||||
echo "\n";
|
||||
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
?>
|
|
@ -0,0 +1,209 @@
|
|||
<?php
|
||||
/**
|
||||
* Copies a given object to create a new one.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DNs we are working with
|
||||
$request = array();
|
||||
$request['dnSRC'] = get_request('dn_src');
|
||||
$request['dnDST'] = get_request('dn_dst');
|
||||
|
||||
$ldap = array();
|
||||
$ldap['SRC'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_src'));
|
||||
$ldap['DST'] = $_SESSION[APPCONFIG]->getServer(get_request('server_id_dst'));
|
||||
|
||||
# Error checking
|
||||
if (! trim($request['dnDST']))
|
||||
error(_('You left the destination DN blank.'),'error','index.php');
|
||||
|
||||
if ($ldap['DST']->isReadOnly())
|
||||
error(_('Destination server is currently READ-ONLY.'),'error','index.php');
|
||||
|
||||
if ($ldap['DST']->dnExists($request['dnDST']))
|
||||
error(sprintf(_('The destination entry (%s) already exists.'),pretty_print_dn($request['dnDST'])),'error','index.php');
|
||||
|
||||
if (! $ldap['DST']->dnExists($ldap['DST']->getContainer($request['dnDST'])))
|
||||
error(sprintf(_('The destination container (%s) does not exist.'),
|
||||
pretty_print_dn($ldap['DST']->getContainer($request['dnDST']))),'error','index.php');
|
||||
|
||||
if (pla_compare_dns($request['dnSRC'],$request['dnDST']) == 0 && $ldap['SRC']->getIndex() == $ldap['DST']->getIndex())
|
||||
error(_('The source and destination DN are the same.'),'error','index.php');
|
||||
|
||||
$request['recursive'] = (get_request('recursive') == 'on') ? true : false;
|
||||
$request['remove'] = (get_request('remove') == 'yes') ? true : false;
|
||||
|
||||
if ($request['recursive']) {
|
||||
$filter = get_request('filter','POST',false,'(objectClass=*)');
|
||||
|
||||
# Build a tree similar to that of the tree browser to give to r_copy_dn
|
||||
$ldap['tree'] = array();
|
||||
printf('<h3 class="title">%s%s</h3>',_('Copying '),$request['dnSRC']);
|
||||
printf('<h3 class="subtitle">%s</h3>',_('Recursive copy progress'));
|
||||
print '<br /><br />';
|
||||
|
||||
print '<small>';
|
||||
printf ('%s...',_('Building snapshot of tree to copy'));
|
||||
|
||||
$ldap['tree'] = build_tree($ldap['SRC'],$request['dnSRC'],array(),$filter);
|
||||
printf('<span style="color:green">%s</span><br />',_('Success'));
|
||||
|
||||
# Prevent script from bailing early on a long delete
|
||||
@set_time_limit(0);
|
||||
|
||||
$copy_result = r_copy_dn($ldap['SRC'],$ldap['DST'],$ldap['tree'],$request['dnSRC'],$request['dnDST'],$request['remove']);
|
||||
$copy_message = $copy_result;
|
||||
print '</small>';
|
||||
|
||||
} else {
|
||||
if ($_SESSION[APPCONFIG]->getValue('confirm','copy')) {
|
||||
$request['pageSRC'] = new TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,null));
|
||||
$request['pageSRC']->setDN($request['dnSRC']);
|
||||
$request['pageSRC']->accept(true);
|
||||
|
||||
$request['pageDST'] = new TemplateRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['pageDST']->setContainer($app['server']->getContainer($request['dnDST']));
|
||||
$request['pageDST']->accept(true);
|
||||
|
||||
$request['templateSRC'] = $request['pageSRC']->getTemplate();
|
||||
$request['templateDST'] = $request['pageDST']->getTemplate();
|
||||
|
||||
$request['templateDST']->copy($request['templateSRC'],get_rdn($request['dnDST']),true);
|
||||
|
||||
# Set all attributes with a values as shown, and remove the add value options
|
||||
foreach ($request['templateDST']->getAttributes(true) as $sattribute)
|
||||
if ($sattribute->getValues() && ! $sattribute->isInternal()) {
|
||||
$sattribute->show();
|
||||
$sattribute->setMaxValueCount(count($sattribute->getValues()));
|
||||
}
|
||||
|
||||
$request['pageDST']->accept();
|
||||
|
||||
return;
|
||||
|
||||
} else {
|
||||
$copy_result = copy_dn($ldap['SRC'],$ldap['DST'],$request['dnSRC'],$request['dnDST'],$request['remove']);
|
||||
|
||||
if ($copy_result)
|
||||
$copy_message = sprintf('%s %s: <b>%s</b> %s',
|
||||
$request['remove'] ? _('Move successful') : _('Copy successful'),
|
||||
_('DN'),$request['dnDST'],_('has been created.'));
|
||||
else
|
||||
$copy_message = sprintf('%s %s: <b>%s</b> %s',
|
||||
$request['remove'] ? _('Move NOT successful') : _('Copy NOT successful'),
|
||||
_('DN'),$request['dnDST'],_('has NOT been created.'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($copy_result) {
|
||||
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s&refresh=SID_%s_nodes&noheader=1',
|
||||
$ldap['DST']->getIndex(),rawurlencode($request['dnDST']),$ldap['DST']->getIndex());
|
||||
|
||||
system_message(array(
|
||||
'title'=>_('Copy Entry'),
|
||||
'body'=>$copy_message,
|
||||
'type'=>'info'),
|
||||
$redirect_url);
|
||||
}
|
||||
|
||||
function r_copy_dn($serverSRC,$serverDST,$snapshottree,$dnSRC,$dnDST,$remove) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
$copy_message = array();
|
||||
|
||||
$children = isset($snapshottree[$dnSRC]) ? $snapshottree[$dnSRC] : null;
|
||||
|
||||
# If we have children, then we need to copy, then delete for a move
|
||||
if (is_array($children) && count($children)) {
|
||||
|
||||
$copy_result = copy_dn($serverSRC,$serverDST,$dnSRC,$dnDST,false);
|
||||
|
||||
if (! $copy_result)
|
||||
return false;
|
||||
|
||||
array_push($copy_message,sprintf('%s %s: <b>%s</b> %s',_('Copy successful'),_('DN'),$dnDST,_('has been created.')));
|
||||
|
||||
$hadError = false;
|
||||
foreach ($children as $child_dn) {
|
||||
$dnDST_new = sprintf('%s,%s',get_rdn($child_dn),$dnDST);
|
||||
$copy_result = r_copy_dn($serverSRC,$serverDST,$snapshottree,$child_dn,$dnDST_new,$remove);
|
||||
$copy_message = array_merge($copy_message,array_values($copy_result));
|
||||
|
||||
if (! $copy_result)
|
||||
$hadError = true;
|
||||
}
|
||||
|
||||
if (! $hadError && $remove) {
|
||||
$delete_result = $serverSRC->delete($dnSRC);
|
||||
|
||||
if ($delete_result)
|
||||
array_push($copy_message,sprintf('%s %s: <b>%s</b> %s',_('Delete successful'),_('DN'),$dnDST,_('has been deleted.')));
|
||||
}
|
||||
|
||||
} else {
|
||||
$copy_result = copy_dn($serverSRC,$serverDST,$dnSRC,$dnDST,$remove);
|
||||
|
||||
if ($copy_result)
|
||||
array_push($copy_message,sprintf('%s %s: <b>%s</b> %s',
|
||||
$remove ? _('Move successful') : _('Copy successful'),
|
||||
_('DN'),$dnDST,_('has been created.')));
|
||||
else
|
||||
array_push($copy_message,sprintf('%s %s: <b>%s</b> %s',
|
||||
$remove ? _('Move NOT successful') : _('Copy NOT successful'),
|
||||
_('DN'),$dnDST,_('has NOT been created.')));
|
||||
}
|
||||
|
||||
return $copy_message;
|
||||
}
|
||||
|
||||
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());
|
||||
}
|
||||
|
||||
function build_tree($server,$dn,$buildtree) {
|
||||
if (DEBUG_ENABLED && (($fargs=func_get_args())||$fargs='NOARGS'))
|
||||
debug_log('Entered (%%)',1,0,__FILE__,__LINE__,__METHOD__,$fargs);
|
||||
|
||||
# We search all children, not only the visible children in the tree
|
||||
$children = $server->getContainerContents($dn,null,0);
|
||||
|
||||
if (count($children)) {
|
||||
$buildtree[$dn] = $children;
|
||||
foreach ($children as $child_dn)
|
||||
$buildtree = build_tree($server,$child_dn,$buildtree);
|
||||
}
|
||||
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Returning (%s)',1,0,__FILE__,__LINE__,__METHOD__,$buildtree);
|
||||
|
||||
return $buildtree;
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,103 @@
|
|||
<?php
|
||||
/**
|
||||
* Copies a given object to create a new one.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
|
||||
# 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 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>',_('Copy'),get_rdn($request['dn'])));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
printf('<script type="text/javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
echo '<div style="text-align: center;">';
|
||||
printf('%s <b>%s</b> %s:<br /><br />',_('Copy'),get_rdn($request['dn']),_('to a new object'));
|
||||
echo '</div>';
|
||||
|
||||
echo '<form action="cmd.php" method="post" id="copy_form">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="cmd" value="copy" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="server_id_src" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn_src" value="%s" />',htmlspecialchars($request['dn']));
|
||||
echo '</div>';
|
||||
echo "\n";
|
||||
|
||||
echo '<table border="0" style="border-spacing: 10px; margin-left: auto; margin-right: auto;">';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym>:</td>',
|
||||
_('The full DN of the new entry to be created when copying the source entry'),_('Destination DN'));
|
||||
echo '<td>';
|
||||
printf('<input type="text" name="dn_dst" size="45" value="%s" />',htmlspecialchars($request['dn']));
|
||||
draw_chooser_link('copy_form','dn_dst','true',get_rdn($request['dn']));
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td>%s:</td><td>%s</td></tr>',_('Destination Server'),server_select_list($app['server']->getIndex(),true,'server_id_dst'));
|
||||
echo "\n";
|
||||
|
||||
# We search all children, not only the visible children in the tree
|
||||
$request['children'] = $app['server']->getContainerContents($request['dn']);
|
||||
|
||||
if (count($request['children']) > 0) {
|
||||
echo '<tr>';
|
||||
printf('<td><label for="recursive">%s</label>:</td>',_('Recursive copy'));
|
||||
echo '<td><input type="checkbox" id="recursive" name="recursive" onclick="copy_field_toggle(this)" />';
|
||||
printf('<small>(%s)</small></td>',_('Recursively copy all children of this object as well.'));
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><acronym title="%s">%s</acronym>:</td>',
|
||||
_('When performing a recursive copy, only copy those entries which match this filter'),_('Filter'));
|
||||
echo '<td><input type="text" name="filter" value="(objectClass=*)" size="45" disabled />';
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td>%s</td>',_('Delete after copy (move):'));
|
||||
echo '<td><input type="checkbox" name="remove" value="yes" disabled />';
|
||||
printf('<small>(%s)</small)</td>',_('Make sure your filter (above) will select all child records.'));
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
} else {
|
||||
printf('<tr><td>%s</td><td><input type="checkbox" name="remove" value="yes"/></td></tr>',_('Delete after copy (move):'));
|
||||
}
|
||||
echo "\n";
|
||||
|
||||
printf('<tr><td colspan="2" style="text-align: center;"><input type="submit" value="%s" /></td></tr>',_('Copy '));
|
||||
echo "\n";
|
||||
|
||||
echo '</table>';
|
||||
echo '</form>';
|
||||
|
||||
if ($_SESSION[APPCONFIG]->getValue('appearance','show_hints'))
|
||||
printf('<div style="text-align: center;"><small><img src="%s/light.png" alt="Light" /><span class="hint">%s</span></small></div>',
|
||||
IMGDIR,_('Hint: Copying between different servers only works if there are no schema violations'));
|
||||
|
||||
|
||||
# Draw the javascrpt to enable/disable the filter field if this may be a recursive copy
|
||||
if (count($request['children']) > 0)
|
||||
printf('<script type="text/javascript" src="%sform_field_toggle_enable.js"></script>',JSDIR);
|
||||
?>
|
|
@ -0,0 +1,104 @@
|
|||
<?php
|
||||
/**
|
||||
* Creates a new object in LDAP.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# If cancel was selected, we'll redirect
|
||||
if (get_request('cancel','REQUEST')) {
|
||||
header('Location: index.php');
|
||||
die();
|
||||
}
|
||||
|
||||
$request = array();
|
||||
$request['redirect'] = get_request('redirect','POST',false,false);
|
||||
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setContainer(get_request('container','REQUEST',true));
|
||||
$request['page']->accept();
|
||||
$request['template'] = $request['page']->getTemplate();
|
||||
|
||||
if ((! $request['template']->getContainer() || ! $app['server']->dnExists($request['template']->getContainer())) && ! get_request('create_base'))
|
||||
error(sprintf(_('The container you specified (%s) does not exist. Please try again.'),$request['template']->getContainer()),'error','index.php');
|
||||
|
||||
# Check if the container is a leaf - we shouldnt really return a hit here, the template engine shouldnt have allowed a user to attempt to create an entry...
|
||||
$tree = get_cached_item($app['server']->getIndex(),'tree');
|
||||
|
||||
$request['container'] = $tree->getEntry($request['template']->getContainer());
|
||||
if (! $request['container'] && ! get_request('create_base')) {
|
||||
$tree->addEntry($request['template']->getContainer());
|
||||
$request['container'] = $tree->getEntry($request['template']->getContainer());
|
||||
}
|
||||
|
||||
# Check our RDN
|
||||
if (! count($request['template']->getRDNAttrs()))
|
||||
error(_('The were no attributes marked as an RDN attribute.'),'error','index.php');
|
||||
if (! $request['template']->getRDN())
|
||||
error(_('The RDN field is empty?'),'error','index.php');
|
||||
|
||||
# Some other attribute checking...
|
||||
foreach ($request['template']->getAttributes() as $attribute) {
|
||||
# Check that our Required Attributes have a value - we shouldnt really return a hit here, the template engine shouldnt have allowed this to slip through.
|
||||
# @todo this isIgnoredAttr() function is missing?
|
||||
if ($attribute->isRequired() && ! count($attribute->getValues()) && ! $app['server']->isIgnoredAttr($attr->getName()))
|
||||
error(sprintf(_('You left the value blank for required attribute (%s).'),
|
||||
$attribute->getName(false)),'error','index.php');
|
||||
}
|
||||
|
||||
# Create the entry
|
||||
$add_result = $app['server']->add($request['template']->getDN(),$request['template']->getLDAPadd());
|
||||
|
||||
if ($add_result) {
|
||||
$action_number = $_SESSION[APPCONFIG]->getValue('appearance','action_after_creation');
|
||||
$href = sprintf('cmd=template_engine&server_id=%s',$app['server']->getIndex());
|
||||
|
||||
if ($request['redirect'])
|
||||
$redirect_url = $request['redirect'];
|
||||
|
||||
else if ($action_number == 2)
|
||||
$redirect_url = sprintf('cmd.php?%s&template=%s&container=%s',
|
||||
$href,'default',$request['template']->getContainerEncode());
|
||||
|
||||
else
|
||||
$redirect_url = sprintf('cmd.php?%s&template=%s&dn=%s',
|
||||
$href,'default',$request['template']->getDNEncode());
|
||||
|
||||
if ($action_number == 1 || $action_number == 2)
|
||||
printf('<meta http-equiv="refresh" content="0; url=%s" />',$redirect_url);
|
||||
|
||||
if ($action_number == 1 || $action_number == 2) {
|
||||
$create_message = sprintf('%s %s: <b>%s</b> %s',
|
||||
_('Creation successful!'),_('DN'),$request['template']->getDN(),_('has been created.'));
|
||||
|
||||
if (isAjaxEnabled())
|
||||
$redirect_url .= sprintf('&refresh=SID_%s_nodes&noheader=1',$app['server']->getIndex());
|
||||
|
||||
system_message(array(
|
||||
'title'=>_('Create Entry'),
|
||||
'body'=>$create_message,
|
||||
'type'=>'info'),
|
||||
$redirect_url);
|
||||
|
||||
} else {
|
||||
$request['page']->drawTitle(_('Entry created'));
|
||||
$request['page']->drawSubTitle(sprintf('%s: <b>%s</b>',
|
||||
_('DN'),$request['template']->getDN()));
|
||||
|
||||
echo '<br />';
|
||||
echo '<center>';
|
||||
printf('<a href="cmd.php?%s&dn=%s">%s</a>.',
|
||||
htmlspecialchars($href),rawurlencode($request['template']->getDN()),_('Display the new created entry'));
|
||||
echo '<br />';
|
||||
printf('<a href="cmd.php?%s&container=%s">%s</a>.',
|
||||
htmlspecialchars($href),rawurlencode($request['template']->getContainer()),_('Create another entry'));
|
||||
echo '</center>';
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,143 @@
|
|||
<?php
|
||||
/**
|
||||
* Creates a new object in LDAP.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$request = array();
|
||||
$request['redirect'] = get_request('redirect','POST',false,false);
|
||||
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->setContainer(get_request('container','REQUEST',true));
|
||||
$request['page']->accept();
|
||||
$request['template'] = $request['page']->getTemplate();
|
||||
|
||||
if (! $request['template']->getContainer() || ! $app['server']->dnExists($request['template']->getContainer()))
|
||||
error(sprintf(_('The container you specified (%s) does not exist. Please try again.'),$request['template']->getContainer()),'error','index.php');
|
||||
|
||||
# Check if the container is a leaf - we shouldnt really return a hit here, the template engine shouldnt have allowed a user to attempt to create an entry...
|
||||
$tree = get_cached_item($app['server']->getIndex(),'tree');
|
||||
|
||||
$request['container'] = $tree->getEntry($request['template']->getContainer());
|
||||
if (! $request['container']) {
|
||||
$tree->addEntry($request['template']->getContainer());
|
||||
$request['container'] = $tree->getEntry($request['template']->getContainer());
|
||||
}
|
||||
|
||||
# Check our RDN
|
||||
if (! count($request['template']->getRDNAttrs()))
|
||||
error(_('The were no attributes marked as an RDN attribute.'),'error','index.php');
|
||||
if (! $request['template']->getRDN())
|
||||
error(_('The RDN field is empty?'),'error','index.php');
|
||||
|
||||
# Some other attribute checking...
|
||||
foreach ($request['template']->getAttributes() as $attribute) {
|
||||
# Check that our Required Attributes have a value - we shouldnt really return a hit here, the template engine shouldnt have allowed this to slip through.
|
||||
# @todo this isIgnoredAttr() function is missing?
|
||||
if ($attribute->isRequired() && ! count($attribute->getValues()) && ! $app['server']->isIgnoredAttr($attr->getName()))
|
||||
error(sprintf(_('You left the value blank for required attribute (%s).'),
|
||||
$attribute->getName(false)),'error','index.php');
|
||||
}
|
||||
|
||||
# Check for unique attributes
|
||||
$app['server']->checkUniqueAttrs($request['template']->getDN(),$request['template']->getLDAPadd());
|
||||
|
||||
$request['page']->drawTitle(_('Create LDAP Entry'));
|
||||
$request['page']->drawSubTitle(sprintf('%s: <b>%s</b> %s: <b>%s</b>',
|
||||
_('Server'),$app['server']->getName(),_('Container'),$request['template']->getContainer()));
|
||||
|
||||
# Confirm the creation
|
||||
if (count($request['template']->getLDAPadd(true))) {
|
||||
echo '<div style="text-align: center;">';
|
||||
echo _('Do you want to create this entry?');
|
||||
echo '<br /><br />';
|
||||
echo '</div>';
|
||||
|
||||
echo "\n\n";
|
||||
echo '<form action="cmd.php" method="post" id="create_form">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="cmd" value="create" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="container" value="%s" />',$request['template']->getContainerEncode(false));
|
||||
printf('<input type="hidden" name="template" value="%s" />',$request['template']->getID());
|
||||
foreach ($request['template']->getRDNAttrs() as $rdn)
|
||||
printf('<input type="hidden" name="rdn_attribute[]" value="%s" />',htmlspecialchars($rdn));
|
||||
echo "\n";
|
||||
|
||||
$request['page']->drawHiddenAttributes();
|
||||
echo '</div>';
|
||||
|
||||
echo '<table class="result_table" style="margin-left: auto; margin-right: auto;">';
|
||||
echo "\n";
|
||||
|
||||
printf('<tr class="heading"><td>%s</td><td>%s</td><td>%s</td></tr>',
|
||||
_('Attribute'),_('New Value'),_('Skip'));
|
||||
echo "\n\n";
|
||||
|
||||
$counter = 0;
|
||||
printf('<tr class="%s"><td colspan="3" style="text-align: center;"><b>%s</b></td></tr>',$counter%2 ? 'even' : 'odd',htmlspecialchars($request['template']->getDN()));
|
||||
|
||||
foreach ($request['template']->getLDAPadd(true) as $attribute) {
|
||||
$counter++;
|
||||
|
||||
printf('<tr class="%s">',$counter%2 ? 'even' : 'odd');
|
||||
printf('<td><b>%s</b></td>',$attribute->getFriendlyName());
|
||||
|
||||
# Show NEW Values
|
||||
echo '<td><span style="white-space: nowrap;">';
|
||||
$request['page']->draw('CurrentValues',$attribute);
|
||||
echo '</span></td>';
|
||||
|
||||
# Show SKIP Option
|
||||
$input_disabled = '';
|
||||
$input_onclick = '';
|
||||
|
||||
if ($attribute->isRequired())
|
||||
$input_disabled = 'disabled="disabled"';
|
||||
|
||||
printf('<td><input name="skip_array[%s]" id="skip_array_%s" type="checkbox" %s %s/></td>',
|
||||
htmlspecialchars($attribute->getName()),htmlspecialchars($attribute->getName()),$input_disabled,$input_onclick);
|
||||
echo '</tr>';
|
||||
echo "\n\n";
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '<div style="text-align: center;">';
|
||||
echo '<br />';
|
||||
|
||||
printf('<input type="submit" value="%s" %s/>',
|
||||
_('Commit'),
|
||||
(isAjaxEnabled() ? sprintf('onclick="return ajSUBMIT(\'BODY\',document.getElementById(\'create_form\'),\'%s\');"',_('Updating Object')) : ''));
|
||||
|
||||
printf('<input type="submit" name="cancel" value="%s" %s/>',
|
||||
_('Cancel'),
|
||||
(isAjaxEnabled() ? sprintf('onclick="return ajDISPLAY(\'BODY\',\'cmd=template_engine&server_id=%s&container=%s\',\'%s\');"',$app['server']->getIndex(),$request['template']->getContainer(),_('Retrieving DN')) : ''));
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
echo '<br />';
|
||||
|
||||
} else {
|
||||
$href = sprintf('cmd=template_engine&server_id=%s&dn=%s',
|
||||
$app['server']->getIndex(),$request['template']->getDNEncode());
|
||||
|
||||
echo '<div style="text-align: center;">';
|
||||
echo _('You made no changes');
|
||||
|
||||
if (isAjaxEnabled())
|
||||
printf(' <a href="cmd.php?%s" onclick="return ajDISPLAY(\'BODY\',\'%s\',\'%s\');">%s</a>.',
|
||||
htmlspecialchars($href),htmlspecialchars($href),_('Retrieving DN'),_('Go back'));
|
||||
else
|
||||
printf(' <a href="cmd.php?%s">%s</a>.',htmlspecialchars($href),_('Go back'));
|
||||
|
||||
echo '</div>';
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,915 @@
|
|||
/* $Header$ */
|
||||
|
||||
/* Global Page */
|
||||
table.page {
|
||||
font-weight: normal;
|
||||
color: #000000;
|
||||
|
||||
font-family: "bitstream vera sans","luxi sans",verdana,geneva,arial,helvetica,sans-serif;
|
||||
background-color: #F5F5F5;
|
||||
font-size: 13px;
|
||||
empty-cells: hide;
|
||||
}
|
||||
|
||||
/* Global Page - Defaults */
|
||||
/* A HREF Links */
|
||||
table.page a {
|
||||
color: #0000AA;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.page a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.page a img {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
/* Global Page - Logo & Title */
|
||||
table.page tr.head {
|
||||
text-align: center;
|
||||
color: #FFFFFF;
|
||||
background-color: #001188;
|
||||
font-weight: bold;
|
||||
font-size: 11px;
|
||||
height: 25px;
|
||||
}
|
||||
|
||||
table.page tr.head img.logo {
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
|
||||
width: 100px;
|
||||
height: 60px;
|
||||
}
|
||||
|
||||
table.page tr.pagehead {
|
||||
}
|
||||
|
||||
table.page tr.pagehead td.imagetop {
|
||||
width: 100%;
|
||||
vertical-align: bottom;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Global Page - Control Line */
|
||||
table.page tr.control td {
|
||||
border-top: 1px solid #AAAACC;
|
||||
border-bottom: 1px solid #AAAACC;
|
||||
}
|
||||
|
||||
/* Global Page - Control Line Menu Items */
|
||||
table.page table.control {
|
||||
table-layout: fixed;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.page table.control td {
|
||||
border-top: 0px;
|
||||
border-bottom: 0px;
|
||||
padding: 0px;
|
||||
padding-top: 2px;
|
||||
padding-bottom: 2px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
font-size: 11px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.page table.control img {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
}
|
||||
|
||||
table.page table.control a {
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
table.page table.control a:hover {
|
||||
text-decoration: none;
|
||||
background-color: #FFFFFF;
|
||||
color: #0000AA;
|
||||
}
|
||||
|
||||
table.page table.control td.spacer {
|
||||
width: 20%;
|
||||
}
|
||||
|
||||
table.page table.control td.logo {
|
||||
text-align: right;
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
table.page table.control td.logo img.logo {
|
||||
vertical-align: middle;
|
||||
text-align: right;
|
||||
|
||||
width: 100px;
|
||||
height: 50px;
|
||||
}
|
||||
|
||||
/* Global Page - LDAP Tree */
|
||||
table.page td.tree {
|
||||
border-right: 1px solid #AAAACC;
|
||||
vertical-align: top;
|
||||
background-color: #F5F5F5;
|
||||
width: 10%;
|
||||
}
|
||||
|
||||
/* Global Page - Main Body */
|
||||
table.page td.body {
|
||||
vertical-align: top;
|
||||
width: 100%;
|
||||
background-color: #F5F5F5;
|
||||
}
|
||||
|
||||
/* Global Page - Main Body System Message */
|
||||
table.page table.sysmsg {
|
||||
border-bottom: 2px solid #AAAACC;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.page table.sysmsg td.head {
|
||||
font-size: small;
|
||||
text-align: left;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.page table.sysmsg td.body {
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
table.page table.sysmsg td.icon {
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* Global Page - Main Body */
|
||||
table.page table.body {
|
||||
font-weight: normal;
|
||||
background-color: #F5F5F5;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.page table.body h3.title {
|
||||
text-align: center;
|
||||
margin: 0px;
|
||||
padding: 10px;
|
||||
color: #FFFFFF;
|
||||
background-color: #000088;
|
||||
border: 1px solid #000000;
|
||||
font-weight: normal;
|
||||
font-size: 150%;
|
||||
}
|
||||
|
||||
table.page table.body h3.subtitle {
|
||||
text-align: center;
|
||||
margin: 0px;
|
||||
margin-bottom: 15px;
|
||||
font-size: 75%;
|
||||
color: #FFFFFF;
|
||||
border-bottom: 1px solid #000000;
|
||||
border-left: 1px solid #000000;
|
||||
border-right: 1px solid #000000;
|
||||
background: #000088;
|
||||
padding: 4px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
table.page table.body td.spacer {
|
||||
border-top: 2px solid #AAAACC;
|
||||
padding: 0px;
|
||||
font-size: 5px;
|
||||
}
|
||||
|
||||
table.page table.body td.head {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.page table.body td.foot {
|
||||
font-size: small;
|
||||
border-top: 1px solid #AAAACC;
|
||||
border-bottom: 1px solid #AAAACC;
|
||||
}
|
||||
|
||||
/* Global Page Footer */
|
||||
table.page tr.foot td {
|
||||
border-top: 1px solid #AAAACC;
|
||||
font-weight: bold;
|
||||
font-size: 12px;
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
/* Global Page - Other Layouts */
|
||||
/* Server Select */
|
||||
table.page table.server_select {
|
||||
font-weight: bold;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* Individual table layouts */
|
||||
/* LDAP Tree */
|
||||
table.tree {
|
||||
}
|
||||
|
||||
table.tree tr.server td.icon {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.tree tr.server td.name {
|
||||
padding-right: 10px;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.tree tr.server td {
|
||||
padding-top: 5px;
|
||||
font-size: 18px;
|
||||
text-align: left;
|
||||
padding-right: 0px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.tree td {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.tree td.server_links {
|
||||
vertical-align: top;
|
||||
text-align: center;
|
||||
padding-top: 0px;
|
||||
padding-bottom: 0px;
|
||||
padding-left: 3px;
|
||||
padding-right: 3px;
|
||||
}
|
||||
|
||||
table.tree td.server_links a {
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
table.tree td.server_links a:hover {
|
||||
text-decoration: none;
|
||||
background-color: #FFFFFF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
table.tree tr.option td.expander {
|
||||
text-align: center;
|
||||
width: 22px;
|
||||
max-width: 22px;
|
||||
min-width: 22px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.tree tr.option td.icon {
|
||||
text-align: center;
|
||||
width: 22px;
|
||||
max-width: 22px;
|
||||
min-width: 22px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.tree td.rdn a {
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
table.tree td.rdn a:hover {
|
||||
font-size: 13px;
|
||||
color: #841212;
|
||||
background-color: #FFF0C0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree td.rdn span.count {
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
table.tree td.links a {
|
||||
color: #0000AA;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.tree td.link a {
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
table.tree td.link a:hover {
|
||||
font-size: 13px;
|
||||
color: #841212;
|
||||
background-color: #FFF0C0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree td.links a:hover {
|
||||
text-decoration: none;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
table.tree td.blank {
|
||||
font-size: 1px;
|
||||
}
|
||||
|
||||
table.tree td.spacer {
|
||||
width: 22px;
|
||||
}
|
||||
|
||||
table.tree td.logged_in {
|
||||
font-size: 10px;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
table.tree td.logged_in a {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
table.tree td.logged_in a:hover {
|
||||
color: #841212;
|
||||
background-color: #FFF0C0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Tree Global Defaults */
|
||||
table.tree tr td {
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
table.tree a {
|
||||
text-decoration: none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
table.tree a:hover {
|
||||
text-decoration: underline;
|
||||
color: blue;
|
||||
}
|
||||
|
||||
table.tree span.dnicon img {
|
||||
width: 16px;
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
/* Tree */
|
||||
table.tree .treemenudiv {
|
||||
display: block;
|
||||
white-space: nowrap;
|
||||
padding-top: 1px;
|
||||
padding-bottom: 1px;
|
||||
}
|
||||
|
||||
table.tree .phplmnormal {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmnormal:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:link {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:visited {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #000000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #841212;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplm:active {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #ff0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:link {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #dd0000;
|
||||
background-color: #ffdd76;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:visited {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #dd0000;
|
||||
background-color: #ffdd76;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:hover {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #841212;
|
||||
background-color: #fff0c0;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
table.tree a.phplmselected:active {
|
||||
font-family: bitstream vera sans, luxi sans, verdana, geneva, arial, helvetica, sans-serif;
|
||||
font-size: 13px;
|
||||
color: #ff0000;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
/* Standard Form */
|
||||
table.forminput {
|
||||
background-color: #F9F9FA;
|
||||
padding: 10px;
|
||||
border: 1px solid #AAAACC;
|
||||
}
|
||||
|
||||
table.forminput td.title {
|
||||
text-align: center;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.forminput td.subtitle {
|
||||
text-align: center;
|
||||
font-weight: normal;
|
||||
font-size: small;
|
||||
}
|
||||
|
||||
table.forminput tr td.heading {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.forminput td.small {
|
||||
font-size: 80%;
|
||||
}
|
||||
|
||||
table.forminput td.top {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.forminput input.val {
|
||||
width: 350px;
|
||||
border: 1px solid #AAAACC;
|
||||
}
|
||||
|
||||
table.forminput input.roval {
|
||||
width: 350px;
|
||||
border: none;
|
||||
}
|
||||
|
||||
table.forminput td.icon {
|
||||
width: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.forminput td.icon img {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
table.forminput td.label {
|
||||
text-align: left;
|
||||
font-size: 13px;
|
||||
}
|
||||
|
||||
/* Menu on top of entry form */
|
||||
table.menu {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
table.menu td.icon {
|
||||
width: 16px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Edit DN */
|
||||
div.add_value {
|
||||
font-size: 12px;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
|
||||
/* Edit Entry */
|
||||
table.entry {
|
||||
border-collapse: collapse;
|
||||
border-spacing: 0px;
|
||||
empty-cells: show;
|
||||
}
|
||||
|
||||
table.entry input {
|
||||
margin: 1px;
|
||||
}
|
||||
|
||||
table.entry input.value {
|
||||
color: #000000;
|
||||
font-size: 14px;
|
||||
width: 350px;
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
table.entry div.helper {
|
||||
text-align: left;
|
||||
white-space: nowrap;
|
||||
background-color: #FFFFFF;
|
||||
color: #888;
|
||||
font-size: 14px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
table.entry input.roval {
|
||||
font-size: 14px;
|
||||
width: 350px;
|
||||
background-color: #FFFFFF;
|
||||
color: #000000;
|
||||
border: none;
|
||||
}
|
||||
|
||||
table.entry textarea.value {
|
||||
font-size: 14px;
|
||||
width: 350px;
|
||||
background-color: #FFFFFF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
table.entry textarea.roval {
|
||||
font-size: 14px;
|
||||
width: 350px;
|
||||
background-color: #FFFFFF;
|
||||
color: #000000;
|
||||
border: none;
|
||||
}
|
||||
|
||||
table.entry tr td {
|
||||
padding: 4px;
|
||||
padding-right: 0px;
|
||||
}
|
||||
|
||||
table.entry tr td.heading {
|
||||
border-top: 3px solid #C0C0C0;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.entry tr td.note {
|
||||
text-align: right;
|
||||
background-color: #E0E0E0;
|
||||
}
|
||||
|
||||
table.entry tr td.title {
|
||||
background-color: #E0E0E0;
|
||||
vertical-align: top;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.entry tr td.title a {
|
||||
text-decoration: none;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
table.entry tr td.title a:hover {
|
||||
text-decoration: underline;
|
||||
color: #016;
|
||||
}
|
||||
|
||||
table.entry tr td.value {
|
||||
text-align: left;
|
||||
vertical-align: middle;
|
||||
padding-bottom: 10px;
|
||||
padding-left: 50px;
|
||||
}
|
||||
|
||||
/** When an attr is updated, it is highlighted to indicate such */
|
||||
table.entry tr.updated td.title {
|
||||
border-top: 1px dashed #AAAA88;
|
||||
border-left: 1px dashed #AAAA88;
|
||||
background-color: #999988;
|
||||
}
|
||||
|
||||
table.entry tr.updated td.note {
|
||||
border-top: 1px dashed #AAAA88;
|
||||
border-right: 1px dashed #AAAA88;
|
||||
background-color: #999988;
|
||||
}
|
||||
|
||||
/** An extra row that sits at the bottom of recently modified attrs to encase them in dashes */
|
||||
table.entry tr.updated td.bottom {
|
||||
border-top: 1px dashed #AAAA88;
|
||||
}
|
||||
|
||||
/** Formatting for the value cell when it is the attribute that has been recently modified */
|
||||
table.entry tr.updated td.value {
|
||||
border-left: 1px dashed #AAAA88;
|
||||
border-right: 1px dashed #AAAA88;
|
||||
}
|
||||
|
||||
/* Need to prevent sub-tables (like the one in which jpegPhotos are displayed)
|
||||
* from drawing borders as well. */
|
||||
table.entry tr.updated td table td {
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
table.entry tr.noinput {
|
||||
background: #E0E0E0;
|
||||
}
|
||||
|
||||
span.hint {
|
||||
font-size: small;
|
||||
font-weight: normal;
|
||||
color: #888;
|
||||
}
|
||||
|
||||
/* Login Box */
|
||||
#login {
|
||||
background: url('../../images/default/ldap-uid.png') no-repeat 0 1px;
|
||||
background-color: #FAFAFF;
|
||||
color: #000000;
|
||||
padding-left: 17px;
|
||||
}
|
||||
|
||||
#login:focus {
|
||||
background-color: #F0F0FF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#login:disabled {
|
||||
background-color: #DDDDFF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#password {
|
||||
background: url('../../images/default/key.png') no-repeat 0 1px;
|
||||
background-color: #FAFAFF;
|
||||
color: #000000;
|
||||
padding-left: 17px;
|
||||
}
|
||||
|
||||
#password:focus {
|
||||
background-color: #F0F0FF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#password:disabled {
|
||||
background-color: #DDDDFF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#generic {
|
||||
background-color: #FAFAFF;
|
||||
color: #000000;
|
||||
padding-left: 17px;
|
||||
}
|
||||
#generic:focus {
|
||||
background-color: #F0F0FF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
#generic:disabled {
|
||||
background-color: #DDDDFF;
|
||||
color: #000000;
|
||||
}
|
||||
|
||||
/* After input results */
|
||||
div.execution_time {
|
||||
font-size: 75%;
|
||||
font-weight: normal;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
table.result {
|
||||
width: 100%;
|
||||
vertical-align: top;
|
||||
empty-cells: show;
|
||||
border: 1px solid #AAAACC;
|
||||
border-spacing: 0px;
|
||||
background-color: #F2F2FF;
|
||||
}
|
||||
|
||||
table.result tr.heading {
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.result tr.list_title {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
table.result tr.list_title td.icon {
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
table.result tr.list_item {
|
||||
background-color: #FFFFFF;
|
||||
}
|
||||
|
||||
table.result tr.list_item td.blank {
|
||||
width: 25px;
|
||||
}
|
||||
|
||||
table.result tr.list_item td.heading {
|
||||
vertical-align: top;
|
||||
color: gray;
|
||||
width: 10%;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
table.result tr.list_item td.value {
|
||||
color: #000000;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
table.result_box {
|
||||
border: 1px solid #AAAACC;
|
||||
border-collapse: collapse;
|
||||
empty-cells: show;
|
||||
}
|
||||
|
||||
table.result_table {
|
||||
border: 1px solid #AAAACC;
|
||||
border-collapse: collapse;
|
||||
empty-cells: show;
|
||||
}
|
||||
|
||||
table.result_table td {
|
||||
font-size: 12px;
|
||||
vertical-align: top;
|
||||
border: 1px solid #AAAACC;
|
||||
padding: 4px;
|
||||
}
|
||||
|
||||
table.result_table th {
|
||||
border: 1px solid #AAAACC;
|
||||
padding: 10px;
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
table.result_table tr.highlight {
|
||||
background-color: #EEEBBB;
|
||||
}
|
||||
|
||||
table.result_table tr.highlight td {
|
||||
border: 1px solid #AAAACC;
|
||||
font-weight: bold;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
table.result_table td.heading {
|
||||
color: #FFFFFF;
|
||||
background-color: #000088;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
table.result_table td.value {
|
||||
color: #000000;
|
||||
background-color: #E0E0E0;
|
||||
}
|
||||
|
||||
table.result_table tr.heading {
|
||||
color: #FFFFFF;
|
||||
background-color: #000088;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.result_table tr.heading a {
|
||||
color: #FFFFFF;
|
||||
font-size: 12px;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.result_table tr.heading td {
|
||||
border: 1px solid #AAAACC;
|
||||
font-weight: normal;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
table.result_table tr.even {
|
||||
background-color: #E0E0E0;
|
||||
}
|
||||
|
||||
table.result_table tr.even td {
|
||||
border: 1px solid #AAAACC;
|
||||
font-weight: normal;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
table.result_table tr.even td.title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.result_table tr.odd {
|
||||
background-color: #F0F0F0;
|
||||
}
|
||||
|
||||
table.result_table tr.odd td {
|
||||
border: 1px solid #AAAACC;
|
||||
font-weight: normal;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
padding-left: 10px;
|
||||
padding-right: 10px;
|
||||
}
|
||||
|
||||
table.result_table tr.odd td.title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
table.result_table ul.list {
|
||||
margin: 5px;
|
||||
margin-left: 0px;
|
||||
padding-left: 20px;
|
||||
}
|
||||
|
||||
table.result_table ul.list li {
|
||||
margin-left: 0px;
|
||||
padding-left: 0px;
|
||||
}
|
||||
|
||||
table.result_table ul.list li small {
|
||||
font-size: 75%;
|
||||
color: #707070;
|
||||
}
|
||||
|
||||
table.result_table ul.list li small a {
|
||||
color: #7070C0;
|
||||
}
|
||||
|
||||
/* Error Dialog Box */
|
||||
table.error {
|
||||
width: 500px;
|
||||
border: 1px solid #AA0000;
|
||||
background-color: #FFF0F0;
|
||||
}
|
||||
|
||||
table.error th {
|
||||
background-color: #AA0000;
|
||||
border: 0px;
|
||||
color: #FFFFFF;
|
||||
font-size: 14px;
|
||||
font-weight: bold;
|
||||
text-align: center;
|
||||
vertical-align: middle;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
table.error th.img {
|
||||
vertical-align: middle;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
table.error td {
|
||||
border: 0px;
|
||||
background-color: #FFF0F0;
|
||||
padding: 2px;
|
||||
text-align: left;
|
||||
vertical-align: top;
|
||||
}
|
||||
|
||||
/* Popup Window */
|
||||
div.popup h3.subtitle {
|
||||
text-align: center;
|
||||
margin: 0px;
|
||||
margin-bottom: 15px;
|
||||
color: #FFFFFF;
|
||||
border-bottom: 1px solid #000000;
|
||||
border-left: 1px solid #000000;
|
||||
border-right: 1px solid #000000;
|
||||
background: #000088;
|
||||
padding: 4px;
|
||||
font-weight: normal;
|
||||
}
|
||||
|
||||
span.good {
|
||||
color: green;
|
||||
}
|
||||
|
||||
span.bad {
|
||||
color: red;
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/**
|
||||
* Deletes a DN and presents a "job's done" message.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DNs we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST',true);
|
||||
|
||||
if (! $app['server']->dnExists($request['dn']))
|
||||
error(sprintf('%s (%s)',_('No such entry.'),'<b>'.pretty_print_dn($request['dn']).'</b>'),'error','index.php');
|
||||
|
||||
# Delete the entry.
|
||||
$result = $app['server']->delete($request['dn']);
|
||||
|
||||
if ($result) {
|
||||
$redirect_url = '';
|
||||
|
||||
if (isAjaxEnabled())
|
||||
$redirect_url .= sprintf('&refresh=SID_%s_nodes&noheader=1',$app['server']->getIndex());
|
||||
|
||||
system_message(array(
|
||||
'title'=>_('Delete DN'),
|
||||
'body'=>_('Successfully deleted DN ').sprintf('<b>%s</b>',$request['dn']),
|
||||
'type'=>'info'),
|
||||
sprintf('index.php?server_id=%s%s',$app['server']->getIndex(),$redirect_url));
|
||||
} else
|
||||
system_message(array(
|
||||
'title'=>_('Could not delete the entry.').sprintf(' (%s)',pretty_print_dn($request['dn'])),
|
||||
'body'=>ldap_error_msg($app['server']->getErrorMessage(null),$app['server']->getErrorNum(null)),
|
||||
'type'=>'error'));
|
||||
?>
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* Deletes an attribute from an entry with NO confirmation.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST',true);
|
||||
$request['attr'] = get_request('attr','REQUEST',true);
|
||||
$request['index'] = get_request('index','REQUEST',true);
|
||||
|
||||
if ($app['server']->isAttrReadOnly($request['attr']))
|
||||
error(sprintf(_('The attribute "%s" is flagged as read-only in the phpLDAPadmin configuration.'),$request['attr']),'error','index.php');
|
||||
|
||||
$update_array = array();
|
||||
$update_array[$request['attr']] = $app['server']->getDNAttrValue($request['dn'],$request['attr']);
|
||||
|
||||
$redirect_url = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',
|
||||
$app['server']->getIndex(),rawurlencode($request['dn']));
|
||||
|
||||
if (! isset($update_array[$request['attr']][$request['index']]))
|
||||
system_message(array(
|
||||
'title'=>_('Could not delete attribute value.'),
|
||||
'body'=>sprintf('%s. %s/%s',_('The attribute value does not exist'),$request['attr'],$request['index']),
|
||||
'type'=>'warn'),$redirect_url);
|
||||
|
||||
else {
|
||||
unset($update_array[$request['attr']][$request['index']]);
|
||||
foreach ($update_array as $key => $values)
|
||||
$update_array[$key] = array_values($values);
|
||||
|
||||
$result = $app['server']->modify($request['dn'],$update_array);
|
||||
|
||||
if ($result) {
|
||||
foreach ($update_array as $attr => $junk)
|
||||
$redirect_url .= sprintf('&modified_attrs[]=%s',$attr);
|
||||
|
||||
header("Location: $redirect_url");
|
||||
die();
|
||||
}
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,157 @@
|
|||
<?php
|
||||
/**
|
||||
* Displays a last chance confirmation form to delete a DN.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
# The DN we are working with
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
|
||||
$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();
|
||||
|
||||
# Check if the entry exists.
|
||||
if (! $request['dn'] || ! $app['server']->dnExists($request['dn']))
|
||||
system_message(array(
|
||||
'title'=>_('Entry does not exist'),
|
||||
'body'=>sprintf('%s (%s)',_('The entry does not exist'),$request['dn']),
|
||||
'type'=>'error'),'index.php');
|
||||
|
||||
# We search all children, not only the visible children in the tree
|
||||
$request['children'] = $app['server']->getContainerContents($request['dn'],null,0,'(objectClass=*)',LDAP_DEREF_NEVER);
|
||||
|
||||
printf('<h3 class="title">%s %s</h3>',_('Delete'),htmlspecialchars(get_rdn($request['dn'])));
|
||||
printf('<h3 class="subtitle">%s: <b>%s</b></h3>',
|
||||
_('DN'),$request['dn']);
|
||||
echo "\n";
|
||||
|
||||
echo '<center>';
|
||||
|
||||
if (count($request['children'])) {
|
||||
printf('<b>%s</b><br /><br />',_('Permanently delete all children also?'));
|
||||
|
||||
$search['href'] = htmlspecialchars(sprintf('cmd.php?cmd=query_engine&server_id=%s&filter=%s&base=%s&scope=sub&query=none&format=list',
|
||||
$app['server']->getIndex(),rawurlencode('objectClass=*'),rawurlencode($request['dn'])));
|
||||
|
||||
$query = array();
|
||||
$query['base'] = $request['dn'];
|
||||
$query['scope'] = 'sub';
|
||||
$query['attrs'] = array('dn');
|
||||
$query['size_limit'] = 0;
|
||||
$query['deref'] = LDAP_DEREF_NEVER;
|
||||
$request['search'] = $app['server']->query($query,null);
|
||||
|
||||
echo '<table class="forminput" border="0">';
|
||||
echo '<tr>';
|
||||
echo '<td colspan="2">';
|
||||
printf(_('This entry is the root of a sub-tree containing %s entries.'),count($request['search']));
|
||||
printf(' <small>(<a href="%s">%s</a>)</small>',
|
||||
$search['href'],_('view entries'));
|
||||
echo '</td></tr>';
|
||||
|
||||
echo '<tr><td colspan="2"> </td></tr>';
|
||||
|
||||
printf('<tr><td colspan="2">%s</td></tr>',
|
||||
sprintf(_('phpLDAPadmin can recursively delete this entry and all %s of its children. See below for a list of all the entries that this action will delete. Do you want to do this?'),count($request['search'])));
|
||||
|
||||
echo '<tr><td colspan="2"> </td></tr>';
|
||||
|
||||
printf('<tr><td colspan="2"><small>%s</small></td></tr>',
|
||||
_('Note: this is potentially very dangerous and you do this at your own risk. This operation cannot be undone. Take into consideration aliases, referrals, and other things that may cause problems.'));
|
||||
echo "\n";
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td style="width: 50%; text-align: center;">';
|
||||
echo '<form action="cmd.php" method="post" id="delete_form">';
|
||||
echo '<input type="hidden" name="cmd" value="rdelete" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',$request['template']->getDNEncode(false));
|
||||
//@todo need to refresh the tree after a delete
|
||||
printf('<input type="submit" value="%s" %s />',
|
||||
sprintf(_('Delete all %s objects'),count($request['search'])),
|
||||
(isAjaxEnabled() ? sprintf('onclick="return ajSUBMIT(\'BODY\',document.getElementById(\'delete_form\'),\'%s\');"',_('Deleting Object(s)')) : ''));
|
||||
echo '</form>';
|
||||
echo '</td>';
|
||||
|
||||
echo '<td style="width: 50%; text-align: center;">';
|
||||
echo '<form action="cmd.php" method="get">';
|
||||
echo '<input type="hidden" name="cmd" value="template_engine" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',$request['template']->getDNEncode(false));
|
||||
printf('<input type="submit" name="submit" value="%s" %s />',
|
||||
_('Cancel'),
|
||||
(isAjaxEnabled() ? sprintf('onclick="return ajDISPLAY(\'BODY\',\'cmd=template_engine&server_id=%s&dn=%s\',\'%s\');"',$app['server']->getIndex(),$request['template']->getDNEncode(),_('Retrieving DN')) : ''));
|
||||
echo '</form>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo "\n";
|
||||
|
||||
echo '</table>';
|
||||
echo "\n";
|
||||
|
||||
echo '<br /><br />';
|
||||
echo _('List of entries to be deleted:');
|
||||
echo '<br />';
|
||||
|
||||
$i = 0;
|
||||
printf('<select size="%s" multiple disabled style="background:white; color:black;width:500px" >',min(10,count($request['search'])));
|
||||
foreach ($request['search'] as $key => $value)
|
||||
printf('<option>%s. %s</option>',++$i,dn_unescape($value['dn']));
|
||||
echo '</select>';
|
||||
echo "\n";
|
||||
|
||||
} else {
|
||||
echo '<table class="forminput" border="0">';
|
||||
|
||||
printf('<tr><td colspan="4">%s</td></tr>',_('Are you sure you want to permanently delete this object?'));
|
||||
echo '<tr><td colspan="4"> </td></tr>';
|
||||
|
||||
printf('<tr><td style="width: 10%%;">%s:</td><td colspan="3" style="width: 75%%;"><b>%s</b></td></tr>',_('Server'),$app['server']->getName());
|
||||
printf('<tr><td style="width: 10%%;"><acronym title="%s">%s</acronym></td><td colspan="3" style="width: 75%%;"><b>%s</b></td></tr>',
|
||||
_('DN'),_('DN'),$request['dn']);
|
||||
echo '<tr><td colspan="4"> </td></tr>';
|
||||
echo "\n";
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td colspan="2" style="width: 50%; text-align: center;">';
|
||||
echo '<form action="cmd.php" method="post" id="delete_form">';
|
||||
echo '<input type="hidden" name="cmd" value="delete" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',$request['template']->getDNEncode(false));
|
||||
//@todo need to refresh the tree after a delete
|
||||
printf('<input type="submit" name="submit" value="%s" %s />',
|
||||
_('Delete'),
|
||||
(isAjaxEnabled() ? sprintf('onclick="return ajSUBMIT(\'BODY\',document.getElementById(\'delete_form\'),\'%s\');"',_('Deleting Object(s)')) : ''));
|
||||
echo '</form>';
|
||||
|
||||
echo '</td>';
|
||||
echo '<td colspan="2" style="width: 50%; text-align: center;">';
|
||||
|
||||
echo '<form action="cmd.php" method="get">';
|
||||
echo '<input type="hidden" name="cmd" value="template_engine" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
printf('<input type="hidden" name="dn" value="%s" />',$request['template']->getDNEncode(false));
|
||||
printf('<input type="submit" name="submit" value="%s" %s />',
|
||||
_('Cancel'),
|
||||
(isAjaxEnabled() ? sprintf('onclick="return ajDISPLAY(\'BODY\',\'cmd=template_engine&server_id=%s&dn=%s\',\'%s\');"',$app['server']->getIndex(),$request['template']->getDNEncode(),_('Retrieving DN')) : ''));
|
||||
echo '</form>';
|
||||
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '</table>';
|
||||
echo "\n";
|
||||
}
|
||||
|
||||
echo '</center>';
|
||||
echo '<br />';
|
||||
?>
|
|
@ -0,0 +1,49 @@
|
|||
<?php
|
||||
/**
|
||||
* Download a binary value attribute to the user.
|
||||
* A server ID, DN and Attribute must be provided in the GET attributes.
|
||||
* Optionally an index, type and filename can be supplied.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
$request['attr'] = strtolower(get_request('attr','GET',true));
|
||||
$request['index'] = get_request('index','GET',false,0);
|
||||
$request['type'] = get_request('type','GET',false,'octet-stream');
|
||||
$request['filename'] = get_request('filename','GET',false,sprintf('%s:%s.bin',get_rdn($request['dn'],true),$request['attr']));
|
||||
|
||||
if (! $app['server']->dnExists($request['dn']))
|
||||
error(sprintf(_('The entry (%s) does not exist.'),$request['dn']),'error','index.php');
|
||||
|
||||
$search = $app['server']->getDNAttrValues($request['dn'],null,LDAP_DEREF_NEVER,array($request['attr']));
|
||||
|
||||
# Dump the binary data to the browser
|
||||
$obStatus = ob_get_status();
|
||||
if (isset($obStatus['type']) && $obStatus['type'] && $obStatus['status'])
|
||||
ob_end_clean();
|
||||
|
||||
if (! isset($search[$request['attr']][$request['index']])) {
|
||||
# We cant display an error, but we can set a system message, which will be display on the next page render.
|
||||
system_message(array(
|
||||
'title'=>_('No binary data available'),
|
||||
'body'=>sprintf(_('Could not fetch binary data from LDAP server for attribute [%s].'),$request['attr']),
|
||||
'type'=>'warn'));
|
||||
|
||||
die();
|
||||
}
|
||||
|
||||
header(sprintf('Content-type: %s',$request['type']));
|
||||
header(sprintf('Content-disposition: attachment; filename="%s"',$request['filename']));
|
||||
header(sprintf('Expires: Mon, 26 Jul 1997 05:00:00 GMT',gmdate('r')));
|
||||
header(sprintf('Last-Modified: %s',gmdate('r')));
|
||||
echo $search[$request['attr']][$request['index']];
|
||||
die();
|
||||
?>
|
|
@ -0,0 +1,61 @@
|
|||
<?php
|
||||
/**
|
||||
* Draw a portion of the LDAP tree.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Tree
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','REQUEST');
|
||||
$request['server_id'] = get_request('server_id','REQUEST');
|
||||
$request['code'] = get_request('code','REQUEST');
|
||||
$request['action'] = get_request('action','REQUEST');
|
||||
$request['noheader'] = get_request('noheader','REQUEST',false,0);
|
||||
|
||||
$tree = Tree::getInstance($request['server_id']);
|
||||
if (! $tree)
|
||||
die();
|
||||
|
||||
$treesave = false;
|
||||
|
||||
if ($request['dn']) {
|
||||
$dnentry = $tree->getEntry($request['dn']);
|
||||
|
||||
if (! $dnentry) {
|
||||
$tree->addEntry($request['dn']);
|
||||
$dnentry = $tree->getEntry($request['dn']);
|
||||
$treesave = true;
|
||||
}
|
||||
|
||||
switch ($request['action']) {
|
||||
case 0:
|
||||
$dnentry->close();
|
||||
|
||||
break;
|
||||
|
||||
case 2:
|
||||
default:
|
||||
if ($dnentry->isSizeLimited()) {
|
||||
$tree->readChildren($request['dn'],true);
|
||||
|
||||
$treesave = true;
|
||||
}
|
||||
|
||||
$dnentry->open();
|
||||
}
|
||||
}
|
||||
|
||||
if ($treesave)
|
||||
set_cached_item($app['server']->getIndex(),'tree','null',$tree);
|
||||
|
||||
if ($request['dn'])
|
||||
echo $tree->draw_children($dnentry,$request['code']);
|
||||
else
|
||||
$tree->draw($request['noheader']);
|
||||
|
||||
die();
|
||||
?>
|
|
@ -0,0 +1,123 @@
|
|||
<?php
|
||||
/**
|
||||
* Display a selection (popup window) to pick a DN.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
include './common.php';
|
||||
|
||||
$www['page'] = new page();
|
||||
|
||||
$request = array();
|
||||
$request['container'] = get_request('container','GET');
|
||||
$request['form'] = get_request('form','GET');
|
||||
$request['element'] = get_request('element','GET');
|
||||
$request['rdn'] = get_request('rdn','GET');
|
||||
|
||||
echo '<div class="popup">';
|
||||
printf('<h3 class="subtitle">%s</h3>',_('Entry Chooser'));
|
||||
|
||||
echo '<script type="text/javascript">';
|
||||
echo ' function returnDN(dn) {';
|
||||
printf(" eval ('o = opener.document.getElementById(\"%s\").%s;');",$request['form'],$request['element']);
|
||||
echo ' o.value = dn;';
|
||||
echo ' close();';
|
||||
echo ' }';
|
||||
echo '</script>';
|
||||
|
||||
echo '<table class="forminput" width="100%" border="0">';
|
||||
if ($request['container']) {
|
||||
printf('<tr><td class="heading" colspan="3">%s:</td><td>%s</td></tr>',_('Server'),$app['server']->getName());
|
||||
printf('<tr><td class="heading" colspan="3">%s:</td><td>%s</td></tr>',_('Looking in'),$request['container']);
|
||||
echo '<tr><td class="blank" colspan="4"> </td></tr>';
|
||||
}
|
||||
|
||||
# Has the user already begun to descend into a specific server tree?
|
||||
if (isset($app['server']) && ! is_null($request['container'])) {
|
||||
|
||||
$request['children'] = $app['server']->getContainerContents($request['container'],null,0,'(objectClass=*)',$_SESSION[APPCONFIG]->getValue('deref','tree'));
|
||||
sort($request['children']);
|
||||
|
||||
foreach ($app['server']->getBaseDN() as $base) {
|
||||
if (DEBUG_ENABLED)
|
||||
debug_log('Comparing BaseDN [%s] with container [%s]',64,0,__FILE__,__LINE__,__METHOD__,$base,$request['container']);
|
||||
|
||||
if (! pla_compare_dns($request['container'],$base)) {
|
||||
$parent_container = false;
|
||||
$href['up'] = sprintf('entry_chooser.php?form=%s&element=%s&rdn=%s',$request['form'],$request['element'],rawurlencode($request['rdn']));
|
||||
break;
|
||||
|
||||
} else {
|
||||
$parent_container = $app['server']->getContainer($request['container']);
|
||||
$href['up'] = sprintf('entry_chooser.php?form=%s&element=%s&rdn=%s&server_id=%s&container=%s',
|
||||
$request['form'],$request['element'],$request['rdn'],$app['server']->getIndex(),rawurlencode($parent_container));
|
||||
}
|
||||
}
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="blank"> </td>';
|
||||
printf('<td class="icon"><a href="%s"><img src="%s/up.png" alt="Up" /></a></td>',$href['up'],IMGDIR);
|
||||
printf('<td colspan="2"><a href="%s">%s...</a></td>',$href['up'],_('Back Up'));
|
||||
echo '</tr>';
|
||||
|
||||
if (! count($request['children']))
|
||||
printf('<td class="blank" colspan="2"> </td><td colspan="2">(%s)</td>',_('no entries'));
|
||||
|
||||
else
|
||||
foreach ($request['children'] as $dn) {
|
||||
$href['return'] = sprintf("javascript:returnDN('%s%s')",($request['rdn'] ? sprintf('%s,',$request['rdn']) : ''),str_replace('\\','\\\\',$dn));
|
||||
$href['expand'] = sprintf('entry_chooser.php?server_id=%s&form=%s&element=%s&rdn=%s&container=%s',
|
||||
$app['server']->getIndex(),$request['form'],$request['element'],$request['rdn'],rawurlencode($dn));
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="blank"> </td>';
|
||||
printf('<td class="icon"><a href="%s"><img src="%s/plus.png" alt="Plus" /></a></td>',$href['expand'],IMGDIR);
|
||||
|
||||
printf('<td colspan="2"><a href="%s">%s</a></td>',$href['return'],$dn);
|
||||
echo '</tr>';
|
||||
echo "\n\n";
|
||||
}
|
||||
|
||||
# Draw the root of the selection tree (ie, list all the servers)
|
||||
} else {
|
||||
foreach ($_SESSION[APPCONFIG]->getServerList() as $index => $server) {
|
||||
if ($server->isLoggedIn(null)) {
|
||||
printf('<tr><td class="heading" colspan="3">%s:</td><td class="heading">%s</td></tr>',_('Server'),$server->getName());
|
||||
foreach ($server->getBaseDN() as $dn) {
|
||||
if (! $dn) {
|
||||
printf('<tr><td class="blank"> </td><td colspan="3">(%s)</td></tr>',_('Could not determine base DN'));
|
||||
|
||||
} else {
|
||||
$href['return'] = sprintf("javascript:returnDN('%s%s')",($request['rdn'] ? sprintf('%s,',$request['rdn']) : ''),rawurlencode($dn));
|
||||
$href['expand'] = htmlspecialchars(sprintf('entry_chooser.php?server_id=%s&form=%s&element=%s&rdn=%s&container=%s',
|
||||
$server->getIndex(),$request['form'],$request['element'],$request['rdn'],rawurlencode($dn)));
|
||||
|
||||
echo '<tr>';
|
||||
echo '<td class="blank"> </td>';
|
||||
printf('<td colspan="2" class="icon"><a href="%s"><img src="%s/plus.png" alt="Plus" /></a></td>',$href['expand'],IMGDIR);
|
||||
printf('<td colspan="2"><a href="%s">%s</a></td>',$href['return'],$dn);
|
||||
}
|
||||
}
|
||||
|
||||
echo '<tr><td class="blank" colspan="4"> </td></tr>';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
echo '</table>';
|
||||
echo '</div>';
|
||||
|
||||
# Capture the output and put into the body of the page.
|
||||
$www['body'] = new block();
|
||||
$www['body']->SetBody(ob_get_contents());
|
||||
$www['page']->block_add('body',$www['body']);
|
||||
ob_end_clean();
|
||||
|
||||
# Render the popup.
|
||||
$www['page']->display(array('CONTROL'=>false,'FOOT'=>false,'HEAD'=>false,'TREE'=>false));
|
||||
?>
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
/**
|
||||
* This script alters the session variable 'tree', expanding it
|
||||
* at the dn specified in the query string.
|
||||
*
|
||||
* Note: this script is equal and opposite to collapse.php
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Tree
|
||||
* @see collapse.php
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
|
||||
$dn = get_request('dn','GET',true);
|
||||
$tree = get_cached_item($app['server']->getIndex(),'tree');
|
||||
$entry = $tree->getEntry($dn);
|
||||
$entry->open();
|
||||
set_cached_item($app['server']->getIndex(),'tree','null',$tree);
|
||||
|
||||
header(sprintf('Location:index.php?server_id=%s&junk=%s#%s',
|
||||
$app['server']->getIndex(),random_junk(),htmlid($app['server']->getIndex(),$dn)));
|
||||
die();
|
||||
?>
|
|
@ -0,0 +1,40 @@
|
|||
<?php
|
||||
/**
|
||||
* Performs the export of data from the LDAP server
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
require LIBDIR.'export_functions.php';
|
||||
|
||||
# Prevent script from bailing early for long search
|
||||
@set_time_limit(0);
|
||||
|
||||
$request = array();
|
||||
$request['file'] = get_request('save_as_file') ? true : false;
|
||||
$request['exporter'] = new Exporter($app['server']->getIndex(),get_request('exporter_id','REQUEST'));
|
||||
$request['export'] = $request['exporter']->getTemplate();
|
||||
$types = $request['export']->getType();
|
||||
|
||||
# send the header
|
||||
if ($request['file']) {
|
||||
$obStatus = ob_get_status();
|
||||
if (isset($obStatus['type']) && $obStatus['type'] && $obStatus['status'])
|
||||
ob_end_clean();
|
||||
|
||||
header('Content-type: application/download');
|
||||
header(sprintf('Content-Disposition: inline; filename="%s.%s"','export',$types['extension'].($request['export']->isCompressed() ? '.gz' : '')));
|
||||
$request['export']->export();
|
||||
die();
|
||||
|
||||
} else {
|
||||
print '<span style="font-size: 14px; font-family: courier;"><pre>';
|
||||
$request['export']->export();
|
||||
print '</pre></span>';
|
||||
}
|
||||
?>
|
|
@ -0,0 +1,213 @@
|
|||
<?php
|
||||
/**
|
||||
* Export entries from the LDAP server.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
require LIBDIR.'export_functions.php';
|
||||
|
||||
$request = array();
|
||||
$request['dn'] = get_request('dn','GET');
|
||||
$request['format'] = get_request('format','GET',false,get_line_end_format());
|
||||
$request['scope'] = get_request('scope','GET',false,'base');
|
||||
$request['exporter_id'] = get_request('exporter_id','GET',false,'LDIF');
|
||||
$request['filter'] = get_request('filter','GET',false,'(objectClass=*)');
|
||||
$request['attr'] = get_request('attributes','GET',false,'*');
|
||||
$request['sys_attr'] = get_request('sys_attr','GET') ? true: false;
|
||||
|
||||
$available_formats = array(
|
||||
'mac' => 'Macintosh',
|
||||
'unix' => 'UNIX (Linux, BSD)',
|
||||
'win' => 'Windows'
|
||||
);
|
||||
|
||||
$available_scopes = array(
|
||||
'base' => _('Base (base dn only)'),
|
||||
'one' => _('One (one level beneath base)'),
|
||||
'sub' => _('Sub (entire subtree)')
|
||||
);
|
||||
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->drawTitle(sprintf('<b>%s</b>',_('Export')));
|
||||
|
||||
printf('<script type="text/javascript" src="%sdnChooserPopup.js"></script>',JSDIR);
|
||||
printf('<script type="text/javascript" src="%sform_field_toggle_enable.js"></script>',JSDIR);
|
||||
|
||||
echo '<br />';
|
||||
echo '<form id="export_form" action="cmd.php" method="post">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="cmd" value="export" />';
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
|
||||
echo '<table class="forminput" style="margin-left: auto; margin-right: auto;">';
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
|
||||
echo '<fieldset>';
|
||||
printf('<legend>%s</legend>',_('Export'));
|
||||
|
||||
echo '<table>';
|
||||
printf('<tr><td>%s</td><td>%s</td></tr>',_('Server'),$app['server']->getName());
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td style="white-space:nowrap">%s</td>',_('Base DN'));
|
||||
echo '<td><span style="white-space: nowrap;">';
|
||||
printf('<input type="text" name="dn" id="dn" style="width:230px" value="%s" /> ',htmlspecialchars($request['dn']));
|
||||
draw_chooser_link('export_form','dn');
|
||||
echo '</span></td>';
|
||||
echo '</tr>';
|
||||
|
||||
echo '<tr>';
|
||||
printf('<td><span style="white-space: nowrap">%s</span></td>',_('Search Scope'));
|
||||
|
||||
echo '<td>';
|
||||
|
||||
foreach ($available_scopes as $id => $desc)
|
||||
printf('<input type="radio" name="scope" value="%s" id="%s"%s /><label for="%s">%s</label><br />',
|
||||
htmlspecialchars($id),$id,($id == $request['scope']) ? 'checked="checked"' : '',
|
||||
htmlspecialchars($id),$desc);
|
||||
|
||||
echo '</td>';
|
||||
|
||||
echo '</tr>';
|
||||
|
||||
printf('<tr><td>%s</td><td><input type="text" name="filter" style="width:300px" value="%s" /></td></tr>',
|
||||
_('Search Filter'),htmlspecialchars($request['filter']));
|
||||
|
||||
printf('<tr><td>%s</td><td><input type="text" name="attributes" style="width:300px" value="%s" /></td></tr>',
|
||||
_('Show Attributtes'),htmlspecialchars($request['attr']));
|
||||
|
||||
printf('<tr><td> </td><td><input type="checkbox" name="sys_attr" id="sys_attr" %s/> <label for="sys_attr">%s</label></td></tr>',
|
||||
$request['sys_attr'] ? 'checked="checked" ' : '',_('Include system attributes'));
|
||||
|
||||
printf('<tr><td> </td><td><input type="checkbox" id="save_as_file" name="save_as_file" onclick="export_field_toggle(this)" /> <label for="save_as_file">%s</label></td></tr>',
|
||||
_('Save as file'));
|
||||
|
||||
printf('<tr><td> </td><td><input type="checkbox" id="compress" name="compress" disabled="disabled" /> <label for="compress">%s</label></td></tr>',
|
||||
_('Compress'));
|
||||
|
||||
echo '</table>';
|
||||
echo '</fieldset>';
|
||||
echo '</td>';
|
||||
echo '</tr>';
|
||||
echo '<tr>';
|
||||
echo '<td>';
|
||||
|
||||
echo '<table style="width: 100%">';
|
||||
echo '<tr>';
|
||||
|
||||
echo '<td style="width: 50%">';
|
||||
echo '<fieldset style="height: 100px">';
|
||||
|
||||
printf('<legend>%s</legend>',_('Export format'));
|
||||
|
||||
foreach (Exporter::types() as $index => $exporter) {
|
||||
printf('<input type="radio" name="exporter_id" id="exporter_id_%s" value="%s"%s/>',
|
||||
htmlspecialchars($exporter['type']),htmlspecialchars($exporter['type']),($exporter['type'] === $request['exporter_id']) ? ' checked="checked"' : '');
|
||||
|
||||
printf('<label for="exporter_id_%s">%s</label><br />',
|
||||
htmlspecialchars($exporter['type']),$exporter['type']);
|
||||
}
|
||||
|
||||
echo '</fieldset>';
|
||||
echo '</td>';
|
||||
|
||||
echo '<td style="width: 50%">';
|
||||
echo '<fieldset style="height: 100px">';
|
||||
|
||||
printf('<legend>%s</legend>',_('Line ends'));
|
||||
foreach ($available_formats as $id => $desc)
|
||||
printf('<input type="radio" name="format" value="%s" id="%s"%s /><label for="%s">%s</label><br />',
|
||||
htmlspecialchars($id),htmlspecialchars($id),($request['format']==$id) ? ' checked="checked"' : '',
|
||||
htmlspecialchars($id),$desc);
|
||||
|
||||
echo '</fieldset>';
|
||||
echo '</td></tr>';
|
||||
echo '</table>';
|
||||
echo '</td>';
|
||||
|
||||
echo '</tr>';
|
||||
|
||||
printf('<tr><td colspan="2" style="text-align: center;"><input type="submit" name="target" value="%s" /></td></tr>',
|
||||
htmlspecialchars(_('Proceed >>')));
|
||||
|
||||
echo '</table>';
|
||||
|
||||
echo '</div>';
|
||||
echo '</form>';
|
||||
|
||||
/**
|
||||
* Helper function for fetching the line end format.
|
||||
*
|
||||
* @return String 'win', 'unix', or 'mac' based on the user's browser..
|
||||
*/
|
||||
function get_line_end_format() {
|
||||
if (is_browser('win'))
|
||||
return 'win';
|
||||
elseif (is_browser('unix'))
|
||||
return 'unix';
|
||||
elseif (is_browser('mac'))
|
||||
return 'mac';
|
||||
else
|
||||
return 'unix';
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the USER_AGENT string from the $_SERVER array, all in lower case in
|
||||
* an E_NOTICE safe manner.
|
||||
*
|
||||
* @return string|false The user agent string as reported by the browser.
|
||||
*/
|
||||
function get_user_agent_string() {
|
||||
if (isset($_SERVER['HTTP_USER_AGENT']))
|
||||
return strtolower($_SERVER['HTTP_USER_AGENT']);
|
||||
else
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the OS for the browser
|
||||
*/
|
||||
function is_browser($type) {
|
||||
$agents = array();
|
||||
|
||||
$agents['unix'] = array(
|
||||
'sunos','sunos 4','sunos 5',
|
||||
'i86',
|
||||
'irix','irix 5','irix 6','irix6',
|
||||
'hp-ux','09.','10.',
|
||||
'aix','aix 1','aix 2','aix 3','aix 4',
|
||||
'inux',
|
||||
'sco',
|
||||
'unix_sv','unix_system_v','ncr','reliant','dec','osf1',
|
||||
'dec_alpha','alphaserver','ultrix','alphastation',
|
||||
'sinix',
|
||||
'freebsd','bsd',
|
||||
'x11','vax','openvms'
|
||||
);
|
||||
|
||||
$agents['win'] = array(
|
||||
'win','win95','windows 95',
|
||||
'win16','windows 3.1','windows 16-bit','windows','win31','win16','winme',
|
||||
'win2k','winxp',
|
||||
'win98','windows 98','win9x',
|
||||
'winnt','windows nt','win32',
|
||||
'32bit'
|
||||
);
|
||||
|
||||
$agents['mac'] = array(
|
||||
'mac','68000','ppc','powerpc'
|
||||
);
|
||||
|
||||
if (isset($agents[$type]))
|
||||
return in_array(get_user_agent_string(),$agents[$type]);
|
||||
else
|
||||
return false;
|
||||
}
|
||||
?>
|
After Width: | Height: | Size: 7.5 KiB |
After Width: | Height: | Size: 2.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 253 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 624 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 628 B |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |
After Width: | Height: | Size: 1.0 KiB |