View file sots-syet-livebook/mp3/index.php

File size: 4.13Kb
<?php
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';

$set['title'] = 'Поиск mp3';
include_once '../sys/inc/thead.php';
title();
aut();

// Класс плеера
require 'class.PlayerJsTpl.php'; 
include 'conf.php';
include 'CurlClass.php';

$c = new CurlClassConfig;
$c->timeout = 10;
$c->followLocations = FALSE;
$curl = new CurlClass;

$search = isset($_GET['search']) ? htmlspecialchars(trim($_GET['search'])) : false;
$page = isset($_GET['page']) ? htmlspecialchars(trim($_GET['page'])) : false;
$q = isset($_GET['q']) ? htmlspecialchars(trim($_GET['q'])) : false;
$file = $curl->getPage ($c, 'http://poiskm.org/show/' . $search . '?page=' . $page);

?>
<style>
* {box-sizing: border-box;}
form {
  position: relative;
  margin: 0 auto;
}
button {
position: absolute;
    top: 3px;
    right: 0px;
    width: 42px;
    height: 37px;
    border: none;
    background: #ffffff;
    border-radius: 0 5px 5px 0;
    cursor: pointer;
    border: 1px solid #d0d0d0;
}
button:before {
  content: "\f002";
  font-family: FontAwesome;
  font-size: 16px;
  color: #d0d0d0;
}
</style>
<?

switch ($q) 
{
    default:
    echo '<div class="mess">
          <form action="' . $papka . '" method="get">
          <input style="background: white; border: 1px solid #d0d0d0;width: 91%;border-radius: 3px 0px 0px 3px;" placeholder="Введите текст для поиска трека..." type="search" name="search" value="">
          <input name="page" type="hidden" value="1"/>
          <input name="q" type="hidden" value="files"/>
          <button type="submit"></button>
          </form></div>';
          echo '<div class="mess">
          Введите название песни, или жанр, к примеру: <b>Рэп</b>, <b>Рок</b>, <b>Клубная</b>, также можете вводить текст на латинице наример <b>Rock</b>.
          </div>';
    break;

    case 'files':
    echo '<div class="mess">
          <form action="' . $papka . '" method="get">
          <input style="background: white; border: 1px solid #d0d0d0;width: 91%;border-radius: 3px 0px 0px 3px;" placeholder="Введите текст для поиска..." type="search" id="playerQuery" name="search" value="' . $search . '">
          <input name="page" type="hidden" value="1"/>
          <input name="q" type="hidden" value="files" />
          <button type="submit"></button>
          </form></div>';
    
    preg_match_all('#id="audio_src_(.*)"(.*)href="(.*)">(.*)</a>(.*)<span class="title-name">(.*)<(.*)<span class="duration">(.*)<#sU', $file, $zona);
    preg_match_all('#page=(.*)">(.*)</a>#sU', $file, $pages_all);
    
    $pages = 1;
    if (count($pages_all[1]) >= 2) {
        $pages = count($pages_all[1]) - 1;
    }
    
    $chunk = array_chunk($zona[1], 10, true);
    
    PlayerJsTpl::InitJsCss(); 
    PlayerJsTpl::getPlayer($zona[1][0], $zona[1][count($chunk[0]) - 1], $page, $pages); 
    
    ?><div id="ajaxContent"><?
    
    if ($chunk[0]) {
        if (isset($_GET['ajaxData'])) {
            ob_end_clean();
        }
        
        for($i = 0; $i < count($chunk[0]); $i++)
        {
            $num++;
            PlayerJsTpl::getPlayerMini($i, $zona); 
        }
        
        if (isset($pages_all[1]) && count($pages_all[1]) >= 2) {
            ob_start(); 
            str($papka . '?q=files&search=' . $search . '&', $pages, $page);
            $str = ob_get_contents(); 
            ob_end_clean();
            
            echo str_replace('end',  $pages, $str); 
        }
        
        if (isset($_GET['ajaxData'])) {
            die(); 
        }
    } else {
        echo '<div class="mess">Нет результатов</div>';
    }
    ?></div><?
}

PlayerJsTpl::Init(); 

include_once '../sys/inc/tfoot.php';
?>