Removed some old files where functionality has been adapted in PLA v2
This commit is contained in:
@@ -1,117 +0,0 @@
|
||||
<?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();
|
||||
}
|
||||
}
|
||||
?>
|
@@ -1,173 +0,0 @@
|
||||
<?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'),htmlspecialchars($request['attr']),_('value to'),htmlspecialchars(get_rdn($request['dn']))));
|
||||
$request['page']->drawSubTitle();
|
||||
|
||||
if (! strcasecmp($request['attr'],'objectclass')) {
|
||||
echo '<form action="cmd.php" method="post" class="new_value" id="entry_form">';
|
||||
echo '<div>';
|
||||
echo '<input type="hidden" name="cmd" value="add_oclass_form" />';
|
||||
|
||||
} else {
|
||||
echo '<form action="cmd.php" method="post" class="new_value" id="entry_form" enctype="multipart/form-data" onsubmit="return submitForm(this)">';
|
||||
echo '<div>';
|
||||
if ($_SESSION[APPCONFIG]->getValue('confirm','update'))
|
||||
echo '<input type="hidden" name="cmd" value="update_confirm" />';
|
||||
else
|
||||
echo '<input type="hidden" name="cmd" value="update" />';
|
||||
}
|
||||
|
||||
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
|
||||
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']);
|
||||
}
|
||||
}
|
||||
?>
|
@@ -1,213 +0,0 @@
|
||||
<?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 Attributes'),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;
|
||||
}
|
||||
?>
|
@@ -1,111 +0,0 @@
|
||||
<?php
|
||||
/**
|
||||
* Imports an LDIF file to the specified LDAP server.
|
||||
*
|
||||
* @package phpLDAPadmin
|
||||
* @subpackage Page
|
||||
*/
|
||||
|
||||
/**
|
||||
*/
|
||||
|
||||
require './common.php';
|
||||
require LIBDIR.'import_functions.php';
|
||||
|
||||
$request = array();
|
||||
$request['importer'] = new Importer($app['server']->getIndex(),'LDIF');
|
||||
$request['import'] = $request['importer']->getTemplate();
|
||||
|
||||
$request['continuous_mode'] = get_request('continuous_mode') ? true : false;
|
||||
|
||||
$type = $request['import']->getType();
|
||||
|
||||
# Set our timelimit in case we have a lot of importing to do
|
||||
@set_time_limit(0);
|
||||
|
||||
# String associated to the operation on the ldap server
|
||||
$actionString = array(
|
||||
'add' => _('Adding'),
|
||||
'delete' => _('Deleting'),
|
||||
'modrdn' => _('Renaming'),
|
||||
'moddn' => _('Renaming'),
|
||||
'modify' => _('Modifying')
|
||||
);
|
||||
|
||||
# String associated with error
|
||||
$actionErrorMsg = array(
|
||||
'add' => _('Could not add object'),
|
||||
'delete' => _('Could not delete object'),
|
||||
'modrdn' => _('Could not rename object'),
|
||||
'moddn' => _('Could not rename object'),
|
||||
'modify' => _('Could not modify object')
|
||||
);
|
||||
|
||||
$request['page'] = new PageRender($app['server']->getIndex(),get_request('template','REQUEST',false,'none'));
|
||||
$request['page']->drawTitle(sprintf('<b>%s</b>',_('Import')));
|
||||
$request['page']->drawSubTitle(sprintf('%s: <b>%s</b> %s: <b>%s %s %s (%s)</b>',
|
||||
_('Server'),$app['server']->getName(),
|
||||
_('File'),$request['import']->getSource('name'),number_format($request['import']->getSource('size')),_('bytes'),$type['description']));
|
||||
|
||||
echo '<br />';
|
||||
|
||||
# @todo When renaming DNs, the hotlink should point to the new entry on success, or the old entry on failure.
|
||||
while (! $request['import']->eof()) {
|
||||
while ($request['template'] = $request['import']->readEntry()) {
|
||||
|
||||
$edit_href = sprintf('cmd.php?cmd=template_engine&server_id=%s&dn=%s',$app['server']->getIndex(),
|
||||
rawurlencode($request['template']->getDN()));
|
||||
|
||||
$changetype = $request['template']->getType();
|
||||
printf('<small>%s <a href="%s">%s</a>',$actionString[$changetype],$edit_href,$request['template']->getDN());
|
||||
|
||||
if ($request['import']->LDAPimport())
|
||||
printf(' <span style="color:green;">%s</span></small><br />',_('Success'));
|
||||
|
||||
else {
|
||||
printf(' <span style="color:red;">%s</span></small><br /><br />',_('Failed'));
|
||||
$errormsg = sprintf('%s <b>%s</b>',$actionErrorMsg[$changetype],$request['template']->getDN());
|
||||
$errormsg .= ldap_error_msg($app['server']->getErrorMessage(null),$app['server']->getErrorNum(null));
|
||||
|
||||
system_message(array(
|
||||
'title'=>_('LDIF text import'),
|
||||
'body'=>$errormsg,
|
||||
'type'=>'warn'));
|
||||
}
|
||||
}
|
||||
|
||||
if ($request['import']->error) {
|
||||
printf('<small><span style="color:red;">%s: %s</span></small><br />',
|
||||
_('Error'),$request['import']->error['message']);
|
||||
|
||||
echo '<br/>';
|
||||
|
||||
display_pla_parse_error($request['import']);
|
||||
}
|
||||
|
||||
if (! $request['continuous_mode'])
|
||||
break;
|
||||
}
|
||||
|
||||
function display_pla_parse_error($request) {
|
||||
$type = $request->getType();
|
||||
|
||||
echo '<center>';
|
||||
echo '<table class="error">';
|
||||
echo '<tr>';
|
||||
printf('<td class="img"><img src="%s/%s" /></td>',IMGDIR,'error-big.png');
|
||||
|
||||
printf('<td><h2>%s %s</h2></td>',$type['description'],_('Parse Error'));
|
||||
echo '</tr>';
|
||||
|
||||
printf('<tr><td><b>%s</b>:</td><td>%s</td></tr>',_('Description'),$request->error['message']);
|
||||
printf('<tr><td><b>%s</b>:</td><td>%s</td></tr>',_('Line'),$request->error['line']);
|
||||
printf('<tr><td colspan=2><b>%s</b>:</td></tr>',_('Data'));
|
||||
|
||||
foreach ($request->error['data'] as $line)
|
||||
printf('<tr><td> </td><td>%s</td></tr>',$line);
|
||||
|
||||
echo '</table>';
|
||||
echo '</center>';
|
||||
}
|
||||
?>
|
6
htdocs/js/dnChooserPopup.js
vendored
6
htdocs/js/dnChooserPopup.js
vendored
@@ -1,6 +0,0 @@
|
||||
function dnChooserPopup(form,element,rdn)
|
||||
{
|
||||
mywindow=open('entry_chooser.php','myname','resizable=no,width=600,height=370,scrollbars=1');
|
||||
mywindow.location.href = 'entry_chooser.php?form=' + form + '&element=' + element + '&rdn=' + rdn;
|
||||
if (mywindow.opener == null) mywindow.opener = self;
|
||||
}
|
Reference in New Issue
Block a user