steffen: server/kolab-webadmin/kolab-webadmin/php/admin/include auth.class.php, 1.7, 1.8 authenticate.php, 1.1, 1.2 debug.php, 1.4, 1.5 form.class.php, 1.14, 1.15 headers.php, 1.1, 1.2 ldap.class.php, 1.18, 1.19 sieveutils.class.php, 1.2, 1.3

cvs at intevation.de cvs at intevation.de
Thu Dec 16 22:03:31 CET 2004


Author: steffen

Update of /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include
In directory doto:/tmp/cvs-serv21344/include

Modified Files:
	auth.class.php authenticate.php debug.php form.class.php 
	headers.php ldap.class.php sieveutils.class.php 
Log Message:
Fixed pesky encoding again again and indentation

Index: auth.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/auth.class.php,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- auth.class.php	19 Nov 2004 11:39:54 -0000	1.7
+++ auth.class.php	16 Dec 2004 21:03:29 -0000	1.8
@@ -1,6 +1,6 @@
 <?php
 /*
- *  Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ *  Copyright (c) 2004 Klarälvdalens Datakonsult AB
  *
  *    Written by Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
  *
@@ -23,137 +23,137 @@
 require_once('mysmarty.php');
 
 class KolabAuth {
-  function KolabAuth( $do_auth = true ) {
-    if( isset( $_GET['logout'] ) || isset( $_POST['logout'] ) ) {
-      $this->logout();
-    } else if( $do_auth ) {
-      $this->authenticate();
-    }
-  }
+	function KolabAuth( $do_auth = true ) {
+		if( isset( $_GET['logout'] ) || isset( $_POST['logout'] ) ) {
+			$this->logout();
+		} else if( $do_auth ) {
+			$this->authenticate();
+		}
+	}
 
-  function authenticate() {
-    global $ldap;
-    $this->error_string = false;
-    if( !isset( $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();
-      $this->gotoLoginPage(); 
-    }
-    if( $this->isAuthenticated() ) {
-      $bind_result = $ldap->bind( $_SESSION['auth_dn'], $_SESSION['auth_pw'] );
-    } else {
-      $bind_result = false;
-    }
-    if( !$bind_result ) {
-      // Anon. bind first
-      if( !$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'] );
-                if (!$dn) {
-		  $dn = $ldap->dnForMail( $_POST['username'] ); // try mail attribute
+	function authenticate() {
+		global $ldap;
+		$this->error_string = false;
+		if( !isset( $ldap ) ) {
+			$this->error_string = _("Server error, no ldap object!");
+			return false;
 		}
-		if( $dn ) {
-		  $auth_user = $ldap->uidForDn( $dn );
-		  $bind_result = $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'] = $ldap->groupForUid( $auth_user );
-			$_SESSION['remote_ip'] = $_SERVER['REMOTE_ADDR'];
-			return true;
-		  } else {
-			$this->error_string = _("Wrong username or password");
+		// Anon. bind first
+		if( !$ldap->bind( $_SESSION['php_dn'],  $_SESSION['php_pw'] ) ) {
+			$this->error_string = _("Could not bind to LDAP server: ").$ldap->error();
 			$this->gotoLoginPage(); 
-		  }
+		}
+		if( $this->isAuthenticated() ) {
+			$bind_result = $ldap->bind( $_SESSION['auth_dn'], $_SESSION['auth_pw'] );
 		} else {
-		  $this->error_string = _("Wrong username or password");
-		  //$this->error_string = "Dn not found";
-		  $this->gotoLoginPage(); 
+			$bind_result = false;
 		}
-      } else {
-		$this->error_string = _('Please log in as a valid user');
-		$this->gotoLoginPage();
-      }
-    } else {
-      // All OK, user already logged in
-      return true;
-    }
-  }
+		if( !$bind_result ) {
+			// Anon. bind first
+			if( !$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'] );
+                if (!$dn) {
+					$dn = $ldap->dnForMail( $_POST['username'] ); // try mail attribute
+				}
+				if( $dn ) {
+					$auth_user = $ldap->uidForDn( $dn );
+					$bind_result = $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'] = $ldap->groupForUid( $auth_user );
+						$_SESSION['remote_ip'] = $_SERVER['REMOTE_ADDR'];
+						return true;
+					} else {
+						$this->error_string = _("Wrong username or password");
+						$this->gotoLoginPage(); 
+					}
+				} else {
+					$this->error_string = _("Wrong username or password");
+					//$this->error_string = "Dn not found";
+					$this->gotoLoginPage(); 
+				}
+			} else {
+				$this->error_string = _('Please log in as a valid user');
+				$this->gotoLoginPage();
+			}
+		} else {
+			// All OK, user already logged in
+			return true;
+		}
+	}
   
-  function logout() {
-      session_unset();
-      session_destroy();
-      $this->error_string = "";
-      //$this->gotoLoginPage();
-      Header("Location: /admin/");
-  }
+	function logout() {
+		session_unset();
+		session_destroy();
+		$this->error_string = "";
+		//$this->gotoLoginPage();
+		Header("Location: /admin/");
+	}
 
-  function handleLogin() {
-    if( isset( $_POST['login'] ) ) {
-      $this->authenticate();
-    } else if( isset( $_POST['logout'] ) ) {
-      $this->logout();
-    }
-  }
+	function handleLogin() {
+		if( isset( $_POST['login'] ) ) {
+			$this->authenticate();
+		} else if( isset( $_POST['logout'] ) ) {
+			$this->logout();
+		}
+	}
 
-  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() );
-    $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() );
+		$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'];
-  }
+	function isAuthenticated() {
+		return isset( $_SESSION['auth_dn'] ) && $_SESSION['remote_ip'] == $_SERVER['REMOTE_ADDR'];
+	}
 
-  function dn() {
-    if( $this->isAuthenticated() ) return $_SESSION['auth_dn'];
-    else return false;
-  }
+	function dn() {
+		if( $this->isAuthenticated() ) return $_SESSION['auth_dn'];
+		else return false;
+	}
 
-  function uid() {
-    if( $this->isAuthenticated() ) return $_SESSION['auth_user'];
-    else return false;
-  }
+	function uid() {
+		if( $this->isAuthenticated() ) return $_SESSION['auth_user'];
+		else return false;
+	}
 
-  function group() {
-    if( $this->isAuthenticated() ) return $_SESSION['auth_group'];
-  }
+	function group() {
+		if( $this->isAuthenticated() ) return $_SESSION['auth_group'];
+	}
 
-  function password() {
-    if( $this->isAuthenticated() ) {
-      return $_SESSION['auth_pw'];
-    }
-    else return false;
-  }
+	function password() {
+		if( $this->isAuthenticated() ) {
+			return $_SESSION['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 ) {$_SESSION['auth_dn'] = $dn;}
+	function setUid( $uid ) {$_SESSION['auth_user'] = $uid;}
+	function setPassword( $pw ) {$_SESSION['auth_pw'] = $pw;}
 
-  function error() {
-    return $this->error_string;
-  }
+	function error() {
+		return $this->error_string;
+	}
 
-  var $error_string = false;
+	var $error_string = false;
 };
 /*
   Local variables:

Index: authenticate.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/authenticate.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- authenticate.php	17 May 2004 15:24:26 -0000	1.1
+++ authenticate.php	16 Dec 2004 21:03:29 -0000	1.2
@@ -21,7 +21,7 @@
 require_once('auth.class.php');
 global $auth;
 if( !isset($auth) ) {
-  $auth =& new KolabAuth;
+	$auth =& new KolabAuth;
 }
 /*
   Local variables:

Index: debug.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/debug.php,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- debug.php	28 May 2004 15:49:51 -0000	1.4
+++ debug.php	16 Dec 2004 21:03:29 -0000	1.5
@@ -1,21 +1,40 @@
 <?php
+/*
+ *  Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ *
+ *    Written by Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
+ *
+ *  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
+ *  (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 can view the  GNU General Public License, online, at the GNU
+ *  Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+ */
+
 function getmicrotime() { 
     list($usec, $sec) = explode(" ", microtime()); 
     return ((float)$usec + (float)$sec); 
 }
 function debug($str) {
-  #print $str.'<br/>';
+	#print $str.'<br/>';
 }
 function debug_var_dump($var) {
-  #print '<pre>';
-  #var_dump($var);
-  #print '</pre>';
+    #print '<pre>';
+    #var_dump($var);
+    #print '</pre>';
 }
 function backtrace() {
-  $debug_array = debug_backtrace();
-  $counter = count($debug_array);
-  for($tmp_counter = 0; $tmp_counter != $counter; ++$tmp_counter) {
-  ?>
+	$debug_array = debug_backtrace();
+	$counter = count($debug_array);
+	for($tmp_counter = 0; $tmp_counter != $counter; ++$tmp_counter) {
+	?>
  <table width="558" height="116" border="1" cellpadding="0" cellspacing="0" bordercolor="#000000">
     <tr>
     <td height="38" bgcolor="#D6D7FC"><font color="#000000">function <font color="#FF3300"><?
@@ -25,13 +44,13 @@
     $args_counter = count($debug_array[$tmp_counter]["args"]);
     //print them
     for($tmp_args_counter = 0; $tmp_args_counter != $args_counter; ++$tmp_args_counter) {
-      echo($debug_array[$tmp_counter]["args"][$tmp_args_counter]);
+		echo($debug_array[$tmp_counter]["args"][$tmp_args_counter]);
       
-      if(($tmp_args_counter + 1) != $args_counter) {
-	echo(", ");
-      } else {
-	echo(" ");
-      }
+		if(($tmp_args_counter + 1) != $args_counter) {
+			echo(", ");
+		} else {
+			echo(" ");
+		}
     }
     ?></font><font color="#FF3300">)</font></font></td></tr><tr>
     <td bgcolor="#5F72FA"><font color="#FFFFFF">{</font><br>
@@ -41,10 +60,20 @@
        <?php echo($debug_array[$tmp_counter]["line"]);?></font><br>
 	<font color="#FFFFFF">}</font></td></tr></table>
        <?php
-	if(($tmp_counter + 1) != $counter) {
-	  echo("<br>was called by:<br>");
+	   if(($tmp_counter + 1) != $counter) {
+		   echo("<br>was called by:<br>");
+	   }
 	}
-  }
-  //exit();
+	//exit();
 }
+
+/*
+  Local variables:
+  mode: php
+  indent-tabs-mode: t
+  tab-width: 4
+  buffer-file-coding-system: utf-8
+  End:
+  vim:encoding=utf-8:
+ */
 ?>

Index: form.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/form.class.php,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- form.class.php	18 Nov 2004 13:27:56 -0000	1.14
+++ form.class.php	16 Dec 2004 21:03:29 -0000	1.15
@@ -1,6 +1,6 @@
 <?php
 /*
- *  Copyright (c) 2004 KlarÃ��¿½ï¿½Â¤lvdalens Datakonsult AB
+ *  Copyright (c) 2004 Klarälvdalens Datakonsult AB
  *
  *    Writen by Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
  *

Index: headers.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/headers.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- headers.php	17 May 2004 15:24:26 -0000	1.1
+++ headers.php	16 Dec 2004 21:03:29 -0000	1.2
@@ -1,6 +1,6 @@
 <?php
 /*
- *  Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ *  Copyright (c) 2004 Klaralvdalens Datakonsult AB
  *
  *    Writen by Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
  *

Index: ldap.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/ldap.class.php,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- ldap.class.php	13 Dec 2004 09:35:29 -0000	1.18
+++ ldap.class.php	16 Dec 2004 21:03:29 -0000	1.19
@@ -1,6 +1,6 @@
 <?php
 /*
- *  Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ *  Copyright (c) 2004 Klarälvdalens Datakonsult AB
  *
  *    Written by Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
  *

Index: sieveutils.class.php
===================================================================
RCS file: /kolabrepository/server/kolab-webadmin/kolab-webadmin/php/admin/include/sieveutils.class.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- sieveutils.class.php	13 Dec 2004 13:21:16 -0000	1.2
+++ sieveutils.class.php	16 Dec 2004 21:03:29 -0000	1.3
@@ -1,4 +1,23 @@
 <?php
+/*
+ *  Copyright (c) 2004 Klarälvdalens Datakonsult AB
+ *
+ *    Written by Steffen Hansen <steffen at klaralvdalens-datakonsult.se>
+ *
+ *  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
+ *  (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 can view the  GNU General Public License, online, at the GNU
+ *  Project's homepage; see <http://www.gnu.org/licenses/gpl.html>.
+ */
+
 class SieveUtils {
   // Funny multiline string escaping in Sieve
   /*static*/ function dotstuff( $str ) {
@@ -75,4 +94,14 @@
     // TODO
   }
 };
+
+/*
+  Local variables:
+  mode: php
+  indent-tabs-mode: t
+  tab-width: 4
+  buffer-file-coding-system: utf-8
+  End:
+  vim:encoding=utf-8:
+ */
 ?>





More information about the commits mailing list