File: export.php

package info (click to toggle)
phpldapadmin 1.2.6.3-0.3%2Bdeb12u1
  • links: PTS
  • area: main
  • in suites: bookworm
  • size: 6,836 kB
  • sloc: php: 17,571; javascript: 5,299; xml: 1,498; sh: 346; makefile: 26
file content (40 lines) | stat: -rwxr-xr-x 1,111 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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' : '')));
	echo $request['export']->export();
	die();

} else {
	print '<span style="font-size: 14px; font-family: courier;"><pre>';
	echo htmlspecialchars($request['export']->export());
	print '</pre></span>';
}
?>