aboutsummaryrefslogtreecommitdiffstats
path: root/mod/prate.php
diff options
context:
space:
mode:
Diffstat (limited to 'mod/prate.php')
-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) {
+