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; }
/** * 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(); } }
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 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)) { $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) { $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 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']; }
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 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['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 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"))); }
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 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 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; }
private function handleLexicon(&$data, $curie) { require_once 'Config.php'; //include 'Globals.php'; //include 'JsonClientUtil.php'; //$curie = "NIFCELL:sao2128417084"; $data['curie'] = $curie; $treeObj = getTreeObj($curie); $data['treeObj'] = $treeObj; $parentID = getParentID($treeObj, $curie); $data['parentID'] = $parentID; $node = getNode($treeObj, $parentID); $data['node'] = $node; $mainNode = getNode($treeObj, $curie); $data['mainNode'] = $mainNode; $list = getChildrenIDs($treeObj, $curie); $data['list'] = $list; $leafHTML = ""; $list->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO); for ($list->rewind(); $list->valid(); $list->next()) { $item = $list->current(); $leaf = getNode($treeObj, $item); $leafLinkName = str_replace(" ", "_", $leaf->lbl); $leafLinkName = str_replace("(", "_", $leafLinkName); $leafLinkName = str_replace(")", "_", $leafLinkName); //$leafLink = "/SciCrunchKS/index.php/pages/view/".$leafLinkName; $leafLink = "/" . Config::$localContextName . "/index.php/pages/view/" . $leaf->id; //$leafHTML = $leafHTML . "<ul><li><span><i class=\"icon-leaf\"></i><a href=\"".$leafLink."\">" . $leaf->lbl . "</a></span> <a href=\"\"></a></li></ul>\n"; $leafHTML = $leafHTML . "<ul><li><span id=\"" . $leaf->id . "," . $mainNode->id . "\"><i class=\"icon-plus-sign\"></i>" . $leaf->lbl . "</span> <a href=\"" . $leafLink . "\"><img src=\"/img/view-icon.png\" width=\"25\" height=\"25\"></a></li></ul>\n"; } $data['leafHTML'] = $leafHTML; require_once 'ServiceUtil.php'; require_once 'PropertyConfig.php'; $util = new ServiceUtil(); $list2 = $util->getOtherChildrenIDs($treeObj, $curie, PropertyConfig::$has_proper_part); $partOfParentID = $util->getOtherParentID($treeObj, $curie, PropertyConfig::$has_proper_part); $partOfParenttNode = getNode($treeObj, $partOfParentID); $data['node2'] = $partOfParenttNode; $leafHTML = null; $list2->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO); for ($list2->rewind(); $list2->valid(); $list2->next()) { $item = $list2->current(); $leaf = getNode($treeObj, $item); $leafLinkName = str_replace(" ", "_", $leaf->lbl); $leafLinkName = str_replace("(", "_", $leafLinkName); $leafLinkName = str_replace(")", "_", $leafLinkName); //$leafLink = "/SciCrunchKS/index.php/pages/view/".$leafLinkName; $leafLink = "/" . Config::$localContextName . "/index.php/pages/view/" . $leaf->id; //$leafHTML = $leafHTML . "<ul><li><span><i class=\"icon-leaf\"></i><a href=\"".$leafLink."\">" . $leaf->lbl . "</a></span> <a href=\"\"></a></li></ul>\n"; $leafHTML = $leafHTML . "<ul><li><span id=\"" . $leaf->id . "," . $mainNode->id . "\"><i class=\"icon-plus-sign\"></i>" . $leaf->lbl . "</span> <a href=\"" . $leafLink . "\"><img src=\"/img/view-icon.png\" width=\"25\" height=\"25\"></a></li></ul>\n"; } $data['leafHTML2'] = $leafHTML; $list3 = $util->getChildrenIDsIncoming($treeObj, $curie, PropertyConfig::$part_of); $partOfParentID3 = $util->getParentIDIncoming($treeObj, $curie, PropertyConfig::$part_of); $partOfParenttNode3 = getNode($treeObj, $partOfParentID3); $data['node3'] = $partOfParenttNode3; $leafHTML = null; $list3->setIteratorMode(SplDoublyLinkedList::IT_MODE_FIFO); for ($list3->rewind(); $list3->valid(); $list3->next()) { $item = $list3->current(); $leaf = getNode($treeObj, $item); $leafLinkName = str_replace(" ", "_", $leaf->lbl); $leafLinkName = str_replace("(", "_", $leafLinkName); $leafLinkName = str_replace(")", "_", $leafLinkName); //$leafLink = "/SciCrunchKS/index.php/pages/view/".$leafLinkName; $leafLink = "/" . Config::$localContextName . "/index.php/pages/view/" . $leaf->id; //$leafHTML = $leafHTML . "<ul><li><span><i class=\"icon-leaf\"></i><a href=\"".$leafLink."\">" . $leaf->lbl . "</a></span> <a href=\"\"></a></li></ul>\n"; $leafHTML = $leafHTML . "<ul><li><span id=\"" . $leaf->id . "," . $mainNode->id . "\"><i class=\"icon-plus-sign\"></i>" . $leaf->lbl . "</span> <a href=\"" . $leafLink . "\"><img src=\"/img/view-icon.png\" width=\"25\" height=\"25\"></a></li></ul>\n"; } $data['leafHTML3'] = $leafHTML; }
$response = validateUserSession($userid); break; case "login": $username = required_param('username', PARAM_TEXT); $password = required_param('password', PARAM_TEXT); $response = login($username, $password); break; case "logout": clearSession(); $response = new Result("logout", "logged out"); break; /** NODES **/ /** NODES **/ case "getnode": $nodeid = required_param('nodeid', PARAM_ALPHANUMEXT); $response = getNode($nodeid, $style); break; case "addnode": $name = required_param('name', PARAM_TEXT); $desc = required_param('desc', PARAM_HTML); $nodetypeid = optional_param('nodetypeid', "", PARAM_ALPHANUMEXT); $imageurlid = optional_param('imageurlid', "", PARAM_TEXT); $imagethumbnail = optional_param('imagethumbnail', "", PARAM_TEXT); $response = addNode($name, $desc, $private, $nodetypeid, $imageurlid, $imagethumbnail); break; case "addnodeandconnect": $name = required_param('name', PARAM_TEXT); $desc = required_param('desc', PARAM_HTML); $nodetypename = required_param('nodetypename', PARAM_TEXT); $focalnodeid = required_param('focalnodeid', PARAM_ALPHANUMEXT); $linktypename = required_param('linktypename', PARAM_TEXT);
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; } } } }
$resourcetypesarray = optional_param("resourcetypesarray", "", PARAM_TEXT); $resourcetitlearray = optional_param("resourcetitlearray", "", PARAM_TEXT); $resourceurlarray = optional_param("resourceurlarray", "", PARAM_URL); $identifierarray = optional_param("identifierarray", "", PARAM_TEXT); $resourcenodeidsarray = optional_param("resourcenodeidsarray", "", PARAM_TEXT); $resourcecliparray = optional_param("resourcecliparray", "", PARAM_TEXT); $resourceclippatharray = optional_param("resourceclippatharray", "", PARAM_TEXT); if (isset($_POST["editissue"])) { if ($issue == "") { array_push($errors, $LNG->FORM_ISSUE_ENTER_SUMMARY_ERROR); } if (empty($errors)) { $private = optional_param("private", "Y", PARAM_ALPHA); $r = getRoleByName("Issue"); $roleIssue = $r->roleid; $issuenode = getNode($nodeid); $filename = ""; if (isset($issuenode->filename)) { $filename = $issuenode->filename; } $issuenode->edit($issue, $desc, $private, $roleIssue, $filename, ''); if (!$issuenode instanceof Error) { /*if ($_FILES['image']['error'] == 0) { $imagedir = $HUB_FLM->getUploadsNodeDir($issuenode->nodeid); $photofilename = uploadImageToFit('image',$errors,$imagedir); if($photofilename == ""){ $photofilename = $CFG->DEFAULT_ISSUE_PHOTO; } $issuenode->updateImage($photofilename); }*/
} else { // For IE security message avoidance echo "var objWin = window.self;"; echo "objWin.open('','_self','');"; echo "objWin.close();"; } echo '</script>'; //include_once($HUB_FLM->getCodeDirPath("ui/footerdialog.php")); die; } else { array_push($errors, $LNG->FORM_ISSUE_CREATE_ERROR_MESSAGE . " " . $issuenode->message); } } } else { if ($clonenodeid != "") { $clone = getNode($clonenodeid); $issue = $clone->name; $desc = $clone->description; $private = $clone->private; if (isset($clone->urls)) { $urls = $clone->urls; $count = count($urls); for ($i = 0; $i < $count; $i++) { $url = $urls[$i]; $resourcetypesarray[$i] = $url; $identifierarray[$i] = $url->identifier; $resourcetitlearray[$i] = $url->title; $resourceurlarray[$i] = $url->url; $resourcenodeidsarray[$i] = $url->urlid; $resourcecliparray[$i] = $url->clip; $resourceclippatharray[$i] = $url->clippath;
/** * Add a Connection. Requires login.<br> * @param string $fromnodeid * @param string $fromroleid * @param string $linktypeid * @param string $tonodeid * @param string $toroleid * @param string $private optional, can be Y or N, defaults to users preferred setting * @param string $description * @return Connection or Error */ function addConnection($fromnodeid, $fromroleid, $linktypeid, $tonodeid, $toroleid, $private = "", $description = "") { global $USER, $HUB_DATAMODEL, $ERROR; //echo "linktypeid=".$linktypeid; //echo("<br>".$fromnodeid); //echo("<br>".$fromroleid); //echo("<br>".$tonodeid); //echo("<br>".$toroleid); if ($private == "") { $private = $USER->privatedata; } // Check connection adheres to datamodel rules $fromNode = getNode($fromnodeid, 'short'); $toNode = getNode($tonodeid, 'short'); $linkType = new LinkType($linktypeid); $linkType = $linkType->load(); $fromRole = new Role($fromroleid); $fromRole = $fromRole->load(); $toRole = new Role($toroleid); $toRole = $toRole->load(); $allowed = false; //error_log($fromNode->role->name); //error_log($fromRole->name); //error_log($toNode->role->name); //error_log($toRole->name); //error_log($linkType->label); if ($fromNode instanceof Error) { $ERROR = new Error(); return $ERROR->createInvalidConnectionError("fromnodeid:" . $fromnodeid); } if ($toNode instanceof Error) { $ERROR = new Error(); return $ERROR->createInvalidConnectionError("tonodeid:" . $tonodeid); } if (!$linkType instanceof Error) { if ($fromNode->role->name == $fromRole->name && $toNode->role->name == $toRole->name) { //error_log("HERE1"); //error_log($fromRole->name); //error_log($linkType->label); //error_log($toRole->name); $allowed = $HUB_DATAMODEL->matchesModel($fromRole->name, $linkType->label, $toRole->name); } else { if ($fromRole->name == 'Pro') { //error_log("HERE2"); $allowed = $HUB_DATAMODEL->matchesModelPro($fromNode->role->name, $linkType->label, $toNode->role->name); } else { if ($fromRole->name == 'Con') { //error_log("HERE3"); $allowed = $HUB_DATAMODEL->matchesModelCon($fromNode->role->name, $linkType->label, $toNode->role->name); } } } if (!$allowed) { //error_log("NOT ALLOWED"); $ERROR = new Error(); return $ERROR->createInvalidConnectionError(); } else { //error_log("ALLOWED"); $cobj = new Connection(); return $cobj->add($fromnodeid, $fromroleid, $linktypeid, $tonodeid, $toroleid, $private, $description); } } else { //error_log("NOT ALLOWED - LINK ERROR"); $ERROR = new Error(); return $ERROR->createInvalidConnectionError("linktypeid" . $linktypeid); } }
$nextuserid = $next['UserID']; $as = getUserActivity($nextuserid, $followlastrun); if ($as->totalno > 0) { $nextMessage .= '<br />' . $LNG->ADMIN_CRON_FOLLOW_USER_ACTIVITY_MESSAGE . ' <span style="font-weight:bold">' . $name . '</span>: <a href="' . $CFG->homeAddress . 'ui/popups/activityviewerusers.php?userid=' . $nextuserid . '&fromtime=' . $followlastrun . '">' . $LNG->ADMIN_CRON_FOLLOW_SEE_ACTIVITY_LINK . '</a>'; } } // GET ITEMS THEY FOLLOW $itemArray = getItemsBeingFollowedByMe($userid); $k = 0; $countk = count($itemArray); for ($k = 0; $k < $countk; $k++) { $array = $itemArray[$k]; $nodeid = $array['NodeID']; $nodename = $array['Name']; $nodetype = $array['NodeType']; $nextnode = getNode($nodeid); $as = getNodeActivity($nodeid, $followlastrun); $activities = $as->activities; if ($as->totalno > 0) { $nextMessage .= '<br /><br /><hr />' . $LNG->ADMIN_CRON_FOLLOW_ACTIVITY_FOR . ' ' . $nodetype . ': <span style="font-weight:bold">' . $nodename . '</span> <a href="' . $CFG->homeAddress . 'ui/popups/activityviewer.php?nodeid=' . $nodeid . '&fromtime=' . $followlastrun . '">' . $LNG->ADMIN_CRON_FOLLOW_EXPLORE_LINK . '</a>'; } foreach ($activities as $activity) { if ($activity->type == 'Follow') { $nextMessage .= '<br /><br /><span style="font-style:italic">' . $LNG->ADMIN_CRON_FOLLOW_ON_THE . ' ' . date("d M Y - H:i", $activity->modificationdate) . ' </span>'; $nextMessage .= ' ' . $activity->user->name . ' '; $nextMessage .= '<span style="font-weight:bold">' . $LNG->ADMIN_CRON_FOLLOW_STARTED . '</span> ' . $LNG->ADMIN_CRON_FOLLOW_THIS_ITEM; } else { if ($activity->type == 'Vote') { $nextMessage .= '<br /><br /><span style="font-style:italic">' . $LNG->ADMIN_CRON_FOLLOW_ON_THE . ' ' . date("d M Y - H:i", $activity->modificationdate) . ' </span>'; $nextMessage .= ' ' . $activity->user->name . ' '; if ($activity->changetype == 'Y') {
require_once("$abspath/system/design.php"); require_once("$abspath/system/fetch.php"); 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"); ?>
/** * Return an object with the Debate viewing stats. * * @param nodeid the nodeid of the Issue node to get the viewing stats for. * @param style, the style of node to return - how much data it has (defaults to 'mini' can also be 'long' or 'short') * @return debateviewingstats class containing properties: groupmembercount, viewingmembercount. * or an Error. */ function getDebateViewingStats($nodeid, $groupid) { $group = getGroup($groupid); $userset = $group->members; $members = $userset->users; $memberscount = count($members); $node = getNode($nodeid, 'shortactivity'); $activitySet = $node->activity; $activities = $activitySet->activities; $count = count($activities); $userCheck = array(); for ($i = 0; $i < $count; $i++) { $next = $activities[$i]; if ($next->type == 'View') { if (isset($next->userid) && $next->userid != "" && !in_array($next->userid, $userCheck)) { array_push($userCheck, $next->userid); } } } class debateviewingstats { public $groupmembercount = 0; public $viewingmembercount = 0; } $stats = new debateviewingstats(); $stats->groupmembercount = $memberscount; $stats->viewingmembercount = count($userCheck); return $stats; }
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); }
echo "</script></td>"; echo "<td>"; echo "<span class='labelinput' style='font-size: 100%;'>"; echo $LNG->FORM_ACTIVITY_ACTION_STARTED_FOLLOWING; echo "</span>"; echo "</td>"; echo "<td id='followitem" . $i . "'>"; echo "<script type='text/javascript'>"; echo " if (nodeFollowObj) { activityitems['followitem" . $i . "'] = renderNodeFromLocalJSon(nodeFollowObj, 'activity', nodeFollowObj.role, true); }"; echo "</script></td>"; echo "</tr>"; } } } else { if ($activity->type == 'Vote') { $votenode = getNode($activity->itemid); if ($votenode instanceof CNode) { try { $jsonvotenode = json_encode($votenode); } catch (Exception $e) { echo 'Caught exception: ', $e->getMessage(), "<br>"; } echo "<script type='text/javascript'>"; echo "var nodeVoteObj = "; echo $jsonvotenode; echo ";"; echo "</script>"; echo "<tr>"; echo "<td>"; echo "<span class='labelinput' style='font-size: 100%;'>" . date('d M Y', $activity->modificationdate) . "</span>"; echo "</td>";
} } break; case "nodes": if ($len == 2) { $nodeset = getNodesByGlobal(0, -1, 'date', 'ASC'); $nodeset->cipher = $cipher; if (isset($unobfuscationid) && $unobfuscationid != "") { $nodeset->unobfuscationid = $unobfuscationid; } $response = $nodeset; break; } else { if ($len == 3) { $id = check_param($parts[2], PARAM_TEXT); $node = getNode($id); $node->cipher = $cipher; if (isset($unobfuscationid) && $unobfuscationid != "") { $node->unobfuscationid = $unobfuscationid; } $response = $node; } } break; case "views": if ($len == 2) { $viewSet = getViews(); $viewSet->cipher = $cipher; if (isset($unobfuscationid) && $unobfuscationid != "") { $viewSet->unobfuscationid = $unobfuscationid; }
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); }
* * ********************************************************************************/ include_once "../../config.php"; $me = substr($_SERVER["PHP_SELF"], 1); // remove initial '/' if ($HUB_FLM->hasCustomVersion($me)) { $path = $HUB_FLM->getCodeDirPath($me); include_once $path; die; } array_push($HEADER, '<script src="' . $HUB_FLM->getCodeWebPath('ui/users.js.php') . '" type="text/javascript"></script>'); checkLogin(); include_once $HUB_FLM->getCodeDirPath("ui/headerdialog.php"); $nodeid = required_param("nodeid", PARAM_ALPHANUMEXT); $fromtime = optional_param("fromtime", "0", PARAM_TEXT); $node = getNode($nodeid); $as = getNodeActivity($nodeid, $fromtime, 0, -1); $activities = $as->activities; ?> <script type="text/javascript"> var activityitems = new Object(); var useritems = new Object(); </script> <div id="activitydiv"> <div class="formrow"> <div id="formsdiv" class="forminput"> <?php echo "<table class='table' cellspacing='0' cellpadding='3' border='0'>"; echo "<tr>";
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; }