phpldapadmin/htdocs/export.php

41 lines
1.1 KiB
PHP
Raw Normal View History

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