Location: PHPKode > projects > Epiware Document Management > Epiware_4.8.6/epi/manage_users_save_users.php
<?
/******************************************************************************
Epiware: Project and Document Management
http://www.epiware.com
Copyright (C) 2006 James Kern

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version. 

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. 

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Epiware, Inc. and Praxis Inc, hereby disclaims all copyright
interest in the program 'Epiware' written
by James Kern, Edward Kline, Ryan Gilfether, Ray Gorospe, Patrick Waddingham

06 September 2006
James Kern, President of Epiware 
Jack Chapman, President of Praxis
*****************************************************************************/ 
include("./module_prepend.php");
include("./obj_array_functions.inc.php");
if(!is_root($user_id,$db))
{
	exit;	
}
header("Content-type: text/xml");
echo"<?xml version='1.0' encoding='UTF-8'?>
<result>
";

$postObj = get_object_from_array($_POST,"tgt_");

if($postObj->realm_id > 0)
{
	$realm = new realms();
	$realm->get($postObj->realm_id,$db);
	while(list($i,$userid)=each($_POST["selected_users"]))
	{
		$ru = new realm_user();
		$ru->realm_id = $realm->realm_id;
		$ru->group_id = $realm->group_id;
		$ru->user_id = $userid;
		
		$value = $ru->insert_into_non_key_realm($db);
		echo "<success value='$value' uid='".$ru->user_id."' rid='".$ru->realm_id."'></success>";
	}		
	
}
else if($postObj->group_id > 0)
{ 
	//get key realm
	
	$key_realm = return_object(realms::get_by_key_realm($postObj->group_id,'1',$db),true);
	if($key_realm->realm_id > 0)
	{
		while(list($i,$userid)=each($_POST["selected_users"]))
		{
			$ru = new realm_user();
			$ru->realm_id = $key_realm->realm_id;
			$ru->group_id = $key_realm->group_id;
			$ru->user_id = $userid;
			
			$value = $ru->insert($db);	
			echo "<success value='$value' uid='".$ru->user_id."' rid='".$ru->realm_id."'></success>";
		}	
		
	}	
	else 
	{
		echo "<error message='No target web group or member group provided.'></error>";		
	}
}
else 
{
	
	echo "<error message='No target web group or member group provided.'></error>";	
}

echo "
</result>
";
?>
Return current item: Epiware Document Management