diff options
author | redmatrix <redmatrix@redmatrix.me> | 2015-09-01 22:03:10 -0700 |
---|---|---|
committer | redmatrix <redmatrix@redmatrix.me> | 2015-09-01 22:03:10 -0700 |
commit | 6cc60ba477c1634b2ba6d78495d35cbf306988e1 (patch) | |
tree | 5ffbc602bc3d6c3fe412f8b80aa69636e42cc1e3 /mod | |
parent | c5578d79643bbdde8f49baae2fa6890fc9bf9a53 (diff) | |
download | volse-hubzilla-6cc60ba477c1634b2ba6d78495d35cbf306988e1.tar.gz volse-hubzilla-6cc60ba477c1634b2ba6d78495d35cbf306988e1.tar.bz2 volse-hubzilla-6cc60ba477c1634b2ba6d78495d35cbf306988e1.zip |
initial work on obj import, rename import_profile_photo to import_xchan_photo to more accurately state its purpose.
Diffstat (limited to 'mod')
-rw-r--r-- | mod/import.php | 45 | ||||
-rw-r--r-- | mod/openid.php | 2 | ||||
-rw-r--r-- | mod/thing.php | 4 |
3 files changed, 32 insertions, 19 deletions
diff --git a/mod/import.php b/mod/import.php index 0c5ec2a4c..e8e4f7a3d 100644 --- a/mod/import.php +++ b/mod/import.php @@ -422,7 +422,7 @@ function import_post(&$a) { require_once('include/photo/photo_driver.php'); - $photos = import_profile_photo($xchan['xchan_photo_l'],$xchan['xchan_hash']); + $photos = import_xchan_photo($xchan['xchan_photo_l'],$xchan['xchan_hash']); if($photos[4]) $photodate = NULL_DATE; else @@ -556,22 +556,35 @@ function import_post(&$a) { ref_session_write(session_id(), serialize($_SESSION)); } + $objs = $data['obj']; + if($objs) { + foreach($objs as $obj) { + // if it's the old term format - too hard to support + if(! $obj['obj_created']) + continue; + $baseurl = $obj['obj_baseurl']; + unset($obj['obj_id']); + unset($obj['obj_baseurl']); + + $obj['obj_channel'] = $channel['channel_id']; + + if($baseurl && (strpos($obj['obj_url'],$baseurl . '/thing/') !== false)) { + $obj['obj_url'] = str_replace($baseurl,z_root(),$obj['obj_url']); + } + + if($obj['obj_imgurl']) { + $x = import_xchan_photo($obj['obj_imgurl'],get_observer_hash(),true); + $obj['obj_imgurl'] = $x[0]; + } -// This needs more work - we also need the term where otype = 6 to link with this, and the terms need to be relocated. -// $objs = $data['obj']; -// if($objs) { -// foreach($objs as $obj) { -// unset($obj['obj_id']); -// $obj['channel'] = $channel['channel_id']; - -// dbesc_array($obj); -// $r = dbq("INSERT INTO obj (`" -// . implode("`, `", array_keys($obj)) -// . "`) VALUES ('" -// . implode("', '", array_values($obj)) -// . "')" ); -// } -// } + dbesc_array($obj); + $r = dbq("INSERT INTO obj (`" + . implode("`, `", array_keys($obj)) + . "`) VALUES ('" + . implode("', '", array_values($obj)) + . "')" ); + } + } $saved_notification_flags = notifications_off($channel['channel_id']); diff --git a/mod/openid.php b/mod/openid.php index 70da2690a..b9ca672a9 100644 --- a/mod/openid.php +++ b/mod/openid.php @@ -155,7 +155,7 @@ function openid_content(&$a) { ); if($r) { - $photos = import_profile_photo($pphoto,$url); + $photos = import_xchan_photo($pphoto,$url); if($photos) { $z = 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_hash = '%s'", diff --git a/mod/thing.php b/mod/thing.php index 78fbf396c..86712d9eb 100644 --- a/mod/thing.php +++ b/mod/thing.php @@ -88,7 +88,7 @@ function thing_init(&$a) { } $orig_record = $t[0]; if($photo != $orig_record['obj_imgurl']) { - $arr = import_profile_photo($photo,get_observer_hash(),true); + $arr = import_xchan_photo($photo,get_observer_hash(),true); $local_photo = $arr[0]; $local_photo_type = $arr[3]; } @@ -125,7 +125,7 @@ function thing_init(&$a) { $local_photo = null; if($photo) { - $arr = import_profile_photo($photo,get_observer_hash(),true); + $arr = import_xchan_photo($photo,get_observer_hash(),true); $local_photo = $arr[0]; $local_photo_type = $arr[3]; } |