Файл: index.php
Строк: 107
<?php
####################################
## Автор:Черный Властелин aka Ren ##
## ICQ 38-33-283 ##
## http://profiwm.ru/us7311 ##
## Принимаю заказы! ##
####################################
include 'simple_html_dom.php';
include('conf.php');
$id = $_GET['load'];
$file = '';
$url = 'http://mobile.lubetube.com' . ($id ? $id : '/');
$curl = curl_init();
curl_setopt($curl, CURLOPT_URL, $url);
curl_setopt($curl, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/21.0.1180.89 Safari/537.1');
curl_setopt($curl, CURLINFO_HEADER_OUT, false);
curl_setopt($curl, CURLOPT_REFERER, "http://vko.su/?");
curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($curl, CURLOPT_CONNECTTIMEOUT, 60);
$res = curl_exec($curl);
$data = new simple_html_dom();
$data->load($res);
curl_close($curl);
if ($data == false) {
$file .= '<div class="menu">Сайт временно не работает! Приносим свои извинения!</div>';
exit;
}
// Header тэги и тд.
$temp = $data->find('head');
foreach ($temp as $p) {
$metadesc = $p->find('meta[name="description"]', 0)->content;
$metakey = $p->find('meta[name="keywords"]', 0)->content;
$title = $p->find('title', 0)->innertext;
foreach ($array as $key => $val) {
$metadesc = str_ireplace($key, $val, $metadesc);
$metakey = str_ireplace($key, $val, $metakey);
$title = str_ireplace($key, $val, $title);
}
}
// Показ видео
$tmp = $data->find('#videocontainer');
if ($tmp != false) {
foreach ($tmp as $p) {
$file .= '<div class="content"><center>';
$name = str_replace('Play ', '', $p->find('img', 1)->alt);
$name = str_replace("'", '', $name);
$link = str_replace('/video', 'http://mobile.lubetube.com/video', $p->find('a', 0)->href);
$about = preg_replace('#<li class="videoreleased"(.*)/strong></li>#sU', '', $p->find('ul.videodetails', 0));
$about = preg_replace('#<li class="videoviews"><i class="icon icon-play"></i> From(.*)/strong></li>#sU', '', $about);
$about = str_replace('/mostrecent', '?load=/mostrecent', $about);
$file .= '<h1>' . $name . '</h1>';
$file .= $p->find('img', 1);
$file .= '</div><div class="content">' . $name . '</div>
<a class="button" href="' . $link . '">Смотреть онлайн</a><br />
<a class="button" href="' . $link . '">Скачать MP4</a>
<table width="100%"><tr>' . $about . '</table><div class="cat">Похожие записи</div>';
}
}
// Листинг видео
$tmp = $data->find('ul.listView li');
if ($tmp != false) {
$file .= '<div class="content"><center>';
foreach ($tmp as $p) {
$img = $p->find('img', 0);
if (!empty($img)) {
$link = str_replace('http://mobile.lubetube.com', '?load=', $p->find('a', 0)->href);
$name = str_replace('http://mobile.lubetube.com', '?load=', $p->find('a', 0)->innertext);
foreach ($array as $key => $val) {
$name = str_ireplace($key, $val, $name);
}
$dur = strip_tags(str_replace('Duration: ', '', $p->find('span.views', 0)));
$views = strip_tags(str_replace('Views: ', '', $p->find('span.numPhotos', 0)));
$file .= '<div class="videoBox">
<a class="img" href="' . $link . '">' . $img . '
<div class="info"><span>' . $views . '</span>' . $dur . '</div></a><a href="' . $link . '">' . $name . '</a>
</div>';
}
}
$file .= '</center></div>';
}
// Листинг категорий:
$tmp = $data->find('#categories li');
if ($tmp != false) {
$file .= '<div class="content"><center>';
foreach ($tmp as $p) {
$link = $p->find('a', 0)->href;
if(stristr($link, '/gals/') === FALSE) {
$link = str_replace('http://mobile.lubetube.com/mostrecent', '?load=/mostrecent', $link);
$name = $p->find('a', 0)->title;
foreach ($array as $key => $val) {
$name = str_ireplace($key, $val, $name);
}
$file .= '<a href="' . $link . '" class="category">' . $name . '</a>';
}
}
$file .= '</center></div>';
}
// Навигация:
$tmp = $data->find('div.pagination a');
if ($tmp != false) {
$file .= '<div class="content"><center>';
foreach ($tmp as $p) {
$p = preg_replace('#<a(.*)class="selected">(.*)</a>(.*)#sU', '<span class="apage">$2</span>', $p);
$p = str_replace('<a href', ' <a class="pages" href', $p);
$p = str_replace('/mostrecent', '?load=/mostrecent', $p);
$p = str_replace('/toprated', '?load=/toprated', $p);
$p = str_replace('/mostviewed', '?load=/mostviewed', $p);
$file .= $p;
}
$file .= '</center></div>';
}
$view = get_head($title, $metakey, $metadesc) . $file . get_foot();
foreach ($array as $key => $val) {
$view = str_replace($key, $val, $view);
}
print $view;
$data->clear();
unset($data);
?>