当前位置: 首页>>代码示例>>PHP>>正文


PHP game::timespan方法代码示例

本文整理汇总了PHP中game::timespan方法的典型用法代码示例。如果您正苦于以下问题:PHP game::timespan方法的具体用法?PHP game::timespan怎么用?PHP game::timespan使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在game的用法示例。


在下文中一共展示了game::timespan方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: counterFilter

 public function counterFilter($time, $redirect_to)
 {
     $rel = (string) $time;
     if ($redirect_to) {
         if ($redirect_to === true) {
             $rel .= ",refresh";
         } else {
             $rel .= "," . htmlspecialchars($redirect_to);
         }
     }
     return '<span class="counter" rel="' . $rel . '">' . \game::timespan($time, \game::TIME_FULL, 5) . '</span>';
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:12,代码来源:Counter.php

示例2: visliste

function visliste($name, $where)
{
    global $_base;
    $result = \Kofradia\DB::get()->query("SELECT up_id, up_name, up_access_level, up_last_online FROM users_players WHERE {$where} ORDER BY up_name");
    // hopp over hvis det ikke finnes noen
    if ($result->rowCount() == 0) {
        return;
    }
    echo '
		<h2 class="bg1">' . $name . '<span class="left2"></span><span class="right2"></span></h2>
		<div class="bg1">
			<dl class="dd_right">';
    while ($row = $result->fetch()) {
        echo '
				<dt>' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</dt>
				<dd>' . game::timespan($row['up_last_online'], game::TIME_ABS | game::TIME_NOBOLD) . '</dd>';
    }
    echo '
			</dl>
		</div>';
}
开发者ID:Kuzat,项目名称:kofradia,代码行数:21,代码来源:crewet.php

示例3: 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>
//.........这里部分代码省略.........
开发者ID:Kuzat,项目名称:kofradia,代码行数:101,代码来源:innboks.php

示例4: page_training_show

    /**
     * Våpentrening
     */
    protected function page_training_show()
    {
        // sett opp og test for anti-bot
        $this->training_antibot = new antibot(login::$user->id, "training", 7);
        if (MAIN_SERVER) {
            $this->training_antibot->check_required();
        }
        // sett opp skjema
        $this->training_form = \Kofradia\Form::getByDomain("training", login::$user);
        // ventetid?
        $wait = max(0, login::$user->player->data['up_weapon_training_next'] - time());
        // skal vi trene våpenet?
        if (isset($_POST['wt']) && $this->training_form->validateHashOrAlert(null, "Våpentrening")) {
            // kan vi ikke trene nå?
            if ($wait > 0) {
                redirect::handle();
            }
            // finnes ikke valget?
            $id = (int) postval("training_id");
            if (!isset(self::$trainings[$id])) {
                ess::$b->page->add_message("Du må velge et alternativ.", "error");
                redirect::handle();
            }
            $opt = self::$trainings[$id];
            // lagre valget for neste gang
            ess::session_put("training_id", $id);
            // har ikke nok cash?
            if ($opt['price'] > login::$user->player->data['up_cash']) {
                ess::$b->page->add_message("Du har ikke nok penger til å utføre våpentreningen.");
                redirect::handle();
            }
            $f = self::TRAINING_MAX * $opt['percent'];
            $next_old = login::$user->player->data['up_weapon_training_next'] ? ' = ' . login::$user->player->data['up_weapon_training_next'] : ' IS NULL';
            // utfør våpentrening
            $a = \Kofradia\DB::get()->exec("\n\t\t\t\tUPDATE users_players\n\t\t\t\tSET up_weapon_training = up_weapon_training + (1 - up_weapon_training) * {$f}, up_weapon_training_next = " . (time() + $opt['wait']) . ", up_cash = up_cash - {$opt['price']}\n\t\t\t\tWHERE up_id = " . login::$user->player->id . " AND up_cash >= {$opt['price']} AND up_weapon_training_next{$next_old}");
            // ikke oppdatert?
            if ($a == 0) {
                ess::$b->page->add_message("Kunne ikke utføre våpentrening.", "error");
            } else {
                $this->training_antibot->increase_counter();
                ess::$b->page->add_message("Du trente opp våpenet ditt og våpentreningen økte med " . game::format_num((1 - login::$user->player->data['up_weapon_training']) * $f * 100, 2) . " %.");
            }
            redirect::handle();
        }
        $training = login::$user->player->data['up_weapon_training'] * 100;
        echo '
<div class="bg1_c xsmall">
	<h1 class="bg1">Våpentrening<span class="left2"></span><span class="right2"></span></h1>
	<div class="bg1">';
        if ($wait > 0) {
            echo '
		<p class="c">Du må vente ' . game::counter($wait, true) . ' før du kan trene våpenet på nytt.</p>';
        } else {
            // vis alternativene
            echo '
		<form action="" method="post">
			' . $this->training_form->getHTMLInput() . '
			<table class="table tablemt center">
				<thead>
					<tr>
						<th>Pris</th>
						<th>Ventetid</th>
					</tr>
				</thead>
				<tbody>';
            $i = 0;
            $match = ess::session_get("training_id") ?: 0;
            foreach (self::$trainings as $id => $row) {
                echo '
					<tr class="box_handle' . (++$i % 2 == 0 ? ' color' : '') . '">
						<td class="r"><input type="radio" name="training_id"' . ($match == $id ? ' checked="checked"' : '') . ' value="' . $id . '" />' . game::format_cash($row['price']) . '</td>
						<td class="r">' . game::timespan($row['wait']) . '</td>
					</tr>';
            }
            echo '
				</tbody>
			</table>
			<p class="c">' . show_sbutton("Utfør", 'name="wt"') . '</p>
		</form>';
        }
        echo '
		<div class="progressbar p' . ($training < 28 ? ' levelcrit' : ($training < 35 ? ' levelwarn' : '')) . '">
			<div class="progress" style="width: ' . round(min(100, $training)) . '%">
				<p>Våpentrening: ' . ($training == 100 ? '100' : game::format_num($training, 2)) . ' %</p>
			</div>
		</div>
		<p>Du har en <b>' . htmlspecialchars(login::$user->player->weapon->data['name']) . '</b> med <b>' . game::format_num(login::$user->player->data['up_weapon_bullets']) . '</b> ' . fword('kule', 'kuler', login::$user->player->data['up_weapon_bullets']) . '.</p>
		<p>Våpentreningen din synker jevnlig i løpet av dagen, og du er nødt til å trene for å holde oppe våpentreningen din. Hvis våpentreningen din faller under 25 %, risikerer du å miste våpenet ditt.</p>
		<p>Bedre våpentrening fører til:</p>
		<ul class="spacer">
			<li>Du forbedrer treffsikkerheten din</li>
			<li>Du øker skuddtakten samtidig som treffsikkerheten forblir den samme</li>
		</ul>
	</div>
</div>';
    }
开发者ID:Kuzat,项目名称:kofradia,代码行数:99,代码来源:angrip.php

示例5: CountdownProgressbarTime

// javascript for progress for tiden
$_base->page->add_js_domready('
	new CountdownProgressbarTime($("progress_time"), ' . $progress_time_status . ', ' . $progress_time_limit . ');');
echo '
<div class="bg1_c small bg1_padding" style="width: 420px">
	<h1 class="bg1">' . htmlspecialchars($oppdrag['o_title']) . '<span class="left"></span><span class="right"></span></h1>
	<p class="h_left"><a href="oppdrag?force">&laquo; Tilbake</a></p>
	<div class="bg1">' . (!$success ? '
		<p>Du må ha mer enn <b>' . game::format_number($target) . '</b> chips om <u>' . game::counter($expire - time()) . '</u>.<br />
		Du har nå <b>' . game::format_number($chips) . '</b> chips' . ($chips < $target ? ' og mangler ' . game::format_number($target - $chips) . ' chips' : '') . '.</p>' : '
		<p>Trykk <a href="oppdrag">her</a> for å gå tilbake til oppdrag.</p>') . '
		<div class="progressbar">
			<div class="progress" style="width: ' . round(min($chips, $target) / $target * 100) . '%"><p>Du har ' . game::format_number(min($chips, $target) / $target * 100, 1) . ' % av antall chips du trenger</p></div>
		</div>
		<div class="progressbar" style="margin-top: 3px">
			<div class="progress" style="width: ' . round($progress_time) . '%" id="progress_time"><p>' . game::timespan($progress_time_limit - $progress_time_status, game::TIME_FULL) . ' gjenstår</p></div>
		</div>';
// nytt spill?
if (!$cards && !$success) {
    ess::$b->page->add_js_domready('$("chips").focus();');
    echo '
		<div class="bg1_c" style="width: 65%">
			<h2 class="bg1">Nytt spill<span class="left2"></span><span class="right2"></span></h2>
			<div class="bg1 c">
				<form action="" method="post">
					<p>Antall chips: <input type="text" class="styled w80 r" name="chips" id="chips" value="' . game::format_number(min($chips, $status->get("bet", 1000))) . ' chips" /> ' . show_sbutton("Start") . '</p>
				</form>
			</div>
		</div>';
}
// velge kort?
开发者ID:Kuzat,项目名称:kofradia,代码行数:31,代码来源:single_poker.php

示例6: handle_data


//.........这里部分代码省略.........
                             try {
                                 $result = \Kofradia\DB::get()->query($query);
                             } catch (Exception $e) {
                                 $ok = false;
                             }
                             if (!$ok) {
                                 $this->send_data($cid, "PRIVMSG {$arg} :Query failed: " . \Kofradia\DB::get()->errorInfo()[2] . "\n");
                             } else {
                                 if ($result->rowCount() == 0) {
                                     $this->send_data($cid, "PRIVMSG {$arg} :No data in result.\n");
                                 } else {
                                     // list opp feltene
                                     $row = $result->fetch();
                                     $fields = array_keys($row);
                                     $this->send_data($cid, "PRIVMSG {$arg} :Fields: " . implode(", ", $fields) . "\n");
                                     // vis hver rad
                                     $i = 1;
                                     do {
                                         $data = array();
                                         foreach ($row as $value) {
                                             $data[] = preg_replace("/[\r\n]/", "", $value);
                                         }
                                         $this->send_data($cid, "PRIVMSG {$arg} :Row {$i}: " . implode(", ", $data) . "\n");
                                         $i++;
                                     } while ($row = $result->fetch());
                                 }
                                 $this->send_data($cid, "PRIVMSG {$arg} :Query completed..\n");
                             }
                         }
                         $break = true;
                     } else {
                         $log = false;
                     }
                     if ($log) {
                         // logg forespørselen
                         file_put_contents("irclog-" . $this->settings['name'] . ".log", date("r") . " {$user['nick']}!{$user['ident']}@{$user['host']} {$type} {$arg} {$content}\n", FILE_APPEND);
                     }
                     if ($break) {
                         break;
                     }
                 }
                 // ikke kanal melding
                 if (substr($arg, 0, 1) != "#") {
                     if ($user['ident'] != "" && $type == "PRIVMSG") {
                         $this->send_data($cid, "NOTICE {$user['nick']} :Doh?\n");
                     }
                 } else {
                     // aktiv cid?
                     if ($this->connected_cid == $cid) {
                         $info = preg_split("/\\s+/", $content, 2);
                         if (!isset($info[1])) {
                             $info[1] = NULL;
                         }
                         switch ($info[0]) {
                             case "!status":
                                 $time = intval($info[1]);
                                 if ($time == 0 || $time < 0) {
                                     $time = 300;
                                 }
                                 $last = time() - $time;
                                 $result = \Kofradia\DB::get()->query("SELECT COUNT(up_id) FROM users_players WHERE up_last_online >= {$last}");
                                 $ant = game::format_number($result->fetchColumn(0));
                                 unset($result);
                                 $time = game::timespan($time, game::TIME_FULL | game::TIME_NOBOLD);
                                 $this->msg($cid, $arg, "%bAntall pålogget siste {$time}%b: %u{$ant}%u");
                                 break;
                             case "!info":
                                 if ($this->irc_info) {
                                     $this->irc_info->end_node = $arg;
                                     $this->irc_info->parse_request($info[1]);
                                 }
                                 break;
                             case "!search":
                                 $this->node_search($cid, $arg, $info[1]);
                                 break;
                         }
                     }
                 }
                 break;
             default:
                 $this->debug($cid, "UNKNOWN USER DATA: {$line}");
         }
         return;
     }
     $info = explode(" ", $line, 2);
     switch ($info[0]) {
         case "PING":
             $this->debug($cid, "PING PONG");
             $this->send_data($cid, "PONG {$info[1]}");
             break;
         case "ERROR":
             $this->debug($cid, $line);
             $this->handle_error($cid, "Error occured..");
             // koble til på nytt
             #$this->connect($cid);
             break;
         default:
             $this->debug($cid, "UNKNOWN DATA: {$line}");
     }
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:101,代码来源:ircbot_log.php

示例7: htmlspecialchars

 $td[] = '<td class="r"><a href="' . $__server['relative_path'] . '/min_side?up_id=' . $row['up_id'] . '">' . $row['up_id'] . '</a></td>';
 $td[] = '<td>' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</td>';
 if (isset($show['ip'])) {
     $td[] = '<td><a href="ip_sessions?ip=' . htmlspecialchars($row['u_online_ip']) . '">IP økter</a> - <a href="http://www.ripe.net/fcgi-bin/whois?form_type=simple&full_query_string=&searchtext=' . urlencode($row['u_online_ip']) . '&do_search=Search">RIPE</a> - <a href="finn?ip=' . urlencode($row['u_online_ip']) . '">' . $row['u_online_ip'] . '</a>' . (isset($ip_bans[$row['u_online_ip']]) ? ' <a href="../ip_ban?active" style="color:#FF0000" title="IP-Adresse blokkert' . (!empty($ip_bans[$row['u_online_ip']]['bi_reason']) ? ': ' . htmlspecialchars($ip_bans[$row['u_online_ip']]['bi_reason']) : '') . '">(Blokkert)</a>' : '') . '</td>';
 }
 if (isset($show['reg'])) {
     $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'])) {
开发者ID:Kuzat,项目名称:kofradia,代码行数:31,代码来源:finn.php

示例8: 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">&laquo; 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>&nbsp;</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>';
    }
开发者ID:Kuzat,项目名称:kofradia,代码行数:74,代码来源:ranklist.php

示例9: while

    $anon = $last_visitor_anon ? '
				<dt>Anonym</dt>
				<dd>' . game::timespan($last_visitor_anon, game::TIME_ABS) . '</dd>' : '';
    $i = 0;
    while ($row = $last_visitors->fetch()) {
        if ($i++ == $last_visitors_limit) {
            break;
        }
        // anonym?
        if ($last_visitor_anon && $last_visitor_anon > $row['time']) {
            echo $anon;
            $anon = false;
        }
        echo '
				<dt>' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</dt>
				<dd>' . game::timespan($row['time'], game::TIME_ABS) . '</dd>';
    }
    // anonym?
    if ($anon && $i <= $last_visitors_limit) {
        echo $anon;
    }
    echo '
			</dl>';
}
echo '
		</div>';
// prestasjoner
echo '
		<div class="section">
			<h2>Prestasjoner <img src="' . STATIC_LINK . '/icon/ruby.png" alt="" title="Oppnådde prestasjoner" style="vertical-align: bottom; margin-top: -2px" /></h2>';
// hent alle prestasjonene
开发者ID:Kuzat,项目名称:kofradia,代码行数:31,代码来源:profil.php

示例10: while

		<tr>
			<th class="name">Spiller ' . $sort->show_link(0, 1) . ' (' . $sort->show_link(2, 3) . ')</th>
			<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>';
        }
开发者ID:Kuzat,项目名称:kofradia,代码行数:31,代码来源:finn_spiller.php

示例11: header

})();
</script>';
    die;
}
header("Content-Type: text/xml");
echo '<?xml version="1.0" encoding="utf-8"?>
<playerinfo>
	<up_id>' . $player['up_id'] . '</up_id>
	<url>' . htmlspecialchars($__server['relative_path'] . "/p/" . rawurlencode($player['up_name']) . "/" . $player['up_id']) . '</url>
	<up_name>' . htmlspecialchars($player['up_name']) . '</up_name>
	<up_name_display>' . htmlspecialchars(game::profile_link($player['up_id'], $player['up_name'], $player['up_access_level'])) . '</up_name_display>
	<status>' . htmlspecialchars($status) . '</status>
	<reg_time_abs>' . htmlspecialchars($_base->date->get($player['up_created_time'])->format(date::FORMAT_SEC)) . '</reg_time_abs>
	<reg_time_rel>' . htmlspecialchars(game::timespan($player['up_created_time'], game::TIME_ABS)) . '</reg_time_rel>
	<last_online_abs>' . htmlspecialchars($_base->date->get($player['up_last_online'])->format(date::FORMAT_SEC)) . '</last_online_abs>
	<last_online_rel>' . htmlspecialchars(game::timespan($player['up_last_online'], game::TIME_ABS)) . '</last_online_rel>
	<activated>' . htmlspecialchars($player['up_access_level'] == 0 ? 0 : 1) . '</activated>
	<profile_image>' . htmlspecialchars($profile_image) . '</profile_image>
	<rank_name>' . htmlspecialchars($rank['name'] . ($rank['orig'] ? ' (' . $rank['orig'] . ')' : '')) . '</rank_name>';
// moderator stæsj
if ($mod) {
    echo '
	<ip>' . $player['u_online_ip'] . '</ip>
	<email>' . htmlspecialchars($player['u_email']) . '</email>
	<hits>' . $player['up_hits'] . '</hits>
	<money>' . game::format_cash($player['money']) . '</money>';
}
echo '
	<contact>' . $is_contact . '</contact>
	<block>' . $is_block . '</block>
	<ff_list>';
开发者ID:Kuzat,项目名称:kofradia,代码行数:31,代码来源:get_player_info.php

示例12: handle

    /**
     * Send lenke med autologin
     */
    protected function handle()
    {
        // mangler eller ugyldig nøkkel?
        if (!isset($_POST['key']) || !isset($_SESSION['glemtpassord_key']) || $_POST['key'] != $_SESSION['glemtpassord_key']) {
            ess::$b->page->add_message("Ugyldig forespørsel. Prøv på nytt.", "error");
            return;
        }
        // sjekk e-post
        $epost = trim(postval("epost"));
        if (empty($epost)) {
            ess::$b->page->add_message("Du må fylle inn e-postadressen din.", "error");
            return;
        }
        // sjekk om det er noen oppføringer med denne e-posten i databasen (og hent de som lever)
        $result = \Kofradia\DB::get()->query("SELECT u_id, up_name, up_access_level, u_pass_change, u_email FROM users LEFT JOIN users_players ON u_active_up_id = up_id WHERE u_email = " . \Kofradia\DB::quote($epost) . " AND u_access_level != 0");
        // ingen?
        if ($result->rowCount() == 0) {
            ess::$b->page->add_message('Fant ingen bruker som hadde e-postadressen ' . htmlspecialchars($epost) . '. Du finner ikke din bruker dersom <u>brukeren</u> er deaktivert. Dersom du har blitt deaktivert og mener dette er feil ta <a href="henvendelser">kontakt</a>.', "error");
            return;
        }
        // flere e-postadresser?
        if ($result->rowCount() > 1) {
            ess::$b->page->add_message('Det finnes flere brukere som er registrert på ' . htmlspecialchars($epost) . '. Vennligst ta <a href="henvendelser">kontakt</a>!', "error");
            redirect::handle();
        }
        $row = $result->fetch();
        // er det noen oppføring for når passordet sist ble oppdatert?
        if (!empty($row['u_pass_change'])) {
            $info = explode(";", $row['u_pass_change']);
            // A;<timestamp>;<ip>[;hash]			-- asked	- bedt om nytt pass
            // C;<timestamp>;<ip>					-- changed	- endret pass
            // bedt om pass (A - asked)
            if ($info[0] == "A") {
                // når?
                $when = intval($info[1]);
                $wait = max(0, $when + self::WAIT - time());
                if ($wait > 0) {
                    ess::$b->page->add_message("Du benyttet deg av glemt passord " . ess::$b->date->get($when)->format() . ", og må vente " . game::timespan($wait, game::TIME_FULL) . " før du kan benytte deg av glemt passord på nytt. Se e-posten du skal ha mottatt!", "error");
                    return;
                }
            }
        }
        // legg inn i databasen
        \Kofradia\DB::get()->exec("UPDATE users SET u_pass_change = 'A;" . time() . ";{$_SERVER['REMOTE_ADDR']}' WHERE u_id = {$row['u_id']}");
        // generer autologin
        $hash = \Kofradia\Users\Autologin::generate($row['u_id'], time() + self::AUTOLOGIN_TIME, null, \Kofradia\Users\Autologin::TYPE_RESET_PASS);
        // send e-post
        $email = new email();
        $email->text = 'Hei,

Du har bedt om å nullstille ditt passord på ' . ess::$s['path'] . ' fra IP-en ' . $_SERVER['REMOTE_ADDR'] . ' (' . $_SERVER['HTTP_USER_AGENT'] . ').

Ved å benytte lenken nedenfor vil passordet på brukeren din bli nullstilt, du blir automatisk logget inn og kan fylle inn ditt nye passord:
' . \Kofradia\Users\Autologin::generateUrl($hash) . '

Hvis du ikke ønsker å nullstille ditt passord kan du se bort fra denne e-posten.

--
www.kofradia.no';
        $email->headers['X-SMafia-IP'] = $_SERVER['REMOTE_ADDR'];
        $email->headers['Reply-To'] = "henvendelse@smafia.no";
        $email->send($epost, "Nullstille ditt passord");
        // logg dette
        putlog("NOTICE", "%c7%bNULLSTILLE PASSORD:%b%c %u{$_SERVER['REMOTE_ADDR']}%u ba om e-post for å nullstille passordet %u{$epost}%u (%u{$row['up_name']}%u)");
        // gi infomelding
        ess::$b->page->add_message("Vi har sendt deg en e-post til <b>" . htmlspecialchars($row['u_email']) . "</b>.<br />Benytt denne for å nullstille passordet ditt.");
        redirect::handle("", redirect::ROOT);
    }
开发者ID:Kuzat,项目名称:kofradia,代码行数:71,代码来源:glemt_passord.php

示例13: while

	<thead>
		<tr>
			<th>Bruker/spiller</th>
			<th>Type blokkering</th>
			<th>Ble utestengt</th>
			<th>Utestengt til</th>
			<th>Begrunnelse</th>
			<th>Intern info</th>
		</tr>
	</thead>
	<tbody>';
    $i = 0;
    while ($row = $result->fetch()) {
        $access = access::has(blokkeringer::$types[$row['ub_type']]['access']);
        echo '
		<tr' . (++$i % 2 == 0 ? ' class="color"' : '') . '>
			<td>' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</td>
			<td>' . ($access ? '<a href="' . $__server['relative_path'] . '/min_side?u_id=' . $row['u_id'] . '&amp;b=blokk&amp;t=' . $row['ub_type'] . '">' : '') . htmlspecialchars(blokkeringer::$types[$row['ub_type']]['title']) . ($access ? '</a>' : '') . '</td>
			<td>' . $_base->date->get($row['ub_time_added'])->format(date::FORMAT_SEC) . '</td>
			<td>' . $_base->date->get($row['ub_time_expire'])->format(date::FORMAT_SEC) . '<br />
			' . game::timespan($row['ub_time_expire'], game::TIME_ABS) . '</td>
			<td>' . game::format_data($row['ub_reason'], "bb-opt", "Ingen begrunnelse oppgitt.") . '</td>
			<td>' . game::format_data($row['ub_note'], "bb-opt", "Ingen begrunnelse oppgitt.") . '</td>
		</tr>';
    }
    echo '
	</tbody>
</table>
<p>' . $pagei->pagenumbers() . '</p>';
}
$_base->page->load();
开发者ID:Kuzat,项目名称:kofradia,代码行数:31,代码来源:banned.php

示例14: attack

 /**
  * Angrep en annen spiller
  * @param player $up spilleren man angriper
  * @param int $bullets antall kuler man bruker
  */
 public function attack(player $up, $bullets)
 {
     \Kofradia\DB::get()->beginTransaction();
     // beregn skadeprosent
     $skade = $this->calc_damage($up, $bullets);
     $skadeprosent = $skade[2];
     // tilfeldig skadeprosent
     $skadeprosent *= rand(7500, 10000) / 10000;
     // kalkuler hvor mye helse spilleren skal miste
     $miste_helse = $skadeprosent * self::MAX_ATTACK_HEALTH;
     // sett ned helsen til spilleren og behandle spilleren
     $ret = $up->health_decrease($miste_helse, $this->up, player::ATTACK_TYPE_KILL, $skadeprosent, array("bullets" => $bullets, "attack_skade" => $skade, "skadeprosent" => $skadeprosent));
     if (!$ret) {
         \Kofradia\DB::get()->commit();
         return false;
     }
     // ble drept?
     if ($ret['drept']) {
         // øk wanted nivået
         $ret['fengsel'] = $this->up->fengsel_rank($ret['rankpoeng'], true);
     } else {
         // sett angriper i fengsel
         $tid = rand(300, 600);
         $ret['fengsel'] = $this->up->fengsel_rank($ret['rankpoeng'], false, true, $tid);
         putlog("DF", " - Fengsel i " . game::timespan($tid, game::TIME_NOBOLD | game::TIME_ALL | game::TIME_FULL));
     }
     // sett ny energi for angriper
     $m = $ret['drept'] ? 0.6 : 0.8;
     // faktoren med hvor mye energi man mister
     $m *= $skadeprosent;
     $m = 1 - $m;
     \Kofradia\DB::get()->exec("UPDATE users_players SET up_energy = GREATEST(0, up_energy * {$m}) WHERE up_id = {$this->up->id}");
     $this->up->data['up_energy'] = max(0, $this->up->data['up_energy'] * $m);
     // gjennomfør transaksjon
     \Kofradia\DB::get()->commit();
     return $ret;
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:42,代码来源:class.drap.php

示例15: run

 /** Kjør rutine */
 private function run($row)
 {
     global $_base;
     // marker som opptatt
     $a = \Kofradia\DB::get()->exec("UPDATE scheduler SET s_count = s_count + 1, s_previous = {$this->start}, s_expire = " . ($this->start + 600) . " WHERE s_name = " . \Kofradia\DB::quote($row['s_name']) . " AND s_count = {$row['s_count']}");
     // ikke oppdater - hopp over (en annen holder mest sannsynlig på)
     if ($a == 0) {
         return;
     }
     ++$this->count;
     // finn ut når rutinen skal utføres neste gang
     $next = $this->next($row['s_hours'], $row['s_minutes'], $row['s_seconds']);
     // sjekk om filen finnes
     $path = PATH_APP . "/scheduler/" . $row['s_file'];
     if (!file_exists($path)) {
         // lagre logg
         putlog("NOTICE", "%bScheduler:%b ERROR: Scriptfil %u{$row['s_file']}%u for %u{$row['s_name']}%u finnes ikke!");
         sysreport::log("Scheduler - scriptfil mangler", "Scriptfil '{$row['s_file']}' for '{$row['s_name']}' finnes ikke!");
     } else {
         $start = microtime(true);
         // benytt egen funksjon for å hindre overskriving av variabler
         if ($this->load($path) == "skip_next") {
             $scheduler_skip_next = true;
         }
         $next_r = isset($scheduler_skip_next) ? '' : " - neste: " . $_base->date->get($next)->format(date::FORMAT_SEC) . " (" . game::timespan($next, game::TIME_ABS | game::TIME_NOBOLD) . ")";
         putlog("SPAM", "%bScheduler:%b Rutinen %u{$row['s_name']}%u ble utført (" . number_format(round(microtime(true) - $start, 6), 6, ",", ".") . " sekunder){$next_r}");
     }
     $s_next = isset($scheduler_skip_next) ? '' : ', s_next = ' . $next;
     \Kofradia\DB::get()->exec("UPDATE scheduler SET s_expire = 0{$s_next} WHERE s_name = " . \Kofradia\DB::quote($row['s_name']) . " AND s_count = " . ($row['s_count'] + 1));
 }
开发者ID:Kuzat,项目名称:kofradia,代码行数:31,代码来源:class.scheduler.php


注:本文中的game::timespan方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。