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()))." ".$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; }
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; }
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; }
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))." ".$child->getName(), "exec=show&node_id=".$child->getNodeId())."</td>"; $stdout .= "</tr>"; } $stdout .= "</table>"; } } else { foreach ($children as $child) $stdout .= $child->getName()." "; } return true; }
function importLines($lines, $fields, $class_name, $parent) { $count = 0; foreach ($lines as $line) { $line = trim($line); if (empty($line)) continue; $array = explode(";", $line); $newobject = new mObject(); $newobject->setClassName($class_name); $newobject->loadVars(); $newobject->name = trim($array[$fields['name']]); $newobject->language = $_SESSION['murrix']['language']; $newobject->rights = $parent->getMeta("initial_rights", $parent->getRights()); $vars = $newobject->getVars(); foreach ($vars as $var) { if (!isset($fields[$var->name])) continue; $value = $array[$fields[$var->name]]; $newobject->setVarValue($var->name, $value); } if ($newobject->save()) { guessObjectType($newobject); clearNodeFileCache($parent->getNodeId()); $newobject->linkWithNode($parent->getNodeId()); $count++; } else { return mMsg::add("importLines", $object->getLastError(), true); } } return $count; }
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)); }
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)); }
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); }
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))." ".$version->getName()."</td>"; $stdout .= "</tr>"; } $stdout .= "</table>"; } return true; }
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; }
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; }
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; }
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; }
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 execute(&$system, $args) { if (isset($args['action']) && $args['action'] == "deleteversion") { $object = new mObject(); $object->loadByObjectId($args['object_id']); if ($object->hasRight("write")) $object->deleteCurrentVersion(); $args['node_id'] = $object->getNodeId(); clearNodeFileCache($object->getNodeId()); $links = $object->getLinks(); foreach ($links as $link) { if ($link['type'] == "sub") clearNodeFileCache($link['remote_id']); } } $system->triggerEventIntern("newlocation", $args); }
<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"); if (count($children) > 0) { foreach ($children as $child) {
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; }
</div> <div class="menu_login"> <center> <div style="display: table-cell; text-align: left"> <? $home_id = $_SESSION['murrix']['user']->home_id; if ($home_id > 0) { $home = new mObject($home_id); echo cmd(img(geticon("home"))." ".ucf($home->getName()), "exec=show&node_id=$home_id")."<br/>"; } $groups = $_SESSION['murrix']['user']->getGroups(); foreach ($groups as $group_name) { $group = new mGroup(); $group->setByName($group_name); $home_id = $group->home_id; if ($home_id > 0) { $home = new mObject($home_id); echo cmd(img(geticon($home->getIcon()))." ".ucf($home->getName()), "exec=show&node_id=$home_id")."<br/>"; } } ?> </div> </center> </div>
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; } } } }
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 createGroup($name, $description, $create_home = true) { if (!isAdmin) return ucf(i18n("not enough rights to create new group")); if (empty($name)) return ucf(i18n("a name must be specified")); $group = new mGroup(); $group->setByName($name); if ($group->id > 0) return ucf(i18n("a group with that name already exists")); $group->name = $name; $group->description = $description; $ret = $group->save(); if ($create_home && getNode("/root/home/groups/".$name) <= 0) { $home = new mObject(); $home->setClassName("folder"); $home->loadVars(); $home->name = $name; $home->language = $_SESSION['murrix']['language']; $home->rights = "$name=rc"; $home->setVarValue("description", "This is the home of $name"); if ($home->save()) { $home->setMeta("initial_rights", "$name=rwc"); $home_folder = new mObject(getNode("/root/home/groups")); $home->linkWithNode($home_folder->getNodeId()); } else { $message = "Operation unsuccessfull.<br/>"; $message .= "Error output:<br/>"; $message .= $home->getLastError(); return $message; } $group->home_id = $home->getNodeId(); $group->save(); } return $ret; }
require_once("$abspath/system/paths.php"); require_once("$abspath/system/objectcache.php"); require_once("$abspath/system/settings.php"); require_once("$abspath/system/user.php"); require_once("$abspath/session.php"); if (($str = db_connect()) !== true) echo "Failed to connect to database!"; $root_id = getSetting("ROOT_NODE_ID", 1, "any"); $anonymous_id = getSetting("ANONYMOUS_ID", 1, "any"); $parent_id = getInput("parent_id", getNode($_SESSION['murrix']['path'])); $parent = new mObject($parent_id); if (!$parent->hasRight("create") && !isAdmin()) { echo "You do not have enough rights to upload files."; exit; } $varid = GetInput("varid"); if (isset($_POST['action']) && $_POST['action'] == "upload") { move_uploaded_file($_FILES['file']['tmp_name'], $_FILES['file']['tmp_name']."_tmpfile"); ?> <script type="text/javascript"> parent.document.getElementById('<?php
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); }
<?php echo getAge($date); ?> <?php echo i18n("years old"); ?> </td> </tr> <? } $links = $object->getLinks(0, "partner"); if (count($links) > 0) { $partner = new mObject($links[0]['remote_id']); ?> <tr> <td class="left"> <?php echo ucf(i18n("partner")); ?> </td> <td> <?php echo img(geticon("user")); ?> </td> <td class="right"> <?php echo cmd($partner->getName(), "exec=show&node_id=" . $partner->getNodeId());
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; }
function execute(&$system, $args) { if (isset($args['node_id'])) { if (isAnonymous()) { $system->addAlert(ucf(i18n("anonymous user can not vote"))); return; } if (!isset($args['answer'])) { $system->addAlert(ucf(i18n("you must choose an alternative"))); return; } $poll = new mObject($args['node_id']); if ($poll->getNodeId() > 0) { $now = time(); if (strtotime($poll->getVarValue("closedate")) < $now) { $system->addAlert(ucf(i18n("this poll is closed"))); return; } if (strtotime($poll->getVarValue("opendate")) > $now) { $system->addAlert(ucf(i18n("this poll is not open yet"))); return; } $answers = fetch("FETCH node WHERE link:node_top='".$poll->getNodeId()."' AND link:type='sub' AND property:class_name='poll_answer' AND property:name='".$_SESSION['murrix']['user']->id."' NODESORTBY property:version"); if (count($answers) > 0) { $system->addAlert(ucf(i18n("you have already voted in this poll"))); return; } $answer = new mObject(); $answer->setClassName("poll_answer"); $answer->loadVars(); $answer->name = $_SESSION['murrix']['user']->id; $answer->language = $_SESSION['murrix']['language']; $answer->rights = $poll->rights;; $answer->setVarValue("answer", $args['answer']); $answer->save(); clearNodeFileCache($poll->getNodeId()); $answer->linkWithNode($poll->getNodeId()); } } $this->draw($system, $args); }
<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; }
function exec($args, $stdin, &$stdout, &$stderr, &$system) { if (!empty($args)) { $args_split = splitArgs($args); if (count($args_split) >= 2) { $source = $args_split[0]; $target = $args_split[1]; if ($source{0} != "/") $source = $_SESSION['murrix']['path']."/$source"; $source_node_id = getNode($source); if ($source_node_id <= 0) { $stderr = ucf(i18n("no such path")).": $source"; return true; } else $source = new mObject($source_node_id); if (!(isAdmin() || $source->hasRight("write"))) { $stderr = ucf(i18n("not enough rights on source")); return true; } if ($target{0} != "/") $target = $_SESSION['murrix']['path']."/$target"; $target_node_id = getNode($target); if ($target_node_id <= 0) { $stderr = ucf(i18n("no such path")).": $target"; return true; } else $target = new mObject($target_node_id); if (!(isAdmin() || $target->hasRight("write"))) { $stderr = ucf(i18n("not enough rights on target")); return true; } $parent_node_id = getNode($_SESSION['murrix']['path']); $source->linkWithNode($target->getNodeId(), "sub"); $source->unlinkWithNode($parent_node_id, "sub", "bottom"); clearNodeFileCache($source->getNodeId()); clearNodeFileCache($target->getNodeId()); clearNodeFileCache(getNode($_SESSION['murrix']['path'])); $stdout = ucf(i18n("moved node successfully")); } } else { $stdout = "Usage: omove [sourcepath] [targetpath]\n"; $stdout .= "Example: omove \"/root/home\" \"/root/public\""; } return true; }
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; }
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); }