Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- //////////////////////////////////////
- // //
- // YouTube links //
- // Автор хака: Максим Гардер //
- // URL: http://maxim-harder.de/ //
- // email: info@maxim-harder.de //
- // Telegram: @MaHarder //
- // //
- //////////////////////////////////////
- if( !defined( 'DATALIFEENGINE' ) ) die( "Oh! You little bastard!" );
- $news_id = intval($news_id);
- if($news_id == false) return;
- if($field == false) return;
- $is_change = false;
- if($config['allow_cache'] != '1') {
- $config['allow_cache'] = '1';
- $is_change = true;
- }
- $yt_links = false;
- $yt_links = dle_cache( "youtube_links_" . $news_id, $config['skin'], false);
- if($yt_links) { echo $yt_links; return;}
- if ( !$yt_links ) {
- $row = $db->super_query("SELECT * FROM ". PREFIX ."_post WHERE id={$news_id}");
- $xfieldsdata = xfieldsdataload( $row["xfields"] );
- $xfields_n = $xfieldsdata;
- $url = $xfields_n[$field];
- $source = @parse_url ( $url );
- $source['host'] = str_replace( "www.", "", strtolower($source['host']) );
- if ($source['host'] == "youtube.com") {
- $a = explode('&', $source['query']);
- $b = explode('=', $a[0]);
- if ($b[0] == "v") $id = htmlspecialchars($b[1], ENT_QUOTES, $config['charset']);
- }
- if ($source['host'] == "youtu.be") {
- $id = str_replace( "/", "", $source['path'] );
- $id = htmlspecialchars($id, ENT_QUOTES, $config['charset']);
- }
- if ($source['host'] == "youtube.com" OR $source['host'] == "youtu.be") {
- $content = <<<HTML
- <div class="col-md-12">
- <div class="thumbnail-hover thumbnail-fade">
- <div class="caption">
- <h4></h4>
- <p>
- <a href="https://www.youtube.com/watch?v={$id}" class="popup-youtube hvr-pulse-shrink playbtn" data="modal"><i class="fa fa-play-circle-o" aria-hidden="true"></i></a>
- </p>
- </div>
- <img src="http://img.youtube.com/vi/{$id}/maxresdefault.jpg" class="img-responsive img-thumbnail">
- </div>
- </div>
- HTML;
- } else {
- $content = "";
- }
- $yt_links_cache = $content;
- echo $yt_links_cache;
- create_cache( "youtube_links_" . $news_id, $yt_links_cache, $config['skin'], false );
- if ($is_change) $config['allow_cache'] = false;
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement