PageRenderTime 47ms CodeModel.GetById 17ms RepoModel.GetById 0ms app.codeStats 0ms

/filme/php/vplay_main_main.php

https://code.google.com/p/hdforall/
PHP | 284 lines | 261 code | 19 blank | 4 comment | 24 complexity | 6608666c6169fe8e905b2e101e19a3ee MD5 | raw file
  1. #!/usr/local/bin/Resource/www/cgi-bin/php
  2. <?php echo "<?xml version='1.0' encoding='UTF8' ?>";
  3. $host = "http://127.0.0.1/cgi-bin";
  4. ?>
  5. <rss version="2.0">
  6. <onEnter>
  7. startitem = "middle";
  8. setRefreshTime(1);
  9. </onEnter>
  10. <onRefresh>
  11. setRefreshTime(-1);
  12. itemCount = getPageInfo("itemCount");
  13. </onRefresh>
  14. <mediaDisplay name="threePartsView"
  15. sideLeftWidthPC="0"
  16. sideRightWidthPC="0"
  17. headerImageWidthPC="0"
  18. selectMenuOnRight="no"
  19. autoSelectMenu="no"
  20. autoSelectItem="no"
  21. itemImageHeightPC="0"
  22. itemImageWidthPC="0"
  23. itemXPC="8"
  24. itemYPC="25"
  25. itemWidthPC="30"
  26. itemHeightPC="8"
  27. capXPC="8"
  28. capYPC="25"
  29. capWidthPC="30"
  30. capHeightPC="64"
  31. itemBackgroundColor="0:0:0"
  32. itemPerPage="8"
  33. itemGap="0"
  34. bottomYPC="90"
  35. backgroundColor="0:0:0"
  36. showHeader="no"
  37. showDefaultInfo="no"
  38. imageFocus=""
  39. sliding="no"
  40. idleImageXPC="5" idleImageYPC="5" idleImageWidthPC="8" idleImageHeightPC="10"
  41. >
  42. <text align="center" offsetXPC="0" offsetYPC="0" widthPC="100" heightPC="20" fontSize="30" backgroundColor="10:105:150" foregroundColor="100:200:255">
  43. <script>getPageInfo("pageTitle");</script>
  44. </text>
  45. <text redraw="yes" offsetXPC="85" offsetYPC="12" widthPC="10" heightPC="6" fontSize="20" backgroundColor="10:105:150" foregroundColor="60:160:205">
  46. <script>sprintf("%s / ", focus-(-1))+itemCount;</script>
  47. </text>
  48. <text align="center" redraw="yes"
  49. lines="10" fontSize=17
  50. offsetXPC=55 offsetYPC=55 widthPC=40 heightPC=42
  51. backgroundColor=0:0:0 foregroundColor=200:200:200>
  52. <script>print(annotation); annotation;</script>
  53. </text>
  54. <image redraw="yes" offsetXPC=60 offsetYPC=25 widthPC=30 heightPC=20>
  55. /usr/local/etc/www/cgi-bin/scripts/clip/image/vplay.jpg
  56. </image>
  57. <idleImage>image/POPUP_LOADING_01.png</idleImage>
  58. <idleImage>image/POPUP_LOADING_02.png</idleImage>
  59. <idleImage>image/POPUP_LOADING_03.png</idleImage>
  60. <idleImage>image/POPUP_LOADING_04.png</idleImage>
  61. <idleImage>image/POPUP_LOADING_05.png</idleImage>
  62. <idleImage>image/POPUP_LOADING_06.png</idleImage>
  63. <idleImage>image/POPUP_LOADING_07.png</idleImage>
  64. <idleImage>image/POPUP_LOADING_08.png</idleImage>
  65. <itemDisplay>
  66. <text align="left" lines="1" offsetXPC=0 offsetYPC=0 widthPC=100 heightPC=100>
  67. <script>
  68. idx = getQueryItemIndex();
  69. focus = getFocusItemIndex();
  70. if(focus==idx)
  71. {
  72. location = getItemInfo(idx, "location");
  73. annotation = getItemInfo(idx, "annotation");
  74. }
  75. getItemInfo(idx, "title");
  76. </script>
  77. <fontSize>
  78. <script>
  79. idx = getQueryItemIndex();
  80. focus = getFocusItemIndex();
  81. if(focus==idx) "16"; else "14";
  82. </script>
  83. </fontSize>
  84. <backgroundColor>
  85. <script>
  86. idx = getQueryItemIndex();
  87. focus = getFocusItemIndex();
  88. if(focus==idx) "10:80:120"; else "-1:-1:-1";
  89. </script>
  90. </backgroundColor>
  91. <foregroundColor>
  92. <script>
  93. idx = getQueryItemIndex();
  94. focus = getFocusItemIndex();
  95. if(focus==idx) "255:255:255"; else "140:140:140";
  96. </script>
  97. </foregroundColor>
  98. </text>
  99. </itemDisplay>
  100. <onUserInput>
  101. <script>
  102. ret = "false";
  103. userInput = currentUserInput();
  104. if (userInput == "pagedown" || userInput == "pageup")
  105. {
  106. idx = Integer(getFocusItemIndex());
  107. if (userInput == "pagedown")
  108. {
  109. idx -= -8;
  110. if(idx &gt;= itemCount)
  111. idx = itemCount-1;
  112. }
  113. else
  114. {
  115. idx -= 8;
  116. if(idx &lt; 0)
  117. idx = 0;
  118. }
  119. print("new idx: "+idx);
  120. setFocusItemIndex(idx);
  121. setItemFocus(0);
  122. redrawDisplay();
  123. "true";
  124. }
  125. ret;
  126. </script>
  127. </onUserInput>
  128. </mediaDisplay>
  129. <item_template>
  130. <mediaDisplay name="threePartsView" idleImageXPC="5" idleImageYPC="5" idleImageWidthPC="8" idleImageHeightPC="10">
  131. <idleImage>image/POPUP_LOADING_01.png</idleImage>
  132. <idleImage>image/POPUP_LOADING_02.png</idleImage>
  133. <idleImage>image/POPUP_LOADING_03.png</idleImage>
  134. <idleImage>image/POPUP_LOADING_04.png</idleImage>
  135. <idleImage>image/POPUP_LOADING_05.png</idleImage>
  136. <idleImage>image/POPUP_LOADING_06.png</idleImage>
  137. <idleImage>image/POPUP_LOADING_07.png</idleImage>
  138. <idleImage>image/POPUP_LOADING_08.png</idleImage>
  139. </mediaDisplay>
  140. </item_template>
  141. <searchLink>
  142. <link>
  143. <script>"<?php echo $host."/scripts/filme/php/vplay_search.php?query="; ?>" + urlEncode(keyword);</script>
  144. </link>
  145. </searchLink>
  146. <channel>
  147. <title>vplay - seriale</title>
  148. <menu>main menu</menu>
  149. <?php
  150. function str_between($string, $start, $end){
  151. $string = " ".$string; $ini = strpos($string,$start);
  152. if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini;
  153. return substr($string,$ini,$len);
  154. }
  155. //necesita inregistrare pe site
  156. //vplay.txt are o singura linie de forma
  157. //username@pass
  158. $filename = "/usr/local/etc/dvdplayer/vplay.txt";
  159. $cookie="D://vplay_c.txt";
  160. $cookie="/tmp/vplay_c.txt";
  161. if (file_exists($filename)) {
  162. $handle = fopen($filename, "r");
  163. $c = fread($handle, filesize($filename));
  164. fclose($handle);
  165. $a=explode("@",$c);
  166. $user=$a[0];
  167. $pass=trim($a[1]);
  168. if (!file_exists($cookie)) {
  169. $l="http://vplay.ro/in";
  170. $post="usr_vplay=".$user."&pwd=".$pass."&rbm=1";
  171. $ch = curl_init();
  172. curl_setopt($ch, CURLOPT_URL, $l);
  173. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  174. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
  175. curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
  176. curl_setopt($ch,CURLOPT_REFERER,"http://vplay.ro/login/");
  177. curl_setopt ($ch, CURLOPT_POST, 1);
  178. curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);
  179. curl_setopt($ch, CURLOPT_COOKIEJAR, $cookie);
  180. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
  181. $html = curl_exec($ch);
  182. curl_close($ch);
  183. }
  184. }
  185. $link="http://vplay.ro/coll/";
  186. $ch = curl_init();
  187. curl_setopt($ch, CURLOPT_URL, $link);
  188. curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
  189. curl_setopt($ch, CURLOPT_USERAGENT, 'Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.2) Gecko/20090729 Firefox/3.5.2 GTB5');
  190. curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
  191. curl_setopt($ch, CURLOPT_COOKIEFILE, $cookie);
  192. $html = curl_exec($ch);
  193. curl_close($ch);
  194. $html1 = str_between($html,"<h2>Colec","</ul>");
  195. if ($html1 <> "") {
  196. echo '
  197. <item>
  198. <title>Lista ta de favorite</title>
  199. <link>'.$host.'/scripts/filme/php/vplay_fav.php</link>
  200. <annotation>Lista ta de favorite</annotation>
  201. <mediaDisplay name="threePartsView"/>
  202. </item>
  203. ';
  204. echo '
  205. <item>
  206. <title>Cele mai urm?rite de tine</title>
  207. <link>'.$host.'/scripts/filme/php/vplay_main1.php</link>
  208. <annotation>Cele mai urm?rite de tine</annotation>
  209. <mediaDisplay name="threePartsView"/>
  210. </item>
  211. ';
  212. echo '
  213. <item>
  214. <title>C?utare serial</title>
  215. <annotation>C?utare serial</annotation>
  216. <onClick>
  217. keyword = getInput();
  218. if (keyword != null)
  219. {
  220. jumpToLink("searchLink");
  221. }
  222. </onClick>
  223. </item>
  224. ';
  225. }
  226. $videos = explode('option value="', $html);
  227. unset($videos[0]);
  228. $videos = array_values($videos);
  229. $n=0;
  230. foreach($videos as $video) {
  231. $t1=explode('"',$video);
  232. $l=$t1[0];
  233. if ($l == "")
  234. $link="http://vplay.ro/coll/";
  235. else
  236. $link="http://vplay.ro/coll/g/".$l."/";
  237. $t1=explode(">",$video);
  238. $t2=explode("<",$t1[1]);
  239. $title=$t2[0];
  240. if ($title=="-----") $title="Toate";
  241. $n++;
  242. echo '
  243. <item>
  244. <title>'.$title.'</title>
  245. <link>'.$host.'/scripts/filme/php/vplay_main.php?query=1,'.$link.','.urlencode($title).'</link>
  246. <annotation>'.$title.'</annotation>
  247. <mediaDisplay name="threePartsView"/>
  248. </item>
  249. ';
  250. }
  251. if ($n==0) {
  252. $link = "/usr/local/etc/www/cgi-bin/scripts/filme/php/vplay.rss";
  253. $description="Pentru a accesa acest site trebuie s? ave?i un cont pe vplay.ro (este gratis). Completa?i userul ?i parola în acest formular ?i apoi ap?sa?i Return, Return dup? care accesa?i din nou aceast? pagin?. Dac? userul ?i parola sunt corecte ve?i vedea lista serialelor.";
  254. echo '
  255. <item>
  256. <title>Logare</title>
  257. <link>'.$link.'</link>
  258. <annotation>'.$description.'</annotation>
  259. <mediaDisplay name="onePartView" />
  260. </item>
  261. ';
  262. }
  263. ?>
  264. </channel>
  265. </rss>