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


PHP Core::getOptions方法代码示例

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


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

示例1: indexAction

 /**
  * Index action.
  *
  * @return Bengine_Comm_Controller_Signup
  */
 public function indexAction()
 {
     $this->assign("page", Core::getLang()->getItem("REGISTRATION"));
     $this->assign("userCheck", sprintf(Core::getLanguage()->getItem("USER_CHECK"), Core::getOptions()->get("MIN_USER_CHARS"), Core::getOptions()->get("MAX_USER_CHARS")));
     $this->assign("passwordCheck", sprintf(Core::getLanguage()->getItem("PASSWORD_CHECK"), Core::getOptions()->get("MIN_PASSWORD_LENGTH"), Core::getOptions()->get("MAX_PASSWORD_LENGTH")));
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:12,代码来源:Signup.php

示例2: run

 /**
  * Runs the community application.
  *
  * @return Comm
  */
 public function run()
 {
     parent::run();
     Hook::event("CommStart");
     define("LANG", Core::getLang()->getOpt("langcode") . "/");
     Core::getLang()->load("Registration");
     self::setCMS();
     self::initUniverses();
     self::initLanguage();
     Core::getTPL()->addHTMLHeaderFile("lib/jquery.js", "js");
     Core::getTPL()->addHTMLHeaderFile("lib/bootstrap.js", "js");
     Core::getTPL()->addHTMLHeaderFile("main.js", "js");
     Core::getTPL()->addHTMLHeaderFile("sign.js", "js");
     Core::getTPL()->addHTMLHeaderFile("style.css", "css");
     Core::getTPL()->assign("containerClass", "content");
     Core::getTPL()->addLoop("headerMenu", self::getCMS()->getMenu("h"));
     $userCheck = sprintf(Core::getLanguage()->getItem("USER_CHECK"), Core::getOptions()->get("MIN_USER_CHARS"), Core::getOptions()->get("MAX_USER_CHARS"));
     $passwordCheck = sprintf(Core::getLanguage()->getItem("PASSWORD_CHECK"), Core::getOptions()->get("MIN_PASSWORD_LENGTH"), Core::getOptions()->get("MAX_PASSWORD_LENGTH"));
     Core::getTPL()->assign("userCheck", $userCheck);
     Core::getTPL()->assign("passwordCheck", $passwordCheck);
     Core::getTPL()->assign("uniSelection", self::getUnisAsOptionList());
     Hook::event("CommTemplateAssign");
     $this->dispatch();
     Hook::event("CommEnd");
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:31,代码来源:Comm.php

示例3: indexAction

 /**
  * Index action.
  *
  * @return Bengine_Comm_Controller_Index
  */
 public function indexAction()
 {
     Hook::event("CommIndexStart", array($this));
     $this->assign("errorMsg", Core::getRequest()->getGET("error"));
     if ($this->isPost()) {
         $encryption = Core::getOptions("USE_PASSWORD_SALT") ? "md5_salt" : "md5";
         $login = new Bengine_Game_Login($this->getParam("username"), $this->getParam("password"), "game", $encryption);
         $login->setRedirectOnFailure(false)->checkData();
         if ($login->getCanLogin()) {
             Hook::event("PreLogin", array($login));
             $login->startSession();
             Hook::event("PostLogin", array($login));
         } else {
             $this->assign("errorMsg", $login->getErrors()->getFirst());
         }
     }
     if ($this->errorMsg != "") {
         Core::getLang()->load("error");
         $this->assign("errorMsg", Core::getLang()->get($this->errorMsg));
     }
     $this->assign("page", Core::getLang()->getItem("LOGIN"));
     if ($cmsPage = Comm::getCMS()->getPage("index")) {
         $this->assign("page", $cmsPage["title"]);
         $this->assign("content", $cmsPage["content"]);
         $this->setTemplate("cms_page");
     } else {
         $this->assign("showDefaultContent", true);
     }
     Hook::event("CommIndexEnd", array($this));
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:36,代码来源:Index.php

示例4: indexAction

 /**
  * Index action.
  *
  * @return Bengine_Game_Controller_Resource
  */
 protected function indexAction()
 {
     Hook::event("ShowResourcesBefore", array($this));
     Core::getTPL()->addLoop("data", $this->data);
     $productFactor = (double) Core::getConfig()->get("PRODUCTION_FACTOR");
     $isMoon = (bool) Game::getPlanet()->getData("ismoon");
     // Basic prod
     $basicMetal = $isMoon ? 0 : Core::getOptions()->get("METAL_BASIC_PROD");
     Core::getTPL()->assign("basicMetal", fNumber($basicMetal * $productFactor));
     $basicSilicon = $isMoon ? 0 : Core::getOptions()->get("SILICON_BASIC_PROD");
     Core::getTPL()->assign("basicSilicon", fNumber($basicSilicon * $productFactor));
     $basicHydrogen = $isMoon ? 0 : Core::getOptions()->get("HYDROGEN_BASIC_PROD");
     Core::getTPL()->assign("basicHydrogen", fNumber($basicHydrogen * $productFactor));
     Core::getTPL()->assign("sats", Game::getPlanet()->getBuilding(Bengine_Game_Planet::SOLAR_SAT_ID));
     if (Game::getPlanet()->getBuilding(Bengine_Game_Planet::SOLAR_SAT_ID) > 0) {
         Core::getTPL()->assign("satsNum", fNumber(Game::getPlanet()->getBuilding(Bengine_Game_Planet::SOLAR_SAT_ID)));
         $solarSatProduction = Game::getPlanet()->getBuildingProd("energy", Bengine_Game_Planet::SOLAR_SAT_ID);
         Core::getTPL()->assign("satsProd", fNumber($solarSatProduction));
         Core::getLang()->assign("prodPerSat", floor($solarSatProduction / Game::getPlanet()->getBuilding(Bengine_Game_Planet::SOLAR_SAT_ID)));
         Core::getTPL()->assign("solar_satellite_prod", Game::getPlanet()->getData("solar_satellite_prod"));
     }
     // Storage capacity
     Core::getTPL()->assign("storageMetal", fNumber(Game::getPlanet()->getStorage("metal") / 1000) . "k");
     Core::getTPL()->assign("storageSilicon", fNumber(Game::getPlanet()->getStorage("silicon") / 1000) . "k");
     Core::getTPL()->assign("sotrageHydrogen", fNumber(Game::getPlanet()->getStorage("hydrogen") / 1000) . "k");
     // Total prod
     Core::getTPL()->assign("totalMetal", fNumber(Game::getPlanet()->getProd("metal")));
     Core::getTPL()->assign("totalSilicon", fNumber(Game::getPlanet()->getProd("silicon")));
     Core::getTPL()->assign("totalHydrogen", fNumber(Game::getPlanet()->getProd("hydrogen")));
     Core::getTPL()->assign("totalEnergy", fNumber(Game::getPlanet()->getEnergy()));
     // Daily prod
     Core::getTPL()->assign("dailyMetal", fNumber(Game::getPlanet()->getProd("metal") * 24));
     Core::getTPL()->assign("dailySilicon", fNumber(Game::getPlanet()->getProd("silicon") * 24));
     Core::getTPL()->assign("dailyHydrogen", fNumber(Game::getPlanet()->getProd("hydrogen") * 24));
     // Weekly prod
     Core::getTPL()->assign("weeklyMetal", fNumber(Game::getPlanet()->getProd("metal") * 168));
     Core::getTPL()->assign("weeklySilicon", fNumber(Game::getPlanet()->getProd("silicon") * 168));
     Core::getTPL()->assign("weeklyHydrogen", fNumber(Game::getPlanet()->getProd("hydrogen") * 168));
     // Monthly prod
     Core::getTPL()->assign("monthlyMetal", fNumber(Game::getPlanet()->getProd("metal") * 720));
     Core::getTPL()->assign("monthlySilicon", fNumber(Game::getPlanet()->getProd("silicon") * 720));
     Core::getTPL()->assign("monthlyHydrogen", fNumber(Game::getPlanet()->getProd("hydrogen") * 720));
     $selectBox = "";
     for ($i = 10; $i >= 0; $i--) {
         $selectBox .= createOption($i * 10, $i * 10, 0);
     }
     Core::getTPL()->assign("selectProd", $selectBox);
     Hook::event("ShowResourcesAfter");
     $this->assign("updateAction", BASE_URL . "game/" . SID . "/Resource/Update");
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:56,代码来源:Resource.php

示例5: indexAction

 /**
  * @return Bengine_Admin_Controller_Auth
  */
 protected function indexAction()
 {
     $this->setIsAjax();
     $this->setMainTemplate(null);
     if ($this->isPost()) {
         $encryption = Core::getOptions("USE_PASSWORD_SALT") ? "md5_salt" : "md5";
         $auth = new Login($this->getParam("username"), $this->getParam("password"), "admin/index", $encryption);
         $auth->setRedirectOnFailure(false)->setCountLoginAttempts(false)->checkData();
         if ($auth->getCanLogin()) {
             $auth->startSession();
         }
         Core::getTemplate()->assign("loginErrors", $auth->getErrors());
     }
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:18,代码来源:Auth.php

示例6: __construct

 /**
  * Key check and set new password.
  *
  * @param integer $userid
  * @param string $key Key, transmitted by email
  * @param string $newpw New password
  *
  * @return Bengine_Game_Account_Password_Changer
  */
 public function __construct($userid, $key, $newpw)
 {
     Hook::event("ChangePassword", array($userid, $key));
     if (empty($key) || Str::length($newpw) < Core::getOptions()->get("MIN_PASSWORD_LENGTH") || Str::length($newpw) > Core::getOptions()->get("MAX_PASSWORD_LENGTH")) {
         $this->printIt("PASSWORD_INVALID");
     }
     $where = Core::getDB()->quoteInto("userid = ? AND ", $userid);
     $where .= Core::getDB()->quoteInto("activation = ?", $key);
     $result = Core::getQuery()->select("user", "userid", "", $where);
     if ($result->rowCount()) {
         $result->closeCursor();
         $encryption = Core::getOptions("USE_PASSWORD_SALT") ? "md5_salt" : "md5";
         $newpw = Str::encode($newpw, $encryption);
         Core::getQuery()->update("password", array("password" => $newpw, "time" => TIME), "userid = ?", array($userid));
         Core::getQuery()->update("user", array("activation" => ""), "userid = ?", array($userid));
         $this->printIt("PASSWORD_CHANGED", false);
     }
     $result->closeCursor();
     $this->printIt("ERROR_PASSWORD_CHANGED");
     return;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:30,代码来源:Changer.php

示例7: _execute

 /**
  * @param Bengine_Game_Model_Event $event
  * @param array $data
  * @return Bengine_Game_EventHandler_Handler_Fleet_Colonize
  */
 protected function _execute(Bengine_Game_Model_Event $event, array $data)
 {
     $id = self::COLONY_SHIP_ID;
     Hook::event("EhColonize", array($event, &$data, $this));
     $where = Core::getDB()->quoteInto("galaxy = ? AND system = ? AND position = ? AND planetid != ?", array($data["galaxy"], $data["system"], $data["position"], 0));
     $_result = Core::getQuery()->select("galaxy", "planetid", "", $where);
     if ($_result->rowCount() == 0) {
         $_result = Core::getQuery()->select("planet", "planetid", "", Core::getDB()->quoteInto("userid = ? AND ismoon = 0", $event["userid"]));
         if ($_result->rowCount() < Core::getOptions()->get("MAX_PLANETS")) {
             $colony = new Bengine_Game_Planet_Creator($event["userid"], $data["galaxy"], $data["system"], $data["position"]);
             $colonyShip = $data["ships"][$id];
             $_result = Core::getQuery()->select("construction", array("basic_metal", "basic_silicon", "basic_hydrogen"), "", Core::getDB()->quoteInto("buildingid = ?", $colonyShip["id"]));
             $shipData = $_result->fetchRow();
             $_result->closeCursor();
             $points = ($shipData["basic_metal"] + $shipData["basic_silicon"] + $shipData["basic_hydrogen"]) * $colonyShip["quantity"] / 1000;
             $fpoints = $colonyShip["quantity"];
             Core::getDB()->query("UPDATE " . PREFIX . "user SET points = points - ?, fpoints = fpoints - ? WHERE userid = ?", array($points, $fpoints, $event["userid"]));
             if ($data["ships"][$id]["quantity"] > 1) {
                 $data["ships"][$id]["quantity"]--;
             } else {
                 $data["ships"][$id] = null;
                 unset($data["ships"][$id]);
             }
             if (count($data["ships"]) > 0) {
                 foreach ($data["ships"] as $ship) {
                     Core::getQuery()->insert("unit2shipyard", array("unitid" => $ship["id"], "planetid" => $colony->getPlanetId(), "quantity" => $ship["quantity"]));
                 }
             }
         } else {
             $this->sendBack($data, $data["time"] + $event["time"], null, $event["planetid"]);
             $data["success"] = "empire";
         }
     } else {
         $this->sendBack($data, $data["time"] + $event["time"], null, $event["planetid"]);
         $data["success"] = "occupied";
     }
     new Bengine_Game_AutoMsg($event["mode"], $event["userid"], $event["time"], $data);
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:44,代码来源:Colonize.php

示例8: getMaxFields

 /**
  * Maximum available fields.
  *
  * @return integer
  */
 public function getMaxFields()
 {
     $fmax = floor(pow($this->get("diameter") / 1000, 2));
     $terraFormer = $this->getBuilding("TERRA_FORMER");
     if (null !== $terraFormer) {
         $terraFormer = (int) $terraFormer->get("level");
     } else {
         $terraFormer = 0;
     }
     if ($terraFormer > 0) {
         $fmax += $terraFormer * (int) Core::getOptions()->get("TERRAFORMER_ADDITIONAL_FIELDS");
     } else {
         if ($this->data["ismoon"]) {
             $fields = (int) $this->getBuilding("MOON_BASE")->get("level") * (int) Core::getOptions()->get("MOON_BASE_FIELDS") + 1;
             if ($fields < $fmax) {
                 $fmax = $fields;
             }
         }
     }
     Hook::event("GetMaxFields", array(&$fmax, $this));
     $addition = $this->get("ismoon") ? 0 : Core::getOptions()->get("PLANET_FIELD_ADDITION");
     return $fmax + $addition;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:28,代码来源:Planet.php

示例9: _execute

 /**
  * (non-PHPdoc)
  * @see app/code/Bengine/EventHandler/Handler/Bengine_Game_EventHandler_Handler_Abstract#_execute($event, $data)
  */
 protected function _execute(Bengine_Game_Model_Event $event, array $data)
 {
     Hook::event("EhEspionage", array($event, &$data, $this));
     $espReport = new Bengine_Game_Espionage_Report($event["destination"], $event["userid"], $event["destination_user_id"], $event["destination_username"], $data["ships"][38]["quantity"]);
     $data["destinationplanet"] = $espReport->getPlanetname();
     $data["suser"] = $event["username"];
     $data["planetname"] = $event["planetname"];
     $data["defending_chance"] = $espReport->getChance();
     $data["probes_lost"] = $espReport->getProbesLost();
     $data["event"] = $event;
     if ($event["destination_user_id"]) {
         new Bengine_Game_AutoMsg($event["mode"], $event["destination_user_id"], $event["time"], $data);
     }
     if ($espReport->getProbesLost()) {
         $points = 0;
         $fpoints = 0;
         $tfMetal = 0;
         $tfSilicon = 0;
         $intoTF = floatval(Core::getOptions()->get("FLEET_INTO_DEBRIS"));
         foreach ($data["ships"] as $key => $ship) {
             $_result = Core::getQuery()->select("construction", array("basic_metal", "basic_silicon", "basic_hydrogen"), "", Core::getDB()->quoteInto("buildingid = ?", $key));
             $shipData = $_result->fetchRow();
             $_result->closeCursor();
             $points += ($shipData["basic_metal"] + $shipData["basic_silicon"] + $shipData["basic_hydrogen"]) * $ship["quantity"] / 1000;
             $fpoints += $ship["quantity"];
             $tfMetal = $shipData["basic_metal"] * $ship["quantity"] * $intoTF;
             $tfSilicon = $shipData["basic_silicon"] * $ship["quantity"] * $intoTF;
         }
         $what = $event->get("destination_ismoon") ? "moonid" : "planetid";
         Core::getDB()->query("UPDATE " . PREFIX . "galaxy SET metal = metal + ?, silicon = silicon + ? WHERE " . $what . " = ?", array($tfMetal, $tfSilicon, $event["destination"]));
         Core::getDB()->query("UPDATE " . PREFIX . "user SET points = points - ?, fpoints = fpoints - ? WHERE userid = ?", array($points, $fpoints, $event["userid"]));
     } else {
         $data["nomessage"] = true;
         $this->sendBack($data, $data["time"] + $event["time"], $event["destination"], $event["planetid"]);
     }
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:41,代码来源:Espionage.php

示例10: allianceRanking

 /**
  * Shows alliance ranking.
  *
  * @param integer $type	Type of ranking (Fleet, Research, Points)
  * @param integer $pos	Position to start ranking
  *
  * @return Bengine_Game_Controller_Ranking
  */
 protected function allianceRanking($type, $pos)
 {
     $joins = "LEFT JOIN " . PREFIX . "user2ally u2a ON (u2a.aid = a.aid)";
     $joins .= "LEFT JOIN " . PREFIX . "user u ON (u.userid = u2a.userid)";
     $result = Core::getQuery()->select("alliance a", "SUM(u." . $type . ") AS points", $joins, "a.aid > '0'", "", "", "a.aid", "HAVING points >= (points)");
     $oPos = $result->rowCount();
     $oPos = $oPos <= 0 ? 1 : $oPos;
     $oPos = ceil($oPos / Core::getOptions()->get("USER_PER_PAGE"));
     $result->closeCursor();
     $result = Core::getQuery()->select("alliance", "aid", "", "aid > '0'");
     $pages = ceil($result->rowCount() / Core::getOptions()->get("USER_PER_PAGE"));
     $result->closeCursor();
     if (!is_numeric($pos)) {
         $pos = $oPos;
     } else {
         if ($pos > $pages) {
             $pos = $pages;
         } else {
             if ($pos < 1) {
                 $pos = 1;
             }
         }
     }
     $ranks = "";
     for ($i = 0; $i < $pages; $i++) {
         $n = $i * Core::getOptions()->get("USER_PER_PAGE") + 1;
         if ($i + 1 == $pos) {
             $s = 1;
         } else {
             $s = 0;
         }
         if ($i + 1 == $oPos) {
             $c = "ownPosition";
         } else {
             $c = "";
         }
         $ranks .= createOption($i + 1, fNumber($n) . " - " . fNumber($n + Core::getOptions()->get("USER_PER_PAGE") - 1), $s, $c);
     }
     Core::getTPL()->assign("rankingSel", $ranks);
     $order = $this->average ? "average" : "points";
     $rank = abs(($pos - 1) * Core::getOptions()->get("USER_PER_PAGE"));
     $max = Core::getOptions()->get("USER_PER_PAGE");
     $select = array("a.aid", "a.name", "a.tag", "a.showhomepage", "a.homepage", "a.open", "COUNT(u2a.userid) AS members", "FLOOR(SUM(u." . $type . ")) AS points", "AVG(u." . $type . ") AS average");
     $joins = "LEFT JOIN " . PREFIX . "user2ally u2a ON u2a.aid = a.aid ";
     $joins .= "LEFT JOIN " . PREFIX . "user u ON u2a.userid = u.userid ";
     $result = Core::getQuery()->select("alliance a", $select, $joins, "a.aid > '0'", $order . " DESC, members DESC, a.tag ASC", $rank . ", " . $max, "a.aid");
     $AllianceList = new Bengine_Game_Alliance_List($result, $rank);
     Hook::event("ShowRankingAlliance", array($AllianceList));
     Core::getTPL()->addLoop("ranking", $AllianceList->getArray());
     $this->setTemplate("ranking/ally");
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:60,代码来源:Ranking.php

示例11: setBannedLoginTime

 /**
  * Setter-method for banning login time (in minutes).
  *
  * @param integer
  *
  * @return Login
  */
 public function setBannedLoginTime($bannedLoginTime = null)
 {
     $this->bannedLoginTime = $bannedLoginTime;
     if (is_null($this->bannedLoginTime) && Core::getOptions()->exists("bannedlogintime")) {
         $this->bannedLoginTime = Core::getOptions()->get("bannedlogintime");
     }
     if (!is_numeric($this->bannedLoginTime)) {
         $this->setCountLoginAttempts(false);
     }
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:18,代码来源:Login.util.php

示例12: globalMailAction

 /**
  * Allows the user to write a global mail to all alliance member.
  *
  * @param string $reply
  * @return Bengine_Game_Controller_Alliance
  */
 protected function globalMailAction($reply)
 {
     $result = Core::getQuery()->select("user2ally u2a", array("a.founder", "ar.CAN_WRITE_GLOBAL_MAILS"), "LEFT JOIN " . PREFIX . "alliance a ON (a.aid = u2a.aid) LEFT JOIN " . PREFIX . "allyrank ar ON (ar.rankid = u2a.rank)", Core::getDB()->quoteInto("u2a.userid = ?", Core::getUser()->get("userid")));
     if ($row = $result->fetchRow()) {
         $result->closeCursor();
         if ($row["CAN_WRITE_GLOBAL_MAILS"] || $row["founder"] == Core::getUser()->get("userid")) {
             Core::getLanguage()->load("Message");
             if ($this->isPost()) {
                 $message = richtext($this->getParam("message"));
                 $length = Str::length(strip_tags($message));
                 $subject = Str::validateXHTML(trim($this->getParam("subject")));
                 $receiver = $this->getParam("receiver");
                 if ($length > 2 && $length <= Core::getOptions()->get("MAX_PM_LENGTH") && Str::length($subject) > 0 && Str::length($subject) < 101) {
                     Hook::event("SendGlobalMail", array($subject, &$message));
                     if ($receiver == "foo") {
                         $where = Core::getDB()->quoteInto("aid = ?", $this->aid);
                     } else {
                         $where = Core::getDB()->quoteInto("rank = ? AND aid = ?", array($receiver, $this->aid));
                     }
                     $_result = Core::getQuery()->select("user2ally", "userid", "", $where);
                     foreach ($_result->fetchAll() as $_row) {
                         Core::getQuery()->insert("message", array("mode" => 6, "time" => TIME, "sender" => Core::getUser()->get("userid"), "receiver" => $_row["userid"], "message" => $message, "subject" => $subject, "read" => $_row["userid"] == Core::getUser()->get("userid") ? 1 : 0));
                     }
                     $_result->closeCursor();
                     Logger::addMessage("SENT_SUCCESSFUL", "success");
                 } else {
                     if ($length < 3) {
                         Core::getTPL()->assign("messageError", Logger::getMessageField("MESSAGE_TOO_SHORT"));
                     }
                     if ($length > Core::getOptions()->get("MAX_PM_LENGTH")) {
                         Core::getTPL()->assign("messageError", Logger::getMessageField("MESSAGE_TOO_LONG"));
                     }
                     if (Str::length($subject) == 0) {
                         Core::getTPL()->assign("subjectError", Logger::getMessageField("SUBJECT_TOO_SHORT"));
                     }
                     if (Str::length($subject) > 100) {
                         Core::getTPL()->assign("subjectError", Logger::getMessageField("SUBJECT_TOO_LONG"));
                     }
                     Core::getTPL()->assign("subject", $this->getParam("subject"))->assign("message", $this->getParam("message"));
                 }
             } else {
                 if ($reply) {
                     $reply = preg_replace("#((RE|FW):\\s)+#is", "\\1", $reply);
                     Core::getTPL()->assign("subject", $reply);
                 }
             }
             $ranks = Core::getQuery()->select("allyrank", array("rankid", "name"), "", Core::getDB()->quoteInto("aid = ?", $this->aid));
             Core::getTPL()->assign("maxpmlength", fNumber(Core::getOptions()->get("MAX_PM_LENGTH")));
             Core::getTPL()->addLoop("ranks", $ranks);
         } else {
             Logger::dieMessage("MISSING_RIGHTS_FOR_GLOBAL_MAIL", "warning");
         }
     } else {
         Logger::dieMessage("MISSING_RIGHTS_FOR_GLOBAL_MAIL", "warning");
     }
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:63,代码来源:Alliance.php

示例13: validateInputs

 /**
  * Validates the inputted galaxy and system.
  *
  * @return Bengine_Game_Controller_Galaxy
  */
 protected function validateInputs()
 {
     if (empty($this->galaxy)) {
         $this->galaxy = Game::getPlanet()->getData("galaxy");
     }
     if (empty($this->system)) {
         $this->system = Game::getPlanet()->getData("system");
     }
     if ($this->galaxy < 1) {
         $this->galaxy = 1;
     } else {
         if ($this->galaxy > Core::getOptions()->get("GALAXYS")) {
             $this->galaxy = Core::getOptions()->get("GALAXYS");
         }
     }
     if ($this->system < 1) {
         $this->system = 1;
     } else {
         if ($this->system > Core::getOptions()->get("SYSTEMS")) {
             $this->system = Core::getOptions()->get("SYSTEMS");
         }
     }
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:29,代码来源:Galaxy.php

示例14: sendFleet


//.........这里部分代码省略.........
             $data["silicon"] = _pos(Game::getPlanet()->getData("silicon"));
         }
         if ($data["hydrogen"] > Game::getPlanet()->getData("hydrogen") - $data["consumption"]) {
             $data["hydrogen"] = _pos(Game::getPlanet()->getData("hydrogen") - $data["consumption"]);
         }
         if ($mode == 13) {
             $data["duration"] = _pos($holdingTime);
             if ($data["duration"] > 24) {
                 $data["duration"] = 24;
             }
             $data["duration"] *= 3600;
         }
         $capa = $temp["capacity"] - $data["consumption"] - $data["metal"] - $data["silicon"] - $data["hydrogen"];
         // Reduce used capacity automatically
         if ($capa < 0) {
             if ($capa + $data["hydrogen"] > 0) {
                 $data["hydrogen"] -= abs($capa);
             } else {
                 $capa += $data["hydrogen"];
                 $data["hydrogen"] = 0;
                 if ($capa + $data["silicon"] > 0 && $capa < 0) {
                     $data["silicon"] -= abs($capa);
                 } else {
                     if ($capa < 0) {
                         $capa += $data["silicon"];
                         $data["silicon"] = 0;
                         if ($capa + $data["metal"] && $capa < 0) {
                             $data["metal"] -= abs($capa);
                         } else {
                             if ($capa < 0) {
                                 $data["metal"] = 0;
                             }
                         }
                     }
                 }
             }
         }
         $data["capacity"] = $temp["capacity"] - $data["consumption"] - $data["metal"] - $data["silicon"] - $data["hydrogen"];
         if ($data["capacity"] < 0) {
             Logger::dieMessage("NOT_ENOUGH_CAPACITY");
         }
         // If mission is recycling, get just the capacity of the recyclers.
         if ($mode == 9 && $data["capacity"] > 0) {
             $_result = Core::getQuery()->select("ship_datasheet", "capicity", "", "unitid = '37'");
             // It is __capacity__ and not capicity
             $_row = $_result->fetchRow();
             $_result->closeCursor();
             $recCapa = $_row["capicity"] * $temp["ships"][37]["quantity"];
             if ($data["capacity"] >= $recCapa) {
                 $data["capacity"] = $recCapa;
             }
         }
         $time = Game::getFlyTime($distance, $data["maxspeed"], $temp["speed"]);
         $data["time"] = $time;
         if ($mode == 18) {
             $data["alliance_attack"] = $temp["alliance_attack"];
             $mainFleet = Game::getEH()->getMainFormationFleet($data["alliance_attack"]["eventid"]);
             $allFleets = Game::getEH()->getFormationFleets($data["alliance_attack"]["eventid"]);
             $numFleets = 1;
             $formationUser[$mainFleet->get("user")] = true;
             /* @var Bengine_Game_Model_Fleet $oneFleet */
             foreach ($allFleets as $oneFleet) {
                 $numFleets++;
                 $formationUser[$oneFleet->get("user")] = true;
             }
             unset($formationUser[Core::getUser()->get("userid")]);
             if ($numFleets >= Core::getOptions()->get("MAX_FORMATION_FLEETS")) {
                 Logger::dieMessage("MAX_FORMATION_FLEETS_EXCEEDED");
             }
             if (count($formationUser) >= Core::getOptions()->get("MAX_FORMATION_USER")) {
                 Logger::dieMessage("MAX_FORMATION_USER_EXCEEDED");
             }
             if ($data["time"] + TIME > ($mainFleet["time"] - TIME) * (1 + Core::getOptions()->get("MAX_FORMATION_DELAY")) + TIME) {
                 Logger::dieMessage("MAX_FORMATION_DELAY_EXCEEDED");
             }
         }
         Hook::event("SendFleet", array(&$data, &$time, &$temp, $distance));
         Core::getQuery()->delete("temp_fleet", "planetid = ?", null, null, array(Core::getUser()->get("curplanet")));
         $handler = Game::getEH()->addEvent($mode, $time + TIME, Core::getUser()->get("curplanet"), Core::getUser()->get("userid"), isset($temp["destination"]) ? $temp["destination"] : null, $data);
         Core::getTPL()->assign("mission", Game::getMissionName($mode));
         Core::getTPL()->assign("mode", $mode);
         Core::getTPL()->assign("distance", fNumber($distance));
         Core::getTPL()->assign("speed", fNumber($temp["maxspeed"]));
         Core::getTPL()->assign("consume", fNumber($data["consumption"]));
         Core::getTPL()->assign("start", Game::getPlanet()->getCoords(false));
         Core::getTPL()->assign("target", $data["galaxy"] . ":" . $data["system"] . ":" . $data["position"]);
         Core::getTPL()->assign("arrival", Date::timeToString(1, $handler->getFinishTime()));
         if ($returnTime = $handler->getReturnTime()) {
             Core::getTPL()->assign("return", Date::timeToString(1, $returnTime));
         }
         $fleet = array();
         foreach ($data["ships"] as $key => $value) {
             $fleet[$key]["name"] = Core::getLanguage()->getItem($value["name"]);
             $fleet[$key]["quantity"] = fNumber($value["quantity"]);
         }
         Core::getTPL()->addLoop("fleet", $fleet);
         $this->setTemplate("mission/step4");
     }
     return $this;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:101,代码来源:Mission.php

示例15: getPassword

 /**
  * Returns the password.
  *
  * @param boolean $encrypted	Encrypt password
  *
  * @return string
  */
 public function getPassword($encrypted = false)
 {
     if ($encrypted) {
         $encryption = Core::getOptions("USE_PASSWORD_SALT") ? "md5_salt" : "md5";
         return Str::encode($this->password, $encryption);
     }
     return $this->password;
 }
开发者ID:enriquesomolinos,项目名称:Bengine,代码行数:15,代码来源:Creator.php


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