Start of implementation of Import and Export using LDIF

This commit is contained in:
2024-01-11 08:59:40 +11:00
parent ded1f74285
commit 4c8bd1c81f
30 changed files with 1118 additions and 925 deletions

View File

@@ -1,40 +0,0 @@
<?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' : '')));
echo $request['export']->export();
die();
} else {
print '<span style="font-size: 14px; font-family: courier;"><pre>';
echo htmlspecialchars($request['export']->export());
print '</pre></span>';
}
?>

View File

@@ -1,48 +0,0 @@
<?php
/**
* Displays a form to allow the user to upload and import
* an LDIF file.
*
* @package phpLDAPadmin
* @subpackage Page
*/
/**
*/
require './common.php';
if (! ini_get('file_uploads'))
error(_('Your PHP.INI does not have file_uploads = ON. Please enable file uploads in PHP.'),'error','index.php');
$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>',_('Server'),$app['server']->getName()));
echo '<form action="cmd.php" method="post" class="new_value" enctype="multipart/form-data">';
echo '<div>';
printf('<input type="hidden" name="server_id" value="%s" />',$app['server']->getIndex());
echo '<input type="hidden" name="cmd" value="import" />';
echo '</div>';
echo '<table class="forminput" border="0" style="margin-left: auto; margin-right: auto;">';
echo '<tr><td colspan="2">&nbsp;</td></tr>';
echo '<tr>';
printf('<td>%s</td>',_('Select an LDIF file'));
echo '<td>';
echo '<input type="file" name="ldif_file" />';
echo '</td></tr>';
printf('<tr><td>&nbsp;</td><td class="small"><b>%s %s</b></td></tr>',_('Maximum file size'),ini_get('upload_max_filesize'));
echo '<tr><td colspan="2">&nbsp;</td></tr>';
printf('<tr><td>%s</td></tr>',_('Or paste your LDIF here'));
echo '<tr><td colspan="2"><textarea name="ldif" rows="20" cols="100"></textarea></td></tr>';
echo '<tr><td colspan="2">&nbsp;</td></tr>';
printf('<tr><td>&nbsp;</td><td class="small"><input type="checkbox" name="continuous_mode" value="1" />%s</td></tr>',
_("Don't stop on errors"));
printf('<tr><td>&nbsp;</td><td><input type="submit" value="%s" /></td></tr>',_('Proceed >>'));
echo '</table>';
echo '</form>';
?>