Fixed formatting, quoting, and line endings
Split index.php into multiple files

index.php wasn't structured logically, it should have been broken up
into multiple files.

index.php
Indexes a directory, lists target documents and provides links to view
them.

view.php
Displays a target document.
Cleaned up code