final cleanup on ratings feature

This commit is contained in:
friendica
2015-02-03 21:19:29 -08:00
parent 86771547e6
commit 4ead2cd79d
8 changed files with 60 additions and 14 deletions

View File

@@ -1,5 +1,26 @@
<?php
function prate_init(&$a) {
if($_SERVER['REQUEST_METHOD'] === 'post')
return;
if(! local_channel())
return;
$channel = $a->get_channel();
$target = argv(1);
if(! $target)
return;
$r = q("select * from xlink where xlink_xchan = '%s' and xlink_link = '%s' and xlink_static = 1",
dbesc($channel['channel_hash']),
dbesc($target)
);
if($r)
json_return_and_die(array('rating' => $r[0]['xlink_rating'],'rating_text' => $r[0]['xlink_rating_text']));
killme();
}
function prate_post(&$a) {
@@ -63,7 +84,7 @@ function prate_post(&$a) {
proc_run('php','include/ratenotif.php','rating',$record);
}
return;
json_return_and_die(array('result' => true));;
}
@@ -75,3 +96,4 @@ function prate_post(&$a) {