diff options
author | Thomas Willingham <founder@kakste.com> | 2013-08-24 17:05:18 +0100 |
---|---|---|
committer | Thomas Willingham <founder@kakste.com> | 2013-08-24 17:05:18 +0100 |
commit | c803fb90df3bbbd8bb88df09a271b5a9214e8c1d (patch) | |
tree | 0ad021580411798fc0ab025f1b1c302fe8afd3f6 /mod/import.php | |
parent | 6999fb586ba90e9f1c79e9f09f4035f63fb925fd (diff) | |
parent | b0dd38b30949f907265eda757bfa14aa1f38b38f (diff) | |
download | volse-hubzilla-c803fb90df3bbbd8bb88df09a271b5a9214e8c1d.tar.gz volse-hubzilla-c803fb90df3bbbd8bb88df09a271b5a9214e8c1d.tar.bz2 volse-hubzilla-c803fb90df3bbbd8bb88df09a271b5a9214e8c1d.zip |
Merge remote-tracking branch 'upstream/master'
Diffstat (limited to 'mod/import.php')
-rw-r--r-- | mod/import.php | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/mod/import.php b/mod/import.php index 4c878f5c6..08311013a 100644 --- a/mod/import.php +++ b/mod/import.php @@ -16,10 +16,10 @@ function import_post(&$a) { $data = null; $seize = ((x($_REQUEST,'make_primary')) ? intval($_REQUEST['make_primary']) : 0); - $src = $_FILES['userfile']['tmp_name']; - $filename = basename($_FILES['userfile']['name']); - $filesize = intval($_FILES['userfile']['size']); - $filetype = $_FILES['userfile']['type']; + $src = $_FILES['filename']['tmp_name']; + $filename = basename($_FILES['filename']['name']); + $filesize = intval($_FILES['filename']['size']); + $filetype = $_FILES['filename']['type']; if($src) { @@ -206,10 +206,35 @@ function import_post(&$a) { // import xchans and contact photos + if($seize) { + + // replace our existing xchan if we're seizing control + + $r = q("delete from xchan where xchan_hash = '%s' limit 1", + dbesc($channel['channel_hash']) + ); + + $r = q("insert into xchan ( xchan_hash, xchan_guid, xchan_guid_sig, xchan_pubkey, xchan_photo_l, xchan_photo_m, xchan_photo_s, xchan_addr, xchan_url, xchan_name, xchan_network, xchan_photo_date, xchan_name_date ) values ('%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s')", + dbesc($channel['channel_hash']), + dbesc($channel['channel_guid']), + dbesc($channel['channel_guid_sig']), + dbesc($channel['channel_pubkey']), + dbesc($a->get_baseurl() . "/photo/profile/l/" . $channel['channel_id']), + dbesc($a->get_baseurl() . "/photo/profile/m/" . $channel['channel_id']), + dbesc($a->get_baseurl() . "/photo/profile/s/" . $channel['channel_id']), + dbesc($channel['channel_address'] . '@' . get_app()->get_hostname()), + dbesc(z_root() . '/channel/' . $channel['channel_address']), + dbesc($channel['channel_name']), + dbesc('zot'), + dbesc(datetime_convert()), + dbesc(datetime_convert()) + ); + } $xchans = $data['xchan']; if($xchans) { foreach($xchans as $xchan) { + $r = q("select xchan_hash from xchan where xchan_hash = '%s' limit 1", dbesc($xchan['xchan_hash']) ); |