Function rewriteHandler
"Rewrite" handling for Zenphoto
The basic rules are found in the zenphoto-rewrite.txt file. Additional rules can be provided by plugins. But for the plugin to load in time for the rules to be seen it must be either a CLASS_PLUGIN or a FEATURE_PLUGIN. Plugins add rules by inserting them into the $_zp_conf_vars['special_pages'] array. Each "rule" is an array of three elements: define, rewrite, and (optionally) rule.
Elemments which have a define and no rule are processed by rewrite rules in the zenphoto-rewrite.txt file and the define is used internally to Zenphoto to reference the rewrite text when building links.
Elements with a rule defined are processed after Search, Pages, and News rewrite rules and before Image and album rewrite rules. The tag %REWRITE% in the rule is replaced with the rewrite text before processing the rule. Thus rewrite is the token that should appear in the acutal URL.
It makes no sense to have an element without either a define or a rule as nothing will happen.
At present all rules are presumed to to stop processing the rule set. Historically that is what all our rules have done, but I suppose we could change that. The "R" flag may be used to cause a header status to be sent. However, we do not redirect back to index.php, so the "R" flag is only useful if the target is a different script.