Esempio n. 1
0
 /**
  * Go to login if no user
  */
 public function needUser()
 {
     if (!$this->user) {
         // are we really logged in?
         if (\login::$logged_in) {
             throw new \HSException("Cannot send to login, a user is already logged in.");
         }
         \access::no_guest();
     }
 }
Esempio n. 2
0
 /**
  * Construct
  */
 public function __construct(player $up)
 {
     // sende til side?
     if (isset($_GET['orign'])) {
         redirect::handle($_GET['orign'], redirect::SERVER, login::$info['ses_secure']);
     }
     parent::__construct($up);
     access::no_guest();
     ess::$b->page->add_title("Hovedsiden");
     $this->show();
     ess::$b->page->load();
 }
Esempio n. 3
0
 /**
  * Construct
  */
 public function __construct()
 {
     access::no_guest();
     ess::$b->page->add_title("Anti-bot sjekk");
     // hvilken side vi skal sendes til
     $this->redirect_url = getval("ret");
     if (!$this->redirect_url) {
         $this->redirect_url = ess::$s['relative_path'] . "/";
     }
     // sjekk etter anti-bot
     $name = getval("name");
     $this->antibot = antibot::get($name);
     if (!$this->antibot->data) {
         ess::$b->page->add_message("Anti-bot oppføringen er ikke opprettet.", "error");
         $this->redirect();
     }
     // kuler?
     if ($name == "kuler") {
         // gjennomfør pre-check
         if (!$this->antibot->kuler_precheck()) {
             $this->redirect();
         }
         // sett lave ventetider
         $this->update_delay = 2;
         $this->retry_delay = 2;
     }
     redirect::store("sjekk?name=" . urlencode($this->antibot->name) . '&ret=' . urlencode($this->redirect_url));
     // sjekk om anti-boten ikke krever sjekk
     if (!$this->antibot->is_check_required()) {
         $this->redirect();
     }
     // sjekk for ventetid
     $this->check_wait();
     // hent bildene
     $this->load_images();
     $this->form = \Kofradia\Form::getByDomain("anti-bot", login::$user);
     // utføre sjekk?
     if (isset($_POST['valider']) && isset($this->images) && !$this->wait) {
         $this->check();
     }
     // nye bilder?
     if (isset($_POST['new'])) {
         $this->new_imgs();
     }
     // vis anti-boten
     $this->show();
 }
Esempio n. 4
0
 /**
  * Construct
  */
 public function __construct(player $up)
 {
     access::no_guest();
     parent::__construct($up);
     $this->obj = new julekalender($up);
     ess::$b->page->add_js_file("&rpath;/resources/julekalender.js");
     ess::$b->page->add_css_file("&rpath;/resources/julekalender.css");
     // admin?
     if (isset($_GET['jul'])) {
         $this->admin();
     }
     // besvare?
     if (isset($_POST['day'])) {
         $this->respond();
     }
     $this->show();
     //ess::$b->page->load();
 }
Esempio n. 5
0
    /** Initialisering */
    public static function init()
    {
        access::no_guest();
        // oppdatere status?
        if (isset($_POST['load_status'])) {
            self::action_status();
            die;
        }
        ess::$b->page->add_title("Support");
        ess::$b->page->add_css('
td.support_important {
	background-color: #FF0000;
	color: #FFFFFF;
	font-weight: bold;
}
');
        // hva skal vises?
        switch (getval("a")) {
            // vis en henvendelse
            case "show":
                self::action_show();
                break;
                // panelet
            // panelet
            case "panel":
                self::action_panel();
                break;
                // søk
            // søk
            case "search":
                self::action_search();
                break;
                // forsiden
            // forsiden
            case "":
                self::action_main();
                break;
                // ukjent
            // ukjent
            default:
                redirect::handle("");
        }
        ess::$b->page->load();
    }
Esempio n. 6
0
 /**
  * Registering vote
  */
 public function action_vote()
 {
     \access::no_guest();
     if (!isset($_POST['poll']) || !is_array($_POST['poll']) || count($_POST['poll']) > 1) {
         \ess::$b->page->add_message("Du må velge et alternativ.", "error");
         \redirect::handle("", \redirect::ROOT);
     }
     $p_id = (int) key($_POST['poll']);
     $po_id = (int) current($_POST['poll']);
     $poll = Poll::load($p_id, \login::$user);
     if (!$poll || !$poll->isAvailable()) {
         \ess::$b->page->add_message("Fant ikke avstemningen.", "error");
         \redirect::handle("", \redirect::ROOT);
     }
     // allerede stemt?
     if ($poll->getVote()) {
         \ess::$b->page->add_message("Du har allerede stemt på avstemningen «" . htmlspecialchars($poll->data['p_title']) . "».", "error");
         \redirect::handle("", \redirect::ROOT);
     }
     // finn alternativet
     $option = $poll->findOption($po_id);
     if (!$option) {
         \ess::$b->page->add_message("Ugyldig alternativ.", "error");
         \redirect::handle("", \redirect::ROOT);
     }
     if ($option->vote(\login::$user)) {
         \ess::$b->page->add_message("Du har avgitt stemme på avstemningen «" . htmlspecialchars($poll->data['p_title']) . "».");
     } else {
         \ess::$b->page->add_message("Din stemme ble ikke registrert.", "error");
     }
     // sende til forum tråden?
     if ($poll->data['p_ft_id']) {
         \redirect::handle("/forum/topic?id={$poll->data['p_ft_id']}", \redirect::ROOT);
     }
     \redirect::handle("", \redirect::ROOT);
 }
Esempio n. 7
0
<?php

require "../base.php";
global $_base, $__server;
access::no_guest();
$_base->page->add_title("BB-testing");
$_base->page->add_js_domready('
	new Element("input", {"type": "button", "value": "Vis resultat med AJAX", "class": "button"}).addEvent("click", function()
	{
		$("ajaxcontainer").setStyle("display", "block");
		$("ajaxcontent").set("html", "<p>Henter data..</p>");
		preview($("textcontent").value, $("ajaxcontent"));
		
		//preview_bb(event, $("textcontent").value, ["ajaxcontainer"], "ajaxcontent");
	}).inject($("ajaxbutton"));');
echo '
<div class="bg1_c large">
	<h1 class="bg1">BB-testing<span class="left"></span><span class="right"></span></h1>
	<div class="bg1">
		<p>Her kan du teste diverse BB-koder. Du kan også forhåndsvise profilen din på <a href="' . $__server['relative_path'] . '/min_side?a=profil">rediger profil</a>.</p>
		<form action="" method="post">
			<p><b>BB-kode</b>: (<a href="' . ess::$s['relative_path'] . '/node/11">Hjelp</a>)</p>
			<p><textarea name="bb" rows="13" cols="100" style="width: 97%" id="textcontent">' . htmlspecialchars(postval("bb")) . '</textarea></p>
			<p class="c">' . show_sbutton("Vis resultat") . ' <span id="ajaxbutton"></span></p>
		</form>
	</div>
</div>

<div class="bg1_c large' . (!isset($_POST['bb']) ? ' hide' : '') . '" id="ajaxcontainer">
	<h1 class="bg1">Resultat<span class="left"></span><span class="right"></span></h1>
	<div class="bg1">
Esempio n. 8
0
 /**
  * Add title to page and deny guests
  */
 public function before()
 {
     parent::before();
     \ess::$b->page->add_title("Kontakter");
     \access::no_guest();
 }