Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /**
- *
- * @ This file is created by deZender.Net
- * @ deZender (PHP5 Decoder for ionCube Encoder)
- *
- * @ Version : 1.1.5.0
- * @ Author : DeZender
- * @ Release on : 30.07.2012
- * @ Official site : http://DeZender.Net
- *
- */
- class mp3models {
- function __construct() {
- $this->loadLib( );
- }
- function loadLib() {
- SoapClient;
- $this->client = new ( 'http://api.4shared.com/jax3/DesktopApp?wsdl', array( 'cache_wsdl' => WSDL_CACHE_DISK, 'trace' => 1, 'exceptions' => 0 ) );
- }
- function clearQuery($query) {
- $query = str_replace( array( '-', '_' ), ' ', stripslashes( $query ) );
- $query = preg_replace( '/\s+/', ' ', $query );
- $query = trim( $query, ' ' );
- $query = strtolower( $query );
- $query = str_replace( ' ', '+', $query );
- return $query;
- }
- function clearQuery2($query) {
- $query = str_replace( array( '+', '_' ), ' ', stripslashes( $query ) );
- $query = preg_replace( '/\s+/', ' ', $query );
- $query = trim( $query, ' ' );
- $query = strtolower( $query );
- $query = str_replace( ' ', '-', $query );
- return $query;
- }
- function grabBING($text = null, $count = null) {
- if (empty( $text )) {
- $query = QUERY;
- }
- else {
- $query = $text;
- }
- $host = 'www.bing.com';
- $uri = 'search';
- $params['q'] = $this->clearQuery( $query ) . '+site:4shared.com/mp3';
- $params['go'] = '';
- $params['qs'] = 'n';
- $params['form'] = '';
- $params['pq'] = $this->clearQuery( $query ) . '+site:4shared.com/mp3';
- $params['sc'] = '0-0';
- $params['sp'] = '-1';
- $params['sk'] = '';
- $params['count'] = $count;
- $params['format'] = 'rss';
- $canonicalized_query = array( );
- foreach ($params as $param => $value) {
- $canonicalized_query[] = $param . '=' . $value;
- }
- $canonicalized_query = implode( '&', $canonicalized_query );
- $request = 'http://' . $host . '/' . $uri . '?' . $canonicalized_query;
- $feed = rawurlencode( $request );
- $ip = $_SERVER['REMOTE_ADDR'];
- $url = 'http://ajax.googleapis.com/ajax/services/feed/load?v=2.0&q=' . $feed . '&num=' . $count . '&userip=' . $ip;
- include_once( BASEPATH . 'libs/curl.php' );
- cURL;
- $cURL = new ( );
- $return = $cURL->get( $url );
- $json = json_decode( $return, true );
- return $json;
- }
- function grabMP3($text = null, $start = null) {
- if (empty( $text )) {
- $query = QUERY;
- }
- else {
- $query = $text;
- }
- $ip = $_SERVER['REMOTE_ADDR'];
- $host = 'ajax.googleapis.com';
- $uri = 'ajax/services/search/web';
- $params['v'] = '1.0';
- $params['q'] = rawurlencode( $this->clearQuery( $query ) . '+"KB |"+site:4shared.com/mp3' );
- $params['rsz'] = '8';
- $params['start'] = $start;
- $params['userip'] = $ip;
- $canonicalized_query = array( );
- foreach ($params as $param => $value) {
- $canonicalized_query[] = $param . '=' . $value;
- }
- $canonicalized_query = implode( '&', $canonicalized_query );
- $request = 'http://' . $host . '/' . $uri . '?' . $canonicalized_query;
- include_once( BASEPATH . 'libs/curl.php' );
- cURL;
- $cURL = new ( );
- $return = $cURL->get( $request );
- $json = json_decode( $return, true );
- return $json;
- }
- function aasort($array, $key) {
- $sorter = array( );
- $ret = array( );
- reset( $array );
- foreach ($array as $ii => $va) {
- $sorter[$ii] = $va[$key];
- }
- arsort( $sorter );
- foreach ($sorter as $ii => $va) {
- $ret[$ii] = $array[$ii];
- }
- $array = $ret;
- return $array;
- }
- function filterData($text = null, $count = null, $view = null) {
- $gets = $this->grabBING( $text, $count );
- $datamp3 = $gets['responseData']['feed']['entries'];
- foreach ($datamp3 as $value) {
- $title = $this->filterTitle( $value['title'] );
- $link = $value['link'];
- $id = $this->getidlink( $link );
- $date = strtotime( $value['publishedDate'] );
- if (!empty( $title )) {
- $data[] = array( 'date' => $date, 'title' => $title, 'id' => $id, 'source' => '4shared.com' );
- continue;
- }
- }
- return $data;
- }
- function get4shared($query = null) {
- $host = 'search.4shared.com';
- $uri = 'network/searchXml.jsp';
- $params['q'] = $this->clearQuery2( $query );
- $params['searchExtention'] = 'mp3';
- $params['sortType'] = 3;
- $params['sortOrder'] = 1;
- $params['searchmode'] = 3;
- $canonicalized_query = array( );
- foreach ($params as $param => $value) {
- $canonicalized_query[] = $param . '=' . $value;
- }
- $canonicalized_query = implode( '&', $canonicalized_query );
- $url = 'http://' . $host . '/' . $uri . '?' . $canonicalized_query;
- include_once( BASEPATH . 'libs/curl.php' );
- cURL;
- $cURL = new ( );
- $result = $cURL->get( $url );
- include_once( BASEPATH . 'libs/class_xml.php' );
- $alldata = xml2array( $result, 1 );
- $datamp3 = $alldata['search-result']['result-files']['file'];
- if ($datamp3[0]['name']) {
- foreach ($datamp3 as $value) {
- $title = $this->filterTitle( $value['name'] );
- $link = $value['url'];
- $id = $this->getidlink( $link );
- if (!empty( $title )) {
- $data[] = array( 'title' => $title, 'id' => $id );
- continue;
- }
- }
- }
- else {
- $title = $datamp3['name'];
- $link = $datamp3['url'];
- $id = $this->getidlink( $link );
- if (!empty( $title )) {
- $data[] = array( 'title' => $title, 'id' => $id );
- }
- }
- return $data;
- }
- function filterTitle($title = null) {
- $title = str_replace( '4shared.com - free file sharing and storage', '', $title );
- $title = str_replace( ' ...', '', $title );
- $title = preg_replace( '/(.*) - 4shared(.*)/', '$1', $title );
- $title = str_replace( '4shared', '', $title );
- $title = trim( $title, ' ' );
- return $title;
- }
- function getidlink($link = null) {
- $link = preg_replace( '/http:\/\/(.*).4shared.com\/mp3\/(.*)\/(.*)/', '$2', $link );
- return $link;
- }
- function findmp3($query = null, $view = null) {
- $url = 'http://pipes.yahoo.com/pipes/pipe.run?_id=67f92d4dd91f40f0a1b44e7fb9fef3e2&_render=json&q=' . $this->clearQuery( $query );
- include_once( BASEPATH . 'libs/curl.php' );
- cURL;
- $cURL = new ( );
- $return = $cURL->get( $url );
- $json = json_decode( $return, true );
- foreach ($json['value']['items'] as $row) {
- $data[] = array( 'title' => $row['title'], 'id' => $row['id'], 'source' => $row['source'] );
- }
- return $data;
- }
- function sandboxfindmp3($query = null, $view = null) {
- $url = 'http://pipes.yahoo.com/pipes/pipe.run?_id=67f92d4dd91f40f0a1b44e7fb9fef3e2&_render=json&q=ari+lasso';
- include_once( BASEPATH . 'libs/curl.php' );
- cURL;
- $cURL = new ( );
- $return = $cURL->get( $url );
- $json = json_decode( $return, true );
- return $json;
- }
- function login4shared() {
- global $core;
- $url = 'http://m.4shared.com/login.jsp?login=' . $core->user_4shared . '&password=' . $core->pass_4shared . '&remember=true';
- include_once( BASEPATH . 'libs/curl.php' );
- cURL;
- $cURL = new ( );
- $cURL->get( $url );
- }
- function getfile($id = null) {
- global $core;
- $url = 'http://m.4shared.com/mp3/' . $id;
- $infomp3 = $this->client->getMp3FileInfo( $core->user_4shared, $core->pass_4shared, $url );
- $id_file = $infomp3->fileId;
- $infofile = $this->client->getFileInfo( $core->user_4shared, $core->pass_4shared, $id_file );
- $title = $infofile->name;
- $size = number_format( $infofile->size / 1048576, 3, ',', ' ' ) . ' KB';
- $preview = $this->client->getPreviewLink( $core->user_4shared, $core->pass_4shared, $id_file );
- $download = $this->client->getDirectLink( $core->user_4shared, $core->pass_4shared, $url );
- $date = strtotime( $infofile->date );
- if ($core->adfly_view == 'yes') {
- $link = SITEURL . '/download/?url=' . urlencode( $download );
- $url = 'http://api.adf.ly/api.php?key=' . $core->adfly_key . '&uid=' . $core->adfly_uid . '&advert_type=int&domain=adf.ly&url=' . $link;
- $download = file_get_contents( $url );
- }
- $data[] = array( 'preview' => $preview, 'download' => $download, 'title' => $title, 'size' => $size, 'date' => $date );
- return $data;
- }
- function detailsoundcloud($id = null) {
- $url = 'http://api.soundcloud.com/tracks/' . $id . '.json?client_id=' . SOUNDCLOUD_ID;
- $file = file_get_contents( $url );
- $json = json_decode( $file );
- $title = $json->title . '.mp3';
- $size = number_format( $json->original_content_size / 1048576, 3, ',', ' ' ) . ' KB';
- $download = SITEURL . '/downloadsc/?url=' . base64_encode( $json->stream_url . '?client_id=' . SOUNDCLOUD_ID ) . '&name=' . $title;
- $date = strtotime( $json->created_at );
- $data[] = array( 'preview' => $json->uri, 'download' => $download, 'title' => $title, 'size' => $size, 'date' => $date );
- return $data;
- }
- function infosc($id = null) {
- $url = 'http://api.soundcloud.com/tracks/' . $id . '.json?client_id=' . SOUNDCLOUD_ID;
- $file = file_get_contents( $url );
- $json = json_decode( $file );
- return $json;
- }
- function infofile($id = null) {
- global $core;
- $url = 'http://m.4shared.com/mp3/' . $id;
- $infomp3 = $this->client->getMp3FileInfo( $core->user_4shared, $core->pass_4shared, $url );
- $id_file = $infomp3->fileId;
- $infofile = $this->client->getFileInfo( $core->user_4shared, $core->pass_4shared, $id_file );
- $data = array( 'mp3' => $infomp3, 'file' => $infofile );
- return $data;
- }
- function previewfile($id = null, $source = null) {
- global $core;
- if ($source == '4s') {
- $url = 'http://m.4shared.com/mp3/' . $id;
- $infomp3 = $this->client->getMp3FileInfo( $core->user_4shared, $core->pass_4shared, $url );
- $id_file = $infomp3->fileId;
- $preview = $this->client->getPreviewLink( $core->user_4shared, $core->pass_4shared, $id_file );
- }
- else {
- $url = 'http://api.soundcloud.com/tracks/' . $id . '.json?client_id=' . SOUNDCLOUD_ID;
- $file = file_get_contents( $url );
- $json = json_decode( $file );
- $preview = $json->uri;
- }
- return $preview;
- }
- function saveKeyword($keyword) {
- global $core;
- global $db;
- if (!empty( $keyword )) {
- $info = $this->checkKeyword( $keyword );
- $info_id = $info[0]['keyword_id'];
- $info_count = $info[0]['keyword_count'];
- if (empty( $info_count )) {
- $data = array( 'keyword_name' => $keyword, 'keyword_date' => strtotime( NOW ), 'keyword_count' => $info_count + 1 );
- if ($this->countKeyword( ) < $core->countkeyword) {
- $id = $db->insert( 'tb_keywords', $data );
- return null;
- }
- $expkws = $db->query( 'SELECT keyword_id FROM tb_keywords' . '
- ORDER BY keyword_count,keyword_date ASC LIMIT 1' );
- while ($row = $db->fetch( $expkws )) {
- $kwidexp = $row['keyword_id'];
- }
- $db->update( 'tb_keywords', $data, 'keyword_id=' . $kwidexp );
- return null;
- }
- $data = array( 'keyword_date' => strtotime( NOW ), 'keyword_count' => $info_count + 1 );
- $db->update( 'tb_keywords', $data, 'keyword_id=' . $info_id );
- }
- }
- function countKeyword() {
- global $db;
- $sql = $db->query( 'select keyword_id from tb_keywords' );
- return $db->numrows( $sql );
- }
- function checkKeyword($keyword) {
- global $db;
- $sql = $db->query( '' . 'SELECT keyword_id,keyword_count from tb_keywords WHERE keyword_name=\'' . $keyword . '\'' );
- while ($row = $db->fetch( $sql )) {
- $record[] = $row;
- }
- return $record;
- }
- function getChart() {
- $url = 'http://ax.itunes.apple.com/WebObjects/MZStoreServices.woa/ws/RSS/topsongs/limit=24/xml';
- include_once( BASEPATH . 'libs/curl.php' );
- cURL;
- $cURL = new ( );
- $result = $cURL->get( $url );
- include_once( BASEPATH . 'libs/class_xml.php' );
- $data = xml2array( $result, 1 );
- $charts = $data['feed']['entry'];
- foreach ($charts as $chart) {
- $title = $chart['title'];
- $img = $chart['im:image'][2];
- $datachart[] = array( 'title' => $title, 'img' => $img );
- }
- return $datachart;
- }
- function getHomeLatest() {
- global $db;
- global $core;
- $sql = $db->query( 'SELECT keyword_name FROM tb_keywords' . '
- ORDER BY keyword_date DESC' . ( '' . '
- LIMIT ' . $core->countlatest ) );
- while ($row = $db->fetch( $sql )) {
- $record[] = $row['keyword_name'];
- }
- return $record;
- }
- }
- ?>
Add Comment
Please, Sign In to add comment