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)) { $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 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 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 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 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 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); }
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) { $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 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); }
require_once("$abspath/3dparty/exifer/exif.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"); $node_id = getInput('node_id', 0); $object = new mObject($node_id); if (!$object->hasRight("write")) { echo "You do not have enough rights"; exit; } if ($_POST['action'] == "newregion") { $region = new mObject(); $region->setClassName("image_region"); $region->loadVars(); $object->language = $_SESSION['murrix']['language']; $region->name = "ImageRegion"; $region->setVarValue("image_width", $_POST['image_width']); $region->setVarValue("image_height", $_POST['image_height']);
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 echo $varid; ?>
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); }
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; }
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); }
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 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); }
flush(); } ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <title>MURRiX File Upload</title> <META NAME="ROBOTS" CONTENT="NOINDEX"> </head> <body> <font size="3"> <? $parent = new mObject($_GET['node_id']); if ($parent->hasRight("create")) { clearNodeFileCache($parent->getNodeId()); printToLog("Staring processing of ".count($_FILES)." uploaded files...<br/>"); $count = 0; $size = 0; foreach($_FILES as $tagname => $file) { // get the temporary name (e.g. /tmp/php34634.tmp) $tempName = $file['tmp_name']; // where to save the file? $targetFile = $_POST[$tagname . '_relativePath']; printToLog("Processing #$count: $targetFile<br/>");
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"); if (!isset($_GET['node_id'])) $node_id = empty($_SESSION['murrix']['node_browse_last']) ? getNode("/root") : $_SESSION['murrix']['node_browse_last']; else $node_id = $_GET['node_id']; $_SESSION['murrix']['node_browse_last'] = $node_id; $object = new mObject($node_id); if (!$object->hasRight("read")) { echo "You do not have enough rights"; exit; } ?> <!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> <title>MURRiX <?php echo ucf(i18n("browse")); ?> </title> <meta name="robots" content="noindex"/> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>
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); }