Merge branch 'master' into tres

Conflicts:
	view/css/mod_events.css
	view/theme/redbasic/css/style.css
This commit is contained in:
friendica
2015-02-05 19:38:43 -08:00
45 changed files with 7847 additions and 6813 deletions

View File

@@ -903,3 +903,63 @@ function widget_random_block($arr) {
return $o;
}
function widget_rating($arr) {
$a = get_app();
$poco_rating = get_config('system','poco_rating_enable');
if((! $poco_rating) && ($poco_rating !== false)) {
return;
}
if($arr['target'])
$hash = $arr['target'];
else
$hash = $a->poi['xchan_hash'];
if(! $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;
}
}
$self = false;
if(local_channel()) {
$channel = $a->get_channel();
if($hash == $channel['channel_hash'])
$self = true;
head_add_js('ratings.js');
}
if((($remote) || (local_channel())) && (! $self)) {
$o = '<div class="widget rateme">';
if($remote)
$o .= '<a class="rateme" href="' . $url . '"><i class="icon-pencil"></i> ' . t('Rate Me') . '</a>';
else
$o .= '<div class="rateme fakelink" onclick="doRatings(\'' . $hash . '\'); return false;"><i class="icon-pencil"></i> ' . t('Rate Me') . '</div>';
$o .= '</div>';
}
$o .= '<div class="widget rateme"><a class="rateme" href="ratings/' . $hash . '"><i class="icon-eye-open"></i> ' . t('View Ratings') . '</a>';
$o .= '</div>';
return $o;
}