Esempio n. 1
0
 public function __construct($id)
 {
     if (UserManager::existsById($id)) {
         $con = Database::getCon();
         $res = $con->query("SELECT * FROM users WHERE id = {$id}");
         $this->Data = $res->fetch_array();
         $this->Data["settings"] = unserialize($this->Data["settings"]);
         $this->Data["gameServerCount"] = Database::getRowCount("gameserver", array("userID" => $this->getData("id")));
     } else {
         trigger_error("User existiert nicht");
     }
 }
 public static function initialize()
 {
     if (isset($_SESSION['id']) && $_SESSION['id'] != -1) {
         if (UserManager::existsById($_SESSION['id'])) {
             UserManager::$_localUser = new User($_SESSION['id']);
         } else {
             $_SESSION['id'] = -1;
         }
     } else {
         if (isset($_COOKIE['username']) && isset($_COOKIE['password']) && !(isset($_SESSION['id']) && $_SESSION['id'] != -1)) {
             UserManager::tryLogin($_COOKIE['username'], $_COOKIE['password'], true);
         }
     }
 }
Esempio n. 3
0
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
include "../core.php";
// Admin Check
$user = UserManager::getLocalUser();
if (!$user->isAdmin()) {
    PageManager::displayErrorPage("access");
    return;
}
$userid = isset($_GET['userid']) ? $_GET['userid'] : null;
if ($userid != null) {
    if (UserManager::existsById($userid)) {
        $user = new User($userid);
        $page = new Page($smarty, "modals/CustomerRemove.tpl");
        if ($user->getData("gameServerCount") == 0) {
            $page->assign("u", $user);
        } else {
            $page->assign("t_Report", Reporting::Error("This customer cannot be deleted because still has gameservers. They have to be deleted manually."));
        }
        $page->display();
    } else {
        $p = new Page($smarty, "modals/DefaultError.tpl");
        $p->display();
    }
} else {
    $p = new Page($smarty, "modals/DefaultError.tpl");
    $p->display();
Esempio n. 4
0
         $error[] = "The given Template doesnt exist.";
     } else {
         $template = new Template($_POST['templateid']);
         if ($template->isBaseTemplate()) {
             $error[] = "The given Template is not a gameserver template.";
         } else {
             $gameName = $template->getData("gameName");
         }
     }
 }
 // Customer ID
 $err = @Utils::checkInput($_POST['customerid'], "Customer ID", 1, 64, INPUT_TYPE_NUMERIC);
 if (strlen($err) != 0) {
     $error[] = $err;
 } else {
     if (!UserManager::existsById($_POST['customerid'])) {
         $error[] = "The given User doesnt exist.";
     } else {
         $user = new User($_POST['customerid']);
         $userName = $user->getData("username") . " (" . $user->getData("prename") . " " . $user->getData("lastname") . ")";
     }
 }
 // Slots
 $err = @Utils::checkInput($_POST['slots'], "Slots", 1, 64, INPUT_TYPE_NUMERIC);
 if (strlen($err) != 0) {
     $error[] = $err;
 }
 if (count($error) == 0) {
     $page->assign("t_Report", Reporting::success("A Gameserver for the User {$userName} will be installed shortly.<br />Server: {$serverName} {$serverIP}:{$serverPort}<br />Game: {$gameName}"));
     GameserverManager::createServer($server, $user, $template, $serverPort, $_POST["slots"]);
     // Log
 * WolfPanel (c) 2015 by Fursystems.de (Marcel Kallen)
 * 
 * WolfPanel is licensed under a
 * Creative Commons Attribution-NonCommercial 4.0 International License.
 * 
 * You should have received a copy of the license along with this
 * work. If not, see <http://creativecommons.org/licenses/by-nc/4.0/>. 
 */
include "../core.php";
// Admin Check
$user = UserManager::getLocalUser();
if (!$user->isAdmin()) {
    PageManager::displayErrorPage("access");
    return;
}
if (isset($_GET["userid"])) {
    if (UserManager::existsById($_GET['userid'])) {
        $gs = GameserverManager::getAllByUserID($_GET['userid']);
        if ($gs !== false) {
            $smarty->assign("Gameservers", $gs);
        }
    } else {
        $smarty->assign("t_Report", Reporting::error("The given user doesnt exist."));
    }
} else {
    $gs = GameserverManager::getAll();
    if ($gs !== false) {
        $smarty->assign("Gameservers", $gs);
    }
}
$smarty->display("ajax/getAdminGameserverList.tpl");
Esempio n. 6
0
     }
     if (count($error) == 0) {
         $username = $_POST["username"];
         UserManager::addUser($_POST['username'], $_POST['prename'], $_POST['lastname'], $_POST['email']);
         $page->assign("t_Report", Reporting::success("The user \"{$username}\" was added successfully."));
     } else {
         $page->assign("t_Report", Reporting::error(Utils::buildErrorString($error)));
     }
 } else {
     if ("RemoveCustomer" == $do) {
         $error = array();
         $err = @Utils::checkInput($_POST['userid'], "User ID", 0, 0, INPUT_TYPE_NUMERIC);
         if (strlen($err) != 0) {
             $error[] = $err;
         } else {
             if (!UserManager::existsById($_POST['userid'])) {
                 $error[] = "The given User ID doesn't exist.";
             } else {
                 $user = new User($_POST['userid']);
                 if ($user->getData("coins") > 0) {
                     $error[] = "The user still has coins. You cannot delete him.";
                 }
                 // TODO: Gameserver Count ask
             }
         }
         if (count($error) == 0) {
             $username = $user->getData("username");
             $name = $user->getData("prename") . " " . $user->getData("lastname");
             $page->assign("t_Report", Reporting::success("The user \"{$username}\" (\"{$name}\") has been removed successfully."));
             Database::rowDeleteByField("users", "id", $_POST['userid']);
         } else {