public function setUserdata($name, $wert, $typ = "", $UserID = 0, $echoSaved = false) { if ($UserID != 0 and $_SESSION["S"]->isUserAdmin() == "0") { echo "Only an admin-user can change Userdata of other users!"; exit; } if ($typ == "uRest" and $_SESSION["S"]->isUserAdmin() == "0") { echo "Only an admin-user can change restrictions!"; exit; } if ($UserID == 0) { $UserID = $_SESSION["S"]->getCurrentUser()->getID(); } $UD = $this->getUserdata($name, $UserID); if ($UD == null) { $nUD = new Userdata(-1); $nUDA = $nUD->newAttributes(); $nUDA->UserID = $UserID; $nUDA->name = $name; $nUDA->wert = $wert; $nUDA->typ = $typ; $nUD->setA($nUDA); $nUD->newMe(); $this->collector[] = $nUD; } else { $UD->saveNewValue($wert); } if ($echoSaved) { Red::messageSaved(); } }