本文整理汇总了PHP中Info类的典型用法代码示例。如果您正苦于以下问题:PHP Info类的具体用法?PHP Info怎么用?PHP Info使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Info类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: AddInfo
/**
* Adds an info to the 'global' Info-array, or outputs it to STDOUT.
* @param Info $InInfo
*/
public static function AddInfo($InInfo)
{
global $argv, $argc;
if (isset($argv) && $argc > 0) {
fwrite(STDOUT, html_entity_decode($InInfo->getInfoMessage(), ENT_COMPAT, 'UTF-8') . "\n");
} else {
$Infos = unserialize($_SESSION['Infos']);
$Infos[] = $InInfo;
$_SESSION['Infos'] = serialize($Infos);
}
}
示例2: render
/**
* Renderize the view.
*
* @return null
*/
public function render(Info $info)
{
?>
<p>
<?php
echo REQUIRED_FIELDS_TEXT;
?>
</p>
<form action="<?php
echo $this->generateURL('info', 'edit', $info->getIdInfo());
?>
" method="post">
<fieldset>
<div class="row">
<div class="col-md-6">
<div>
<label for="title">
Título <small>(*)</small>
</label>
<input name="title" type="text" required value="<?php
echo $info->getTitle();
?>
" />
</div>
</div>
<div class="col-md-6">
<div>
<input type="submit" value="Modificar" />
</div>
</div>
</div>
</fieldset>
</form>
<?php
}
示例3: dashboard
function dashboard()
{
// content_count visits_count block_count replies_count os_ver server_ip webserver domain_name
$table = "(select (SELECT COUNT(1) FROM content) content_count,(SELECT sum(visits) FROM content) visits_count,(SELECT COUNT(1) FROM block) block_count,(SELECT COUNT(1) FROM replies) replies_count from dual) tmp";
$model = new BaseModel();
$sys_info = $model->getRecord($table);
$info = new Info();
$serv_info = $info->get_server_info();
$obj = array_merge($sys_info, $serv_info);
$obj['yips'] = $this->getYIPs();
$obj['ips'] = $this->getIPs();
$obj['tips'] = $this->getTotIPs();
require 'view/admin/dashboard.php';
}
示例4: create
public function create($data)
{
$sellerID = $this->sellerInfo->getId();
$ticketData = ['ticketTerms' => (array) $data->terms->{$sellerID}, 'totalDuration' => $data->total_duration, 'segmentDurations' => $data->segment_durations, 'stopsAirports' => $data->stops_airports, 'maxStops' => $data->max_stops, 'minStopDuration' => $data->min_stop_duration, 'maxStopDuration' => $data->max_stop_duration, 'isDirect' => $data->is_direct, 'carriers' => (array) $data->carriers, 'segments' => []];
$segmentsAirports = (array) $data->segments_airports;
$ticketData['segmentsAirports'] = (array) $segmentsAirports[0];
$segmentsTime = (array) $data->segments_time;
$ticketData['segmentsTime'] = (array) $segmentsTime[0];
$segments = (array) $data->segment[0]->flight;
foreach ($segments as $segment) {
$ticketData['segments'][] = (array) $segment;
}
$ticket = new Ticket($ticketData);
return $ticket;
}
示例5: uptime
public static function uptime()
{
if ($uptime = Info::proc('uptime')) {
$days = floor($uptime / 60 / 60 / 24);
$hours = $uptime / 60 / 60 % 24;
$mins = $uptime / 60 % 60;
$secs = $uptime % 60;
$time = '';
if ($days > 0) {
$time .= __(':days days', [':days' => $days]) . ' ';
}
if ($hours > 0) {
$time .= __(':hours hours', [':hours' => $hours]) . ' ';
}
if ($mins > 0) {
$time .= __(':mins mins', [':mins' => $mins]) . ' ';
}
if ($secs > 0) {
$time .= __(':secs secs', [':secs' => $secs]);
}
return $time;
} else {
return null;
}
}
示例6: getWarInfo
public static function getWarInfo($warID)
{
global $mdb;
$warInfo = array();
if ($warID == null) {
return $warInfo;
}
$warInfo = $mdb->findDoc('information', ['type' => 'warID', 'id' => $warID]);
if (!isset($warInfo['aggressor'])) {
return [];
}
$warInfo['warID'] = $warID;
$agr = $warInfo['aggressor']['id'];
$agrIsAlliance = self::isAlliance($agr);
$agrName = $agrIsAlliance ? Info::getInfoField('allianceID', $agr, 'name') : Info::getInfoField('corporationID', $agr, 'name');
$warInfo['agrName'] = $agrName;
$warInfo['agrLink'] = ($agrIsAlliance ? '/alliance/' : '/corporation/') . "{$agr}/";
$dfd = $warInfo['defender']['id'];
$dfdIsAlliance = self::isAlliance($dfd);
$dfdName = $dfdIsAlliance ? Info::getInfoField('allianceID', $dfd, 'name') : Info::getInfoField('corporationID', $dfd, 'name');
$warInfo['dfdName'] = $dfdName;
$warInfo['dfdLink'] = ($dfdIsAlliance ? '/alliance/' : '/corporation/') . "{$dfd}/";
$warInfo['dscr'] = "{$agrName} vs {$dfdName}";
return $warInfo;
}
示例7: getNfoFromNZB
/**
* Look for an .nfo file in the NZB, return the NFO message id.
* Gets the NZB completion.
* Looks for PAR2 files in the NZB.
*
* @param string $guid
* @param string $relID
* @param int $groupID
* @param string $groupName
*
* @return bool
*
* @access public
*/
public function getNfoFromNZB($guid, $relID, $groupID, $groupName)
{
$fetchedBinary = false;
$messageID = $this->parseNZB($guid, $relID, $groupID, true);
if ($messageID !== false) {
$fetchedBinary = $this->nntp->getMessages($groupName, $messageID['id'], $this->alternateNNTP);
if ($this->nntp->isError($fetchedBinary)) {
// NFO download failed, increment attempts.
$this->pdo->queryExec(sprintf('UPDATE releases SET nfostatus = nfostatus - 1 WHERE id = %d', $relID));
if ($this->echooutput) {
echo 'f';
}
return false;
}
if ($this->nfo->isNFO($fetchedBinary, $guid) === true) {
if ($this->echooutput) {
echo $messageID['hidden'] === false ? '+' : '*';
}
} else {
if ($this->echooutput) {
echo '-';
}
$this->pdo->queryExec(sprintf('UPDATE releases SET nfostatus = %d WHERE id = %d', Info::NFO_NONFO, $relID));
$fetchedBinary = false;
}
} else {
if ($this->echooutput) {
echo '-';
}
$this->pdo->queryExec(sprintf('UPDATE releases SET nfostatus = %d WHERE id = %d', Info::NFO_NONFO, $relID));
}
return $fetchedBinary;
}
示例8: upload
/**
* Call move() method for each given file
* @return array of filenames that were uploaded
*/
protected function upload()
{
$input = $this->input;
// if $_FILES array contains fields with multiple attribute
if (Info::getArrayDepth($input) === 3) {
foreach ($input as $field => $filebatch) {
// if current field allows for MULTIPLE files upload
if (Info::getArrayDepth($filebatch) === 2) {
foreach ($filebatch as $file => $contents) {
$this->move($contents);
}
// if current field allows for only SINGLE file upload
} else {
$contents = $filebatch;
$this->move($contents);
}
}
// if $_FILES array doesn't contain fields with multiple attribute at all
} else {
foreach ($input as $field => $contents) {
$this->move($contents);
}
}
return $this->results;
}
示例9: validKill
function validKill(&$kill)
{
// Show all pod kills
$victimShipID = $kill['victim']['shipType']['id'];
if ($victimShipID == 670 || $victimShipID == 33328) {
return true;
}
$npcOnly = true;
foreach ($kill['attackers'] as $attacker) {
if (isset($attacker['shipType']['id'])) {
$attackerGroupID = Info::getGroupID($attacker['shipType']['id']);
if ($attackerGroupID == 365) {
return true;
}
// A tower is involved
if ($attackerGroupID == 99) {
return true;
}
// A sentry gun is involved
}
if (isset($attacker['shipType']['id']) && $attacker['shipType']['id'] == 34495) {
return true;
}
// A drifter is involved
// Don't process the kill if it's NPC only
if (isset($attacker['corporation']['id']) && $attacker['corporation']['id'] == 1000125) {
return true;
}
$npcOnly &= @$attacker['character']['id'] == 0 && (@$attacker['corporation']['id'] < 1999999 && @$attacker['corporation']['id'] != 1000125);
}
return !$npcOnly;
}
示例10: actionIndex
public function actionIndex()
{
if (Yii::app()->user->isGuest) {
$this->redirect(Yii::app()->homeUrl);
}
$this->pageTitle = Yii::t('title', 'Userbar creation');
$image = null;
$model = new UserbarForm();
if (isset($_POST['UserbarForm'])) {
$model->attributes = $_POST['UserbarForm'];
if ($model->validate()) {
$criteria = new CDbCriteria();
$criteria->select = 'id, name, exp, gender, race, player_class';
$player = Players::model()->with('abyssRank', 'lifeStats')->findByPK($model->player_id);
$criteria = new CDbCriteria();
$criteria->select = 'name';
$legion = Legions::model()->with(array('legionMembers' => array('joinType' => 'INNER JOIN', 'condition' => 'player_id = ' . $model->player_id)))->find();
if ($legion == NULL) {
$legion->name = null;
}
Yii::app()->ih->load($_SERVER['DOCUMENT_ROOT'] . Yii::app()->baseUrl . '/images/userbars/ub' . $model->fon . '.png')->text($player->name, Yii::app()->basePath . '/fonts/romic.ttf', 14, $this->rgb($model->shadow), CImageHandler::CORNER_LEFT_TOP, 8, 8)->text($player->name, Yii::app()->basePath . '/fonts/romic.ttf', 14, $this->rgb($model->name), CImageHandler::CORNER_LEFT_TOP, 8, 7)->text($legion->name, Yii::app()->basePath . '/fonts/monaco.ttf', 10, $this->rgb($model->shadow), CImageHandler::CORNER_LEFT_TOP, 8, 36)->text($legion->name, Yii::app()->basePath . '/fonts/monaco.ttf', 10, $this->rgb($model->legion), CImageHandler::CORNER_LEFT_TOP, 8, 35)->text(Info::class_text($player->player_class) . ', ' . $this->genderRace($player->gender, $player->race), Yii::app()->basePath . '/fonts/verdana.ttf', 8, $this->rgb($model->shadow), CImageHandler::CORNER_LEFT_BOTTOM, 8, 9)->text(Info::class_text($player->player_class) . ', ' . $this->genderRace($player->gender, $player->race), Yii::app()->basePath . '/fonts/verdana.ttf', 8, $this->rgb($model->class_race), CImageHandler::CORNER_LEFT_BOTTOM, 8, 10)->text(Info::lvl($player->exp) . ' Level', Yii::app()->basePath . '/fonts/romic.ttf', 14, $this->rgb($model->shadow), CImageHandler::CORNER_RIGHT_TOP, 8, 6)->text(Info::lvl($player->exp) . ' Level', Yii::app()->basePath . '/fonts/romic.ttf', 14, $this->rgb($model->level), CImageHandler::CORNER_RIGHT_TOP, 8, 5)->text($player->abyssRank->all_kill . '/' . $player->abyssRank->weekly_kill . ' Kills', Yii::app()->basePath . '/fonts/monaco.ttf', 10, $this->rgb($model->shadow), CImageHandler::CORNER_RIGHT_TOP, 8, 34)->text($player->abyssRank->all_kill . '/' . $player->abyssRank->weekly_kill . ' Kills', Yii::app()->basePath . '/fonts/monaco.ttf', 10, $this->rgb($model->kills), CImageHandler::CORNER_RIGHT_TOP, 8, 33)->text($player->lifeStats->hp . ' HP, ' . $player->lifeStats->mp . ' MP', Yii::app()->basePath . '/fonts/verdana.ttf', 8, $this->rgb($model->shadow), CImageHandler::CORNER_RIGHT_BOTTOM, 8, 9)->text($player->lifeStats->hp . ' HP, ' . $player->lifeStats->mp . ' MP', Yii::app()->basePath . '/fonts/verdana.ttf', 8, $this->rgb($model->stats), CImageHandler::CORNER_RIGHT_BOTTOM, 8, 10)->save($_SERVER['DOCUMENT_ROOT'] . Yii::app()->baseUrl . '/userbars/' . $model->player_id . '.png');
$image = Yii::app()->homeUrl . 'userbars/' . $model->player_id . '.png';
}
}
$this->render('/userbar', array('model' => $model, 'players' => Players::getPlayers(), 'image' => $image));
}
示例11: 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}");
}
}
}
示例12: __construct
/**
* @param Index $index
*/
public function __construct(Index $index)
{
$this->index = $index;
$this->filename = $index->getInfo()->getDictFilename();
$this->isCompressed = Info::isCompressedFile($this->filename);
$this->open();
}
示例13: HtmlHeader
/**
* Generate a HTML header, containing DOCTYPE, head- and meta-tags, JavaScript-includes and title.
* @param string $Title
* @param User $CurrentUser
* @return string
*/
public static function HtmlHeader($Title = NULL, $CurrentUser = NULL)
{
global $lang;
$Output = sprintf("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n\t\t<html xmlns=\"http://www.w3.org/1999/xhtml\">\n\n\t\t<head>\n\t\t<meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\" />\n\t\t<meta name=\"language\" content=\"%5\$s\" />\n\t\t<meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\" />\n\t\t\n\t\t<link rel=\"stylesheet\" type=\"text/css\" href=\"style.css\" title=\"CandyDoll DB\" />\n\t\t<link rel=\"shortcut icon\" href=\"favicon.ico\" />\n\t\t<link rel=\"icon\" href=\"favicon.ico\" />\n\t\t\n\t\t<script type=\"text/javascript\" src=\"js/jquery.min.js\"></script>\n\t\t<script type=\"text/javascript\" src=\"js/jquery.ba-outside-events.js\"></script>\n\t\t<script type=\"text/javascript\">\n\t\t\t//<![CDATA[\n\t\t\t\tvar ColorBoxI18N = {\n\t\t\t\t\tcurrent: '%6\$s',\n\t\t\t\t\tprevious: '%7\$s',\n\t\t\t\t\tnext: '%8\$s',\n\t\t\t\t\tclose: '%9\$s'\n\t\t\t\t};\n\t\t\t\tvar CacheDeletePermission = %11\$s;\n\t\t\t//]]>\n\t\t</script>\n\t\t<script type=\"text/javascript\" src=\"js/candydolldb.js\"></script>\n\n\t\t<title>CandyDoll DB v%1\$s%2\$s</title>\n\t\t</head>\n\n\t\t<body>\n\t\t\n\t\t<h1 class=\"Hidden\">CandyDollDB v%1\$s%2\$s</h1>\n\t\t%3\$s\n\t\t%10\$s\n\t\t\n\t\t<div id=\"Wrapper\">\n\t\t<div id=\"Header\">\n\t\t</div>\n\t\t\n\t\t<div id=\"ContentBG\">\n\t\t<div id=\"Content\">", CANDYDOLLDB_VERSION, $Title ? ' :: ' . htmlentities($Title) : NULL, Error::GenerateErrorList(), isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off' ? 'https' : 'http', $CurrentUser != NULL ? $CurrentUser->getLanguage() : 'en', $lang->g('LabelColorBoxCurrent'), $lang->g('LabelColorBoxPrevious'), $lang->g('LabelColorBoxNext'), $lang->g('LabelColorBoxClose'), Info::GenerateInfoList(), !is_null($CurrentUser) && $CurrentUser->hasPermission(RIGHT_CACHE_DELETE) ? 'true' : 'false');
if ($CurrentUser != NULL) {
$Output .= sprintf("\n\t\t\t<ul id=\"TopNavigation\">\n\t\t\t<li><a href=\"index.php\">%2\$s</a></li>\n\t\t\t<li><a href=\"#\">%3\$s</a>\n\t\t\n\t\t\t\t<ul>\n\t\t\t\t<li><a href=\"%15\$s\">%4\$s</a></li>\n\t\t\t\t<li><a href=\"%16\$s\">%5\$s</a></li>\n\t\t\t\t<li><a href=\"tag.php\">%6\$s</a></li>\n\t\t\t\t<li><a href=\"admin_panel.php\">%7\$s</a></li>\n\t\t\t\t<li><a href=\"%17\$s\">%8\$s</a></li>\n\t\t\t\t</ul>\n\t\t\n\t\t\t</li>\n\t\t\t<li><a href=\"user.php\">%9\$s</a>\n\t\t\t\n\t\t\t\t<ul>\n\t\t\t\t<li><a href=\"user_view.php?user_id=%1\$d\">%10\$s</a></li>\n\t\t\t\t</ul>\n\t\t\t\n\t\t\t</li>\n\t\t\t<li><a href=\"#\">%11\$s</a>\n\t\t\t\t\n\t\t\t\t<ul>\n\t\t\t\t<li><a href=\"%18\$s\">%12\$s</a></li>\n\t\t\t\t<li><a href=\"%19\$s\">%13\$s</a></li>\n\t\t\t\t</ul>\t\n\t\t\t\n\t\t\t</li>\n\t\t\t<li><a href=\"logout.php\">%14\$s</a></li>\n\t\t\t</ul>", $CurrentUser->getID(), $lang->g('NavigationHome'), $lang->g('NavigationFeatures'), $lang->g('NavigationImportXML'), $lang->g('NavigationNewModel'), $lang->g('NavigationManageTags'), $lang->g('NavigationAdminPanel'), $lang->g('NavigationMultiDownload'), $lang->g('NavigationUsers'), $lang->g('NavigationMyAccount'), $lang->g('NavigationSearch'), $lang->g('NavigationTagSearch'), $lang->g('NavigationDirtySets'), $lang->g('NavigationLogOut'), $CurrentUser->hasPermission(RIGHT_IMPORT_XML) ? 'import_xml.php' : '#', $CurrentUser->hasPermission(RIGHT_MODEL_ADD) ? 'model_view.php' : '#', $CurrentUser->hasPermission(RIGHT_EXPORT_ZIP_MULTI) ? 'download_multi.php' : '#', $CurrentUser->hasPermission(RIGHT_SEARCH_TAGS) ? 'search.php?q=' : '#', $CurrentUser->hasPermission(RIGHT_SEARCH_DIRTY) ? 'set_dirty.php' : '#');
}
return $Output;
}
示例14: readFromStatusFile
/**
* Read Nagios status from Nagios's status.dat file
* @return {boolean} Returns TRUE if we file could be opened and
* read, FALSE otherwise
*/
public function readFromStatusFile($path)
{
$handle = fopen($path, 'r', FALSE);
if ($handle === FALSE) {
return FALSE;
}
while ($line = StatusBase::readLine($handle)) {
switch ($line) {
case 'contactstatus {':
$c = new ContactStatus();
$c->readFromHandle($handle);
$this->contacts[$c->contact_name] = $c;
break;
case 'hoststatus {':
$host = new HostStatus();
$host->readFromHandle($handle);
$this->hosts[$host->host_name] = $host;
break;
case 'info {':
$i = new Info();
$i->readFromHandle($handle);
// FIXME: Use this for something
break;
case 'programstatus {':
$p = new ProgramStatus();
$p->readFromHandle($handle);
// FIXME: Use this for something
break;
case 'servicestatus {':
$service = new ServiceStatus();
$service->readFromHandle($handle);
$this->services[] = $service;
// Add the host to the ServiceStatus class
$service->host = $this->hosts[$service->host_name];
// Add the service to the "parent" HostStatus class
$this->hosts[$service->host_name]->services[] = $service;
break;
default:
break;
}
}
fclose($handle);
return TRUE;
}
示例15: 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;
}