|
@@ -2706,8 +2706,8 @@ function profileLoadAvatarData()
|
|
|
|
|
|
// Default context.
|
|
// Default context.
|
|
$context['member']['avatar'] += array(
|
|
$context['member']['avatar'] += array(
|
|
- 'custom' => stristr($cur_profile['avatar'], 'http://') ? $cur_profile['avatar'] : 'http://',
|
|
|
|
- 'selection' => $cur_profile['avatar'] == '' || stristr($cur_profile['avatar'], 'http://') ? '' : $cur_profile['avatar'],
|
|
|
|
|
|
+ 'custom' => stristr($cur_profile['avatar'], 'http://') || stristr($cur_profile['avatar'], 'https://') ? $cur_profile['avatar'] : 'http://',
|
|
|
|
+ 'selection' => $cur_profile['avatar'] == '' || (stristr($cur_profile['avatar'], 'http://') || stristr($cur_profile['avatar'], 'https://')) ? '' : $cur_profile['avatar'],
|
|
'id_attach' => $cur_profile['id_attach'],
|
|
'id_attach' => $cur_profile['id_attach'],
|
|
'filename' => $cur_profile['filename'],
|
|
'filename' => $cur_profile['filename'],
|
|
'allow_server_stored' => allowedTo('profile_server_avatar') || (!$context['user']['is_owner'] && allowedTo('profile_extra_any')),
|
|
'allow_server_stored' => allowedTo('profile_server_avatar') || (!$context['user']['is_owner'] && allowedTo('profile_extra_any')),
|
|
@@ -2724,7 +2724,7 @@ function profileLoadAvatarData()
|
|
);
|
|
);
|
|
$context['member']['avatar']['href'] = empty($cur_profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $cur_profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $cur_profile['filename'];
|
|
$context['member']['avatar']['href'] = empty($cur_profile['attachment_type']) ? $scripturl . '?action=dlattach;attach=' . $cur_profile['id_attach'] . ';type=avatar' : $modSettings['custom_avatar_url'] . '/' . $cur_profile['filename'];
|
|
}
|
|
}
|
|
- elseif (stristr($cur_profile['avatar'], 'http://') && $context['member']['avatar']['allow_external'])
|
|
|
|
|
|
+ elseif ((stristr($cur_profile['avatar'], 'http://') || stristr($cur_profile['avatar'], 'https://')) && $context['member']['avatar']['allow_external'])
|
|
$context['member']['avatar'] += array(
|
|
$context['member']['avatar'] += array(
|
|
'choice' => 'external',
|
|
'choice' => 'external',
|
|
'server_pic' => 'blank.png',
|
|
'server_pic' => 'blank.png',
|
|
@@ -2897,7 +2897,7 @@ function profileSaveAvatarData(&$value)
|
|
}
|
|
}
|
|
|
|
|
|
$downloadedExternalAvatar = false;
|
|
$downloadedExternalAvatar = false;
|
|
- if ($value == 'external' && allowedTo('profile_remote_avatar') && stripos($_POST['userpicpersonal'], 'http://') === 0 && strlen($_POST['userpicpersonal']) > 7 && !empty($modSettings['avatar_download_external']))
|
|
|
|
|
|
+ if ($value == 'external' && allowedTo('profile_remote_avatar') && (stripos($_POST['userpicpersonal'], 'http://') === 0 || stripos($_POST['userpicpersonal'], 'https://') === 0) && strlen($_POST['userpicpersonal']) > 7 && !empty($modSettings['avatar_download_external']))
|
|
{
|
|
{
|
|
if (!is_writable($uploadDir))
|
|
if (!is_writable($uploadDir))
|
|
fatal_lang_error('attachments_no_write', 'critical');
|
|
fatal_lang_error('attachments_no_write', 'critical');
|
|
@@ -2905,7 +2905,7 @@ function profileSaveAvatarData(&$value)
|
|
require_once($sourcedir . '/Subs-Package.php');
|
|
require_once($sourcedir . '/Subs-Package.php');
|
|
|
|
|
|
$url = parse_url($_POST['userpicpersonal']);
|
|
$url = parse_url($_POST['userpicpersonal']);
|
|
- $contents = fetch_web_data('http://' . $url['host'] . (empty($url['port']) ? '' : ':' . $url['port']) . str_replace(' ', '%20', trim($url['path'])));
|
|
|
|
|
|
+ $contents = fetch_web_data($url['scheme'] . '://' . $url['host'] . (empty($url['port']) ? '' : ':' . $url['port']) . str_replace(' ', '%20', trim($url['path'])));
|
|
|
|
|
|
$new_filename = $uploadDir . '/' . getAttachmentFilename('avatar_tmp_' . $memID, false, null, true);
|
|
$new_filename = $uploadDir . '/' . getAttachmentFilename('avatar_tmp_' . $memID, false, null, true);
|
|
if ($contents != false && $tmpAvatar = fopen($new_filename, 'wb'))
|
|
if ($contents != false && $tmpAvatar = fopen($new_filename, 'wb'))
|
|
@@ -2942,7 +2942,7 @@ function profileSaveAvatarData(&$value)
|
|
// Get rid of their old avatar. (if uploaded.)
|
|
// Get rid of their old avatar. (if uploaded.)
|
|
removeAttachments(array('id_member' => $memID));
|
|
removeAttachments(array('id_member' => $memID));
|
|
}
|
|
}
|
|
- elseif ($value == 'external' && allowedTo('profile_remote_avatar') && stripos($_POST['userpicpersonal'], 'http://') === 0 && empty($modSettings['avatar_download_external']))
|
|
|
|
|
|
+ elseif ($value == 'external' && allowedTo('profile_remote_avatar') && (stripos($_POST['userpicpersonal'], 'http://') === 0 || stripos($_POST['userpicpersonal'], 'https://') === 0) && empty($modSettings['avatar_download_external']))
|
|
{
|
|
{
|
|
// We need these clean...
|
|
// We need these clean...
|
|
$cur_profile['id_attach'] = 0;
|
|
$cur_profile['id_attach'] = 0;
|
|
@@ -2958,7 +2958,7 @@ function profileSaveAvatarData(&$value)
|
|
if ($profile_vars['avatar'] == 'http://' || $profile_vars['avatar'] == 'http:///')
|
|
if ($profile_vars['avatar'] == 'http://' || $profile_vars['avatar'] == 'http:///')
|
|
$profile_vars['avatar'] = '';
|
|
$profile_vars['avatar'] = '';
|
|
// Trying to make us do something we'll regret?
|
|
// Trying to make us do something we'll regret?
|
|
- elseif (substr($profile_vars['avatar'], 0, 7) != 'http://')
|
|
|
|
|
|
+ elseif (substr($profile_vars['avatar'], 0, 7) != 'http://' && substr($profile_vars['avatar'], 0, 8) != 'https://')
|
|
return 'bad_avatar';
|
|
return 'bad_avatar';
|
|
// Should we check dimensions?
|
|
// Should we check dimensions?
|
|
elseif (!empty($modSettings['avatar_max_height_external']) || !empty($modSettings['avatar_max_width_external']))
|
|
elseif (!empty($modSettings['avatar_max_height_external']) || !empty($modSettings['avatar_max_width_external']))
|