aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2015-02-15 21:22:05 -0800
committerfriendica <info@friendica.com>2015-02-15 21:22:05 -0800
commit8774089005501a6429eb9a99a73de504598a24c3 (patch)
tree1654cc931e017c51d32568c0ce9b5f114db5903a
parent2e3daf77bbf38970cf22ec14e4a6e42b4d7bdb95 (diff)
downloadvolse-hubzilla-8774089005501a6429eb9a99a73de504598a24c3.tar.gz
volse-hubzilla-8774089005501a6429eb9a99a73de504598a24c3.tar.bz2
volse-hubzilla-8774089005501a6429eb9a99a73de504598a24c3.zip
preparatory work for site ratings
-rw-r--r--mod/ratings.php18
-rw-r--r--mod/ratingsearch.php15
-rw-r--r--view/tpl/prep.tpl5
3 files changed, 28 insertions, 10 deletions
diff --git a/mod/ratings.php b/mod/ratings.php
index fe7865778..684856f45 100644
--- a/mod/ratings.php
+++ b/mod/ratings.php
@@ -35,7 +35,7 @@ function ratings_init(&$a) {
$results = false;
- $x = z_fetch_url($url . '/ratingsearch/' . $hash);
+ $x = z_fetch_url($url . '/ratingsearch/' . urlencode($hash));
if($x['success'])
@@ -48,8 +48,9 @@ function ratings_init(&$a) {
return;
}
- $a->poi = $results['target'];
-
+ if(array_key_exists('xchan_hash',$results['target']))
+ $a->poi = $results['target'];
+
$friends = array();
$others = array();
@@ -62,9 +63,9 @@ function ratings_init(&$a) {
}
}
- $a->data = array_merge($friends,$others);
+ $a->data = array('target' => $results['target'], 'results' => array_merge($friends,$others));
- if(! $a->data) {
+ if(! $a->data['results']) {
notice( t('No ratings') . EOL);
}
@@ -90,11 +91,16 @@ function ratings_content(&$a) {
if(! $poco_rating)
return;
+ $site_target = ((array_key_exists('target',$a->data) && array_key_exists('site_url',$a->data['target'])) ?
+ $a->data['target']['site_url'] : '');
+
$o = replace_macros(get_markup_template('prep.tpl'),array(
'$header' => t('Ratings'),
'$rating_lbl' => t('Rating: ' ),
+ '$website' => t('Website: '),
+ '$site' => $site_target,
'$rating_text_lbl' => t('Description: '),
- '$raters' => $a->data
+ '$raters' => $a->data['results']
));
return $o;
diff --git a/mod/ratingsearch.php b/mod/ratingsearch.php
index ec2db570b..b95b4367e 100644
--- a/mod/ratingsearch.php
+++ b/mod/ratingsearch.php
@@ -32,12 +32,19 @@ function ratingsearch_init(&$a) {
dbesc($hash . '%')
);
+ if(! $p) {
+ $p = q("select * from site where site_url like '%s' ",
+ dbesc('%' . $hash)
+ );
+
+ if(! $p) {
+ $ret['message'] = 'channel not found';
+ json_return_and_die($ret);
+ }
+ }
+
if($p)
$ret['target'] = $p[0];
- else {
- $ret['message'] = 'channel not found';
- json_return_and_die($ret);
- }
$ret['success'] = true;
diff --git a/view/tpl/prep.tpl b/view/tpl/prep.tpl
index 83a86372c..7bef7a417 100644
--- a/view/tpl/prep.tpl
+++ b/view/tpl/prep.tpl
@@ -1,5 +1,10 @@
<h1>{{$header}}</h1>
+{{if $site}}
+<h3>{{$website}} {{$site}}</h3>
+{{/if}}
+
+
{{if $raters}}
{{foreach $raters as $r}}