_, 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() { if (DEBUG_ENABLED) debug_log('draw_server_tree(): Entered with ()',2); global $lang; global $tree; global $tree_icons; global $ldapserver; global $recently_timed_out_servers; global $config; $server_id = $ldapserver->server_id; // Does this server want mass deletion availble? if ($ldapserver->isMassDeleteEnabled()) { print '
'; printf('',$ldapserver->server_id); } print ''; printf('%s',$lang['server']); printf('',$ldapserver->server_id); printf('%s ',htmlspecialchars($ldapserver->name)); if ($ldapserver->haveAuthInfo() && $ldapserver->session_timeout) printf('timeout', sprintf($lang['timeout_at'],strftime('%H:%M',time()+($ldapserver->session_timeout*60)))); print ''; // 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 ($ldapserver->haveAuthInfo()) { if ($ldapserver->connect(false)) { $schema_href = sprintf('schema.php?server_id=%s" target="right_frame',$ldapserver->server_id); $search_href = sprintf('search.php?server_id=%s" target="right_frame',$ldapserver->server_id); $refresh_href = sprintf('refresh.php?server_id=%s',$ldapserver->server_id); $logout_href = get_custom_file($ldapserver->server_id,'logout.php','').'?server_id='.$ldapserver->server_id; $info_href = sprintf('server_info.php?server_id=%s',$ldapserver->server_id); $import_href = sprintf('ldif_import_form.php?server_id=%s',$ldapserver->server_id); $export_href = sprintf('export_form.php?server_id=%s',$ldapserver->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 ($ldapserver->isShowCreateEnabled()) // echo '' . $lang['create'] . ' | '; echo '' . $lang['info'] . ' | '; echo '' . $lang['import'] . ' | '; echo '' . $lang['export_lcase'] . ''; if( $ldapserver->auth_type != 'config' ) echo ' | ' . $lang['logout'] . ''; echo ' )'; if ($ldapserver->auth_type != 'config') { $logged_in_dn = get_logged_in_dn( $ldapserver ); echo "" . $lang['logged_in_as']; if (dn_get_base($ldapserver,$logged_in_dn) == $logged_in_dn) { $logged_in_branch = ''; $logged_in_dn_array = array(); } else { $logged_in_branch = preg_replace("/,".dn_get_base($ldapserver,$logged_in_dn)."$/","",$logged_in_dn); $logged_in_dn_array = explode(',',$logged_in_branch); } $logged_in_dn_array[] = dn_get_base($ldapserver,$logged_in_dn); $rdn = $logged_in_dn; if (strcasecmp("anonymous",$logged_in_dn)) { foreach ($logged_in_dn_array as $rdn_piece) { printf('%s', $server_id,rawurlencode($rdn),pretty_print_dn($rdn_piece)); if ($rdn_piece != end($logged_in_dn_array)) echo ','; $rdn = substr($rdn,(1 + strpos($rdn,','))); } } else echo "Anonymous"; echo ""; } if( $ldapserver->isReadOnly() ) echo "" . "(" . $lang['read_only'] . ")"; $javascript_forms = ''; $javascript_id = 0; foreach ($ldapserver->getBaseDN() as $base_dn) { // 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[$ldapserver->server_id][$base_dn] ) ) { $expand_href = sprintf('collapse.php?server_id=%s&dn=%s', $ldapserver->server_id,rawurlencode( $base_dn )); $expand_img = "images/minus.png"; $expand_alt = "-"; $child_count = number_format( count( $tree[$ldapserver->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( $ldapserver, $base_dn ) ) { $javascript_id++; ?> ',$javascript_id); $javascript_forms .= sprintf(''); $javascript_forms .= sprintf('',$ldapserver->server_id); $javascript_forms .= sprintf(''); $javascript_forms .= sprintf('',htmlspecialchars($base_dn)); $javascript_forms .= sprintf('
'); ?> server_id,rawurlencode( $base_dn )); $expand_img = "images/plus.png"; $expand_alt = "+"; $size_limit = $config->GetValue('search','size_limit'); if( $ldapserver->isLowBandwidth() ) { $child_count = null; } else { $child_count = count( get_container_contents( $ldapserver, $base_dn, $size_limit+1, '(objectClass=*)', $config->GetValue('deref','tree') ) ); if( $child_count > $size_limit ) $child_count = $size_limit . '+'; } } } $create_href = sprintf('create_form.php?server_id=%s&container=%s',$ldapserver->server_id, rawurlencode( $base_dn )); $edit_href = sprintf("edit.php?server_id=%s&dn=%s",$ldapserver->server_id,rawurlencode( $base_dn )); $icon = isset( $tree_icons[ $ldapserver->server_id ][ $base_dn ] ) ? $tree_icons[ $ldapserver->server_id ][ $base_dn ] : get_icon( $ldapserver, $base_dn ); // Shall we draw the "mass-delete" checkbox? if( $ldapserver->isMassDeleteEnabled() ) { 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( $ldapserver->isShowCreateEnabled() && isset( $tree[ $ldapserver->server_id ][ $base_dn ]) && count( $tree[ $ldapserver->server_id ][ $base_dn ] ) > 10 ) draw_create_link( $ldapserver->server_id, $base_dn, -1, urlencode( $base_dn )); } else { // end if( $base_dn ) # The server refuses to give out the base dn printf('%s
%s
%s
', $lang['could_not_determine_root'],$lang['ldap_refuses_to_give_root'],$lang['please_specify_in_config']); # Proceed to the next server. We cannot draw anything else for this server. continue; } flush(); // Is the root of the tree expanded already? if( isset( $tree[$ldapserver->server_id][$base_dn] ) && is_array( $tree[$ldapserver->server_id][$base_dn] ) ) { foreach( $tree[ $ldapserver->server_id ][ $base_dn ] as $child_dn ) draw_tree_html( $child_dn, $ldapserver, 0 ); if( ! $ldapserver->isReadOnly() ) { echo ''; if( $ldapserver->isShowCreateEnabled() ) { echo '' .
								$lang['new'] . ''; echo '' . $lang['create_new'] . ''; } } } } } else { // end if( $ldapserver->connect(false) ) // could not connect to LDAP server echo "\n"; echo "\n"; echo "\""\n"; echo "" . $lang['could_not_connect'] . "\n"; echo "\n"; if( $ldapserver->auth_type != 'config' ) { $logout_href = get_custom_file( $ldapserver->server_id, 'logout.php','') . '?server_id=' . $ldapserver->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 $ldapserver->haveAuthInfo() // We don't have enough information to login to this server // Draw the "login..." link $login_href = get_custom_file( $ldapserver->server_id, 'login_form.php','' ) . "?server_id=$server_id"; echo ''; echo ''; echo ''; echo '' . $lang['login'] . ''; echo '' . $lang['login_link'] . ''; echo ''; // If the server recently timed out display the message if ( in_array($ldapserver->server_id,$recently_timed_out_servers) ) echo '' . $lang['session_timed_out_tree'] . ''; } if( $ldapserver->isMassDeleteEnabled() ) { echo "\n"; echo "\n"; echo "\n"; } if (isset($javascript_forms) && $javascript_forms) { echo "\n"; echo $javascript_forms; echo "\n"; } } ?>