phpldapadmin/htdocs/tree.php

126 lines
4.8 KiB
PHP
Raw Normal View History

2009-06-30 08:09:20 +00:00
<?php
2009-06-30 10:41:18 +00:00
// $Header: /cvsroot/phpldapadmin/phpldapadmin/htdocs/tree.php,v 1.92 2006/10/29 12:49:24 wurley Exp $
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
/**
2009-06-30 08:05:37 +00:00
* This script displays the LDAP tree for all the servers that you have
2009-06-30 09:29:51 +00:00
* in config.php.
*
* We read the session variable 'tree' to know which dns are expanded or collapsed.
* No query string parameters are expected, however, you can use a '#' offset to
* scroll to a given dn. The syntax is tree.php#<server_id>_<rawurlencoded dn>, so
* if I wanted to scroll to dc=example,dc=com for server 3, the URL would be:
*
2009-06-30 08:05:37 +00:00
* tree.php#3_dc%3Dexample%2Cdc%3Dcom
2009-06-30 09:29:51 +00:00
*
* @package phpLDAPadmin
* @author The phpLDAPadmin development team
*/
/**
2009-06-30 08:05:37 +00:00
*/
2009-06-30 09:22:30 +00:00
require './common.php';
2009-06-30 10:26:08 +00:00
no_expire_header();
2009-06-30 08:05:37 +00:00
2009-06-30 10:26:08 +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:05:37 +00:00
2009-06-30 09:29:51 +00:00
$recently_timed_out_servers = array();
2009-06-30 10:26:08 +00:00
if (isset($_SESSION['activity']['rightframe_server_id']))
$rightframe_server_id = $_SESSION['activity']['rightframe_server_id'];
$rightframerefresh = false;
2009-06-30 09:29:51 +00:00
2009-06-30 10:26:08 +00:00
foreach ($ldapservers->GetServerList() as $server_id) {
2009-06-30 09:29:51 +00:00
$ldapserver = $ldapservers->Instance($server_id);
# Test to see if we should log out the user due to the timeout.
2009-06-30 10:26:08 +00:00
if ($ldapserver->haveAuthInfo() && $ldapserver->auth_type != 'config') {
2009-06-30 09:29:51 +00:00
/* If time out value has been reached:
2009-06-30 10:26:08 +00:00
- log out user
- put $server_id in array of recently timed out servers */
if (session_timed_out($ldapserver)) {
2009-06-30 09:29:51 +00:00
array_push($recently_timed_out_servers, $server_id);
2009-06-30 10:26:08 +00:00
# If $ldapserver->server_id equal $rightframe_server_id load timeout page on right frame
if ($ldapserver->server_id == $rightframe_server_id)
$rightframerefresh = true;
/* Otherwise calculate a new refresh value. If the timeout value is less than the previous
$meta_refresh_variable value set $meta_refresh_variable to $ldapserver->session_timeout */
} else
2009-06-30 09:29:51 +00:00
$meta_refresh_variable = $ldapserver->session_timeout*60;
}
}
2009-06-30 09:22:30 +00:00
include './header.php';
2009-06-30 08:05:37 +00:00
2009-06-30 10:26:08 +00:00
echo '<body>';
2009-06-30 08:05:37 +00:00
2009-06-30 10:26:08 +00:00
if ($rightframerefresh) {
?>
<script type="text/javascript" language="javascript">
<!--
parent.right_frame.location.href = 'timeout.php?server_id=<?php echo $rightframe_server_id; ?>';
//-->
</script>
2009-06-30 09:22:30 +00:00
<?php
2009-06-30 10:26:08 +00:00
}
2009-06-30 08:05:37 +00:00
?>
2009-06-30 10:26:08 +00:00
<!-- # PHP layers menu. -->
<script type="text/javascript" language="javascript" src="js/phplayersmenu/libjs/layersmenu-browser_detection.js"></script>
<script type="text/javascript" language="javascript" src="js/phplayersmenu/libjs/layerstreemenu-cookies.js"></script>
2009-06-30 09:22:30 +00:00
2009-06-30 10:26:08 +00:00
<?php
printf('<h3 class="subtitle" style="margin:0px">phpLDAPadmin - %s</h3>',pla_version());
echo "\n\n";
echo '<!-- Links at the top of the tree viewer -->';
echo '<table class="edit_dn_menu" width=100%><tr>';
printf('<td><img src="images/home.png" alt="%s" /></td>',_('Home'));
2009-06-30 10:41:18 +00:00
printf('<td width=50%%><span style="white-space: nowrap;"><a href="welcome.php" target="right_frame">%s</a></span></td>',_('Home'));
2009-06-30 10:26:08 +00:00
printf('<td><img src="images/trash.png" alt="%s" /></td>',_('Purge caches'));
2009-06-30 10:41:18 +00:00
printf('<td width=50%%><span style="white-space: nowrap;"><a href="purge_cache.php" target="right_frame" title="%s">%s</a></span></td>',_('Purge all cached data in phpLDAPadmin, including server schemas.'),_('Purge caches'));
2009-06-30 10:26:08 +00:00
echo '</tr><tr>';
if (! $config->GetValue('appearance','hide_configuration_management')) {
printf('<td><img src="images/light.png" alt="%s" /></td>',_('light'));
2009-06-30 10:41:18 +00:00
printf('<td width=50%%><span style="white-space: nowrap;"><a href="%s" target="new">%s</a></span></td>',get_href('add_rfe'),_('Request feature'));
2009-06-30 10:26:08 +00:00
printf('<td><img src="images/bug.png" alt="%s" /></td>',_('bug'));
2009-06-30 10:41:18 +00:00
printf('<td width=50%%><span style="white-space: nowrap;"><a href="%s" target="new">%s</a></span></td>',get_href('add_bug'),_('Report a bug'));
2009-06-30 10:26:08 +00:00
echo '</tr><tr>';
printf('<td><img src="images/smile.png" alt="%s" /></td>',_('Donate'));
2009-06-30 10:41:18 +00:00
printf('<td width=50%%><span style="white-space: nowrap;"><a href="%s" target="right_frame">%s</a></span></td>',get_href('donate'),_('Donate'));
2009-06-30 10:26:08 +00:00
}
2009-06-30 08:07:14 +00:00
2009-06-30 10:26:08 +00:00
printf('<td><img src="images/help.png" alt="%s" /></td>',_('Help'));
2009-06-30 10:41:18 +00:00
printf('<td><span style="white-space: nowrap;"><a href="help.php" target="right_frame">%s</a></span></td>',_('Help'));
2009-06-30 10:26:08 +00:00
echo '</tr></table>';
2009-06-30 08:05:37 +00:00
2009-06-30 10:26:08 +00:00
echo "\n\n";
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
# We want the std tree function as a fallback
require LIBDIR.'tree_functions.php';
2009-06-30 09:22:30 +00:00
2009-06-30 10:26:08 +00:00
# Are we going to use the PLM tree?
if ($config->GetValue('appearance','tree_plm')) {
require JSDIR.'phplayersmenu/lib/PHPLIB.php';
require JSDIR.'phplayersmenu/lib/layersmenu-common.inc.php';
require JSDIR.'phplayersmenu/lib/treemenu.inc.php';
}
2009-06-30 09:29:51 +00:00
# For each of the configured servers
foreach( $ldapservers->GetServerList() as $server_id ) {
$ldapserver = $ldapservers->Instance($server_id);
2009-06-30 08:05:37 +00:00
2009-06-30 09:29:51 +00:00
if ($ldapserver->isVisible()) {
$filename = get_custom_file($server_id,'tree_functions.php',LIBDIR);
require_once($filename);
2009-06-30 09:22:30 +00:00
2009-06-30 09:29:51 +00:00
call_custom_function($server_id,'draw_server_tree');
2009-06-30 08:05:37 +00:00
}
}
2009-06-30 10:26:08 +00:00
echo '</body></html>';
2009-06-30 08:05:37 +00:00
?>