diff --git a/public_html/modules/index.php b/public_html/modules/index.php new file mode 100644 index 0000000..ba6a0ed --- /dev/null +++ b/public_html/modules/index.php @@ -0,0 +1,16 @@ +strings, array()); diff --git a/public_html/modules/signup.php b/public_html/modules/signup.php new file mode 100644 index 0000000..b0523e2 --- /dev/null +++ b/public_html/modules/signup.php @@ -0,0 +1,80 @@ +forget your password?"; + } + + if(empty($_POST['password']) || strlen($_POST['password']) < 8) + { + $sErrors[] = "You did not enter a valid password. Your password has to be at least 8 characters."; + } + elseif(empty($_POST['password2']) || $_POST['password'] != $_POST['password2']) + { + $sErrors[] = "The passwords you entered did not match."; + } + + if(!empty($_POST['displayname']) && User::CheckIfDisplayNameExists($_POST['displayname'])) + { + $sErrors[] = "The (display) name you entered is already in use. Please pick a different name. You can also just use your nickname!"; + } + + if(empty($sErrors)) + { + $sUser = new User(0); + $sUser->uUsername = $_POST['username']; + $sUser->uDisplayName = (!empty($_POST['displayname'])) ? $_POST['displayname'] : $_POST['username']; + $sUser->uPassword = $_POST['password']; + $sUser->uEmailAddress = $_POST['email']; + $sUser->uActivationKey = random_string(16); + $sUser->GenerateSalt(); + $sUser->GenerateHash(); + $sUser->InsertIntoDatabase(); + + send_mail($_POST['email'], "Please confirm your registration at ReDonate.", + NewTemplater::Render("email/signup.txt", $locale->strings, array( + "confirmation-url" => "http://redonate.cryto.net/confirm/{$sUser->sEmailAddress}/{$sUser->sActivationKey}/", + "name" => $sUser->uDisplayName)), /* we don't want a HTML-entities-encoded version here */ + NewTemplater::Render("email/layout.html", $locale->strings, array( + "contents" => NewTemplater::Render("email/signup.html", $locale->strings, array( + "confirmation-url" => "http://redonate.cryto.net/confirm/{$sUser->sEmailAddress}/{$sUser->sActivationKey}/", + "name" => $sUser->sDisplayName)) + )) + ); + + $sPageContents = NewTemplater::Render("signup/success", $locale->strings, array()); + return; + } +} + +$sPageContents = NewTemplater::Render("signup/form", $locale->strings, array('errors' => $sErrors)); diff --git a/public_html/modules/subscribe.php b/public_html/modules/subscribe.php index 0c711ec..a3b860a 100644 --- a/public_html/modules/subscribe.php +++ b/public_html/modules/subscribe.php @@ -81,4 +81,17 @@ $sSubscription->uConfirmed = 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.cryto.net/confirm/{$sSubscription->sEmailAddress}/{$sSubscription->sConfirmationKey}/", + "amount" => "$5.00")), + 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.cryto.net/confirm/{$sSubscription->sEmailAddress}/{$sSubscription->sConfirmationKey}/", + "amount" => "$5.00")) + )) +); + $sPageContents = NewTemplater::Render("subscription/success", $locale->strings, array()); diff --git a/public_html/rewrite.php b/public_html/rewrite.php index 3403272..c47fea9 100644 --- a/public_html/rewrite.php +++ b/public_html/rewrite.php @@ -16,14 +16,50 @@ $_CPHP_CONFIG = "../config.json"; require("cphp/base.php"); $_APP = true; -function __autoload($class_name) +require_once('lib/swiftmailer/swift_required.php'); + +function autoload_redonate($class_name) { global $_APP; $class_name = str_replace("\\", "/", strtolower($class_name)); - require_once("classes/{$class_name}.php"); + + if(file_exists("classes/{$class_name}.php")) + { + require_once("classes/{$class_name}.php"); + } } +spl_autoload_register(autoload_redonate); + +function send_mail($to, $subject, $text, $html) +{ + global $mail_transport, $cphp_config; + $sMessage = Swift_Message::newInstance(); + $sMessage->setSubject($subject); + $sMessage->setTo($to); + $sMessage->setFrom($cphp_config->smtp->from); + $sMessage->setBody($text); + $sMessage->addPart($html, "text/html"); + + echo("
+
+ From: {$cphp_config->smtp->from}
+ To: {$to}
+ Subject: {$subject} +
+
+
{$text}
+
+
+ {$html} +
+
"); + + //$mail_transport->send($sMessage); +} + + $sPageTitle = ""; $sPageContents = ""; $sError = ""; @@ -34,8 +70,11 @@ $router->ignore_query = true; $router->routes = array( 0 => array( - "^/$" => "modules/index.php", - "^/register$" => "modules/register.php", + "^/$" => array( + 'target' => "modules/index.php", + '_padded' => false + ), + "^/sign-up$" => "modules/signup.php", "^/login$" => "modules/login.php", "^/campaign/([a-zA-Z0-9-]+)$" => "modules/landing.php", "^/campaign/([a-zA-Z0-9-]+)/subscribe$" => "modules/subscribe.php", @@ -44,4 +83,5 @@ $router->routes = array( $router->RouteRequest(); -echo(NewTemplater::Render("layout", $locale->strings, array("contents" => $sPageContents, "title" => $sPageTitle))); +echo(NewTemplater::Render("layout", $locale->strings, array("contents" => $sPageContents, "title" => $sPageTitle, + "padded" => (isset($router->uVariables['padded']) ? $router->uVariables['padded'] : true)))); diff --git a/public_html/static/css/style.css b/public_html/static/css/style.css index 6a8752d..7a9c42b 100644 --- a/public_html/static/css/style.css +++ b/public_html/static/css/style.css @@ -16,6 +16,15 @@ body margin: 0px auto; } +pre.debug +{ + white-space: pre-wrap; /* css-3 */ + white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ + white-space: -pre-wrap; /* Opera 4-6 */ + white-space: -o-pre-wrap; /* Opera 7 */ + word-wrap: break-word; /* Internet Explorer 5.5+ */ +} + /************************************** * CLEARFIX * **************************************/ @@ -65,6 +74,11 @@ body color: #3B4A28; } +.main h2.spaced +{ + margin-bottom: 24px; +} + /************************************** * FOOTER * **************************************/ @@ -99,6 +113,106 @@ body content: ""; } +.intro +{ + background-color: #F5F5F5; + padding: 14px -18px; + text-align: center; +} + +.col1, .col2 +{ + width: 46%; + line-height: 140%; +} + +.col1 +{ + font-size: 18px; + float: left; + margin-left: 8px; + text-align: justify; +} + +.col2 +{ + font-size: 17px; + float: right; + margin-right: 16px; +} + +/************************************** + * FORMS * + **************************************/ + +.formfield +{ + margin: 6px 0px; +} + +.formfield.next-similar +{ + margin-bottom: 6px; +} + +.formfield.previous-similar +{ + margin-top: 6px; +} + +.formfield label, .formfield input +{ + float: left; +} + +.formfield input +{ + font-size: 17px; + padding: 4px; + width: 30%; + border: 1px solid #6CA825; + border-radius: 1px; + background-color: #F4FDE4; +} + +.formfield label +{ + width: 18%; + font-size: 18px; + padding-top: 7px; + margin-right: 12px; + font-weight: bold; +} + +.formfield.submit +{ + padding-left: 20%; + margin-top: 24px; +} + +form .note +{ + clear: both; + font-size: 14px; + margin-left: 20%; + padding-top: 3px; +} + +form .note:before +{ + content: "↳"; + margin-right: 5px; +} + +.errors +{ + color: #2F0003; + margin-bottom: 36px; + padding: 12px; + border: 1px solid #6F0008; + background-color: #FFF7F8; +} + /************************************** * LANDING * **************************************/ @@ -264,3 +378,14 @@ p.pledge-button -ms-filter: grayscale(100%); filter: grayscale(100%); } + + +.no-padding +{ + padding: 0px; +} + +.padding +{ + padding: 16px 20px; +} diff --git a/public_html/templates/email/confirm.html.tpl b/public_html/templates/email/confirm.html.tpl new file mode 100644 index 0000000..ddcf6dd --- /dev/null +++ b/public_html/templates/email/confirm.html.tpl @@ -0,0 +1,23 @@ +

+ Hello there, great to have you on board! +

+ +

+ You've subscribed to pledge {%?amount} a month to {%?project-name} using Redonate. We want to make sure that it was really you, so you'll have to click on the following link (or copy-paste it) to confirm that you want to do this: +

+ +

+ {%?confirmation-url} +

+ +

+ If you did not subscribe and someone else used your e-mail address, don't panic! ReDonate is a service for voluntary recurring donations. We do not automatically charge for a donation, and just act as a reminder service. You can safely ignore this e-mail if you did not subscribe (or changed your mind), and we'll remove the subscription in 7 days. +

+ +

+ If you have any further questions, don't hesitate to reply to this e-mail! We promise we'll read every e-mail, and give you a personal response. +

+ +

+ - Sven Slootweg, ReDonate +

diff --git a/public_html/templates/email/confirm.txt.tpl b/public_html/templates/email/confirm.txt.tpl new file mode 100644 index 0000000..b13a7f3 --- /dev/null +++ b/public_html/templates/email/confirm.txt.tpl @@ -0,0 +1,11 @@ +Hello there, great to have you on board! + +You've subscribed to pledge {%?amount} a month to {%?project-name} using Redonate. We want to make sure that it was really you, so you'll have to click on the following link (or copy-paste it) to confirm that you want to do this: + +{%?confirmation-url} + +If you did not subscribe and someone else used your e-mail address, don't panic! ReDonate is a service for voluntary recurring donations. We do not automatically charge for a donation, and just act as a reminder service. You can safely ignore this e-mail if you did not subscribe (or changed your mind), and we'll remove the subscription in 7 days. + +If you have any further questions, don't hesitate to reply to this e-mail! We promise we'll read every e-mail, and give you a personal response. + +- Sven Slootweg, ReDonate diff --git a/public_html/templates/email/layout.html.tpl b/public_html/templates/email/layout.html.tpl new file mode 100644 index 0000000..4919ca3 --- /dev/null +++ b/public_html/templates/email/layout.html.tpl @@ -0,0 +1,5 @@ +
+

ReDonate

+ + {%?contents} +
diff --git a/public_html/templates/email/signup.html.tpl b/public_html/templates/email/signup.html.tpl new file mode 100644 index 0000000..1fa6af9 --- /dev/null +++ b/public_html/templates/email/signup.html.tpl @@ -0,0 +1,23 @@ +

+ Hello there {%?name}, great to have you on board! +

+ +

+ You've recently signed up on ReDonate. We want to make sure that it was really you, so you'll have to click (or copy-paste) the following link to let us know that you're okay with this: +

+ +

+ {%?confirmation-url} +

+ +

+ If you did not sign up yourself or you changed your mind, don't worry! You can simply ignore this e-mail, and we'll remove your account in 7 days. +

+ +

+ If you have any further questions, don't hesitate to reply to this e-mail! We promise we'll read every e-mail, and give you a personal response. +

+ +

+ - Sven Slootweg, ReDonate +

diff --git a/public_html/templates/email/signup.txt.tpl b/public_html/templates/email/signup.txt.tpl new file mode 100644 index 0000000..ac0b1e1 --- /dev/null +++ b/public_html/templates/email/signup.txt.tpl @@ -0,0 +1,11 @@ +Hello there {%?name}, great to have you on board! + +You've recently signed up on ReDonate. We want to make sure that it was really you, so you'll have to click (or copy-paste) the following link to let us know that you're okay with this: + +{%?confirmation-url} + +If you did not sign up yourself or you changed your mind, don't worry! You can simply ignore this e-mail, and we'll remove your account in 7 days. + +If you have any further questions, don't hesitate to reply to this e-mail! We promise we'll read every e-mail, and give you a personal response. + +- Sven Slootweg, ReDonate diff --git a/public_html/templates/index.tpl b/public_html/templates/index.tpl new file mode 100644 index 0000000..46241a7 --- /dev/null +++ b/public_html/templates/index.tpl @@ -0,0 +1,60 @@ +
+

ReDonate is recurring contributions, done right.

+
+
+ +
+
+
+

Why use ReDonate?

+ +

+ You just made an awesome website. Or maybe you made an album, or even a movie! You really want + to make it available to others for free, but you don't get donations very often. +

+ +

+ What if your fans are simply forgetting to donate? +

+ +

+ Maybe you've considered recurring donations. But on the other hand, would you really want to automatically take + away money from your users and fans? If they have to jump through hoops to get rid of it... is it really a donation? +

+ +

+ We're here to help. We'll allow your users and fans to subscribe to monthly donations, while + still keeping them 100% voluntary. A donor can unsubscribe or choose not to donate at any time. And + we'll give you a neat statistics page to keep track of what's going on :) +

+
+
+

Here's what you get:

+ + + +
+
+ +
+
+
+ (or log in to your existing account) +
+
+
+
diff --git a/public_html/templates/layout.tpl b/public_html/templates/layout.tpl index 2399008..d4dfd1f 100644 --- a/public_html/templates/layout.tpl +++ b/public_html/templates/layout.tpl @@ -13,7 +13,7 @@ ReDonate -
+
{%?contents}