phpldapadmin/htdocs/export.php

41 lines
1.1 KiB
PHP
Raw Normal View History

2009-06-30 09:22:30 +00:00
<?php
2009-06-30 09:29:51 +00:00
/**
* Performs the export of data from the LDAP server
*
2009-06-30 09:29:51 +00:00
* @package phpLDAPadmin
* @subpackage Page
2009-06-30 09:29:51 +00:00
*/
2009-06-30 09:29:51 +00:00
/**
*/
2009-06-30 10:46:00 +00:00
require './common.php';
2009-06-30 09:29:51 +00:00
require LIBDIR.'export_functions.php';
2009-06-30 09:22:30 +00:00
# Prevent script from bailing early for long search
2009-06-30 10:26:08 +00:00
@set_time_limit(0);
2009-06-30 09:29:51 +00:00
$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();
2009-06-30 10:26:08 +00:00
# send the header
if ($request['file']) {
2009-06-30 11:52:55 +00:00
$obStatus = ob_get_status();
if (isset($obStatus['type']) && $obStatus['type'] && $obStatus['status'])
ob_end_clean();
2009-06-30 10:26:08 +00:00
header('Content-type: application/download');
header(sprintf('Content-Disposition: inline; filename="%s.%s"','export',$types['extension'].($request['export']->isCompressed() ? '.gz' : '')));
$request['export']->export();
2009-06-30 10:46:00 +00:00
die();
2009-06-30 10:26:08 +00:00
2009-06-30 10:46:00 +00:00
} else {
print '<span style="font-size: 14px; font-family: courier;"><pre>';
$request['export']->export();
2009-06-30 10:46:00 +00:00
print '</pre></span>';
}
2009-06-30 09:22:30 +00:00
?>