Initial commit Change-Id: I0000000000000000000000000000000000000000
5
README
Executable file
@@ -0,0 +1,5 @@
|
||||
When pushing changes to production, copy everything over execpt conf.php
|
||||
|
||||
default admin:
|
||||
admin
|
||||
admin
|
||||
11
classes/access.php
Executable file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
A simple auth module that should be included on any page that requires authentication
|
||||
@author ricky barrette
|
||||
@author Twenty Codes, LLC
|
||||
*/
|
||||
session_start();
|
||||
if(!$_SESSION['access'] == 'admin') {
|
||||
header('Location: login.php' ) ;
|
||||
}
|
||||
?>
|
||||
11
classes/auth.php
Executable file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
/**
|
||||
A simple auth module that should be included on any page that requires authentication
|
||||
@author ricky barrette
|
||||
@author Twenty Codes, LLC
|
||||
*/
|
||||
session_start();
|
||||
if(!$_SESSION['loggedIn']) {
|
||||
header('Location: login.php' ) ;
|
||||
}
|
||||
?>
|
||||
177
classes/blog.php
Executable file
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
class blog {
|
||||
var $host;
|
||||
var $username;
|
||||
var $password;
|
||||
var $table;
|
||||
|
||||
/**
|
||||
* Contructor
|
||||
* @param String $host
|
||||
* @param String $username
|
||||
* @param String $password
|
||||
* @param String $db
|
||||
*/
|
||||
public function blog($host, $username, $password, $db){
|
||||
$this->host = $host;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
$this->table = $db;
|
||||
$this->connect();
|
||||
}
|
||||
|
||||
/**
|
||||
deletes all the comments in the blog database for the suppled id
|
||||
*/
|
||||
public function delete_thread($id){
|
||||
$q = "DELETE FROM blog WHERE id = '$report'";
|
||||
return mysql_query($q);
|
||||
}
|
||||
|
||||
/**
|
||||
Display all comment entrys for the specified report
|
||||
*/
|
||||
public function get_blog() {
|
||||
|
||||
/* Instantiate class */
|
||||
require_once("pager.php");
|
||||
$p = new Pager;
|
||||
|
||||
/* Show many results per page? */
|
||||
$limit = 5;
|
||||
|
||||
/* Find the start depending on $_GET['page'] (declared if it's null) */
|
||||
$start = $p->findStart($limit);
|
||||
|
||||
/* Find the number of rows returned from a query; Note: Do NOT use a LIMIT clause in this query */
|
||||
$count = mysql_num_rows(mysql_query("SELECT * FROM blog"));
|
||||
|
||||
/* Find the number of pages based on $count and $limit */
|
||||
$pages = $p->findPages($count, $limit);
|
||||
|
||||
/* Now we use the LIMIT clause to grab a range of rows */
|
||||
$r = mysql_query("SELECT * FROM blog ORDER BY id DESC LIMIT ".$start.", ".$limit);
|
||||
|
||||
/* Now get the page list and echo it */
|
||||
$pagelist = $p->pageList($_GET['page'], $pages);
|
||||
|
||||
if ( $r !== false && mysql_num_rows($r) > 0 ) {
|
||||
while ( $a = mysql_fetch_assoc($r) ) {
|
||||
$title = stripslashes($a['title']);
|
||||
$bodytext = stripslashes($a['bodytext']);
|
||||
$username = $a['name'];
|
||||
$gravatar = 'http://www.gravatar.com/avatar/' . $a['email'] . '?s=48';
|
||||
$date = $a['created'];
|
||||
|
||||
$entry_display .= <<<ENTRY_DISPLAY
|
||||
<div class="post">
|
||||
<img src="$gravatar" /> <b>$username : $title</b><hr/>
|
||||
<p> $bodytext
|
||||
<hr class="commentfooter" /> Posted: $date</p>
|
||||
</div>
|
||||
<br/>
|
||||
ENTRY_DISPLAY;
|
||||
}
|
||||
$entry_display .= '<div align="center">'.$pagelist.'</div>';
|
||||
}
|
||||
else {
|
||||
$entry_display .= <<<ENTRY_DISPLAY
|
||||
<p>
|
||||
No entries have been made on this page.
|
||||
</p>
|
||||
|
||||
ENTRY_DISPLAY;
|
||||
}
|
||||
|
||||
/*
|
||||
$entry_display .= <<<ADMIN_OPTION
|
||||
|
||||
<p class="admin_link">
|
||||
<a href="{$_SERVER['PHP_SELF']}?new_comment=1">Add a New Entry</a>
|
||||
</p>
|
||||
|
||||
ADMIN_OPTION;
|
||||
*/
|
||||
return $entry_display;
|
||||
}
|
||||
|
||||
/*
|
||||
This function will be used to display the new comment entry form
|
||||
*/
|
||||
public function display_post() {
|
||||
return <<<ADMIN_FORM
|
||||
<h2>
|
||||
New Blog Entry
|
||||
</h2>
|
||||
<form action="{$_SERVER['PHP_SELF']}" method="post">
|
||||
|
||||
<input type="hidden" name="blog" value="1" />
|
||||
|
||||
<div class="clearfix">
|
||||
<label for="title">Title</label><br />
|
||||
<div class="input">
|
||||
<input name="title" id="title" type="text" maxlength="55" class="xlarge" required/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix">
|
||||
<label for="bodytext">Body Text</label><br />
|
||||
<div class="input">
|
||||
<textarea name="bodytext" id="bodytext" rows=10 cols=56 class="xxlarge"required></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button type="submit" class="btn primary" onclick="checkRequired(this.forum)" >Create This Entry</button>
|
||||
<button type="reset" class="btn">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
ADMIN_FORM;
|
||||
}
|
||||
|
||||
public function write($p) {
|
||||
if ( $p['title'] )
|
||||
$title = mysql_real_escape_string(strip_tags($_POST['title']));
|
||||
if ( $p['bodytext'])
|
||||
$bodytext = mysql_real_escape_string(strip_tags($_POST['bodytext']));
|
||||
$name = $_SESSION['username'];
|
||||
$email = $_SESSION['email'];
|
||||
|
||||
if ( $title && $bodytext ) {
|
||||
$created = date("g:iA M d, Y");
|
||||
$sql = "INSERT INTO blog (title, bodytext, created, name, email)VALUES('$title','$bodytext','$created','$name', '$email' )";
|
||||
return mysql_query($sql) or die("Could not select database. " . mysql_error());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
This function connects to the database
|
||||
*/
|
||||
public function connect() {
|
||||
mysql_connect($this->host,$this->username,$this->password) or die("Could not connect. " . mysql_error());
|
||||
mysql_select_db($this->table) or die("Could not select database. " . mysql_error());
|
||||
|
||||
return $this->buildDB();
|
||||
}
|
||||
|
||||
private function buildDB() {
|
||||
$sql = <<<MySQL_QUERY
|
||||
CREATE TABLE IF NOT EXISTS blog (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
title VARCHAR(150),
|
||||
bodytext TEXT,
|
||||
created VARCHAR(100),
|
||||
name VARCHAR(20),
|
||||
email VARCHAR(100)
|
||||
)
|
||||
MySQL_QUERY;
|
||||
|
||||
return mysql_query($sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
187
classes/comments.php
Executable file
@@ -0,0 +1,187 @@
|
||||
<?php
|
||||
|
||||
class comments {
|
||||
|
||||
var $host;
|
||||
var $username;
|
||||
var $password;
|
||||
var $db;
|
||||
var $table;
|
||||
|
||||
/**
|
||||
* Contructor
|
||||
* @param String $host
|
||||
* @param String $username
|
||||
* @param String $password
|
||||
* @param String $db
|
||||
*/
|
||||
public function comments($table, $host, $username, $password, $db){
|
||||
$this->host = $host;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
$this->db = $db;
|
||||
$this->table = $table;
|
||||
$this->connect();
|
||||
}
|
||||
|
||||
/**
|
||||
deletes all the comments in the database for the suppled report
|
||||
*/
|
||||
public function delete_comment($id, $thread){
|
||||
$table = $this->table;
|
||||
$q = "DELETE FROM $table WHERE report = '$thread' and id = '$id'";
|
||||
mysql_query($q);
|
||||
return"Deleted Post";
|
||||
}
|
||||
|
||||
/**
|
||||
Display all comment entrys for the specified report
|
||||
*/
|
||||
public function get_comments($report) {
|
||||
|
||||
$page = $_SERVER['PHP_SELF'];
|
||||
|
||||
$table = $this->table;
|
||||
|
||||
$entry_display .= <<<ENTRY_DISPLAY
|
||||
<h2>
|
||||
Comments
|
||||
</h2>
|
||||
|
||||
ENTRY_DISPLAY;
|
||||
|
||||
$q = "SELECT * FROM $table WHERE report=".$report." ORDER BY id";
|
||||
$r = mysql_query($q);
|
||||
|
||||
if ( $r !== false && mysql_num_rows($r) > 0 ) {
|
||||
while ( $a = mysql_fetch_assoc($r) ) {
|
||||
$title = stripslashes($a['title']);
|
||||
$bodytext = stripslashes($a['bodytext']);
|
||||
$username = $a['name'];
|
||||
$gravatar = 'http://www.gravatar.com/avatar/' . $a['email'] . '?s=48';
|
||||
$date = $a['created'];
|
||||
$id = $a['id'];
|
||||
|
||||
$entry_display .= <<<ENTRY_DISPLAY
|
||||
<div class="post"><img src="$gravatar" /> <b>$username : $title</b>
|
||||
ENTRY_DISPLAY;
|
||||
|
||||
if($_SESSION['access'] == "admin" || $_SESSION['username'] == $username)
|
||||
$entry_display .= <<<ENTRY_DISPLAY
|
||||
<a align="right" href="$page?deletepost=$id&thread=$report" onclick="return confirm('Are you sure You want to delete this post forever?');">Delete Post</a>
|
||||
ENTRY_DISPLAY;
|
||||
|
||||
|
||||
$entry_display .= <<<ENTRY_DISPLAY
|
||||
<hr/>
|
||||
<p> $bodytext
|
||||
<hr class="commentfooter" /> Posted: $date</p>
|
||||
</div>
|
||||
<br/>
|
||||
ENTRY_DISPLAY;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$entry_display .= <<<ENTRY_DISPLAY
|
||||
<p>
|
||||
No entries have been made on this page.
|
||||
</p>
|
||||
|
||||
ENTRY_DISPLAY;
|
||||
}
|
||||
|
||||
/*
|
||||
$entry_display .= <<<ADMIN_OPTION
|
||||
|
||||
<p class="admin_link">
|
||||
<a href="{$_SERVER['PHP_SELF']}?new_comment=1">Add a New Entry</a>
|
||||
</p>
|
||||
|
||||
ADMIN_OPTION;
|
||||
*/
|
||||
return $entry_display;
|
||||
}
|
||||
|
||||
/*
|
||||
This function will be used to display the new comment entry form
|
||||
*/
|
||||
public function display_post($report) {
|
||||
|
||||
return <<<ADMIN_FORM
|
||||
|
||||
<h2>
|
||||
New Comment
|
||||
</h2>
|
||||
<form action="{$_SERVER['PHP_SELF']}" method="post">
|
||||
|
||||
<input type="hidden" name="comment" value="$report" />
|
||||
|
||||
<div class="clearfix">
|
||||
<label for="title">Title</label><br />
|
||||
<div class="input">
|
||||
<input name="title" id="title" type="text" maxlength="55" class="xlarge" required/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix">
|
||||
<label for="bodytext">Body Text</label><br />
|
||||
<div class="input">
|
||||
<textarea name="bodytext" id="bodytext" rows=10 cols=56 class="xxlarge"required></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button type="submit" class="btn primary" onclick="checkRequired(this.forum)" >Create This Entry</button>
|
||||
<button type="reset" class="btn">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
ADMIN_FORM;
|
||||
}
|
||||
|
||||
public function write($thread, $title, $body) {
|
||||
$table = $this->table;
|
||||
$title = mysql_real_escape_string(strip_tags($title));
|
||||
$bodytext = mysql_real_escape_string(strip_tags($body));
|
||||
$name = $_SESSION['username'];
|
||||
$email = $_SESSION['email'];
|
||||
|
||||
if ( $title && $bodytext ) {
|
||||
$created = date("g:iA M d, Y");
|
||||
$sql = "INSERT INTO $table (title, bodytext, created, report, name, email) VALUES ('$title','$bodytext','$created','$thread', '$name', '$email' )";
|
||||
return mysql_query($sql) or die("Could not instert." . mysql_error());
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
This function connects to the database
|
||||
*/
|
||||
public function connect() {
|
||||
mysql_connect($this->host,$this->username,$this->password) or die("Could not connect. " . mysql_error());
|
||||
mysql_select_db($this->db) or die("Could not select database. " . mysql_error());
|
||||
|
||||
return $this->buildDB();
|
||||
}
|
||||
|
||||
private function buildDB() {
|
||||
$table = $this->table;
|
||||
$sql = <<<MySQL_QUERY
|
||||
CREATE TABLE IF NOT EXISTS $table (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
title VARCHAR(150),
|
||||
bodytext TEXT,
|
||||
created VARCHAR(100),
|
||||
report INTEGER,
|
||||
name VARCHAR(20),
|
||||
email VARCHAR(100)
|
||||
)
|
||||
MySQL_QUERY;
|
||||
|
||||
return mysql_query($sql);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
11
classes/conf.php
Executable file
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
define('DB_HOST', '127.0.0.1');
|
||||
define('DB_USER', 'exceptionuser');
|
||||
define('DB_PASSWORD', '#xCeption');
|
||||
define('DB_DATABASE', 'exceptions_testing');
|
||||
define('COMPANY_NAME', 'Twenty Codes, LLC');
|
||||
define('EMAIL', 'twentycodes@gmail.com');
|
||||
define('MAP_LOCATION', '/exceptionhandler/maps/');
|
||||
define('REPORT_URL', 'http://powers.doesntexist.com:666/testing/index.php?report=');
|
||||
|
||||
?>
|
||||
211
classes/content.php
Normal file
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
/*
|
||||
This class will be used to maintian web page content.
|
||||
*/
|
||||
class content {
|
||||
var $host;
|
||||
var $username;
|
||||
var $password;
|
||||
var $db;
|
||||
var $id;
|
||||
var $key;
|
||||
|
||||
function content($host, $username, $password, $db, $key){
|
||||
$this->host = $host;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
$this->db = $db;
|
||||
$this->connect();
|
||||
$this->id = $this->get_id_from_key($key);
|
||||
$this->key = $key;
|
||||
}
|
||||
|
||||
public function get_id_from_key($key){
|
||||
$q = "SELECT * FROM pages WHERE pagekey='$key'";
|
||||
$r = mysql_query($q);
|
||||
|
||||
if ( $r !== false && mysql_num_rows($r) > 0 ) {
|
||||
$a = mysql_fetch_assoc($r);
|
||||
return $a['id'];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
deletes a page by its id
|
||||
*/
|
||||
public function delete_content(){
|
||||
$id = $this->id;
|
||||
$q = "DELETE FROM pages WHERE id = '$id'";
|
||||
return mysql_query($q);
|
||||
}
|
||||
|
||||
/**
|
||||
returns the raw content for a page in an array
|
||||
keys are:
|
||||
title
|
||||
bodytext
|
||||
id
|
||||
*/
|
||||
public function get_content() {
|
||||
$q = "SELECT * FROM pages WHERE id=".$this->id;
|
||||
$r = mysql_query($q);
|
||||
|
||||
if ( $r !== false && mysql_num_rows($r) > 0 ) {
|
||||
return mysql_fetch_assoc($r);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
returns a html formated body
|
||||
*/
|
||||
public function get_body() {
|
||||
$key = $this->key;
|
||||
$a = $this->get_content();
|
||||
$body = $this->txt2html($a['bodytext']);
|
||||
if($_SESSION['access'] == admin) {
|
||||
$body .= "</br><a href=\"content_manager.php?pagekey=$key\">Edit</a>";
|
||||
}
|
||||
return $body;
|
||||
}
|
||||
|
||||
/*
|
||||
returns a non formated body
|
||||
*/
|
||||
public function get_title() {
|
||||
$a = $this->get_content();
|
||||
return $a['title'];
|
||||
}
|
||||
|
||||
/*
|
||||
This function will be used to edit a page
|
||||
*/
|
||||
public function display_editor() {
|
||||
$content = $this->get_content();
|
||||
$id = $this->id;
|
||||
$key = $this->key;
|
||||
$title = $content['title'];
|
||||
$body = $content['bodytext'];
|
||||
|
||||
return <<<ADMIN_FORM
|
||||
<form action="{$_SERVER['PHP_SELF']}" method="post">
|
||||
|
||||
<input type="hidden" name="page" value="$id" />
|
||||
<input type="hidden" name="pagekey" value="$key" />
|
||||
<div class="clearfix">
|
||||
<label for="title">Title</label><br />
|
||||
<div class="input">
|
||||
<input name="title" id="title" type="text" maxlength="55" class="xlarge" value="$title"> </input>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix">
|
||||
<label for="bodytext">Body Text</label><br />
|
||||
<div class="input">
|
||||
<textarea name="bodytext" id="bodytext" rows=10 cols=56 class="xxlarge">$body</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button type="submit" class="btn primary" >Save</button>
|
||||
<button type="reset" class="btn">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
ADMIN_FORM;
|
||||
}
|
||||
|
||||
/*
|
||||
saves page information
|
||||
*/
|
||||
public function write($title, $body) {
|
||||
$title = mysql_real_escape_string(strip_tags($title));
|
||||
$bodytext = mysql_real_escape_string($body);
|
||||
$key = $this->key;
|
||||
$updateStm = "UPDATE pages SET title='$title', bodytext='$body' WHERE pagekey='$key'";
|
||||
|
||||
mysql_query($updateStm);
|
||||
|
||||
if(mysql_affected_rows()<=0){
|
||||
$sql = "INSERT INTO pages (title, bodytext, pagekey)VALUES('$title','$bodytext','$key')";
|
||||
mysql_query($sql);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
This function connects to the database
|
||||
*/
|
||||
public function connect() {
|
||||
mysql_connect($this->host,$this->username,$this->password) or die("Could not connect. " . mysql_error());
|
||||
mysql_select_db($this->db) or die("Could not select database. " . mysql_error());
|
||||
|
||||
return $this->buildDB();
|
||||
}
|
||||
|
||||
private function buildDB() {
|
||||
$sql = <<<MySQL_QUERY
|
||||
CREATE TABLE IF NOT EXISTS pages ( id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT, title TEXT, bodytext TEXT, pagekey TEXT)
|
||||
MySQL_QUERY;
|
||||
|
||||
return mysql_query($sql);
|
||||
}
|
||||
|
||||
public function stri_replace( $find, $replace, $string ) {
|
||||
// Case-insensitive str_replace()
|
||||
|
||||
$parts = explode( strtolower($find), strtolower($string) );
|
||||
|
||||
$pos = 0;
|
||||
|
||||
foreach( $parts as $key=>$part ){
|
||||
$parts[ $key ] = substr($string, $pos, strlen($part));
|
||||
$pos += strlen($part) + strlen($find);
|
||||
}
|
||||
|
||||
return( join( $replace, $parts ) );
|
||||
}
|
||||
|
||||
|
||||
public function txt2html($txt) {
|
||||
// Transforms txt in html
|
||||
|
||||
//Kills double spaces and spaces inside tags.
|
||||
while( !( strpos($txt,' ') === FALSE ) ) $txt = str_replace(' ',' ',$txt);
|
||||
$txt = str_replace(' >','>',$txt);
|
||||
$txt = str_replace('< ','<',$txt);
|
||||
|
||||
//Transforms accents in html entities.
|
||||
$txt = htmlentities($txt);
|
||||
|
||||
//We need some HTML entities back!
|
||||
$txt = str_replace('"','"',$txt);
|
||||
$txt = str_replace('<','<',$txt);
|
||||
$txt = str_replace('>','>',$txt);
|
||||
$txt = str_replace('&','&',$txt);
|
||||
|
||||
//Ajdusts links - anything starting with HTTP opens in a new window
|
||||
$txt = $this->stri_replace("<a href=\"http://","<a target=\"_blank\" href=\"http://",$txt);
|
||||
$txt = $this->stri_replace("<a href=http://","<a target=\"_blank\" href=http://",$txt);
|
||||
|
||||
//Basic formatting
|
||||
$eol = ( strpos($txt,"\r") === FALSE ) ? "\n" : "\r\n";
|
||||
$html = '<p>'.str_replace("$eol$eol","</p><p>",$txt).'</p>';
|
||||
$html = str_replace("$eol","<br />\n",$html);
|
||||
$html = str_replace("</p>","</p>\n\n",$html);
|
||||
$html = str_replace("<p></p>","<p> </p>",$html);
|
||||
|
||||
//Wipes <br> after block tags (for when the user includes some html in the text).
|
||||
$wipebr = Array("table","tr","td","blockquote","ul","ol","li");
|
||||
|
||||
for($x = 0; $x < count($wipebr); $x++) {
|
||||
|
||||
$tag = $wipebr[$x];
|
||||
$html = $this->stri_replace("<$tag><br />","<$tag>",$html);
|
||||
$html = $this->stri_replace("</$tag><br />","</$tag>",$html);
|
||||
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
34
classes/email.php
Executable file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
require_once('conf.php');
|
||||
|
||||
/*
|
||||
Generates and sends a email to notify devs of a new or updated exception report
|
||||
*/
|
||||
function reportEmail($app, $version, $msg, $status, $id){
|
||||
$companyEmail = EMAIL;
|
||||
$url = REPORT_URL;
|
||||
|
||||
$email = <<<EMAIL
|
||||
|
||||
$app $version has generated the following exception:
|
||||
|
||||
$msg
|
||||
|
||||
$url$id
|
||||
|
||||
This email was generated by the Twenty Codes, LLC Exception Handler.
|
||||
EMAIL;
|
||||
|
||||
mail( 'arsenickiss7891@gmail.com' , "$status excpetion report for $app $version" , $email, "From: Exception Handler" );
|
||||
|
||||
/*
|
||||
The following was used if mail() doesnt work. This method seems to be problematic
|
||||
$temp = fopen("/exceptionhandler/email", 'w');
|
||||
fwrite($temp, $email);
|
||||
fclose($temp);
|
||||
shell_exec("ssmtp -t < /exceptionhandler/email");
|
||||
unlink("/exceptionhandler/email");
|
||||
*/
|
||||
}
|
||||
?>
|
||||
342
classes/exceptionReports.php
Executable file
@@ -0,0 +1,342 @@
|
||||
<?php
|
||||
|
||||
class exceptionReports{
|
||||
|
||||
var $host;
|
||||
var $username;
|
||||
var $password;
|
||||
var $table;
|
||||
var $maps;
|
||||
var $email;
|
||||
var $reporturl;
|
||||
|
||||
/**
|
||||
deletes a report by is id
|
||||
*/
|
||||
public function delete_report($id){
|
||||
mysql_query("DELETE FROM report_comments WHERE report = '$id'");
|
||||
return mysql_query("DELETE FROM reports WHERE id = '$id'")or die(mysql_error());
|
||||
}
|
||||
|
||||
/**
|
||||
updates the status of a report
|
||||
*/
|
||||
public function set_status($id, $status){
|
||||
return mysql_query("UPDATE reports SET status='$status' WHERE id=$id");
|
||||
}
|
||||
|
||||
/**
|
||||
diplays a list of exception reports, this list will link to the indiviual reports
|
||||
*/
|
||||
public function display_report_list() {
|
||||
|
||||
|
||||
/* Instantiate class */
|
||||
require_once("pager.php");
|
||||
$p = new Pager;
|
||||
|
||||
/* Show many results per page? */
|
||||
$limit = 5;
|
||||
|
||||
/* Find the start depending on $_GET['page'] (declared if it's null) */
|
||||
$start = $p->findStart($limit);
|
||||
|
||||
/* Find the number of rows returned from a query; Note: Do NOT use a LIMIT clause in this query */
|
||||
$count = mysql_num_rows(mysql_query("SELECT * FROM reports"));
|
||||
|
||||
/* Find the number of pages based on $count and $limit */
|
||||
$pages = $p->findPages($count, $limit);
|
||||
|
||||
/* Now we use the LIMIT clause to grab a range of rows */
|
||||
$r = mysql_query("SELECT * FROM reports ORDER BY id DESC LIMIT ".$start.", ".$limit);
|
||||
|
||||
/* Now get the page list and echo it */
|
||||
$pagelist = $p->pageList($_GET['page'], $pages);
|
||||
|
||||
|
||||
/* Or you can use a simple "Previous | Next" listing if you don't want the numeric page listing */
|
||||
//$next_prev = $p->nextPrev($_GET['page'], $pages);
|
||||
//echo $next_prev;
|
||||
|
||||
/* From here you can do whatever you want with the data from the $result link. */
|
||||
|
||||
/*
|
||||
get all the reports
|
||||
*/
|
||||
// $result = mysql_query("SELECT * FROM reports");
|
||||
|
||||
while($report = mysql_fetch_assoc($r)) {
|
||||
$msg = stripslashes($report['msg']);
|
||||
$app = stripslashes($report['app']);
|
||||
$id = $report['id'];
|
||||
$status = $report['status'];
|
||||
$version = $report['version'];
|
||||
$count = $report['count'];
|
||||
$status_icon = '<img height="3%" src="res/newbutton.png"/>';
|
||||
|
||||
if($status == 'updated')
|
||||
$status_icon = '<img height="3%" src="res/updatedbutton.png"/>';
|
||||
else if ($status == 'old')
|
||||
$status_icon = '<img height="3%" src="res/oldbutton.png"/>';
|
||||
$entry_display .= <<<ENTRY_DISPLAY
|
||||
<div class="post">
|
||||
<b>#$id</b> $status_icon App: <b class="centered">$app $version</b> <div align="right"> Count: <b>$count</b></div><hr/>
|
||||
<a href="{$_SERVER['PHP_SELF']}?report=$id">$msg</a>
|
||||
</div>
|
||||
<br/>
|
||||
ENTRY_DISPLAY;
|
||||
|
||||
}
|
||||
|
||||
$entry_display .= '<div class="centered">'.$pagelist.'</div>';
|
||||
return $entry_display;
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This will display the specified report
|
||||
*/
|
||||
public function display_report($id) {
|
||||
|
||||
$id = mysql_real_escape_string($id);
|
||||
|
||||
/*
|
||||
get all the reports
|
||||
*/
|
||||
$r = mysql_query("SELECT * FROM reports WHERE id=".$id);
|
||||
|
||||
if($report = mysql_fetch_assoc($r)) {
|
||||
|
||||
$msg = stripslashes($report['msg']);
|
||||
$stackTrace = stripslashes($report['stackTrace']);
|
||||
$cause =stripslashes($report['cause']);
|
||||
$date = nl2br(stripslashes($report['date']));
|
||||
$device = nl2br(stripslashes($report['device']));
|
||||
$version = stripslashes($report['version']);
|
||||
$app = stripslashes($report['app']);
|
||||
$description = nl2br(stripslashes($report['description']));
|
||||
$count = $report['count'];
|
||||
$status = $report['status'];
|
||||
$status_icon = '<img height="5%" src="res/newbutton.png"/>';
|
||||
$update_status_button = '<a href="index.php?report='.$id.'&status=old">Mark as Old</a>';
|
||||
|
||||
if($status == 'updated')
|
||||
$status_icon = '<img height="5%" src="res/updatedbutton.png"/>';
|
||||
else if ($status == 'old'){
|
||||
$status_icon = '<img height="5%" src="res/oldbutton.png"/>';
|
||||
$update_status_button = '<a href="index.php?report='.$id.'&status=new">Mark as New</a>';
|
||||
}
|
||||
$entry_display .= <<<ENTRY_DISPLAY
|
||||
<P align="right">
|
||||
$update_status_button
|
||||
<a href="index.php?delete=$id" onclick="return confirm('Are you sure You want to delete this report forever?');">Delete Report</a>
|
||||
</P>
|
||||
ENTRY_DISPLAY;
|
||||
|
||||
|
||||
$entry_display .= <<<ENTRY_DISPLAY
|
||||
|
||||
<SCRIPT language=javascript Type=Text/javascript>
|
||||
Function copyToClipBoard(sContents)
|
||||
{
|
||||
window.clipboardData.setData("Text", sContents);
|
||||
alert("The contents have been copied to your clipboard.\t");
|
||||
}
|
||||
</SCRIPT>
|
||||
|
||||
<form name="report" >
|
||||
<h2>
|
||||
<b class="big"> #$id </b>$status_icon
|
||||
<br/>
|
||||
$msg
|
||||
</h2>
|
||||
<b>Count:</b> $count
|
||||
<br/>
|
||||
<br/>
|
||||
<b>App</b>
|
||||
<br/>
|
||||
$app
|
||||
<br/>
|
||||
<br/>
|
||||
<b>Version</b>
|
||||
<br/>
|
||||
$version
|
||||
<br/>
|
||||
<br/>
|
||||
<b>Stack Trace</b>
|
||||
<br/>
|
||||
<div name="stack" class="codebox" onClick="javascript:document.report.stack.select();
|
||||
copyToClipBoard(document.report.stack.value);">$stackTrace</div>
|
||||
<br/>
|
||||
<b>Cause</b>
|
||||
<br/>
|
||||
<div name="cause" class="codebox" onClick="javascript:document.report.cause.select();
|
||||
copyToClipBoard(document.report.cause.value);">$cause</div>
|
||||
<br/>
|
||||
<b>Date</b>
|
||||
<br/>
|
||||
$date
|
||||
<br/>
|
||||
<b>Devices</b>
|
||||
<br/>
|
||||
$device
|
||||
<br/>
|
||||
<b>User Descriptions</b>
|
||||
<br/>
|
||||
$description
|
||||
</form>
|
||||
|
||||
ENTRY_DISPLAY;
|
||||
/*
|
||||
comments
|
||||
*/
|
||||
include_once('comments.php');
|
||||
$obj = new comments("report_comments",DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
|
||||
|
||||
$entry_display .= $obj->get_comments($id);
|
||||
$entry_display .= $obj->display_post($id);;
|
||||
} else {
|
||||
echo "<b>No Report Found: $id</b>";
|
||||
}
|
||||
return $entry_display;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Files a new exception report into the database
|
||||
*/
|
||||
public function file_report($report){
|
||||
|
||||
include('email.php');
|
||||
$output = "Filing report...";
|
||||
|
||||
/*
|
||||
add escapes to the data
|
||||
*/
|
||||
$report['msg'] = mysql_real_escape_string($report['msg']);
|
||||
$report['stackTrace'] = mysql_real_escape_string($report['stackTrace']);
|
||||
$report['cause'] = mysql_real_escape_string($report['cause']);
|
||||
$report['date'] = mysql_real_escape_string($report['date']) ."\n";
|
||||
$report['device'] = mysql_real_escape_string($report['device']) ."\n";
|
||||
$report['version'] = mysql_real_escape_string($report['version']);
|
||||
$report['app'] = mysql_real_escape_string($report['app']);
|
||||
$report['description'] = "--START NEW DESCRIPTION--- " . mysql_real_escape_string($report['description']) ."\n";
|
||||
|
||||
/*
|
||||
check to see if a map exist
|
||||
if it does, then we want to map the stack & cause
|
||||
*/
|
||||
$map = $maps. $report['app'] . $report['version'] . ".txt";
|
||||
if (file_exists($map)) {
|
||||
$output .= $map . " Exists";
|
||||
$stack = fopen("tmp/stack", 'w');
|
||||
$cause = fopen("tmp/cause", 'w');
|
||||
fwrite($stack, stripcslashes($report['stackTrace']));
|
||||
fwrite($cause, stripcslashes($report['cause']));
|
||||
fclose($stack);
|
||||
fclose($cause);
|
||||
|
||||
$retrace = "java -jar ../lib/retrace.jar ".$map . " ";
|
||||
|
||||
$output .= "\n";
|
||||
$output .= $retrace;
|
||||
|
||||
$report['stackTrace'] = shell_exec($retrace . "tmp/stack");
|
||||
$output .= $report['stackTrace'];
|
||||
$report['cause'] = shell_exec($retrace . "tmp/cause");
|
||||
|
||||
unlink("tmp/stack");
|
||||
unlink("tmp/cause");
|
||||
|
||||
} else {
|
||||
$output .= "There was no existing map for ". $map;
|
||||
}
|
||||
|
||||
/*
|
||||
Serach for duplicates and try to update them
|
||||
*/
|
||||
$updateStm = "UPDATE reports SET count=count+1, status='updated', description=concat(description,'".$report['description']."'), device=concat(device,'".$report['device']."'), date=concat(date,'".$report['date']."') WHERE msg='".$report['msg']."' AND stackTrace='".$report['stackTrace']."' AND cause='".$report['cause']."' AND version='".$report['version']."' AND app='".$report['app']."'";
|
||||
|
||||
mysql_query($updateStm);
|
||||
|
||||
/*
|
||||
check to see if there were any row affected
|
||||
*/
|
||||
if(mysql_affected_rows()<=0)
|
||||
{
|
||||
/*
|
||||
insert the new report
|
||||
*/
|
||||
$insert = "INSERT INTO reports (msg, stackTrace, cause, date, device, version, app, description, count, status) VALUES ('".$report['msg']."', '".$report['stackTrace']."', '".$report['cause']."', '".$report['date']."', '".$report['device']."', '".$report['version']."', '".$report['app']."', '".$report['description']."', 1, 'new')";
|
||||
|
||||
|
||||
if( mysql_query($insert))
|
||||
$output .= "Successfully filed new report";
|
||||
reportEmail($report['app'], $report['version'], $report['msg'], "NEW", mysql_insert_id());
|
||||
return $output;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
$output .= "Successfully updated an old report";
|
||||
/*
|
||||
we will run a query to get the row id of the updated rows
|
||||
*/
|
||||
$query = mysql_query("SELECT * FROM reports WHERE msg='".$report['msg']."' AND stackTrace='".$report['stackTrace']."' AND cause='".$report['cause']."' AND version='".$report['version']."' AND app='".$report['app']."'");
|
||||
while($r = mysql_fetch_assoc($query)) {
|
||||
reportEmail($report['app'], $report['version'], $report['msg'], "UPDATED", $r['id']);
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
Converts the entire exception reports database into JSON so it can be downloaded, and parsed
|
||||
*/
|
||||
public function get_reports(){
|
||||
|
||||
$result = mysql_query("SELECT * FROM reports");
|
||||
$reports = array();
|
||||
if(mysql_num_rows($result)) {
|
||||
while($report = mysql_fetch_assoc($result)) {
|
||||
$reports[] = array('report'=>$report);
|
||||
}
|
||||
}
|
||||
// header('Content-type: application/json');
|
||||
return json_encode(array('reports'=>$reports));
|
||||
}
|
||||
|
||||
/*
|
||||
Connects the the database
|
||||
*/
|
||||
public function connect() {
|
||||
mysql_connect($this->host,$this->username,$this->password) or die("Could not connect. " . mysql_error());
|
||||
mysql_select_db($this->table) or die("Could not select database. " . mysql_error());
|
||||
return $this->buildDB();
|
||||
}
|
||||
|
||||
/**
|
||||
Builds the database that will be used to for exception reports
|
||||
*/
|
||||
private function buildDB() {
|
||||
$sql = <<<MySQL_QUERY
|
||||
CREATE TABLE IF NOT EXISTS reports (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
msg TEXT,
|
||||
stackTrace TEXT,
|
||||
cause TEXT,
|
||||
date TEXT,
|
||||
device TEXT,
|
||||
version TEXT,
|
||||
app TEXT,
|
||||
description TEXT,
|
||||
count INTEGER,
|
||||
status TEXT
|
||||
)
|
||||
MySQL_QUERY;
|
||||
|
||||
return mysql_query($sql);
|
||||
}
|
||||
}
|
||||
?>
|
||||
29
classes/footer.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
require_once('classes/conf.php');
|
||||
require_once('classes/content.php');
|
||||
|
||||
$column2 = new content(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE, "column2");
|
||||
$title = $column2->get_title();
|
||||
$column2 = "<h2>$title</h2></br>".$column2->get_body();
|
||||
|
||||
echo <<< LAYOUT
|
||||
<!-- Column 1 end -->
|
||||
</div>
|
||||
<div class="col2">
|
||||
<!-- Column 2 start -->
|
||||
$column2
|
||||
<!-- Column 2 end -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
LAYOUT;
|
||||
|
||||
$name = COMPANY_NAME;
|
||||
$year = date("Y");
|
||||
echo <<< FOOTER
|
||||
<div id="footer">© $name $year</div>
|
||||
FOOTER;
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
153
classes/guest.php
Executable file
@@ -0,0 +1,153 @@
|
||||
<?php
|
||||
/**
|
||||
This class is used to maintian the guests table in the database
|
||||
@author ricky barrette
|
||||
@author Twenty Codes, LLC
|
||||
*/
|
||||
class guest {
|
||||
|
||||
var $host;
|
||||
var $username;
|
||||
var $password;
|
||||
var $table;
|
||||
|
||||
/**
|
||||
* Contructor
|
||||
* @param String $host
|
||||
* @param String $username
|
||||
* @param String $password
|
||||
* @param String $db
|
||||
*/
|
||||
public function guest($host, $username, $password, $db){
|
||||
$this->host = $host;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
$this->table = $db;
|
||||
$this->connect();
|
||||
}
|
||||
|
||||
/**
|
||||
Generates and sends a email to notify users of their email
|
||||
*/
|
||||
function sendEmail($userEmail, $title, $body){
|
||||
mail( $userEmail , $title , $body);
|
||||
}
|
||||
|
||||
public function email_guests($title, $body){
|
||||
$r = mysql_query("SELECT * FROM guests");
|
||||
if ( $r !== false && mysql_num_rows($r) > 0 )
|
||||
while ( $a = mysql_fetch_assoc($r) )
|
||||
$this->sendEmail($a['email'], $title, $body);
|
||||
}
|
||||
|
||||
/**
|
||||
Display all users as links that remove them
|
||||
*/
|
||||
public function display_guest_list() {
|
||||
|
||||
$entry_display .= '<h2>Guest List:</h2>';
|
||||
|
||||
/* Instantiate class */
|
||||
require_once("pager.php");
|
||||
$p = new Pager;
|
||||
|
||||
/* Show many results per page? */
|
||||
$limit = 10;
|
||||
|
||||
/* Find the start depending on $_GET['page'] (declared if it's null) */
|
||||
$start = $p->findStart($limit);
|
||||
|
||||
/* Find the number of rows returned from a query; Note: Do NOT use a LIMIT clause in this query */
|
||||
$count = mysql_num_rows(mysql_query("SELECT * FROM guests"));
|
||||
|
||||
/* Find the number of pages based on $count and $limit */
|
||||
$pages = $p->findPages($count, $limit);
|
||||
|
||||
/* Now we use the LIMIT clause to grab a range of rows */
|
||||
$r = mysql_query("SELECT * FROM guests ORDER BY f_name LIMIT ".$start.", ".$limit);
|
||||
|
||||
/* Now get the page list and echo it */
|
||||
$pagelist = $p->pageList($_GET['page'], $pages);
|
||||
|
||||
if ( $r !== false && mysql_num_rows($r) > 0 ) {
|
||||
while ( $a = mysql_fetch_assoc($r) ) {
|
||||
$address = $a['address'];
|
||||
$email = $a['email'];
|
||||
$name = $a['f_name'].' '.$a['l_name'];
|
||||
$plus_one = $a['plus_one_f_name'].' '.$a['plus_one_l_name'];
|
||||
|
||||
$entry_display .= <<<GUEST
|
||||
<b>$name & $plus_one</b>
|
||||
<br/>
|
||||
$address
|
||||
<br/>
|
||||
$email
|
||||
<br/>
|
||||
<br/>
|
||||
GUEST;
|
||||
}
|
||||
$entry_display .= '<div align="center">'.$pagelist.'</div>';
|
||||
}
|
||||
else
|
||||
$entry_display .= '<p>No entries have been made on this page. </p>';
|
||||
|
||||
return $entry_display;
|
||||
}
|
||||
|
||||
public function get_guest_count(){
|
||||
$sql="select * from guests";
|
||||
$result=mysql_query($sql);
|
||||
return mysql_num_rows($result);
|
||||
}
|
||||
|
||||
/**
|
||||
inserts a new user into the database
|
||||
@author ricky barrette
|
||||
*/
|
||||
public function new_guest($f_name, $l_name, $address, $email, $plus_one_f_name, $plus_one_l_name) {
|
||||
$sql="select * from guests where email='$email'";
|
||||
$result=mysql_query($sql);
|
||||
$count=mysql_num_rows($result);
|
||||
if($count==1) // If there is a match.
|
||||
die("User/Email already exists");
|
||||
$email = mysql_real_escape_string(strip_tags($email));
|
||||
$f_name = mysql_real_escape_string(strip_tags($f_name));
|
||||
$l_name = mysql_real_escape_string(strip_tags($l_name));
|
||||
$address = mysql_real_escape_string(strip_tags($address));
|
||||
$hash=md5($email);
|
||||
|
||||
$sql = "INSERT INTO guests (f_name, l_name, address, email, hash, plus_one_f_name, plus_one_l_name) VALUES('$f_name','$l_name','$address','$email','$hash','$plus_one_f_name','$plus_one_l_name')";
|
||||
return mysql_query($sql) or die("Could not insert. " . mysql_error());
|
||||
}
|
||||
|
||||
/**
|
||||
Connects to the database
|
||||
@author ricky barrette
|
||||
*/
|
||||
public function connect() {
|
||||
$connection = mysql_connect($this->host,$this->username,$this->password) or die("Could not connect. " . mysql_error());
|
||||
mysql_select_db($this->table) or die("Could not select database. " . mysql_error());
|
||||
return $this->buildDB();
|
||||
}
|
||||
|
||||
/**
|
||||
Builds the users table
|
||||
@author ricky barrette
|
||||
*/
|
||||
private function buildDB() {
|
||||
$sql = <<<MySQL_QUERY
|
||||
CREATE TABLE IF NOT EXISTS guests (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
f_name TEXT,
|
||||
l_name TEXT,
|
||||
address TEXT,
|
||||
email TEXT,
|
||||
hash TEXT,
|
||||
plus_one_f_name TEXT,
|
||||
plus_one_l_name TEXT)
|
||||
MySQL_QUERY;
|
||||
return mysql_query($sql);
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
37
classes/header.php
Executable file
@@ -0,0 +1,37 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="css/screen.css" />
|
||||
<link rel="shortcut icon" href="res/icon.png" type="image/x-icon" />
|
||||
<?php
|
||||
session_start();
|
||||
require_once('classes/conf.php');
|
||||
require_once('classes/content.php');
|
||||
$column1 = new content(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE, "column1");
|
||||
$title = $column1->get_title();
|
||||
|
||||
echo <<<HEADER
|
||||
<title>$title</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="header">
|
||||
<div class="topbar-wrapper" style="z-index: 5;">
|
||||
<div class="topbar">
|
||||
<div class="container fixed">
|
||||
<h3><a class="logo" href="index.php">$title</a></h3>
|
||||
HEADER;
|
||||
|
||||
include_once("classes/navigation_bar.php");
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
</div> <!-- topbar-wrapper -->
|
||||
</div>
|
||||
|
||||
<br/>
|
||||
<br/>
|
||||
<div class="colmask leftmenu">
|
||||
<div class="colleft">
|
||||
<div class="col1">
|
||||
<!-- Column 1 start -->
|
||||
<br/>
|
||||
43
classes/navigation_bar.php
Executable file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/*
|
||||
PRIMARY NAV
|
||||
*/
|
||||
|
||||
$items = array(array("link"=>"index.php", "label"=>"Home"));
|
||||
|
||||
array_push($items, array("link"=>"forum.php", "label"=>"Forum"));
|
||||
array_push($items, array("link"=>"user_manager.php", "label"=>"Control Panel"));
|
||||
|
||||
if($_SESSION['access'] == 'admin')
|
||||
array_push($items, array("link"=>"map_manager.php", "label"=>"Maps"));
|
||||
|
||||
if($_SESSION['loggedIn'])
|
||||
array_push($items, array("link"=>"logout.php", "label"=>"Logout ".$_SESSION['username']));
|
||||
else
|
||||
array_push($items, array("link"=>"login.php", "label"=>"Log In"));
|
||||
|
||||
$menu = '<ul>';
|
||||
foreach ($items as $val)
|
||||
$menu .= '<li><a href="'.$val['link'].'">'.$val['label'].'</a></li>';
|
||||
$menu .= '</ul>';
|
||||
|
||||
|
||||
/*
|
||||
SECONDARY NAV
|
||||
*/
|
||||
$menu .= '<ul class="nav secondary-nav">';
|
||||
|
||||
$items = array();
|
||||
|
||||
foreach ($items as $val) {
|
||||
$menu .= '<li><a href="'.$val['link'].'">'.$val['label'].'</a></li>';
|
||||
}
|
||||
|
||||
$menu .= <<<SEARCH
|
||||
<form action="index.php"><input name="search" id="search" type="text" placeholder="Report Number"/></form>
|
||||
SEARCH;
|
||||
|
||||
$menu .= '</ul>';
|
||||
|
||||
echo $menu;
|
||||
?>
|
||||
120
classes/pager.php
Executable file
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
/**************************************************************************************
|
||||
* Class: Pager
|
||||
* Author: Tsigo <tsigo@tsiris.com>
|
||||
* Methods:
|
||||
* findStart
|
||||
* findPages
|
||||
* pageList
|
||||
* nextPrev
|
||||
* Redistribute as you see fit.
|
||||
**************************************************************************************/
|
||||
class Pager
|
||||
{
|
||||
/***********************************************************************************
|
||||
* int findStart (int limit)
|
||||
* Returns the start offset based on $_GET['page'] and $limit
|
||||
***********************************************************************************/
|
||||
function findStart($limit)
|
||||
{
|
||||
if ((!isset($_GET['page'])) || ($_GET['page'] == "1"))
|
||||
{
|
||||
$start = 0;
|
||||
$_GET['page'] = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
$start = ($_GET['page']-1) * $limit;
|
||||
}
|
||||
|
||||
return $start;
|
||||
}
|
||||
/***********************************************************************************
|
||||
* int findPages (int count, int limit)
|
||||
* Returns the number of pages needed based on a count and a limit
|
||||
***********************************************************************************/
|
||||
function findPages($count, $limit)
|
||||
{
|
||||
$pages = (($count % $limit) == 0) ? $count / $limit : floor($count / $limit) + 1;
|
||||
|
||||
return $pages;
|
||||
}
|
||||
/***********************************************************************************
|
||||
* string pageList (int curpage, int pages)
|
||||
* Returns a list of pages in the format of "« < [pages] > »"
|
||||
***********************************************************************************/
|
||||
function pageList($curpage, $pages)
|
||||
{
|
||||
$page_list = "";
|
||||
|
||||
/* Print the first and previous page links if necessary */
|
||||
if (($curpage != 1) && ($curpage))
|
||||
{
|
||||
$page_list .= " <a href=\"".$_SERVER['PHP_SELF']."?page=1\" title=\"First Page\"><<</a> ";
|
||||
}
|
||||
|
||||
if (($curpage-1) > 0)
|
||||
{
|
||||
$page_list .= " <a href=\"".$_SERVER['PHP_SELF']."?page=".($curpage-1)."\" title=\"Previous Page\"><</a> ";
|
||||
}
|
||||
|
||||
/* Print the numeric page list; make the current page unlinked and bold */
|
||||
for ($i=1; $i<=$pages; $i++)
|
||||
{
|
||||
if ($i == $curpage)
|
||||
{
|
||||
$page_list .= " <b>".$i."</b>";
|
||||
}
|
||||
else
|
||||
{
|
||||
$page_list .= " <a href=\"".$_SERVER['PHP_SELF']."?page=".$i."\" title=\"Page ".$i."\">".$i."</a>";
|
||||
}
|
||||
$page_list .= " ";
|
||||
}
|
||||
|
||||
/* Print the Next and Last page links if necessary */
|
||||
if (($curpage+1) <= $pages)
|
||||
{
|
||||
$page_list .= " <a href=\"".$_SERVER['PHP_SELF']."?page=".($curpage+1)."\" title=\"Next Page\">></a> ";
|
||||
}
|
||||
|
||||
if (($curpage != $pages) && ($pages != 0))
|
||||
{
|
||||
$page_list .= " <a href=\"".$_SERVER['PHP_SELF']."?page=".$pages."\" title=\"Last Page\">>></a> ";
|
||||
}
|
||||
$page_list .= "</td>\n";
|
||||
|
||||
return $page_list;
|
||||
}
|
||||
/***********************************************************************************
|
||||
* string nextPrev (int curpage, int pages)
|
||||
* Returns "Previous | Next" string for individual pagination (it's a word!)
|
||||
***********************************************************************************/
|
||||
function nextPrev($curpage, $pages)
|
||||
{
|
||||
$next_prev = "";
|
||||
|
||||
if (($curpage-1) <= 0)
|
||||
{
|
||||
$next_prev .= "Previous";
|
||||
}
|
||||
else
|
||||
{
|
||||
$next_prev .= "<a href=\"".$_SERVER['PHP_SELF']."?page=".($curpage-1)."\">Previous</a>";
|
||||
}
|
||||
|
||||
$next_prev .= " | ";
|
||||
|
||||
if (($curpage+1) > $pages)
|
||||
{
|
||||
$next_prev .= "Next";
|
||||
}
|
||||
else
|
||||
{
|
||||
$next_prev .= "<a href=\"".$_SERVER['PHP_SELF']."?page=".($curpage+1)."\">Next</a>";
|
||||
}
|
||||
|
||||
return $next_prev;
|
||||
}
|
||||
}
|
||||
?>
|
||||
165
classes/threads.php
Executable file
@@ -0,0 +1,165 @@
|
||||
<?php
|
||||
|
||||
class threads{
|
||||
|
||||
var $host;
|
||||
var $username;
|
||||
var $password;
|
||||
var $table;
|
||||
|
||||
/**
|
||||
* Contructor
|
||||
* @param String $host
|
||||
* @param String $username
|
||||
* @param String $password
|
||||
* @param String $db
|
||||
*/
|
||||
public function threads($host, $username, $password, $db){
|
||||
$this->host = $host;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
$this->table = $db;
|
||||
$this->connect();
|
||||
}
|
||||
|
||||
/**
|
||||
deletes a report by is id
|
||||
*/
|
||||
public function delete_thread($id){
|
||||
mysql_query("DELETE FROM comments WHERE report = '$id'");
|
||||
return mysql_query("DELETE FROM threads WHERE id = '$id'")or die(mysql_error());
|
||||
}
|
||||
|
||||
/**
|
||||
diplays a list of exception reports, this list will link to the indiviual reports
|
||||
*/
|
||||
public function display_report_list() {
|
||||
/* Instantiate class */
|
||||
require_once("pager.php");
|
||||
$p = new Pager;
|
||||
|
||||
/* Show many results per page? */
|
||||
$limit = 5;
|
||||
|
||||
/* Find the start depending on $_GET['page'] (declared if it's null) */
|
||||
$start = $p->findStart($limit);
|
||||
|
||||
/* Find the number of rows returned from a query; Note: Do NOT use a LIMIT clause in this query */
|
||||
$count = mysql_num_rows(mysql_query("SELECT * FROM threads"));
|
||||
|
||||
/* Find the number of pages based on $count and $limit */
|
||||
$pages = $p->findPages($count, $limit);
|
||||
|
||||
/* Now we use the LIMIT clause to grab a range of rows */
|
||||
$r = mysql_query("SELECT * FROM threads ORDER BY id LIMIT ".$start.", ".$limit);
|
||||
|
||||
/* Now get the page list and echo it */
|
||||
$pagelist = $p->pageList($_GET['page'], $pages);
|
||||
|
||||
/*
|
||||
get all the reports
|
||||
*/
|
||||
$entry_display = '<br/>';
|
||||
while($thread = mysql_fetch_assoc($r)) {
|
||||
$title = $thread['title'];
|
||||
$id = $thread['id'];
|
||||
$author = $thread['author'];
|
||||
$entry_display .= <<<ENTRY_DISPLAY
|
||||
<div class="post">
|
||||
<a href="forum.php?thread=$id" >#$id $title</a> Started by: $author
|
||||
</div>
|
||||
<br/>
|
||||
ENTRY_DISPLAY;
|
||||
|
||||
}
|
||||
$entry_display .= '<div align="center">'.$pagelist.'</div>';
|
||||
return $entry_display;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
This will display the specified report
|
||||
*/
|
||||
public function display_thread($id) {
|
||||
|
||||
$id = mysql_real_escape_string($id);
|
||||
|
||||
/*
|
||||
get all the reports
|
||||
*/
|
||||
$r = mysql_query("SELECT * FROM threads WHERE id=".$id);
|
||||
|
||||
if($thread = mysql_fetch_assoc($r)) {
|
||||
|
||||
$title = $thread['title'];
|
||||
$author = $thread['author'];
|
||||
$time = $thread['time'];
|
||||
|
||||
$entry_display = <<<THREAD
|
||||
|
||||
<h1>$title</h1>
|
||||
Started By: $author ~ $time
|
||||
THREAD;
|
||||
|
||||
if($_SESSION['access'] == "admin" || $_SESSION['username'] == $author)
|
||||
echo <<<DELETE
|
||||
<a align="right" href="forum.php?delete=$id" onclick="return confirm('Are you sure You want to delete this thread forever?');">Delete Thread</a>
|
||||
DELETE;
|
||||
|
||||
/*
|
||||
comments
|
||||
*/
|
||||
require_once('comments.php');
|
||||
$comments = new comments("comments",DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
|
||||
|
||||
$entry_display .= $comments->get_comments($id);
|
||||
$entry_display .= $comments->display_post($id);;
|
||||
} else
|
||||
return "<b>No Thread Found: $id</b>";
|
||||
return $entry_display;
|
||||
|
||||
}
|
||||
|
||||
/*
|
||||
Files a new exception report into the database
|
||||
*/
|
||||
public function file_thread($title, $author, $time){
|
||||
/*
|
||||
add escapes to the data
|
||||
*/
|
||||
$title = mysql_real_escape_string($title);
|
||||
|
||||
/*
|
||||
insert the new report
|
||||
*/
|
||||
$insert = "INSERT INTO threads (title, author, time) VALUES ('$title', '$author', '$time')";
|
||||
mysql_query($insert);
|
||||
return mysql_insert_id();
|
||||
}
|
||||
|
||||
/*
|
||||
Connects the the database
|
||||
*/
|
||||
public function connect() {
|
||||
mysql_connect($this->host,$this->username,$this->password) or die("Could not connect. " . mysql_error());
|
||||
mysql_select_db($this->table) or die("Could not select database. " . mysql_error());
|
||||
return $this->buildDB();
|
||||
}
|
||||
|
||||
/**
|
||||
Builds the database that will be used to for exception reports
|
||||
*/
|
||||
private function buildDB() {
|
||||
$sql = <<<MySQL_QUERY
|
||||
CREATE TABLE IF NOT EXISTS threads (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
title TEXT,
|
||||
author TEXT,
|
||||
time TEXT
|
||||
)
|
||||
MySQL_QUERY;
|
||||
|
||||
return mysql_query($sql);
|
||||
}
|
||||
}
|
||||
?>
|
||||
75
classes/thumbnail.php
Executable file
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
//Thumbnail save settings, feel free to change these. Pre-existing thumbnails need to be deeted for the changes to take effect!!!
|
||||
$thumbsize = "55"; // Thumbnail size.
|
||||
$thumbquality = "130"; //the thumbnail JPEG quality.
|
||||
|
||||
// Image folder
|
||||
|
||||
$images = $_GET['imagefolder'];
|
||||
|
||||
// Thumbnail folder
|
||||
|
||||
$thumbnails = $_GET['thumbfolder'];
|
||||
|
||||
// The file you are resizing
|
||||
$file = $_GET['im'];
|
||||
|
||||
//image name:
|
||||
$tn_name = $_GET['name'];
|
||||
|
||||
// This sets it to a .jpg, but you can change this to png or gif
|
||||
header('Content-type: image/jpeg');
|
||||
|
||||
// Setting the resize parameters
|
||||
list($width, $height) = getimagesize($file);
|
||||
|
||||
if ($width == $height) {
|
||||
$modwidth = $thumbsize;
|
||||
$modheight = $thumbsize;
|
||||
}
|
||||
else if ($width < $height) {
|
||||
$zoom = $thumbsize / $width;
|
||||
$modwidth = $thumbsize;
|
||||
$modheight = $height * $zoom;
|
||||
$dstx = 0;
|
||||
$dsty = ($thumbsize - $modheight)/2;
|
||||
|
||||
}
|
||||
else {
|
||||
$zoom = $thumbsize / $height;
|
||||
$modheight = $thumbsize;
|
||||
$modwidth = $width * $zoom;
|
||||
$dstx = ($thumbsize - $modwidth)/2;
|
||||
$dsty = 0;
|
||||
}
|
||||
|
||||
// Resizing the Image
|
||||
$tn = imagecreatetruecolor($thumbsize, $thumbsize);
|
||||
$image = imagecreatefromjpeg($file);
|
||||
imagecopyresampled($tn, $image, $dstx, $dsty, 0, 0, $modwidth, $modheight, $width, $height);
|
||||
|
||||
|
||||
// preparing name for the thumbnail
|
||||
$splitname = explode (".", $tn_name);
|
||||
|
||||
// check if thumbs directory already exists, if not: make one
|
||||
|
||||
if (!is_dir("$thumbnails")) {
|
||||
echo "making dir";
|
||||
mkdir($thumbnails, 0755);
|
||||
}
|
||||
|
||||
// if it exists, check if directory is writeable, if not: chmod
|
||||
|
||||
elseif(!is_writeable("$thumbnails")) {
|
||||
chmod($thumbnails, 0755);
|
||||
}
|
||||
|
||||
// copying thumbnail with _tn before extension to server
|
||||
ImageJPEG($tn, $thumbnails . "/$splitname[0]_thumb.jpg", $thumbquality);
|
||||
// Outputting a .jpg, you can make this gif or png if you want
|
||||
imagejpeg($tn, null, $thumbquality);
|
||||
|
||||
chmod($thumbnails . "/$splitname[0]_thumb.jpg", 0755);
|
||||
?>
|
||||
44
classes/thumbnails.php
Executable file
@@ -0,0 +1,44 @@
|
||||
<?php
|
||||
function php_thumbnails($imagefolder) {
|
||||
$images = $imagefolder;
|
||||
$thumbnails = $imagefolder."/thumbs";
|
||||
|
||||
//load images into an array and sort them alphabeticall:
|
||||
$files = array();
|
||||
if ($handle = opendir($images)){
|
||||
while (false !== ($file = readdir($handle)))
|
||||
//Only do JPG's
|
||||
if(eregi("((.jpeg|.jpg)$)", $file))
|
||||
$files[] = array("name" => $file);
|
||||
closedir($handle);
|
||||
}
|
||||
//Obtain a list of columns
|
||||
|
||||
foreach ($files as $key => $row)
|
||||
$name[$key] = $row['name'];
|
||||
|
||||
//Put images in order:
|
||||
array_multisort($name, SORT_ASC, $files);
|
||||
//set the GET variable name
|
||||
$pic = $imagefolder;
|
||||
|
||||
foreach ($files as $file){
|
||||
$name = $file['name'];
|
||||
$splitname = explode (".", $name);
|
||||
|
||||
$pictitle = str_replace("_"," ",$splitname[0]);
|
||||
$link = "<a rel=\"lightbox[" . $images . "]\" title=\"$splitname[0]\" href=\"" . $images . "/" . $name . "\">";
|
||||
|
||||
if (file_exists("$thumbnails/".$splitname[0]."_thumb.jpg")){
|
||||
// Load the thumbnail image
|
||||
echo($link);
|
||||
echo("<img class=\"thumb\" src=\"" . $thumbnails . "/".$splitname[0]."_thumb.jpg\" alt=\"$pictitle\"></a> \n");
|
||||
} else {
|
||||
// Create a thumbnail image
|
||||
echo($link);
|
||||
echo("<img class=\"thumb\" src=\"thumbnail.php?imagefolder=" . $images . "&thumbfolder=" . $thumbnails . "&name=" . $file['name'] . "&im=" . $images . "/" . $file['name'] . "\" alt=\"$pictitle\"></a> \n");
|
||||
}
|
||||
}
|
||||
reset($files);
|
||||
}
|
||||
?>
|
||||
195
classes/users.php
Executable file
@@ -0,0 +1,195 @@
|
||||
<?php
|
||||
/**
|
||||
This class is used to maintian the users table in the database
|
||||
@author ricky barrette
|
||||
@author Twenty Codes, LLC
|
||||
*/
|
||||
class users {
|
||||
|
||||
var $host;
|
||||
var $username;
|
||||
var $password;
|
||||
var $table;
|
||||
|
||||
/**
|
||||
* Contructor
|
||||
* @param String $host
|
||||
* @param String $username
|
||||
* @param String $password
|
||||
* @param String $db
|
||||
*/
|
||||
public function users($host, $username, $password, $db){
|
||||
$this->host = $host;
|
||||
$this->username = $username;
|
||||
$this->password = $password;
|
||||
$this->table = $db;
|
||||
$this->connect();
|
||||
}
|
||||
|
||||
/**
|
||||
Chnages the password of a user
|
||||
*/
|
||||
public function change_password($user, $old, $new){
|
||||
mysql_query("UPDATE users SET pass='$new' WHERE user='$user' AND pass='$old'");
|
||||
$count=mysql_affected_rows();
|
||||
if($count==1)
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
deletes a user by their username and hasded email
|
||||
*/
|
||||
public function delete_user($user, $email){
|
||||
return mysql_query("DELETE FROM users WHERE user='$user' AND email='$email'")or die(mysql_error());
|
||||
}
|
||||
|
||||
/**
|
||||
Display all users as links that remove them
|
||||
*/
|
||||
public function display_users() {
|
||||
|
||||
$entry_display .= <<<ENTRY_DISPLAY
|
||||
<h2>
|
||||
Users:
|
||||
</h2>
|
||||
|
||||
ENTRY_DISPLAY;
|
||||
|
||||
/* Instantiate class */
|
||||
require_once("pager.php");
|
||||
$p = new Pager;
|
||||
|
||||
/* Show many results per page? */
|
||||
$limit = 5;
|
||||
|
||||
/* Find the start depending on $_GET['page'] (declared if it's null) */
|
||||
$start = $p->findStart($limit);
|
||||
|
||||
/* Find the number of rows returned from a query; Note: Do NOT use a LIMIT clause in this query */
|
||||
$count = mysql_num_rows(mysql_query("SELECT * FROM users"));
|
||||
|
||||
/* Find the number of pages based on $count and $limit */
|
||||
$pages = $p->findPages($count, $limit);
|
||||
|
||||
/* Now we use the LIMIT clause to grab a range of rows */
|
||||
$r = mysql_query("SELECT * FROM users ORDER BY user LIMIT ".$start.", ".$limit);
|
||||
|
||||
/* Now get the page list and echo it */
|
||||
$pagelist = $p->pageList($_GET['page'], $pages);
|
||||
|
||||
if ( $r !== false && mysql_num_rows($r) > 0 ) {
|
||||
while ( $a = mysql_fetch_assoc($r) ) {
|
||||
$user = stripslashes($a['user']);
|
||||
$email = stripslashes($a['email']);
|
||||
$username = $a['name'];
|
||||
$gravatar = 'http://www.gravatar.com/avatar/' . $email . '?s=48';
|
||||
|
||||
$entry_display .= <<<ENTRY_DISPLAY
|
||||
<img src="$gravatar" /> <b>$user</b> <a href="user_manager.php?user=$user&email=$email" onclick="return confirm('Are you sure You want to delete the user ‘ $user ’ forever?');">Delete $user</a><br/>
|
||||
ENTRY_DISPLAY;
|
||||
}
|
||||
$entry_display .= '<div align="center">'.$pagelist.'</div>';
|
||||
|
||||
}
|
||||
else {
|
||||
$entry_display .= <<<ENTRY_DISPLAY
|
||||
<p>
|
||||
No entries have been made on this page.
|
||||
</p>
|
||||
|
||||
ENTRY_DISPLAY;
|
||||
}
|
||||
|
||||
/*
|
||||
$entry_display .= <<<ADMIN_OPTION
|
||||
|
||||
<p class="admin_link">
|
||||
<a href="{$_SERVER['PHP_SELF']}?new_comment=1">Add a New Entry</a>
|
||||
</p>
|
||||
|
||||
ADMIN_OPTION;
|
||||
*/
|
||||
return $entry_display;
|
||||
}
|
||||
|
||||
/**
|
||||
checks if a user/pass combo exists in the database
|
||||
@return true if user/pas combo exists
|
||||
@author ricky barrette
|
||||
*/
|
||||
public function login($user, $pass) {
|
||||
$sql="select * from users where user='".mysql_real_escape_string($user)."' and pass='$pass';";
|
||||
|
||||
$result=mysql_query($sql);
|
||||
$count=mysql_num_rows($result);
|
||||
|
||||
$a = mysql_fetch_assoc($result);
|
||||
|
||||
if($count==1){ // If there is a match.
|
||||
$_SESSION["username"] = $user; // Creates a cookie saving the username
|
||||
$_SESSION["loggedIn"] = true; // Creates a cookie saying the user is logged in
|
||||
$_SESSION["access"] = $a['access'];
|
||||
$_SESSION["email"] = $a['email'];
|
||||
|
||||
return true;
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
inserts a new user into the database
|
||||
@author ricky barrette
|
||||
*/
|
||||
public function new_user($user, $pass, $access, $email) {
|
||||
$sql="select * from users where user='".mysql_real_escape_string($user)."' and pass='$pass';";
|
||||
$result=mysql_query($sql);
|
||||
$count=mysql_num_rows($result);
|
||||
if($count==1) // If there is a match.
|
||||
die("User/Email already exists");
|
||||
$user = mysql_real_escape_string(strip_tags($user));
|
||||
$email = md5(mysql_real_escape_string(strip_tags($email)));
|
||||
$sql = "INSERT INTO users (user, email, access, pass) VALUES('$user','$email','$access','$pass')";
|
||||
return mysql_query($sql) or die("Could not select database. " . mysql_error());
|
||||
}
|
||||
|
||||
/**
|
||||
Connects to the database
|
||||
@author ricky barrette
|
||||
*/
|
||||
public function connect() {
|
||||
$connection = mysql_connect($this->host,$this->username,$this->password) or die("Could not connect. " . mysql_error());
|
||||
mysql_select_db($this->table) or die("Could not select database. " . mysql_error());
|
||||
return $this->buildDB();
|
||||
}
|
||||
|
||||
/**
|
||||
Builds the users table
|
||||
@author ricky barrette
|
||||
*/
|
||||
private function buildDB() {
|
||||
$sql = <<<MySQL_QUERY
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INTEGER NOT NULL PRIMARY KEY AUTO_INCREMENT,
|
||||
user TEXT,
|
||||
email TEXT,
|
||||
access TEXT,
|
||||
pass TEXT
|
||||
)
|
||||
MySQL_QUERY;
|
||||
$result = mysql_query($sql);
|
||||
if($result){
|
||||
$sql="select * from users where user='admin'";
|
||||
|
||||
$result = mysql_query($sql);
|
||||
$count=mysql_num_rows($result);
|
||||
|
||||
if(! $count==1)
|
||||
mysql_query("INSERT INTO users (user, email, access, pass) VALUES('admin', 'd41d8cd98f00b204e9800998ecf8427e', 'admin','d82494f05d6917ba02f7aaa29689ccb444bb73f20380876cb05d1f37537b7892')");
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
}
|
||||
?>
|
||||
25
content_manager.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
session_start();
|
||||
include('classes/auth.php');
|
||||
include('classes/access.php');
|
||||
include('classes/header.php');
|
||||
require_once('classes/content.php');
|
||||
require_once('classes/conf.php');
|
||||
|
||||
if($_REQUEST['pagekey'])
|
||||
$key = $_REQUEST['pagekey'];
|
||||
|
||||
if($_POST['pagekey'])
|
||||
$key = $_POST['pagekey'];
|
||||
|
||||
$content = new content(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE, $key);
|
||||
|
||||
if($_POST['pagekey']) {
|
||||
if($content->write($_POST['title'], $_POST['bodytext']))
|
||||
echo 'Saved';
|
||||
}
|
||||
|
||||
echo $content->display_editor();
|
||||
|
||||
include('classes/footer.php');
|
||||
?>
|
||||
41
css/prettify.css
Executable file
@@ -0,0 +1,41 @@
|
||||
.com { color: #93a1a1; }
|
||||
.lit { color: #195f91; }
|
||||
.pun, .opn, .clo { color: #93a1a1; }
|
||||
.fun { color: #dc322f; }
|
||||
.str, .atv { color: #268bd2; }
|
||||
.kwd, .tag { color: #195f91; }
|
||||
.typ, .atn, .dec, .var { color: #CB4B16; }
|
||||
.pln { color: #93a1a1; }
|
||||
pre.prettyprint {
|
||||
background: #fefbf3;
|
||||
padding: 9px;
|
||||
border: 1px solid rgba(0,0,0,.2);
|
||||
-webkit-box-shadow: 0 1px 2px rgba(0,0,0,.1);
|
||||
-moz-box-shadow: 0 1px 2px rgba(0,0,0,.1);
|
||||
box-shadow: 0 1px 2px rgba(0,0,0,.1);
|
||||
}
|
||||
|
||||
/* Specify class=linenums on a pre to get line numbering */
|
||||
ol.linenums { margin: 0 0 0 40px; } /* IE indents via margin-left */
|
||||
ol.linenums li { color: rgba(0,0,0,.15); line-height: 20px; }
|
||||
/* Alternate shading for lines */
|
||||
li.L1, li.L3, li.L5, li.L7, li.L9 { }
|
||||
|
||||
/*
|
||||
$base03: #002b36;
|
||||
$base02: #073642;
|
||||
$base01: #586e75;
|
||||
$base00: #657b83;
|
||||
$base0: #839496;
|
||||
$base1: #93a1a1;
|
||||
$base2: #eee8d5;
|
||||
$base3: #fdf6e3;
|
||||
$yellow: #b58900;
|
||||
$orange: #cb4b16;
|
||||
$red: #dc322f;
|
||||
$magenta: #d33682;
|
||||
$violet: #6c71c4;
|
||||
$blue: #268bd2;
|
||||
$cyan: #2aa198;
|
||||
$green: #859900;
|
||||
*/
|
||||
1870
css/screen.css
Executable file
16
error/.htaccess
Executable file
@@ -0,0 +1,16 @@
|
||||
php_value include_path ".:/var/www"
|
||||
|
||||
# disable directory browsing
|
||||
Options All -Indexes
|
||||
|
||||
ErrorDocument 400 /error/error400.php
|
||||
ErrorDocument 401 /error/error401.php
|
||||
ErrorDocument 403 /error/error403.php
|
||||
ErrorDocument 404 /error/error404.php
|
||||
ErrorDocument 500 /error/error500.php
|
||||
|
||||
#400 - Bad request
|
||||
#401 - Authorization Required
|
||||
#403 - Forbidden directory
|
||||
#404 - Page not found
|
||||
#500 - Internal Server Error
|
||||
16
error/.htaccess~
Executable file
@@ -0,0 +1,16 @@
|
||||
php_value include_path ".:/var/www"
|
||||
|
||||
# disable directory browsing
|
||||
Options All -Indexes
|
||||
|
||||
ErrorDocument 400 /error/error400.php
|
||||
ErrorDocument 401 /error/error401.php
|
||||
ErrorDocument 403 /error/error403.php
|
||||
ErrorDocument 404 /error/error404.php
|
||||
ErrorDocument 500 /error/error500.php
|
||||
|
||||
#400 - Bad request
|
||||
#401 - Authorization Required
|
||||
#403 - Forbidden directory
|
||||
#404 - Page not found
|
||||
#500 - Internal Server Error
|
||||
BIN
error/404_error_icon.png
Executable file
|
After Width: | Height: | Size: 118 KiB |
BIN
error/500_error_icon.png
Executable file
|
After Width: | Height: | Size: 214 KiB |
22
error/error400.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<html>
|
||||
<title>Bad request</title>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
include("error_header.php");
|
||||
|
||||
echo <<<MSG
|
||||
<center>
|
||||
<img src="/error/error_icon.png"/>
|
||||
<br/>
|
||||
<strong>Bad request</strong>
|
||||
</center>
|
||||
MSG;
|
||||
|
||||
include("footer.php");
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
22
error/error401.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<html>
|
||||
<title>Authorization Required</title>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
include("error_header.php");
|
||||
|
||||
echo <<<MSG
|
||||
<center>
|
||||
<img src="/error/error_icon.png"/>
|
||||
<br/>
|
||||
<strong>Authorization Required</strong>
|
||||
</center>
|
||||
MSG;
|
||||
|
||||
include("footer.php");
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
22
error/error403.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<html>
|
||||
<title>Forbidden directory</title>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
include("error_header.php");
|
||||
|
||||
echo <<<MSG
|
||||
<center>
|
||||
<img src="/error/error_icon.png"/>
|
||||
<br/>
|
||||
<b>Forbidden directory</b>
|
||||
</center>
|
||||
MSG;
|
||||
|
||||
include("footer.php");
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
22
error/error404.php
Executable file
@@ -0,0 +1,22 @@
|
||||
<html>
|
||||
<title>Page not found</title>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
include("error_header.php");
|
||||
|
||||
echo <<<MSG
|
||||
<center>
|
||||
<img height="70%" src="/error/404_error_icon.png"/>
|
||||
<br/>
|
||||
<strong>Page not found</strong>
|
||||
</center>
|
||||
MSG;
|
||||
|
||||
include("footer.php");
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
24
error/error500.php
Executable file
@@ -0,0 +1,24 @@
|
||||
<html>
|
||||
<title>Internal Server Error</title>
|
||||
<body>
|
||||
|
||||
<?php
|
||||
|
||||
include("error_header.php");
|
||||
|
||||
echo <<<MSG
|
||||
<center>
|
||||
<img height="70%" src="/error/500_error_icon.png"/>
|
||||
<br/>
|
||||
<strong>Internal Server Error</strong>
|
||||
<br/>
|
||||
He's Dead Jim....
|
||||
</center>
|
||||
MSG;
|
||||
|
||||
include("footer.php");
|
||||
|
||||
?>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
18
error/error_header.php
Executable file
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
require_once('/exceptionhandler/config.php');
|
||||
$name = COMPANY_NAME;
|
||||
echo <<<HEADER
|
||||
|
||||
<html>
|
||||
<head>
|
||||
<link rel="stylesheet" type="text/css" href="style.css" />
|
||||
<link rel="shortcut icon" href="/error/error_icon.png" type="image/x-icon" />
|
||||
</head>
|
||||
<body>
|
||||
<h1>
|
||||
$name
|
||||
</h1>
|
||||
</body>
|
||||
</html>
|
||||
HEADER;
|
||||
?>
|
||||
BIN
error/error_icon.png
Executable file
|
After Width: | Height: | Size: 4.6 KiB |
135
error/style.css
Executable file
@@ -0,0 +1,135 @@
|
||||
.body {
|
||||
margin:0;
|
||||
padding-left:10%;
|
||||
border:0; /* This removes the border around the viewport in old versions of IE */
|
||||
width:80%;
|
||||
background:#fff;
|
||||
min-width:600px; /* Minimum width of layout - remove line if not required */
|
||||
/* The min-width property does not work in old versions of Internet Explorer */
|
||||
font-size: 16px;
|
||||
}
|
||||
.big{
|
||||
font-size: 250%;
|
||||
}
|
||||
|
||||
.textfield {
|
||||
font-size: 11px;
|
||||
color: #333333;
|
||||
background: #F7F7F7;
|
||||
border: 1px solid #CCCCCC;
|
||||
padding-left: 1px;
|
||||
}
|
||||
h1 {
|
||||
color: #99CC00;
|
||||
margin: 0px 0px 5px;
|
||||
padding: 0px 0px 3px;
|
||||
font: bold 35px Verdana, Arial, Helvetica, sans-serif;
|
||||
border-bottom: 4px dashed #E6E8ED;
|
||||
|
||||
text-shadow: 1px 0px #eee, 0px 1px #ccc,
|
||||
2px 1px #eee, 1px 2px #ccc,
|
||||
3px 2px #eee, 2px 3px #ccc,
|
||||
4px 3px #eee, 3px 4px #ccc,
|
||||
5px 4px #eee, 4px 5px #ccc,
|
||||
6px 5px #eee, 5px 6px #ccc,
|
||||
7px 6px #eee, 6px 7px #ccc,
|
||||
8px 7px #eee, 7px 8px #ccc,
|
||||
8px 8px #eee;
|
||||
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #99CC00;
|
||||
margin: 0px 0px 5px;
|
||||
padding: 0px 0px 3px;
|
||||
font: bold 20px Verdana, Arial, Helvetica, sans-serif;
|
||||
border-bottom: 1px dashed #E6E8ED;
|
||||
}
|
||||
|
||||
b {
|
||||
color:#99CC00;
|
||||
font-size: 18px;
|
||||
}
|
||||
a {
|
||||
color:#99CC00;
|
||||
font-size: 18px;
|
||||
}
|
||||
a:hover {
|
||||
color: #2D3954;
|
||||
}
|
||||
.err {
|
||||
color: #FF9900;
|
||||
}
|
||||
th {
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
}
|
||||
.dim{
|
||||
width:228px;
|
||||
height:228px;
|
||||
}
|
||||
.padding{
|
||||
padding:50px;
|
||||
}
|
||||
footer{
|
||||
clear:both;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
width:98%;
|
||||
}
|
||||
li{
|
||||
display: inline;
|
||||
list-style-type: none;
|
||||
padding-right: 20px;
|
||||
}
|
||||
.post{
|
||||
background-color: #ffffff;
|
||||
border:1px solid #cccccc;
|
||||
padding:10px;
|
||||
-webkit-border-radius: 20px 20px;
|
||||
-moz-box-shadow: 5px 5px 5px #ccc;
|
||||
-webkit-box-shadow: 5px 5px 5px #ccc;
|
||||
box-shadow: 5px 5px 5px #ccc;
|
||||
white-space: pre-wrap; /* css-3 */
|
||||
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
|
||||
white-space: -pre-wrap; /* Opera 4-6 */
|
||||
white-space: -o-pre-wrap; /* Opera 7 */
|
||||
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
||||
}
|
||||
.commentfooter{
|
||||
border-top: 1px dashed #E6E8ED
|
||||
}
|
||||
pre {
|
||||
width: 70%;
|
||||
margin: 5px;
|
||||
white-space: pre-wrap; /* css-3 */
|
||||
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
|
||||
white-space: -pre-wrap; /* Opera 4-6 */
|
||||
white-space: -o-pre-wrap; /* Opera 7 */
|
||||
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
||||
}
|
||||
.codebox {
|
||||
display: block;
|
||||
background: #383838;
|
||||
color: #99CC00;
|
||||
padding: 10px;
|
||||
font-size: 14px;
|
||||
line-height: 15px;
|
||||
-moz-border-radius: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
/*
|
||||
-moz-box-shadow: 0 0 40px #656565;
|
||||
-webkit-box-shadow: 0 0 40px #656565;
|
||||
box-shadow: 0 0 40px #656565;
|
||||
*/
|
||||
|
||||
}
|
||||
.centered {
|
||||
text-align:center;
|
||||
}
|
||||
.search{
|
||||
width:25%;
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
56
forum.php
Executable file
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
session_start();
|
||||
include('classes/auth.php');
|
||||
include("classes/header.php");
|
||||
require_once('classes/conf.php');
|
||||
require_once('classes/threads.php');
|
||||
require_once('classes/comments.php');
|
||||
$threads = new threads(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
|
||||
$comments = new comments("comments" ,DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
|
||||
|
||||
if($_POST){
|
||||
if($_POST['comment'])
|
||||
$id = $_POST['comment'];
|
||||
else
|
||||
$id = $threads->file_thread($_POST['title'],$_SESSION['username'], date("g:iA M d, Y"));
|
||||
$comments->write($id, $_POST['title'], $_POST['bodytext']);
|
||||
echo $threads->display_thread($id);
|
||||
} else {
|
||||
if($_REQUEST['deletepost'])
|
||||
echo $comments->delete_comment($_REQUEST['deletepost'], $_REQUEST['thread']);
|
||||
if($_REQUEST['thread'])
|
||||
echo $threads->display_thread($_REQUEST['thread']);
|
||||
else {
|
||||
if($_REQUEST['delete'])
|
||||
echo $threads->delete_thread($_REQUEST['delete']);
|
||||
|
||||
echo '<h2 align="center"> Forum </h2>';
|
||||
echo $threads->display_report_list();
|
||||
echo <<<NEW_THREAD
|
||||
<h2>New Thread</h2>
|
||||
<form action="forum.php" method="post">
|
||||
<div class="clearfix">
|
||||
<label for="title">Title</label><br />
|
||||
<div class="input">
|
||||
<input name="title" id="title" type="text" maxlength="55" class="xlarge" required/>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix">
|
||||
<label for="bodytext">Body Text</label><br />
|
||||
<div class="input">
|
||||
<textarea name="bodytext" id="bodytext" rows=10 cols=56 class="xxlarge" required></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button type="submit" class="btn primary" >Create This Thread</button>
|
||||
<button type="reset" class="btn">Cancel</button>
|
||||
</div>
|
||||
</form>
|
||||
NEW_THREAD;
|
||||
|
||||
}
|
||||
}
|
||||
include("classes/footer.php");
|
||||
?>
|
||||
86
index.php
Executable file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once('classes/conf.php');
|
||||
|
||||
include_once('classes/exceptionReports.php');
|
||||
$obj = new exceptionReports();
|
||||
$obj->host = DB_HOST;
|
||||
$obj->username = DB_USER;
|
||||
$obj->password = DB_PASSWORD;
|
||||
$obj->table = DB_DATABASE;
|
||||
$obj->maps = MAP_LOCATION;
|
||||
$obj->email = EMAIL;
|
||||
$obj->reporturl = REPORT_URL;
|
||||
$obj->connect();
|
||||
|
||||
$welcome = <<<WELCOME
|
||||
|
||||
WELCOME;
|
||||
|
||||
//allow allications to get a JSON
|
||||
if ( $_REQUEST['get'] == 1 )
|
||||
echo $obj->get_reports();
|
||||
else
|
||||
//allow applications to post new exceptions
|
||||
if( $_REQUEST['post'] == 1 )
|
||||
echo $obj->file_report($_REQUEST);
|
||||
else
|
||||
if(isset($_POST['report']) && isset($_POST['status']))
|
||||
$obj->set_status($_REQUEST['report'], $_REQUEST['status']);
|
||||
|
||||
/**
|
||||
Everything after this else block will be used for the web GUI
|
||||
*/
|
||||
else {
|
||||
include("classes/auth.php");
|
||||
include("classes/header.php");
|
||||
require_once('classes/content.php');
|
||||
include_once('classes/comments.php');
|
||||
$comments = new comments("report_comments", DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
|
||||
|
||||
$column1 = new content(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE, "column1");
|
||||
$column1 = $column1->get_body();
|
||||
|
||||
if( $_REQUEST['search'] ){
|
||||
$column1 .= $obj->display_report($_REQUEST['search']);
|
||||
} else {
|
||||
|
||||
|
||||
//delete report
|
||||
if($_REQUEST['delete'] > 0)
|
||||
if($obj->delete_report($_REQUEST['delete']))
|
||||
$column1 .= '<strong>Deleted Report</strong>';
|
||||
|
||||
//delete report comment
|
||||
if($_REQUEST['deletepost'] > 0){
|
||||
$comments->delete_comment($_REQUEST['deletepost'], $_REQUEST['thread']);
|
||||
$column1 .= $obj->display_report($_REQUEST['thread']);
|
||||
} else {
|
||||
|
||||
//this is for the comment module
|
||||
if( $_REQUEST['comment'] > 0 ){
|
||||
if($comments->write($_REQUEST['comment'], $_REQUEST['title'], $_REQUEST['bodytext'])){
|
||||
$column1 .= $obj->display_report($_REQUEST['comment']);
|
||||
}else
|
||||
$column1 .= "Error";
|
||||
} else {
|
||||
|
||||
//this is for displaying the web application
|
||||
if ( $_REQUEST['report'] > 0){
|
||||
if(isset($_REQUEST['status']))
|
||||
$obj->set_status($_REQUEST['report'], $_REQUEST['status']);
|
||||
$column1 .= $obj->display_report($_REQUEST['report']);
|
||||
} else {
|
||||
$column1 .= $welcome;
|
||||
$column1 .= $obj->display_report_list();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
echo $column1;
|
||||
|
||||
include("classes/footer.php");
|
||||
?>
|
||||
|
||||
16
lib/.htaccess
Executable file
@@ -0,0 +1,16 @@
|
||||
php_value include_path ".:/var/www"
|
||||
|
||||
# disable directory browsing
|
||||
Options All -Indexes
|
||||
|
||||
ErrorDocument 400 /error/error400.php
|
||||
ErrorDocument 401 /error/error401.php
|
||||
ErrorDocument 403 /error/error403.php
|
||||
ErrorDocument 404 /error/error404.php
|
||||
ErrorDocument 500 /error/error500.php
|
||||
|
||||
#400 - Bad request
|
||||
#401 - Authorization Required
|
||||
#403 - Forbidden directory
|
||||
#404 - Page not found
|
||||
#500 - Internal Server Error
|
||||
BIN
lib/proguard.jar
Executable file
BIN
lib/retrace.jar
Executable file
135
lib/style.css
Executable file
@@ -0,0 +1,135 @@
|
||||
.body {
|
||||
margin:0;
|
||||
padding-left:10%;
|
||||
border:0; /* This removes the border around the viewport in old versions of IE */
|
||||
width:80%;
|
||||
background:#fff;
|
||||
min-width:600px; /* Minimum width of layout - remove line if not required */
|
||||
/* The min-width property does not work in old versions of Internet Explorer */
|
||||
font-size: 16px;
|
||||
}
|
||||
.big{
|
||||
font-size: 250%;
|
||||
}
|
||||
|
||||
.textfield {
|
||||
font-size: 11px;
|
||||
color: #333333;
|
||||
background: #F7F7F7;
|
||||
border: 1px solid #CCCCCC;
|
||||
padding-left: 1px;
|
||||
}
|
||||
h1 {
|
||||
color: #99CC00;
|
||||
margin: 0px 0px 5px;
|
||||
padding: 0px 0px 3px;
|
||||
font: bold 35px Verdana, Arial, Helvetica, sans-serif;
|
||||
border-bottom: 4px dashed #E6E8ED;
|
||||
|
||||
text-shadow: 1px 0px #eee, 0px 1px #ccc,
|
||||
2px 1px #eee, 1px 2px #ccc,
|
||||
3px 2px #eee, 2px 3px #ccc,
|
||||
4px 3px #eee, 3px 4px #ccc,
|
||||
5px 4px #eee, 4px 5px #ccc,
|
||||
6px 5px #eee, 5px 6px #ccc,
|
||||
7px 6px #eee, 6px 7px #ccc,
|
||||
8px 7px #eee, 7px 8px #ccc,
|
||||
8px 8px #eee;
|
||||
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #99CC00;
|
||||
margin: 0px 0px 5px;
|
||||
padding: 0px 0px 3px;
|
||||
font: bold 20px Verdana, Arial, Helvetica, sans-serif;
|
||||
border-bottom: 1px dashed #E6E8ED;
|
||||
}
|
||||
|
||||
b {
|
||||
color:#99CC00;
|
||||
font-size: 18px;
|
||||
}
|
||||
a {
|
||||
color:#99CC00;
|
||||
font-size: 18px;
|
||||
}
|
||||
a:hover {
|
||||
color: #2D3954;
|
||||
}
|
||||
.err {
|
||||
color: #FF9900;
|
||||
}
|
||||
th {
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
}
|
||||
.dim{
|
||||
width:228px;
|
||||
height:228px;
|
||||
}
|
||||
.padding{
|
||||
padding:50px;
|
||||
}
|
||||
footer{
|
||||
clear:both;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
width:98%;
|
||||
}
|
||||
li{
|
||||
display: inline;
|
||||
list-style-type: none;
|
||||
padding-right: 20px;
|
||||
}
|
||||
.post{
|
||||
background-color: #ffffff;
|
||||
border:1px solid #cccccc;
|
||||
padding:10px;
|
||||
-webkit-border-radius: 20px 20px;
|
||||
-moz-box-shadow: 5px 5px 5px #ccc;
|
||||
-webkit-box-shadow: 5px 5px 5px #ccc;
|
||||
box-shadow: 5px 5px 5px #ccc;
|
||||
white-space: pre-wrap; /* css-3 */
|
||||
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
|
||||
white-space: -pre-wrap; /* Opera 4-6 */
|
||||
white-space: -o-pre-wrap; /* Opera 7 */
|
||||
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
||||
}
|
||||
.commentfooter{
|
||||
border-top: 1px dashed #E6E8ED
|
||||
}
|
||||
pre {
|
||||
width: 70%;
|
||||
margin: 5px;
|
||||
white-space: pre-wrap; /* css-3 */
|
||||
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
|
||||
white-space: -pre-wrap; /* Opera 4-6 */
|
||||
white-space: -o-pre-wrap; /* Opera 7 */
|
||||
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
||||
}
|
||||
.codebox {
|
||||
display: block;
|
||||
background: #383838;
|
||||
color: #99CC00;
|
||||
padding: 10px;
|
||||
font-size: 14px;
|
||||
line-height: 15px;
|
||||
-moz-border-radius: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
/*
|
||||
-moz-box-shadow: 0 0 40px #656565;
|
||||
-webkit-box-shadow: 0 0 40px #656565;
|
||||
box-shadow: 0 0 40px #656565;
|
||||
*/
|
||||
|
||||
}
|
||||
.centered {
|
||||
text-align:center;
|
||||
}
|
||||
.search{
|
||||
width:25%;
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
1
lib/version
Executable file
@@ -0,0 +1 @@
|
||||
proguard version 4.6
|
||||
58
login.php
Executable file
@@ -0,0 +1,58 @@
|
||||
<?php
|
||||
session_start();
|
||||
require_once('classes/conf.php');
|
||||
include_once('classes/users.php');
|
||||
if($_SESSION['loggedIn'])
|
||||
header('Location: index.php' ) ;
|
||||
|
||||
$users = new users(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
|
||||
|
||||
if($_POST)
|
||||
if($users->login($_POST['username'], $_POST['password']))
|
||||
header('Location: index.php' ) ;
|
||||
else
|
||||
$failed = true;
|
||||
|
||||
include("classes/header.php");
|
||||
|
||||
if($failed)
|
||||
echo "Please check you Userame / Password";
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript" src="scripts/jquery.js"></script>
|
||||
<script type="text/javascript" src="scripts/jquery.sha256.js"></script>
|
||||
<script type="text/javascript">
|
||||
function readText (form) {
|
||||
form.password.value = $.sha256(form.password.value+form.username.value);
|
||||
}
|
||||
</script>
|
||||
<form id='login' name='login' action='login.php' method='POST' accept-charset='UTF-8'>
|
||||
<fieldset>
|
||||
<legend>Login</legend>
|
||||
<input type='hidden' name='submitted' id='submitted' value='1' />
|
||||
|
||||
<div class="clearfix">
|
||||
<label for='username'>UserName:</label>
|
||||
<div class="input">
|
||||
<input type='text' name='username' id='username' maxlength="50" required />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix">
|
||||
<label for='password'>Password:</label>
|
||||
<div class="input">
|
||||
<input type='password' name='password' id='password' onfocus="this.value = '';" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button type="submit" class="btn primary" onClick="readText(this.form)">Login</button>
|
||||
<button type="reset" class="btn">Cancel</button>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
|
||||
<?php include("classes/footer.php"); ?>
|
||||
5
logout.php
Executable file
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
session_start();
|
||||
session_destroy();
|
||||
header('Location: index.php');
|
||||
?>
|
||||
74
map_manager.php
Executable file
@@ -0,0 +1,74 @@
|
||||
<?php
|
||||
/**
|
||||
Map manager page
|
||||
@author ricky barrette
|
||||
@author Twenty Codes, LLC
|
||||
*/
|
||||
include("classes/auth.php");
|
||||
include("classes/access.php");
|
||||
require_once('classes/conf.php');
|
||||
|
||||
include("classes/header.php");
|
||||
|
||||
echo <<<FORM
|
||||
<html>
|
||||
<body>
|
||||
<form action="upload_file.php" method="post"
|
||||
enctype="multipart/form-data">
|
||||
<label for="package">Package:</label>
|
||||
<br/>
|
||||
<input name="package" id="package" type="text" maxlength="5555500" size=50%/>
|
||||
<br/>
|
||||
<label for="package">Build:</label>
|
||||
<br/>
|
||||
<input name="build" id="build" type="text" maxlength="5555500" size=50%/>
|
||||
<br/>
|
||||
<label for="file">File:</label>
|
||||
<input type="file" name="file" id="file" accept="text/plain" />
|
||||
<br />
|
||||
<input type="submit" name="submit" value="Submit" />
|
||||
</form>
|
||||
</body>
|
||||
</html>
|
||||
FORM;
|
||||
|
||||
/*
|
||||
delete a map if needed
|
||||
*/
|
||||
if($_REQUEST["delete"])
|
||||
if($_REQUEST["delete"] != ".htaccess")
|
||||
if($_REQUEST["delete"] != "style.css"){
|
||||
if(file_exists(MAP_LOCATION. $_REQUEST["delete"]))
|
||||
if(unlink(MAP_LOCATION.$_REQUEST["delete"]))
|
||||
echo "Deteled ". $_REQUEST["delete"] . "<br/><br/>";
|
||||
}
|
||||
|
||||
/*
|
||||
display the maps
|
||||
*/
|
||||
$hasMaps = false;
|
||||
if ($handle = opendir(MAP_LOCATION)) {
|
||||
echo "<b>Existing Maps </b><br/><br/>";
|
||||
/* This is the correct way to loop over the directory. */
|
||||
while (false !== ($file = readdir($handle))) {
|
||||
if($file != ".htaccess")
|
||||
if($file != "style.css")
|
||||
if($file != ".")
|
||||
if($file !=".."){
|
||||
echo <<<MAP
|
||||
<a href="?delete=$file" onclick="return confirm('Are you sure You want to delete this Map forever?');">$file</a>
|
||||
<br/>
|
||||
MAP;
|
||||
$hasMaps = true;
|
||||
}
|
||||
}
|
||||
closedir($handle);
|
||||
|
||||
if(!$hasMaps)
|
||||
echo"<strong>There are no maps yet</strong>";
|
||||
}
|
||||
|
||||
echo "<br/>";
|
||||
|
||||
include("classes/footer.php");
|
||||
?>
|
||||
10
no_access.php
Executable file
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
include("classes/header.php");
|
||||
echo <<<MSG
|
||||
<div align="center">
|
||||
<img src="res/error_icon.png"/> <br/>
|
||||
<b> Sorry you dont have access to this page... <br/> Please contact your system Admin if you require access.</b>
|
||||
</div>
|
||||
MSG;
|
||||
include("classes/footer.php");
|
||||
?>
|
||||
16
res/.htaccess
Executable file
@@ -0,0 +1,16 @@
|
||||
php_value include_path ".:/var/www"
|
||||
|
||||
# disable directory browsing
|
||||
Options All -Indexes
|
||||
|
||||
ErrorDocument 400 /error/error400.php
|
||||
ErrorDocument 401 /error/error401.php
|
||||
ErrorDocument 403 /error/error403.php
|
||||
ErrorDocument 404 /error/error404.php
|
||||
ErrorDocument 500 /error/error500.php
|
||||
|
||||
#400 - Bad request
|
||||
#401 - Authorization Required
|
||||
#403 - Forbidden directory
|
||||
#404 - Page not found
|
||||
#500 - Internal Server Error
|
||||
BIN
res/bullet.gif
Normal file
|
After Width: | Height: | Size: 49 B |
BIN
res/close.gif
Normal file
|
After Width: | Height: | Size: 222 B |
BIN
res/closelabel.gif
Normal file
|
After Width: | Height: | Size: 979 B |
BIN
res/download-icon.gif
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
BIN
res/error_icon.png
Executable file
|
After Width: | Height: | Size: 4.6 KiB |
BIN
res/icon.png
Executable file
|
After Width: | Height: | Size: 3.7 KiB |
BIN
res/loading.gif
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
res/newbutton.png
Executable file
|
After Width: | Height: | Size: 3.5 KiB |
BIN
res/nextlabel.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
res/oldbutton.png
Executable file
|
After Width: | Height: | Size: 3.3 KiB |
BIN
res/prevlabel.gif
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
res/updatedbutton.png
Executable file
|
After Width: | Height: | Size: 3.6 KiB |
16
scripts/.htaccess
Executable file
@@ -0,0 +1,16 @@
|
||||
php_value include_path ".:/var/www"
|
||||
|
||||
# disable directory browsing
|
||||
Options All -Indexes
|
||||
|
||||
ErrorDocument 400 /error/error400.php
|
||||
ErrorDocument 401 /error/error401.php
|
||||
ErrorDocument 403 /error/error403.php
|
||||
ErrorDocument 404 /error/error404.php
|
||||
ErrorDocument 500 /error/error500.php
|
||||
|
||||
#400 - Bad request
|
||||
#401 - Authorization Required
|
||||
#403 - Forbidden directory
|
||||
#404 - Page not found
|
||||
#500 - Internal Server Error
|
||||
136
scripts/builder.js
Normal file
@@ -0,0 +1,136 @@
|
||||
// script.aculo.us builder.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
|
||||
|
||||
// Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||||
//
|
||||
// script.aculo.us is freely distributable under the terms of an MIT-style license.
|
||||
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
||||
|
||||
var Builder = {
|
||||
NODEMAP: {
|
||||
AREA: 'map',
|
||||
CAPTION: 'table',
|
||||
COL: 'table',
|
||||
COLGROUP: 'table',
|
||||
LEGEND: 'fieldset',
|
||||
OPTGROUP: 'select',
|
||||
OPTION: 'select',
|
||||
PARAM: 'object',
|
||||
TBODY: 'table',
|
||||
TD: 'table',
|
||||
TFOOT: 'table',
|
||||
TH: 'table',
|
||||
THEAD: 'table',
|
||||
TR: 'table'
|
||||
},
|
||||
// note: For Firefox < 1.5, OPTION and OPTGROUP tags are currently broken,
|
||||
// due to a Firefox bug
|
||||
node: function(elementName) {
|
||||
elementName = elementName.toUpperCase();
|
||||
|
||||
// try innerHTML approach
|
||||
var parentTag = this.NODEMAP[elementName] || 'div';
|
||||
var parentElement = document.createElement(parentTag);
|
||||
try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
|
||||
parentElement.innerHTML = "<" + elementName + "></" + elementName + ">";
|
||||
} catch(e) {}
|
||||
var element = parentElement.firstChild || null;
|
||||
|
||||
// see if browser added wrapping tags
|
||||
if(element && (element.tagName.toUpperCase() != elementName))
|
||||
element = element.getElementsByTagName(elementName)[0];
|
||||
|
||||
// fallback to createElement approach
|
||||
if(!element) element = document.createElement(elementName);
|
||||
|
||||
// abort if nothing could be created
|
||||
if(!element) return;
|
||||
|
||||
// attributes (or text)
|
||||
if(arguments[1])
|
||||
if(this._isStringOrNumber(arguments[1]) ||
|
||||
(arguments[1] instanceof Array) ||
|
||||
arguments[1].tagName) {
|
||||
this._children(element, arguments[1]);
|
||||
} else {
|
||||
var attrs = this._attributes(arguments[1]);
|
||||
if(attrs.length) {
|
||||
try { // prevent IE "feature": http://dev.rubyonrails.org/ticket/2707
|
||||
parentElement.innerHTML = "<" +elementName + " " +
|
||||
attrs + "></" + elementName + ">";
|
||||
} catch(e) {}
|
||||
element = parentElement.firstChild || null;
|
||||
// workaround firefox 1.0.X bug
|
||||
if(!element) {
|
||||
element = document.createElement(elementName);
|
||||
for(attr in arguments[1])
|
||||
element[attr == 'class' ? 'className' : attr] = arguments[1][attr];
|
||||
}
|
||||
if(element.tagName.toUpperCase() != elementName)
|
||||
element = parentElement.getElementsByTagName(elementName)[0];
|
||||
}
|
||||
}
|
||||
|
||||
// text, or array of children
|
||||
if(arguments[2])
|
||||
this._children(element, arguments[2]);
|
||||
|
||||
return $(element);
|
||||
},
|
||||
_text: function(text) {
|
||||
return document.createTextNode(text);
|
||||
},
|
||||
|
||||
ATTR_MAP: {
|
||||
'className': 'class',
|
||||
'htmlFor': 'for'
|
||||
},
|
||||
|
||||
_attributes: function(attributes) {
|
||||
var attrs = [];
|
||||
for(attribute in attributes)
|
||||
attrs.push((attribute in this.ATTR_MAP ? this.ATTR_MAP[attribute] : attribute) +
|
||||
'="' + attributes[attribute].toString().escapeHTML().gsub(/"/,'"') + '"');
|
||||
return attrs.join(" ");
|
||||
},
|
||||
_children: function(element, children) {
|
||||
if(children.tagName) {
|
||||
element.appendChild(children);
|
||||
return;
|
||||
}
|
||||
if(typeof children=='object') { // array can hold nodes and text
|
||||
children.flatten().each( function(e) {
|
||||
if(typeof e=='object')
|
||||
element.appendChild(e);
|
||||
else
|
||||
if(Builder._isStringOrNumber(e))
|
||||
element.appendChild(Builder._text(e));
|
||||
});
|
||||
} else
|
||||
if(Builder._isStringOrNumber(children))
|
||||
element.appendChild(Builder._text(children));
|
||||
},
|
||||
_isStringOrNumber: function(param) {
|
||||
return(typeof param=='string' || typeof param=='number');
|
||||
},
|
||||
build: function(html) {
|
||||
var element = this.node('div');
|
||||
$(element).update(html.strip());
|
||||
return element.down();
|
||||
},
|
||||
dump: function(scope) {
|
||||
if(typeof scope != 'object' && typeof scope != 'function') scope = window; //global scope
|
||||
|
||||
var tags = ("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY " +
|
||||
"BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET " +
|
||||
"FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+
|
||||
"KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+
|
||||
"PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+
|
||||
"TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);
|
||||
|
||||
tags.each( function(tag){
|
||||
scope[tag] = function() {
|
||||
return Builder.node.apply(Builder, [tag].concat($A(arguments)));
|
||||
};
|
||||
});
|
||||
}
|
||||
};
|
||||
1123
scripts/effects.js
vendored
Normal file
8981
scripts/jquery.js
vendored
Executable file
14
scripts/jquery.sha256.js
Executable file
@@ -0,0 +1,14 @@
|
||||
/**
|
||||
* SHA256 Hash Algorithm Plugin
|
||||
*
|
||||
* @version 1.0 (06/09/2009)
|
||||
* @requires jQuery v1.2.6+
|
||||
* @author Alex Weber <alexweber.com.br>
|
||||
* @copyright Copyright (c) 2008-2009, Alex Weber
|
||||
* @see http://anmar.eu.org/projects/jssha2/
|
||||
* @see http://pajhome.org.uk/crypt/md5
|
||||
*
|
||||
* Distributed under the BSD License
|
||||
*
|
||||
*/
|
||||
(function(f){var m=8;var k=function(q,t){var s=(q&65535)+(t&65535);var r=(q>>16)+(t>>16)+(s>>16);return(r<<16)|(s&65535)};var e=function(r,q){return(r>>>q)|(r<<(32-q))};var g=function(r,q){return(r>>>q)};var a=function(q,s,r){return((q&s)^((~q)&r))};var d=function(q,s,r){return((q&s)^(q&r)^(s&r))};var h=function(q){return(e(q,2)^e(q,13)^e(q,22))};var b=function(q){return(e(q,6)^e(q,11)^e(q,25))};var p=function(q){return(e(q,7)^e(q,18)^g(q,3))};var l=function(q){return(e(q,17)^e(q,19)^g(q,10))};var c=function(r,s){var E=new Array(1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298);var t=new Array(1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225);var q=new Array(64);var G,F,D,C,A,y,x,w,v,u;var B,z;r[s>>5]|=128<<(24-s%32);r[((s+64>>9)<<4)+15]=s;for(var v=0;v<r.length;v+=16){G=t[0];F=t[1];D=t[2];C=t[3];A=t[4];y=t[5];x=t[6];w=t[7];for(var u=0;u<64;u++){if(u<16){q[u]=r[u+v]}else{q[u]=k(k(k(l(q[u-2]),q[u-7]),p(q[u-15])),q[u-16])}B=k(k(k(k(w,b(A)),a(A,y,x)),E[u]),q[u]);z=k(h(G),d(G,F,D));w=x;x=y;y=A;A=k(C,B);C=D;D=F;F=G;G=k(B,z)}t[0]=k(G,t[0]);t[1]=k(F,t[1]);t[2]=k(D,t[2]);t[3]=k(C,t[3]);t[4]=k(A,t[4]);t[5]=k(y,t[5]);t[6]=k(x,t[6]);t[7]=k(w,t[7])}return t};var j=function(t){var s=Array();var q=(1<<m)-1;for(var r=0;r<t.length*m;r+=m){s[r>>5]|=(t.charCodeAt(r/m)&q)<<(24-r%32)}return s};var n=function(s){var r="0123456789abcdef";var t="";for(var q=0;q<s.length*4;q++){t+=r.charAt((s[q>>2]>>((3-q%4)*8+4))&15)+r.charAt((s[q>>2]>>((3-q%4)*8))&15)}return t};var o=function(s,v){var u=j(s);if(u.length>16){u=core_sha1(u,s.length*m)}var q=Array(16),t=Array(16);for(var r=0;r<16;r++){q[r]=u[r]^909522486;t[r]=u[r]^1549556828}var w=c(q.concat(j(v)),512+v.length*m);return c(t.concat(w),512+256)};var i=function(q){q=typeof q=="object"?f(q).val():q.toString();return q};f.extend({sha256:function(q){q=i(q);return n(c(j(q),q.length*m))},sha256hmac:function(q,r){q=i(q);r=i(r);return n(o(q,r))},sha256config:function(q){m=parseInt(q)||8}});f.fn.sha256=function(r){f.sha256config(r);var q=i(f(this).val());var s=f.sha256(q);f.sha256config(8);return s}})(jQuery);
|
||||
497
scripts/lightbox-web.js
Normal file
@@ -0,0 +1,497 @@
|
||||
// -----------------------------------------------------------------------------------
|
||||
//
|
||||
// Lightbox v2.04
|
||||
// by Lokesh Dhakar - http://www.lokeshdhakar.com
|
||||
// Last Modification: 2/9/08
|
||||
//
|
||||
// For more information, visit:
|
||||
// http://lokeshdhakar.com/projects/lightbox2/
|
||||
//
|
||||
// Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
|
||||
// - Free for use in both personal and commercial projects
|
||||
// - Attribution requires leaving author name, author link, and the license info intact.
|
||||
//
|
||||
// Thanks: Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.com), and Thomas Fuchs(mir.aculo.us) for ideas, libs, and snippets.
|
||||
// Artemy Tregubenko (arty.name) for cleanup and help in updating to latest ver of proto-aculous.
|
||||
//
|
||||
// -----------------------------------------------------------------------------------
|
||||
/*
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
Configuration
|
||||
|
||||
Lightbox Class Declaration
|
||||
- initialize()
|
||||
- updateImageList()
|
||||
- start()
|
||||
- changeImage()
|
||||
- resizeImageContainer()
|
||||
- showImage()
|
||||
- updateDetails()
|
||||
- updateNav()
|
||||
- enableKeyboardNav()
|
||||
- disableKeyboardNav()
|
||||
- keyboardAction()
|
||||
- preloadNeighborImages()
|
||||
- end()
|
||||
|
||||
Function Calls
|
||||
- document.observe()
|
||||
|
||||
*/
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Configurationl
|
||||
//
|
||||
LightboxOptions = Object.extend({
|
||||
fileLoadingImage: 'res/loading.gif',
|
||||
fileBottomNavCloseImage: 'res/closelabel.gif',
|
||||
|
||||
overlayOpacity: 0.8, // controls transparency of shadow overlay
|
||||
|
||||
animate: true, // toggles resizing animations
|
||||
resizeSpeed: 7, // controls the speed of the image resizing animations (1=slowest and 10=fastest)
|
||||
|
||||
borderSize: 10, //if you adjust the padding in the CSS, you will need to update this variable
|
||||
|
||||
// When grouping images this is used to write: Image # of #.
|
||||
// Change it for non-english localization
|
||||
labelImage: "Image",
|
||||
labelOf: "of"
|
||||
}, window.LightboxOptions || {});
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
||||
var Lightbox = Class.create();
|
||||
|
||||
Lightbox.prototype = {
|
||||
imageArray: [],
|
||||
activeImage: undefined,
|
||||
|
||||
// initialize()
|
||||
// Constructor runs on completion of the DOM loading. Calls updateImageList and then
|
||||
// the function inserts html at the bottom of the page which is used to display the shadow
|
||||
// overlay and the image container.
|
||||
//
|
||||
initialize: function() {
|
||||
|
||||
this.updateImageList();
|
||||
|
||||
this.keyboardAction = this.keyboardAction.bindAsEventListener(this);
|
||||
|
||||
if (LightboxOptions.resizeSpeed > 10) LightboxOptions.resizeSpeed = 10;
|
||||
if (LightboxOptions.resizeSpeed < 1) LightboxOptions.resizeSpeed = 1;
|
||||
|
||||
this.resizeDuration = LightboxOptions.animate ? ((11 - LightboxOptions.resizeSpeed) * 0.15) : 0;
|
||||
this.overlayDuration = LightboxOptions.animate ? 0.2 : 0; // shadow fade in/out duration
|
||||
|
||||
// When Lightbox starts it will resize itself from 250 by 250 to the current image dimension.
|
||||
// If animations are turned off, it will be hidden as to prevent a flicker of a
|
||||
// white 250 by 250 box.
|
||||
var size = (LightboxOptions.animate ? 250 : 1) + 'px';
|
||||
|
||||
|
||||
// Code inserts html at the bottom of the page that looks similar to this:
|
||||
//
|
||||
// <div id="overlay"></div>
|
||||
// <div id="lightbox">
|
||||
// <div id="outerImageContainer">
|
||||
// <div id="imageContainer">
|
||||
// <img id="lightboxImage">
|
||||
// <div style="" id="hoverNav">
|
||||
// <a href="#" id="prevLink"></a>
|
||||
// <a href="#" id="nextLink"></a>
|
||||
// </div>
|
||||
// <div id="loading">
|
||||
// <a href="#" id="loadingLink">
|
||||
// <img src="res/loading.gif">
|
||||
// </a>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div id="imageDataContainer">
|
||||
// <div id="imageData">
|
||||
// <div id="imageDetails">
|
||||
// <span id="caption"></span>
|
||||
// <span id="numberDisplay"></span>
|
||||
// </div>
|
||||
// <div id="bottomNav">
|
||||
// <a href="#" id="bottomNavClose">
|
||||
// <img src="res/close.gif">
|
||||
// </a>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
|
||||
|
||||
var objBody = $$('body')[0];
|
||||
|
||||
objBody.appendChild(Builder.node('div',{id:'overlay'}));
|
||||
|
||||
objBody.appendChild(Builder.node('div',{id:'lightbox'}, [
|
||||
Builder.node('div',{id:'outerImageContainer'},
|
||||
Builder.node('div',{id:'imageContainer'}, [
|
||||
Builder.node('img',{id:'lightboxImage'}),
|
||||
Builder.node('div',{id:'hoverNav'}, [
|
||||
Builder.node('a',{id:'prevLink', href: '#' }),
|
||||
Builder.node('a',{id:'nextLink', href: '#' })
|
||||
]),
|
||||
Builder.node('div',{id:'loading'},
|
||||
Builder.node('a',{id:'loadingLink', href: '#' },
|
||||
Builder.node('img', {src: LightboxOptions.fileLoadingImage})
|
||||
)
|
||||
)
|
||||
])
|
||||
),
|
||||
Builder.node('div', {id:'imageDataContainer'},
|
||||
Builder.node('div',{id:'imageData'}, [
|
||||
Builder.node('div',{id:'imageDetails'}, [
|
||||
Builder.node('span',{id:'caption'}),
|
||||
Builder.node('span',{id:'numberDisplay'})
|
||||
]),
|
||||
Builder.node('div',{id:'bottomNav'},
|
||||
Builder.node('a',{id:'bottomNavClose', href: '#' },
|
||||
Builder.node('img', { src: LightboxOptions.fileBottomNavCloseImage })
|
||||
)
|
||||
)
|
||||
])
|
||||
)
|
||||
]));
|
||||
|
||||
|
||||
$('overlay').hide().observe('click', (function() { this.end(); }).bind(this));
|
||||
$('lightbox').hide().observe('click', (function(event) { if (event.element().id == 'lightbox') this.end(); }).bind(this));
|
||||
$('outerImageContainer').setStyle({ width: size, height: size });
|
||||
$('prevLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage - 1); }).bindAsEventListener(this));
|
||||
$('nextLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage + 1); }).bindAsEventListener(this));
|
||||
$('loadingLink').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
|
||||
$('bottomNavClose').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
|
||||
|
||||
var th = this;
|
||||
(function(){
|
||||
var ids =
|
||||
'overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink ' +
|
||||
'imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose';
|
||||
$w(ids).each(function(id){ th[id] = $(id); });
|
||||
}).defer();
|
||||
},
|
||||
|
||||
//
|
||||
// updateImageList()
|
||||
// Loops through anchor tags looking for 'lightbox' references and applies onclick
|
||||
// events to appropriate links. You can rerun after dynamically adding images w/ajax.
|
||||
//
|
||||
updateImageList: function() {
|
||||
this.updateImageList = Prototype.emptyFunction;
|
||||
|
||||
document.observe('click', (function(event){
|
||||
var target = event.findElement('a[rel^=lightbox]') || event.findElement('area[rel^=lightbox]');
|
||||
if (target) {
|
||||
event.stop();
|
||||
this.start(target);
|
||||
}
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
//
|
||||
// start()
|
||||
// Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
|
||||
//
|
||||
start: function(imageLink) {
|
||||
|
||||
$$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'hidden' });
|
||||
|
||||
// stretch overlay to fill page and fade in
|
||||
var arrayPageSize = this.getPageSize();
|
||||
$('overlay').setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });
|
||||
|
||||
new Effect.Appear(this.overlay, { duration: this.overlayDuration, from: 0.0, to: LightboxOptions.overlayOpacity });
|
||||
|
||||
this.imageArray = [];
|
||||
var imageNum = 0;
|
||||
|
||||
if ((imageLink.rel == 'lightbox')){
|
||||
// if image is NOT part of a set, add single image to imageArray
|
||||
this.imageArray.push([imageLink.href, imageLink.title]);
|
||||
} else {
|
||||
// if image is part of a set..
|
||||
this.imageArray =
|
||||
$$(imageLink.tagName + '[href][rel="' + imageLink.rel + '"]').
|
||||
collect(function(anchor){ return [anchor.href, anchor.title]; }).
|
||||
uniq();
|
||||
|
||||
while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
|
||||
}
|
||||
|
||||
// calculate top and left offset for the lightbox
|
||||
var arrayPageScroll = document.viewport.getScrollOffsets();
|
||||
var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);
|
||||
var lightboxLeft = arrayPageScroll[0];
|
||||
this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show();
|
||||
|
||||
this.changeImage(imageNum);
|
||||
},
|
||||
|
||||
//
|
||||
// changeImage()
|
||||
// Hide most elements and preload image in preparation for resizing image container.
|
||||
//
|
||||
changeImage: function(imageNum) {
|
||||
|
||||
this.activeImage = imageNum; // update global var
|
||||
|
||||
// hide elements during transition
|
||||
if (LightboxOptions.animate) this.loading.show();
|
||||
this.lightboxImage.hide();
|
||||
this.hoverNav.hide();
|
||||
this.prevLink.hide();
|
||||
this.nextLink.hide();
|
||||
// HACK: Opera9 does not currently support scriptaculous opacity and appear fx
|
||||
this.imageDataContainer.setStyle({opacity: .0001});
|
||||
this.numberDisplay.hide();
|
||||
|
||||
var imgPreloader = new Image();
|
||||
|
||||
// once image is preloaded, resize image container
|
||||
|
||||
|
||||
imgPreloader.onload = (function(){
|
||||
this.lightboxImage.src = this.imageArray[this.activeImage][0];
|
||||
this.resizeImageContainer(imgPreloader.width, imgPreloader.height);
|
||||
}).bind(this);
|
||||
imgPreloader.src = this.imageArray[this.activeImage][0];
|
||||
},
|
||||
|
||||
//
|
||||
// resizeImageContainer()
|
||||
//
|
||||
resizeImageContainer: function(imgWidth, imgHeight) {
|
||||
|
||||
// get current width and height
|
||||
var widthCurrent = this.outerImageContainer.getWidth();
|
||||
var heightCurrent = this.outerImageContainer.getHeight();
|
||||
|
||||
// get new width and height
|
||||
var widthNew = (imgWidth + LightboxOptions.borderSize * 2);
|
||||
var heightNew = (imgHeight + LightboxOptions.borderSize * 2);
|
||||
|
||||
// scalars based on change from old to new
|
||||
var xScale = (widthNew / widthCurrent) * 100;
|
||||
var yScale = (heightNew / heightCurrent) * 100;
|
||||
|
||||
// calculate size difference between new and old image, and resize if necessary
|
||||
var wDiff = widthCurrent - widthNew;
|
||||
var hDiff = heightCurrent - heightNew;
|
||||
|
||||
if (hDiff != 0) new Effect.Scale(this.outerImageContainer, yScale, {scaleX: false, duration: this.resizeDuration, queue: 'front'});
|
||||
if (wDiff != 0) new Effect.Scale(this.outerImageContainer, xScale, {scaleY: false, duration: this.resizeDuration, delay: this.resizeDuration});
|
||||
|
||||
// if new and old image are same size and no scaling transition is necessary,
|
||||
// do a quick pause to prevent image flicker.
|
||||
var timeout = 0;
|
||||
if ((hDiff == 0) && (wDiff == 0)){
|
||||
timeout = 100;
|
||||
if (Prototype.Browser.IE) timeout = 250;
|
||||
}
|
||||
|
||||
(function(){
|
||||
this.prevLink.setStyle({ height: imgHeight + 'px' });
|
||||
this.nextLink.setStyle({ height: imgHeight + 'px' });
|
||||
this.imageDataContainer.setStyle({ width: widthNew + 'px' });
|
||||
|
||||
this.showImage();
|
||||
}).bind(this).delay(timeout / 1000);
|
||||
},
|
||||
|
||||
//
|
||||
// showImage()
|
||||
// Display image and begin preloading neighbors.
|
||||
//
|
||||
showImage: function(){
|
||||
this.loading.hide();
|
||||
new Effect.Appear(this.lightboxImage, {
|
||||
duration: this.resizeDuration,
|
||||
queue: 'end',
|
||||
afterFinish: (function(){ this.updateDetails(); }).bind(this)
|
||||
});
|
||||
this.preloadNeighborImages();
|
||||
},
|
||||
|
||||
//
|
||||
// updateDetails()
|
||||
// Display caption, image number, and bottom nav.
|
||||
//
|
||||
updateDetails: function() {
|
||||
|
||||
// if caption is not null
|
||||
if (this.imageArray[this.activeImage][1] != ""){
|
||||
this.caption.update(this.imageArray[this.activeImage][1]).show();
|
||||
}
|
||||
|
||||
// if image is part of set display 'Image x of x'
|
||||
if (this.imageArray.length > 1){
|
||||
this.numberDisplay.update( LightboxOptions.labelImage + ' ' + (this.activeImage + 1) + ' ' + LightboxOptions.labelOf + ' ' + this.imageArray.length).show();
|
||||
}
|
||||
|
||||
new Effect.Parallel(
|
||||
[
|
||||
new Effect.SlideDown(this.imageDataContainer, { sync: true, duration: this.resizeDuration, from: 0.0, to: 1.0 }),
|
||||
new Effect.Appear(this.imageDataContainer, { sync: true, duration: this.resizeDuration })
|
||||
],
|
||||
{
|
||||
duration: this.resizeDuration,
|
||||
afterFinish: (function() {
|
||||
// update overlay size and update nav
|
||||
var arrayPageSize = this.getPageSize();
|
||||
this.overlay.setStyle({ height: arrayPageSize[1] + 'px' });
|
||||
this.updateNav();
|
||||
}).bind(this)
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
//
|
||||
// updateNav()
|
||||
// Display appropriate previous and next hover navigation.
|
||||
//
|
||||
updateNav: function() {
|
||||
|
||||
this.hoverNav.show();
|
||||
|
||||
// if not first image in set, display prev image button
|
||||
if (this.activeImage > 0) this.prevLink.show();
|
||||
|
||||
// if not last image in set, display next image button
|
||||
if (this.activeImage < (this.imageArray.length - 1)) this.nextLink.show();
|
||||
|
||||
this.enableKeyboardNav();
|
||||
},
|
||||
|
||||
//
|
||||
// enableKeyboardNav()
|
||||
//
|
||||
enableKeyboardNav: function() {
|
||||
document.observe('keydown', this.keyboardAction);
|
||||
},
|
||||
|
||||
//
|
||||
// disableKeyboardNav()
|
||||
//
|
||||
disableKeyboardNav: function() {
|
||||
document.stopObserving('keydown', this.keyboardAction);
|
||||
},
|
||||
|
||||
//
|
||||
// keyboardAction()
|
||||
//
|
||||
keyboardAction: function(event) {
|
||||
var keycode = event.keyCode;
|
||||
|
||||
var escapeKey;
|
||||
if (event.DOM_VK_ESCAPE) { // mozilla
|
||||
escapeKey = event.DOM_VK_ESCAPE;
|
||||
} else { // ie
|
||||
escapeKey = 27;
|
||||
}
|
||||
|
||||
var key = String.fromCharCode(keycode).toLowerCase();
|
||||
|
||||
if (key.match(/x|o|c/) || (keycode == escapeKey)){ // close lightbox
|
||||
this.end();
|
||||
} else if ((key == 'p') || (keycode == 37)){ // display previous image
|
||||
if (this.activeImage != 0){
|
||||
this.disableKeyboardNav();
|
||||
this.changeImage(this.activeImage - 1);
|
||||
}
|
||||
} else if ((key == 'n') || (keycode == 39)){ // display next image
|
||||
if (this.activeImage != (this.imageArray.length - 1)){
|
||||
this.disableKeyboardNav();
|
||||
this.changeImage(this.activeImage + 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// preloadNeighborImages()
|
||||
// Preload previous and next images.
|
||||
//
|
||||
preloadNeighborImages: function(){
|
||||
var preloadNextImage, preloadPrevImage;
|
||||
if (this.imageArray.length > this.activeImage + 1){
|
||||
preloadNextImage = new Image();
|
||||
preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
|
||||
}
|
||||
if (this.activeImage > 0){
|
||||
preloadPrevImage = new Image();
|
||||
preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
//
|
||||
// end()
|
||||
//
|
||||
end: function() {
|
||||
this.disableKeyboardNav();
|
||||
this.lightbox.hide();
|
||||
new Effect.Fade(this.overlay, { duration: this.overlayDuration });
|
||||
$$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'visible' });
|
||||
},
|
||||
|
||||
//
|
||||
// getPageSize()
|
||||
//
|
||||
getPageSize: function() {
|
||||
|
||||
var xScroll, yScroll;
|
||||
|
||||
if (window.innerHeight && window.scrollMaxY) {
|
||||
xScroll = window.innerWidth + window.scrollMaxX;
|
||||
yScroll = window.innerHeight + window.scrollMaxY;
|
||||
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
|
||||
xScroll = document.body.scrollWidth;
|
||||
yScroll = document.body.scrollHeight;
|
||||
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
|
||||
xScroll = document.body.offsetWidth;
|
||||
yScroll = document.body.offsetHeight;
|
||||
}
|
||||
|
||||
var windowWidth, windowHeight;
|
||||
|
||||
if (self.innerHeight) { // all except Explorer
|
||||
if(document.documentElement.clientWidth){
|
||||
windowWidth = document.documentElement.clientWidth;
|
||||
} else {
|
||||
windowWidth = self.innerWidth;
|
||||
}
|
||||
windowHeight = self.innerHeight;
|
||||
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
|
||||
windowWidth = document.documentElement.clientWidth;
|
||||
windowHeight = document.documentElement.clientHeight;
|
||||
} else if (document.body) { // other Explorers
|
||||
windowWidth = document.body.clientWidth;
|
||||
windowHeight = document.body.clientHeight;
|
||||
}
|
||||
|
||||
// for small pages with total height less then height of the viewport
|
||||
if(yScroll < windowHeight){
|
||||
pageHeight = windowHeight;
|
||||
} else {
|
||||
pageHeight = yScroll;
|
||||
}
|
||||
|
||||
// for small pages with total width less then width of the viewport
|
||||
if(xScroll < windowWidth){
|
||||
pageWidth = xScroll;
|
||||
} else {
|
||||
pageWidth = windowWidth;
|
||||
}
|
||||
|
||||
return [pageWidth,pageHeight];
|
||||
}
|
||||
}
|
||||
|
||||
document.observe('dom:loaded', function () { new Lightbox(); });
|
||||
496
scripts/lightbox.js
Normal file
@@ -0,0 +1,496 @@
|
||||
// -----------------------------------------------------------------------------------
|
||||
//
|
||||
// Lightbox v2.05
|
||||
// by Lokesh Dhakar - http://www.lokeshdhakar.com
|
||||
// Last Modification: 3/18/11
|
||||
//
|
||||
// For more information, visit:
|
||||
// http://lokeshdhakar.com/projects/lightbox2/
|
||||
//
|
||||
// Licensed under the Creative Commons Attribution 2.5 License - http://creativecommons.org/licenses/by/2.5/
|
||||
// - Free for use in both personal and commercial projects
|
||||
// - Attribution requires leaving author name, author link, and the license info intact.
|
||||
//
|
||||
// Thanks: Scott Upton(uptonic.com), Peter-Paul Koch(quirksmode.com), and Thomas Fuchs(mir.aculo.us) for ideas, libs, and snippets.
|
||||
// Artemy Tregubenko (arty.name) for cleanup and help in updating to latest ver of proto-aculous.
|
||||
//
|
||||
// -----------------------------------------------------------------------------------
|
||||
/*
|
||||
|
||||
Table of Contents
|
||||
-----------------
|
||||
Configuration
|
||||
|
||||
Lightbox Class Declaration
|
||||
- initialize()
|
||||
- updateImageList()
|
||||
- start()
|
||||
- changeImage()
|
||||
- resizeImageContainer()
|
||||
- showImage()
|
||||
- updateDetails()
|
||||
- updateNav()
|
||||
- enableKeyboardNav()
|
||||
- disableKeyboardNav()
|
||||
- keyboardAction()
|
||||
- preloadNeighborImages()
|
||||
- end()
|
||||
|
||||
Function Calls
|
||||
- document.observe()
|
||||
|
||||
*/
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
||||
//
|
||||
// Configurationl
|
||||
//
|
||||
LightboxOptions = Object.extend({
|
||||
fileLoadingImage: 'res/loading.gif',
|
||||
fileBottomNavCloseImage: 'res/closelabel.gif',
|
||||
|
||||
overlayOpacity: 0.8, // controls transparency of shadow overlay
|
||||
|
||||
animate: true, // toggles resizing animations
|
||||
resizeSpeed: 7, // controls the speed of the image resizing animations (1=slowest and 10=fastest)
|
||||
|
||||
borderSize: 10, //if you adjust the padding in the CSS, you will need to update this variable
|
||||
|
||||
// When grouping images this is used to write: Image # of #.
|
||||
// Change it for non-english localization
|
||||
labelImage: "Image",
|
||||
labelOf: "of"
|
||||
}, window.LightboxOptions || {});
|
||||
|
||||
// -----------------------------------------------------------------------------------
|
||||
|
||||
var Lightbox = Class.create();
|
||||
|
||||
Lightbox.prototype = {
|
||||
imageArray: [],
|
||||
activeImage: undefined,
|
||||
|
||||
// initialize()
|
||||
// Constructor runs on completion of the DOM loading. Calls updateImageList and then
|
||||
// the function inserts html at the bottom of the page which is used to display the shadow
|
||||
// overlay and the image container.
|
||||
//
|
||||
initialize: function() {
|
||||
|
||||
this.updateImageList();
|
||||
|
||||
this.keyboardAction = this.keyboardAction.bindAsEventListener(this);
|
||||
|
||||
if (LightboxOptions.resizeSpeed > 10) LightboxOptions.resizeSpeed = 10;
|
||||
if (LightboxOptions.resizeSpeed < 1) LightboxOptions.resizeSpeed = 1;
|
||||
|
||||
this.resizeDuration = LightboxOptions.animate ? ((11 - LightboxOptions.resizeSpeed) * 0.15) : 0;
|
||||
this.overlayDuration = LightboxOptions.animate ? 0.2 : 0; // shadow fade in/out duration
|
||||
|
||||
// When Lightbox starts it will resize itself from 250 by 250 to the current image dimension.
|
||||
// If animations are turned off, it will be hidden as to prevent a flicker of a
|
||||
// white 250 by 250 box.
|
||||
var size = (LightboxOptions.animate ? 250 : 1) + 'px';
|
||||
|
||||
|
||||
// Code inserts html at the bottom of the page that looks similar to this:
|
||||
//
|
||||
// <div id="overlay"></div>
|
||||
// <div id="lightbox">
|
||||
// <div id="outerImageContainer">
|
||||
// <div id="imageContainer">
|
||||
// <img id="lightboxImage">
|
||||
// <div style="" id="hoverNav">
|
||||
// <a href="#" id="prevLink"></a>
|
||||
// <a href="#" id="nextLink"></a>
|
||||
// </div>
|
||||
// <div id="loading">
|
||||
// <a href="#" id="loadingLink">
|
||||
// <img src="res/loading.gif">
|
||||
// </a>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// <div id="imageDataContainer">
|
||||
// <div id="imageData">
|
||||
// <div id="imageDetails">
|
||||
// <span id="caption"></span>
|
||||
// <span id="numberDisplay"></span>
|
||||
// </div>
|
||||
// <div id="bottomNav">
|
||||
// <a href="#" id="bottomNavClose">
|
||||
// <img src="res/close.gif">
|
||||
// </a>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
// </div>
|
||||
|
||||
|
||||
var objBody = $$('body')[0];
|
||||
|
||||
objBody.appendChild(Builder.node('div',{id:'overlay'}));
|
||||
|
||||
objBody.appendChild(Builder.node('div',{id:'lightbox'}, [
|
||||
Builder.node('div',{id:'outerImageContainer'},
|
||||
Builder.node('div',{id:'imageContainer'}, [
|
||||
Builder.node('img',{id:'lightboxImage'}),
|
||||
Builder.node('div',{id:'hoverNav'}, [
|
||||
Builder.node('a',{id:'prevLink', href: '#' }),
|
||||
Builder.node('a',{id:'nextLink', href: '#' })
|
||||
]),
|
||||
Builder.node('div',{id:'loading'},
|
||||
Builder.node('a',{id:'loadingLink', href: '#' },
|
||||
Builder.node('img', {src: LightboxOptions.fileLoadingImage})
|
||||
)
|
||||
)
|
||||
])
|
||||
),
|
||||
Builder.node('div', {id:'imageDataContainer'},
|
||||
Builder.node('div',{id:'imageData'}, [
|
||||
Builder.node('div',{id:'imageDetails'}, [
|
||||
Builder.node('span',{id:'caption'}),
|
||||
Builder.node('span',{id:'numberDisplay'})
|
||||
]),
|
||||
Builder.node('div',{id:'bottomNav'},
|
||||
Builder.node('a',{id:'bottomNavClose', href: '#' },
|
||||
Builder.node('img', { src: LightboxOptions.fileBottomNavCloseImage })
|
||||
)
|
||||
)
|
||||
])
|
||||
)
|
||||
]));
|
||||
|
||||
|
||||
$('overlay').hide().observe('click', (function() { this.end(); }).bind(this));
|
||||
$('lightbox').hide().observe('click', (function(event) { if (event.element().id == 'lightbox') this.end(); }).bind(this));
|
||||
$('outerImageContainer').setStyle({ width: size, height: size });
|
||||
$('prevLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage - 1); }).bindAsEventListener(this));
|
||||
$('nextLink').observe('click', (function(event) { event.stop(); this.changeImage(this.activeImage + 1); }).bindAsEventListener(this));
|
||||
$('loadingLink').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
|
||||
$('bottomNavClose').observe('click', (function(event) { event.stop(); this.end(); }).bind(this));
|
||||
|
||||
var th = this;
|
||||
(function(){
|
||||
var ids =
|
||||
'overlay lightbox outerImageContainer imageContainer lightboxImage hoverNav prevLink nextLink loading loadingLink ' +
|
||||
'imageDataContainer imageData imageDetails caption numberDisplay bottomNav bottomNavClose';
|
||||
$w(ids).each(function(id){ th[id] = $(id); });
|
||||
}).defer();
|
||||
},
|
||||
|
||||
//
|
||||
// updateImageList()
|
||||
// Loops through anchor tags looking for 'lightbox' references and applies onclick
|
||||
// events to appropriate links. You can rerun after dynamically adding images w/ajax.
|
||||
//
|
||||
updateImageList: function() {
|
||||
this.updateImageList = Prototype.emptyFunction;
|
||||
|
||||
document.observe('click', (function(event){
|
||||
var target = event.findElement('a[rel^=lightbox]') || event.findElement('area[rel^=lightbox]');
|
||||
if (target) {
|
||||
event.stop();
|
||||
this.start(target);
|
||||
}
|
||||
}).bind(this));
|
||||
},
|
||||
|
||||
//
|
||||
// start()
|
||||
// Display overlay and lightbox. If image is part of a set, add siblings to imageArray.
|
||||
//
|
||||
start: function(imageLink) {
|
||||
|
||||
$$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'hidden' });
|
||||
|
||||
// stretch overlay to fill page and fade in
|
||||
var arrayPageSize = this.getPageSize();
|
||||
$('overlay').setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });
|
||||
|
||||
new Effect.Appear(this.overlay, { duration: this.overlayDuration, from: 0.0, to: LightboxOptions.overlayOpacity });
|
||||
|
||||
this.imageArray = [];
|
||||
var imageNum = 0;
|
||||
|
||||
if ((imageLink.getAttribute("rel") == 'lightbox')){
|
||||
// if image is NOT part of a set, add single image to imageArray
|
||||
this.imageArray.push([imageLink.href, imageLink.title]);
|
||||
} else {
|
||||
// if image is part of a set..
|
||||
this.imageArray =
|
||||
$$(imageLink.tagName + '[href][rel="' + imageLink.rel + '"]').
|
||||
collect(function(anchor){ return [anchor.href, anchor.title]; }).
|
||||
uniq();
|
||||
|
||||
while (this.imageArray[imageNum][0] != imageLink.href) { imageNum++; }
|
||||
}
|
||||
|
||||
// calculate top and left offset for the lightbox
|
||||
var arrayPageScroll = document.viewport.getScrollOffsets();
|
||||
var lightboxTop = arrayPageScroll[1] + (document.viewport.getHeight() / 10);
|
||||
var lightboxLeft = arrayPageScroll[0];
|
||||
this.lightbox.setStyle({ top: lightboxTop + 'px', left: lightboxLeft + 'px' }).show();
|
||||
|
||||
this.changeImage(imageNum);
|
||||
},
|
||||
|
||||
//
|
||||
// changeImage()
|
||||
// Hide most elements and preload image in preparation for resizing image container.
|
||||
//
|
||||
changeImage: function(imageNum) {
|
||||
|
||||
this.activeImage = imageNum; // update global var
|
||||
|
||||
// hide elements during transition
|
||||
if (LightboxOptions.animate) this.loading.show();
|
||||
this.lightboxImage.hide();
|
||||
this.hoverNav.hide();
|
||||
this.prevLink.hide();
|
||||
this.nextLink.hide();
|
||||
// HACK: Opera9 does not currently support scriptaculous opacity and appear fx
|
||||
this.imageDataContainer.setStyle({opacity: .0001});
|
||||
this.numberDisplay.hide();
|
||||
|
||||
var imgPreloader = new Image();
|
||||
|
||||
// once image is preloaded, resize image container
|
||||
imgPreloader.onload = (function(){
|
||||
this.lightboxImage.src = this.imageArray[this.activeImage][0];
|
||||
/*Bug Fixed by Andy Scott*/
|
||||
this.lightboxImage.width = imgPreloader.width;
|
||||
this.lightboxImage.height = imgPreloader.height;
|
||||
/*End of Bug Fix*/
|
||||
this.resizeImageContainer(imgPreloader.width, imgPreloader.height);
|
||||
}).bind(this);
|
||||
imgPreloader.src = this.imageArray[this.activeImage][0];
|
||||
},
|
||||
|
||||
//
|
||||
// resizeImageContainer()
|
||||
//
|
||||
resizeImageContainer: function(imgWidth, imgHeight) {
|
||||
|
||||
// get current width and height
|
||||
var widthCurrent = this.outerImageContainer.getWidth();
|
||||
var heightCurrent = this.outerImageContainer.getHeight();
|
||||
|
||||
// get new width and height
|
||||
var widthNew = (imgWidth + LightboxOptions.borderSize * 2);
|
||||
var heightNew = (imgHeight + LightboxOptions.borderSize * 2);
|
||||
|
||||
// scalars based on change from old to new
|
||||
var xScale = (widthNew / widthCurrent) * 100;
|
||||
var yScale = (heightNew / heightCurrent) * 100;
|
||||
|
||||
// calculate size difference between new and old image, and resize if necessary
|
||||
var wDiff = widthCurrent - widthNew;
|
||||
var hDiff = heightCurrent - heightNew;
|
||||
|
||||
if (hDiff != 0) new Effect.Scale(this.outerImageContainer, yScale, {scaleX: false, duration: this.resizeDuration, queue: 'front'});
|
||||
if (wDiff != 0) new Effect.Scale(this.outerImageContainer, xScale, {scaleY: false, duration: this.resizeDuration, delay: this.resizeDuration});
|
||||
|
||||
// if new and old image are same size and no scaling transition is necessary,
|
||||
// do a quick pause to prevent image flicker.
|
||||
var timeout = 0;
|
||||
if ((hDiff == 0) && (wDiff == 0)){
|
||||
timeout = 100;
|
||||
if (Prototype.Browser.IE) timeout = 250;
|
||||
}
|
||||
|
||||
(function(){
|
||||
this.prevLink.setStyle({ height: imgHeight + 'px' });
|
||||
this.nextLink.setStyle({ height: imgHeight + 'px' });
|
||||
this.imageDataContainer.setStyle({ width: widthNew + 'px' });
|
||||
|
||||
this.showImage();
|
||||
}).bind(this).delay(timeout / 1000);
|
||||
},
|
||||
|
||||
//
|
||||
// showImage()
|
||||
// Display image and begin preloading neighbors.
|
||||
//
|
||||
showImage: function(){
|
||||
this.loading.hide();
|
||||
new Effect.Appear(this.lightboxImage, {
|
||||
duration: this.resizeDuration,
|
||||
queue: 'end',
|
||||
afterFinish: (function(){ this.updateDetails(); }).bind(this)
|
||||
});
|
||||
this.preloadNeighborImages();
|
||||
},
|
||||
|
||||
//
|
||||
// updateDetails()
|
||||
// Display caption, image number, and bottom nav.
|
||||
//
|
||||
updateDetails: function() {
|
||||
|
||||
this.caption.update(this.imageArray[this.activeImage][1]).show();
|
||||
|
||||
// if image is part of set display 'Image x of x'
|
||||
if (this.imageArray.length > 1){
|
||||
this.numberDisplay.update( LightboxOptions.labelImage + ' ' + (this.activeImage + 1) + ' ' + LightboxOptions.labelOf + ' ' + this.imageArray.length).show();
|
||||
}
|
||||
|
||||
new Effect.Parallel(
|
||||
[
|
||||
new Effect.SlideDown(this.imageDataContainer, { sync: true, duration: this.resizeDuration, from: 0.0, to: 1.0 }),
|
||||
new Effect.Appear(this.imageDataContainer, { sync: true, duration: this.resizeDuration })
|
||||
],
|
||||
{
|
||||
duration: this.resizeDuration,
|
||||
afterFinish: (function() {
|
||||
// update overlay size and update nav
|
||||
var arrayPageSize = this.getPageSize();
|
||||
this.overlay.setStyle({ width: arrayPageSize[0] + 'px', height: arrayPageSize[1] + 'px' });
|
||||
this.updateNav();
|
||||
}).bind(this)
|
||||
}
|
||||
);
|
||||
},
|
||||
|
||||
//
|
||||
// updateNav()
|
||||
// Display appropriate previous and next hover navigation.
|
||||
//
|
||||
updateNav: function() {
|
||||
|
||||
this.hoverNav.show();
|
||||
|
||||
// if not first image in set, display prev image button
|
||||
if (this.activeImage > 0) this.prevLink.show();
|
||||
|
||||
// if not last image in set, display next image button
|
||||
if (this.activeImage < (this.imageArray.length - 1)) this.nextLink.show();
|
||||
|
||||
this.enableKeyboardNav();
|
||||
},
|
||||
|
||||
//
|
||||
// enableKeyboardNav()
|
||||
//
|
||||
enableKeyboardNav: function() {
|
||||
document.observe('keydown', this.keyboardAction);
|
||||
},
|
||||
|
||||
//
|
||||
// disableKeyboardNav()
|
||||
//
|
||||
disableKeyboardNav: function() {
|
||||
document.stopObserving('keydown', this.keyboardAction);
|
||||
},
|
||||
|
||||
//
|
||||
// keyboardAction()
|
||||
//
|
||||
keyboardAction: function(event) {
|
||||
var keycode = event.keyCode;
|
||||
|
||||
var escapeKey;
|
||||
if (event.DOM_VK_ESCAPE) { // mozilla
|
||||
escapeKey = event.DOM_VK_ESCAPE;
|
||||
} else { // ie
|
||||
escapeKey = 27;
|
||||
}
|
||||
|
||||
var key = String.fromCharCode(keycode).toLowerCase();
|
||||
|
||||
if (key.match(/x|o|c/) || (keycode == escapeKey)){ // close lightbox
|
||||
this.end();
|
||||
} else if ((key == 'p') || (keycode == 37)){ // display previous image
|
||||
if (this.activeImage != 0){
|
||||
this.disableKeyboardNav();
|
||||
this.changeImage(this.activeImage - 1);
|
||||
}
|
||||
} else if ((key == 'n') || (keycode == 39)){ // display next image
|
||||
if (this.activeImage != (this.imageArray.length - 1)){
|
||||
this.disableKeyboardNav();
|
||||
this.changeImage(this.activeImage + 1);
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
//
|
||||
// preloadNeighborImages()
|
||||
// Preload previous and next images.
|
||||
//
|
||||
preloadNeighborImages: function(){
|
||||
var preloadNextImage, preloadPrevImage;
|
||||
if (this.imageArray.length > this.activeImage + 1){
|
||||
preloadNextImage = new Image();
|
||||
preloadNextImage.src = this.imageArray[this.activeImage + 1][0];
|
||||
}
|
||||
if (this.activeImage > 0){
|
||||
preloadPrevImage = new Image();
|
||||
preloadPrevImage.src = this.imageArray[this.activeImage - 1][0];
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
//
|
||||
// end()
|
||||
//
|
||||
end: function() {
|
||||
this.disableKeyboardNav();
|
||||
this.lightbox.hide();
|
||||
new Effect.Fade(this.overlay, { duration: this.overlayDuration });
|
||||
$$('select', 'object', 'embed').each(function(node){ node.style.visibility = 'visible' });
|
||||
},
|
||||
|
||||
//
|
||||
// getPageSize()
|
||||
//
|
||||
getPageSize: function() {
|
||||
|
||||
var xScroll, yScroll;
|
||||
|
||||
if (window.innerHeight && window.scrollMaxY) {
|
||||
xScroll = window.innerWidth + window.scrollMaxX;
|
||||
yScroll = window.innerHeight + window.scrollMaxY;
|
||||
} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
|
||||
xScroll = document.body.scrollWidth;
|
||||
yScroll = document.body.scrollHeight;
|
||||
} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
|
||||
xScroll = document.body.offsetWidth;
|
||||
yScroll = document.body.offsetHeight;
|
||||
}
|
||||
|
||||
var windowWidth, windowHeight;
|
||||
|
||||
if (self.innerHeight) { // all except Explorer
|
||||
if(document.documentElement.clientWidth){
|
||||
windowWidth = document.documentElement.clientWidth;
|
||||
} else {
|
||||
windowWidth = self.innerWidth;
|
||||
}
|
||||
windowHeight = self.innerHeight;
|
||||
} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
|
||||
windowWidth = document.documentElement.clientWidth;
|
||||
windowHeight = document.documentElement.clientHeight;
|
||||
} else if (document.body) { // other Explorers
|
||||
windowWidth = document.body.clientWidth;
|
||||
windowHeight = document.body.clientHeight;
|
||||
}
|
||||
|
||||
// for small pages with total height less then height of the viewport
|
||||
if(yScroll < windowHeight){
|
||||
pageHeight = windowHeight;
|
||||
} else {
|
||||
pageHeight = yScroll;
|
||||
}
|
||||
|
||||
// for small pages with total width less then width of the viewport
|
||||
if(xScroll < windowWidth){
|
||||
pageWidth = xScroll;
|
||||
} else {
|
||||
pageWidth = windowWidth;
|
||||
}
|
||||
|
||||
return [pageWidth,pageHeight];
|
||||
}
|
||||
}
|
||||
|
||||
document.observe('dom:loaded', function () { new Lightbox(); });
|
||||
6081
scripts/prototype.js
vendored
Normal file
68
scripts/scriptaculous.js
Normal file
@@ -0,0 +1,68 @@
|
||||
// script.aculo.us scriptaculous.js v1.9.0, Thu Dec 23 16:54:48 -0500 2010
|
||||
|
||||
// Copyright (c) 2005-2010 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us)
|
||||
//
|
||||
// Permission is hereby granted, free of charge, to any person obtaining
|
||||
// a copy of this software and associated documentation files (the
|
||||
// "Software"), to deal in the Software without restriction, including
|
||||
// without limitation the rights to use, copy, modify, merge, publish,
|
||||
// distribute, sublicense, and/or sell copies of the Software, and to
|
||||
// permit persons to whom the Software is furnished to do so, subject to
|
||||
// the following conditions:
|
||||
//
|
||||
// The above copyright notice and this permission notice shall be
|
||||
// included in all copies or substantial portions of the Software.
|
||||
//
|
||||
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
// For details, see the script.aculo.us web site: http://script.aculo.us/
|
||||
|
||||
var Scriptaculous = {
|
||||
Version: '1.9.0',
|
||||
require: function(libraryName) {
|
||||
try{
|
||||
// inserting via DOM fails in Safari 2.0, so brute force approach
|
||||
document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');
|
||||
} catch(e) {
|
||||
// for xhtml+xml served content, fall back to DOM methods
|
||||
var script = document.createElement('script');
|
||||
script.type = 'text/javascript';
|
||||
script.src = libraryName;
|
||||
document.getElementsByTagName('head')[0].appendChild(script);
|
||||
}
|
||||
},
|
||||
REQUIRED_PROTOTYPE: '1.6.0.3',
|
||||
load: function() {
|
||||
function convertVersionString(versionString) {
|
||||
var v = versionString.replace(/_.*|\./g, '');
|
||||
v = parseInt(v + '0'.times(4-v.length));
|
||||
return versionString.indexOf('_') > -1 ? v-1 : v;
|
||||
}
|
||||
|
||||
if((typeof Prototype=='undefined') ||
|
||||
(typeof Element == 'undefined') ||
|
||||
(typeof Element.Methods=='undefined') ||
|
||||
(convertVersionString(Prototype.Version) <
|
||||
convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
|
||||
throw("script.aculo.us requires the Prototype JavaScript framework >= " +
|
||||
Scriptaculous.REQUIRED_PROTOTYPE);
|
||||
|
||||
var js = /scriptaculous\.js(\?.*)?$/;
|
||||
$$('script[src]').findAll(function(s) {
|
||||
return s.src.match(js);
|
||||
}).each(function(s) {
|
||||
var path = s.src.replace(js, ''),
|
||||
includes = s.src.match(/\?.*load=([a-z,]*)/);
|
||||
(includes ? includes[1] : 'builder,effects,dragdrop,controls,slider,sound').split(',').each(
|
||||
function(include) { Scriptaculous.require(path+include+'.js') });
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
Scriptaculous.load();
|
||||
16
tmp/.htaccess
Executable file
@@ -0,0 +1,16 @@
|
||||
php_value include_path ".:/var/www"
|
||||
|
||||
# disable directory browsing
|
||||
Options All -Indexes
|
||||
|
||||
ErrorDocument 400 /error/error400.php
|
||||
ErrorDocument 401 /error/error401.php
|
||||
ErrorDocument 403 /error/error403.php
|
||||
ErrorDocument 404 /error/error404.php
|
||||
ErrorDocument 500 /error/error500.php
|
||||
|
||||
#400 - Bad request
|
||||
#401 - Authorization Required
|
||||
#403 - Forbidden directory
|
||||
#404 - Page not found
|
||||
#500 - Internal Server Error
|
||||
11
tmp/email
Executable file
@@ -0,0 +1,11 @@
|
||||
To: arsenickiss7891@gmail.com
|
||||
From: Exception Handler
|
||||
Subject: NEW exception report for com.test 1.0b1
|
||||
|
||||
com.test 1.0b1 has generated the following exception:
|
||||
|
||||
THIS IS A TEST
|
||||
|
||||
http://powers.doesntexist.com:666/index.php?report=3
|
||||
|
||||
This email was generated by your Exception Handler.
|
||||
135
tmp/style.css
Executable file
@@ -0,0 +1,135 @@
|
||||
.body {
|
||||
margin:0;
|
||||
padding-left:10%;
|
||||
border:0; /* This removes the border around the viewport in old versions of IE */
|
||||
width:80%;
|
||||
background:#fff;
|
||||
min-width:600px; /* Minimum width of layout - remove line if not required */
|
||||
/* The min-width property does not work in old versions of Internet Explorer */
|
||||
font-size: 16px;
|
||||
}
|
||||
.big{
|
||||
font-size: 250%;
|
||||
}
|
||||
|
||||
.textfield {
|
||||
font-size: 11px;
|
||||
color: #333333;
|
||||
background: #F7F7F7;
|
||||
border: 1px solid #CCCCCC;
|
||||
padding-left: 1px;
|
||||
}
|
||||
h1 {
|
||||
color: #99CC00;
|
||||
margin: 0px 0px 5px;
|
||||
padding: 0px 0px 3px;
|
||||
font: bold 35px Verdana, Arial, Helvetica, sans-serif;
|
||||
border-bottom: 4px dashed #E6E8ED;
|
||||
|
||||
text-shadow: 1px 0px #eee, 0px 1px #ccc,
|
||||
2px 1px #eee, 1px 2px #ccc,
|
||||
3px 2px #eee, 2px 3px #ccc,
|
||||
4px 3px #eee, 3px 4px #ccc,
|
||||
5px 4px #eee, 4px 5px #ccc,
|
||||
6px 5px #eee, 5px 6px #ccc,
|
||||
7px 6px #eee, 6px 7px #ccc,
|
||||
8px 7px #eee, 7px 8px #ccc,
|
||||
8px 8px #eee;
|
||||
|
||||
}
|
||||
|
||||
h2 {
|
||||
color: #99CC00;
|
||||
margin: 0px 0px 5px;
|
||||
padding: 0px 0px 3px;
|
||||
font: bold 20px Verdana, Arial, Helvetica, sans-serif;
|
||||
border-bottom: 1px dashed #E6E8ED;
|
||||
}
|
||||
|
||||
b {
|
||||
color:#99CC00;
|
||||
font-size: 18px;
|
||||
}
|
||||
a {
|
||||
color:#99CC00;
|
||||
font-size: 18px;
|
||||
}
|
||||
a:hover {
|
||||
color: #2D3954;
|
||||
}
|
||||
.err {
|
||||
color: #FF9900;
|
||||
}
|
||||
th {
|
||||
font-weight: bold;
|
||||
text-align: left;
|
||||
}
|
||||
.dim{
|
||||
width:228px;
|
||||
height:228px;
|
||||
}
|
||||
.padding{
|
||||
padding:50px;
|
||||
}
|
||||
footer{
|
||||
clear:both;
|
||||
margin: 0 auto;
|
||||
position: relative;
|
||||
width:98%;
|
||||
}
|
||||
li{
|
||||
display: inline;
|
||||
list-style-type: none;
|
||||
padding-right: 20px;
|
||||
}
|
||||
.post{
|
||||
background-color: #ffffff;
|
||||
border:1px solid #cccccc;
|
||||
padding:10px;
|
||||
-webkit-border-radius: 20px 20px;
|
||||
-moz-box-shadow: 5px 5px 5px #ccc;
|
||||
-webkit-box-shadow: 5px 5px 5px #ccc;
|
||||
box-shadow: 5px 5px 5px #ccc;
|
||||
white-space: pre-wrap; /* css-3 */
|
||||
white-space: -moz-pre-wrap; /* Mozilla, since 1999 */
|
||||
white-space: -pre-wrap; /* Opera 4-6 */
|
||||
white-space: -o-pre-wrap; /* Opera 7 */
|
||||
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
||||
}
|
||||
.commentfooter{
|
||||
border-top: 1px dashed #E6E8ED
|
||||
}
|
||||
pre {
|
||||
width: 70%;
|
||||
margin: 5px;
|
||||
white-space: pre-wrap; /* css-3 */
|
||||
white-space: -moz-pre-wrap !important; /* Mozilla, since 1999 */
|
||||
white-space: -pre-wrap; /* Opera 4-6 */
|
||||
white-space: -o-pre-wrap; /* Opera 7 */
|
||||
word-wrap: break-word; /* Internet Explorer 5.5+ */
|
||||
}
|
||||
.codebox {
|
||||
display: block;
|
||||
background: #383838;
|
||||
color: #99CC00;
|
||||
padding: 10px;
|
||||
font-size: 14px;
|
||||
line-height: 15px;
|
||||
-moz-border-radius: 10px;
|
||||
-webkit-border-radius: 10px;
|
||||
border-radius: 10px;
|
||||
/*
|
||||
-moz-box-shadow: 0 0 40px #656565;
|
||||
-webkit-box-shadow: 0 0 40px #656565;
|
||||
box-shadow: 0 0 40px #656565;
|
||||
*/
|
||||
|
||||
}
|
||||
.centered {
|
||||
text-align:center;
|
||||
}
|
||||
.search{
|
||||
width:25%;
|
||||
text-align:right;
|
||||
}
|
||||
|
||||
27
upload_file.php
Executable file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
require_once('classes/conf.php');
|
||||
include("classes/header.php");
|
||||
|
||||
if ($_FILES["file"]["type"] == 'text/plain'){
|
||||
|
||||
if ($_FILES["file"]["error"] > 0)
|
||||
{
|
||||
echo "Return Code: " . $_FILES["file"]["error"] . "<br />";
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Upload: " . $_FILES["file"]["name"] . "<br />";
|
||||
echo "Type: " . $_FILES["file"]["type"] . "<br />";
|
||||
echo "Size: " . ($_FILES["file"]["size"] / 1024) . " Kb<br />";
|
||||
move_uploaded_file($_FILES["file"]["tmp_name"],
|
||||
MAP_LOCATION . $_FILES["file"]["name"]);
|
||||
rename(MAP_LOCATION . $_FILES["file"]["name"], MAP_LOCATION . strip_tags($_POST["package"]) . strip_tags($_POST["build"]));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
echo "Invalid file";
|
||||
}
|
||||
include("classes/footer.php");
|
||||
?>
|
||||
161
uploader/class.FlashUploader.php
Executable file
@@ -0,0 +1,161 @@
|
||||
<?php
|
||||
/*********************************************************************************************
|
||||
FUNCTION IAF_display_js
|
||||
Parameters: None
|
||||
Description: Displays the javascript which controls the resizing of the uploader
|
||||
Alias: IFU_display_js
|
||||
*********************************************************************************************/
|
||||
function IAF_display_js() {
|
||||
ob_start(); ?>
|
||||
<script type="text/javascript">
|
||||
function flashResize(ele, height, width) {
|
||||
var uploader = document.getElementById(ele);
|
||||
|
||||
if(height != 0)
|
||||
uploader.style.height = height+"px";
|
||||
|
||||
if(width != 0)
|
||||
uploader.style.width = width+"px";
|
||||
}
|
||||
|
||||
function canResizeFlash(){
|
||||
var ua = navigator.userAgent.toLowerCase();
|
||||
var opera = ua.indexOf("opera");
|
||||
|
||||
if( document.getElementById ) {
|
||||
if(opera == -1) return true;
|
||||
else if(parseInt(ua.substr(opera+6, 1)) >= 7) return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
e = canResizeFlash();
|
||||
</script>
|
||||
<?php
|
||||
$js = ob_get_contents(); ob_end_clean();
|
||||
|
||||
echo $js;
|
||||
}
|
||||
function IFU_display_js() { IAF_display_js(); }
|
||||
|
||||
/*********************************************************************************************
|
||||
CLASS FlashUploader
|
||||
Parameters: None
|
||||
Description: Class that controls and displays the In-a-Flash Uploader
|
||||
*********************************************************************************************/
|
||||
class FlashUploader {
|
||||
var $element_id;
|
||||
var $swf_name;
|
||||
var $target;
|
||||
|
||||
var $pass_vars;
|
||||
var $properties;
|
||||
|
||||
|
||||
/*********************************************************************************************
|
||||
FUNCTION FlashUploader (Constructor)
|
||||
Parameters:
|
||||
$element_id - the name of the div containing the uploader
|
||||
$swf_name - the name of the swf file (usually uploader/uploader.swf)
|
||||
$target - the path to the PHP file that handles the upload (usually uploader/uploader.php)
|
||||
Description: Creates the FlashUploader object
|
||||
*********************************************************************************************/
|
||||
function FlashUploader($element_id, $swf_path, $target) {
|
||||
$this->element_id = $element_id;
|
||||
$this->swf_name = $swf_path;
|
||||
$this->target = $target;
|
||||
|
||||
$this->pass_vars = array();
|
||||
$this->properties = array(
|
||||
'bg_color' => '0xFFFFFF',
|
||||
'set_width' => 415,
|
||||
'set_height' => 54,
|
||||
'valid_extensions' => '*.jpg,*.pdf',
|
||||
'extensions_mod' => '*.jpg;*.pdf'
|
||||
);
|
||||
|
||||
//valid properties: max_file_size, max_files, callback, style, valid_extensions, click_text, uploading_text, complete_text, pending_text, max_text, auto_clear, allow_clear, allow_cancel, set_width, set_height, bg_color, bar_bg_color, divider_color, button_title_color, button_color, button_shadow, txt_title_color, txt_filename_color, txt_percent_color, txt_progress_color
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************
|
||||
FUNCTION set
|
||||
Parameters:
|
||||
$property - the name of the property
|
||||
$value - the desired value of the property
|
||||
Description: Creates the FlashUploader object
|
||||
*********************************************************************************************/
|
||||
function set($property, $value) {
|
||||
$this->properties[$property] = $value;
|
||||
|
||||
if($property == 'valid_extensions')
|
||||
$this->properties['extensions_mod'] = implode(';', explode(',', $this->properties['valid_extensions']));
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************
|
||||
FUNCTION pass_var
|
||||
Parameters:
|
||||
$name - the name of the variable to pass
|
||||
$value - the desired value of the variable
|
||||
Description: Creates a variable to pass to the PHP upload file ($target) via GET
|
||||
*********************************************************************************************/
|
||||
function pass_var($name, $value) {
|
||||
$this->pass_vars[$name] = $value;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************
|
||||
FUNCTION property_str
|
||||
Parameters: None
|
||||
Description: Generates the string of property values to be passed to the uploader
|
||||
*********************************************************************************************/
|
||||
function property_str() {
|
||||
$string = '&';
|
||||
|
||||
foreach($this->properties as $i=>$p)
|
||||
$string .= $i.'='.$p.'&';
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************
|
||||
FUNCTION var_string
|
||||
Parameters: None
|
||||
Description: Generates the string of variables to be passed to the PHP upload file ($target) via GET
|
||||
*********************************************************************************************/
|
||||
function var_string() {
|
||||
$string = 'vars=';
|
||||
|
||||
foreach($this->pass_vars as $index=>$pv)
|
||||
$string .= $index.'*!#'.$pv.'#!*';
|
||||
|
||||
return $string;
|
||||
}
|
||||
|
||||
|
||||
/*********************************************************************************************
|
||||
FUNCTION display
|
||||
Parameters: None
|
||||
Description: Displays the FlashUploader
|
||||
*********************************************************************************************/
|
||||
function display() {
|
||||
ob_start(); ?>
|
||||
<div id="<?php echo $this->element_id?>" style="width: <?php echo $this->properties['set_width']?>px; height: <?php echo $this->properties['set_height']?>px;">
|
||||
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" data="<?php echo $this->swf_name?>.swf" width="100%" height="100%" type="application/x-shockwave-flash"><param name="allowScriptAccess" value="sameDomain" />
|
||||
<param name="movie" value="<?php echo $this->swf_name?>.swf" />
|
||||
<param name="quality" value="high" />
|
||||
<param name="bgcolor" value="#<?php echo substr($this->properties['bg_color'], 2)?>" />
|
||||
<param name="FlashVars" value="allowResize='+e+'&element_id=<?php echo $this->element_id; ?>&target=<?php echo $this->target; ?><?php echo $this->property_str();?><?php echo $this->var_string();?>" />
|
||||
<embed src="<?php echo $this->swf_name?>.swf" FlashVars="allowResize='+e+'&element_id=<?php echo $this->element_id; ?>&target=<?php echo $this->target; ?><?php echo $this->property_str();?><?php echo $this->var_string();?>" quality="high" bgcolor="#<?php echo substr($this->properties['bg_color'], 2)?>" width="100%" height="100%" name="<?php echo $this->element_id?>" align="top" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
|
||||
</object>
|
||||
</div>
|
||||
<?php
|
||||
|
||||
$display = ob_get_contents(); ob_end_clean();
|
||||
echo $display;
|
||||
}
|
||||
}
|
||||
?>
|
||||
BIN
uploader/uploader.swf
Normal file
155
user_manager.php
Executable file
@@ -0,0 +1,155 @@
|
||||
<?php
|
||||
/**
|
||||
User manager page
|
||||
@author ricky barrette
|
||||
@author Twenty Codes, LLC
|
||||
*/
|
||||
include("classes/auth.php");
|
||||
require_once('classes/conf.php');
|
||||
include_once('classes/users.php');
|
||||
include("classes/header.php");
|
||||
$users = new users(DB_HOST, DB_USER, DB_PASSWORD, DB_DATABASE);
|
||||
|
||||
$user = $_SESSION['username'];
|
||||
|
||||
|
||||
if($_POST['submitted'] == 1){
|
||||
$users->new_user($_POST['username'], $_POST['password'], $_POST['access'], $_POST['email']);
|
||||
echo "Added new user ". $_POST['username'];
|
||||
}
|
||||
|
||||
if($_POST['submitted'] == 2){
|
||||
if($users->change_password($_POST['username'], $_POST['old_password'], $_POST['new_password']))
|
||||
echo "Changed ". $_POST['username'] ."'s Password.";
|
||||
else
|
||||
echo"Failed to change password, check Username and Password";
|
||||
}
|
||||
|
||||
if($_REQUEST['user'])
|
||||
if($_REQUEST['email']){
|
||||
$users->delete_user($_REQUEST['user'], $_REQUEST['email']);
|
||||
echo "Deleted ".$_REQUEST['user'];
|
||||
}
|
||||
|
||||
|
||||
echo <<<SCRIPTS
|
||||
<script type="text/javascript" src="scripts/jquery.js"></script>
|
||||
<script type="text/javascript" src="scripts/jquery.sha256.js"></script>
|
||||
<script type="text/javascript">
|
||||
function addUser (form) {
|
||||
form.password.value = $.sha256(form.password.value+form.username.value);
|
||||
form.submit();
|
||||
}
|
||||
|
||||
function changePass (form) {
|
||||
form.old_password.value = $.sha256(form.old_password.value+form.username.value);
|
||||
form.new_password.value = $.sha256(form.new_password.value+form.username.value);
|
||||
form.submit();
|
||||
}
|
||||
</script>
|
||||
SCRIPTS;
|
||||
|
||||
/**
|
||||
Everythign inside this ifblock requires admin access
|
||||
*/
|
||||
if($_SESSION['access'] == "admin") {
|
||||
|
||||
echo "<a href=\"content_manager.php?pagekey=new_user_email\">Edit New User Email</a>";
|
||||
|
||||
echo $users->display_users();
|
||||
echo <<<ADD_USER
|
||||
<br/>
|
||||
|
||||
<form id='add_user' name='add_user' action='user_manager.php' method='POST' accept-charset='UTF-8'>
|
||||
<fieldset >
|
||||
<legend>Add User</legend>
|
||||
<input type='hidden' name='submitted' id='submitted' value='1'/>
|
||||
|
||||
<div class="clearfix">
|
||||
<label for='username' >UserName:</label>
|
||||
<div class="input">
|
||||
<input type='text' name='username' id='username' maxlength="50" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="clearfix">
|
||||
<label for='password' >Password:</label>
|
||||
<div class="input">
|
||||
<input type='password' name='password' id='password' maxlength="50" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix">
|
||||
<label for='access' >Access:</label>
|
||||
<div class="input">
|
||||
<input type='text' name='access' id='access' maxlength="50" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix">
|
||||
<label for='email' >Email:</label>
|
||||
<div class="input">
|
||||
<input type='text' name='email' id='email' maxlength="50" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button type="submit" class="btn primary" onClick="addUser(this.form)" >Add User</button>
|
||||
<button type="reset" class="btn">Cancel</button>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
ADD_USER;
|
||||
}
|
||||
|
||||
|
||||
echo <<<CHANGE_PASS
|
||||
<form action='user_manager.php' method='POST' accept-charset='UTF-8'>
|
||||
<fieldset >
|
||||
<legend>Change Password</legend>
|
||||
<input type='hidden' name='submitted' id='submitted' value='2'/>
|
||||
|
||||
CHANGE_PASS;
|
||||
|
||||
|
||||
if($_SESSION['access'] == "admin")
|
||||
echo <<<CHANGE_PASS
|
||||
<div class="clearfix">
|
||||
<label for='username' >UserName:</label>
|
||||
<div class="input">
|
||||
<input type='text' name='username' id='username' maxlength="50" value="$user"/>
|
||||
</div>
|
||||
</div>
|
||||
CHANGE_PASS;
|
||||
else
|
||||
echo "<input type='hidden' name='username' id='username' value='$user'/>";
|
||||
|
||||
|
||||
echo <<<CHANGE_PASS
|
||||
<div class="clearfix">
|
||||
<label for='password' >Old Password:</label>
|
||||
<div class="input">
|
||||
<input type='password' name='old_password' id='old_password' maxlength="50" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="clearfix">
|
||||
<label for='password' >New Password:</label>
|
||||
<div class="input">
|
||||
<input type='password' name='new_password' id='new_password' maxlength="50" />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button type="submit" class="btn primary" onClick="changePass(this.form)" >Change Password</button>
|
||||
<button type="reset" class="btn">Cancel</button>
|
||||
</div>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
CHANGE_PASS;
|
||||
|
||||
include("classes/footer.php");
|
||||
?>
|
||||