Advertisement
MaHarder

youtube

May 27th, 2018
778
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.17 KB | None | 0 0
  1. <?php
  2. //////////////////////////////////////
  3. //                                  //
  4. //  YouTube links                   //
  5. //  Автор хака: Максим Гардер      //
  6. //  URL: http://maxim-harder.de/    //
  7. //  email: info@maxim-harder.de     //
  8. //  Telegram: @MaHarder             //
  9. //                                  //
  10. //////////////////////////////////////
  11.  
  12. if( !defined( 'DATALIFEENGINE' ) ) die( "Oh! You little bastard!" );
  13.  
  14. $news_id = intval($news_id);
  15. if($news_id == false) return;
  16. if($field == false) return;
  17.    
  18. $is_change = false;
  19. if($config['allow_cache'] != '1') {
  20.     $config['allow_cache'] = '1';
  21.     $is_change = true;
  22. }
  23.  
  24. $yt_links = false;
  25. $yt_links = dle_cache( "youtube_links_" . $news_id, $config['skin'], false);
  26.    
  27. if($yt_links) { echo $yt_links; return;}
  28.  
  29. if ( !$yt_links ) {
  30.  
  31.     $row = $db->super_query("SELECT * FROM ". PREFIX ."_post WHERE id={$news_id}");
  32.     $xfieldsdata = xfieldsdataload( $row["xfields"] );
  33.     $xfields_n = $xfieldsdata;
  34.  
  35.     $url = $xfields_n[$field];
  36.  
  37.     $source = @parse_url ( $url );
  38.     $source['host'] = str_replace( "www.", "", strtolower($source['host']) );
  39.  
  40.     if ($source['host'] == "youtube.com") {
  41.         $a = explode('&', $source['query']);
  42.         $b = explode('=', $a[0]);
  43.         if ($b[0] == "v") $id = htmlspecialchars($b[1], ENT_QUOTES, $config['charset']);
  44.     }
  45.  
  46.     if ($source['host'] == "youtu.be") {
  47.         $id = str_replace( "/", "", $source['path'] );
  48.         $id = htmlspecialchars($id, ENT_QUOTES, $config['charset']);
  49.     }
  50.  
  51.     if ($source['host'] == "youtube.com" OR $source['host'] == "youtu.be") {
  52.         $content = <<<HTML
  53.             <div class="col-md-12">
  54.                 <div class="thumbnail-hover thumbnail-fade">
  55.                     <div class="caption">
  56.                         <h4></h4>
  57.                         <p>
  58.                             <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>
  59.                         </p>
  60.                     </div>
  61.                     <img src="http://img.youtube.com/vi/{$id}/maxresdefault.jpg" class="img-responsive img-thumbnail">
  62.                 </div>
  63.             </div>
  64. HTML;
  65.     } else {
  66.         $content = "";
  67.     }
  68.        
  69.     $yt_links_cache = $content;
  70.     echo $yt_links_cache;
  71.        
  72.     create_cache( "youtube_links_" . $news_id, $yt_links_cache, $config['skin'], false );
  73.     if ($is_change) $config['allow_cache'] = false;
  74.  
  75. }
  76. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement