Don't like ads? PRO users don't see any ads ;-)

Untitled

By: mxneo on Nov 16th, 2011  |  syntax: None  |  size: 4.26 KB  |  hits: 33  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1.                 function clear_url($url) {
  2.                         $url = strip_tags( trim( stripslashes( $url ) ) );
  3.                         $url = str_replace( '\"', '"', $url );
  4.                         $url = str_replace( "'", "", $url );
  5.                         $url = str_replace( '"', "", $url );
  6.                         if( ! $this->safe_mode OR $this->wysiwyg ) {
  7.                                 $url = htmlspecialchars( $url, ENT_QUOTES );
  8.                         }
  9.                         $url = str_ireplace( "document.cookie", "document.cookie", $url );
  10.                         $url = str_replace( " ", "%20", $url );
  11.                         $url = str_replace( "<", "&#60;", $url );
  12.                         $url = str_replace( ">", "&#62;", $url );
  13.                         $url = preg_replace( "/javascript:/i", "j&#097;vascript:", $url );
  14.                         $url = preg_replace( "/data:/i", "d&#097;ta:", $url );
  15.                         return $url;
  16.                 }
  17.                 function build_fsp_video($url) {
  18.                         $url = clear_url( urldecode( $url ) );
  19.                         $url = str_replace("&amp;","&", $url );        
  20.                         if( $url == "" ) return;
  21.                         $source = @parse_url ( $url );
  22.                         $source['host'] = str_replace( "www.", "", strtolower($source['host']) );
  23.                         if ($source['host'] != "freespace.by" AND $source['host'] != "freespace.by") return "[fsp_video=".$url."]";
  24.                         if ($source['host'] == "freespace.by"){
  25.                                 $furl = 'http://freespace.by/';  // URL сайта на котором будем авторизоваться
  26.                                 $urlTo = 'http://freespace.by/api.php';
  27.                                 $user = 'smotrikov@mail.ru';
  28.                                 $pass = '1982049';                              // URL на которой будем слать POST данные
  29.                                 $ch = curl_init();                              // Инициализируем сеанс CURL
  30.                                 curl_setopt($ch, CURLOPT_URL, $furl);            // Заходим на сайт
  31.                                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); // Делаем так, чтобы страница не выдавалась сразу в поток, а можно было ее записать в переменную
  32.                                 $html = curl_exec($ch);                         // Имитируем заход на сайт
  33.                                 //curl_setopt($ch, CURLOPT_HEADER, array("Content-Type: Content-Type=application/octet-stream; charset=UTF-8")); //Хеадер
  34.                                 curl_setopt($ch, CURLOPT_URL, $urlTo);              // Устанавливаем адрес куда будем слать POST данные
  35.                                 curl_setopt($ch, CURLOPT_COOKIEJAR, 'Z:/home/test31.ru/www/cookie1.txt');  // Записываем cookies в файл, чтобы потом можно было их считать
  36.                                 curl_setopt($ch, CURLOPT_COOKIEFILE, 'Z:/home/test31.ru/www/cookie1.txt'); // Теперь читаем cookies с файла
  37.                                 curl_setopt($ch, CURLOPT_POST, true);               // Говорим, что информация будет отправляться методом POST
  38.                                 curl_setopt($ch, CURLOPT_POSTFIELDS, "action[0]=AuthExt.logon&username[0]=$user&password[0]=$pass&remember[0]=1");        // Передаем POST данные
  39.                                 curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);     // Иногда бывает, что после отправки данных происходит редирект heaer('Location:...').
  40.                                 // Этот параметр говорит о то, чтобы мы следовали за ними, а не оставались на месте после отправки данных
  41.                                 $html = curl_exec($ch); // Записываем пришедшие данные в переменную    
  42.                                 curl_setopt($ch, CURLOPT_URL,$url);
  43.                                 $html = curl_exec($ch);
  44.                                 curl_close($ch);        // Закрываем сеанс работы CURL
  45.                                 //echo $html;             // И вуаля :) Выводим авторизованную страницу
  46.                                 preg_match_all('/"file":"(.*)"/isU', $html, $captc);
  47.                                 $capt = $captc[1][ 0];
  48.                                 return  "<!--dle_video_begin:{$decode_url}--><embed src=\"http://test32.ru/engine/classes/flashplayer/flvplayer.swf\" width=\"550\" height=\"400\" allowfullscreen=\"true\" flashvars=\"&file={$capt}&backcolor=0x000000&frontcolor=0xFFFFFF&lightcolor=0x000000&screencolor=0x000000&&logo=/logo.png&streamer=lighttpd\"></embed><!--dle_video_end-->";
  49.                         } else return '<!--dle_movshare_begin:'.$url.'--><center><iframe src=\"'.$url.'\" width=\"720\" height=\"320\" frameborder=\"0\"></iframe></center><!--dle_movshare_end-->';
  50.                 }
  51.                
  52.                 $row['full_story'] = preg_replace( "#\[fsp_video=([^\]]+)\]#ies", "build_fsp_video('\\1')", $row['full_story'] );
  53.