2009-06-30 09:22:30 +00:00
|
|
|
<?php
|
2009-06-30 09:24:29 +00:00
|
|
|
// $Header: /cvsroot/phpldapadmin/phpldapadmin/refresh.php,v 1.13 2005/03/05 09:41:01 wurley Exp $
|
2009-06-30 09:22:30 +00:00
|
|
|
|
2009-06-30 09:24:29 +00:00
|
|
|
/**
|
2009-06-30 08:05:37 +00:00
|
|
|
* This script alters the session variable 'tree', by re-querying
|
|
|
|
* the LDAP server to grab the contents of every expanded container.
|
|
|
|
*
|
|
|
|
* Variables that come in as GET vars:
|
|
|
|
* - server_id
|
2009-06-30 09:24:29 +00:00
|
|
|
*
|
|
|
|
* @package phpLDAPadmin
|
|
|
|
*/
|
|
|
|
/**
|
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:24:29 +00:00
|
|
|
$server_id = (isset($_GET['server_id']) ? $_GET['server_id'] : '');
|
|
|
|
$ldapserver = new LDAPServer($server_id);
|
2009-06-30 08:05:37 +00:00
|
|
|
|
2009-06-30 09:24:29 +00:00
|
|
|
if( ! $ldapserver->haveAuthInfo() || ! array_key_exists( 'tree', $_SESSION ))
|
2009-06-30 08:05:37 +00:00
|
|
|
header( "Location: tree.php" );
|
|
|
|
|
|
|
|
$tree = $_SESSION['tree'];
|
|
|
|
$tree_icons = $_SESSION['tree_icons'];
|
|
|
|
|
2009-06-30 09:24:29 +00:00
|
|
|
// Get the icon for the base object(s) for this server
|
|
|
|
foreach ($ldapserver->getBaseDN() as $base_dn)
|
|
|
|
$tree_icons[$server_id][ $base_dn ] = get_icon( $ldapserver, $base_dn );
|
2009-06-30 08:05:37 +00:00
|
|
|
|
|
|
|
// get all the icons and container contents for all expanded entries
|
2009-06-30 09:24:29 +00:00
|
|
|
if( isset($tree[$server_id]) && is_array( $tree[$server_id] ) ) {
|
|
|
|
foreach( $tree[$server_id] as $dn => $children ) {
|
|
|
|
$tree[$server_id][$dn] = get_container_contents( $ldapserver, $dn, 0, '(objectClass=*)', get_tree_deref_setting() );
|
|
|
|
|
2009-06-30 08:09:20 +00:00
|
|
|
if( is_array( $tree[$server_id][$dn] ) ) {
|
|
|
|
foreach( $tree[$server_id][$dn] as $child_dn )
|
2009-06-30 09:24:29 +00:00
|
|
|
$tree_icons[$server_id][$child_dn] = get_icon( $ldapserver, $child_dn );
|
|
|
|
|
2009-06-30 08:09:20 +00:00
|
|
|
sort( $tree[ $server_id ][ $dn ] );
|
|
|
|
}
|
2009-06-30 08:05:37 +00:00
|
|
|
}
|
2009-06-30 09:24:29 +00:00
|
|
|
|
|
|
|
} else {
|
2009-06-30 08:05:37 +00:00
|
|
|
header( "Location: tree.php#$server_id" );
|
|
|
|
}
|
|
|
|
|
|
|
|
$_SESSION['tree'] = $tree;
|
|
|
|
$_SESSION['tree_icons'] = $tree_icons;
|
|
|
|
session_write_close();
|
|
|
|
|
|
|
|
header( "Location: tree.php#$server_id" );
|
|
|
|
?>
|