Some more refactoring to use of the PDO class instead of sql.php.

A few more files to go.
Also added an extra config item so oyu can define the site's name. It's
usable in titles of emails.