Example #1
0
 /** Hent diverse bruker funksjoner */
 protected function load_user_stuff()
 {
     // queries info
     if (access::has("admin") && isset($_COOKIE['show_queries_info'])) {
         define("SHOW_QUERIES_INFO", true);
     }
 }
Example #2
0
 /**
  * Legg til element
  * @param $elm_id
  * @param $mode_admin
  */
 public static function add_element($elm_id, $mode_admin = NULL)
 {
     // sjekk admin
     if (is_null($mode_admin)) {
         if (access::has("crewet")) {
             $mode_admin = true;
         } else {
             $mode_admin = false;
         }
     } elseif (!is_bool($mode_admin)) {
         $mode_admin = false;
     }
     $mode = $mode_admin ? "admin" : "normal";
     // legg til i lista
     self::$elements[$mode][] = htmlspecialchars($elm_id);
 }
Example #3
0
    /**
     * Construct
     */
    public function __construct()
    {
        $this->ff = ff::get_ff();
        $this->ff->needaccess(2, "Du har ikke tilgang til denne banken.");
        $this->priority_write = $this->ff->get_bank_write_priority();
        if (false && !access::has("admin")) {
            echo '
<div class="bg1_c xsmall">
	<h1 class="bg1">' . ucfirst($this->ff->type['type']) . 'bank stengt<span class="left"></span><span class="right"></span></h1>
	<div class="bg1">
		<p>' . ucfirst($this->ff->type['type']) . 'banken er stengt for å unngå distribusjon av penger. Pengenivået vil bli justert til å være ihht. verdiene ved midnatt.</p>
	</div>
</div>';
            $this->ff->load_page();
        }
        redirect::store("banken?ff_id={$this->ff->id}");
        ess::$b->page->add_title("Banken");
        $this->nostat = access::is_nostat() && login::$user->player->id != 1;
        // kontroller at vi har bankkonto
        if (!login::$user->player->user->data['u_bank_auth']) {
            ess::$b->page->add_message("Banken for {$this->ff->type['refobj']} benytter seg av passordet i din vanlige bank. For å få tilgang til den må du først opprette et passord. Etter du har opprettet et passord kan du gå tilbake til banken til {$this->ff->type['refobj']}.");
            redirect::handle("banken", redirect::ROOT);
        }
        // kontroller at vi er logget inn i banken
        $this->auth_verify();
        // gi/fjerne tilgang for medeier?
        if ((isset($_POST['pri2_wt']) || isset($_POST['pri2_wf'])) && validate_sid()) {
            $this->pri2_access();
        }
        // vise statistikk
        if (isset($_GET['stats'])) {
            $this->stats();
        }
        // sette inn penger?
        if (isset($_POST['bank_inn']) && !$this->nostat && $this->ff->access($this->priority_write)) {
            $this->sett_inn();
        }
        // ta ut penger
        if (isset($_POST['bank_ut']) && !$this->nostat && $this->ff->access($this->priority_write)) {
            $this->ta_ut();
        }
        // vis banken
        $this->show();
        $this->ff->load_page();
    }
Example #4
0
 /**
  * Krev at brukeren ikke har noen aktiv lås
  * @param boolean $allow_crew tillate crew å vise siden?
  */
 public static function validate_lock($allow_crew = false)
 {
     // har vi lås?
     if (login::check_lock()) {
         // crew?
         if ($allow_crew && access::has("crewet")) {
             return;
         }
         // har vi ingen spiller?
         if (count(login::$user->lock) == 1 && in_array("player", login::$user->lock)) {
             ajax::text("ERROR:NO-PLAYER", ajax::TYPE_INVALID);
         }
         // ikke tillatt
         ajax::text("ERROR:USER-RESTRICTED", ajax::TYPE_INVALID);
     }
 }
Example #5
0
<?php

define("FORCE_HTTPS", true);
define("ALLOW_GUEST", true);
require "base.php";
global $__server, $_base;
$_base->page->add_title("Henvendelser");
$categories = array(1 => "Generelt", "Utestengt/deaktivert", "Feil/bugs", "Forslag til funksjon", "Annet");
$status = array("crew" => array(0 => "Ny", 1 => "Under behandling", 2 => "Venter på svar", 3 => "Ferdig behandlet", 4 => "Slettet"), "other" => array(0 => "Ikke behandlet", 1 => "Under behandling", 2 => "Trenger svar", 3 => "Ferdig behandlet", 4 => "Slettet"));
// administrasjon
if (isset($_GET['a']) && access::has("mod", NULL, NULL, true)) {
    redirect::store("henvendelser?a");
    // ikke authed?
    if (!access::has("mod")) {
        echo '
<h1>Henvendelser</h1>
<p>Du må logge inn for utvidede tilganger for å få tilgang til henvendelsene som er sendt inn.</p>';
        $_base->page->load();
    }
    // bestemt henvendelse?
    if (isset($_GET['h_id'])) {
        $h_id = intval($_GET['h_id']);
        $bb = true;
        // hent henvendelsen
        $result = \Kofradia\DB::get()->query("SELECT h_id, h_name, h_category, h_email, h_subject, h_name, h_status, h_time, h_random, h_last_visit FROM henvendelser WHERE h_id = {$h_id}");
        $h = $result->fetch();
        if (!$h) {
            $_base->page->add_message("Fant ikke henvendelsen.", "error");
            redirect::handle();
        }
        // opprette svar?
Example #6
0
    /**
     * Vis skjema og behandle angrep på annen spiller
     */
    protected function page_attack_show()
    {
        // er drapsfunksjonen deaktivert?
        if (DISABLE_ANGREP && !access::has("mod")) {
            echo '
<div class="bg1_c xxsmall">
	<h1 class="bg1">Angrip spiller<span class="left2"></span><span class="right2"></span></h1>
	<div class="bg1">
		<p>Funksjonen er for øyeblikket deaktivert.</p>
	</div>
</div>';
            return;
        }
        // kan vi ikke angripe nå?
        $lock = array(array(1450933200, 1451019600, "Angrepsfunksjonen er stengt på julaften."), array(1451581200, 1451667600, "Angrepsfunksjonen er stengt på nyttårsaften."));
        $locked = false;
        $limit_attack = date('H') >= 18 && date('H') < 22;
        if (!$limit_attack) {
            $locked = "Du kan kun angripe spillere mellom klokken 18:00 og 22:00.";
        }
        foreach ($lock as $period) {
            if ($period[0] <= time() && $period[1] >= time()) {
                $locked = $period[2];
            }
        }
        if ($locked) {
            echo '
<div class="bg1_c xxsmall">
	<h1 class="bg1">Angrip spiller<span class="left2"></span><span class="right2"></span></h1>
	<div class="bg1">
		<p>' . $locked . '</p>
	</div>
</div>';
            return;
        }
        // har vi ikke noe våpen?
        if (!login::$user->player->weapon) {
            echo '
<div class="bg1_c xxsmall">
	<h1 class="bg1">Angrip spiller<span class="left2"></span><span class="right2"></span></h1>
	<div class="bg1">
		<p>Du må kjøpe et våpen før du kan gjennomføre et angrep mot en annen spiller. Våpen kjøpes hos våpen og beskyttelse-firma.</p>
	</div>
</div>';
            return;
        }
        // for lav energi?
        if (!login::$user->player->energy_check(self::ENERGY_MUST_HAVE)) {
            echo '
<div class="bg1_c xxsmall">
	<h1 class="bg1">Angrip spiller<span class="left2"></span><span class="right2"></span></h1>
	<div class="bg1">
		<p>Du har ikke nok energi for å utføre et drapsforsøk for øyeblikket.</p>
	</div>
</div>';
            return;
        }
        // sett opp og test for anti-bot
        $this->antibot = new antibot(login::$user->id, "angrip", 2);
        if (MAIN_SERVER) {
            $this->antibot->check_required();
        }
        // valgt spiller?
        if (isset($_POST['up']) || isset($_POST['up_id'])) {
            $this->show_training = false;
            if ($this->player_check()) {
                return;
            }
        }
        ess::$b->page->add_js_domready('$("angrip_up").focus();');
        echo '
<form action="" method="post">
	<div class="bg1_c xsmall">
		<h1 class="bg1">Angrip spiller<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">' . ($_SERVER['REQUEST_METHOD'] == "POST" ? '
			<boxes />' : '') . '
			<p>Her kan du angripe en spiller. Du må først spesifisere hvilken spiller du skal angripe. Deretter spesifiserer du antall kuler, før du faktisk forsøker å angripe spilleren.</p>
			<dl class="dd_right">
				<dt>Spiller som skal angripes</dt>
				<dd><input type="text" name="up" id="angrip_up" class="styled w80" value="' . htmlspecialchars(postval("up")) . '" /></dd>
			</dl>
			<p class="c">' . show_sbutton("Fortsett") . '</p>
			<p class="c"><a href="node/42">Informasjon om funksjonen</a></p>
		</div>
	</div>
</form>';
    }
Example #7
0
 /**
  * Sjekk om vi skal ha crewtilgang
  */
 protected function members_check_crew()
 {
     if ($this->modifiers < self::LOAD_SCRIPT) {
         // er vi mod+ uten brukerinfo?
         if (access::has("mod") && !$this->uinfo) {
             $row = array("ffm_up_id" => login::$user->player->id, "ffm_date_created" => 0, "ffm_date_join" => 0, "ffm_donate" => 0, "ffm_priority" => 0, "ffm_parent_up_id" => 0, "ffm_status" => 1, "ffm_params" => "", "ffm_forum_topics" => 0, "ffm_forum_replies" => 0, "ffm_earnings" => 0, "ffm_earnings_ff" => 0, "ffm_pay_points" => null, "ffm_log_new" => 0, "up_u_id" => login::$user->id, "up_name" => login::$user->player->data['up_name'], "up_access_level" => login::$user->player->data['up_access_level'], "up_last_online" => login::$user->player->data['up_last_online']);
             $this->uinfo = new ff_member($row, $this);
             $this->uinfo->crew();
         }
     }
 }
Example #8
0
// mangler når forumtråden sist ble oppdatert?
if (!isset($_POST['topic_last_edit'])) {
    ajax::text("ERROR:MISSING");
}
$topic_last_edit = (int) $_POST['topic_last_edit'];
// hent topic info
$seen_q = login::$logged_in ? "fs_ft_id = ft_id AND fs_u_id = " . login::$user->id : "FALSE";
$result = \Kofradia\DB::get()->query("\nSELECT\n\tft_id, ft_fse_id, ft_title, ft_deleted, ft_last_reply, ft_last_edit,\n\tfs_time\nFROM\n\tforum_topics\n\tLEFT JOIN forum_seen ON {$seen_q}\nWHERE ft_id = {$id}");
// finnes ikke?
if ($result->rowCount() == 0) {
    ajax::text("ERROR:404-TOPIC", ajax::TYPE_INVALID);
}
// les info
$topic = $result->fetch();
// sjekk om det er slettet, har vi tilgang?
if ($topic['ft_deleted'] != 0 && !access::has("forum_mod")) {
    ajax::text("ERROR:404-TOPIC", ajax::TYPE_INVALID);
}
// kontroller tilgang til forumet
$forum = new \Kofradia\Forum\CategoryAjax($topic['ft_fse_id']);
$forum->require_access();
// mangler svarliste?
if (!isset($_POST['r_id_list'])) {
    ajax::text("ERROR:MISSING", ajax::TYPE_INVALID);
}
// hvilket tidspunkt vi skal hente endringer etter
if (!isset($_POST['time'])) {
    ajax::text("ERROR:MISSING", ajax::TYPE_INVALID);
}
$time_last = (int) $_POST['time'];
// mangler siste id?
Example #9
0
    /**
     * Construct
     */
    public function __construct()
    {
        // endre signatur i forumet
        if (login::$logged_in && (isset($_GET['show_signature']) || isset($_GET['hide_signature']))) {
            if (isset($_GET['show_signature']) && login::$user->data['u_forum_show_signature'] == 0) {
                \Kofradia\DB::get()->exec("UPDATE users SET u_forum_show_signature = 1 WHERE u_id = " . login::$user->id);
            } elseif (isset($_GET['hide_signature']) && login::$user->data['u_forum_show_signature'] == 1) {
                \Kofradia\DB::get()->exec("UPDATE users SET u_forum_show_signature = 0 WHERE u_id = " . login::$user->id);
            }
            redirect::handle(game::address("topic", $_GET, array("show_signature", "hide_signature")));
        }
        // hent forumtråd
        $this->topic = new \Kofradia\Forum\Topic(getval("id"));
        $this->fmod = $this->topic->forum->fmod;
        // sett standard redirect
        redirect::store("topic?id={$this->topic->id}");
        // slette forumtråden?
        if (isset($_POST['delete'])) {
            // forsøk å slette forumtråden
            validate_sid();
            $this->topic->delete();
        }
        // gjenopprette forumtråden?
        if (isset($_POST['restore'])) {
            // forsøk å gjenopprette forumtråden
            validate_sid();
            $this->topic->restore();
        }
        // slette forumsvar?
        if (isset($_GET['delete_reply'])) {
            validate_sid();
            // finn forumsvaret
            if ($reply = $this->topic->get_reply($_GET['delete_reply'])) {
                // forsøk å slett forumsvaret
                $reply->delete();
            } else {
                ess::$b->page->add_message("Fant ikke forumsvaret.", "error");
                redirect::handle();
            }
        }
        // gjenopprette forumsvar?
        if (isset($_GET['restore_reply'])) {
            validate_sid();
            // finn forumsvaret
            if ($reply = $this->topic->get_reply($_GET['restore_reply'])) {
                // forsøk å gjenopprett forumsvaret
                $reply->restore();
            } else {
                ess::$b->page->add_message("Fant ikke forumsvaret.", "error");
                redirect::handle();
            }
        }
        // legge til nytt svar?
        if (isset($_GET['reply']) && isset($_POST['post']) && isset($_POST['text'])) {
            // ikke slå sammen?
            $no_concatenate = isset($_POST['no_concatenate']) && access::has("forum_mod");
            // annonsere?
            $announce = isset($_POST['announce']) && access::has("forum_mod");
            // har vi ingen aktiv spiller?
            if (count(login::$user->lock) == 1 && in_array("player", login::$user->lock)) {
                ess::$b->page->add_message("Du har ingen aktiv spiller.", "error");
                redirect::handle();
            }
            // forsøk å legg til svaret
            $this->topic->add_reply($_POST['text'], $no_concatenate, $announce);
        }
        // den aktuelle siden (sjekk for replyid før vi retter sidetall)
        $pagei = new pagei(pagei::ACTIVE_GET, "p", pagei::PER_PAGE, $this->topic->replies_per_page);
        // sjekk om vi skal vise slettede svar
        if (isset($_GET['show_deleted']) && $this->fmod) {
            $show_deleted = true;
            $deleted = "";
        } else {
            $show_deleted = false;
            $deleted = " AND fr_deleted = 0";
        }
        // skal vi vise status for meldingene?
        $fs_id = 0;
        // skal vi vise et bestemt forumsvar?
        $reply_id = false;
        if (isset($_GET['replyid'])) {
            // hent forumsvaret
            $reply_id = intval($_GET['replyid']);
            $result = \Kofradia\DB::get()->query("SELECT fr_id, fr_deleted FROM forum_replies WHERE fr_ft_id = {$this->topic->id} AND fr_id = {$reply_id}");
            $row = $result->fetch();
            // fant ikke forumsvaret, eller slettet uten tilgang?
            if (!$row || $row['fr_deleted'] != 0 && !$this->fmod) {
                ess::$b->page->add_message("Fant ikke forumsvaret du refererte til.", "error");
                redirect::handle();
            }
            // slettet?
            if ($row['fr_deleted'] != 0 && !$show_deleted) {
                $show_deleted = true;
                $deleted = "";
            }
            // finn ut antall forumsvar før
            $result = \Kofradia\DB::get()->query("SELECT COUNT(fr_id) FROM forum_replies WHERE fr_ft_id = {$this->topic->id} AND fr_id < {$reply_id}{$deleted}");
            $reply_num = $result->fetchColumn(0) + 1;
            // sett opp sidetallet og sett til aktiv side
            $pagei->__construct(pagei::ACTIVE, ceil($reply_num / $this->topic->replies_per_page));
        } elseif (isset($_GET['fs']) && \Kofradia\Forum\Category::$fs_check) {
            // har vi ikke status?
            if (empty($this->topic->info['fs_time'])) {
                // sørg for at vi er på side 1
                if ($pagei->active != 1) {
                    // gå til første side
                    redirect::handle(game::address(PHP_SELF, $_GET, array("p")), redirect::SERVER);
                }
            } else {
                // finn neste forumsvar etter fs_time
                $result = \Kofradia\DB::get()->query("SELECT fr_id FROM forum_replies WHERE fr_ft_id = {$this->topic->id} AND fr_time > {$this->topic->info['fs_time']}{$deleted} ORDER BY fr_time LIMIT 1");
                $row = $result->fetch();
                // fant ikke noe forumsvar?
                if (!$row) {
                    // finn det siste innlegget
                    $result = \Kofradia\DB::get()->query("SELECT fr_id FROM forum_replies WHERE fr_ft_id = {$this->topic->id}{$deleted} ORDER BY fr_time DESC LIMIT 1");
                    $row = $result->fetch();
                }
                // fremdeles ingen forumsvar å gå til?
                if (!$row) {
                    // sørg for at vi er på side 1
                    if ($pagei->active != 1) {
                        // gå til første side
                        redirect::handle(game::address(PHP_SELF, $_GET, array("p")), redirect::SERVER);
                    }
                } else {
                    // finn ut antall forumsvar før det vi skal gå til
                    $result = \Kofradia\DB::get()->query("SELECT COUNT(fr_id) FROM forum_replies WHERE fr_ft_id = {$this->topic->id} AND fr_id < {$row['fr_id']}{$deleted}");
                    $reply_num = $result->fetchColumn(0) + 1;
                    // sett opp sidetallet og kontroller at vi er på riktig side
                    $page = ceil($reply_num / $this->topic->replies_per_page);
                    if ($pagei->active != $page) {
                        // videresend til den riktige siden
                        redirect::handle(game::address(PHP_SELF, $_GET, array("p"), array("p" => $page)), redirect::SERVER);
                    }
                    $fs_id = $row['fr_id'];
                }
            }
        }
        // viser vi slettede meldinger?
        if ($show_deleted) {
            // finn ut hvor mange meldinger som er slettet
            $result = \Kofradia\DB::get()->query("SELECT COUNT(fr_id) FROM forum_replies WHERE fr_ft_id = {$this->topic->id} AND fr_deleted != 0");
            $count = $result->fetchColumn(0);
            ess::$b->page->add_message("Du viser slettede forumsvar. Denne forumtråden har <b>{$count}</b> " . fword("slettet forumsvar", "slettede forumsvar", $count) . ".", NULL, "top");
        }
        // øk visningstelleren hvis vi ikke har besøkt denne forumtråden de siste 10 min
        if (!isset($_SESSION[$GLOBALS['__server']['session_prefix'] . 'forum_topics_visited'][$this->topic->id]) || $_SESSION[$GLOBALS['__server']['session_prefix'] . 'forum_topics_visited'][$this->topic->id] + 600 <= time()) {
            \Kofradia\DB::get()->exec("UPDATE forum_topics SET ft_views = ft_views + 1 WHERE ft_id = {$this->topic->id}");
        }
        // lagre som vist
        $_SESSION[$GLOBALS['__server']['session_prefix'] . 'forum_topics_visited'][$this->topic->id] = time();
        // tittel på siden
        $this->topic->forum->add_title();
        ess::$b->page->add_title($this->topic->info['ft_title']);
        // finn ut antall svar vi har synlige
        if ($show_deleted) {
            $result = \Kofradia\DB::get()->query("SELECT COUNT(fr_id) FROM forum_replies WHERE fr_ft_id = {$this->topic->id}{$deleted}");
            $replies_count = $result->fetchColumn(0);
        } else {
            $replies_count = $this->topic->info['ft_replies'];
        }
        // korriger aktiv side
        $pagei->__construct(pagei::TOTAL, $replies_count);
        // skal vi vise svarskjema?
        $reply_form = login::$logged_in && isset($_GET['reply']) && !$reply_id;
        if ($reply_form) {
            // sørg for at vi er på siste siden
            $pagei->__construct(pagei::ACTIVE_LAST);
        }
        echo '
<div class="bg1_c forumw">
	<h1 class="bg1">' . htmlspecialchars($this->topic->info['ft_title']) . '<span class="left"></span><span class="right"></span></h1>
	<p class="h_left"><a href="forum?id=' . $this->topic->forum->id . '">' . htmlspecialchars($this->topic->forum->get_name()) . '</a></p>
	<p class="h_right">' . ($this->topic->info['ft_locked'] == 1 ? '
		Låst emne!' : '') . (login::$logged_in && $this->topic->info['ft_deleted'] == 0 && ($this->topic->info['ft_locked'] != 1 || $this->fmod) ? '
		<a href="' . htmlspecialchars(game::address(PHP_SELF, $_GET, array("replyid"), array("reply" => true))) . '" class="forum_link_replyform">Opprett svar</a>' : '') . ($this->fmod ? $show_deleted ? '
		<a href="' . htmlspecialchars(game::address(PHP_SELF, $_GET, array("show_deleted", "replyid"))) . '">Skjul slettede svar</a>' : '
		<a href="' . htmlspecialchars(game::address(PHP_SELF, $_GET, array(), array("show_deleted" => true))) . '">Vis slettede svar</a>' : '') . '
	</p>
	<div class="bg1">
<div class="forum" id="forum_topic_container">';
        // vise sidetall øverst?
        if ($pagei->pages > 1) {
            echo '
	<p class="c">' . $pagei->pagenumbers(game::address(PHP_SELF, $_GET, array("p", "replyid", "fs")), game::address(PHP_SELF, $_GET, array("p", "replyid", "fs"), array("p" => "_pageid_"))) . '</p>';
        }
        // hent forumsvar
        $replies = array();
        $up_ids = array();
        $id_list = array();
        $last_time = 0;
        $replies_last_edit = array();
        if ($replies_count > 0) {
            // hent svarene
            $result = \Kofradia\DB::get()->query("\n\t\t\t\tSELECT\n\t\t\t\t\tfr_id, fr_time, fr_up_id, fr_text, fr_deleted, fr_last_edit, fr_last_edit_up_id,\n\t\t\t\t\tup_name, up_access_level, up_forum_signature, up_points, up_profile_image_url,\n\t\t\t\t\tupr_rank_pos,\n\t\t\t\t\tr_time\n\t\t\t\tFROM\n\t\t\t\t\tforum_replies\n\t\t\t\t\tLEFT JOIN users_players ON up_id = fr_up_id\n\t\t\t\t\tLEFT JOIN users_players_rank ON upr_up_id = up_id\n\t\t\t\t\tLEFT JOIN rapportering ON r_type = " . rapportering::TYPE_FORUM_REPLY . " AND r_type_id = fr_id AND r_state < 2\n\t\t\t\tWHERE fr_ft_id = {$this->topic->id}{$deleted}\n\t\t\t\tGROUP BY fr_id\n\t\t\t\tORDER BY fr_time ASC\n\t\t\t\tLIMIT {$pagei->start}, {$pagei->per_page}");
            while ($row = $result->fetch()) {
                $id_list[] = $row['fr_id'];
                $up_ids[] = $row['fr_up_id'];
                $last_time = $row['fr_time'];
                $replies_last_edit[$row['fr_id']] = $row['fr_last_edit'];
                $replies[] = $row;
            }
        }
        // hent inn familierelasjoner
        $up_ids[] = $this->topic->info['ft_up_id'];
        $this->topic->forum->ff_get_familier($up_ids);
        // vis hovedinnlegget
        echo $this->topic->forum->template_topic($this->topic->extended_info());
        // vis forumsvar
        if (count($replies) > 0) {
            // scrolle til første forumsvar på andre enn første side
            if ($pagei->active > 1 && !$reply_form && !$reply_id && !$fs_id) {
                echo '
	<div id="forum_scroll_here"></div>';
            }
            $reply_num = $pagei->per_page * ($pagei->active - 1) + 1;
            foreach ($replies as $row) {
                $row['ft_fse_id'] = $this->topic->forum->id;
                $row['ft_id'] = $this->topic->id;
                $row['reply_num'] = ++$reply_num;
                $row['fs_new'] = \Kofradia\Forum\Category::$fs_check && $this->topic->info['fs_time'] < $row['fr_time'];
                if ($reply_id == $row['fr_id']) {
                    $row['class_extra'] = 'forum_focus';
                }
                if ($reply_id == $row['fr_id'] || $fs_id == $row['fr_id']) {
                    $row['h2_extra'] = 'id="forum_scroll_here"';
                    // vis bokser her
                    if ($reply_id == $row['fr_id'] || $fs_id == $row['fr_id']) {
                        echo '
	<boxes />';
                    }
                }
                // vis html for svaret
                echo $this->topic->forum->template_topic_reply($row);
            }
        }
        // oppdatere sist sett?
        $time = $last_time != 0 ? $last_time : $this->topic->info['ft_time'];
        // legge til?
        if (login::$logged_in && empty($this->topic->info['fs_time'])) {
            \Kofradia\DB::get()->exec("INSERT IGNORE INTO forum_seen SET fs_ft_id = {$this->topic->id}, fs_u_id = " . login::$user->id . ", fs_time = {$time}");
        } elseif (login::$logged_in && $time > $this->topic->info['fs_time']) {
            \Kofradia\DB::get()->exec("UPDATE forum_seen SET fs_time = GREATEST(fs_time, {$time}) WHERE fs_ft_id = {$this->topic->id} AND fs_u_id = " . login::$user->id);
        }
        echo '
</div>';
        // vis svarskjema
        echo '
<div' . ($reply_form ? '' : ' style="display: none"') . ' id="container_reply">' . ($reply_form ? '
	<boxes />' : '') . '
	<form action="' . htmlspecialchars(game::address("topic", $_GET, array("replyid", "fs"), array("reply" => true))) . '" method="post"' . ($reply_form ? ' id="forum_scroll_here"' : '') . '>
		<div class="section forum_reply_edit_c">
			<h2>Svar</h2>
			<dl class="dl_2x">
				<dt>Innhold</dt>
				<dd><textarea name="text" rows="20" cols="75" id="replyText">' . htmlspecialchars(postval("text")) . '</textarea></dd>';
        // vise ekstra alternativer?
        if (access::has("forum_mod") || $this->topic->forum->id >= 5 && $this->topic->forum->id <= 7) {
            $no_concat = isset($_POST['no_concatenate']) || $_SERVER['REQUEST_METHOD'] != "POST" && $this->topic->forum->id >= 5 && $this->topic->forum->id <= 7;
            $announce_text = $this->topic->forum->id >= 5 && $this->topic->forum->id <= 7 ? 'Legg til logg i spilleloggen til medlemmer av Crewet.' : 'Annonser på #kofradia kanalen';
            echo '
				<dt>Ekstra</dt>
				<dd>' . (!$this->topic->forum->ff ? '
					<input type="checkbox" name="announce" id="announce"' . (isset($_POST['announce']) ? ' checked="checked"' : '') . ' /><label for="announce"> ' . $announce_text . '</label><br />' : '') . '
					<input type="checkbox" name="no_concatenate" id="no_concatenate"' . ($no_concat ? ' checked="checked"' : '') . ' /><label for="no_concatenate"> <u>Ikke</u> kombiner sammen med siste melding.</label>
				</dd>';
        }
        echo '
			</dl>
			<p class="c">
				' . show_sbutton("Legg til svar", 'name="post" accesskey="s" id="forum_reply_button_add"') . '
				' . show_sbutton("Forhåndsvis", 'name="preview" accesskey="p" id="forum_reply_button_preview"') . '
			</p>
		</div>
		<div id="reply_preview" class="forum">';
        // forhåndsvise?
        if (login::$logged_in && isset($_POST['preview'])) {
            $data = array("ft_id" => $this->topic->id, "fr_text" => postval("text"), "fr_up_id" => login::$user->player->id, "up_name" => login::$user->player->data['up_name'], "up_access_level" => login::$user->player->data['up_access_level'], "up_points" => login::$user->player->data['up_points'], "upr_rank_pos" => login::$user->player->data['upr_rank_pos'], "up_forum_signature" => login::$user->player->data['up_forum_signature'], "up_profile_image_url" => login::$user->player->data['up_profile_image_url'], "fs_new" => \Kofradia\Forum\Category::$fs_check);
            echo \Kofradia\Forum\Category::template_topic_reply_preview($data);
        }
        echo '</div>
	</form>
</div>';
        // linker i bunn
        if (login::$logged_in) {
            echo '
<form action="" method="post">
	<input type="hidden" name="sid" value="' . login::$info['ses_id'] . '" />
	<div class="forum_footer_links">';
            // slette/gjenopprette lenker
            if ($this->fmod || $this->topic->info['ft_up_id'] == login::$user->player->id) {
                echo '
		<p class="left">' . ($this->topic->info['ft_deleted'] == 0 ? '
			<span class="red">' . show_sbutton("Slett emnet", 'name="delete" onclick="return confirm(\'Sikker?!\')"') . '</span>' : '
			<span class="green">' . show_sbutton("Gjenopprett emnet", 'name="restore" onclick="return confirm(\'Sikker?!\')"') . '</span>') . '
		</p>';
            }
            // alternativer
            echo '
		<p class="right">';
            // reply lenke
            if (!$reply_form && $this->topic->info['ft_deleted'] == 0 && ($this->topic->info['ft_locked'] == 0 || $this->fmod)) {
                echo '
			<a href="' . htmlspecialchars(game::address("topic", $_GET, array("replyid"), array("reply" => true))) . '" class="button forum_link_replyform" accesskey="r">Opprett svar</a>';
            }
            // signatur lenker
            echo login::$user->data['u_forum_show_signature'] == 1 ? '
			<a href="' . htmlspecialchars(game::address("topic", $_GET, array("show_signature"), array("hide_signature" => true))) . '" class="button">Skjul signaturer</a>' : '
			<a href="' . htmlspecialchars(game::address("topic", $_GET, array("hide_signature"), array("show_signature" => true))) . '" class="button">Vis signaturer</a>';
            echo '
		</p>';
        }
        // sidetall
        if ($pagei->pages > 1) {
            echo '
		<p class="center">' . $pagei->pagenumbers(game::address(PHP_SELF, $_GET, array("p", "replyid", "fs", "reply")), game::address(PHP_SELF, $_GET, array("p", "replyid", "fs", "reply"), array("p" => "_pageid_"))) . '</p>';
        }
        echo '
	</div>
</form>
	</div>
</div>';
        // div javascript
        // sørg for at meldingene blir oppdatert og at nye meldinger blr hentet hvis vi er på siste side
        ess::$b->page->add_js_file(ess::$s['relative_path'] . "/js/forum.js");
        ess::$b->page->add_js('
		sm_scripts.report_links();');
        ess::$b->page->add_js_domready('
	var topic = new ForumTopic(' . $this->topic->id . ', ' . js_encode($id_list) . ', ' . js_encode($replies_last_edit) . ', ' . ($pagei->pages == $pagei->active ? 'true' : 'false') . ', ' . ($show_deleted ? 'true' : 'false') . ', ' . ($this->fmod ? 'true' : 'false') . ', ' . (int) $this->topic->info['ft_last_edit'] . ');' . ($reply_form ? '
	topic.reply_form_show();' : ''));
        $this->topic->forum->load_page();
    }
Example #10
0
    /**
     * Overføre penger
     */
    protected function overfor()
    {
        $mottaker = postval("mottaker");
        $amount = game::intval(postval("amount"));
        // kontroller at vi har nok penger
        $result = \Kofradia\DB::get()->query("SELECT {$amount} <= up_bank FROM users_players WHERE up_id = " . $this->up->id);
        $amount_ok = $result->fetchColumn(0) == 1;
        // sjekk beløpet
        if ($amount <= 0) {
            ess::$b->page->add_message("Ugyldig beløp.", "error");
            return;
        }
        if ($amount < 50) {
            ess::$b->page->add_message("Du må sende minimum 50 kr.", "error");
            return;
        }
        if (!$amount_ok) {
            ess::$b->page->add_message("Du har ikke så mye penger i banken.", "error");
            return;
        }
        // har vi ikke tilgang (NoStatUser)
        if (access::is_nostat() && !access::has("admin")) {
            ess::$b->page->add_message("Du er NoStatUser og kan ikke sende penger!", "error");
            return;
        }
        // sjekk session
        if (postval("sid") != login::$info['ses_id']) {
            ess::$b->page->add_message("Startet du ikke overføringen selv? :o", "error");
            return;
        }
        // sjekk mottaker
        $result = \Kofradia\DB::get()->query("SELECT up_id, up_u_id, up_name, up_access_level, up_bank_ff_id FROM users_players WHERE up_name = " . \Kofradia\DB::quote($mottaker) . " ORDER BY up_access_level = 0, up_last_online DESC LIMIT 1");
        $player = $result->fetch();
        // ingen gyldig mottaker?
        if (!$player) {
            ess::$b->page->add_message("Fant ikke mottakeren.", "error");
            return;
        }
        // seg selv?
        if ($player['up_id'] == $this->up->id) {
            ess::$b->page->add_message("Du kan ikke sende til deg selv.", "error");
            return;
        }
        // død mottaker?
        if ($player['up_access_level'] == 0) {
            ess::$b->page->add_message('<user id="' . $player['up_id'] . '" /> er død. Hvem skal motta pengene?!');
            return;
        }
        $result = \Kofradia\DB::get()->query("SELECT uc_info FROM users_contacts WHERE uc_u_id = {$player['up_u_id']} AND uc_contact_up_id = " . $this->up->id . " AND uc_type = 2");
        $blokkert = $result->rowCount() > 0;
        $blokkert_info = $blokkert ? $result->fetchColumn(0) : false;
        // sjekk bankkontoen til mottaker
        $bank = page_banken_bank::get($player['up_bank_ff_id']);
        // ingen bankkonto?
        if (!$bank) {
            ess::$b->page->add_message("Mottakeren har ingen bankkonto du kan sende til.", "error");
            return;
        }
        // blokkert?
        if ($blokkert && !access::has("crewet")) {
            // blokkert
            $reason = game::bb_to_html($blokkert_info);
            $reason = empty($reason) ? '' : ' Begrunnelse: ' . $reason;
            ess::$b->page->add_message("Denne spilleren har blokkert deg, og du kan derfor ikke sende personen penger.{$reason}", "error");
            return;
        }
        $note = mb_substr(postval("note"), 0, 100);
        // hoppe over overføringstapet?
        $skip_bog = false;
        if (isset($_POST['skip_bog']) && access::is_nostat()) {
            $skip_bog = true;
            $this->bank->overforingstap = 0;
            $bank->overforingstap = 0;
        }
        // regn ut hvor mye penger som skal bli til overs etc
        $result = \Kofradia\DB::get()->query("SELECT ROUND({$amount} * {$this->bank->overforingstap}), ROUND({$amount} * {$bank->overforingstap}), ROUND({$amount} * {$this->bank->overforingstap}) + ROUND({$amount} * {$bank->overforingstap}), {$amount} - ROUND({$amount} * {$this->bank->overforingstap}) - ROUND({$amount} * {$bank->overforingstap}), {$amount} - ROUND({$amount} * {$this->bank->overforingstap})");
        $info = $result->fetch(\PDO::FETCH_NUM);
        // 0 -> tap sender
        // 1 -> tap mottaker
        // 2 -> tap totalt
        // 3 -> til overs (det som mottakeren får)
        // 4 -> mellombeløp (utgangsbeløpet - tap sender)
        // kontrollere at overføringen ikke blir utført flere ganger
        $form = \Kofradia\Form::getByDomain("banken_" . $player['up_id'], login::$user);
        // bekreftet?
        if (isset($_POST['confirm']) && isset($_POST['ovt_s']) && isset($_POST['ovt_m']) && $form->validateHashOrAlert()) {
            // kontroller overføringstapene (slik at det ikke har skjedd noen endringer)
            $ovt_s = postval("ovt_s");
            $ovt_m = postval("ovt_m");
            if ($ovt_s != $this->bank->overforingstap || $ovt_m != $bank->overforingstap) {
                // det har endret seg
                login::data_set("banken_ovt_endret", true);
            } else {
                // start transaksjon
                \Kofradia\DB::get()->beginTransaction();
                // send pengene
                $a = \Kofradia\DB::get()->exec("UPDATE users_players AS s, users_players AS m SET s.up_bank = s.up_bank - {$amount}, m.up_bank = m.up_bank + {$info[3]} WHERE s.up_id = " . $this->up->id . " AND m.up_id = {$player['up_id']} AND s.up_bank >= {$amount}");
                // mislykket?
                if ($a == 0) {
                    ess::$b->page->add_message("Noe gikk galt under overføringen.", "error");
                    \Kofradia\DB::get()->commit();
                } else {
                    // lagre overføringslogg
                    \Kofradia\DB::get()->exec("INSERT INTO bank_log SET bl_sender_up_id = " . $this->up->id . ", bl_receiver_up_id = {$player['up_id']}, amount = {$info[4]}, time = " . time());
                    // oppdater senderen
                    \Kofradia\DB::get()->exec("UPDATE users_players SET up_bank_sent = up_bank_sent + {$info[4]}, up_bank_profit = up_bank_profit - {$info[4]}, up_bank_num_sent = up_bank_num_sent + 1, up_bank_charge = up_bank_charge + {$info[0]} WHERE up_id = " . $this->up->id);
                    // oppdater mottakeren
                    \Kofradia\DB::get()->exec("UPDATE users_players SET up_bank_received = up_bank_received + {$info[4]}, up_bank_profit = up_bank_profit + {$info[4]}, up_bank_num_received = up_bank_num_received + 1, up_bank_charge = up_bank_charge + {$info[1]} WHERE up_id = {$player['up_id']}");
                    // spillelogg (med melding)
                    $player2 = new player($player['up_id']);
                    $player2->add_log("bankoverforing", $info[4] . ":" . $note, $this->up->id);
                    // legg til transaksjonsrader
                    if ($info[0] > 0) {
                        \Kofradia\DB::get()->exec("INSERT INTO ff_bank_transactions SET ffbt_ff_id = {$this->bank->id}, ffbt_time = " . time() . ", ffbt_amount = {$amount}, ffbt_profit = {$info[0]}");
                    }
                    if ($info[1] > 0) {
                        \Kofradia\DB::get()->exec("INSERT INTO ff_bank_transactions SET ffbt_ff_id = {$bank->id}, ffbt_time = " . time() . ", ffbt_amount = {$amount}, ffbt_profit = {$info[1]}");
                    }
                    // IRC logg
                    putlog("LOG", "%c9%uBANKOVERFØRING:%u%c (%u" . $this->up->data['up_name'] . "%u) sendte (%u" . game::format_cash($amount) . "%u (%u{$info[3]}%u)) til (%u{$player['up_name']}%u) (TAP: " . game::format_cash($info[2]) . ") " . (!empty($note) ? 'Melding: (' . $note . ')' : 'Ingen melding.'));
                    ess::$b->page->add_message('Du overførte <b>' . game::format_cash($info[4]) . '</b> til <user id="' . $player['up_id'] . '" />.' . ($info[0] > 0 ? ' Banken din tok <b>' . game::format_cash($info[0]) . '</b> i overføringsgebyr.' : ''));
                    \Kofradia\DB::get()->commit();
                    // trigger
                    $this->up->update_money(-$amount, false, false, null);
                    $player2->update_money($info[3], false, false, null);
                    redirect::handle();
                }
            }
        }
        ess::$b->page->add_css('.dl_bank dd { text-align: right }');
        // vis godkjenn form
        echo '
<h1>Banken - overføring</h1>
<form action="" method="post">
	<input type="hidden" name="mottaker" value="' . htmlspecialchars($mottaker) . '" />
	<input type="hidden" name="amount" value="' . $amount . '" />
	<input type="hidden" name="note" value="' . htmlspecialchars($note) . '" />
	<input type="hidden" name="ovt_s" value="' . $this->bank->overforingstap . '" />
	<input type="hidden" name="ovt_m" value="' . $bank->overforingstap . '" />
	' . $form->getHTMLInput();
        // hoppe over overføringstapet?
        if ($skip_bog) {
            echo '
	<input type="hidden" name="skip_bog" />';
        }
        echo '
	<input type="hidden" name="sid" value="' . login::$info['ses_id'] . '" />
	<div style="width: 200px; padding-left: 100px; float: left">
		<div class="section">
			<h2>Avsender</h2>
			<dl class="dl_30">
				<dt>Kontoeier</dt>
				<dd>' . game::profile_link() . '</dd>
				
				<dt>Bankfirma</dt>
				<dd><a href="ff/?ff_id=' . $this->bank->id . '">' . htmlspecialchars($this->bank->data['ff_name']) . '</a></dd>
				
				<dt><abbr title="Overføringstap">Overf.tap</abbr></dt>
				<dd>' . $this->bank->overforingstap * 100 . ' %</dd>
				
				<dt>Plassering</dt>
				<dd>' . (!isset(game::$bydeler[$this->bank->data['br_b_id']]) ? '<span style="color: #777777">Ukjent</span>' : htmlspecialchars(game::$bydeler[$this->bank->data['br_b_id']]['name'])) . '</dd>
			</dl>
		</div>
	</div>
	<div style="width: 200px; padding-left: 20px; float: left">
		<div class="section">
			<h2>Mottaker</h2>
			<dl class="dl_30">
				<dt>Kontoeier</dt>
				<dd><user id="' . $player['up_id'] . '" /></dd>
				
				<dt>Bankfirma</dt>
				<dd><a href="ff/?ff_id=' . $bank->id . '">' . htmlspecialchars($bank->data['ff_name']) . '</a></dd>
				
				<dt><abbr title="Overføringstap">Overf.tap</abbr></dt>
				<dd>' . $bank->overforingstap * 100 . ' %</dd>
				
				<dt>Plassering</dt>
				<dd>' . (!isset(game::$bydeler[$bank->data['br_b_id']]) ? '<span style="color: #777777">Ukjent</span>' : htmlspecialchars(game::$bydeler[$bank->data['br_b_id']]['name'])) . '</dd>
			</dl>
		</div>
	</div>
	<div class="clear" style="width: 420px; margin-left: 100px">
		<div class="section">
			<h2>Overføringsinformasjon</h2>
			<dl class="dl_40 dl_bank">
				<dt>Overføringsbeløp</dt>
				<dd>' . game::format_cash($amount) . '</dd>';
        // hopper over overføringstapet?
        if ($skip_bog) {
            echo '
				
				<dt>Hopper over overføringstapet</dt>
				<dd>NoStat</dd>';
        }
        echo '
				
				<dt>Overføringstap for avsender</dt>
				<dd>' . game::format_cash($info[0]) . '</dd>
				
				<dt>Overføringstap for mottaker</dt>
				<dd>' . game::format_cash($info[1]) . '</dd>
				
				<dt>Mottaker får</dt>
				<dd>' . game::format_cash($info[3]) . '</dd>
				
				<dt>Melding</dt>
				<dd>' . (empty($note) ? 'Ingen melding.' : game::bb_to_html($note)) . '</dd>
			</dl>
			<h4>
				' . show_sbutton("Utfør overføring", 'name="confirm"') . '
				' . show_sbutton("Avbryt/endre", 'name="abort"') . '
			</h4>
		</div>
	</div>
</form>';
        ess::$b->page->load();
    }
Example #11
0
/**
 * Rette på HTML før output.
 * 
 * @param string $content
 * @return string
 */
function parse_html($content)
{
    global $__server;
    // fikse noen <user="" /> ?
    $matches = false;
    if (preg_match_all("/(<user=\"([0-9a-zA-Z\\-_ ]+)\"( nolink)? \\/>|<user id=\"([0-9]+)\"( nolink)? \\/>)/", $content, $matches)) {
        $users = array();
        $ids = array();
        // sett opp brukernavn liste
        foreach ($matches[2] as $user) {
            if (!empty($user)) {
                if (!in_array($user, $users)) {
                    $users[] = $user;
                }
            }
        }
        // sett opp ID liste
        foreach ($matches[4] as $id) {
            if (!empty($id)) {
                if (!in_array($id, $ids)) {
                    $ids[] = $id;
                }
            }
        }
        // fant gyldige treff
        if (count($users) > 0 || count($ids) > 0) {
            global $_base;
            $q = array();
            // brukernavn
            if (count($users) > 0) {
                $q[] = "\n\t\t\t\t\tSELECT up_id, up_name, up_access_level FROM (\n\t\t\t\t\t\tSELECT up_id, up_name, up_access_level\n\t\t\t\t\t\tFROM users_players\n\t\t\t\t\t\tWHERE up_name IN (" . implode(",", array_map(array($_base->db, "quote"), $users)) . ")\n\t\t\t\t\t\tORDER BY up_access_level = 0, up_last_online DESC\n\t\t\t\t\t) ref\n\t\t\t\t\tGROUP BY up_name";
            }
            // id
            if (count($ids) > 0) {
                $q[] = "SELECT up_id, up_name, up_access_level FROM users_players WHERE up_id IN (" . implode(",", array_unique(array_map("intval", $ids))) . ")";
            }
            // hent info og bytt om
            $result = \Kofradia\DB::get()->query(implode(" UNION ", $q));
            while ($row = $result->fetch()) {
                $content = preg_replace('/(<user="******"/") . '" \\/>|<user id="' . $row['up_id'] . '" \\/>)/i', game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']), $content);
                $content = preg_replace('/(<user="******"/") . '" nolink \\/>|<user id="' . $row['up_id'] . '" nolink \\/>)/i', game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level'], false), $content);
            }
        }
        // ordne de som ikke ble funnet
        $content = preg_replace('~<user="******"( nolink)? />~i', '<a href="' . $__server['relative_path'] . '/finn_spiller?finn=$1">$1 (ukjent spiller)</a>', $content);
        $content = preg_replace('~<user id="([0-9]+)"( nolink)? />~i', '<a href="' . $__server['relative_path'] . '/finn_spiller">#$1 (ukjent spiller)</a>', $content);
    }
    // fikse noen <ff_link>id</ff_link> ?
    $matches = false;
    if (preg_match_all("~(<ff_link>([0-9]+)</ff_link>)~", $content, $matches)) {
        $ids = array();
        // sett opp ID liste
        foreach ($matches[2] as $id) {
            if (!in_array($id, $ids)) {
                $ids[] = (int) $id;
            }
        }
        // fant gyldige treff
        if (count($ids) > 0) {
            // hent info og bytt om
            $result = \Kofradia\DB::get()->query("SELECT ff_id, ff_name, ff_inactive FROM ff WHERE ff_id IN (" . implode(",", $ids) . ")");
            while ($row = $result->fetch()) {
                $link = $row['ff_inactive'] && !access::has("mod") ? htmlspecialchars($row['ff_name']) : '<a href="' . ess::$s['relative_path'] . '/ff/?ff_id=' . $row['ff_id'] . '">' . htmlspecialchars($row['ff_name']) . '</a>';
                $content = preg_replace('~(<ff_link>' . $row['ff_id'] . '</ff_link>)~', $link, $content);
            }
        }
        // ordne de som ikke ble funnet
        $content = preg_replace('~<ff_link>([0-9]+)</ff_link>~', '<span class="ff_unknown">ukjent firma/broderskap (#$1)</span>', $content);
    }
    // fiks entities
    $content = str_replace(array("&rpath;", "&spath;", "&path;", "&staticlink;"), array(ess::$s['rpath'], ess::$s['spath'], ess::$s['path'], STATIC_LINK), $content);
    return $content;
}
Example #12
0
<?php

require "base.php";
// TODO: lenke fra min side må endres
$up = login::$user->player;
if (isset($_GET['up_id']) && (access::has("mod") && isset($_GET['stats']) || access::has("sadmin") && KOFRADIA_DEBUG)) {
    // forsøk å finn spilleren
    $up = player::get((int) getval("up_id"));
    if (!$up) {
        ess::$b->page->add_message("Fant ingen spiller med ID <u>" . htmlspecialchars($_GET['up_id']) . "</u>.", "error");
        ess::$b->page->load();
    }
    redirect::store("poker?up_id={$up->id}");
    echo '
<p class="c">Du viser pokersiden som tilhører ' . $up->profile_link() . '.' . (!isset($_GET['stats']) ? '<br /><b>Viktig:</b> Utfordringer du gjør her vil bli gjort som denne spilleren, og ikke din egen.' : '') . '</p>';
}
$poker = new page_poker($up);
Example #13
0
    protected function show()
    {
        // tittel på meldingstråden
        ess::$b->page->add_title($this->thread->data_thread['it_title']);
        // sett opp deltakere
        $deltakere = array();
        $c = access::has("crewet");
        foreach ($this->thread->receivers as $row) {
            if ($this->thread->data_rel && $this->thread->data_rel['ir_up_id'] == $row['ir_up_id']) {
                continue;
            }
            $p = $row['ir_deleted'] != 0 || $row['up_access_level'] == 0 && (!access::has("crewet") || $row['u_access_level'] == 0 || $row['u_active_up_id'] != $row['ir_up_id']);
            $deltakere[] = ($p ? '<span class="user_strike">' : '') . '<user id="' . $row['ir_up_id'] . '" />' . ($p ? '</span>' : '');
        }
        $deltakere_siste = array_pop($deltakere);
        $this->add_receivers();
        // overskrift
        if ($this->thread->restrict || !$this->thread->can_reply_receivers) {
            echo '
<h1>Melding: ' . htmlspecialchars($this->thread->data_thread['it_title']) . '</h1>';
        } else {
            echo '
<form action="" method="post">
	<h1><span class="red">' . show_sbutton("Slett", 'name="slettalle" onclick="return confirm(\'Dette vil slette meldingstråden for alle deltakere. Denne handlingen kan ikke angres uten videre. Fortsette?\')"') . '</span> Melding: ' . htmlspecialchars($this->thread->data_thread['it_title']) . '</h1>
</form>';
        }
        // tittel og verktøy
        echo '
<form action="innboks" method="post">
	<p class="im_tools top h_right">
		<a href="innboks' . ($this->thread->data_rel ? '' : '?user='******'up_name'])) . '">Tilbake til meldinger</a>
		<input type="hidden" name="it_id[]" value="' . $this->thread->id . '" />' . (!isset($_GET['reply']) && $this->can_reply ? '
		' . show_sbutton("Opprett svar", 'name="reply" accesskey="s"', 'reply_link_form_show') : '') . ($this->thread->data_rel ? '
		<span class="red">' . show_sbutton("Slett", 'name="slett"  accesskey="d" onclick="return confirm(\'Er du sikker på at du vil slette meldingen?\')"') . '</span>' : '') . '
	</p>
</form>';
        // deltakere
        if ($deltakere_siste) {
            echo '
<p id="im_deltakere"><span id="im_deltakere_i">Deltakere: ' . (count($deltakere) > 0 ? implode(", ", $deltakere) . ' og ' : '') . $deltakere_siste . '</span></p>';
            if (!$this->thread->can_reply_access) {
                echo '
<p>Du har ikke mulighet til å svare i denne meldingen.</p>';
            } elseif (!$this->thread->can_reply_receivers) {
                echo '
<p>Det er ingen mottakere du kan svare til.</p>';
            }
        } else {
            echo '
<p>Det er ingen andre deltakere enn deg selv i denne meldingstråden.</p>';
        }
        // flere sider?
        if ($this->pagei->pages > 1) {
            echo '
<p class="c">' . $this->pagei->pagenumbers(array("goto")) . '</p>';
        }
        // svarskjema
        echo '
<div id="container_reply"' . (!isset($_GET['reply']) ? ' style="display: none"' : '') . '>
	<form action="' . htmlspecialchars(game::address(PHP_SELF, $_GET, array(), array("reply" => true))) . '" method="post" onsubmit="this.onsubmit=function(){return false;}">
		<div class="section" style="margin-top:0">
			<h3>Skriv svar</h3>
			<dl class="dd_auto_100">
				<dt>Innhold</dt>
				<dd><textarea name="melding" rows="10" cols="75" id="textContent">' . htmlspecialchars(postval("melding")) . '</textarea></dd>
				<dt' . (isset($_POST['preview']) && isset($_POST['melding']) ? '' : ' style="display: none"') . ' id="previewDT">Forhåndsvisning</dt>
				<dd' . (isset($_POST['preview']) && isset($_POST['melding']) ? '' : ' style="display: none"') . ' id="previewDD">' . (!isset($_POST['melding']) || empty($_POST['melding']) ? 'Tom melding?!' : game::bb_to_html($_POST['melding'])) . '</dd>
			</dl>
			<h3 class="c">
				' . show_sbutton("Send melding", 'name="post" accesskey="s"') . '
				' . show_sbutton("Forhåndsvis", 'name="preview" accesskey="p" id="reply_link_preview"') . '
			</h3>
		</div>
	</form>
</div>';
        // meldingene
        echo '
<div id="innboks">';
        // hent meldingene på denne siden
        $result = $this->thread->get_messages($this->pagei->start, $this->limit);
        $i = 0;
        $last_id = 0;
        while ($row = $result->fetch()) {
            $e = $this->pagei->total - $i - ($this->pagei->active - 1) * $this->pagei->per_page;
            if ($i == 0) {
                $last_id = $row['im_id'];
            }
            echo $this->thread->reply_format($row, $e, $this->highlight_im_id == $row['im_id'], $i < $this->new);
            $i++;
        }
        echo '
</div>';
        if (!isset($_GET['reply']) && $this->can_reply || $this->thread->data_rel) {
            echo '
<form action="innboks" method="post">
	<input type="hidden" name="it_id[]" value="' . $this->thread->id . '" />' . ($this->thread->data_rel ? '
	<p class="im_tools bottom left" id="im_mark"></p>' : '') . '
	<p class="im_tools bottom">' . (!isset($_GET['reply']) && $this->can_reply ? '
		' . show_sbutton("Opprett svar", 'name="reply" accesskey="s"', 'reply_link_form_show') : '') . ($this->thread->data_rel ? '
		<span class="red">' . show_sbutton("Slett", 'name="slett"  accesskey="d" onclick="return confirm(\'Er du sikker på at du vil slette meldingen?\')"') . '</span>' : '') . '
	</p>
</form>';
        }
        // flere sider?
        if ($this->pagei->pages > 1) {
            echo '
<p class="c center w200">' . $this->pagei->pagenumbers(array("goto")) . '</p>';
        }
        echo '
<div class="clear"></div>';
        $this->add_css();
        $this->add_js($last_id);
        $this->load_page();
    }
Example #14
0
    // legg til tittel
    $_base->page->add_title("Forum", "Rediger forumtråd", $topic->info['ft_title']);
    echo '
<div class="bg1_c forumw">
	<h1 class="bg1">Rediger forumtråd<span class="left"></span><span class="right"></span></h1>
	<p class="h_left"><a href="topic?id=' . $topic->id . '">&laquo; Tilbake til forumtråden</a></p>
	<div class="bg1">
		<boxes />
		<div id="topic_info_edit"></div>
		<div class="forum_reply_edit_c">
		<form action="" method="post">
			<dl class="dl_2x">
				<dt>Tittel</dt>
				<dd>
					<input type="text" name="title" id="topic_title" class="styled w200" value="' . htmlspecialchars(postval("title", $topic->info['ft_title'])) . '" maxlength="' . \Kofradia\Forum\Category::TOPIC_TITLE_MAX_LENGTH . '" />';
    if (!$topic->forum->ff || access::has("mod")) {
        echo '
					<select name="section" id="topic_section">';
        // hent alle forumkategoriene vi har tilgang til
        $sections = \Kofradia\Forum\Category::get_forum_list();
        $section = isset($_POST['section']) && isset($sections[$_POST['section']]) ? (int) $_POST['section'] : $topic->info['ft_fse_id'];
        foreach ($sections as $row) {
            $name = $row['name'];
            echo '
						<option value="' . $row['fse_id'] . '"' . ($section == $row['fse_id'] ? ' selected="selected"' : '') . '>' . htmlspecialchars($name) . '</option>';
        }
        echo '
					</select>';
    }
    if ($topic->forum->fmod) {
        // type
Example #15
0
echo '
<h1>Endre HT-passord</h1>
<div class="section center w200">
	<h2>Endre HT-passord</h2>' . (!$htdigest->is_user(login::$user->player->data['up_name'], "HT-pass") ? '
	<p class="error_box">Du har ingen aktiv HT-pass bruker.</p>' : '') . '
	<p>HT-passordet er det som brukes for å komme inn på enkelte undersider på webserveren som krever passord for hele mappen (for dokumenter osv).</p>
	<form action="" method="post">
		<dl class="dd_right dl_2x">
			<dt>Nytt passord</dt>
			<dd><input type="password" name="pass" class="styled w100" /></dd>
		</dl>
		<p class="c">' . show_sbutton("Lagre") . '</p>
	</form>
</div>';
// vis liste over alle brukerene
if (access::has("mod")) {
    // finn brukere
    $users = $htdigest->get_users("HT-pass");
    // fjerne en bruker?
    if (isset($_POST['delete'])) {
        // finnes brukeren?
        if (!$htdigest->is_user($_POST['delete'], "HT-pass")) {
            $_base->page->add_message("Denne brukeren finnes ikke.", "error");
            redirect::handle();
        }
        // fjern brukeren
        $htdigest->remove_user($_POST['delete'], "HT-pass");
        // lagre ny data
        file_put_contents($passfile, $htdigest->generate_data());
        putlog("CREWCHAN", "HT-PASSORD: " . login::$user->player->data['up_name'] . " fjernet %u{$_POST['delete']}%u fra HT-pass listen.");
        $_base->page->add_message("Brukeren <b>" . htmlspecialchars($_POST['delete']) . "</b> ble fjernet.");
Example #16
0
	<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'] . '&amp;a=crew">bruker</a> | <a href="' . $__server['relative_path'] . '/min_side?up_id=' . $player['up_id'] . '&amp;a=crew">spiller</a> | <a href="' . $__server['relative_path'] . '/min_side?u_id=' . $player['up_u_id'] . '&amp;a=crew&amp;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>';
        } else {
            echo '
				<li><a href="' . $__server['relative_path'] . '/kontakter/add/' . $player['up_id'] . '">Legg til som kontakt</a></li>';
        }
        if ($is_block == 1) {
            echo '
				<li><a href="' . $__server['relative_path'] . '/kontakter/delete/' . $player['up_id'] . '?sid=' . login::$info['ses_id'] . '&amp;type=block">Fjern fra blokkering</a></li>';
        } else {
            echo '
Example #17
0
            ess::$b->page->add_message('Spilleren <user id="' . $up['up_id'] . '" /> er deaktivert. Endringer må gjøres manuelt.', "error");
            redirect::handle();
        }
        // overfør nivå
        \Kofradia\DB::get()->exec("UPDATE users, users_players SET up_access_level = u_access_level WHERE u_active_up_id = up_id AND up_id = {$up['up_id']} AND u_access_level != 0 AND up_access_level != 0");
        ess::$b->page->add_message('Tilgangsnivået til brukeren <user id="' . $up['up_id'] . '" /> ble overført til spilleren.');
        // ranklista
        \Kofradia\DB::get()->exec("UPDATE users, users_players_rank SET upr_up_access_level = u_access_level WHERE upr_up_id = {$up['up_id']} AND upr_up_id = u_active_up_id");
        ranklist::update();
        // logg
        putlog("CREWCHAN", "TILGANGSNIVÅ OVERFØRT: Tilgangsnivået til {$up['up_name']} ble overført fra brukeren (nivå: {$up['u_access_level']}) til spilleren (gammelt nivå: {$up['up_access_level']}).");
        redirect::handle();
    }
    $result = \Kofradia\DB::get()->query("\n\t\tSELECT u_id, u_access_level, up_access_level, up_id, up_name, up_last_online\n\t\tFROM users, users_players\n\t\tWHERE u_active_up_id = up_id AND up_u_id = u_id AND u_access_level != up_access_level AND (up_access_level != 0 || u_access_level != 1)\n\t\tORDER BY up_name");
    if ($result->rowCount() > 0) {
        $admin = access::has("admin");
        echo '
<div class="bg1_c medium">
	<h1 class="bg1">Forskjell mellom brukernivå og spillernivå<span class="left2"></span><span class="right2"></span></h1>
	<div class="bg1">
		<boxes />' . ($admin ? '
		<form action="" method="post">' : '') . '
		<table class="table ' . ($admin ? 'tablemt' : 'tablem') . ' center">
			<thead>
				<tr>
					<th>U_ID</th>
					<th>UP_ID</th>
					<th>Spiller</th>
					<th>Brukernivå</th>
					<th>Spillernivå</th>
					<th>Sist pålogget</th>
Example #18
0
<?php

require "../base.php";
global $_base;
access::no_guest();
// firma/familie?
if (isset($_GET['f']) || isset($_GET['fa'])) {
    #require "f/sok";
    die;
}
// hent forumene og sett opp forumene vi har tilgang til
$sections = \Kofradia\Forum\Category::get_forum_list();
$_base->page->add_title("Forum", "Søk");
$forum_mod = access::has("forum_mod");
$allow_deleted = $forum_mod;
// hvor man skal kunne søke
$search_where = array(1 => array("Alle innlegg", true, true), array("Kun hovedinnlegg", true, false), array("Kun svar", false, true));
$id = requestval("w");
$search_where_id = isset($search_where[$id]) ? $id : 1;
// hvilke forum søker vi i?
$search_forums = $sections;
$search_forums_active = array();
foreach ($_REQUEST as $key => $dummy) {
    $match = false;
    if (preg_match("/^s(\\d+)\$/Du", $key, $match)) {
        if (isset($search_forums[$match[1]])) {
            $search_forums_active[] = $match[1];
        }
    }
}
if (count($search_forums_active) == 0) {
Example #19
0
.profile_signature_empty {
	color: #555555;
}
');
    echo '
<p>Viser signaturen til ' . $player->profile_link() . ':</p>
<div class="profile_signature">' . (empty($signature) ? '
	<span class="profile_signature_empty">Spilleren har ingen signatur.</span>' : $signature) . '
</div>
<p>' . (login::$logged_in ? $player->data['up_u_id'] == login::$user->id || access::has("forum_mod") ? '<a href="' . ess::$s['rpath'] . '/min_side?up_id=' . $player->id . '&amp;a=forum">Rediger signatur</a> - ' : '<a href="' . $__server['relative_path'] . '/js" class="report_link" rel="signature,' . $player->id . ',1">Rapporter signatur</a> - ' : '') . '<a href="' . $__server['relative_path'] . '/p/' . rawurlencode($player->data['up_name']) . '/' . $player->id . '">Tilbake til profil</a></p>';
    ess::$b->page->load();
}
// forhåndsvisning?
$preview = false;
$text = $player->data['up_profile_text'];
if (isset($_POST['preview']) && (login::$logged_in && (login::$user->id == $player->data['up_u_id'] || access::has("crewet")))) {
    ess::$b->page->add_message("Denne profilen er en forhåndsvisning av teksten du redigerer.<br /><br />For å lagre teksten må du lukke dette vinduet og gå tilbake til redigeringen.");
    $text = $_POST['preview'];
    $preview = true;
}
$html = game::format_data($text, "profile", $player);
echo '
<div class="p" id="profile_text">
	' . (empty($html) ? '<span class="dark">Mangler profiltekst.</span>' : $html) . '
</div>
<div class="clear"></div>';
if ($preview) {
    echo '
<p class="dark" style="border-top: 2px solid #1F1F1F; padding: 5px 2px"><b>Dette er en forhåndsvisning.</b></p>';
}
// sjekk for whatpulse
Example #20
0
<?php

define("ALLOW_GUEST", true);
define("FORCE_HTTPS", true);
require "base.php";
global $_base;
$_base->page->add_title("Søknader");
// hent aktuell søknad
$id = \Kofradia\DB::quote(getval("so_id"));
$result = \Kofradia\DB::get()->query("SELECT so_id, so_title, so_info, so_expire, so_status FROM soknader_oversikt WHERE so_id = {$id}");
$soknad = $result->fetch();
$closed = $soknad['so_expire'] <= time();
// finnes ikke, eller ikke tilgang til ikke publisert søknad
if (!$soknad || $soknad['so_status'] == 0 && !access::has("mod")) {
    $_base->page->add_message("Fant ikke søknaden.", "error");
    redirect::handle("soknader");
}
$_base->page->add_title($soknad['so_title']);
redirect::store("soknader_vis?so_id={$soknad['so_id']}");
// hent felt til søknaden
$result = \Kofradia\DB::get()->query("SELECT sf_id, sf_title, sf_extra, sf_default_value, sf_params FROM soknader_felt WHERE sf_so_id = {$soknad['so_id']} ORDER BY sf_sort");
$felt = array();
while ($row = $result->fetch()) {
    $row['params'] = new params($row['sf_params']);
    $felt[$row['sf_id']] = $row;
}
// hent informasjon om brukeren og denne søknaden
$applicant = null;
if (login::$logged_in) {
    $result = \Kofradia\DB::get()->query("SELECT sa_id, sa_added, sa_status, sa_updated FROM soknader_applicants WHERE sa_so_id = {$soknad['so_id']} AND sa_up_id = " . login::$user->player->id);
    $applicant = $result->fetch();
Example #21
0
    /**
     * Vis toppliste
     */
    protected function top()
    {
        if (access::has("crewet") && !isset($_GET['update'])) {
            echo '
<p class="c"><a href="ranklist?update">Oppdater ranklista hvis det er feil i den &raquo;</a></p>';
        }
        // hent folka..
        $result = \Kofradia\DB::get()->query("\n\t\t\tSELECT up_id, up_name, up_access_level, up_points, up_last_online, up_profile_image_url, upr_rank_pos\n\t\t\tFROM users_players\n\t\t\t\tLEFT JOIN users_players_rank ON upr_up_id = up_id\n\t\t\tWHERE up_access_level < " . ess::$g['access_noplay'] . " AND up_access_level != 0\n\t\t\tORDER BY up_points DESC\n\t\t\tLIMIT 15");
        // hent familier hvor spilleren er medlem
        $result_ff = \Kofradia\DB::get()->query("\n\t\t\tSELECT ffm_up_id, ffm_priority, ff_id, ff_type, ff_name\n\t\t\tFROM\n\t\t\t\t(\n\t\t\t\t\tSELECT up_id\n\t\t\t\t\tFROM users_players\n\t\t\t\t\tWHERE up_access_level < " . ess::$g['access_noplay'] . " AND up_access_level != 0\n\t\t\t\t\tORDER BY up_points DESC\n\t\t\t\t\tLIMIT 15\n\t\t\t\t) ref\n\t\t\t\tJOIN ff_members ON ffm_up_id = up_id AND ffm_status = " . ff_member::STATUS_MEMBER . "\n\t\t\t\tJOIN ff ON ff_id = ffm_ff_id AND ff_type = 1 AND ff_inactive = 0\n\t\t\tORDER BY ff_name");
        $familier = array();
        while ($row = $result_ff->fetch()) {
            $pos = ff::$types[$row['ff_type']]['priority'][$row['ffm_priority']];
            $text = '<a href="' . ess::$s['relative_path'] . '/ff/?ff_id=' . $row['ff_id'] . '" title="' . htmlspecialchars($pos) . '">' . htmlspecialchars($row['ff_name']) . '</a>';
            $familier[$row['ffm_up_id']][] = $text;
        }
        ess::$b->page->add_css('
.ranklist_box {
	background-color: #1D1D1D;
	margin: 15px auto;
	overflow: hidden;
	padding-left: 10px;
	position: relative;
	/*width: 60%;*/
}
.ranklist_box .profile_image {
	float: left;
	margin: 0 10px 0 -10px;
	border: 0;
}
.ranklist_box_1 {
	max-height: 100px;
	min-height: 80px;
}
.ranklist_box_2 {
	min-height: 60px;
	max-height: 60px;
}
.ranklist_box_2 .profile_image {
	width: 80px;
}
.ranklist_pos {
	position: absolute;
	top: 10px;
	right: 10px;
	font-size: 30px;
}
.ranklist_box_2 .ranklist_pos { font-size: 20px }
.ranklist_player {
	position: absolute;
	top: 10px;
	left: 130px;
}
.ranklist_player img { display: none }
.ranklist_box_2 .ranklist_player { left: 90px }
.rp_up { font-size: 16px }
.rp_rank {
	display: block;
	padding-top: 5px;
	color: #555;
}
.rp_familie {
	position: absolute;
	bottom: 10px;
	right: 10px;
	text-align: right;
}
.rp_no_familie { color: #555 }');
        echo '
<div class="bg1_c small">
	<h1 class="bg1">Rangeringsoversikt<span class="left"></span><span class="right"></span></h1>
	<div class="bg1">';
        $e = 0;
        while ($row = $result->fetch()) {
            $e++;
            $rank = game::rank_info($row['up_points'], $row['upr_rank_pos'], $row['up_access_level']);
            echo '
		<p class="ranklist_box ranklist_box_' . ($e > 5 ? "2" : "1") . '">
			<img src="' . htmlspecialchars(player::get_profile_image_static($row['up_profile_image_url'])) . '" alt="Profilbilde" class="profile_image" />
			<span class="ranklist_pos">#' . $e . '</span>
			<span class="ranklist_player">
				<span class="rp_up">' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</span><br />
				<span class="rp_rank">' . $rank['name'] . '</span>
			</span>
			<span class="rp_familie">' . (!isset($familier[$row['up_id']]) ? '<i class="rp_no_familie">Ingen broderskap</i>' : implode(", ", $familier[$row['up_id']])) . '</span>
		</p>';
            if ($e == 15) {
                break;
            }
        }
        echo '
		<p class="c"><a href="ranklist?alle">Vis komplett liste &raquo;</a></p>
	</div>
</div>';
    }
Example #22
0
 /**
  * Hent oversikt over garasjefirmaer
  */
 public function get_ff()
 {
     $ff = array();
     // hent firmaer som leier ut garasjer
     $crew = access::has("mod") ? "" : " AND ff_is_crew = 0";
     $result = \Kofradia\DB::get()->query("\n\t\t\tSELECT ff_id, ff_name, ff_params\n\t\t\tFROM ff\n\t\t\tWHERE ff_type = " . ff::TYPE_GARASJE . " AND ff_inactive = 0{$crew}");
     while ($row = $result->fetch()) {
         $params = new params($row['ff_params']);
         unset($row['ff_params']);
         $row['price'] = $params->get("garasje_price", ff::GTA_GARAGE_PRICE_DEFAULT);
         $ff[$row['ff_id']] = $row;
     }
     return $ff;
 }
Example #23
0
        echo '
			</tbody>
		</table>';
    }
    echo '
	</div>
</div>';
    $_base->page->load();
}
echo '
<div class="bg1_c small">
	<h1 class="bg1">
		Søknader
		<span class="left"></span>
		<span class="right"></span>
	</h1>' . (access::has("mod") ? '
	<p class="h_left"><a href="soknader?admin">Administrer søknader</a></p>' : '') . '
	<div class="bg1">
		<!--<p>Her vil det bli lagt ut søknader for alle ting vi søker folk til. Måtte det være nye folk i crewet eller noe helt annet.</p>-->';
// hent åpne søknader
$result = \Kofradia\DB::get()->query("SELECT so_id, so_title, so_preinfo, so_expire FROM soknader_oversikt WHERE so_expire > " . time() . " AND so_status = 1 ORDER BY so_expire, so_title");
if ($result->rowCount() == 0) {
    echo '
		<p class="c">Det er ingen søknader som er åpne for øyeblikket.</p>';
} else {
    while ($row = $result->fetch()) {
        echo '
		<h2 class="bg1">
			' . htmlspecialchars($row['so_title']) . '
			<span class="left2"></span>
			<span class="right2"></span>
Example #24
0
    protected function list_cards_selectable(CardsPoker $poker, array $solve)
    {
        foreach ($poker->active as $key => $card) {
            echo sprintf('
				<input type="checkbox" name="kort[%d]" value="1" id="kort%d"%s /><label for="kort%d"><img src="%s" alt="%s" title="%s" class="spillekort" /></label>', $key, $key, isset($solve[2][$key]) && access::has("admin") ? ' checked="checked"' : '', $key, htmlspecialchars(sprintf(self::$kort_url, $card->num + 1, $card->group['name'])), ucfirst(htmlspecialchars($card->group['title'])) . ' ' . $card->sign(), ucfirst(htmlspecialchars($card->group['title'])) . ' ' . $card->sign());
        }
    }
Example #25
0
<?php

require "graphs_base.php";
ajax::require_user();
// annen bruker
$u_id = login::$user->id;
$up_name = login::$user->player->data['up_name'];
if (isset($_GET['up_id']) && access::has("mod")) {
    $up_id = (int) getval("up_id");
    $result = \Kofradia\DB::get()->query("SELECT up_u_id, up_id, up_name FROM users_players WHERE up_id = {$up_id}");
    if ($result->rowCount() == 0) {
        ajax::text("ERROR:UP-404", ajax::TYPE_404);
    }
    $row = $result->fetch();
    $u_id = $row['up_u_id'];
    $up_name = $row['up_name'];
}
// sett opp tidspunkt
$date = ess::$b->date->get();
$time_end = $date->format("U");
$day_end = $date->format("Y-m-d");
$date->modify("-30 days");
$date->setTime(0, 0, 0);
$time_start = $date->format("U");
$stats = array();
while (true) {
    $day = $date->format("Y-m-d");
    $stats[$day] = 0;
    $date->modify("+1 day");
    if ($day == $day_end) {
        break;
Example #26
0
    /**
     * Crewside
     */
    protected static function page_crew()
    {
        global $__server, $_lang;
        ess::$b->page->add_title("Crew");
        $subpage2 = getval("b");
        redirect::store(page_min_side::addr(NULL, $subpage2 != "" ? "b=" . $subpage2 : ''));
        ess::$b->page->add_css('
.minside_crew_links .active { color: #CCFF00 }');
        $links = array();
        $links[] = '<a href="' . htmlspecialchars(page_min_side::addr(NULL, "", "player")) . '">Min spiller</a>';
        $links[] = '<a href="' . htmlspecialchars(page_min_side::addr(NULL, "")) . '"' . ($subpage2 == "" ? ' class="active"' : '') . '>Oversikt / logg</a>';
        if (access::has("forum_mod")) {
            $links[] = '<a href="' . htmlspecialchars(page_min_side::addr(NULL, "b=addlog")) . '"' . ($subpage2 == "addlog" ? ' class="active"' : '') . '>Nytt notat</a>';
        }
        $links[] = '<a href="' . htmlspecialchars(page_min_side::addr(NULL, "b=blokk")) . '"' . ($subpage2 == "blokk" ? ' class="active"' : '') . '>Blokkeringer</a>';
        if (access::has("mod")) {
            $links[] = '<a href="' . htmlspecialchars(page_min_side::addr(NULL, "b=banka")) . '"' . ($subpage2 == "banka" ? ' class="active"' : '') . '>Bankpassord</a>';
        }
        if (access::has("mod")) {
            $links[] = '<a href="' . htmlspecialchars(page_min_side::addr(NULL, "b=birth")) . '"' . ($subpage2 == "birth" ? ' class="active"' : '') . '>Fødselsdato</a>';
        }
        if (access::has("mod")) {
            $links[] = '<a href="' . htmlspecialchars(page_min_side::addr("set", "b=pass")) . '">Passord</a>';
        }
        if (access::has("admin")) {
            $links[] = '<a href="' . htmlspecialchars(page_min_side::addr(NULL, "b=level")) . '"' . ($subpage2 == "level" ? ' class="active"' : '') . '>Tilgangsnivå</a>';
        }
        $links[] = '<a href="' . htmlspecialchars(page_min_side::addr(NULL, "b=send_email")) . '"' . ($subpage2 == "send_email" ? ' class="active"' : '') . '>Send e-post</a>';
        $links[] = '<a href="' . htmlspecialchars(page_min_side::addr(NULL, "b=warning")) . '"' . ($subpage2 == "warning" ? ' class="active"' : '') . '>Gi advarsel</a>';
        echo '
	<p class="c minside_crew_links">' . implode(" | ", $links) . '</p>';
        if ($subpage2 == "") {
            // javascript for rapporteringer
            ess::$b->page->add_js_domready('
	var w = $("minside_reports");
	var xhr = new Request({
		url: relative_path + "/ajax/minside_report",
		data: { u_id: ' . page_min_side::$active_user->id . ' },
		evalScripts: function(script)
		{
			ajax.js += script;
		}
	});
	xhr.addEvent("success", function(text)
	{
		w.set("html", text);
		w.getElements(".pagenumbers").each(function(elm)
		{
			elm.addEvent("set_page", function(s) { load(null, s, true); });
		});
		ajax.refresh();
	});
	xhr.addEvent("failure", function(x)
	{
		var p = new Element("p", {html: "Feil: " + x}).inject(w.empty());
	});
	function load(a, s, goto)
	{
		if (a !== null) xhr.options.data.a = a;
		if (s) xhr.options.data.s = s;
		if (goto) w.getParent().goto(-10);
		w.set("html", "<p>Laster inn data..</p>");
		xhr.send();
	}
	$("minside_reports_from").addEvent("click", function() { load("from", 1, true); });
	$("minside_reports_to").addEvent("click", function() { load("to", 1, true); });
	$("minside_reports_all").addEvent("click", function() { load("", 1, true); });
	load();');
            // css for rapporteringer
            ess::$b->page->add_css('
.rap_wrap {
	margin: 1em 0;
	background-color: #222222;
	position: relative;
	overflow: auto;
}
.rap_time {
	position: absolute;
	top: 8px;
	right: 5px;
	margin: 0;
	color: #777777;
}
.rap_time span {
	color: #EEEEEE;
}
.rap_w {
	margin: 0;
	padding: 5px;
	background-color: #282828;
}
.rap_u {
	font-size: 14px;
}

.rap_wrap .col2_w { margin: 0 }
.rap_wrap .col_w.left { width: 40% }
.rap_wrap .col_w.right { width: 60% }
.rap_wrap .col_w.left .col { margin: 0 0 0 5px }
.rap_wrap .col_w.right .col { margin: 5px 5px 5px 0 }

.rap_note {
	background-color: #1C1C1C;
	padding: 5px !important;
	overflow: auto;
	border: 1px dotted #525252
}
');
            // faner
            ess::$b->page->add_js_domready('
	$$(".minside_fane_link").addEvent("click", function(elm)
	{
		$$(".minside_fane").setStyle("display", "none");
		$$(".minside_fane_link").removeClass("minside_fane_active");
		this.addClass("minside_fane_active");
		$(this.get("rel")).setStyle("display", "");
	});
	$$(".minside_fane_active").fireEvent("click");');
            ess::$b->page->add_css('
.minside_fane_active, .minside_fane_active:hover {
	color: #CCFF00;
}');
            echo '
	<div class="col2_w">
		<div class="col_w left">
			<div class="col">
				<div class="bg1_c">
					<h1 class="bg1">Oversikt<span class="left2"></span><span class="right2"></span></h1>
					<div class="bg1">';
            // hent blokkeringer for brukeren
            $result = \Kofradia\DB::get()->query("SELECT ub_id, ub_type, ub_time_expire, ub_reason FROM users_ban WHERE ub_u_id = " . page_min_side::$active_user->id . " AND ub_time_expire > " . time());
            if ($result->rowCount() > 0) {
                while ($row = $result->fetch()) {
                    $access = access::has(blokkeringer::$types[$row['ub_type']]['access']);
                    echo '
						<p>Blokkert: ' . ($access ? '<a href="' . htmlspecialchars(page_min_side::addr(NULL, "b=blokk&t={$row['ub_type']}")) . '">' : '') . htmlspecialchars(blokkeringer::$types[$row['ub_type']]['title']) . ($access ? '</a>' : '') . ' (til ' . ess::$b->date->get($row['ub_time_expire'])->format(date::FORMAT_SEC) . ', ' . game::counter($row['ub_time_expire'] - time()) . ')</p>';
                }
            }
            echo '
						<p>Trykk deg inn på de forskjellige spillerene til brukeren for å se informasjon knyttet opp mot dem.</p>
					</div>
				</div>
			</div>
		</div>
		<div class="col_w right">
			<div class="col">
				<div class="bg1_c">
					<h1 class="bg1">Crewnotat for brukeren<span class="left2"></span><span class="right2"></span></h1>
					<p class="h_right"><a href="' . htmlspecialchars(page_min_side::addr(NULL, "b=enote")) . '">rediger</a></p>
					<div class="bg1">
						<p>Her kan hvem som helst i crewet legge til eller endre et notat for denne brukeren for å memorere ting som har med <u>brukeren</u> å gjøre.</p>' . (empty(page_min_side::$active_user->data['u_note_crew']) ? '
						<p>Ingen notat er registrert.</p>' : '
						<div class="p">' . game::bb_to_html(page_min_side::$active_user->data['u_note_crew']) . '</div>') . '
					</div>
				</div>
			</div>
		</div>
	</div>
	<p class="c"><a class="minside_fane_link minside_fane_active" rel="minside_fane2">Loggoppføringer</a> | <a class="minside_fane_link" rel="minside_fane1">Rapporteringer</a></p>
	<div id="minside_fane1" class="minside_fane">
		<p class="c">Filter: <a id="minside_reports_from">Brukerens egne rapporteringer</a> | <a id="minside_reports_to">Andres rapporteringer</a> | <a id="minside_reports_all">Alle</a></p>
		<div id="minside_reports">
			<p>Laster inn..</p>
		</div>
	</div>
	<div id="minside_fane2" class="minside_fane">
	<p class="c">Loggoppføringer for denne brukeren</p>';
            // hent loggene for denne brukeren
            $pagei = new pagei(pagei::ACTIVE_GET, "side", pagei::PER_PAGE, 50);
            $result = $pagei->query("SELECT lc_id, lc_up_id, lc_time, lc_lca_id, lc_a_up_id, lc_log FROM log_crew JOIN users_players ON up_u_id = " . page_min_side::$active_user->id . " WHERE lc_a_up_id = up_id ORDER BY lc_time DESC");
            // ingen handlinger?
            if ($result->rowCount() == 0) {
                echo '
	<p class="c">Ingen oppføringer eksisterer.</p>';
            } else {
                $rows = array();
                while ($row = $result->fetch()) {
                    $rows[$row['lc_id']] = $row;
                }
                $data = crewlog::load_summary_data($rows);
                $logs = array();
                foreach ($data as $row) {
                    // hent sammendrag
                    $summary = crewlog::make_summary($row, NULL, $row['lc_a_up_id'] != page_min_side::$active_player->id);
                    $day = ess::$b->date->get($row['lc_time'])->format(date::FORMAT_NOTIME);
                    $logs[$day][] = '<p><span class="time">' . ess::$b->date->get($row['lc_time'])->format("H:i") . ':</span> ' . $summary . '</p>';
                }
                ess::$b->page->add_css('.crewlog .time { color: #888888; padding-right: 5px }');
                foreach ($logs as $day => $items) {
                    echo '
	<div class="bg1_c">
		<h1 class="bg1">' . $day . '<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1 crewlog">
			' . implode('
			', $items) . '
		</div>
	</div>';
                }
                echo '
	<p class="c">' . $pagei->pagenumbers() . '</p>';
            }
            echo '
	</div>';
        } elseif ($subpage2 == "addlog" && access::has("forum_mod")) {
            // legge til?
            if (isset($_POST['notat'])) {
                $notat = trim(postval("notat"));
                $notat_bb = trim(game::bb_to_html($notat));
                if (empty($notat_bb)) {
                    ess::$b->page->add_message("Notatet kan ikke være tomt.", "error");
                } else {
                    // legg til i crewloggen
                    crewlog::log("user_add_note", page_min_side::$active_player->id, $notat);
                    ess::$b->page->add_message("Notatet ble registrert.");
                    redirect::handle(page_min_side::addr());
                }
            }
            ess::$b->page->add_title("Nytt notat");
            ess::$b->page->add_js_domready('$("notat_felt").focus();');
            echo '
	<div class="bg1_c">
		<h1 class="bg1">Legg til notat i crewloggen<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">
			<p>Notat: (Vil bli lagt til som vanlig logg i <a href="' . htmlspecialchars(page_min_side::addr(NULL)) . '">Crewloggen</a>.)</p>
			<form action="" method="post">
				<p><textarea name="notat" id="notat_felt" rows="10" cols="30" style="width: 98%; overflow: auto">' . htmlspecialchars(postval("notat")) . '</textarea></p>
				<p>' . show_sbutton("Legg til notat") . '</p>
			</form>
		</div>
	</div>';
        } elseif ($subpage2 == "blokk") {
            ess::$b->page->add_title("Blokkeringer");
            $type = false;
            if (isset($_GET['t'])) {
                // kontroller type
                $type_id = intval($_GET['t']);
                // fant ikke?
                if (!isset(blokkeringer::$types[$type_id])) {
                    ess::$b->page->add_message("Ugyldig type '.{$type_id}.'.", "error");
                } else {
                    $type = blokkeringer::$types[$type_id];
                    // har vi tilgang til å gjøre noe med denne blokkeringen?
                    if (!access::has($type['access'])) {
                        ess::$b->page->add_message('Du har ikke tilgang til denne typen blokkering. (' . htmlspecialchars($type['title']) . ')', "error");
                        $type = false;
                    }
                }
            }
            // vise en type blokkering?
            if ($type) {
                redirect::store(page_min_side::addr(NULL, "b=blokk&t={$type_id}"));
                // sjekk om det er en aktiv blokkering for denne typen
                $active = blokkeringer::check($type_id, page_min_side::$active_user->id);
                if ($active) {
                    // hent informasjon om blokkeringen
                    $info = blokkeringer::get_info($active['ub_id']);
                }
                // handling: legg til blokkering
                if (isset($_POST['add']) && $active) {
                    ess::$b->page->add_message("Det er allerede en blokkering på brukeren som varer til " . ess::$b->date->get($active['ub_time_expire'])->format() . ".", "error");
                } elseif (isset($_POST['add'])) {
                    // kontroller verdier
                    $date_type = isset($_POST['date_type']) && $_POST['date_type'] == "abs" ? "abs" : "rel";
                    $rel_weeks = intval(postval("rel_weeks"));
                    $rel_days = intval(postval("rel_days"));
                    $rel_hours = intval(postval("rel_hours"));
                    $rel_mins = intval(postval("rel_mins"));
                    $abs_date = postval("abs_date");
                    $abs_time = postval("abs_time");
                    // sjekk type og verdiene
                    $expire = false;
                    // bestemt dato/tidspunkt
                    if ($date_type == "abs") {
                        // kontroller datoen
                        if (!($abs_date_m = check_date($abs_date, "%y-%m-%d"))) {
                            ess::$b->page->add_message('Datoen du skrev inn er ikke gyldig.', "error");
                        } elseif (!($abs_time_m = check_date($abs_time, "%h:%i:%s"))) {
                            ess::$b->page->add_message('Tidspunktet du skrev inn er ikke gyldig.', "error");
                        } else {
                            // ok
                            $date = ess::$b->date->get();
                            $date->setTime($abs_time_m[1], $abs_time_m[2], $abs_time_m[3]);
                            $date->setDate($abs_date_m[1], $abs_date_m[2], $abs_date_m[3]);
                            $expire = $date->format("U");
                        }
                    } else {
                        // sjekk uker
                        if ($rel_weeks < 0 || $rel_weeks > 9) {
                            ess::$b->page->add_message('Antall uker kan ikke være under 0 eller over 9.', "error");
                        } elseif ($rel_days < 0 || $rel_days > 6) {
                            ess::$b->page->add_message('Antall dager kan ikke være under 0 eller over 6.', "error");
                        } elseif ($rel_hours < 0 || $rel_hours > 23) {
                            ess::$b->page->add_message('Antall timer kan ikke være under 0 eller over 23.', "error");
                        } elseif ($rel_mins < 0 || $rel_mins > 59) {
                            ess::$b->page->add_message('Antall minutter kan ikke være under 0 eller over 59.', "error");
                        } else {
                            // ok
                            $expire = time() + $rel_weeks * 604800 + $rel_days * 86400 + $rel_hours * 3600 + $rel_mins * 60;
                        }
                    }
                    // sjekke videre?
                    if ($expire) {
                        // sjekk at datoen er minst 1 min fremover i tid
                        if ($expire < time() + 60) {
                            ess::$b->page->add_message('Du kan ikke legge til en blokkering for mindre enn 1 minutt.', "error");
                        } else {
                            // kontroller begrunnelse og intern informasjon
                            $log = trim(postval("log"));
                            $note = trim(postval("note"));
                            // mangler begrunnelse?
                            if ($log == "") {
                                ess::$b->page->add_message('Mangler begrunnelse.', "error");
                            } elseif ($note == "") {
                                ess::$b->page->add_message("Mangler intern informasjon", "error");
                            } else {
                                // forsøk å legg til blokkeringen
                                $add = blokkeringer::add(page_min_side::$active_user->id, $type_id, $expire, $log, $note);
                                if ($add !== true) {
                                    ess::$b->page->add_message("Det er allerede en blokkering på brukeren som varer til " . ess::$b->date->get($add['ub_time_expire'])->format() . ".", "error");
                                } else {
                                    // legg til crewlogg
                                    crewlog::log("user_ban_active", page_min_side::$active_player->id, $log, array("type" => $type_id, "time_end" => $expire, "note" => $note));
                                    ess::$b->page->add_message('Brukeren er nå blokkert til ' . ess::$b->date->get($expire)->format() . '. (' . htmlspecialchars($type['title']) . ')');
                                    redirect::handle();
                                }
                            }
                        }
                    }
                } elseif (isset($_POST['edit']) && !$active) {
                    // ingen blokkering å redigere?
                    ess::$b->page->add_message("Brukeren har ikke lengre denne blokkeringen.", "error");
                } elseif (isset($_POST['edit'])) {
                    // godkjent handling?
                    if (isset($_POST['log_change'])) {
                        // kontroller verdier
                        $date = postval("date");
                        $time = postval("time");
                        // kontroller datoen
                        if (!($date_m = check_date($date, "%y-%m-%d"))) {
                            ess::$b->page->add_message('Datoen du skrev inn er ikke gyldig.', "error");
                        } elseif (!($time_m = check_date($time, "%h:%i:%s"))) {
                            ess::$b->page->add_message('Tidspunktet du skrev inn er ikke gyldig.', "error");
                        } else {
                            $date = ess::$b->date->get();
                            $date->setTime($time_m[1], $time_m[2], $time_m[3]);
                            $date->setDate($date_m[1], $date_m[2], $date_m[3]);
                            $expire = $date->format("U");
                            // sjekk at datoen er minst 1 min fremover i tid
                            if ($expire < time() + 60) {
                                ess::$b->page->add_message('Du kan ikke legge til en blokkering for mindre enn 1 minutt.', "error");
                            } else {
                                // kontroller begrunnelse for utestengelse, begrunnelse for endring og intern informasjon
                                $log_ban = trim(postval("log_ban"));
                                $log_change = trim(postval("log_change"));
                                $note = trim(postval("note"));
                                // mangler begrunnelse for endring?
                                if ($log_change == "") {
                                    ess::$b->page->add_message('Mangler begrunnelse for endring.', "error");
                                } elseif ($log_ban == "") {
                                    ess::$b->page->add_message('Mangler begrunnelse for utestengelse.', "error");
                                } elseif ($note == "") {
                                    ess::$b->page->add_message('Mangler intern informasjon.', "error");
                                } elseif ($expire == $info['ub_time_expire'] && $log_ban == $info['ub_reason'] && $note == $info['ub_note']) {
                                    ess::$b->page->add_message('Ingen endringer ble utført.', "error");
                                } else {
                                    // oppdater blokkeringen
                                    $edit = blokkeringer::edit($active['ub_id'], $expire, $log_ban, $note);
                                    if ($edit == 0) {
                                        ess::$b->page->add_message("Blokkeringen kunne ikke bli oppdatert. Den er mest sannsynlig ikke lengre aktiv.", "error");
                                    } else {
                                        // legg til crewlogg
                                        $data = array("type" => $type_id, "time_end_old" => $info['ub_time_expire'], "log_old" => $info['ub_reason'], "note_old" => $info['ub_note']);
                                        if ($expire != $info['ub_time_expire']) {
                                            $data["time_end_new"] = $expire;
                                        }
                                        if ($log_ban != $info['ub_reason']) {
                                            $data["log_new"] = $log_ban;
                                        }
                                        if ($note != $info['ub_note']) {
                                            $data["note_new"] = $note;
                                        }
                                        crewlog::log("user_ban_change", page_min_side::$active_player->id, $log_change, $data);
                                        ess::$b->page->add_message('Du har oppdatert blokkeringen. Brukeren er nå blokkert til ' . ess::$b->date->get($expire)->format() . '. (' . htmlspecialchars($type['title']) . ')');
                                        redirect::handle();
                                    }
                                }
                            }
                        }
                    }
                } elseif (isset($_POST['delete']) && !$active) {
                    // ingen blokkering å slette?
                    ess::$b->page->add_message("Brukeren har ikke lengre denne blokkeringen.", "error");
                } elseif (isset($_POST['delete'])) {
                    // godkjent handling?
                    if (isset($_POST['log'])) {
                        $log = trim(postval("log"));
                        // mangler logg?
                        if ($log == "") {
                            ess::$b->page->add_message('Mangler begrunnelse.', "error");
                        } else {
                            // fjern blokkeringen
                            $delete = blokkeringer::delete($active['ub_id']);
                            if ($delete == 0) {
                                ess::$b->page->add_message("Blokkeringen kunne ikke bli oppdatert. Den er mest sannsynlig ikke lengre aktiv.", "error");
                            } else {
                                // legg til crewlogg
                                crewlog::log("user_ban_delete", page_min_side::$active_player->id, $log, array("type" => $type_id, "time_end" => $info['ub_time_expire'], "log" => $info['ub_reason'], "note" => $info['ub_note']));
                                ess::$b->page->add_message('Du har fjernet blokkeringen. (' . htmlspecialchars($type['title']) . ')');
                                redirect::handle();
                            }
                        }
                    }
                }
                echo '
	<div class="bg1_c" style="width: 350px">
		<h1 class="bg1">Blokkering: ' . htmlspecialchars($type['title']) . '<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">
			<boxes />
			<p class="r">Tilgangsnivå: ' . access::name($type['access']) . '</p>
			<p><u>Hensikt:</u> ' . $type['description'] . '</p>';
                // blokkert?
                if ($active) {
                    echo '
			<p>Brukeren er blokkert.</p>
			<dl class="dd_right">
				<dt>Lagt til</dt>
				<dd>' . ess::$b->date->get($info['ub_time_added'])->format(date::FORMAT_SEC) . '<br />' . game::timespan($info['ub_time_added'], game::TIME_ABS | game::TIME_ALL, 5) . '</dd>
				<dt>Utestengt til</dt>
				<dd>' . ess::$b->date->get($info['ub_time_expire'])->format(date::FORMAT_SEC) . '<br />' . game::counter($info['ub_time_expire'] - time()) . '</dd>
			</dl>
			<div class="section">
				<h2>Begrunnelse</h2>
				<div class="p">' . (($reason = game::bb_to_html($info['ub_reason'])) == "" ? 'Ikke oppgitt.' : $reason) . '</div>
				<h2>Intern informasjon</h2>
				<div class="p">' . (($note = game::bb_to_html($info['ub_note'])) == "" ? 'Ikke oppgitt.' : $note) . '</div>
			</div>';
                    // handling: redigere blokkering
                    if (isset($_POST['edit'])) {
                        echo '
			<p>Du er i ferd med å endre blokkeringen til brukeren.</p>
			<form action="" method="post">
				<dl class="dd_right dl_2x">
					<dt>Til</dt>
					<dd>
						Dato:
						<input type="text" name="date" id="ban_date" value="' . htmlspecialchars(postval("date", ess::$b->date->get($info['ub_time_expire'])->format("Y-m-d"))) . '" class="styled w80" />
						<input type="text" name="time" id="ban_time" value="' . htmlspecialchars(postval("time", ess::$b->date->get($info['ub_time_expire'])->format("H:i:s"))) . '" class="styled w80" />
					</dd>
					<dt>Begrunnelse for endring</dt>
					<dd><textarea name="log_change" cols="30" rows="5">' . htmlspecialchars(postval("log_change")) . '</textarea></dd>
					<dt>Begrunnelse for blokkering</dt>
					<dd><textarea name="log_ban" cols="30" rows="5">' . htmlspecialchars(postval("log_ban", $info['ub_reason'])) . '</textarea></dd>
					<dt>Intern informasjon</dt>
					<dd><textarea name="note" cols="30" rows="5">' . htmlspecialchars(postval("note", $info['ub_note'])) . '</textarea></dd>
					<dd>
						' . show_sbutton("Lagre endringer", 'name="edit"') . '
						' . show_sbutton("Avbryt") . '
					</dd>
				</dl>
			</form>';
                    } elseif (isset($_POST['delete'])) {
                        echo '
			<p>Du er i ferd med å fjerne blokkeringen til brukeren.</p>
			<form action="" method="post">
				<dl class="dd_right dl_2x">
					<dt>Begrunnelse for fjerning</dt>
					<dd><textarea name="log" cols="30" rows="5">' . htmlspecialchars(postval("log")) . '</textarea></dd>
					<form action="" method="post">
						<dd>
							' . show_sbutton("Fjern", 'name="delete"') . '
							' . show_sbutton("Avbryt") . '
						</dd>
					</form>
				</dl>
			</form>';
                    } else {
                        echo '
			<form action="" method="post">
				<p>
					' . show_sbutton("Endre", 'name="edit"') . '
					' . show_sbutton("Fjern", 'name="delete"') . '
					<a href="' . htmlspecialchars(page_min_side::addr(NULL, "b=blokk")) . '" class="button">Tilbake</a>
				</p>
			</form>';
                    }
                } else {
                    $date_type = isset($_POST['type']) && $_POST['type'] == "abs" ? "abs" : "rel";
                    $hide_rel = $date_type == "rel" ? '' : ' hide';
                    $hide_abs = $date_type == "abs" ? '' : ' hide';
                    echo '
			<p>Brukeren har ingen aktiv blokkering.</p>
			<form action="" method="post">
				<input type="hidden" name="date_type" value="' . $date_type . '" />
				<dl class="dd_right dl_2x">
					<dt class="date_rel' . $hide_rel . '">Varighet (<a href="#" onclick="handleClass(\'.date_abs\', \'.date_rel\', event, this.parentNode.parentNode); $(\'date_type\').value=\'abs\'">velg dato</a>)</dt>
					<dd class="date_rel' . $hide_rel . '">
						<input type="text" name="rel_weeks" class="styled w30 r" style="width: 10px" value="' . intval(postval("rel_weeks")) . '" maxlength="1" /> uker
						<input type="text" name="rel_days" class="styled w30 r" style="width: 10px" value="' . intval(postval("rel_days")) . '" maxlength="1" /> dager
						<input type="text" name="rel_hours" class="styled w30 r" style="width: 17px" value="' . intval(postval("rel_hours")) . '" maxlength="2" /> timer
						<input type="text" name="rel_mins" class="styled w30 r" style="width: 17px" value="' . intval(postval("rel_mins")) . '" maxlength="2" /> minutter
					</dd>
					<dt class="date_abs' . $hide_abs . '">Til (<a href="#" onclick="handleClass(\'.date_rel\', \'.date_abs\', event, this.parentNode.parentNode); $(\'date_type\').value=\'rel\'">velg varighet</a>)</dt>
					<dd class="date_abs' . $hide_abs . '">
						Dato:
						<input type="text" name="abs_date" value="' . htmlspecialchars(postval("abs_date", ess::$b->date->get()->format("Y-m-d"))) . '" class="styled w80" />
						<input type="text" name="abs_time" value="' . htmlspecialchars(postval("abs_time", ess::$b->date->get()->format("H:i:s"))) . '" class="styled w60" />
					</dd>
					<dt>Begrunnelse</dt>
					<dd><textarea name="log" cols="30" rows="5">' . htmlspecialchars(postval("log")) . '</textarea></dd>
					<dt>Intern informasjon</dt>
					<dd><textarea name="note" cols="30" rows="5">' . htmlspecialchars(postval("note")) . '</textarea></dd>
					<dd>
						' . show_sbutton("Legg til blokkering", 'name="add"') . '
						<a href="' . htmlspecialchars(page_min_side::addr(NULL, "a=blokk")) . '" class="button">Tilbake</a>
					</dd>
				</dl>
			</form>';
                }
                echo '
		</div>
	</div>';
            } else {
                // filtrer ut de blokkeringene vi har tilgang til å sette
                $types = blokkeringer::$types;
                $links = array();
                foreach ($types as $id => $type) {
                    if (!access::has($type['access'])) {
                        continue;
                    }
                    $links[$type['title']] = '
				<li><a href="' . htmlspecialchars(page_min_side::addr(NULL, "b=blokk&t={$id}")) . '" title="' . htmlspecialchars($type['description']) . '">' . htmlspecialchars($type['title']) . '</a></li>';
                }
                // sorter
                ksort($links);
                $links = implode('', $links);
                // vis oversikt
                echo '
	<div class="bg1_c" style="width: 350px">
		<h1 class="bg1">Blokkeringer<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">
			<p>Velg type:</p>';
                if ($links == '') {
                    echo '
			<p>Du har ikke tilgang til noen blokkeringstyper.</p>';
                } else {
                    echo '
			<ul>' . $links . '
			</ul>';
                }
                echo '
		</div>
	</div>';
                // hent alle aktive blokkeringer
                $result = \Kofradia\DB::get()->query("SELECT ub_type, ub_time_expire, ub_reason FROM users_ban WHERE ub_u_id = " . page_min_side::$active_user->id . " AND ub_time_expire > " . time() . " ORDER BY ub_time_expire");
                if ($result->rowCount() > 0) {
                    echo '
	<div class="bg1_c" style="width: 350px">
		<h1 class="bg1">Aktive blokkeringer<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">
			<table class="table tablem" style="width: 100%">
				<thead>
					<tr>
						<th>Type</th>
						<th>Dato</th>
						<th>Begrunnelse</th>
					</tr>
				</thead>
				<tbody>';
                    $i = 0;
                    while ($row = $result->fetch()) {
                        $type = blokkeringer::get_type($row['ub_type']);
                        $access = access::has($type['access']);
                        echo '
					<tr' . (++$i % 2 == 0 ? ' class="color"' : '') . '>
						<td>' . ($access ? '<a href="' . htmlspecialchars(page_min_side::addr(NULL, "b=blokk&t={$row['ub_type']}")) . '">' : '') . htmlspecialchars($type['title']) . ($access ? '</a>' : '') . '</td>
						<td>
							' . ess::$b->date->get($row['ub_time_expire'])->format(date::FORMAT_SEC) . '<br />
							(' . game::timespan($row['ub_time_expire'], game::TIME_ABS | game::TIME_ALL, 5) . ')
						</td>
						<td>' . game::format_data($row['ub_reason'], "bb-opt", "Ingen begrunnelse gitt.") . '</td>
					</tr>';
                    }
                    echo '
				</tbody>
			</table>
		</div>
	</div>';
                }
            }
        } elseif ($subpage2 == "send_email") {
            ess::$b->page->add_title("Send e-post");
            // har tekst?
            $show_form = true;
            if (isset($_POST['text']) && !isset($_POST['edit'])) {
                $subject = trim(postval("subject"));
                $text = trim(postval("text"));
                // mangler emne?
                if (empty($subject)) {
                    ess::$b->page->add_message("Du må fylle ut emnefeltet.", "error");
                } elseif (empty($text)) {
                    ess::$b->page->add_message("Du må fylle ut innholdet.", "error");
                } else {
                    $email_subject = $subject;
                    $email_text = $text . "\n\n--\n" . login::$user->player->data['up_name'] . "\nwww.kofradia.no\n\nDenne meldingen ble sendt til " . page_min_side::$active_user->data['u_email'] . " som tilhører " . page_min_side::$active_player->data['up_name'];
                    // godkjent?
                    if (isset($_POST['send'])) {
                        // send e-posten
                        $email = new email();
                        $email->text = $email_text;
                        $email->headers['BCC'] = "*****@*****.**";
                        $email->headers['Reply-To'] = "*****@*****.**";
                        $email->send(page_min_side::$active_user->data['u_email'], $email_subject);
                        // legg til crewlogg
                        crewlog::log("user_send_email", page_min_side::$active_player->id, NULL, array("email" => page_min_side::$active_user->data['u_email'], "email_subject" => $email_subject, "email_content" => $email_text));
                        ess::$b->page->add_message("E-posten ble sendt til " . htmlspecialchars(page_min_side::$active_user->data['u_email']) . ".");
                        redirect::handle(page_min_side::addr(""));
                    }
                    echo '
	<div class="bg1_c" style="width: 400px">
		<h1 class="bg1">Send e-post<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">
			<p><b>Mottaker:</b> ' . htmlspecialchars(page_min_side::$active_user->data['u_email']) . '</p>
			<p><b>Emne:</b> ' . htmlspecialchars($email_subject) . '</p>
			<p style="font-family: monospace">' . nl2br(htmlspecialchars($email_text)) . '</p>
			<form action="" method="post">
				<input type="hidden" id="email_subject" name="subject" value="' . htmlspecialchars($subject) . '" />
				<input type="hidden" id="email_text" name="text" value="' . htmlspecialchars($text) . '" />
				<p>' . show_sbutton("Send e-posten", 'name="send"') . ' ' . show_sbutton("Tilbake / endre", 'name="edit"') . '</p>
			</form>
		</div>
	</div>';
                    $show_form = false;
                }
            }
            if ($show_form) {
                ess::$b->page->add_js_domready('$("email_subject").focus();');
                echo '
	<div class="bg1_c" style="width: 400px">
		<h1 class="bg1">Send e-post<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">
			<boxes />
			<p>Her sender du e-post til brukeren på vegne av Kofradia. Avsender vil være den normale avsendere all e-post fra Kofradia blir sendt fra.</p>
			<form action="" method="post">
				<dl class="dd_right dl_2x">
					<dt>Mottaker</dt>
					<dd>' . htmlspecialchars(page_min_side::$active_user->data['u_email']) . '</dd>
					<dt>Emne</dt>
					<dd><input type="text" value="' . htmlspecialchars(postval("subject")) . '" name="subject" id="email_subject" class="styled w200" /></dd>
					<dt>Innhold</dt>
					<dd><textarea name="text" id="email_text" cols="50" rows="10">' . htmlspecialchars(postval("text", "Hei,\n\n")) . '</textarea></dd>
					<dd>' . show_sbutton("Forhåndsvis / fortsett") . '</dd>
				</dl>
			</form>
		</div>
	</div>';
            }
        } elseif ($subpage2 == "warning") {
            ess::$b->page->add_title("Gi advarsel til brukeren");
            $types = crewlog::$user_warning_types;
            // legge til advarsel?
            if (isset($_POST['log'])) {
                $log = trim(postval("log"));
                $note = trim(postval("note"));
                $type = postval("type");
                $priority = (int) postval("priority");
                $notify = isset($_POST['notify']);
                if (empty($log) || empty($note)) {
                    ess::$b->page->add_message("Både begrunnelse og intern informasjon må fylles ut.", "error");
                } elseif (!isset($types[$type])) {
                    ess::$b->page->add_message("Ugyldig kategori.", "error");
                } elseif ($priority < 1 || $priority > 3) {
                    ess::$b->page->add_message("Ugylig alvorlighet.", "error");
                } else {
                    $data = array("type" => $types[$type], "note" => $note, "priority" => $priority);
                    // legge til spillerlogg?
                    if ($notify) {
                        $data['notified'] = 1;
                        $data['notified_id'] = player::add_log_static(gamelog::$items['advarsel'], urlencode($types[$type]) . ':' . urlencode($log), NULL, page_min_side::$active_player->id);
                        ess::$b->page->add_message("Advarselen ble lagret. Brukeren ble informert.");
                    } else {
                        ess::$b->page->add_message("Advarselen ble lagret. Du har ikke informert brukeren om denne advarselen.");
                    }
                    // legg til advarselen
                    crewlog::log("user_warning", page_min_side::$active_player->id, $log, $data);
                    redirect::handle();
                }
            }
            echo '
	<div class="bg1_c" style="width: 400px">
		<h1 class="bg1">Gi advarsel til brukeren<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">
			<form action="" method="post">
				<boxes />
				<p>Dette kan benyttes som et verktøy for å gi advarsler til brukere. Det kan velges om brukeren skal motta advarselen eller ikke. Hvis man ikke velger å informere brukeren om noe, blir det alikevel søkbart i crewloggen for brukeren.</p>
				<p>Alvorligheten av advarselen blir benyttet for å automatisere en poengsum brukeren får avhengig av antall advarseler. En advarsel med høy alvorlighet varer lenger og teller mer enn en med lav alvorlighet.</p>
				<dl class="dd_right">
					<dt>Kategori</dt>
					<dd>
						<select name="type">';
            $type = isset($_POST['type']) && isset($types[$_POST['type']]) ? intval($_POST['type']) : false;
            if ($type === false) {
                echo '
							<option value="">Velg ..</option>';
            }
            foreach ($types as $key => $row) {
                echo '
							<option value="' . $key . '"' . ($key === $type ? ' selected="selected"' : '') . '>' . htmlspecialchars($row) . '</option>';
            }
            echo '
						</select>
					</dd>
					<dt>Alvorlighet/prioritet</dt>
					<dd>
						<select name="priority">';
            $priority = isset($_POST['priority']) && is_numeric($_POST['priority']) && $_POST['priority'] >= 1 && $_POST['priority'] <= 3 ? $_POST['priority'] : 2;
            echo '
							<option value="1"' . ($priority == 1 ? ' selected="selected"' : '') . '>Lav</option>
							<option value="2"' . ($priority == 2 ? ' selected="selected"' : '') . '>Moderat</option>
							<option value="3"' . ($priority == 3 ? ' selected="selected"' : '') . '>Høy</option>
						</select>
					</dd>
				</dl>
				<p>Begrunnelse:</p>
				<p><textarea name="log" rows="10" cols="30" style="width: 98%">' . htmlspecialchars(postval("log")) . '</textarea></p>
				<p>Intern informasjon:</p>
				<p><textarea name="note" rows="10" cols="30" style="width: 98%">' . htmlspecialchars(postval("note")) . '</textarea></p>
				<p><input type="checkbox" name="notify"' . ($_SERVER['REQUEST_METHOD'] == "POST" && !isset($_POST['notify']) ? '' : ' checked="checked"') . ' id="warning_notify" /><label for="warning_notify"> Gi brukeren informasjon om denne advarselen. Kun kategori og begrunnelse vil bli oppgitt til brukeren som en logg i hendelser.</label></p>
				<p class="c">' . show_sbutton("Lagre") . '</p>
			</form>
		</div>
	</div>';
            // analyser advarsler
            $lca_id = crewlog::$actions['user_warning'][0];
            $pagei = new pagei(pagei::ACTIVE_GET, "side", pagei::PER_PAGE, 15);
            $result = $pagei->query("\n\t\t\t\tSELECT lc_id, lc_up_id, lc_time, lc_log, lcd_data_int\n\t\t\t\tFROM log_crew\n\t\t\t\t\tJOIN users_players ON lc_a_up_id = up_id AND up_u_id = " . page_min_side::$active_user->id . "\n\t\t\t\t\tLEFT JOIN log_crew_data ON lcd_lc_id = lc_id AND lcd_lce_id = 5\n\t\t\t\tWHERE lc_lca_id = {$lca_id} AND (lcd_data_int IS NULL OR lcd_data_int = 0)\n\t\t\t\tORDER BY lc_time DESC");
            $data = array();
            while ($row = $result->fetch()) {
                $data[$row['lc_id']] = $row;
            }
            // sett opp data
            $data = crewlog::load_summary_data($data);
            echo '
	<div class="bg1_c ' . (count($data) == 0 ? 'xsmall' : 'medium') . '">
		<h1 class="bg1">Tidligere advarsler<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">';
            if (count($data) == 0) {
                echo '
			<p>Brukeren har ingen tidligere advarsler.</p>';
            } else {
                ess::$b->page->add_css('
.advarsel { border: 1px solid #292929; margin: 10px 0; padding: 0 10px }');
                foreach ($data as $row) {
                    $priority = $row['data']['priority'] == 1 ? "lav" : ($row['data']['priority'] == 2 ? "moderat" : "høy");
                    echo '
			<div class="advarsel">
				<p><b>' . ess::$b->date->get($row['lc_time'])->format() . '</b>: ' . $row['data']['type'] . ' (alvorlighet: <b>' . $priority . '</b>):</p>
				<ul>
					<li>' . game::format_data($row['lc_log']) . '</li>
					<li>Internt notat: ' . game::format_data($row['data']['note']) . '</li>
				</ul>
				<p>' . (empty($row['data']['notified']) ? 'Ble IKKE varslet.' : 'Ble varslet.') . ' Av <user id="' . $row['lc_up_id'] . '" /></p>
			</div>';
                }
                echo '
			<p class="c">' . $pagei->pagenumbers() . '</p>';
            }
            echo '
		</div>
	</div>';
        } elseif ($subpage2 == "enote") {
            ess::$b->page->add_title("Endre notat for bruker");
            // lagre endringer?
            if (isset($_POST['notat'])) {
                $notat = postval("notat");
                if ($notat == page_min_side::$active_user->data['u_note_crew']) {
                    ess::$b->page->add_message("Ingen endringer ble utført.", "error");
                } else {
                    \Kofradia\DB::get()->exec("UPDATE users SET u_note_crew = " . \Kofradia\DB::quote($notat) . " WHERE u_id = " . page_min_side::$active_user->id);
                    // legg til crewlogg
                    crewlog::log("user_note_crew", page_min_side::$active_player->id, NULL, array("note_old" => page_min_side::$active_user->data['u_note_crew'], "note_diff" => diff::make(page_min_side::$active_user->data['u_note_crew'], $notat)));
                    ess::$b->page->add_message("Notatet ble endret.");
                    redirect::handle();
                }
            }
            echo '
	<div class="bg1_c" style="width: 400px">
		<h1 class="bg1">Endre crewnotat for bruker<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">
			<form action="" method="post">
				<p>Dette endrer notatet som er tilknyttet brukeren. Du kan også tilknytte <a href="' . htmlspecialchars(page_min_side::addr(NULL, "b=enote", "player")) . '">informasjon til spilleren</a>, hvis det heller er ønskelig.</p>
				<p>Notat:</p>
				<p><textarea name="notat" rows="10" cols="30" style="width: 98%">' . htmlspecialchars(page_min_side::$active_user->data['u_note_crew']) . '</textarea></p>
				<p class="c">' . show_sbutton("Lagre") . '</p>
			</form>
		</div>
	</div>';
        } elseif ($subpage2 == "level" && access::has("admin")) {
            // nivåer man kan bytte til
            static $levels = array(1 => "Vanlig bruker", 14 => "Skjult nostat (crewtilgang)", -4 => "Ressurs", 12 => "Ressurs (nostat)", 13 => "Utvikler", 4 => "Forummoderator", 6 => "Forummoderator (nostat)", 5 => "Moderator", 11 => "Seniormoderator");
            if (access::has("sadmin")) {
                $levels[7] = "Administrator";
            }
            if (access::has("sadmin")) {
                $levels[8] = "Superadministrator";
            }
            // kan vi ikke endre brukernivået til denne brukeren?
            if (!isset($levels[page_min_side::$active_user->data['u_access_level']])) {
                ess::$b->page->add_message("Du har ikke rettigheter til å endre tilgangsnivået til denne brukeren.", "error");
                redirect::handle(page_min_side::addr());
            }
            // endre brukernivå?
            if (isset($_POST['level'])) {
                $level = intval($_POST['level']);
                $log = trim(postval("log"));
                // samme brukernivå?
                if ($level == page_min_side::$active_user->data['u_access_level']) {
                    ess::$b->page->add_message("Du må velge et nytt tilgangsnivå.", "error");
                } elseif (!isset($levels[$level])) {
                    ess::$b->page->add_message("Ugyldig tilgangsnivå.");
                } elseif (empty($log)) {
                    ess::$b->page->add_message("Mangler begrunnelse.");
                } else {
                    // endre tilgangsnivå
                    $old = page_min_side::$active_user->data['u_access_level'];
                    if (page_min_side::$active_user->change_level($level, isset($_POST['no_update_up']))) {
                        // e-post logg
                        sysreport::log("Endring av tilgangsnivå: " . login::$user->player->data['up_name'] . " endret tilgangsnivået til " . page_min_side::$active_user->data['u_email'] . " (" . page_min_side::$active_player->data['up_name'] . ") fra {$levels[$old]} til {$levels[$level]} {$__server['path']}/min_side?u_id=" . page_min_side::$active_user->id . "\n\nBegrunnelse: " . strip_tags(game::format_data($log)), "Kofradia: Endring av tilgangsnivå for " . page_min_side::$active_user->data['u_email'] . " (" . page_min_side::$active_player->data['up_name'] . ")");
                        // finn totalt beløp spilleren har
                        $result = \Kofradia\DB::get()->query("SELECT up_cash + up_bank FROM users_players WHERE up_id = " . page_min_side::$active_player->id);
                        $money = $result->fetchColumn(0);
                        // crewlogg
                        $data = array("level_old" => $old, "level_old_text" => $levels[$old], "level_new" => $level, "level_new_text" => $levels[$level], "money" => $money, "points" => page_min_side::$active_player->data['up_points']);
                        if (page_min_side::$active_player->active && !isset($_POST['no_update_up'])) {
                            $data['up_id'] = page_min_side::$active_player->id;
                        }
                        crewlog::log("user_level", page_min_side::$active_player->id, $log, $data);
                        putlog("CREWCHAN", "%bEndring av tilgangsnivå%b: " . login::$user->player->data['up_name'] . " endret tilgangsnivået til " . page_min_side::$active_user->data['u_email'] . " (" . page_min_side::$active_player->data['up_name'] . ") fra {$levels[$old]} til {$levels[$level]} {$__server['path']}/min_side?u_id=" . page_min_side::$active_user->id);
                        ess::$b->page->add_message('Tilgangsnivået ble endret fra <b>' . htmlspecialchars($levels[$old]) . '</b> til <b>' . htmlspecialchars($levels[$level]) . '</b>.');
                    } else {
                        ess::$b->page->add_message("Tilgangsnivået kunne ikke endres.", "error");
                    }
                    redirect::handle();
                }
            }
            echo '
	<div class="bg1_c" style="width: 350px">
		<h1 class="bg1">Endre tilgangsnivå for bruker<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">' . (page_min_side::$active_player->active ? '
			<p>Dette vil automatisk berøre spilleren ' . page_min_side::$active_player->profile_link() . '.<p>' : '
			<p>Dette vil kun ha innvirkning på brukeren, siden det ikke er noen aktiv spiller.</p>') . '
			<form action="" method="post">
				<dl class="dd_right">
					<dt>Nåværende tilgangsnivå</dt>
					<dd>' . $levels[page_min_side::$active_user->data['u_access_level']] . '</dd>
					<dt>Nytt tilgangsnivå</dt>
					<dd>
						<select name="level">';
            $level = intval(postval("level", page_min_side::$active_user->data['u_access_level']));
            foreach ($levels as $id => $name) {
                echo '
							<option value="' . $id . '"' . ($level == $id ? ' selected="selected"' : '') . '>' . htmlspecialchars($name) . '</option>';
            }
            echo '
						</select>
					</dd>
					<dt>Begrunnelse</dt>
					<dd><textarea name="log" id="log" cols="30" rows="5">' . htmlspecialchars(postval("log")) . '</textarea></dd>
				</dl>' . (page_min_side::$active_player->active ? '
				<p><input type="checkbox" id="no_update_up" name="no_update_up"' . (isset($_POST['no_update_up']) ? ' checked="checked"' : '') . ' /><label for="no_update_up"> Ikke oppdater det visuelle tilgangsnivået til ' . page_min_side::$active_player->profile_link() . '</label></p>' : '') . '
				<p class="c">' . show_sbutton("Endre tilgangsnivå") . '</p>
			</form>
		</div>
	</div>';
        } elseif ($subpage2 == "banka" && access::has("mod")) {
            // lagre nytt passord
            if (isset($_POST['bank_auth'])) {
                $bank_auth = postval("bank_auth");
                $log = trim(postval("log"));
                // for kort?
                if (mb_strlen($bank_auth) < 6) {
                    ess::$b->page->add_message("Passordet må inneholde minst 6 tegn.", "error");
                } elseif (password::verify_hash($bank_auth, page_min_side::$active_user->data['u_bank_auth'], 'bank_auth')) {
                    ess::$b->page->add_message("Passordet er det samme som nåværende.", "error");
                } elseif ($log == "") {
                    ess::$b->page->add_message("Mangler begrunnelse.", "error");
                } else {
                    $newpass = password::hash($bank_auth, null, 'bank_auth');
                    \Kofradia\DB::get()->exec("UPDATE users SET u_bank_auth = " . \Kofradia\DB::quote($newpass) . " WHERE u_id = " . page_min_side::$active_user->id);
                    // crewlogg
                    crewlog::log("user_bank_auth", page_min_side::$active_player->id, $log, array("pass_old" => page_min_side::$active_user->data['u_bank_auth'], "pass_new" => $newpass));
                    ess::$b->page->add_message("Bankpassordet ble endret.");
                    redirect::handle();
                }
            }
            ess::$b->page->add_title("Endre bankpassord");
            echo '
	<div class="bg1_c" style="width: 350px">
		<h1 class="bg1">Endre bankpassord<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">
			<form action="" method="post" autocomplete="off">
				<dl class="dd_right">
					<dt>Nytt bankpassord</dt>
					<dd><input type="password" id="bank_auth" class="styled w120" /></dd>
					<dt>Begrunnelse for endring</dt>
					<dd><textarea name="log" id="log" cols="30" rows="5">' . htmlspecialchars(postval("log")) . '</textarea></dd>
				</dl>
				<p class="c">' . show_sbutton("Lagre") . '</p>
			</form>
		</div>
	</div>';
        } elseif ($subpage2 == "phone" && access::has("mod")) {
            // lagre nytt nummer?
            if (isset($_POST['phone'])) {
                $phone = postval("phone");
                $log = trim(postval("log"));
                if (!preg_match("/^47\\d{8}\$/Du", $phone) && $phone != "") {
                    ess::$b->page->add_message("Ugyldig telefonnummer. Må bestå av 10 tall inkludert 47 først.", "error");
                } else {
                    // kontroller at nummeret ikke er lagt inn fra før
                    $result = \Kofradia\DB::get()->query("SELECT u_id, u_email, up_id, up_name, up_access_level FROM users, users_players WHERE u_phone = " . \Kofradia\DB::quote($phone) . " AND u_id != " . page_min_side::$active_user->id . " AND up_id = u_active_up_id LIMIT 1");
                    if ($result->rowCount() > 0) {
                        $row = $result->fetch();
                        ess::$b->page->add_message('Nummeret er allerede i bruk av <a href="min_side?u_id=' . $row['u_id'] . '">' . htmlspecialchars($row['u_email']) . '</a> (' . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . ').', "error");
                    } elseif ($phone == page_min_side::$active_user->data['u_phone']) {
                        ess::$b->page->add_message("Nummeret er det samme som nåværende nummer.", "error");
                    } elseif ($log == "") {
                        ess::$b->page->add_message("Mangler logg melding.");
                    } else {
                        // lagre nytt nummer
                        \Kofradia\DB::get()->exec("UPDATE users SET u_phone = " . \Kofradia\DB::quote($phone) . " WHERE u_id = " . page_min_side::$active_user->id);
                        crewlog::log("user_phone", page_min_side::$active_player->id, $log, array("phone_old" => page_min_side::$active_user->data['u_phone'], "phone_new" => $phone));
                        ess::$b->page->add_message('Mobilnummeret ble endret fra <b>' . (empty(page_min_side::$active_user->data['u_phone']) ? 'tomt' : htmlspecialchars(page_min_side::$active_user->data['u_phone'])) . '</b> til <b>' . (empty($phone) ? 'tomt' : $phone) . '</b>.');
                    }
                }
            }
            ess::$b->page->add_title("Endre mobilnummer");
            echo '
	<div class="bg1_c" style="width: 350px">
		<h1 class="bg1">Endre mobilnummer<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">
			<p>Her endrer du mobilnummeret til brukeren. Dette kan bli brukt til å sende ut forskjellig informasjon.</p>
			<form action="" method="post">
				<dl class="dd_right dl_2x">
					<dt>Nåværende nummer</dt>
					<dd>' . (empty(page_min_side::$active_user->data['u_phone']) ? 'Tomt' : htmlspecialchars(page_min_side::$active_user->data['u_phone'])) . '</dd>
					<dt>Nytt nummer</dt>
					<dd><input type="text" maxlength="10" value="' . htmlspecialchars(postval("phone", page_min_side::$active_user->data['u_phone'])) . '" name="phone" class="styled w80" /></dd>
					<dt>Begrunnelse for endring</dt>
					<dd><textarea name="log" cols="30" rows="5">' . htmlspecialchars(postval("log")) . '</textarea></dd>
				</dl>
				<p class="c">' . show_sbutton("Lagre") . '</p>
			</form>
		</div>
	</div>';
        } elseif ($subpage2 == "birth" && access::has("mod")) {
            // lagre ny fødselsdato?
            if (isset($_POST['birth_day']) && isset($_POST['birth_month']) && isset($_POST['birth_year'])) {
                $birth = postval("birth");
                // sjekk fødselsdato
                $birth_day = intval(postval("birth_day"));
                $birth_month = intval(postval("birth_month"));
                $birth_year = intval(postval("birth_year"));
                $date = ess::$b->date->get();
                $n_day = $date->format("j");
                $n_month = $date->format("n");
                $n_year = $date->format("Y");
                $age = $n_year - $birth_year - ($n_month < $birth_month || $birth_month == $n_month && $n_day < $birth_day ? 1 : 0);
                $birth = $birth_year . "-" . str_pad($birth_month, 2, "0", STR_PAD_LEFT) . "-" . str_pad($birth_day, 2, "0", STR_PAD_LEFT);
                // sjekk om fødselsdatoen er gyldig
                $birth_date = ess::$b->date->get();
                $birth_date->setDate($birth_year, $birth_month, $birth_day);
                $birth_valid = $birth_date->format("Y-m-d") == $birth;
                $log = trim(postval("log"));
                // ugyldig dag?
                if ($birth_day < 0 || $birth_day > 31) {
                    ess::$b->page->add_message("Du må velge en gyldig dag.", "error");
                } elseif ($birth_month < 0 || $birth_month > 12) {
                    ess::$b->page->add_message("Du må velge en gyldig måned.", "error");
                } elseif (($birth_year < 1900 || $birth_year > $n_year) && $birth_year !== 0) {
                    ess::$b->page->add_message("Du må velge et gyldig år.", "error");
                } elseif (!$birth_valid && $birth !== '0-00-00') {
                    ess::$b->page->add_message("Datoen du fylte inn for fødselsdatoen din eksisterer ikke.");
                } elseif ($birth == page_min_side::$active_user->data['u_birth']) {
                    ess::$b->page->add_message("Fødselsdatoen ble ikke endret.", "error");
                } elseif ($log == "") {
                    ess::$b->page->add_message("Mangler begrunnelse.", "error");
                } else {
                    // oppdater
                    \Kofradia\DB::get()->exec("UPDATE users SET u_birth = " . \Kofradia\DB::quote($birth) . " WHERE u_id = " . page_min_side::$active_user->id);
                    // legg til crewlogg
                    crewlog::log("user_birth", page_min_side::$active_player->id, $log, array("birth_old" => page_min_side::$active_user->data['u_birth'], "birth_new" => $birth));
                    // alder
                    if ($age < 13) {
                        ess::$b->page->add_message("Fødselsdatoen ble satt til <b>{$birth}</b> ({$age} år). Brukeren oppfyller <u>ikke</u> kravet om alder jf. betingelsene.");
                    } else {
                        ess::$b->page->add_message("Fødselsdatoen ble satt til <b>{$birth}</b> ({$age} år).");
                    }
                    redirect::handle();
                }
            }
            $birth = explode("-", page_min_side::$active_user->data['u_birth']);
            $birth_day = isset($birth[2]) ? intval($birth[2]) : 0;
            $birth_month = isset($birth[1]) ? intval($birth[1]) : 0;
            $birth_year = isset($birth[0]) ? intval($birth[0]) : 0;
            ess::$b->page->add_title("Endre fødselsdato");
            echo '
	<div class="bg1_c" style="width: 350px">
		<h1 class="bg1">Endre fødselsdato<span class="left2"></span><span class="right2"></span></h1>
		<div class="bg1">
			<form action="" method="post">
				<dl class="dd_right dl_2x">
					<dt>Nåværende fødselsdato</dt>
					<dd>' . (empty(page_min_side::$active_user->data['u_birth']) ? 'Ikke registrert' : htmlspecialchars(page_min_side::$active_user->data['u_birth'])) . '</dd>
					<dt>Ny fødselsdato</dt>
					<dd>
						<select name="birth_day">
							<option value="">Dag</option>
							<option value="0">0</option>';
            $active = postval("birth_day", $birth_day);
            for ($i = 1; $i <= 31; $i++) {
                echo '
							<option value="' . $i . '"' . ($i == $active ? ' selected="selected"' : '') . '>' . $i . '</option>';
            }
            echo '
						</select>
						<select name="birth_month">
							<option value="">Måned</option>
							<option value="0">Tom</option>';
            $active = postval("birth_month", $birth_month);
            for ($i = 1; $i <= 12; $i++) {
                echo '
							<option value="' . $i . '"' . ($i == $active ? ' selected="selected"' : '') . '>' . ucfirst($_lang['months'][$i]) . '</option>';
            }
            echo '
						</select>
						<select name="birth_year">
							<option value="">År</option>
							<option value="0">0000</option>';
            $active = postval("birth_year", $birth_year);
            for ($i = ess::$b->date->get()->format("Y"); $i >= 1900; $i--) {
                echo '
							<option value="' . $i . '"' . ($i == $active ? ' selected="selected"' : '') . '>' . $i . '</option>';
            }
            echo '
						</select>
					</dd>
					<dt>Begrunnelse for endring</dt>
					<dd><textarea name="log" id="log" cols="30" rows="5">' . htmlspecialchars(postval("log")) . '</textarea></dd>
				</dl>
				<p class="c">' . show_sbutton("Lagre") . '</p>
			</form>
		</div>
	</div>';
        }
    }
Example #27
0
 /**
  * Sett opp og kontroller mottakere
  */
 protected function parse_receivers()
 {
     // sett opp søk
     $where = $this->get_receivers();
     if (!$where) {
         return null;
     }
     // hent brukere og evt. blokk
     $result = \Kofradia\DB::get()->query("\n\t\t\tSELECT u_active_up_id, u_access_level, up_id, up_name, up_access_level, uc_id, uc_info\n\t\t\tFROM (\n\t\t\t\tSELECT u_active_up_id, u_access_level, up_id, up_name, up_access_level, uc_id, uc_info\n\t\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\t\tWHERE up_u_id = u_id AND {$where}\n\t\t\t\tORDER BY up_access_level = 0, up_last_online DESC\n\t\t\t) ref\n\t\t\tGROUP BY up_name");
     $this->errors = array();
     $this->infos = array();
     $receivers = array();
     while ($row = $result->fetch()) {
         // seg selv?
         if ($row['up_id'] == login::$user->player->id) {
             $this->remove_player($row);
             $this->errors[] = 'Du kan ikke legge til deg selv som mottaker. Du er mottaker av meldingen automatisk.';
         } elseif ($row['up_access_level'] == 0 && (!access::has("crewet") || $row['u_access_level'] == 0 || count($this->players_list) > 1 || $row['u_active_up_id'] != $row['up_id'])) {
             if (!access::has("crewet") || $row['u_access_level'] == 0 || $row['u_active_up_id'] != $row['up_id']) {
                 $this->remove_player($row);
                 $this->errors[] = '<user id="' . $row['up_id'] . '" /> er død og kan ikke motta meldinger.';
             } else {
                 $receivers[] = $row;
                 $this->errors[] = '<user id="' . $row['up_id'] . '" /> er død, men brukeren er aktivert. Kan motta meldinger hvis spilleren er den eneste mottakeren.';
             }
         } elseif ($row['uc_id'] && !access::has("crewet")) {
             $this->remove_player($row);
             // sett opp begrunnelse
             $info = $row['uc_info'];
             $reason = game::bb_to_html($info);
             $reason = empty($reason) ? '' : ' Begrunnelse: ' . $reason;
             $this->errors[] = '<user id="' . $row['up_id'] . '" /> har blokkert deg og kan ikke legges til som mottaker.' . $reason;
         } else {
             // forbeholdt mot å motta meldinger? -> men crew
             if (in_array($row['up_access_level'], ess::$g['access']['block_pm']) && access::has("crewet")) {
                 $this->infos[] = '<user id="' . $row['up_id'] . '" /> er egentlig reservert mot meldinger.';
             } elseif (in_array($row['up_access_level'], ess::$g['access']['block_pm'])) {
                 $result2 = \Kofradia\DB::get()->query("\n\t\t\t\t\t\tSELECT uc_contact_up_id\n\t\t\t\t\t\tFROM users_players, users_contacts\n\t\t\t\t\t\tWHERE up_id = {$row['up_id']}\n\t\t\t\t\t\t  AND up_u_id = uc_u_id\n\t\t\t\t\t\t  AND uc_contact_up_id = " . login::$user->player->id . "\n\t\t\t\t\t\t  AND uc_type = 1");
                 $kontakt = $result2->rowCount() > 0;
                 // ikke kontakt? sjekk for mottatt melding innen 24 timer
                 if (!$kontakt) {
                     $expire = time() - 86400;
                     $result2 = \Kofradia\DB::get()->query("\n\t\t\t\t\t\t\tSELECT MAX(ir2.ir_restrict_im_time)\n\t\t\t\t\t\t\tFROM inbox_rel AS ir1, inbox_rel AS ir2\n\t\t\t\t\t\t\tWHERE ir1.ir_up_id = {$row['up_id']} AND ir1.ir_it_id = ir2.ir_it_id AND ir2.ir_up_id = " . login::$user->player->id . " AND ir1.ir_deleted = 0");
                     // for lenger enn 24 timer siden? --> kan ikke sende melding
                     if ($result2->rowCount() == 0 || $result2->fetchColumn(0) < $expire) {
                         $this->remove_player($row);
                         $this->errors[] = '<user id="' . $row['up_id'] . '" /> kan ikke legges til som mottaker fordi spilleren er reservert mot dette. For å kunne sende melding til denne spilleren må du være i kontaklisten til personen, eller ha mottatt en melding fra personen i løpet av de siste 24 timene.';
                         putlog("NOTICE", "%bMELDING SPERRET%b: %u" . login::$user->player->data['up_name'] . "%u forsøkte å sende melding til %u{$row['up_name']}%u men var ikke i kontaktlisten!");
                         // lagre logg
                         $file = GAMELOG_DIR . "/message_reject_" . date("Ymd_His") . ".log";
                         $fh = @fopen($file, "w");
                         if ($fh) {
                             fwrite($fh, "Melding fra " . login::$user->player->data['up_name'] . " (ID: " . login::$user->player->id . ")\n\n\n" . print_r($_POST, true));
                             fclose($fh);
                             putlog("NOTICE", "%c4%bMESSAGE LOG SAVED TO %u{$file}%u");
                         } else {
                             putlog("NOTICE", "%c0,4%bERROR SAVING MESSAGE LOG TO FILE {$file}");
                         }
                         continue;
                     }
                 }
             }
             // kan sende melding
             $receivers[] = $row;
             // blokkert men vi er crew? (testet ovenfor hvis man ikke var crew)
             if ($row['uc_id']) {
                 $info = $row['uc_info'];
                 $reason = game::bb_to_html($info);
                 $reason = empty($reason) ? '' : ' Begrunnelse: ' . $reason;
                 $this->infos[] = '<user id="' . $row['up_id'] . '" /> har egentlig blokkert deg.' . $reason;
             }
         }
     }
     $this->receivers = $receivers;
 }
Example #28
0
<?php

require "base.php";
global $_base;
// vis en spesiell bruker?
$user = login::$user;
$show_deleted = false;
// bruker ID
if (isset($_GET['u_id']) && access::has("admin")) {
    // hent info
    $u_id = (int) getval("u_id");
    $user = user::get($u_id);
    if (!$user) {
        echo '
<h1>Meldinger</h1>
<p>Fant ingen bruker med ID <b>' . $u_id . '</b>.</p>';
        $_base->page->load();
    }
    $show_deleted = true;
    echo '
<h1 class="scroll_here">Meldinger Admin</h1>
<p>Du viser meldingene som tilhører ' . game::profile_link($user->player->data['up_id'], $user->player->data['up_name'], $user->player->data['up_access_level']) . '</p>';
    redirect::store("innboks_sok?u_id={$u_id}");
}
// logg visning av innboks
putlog("PROFILVIS", "%c5%bVIS-MELDINGER-SOK:%b%c %u" . login::$user->player->data['up_name'] . "%u ({$_SERVER['REQUEST_URI']})");
// hvem som skal ha kunnet skrevet det man søker på
$search_from = array(1 => array("Alle", ""), array("Meg selv", " AND im_up_id = up_ref.up_id"), array("Andre", " AND im_up_id != up_ref.up_id"), array('Spesifiser', NULL, array()));
$id = requestval("f");
$search_from_id = isset($search_from[$id]) ? $id : 1;
// fant ikke brukeren?
Example #29
0
 /**
  * Kontroller tilgangsnivå
  * Hvis data hentes fra SESSION, må brukeren være logget inn som crew først
  */
 public static function access($access_name, $allow_extended_access_login = NULL)
 {
     if (self::$access_override) {
         return true;
     }
     sess_start();
     if (!isset($_SESSION[$GLOBALS['__server']['session_prefix'] . 'user'])) {
         return false;
     }
     return access::has($access_name, NULL, $_SESSION[$GLOBALS['__server']['session_prefix'] . 'user']->data['u_access_level'], $allow_extended_access_login ? 'login' : NULL);
 }
Example #30
0
    /**
     * Vis fengsel
     */
    protected function show()
    {
        // er vi i fengsel nå?
        if ($wait = $this->up->fengsel_wait()) {
            ess::$b->page->add_js_domready('$("fengsel_dusor").focus();');
            echo '
<div class="bg1_c xsmall">
	<h1 class="bg1">Du er i fengsel<span class="left"></span><span class="right"></span></h1>
	<p class="h_right"><a href="node/16">Hjelp</a></p>
	<div class="bg1">
		<p>Du befinner deg for øyeblikket i fengsel og slipper ut om ' . game::counter($wait, true) . '.</p>' . (!$this->up->is_nostat() ? '
		<form action="" method="post">
			<input type="hidden" name="sid" value="' . login::$info['ses_id'] . '" />
			<input type="hidden" name="expire" value="' . $this->up->data['up_fengsel_time'] . '" />
			<dl class="dd_right">
				<dt>Dusør for å bryte deg ut</dt>
				<dd><input type="text" class="styled w80" name="amount" id="fengsel_dusor" value="' . game::format_cash($this->up->data['up_fengsel_dusor']) . '" /></dd>
			</dl>
			<p class="c">' . show_sbutton($this->up->data['up_fengsel_dusor'] > 0 ? "Endre dusør" : "Sett dusør", 'name="dusor"') . '</p>
			<p class="c">Spilleren som bryter ut mottar kun ' . self::DUSOR_PROFIT * 100 . ' % av dusøren.</p>
		</form>' : '') . '
	</div>
</div>';
        }
        // sortering
        $sort = new sorts("sort");
        $sort->append("asc", "Spiller", "up_name");
        $sort->append("desc", "Spiller", "up_name DESC");
        $sort->append("asc", "Wanted nivå", "up_wanted_level, up_fengsel_time DESC");
        $sort->append("desc", "Wanted nivå", "up_wanted_level DESC, up_fengsel_time DESC");
        $sort->append("asc", "Tid igjen", "up_fengsel_time");
        $sort->append("desc", "Tid igjen", "up_fengsel_time DESC");
        $sort->set_active(requestval("sort"), 5);
        // hent folk i fengsel
        $sort_info = $sort->active();
        $pagei = new pagei(pagei::ACTIVE_GET, "side", pagei::PER_PAGE, 15);
        $result = $pagei->query("\n\t\t\tSELECT up_id, up_name, up_access_level, up_fengsel_time, up_fengsel_num, up_fengsel_dusor, ROUND(up_fengsel_dusor * " . self::DUSOR_PROFIT . ") up_fengsel_dusor_get, up_wanted_level\n\t\t\tFROM users_players\n\t\t\tWHERE up_fengsel_time > " . time() . " AND up_access_level != 0\n\t\t\tORDER BY {$sort_info['params']}");
        $num = $result->rowCount();
        echo '
<div class="bg1_c ' . ($num == 0 ? 'xsmall' : 'xlarge') . '">
	<h1 class="bg1">Fengsel<span class="left"></span><span class="right"></span></h1>
	<p class="h_right"><a href="node/16">Hjelp</a></p>
	<div class="bg1">
		<form action="" method="post">
			<p class="c dark">Ditt wanted nivå er på ' . game::format_number($this->up->data['up_wanted_level'] / 10, 1) . ' %.</p>';
        if ($num == 0) {
            echo '
			<p class="c dark">Ingen er i fengselet for øyeblikket.</p>
			<p class="c"><a href="' . htmlspecialchars(game::address("fengsel", $_GET)) . '" class="button">Oppdater</a></p>';
        } else {
            echo '
			<table class="table center" width="100%">
				<thead>
					<tr>
						<th>Spiller ' . $sort->show_link(0, 1) . '</th>
						<th>Wanted<br />nivå ' . $sort->show_link(2, 3) . '</th>
						<th>Utbrytning<br />sannsynlighet</th>
						<th>Ca. poeng</th>
						<th>Dusør</th>
						<th>Tid igjen ' . $sort->show_link(4, 5) . '</th>
					</tr>
				</thead>
				<tbody>';
            $i = 0;
            while ($row = $result->fetch()) {
                $prefix = "";
                $attr = new attr("class");
                if (++$i % 2 == 0) {
                    $attr->add("color");
                }
                if (!$this->up->fengsel_check()) {
                    $attr->add("box_handle");
                    $prefix = '<input type="radio" name="up_id" value="' . $row['up_id'] . '_' . $row['up_fengsel_time'] . '_' . $row['up_fengsel_dusor'] . '" /> ';
                }
                $time = $row['up_fengsel_time'] - time();
                $prob = self::calc_prob($time, $row['up_wanted_level'] / 10);
                $points = self::calc_points($prob);
                echo '
					<tr' . $attr->build() . '>
						<td>' . $prefix . game::profile_link($row['up_id'], $row['up_name'], $row['up_access_level']) . '</td>
						<td class="c">' . game::format_number($row['up_wanted_level'] / 10, 1) . ' %</td>
						<td class="c">' . game::format_number($prob, 1) . ' %</td>
						<td class="c">' . game::format_num($points) . '</td>
						<td class="r nowrap">' . game::format_cash($row['up_fengsel_dusor_get']) . '</td>
						<td class="r">' . game::counter($time) . '</td>
					</tr>';
            }
            echo '
				</tbody>
			</table>
			<p class="c">' . (($wait = $this->up->fengsel_wait()) == 0 ? '
				' . show_sbutton("Bryt ut", 'name="brytut"') : '
				Du er i fengsel og slipper ut om ' . game::counter($wait, true) . '.
			</p>
			<p class="c">') . '
				<a href="' . htmlspecialchars(game::address("fengsel", $_GET)) . '" class="button">Oppdater</a>
			</p>';
            // flere sider?
            if ($pagei->pages > 1) {
                echo '
			<div class="hr"></div>
			<p class="c">
				' . $pagei->pagenumbers() . '
			</p>';
            }
        }
        echo '
		</form>
	</div>
</div>';
        // testing
        if (!MAIN_SERVER || access::is_nostat() && access::has("mod")) {
            echo '
<div class="bg1_c xxsmall bg1_padding">
	<h1 class="bg1">' . (MAIN_SERVER ? 'No-stat' : 'Testing') . '<span class="left"></span><span class="right"></span></h1>
	<div class="bg1">
		<form action="" method="post">' . ($this->up->fengsel_check() ? '
			<p class="c">' . show_sbutton("Gå ut av fengsel", 'name="remove"') . '</p>' : '
			<dl class="dd_right dl_2x">
				<dt>Tid</dt>
				<dd><input type="text" name="time" value="' . htmlspecialchars(postval("time", 20)) . '" class="styled w40" /> sekunder</dd>
			</dl>
			<p class="c">' . show_sbutton("Gå inn i fensgel") . '</p>') . '
		</form>
	</div>
</div>';
        }
    }