From 70806096b6797e147a6127fd50c4d9048f66a8d2 Mon Sep 17 00:00:00 2001
From: Ricky Barrette
Date: Sun, 5 Feb 2012 16:40:26 -0500
Subject: [PATCH] Initial commit Change-Id:
I0000000000000000000000000000000000000000
---
README | 5 +
classes/access.php | 11 +
classes/auth.php | 11 +
classes/blog.php | 177 +
classes/comments.php | 187 +
classes/conf.php | 11 +
classes/content.php | 211 +
classes/email.php | 34 +
classes/exceptionReports.php | 342 ++
classes/footer.php | 29 +
classes/guest.php | 153 +
classes/header.php | 37 +
classes/navigation_bar.php | 43 +
classes/pager.php | 120 +
classes/threads.php | 165 +
classes/thumbnail.php | 75 +
classes/thumbnails.php | 44 +
classes/users.php | 195 +
content_manager.php | 25 +
css/prettify.css | 41 +
css/screen.css | 1870 +++++++
error/.htaccess | 16 +
error/.htaccess~ | 16 +
error/404_error_icon.png | Bin 0 -> 121060 bytes
error/500_error_icon.png | Bin 0 -> 218814 bytes
error/error400.php | 22 +
error/error401.php | 22 +
error/error403.php | 22 +
error/error404.php | 22 +
error/error500.php | 24 +
error/error_header.php | 18 +
error/error_icon.png | Bin 0 -> 4675 bytes
error/style.css | 135 +
forum.php | 56 +
index.php | 86 +
lib/.htaccess | 16 +
lib/proguard.jar | Bin 0 -> 686067 bytes
lib/retrace.jar | Bin 0 -> 6894 bytes
lib/style.css | 135 +
lib/version | 1 +
login.php | 58 +
logout.php | 5 +
map_manager.php | 74 +
no_access.php | 10 +
res/.htaccess | 16 +
res/bullet.gif | Bin 0 -> 49 bytes
res/close.gif | Bin 0 -> 222 bytes
res/closelabel.gif | Bin 0 -> 979 bytes
res/download-icon.gif | Bin 0 -> 1151 bytes
res/error_icon.png | Bin 0 -> 4675 bytes
res/icon.png | Bin 0 -> 3808 bytes
res/loading.gif | Bin 0 -> 2767 bytes
res/newbutton.png | Bin 0 -> 3632 bytes
res/nextlabel.gif | Bin 0 -> 1252 bytes
res/oldbutton.png | Bin 0 -> 3415 bytes
res/prevlabel.gif | Bin 0 -> 1264 bytes
res/updatedbutton.png | Bin 0 -> 3666 bytes
scripts/.htaccess | 16 +
scripts/builder.js | 136 +
scripts/effects.js | 1123 ++++
scripts/jquery.js | 8981 ++++++++++++++++++++++++++++++
scripts/jquery.sha256.js | 14 +
scripts/lightbox-web.js | 497 ++
scripts/lightbox.js | 496 ++
scripts/prototype.js | 6081 ++++++++++++++++++++
scripts/scriptaculous.js | 68 +
tmp/.htaccess | 16 +
tmp/email | 11 +
tmp/style.css | 135 +
upload_file.php | 27 +
uploader/class.FlashUploader.php | 161 +
uploader/uploader.swf | Bin 0 -> 16908 bytes
user_manager.php | 155 +
73 files changed, 22457 insertions(+)
create mode 100755 README
create mode 100755 classes/access.php
create mode 100755 classes/auth.php
create mode 100755 classes/blog.php
create mode 100755 classes/comments.php
create mode 100755 classes/conf.php
create mode 100644 classes/content.php
create mode 100755 classes/email.php
create mode 100755 classes/exceptionReports.php
create mode 100755 classes/footer.php
create mode 100755 classes/guest.php
create mode 100755 classes/header.php
create mode 100755 classes/navigation_bar.php
create mode 100755 classes/pager.php
create mode 100755 classes/threads.php
create mode 100755 classes/thumbnail.php
create mode 100755 classes/thumbnails.php
create mode 100755 classes/users.php
create mode 100644 content_manager.php
create mode 100755 css/prettify.css
create mode 100755 css/screen.css
create mode 100755 error/.htaccess
create mode 100755 error/.htaccess~
create mode 100755 error/404_error_icon.png
create mode 100755 error/500_error_icon.png
create mode 100755 error/error400.php
create mode 100755 error/error401.php
create mode 100755 error/error403.php
create mode 100755 error/error404.php
create mode 100755 error/error500.php
create mode 100755 error/error_header.php
create mode 100755 error/error_icon.png
create mode 100755 error/style.css
create mode 100755 forum.php
create mode 100755 index.php
create mode 100755 lib/.htaccess
create mode 100755 lib/proguard.jar
create mode 100755 lib/retrace.jar
create mode 100755 lib/style.css
create mode 100755 lib/version
create mode 100755 login.php
create mode 100755 logout.php
create mode 100755 map_manager.php
create mode 100755 no_access.php
create mode 100755 res/.htaccess
create mode 100644 res/bullet.gif
create mode 100644 res/close.gif
create mode 100644 res/closelabel.gif
create mode 100644 res/download-icon.gif
create mode 100755 res/error_icon.png
create mode 100755 res/icon.png
create mode 100644 res/loading.gif
create mode 100755 res/newbutton.png
create mode 100644 res/nextlabel.gif
create mode 100755 res/oldbutton.png
create mode 100644 res/prevlabel.gif
create mode 100755 res/updatedbutton.png
create mode 100755 scripts/.htaccess
create mode 100644 scripts/builder.js
create mode 100644 scripts/effects.js
create mode 100755 scripts/jquery.js
create mode 100755 scripts/jquery.sha256.js
create mode 100644 scripts/lightbox-web.js
create mode 100644 scripts/lightbox.js
create mode 100644 scripts/prototype.js
create mode 100644 scripts/scriptaculous.js
create mode 100755 tmp/.htaccess
create mode 100755 tmp/email
create mode 100755 tmp/style.css
create mode 100755 upload_file.php
create mode 100755 uploader/class.FlashUploader.php
create mode 100644 uploader/uploader.swf
create mode 100755 user_manager.php
diff --git a/README b/README
new file mode 100755
index 0000000..4216c9b
--- /dev/null
+++ b/README
@@ -0,0 +1,5 @@
+When pushing changes to production, copy everything over execpt conf.php
+
+default admin:
+admin
+admin
diff --git a/classes/access.php b/classes/access.php
new file mode 100755
index 0000000..e5f362a
--- /dev/null
+++ b/classes/access.php
@@ -0,0 +1,11 @@
+
diff --git a/classes/auth.php b/classes/auth.php
new file mode 100755
index 0000000..88fe50d
--- /dev/null
+++ b/classes/auth.php
@@ -0,0 +1,11 @@
+
diff --git a/classes/blog.php b/classes/blog.php
new file mode 100755
index 0000000..d676a27
--- /dev/null
+++ b/classes/blog.php
@@ -0,0 +1,177 @@
+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 .= <<
+
$username : $title
+ $bodytext
+
Posted: $date
+
+
+ENTRY_DISPLAY;
+ }
+ $entry_display .= ''.$pagelist.'
';
+ }
+ else {
+ $entry_display .= <<
+ No entries have been made on this page.
+
+
+ENTRY_DISPLAY;
+ }
+
+ /*
+ $entry_display .= <<
+ Add a New Entry
+
+
+ ADMIN_OPTION;
+ */
+ return $entry_display;
+ }
+
+ /*
+ This function will be used to display the new comment entry form
+ */
+ public function display_post() {
+ return <<
+ New Blog Entry
+
+
+
+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 = <<
\ No newline at end of file
diff --git a/classes/comments.php b/classes/comments.php
new file mode 100755
index 0000000..f77aa47
--- /dev/null
+++ b/classes/comments.php
@@ -0,0 +1,187 @@
+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 .= <<
+ Comments
+
+
+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 .= <<
$username : $title
+ENTRY_DISPLAY;
+
+ if($_SESSION['access'] == "admin" || $_SESSION['username'] == $username)
+ $entry_display .= <<Delete Post
+ENTRY_DISPLAY;
+
+
+ $entry_display .= <<
+ $bodytext
+
Posted: $date
+
+
+ENTRY_DISPLAY;
+ }
+ }
+ else {
+ $entry_display .= <<
+ No entries have been made on this page.
+
+
+ENTRY_DISPLAY;
+ }
+
+ /*
+ $entry_display .= <<
+ Add a New Entry
+
+
+ADMIN_OPTION;
+*/
+ return $entry_display;
+ }
+
+ /*
+ This function will be used to display the new comment entry form
+ */
+ public function display_post($report) {
+
+ return <<
+ New Comment
+
+
+
+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 = <<
diff --git a/classes/conf.php b/classes/conf.php
new file mode 100755
index 0000000..04f74ce
--- /dev/null
+++ b/classes/conf.php
@@ -0,0 +1,11 @@
+
diff --git a/classes/content.php b/classes/content.php
new file mode 100644
index 0000000..85bce34
--- /dev/null
+++ b/classes/content.php
@@ -0,0 +1,211 @@
+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 .= "Edit";
+ }
+ 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;
+ }
+
+ /*
+ 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 = <<$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("stri_replace("'.str_replace("$eol$eol","",$txt).'
';
+ $html = str_replace("$eol","
\n",$html);
+ $html = str_replace("","\n\n",$html);
+ $html = str_replace("","
",$html);
+
+ //Wipes
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>
","<$tag>",$html);
+ $html = $this->stri_replace("$tag>
","$tag>",$html);
+
+ }
+
+ return $html;
+}
+
+}
+?>
diff --git a/classes/email.php b/classes/email.php
new file mode 100755
index 0000000..dca3983
--- /dev/null
+++ b/classes/email.php
@@ -0,0 +1,34 @@
+
diff --git a/classes/exceptionReports.php b/classes/exceptionReports.php
new file mode 100755
index 0000000..fa029c0
--- /dev/null
+++ b/classes/exceptionReports.php
@@ -0,0 +1,342 @@
+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 = '
';
+
+ if($status == 'updated')
+ $status_icon = '
';
+ else if ($status == 'old')
+ $status_icon = '
';
+ $entry_display .= <<
+#$id $status_icon App: $app $version Count: $count
+ $msg
+
+
+ENTRY_DISPLAY;
+
+ }
+
+ $entry_display .= ''.$pagelist.'
';
+ 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 = '
';
+ $update_status_button = 'Mark as Old';
+
+ if($status == 'updated')
+ $status_icon = '
';
+ else if ($status == 'old'){
+ $status_icon = '
';
+ $update_status_button = 'Mark as New';
+ }
+ $entry_display .= <<
+ $update_status_button
+ Delete Report
+
+ENTRY_DISPLAY;
+
+
+ $entry_display .= <<
+Function copyToClipBoard(sContents)
+{
+window.clipboardData.setData("Text", sContents);
+alert("The contents have been copied to your clipboard.\t");
+}
+
+
+
+
+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 "No Report Found: $id";
+ }
+ 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 = <<
diff --git a/classes/footer.php b/classes/footer.php
new file mode 100755
index 0000000..5635de1
--- /dev/null
+++ b/classes/footer.php
@@ -0,0 +1,29 @@
+get_title();
+$column2 = "$title
".$column2->get_body();
+
+echo <<< LAYOUT
+
+
+
+
+ $column2
+
+
+
+
+LAYOUT;
+
+$name = COMPANY_NAME;
+$year = date("Y");
+echo <<< FOOTER
+
+FOOTER;
+?>
+