Hi,
I stumbled upon some NOTICE errors while hacking on a hook on password
changes. See attachment.

(This is my first phpgw patch - yay!)
Index: preferences/changepassword.php
===================================================================
RCS file: /sources/phpgroupware/preferences/changepassword.php,v
retrieving revision 1.44
diff -u -8 -p -r1.44 changepassword.php
--- preferences/changepassword.php	18 Sep 2006 09:34:00 -0000	1.44
+++ preferences/changepassword.php	10 Jun 2007 10:23:49 -0000
@@ -15,20 +15,20 @@
 		'currentapp' => 'preferences'
 	);
 
 	/**
 	 * Include phpgroupware header
 	 */
 	include('../header.inc.php');
 
-	$n_passwd   = $_POST['n_passwd'];
-	$n_passwd_2 = $_POST['n_passwd_2'];
+	$n_passwd   = @$_POST['n_passwd'];
+	$n_passwd_2 = @$_POST['n_passwd_2'];
 
-	if (! $GLOBALS['phpgw']->acl->check('changepassword', 1) || $_POST['cancel'])
+	if (! $GLOBALS['phpgw']->acl->check('changepassword', 1) || isset($_POST['cancel']))
 	{
 		$GLOBALS['phpgw']->redirect_link('/preferences/index.php');
 		$GLOBALS['phpgw']->common->phpgw_exit();
 	}
 
 	$GLOBALS['phpgw']->template->set_file(array(
 		'form' => 'changepassword.tpl'
 	));
@@ -39,29 +39,31 @@
 	$GLOBALS['phpgw']->template->set_var('form_action',$GLOBALS['phpgw']->link('/preferences/changepassword.php'));
 
 	if ($GLOBALS['phpgw_info']['server']['auth_type'] != 'ldap')
 	{
 		$GLOBALS['phpgw']->template->set_var('sql_message',lang('note: This feature does *not* change your email password. This will '
 			. 'need to be done manually.'));
 	}
 
-	if ($_POST['change'])
+	if (isset($_POST['change']))
 	{
+		$errors = array();
+
 		if ($n_passwd != $n_passwd_2)
 		{
 			$errors[] = lang('The two passwords are not the same');
 		}
 
 		if (! $n_passwd)
 		{
 			$errors[] = lang('You must enter a password');
 		}
 
-		if (is_array($errors))
+		if (count($errors))
 		{
 			$GLOBALS['phpgw']->common->phpgw_header();
 			echo parse_navbar();
 			$GLOBALS['phpgw']->template->set_var('messages',$GLOBALS['phpgw']->common->error_list($errors));
 			$GLOBALS['phpgw']->template->pfp('out','form');
 			$GLOBALS['phpgw']->common->phpgw_exit(True);
 		}
 
_______________________________________________
phpGroupWare-developers mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/phpgroupware-developers

Reply via email to