function exec($args, $stdin, &$stdout, &$stderr, &$system) { if (!isAdmin()) { $stderr = ucf(i18n("not enough rights to set initial metadata")); return true; } if (empty($args)) { $stdout = "Usage: maddinit [class name] [metadata name] [value]\n"; $stdout .= "Example: maddinit file_folder view thumbnail"; } else { list($class_name, $name, $value) = splitArgs($args); $return = setInitialMetadata($class_name, $name, $value); if ($return === true) $stdout = "Updated metadata successfully"; else $stderr = $return; } return true; }
function exec($args, $stdin, &$stdout, &$stderr, &$system) { if (!empty($args)) { switch ($this->stage) { case 1: if (!login($this->username, $args)) { $stderr = ucf(i18n("login failed")).". ".ucf(i18n("please try again")); } else { $system->triggerEventIntern("login", array()); //$response->addScript("window.location.reload()"); $user = new mUser(); $user->setByUsername($this->username); $stdout = $user->name." ".i18n("logged in successfully"); } $this->stage = 0; return true; } $this->username = $args; $stdout = ucf(i18n("password:"******"document.getElementById('cmdline').type='password';"); return false; } return true; }
function getName($raw = false) { if ($raw) return $this->name; return ucf(str_replace("_", " ", $this->name)); }
function exec($args, $stdin, &$stdout, &$stderr, &$system) { logout(); $system->triggerEventIntern("logout", array()); $stdout = ucf(i18n("logout successfull")); 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) { $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 (!isAdmin()) { $stderr = ucf(i18n("not enough rights to add user to group")); return true; } if (empty($args)) { $stdout = "Usage: gadduser [group] [username]\n"; $stdout .= "Example: gadduser admins admin"; } else { list($groupname, $username) = explode(" ", $args); $user = new mUser(); $user->setByUsername($username); if ($user->id <= 0) { $stderr = ucf(i18n("no user named"))." $username ".i18n("found"); return true; } $group = new mGroup(); $group->setByName($groupname); if ($group->id <= 0) { $stderr = ucf(i18n("no group named"))." $groupname ".i18n("found"); return true; } $user_groups = $user->getGroups(); if (in_array($groupname, $user_groups)) { $stderr = $username." ".i18n("is already a member of")." $groupname"; return true; } $user->groups .= " $groupname"; $user->save(); $stdout = ucf(i18n("added"))." $username ".i18n("to")." $groupname"; } return true; }
function draw(&$system, $args) { $node_id = $this->getNodeId($args); $data = ""; if ($node_id > 0) { $object = new mObject($node_id); $data = compiletpl("scripts/versions", array(), $object); } else $data = compiletpl("message", array("titel"=>ucf(i18n("error")), "message"=>ucf(i18n("the specified path is invalid")))); $system->setZoneData($this->zone, utf8e($data)); }
function setOwnerOnObjectsRecursive(&$object, &$stdout, &$stderr, $rights) { if (!(isAdmin() || $object->hasRight("write"))) $stderr .= ucf(i18n("not enough rights to change ownership on"))." ".$object->getPathInTree()."\n"; if ($object->grantRight($rights)) $stdout .= "";//ucf(i18n("changed ownership successfully on"))." ".$object->getPathInTree()."\n"; else $stderr .= ucf(i18n("failed to change ownership on"))." ".$object->getPathInTree()."\n"; $children = fetch("FETCH node WHERE link:node_top='".$object->getNodeId()."' AND link:type='sub' NODESORTBY property:version SORTBY property:name"); for ($n = 0; $n < count($children); $n++) $this->setOwnerOnObjectsRecursive($children[$n], $stdout, $stderr, $rights); }
function execute(&$system, $args) { if (!is_array($this->actionHandlers)) $this->actionHandlers = array(); if (in_array($args['action'], $this->actionHandlers)) { $actionHandler = "action".ucf($args['action']); $this->$actionHandler($system, $args); return; } $this->draw($system, $args); }
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 (!isAdmin()) { $stderr = ucf(i18n("not enough rights to delete group")); return true; } switch ($this->stage) { case 1: if (empty($args) || strtolower($args) == "y" || strtolower($args) == "yes") { $result = delGroup($this->name); if ($result === true) $stdout = ucf(i18n("removed group successfully")); else $stdout = $result; $this->stage = 0; return true; } $stdout = ucf(i18n("aborted by user")); $this->stage = 0; return true; } if (empty($args)) { $stdout = "Usage: gdel [username]\n"; $stdout .= "Example: gdel admin"; return true; } else { $this->name = $args; $stdout = ucf(i18n("are you sure you want to delete this group"))." (Y/n)?"; $this->stage = 1; } return false; }
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 setSetting($name, $value, $theme = "") { clearSettingsCache(); $table = new mTable("settings"); if (empty($theme)) $theme = $_SESSION['murrix']['theme']; $settings = $table->get("`name`='$name' AND (`theme`='any' OR `theme`='$theme')"); if (count($settings) > 0) { $settings[0]['value'] = $value; if (empty($value)) { if (!$table->remove($settings[0]['id'])) return $table->error; else return true; } else { if (!$table->update($settings[0]['id'], $settings[0])) return $table->error; else return true; } } else if (!empty($value)) { $setting = array("name" => $name, "value" => $value, "theme" => $theme); if (!$table->insert($setting)) return $table->error; else return true; } return ucf(i18n("no such setting")); }
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 setInitialMetadata($class_name, $name, $value) { $table = new mTable("initial_meta"); $meta = $table->get("`class_name`='$class_name' AND `name`='$name'"); if (count($meta) > 0) { if (empty($value)) { if (!$table->remove($meta[0]['id'])) return $table->error; else return true; } else { if (!$table->update($meta[0]['id'], array($name => $value))) return $table->error; else return true; } } else if (!empty($name)) { if (empty($value)) return ucf(i18n("empty value, nothing set")); $meta = array("class_name" => $class_name, "name" => $name, "value" => $value); if (!$table->insert($meta)) return $table->error; else return true; } return ucf(i18n("empty name is forbidden")); }
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)) { $args_split = splitArgs($args); if (count($args_split) >= 2) { $name = $args_split[0]; $value = $args_split[1]; if (isset($args_split[2])) $theme = $args_split[2]; if (!isAdmin()) { $stderr = ucf(i18n("not enough rights")); return true; } $result = setSetting($name, $value, $theme); if ($result === true) $stdout = ucf(i18n("setting set successfully")); else $stdout = $result; } } else { $stdout = "Usage: sset [settingname] [value]\n"; $stdout .= "Example: sset TITLE \"Murrix title\""; } return true; }
$alternatives = $object->getVarValue("alternatives"); for ($n = 0; $n < count($alternatives); $n++) { ?> <div class="alternative"> <input class="input_radio" type="radio" name="answer" value="<?php echo $n; ?> "> <?php echo $alternatives[$n]; ?> </div> <? } ?> <input class="submit" id="submitButton" type="submit" value="<?php echo ucf(i18n("submit")); ?> "/> </div> </form> <? } ?> </div> </div> <? } ?>
function exec($args, $stdin, &$stdout, &$stderr, &$system) { if (!isAdmin()) { $stderr = ucf(i18n("not enough rights to create group")); return true; } switch ($this->stage) { case 1: $this->name = $args; $stdout = "$args\n"; $stdout .= ucf(i18n("enter description:")); $this->stage = 2; return false; case 2: $this->description = $args; $stdout = "$args\n".ucf(i18n("create home"))." (Y/n)?"; $this->stage = 3; return false; case 3: $this->create_home = (empty($args) || strtolower($args) == "y" || strtolower($args) == "yes"); if ($this->create_home) $stdout = "yes\n"; else $stdout = "no\n"; $stdout .= ucf(i18n("are you sure you want to create this group"))." (Y/n)?"; $this->stage = 4; return false; case 4: if (empty($args) || strtolower($args) == "y" || strtolower($args) == "yes") { $result = createGroup($this->name, $this->description, $this->create_home); if (is_numeric($result)) { $stdout = ucf(i18n("created new group successfully")); $this->stage = 0; return true; } $stderr = $result; $this->stage = 0; return true; } $stdout = ucf(i18n("aborted by user")); $this->stage = 0; return true; } if (empty($args)) { $stdout = ucf(i18n("enter name:")); $this->stage = 1; } else { $this->name = $args; $stdout .= ucf(i18n("enter description:")); $this->stage = 2; } return false; }
<? echo compiletpl("scripts/show/tabs", array("view"=>"delete"), $object); echo compiletpl("title/big", array("left"=>img(geticon($object->getIcon()))." ".$object->getName()), $object); ?> <div class="main"> <center> <?php echo "<span style=\"font-weight: bold; font-size: 16px;\">" . ucf(i18n("are you sure you want to delete")) . " \"" . $object->getName() . "\"?</span>"; ?> <br/> <table class="invisible" width="50%"> <tr> <td align="center"> <?php echo cmd(img(geticon("yes", 32)) . "<br/>" . ucf(i18n("yes")), "exec=delete&action=delete&node_id=" . $object->getNodeId()); ?> </td> <td align="center"> <?php echo cmd(img(geticon("no", 32)) . "<br/>" . ucf(i18n("no")), "exec=show&node_id=" . $object->getNodeId()); ?> </td> </tr> </table> </center> </div>
if ($object->hasRight("create")) { $titel = img(geticon("file"))." ".ucf(i18n("new")); if ($args['view'] == "new") { $current = $titel; $class = "tab_selected"; } else $class = "tab"; $text .= cmd($titel, "exec=new&node_id=".$object->getNodeId(), array("onmouseup"=>"document.getElementById('adminpanel').style.display='none'", "class"=>$class)); $titel = img(geticon("menu"))." ".ucf(i18n("import")); if ($args['view'] == "import") { $current = $titel; $class = "tab_selected"; } else $class = "tab"; $text .= cmd($titel, "exec=import&node_id=".$object->getNodeId(), array("onmouseup"=>"document.getElementById('adminpanel').style.display='none'", "class"=>$class)); } if (!empty($text)) { ?>
<? $args_title = array(); $args_title['left'] = img(geticon("comment"))." ".ucf(i18n("comments")); if ($object->hasRight("create") || $object->hasRight("comment")) $args_title['right'] = cmd(img(geticon("comment"))." ".ucf(i18n("post")), "exec=new&node_id=".$object->getNodeId()."&class_name=comment"); echo compiletpl("title/medium", $args_title, $object); $pagername = "comments_show"; $children = fetch("FETCH node WHERE link:node_top='".$object->getNodeId()."' AND link:type='sub' AND property:class_name='comment' NODESORTBY property:version SORTBY !property:created"); $children = getReadable($children); if (count($children) > 0) { include(gettpl("pager/start", $object)); for ($i = $start; $i < $end; $i++) echo compiletpl("scripts/show/line", array(), $children[$i]); include(gettpl("pager/end", $object)); } ?>
</div> <div class="show_line_main_right"></div> <div class="show_line_main"> <div class="show_line_main_top"> <div class="show_line_main_top_inner"> <span class="show_line_main_top_inner_title"> <?php echo cmd($object->getName(), "exec=show&node_id=" . $object->getNodeId()); ?> </span> </div> </div> <div class="show_line_main_bottom"> <?php echo DownloadSize(@filesize($object->getVarValue("file"))); ?> <a href="?file=<?php echo $object->resolveVarName("file"); ?> &download=1"><?php echo img(geticon("download")) . " " . ucf(i18n("download")); ?> </a><br/> <?php echo $object->getVarShow("description"); ?> </div> </div> </div> <div class="clear"></div>
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; }
</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 exec($args, $stdin, &$stdout, &$stderr, &$system) { if (!isAdmin()) { $stderr = ucf(i18n("not enough rights to create class")); return true; } switch ($this->stage) { case 1: $this->name = $args; $stdout = "$args\n"; $stdout .= ucf(i18n("enter icon:")); $this->stage = 2; return false; case 2: $this->icon = $args; $stdout = "$args\n"; $stdout .= ucf(i18n("are you sure you want to create this class"))." (Y/n)?"; $this->stage = 3; return false; case 3: if (empty($args) || strtolower($args) == "y" || strtolower($args) == "yes") { $result = createClass($this->name, $this->icon); if (is_numeric($result) || $result === true) { $stdout = ucf(i18n("created new class successfully")); $this->stage = 0; return true; } $stderr = $result; $this->stage = 0; return true; } $stdout = ucf(i18n("aborted by user")); $this->stage = 0; return true; } if (empty($args)) { $stdout = ucf(i18n("enter name:")); $this->stage = 1; } else { $this->name = $args; $stdout .= ucf(i18n("enter icon:")); $this->stage = 2; } return false; }
<legend> <?php echo $req . ucf(str_replace("_", " ", i18n($var->getName(true)))); ?> (<?php echo $var->getType(); ?> ) </legend> <? echo $var->getComment(); echo $var->getEdit("sEdit"); $args['output']['js'] .= $var->getJavascript("sEdit"); ?> </fieldset> </div> <br/> <? } } ?> <input class="submit" id="submitButton" type="submit" value="<?php echo ucf(i18n("save")); ?> "/> <input checked type="checkbox" name="newversion"/> <?php echo ucf(i18n("save as new version")); ?> </div> </div> </form>
echo ucf(i18n("login")); ?> </div> <div id="login_container" class="container"> <?php echo $_SESSION['murrix']['system']->createZone("zone_login"); ?> </div> <div class="title"> <a class="right" href="javascript:void(null)" onclick="toggleSidebarContainer('calendar')"><?php echo img(imgpath("1downarrow.png"), "", "", "calendar_arrow"); ?> </a> <?php echo cmd(ucf(i18n("calendar")), "exec=calendar", "sidebar"); ?> </div> <div id="calendar_container" class="container"> <div class="container"> <?php echo compiletpl("scripts/calendar/small_month", array("firstday" => strtotime(date("Y-m") . "-01"))); ?> </div> </div> <?php echo $_SESSION['murrix']['system']->createZone("zone_poll"); ?> <?php