public function __construct($smarty, $smartyTemplate, $mode = null)
 {
     if (null == $mode) {
         if (!empty($_GET['mode'])) {
             if ("json" == $_GET['mode']) {
                 $mode = MODE_JSON;
             }
         }
     }
     if (null == $mode) {
         $mode = MODE_WEB;
     }
     $this->_mode = $mode;
     $this->_smarty = $smarty;
     $this->_smartyTemplate = $smartyTemplate;
     // User specified global information
     if (UserManager::GetLocalUser() != null) {
         $this->_assigns["t_User"] = UserManager::GetLocalUser();
         $this->_assigns["t_GameserverList"] = UserManager::GetLocalUser()->getAllGameserver();
         $this->_assigns["t_Gameserver"] = UserManager::GetLocalUser()->getSelectedGameserver();
     }
     // Javascript File
     $jsscript = str_replace("pages/", "", str_replace(".tpl", ".js", $smartyTemplate));
     $jsfile = Core::GetConfig("dirIntRoot") . "assets/js/custom/{$jsscript}";
     if (file_exists($jsfile)) {
         $smarty->assign("t_JS", $jsscript);
     }
 }
$smarty->assign("pageActive", "userdashboard");
$page = new Page($smarty, "pages/userDashboard.tpl");
if (isset($_GET['do']) || isset($_POST['do'])) {
    $do = isset($_GET['do']) ? $_GET['do'] : $_POST['do'];
    if ("select" == $do) {
        $error = array();
        // Gameserver ID
        $err = @Utils::checkInput($_REQUEST['id'], "Gameserver ID", 1, 64, INPUT_TYPE_NUMERIC);
        if (strlen($err) != 0) {
            $error[] = $err;
        } else {
            if (!GameserverManager::existsById($_REQUEST['id'])) {
                $error[] = "The given Gameserver doesnt exist.";
            } else {
                $gameserver = new Gameserver($_REQUEST['id']);
                if ($gameserver->getOwnerId() != UserManager::GetLocalUser()->getData("id")) {
                    $error[] = "You dont have permission to perform this command";
                } else {
                    UserManager::GetLocalUser()->setSelectedGameserver($gameserver);
                }
            }
        }
        if (count($error) == 0) {
            $page->assign("t_Report", Reporting::Success("The server has been selected."));
            UserManager::GetLocalUser()->setSelectedGameserver($gameserver);
        } else {
            $page->assign("t_Report", Reporting::error(Utils::buildErrorString($error)));
        }
    }
}
$page->display();
<?php

/*
 * 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";
if (isset($_POST["id"])) {
    // Gameserver ID
    $err = @Utils::checkInput($_POST['id'], "Gameserver ID", 1, 64, INPUT_TYPE_NUMERIC);
    if (strlen($err) != 0) {
        $error[] = $err;
    } else {
        if (!GameserverManager::existsById($_POST['id'])) {
            $error[] = "The given Gameserver doesnt exist.";
        } else {
            $gameserver = new Gameserver($_POST['id']);
            if ($gameserver->getOwnerId() != UserManager::GetLocalUser()->getData("id")) {
                $error[] = "You dont have permission to perform this command";
            } else {
                $smarty->assign("log", "<pre>" . $gameserver->getLatestLog() . "</pre>");
            }
        }
    }
    $smarty->display("ajax/getGameserverLog.tpl");
}
<?php

/*
 * 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 "assets/core.php";
$smarty->assign("page", "Start / Stop / Restart");
$smarty->assign("pageActive", "userservercontrol");
$lU = UserManager::GetLocalUser();
if ($lU->getSelectedGameserver() != null) {
    $gs = $lU->getSelectedGameserver();
    $page = new Page($smarty, "pages/userServerControl.tpl");
    if (isset($_GET['do']) || isset($_POST['do'])) {
        $do = isset($_GET['do']) ? $_GET['do'] : $_POST['do'];
    } else {
        $do = "nothing";
    }
    // Controllable
    $page->assign("controllable", $gs->isControlable());
    if (!$gs->isControlable()) {
        $page->assign("t_Report", Reporting::error("This Gameserver is not availabe for control at the moment."));
    } else {
        if ("Start" == $do) {
            $page->assign("t_Report", Reporting::success("The gameserver will be started soon."));
            $gs->scheduleStart();