function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		if (!empty($args))
		{
			$args_split = splitArgs($args);
			list($rights, $path, $recursive) = $args_split;
			
			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);
			
			if (!(isAdmin() || $object->hasRight("write")))
			{
				$stderr .= ucf(i18n("not enough rights to change ownership on"))." ".$object->getPathInTree();
			}
			else
			{
				$_SESSION['murrix']['objectcache']['disabled'] = true;
			
				if ($recursive == "-r" || $recursive == "-R")
				{
					$stderr = $this->setOwnerOnObjectsRecursive($object, $stdout, $stderr, $rights);
				}
				else
				{
					if ($object->grantRight($rights))
						$stdout = "";//ucf(i18n("changed ownership successfully on"))." ".$object->getPathInTree();
					else
						$stderr = ucf(i18n("failed to change ownership on"))." ".$object->getPathInTree();
				}
				
				$_SESSION['murrix']['objectcache']['disabled'] = false;
			}
		}
		else
		{
			$stdout = "Usage: grant [groupname]=[rights] [path] [-R]\n";
			$stdout .= "Example: grant admins=rwc /root";
		}
		
		return true;
	}
Exemple #2
0
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		if (!empty($args))
		{
			$object = new mObject(getNode($_SESSION['murrix']['path']));
			
			if (!$object->hasRight("write"))
			{
				$stderr = ucf(i18n("not enough rights"));
				return true;
			}
			
			$links = $object->getLinks();
			$link_matched = false;
			foreach ($links as $link)
			{
				if ($link['id'] == $args)
				{
					$link_matched = $link;
					break;
				}
			}
			
			if ($matched === false)
			{
				$stderr = ucf(i18n("unknown link specified"));
				return true;
			}
			
			$object->deleteLink($args);
			clearNodeFileCache($object->getNodeId());
			clearNodeFileCache($link_matched['remote_id']);

			$_SESSION['murrix']['path'] = $object->getPathInTree();
			$system->TriggerEventIntern($response, "newlocation", array());
			$stdout = ucf(i18n("removed link successfully"));
		}
		else
		{
			$stdout = "Usage: ldel [linkid]\n";
			$stdout .= "Example: ldel 1";
		}
		
		return true;
	}
	function actionDelete(&$system, $args)
	{
		$object = new mObject($this->getNodeId($args));

		if ($object->getNodeId() > 0)
		{
			if ($object->hasRight("write"))
			{
				$parent_id = getNode(GetParentPath($object->getPathInTree()));
				
				$object->deleteNode();
				
				$system->addRedirect("exec=show&node_id=$parent_id");
			}
			else
				$system->addAlert(ucf(i18n("not enough rights")));
		}
		else
			$system->addAlert(ucf(i18n("the specified path is invalid")));
	}
	function execute(&$system, $args)
	{
		if (!is_array($args))
			$args = array();
	
		// This should be checked and possibly moved to the settingsscript
		if (isset($args['meta']) || isset($args['rebuild_thumb']))
		{
			$node_id = $this->getNodeId($args);
		
			if ($node_id > 0)
			{
				$object = new mObject($node_id);
		
				if ($object->hasRight("write"))
				{
					if (isset($args['meta']))
						$object->setMeta($args['meta'], $args['value']);
		
					// Special case for files
					if (isset($args['rebuild_thumb']))
						delThumbnails($args['rebuild_thumb']);
						
					clearNodeFileCache($object->getNodeId());
				}
			}
		}
		$node_id = $this->getNodeId($args);
		
		if ($node_id > 0)
		{
			$object = new mObject($node_id);
			$_SESSION['murrix']['path'] = $object->getPathInTree();
		}

		$system->triggerEventIntern("newlocation", $args);
	}
	function execute(&$system, $args)
	{
		if (isset($args['action']))
		{
			if ($args['action'] == "deletelink")
			{
				$object = new mObject($args['node_id']);
	
				/*$links = $object->getLinks();
				if ($object->getNumLinksSubBottom() <= 1 && ($link['type'] == "sub" && $link['direction'] == "bottom"))
					$response->addAlert(ucf(i18n("unable to delete last link")));
				else*/ 
				if ($object->hasRight("write"))
				{
					$object->unlinkWithNode($args['remote_id'], $args['type'], $args['direction']);
					clearNodeFileCache($object->getNodeId());
					clearNodeFileCache($args['remote_id']);

					$_SESSION['murrix']['path'] = $object->getPathInTree();
					$system->triggerEventIntern("newlocation", $args);
				}
				else
					$system->addAlert(ucf(i18n("you don't have enough rights to delete this link")));
					
				return;
			}
			else if ($args['action'] == "newlink")
			{
				$object = new mObject($args['node_id']);
	
				if ($object->hasRight("write"))
				{
					if (isset($args['remote_node_id']))
						$remote_node_id = $args['remote_node_id'];
					else
						$remote_node_id = getNode($args['path']);

					if ($remote_node_id > 0)
					{
						$remote = new mObject($remote_node_id);

						if ($remote->hasRight("write"))
						{
							if (!$object->linkWithNode($remote_node_id, $args['type']))
							{
								$system->addAlert(ucf(i18n($object->error)));
								return;
							}
							clearNodeFileCache($object->getNodeId());
							clearNodeFileCache($remote_node_id);
						}
						else
						{
							$system->addAlert(ucf(i18n("you don't have enough rights on the remote object to create this link")));
							return;
						}
					}
					else
					{
						$system->addAlert(ucf(i18n("the remote object you specified does not exist")));
						return;
					}
				}
				else
				{
					$system->addAlert(ucf(i18n("you don't have enough rights to create a link")));
					return;
				}
				
				$args['message'] = ucf(i18n("created new link successfully"));
				$_SESSION['murrix']['path'] = $object->getPathInTree();
				$system->triggerEventIntern("newlocation", $args);
				return;
			}
		}
		
		$this->draw($system, $args);
	}
	function execute(&$system, $args)
	{
		if (isset($args['action']))
		{
			$object = new mObject($args['parent_id']);
	
			if ($object->hasRight("write"))
			{
				if (count($args['node_ids']) == 0)
				{
					$system->addAlert(ucf(i18n("you must select at least one object")));
					return;
				}
				
				if ($args['action'] == "delete")
				{
					foreach ($args['node_ids'] as $node_id)
					{
						$child = new mObject($node_id);
						
						$not_allowed_str = "";
						if ($child->hasRight("write"))
							$child->deleteNode();
						else
							$not_allowed_str .= $child->getPathInTree()."\n";
							
						if (!empty($not_allowed_str))
							$system->addAlert(ucf(i18n("you did not have enough rights to delete these nodes:"))."\n$not_allowed_str");
					}
					
					clearNodeFileCache($object->getNodeId());
				}
				else
				{
					if (isset($args['remote_node_id']))
						$remote_node_id = $args['remote_node_id'];
					else
						$remote_node_id = getNode($args['path']);
		
					if ($remote_node_id > 0)
					{
						$remote = new mObject($remote_node_id);
		
						if ($remote->hasRight("write"))
						{
							switch ($args['action'])
							{
								case "move":
								foreach ($args['node_ids'] as $node_id)
								{
									$child = new mObject($node_id);
				
									$child->linkWithNode($remote_node_id, "sub");
									$child->unlinkWithNode($object->getNodeId(), "sub", "bottom");
									clearNodeFileCache($object->getNodeId());
									clearNodeFileCache($child->getNodeId());
									clearNodeFileCache($remote_node_id);
								}
								break;
								
								case "link":
								foreach ($args['node_ids'] as $node_id)
								{
									$child = new mObject($node_id);
				
									$child->linkWithNode($remote_node_id, "sub");
									clearNodeFileCache($remote_node_id);
									clearNodeFileCache($child->getNodeId());
								}
								break;
							}
						}
						else
						{
							$system->addAlert(ucf(i18n("you don't have enough rights on the target")));
							return;
						}
					}
					else
					{
						$system->addAlert(ucf(i18n("the remote object you specified does not exist")));
						return;
					}
				}
			}
			else
			{
				$system->addAlert(ucf(i18n("you don't have enough rights")));
				return;
			}
		}

		$this->draw($system, $args);
	}
	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;
	}
" type="image/x-icon"/>
			
		<link rel="stylesheet" type="text/css" href="<?php 
echo "{$wwwpath}/design/" . $_SESSION['murrix']['theme'] . "/stylesheets/nodebrowse.css";
?>
"/>
	</head>
	
	<body class="nodebrowse">
		<?php 
echo compiletpl("title/big", array("left" => img(geticon($object->getIcon())) . " " . $object->getName(), "right" => $object->getNodeId()));
?>
		<div class="main">
			<div class="container">
				<?php 
echo $object->getPathInTree();
?>
			</div>
		</div>
		<div class="container">
			<center>
				<input type="button" class="submit" onclick="<?php 
echo "opener.document.getElementById('" . $_GET['input_id'] . "').value='" . $object->getNodeId() . "';";
?>
;parent.window.close();" value="<?php 
echo ucf(i18n("select"));
?>
"/>
			</center>
		</div>
		<?
					$tempName = $file['tmp_name'];
					
					// where to save the file?
					$targetFile = $_POST[$tagname . '_relativePath'];
					printToLog("Processing #$count: $targetFile<br/>");
					
					$targetFile = utf8d($targetFile);
		
					$paths = pathinfo($targetFile);
		
					// Create folders
					
					$dir = $paths['dirname'];
		
					if (empty($dir) || $dir == ".")
						$parent_path = $parent->getPathInTree();
					else
						$parent_path = $parent->getPathInTree()."/$dir";
						
					if (getNode($parent_path) <= 0)
					{
						preg_match_all("/([^\/]*)\/?/i", $dir, $atmp);
						$base = $parent->getPathInTree();
						
						foreach ($atmp[0] as $key => $val)
						{
							$val = str_replace("/", "", $val);
						
							if (empty($val))
								break;