]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #5232 handling empty profile url field
authorCash Costello <cash.costello@gmail.com>
Thu, 21 Mar 2013 01:00:41 +0000 (21:00 -0400)
committerCash Costello <cash.costello@gmail.com>
Thu, 21 Mar 2013 01:00:41 +0000 (21:00 -0400)
actions/profile/edit.php
mod/profile/views/default/profile/details.php

index 63fb3160080ed1e6b95fddb76b34d99d1bd10208..b817463ac408fb2a68ece72d4c5bf207f1149d94 100644 (file)
@@ -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";
        }
 
index 167f995ae5c109a9c7d3c0bc041312c2f7da41a4..15df6c2fd2aa10892660930fe1867177a4022e1a 100644 (file)
@@ -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';
                        ?>
                        <div class="<?php echo $even_odd; ?>">