Skip to content

Commit

Permalink
v2
Browse files Browse the repository at this point in the history
  • Loading branch information
bo4b committed May 3, 2012
1 parent 910a59a commit a9a2169
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions shrtr.module
Expand Up @@ -130,6 +130,12 @@ function shrtr_new_form_submit($form, &$form_state) {
else {
$expire = 0;
}

$regex = '/(^http:\/\/|^ftp:\/\/|^news:|^https:\/\/|mailto:)([\x21-\x7E-]+\.)/';
$url = $form_state['values']['url'];
if(!preg_match($regex, $url, $matches)) {
$url = "http://" . $url;
}

$record = array(
'url' => $form_state['values']['url'],
Expand Down

0 comments on commit a9a2169

Please sign in to comment.