aboutsummaryrefslogtreecommitdiffstats
path: root/include/socgraph.php
diff options
context:
space:
mode:
authorTony Baldwin <tonybaldwin@gmx.com>2014-03-09 19:22:54 -0400
committerTony Baldwin <tonybaldwin@gmx.com>2014-03-09 19:22:54 -0400
commit5cca00ddc79dad667464674e08a2a860e262eabd (patch)
tree53df980e32a6706e977a5a2276e0f9aa9ec09300 /include/socgraph.php
parent67166180bb560276273a20bcd9ca2a7aae036aba (diff)
parenta79072ce478a999b06df38ae324fbcef6d3a76e7 (diff)
downloadvolse-hubzilla-5cca00ddc79dad667464674e08a2a860e262eabd.tar.gz
volse-hubzilla-5cca00ddc79dad667464674e08a2a860e262eabd.tar.bz2
volse-hubzilla-5cca00ddc79dad667464674e08a2a860e262eabd.zip
Merge remote-tracking branch 'upstream/master'
Conflicts: view/theme/redbasic/tpl/theme_settings.tpl reset to upstream
Diffstat (limited to 'include/socgraph.php')
-rw-r--r--include/socgraph.php29
1 files changed, 29 insertions, 0 deletions
diff --git a/include/socgraph.php b/include/socgraph.php
index 0e91eba60..10d52da66 100644
--- a/include/socgraph.php
+++ b/include/socgraph.php
@@ -64,6 +64,35 @@ 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']),
+ dbesc($xchan)
+ );
+ 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;