PageRenderTime 30ms CodeModel.GetById 18ms app.highlight 3ms RepoModel.GetById 1ms app.codeStats 1ms

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