June 7, 2018♦
EVR.include("album/grid/Beam.js");
EVR.Album.Grid = function(container)
{
this.container = container;
this.visible = false;
}
EVR.Album.Grid.prototype.toggle = function()
{
if (!this.visible)
{
this.show();
}
else
{
this.hide();
}
}
EVR.Album.Grid.prototype.show = function()
{
this.generate();
this.start_flicker();
this.visible = true;
}
EVR.Album.Grid.prototype.hide = function()
{
window.clearInterval(this.interval);
this.clear();
this.visible = false;
}
EVR.Album.Grid.prototype.generate = function()
{
var beams = [];
var container = this.container;
var count = this.generate_count();
for (var ii = 0; ii < count; ii++)
{
beams.push(new EVR.Album.Grid.Beam(container));
}
this.beams = beams;
}
EVR.Album.Grid.prototype.generate_count = function()
{
return Math.get_random_int(ALBUM_MIN_BEAMS, ALBUM_MAX_BEAMS);
}
EVR.Album.Grid.prototype.clear = function()
{
var beams = this.beams;
for (var ii = 0; ii < beams.length; ii++)
{
beams[ii].hide();
}
this.beams = null;
}
EVR.Album.Grid.prototype.start_flicker = function()
{
var current = this;
this.interval = window.setInterval(
function()
{
current.flicker();
}, ALBUM_BEAM_FLICKER_RATE);
}
EVR.Album.Grid.prototype.flicker = function()
{
var beams = this.beams;
for (var ii = 0; ii < beams.length; ii++)
{
beams[ii].set_color();
}
}
EVR.Album.Grid.prototype.toString = function()
{
return "[object EVR.Album.Grid]";
}
EVR.Album.Grid.Beam = function(container)
{
this.container = container;
this.set_element();
this.container.appendChild(this.element);
}
EVR.Album.Grid.Beam.prototype.set_element = function()
{
var element = document.createElement("div");
var style = element.style;
style.position = "absolute";
style.zIndex = 4;
style.fontSize = "0px";
this.element = element;
this.set_dimensions();
this.set_color();
this.set_position();
this.set_opacity();
}
EVR.Album.Grid.Beam.prototype.set_dimensions = function()
{
var size = this.container.clientHeight * ALBUM_BEAM_SIZE;
var style = this.element.style;
style.width = size;
style.height = size;
}
EVR.Album.Grid.Beam.prototype.set_color = function()
{
var color = this.choose_color();
this.element.style.background = color;
}
EVR.Album.Grid.Beam.prototype.choose_color = function()
{
var colors = ALBUM_BEAM_COLORS;
var max = colors.length - 1;
var index = Math.get_random_int(0, max);
return colors[index];
}
EVR.Album.Grid.Beam.prototype.set_position = function()
{
var style = this.element.style;
style.top = Math.get_random_int(0, 100) + "%";
style.left = Math.get_random_int(0, 100) + "%";
}
EVR.Album.Grid.Beam.prototype.set_opacity = function()
{
var opacity = ALBUM_BEAM_OPACITY;
var style = this.element.style;
style.filter = "alpha(opacity=" + parseInt(opacity * 100) + ")";
style.opacity = opacity;
}
EVR.Album.Grid.Beam.prototype.hide = function()
{
this.container.removeChild(this.element);
}
EVR.Album.Grid.Beam.prototype.toString = function()
{
return "[object EVR.Album.Grid.Beam]";
}
<?php
namespace account;
require_once "verify_user_credentials.php";
require_once "add_user_cookie.php";
submit_login_request();
function submit_login_request()
{
$name = $_GET["name"];
$password = $_GET["pass"];
$errors = verify_user_credentials($name, $password);
if ($errors->count() == 0)
{
add_user_cookie($name);
}
echo $errors;
}
<?php
namespace account;
class Errors
{
private $errors = array();
public function __toString()
{
$list = "";
$errors = $this->errors;
foreach ($errors as $index => $error)
{
$list .= $error;
if ($index < count($errors) - 1)
{
$list .= "\n";
}
}
return $list;
}
public function add($message)
{
$this->errors[] = $message;
}
public function count()
{
return count($this->errors);
}
}
<?php
namespace account;
require_once "Mail.php";
$GLOBALS["EMAIL_SENDER"] = "VSROYGBIV <frank@cyclops.asia>";
$GLOBALS["PASSWORD_EMAIL_SUBJECT"] =
"Your new password for Emoticon Vs. Rainbow";
$GLOBALS["PASSWORD_EMAIL_PREFACE"] = "Your new password is";
$GLOBALS["PASSWORD_EMAIL_POSTSCRIPT"] =
"You can change this password before logging-in (@ http://vsroygbiv.com)";
class Password_Mail extends Mail
{
public function __construct($recipient, $password)
{
parent::__construct(
$recipient, $GLOBALS["EMAIL_SENDER"],
$GLOBALS["PASSWORD_EMAIL_SUBJECT"]);
$this->password = $password;
}
protected function build_message()
{
$message = $GLOBALS["PASSWORD_EMAIL_PREFACE"] . " ";
$message .= $this->password . "\n";
$message .= $GLOBALS["PASSWORD_EMAIL_POSTSCRIPT"] . "\n";
return $message;
}
}