当前位置: 首页>>代码示例>>PHP>>正文


PHP getNode函数代码示例

本文整理汇总了PHP中getNode函数的典型用法代码示例。如果您正苦于以下问题:PHP getNode函数的具体用法?PHP getNode怎么用?PHP getNode使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getNode函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: importDir

function importDir($parent, $path)
{
	global $abspath;
	$logtext = "";
	
	$node_id = getNode($parent->getPath()."/".basename($path));
	
	if ($node_id <= 0)
	{
		$node_id = createObject($parent, basename($path), "file_folder");
		$logtext .= "Created ".$parent->getPathInTree()."/".basename($path)."<br/>";
		
		if ($node_id === false)
			return false;
	}
	
	$new_parent = new mObject($node_id);
	
	$subitems = GetSubfilesAndSubfolders($path);
	
	foreach ($subitems as $subitem)
	{
		if (is_dir("$path/$subitem"))
			$logtext .= importDir($new_parent, "$path/$subitem");
		else
		{
			createObject($new_parent, $subitem, "file", array("file" => "$subitem:$path/$subitem"));
			$logtext .= "Created ".$new_parent->getPathInTree()."/$subitem<br/>";
		}
	}
	
	return $logtext;
}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:33,代码来源:import.php

示例2: load

 /**
  * Load the activity object.
  * @param String $itemid the id of the item whose activity was auditied.
  * @param String $userid the id of the user who caused the audit to happen. Who performed the activity.
  * @param String $type the type of audited item ('Vote', 'Node', 'Connection', 'Follow', 'View')
  * @param int $modificationdate the time of the audit in seconds from epoch
  * @param String $changetype the type of activity (view, edit, add, delete etc)
  * @param String $xml the xml for the audited history object
  * @param String $style (optional - default 'long') may be 'short' or 'long' or 'cif'
  */
 function load($itemid, $userid, $type, $modificationdate, $changetype, $xml, $style = 'long')
 {
     $this->itemid = $itemid;
     $this->userid = $userid;
     $this->type = $type;
     $this->modificationdate = $modificationdate;
     $this->changetype = $changetype;
     $this->xml = $xml;
     $this->user = new User($userid);
     if ($style != 'cif') {
         $this->user = $this->user->load($style);
     }
     switch ($this->type) {
         case "Node":
             if ($style == 'long') {
                 $this->node = getIdeaFromAuditXML($this->xml);
             }
             $this->currentnode = getNode($this->itemid, $style);
             if ($this->currentnode instanceof Error) {
                 if ($this->currentnode->code == 7007) {
                     // NODE NOT FOUND
                     $this->tombstone == true;
                 }
             }
             break;
         case "Connection":
             if ($style == 'long') {
                 $this->con = getConnectionFromAuditXML($this->xml);
             }
             $this->currentcon = getConnection($this->itemid, $style);
             if ($this->currentcon instanceof Error) {
                 if ($this->currentcon->code == 7008) {
                     // CONNECTION NODE FOUND
                     $this->tombstone == true;
                 }
             }
             break;
     }
     try {
         $this->canview($style);
     } catch (Exception $e) {
         $this->itemid = "";
         $this->userid = "";
         $this->type = "";
         $this->modificationdate = "";
         $this->changetype = "";
         $this->xml = "";
         $this->user = "";
         $this->node = "";
         $this->con = "";
         $this->currentnode = "";
         $this->currentcon = "";
         return access_denied_error();
     }
 }
开发者ID:uniteddiversity,项目名称:DebateHub,代码行数:65,代码来源:activity.class.php

示例3: exec

	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;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:54,代码来源:oadd.php

示例4: sendMessage

	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;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:53,代码来源:class.muser.php

示例5: exec

	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;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:51,代码来源:grant.php

示例6: exec

	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$object = new mObject(getNode($_SESSION['murrix']['path']));
		$links = $object->getLinks();
		
		if ($args == "-l")
		{
			$stdout .= "total ".count($links)."\n";
			if (count($links) > 0)
			{
				$stdout .= "<table cellspacing=\"0\">";
				$stdout .= "<tr class=\"table_title\">";
				$stdout .= "<td>Id</td>";
				$stdout .= "<td>Type</td>";
				$stdout .= "<td>Remote node</td>";
				$stdout .= "<td>Remote node is on...</td>";
				$stdout .= "</tr>";
				foreach ($links as $link)
				{
					if ($link['remote_id'] <= 0)
						$remote = ucf(i18n("unknown"));
					else
					{
						$remote_obj = new mObject($link['remote_id']);
						$remote = cmd(img(geticon($remote_obj->getIcon()))."&nbsp;".$remote_obj->getName(), "exec=show&node_id=".$remote_obj->getNodeId());
					}
	
					$stdout .= "<tr>";
					$stdout .= "<td>".$link['id']."</td>";
					$stdout .= "<td>".$link['type']."</td>";
					$stdout .= "<td>".$remote."</td>";
					$stdout .= "<td>".ucf(i18n($link['direction']))."</td>";
					$stdout .= "</tr>";
				}
				$stdout .= "</table>";
			}
		}
		else
		{
			foreach ($links as $link)
			{
				if ($link['remote_id'] > 0)
				{
					$remote_obj = new mObject($link['remote_id']);
					$stdout .= cmd($remote_obj->getName(), "exec=show&node_id=".$remote_obj->getNodeId())." ";
				}
			}
		}
		
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:51,代码来源:llist.php

示例7: getNodeId

	function getNodeId(&$args)
	{
		if (isset($args['node_id']))
			return $args['node_id'];
		else if (isset($args['path']))
			$args['node_id'] = getNode($args['path']);
		else
		{
			//if (empty($_SESSION['murrix']['path']) || $_SESSION['murrix']['path'] = "/")
			//	$_SESSION['murrix']['path'] = $_SESSION['murrix']['default_path'];
			
			$args['node_id'] = getNode($_SESSION['murrix']['path']);
		}

		return $args['node_id'];
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:16,代码来源:class.script.php

示例8: exec

	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;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:47,代码来源:olist.php

示例9: exec

	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;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:45,代码来源:ldel.php

示例10: execute

	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);
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:20,代码来源:script.php

示例11: actionDelete

	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")));
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:20,代码来源:script.php

示例12: exec

	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$object = new mObject(getNode($_SESSION['murrix']['path']));

		$user = $object->getUser();
			
		$stdout .= "<table cellspacing=\"0\">";
		$stdout .= "<tr><td class=\"titlename\">Name</td><td>".cmd($object->getName(), "exec=show'&node_id=".$object->getNodeId())."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Icon</td><td>".img(geticon($object->getIcon(), 16))."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Id</td><td>".$object->getNodeId()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Revision</td><td>".$object->getVersion()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Language</td><td>".$object->getLanguage()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Class</td><td>".$object->getClassName()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Rights</td><td>".$object->getRights()."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">User</td><td>".$user->username."</td></tr>";
		$stdout .= "<tr><td class=\"titlename\">Time</td><td>".$object->getCreated()."</td></tr>";
		$stdout .= "</table>";
		
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:20,代码来源:oinfo.php

示例13: exec

	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		$object = new mObject(getNode($_SESSION['murrix']['path']));
		$versions = fetch("FETCH object WHERE property:node_id='".$object->getNodeId()."' NODESORTBY property:language,property:version,property:name");
		
		$stdout .= "total ".count($versions)."\n";
		if (count($versions) > 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>Group</td>";
			$stdout .= "<td>Time</td>";
			$stdout .= "<td>Name</td>";
			$stdout .= "</tr>";
			foreach ($versions as $version)
			{
				$user = $version->getUser();
				$group = $version->getGroup();
				
				$stdout .= "<tr>";
				$stdout .= "<td>".$version->getId()."</td>";
				$stdout .= "<td>".$version->getVersion()."</td>";
				$stdout .= "<td>".$version->getLanguage()."</td>";
				$stdout .= "<td>".$version->getClassName()."</td>";
				$stdout .= "<td>".$version->getRights()."</td>";
				$stdout .= "<td>".$user->username."</td>";
				$stdout .= "<td>".$group->name."</td>";
				$stdout .= "<td>".$version->getCreated()."</td>";
				$stdout .= "<td>".img(geticon($version->getIcon(), 16))."&nbsp;".$version->getName()."</td>";
				$stdout .= "</tr>";
			}
			$stdout .= "</table>";
		}
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:41,代码来源:rlist.php

示例14: exec

	function exec($args, $stdin, &$stdout, &$stderr, &$system)
	{
		if (!empty($args))
		{
			list($rights, $path) = explode(" ", $args, 2);
			
			if ($path{0} != "/")
				$path = $_SESSION['murrix']['path']."/$path";
				
			$node_id = getNode($path);
			
			if ($node_id <= 0)
			{
				$stderr = ucf(i18n("no such path"));
				return true;
			}
			else
				$object = new mObject($node_id);
			
			if (!(isAdmin() || $object->hasRight("write")))
			{
				$stderr = ucf(i18n("not enough rights to change rights"));
				return true;
			}
			
			$object->setRights($rights);
		
			if ($object->saveCurrent())
				$stdout = ucf(i18n("changed rights successfully"));
			else
				$stderr = ucf(i18n("failed to change rights"));
		}
		else
		{
			$stdout = "Usage: chmod [rightstring] [path]\n";
			$stdout .= "Example: chmod rwcrwcrwc /root";
		}
		
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:40,代码来源:chmod.php

示例15: exec

	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("no such path"));
				return true;
			}
			else
				$object = new mObject($node_id);
			
			if (!(isAdmin() || $object->hasRight("write")))
			{
				$stderr = ucf(i18n("not enough rights to delete"));
				return true;
			}
			
			clearNodeFileCache($object->getNodeId());
			$object->deleteNode();
			$stdout = ucf(i18n("deleted node successfully"));
		}
		else
		{
			$stdout = "Usage: odel [name]\n";
			$stdout .= "Example: odel oldfolder";
		}
		
		return true;
	}
开发者ID:BackupTheBerlios,项目名称:murrix-svn,代码行数:37,代码来源:odel.php


注:本文中的getNode函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。