Implements Zenphoto mod_rewrite handling in a PHP script

This change is to facilitate server implementations on non-apache
servers. The server rewrite rules are now quite simple. Anything not
pointing to a file is redirected to the gallery index.php script and
"rewrite rules" are processed by the rewrite.php script.

NOTE: the rules interpretation is fairly restrictive. The only flags
interpreted are L, R, and QSA. L is assumed if R is not present. NC is
also assumed.

Rewrite interpretation occurs before any plugins are loaded (as the
plugins need to use the results.) This means that at present there is no
facility for user augmentation of these rules. But since they are
Zenphoto rules, that should be no problem.
Code optimization, Adds rewrite defines
Merge remote-tracking branch 'origin/1.4.5' into PHP-mod_rewrite
Merge remote-tracking branch 'origin/1.4.5' into PHP-mod_rewrite
Merge remote-tracking branch 'origin/1.4.5' into PHP-mod_rewrite