From e9f710c18089489c402cae23fbac71c0b7283824 Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Sun, 10 Mar 2013 13:22:43 -0400 Subject: validate url on profile display --- mod/profile/views/default/profile/details.php | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'mod/profile/views') diff --git a/mod/profile/views/default/profile/details.php b/mod/profile/views/default/profile/details.php index 7b05b0e15..167f995ae 100644 --- a/mod/profile/views/default/profile/details.php +++ b/mod/profile/views/default/profile/details.php @@ -21,6 +21,12 @@ if (is_array($profile_fields) && sizeof($profile_fields) > 0) { continue; } $value = $user->$shortname; + + // validate urls + if ($valtype == 'url' && !preg_match('~^https?\://~i', $value)) { + $value = "http://$value"; + } + if (!empty($value)) { //This function controls the alternating class $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; -- cgit v1.2.3 From 4da579033674ecdb134bc921f3f0666072419e6c Mon Sep 17 00:00:00 2001 From: Cash Costello Date: Wed, 20 Mar 2013 21:00:41 -0400 Subject: Fixes #5232 handling empty profile url field --- actions/profile/edit.php | 2 +- mod/profile/views/default/profile/details.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'mod/profile/views') diff --git a/actions/profile/edit.php b/actions/profile/edit.php index 63fb31600..b817463ac 100644 --- a/actions/profile/edit.php +++ b/actions/profile/edit.php @@ -48,7 +48,7 @@ foreach ($profile_fields as $shortname => $valuetype) { forward(REFERER); } - if ($valuetype == 'url' && !preg_match('~^https?\://~i', $value)) { + if ($value && $valuetype == 'url' && !preg_match('~^https?\://~i', $value)) { $value = "http://$value"; } diff --git a/mod/profile/views/default/profile/details.php b/mod/profile/views/default/profile/details.php index 167f995ae..15df6c2fd 100644 --- a/mod/profile/views/default/profile/details.php +++ b/mod/profile/views/default/profile/details.php @@ -22,13 +22,13 @@ if (is_array($profile_fields) && sizeof($profile_fields) > 0) { } $value = $user->$shortname; - // validate urls - if ($valtype == 'url' && !preg_match('~^https?\://~i', $value)) { - $value = "http://$value"; - } - if (!empty($value)) { - //This function controls the alternating class + // validate urls + if ($valtype == 'url' && !preg_match('~^https?\://~i', $value)) { + $value = "http://$value"; + } + + // this controls the alternating class $even_odd = ( 'odd' != $even_odd ) ? 'odd' : 'even'; ?>
-- cgit v1.2.3 From 33015121e7ec691372a56be0c5ef03d24d9c3aac Mon Sep 17 00:00:00 2001 From: Steve Clay Date: Thu, 21 Mar 2013 10:48:20 -0400 Subject: Auto-fixes profile URLs broken by #5232 --- mod/profile/views/default/profile/details.php | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'mod/profile/views') diff --git a/mod/profile/views/default/profile/details.php b/mod/profile/views/default/profile/details.php index 15df6c2fd..da4e95690 100644 --- a/mod/profile/views/default/profile/details.php +++ b/mod/profile/views/default/profile/details.php @@ -23,6 +23,14 @@ if (is_array($profile_fields) && sizeof($profile_fields) > 0) { $value = $user->$shortname; if (!empty($value)) { + + // fix profile URLs populated by https://github.com/Elgg/Elgg/issues/5232 + // @todo Replace with upgrade script, only need to alter users with last_update after 1.8.13 + if ($valtype == 'url' && $value == 'http://') { + $user->$shortname = ''; + continue; + } + // validate urls if ($valtype == 'url' && !preg_match('~^https?\://~i', $value)) { $value = "http://$value"; -- cgit v1.2.3