本文整理汇总了PHP中Info::addInfo方法的典型用法代码示例。如果您正苦于以下问题:PHP Info::addInfo方法的具体用法?PHP Info::addInfo怎么用?PHP Info::addInfo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Info
的用法示例。
在下文中一共展示了Info::addInfo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: elseif
if ($key == 'system') {
$statType = 'solarSystemID';
} elseif ($key == 'ship') {
$statType = 'shipTypeID';
} else {
$statType = "{$key}ID";
}
$statistics = $mdb->findDoc('statistics', ['type' => $statType, 'id' => (int) $id]);
$prevRanks = $mdb->findDoc('ranksProgress', ['cacheTime' => 36000, 'type' => $statType, 'id' => (int) $id], ['date' => 1]);
if ($prevRanks != null && isset($prevRanks['date']->sec)) {
$prevRanks['date'] = date('Y-m-d', $prevRanks['date']->sec);
$statistics['prevRanks'] = $prevRanks;
}
$groups = @$statistics['groups'];
if (is_array($groups) and sizeof($groups) > 0) {
Info::addInfo($groups);
$g = [];
foreach ($groups as $group) {
$g[$group['groupName']] = $group;
}
ksort($g);
// Divide the stats into 4 columns...
$chunkSize = ceil(sizeof($g) / 4);
$statistics['groups'] = array_chunk($g, $chunkSize);
} else {
$statistics['groups'] = null;
}
$months = @$statistics['months'];
// Ensure the months are sorted in descending order
if (is_array($months) && sizeof($months) > 0) {
krsort($months);
示例2: getJson
/**
* Returns json of the kill
*
* @param $killID the ID of the kill
* @return string
*/
public static function getJson($killID)
{
$jsonRaw = Db::queryField("SELECT kill_json FROM zz_killmails WHERE killID = :killID", "kill_json", array(":killID" => $killID));
$decoded = json_decode($jsonRaw, true);
$killarray = Info::addInfo($decoded);
return json_encode($killarray);
}
示例3: array
$entities = array();
if ($_POST) {
$app->redirect('/search/' . urlencode($_POST['searchbox']) . '/');
}
if ($search) {
$result = Info::findEntity($search);
// if there is only one result, we redirect.
if (count($result) == 1) {
$type = str_replace('ID', '', $result[0]['type']);
$values = array_values($result[0]);
$id = $result[0]['id'];
$app->redirect("/{$type}/{$id}/");
die;
}
$entities = [];
foreach ($result as $row) {
$entity = [];
$entity['type'] = str_replace('ID', '', $row['type']);
$entity[$row['type']] = $row['id'];
$entity[$entity['type'] . 'Name'] = $row['name'];
if ($entity['type'] == 'type') {
$entity['type'] = 'item';
}
if ($entity['type'] == 'solarSystem') {
$entity['type'] = 'system';
}
$entities[] = $entity;
}
Info::addInfo($entities);
}
$app->render('search.html', array('data' => $entities));
示例4: getTop
/**
* @param string $groupByColumn
*/
public static function getTop($groupByColumn, $parameters = array())
{
global $mdb, $debug, $longQueryMS;
$hashKey = "Stats::getTop:{$groupByColumn}:" . serialize($parameters);
$result = RedisCache::get($hashKey);
if ($result != null) {
return $result;
}
if (isset($parameters['pastSeconds'])) {
$killmails = $mdb->getCollection('oneWeek');
if ($parameters['pastSeconds'] >= 604800) {
unset($parameters['pastSeconds']);
}
} else {
$killmails = $mdb->getCollection('killmails');
}
$query = MongoFilter::buildQuery($parameters);
if (!$mdb->exists('killmails', $query)) {
return [];
}
$andQuery = MongoFilter::buildQuery($parameters, false);
if ($groupByColumn == 'solarSystemID' || $groupByColumn == 'regionID') {
$keyField = "system.{$groupByColumn}";
} else {
$keyField = "involved.{$groupByColumn}";
}
$id = $type = null;
if ($groupByColumn != 'solarSystemID' && $groupByColumn != 'regionID') {
foreach ($parameters as $k => $v) {
if (strpos($k, 'ID') === false) {
continue;
}
if (!is_array($v) || sizeof($v) < 1) {
continue;
}
$id = $v[0];
if ($k != 'solarSystemID' && $k != 'regionID') {
$type = "involved.{$k}";
} else {
$type = "system.{$k}";
}
}
}
$timer = new Timer();
$pipeline = [];
$pipeline[] = ['$match' => $query];
if ($groupByColumn != 'solarSystemID' && $groupByColumn != 'regionID') {
$pipeline[] = ['$unwind' => '$involved'];
}
if ($type != null && $id != null) {
$pipeline[] = ['$match' => [$type => $id, 'involved.isVictim' => false]];
}
$pipeline[] = ['$match' => [$keyField => ['$ne' => null]]];
$pipeline[] = ['$match' => $andQuery];
$pipeline[] = ['$group' => ['_id' => ['killID' => '$killID', $groupByColumn => '$' . $keyField]]];
$pipeline[] = ['$group' => ['_id' => '$_id.' . $groupByColumn, 'kills' => ['$sum' => 1]]];
$pipeline[] = ['$sort' => ['kills' => -1]];
if (!isset($parameters['nolimit'])) {
$pipeline[] = ['$limit' => 10];
}
$pipeline[] = ['$project' => [$groupByColumn => '$_id', 'kills' => 1, '_id' => 0]];
if (!$debug) {
MongoCursor::$timeout = -1;
}
$result = $killmails->aggregateCursor($pipeline);
$result = iterator_to_array($result);
$time = $timer->stop();
if ($time > $longQueryMS) {
Log::log("Aggregate Long query ({$time}ms): {$hashKey}");
}
Info::addInfo($result);
RedisCache::set($hashKey, $result, 3600);
return $result;
}
示例5: execute
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}");
}
}
}
示例6: getRanks
public static function getRanks($type, $rankType, $recent)
{
$table = $recent == true ? 'zz_ranks' : 'zz_ranks_recent';
switch ($rankType) {
case 'shipsDestroyed':
$valueColumn = 'shipsDestroyed';
$rankColumn = 'sdRank';
break;
case 'pointsDestroyed':
$valueColumn = 'pointsDestroyed';
$rankColumn = 'pdRank';
break;
case 'iskDestroyed':
$valueColumn = 'iskDestroyed';
$rankColumn = 'idRank';
break;
case 'overallRank':
$valueColumn = 'overallRank';
$rankColumn = 'overallRank';
break;
default:
throw new Exception("Unknown rankType passed to getRanks: {$rankType}");
}
switch ($type) {
case 'pilot':
$idColumn = 'characterID';
break;
case 'corp':
$idColumn = 'corporationID';
break;
case 'alli':
$idColumn = 'allianceID';
break;
case 'faction':
$idColumn = 'factionID';
break;
case 'ship':
$idColumn = 'shipTypeID';
break;
case 'group':
$idColumn = 'groupID';
break;
case 'system':
$idColumn = 'solarSystemID';
break;
case 'region':
$idColumn = 'regionID';
break;
default:
throw new Exception("Unknown type passed to getRanks: {$type}");
}
$result = Db::query("select typeID {$idColumn}, {$rankColumn} rank, {$valueColumn} kills from {$table} where type = '{$type}' order by {$rankColumn} limit 10");
Info::addInfo($result);
return $result;
}
示例7: beSocial
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}");
}
}
示例8: processAPI
/**
* @param \Pheal\Core\Result $data
* @param mixed $db
* @return int
*/
private static function processAPI($data, $db)
{
$count = 0;
foreach ($data->kills as $kill) {
if ($kill->killID > 0) {
$killID = $kill->killID;
} else {
$killID = $kill->killInternalID * -1;
}
if ($killID == 0) {
continue;
}
$killArray = $kill->toArray();
// Remove all the unwanted crud that EDK sets
unset($killArray["killInternalID"]);
unset($killArray["hash"]);
unset($killArray["trust"]);
// If the killID is below zero, we'll just replace the killID in the array with the minus one..
if ($killID < 0) {
$killArray["killID"] = $killID;
}
$json = json_encode($killArray);
$hash = Util::getKillHash(null, $kill);
$source = "EDK Feed Fetch";
$mKillID = $db->queryField("select killID from zz_killmails where killID < 0 and processed = 1 and hash = :hash", "killID", array(":hash" => $hash), 0);
if ($mKillID) {
Kills::cleanDupe($mKillID, $killID);
}
// If the killID is negative at this point, we need to create a raw mail, and use that to insert it into the zz_manual_mails table, so we can get a manual mail id
if ($killID < 0) {
$rawText = Kills::getRawMail(null, Info::addInfo($killArray));
$db->execute("INSERT IGNORE INTO zz_manual_mails (hash, rawText) VALUES (:hash, :rawText)", array(":hash" => $hash, ":rawText" => $rawText));
$killID = $db->queryField("SELECT mKillID FROM zz_manual_mails WHERE hash = :hash ORDER BY mKillID DESC LIMIT 1", array(":hash" => $hash), 0);
}
$added = $db->execute("insert ignore into zz_killmails (killID, hash, source, kill_json) values (:killID, :hash, :source, :json)", array(":killID" => $killID, ":hash" => $hash, ":source" => $source, ":json" => $json));
$count += $added;
}
return $count;
}
示例9: getSupers
public static function getSupers($key, $id)
{
$data = array();
$parameters = [$key => (int) $id, 'groupID' => 30, 'isVictim' => false, 'pastSeconds' => 86400 * 90, 'nolimit' => true];
$data['titans']['data'] = Stats::getTop('characterID', $parameters);
$data['titans']['title'] = 'Titans';
$parameters = [$key => (int) $id, 'groupID' => 659, 'isVictim' => false, 'pastSeconds' => 86400 * 90, 'nolimit' => true];
$data['supercarriers']['data'] = Stats::getTop('characterID', $parameters);
$data['supercarriers']['title'] = 'Supercarriers';
Info::addInfo($data);
return $data;
}
示例10: header
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
if (!is_numeric($id)) {
$id = Info::getItemId($id);
if ($id > 0) {
header("Location: /item/{$id}/");
} else {
header("Location: /");
}
die;
}
$info = Db::queryRow("select typeID, typeName, description from ccp_invTypes where typeID = :id", array(":id" => $id), 3600);
$info["description"] = str_replace("<br>", "\n", $info["description"]);
$info["description"] = strip_tags($info["description"]);
$hasKills = 1 == Db::queryField("select 1 as hasKills from zz_participants where shipTypeID = :id limit 1", "hasKills", array(":id" => $id), 3600);
$buyOrders = Db::query("select * from zz_marketdata where typeID = :typeID and bid = 1 order by price desc limit 10", array(":typeID" => $id));
$sellOrders = Db::query("select * from zz_marketdata where typeID = :typeID and bid = 0 order by price asc limit 10", array(":typeID" => $id));
$info["attributes"] = Db::query("SELECT categoryName, coalesce(displayName, attributeName) attributeName, coalesce(valueint,valuefloat) value FROM ccp_invTypes JOIN ccp_dgmTypeAttributes ON (ccp_invTypes.typeid = ccp_dgmTypeAttributes.typeid) JOIN ccp_dgmAttributeTypes ON (ccp_dgmTypeAttributes.attributeid = ccp_dgmAttributeTypes.attributeid) LEFT JOIN ccp_dgmAttributeCategories ON (ccp_dgmAttributeTypes.categoryid=ccp_dgmAttributeCategories.categoryid) WHERE ccp_invTypes.typeid = :typeID and ccp_dgmAttributeCategories.categoryid is not null and displayName is not null and ccp_dgmAttributeTypes.categoryID not in (8,9) ORDER BY ccp_dgmAttributeCategories.categoryid, ccp_dgmAttributeTypes.attributeid", array(":typeID" => $id));
Info::addInfo($buyOrders);
Info::addInfo($sellOrders);
$app->render("item.html", array("info" => $info, "hasKills" => $hasKills, "buyOrders" => $buyOrders, "sellOrders" => $sellOrders));
示例11: time
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));
示例12:
<?php
global $mdb;
$battles = $mdb->find("battles", [], ['battleID' => -1], 50);
Info::addInfo($battles);
$app->render('battles.html', ['battles' => $battles]);
示例13: addInfo
/**
* @param array $array
* @param array $killHash
* @return array
*/
private static function addInfo($array, $killHash)
{
$results = array();
foreach ($array as $hash => $kill) {
$split = explode("|", $hash);
$row = array();
$row["shipTypeID"] = $split[0];
$row["corporationID"] = $split[1];
$row["characterID"] = $split[2];
$row["allianceID"] = $split[3];
$row["destroyed"] = in_array($hash, array_keys($killHash)) ? $killHash[$hash]["kill"]["victim"]["killID"] : 0;
$podHash = "670|" . $row["corporationID"] . "|" . $row["characterID"] . "|" . $row["allianceID"];
$row["podded"] = in_array($podHash, $killHash) ? 1 : 0;
Info::addInfo($row);
$results[] = $row;
}
return $results;
}
示例14: getCharacters
/**
* Returns an array of the characters assigned to this user.
*
* @static
*
* @param $userID int
*
* @return array
*/
public static function getCharacters($userID)
{
$result = self::getCharacterKeys($userID);
Info::addInfo($result);
return $result;
}
示例15: header
global $mdb;
if (!is_numeric($id)) {
$id = Info::getItemId($id);
if ($id > 0) {
header("Location: /item/{$id}/");
} else {
header('Location: /');
}
die;
}
$info = $mdb->findDoc("information", ['type' => 'typeID', 'id' => (int) $id, 'cacheTime' => 3600]);
$info['typeName'] = $info['name'];
$info['description'] = str_replace('<br>', "\n", @$info['description']);
$info['description'] = strip_tags(@$info['description']);
$info['price'] = Price::getItemPrice($id, date('Ymd'));
global $mdb;
$cursor = $mdb->getCollection('killmails')->find(['involved.shipTypeID' => (int) $id]);
$hasKills = $cursor->hasNext();
$info['attributes'] = array();
$info['market'] = Db::query('select * from zz_item_price_lookup where typeID = :typeID order by priceDate desc limit 30', array(':typeID' => $id));
$kills = $mdb->find('itemmails', ['typeID' => (int) $id], ['killID' => -1], 50);
$victims = [];
foreach ($kills as $row) {
$kill = $mdb->findDoc('killmails', ['killID' => $row['killID']]);
$victim = $kill['involved'][0];
$victim['destroyed'] = $row['killID'];
$victims[] = $victim;
}
Info::addInfo($victims);
$app->render('item.html', array('info' => $info, 'hasKills' => $hasKills, 'kills' => $victims));