better handling of interactive likes
This commit is contained in:
parent
39632f65b6
commit
0cb81714d8
27
mod/like.php
27
mod/like.php
@ -7,13 +7,16 @@ require_once('include/items.php');
|
|||||||
|
|
||||||
function like_content(&$a) {
|
function like_content(&$a) {
|
||||||
|
|
||||||
|
$o = '';
|
||||||
|
|
||||||
$observer = $a->get_observer();
|
$observer = $a->get_observer();
|
||||||
$interactive = $_REQUEST['interactive'];
|
$interactive = $_REQUEST['interactive'];
|
||||||
if($interactive) {
|
if($interactive) {
|
||||||
|
$o .= '<h1>' . t('Like/Dislike') . '</h1>';
|
||||||
|
$o .= EOL . EOL;
|
||||||
|
|
||||||
if(! $observer) {
|
if(! $observer) {
|
||||||
$o .= '<h1>' . t('Like/Dislike') . '</h1>';
|
$_SESSION['return_url'] = $a->query_string;
|
||||||
$o .= EOL . EOL;
|
|
||||||
$o .= t('This action is restricted to members.') . EOL;
|
$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;
|
$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;
|
return $o;
|
||||||
@ -72,7 +75,7 @@ function like_content(&$a) {
|
|||||||
// forgery - illegal
|
// forgery - illegal
|
||||||
if($interactive) {
|
if($interactive) {
|
||||||
notice( t('Invalid request.') . EOL);
|
notice( t('Invalid request.') . EOL);
|
||||||
return;
|
return $o;
|
||||||
}
|
}
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
@ -99,7 +102,7 @@ function like_content(&$a) {
|
|||||||
if(! $r) {
|
if(! $r) {
|
||||||
if($interactive) {
|
if($interactive) {
|
||||||
notice( t('Invalid request.') . EOL);
|
notice( t('Invalid request.') . EOL);
|
||||||
return;
|
return $o;
|
||||||
}
|
}
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
@ -137,7 +140,7 @@ function like_content(&$a) {
|
|||||||
if(! ($owner_uid && $r)) {
|
if(! ($owner_uid && $r)) {
|
||||||
if($interactive) {
|
if($interactive) {
|
||||||
notice( t('Invalid request.') . EOL);
|
notice( t('Invalid request.') . EOL);
|
||||||
return;
|
return $o;
|
||||||
}
|
}
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
@ -149,7 +152,7 @@ function like_content(&$a) {
|
|||||||
if(! ($perms['post_wall'] && $perms['view_profile'])) {
|
if(! ($perms['post_wall'] && $perms['view_profile'])) {
|
||||||
if($interactive) {
|
if($interactive) {
|
||||||
notice( t('Permission denied.') . EOL);
|
notice( t('Permission denied.') . EOL);
|
||||||
return;
|
return $o;
|
||||||
}
|
}
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
@ -160,7 +163,7 @@ function like_content(&$a) {
|
|||||||
if(! $ch) {
|
if(! $ch) {
|
||||||
if($interactive) {
|
if($interactive) {
|
||||||
notice( t('Channel unavailable.') . EOL);
|
notice( t('Channel unavailable.') . EOL);
|
||||||
return;
|
return $o;
|
||||||
}
|
}
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
@ -199,7 +202,7 @@ function like_content(&$a) {
|
|||||||
drop_item($z[0]['iid'],false);
|
drop_item($z[0]['iid'],false);
|
||||||
if($interactive) {
|
if($interactive) {
|
||||||
notice( t('Previous action reversed.') . EOL);
|
notice( t('Previous action reversed.') . EOL);
|
||||||
return;
|
return $o;
|
||||||
}
|
}
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
@ -411,11 +414,9 @@ function like_content(&$a) {
|
|||||||
proc_run('php',"include/notifier.php","like","$post_id");
|
proc_run('php',"include/notifier.php","like","$post_id");
|
||||||
|
|
||||||
if($interactive) {
|
if($interactive) {
|
||||||
notice( t('Action completed.') . EOL);
|
notice( t('Action completed.') . EOL);
|
||||||
$o .= '<h1>' . t('Like/Dislike') . '</h1>';
|
$o .= t('Thank you.');
|
||||||
$o .= EOL . EOL;
|
return $o;
|
||||||
$o .= t('Thank you.');
|
|
||||||
return $o;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
killme();
|
killme();
|
||||||
|
@ -65,7 +65,11 @@ function rmagic_post(&$a) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($url) {
|
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);
|
goaway($url . '/magic' . '?f=&dest=' . $dest);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user