コード例 #1
0
ファイル: login.php プロジェクト: BackupTheBerlios/murrix-svn
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		if (!empty($args))
		{
			switch ($this->stage)
			{
				case 1:
					if (!login($this->username, $args))
					{
						$stderr = ucf(i18n("login failed")).". ".ucf(i18n("please try again"));
					}
					else
					{
						$system->triggerEventIntern("login", array());
						//$response->addScript("window.location.reload()");
						
						$user = new mUser();
						$user->setByUsername($this->username);
						
						$stdout = $user->name." ".i18n("logged in successfully");
					}
					
					$this->stage = 0;
					return true;
			}
			
			$this->username = $args;
			$stdout = ucf(i18n("password:"******"document.getElementById('cmdline').type='password';");
			return false;
		}
		return true;
	}
コード例 #2
0
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		if (!isAdmin())
		{
			$stderr = ucf(i18n("not enough rights to add user to group"));
			return true;
		}
		
		if (empty($args))
		{
			$stdout = "Usage: gadduser [group] [username]\n";
			$stdout .= "Example: gadduser admins admin";
		}
		else
		{
			list($groupname, $username) = explode(" ", $args);
			$user = new mUser();
			$user->setByUsername($username);
			
			if ($user->id <= 0)
			{
				$stderr = ucf(i18n("no user named"))." $username ".i18n("found");
				return true;
			}
			
			$group = new mGroup();
			$group->setByName($groupname);
			
			if ($group->id <= 0)
			{
				$stderr = ucf(i18n("no group named"))." $groupname ".i18n("found");
				return true;
			}
			
			$user_groups = $user->getGroups();
			
			if (in_array($groupname, $user_groups))
			{
				$stderr = $username." ".i18n("is already a member of")." $groupname";
				return true;
			}
			
			$user->groups .= " $groupname";
			$user->save();
			
			$stdout = ucf(i18n("added"))." $username ".i18n("to")." $groupname";
		}
		
		return true;
	}
コード例 #3
0
	function getList()
	{
		$users = $this->get();
		
		$list = array();
		foreach ($users as $user)
		{
			$u = new mUser();
			$u->setByArray($user);
			$list[] = $u;
		}
		
		return $list;
	}
コード例 #4
0
ファイル: index.php プロジェクト: StudsPro/islandpeeps.com
    echo __('files_lsttit_user');
    ?>
</td>
                                <th><center><?php 
    echo __('files_lsttit_public');
    ?>
</center></th>
			    </tr>
			</thead>
			<tbody>
			    <?php 
    foreach ($files as $file) {
        ?>
			    <?php 
        if (empty($file->uploadRequest)) {
            $_user = mUser::getUser($file->fileUploadBy)->companyName;
            if (isset($_user) && !empty($_user)) {
                $_lbl_user = $_user;
            } else {
                $_lbl_user = '******';
            }
        } else {
            $_lbl_user = __('dash_txt_uprequest');
        }
        if ($file->filePublic == '0') {
            $_icon = 'icon-lock icon-large';
        } else {
            $_icon = 'icon-unlock icon-large';
        }
        ?>
			    <tr data-file-id="<?php 
コード例 #5
0
ファイル: details.php プロジェクト: StudsPro/islandpeeps.com
echo __('files_lbl_uploadby');
?>
</label>
		    <div class="controls">
			<?php 
if ($details->fileUploadBy == 'UPLOADREQUEST') {
    ?>
			<p><?php 
    echo __('files_txt_uploadrequest') . ' (' . $details->uploadRequest . ')';
    ?>
</p>
			<?php 
} else {
    ?>
			<p><?php 
    echo mUser::getUser($details->fileUploadBy)->companyName;
    ?>
</p>
			<?php 
}
?>
		    </div>
		</div>
		
		<div class="control-group">
		    <label class="control-label"><?php 
echo __('files_lbl_tags');
?>
</label>
		    <div class="controls">
			<input type="text" name="tags" placeholder="Tag" class="tagManager span1" /><br /><br />
コード例 #6
0
ファイル: user.php プロジェクト: BackupTheBerlios/murrix-svn
function createUser($name, $username, $password, $email, $groups, $create_home = true)
{
	if (!isAdmin)
		return ucf(i18n("not enough rights to create new user"));

	if (empty($name))
		return ucf(i18n("a name must be specified"));
		
	if (empty($username))
		return ucf(i18n("a username must be specified"));

	$user = new mUser();
	$user->setByUsername($username);

	if ($user->id > 0)
		return ucf(i18n("a user with that username already exists"));
		
	$group = new mGroup();
	$group->setByName($username);
	if ($group->id > 0)
		$group_id = $group->id;
	else
		$group_id = createGroup($username, "This is the group of $name", false);
		
	$group = new mGroup($group_id);
	$groups = $group->name." $groups";
	$groups = trim($groups);

	$user->name = $name;
	$user->username = $username;
	$user->password = md5($password);
	$user->groups = $groups;
	$user->email = $email;
	$ret = $user->save();
	
	if ($create_home && getNode("/root/home/users/".$username) <= 0)
	{
		$home = new mObject();
		$home->setClassName("folder");
		$home->loadVars();
	
		$home->name = $username;
		$home->language = $_SESSION['murrix']['language'];
		$home->rights = "$username=rc";
	
		$home->setVarValue("description", "This is the home of $name");
	
		if ($home->save())
		{
			$home->setMeta("initial_rights", "$username=rwc");
			$home_folder = new mObject(getNode("/root/home/users"));
			$home->linkWithNode($home_folder->getNodeId());
		}
		else
		{
			$message = "Operation unsuccessfull.<br/>";
			$message .= "Error output:<br/>";
			$message .= $home->getLastError();
			return $message;
		}
		
		$user->home_id = $home->getNodeId();
		$user->save();
	}

	return $ret;
}
コード例 #7
0
ファイル: chown.php プロジェクト: BackupTheBerlios/murrix-svn
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		if (!empty($args))
		{
			$args_split = splitArgs($args);
			list($ug, $path, $recursive) = $args_split;
			
			list($username, $groupname) = explode(".", $ug);
			
			if ($path{0} != "/")
				$path = $_SESSION['murrix']['path']."/$path";
				
			$node_id = getNode($path);
			
			if ($node_id <= 0)
			{
				$stderr = ucf(i18n("no such path"))." $path";
				return true;
			}
			else
				$object = new mObject($node_id);
			
			$user = new mUser();
			$user->setByUsername($username);
			
			if ($user->id <= 0)
			{
				$stderr = ucf(i18n("no such user"));
				return true;
			}
			
			$group_id = 0;
			if (!empty($groupname))
			{
				$group = new mGroup();
				$group->setByName($groupname);
				
				if ($group->id <= 0)
				{
					$stderr = ucf(i18n("no such group"));
					return true;
				}
				$group_id = $group->id;
			}
			
			if (!(isAdmin() || $object->hasRight("write")))
			{
				$stderr .= ucf(i18n("not enough rights to change ownership on"))." ".$object->getPathInTree();
			}
			else
			{
				if ($recursive == "-r" || $recursive == "-R")
				{
					$stderr = $this->setOwnerOnObjectsRecursive($object, $stdout, $stderr, $user->id, $group_id);
				}
				else
				{
					$object->setUserId($user->id);
				
					if ($group_id > 0)
						$object->setGroupId($group_id);
					
					if ($object->saveCurrent())
						$stdout = "";//ucf(i18n("changed ownership successfully on"))." ".$object->getPathInTree();
					else
						$stderr = ucf(i18n("failed to change ownership on"))." ".$object->getPathInTree();
				}
				
				
			}
		}
		else
		{
			$stdout = "Usage: chown [username].[groupname] [path] [-R]\n";
			$stdout .= "Example: chown admin.admins /root";
		}
		
		return true;
	}
コード例 #8
0
ファイル: upass.php プロジェクト: BackupTheBerlios/murrix-svn
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		switch ($this->stage)
		{
			case 1:
				$this->password1 = $args;
				$stdout = ucf(i18n("enter new password again:"));
				$system->addJSScript("document.getElementById('cmdline').type='password';");
				$this->stage = 2;
				return false;
				
			case 2:
				if ($this->password1 != $args)
					$stdout = ucf(i18n("passwords do not match, aborting"));
				else
				{
					$ret = changePassword($this->user_node_id, $args);
					if ($ret !== true)
					{
						$stderr = $ret;
						$this->stage = 0;
						return true;
					}
					else
					{
						$user = new mUser($this->user_node_id);
						$stdout = ucf(i18n("successfully changed password for"))." ".$user->name;
					}
				}
				
				$this->stage = 0;
				return true;
		
		}
		
		if (empty($args))
			$this->user_node_id = $_SESSION['murrix']['user']->id;
		else
		{
			$user = new mUser();
			
			if (!$user->setByUsername($args))
			{
				$stderr = ucf(i18n("No such user"));
				return true;
			}
			
			if (!(($user_node_id == $_SESSION['murrix']['user']->id || isAdmin()) && !isAnonymous()))
			{
				$stderr = ucf(i18n("not enough rights to change password for user"));
				return true;
			}
			
			$this->user_node_id = $user->id;
		}
		
		$stdout = ucf(i18n("enter new password:"******"document.getElementById('cmdline').type='password';");
		$this->stage = 1;
		return false;
	}
コード例 #9
0
	function parseXML($args)
	{
		// Instantiate the serializer
		$Unserializer = &new XML_Unserializer();
		
		// Serialize the data structure
		$status = $Unserializer->unserialize($args['data']);
		
		// Check whether serialization worked
		if (PEAR::isError($status))
			die($status->getMessage());
		
		// Display the PHP data structure
		$import_data = $Unserializer->getUnserializedData();
		
		$parent = new mObject($args['node_id']);
		
		$logtext = "";
	
		if (isset($import_data['version']))
			$logtext .= "Version: ".$import_data['version']."<br/>";
		
		if (isset($import_data['name']))
			$logtext .= "Created: ".$import_data['created']."<br/>";
		
		if (isset($import_data['name']))
			$logtext .= "Name: ".$import_data['name']."<br/>";
			
		if (isset($import_data['description']))
			$logtext .= "Description: ".$import_data['description']."<br/>";
		
		$imported_classes = array();
		$imported_nodes = array();
		$imported_links = array();
		$imported_users = array();
		$imported_groups = array();
		
		if (isset($import_data['container']['xmldata']))
			$import_data['container'] = array($import_data['container']);
		
		foreach ($import_data['container'] as $container)
		{
			switch ($container['xmldata'])
			{
				case "node":
				$imported_nodes[] = $container;
				break;
				
				case "class":
				$imported_classes[] = $container;
				break;
				
				case "link":
				$imported_links[] = $container;
				break;
				
				case "user":
				$imported_users[] = $container;
				break;
				
				case "group":
				$imported_groups[] = $container;
				break;
			}
			
		}
		
		if (count($imported_classes) > 0)
			$logtext .= "Found ".count($imported_classes)." classes<br/>";
		if (count($imported_nodes) > 0)
			$logtext .= "Found ".count($imported_nodes)." nodes<br/>";
		if (count($imported_links) > 0)
			$logtext .= "Found ".count($imported_links)." links<br/>";
		if (count($imported_users) > 0)
			$logtext .= "Found ".count($imported_users)." users<br/>";
		if (count($imported_groups) > 0)
			$logtext .= "Found ".count($imported_groups)." groups<br/>";
		
		$class_table = new mTable("classes");
		$vars_table = new mTable("vars");
		$initial_meta_table = new mTable("initial_meta");
		
		foreach ($imported_classes as $class)
		{
			$logtext .= "Checking database for existing class ".$class['name']."<br/>";
			
			$existing_class = $class_table->get("`name`='".$class['name']."'");
			
			if (count($existing_class) == 0)
			{
				$logtext .= "No existing class named ".$class['name']." found, creating<br/>";
				
				$class_table->insert(array("name"=>$class['name'], "default_icon"=>$class['icon']));
				
				if (count($class['variables']) > 0)
				{
					foreach ($class['variables'] as $varname => $properties)
						$vars_table->insert(array("class_name"=>$class['name'], "name"=>$varname, "priority"=>$properties['priority'], "required"=>$properties['required'], "type"=>$properties['type'], "extra"=>$properties['extra'], "comment"=>$properties['comment']));
				}
				
				if (count($class['metadata']) > 0)
				{
					foreach ($class['metadata'] as $name => $value)
						$initial_meta_table->insert(array("class_name"=>$class['name'], "name"=>$name, "value"=>$value));
				}
				
				continue;
			}
			else
				$logtext .= "Class named ".$class['name']." found, checking variables<br/>";
			
			$class_object = new mObject();
			$class_object->setClassName($class['name']);
			$class_object->loadVars();
			
			foreach ($class['variables'] as $varname => $properties)
			{
				if ($class_object->checkVarExistance($varname) == 0)
				{
					$logtext .= "Could not resolve - $varname, skipping, this data will be ignored!<br/>";
					continue;
				}
			}
		}
		
		$nodes_to_link = array();
		$id_conversion = array();
		$added_node_ids = array();
		$linked_node_ids = array();
		
		$node_table = new mTable("nodes");
		
		foreach ($imported_nodes as $container)
		{
			if (!isset($container['created']))
				$container['created'] = date("Y-m-d H:i:s");
		
			if (isset($container['rights']))
				$rights = $container['rights'];
			else
				$rights = $parent->getRights();
		
			$node_id = $node_table->insert(array("created" => $container['created'], "rights" => $rights));
			
			$node = new mObject();
			$node->node_id = $node_id;
			
			$id_conversion[$container['id']] = $node_id;
			$added_node_ids[] = $node_id;
			
			if (is_array($container['metadata']))
			{
				foreach ($container['metadata'] as $key => $value)
				{
					$node->setMeta($key, $value);
					$logtext .= "Created metadata name=".$key.", value=".$value.", node_id=".$node_id."<br/>";
				}
			}
			
			foreach ($container['objects'] as $object_array)
			{
				$object = new mObject();
				$object->setClassName($object_array['class_name']);
				$object->loadVars();
				
				if (!isset($object_array['created']))
					$object_array['created'] = date("Y-m-d H:i:s");
				
				$object->node_id = $node_id;
				
				if (!empty($object_array['created']))
					$object->created = $object_array['created'];
				else
					$object->created = date("Y-m-d H:i:s");
					
				if (!empty($object_array['version']))
					$object->version = $object_array['version'];
				else
					$object->version = 1;
					
				$object->class_name = $object_array['class_name'];
				$object->name = $object_array['name'];
				$object->icon = $object_array['icon'];
				$object->language = $object_array['language'];
				
				if (isset($object_array['user']))
				{
					$user = new mUser();
					$user->setByUsername($object_array['user']);
					$object->user_id = $user->id;
				}
				else
					$object->user_id = $_SESSION['murrix']['user']->id;
				
				if (is_array($object_array['variables']))
				{
					foreach ($object_array['variables'] as $key => $value)
					{
						if ($object->checkVarExistance($key) == 0)
						{
							$logtext .= "Could not resolve - $key, skipping<br/>";
							continue;
						}
						
						if (!is_array($value['value']))
							$value['value'] = html_entity_decode($value['value']);
							
						if ($value['type'] == "file")
						{
							$extension = strtolower(pathinfo($value['value'], PATHINFO_EXTENSION));
							$oldfile = $args['filepath']."/".$value['fileid'].".$extension";
							
							if (!file_exists($oldfile))
								$logtext .= "Could not find file - $oldfile, skipping<br/>";
							else
								$object->setVarValue($key, $value['value'].":$oldfile");
						}
						else if ($value['type'] == "thumbnail")
						{
							if (!empty($value['thumb_id']))
							{
								$oldfile = $args['thumbpath']."/".$value['fileid'].".jpg";
								
								if (!file_exists($oldfile))
									$logtext .= "Could not find thumbfile - $oldfile, skipping<br/>";
								else
									$object->setVarValue($key, $value['fileid'].".jpg:$oldfile");
							}
						}
						else
							$object->setVarValue($key, $value['value']);
					}
				}
				
				$object->save(true);
				guessObjectType($object);
				$logtext .= "Created object name=".$object->name.", node_id=$node_id, id=".$object->id.",version=".$object->version.",language=".$object->language."<br/>";
			}
		}
		
		$link_table = new mTable("links");
		
		foreach ($imported_links as $container)
		{
			$link_array = array();
			$link_array['node_top'] = $id_conversion[$container['node_top']];
			$link_array['node_bottom'] = $id_conversion[$container['node_bottom']];
			$link_array['type'] = $container['type'];
			
			$link_table->insert($link_array);
			$logtext .= "Linked node_top=".$link_array['node_top']." to node_bottom=".$link_array['node_bottom'].", type=".$link_array['type']."<br/>";
			
			if ($link_array['type'] == "sub")
				$linked_node_ids[] = $id_conversion[$container['node_bottom']];
		}
		
		$added_node_ids = array_unique($added_node_ids);
		$linked_node_ids = array_unique($linked_node_ids);
		
		$node_ids_to_link = array_diff($added_node_ids, $linked_node_ids);
		
		foreach ($node_ids_to_link as $node_id)
		{
			$link_array = array();
			$link_array['node_top'] = $args['node_id'];
			$link_array['node_bottom'] = $node_id;
			$link_array['type'] = "sub";
			
			$link_table->insert($link_array);
			$logtext .= "Linked node_top=".$link_array['node_top']." to node_bottom=".$link_array['node_bottom'].", type=".$link_array['type']."<br/>";
		}
		
		return mMsg::add("mXml::parseXML", $logtext, false);
	}
コード例 #10
0
ファイル: usend.php プロジェクト: BackupTheBerlios/murrix-svn
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		if (isAnonymous())
		{
			$stderr = ucf(i18n("anonymous user can not send messages"));
			return true;
		}
		
		switch ($this->stage)
		{
			case 1:
				$this->username = $args;
				$stdout = "$args\n";
				$stdout .= ucf(i18n("subject:"));
				$this->stage = 2;
				return false;
				
			case 2:
				$this->subject = $args;
				$stdout = "$args\n".ucf(i18n("message:"));
				$this->stage = 3;
				return false;
				
			case 3:
				$this->message = $args;
				$stdout = "$args\n".ucf(i18n("attachment:"));
				$this->stage = 4;
				return false;
			
			case 4:
				$this->attachment = $args;
				$stdout = "$args\n".ucf(i18n("are you sure you want to send message"))." (Y/n)?";
				$this->stage = 5;
				return false;
			
			case 5:
				if (empty($args) || strtolower($args) == "y" || strtolower($args) == "yes")
				{
					$user = new mUser();
					$user->setByUsername($this->username);
					
					if ($user->id <= 0)
					{
						$stderr = ucf(i18n("no such user"))." - ".$this->username;
						$this->stage = 0;
						return true;
					}
					
					if (!$user->sendMessage($this->subject, $this->message, $this->attachment))
					{
						$stderr = ucf(i18n("failed to send message"));
						$this->stage = 0;
						return true;
					}
					
					$stdout = ucf(i18n("sent message successfully"));
					$this->stage = 0;
					return true;
				}
				
				$stdout = ucf(i18n("aborted by user"));
				$this->stage = 0;
				return true;
		}
		
		if (empty($args))
		{
			$stdout = ucf(i18n("to:"));
			$this->stage = 1;
		}
		else
		{
			$this->username = $args;
			$stdout .= ucf(i18n("subject:"));
			$this->stage = 2;
		}
		
		
		return false;
	}
コード例 #11
0
"><?php 
echo __('copy_to_clipboard');
?>
</a></small>
		</p>
	    </div>
	</div>

	<div class="control-group">
	    <label class="control-label"><?php 
echo __('pub_lbl_created');
?>
</label>
	    <div class="controls">
		<p><?php 
echo mUser::getUser($details->userUniqueID)->companyName;
?>
</p>
	    </div>
	</div>

	<div class="control-group">
	    <label class="control-label"><?php 
echo __('pub_lbl_message');
?>
</label>
	    <div class="controls">
		<p><?php 
echo $details->publicMessage != NULL ? nl2br(stripslashes($details->publicMessage)) : __('pub_txt_none');
?>
</p>
コード例 #12
0
			    <?php 
            echo implode(', ', $_short) . ' <strong>' . __('pub_txt_more', count($_files) - count($_short)) . '</strong>';
            ?>
			    <?php 
        } else {
            ?>
			    <?php 
            echo implode(', ', $_files);
            ?>
			    <?php 
        }
        ?>
</small>
			</td>
			<td><?php 
        echo mUser::getUser($item->userUniqueID)->companyName;
        ?>
</td>
			<td><?php 
        echo $item->publicPassword != NULL ? __('pub_txt_passyes') : __('pub_txt_passno');
        ?>
</td>
			<td><?php 
        echo $item->publicLimit != NULL ? cvTZ($item->publicLimit) : __('pub_txt_passno');
        ?>
</td>
			<td class="tac">
			    <a href="<?php 
        echo site_url('admin/publinks/published_entry?is=' . $item->published . '&entry=' . $item->publicUniqueID);
        ?>
">
コード例 #13
0
	function execute(&$system, $args)
	{
		global $abspath, $wwwpath, $db_prefix;

		if ($args['action'] == "import" && isAdmin())
		{
			if (empty($args['node_id']))
			{
				$system->addAlert(ucf(i18n("you must specifiy a node")));
				return;
			}
			
			if (empty($args['file']))
			{
				$system->addAlert(ucf(i18n("you must upload a file to import")));
				return;
			}
			
			list($filename, $full_filename) = explode(":", $args['file']);
			
			ob_start();
			
			$xml = new mXml();
			
			echo ucf(i18n("log"))."<br/><hr/>";
			
			$data = "";
			
			$extension = pathinfo($filename, PATHINFO_EXTENSION);
			if ($extension == "bz2")
			{
				echo "Found bz2-compressed file.<br/>";
				$bz = bzopen($full_filename, "r");
				while (!feof($bz))
					$data .= bzread($bz, 4096);
				bzclose($bz);
			}
			else
			{
				echo "Found uncompressed file.<br/>";
				$bz = fopen($full_filename, "r");
				while (!feof($bz))
					$data .= fread($bz, 4096);
				fclose($bz);
			}
			
			$import_data = $xml->parseBackupXML($data);
			
			
			
			if (isset($import_data['verion']))
				echo "Version: ".$import_data['verion']."<br/>";
			
			if (isset($import_data['name']))
				echo "Created: ".$import_data['created']."<br/>";
			
			if (isset($import_data['name']))
				echo "Name: ".$import_data['name']."<br/>";
				
			if (isset($import_data['description']))
				echo "Description: ".$import_data['description']."<br/>";
			
			$this->imported_classes = array();
			$this->imported_nodes = array();
			$this->imported_links = array();
			
			//PrintPre($import_data['container']);
			
			foreach ($import_data['container'] as $container)
			{
				$xmldata = $container['xmldata'];
				unset($container['xmldata']);
				//PrintPre($container);
				//echo "<hr/>";
				switch ($xmldata)
				{
					case "node":
					$this->imported_nodes[] = $container;
					break;
					
					case "class":
					$this->imported_classes[] = $container;
					break;
					
					case "link":
					$this->imported_links[] = $container;
					break;
				}
			}
			
			$class_table = new mTable("classes");
			$vars_table = new mTable("vars");
			
			foreach ($this->imported_classes as $class)
			{
				echo "Checking database for existing class ".$class['name']."<br/>";
				
				$existing_class = $class_table->get("`name`='".$class['name']."'");
				
				if (count($existing_class) == 0)
				{
					echo "<span style=\"color:red\">No existing class named ".$class['name']." found</span><br/>";
					continue;
				}
				else
					echo "<span style=\"color:green\">Class named ".$class['name']." found, checking variables</span><br/>";
				
				$existing_vars = $vars_table->get("`class_name`='".$class['name']."'");
				
				foreach ($class['vars'] as $varname => $properties)
				{
					$found = false;
					foreach ($existing_vars as $existing_var)
					{
						if ($existing_var['name'] == $varname)
						{
							$found = true;
							break;
						}
					}
					
					if ($found)
						echo "<span style=\"color:green\">Found matching var named $varname, type ".$properties['type']."</span><br/>";
					else
						echo "<span style=\"color:red\">No matching var named $varname, type ".$properties['type']." found</span><br/>";
				}
			}
			
			$nodes_to_link = array();
			$id_conversion = array();
			$added_node_ids = array();
			$linked_node_ids = array();
			
			$node_table = new mTable("nodes");
			
			foreach ($this->imported_nodes as $container)
			{
				if (!isset($container['created']))
					$container['created'] = date("Y-m-d H:i:s");
							
				$node_id = $node_table->insert(array("created" => $container['created']));
				
				$node = new mObject();
				$node->node_id = $node_id;
				
				$id_conversion[$container['id']] = $node_id;
				$added_node_ids[] = $node_id;
				
				if (is_array($container['metadata']))
				{
					foreach ($container['metadata']['container'] as $metadata)
					{
						$node->setMeta($metadata['name'], $metadata['value']);
						echo "Created metadata name=".$metadata['name'].", value=".$metadata['value'].", node_id=".$node_id."<br/>";
					}
				}
				
				foreach ($container['objects'] as $objcontainer)
				{
					if (isset($objcontainer['xmldata']) && $objcontainer['xmldata'] == "object")
						$objects = array($objcontainer);
					else
						$objects = $objcontainer;
						
					usort(&$objects, array($this, "SortByVersion"));
					
					foreach ($objects as $object_array)
					{
						$object = new mObject();
						$object->setClassName($object_array['class_name']);
						$object->loadVars();
						
						if (!isset($object_array['created']))
							$object_array['created'] = date("Y-m-d H:i:s");
						
						$object->node_id = $node_id;
						$object->created = $object_array['created'];
						$object->version = $object_array['version'];
						$object->class_name = $object_array['class_name'];
						$object->name = $object_array['name'];
						$object->icon = $object_array['icon'];
						$object->language = $object_array['language'];
						
						if (isset($object_array['right']))
							$object->rights = $object_array['rights'];
						else
							$object->rights = "";
						
						if (isset($object_array['user']))
						{
							$user = new mUser();
							$user->setByUsername($object_array['user']);
							$object->user_id = $user->id;
						}
						else
							$object->user_id = $_SESSION['murrix']['user']->id;
						
						if (is_array($object_array['vars']))
						{
							foreach ($object_array['vars'] as $key => $value)
							{
								if ($object->checkVarExistance($key) == 0)
								{
									echo "<span style=\"color:red\">Could not resolve - $key, skipping<br/></span>";
									continue;
								}
								if (!is_array($value['value']))
									$value['value'] = html_entity_decode($value['value']);
									
								if ($value['type'] == "file")
								{
									$extension = strtolower(pathinfo($value['value'], PATHINFO_EXTENSION));
									$oldfile = $args['filepath']."/".$value['file_id'].".$extension";
									
									if (!file_exists($oldfile))
										echo "<span style=\"color:red\">Could not find file - $oldfile, skipping<br/></span>";
									else
										$object->setVarValue($key, $value['value'].":$oldfile");
								}
								else if ($value['type'] == "thumbnail")
								{
									if (!empty($value['thumb_id']))
									{
										$oldfile = $args['thumbpath']."/".$value['thumb_id'].".jpg";
										
										if (!file_exists($oldfile))
											echo "<span style=\"color:red\">Could not find thumbfile - $oldfile, skipping<br/></span>";
										else
											$object->setVarValue($key, $value['thumb_id'].".jpg:$oldfile");
									}
								}
								else
									$object->setVarValue($key, $value['value']);
							}
						}
						
						$object->save(true);
						guessObjectType($object);
						echo "Created object name=".$object->name.", node_id=$node_id, id=".$object->id.",version=".$object->version.",language=".$object->language."<br/>";
					}
				}
			}
			
			$link_table = new mTable("links");
			
			foreach ($this->imported_links as $container)
			{
				$link_array = array();
				$link_array['node_top'] = $id_conversion[$container['node_top']];
				$link_array['node_bottom'] = $id_conversion[$container['node_bottom']];
				$link_array['type'] = $container['type'];
				
				$link_table->insert($link_array);
				echo "Linked node_top=".$link_array['node_top']." to node_bottom=".$link_array['node_bottom'].", type=".$link_array['type']."<br/>";
				
				if ($link_array['type'] == "sub")
					$linked_node_ids[] = $id_conversion[$container['node_bottom']];
			}
			
			$added_node_ids = array_unique($added_node_ids);
			$linked_node_ids = array_unique($linked_node_ids);
			
			$node_ids_to_link = array_diff($added_node_ids, $linked_node_ids);
			
			foreach ($node_ids_to_link as $node_id)
			{
				$link_array = array();
				$link_array['node_top'] = $args['node_id'];
				$link_array['node_bottom'] = $node_id;
				$link_array['type'] = "sub";
				
				$link_table->insert($link_array);
				echo "Linked node_top=".$link_array['node_top']." to node_bottom=".$link_array['node_bottom'].", type=".$link_array['type']."<br/>";
			}
			
			//print_r($import_data);
			$system->setZoneData("zone_import_log", utf8e("<br/>".ob_get_end()));
			return;
		}
		
		$this->draw($system, $args);
	}