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') 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') 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') 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 From 1150f831637c87322fcc85cb59758805d48c90e0 Mon Sep 17 00:00:00 2001 From: Matt Beckett Date: Thu, 26 Sep 2013 13:36:17 -0700 Subject: Fix redeclaring $size variable - breaks user icon if filesize == 0 or the file somehow no longer exists --- mod/profile/icondirect.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'mod/profile') diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php index dbab5d31f..85221945a 100644 --- a/mod/profile/icondirect.php +++ b/mod/profile/icondirect.php @@ -55,8 +55,8 @@ if ($mysql_dblink) { $user_path = date('Y/m/d/', $join_date) . $guid; $filename = "$data_root$user_path/profile/{$guid}{$size}.jpg"; - $size = @filesize($filename); - if ($size) { + $filesize = @filesize($filename); + if ($filesize) { header("Content-type: image/jpeg"); header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', strtotime("+6 months")), true); header("Pragma: public"); -- cgit v1.2.3 From 12dbe2faa03281cc4c1c30d0f9635620676ac49a Mon Sep 17 00:00:00 2001 From: Matt Beckett Date: Thu, 26 Sep 2013 14:13:23 -0700 Subject: change variable name for content length --- mod/profile/icondirect.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'mod/profile') diff --git a/mod/profile/icondirect.php b/mod/profile/icondirect.php index 85221945a..5f1599e0d 100644 --- a/mod/profile/icondirect.php +++ b/mod/profile/icondirect.php @@ -61,7 +61,7 @@ if ($mysql_dblink) { header('Expires: ' . gmdate('D, d M Y H:i:s \G\M\T', strtotime("+6 months")), true); header("Pragma: public"); header("Cache-Control: public"); - header("Content-Length: $size"); + header("Content-Length: $filesize"); header("ETag: \"$etag\""); readfile($filename); exit; -- cgit v1.2.3