function text_to_links ($data=\'\') {
if(empty($data)) { return $data; }
$lines = split(\"\\n\",$data);
if(strpos($data,\"\\\\1\",$line);
$line = eregi_replace(\"(https://[^ )\\r\\n]+)\",\"\\\\1\",$line);
$line = eregi_replace(\"(ftp://[^ )\\r\\n]+)\",\"\\\\1\",$line);
$line = eregi_replace(\"([-a-z0-9_]+(\\.[_a-z0-9-]+)*@([a-z0-9-]+(\\.[a-z0-9-]+)+))\",\"\\\\1\",$line);
$newText .= $line . \"\\n\";
}
return $newText;
}