summaryrefslogtreecommitdiff
path: root/www/functions
diff options
context:
space:
mode:
authorHorus32014-03-16 21:18:48 +0100
committerHorus32014-03-16 21:18:48 +0100
commit0665ea1e03f2bbb269e33ab78e4271eabe8f6442 (patch)
tree0b0a736ed9896844d7827b5bfbf8c9a875cbe7af /www/functions
parente6f9dea9a5a3c450847cdf1a11f77633fca09e43 (diff)
downloadfiles.iamfabulous.de-0665ea1e03f2bbb269e33ab78e4271eabe8f6442.tar.gz
Some comments in the doc and renaming stuff.
Diffstat (limited to 'www/functions')
-rwxr-xr-xwww/functions/func_content.php8
-rwxr-xr-xwww/functions/func_interface.php4
-rwxr-xr-xwww/functions/func_select.php7
3 files changed, 9 insertions, 10 deletions
diff --git a/www/functions/func_content.php b/www/functions/func_content.php
index 7e2281b..9500f06 100755
--- a/www/functions/func_content.php
+++ b/www/functions/func_content.php
@@ -1,8 +1,8 @@
<?php
-function get_content($db, $parentdir, $owner){
+function get_content($db, $file_id, $owner){
- $content_db = $db->query("SELECT * FROM files WHERE parent=" . $parentdir . " AND owner=" . $owner . ";");
+ $content_db = $db->query("SELECT * FROM files WHERE parent=" . $file_id . " AND owner=" . $owner . ";");
$count=0;
@@ -20,8 +20,8 @@ function get_content($db, $parentdir, $owner){
}
if(!empty($content)){
- return $content;
+ return $content; // returns everything listed in the folder which is commited as parameter
} else {
- return false;
+ return false; // empty folder
}
}
diff --git a/www/functions/func_interface.php b/www/functions/func_interface.php
index e0bc0e9..266a24f 100755
--- a/www/functions/func_interface.php
+++ b/www/functions/func_interface.php
@@ -7,9 +7,9 @@ function show($db){
failure("This user doesn't exist!");
}
- $parentdir = select($db, $owner);
+ $file_id = select_file_id($db, $owner);
- $content = get_content($db, $parentdir, $owner);
+ $content = get_content($db, $file_id, $owner);
if(!$content){
failure("This folder is empty.");
diff --git a/www/functions/func_select.php b/www/functions/func_select.php
index f0dc601..357b6b6 100755
--- a/www/functions/func_select.php
+++ b/www/functions/func_select.php
@@ -1,5 +1,5 @@
<?php
-function select($db, $owner){
+function select_file_id($db, $owner){
if($_SESSION["login"] && $_SESSION["userid"] == $owner){ // TODO: Check if loged in user really the user who does the query - fix 12.3.14
$share=""; // to print all files, even hidden ones
@@ -33,13 +33,12 @@ function select($db, $owner){
$parentdir_db = $db->query("SELECT id, parent FROM files WHERE owner=" . $owner . " AND folder='DIRECTORY' " . $share . " AND parent=" . $parentdir . " AND name='" . SQLite3::escapeString($folder_array_unsafe[$i]) . "';");
if(empty($folder_array_unsafe[$i])){
- return $parentdir;
+ return $parentdir; // TODO: Is there a way this can happen?
}
$prim_id = $parentdir_db->fetchArray(SQLITE3_NUM);
if(empty($prim_id)){
failure("Database error.");
- echo $prim_id;
}
if($parentdir != $prim_id[1]){
@@ -58,6 +57,6 @@ function select($db, $owner){
$parentdir = $prim_id[0];
}
- return $parentdir;
+ return $parentdir; // returns the primary key from the last entry in the folder array
}