From 67259b560c63d42e90f2138c798097627859c9fa Mon Sep 17 00:00:00 2001 From: flashwave Date: Wed, 1 Jul 2015 20:22:45 +0200 Subject: [PATCH] one last meow for today --- README.md | 26 +++++++++++++++++++++ _sakura/changelog.json | 8 +++++++ _sakura/components/Users.php | 2 +- _sakura/templates/yuuno/main/support.tpl | 6 ++--- api/.htaccess | 6 ++++- api/api.php | 29 ++++++++++++++++++++++++ main/support.php | 11 +++++---- 7 files changed, 78 insertions(+), 10 deletions(-) create mode 100644 api/api.php diff --git a/README.md b/README.md index 8b25856..d3799a9 100644 --- a/README.md +++ b/README.md @@ -3,3 +3,29 @@ _A backend that doesn't suck_ I'll write a more descriptive readme once it's in a stable state. + +## Apache 2.x Virtualhosts + +``` + + DocumentRoot [local path]/main + ServerName [site url] + ServerAlias www.[site url] + + + + DocumentRoot [local path]/content + ServerName content.[site url] + + Header unset Cookie + Header unset Set-Cookie + + + + DocumentRoot [local path]/api + ServerName api.[site url] + + Header unset Cookie + Header unset Set-Cookie + +``` diff --git a/_sakura/changelog.json b/_sakura/changelog.json index 8b1f1c6..0466374 100644 --- a/_sakura/changelog.json +++ b/_sakura/changelog.json @@ -1397,6 +1397,14 @@ { "type": "FIX", "change": "Moved expire variable for the complete page out of the url and take the data straight from the database." + }, + { + "type": "UPD", + "change": "Made the maximum amount of month you get buy premium for changable." + }, + { + "type": "ADD", + "change": "Added basic API handler." } ] diff --git a/_sakura/components/Users.php b/_sakura/components/Users.php index ed362ac..a9169cf 100644 --- a/_sakura/components/Users.php +++ b/_sakura/components/Users.php @@ -1007,7 +1007,7 @@ class Users { // Check if the user has static premium if(Permissions::check('SITE', 'STATIC_PREMIUM', $id, 1)) - return [1, 0, time() + 1]; + return [2, 0, time() + 1]; // Attempt to retrieve the premium record from the database $getRecord = Database::fetch('premium', false, [ diff --git a/_sakura/templates/yuuno/main/support.tpl b/_sakura/templates/yuuno/main/support.tpl index 61ba2fa..40446be 100644 --- a/_sakura/templates/yuuno/main/support.tpl +++ b/_sakura/templates/yuuno/main/support.tpl @@ -15,8 +15,8 @@ Your current Tenshi tag
-

Your Tenshi tag is valid till {{ page.current[2]|date("l \\t\\h\\e jS \\o\\f F o") }}.

- +

{% if page.current[0] == 2 %}Your rank has persistent Tenshi.{% else %}Your Tenshi tag is valid till {{ page.current[2]|date("l \\t\\h\\e jS \\o\\f F o") }}.{% endif %}

+
{% endif %}
@@ -86,7 +86,7 @@
{% if user.checklogin and perms.canGetPremium %}
- +
diff --git a/api/.htaccess b/api/.htaccess index 34dab00..3511200 100644 --- a/api/.htaccess +++ b/api/.htaccess @@ -1 +1,5 @@ -# Empty .htaccess to make git realise this directory exists \ No newline at end of file +RewriteEngine On + +RewriteCond %{REQUEST_FILENAME} !-f + +RewriteRule ^(.*)$ api.php [QSA,L] diff --git a/api/api.php b/api/api.php new file mode 100644 index 0000000..1b9c891 --- /dev/null +++ b/api/api.php @@ -0,0 +1,29 @@ + 24) { + if(!isset($_POST['months']) || !is_numeric($_POST['months']) || (int)$_POST['months'] < 1 || (int)$_POST['months'] > Configuration::getConfig('premium_amount_max')) { header('Location: /support?fail=true'); @@ -125,10 +125,11 @@ if(isset($_REQUEST['mode']) && Users::checkLogin() && Permissions::check('SITE', // Set default variables $renderData['page'] = [ - 'title' => 'Support Flashii', - 'fail' => isset($_GET['fail']), - 'price' => Configuration::getConfig('premium_price_per_month'), - 'current' => Users::checkUserPremium(Session::$userId) + 'title' => 'Support Flashii', + 'fail' => isset($_GET['fail']), + 'price' => Configuration::getConfig('premium_price_per_month'), + 'current' => Users::checkUserPremium(Session::$userId), + 'amount_max' => Configuration::getConfig('premium_amount_max') ]; // Print page contents