$submit_vars = array (
'login_username' => $auth['rutracker']['login'],
'login_password' => $auth['rutracker']['pass'],
'login' => true,
);
$snoopy->submit("http://login.rutracker.org/forum/login.php", $submit_vars);
$snoopy->_httpmethod = "GET";
$snoopy->fetch($url);
$content = iconv('windows-1251', 'UTF-8', $snoopy->results);
$pos = strpos($content, 'humn_size');
$content = substr($content, 0, $pos);
if (!$content)
{
meta_refresh('release.php', '2');
bb_die('false content');
}
function rutracker($text, $mode=false)
{
if($mode == 'title')
{
//нова¤ регул¤рка дл¤ заголовка рутрекер
preg_match_all ('#data-share_title="([\s\S]*?)">#', $text, $source, PREG_SET_ORDER);
// конец новой регул¤рки
//preg_match_all ('#<h1 class="maintitle"><a.*?href=".*?">([\s\S]*?)</a></h1>#', $text, $source, PREG_SET_ORDER);
$text = @$source[0][1];
$text = str_replace('<wbr>', '', $text);
}
elseif($mode == 'torrent')
{
// нова¤ регул¤рка дл¤ торрент файла рутрекер
preg_match_all ('#<a href="dl.php\?t=(.*?)" class#', $text, $source, PREG_SET_ORDER);
// конец новой регул¤рки
//preg_match_all ('#<a href="http://dl.rutracker.org/forum/dl.php\?t=(.*?)" class#', $text, $source, PREG_SET_ORDER);
$text = $source[0][1];
}
else
{
$pos = strpos($text, '<div class="post_body"');
$text = substr($text, $pos);
$pos = strpos($text, '<div class="clear" style="height: 8px;"></div>');
$text = substr($text, 0, $pos);
$text = preg_replace('/<div class="post_body" id=".*?">/', '', $text);
$text = preg_replace('#<img class="smile" src=".*?" align="absmiddle" border="0" />#', '', $text);
$text = preg_replace('#\n<h3 class="sp-title">.*?</h3>#', '', $text);
$text = str_replace('<div class="q-wrap">', '', $text);
$text = str_replace('<div class="sp-wrap">', '', $text);
$text = str_replace('<div class="c-wrap">', '', $text);
$text = preg_replace('#<a name=".*?"></a>#', '', $text);
$text = preg_replace('#<a class="postLink-name" href=".*?">([\s\S]*?)</a>#', '$1', $text);
$text = str_replace('<span class="post-hr">-</span>', "\n[hr]\n", $text);
$text = preg_replace('#<pre class="post-pre">([\s\S]*?)</pre>#', '$1', $text);
$text = preg_replace('#<div style="margin-.*?">([\s\S]*?)</div>#', '$1', $text);
$text = preg_replace('/<var class="postImg" title="(.*?)"> <\/var>/', '[img]$1[/img]', $text);
$text = preg_replace('/<var class="postImg postImgAligned img-(.*?)" title="(.*?)"> <\/var>/', "[img=\\1]\\2[/img]\n", $text);
$text = str_replace('<span class="post-br"><br /></span>', "\n\n", $text);
$text = preg_replace('/<br.*?>/', '', $text);
$text = preg_replace('/<ul type="(.*?)">/', '[list=$1]', $text);
$text = str_replace('<ul>', '[list]', $text);
$text = str_replace('</ul>', '[/list]', $text);
$text = str_replace('<li>', "\n[*]", $text);
$text = str_replace('</li>', '', $text);
$text = str_replace('<pre>', '[pre]', $text);
$text = str_replace('</pre>', '[/pre]', $text);
for ($i=0; $i<=20; $i++)
{
$text = preg_replace('/<span class="post-b">([^<]*?)<(?=\/)\/span>/', '[b]$1[/b]', $text);
$text = preg_replace('/<span class="post-u">([^<]*?)<(?=\/)\/span>/', '[u]$1[/u]', $text);
$text = preg_replace('/<span class="post-i">([^<]*?)<(?=\/)\/span>/', '[i]$1[/i]', $text);
$text = preg_replace('/<span class="post-s">([^<]*?)<(?=\/)\/span>/', '[s]$1[/s]', $text);
$text = preg_replace('/<span style="font-size: ([^<]*?)px; line-height: normal;">([^<]*?)<(?=\/)\/span>/', "[size=\\1]\\2[/size]", $text);
$text = preg_replace('/<span style="font-family: ([^<]*?);">([^<]*?)<(?=\/)\/span>/', "[font=\"\\1\"]\\2[/font]", $text);
//$text = preg_replace('#<a href="http://www.imdb.com/title/(.*?)/" class=".*?">.*?</a>#', "[imdb]http://www.imdb.com/title/$1[/imdb]", $text);
//$text = preg_replace('#<a href="http://www.kinopoisk.ru/film/(.*?)/" class=".*?">.*?</a>#', "[kp]http://www.kinopoisk.ru/film/$1[/kp]", $text);
//$text = preg_replace('#<a href="http://www.kinopoisk.ru/level/(.*?)/" class=".*?">.*?</a>#', "[kp]http://www.kinopoisk.ru/level/$1[/kp]", $text);
$text = preg_replace('/<span class="post-align" style="text-align: ([^<]*?);">([^<]*?)<(?=\/)\/span>/', "[align=\\1]\n\\2\n[/align]", $text);
$text = preg_replace('/<span class="p-color" style="color: ([^<]*?);">([^<]*?)<(?=\/)\/span>/', '[color=$1]$2[/color]', $text);
$text = preg_replace('#<a href="http://rutracker.org.*?".*?>.*?</a>#', '', $text);
$text = preg_replace('#<a href="http://www.rutracker.org.*?".*?>.*?</a>#', '', $text);
$text = preg_replace('#<a href="http://nnmclub.to.*?".*?>.*?</a>#', '', $text);
$text = preg_replace('#<a href="http://www.nnmclub.to.*?".*?>.*?</a>#', '', $text);
$text = preg_replace('/<a href="([^<]*?)" class="postLink">([^<]*?)<(?=\/)\/a>/', '[url=$1]$2[/url]', $text);
$text = preg_replace('/<div class="sp-head folded">([^<]*?)<\/div>([^<]*?)<(?=\/)\/div>([\s\S]*?)<div class="sp-body">([^<]*?)<(?=\/)\/div>([\s\S]*?)<([^<]*?)\/div>/', "[spoiler=\"\\1\"]\n\\2\n[/spoiler]", $text);
$text = preg_replace('/<div class="q-head">([^<]*?)<\/div>([^<]*?)<(?=\/)\/div>([\s\S]*?)<div class="q">([^<]*?)<(?=\/)\/div>([^<]*?)<([^<]*?)\/div>/', "[quote=\"\\1\"]\n\\2\n[/quote]", $text);
$text = preg_replace('/<div class="q-head">(.*?)<\/div>([\s\S]*?)<([^<]*?)\/div>([^<]*?)<([^<]*?)\/div>/', "[quote=\"\\1\"]\n\\2\n[/quote]", $text);
$text = preg_replace('/<div class="c-head">[\s\S]*?<div class="c-body">([^<]*?)<(?=\/)\/div>([\s\S]*?)<([^<]*?)\/div>/', "[code]\n\\1\n[/code]", $text);
$text = preg_replace('/<div style="text-align:([^<]*?)">([^<]*?)<(?=\/)\/div>/', '<div>[align=$1]$2[/align]</div>', $text);
}
$text = preg_replace('/<div class="sp-head folded">(.*?)<\/div>([\s\S]*?)<([^<]*?)\/div>([^<]*?)<([^<]*?)\/div>/', "[spoiler=\"\\1\"]\n\\2\n[/spoiler]", $text);
$text = trim(strip_tags($text));
$text = str_replace(''', "'", $text);
$text = str_replace(' ', ' ', $text);
$text = str_replace('>', '>', $text);
$text = str_replace('<', '<', $text);
$text = html_entity_decode($text);
}
return $text;
}
if ($message = rutracker($content))
{
$id = rutracker($content, 'torrent');;
$snoopy->submit("http://rutracker.org/forum/dl.php?t=". $id);
$torrent = $snoopy->results;
$tor = bdecode($torrent);
if(count($tor))
{
$new_name = md5($torrent);
$file = fopen("$attach_dir/$new_name.torrent", 'w');
fputs($file, $torrent);
fclose($file);
$hidden_form_fields .= '<input type="hidden" name="add_attachment_body" value="0" />';
$hidden_form_fields .= '<input type="hidden" name="posted_attachments_body" value="0" />';
$hidden_form_fields .= '<input type="hidden" name="attachment_list[]" value="'. $attach_dir .'/'. $new_name .'.torrent" />';
$hidden_form_fields .= '<input type="hidden" name="filename_list[]" value="torrent" />';
$hidden_form_fields .= '<input type="hidden" name="extension_list[]" value="torrent" />';
$hidden_form_fields .= '<input type="hidden" name="mimetype_list[]" value="application/x-bittorrent" />';
$hidden_form_fields .= '<input type="hidden" name="filesize_list[]" value="'. filesize("$attach_dir/$new_name.torrent") .'" />';
$hidden_form_fields .= '<input type="hidden" name="filetime_list[]" value="'. TIMENOW .'" />';
$hidden_form_fields .= '<input type="hidden" name="attach_id_list[]" value="" />';
$hidden_form_fields .= '<input type="hidden" name="attach_thumbnail_list[]" value="0" />';
}
}
$subject = rutracker($content, 'title');