diff --git a/.vscode/php.ini b/.vscode/php.ini index a7915a406..14db01ec9 100644 --- a/.vscode/php.ini +++ b/.vscode/php.ini @@ -7,7 +7,7 @@ xdebug.collect_params = 0 xdebug.mode = debug xdebug.start_with_request = yes xdebug.client_host = ${LANDO_HOST_IP} -; xdebug.log = /tmp/xdebug.log +xdebug.log_level = 0 ; Remote settings xdebug.remote_enable = 1 diff --git a/Code/Access/Permissions.php b/Code/Access/Permissions.php index 4c8bcc4d4..8aefb0f1c 100644 --- a/Code/Access/Permissions.php +++ b/Code/Access/Permissions.php @@ -60,14 +60,14 @@ class Permissions $perms = [ 'view_stream' => t('Grant viewing access to your channel stream and posts'), - 'deliver_stream' => t('Permit delivery of your channel stream and posts'), - 'view_profile' => t('Grant viewing access to your default channel profile'), + 'deliver_stream' => t('Will send them your posts and conversations'), + 'view_profile' => t('Grant viewing access to your profile'), 'view_contacts' => t('Grant viewing access to your address book (connections)'), 'view_storage' => t('Grant viewing access to your file storage and photos'), 'post_wall' => t('Grant permission to post on your channel (wall) page'), 'post_mail' => t('Accept delivery of direct messages and personal mail'), - 'send_stream' => t('Accept delivery of their posts and all comments to their posts'), - 'post_comments' => t('Accept delivery of their comments and likes on your posts'), + 'send_stream' => t('Accept delivery of their posts and conversations'), + 'post_comments' => t('Accept delivery of their comments on your posts'), 'write_storage' => t('Grant upload permissions to your file storage and photos'), 'republish' => t('Grant permission to republish/mirror your posts'), 'moderated' => t('Accept comments and wall posts only after approval (moderation)'), diff --git a/Code/Daemon/Notifier.php b/Code/Daemon/Notifier.php index a733d14e7..287da41e2 100644 --- a/Code/Daemon/Notifier.php +++ b/Code/Daemon/Notifier.php @@ -114,9 +114,6 @@ class Notifier $sys = Channel::get_system(); - $top_level = false; - - $url_recipients = []; $normal_mode = true; if ($cmd === 'request') { @@ -265,11 +262,8 @@ class Notifier return; } - $deleted_item = false; - if (intval($target_item['item_deleted'])) { - logger('notifier: target item ITEM_DELETED', LOGGER_DEBUG); - $deleted_item = true; + logger('target item ITEM_DELETED', LOGGER_DEBUG); } if (! in_array(intval($target_item['item_type']), [ ITEM_TYPE_POST, ITEM_TYPE_MAIL ])) { @@ -629,7 +623,7 @@ class Notifier $dead = []; // known dead hubs - report them as undeliverable foreach ($hubs as $hub) { - if (isset($hub['site_dead']) && intval($hub['site_dead'])) { + if (!empty($hub['site_dead'])) { $dead[] = $hub; continue; } diff --git a/Code/Module/Import.php b/Code/Module/Import.php index b35745ded..3e70a2f8e 100644 --- a/Code/Module/Import.php +++ b/Code/Module/Import.php @@ -46,8 +46,7 @@ class Import extends Controller $max_feeds = ServiceClass::account_fetch($account_id, 'total_feeds'); $data = null; $seize = ((x($_REQUEST, 'make_primary')) ? intval($_REQUEST['make_primary']) : 0); - $import_posts = ((x($_REQUEST, 'import_posts')) ? intval($_REQUEST['import_posts']) : 0); - $moving = false; // intval($_REQUEST['moving']); + $import_posts = 0; $src = $_FILES['filename']['tmp_name']; $filename = basename($_FILES['filename']['name']); $filesize = intval($_FILES['filename']['size']); @@ -69,6 +68,9 @@ class Import extends Controller } unlink($src); } + else { + $import_posts = true; + } // import channel from another server if (!$src) { @@ -78,27 +80,28 @@ class Import extends Controller notice(t('Nothing to import.') . EOL); return; } elseif (strpos($old_address, '@')) { - // if you copy the identity address from your profile page, make it work for convenience - WARNING: this is a utf-8 variant and NOT an ASCII ampersand. Please do not edit. + // if you copy the identity address from your profile page, make it work for convenience + // - WARNING: this is a utf-8 variant and NOT an ASCII ampersand. Please do not edit. $old_address = str_replace('@', '@', $old_address); } + $split = explode('@', $old_address); + if (count($split) !== 2) { + notice(t('An invalid channel address was entered. This resembles an email address (xyz@example.com).')); + return; + } + $channelname = $split[0]; + $servername = $split[1]; - $email = ((x($_REQUEST, 'email')) ? $_REQUEST['email'] : ''); - $password = ((x($_REQUEST, 'password')) ? $_REQUEST['password'] : ''); - - $channelname = substr($old_address, 0, strpos($old_address, '@')); - $servername = substr($old_address, strpos($old_address, '@') + 1); + $password = ((x($_REQUEST, 'old_password')) ? $_REQUEST['old_password'] : ''); $api_path = probe_api_path($servername); if (!$api_path) { - notice(t('Unable to download data from old server') . EOL); + notice(t('Unable to connect to old server') . EOL); return; } - $api_path .= 'channel/export/basic?f=&zap_compat=1&channel=' . $channelname; - if ($import_posts) { - $api_path .= '&posts=1'; - } - $opts = ['http_auth' => $email . ':' . $password]; + $api_path .= 'channel/export/basic?f=&zap_compat=1'; + $opts = ['http_auth' => $channelname . ':' . $password]; $ret = Url::get($api_path, $opts); if ($ret['success']) { $data = $ret['body']; @@ -125,7 +128,6 @@ class Import extends Controller if (array_path_exists('user/parent-uid', $data)) { $settings = ['account_id' => $account_id, 'seize' => 1, 'newname' => $newname]; $f = new Friendica($data, $settings); - return; } @@ -144,10 +146,6 @@ class Import extends Controller } $schema = (array_path_exists('compatibility/schema', $data) && $data['compatibility']['schema']) ? $data['compatibility']['schema'] : 'unknown'; - if ($moving) { - $seize = 1; - } - // import channel $relocate = ((array_key_exists('relocate', $data)) ? $data['relocate'] : null); @@ -718,19 +716,15 @@ class Import extends Controller return replace_macros(Theme::get_template('channel_import.tpl'), [ '$title' => t('Import Channel'), - '$desc' => t('Use this form to import an existing channel from a different server. You may retrieve the channel identity from the old server via the network or provide an export file.'), - '$label_filename' => t('File to Upload'), - '$choice' => t('Or provide the old server details'), - '$old_address' => ['old_address', t('Your old identity address (xyz@example.com)'), '', ''], - '$email' => ['email', t('Your old login email address'), '', ''], - '$password' => ['password', t('Your old login password'), '', ''], - '$import_posts' => ['import_posts', t('Import a few months of posts if possible (limited by available memory)'), false, '', [t('No'), t('Yes')]], + '$desc' => t('Use this form to make a copy (clone) of an existing channel from a different site/instance to this site. You may choose to retrieve the channel data from the old site via the network or provide an export file you downloaded previously.'), + '$label_filename' => t('File to upload'), + '$choice' => t('Or provide the connection details to an existing site/instance. This information is used immediately to download your existing content and is not saved or stored.'), + '$old_address' => ['old_address', t('Your old channel address (xyz@example.com)'), '', ''], + '$old_password' => ['old_password', t('Your old login password'), '', ''], + '$common' => t('Your primary location determines which URL or address should be displayed publicly. This should be the location you intend to use most often.'), - '$common' => t('For either option, please choose whether to make this hub your new primary address, or whether your old location should continue this role. You will be able to post from either location, but only one can be marked as the primary location for files, photos, and media.'), - - '$make_primary' => ['make_primary', t('Make this hub my primary location'), false, '', [t('No'), t('Yes')]], - '$moving' => ['moving', t('Move this channel (disable all previous locations)'), false, '', [t('No'), t('Yes')]], - '$newname' => ['newname', t('Use this channel nickname instead of the one provided'), '', t('Leave blank to keep your existing channel nickname. You will be randomly assigned a similar nickname if either name is already allocated on this site.')], + '$make_primary' => ['make_primary', t('Make this instance my primary location'), false, '', [t('No'), t('Yes')]], + '$newname' => ['newname', t('Use this channel nickname (optional)'), '', t('Leave blank to keep your existing channel nickname. You will be randomly assigned a similar nickname if either name is already allocated on this site.')], '$pleasewait' => t('This process may take several minutes to complete and considerably longer if importing a large amount of posts and files. Please submit the form only once and leave this page open until finished.'), diff --git a/view/tpl/channel_import.tpl b/view/tpl/channel_import.tpl index dfc0eff10..77c4117e8 100755 --- a/view/tpl/channel_import.tpl +++ b/view/tpl/channel_import.tpl @@ -16,9 +16,7 @@
{{$choice}}
{{include file="field_input.tpl" field=$old_address}} - {{include file="field_input.tpl" field=$email}} - {{include file="field_password.tpl" field=$password}} - {{include file="field_checkbox.tpl" field=$import_posts}} + {{include file="field_password.tpl" field=$old_password}}
{{$common}}