Skip to content

Commit

Permalink
Merge branch 'MDL-48372-master' of git://github.com/ankitagarwal/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
danpoltawski committed Jan 6, 2015
2 parents b7f92c3 + c21c92f commit fba50fc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 2 additions & 1 deletion mod/data/field/url/field.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ function update_content($recordid, $value, $name='') {
break;
}

if (!empty($content->content) && (strpos($content->content, '://') === false) && (strpos($content->content, '/', 0) === false)) {
if (!empty($content->content) && (strpos($content->content, '://') === false)
&& (strpos($content->content, '/') !== 0)) {
$content->content = 'http://' . $content->content;
}

Expand Down
4 changes: 4 additions & 0 deletions mod/data/import.php
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@
} else if ($field->type == 'url') {
$values = explode(" ", $value, 2);
$content->content = $values[0];
if (!empty($content->content) && (strpos($content->content, '://') === false)
&& (strpos($content->content, '/') !== 0)) {
$content->content = 'http://' . $content->content;
}
// The url field doesn't always have two values (unforced autolinking).
if (count($values) > 1) {
$content->content1 = $values[1];
Expand Down

0 comments on commit fba50fc

Please sign in to comment.