Uploaded image for project: 'phpBB'
  1. phpBB
  2. PHPBB-10268

extend function make_clickable() to also recognize semicolons as leading URL borders

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Fixed
    • Icon: Minor Minor
    • 3.2.0-a1
    • 3.0.9
    • Posting, Viewing posts
    • None

      When using [quote=""] you can also use an URL as quote author. However, the URL only turns into a clickable link when having a proper starting border. Right now you need to i.e. use a whitespace to accomplish that: [quote=" http://www.phpbb.com"].

      Converting URLs into clickable links kicks in while parsing the QUOTE tags, which during that time carry HTML entities, so at that point you have something like this:

      [quote="http://www.phpbb.com":2htjkmj6]phpBB[/quote:2htjkmj6]

      ...and the URL is not detected, because the semicolon is not considered as a boundary. Using one of the expected characters (linebreak, tab, whitespace, opening round bracket, closing angle bracket, dot) in front of the URL is expected, so a leading whitespace will make it work.

      For that reason I suggest to also take the semicolon into account when turning URLs automatically into clickable links. For that only these lines need a semicolon in both their REs:

      		// relative urls for this board
      		$magic_url_match[] = '#(^|[\n\t (>.])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#ie';
      		$magic_url_replace[] = "make_clickable_callback(MAGIC_URL_LOCAL, '\$1', '\$2', '\$3', '$local_class')";
       
      		// matches a xxxx://aaaaa.bbb.cccc. ...
      		$magic_url_match[] = '#(^|[\n\t (>.])(' . get_preg_expression('url_inline') . ')#ie';
      		$magic_url_replace[] = "make_clickable_callback(MAGIC_URL_FULL, '\$1', '\$2', '', '$class')";

      ...should be:

      		// relative urls for this board
      		$magic_url_match[] = '#(^|[\n\t (>.;])(' . preg_quote($server_url, '#') . ')/(' . get_preg_expression('relative_url_inline') . ')#ie';
      		$magic_url_replace[] = "make_clickable_callback(MAGIC_URL_LOCAL, '\$1', '\$2', '\$3', '$local_class')";
       
      		// matches a xxxx://aaaaa.bbb.cccc. ...
      		$magic_url_match[] = '#(^|[\n\t (>.;])(' . get_preg_expression('url_inline') . ')#ie';
      		$magic_url_replace[] = "make_clickable_callback(MAGIC_URL_FULL, '\$1', '\$2', '', '$class')";


      Requested and solved here: http://www.phpbb.com/community/viewtopic.php?f=72&t=2134405

            bantu Andreas Fischer [X] (Inactive)
            AmigoJack AmigoJack
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: