redonate/public_html/rewrite.php

141 lines
5 KiB
PHP
Raw Normal View History

2013-02-16 00:12:09 +01:00
<?php
/*
* ReDonate is more free software. It is licensed under the WTFPL, which
* allows you to do pretty much anything with it, without having to
* ask permission. Commercial use is allowed, and no attribution is
* required. We do politely request that you share your modifications
* to benefit other developers, but you are under no enforced
* obligation to do so :)
*
* Please read the accompanying LICENSE document for the full WTFPL
* licensing text.
*/
$_APP = true;
require("includes/base.php");
2013-02-16 00:12:09 +01:00
$sPageTitle = "";
$sPageContents = "";
$sError = "";
2013-02-16 00:12:09 +01:00
$router = new CPHPRouter();
$router->allow_slash = true;
$router->ignore_query = true;
$router->routes = array(
0 => array(
2013-02-25 11:54:16 +01:00
"^/$" => array(
'target' => "modules/index.php",
'_padded' => false
),
"^/sign-up$" => "modules/signup.php",
"^/login$" => "modules/login.php",
"^/about$" => "modules/about.php",
"^/logout/([a-zA-Z0-9]+)$" => "modules/logout.php",
"^/confirm/(.+)/([a-zA-Z0-9]+)$" => "modules/confirm.php",
2013-02-25 13:20:41 +01:00
"^/create$" => array(
'target' => "modules/campaign/create.php",
'authenticator' => "authenticators/user.php",
'auth_error' => "modules/error/guest.php"
),
2013-02-25 11:54:16 +01:00
"^/dashboard$" => array(
2013-02-25 12:01:57 +01:00
'target' => "modules/dashboard.php",
'authenticator' => "authenticators/user.php",
'auth_error' => "modules/error/guest.php"
),
2013-02-25 11:54:16 +01:00
"^/dashboard/([a-zA-Z0-9-]+)$" => array(
2013-02-25 12:01:57 +01:00
'target' => "modules/campaign/dashboard.php",
'authenticator' => "authenticators/user.php",
'auth_error' => "modules/error/guest.php"
),
2013-02-25 11:54:16 +01:00
"^/dashboard/([a-zA-Z0-9-]+)/add-payment-method$" => array(
2013-02-25 12:01:57 +01:00
'target' => "modules/campaign/addmethod.php",
'authenticator' => "authenticators/user.php",
'auth_error' => "modules/error/guest.php"
),
"^/dashboard/([a-zA-Z0-9-]+)/remove-payment-method/([0-9]+)$" => array(
'target' => "modules/campaign/removemethod.php",
'authenticator' => "authenticators/user.php",
'auth_error' => "modules/error/guest.php"
),
"^/dashboard/([a-zA-Z0-9-]+)/change-settings$" => array(
'target' => "modules/campaign/changesettings.php",
'authenticator' => "authenticators/user.php",
'auth_error' => "modules/error/guest.php"
),
2013-02-26 10:33:53 +01:00
"^/pay/(.+)/([0-9]+)/([a-zA-Z0-9]+)/(.+)/done$" => array(
'target' => "modules/payment/notify_done.php",
'authenticator' => "authenticators/payment.php",
'auth_error' => "modules/error/nosuchpayment.php"
),
2013-03-01 12:49:01 +01:00
"^/pay/(.+)/([0-9]+)/([a-zA-Z0-9]+)/skip$" => array(
'target' => "modules/payment/notify_skip.php",
'authenticator' => "authenticators/payment.php",
'auth_error' => "modules/error/nosuchpayment.php"
),
2013-02-26 10:33:53 +01:00
"^/pay/(.+)/([0-9]+)/([a-zA-Z0-9]+)/paypal$" => array(
'target' => "modules/payment/paypal.php",
'authenticator' => "authenticators/payment.php",
'auth_error' => "modules/error/nosuchpayment.php"
),
"^/pay/(.+)/([0-9]+)/([a-zA-Z0-9]+)/bitcoin$" => array(
'target' => "modules/payment/bitcoin.php",
'authenticator' => "authenticators/payment.php",
'auth_error' => "modules/error/nosuchpayment.php"
),
"^/pay/(.+)/([0-9]+)/([a-zA-Z0-9]+)/([0-9]+)$" => array(
'target' => "modules/payment/other.php",
'authenticator' => "authenticators/payment.php",
'auth_error' => "modules/error/nosuchpayment.php"
),
"^/change/(.+)/([0-9]+)/([a-zA-Z0-9]+)$" => array(
'target' => "modules/change.php",
'authenticator' => "authenticators/change.php",
'auth_error' => "modules/error/nosuchchange.php"
),
2013-03-01 10:53:09 +01:00
"^/manage/(.+?)/([a-zA-Z0-9]+)/change-amount$" => array(
'target' => "modules/subscription/change_amount.php",
'authenticator' => "authenticators/subscription.php",
'auth_error' => "modules/error/nosuchsubscription.php"
),
"^/manage/(.+?)/([a-zA-Z0-9]+)/unsubscribe$" => array(
'target' => "modules/subscription/unsubscribe.php",
'authenticator' => "authenticators/subscription.php",
'auth_error' => "modules/error/nosuchsubscription.php"
),
"^/manage/(.+?)/([a-zA-Z0-9]+)[.]?$" => array(
'target' => "modules/subscription/manage.php",
'authenticator' => "authenticators/subscription.php",
'auth_error' => "modules/error/nosuchsubscription.php"
),
"^/campaign/([a-zA-Z0-9-]+)$" => array(
'target' => "modules/landing.php",
'_resizable' => true
),
"^/campaign/([a-zA-Z0-9-]+)/subscribe$" => array(
'target' => "modules/subscribe.php",
'_resizable' => true
),
"^/campaign/([a-zA-Z0-9-]+)/donate/([0-9]+)$" => array(
'target' => "modules/donate.php",
'_resizable' => true
),
2013-03-01 13:40:55 +01:00
"^/thanks/([a-zA-Z0-9-]+)$" => "modules/thanks.php",
2013-02-27 10:17:37 +01:00
"^/test$" => "modules/test.php"
2013-02-16 00:12:09 +01:00
)
);
2013-02-22 01:56:22 +01:00
try
{
$router->RouteRequest();
}
catch (RouterException $e)
{
http_status_code(404);
$sPageTitle = "Page not found";
$sPageContents = NewTemplater::Render("404", $locale->strings, array());
}
2013-02-16 00:12:09 +01:00
echo(NewTemplater::Render("layout", $locale->strings, array("contents" => $sPageContents, "title" => $sPageTitle,
"padded" => (isset($router->uVariables['padded']) ? $router->uVariables['padded'] : true), "resizable" => !empty($router->uVariables['resizable']))));