本文整理汇总了PHP中Log::irc方法的典型用法代码示例。如果您正苦于以下问题:PHP Log::irc方法的具体用法?PHP Log::irc怎么用?PHP Log::irc使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Log
的用法示例。
在下文中一共展示了Log::irc方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: 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}");
}
}
}
示例2: execute
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));
}
}
示例3: execute
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());
}
}
示例4: execute
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");
}
示例5: execute
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=" . $smsUsername . "&password=" . $smsPassword . "&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));
}
}
示例6: apiPercentage
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);
}
示例7: array
$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));
示例8: beSocial
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}");
}
}
示例9: date
<?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.');
}
示例10: recalc
/**
* @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|)");
}
示例11: 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}");
}
}
示例12: MongoDate
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];
}
示例13: 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));
示例14: array
<?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']);
示例15: array
}
}
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));