PageRenderTime 43ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/clip/php/cancan.php

https://code.google.com/p/hdforall/
PHP | 292 lines | 270 code | 18 blank | 4 comment | 32 complexity | 0c59b5d836ff71a6c13a556bb6f91197 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. $query = $_GET["query"];
  5. if($query) {
  6. $queryArr = explode(',', $query);
  7. $page = $queryArr[0];
  8. $search = $queryArr[1];
  9. }
  10. ?>
  11. <rss version="2.0">
  12. <onEnter>
  13. startitem = "middle";
  14. setRefreshTime(1);
  15. </onEnter>
  16. <onRefresh>
  17. setRefreshTime(-1);
  18. itemCount = getPageInfo("itemCount");
  19. </onRefresh>
  20. <mediaDisplay name="threePartsView"
  21. sideLeftWidthPC="0"
  22. sideRightWidthPC="0"
  23. headerImageWidthPC="0"
  24. selectMenuOnRight="no"
  25. autoSelectMenu="no"
  26. autoSelectItem="no"
  27. itemImageHeightPC="0"
  28. itemImageWidthPC="0"
  29. itemXPC="8"
  30. itemYPC="25"
  31. itemWidthPC="45"
  32. itemHeightPC="8"
  33. capXPC="8"
  34. capYPC="25"
  35. capWidthPC="45"
  36. capHeightPC="64"
  37. itemBackgroundColor="0:0:0"
  38. itemPerPage="8"
  39. itemGap="0"
  40. bottomYPC="90"
  41. backgroundColor="0:0:0"
  42. showHeader="no"
  43. showDefaultInfo="no"
  44. imageFocus=""
  45. sliding="no"
  46. >
  47. <text align="center" offsetXPC="0" offsetYPC="0" widthPC="100" heightPC="20" fontSize="30" backgroundColor="10:105:150" foregroundColor="100:200:255">
  48. <script>getPageInfo("pageTitle");</script>
  49. </text>
  50. <text align="left" offsetXPC="6" offsetYPC="15" widthPC="100" heightPC="4" fontSize="16" backgroundColor="10:105:150" foregroundColor="100:200:255">
  51. Apasati 2 pentru download, 3 pentru download manager
  52. </text>
  53. <text redraw="yes" offsetXPC="85" offsetYPC="12" widthPC="10" heightPC="6" fontSize="20" backgroundColor="10:105:150" foregroundColor="60:160:205">
  54. <script>sprintf("%s / ", focus-(-1))+itemCount;</script>
  55. </text>
  56. <text align="justify" redraw="yes"
  57. lines="8" fontSize=17
  58. offsetXPC=55 offsetYPC=58 widthPC=40 heightPC=38
  59. backgroundColor=0:0:0 foregroundColor=200:200:200>
  60. <script>print(annotation); annotation;</script>
  61. </text>
  62. <text redraw="yes" align="center" offsetXPC="60" offsetYPC="52" widthPC="30" heightPC="5" fontSize="17" backgroundColor="10:105:150" foregroundColor="100:200:255">
  63. <script>print(durata); durata;</script>
  64. </text>
  65. <text redraw="yes" align="center" offsetXPC="0" offsetYPC="90" widthPC="100" heightPC="8" fontSize="17" backgroundColor="10:105:150" foregroundColor="100:200:255">
  66. <script>print(titlu); titlu;</script>
  67. </text>
  68. <image redraw="yes" offsetXPC=60 offsetYPC=25 widthPC=30 heightPC=25>
  69. <script>print(img); img;</script>
  70. </image>
  71. <idleImage> image/POPUP_LOADING_01.png </idleImage>
  72. <idleImage> image/POPUP_LOADING_02.png </idleImage>
  73. <idleImage> image/POPUP_LOADING_03.png </idleImage>
  74. <idleImage> image/POPUP_LOADING_04.png </idleImage>
  75. <idleImage> image/POPUP_LOADING_05.png </idleImage>
  76. <idleImage> image/POPUP_LOADING_06.png </idleImage>
  77. <idleImage> image/POPUP_LOADING_07.png </idleImage>
  78. <idleImage> image/POPUP_LOADING_08.png </idleImage>
  79. <itemDisplay>
  80. <text align="left" lines="1" offsetXPC=0 offsetYPC=0 widthPC=100 heightPC=100>
  81. <script>
  82. idx = getQueryItemIndex();
  83. focus = getFocusItemIndex();
  84. if(focus==idx)
  85. {
  86. img = getItemInfo(idx,"image");
  87. annotation = getItemInfo(idx, "annotation");
  88. durata = getItemInfo(idx, "durata");
  89. pub = getItemInfo(idx, "pub");
  90. titlu = getItemInfo(idx, "title");
  91. }
  92. getItemInfo(idx, "title");
  93. </script>
  94. <fontSize>
  95. <script>
  96. idx = getQueryItemIndex();
  97. focus = getFocusItemIndex();
  98. if(focus==idx) "16"; else "14";
  99. </script>
  100. </fontSize>
  101. <backgroundColor>
  102. <script>
  103. idx = getQueryItemIndex();
  104. focus = getFocusItemIndex();
  105. if(focus==idx) "10:80:120"; else "-1:-1:-1";
  106. </script>
  107. </backgroundColor>
  108. <foregroundColor>
  109. <script>
  110. idx = getQueryItemIndex();
  111. focus = getFocusItemIndex();
  112. if(focus==idx) "255:255:255"; else "140:140:140";
  113. </script>
  114. </foregroundColor>
  115. </text>
  116. </itemDisplay>
  117. <onUserInput>
  118. <script>
  119. ret = "false";
  120. userInput = currentUserInput();
  121. if (userInput == "pagedown" || userInput == "pageup")
  122. {
  123. idx = Integer(getFocusItemIndex());
  124. if (userInput == "pagedown")
  125. {
  126. idx -= -8;
  127. if(idx &gt;= itemCount)
  128. idx = itemCount-1;
  129. }
  130. else
  131. {
  132. idx -= 8;
  133. if(idx &lt; 0)
  134. idx = 0;
  135. }
  136. print("new idx: "+idx);
  137. setFocusItemIndex(idx);
  138. setItemFocus(0);
  139. redrawDisplay();
  140. "true";
  141. }
  142. if (userInput == "two" || userInput == "2")
  143. {
  144. showIdle();
  145. url="<?php echo $host; ?>" + "/scripts/clip/php/cancan_link.php?file=" + getItemInfo(getFocusItemIndex(),"download");
  146. movie=getUrl(url);
  147. cancelIdle();
  148. topUrl = "http://127.0.0.1/cgi-bin/scripts/util/download.cgi?link=" + movie + ";name=" + getItemInfo(getFocusItemIndex(),"name");
  149. dlok = loadXMLFile(topUrl);
  150. "true";
  151. }
  152. if (userInput == "three" || userInput == "3")
  153. {
  154. jumpToLink("destination");
  155. "true";
  156. }
  157. ret;
  158. </script>
  159. </onUserInput>
  160. </mediaDisplay>
  161. <item_template>
  162. <mediaDisplay name="threePartsView" idleImageXPC="5" idleImageYPC="5" idleImageWidthPC="8" idleImageHeightPC="10">
  163. <idleImage>image/POPUP_LOADING_01.png</idleImage>
  164. <idleImage>image/POPUP_LOADING_02.png</idleImage>
  165. <idleImage>image/POPUP_LOADING_03.png</idleImage>
  166. <idleImage>image/POPUP_LOADING_04.png</idleImage>
  167. <idleImage>image/POPUP_LOADING_05.png</idleImage>
  168. <idleImage>image/POPUP_LOADING_06.png</idleImage>
  169. <idleImage>image/POPUP_LOADING_07.png</idleImage>
  170. <idleImage>image/POPUP_LOADING_08.png</idleImage>
  171. </mediaDisplay>
  172. </item_template>
  173. <destination>
  174. <link>http://127.0.0.1/cgi-bin/scripts/util/level.php
  175. </link>
  176. </destination>
  177. <channel>
  178. <title>www.cancan.ro</title>
  179. <menu>main menu</menu>
  180. <?php
  181. //http://www.cancan.ro/multimedia/video/exclusiv-16/pagina-1/
  182. //http://www.cancan.ro/multimedia/video/exclusiv-16/
  183. if($page) {
  184. $page1=$page-1;
  185. $html = file_get_contents("http://www.cancan.ro/multimedia/video/exclusiv-16/pagina-".$page1."/");
  186. } else {
  187. $page = 1;
  188. $html = file_get_contents("http://www.cancan.ro/multimedia/video/exclusiv-16/");
  189. }
  190. if($page > 1) { ?>
  191. <item>
  192. <?php
  193. $sThisFile = 'http://127.0.0.1'.$_SERVER['SCRIPT_NAME'];
  194. $url = $sThisFile."?query=".($page-1).",";
  195. if($search) {
  196. $url = $url.$search;
  197. }
  198. ?>
  199. <title>Previous Page</title>
  200. <link><?php echo $url;?></link>
  201. <annotation>Pagina anterioara</annotation>
  202. <image>image/left.jpg</image>
  203. <mediaDisplay name="threePartsView"/>
  204. </item>
  205. <?php } ?>
  206. <?php
  207. function str_between($string, $start, $end){
  208. $string = " ".$string; $ini = strpos($string,$start);
  209. if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini;
  210. return substr($string,$ini,$len);
  211. }
  212. $t1=explode('<div class="all_galeries">',$html);
  213. $html=$t1[1];
  214. $videos = explode('<div class="item"', $html);
  215. unset($videos[0]);
  216. $videos = array_values($videos);
  217. foreach($videos as $video) {
  218. $t1 = explode('change_main_galery(', $video);
  219. $t2 = explode(',', $t1[1]);
  220. $link1 = $t2[0];
  221. $link = "http://www.cancan.ro/config/video/".$link1.".xml";
  222. $t1 = explode("src='", $video);
  223. $t2 = explode("'", $t1[1]);
  224. $image = "http://www.cancan.ro".$t2[0];
  225. $t1 = explode('class="titlu">', $video);
  226. $t2 = explode('>',$t1[1]);
  227. $t3 = explode('<', $t2[1]);
  228. $title = $t3[0];
  229. $t1=explode('class="info">',$video);
  230. $t2=explode('</div>',$t1[1]);
  231. $durata = preg_replace("/(<\/?)(\w+)([^>]*>)/e","",$t2[0]);
  232. $descriere = $title;
  233. $name = preg_replace('/[^A-Za-z0-9_]/','_',$title).".flv";
  234. if ($link1 <> "") {
  235. //$link = $host."/scripts/clip/php/cancan_link.php?file=".$link;
  236. echo '
  237. <item>
  238. <title>'.$title.'</title>
  239. <onClick>
  240. <script>
  241. showIdle();
  242. url="'.$host.'/scripts/clip/php/cancan_link.php?file='.$link.'";
  243. movie=getUrl(url);
  244. cancelIdle();
  245. playItemUrl(movie,10);
  246. </script>
  247. </onClick>
  248. <download>'.$link.'</download>
  249. <name>'.$name.'</name>
  250. <annotation>'.$descriere.'</annotation>
  251. <image>'.$image.'</image>
  252. <durata>'.$durata.'</durata>
  253. <media:thumbnail url="'.$image.'" />
  254. </item>
  255. ';
  256. }
  257. }
  258. ?>
  259. <item>
  260. <?php
  261. $sThisFile = 'http://127.0.0.1'.$_SERVER['SCRIPT_NAME'];
  262. $url = $sThisFile."?query=".($page+1).",";
  263. if($search) {
  264. $url = $url.$search;
  265. }
  266. ?>
  267. <title>Next Page</title>
  268. <link><?php echo $url;?></link>
  269. <annotation>Pagina urmatoare</annotation>
  270. <image>image/right.jpg</image>
  271. <mediaDisplay name="threePartsView"/>
  272. </item>
  273. </channel>
  274. </rss>