aboutsummaryrefslogtreecommitdiffstats
path: root/mod/import.php
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-09-01 22:03:10 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-09-01 22:03:10 -0700
commit6cc60ba477c1634b2ba6d78495d35cbf306988e1 (patch)
tree5ffbc602bc3d6c3fe412f8b80aa69636e42cc1e3 /mod/import.php
parentc5578d79643bbdde8f49baae2fa6890fc9bf9a53 (diff)
downloadvolse-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/import.php')
-rw-r--r--mod/import.php45
1 files changed, 29 insertions, 16 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']);