EVR.include("account/form/Form.js");
EVR.Account = function(evr)
{
   EVR.Pop_Up.call(this, evr.field, ACCOUNT_WIDTH, ACCOUNT_HEIGHT);
   this.evr = evr;
   this.forms = new EVR.Account.Form.Forms(this);
   this.set_color(ACCOUNT_BACKGROUND);
   this.add_cancel_button();
   this.forms.append();
}
EVR.Account.prototype = new EVR.Pop_Up;
EVR.Account.prototype.add_cancel_button = function()
{
   var element = document.createElement("button");
   var current = this;
   element.innerHTML = ACCOUNT_BUTTON_TEXT;
   element.onclick =
      function() {
	 current.evr.unload_account();
      };
   this.element.appendChild(element);
   this.button = element;
}
EVR.Account.prototype.append = function()
{
   EVR.Pop_Up.prototype.append.call(this);
   var button = this.button;
   setTimeout(function() { button.focus() }, 100);
}
EVR.Account.prototype.remove = function()
{
   EVR.Pop_Up.prototype.remove.call(this);
   this.forms.reset();
}
EVR.Account.prototype.toString = function()
{
   return "[object EVR.Account]";
}
<?php
namespace account;
require_once "get_user_path.php";
require_once "add_account.php";
$GLOBALS["HASH_FILE_NAME"] = "hash";
$GLOBALS["EMAIL_ADDRESS_FILE_NAME"] = "email";
$GLOBALS["ADDRESSES_FILE_NAME"] = "addresses";
$GLOBALS["GHOSTS_DIRECTORY"] = "ghosts/";
function add_user_account($name, $password, $email_address)
{
   $root = create_directory(find_users_root(), $name);
   store_password($root, $password);
   store_email_address($root, $email_address);
   create_addresses_file($root);
   copy_history_file($root);
   copy_expert_file($root);
   copy_progress_file($root);
   copy_ghost_directory($root);
}
function store_password($root, $password)
{
   $path = create_file($root, $GLOBALS["HASH_FILE_NAME"]);
   $hash = hash_password($password);
   file_put_contents($path, $hash . "\n");
}
function hash_password($password)
{
   return crypt($password, generate_salt());
}
function generate_salt()
{
   return chr(rand(65, 90)) . rand(0, 9);
}
function store_email_address($root, $email_address)
{
   $path = create_file($root, $GLOBALS["EMAIL_ADDRESS_FILE_NAME"]);
   file_put_contents($path, $email_address . "\n");
}
function create_addresses_file($root)
{
   create_file($root, $GLOBALS["ADDRESSES_FILE_NAME"]);
}
function copy_source($name, $root)
{
   $source = get_user_path() . $name;
   if (is_dir($source))
   {
      $destination = $root . $name;
      mkdir($destination);
      chmod($destination, $GLOBALS["DIRECTORY_PERMISSIONS"]);
      foreach (scandir($source) as $file_name)
      {
         if ($file_name[0] != ".")
         {
            $path = $destination . $file_name;
            copy_and_set_permissions($source . $file_name, $path);
         }
      }
   }
   else if (file_exists($source))
   {
      copy_and_set_permissions($source, $root . $name);
   }
}
function copy_and_set_permissions($source, $destination)
{
   copy($source, $destination);
   chmod($destination, $GLOBALS["FILE_PERMISSIONS"]);
}
function copy_history_file($root)
{
   copy_source($GLOBALS["HISTORY_FILE_NAME"], $root);
}
function copy_expert_file($root)
{
   copy_source($GLOBALS["EXPERT_FILE_NAME"], $root);
}
function copy_progress_file($root)
{
   copy_source($GLOBALS["PROGRESS_FILE_NAME"], $root);
}
function copy_ghost_directory($root)
{
   copy_source($GLOBALS["GHOSTS_DIRECTORY"], $root);
}
<?php
namespace account;
require_once "get_user_path.php";
$GLOBALS["CODE_FILE_NAME"] = "code";
function verify_temporary_credentials($id, $code)
{
   $path = find_temp_users_root() . $id . "/";
   if (is_dir($path))
   {
      if (match_codes($path, $code))
      {
         return true;
      }
   }
   return false;
}
function match_codes($root, $submitted_code)
{
   $existing_code = trim(file_get_contents($root . $GLOBALS["CODE_FILE_NAME"]));
   return $submitted_code == $existing_code;
}
<?php
namespace account;
$GLOBALS["FILE_PERMISSIONS"] = 0660;
$GLOBALS["DIRECTORY_PERMISSIONS"] = 0770;
$GLOBALS["HISTORY_FILE_NAME"] = "history.gz";
$GLOBALS["EXPERT_FILE_NAME"] = "expert";
$GLOBALS["PROGRESS_FILE_NAME"] = "progress";
function create_file($root, $name)
{
   $path = $root . $name;
   touch($path);
   chmod($path, $GLOBALS["FILE_PERMISSIONS"]);
   return $path;
}
function create_directory($root, $name)
{
   $saved = umask(0);
   $path = "$root$name/";
   mkdir($path, $GLOBALS["DIRECTORY_PERMISSIONS"]);
   umask($saved);
   return $path;
}
function create_history_file($root)
{
   create_file($root, $GLOBALS["HISTORY_FILE_NAME"]);
}
function create_expert_file($root)
{
   create_file($root, $GLOBALS["EXPERT_FILE_NAME"]);
}
function initialize_progress_file($root)
{
   $path = create_file($root, $GLOBALS["PROGRESS_FILE_NAME"]);
   file_put_contents($path, "0\n");
}
<?php
namespace account;
require_once "get_user_path.php";
function user_exists($name)
{
   return strlen($name) && is_dir(build_user_path($name));
}
<?php
namespace account;
require_once "get_user_path.php";
require_once "add_account.php";
$GLOBALS["ID_LENGTH"] = 7;
$GLOBALS["CODE_LENGTH"] = 10;
$GLOBALS["FILE_PERMISSIONS"] = 0660;
$GLOBALS["CODE_FILE_NAME"] = "code";
$GLOBALS["PROGRESS_FILE_NAME"] = "progress";
$GLOBALS["HISTORY_FILE_NAME"] = "history.gz";
$GLOBALS["EXPERT_FILE_NAME"] = "expert";
function add_temporary_account()
{
   $temp_path = find_temp_users_root();
   $id = build_id($temp_path);
   $root = create_directory($temp_path, $id);
   $code = store_code($root);
   initialize_progress_file($root);
   create_history_file($root);
   create_expert_file($root);
   add_temporary_cookie($id, $code);
   return $id;
}
function build_id($root)
{
   if (!is_dir($root))
   {
      mkdir($root, 0770);
   }
   $ids = scandir($root);
   $next = intval($ids[count($ids) - 1]) + 1;
   return str_pad($next, $GLOBALS["ID_LENGTH"], "0", STR_PAD_LEFT);
}
function store_code($root)
{
   $code = generate_code();
   $path = create_file($root, $GLOBALS["CODE_FILE_NAME"]);
   file_put_contents($path, $code . "\n");
   return $code;
}
function generate_code()
{
   $code = "";
   for ($ii = 0; $ii < $GLOBALS["CODE_LENGTH"]; $ii++)
   {
      $code .= chr(rand(65, 90));
   }
   return $code;
}
function add_temporary_cookie($id, $code)
{
   $expiration = time() + 30 * 24 * 60 * 60;
   $path = "/";
   setcookie("id", $id, $expiration, $path);
   setcookie("code", $code, $expiration, $path);
}
216.73.216.40
216.73.216.40
216.73.216.40
 
November 10, 2013


Food Spring - Watermelon Stage

Getting the fruit as far as possible is the object of each level, collecting bigger, more valuable guns. The final result is determined by the size of the fruits' collection when the monkey arrives in North America and either survives or perishes in the fruits' attack.

Watermelon Peach
Pineapple Grapes