aboutsummaryrefslogtreecommitdiffstats
path: root/mod
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-03 21:19:29 -0800
committerfriendica <info@friendica.com>2015-02-03 21:19:29 -0800
commit4ead2cd79d3c7e5c29a11785a3ceefef6d3ba93f (patch)
treeb2f366402f79f162471b8285ffbea76dd8f44960 /mod
parent86771547e6d04d046d3beeabb8e4486a59a7fcc6 (diff)
downloadvolse-hubzilla-4ead2cd79d3c7e5c29a11785a3ceefef6d3ba93f.tar.gz
volse-hubzilla-4ead2cd79d3c7e5c29a11785a3ceefef6d3ba93f.tar.bz2
volse-hubzilla-4ead2cd79d3c7e5c29a11785a3ceefef6d3ba93f.zip
final cleanup on ratings feature
Diffstat (limited to 'mod')
-rw-r--r--mod/prate.php24
1 files changed, 23 insertions, 1 deletions
diff --git a/mod/prate.php b/mod/prate.php
index 62f188891..b89d16f42 100644
--- a/mod/prate.php
+++ b/mod/prate.php
@@ -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) {
+