public function execute($parameters, $db)
 {
     $db->execute("delete from zz_social where insertTime < date_sub(now(), interval 23 hour)");
     $minPilots = 100;
     $minWrecks = 100;
     $result = $db->query("select * from (select solarSystemID, count(distinct characterID) count, count(distinct killID) kills from zz_participants where characterID != 0 and killID > 0 and dttm > date_sub(now(), interval 1 hour) group by 1 order by 2 desc) f where count >= {$minPilots} and kills > {$minWrecks}");
     foreach ($result as $row) {
         $systemID = $row["solarSystemID"];
         $key = $row["solarSystemID"] * 100 + date("H");
         $key2 = $row["solarSystemID"] * 100 + date("H", time() + 3600);
         // Have we already reported this battle to the masses?
         $socialCount = $db->queryField("select count(*) count from zz_social where killID = :killID", "count", array(":killID" => $key), 0);
         $db->execute("insert ignore into zz_social (killID) values (:k1), (:k2)", array(":k1" => $key, ":k2" => $key2));
         Info::addInfo($row);
         $wrecks = number_format($row['kills'], 0);
         $involved = number_format($row['count'], 0);
         $system = $row["solarSystemName"];
         $date = date("YmdH00");
         $link = "https://zkillboard.com/related/{$systemID}/{$date}/";
         // Insert into (or update) zz_battles
         $db->execute("REPLACE INTO zz_battles (solarSystemID, solarSystemName, timestamp, involved, kills) VALUES (:solarSystemID, :solarSystemName, :timestamp, :involved, :kills)", array(":solarSystemID" => $systemID, ":solarSystemName" => $system, ":timestamp" => $date, ":involved" => $involved, ":kills" => $wrecks));
         if ($socialCount != 0) {
             $message = "Battle detected in |g|{$system}|n| with |g|{$involved}|n| involved and |g|{$wrecks}|n| wrecks.";
             Log::irc($message . " |g|{$link}");
             $isgd = Twit::shortenURL($link);
             $message = Log::stripIRCColors($message . " {$isgd} #tweetfleet #eveonline");
             $tweet = Twit::sendMessage($message);
             $twitID = $tweet->id;
             Log::irc("Message was also tweeted: https://twitter.com/eve_kill/status/{$twitID}");
         }
     }
 }
 public function execute($parameters, $db)
 {
     $url = "https://twitter.com/eve_kill/status/";
     $storageName = "twitterLatestRepliesID";
     $latest = $db->queryField("SELECT contents FROM zz_storage WHERE locker = '{$storageName}'", "contents", array(), 0);
     if ($latest == null) {
         $latest = 0;
     }
     $maxID = $latest;
     $twitter = Twit::getMessages(25);
     $messages = array();
     foreach ($twitter as $status) {
         $text = (array) $status->text;
         $createdAt = (array) $status->created_at;
         $postedBy = (array) $status->user->name;
         $screenName = (array) $status->user->screen_name;
         $id = (int) $status->id;
         if ($id <= $latest) {
             continue;
         }
         $maxID = max($id, $maxID);
         $message = array("message" => $text[0], "postedAt" => $createdAt[0], "postedBy" => $postedBy[0], "screenName" => $screenName[0], "url" => $url . $id[0]);
         $url = "https://twitter.com/" . $screenName[0] . "/status/" . $id;
         $msg = "|g|@|n|" . $screenName[0] . " (|g|" . $message["postedBy"] . "|n|) |g|/|n| " . date("H:i:s", strtotime($message["postedAt"])) . " |g|/|n| " . Twit::shortenUrl($url) . " |g|/|n| |g|" . $message["message"];
         //$msg = "Twitter: ($id) |g|" . $message["postedBy"] . "|n| (|g|@". $screenName[0] ."|n|) / |g|" . date("Y-m-d H:i:s", strtotime($message["postedAt"])) . " Message:|n| " . $message["message"];
         $messages[$id] = $msg;
     }
     ksort($messages);
     foreach ($messages as $id => $msg) {
         Log::irc($msg, "");
     }
     if (sizeof($twitter)) {
         $db->execute("INSERT INTO zz_storage (contents, locker) VALUES (:contents, :locker) ON DUPLICATE KEY UPDATE contents = :contents", array(":locker" => $storageName, ":contents" => $maxID));
     }
 }
Example #3
0
 public function execute($parameters, $db)
 {
     try {
         $db->query("select now()", array(), 0);
     } catch (Exception $ex) {
         Log::irc("|r|Unable to connect to the database: " . $ex->getMessage());
     }
 }
 public function execute($parameters, $db)
 {
     $lastActualKills = $db->queryField("select contents count from zz_storage where locker = 'actualKills'", "count", array(), 0);
     $actualKills = $db->queryField("select count(*) count from zz_killmails where processed = 1", "count", array(), 0);
     $lastTotalKills = $db->queryField("select contents count from zz_storage where locker = 'totalKills'", "count", array(), 0);
     $totalKills = $db->queryField("select count(*) count from zz_killmails", "count", array(), 0);
     $db->execute("replace into zz_storage (locker, contents) values ('totalKills', {$totalKills})");
     $db->execute("replace into zz_storage (locker, contents) values ('actualKills', {$actualKills})");
     $db->execute("delete from zz_storage where locker like '%KillsProcessed'");
     $actualDifference = number_format($actualKills - $lastActualKills, 0);
     $totalDifference = number_format($totalKills - $lastTotalKills, 0);
     Log::irc("|g|{$actualDifference}|n| mails processed | |g|{$totalDifference}|n| kills added");
 }
 public function execute($parameters, $db)
 {
     $storageName = "smsLatestID";
     $latest = $db->queryField("SELECT contents FROM zz_storage WHERE locker = '{$storageName}'", "contents", array(), 0);
     if ($latest == null) {
         $latest = 0;
     }
     $maxID = $latest;
     global $smsUsername, $smsPassword;
     $url = "http://www.bulksms.co.uk:5567/eapi/reception/get_inbox/1/1.1?username="******"&password="******"&last_retrieved_id={$maxID}";
     $response = file_get_contents($url);
     $msgs = explode("\n", $response);
     $cleanMsgs = array();
     foreach ($msgs as $msg) {
         $line = explode("|", $msg);
         if (sizeof($line) >= 6) {
             $cleanMsgs[] = $msg;
         }
     }
     $msgs = $cleanMsgs;
     foreach ($msgs as $msg) {
         $line = explode("|", $msg);
         $id = $line[0];
         $num = $line[1];
         $msg = $line[2];
         $name = $db->queryField("select name from zz_irc_mobile where mobilenumber = :number", "name", array(":number" => $num));
         if ($name != null) {
             $num = $name;
         }
         $maxID = max($maxID, $id);
         $out = "SMS from |g|{$num}|n|: {$msg}";
         Log::irc($out);
     }
     if (sizeof($msgs)) {
         $db->execute("INSERT INTO zz_storage (contents, locker) VALUES (:contents, :locker) ON DUPLICATE KEY UPDATE contents = :contents", array(":locker" => $storageName, ":contents" => $maxID));
     }
 }
Example #6
0
 private static function apiPercentage($db)
 {
     $percentage = Storage::retrieve("LastHourPercentage", 10);
     $row = $db->queryRow("select sum(if(errorCode = 0, 1, 0)) good, sum(if(errorCode != 0, 1, 0)) bad from zz_api_characters");
     $good = $row["good"];
     $bad = $row["bad"];
     if ($bad > ($bad + $good) * ($percentage / 100)) {
         if ($percentage > 15) {
             Log::irc("|r|API gone haywire?  Over {$percentage}% of API's reporting an error atm.");
         }
         $percentage += 5;
     } else {
         if ($bad < ($bad + $good) * (($percentage - 5) / 100)) {
             $percentage -= 5;
         }
     }
     if ($percentage < 10) {
         $percentage = 10;
     }
     Storage::store("LastHourPercentage", $percentage);
 }
Example #7
0
$message = array();
$info = User::getUserInfo();
$ticket = Db::queryRow('SELECT * FROM zz_tickets WHERE id = :id', array(':id' => $id), 0);
if ($ticket == null or sizeof($ticket) == 0) {
    $message = array('status' => 'error', 'message' => 'Ticket does not exist.');
} elseif ($ticket['status'] == 0) {
    $message = array('status' => 'error', 'message' => 'Ticket has been closed, you cannot post, only view it');
} elseif ($ticket['userid'] != User::getUserID() && @$info['moderator'] == 0 && @$info['admin'] == 0) {
    $app->notFound();
}
if ($_POST) {
    $reply = Util::getPost('reply');
    if ($reply && $ticket['status'] != 0) {
        $name = $info['username'];
        $moderator = @$info['moderator'] == true;
        $check = Db::query('SELECT * FROM zz_tickets_replies WHERE reply = :reply AND userid = :userid AND belongsTo = :id', array(':reply' => $reply, ':userid' => User::getUserID(), ':id' => User::getUserID()), 0);
        if (!$check) {
            Db::execute('INSERT INTO zz_tickets_replies (userid, belongsTo, name, reply, moderator) VALUES (:userid, :belongsTo, :name, :reply, :moderator)', array(':userid' => User::getUserID(), ':belongsTo' => $id, ':name' => $name, ':reply' => $reply, ':moderator' => $moderator));
            global $baseAddr;
            if (!$moderator) {
                Log::irc("|g|Ticket response from {$name}|n|: https://{$baseAddr}/moderator/tickets/{$id}/");
            }
            $app->redirect("/tickets/view/{$id}/");
            exit;
        }
    } else {
        $message = array('status' => 'error', 'message' => 'No...');
    }
}
$replies = Db::query('SELECT * FROM zz_tickets_replies WHERE belongsTo = :id', array(':id' => $id), 0);
$app->render('tickets_view.html', array('page' => $id, 'message' => $message, 'ticket' => $ticket, 'replies' => $replies));
Example #8
0
function beSocial($killID)
{
    global $beSocial, $mdb;
    if (!isset($beSocial)) {
        $beSocial = false;
    }
    if ($beSocial === false) {
        return;
    }
    if ($killID < 0) {
        return;
    }
    $ircMin = 10000000000.0;
    $twitMin = 10000000000.0;
    $kill = $mdb->findDoc('killmails', ['killID' => $killID]);
    if (@$kill['social'] == true) {
        return;
    }
    $hours24 = time() - 86400;
    if ($kill['dttm']->sec < $hours24) {
        return;
    }
    // Get victim info
    $victimInfo = $kill['involved'][0];
    if ($victimInfo == null) {
        return;
    }
    $totalPrice = $kill['zkb']['totalValue'];
    Info::addInfo($victimInfo);
    // Reduce spam of freighters and jump freighters
    $shipGroupID = $victimInfo['groupID'];
    if (in_array($shipGroupID, array(513, 902))) {
        $shipPrice = Price::getItemPrice($victimInfo['shipTypeID'], date('Ymd'));
        $ircMin += $shipPrice;
        $twitMin += $shipPrice;
    }
    $worthIt = false;
    $worthIt |= $totalPrice >= $ircMin;
    if (!$worthIt) {
        return;
    }
    $tweetIt = false;
    $tweetIt |= $totalPrice >= $twitMin;
    global $fullAddr, $twitterName;
    $url = "{$fullAddr}/kill/{$killID}/";
    if ($url == '') {
        $url = "{$fullAddr}/kill/{$killID}/";
    }
    $message = '|g|' . $victimInfo['shipName'] . '|n| worth |r|' . Util::formatIsk($totalPrice) . " ISK|n| was destroyed! {$url}";
    if (!isset($victimInfo['characterName'])) {
        $victimInfo['characterName'] = $victimInfo['corporationName'];
    }
    if (strlen($victimInfo['characterName']) < 25) {
        $name = $victimInfo['characterName'];
        if (Util::endsWith($name, 's')) {
            $name .= "'";
        } else {
            $name .= "'s";
        }
        $message = "{$name} {$message}";
    }
    $mdb->getCollection('killmails')->update(['killID' => $killID], ['$unset' => ['social' => true]]);
    Log::irc("{$message}");
    $message = Log::stripIRCColors($message);
    $message .= ' #tweetfleet #eveonline';
    if (strlen($message) > 120) {
        $message = str_replace(' worth ', ': ', $message);
    }
    if (strlen($message) > 120) {
        $message = str_replace(' was destroyed!', '', $message);
    }
    if ($tweetIt && strlen($message) <= 120) {
        $return = Twit::sendMessage($message);
        $twit = "https://twitter.com/{$twitterName}/status/" . $return->id;
        Log::irc("Message was also tweeted: |g|{$twit}");
    }
}
Example #9
0
<?php

require_once '../init.php';
$minute = (int) date('i');
if ($minute != 0) {
    exit;
}
$mdb = new Mdb();
$killsLastHour = new RedisTtlCounter('killsLastHour', 3600);
$kills = $killsLastHour->count();
$count = $mdb->findField('storage', 'contents', ['locker' => 'totalKills']);
if ($kills > 0) {
    Log::irc('|g|' . number_format($kills, 0) . '|n| kills processed.');
    Util::out(number_format($kills, 0) . ' kills added, now at ' . number_format($count, 0) . ' kills.');
}
 /**
  * @param string $type
  * @param string $column
  */
 private static function recalc($type, $column, $calcKills = true, $db)
 {
     //CLI::out("|g|Calculating stats for $type");
     $now = time();
     Log::log("Starting stat calculations for {$type}");
     Log::irc("Starting stat calculations for {$type}");
     $db->execute("replace into zz_storage values ('MaintenanceReason', 'Full stats calculation - currently working on {$type}s')");
     $db->execute("drop table if exists zz_stats_temporary");
     $db->execute("\r\n\t\t\t\tCREATE TABLE `zz_stats_temporary` (\r\n\t\t\t\t\t`killID` int(16) NOT NULL,\r\n\t\t\t\t\t`groupName` varchar(16) NOT NULL,\r\n\t\t\t\t\t`groupNum` int(16) NOT NULL,\r\n\t\t\t\t\t`groupID` int(16) NOT NULL,\r\n\t\t\t\t\t`points` int(16) NOT NULL,\r\n\t\t\t\t\t`price` decimal(16,2) NOT NULL,\r\n\t\t\t\t\tPRIMARY KEY (`killID`,`groupName`,`groupNum`,`groupID`)\r\n\t\t\t\t\t) ENGINE=InnoDB");
     $db->execute("insert ignore into zz_stats_temporary select killID, '{$type}', {$column}, groupID, points, total_price from zz_participants where {$column} != 0 and isVictim = 1");
     $db->execute("replace into zz_stats (type, typeID, groupID, lost, pointsLost, iskLost) select groupName, groupNum, groupID, count(killID), sum(points), sum(price) from zz_stats_temporary group by 1, 2, 3");
     if ($calcKills) {
         $db->execute("truncate table zz_stats_temporary");
         $db->execute("insert ignore into zz_stats_temporary select killID, '{$type}', {$column}, vGroupID, points, total_price from zz_participants where {$column} != 0 and isVictim = 0");
         $db->execute("insert into zz_stats (type, typeID, groupID, destroyed, pointsDestroyed, iskDestroyed) (select groupName, groupNum, groupID, count(killID), sum(points), sum(price) from zz_stats_temporary group by 1, 2, 3) on duplicate key update destroyed = values(destroyed), pointsDestroyed = values(pointsDestroyed), iskDestroyed = values(iskDestroyed)");
     }
     $db->execute("drop table if exists zz_stats_temporary");
     $delta = time() - $now;
     Log::log("Finished stat calculations for {$type} (" . number_format($delta, 0) . " seconds)");
     Log::irc("Finished stat calculations for |g|{$type}|n| (|g|" . number_format($delta, 0) . " seconds|n|)");
 }
Example #11
0
 public static function beSocial($killID)
 {
     if ($killID < 0) {
         return;
     }
     $ircMin = 5000000000;
     $twitMin = 10000000000;
     // This is an array of characters we like to laugh at :)
     $laugh = array(1633218082, 924610627, 619471207, 268946627, 179004085, 428663616);
     $count = Db::queryField("select count(*) count from zz_social where killID = :killID", "count", array(":killID" => $killID), 0);
     if ($count != 0) {
         return;
     }
     // Get victim info
     $victimInfo = Db::queryRow("select * from zz_participants where killID = :killID and isVictim = 1", array(":killID" => $killID));
     if ($victimInfo == null) {
         return;
     }
     $totalPrice = $victimInfo["total_price"];
     if (!in_array($victimInfo["characterID"], $laugh)) {
         // If in laugh array, skip the checks
         // Check the minimums, min. price and happened in last 12 hours
         if ($totalPrice < $ircMin) {
             return;
         }
     }
     Info::addInfo($victimInfo);
     $url = "https://zkillboard.com/detail/{$killID}/";
     if ($totalPrice >= $twitMin) {
         $url = Twit::shortenUrl($url);
     }
     $message = "|g|" . $victimInfo["shipName"] . "|n| worth |r|" . Util::formatIsk($totalPrice) . " ISK|n| was destroyed! {$url}";
     if (!isset($victimInfo["characterName"])) {
         $victimInfo["characterName"] = $victimInfo["corporationName"];
     }
     if (strlen($victimInfo["characterName"]) < 25) {
         $name = $victimInfo["characterName"];
         if (Util::endsWith($name, "s")) {
             $name .= "'";
         } else {
             $name .= "'s";
         }
         $message = "{$name} {$message}";
     }
     Db::execute("insert into zz_social (killID) values (:killID)", array(":killID" => $killID));
     Log::irc("{$message}");
     $message = Log::stripIRCColors($message);
     if ($totalPrice >= $twitMin) {
         $message .= " #tweetfleet #eveonline";
         $return = Twit::sendMessage($message);
         $twit = "https://twitter.com/eve_kill/status/" . $return->id;
         Log::irc("Message was also tweeted: |g|{$twit}");
     }
 }
Example #12
0
                if ($exists > 0) {
                    continue;
                }
                Util::out("Discovered item: {$name}");
                ++$newItems;
                $mdb->insertUpdate('information', ['type' => 'typeID', 'id' => $typeID], ['name' => $name, 'groupID' => $groupID, 'lastCrestUpdate' => new MongoDate(1)]);
            }
        }
    }
    $next = @$groups['next']['href'];
    if ($next != null) {
        $groups = CrestTools::getJSON($next);
    }
} while ($next != null);
$mdb->insertUpdate('storage', ['locker' => 'groupsPopulated'], ['contents' => true]);
if ($newGroups > 0) {
    Log::irc("Added {$newGroups} new groupIDs");
}
if ($newItems > 0) {
    Log::irc("Added {$newItems} new typeIDs");
}
function getTypeID($href)
{
    $ex = explode('/', $href);
    return $ex[4];
}
function getGroupID($href)
{
    $ex = explode('/', $href);
    return $ex[5];
}
Example #13
0
        if ($status == 0) {
            $app->redirect('/tickets/');
        } else {
            $app->redirect('.');
        }
        exit;
    }
    if ($reply !== null && $ticket['status'] != 0) {
        $charID = User::getUserId();
        $name = $info['username'];
        $moderator = @$info['moderator'] == true;
        $mdb->insert("tickets", ['parentID' => $id, 'content' => $reply, 'characterID' => $charID, 'dttm' => time(), 'moderator' => $moderator]);
        $mdb->getCollection("tickets")->update(['_id' => new MongoID($id)], ['$set' => ['dttmUpdate' => time()]]);
        $mdb->getCollection("tickets")->update(['_id' => new MongoID($id)], ['$inc' => ['replies' => 1]]);
        if (!$moderator) {
            Log::irc("|g|Ticket response from {$name}|n|: {$fullAddr}/tickets/view/{$id}/");
        }
        if ($moderator && isset($ticket['email']) && strlen($ticket['email']) > 0) {
            Email::send($ticket['email'], "zKillboard Ticket Response", "You have received a response to a ticket you submitted. To view the response, please click {$fullAddr}/tickets/view/{$id}/");
        }
        $app->redirect(".");
        exit;
    } else {
        $message = array('status' => 'error', 'message' => 'No...');
    }
}
$replies = $mdb->find("tickets", ['parentID' => $id], ['dttm' => 1]);
Info::addInfo($ticket);
Info::addInfo($replies);
array_unshift($replies, $ticket);
$app->render('tickets_view.html', array('page' => $id, 'message' => $message, 'ticket' => $ticket, 'replies' => $replies, 'user' => $info));
Example #14
0
<?php

$message = array();
if ($_POST) {
    $tags = Util::getPost('hidden-tags');
    $ticket = Util::getPost('ticket');
    $info = User::getUserInfo();
    $name = $info['username'];
    $email = $info['email'];
    if (isset($name) && isset($email) && isset($tags) && isset($ticket)) {
        $check = Db::query('SELECT * FROM zz_tickets WHERE ticket = :ticket AND email = :email', array(':ticket' => $ticket, ':email' => $email), 0);
        if (!$check) {
            Db::execute('INSERT INTO zz_tickets (userid, name, email, tags, ticket) VALUES (:userid, :name, :email, :tags, :ticket)', array(':userid' => User::getUserID(), ':name' => $name, ':email' => $email, ':tags' => $tags, ':ticket' => $ticket));
            $id = Db::queryField('SELECT id FROM zz_tickets WHERE userid = :userid AND name = :name AND tags = :tags AND ticket = :ticket', 'id', array(':userid' => User::getUserID(), ':name' => $name, ':tags' => $tags, ':ticket' => $ticket));
            global $baseAddr;
            Log::irc("|g|New ticket from {$name}:|n| https://{$baseAddr}/moderator/tickets/{$id}/");
            $subject = 'zKillboard Ticket';
            $message = "{$name}, you can find your ticket here, we will reply to your ticket asap. https://{$baseAddr}/tickets/view/{$id}/";
            Email::send($email, $subject, $message);
            $app->redirect("/tickets/view/{$id}/");
        } else {
            $message = array('type' => 'error', 'message' => 'Ticket already posted');
        }
    } else {
        $message = array('type' => 'error', 'message' => 'Ticket was not posted, there was an error');
    }
}
$tickets = Db::query('SELECT * FROM zz_tickets WHERE userid = :userid ORDER BY datePosted DESC', array(':userid' => User::getUserID()), 0);
foreach ($tickets as $key => $val) {
    if ($val['tags']) {
        $tickets[$key]['tags'] = explode(',', $val['tags']);
Example #15
0
     }
 }
 if (isset($reply)) {
     $name = $info['username'];
     $moderator = $info['moderator'];
     $check = Db::query('SELECT * FROM zz_tickets_replies WHERE reply = :reply AND userid = :userid', array(':reply' => $reply, ':userid' => $info['id']), 0);
     if (!$check) {
         Db::execute('INSERT INTO zz_tickets_replies (userid, belongsTo, name, reply, moderator) VALUES (:userid, :belongsTo, :name, :reply, :moderator)', array(':userid' => $info['id'], ':belongsTo' => $id, ':name' => $name, ':reply' => $reply, ':moderator' => $moderator));
         $tic = Db::query('SELECT name,email FROM zz_tickets WHERE id = :id', array(':id' => $id));
         $ticname = $tic[0]['name'];
         $ticmail = $tic[0]['email'];
         $subject = 'zKillboard Ticket';
         global $baseAddr;
         $message = "{$ticname}, there is a new reply to your ticket from {$name} - https://{$baseAddr}/tickets/view/{$id}/";
         if ($moderator == 0) {
             Log::irc("User replied to ticket: |g|{$name}|n|  https://{$baseAddr}/moderator/tickets/{$id}/");
         }
         if ($moderator != 0) {
             Email::send($ticmail, $subject, $message);
         }
         if (isset($report)) {
             $app->redirect("/moderator/reportedkills/{$id}/");
         }
         $app->redirect("/moderator/tickets/{$id}/");
     }
 }
 if (isset($delete)) {
     if ($delete < 0) {
         Util::deleteKill($delete);
         Db::execute('DELETE FROM zz_tickets WHERE id = :id', array(':id' => $id));
         Db::execute('DELETE FROM zz_tickets_replies WHERE belongsTo = :belongsTo', array(':belongsTo' => $id));
Example #16
0
global $mdb;
global $baseAddr;
$message = array();
if ($_POST) {
    $email = Util::getPost('email');
    $subject = Util::getPost('subject');
    $ticket = Util::getPost('ticket');
    $info = User::getUserInfo();
    $charID = User::getUserId();
    $name = $info['username'];
    if ($charID > 0 && isset($ticket)) {
        $insert = ['subject' => $subject, 'content' => $ticket, 'dttm' => time(), 'parentID' => null, 'email' => $email, 'characterID' => $charID, 'status' => 1];
        $mdb->insert("tickets", $insert);
        $id = $insert['_id'];
        Log::irc("|g|New ticket from {$name}:|n| https://{$baseAddr}//tickets/view/{$id}/");
        $app->redirect("/tickets/view/{$id}/");
        exit;
    } else {
        $message = array('type' => 'error', 'message' => 'Ticket was not posted, there was an error');
    }
}
$info = User::getUserInfo();
if (@$info['moderator'] == true) {
    $open_tickets = $mdb->find("tickets", ['parentID' => null, 'status' => 1], ['dttm' => -1]);
    $closed_tickets = $mdb->find("tickets", ['parentID' => null, 'status' => ['$ne' => 1]], ['dttm' => -1]);
    $tickets = array_merge($open_tickets, $closed_tickets);
} else {
    $tickets = $mdb->find("tickets", ['$and' => [['characterID' => User::getUserID()], ['parentID' => null]]], ['dttm' => -1]);
}
Info::addInfo($tickets);