aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2014-07-17 19:07:39 -0700
committerfriendica <info@friendica.com>2014-07-17 19:07:39 -0700
commit0cb81714d80e3d51dc4939664425b7d1978b5d06 (patch)
treef90b6ddaafd2c10aba5a68a11cc4d45b90e30a1b
parent39632f65b6781d869fc420d25f3dbc153fde48b6 (diff)
downloadvolse-hubzilla-0cb81714d80e3d51dc4939664425b7d1978b5d06.tar.gz
volse-hubzilla-0cb81714d80e3d51dc4939664425b7d1978b5d06.tar.bz2
volse-hubzilla-0cb81714d80e3d51dc4939664425b7d1978b5d06.zip
better handling of interactive likes
-rwxr-xr-xmod/like.php27
-rw-r--r--mod/rmagic.php6
2 files changed, 19 insertions, 14 deletions
diff --git a/mod/like.php b/mod/like.php
index d0871f1be..f4feca279 100755
--- a/mod/like.php
+++ b/mod/like.php
@@ -7,13 +7,16 @@ require_once('include/items.php');
function like_content(&$a) {
+ $o = '';
$observer = $a->get_observer();
$interactive = $_REQUEST['interactive'];
if($interactive) {
+ $o .= '<h1>' . t('Like/Dislike') . '</h1>';
+ $o .= EOL . EOL;
+
if(! $observer) {
- $o .= '<h1>' . t('Like/Dislike') . '</h1>';
- $o .= EOL . EOL;
+ $_SESSION['return_url'] = $a->query_string;
$o .= t('This action is restricted to members.') . EOL;
$o .= t('Please <a href="rmagic">login with your RedMatrix ID</a> or <a href="register">register as a new RedMatrix member</a> to continue.') . EOL;
return $o;
@@ -72,7 +75,7 @@ function like_content(&$a) {
// forgery - illegal
if($interactive) {
notice( t('Invalid request.') . EOL);
- return;
+ return $o;
}
killme();
}
@@ -99,7 +102,7 @@ function like_content(&$a) {
if(! $r) {
if($interactive) {
notice( t('Invalid request.') . EOL);
- return;
+ return $o;
}
killme();
}
@@ -137,7 +140,7 @@ function like_content(&$a) {
if(! ($owner_uid && $r)) {
if($interactive) {
notice( t('Invalid request.') . EOL);
- return;
+ return $o;
}
killme();
}
@@ -149,7 +152,7 @@ function like_content(&$a) {
if(! ($perms['post_wall'] && $perms['view_profile'])) {
if($interactive) {
notice( t('Permission denied.') . EOL);
- return;
+ return $o;
}
killme();
}
@@ -160,7 +163,7 @@ function like_content(&$a) {
if(! $ch) {
if($interactive) {
notice( t('Channel unavailable.') . EOL);
- return;
+ return $o;
}
killme();
}
@@ -199,7 +202,7 @@ function like_content(&$a) {
drop_item($z[0]['iid'],false);
if($interactive) {
notice( t('Previous action reversed.') . EOL);
- return;
+ return $o;
}
killme();
}
@@ -411,11 +414,9 @@ function like_content(&$a) {
proc_run('php',"include/notifier.php","like","$post_id");
if($interactive) {
- notice( t('Action completed.') . EOL);
- $o .= '<h1>' . t('Like/Dislike') . '</h1>';
- $o .= EOL . EOL;
- $o .= t('Thank you.');
- return $o;
+ notice( t('Action completed.') . EOL);
+ $o .= t('Thank you.');
+ return $o;
}
killme();
diff --git a/mod/rmagic.php b/mod/rmagic.php
index 946277327..de81cdcde 100644
--- a/mod/rmagic.php
+++ b/mod/rmagic.php
@@ -65,7 +65,11 @@ function rmagic_post(&$a) {
}
if($url) {
- $dest = z_root() . '/' . str_replace('zid=','zid_=',$a->query_string);
+ if($_SESSION['return_url'])
+ $dest = urlencode(z_root() . '/' . str_replace('zid=','zid_=',$_SESSION['return_url']));
+ else
+ $dest = urlencode(z_root() . '/' . str_replace('zid=','zid_=',$a->query_string));
+
goaway($url . '/magic' . '?f=&dest=' . $dest);
}
}