inc/users.inc.php
changeset 89 61c49e66c9b0
parent 85 1687c1b107fa
child 109 34b2d49f52c6
equal deleted inserted replaced
88:fa948cc3727e 89:61c49e66c9b0
   228 		if (PEAR::isError($response)) { error($response->getMessage()); return false; }
   228 		if (PEAR::isError($response)) { error($response->getMessage()); return false; }
   229 	}
   229 	}
   230 	return true;
   230 	return true;
   231 }
   231 }
   232 
   232 
       
   233 function delete_perm_templ($ptid) {
       
   234 
       
   235 	global $db;
       
   236 	if (!(verify_permission(user_edit_templ_perm))) {
       
   237 		error(ERR_PERM_DEL_PERM_TEMPL);
       
   238 	} else {
       
   239 		$query = "SELECT id FROM users WHERE perm_templ = " . $ptid;
       
   240 		$result = $db->query($query);
       
   241 		if (PEAR::isError($result)) { error($response->getMessage()); return false; }
       
   242 
       
   243 		if($result->numRows() > 0) {
       
   244 			error(ERR_PERM_TEMPL_ASSIGNED);
       
   245 			return false;
       
   246 		} else {
       
   247 			$query = "DELETE FROM perm_templ_items WHERE templ_id = " . $ptid;
       
   248 			$result = $db->query($query);
       
   249 			if (PEAR::isError($result)) { error($response->getMessage()); return false; }
       
   250 
       
   251 			$query = "DELETE FROM perm_templ WHERE id = " . $ptid;
       
   252 			$result = $db->query($query);
       
   253 			if (PEAR::isError($result)) { error($response->getMessage()); return false; }
       
   254 
       
   255 			return true;
       
   256 		}
       
   257 	}
       
   258 }
   233 
   259 
   234 /*
   260 /*
   235  * Edit the information of an user.. sloppy implementation with too many queries.. (2) :)
   261  * Edit the information of an user.. sloppy implementation with too many queries.. (2) :)
   236  * return values: true if succesful
   262  * return values: true if succesful
   237  */
   263  */
   535 			WHERE perm_templ.id = " . $db->quote($templ_id);
   561 			WHERE perm_templ.id = " . $db->quote($templ_id);
   536 
   562 
   537 	$result = $db->query($query);
   563 	$result = $db->query($query);
   538 	if (PEAR::isError($response)) { error($response->getMessage()); return false; }
   564 	if (PEAR::isError($response)) { error($response->getMessage()); return false; }
   539 
   565 
   540 	while($details = $result->fetchRow()) {
   566 	$details = $result->fetchRow(); 
   541 		$detail_list[] = array (
   567 	return $details;
   542 			"name"	=>	$details['name'],
       
   543 			"descr"	=>	$details['descr']
       
   544 			);
       
   545 	}
       
   546 	return $detail_list;
       
   547 }	
   568 }	
   548 
   569 
   549 
   570 
   550 // Get a list of all available permission templates.
   571 // Get a list of all available permission templates.
   551 
   572