2009-06-30 08:07:14 +00:00
|
|
|
<?php
|
2009-06-30 10:46:00 +00:00
|
|
|
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/download_binary_attr.php,v 1.15 2007/12/15 07:50:30 wurley Exp $
|
2009-06-30 08:07:14 +00:00
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
/**
|
|
|
|
* @package phpLDAPadmin
|
|
|
|
* Variables that come in via common.php
|
|
|
|
* - server_id
|
|
|
|
*/
|
|
|
|
/**
|
|
|
|
*/
|
2009-06-30 09:22:30 +00:00
|
|
|
|
|
|
|
require './common.php';
|
2009-06-30 08:07:14 +00:00
|
|
|
|
2009-06-30 09:29:51 +00:00
|
|
|
if ($ldapserver->isReadOnly())
|
2009-06-30 10:26:08 +00:00
|
|
|
pla_error(_('You cannot perform updates while server is in read-only mode'));
|
2009-06-30 09:29:51 +00:00
|
|
|
if (! $ldapserver->haveAuthInfo())
|
2009-06-30 10:26:08 +00:00
|
|
|
pla_error(_('Not enough information to login to server. Please check your configuration.'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
$dn = rawurldecode($_GET['dn']);
|
2009-06-30 08:07:14 +00:00
|
|
|
$attr = $_GET['attr'];
|
2009-06-30 09:29:51 +00:00
|
|
|
|
|
|
|
# if there are multiple values in this attribute, which one do you want to see?
|
2009-06-30 10:26:08 +00:00
|
|
|
$value_num = isset($_GET['value_num']) ? $_GET['value_num'] : null;
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
if (! $ldapserver->dnExists($dn))
|
|
|
|
pla_error(sprintf(_('No such entry: %s'),pretty_print_dn($dn)));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:46:00 +00:00
|
|
|
$search = $ldapserver->search(null,$dn,'(objectClass=*)',array($attr),'base',false,$_SESSION['plaConfig']->GetValue('deref','view'));
|
2009-06-30 09:29:51 +00:00
|
|
|
|
2009-06-30 10:26:08 +00:00
|
|
|
# Dump the binary data to the browser
|
2009-06-30 10:46:00 +00:00
|
|
|
if (ob_get_level()) ob_end_clean();
|
2009-06-30 10:26:08 +00:00
|
|
|
header('Content-type: octet-stream');
|
2009-06-30 09:29:51 +00:00
|
|
|
header("Content-disposition: attachment; filename=$attr");
|
2009-06-30 10:26:08 +00:00
|
|
|
header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
|
|
|
|
header('Last-Modified: '.gmdate('D, d M Y H:i:s').' GMT');
|
|
|
|
if ($value_num && is_array($search[$attr][$dn]))
|
|
|
|
echo $search[$dn][$attr][$value_num];
|
|
|
|
else
|
|
|
|
echo $search[$dn][$attr];
|
2009-06-30 08:07:14 +00:00
|
|
|
?>
|