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)
 {
     $Bookmarks = new eveApiBookmarks($Db);
     $full_url = FULL_URL;
     // TODO
     $time_start = microtime_float();
     if (!$Bookmarks->fetch(CHAR_ID, USER_ID, API_KEY, CORP_MODE)) {
         $this->Output = $Bookmarks->Error;
         return false;
     }
     $time_end = microtime_float();
     $time_api = $time_end - $time_start;
     $this->Updated = APITime($Bookmarks);
     $this->Title = "Bookmarks for " . USER_NAME;
     $xpandall = isset($_GET['xpandall']);
     if (count($Bookmarks->BookmarksByLocation) > 0) {
         $this->Output .= "";
         $this->Output .= count($Bookmarks->Bookmarks) . " items total in " . count($Bookmarks->BookmarksByLocation) . " locations<br>";
         if (!$xpandall) {
             $this->Output .= "<a href=\"{$full_url}&view=assets&xpandall\">Expand all entries</a><br>";
         } else {
             $this->Output .= "<a href=\"{$full_url}&view=assets\">Collapse all entries</a><br>";
         }
         $this->Output .= "<br><table class='fancy2'>";
         foreach ($Bookmarks->BookmarksByLocation as $location => $items) {
             $system = $Db->getLocationNameFromId($location);
             $this->Output .= "<tr><td style='cursor:pointer;' onclick=\"return toggle_visibility('l{$location}');\"><a href=\"#\" onclick=\"return false\">";
             $this->Output .= "<b>" . $system . "</b></a></td><td align=right><b>" . count($items) . "&nbsp;item" . (count($items) == 1 ? "" : "s") . "</b>&nbsp;&nbsp;&nbsp;<br></td></tr>";
             $this->Output .= "<tr><td colspan=2><div id=\"l{$location}\" style=\"" . ($xpandall ? "display:block;" : "display:none;") . "\"><br>\n";
             foreach ($items as $i => $bookmark) {
                 if ($Bookmarks->Bookmarks[$bookmark]['creatorID'] == 0) {
                     $this->Output .= $Bookmarks->Bookmarks[$bookmark]['bookmarkID'] . " ";
                 }
                 $this->Output .= $Bookmarks->Bookmarks[$bookmark]['memo'] . "<br>";
             }
             $this->Output .= "<br></div></td></tr>\n";
         }
         $this->Output .= "</table>";
     } else {
         $this->Output .= "<br>Character has no Bookmarks.<br>";
     }
     $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start);
     return true;
 }
 public function GetOutput($Db)
 {
     $Contacts = new eveApiContacts($Db);
     $full_url = FULL_URL;
     // TODO
     $time_start = microtime_float();
     if (!$Contacts->fetch(CHAR_ID, USER_ID, API_KEY)) {
         $this->Output = $Contacts->Error;
         return false;
     }
     $time_end = microtime_float();
     $time_api = $time_end - $time_start;
     $this->Updated = APITime($Contacts);
     $this->Title = "Contacts for " . USER_NAME;
     if (count($Contacts->Contacts) > 0) {
         $this->Output .= "<br><table class=\"fancy notification\" style=\"font-size:83%;\" border=1>";
         $this->Output .= "<tr><th>Contact</th><th>Standing</th><th>In Watchlist</th></tr>";
         $alt = " class=\"main\"";
         foreach ($Contacts->Contacts as $contact) {
             if ($alt == " class=\"main\"") {
                 $alt = " class=\"alt\"";
             } else {
                 $alt = " class=\"main\"";
             }
             $this->Output .= "<tr{$alt}>";
             $this->Output .= "<td>" . $contact["contactName"] . "</td>";
             $this->Output .= "<td>" . $contact["standing"] . "</td>";
             $this->Output .= "<td>" . ($contact["inWatchlist"] == "True" ? "&#10004" : "") . "</td>";
             $this->Output .= "</tr>";
         }
         $this->Output .= "</table>";
     } else {
         $this->Output .= "<br>Character has no contacts.<br>";
     }
     $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start);
     return true;
 }
 public function GetOutput($Db)
 {
     global $shpgroups, $owngroups, $interesting, $facmods, $offmods, $sort, $ord, $cols;
     $Members = new eveApiMembers($Db);
     $full_url = FULL_URL;
     // TODO
     $time_start = microtime_float();
     if (!$Members->fetch(CHAR_ID, USER_ID, API_KEY, KEY_MASK & corp_MemberTrackingExtended == corp_MemberTrackingExtended)) {
         $this->Output = $Members->Error;
         return false;
     }
     $time_end = microtime_float();
     $time_api = $time_end - $time_start;
     date_default_timezone_set("UTC");
     $this->Updated = APITime($Members);
     $this->Title = isset($_GET['char']) ? "Character roles info" : USER_NAME . " Membership";
     if (isset($_GET['char'])) {
         // TODO
         /* $result = $Members->entries->xpath("//*[@characterID=".$_GET['char']."]");
         		 
         		 if (count($result) != 0) {
         		 $char = $result[0];
         		 
         		 $this->Output .= "<h3>Roles for " . $char["name"]."</h3>";
         		 $roles = bin((float)$char["roles"]);
         		 
         		 $roleDescriptions = array(1=>"pos fueler",7=>
         		 'personal manager','accountant','security officer',
         		 'factory manager','station manager','auditor',
         		 'hanger can take division 1','hanger can take division 2',
         		 'hanger can take division 3','hanger can take division 4',
         		 'hanger can take division 5','hanger can take division 6',
         		 'hanger can take division 7',
         		 'hanger can query division 1','hanger can query division 2',
         		 'hanger can query division 3','hanger can query division 4',
         		 'hanger can query division 5','hanger can query division 6',
         		 'hanger can query division 7',
         		 'account can take division 1','account can take division 2',
         		 'account can take division 3','account can take division 4',
         		 'account can take division 5','account can take division 6',
         		 'account can take division 7',
         		 'account can query division 1','account can query division 2',
         		 'account can query division 3','account can query division 4',
         		 'account can query division 5','account can query division 6',
         		 'account can query division 7',
         		 'equipment config',
         		 'container can take division 1','container can take division 2',
         		 'container can take division 3','container can take division 4',
         		 'container can take division 5','container can take division 6',
         		 'container can take division 7',
         		 'can rent office','can rent factory slot','can rent research slot',
         		 'junior accountant','starbase config','starbase fuel'
         		 );
         		 
         		 $this->Output .= "<br>";
         		 } else 
         		 $this->Output .= "Character not found";
         		 */
     } else {
         /////////////////////////////////////////////////
         $sql = "SELECT groupName, groupID FROM " . DB_PREFIX . "invGroups WHERE categoryID = 6";
         $result = mysql_query($sql, $Db->link);
         $shpgroups = array();
         while ($row = mysql_fetch_assoc($result)) {
             $shpgroups[$row["groupID"]] = $row["groupName"];
         }
         mysql_free_result($result);
         $owngroups = array();
         function ship_group_Add($type)
         {
             global $Db, $shpgroups, $owngroups;
             if (array_key_exists((int) $type["groupID"], $shpgroups)) {
                 if (!isset($owngroups[$type["groupID"]])) {
                     $owngroups[$type["groupID"]] = 1;
                 } else {
                     $owngroups[$type["groupID"]]++;
                 }
             }
         }
         /////
         function shortloc($loc)
         {
             if (strpos($loc, " - ") != false) {
                 return substr($loc, 0, strpos($loc, " - "));
             }
             return $loc;
         }
         $result = $Members->entries;
         $ord = "ASC";
         $cols = array("name", "joined", "title", "laston", "location", "ship", "hasroles");
         foreach ($result as $entry) {
             if (!isset($entry["logoffDateTime"])) {
                 $cols = array("name", "joined", "title");
                 $lofi = true;
             }
             break;
         }
         $sort = null;
         if (!isset($nosorting) && isset($_GET['sort'])) {
             if (in_array($_GET['sort'], $cols)) {
                 $sort = $_GET['sort'];
                 if (isset($_GET['order'])) {
                     if ($_GET['order'] == "DESC") {
                         $ord = "DESC";
                     }
                 }
                 $this->Output .= "<br>sorting by {$sort}, " . strtolower($ord) . " <a href=\"{$full_url}&view=members\">[no sort]</a><br><br>";
             }
         } else {
             $this->Output .= "<br>";
         }
         if (count($result) > 0) {
             $entries = array();
             //"name","joined","title","laston","ship","has roles"
             foreach ($result as $entry) {
                 $new = array();
                 $new["id"] = (string) $entry["characterID"];
                 $new["name"] = (string) $entry["name"];
                 $new["joined"] = (string) $entry["startDateTime"];
                 $new["title"] = (string) $entry["title"];
                 $new["laston"] = (string) $entry["logoffDateTime"];
                 $new["ship"] = (string) $entry["shipType"];
                 $new["hasroles"] = (int) $entry["roles"] != 0 ? (string) $entry["roles"] == "9223372036854775807" ? "DIRECTOR" : "yes" : "";
                 $new["location"] = shortloc((string) $entry["location"]);
                 if ((int) $entry["shipTypeID"] != -1) {
                     ship_group_Add($Db->getTypeFromTypeId((int) $entry["shipTypeID"]));
                 }
                 $entries[] = $new;
             }
             if ($sort != null && array_key_exists($sort, $entries[0])) {
                 usort($entries, "globl_sortfunc");
             } else {
                 $sort = "name";
                 usort($entries, "globl_sortfunc");
             }
             $namedowngroups = array();
             foreach ($owngroups as $group_id => $cnt) {
                 $namedowngroups[$shpgroups[$group_id]] = $cnt;
             }
             ksort($namedowngroups);
             $this->Output .= "<table><tr><td>";
             $this->Output .= count($result) . " members<br>";
             $this->Output .= "<table class=\"fancy members\" style=\"font-size:83%;\" border=1>";
             $this->Output .= "<tr>";
             foreach ($cols as $col) {
                 $this->Output .= "<th>";
                 if (!isset($nosorting)) {
                     $this->Output .= "<a href=\"{$full_url}&view=members&sort={$col}&order=" . ($sort == $col && $ord == "ASC" ? "DESC" : "ASC") . "\">";
                 }
                 $this->Output .= $col;
                 if (!isset($nosorting)) {
                     $this->Output .= "</a>";
                 }
                 $this->Output .= "</th>";
             }
             $this->Output .= "</tr>";
             $alt = " class=\"main\"";
             //"name","timeincorp","title","laston","ship","hasroles");
             foreach ($entries as $entry) {
                 if ($alt == " class=\"main\"") {
                     $alt = " class=\"alt\"";
                 } else {
                     $alt = " class=\"main\"";
                 }
                 $this->Output .= "<tr {$alt}>";
                 $this->Output .= "<th scope=\"row\">" . str_replace(" ", "&nbsp;", $entry["name"]) . "&nbsp;</th>";
                 $this->Output .= "<td>" . str_replace(" ", "&nbsp;", ptime($entry["joined"])) . "</td>";
                 $this->Output .= "<td width=200>" . str_replace(" ", "&nbsp;", $entry["title"]) . "</td>";
                 if (!isset($lofi)) {
                     $this->Output .= "<td>" . str_replace(" ", "&nbsp;", ptime($entry["laston"])) . "</td>";
                     $this->Output .= "<td>" . str_replace(" ", "&nbsp;", $entry["location"]) . "</td>";
                     $this->Output .= "<td>" . str_replace(" ", "&nbsp;", $entry["ship"]) . "</td>";
                     //$this->Output .= "<td><a href=\"$full_url&view=members&char=".$entry["id"]."\">".$entry["hasroles"]."</a></td>";
                     $this->Output .= "<td>" . $entry["hasroles"] . "</td>";
                 }
                 $this->Output .= "</tr>\n";
             }
             $this->Output .= "</table>";
             $this->Output .= "</td><td valign=\"top\">";
             ///// shiptypes
             if (!isset($lofi)) {
                 $this->Output .= "<table>";
                 $this->Output .= "<tr><th>type</th><th># owned</th></tr>";
                 foreach ($namedowngroups as $group => $cnt) {
                     $this->Output .= "<tr><td>&nbsp;" . str_replace(" ", "&nbsp;", $group) . "&nbsp;</td><td>{$cnt}</td></tr>\n";
                 }
                 $this->Output .= "</table><br>";
             }
             $this->Output .= "</td></tr></table><br>";
         }
     }
     $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start);
     return true;
 }
 public function GetOutput($Db)
 {
     global $sort, $ord, $cols;
     // req for sorting
     $Orders = new eveApiOrders($Db);
     $time_start = microtime_float();
     if (!$Orders->fetch(CHAR_ID, USER_ID, API_KEY, CORP_MODE)) {
         $this->Output = $Mail->Orders;
         return false;
     }
     $time_end = microtime_float();
     $time_api = $time_end - $time_start;
     $this->Updated = APITime($Orders);
     $this->Title = "Orders for " . USER_NAME;
     /////////////////////////////////////////////////
     $result = $Orders->entries;
     $cols = array("date", "state", "type", "minvol", "initvol", "remaining", "price", "station", "range");
     if (CORP_MODE) {
         $cols[] = "owner";
         $cols[] = "div";
     }
     $ordercolors = array(0 => "FFFFFF", 1 => "FFFFFF", 2 => "007700", 3 => "BB0000", 4 => "FFFF00");
     $ord = "DESC";
     $sort = "date";
     $this->Output .= sort_ctrl(true);
     if (count($result) > 0) {
         if ($sort != null && array_key_exists($sort, $result[0])) {
             usort($result, "globl_sortfunc");
         }
         $sellorders = array();
         $buyorders = array();
         $exp_sellorders = array();
         $exp_buyorders = array();
         foreach ($result as $entry) {
             if (!$entry["bid"]) {
                 if ($entry["active"]) {
                     $sellorders[] = $entry;
                 } else {
                     $exp_sellorders[] = $entry;
                 }
             } else {
                 if ($entry["active"]) {
                     $buyorders[] = $entry;
                 } else {
                     $exp_buyorders[] = $entry;
                 }
             }
         }
         if (!isset($_GET['sort'])) {
             $sort = "type";
             $ord = "ASC";
             usort($sellorders, "globl_sortfunc");
             usort($buyorders, "globl_sortfunc");
         }
         $this->Output .= "<h3>Active Orders</h3>";
         $this->Output .= "<a name=\"sa\"></a>";
         $this->Output .= disp_orders($sellorders, "Sell Orders", array("minvol", "range", "state"), false, true);
         $this->Output .= "<a name=\"ba\"></a>";
         $this->Output .= disp_orders($buyorders, "Buy Orders", array("state"), false, true);
         $this->Output .= "<br><h3>Expired Orders</h3>";
         $this->Output .= "<a name=\"se\"></a>";
         $this->Output .= disp_orders($exp_sellorders, "Sell Orders", array("minvol", "range"), true);
         $this->Output .= "<a name=\"be\"></a>";
         $this->Output .= disp_orders($exp_buyorders, "Buy Orders", array());
     } else {
         $this->Output .= (CORP_MODE ? "Corporation" : "Character") . " has no orders history.<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)
 {
     $KillLog = new eveApiKillLog($Db);
     $full_url = FULL_URL;
     // TODO
     $time_start = microtime_float();
     if (!$KillLog->fetch(CHAR_ID, USER_ID, API_KEY, CORP_MODE, CORP_MODE ? CORP_ID : 0)) {
         $this->Output = $KillLog->Error;
         return false;
     }
     $time_end = microtime_float();
     $time_api = $time_end - $time_start;
     $this->Updated = APITime($KillLog);
     $killmail = null;
     if (isset($_GET['kill'])) {
         $kill = $KillLog->All->xpath("/eveapi/result/rowset[@name='kills']/row[@killID=" . $_GET['kill'] . "]");
         if (count($kill) > 0) {
             $killmail = generate_kill($kill[0]);
         }
     }
     if (!$killmail) {
         $this->Title = "PVP Activity for " . USER_NAME;
         if (isset($_GET['kill'])) {
             $this->Output .= "Bad killID!<br>";
         }
         $this->Output .= "<table><tr><td valign=top>\n";
         if (count($KillLog->Kills) > 1) {
             // TODO is this correct?
             $this->Output .= display_log($KillLog->Kills, "Kills");
             $this->Output .= "</td><td valign=top>";
         } else {
             $this->Output .= "<b><span style=\"font-size:80%\">" . strtoupper("[" . (CORP_MODE ? "corp" : "char") . " has no recent kills]") . "</b></span><br><br>";
         }
         if (count($KillLog->Losses) > 1) {
             $this->Output .= display_log($KillLog->Losses, "Losses");
             $this->Output .= "</td>";
         } else {
             $this->Output .= "<b><span style=\"font-size:80%\">" . strtoupper("[" . (CORP_MODE ? "corp" : "char") . " has no recent losses]") . "</b></span><br><br>";
         }
         $this->Output .= "</tr></table>";
     } else {
         $this->Title = "Details for kill " . $_GET['kill'];
         $this->Output .= "<br>Displaying killID " . $_GET['kill'];
         $this->Output .= "<br>[ <a href=\"" . FULL_URL . "&view=kills\">back</a> ]";
         $this->Output .= "<pre>{$killmail}</pre>";
         //}
     }
     $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start);
     return true;
 }
 public function GetOutput($Db)
 {
     $Notifs = new eveApiNotifications($Db);
     $full_url = FULL_URL;
     // TODO
     $time_start = microtime_float();
     if (!$Notifs->fetch(CHAR_ID, USER_ID, API_KEY)) {
         $this->Output = $Notifs->Error;
         return false;
     }
     $time_end = microtime_float();
     $time_api = $time_end - $time_start;
     $this->Updated = APITime($Notifs);
     $this->Title = "Notifications for " . USER_NAME;
     if (count($Notifs->Notifications) > 0) {
         $this->Output .= "<span style=\"font-size:80%; font-weight: bold;\">";
         if ($Notifs->unread > 0) {
             $this->Output .= $Notifs->unread . " unread notification" . ($Notifs->unread == 1 ? ", " : "s, ");
         }
         $this->Output .= count($Notifs->Notifications) . " notifications total<br>";
         if ($Notifs->Message != "") {
             $this->Output .= $Notifs->Message . "<br>";
         }
         $this->Output .= "</span>";
         $idsToResolve = array();
         foreach ($Notifs->Notifications as $message) {
             // get a list of all ids referenced
             if (!in_array((string) $message["senderID"], $idsToResolve)) {
                 $idsToResolve[] = (string) $message["senderID"];
             }
         }
         $ids = idlookup($Db->link, $idsToResolve);
         $this->Output .= "<br><table class=\"fancy notification\" style=\"font-size:83%;\" border=1>";
         $this->Output .= "<tr><th>!</th><th>date</th><th>sender</th><th>type</th></tr>";
         $alt = " class=\"main\"";
         foreach ($Notifs->Notifications as $message) {
             if ($alt == " class=\"main\"") {
                 $alt = " class=\"alt\"";
             } else {
                 $alt = " class=\"main\"";
             }
             $this->Output .= "<tr{$alt}>";
             $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>" . notif_type_lookup($message["typeID"]) . "</td>";
             $this->Output .= "</tr>";
         }
         $this->Output .= "</table>";
     } else {
         $this->Output .= "<br>Character has no recent notifications.<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;
 }
 public function GetOutput($Db)
 {
     global $sort, $ord, $cols;
     // req for sorting
     $Journal = new eveApiJournal($Db);
     $full_url = FULL_URL;
     // TODO
     $time_start = microtime_float();
     $acct = isset($_GET['div']) ? $_GET['div'] + 999 : 1000;
     if (!$Journal->fetch(CHAR_ID, USER_ID, API_KEY, CORP_MODE, $acct)) {
         $this->Output = $Journal->Error;
         return false;
     }
     $time_end = microtime_float();
     $time_api = $time_end - $time_start;
     $this->Updated = APITime($Journal);
     $this->Title = "Journal for " . USER_NAME;
     /////////////////////////////////////////////////
     $ord = "ASC";
     $cols = array("date", "type", "amount", "balance", "description", "reason");
     $sort = null;
     $this->Output .= sort_ctrl();
     if (!$sort) {
         $sort = "date";
         $ord = "DESC";
     }
     $this->Output .= div_select($acct);
     if (count($Journal->entries) > 0) {
         $this->Output .= number_format((int) $Journal->entries[0]["balance"], 2) . " ISK<br><br>";
         $this->Output .= count($Journal->entries) . " entries<br>";
         $this->Output .= "<table class=\"fancy journal\" style=\"font-size:83%;\" border=1>";
         $this->Output .= "<tr>";
         foreach ($cols as $col) {
             $this->Output .= "<th>";
             if (!isset($nosorting)) {
                 $this->Output .= "<a href=\"{$full_url}&view=journal&sort={$col}&order=" . ($sort == $col && $ord == "ASC" ? "DESC" : "ASC") . "\">";
             }
             $this->Output .= $col;
             if (!isset($nosorting)) {
                 $this->Output .= "</a>";
             }
             $this->Output .= "</th>";
         }
         $this->Output .= "</tr>";
         $entries = $Journal->entries;
         if ($sort != null && array_key_exists($sort, $entries[0])) {
             usort($entries, "globl_sortfunc");
         }
         $alt = " class=\"main\"";
         foreach ($entries as $entry) {
             if ($alt == " class=\"main\"") {
                 $alt = " class=\"alt\"";
             } else {
                 $alt = " class=\"main\"";
             }
             $this->Output .= "<tr{$alt}>";
             $this->Output .= "<th scope=\"row\">" . str_replace(" ", "&nbsp;", $entry["date"]) . "&nbsp;</th>";
             $this->Output .= "<td>" . str_replace(" ", "&nbsp;", $entry["typeNice"]) . "</td>";
             $this->Output .= "<td align=right style=\"color: " . ($entry["amount"] > -1 ? "#007700" : "#BB0000") . ";\">&nbsp;" . number_format($entry["amount"], 2) . "&nbsp;ISK</td>";
             $this->Output .= "<td align=right>&nbsp;" . number_format($entry["balance"], 2) . "&nbsp;ISK&nbsp;&nbsp;</td>";
             $this->Output .= "<td>" . $entry["description"] . "</td>";
             $this->Output .= "<td nowrap=\"nowrap\" width=\"400\">" . $entry["reason"] . "&nbsp;</td>";
             $this->Output .= "</tr>\n";
         }
         $this->Output .= "</table>";
     } else {
         $this->Output .= (CORP_MODE ? "Division" : "Character") . " has no Journal activity in the last 3 months.<br>";
     }
     $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start);
     return true;
 }
 public function GetOutput($Db)
 {
     global $shpgroups, $owngroups, $interesting, $facmods, $offmods;
     $Assets = new eveApiAssets($Db);
     $full_url = FULL_URL;
     // TODO
     $time_start = microtime_float();
     if (!$Assets->fetch(CHAR_ID, USER_ID, API_KEY, CORP_MODE)) {
         $this->Output = $Assets->Error;
         return false;
     }
     $this->Updated = APITime($Assets);
     $this->Title = "Assets for " . USER_NAME;
     $time_end = microtime_float();
     $time_api = $time_end - $time_start;
     $Db->updateConqStations();
     $result = $Db->selectWhere("invGroups", ['categoryID' => 6], ['groupName', 'groupID']);
     $shpgroups = array();
     if ($result != false) {
         if ($result->rows > 0) {
             foreach ($result->results as $row) {
                 $shpgroups[$row["groupID"]] = $row["groupName"];
             }
         }
     }
     $owngroups = array();
     $hrwidth = 450;
     $start = true;
     $last = "";
     $interesting = "";
     $facmods = 0;
     $offmods = 0;
     $pos_fuels = isset($_GET['posfuels']);
     $xpandall = isset($_GET['xpandall']);
     /*
     if (isset($_GET['query'])) {
     $query = array();
     $pairs = explode(";",$_GET['query']);
     foreach($pairs as $arg) {
     $arg2 = explode(":",$arg);
     
     switch($arg2[0]) {
     case "type": $query[$arg2[1]] = "typeID"; break;
     case "group": $query[$arg2[1]] = "typeID"; break;
     case "cat": $query[$arg2[1]] = "cat"; break;
     }
     }
     }
     */
     $this->Output .= "<table><tr><td  VALIGN=\"top\" >";
     $this->Output .= $Assets->totalCt . " items total in " . count($Assets->assetsByLocation) . " locations<br>";
     if (!$xpandall) {
         $this->Output .= "<a href=\"{$full_url}&view=assets&xpandall\">Expand all entries</a><br>";
     } else {
         $this->Output .= "<a href=\"{$full_url}&view=assets\">Collapse all entries</a><br>";
     }
     $this->Output .= "<br><table class='fancy2'>";
     foreach ($Assets->assetsByLocation as $location => $items) {
         $station = $Db->getLocationNameFromId($location);
         /*
         if ($station == null)
         $station = $item["locationID"];
         */
         if ($pos_fuels) {
             $bad = true;
             foreach ($items as $itemId => $item) {
                 if (contains_pos_fuel($item)) {
                     $bad = false;
                 }
             }
             if ($bad) {
                 continue;
             }
         }
         $this->Output .= "<tr><td style='cursor:pointer;' onclick=\"return toggle_visibility('l{$location}');\"><a href=\"#\" onclick=\"return false\">";
         $this->Output .= "<b>" . $station . "</b></a>" . ($location < 60000000 ? " (in space)" : "") . "</td><td align=right><b>" . count($items) . "&nbsp;item" . (count($items) == 1 ? "" : "s") . "</b>&nbsp;&nbsp;&nbsp;<br></td></tr>";
         $this->Output .= "<tr><td colspan=2><div id=\"l{$location}\" style=\"" . ($xpandall ? "display:block;" : "display:none;") . "\"><br>\n";
         foreach ($items as $itemId => $item) {
             $this->Output .= item_display($station, $itemId, $item);
         }
         $this->Output .= "<br></div></td></tr>\n";
     }
     $this->Output .= "</table></td><td valign=top>";
     $this->Output .= "Significant assets:";
     $this->Output .= "<br><br>";
     if ($interesting != "") {
         $this->Output .= $interesting;
     } else {
         $this->Output .= "&nbsp;Character has no significant assets.<br>";
     }
     $this->Output .= "<br>";
     $namedowngroups = array();
     foreach ($owngroups as $group_id => $cnt) {
         $namedowngroups[$shpgroups[$group_id]] = $cnt;
     }
     ksort($namedowngroups);
     $this->Output .= "&nbsp;Ships by Group:<br><br>";
     $this->Output .= "<table>";
     $this->Output .= "<tr><th>type</th><th># owned</th></tr>";
     foreach ($namedowngroups as $group => $cnt) {
         $this->Output .= "<tr><td>&nbsp;{$group}&nbsp;</td><td>{$cnt}</td></tr>\n";
     }
     $this->Output .= "</table>";
     $this->Output .= "</td></tr></table>";
     $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start);
     return true;
 }
 public function GetOutput($Db)
 {
     global $sort, $ord, $cols;
     // req for sorting
     $Transactions = new eveApiTransactions($Db);
     $full_url = FULL_URL;
     // TODO
     $time_start = microtime_float();
     $acct = isset($_GET['div']) ? $_GET['div'] + 999 : 1000;
     if (!$Transactions->fetch(CHAR_ID, USER_ID, API_KEY, CORP_MODE, $acct)) {
         $this->Output = $Transactions->Error;
         return false;
     }
     $time_end = microtime_float();
     $time_api = $time_end - $time_start;
     $this->Updated = APITime($Transactions);
     $this->Title = "Transactions for " . USER_NAME;
     /////////////////////////////////////////////////
     $result = $Transactions->entries;
     $ord = "ASC";
     $cols = array("date", "type", "price", "quantity", "total", "client", "station");
     $sort = null;
     $this->Output .= sort_ctrl();
     if (!$sort) {
         $sort = "date";
         $ord = "DESC";
     }
     $this->Output .= div_select($acct);
     if (count($result) > 0) {
         $this->Output .= "<br>" . count($result) . " entries<br>";
         $this->Output .= "<table class=\"fancy trans\" style=\"font-size:83%;\" border=1>";
         $this->Output .= "<tr>";
         foreach ($cols as $col) {
             $this->Output .= "<th>";
             if (!isset($nosorting)) {
                 $this->Output .= "<a href=\"{$full_url}&view=transactions&sort={$col}&order=" . ($sort == $col && $ord == "ASC" ? "DESC" : "ASC") . "\">";
             }
             $this->Output .= $col;
             if (!isset($nosorting)) {
                 $this->Output .= "</a>";
             }
             $this->Output .= "</th>";
         }
         $ids = array();
         foreach ($result as &$entry) {
             $ids[] = (string) $entry['clientID'];
         }
         $ids = array_unique($ids);
         $redIDS = GetRedIDS($ids, $Db);
         if (isset($redIDS[0]) && $redIDS[0] == 0) {
             $redIDS = array();
         }
         $this->Output .= "</tr>";
         //("date","type","price","total","client","station"
         if ($sort != null && array_key_exists($sort, $result[0])) {
             usort($result, "globl_sortfunc");
         }
         $alt = " class=\"main\"";
         $alt_b = false;
         foreach ($result as $entry) {
             $alt_b = !$alt_b;
             $this->Output .= "<tr ";
             if (in_array($entry['clientID'], $redIDS)) {
                 if ($alt_b) {
                     $this->Output .= " class=\"redAlt";
                 } else {
                     $this->Output .= " class=\"redMain";
                 }
             } else {
                 if ($alt_b) {
                     $this->Output .= " class=\"alt";
                 } else {
                     $this->Output .= " class=\"main";
                 }
             }
             $this->Output .= ($entry["corp"] && !CORP_MODE ? " corp_entry_row" : "") . "\">";
             $this->Output .= "<th scope=\"row\">" . str_replace(" ", "&nbsp;", $entry["date"]) . "&nbsp;</th>";
             $this->Output .= "<td>" . str_replace(" ", "&nbsp;", $entry["type"]) . "</td>";
             $this->Output .= "<td align=right >" . number_format($entry["price"], 2) . "&nbsp;ISK</td>";
             $this->Output .= "<td align=center> " . $entry["quantity"] . "</td>";
             $this->Output .= "<td align=right style=\"color: " . ($entry["total"] > -1 ? "#007700" : "#BB0000") . ";\">&nbsp;" . number_format($entry["total"], 2) . "&nbsp;ISK</td>";
             $this->Output .= "<td>&nbsp;" . $entry["client"] . "&nbsp;&nbsp;</td>";
             $this->Output .= "<td width=\"*\">" . $entry["station"] . "&nbsp;</td>";
             $this->Output .= "</tr>\n";
         }
         $this->Output .= "</table>";
     } else {
         $this->Output .= (CORP_MODE ? "Division" : "Character") . " has no recent transactions.<br><br>";
     }
     $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start);
     return true;
 }
    public function GetOutput($Db)
    {
        global $SkillsApi;
        $full_url = FULL_URL;
        // TODO
        $small = isset($_GET['small']);
        $SkillsApi = new eveApiSkills($Db);
        $time_start = microtime_float();
        if (!$SkillsApi->fetch(CHAR_ID, USER_ID, API_KEY)) {
            $this->Output = $SkillsApi->Error;
            return false;
        }
        if (isset($_GET['fitcheck']) || isset($_GET['fittingid'])) {
            $time_end = microtime_float();
            $time_api = $time_end - $time_start;
            $this->Title = "Jackknife Fitting Checker";
            if (isset($_POST['fitting']) || isset($_GET['fittingid'])) {
                $warnings = "";
                $ship = "";
                $fit_name = "";
                if (isset($_POST['fitting'])) {
                    $fit = trim($_POST['fitting']);
                    $fitting = parse_eft_fit($Db, $fit, $warnings, $ship, $fit_name);
                } else {
                    $result = mysql_query("SELECT * FROM " . DB_PREFIX . FITTINGS_TABLE . " WHERE keyv=\"" . mysql_real_escape_string($_GET['fittingid']) . "\"", $Db->link);
                    if ($result != false && mysql_num_rows($result) > 0) {
                        // yay! got a cached value
                        $row = mysql_fetch_assoc($result);
                        mysql_free_result($result);
                        $ship = $row["ship"];
                        $fit_name = $row["name"];
                        $fitting = unserialize($row["fit"]);
                        $this->stored = true;
                        $this->key = $_GET['fittingid'];
                    } else {
                        $this->Output .= "<br><b>Fit Key unknown.</b> You muppet.<br>";
                        $this->Output .= "<br><a href=\"" . FULL_URL . "&view=skills&fitcheck=1\">[try another fit]</a> <a href=\"" . FULL_URL . "&view=skills\">[back to skills]</a><br>";
                        return true;
                    }
                }
                if (strlen($warnings) > 0) {
                    $this->Output .= "<br>\n<b>Fit parsing warnings:</b><br> {$warnings}\n<h4 style=\"color: red\">Your fit will not be saved until these warnings are resolved.</h4>";
                }
                if (count($fitting) == 0) {
                    $this->Output .= "<br><b>FIT WAS UNABLE TO BE PARSED!</b> You muppet.<br>";
                    $this->Output .= "<br><a href=\"" . FULL_URL . "&view=skills&fitcheck=1\">[try another fit]</a> <a href=\"" . FULL_URL . "&view=skills\">[back to skills]</a><br>";
                    return true;
                } else {
                    $canuse = true;
                    $low = "";
                    $med = "";
                    $high = "";
                    $rigs = "";
                    $drones = "";
                    $subsy = "";
                    $skillsneeded = "";
                    $this->key = md5(serialize($fitting));
                    if (!$this->stored && strlen($warnings) == 0) {
                        $result = mysql_query("SELECT * FROM " . DB_PREFIX . FITTINGS_TABLE . " WHERE keyv=\"{$this->key}\"");
                        $this->redirect = true;
                        $this->stored = true;
                        if ($result == false || mysql_num_rows($result) == 0) {
                            $sql = "INSERT INTO " . DB_PREFIX . FITTINGS_TABLE . " (keyv, name, ship, fit) VALUES('{$this->key}', '" . mysql_real_escape_string($fit_name) . "', '" . mysql_real_escape_string($ship) . "', '" . mysql_real_escape_string(serialize($fitting)) . "')";
                            mysql_query($sql, $Db->link);
                        }
                    }
                    foreach ($fitting as $typeID => $qty) {
                        $name = $Db->getNameFromTypeId($typeID);
                        $slot = $Db->getSlotFromTypeId($typeID);
                        if ($slot == SLOT_DRONE) {
                            $drones .= "{$name} x{$qty}<br>";
                        } else {
                            for ($i = 0; $i < $qty; $i++) {
                                switch ($slot) {
                                    case SLOT_LOW:
                                        $low .= $name . "<br>\n";
                                        break;
                                    case SLOT_HIGH:
                                        $high .= $name . "<br>\n";
                                        break;
                                    case SLOT_MED:
                                        $med .= $name . "<br>\n";
                                        break;
                                    case SLOT_RIG:
                                        $rigs .= $name . "<br>\n";
                                        break;
                                    case SLOT_SUBSYSTEM:
                                        $subsy .= $name . "<br>\n";
                                        break;
                                }
                            }
                        }
                        $arr = $SkillsApi->canCharUseTypeIDAdvanced($typeID);
                        if (count($arr) != 0) {
                            $canuse = false;
                            $skillsneeded .= "<b><span style=\"color:darkred;\">{$name}: Missing skills!</span></b>&nbsp;&nbsp;<br><span style=\"font-size: 80%\">\n";
                            foreach ($arr as $typeIDSkill => $missing) {
                                $skillsneeded .= $Db->getNameFromTypeId($typeIDSkill) . ": {$missing}<br>\n";
                            }
                            $skillsneeded .= "</span><br>";
                        }
                    }
                    if ($canuse) {
                        $this->Output .= "<h3 style=\"color:green;\">You can use this fit!</h3>\n";
                    } else {
                        $this->Output .= "<h3 style=\"color:red;\">You are missing skills to use this fit.</b></h3>\n";
                    }
                    $this->Output .= "<table class=\"fittingskills\"><tr>";
                    if ($skillsneeded != "") {
                        $this->Output .= "<th>missing skills</th>";
                    }
                    $this->Output .= "<th>fitting</th>";
                    $this->Output .= "</tr><tr>";
                    $this->Output .= "<td valign=\"top\">{$skillsneeded}</td>";
                    $this->Output .= "<td valign=\"top\">[{$ship}, {$fit_name}]<br>{$low}<br>{$med}<br>{$high}<br>";
                    if ($rigs != "") {
                        $this->Output .= "{$rigs}<br>";
                    }
                    if ($subsy != "") {
                        $this->Output .= "{$subsy}<br>";
                    }
                    if ($drones != "") {
                        $this->Output .= "<br>{$drones}";
                    }
                    $this->Output .= "</td></tr></table><br>";
                }
                if (strlen($warnings) == 0) {
                    $this->Output .= "<h4 style=\"display:inline;\" >Fitting Test URL</h4> - Give this link to friends so they can test their skills against this fit!<br><input type=\"text\" value=\"" . SELF_URL . "fittingid={$this->key}\"  onclick=\"this.select()\" size=85 readonly>";
                }
                $this->Output .= "<h4><a href=\"" . FULL_URL . "&view=skills&fitcheck=1\">[try another fitting]</a>&nbsp;";
                if (strlen($warnings) == 0) {
                    $this->Output .= "<a href=\"" . SELF_URL . "newapi&fittingid={$this->key}\">[try another account]</a>&nbsp;";
                }
                $this->Output .= "<a href=\"" . FULL_URL . "&view=skills\">[back to skills]</a><br></h4>";
            } else {
                $this->Output = "<H4>Paste an EFT-style fit here!</h4><form method=\"post\" action=\"" . FULL_URL . "&view=skills&fitcheck=1\"><textarea name=\"fitting\" cols=\"50\" rows=\"20\"></textarea><br><input type=\"submit\" value=\"Test Ship Fitting\"></form>";
                $this->Output .= "<br><a href=\"" . FULL_URL . "&view=skills\">[back to skills]</a><br>";
            }
            //print_r($typeIDs);
        } else {
            // skills view
            $skillInf = new eveApiTraining($Db);
            $skillTraining = $skillInf->fetch(CHAR_ID, USER_ID, API_KEY);
            $time_end = microtime_float();
            $time_api = $time_end - $time_start;
            $SkillsApi->loadSkills();
            $itemTypesUsed = array(3336, 3327, 3332, 3328, 3339, 3335, 3331, 3337, 3333, 3329, 3338, 3334, 3330, 16591, 12095, 3413, 3392, 3318, 3300, 28609, 3435, 3426, 3449, 22761, 12093, 3432, 3431, 12096, 3428, 23950, 12099, 3354, 3348, 28656, 11579, 21611, 3456, 3455, 3402, 28667, 3424, 11207, 19719, 3380, 12092, 3453, 12098, 12097, 11569, 20494, 3352, 20495, 3351, 3350, 11572, 3349, 13209, 3411, 21889, 21888, 21890, 22442, 20405, 22474, 20069, 22468, 20070, 22446, 20124, 20533, 20342, 29029, 24563, 3421, 24562, 3412, 27906, 22043, 28585, 24625, 3387, 3347, 3345, 3344, 3346, 20527, 3340, 20524, 3343, 20528, 3341, 20526, 3342, 24313, 3442, 3436, 24311, 24314, 24312, 20531, 20525, 20532, 20530, 20327, 3309, 3306, 3303, 21666, 3307, 3304, 3301, 21667, 3308, 3305, 3302, 32435, 3319, 3326, 3324, 3321, 21668, 3325, 24572, 3423, 24571, 3422, 27936, 27902, 24568, 16069, 3393, 21803, 3394, 21802, 3419, 3416, 28352, 28374, 17940, 3410, 3386, 28606, 29637, 22552, 22536, 17476, 22544, 22551, 3320, 25719, 23069, 639, 2961, 12203, 3311, 12202, 12201, 1306, 24688, 3090, 12207, 12206, 11082, 2281, 3420, 3841, 3425, 642, 3065, 12205, 12204, 11083, 641, 638, 19739, 20212, 2929, 12209, 3312, 12208, 11084, 11359, 644, 2446, 3441, 12486, 2420, 20213, 643, 3057, 12215, 12214, 12213, 3186, 12212, 12211, 12210, 645, 640, 2567, 3427, 13320, 12023, 1999, 3082, 12003, 3025, 12015, 2969, 12011, 1978, 3317, 16229, 24696, 24702, 16227, 24698, 2410, 20211, 10858, 3540, 2444, 22456, 22782, 11446, 3829, 22460, 22452, 22464, 19724, 20701, 20448, 23563, 23594, 23606, 20280, 19720, 20446, 19722, 20703, 20454, 32444, 19726, 24569, 3616, 23911, 12219, 23757, 24483, 23915, 21096, 21603, 12084, 3454, 3450, 11269, 2048, 11325, 1952, 1541, 1355, 519, 11578, 3244, 527);
            // speed things up - cache ahead of time
            $Db->cacheItemTypes($itemTypesUsed);
            $Db->cacheSkillsForTypeIds($itemTypesUsed);
            $Db->cacheGroupTypes(array(257, 272, 269, 273, 255, 268, 256, 270, 275, 266, 258, 271, 274, 278));
            //echo "<pre>";
            //print_r($SkillsApi);
            //exit;
            //$this->Updated = APITime($SkillsApi);
            $this->Updated = "Now";
            $this->Title = "Skills for " . CHAR_NAME;
            $this->Header = <<<EOD
<table class="table" >
<tr>
<td VALIGN="top">
<table class="table"><tr><td>
<img src="http://image.eveonline.com/Character/
EOD;
            $this->Header .= CHAR_ID . "_256.jpg\" height=118 width=118></td><td><span style=\"font-size:";
            $this->Header .= strlen($SkillsApi->charName) > 18 ? "300" : "400";
            $this->Header .= "%\">" . $SkillsApi->charName . "</span><br>";
            $this->Header .= $SkillsApi->corpName;
            $this->Header .= "<br><span style=\"font-size:75%\">";
            $this->Header .= number_format($SkillsApi->SPTotal, 0) . " SP in " . $SkillsApi->SkillCount . " skills<br>";
            $this->Header .= number_format($SkillsApi->balance, 2) . " ISK<br>";
            $this->Header .= "Born " . date("Y-m-d", $SkillsApi->charDOB) . "</span></td></tr>";
            //$this->Header .= "<tr><td colspan=\"2\">";
            //$this->Header .= "<span style=\"font-size:75%;\"><a href=\"" . FULL_URL ."&view=skills&fitcheck\">check " . CHAR_NAME."'s skills against a ship fit</a><br><a target=\"_blank\" href=\"http://eve-search.com/search/author/";
            //$this->Header .= str_replace(" ", "%20", $SkillsApi->charName);
            //$this->Header .= "/forum/734105\">search character sale forums for character</a></span><br></td></tr>";
            $this->Header .= <<<EOD
</table>
<br>
<br></td>
<td valign=top align="right">
<table class="skills_legends">
<tr><th colspan="2">Legend</th></tr>
<tr><td>level "U"</td><td>Skill is trainable but not owned</td></tr>
<tr><td>"can fly a"</td><td>can use ship and the mods needed (t2 weaps)</td></tr>
<tr><td>guided m</td><td>guided missiles; eg. standard, heavy, cruise</td></tr>
<tr><td>unguided</td><td>unguided missiles; rockets, heavy ass., torp</td></tr>
<tr><td>poorly vs well</td><td>can use both of associated carrier's remote reps</td></tr>
<tr><td>snipe</td><td>long range t2 weapons and associated modules</td></tr>
<tr><td>RR</td><td>remote rep; short range t2 weapons and armour tank</td></tr>
</table></td></tr><tr><td colspan=2>
EOD;
            if (!ob_start()) {
                die("fatal error - OB opening failed.");
            }
            $this->Output = "<table class=\"skills_table table\"><tr VALIGN=\"top\">";
            $small = 1;
            if ($small) {
                echo "<td VALIGN=\"top\" width=\"250\" rowspan=\"2\">\n";
                include "skills/skills.tab.php";
                echo "</td>\n<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/racial.tab.php";
                echo "</td>\n<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/caps.tab.php";
                echo "<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/weaps.tab.php";
                echo "</td>\n<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/fleet.tab.php";
                echo "</td></tr>\n<tr>";
                echo "<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/skillst2.tab.php";
                echo "</td>\n<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/ldrskil.tab.php";
                echo "</td>\n<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/t2mods.tab.php";
                echo "</td>\n<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/misc.tab.php";
            } else {
                echo "<td VALIGN=\"top\" width=\"250\">\n";
                include "skills/skills.tab.php";
                echo "</td>\n<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/racial.tab.php";
                echo "</td>\n<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/skillst2.tab.php";
                echo "</td>\n<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/ldrskil.tab.php";
                echo "</td>\n<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/caps.tab.php";
                echo "</td>\n<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/weaps.tab.php";
                echo "</td>\n<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/fleet.tab.php";
                echo "</td>\n<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/t2mods.tab.php";
                echo "</td>\n<td VALIGN=\"top\">\n";
                /////////////////////////////////////////////////////
                include "skills/misc.tab.php";
            }
            $this->Output .= ob_get_contents();
            ob_end_clean();
            $this->Output .= "</td>";
            if ($small) {
                $this->Output .= "<td></td>";
            }
            $this->Output .= "</tr>\n</table></td></tr></table>";
            $this->Output .= "<span style=\"font-size:80%;\">";
            //$this->Output .= "best viewed in " . ($small ? "1024x768" : "1440x900") . "<br>";
            if (!$small) {
                $this->Output .= "<a href=\"{$full_url}&small\">compact view</a><br>";
            }
            $this->Output .= "</span>";
        }
        $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start);
        return true;
    }
    public function GetOutput($Db)
    {
        global $sort, $ord, $cols;
        // req for sorting
        $Contracts = new eveApiContracts($Db);
        $full_url = FULL_URL;
        // TODO
        $time_start = microtime_float();
        if (!$Contracts->fetch(CHAR_ID, USER_ID, API_KEY, CORP_MODE)) {
            $this->Output = $Contracts->Error;
            return false;
        }
        $time_end = microtime_float();
        $time_api = $time_end - $time_start;
        $Db->updateConqStations();
        $this->Updated = APITime($Contracts);
        $this->Title = "Contracts for " . USER_NAME;
        if (isset($_GET['testing'])) {
            die("<pre>" . print_r($Contracts->entries, true) . "</pre>");
        }
        $ord = "ASC";
        $cols = array("Type", "status", "System", "dateIssued", "dateFinished", "issuer", "contractor", "Price", "volume", "desc");
        $sort = null;
        $this->Output .= sort_ctrl();
        //$this->Output .= "<h5 style=\"display: inline\">### PAGE UNDER CONSTRUCTION - WATCH FOR ANVILS ###</h5>";
        if (count($Contracts->entries) > 0) {
            $this->Output .= <<<LEGENDEND
<table border="1" style="font-size: 80%; border-style: solid;">

<tr><th colspan="2">LEGEND</th></tr>
<tr><th>time format</th><td>[Month.Days.Years] Hours:Minutes</td></tr>
<tr><th>blue row:</th><td>this contract is on behalf of your corporation</td></tr>
<tr><th>orange volume:</th><td>volume is greater than 30,000 m3</td></tr>
<tr><th>yellow time:</th><td>less than 24hrs left on auction</td></tr>
<tr><th>red time:</th><td>less than 1 hour left on auction</td></tr>
<tr><th>red price:</th><td>this is the price that was/will be paid <b style="color:red">by</b> the contract acceptor</td></tr>
<tr><th>green price:</th><td>this is the price that was/will be paid <b style="color:#0f0">to</b> the contract acceptor</td></tr>
<tr><th>&lt;assignee&gt;</th><td>contract is assigned to assignee but has not been accepted</td></tr>
</table><br>
LEGENDEND;
            $this->Output .= count($Contracts->entries) . " entries. <b>Click an entry to get contract details.</b><br><br>";
            $this->Output .= "<table class=\"contracts_table\" style=\"font-size:83%;\" border=1>";
            $this->Output .= "<tr>";
            foreach ($cols as $col) {
                $this->Output .= "<th>";
                if (!isset($nosorting)) {
                    $this->Output .= "<a href=\"{$full_url}&view=contracts&sort={$col}&order=" . ($sort == $col && $ord == "ASC" ? "DESC" : "ASC") . "\">";
                }
                $this->Output .= $col;
                if (!isset($nosorting)) {
                    $this->Output .= "</a>";
                }
                $this->Output .= "</th>";
            }
            $this->Output .= "</tr>";
            $entries = $Contracts->entries;
            $ids = array();
            foreach ($entries as &$entry) {
                if ((string) $entry["availability"] == "Private" && $entry["acceptor"] == "") {
                    $entry["contractor"] = $entry["assignee"];
                } else {
                    if ($entry["acceptor"] == "") {
                        if (isset($entry["bidder"])) {
                            if ($entry["bidder"] == "") {
                                $entry["contractor"] = "";
                            } else {
                                $entry["contractor"] = "{$entry['bidder']}";
                            }
                        } else {
                            $entry["contractor"] = "";
                        }
                    } else {
                        $entry["contractor"] = $entry["acceptor"];
                    }
                }
                $entry["Price"] = ($entry["reward"] > 0 || $entry["reward"] == $entry["price"] ? -1 : 1) * (double) ($entry["price"] + (double) $entry["reward"]);
                $ids[] = (string) $entry['issuerID'];
                $ids[] = (string) $entry['assigneeID'];
            }
            $ids = array_unique($ids);
            $redIDS = GetRedIDS($ids, $Db);
            if (isset($redIDS[0]) && $redIDS[0] == 0) {
                $redIDS = array();
            }
            unset($entry);
            if ($sort != null && array_key_exists($sort, $entries[0])) {
                usort($entries, "globl_sortfunc");
            }
            $alt_b = false;
            $rowclass = " class=\"nohover" . (isset($_GET['expandall']) ? "" : " contractbody") . "\"";
            foreach ($entries as $entry) {
                $alt_b = !$alt_b;
                $hasItems = isset($entry["buying"]) && ($entry["sellingItems"] != "" || $entry["buyingItems"] != "");
                $this->Output .= "<tr onclick=\"toggle_row_visibility('contract" . $entry["contractID"] . "'); return false;\"";
                if (in_array($entry['issuerID'], $redIDS) || in_array($entry['assigneeID'], $redIDS)) {
                    if ($alt_b) {
                        $this->Output .= " class=\"redAlt";
                    } else {
                        $this->Output .= " class=\"redMain";
                    }
                } else {
                    if ($alt_b) {
                        $this->Output .= " class=\"alt";
                    } else {
                        $this->Output .= " class=\"main";
                    }
                }
                $this->Output .= ($entry["forCorp"] == 1 ? " corp_entry_row" : "") . " hover clickablerow\">";
                //$this->Output .= "<th scope=\"row\">" . $entry["contractID"] . "</th>";
                $this->Output .= "<th scope=\"row\">" . $entry["Type"] . "</th>";
                if (CONTRACT_ACTIVE($entry["status"])) {
                    $this->Output .= "<td class=\"pendingcontractstatus\">" . $entry["status"] . "</td>";
                } else {
                    if ($entry["status"] == "Failed") {
                        $this->Output .= "<td class=\"failedcontractstatus\">FAILED</td>";
                    } else {
                        if ($entry["status"] == "Rejected") {
                            $this->Output .= "<td class=\"failedcontractstatus\">Rejected</td>";
                        } else {
                            $this->Output .= "<td class=\"contractstatus\">" . $entry["status"] . "</td>";
                        }
                    }
                }
                $this->Output .= "<td>" . $entry["System"] . "</td>";
                $this->Output .= "<td>" . shortDateTime($entry["dateIssued"]) . "</td>";
                if (CONTRACT_ACTIVE((string) $entry["status"])) {
                    if ($entry["timeRemaining"] <= 3600 * 24) {
                        $this->Output .= "<td style=\"color: " . timeToColor($entry["timeRemaining"]) . "\">";
                    } else {
                        $this->Output .= "<td>";
                    }
                    $this->Output .= niceTime($entry["timeRemaining"], 2) . " left</td>";
                } else {
                    if ((string) $entry["status"] == "Failed") {
                        $this->Output .= "<td class=\"failedcontractstatus\">FAILED</td>";
                    } else {
                        if ($entry["status"] == "Rejected") {
                            $this->Output .= "<td class=\"failedcontractstatus\">Rejected</td>";
                        } else {
                            if ($entry["dateFinished"] != "") {
                                $this->Output .= "<td>" . shortDateTime($entry["dateFinished"]) . "</td>";
                            } else {
                                $this->Output .= "<td>&nbsp;</td>";
                            }
                        }
                    }
                }
                $this->Output .= "<td>" . $entry["issuer"] . "</td>";
                if ((string) $entry["availability"] == "Private" && $entry["acceptor"] == "") {
                    $this->Output .= "<td>&lt;" . $entry["assignee"] . "&gt;</td>";
                } else {
                    if ($entry["acceptor"] == "") {
                        if (isset($entry["bidder"])) {
                            if ($entry["bidder"] == "") {
                                $this->Output .= "<td style=\"color:grey;\">&lt;no bids&gt;</td>";
                            } else {
                                $this->Output .= "<td style=\"color:grey;\">&lt;bid {$entry['bidder']}&gt;</td>";
                            }
                        } else {
                            $this->Output .= "<td style=\"color:grey;\">&lt;public&gt;</td>";
                        }
                    } else {
                        $this->Output .= "<td>" . $entry["acceptor"] . "</td>";
                    }
                }
                $this->Output .= "<td align=right style=\"color: " . ($entry["reward"] > 0 || $entry["reward"] == $entry["price"] ? "#007700" : "#BB0000") . ";\">" . number_format((double) $entry["price"] + (double) $entry["reward"], 2) . " ISK</td>";
                if ($entry["volume"] > 30000) {
                    $this->Output .= "<td style=\"color: #FFA500\">" . shortVolume($entry["volume"]) . "</td>";
                } else {
                    $this->Output .= "<td>" . shortVolume($entry["volume"]) . "</td>";
                }
                $this->Output .= "<td width=\"500\"" . ">" . $entry["desc"];
                if ($hasItems) {
                    if ($entry["desc"] != "") {
                        $this->Output .= "<br>";
                    }
                    $this->Output .= "<span class=\"contract_items\">";
                    if ($entry["sellingItems"] != "") {
                        switch ($entry["Type"]) {
                            case "Trade":
                                $this->Output .= "<b>Offering:</b> ";
                                break;
                            case "Gift":
                                $this->Output .= "<b>Giving:</b> ";
                                break;
                            default:
                                $this->Output .= "<b>Selling:</b> ";
                                break;
                        }
                        $this->Output .= "{$entry['sellingItems']}<br>";
                    }
                    if ($entry["buyingItems"] != "") {
                        $this->Output .= ($entry["Type"] != "Trade" ? "<b>Buying:</b> " : "<b>Looking for:</b> ") . "{$entry['buyingItems']}";
                    }
                    $this->Output .= "</span>";
                }
                $this->Output .= "&nbsp;</td>\n";
                $this->Output .= "</tr>\n";
                /// BEGIN CONTRACT DETAILS
                $this->Output .= "<tr{$rowclass} id=\"contract" . $entry["contractID"] . "\"><td colspan=\"" . count($cols) . "\">";
                $this->Output .= "<a name=\"" . $entry["contractID"] . "\"></a><h3>";
                if ($entry["title"] != "") {
                    $this->Output .= "{$entry['title']} - ";
                }
                if ($entry["type"] == "ItemExchange") {
                    $this->Output .= "Item Exchange [{$entry["Type"]}]";
                } else {
                    $this->Output .= "{$entry["Type"]}";
                }
                $this->Output .= " - {$entry['status']}</h3>";
                $this->Output .= "<b>Location</b>: {$entry["startStation"]}<br>";
                if ($entry["type"] == "Courier") {
                    $this->Output .= "<b>Destination</b>: {$entry["endStation"]}({$entry["endStationID"]})<br>";
                }
                $this->Output .= "<b>Posted</b>: {$entry['dateIssued']}<br>";
                if ((double) $entry["acceptorID"] != 0 && $entry["type"] == "Courier") {
                    $this->Output .= "<b>Accepted</b>: {$entry['dateAccepted']}<br>";
                }
                if ((string) $entry["status"] != "Completed" && (string) $entry["status"] != "Deleted" && (string) $entry["status"] != "Failed") {
                    $this->Output .= "<b>Remaining</b>: <span";
                    if ($entry["timeRemaining"] <= 3600 * 24) {
                        $this->Output .= " style=\"color: " . timeToColor($entry["timeRemaining"]) . "\">";
                    } else {
                        $this->Output .= ">";
                    }
                    $this->Output .= niceTime($entry["timeRemaining"], 3) . "</span><br>";
                } else {
                    $this->Output .= "<b>Finished</b>: {$entry['dateFinished']}<br>";
                }
                $this->Output .= "<b>Contractor</b>: ";
                if ((string) $entry["availability"] == "Private" && $entry["acceptor"] == "") {
                    $this->Output .= "&lt;" . $entry["assignee"] . "&gt;";
                } else {
                    if ($entry["acceptor"] == "") {
                        if (isset($entry["bidder"])) {
                            if ($entry["bidder"] == "") {
                                $this->Output .= "<span style=\"color:grey;\">&lt;no bids&gt;</span>";
                            } else {
                                $this->Output .= "<span style=\"color:grey;\">&lt;bid {$entry['bidder']}&gt;</span>";
                            }
                        } else {
                            $this->Output .= "<span style=\"color:grey;\">&lt;public&gt;</span>";
                        }
                    } else {
                        $this->Output .= $entry["acceptor"];
                    }
                }
                $this->Output .= "<br>";
                if ($entry["reward"] > 0 || $entry["reward"] == $entry["price"]) {
                    $this->Output .= "<b>Reward</b>: <span style=\"color:007700\">";
                } else {
                    $this->Output .= "<b>Price</b>: <span style=\"color:BB0000\">";
                }
                $this->Output .= number_format((double) $entry["price"] + (double) $entry["reward"], 2) . " ISK</span></br>";
                if ((double) $entry["collateral"] != 0) {
                    $this->Output .= "<b>Collateral</b>: <span style=\"color:#f00;\">" . number_format((double) $entry["collateral"], 2) . " ISK</span></br>";
                }
                $this->Output .= "<b>Volume</b>: ";
                if ($entry["volume"] > 30000) {
                    $this->Output .= "<span style=\"color: #FFA500\">" . number_format($entry["volume"], 2) . " m3</span>";
                } else {
                    $this->Output .= number_format($entry["volume"], 2) . " m3";
                }
                $this->Output .= "<br>";
                if ($hasItems) {
                    $this->Output .= "<br><table class=\"contracts_wtt\"><tr>";
                    if ($entry["sellingItems"] != "") {
                        $this->Output .= "<th> " . ($entry["Type"] != "Trade" ? $entry["Type"] == "Gift" ? "<b>Giving</b>:" : "<b>Selling</b> " : "<b>Offering:</b> ") . "</th>";
                    }
                    if ($entry["buyingItems"] != "") {
                        $this->Output .= "<th> " . ($entry["Type"] != "Trade" ? "<b>Buying</b> " : "<b>Looking for:</b> ") . "</th>";
                    }
                    $this->Output .= "</tr><tr>";
                    if ($entry["sellingItems"] != "") {
                        $this->Output .= "<td>" . str_replace("\n", "<br>", $entry["sellingItemsList"]) . "</td>";
                    }
                    if ($entry["buyingItems"] != "") {
                        $this->Output .= "<td>" . str_replace("\n", "<br>", $entry["buyingItemsList"]) . "</td>";
                    }
                    $this->Output .= "</tr></table>";
                }
                $this->Output .= "";
                $this->Output .= "<br><h3 style=\"font-size: 150%; border-bottom: 0px;\"><a href=\"#\" onclick=\"toggle_row_visibility('contract" . $entry["contractID"] . "'); return false;\">[Hide]</a></h3>";
                $this->Output .= "";
                $this->Output .= "";
                $this->Output .= "</td></tr>\n";
            }
            $this->Output .= "</table>";
            if (isset($_GET['contract'])) {
                $this->Output .= "<script>toggle_row_visibility('contract{$_GET['contract']}'); location.hash='{$_GET['contract']}';</script>";
            }
        } else {
            $this->Output .= (CORP_MODE ? "Corporation" : "Character") . " has no Contracts in the last 3 months.<br>";
        }
        $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start);
        return true;
    }
 public function GetOutput($Db)
 {
     $Contacts = new eveApiContacts($Db);
     $full_url = FULL_URL;
     // TODO
     $time_start = microtime_float();
     if (!$Contacts->fetch(CHAR_ID, USER_ID, API_KEY, CORP_MODE)) {
         $this->Output = $Contacts->Error;
         return false;
     }
     $time_end = microtime_float();
     $time_api = $time_end - $time_start;
     $this->Updated = APITime($Contacts);
     $this->Title = "Contacts for " . USER_NAME;
     if (count($Contacts->Contacts) > 0) {
         $redIDS = GetContactInfo($Contacts->Contacts, $Db);
         $this->Output .= "<br><table class=\"fancy notification\" style=\"font-size:83%;\" border=1>";
         $this->Output .= "<tr><th>Contact</th><th>Standing</th><th>Corp</th><th>Alliance</th><th>In Watchlist</th></tr>";
         $alt = " class=\"main\"";
         foreach ($Contacts->Contacts as $contact) {
             if (in_array($contact['contactID'], $redIDS)) {
                 if (strpos(strtolower($alt), 'main') !== false) {
                     $alt = " class=\"redAlt\"";
                 } else {
                     $alt = " class=\"redMain\"";
                 }
             } else {
                 if (strpos(strtolower($alt), 'main') !== false) {
                     $alt = " class=\"alt\"";
                 } else {
                     $alt = " class=\"main\"";
                 }
             }
             $this->Output .= "<tr{$alt}>";
             $this->Output .= "<td>" . $contact["contactName"] . "</td>";
             $this->Output .= "<td>" . $contact["standing"] . "</td>";
             if (isset($contact['corpID'])) {
                 $this->Output .= "<td>" . $contact["corpName"] . "</td>";
             } else {
                 $this->Output .= "<td></td>";
             }
             if (isset($contact['allianceID'])) {
                 $this->Output .= "<td>" . $contact["allianceName"] . "</td>";
             } else {
                 $this->Output .= "<td></td>";
             }
             $this->Output .= "<td>" . ($contact["inWatchlist"] == "True" ? "&#10004" : "") . "</td>";
             $this->Output .= "</tr>";
         }
         $this->Output .= "</table>";
     } else {
         $this->Output .= "<br>Character has no contacts.<br>";
     }
     $this->Times = getPageTimes($Db, $time_api, microtime_float() - $time_start);
     return true;
 }