diff options
author | friendica <info@friendica.com> | 2013-02-15 22:34:01 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2013-02-15 22:34:01 -0800 |
commit | e754845c80e3bf038d808c6502cf3dec5880e1f6 (patch) | |
tree | 818e54f307e1de5ded24613da18099ff7d40406d /include | |
parent | ace1104d08715ffb4d7ada722adeb53206236a50 (diff) | |
download | volse-hubzilla-e754845c80e3bf038d808c6502cf3dec5880e1f6.tar.gz volse-hubzilla-e754845c80e3bf038d808c6502cf3dec5880e1f6.tar.bz2 volse-hubzilla-e754845c80e3bf038d808c6502cf3dec5880e1f6.zip |
add rating support to poco
Diffstat (limited to 'include')
-rw-r--r-- | include/socgraph.php | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/include/socgraph.php b/include/socgraph.php index f6be92657..0d9ae3e6c 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -37,13 +37,12 @@ function poco_load($xchan = null,$url = null) { } - $url = $url . '?f=&fields=displayName,hash,urls,photos' ; + $url = $url . '?f=&fields=displayName,hash,urls,photos,rating' ; logger('poco_load: ' . $url, LOGGER_DEBUG); $s = z_fetch_url($url); - if(! $s['success']) { logger('poco_load: returns ' . print_r($s,true)); return; @@ -67,9 +66,11 @@ function poco_load($xchan = null,$url = null) { $address = ''; $name = ''; $hash = ''; + $rating = 0; - $name = $entry['displayName']; - $hash = $entry['hash']; + $name = $entry['displayName']; + $hash = $entry['hash']; + $rating = ((array_key_exists('rating',$entry)) ? intval($entry['rating']) : 0); if(x($entry,'urls') && is_array($entry['urls'])) { foreach($entry['urls'] as $url) { @@ -121,15 +122,17 @@ function poco_load($xchan = null,$url = null) { dbesc($hash) ); if(! $r) { - q("insert into xlink ( xlink_xchan, xlink_link, xlink_updated ) values ( '%s', '%s', '%s' ) ", + q("insert into xlink ( xlink_xchan, xlink_link, xlink_rating, xlink_updated ) values ( '%s', '%s', %d, '%s' ) ", dbesc($xchan), dbesc($hash), + intval($rating), dbesc(datetime_convert()) ); } else { - q("update xlink set xlink_updated = '%s' where xlink_id = %d limit 1", + q("update xlink set xlink_updated = '%s', rating = %d where xlink_id = %d limit 1", dbesc(datetime_convert()), + intval($rating), intval($r[0]['xlink_id']) ); } |