Recent Topics

BUG 6.9.2 _skin.func.php line 2288

Started by on Jun 21, 2017 – Contents updated: Jul 17, 2017

Jun 21, 2017 12:41    

Only happens in disp=single/post

regular expression /https?:\/\/(www\.)?twitter\.com\/(#!\/)?@?([^\/\?]*)/ breaks by including " target="_blank" rel="nofollow">

		// Get author's Twitter username
		if( $creator_User = & $Item->get_creator_User() )
		{
			if( $twitter_links = $creator_User->userfield_values_by_code( 'twitter' ) )
			{
				preg_match( '/https?:\/\/(www\.)?twitter\.com\/(#!\/)?@?([^\/\?]*)/', $twitter_links[0], $matches );
				if( isset( $matches[3] ) )
				{
					echo '<meta property="twitter:creator" content="@'.$matches[3].'" />'."\n";
				}
			}
		}

Replace with: /https?:\/\/(www\.)?twitter\.com((?:\/\#!)?\/(\w+))/

		// Get author's Twitter username
		if( $creator_User = & $Item->get_creator_User() )
		{
			if( $twitter_links = $creator_User->userfield_values_by_code( 'twitter' ) )
			{
				preg_match( '/https?:\/\/(www\.)?twitter\.com((?:\/\#!)?\/(\w+))/', $twitter_links[0], $matches );
				if( isset( $matches[3] ) )
				{
					echo '<meta property="twitter:creator" content="@'.$matches[3].'" />'."\n";
				}
			}
		}

Jul 14, 2017 03:07

@achillis

breaks by including " target="_blank" rel="nofollow">

Can you please specify *where* you are including " target="_blank" rel="nofollow">?

Jul 14, 2017 08:35

I realize my explination is unclear.

The regular expression used does not seem to extract the username correctly. It returns other parts of the string that it shouldn't

Jul 16, 2017 17:43

@achillis Ok, thanks for clarifying. Nonetheless I feel we need to check this for security reasons: where is the part " target="_blank" rel="nofollow"> coming from in the first place?

Thanks.


Form is loading...

blogging tool – This forum is powered by b2evolution CMS, a complete engine for your website.