PageRenderTime 169ms CodeModel.GetById 163ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 0ms

/scripts/feeds/scripts_vb6/scripts/filme/php/filme_link.php

http://eboda-hd-for-all-500.googlecode.com/
PHP | 456 lines | 447 code | 1 blank | 8 comment | 46 complexity | 31edb6b3ebd3deb4aef33cafcd7277cd MD5 | raw file
  1#!/usr/local/bin/Resource/www/cgi-bin/php
  2<?php
  3error_reporting(0);
  4$filelink=$_ENV["QUERY_STRING"];
  5$t1=explode(",",$filelink);
  6$filelink = urldecode($t1[0]);
  7$filelink = str_replace("*",",",$filelink);
  8$filelink = str_replace("@","&",$filelink); //seriale.subtitrate.info
  9$pg = urldecode($t1[1]);
 10if ($pg == "") {
 11   $pg_title = "Link";
 12} else {
 13  $pg_title = $pg;
 14  $pg = preg_replace('/[^A-Za-z0-9_]/','_',$pg);
 15}
 16$titledownload=$pg;
 17$onlinemoca=$t1[2];
 18//play movie
 19if (file_exists("/tmp/usbmounts/sda1/download")) {
 20   $dir = "/tmp/usbmounts/sda1/download/";
 21   $dir_log = "/tmp/usbmounts/sda1/download/log/";
 22} elseif (file_exists("/tmp/usbmounts/sdb1/download")) {
 23   $dir = "/tmp/usbmounts/sdb1/download/";
 24   $dir_log = "/tmp/usbmounts/sdb1/download/log/";
 25} elseif (file_exists("/tmp/usbmounts/sdc1/download")) {
 26   $dir = "/tmp/usbmounts/sdc1/download/";
 27   $dir_log = "/tmp/usbmounts/sdc1/download/log/";
 28} elseif (file_exists("/tmp/usbmounts/sda2/download")) {
 29   $dir = "/tmp/usbmounts/sda2/download/";
 30   $dir_log = "/tmp/usbmounts/sda2/download/log/";
 31} elseif (file_exists("/tmp/usbmounts/sdb2/download")) {
 32   $dir = "/tmp/usbmounts/sdb2/download/";
 33   $dir_log = "/tmp/usbmounts/sdb2/download/log/";
 34} elseif (file_exists("/tmp/usbmounts/sdc2/download")) {
 35   $dir = "/tmp/usbmounts/sdc2/download/";
 36   $dir = "/tmp/usbmounts/sdc2/download/log/";
 37} elseif (file_exists("/tmp/hdd/volumes/HDD1/download")) {
 38   $dir = "/tmp/hdd/volumes/HDD1/download/";
 39   $dir_log = "/tmp/hdd/root/log/";
 40} else {
 41     $dir = "";
 42     $dir_log = "";
 43}
 44// end
 45?>
 46<?php echo "<?xml version='1.0' ?>"; ?>
 47<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/">
 48<onEnter>
 49    storagePath             = getStoragePath("tmp");
 50    storagePath_stream      = storagePath + "stream.dat";
 51    storagePath_playlist    = storagePath + "playlist.dat";
 52  setRefreshTime(1);
 53  first_time=1;
 54</onEnter>
 55 <onExit>
 56 setRefreshTime(-1);
 57 </onExit>
 58<onRefresh>
 59  if(first_time == 1)
 60  {
 61  setRefreshTime(-1);
 62  itemCount = getPageInfo("itemCount");
 63  first_time=0;
 64  }
 65  else if (do_down == 1)
 66  {
 67    topUrl = "http://127.0.0.1/cgi-bin/scripts/util/info_down.php?file=" + log_file + ",f";
 68    info_serial = getUrl(topUrl);
 69  }
 70</onRefresh>
 71<mediaDisplay name="threePartsView"
 72	itemBackgroundColor="0:0:0"
 73	backgroundColor="0:0:0"
 74	sideLeftWidthPC="0"
 75	sideRightWidthPC="0"
 76	sideColorRight="0:0:0"
 77	itemImageXPC="5"
 78	itemXPC="20"
 79	itemYPC="20"
 80	itemWidthPC="70"
 81	capWidthPC="70"
 82	unFocusFontColor="101:101:101"
 83	focusFontColor="255:255:255"
 84	showHeader="no"
 85	showDefaultInfo="yes"
 86	bottomYPC="90"
 87	infoYPC="100"
 88	infoXPC="0"
 89	popupXPC = "40"
 90  popupYPC = "55"
 91  popupWidthPC = "22.3"
 92  popupHeightPC = "5.5"
 93  popupFontSize = "13"
 94	popupBorderColor="28:35:51"
 95	popupForegroundColor="255:255:255"
 96 	popupBackgroundColor="28:35:51"
 97  idleImageXPC="5" idleImageYPC="5" idleImageWidthPC="8" idleImageHeightPC="10"
 98>
 99        <idleImage>image/POPUP_LOADING_01.png</idleImage>
100        <idleImage>image/POPUP_LOADING_02.png</idleImage>
101        <idleImage>image/POPUP_LOADING_03.png</idleImage>
102        <idleImage>image/POPUP_LOADING_04.png</idleImage>
103        <idleImage>image/POPUP_LOADING_05.png</idleImage>
104        <idleImage>image/POPUP_LOADING_06.png</idleImage>
105        <idleImage>image/POPUP_LOADING_07.png</idleImage>
106        <idleImage>image/POPUP_LOADING_08.png</idleImage>
107  	<text align="center" offsetXPC="0" offsetYPC="0" widthPC="100" heightPC="18" fontSize="24" backgroundColor="10:105:150" foregroundColor="100:200:255">
108		  <script>getPageInfo("pageTitle");</script>
109		</text>
110  	<text align="left" offsetXPC="6" offsetYPC="15" widthPC="100" heightPC="4" fontSize="16" backgroundColor="10:105:150" foregroundColor="100:200:255">
111    Apasati 1 pentru download manager, 2 pentru download, 3 pentru vizionare download, 4 verificare link
112		</text>
113  	<text  redraw="yes" align="center" offsetXPC="0" offsetYPC="90" widthPC="100" heightPC="8" fontSize="17" backgroundColor="10:105:150" foregroundColor="100:200:255">
114    <script>print(info_serial); info_serial;</script>
115		</text>
116<onUserInput>
117userInput = currentUserInput();
118ret = "false";
119if(userInput == "two" || userInput == "2")
120{
121tip=getItemInfo(getFocusItemIndex(),"tip");
122showIdle();
123if (tip == "1")
124{
125url =  getItemInfo(getFocusItemIndex(),"download");
126movie=getUrl(url);
127info_serial="link:" + movie;
128topUrl = "http://127.0.0.1/cgi-bin/scripts/util/download.cgi?link=" + movie + ";name=" + getItemInfo(getFocusItemIndex(),"name");
129}
130else if (tip == "2")
131{
132topUrl = "http://127.0.0.1/cgi-bin/scripts/util/download.cgi?link=" + getItemInfo(getFocusItemIndex(),"download") + ";name=" + getItemInfo(getFocusItemIndex(),"name");
133}
134dummy = getUrl(topUrl);
135cancelIdle();
136do_down=1;
137file_name= getItemInfo(getFocusItemIndex(),"title");
138log_file="<?php echo $dir_log; ?>" + getItemInfo(getFocusItemIndex(),"name") + ".log";
139setRefreshTime(10000);
140ret="true";
141}
142else if (userInput == "three" || userInput == "3")
143{
144 url="<?php echo $dir; ?>" + getItemInfo(getFocusItemIndex(),"name");
145 playItemurl(url,10);
146 ret="true";
147}
148else if(userInput == "four" || userInput == "4")
149{
150showIdle();
151url =  getItemInfo(getFocusItemIndex(),"download");
152info_serial="link:" + url;
153redrawdisplay();
154tip=getItemInfo(getFocusItemIndex(),"tip");
155if (tip == "1")
156{
157movie=getUrl(url);
158info_serial="movie:" + movie;
159}
160cancelIdle();
161redrawdisplay();
162ret="true";
163}
164else if (userInput == "one" || userInput == "1")
165{
166jumpToLink("destination");
167ret="true";
168}
169else
170{
171info_serial=" ";
172setRefreshTime(-1);
173do_down=0;
174ret="false";
175}
176ret;
177</onUserInput>
178</mediaDisplay>
179<destination>
180	<link>http://127.0.0.1/cgi-bin/scripts/util/level.php
181	</link>
182</destination>
183<channel>
184<?php
185echo "<title>".$pg_title."</title>"
186;
187function str_between($string, $start, $end){
188	$string = " ".$string; $ini = strpos($string,$start);
189	if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini;
190	return substr($string,$ini,$len);
191}
192
193/**####################################**/
194/** Here we start.......**/
195$last_link = "";
196if (strpos($filelink,"onlinemoca") === false) {
197if (strpos($filelink,"filmeonlinesubtitrate.ro") !== false) {
198  $post="pageviewnr=1";
199  $ch = curl_init($filelink);
200  curl_setopt ($ch, CURLOPT_POST, 1);
201  curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);
202  curl_setopt($ch, CURLOPT_FOLLOWLOCATION  ,1);
203  curl_setopt($ch, CURLOPT_RETURNTRANSFER  ,1);  // RETURN THE CONTENTS OF THE CALL
204  $html = curl_exec($ch);
205  curl_close ($ch);
206} else {
207  $html = file_get_contents($filelink);
208}
209} else {
210  $html="";
211}
212/**####################################onlinemoca###############**/
213//Prea multe link-uri, trimit doar un link!
214if (strpos($filelink, 'onlinemoca') !== false) {
215   $filelink=$onlinemoca;
216	if (strpos($filelink,"adf.ly") !==false) {
217	   $h1=file_get_contents($filelink);
218	   $filelink=str_between($h1,"var url = '","'");
219    } else {
220	  $t1=explode("link=",$filelink);
221	  $filelink=$t1[1];
222    }
223	$server = str_between($filelink,"http://","/");
224	$title = $server;
225    $link="http://127.0.0.1/cgi-bin/scripts/filme/php/link.php?file=".urlencode($filelink);
226        $server = str_between($filelink,"http://","/");
227        $title=$server. " - With seek - SDK4";
228	    echo'
229	    <item>
230	    <title>'.$title.'</title>
231        <onClick>
232        <script>
233        showIdle();
234        movie="'.$link.'";
235        url=getUrl(movie);
236        cancelIdle();
237        streamArray = null;
238        streamArray = pushBackStringArray(streamArray, "");
239        streamArray = pushBackStringArray(streamArray, "");
240        streamArray = pushBackStringArray(streamArray, url);
241        streamArray = pushBackStringArray(streamArray, url);
242        streamArray = pushBackStringArray(streamArray, video/x-flv);
243        streamArray = pushBackStringArray(streamArray, "'.$pg_title.'");
244        streamArray = pushBackStringArray(streamArray, "1");
245        writeStringToFile(storagePath_stream, streamArray);
246        doModalRss("rss_file:///usr/local/etc/www/cgi-bin/scripts/util/videoRenderer.rss");
247        </script>
248        </onClick>
249        <download>'.$link.'</download>
250        <tip>1</tip>
251        <name>'.$titledownload.'.flv</name>
252        </item>
253        ';
254}
255/**################ All links ################**/
256if(preg_match_all("/(http\b.*?)(\"|\')+/i",$html,$matches)) {
257$links=$matches[1];
258}
259$s="/adf.ly|vidxden\.c|divxden\.c|vidbux\.c|movreel\.c|videoweed\.(c|e)|novamov\.(c|e)|vk\.com";
260$s=$s."|movshare\.net|videobb\.c|youtube\.c|flvz\.com|rapidmov\.net|putlocker\.com|";
261$s=$s."videozer\.com|peteava\.ro\/embed|peteava\.ro\/id|content\.peteava\.ro";
262$s=$s."|vimeo\.com|googleplayer\.swf|filebox\.ro\/get_video|vkontakte\.ru|megavideo\.com";
263$s=$s."/i";
264for ($i=0;$i<count($links);$i++) {
265  $cur_link=$links[$i];
266  if (preg_match($s,$cur_link)) {
267    if ($cur_link <> $last_link) {
268      if (!preg_match("/facebook|twitter|img\.youtube/",$cur_link)) {
269        $link="http://127.0.0.1/cgi-bin/scripts/filme/php/link.php?file=".urlencode($cur_link);
270        $server = str_between($cur_link,"http://","/");
271        $last_link=$cur_link;
272        $title=$server. " - With seek - SDK4";
273	    echo'
274	    <item>
275	    <title>'.$title.'</title>
276        <onClick>
277        <script>
278        showIdle();
279        movie="'.$link.'";
280        url=getUrl(movie);
281        cancelIdle();
282        streamArray = null;
283        streamArray = pushBackStringArray(streamArray, "");
284        streamArray = pushBackStringArray(streamArray, "");
285        streamArray = pushBackStringArray(streamArray, url);
286        streamArray = pushBackStringArray(streamArray, url);
287        streamArray = pushBackStringArray(streamArray, video/x-flv);
288        streamArray = pushBackStringArray(streamArray, "'.$pg_title.'");
289        streamArray = pushBackStringArray(streamArray, "1");
290        writeStringToFile(storagePath_stream, streamArray);
291        doModalRss("rss_file:///usr/local/etc/www/cgi-bin/scripts/util/videoRenderer.rss");
292        </script>
293        </onClick>
294        <download>'.$link.'</download>
295        <tip>1</tip>
296        <name>'.$titledownload.'.flv</name>
297        </item>
298        ';
299      }
300    }
301  }
302}
303/**################ special links ##############**/
304if (preg_match_all('/<(iframe\b|object\b)[^>]+src\s?=\s?([\'|\"])(.*?)(\"|\')+/is', $html, $matches)) {
305$links=$matches[3];
306}
307$link="";
308$srt="";
309for ($i=0;$i<count($links);$i++) {
310  $cur_link=$links[$i];
311    if (strpos($cur_link,"rofilm.info") !==false) {
312     $baza = file_get_contents($cur_link);
313     $t1=explode('value="file=',$baza);
314     $t2=explode("&",$t1[1]);
315     $link = $t2[0];
316     if ($link=="") {
317       $t1=explode("value='file=",$baza);
318       $t2=explode("&",$t1[1]);
319       $link=$t2[0];
320     }
321     $t1=explode('captions.file=',$baza);
322     $t2=explode("&",$t1[1]);
323     $srt=$t2[0];
324     $srt = str_replace(" ","%20",$srt);
325    } elseif (strpos($cur_link,"serialetvonline.info") !==false) {
326      if (strpos($cur_link,"gettvguide2.php") === false) {
327       $baza = file_get_contents($cur_link);
328       $link = str_between($baza,'"flashvars" value="file=','&');
329       $t1=explode('captions.file=',$baza);
330       $t2=explode("&",$t1[1]);
331       $srt=$t2[0];
332       $srt = str_replace(" ","%20",$srt);
333      }
334     } elseif (strpos($cur_link,"rosharing.com") !==false) {
335       $baza = file_get_contents($cur_link);
336       $link = str_between($baza,'value="file=','&');
337       $t1=explode('captions.file=',$baza);
338       $t2=explode("&",$t1[1]);
339       $srt=$t2[0];
340       $srt = str_replace(" ","%20",$srt);
341     } else {
342       $link="";
343       $srt="";
344     }
345  if ($link <> $last_link) {
346  if ($link <> "") {
347        $server = str_between($link,"http://","/");
348        $title=$server. " - With seek - SDK4";
349	    echo'
350	    <item>
351	    <title>'.$title.'</title>
352        <onClick>
353        <script>
354        showIdle();
355        url="'.$link.'";
356        cancelIdle();
357        streamArray = null;
358        streamArray = pushBackStringArray(streamArray, "");
359        streamArray = pushBackStringArray(streamArray, "");
360        streamArray = pushBackStringArray(streamArray, url);
361        streamArray = pushBackStringArray(streamArray, url);
362        streamArray = pushBackStringArray(streamArray, video/x-flv);
363        streamArray = pushBackStringArray(streamArray, "'.$pg_title.'");
364        streamArray = pushBackStringArray(streamArray, "1");
365        writeStringToFile(storagePath_stream, streamArray);
366        doModalRss("rss_file:///usr/local/etc/www/cgi-bin/scripts/util/videoRenderer.rss");
367        </script>
368        </onClick>
369        <download>'.$link.'</download>
370        <tip>2</tip>
371        <name>'.$titledownload.'.flv</name>
372        </item>
373        ';
374  }
375  if (($srt <> "") && (strpos($srt,".srt") !==false)) {
376    	echo '
377    	<item>
378    	<title>Subtitrare</title>
379    	<download>'.$srt.'</download>
380    	<tip>2</tip>
381        <name>'.$titledownload.'.srt</name>
382    	</item>
383    	';
384  }
385  $last_link = $link;
386  }
387}
388/**################ flash... mediafile,file.....############**/
389$videos = explode('flash', $html);
390unset($videos[0]);
391$videos = array_values($videos);
392foreach($videos as $video) {
393  $t1 = explode('ile=', $video);
394  $t2 = explode('&', $t1[1]);
395  $t3 = explode("'",$t2[0]);
396  $link = urldecode($t3[0]);
397  if (($link <> "") && strcmp($link,$lastlink)) {
398     if (strpos($link, 'http://') !== false){
399        $titledownload = $pg;
400        $title=str_between($link,"http://","/");
401        $ext=".flv";
402    	$lastlink = $link;
403		// for sdk4.... with seek
404		$title=$title. " - With seek - SDK4";
405	    echo'
406	    <item>
407	    <title>'.$title.'</title>
408        <onClick>
409        <script>
410        showIdle();
411        url="'.$link.'";
412        cancelIdle();
413        streamArray = null;
414        streamArray = pushBackStringArray(streamArray, "");
415        streamArray = pushBackStringArray(streamArray, "");
416        streamArray = pushBackStringArray(streamArray, url);
417        streamArray = pushBackStringArray(streamArray, url);
418        streamArray = pushBackStringArray(streamArray, video/x-flv);
419        streamArray = pushBackStringArray(streamArray, "'.$pg_title.'");
420        streamArray = pushBackStringArray(streamArray, "1");
421        writeStringToFile(storagePath_stream, streamArray);
422        doModalRss("rss_file:///usr/local/etc/www/cgi-bin/scripts/util/videoRenderer.rss");
423        </script>
424        </onClick>
425        <download>'.$link.'</download>
426        <tip>2</tip>
427        <name>'.$titledownload.'.'.$ext.'</name>
428        </item>
429        ';
430
431    	$srt1 = str_between($video,'captions.file=','&');
432    	$t1=explode('"',$srt1);
433    	$srt = $t1[0];
434    	if (strpos($srt,"http") === false) {
435           ////www.veziserialeonline.info,www.seriale-filme.info
436          $s1=explode("/",$filelink);
437          $s=$s1[2];
438          $srt="http://".$s.$srt;
439        }
440        $pct = substr($srt, -4, 1);
441    	if (($srt <> "") && ($pct == ".") && (strpos($srt,".srt") !==false)) {
442    	echo '
443    	<item>
444    	<title>Subtitrare</title>
445    	<download>'.$srt.'</download>
446    	<tip>2</tip>
447        <name>'.$titledownload.'.srt</name>
448    	</item>
449    	';
450    	}
451    }
452  }
453} //foreach
454?>
455</channel>
456</rss>