Add user authorisation to book.php.

When a user owns a book, all fields of the document are editable in book.php . When a user is allowed to see the document, but doesn't own it, he will see all the fields, but they wil not be editable. When a document is set to not visible and a user does not own that certain document, then they will just be shown an error message.

Also modified download.php a bit. Plain text files are now correctly downloaded (tried with .log, .pl and .txt). PDF and other non-plaintext are still causing troubles when downloading.