本文整理汇总了PHP中game::format_number方法的典型用法代码示例。如果您正苦于以下问题:PHP game::format_number方法的具体用法?PHP game::format_number怎么用?PHP game::format_number使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类game
的用法示例。
在下文中一共展示了game::format_number方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: format_size
function format_size($bytes)
{
// GB
if ($bytes >= 1073741824) {
return game::format_number(round($bytes / 1073741824, 3), 3) . " GB";
}
// MB
if ($bytes >= 1048576) {
return game::format_number(round($bytes / 1048576, 2), 2) . " MB";
}
// KB
if ($bytes >= 1024) {
return game::format_number(round($bytes / 1024, 2), 2) . " KB";
}
// bytes
return $bytes . " bytes";
}
示例2: show_messages
/**
* Vis meldinger
*/
protected function show_messages()
{
// hent meldinger
$pagei = new pagei(pagei::ACTIVE_GET, "side", pagei::PER_PAGE, login::data_get("innboks_per_side", 15));
$meldinger = $this->inbox->get_messages($pagei, $this->show_deleted);
$this->css();
echo '
<div style="margin-top: 1em; font-size: 15px">
<h1' . ($pagei->active > 1 && ($show_deleted = false ? ' id="scroll_here"' : '')) . ' style="float: left; margin-top: 0">Meldinger</h1>
<p class="h_right" style="margin: 10px 0 0 0 !important">
<a href="innboks_ny">Opprett ny melding</a>' . ($pagei->total > 0 ? '
<a href="' . htmlspecialchars($this->addr(null, null, "innboks_sok")) . '">Søk</a>' : '') . '
</p>
</div>';
// ingen meldinger å vise?
if (!$meldinger) {
echo '
<p class="clear">Du har ingen meldinger i din innboks eller utboks.</p>
<p>Så fort du sender eller mottar en melding vil den komme opp på denne siden.</p>';
} else {
$this->js();
// flere sider?
if ($pagei->pages > 1) {
echo '
<p class="c" style="margin: 25px auto 10px; width: 250px">' . $pagei->pagenumbers() . '</p>';
}
echo '
<form action="" method="post">
<table class="table clear" width="100%" id="meldinger">
<thead>
<tr>
<th>Emne (<a href="#" class="box_handle_toggle" rel="it_id[]">Merk alle</a>)</th>
<th><abbr title="Antall meldinger i meldingstråden">Ant.</abbr></th>
<th><abbr title="Antall deltakere utenom deg selv">De.</abbr></th>
<th>Siste</th>
<th class="nowrap" colspan="1">Tid siste (<a id="skift_tid">veksle</a>)</th>
</tr>
</thead>
<tbody>';
$i = 0;
$c = access::has("crewet");
foreach ($meldinger as $row) {
$o = $row['up_prev_other'] ? '<user id="' . $row['up_prev_other']['im_up_id'] . '" /> <span class="im_utg">(utgående)</span>' : ($row['up_prev'] && !$row['up_prev'][0] ? '<user id="' . $row['up_prev'][1] . '" />' : (count($row['receivers']) > 1 ? '<user id="' . $row['receivers'][0]['ir_up_id'] . '" /> <span class="im_utg">(utgående)</span>' : '<span class="dark">Ingen</span>'));
// låst?
// TODO: Skal ikke tråden se ut som den er låst når man er i crewet? Man har uansett mulighet til å svare når man går inn i tråden
$locked = false;
if (!$row['receivers_ok']) {
$locked = true;
} elseif ($row['ir_up_id'] != $this->inbox->u->player->id || !$this->inbox->u->player->active && !$row['receivers_crew']) {
$locked = true;
}
echo '
<tr class="box_handle' . ($row['ir_unread'] > 0 ? ' not_viewed' : (++$i % 2 == 0 ? ' color' : '')) . '">
<td class="it_e">
<input type="checkbox" name="it_id[]" value="' . $row['it_id'] . '" />
<a href="innboks_les?id=' . $row['it_id'] . '" class="it_a">
<span class="it_t_w">
<span class="it_t">' . htmlspecialchars($row['it_title']) . '</span>' . ($row['ir_unread'] == 1 ? ' <span class="ny">(Ny!)</span>' : ($row['ir_unread'] > 1 ? ' <span class="ny">(' . $row['ir_unread'] . ' nye!)</span>' : '')) . ($row['ir_deleted'] != 0 ? ' <span class="slettet">(Slettet)</span>' : '') . ($locked ? ' <span class="it_locked">(Låst)</span>' : '') . ($row['ir_marked'] != 0 ? '<span class="ir_marked"> (Til oppfølging)</span>' : '') . '
</span>' . ($row['id_text'] != "" ? '<br />
<span class="id_text_w"><span class="id_text">' . $row['id_text'] . '</span> <span class="id_up">(' . ($row['up_prev'][0] ? 'meg' : '<user id="' . $row['up_prev'][1] . '" nolink />') . ')</span></span>' : '') . '
</a>
</td>
<td class="c">' . game::format_number($row['num_messages']) . '</td>
<td class="c">' . (count($row['receivers']) - 1) . '</td>
<td class="it_u">
' . $o . '
<div class="im_deltakere_det hide" rel="' . $row['it_id'] . ',' . $row['ir_marked'] . '">
<table class="table">
<thead>
<tr>
<th>Spiller</th>
<th>Antall</th>
<th>Uleste</th>' . (access::has("mod") ? '
<th>Vis</th>' : '') . '
<th>Status</th>
</tr>
</thead>
<tbody>';
foreach ($row['receivers'] as $r) {
echo '
<tr>
<td><user id="' . $r['ir_up_id'] . '" /></td>
<td class="r">' . $r['num_messages'] . '</td>
<td class="r">' . ($r['ir_unread'] > 0 ? '<b>' . $r['ir_unread'] . '</b>' : $r['ir_unread']) . '</td>' . (access::has("mod") ? '
<td>' . $r['ir_views'] . '</td>' : '') . '
<td>' . ($r['up_access_level'] == 0 ? '<span class="dark">Død' . ($c && $r['u_access_level'] != 0 && $r['u_active_up_id'] == $r['ir_up_id'] ? ', men bruker aktiv' : '') . '</span>' : ($r['ir_deleted'] != 0 ? '<span class="dark">Slettet meldingen</span>' : 'Mottar nye meldinger')) . '</td>
</tr>';
}
echo '
</tbody>
</table>
</div>
</td>
<td class="it_dato_w">
<span class="it_dato_f it_dato_hide">' . ess::$b->date->get($row['ir_restrict_im_time'])->format(date::FORMAT_SEC) . '</span>
<span class="it_dato_f">' . game::timespan($row['ir_restrict_im_time'], game::TIME_ABS) . '</span>
</td>
//.........这里部分代码省略.........
示例3: array
</noscript>
</div>
<p>Denne listen viser hvem som har vært aktive i løpet av siste ' . game::timespan($time, game::TIME_FULL) . '</p>
</form>';
// hent brukerne
$result = \Kofradia\DB::get()->query("SELECT up_id, up_name, up_access_level FROM users_players WHERE up_last_online >= " . (time() - $time) . " ORDER BY up_name");
// sett opp alfabetisk liste
$liste = array();
while ($row = $result->fetch()) {
$liste[mb_strtolower(mb_substr($row['up_name'], 0, 1))][] = game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']);
}
echo '
<table class="table tablemb">
<thead>
<tr>
<th colspan="2">Spillere pålogget - ' . game::format_number($result->rowCount()) . ' spiller' . ($result->rowCount() == 1 ? '' : 'e') . '</th>
</tr>
</thead>
<tbody>';
foreach ($liste as $char => $rows) {
echo '
<tr>
<th>' . htmlspecialchars($char) . '</th>
<td>' . implode(", ", $rows) . '</td>
</tr>';
}
echo '
</tbody>
</table>
</div>
</div>';
示例4: array
$result = \Kofradia\DB::get()->query("SELECT lv_up_id, time, won, total_lodd, total_users, type FROM smafia_database.lotto_vinnere WHERE time >= {$first} AND time < {$last} ORDER BY type");
$rounds = array();
// legg i riktig gruppe
while ($row = $result->fetch()) {
$end = ceil(($row['time'] - 900) / 1800) * 1800 + 900;
if (!isset($rounds[$end])) {
$rounds[$end] = array("time" => $end, "total_lodd" => $row['total_lodd'], "total_users" => $row['total_users'], "users" => array());
}
$rounds[$end]['users'][$row['type']] = array($row['lv_up_id'], $row['won']);
}
krsort($rounds);
foreach ($rounds as $round) {
echo '
<div class="section">
<h2>' . $_base->date->get($round['time'])->format() . '</h2>
<p class="h_right">' . game::format_number($round['total_lodd']) . ' lodd, ' . game::format_number($round['total_users']) . ' spiller' . ($round['total_users'] == 1 ? '' : 'e') . '</p>
<dl class="dd_right">';
foreach ($round['users'] as $num => $row) {
echo '
<dt>' . $num . ' - <user id="' . $row[0] . '" /></dt>
<dd>' . game::format_cash($row[1]) . '</dd>';
}
echo '
</dl>
</div>';
}
// vis side
echo '
<p class="c">' . $pagei->pagenumbers() . '</p>';
}
echo '
示例5: handle_data
function handle_data($cid, $line)
{
global $_base;
$this->debug($cid, "Handling data: {$line}");
if (!isset($this->sockets[$cid])) {
$this->debug($cid, "Socket not found. Aborting data check.");
return;
}
#$this->debug($cid, "Data received: " . $line);
$matches = false;
if (preg_match('/^:([^ ]+)\\s+(.+?)\\s+(.+?)(?:\\s+:(.+?))?\\r?$/s', $line, $matches)) {
$from = $matches[1];
$type = $matches[2];
$arg = $matches[3];
$content = isset($matches[4]) ? $matches[4] : '';
$user = $this->nickinfo($from);
switch ($type) {
// nick i bruk
case "433":
$this->handle_error($cid, "Nick is in use..");
return;
// motd innhold
// motd innhold
case "372":
$this->debug($cid, "MOTD: " . $content);
break;
// motd mangler
// motd mangler
case "422":
#$this->debug($cid, "MOTD mangler");
#$this->debug($cid, "MOTD mangler");
case "376":
$this->debug($cid, "MOTD avsluttet");
// sette som den aktive?
if (!$this->connected_cid) {
$this->connected_cid = $cid;
}
// join kanaler
foreach ($this->settings['channels'] as $chan) {
$args = isset($chan[1]) ? " :" . $chan[1] : "";
$this->send_data($cid, "JOIN {$chan[0]}{$args}\n");
}
// oper
if ($this->settings['name'] == "SMAFIA" || $this->settings['name'] == "SMAFIA_BETA") {
$this->send_data($cid, "OPER SMAFIA StreetzMafiaBoten\n");
}
// merk som klar for timers
$this->connected = true;
break;
// invitasjon
// invitasjon
case "INVITE":
$chan = explode(" ", $arg);
if ($chan != "#StreetzMafia" && $chan != "#kofradia") {
break;
}
$this->send_data($cid, "JOIN {$chan[1]}\n");
break;
// meldinger
// meldinger
case "PRIVMSG":
case "NOTICE":
if (($this->settings['name'] == "SMAFIA" || $this->settings['name'] == "SMAFIA_BETA") && $this->irc_info || $this->settings['name'] == "QuakeNet" && $user["nick"] == "henrist" && $user["ident"] == "henrik" && $user["host"] == "hsw.no") {
$match = false;
$log = true;
$break = false;
if (substr($content, 0, 3) == ".r ") {
$this->send_data($cid, "NOTICE {$user['nick']} :Sending raw data..\n");
$this->send_data($cid, substr($content, 3) . "\n");
$break = true;
} elseif ($content == ".vars") {
$this->msg($cid, $arg, "Kofradia Announcer - Loglimit: {$this->loglimit} - Skiptime: " . game::format_number($this->select_delay / 1000, 1) . " ms - Log delay: " . game::format_number($this->timers["CHECKLOG"][1] * 1000) . " ms");
} elseif ($content == ".queue") {
$w = $this->settings['name'] == "SMAFIA_BETA" ? '1' : " li_network = " . \Kofradia\DB::quote($this->settings['name']);
$result = \Kofradia\DB::get()->query("SELECT COUNT(*) FROM log_irc WHERE {$w}");
$ant = $result->fetchColumn(0);
unset($result);
$this->msg($cid, $arg, "Message queue: " . game::format_number($ant));
} elseif (preg_match("/^\\.loglimit\\s(\\d+)\$/", $content, $match)) {
$num = intval($match[1]);
if ($num <= 0) {
$msg = "Must be more than 0.";
} elseif ($num > 1500) {
$msg = "Must be less than or equal to 1500.";
} else {
$this->loglimit = $num;
$msg = "Log limit set to {$num}.";
}
$this->msg($cid, $arg, $msg);
} elseif (preg_match("/^\\.logdelay\\s(\\d+)\$/", $content, $match)) {
$num = intval($match[1]);
if ($num < 100) {
$msg = "Must be more than or equal 100.";
} else {
$this->timers["CHECKLOG"][1] = $num / 1000;
$msg = "Log delay set to " . game::format_number($num / 1000, 1) . " sec.";
}
$this->msg($cid, $arg, $msg);
} elseif ($content == ".logtimer") {
$this->timers["CHECKLOG"][2] = 0;
//.........这里部分代码省略.........
示例6: urlencode
$td[] = '<td>' . $_base->date->get($row['up_created_time'])->format(date::FORMAT_SEC) . '</td>';
}
if (isset($show['email'])) {
$td[] = '<td><a href="finn?email=' . urlencode($row['u_email']) . '">' . htmlspecialchars($row['u_email']) . '</a></td>';
}
if (isset($show['onlinea'])) {
$td[] = '<td>' . $_base->date->get($row['up_last_online'])->format(date::FORMAT_SEC) . '</td>';
}
if (isset($show['onliner'])) {
$td[] = '<td class="r">' . game::timespan($row['up_last_online'], game::TIME_ABS | game::TIME_SHORT | game::TIME_NOBOLD) . '</td>';
}
if (isset($show['hits'])) {
$td[] = '<td class="r">' . game::format_number($row['up_hits']) . '</td>';
}
if (isset($show['points'])) {
$td[] = '<td class="r">' . game::format_number($row['up_points']) . '</td>';
}
if (isset($show['cash'])) {
$td[] = '<td class="r">' . game::format_cash($row['money']) . '</td>';
}
if (isset($show['birth'])) {
$birth = explode("-", $row['u_birth']);
$td[] = '<td class="r">' . (empty($row['u_birth']) || $row['u_birth'] == "0000-00-00" ? 'Ikke registrert' : intval($birth[2]) . ". " . $_lang['months'][intval($birth[1])] . " " . $birth[0]) . '</td>';
}
if (isset($show['banko'])) {
$td[] = '<td><input type="radio" name="u1" value="' . $row['up_id'] . '" /></td>';
$td[] = '<td><input type="radio" name="u2" value="' . $row['up_id'] . '" /></td>';
}
echo '
<tr' . (++$i % 2 == 0 ? ' class="color"' : '') . '>
' . implode("\n\t\t\t\t", $td) . '
示例7: all
/**
* Vise komplett liste
*/
protected function all()
{
echo '
<div class="bg1_c medium">
<h1 class="bg1">Rangeringsoversikt<span class="left"></span><span class="right"></span></h1>
<div class="bg1">
<p class="c"><a href="ranklist">« Vis kun topp-plaseringene</a></p>';
if (isset($_GET['show_nsu'])) {
$nsu = "";
ess::$b->page->add_message("Du viser også brukere som ikke vises på vanlig statistikk!");
} else {
$nsu = "up_access_level < " . ess::$g['access_noplay'] . " AND ";
}
// finn ut antall spillere
$result = \Kofradia\DB::get()->query("SELECT COUNT(up_id) FROM users_players WHERE {$nsu}up_access_level != 0");
$antall_spillere = $result->fetchColumn(0);
if ($antall_spillere == 0) {
echo '
<p>
Det finnes ingen spillere...?!
</p>';
} else {
// sideoppsett
$pagei = new pagei(pagei::ACTIVE_GET, "side", pagei::PER_PAGE, 50);
// hent folka..
$result = $pagei->query("\n\t\t\t\tSELECT up_id, up_name, up_access_level, up_points, up_last_online, upr_rank_pos\n\t\t\t\tFROM users_players\n\t\t\t\t\tLEFT JOIN users_players_rank ON upr_up_id = up_id\n\t\t\t\tWHERE {$nsu}up_access_level != 0\n\t\t\t\tORDER BY up_points DESC");
$colspan = access::has("mod") ? 6 : 4;
$e = 0;
echo '
<table class="table tablem" width="100%">
<thead>
<tr>
<th>#</th>
<th>Spillernavn</th>
<th>Rank</th>
<th>Sist pålogget</th>' . (access::has("mod") ? '
<th>Rankpoeng</th>
<th> </th>' : '') . '
</tr>
</thead>
<tbody>
<tr>
<td colspan="' . $colspan . '" class="c">' . $pagei->pagenumbers() . '</td>
</tr>';
// startverdi
$i = $pagei->start;
$last_rank = 0;
while ($row = $result->fetch()) {
$rank = game::rank_info($row['up_points'], $row['upr_rank_pos'], $row['up_access_level']);
echo '
<tr' . (++$e % 2 == 0 ? ' class="color"' : '') . '>
<td class="r">' . ($last_rank != $row['upr_rank_pos'] ? '#' . game::format_number($row['upr_rank_pos']) : '<span style="color: #666">#' . game::format_number($row['upr_rank_pos']) . '</span>') . '</td>
<td>' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</td>
<td class="c">' . $rank['name'] . '</td>
<td class="r">' . game::timespan($row['up_last_online'], game::TIME_ABS) . '</td>' . (access::has("mod") ? '
<td class="r">' . game::format_number($row['up_points']) . '</td>
<td><a href="admin/brukere/finn?up_id=' . $row['up_id'] . '">IP-sjekk</a></td>' : '') . '
</tr>';
$last_rank = $row['upr_rank_pos'];
}
echo '
<tr' . (++$e % 2 == 0 ? ' class="color"' : '') . '>
<td colspan="' . $colspan . '" class="c">' . $pagei->pagenumbers() . '</td>
</tr>
</tbody>
</table>';
}
echo '
</div>
</div>';
}
示例8: active_set
/**
* Sett oppdrag som aktivt
*
* @param integer $o_id
* @return boolean active
*/
public function active_set($o_id)
{
// allerede satt som aktivt?
if ($this->active && $this->active['o_id'] == $o_id) {
return false;
}
// finnes ikke oppdraget? (må være hentet først for at vi kan fortsette)
if (!isset($this->oppdrag[$o_id])) {
return false;
}
$oppdrag =& $this->oppdrag[$o_id];
// ikke aktivt allerede?
if ($oppdrag['uo_active'] == 0) {
// sjekk om noen andre oppdrag er aktive
$result = \Kofradia\DB::get()->query("SELECT uo_o_id, uo_active_time FROM users_oppdrag WHERE uo_up_id = {$this->up->id} AND uo_active != 0 LIMIT 1");
if ($result->rowCount() > 0) {
$uo = $result->fetch();
// et annet oppdrag?
if ($uo['uo_o_id'] != $oppdrag['o_id']) {
// sett riktig aktivt oppdrag
if (!isset($this->oppdrag[$uo['uo_o_id']]) && !$this->oppdrag_loaded) {
$this->user_load_all();
}
$this->active_set($uo['uo_o_id']);
// må sette alle andre oppdrag som innaktive før vi kan begynne på et nytt oppdrag
return false;
}
$oppdrag['uo_active'] = 1;
$oppdrag['uo_active_time'] = $uo['uo_active_time'];
} else {
$oppdrag['uo_active'] = 1;
$oppdrag['uo_active_time'] = time();
\Kofradia\DB::get()->exec("UPDATE users_oppdrag SET uo_active = 1, uo_active_time = {$oppdrag['uo_active_time']} WHERE uo_up_id = {$this->up->id} AND uo_o_id = {$oppdrag['o_id']}");
}
}
// sett aktivt oppdrag
if ($this->up->params->get("oppdrag_id") != $oppdrag['o_id']) {
$params = new params();
$params->params = $oppdrag;
$this->up->params->lock();
$this->up->params->update("oppdrag", $params->build());
$this->up->params->update("oppdrag_id", $oppdrag['o_id'], true);
}
$this->active =& $oppdrag;
// sett nye triggere
$this->link_triggers();
// sjekk om oppdraget er over tiden sin
$params = $this->params[$oppdrag['o_id']]['o_params'];
$time_start = $oppdrag['uo_active_time'];
$time_limit = $params->get("time_limit", oppdrag::DEFAULT_TIME_LIMIT_ACTIVE);
if ($time_start + $time_limit < time()) {
// kontroller trigger
if (isset($this->triggers_id[$o_id])) {
$trigger = $this->triggers_id[$o_id];
switch ($params->get("name")) {
case "single_poker":
// nådde vi beløpet?
if ($trigger['status']->get("chips") >= $trigger['trigger']->get("chips")) {
$this->success($o_id, 'Du klarte å spille deg opp til ' . game::format_number($trigger['status']->get("chips")) . ' chips i løpet av ' . game::timespan($time_limit, game::TIME_FULL) . ', noe som var mer enn ' . game::format_number($trigger['trigger']->get("chips")) . ' chips. Oppdraget «$name» ble vellykket!');
} else {
$this->failed($o_id, 'Du spilte deg opp til ' . game::format_number($trigger['status']->get("chips")) . ' chips i løpet av ' . game::timespan($time_limit, game::TIME_FULL) . '. Det var mindre enn ' . game::format_cash($trigger['trigger']->get("chips")) . ' chips. Oppdraget «$name» ble mislykket.');
}
break;
}
}
// hvis oppdraget fortsatt er aktivt, sett det som feilet pga. tid
if (isset($this->oppdrag[$o_id]) && $this->oppdrag[$o_id]['uo_active'] != 0) {
$this->failed($o_id, 'Du brukte for lang tid på oppdraget «$name» og mislykket.');
}
return false;
}
return true;
}
示例9: urlencode
echo '
<tr' . (++$i % 2 == 0 ? ' class="color"' : '') . '>
<td rowspan="' . $count . '" valign="top"><a href="finn?ip=' . urlencode($row[0]['u_online_ip']) . '">' . htmlspecialchars($row[0]['u_online_ip']) . '</a><br />(' . $count . ' ' . fword("bruker", "brukere", $count) . ')</td>';
$e = 0;
foreach ($row as $player) {
// ny rad?
if (++$e > 1) {
echo '
</tr>
<tr' . ($i % 2 == 0 ? ' class="color"' : '') . '>';
}
$birth = explode("-", $player['u_birth']);
echo '
<td>' . game::profile_link($player['up_id'], $player['up_name'], $player['up_access_level']) . '</td>
<td><a href="finn?email=' . urlencode($player['u_email']) . '">' . htmlspecialchars($player['u_email']) . '</a></td>
<td>' . $_base->date->get($player['up_created_time'])->format(date::FORMAT_SEC) . '</td>
<td>' . $_base->date->get($player['up_last_online'])->format(date::FORMAT_SEC) . '</td>
<td class="r">' . game::timespan($player['up_last_online'], game::TIME_ABS | game::TIME_SHORT | game::TIME_NOBOLD) . '</td>
<td class="r">' . game::format_number($player['up_hits']) . '</td>
<td class="r">' . game::format_number($player['up_points']) . '</td>
<td class="r">' . game::format_cash($player['money']) . '</td>
<td class="r">' . (empty($player['u_birth']) || $player['u_birth'] == "0000-00-00" ? 'Ikke registrert' : intval($birth[2]) . ". " . $_lang['months'][intval($birth[1])] . " " . $birth[0]) . '</td>';
}
echo '
</tr>';
}
echo '
</tbody>
</table>';
}
$_base->page->load();
示例10: while
<th>Sist pålogget ' . $sort->show_link(4, 5) . '</th>
<th>Rank</th>
<th>Plassering ' . $sort->show_link(6, 7) . '</th>
</tr>
</thead>
<tbody>';
$i = 0;
while ($row = $result->fetch()) {
$rank = game::rank_info($row['up_points'], $row['upr_rank_pos'], $row['up_access_level']);
$rank_name = $rank['name'] . ($rank['orig'] ? ' (' . $rank['orig'] . ')' : '');
echo '
<tr' . (++$i % 2 == 0 ? ' class="color"' : '') . '>
<td>' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</td>
<td class="r">' . game::timespan($row['up_last_online'], game::TIME_ABS) . '</td>
<td>' . $rank_name . '</td>
<td class="r">' . game::format_number($row['upr_rank_pos']) . '</td>
</tr>';
}
echo '
</tbody>
</table>';
// flere sider?
if ($pagei->pages > 1) {
echo '
<div class="hr"></div>
<p class="c">
' . $pagei->pagenumbers() . '
</p>';
}
}
}
示例11: isset
// er kontakt?
$is_contact = isset(login::$info['contacts'][1][$player['up_id']]) ? 1 : 0;
// er blokkert?
$is_block = isset(login::$info['contacts'][2][$player['up_id']]) ? 1 : 0;
}
// som html?
if (isset($_POST['html'])) {
header("Content-Type: text/html; charset=utf-8");
echo '<div class="profile_box_wrap">
<div class="profile_box_left">
<div class="profile_box_status">
<p>' . $player['up_name'] . ($mod ? ' <span class="profile_box_type">(' . $player['up_id'] . ')</span>' : '') . ($status == "" ? '' : ' ' . $status) . '</p>
</div>
<div class="profile_box_info">
<p><span class="profile_box_type">Rank:</span> <span class="profile_box_value">' . htmlspecialchars($rank['name'] . ($rank['orig'] ? ' (' . $rank['orig'] . ')' : '')) . '</span></p>' . ($player['up_access_level'] != 0 ? '
<p><span class="profile_box_type">Wanted nivå:</span> <span class="profile_box_value">' . game::format_number($player['up_wanted_level'] / 10, 1) . ' %</span></p>' : '') . '
<p><span class="profile_box_type">Sist aktiv:</span> <span class="profile_box_value">' . game::timespan($player['up_last_online'], game::TIME_ABS | game::TIME_PAST | game::TIME_FULL) . '</span></p>
</div>' . ($mod ? '
<div class="profile_box_info">
<p><span class="profile_box_type">Penger:</span> <span class="profile_box_value">' . game::format_cash($player['money']) . '</span></p>
<p><span class="profile_box_type">E-post:</span> <span class="profile_box_value"><a href="' . $__server['relative_path'] . '/admin/brukere/finn?email=' . urlencode($player['u_email']) . '" title="Finn brukere med denne e-posten">' . htmlspecialchars($player['u_email']) . '</a></span></p>
</div>' : '') . '
<div class="profile_box_links">
<ul>
<li><a href="' . $__server['relative_path'] . '/p/' . rawurlencode($player['up_name']) . '/' . $player['up_id'] . '">Vis profil</a></li>' . (access::has("crewet") ? '
<li>Min side: <a href="' . $__server['relative_path'] . '/min_side?u_id=' . $player['up_u_id'] . '&a=crew">bruker</a> | <a href="' . $__server['relative_path'] . '/min_side?up_id=' . $player['up_id'] . '&a=crew">spiller</a> | <a href="' . $__server['relative_path'] . '/min_side?u_id=' . $player['up_u_id'] . '&a=crew&b=warning">ny advarsel</a></li>' : '') . ($is_contact != -1 ? '
<li><a href="' . $__server['relative_path'] . '/innboks_ny?mottaker=' . urlencode($player['up_name']) . '">Send melding</a></li>' : '');
if ($is_contact != -1) {
if ($is_contact == 1) {
echo '
<li><a href="' . $__server['relative_path'] . '/kontakter/delete/' . $player['up_id'] . '?sid=' . login::$info['ses_id'] . '">Fjern fra kontaktlisten</a></li>';
示例12: intval
access::need("admin");
access::need_nostat();
$_base->page->add_title("Skaff ressurser!");
if (isset($_POST['rankpoeng'])) {
$points = intval($_POST['rankpoeng']);
if ($points != 0) {
login::$user->player->increase_rank($points);
$_base->page->add_message("Ranken din ble endret med <b>" . game::format_number($points) . "</b> rankpoeng.");
}
}
if (isset($_POST['rankpoeng_abs'])) {
$points = intval($_POST['rankpoeng_abs']);
if ($points >= 0) {
$points = $points - login::$user->player->data['up_points'];
login::$user->player->increase_rank($points);
$_base->page->add_message("Ranken din ble endret med <b>" . game::format_number($points) . "</b> rankpoeng.");
}
}
if ($_SERVER['REQUEST_METHOD'] == "POST") {
redirect::handle();
}
echo '
<h1>Skaff ressurser</h1>
<form aciont="" method="post">
<table class="table center tablemb">
<tbody>
<tr>
<th>Rank</th>
<td><input type="text" name="rankpoeng" class="styled w80" value="0" /></td>
</tr>
示例13: attack_log
/**
* Lagre logg over angrep
*/
protected function attack_log($ret, $attack_type, $vitner_log, player $up)
{
// sett opp vitner
$vitner = count($vitner_log) > 0 ? \Kofradia\DB::quote(serialize($vitner_log)) : 'NULL';
// sett opp liste over FF
$ff_defend = array();
$list = $this->get_ff_list();
foreach ($list as $row) {
if ($row['ff_is_crew'] != 0) {
continue;
}
$type = ff::$types[$row['ff_type']];
$ff_defend[] = array($row['ff_type'], $row['ff_id'], $type['refobj'], $row['ff_name'], $row['ffm_priority'], $type['priority'][$row['ffm_priority']], $row['ffm_status']);
}
$ff_defend = count($ff_defend) > 0 ? \Kofradia\DB::quote(serialize($ff_defend)) : 'NULL';
// sett opp liste over FF for angriper
$ff_attack = array();
$list = $up->get_ff_list();
foreach ($list as $row) {
if ($row['ff_is_crew'] != 0) {
continue;
}
$type = ff::$types[$row['ff_type']];
$ff_attack[] = array($row['ff_type'], $row['ff_id'], $type['refobj'], $row['ff_name'], $row['ffm_priority'], $type['priority'][$row['ffm_priority']], $row['ffm_status']);
}
$ff_attack = count($ff_attack) > 0 ? \Kofradia\DB::quote(serialize($ff_attack)) : 'NULL';
// legg til i loggen
$cash = isset($ret['penger']) ? $ret['penger'] : 0;
if (isset($ret['penger_bank'])) {
$cash = bcadd($cash, $ret['penger_bank']);
}
$hitlist = isset($ret['hitlist']) ? $ret['hitlist'] : 0;
\Kofradia\DB::get()->exec("INSERT INTO drapforsok SET df_attack_up_id = {$up->id}, df_defend_up_id = {$this->id}, df_time = " . time() . ", df_b_id = " . $up->data['up_b_id'] . ", df_outcome = " . ($ret['drept'] ? 1 : 0) . ", df_rankpoints = {$ret['rankpoeng']}, df_type = {$attack_type}, df_cash = {$cash}, df_hitlist = {$hitlist}, df_vitner = {$vitner}, df_attack_ff_list = {$ff_attack}, df_defend_ff_list = {$ff_defend}, df_bullets = {$ret['bullets']}");
if ($ret['drept']) {
// logg
if ($attack_type == self::ATTACK_TYPE_UTPRESSING) {
putlog("DF", "%c4UTPRESSING DREPT%c: {$up->data['up_name']} ({$up->rank['name']}) presset {$this->data['up_name']} ({$this->rank['name']}). " . $this->generate_minside_url());
} else {
putlog("DF", "ANGREP %c4DREPT%c: {$up->data['up_name']} ({$up->rank['name']}) angrep%c3 {$this->data['up_name']}%c ({$this->rank['name']}) med " . $up->weapon->data['name'] . " (" . game::format_number($up->data['up_weapon_training'] * 100, 2) . " % våpentrening) med " . fwords("%d kule", "%d kuler", $ret['bullets']) . ". " . $this->generate_minside_url());
putlog("DF", " - Angrepstyrke: " . game::format_number($ret['attack_skade'][0] * 100, 2) . ", beskyttelsestyrke: " . game::format_number($ret['attack_skade'][1] * 100, 2) . ", skadeprosent: " . game::format_number($ret['skadeprosent'] * 100, 2) . " % av " . weapon::MAX_ATTACK_HEALTH . " helsepoeng");
}
putlog("DF", " - Helse: Hadde " . game::format_number($this->get_health_percent(), 3) . " %");
putlog("DF", " - Energi: Hadde " . game::format_number($this->get_energy_percent(), 3) . " %");
if (!$this->protection->data) {
putlog("DF", " - Hadde ingen beskyttelse");
} else {
putlog("DF", " - Beskyttelse: Hadde {$this->protection->data['name']} med " . game::format_number($this->data['up_protection_state'] * 100, 2) . " % styrke");
}
putlog("DF", " - Rankpoeng: {$up->data['up_name']} fikk " . game::format_number($ret['rankpoeng']) . " rankpoeng (" . game::format_rank($ret['rankpoeng'], "all") . " % rank) " . $up->generate_minside_url());
if (count($ret['vitner']) == 0) {
putlog("DF", " - Ingen vitner");
} else {
foreach ($ret['vitner'] as $vitne) {
putlog("DF", " - Vitne: {$vitne['up']->data['up_name']} (" . ($vitne['visible'] ? 'ble oppdaget' : 'ble IKKE oppdaget') . ') ' . $vitne['up']->generate_minside_url());
}
}
putlog("DF", " - Penger fra hånda: " . game::format_cash($ret['penger']));
if (isset($ret['penger_bank'])) {
putlog("DF", " - Penger fra banken: " . game::format_cash($ret['penger_bank']));
}
putlog("DF", " - Penger fra hitlist: " . game::format_cash($ret['hitlist']));
foreach ($ret['ffm'] as $ffm) {
putlog("DF", " - Var " . $ffm->get_priority_name() . " i " . $ffm->ff->data['ff_name'] . " " . ess::$s['path'] . "/ff/?ff_id={$ffm->ff->id}");
}
} elseif ($attack_type == self::ATTACK_TYPE_KILL) {
// logg
putlog("DF", "ANGREP %c8SKADET%c: {$up->data['up_name']} ({$up->rank['name']}) angrep%c3 {$this->data['up_name']}%c ({$this->rank['name']}) med " . $up->weapon->data['name'] . " (" . game::format_number($up->data['up_weapon_training'] * 100, 2) . " % våpentrening) med " . fwords("%d kule", "%d kuler", $ret['bullets']) . ". " . $this->generate_minside_url());
putlog("DF", " - Angrepstyrke: " . game::format_number($ret['attack_skade'][0] * 100, 2) . ", beskyttelsestyrke: " . game::format_number($ret['attack_skade'][1] * 100, 2) . ", skadeprosent: " . game::format_number($ret['skadeprosent'] * 100, 2) . " % av " . weapon::MAX_ATTACK_HEALTH . " helsepoeng");
putlog("DF", " - Helse: Mistet " . game::format_number($ret['health_lost_p'] * 100, 3) . " % ({$ret['health_lost']}) og har nå%c4 " . game::format_number($ret['health_new_p'] * 100, 3) . " %");
putlog("DF", " - Energi: Mistet " . game::format_number($ret['energy_lost_p'] * 100, 3) . " % ({$ret['energy_lost']}) og har nå%c12 " . game::format_number($ret['energy_new_p'] * 100, 3) . " %");
if ($ret['protection_replaced']) {
putlog("DF", " - Beskyttelsen ble erstattet med " . $this->protection->data['name']);
} elseif ($ret['protection_lost_p'] == "") {
putlog("DF", " - Hadde ingen beskyttelse");
} else {
putlog("DF", " - Beskyttelse: Mistet " . game::format_number($ret['protection_lost_p'] * 100, 3) . " % og har nå " . game::format_number($ret['protection_new_p'] * 100, 3) . " %");
}
putlog("DF", " - Rankpoeng: {$up->data['up_name']} fikk " . game::format_num($ret['rankpoeng']) . " rankpoeng (offeret mistet " . game::format_num($ret['rankpoeng_lost']) . ") " . $up->generate_minside_url());
if (count($ret['vitner']) == 0) {
putlog("DF", " - Ingen vitner");
} else {
foreach ($ret['vitner'] as $vitne) {
putlog("DF", " - Vitne: {$vitne['up']->data['up_name']} (" . ($vitne['visible'] ? 'ble oppdaget' : 'ble IKKE oppdaget') . ') ' . $vitne['up']->generate_minside_url());
}
}
putlog("DF", " - Penger fra hånda: " . game::format_cash($ret['penger']));
putlog("DF", " - Penger fra hitlist: " . game::format_cash($ret['hitlist']));
}
}
示例14: format_log
//.........这里部分代码省略.........
case "description":
$data = '<user id="' . $data . '" /> redigerte beskrivelsen for ' . $this->refstring . '.';
break;
// Salg
// Salg
case "sell":
$info = explode(":", $data);
switch ($info[0]) {
// starter salget:
// {TYPE=init}:BOSS:UBOSS:FEE:AMOUNT
case "init":
$data = '<user id="' . $info[1] . '" /> åpnet salg av ' . $this->refstring . ' til <user id="' . $info[2] . '" /> for ' . game::format_cash($info[4]) . '.';
break;
// avbryter salget (trekker det tilbake)
// {TYPE=abort}:BOSS:UBOSS:FEE:AMOUNT
// avbryter salget (trekker det tilbake)
// {TYPE=abort}:BOSS:UBOSS:FEE:AMOUNT
case "abort":
$data = '<user id="' . $info[1] . '" /> trakk tilbake salg av ' . $this->refstring . ' til <user id="' . $info[2] . '" /> for ' . game::format_cash($info[4]) . '.';
break;
// godtar kjøpet (mottakeren)
// {TYPE=approve}:BOSS:UBOSS:FEE:AMOUNT
// godtar kjøpet (mottakeren)
// {TYPE=approve}:BOSS:UBOSS:FEE:AMOUNT
case "approve":
$data = '<user id="' . $info[2] . '" /> godtok salget av ' . $this->refstring . ' og har nå overtatt som ' . htmlspecialchars($this->type['priority'][1]) . '. <user id="' . $info[1] . '" /> har blitt satt som ' . htmlspecialchars($this->type['priority'][2]) . '. Gebyr: ' . game::format_cash($info[3]) . '. Salgsbeløp: ' . game::format_cash($info[4]) . '.';
break;
// avslår kjøpet (mottakeren)
// {TYPE=reject}:UBOSS:FEE:AMOUNT
// avslår kjøpet (mottakeren)
// {TYPE=reject}:UBOSS:FEE:AMOUNT
case "reject":
$data = '<user id="' . $info[2] . '" /> avslo salget av ' . $this->refstring . ' for ' . game::format_cash($info[4]) . '.';
break;
}
break;
// Nytt navn
// Nytt navn
case "name":
// syntax: gammelt navn:nytt navn:spiller som sendte søknad:innvilget av
// syntax (abstrakt): ff_name:ff_name:up_id:up_id
$info = explode(":", $data);
$data = 'Navnet på ' . $this->refstring . ' ble endret fra ' . htmlspecialchars(urldecode($info[0])) . ' til <b>' . htmlspecialchars(urldecode($info[1])) . '</b>.';
break;
case "bank_overforing_tap_change":
$info = explode(":", $data);
$data = 'Overføringsgebyret endret seg med ' . game::format_number($info[1] * 100, 2) . ' % til <b>' . game::format_number(($info[0] + $info[1]) * 100, 2) . ' %</b>.';
break;
case "article_edited":
// data: fna_id,up_id,fna_up_id,fna_title_org,fna_title_new,fna_text_old,fna_text_new
$info = array_map("urldecode", explode(":", $data));
$data = '<user id="' . $info[1] . '" /> redigerte <a href="' . $__server['relative_path'] . '/ff/avis?ff_id=' . $this->id . '&a&ffna=' . $info[0] . '">artikkelen</a> til <user id="' . $info[2] . '" />.';
break;
// kastet ut spiller fra bomberommet
// kastet ut spiller fra bomberommet
case "bomberom_kick":
// syntax: up_id(som utfører handlingen):up_id(som ble kastet ut):up_brom_expire(når vi egentlig skulle gå ut av bomberommet)
$info = explode(":", $data);
$data = '<user id="' . $info[0] . '" /> kastet ut <user id="' . $info[1] . '" /> fra bomberommet, som egentlig skulle sittet til ' . ess::$b->date->get($info[2])->format() . '.';
break;
// oppløst
// oppløst
case "dissolve":
// syntax: up_id(som utfører handlingen):up_id(som ble kastet ut):up_brom_expire(når vi egentlig skulle gå ut av bomberommet)
$info = explode(":", $data);
$data = ucfirst($this->type['refobj']) . ' ble oppløst.';
break;
// kuler inn
// kuler inn
case "bullets_in":
// syntax: up_id:num
$info = explode(":", $data);
$data = '<user id="' . $info[0] . '" /> satt inn ' . fwords("%d kule", "%d kuler", $info[1]) . ' i kulelageret.';
break;
// kuler ut
// kuler ut
case "bullets_out":
// syntax: up_id:num[:action_up]
$info = explode(":", $data);
if (isset($info[2])) {
$data = '<user id="' . $info[2] . '" /> tok ut ' . fwords("%d kule", "%d kuler", $info[1]) . ' fra kulelageret og gav de til <user id="' . $info[0] . '" />.';
} else {
$data = '<user id="' . $info[0] . '" /> tok ut ' . fwords("%d kule", "%d kuler", $info[1]) . ' fra kulelageret.';
}
break;
// informasjon
// informasjon
case "info":
// behold data urørt
break;
// Dummy
// Dummy
case "dummy":
$data = $time;
break;
default:
$data = htmlspecialchars($data);
}
return $data;
}
示例15: while
<th>Nettlesere</th>
</tr>
</thead>
<tbody>';
$i = 0;
while ($row = $result->fetch()) {
echo '
<tr' . (++$i % 2 == 0 ? ' class="color"' : '') . '>
<td class="r">' . $row['ses_id'] . '</td>
<td class="r">' . $row['ses_u_id'] . '</td>' . ($wc ? '
<td>' . $row['ses_last_ip'] . '</td>' : '') . '
<td>' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</td>
<td>' . ($row['ses_active'] == 0 ? 'Nei' : '<b>Ja</b>') . '</td>
<td>' . $_base->date->get($row['ses_created_time'])->format(date::FORMAT_SEC) . '</td>
<td>' . $_base->date->get($row['ses_last_time'])->format(date::FORMAT_SEC) . '</td>
<td>' . ($row['ses_logout_time'] == 0 ? '<b>Nei</b>' : $_base->date->get($row['ses_logout_time'])->format(date::FORMAT_SEC)) . '</td>
<td class="r">' . game::format_number($row['ses_hits']) . '</td>
<td class="r">' . game::format_number($row['ses_points']) . '</td>
<td>' . (empty($row['ses_browsers']) ? '<i>Mangler</i>' : strtr(htmlspecialchars($row['ses_browsers']), "\n", "<br />")) . '</td>
</tr>';
}
echo '
</tbody>
</table>';
// flere sider?
if ($pagei->pages > 1) {
echo '
<p>Navigasjon: ' . $pagei->pagenumbers() . '</p>';
}
}
$_base->page->load();