forked from GNUsocial/gnu-social
Validate::uri replaced with filter_var for HTTP[S] URL checks
Also, a bug in checking the OAuth callback URL for validity was fixed, where it referenced the wrong variable when going through form data.
This commit is contained in:
@@ -74,7 +74,7 @@ class BookmarkforurlAction extends Action
|
||||
throw new ClientException(_('URL is required.'), 400);
|
||||
}
|
||||
|
||||
if (!Validate::uri($this->url, array('allowed_schemes' => array('http', 'https')))) {
|
||||
if (!common_valid_http_url($this->url)) {
|
||||
throw new ClientException(_('Invalid URL.'), 400);
|
||||
}
|
||||
|
||||
|
@@ -267,10 +267,7 @@ class ProfileDetailSettingsAction extends ProfileSettingsAction
|
||||
$this->removeAll($user, 'website');
|
||||
$i = 0;
|
||||
foreach($sites as $site) {
|
||||
if (!empty($site['value']) && !Validate::uri(
|
||||
$site['value'],
|
||||
array('allowed_schemes' => array('http', 'https')))
|
||||
) {
|
||||
if (!empty($site['value']) && !common_valid_http_url($site['value'])) {
|
||||
// TRANS: Exception thrown when entering an invalid URL.
|
||||
// TRANS: %s is the invalid URL.
|
||||
throw new Exception(sprintf(_m('Invalid URL: %s.'), $site['value']));
|
||||
|
@@ -1323,7 +1323,7 @@ class Ostatus_profile extends Managed_DataObject
|
||||
}
|
||||
if ($url) {
|
||||
$opts = array('allowed_schemes' => array('http', 'https'));
|
||||
if (Validate::uri($url, $opts)) {
|
||||
if (common_valid_http_url($url)) {
|
||||
return $url;
|
||||
}
|
||||
}
|
||||
@@ -1615,7 +1615,7 @@ class Ostatus_profile extends Managed_DataObject
|
||||
$profile->profileurl = $object->link;
|
||||
} else if (array_key_exists('profileurl', $hints)) {
|
||||
$profile->profileurl = $hints['profileurl'];
|
||||
} else if (Validate::uri($object->id, array('allowed_schemes' => array('http', 'https')))) {
|
||||
} else if (common_valid_http_url($object->id)) {
|
||||
$profile->profileurl = $object->id;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user