本文整理汇总了PHP中Logger::addMessage方法的典型用法代码示例。如果您正苦于以下问题:PHP Logger::addMessage方法的具体用法?PHP Logger::addMessage怎么用?PHP Logger::addMessage使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Logger
的用法示例。
在下文中一共展示了Logger::addMessage方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: seek
/**
* Starts the search.
*
* @param string $what The search item
* @param string $where The search mode
*
* @return Bengine_Game_Controller_Search
*/
protected function seek($what, $where)
{
Core::getLanguage()->load("Statistics");
$this->searchItem = new String($what);
$this->searchItem->trim()->prepareForSearch();
if (!$this->searchItem->validSearchString) {
$this->searchItem->set("");
if (!empty($what)) {
Logger::addMessage("NO_VALID_SEARCH", "warning");
}
}
Core::getTPL()->assign("what", $what);
switch ($where) {
case 1:
Core::getTPL()->assign("players", " selected=\"selected\"");
$this->playerSearch();
break;
case 2:
Core::getTPL()->assign("planets", " selected=\"selected\"");
$this->planetSearch();
break;
case 3:
Core::getTPL()->assign("allys", " selected=\"selected\"");
$this->allianceSearch();
break;
}
return $this;
}
示例2: forwardToLogin
/**
* Forward to login page.
*
* @param string $errorid Error id to output
*
* @return void
*/
function forwardToLogin($errorid)
{
if (LOGIN_REQUIRED) {
$login = BASE_URL . "?error=" . $errorid;
Hook::event("ForwardToLoginPage", array(&$login, $errorid));
doHeaderRedirection($login, false);
}
Logger::addMessage($errorid);
Core::getTPL()->display("login");
return;
}
示例3: execute
/**
* Executes this event.
*
* @return Bengine_Game_Model_Event
*/
public function execute()
{
try {
$this->getEventHandler()->execute();
} catch (Exception $e) {
$this->set("prev_rc", "error");
$this->save();
Logger::addMessage($e->getMessage());
}
return $this;
}
示例4: _add
/**
* @param Bengine_Game_Model_Event $event
* @param array $data
* @return Bengine_Game_EventHandler_Handler_Fleet_Colonize
*/
protected function _add(Bengine_Game_Model_Event $event, array $data)
{
if ($data["metal"] > 0 || $data["silicon"] > 0 || $data["hydrogen"] > 0) {
Logger::addMessage("COLONIZE_RESOURCE_WARNING", "info");
}
$data["metal"] = 0;
$data["silicon"] = 0;
$data["hydrogen"] = 0;
$event->setData($data);
$this->prepareFleet($data);
return $this;
}
示例5: indexAction
/**
* Index action.
*
* @return Bengine_Game_Controller_Constructions
*/
protected function indexAction()
{
Core::getLanguage()->load(array("info", "buildings"));
$mode = self::BUILDING_CONSTRUCTION_TYPE;
$moonType = Game::getPlanet()->getData("ismoon") ? self::MOON_CONSTRUCTION_TYPE : null;
if (!Game::getPlanet()->planetFree()) {
Logger::addMessage("PLANET_FULL", "info");
}
$shipyardSize = Game::getEH()->getShipyardEvents()->getCalculatedSize();
Core::getTPL()->assign("shipyardSize", $shipyardSize);
Core::getLang()->assign("maxFields", fNumber(Game::getPlanet()->getMaxFields()));
Core::getLang()->assign("occupiedFields", Game::getPlanet()->getFields(true));
/* @var Bengine_Game_Model_Collection_Construction $collection */
$collection = Application::getCollection("game/construction");
$collection->addTypeFilter($mode, $moonType ? true : false, $moonType)->addPlanetJoin(Core::getUser()->get("curplanet"))->addDisplayOrder();
Core::getTPL()->addHTMLHeaderFile("lib/jquery.countdown.js", "js");
Hook::event("ConstructionsLoaded", array($collection));
Core::getTPL()->addLoop("constructions", $collection);
Core::getTPL()->assign("event", $this->event);
return $this;
}
示例6: indexAction
/**
* Index action.
*
* @return Bengine_Game_Controller_Research
*/
protected function indexAction()
{
Core::getLanguage()->load(array("info", "buildings"));
/* @var Bengine_Game_Model_Collection_Construction $collection */
$collection = Application::getCollection("game/construction");
$collection->addTypeFilter(self::RESEARCH_CONSTRUCTION_TYPE, Game::getPlanet()->getData("ismoon"))->addUserJoin(Core::getUser()->get("userid"))->addDisplayOrder();
if (!Game::getPlanet()->getBuilding("RESEARCH_LAB") || !count($collection)) {
Logger::dieMessage("RESEARCH_LAB_REQUIRED");
}
Hook::event("ResearchLoaded", array($collection));
Core::getTPL()->addLoop("constructions", $collection);
Core::getTPL()->assign("event", $this->event);
$canResearch = true;
if (!Game::getEH()->canReasearch()) {
Logger::addMessage("RESEARCH_LAB_UPGRADING", "info");
$canResearch = false;
}
Core::getTPL()->assign("canResearch", $canResearch);
Core::getTPL()->addHTMLHeaderFile("lib/jquery.countdown.js", "js");
return $this;
}
示例7: indexAction
/**
* Index action.
*
* @return Bengine_Game_Controller_Shipyard
*/
protected function indexAction()
{
Core::getLanguage()->load(array("info", "buildings"));
$this->setTemplate("shipyard/index");
/* @var Bengine_Game_Model_Collection_Construction $collection */
$collection = Application::getCollection("game/construction", "game/unit");
$collection->addTypeFilter($this->mode, Game::getPlanet()->getData("ismoon"))->addShipyardJoin(Core::getUser()->get("curplanet"))->addDisplayOrder();
if (Game::getPlanet()->getBuilding("SHIPYARD") == 0) {
Logger::dieMessage("SHIPYARD_REQUIRED");
}
if ($this->mode == self::FLEET_CONSTRUCTION_TYPE) {
Core::getTPL()->assign("shipyard", Core::getLanguage()->getItem("SHIP_CONSTRUCTION"));
} else {
Core::getTPL()->assign("shipyard", Core::getLanguage()->getItem("DEFENSE"));
}
if (!$this->canBuildUnits) {
Logger::addMessage("SHIPYARD_UPGRADING", "info");
}
$missions = Game::getEH()->getShipyardEvents();
if (count($missions)) {
Core::getTPL()->addHTMLHeaderFile("lib/jquery.countdown.js", "js");
/* @var Bengine_Game_Model_Event $event */
$event = $missions->getFirstItem();
Core::getTPL()->assign("remainingTime", $event->getTimeLeft());
Core::getTPL()->assign("currentWork", Core::getLanguage()->getItem($event->getData("mission")));
Core::getTPL()->assign("currentMissionImage", BASE_URL . "img/buildings/" . $event->getData("mission") . ".gif");
Core::getLang()->assign("unitName", Core::getLanguage()->getItem($event->getData("mission")));
}
Core::getTPL()->addLoop("events", $missions);
Core::getTPL()->addLoop("units", $collection);
Core::getTPL()->assign("canBuildUnits", $this->canBuildUnits);
Core::getTPL()->assign("canBuildRockets", $this->canBuildRockets);
$this->assign("orderAction", BASE_URL . "game/" . SID . "/" . $this->getParam("controller") . "/Order");
$this->assign("cancelAction", BASE_URL . "game/" . SID . "/" . $this->getParam("controller") . "/Cancel");
return $this;
}
示例8: changePlanetOptions
/**
* Shows form for planet options.
*
* @param string $planetname
* @param boolean $abandon
* @param string $password
*
* @return Bengine_Game_Controller_Index
*/
protected function changePlanetOptions($planetname, $abandon, $password)
{
$planetname = trim($planetname);
Hook::event("SAVE_PLANET_OPTIONS", array(&$planetname, &$abandon));
if ($abandon == 1) {
$ok = true;
if (Game::getEH()->getPlanetFleetEvents()) {
Logger::addMessage("CANNOT_DELETE_PLANET");
$ok = false;
}
if (Core::getUser()->get("hp") == Core::getUser()->get("curplanet")) {
Logger::addMessage("CANNOT_DELETE_HOMEPLANET");
$ok = false;
}
$result = Core::getQuery()->select("password", "password", "", Core::getDB()->quoteInto("userid = ?", Core::getUser()->get("userid")));
$row = $result->fetchRow();
$result->closeCursor();
$encryption = Core::getOptions("USE_PASSWORD_SALT") ? "md5_salt" : "md5";
$password = Str::encode($password, $encryption);
if (!Str::compare($row["password"], $password)) {
Logger::addMessage("WRONG_PASSWORD");
$ok = false;
}
if ($ok) {
deletePlanet(Game::getPlanet()->getPlanetId(), Core::getUser()->get("userid"), Game::getPlanet()->getData("ismoon"));
Core::getQuery()->update("user", array("curplanet" => Core::getUser()->get("hp")), "userid = ?", array(Core::getUser()->get("userid")));
Core::getUser()->rebuild();
$this->redirect("game/" . SID . "/Index");
}
} else {
if (checkCharacters($planetname)) {
Core::getQuery()->update("planet", array("planetname" => $planetname), "planetid = ?", array(Core::getUser()->get("curplanet")));
$this->redirect("game/" . SID . "/Index");
} else {
Logger::addMessage("INVALID_PLANET_NAME");
}
}
return $this;
}
示例9: 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;
}
示例10: printError
/**
* Add the message to logger.
*
* @return void
*/
public function printError()
{
Logger::addMessage($this->message);
return;
}
示例11: add
/**
* @param array $month
* @param array $day
* @param array $weekday
* @param integer $hour
* @param integer $minute
* @param string $class
* @return Bengine_Admin_Controller_Cronjob
*/
protected function add($month, $day, $weekday, $hour, $minute, $class)
{
if (is_array($month) && is_array($day) && is_array($weekday) && !empty($class)) {
$month = implode(",", $month);
$day = implode(",", $day);
$weekday = implode(",", $weekday);
$spec = array("class" => $class, "month" => $month, "day" => $day, "weekday" => $weekday, "hour" => $hour, "minute" => $minute, "xtime" => TIME, "last" => 0, "active" => 0);
Core::getQuery()->insert("cronjob", $spec);
} else {
Logger::addMessage("InvalidInformation");
}
return $this;
}
示例12: starGateJump
/**
* Select the ships for jump.
*
* @param array $ships
*
* @return Bengine_Game_Controller_Mission
*/
protected function starGateJump($ships)
{
$this->noAction = true;
$data = array();
Core::getQuery()->delete("temp_fleet", "planetid = ?", null, null, array(Core::getUser()->get("curplanet")));
$select = array("u2s.unitid", "u2s.quantity", "d.capicity", "d.speed", "d.consume", "b.name");
$joins = "LEFT JOIN " . PREFIX . "construction b ON (b.buildingid = u2s.unitid)";
$joins .= "LEFT JOIN " . PREFIX . "ship_datasheet d ON (d.unitid = u2s.unitid)";
$result = Core::getQuery()->select("unit2shipyard u2s", $select, $joins, Core::getDB()->quoteInto("b.mode = '3' AND u2s.planetid = ?", Core::getUser()->get("curplanet")));
foreach ($result->fetchAll() as $row) {
$id = $row["unitid"];
if (isset($ships[$id])) {
$quantity = _pos($ships[$id]);
if ($quantity > $row["quantity"]) {
$quantity = $row["quantity"];
}
if ($quantity > 0) {
$data["ships"][$id]["quantity"] = $quantity;
$data["ships"][$id]["name"] = $row["name"];
}
}
}
$result->closeCursor();
$result = Core::getQuery()->select("stargate_jump", "time", "", Core::getDB()->quoteInto("planetid = ?", Core::getUser()->get("curplanet")), "time DESC");
$row = $result->fetchRow();
$result->closeCursor();
$requiredReloadTime = (int) Core::getConfig()->get("STAR_GATE_RELOAD_TIME") * 60;
$reloadTime = $row["time"] + $requiredReloadTime;
if (count($data) > 0 && $reloadTime < TIME) {
$moons = array();
$select = new Recipe_Database_Select();
$select->from(array("p" => "planet"))->attributes(array("p" => array("planetid", "planetname"), "g" => array("galaxy", "system", "position"), "sj" => array("time")));
$select->join(array("b2p" => "building2planet"), array("b2p" => "planetid", "p" => "planetid"))->join(array("g" => "galaxy"), array("g" => "moonid", "p" => "planetid"))->join(array("sj" => "stargate_jump"), array("sj" => "planetid", "p" => "planetid"))->where(array("p" => "userid"), Core::getUser()->get("userid"))->where(array("p" => "ismoon"), 1)->where(array("p" => "planetid", "!="), Core::getUser()->get("curplanet"))->where(array("b2p" => "buildingid"), 56)->where("IFNULL(sj.time, 0) + ? < UNIX_TIMESTAMP()", $requiredReloadTime)->group(array("p" => "planetid"))->order(array("g" => "galaxy"))->order(array("g" => "system"))->order(array("g" => "position"));
$result = $select->getStatement();
foreach ($result->fetchAll() as $row) {
$moons[] = $row;
$data["moons"][] = $row["planetid"];
}
$result->closeCursor();
Hook::event("ShowStarGates", array(&$moons, &$data));
Core::getTPL()->addLoop("moons", $moons);
$data = serialize($data);
Core::getQuery()->insert("temp_fleet", array("planetid" => Core::getUser()->get("curplanet"), "data" => $data));
$this->setTemplate("mission/stargatejump");
} else {
if ($reloadTime < TIME) {
$reloadTime = TIME;
}
Core::getLanguage()->assign("reloadTime", fNumber(($reloadTime - TIME) / 60), 2);
Logger::addMessage("RELOADING_STAR_GATE");
}
return $this;
}
示例13: deleteMessages
/**
* Deletes messages.
*
* @param integer $folder Folder id
* @param integer $option Mode to delete content
* @param array $msgs Messages
*
* @return Bengine_Game_Controller_MSG
*/
protected function deleteMessages($folder, $option, array $msgs)
{
$pagination = $this->getPagination($folder);
$deltime = 604800;
if (is_numeric(Core::getOptions()->get("DEL_MESSAGE_DAYS")) && Core::getOptions()->get("DEL_MESSAGE_DAYS") > 0) {
$deltime = (int) Core::getOptions()->get("DEL_MESSAGE_DAYS") * 86400;
}
$deltime = TIME - $deltime;
Core::getQuery()->delete("message", "time <= ?", null, null, array($deltime));
switch ($option) {
case 1:
foreach ($msgs as $msgid) {
Core::getQuery()->delete("message", "msgid = ? AND receiver = ?", null, null, array($msgid, Core::getUser()->get("userid")));
}
break;
case 2:
$where = Core::getDB()->quoteInto("receiver = ? AND mode = ?", array(Core::getUser()->get("userid"), $folder));
$result = Core::getQuery()->select("message", "msgid", "", $where, "time DESC", $pagination->getStart() . ", " . Core::getOptions()->get("MAX_PMS"));
foreach ($result->fetchAll() as $row) {
if (!in_array($row["msgid"], $msgs)) {
Core::getQuery()->delete("message", "msgid = ?", null, null, array($row["msgid"]));
}
}
$result->closeCursor();
break;
case 3:
$where = Core::getDB()->quoteInto("receiver = ? AND mode = ?", array(Core::getUser()->get("userid"), $folder));
$result = Core::getQuery()->select("message", array("msgid"), "", $where, "time DESC", $pagination->getStart() . ", " . Core::getOptions()->get("MAX_PMS"));
foreach ($result->fetchAll() as $row) {
Core::getQuery()->delete("message", "msgid = ?", null, null, array($row["msgid"]));
}
break;
case 4:
Core::getQuery()->delete("message", "receiver = ? AND mode = ?", null, null, array(Core::getUser()->get("userid"), $folder));
break;
case 5:
$reports = array();
$modId = Game::getRandomModerator();
foreach ($msgs as $msgid) {
$where = Core::getDB()->quoteInto("m.msgid = ? AND m.receiver = ?", array($msgid, Core::getUser()->get("userid")));
$result = Core::getQuery()->select("message m", array("m.sender", "m.mode", "m.message", "m.time", "u.username"), "LEFT JOIN " . PREFIX . "user u ON (u.userid = m.sender)", $where);
if ($row = $result->fetchRow()) {
if (($row["sender"] > 0 || $row["mode"] == 5) && $row["sender"] != $modId) {
$reports[] = $row;
}
}
}
if (count($reports) > 0) {
Core::getLang()->assign("reportSender", Core::getUser()->get("username"));
foreach ($reports as $report) {
Core::getLang()->assign("reportMessage", $report["message"]);
Core::getLang()->assign("reportUser", $report["username"]);
Core::getLang()->assign("reportSendTime", Date::timeToString(1, $report["time"], "", false));
if ($report["mode"] == 5) {
$assault = Game::getModel("game/assault")->load((int) $report["message"]);
$url = BASE_URL . Core::getLang()->getOpt("langcode") . "/combat/report/" . $assault->get("assaultid") . "/" . $assault->get("key");
$gentime = $assault->get("gentime") / 1000;
$label = Core::getLanguage()->getItem("ASSAULT_REPORT") . " (A: " . fNumber($assault->get("lostunits_attacker")) . ", D: " . fNumber($assault->get("lostunits_defender")) . ") " . $gentime . "s";
Core::getLang()->assign("reportLink", "<span class=\"assault-report\" onclick=\"window.open('" . $url . "')\">" . $label . "</span>");
$message = Core::getDB()->escape(Core::getLang()->get("MODERATOR_REPORT_COMBAT"));
} else {
richText($message = Core::getLang()->get("MODERATOR_REPORT_MESSAGE"));
}
$subject = Core::getLang()->get("MODERATOR_REPORT_SUBJECT");
$spec = array("sender" => null, "mode" => 1, "subject" => $subject, "message" => $message, "receiver" => $modId, "time" => TIME, "read" => 0);
Core::getQuery()->insert("message", $spec);
}
Logger::addMessage("MESSAGES_REPORTED", "success");
}
break;
}
return $this;
}
示例14: startAssault
/**
* Starts the assault.
*
* @param int $galaxy
* @param int $system
* @param int $position
* @return Bengine_Game_Assault
*/
public function startAssault($galaxy = 0, $system = 0, $position = 0)
{
Hook::event("StartAssaultFirst", array($this, $this->owner, $galaxy, $system, $position));
// Include database access
$database = array();
$cs = array();
require APP_ROOT_DIR . "etc/Config.inc.php";
// Run java
$jrePath = $cs["jre"];
$jarPath = APP_ROOT_DIR . "app/Assault.jar";
$cmd = $jrePath . ' -jar "' . $jarPath . '" "' . $cs["host"] . '" "' . $cs["user"] . '" "' . $cs["userpw"] . '" "' . $database["databasename"] . '" "' . $database["tableprefix"] . '" ' . escapeshellarg($this->assaultid) . ' 2>&1';
$output = array();
$commandResult = null;
if (function_exists("exec")) {
exec($cmd, $output, $commandResult);
} else {
$output[] = "Function exec() disabled.";
}
$result = Core::getQuery()->select("assault", array("result", "moonchance", "moon", "accomplished", "lostunits_defender"), "", Core::getDB()->quoteInto("assaultid = ?", $this->assaultid));
$row = $result->fetchRow();
$result->closeCursor();
$this->data = $row;
if ($commandResult !== 0 || !$row["accomplished"]) {
$output = implode("<br/>", $output);
Logger::addMessage("Sorry, could not start battle <strong>" . $this->assaultid . "</strong>:<br/>" . $output);
}
Hook::event("StartAssaultLast", array($this, &$row, $this->owner));
if ($row["moon"]) {
new Bengine_Game_Planet_Creator($this->owner, $galaxy, $system, $position, 1, $row["moonchance"]);
}
return $this;
}
示例15: saveVariable
/**
* @param string $var
* @param string $type
* @param string $options
* @param string $description
* @param integer $groupid
* @return Bengine_Admin_Controller_Config
*/
protected function saveVariable($var, $type, $options, $description, $groupid)
{
$options = $this->serialize($options);
$spec = array("type" => $type, "options" => $options, "description" => Str::validateXHTML($description), "groupid" => $groupid);
Core::getQuery()->update("config", $spec, "var = ?", array($var));
Logger::addMessage("Saving_Successful", "success");
return $this;
}