_, so if I wanted to scroll to * dc=example,dc=com for server 3, the URL would be: * tree.php#3_dc%3Dexample%2Cdc%3Dcom */ function draw_server_tree() { global $server_id; global $servers; global $lang; global $tree; global $tree_icons; // Does this server want mass deletion availble? if( mass_delete_enabled( $server_id ) ) { echo "
\n"; echo "\n"; } $server_name = $servers[$server_id]['name']; echo ''; echo '' . $lang['server'] . ''; echo ''; echo '' . htmlspecialchars( $server_name ) . ''; echo ''; // do we have what it takes to authenticate here, or do we need to // present the user with a login link (for 'cookie' and 'session' auth_types)? if( have_auth_info( $server_id ) ) { if( ! pla_ldap_connection_is_error( pla_ldap_connect( $server_id ), false ) ) { $schema_href = 'schema.php?server_id=' . $server_id . '" target="right_frame'; $search_href = 'search.php?server_id=' . $server_id . '" target="right_frame'; $refresh_href = 'refresh.php?server_id=' . $server_id; $create_href = 'create_form.php?server_id=' . $server_id . '&container=' . rawurlencode( $servers[$server_id]['base'] ); $logout_href = get_custom_file( $server_id, 'logout.php') . '?server_id=' . $server_id; $info_href = 'server_info.php?server_id=' . $server_id; $import_href = 'ldif_import_form.php?server_id=' . $server_id; $export_href = 'export_form.php?server_id=' . $server_id; // Draw the quick-links below the server name: // ( schema | search | refresh | create ) echo ''; echo ''; echo '( '; echo '' . $lang['schema'] . ' | '; echo '' . $lang['search'] . ' | '; echo '' . $lang['refresh'] . ' | '; if (show_create_enabled($server_id)) echo '' . $lang['create'] . ' | '; echo '' . $lang['info'] . ' | '; echo '' . $lang['import'] . ' | '; echo '' . $lang['export_lcase'] . ''; if( $servers[ $server_id ][ 'auth_type' ] != 'config' ) echo ' | ' . $lang['logout'] . ''; echo ' )'; if( $servers[$server_id]['auth_type'] != 'config' ) { $logged_in_dn = get_logged_in_dn( $server_id ); echo "" . $lang['logged_in_as']; if( strcasecmp( "anonymous", $logged_in_dn ) ) echo "" . pretty_print_dn( $logged_in_dn ) . ""; else echo "Anonymous"; echo ""; } if( is_server_read_only( $server_id ) ) echo "" . "(" . $lang['read_only'] . ")"; // Fetch and display the base DN for this server if( null == $servers[ $server_id ]['base'] ) $base_dn = try_to_get_root_dn( $server_id ); else $base_dn = $servers[ $server_id ]['base']; // Did we get a base_dn for this server somehow? if( $base_dn ) { echo "\n\n\n\n"; // is the root of the tree expanded already? if( isset( $tree[$server_id][$base_dn] ) ) { $expand_href = "collapse.php?server_id=$server_id&" . "dn=" . rawurlencode( $base_dn ); $expand_img = "images/minus.png"; $expand_alt = "-"; $child_count = number_format( count( $tree[$server_id][$base_dn] ) ); } else { // Check if the LDAP server is not yet initialized // (ie, the base DN configured in config.php does not exist) if( ! dn_exists( $server_id, $base_dn ) ) { $create_base_href = "creation_template.php?template=custom&server_id=$server_id"; ?>
$limit ) $child_count = $limit . '+'; } } } $edit_href = "edit.php?server_id=$server_id&dn=" . rawurlencode( $base_dn ); $icon = isset( $tree_icons[ $server_id ][ $base_dn ] ) ? $tree_icons[ $server_id ][ $base_dn ] : get_icon( $server_id, $base_dn ); // Shall we draw the "mass-delete" checkbox? if( mass_delete_enabled( $server_id ) ) { echo "\n"; } echo ""; echo "\"$expand_alt\""; echo ""; echo "\"img\"\n"; echo "" . pretty_print_dn( $base_dn ) . ''; if( $child_count ) echo " ($child_count)"; echo "\n"; echo "\n"; if( show_create_enabled( $server_id ) && isset( $tree[ $server_id ][ $base_dn ]) && count( $tree[ $server_id ][ $base_dn ] ) > 10 ) draw_create_link( $server_id, $base_dn, -1, urlencode( $base_dn )); } else { // end if( $base_dn ) if( "" === $base_dn || null === $base_dn ) { // The server refuses to give out the base dn echo ""; echo $lang['could_not_determine_root']; echo '
'; echo $lang['ldap_refuses_to_give_root']; echo '
'; echo $lang['please_specify_in_config']; echo "
"; // Proceed to the next server. We cannot draw anything else for this server. return; } else { // For some unknown reason, we couldn't determine the base dn echo ""; echo $lang['could_not_determine_root']; echo '
'; echo $lang['please_specify_in_config']; echo "
"; // Proceed to the next server. We cannot draw anything else for this server. return; } } flush(); // Is the root of the tree expanded already? if( isset( $tree[$server_id][$base_dn] ) && is_array( $tree[$server_id][$base_dn] ) ) { foreach( $tree[ $server_id ][ $base_dn ] as $child_dn ) draw_tree_html( $child_dn, $server_id, 0 ); if( ! is_server_read_only( $server_id ) ) { echo ''; if( show_create_enabled( $server_id ) ) { echo '' . 
							$lang['new'] . ''; echo '' . $lang['create_new'] . ''; } } } } else { // end if( pla_ldap_connect( $ds ) ) // could not connect to LDAP server echo "\n"; echo "\n"; echo "\""\n"; echo "" . $lang['could_not_connect'] . "\n"; echo "\n"; if( $servers[ $server_id ][ 'auth_type' ] != 'config' ) { $logout_href = get_custom_file( $server_id, 'logout.php') . '?server_id=' . $server_id; echo "\n"; echo "\n"; echo "\n"; echo ""; echo "" . $lang['logout'] . "\n"; echo "\n"; } // Proceed to the next server in the list. We cannot do anything mroe here. return; } } else { // end if have_auth_info( $server_id ) // We don't have enough information to login to this server // Draw the "login..." link $login_href = get_custom_file( $server_id, 'login_form.php' ) . "?server_id=$server_id"; echo ''; echo ''; echo ''; echo '' . $lang['login'] . ''; echo '' . $lang['login_link'] . ''; echo ''; } if( mass_delete_enabled( $server_id ) ) { echo "\n"; echo "\n"; echo "\n"; } } ?>