diff options
author | friendica <info@friendica.com> | 2014-02-25 19:48:13 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-02-25 19:48:13 -0800 |
commit | e7e97e578b3069b8d24ea2a18ce4d3648b402ca3 (patch) | |
tree | a2fce103f82322b6680b6ac7207ca080c53f29cb /include | |
parent | 2c72e49d1f63404b464f284d86ce2dce7f2eb493 (diff) | |
download | volse-hubzilla-e7e97e578b3069b8d24ea2a18ce4d3648b402ca3.tar.gz volse-hubzilla-e7e97e578b3069b8d24ea2a18ce4d3648b402ca3.tar.bz2 volse-hubzilla-e7e97e578b3069b8d24ea2a18ce4d3648b402ca3.zip |
put bookmarked chatrooms into poco
Diffstat (limited to 'include')
-rw-r--r-- | include/socgraph.php | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/include/socgraph.php b/include/socgraph.php index 0e91eba60..2bd0290cc 100644 --- a/include/socgraph.php +++ b/include/socgraph.php @@ -64,6 +64,34 @@ function poco_load($xchan = '',$url = null) { logger('poco_load: ' . print_r($j,true),LOGGER_DATA); + if($xchan) { + if(array_key_exists('chatrooms',$j) && is_array($j['chatrooms'])) { + foreach($j['chatrooms'] as $room) { + $r = q("select * from xchat where xchat_url = '%s' and xchat_xchan = '%s' limit 1", + dbesc($room['url']) + ); + if($r) { + q("update xchat set xchat_edited = '%s' where xchat_id = %d limit 1", + dbesc(datetime_convert()), + intval($r[0]['xchat_id']) + ); + } + else { + $x = q("insert into xchat ( xchat_url, xchat_desc, xchat_xchan, xchat_edited ) + values ( '%s', '%s', '%s', '%s' ) ", + dbesc(escape_tags($room['url'])), + dbesc(escape_tags($room['desc'])), + dbesc($xchan), + dbesc(datetime_convert()) + ); + } + } + } + q("delete from xchat where xchat_edited < UTC_TIMESTAMP() - INTERVAL 7 DAY and xchat_xchan = '%s' ", + dbesc($xchan) + ); + } + if(! ((x($j,'entry')) && (is_array($j['entry'])))) { logger('poco_load: no entries'); return; |