hooligan

CSRF FIX vb 3.x & 4.x

Mar 24th, 2012
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.50 KB | None | 0 0
  1.     /**
  2.     * Handles a match of the [img] tag that will be displayed as an actual image.
  3.     *
  4.     * @param    string  The URL to the image.
  5.     *
  6.     * @return   string  HTML representation of the tag.
  7.     */
  8.     function handle_bbcode_img_match($link)
  9.     {
  10.         $link = $this->strip_smilies(str_replace('\\"', '"', $link));
  11.  
  12.         // remove double spaces -- fixes issues with wordwrap
  13.         $link = str_replace(array('  ', '"'), '', $link);
  14.  
  15.         $whitelist = array(
  16.         "savepic.net",
  17.         "savepic.ru",
  18.         "hostingkartinok.com",
  19.         "imglink.ru",
  20.         "imageshost.ru",
  21.         "pixshock.net",
  22.         "radikal.ru",
  23.         "saveimg.ru",
  24.         "ipicture.ru",
  25.         "jpg1.ru",
  26.         "imagepost.ru",
  27.         "jpeghost.ru",
  28.         "impic.ru",
  29.         "fastpic.ru",
  30.         "imgex.com",
  31.         "pictureshack.ru",
  32.         "keep4u.ru",
  33.         "myphotoalbum.ru",
  34.         "4put.ru",
  35.         "xmages.net",
  36.         "lostpic.net");
  37.  
  38.         $host = parse_url($link, PHP_URL_HOST);
  39.         if(substr($host, 0, 4) == "www.")
  40.         {
  41.         $host = str_replace("www.", "", $host);
  42.         }
  43.  
  44.         if (in_array($host, $whitelist)) {
  45.         return '<img src="' .  $link . '" border="0" alt="" />';
  46.         }
  47.         else
  48.         {
  49.         return '<p style="color: red;">Please upload your picture at a trusted hoster. For: savepic.net, radikal.ru, ipicture.ru, fastpic.ru, etc</p>';
  50.         }
  51.     }
  52.  
  53. /*======================================================================*\
  54. || #################################################################### ||
  55. || # ---------------------- Xaker.Name ------------------------------ # ||
  56. \*======================================================================*/
Advertisement
Add Comment
Please, Sign In to add comment