本文整理汇总了PHP中access::types方法的典型用法代码示例。如果您正苦于以下问题:PHP access::types方法的具体用法?PHP access::types怎么用?PHP access::types使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类access
的用法示例。
在下文中一共展示了access::types方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: time
$player->data['up_profile_hits']++;
}
}
// hent siste besøkende
$expire = time() - 604800;
// 1 uke
$last_visitors_limit = 7;
$last_visitors = \Kofradia\DB::get()->query("\n\tSELECT up_id, up_name, up_access_level, time\n\tFROM users_views JOIN users_players ON up_id = uv_visitor_up_id\n\tWHERE uv_up_id = {$player->id} AND time > {$expire}\n\tORDER BY time DESC LIMIT {$last_visitors_limit}");
$last_visitor_anon = $player->data['up_profile_anon_time'] && $player->data['up_profile_anon_time'] > $expire ? $player->data['up_profile_anon_time'] : false;
// sett opp navnet
$name = htmlspecialchars($player->data['up_name']);
// drept?
if ($player->data['up_access_level'] == 0 && $player->data['up_deactivated_dead'] != 0) {
$name .= ' <span class="c_deactivated">[Død]</span>';
} else {
$types = access::types($player->data['up_access_level']);
if (!in_array("none", $types)) {
$type = access::type($player->data['up_access_level']);
$type_name = access::name($type);
$class = access::html_class($type);
$name .= ' <span class="' . $class . '">[' . htmlspecialchars($type_name) . ']</span>';
}
}
// finn ut rankplassering denne timen
$result = \Kofradia\DB::get()->query("\n\tSELECT COUNT(ref.uhi_up_id)+1, SUM(users_hits.uhi_points)\n\tFROM users_hits LEFT JOIN users_hits ref ON ref.uhi_points > users_hits.uhi_points AND ref.uhi_secs_hour = users_hits.uhi_secs_hour\n\tWHERE users_hits.uhi_secs_hour = " . login::get_secs_hour() . " AND users_hits.uhi_up_id = {$player->id}\n\tGROUP BY users_hits.uhi_secs_hour, users_hits.uhi_up_id");
$row = $result->fetch(\PDO::FETCH_NUM);
$rank_hour_pos = $row ? $row[1] == 0 ? 'Ingen' : '#' . game::format_number($row[0]) : 'Ingen';
// pengerank
$result = \Kofradia\DB::get()->query("SELECT COUNT(up_id)+1 FROM users_players WHERE up_cash+up_bank > CAST({$player->data['up_cash']} AS UNSIGNED)+CAST({$player->data['up_bank']} AS UNSIGNED) AND up_access_level < {$_game['access_noplay']} AND up_access_level != 0");
$pengeplassering = $result->fetchColumn(0);
$pengerank = "Ubetydelig";
示例2: create_handle
protected function create_handle()
{
// er det noen mottakere som ikke ble funnet?
if (count($this->receivers) != count($this->players_list)) {
$this->report_missing();
}
// noen infomeldinger
if (count($this->infos) > 0) {
ess::$b->page->add_message(implode("<br />", $this->infos));
}
// noen feil?
if (count($this->errors) > 0) {
ess::$b->page->add_message(implode("<br />", $this->errors), "error");
return;
}
// ingen mottakere?
if (count($this->receivers) == 0) {
ess::$b->page->add_message("Du må velge en eller flere mottakere.", "error");
return;
}
// for mange mottakere?
if (count($this->receivers) > $this->receivers_limit) {
ess::$b->page->add_message("Du har valgt for mange mottakere. Du har en grense på <b>{$this->receivers_limit}</b> spillere.", "error");
return;
}
// blokkert fra å sende meldinger? (kan kun sende til Crewet og med 1 mottaker)
$blokkering = blokkeringer::check(blokkeringer::TYPE_MELDINGER);
$blokkering_ok = true;
if ($blokkering && count($this->receivers) == 1) {
// kontroller at den ene mottakeren vi har valgt er i Crewet (tilgang til "crewet")
$row = reset($this->receivers);
$result = \Kofradia\DB::get()->query("SELECT up_access_level FROM users_players WHERE up_id = {$row['up_id']}");
$row = $result->fetch();
if (!$row || !in_array("crewet", access::types($row['up_access_level']))) {
$blokkering_ok = false;
}
}
// er mottakere crew?
$receivers_crew = true;
foreach ($this->receivers as $row) {
if (!in_array("crewet", access::types($row['up_access_level']))) {
$receivers_crew = false;
break;
}
}
// blokkert og for mange mottakere?
if ($blokkering && count($this->receivers) > 1) {
ess::$b->page->add_message("Du er blokkert fra å sende meldinger til andre enn Crewet. Du kan kun ha én mottaker. Blokkeringen varer til " . ess::$b->date->get($blokkering['ub_time_expire'])->format(date::FORMAT_SEC) . ".<br /><b>Begrunnelse:</b> " . game::format_data($blokkering['ub_reason'], "bb-opt", "Ingen begrunnelse gitt."), "error");
return;
}
// blokkert og mottaker er ikke i Crewet?
if (!$blokkering_ok) {
ess::$b->page->add_message("Du er blokkert fra å sende meldinger til andre enn Crewet. Blokkeringen varer til " . ess::$b->date->get($blokkering['ub_time_expire'])->format(date::FORMAT_SEC) . ".<br /><b>Begrunnelse:</b> " . game::format_data($blokkering['ub_reason'], "bb-opt", "Ingen begrunnelse gitt."), "error");
return;
}
// er spilleren deaktivert, og mottakere er ikke crew?
if (!login::$user->player->active && (!$receivers_crew || count($this->receivers) > 1)) {
ess::$b->page->add_message("Din spiller er deaktivert. Du har kun mulighet til å sende meldinger til Crewet. Kun én deltaker kan legges til.");
return;
}
// ikke sende enda?
if (!isset($_POST['post'])) {
return;
}
// kontroller ventetid
if (!$this->check_wait()) {
return;
}
// behandle innhold
$title = trim(postval("title"));
$message = trim(postval("message"));
// lengde
$plain = strip_tags(game::bb_to_html($message));
$plain = preg_replace("/[^a-zA-ZæøåÆØÅ0-9]/u", '', $plain);
// er ikke begge feltene fylt ut?
if (empty($title) || empty($message)) {
ess::$b->page->add_message("Både tittelfeltet og tekstfeltet må fylles ut.", "error");
return;
}
// for kort tittel?
if (mb_strlen($title) < 2) {
ess::$b->page->add_message("Tittelfeltet må inneholde minst 2 tegn.", "error");
return;
}
// for lang tittel?
if (mb_strlen($title) > 35) {
ess::$b->page->add_message("Tittelfeltet kan ikke være lengre enn 35 tegn.", "error");
return;
}
// for kort melding?
if (mb_strlen($plain) < 10) {
ess::$b->page->add_message("Meldingen kan ikke inneholde færre enn 10 bokstaver/tall.", "error");
return;
}
$it_id = login::$user->player->send_message($this->receivers, $title, $message);
redirect::handle("innboks_les?id={$it_id}");
}
示例3: ucfirst
$type = ff::$types[$row['ff_type']];
$row['posisjon'] = ucfirst($type['priority'][$row['ffm_priority']]);
$ff[] = $row;
}
// profilbildet
$profile_image = player::get_profile_image_static($player['up_profile_image_url']);
// ranken
$rank = game::rank_info($player['up_points'], $player['upr_rank_pos'], $player['up_access_level']);
#$rank_name = $rank['name'];
// statusen
$status = "";
// drept?
if ($player['up_access_level'] == 0 && $player['up_deactivated_dead'] != 0) {
$status = '<span class="c_deactivated">[Død]</span>';
} else {
$types = access::types($player['up_access_level']);
if (!in_array("none", $types)) {
$type = access::type($player['up_access_level']);
$type_name = access::name($type);
$class = access::html_class($type);
$status = '<span class="' . $class . '">[' . htmlspecialchars($type_name) . ']</span>';
}
// nostat?
if ($player['up_access_level'] >= ess::$g['access_noplay'] && $player['up_access_level'] != ess::$g['access']['nostat'][0]) {
if ($status != "") {
$status .= " ";
}
$status .= '[nostat]';
}
}
// kontakt og blokkering
示例4: load_user
/**
* Last inn brukeren
*/
protected static function load_user($u_id)
{
global $_base, $_game;
if (!self::$logged_in) {
return;
}
// last inn brukeren
if (!user::get($u_id, true)) {
self::logout();
}
// utvidede tilganger
if (self::$user->data['u_access_level'] != 1 && self::$user->data['u_access_level'] != 0 && in_array(self::$user->data['u_access_level'], $_game['access']['crewet'])) {
// logget inn, ikke inaktiv mer enn 30 min og samme tilgangsnøkkel?
$time = time();
$key = self::$user->params->get("extended_access_passkey");
if (isset($_SESSION[$GLOBALS['__server']['session_prefix'] . 'extended_access']['authed']) && $_SESSION[$GLOBALS['__server']['session_prefix'] . 'extended_access']['auth_check'] + 1800 > $time && $_SESSION[$GLOBALS['__server']['session_prefix'] . 'extended_access']['passkey'] == $key) {
$_SESSION[$GLOBALS['__server']['session_prefix'] . 'extended_access']['auth_check'] = $time;
self::$extended_access = $_SESSION[$GLOBALS['__server']['session_prefix'] . 'extended_access'];
} else {
self::$extended_access = array("authed" => NULL, "auth_time" => 0, "auth_check" => 0, "passkey" => $key);
$_SESSION[$GLOBALS['__server']['session_prefix'] . 'extended_access'] = self::$extended_access;
}
}
// trenger vi å hente nye kontakter?
if (!isset($_SESSION[$GLOBALS['__server']['session_prefix'] . 'login_info']['contacts_update']) || $_SESSION[$GLOBALS['__server']['session_prefix'] . 'login_info']['contacts_update'] != self::$user->data['u_contacts_update_time']) {
// kontakter
self::$info['contacts'] = array(1 => array(), 2 => array());
$result = \Kofradia\DB::get()->query("SELECT uc_id, uc_contact_up_id, uc_time, uc_type, up_name, up_access_level FROM users_contacts LEFT JOIN users_players ON up_id = uc_contact_up_id WHERE uc_u_id = {$u_id} ORDER BY uc_type, up_name ASC");
while ($row = $result->fetch()) {
self::$info['contacts'][$row['uc_type']][$row['uc_contact_up_id']] = $row;
}
unset($result);
self::$info['contacts_update'] = self::$user->data['u_contacts_update_time'];
} else {
self::$info['contacts'] = $_SESSION[$GLOBALS['__server']['session_prefix'] . 'login_info']['contacts'];
self::$info['contacts_update'] = $_SESSION[$GLOBALS['__server']['session_prefix'] . 'login_info']['contacts_update'];
}
// lagre session
$_SESSION[$GLOBALS['__server']['session_prefix'] . 'logged_in'] = true;
$_SESSION[$GLOBALS['__server']['session_prefix'] . 'login_info'] =& self::$info;
$_SESSION[$GLOBALS['__server']['session_prefix'] . 'user'] = self::$user;
if (!isset($_SESSION[$GLOBALS['__server']['session_prefix'] . 'data'])) {
$_SESSION[$GLOBALS['__server']['session_prefix'] . 'data'] = array();
}
self::$data =& $_SESSION[$GLOBALS['__server']['session_prefix'] . 'data'];
// sett opp tilganger for ajax etc
$_SESSION[$GLOBALS['__server']['session_prefix'] . 'login_info']['accesses'] = access::types(self::$user->data['u_access_level']);
if (self::$user->data['u_access_level'] != 1 && self::$user->data['u_access_level'] != 0 && !isset(self::$extended_access['authed'])) {
$_SESSION[$GLOBALS['__server']['session_prefix'] . 'login_info']['accesses'] = access::types(1);
}
}
示例5: reply_test
/**
* Kontroller mulighet til å svare på meldingentråden
* @return boolean true hvis vi kan fortsette sending
*/
public function reply_test()
{
// er ikke logget inn?
if (!login::$logged_in) {
throw new HSException("Ikke logget inn.");
}
// kan vi ikke svare på denne meldingen?
if (!$this->can_reply_access) {
$this->handle_ret(self::RET_ERROR_CANNOT_REPLY);
return false;
}
// er det ingen mottakere vi kan sende til?
if (!$this->can_reply_receivers) {
$this->handle_ret(self::RET_ERROR_NO_RECEIVERS);
return false;
}
// hent kontaktstatus for mottakerene
$result = \Kofradia\DB::get()->query("\n\t\t\tSELECT up_id, up_name, up_access_level, uc_id, uc_info\n\t\t\tFROM users_players, users LEFT JOIN users_contacts ON u_id = uc_u_id AND uc_contact_up_id = " . login::$user->player->id . " AND uc_type = 2\n\t\t\tWHERE up_u_id = u_id AND up_id IN (" . implode(",", $this->receivers_accept) . ")");
$blocked = array();
while ($row = $result->fetch()) {
// blokkert?
if ($row['uc_id']) {
$blocked[] = $row;
}
}
// blokkert fra å sende meldinger? (kan kun sende til Crewet og med 1 mottaker)
$blokkering = blokkeringer::check(blokkeringer::TYPE_MELDINGER);
$blokkering_ok = true;
if ($blokkering && count($this->receivers_accept) == 1) {
// kontroller at den ene mottakeren vi har er i Crewet (tilgang til "crewet")
if (!in_array("crewet", access::types($this->receivers[reset($this->receivers_accept)]['up_access_level']))) {
$blokkering_ok = false;
}
}
// blokkert og for mange mottakere?
if ($blokkering && count($this->receivers_accept) > 1) {
$this->handle_ret(self::RET_ERROR_BAN_CREW);
return false;
}
// blokkert og mottaker er ikke i Crewet?
if (!$blokkering_ok) {
$this->handle_ret(self::RET_ERROR_BAN);
return false;
}
// sjekk om noen av brukerene har blokkert personen
if (count($blocked) > 0 && !access::has("crewet")) {
$this->handle_ret(self::RET_ERROR_BLOCKED, $blocked);
return false;
}
// har noen egentlig blokkert oss?
if (count($blocked) > 0) {
$this->handle_ret(self::RET_INFO_BLOCKED, $blocked);
}
// kan fortsette med sending
return true;
}
示例6: parse_html
// hent egen informasjon
// TODO: Velge kun det vi skal bruke?
$result = \Kofradia\DB::get()->query("\n\tSELECT\n\t\tusers_players.*,\n\t\tupr_rank_pos,\n\t\tusers.*,\n\t\tup_cash + up_bank AS money\n\tFROM\n\t\tusers_players\n\t\tLEFT JOIN users_players_rank ON upr_up_id = up_id,\n\t\tusers\n\tWHERE up_id = " . login::$user->player->id . " AND up_u_id = u_id\n\tGROUP BY up_id");
// fant ikke?
if ($result->rowCount() == 0) {
ajax::text("ERROR:NO-USER", ajax::TYPE_404);
}
// les info
$user = $result->fetch();
// profilbilde
$profile_image = parse_html(player::get_profile_image_static($user['up_profile_image_url']));
// ranken
$rank = game::rank_info($user['up_points'], $user['upr_rank_pos'], $user['up_access_level']);
// statusen
$status = "";
$types = access::types($user['up_access_level']);
if (!in_array("none", $types)) {
$type = access::type($user['up_access_level']);
$type_name = access::name($type);
$class = access::html_class($type);
$status = '<span class="' . $class . '">[' . htmlspecialchars($type_name) . ']</span>';
}
// bydel
$bydel = game::$bydeler[$user['up_b_id']];
$health = $user['up_health'] / $user['up_health_max'] * 100;
$energy = $user['up_energy'] / $user['up_energy_max'] * 100;
// xml
ajax::xml('<userinfo u_id="' . $user['u_id'] . '">
<u_id>' . $user['u_id'] . '</u_id>
<u_reg_time_abs>' . htmlspecialchars($_base->date->get($user['u_created_time'])->format(date::FORMAT_SEC)) . '</u_reg_time_abs>
<u_reg_time_rel>' . htmlspecialchars(game::timespan($user['u_created_time'], game::TIME_ABS)) . '</u_reg_time_rel>
示例7: get_messages
/**
* Hent meldinger og data for meldingene
*/
public function get_messages(pagei $pagei, $show_deleted = false)
{
$result = $pagei->query("\n\t\t\tSELECT it_id, it_title, ir_unread, ir_restrict_im_time, ir_up_id, ir_deleted, ir_marked, COUNT(im_id) num_messages\n\t\t\tFROM inbox_threads\n\t\t\t\tJOIN inbox_rel ON it_id = ir_it_id\n\t\t\t\tJOIN users_players ON up_u_id = {$this->u->id} AND ir_up_id = up_id\n\t\t\t\tJOIN inbox_messages ON im_it_id = it_id AND im_deleted = 0 AND im_time <= ir_restrict_im_time\n\t\t\tWHERE 1" . ($show_deleted ? '' : ' AND ir_deleted = 0') . "\n\t\t\tGROUP BY it_id\n\t\t\tORDER BY (ir_unread != 0 AND ir_deleted = 0) DESC, ir_marked = 0, ir_restrict_im_time DESC");
// ingen meldinger?
if ($pagei->total == 0) {
return array();
}
// sett opp data for meldingene
$meldinger = array();
$prev = array();
while ($row = $result->fetch()) {
$row['up_prev'] = false;
$row['up_prev_other'] = false;
$row['id_text'] = '';
$row['receivers'] = array();
$row['receivers_ok'] = false;
$row['receivers_crew'] = true;
$prev[] = $row['it_id'];
$meldinger[$row['it_id']] = $row;
}
// hent alle deltakerene i meldingstrådene som skal listes opp
$result = \Kofradia\DB::get()->query("\n\t\t\tSELECT ir_it_id, ir_up_id, ir_unread, ir_views, ir_deleted, ir_restrict_im_time, ir_marked, COUNT(im_id) AS num_messages, up_access_level, up_u_id, u_access_level, u_active_up_id\n\t\t\tFROM inbox_rel\n\t\t\t\tJOIN (\n\t\t\t\t\tSELECT ir_it_id ref_it_id, MAX(ir_restrict_im_time) ref_ir_restrict_im_time\n\t\t\t\t\tFROM inbox_rel, users_players\n\t\t\t\t\tWHERE ir_it_id IN (" . implode(",", $prev) . ") AND up_id = ir_up_id AND up_u_id = {$this->u->id}\n\t\t\t\t\tGROUP BY ir_it_id\n\t\t\t\t\tORDER BY up_last_online DESC\n\t\t\t\t) ref ON ref_it_id = ir_it_id\n\t\t\t\tLEFT JOIN inbox_messages ON im_it_id = ir_it_id AND im_up_id = ir_up_id AND im_deleted = 0 AND im_time <= ref_ir_restrict_im_time\n\t\t\t\tLEFT JOIN users_players ON up_id = ir_up_id\n\t\t\t\tLEFT JOIN users ON u_id = up_u_id\n\t\t\tWHERE ir_it_id IN (" . implode(",", $prev) . ")\n\t\t\tGROUP BY ir_it_id, ir_up_id\n\t\t\tORDER BY up_name");
$c = access::has("crewet");
while ($row = $result->fetch()) {
$meldinger[$row['ir_it_id']]['receivers'][] = $row;
if ($row['ir_up_id'] != $this->u->player->id && $row['ir_deleted'] == 0 && ($row['up_access_level'] != 0 || $c && $row['u_access_level'] != 0 && $row['u_active_up_id'] == $row['ir_up_id'])) {
$meldinger[$row['ir_it_id']]['receivers_ok'] = true;
if ($meldinger[$row['ir_it_id']]['receivers_crew'] && !in_array("crewet", access::types($row['up_access_level']))) {
$meldinger[$row['ir_it_id']]['receivers_crew'] = false;
}
}
}
// hent spillerene som har skrevet siste melding (inkludert meg)
$im_id = array();
$result = \Kofradia\DB::get()->query("\n\t\t\tSELECT im_id, im_it_id, im_up_id, is_self\n\t\t\tFROM (\n\t\t\t\tSELECT im_id, im_it_id, im_up_id, IF(up1.up_u_id = {$this->u->id}, 1, 0) is_self\n\t\t\t\tFROM inbox_messages\n\t\t\t\t\tJOIN users_players up1 ON up1.up_id = im_up_id\n\t\t\t\t\tJOIN users_players up2 ON up2.up_u_id = {$this->u->id}\n\t\t\t\t\tJOIN inbox_rel ON im_it_id = ir_it_id AND ir_up_id = up2.up_id AND im_time <= ir_restrict_im_time\n\t\t\t\tWHERE im_it_id IN (" . implode(",", $prev) . ") AND im_deleted = 0\n\t\t\t\tORDER BY im_id DESC\n\t\t\t) AS ref\n\t\t\tGROUP BY im_it_id");
$others = array();
while ($row = $result->fetch()) {
$meldinger[$row['im_it_id']]['up_prev'] = array($row['is_self'], $row['im_up_id']);
$im_id[$row['im_id']] = $row['im_it_id'];
if ($row['is_self']) {
$others[] = $row['im_it_id'];
}
}
// skal vi hente tidligere avsender? (vi har svart sist)
if (count($others) > 0) {
// hent spillerene som har skrevet siste melding (ekskludert meg)
$result = \Kofradia\DB::get()->query("\n\t\t\t\tSELECT im_it_id, im_up_id\n\t\t\t\tFROM (\n\t\t\t\t\tSELECT im_it_id, im_up_id\n\t\t\t\t\tFROM inbox_messages\n\t\t\t\t\t\tJOIN users_players up1 ON up1.up_id = im_up_id AND up1.up_u_id != {$this->u->id}\n\t\t\t\t\t\tJOIN users_players up2 ON up2.up_u_id = {$this->u->id}\n\t\t\t\t\t\tJOIN inbox_rel ON im_it_id = ir_it_id AND ir_up_id = up2.up_id AND im_time <= ir_restrict_im_time\n\t\t\t\t\tWHERE im_it_id IN (" . implode(",", $others) . ") AND im_deleted = 0\n\t\t\t\t\tORDER BY im_id DESC\n\t\t\t\t) AS ref\n\t\t\t\tGROUP BY im_it_id");
$others = array();
while ($row = $result->fetch()) {
$meldinger[$row['im_it_id']]['up_prev_other'] = $row;
}
}
// hent innholdet til de siste meldingene
if (count($im_id) > 0) {
$result = \Kofradia\DB::get()->query("\n\t\t\t\tSELECT id_im_id, id_text FROM inbox_data WHERE id_im_id IN (" . implode(",", array_keys($im_id)) . ")");
$max = 50;
while ($row = $result->fetch()) {
$d = strip_tags(game::format_data($row['id_text']));
$d = preg_replace("/(^ +| +\$|\\r)/mu", "", $d);
$d = preg_replace("/(?<![!,.\\n ])\\n/u", ". ", $d);
$d = preg_replace("/\\n/u", " ", $d);
$d = preg_replace("/ +/u", " ", $d);
$d = trim($d);
if (mb_strlen($d) > $max) {
// TODO: Flytt funksjon til en klasse/funksjon så den kan gjenbrukes av andre sider
// forsøk å bryt på et mellomrom
$pos = mb_strpos($d, " ", $max - 10);
if ($pos !== false && $pos < $max) {
$d = mb_substr($d, 0, $pos) . " ...";
} else {
$d = mb_substr($d, 0, $max - 3) . "...";
}
}
$meldinger[$im_id[$row['id_im_id']]]['id_text'] = $d;
}
}
return $meldinger;
}