Esempio n. 1
0
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		if (!empty($args))
		{
			$path = $args;
			
			if ($path{0} != "/")
				$path = $_SESSION['murrix']['path']."/$path";
				
			$node_id = getNode($path);
			
			if ($node_id > 0)
			{
				$stderr = ucf(i18n("object already exists"));
				return true;
			}
			
			$parent = new mObject(getNode($_SESSION['murrix']['path']));
			
			if (!(isAdmin() || $parent->hasRight("create")))
			{
				$stderr = ucf(i18n("not enough rights to create folder"));
				return true;
			}
			
			$object = new mObject();
			$object->setClassName("folder");
			$object->loadVars();

			$object->name = basename($path);
			$object->language = $_SESSION['murrix']['language'];
			$object->rights = $parent->getMeta("initial_rights", "rwcrwc---");
			$object->group_id = $parent->getMeta("initial_group", $parent->getGroupId());

			if (!$object->save())
			{
				$stderr = "Operation unsuccessfull.\n";
				$stderr .= "Error output:\n";
				$stderr .= $object->getLastError();
				return true;
			}
			
			clearNodeFileCache($parent->getNodeId());
			$object->linkWithNode($parent->getNodeId());
			$stdout = ucf(i18n("created folder successfully"));
		}
		else
		{
			$stdout = "Usage: oadd [name]\n";
			$stdout .= "Example: oadd newfolder";
		}
			
		return true;
	}
Esempio n. 2
0
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$object = new mObject(getNode($_SESSION['murrix']['path']));
		$children = fetch("FETCH node WHERE link:node_top='".$object->getNodeId()."' AND link:type='sub' NODESORTBY property:version SORTBY ".$object->getMeta("sort_by", "property:name"));
		
		if ($args == "-l")
		{
			$stdout .= "total ".count($children)."\n";
			if (count($children) > 0)
			{
				$stdout .= "<table cellspacing=\"0\">";
				$stdout .= "<tr class=\"table_title\">";
				$stdout .= "<td>Id</td>";
				$stdout .= "<td>Rev.</td>";
				$stdout .= "<td>Lang.</td>";
				$stdout .= "<td>Class</td>";
				$stdout .= "<td>Rights</td>";
				$stdout .= "<td>User</td>";
				$stdout .= "<td>Time</td>";
				$stdout .= "<td>Name</td>";
				$stdout .= "</tr>";
				foreach ($children as $child)
				{
					$user = $child->getUser();
					
					$stdout .= "<tr>";
					$stdout .= "<td>".$child->getNodeId()."</td>";
					$stdout .= "<td>".$child->getVersion()."</td>";
					$stdout .= "<td>".$child->getLanguage()."</td>";
					$stdout .= "<td>".$child->getClassName()."</td>";
					$stdout .= "<td>".$child->getRights()."</td>";
					$stdout .= "<td>".$user->username."</td>";
					$stdout .= "<td>".$child->getCreated()."</td>";
					$stdout .= "<td>".cmd(img(geticon($child->getIcon(), 16))."&nbsp;".$child->getName(), "exec=show&node_id=".$child->getNodeId())."</td>";
					$stdout .= "</tr>";
				}
				$stdout .= "</table>";
			}
		}
		else
		{
			foreach ($children as $child)
				$stdout .= $child->getName()." ";
		}
		
		return true;
	}
Esempio n. 3
0
<div class="main">
	<div class="container">
		<center>
		<?
			global $wwwpath;
		
			$parent = new mObject(getNode(getParentPath($object->getPathInTree())));
			
			$invert = "";
			if ($parent->getMeta("sort_direction", "") == "asc")
				$invert = "!";
			
			$family = fetch("FETCH node WHERE link:node_top='".$parent->getNodeId()."' AND link:type='sub' AND !property:class_name='comment' AND !property:class_name='poll_answer' NODESORTBY property:version SORTBY $invert".$parent->getMeta("sort_by", "property:name"));
			
			$family = getReadable($family);
			
			$prev = false;
			$next = false;
			
			for ($n = 0; $n < count($family); $n++)
			{
				if ($family[$n]->getNodeId() == $object->getNodeId())
				{
					if ($n > 0)
						$prev = $family[$n-1];
						
					if ($n < count($family)-1)
						$next = $family[$n+1];
				
					break;
				}
Esempio n. 4
0
	function execute(&$system, $args)
	{
		$parent_id = $this->getNodeId($args);
		$parent = new mObject($parent_id);
		
		$class_name = "";
		if (!empty($args['class_name']))
			$class_name = $args['class_name'];

		if (empty($class_name))
			$class_name = $parent->getMeta("default_class_name", "folder");
		
		if ($parent->hasRight("create") || $parent->hasRight("comment") && $class_name == "comment")
		{
			if (isset($args['action']) && $args['action'] == "save")
			{
				if (!empty($class_name))
				{
					$languages = explode(",", $args['languages']);
					$languages_tosave = array();
				
					foreach ($languages as $language)
					{
						if (!empty($args[$language.'_name']))
						{
							if (!(strpos($args[$language.'_name'], "\\") === false) || !(strpos($args[$language.'_name'], "/") === false) || !(strpos($args[$language.'_name'], "+") === false))
							{
								$system->addAlert(ucf(i18n($language))." ".i18n("version").": ".ucf(i18n("you can not use '\\', '/' or '+' in the name")));
								return;
							}

							$languages_tosave[] = $language;
						}
					}

					if (count($languages_tosave) == 0)
					{
						$system->addAlert(ucf(i18n("nothing to save")));
						return;
					}

					$languages = $languages_tosave;
				
	
					$object = new mObject();
					$object->setClassName($class_name);
					$object->loadVars();
	
					$saved = false;
					foreach ($languages as $language)
					{
						$object->name = trim($args[$language.'_name']);
						$object->icon = trim($args[$language.'_icon']);
						$object->language = $language;
						$object->rights = $parent->getMeta("initial_rights", $parent->getRights());
	
						$vars = $object->getVars();
	
						foreach ($vars as $var)
						{
							$key = $language."_v".$var->id;
							$value = (isset($args[$key]) ? $args[$key] : "");
							
							if (empty($value) && $var->getRequired() && $var->getType() != "boolean")
							{
								$system->addAlert(utf8e(ucf(i18n($language))." ".i18n("version").": ".ucf(str_replace("_", " ", i18n($var->getName(true))))." ".i18n("is a required field")));
								return;
							}
							
							$object->setVarValue($var->name, $value);
						}
	
						if ($object->save())
						{
							guessObjectType($object);
							$saved = true;
						}
						else
						{
							$message = "Operation unsuccessfull.<br/>";
							$message .= "Error output:<br/>";
							$message .= $object->getLastError();
							$system->addAlert($message);
							return;
						}
					}
	
					if ($saved)
					{
						clearNodeFileCache($parent->getNodeId());
						$object->linkWithNode($parent->getNodeId());
						
						$system->addRedirect("exec=show&node_id=".$object->getNodeId());
					}
	
					return;
				}
			}
		}
		
		$args['class_name'] = $class_name;
		$this->draw($system, $args);
	}
	function sendMessage($subject, $text, $attachment)
	{
		if ($this->id <= 0)
			return false;
			
		$user_id = $_SESSION['murrix']['user']->id;
		$_SESSION['murrix']['user']->id = $this->id;
		
		$home = new mObject($this->home_id);
		
		$inbox_id = getNode($home->getPath()."/inbox", "eng");
		
		if ($inbox_id < 0)
		{
			$inbox = new mObject();
			$inbox->setClassName("folder");
			$inbox->loadVars();

			$inbox->name = "inbox";
			$inbox->language = $_SESSION['murrix']['language'];

			$inbox_id = $inbox->save();
			
			$inbox->rights = $home->getMeta("initial_rights", $home->getRights());
			
			clearNodeFileCache($home->getNodeId());
			$inbox->linkWithNode($home->getNodeId());
		}
		else
			$inbox = new mObject($inbox_id);
		
		$message = new mObject();
		$message->setClassName("message");
		$message->loadVars();
		
		$message->name = $subject;
		$message->language = $_SESSION['murrix']['language'];
		
		$message->setVarValue("text", $text);
		$message->setVarValue("attachment", $attachment);
		$message->setVarValue("sender", $_SESSION['murrix']['user']->name);

		$message->save();
		
		$message->rights = $inbox->getMeta("initial_rights", $inbox->getRights());
		
		clearNodeFileCache($inbox->getNodeId());
		$message->linkWithNode($inbox->getNodeId());
		
		$_SESSION['murrix']['user']->id = $user_id;
		
		return true;
	}
}

$value_id = $object->resolveVarName("file");
$filename = $object->getVarValue("file");
$type = getfiletype(pathinfo($filename, PATHINFO_EXTENSION));

$angle = -1;
$maxsize = getSetting("IMGSIZE", 640);

if ($type != "image")
{
	echo "File is not an image";
	exit;
}

$angle = $object->getMeta("angle", "");
			
$thumbnail = getThumbnail($value_id, $maxsize, $maxsize, $angle);

if ($thumbnail == false)
{
	echo "No thumbnail could be created";
	exit;
}

$_SESSION['murrix']['rightcache']['thumbnail'][] = $thumbnail->id;

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
	<head>
Esempio n. 7
0
		
					$parent_new = new mObject(getNode($parent_path));
		
					$object = new mObject();
					$object->setClassName("file");
					$object->loadVars();
	
					$name = trim($paths['basename']);
					// replace '\\' with '/'
					$name = str_replace("\\", "", $name);
					$name = str_replace("/", "", $name);
					$name = str_replace("+", "", $name);
	
					$object->name = $name;
					$object->language = $_SESSION['murrix']['language'];
					$object->rights = $parent_new->getMeta("initial_rights", $parent_new->getRights());
		
					$object->setVarValue("file", trim($paths['basename']).":".$tempName);
		
					if ($object->save())
					{
						guessObjectType($object);
						$object->linkWithNode($parent_new->getNodeId());
						clearNodeFileCache($parent_new->getNodeId());
						printToLog("Created file". $object->getPath()."<br/>");
						$count++;
						$size += $file['size'];
					}
					else
					{
						printToLog("Failed to create file ". $object->getPath()."<br/>");