Make validate_url more intuitive

- Remove the parameter passed by reference
- Add modified url in return value
This commit is contained in:
Hypolite Petovan 2017-12-16 19:23:22 -05:00
commit 1724dd3841
5 changed files with 21 additions and 20 deletions

View file

@ -377,7 +377,8 @@ function dfrn_request_post(App $a) {
);
}
else {
if (! validate_url($url)) {
$url = validate_url($url);
if (! $url) {
notice( t('Invalid profile URL.') . EOL);
goaway(System::baseUrl() . '/' . $a->cmd);
return; // NOTREACHED

View file

@ -537,10 +537,9 @@ function settings_post(App $a) {
// If openid has changed or if there's an openid but no openidserver, try and discover it.
if ($openid != $a->user['openid'] || (strlen($openid) && (!strlen($openidserver)))) {
$tmp_str = $openid;
if (strlen($tmp_str) && validate_url($tmp_str)) {
if (strlen($tmp_str) && validate_url($openid)) {
logger('updating openidserver');
require_once('library/openid.php');
require_once 'library/openid.php';
$open_id_obj = new LightOpenID;
$open_id_obj->identity = $openid;
$openidserver = $open_id_obj->discover($open_id_obj->identity);