/* index.phtml: this should be placed in all toplevel directories that might be called
to replace the main frameset (called with target _top).
it checks the cookie NYPHIL_CLIENT_STATE given its value redirects to the correct page.
possible values for
NYPHIL_CLIENT_STATE:
VOID (FALSE): REDIRECT TO this folder/main.phtml and append as get any post or get
vars that came along.
"UADDRESS_ADMIN": redirect to http_root/admin/uaddress/ with the argument of $content=path to main.phtml
(with any post/get vars appended as get)
"SCAVENGER_ADMIN":redirect to http_root/admin/scavenger/ with the argument of $content=path to main.phtml
(with any post/get vars appended as get)
"SCAVENGER_PLAY": redirect to http_root/scavenger/ with the argument of $content=path to main.phtml
(with any post/get vars appended as get)
*/
include("/home/nyphil/php/classes/common/Localizer");
$localize = new Localizer($HTTP_HOST, $SCRIPT_NAME);
$local_http_root = $localize->getCorrectedHttpRoot();
$topdoc = $local_http_root . $localize->getCorrectedHttpPath() . "main.phtml";
$getstring = "?";
//assemble any get vars
foreach($HTTP_GET_VARS as $name=>$val)
$getstring .= "$name=".urlencode($val)."&";
foreach($HTTP_POST_VARS as $name=>$val)
$getstring .= "$name=".urlencode($val)."&";
$topdoc .= $getstring;
//now check cookie and redirect
switch($NYPHIL_CLIENT_STATE)
{
case "UADDRESS_ADMIN":
$redirect = $local_http_root . "/admin/uaddress/?content=".urlencode($topdoc);
break;
case "SCAVENGER_ADMIN":
$redirect = $local_http_root . "/admin/scavenger/?content=".urlencode($topdoc);
break;
case "SCAVENGER_PLAY":
$redirect = $local_http_root . "/scavenger/?content=".urlencode($topdoc);
break;
default:
$redirect = $topdoc;
}
header("Location: http://$redirect");
exit;
//print "would send you to: $redirect";
?>