summaryrefslogtreecommitdiff
path: root/www/functions/func_interface.php
blob: 192e94f1b3d93da723aba468ac80549e5e81954c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php

function collect_content($db,$username, $folder_path){
	$owner = user_id($db, $username);

	if(!$owner){
		failure("This user doesn't exist!");
	}

	$file_id = select_file_id($db, $owner, $folder_path);

	$check_if_file_db = $db->query("SELECT folder FROM files WHERE id=".$file_id.";");
	$check_if_file_ar = $check_if_file_db->fetchArray(SQLITE3_NUM);

	//TODO: Instead of exit; let the browser start_download or print folder content
	if($check_if_file_ar[0] == "FILE"){
		if(start_file_download($username, $folder_path)){
			exit;
			return true;
		} else {
			exit;
			return false;
		}
	} else {
		$content = get_content($db, $file_id, $owner);
	}


	/*if(!$content){
		failure("This folder is empty.");
	}*/

	return $content;
}

/*function print_browser($content){
	var_dump($content);
}*/

function print_invite($var){
	include("invite.php");
}