Add and adjust copyright headers and add a "legal.php" to describe licenses and libraries.