This commit is contained in:
Michael Zhang 2023-01-14 07:40:41 -06:00
parent df33b79437
commit 17d49821f5
Signed by: michael
GPG key ID: BDA47A31A3C8EE6B
98 changed files with 3114 additions and 7359 deletions

Binary file not shown.

View file

@ -45,7 +45,7 @@ $your_date=strtotime($str); $datediff=$now - $your_date; return floor($datediff/
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="../page.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<title>About LEXIS</title>
<title>About Keepit</title>
<style>
body {
overflow-x:hidden;
@ -71,7 +71,7 @@ body {
display:block;
font-size:15pt;
}
#goToLEXISNow {
#goToKeepitNow {
position:fixed;
bottom:10px;
right:-250px;
@ -83,7 +83,7 @@ body {
-moz-transition:all .3s ease-out;
-webkit-transition:all .3s ease-out;
}
#goToLEXISNow .button {
#goToKeepitNow .button {
box-shadow:0px 5px 5px #000;
}
#bottombar {
@ -103,7 +103,7 @@ body {
<body>
<div id="container">
<?php include ("../header.php"); ?>
<center><span style="font-size:32pt;display:block;">LEXIS Cloud Office</span>
<center><span style="font-size:32pt;display:block;">Keepit Cloud Office</span>
<span style="display:block;">A new dimension of cloud computing.</span></center>
<table id="features">
<tr>
@ -116,7 +116,7 @@ body {
<td><img src="images/about/accidents_happen.png" /></td>
<td>
<span class="title">Accidents happen, and you lose your files ... or not?<br /><br /></span>
<span class="text">Your files are always safe. Don't ever worry about losing your files again when you have an accident. When you get a new device, simply install the new LEXIS app, and then all your files are back! </span>
<span class="text">Your files are always safe. Don't ever worry about losing your files again when you have an accident. When you get a new device, simply install the new Keepit app, and then all your files are back! </span>
</td>
</tr><tr>
<td>
@ -128,27 +128,27 @@ body {
<td><img src="images/about/free.png" /></td>
<td>
<span class="title">Free ... ? It can't be!<br /><br /></span>
<span class="text">It's true. Once you sign up for an ANIXO account, you get 10 gigabytes of free storage. You can use this storage however you want, and you can also expand this space! Simply buy another LEXIS Office Floorplan and you'll have more space in no time!</span>
<span class="text">It's true. Once you sign up for a Keepit account, you get 10 gigabytes of free storage. You can use this storage however you want, and you can also expand this space! Simply buy another Keepit Office Floorplan and you'll have more space in no time!</span>
</td>
</tr><tr>
<td>
<span class="title">Stats? Just for curious people.<br /><br /></span>
<span class="text">So far, we are storing a total of <?php $total = getDirectorySize("files/"); echo filesize_format ($total); ?>. We started this project close to the start of ANIXO Specifications, estimated to be around August 28, 2012 (<?php echo daysAgo ("2012-8-28"); ?> days ago).</span>
<span class="text">So far, we are storing a total of <?php $total = getDirectorySize("files/"); echo filesize_format ($total); ?>. We started this project close to the start of Keepit, estimated to be around August 28, 2012 (<?php echo daysAgo ("2012-8-28"); ?> days ago).</span>
</td>
<td><img src="images/about/stats.png" /></td>
</tr>
</table>
<div id="bottombar">
LEXIS &copy; 2012-<?php echo date("Y"); ?> by Michael Zhang, ANIXO Specifications.
Keepit &copy; 2012-<?php echo date("Y"); ?> by Michael Zhang, Keepit.
</div>
<div style="position:fixed;top:5px;left:15px;" id="disp"></div>
<div id="goToLEXISNow">
<a class="button color2" href="index.php">Go to your LEXIS cloud now! &raquo;</a>
<div id="goToKeepitNow">
<a class="button color2" href="index.php">Go to your Keepit cloud now! &raquo;</a>
</div>
<script type="text/javascript">
$("#container").scroll(function() {
if(Math.abs($("#container").scrollTop())>40) {
$("#goToLEXISNow").css("right","0px");
$("#goToKeepitNow").css("right","0px");
}
});
</script>

View file

@ -3,7 +3,7 @@
include ("../../auth.inc.php");
$id = $_POST['ID'] or die ("Error: no variable given.");
mysql_query("delete from `lexis_docbank` where id='".$id."'") or die ("Error: couldn't delete ");
mysql_query("delete from `keepit_docbank` where id='".$id."'") or die ("Error: couldn't delete ");
?>
hai

View file

@ -5,7 +5,7 @@ error_reporting(0);
include ("../../auth.inc.php");
$id = $_POST['ID'] or die ("Error: No variable given.");
$query = mysql_query("select * from `lexis_docbank` where id='" . $id . "'") or die ("Error: File not found.");
$query = mysql_query("select * from `keepit_docbank` where id='" . $id . "'") or die ("Error: File not found.");
$row = mysql_fetch_array($query);
echo $row['title'];

View file

@ -23,16 +23,16 @@ $id = $_POST['id'] or die ("No variable given.");
$query = mysql_query("select * from users where username='".$_SESSION['username']."'");
$row = mysql_fetch_array($query);
$lexis_dir = $row['lexis_dir'];
$keepit_dir = $row['keepit_dir'];
$query = mysql_query("select * from `lexis_docbank` where id='" . $id . "'");
$query = mysql_query("select * from `keepit_docbank` where id='" . $id . "'");
$row = mysql_fetch_array($query);
function filesize_of_folder($id) {
$filesize = 0;
$fquery = mysql_query("select * from lexis_docbank where container='" . $id . "'");
$fquery = mysql_query("select * from keepit_docbank where container='" . $id . "'");
while ($frow = mysql_fetch_array($fquery)) {
if ($frow['type']=="lexis_directory") {
if ($frow['type']=="keepit_directory") {
$filesize += filesize_of_folder($frow['id']);
} else {
$filesize += filesize("../files/".$frow['id'].".".$frow['type']);
@ -43,7 +43,7 @@ function filesize_of_folder($id) {
if (isset($row['id']) && strlen($row['id'])>1) {
if ($row['type'] != "lexis_directory") {
if ($row['type'] != "keepit_directory") {
$filesize = filesize("../files/".$id.".".$row['type']);
} else {
$filesize = filesize_of_folder($row['id']);
@ -60,7 +60,7 @@ if (isset($row['id']) && strlen($row['id'])>1) {
return "";
}
function getIconURL($ext) {
if ($ext=="lexis_directory") {
if ($ext=="keepit_directory") {
return "images/folder.png";
} else {
$x = scandir("../icons/");
@ -87,7 +87,7 @@ if (isset($row['id']) && strlen($row['id'])>1) {
<tr>
<td id="icon"><img src="<?php echo getIconURL($row['type']); ?>" width="1" height="1" /></td>
<td id="desc">
<?php if ($row['type']=="lexis_directory") { ?>
<?php if ($row['type']=="keepit_directory") { ?>
<a href="index.php?switchDir=<?php echo $row['id']; ?>"><?php echo $row['title']; ?></a>
<?php } else { ?>
<form action="downloadFile.php" id="downloadForm" method="POST">
@ -98,26 +98,26 @@ if (isset($row['id']) && strlen($row['id'])>1) {
</form>
<?php } ?>
<!--<h3><?php echo "<a ".(($row['type']!="lexis_directory")?"target='_blank'":"")." href='" . (($row['type']=="lexis_directory")?"index.php?switchDir=".$row['id']:"") . "'>" . $row['title']; ?><?php if ($row['type']!="lexis_directory") echo "<span style='color:#999;'>.".strtolower($row['type'])."</span>"; ?></a></h3>-->
<small style="display:block;">Type: <?php echo $row['type']=="lexis_directory"?"Folder":strtoupper($row['type'])." file"; ?></small>
<small style="display:block;">Size: <?php if ($row['type']!="lexis_directory") { echo filesize_format($filesize); } else { echo filesize_format(filesize_of_folder($row['id'])); } ?></small>
<!--<h3><?php echo "<a ".(($row['type']!="keepit_directory")?"target='_blank'":"")." href='" . (($row['type']=="keepit_directory")?"index.php?switchDir=".$row['id']:"") . "'>" . $row['title']; ?><?php if ($row['type']!="keepit_directory") echo "<span style='color:#999;'>.".strtolower($row['type'])."</span>"; ?></a></h3>-->
<small style="display:block;">Type: <?php echo $row['type']=="keepit_directory"?"Folder":strtoupper($row['type'])." file"; ?></small>
<small style="display:block;">Size: <?php if ($row['type']!="keepit_directory") { echo filesize_format($filesize); } else { echo filesize_format(filesize_of_folder($row['id'])); } ?></small>
</td>
</table>
<p>&nbsp;</p>
<div>
<a href="javascript:renameBtn('<?php echo $row['id']; ?>');" class="button color1">Rename</a><?php if ($row['type']!="lexis_directory") { ?><form style="display:inline;" action="downloadFile.php" id="downloadForm" method="POST"><input type="hidden" name="id" value="<?php echo $row['id']; ?>" /><input type="hidden" name="type" value="<?php echo $row['type']; ?>" /><input type="hidden" name="title" value="<?php echo $row['title']; ?>" /><a class="button color2" href="javascript:$('#downloadForm').submit();">Download</a></form><?php } ?><a href="javascript:void(0);" id="deleteBtn" class="button color7">Delete</a>
<a href="javascript:renameBtn('<?php echo $row['id']; ?>');" class="button color1">Rename</a><?php if ($row['type']!="keepit_directory") { ?><form style="display:inline;" action="downloadFile.php" id="downloadForm" method="POST"><input type="hidden" name="id" value="<?php echo $row['id']; ?>" /><input type="hidden" name="type" value="<?php echo $row['type']; ?>" /><input type="hidden" name="title" value="<?php echo $row['title']; ?>" /><a class="button color2" href="javascript:$('#downloadForm').submit();">Download</a></form><?php } ?><a href="javascript:void(0);" id="deleteBtn" class="button color7">Delete</a>
</div>
<p>&nbsp;</p>
<div id="preview">
<?php if ($row['type']=="lexis_directory") { ?>
<?php if ($row['type']=="keepit_directory") { ?>
Folder contents:
<ul style="list-style-type:none;">
<?php
$fquery = mysql_query("select * from lexis_docbank where container='".$row['id']."'");
$fquery = mysql_query("select * from keepit_docbank where container='".$row['id']."'");
while($frow = mysql_fetch_array($fquery)) {
echo "<li><img style='vertical-align:middle;' src='".getIconURL($frow['type'])."' width='30' height='30' />&nbsp;<a href='javascript:showPreviewPane(\"".$frow['id']."\");'>".$frow['title']."</a></li>";
}

View file

@ -74,7 +74,7 @@ if ($_SESSION['logged']==1) {
$terms = explode(" ",$words);
include ("../../auth.inc.php");
$fquery = mysql_query("select * from `lexis_docbank` where owner='".$_SESSION['username']."'") or die("Error: " . mysql_error());
$fquery = mysql_query("select * from `keepit_docbank` where owner='".$_SESSION['username']."'") or die("Error: " . mysql_error());
$allFiles = array();
while($file= mysql_fetch_array($fquery)) {
array_push($allFiles,$file);
@ -101,7 +101,7 @@ if ($_SESSION['logged']==1) {
echo "<ul class='resultsList'>";
foreach ($locus as $file) {
$type = $file['type'];
echo "<li>".($type=="lexis_directory"?('<a href="index.php?switchDir='.$file['id'].'" class="searchResult">'):('<a href="'.getLink($file['id'],$type).'" target="_blank" class="searchResult">'))."<img src='".($type=="lexis_directory"?"images/folder.png":getIconURL($type))."' style='width:30px; height:30px; vertical-align:middle;' />&nbsp;&nbsp;".lengthFilter($file['title'])."</a></li>";
echo "<li>".($type=="keepit_directory"?('<a href="index.php?switchDir='.$file['id'].'" class="searchResult">'):('<a href="'.getLink($file['id'],$type).'" target="_blank" class="searchResult">'))."<img src='".($type=="keepit_directory"?"images/folder.png":getIconURL($type))."' style='width:30px; height:30px; vertical-align:middle;' />&nbsp;&nbsp;".lengthFilter($file['title'])."</a></li>";
}
echo "</ul>";
} else {

View file

@ -2,7 +2,7 @@
session_start();
$nv = $_POST['new_view'] or die ("No variable given.");
$_SESSION['lexis_view'] = $nv;
$_SESSION['keepit_view'] = $nv;
echo "Done.";

View file

@ -18,13 +18,13 @@ $query = mysql_query("select * from `users` where username = '$owner'") or die("
$row = mysql_fetch_array($query);
$doc = $_GET['doc'];
$val = true;
$dir = isset($_SESSION['current_dir'])?$_SESSION['current_dir']:$row['lexis_dir'];
$dir = isset($_SESSION['current_dir'])?$_SESSION['current_dir']:$row['keepit_dir'];
if ($doc == "new") {
$id = get_random_string("ABCDEFGHIJKLMNOPQRSTUVWYZabcdefghijklmnopqrstuvwyz0123456789",50);
} else {
if (isset($_GET['id'])) {
$id = $_GET['id'];
$query2 = mysql_query("select * from `lexis_docbank` where id='$id'") or die ("Error: ".mysql_error());
$query2 = mysql_query("select * from `keepit_docbank` where id='$id'") or die ("Error: ".mysql_error());
$row2 = mysql_fetch_array($query2);
$contents = nl2br(file_get_contents("../files/".$id.".cascade")) or die ("Can't find file");
@ -38,30 +38,30 @@ if ($doc == "new") {
$cDir = "";
if ($_SESSION['current_dir'] == $row['lexis_dir']) {
if ($_SESSION['current_dir'] == $row['keepit_dir']) {
$cDir = "My Cloud";
} else {
$nowdir = "[unknown directory]";
$upperDirectory = "";
$upperName = "";
$fquery = mysql_query("select * from `lexis_docbank`") or die("Error: " . mysql_error());
$fquery = mysql_query("select * from `keepit_docbank`") or die("Error: " . mysql_error());
while ($frow = mysql_fetch_array($fquery)) {
if ($frow['id'] == $_SESSION['current_dir']) {
$nowdir = $frow['title'];
$upperDirectory = $frow['container'];
}
}
if ($upperDirectory == $row['lexis_dir']) {
if ($upperDirectory == $row['keepit_dir']) {
$upperName = "My Cloud";
} else {
$fquery = mysql_query("select * from `lexis_docbank`") or die("Error: " . mysql_error());
$fquery = mysql_query("select * from `keepit_docbank`") or die("Error: " . mysql_error());
while ($frow = mysql_fetch_array($fquery)) {
if ($frow['id'] == $upperDirectory) {
$upperName = $frow['title'];
}
}
}
$cDir = (($upperDirectory != $row['lexis_dir'])?"... ":"") . $upperName . " &raquo; " . $nowdir;
$cDir = (($upperDirectory != $row['keepit_dir'])?"... ":"") . $upperName . " &raquo; " . $nowdir;
// echo "Current directory: <b>" . $nowdir . "</b> (<a href='index.php?switchDir=" . $upperDirectory . "'>Back to " . $upperName . "</a>)";
}
@ -70,8 +70,8 @@ if ($_SESSION['current_dir'] == $row['lexis_dir']) {
<!--
CASCADE Spreadsheet Editor
LEXIS CLOUD OFFICE
(c) 2012-2013 by ANIXO Specifications
Keepit CLOUD OFFICE
(c) 2012-2013 by Keepit
The code you found here is written by Michael Zhang. If you have found the PHP inside it we ask that you don't read any sensitive information. Otherwise, feel free to use some of the scripts here as examples as you create your own website or other such project.
@ -83,7 +83,7 @@ if ($_SESSION['current_dir'] == $row['lexis_dir']) {
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="copyright" content="(c) 2012-<?php echo date("Y"); ?> by ANIXO Specifications." />
<meta name="copyright" content="(c) 2012-<?php echo date("Y"); ?> by Keepit." />
<title>Cascade Spreadsheet</title>
<link rel="stylesheet" href="../../page.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
@ -479,7 +479,7 @@ if ($_SESSION['current_dir'] == $row['lexis_dir']) {
</script>
<?php } else { ?>
<h2>You must be signed in to use the LEXIS Cloud Office.</h2>
<h2>You must be signed in to use the Keepit Cloud Office.</h2>
<p>Hover over to the right to reveal the sign in page!</p>
<?php } ?>

View file

@ -25,9 +25,9 @@ $file = "../files/".$id.".cascade";
if (file_exists($file)) {
unlink($file);
file_put_contents($file, $contents) or die ("Error");
mysql_query("update lexis_docbank set title='$title' where id='$id' and owner='$owner'") or die(mysql_error());
mysql_query("update keepit_docbank set title='$title' where id='$id' and owner='$owner'") or die(mysql_error());
} else {
$query = mysql_query("insert into lexis_docbank (id,title,container,owner,type) values('$id','$title','$dir','$owner','cascade')") or die("Can't connect: ".mysql_error());
$query = mysql_query("insert into keepit_docbank (id,title,container,owner,type) values('$id','$title','$dir','$owner','cascade')") or die("Can't connect: ".mysql_error());
file_put_contents($file, $contents) or die ("Error");
}

View file

@ -24,13 +24,13 @@ $query = mysql_query("select * from `users` where username = '$owner'") or die("
$row = mysql_fetch_array($query);
$doc = $_GET['doc'];
$val = true;
$dir = isset($_SESSION['current_dir'])?$_SESSION['current_dir']:$row['lexis_dir'];
$dir = isset($_SESSION['current_dir'])?$_SESSION['current_dir']:$row['keepit_dir'];
if ($doc == "new") {
$id = get_random_string("ABCDEFGHIJKLMNOPQRSTUVWYZabcdefghijklmnopqrstuvwyz0123456789",50);
} else {
if (isset($_GET['id'])) {
$id = $_GET['id'];
$query2 = mysql_query("select * from `lexis_docbank` where id='$id'") or die ("Error: ".mysql_error());
$query2 = mysql_query("select * from `keepit_docbank` where id='$id'") or die ("Error: ".mysql_error());
$row2 = mysql_fetch_array($query2);
$contents = nl2br(file_get_contents("../files/".$id.".scribe")) or die ("Can't find file");
@ -44,30 +44,30 @@ if ($doc == "new") {
$cDir = "";
if ($_SESSION['current_dir'] == $row['lexis_dir']) {
if ($_SESSION['current_dir'] == $row['keepit_dir']) {
$cDir = "My Cloud";
} else {
$nowdir = "[unknown directory]";
$upperDirectory = "";
$upperName = "";
$fquery = mysql_query("select * from `lexis_docbank`") or die("Error: " . mysql_error());
$fquery = mysql_query("select * from `keepit_docbank`") or die("Error: " . mysql_error());
while ($frow = mysql_fetch_array($fquery)) {
if ($frow['id'] == $_SESSION['current_dir']) {
$nowdir = $frow['title'];
$upperDirectory = $frow['container'];
}
}
if ($upperDirectory == $row['lexis_dir']) {
if ($upperDirectory == $row['keepit_dir']) {
$upperName = "My Cloud";
} else {
$fquery = mysql_query("select * from `lexis_docbank`") or die("Error: " . mysql_error());
$fquery = mysql_query("select * from `keepit_docbank`") or die("Error: " . mysql_error());
while ($frow = mysql_fetch_array($fquery)) {
if ($frow['id'] == $upperDirectory) {
$upperName = $frow['title'];
}
}
}
$cDir = (($upperDirectory != $row['lexis_dir'])?"... ":"") . $upperName . " &raquo; " . $nowdir;
$cDir = (($upperDirectory != $row['keepit_dir'])?"... ":"") . $upperName . " &raquo; " . $nowdir;
// echo "Current directory: <b>" . $nowdir . "</b> (<a href='index.php?switchDir=" . $upperDirectory . "'>Back to " . $upperName . "</a>)";
}
@ -76,8 +76,8 @@ if ($_SESSION['current_dir'] == $row['lexis_dir']) {
<!--
SCRIBE Word Editor
LEXIS CLOUD OFFICE
(c) 2012-2013 by ANIXO Specifications
Keepit CLOUD OFFICE
(c) 2012-2013 by Keepit
The code you found here is written by Michael Zhang. If you have found the PHP inside it we ask that you don't read any sensitive information. Otherwise, feel free to use some of the scripts here as examples as you create your own website or other such project.
@ -89,7 +89,7 @@ if ($_SESSION['current_dir'] == $row['lexis_dir']) {
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="copyright" content="(c) 2012-<?php echo date("Y"); ?> by ANIXO Specifications." />
<meta name="copyright" content="(c) 2012-<?php echo date("Y"); ?> by Keepit." />
<title>Scribe Word Editor</title>
<link rel="stylesheet" href="../../page.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
@ -566,7 +566,7 @@ if ($_SESSION['current_dir'] == $row['lexis_dir']) {
</script>
<?php } else { ?>
<h2>You must be signed in to use the LEXIS Cloud Office.</h2>
<h2>You must be signed in to use the Keepit Cloud Office.</h2>
<p>Hover over to the right to reveal the sign in page!</p>
<?php } ?>

View file

@ -25,9 +25,9 @@ $file = "../files/".$id.".scribe";
if (file_exists($file)) {
unlink($file);
file_put_contents($file, $contents) or die ("Error");
mysql_query("update lexis_docbank set title='$title' and dateMod=NOW() where id='$id' and owner='$owner'") or die(mysql_error());
mysql_query("update keepit_docbank set title='$title' and dateMod=NOW() where id='$id' and owner='$owner'") or die(mysql_error());
} else {
$query = mysql_query("insert into lexis_docbank (id,title,container,owner,type,dateMod) values('$id','$title','$dir','$owner','scribe',NOW())") or die("Can't connect: ".mysql_error());
$query = mysql_query("insert into keepit_docbank (id,title,container,owner,type,dateMod) values('$id','$title','$dir','$owner','scribe',NOW())") or die("Can't connect: ".mysql_error());
file_put_contents($file, $contents) or die ("Error");
}

View file

@ -2,7 +2,7 @@
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="copyright" content="(c) 2012-<?php echo date("Y"); ?> by ANIXO Specifications." />
<meta name="copyright" content="(c) 2012-<?php echo date("Y"); ?> by Keepit." />
<title></title>
<link rel="stylesheet" href="../../page.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>

253
index.php
View file

@ -17,18 +17,6 @@ function get_random_string($valid_chars, $length)
}
return $random_string;
}
function filesize_of_folder($id) {
$filesize = 0;
$fquery = mysql_query("select * from lexis_docbank where container='" . $id . "'");
while ($frow = mysql_fetch_array($fquery)) {
if ($frow['type']=="lexis_directory") {
$filesize += filesize_of_folder($frow['id']);
} else {
$filesize += filesize("files/".$frow['id'].".".$frow['type']);
}
}
return $filesize;
}
function filesize_format($size, $sizes = array('Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'))
{
if ($size == 0)
@ -39,30 +27,27 @@ function filesize_format($size, $sizes = array('Bytes', 'KB', 'MB', 'GB', 'TB',
$username = $_SESSION['username'];
$query = mysql_query("select * from `users` where username = '$username'") or die("Error: " . mysql_error());
$row = mysql_fetch_array($query);
if (!isset($row['lexis_dir']) || strlen($row['lexis_dir']) < 51) {
if (!isset($row['keepit_dir']) || strlen($row['keepit_dir']) < 51) {
$k = get_random_string("ABCDEFGHIJKLMNOPQRSTUVWYZabcdefghijklmnopqrstuvwyz0123456789", 51);
mysql_query("update `users` set lexis_dir = '" . $k . "' where username = '$username'") or die("Error: " . mysql_error());
mysql_query("update `users` set keepit_dir = '" . $k . "' where username = '$username'") or die("Error: " . mysql_error());
}
if (!isset($_SESSION['lexis_view'])) {
$_SESSION['lexis_view'] = "icon";
if (!isset($_SESSION['keepit_view'])) {
$_SESSION['keepit_view'] = "icon";
}
?>
<html>
<head>
<title>LEXIS Cloud Office</title>
<title>Keepit Cloud Office</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="icon" href="../images/lexis.png" />
<link rel="icon" href="../images/keepit.png" />
<link rel="stylesheet" href="../page.css" />
<link rel="stylesheet" href="dtree.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
<script src="dtree.js" type="text/javascript"></script>
<style type="text/css">
body {
overflow:hidden;
}
#container {
overflow:hidden;
}
@ -90,7 +75,6 @@ if (!isset($_SESSION['lexis_view'])) {
width:100%;
position:absolute;
left:0px;
z-index:106;
}
#searchBar #search {
width:100%;
@ -102,8 +86,6 @@ if (!isset($_SESSION['lexis_view'])) {
padding:15px;
border:none;
outline:none;
margin:0px;
box-shadow:none;
}
#searchBar #search:focus {
box-shadow:none;
@ -116,12 +98,6 @@ if (!isset($_SESSION['lexis_view'])) {
padding:15px;
overflow:auto;
margin:0px;
border-right:4px solid #999;
transition:all .3s ease-out;
-o-transition:all .3s ease-out;
-ms-transition:all .3s ease-out;
-moz-transition:all .3s ease-out;
-webkit-transition:all .3s ease-out;
}
#mainContent {
position:absolute;
@ -131,11 +107,6 @@ if (!isset($_SESSION['lexis_view'])) {
padding:15px;
overflow:auto;
margin:0px;
transition:all .3s ease-out;
-o-transition:all .3s ease-out;
-ms-transition:all .3s ease-out;
-moz-transition:all .3s ease-out;
-webkit-transition:all .3s ease-out;
}
.fileNode {
display:inline-block;
@ -198,10 +169,9 @@ if (!isset($_SESSION['lexis_view'])) {
display:block;
box-sizing:border-box; -moz-box-sizing:border-box;
padding:10px;
background-color:#E2E2E2;
background-color:#E0E0E0;
margin-bottom:10px;
/* box-shadow:inset 0px 3px 5px #999; */
border:1px solid #999;
box-shadow:inset 0px 3px 5px #999;
transition:all .3s ease-out;
-o-transition:all .3s ease-out;
-ms-transition:all .3s ease-out;
@ -209,12 +179,12 @@ if (!isset($_SESSION['lexis_view'])) {
-webkit-transition:all .3s ease-out;
}
#menu a.btn:hover {
/* box-shadow:inset 0px 3px 5px #666; */
background-color:#EAEAEA;
box-shadow:inset 0px 3px 5px #666;
background-color:#FAFAFA;
text-decoration:none;
}
#menu a.btn:active {
background-color:#D7D7D7;
background-color:#C2C2C2;
}
.dialog {
position:fixed;
@ -262,7 +232,6 @@ if (!isset($_SESSION['lexis_view'])) {
box-shadow:0px 5px 10px #666;
box-sizing:border-box; -moz-box-sizing:border-box;
padding:15px;
height:0px;
background-color:#EEE;
}
#searchResults #results {
@ -282,23 +251,23 @@ if (!isset($_SESSION['lexis_view'])) {
height:30px;
cursor:pointer;
}
/* * {border:1px solid #F00;} */
#previewPane {
z-index:110;
position:absolute;
right:0px;
left:-30%;
width:30%;
box-sizing:border-box; -moz-box-sizing:border-box;
padding:15px;
overflow:auto;
margin:0px;
border-left:4px solid #999;
display:block;
background-color:#EEE;
transition:all .3s ease-out;
-o-transition:all .3s ease-out;
-ms-transition:all .3s ease-out;
-moz-transition:all .3s ease-out;
-webkit-transition:all .3s ease-out;
border-right:3px solid #999;
}
#previewPane #closeBtn {
z-index:111;
@ -310,44 +279,6 @@ if (!isset($_SESSION['lexis_view'])) {
top:10px;
}
</style>
<script>
function preventOverScroll(scrollPane) {
var CAPTURE_PHASE = true;
var BUBBLE_PHASE = false;
var allowScrollUp = true, allowScrollDown = true, lastY = 0;
scrollPane.addEventListener
('touchstart',
function(e) {
allowScrollUp = (this.scrollTop > 0);
allowScrollDown = (this.scrollTop < this.scrollHeight - this.clientHeight);
lastY = e.pageY;
},
CAPTURE_PHASE);
scrollPane.addEventListener
('touchmove',
function (e) {
var up = (e.pageY > lastY);
var down = ! up;
lastY = event.pageY;
if ((up && allowScrollUp) || (down && allowScrollDown)) {
e.stopPropagation();
} else {
e.preventDefault();
}
},
CAPTURE_PHASE);
};
document.addEventListener('touchmove', function(e) { e.preventDefault(); }, false);
preventOverScroll(document.getElementById("mainContent"));
preventOverScroll(document.getElementById("navTree"));
preventOverScroll(document.getElementById("previewPane"));
</script>
</head>
<body>
@ -367,10 +298,10 @@ if (!isset($_SESSION['lexis_view'])) {
5. DISPLAY TO THE USER IN A NEAT, ORGANIZED METHOD.
*/
// STEP 1
$current_dir = (isset($_SESSION['current_dir'])) ? $_SESSION['current_dir'] : $row['lexis_dir'];
$current_dir = (isset($_SESSION['current_dir'])) ? $_SESSION['current_dir'] : $row['keepit_dir'];
$_SESSION['current_dir'] = $current_dir;
// STEP 2
$fquery = mysql_query("select * from `lexis_docbank` where container = '$current_dir'") or die("Error: " . mysql_error());
$fquery = mysql_query("select * from `keepit_docbank` where container = '$current_dir'") or die("Error: " . mysql_error());
$files = array();
$totalfiles = array();
while ($frow = mysql_fetch_array($fquery)) {
@ -393,55 +324,55 @@ if (!isset($_SESSION['lexis_view'])) {
}
// STEP 3a
$cDir = "";
if ($_SESSION['current_dir'] == $row['lexis_dir']) {
if ($_SESSION['current_dir'] == $row['keepit_dir']) {
$cDir = "<a href='index.php'>My Cloud</a>";
} else {
/* $nowdir = "[unknown directory]";
$upperDirectory = "";
$upperName = "";
$fquery = mysql_query("select * from `lexis_docbank`") or die("Error: " . mysql_error());
$fquery = mysql_query("select * from `keepit_docbank`") or die("Error: " . mysql_error());
while ($frow = mysql_fetch_array($fquery)) {
if ($frow['id'] == $_SESSION['current_dir']) {
$nowdir = $frow['title'];
$upperDirectory = $frow['container'];
}
}
if ($upperDirectory == $row['lexis_dir']) {
if ($upperDirectory == $row['keepit_dir']) {
$upperName = "My Cloud";
} else {
$fquery = mysql_query("select * from `lexis_docbank`") or die("Error: " . mysql_error());
$fquery = mysql_query("select * from `keepit_docbank`") or die("Error: " . mysql_error());
while ($frow = mysql_fetch_array($fquery)) {
if ($frow['id'] == $upperDirectory) {
$upperName = $frow['title'];
}
}
}
$cDir = (($upperDirectory != $row['lexis_dir'])?"... ":"") . "<a href='index.php?switchDir=" . $upperDirectory . "'>" . $upperName . "</a> &raquo; <a href='index.php'>" . $nowdir . "</a>"; */
$cDir = (($upperDirectory != $row['keepit_dir'])?"... ":"") . "<a href='index.php?switchDir=" . $upperDirectory . "'>" . $upperName . "</a> &raquo; <a href='index.php'>" . $nowdir . "</a>"; */
$nowdir = "[unknown directory]";
$fquery = mysql_query("select * from `lexis_docbank` where id='".$_SESSION['current_dir']."'") or die("Error: " . mysql_error());
$fquery = mysql_query("select * from `keepit_docbank` where id='".$_SESSION['current_dir']."'") or die("Error: " . mysql_error());
while ($frow = mysql_fetch_array($fquery)) {
$nowdir = $frow['title'];
}
if ($_SESSION['current_dir']==$row['lexis_dir']) {
$cDir = "<a href='index.php?switchDir=" . $row['lexis_dir'] . "'>My Cloud</a>";
if ($_SESSION['current_dir']==$row['keepit_dir']) {
$cDir = "<a href='index.php?switchDir=" . $row['keepit_dir'] . "'>My Cloud</a>";
} else {
$cur = $_SESSION['current_dir'];
$cDir = "<a href='index.php?switchDir=" . $cur . "'>" . $nowdir . "</a>";
$upperDirectory = "";
$upperName = "";
$cName = "";
while ($cur != $row['lexis_dir']) {
$fquery = mysql_query("select * from `lexis_docbank` where id='".$cur."'") or die("Error: " . mysql_error());
while ($cur != $row['keepit_dir']) {
$fquery = mysql_query("select * from `keepit_docbank` where id='".$cur."'") or die("Error: " . mysql_error());
$frow = mysql_fetch_array($fquery);
$cName = $frow['title'];
$upperDirectory = $frow['container'];
$fquery = mysql_query("select * from `lexis_docbank` where id='".$upperDirectory."'") or die("Error: " . mysql_error());
$fquery = mysql_query("select * from `keepit_docbank` where id='".$upperDirectory."'") or die("Error: " . mysql_error());
$frow = mysql_fetch_array($fquery);
$upperName = $frow['title'];
$cDir = "<a href='index.php?switchDir=" . $upperDirectory . "'>" . $upperName . "</a> &raquo; " . $cDir;
$cur = $upperDirectory;
}
$cDir = "<a href='index.php?switchDir=" . $row['lexis_dir'] . "'>My Cloud</a> " . $cDir;
$cDir = "<a href='index.php?switchDir=" . $row['keepit_dir'] . "'>My Cloud</a> " . $cDir;
}
// echo "Current directory: <b>" . $nowdir . "</b> (<a href='index.php?switchDir=" . $upperDirectory . "'>Back to " . $upperName . "</a>)";
}
@ -478,21 +409,29 @@ if (!isset($_SESSION['lexis_view'])) {
d = new dTree ('d');
<?php
$c = 1;
$t = array();
$all = array();
$root = array(
"id" => $row['lexis_dir'],
"type" => "lexis_directory",
"id" => $row['keepit_dir'],
"type" => "keepit_directory",
"owner" => $_SESSION['username'],
"container" => "n/a",
"title" => "My Cloud",
);
array_push($t,$root);
$fquery = mysql_query("select * from `lexis_docbank` where owner='".$_SESSION['username']."' and type='lexis_directory'") or die("Error: " . mysql_error());
$fquery = mysql_query("select * from `keepit_docbank`") or die("Error: " . mysql_error());
while ($frow = mysql_fetch_array($fquery)) {
array_push ($t,$frow);
array_push ($all,$frow);
}
foreach ($all as $one) {
if ($one['owner']==$_SESSION['username']) {
if ($one['type']=='keepit_directory') {
array_push($t,$one);
}
}
}
for ($i=0;$i<count($t);$i++) {
$one = $t[$i];
@ -509,20 +448,9 @@ if (!isset($_SESSION['lexis_view'])) {
document.write (d);
</script>
<p style="width:100%; text-align:center;">
<a href="LexisSync.exe" class="button color2" style="width:50%; box-sizing:border-box; -moz-box-sizing:border-box; display:inline-block; text-align:center;" target="_blank">LEXIS Sync Tool<br /><small>Windows Executable</small></a><a href="LexisSync.jar" class="button color3" style="width:50%; box-sizing:border-box; -moz-box-sizing:border-box; display:inline-block; text-align:center;" target="_blank">LEXIS Sync Tool<br /><small>Universal JAR</small></a>
</p>
</div>
<div id="mainContent">
<?php if (count($totalfiles)<1 && $current_dir==$row['lexis_dir']) { ?>
<div id="welcomeSign" style="width:70%; background-color:#FAFAFA; padding:15px; border:1px solid #999; position:relative;">
<h2>Welcome to LEXIS!</h2>
<p>LEXIS is a convenient place to store your files, where you can access them from different devices. To get started, head over to the top left and click the File button. There you can create or upload a file. You have 10 GB of available online storage space.</p>
<p>Thanks for using LEXIS!</p>
<a href="javascript:$('#welcomeSign').slideUp();" style="position:absolute; top:10px; right:10px;"><img src="images/closeIcon.png" /></a>
</div>
<?php } else { ?>
<?php
function getIconURL($ext) {
$x = scandir("icons/");
@ -539,7 +467,7 @@ if (!isset($_SESSION['lexis_view'])) {
$sizes = array();
$types = array();
foreach ($files as $file) {
if ($file['type'] != "lexis_directory") {
if ($file['type'] != "keepit_directory") {
$thissize = filesize("files/" . $file['id'] . "." . $file['type']);
array_push($ids, $file['id']);
array_push($titles, $file['title']);
@ -548,7 +476,7 @@ if (!isset($_SESSION['lexis_view'])) {
} else {
array_push($ids, $file['id']);
array_push($titles, $file['title']);
array_push($sizes, filesize_of_folder($file['id']));
array_push($sizes, "");
array_push($types, $file['type']);
}
}
@ -572,7 +500,7 @@ if (!isset($_SESSION['lexis_view'])) {
}
?>
<?php if ($_SESSION['lexis_view']=='icon') { ?>
<?php if ($_SESSION['keepit_view']=='icon') { ?>
<script type="text/javascript">
function filesize_format(size) {
var i = -1;
@ -590,7 +518,7 @@ if (!isset($_SESSION['lexis_view'])) {
this.size = size;
function str() {
var t = "";
if (this.type=="lexis_directory") { t+="<a href='index.php?switchDir="+this.id+"'>"; }
if (this.type=="keepit_directory") { t+="<a href='index.php?switchDir="+this.id+"'>"; }
else { t+="<a href='files/"+this.id+"."+this.type+"' target='_blank'>"; }
t += "<div class='node'><h3>"+this.title+"</h3>"+filesize_format(this.size)+"</div>";
t += "</a>";
@ -602,7 +530,7 @@ if (!isset($_SESSION['lexis_view'])) {
$count = 0;
echo "<!-- WRITING THE NODES -->";
for ($i = 0; $i < count($files); $i++) {
if ($types[$i] == "lexis_directory") {
if ($types[$i] == "keepit_directory") {
// echo "var node".$count." = new node('".$ids[$i]."','".$titles[$i]."','".$types[$i]."','".$sizes[$i]."');";
$t = "";
$t .= "<a href='javascript:showPreviewPane(\"".$ids[$i]."\");'>"; //href='index.php?switchDir=".$ids[$i]."'>";
@ -614,7 +542,7 @@ if (!isset($_SESSION['lexis_view'])) {
echo "\r\n";
}
for ($i = 0; $i < count($files); $i++) {
if ($types[$i] != "lexis_directory") {
if ($types[$i] != "keepit_directory") {
// echo "var node".$count." = new node('".$ids[$i]."','".$titles[$i]."','".$types[$i]."','".$sizes[$i]."');";
$t = "";
$t .= "<a href='javascript:showPreviewPane(\"".$ids[$i]."\");'>"; //href='".getLink($ids[$i],$types[$i])."' target='_blank'>";
@ -631,7 +559,7 @@ if (!isset($_SESSION['lexis_view'])) {
<div id="dblClickHint"></div>
<table id="mainTable" style="width:80%; border-collapse:collapse;font-weight:300;">
<tr style="text-align:left; background-color:#DDD;">
<tr style="background-color:#DDD;">
<th style="width:30px;"></th>
<th>Name</th>
<th>Size</th>
@ -639,21 +567,21 @@ if (!isset($_SESSION['lexis_view'])) {
</tr>
<?php
for ($i = 0; $i < count($files); $i++) {
if ($types[$i] == "lexis_directory") {
if ($types[$i] == "keepit_directory") {
echo "<tr class='row'>";
echo "<td><img src='images/folder.png' alt='Folder' width='60' height='60' /></td>";
echo "<td><a href='javascript:showPreviewPane(\"".$ids[$i]."\");'>" . $titles[$i] . "</a></td>";
echo "<td>" . filesize_format($sizes[$i]) . "</td>";
echo "<td style='cursor:pointer;' onclick='javascript:location.href=\"index.php?switchDir=" . $ids[$i] . "\";'>" . $titles[$i] . "</td>";
echo "<td></td>";
echo "<td>Directory</td>";
echo "</tr>";
}
echo "\r\n";
}
for ($i = 0; $i < count($files); $i++) {
if ($types[$i] != "lexis_directory") {
if ($types[$i] != "keepit_directory") {
echo "<tr class='row'>";
echo "<td><img src='".getIconURL($types[$i])."' alt='File' width='60' height='60' /></td>";
echo "<td><a href='javascript:showPreviewPane(\"".$ids[$i]."\");'>" . $titles[$i] . "</a></td>";
echo "<td><a href='".getLink($ids[$i],$types[$i])."' target='_blank'>" . $titles[$i] . "</a></td>";
echo "<td>" . filesize_format($sizes[$i]) . "</td>";
echo "<td>" . strtoupper($types[$i]) . " file</td>";
echo "</tr>";
@ -663,8 +591,7 @@ if (!isset($_SESSION['lexis_view'])) {
?>
</table>
<?php }
} ?>
<?php } ?>
</div>
<div id="menu" style="opacity:0;"></div>
@ -705,24 +632,10 @@ if (!isset($_SESSION['lexis_view'])) {
<p><b>Create Directory</b><a style="position:absolute; top:5px; right:5px;" href="#" class="close"><img src="images/closeIcon.png" style="width:32px;height:32px;" alt="Close" /></a></p>
<p>Give your new folder a name.</p>
<p>
<form action="newdir.php" method="POST">
<input type="text" name="name" id="name" class="tf" autocomplete="off" />
<input type="submit" class="button color2" value="Create Folder!" />
</form>
</p>
</div>
</div>
<div id="renameDialog" class="dialog">
<div class="mask"></div>
<div class="window">
<p><b>Rename Item</b><a style="position:absolute; top:5px; right:5px;" href="#" class="close"><img src="images/closeIcon.png" style="width:32px;height:32px;" alt="Close" /></a></p>
<p>Rename "<span id="renameSource"></span>" to:</p>
<p>
<form action="rename.php" method="POST">
<input type="hidden" name="renameFormItem" id="renameFormItem" value="" />
<form action="newdir.php" method="POST">
<input type="text" name="name" class="tf" autocomplete="off" />
<input type="submit" class="button color2" value="Rename" />
</form>
<input type="submit" class="button color2" value="Create Folder!" />
</form>
</p>
</div>
</div>
@ -730,13 +643,7 @@ if (!isset($_SESSION['lexis_view'])) {
<script type="text/javascript">
var currentMenu = "fileBtn";
$("#previewPane").css("right","-30%");
function showPreviewPane(id) {
$("#previewPane").css("right","0px");
$("#mainContent").css("right","30%");
$("#navTree").css("left","-30%");
$("#previewPane").html("Loading file information...");
$.ajax({
type:"POST",
url:"ajax/previewPane.php",
@ -744,19 +651,15 @@ if (!isset($_SESSION['lexis_view'])) {
dataType: "html",
success: function (msg) {
$("#previewPane").html(msg);
$("#previewPane").css("left","0px");
}
});
hideMenu();
}
function closePreviewPane() {
$("#previewPane").css("right","-30%");
$("#mainContent").css("right","0px");
$("#navTree").css("left","0px");
$("#previewPane").css("left","-30%");
}
$("#searchResults").css("top",$("#bars").position().top + $("#bars").height());
setInterval(function() {
$("#searchResults").width(window.innerWidth*4/5);
@ -764,6 +667,7 @@ if (!isset($_SESSION['lexis_view'])) {
$("#searchBar").css("width",window.innerWidth);
$("#topbar").css("top",$("#bars").position().top + $("#bars").height() + $("#searchBar").height());
$("#searchResults").css("top",$("#bars").position().top + $("#bars").height() + $("#searchBar").height());
$("#menu").css("top",$("#bars").position().top + $("#bars").height() + $("#searchBar").height() + $("#topbar").height());
$("#menu").height(window.innerHeight - $("#bars").position().top - $("#bars").height() - $("#searchBar").height() - $("#topbar").height() - 50);
@ -780,16 +684,12 @@ if (!isset($_SESSION['lexis_view'])) {
$("#newDialog .window").css("top",(window.innerHeight/2-150)+"px");
$("#newDirDialog .window").css("left",(window.innerWidth/2-150)+"px");
$("#newDirDialog .window").css("top",(window.innerHeight/2-125)+"px");
$("#renameDialog .window").css("left",(window.innerWidth/2-150)+"px");
$("#renameDialog .window").css("top",(window.innerHeight/2-125)+"px");
$("#uploadDialog .window").css("width",300);
$("#uploadDialog .window").css("height",250);
$("#newDialog .window").css("width",400);
$("#newDialog .window").css("height",300);
$("#newDirDialog .window").css("width",300);
$("#newDirDialog .window").css("height",250);
$("#renameDialog .window").css("width",300);
$("#renameDialog .window").css("height",250);
});
$("#search").keypress(function(e) {
@ -815,13 +715,11 @@ if (!isset($_SESSION['lexis_view'])) {
function showResults() {
$("#searchResults").height(window.innerHeight - $("#bars").position().top - $("#bars").height() - $("#searchBar").height() - 50);
$("#searchResults").css("top",$("#bars").position().top+$("#bars").height()+$("#searchBar").height());
$("#searchResults").css("opacity",1);
$("#searchResults").css("padding",15);
}
function hideResults() {
$("#searchResults").css("top",$("#bars").position().top+$("#bars").height());
$("#searchResults").height("0px");
$("#searchResults").height(0);
$("#searchResults").css("opacity",0);
$("#searchResults").css("padding",0);
}
@ -837,17 +735,17 @@ if (!isset($_SESSION['lexis_view'])) {
$("#menu").css("left",($(this).position().left==0)?15:$(this).position().left);
var content = "";
if ($(this).attr("id")=="fileBtn") {
content = "<h2>File</h2><a href='javascript:newBtn();' class='btn'>Create File</a><a href='javascript:uploadBtn();' class='btn'>Upload File</a><a href='javascript:location.href=\"about.php\"' class='btn'>About LEXIS</a>";
content = "<h2>File</h2><a href='javascript:newBtn();' class='btn'>Create File</a><a href='javascript:uploadBtn();' class='btn'>Upload File</a><a href='javascript:newDirBtn();' class='btn'>Create Folder</a><a href='javascript:location.href=\"about.php\"' class='btn'>About Keepit</a>";
} else if ($(this).attr("id")=="actionsBtn") {
content = "<h2>Actions</h2><a href='javascript:newDirBtn();' class='btn'>Create Folder</a>";
content = "<h2>Actions</h2><a href='javascript:deleteBtn();' class='btn'>Delete</a>";
} else if ($(this).attr("id")=="viewBtn") {
content = "<h2>View</h2><a href='javascript:switchViewBtn();' class='btn'>Switch to <?php echo $_SESSION['lexis_view']=="icon"?"list":"icon"; ?> view</a>";
content = "<h2>View</h2><a href='javascript:switchViewBtn();' class='btn'>Switch to <?php echo $_SESSION['keepit_view']=="icon"?"list":"icon"; ?> view</a>";
}
currentMenu = $(this).attr("id");
$("#menu").html(content);
$("#menu").css("opacity",1);
}
// closePreviewPane();
closePreviewPane();
});
$(".dialog .mask").click(function() {
$(".dialog .window").css("border","1px solid #F00");
@ -884,27 +782,11 @@ if (!isset($_SESSION['lexis_view'])) {
$("#newDirDialog").fadeIn("fast");
hideMenu();
};
function renameBtn(id) {
$(".dialog").fadeOut("fast");
$("#renameDialog #renameFormItem").val(id);
$.ajax({
type:"POST",
url:"ajax/getTitleForID.php",
data: {ID:id},
dataType: "html",
success: function (msg) {
$("#renameDialog #renameSource").html(msg);
$("#renameDialog #renameTo").val("");
$("#renameDialog").fadeIn("fast");
hideMenu();
}
});
};
function switchViewBtn() {
$.ajax({
type:"POST",
url:"ajax/switchView.php",
data: {new_view:"<?php if ($_SESSION['lexis_view']=="icon") { echo "list"; } else { echo "icon"; } ?>"},
data: {new_view:"<?php if ($_SESSION['keepit_view']=="icon") { echo "list"; } else { echo "icon"; } ?>"},
dataType: "html",
success: function (msg) {
location.reload(true);
@ -912,12 +794,11 @@ if (!isset($_SESSION['lexis_view'])) {
});
}
document.title = "<?php echo ($current_dir == $row['lexis_dir']) ? "My Cloud" : $nowdir; ?> - LEXIS Cloud Office";
document.title = "<?php echo ($current_dir == $row['keepit_dir']) ? "My Cloud" : $nowdir; ?>";
</script>
<?php } else { ?>
<p>You have to be signed in to use LEXIS!</p>
<p>&nbsp;</p>
You have to be signed in to use Keepit!
<?php } ?>

View file

@ -1,808 +0,0 @@
<?php
// error_reporting (0);
include ("../auth.inc.php");
if ($_GET['switchDir']) {
$_SESSION['current_dir'] = $_GET['switchDir'];
echo "<script type='text/javascript'>location.href='index.php';</script>";
}
// DEFINE FUNCTIONS
function get_random_string($valid_chars, $length)
{
$random_string = "";
$num_valid_chars = strlen($valid_chars);
for ($i = 0; $i < $length; $i++) {
$random_pick = mt_rand(1, $num_valid_chars);
$random_char = $valid_chars[$random_pick - 1];
$random_string .= $random_char;
}
return $random_string;
}
function filesize_format($size, $sizes = array('Bytes', 'KB', 'MB', 'GB', 'TB', 'PB', 'EB', 'ZB', 'YB'))
{
if ($size == 0)
return ('');
return (round($size / pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $sizes[$i]);
}
$username = $_SESSION['username'];
$query = mysql_query("select * from `users` where username = '$username'") or die("Error: " . mysql_error());
$row = mysql_fetch_array($query);
if (!isset($row['lexis_dir']) || strlen($row['lexis_dir']) < 51) {
$k = get_random_string("ABCDEFGHIJKLMNOPQRSTUVWYZabcdefghijklmnopqrstuvwyz0123456789", 51);
mysql_query("update `users` set lexis_dir = '" . $k . "' where username = '$username'") or die("Error: " . mysql_error());
}
if (!isset($_SESSION['lexis_view'])) {
$_SESSION['lexis_view'] = "icon";
}
?>
<html>
<head>
<title>LEXIS Cloud Office</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="icon" href="../images/lexis.png" />
<link rel="stylesheet" href="../page.css" />
<link rel="stylesheet" href="dtree.css" />
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js" type="text/javascript"></script>
<script src="dtree.js" type="text/javascript"></script>
<style type="text/css">
#container {
overflow:hidden;
}
#topbar {
width:100%;
position:absolute;
left:0px;
margin:none;
padding:none;
z-index:104;
}
#topbar a.btn {
display:inline-block;
padding:15px 30px 15px 30px;
transition:all .3s ease-out;
-o-transition:all .3s ease-out;
-ms-transition:all .3s ease-out;
-moz-transition:all .3s ease-out;
-webkit-transition:all .3s ease-out;
}
#topbar a.btn:hover {
text-decoration:none;
}
#searchBar {
width:100%;
position:absolute;
left:0px;
}
#searchBar #search {
width:100%;
height:100%;
font-family:'Roboto', Arial, Helvetica;
font-weight:300;
font-size:15pt;
box-sizing:border-box; -moz-box-sizing:border-box;
padding:15px;
border:none;
outline:none;
}
#searchBar #search:focus {
box-shadow:none;
}
#navTree {
position:absolute;
left:0px;
width:30%;
box-sizing:border-box; -moz-box-sizing:border-box;
padding:15px;
overflow:auto;
margin:0px;
}
#mainContent {
position:absolute;
right:0px;
width:70%;
box-sizing:border-box; -moz-box-sizing:border-box;
padding:15px;
overflow:auto;
margin:0px;
}
.fileNode {
display:inline-block;
cursor:pointer;
width:35%;
height:60px;
padding-top:10px;
padding-bottom:15px;
padding-left:80px;
border:1px solid #999;
/* box-shadow:0px 3px 5px #999; */
margin:5px;
transition:all .3s ease-out;
-o-transition:all .3s ease-out;
-ms-transition:all .3s ease-out;
-moz-transition:all .3s ease-out;
-webkit-transition:all .3s ease-out;
overflow:hidden;
float:left;
}
.fileNode:hover {
background-color:#FDFDFD;
/* box-shadow:0px 3px 5px #666; */
}
.fileNode:active {
background-color:#DFDFDF;
/* box-shadow:0px 3px 5px #333; */
}
.nodeDirectory {
background-image:url(images/folder.png);
background-repeat:no-repeat;
background-size:80px;
}
.nodeFile {
background-image:url(images/files.png);
background-repeat:no-repeat;
background-size:80px;
}
.fileNode span {
font-size:16pt;
display:block;
}
#menu {
width:450px;
position:absolute;
left:0px;
background-color:#EEE;
z-index:100;
transition:all .3s ease-out;
-o-transition:all .3s ease-out;
-ms-transition:all .3s ease-out;
-moz-transition:all .3s ease-out;
-webkit-transition:all .3s ease-out;
box-shadow:0px 5px 10px #666;
box-sizing:border-box; -moz-box-sizing:border-box;
padding:15px;
}
#menu a.btn {
width:100%;
display:block;
box-sizing:border-box; -moz-box-sizing:border-box;
padding:10px;
background-color:#E0E0E0;
margin-bottom:10px;
box-shadow:inset 0px 3px 5px #999;
transition:all .3s ease-out;
-o-transition:all .3s ease-out;
-ms-transition:all .3s ease-out;
-moz-transition:all .3s ease-out;
-webkit-transition:all .3s ease-out;
}
#menu a.btn:hover {
box-shadow:inset 0px 3px 5px #666;
background-color:#FAFAFA;
text-decoration:none;
}
#menu a.btn:active {
background-color:#C2C2C2;
}
.dialog {
position:fixed;
top:0px;
left:0px;
display:none;
z-index:240;
}
.dialog .mask {
width:100%;
height:100%;
background-color:#FFF;
opacity:0.5;
position:fixed;
top:0px;
left:0px;
z-index:249;
}
.dialog .window {
z-index:251;
position:absolute;
top:0px;
left:0px;
background-color:#EEE;
border:1px solid #000;
padding:15px;
box-shadow:0px 5px 5px #999;
}
.newDialogInnerBtn {
display:block;
text-align:center;
}
.newDialogInnerBtn:hover {
text-decoration:none;
}
#searchResults {
position:absolute;
left:30px;
z-index:105;
transition:all .3s ease-out;
-o-transition:all .3s ease-out;
-ms-transition:all .3s ease-out;
-moz-transition:all .3s ease-out;
-webkit-transition:all .3s ease-out;
box-shadow:0px 5px 10px #666;
box-sizing:border-box; -moz-box-sizing:border-box;
padding:15px;
background-color:#EEE;
}
#searchResults #results {
box-sizing:border-box; -moz-box-sizing:border-box;
padding:15px;
width:100%;
height:100%;
overflow:auto;
z-index:67;
}
#searchResults #closeBtn {
z-index:68;
position:absolute;
right:50px;
top:10px;
width:30px;
height:30px;
cursor:pointer;
}
#previewPane {
z-index:110;
position:absolute;
left:-30%;
width:30%;
box-sizing:border-box; -moz-box-sizing:border-box;
padding:15px;
overflow:auto;
margin:0px;
display:block;
background-color:#EEE;
transition:all .3s ease-out;
-o-transition:all .3s ease-out;
-ms-transition:all .3s ease-out;
-moz-transition:all .3s ease-out;
-webkit-transition:all .3s ease-out;
border-right:3px solid #999;
}
#previewPane #closeBtn {
z-index:111;
position:absolute;
width:25px;
height:25px;
cursor:pointer;
right:10px;
top:10px;
}
</style>
</head>
<body>
<div id="container">
<?php include ("../header.php"); if ($_SESSION['logged']==1) { ?>
<?php
/*
PROCEDURE:
1. CHECK WHICH DIRECTORY WE ARE CURRENTLY VIEWING
2. GO THROUGH THE ENTIRE CLOUD SERVER
3a. CHECK FOR PERMISSIONS
3b. RETURN THE FILES THAT ARE IN THE CONTAINING FOLDER
4. ARRANGE THE FILES IN A CERTAIN ORDER
5. DISPLAY TO THE USER IN A NEAT, ORGANIZED METHOD.
*/
// STEP 1
$current_dir = (isset($_SESSION['current_dir'])) ? $_SESSION['current_dir'] : $row['lexis_dir'];
$_SESSION['current_dir'] = $current_dir;
// STEP 2
$fquery = mysql_query("select * from `lexis_docbank` where container = '$current_dir'") or die("Error: " . mysql_error());
$files = array();
$totalfiles = array();
while ($frow = mysql_fetch_array($fquery)) {
array_push($totalfiles, $frow);
/*
CONDITIONS:
1. IT MUST BE IN THE CONTAINING FOLDER
2. ITS OWNER IS THE USER || THE USER IS AN EDITOR || THE USER IS A VIEWER
*/
$val = false;
if ($frow['owner'] == $username) {
$val = true;
}
if ($frow['container'] != $current_dir) {
$val = false;
}
if ($val) {
array_push($files, $frow);
}
}
// STEP 3a
$cDir = "";
if ($_SESSION['current_dir'] == $row['lexis_dir']) {
$cDir = "<a href='index.php'>My Cloud</a>";
} else {
/* $nowdir = "[unknown directory]";
$upperDirectory = "";
$upperName = "";
$fquery = mysql_query("select * from `lexis_docbank`") or die("Error: " . mysql_error());
while ($frow = mysql_fetch_array($fquery)) {
if ($frow['id'] == $_SESSION['current_dir']) {
$nowdir = $frow['title'];
$upperDirectory = $frow['container'];
}
}
if ($upperDirectory == $row['lexis_dir']) {
$upperName = "My Cloud";
} else {
$fquery = mysql_query("select * from `lexis_docbank`") or die("Error: " . mysql_error());
while ($frow = mysql_fetch_array($fquery)) {
if ($frow['id'] == $upperDirectory) {
$upperName = $frow['title'];
}
}
}
$cDir = (($upperDirectory != $row['lexis_dir'])?"... ":"") . "<a href='index.php?switchDir=" . $upperDirectory . "'>" . $upperName . "</a> &raquo; <a href='index.php'>" . $nowdir . "</a>"; */
$nowdir = "[unknown directory]";
$fquery = mysql_query("select * from `lexis_docbank` where id='".$_SESSION['current_dir']."'") or die("Error: " . mysql_error());
while ($frow = mysql_fetch_array($fquery)) {
$nowdir = $frow['title'];
}
if ($_SESSION['current_dir']==$row['lexis_dir']) {
$cDir = "<a href='index.php?switchDir=" . $row['lexis_dir'] . "'>My Cloud</a>";
} else {
$cur = $_SESSION['current_dir'];
$cDir = "<a href='index.php?switchDir=" . $cur . "'>" . $nowdir . "</a>";
$upperDirectory = "";
$upperName = "";
$cName = "";
while ($cur != $row['lexis_dir']) {
$fquery = mysql_query("select * from `lexis_docbank` where id='".$cur."'") or die("Error: " . mysql_error());
$frow = mysql_fetch_array($fquery);
$cName = $frow['title'];
$upperDirectory = $frow['container'];
$fquery = mysql_query("select * from `lexis_docbank` where id='".$upperDirectory."'") or die("Error: " . mysql_error());
$frow = mysql_fetch_array($fquery);
$upperName = $frow['title'];
$cDir = "<a href='index.php?switchDir=" . $upperDirectory . "'>" . $upperName . "</a> &raquo; " . $cDir;
$cur = $upperDirectory;
}
$cDir = "<a href='index.php?switchDir=" . $row['lexis_dir'] . "'>My Cloud</a> " . $cDir;
}
// echo "Current directory: <b>" . $nowdir . "</b> (<a href='index.php?switchDir=" . $upperDirectory . "'>Back to " . $upperName . "</a>)";
}
echo "<br />";
function getLink($id, $ext) {
if ($ext == "scribe") {
return "apps/scribe.php?doc=open&id=".$id;
} else if ($ext == "cascade") {
return "apps/cascade.php?doc=open&id=".$id;
} else {
return "files/".$id.".".$ext;
}
return "";
}
?>
<div id="searchBar">
<input type="text" id="search" autofocus autocomplete="off" placeholder="Search your cloud..." />
</div>
<div id="topbar">
<a href="javascript:void(0);" id="fileBtn" class="btn color1">File</a>
<a href="javascript:void(0);" id="actionsBtn" class="btn color6">Actions</a>
<a href="javascript:void(0);" id="viewBtn" class="btn color6">View</a>
&nbsp;&nbsp;&nbsp;
<div id="navigation" style="display:inline-block;">
<?php echo $cDir; ?>
</div>
</div>
<div id="navTree">
<script type="text/javascript">
d = new dTree ('d');
<?php
$c = 1;
$t = array();
$all = array();
$root = array(
"id" => $row['lexis_dir'],
"type" => "lexis_directory",
"owner" => $_SESSION['username'],
"container" => "n/a",
"title" => "My Cloud",
);
array_push($t,$root);
$fquery = mysql_query("select * from `lexis_docbank`") or die("Error: " . mysql_error());
while ($frow = mysql_fetch_array($fquery)) {
array_push ($all,$frow);
}
foreach ($all as $one) {
if ($one['owner']==$_SESSION['username']) {
if ($one['type']=='lexis_directory') {
array_push($t,$one);
}
}
}
for ($i=0;$i<count($t);$i++) {
$one = $t[$i];
$k = -1;
for ($j=0;$j<count($t);$j++) {
$two = $t[$j];
if ($two['id']==$one['container']) {
$k = $j;
}
}
echo "d.add(".$i.",".$k.",\"".$one['title']."\",'index.php?switchDir=".$one['id']."','','','images/dTree/folder.png','images/dTree/folderOpen.png');\r\n";
}
?>
document.write (d);
</script>
</div>
<div id="mainContent">
<?php
function getIconURL($ext) {
$x = scandir("icons/");
if (in_array($ext.".png",$x)) {
return "icons/".$ext.".png";
} else {
return "images/file.png";
}
}
// ORGANIZE THE FILES
$ids = array();
$titles = array();
$sizes = array();
$types = array();
foreach ($files as $file) {
if ($file['type'] != "lexis_directory") {
$thissize = filesize("files/" . $file['id'] . "." . $file['type']);
array_push($ids, $file['id']);
array_push($titles, $file['title']);
array_push($sizes, $thissize);
array_push($types, $file['type']);
} else {
array_push($ids, $file['id']);
array_push($titles, $file['title']);
array_push($sizes, "");
array_push($types, $file['type']);
}
}
if (isset($_SESSION['sort']))
$meth = $_SESSION['sort'];
else
$meth = "title";
switch ($meth) {
case "title":
array_multisort($titles, SORT_STRING, $ids, SORT_STRING, $types, SORT_STRING, $sizes, SORT_NUMERIC);
break;
case "type":
array_multisort($types, SORT_STRING, $ids, SORT_STRING, $titles, SORT_STRING, $sizes, SORT_NUMERIC);
break;
case "size":
array_multisort($sizes, SORT_NUMERIC, $ids, SORT_STRING, $types, SORT_STRING, $titles, SORT_STRING);
break;
default:
array_multisort($titles, SORT_STRING, $ids, SORT_STRING, $types, SORT_STRING, $sizes, SORT_NUMERIC);
break;
}
?>
<?php if ($_SESSION['lexis_view']=='icon') { ?>
<script type="text/javascript">
function filesize_format(size) {
var i = -1;
var byteUnits = [' KB', ' MB', ' GB', ' TB', 'PB', 'EB', 'ZB', 'YB'];
do {
size = size / 1024;
i++;
} while (size > 1024);
return Math.max(size, 0.1).toFixed(1) +" "+ byteUnits[i];
};
function fileNode (id, title, type, size) {
this.id = id;
this.title = title;
this.type = type;
this.size = size;
function str() {
var t = "";
if (this.type=="lexis_directory") { t+="<a href='index.php?switchDir="+this.id+"'>"; }
else { t+="<a href='files/"+this.id+"."+this.type+"' target='_blank'>"; }
t += "<div class='node'><h3>"+this.title+"</h3>"+filesize_format(this.size)+"</div>";
t += "</a>";
return t;
}
}
</script>
<?php
$count = 0;
echo "<!-- WRITING THE NODES -->";
for ($i = 0; $i < count($files); $i++) {
if ($types[$i] == "lexis_directory") {
// echo "var node".$count." = new node('".$ids[$i]."','".$titles[$i]."','".$types[$i]."','".$sizes[$i]."');";
$t = "";
$t .= "<a href='javascript:showPreviewPane(\"".$ids[$i]."\");'>"; //href='index.php?switchDir=".$ids[$i]."'>";
$t .= "<div class='fileNode nodeDirectory' contextmenu='menu".$i."'><span>".$titles[$i]."</span>Directory</div>";
$t .= "</a>\n";
echo $t;
$count++;
}
echo "\r\n";
}
for ($i = 0; $i < count($files); $i++) {
if ($types[$i] != "lexis_directory") {
// echo "var node".$count." = new node('".$ids[$i]."','".$titles[$i]."','".$types[$i]."','".$sizes[$i]."');";
$t = "";
$t .= "<a href='javascript:showPreviewPane(\"".$ids[$i]."\");'>"; //href='".getLink($ids[$i],$types[$i])."' target='_blank'>";
$t .= "<div class='fileNode nodeFile' style='background-image:url(".getIconURL($types[$i]).");'><span>".$titles[$i]."</span>" . strtoupper($types[$i]) . " file<br />".filesize_format($sizes[$i])."</div>";
$t .= "</a>\n";
echo $t;
$count++;
}
echo "\r\n";
}
?>
<?php } else { ?>
<div id="dblClickHint"></div>
<table id="mainTable" style="width:80%; border-collapse:collapse;font-weight:300;">
<tr style="background-color:#DDD;">
<th style="width:30px;"></th>
<th>Name</th>
<th>Size</th>
<th>Type</th>
</tr>
<?php
for ($i = 0; $i < count($files); $i++) {
if ($types[$i] == "lexis_directory") {
echo "<tr class='row'>";
echo "<td><img src='images/folder.png' alt='Folder' width='60' height='60' /></td>";
echo "<td style='cursor:pointer;' onclick='javascript:location.href=\"index.php?switchDir=" . $ids[$i] . "\";'>" . $titles[$i] . "</td>";
echo "<td></td>";
echo "<td>Directory</td>";
echo "</tr>";
}
echo "\r\n";
}
for ($i = 0; $i < count($files); $i++) {
if ($types[$i] != "lexis_directory") {
echo "<tr class='row'>";
echo "<td><img src='".getIconURL($types[$i])."' alt='File' width='60' height='60' /></td>";
echo "<td><a href='".getLink($ids[$i],$types[$i])."' target='_blank'>" . $titles[$i] . "</a></td>";
echo "<td>" . filesize_format($sizes[$i]) . "</td>";
echo "<td>" . strtoupper($types[$i]) . " file</td>";
echo "</tr>";
}
echo "\r\n";
}
?>
</table>
<?php } ?>
</div>
<div id="menu" style="opacity:0;"></div>
<div id="searchResults">
<img src="images/closeIcon.png" id="closeBtn" />
<div id="results"></div>
</div>
<div id="previewPane">
&nbsp;
</div>
<div id="uploadDialog" class="dialog">
<div class="mask"></div>
<div class="window">
<p><b>Upload File</b><a style="position:absolute; top:5px; right:5px;" href="#" class="close"><img src="images/closeIcon.png" style="width:32px;height:32px;" alt="Close" /></a></p>
<form action="upload.php" style="display:inline;" enctype="multipart/form-data" method="post" id="uploadForm">
<input type="file" name="uploaded" id="uploaded" />
</form>
<p><a class="button color2" href="javascript:$('#uploadForm').submit();">Upload</a></p>
</div>
</div>
<div id="newDialog" class="dialog">
<div class="mask"></div>
<div class="window">
<p><b>Create File</b><a style="position:absolute; top:5px; right:5px;" href="#" class="close"><img src="images/closeIcon.png" style="width:32px;height:32px;" alt="Close" /></a></p>
<p>Choose the type of file you want to create.</p>
<p class="buttonGroup">
<a class="newDialogInnerBtn button color5" href="#" id="newDirBtn">Directory (folder)</a>
<a class="newDialogInnerBtn button color1" target="_blank" href="apps/scribe.php?doc=new" id="newScribeBtn">Scribe Document</a>
<a class="newDialogInnerBtn button color2" target="_blank" href="apps/cascade.php?doc=new" id="newCascadeBtn">Cascade Spreadsheet (EXPERIMENTAL)</a>
</p>
</div>
</div>
<div id="newDirDialog" class="dialog">
<div class="mask"></div>
<div class="window">
<p><b>Create Directory</b><a style="position:absolute; top:5px; right:5px;" href="#" class="close"><img src="images/closeIcon.png" style="width:32px;height:32px;" alt="Close" /></a></p>
<p>Give your new folder a name.</p>
<p>
<form action="newdir.php" method="POST">
<input type="text" name="name" class="tf" autocomplete="off" />
<input type="submit" class="button color2" value="Create Folder!" />
</form>
</p>
</div>
</div>
<script type="text/javascript">
var currentMenu = "fileBtn";
function showPreviewPane(id) {
$.ajax({
type:"POST",
url:"ajax/previewPane.php",
data: {id:id},
dataType: "html",
success: function (msg) {
$("#previewPane").html(msg);
$("#previewPane").css("left","0px");
}
});
}
function closePreviewPane() {
$("#previewPane").css("left","-30%");
}
setInterval(function() {
$("#searchResults").width(window.innerWidth*4/5);
$("#searchBar").css("top",$("#bars").position().top + $("#bars").height());
$("#searchBar").css("width",window.innerWidth);
$("#topbar").css("top",$("#bars").position().top + $("#bars").height() + $("#searchBar").height());
$("#searchResults").css("top",$("#bars").position().top + $("#bars").height() + $("#searchBar").height());
$("#menu").css("top",$("#bars").position().top + $("#bars").height() + $("#searchBar").height() + $("#topbar").height());
$("#menu").height(window.innerHeight - $("#bars").position().top - $("#bars").height() - $("#searchBar").height() - $("#topbar").height() - 50);
$("#navTree").css("top",$("#bars").position().top + $("#bars").height() + $("#searchBar").height() + $("#topbar").height());
$("#navTree").height(window.innerHeight - $("#bars").position().top - $("#bars").height() - $("#searchBar").height() - $("#topbar").height() - 30);
$("#previewPane").css("top",$("#bars").position().top + $("#bars").height() + $("#searchBar").height() + $("#topbar").height());
$("#previewPane").height(window.innerHeight - $("#bars").position().top - $("#bars").height() - $("#searchBar").height() - $("#topbar").height() - 30);
$("#mainContent").css("top",$("#bars").position().top + $("#bars").height() + $("#searchBar").height() + $("#topbar").height());
$("#mainContent").height(window.innerHeight - $("#bars").position().top - $("#bars").height() - $("#searchBar").height() - $("#topbar").height() - 30);
$("#uploadDialog .window").css("left",(window.innerWidth/2-150)+"px");
$("#uploadDialog .window").css("top",(window.innerHeight/2-125)+"px");
$("#newDialog .window").css("left",(window.innerWidth/2-200)+"px");
$("#newDialog .window").css("top",(window.innerHeight/2-150)+"px");
$("#newDirDialog .window").css("left",(window.innerWidth/2-150)+"px");
$("#newDirDialog .window").css("top",(window.innerHeight/2-125)+"px");
$("#uploadDialog .window").css("width",300);
$("#uploadDialog .window").css("height",250);
$("#newDialog .window").css("width",400);
$("#newDialog .window").css("height",300);
$("#newDirDialog .window").css("width",300);
$("#newDirDialog .window").css("height",250);
});
$("#search").keypress(function(e) {
if ($("#search").val().length>0) {
var searchTerm = $("#search").val();
$.ajax({
type:"POST",
url:"ajax/searchAjax.php",
data: {words:searchTerm},
dataType: "html",
success: function (msg) {
$("#searchResults #results").html(msg);
showResults();
}
});
} else {
hideResults();
}
});
$("#searchResults #closeBtn").click(function() {
hideResults();
});
function showResults() {
$("#searchResults").height(window.innerHeight - $("#bars").position().top - $("#bars").height() - $("#searchBar").height() - 50);
$("#searchResults").css("opacity",1);
$("#searchResults").css("padding",15);
}
function hideResults() {
$("#searchResults").height(0);
$("#searchResults").css("opacity",0);
$("#searchResults").css("padding",0);
}
hideResults();
$("#topbar .btn").click(function () {
if ($("#menu").css("opacity")==1 && currentMenu==$(this).attr("id")) {
hideMenu()
} else {
if ($("#menu").css("opacity")==1) {
hideMenu();
}
$("#menu").css("left",($(this).position().left==0)?15:$(this).position().left);
var content = "";
if ($(this).attr("id")=="fileBtn") {
content = "<h2>File</h2><a href='javascript:newBtn();' class='btn'>Create File</a><a href='javascript:uploadBtn();' class='btn'>Upload File</a><a href='javascript:newDirBtn();' class='btn'>Create Folder</a><a href='javascript:location.href=\"about.php\"' class='btn'>About LEXIS</a>";
} else if ($(this).attr("id")=="actionsBtn") {
content = "<h2>Actions</h2><a href='javascript:deleteBtn();' class='btn'>Delete</a>";
} else if ($(this).attr("id")=="viewBtn") {
content = "<h2>View</h2><a href='javascript:switchViewBtn();' class='btn'>Switch to <?php echo $_SESSION['lexis_view']=="icon"?"list":"icon"; ?> view</a>";
}
currentMenu = $(this).attr("id");
$("#menu").html(content);
$("#menu").css("opacity",1);
}
closePreviewPane();
});
$(".dialog .mask").click(function() {
$(".dialog .window").css("border","1px solid #F00");
$(".dialog .window").css("box-shadow","0px 5px 5px #F00");
setTimeout(function() {
$(".dialog .window").css("border","1px solid #000");
$(".dialog .window").css("box-shadow","0px 5px 5px #999");
},1000);
});
$(".dialog .close").click(function() {
$(".dialog").fadeOut("fast");
});
function hideMenu() {
$("#menu").css("opacity",0);
$("#menu").css("left",-1*$("#menu").width());
}
hideMenu();
function uploadBtn() {
$("#uploadDialog").fadeIn("fast");
hideMenu();
};
function newBtn() {
$("#newDialog").fadeIn("fast");
hideMenu();
};
$("#newScribeBtn").click (function() {
$(".dialog").fadeOut("fast");
});
$("#newCascadeBtn").click (function() {
$(".dialog").fadeOut("fast");
});
function newDirBtn() {
$(".dialog").fadeOut("fast");
$("#newDirDialog").fadeIn("fast");
hideMenu();
};
function switchViewBtn() {
$.ajax({
type:"POST",
url:"ajax/switchView.php",
data: {new_view:"<?php if ($_SESSION['lexis_view']=="icon") { echo "list"; } else { echo "icon"; } ?>"},
dataType: "html",
success: function (msg) {
location.reload(true);
}
});
}
document.title = "<?php echo ($current_dir == $row['lexis_dir']) ? "My Cloud" : $nowdir; ?>";
</script>
<?php } else { ?>
You have to be signed in to use LEXIS!
<?php } ?>
</div>
</body>
</html>

View file

@ -21,7 +21,7 @@ if (isset($_POST['name'])) {
$newdir = $_POST['name'] or die ("No name");
$use_dir = $_SESSION['current_dir'];
$username = $_SESSION['username'];
mysql_query("insert into lexis_docbank (id,title,container,owner,type,dateMod) values('$id','$newdir','$use_dir','$username','lexis_directory',NOW())") or die("Error: " . mysql_error());?>
mysql_query("insert into keepit_docbank (id,title,container,owner,type,dateMod) values('$id','$newdir','$use_dir','$username','keepit_directory',NOW())") or die("Error: " . mysql_error());?>
<script type="text/javascript">
location.href='index.php';

View file

@ -4,7 +4,7 @@ include ("../auth.inc.php");
$id = $_POST['renameFormItem'] or die ("Error: no variable given.");
$nName = $_POST['name'] or die ("Error: no variable given.");
mysql_query("update `lexis_docbank` set title='".$nName."' where id='".$id."'") or die ("Error: couldn't rename ");
mysql_query("update `keepit_docbank` set title='".$nName."' where id='".$id."'") or die ("Error: couldn't rename ");
?>

View file

@ -1,70 +0,0 @@
//
// main.cpp
// Program 1
//
// Created by Liyang Zhang 2016 on 6/10/13.
// Copyright (c) 2013 Liyang Zhang 2016. All rights reserved.
//
//precompiler directives:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main( )
{
// ********************* CONSTANTS *********************
const double PI = 3.141592653589793238462643383279502884197;
// ********************* PROBLEM 1 *********************
double L = 6;
double r = 5;
double TA = PI*r*L + PI*r*r;
cout << "Total Area = " << TA << " Units squared" << endl;
// ********************* PROBLEM 2 *********************
double a = 7;
double b = 8.4;
double c = sqrt(a*a + b*b);
cout << "c = " << c << endl;
// ********************* PROBLEM 3 *********************
double h = 0.6;
double b1 = 1.3;
double b2 = 3.5;
double A = 0.5 * h * (b1 + b2);
cout << "Area = " << A << " Units squared" << endl;
// ********************* PROBLEM 4 *********************
h = 12;
r = 3;
double volume = PI * r * r * h;
cout << "Volume = " << volume << " Units cubed" << endl;
// ********************* PROBLEM 5 *********************
double d1 = 3;
double d2 = 5;
double d3 = 7;
double s = (d1 + d2 + d3) /2;
A = sqrt(s*(s-d1)*(s-d2)*(s-d3));
cout << "Area = " << A << " Units squared" << endl;
// ********************* PROBLEM 6 *********************
double diameter = 10;
double SA = pow(diameter,2) - PI*pow(diameter/2,2);
cout << "Shaded Area = " << SA << " Units squared" << endl;
cout << endl << endl << "done" << endl;
return 0;
}

View file

@ -1,72 +0,0 @@
//
// main.cpp
// Program 1
//
// Created by Liyang Zhang 2016 on 6/10/13.
// Copyright (c) 2013 Liyang Zhang 2016. All rights reserved.
//
//precompiler directives:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main( )
{
// ********************* PROBLEM 1 *********************
double a[5];
for (int i=0;i<5;i++) {
cout << "Please enter a number: ";
cin >> a[i];
}
cout << endl << "The average of your numbers is " << (a[0]+a[1]+a[2]+a[3]+a[4])/5 << "." << endl;
cout << endl;
// ********************* PROBLEM 2 *********************
for (int i=0;i<5;i++) {
cout << "Please enter a number: ";
cin >> a[i];
}
double product = a[0]*a[1]*a[2]*a[3]*a[4];
cout << endl << "The product of your numbers is " << product << "." << endl;
// ********************* PROBLEM 3 *********************
double sum = 0;
for (int i=25;i<=50;i++) {
sum += i;
}
cout << endl << "The sum of the consecutive integers from 25 to 50 is " << sum << "." << endl;
// ********************* PROBLEM 3 *********************
product = 1;
for (int i=3;i<=11;i+=2) {
product *= i;
}
cout << endl << "The product of the odd integers from 3 to 11 is " << product << "." << endl;
// ********************* PROBLEM 4 *********************
double frac = 1, decimal = 1;
for (int i=2;i<=6;i++) {
frac *= i;
decimal /= i;
}
cout << endl << "The product of 1/2, 1/3, 1/4, 1/5, and 1/6 is 1/" << frac << ", or " << decimal << "." << endl;
return 0;
}

View file

@ -1,96 +0,0 @@
//
// main.cpp
// Program 1
//
// Created by Liyang Zhang 2016 on 6/10/13.
// Copyright (c) 2013 Liyang Zhang 2016. All rights reserved.
//
//precompiler directives:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main( )
{
// ********************* PROBLEM 1 *********************
for (int i=0;i<4;i++) {
for (int j=7;j<=10;j++) {
cout << j << " ";
}
cout << endl;
}
cout << endl;
for (int i=0;i<4;i++) {
cout << "* ";
for (int j=2;j<=10;j+=2) {
cout << j << " ";
}
cout << endl;
}
cout << endl;
for (int i=0;i<4;i++) {
for (int j=1;j<=4;j++) {
cout << j << " ";
}
cout << "0 ";
for (int j=6;j<=9;j++) {
cout << j << " ";
}
cout << endl;
}
cout << endl;
// ********************* PROBLEM 2 *********************
for (int i=0;i<3;i++) {
for (int j=0;j<3;j++) {
cout << "A " << (j+1) << " ";
}
cout << endl;
}
cout << endl;
for (int i=0;i<4;i++) {
cout << "<";
for (int j=0;j<10;j++) {
cout << "*";
}
cout << ">" << endl;
}
cout << endl;
for (int i=0;i<6;i++) {
for (int j=1;j<=4;j++) {
if (i%2==0)
cout << j << " ";
else
cout << 5-j << " ";
}
cout << endl;
}
cout << endl;
// ********************* PROBLEM 3 *********************
for (int i=0;i<3;i++) {
cout << "$ ";
for (int j=0;j<3;j++) {
if (j > 0) cout << "# ";
for (int k=1;k<=5;k++) {
cout << k << " ";
}
}
cout << "$" << endl;
}
return 0;
}

View file

@ -1,61 +0,0 @@
//
// main.cpp
// Program 1
//
// Created by Liyang Zhang 2016 on 6/10/13.
// Copyright (c) 2013 Liyang Zhang 2016. All rights reserved.
//
//precompiler directives:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main( )
{
// ********************* PROBLEM 1 *********************
ifstream f1;
f1.open("nbrs1.dat");
double data;
while (f1 >> data) {
if (data > 25) {
cout << data << endl;
}
}
cout << endl;
// ********************* PROBLEM 2 *********************
double S = 25, R, D, T;
cout << fixed;
cout << "Speed (MPH)\tReaction Dist\tBraking Dist\tTotal Dist" << endl;
do {
R = S*5200/7200;
D = 0.06*S*S;
T = R+D;
cout << setprecision(1) << S << "\t\t" << R << "\t\t" << D << "\t\t" << T << endl;
S += 5;
} while (S <= 90);
// ********************* PROBLEM 3 *********************
int Y = 1;
double amount = 500;
cout << "Year\tAmount" << endl;
do {
amount *= 1.05;
cout << setprecision(2) << Y << "\t$" << amount << endl;
Y += 1;
} while (Y <= 10);
return 0;
}

View file

@ -1,67 +0,0 @@
//
// main.cpp
// Program 1
//
// Created by Liyang Zhang 2016 on 6/10/13.
// Copyright (c) 2013 Liyang Zhang 2016. All rights reserved.
//
//precompiler directives:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main( )
{
// ********************* PROBLEM 1 *********************
double population = 1700;
for (int i=0;i<8;i++) {
population *= 1.04;
}
cout << "At Malcolm Community College, there will be " << (int) population << " students in 8 years." << endl;
cout << endl;
// ********************* PROBLEM 2 *********************
ifstream f1;
f1.open("jobs.dat");
cout << fixed;
double a,b;
while (f1 >> a >> b) {
cout << "When Ann Sparks worked " << setprecision(0) << a << " hours at $" << setprecision(2) << b << " per hour she earned $" << a*b << "." << endl;
}
cout << endl;
// ********************* PROBLEM 3 *********************
ifstream f2;
f2.open("rooms.dat");
double sum;
while (f2 >> a >> b) {
sum += a*b;
}
cout << "Mr. Thomas' building has " << setprecision(0) << sum << " square feet of floor space." << endl;
cout << endl;
// ********************* PROBLEM 5 *********************
double value = 37000;
for (int i=0;i<5;i++) {
value *= 0.75;
}
cout << "Hook-U's truck is worth $" << setprecision(2) << value << " in 5 years." << endl;
return 0;
}

View file

@ -1,79 +0,0 @@
//
// main.cpp
// Program 1
//
// Created by Liyang Zhang 2016 on 6/10/13.
// Copyright (c) 2013 Liyang Zhang 2016. All rights reserved.
//
//precompiler directives:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main( )
{
// ********************* PROBLEM 1 *********************
double a,b;
ifstream f1;
f1.open("p14_1.dat");
while (f1 >> a >> b) {
if (a<0) {
cout << a*b << endl;
} else {
cout << a+b << endl;
}
}
cout << endl;
// ********************* PROBLEM 2 *********************
ifstream f2;
f2.open("p14_2.dat");
while (f2 >> a >> b) {
if (a>0) {
if (b<0) {
cout << a << endl;
} else {
cout << b << endl;
}
} else {
cout << a+b << endl;
}
}
cout << endl;
// ********************* PROBLEM 3 *********************
string c;
ifstream f3;
f3.open("p14_3.dat");
cout << fixed;
cout << "EMPLOYEE\tREGULAR HOURLY RATE\tNUMBER OF HOURS WORKED\tPAY" << endl;
while (f3 >> c >> a >> b) {
string q = "";
if (c.length() < 8) q = "\t\t"; else q = "\t";
double pay = 0;
if (b<=40) {
pay = a*b;
} else {
pay = a*40;
b -= 40;
pay += 1.5*a*b;
}
cout << setprecision(2) << c << q << a << "\t\t\t" << b << "\t\t\t" << pay << endl;
}
return 0;
}

View file

@ -1,51 +0,0 @@
//
// main.cpp
// Program 2
//
// Created by Liyang Zhang 2016 on 6/10/13.
// Copyright (c) 2013 Liyang Zhang 2016. All rights reserved.
//
//precompiler directives:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main( )
{
// ********************* PROBLEM 1 *********************
double C = 30;
double F = 9*C/5 + 32;
cout << "CELSIUS\tFAHRENHEIT" << endl << C << "\t\t" << F << endl << endl;
// ********************* PROBLEM 2 *********************
double A = 78000;
double R = 6.45;
double T = A * R / 100;
cout << "The tax on a house with an assessed value of $" << A << " and a tax rate of $" << R << "per $100 is $" << T << "." << endl << endl;
// ********************* PROBLEM 3 *********************
double T1 = 89;
double T2 = 72;
double T3 = 86;
double average = (T1 + T2 + T3) / 3;
cout << "test1\ttest2\ttest3\taverage" << endl << T1 << "\t\t" << T2 << "\t\t" << T3 << "\t\t" << average << endl << endl;
// ********************* PROBLEM 4 *********************
double H = 38;
R = 4.75;
double P = H * R;
cout << "Todd worked " << H << " hours at a rate of $" << R << " and earned $" << P << "." << endl;
cout << endl << endl << "done" << endl;
return 0;
}

View file

@ -1,56 +0,0 @@
//
// main.cpp
// Program 1
//
// Created by Liyang Zhang 2016 on 6/10/13.
// Copyright (c) 2013 Liyang Zhang 2016. All rights reserved.
//
//precompiler directives:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main( )
{
cout << std::scientific;
// ********************* PROBLEM 3 *********************
double a = 1.922e+14;
int b = 75;
cout << "The product of " << a << " and " << b << " is " << (a*b) << "." << endl;
// ********************* PROBLEM 4 *********************
a = 6.22e-8;
double c = 3.511e-7;
cout << "The sum of " << a << " and " << c << " is " << (a+c) << "." << endl;
// ********************* PROBLEM 5 *********************
double LS = 186000;
double YS = 365 * 24 * 60 * 60;
cout << "The distance light can travel in one year is " << (LS * YS) << " miles." << endl;
// ********************* PROBLEM 6 *********************
double MILE = 5280;
double W = 62.4;
cout << "The weight of 1000 cubic miles is " << 1000*pow(MILE,3)*W << " pounds." << endl;
// ********************* PROBLEM 7 *********************
double L = 5000, H = 9140, R = 516;
W = 199;
cout << "The total number of sheets of paper in a warehouse that have been stacked " << L << " reams long by " << W << " reams wide by " << H << " reams high is " << (L*W*H*R) << " sheets." << endl;
cout << endl << endl << "done" << endl;
return 0;
}

View file

@ -1,58 +0,0 @@
//
// main.cpp
// Program 1
//
// Created by Liyang Zhang 2016 on 6/10/13.
// Copyright (c) 2013 Liyang Zhang 2016. All rights reserved.
//
//precompiler directives:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main( )
{
cout << std::scientific;
cout << "This program will determine the appropriate letter grade and message for a certain percentage.\n\nInput the percentage of the grade here and press <enter>\n > ";
int percent;
cin >> percent;
string letter, message;
if (percent > 100) {
letter = "A+";
message = "Excellent";
} else if (percent <= 100 && percent >= 90) {
letter = "A";
message = "Solid work";
} else if (percent < 90 && percent >= 80) {
letter = "B";
message = "Doing fine";
} else if (percent < 80 && percent >= 70) {
letter = "C";
message = "Need to work harder";
} else if (percent < 70 && percent >= 60) {
letter = "D";
message = "On probation";
} else if (percent < 60 && percent >= 0) {
letter = "F";
message = "You are failing";
} else {
letter = "N/A";
message = "Can't have negative score";
}
cout << "\tGrade\t\tLetter Grade\t\tMessage" << endl << "\t" << percent << "\t\t" << letter << "\t\t\t" << message << endl;
cout << endl << endl << "done" << endl;
return 0;
}

View file

@ -1,88 +0,0 @@
//
// main.cpp
// Program 1
//
// Created by Liyang Zhang 2016 on 6/10/13.
// Copyright (c) 2013 Liyang Zhang 2016. All rights reserved.
//
//precompiler directives:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main( )
{
// ********************* PROBLEM 1 *********************
cout << "Input the mortgage amount requested and press <enter>:\n > ";
double mortgage;
cin >> mortgage;
double DP;
if (mortgage < 0 || mortgage >100000) {
cout << "Please input a reasonable mortgage amount (less than 100000)";
return 0;
} else {
if (mortgage <= 50000) {
DP += 0.02 * mortgage;
} else {
DP += 0.02 * 50000;
mortgage -= 50000;
if (mortgage <= 25000) {
DP += 0.2 * mortgage;
}else {
DP += 0.2 * 25000;
mortgage -= 25000;
DP += 0.25 * mortgage;
}
}
}
cout << "Your mortgage of $" << mortgage << " requires a down payment of $" << DP << "." << endl;
// ********************* PROBLEM 2 *********************
double T1, T2, T3, T4;
cout << "Enter T1: ";
cin >> T1;
cout << "Enter T2: ";
cin >> T2;
cout << "Enter T3: ";
cin >> T3;
cout << "Enter T4: ";
cin >> T4;
double sum = T1 + T2 + T3 + T4;
string pass = "pass";
if (sum <= 260) {
pass = "fail";
}
cout << "\tT1\tT2\tT3\tT4\tSum\tFinal Grade" << endl;
cout << "\t" << T1 << "\t" << T2 << "\t" << T3 << "\t" << T4 << "\t" << sum << "\t" << pass << endl;
// ********************* PROBLEM 3 *********************
double sales, commission;
cout << "Enter the sales\n > ";
cin >> sales;
if (sales >= 15000)
commission = 0.15 * sales;
else
commission = 0.0725 * sales;
cout << "\tSales\tCommission" << endl;
cout << "\t" << sales << "\t" << commission << endl;
cout << endl << endl << "done" << endl;
return 0;
}

View file

@ -1,52 +0,0 @@
//
// main.cpp
// Program 1
//
// Created by Liyang Zhang 2016 on 6/10/13.
// Copyright (c) 2013 Liyang Zhang 2016. All rights reserved.
//
//precompiler directives:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main( )
{
// ********************* CONSTANTS *********************
const double PI = 3.1415926535897932384626433832795028841971693993;
// ********************* PROBLEM 1 *********************
double F = -35;
double C;
cout << "C\tF" << endl;
do {
C = 5*(F-32)/9;
cout << F << "^F\t" << C << "^C" << endl;
F += 5;
} while (F <= 125);
cout << endl;
// ********************* PROBLEM 2 *********************
double radius = 2;
double area, circumference;
cout << "Radius\tCircumference\tArea" << endl;
do {
circumference = 2 * radius * PI;
area = radius * radius * PI;
cout << radius << "\t" << circumference << "\t\t" << area << endl;
radius += 5;
} while (radius <= 47);
cout << endl << endl << "done" << endl;
return 0;
}

View file

@ -1,79 +0,0 @@
//
// main.cpp
// Program 1
//
// Created by Liyang Zhang 2016 on 6/10/13.
// Copyright (c) 2013 Liyang Zhang 2016. All rights reserved.
//
//precompiler directives:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main( )
{
// ********************* PROBLEM 3 *********************
int i = 1;
double s = 1, c = 1;
cout << "Integer\tSquare Root\tCube Root" << endl;
do {
cout << i << "\t" << s << "\t\t" << c << endl;
i += 1;
s = pow(i,0.5);
c = pow(i,1./3);
} while (c < 2.5);
cout << endl;
// ********************* PROBLEM 4 *********************
double cost = 1.95;
int year = 2013;
cout << "Year\tCost" << endl;
cout << fixed;
do {
cout << year << "\t" << setprecision(2) << cost << endl;
year += 1;
cost *= 1.05;
} while (cost <= 10);
cout << year << "\t" << cost << endl;
// ********************* PROBLEM 5 *********************
int x;
int x1;
cout << "What is the value of x?\n > ";
cin >> x1;
if (abs(x1) != x1) {
cout << "Can't be negative." << endl;
return 0;
} else {
x = x1;
int c = 0;
do {
if (x % 2 == 0) {
x /= 2;
} else {
x = 3*x+1;
}
c += 1;
cout << x << " ";
} while (x != 1);
cout << "It took " << c << " replacements." << endl;
}
return 0;
}

View file

@ -1,47 +0,0 @@
//
// main.cpp
// Program 1
//
// Created by Liyang Zhang 2016 on 6/10/13.
// Copyright (c) 2013 Liyang Zhang 2016. All rights reserved.
//
//precompiler directives:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main( )
{
cout << fixed;
double amount, rate, payment;
cout << "Amount? ";
cin >> amount;
cout << "Rate? ";
cin >> rate;
cout << "Payment? ";
cin >> payment;
int month = 1;
double interest, principal;
cout << "MONTH\tAMOUNT\tINTEREST\tTO PRINCIPAL" << endl;
do {
interest = rate*amount/1200;
principal = payment - interest;
if (principal > amount) principal = amount;
cout << month << "\t" << setprecision(2) << amount << "\t" << interest << "\t\t" << principal << endl;
amount -= principal;
month++;
} while (amount > 0);
return 0;
}

View file

@ -1,55 +0,0 @@
//
// main.cpp
// Program 1
//
// Created by Liyang Zhang 2016 on 6/10/13.
// Copyright (c) 2013 Liyang Zhang 2016. All rights reserved.
//
//precompiler directives:
#include <iostream>
#include <iomanip>
#include <fstream>
#include <cmath>
using namespace std;
int main( )
{
// ********************* PROBLEM 1 *********************
int num, counter = 1;
while (counter <= 5) {
num = counter * 2;
cout << counter << " doubled is " << num << endl;
counter ++;
}
// ********************* PROBLEM 2 *********************
cout << "You will input two numbers. This program will determine if the numbers are equal, or if one is larger than the other." << endl;
cout << endl;
double A, B;
cout << "A = ";
cin >> A;
cout << "B = ";
cin >> B;
cout << endl;
if (A>B) {
cout << A << " > " << B << endl;
cout << "Larger";
} else if (A<B) {
cout << A << " < " << B << endl;
cout << "Smaller";
} else {
cout << A << " = " << B << endl;
cout << "Equal";
}
return 0;
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View file

@ -1 +0,0 @@
<font face=\"HelveticaNeue\">hiadsfihqpweiohtasdifhqpoiewtpqiehwptiqhewpotihqpweithpqioewtpqijwerpoqewjfpjasdo;fkja;dslkfja;lsdkfj;askdjf</font>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 628 KiB

1177
temp/jquery-ui.css vendored

File diff suppressed because it is too large Load diff

View file

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry exported="true" kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View file

@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>PlanarTowerDefense</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>

View file

@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6

View file

@ -1,6 +0,0 @@
5x5
2,1,1,1,0
0,0,0,1,0
0,1,1,1,0
0,1,0,0,0
0,1,1,1,3

View file

@ -1,6 +0,0 @@
5x5
2,1,1,0,0
0,0,1,0,0
0,0,1,0,0
0,0,1,0,0
0,0,1,1,3

View file

@ -1,6 +0,0 @@
5x5
2,1,0,0,0
0,1,1,0,0
0,0,1,0,0
0,0,1,1,0
0,0,0,1,3

View file

@ -1,158 +0,0 @@
package pFusion.tmp;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.InputStreamReader;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
public class Camera {
BufferedImage back;
static Tile[][][] maps;
static Enemy[] enemies = new Enemy[3];
int map = 0;
int w = 5, h = 5;
int money = 1000;
FontMetrics metrics;
int R = (int) (Math.random() * 255), G = (int) (Math.random() * 255),
B = (int) (Math.random() * 255);
boolean R1 = (Math.random() > 0.5) ? false : true,
G1 = (Math.random() > 0.5) ? false : true,
B1 = (Math.random() > 0.5) ? false : true;
public Camera() throws Exception {
back = ImageIO.read(Camera.class.getResource("Back1.jpg"));
loadMap();
}
public void nextMap() {
map += 1;
if (map > 2)
map = 0;
}
public void prevMap() {
map -= 1;
if (map < 0)
map = 2;
}
public void loadMap() throws Exception {
maps = new Tile[3][w][h];
for (int i = 0; i < 3; i++) {
BufferedReader in = new BufferedReader(
new InputStreamReader(
Camera.class.getResourceAsStream("defaultMap" + i
+ ".dat")));
String t = in.readLine();
for (int j = 0; j < w; j++) {
t = in.readLine();
for (int k = 0; k < h; k++) {
maps[i][j][k] = new Tile(j, k, Integer.parseInt(t
.split(",")[k]));
}
}
}
for (int i = 0; i < enemies.length; i++) {
enemies[i] = new Enemy();
enemies[i].setMap(i);
enemies[i].setX(0);
enemies[i].setY(0);
}
}
public void update(long time) {
for (int i = 0; i < enemies.length; i++) {
enemies[i].update(time);
}
}
public void draw(Graphics2D g) {
String t = "";
g.drawImage(back, 0, 0, PDefense.width, PDefense.height, null);
g.setColor(new Color(R, G, B, 50));
g.fillRect(0, 0, PDefense.width, PDefense.height);
if (!PDefense.paused) {
if (R1)
R += 1;
else
R -= 1;
if (G1)
G += 1;
else
G -= 1;
if (B1)
B += 1;
else
B -= 1;
if (R >= 255) {
R = 255;
R1 = false;
}
if (R <= 0) {
R = 0;
R1 = true;
}
if (G >= 255) {
G = 255;
G1 = false;
}
if (G <= 0) {
G = 0;
G1 = true;
}
if (B >= 255) {
B = 255;
B1 = false;
}
if (B <= 0) {
B = 0;
B1 = true;
}
}
g.setFont(PFont.getFont(15));
g.setColor(new Color(255, 255, 255));
metrics = new JFrame().getFontMetrics(g.getFont());
// t = "[Current map: Map " + (map + 1) +
// "] Keyboard shortcuts: Escape to pause, Tab for next map, Shift+Tab for previous map";
t = "[Current map: Map " + (map + 1) + "]";
g.drawString(t, 20, 20);
for (int i = 0; i < maps[map].length; i++) {
for (int j = 0; j < maps[map][0].length; j++) {
int l = 150 + (100 * i), q = 50 + (100 * j);
if (maps[map][i][j].getC() == 0 && !PDefense.paused) {
if (PDefense.location.x >= l
&& PDefense.location.x <= (l + 100)
&& PDefense.location.y >= q
&& PDefense.location.y <= q + 100) {
if (PDefense.leftMouse) {
g.setColor(maps[map][i][j].getPressColor(map % 3));
} else {
g.setColor(maps[map][i][j].getHoverColor(map % 3));
}
} else {
g.setColor(maps[map][i][j].getColor(map % 3));
}
} else {
g.setColor(maps[map][i][j].getColor(map % 3));
}
g.fillRect(l, q, 100, 100);
}
}
for (int i = 0; i < enemies.length; i++) {
if (enemies[i].map == map) {
enemies[i].draw(g, 150, 50, 100, 100);
}
}
}
}

View file

@ -1,78 +0,0 @@
package pFusion.tmp;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Point;
import java.util.ArrayList;
import java.util.LinkedHashSet;
import java.util.Set;
public class Enemy extends Entity {
ArrayList<Point> travelled;
int moveCountdown = 50;
int health = 100;
public Enemy() {
travelled = new ArrayList<Point>();
travelled.add(new Point(0, 0));
color = new Color(200, 50, 50);
}
public void update(long time) {
Set<Point> setItems = new LinkedHashSet<Point>(travelled);
travelled.clear();
travelled.addAll(setItems);
moveCountdown -= 1;
if (moveCountdown == 0) {
moveCountdown = 50;
move();
}
}
public void move() {
boolean moved = false;
for (int i = 0; i < Camera.maps[map].length; i++) {
for (int j = 0; j < Camera.maps[map][0].length; j++) {
if (!moved) {
Tile tmpTile = Camera.maps[map][i][j];
if (tmpTile.getC() == 1) {
int dx = (int) (Math.abs(x - tmpTile.getX())), dy = (int) (Math
.abs(y - tmpTile.getY()));
if ((dx == 0 && dy == 1) || (dy == 0 && dx == 1)) {
boolean b = true;
for (Point p : travelled) {
if (tmpTile.getX() == p.x
&& tmpTile.getY() == p.y) {
b = false;
}
}
if (b) {
for (Enemy e : Camera.enemies) {
if (map == e.map && tmpTile.getX() == e.x
&& tmpTile.getY() == e.y) {
b = false;
}
}
}
if (b) {
travelled.add(new Point(x, y));
x = tmpTile.getX();
y = tmpTile.getY();
moved = true;
}
}
}
}
}
}
}
public void draw(Graphics2D g, int sx, int sy, int bw, int bh) {
int eX = sx + (x * bw) + (bw - (bw / 4 * 3)) / 2, eY = sy + (y * bh)
+ (bh - (bh / 4 * 3)) / 2;
g.setColor(new Color(200, 50, 50, 100));
g.fillOval(eX, eY, bw / 4 * 3, bh / 4 * 3);
g.setColor(color);
g.fillArc(eX, eY, bw / 4 * 3, bh / 4 * 3, 90, 90 + (health * 360 / 100));
}
}

View file

@ -1,48 +0,0 @@
package pFusion.tmp;
import java.awt.Color;
public class Entity {
int x, y;
int map;
Color color;
public Entity() {
x = -1;
y = -1;
map = 0;
color = Color.black;
}
public void setX(int x) {
this.x = x;
}
public void setY(int y) {
this.y = y;
}
public void setMap(int map) {
this.map = map;
}
public void setColor(Color color) {
this.color = color;
}
public int getX() {
return x;
}
public int getY() {
return y;
}
public int getMap() {
return map;
}
public Color getColor() {
return color;
}
}

View file

@ -1,125 +0,0 @@
package pFusion.tmp;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import java.io.File;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.swing.JFrame;
public class MenuOptions {
FontMetrics metrics;
JFrame frame;
int countdown = 6;
private int button1W = 300, button1H = 60, button1X = 20, button1Y = 520;
private boolean button1O = false;
private int button2W = 300, button2H, button2X, button2Y = 180;
private boolean button2O = false;
public MenuOptions() {
frame = new JFrame();
}
public void draw(Graphics2D g) {
String t = "";
g.setColor(new Color(102, 204, 204));
g.fillRect(0, 0, PDefense.width, PDefense.height);
g.setColor(new Color(0, 0, 0));
g.setFont(PFont.getFont(35));
metrics = frame.getFontMetrics(g.getFont());
t = "Options";
g.drawString(t, PDefense.width / 2 - metrics.stringWidth(t) / 2, 100);
// AUTO-PAUSE
g.setFont(PFont.getFont(16));
metrics = frame.getFontMetrics(g.getFont());
t = "Auto-Pause (focusLost)";
g.drawString(t, 40, 180);
button2X = 55 + metrics.stringWidth(t);
button2H = metrics.getHeight() + 10;
g.setFont(PFont.getFont(15));
metrics = frame.getFontMetrics(g.getFont());
t = String.valueOf(PDefense.autopause);
g.setColor(button2O ? new Color(140, 70, 140) : new Color(102, 51, 102));
g.fillRect(button2X, button2Y + metrics.getHeight() / 2 - button2H / 2,
button2W, button2H);
g.setColor(new Color(255, 255, 255));
g.drawString(t, button2X + button2W / 2 - metrics.stringWidth(t) / 2,
button2Y);
// BACK BUTTON
g.setColor(button1O ? new Color(70, 140, 140) : new Color(51, 102, 102));
g.fillRect(button1X, button1Y, button1W, button1H);
g.setColor(new Color(255, 255, 255));
g.setFont(PFont.getFont(25));
metrics = frame.getFontMetrics(g.getFont());
t = "Back";
g.drawString(t, button1X + button1W / 2 - metrics.stringWidth(t) / 2,
button1Y + button1H / 2);
// MOUSE LOCATION ETC.
button1O = PDefense.location.x >= button1X
&& PDefense.location.x <= button1X + button1W
&& PDefense.location.y >= button1Y
&& PDefense.location.y <= button1Y + button1H;
button2O = PDefense.location.x >= button2X
&& PDefense.location.x <= button2X + button2W
&& PDefense.location.y >= button2Y
&& PDefense.location.y <= button2Y + button2H;
if (PDefense.leftMouse && button1O) {
writeOptions();
PDefense.PState = PDefense.state.MENU;
PDefense.leftMouse = false;
}
if (PDefense.leftMouse && button2O) {
PDefense.autopause = !PDefense.autopause;
ArrayList<String> oTmp = new ArrayList<String>();
for (String option : PDefense.options) {
if (option.split("=")[0].equals("autopause")) {
oTmp.add("autopause=" + !PDefense.autopause);
} else {
oTmp.add(option);
}
}
PDefense.leftMouse = false;
}
if (countdown > 0) {
countdown -= 1;
} else {
countdown = 6;
writeOptions();
}
}
public void writeOptions() {
try {
PrintWriter out = new PrintWriter(new File(PDefense.appdata
+ File.separator + ".planar" + File.separator
+ "options.dat"));
for (String option : PDefense.options) {
out.println(option);
}
out.flush();
out.close();
} catch (Exception e) {
System.err
.println("***** AN ERROR OCCURRED AT MenuOptions.java *****");
e.printStackTrace();
System.exit(0);
}
}
}

View file

@ -1,77 +0,0 @@
package pFusion.tmp;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics2D;
import javax.swing.JFrame;
public class MenuPause {
FontMetrics metrics;
int button1W = 400, button1H = 60, button1X = 200, button1Y = 320;
private boolean button1O = false;
int button3W = 400, button3H = 60, button3X = 200, button3Y = 390;
private boolean button3O = false;
public MenuPause() {
}
public void draw(Graphics2D g) {
String t = "";
g.setFont(PFont.getFont(100));
g.setColor(new Color(0, 0, 0, 50));
g.fillRect(0, 0, PDefense.width, PDefense.height);
g.setColor(new Color(255, 255, 255));
metrics = new JFrame().getFontMetrics(g.getFont());
t = "PAUSED";
g.drawString(t, PDefense.width / 2 - metrics.stringWidth(t) / 2,
PDefense.height / 2 - metrics.getHeight() / 2);
// RESUME BUTTON
g.setColor(button1O ? new Color(140, 70, 140) : new Color(102, 51, 102));
g.fillRect(button1X, button1Y, button1W, button1H);
g.setColor(new Color(255, 255, 255));
g.setFont(PFont.getFont(25));
metrics = new JFrame().getFontMetrics(g.getFont());
t = "Resume";
g.drawString(t, PDefense.width / 2 - metrics.stringWidth(t) / 2,
button1Y + button1H / 2);
// MENU BUTTON
g.setColor(button3O ? new Color(140, 70, 140) : new Color(102, 51, 102));
g.fillRect(button3X, button3Y, button3W, button3H);
g.setColor(new Color(255, 255, 255));
g.setFont(PFont.getFont(25));
metrics = new JFrame().getFontMetrics(g.getFont());
t = "Menu";
g.drawString(t, PDefense.width / 2 - metrics.stringWidth(t) / 2,
button3Y + button3H / 2);
// MOUSE LOCATION ETC.
button1O = PDefense.location.x >= button1X
&& PDefense.location.x <= button1X + button1W
&& PDefense.location.y >= button1Y
&& PDefense.location.y <= button1Y + button1H;
button3O = PDefense.location.x >= button3X
&& PDefense.location.x <= button3X + button3W
&& PDefense.location.y >= button3Y
&& PDefense.location.y <= button3Y + button3H;
if (PDefense.leftMouse && button1O) {
PDefense.paused = false;
PDefense.leftMouse = false;
}
if (PDefense.leftMouse && button3O) {
PDefense.PState = PDefense.state.MENU;
PDefense.leftMouse = false;
}
}
}

View file

@ -1,522 +0,0 @@
package pFusion.tmp;
import java.awt.Color;
import java.awt.FontMetrics;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.awt.Image;
import java.awt.MouseInfo;
import java.awt.Point;
import java.awt.RenderingHints;
import java.awt.Toolkit;
import java.awt.event.FocusEvent;
import java.awt.event.FocusListener;
import java.awt.event.KeyEvent;
import java.awt.event.KeyListener;
import java.awt.event.MouseEvent;
import java.awt.event.MouseListener;
import java.awt.event.MouseMotionListener;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;
import java.awt.image.BufferedImage;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.util.ArrayList;
import javax.imageio.ImageIO;
import javax.swing.JFrame;
public class PDefense extends JFrame implements MouseMotionListener,
MouseListener, KeyListener, FocusListener {
public static final long serialVersionUID = 1L;
public static boolean leftMouse = false;
private FontMetrics metrics;
public static Point location;
private int button1W = 400, button1H = 60, button1X = 200, button1Y = 260;
private boolean button1O = false;
private int button2W = 400, button2H = 60, button2X = 200, button2Y = 330;
private boolean button2O = false;
private int button3W = 400, button3H = 60, button3X = 200, button3Y = 400;
private boolean button3O = false;
private int logowait = 80;
BufferedImage splash;
public static int optionsReferrer = 0;
private String version = "0.2.1";
Camera c;
MenuPause mp;
MenuOptions mo;
static int xmouse, ymouse;
static int width, height;
long oldTime, time;
static boolean paused = false;
boolean shiftPressed = false, tabPressed = false;
public static String appdata = System.getenv("APPDATA");
public static ArrayList<String> options;
static boolean autopause;
boolean ee = false;
JFrame eeTmp;
int switchMapDelay = 8;
/**
*
* @author Michael Zhang Copyright 2013 by pFusion
*
*/
public static enum state {
NULL, MENU, OPTIONS, GAME
}
public static state PState = state.NULL;
public static enum gstate {
PLAYING, PAUSED
}
public static gstate GState = gstate.PLAYING;
public PDefense() {
try {
// SEE IF DIRECTORY EXISTS
File mainDir = new File(appdata + File.separator + ".planar");
if (!(mainDir.exists() && mainDir.isDirectory())) {
mainDir.mkdir();
}
// SEE IF OPTIONS FILE EXISTS
boolean updated = false;
File optionsFile = new File(appdata + File.separator + ".planar"
+ File.separator + "options.dat");
if (!optionsFile.exists()) {
copyOptionsFile();
} else {
ArrayList<String> optionsTmp = new ArrayList<String>();
BufferedReader in = new BufferedReader(new FileReader(appdata
+ File.separator + ".planar" + File.separator
+ "options.dat"));
String line;
while ((line = in.readLine()) != null) {
optionsTmp.add(line);
}
in.close();
for (String option : optionsTmp) {
if (option.split("=")[0] == "version"
&& option.split("=")[1] == version) {
updated = true;
}
}
}
if (!updated) {
copyOptionsFile();
}
// LOAD OPTIONS
options = new ArrayList<String>();
BufferedReader in = new BufferedReader(new FileReader(appdata
+ File.separator + ".planar" + File.separator
+ "options.dat"));
String line;
while ((line = in.readLine()) != null) {
options.add(line);
}
in.close();
for (String option : options) {
if (option.split("=")[0].equals("autopause")) {
autopause = option.split("=")[1].toLowerCase().trim() == "true";
}
}
splash = ImageIO.read(PDefense.class.getResource("Splash.png"));
c = new Camera();
mp = new MenuPause();
mo = new MenuOptions();
setSize(800, 600);
setTitle("Planar Tower Defense");
setFont(PFont.getFont(30f));
setResizable(false);
setIconImage(ImageIO.read(PDefense.class.getResource("Icon.png")));
setLocation(Toolkit.getDefaultToolkit().getScreenSize().width / 2
- getWidth() / 2, Toolkit.getDefaultToolkit()
.getScreenSize().height / 2 - getHeight() / 2);
setDefaultCloseOperation(EXIT_ON_CLOSE);
setVisible(true);
setFocusable(true);
requestFocus();
addMouseMotionListener(this);
addMouseListener(this);
addKeyListener(this);
addFocusListener(this);
setFocusTraversalKeysEnabled(false);
width = getWidth();
height = getHeight();
addMouseListener(new MouseListener() {
public void mouseClicked(MouseEvent e) {
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
public void mousePressed(MouseEvent e) {
leftMouse = true;
}
public void mouseReleased(MouseEvent e) {
leftMouse = false;
}
});
Thread th = new Thread() {
public void run() {
try {
while (true) {
location = MouseInfo.getPointerInfo().getLocation();
location.setLocation(location.x - getLocation().x,
location.y - getLocation().y);
if (PState == state.MENU) {
button1O = location.x >= button1X
&& location.x <= button1X + button1W
&& location.y >= button1Y
&& location.y <= button1Y + button1H;
button2O = location.x >= button2X
&& location.x <= button2X + button2W
&& location.y >= button2Y
&& location.y <= button2Y + button2H;
button3O = location.x >= button3X
&& location.x <= button3X + button3W
&& location.y >= button3Y
&& location.y <= button3Y + button3H;
}
if (leftMouse && button1O) {
PState = state.GAME;
PDefense.leftMouse = false;
}
if (leftMouse && button2O) {
options(0);
PDefense.leftMouse = false;
}
if (leftMouse && button3O) {
System.out.println("Exiting the application!");
System.exit(0);
}
repaint();
Thread.sleep(50);
}
} catch (Exception e) {
System.err
.println("***** AN ERROR OCCURRED AT PDefense.java *****");
e.printStackTrace();
System.exit(0);
}
}
};
th.start();
} catch (Exception e) {
System.err
.println("***** AN ERROR OCCURRED AT PDefense.java *****");
e.printStackTrace();
System.exit(0);
}
}
public void paint(Graphics g) {
try {
Image buffer = createImage(getWidth(), getHeight());
Graphics2D g2 = (Graphics2D) buffer.getGraphics();
draw(g2);
g.drawImage(buffer, 0, 0, null);
g2.dispose();
} catch (Exception e) {
System.err
.println("***** AN ERROR OCCURRED AT PDefense.java *****");
e.printStackTrace();
System.exit(0);
}
}
public void draw(Graphics2D g) {
g.setRenderingHints(new RenderingHints(
RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_GASP));
if (logowait > 0) {
logowait -= 1;
g.drawImage(splash, 0, 0, null);
g.setColor(Color.black);
g.setFont(PFont.getFont(12));
// g.drawString("Menu in " + logowait + "u", 20, 40);
} else if (logowait == 0) {
logowait = -1;
PState = state.MENU;
} else {
if (PState == state.MENU) {
String t = "";
g.setColor(new Color(204, 102, 204));
g.fillRect(0, 0, getWidth(), getHeight());
g.setColor(new Color(255, 255, 255));
g.setFont(PFont.getFont(40));
metrics = getFontMetrics(g.getFont());
t = "Planar Defense";
g.drawString(t, getWidth() / 2 - metrics.stringWidth(t) / 2,
180);
// PLAY BUTTON
g.setColor(button1O ? new Color(140, 70, 140) : new Color(102,
51, 102));
g.fillRect(button1X, button1Y, button1W, button1H);
g.setColor(new Color(255, 255, 255));
g.setFont(PFont.getFont(25));
metrics = getFontMetrics(g.getFont());
t = "Play";
g.drawString(t, getWidth() / 2 - metrics.stringWidth(t) / 2,
button1Y + button1H / 2);
// OPTION BUTTON
g.setColor(button2O ? new Color(140, 70, 140) : new Color(102,
51, 102));
g.fillRect(button2X, button2Y, button2W, button2H);
g.setColor(new Color(255, 255, 255));
g.setFont(PFont.getFont(25));
metrics = getFontMetrics(g.getFont());
t = "Options";
g.drawString(t, getWidth() / 2 - metrics.stringWidth(t) / 2,
button2Y + button2H / 2);
// QUIT BUTTON
g.setColor(button3O ? new Color(140, 70, 140) : new Color(102,
51, 102));
g.fillRect(button3X, button3Y, button3W, button3H);
g.setColor(new Color(255, 255, 255));
g.setFont(PFont.getFont(25));
metrics = getFontMetrics(g.getFont());
t = "Exit";
g.drawString(t, getWidth() / 2 - metrics.stringWidth(t) / 2,
button3Y + button3H / 2);
// MADE BY
g.setColor(new Color(255, 255, 255));
g.setFont(PFont.getFont(15));
metrics = getFontMetrics(g.getFont());
t = "Made by Michael Zhang.";
g.drawString(t, getWidth() / 2 - metrics.stringWidth(t) / 2,
570);
t = "© 2013 by pFusion";
g.drawString(t, getWidth() / 2 - metrics.stringWidth(t) / 2,
585);
} else if (PState == state.OPTIONS) {
mo.draw(g);
} else if (PState == state.GAME) {
time = System.currentTimeMillis() - oldTime;
oldTime += time;
g.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_ON);
g.setRenderingHint(RenderingHints.KEY_RENDERING,
RenderingHints.VALUE_RENDER_QUALITY);
g.setRenderingHints(new RenderingHints(
RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingHints.VALUE_TEXT_ANTIALIAS_GASP));
update();
draw2(g);
}
}
}
public void update() {
if (!paused) {
switchMapDelay -= 1;
if (switchMapDelay <= 0)
switchMapDelay = 0;
if (tabPressed && switchMapDelay == 0) {
if (shiftPressed) {
c.prevMap();
} else {
c.nextMap();
}
tabPressed = false;
switchMapDelay = 8;
}
c.update(time);
}
}
public void menuUpdate() {
}
public void draw2(Graphics2D g) {
if (GState == gstate.PLAYING) {
gameDraw(g);
} else if (GState == gstate.PAUSED) {
}
}
public void gameDraw(Graphics2D g) {
c.draw(g);
if (paused) {
menuDraw(g);
}
}
public void menuDraw(Graphics2D g) {
mp.draw(g);
}
public static void options(int referrer) {
// REFERRER ID
//
// 0: MENU
// 1: GAME
optionsReferrer = referrer;
PState = state.OPTIONS;
}
public void copyOptionsFile() throws Exception {
File optionsFile = new File(appdata + File.separator + ".planar"
+ File.separator + "options.dat");
BufferedReader in = new BufferedReader(new InputStreamReader(
PDefense.class.getResourceAsStream("defaultOptions.dat")));
PrintWriter out = new PrintWriter(optionsFile);
String line;
while ((line = in.readLine()) != null) {
out.println(line);
}
in.close();
out.flush();
out.close();
}
public void focusGained(FocusEvent e) {
}
public void focusLost(FocusEvent e) {
if (GState == gstate.PLAYING && autopause) {
paused = true;
}
}
public void keyPressed(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_TAB:
tabPressed = true;
break;
case KeyEvent.VK_SHIFT:
shiftPressed = true;
break;
case KeyEvent.VK_ESCAPE:
if (GState == gstate.PLAYING) {
paused = !paused;
}
break;
// E
case KeyEvent.VK_Q:
eeTmp = new JFrame();
eeTmp.setUndecorated(true);
eeTmp.setSize(Toolkit.getDefaultToolkit().getScreenSize());
eeTmp.setAlwaysOnTop(true);
eeTmp.addWindowListener(new WindowListener() {
public void windowActivated(WindowEvent e) {
}
public void windowClosed(WindowEvent e) {
}
public void windowClosing(WindowEvent e) {
ee = false;
}
public void windowDeactivated(WindowEvent e) {
}
public void windowDeiconified(WindowEvent e) {
}
public void windowIconified(WindowEvent e) {
}
public void windowOpened(WindowEvent e) {
}
});
ee = true;
eeTmp.setVisible(true);
break;
}
}
public void keyReleased(KeyEvent e) {
switch (e.getKeyCode()) {
case KeyEvent.VK_TAB:
tabPressed = false;
break;
case KeyEvent.VK_SHIFT:
shiftPressed = false;
break;
}
}
public void keyTyped(KeyEvent e) {
}
public void mouseClicked(MouseEvent e) {
}
public void mouseEntered(MouseEvent e) {
}
public void mouseExited(MouseEvent e) {
}
public void mousePressed(MouseEvent e) {
leftMouse = true;
}
public void mouseReleased(MouseEvent e) {
leftMouse = false;
}
public void mouseDragged(MouseEvent e) {
}
public void mouseMoved(MouseEvent e) {
}
public static void main(String[] args) {
new PDefense();
}
}

View file

@ -1,21 +0,0 @@
package pFusion.tmp;
import java.awt.Font;
public class PFont extends Font {
public static final long serialVersionUID = 1L;
protected PFont(Font f) {
super(f);
}
public static Font getFont(float size) {
try {
return Font.createFont(Font.TRUETYPE_FONT,
PFont.class.getResourceAsStream("Nexa.ttf")).deriveFont(
size);
} catch (Exception e) {
return new Font("sans", Font.PLAIN, (int) size);
}
}
}

View file

@ -1,106 +0,0 @@
package pFusion.tmp;
import java.awt.Color;
public class Tile {
private int x, y, c;
/*
*
* KEY:
*
* 0 = AVAILABLE TILE; 1 = ROAD TILE; 2 = ENTER TILE; 3 = EXIT TILE;
*/
public Tile(int x, int y, int c) {
this.x = x;
this.y = y;
this.c = c;
}
public void setX(int x) {
this.x = x;
}
public void setY(int y) {
this.y = y;
}
public void setC(int c) {
this.c = c;
}
public int getX() {
return this.x;
}
public int getY() {
return this.y;
}
public int getC() {
return this.c;
}
public Color getHoverColor(int theme) {
Color tmp = getColor(theme);
int k = 30;
int r = tmp.getRed() + k, b = tmp.getBlue() + k, g = tmp.getGreen() + k;
if (r > 255)
r = 255;
if (g > 255)
g = 255;
if (b > 255)
b = 255;
return new Color(r, g, b, tmp.getAlpha());
}
public Color getPressColor(int theme) {
Color tmp = getColor(theme);
int k = 30;
int r = tmp.getRed() - k, b = tmp.getBlue() - k, g = tmp.getGreen() - k;
if (r < 0)
r = 0;
if (g < 0)
g = 0;
if (b < 0)
b = 0;
return new Color(r, g, b, tmp.getAlpha());
}
public Color getColor(int theme) {
switch (c) {
case 0:
return new Color(225, 225, 225, 85);
case 1:
switch (theme) {
case 0:
return new Color(200, 64, 64, 85);
case 1:
return new Color(64, 200, 64, 85);
case 2:
return new Color(64, 64, 200, 85);
}
case 2:
switch (theme) {
case 0:
return new Color(175, 32, 32, 85);
case 1:
return new Color(32, 175, 32, 85);
case 2:
return new Color(32, 32, 175, 85);
}
case 3:
switch (theme) {
case 0:
return new Color(175, 32, 32, 85);
case 1:
return new Color(32, 175, 32, 85);
case 2:
return new Color(32, 32, 175, 85);
}
default:
return new Color(0, 0, 0, 85);
}
}
}

View file

@ -1,6 +0,0 @@
5x5
2,1,1,1,0
0,0,0,1,0
0,1,1,1,0
0,1,0,0,0
0,1,1,1,3

View file

@ -1,6 +0,0 @@
5x5
2,1,1,0,0
0,0,1,0,0
0,0,1,0,0
0,0,1,0,0
0,0,1,1,3

View file

@ -1,6 +0,0 @@
5x5
2,1,0,0,0
0,1,1,0,0
0,0,1,0,0
0,0,1,1,0
0,0,0,1,3

View file

@ -48,11 +48,11 @@ $permitted = array(
// print_r ( $permitted);
if ($_SESSION['logged'] == 1 && isset($_FILES['uploaded'])) {
$username = $_SESSION['username'];
$query2 = mysql_query("select * from `lexis_docbank` where owner = '" . $_SESSION['username'] . "'") or die("Error: " . mysql_error());
$query2 = mysql_query("select * from `keepit_docbank` where owner = '" . $_SESSION['username'] . "'") or die("Error: " . mysql_error());
$usage = 0;
while ($row2 = mysql_fetch_array($query2)) {
$fileLoc = "files/" . $row2['id'] . "." . $row2['type'];
if ($row2['type']!="lexis_directory") {
if ($row2['type']!="keepit_directory") {
$fileSize = filesize($fileLoc);
$usage += $fileSize;
}
@ -82,15 +82,15 @@ if ($_SESSION['logged'] == 1 && isset($_FILES['uploaded'])) {
$success = move_uploaded_file($_FILES['uploaded']['tmp_name'], UPLOAD_DIR . $file);
}
if ($success) {
$result = "Your file was uploaded.<br /><a href='index.php'>&laquo; Back to LEXIS</a><script type='text/javascript'>location.href='index.php';</script>";
$result = "Your file was uploaded.<br /><a href='index.php'>&laquo; Back to Keepit</a><script type='text/javascript'>location.href='index.php';</script>";
$pieces = explode('.', $_FILES['uploaded']['name']);
$query = mysql_query("insert into lexis_docbank (id,title,container,owner,type,dateMod) values('$id','" . $pieces[0] . "','$use_dir','$username','" . $type . "',NOW())") or die("Can't connect: " . mysql_error());
$query = mysql_query("insert into keepit_docbank (id,title,container,owner,type,dateMod) values('$id','" . $pieces[0] . "','$use_dir','$username','" . $type . "',NOW())") or die("Can't connect: " . mysql_error());
} else {
$result = "Error uploading your file. Please try again. If this problem persists, contact ANIXO Specifications and we will try to help you.";
$result = "Error uploading your file. Please try again. If this problem persists, contact Keepit and we will try to help you.";
}
break;
case 8:
$result = "Error uploading your file. Please try again. If this problem persists, contact ANIXO Specifications and we will try to help you.";
$result = "Error uploading your file. Please try again. If this problem persists, contact Keepit and we will try to help you.";
break;
case 4:
$result = "You didn't upload a file.";