phpldapadmin/htdocs/expand.php

70 lines
2.1 KiB
PHP
Raw Normal View History

2009-06-30 08:09:20 +00:00
<?php
2009-06-30 09:29:51 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/expand.php,v 1.22 2005/07/22 05:47:44 wurley Exp $
2009-06-30 09:22:30 +00:00
2009-06-30 09:29:51 +00:00
/**
2009-06-30 08:05:37 +00:00
* This script alters the session variable 'tree', expanding it
2009-06-30 09:29:51 +00:00
* at the dn specified in the query string.
2009-06-30 08:05:37 +00:00
*
2009-06-30 09:29:51 +00:00
* Variables that come in via common.php
* - server_id
2009-06-30 08:05:37 +00:00
* Variables that come in as GET vars:
* - dn (rawurlencoded)
*
* Note: this script is equal and opposite to collapse.php
2009-06-30 09:29:51 +00:00
* @package phpLDAPadmin
* @see collapse.php
*/
/**
2009-06-30 08:05:37 +00:00
*/
2009-06-30 09:22:30 +00:00
require './common.php';
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
if (! $ldapserver->haveAuthInfo())
pla_error($lang['not_enough_login_info']);
# no expire header stuff
2009-06-30 08:05:37 +00:00
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
2009-06-30 09:29:51 +00:00
# This allows us to display large sub-trees without running out of time.
2009-06-30 09:22:30 +00:00
@set_time_limit( 0 );
2009-06-30 08:07:14 +00:00
$dn = $_GET['dn'];
2009-06-30 08:05:37 +00:00
$encoded_dn = rawurlencode( $dn );
2009-06-30 09:22:30 +00:00
initialize_session_tree();
2009-06-30 08:07:14 +00:00
2009-06-30 08:05:37 +00:00
$tree = $_SESSION['tree'];
$tree_icons = $_SESSION['tree_icons'];
2009-06-30 09:29:51 +00:00
$contents = get_container_contents( $ldapserver, $dn, 0, '(objectClass=*)', $config->GetValue('deref','tree'));
2009-06-30 09:22:30 +00:00
usort( $contents, 'pla_compare_dns' );
2009-06-30 09:29:51 +00:00
$tree[$ldapserver->server_id][$dn] = $contents;
2009-06-30 08:07:14 +00:00
2009-06-30 08:05:37 +00:00
foreach( $contents as $dn )
2009-06-30 09:29:51 +00:00
$tree_icons[$ldapserver->server_id][$dn] = get_icon( $ldapserver, $dn );
2009-06-30 08:05:37 +00:00
$_SESSION['tree'] = $tree;
$_SESSION['tree_icons'] = $tree_icons;
// This is for Opera. By putting "random junk" in the query string, it thinks
// that it does not have a cached version of the page, and will thus
// fetch the page rather than display the cached version
$time = gettimeofday();
$random_junk = md5( strtotime( 'now' ) . $time['usec'] );
2009-06-30 08:07:14 +00:00
// If cookies were disabled, build the url parameter for the session id.
// It will be append to the url to be redirect
$id_session_param="";
2009-06-30 09:29:51 +00:00
if( SID != "" )
2009-06-30 09:22:30 +00:00
$id_session_param = "&".session_name()."=".session_id();
2009-06-30 08:05:37 +00:00
2009-06-30 08:09:20 +00:00
session_write_close();
2009-06-30 09:29:51 +00:00
header(sprintf('Location:tree.php?foo=%s#%s_%s%s',$random_junk,$ldapserver->server_id,$encoded_dn,$id_session_param));
2009-06-30 08:05:37 +00:00
?>