get_shared_node($code); if($shared_node==NULL || $shared_node->password!=$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); } ?>