inc/users.inc.php
changeset 85 1687c1b107fa
parent 83 90fbb34b3d97
child 89 61c49e66c9b0
equal deleted inserted replaced
84:c8ebeadd438e 85:1687c1b107fa
   566 	}
   566 	}
   567 	return $perm_templ_list;
   567 	return $perm_templ_list;
   568 }
   568 }
   569 
   569 
   570 
   570 
       
   571 // Add a permission template.
       
   572 
       
   573 function add_perm_templ($details) {
       
   574 	global $db;
       
   575 
       
   576 	// Fix permission template name and description first. 
       
   577 
       
   578 	$query = "INSERT INTO perm_templ 
       
   579 			VALUES (
       
   580 				'', " 
       
   581 				. $db->quote($details['templ_name']) . ", " 
       
   582 				. $db->quote($details['templ_descr']) . ")";
       
   583 
       
   584 	$result = $db->query($query);
       
   585 	if (PEAR::isError($response)) { error($response->getMessage()); return false; }
       
   586 
       
   587 	$perm_templ_id = $db->lastInsertId('perm_templ', 'id');
       
   588 
       
   589 	foreach ($details['perm_id'] AS $perm_id) {
       
   590 		$r_insert_values[] = "(''," . $db->quote($perm_templ_id) . "," . $db->quote($perm_id) . ")";
       
   591 	}
       
   592 	$query = "INSERT INTO perm_templ_items VALUES " . implode(',', $r_insert_values) ;
       
   593 	$result = $db->query($query);
       
   594 	if (pear::iserror($response)) { error($response->getmessage()); return false; }
       
   595 
       
   596 	return true;
       
   597 }
       
   598 
   571 // Update all details of a permission template.
   599 // Update all details of a permission template.
   572 
   600 
   573 function update_perm_templ_details($details) {
   601 function update_perm_templ_details($details) {
   574 	global $db;
   602 	global $db;
   575 
   603