diff options
-rwxr-xr-x | mod/like.php | 49 | ||||
-rwxr-xr-x | view/tpl/head.tpl | 5 |
2 files changed, 44 insertions, 10 deletions
diff --git a/mod/like.php b/mod/like.php index ececb31c7..55a436175 100755 --- a/mod/like.php +++ b/mod/like.php @@ -9,6 +9,16 @@ function like_content(&$a) { $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'])); @@ -60,6 +70,10 @@ function like_content(&$a) { ); if(! $d) { // forgery - illegal + if($interactive) { + notice( t('Invalid request.') . EOL); + return; + } killme(); } // $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)) ); - if(! $r) + if(! $r) { + if($interactive) { + notice( t('Invalid request.') . EOL); + return; + } killme(); + } $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(); + } // 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']); - if(! ($perms['post_wall'] && $perms['view_profile'])) + if(! ($perms['post_wall'] && $perms['view_profile'])) { + if($interactive) { + notice( t('Permission denied.') . EOL); + return; + } killme(); + } $ch = q("select * from channel left join xchan on channel_hash = xchan_hash where channel_id = %d limit 1", intval($owner_uid) ); - if(! $ch) + if(! $ch) { + if($interactive) { + notice( t('Channel unavailable.') . EOL); + return; + } killme(); - - + } + if(! $plink) $plink = '[zrl=' . z_root() . '/profile/' . $ch[0]['channel_address'] . ']' . $post_type . '[/zrl]'; @@ -164,6 +197,10 @@ function like_content(&$a) { intval($z[0]['id']) ); drop_item($z[0]['iid'],false); + if($interactive) { + notice( t('Previous action reversed.') . EOL); + return; + } killme(); } } diff --git a/view/tpl/head.tpl b/view/tpl/head.tpl index a212fd486..b90bf8b89 100755 --- a/view/tpl/head.tpl +++ b/view/tpl/head.tpl @@ -1,15 +1,12 @@ <meta http-equiv="Content-Type" content="text/html;charset=utf-8" /> <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}}" /> <!--[if IE]> <script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![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}} {{$js_strings}} |