<?php
namespace entities\evr\security;

class Addresses
{
   public function __construct($user)
   {
      $this->user = $user;
      $this->set_path();
   }
   private function set_path()
   {
      $user = $this->user;
      $root = $GLOBALS["USERS_PATH"];
      $this->path = "$root/$user/" . $GLOBALS["USER_ADDRESSES_PATH"];
   }
   public function add_current()
   {
      if (!$this->find_current_address())
      {
         $entry = $_SERVER["REMOTE_ADDR"] . " " . time() . "\n";
         file_put_contents($this->path, $entry, FILE_APPEND);
      }
   }
   public function find_current_address()
   {
      foreach ($this->get() as $entry)
      {
         if ($_SERVER["REMOTE_ADDR"] == $this->extract($entry))
         {
            return true;
         }
      }
      return false;
   }
   private function get()
   {
      return file($this->path);
   }
   private function extract($entry)
   {
      $fields = explode(" ", $entry);
      return $fields[0];
   }
}
<?php
namespace entities\evr\security;

class Join_Beta_Mail extends Mail
{
   public function __construct($sender)
   {
      parent::__construct(
         $GLOBALS["BETA_RECIPIENT"], $sender, $GLOBALS["BETA_SUBJECT"]);
   }
   protected function build_message()
   {
      return $this->sender;
   }
}
<?php
namespace entities\evr\security\display;
use \entities\html as html;

class Alerts extends html\Div
{
   public function __construct()
   {
      parent::__construct("alerts");
   }
   protected function build_content()
   {
      $markup = $this->build_alert("boost", $GLOBALS["BOOST_ALERT"]);
      $markup .= $this->build_alert("sound", $GLOBALS["SOUND_ALERT"]);
      $markup .= $this->build_alert("fullscreen", $GLOBALS["FULLSCREEN_ALERT"]);
      return $markup;
   }
   private function build_alert($id, $text)
   {
      return new html\Div($id, null, $text);
   }
}
<?php
namespace entities\evr\security\display;
use \entities\html as html;

class Home extends html\Div
{
   protected function build_content()
   {
      $markup = new Header();
      $markup .= new forms\Login();
      $markup .= new Links();
      $markup .= new forms\Activate();
      $markup .= new Alerts();
      $markup .= new Beta_Invitation();
      $markup .= new \entities\evr\Trailer();
      $markup .= new Thumbs();
      return $markup;
   }
}
<?php
namespace entities\evr\security\display;
use \entities\html as html;

class Header extends html\Div
{
   public function __construct()
   {
      parent::__construct("header", null, $GLOBALS["HEADER"]);
   }
}
<?php
namespace entities\evr\security\display;
use \entities\html as html;

class Beta_Invitation extends html\Div
{
   public function __construct()
   {
      parent::__construct("invitation");
   }
   protected function build_content()
   {
      $markup = $this->build_heading();
      $markup .= file_get_contents(dirname(__FILE__) . "/invitation");
      $markup .= new forms\Join_Beta();
      return $markup;
   }
   private function build_heading()
   {
      $text = $GLOBALS["BETA_INVITATION_HEADING"];
      return new html\Div("heading", null, $text);
   }
}
<?php
namespace entities\evr\security\display;
use entities\html as html;

class Links extends html\Div
{
   public function __construct()
   {
      parent::__construct("links");
   }
   protected function build_content()
   {
      $markup = new html\A("?change", "change password", null, "password");
      $markup .= new html\A("?reset", "reset password", null, "password");
      return $markup;
   }
}
<?php
namespace entities\evr\security\display;
use \entities\html as html;

class Thumbs extends html\Div
{
   protected function build_content()
   {
      $markup = "";
      $directory = $GLOBALS["THUMBNAILS_PATH"];
      foreach (scandir($directory) as $file)
      {
         if ($file[0] != ".")
         {
            $path = $directory . $file;
            $markup .= new html\Image($path, null, "thumb");
         }
      }
      return $markup;
   }
}
<?php
namespace entities\evr\security\display\forms;
use \entities\html as html;

class Join_Beta extends html\Form
{
   protected function build_content()
   {
      $markup = new html\Input("email", "text", "email address", null, true);
      $markup .= $this->build_button();
      return $markup;
   }
   private function build_button()
   {
      $text = $GLOBALS["JOIN_BETA_BUTTON_TEXT"];
      return new html\Input("action", "submit", $text);
   }
}
3.92.28.84
3.92.28.84
3.92.28.84
 
June 5, 2016