Exemplo n.º 1
0
	function draw(&$system, $args)
	{
		foreach ($this->zones as $key => $value)
		{
			$zone_args = array();
			$data = compiletplWithOutput($value, $zone_args);
			$system->setZoneData($key, utf8e($data));
			
			if (!empty($zone_args['output']['js']))
				$system->addScript($zone_args['output']['js']);
		}
	}
Exemplo n.º 2
0
	function draw(&$system, $args)
	{
		$node_id = $this->getNodeId($args);

		$data = "";
		if ($node_id > 0)
		{
			$object = new mObject($node_id);
			$data = compiletpl("scripts/versions", array(), $object);
		}
		else
			$data = compiletpl("message", array("titel"=>ucf(i18n("error")), "message"=>ucf(i18n("the specified path is invalid"))));

		$system->setZoneData($this->zone, utf8e($data));
	}
Exemplo n.º 3
0
	function draw(&$system, $args)
	{
		$object = new mObject($this->getNodeId($args));

		$data = "";
		if ($object->getNodeId() > 0)
		{
			if ($object->hasRight("write"))
				$data = compiletpl("scripts/delete", array(), $object);
			else
				$data = compiletpl("message", array("title"=>ucf(i18n("error")), "message"=>ucf(i18n("not enough rights"))));
		}
		else
			$data = compiletpl("message", array("title"=>ucf(i18n("error")), "message"=>ucf(i18n("the specified path is invalid"))));

		$system->setZoneData($this->zone, utf8e($data));
	}
Exemplo n.º 4
0
	function draw(&$system, $args)
	{
		$node_id = $this->getNodeId($args);

		if ($node_id > 0)
		{
			$object = new mObject($node_id);
			if ($object->hasRight("read"))
				$data = compiletpl("scripts/show/view", array("children_show_page"=>$args['children_show_page']), $object);
			else
				$data = compiletpl("message", array("title"=>ucf(i18n("error")), "message"=>ucf(i18n("not enough rights"))), $object);
		}
		else
			$data = compiletpl("message", array("title"=>ucf(i18n("error")), "message"=>ucf(i18n("the specified path is invalid"))), $object);

		$system->setZoneData($this->zone, utf8e($data));
	}
Exemplo n.º 5
0
	function draw(&$system, $args)
	{
		$query_string = "";
		$class = "";
		$children = array();
			
		if (is_array($args) && !empty($args['query']))
		{
			$query_string = trim($args['query']);
			$query_string2 = str_replace(" ", "%", $query_string);
			$class = (isset($args['class_name']) ? $args['class_name'] : "");
			$class_query = (!empty($class) ? " AND property:class_name='$class'" : "");
			$children = fetch("FETCH node WHERE property:name LIKE '%$query_string2%' $class_query NODESORTBY property:version SORTBY property:name");

			$children = getReadable($children);
		}

		$system->setZoneData($this->zone, utf8e(compiletpl("scripts/search", array("objects"=>$children, "class"=>$class, "query_string"=>$query_string))));
	}
Exemplo n.º 6
0
	function draw(&$system, $args)
	{
		$events = $this->getEvents();

		$data = compiletpl("scripts/calendar/view", array("date"=>$this->date, "calendars"=>$this->calendars, "view"=>$this->view, "events"=>$events,"firstday"=>strtotime($this->date)));

		$system->setZoneData($this->zone, utf8e($data));
	}
Exemplo n.º 7
0
	function draw(&$system, $args)
	{
		$system->setZoneData($this->zone, utf8e(compiletpl("scripts/langswitch", array())));
	}
Exemplo n.º 8
0
	function draw(&$system, $args)
	{
		$system->setZoneData($this->zone, utf8e(compiletpl("scripts/poll/view", array())));
	}
Exemplo n.º 9
0
	function draw(&$system, $args)
	{
		$parent_id = $this->getNodeId($args);
		$object = new mObject($parent_id);
	
		$javascript = "";
		$data = "";
		if ($object->hasRight("create") || $object->hasRight("comment") && $args['class_name'] == "comment")
		{
			$newobject = new mObject();
			$newobject->setClassName(isset($args['class_name']) ? $args['class_name'] : "folder");
			$newobject->loadVars();
			$newobject->loadClassIcon();
			
			$new_args = array("parent_node_id"=>$object->getNodeId());
			$data = compiletplWithOutput("scripts/new", $new_args, $newobject);
			$javascript = $new_args['output']['js'];
		}
		else
			$data = compiletpl("message", array("title"=>ucf(i18n("error")), "message"=>ucf(i18n("not enough rights"))), $object);
			

		$system->setZoneData($this->zone, utf8e($data));
		if (!empty($javascript))
			$system->addScript($javascript);
	}
Exemplo n.º 10
0
	function actionFinish(&$system, $args)
	{
		global $abspath, $db_prefix, $root_id, $anonymous_id;
		$db_prefix = $this->db['prefix'];
		
		if (empty($args['theme']))
		{
			$system->addAlert("You must enter select a theme");
			return;
		}
		
		if (empty($args['imgsize']))
		{
			$system->addAlert("You must enter a imagesize");
			return;
		}
		
		if (empty($args['thumbsize']))
		{
			$system->addAlert("You must enter a thumbnailsize");
			return;
		}
		
		if (empty($args['default_lang']))
		{
			$system->addAlert("You must enter a default language");
			return;
		}
		
		if (empty($args['default_path']))
		{
			$system->addAlert("You must enter a default path");
			return;
		}
		
		if (empty($args['password']))
		{
			$system->addAlert("You must enter a password");
			return;
		}
		
		unset($args['action']);
		$this->config = $args;
		
		
		$logtext = "";
			
		if (!$db_conn = mysql_pconnect($this->db['adress'], $this->db['username'], $this->db['password']))
		{
			$system->addAlert("Error connecting to MySQL: " . mysql_errno() . " " . mysql_error());
			return;
		}
			
		if (!mysql_select_db($this->db['name']))
		{
			if (mysql_query("CREATE DATABASE `".$this->db['name']."`"))
				$logtext .= "Database ".$this->db['name']." created.<br/>";
			else
			{
				$system->addAlert("Failed to create database ".$this->db['name'].". Error: " . mysql_errno() . " " . mysql_error());
				return;
			}
		}

		mysql_select_db($this->db['name']);
		
		$files = GetSubfiles("$abspath/scripts/install/db");
		foreach ($files as $file)
		{
			$query = "DROP TABLE IF EXISTS `".$this->db['prefix'].basename($file, ".sql")."`";
			mysql_query($query);
		
			$query = str_replace("%PREFIX%", $this->db['prefix'], implode("", file("$abspath/scripts/install/db/$file")));
			
			if (mysql_query($query))
				$logtext .= "Imported $file successfully.<br/>";
			else
			{
				$system->addAlert("Failed to import $file. Error: " . mysql_errno() . " " . mysql_error()."\n$query");
				return;
			}
		}
		
		$xml = new mXml();
		
		$files = GetSubfiles("$abspath/scripts/install/classes");
		foreach ($files as $file)
		{
			$filedata = getFileData($file, "$abspath/scripts/install/classes/$file");
			$msgid = $xml->parseXML(array("node_id" => 0, "data" => $filedata));
			
			$logtext .= mMsg::getText($msgid);
			
			if (mMsg::isError($msgid))
			{
				$system->addAlert(mMsg::getError($msgid));
				return;
			}
			else
				$logtext .= "Imported $file successfully.<br/>";
		}

		$files = GetSubfiles("$abspath/scripts/install/objects");
		foreach ($files as $file)
		{
			$filedata = getFileData($file, "$abspath/scripts/install/objects/$file");
			$msgid = $xml->parseXML(array("node_id" => 0, "data" => $filedata));
			
			$logtext .= mMsg::getText($msgid);
			
			if (mMsg::isError($msgid))
			{
				$system->addAlert(mMsg::getError($msgid));
				return;
			}
			else
				$logtext .= "Imported $file successfully.<br/>";
		}
		
		$root_id = 1;
		
		$admin_group_id = createGroup("admins", "Administrators group", true);
		$anon_group_id = createGroup("anonymous", "Anonymous group", false);
		
		$anon_user_id = createUserSimple("Anonymous", "anonymous", "", "", "anonymous", false);
		$anonymous_id = $anon_user_id;
		$admin_user_id = createUserSimple("Administrator", "admin", $this->config['password'], "", "admins", true);
		
		
		$files = GetSubfiles("$abspath/cache");
		foreach ($files as $file)
			unlink("$abspath/cache/$file");
			
		$files = GetSubfiles("$abspath/files");
		foreach ($files as $file)
			unlink("$abspath/files/$file");
			
		$files = GetSubfiles("$abspath/thumbnails");
		foreach ($files as $file)
			unlink("$abspath/thumbnails/$file");
		
		// Insert initial objects
/*
		$root_obj = new mObject();
		$root_obj->setClassName("folder");
		$root_obj->loadVars();
		$root_obj->setLanguage("eng");
		$root_obj->setName("root");
		$root_obj->setIcon("murrix");
		$root_obj->setRights("all=r");
		
		$root_obj->setVarValue("description", "This is the root node");

		if ($root_obj->save())
		{
			$root_obj->setMeta("initial_rights", "admins=rwc");
			$logtext .= "Created ".$root_obj->getName().".<br/>";
		}
		else
		{
			$logtext .= "Failed to create ".$root_obj->getName().".<br/>";
			$logtext .= $root_obj->error;
			$this->done = false;
		}

		$home_obj = new mObject();
		$home_obj->setClassName("folder");
		$home_obj->loadVars();
		$home_obj->setLanguage("eng");
		$home_obj->setName("home");
		$home_obj->setIcon("home");
		$home_obj->setRights("all=r");

		$home_obj->setVarValue("description", "This folder contain home folders");
		
		if ($home_obj->save())
		{
			$home_obj->linkWithNode($root_obj->getNodeId());
			$logtext .= "Created ".$home_obj->getName().".<br/>";
		}
		else
		{
			$logtext .= "Failed to create ".$home_obj->getName().".<br/>";
			$logtext .= $home_obj->error;
			$this->done = false;
		}
		
		$users_home_obj = new mObject();
		$users_home_obj->setClassName("folder");
		$users_home_obj->loadVars();
		$users_home_obj->setLanguage("eng");
		$users_home_obj->setName("users");
		$users_home_obj->setIcon("user");
		$users_home_obj->setRights("all=r");

		$users_home_obj->setVarValue("description", "This folder contain home folders");
		
		if ($users_home_obj->save())
		{
			$users_home_obj->linkWithNode($home_obj->getNodeId());
			$logtext .= "Created ".$users_home_obj->getName().".<br/>";
		}
		else
		{
			$logtext .= "Failed to create ".$users_home_obj->getName().".<br/>";
			$logtext .= $users_home_obj->error;
			$this->done = false;
		}
		
		$group_home_obj = new mObject();
		$group_home_obj->setClassName("folder");
		$group_home_obj->loadVars();
		$group_home_obj->setLanguage("eng");
		$group_home_obj->setName("groups");
		$group_home_obj->setIcon("group2");
		$group_home_obj->setRights("all=r");

		$users_home_obj->setVarValue("description", "This folder contain group folders");
		
		if ($group_home_obj->save())
		{
			$group_home_obj->linkWithNode($home_obj->getNodeId());
			$logtext .= "Created ".$group_home_obj->getName().".<br/>";
		}
		else
		{
			$logtext .= "Failed to create ".$group_home_obj->getName().".<br/>";
			$logtext .= $group_home_obj->error;
			$this->done = false;
		}
		
		$adminhome_obj = new mObject();
		$adminhome_obj->setClassName("folder");
		$adminhome_obj->loadVars();
		$adminhome_obj->setLanguage("eng");
		$adminhome_obj->setName($this->admin_username);
		$adminhome_obj->setRights("admins=rwc");

		$adminhome_obj->setVarValue("description", "This is the home for ".$this->admin_username);
		
		if ($adminhome_obj->save())
		{
			$adminhome_obj->linkWithNode($users_home_obj->getNodeId());
			$logtext .= "Created ".$adminhome_obj->getName().".<br/>";
			
			$administrator->home_id = $adminhome_obj->getNodeId();
			$administrator->save();
		}
		else
		{
			$logtext .= "Failed to create ".$adminhome_obj->getName().".<br/>";
			$logtext .= $adminhome_obj->error;
			$this->done = false;
		}
		
		$adminshome_obj = new mObject();
		$adminshome_obj->setClassName("folder");
		$adminshome_obj->loadVars();
		$adminshome_obj->setLanguage("eng");
		$adminshome_obj->setName("admins");
		$adminshome_obj->setRights("admins=rwc");

		$adminshome_obj->setVarValue("description", "This is the home for admins");
		
		if ($adminshome_obj->save())
		{
			$adminshome_obj->linkWithNode($group_home_obj->getNodeId());
			$logtext .= "Created ".$adminshome_obj->getName().".<br/>";
			
			$administrator_group->home_id = $adminshome_obj->getNodeId();
			$administrator_group->save();
		}
		else
		{
			$logtext .= "Failed to create ".$adminshome_obj->getName().".<br/>";
			$logtext .= $adminshome_obj->error;
			$this->done = false;
		}
		
		$public_obj = new mObject();
		$public_obj->setClassName("folder");
		$public_obj->loadVars();
		$public_obj->setLanguage("eng");
		$public_obj->setName("public");
		$public_obj->setRights("all=r");

		$public_obj->setVarValue("description", "This folder is readable by anyone");
		
		if ($public_obj->save())
		{
			$public_obj->linkWithNode($root_obj->getNodeId());
			$logtext .= "Created ".$public_obj->getName().".<br/>";
		}
		else
		{
			$logtext .= "Failed to create ".$public_obj->getName().".<br/>";
			$logtext .= $public_obj->error;
			$this->done = false;
		}
		*/
		
		
		
		setSetting("ROOT_NODE_ID",	1,				"any");
		setSetting("ANONYMOUS_ID",	$anonymous->id,			"any");
		setSetting("TRANSPORT",		$this->config['transport'],	"any");
		setSetting("DEFAULT_THEME",	$this->config['theme'],		"any");
		
		setSetting("IMGSIZE",		$this->config['imgsize'],	$this->config['theme']);
		setSetting("THUMBSIZE",		$this->config['thumbsize'],	$this->config['theme']);
		setSetting("INSTANTTHUMBS",	$this->config['instantthumbs'],	$this->config['theme']);
		setSetting("DEFAULT_PATH",	$this->config['default_path'],	$this->config['theme']);
		setSetting("DEFAULT_LANG",	$this->config['default_lang'],	$this->config['theme']);

		$confdata = "<?\n";
		$confdata .= "\$mysql_address = \"".$this->db['adress']."\";\n";
		$confdata .= "\$mysql_user = \"".$this->db['username']."\";\n";
		$confdata .= "\$mysql_pass = \"".$this->db['password']."\";\n";
		$confdata .= "\$mysql_db = \"".$this->db['name']."\";\n";
		$confdata .= "\$db_prefix = \"".$this->db['prefix']."\";\n";
		$confdata .= "?>";

		if (is_writable($abspath))
		{
			$conffile = fopen("$abspath/config.inc.php", "w");
			fwrite($conffile, $confdata);
			fclose($conffile);
			chmod("$abspath/config.inc.php", 0600);
			$logtext .= "Wrote config, $abspath/config.inc.php.<br/>";
		}
		else
		{
			$logtext .= "Unable to write config file.<br/>";
			$logtext .= "Please put the folowing into \"config.inc.php\" and place it in MURRiXs rootpath:<br/>";
			$logtext .= "<br/>";
			$logtext .= nl2br(htmlentities($confdata));
			$logtext .= "<br/>";
		}
		
		$logtext .= "Installation complete!<br/>";
		
		
		$data = compiletpl("finish", array("logtext"=>$logtext));
		$system->setZoneData($this->zone, utf8e($data));
		
		$data = compiletpl("menu", array("action"=>"finish"));
		$system->setZoneData("zone_menu", utf8e($data));
	}
Exemplo n.º 11
0
	function draw(&$system, $args)
	{
		if (isset($args['object_id']))
		{
			$object = new mObject();
			$object->loadByObjectId($args['object_id']);
		}
		else
			$object = new mObject($this->getNodeId($args));
		
		$javascript = "";
		$data = "";
		if ($object->getNodeId() > 0)
		{
			if ($object->hasRight("write"))
			{
				$edit_args = array();
				$data = compiletplWithOutput("scripts/edit", $edit_args, $object);
				$javascript = $edit_args['output']['js'];
			}
			else
				$data = compiletpl("message", array("title"=>ucf(i18n("error")), "message"=>ucf(i18n("not enough rights"))));
		}
		else
			$data = compiletpl("message", array("title"=>ucf(i18n("error")), "message"=>ucf(i18n("the specified path is invalid"))));
		
		$system->setZoneData($this->zone, utf8e($data));
		
		if (!empty($javascript))
			$system->addJSScript($javascript);
	}
Exemplo n.º 12
0
	function draw(&$system, $args)
	{
		if (!isset($args['cmdline']))
		{
			$system->setZoneData($this->zone, utf8e(compiletpl("scripts/console/view", array("logtext"=>$this->logg))));
			$system->addJSScript("document.getElementById('cmdline').focus();");
			$this->running = "";
		}
		
		if (isset($args['cmdline']) || isset($args['initcmd']))
		{
			$cmd = isset($args['cmdline']) ? $args['cmdline'] : $args['initcmd'];
		
			$cmd = trim($cmd);
			
			//if (!empty($cmd))
			{
				$output = "";
				
				if ($cmd == "clear")
				{
					$system->addJSScript("document.getElementById('cmdline').value='';");
					$this->setLogText($system, "");
				}
				else if ($cmd == "list")
				{
					$system->addJSScript("document.getElementById('cmdline').value='';");
					$this->addLogText($system, "<div class=\"cmd\">] $cmd</div>");
					
					$list = "";
					foreach ($this->scripts as $key => $script)
						$list .= "$key ";
						
					$this->addLogText($system, "<div class=\"out\">".nl2br($list)."</div>");
				}
				else if ($cmd == "zones")
				{
					$system->addJSScript("document.getElementById('cmdline').value='';");
					$this->addLogText($system, "<div class=\"cmd\">] $cmd</div>");
					
					$list = "";
					foreach ($system->scripts as $name => $script)
					{
						$list .= "ZONE=".$system->scripts[$name]->zone." CLASS=$name ACTIVE=".$system->scripts[$name]->active."\n";
					}
						
					$this->addLogText($system, "<div class=\"out\">".nl2br($list)."</div>");
				}
				else
				{
					if ($this->execCommand($cmd, $stdout, $stderr, $system))
						$system->addJSScript("document.getElementById('cmdline').value='';");
					
					
					
					if (!empty($stderr))
						$this->addLogText($system, "<div class=\"err\">".nl2br($stderr)."</div>");
						
					if (!empty($stdout))
						$this->addLogText($system, "<div class=\"out\">".nl2br($stdout)."</div>");
				}
			}
		}
		
		$system->addJSScript("var console_log = document.getElementById(\"console_log\");console_log.scrollTop = console_log.scrollHeight;");
	}
Exemplo n.º 13
0
	function draw(&$system, $args)
	{
		if (empty($args['view']))
			$args['view'] = "xml";
	
		$object = new mObject($this->getNodeId($args));
		
		$javascript = "";
		$data = "";
		if ($object->getNodeId() > 0)
		{
			if ($object->hasRight("create"))
			{
				$data = compiletplWithOutput("scripts/import/view", $args, $object);
				$javascript = $args['output']['js'];
			}
			else
				$data = compiletpl("message", array("title"=>ucf(i18n("error")), "message"=>ucf(i18n("not enough rights"))));
		}
		
		$system->setZoneData($this->zone, utf8e($data));
		
		if (!empty($javascript))
			$system->addJSScript($javascript);
	}
Exemplo n.º 14
0
	function draw(&$system, $args)
	{
		$system->setZoneData($this->zone, utf8e(compiletpl("scripts/addressbar", array("divider"=>$this->divider, "path"=>$_SESSION['murrix']['path']))));
	}
Exemplo n.º 15
0
function printToLog($text)
{
	echo utf8e($text);
	flush();
}
Exemplo n.º 16
0
	function draw(&$system, $args)
	{
		$data = "";
		if (isAdmin())
			$data = compiletpl("scripts/xml/view", array());
		else
			$data = compiletpl("message", array("title"=>ucf(i18n("error")), "message"=>ucf(i18n("not enough rights"))));
		
		$system->setZoneData($this->zone, utf8e($data));
	}