get_shared_node($code); if($shared_node==NULL) { http_response_code(409); exit(0); } if ($shared_node->password!=$password) { if ($password == "") { require_once("../share_frontend.php"); exit(0); }else { echo "Invalid password"; http_response_code(409); exit(0); } } if(isset($_SESSION["user_object"])) { $user=$_SESSION["user_object"]; $permissions=$database->get_permissions($shared_node->node_id,$user->user_id); if($permissions["can_view"]==true) { $node=$database->get_node($shared_node->node_id); if($node->is_directory) { /*spooky stuff here*/ http_response_code(409); exit(1); }else { header("Content-type: $node->type"); readfile("$storage_root/$node->code"); } } }else { if($shared_node->is_public==true) { $node=$database->get_node($shared_node->node_id); if($node->is_directory) { /*spooky stuff here*/ http_response_code(409); exit(1); }else { header("Content-type: $node->type"); readfile("$storage_root/$node->code"); } }else { http_response_code(409); exit(1); } } }else { http_response_code(409); exit(0); } ?>