gunnar: server/php-kolab/Kolab_Webadmin/Webadmin auth.class.php, 1.1, 1.2 debug.php, 1.1, 1.2 form.class.php, 1.1, 1.2 ldap.class.php, 1.1, 1.2 locale.php, 1.1, 1.2 menu.php, 1.1, 1.2 passwd.php, 1.1, 1.2 authenticate.php, 1.1, NONE headers.php, 1.1, NONE

cvs at kolab.org cvs at kolab.org
Thu Aug 16 17:52:03 CEST 2007


Author: gunnar

Update of /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin
In directory doto:/tmp/cvs-serv17505/Kolab_Webadmin/Webadmin

Modified Files:
	auth.class.php debug.php form.class.php ldap.class.php 
	locale.php menu.php passwd.php 
Removed Files:
	authenticate.php headers.php 
Log Message:
Force Kolab_Webadmin to be a library.

Index: auth.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/auth.class.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- auth.class.php	16 Aug 2007 12:16:51 -0000	1.1
+++ auth.class.php	16 Aug 2007 15:52:01 -0000	1.2
@@ -1,30 +1,42 @@
 <?php
-/*
- *  Copyright (c) 2004 Klarälvdalens Datakonsult AB
+/*  
+ *  COPYRIGHT
+ *  ---------
  *
- *    Written by Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
+ *  See ../AUTHORS file
  *
- *  This  program is free  software; you can redistribute  it and/or
- *  modify it  under the terms of the GNU  General Public License as
- *  published by the  Free Software Foundation; either version 2, or
+ *
+ *  LICENSE
+ *  -------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
  *
- *  This program is  distributed in the hope that it will be useful,
- *  but WITHOUT  ANY WARRANTY; without even the  implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- *  General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  $Revision$
+ *
+ *  ABOUT
+ *  -----
+ *
+ *  A class for authenticating against the Kolab server.
  *
- *  You can view the  GNU General Public License, online, at the GNU
- *  Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
  */
 
-require_once('ldap.class.php');
 require_once('debug.php');
-//require_once('mysmarty.php');
-require_once('locale.php');
 
 class KolabAuth {
-    function KolabAuth( $do_auth = true, $params = array() ) {
+    function KolabAuth( $do_auth = true, $ldap, $params = array() ) {
+	    $this->ldap = $ldap;
 	    $this->params = $params;
 		if( isset( $_GET['logout'] ) || isset( $_POST['logout'] ) ) {
 			$this->logout();
@@ -34,50 +46,49 @@
 	}
 
 	function authenticate() {
-		global $ldap;
 		$this->error_string = false;
-		if( !isset( $ldap ) ) {
+		if( !isset( $this->ldap ) ) {
 			$this->error_string = _("Server error, no ldap object!");
 			return false;
 		}
 		// Anon. bind first
-		if( !$ldap->bind( $_SESSION['php_dn'],  $_SESSION['php_pw'] ) ) {
-			$this->error_string = _("Could not bind to LDAP server: ").$ldap->error();
+		if( !$this->ldap->bind( $this->params['php_dn'],  $this->params['php_pw'] ) ) {
+			$this->error_string = _("Could not bind to LDAP server: ").$this->ldap->error();
 			$this->gotoLoginPage(); 
 		}
 		if( $this->isAuthenticated() ) {
-			$bind_result = $ldap->bind( $_SESSION['auth_dn'], $_SESSION['auth_pw'] );
+			$bind_result = $this->ldap->bind( $this->params['auth_dn'], $this->params['auth_pw'] );
 		} else {
 			$bind_result = false;
 		}
 		if( !$bind_result ) {
 			// Anon. bind first
-			if( !$ldap->bind() ) {
+			if( !$this->ldap->bind() ) {
 				$this->error_string = _("Could not bind to LDAP server");
 				$this->gotoLoginPage(); 
 			}
 			// User not logged in, check login/password
 			if( isset( $_POST['username'] ) && isset( $_POST['password'] ) ) {
-				$dn = $ldap->dnForUid( $_POST['username'] );
+				$dn = $this->ldap->dnForUid( $_POST['username'] );
                 if (!$dn) {
-					$dn = $ldap->dnForMail( $_POST['username'] ); // try mail attribute
+					$dn = $this->ldap->dnForMail( $_POST['username'] ); // try mail attribute
 				}
 				if( $dn ) {
-					$auth_user = $ldap->uidForDn( $dn );
-					$auth_group = $ldap->groupForUid( $auth_user );
+					$auth_user = $this->ldap->uidForDn( $dn );
+					$auth_group = $this->ldap->groupForUid( $auth_user );
 					$tmp_group = ($auth_user=='manager')?'manager':$auth_group;
 					if( !in_array( $tmp_group, $this->params['allow_user_classes'] ) ) {
 						$this->error_string = _("User class '$tmp_group' is denied access");
 						$this->gotoLoginPage();					  
 					}
-					$bind_result = $ldap->bind( $dn, $_POST['password'] );
+					$bind_result = $this->ldap->bind( $dn, $_POST['password'] );
 					if( $bind_result ) {
 						// All OK!
-						$_SESSION['auth_dn'] = $dn;
-						$_SESSION['auth_user'] = $auth_user;
-						$_SESSION['auth_pw'] = $_POST['password'];
-						$_SESSION['auth_group'] = $auth_group;
-						$_SESSION['remote_ip'] = $_SERVER['REMOTE_ADDR'];
+						$this->params['auth_dn'] = $dn;
+						$this->params['auth_user'] = $auth_user;
+						$this->params['auth_pw'] = $_POST['password'];
+						$this->params['auth_group'] = $auth_group;
+						$this->params['remote_ip'] = $_SERVER['REMOTE_ADDR'];
 						return true;
 					} else {
 						$this->error_string = _("Wrong username or password");
@@ -117,48 +128,48 @@
 	}
 
 	// FIXME: This requires knowledge that should be external to this library
-	function gotoLoginPage() {
-		global $topdir;
-		$smarty =& new MySmarty();
-		$smarty->assign( 'topdir', $topdir );
-		$smarty->assign( 'uid', '' );
-		$smarty->assign( 'group', '' );
-		$smarty->assign( 'page_title', _('Login') );
-		$smarty->assign( 'menuitems', array() );
-		if( $this->error() ) $smarty->assign( 'errors', array( $this->error() ) );
-		$smarty->assign( 'maincontent', 'login.tpl' );
-		$smarty->display('page.tpl');
-		exit();
-	}
+// 	function gotoLoginPage() {
+// 		global $topdir;
+// 		$smarty =& new MySmarty();
+// 		$smarty->assign( 'topdir', $topdir );
+// 		$smarty->assign( 'uid', '' );
+// 		$smarty->assign( 'group', '' );
+// 		$smarty->assign( 'page_title', _('Login') );
+// 		$smarty->assign( 'menuitems', array() );
+// 		if( $this->error() ) $smarty->assign( 'errors', array( $this->error() ) );
+// 		$smarty->assign( 'maincontent', 'login.tpl' );
+// 		$smarty->display('page.tpl');
+// 		exit();
+// 	}
 
 	function isAuthenticated() {
-		return isset( $_SESSION['auth_dn'] ) && $_SESSION['remote_ip'] == $_SERVER['REMOTE_ADDR'];
+		return isset( $this->params['auth_dn'] ) && $this->params['remote_ip'] == $_SERVER['REMOTE_ADDR'];
 	}
 
 	function dn() {
-		if( $this->isAuthenticated() ) return $_SESSION['auth_dn'];
+		if( $this->isAuthenticated() ) return $this->params['auth_dn'];
 		else return false;
 	}
 
 	function uid() {
-		if( $this->isAuthenticated() ) return $_SESSION['auth_user'];
+		if( $this->isAuthenticated() ) return $this->params['auth_user'];
 		else return false;
 	}
 
 	function group() {
-		if( $this->isAuthenticated() ) return $_SESSION['auth_group'];
+		if( $this->isAuthenticated() ) return $this->params['auth_group'];
 	}
 
 	function password() {
 		if( $this->isAuthenticated() ) {
-			return $_SESSION['auth_pw'];
+			return $this->params['auth_pw'];
 		}
 		else return false;
 	}
 
-	function setDn( $dn ) {$_SESSION['auth_dn'] = $dn;}
-	function setUid( $uid ) {$_SESSION['auth_user'] = $uid;}
-	function setPassword( $pw ) {$_SESSION['auth_pw'] = $pw;}
+	function setDn( $dn ) {$this->params['auth_dn'] = $dn;}
+	function setUid( $uid ) {$this->params['auth_user'] = $uid;}
+	function setPassword( $pw ) {$this->params['auth_pw'] = $pw;}
 
 	function error() {
 		return $this->error_string;
@@ -170,7 +181,7 @@
 /*
   Local variables:
   mode: php
-  indent-tabs-mode: t
+  indent-tabs-mode: f
   tab-width: 4
   buffer-file-coding-system: utf-8
   End:

Index: debug.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/debug.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- debug.php	16 Aug 2007 12:16:51 -0000	1.1
+++ debug.php	16 Aug 2007 15:52:01 -0000	1.2
@@ -1,21 +1,35 @@
 <?php
-/*
- *  Copyright (c) 2004 Klarälvdalens Datakonsult AB
+/*  
+ *  COPYRIGHT
+ *  ---------
  *
- *    Written by Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
+ *  See ../AUTHORS file
  *
- *  This  program is free  software; you can redistribute  it and/or
- *  modify it  under the terms of the GNU  General Public License as
- *  published by the  Free Software Foundation; either version 2, or
+ *
+ *  LICENSE
+ *  -------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
  *
- *  This program is  distributed in the hope that it will be useful,
- *  but WITHOUT  ANY WARRANTY; without even the  implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- *  General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  $Revision$
+ *
+ *  ABOUT
+ *  -----
+ *
+ *  Debugging functions.
  *
- *  You can view the  GNU General Public License, online, at the GNU
- *  Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
  */
 
 function getmicrotime() { 

Index: form.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/form.class.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- form.class.php	16 Aug 2007 12:16:51 -0000	1.1
+++ form.class.php	16 Aug 2007 15:52:01 -0000	1.2
@@ -1,37 +1,57 @@
 <?php
-/*
- *  Copyright (c) 2004 Klarälvdalens Datakonsult AB
+/*  
+ *  COPYRIGHT
+ *  ---------
  *
- *    Writen by Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
+ *  See ../AUTHORS file
  *
- *  This  program is free  software; you can redistribute  it and/or
- *  modify it  under the terms of the GNU  General Public License as
- *  published by the  Free Software Foundation; either version 2, or
+ *
+ *  LICENSE
+ *  -------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
  *
- *  This program is  distributed in the hope that it will be useful,
- *  but WITHOUT  ANY WARRANTY; without even the  implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- *  General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  $Revision$
+ *
+ *  ABOUT
+ *  -----
+ *
+ *  Supporting functions for smarty forms
  *
- *  You can view the  GNU General Public License, online, at the GNU
- *  Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
  */
 
-require_once('mysmarty.php');
+require_once('smarty/Smarty.php');
 
-function checkuniquealias( $form, $key, $value ) {
-  global $ldap;
-  global $action;
-  global $dn;
+function output_headers()
+{
+    header("Content-Type: text/html; charset=UTF-8");
+    header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
+    header("Cache-Control: no-cache, must-revalidate");
+    header("Pragma: no-cache");
+}
+
+//FIXME: Does not work like this
+function checkuniquealias( $form, $key, $value, $ldap, $action, $dn, $base_dn ) {
   $excludedn = false;
   if( $action == 'save' ) $excludedn = trim($dn);
   $lst = array_unique( array_filter( array_map( 'trim', preg_split( '/\n/', $value ) ), 'strlen') );
   $str = '';
   foreach( $lst as $alias ) {
 	debug( "looking at $alias, exluding $dn" );
-	if( $ldap->countMail( $_SESSION['base_dn'], $alias, $excludedn ) > 0 ) {
-	  $str .= _('Email address ').MySmarty::htmlentities($alias)._(' collides with an address already used for another user, a vCard or a distribution list.<br />');
+	if( $ldap->countMail( $base_dn, $alias, $excludedn ) > 0 ) {
+	  $str .= _('Email address ').Smarty::htmlentities($alias)._(' collides with an address already used for another user, a vCard or a distribution list.<br />');
 	}
   }
   return $str;
@@ -135,12 +155,12 @@
 	$str .= '<tr>';
 	if( ereg( 'readonly', $value['attrs'] ) ) {
 	  $str .= '<td><label>'.$value['name'].'</label></td>';
-	  $str .= '<td><p class="ctrl">'.MySmarty::htmlentities($value['value']).'</p><input name="'
-	    .$key.'" type="hidden" value="'.MySmarty::htmlentities($value['value']).'" /></td>';
+	  $str .= '<td><p class="ctrl">'.Smarty::htmlentities($value['value']).'</p><input name="'
+	    .$key.'" type="hidden" value="'.Smarty::htmlentities($value['value']).'" /></td>';
 	} else {
 	  $str .= '<td><label for="'.$key.'">'.$value['name'].'</label></td>';
-	  $str .= '<td><input name="'.$key.'" id="'.$key.'" type="'.$value['type'].'" value="'.MySmarty::htmlentities($value['value']).'" '
-	    .MySmarty::htmlentities($value['attrs']).' size="'.$size.'" /></td>';
+	  $str .= '<td><input name="'.$key.'" id="'.$key.'" type="'.$value['type'].'" value="'.Smarty::htmlentities($value['value']).'" '
+	    .Smarty::htmlentities($value['attrs']).' size="'.$size.'" /></td>';
 	}
 	$str .= '<td>'.KolabForm::comment_helper($value).'</td>';
 	$str .= '</tr>'."\n";
@@ -154,22 +174,22 @@
 	  list($uname,$domain) = split('@',$value['value']);
 	}
 	if( ereg( 'readonly', $value['attrs'] ) ) {
-	  $str .= '<td><p class="ctrl">'.MySmarty::htmlentities($value['value']).'</p><input name="user_'.$key.'" type="hidden" value="'.
-	    MySmarty::htmlentities($uname).'" /><input name="domain_'.$key.'" type="hidden" value="'.
-	    MySmarty::htmlentities($domain).'" /></td>';
+	  $str .= '<td><p class="ctrl">'.Smarty::htmlentities($value['value']).'</p><input name="user_'.$key.'" type="hidden" value="'.
+	    Smarty::htmlentities($uname).'" /><input name="domain_'.$key.'" type="hidden" value="'.
+	    Smarty::htmlentities($domain).'" /></td>';
 	} else {
 	  $str .= '<td><label for="user_'.$key.'">'.$value['name'].'</label></td>';
-	  $str .= '<td><input name="user_'.$key.'" id="user_'.$key.'" type="text" value="'.MySmarty::htmlentities($uname).'" '
+	  $str .= '<td><input name="user_'.$key.'" id="user_'.$key.'" type="text" value="'.Smarty::htmlentities($uname).'" '
 	    .$value['attrs'].' size="'.($size-40).'" />';
 	  if( count($value['domains']) == 1 ) {
-	    $str .= '<input name="domain_'.$key.'" type="hidden" value="'.MySmarty::htmlentities($value['domains'][0]).'" />';
-	    $str .= '<span class="ctrl">@'.MySmarty::htmlentities($value['domains'][0]).'</span></td>';
+	    $str .= '<input name="domain_'.$key.'" type="hidden" value="'.Smarty::htmlentities($value['domains'][0]).'" />';
+	    $str .= '<span class="ctrl">@'.Smarty::htmlentities($value['domains'][0]).'</span></td>';
 	  } else {
 	    $str .= '<label for="domain_'.$key.'">@</label><select name="domain_'.$key.'" id="domain_'.$key.'" '.$value['attrs']." >\n";
 	    foreach( $value['domains'] as $dom ) {
 	      if( $dom == $domain ) $s = 'selected="selected"';
 	      else $s = '';
-	      $str .= '<option value="'.MySmarty::htmlentities($dom).'" '.$s.'>'.MySmarty::htmlentities($dom).'</option>'."\n";
+	      $str .= '<option value="'.Smarty::htmlentities($dom).'" '.$s.'>'.Smarty::htmlentities($dom).'</option>'."\n";
 	    }
 	    $str .= '</select>';
 	    $str .= '</td>';
@@ -189,10 +209,10 @@
 	$str .= '<tr>';
 	if( ereg( 'readonly', $value['attrs'] ) ) {
 	  $str .= '<td><label>'.$value['name'].'</label></td>';
-	  $str .= '<td><p class="ctrl">'.MySmarty::htmlentities($value['value']).'</p></td>';
+	  $str .= '<td><p class="ctrl">'.Smarty::htmlentities($value['value']).'</p></td>';
 	} else {
 	  $str .= '<td><label for="'.$key.'">'.$value['name'].'</label></td>';
-	  $str .= '<td><textarea name="'.$key.'" id="'.$key.'" rows="5" cols="'.$size.'" '.$value['attrs'].' onkeypress="javascript:textareakeypress()">'.MySmarty::htmlentities($value['value']).'</textarea></td>';
+	  $str .= '<td><textarea name="'.$key.'" id="'.$key.'" rows="5" cols="'.$size.'" '.$value['attrs'].' onkeypress="javascript:textareakeypress()">'.Smarty::htmlentities($value['value']).'</textarea></td>';
 	}
 	$str .= '<td>'.KolabForm::comment_helper($value).'</td>';
 	$str .= '</tr>'."\n";
@@ -220,8 +240,8 @@
 	    if( is_array( $value['value'] ) ) $checked = ( in_array($opt ,$value['value'] ))?"checked":"";
 	    else $checked = "";
 	    //debug("Checking if $opt is in ".join(",",$value['value'])." :$checked");
-	    $str .= '<tr><td><input name="'.$key.'[]" type="checkbox" value="'.MySmarty::htmlentities($opt).'" '.$value['attrs']." $checked /></td><td>"
-	      .MySmarty::htmlentities($opt).'</td></tr>';
+	    $str .= '<tr><td><input name="'.$key.'[]" type="checkbox" value="'.Smarty::htmlentities($opt).'" '.$value['attrs']." $checked /></td><td>"
+	      .Smarty::htmlentities($opt).'</td></tr>';
 	  }
 	  $str .= '</table></td>';
 	}
@@ -232,8 +252,8 @@
 	$str .= '<tr>';
 	if( ereg( 'readonly', $value['attrs'] ) ) {
 	  $str .= '<td><label>'.$value['name'].'</label></td>';
-	  $str .= '<td><p class="ctrl">'.MySmarty::htmlentities($value['options'][$value['value']]).
-	    '<input type="hidden" name="'.$key.'" value="'.MySmarty::htmlentities($value['value']).'" /></p></td>';
+	  $str .= '<td><p class="ctrl">'.Smarty::htmlentities($value['options'][$value['value']]).
+	    '<input type="hidden" name="'.$key.'" value="'.Smarty::htmlentities($value['value']).'" /></p></td>';
 	} else {
 	  $str .= '<td><label for="'.$key.'">'.$value['name'].'</label></td>';
 	  $str .= '<td><select name="'.$key.'" id="'.$key.'" '.$value['attrs'].' >'."\n";
@@ -241,7 +261,7 @@
 	  for( $i = 0; $i < count($value['options']); ++$i) {
 	    if( $i == $value['value'] ) $s = 'selected="selected"';
 	    else $s = '';
-	    $str .= '<option value="'.$i.'" '.$s.'>'.MySmarty::htmlentities($value['options'][$i]).'</option>'."\n";
+	    $str .= '<option value="'.$i.'" '.$s.'>'.Smarty::htmlentities($value['options'][$i]).'</option>'."\n";
 	  }
 	  $str .= '</select>';
 	  $str .= '</td>';
@@ -256,8 +276,8 @@
 			   'contact' => _('Contacts'), 'note' => _('Notes'));
 	if( ereg( 'readonly', $value['attrs'] ) ) {
 	  $str .= '<td><label>'.$value['name'].'</label></td>';
-	  $str .= '<td><p class="ctrl">'.MySmarty::htmlentities($entries[$value['value']]).
-	    '<input type="hidden" name="'.$key.'" value="'.MySmarty::htmlentities($value['value']).'" /></p></td>';
+	  $str .= '<td><p class="ctrl">'.Smarty::htmlentities($entries[$value['value']]).
+	    '<input type="hidden" name="'.$key.'" value="'.Smarty::htmlentities($value['value']).'" /></p></td>';
 	} else {
 	  $str .= '<td><label for="'.$key.'">'.$value['name'].'</label></td>';
 	  $str .= '<td><select name="'.$key.'" id="'.$key.'" '.$value['attrs'].' >'."\n";
@@ -267,7 +287,7 @@
 	    else
 	      $s = '';
 	    
-	    $str .= '<option value="'.$id.'" '.$s.'>'.MySmarty::htmlentities($title).'</option>'."\n";
+	    $str .= '<option value="'.$id.'" '.$s.'>'.Smarty::htmlentities($title).'</option>'."\n";
 	  }
 	  $str .= '</select>';
 	  $str .= '</td>';
@@ -279,11 +299,11 @@
 	$str .= '<tr>';
 	if( ereg( 'readonly', $value['attrs'] ) ) {
 	  $str .= '<td><label>'.$value['name'].'</label></td>';
-	  if( $value['user'] ) $str .= '<td><span class="ctrl">'.MySmarty::htmlentities($value['user']).'</span> <span class="ctrl">'.$value['perm'].'</span></td>';
+	  if( $value['user'] ) $str .= '<td><span class="ctrl">'.Smarty::htmlentities($value['user']).'</span> <span class="ctrl">'.$value['perm'].'</span></td>';
 	} else {
 	  $str .= '<td><label for="user_'.$key.'">'.$value['name'].'</label></td>';
 	  $str .= '<td><input name="user_'.$key.'" id="user_'.$key.'" type="'.$value['type'].'" size="'.($size-15).'" value="'
-	    .MySmarty::htmlentities($value['user']).'" '.$value['attrs'].' />';
+	    .Smarty::htmlentities($value['user']).'" '.$value['attrs'].' />';
 	  $str .= '<select name="perm_'.$key.'">'."\n";
 	  if( $value['perm'] ) $selected_perm = $value['perm'];
 	  else $selected_perm = 'all';
@@ -330,15 +350,15 @@
 	    if( !$user ) continue;
 	    $str .= '<tr><td>';
 	    if( $user == 'anyone' ) $str .= '<p class="ctrl">'._('Anyone').'</p>';
-	    else $str .= '<p class="ctrl">'.MySmarty::htmlentities($user).'</p>';
-	    $str .= '</td><td><p class="ctrl">'.MySmarty::htmlentities($policies[$pol]).'</p></td></tr>'."\n";
+	    else $str .= '<p class="ctrl">'.Smarty::htmlentities($user).'</p>';
+	    $str .= '</td><td><p class="ctrl">'.Smarty::htmlentities($policies[$pol]).'</p></td></tr>'."\n";
 	  } else {
 	    $str .= '<tr><td>';
 	    if( $user == 'anyone' ) {
-	      $str .= _('Anyone').'<input type="hidden" name="user_'.$key.'_'.$i.'" value="'.MySmarty::htmlentities($user).'" '.$value['attrs'].' />';
+	      $str .= _('Anyone').'<input type="hidden" name="user_'.$key.'_'.$i.'" value="'.Smarty::htmlentities($user).'" '.$value['attrs'].' />';
 	    } else {
 	      $str .= '<input name="user_'.$key.'_'.$i.'" type="text" size="'.($size-20)
-		.'" value="'.MySmarty::htmlentities($user).'" '.$value['attrs'].' />';
+		.'" value="'.Smarty::htmlentities($user).'" '.$value['attrs'].' />';
 	    }
 	    $str .= '</td><td><select name="policy_'.$key.'_'.$i.'">'."\n";
 	    $j = 0;
@@ -367,7 +387,7 @@
       if( !isset( $value['comment'] ) ) $value['comment'] = '';
       if( !isset( $value['attrs'] ) ) $value['attrs'] = '';
       if( $value['type'] == 'hidden' ) {
-	$str .= '<input name="'.$key.'" type="hidden" value="'.MySmarty::htmlentities($value['value']).'" '.$value['attrs'].' />';
+	$str .= '<input name="'.$key.'" type="hidden" value="'.Smarty::htmlentities($value['value']).'" '.$value['attrs'].' />';
       }
     }
     $str .= '</form>';

Index: ldap.class.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/ldap.class.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ldap.class.php	16 Aug 2007 12:16:51 -0000	1.1
+++ ldap.class.php	16 Aug 2007 15:52:01 -0000	1.2
@@ -1,25 +1,37 @@
 <?php
-/*
- *  Copyright (c) 2004,2005 Klarälvdalens Datakonsult AB
+/*  
+ *  COPYRIGHT
+ *  ---------
  *
- *    Written by Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
+ *  See ../AUTHORS file
  *
- *  This  program is free  software; you can redistribute  it and/or
- *  modify it  under the terms of the GNU  General Public License as
- *  published by the  Free Software Foundation; either version 2, or
+ *
+ *  LICENSE
+ *  -------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
  *
- *  This program is  distributed in the hope that it will be useful,
- *  but WITHOUT  ANY WARRANTY; without even the  implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- *  General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  $Revision$
+ *
+ *  ABOUT
+ *  -----
+ *
+ *  Provides functions for language detection.
  *
- *  You can view the  GNU General Public License, online, at the GNU
- *  Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
  */
 
-require_once('mysmarty.php');
-require_once('session_vars.php');
 require_once('debug.php');
 
 /* We dont have any better place to put this right now... */
@@ -41,20 +53,23 @@
  }
 
 class KolabLDAP {
-  function KolabLDAP() {
-    $this->is_bound = false;
-    $this->bind_dn = false;
-    $this->search_result = false;
-	$this->cached_domains = false;
-	// Always connect to master server
-    $this->connection=ldap_connect($_SESSION['ldap_master_uri']);
-	if (ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, 3)) {
-	  // Good, we really neeed v3!
-	} else {
-	  echo _("Error setting LDAP protocol to v3. Please contact your system administrator");
-	  return false;
-	}
-  }
+
+    function KolabLDAP() 
+    {
+        $this->errors = array();
+        $this->is_bound = false;
+        $this->bind_dn = false;
+        $this->search_result = false;
+        $this->cached_domains = false;
+        // Always connect to master server
+        $this->connection=ldap_connect($_SESSION['ldap_master_uri']);
+        if (ldap_set_option($this->connection, LDAP_OPT_PROTOCOL_VERSION, 3)) {
+            // Good, we really neeed v3!
+        } else {
+            echo _("Error setting LDAP protocol to v3. Please contact your system administrator");
+            return false;
+        }
+    }
 
   function close() {
     if( $this->search_result ) {
@@ -171,7 +186,6 @@
   }
 
   function uidForDn( $dn ) {
-	global $errors;
     $res = ldap_read( $this->connection, $dn,
 					  '(objectclass=*)',
 					  array( 'uid' ) );
@@ -181,10 +195,10 @@
 	  if( $entries['count'] == 1 ) {
 		return $entries[0]['uid'][0];
 	  } else {
-		$errors[] = sprintf( _("No such object %s"), $dn );
+		$this->errors[] = sprintf( _("No such object %s"), $dn );
 	  }
 	} else {
-	  $errors[] = sprintf( _("LDAP Error searching for DN %s: %s"), $dn, ldap_error($this->connection));
+	  $this->errors[] = sprintf( _("LDAP Error searching for DN %s: %s"), $dn, ldap_error($this->connection));
 	}
     return false;	
   }
@@ -203,7 +217,6 @@
   }
 
   function mailForDn( $dn ) {
-    global $errors;
     $res = ldap_read( $this->connection, $dn, '(objectclass=*)', array( 'mail' ) );
     if( $res ) {
       $entries = ldap_get_entries( $this->connection, $res );
@@ -211,10 +224,10 @@
       if( $entries[0]['count'] == 1 ) {
         return $entries[0]['mail'][0]; 
       } else {
-        $errors[] = sprintf( _("No such object %s"), $dn);
+        $this->errors[] = sprintf( _("No such object %s"), $dn);
       } 
     } else {
-      $errors[] = sprintf(_("LDAP Error searching for DN %s: %s"), $dn, ldap_error($this->connection));
+      $this->errors[] = sprintf(_("LDAP Error searching for DN %s: %s"), $dn, ldap_error($this->connection));
     }
     return false;
   }
@@ -233,7 +246,6 @@
   }
 
   function aliasForDn( $dn ) {
-    global $errors;
     $res = ldap_read( $this->connection, $dn, '(objectclass=*)', array( 'alias' ) );
     if( $res ) {
       $entries = ldap_get_entries( $this->connection, $res );
@@ -241,10 +253,10 @@
       if( $entries['count'] == 1 ) {
         return $entries[0]['alias'][0];
       } else {
-        $errors[] = sprintf( _("No such object %s"), $dn);
+        $this->errors[] = sprintf( _("No such object %s"), $dn);
       }
     } else {
-      $errors[] = sprintf( _("LDAP Error searching for DN %s: %s"), $dn, ldap_error($this->connection) );
+      $this->errors[] = sprintf( _("LDAP Error searching for DN %s: %s"), $dn, ldap_error($this->connection) );
     }
     return false;
   }
@@ -257,7 +269,7 @@
         return ldap_get_dn( $this->connection, $entry );
       }
     } else {
-      $errors[] = sprintf( _("Error searching for DN for alias=%s: %s"), $mail, ldap_error($this->connection));
+      $this->errors[] = sprintf( _("Error searching for DN for alias=%s: %s"), $mail, ldap_error($this->connection));
     }
     return false;
   }
@@ -270,7 +282,7 @@
         return ldap_get_dn( $this->connection, $entry );
       }
     } else {
-      $errors[] = sprintf( _("Error searching for DN for mail or alias %s: %s"), $mail, ldap_error($this->connection));
+      $this->errors[] = sprintf( _("Error searching for DN for mail or alias %s: %s"), $mail, ldap_error($this->connection));
     }
     return false;
   }
@@ -327,13 +339,12 @@
 
   // Get members of a group as an array of DNs
   function groupMembers( $base, $group ) {
-    global $errors;
     $privmembers = array();
     $mybase = 'cn='.$group.','.$base;
     $filter = '(objectClass=kolabGroupOfNames)';
     $res = ldap_search( $this->connection, $mybase, $filter, array('member') );
     if( !$res ) {
-      array_push($errors, _("LDAP Error: Can't read maintainers group: ")
+      array_push($this->errors, _("LDAP Error: Can't read maintainers group: ")
 				 .ldap_error($conn) );	
       return array();
     }

Index: locale.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/locale.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- locale.php	16 Aug 2007 12:16:51 -0000	1.1
+++ locale.php	16 Aug 2007 15:52:01 -0000	1.2
@@ -1,29 +1,37 @@
 <?php
-/*
- *  Copyright (c) 2005 Klarälvdalens Datakonsult AB
+/*  
+ *  COPYRIGHT
+ *  ---------
  *
- *    Written by Romain Pokrzywka <romain at klaralvdalens-datakonsult.se>
+ *  See ../AUTHORS file
  *
- *  This  program is free  software; you can redistribute  it and/or
- *  modify it  under the terms of the GNU  General Public License as
- *  published by the  Free Software Foundation; either version 2, or
+ *
+ *  LICENSE
+ *  -------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
  *
- *  This program is  distributed in the hope that it will be useful,
- *  but WITHOUT  ANY WARRANTY; without even the  implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- *  General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  $Revision$
+ *
+ *  ABOUT
+ *  -----
+ *
+ *  Provides functions for language detection.
  *
- *  You can view the  GNU General Public License, online, at the GNU
- *  Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
  */
 
-  //require_once("mysmarty.php");
-
-// PENDING(romain,steffen): Clean up so this is not a mix of code and global functions
-
-session_start();
-
 function supported_lang($lang) {
 
     // REMEMBER TO UPDATE THIS WHEN ADDING NEW LANGUAGES
@@ -95,29 +103,28 @@
     $_SESSION["lang"] = $lang;
 }
 
+// //FIXME: This should be external knowledge
 // Check if language was changed
-if(!empty($_REQUEST["lang"])) {
-    setLanguage($_REQUEST["lang"]);
-}
+// if(!empty($_REQUEST["lang"])) {
+//     setLanguage($_REQUEST["lang"]);
+// }
 
-// I18N support information
-$language = getLanguage();
-putenv("LANG=$language"); 
-putenv("LANGUAGE=$language"); 
-setlocale(LC_ALL, $language);
+// // I18N support information
+// $language = getLanguage();
+// putenv("LANG=$language"); 
+// putenv("LANGUAGE=$language"); 
+// setlocale(LC_ALL, $language);
 
-$domain = "messages";
-//$tmpSmarty = new MySmarty();
+// $domain = "messages";
 
-//FIXME: This should be external knowledge
-bindtextdomain($domain, $locale_dir); 
-bind_textdomain_codeset($domain, "UTF-8");
-textdomain($domain);
+// bindtextdomain($domain, $locale_dir); 
+// bind_textdomain_codeset($domain, "UTF-8");
+// textdomain($domain);
 
 /*
   Local variables:
   mode: php
-  indent-tabs-mode: t
+  indent-tabs-mode: f
   tab-width: 4
   buffer-file-coding-system: utf-8
   End:

Index: menu.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/menu.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- menu.php	16 Aug 2007 12:16:51 -0000	1.1
+++ menu.php	16 Aug 2007 15:52:01 -0000	1.2
@@ -1,137 +1,218 @@
 <?php
-/*
- *  Copyright (c) 2004 Klarälvdalens Datakonsult AB
+/*  
+ *  COPYRIGHT
+ *  ---------
  *
- *    Written by Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
+ *  See ../AUTHORS file
  *
- *  This  program is free  software; you can redistribute  it and/or
- *  modify it  under the terms of the GNU  General Public License as
- *  published by the  Free Software Foundation; either version 2, or
+ *
+ *  LICENSE
+ *  -------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
  *  (at your option) any later version.
  *
- *  This program is  distributed in the hope that it will be useful,
- *  but WITHOUT  ANY WARRANTY; without even the  implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- *  General Public License for more details.
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  $Revision$
+ *
+ *  ABOUT
+ *  -----
+ *
+ *  Generate the webadmin menu
  *
- *  You can view the  GNU General Public License, online, at the GNU
- *  Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
  */
 
-require_once('locale.php');
+function generate_menu($auth, $topdir)
+{
+    $menuitems = array();
 
-$menuitems = array();
+    if( $auth->group() == "admin" || 
+        $auth->group() == "maintainer" || 
+        $auth->group() == 'domain-maintainer' ) {
+        $menuitems['user'] = array( 
+            'name'    => _('Users'),
+            'url'     => $topdir . '/user/',
+            'title'   => _('Manage Email Users'),
+            'submenu' => array( 
+                array( 
+                    'name' => _('Create New User'),
+                    'url'  => 'user.php?action=create' 
+                )
+            )
+        );
+    } else {
+        $menuitems['user'] = array( 
+            'name'    => _('My User Settings'),
+            'url'     => $topdir . '/user/user.php?action=modify',
+            'title'   => _('My User Settings'),
+            'submenu' => array(
+                array( 
+                    'name' => _('Mail Delivery'),
+                    'url'  => 'deliver.php'),
+                array( 
+                    'name' => _('Forward Email'),
+                    'url'  => 'forward.php' ),
+                array( 
+                    'name' => _('Vacation'),
+                    'url'  => 'vacation.php' 
+                )
+            )
+        );
+    }
+    if( $auth->group() == "admin" || 
+        $auth->group() == "maintainer") {
+        $menuitems['addressbook'] = array( 
+            'name'    => _('Addressbook'),
+            'url'     => $topdir . '/addressbook/',
+            'title'   => _('Manage Address Book'),
+            'submenu' => array( 
+                array( 
+                    'name' => _('Create New vCard'),
+                    'url'  => 'addr.php?action=create' 
+                )
+            )
+        );
+    }
 
-if( $auth->group() == "admin" || $auth->group() == "maintainer" || $auth->group() == 'domain-maintainer' ) {
-  $menuitems['user'] = array( 'name' => _('Users'),
-							  'url'  => $topdir.'/user/',
-							  'title' => _('Manage Email Users'),
-							  'submenu' => array( 
-												 array( 'name' => _('Create New User'),
-														'url'  => 'user.php?action=create' )));
-} else {
-  $menuitems['user'] = array( 'name' => _('My User Settings'),
-							  'url'  => $topdir.'/user/user.php?action=modify',
-							  'title' => _('My User Settings'),
-							  'submenu' => array(
-												 array( 'name' => _('Mail Delivery'),
-														'url'  => 'deliver.php'),
-												 array( 'name' => _('Forward Email'),
-														'url'  => 'forward.php' ),
-												 array( 'name' => _('Vacation'),
-														'url'  => 'vacation.php' )));
-}
-if( $auth->group() == "admin" || $auth->group() == "maintainer") {
-  $menuitems['addressbook'] = array( 'name' => _('Addressbook'),
-									 'url'  => $topdir.'/addressbook/',
-									 'title' => _('Manage Address Book'),
-									 'submenu' => array( 
-														array( 'name' => _('Create New vCard'),
-															   'url' => 'addr.php?action=create' )));
+    if( $auth->group() == "admin" || 
+        $auth->group() == "maintainer" || 
+        $auth->group() == 'domain-maintainer') {
+        $menuitems['sf'] = array( 
+            'name'    => _('Shared Folder'),
+            'url'     => $topdir . '/sharedfolder/',
+            'title'   => _('Manage Shared Folders'),
+            'submenu' => array( 
+                array( 
+                    'name' => _('Add Shared Folder'),
+                    'url'  => 'sf.php?action=create' 
+                )
+            )
+        );  
+    }
 
-}
-if( $auth->group() == "admin" || $auth->group() == "maintainer" || $auth->group() == 'domain-maintainer') {
-  $menuitems['sf'] = array( 'name' => _('Shared Folder'),
-							'url'  => $topdir.'/sharedfolder/',
-							'title' => _('Manage Shared Folders'),
-							'submenu' => array( 
-											   array( 'name' => _('Add Shared Folder'),
-													  'url' => 'sf.php?action=create' )));  
-}
-if( $auth->group() == 'admin' || $auth->group() == 'maintainer' || $auth->group() == 'domain-maintainer') {
-  $menuitems['distlist'] = array( 'name' => _('Distribution Lists'),
-									   'url'  => $topdir.'/distributionlist/',
-									   'title' => _('Manage Distribution Lists'),
-									   'submenu' => array(
-														  array( 'name' => _('Create New List'),
-   															 'url'   => 'list.php?action=create' ) ) );
-}
-if( $auth->group() == 'admin' ) {
-  $menuitems['administrator'] = array( 'name' => _('Administrators'),
-									   'url'  => $topdir.'/administrator/',
-									   'title' => _('Manage Administrators'),
-									   'submenu' => array(
-														  array( 'name' => _('Create New Administrator'),
-																 'url'   => 'admin.php?action=create' ) ) );
-  $menuitems['domain-maintainer'] = array( 'name' => _('Domain Maintainers'),
-									   'url'  => $topdir.'/domainmaintainer/',
-									   'title' => _('Manage Domain Maintainers'),
-									   'submenu' => array(
-														  array( 'name' => _('Create New Domain Maintainer'),
-																 'url'   => 'domainmaintainer.php?action=create' ) ) );
-  $menuitems['maintainer'] = array( 'name' => _('Maintainers'),
-									'url'  => $topdir.'/maintainer/',
-									'title' => _('Manage Maintainers'),
-									'submenu' => array(
-													   array( 'name' => _('Create New Maintainer'),
-															  'url'   => 'maintainer.php?action=create' ) ) );
-} else if( $auth->group() == 'maintainer' ) {
-  $mdn = $auth->dn();
-  $menuitems['maintainer'] = array( 'name' => _('Maintainers'),
-									'url'  => $topdir.'/maintainer/maintainer.php?action=modify&dn='.urlencode($mdn),
-									'title' => _('Manage Maintainer') );  
-  $menuitems['domain-maintainer'] = array( 'name' => _('Domain Maintainers'),
-									   'url'  => $topdir.'/domainmaintainer/',
-									   'title' => _('Manage Domain Maintainers'),
-									   'submenu' => array(
-														  array( 'name' => _('Create New Domain Maintainer'),
-																 'url'   => 'domainmaintainer.php?action=create' ) ) );
-} else if( $auth->group() == 'domain-maintainer' ) {
-  $mdn = $auth->dn();
-  $menuitems['domain-maintainer'] = array( 'name' => _('Domain Maintainers'),
-									'url'  => $topdir.'/domainmaintainer/domainmaintainer.php?action=modify&dn='.urlencode($mdn),
-									'title' => _('Manage Domain Maintainer') );  
-}
-if( $auth->group() == 'admin' ) {
-  $menuitems['service'] = array( 'name' => _('Services'),
-								 'url'  => $topdir.'/service/',
-								 'title' => _('Manage Services') );
-}
+    if( $auth->group() == 'admin' || 
+        $auth->group() == 'maintainer' || 
+        $auth->group() == 'domain-maintainer') {
+        $menuitems['distlist'] = array( 
+            'name'    => _('Distribution Lists'),
+            'url'     => $topdir . '/distributionlist/',
+            'title'   => _('Manage Distribution Lists'),
+            'submenu' => array(
+                array( 
+                    'name' => _('Create New List'),
+                    'url'  => 'list.php?action=create' 
+                ) 
+            ) 
+        );
+    }
 
-$menuitems['about'] = array( 'name' => _('About Kolab'),
-							 'url'  => $topdir.'/kolab/',
-							 'title' => _('About Kolab'),
-							 'submenu' => array( 
-												array( 'name' => _('Erfrakon'),
-													   'url'  => 'erfrakon.php' ),
-												array( 'name' => _('Intevation'),
-													   'url'  => 'intevation.php' ),
-												array( 'name' => _('Klarälvdalens Datakonsult'),
-													   'url'  => 'kdab.php' ),
-												array( 'name' => _('Code Fusion'),
-													   'url'  => 'codefusion.php' ),
-												array( 'name' => _('KDE'),
-													   'url'  => 'kde.php' )
-												));
-if( $auth->group() == 'admin' || $auth->group() == 'maintainer' || $auth->group() == 'domain-maintainer') {
-  $menuitems['about']['submenu'][] = array( 'name' => _('<b>Versions</b>'),
-											'url'  => 'versions.php' );
+    if( $auth->group() == 'admin' ) {
+        $menuitems['administrator'] = array( 
+            'name'    => _('Administrators'),
+            'url'     => $topdir . '/administrator/',
+            'title'   => _('Manage Administrators'),
+            'submenu' => array(
+                array( 
+                    'name' => _('Create New Administrator'),
+                    'url'   => 'admin.php?action=create' 
+                ) 
+            ) 
+        );
+        $menuitems['domain-maintainer'] = array( 
+            'name'    => _('Domain Maintainers'),
+            'url'     => $topdir . '/domainmaintainer/',
+            'title'   => _('Manage Domain Maintainers'),
+            'submenu' => array(
+                array( 
+                    'name' => _('Create New Domain Maintainer'),
+                    'url'  => 'domainmaintainer.php?action=create' 
+                ) 
+            ) 
+        );
+        $menuitems['maintainer'] = array( 
+            'name'    => _('Maintainers'),
+            'url'     => $topdir . '/maintainer/',
+            'title'   => _('Manage Maintainers'),
+            'submenu' => array(
+                array( 
+                    'name' => _('Create New Maintainer'),
+                    'url'   => 'maintainer.php?action=create' 
+                ) 
+            ) 
+        );
+    } else if ( $auth->group() == 'maintainer' ) {
+        $mdn = $auth->dn();
+        $menuitems['maintainer'] = array( 
+            'name'  => _('Maintainers'),
+            'url'   => $topdir . '/maintainer/maintainer.php?action=modify&dn=' . urlencode($mdn),
+            'title' => _('Manage Maintainer') );  
+        $menuitems['domain-maintainer'] = array( 
+            'name'    => _('Domain Maintainers'),
+            'url'     => $topdir . '/domainmaintainer/',
+            'title'   => _('Manage Domain Maintainers'),
+            'submenu' => array(
+                array( 
+                    'name' => _('Create New Domain Maintainer'),
+                    'url'  => 'domainmaintainer.php?action=create' 
+                ) 
+            ) 
+        );
+    } else if( $auth->group() == 'domain-maintainer' ) {
+        $mdn = $auth->dn();
+        $menuitems['domain-maintainer'] = array( 
+            'name'  => _('Domain Maintainers'),
+            'url'   => $topdir . '/domainmaintainer/domainmaintainer.php?action=modify&dn=' . urlencode($mdn),
+            'title' => _('Manage Domain Maintainer') );  
+    }
+    if( $auth->group() == 'admin' ) {
+        $menuitems['service'] = array( 
+            'name'  => _('Services'),
+            'url'   => $topdir.'/service/',
+            'title' => _('Manage Services') 
+        );
+    }
+
+    $menuitems['about'] = array( 
+        'name' => _('About Kolab'),
+        'url'  => $topdir.'/kolab/',
+        'title' => _('About Kolab'),
+        'submenu' => array( 
+            array( 'name' => _('Erfrakon'),
+                   'url'  => 'erfrakon.php' ),
+            array( 'name' => _('Intevation'),
+                   'url'  => 'intevation.php' ),
+            array( 'name' => _('Klarälvdalens Datakonsult'),
+                   'url'  => 'kdab.php' ),
+            array( 'name' => _('Code Fusion'),
+                   'url'  => 'codefusion.php' ),
+            array( 'name' => _('KDE'),
+                   'url'  => 'kde.php' )
+        )
+    );
+    if( $auth->group() == 'admin' || 
+        $auth->group() == 'maintainer' || 
+        $auth->group() == 'domain-maintainer') {
+        $menuitems['about']['submenu'][] = array( 
+            'name' => _('<b>Versions</b>'),
+            'url'  => 'versions.php' 
+        );
+    }
 }
 
 /*
   Local variables:
   mode: php
-  indent-tabs-mode: t
+  indent-tabs-mode: f
   tab-width: 4
   buffer-file-coding-system: utf-8
   End:

Index: passwd.php
===================================================================
RCS file: /kolabrepository/server/php-kolab/Kolab_Webadmin/Webadmin/passwd.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- passwd.php	16 Aug 2007 12:16:51 -0000	1.1
+++ passwd.php	16 Aug 2007 15:52:01 -0000	1.2
@@ -1,14 +1,36 @@
 <?php
-/* -------------------------------------------------------------------
-   Copyright (c) 2004 Klaraelvdalens Datakonsult AB
-   Copyright (C) 2007 by Intevation GmbH
-   Author(s):
-   Sascha Wilde <wilde at intevation.de>
-   Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
-
-   This program is free software under the GNU GPL (>=v2)
-   Read the file COPYING coming with the software for details.
-   ------------------------------------------------------------------- */
+/*  
+ *  COPYRIGHT
+ *  ---------
+ *
+ *  See ../AUTHORS file
+ *
+ *
+ *  LICENSE
+ *  -------
+ *
+ *  This program is free software; you can redistribute it and/or modify
+ *  it under the terms of the GNU General Public License as published by
+ *  the Free Software Foundation; either version 2 of the License, or
+ *  (at your option) any later version.
+ *
+ *  This program is distributed in the hope that it will be useful,
+ *  but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *  GNU General Public License for more details.
+ *
+ *  You should have received a copy of the GNU General Public License
+ *  along with this program; if not, write to the Free Software
+ *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *  $Revision$
+ *
+ *  ABOUT
+ *  -----
+ *
+ *  Debugging functions.
+ *
+ */
 
 // Generate OpenLDAP style SSHA password strings
 function ssha($string, $salt)
@@ -25,9 +47,9 @@
   return $salt;
 }
 
+//FIXME: won't work
 // Check that passwords from form input match
-function checkpw( $form, $key, $value ) {
-  global $action;
+function checkpw( $form, $key, $value, $action ) {
   if( $action == 'firstsave' ) {
     if( $key == 'password_0' ) {
       if( $value == '' ) return _('Password is empty');

--- authenticate.php DELETED ---

--- headers.php DELETED ---





More information about the commits mailing list