public function GetOutput($Db)
    {
        /*<img src="http://image.eveonline.com/Character/<?php echo $chid;  ?>_256.jpg" height=118 width=118>*/
        $full_url = FULL_URL;
        // TODO
        $time_start = microtime_float();
        $corpinf = cache_api_retrieve($Db, "/corp/CorporationSheet.xml.aspx", array("corporationID" => CORP_ID), 3 * 24 * 60 * 60)->value;
        $this->Title = "About " . $corpinf->result->corporationName;
        $time_end = microtime_float();
        $time_api = $time_end - $time_start;
        $this->Output .= <<<EOD
<table><tr><td>
<img src="http://image.eveonline.com/Corporation/{$corpinf->result->corporationID}_128.png" height=108 width=108>
</td><td valign=top>
<table>
<tr><td>CEO </td><td>{$corpinf->result->ceoName}</tr>
<tr><td>Members&nbsp;&nbsp;</td><td>{$corpinf->result->memberCount}</tr>
<tr><td>Tax </td><td>{$corpinf->result->taxRate}%</tr>
<tr><td>URL </td><td><a href="{$corpinf->result->url}" target="_blank">{$corpinf->result->url}</a></td></tr>
EOD;
        if ((int) $corpinf->result->allianceID != 0) {
            $this->Output .= "<tr><td>Alliance </td><td>" . $corpinf->result->allianceName . "</tr>";
        }
        $this->Output .= "\r\n\t\t</table>\r\n\t\t</td></table>\r\n\t\t<br>\r\n\t\t<div>";
        $this->Output .= parse_ccptml($corpinf->result->description);
        $this->Output .= "</div><br>";
        $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start);
        return true;
    }
 public function GetOutput($Db)
 {
     $Mail = new eveApiMails($Db);
     $full_url = FULL_URL;
     // TODO
     $time_start = microtime_float();
     if (!$Mail->fetch(CHAR_ID, USER_ID, API_KEY)) {
         $this->Output = $Mail->Error;
         return false;
     }
     $time_end = microtime_float();
     $time_api = $time_end - $time_start;
     $this->Updated = APITime($Mail);
     $this->Title = "Mail for " . CHAR_NAME;
     if (count($Mail->Messages) > 0) {
         $idsToResolve = array();
         foreach ($Mail->Messages as $message) {
             // get a list of all ids referenced
             foreach (explode(",", $message["toCorpOrAllianceID"] . "," . $message["toCharacterIDs"] . "," . $message["senderID"]) as $str) {
                 if ($str != "" && !in_array($str, $idsToResolve)) {
                     $idsToResolve[] = $str;
                 }
             }
         }
         $ids = idlookup($Db->link, $idsToResolve);
         if (isset($_GET['mail'])) {
             $ret = $Mail->fetchMailBody(CHAR_ID, USER_ID, API_KEY, $_GET['mail']);
             if (!$ret) {
                 $this->Output = "Error fetching mail {$_GET['mail']}: " . $Mail->Error;
                 return false;
             }
             foreach ($Mail->Messages as $message) {
                 if ($message["messageID"] != $_GET['mail']) {
                     continue;
                 } else {
                     $this->Output .= "<h3>{$message['title']}</h3><h5 style=\"display: inline;\">Sent by " . $ids[(int) $message["senderID"]] . " on {$message['sentDate']}</h5><br><br>";
                     break;
                 }
             }
             $this->Output .= parse_ccptml($ret) . "<br><br>";
             $this->Output .= "<a href=\"{$full_url}&view=mail\">[back]</a><br><br>";
         } else {
             $this->Output .= "<span style=\"font-size:80%; font-weight: bold;\">";
             /*if ($Mail->unread > 0) 
               $this->Output .= $Mail->unread." unread message".($Mail->unread ==1?", ":"s, ");*/
             $this->Output .= count($Mail->Messages) . " messages total<br>";
             if ($Mail->Message != "") {
                 $this->Output .= $Mail->Message . "<br>";
             }
             $this->Output .= "</span>";
             $this->Output .= "<br><table class=\"fancy Mail\" style=\"font-size:83%;\" border=1>";
             $this->Output .= "<tr><th>date</th><th>sender</th><th>title</th><th>recipients</th></tr>";
             $alt = " class=\"main\"";
             foreach ($Mail->Messages as $message) {
                 if ($alt == " class=\"main\"") {
                     $alt = " class=\"alt\"";
                 } else {
                     $alt = " class=\"main\"";
                 }
                 if ((int) $message["toListID"] == 0 || (string) $message["toListID"] == "") {
                     $to = array();
                     if ($message["toCorpOrAllianceID"] != "") {
                         $to += explode(",", $message["toCorpOrAllianceID"]);
                     }
                     if ($message["toCharacterIDs"] != "") {
                         $to += explode(",", $message["toCharacterIDs"]);
                     }
                     $recp = "";
                     foreach ($to as $rec) {
                         $recp .= $ids[(int) $rec] . ", ";
                     }
                     $recp = rtrim($recp, ", ");
                 } else {
                     $recp = "(mailing list)";
                 }
                 $this->Output .= "<tr{$alt} style=\"cursor: pointer;\" onclick=\"document.location='{$full_url}&view=mail&mail=" . $message["messageID"] . "'\">";
                 //$this->Output .= "<td>".($message["read"]!=1?"<b>#</b>":"")."</td>";
                 $this->Output .= "<td>" . $message["sentDate"] . "</td>";
                 $this->Output .= "<td>" . $ids[(int) $message["senderID"]] . "</td>";
                 $this->Output .= "<td>" . $message["title"] . "</td>";
                 $this->Output .= "<td>" . $recp . "</td>\n";
                 $this->Output .= "</tr>";
             }
             $this->Output .= "</table>";
         }
     } else {
         $this->Output .= "<br>Character has no recent mails.<br>";
     }
     $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start);
     return true;
 }
 public function GetOutput($Db)
 {
     $Mail = new eveApiMails($Db);
     $full_url = FULL_URL;
     // TODO
     $time_start = microtime_float();
     if (!$Mail->fetch(CHAR_ID, USER_ID, API_KEY)) {
         $this->Output = $Mail->Error;
         return false;
     }
     $time_end = microtime_float();
     $time_api = $time_end - $time_start;
     $this->Updated = APITime($Mail);
     $this->Title = "Mail for " . CHAR_NAME;
     if (count($Mail->Messages) > 0) {
         $idsToResolve = array();
         foreach ($Mail->Messages as $message) {
             // get a list of all ids referenced
             foreach (explode(",", $message["toCorpOrAllianceID"] . "," . $message["toCharacterIDs"] . "," . $message["senderID"]) as $str) {
                 if ($str != "" && !in_array($str, $idsToResolve)) {
                     $idsToResolve[] = $str;
                 }
             }
         }
         $ids = idlookup($Db->link, $idsToResolve);
         if (isset($_GET['mail'])) {
             $ret = $Mail->fetchMailBody(CHAR_ID, USER_ID, API_KEY, $_GET['mail']);
             if (!$ret) {
                 $this->Output = "Error fetching mail {$_GET['mail']}: " . $Mail->Error;
                 return false;
             }
             if (isset($_GET['ajax'])) {
                 die(json_encode(["result" => "success", "body" => (string) $ret]));
             }
             foreach ($Mail->Messages as $message) {
                 if ($message["messageID"] != $_GET['mail']) {
                     continue;
                 } else {
                     $this->Output .= "<h3>{$message['title']}</h3><h5 style=\"display: inline;\">Sent by " . $ids[(int) $message["senderID"]] . " on {$message['sentDate']}</h5><br><br>";
                     break;
                 }
             }
             $this->Output .= parse_ccptml($ret) . "<br><br>";
             $this->Output .= "<a href=\"{$full_url}&view=mail\">[back]</a><br><br>";
         } else {
             $this->Output .= "<span style=\"font-size:80%; font-weight: bold;\">";
             /*if ($Mail->unread > 0)
               $this->Output .= $Mail->unread." unread message".($Mail->unread ==1?", ":"s, ");*/
             $this->Output .= count($Mail->Messages) . " messages total<br>";
             if (isset($_SESSION) && isset($_SESSION['mailFormatted']) && $_SESSION['mailFormatted'] == true) {
                 $this->Output .= "Message Formatting: <input type=\"button\" value=\"Formatted\" id=\"changeMessageFormatting\">";
             } else {
                 $this->Output .= "Message Formatting: <input type=\"button\" value=\"Unformatted\" id=\"changeMessageFormatting\">";
             }
             if ($Mail->Message != "") {
                 $this->Output .= $Mail->Message . "<br>";
             }
             $this->Output .= "</span>";
             $this->Output .= "<br><table class=\"fancy Mail\" style=\"font-size:83%;\" border=1>";
             $this->Output .= "<tr><th>date</th><th>sender</th><th>title</th><th>recipients</th></tr>";
             $alt = " class=\"main\"";
             $ids1 = array();
             foreach ($Mail->Messages as $message) {
                 $ids1[] = (string) $message['senderID'];
                 $kindaID = explode(",", (string) $message['toCharacterIDs']);
                 $kindaID2 = explode(",", (string) $message['toCorpOrAllianceID']);
                 $ids1 = array_merge($ids1, $kindaID, $kindaID2);
             }
             $ids1 = array_unique($ids1);
             $redIDS = GetRedIDS($ids1, $Db);
             if (isset($redIDS[0]) && $redIDS[0] == 0) {
                 $redIDS = array();
             }
             foreach ($Mail->Messages as $message) {
                 $sentTo = explode(",", (string) $message['toCharacterIDs']);
                 $sentToGroup = explode(",", (string) $message['toCorpOrAllianceID']);
                 $intersect = array_intersect($redIDS, $sentTo);
                 $intersect2 = array_intersect($redIDS, $sentToGroup);
                 if (in_array((string) $message['senderID'], $redIDS) || !empty($intersect) || !empty($intersect2)) {
                     if (strpos(strtolower($alt), 'main') !== false) {
                         $alt = " class=\"redAlt messageRow\"";
                     } else {
                         $alt = " class=\"redMain messageRow\"";
                     }
                 } else {
                     if (strpos(strtolower($alt), 'main') !== false) {
                         $alt = " class=\"alt messageRow\"";
                     } else {
                         $alt = " class=\"main messageRow\"";
                     }
                 }
                 if ((int) $message["toListID"] == 0 || (string) $message["toListID"] == "") {
                     $to = array();
                     if ($message["toCorpOrAllianceID"] != "") {
                         $to += explode(",", $message["toCorpOrAllianceID"]);
                     }
                     if ($message["toCharacterIDs"] != "") {
                         $to += explode(",", $message["toCharacterIDs"]);
                     }
                     $recp = "";
                     foreach ($to as $rec) {
                         $recp .= $ids[(int) $rec] . ", ";
                     }
                     $recp = rtrim($recp, ", ");
                 } else {
                     $recp = "(mailing list)";
                 }
                 $this->Output .= "<tr{$alt} style=\"cursor: pointer;\" href=\"{$full_url}&view=mail&mail=" . $message["messageID"] . "\">";
                 //$this->Output .= "<td>".($message["read"]!=1?"<b>#</b>":"")."</td>";
                 $this->Output .= "<td>" . $message["sentDate"] . "</td>";
                 $this->Output .= "<td>" . $ids[(int) $message["senderID"]] . "</td>";
                 $this->Output .= "<td>" . $message["title"] . "</td>";
                 $this->Output .= "<td>" . $recp . "</td>\n";
                 $this->Output .= "</tr>";
             }
             $this->Output .= "</table>";
         }
     } else {
         $this->Output .= "<br>Character has no recent mails.<br>";
     }
     $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start);
     return true;
 }