summaryrefslogtreecommitdiff
path: root/www/functions/func_delete.php
diff options
context:
space:
mode:
authorHorus32014-04-13 18:48:34 +0200
committerHorus32014-04-13 18:48:34 +0200
commitab03a281b0e9fc34a370b6a1809e9f8ab52236eb (patch)
tree4b68acbbcbc19161b49a1e8a17ffa0655c654cb8 /www/functions/func_delete.php
parent087455a4825429a4fde186c4e82badcd20573c7b (diff)
downloadfiles.iamfabulous.de-ab03a281b0e9fc34a370b6a1809e9f8ab52236eb.tar.gz
Patch: Old files are now deleted if you overwrite it with a new one.
Diffstat (limited to 'www/functions/func_delete.php')
-rw-r--r--www/functions/func_delete.php18
1 files changed, 18 insertions, 0 deletions
diff --git a/www/functions/func_delete.php b/www/functions/func_delete.php
index 059bc3b..6220f8a 100644
--- a/www/functions/func_delete.php
+++ b/www/functions/func_delete.php
@@ -4,6 +4,24 @@
expected state: tested?; but broken
*/
+function check_if_deletable($db, $id, $hash){
+ $check_db = $db->query("SELECT hash FROM files WHERE id!=".$id." AND folder='FILE';");
+
+ $count = 0;
+ while($check_ar = $check_db->fetchArray(SQLITE3_NUM)){
+ if($check_ar[0] == $hash){
+ $count = $count +1;
+ break;
+ }
+ }
+
+ if($count == 0){
+ return true;
+ } else {
+ return false;
+ }
+}
+
function delete_file($user, $path){
if(!$_SESSION["login"]){