diff options
author | friendica <info@friendica.com> | 2015-01-28 17:39:53 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2015-01-28 17:39:53 -0800 |
commit | 9b3b0b5e887662c2bfdf2013fb2acb83cdc6f443 (patch) | |
tree | 3ebdf8717899a81af8fa05c0241dd04a5be72bd9 /mod/dirsearch.php | |
parent | 1ef2d1c5c405a5c9ab7f41a4fdefd295098b5ac8 (diff) | |
download | volse-hubzilla-9b3b0b5e887662c2bfdf2013fb2acb83cdc6f443.tar.gz volse-hubzilla-9b3b0b5e887662c2bfdf2013fb2acb83cdc6f443.tar.bz2 volse-hubzilla-9b3b0b5e887662c2bfdf2013fb2acb83cdc6f443.zip |
basic query for number of raters. Should probably be a join or subselect but that will take a bit more fiddling
Diffstat (limited to 'mod/dirsearch.php')
-rw-r--r-- | mod/dirsearch.php | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/mod/dirsearch.php b/mod/dirsearch.php index 06d530849..52a3d02cf 100644 --- a/mod/dirsearch.php +++ b/mod/dirsearch.php @@ -125,7 +125,7 @@ function dirsearch_content(&$a) { if($hash) { - $sql_extra = " AND xchan_hash = '" . dbesc($hash) . "' "; + $sql_extra = " AND xchan_hash like '" . dbesc($hash) . protect_sprintf('%') . "' "; } @@ -229,8 +229,18 @@ function dirsearch_content(&$a) { foreach($r as $rr) { + $entry = array(); + $pc = q("select count(xlink_rating) as total_ratings from xlink where xlink_link = '%s' and xlink_rating != 0 and xlink_static = 1 group by xlink_rating", + dbesc($rr['xchan_hash']) + ); + + if($pc) + $entry['total_ratings'] = intval($pc[0]['total_ratings']); + else + $entry['total_ratings'] = 0; + $entry['name'] = $rr['xchan_name']; $entry['hash'] = $rr['xchan_hash']; |