SMFHacks.com

Modifications/Themes => Modifications Talk => Topic started by: eat_me on September 27, 2006, 10:07:15 am

Title: Registered links
Post by: eat_me on September 27, 2006, 10:07:15 am

I've modified Subs.php like in 'Registered links' mod and now if user is a guest he can't see not only links but also images (if images are posted as links like http://somewhere.com/image.gif).
But now I have a problem: if an image's url is from my forum's server, guests can't see this image.  :'(

Can somebody help me? What should I add in code below to solve this problem?
Code: [Select]
array(
'tag' => 'img',
'type' => 'unparsed_content',
'content' => $user_info['is_guest'] ?
'[<a href="' . $scripturl . '?action=join">' . $txt[97] . '</a>]' : '<img src="$1" border="0" />',
'validate' => create_function('&$tag, &$data, $disabled', '$data = strtr($data, array(\'<br />\' => \'\'));'),
),
array(
'tag' => 'img',
'type' => 'unparsed_content',
'before' => $user_info['is_guest'] ?
'[<a href="' . $scripturl . '?action=join">' . $txt[97] . '</a>]<div style="display:none">' : '<img src="$1" border="0" />',
'after' => $user_info['is_guest'] ?  '</div>' : '',
'validate' => create_function('&$tag, &$data, $disabled', '
if (substr($data, 0, 1) == \'#\')
$data = \'#post_\' . substr($data, 1);'),
'disallow_children' => array('email', 'ftp', 'url', 'iurl', 'img'),
'disabled_after' => $user_info['is_guest'] ?  '' :  ' ($1)',

Probably I have to add variable $board_url and have to use function parse_url, but if variable $1 is data (here it's a link to an image), then ...

P.S. I'm new at php & smf. ::)