Advertisement
Guest User

Untitled

a guest
Aug 2nd, 2011
441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Diff 1.30 KB | None | 0 0
  1. --- timthumb.php    2011-08-02 08:15:25.000000000 -0700
  2. +++ timthumb.new    2011-08-02 11:08:55.000000000 -0700
  3. @@ -641,7 +641,9 @@
  4.                 display_error ('source filename invalid');
  5.             }          
  6.  
  7. -           if (($url_info['host'] == 'www.youtube.com' || $url_info['host'] == 'youtube.com') && preg_match ('/v=([^&]+)/i', $url_info['query'], $matches)) {
  8. +           $url_host = preg_replace( '/^www\./', '', strtolower( $url_info['host'] ) );
  9. +
  10. +           if ( $url_host == 'youtube.com' && preg_match ('/v=([^&]+)/i', $url_info['query'], $matches) ) {
  11.                 $v = $matches[1];
  12.                 $src = 'http://img.youtube.com/vi/' . $v . '/0.jpg';
  13.                 $url_info['host'] = 'img.youtube.com';
  14. @@ -650,19 +652,10 @@
  15.             $isAllowedSite = false;
  16.  
  17.             // check allowed sites (if required)
  18. -           if (ALLOW_EXTERNAL) {
  19. -
  20. +           if (ALLOW_EXTERNAL)
  21.                 $isAllowedSite = true;
  22. -
  23. -           } else {
  24. -
  25. -               foreach ($allowedSites as $site) {
  26. -                   if (preg_match ('/(?:^|\.)' . $site . '$/i', $url_info['host'])) {
  27. -                       $isAllowedSite = true;
  28. -                   }
  29. -               }
  30. -
  31. -           }
  32. +           else
  33. +               $isAllowedSite = (bool)count( preg_grep( '/^' . preg_quote( $url_host ) . '$/i', $allowedSites ) );
  34.  
  35.             // if allowed
  36.             if ($isAllowedSite) {
  37. @@ -861,4 +854,4 @@
  38.     echo '<br />TimThumb version : ' . VERSION . '</pre>';
  39.      die ();
  40.  
  41. -}
  42. \ No newline at end of file
  43. +}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement