When some one add http:// in their "Home Page" textbox,
then submit it, there will be double http:// in their Home Page

I'm new on drupal, so I just modify it into:
eregi_replace('^http://','',check_url($entry['anonwebsite']))
(line 622) in guestbook.module
~may be there is another simple solution / function
~it's just my quick and dirty trick, but it seems work on me :D

Comments

Santa Claus’s picture

You need to change guestbook.module from the original code:

if (in_array('website', $display) && !empty($entry['anonwebsite'])) {
    $output .= '&nbsp;|&nbsp;<a href="http://'. check_url($entry['anonwebsite']) .'">' . t('Website') . '</a>&nbsp;';
  }

to the new code:

  if (in_array('website', $display) && !empty($entry['anonwebsite'])) {
//check availability 'http://' in introduced url
if (eregi('http://', check_url($entry['anonwebsite']))) {
//url is okay
$output .= '&nbsp;|&nbsp;<a href="'. check_url($entry['anonwebsite']) .'">' . t('Website') . '</a>&nbsp;';
}
else {
//add 'http://' to url
$output .= '&nbsp;|&nbsp;<a href="http://'. check_url($entry['anonwebsite']) .'">' . t('Website') . '</a>&nbsp;';
 }
  }

If you sure that your users don't enter web-links without 'http://', you can use only this simple code:

if (in_array('website', $display) && !empty($entry['anonwebsite'])) {
    $output .= '&nbsp;|&nbsp;<a href="http://'. check_url($entry['anonwebsite']) .'">' . t('Website') . '</a>&nbsp;';
  }
sun’s picture

Title: Duplicate string "http://" in check_url($entry['anonwebsite']) » Duplicate "http://" prefix in website
Status: Active » Needs work
sun’s picture

Status: Needs work » Fixed

Good shot. Committed a proper fix for this bug.

Anonymous’s picture

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for two weeks with no activity.