Switch to PDO

This pull request changes the functions used in `db_constants.php` to use the PDO PHP extension, instead of the `mysql` and `pg` extensions.
Why?
===================
Because the `mysql` extension will be removed in a future PHP release, and PDO lets us support a huge amount of databases (http://php.net/manual/en/pdo.drivers.php) (including MySQL and PostgreSQL) with little to no code changes.
Note
===================
As long as you use `db_` functions from `db_constants.php`, you shouldn't have to change anything.