Beispiel #1
0
 /**
  * @param Bengine_Game_Model_Message $message
  * @return Bengine_Game_MessageFolder_Abstract
  */
 protected function replaceForeignSessionId(Bengine_Game_Model_Message $message)
 {
     $str = $message->get("message");
     $str = preg_replace("#(" . BASE_URL . "game)/([a-f0-9]{32})#i", "\$1/" . SID, $str);
     $message->set("message", $str);
     return $this;
 }
Beispiel #2
0
 /**
  * Formats the message for news feeds.
  *
  * @param Bengine_Game_Model_Message $message
  *
  * @return Bengine_Game_MessageFolder_Combat
  */
 protected function _formatFeed(Bengine_Game_Model_Message $message)
 {
     $assaultId = (int) $message->get("message");
     $assault = Application::getModel("game/assault")->load($assaultId);
     $link = BASE_URL . Core::getLang()->getOpt("langcode") . "/combat/report/" . $assaultId . "/" . $assault->get("key");
     $gentime = $assault->get("gentime") / 1000;
     $text = Core::getLanguage()->getItem("ASSAULT_REPORT") . " (A: " . fNumber($assault->get("lostunits_attacker")) . ", D: " . fNumber($assault->get("lostunits_defender")) . ") " . $gentime . "s";
     $subject = Core::getLang()->get($message->get("subject")) . ": " . $assault->get("planetname") . " [" . $assault->getCoords(false) . "]";
     $message->set(array("message" => $text, "subject" => $subject, "link" => $link));
     return $this;
 }
Beispiel #3
0
 /**
  * Formats the message.
  *
  * @param Bengine_Game_Model_Message $message
  *
  * @return Bengine_Game_MessageFolder_System
  */
 protected function _format(Bengine_Game_Model_Message $message)
 {
     if (!$message->get("sender")) {
         $message->set("sender", Core::getLanguage()->getItem("FLEET_COMMAND"));
     }
     $message->set("subject", str_replace("%SID%", SID, $message->get("subject")));
     $message->set("message", str_replace("%SID%", SID, $message->get("message")));
     return $this;
 }
Beispiel #4
0
 /**
  * Formats the message.
  *
  * @param Bengine_Game_Model_Message $message
  *
  * @return Bengine_Game_MessageFolder_Alliance
  */
 protected function _format(Bengine_Game_Model_Message $message)
 {
     $senderName = $message->get("username");
     $sender = !empty($senderName) ? Core::getLanguage()->getItem("ALLIANCE_GLOBAL_MAIL") . " (" . $senderName . ")" : Core::getLanguage()->getItem("ALLIANCE");
     $message->set("sender", $sender);
     $this->replaceForeignSessionId($message);
     if (Core::getUser()->get("aid")) {
         $subject = "RE: " . preg_replace("#((RE|FW):\\s)+#is", "\\1", $message->get("subject"));
         $subject = rawurlencode($subject);
         $linkUrl = "game/";
         if (URL_SESSION) {
             $linkUrl .= SID . "/";
         }
         $linkUrl .= "Alliance/GlobalMail/" . $subject;
         if (!empty($senderName)) {
             $replyImg = Image::getImage("pm.gif", Core::getLanguage()->getItem("REPLY_ALLIANCE_MAIL"));
             $message->set("reply_link", Link::get($linkUrl, $replyImg));
         }
     }
     return $this;
 }
Beispiel #5
0
 /**
  * Formats the message.
  *
  * @param Bengine_Game_Model_Message $message
  *
  * @return Bengine_Game_MessageFolder_User
  */
 protected function _format(Bengine_Game_Model_Message $message)
 {
     $sender = $message->get("sender");
     if (!empty($sender)) {
         $url = "game/" . SID . "/MSG/Write/" . rawurlencode($message->get("username")) . "/" . Link::urlEncode("RE: " . $message->get("subject"));
         $reply = Link::get($url, Image::getImage("pm.gif", Core::getLanguage()->getItem("REPLY")));
         $message->set("reply_link", $reply);
         $sender = $message->get("username") . " " . getCoordLink($message->get("galaxy"), $message->get("system"), $message->get("position"));
     } else {
         $sender = "System";
     }
     $message->set("sender", $sender);
     $this->replaceForeignSessionId($message);
     return $this;
 }