phpldapadmin/collapse.php

52 lines
1.5 KiB
PHP
Raw Normal View History

2009-06-30 08:05:37 +00:00
<?php
/*
* collapse.php
* This script alters the session variable 'tree', collapsing it
* at the dn specified in the query string.
*
* Variables that come in as GET vars:
* - dn (rawurlencoded)
* - server_id
*
* Note: this script is equal and opposite to expand.php
*/
2009-06-30 08:07:14 +00:00
require 'common.php';
2009-06-30 08:05:37 +00:00
2009-06-30 08:07:14 +00:00
$dn = $_GET['dn'];
2009-06-30 08:05:37 +00:00
$encoded_dn = rawurlencode( $dn );
$server_id = $_GET['server_id'];
check_server_id( $server_id ) or pla_error( "Bad server_id: " . htmlspecialchars( $server_id ) );
session_start();
2009-06-30 08:07:14 +00:00
// dave commented this out since it was being triggered for weird reasons
//session_is_registered( 'tree' ) or pla_error( "Your session tree is not registered. That's weird. Shouldn't ever happen".
// ". Just go back and it should be fixed automagically." );
2009-06-30 08:05:37 +00:00
$tree = $_SESSION['tree'];
// and remove this instance of the dn as well
unset( $tree[$server_id][$dn] );
$_SESSION['tree'] = $tree;
session_write_close();
// 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="";
if(SID != ""){
$id_session_param = "&".session_name()."=".session_id();
}
2009-06-30 08:05:37 +00:00
2009-06-30 08:09:20 +00:00
header( "Location:tree.php?foo=$random_junk#{$server_id}_{$encoded_dn}$id_session_param" );
2009-06-30 08:07:14 +00:00
?>