phpldapadmin/htdocs/refresh.php

52 lines
1.5 KiB
PHP
Raw Normal View History

2009-06-30 09:22:30 +00:00
<?php
2009-06-30 09:29:51 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/refresh.php,v 1.15 2005/07/22 05:51:57 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', by re-querying
* the LDAP server to grab the contents of every expanded container.
*
2009-06-30 09:29:51 +00:00
* Variables that come in via common.php
2009-06-30 08:05:37 +00:00
* - server_id
2009-06-30 09:29:51 +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:29:51 +00:00
if (! isset($ldapserver) || ! array_key_exists('tree',$_SESSION))
header("Location: tree.php");
2009-06-30 08:05:37 +00:00
$tree = $_SESSION['tree'];
$tree_icons = $_SESSION['tree_icons'];
2009-06-30 09:29:51 +00:00
# Get the icon for the base object(s) for this server
foreach ($ldapserver->getBaseDN() as $base_dn)
$tree_icons[$ldapserver->server_id][$base_dn] = get_icon($ldapserver,$base_dn);
# get all the icons and container contents for all expanded entries
if (isset($tree[$ldapserver->server_id]) && is_array($tree[$ldapserver->server_id])) {
foreach ($tree[$ldapserver->server_id] as $dn => $children) {
$tree[$ldapserver->server_id][$dn] = get_container_contents($ldapserver,$dn,0,'(objectClass=*)',
$config->GetValue('deref','tree'));
if (is_array($tree[$ldapserver->server_id][$dn])) {
foreach ($tree[$ldapserver->server_id][$dn] as $child_dn)
$tree_icons[$ldapserver->server_id][$child_dn] = get_icon($ldapserver,$child_dn);
sort($tree[$ldapserver->server_id][$dn]);
2009-06-30 08:09:20 +00:00
}
2009-06-30 08:05:37 +00:00
}
2009-06-30 09:29:51 +00:00
} else {
header(sprintf('Location: tree.php#%s',$ldapserver->server_id));
2009-06-30 08:05:37 +00:00
}
$_SESSION['tree'] = $tree;
$_SESSION['tree_icons'] = $tree_icons;
session_write_close();
2009-06-30 09:29:51 +00:00
header(sprintf('Location: tree.php#%s',$ldapserver->server_id));
2009-06-30 08:05:37 +00:00
?>