diff options
-rw-r--r-- | include/zot.php | 2 | ||||
-rw-r--r-- | mod/rate.php | 9 | ||||
-rw-r--r-- | mod/ratings.php | 3 | ||||
-rw-r--r-- | mod/ratingsearch.php | 14 | ||||
-rw-r--r-- | view/tpl/rating_form.tpl | 2 |
5 files changed, 22 insertions, 8 deletions
diff --git a/include/zot.php b/include/zot.php index da6ca16c3..926764635 100644 --- a/include/zot.php +++ b/include/zot.php @@ -2442,7 +2442,7 @@ function import_site($arr,$pubkey) { } $directory_url = htmlspecialchars($arr['directory_url'],ENT_COMPAT,'UTF-8',false); - $url = htmlspecialchars($arr['url'],ENT_COMPAT,'UTF-8',false); + $url = htmlspecialchars(strtolower($arr['url']),ENT_COMPAT,'UTF-8',false); $sellpage = htmlspecialchars($arr['sellpage'],ENT_COMPAT,'UTF-8',false); $site_location = htmlspecialchars($arr['location'],ENT_COMPAT,'UTF-8',false); $site_realm = htmlspecialchars($arr['realm'],ENT_COMPAT,'UTF-8',false); diff --git a/mod/rate.php b/mod/rate.php index cc12dcac9..2555b36a2 100644 --- a/mod/rate.php +++ b/mod/rate.php @@ -21,6 +21,13 @@ function rate_init(&$a) { if($r) { $a->poi = $r[0]; } + else { + $r = q("select * from site where site_url like '%s' ", + dbesc('%' . $target) + ); + if($r) + $a->data['site'] = strtolower($r[0]); + } } @@ -145,6 +152,8 @@ function rate_content(&$a) { $o = replace_macros(get_markup_template('rating_form.tpl'),array( '$header' => t('Rating'), + '$website' => t('Website:'), + '$site' => (($a->data['site']) ? '<a href="' . $a->data['site']['site_url'] . '" >' . $a->data['site']['site_url'] . '</a>' : ''), 'target' => $a->data['target'], '$tgt_name' => (($a->poi && $a->poi['xchan_name']) ? $a->poi['xchan_name'] : sprintf( t('Remote Channel [%s] (not yet known on this site)'), substr($a->data['target'],0,16))), '$lbl_rating' => t('Rating (this information is public)'), diff --git a/mod/ratings.php b/mod/ratings.php index 684856f45..dc98eb238 100644 --- a/mod/ratings.php +++ b/mod/ratings.php @@ -92,7 +92,8 @@ function ratings_content(&$a) { return; $site_target = ((array_key_exists('target',$a->data) && array_key_exists('site_url',$a->data['target'])) ? - $a->data['target']['site_url'] : ''); + '<a href="' . $a->data['target']['site_url'] . '" >' . $a->data['target']['site_url'] . '</a>' : ''); + $o = replace_macros(get_markup_template('prep.tpl'),array( '$header' => t('Ratings'), diff --git a/mod/ratingsearch.php b/mod/ratingsearch.php index b95b4367e..9c4f2f827 100644 --- a/mod/ratingsearch.php +++ b/mod/ratingsearch.php @@ -32,13 +32,17 @@ function ratingsearch_init(&$a) { dbesc($hash . '%') ); - if(! $p) { + if($p) + $target = $p[0]['xchan_hash']; + else { $p = q("select * from site where site_url like '%s' ", dbesc('%' . $hash) ); - - if(! $p) { - $ret['message'] = 'channel not found'; + if($p) { + $target = strtolower($hash); + } + else { + $ret['message'] = 'Rating target not found'; json_return_and_die($ret); } } @@ -50,7 +54,7 @@ function ratingsearch_init(&$a) { $r = q("select * from xlink left join xchan on xlink_xchan = xchan_hash where xlink_link = '%s' and xlink_rating != 0 and xlink_static = 1 order by xchan_name asc", - dbesc($p[0]['xchan_hash']) + dbesc($target) ); if($r) { diff --git a/view/tpl/rating_form.tpl b/view/tpl/rating_form.tpl index 216bf6ede..95c2eb03f 100644 --- a/view/tpl/rating_form.tpl +++ b/view/tpl/rating_form.tpl @@ -1,6 +1,6 @@ <h3>{{$header}}</h3> -<div class="rating-target-name">{{$tgt_name}}</div> +<div class="rating-target-name">{{if $site}}{{$website}} {{$site}}{{else}}{{$tgt_name}}{{/if}}</div> <h3>{{$lbl_rating}}</h3> |