]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
if not a POST, redirect to subscriptions
authorEvan Prodromou <evan@prodromou.name>
Sat, 5 Jul 2008 21:36:37 +0000 (17:36 -0400)
committerEvan Prodromou <evan@prodromou.name>
Sat, 5 Jul 2008 21:36:37 +0000 (17:36 -0400)
darcs-hash:20080705213637-84dde-87ceb18bfc0db5248083bae1b9ce7ef088a68fe2.gz

actions/subscribe.php
actions/unsubscribe.php

index 9a1d43fa5df4786b5f97f61013575e5b51c481e2..fe683828a7623911d3046af8a6b0797f471ecd93 100644 (file)
@@ -28,6 +28,13 @@ class SubscribeAction extends Action {
                        return;
                }
 
+               $user = common_current_user();
+
+               if ($_SERVER['REQUEST_METHOD'] != 'POST') {
+                       common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
+                       return;
+               }
+               
                $other_nickname = $this->arg('subscribeto');
 
                $other = User::staticGet('nickname', $other_nickname);
@@ -37,8 +44,6 @@ class SubscribeAction extends Action {
                        return;
                }
 
-               $user = common_current_user();
-
                if ($user->isSubscribed($other)) {
                        common_user_error(_t('Already subscribed!.'));
                        return;
index fabb7148e1404a27a65b60740afced403d58bf0c..1bf95fb612b16bb69d8cfbab0b954e0e435b8ded 100644 (file)
@@ -24,6 +24,14 @@ class UnsubscribeAction extends Action {
                        common_user_error(_t('Not logged in.'));
                        return;
                }
+               
+               $user = common_current_user();
+
+               if ($_SERVER['REQUEST_METHOD'] != 'POST') {
+                       common_redirect(common_local_url('subscriptions', array('nickname' => $user->nickname)));
+                       return;
+               }
+               
                $other_nickname = $this->arg('unsubscribeto');
                $other = User::staticGet('nickname', $other_nickname);
                if (!$other) {
@@ -31,8 +39,6 @@ class UnsubscribeAction extends Action {
                        return;
                }
 
-               $user = common_current_user();
-
                if (!$user->isSubscribed($other)) {
                        common_server_error(_t('Not subscribed!.'));
                }