当前位置: 首页>>代码示例>>PHP>>正文


PHP TemplateManager::existsById方法代码示例

本文整理汇总了PHP中TemplateManager::existsById方法的典型用法代码示例。如果您正苦于以下问题:PHP TemplateManager::existsById方法的具体用法?PHP TemplateManager::existsById怎么用?PHP TemplateManager::existsById使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TemplateManager的用法示例。


在下文中一共展示了TemplateManager::existsById方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: Template

     if (!Core::isValidPort($_POST['port'])) {
         $error[] = "The given port is not a valid port.";
     } else {
         if (!$server->isPortFree($_POST['port'])) {
             $error[] = "The given port isnt free.";
         } else {
             $serverPort = $_POST["port"];
         }
     }
 }
 // Template ID
 $err = @Utils::checkInput($_POST['templateid'], "Template ID", 1, 64, INPUT_TYPE_NUMERIC);
 if (strlen($err) != 0) {
     $error[] = $err;
 } else {
     if (!TemplateManager::existsById($_POST['templateid'])) {
         $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 {
开发者ID:xerox8521,项目名称:FS-Gamepanel,代码行数:31,代码来源:admingameserver.php

示例2: isset

     if (!is_numeric($sid)) {
         $errors[] = "Invalid server id given.";
     } else {
         if (!PhysicalServerManager::existsById($sid)) {
             $errors[] = "The given server id doesn't exist.";
         }
     }
 }
 $tplid = isset($_GET['id']) ? $_GET['id'] : "";
 if (empty($tplid)) {
     $errors[] = "No template id given.";
 } else {
     if (!is_numeric($tplid)) {
         $errors[] = "Invalid template id given.";
     } else {
         if (!TemplateManager::existsById($tplid)) {
             $errors[] = "The given template doesn't exist.";
         }
     }
 }
 $tpl = new Template($tplid);
 $server = new PhysicalServer($sid);
 if (count($errors) == 0) {
     if (!$tpl->isInstalledOnServer($server)) {
         $errors[] = "The defined script is not installed on the given server.";
     }
 }
 if (count($errors) == 0) {
     $tpl->removeFromServer($server);
     $page->assign("t_Report", Reporting::success("The template was removed from the server successfully."));
 } else {
开发者ID:xerox8521,项目名称:FS-Gamepanel,代码行数:31,代码来源:server.php

示例3: execute

 public function execute()
 {
     $done = true;
     if (!$this->_validate()) {
         return $this->delete();
     }
     try {
         switch ($this->getData("type")) {
             case TASK_SERVER_INIT:
                 $err = $this->server->initializeForUse();
                 if (strlen($err) == 0) {
                     Core::addToTaskLog("Server " . $this->getData("serverID") . " has been initialized.");
                 } else {
                     Core::addToTaskLog("Server " . $this->getData("serverID") . " could not be initialized. Reason: {$err}.");
                 }
                 break;
             case TASK_SERVER_UPDATE:
                 $server = new PhysicalServer($this->getData('serverID'));
                 $server->updateServer();
                 Core::addToTaskLog("Server " . $this->getData("serverID") . " has been updated");
                 break;
             case TASK_SERVER_INSTALL_TEMPLATE:
                 if (!PhysicalServerManager::existsById($this->getData("serverID"))) {
                     $this->delete();
                 }
                 if (!TemplateManager::existsById($this->getData("addInfo"))) {
                     $this->delete();
                 }
                 $server = new PhysicalServer($this->getData("serverID"));
                 $template = new Template($this->getData("addInfo"));
                 $template->installOnServer($server);
                 Core::addToTaskLog("Template (" . $template->getData("id") . ", " . $template->getData("gameName") . ") installed on server " . $server->getData("id") . " (" . $server->getData("name") . ")");
                 break;
             case TASK_TEMPLATES_INSTALL_FROM_REMOTE:
                 $template = TemplateManager::loadTemplateByRemote($this->getData("addInfo"));
                 Core::addToTaskLog("Gameserver templated downloaded. (" . $template->getData("gameName") . ")");
                 break;
             case TASK_GAMESERVER_UPDATESETTINGS:
                 if (GameserverManager::existsById($this->getData("addInfo"))) {
                     echo "Updating Config.";
                     $gameserver = new Gameserver($this->getData("addInfo"));
                     $gameserver->settingsUpdateOnServer();
                     $id = $gameserver->getData("id");
                     Core::addToTaskLog("Gameserver settings saved. (ID: {$id})");
                 } else {
                     $id = $this->getData("addInfo");
                     Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
                 }
                 break;
             case TASK_GAMESERVER_INSTALL:
                 if (GameserverManager::existsById($this->getData("addInfo"))) {
                     $gameserver = new Gameserver($this->getData("addInfo"));
                     $gameserver->install();
                     $id = $gameserver->getData("id");
                     Core::addToTaskLog("Gameserver installed. (ID: {$id})");
                 } else {
                     $id = $this->getData("addInfo");
                     Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
                 }
                 break;
             case TASK_GAMESERVER_UNINSTALL:
                 if (GameserverManager::existsById($this->getData("addInfo"))) {
                     $gameserver = new Gameserver($this->getData("addInfo"));
                     $done = $gameserver->delete();
                     $id = $gameserver->getData("id");
                     if ($done) {
                         Core::addToTaskLog("Gameserver deleted. (ID: {$id})");
                     }
                 } else {
                     $id = $this->getData("addInfo");
                     Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
                 }
                 break;
             case TASK_GAMESERVER_START:
                 if (GameserverManager::existsById($this->getData("addInfo"))) {
                     $gameserver = new Gameserver($this->getData("addInfo"));
                     $gameserver->start();
                     $id = $gameserver->getData("id");
                     Core::addToTaskLog("Gameserver started. (ID: {$id})");
                 } else {
                     $id = $this->getData("addInfo");
                     Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
                 }
                 break;
             case TASK_GAMESERVER_STOP:
                 if (GameserverManager::existsById($this->getData("addInfo"))) {
                     $gameserver = new Gameserver($this->getData("addInfo"));
                     $gameserver->stop();
                     $id = $gameserver->getData("id");
                     Core::addToTaskLog("Gameserver stopped. (ID: {$id})");
                 } else {
                     $id = $this->getData("addInfo");
                     Core::addToTaskLog("Gameserver Install Task couldnt be executed. Gameserver doesnt exist (ID: {$id})", LOGLEVEL_WARNING);
                 }
                 break;
             case TASK_GAMESERVER_DISABLE:
                 if (GameserverManager::existsById($this->getData("addInfo"))) {
                     $gameserver = new Gameserver($this->getData("addInfo"));
                     $gameserver->disable();
                     $id = $gameserver->getData("id");
//.........这里部分代码省略.........
开发者ID:xerox8521,项目名称:FS-Gamepanel,代码行数:101,代码来源:Task.class.php


注:本文中的TemplateManager::existsById方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。