Файл: vsime.com/system/functions/links.php
Строк: 31
<?
function links_user($arr)
{
global $config;
$nick = " <a href='http://$_SERVER[HTTP_HOST]$config[profile_page]?id=".@mysqli_result("SELECT `id` FROM `user` WHERE `nick` = '$arr[1]'")."'>".hsc($arr[1])."</a>";
return $nick;
}
function links_preg2($arr)
{
global $config;
if (preg_match('#^http://'.preg_quote($_SERVER['HTTP_HOST']).'#',$arr[2]))return $arr[1].'<a href="'.$arr[2].'">'.$arr[2].'</a>'.$arr[4];
else return $arr[1].'<a'.($config['web']?' target="_blank"':null).' href="http://'.$_SERVER['HTTP_HOST'].'/redirect.php?url='.html_entity_decode(hsc($arr[2])).'">'.$arr[2].'</a>'.$arr[4];
}
function links($msg)
{
global $config;
$msg = preg_replace('#[url=((?:http|https|ftp)://'.$_SERVER['HTTP_HOST'].'.*)](.*?)[/url]#si', ' <a href="1">2</a>', $msg);
$msg = preg_replace('/[img](.+)[/img]/isU', '<img style="vertical-align: middle; border: 1px solid #B7C5D2;padding: 2px 2px 2px 2px;margin: 0 2px 0 0; max-height: 200px; max-width: 200px;" src="$1" />', $msg);
$msg=preg_replace_callback('/[user](.+)[/user]/isU', 'links_user', $msg);
$msg=preg_replace_callback('~(^|s)([a-z]+://([^ rnt`'"]+))(s|$)~iu', 'links_preg2', $msg);
return $msg;
}
?>