function rutor($text)
{
preg_match_all ("#<tr><td style=\"vertical-align:top;\"></td>([\s\S]*?)</td></tr>#si", $text, $source, PREG_SET_ORDER);
$text = $source[0][1];
$text = str_replace('<a href="http://changecopyright.ru" target="_blank"><img src="http://changecopyright.ru/bannersout/banner-468x60.png"></a><br />', '', $text);
//Регулярка пидоров
$text = str_replace('<span style="color:blue;">HQ-ViDEO</span>', '<b>torrentpier.com</b>', $text);
$text = str_replace('HQCLUB', 'torrentpier.com', $text);
$text = str_replace('FREEISLAND', 'torrentpier.com', $text);
$text = str_replace('Gears Media', 'torrentpier.com', $text);
$text = str_replace('Just_TeMa', 'torrentpier.com', $text);
$text = str_replace('Files-х', 'torrentpier.com', $text);
$text = preg_replace('#<a href="http://hellywood.ru/.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://hq-video.org/.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://hqclub.net/.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://exkinoray.tv.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://exkinoray.org.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://interhit.org.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://exkinoray.tv/pic/offbanner/reliz.exkinoray.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://img23.binimage.org/34/36/9a/enigmavladislav71.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://riper.am/riperam.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://riper.am/.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://www.generalfilm.ws.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://generalfilm.ws.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://s019.*******.host/i603/1209/87/535dfd778010.gif".*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#& <img src="http://s017.*******.host/i412/1208/f2/bf3e5e3f51c8.gif.*?>#', ' ', $text);
$text = preg_replace('#<img src="http://2.firepic.org/2/images/2012-03/07/tp2rxwtz8xl3.gif".*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://www.agrmusic.org/.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://tracker.nova-lan.ru/.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://nick-name.ru/.*?</a>#', ' ', $text);
$text = preg_replace('#<img src="http://i50.fastpic.ru/big/2013/0803/58/6cd4a3d8ac226de81209cee3369dc458.gif.*?>#', ' ', $text);
$text = preg_replace('#<img src="http://megarelizer.ru/.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://i.imgur.com/1qnKU.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://www.freeisland.org/.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://scarabey.org/.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://new-team.org.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://i57.fastpic.ru/big/2013/1128/8e/0f1951eab7c36987190091c1d058ae8e.jpg.*?>#', ' ', $text);
$text = preg_replace('#<img src="http://s019.*******.host/i622/1306/32/980d60bc4416.gif".*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://www.hd-net.org.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://mediaclub.tv.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://i056.*******.host/1402/31/35cc79d56ba1.gif.*?>#', ' ', $text);
$text = preg_replace('#<img src="http://lostpic.net/orig_images/9/6/9/969f804e8322f6fb6bbf24462c4f3bad.png".*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://cinemania.cc/pic/groups/CINEMANIA.png".*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://cinemania.cc/.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="<img src="http://s005.*******.host/i212/1309/51/23eede0fecd5.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://s019.*******.host/i624/1309/2d/7c5758387429.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://rutor.info.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://zerkalo-rutor.org.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://i59.fastpic.ru/big/2013/1129/34/0fc4a1022f44fd99fd69acbb5d5d1d34.jpeg.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://fotohost.kz/images/2014/03/02/JyoXZ.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://s020.*******.host/i717/1309/b9/e1cf911f8341.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://s020.*******.host/i718/1311/c5/6a57c000d933.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://s57.*******.host/i157/1402/9c/352c1ea45daf.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://i069.*******.host/1402/dd/a538fe599270.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://s017.*******.host/i404/1309/60/16fa77685833.gif" /> <img src="http://s59.*******.host/i163/1308/21/6e04962f4ee1.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://i056.*******.host/1301/d3/79bb1765a159.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://i59.fastpic.ru/big/2013/1129/34/0fc4a1022f44fd99fd69acbb5d5d1d34.jpeg.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://filmrus.net/pic/groups/FilmRus.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://hdreactor.org/freehd.png.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://i33.fastpic.ru/big/2012/0324/17/b3009b8b3e6c80c43db9561cab87ec17.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://s018.*******.host/i520/1307/91/9bb3f0c192f0.png.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://www.filmrus.net/pic/groups/FfClub.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://2.firepic.org/2/images/2012-04/04/8hvkmj1lk60e.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://files-x.com/.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://firepic.org/images/2011-09/pe9tr9qjw85d24w4zizfmem17.jpg.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://2.firepic.org/2/images/2011-12/26/o2lz4uqlwnt6.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://2.firepic.org/2/images/2011-11/07/5u8270klj72q.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://rustorents.com/pic/knopka.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://s.rutor.org/t/button1.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://s.rutor.info/t/button1.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://s019.*******.host/i627/1302/41/7689dc958955.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://s010.*******.host/i313/1412/59/8882057187ec.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://www.imageup.ru/img286/1291032/0ptimus.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://www.rutor.info/.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://s014.*******.host/i328/1410/76/bbeb05031521.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://lostpic.net/orig_images/c/2/3/c23b68bf7f9713c5bc6bca6a3c6c7f44.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://i66.fastpic.ru/big/2015/0113/73/e08879f9d7f777b8bbdf2315f7995a73.jpeg.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://www.hq-video.org/images/hq_88_31.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://i42.fastpic.ru/big/2012/0808/51/5a228c567a256ef93291927224da4d51.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://2.firepic.org/2/images/2015-05/30/9is8sqoz1bom.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://open-tor.org/.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://interhit.org/pic/pics.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://tor-ru.net.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<a href="http://files-x.rip.*?</a>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://2.firepic.org/2/images/2013-09/02/0h3zu24zoutd.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
$text = preg_replace('#<img src="http://i58.fastpic.ru/big/2015/0506/2d/36f03ef0ca5684e2fbf0a89b2413f52d.gif.*?>#', '[img]https://torrentpier.com/styles/images/torrents.gif[/img]', $text);
//Регулярка пидоров конец
$text = preg_replace('/<td>.*?<img src="([\s\S]*?)".*?\/>/', '[img=right]$1[/img]', $text);
$text = str_replace('<br />', "\n", $text);
$text = preg_replace('/<a href="\/tag\/.*?" target="_blank">([\s\S]*?)<\/a>/', '$1', $text);
$text = preg_replace('/<div class="hidewrap"><div class="hidehead" onclick="hideshow.*?">([\s\S]*?)<\/div><div class="hidebody"><\/div><textarea class="hidearea">([\s\S]*?)<\/textarea><\/div>/', "\n[spoiler=\"\\1\"]\\2[/spoiler]", $text);
$text = preg_replace('/<a href="([\s\S]*?)" target="_blank">([\s\S]*?)<\/a>/', '[url=$1]$2[/url]', $text);
$text = preg_replace('/<img src="(http:\/\/s.rutor.org\/imdb\/.*?)" \/>/', '[img]https://torrentpier.com/styles/images/imdb.png[/img]', $text);
$text = preg_replace('/<img src="(http:\/\/s.rutor.info\/imdb\/.*?)" \/>/', '[img]https://torrentpier.com/styles/images/imdb.png[/img]', $text);
$text = preg_replace('/<img src="(.*?)" style="float:(.*?);" \/>/', '[img=$2]$1[/img]', $text);
$text = preg_replace('/<img src="([\s\S]*?)" \/>/', '[img]$1[/img]', $text);
$text = str_replace('<center>', '[align=center]', $text);
$text = str_replace('</center>', '[/align]', $text);
$text = str_replace('<hr />', '[hr]', $text);
$text = str_replace(''', "'", $text);
$text = str_replace(' ', ' ', $text);
// $text = str_replace('>', '>', $text);
// $text = str_replace('<', '<', $text);
for ($i=0; $i<=20; $i++)
{
$text = preg_replace('/<b>([^<]*?)<(?=\/)\/b>/', '[b]$1[/b]', $text);
$text = preg_replace('/<u>([^<]*?)<(?=\/)\/u>/', '[u]$1[/u]', $text);
$text = preg_replace('/<i>([^<]*?)<(?=\/)\/i>/', '[i]$1[/i]', $text);
$text = preg_replace('/<s>([^<]*?)<(?=\/)\/s>/', '[s]$1[/s]', $text);
$text = preg_replace('/<font size="([^<]*?)">([^<]*?)<(?=\/)\/font>/', "[size=2\\1]\\2[/size]", $text);
$text = preg_replace('/<span style="color:([^<]*?);">([^<]*?)<(?=\/)\/span>/', '[color=$1]$2[/color]', $text);
$text = preg_replace('/<span style="font-family:([^<]*?);">([^<]*?)<(?=\/)\/span>/', '[font="$1"]$2[/font]', $text);
}
// Убираем пустое пространство
$text = preg_replace('#([\r\n])[\s]+#is', "$1", $text);
$text = strip_tags($text);
$text = strip_tags(html_entity_decode($text));
return $text;
}
function submit_torrent($subject, $message, $forum_id, $torfile, $time, $user_id)
{
global $lang, $bb_cfg;
$user_ip = '7f000001';
if(!$user_id) $user_id = BOT_UID;
$subject = preg_replace("/(FREEISLAND|HQCLUB|HQ-ViDEO|HELLYWOOD|ExKinoRay|NewStudio|LostFilm|RiperAM|Generalfilm|Files-x|NovaLan|Scarabey|New-Team|HD-NET|MediaClub|Baibako|CINEMANIA|Rulya74|RG WazZzuP|Ash61|egoleshik|Т-Хzona|TORRENT - BAGIRA|F-Torrents|2LT_FS|Bagira|Pshichko66|Занавес|msltel|Leo.pard|Точка Zрения|BenderBEST|PskovLine|HDReactor|Temperest|Element-Team|BT-Club|Filmoff CLUB|HD Club|HDCLUB|potroks|fox-torrents|HYPERHD|GORESEWAGE|NoLimits-Team|New Team|FireBit-Films|NNNB|New-team|Youtracker|marcury|Neofilm|Filmrus|Deadmauvlad|Torrent-Xzona|Brazzass|Кинорадиомагия|Assassin's Creed|GOLDBOY|ClubTorrent|AndreSweet|TORRENT-45|0ptimus|Torrange|Sanjar & NeoJet|Leonardo|BTT-TEAM и Anything-group|BTT-TEAM|Anything-group|Gersuzu|Xixidok|PEERATES|ivandubskoj|R. G. Jolly Roger|Fredd Kruger|Киномагия|RG MixTorrent|RusTorents|Тorrent-Хzona|R.G. Mega Best|Gold Cartoon KINOREAKTOR (Sheikn)|ImperiaFilm|RG Jolly Roger|Sheikn|R.G. Mobile-Men|KinoRay & Sheikn|HitWay|mcdangerous|Тorren|Stranik 2.0|Romych|R.G. AVI|Lebanon|Big111|Dizell|СИНЕМА-ГРУПП|PlanetaUA|RG Superdetki|potrokis|olegek70|bAGrat|Alekxandr48|Mao Dzedyn|Fartuna|R.G.Mega Best|DenisNN|Киномагии|UAGet|Victorious|Gold Cartoon KINOREAKTOR|KINOREAKTOR|KinoFiles|HQRips|F-Torrent|A.Star|Beeboop|Azazel|Leon-masl|Vikosol|RG Orient Extreme|R.G.TorrBy|ale x2008|Deadmauvlad|semiramida1970|Zelesk|CineLab SoundMix|Сотник|ALGORITM|E76|datynet|Дяди Лёши| leon030982|GORESEWAGE|Hot-Film|КинозалSAT|ENGINEER|CinemaClub|Zlofenix|pro100shara|FreeRutor|FreeHD|гаврила|vadi|SuperMin|GREEN TEA|Kerob|AGR - Generalfilm|R.G. DHT-Music|Витек 78|Twi7ter|KinoGadget|BitTracker|KURD28|Gears Media|KINONAVSE100|Just TeMa|ColdFilm|torrentfilm|BlueBird|qqss44|Jaskier|HAwkey|Шкипер|MegaPeer|Vovan366|Interhit|Files-х)/si","torrentpier.com",$subject);
DB()->sql_query("INSERT INTO ". BB_TOPICS ."
(topic_title, topic_poster, topic_time, forum_id, topic_attachment, topic_dl_type, topic_last_post_time)
VALUES
('$subject', $user_id, '$time', $forum_id, '1', '1', '$time')");
$topic_id = DB()->sql_nextid();
DB()->sql_query("INSERT INTO ". BB_POSTS ."
(topic_id, forum_id, poster_id, post_time, poster_ip, post_attachment)
VALUES
($topic_id, $forum_id, $user_id, '$time', '$user_ip', '1')");
$post_id = DB()->sql_nextid();
DB()->sql_query("UPDATE ". BB_TOPICS ." SET
topic_first_post_id = $post_id,
topic_last_post_id = $post_id
WHERE topic_id = $topic_id");
DB()->sql_query("INSERT INTO ". BB_POSTS_TEXT ."
(post_id, post_text)
VALUES
($post_id, '$message')");
add_search_words($post_id, stripslashes($message), stripslashes($subject));
DB()->sql_query("INSERT INTO ". BB_ATTACHMENTS_DESC ."
(physical_filename, real_filename, extension, mimetype, filesize, filetime)
VALUES
('". $torfile['physical_filename'] ."', '". $torfile['real_filename'] ."', 'torrent', 'application/x-bittorrent', '". $torfile['filesize'] ."', ". $time .")");
$attach_id = DB()->sql_nextid();
DB()->sql_query("INSERT INTO ". BB_ATTACHMENTS ."
(attach_id, post_id, user_id_1)
VALUES
($attach_id, $post_id, ". $user_id .")");
DB()->sql_query("UPDATE ". BB_FORUMS ." SET
forum_posts = forum_posts + 1,
forum_last_post_id = $post_id,
forum_topics = forum_topics + 1
WHERE forum_id = $forum_id");
DB()->sql_query("UPDATE rutor_releases SET time = ". TIMENOW ." WHERE title = '$subject'");
tracker_register ($attach_id, '2', TOR_APPROVED);
}