本文整理汇总了PHP中Page::assign方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::assign方法的具体用法?PHP Page::assign怎么用?PHP Page::assign使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Page
的用法示例。
在下文中一共展示了Page::assign方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayErrorPage
public static function displayErrorPage($type, $msg = "")
{
$page = new Page(PageManager::$smarty, "pages/bigMessage.tpl");
switch ($type) {
case "access":
$page->assign("page", "Access denied");
$page->assign("message", Reporting::error("You dont have access to display this page."));
break;
case "error":
$page->assign("page", "An error occured.");
$page->assign("message", Reporting::error($msg));
break;
case "404":
$page->assign("page", "Page not found");
$page->assign("message", Reporting::error("The requests page you are looking for, wasn't found in our System. Sorry :("));
break;
default:
$page->assign("page", "Error Occured");
$page->assign("message", Reporting::error("And undefined error occured. Please try to reload the page or contact the system administrator."));
break;
}
if (isset($_SERVER['HTTP_REFERER'])) {
$page->assign("referrer", $_SERVER['HTTP_REFERER']);
}
$page->display();
}
示例2: User
$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
$local = UserManager::getLocalUser();
$localUsername = $local->getData("username");
$localID = $local->getData("id");
$gameName = $template->getData("gameName");
$ip = $server->getData("ip");
$username = $user->getData("username");
$userID = $user->getData("id");
Core::addToAdminLog("Admin {$localUsername} ({$localID}) has created a gameserver ({$gameName} [{$ip}:{$serverPort}]) for {$username} ({$userID})");
} else {
$page->assign("t_Report", Reporting::error(Utils::buildErrorString($error)));
}
} else {
if ("RemoveServer" == $do) {
示例3: Template
}
if (!isset($_GET['vers'])) {
$errors[] = "No script directory was given.";
} else {
if (empty($_GET['vers'])) {
$errors[] = "The script directory is empty.";
}
}
if (count($errors) == 0) {
if (TemplateManager::existsByFolderNameAndVersion($_GET['folder'], $_GET['vers'])) {
$errors[] = "The script is already installed in this version.";
}
}
if (count($errors) == 0) {
Core::addTask(TASK_TEMPLATES_INSTALL_FROM_REMOTE, $_GET['folder']);
$page->assign("t_Report", Reporting::success("The Script will be installed in a few moments..."));
} else {
$page->assign("t_Report", Reporting::error(Utils::buildErrorString($errors)));
}
} else {
if ("RemoveScript" == $do) {
if (!empty($_GET['id'])) {
if (TemplateManager::existsById($_GET['id'])) {
$t = new Template($_GET['id']);
if ($t->isInstalledOnAnyServer() != 0) {
$page->assign("t_Report", Reporting::error("The template (ID " . $t->getData("id") . ") is still installed on any server."));
} else {
$t->remove();
$page->assign("t_Report", Reporting::success("The template (ID " . $t->getData("id") . ") was successfully removed."));
}
} else {
示例4: Page
$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();
示例5: isset
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* 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;
}
include "../classes/PhysicalServerManager.class.php";
include "../classes/PhysicalServer.class.php";
$serverid = isset($_GET['serverid']) ? $_GET['serverid'] : null;
if ($serverid != null) {
if (PhysicalServerManager::existsById($serverid)) {
$server = new PhysicalServer($serverid);
$page = new Page($smarty, "modals/PhysicalServerInitialize.tpl");
$page->assign("server", $server);
$page->display();
} else {
$p = new Page($smarty, "modals/DefaultError.tpl");
$p->display();
}
} else {
$p = new Page($smarty, "modals/DefaultError.tpl");
$p->display();
}
示例6: Page
<?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";
// Custom Includes
// Admin Check
$user = UserManager::getLocalUser();
if (!$user->isAdmin()) {
PageManager::displayErrorPage("access");
return;
}
$smarty->assign("page", "Check Installation");
$smarty->assign("pageActive", "checkinstallation");
$page = new Page($smarty, "pages/adminCheckinstallation.tpl");
$installerrors = Core::getInstallationErrors();
$page->assign("errorCount", $installerrors["count"]);
$page->assign("installErrors", $installerrors);
$page->display();
示例7: array
$error = array();
if (!UserManager::checkValidEmail($email)) {
$error[] = "Ungültige E-Mail Adresse.";
}
if (!UserManager::checkValidPassword($pass)) {
$error[] = "Ungültiges Passwort.";
}
if (count($error) == 0 && !UserManager::tryLogin($email, $pass)) {
$error[] = "Es wurde kein Nutzer mit den angegeben Login-Daten gefunden.";
}
if (count($error) == 0) {
if (isset($_POST['keepLoggedIn'])) {
setcookie("username", $email, time() + 60 * 60 * 24 * 30 * 12 * 4);
setcookie("password", $pass, time() + 60 * 60 * 24 * 30 * 12 * 4);
}
$page->assign("t_Report", Reporting::success("Sie wurden erfolgreich eingeloggt!<br />Sie werden in Kürze weitergeleitet."));
$page->assign("t_Redirect", array("seconds" => 2, "link" => Core::GetConfig("dirRoot") . "Dashboard"));
} else {
$msg = "Es sind Fehler aufgetreten!<ul>";
foreach ($error as $e) {
$msg .= "<li>" . $e . "</li>";
}
$msg .= "</ul>";
$page->assign("t_Report", Reporting::error($msg));
$page->assign("error", 1);
}
}
if (is_dir("install")) {
$page->assign("t_StaticInformation", Reporting::info("<br />Standard Werte für den Admin Nutzer: <br />E-Mail: admin@admin.de<br />Passwort: admin<br />Um diese Nachricht auszublenden, lösche das Verzeichnis 'install'"));
}
$page->display();
示例8: Page
$user = UserManager::getLocalUser();
if (!$user->isAdmin()) {
PageManager::displayErrorPage("access");
return;
}
$smarty->assign("page", "Server");
$smarty->assign("pageActive", "server");
$page = new Page($smarty, "pages/adminServer.tpl");
if (isset($_GET['do']) || isset($_POST['do'])) {
$do = isset($_GET['do']) ? $_GET['do'] : $_POST['do'];
if ($do == "AddServer") {
unset($_POST['do']);
$errors = PhysicalServerManager::validateInformation($_POST);
if (count($errors) == 0) {
PhysicalServerManager::addServer($_POST);
$page->assign("t_Report", Reporting::success("Der neue Server \"" . $_POST['name'] . "\" wurde erfolgreich hinzugefügt"));
//header("Location: " . Core::GetConfig("dirRoot") . "Server");
} else {
$page->assign("t_Report", Reporting::error(Utils::buildErrorString($errors)));
}
} else {
if ($do == "RemoveScript") {
$errors = array();
$sid = isset($_GET['sid']) ? $_GET['sid'] : "";
if (empty($sid)) {
$errors[] = "No server id given.";
} else {
if (!is_numeric($sid)) {
$errors[] = "Invalid server id given.";
} else {
if (!PhysicalServerManager::existsById($sid)) {
示例9: assignTplVar
/**
* @param string $key
* @param string $value
* @return void
*/
protected function assignTplVar($key, $value)
{
Page::assign($key, $value);
}
示例10: Page
$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();
} else {
if ("Stop" == $do) {
$page->assign("t_Report", Reporting::success("The gameserver will be stopped soon."));
$gs->scheduleStop();
}
}
}
$page->display();
} else {
$page = new Page($smarty, "pages/bigmessage.tpl");
$page->assign("t_Report", Reporting::Error("You havent selected any gameserver yet."));
$page->display();
}
示例11: Page
<?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", "Logout");
$smarty->assign("t_CSS", "login.css");
$page = new Page($smarty, "pages/bigMessage.tpl");
$page->assign("message", Reporting::success("Sie wurden erfolgreich ausgeloggt. <br />Sie werden nun weitergeleitet."));
$page->assign("t_Redirect", array("seconds" => 2, "link" => Core::GetConfig("dirRoot") . "Login"));
session_destroy();
setcookie("username", "", time() - 3600);
setcookie("password", "", time() - 3600);
$page->display();
示例12: Page
<?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";
// Admin Check
$user = UserManager::getLocalUser();
if (!$user->isAdmin()) {
PageManager::displayErrorPage("access");
return;
}
$smarty->assign("page", "Dashboard");
$smarty->assign("pageActive", "dashboard");
$page = new Page($smarty, "pages/dashboard.tpl");
$page->assign("adminLogEntries", Core::getLatestAdminLog(20));
$page->assign("taskLogEntries", Core::getLatestTaskLog(20));
$page->display();
示例13: Page
*
* 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;
}
$page = new Page($smarty, "modals/AdminGameserverAdd.tpl");
// Users
$c = UserManager::getAllUsers();
if ($c === false) {
$page->assign("t_Report", Reporting::info("There are no users yet. Try <a href='" . Core::GetConfig("dirRoot") . "Customer'>adding one</a>."));
} else {
$page->assign("customerArrayData", $c);
}
// Templates
$c = TemplateManager::getAllGameserverTemplates();
if ($c == false) {
$page->assign("t_Report", Reporting::info("There are no not gameserver templates yet. Try <a href='" . Core::GetConfig("dirRoot") . "Templates'>adding one</a>."));
} else {
$page->assign("templateArrayData", $c);
}
// Physical Servers
$c = PhysicalServerManager::getAllPhysicalServer();
if ($c === false) {
$page->assign("t_Report", Reporting::info("There are no servers yet. Try <a href='" . Core::GetConfig("dirRoot") . "Server'>adding one</a>."));
} else {
示例14: isset
* 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();
}
示例15: Page
<?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";
// Admin Check
$user = UserManager::getLocalUser();
if (!$user->isAdmin()) {
PageManager::displayErrorPage("access");
return;
}
$page = new Page($smarty, "modals/AdminGameserverReinstall.tpl");
$gsID = isset($_GET['gameserver']) ? $_GET['gameserver'] : null;
if (GameserverManager::existsById($gsID)) {
$gs = new Gameserver($gsID);
$page->assign("gs", $gs);
} else {
$page->assign("t_Report", Reporting::error("This Gameserver isnt available."));
}
$page->display();