[feladat @ 292]
authorrejo
Fri, 11 Jul 2008 08:02:01 +0000
changeset 184 b60b88b1ae08
parent 183 aae57715199e
child 185 6baa2f78d3fe
[feladat @ 292] Fixed a number of undefined variable errors in PHP. Fixed an omission in r291.
edit_user.php
inc/users.inc.php
--- a/edit_user.php	Fri Jul 11 07:44:10 2008 +0000
+++ b/edit_user.php	Fri Jul 11 08:02:01 2008 +0000
@@ -34,7 +34,7 @@
 	error(ERR_INV_INPUT);
 } elseif (($edit_id == $_SESSION["userid"] && $perm_edit_own == "1") || ($edit_id != $_SESSION["userid"] && $perm_edit_others == "1" )) {
 
-	if($_POST["commit"]) {
+	if(isset($_POST["commit"])) {
 
 		$i_username = "-1";
 		$i_fullname = "-1";
--- a/inc/users.inc.php	Fri Jul 11 07:44:10 2008 +0000
+++ b/inc/users.inc.php	Fri Jul 11 08:02:01 2008 +0000
@@ -81,11 +81,11 @@
 function list_permission_templates() {
 	global $db;
 	$query = "SELECT * FROM perm_templ";
-	$result = $db->query($query);
+	$response = $db->query($query);
 	if (PEAR::isError($response)) { error($response->getMessage()); return false; }
 
 	$template_list = array();
-	while ($template= $result->fetchRow()) {
+	while ($template= $response->fetchRow()) {
 		$tempate_list[] = array(
 			"id"	=>	$template['id'],
 			"name"	=>	$template['name'],
@@ -292,11 +292,11 @@
 		// username already exists.
 
 		$query = "SELECT username FROM users WHERE id = " . $db->quote($id);
-		$result = $db->query($query);
+		$response = $db->query($query);
 		if (PEAR::isError($response)) { error($response->getMessage()); return false; }
 
 		$usercheck = array();
-		$usercheck = $result->fetchRow();
+		$usercheck = $response->fetchRow();
 
 		if ($usercheck['username'] != $user) {
 			
@@ -331,7 +331,7 @@
 
 		$query .= " WHERE id = " . $db->quote($id) ;
 
-		$result = $db->query($query);
+		$response = $db->query($query);
 		if (PEAR::isError($response)) { error($response->getMessage()); return false; }
 		
 	} else {
@@ -495,10 +495,10 @@
 			. $sql_add . "
 			ORDER BY username";
 
-	$result = $db->query($query);
+	$response = $db->query($query);
 	if (PEAR::isError($response)) { error($response->getMessage()); return false; }
 	
-	while ($user = $result->fetchRow()) {
+	while ($user = $response->fetchRow()) {
 		$userlist[] = array(
 			"uid"		=>	$user['uid'],
 			"username"	=>	$user['username'],
@@ -535,11 +535,11 @@
 			FROM perm_items" 
 			. $limit . "
 			ORDER BY descr";
-	$result = $db->query($query);
+	$response = $db->query($query);
 	if (PEAR::isError($response)) { error($response->getMessage()); return false; }
 
 	$permission_list = array();
-	while ($permission = $result->fetchRow()) {
+	while ($permission = $response->fetchRow()) {
 		if ($return_name_only == false) {
 			$permission_list[] = array(
 				"id"	=>	$permission['id'],
@@ -661,6 +661,7 @@
 
 	verify_permission('user_edit_own') ? $perm_edit_own = "1" : $perm_edit_own = "0" ;
 	verify_permission('user_edit_others') ? $perm_edit_others = "1" : $perm_edit_others = "0" ;
+	verify_permission('templ_perm_edit') ? $perm_templ_perm_edit = "1" : $perm_templ_perm_edit = "0" ;
 
 	if (($details['uid'] == $_SESSION["userid"] && $perm_edit_own == "1") || 
 			($details['uid'] != $_SESSION["userid"] && $perm_edit_others == "1" )) {
@@ -721,8 +722,7 @@
 
 		}
 
-		// TODO Check if function works if password is set too.
-		if($details['password'] != "") {
+		if(isset($details['password']) && $details['password'] != "") {
 			$query .= ", password = '" . md5($db->quote($details['password'])) . "' ";
 		}