PageRenderTime 31ms CodeModel.GetById 19ms app.highlight 3ms RepoModel.GetById 2ms app.codeStats 0ms

/trailer/php/cinemarx.php

https://code.google.com/p/hdforall/
PHP | 269 lines | 238 code | 29 blank | 2 comment | 27 complexity | f7041f66c1fe9ccc7415f93c58ef2d18 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="50"
 29	itemHeightPC="8"
 30	capXPC="8"
 31	capYPC="25"
 32	capWidthPC="50"
 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" idleImageXPC="5" idleImageYPC="5" idleImageWidthPC="8" idleImageHeightPC="10"
 43>
 44
 45  	<text align="center" offsetXPC="0" offsetYPC="0" widthPC="100" heightPC="20" fontSize="30" backgroundColor="10:105:150" foregroundColor="100:200:255">
 46		  <script>getPageInfo("pageTitle");</script>
 47		</text>
 48  	<text align="left" offsetXPC="6" offsetYPC="15" widthPC="100" heightPC="4" fontSize="16" backgroundColor="10:105:150" foregroundColor="100:200:255">
 49    Apasati 2 pentru download, 3 pentru download manager
 50		</text>
 51  	<text redraw="yes" offsetXPC="85" offsetYPC="12" widthPC="10" heightPC="6" fontSize="20" backgroundColor="10:105:150" foregroundColor="60:160:205">
 52		  <script>sprintf("%s / ", focus-(-1))+itemCount;</script>
 53		</text>
 54  	<text  redraw="yes" align="center" offsetXPC="0" offsetYPC="90" widthPC="100" heightPC="8" fontSize="17" backgroundColor="10:105:150" foregroundColor="100:200:255">
 55		  <script>print(annotation); annotation;</script>
 56		</text>
 57		<image  redraw="yes" offsetXPC=60 offsetYPC=35 widthPC=30 heightPC=30>
 58  <script>print(img); img;</script>
 59		</image>
 60        <idleImage>image/POPUP_LOADING_01.png</idleImage>
 61        <idleImage>image/POPUP_LOADING_02.png</idleImage>
 62        <idleImage>image/POPUP_LOADING_03.png</idleImage>
 63        <idleImage>image/POPUP_LOADING_04.png</idleImage>
 64        <idleImage>image/POPUP_LOADING_05.png</idleImage>
 65        <idleImage>image/POPUP_LOADING_06.png</idleImage>
 66        <idleImage>image/POPUP_LOADING_07.png</idleImage>
 67        <idleImage>image/POPUP_LOADING_08.png</idleImage>
 68
 69		<itemDisplay>
 70			<text align="left" lines="1" offsetXPC=0 offsetYPC=0 widthPC=100 heightPC=100>
 71				<script>
 72					idx = getQueryItemIndex();
 73					focus = getFocusItemIndex();
 74					if(focus==idx)
 75					{
 76                      img = getItemInfo(idx,"image");
 77					  annotation = getItemInfo(idx, "title");
 78					}
 79					getItemInfo(idx, "title");
 80				</script>
 81				<fontSize>
 82  				<script>
 83  					idx = getQueryItemIndex();
 84  					focus = getFocusItemIndex();
 85  			    if(focus==idx) "16"; else "14";
 86  				</script>
 87				</fontSize>
 88			  <backgroundColor>
 89  				<script>
 90  					idx = getQueryItemIndex();
 91  					focus = getFocusItemIndex();
 92  			    if(focus==idx) "10:80:120"; else "-1:-1:-1";
 93  				</script>
 94			  </backgroundColor>
 95			  <foregroundColor>
 96  				<script>
 97  					idx = getQueryItemIndex();
 98  					focus = getFocusItemIndex();
 99  			    if(focus==idx) "255:255:255"; else "140:140:140";
100  				</script>
101			  </foregroundColor>
102			</text>
103
104		</itemDisplay>
105
106<onUserInput>
107<script>
108ret = "false";
109userInput = currentUserInput();
110
111if (userInput == "pagedown" || userInput == "pageup")
112{
113  idx = Integer(getFocusItemIndex());
114  if (userInput == "pagedown")
115  {
116    idx -= -8;
117    if(idx &gt;= itemCount)
118      idx = itemCount-1;
119  }
120  else
121  {
122    idx -= 8;
123    if(idx &lt; 0)
124      idx = 0;
125  }
126
127  print("new idx: "+idx);
128  setFocusItemIndex(idx);
129	setItemFocus(0);
130  redrawDisplay();
131  "true";
132}
133if (userInput == "two" || userInput == "2")
134	{
135     showIdle();
136     url="<?php echo $host; ?>" + "/scripts/trailer/php/cinemarx_link.php?file=" + getItemInfo(getFocusItemIndex(),"download");
137     movie=getUrl(url);
138     cancelIdle();
139	 topUrl = "http://127.0.0.1/cgi-bin/scripts/util/download.cgi?link=" + movie + ";name=" + getItemInfo(getFocusItemIndex(),"name");
140	 dlok = loadXMLFile(topUrl);
141	 "true";
142}
143if (userInput == "three" || userInput == "3")
144   {
145    jumpToLink("destination");
146    "true";
147}
148ret;
149</script>
150</onUserInput>
151
152	</mediaDisplay>
153	<item_template>
154		<mediaDisplay  name="threePartsView" idleImageXPC="5" idleImageYPC="5" idleImageWidthPC="8" idleImageHeightPC="10">
155        <idleImage>image/POPUP_LOADING_01.png</idleImage>
156        <idleImage>image/POPUP_LOADING_02.png</idleImage>
157        <idleImage>image/POPUP_LOADING_03.png</idleImage>
158        <idleImage>image/POPUP_LOADING_04.png</idleImage>
159        <idleImage>image/POPUP_LOADING_05.png</idleImage>
160        <idleImage>image/POPUP_LOADING_06.png</idleImage>
161        <idleImage>image/POPUP_LOADING_07.png</idleImage>
162        <idleImage>image/POPUP_LOADING_08.png</idleImage>
163		</mediaDisplay>
164
165	</item_template>
166<destination>
167	<link>http://127.0.0.1/cgi-bin/scripts/util/level.php
168	</link>
169</destination>
170<channel>
171	<title>www.cinemarx.ro</title>
172	<menu>main menu</menu>
173
174
175<?php
176$query = $_GET["query"];
177if($query) {
178   $queryArr = explode(',', $query);
179   $page = $queryArr[0];
180   $search = $queryArr[1];
181}
182$host = "http://127.0.0.1/cgi-bin";
183if($page) {
184        $html = file_get_contents("http://www.cinemarx.ro/trailere/cele-mai-recente/".$page."/");
185    }
186else {
187    $page = 1;
188        $html = file_get_contents("http://www.cinemarx.ro/trailere/cele-mai-recente/1/");
189    }
190
191
192if($page > 1) { ?>
193
194<item>
195<?php
196$sThisFile = 'http://127.0.0.1'.$_SERVER['SCRIPT_NAME'];
197$url = $sThisFile."?query=".($page-1).",";
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
206
207<?php } ?>
208
209<?php
210
211$videos = explode('<li class="image">', $html);
212
213unset($videos[0]);
214$videos = array_values($videos);
215$baseurl = "http://127.0.0.1/cgi-bin/translate?stream,Content-type:video/x-flv,";
216foreach($videos as $video) {
217    $t1 = explode('<a href="', $video);
218    $t2 = explode('"', $t1[1]);
219    $link = 'http://www.cinemarx.ro'.$t2[0];
220
221    $t1 = explode(' title="', $video);
222    $t2 = explode('"', $t1[1]);
223    $title = $t2[0];
224    
225    $t1 = explode(' src="', $video);
226    $t2 = explode('"', $t1[1]);
227    $image = $t2[0];
228    
229    //$link = $host."/scripts/trailer/php/cinemarx_link.php?file=".$link;
230    $name = preg_replace('/[^A-Za-z0-9_]/','_',$title).".flv";
231
232    echo '
233    <item>
234    <title>'.$title.'</title>
235    <onClick>
236    <script>
237    showIdle();
238    url="'.$host.'/scripts/trailer/php/cinemarx_link.php?file='.$link.'";
239    movie=getUrl(url);
240    movie1="'.$baseurl.'" + movie;
241    cancelIdle();
242    playItemUrl(movie1,10);
243    </script>
244    </onClick>
245    <download>'.$link.'</download>
246    <name>'.$name.'</name>
247    <image>'.$image.'</image>
248    <media:thumbnail url="'.$image.'" />
249    </item>
250    ';
251}
252
253
254?>
255
256<item>
257<?php
258$sThisFile = 'http://127.0.0.1'.$_SERVER['SCRIPT_NAME'];
259$url = $sThisFile."?query=".($page+1).",";
260?>
261<title>Next Page</title>
262<link><?php echo $url;?></link>
263<annotation>Pagina urmatoare</annotation>
264<image>image/right.jpg</image>
265<mediaDisplay name="threePartsView"/>
266</item>
267
268</channel>
269</rss>