public function contact()
 {
     $content = Content::find_by_permalink("contact");
     $this->assign("content", $content);
     $contact = new Contact();
     if ($this->post) {
         $contact->name = $_POST['name'];
         $contact->emailaddress = $_POST['emailaddress'];
         $contact->subject = $_POST['subject'];
         $contact->message = $_POST['message'];
         $contact->ip = Site::RemoteIP();
         if ($this->csrf) {
             $sent = $contact->send();
             if ($sent) {
                 Site::flash("notice", "The email has been sent");
                 Redirect("contact");
             }
         } else {
             global $site;
             $site['flash']['error'] = "Invalid form submission";
         }
     }
     $this->assign("contact", $contact);
     $this->title = "Contact Us";
     $this->render("contact/contact.tpl");
 }
 public function show($id = null)
 {
     $cart = $this->getCart($id);
     foreach ($cart->items() as $item) {
         if ($item->paid) {
             $item->destroy();
         } elseif (is_a($item, 'EventSignup') && $item->is_soldout()) {
             $item->destroy();
         } elseif (is_a($item, "EventService")) {
             if (!$item->event_signup->paid || !$item->service->available()) {
                 $item->destroy();
             }
         }
     }
     if (count($cart->items(true)) == 0) {
         $cart->destroy();
         Site::Flash("There is nothing to pay for in this cart.");
         Redirect("bookings");
     }
     $cart->check_discounts();
     $terms = Content::find_by_permalink("terms");
     $gateway = PaymentGateway::getActive();
     $this->assign('gateway', $gateway);
     $this->assign('baseURI', $this->getBaseURI());
     $this->assign('cart', $cart);
     $this->assign("terms", $terms);
     $this->title = "My Bookings :: Payment Options";
     $this->render("cart/show.tpl");
 }
 protected static function load_content($permalink = null, $external_only = false)
 {
     if (!$permalink) {
         $permalink = $_GET['permalink'];
     }
     $content = Content::find_by_permalink($permalink, $external_only);
     if ($content) {
         return $content;
     } else {
         Error404();
     }
 }
 public function index()
 {
     $options = array("address" => "gameservers.address ASC, gameservers.port ASC", "name" => "gameservers.name ASC", "game" => "games.name ASC", "map" => "gameservers.map ASC", "players" => "gameservers.numplayers DESC, gameservers.maxplayers DESC", "ping" => "gameservers.ping ASC");
     if (isset($_GET['sort']) && array_key_exists($_GET['sort'], $options)) {
         $sortkey = $_GET['sort'];
         $sort = $options[$_GET['sort']];
     } else {
         $sort = $options['name'];
         $sortkey = "name";
     }
     $content = Content::find_by_permalink("servers", false);
     $servers = Gameserver::find_all("gametypes.deleted = false AND gameservers.online = 1", $sort);
     $this->assign("servers", $servers);
     $this->assign("content", $content);
     $this->assign("sort", $sortkey);
     $this->title = "Servers";
     $this->render("gameserver/index.tpl");
 }
 public function Index()
 {
     $this->layout = 'homepage';
     $content = Content::find_by_permalink("index");
     $nextEvent = Event::next_event();
     $news = array();
     if ($nextEvent) {
         $permalink = mysql_real_escape_string($nextEvent->permalink);
         $newsTags = NewsTag::find_all("news.publish_at <= NOW() AND news.published AND tags.permalink = '{$permalink}'", "news.publish_at DESC", 3);
         foreach ($newsTags as $tag) {
             $tag->news->reload();
             $news[] = $tag->news;
         }
     }
     $this->assign("news", $news);
     $this->assign("content", $content);
     $this->assign("next_event", $nextEvent);
     global $config;
     $this->assign("baseurl", $config['forums']['base_url']);
     $this->render("home/index.tpl");
 }
 public function signup()
 {
     global $config;
     global $site;
     $user = new User();
     $user->requiresContactData = true;
     $arid = '';
     if (isset($_SESSION['affiliate_referral'])) {
         $arid = $_SESSION['affiliate_referral'];
     }
     $user->referral_type = "none";
     if ($this->post) {
         $user->nickname = $this->PostData('nickname');
         $user->email = $this->PostData('email');
         $user->password = $this->PostData('password');
         $user->password_confirmation = $this->PostData('password_confirmation');
         $user->firstname = $this->PostData('firstname');
         $user->surname = $this->PostData('surname');
         $user->clan = $this->PostData('clan');
         $user->address1 = $this->PostData('address1');
         $user->address2 = $this->PostData('address2');
         $user->towncity = $this->PostData('towncity');
         $user->county = $this->PostData('county');
         $user->country_id = $this->PostData('country_id');
         $user->postcode = $this->PostData('postcode');
         $user->phone = $this->PostData('phone');
         $user->set_dateofbirth($this->PostData('dateofbirth'));
         $user->terms = $this->PostData('terms');
         $user->allow_emails = $this->PostData('allow_emails');
         $user->referral_type = $this->PostData('referral_type');
         $arid = $this->PostData('arid');
         $valid = $user->validate();
         $validCaptcha = Recaptcha::validate($this->PostData('g-recaptcha-response'), Site::RemoteIP());
         if (!$validCaptcha) {
             $this->assign("failedcaptcha", true);
         } elseif ($valid) {
             $user->save();
             // This was a referral, make a note.
             if ($arid) {
                 AffiliateReferral::create_from_arid($user, $arid);
             }
             Email::send_user_signup($user);
             Redirect("signup/complete");
         }
     }
     $this->assign("affiliate_referral_id", $arid);
     $referral_types = array_merge(array("none" => "Please choose..."), $user->referral_types);
     $this->assign("referral_types", $referral_types);
     $terms = Content::find_by_permalink("signup-terms");
     $countries = Utils::FormOptions(Country::find_all("", "countries.name ASC"));
     $this->assign('countries', $countries);
     $this->assign("user", $user);
     $this->assign("site", $site);
     $this->assign("terms", $terms);
     $this->assign('arid', $arid);
     global $config;
     $this->assign('recaptcha', $config['recaptcha']['public']);
     $this->title = "Signup";
     $this->render("user/signup.tpl");
 }