Файл: you/index.php
Строк: 300
<?
###################################################
# BY MAKSAMKA (Mr.MAX) ICQ 154-26-36 #
# Поиск видео > API v3 Youtube #
# Версия сборки V.1.1 продолжение будет #
###################################################
?>
<?require_once(dirname(__FILE__).'/_system/bd.php')?>
<?switch (filtr($_GET['m'])) :
default:
?>
<?$title= 'Глобальный поиск видео'?>
<?require_once(dirname(__FILE__).'/heads.php')?>
<div class="wrapper">
<div class="wrapper2">
<h1 class="news"><img src="<?=$papka?>slyle/images/zag.png" alt="" /> Поиск видео</span></h1>
<div class="main">
<form action="<?=$papka?>search" method="POST" class="sendmail">
Искать : <br />
<input type="text" name="zapros" placeholder="Что ищем? (А-я, A-z, 0-9)"/>
<br/>
Где ищем :<br />
<select name="to">
<option value="any">Видео</option>
<option value="movie">Фильмы и сериалы</option>
<option value="episode">Эпизоды шоу</option>
</select><br/>
Сортировка :<br />
<select name="sort">
<option value="relevance">Не сортировать</option>
<option value="date">По дате</option>
<option value="rating">По рейтингу</option>
<option value="title">По алфавиту</option>
<option value="viewCount">По просмотрам</option>
</select>
<br/>
Тоько HD :
<input type="checkbox" name="act" value="1" />
<br/>
<input type="submit" name="submit" value="Искать">
</form></div>
<h3><div class="blc"><img src="<?=$papka?>slyle/images/raz.png" alt="" /> Другие ищут</span></h3></div>
<div class="blm3">
<?$array = core::$dbs->query("SELECT count, text, time FROM obr ORDER BY time DESC LIMIT $cop")?>
<?if($array->rowCount()==0){?>
Ничего не найдено
<?}?>
<?while($arr = $array->fetch()) : ?>
<a class="link" href="<?=$papka?>results/<?=out($arr['text'])?>/"><img src="<?=$papka?>slyle/images/1.png" alt=""/> <?=out($arr['text'])?> [Обр: <span class="hit"><?=num($arr['count'])?></span> - <?=out(times($arr['time']))?>]</a>
<? endwhile ?>
</div>
<h3><div class="blc2"><img src="<?=$papka?>slyle/images/raz.png" alt="" /> Информация:</span></h3></div>
<div class="blm2">
<a class="link" href="<?=$papka?>index/1"><img src="<?=$papka?>slyle/images/2.png" alt="" style="width:22px;"/> История запросов <span class="count"><?=num(core::$dbs->querySingle("SELECT COUNT(*) FROM obr"))?></span></a>
<a class="link" href="<?=$papka?>comm/1"><img src="<?=$papka?>slyle/images/2.png" alt="" style="width:22px;"/> Мнение о сервисе <span class="count"><?=num(core::$dbs->querySingle("SELECT COUNT(*) FROM comment"))?></span></a>
</div>
</div>
</div>
<?require_once(dirname(__FILE__).'/foots.php')?>
<?break?>
<?case process:?>
<?if(preg_match("#^([А-Яа-яЁёa-zA-Z0-9s])+$#ui", $_POST['zapros']) AND strlen($_POST['zapros']) > 3 AND strlen($_POST['zapros']) < 30 AND isset($_POST['submit']) AND $_POST['sort'] == 'relevance' OR $_POST['sort'] == 'date' OR $_POST['sort'] == 'rating' OR $_POST['sort'] == 'title' OR $_POST['sort'] == 'viewCount' AND $_POST['to'] == 'any' OR $_POST['to'] == 'movie' OR $_POST['to'] == 'episode'){?>
<?if(core::$dbs->querySingle("SELECT COUNT(id) FROM obr WHERE text = ?", array(filtr($_POST['zapros'])))){?>
<?core::$dbs->query("UPDATE obr SET count = count+?, time = ? WHERE text = ? LIMIT 1",array(1,time(),filtr($_POST['zapros'])))?>
<?}else{?>
<?core::$dbs->query("INSERT INTO obr SET count = ?, text = ?, time = ?",array(1,filtr($_POST['zapros']),time()))?>
<?}?>
<?$_SESSION['sort'] = filtr($_POST['sort'])?>
<?$_SESSION['ot'] = filtr($_POST['to'])?>
<?($_POST['act'] ? $_SESSION['hd'] = 1 : $_SESSION['hd'] = 0)?>
<?die(header('Location: '.$papka. 'results/' .filtr($_POST['zapros']) . '/'))?>
<?}else{?>
<?die(header('Location: '.$papka))?>
<?}?>
<?break?>
<?case resultat:?>
<?if(!preg_match("#^([А-Яа-яЁёa-zA-Z0-9s])+$#ui", $_GET['name']) OR !preg_match("#^([a-zA-Z])+$#ui", $_SESSION['sort']) OR !preg_match("#^([a-zA-Z])+$#ui", $_SESSION['ot']) OR !core::$dbs->querySingle("SELECT COUNT(id) FROM obr WHERE text = ?", array(filtr($_GET['name'])))) die(header('Location: '.$papka))?>
<?$json= yotube('https://www.googleapis.com/youtube/v3/search?part=snippet&videoSyndicated=true&q=' . urlencode(out($_GET['name'])) . '&key=' . $apikey . '&maxResults=' .$cop . '&pageToken=' .(filtr($_GET['token']) ? filtr($_GET['token']) : null) .'&type=video&order=' . filtr($_SESSION['sort']) . '&videoType=' . filtr($_SESSION['ot']) . '&videoDefinition='.($_SESSION['hd'] ? 'high' : 'any'), md5(urlencode(out($_GET['name'])) .(filtr($_GET['token']) ? filtr($_GET['token']) : null)), $cache_file);?>
<?$title= 'Поиск видео | ' . out($_GET['name'])?>
<?require_once(dirname(__FILE__).'/heads.php')?>
<div class="wrapper">
<div class="wrapper2">
<h1 class="news"><img src="<?=$papka?>slyle/images/zag.png" alt="" /> <?=out($_GET['name'])?></span></h1>
<?if(!$json->items){?>
<div class="main">
Ничего не найдено(
</div>
</div>
</div>
<?require_once(dirname(__FILE__).'/foots.php')?>
<?exit?>
<?}?>
<?$i = 1;?>
<?foreach ($json->items as $data) : ?>
<a class="link" href="<?=$papka?>video/<?=filtr($data->id->videoId)?>" title="<?=filtr($data->snippet->title)?>">
<table><tr>
<td><div class="imgPicture">
<img src="<?=filtr($data->snippet->thumbnails->default->url)?>" alt="<?=filtr($data->snippet->title)?>" height="60" width="90"/>
</div></td>
<td>
<?=mb_substr(filtr($data->snippet->title),0, 40)?>...
<span class="c_date"><?=date_format(new DateTime($data->snippet->publishedAt) , 'd.m.y')?>
</span>
</td>
</tr></table>
</a>
<?$n[] = $i++;?>
<? endforeach ?>
<?if($n[$pnumber-1] == $pnumber){?>
<div class="pages">
<?if (strlen($json->prevPageToken)>1){?>
<a href="<?=$papka?>results/<?=filtr($_GET['name'])?>/<?=filtr($json->prevPageToken)?>"><- Назад</a>
<?}?>
<?if (strlen($json->nextPageToken)>1){?>
<a href="<?=$papka?>results/<?=filtr($_GET['name'])?>/<?=filtr($json->nextPageToken)?>">Далее -></a>
<?}?>
</div>
<?}else{?>
<?if($n[0] >= 1 && strlen($json->prevPageToken)>1){?>
<div class="pages"><a href="<?=$papka?>results/<?=filtr($_GET['name'])?>/<?=filtr($json->prevPageToken)?>"><- Назад</a></div>
<?}?>
<?}?>
</div>
</div>
<?require_once(dirname(__FILE__).'/foots.php')?>
<?break?>
<?case v:?>
<?$json = yotube('https://www.googleapis.com/youtube/v3/videos?key='.$apikey.'&part=snippet,contentDetails,statistics,topicDetails&id='.filtr($_GET['id']).'®ionCode=ru', md5(filtr($_GET['id'])), $cache_file);?>
<?if(!$json->items){?>
<?$title= 'Ошибка'?>
<?require_once(dirname(__FILE__).'/heads.php')?>
<div class="wrapper">
<div class="wrapper2">
<h1 class="news"><img src="<?=$papka?>slyle/images/zag.png" alt="" /> Ошибка</span></h1>
<div class="main">
файл не доступен
</div>
</div>
</div>
<?require_once(dirname(__FILE__).'/foots.php')?>
<?exit?>
<?}?>
<?foreach ($json->items as $video) : ?>
<?$title= filtr($video->snippet->title)?>
<?require_once(dirname(__FILE__).'/heads.php')?>
<div class="wrapper">
<div class="wrapper2">
<h1 class="news"><img src="<?=$papka?>slyle/images/zag.png" alt="" /> <?=filtr($video->snippet->title)?></span></h1>
<div class="main"><iframe width="98%" src="http://www.youtube.com/embed/<?=filtr($video->id)?>?modestbranding=1" frameborder="0" allowfullscreen="yes"></iframe></div>
<div class="main">
<center>
<img src="http://img.youtube.com/vi/<?=filtr($video->id)?>/1.jpg" width="90px" alt="<?=$video->snippet->title?>">
<img src="http://img.youtube.com/vi/<?=filtr($video->id)?>/2.jpg" width="90px" alt="<?=$video->snippet->title?>">
<img src="http://img.youtube.com/vi/<?=filtr($video->id)?>/3.jpg" width="90px" alt="<?=$video->snippet->title?>">
</center>
</div>
<div class="main">
<b>Длительность</b> : <?=filtr(tm($video->contentDetails->duration))?>
<?=($video->snippet->description ? '<br/><b>Описание</b>:'.filtr($video->snippet->description) : null)?>
</div>
<? endforeach ?>
<?$yd = new YoutubeDownloader('https://www.youtube.com/watch?v='.filtr($_GET['id']))?>
<?$fullInfo = $yd->getFullInfo()?>
<?$videoId = $fullInfo['video_id']?>
<?$response['data'] = array(
'baseInfo' => $yd->getBaseInfo(),
'downloadInfo' => $yd->getDownloadsInfo(),
)?>
<?$downloadInfo = $response['data']['downloadInfo']?>
<h3><h1 class="blc"><img src="<?=$papka?>slyle/images/polez.png" alt="" /> Скачать файл</span></h3></div>
<div class="blm4">
<? foreach ($downloadInfo AS $downloadInfoItem): ?>
<?if(!$downloadInfoItem['fileType']){?>
<div class="main">
Этот файл не доступен для скачки(
</div>
</div></div>
</div>
<?require_once(dirname(__FILE__).'/foots.php')?>
<?exit?>
<?}?>
<?php $downloadInfoItem['fileType'] = str_replace('video/', 'Файл (<b>видео</b>) - ', $downloadInfoItem['fileType']) ?>
<?php $downloadInfoItem['fileType'] = str_replace('audio/', 'Файл (<b>аудио</b>) - ', $downloadInfoItem['fileType']) ?>
<a class="link" href="<?= $downloadInfoItem['url'] ?>"><img src="<?=$papka?>slyle/images/1.png" alt="" style="width:22px;"/> <?= $downloadInfoItem['fileType'] ?></a>
<? endforeach ?>
</div>
</div></div>
<?require_once(dirname(__FILE__).'/foots.php')?>
<?break?>
<?case coma:?>
<?$title= 'Мнение о сервисе'?>
<?require_once(dirname(__FILE__).'/heads.php') ?>
<div class="wrapper">
<div class="wrapper2">
<h1 class="news"><img src="<?=$papka?>slyle/images/zag.png" alt="" />Мнение сервиса</h1>
<div class="main">
<form action="<?=$papka?>comm/" method="post">
<b>Ваше имя</b>:<br/>
<input type="text" name="name" maxlength="32" value=""/><br/>
<b>Комментарий</b>:<br/>
<textarea cols="25" rows="3" name="msg" id="msg"></textarea><br />
<input class="button" name="submit" type="submit" value="Сказать"/>
</form>
</div>
<?if(isset($_POST['submit'])){?>
<?if(strlen(filtr($_POST['name'])) > 60 || strlen(filtr($_POST['name'])) < 3 && strlen(filtr($_POST['msg'])) > 500 || strlen(filtr($_POST['msg'])) < 3) {?>
<div class="main">Правильность заполнения полей имя и комментарий нарушено</div>
<?require_once(dirname(__FILE__).'/foots.php') ?>
<?exit;?>
<?}?>
<?core::$dbs->query("INSERT INTO comment SET name = ?, text = ?, time = ?",array(filtr($_POST['name']),filtr($_POST['msg']),time()))?>
<?die(header('location: ' .$papka .'comm/1'))?>
<?}?>
<?$m = kol(core::$dbs->querySingle("SELECT COUNT(id) FROM comment"),$page,$cop)?>
<?if(!$m[1]){?>
<div class="main">Нет мнений</div>
<?require_once(dirname(__FILE__).'/foots.php') ?>
<?exit?>
<?}?>
<?$array = core::$dbs->query("SELECT id, name, text, time FROM comment ORDER BY time DESC LIMIT $m[0],$cop")?>
<?while($arr = $array->fetch()) : ?>
<div class="main"><b><?=out($arr['name'])?></b> [ <?=out(times($arr['time']))?> ]
<br/>
<?=out($arr['text'])?>
</div>
<? endwhile ?>
</div>
</div>
<?navigator($page,$m[1],$papka.'comm/')?>
<?require_once(dirname(__FILE__).'/foots.php')?>
<?break?>
<?case o:?>
<?$title= 'Другие ищут'?>
<?require_once(dirname(__FILE__).'/heads.php') ?>
<div class="wrapper">
<div class="wrapper2">
<h1 class="news"><img src="<?=$papka?>slyle/images/zag.png" alt="" /> Другие ищут</h1>
<div class="blm3">
<?$m = kol(core::$dbs->querySingle("SELECT COUNT(id) FROM obr"),$page,$cop)?>
<?if(!$m[1]){?>
Пусто
<?require_once(dirname(__FILE__).'/foots.php') ?>
<?exit?>
<?}?>
<?$array = core::$dbs->query("SELECT count, text, time FROM obr ORDER BY id DESC LIMIT $m[0],$cop")?>
<?while($arr = $array->fetch()) : ?>
<a class="link" href="<?=$papka?>results/<?=out($arr['text'])?>/"><img src="<?=$papka?>slyle/images/1.png" alt=""/> <?=out($arr['text'])?> [Обр: <span class="hit"><?=num($arr['count'])?></span> - <?=out(times($arr['time']))?>]</a>
<? endwhile ?>
</div>
</div>
</div>
<?navigator($page,$m[1],$papka.'index/')?>
<?require_once(dirname(__FILE__).'/foots.php') ?>
<? endswitch ?>