Пример #1
0
	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;
	}
Пример #2
0
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$group = new mGroup();
		$groups = $group->getList();
		
		if ($args == "-l")
		{
			$stdout .= "total ".count($groups)."\n";
			if (count($groups) > 0)
			{
				$stdout .= "<table cellspacing=\"0\">";
				$stdout .= "<tr class=\"table_title\">";
				$stdout .= "<td>Id</td>";
				$stdout .= "<td>Name</td>";
				$stdout .= "<td>Home</td>";
				$stdout .= "<td>Created</td>";
				$stdout .= "<td>Description</td>";
				$stdout .= "</tr>";
				foreach ($groups as $group)
				{
					$stdout .= "<tr>";
					$stdout .= "<td>".$group->id."</td>";
					$stdout .= "<td>".$group->name."</td>";
					
					if ($group->home_id > 0)
					{
						$home = new mObject($group->home_id);
						$stdout .= "<td>".cmd($home->getPath(), "exec=show&node_id=".$home->getNodeId())."</td>";
					}
					else
						$stdout .= "<td></td>";
					
					$stdout .= "<td>".$group->created."</td>";
					$stdout .= "<td>".$group->description."</td>";
					$stdout .= "</tr>";
				}
				$stdout .= "</table>";
			}
		}
		else
		{
			foreach ($groups as $group)
				$stdout .= $group->name." ";
		}
		
		return true;
	}
Пример #3
0
	function execute(&$system, $args)
	{
		if (isset($args['language']))
		{
			if ($_SESSION['murrix']['language'] != $args['language']);
			{
				$_SESSION['murrix']['language'] = $args['language'];
				unset($_SESSION['murrix']['querycache']);

				$node_id = getNode($_SESSION['murrix']['path']);
				$object = new mObject($node_id);
				$_SESSION['murrix']['path'] = $object->getPath();
	
				//$system->TriggerEventIntern($response, "newlang");
				$system->addJSScript("window.location.reload()");
				return;
			}
		}
		$this->draw($system, $args);
	}
Пример #4
0
	function fillCalendars()
	{
		$this->calendars = array();
		$home_id = $_SESSION['murrix']['user']->home_id;
		if ($home_id > 0)
		{
			$home = new mObject($home_id);
			$calendar_id = getNode($home->getPath()."/calendar", "eng");
			if ($calendar_id > 0)
			{
				$name = $home->getName();
				$count = 0;
				while (isset($this->calendars[$name]))
				{
					$count++;
					$name .= $count;
				}
				
				$children = fetch("FETCH node WHERE link:node_top='$calendar_id' AND link:type='sub' AND property:class_name='folder' NODESORTBY property:version SORTBY property:name");
				
				for ($n = 0; $n < count($children); $n++)
				{
					$children[$n]->color = colour('light');
					$children[$n]->active = true;
				}
				
				$this->calendars[$name] = $children;
			}
		}
			
		$groups = $_SESSION['murrix']['user']->getGroups();
		foreach ($groups as $groupname)
		{
			$group = new mGroup();
			$group->setByName($groupname);
			
			$home_id = $group->home_id;
			
			if ($home_id > 0)
			{
				$home = new mObject($home_id);
				$calendar_id = getNode($home->getPath()."/calendar", "eng");
				if ($calendar_id > 0)
				{
					$name = $home->getName();
					$count = 0;
					while (isset($this->calendars[$name]))
					{
						$count++;
						$name .= $count;
					}
					
					$children = fetch("FETCH node WHERE link:node_top='$calendar_id' AND link:type='sub' AND property:class_name='folder' NODESORTBY property:version SORTBY property:name");
				
					for ($n = 0; $n < count($children); $n++)
					{
						$children[$n]->color = colour('light');
						$children[$n]->active = true;
					}
				
					$this->calendars[$name] = $children;
				}
			}
		}
	}
Пример #5
0
	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$path = $args;
		
		if (empty($path))
		{
			$home_id = $_SESSION['murrix']['user']->home_id;
			
			if ($home_id > 0)
			{
				$home = new mObject($home_id);
				$path = $home->getPath();
			}
			else
				return true;
		}
			
		if ($path == ".")
			return true;
			
		if ($path == "..")
		{
			$path = getParentPath($_SESSION['murrix']['path']);
		}
		else if ($path{0} != "/")
		{
			$path = $_SESSION['murrix']['path']."/$path";
		}
	
		global $root_id;
		$node_id = getNode($path);
		
		$invalid = false;
		if ($node_id == $root_id)
		{
			$root_obj = new mObject($root_id);
			
			if ($root_obj->getPath() != $path)
				$invalid = true;
		}
		else if ($node_id <= 0)
			$invalid = true;
			
		if ($invalid)
		{
			$stderr = ucf(i18n("no such path"))." \"$path\"";
			return true;
		}
		
		$object = new mObject(getNode($path));
		if (!$object->hasRight("read") && !isAdmin())
		{
			$stderr = ucf(i18n("permission denied, no rights"));
			return true;
		}
		
		$_SESSION['murrix']['path'] = $path;
		$stdout = "Entered \"$path\"";
		
		if ($response != null)
			$system->TriggerEventIntern($response, "newlocation", array("path" => $path));
			
		return true;
	}
Пример #6
0
?>
			</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>
		<?
		$parent_path = GetParentPath($object->getPath());
		$parent_id = getNode($parent_path);

		if ($parent_id > 0 && $parent_id != $node_id)
		{
			$parent = new mObject($parent_id);
			?>
			<div class="main">
			<?
				echo "<a href=\"".$_SERVER["REQUEST_URI"]."&node_id=$parent_id\">".img(geticon($parent->getIcon()))." <strong>".ucf(i18n("up one level"))."</strong></a>";
			?>
			</div>
		<?
		}

		$children = fetch("FETCH node WHERE link:node_top='$node_id' AND link:type='sub' NODESORTBY property:version SORTBY property:name");