function sed_bbcode_autourls($text)
{
global $usr;
if ($usr['maingrp']>0)
{
$text = ' '.$text;
$text = preg_replace("#([\n ])([a-z0-9]+?)://([^\t \n\r]+)#i", "\\1\\2://\\3", $text);
$text = preg_replace("#([\n ])([a-z0-9-_.]+?@[A-z0-9-]+\.[^,\t \n\r]+)#i", "\\1\\2", $text);
return(substr($text,1));
}
else
{
$text = ' '.$text;
$text = preg_replace("#([\n ])([a-z0-9]+?)://([^\t \n\r]+)#i", " <a href=\"users.php?m=register\"><img src=adres /></a> ", $text);
$text = preg_replace("#\[url([^\t \n\r]+)#i", "  <a href=\"users.php?m=register\"><img src=adres /></a>", $text);
$text = preg_replace("#([\n ])([a-z0-9-_.]+?@[A-z0-9-]+\.[^,\t \n\r]+)#i", "\\1\\2", $text);
return(substr($text,1));
}
}