make mod_like interactive if requested
This commit is contained in:
parent
437b0cb16e
commit
bfe4bdc30b
49
mod/like.php
49
mod/like.php
@ -9,6 +9,16 @@ function like_content(&$a) {
|
|||||||
|
|
||||||
|
|
||||||
$observer = $a->get_observer();
|
$observer = $a->get_observer();
|
||||||
|
$interactive = $_REQUEST['interactive'];
|
||||||
|
if($interactive) {
|
||||||
|
if(! $observer) {
|
||||||
|
$o .= '<h1>' . t('Like/Dislike') . '</h1>';
|
||||||
|
$o .= EOL . 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;
|
||||||
|
return $o;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$verb = notags(trim($_GET['verb']));
|
$verb = notags(trim($_GET['verb']));
|
||||||
|
|
||||||
@ -60,6 +70,10 @@ function like_content(&$a) {
|
|||||||
);
|
);
|
||||||
if(! $d) {
|
if(! $d) {
|
||||||
// forgery - illegal
|
// forgery - illegal
|
||||||
|
if($interactive) {
|
||||||
|
notice( t('Invalid request.') . EOL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
// $d now contains a list of those who can see this profile - only send the status notification
|
// $d now contains a list of those who can see this profile - only send the status notification
|
||||||
@ -82,8 +96,13 @@ function like_content(&$a) {
|
|||||||
dbesc(argv(2))
|
dbesc(argv(2))
|
||||||
);
|
);
|
||||||
|
|
||||||
if(! $r)
|
if(! $r) {
|
||||||
|
if($interactive) {
|
||||||
|
notice( t('Invalid request.') . EOL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
killme();
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
$owner_uid = $r[0]['obj_channel'];
|
$owner_uid = $r[0]['obj_channel'];
|
||||||
|
|
||||||
@ -115,23 +134,37 @@ function like_content(&$a) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if(! ($owner_uid && $r))
|
if(! ($owner_uid && $r)) {
|
||||||
|
if($interactive) {
|
||||||
|
notice( t('Invalid request.') . EOL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
killme();
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
// The resultant activity is going to be a wall-to-wall post, so make sure this is allowed
|
// The resultant activity is going to be a wall-to-wall post, so make sure this is allowed
|
||||||
|
|
||||||
$perms = get_all_perms($owner_uid,$observer['xchan_hash']);
|
$perms = get_all_perms($owner_uid,$observer['xchan_hash']);
|
||||||
|
|
||||||
if(! ($perms['post_wall'] && $perms['view_profile']))
|
if(! ($perms['post_wall'] && $perms['view_profile'])) {
|
||||||
|
if($interactive) {
|
||||||
|
notice( t('Permission denied.') . EOL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
killme();
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
$ch = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_id = %d limit 1",
|
$ch = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_id = %d limit 1",
|
||||||
intval($owner_uid)
|
intval($owner_uid)
|
||||||
);
|
);
|
||||||
if(! $ch)
|
if(! $ch) {
|
||||||
|
if($interactive) {
|
||||||
|
notice( t('Channel unavailable.') . EOL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
killme();
|
killme();
|
||||||
|
}
|
||||||
|
|
||||||
if(! $plink)
|
if(! $plink)
|
||||||
$plink = '[zrl=' . z_root() . '/profile/' . $ch[0]['channel_address'] . ']' . $post_type . '[/zrl]';
|
$plink = '[zrl=' . z_root() . '/profile/' . $ch[0]['channel_address'] . ']' . $post_type . '[/zrl]';
|
||||||
|
|
||||||
@ -164,6 +197,10 @@ function like_content(&$a) {
|
|||||||
intval($z[0]['id'])
|
intval($z[0]['id'])
|
||||||
);
|
);
|
||||||
drop_item($z[0]['iid'],false);
|
drop_item($z[0]['iid'],false);
|
||||||
|
if($interactive) {
|
||||||
|
notice( t('Previous action reversed.') . EOL);
|
||||||
|
return;
|
||||||
|
}
|
||||||
killme();
|
killme();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,15 +1,12 @@
|
|||||||
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
|
||||||
<base href="{{$baseurl}}/" />
|
<base href="{{$baseurl}}/" />
|
||||||
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=0">
|
<meta name="viewport" content="width=device-width, height=device-height, initial-scale=1, user-scalable=0" />
|
||||||
<meta name="generator" content="{{$generator}}" />
|
<meta name="generator" content="{{$generator}}" />
|
||||||
|
|
||||||
<!--[if IE]>
|
<!--[if IE]>
|
||||||
<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
|
|
||||||
<script>(function(w){var dpr=((w.devicePixelRatio===undefined)?1:w.devicePixelRatio);if(!!w.navigator.standalone){var r=new XMLHttpRequest();r.open('GET','/retinaimages.php?devicePixelRatio='+dpr,false);r.send()}else{document.cookie='devicePixelRatio='+dpr+'; path=/'}})(window)</script>
|
|
||||||
<noscript><style id="devicePixelRatio" media="only screen and (-moz-min-device-pixel-ratio: 2), only screen and (-o-min-device-pixel-ratio: 2/1), only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-device-pixel-ratio: 2)">html{background-image:url("/retinaimages.php?devicePixelRatio=2")}</style></noscript>
|
|
||||||
|
|
||||||
{{$head_css}}
|
{{$head_css}}
|
||||||
|
|
||||||
{{$js_strings}}
|
{{$js_strings}}
|
||||||
|
Reference in New Issue
Block a user