Example #1
0
 public function GenerateEmail()
 {
     global $locale;
     $sText = NewTemplater::Render("email/change.txt", $locale->strings, array("campaign-name" => $this->sCampaign->sName, "confirmation-url" => "http://redonate.net/change/{$this->sSubscription->sEmailAddress}/{$this->sId}/{$this->sKey}", "unsubscribe-url" => "http://redonate.net/manage/{$this->sSubscription->sEmailAddress}/{$this->sSubscription->sSettingsKey}", "old" => Currency::Format($this->sOldCurrency, $this->sOldAmount), "new" => Currency::Format($this->sNewCurrency, $this->sNewAmount)));
     $sHtml = NewTemplater::Render("email/layout.html", $locale->strings, array("contents" => NewTemplater::Render("email/change.html", $locale->strings, array("campaign-name" => $this->sCampaign->sName, "confirmation-url" => "http://redonate.net/change/{$this->sSubscription->sEmailAddress}/{$this->sId}/{$this->sKey}", "unsubscribe-url" => "http://redonate.net/manage/{$this->sSubscription->sEmailAddress}/{$this->sSubscription->sSettingsKey}", "old" => Currency::Format($this->sOldCurrency, $this->sOldAmount), "new" => Currency::Format($this->sNewCurrency, $this->sNewAmount)))));
     return array("text" => $sText, "html" => $sHtml);
 }
 public function GenerateEmail()
 {
     global $locale;
     $sMethods = array();
     foreach ($this->sCampaign->GetPaymentMethods() as $sPaymentMethod) {
         $sMethods[] = array("name" => $sPaymentMethod->GetName(), "url" => $sPaymentMethod->GenerateUrl($this));
     }
     $sText = NewTemplater::Render("email/reminder.txt", $locale->strings, array("campaign-name" => $this->sCampaign->sName, "amount" => Currency::Format($this->sCurrency, $this->sAmount), "skip-url" => "http://redonate.net/pay/{$this->sSubscription->sEmailAddress}/{$this->sId}/{$this->sKey}/skip", "unsubscribe-url" => "http://redonate.net/manage/{$this->sSubscription->sEmailAddress}/{$this->sSubscription->sSettingsKey}", "methods" => $sMethods));
     $sHtml = NewTemplater::Render("email/layout.html", $locale->strings, array("contents" => NewTemplater::Render("email/reminder.html", $locale->strings, array("campaign-name" => $this->sCampaign->sName, "amount" => Currency::Format($this->sCurrency, $this->sAmount), "skip-url" => "http://redonate.net/pay/{$this->sSubscription->sEmailAddress}/{$this->sId}/{$this->sKey}/skip", "unsubscribe-url" => "http://redonate.net/manage/{$this->sSubscription->sEmailAddress}/{$this->sSubscription->sSettingsKey}", "methods" => $sMethods))));
     return array("text" => $sText, "html" => $sHtml);
 }
Example #3
0
// While I realize this won't stop anyone who really wants to disable the "alert" system, it might prevent someone who knows nothing about PHP.
$sLicense = Core::GetSetting('license');
NewTemplater::SetGlobalVariable("License", $sLicense->sValue);
if ($sMail->sValue == 1) {
    include "./includes/library/sendgrid/SendGrid_loader.php";
} elseif ($sMail->sValue == 2) {
    include "./includes/library/mandril/mandril.php";
}
if (isset($_SESSION["user_id"])) {
    $sUser = new User($_SESSION["user_id"]);
    $_SESSION['permissions'] = $sUser->sPermissions;
    NewTemplater::SetGlobalVariable("Username", $sUser->sUsername);
    NewTemplater::SetGlobalVariable("UserPermissions", $sUser->sPermissions);
    $sPullVPS = $database->CachedQuery("SELECT * FROM vps WHERE `user_id` = :UserId", array('UserId' => $sUser->sId));
    if (!empty($sPullVPS)) {
        foreach ($sPullVPS->data as $key => $value) {
            $sServer = new Server($value["server_id"]);
            if ($sRequest == 'view.php') {
                if ($sId == $value["id"]) {
                    $sViewing = 1;
                } else {
                    $sViewing = 0;
                }
            } else {
                $sViewing = 0;
            }
            $sVPS[] = array("id" => $value["id"], "server_id" => $sServer->sId, "server_name" => $sServer->sName, "container_id" => $value["container_id"], "hostname" => $value["hostname"], "primary_ip" => $value["primary_ip"], "type" => ucfirst($value["type"]), "viewing" => $sViewing);
        }
    }
    NewTemplater::SetGlobalVariable("UserVPS", $sVPS);
}
Example #4
0
$sProjections = array();
$sSubscribers = array();
try {
    foreach (Campaign::CreateFromQuery("SELECT * FROM campaigns WHERE `OwnerId` = :UserId", array(":UserId" => $sCurrentUser->sId)) as $sCampaign) {
        $sCampaign->UpdateStatistics();
        $sPaymentMethods = array();
        try {
            foreach (PaymentMethod::CreateFromQuery("SELECT * FROM payment_methods WHERE `CampaignId` = :CampaignId", array(":CampaignId" => $sCampaign->sId)) as $sPaymentMethod) {
                $sPaymentMethods[] = $sPaymentMethod->GetLogo();
            }
        } catch (NotFoundException $e) {
            /* No payment methods...? */
        }
        if ($sCampaign->sHaveData) {
            $sPercentages[] = $sCampaign->sDonationRate;
            $sTotals[] = $sCampaign->sMonthlyTotal;
            $sProjections[] = $sCampaign->sMonthlyProjection;
        }
        $sSubscribers[] = $sCampaign->sSubscriberCount;
        $sCampaigns[] = array("name" => $sCampaign->sName, "urlname" => $sCampaign->sUrlName, "subscribers" => number_format($sCampaign->sSubscriberCount, 0), "rate" => number_format($sCampaign->sDonationRate, 2), "total" => Currency::Format("usd", $sCampaign->sMonthlyTotal), "projection" => Currency::Format("usd", $sCampaign->sMonthlyProjection), "one-off" => $sCampaign->sAllowOneTime, "payment-methods" => $sPaymentMethods, "have-data" => $sCampaign->sHaveData);
    }
} catch (NotFoundException $e) {
    /* pass */
}
$sPercentages = empty($sPercentages) ? array(0) : $sPercentages;
$sTotals = empty($sTotals) ? array(0) : $sTotals;
$sProjections = empty($sProjections) ? array(0) : $sProjections;
$sSubscribers = empty($sSubscribers) ? array(0) : $sSubscribers;
$sPageTitle = "Dashboard";
$sPageContents = NewTemplater::Render("dashboard", $locale->strings, array("campaigns" => $sCampaigns, "total-rate" => number_format(array_sum($sPercentages) / count($sPercentages), 2), "total-subscribers" => number_format(array_sum($sSubscribers), 0), "total-total" => Currency::Format("usd", array_sum($sTotals)), "total-projection" => Currency::Format("usd", array_sum($sProjections))));
Example #5
0
/*
 * 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.
 */
if (!isset($_APP)) {
    die("Unauthorized.");
}
if (!empty($_POST['submit'])) {
    $sSubscription->uIsActive = false;
    $sSubscription->InsertIntoDatabase();
    $sLogEntry = new LogEntry(0);
    $sLogEntry->uType = LogEntry::UNSUBSCRIPTION;
    $sLogEntry->uIp = $_SERVER['REMOTE_ADDR'];
    $sLogEntry->uData = json_encode(array("email" => $sSubscription->sEmailAddress));
    $sLogEntry->uCampaignId = $sSubscription->sCampaign->sId;
    $sLogEntry->uDate = time();
    $sLogEntry->uSessionId = session_id();
    $sLogEntry->InsertIntoDatabase();
    flash_notice("We've unsubscribed you.");
    redirect("/manage/{$sSubscription->sEmailAddress}/{$sSubscription->sSettingsKey}");
}
$sPageTitle = "Change pledge amount";
$sPageContents = NewTemplater::Render("subscription/unsubscribe", $locale->strings, array("email" => $sSubscription->sEmailAddress, "key" => $sSubscription->sSettingsKey, "name" => $sSubscription->sCampaign->sName));
Example #6
0
                }
                $sQuotedRecipient = urlencode($sPaymentMethod->sAddress);
                $sQuotedName = urlencode("{$sCampaign->sName} (via ReDonate.net)");
                $sQuotedNumber = urlencode("0");
                $sQuotedReturnUrl = urlencode("http://redonate.net/thanks/{$sCampaign->sUrlName}");
                if (filter_var($sPaymentMethod->sAddress, FILTER_VALIDATE_EMAIL)) {
                    $target = "https://www.paypal.com/cgi-bin/webscr?business={$sQuotedRecipient}&cmd=_donations&item_name={$sQuotedName}&item_number={$sQuotedNumber}&currency_code={$sCurrency}&amount={$sAmount}&return={$sQuotedReturnUrl}";
                } else {
                    /* This is most likely a hosted button ID. We can only provide limited information in this case - we can really only set the item description. 
                     * Not sure if setting the return URL will work, but we might as well try. */
                    $target = "https://www.paypal.com/cgi-bin/webscr?hosted_button_id={$sQuotedRecipient}&cmd=_s-xclick&item_name={$sQuotedName}&return={$sQuotedReturnUrl}";
                }
                redirect($target);
                return;
            case PaymentMethod::BITCOIN:
                if ($sPaymentRequest->sCurrency != "btc") {
                    $sAmount = Currency::Convert("btc", $_POST['currency'], $_POST['amount']);
                } else {
                    $sAmount = htmlspecialchars($_POST['amount']);
                }
                $sPageContents = NewTemplater::Render("payment/bitcoin", $locale->strings, array("address" => $sPaymentMethod->sAddress, "amount" => Currency::Format("btc", $sAmount), "done-url" => "/thanks/{$sCampaign->sUrlName}"));
                return;
            default:
                $sPageContents = NewTemplater::Render("payment/other", $locale->strings, array("name" => $sPaymentMethod->sCustomName, "address" => $sPaymentMethod->sAddress, "amount" => Currency::Format($_POST['currency'], $_POST['amount']), "done-url" => "/thanks/{$sCampaign->sUrlName}"));
                return;
        }
    }
}
$sPageTitle = "Donate to {$sCampaign->sName} once";
$sPageContents = NewTemplater::Render("donate", $locale->strings, array("campaign-name" => $sCampaign->sName, "method-id" => $sPaymentMethod->sId, "urlname" => $sCampaign->sUrlName, "method-name" => $sMethodName));
Example #7
0
<?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.
 */
if (!isset($_APP)) {
    die("Unauthorized.");
}
try {
    $sPaymentMethod = $sPaymentRequest->sCampaign->GetPaymentMethod(PaymentMethod::BITCOIN);
} catch (NotFoundException $e) {
    throw new RouterException("No such payment method found.");
}
if ($sPaymentRequest->sCurrency != "btc") {
    $sAmount = Currency::Convert("btc", $sPaymentRequest->sCurrency, $sPaymentRequest->sAmount);
} else {
    $sAmount = $sPaymentRequest->sAmount;
}
$sPageContents = NewTemplater::Render("payment/bitcoin", $locale->strings, array("address" => $sPaymentMethod->sAddress, "amount" => Currency::Format("btc", $sAmount), "done-url" => "/pay/{$sPaymentRequest->sSubscription->sEmailAddress}/{$sPaymentRequest->sId}/{$sPaymentRequest->sKey}/bitcoin/done"));
Example #8
0
    throw new RouterException("Not authorized to administrate this campaign.");
}
if (!empty($_POST['submit'])) {
    if (empty($_POST['address'])) {
        flash_error("You did not enter a valid address or account ID.");
    }
    if (!isset($_POST['method']) || $_POST['method'] == "") {
        flash_error("You did not select a valid payment method.");
    } elseif ($_POST['method'] == "0" && empty($_POST['customname'])) {
        flash_error("You did not enter a valid name for the payment method.");
    } elseif (PaymentMethod::CheckIfValidMethod($_POST['method']) === false) {
        flash_error("You did not select a valid payment method.");
    } elseif (PaymentMethod::ValidateAddress($_POST['method'], $_POST['address']) === false) {
        flash_error("The address you entered is invalid.");
    }
    if (count(get_errors(false)) == 0) {
        $sPaymentMethod = new PaymentMethod(0);
        $sPaymentMethod->uType = $_POST['method'];
        $sPaymentMethod->uAddress = $_POST['address'];
        $sPaymentMethod->uCampaignId = $sCampaign->sId;
        if ($_POST['method'] == 0) {
            $sPaymentMethod->uCustomName = $_POST['customname'];
        }
        $sPaymentMethod->InsertIntoDatabase();
        flash_notice("The payment method was successfully added.");
        redirect("/dashboard/{$sCampaign->uUrlName}");
    }
}
$sPageTitle = "Add payment method";
$sPageContents = NewTemplater::Render("campaign/addmethod", $locale->strings, array("name" => $sCampaign->sName, "urlname" => $sCampaign->sUrlName));
Example #9
0
 * licensing text.
 */
if (!isset($_APP)) {
    die("Unauthorized.");
}
if (!empty($_SESSION['user_id'])) {
    flash_notice("You are already logged in.");
    redirect("/dashboard");
}
if (!empty($_POST['submit'])) {
    if (empty($_POST['username'])) {
        flash_error("You did not enter a username.");
    } elseif (empty($_POST['password'])) {
        flash_error("You did not enter a password.");
    } else {
        try {
            $sUser = User::CreateFromQuery("SELECT * FROM users WHERE `Username` = :Username", array(":Username" => $_POST['username']), 0, true);
            if ($sUser->VerifyPassword($_POST['password'])) {
                $sUser->Authenticate();
                flash_notice("Welcome back, {$sUser->sDisplayName}!");
                redirect("/dashboard");
            } else {
                flash_error("The password you entered is incorrect. Did you <a href=\"/forgot-password\">forget your password</a>?");
            }
        } catch (NotFoundException $e) {
            flash_error("That username does not exist.");
        }
    }
}
$sPageContents = NewTemplater::Render("login/form", $locale->strings, array());
$sPageTitle = "Login";
Example #10
0
}
try {
    $sCampaign = Campaign::FindByUrlName($router->uParameters[1]);
} catch (NotFoundException $e) {
    http_status_code(404);
    $sPageContents = NewTemplater::Render("404", $locale->strings, array());
    return;
}
$sCampaign->UpdateStatistics();
$sPaymentMethods = array();
try {
    foreach (PaymentMethod::CreateFromQuery("SELECT * FROM payment_methods WHERE `CampaignId` = :CampaignId", array(":CampaignId" => $sCampaign->sId)) as $sPaymentMethod) {
        $sNewMethod = $sPaymentMethod->GetLogo();
        $sNewMethod['address'] = $sPaymentMethod->sAddress;
        $sNewMethod['id'] = $sPaymentMethod->sId;
        $sPaymentMethods[] = $sNewMethod;
    }
} catch (NotFoundException $e) {
    /* No payment methods...? */
}
$sLogEntry = new LogEntry(0);
$sLogEntry->uType = LogEntry::PAGELOAD;
$sLogEntry->uIp = $_SERVER['REMOTE_ADDR'];
$sLogEntry->uData = json_encode(array());
$sLogEntry->uCampaignId = $sCampaign->sId;
$sLogEntry->uDate = time();
$sLogEntry->uSessionId = session_id();
$sLogEntry->InsertIntoDatabase();
$sPageTitle = "Contribute to {$sCampaign->sName}";
$sPageContents = NewTemplater::Render("landing", $locale->strings, array("can-donate-once" => $sCampaign->sAllowOneTime, "project-name" => $sCampaign->sName, "urlname" => $sCampaign->sUrlName, "methods" => $sPaymentMethods), array("currency" => $sCampaign->sDefaultCurrency, "amount" => $sCampaign->sDefaultAmount));
Example #11
0
    $class_name = str_replace("\\", "/", strtolower($class_name));
    if (file_exists("classes/{$class_name}.php")) {
        require_once "classes/{$class_name}.php";
    }
}
spl_autoload_register('autoload_redonate');
/* Set global templater variables */
NewTemplater::SetGlobalVariable("logged-in", !empty($_SESSION['user_id']));
if (!empty($_SESSION['user_id'])) {
    /* TODO: Handle being logged in to a non-existent user */
    $sCurrentUser = new User($_SESSION['user_id']);
    $sCurrentUser->SetGlobalVariables();
    NewTemplater::SetGlobalVariable("logout-key", $_SESSION['logout_key']);
}
NewTemplater::RegisterVariableHook("errors", "get_errors");
NewTemplater::RegisterVariableHook("notices", "get_notices");
function get_errors($fetch)
{
    if (isset($_SESSION['errors'])) {
        $errors = $_SESSION['errors'];
        if ($fetch === true) {
            /* We only want to clear out errors if a call to
             * actually retrieve the errors was made, not just
             * something like an isempty. */
            $_SESSION['errors'] = array();
        }
        return $errors;
    } else {
        return array();
    }
}
Example #12
0
 * Please read the accompanying LICENSE document for the full WTFPL
 * licensing text.
 */
if (!isset($_APP)) {
    die("Unauthorized.");
}
$sOtherSubscriptions = array();
foreach (Subscription::FindByEmail($sSubscription->sEmailAddress) as $sOtherSubscription) {
    /* We don't want to add the currently visible subscription to the
     * list of other subscriptions. */
    if ($sOtherSubscription->sId != $sSubscription->sId) {
        if ($sOtherSubscription->sIsConfirmed == false) {
            $sStatus = "Awaiting confirmation";
        } elseif ($sOtherSubscription->sIsActive == true) {
            $sStatus = "Active";
        } else {
            $sStatus = "Cancelled";
        }
        $sOtherSubscriptions[] = array("name" => $sOtherSubscription->sCampaign->sName, "amount" => Currency::Format($sOtherSubscription->sCurrency, $sOtherSubscription->sAmount), "key" => $sOtherSubscription->sSettingsKey, "status" => $sStatus);
    }
}
if ($sSubscription->sIsConfirmed == false) {
    $sStatus = "Awaiting confirmation";
} elseif ($sSubscription->sIsActive == true) {
    $sStatus = "Active";
} else {
    $sStatus = "Cancelled";
}
$sPageTitle = "Manage your subscriptions";
$sPageContents = NewTemplater::Render("subscription/manage", $locale->strings, array("name" => $sSubscription->sCampaign->sName, "amount" => Currency::Format($sSubscription->sCurrency, $sSubscription->sAmount), "email" => $sSubscription->sEmailAddress, "key" => $sSubscription->sSettingsKey, "status" => $sStatus, "other" => $sOtherSubscriptions));
Example #13
0
<?php

session_name('neon_auth');
require_once './includes/db.php';
require_once './includes/functions.php';
require_once './includes/global_settings.php';
require_once './includes/lib/net/ssh.php';
require_once './includes/lib/crypt/RSA.php';
include './includes/lib/net/sftp.php';
$sWriteLog = fopen($cphp_config->settings->commandlog, 'a');
$user_ssh = new Net_SSH2($sDefaultIP->sValue);
$user_sftp = new Net_SFTP($sDefaultIP->sValue);
if (isset($_SESSION['user_id'])) {
    $sUser = new User($_SESSION['user_id']);
    $LoggedIn = true;
    NewTemplater::SetGlobalVariable("Username", $sUser->sUsername);
    NewTemplater::SetGlobalVariable("UserId", $sUser->sId);
} else {
    $LoggedIn = false;
}
$sErrorMessage = NULL;
Example #14
0
    $sChangeRequest->uSubscriptionId = $sExistingSubscription->sId;
    $sChangeRequest->uCampaignId = $sExistingSubscription->sCampaign->sId;
    $sChangeRequest->uIsConfirmed = false;
    $sChangeRequest->uDate = time();
    $sChangeRequest->InsertIntoDatabase();
    $sEmail = $sChangeRequest->GenerateEmail();
    send_mail($sExistingSubscription->sEmailAddress, "Changes to your pledge to {$sExistingSubscription->sCampaign->sName}", $sEmail['text'], $sEmail['html']);
    return;
}
$sLogEntry = new LogEntry(0);
$sLogEntry->uType = LogEntry::SUBSCRIPTION;
$sLogEntry->uIp = $_SERVER['REMOTE_ADDR'];
$sLogEntry->uData = json_encode(array("email" => $_POST['email']));
$sLogEntry->uCampaignId = $sCampaign->sId;
$sLogEntry->uDate = time();
$sLogEntry->uSessionId = session_id();
$sLogEntry->InsertIntoDatabase();
$sSubscription = new Subscription(0);
$sSubscription->uEmailAddress = $_POST['email'];
$sSubscription->uConfirmationKey = random_string(25);
$sSubscription->uSettingsKey = random_string(25);
$sSubscription->uCurrency = $_POST['currency'];
$sSubscription->uAmount = str_replace(",", ".", $_POST['amount']);
$sSubscription->uSubscriptionDate = time();
$sSubscription->uIsConfirmed = false;
$sSubscription->uIsActive = false;
$sSubscription->uCampaignId = $sCampaign->sId;
$sSubscription->InsertIntoDatabase();
send_mail($_POST['email'], "Please confirm your ReDonate pledge.", NewTemplater::Render("email/confirm.txt", $locale->strings, array("project-name" => $sCampaign->sName, "confirmation-url" => "http://redonate.net/confirm/{$sSubscription->sEmailAddress}/{$sSubscription->sConfirmationKey}/", "amount" => Currency::Format($sSubscription->sCurrency, $sSubscription->sAmount))), NewTemplater::Render("email/layout.html", $locale->strings, array("contents" => NewTemplater::Render("email/confirm.html", $locale->strings, array("project-name" => $sCampaign->sName, "confirmation-url" => "http://redonate.net/confirm/{$sSubscription->sEmailAddress}/{$sSubscription->sConfirmationKey}/", "amount" => Currency::Format($sSubscription->sCurrency, $sSubscription->sAmount))))));
$sPageContents = NewTemplater::Render("subscription/success", $locale->strings, array());
$sPageTitle = "Thanks for your pledge!";
Example #15
0
<?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";
$sPageTitle = "";
$sPageContents = "";
$sError = "";
$router = new CPHPRouter();
$router->allow_slash = true;
$router->ignore_query = true;
$router->routes = array(0 => array("^/\$" => 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", "^/create\$" => array('target' => "modules/campaign/create.php", 'authenticator' => "authenticators/user.php", 'auth_error' => "modules/error/guest.php"), "^/dashboard\$" => array('target' => "modules/dashboard.php", 'authenticator' => "authenticators/user.php", 'auth_error' => "modules/error/guest.php"), "^/dashboard/([a-zA-Z0-9-]+)\$" => array('target' => "modules/campaign/dashboard.php", 'authenticator' => "authenticators/user.php", 'auth_error' => "modules/error/guest.php"), "^/dashboard/([a-zA-Z0-9-]+)/add-payment-method\$" => array('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"), "^/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"), "^/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"), "^/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"), "^/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), "^/thanks/([a-zA-Z0-9-]+)\$" => "modules/thanks.php", "^/test\$" => "modules/test.php"));
try {
    $router->RouteRequest();
} catch (RouterException $e) {
    http_status_code(404);
    $sPageTitle = "Page not found";
    $sPageContents = NewTemplater::Render("404", $locale->strings, array());
}
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'])));
Example #16
0
 * 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.
 */
if (!isset($_APP)) {
    die("Unauthorized.");
}
if (!empty($_POST['submit'])) {
    if (empty($_POST['name'])) {
        flash_error("You did not enter a valid campaign name.");
    }
    if (count(get_errors(false)) == 0) {
        $sCampaign = new Campaign(0);
        $sCampaign->uName = $_POST['name'];
        $sCampaign->uOwnerId = $sCurrentUser->sId;
        $sCampaign->uCreationDate = time();
        $sCampaign->uAllowOneTime = isset($_POST['allow_once']);
        $sCampaign->uUrlName = Campaign::GenerateUrlName($_POST['name']);
        $sCampaign->InsertIntoDatabase();
        flash_notice("Your campaign was successfully created. You should add a payment method now.");
        redirect("/dashboard/{$sCampaign->uUrlName}");
    }
}
$sPageTitle = "Create new campaign";
$sPageContents = NewTemplater::Render("campaign/create", $locale->strings, array());
Example #17
0
<?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.
 */
if (!isset($_APP)) {
    die("Unauthorized.");
}
$sPageTitle = "About";
$sPageContents = NewTemplater::Render("about", $locale->strings, array());
Example #18
0
<?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.
 */
if (empty($_APP)) {
    die("Unauthorized.");
}
$uLogoutKey = $router->uParameters[1];
if (!empty($_SESSION['logout_key']) && $_SESSION['logout_key'] == $uLogoutKey) {
    unset($_SESSION['user_id']);
    unset($_SESSION['logout_key']);
    $sPageTitle = "Logged out";
    $sPageContents = NewTemplater::Render("logout", $locale->strings, array());
    NewTemplater::SetGlobalVariable("logged-in", false);
} else {
    throw new RouterException("No valid logout key specified.");
}
Example #19
0
 * 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.
 */
if (!isset($_APP)) {
    die("Unauthorized.");
}
if (!empty($_POST['submit'])) {
    if (empty($_POST['currency'])) {
        flash_error("Please select a valid currency.");
    }
    if (empty($_POST['amount']) || preg_match("([0-9]*[.,][0-9]+|[0-9]+)", $_POST['amount']) == false) {
        flash_error("Please enter a valid amount.");
    }
    if (count(get_errors(false)) == 0) {
        $sSubscription->uAmount = str_replace(",", ".", $_POST['amount']);
        $sSubscription->uCurrency = $_POST['currency'];
        $sSubscription->InsertIntoDatabase();
        flash_notice("The monthly pledge amount for this subscription was successfully updated.");
        redirect("/manage/{$sSubscription->sEmailAddress}/{$sSubscription->sSettingsKey}");
    }
}
$sPageTitle = "Change pledge amount";
$sPageContents = NewTemplater::Render("subscription/change_amount", $locale->strings, array("email" => $sSubscription->sEmailAddress, "key" => $sSubscription->sSettingsKey));
Example #20
0
<?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.
 */
if (!isset($_APP)) {
    die("Unauthorized.");
}
$sPaymentRequest->uPaid = true;
$sPaymentRequest->InsertIntoDatabase();
$sLogEntry = new LogEntry(0);
$sLogEntry->uType = LogEntry::DONATION_SKIPPED;
$sLogEntry->uIp = $_SERVER['REMOTE_ADDR'];
$sLogEntry->uData = json_encode(array("payment_request" => $sPaymentRequest->sId));
$sLogEntry->uCampaignId = $sPaymentRequest->sCampaign->sId;
$sLogEntry->uDate = time();
$sLogEntry->uSessionId = session_id();
$sLogEntry->InsertIntoDatabase();
$sPageTitle = "Thanks for letting us know.";
$sPageContents = NewTemplater::Render("payment/skipped", $locale->strings, array());
Example #21
0
<?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.
 */
if (!isset($_APP)) {
    die("Unauthorized.");
}
try {
    $sPaymentMethod = PaymentMethod::CreateFromQuery("SELECT * FROM payment_methods WHERE `CampaignId` = :CampaignId AND `Id` = :Id", array(":CampaignId" => $sPaymentRequest->sCampaign->sId, ":Id" => $router->uParameters[4]), 0, true);
} catch (NotFoundException $e) {
    throw new RouterException("No such payment method found.");
}
$sPageContents = NewTemplater::Render("payment/other", $locale->strings, array("name" => $sPaymentMethod->sCustomName, "address" => $sPaymentMethod->sAddress, "amount" => Currency::Format($sPaymentRequest->sCurrency, $sPaymentRequest->sAmount), "done-url" => "/pay/{$sPaymentRequest->sSubscription->sEmailAddress}/{$sPaymentRequest->sId}/{$sPaymentRequest->sKey}/{$sPaymentMethod->sId}/done"));
Example #22
0
}
$sCampaign->UpdateStatistics();
$sPaymentMethods = array();
try {
    foreach (PaymentMethod::CreateFromQuery("SELECT * FROM payment_methods WHERE `CampaignId` = :CampaignId", array(":CampaignId" => $sCampaign->sId)) as $sPaymentMethod) {
        $sNewMethod = $sPaymentMethod->GetLogo();
        $sNewMethod['address'] = $sPaymentMethod->sAddress;
        $sNewMethod['id'] = $sPaymentMethod->sId;
        $sPaymentMethods[] = $sNewMethod;
    }
} catch (NotFoundException $e) {
    /* No payment methods...? */
}
$sEventTotal = $sCampaign->sPastMonthSubscriptions + $sCampaign->sPastMonthUnsubscriptions + $sCampaign->sPastMonthDonations + $sCampaign->sPastMonthNonDonations;
if ($sEventTotal !== 0) {
    $sSubscriptionPercentage = $sCampaign->sPastMonthSubscriptions / $sEventTotal * 100;
    $sUnsubscriptionPercentage = $sCampaign->sPastMonthUnsubscriptions / $sEventTotal * 100;
    $sDonationPercentage = $sCampaign->sPastMonthDonations / $sEventTotal * 100;
    $sNonDonationPercentage = $sCampaign->sPastMonthNonDonations / $sEventTotal * 100;
    $sStatisticsAvailable = true;
} else {
    /* We obviously can't divide by zero - and nothing happened anyway. */
    $sSubscriptionPercentage = 0;
    $sUnsubscriptionPercentage = 0;
    $sDonationPercentage = 0;
    $sNonDonationPercentage = 0;
    $sStatisticsAvailable = false;
}
$sPageTitle = "Dashboard for {$sCampaign->sName}";
$sPageContents = NewTemplater::Render("campaign/dashboard", $locale->strings, array("name" => $sCampaign->sName, "urlname" => $sCampaign->sUrlName, "payment-methods" => $sPaymentMethods, "subscriptions-amount" => $sCampaign->sPastMonthSubscriptions, "subscriptions-percentage" => $sSubscriptionPercentage, "unsubscriptions-amount" => $sCampaign->sPastMonthUnsubscriptions, "unsubscriptions-percentage" => $sUnsubscriptionPercentage, "donations-amount" => $sCampaign->sPastMonthDonations, "donations-percentage" => $sDonationPercentage, "nondonations-amount" => $sCampaign->sPastMonthNonDonations, "nondonations-percentage" => $sNonDonationPercentage, "statistics-available" => $sStatisticsAvailable), array("default_currency" => $sCampaign->sDefaultCurrency, "default_amount" => $sCampaign->sDefaultAmount));
 public static function AdvancedParse($templatename, $localize = array(), $compile = array())
 {
     return NewTemplater::Render($templatename, $localize, $compile);
 }
Example #24
0
 public function SetGlobalVariables()
 {
     NewTemplater::SetGlobalVariable("my-displayname", $this->sDisplayName);
 }
Example #25
0
NewTemplater::SetGlobalVariable("PanelTitle", $sPanelTitle->sValue);
$sRegistrationEnabled = Core::GetSetting('registration_enabled');
NewTemplater::SetGlobalVariable("RegistrationEnabled", $sRegistrationEnabled->sValue);
$sForgotPasswordEnabled = Core::GetSetting('forgotpassword_enabled');
NewTemplater::SetGlobalVariable("ForgotPasswordEnabled", $sForgotPasswordEnabled->sValue);
$sDefaultIP = Core::GetSetting('default_ip');
if ($sDefaultIP->sValue == localhost) {
    $sServerIP = $_SERVER['SERVER_ADDR'];
    $sUpdateIP = $database->CachedQuery("UPDATE settings SET `setting_value` = :ServerIP WHERE `setting_name` = :SettingName", array(':ServerIP' => $sServerIP, ':SettingName' => 'default_ip'), 5);
    $sDefaultIP = Core::GetSetting('default_ip');
}
NewTemplater::SetGlobalVariable("DefaultIP", $sDefaultIP->sValue);
$sMaxPanelUploadSize = Core::GetSetting('max_panel_upload_size');
NewTemplater::SetGlobalVariable("MaxPanelUploadSize", $sMaxPanelUploadSize->sValue);
$sVersion = Core::GetSetting('version');
NewTemplater::SetGlobalVariable("Version", $sVersion->sValue);
function remove_magic_quotes($array)
{
    foreach ($array as $k => $v) {
        if (is_array($v)) {
            $array[$k] = remove_magic_quotes($v);
        } else {
            $array[$k] = stripslashes($v);
        }
    }
    return $array;
}
if (get_magic_quotes_gpc()) {
    $_GET = remove_magic_quotes($_GET);
    $_POST = remove_magic_quotes($_POST);
    $_COOKIE = remove_magic_quotes($_COOKIE);