/clip/php/almanahe.php
PHP | 319 lines | 295 code | 22 blank | 2 comment | 31 complexity | 0ba0fa0d9582b5d011e25d38f96dedda MD5 | raw file
- #!/usr/local/bin/Resource/www/cgi-bin/php
- <?php echo "<?xml version='1.0' encoding='UTF8' ?>";
- $host = "http://127.0.0.1/cgi-bin";
- $query = $_GET["query"];
- if($query) {
- $queryArr = explode(',', $query);
- $page = $queryArr[0];
- $search = urldecode($queryArr[1]);
- $tit = urldecode($queryArr[2]);
- }
- clearstatcache();
- if (file_exists("/tmp/usbmounts/sda1/download")) {
- $dir = "/tmp/usbmounts/sda1/download/log/";
- } elseif (file_exists("/tmp/usbmounts/sdb1/download")) {
- $dir = "/tmp/usbmounts/sdb1/download/log/";
- } elseif (file_exists("/tmp/usbmounts/sdc1/download")) {
- $dir = "/tmp/usbmounts/sdc1/download/log/";
- } elseif (file_exists("/tmp/usbmounts/sda2/download")) {
- $dir = "/tmp/usbmounts/sda2/download/log/";
- } elseif (file_exists("/tmp/usbmounts/sdb2/download")) {
- $dir = "/tmp/usbmounts/sdb2/download/log/";
- } elseif (file_exists("/tmp/usbmounts/sdc2/download")) {
- $dir = "/tmp/usbmounts/sdc1/download/log/";
- } elseif (file_exists("/tmp/hdd/volumes/HDD1/download")) {
- $dir = "/tmp/hdd/root/log/";
- } else {
- $dir = "";
- }
- ?>
- <rss version="2.0">
- <onEnter>
- startitem = "middle";
- setRefreshTime(1);
- </onEnter>
- <onRefresh>
- setRefreshTime(-1);
- itemCount = getPageInfo("itemCount");
- </onRefresh>
- <mediaDisplay name="threePartsView"
- sideLeftWidthPC="0"
- sideRightWidthPC="0"
- headerImageWidthPC="0"
- selectMenuOnRight="no"
- autoSelectMenu="no"
- autoSelectItem="no"
- itemImageHeightPC="0"
- itemImageWidthPC="0"
- itemXPC="8"
- itemYPC="25"
- itemWidthPC="45"
- itemHeightPC="8"
- capXPC="8"
- capYPC="25"
- capWidthPC="45"
- capHeightPC="64"
- itemBackgroundColor="0:0:0"
- itemPerPage="8"
- itemGap="0"
- bottomYPC="90"
- backgroundColor="0:0:0"
- showHeader="no"
- showDefaultInfo="no"
- imageFocus=""
- sliding="no"
- >
- <text align="center" offsetXPC="0" offsetYPC="0" widthPC="100" heightPC="20" fontSize="30" backgroundColor="10:105:150" foregroundColor="100:200:255">
- <script>getPageInfo("pageTitle");</script>
- </text>
- <text align="left" offsetXPC="6" offsetYPC="15" widthPC="100" heightPC="4" fontSize="16" backgroundColor="10:105:150" foregroundColor="100:200:255">
- Ap??a??i 2 pentru download, 3 pentru Download Manager
- </text>
- <text redraw="yes" offsetXPC="85" offsetYPC="12" widthPC="10" heightPC="6" fontSize="20" backgroundColor="10:105:150" foregroundColor="60:160:205">
- <script>sprintf("%s / ", focus-(-1))+itemCount;</script>
- </text>
- <text align="center" redraw="yes"
- lines="8" fontSize=17
- offsetXPC=55 offsetYPC=58 widthPC=40 heightPC=38
- backgroundColor=0:0:0 foregroundColor=200:200:200>
- <script>print(annotation); annotation;</script>
- </text>
- <text redraw="yes" align="center" offsetXPC="55" offsetYPC="52" widthPC="15" heightPC="5" fontSize="17" backgroundColor="10:105:150" foregroundColor="100:200:255">
- <script>print(durata); durata;</script>
- </text>
- <text redraw="yes" align="left" offsetXPC="72" offsetYPC="52" widthPC="30" heightPC="5" fontSize="17" backgroundColor="10:105:150" foregroundColor="100:200:255">
- <script>print(pub); pub;</script>
- </text>
- <text redraw="yes" align="center" offsetXPC="0" offsetYPC="90" widthPC="100" heightPC="8" fontSize="17" backgroundColor="10:105:150" foregroundColor="100:200:255">
- <script>print(titlu); titlu;</script>
- </text>
- <image redraw="yes" offsetXPC=60 offsetYPC=25 widthPC=30 heightPC=25>
- <script>print(img); img;</script>
- </image>
- <idleImage> image/POPUP_LOADING_01.png </idleImage>
- <idleImage> image/POPUP_LOADING_02.png </idleImage>
- <idleImage> image/POPUP_LOADING_03.png </idleImage>
- <idleImage> image/POPUP_LOADING_04.png </idleImage>
- <idleImage> image/POPUP_LOADING_05.png </idleImage>
- <idleImage> image/POPUP_LOADING_06.png </idleImage>
- <idleImage> image/POPUP_LOADING_07.png </idleImage>
- <idleImage> image/POPUP_LOADING_08.png </idleImage>
- <itemDisplay>
- <text align="left" lines="1" offsetXPC=0 offsetYPC=0 widthPC=100 heightPC=100>
- <script>
- idx = getQueryItemIndex();
- focus = getFocusItemIndex();
- if(focus==idx)
- {
- img = getItemInfo(idx,"image");
- annotation = getItemInfo(idx, "annotation");
- durata = getItemInfo(idx, "durata");
- pub = getItemInfo(idx, "pub");
- titlu = getItemInfo(idx, "title");
- }
- getItemInfo(idx, "title");
- </script>
- <fontSize>
- <script>
- idx = getQueryItemIndex();
- focus = getFocusItemIndex();
- if(focus==idx) "16"; else "14";
- </script>
- </fontSize>
- <backgroundColor>
- <script>
- idx = getQueryItemIndex();
- focus = getFocusItemIndex();
- if(focus==idx) "10:80:120"; else "-1:-1:-1";
- </script>
- </backgroundColor>
- <foregroundColor>
- <script>
- idx = getQueryItemIndex();
- focus = getFocusItemIndex();
- if(focus==idx) "255:255:255"; else "140:140:140";
- </script>
- </foregroundColor>
- </text>
- </itemDisplay>
- <onUserInput>
- <script>
- ret = "false";
- userInput = currentUserInput();
- if (userInput == "pagedown" || userInput == "pageup")
- {
- idx = Integer(getFocusItemIndex());
- if (userInput == "pagedown")
- {
- idx -= -8;
- if(idx >= itemCount)
- idx = itemCount-1;
- }
- else
- {
- idx -= 8;
- if(idx < 0)
- idx = 0;
- }
- print("new idx: "+idx);
- setFocusItemIndex(idx);
- setItemFocus(0);
- redrawDisplay();
- "true";
- }
- if (userInput == "two" || userInput == "2")
- {
- showIdle();
- url="<?php echo $host; ?>" + "/scripts/clip/php/almanahe_link.php?file=" + getItemInfo(getFocusItemIndex(),"download");
- movie=getUrl(url);
- cancelIdle();
- topUrl = "http://127.0.0.1/cgi-bin/scripts/util/download.cgi?link=" + movie + ";name=" + getItemInfo(getFocusItemIndex(),"name");
- dlok = loadXMLFile(topUrl);
- "true";
- }
- if (userInput == "three" || userInput == "3")
- {
- jumpToLink("destination");
- "true";
- }
- ret;
- </script>
- </onUserInput>
- </mediaDisplay>
- <item_template>
- <mediaDisplay name="threePartsView" idleImageXPC="5" idleImageYPC="5" idleImageWidthPC="8" idleImageHeightPC="10">
- <idleImage>image/POPUP_LOADING_01.png</idleImage>
- <idleImage>image/POPUP_LOADING_02.png</idleImage>
- <idleImage>image/POPUP_LOADING_03.png</idleImage>
- <idleImage>image/POPUP_LOADING_04.png</idleImage>
- <idleImage>image/POPUP_LOADING_05.png</idleImage>
- <idleImage>image/POPUP_LOADING_06.png</idleImage>
- <idleImage>image/POPUP_LOADING_07.png</idleImage>
- <idleImage>image/POPUP_LOADING_08.png</idleImage>
- </mediaDisplay>
- </item_template>
- <destination>
- <link>http://127.0.0.1/cgi-bin/scripts/util/level.php
- </link>
- </destination>
- <channel>
- <title><?php echo $tit; ?></title>
- <menu>main menu</menu>
- <?php
- $page1=20*($page-1);
- //http://www.almanahe.ro/video/videolist/videonew.html?cid=8
- $t1=explode("cid=",$search);
- $cid=$t1[1];
- $post="advanceFromSubmission=1&album_id=&cid=".$cid."&sid=&tags=&user_id=0&action_new=&thumb=yes&keyword=&video_language=&run_length=&video_owner=&video_country=&added_within=&start=".$page1."&advanceFromSubmission=&pg=videonew&video_title=&myvideo=No&myfavoritevideo=No&default=Yes&advanced_keyword=Cuvinte+cheie&search_video_owner=+Nume+utilizator&video_country=&video_language=&run_length=&added_within=";
- $ch = curl_init($search);
- curl_setopt($ch, CURLOPT_FOLLOWLOCATION ,1);
- curl_setopt($ch, CURLOPT_REFERER, $search);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER ,1); // RETURN THE CONTENTS OF THE CALL
- curl_setopt ($ch, CURLOPT_POST, 1);
- curl_setopt ($ch, CURLOPT_POSTFIELDS, $post);
- $html = curl_exec($ch);
- if($page > 1) { ?>
- <item>
- <?php
- $sThisFile = 'http://127.0.0.1'.$_SERVER['SCRIPT_NAME'];
- $url = $sThisFile."?query=".($page-1).",";
- if($search) {
- $url = $url.$search.",".urlencode($tit);
- }
- ?>
- <title>Previous Page</title>
- <link><?php echo $url;?></link>
- <annotation>Pagina anterioara</annotation>
- <image>image/left.jpg</image>
- <mediaDisplay name="threePartsView"/>
- </item>
- <?php } ?>
- <?php
- function str_between($string, $start, $end){
- $string = " ".$string; $ini = strpos($string,$start);
- if ($ini == 0) return ""; $ini += strlen($start); $len = strpos($string,$end,$ini) - $ini;
- return substr($string,$ini,$len);
- }
- $videos = explode('<div id="videolist_thumb', $html);
- unset($videos[0]);
- $videos = array_values($videos);
- foreach($videos as $video) {
- $t1 = explode('href="', $video);
- $t2 = explode('"', $t1[1]);
- $link = $t2[0];
- $t1 = explode('src="', $video);
- $t2 = explode('"', $t1[1]);
- $image = $t2[0];
- $t1 = explode('title="', $video);
- $t2 = explode('"', $t1[1]);
- $title = $t2[0];
-
- $t1=explode('<span class="clsRunTime">',$video);
- $t2=explode('</span>',$t1[1]);
- $durata=$t2[0];
-
- $t1=explode('<p>',$video);
- $t2=explode('</p>',$t1[3]);
- $pub = trim(preg_replace("/(<\/?)(\w+)([^>]*>)/e","",$t2[0]));
- $pub=str_replace(' ','',$pub);
- $name = preg_replace('/[^A-Za-z0-9_]/','_',$title).".flv";
- $descriere=$title;
- echo '
- <item>
- <title>'.$title.'</title>
- <onClick>
- <script>
- showIdle();
- url="'.$host.'/scripts/clip/php/almanahe_link.php?file='.$link.'";
- movie=getUrl(url);
- cancelIdle();
- playItemUrl(movie,10);
- </script>
- </onClick>
- <download>'.$link.'</download>
- <name>'.$name.'</name>
- <annotation>'.$descriere.'</annotation>
- <image>'.$image.'</image>
- <durata>'.$durata.'</durata>
- <pub>'.$pub.'</pub>
- <media:thumbnail url="'.$image.'" />
- </item>
- ';
- }
- ?>
- <item>
- <?php
- $sThisFile = 'http://127.0.0.1'.$_SERVER['SCRIPT_NAME'];
- $url = $sThisFile."?query=".($page+1).",";
- if($search) {
- $url = $url.$search.",".urlencode($tit);
- }
- ?>
- <title>Next Page</title>
- <link><?php echo $url;?></link>
- <annotation>Pagina urmatoare</annotation>
- <image>image/right.jpg</image>
- <mediaDisplay name="threePartsView"/>
- </item>
- </channel>
- </rss>