steffen: server/kolab/kolab/admin/maintainer create_maintainer.php, 1.8, 1.9 index.php, 1.7, 1.8
cvs at intevation.de
cvs at intevation.de
Fri Apr 16 12:17:31 CEST 2004
- Previous message: steffen: server/kolab/kolab/admin/login head.php, 1.6, 1.7 index.php, 1.9, 1.10
- Next message: steffen: server/kolab/kolab/admin/include auth.class.php, NONE, 1.1 authenticate.php, NONE, 1.1 debug.php, NONE, 1.1 form.class.php, NONE, 1.1 ldap.class.php, NONE, 1.1 login.php, NONE, 1.1 headfoot.php, 1.11, 1.12 kolab.css, 1.3, 1.4 ldap_utils.php, 1.4, 1.5 preferences.php, 1.2, 1.3 session_vars.php, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Author: steffen
Update of /kolabrepository/server/kolab/kolab/admin/maintainer
In directory doto:/tmp/cvs-serv22487/admin/maintainer
Modified Files:
create_maintainer.php index.php
Log Message:
Started restructuring the webinterface. New classes:
KolabLdap: Class for accessing the ldap server, API not fully evolved yet
KolabAuth: Class for authenticating a user using the LDAP class
KolabForm: HTML form handling class. This is supposed to replace the many
long input forms in the webinterface. Currently it is only used in
user/ and some error-handling is missing
Index: create_maintainer.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/maintainer/create_maintainer.php,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- create_maintainer.php 28 Nov 2003 02:01:04 -0000 1.8
+++ create_maintainer.php 16 Apr 2004 10:17:28 -0000 1.9
@@ -5,14 +5,12 @@
This program is Free Software under the GNU General Public License (>=v2).
Read the file COPYING that comes with this packages for details.
*/
- include("head.php");
- This("maintainer/create_maintainer.php?action=create");
- Head();
- include("../include/checks.php");
-?>
-
+require_once('../include/authenticate.php');
+include("head.php");
+This("maintainer/create_maintainer.php?action=create");
+Head();
+include("../include/checks.php");
-<?
function debug ($a) {
// print "debug: $a<br>\n";
}
@@ -30,10 +28,11 @@
$dn="";
if (!empty($HTTP_GET_VARS['dn'])) $dn = trim(urldecode($HTTP_GET_VARS['dn']));
-if (!($uid = $_SERVER['PHP_AUTH_USER']) ||
- !($bind_dn = uid2dn($uid)) ||
- !($group = uid2group($uid)))
- array_push($errors, "Internal Error: could not get Authentication Information");
+// user authentication
+$uid = $auth->uid();
+$bind_dn = $auth->dn();
+$group = $auth->group();
+$link = $ldap->connection;
if (!$errors && $group != "admin")
array_push($errors, "Error: You don't have the required Permissions");
@@ -42,50 +41,8 @@
$myself = $_SERVER['PHP_SELF'];
-if (!empty($_SESSION['ldap_server'])) $ldap_server = $_SESSION['ldap_server'];
- else $ldap_server = '127.0.0.1';
-
-if (!empty($_SESSION['ldap_port'])) $ldap_port = $_SESSION['ldap_port'];
- else $ldap_port = 389;
-
$attributes = array ( 'cn', 'sn', 'uid', 'userPassword');
-$utf8 = array ( 'sn', 'cn' );
-
-function to_utf8 ($a)
-{
- global $utf8;
- global $attributes;
- foreach ($attributes as $attr) {
- if (!in_array($attr,$utf8) || empty($a[$attr])) continue;
- if (is_array($a[$attr])) {
- $index = 0;
- while (!empty($a[$attr][$index])) {
- $a[$attr][$index] = utf8_encode($a[$attr][$index]);
- $index++;
- }
- } elseif (!empty($a[$attr])) $a[$attr] = utf8_encode($a[$attr]);
- }
- return $a;
-}
-
-function from_utf8 ($a)
-{
- global $utf8;
- global $attributes;
- foreach ($attributes as $attr) {
- if (!in_array($attr,$utf8) || empty($a[$attr])) continue;
- if (is_array($a[$attr])) {
- $index = 0;
- while (!empty($a[$attr][$index])) {
- $a[$attr][$index] = utf8_decode($a[$attr][$index]);
- $index++;
- }
- } elseif (!empty($a[$attr])) $a[$attr] = utf8_decode($a[$attr]);
- }
- return $a;
-}
-
$beautify = array (
'sn' => 'Surname', 'uid' => 'Unique UserID', 'userPassword' => 'Password',
'firstname' => 'First Name', 'lastname' => 'Last Name');
@@ -148,9 +105,6 @@
$password_0 = "";
$password_1 = "";
-if (!$errors && (!($link = ldap_connect($ldap_server,$ldap_port)) ||
- !ldap_bind($link, $bind_dn, $_SERVER["PHP_AUTH_PW"])))
- array_push($errors, "Communication Error: could not query ldap://$ldap_server:$ldap_port ".ldap_error($link));
if (!$errors) {
$oldmemberline = array();
@@ -173,9 +127,9 @@
if (!$errors) {
print("<div class=\"maintitle\"> Delete Maintainer </div>\n");
if (!(ldap_delete($link,$dn)))
- array_push($errors, "LDAP Error: could delete ".utf8_decode($dn)." ".ldap_error($link));
+ array_push($errors, "LDAP Error: could delete ".$dn." ".ldap_error($link));
else {
- print("<div class=\"message\"> The object ".utf8_decode($dn)." is deleted </div>\n");
+ print("<div class=\"message\"> The object ".$dn." is deleted </div>\n");
if (!ldap_mod_del($link, "cn=maintainer,".$_SESSION['base_dn'], $oldmemberline))
array_push($errors, "LDAP Error: could not update maintainer group ".ldap_error($link));
}
@@ -228,7 +182,6 @@
missing_input();
}
- $ldap_object = to_utf8($ldap_object);
if (!empty($ldap_object['uid']) && !is_unique('uid', $ldap_object['uid'])) {
$comment['uid'] = "<span class=\"warning\"> Error: This uid is already taken by another user </span>";
missing_input();
@@ -245,26 +198,25 @@
($oldattrs=ldap_get_attributes($link,$entry))) {
$ldap_object['uid'] = $oldattrs['uid'][0];
if (!ldap_add($link,$newdn, $ldap_object) || !ldap_delete($link,$dn))
- array_push($errors, "LDAP Error: could not rename ".utf8_decode($dn).
- " to ".utf8_decode($newdn)." ".ldap_error($link));
+ array_push($errors, "LDAP Error: could not rename ".$dn.
+ " to ".$newdn." ".ldap_error($link));
$dn = $newdn;
- } else array_push($errors,"LDAP Error: could not read ".utf8_decode($dn)." ".ldap_error($link));
+ } else array_push($errors,"LDAP Error: could not read ".$dn." ".ldap_error($link));
} else {
$ldap_object = fill_up($ldap_object);
if (!ldap_modify($link, $dn, $ldap_object))
- array_push($errors, "LDAP Error: could not modify object ".utf8_decode($dn)." ".ldap_error($link));
+ array_push($errors, "LDAP Error: could not modify object ".$dn." ".ldap_error($link));
}
}
} else {
if (!$errors) {
$dn = "cn=".$ldap_object['cn'].",".$_SESSION['base_dn'];
if ($dn && !ldap_add($link, $dn, $ldap_object))
- array_push($errors, "LDAP Error: could not add object ".utf8_decode($dn)." ".ldap_error($link));
+ array_push($errors, "LDAP Error: could not add object ".$dn." ".ldap_error($link));
}
if ($errors) {
$action = "create";
print("<div class=\"maintitle\"> Create New Maintainer </div>\n");
- $ldap_object = from_utf8($ldap_object);
break;
}
}
@@ -294,7 +246,6 @@
($entry = ldap_first_entry($link,$result)) &&
($ldap_object = ldap_get_attributes($link,$entry))) {
//$myentry = array_merge_recursive($myentry, $attrs);
- $ldap_object = from_utf8($ldap_object);
$ldap_object = fill_up($ldap_object);
ldap_free_result($result);
}
Index: index.php
===================================================================
RCS file: /kolabrepository/server/kolab/kolab/admin/maintainer/index.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- index.php 14 Jun 2003 13:25:53 -0000 1.7
+++ index.php 16 Apr 2004 10:17:28 -0000 1.8
@@ -5,19 +5,22 @@
This program is Free Software under the GNU General Public License (>=v2).
Read the file COPYING that comes with this packages for details.
*/
- include("head.php");
- This("maintainer/");
- Head();
-
-$utf8 = array ( 'cn', 'sn' );
+require_once('../include/authenticate.php');
+include("head.php");
+This("maintainer/");
+Head();
$errors = array();
-// check user authentication
-if (!($uid = $_SERVER["PHP_AUTH_USER"]) ||
- !($bind_dn = uid2dn($uid)) ||
- !($group = uid2group($uid)))
- array_push($errors, "Internal Error: could not get Authentication Information");
+function debug( $str ) {
+ //print "DEBUG: $str";
+}
+
+// user authentication
+$uid = $auth->uid();
+$bind_dn = $auth->dn();
+$group = $auth->group();
+$link = $ldap->connection;
if (isset($_SESSION['base_dn'])) $base_dn = $_SESSION['base_dn'];
else $base_dn = 'k=kolab' ;
@@ -33,194 +36,185 @@
$myself = $_SERVER['PHP_SELF'];
-if (isset($_SESSION['ldap_server'])) $ldap_server = $_SESSION['ldap_server'];
- else $ldap_server = '127.0.0.1';
-
-if (isset($_SESSION['ldap_port'])) $ldap_port = $_SESSION['ldap_port'];
- else $ldap_port = 389;
-
-if (!$errors && !($link = ldap_connect($ldap_server,$ldap_port)) || !ldap_bind($link))
- array_push($errors, "Communication Error: could not query ldap://$ldap_server:$ldap_port ".ldap_error($link));
-
-
// get all entries & dynamically split the letters with growing entries
- $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(sn=*))";
- $result = ldap_search($link, $base_dn, $filter);
+$filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(sn=*))";
+$result = ldap_search($link, $base_dn, $filter);
- // counting all entries
- if ($result) {
- ldap_sort($link,$result,'sn');
- $entry = ldap_first_entry($link, $result);
- $entries = 0;
- while ($entry) {
- $dn = ldap_get_dn($link,$entry);
- $attrs = ldap_get_attributes($link, $entry);
- $userid = $attrs['uid'][0];
- $gid = uid2group($userid);
- if ($gid == "maintainer") {
- $entries++;
- }
- $entry = ldap_next_entry($link, $entry);
- }
- ldap_free_result($result);
- } else array_push($errors, "Communication Error: ldap server did not answer query for user information");
+// counting all entries
+if ($result) {
+ ldap_sort($link,$result,'sn');
+ $entry = ldap_first_entry($link, $result);
+ $entries = 0;
+ while ($entry) {
+ $dn = ldap_get_dn($link,$entry);
+ $attrs = ldap_get_attributes($link, $entry);
+ $userid = $attrs['uid'][0];
+ $gid = $ldap->groupForUid($userid);
+ if ($gid == "maintainer") {
+ debug("Found maintainer $dn");
+ $entries++;
+ }
+ $entry = ldap_next_entry($link, $entry);
+ }
+ ldap_free_result($result);
+} else array_push($errors, "Communication Error: ldap server did not answer query for user information");
if (!$errors) {
- printf("<div class=\"maintitle\">Manage Maintainers (%s Maintainers)</div>", $entries);
- // if there are more than 2000 entries, split in 26 categories for every letter
- if ($entries > 2000) {
- print("<div class=\"alphabetlisting\"><form method=\"POST\" action=\"$myself\">\n\n");
- for ($i = 65; $i < 91; $i++) {
- printf("<a href=\"$myself?alphaselect=[%s]\"> [%s] </a>", chr($i), chr($i));
- }
- $text="[all]";
- print("<a href=\"$myself?alphaselect=$text\"> $text </a>\n");
- print("</form></div>\n");
-
- for ($i = 65; $i < 91; $i++) {
- switch ($alphaselect) {
- case "[".chr($i)."]":
- $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(|(sn=".chr($i)."*)(sn=".chr($i+32)."*)";
- if ($i == 65) {
- if (in_array('sn', $utf8)) $filter = $filter."(sn=".utf8_encode("Ä")."*)(sn=".utf8_encode("ä")."*)"; }
- if ($i == 79) {
- if (in_array('sn', $utf8)) $filter = $filter."(sn=".utf8_encode("Ö")."*)(sn=".utf8_encode("ö")."*)"; }
- if ($i == 85) {
- if (in_array('sn', $utf8)) $filter = $filter."(sn=".utf8_encode("Ü")."*)(sn=".utf8_encode("ü")."*)"; }
- $filter = $filter."))";
- break;
- }
- }
- }
- // if there are more than 50 entries, split in four categories
- elseif ($entries > 50) {
- print("<div class=\"alphabetlisting\"><form method=\"POST\" action=\"$myself\">\n\n");
- $text="[A-F]";
- print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
- $text="[G-L]";
- print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
- $text="[M-S]";
- print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
- $text="[T-Z]";
- print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
- $text="[all]";
- print("<a href=\"$myself?alphaselect=$text\"> $text </a>\n");
- print("</form></div>\n");
-
- switch ($alphaselect) {
- case "[A-F]":
- $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(|(sn=F*)(sn=E*)(sn=D*)(sn=C*)(sn=B*)(sn=A*)";
- $filter = $filter."(sn=f*)(sn=e*)(sn=d*)(sn=c*)(sn=b*)(sn=a*)";
- if (in_array('sn', $utf8)) $filter = $filter."(sn=".utf8_encode("AÄ")."*)(sn=".utf8_encode("Aä")."*)";
- $filter = $filter."))";
- break;
- case "[G-L]":
- $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(|(sn=G*)(sn=H*)(sn=I*)(sn=J*)(sn=K*)(sn=L*)";
- $filter = $filter."(sn=g*)(sn=h*)(sn=i*)(sn=j*)(sn=k*)(sn=l*)))";
- break;
- case "[M-S]":
- $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(|(sn=M*)(sn=N*)(sn=O*)(sn=P*)(sn=Q*)(sn=R*)(sn=S*)";
- $filter = $filter."(sn=m*)(sn=n*)(sn=o*)(sn=p*)(sn=q*)(sn=r*)(sn=s*)";
- if (in_array('sn', $utf8)) $filter = $filter."(sn=".utf8_encode("AÖ")."*)(sn=".utf8_encode("Aö")."*)".
- "(sn=".utf8_encode("AÜ")."*)(sn=".utf8_encode("Aü")."*)";
- $filter = $filter."))";
- break;
- case "[T-Z]":
- $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(|(sn=T*)(sn=U*)(sn=V*)(sn=W*)(sn=X*)(sn=Y*)(sn=Z*)";
- $filter = $filter."(sn=t*)(sn=u*)(sn=v*)(sn=w*)(sn=x*)(sn=y*)(sn=z*)))";
- break;
- default:
- $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(sn=*))";
- break;
- }
-
- }
- // if there are less than 50 entries, all entries are shown - w/o options
- else { echo "<div class=\"alphabetlisting\"></div>\n"; $alphaselect = "[all]"; $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(sn=*))"; }
-
+ printf("<div class=\"maintitle\">Manage Maintainers (%s Maintainers)</div>", $entries);
+ // if there are more than 2000 entries, split in 26 categories for every letter
+ if ($entries > 2000) {
+ print("<div class=\"alphabetlisting\"><form method=\"POST\" action=\"$myself\">\n\n");
+ for ($i = 65; $i < 91; $i++) {
+ printf("<a href=\"$myself?alphaselect=[%s]\"> [%s] </a>", chr($i), chr($i));
+ }
+ $text="[all]";
+ print("<a href=\"$myself?alphaselect=$text\"> $text </a>\n");
+ print("</form></div>\n");
+
+ for ($i = 65; $i < 91; $i++) {
+ switch ($alphaselect) {
+ case "[".chr($i)."]":
+ $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(|(sn=".chr($i)."*)(sn=".chr($i+32)."*)";
+ if ($i == 65) {
+ $filter = $filter."(sn=".utf8_encode("Ä")."*)(sn=".utf8_encode("ä")."*)"; }
+ if ($i == 79) {
+ $filter = $filter."(sn=".utf8_encode("Ö")."*)(sn=".utf8_encode("ö")."*)"; }
+ if ($i == 85) {
+ $filter = $filter."(sn=".utf8_encode("Ü")."*)(sn=".utf8_encode("ü")."*)"; }
+ $filter = $filter."))";
+ break;
+ }
+ }
+ }
+ // if there are more than 50 entries, split in four categories
+ elseif ($entries > 50) {
+ print("<div class=\"alphabetlisting\"><form method=\"POST\" action=\"$myself\">\n\n");
+ $text="[A-F]";
+ print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
+ $text="[G-L]";
+ print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
+ $text="[M-S]";
+ print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
+ $text="[T-Z]";
+ print("<a href=\"$myself?alphaselect=$text\"> $text </a>");
+ $text="[all]";
+ print("<a href=\"$myself?alphaselect=$text\"> $text </a>\n");
+ print("</form></div>\n");
+
+ switch ($alphaselect) {
+ case "[A-F]":
+ $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(|(sn=F*)(sn=E*)(sn=D*)(sn=C*)(sn=B*)(sn=A*)";
+ $filter = $filter."(sn=f*)(sn=e*)(sn=d*)(sn=c*)(sn=b*)(sn=a*)";
+ $filter = $filter."(sn=".utf8_encode("AÄ")."*)(sn=".utf8_encode("Aä")."*)";
+ $filter = $filter."))";
+ break;
+ case "[G-L]":
+ $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(|(sn=G*)(sn=H*)(sn=I*)(sn=J*)(sn=K*)(sn=L*)";
+ $filter = $filter."(sn=g*)(sn=h*)(sn=i*)(sn=j*)(sn=k*)(sn=l*)))";
+ break;
+ case "[M-S]":
+ $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(|(sn=M*)(sn=N*)(sn=O*)(sn=P*)(sn=Q*)(sn=R*)(sn=S*)";
+ $filter = $filter."(sn=m*)(sn=n*)(sn=o*)(sn=p*)(sn=q*)(sn=r*)(sn=s*)";
+ $filter = $filter."(sn=".utf8_encode("AÖ")."*)(sn=".utf8_encode("Aö")."*)".
+ "(sn=".utf8_encode("AÜ")."*)(sn=".utf8_encode("Aü")."*)";
+ $filter = $filter."))";
+ break;
+ case "[T-Z]":
+ $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(|(sn=T*)(sn=U*)(sn=V*)(sn=W*)(sn=X*)(sn=Y*)(sn=Z*)";
+ $filter = $filter."(sn=t*)(sn=u*)(sn=v*)(sn=w*)(sn=x*)(sn=y*)(sn=z*)))";
+ break;
+ default:
+ $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(sn=*))";
+ break;
+ }
+
+ }
+ // if there are less than 50 entries, all entries are shown - w/o options
+ else { echo "<div class=\"alphabetlisting\"></div>\n"; $alphaselect = "[all]"; $filter = "(&(cn=*)(objectclass=inetOrgPerson)(uid=*)(sn=*))"; }
+
}
if (!$errors) {
- $result = ldap_search($link, $base_dn, $filter);
- $entries = 0;
- ldap_sort($link,$result,'sn');
- $entry = ldap_first_entry($link, $result);
- while ($entry) {
- $dn = ldap_get_dn($link,$entry);
- $attrs = ldap_get_attributes($link, $entry);
- $userid = $attrs['uid'][0];
- $gid = uid2group($userid);
- if ($gid == "maintainer")
- $entries = $entries+1;
- $entry = ldap_next_entry($link, $entry);
+ debug("Searching with base $base_dn and filter $filter");
+ $result = ldap_search($link, $base_dn, $filter);
+ $entries = 0;
+ ldap_sort($link,$result,'sn');
+ $entry = ldap_first_entry($link, $result);
+ while ($entry) {
+ $dn = ldap_get_dn($link,$entry);
+ $attrs = ldap_get_attributes($link, $entry);
+ $userid = $attrs['uid'][0];
+ $gid = $ldap->groupForUid($userid);
+ if ($gid == "maintainer")
+ $entries++;
+ $entry = ldap_next_entry($link, $entry);
+ }
+ debug("Found $entries entries");
+ ldap_free_result($result);
+ $result = ldap_search($link, $base_dn, $filter);
+ // splitting into more than one page?
+ print("<div class=\"pagelisting\">");
+ $pages = ceil($entries / $views);
+ if ($pages > 1) {
+ for ($i = 1; $i < $pages; $i++) {
+ // the actual page won't be clickable
+ if ($page != $i)
+ printf(" <a href=\"index.php?alphaselect=%s&page=%s\">%s</a> |\n", $alphaselect, $i, $i);
+ else
+ printf(" %s |\n", $i);
}
- ldap_free_result($result);
- $result = ldap_search($link, $base_dn, $filter);
-// splitting into more than one page?
-print("<div class=\"pagelisting\">");
-$pages = ceil($entries / $views);
-if ($pages > 1) {
- for ($i = 1; $i < $pages; $i++) {
- // the actual page won't be clickable
- if ($page != $i)
- printf(" <a href=\"index.php?alphaselect=%s&page=%s\">%s</a> |\n", $alphaselect, $i, $i);
- else
- printf(" %s |\n", $i);
+ // last item w/o vertical dash
+ if ($page != $i)
+ printf(" <a href=\"index.php?alphaselect=%s&page=%s\">%s</a> \n", $alphaselect, $i, $i);
+ else
+ printf(" %s ", $i);
+ }
+ print("</div>");
+
+ if ($result) {
+ print("<div class=\"contenttable\">");
+ print("<TABLE class=\"content\" nosave>\n");
+ ldap_sort($link,$result,'sn');
+ $entry = ldap_first_entry($link, $result);
+ $first=0;
+ while ($entry) {
+ $dn = ldap_get_dn($link,$entry);
+ $attrs = ldap_get_attributes($link, $entry);
+ $userid = $attrs['uid'][0];
+ $sn = $attrs['sn'][0];
+ $cn = $attrs['cn'][0];
+ $a = strlen($sn);
+ $b = strlen($cn);
+ $fn = substr($cn, 0, $b - $a);
+ $gid = $ldap->groupForUid($userid);
+ $skip = 0;
+ if ($gid == "maintainer") {
+ // skipping to correct page and start with first entry
+ if ($skip < ($page-1)*$views) {
+ $entry = ldap_next_entry($link, $entry);
}
- // last item w/o vertical dash
- if ($page != $i)
- printf(" <a href=\"index.php?alphaselect=%s&page=%s\">%s</a> \n", $alphaselect, $i, $i);
- else
- printf(" %s ", $i);
-}
-print("</div>");
-
-if ($result) {
- print("<div class=\"contenttable\">");
- print("<TABLE class=\"content\" nosave>\n");
- ldap_sort($link,$result,'sn');
- $entry = ldap_first_entry($link, $result);
- $first=0;
- while ($entry) {
- $dn = ldap_get_dn($link,$entry);
- $attrs = ldap_get_attributes($link, $entry);
- $userid = $attrs['uid'][0];
- $sn = $attrs['sn'][0];
- if (in_array('sn', $utf8)) $sn = utf8_decode($sn);
- $cn = $attrs['cn'][0];
- if (in_array('cn', $utf8)) $cn = utf8_decode($cn);
- $a = strlen($sn);
- $b = strlen($cn);
- $fn = substr($cn, 0, $b - $a);
- $gid = uid2group($userid);
- if ($gid == "maintainer") {
- // skipping to correct page and start with first entry
- if ($skip <= ($page-1)*$views) {
- $entry = ldap_next_entry($link, $entry);
- }
- else {
- // counts the entries, which are already listed on this page and breaks on overflow
- if ($countentries < $views) {
- $userid = urlencode($userid);
- $dn = urlencode($dn);
- if ($first == 0) printf("<thead><td class=\"content\"> Name </td><td class=\"content\"> UID </td><td class=\"content\"> Action </td></thead>\n");
- $first++;
- printf("<tr><td class=\"content\"> %s, %s </td><td class=\"content\"> %s </td><td class=\"contentaction\">
+ else {
+ // counts the entries, which are already listed on this page and breaks on overflow
+ if ($countentries < $views) {
+ $userid = urlencode($userid);
+ $dn = urlencode($dn);
+ if ($first == 0) printf("<thead><td class=\"content\"> Name </td><td class=\"content\"> UID </td><td class=\"content\"> Action </td></thead>\n");
+ $first++;
+ printf("<tr><td class=\"content\"> %s, %s </td><td class=\"content\"> %s </td><td class=\"contentaction\">
<a href=\"create_maintainer.php?action=modify&dn=%s\"> [Modify]</a>
<a href=\"create_maintainer.php?action=delete&dn=%s\"> [Delete]</a>
- </td></tr>\n", $sn, $fn, $userid, $dn,$dn);
- }
- $countentries++;
- }
- }
- $skip++;
- $entry = ldap_next_entry($link, $entry);
+ </td></tr>\n", $sn, $fn, $usserid, $dn,$dn);
+ }
+ $countentries++;
+ }
}
- ldap_free_result($result);
- if ($first == 0) print("<tr><td class=\"nocontent\"> (No maintainers in the category $alphaselect) </td></tr>\n");
- ldap_close($link);
-} else array_push($errors, "Communication Error: ldap server did not answer query for user information");
-
+ $skip++;
+ $entry = ldap_next_entry($link, $entry);
+ }
+ ldap_free_result($result);
+ if ($first == 0) print("<tr><td class=\"nocontent\"> (No maintainers in the category $alphaselect) </td></tr>\n");
+ ldap_close($link);
+ } else array_push($errors, "Communication Error: ldap server did not answer query for user information");
}
print("</table>\n<div class=\"pagelisting\">");
- Previous message: steffen: server/kolab/kolab/admin/login head.php, 1.6, 1.7 index.php, 1.9, 1.10
- Next message: steffen: server/kolab/kolab/admin/include auth.class.php, NONE, 1.1 authenticate.php, NONE, 1.1 debug.php, NONE, 1.1 form.class.php, NONE, 1.1 ldap.class.php, NONE, 1.1 login.php, NONE, 1.1 headfoot.php, 1.11, 1.12 kolab.css, 1.3, 1.4 ldap_utils.php, 1.4, 1.5 preferences.php, 1.2, 1.3 session_vars.php, 1.1, 1.2
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the commits
mailing list