diff options
author | friendica <info@friendica.com> | 2015-02-04 17:32:29 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2015-02-04 17:32:29 -0800 |
commit | 561bab4ece9fa5844a0cb00f3cbd75e0855b2796 (patch) | |
tree | 9e614fce416c8b54d6a1a03cc70b1c05bdc48ec6 /include/widgets.php | |
parent | 48a145a8ed341c1f28f941be2eaab053c172e3f1 (diff) | |
download | volse-hubzilla-561bab4ece9fa5844a0cb00f3cbd75e0855b2796.tar.gz volse-hubzilla-561bab4ece9fa5844a0cb00f3cbd75e0855b2796.tar.bz2 volse-hubzilla-561bab4ece9fa5844a0cb00f3cbd75e0855b2796.zip |
remote rating and addition of rate-me to channel profile sidebar
Diffstat (limited to 'include/widgets.php')
-rw-r--r-- | include/widgets.php | 38 |
1 files changed, 30 insertions, 8 deletions
diff --git a/include/widgets.php b/include/widgets.php index 71407ad3d..7d2aaeb99 100644 --- a/include/widgets.php +++ b/include/widgets.php @@ -907,10 +907,6 @@ function widget_random_block($arr) { function widget_rating($arr) { $a = get_app(); - if(! local_channel()) - return; - - $channel = $a->get_channel(); if($arr['target']) $hash = $arr['target']; @@ -920,13 +916,39 @@ function widget_rating($arr) { if(! $hash) return; - if($hash == $channel['channel_hash']) - return; + $url = ''; + $remote = false; + + if(remote_channel() && ! local_channel()) { + $ob = $a->get_observer(); + if($ob && $ob['xchan_url']) { + $p = parse_url($ob['xchan_url']); + if($p) { + $url = $p['scheme'] . '://' . $p['host'] . (($p['port']) ? ':' . $p['port'] : ''); + $url .= '/rate?f=&target=' . urlencode($hash); + } + $remote = true; + } + } - head_add_js('ratings.js'); + if(local_channel()) { + $channel = $a->get_channel(); + + if($hash == $channel['channel_hash']) + return; + + head_add_js('ratings.js'); + + } + + if((! $remote) && (! local_channel())) + return; $o = '<div class="widget rateme">'; - $o .= '<div class="rateme fakelink" onclick="doRatings(\'' . $hash . '\'); return false;"><i class="icon-pencil"></i> ' . t('Rate Me') . '</div></div>'; + if($remote) + $o .= '<a class="rateme" href="' . $url . '"><i class="icon-pencil"></i> ' . t('Rate Me') . '</a></div>'; + else + $o .= '<div class="rateme fakelink" onclick="doRatings(\'' . $hash . '\'); return false;"><i class="icon-pencil"></i> ' . t('Rate Me') . '</div></div>'; return $o; }
\ No newline at end of file |