diff options
author | zottel <github@zottel.net> | 2014-02-19 08:30:14 +0100 |
---|---|---|
committer | zottel <github@zottel.net> | 2014-02-19 08:30:14 +0100 |
commit | 79d3dae7fa80df6ea6914807bcde4d8b8c390361 (patch) | |
tree | 96327bd990038c66f0e644c505522cb424a1bbd0 /include/items.php | |
parent | 2bca2199112625593eb412584e17e874e71ca913 (diff) | |
parent | 24d119b8c4e94ed130577e4e4a8d17ea13c406ac (diff) | |
download | volse-hubzilla-79d3dae7fa80df6ea6914807bcde4d8b8c390361.tar.gz volse-hubzilla-79d3dae7fa80df6ea6914807bcde4d8b8c390361.tar.bz2 volse-hubzilla-79d3dae7fa80df6ea6914807bcde4d8b8c390361.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'include/items.php')
-rwxr-xr-x | include/items.php | 50 |
1 files changed, 48 insertions, 2 deletions
diff --git a/include/items.php b/include/items.php index c90bfb41c..7e15e9411 100755 --- a/include/items.php +++ b/include/items.php @@ -725,14 +725,60 @@ function import_author_xchan($x) { return $arr['xchan_hash']; if((! array_key_exists('network', $x)) || ($x['network'] === 'zot')) { - return import_author_zot($x); + $y = import_author_zot($x); } - // TODO: create xchans for other common and/or aligned networks + if($x['network'] === 'rss') { + $y = import_author_rss($x); + } + + return(($y) ? $y : false); +} + +function import_author_rss($x) { + + if(! $x['url']) + return false; + + $r = q("select xchan_hash from xchan where xchan_network = 'rss' and xchan_url = '%s' limit 1", + dbesc($x['url']) + ); + if($r) { + logger('import_author_rss: in cache' , LOGGER_DEBUG); + return $r[0]['xchan_hash']; + } + $name = trim($x['name']); + + $r = q("insert into xchan ( xchan_hash, xchan_url, xchan_name, xchan_network ) + values ( '%s', '%s', '%s', '%s' )", + dbesc($x['url']), + dbesc($x['url']), + dbesc(($name) ? $name : t('Unknown')), + dbesc('rss') + ); + if($r) { + + $photos = import_profile_photo($x['photo'],$x['url']); + + if($photos) { + $r = q("update xchan set xchan_photo_date = '%s', xchan_photo_l = '%s', xchan_photo_m = '%s', xchan_photo_s = '%s', xchan_photo_mimetype = '%s' where xchan_url = '%s' and xchan_network = 'rss' limit 1", + dbesc(datetime_convert('UTC','UTC',$arr['photo_updated'])), + dbesc($photos[0]), + dbesc($photos[1]), + dbesc($photos[2]), + dbesc($photos[3]), + dbesc($x['url']) + ); + if($r) + return $x['url']; + } + } return false; + } + function encode_item($item) { $x = array(); $x['type'] = 'activity'; |