function doNewUser() { $username = $_REQUEST["UserName"]; $user = new User(); if ($user->selectByName($username)) { fehlerausgabe("Fehler: User existiert schon"); die; } }
function doMkDir() { global $sage_data_dir; $cwd = $_SESSION["path"]; $newname = quotemeta(@$_REQUEST["OrdnerName"]); if (strstr($newname, "/") || strstr($newname, "\\")) { fehlerausgabe("Kann {$newname} nicht anlegen: Ungültiger Name"); return false; } $path = new Path(); if ($path->selectByName($newname)) { fehlerausgabe("Kann Ordner {$newname} nicht anlegen: Ordner existiert schon"); return false; } $path->loginname = $_SESSION["user"]->loginname; $path->pathname = $_SESSION["path"] . "/" . $newname; $path->description = $_REQUEST["Beschreibung"]; $path->insert_at = "NOW()"; $path->modified_at = "NOW()"; $curpath = new Path(); if (!$curpath->selectByName($_SESSION["path"])) { fehlerausgabe("Kann Ordner {$newname} nicht anlegen: Kann Parent-Pfad nicht finden"); return false; } $path->path_id_parent = $curpath->path_id; if (!$path->insert()) { fehlerausgabe("Kann Ordner {$newname} nicht anlegen: Kann Pfad nicht in DB schreiben"); return false; } $path->selectByName($_SESSION["path"] . "/" . $newname); // zur Zeit wird ein neuer Ordner standardmässig der Gruppe zur Verfügung gestellt $acluserid = $_SESSION["user"]->user_id_parent; if ($acluserid == "") { $acluserid = $_SESSION["user"]->user_id; } // [kludge]: verwende Referenz auf die Parent-ACL mit veränderter Path-ID, um eine neue // ACL zu erzeugen $acllist = new ACLList(); if (!$acllist->selectByUserIDAndPath($acluserid, $_SESSION["path"])) { fehlerausgabe("Kann Ordner {$newname} nicht anlegen: Fehler beim Selektieren der Parent-ACL"); return false; } if (count($acllist) < 1) { fehlerausgabe("Kann Ordner {$newname} nicht anlegen: Kann Parent-ACL nicht finden"); return false; } $acl = $acllist->list[0]; $acl->user_id = $acluserid; $acl->path_id = $path->path_id; if (!$acl->insert()) { fehlerausgabe("Kann Ordner {$newname} nicht anlegen: Kann nicht einfügen"); return false; } //fs $oldumask = umask(); umask(077); if (!mkdir($sage_data_dir . $path->pathname, 0700)) { fehlerausgabe("Kann Ordner {$newname} nicht anlegen: Dateisystem weigert sich"); return false; } umask($oldumask); redirectTo($_SERVER["PHP_SELF"] . "?cmd=ls"); return true; }
function deleteACL($aclid) { $dbq = new DB(); $dbq->db_connect(); $query = "DELETE FROM sage_acl\n WHERE acl_id = {$aclid}"; // db_insert gibt ein boolean zurück $result = $dbq->db_insert($query); if (!$result) { fehlerausgabe("Konnte die ACL nicht löschen."); die; } }
<?php ob_start(); require_once "inc/functions.inc.php"; if (!loggedIn()) { setupSession(); } require_once "inc/config.inc.php"; require_once "inc/mysql_class.inc.php"; require_once "inc/fehlerausgabe.inc.php"; $PageName = "ACL-Editor"; require "inc/header.inc.php"; require "inc/leftnav.inc.php"; $command = @$_POST["cmd"]; if ($command == "") { $command = "list"; } if ($command == "list") { $path = @$_POST["path"]; if ($path == "") { fehlerausgabe("Kein Pfad angegeben"); die; } listACLsByPath($path); } /* else if ($command == "change") { if (!doChange()) printProfileForm(); else redirectTo($_SERVER["PHP_SELF"]); }*/ require "inc/footer.inc.php"; ob_end_flush();
function doChange() { $retval = true; if (isset($_POST["oldpw"]) && @$_POST["oldpw"] != "") { echo $_POST["oldpw"]; if (!changePassword(@$_POST["oldpw"], @$_POST["pw"], @$_POST["pwcfrm"])) { return false; } } if (!changeFirstName(@$_POST["firstname"])) { $retval = false; } if (!changeSurName(@$_POST["surname"])) { $retval = false; } if (!changeDescription(@$_POST["description"])) { $retval = false; } if (!changeHomepage(@$_POST["homepage"])) { $retval = false; } if (!changeEMail(@$_POST["e_mail"])) { $retval = false; } $uid = $_SESSION["user"]->user_id; if (!$_SESSION["user"]->selectByID($uid)) { fehlerausgabe("Fehler beim Neuladen des Userprofils. Bitte melden Sie sich neu an"); die; } return $retval; }