From ac5891a49fe76808195f0e7bb9856e98ac1aed5a Mon Sep 17 00:00:00 2001
From: oweissbarth
Date: Mon, 17 Mar 2014 20:44:55 +0100
Subject: Added directory creation to the browser and fixed all the bugs in
func_folder
---
www/browse.php | 66 +++++++++++++++++++++++++----
www/functions/func_folder.php | 4 +-
www/functions/func_interface.php | 4 +-
www/index.php | 2 +-
www/static/browser.css | 90 +++++++++++++++++++++++++++++++++++++++-
www/static/img/icon_delete.svg | 63 ++++++++++++++++++++++++++++
www/static/img/icon_file.svg | 8 ++--
www/static/img/icon_folder.svg | 10 ++---
www/static/img/icon_new.svg | 88 +++++++++++++++++++++++++++++++++++++++
www/static/img/icon_upload.svg | 63 ++++++++++++++++++++++++++++
10 files changed, 375 insertions(+), 23 deletions(-)
create mode 100644 www/static/img/icon_delete.svg
create mode 100644 www/static/img/icon_new.svg
create mode 100644 www/static/img/icon_upload.svg
diff --git a/www/browse.php b/www/browse.php
index 028174e..468401a 100644
--- a/www/browse.php
+++ b/www/browse.php
@@ -1,20 +1,63 @@
-
';
- include("static/footer.html");
+ $file_list = "";
+ if($content){
+ foreach($content as $file){
+ $file_list .= get_item($file);
+ }
+ }
+
+ echo '
+
+
+ ';
+
+ include("static/footer.html");
}
+
function get_icon($file){
if($file[4]=="DIRECTORY"){
return ''.get_link($file).' | ';
@@ -31,3 +74,10 @@ function get_link($file){
function get_item($file){
return ''.get_icon($file).'| '.get_link($file).$file[3].' |
';
}
+
+function print_menu(){
+ echo '';
+}
diff --git a/www/functions/func_folder.php b/www/functions/func_folder.php
index 145f14a..376cdd6 100644
--- a/www/functions/func_folder.php
+++ b/www/functions/func_folder.php
@@ -10,7 +10,7 @@ function create_folder($path, $new_folder_name, $share){
$file_id = select_file_id($db, $_SESSION["userid"], $path);
- $owner_db = $db->query("SELECT owner FROM files WHERE id=" . SQLite3::escapeString('$file_id') . ";");
+ $owner_db = $db->query("SELECT owner FROM files WHERE id=" . SQLite3::escapeString($file_id) . ";");
$owner_ar = $owner_db->fetchArray(SQLITE3_NUM);
if($owner_ar[0] != $_SESSION["userid"]){
@@ -19,7 +19,7 @@ function create_folder($path, $new_folder_name, $share){
if($db->exec("
BEGIN TRANSACTION;
- INSERT INTO files (id, parent, owner, name, folder, size, share, hash) VALUES (Null, " . $file_id . ", " . $_SESSION['userid'] . ", " . SQLite3::escapeString('$new_folder_name') . ", 'DIRECTORY', 0, " . SQLite3::escapeString('$share') . ", '');
+ INSERT INTO files (id, parent, owner, name, folder, size, share, hash) VALUES (Null, " . $file_id . ", " . $_SESSION['userid'] . ", '" . SQLite3::escapeString($new_folder_name) . "', 'DIRECTORY', 0, '" . SQLite3::escapeString($share) . "', '');
COMMIT;
")){
return MKDIR_SUCCESS;
diff --git a/www/functions/func_interface.php b/www/functions/func_interface.php
index e6aa3f1..e5e4729 100755
--- a/www/functions/func_interface.php
+++ b/www/functions/func_interface.php
@@ -11,9 +11,9 @@ function collect_content($db,$username, $folder_path){
$content = get_content($db, $file_id, $owner);
- if(!$content){
+ /*if(!$content){
failure("This folder is empty.");
- }
+ }*/
return $content;
}
diff --git a/www/index.php b/www/index.php
index 7af88c6..9a23444 100755
--- a/www/index.php
+++ b/www/index.php
@@ -14,7 +14,7 @@ if(empty($_GET)){
header("Refresh: 0; /login");
exit;
} else {
- header("Refresh: 0; /" . $_SESSION[username]);
+ header("Refresh: 0; /" . $_SESSION["username"]);
exit;
}
} else {
diff --git a/www/static/browser.css b/www/static/browser.css
index 21ef4ad..a6031dc 100644
--- a/www/static/browser.css
+++ b/www/static/browser.css
@@ -17,10 +17,98 @@ width: 100%
table tr td {
padding-left: 0;
padding-right: 0;
+ height: 30px;
margin: 0;
-
+ border: none;
}
a{
text-decoration: none;
color: black;
+/* outline: 1px solid red;*/
+}
+
+td{
+/* outline: 1px solid black;*/
+}
+
+#menu{
+ position: fixed;
+ top:0;
+ right: 0;
+ margin-top: 10px;
+ margin-right: 30px;
+}
+
+.menu-item{
+ height: 45px;
+ width: 45px;
+ margin: 10px;
+ display:inline-block;
+}
+
+.menu-item:hover{
+ margin: 10px;
+ background:#2669AB;
+ height: 45px;
+ width: 45px;
+ border-radius: 10px;
+ box-shadow: 3px -3px 5px black;
+}
+
+#new-folder-bg{
+ width: 100%;
+ height: 100%;
+ background: white;
+ position: fixed;
+ z-index: 99;
+ top: 0px;
+ opacity: 0.75;
+ visibility: hidden;
+}
+
+#new-folder-form{
+
+}
+
+#new-folder-area{
+ height: 190px;
+ width: 400px;
+ position: fixed;
+ top: 50%;
+ margin-top: -100px;
+
+ padding: 10px;
+
+ left: 50%;
+ margin-left: -200px;
+
+ border: 1px solid black;
+}
+
+
+input.new-folder-input[type=text], input.new-folder-input[type=checkbox]{
+ border: none;
+ box-shadow: inset 0px 0px 1px 1px #1F3D4C;
+ border-radius: 0;
+ height: 40px;
+ font-size: 25px;
+ margin-top: 15px;
+ width: 395px;
+ display:block;
+ padding-left: 5px;
+}
+
+input.new-folder-input:focus{
+ background: #D6E0E5
+}
+
+#button-input{
+ height: 40px;
+ width: 120px;
+ display:inline;
+ border: none;
+ box-shadow: inset 0px 0px 1px 1px #1F3D4C;
+ border-radius: 0;
+ font-size: 25px;
+ margin-top: 15px;
}
diff --git a/www/static/img/icon_delete.svg b/www/static/img/icon_delete.svg
new file mode 100644
index 0000000..81a0eff
--- /dev/null
+++ b/www/static/img/icon_delete.svg
@@ -0,0 +1,63 @@
+
+
+
+
diff --git a/www/static/img/icon_file.svg b/www/static/img/icon_file.svg
index de7eaaa..56f4584 100644
--- a/www/static/img/icon_file.svg
+++ b/www/static/img/icon_file.svg
@@ -14,7 +14,7 @@
id="svg3794"
version="1.1"
inkscape:version="0.48.3.1 r9886"
- sodipodi:docname="New document 5">
+ sodipodi:docname="icon_file.svg">
image/svg+xml
-
+
@@ -54,7 +54,7 @@
transform="translate(0,-552.36218)">
diff --git a/www/static/img/icon_folder.svg b/www/static/img/icon_folder.svg
index 1191fa1..f555979 100644
--- a/www/static/img/icon_folder.svg
+++ b/www/static/img/icon_folder.svg
@@ -14,7 +14,7 @@
id="svg2"
version="1.1"
inkscape:version="0.48.3.1 r9886"
- sodipodi:docname="New document 1">
+ sodipodi:docname="icon_folder.svg">
image/svg+xml
-
+
@@ -55,13 +55,13 @@
id="layer1"
transform="translate(0,-552.36218)">
+
+
+
diff --git a/www/static/img/icon_upload.svg b/www/static/img/icon_upload.svg
new file mode 100644
index 0000000..cf21623
--- /dev/null
+++ b/www/static/img/icon_upload.svg
@@ -0,0 +1,63 @@
+
+
+
+
--
cgit v1.2.3