File: index.php3

package info (click to toggle)
openldap2 2.0.23-6.3
  • links: PTS
  • area: main
  • in suites: woody
  • size: 7,816 kB
  • ctags: 6,366
  • sloc: ansic: 86,391; sh: 9,816; makefile: 1,270; cpp: 1,107; sql: 838; php: 700; perl: 134; tcl: 40
file content (111 lines) | stat: -rw-r--r-- 3,517 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!DOCTYPE PUBLIC HTML "-//W3C//HTML3.2 Final//En">
<html>
<head>
	<!-- copyright, (C) Predrag Balorda, OpenLDAP Foundation, 1998,1999,2000 -->
	<title>PHP3 Thingy</title>
	<link rel="stylesheet" type="text/css" href="style.css">
</head>
<body>
<?
include ('include/preferences.inc');
include ('include/ldap_manager.inc');
include ('include/query_manager.inc');
include ('include/search_form.inc');
$FILE = "http://$HTTP_HOST$SCRIPT_NAME";
$JPEGFILE = "http://$HTTP_HOST/ldap/php3-tool/ldap-photo.php3";
$qm = new query_manager;
$lm = new ldap_manager;
$prefs = new preferences;

function main() {
	$main_start_time = microtime();
	global $lm, $qm, $prefs, $FILE;
	$qm = new query_manager;
	$lm = new ldap_manager;
	$prefs = new preferences;
	$lm->ldap_action = $qm->get_action();
	$lm->base_dn = $qm->get_base_dn();
	$lm->host = $qm->get_host();
	$lm->search_filter = $qm->get_search_filter();
	$prefs->loadPreferences();
	display_advanced_form();
	if (!$lm->connect($lm->host)) {
		echo "Couldn't connect to <b>".$lm->host."</b><br>\n";
		echo "Bye";
		return 0;
	}
	if (!$lm->ldapTakeAction($lm->ldap_action) || $lm->entriesCount == 0) {
		echo "Didn't find anything for ".$lm->ldap_action." on ".$lm->search_filter." from ".$lm->base_dn."<br>\n";
		return 0;
	}
	else {
	//	echo "I got <b>".$lm->entriesCount."</b> entries for ".$lm->ldap_action." on ".$lm->search_filter." from ".$lm->base_dn."<br>\n";
		$get_entries_s_t = microtime();
		$lm->getEntries();
		$get_entries_e_t = microtime();
	//	echo "Disconnecting from <b>".$lm->host."</b><br>\n";
		$lm->disconnect();
	}
	if (($qm->get_mode() == "tree") && ($lm->ldap_action == "list")) {
		$display_entries_s_t = microtime();
		?><table width="100%" border=1 cellpadding=0 cellspacing=0>
		<tr>
			<td bgcolor="#9380DB" align=center valign=absmiddle>
				<h3 class=head><?echo $lm->formatHTMLBaseDN($lm->base_dn);?></h3>
				</td>
			</tr>
		</table>
		<p>
		<script language="JavaScript" src="javascript/expandable-outlines.js">
		</script><?
		$tokens = array( 0 => " ", 1 => ",");
		$e = $lm->entries[0];
		$s = ldap_dn2ufn($e->dn);
		$firstel = $lm->stripString($s, $tokens);
		for ($i=0; $i<count($lm->entries); $i++) {
			$c = "";
			$e = $lm->entries[$i];
			$s = ldap_dn2ufn($e->dn);
			$tin = $lm->stripString($s, $tokens);
			?><div id="<? echo $tin; ?>Parent" class=parent>
			<h3 class=subsection>
			<a href="#" onClick="expandIt('<? echo $tin; ?>'); return false">
			<img name="imEx" src="false.gif" border=0 alt=""></a>
			<? $n = ldap_explode_dn($e->dn, 1); echo $n[0]; ?></h3>
			</div>
			<div id="<? echo $tin; ?>Child" class=child>
			<table border=1 cellspacing=0 cellpadding=0>
			<? $c .= $e->formatHTMLAttributes(); echo $c; ?>
			</table>
			<br>
			</div><?
		}
		?><script language="JavaScript"><!--
		if (NS4) {
			firstEl = "<? echo $firstel; ?>Parent";
			firstInd = getIndex(firstEl);
			showAll();
			arrange();
		}
		//--></script><?
	}
	else {
		$display_entries_s_t = microtime();
		$c = $lm->formatHTMLEntries();
		echo $c;
	}
	$display_entries_e_t = microtime();
//	echo "<div align=right valign=bottom>";
//	$t1 = $lm->calculateTime("getEntries()", $get_entries_s_t, $get_entries_e_t);
//	$t2 = $lm->calculateTime("displayEntries()", $display_entries_s_t, $display_entries_e_t);
//	$main_end_time = microtime();
//	$t3 = $lm->calculateTime("main()", $main_start_time, $main_end_time);
//	$t = $t3 - ($t1 + $t2);
//	echo "Ether : ".$t." seconds<br>\n";
//	echo "</div>";
	return 1;
}
$return = main();
?>
</body>
</html>