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");
 }
Exemplo n.º 2
0
 /**
  * Takes an RPCUser username and password and, if valid, returns a new RPC Session
  * to be used in further communications.
  * 
  * @arg string Username to log in as
  * @arg string Password to for this username
  * 
  * @param object $method The name of the RPC method
  * @param object $args An array of arguements, listed above
  * @return string The session code
  * @throws RPCException
  */
 public function login($method, $args)
 {
     if (count($args) < 2) {
         throw new RPCException('Invalid arguements', 500);
     }
     $struct = RPCUser::login($args[0], $args[1]);
     if ($struct['code'] == 200) {
         try {
             $session = $struct['user']->createSession(Site::RemoteIP());
             return $session->code;
         } catch (Error500 $e) {
             throw new RPCException($e->getMessage(), 500);
         }
     } else {
         throw new RPCException($struct['error'], $struct['code']);
     }
 }
Exemplo n.º 3
0
 protected static function GenerateCSRFHash()
 {
     $hash = md5(rand(1, 9999999) . microtime(true) + Site::RemoteIP());
     $hash = base_convert($hash, 16, 36);
     $_SESSION['csrf'] = $hash;
     return $hash;
 }
 public function intranet_index($permalink = null)
 {
     global $config;
     if (!in_array(Site::RemoteIP(), $config['intranet']['ips'])) {
         //throw new Error403();
     }
     $event = self::load_event($permalink, true);
     if ($_GET['key'] == md5("winbarmint")) {
         $event_id = mysql_real_escape_string($event->id);
         $signups = EventSignup::find_all("event_signups.event_id = '{$event_id}' AND event_signups.paid = true AND event_signups.voucher = false", "users.id ASC");
         $this->assign("signups", $signups);
         $this->assign("event", $event);
         header('Content-Type: text/xml');
         $this->render("event_signup/intranet_index.tpl", true);
     } else {
         Error403();
     }
 }
Exemplo n.º 5
0
 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");
 }