inc/users.inc.php
changeset 184 b60b88b1ae08
parent 183 aae57715199e
child 188 4066e4c0de01
--- 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'])) . "' ";
 		}