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