From: <ara...@us...> - 2008-08-23 17:11:44
|
Revision: 239 http://easybox-mod.svn.sourceforge.net/easybox-mod/?rev=239&view=rev Author: aragornis Date: 2008-08-23 17:11:35 +0000 (Sat, 23 Aug 2008) Log Message: ----------- Suppression des icones pour les renvoyer sans majuscules Noms des icones mis en minuscule Le module wat devrait ?\195?\160 peu pres marcher : ?\195?\160 tester L'API photo remarche avec les fichiers locaux Modified Paths: -------------- trunk/http/_framework/lib/Photo.class.php trunk/http/_utilisateur/contentVLC trunk/http/http-vlc/player.html trunk/http/module/VOD/classes/player_proxy_wat.php trunk/http/module/_menu/menu.php Removed Paths: ------------- trunk/http/skin/mediacenter/icones/Ma Musique.gif trunk/http/skin/mediacenter/icones/MesFavoris.gif trunk/http/skin/mediacenter/icones/MesFichiers.gif trunk/http/skin/mediacenter/icones/MesSignets.gif trunk/http/skin/mediacenter/icones/MesVideos.gif trunk/http/skin/mediacenter/icones/VideosduWeb.gif Modified: trunk/http/_framework/lib/Photo.class.php =================================================================== --- trunk/http/_framework/lib/Photo.class.php 2008-08-23 16:44:30 UTC (rev 238) +++ trunk/http/_framework/lib/Photo.class.php 2008-08-23 17:11:35 UTC (rev 239) @@ -129,12 +129,17 @@ }else{ $RemoteDL = new RemoteDL($this->url); $RemoteDL->set_cache_time(0); - if($data = $RemoteDL->file_get_contents()){ + if(!($data = $RemoteDL->file_get_contents())){ + if(file_exists($this->url)){ + $data = file_get_contents($this->url); + } + } + + if($data){ $this->img = imagecreatefromstring($data); $this->width = imagesx($this->img); $this->height = imagesy($this->img); - $trans = imagecolortransparent($this->img); if($trans!=-1){ $this->couleur_fond = imagecolorsforindex($this->img,$trans); Modified: trunk/http/_utilisateur/contentVLC =================================================================== --- trunk/http/_utilisateur/contentVLC 2008-08-23 16:44:30 UTC (rev 238) +++ trunk/http/_utilisateur/contentVLC 2008-08-23 17:11:35 UTC (rev 239) @@ -19,15 +19,10 @@ - - - - - -|00:00:00|fake:|00:00:04|playing|C:\Program Files\Easyboxv3\http\skin\mediacenter\background\bg.png +|00:00:00|current_node_url|00:00:04|playing|current_node_name Modified: trunk/http/http-vlc/player.html =================================================================== --- trunk/http/http-vlc/player.html 2008-08-23 16:44:30 UTC (rev 238) +++ trunk/http/http-vlc/player.html 2008-08-23 17:11:35 UTC (rev 239) @@ -1,3 +1,3 @@ <vlc id="rpn" param1="vlc_stop" /> <vlc id="rpn" param1="playlist_empty" /> -<vlc id="rpn" param1="'fake: :fake-file=C:\\\\Program Files\\\\Easyboxv3\\\\http\\\\skin\\\\mediacenter\\\\background\\\\bg.png :fake-width=720 :fake-height=576 :fake-aspect-ratio=4:3 :fake-duration=4000 :sout=#transcode{acodec=mpga,ab=128,channels=2,samplerate=44100,vcodec=mp2v,vb=1024,fps=25.,soverlay=1}:duplicate{dst=std{access=udp,mux=ts,dst=212.27.38.253:1234}}' 'C:\\Program Files\\Easyboxv3\\http\\skin\\mediacenter\\background\\bg.png' playlist_add vlc_play" /> +<vlc id="rpn" param1="'fake: :fake-file=C:\\\\Program Files\\\\Easyboxv3\\\\http\\\\skin\\\\mediacenter\\\\background\\\\bg.png :fake-width=720 :fake-height=576 :fake-aspect-ratio=4:3 :fake-duration=4000 :sout=#transcode{acodec=mpga,ab=128,channels=2,samplerate=44100,vcodec=mp2v,vb=1024,fps=25.,soverlay=1}:duplicate{dst=display,dst=std{access=udp,mux=ts,dst=212.27.38.253:1234}}' 'C:\\Program Files\\Easyboxv3\\http\\skin\\mediacenter\\background\\bg.png' playlist_add vlc_play" /> Modified: trunk/http/module/VOD/classes/player_proxy_wat.php =================================================================== --- trunk/http/module/VOD/classes/player_proxy_wat.php 2008-08-23 16:44:30 UTC (rev 238) +++ trunk/http/module/VOD/classes/player_proxy_wat.php 2008-08-23 17:11:35 UTC (rev 239) @@ -1,8 +1,12 @@ <?php +$RACINE_REP = '../../'; +define('LIBRARIES_REP', $RACINE_REP.'/_framework/lib/'); +require_once(LIBRARIES_REP.'Ini.class.php'); +$ini_class = new INI(USER.'configuration.ini'); + set_time_limit(3600); -class Http -{ +class Http { /*Code de retour */ public $statusCode; /*Contenu renvoyé */ @@ -14,8 +18,7 @@ /*Timeout de réception d'un paquet */ public $httpTimeout = 5; - function __construct() - { + function __construct(){ } /*Requête Get @@ -24,8 +27,7 @@ @param string $queryString Chaîne contenant les paramètres \xC3 passer \xC3 la requête @return boolean Résultat de la requête (true = 200 OK) **/ - function get($url, $queryString = '', $sCookie = '') - { + function get($url, $queryString = '', $sCookie = ''){ return $this->request($url, 'GET', $queryString, $sCookie); } @@ -35,8 +37,7 @@ @param string $queryString Chaîne contenant les paramètres \xC3 passer \xC3 la requête @return boolean Résultat de la requête (true = 200 OK) **/ - function post($url, $queryString = '', $sCookie = '') - { + function post($url, $queryString = '', $sCookie = ''){ return $this->request($url, 'POST', $queryString, $sCookie); } @@ -47,42 +48,43 @@ @param string $requestType Type de la requête (GET/POST) @return boolean Résultat de la requête (true = 200 OK) **/ - function request($url, $requestType = 'GET', $queryString = '', $sCookie = '', $envoi=false) - { + function request($url, $requestType = 'GET', $queryString = '', $sCookie = '', $envoi=false){ + global $ini; $this->statusCode = 0; $this->htmlContents = ''; $this->httpHeaders = array('Set-Cookie' => array()); /*Explosion de l'URL */ $parsedUrl = parse_url($url); - if (!isset($parsedUrl['path']) || $parsedUrl['path'] === '') - { + if (!isset($parsedUrl['path']) || $parsedUrl['path'] === ''){ $parsedUrl['path'] = '/'; } /*Zut, on a passé une partie des infos dans l'url ! */ - if (isset($parsedUrl['query']) && $parsedUrl['query'] !== '') - { - if ($requestType === 'GET') - { - if ($queryString !== '') - { + if (isset($parsedUrl['query']) && $parsedUrl['query'] !== ''){ + if ($requestType === 'GET'){ + if ($queryString !== ''){ $queryString .= '&'; } $queryString .= $parsedUrl['query']; - } - else - { + }else{ $parsedUrl['path'] = $parsedUrl['path'].'?'.$parsedUrl['query']; } } + if($ini['explorateur']['proxy']){ + $fp = @fsockopen($ini['explorateur']['proxy'], $ini['explorateur']['proxyport'], $errno, $errstr, 50); + }else{ + $fp = @fsockopen($parsedUrl['host'], 80, $errno, $errstr, 5); + } - $fp = @fsockopen($parsedUrl['host'], 80, $errno, $errstr, 5); if (!$fp) return false; - if ($requestType === 'GET') - { - fputs($fp, "GET ".$parsedUrl['path'].($queryString != '' ? '?'.$queryString : '')." HTTP/1.1\r\nHost: ".$parsedUrl['host']."\r\n"); - if ($sCookie !== '') - { + if ($requestType === 'GET'){ + if($ini['explorateur']['proxy']){ + fputs($fp, "GET ".$url." HTTP/1.1\r\nHost: ".$parsedUrl['host']."\r\n"); + }else{ + fputs($fp, "GET ".$parsedUrl['path'].($queryString != '' ? '?'.$queryString : '')." HTTP/1.1\r\nHost: ".$parsedUrl['host']."\r\n"); + } + + if ($sCookie !== ''){ fputs($fp, "Cookie: $sCookie\r\n"); } fputs($fp, "Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8\r\n"); @@ -92,10 +94,12 @@ fputs($fp, "Accept-Encoding: gzip,deflate\r\n"); fputs($fp, "Keep-Alive: 300\r\n"); fputs($fp, "Connection: keep-alive\r\n\r\n"); - } - elseif ($requestType === 'POST') - { - fputs($fp, "POST ".$parsedUrl['path']." HTTP/1.1\r\nHost: ".$parsedUrl['host']."\r\n"); + }elseif ($requestType === 'POST'){ + if($ini['explorateur']['proxy']){ + fputs($fp, "POST ".$url." HTTP/1.1\r\nHost: ".$parsedUrl['host']."\r\n"); + }else{ + fputs($fp, "POST ".$parsedUrl['path']." HTTP/1.1\r\nHost: ".$parsedUrl['host']."\r\n"); + } if ($sCookie !== '') { fputs($fp, "Cookie: $sCookie\r\n"); @@ -106,46 +110,39 @@ fputs($fp, "Accept-Encoding: gzip,deflate"); fputs($fp, "Connection: close\r\n\r\n"); fputs($fp, $queryString); - } - else - { + }else{ return false; } $buffer = ''; /*Time out de lecture */ - //stream_set_timeout($fp, 5); + stream_set_timeout($fp, 1000); /*Lecture des headers */ - while (!feof($fp)) - { + while (!feof($fp)){ $buffer = fgets($fp, 4096); - if ($buffer === false) - { + if ($buffer === false){ return false; } $buffer = trim($buffer); - if($envoi) - header($buffer); - if (substr($buffer, 0, 7) === 'HTTP/1.') - { - $this->statusCode = (int) substr($buffer, 9, 3); + file_put_contents('debug.txt',file_get_contents('debug.txt')."\n".$buffer); + + if($envoi){ + header('HTTP/1.0 200 OK'); + header('Content-Type: video/x-flv'); + header('Accept-Ranges: bytes'); } - else - { + if (substr($buffer, 0, 7) === 'HTTP/1.'){ + $this->statusCode = (int) substr($buffer, 9, 3); + }else{ $colonPos = strpos($buffer, ':'); - if ($colonPos !== false) - { + if ($colonPos !== false){ $headerName = substr($buffer, 0, $colonPos); - if ($headerName === 'Set-Cookie') - { + if ($headerName === 'Set-Cookie'){ $this->httpHeaders[$headerName][] = substr($buffer, $colonPos + 2); - } - else - { - + }else{ $this->httpHeaders[$headerName] = substr($buffer, $colonPos + 2); } } @@ -154,23 +151,17 @@ } /*Redirection 301 ou 302 */ - if (($this->statusCode === 302 || $this->statusCode === 301) && isset($this->httpHeaders['Location']) && $this->maxRedirects-- > 0) - { + if (($this->statusCode === 302 || $this->statusCode === 301) && isset($this->httpHeaders['Location']) && $this->maxRedirects-- > 0){ $newUrl = parse_url($this->httpHeaders['Location']); - if (!isset($newUrl['path'])) - { + if (!isset($newUrl['path'])){ $newUrl['path'] = ''; - } - else - { + }else{ $newUrl['path'] = ltrim($newUrl['path'], '/'); } - if (!isset($newUrl['host'])) - { + if (!isset($newUrl['host'])){ $newUrl['host'] = $parsedUrl['host']; } - if (!isset($newUrl['query'])) - { + if (!isset($newUrl['query'])){ $newUrl['query'] = ''; } return $this->request('http://'.$newUrl['host'].'/'.$newUrl['path'], $requestType, $newUrl['query'], $sCookie); @@ -179,24 +170,21 @@ $this->maxRedirects = 0; $buffer = ''; - if (isset($this->httpHeaders['Transfer-Encoding']) && $this->httpHeaders['Transfer-Encoding'] === 'chunked') - { + + if (isset($this->httpHeaders['Transfer-Encoding']) && $this->httpHeaders['Transfer-Encoding'] === 'chunked'){ /*Fichier chunked */ - while (!feof($fp)) - { + while (!feof($fp)){ $length = fgets($fp, 1024); - if ($length === false) - { + if ($length === false){ return false; } $length = hexdec(trim($length)); - if($length===0) - { + if($length===0){ break; } - while ($length > 0) - { + + while ($length > 0){ $buff = fgets($fp, $length + 1); if ($buff === false) { @@ -207,53 +195,36 @@ } fgets($fp,1024); - } - } - elseif (isset($this->httpHeaders['Content-Length'])) - { - + }elseif (isset($this->httpHeaders['Content-Length']) AND !$envoi){ //Fichier avec Content-Length $length = (int) $this->httpHeaders['Content-Length']; - while ($length > 0) - { - if($envoi) - $buff = fgets($fp, 4096); - else + while ($length > 0){ $buff = fgets($fp, $length+1); - if ($buff === false) { break; - } + } $length -= strlen($buff); $buffer .= $buff; - + if($envoi) echo $buff; - } - - - } - - else - { + }else{ /*Fichier sans Content-Length ni chunk */ while (!feof($fp)) { - $buff = fgets($fp, 1024); - if ($buff === false) - { + $buff = fgets($fp, 4096); + if ($buff === false){ break; - } + $buffer .= $buff; if($envoi) echo $buff; - - + usleep(1000); } } @@ -281,18 +252,21 @@ } $id = $_GET['id']; - +file_put_contents('debug.txt',''); $http = new Http(); $http->request('http://www.wat.tv/get/5c396b7d6c541c946bb25bbdf3ee6e7a/488ee20e/2/FLV-320x240/'.substr($id, -4, 2).'/'.substr($id, -2).'/'.$id.'.flv','GET','getURL=1&c='.$id.'&d=1&member=1868631551&end=0&fs=0&cnt=0&version=WIN%209,0,124,0'); -/* http://www.wat.tv/get/d09e0cdbdd405685df9b2bcefdcc4932/488ecfe3/2/FLV-320x240/34/69/1353469.flv?getURL=1&c=1353469&d=1&member=1868631551&end=0&fs=0&cnt=0&version=WIN%209,0,124,0 +/* http://www.wat.tv/get/d09e0cdbdd405685df9b2bcefdcc4932/488ecfe3/2/FLV-320x240/34/69/1353469.flv?getURL=1&c=1353469&d=1&member=1868631551&end=0&fs=0&cnt=0&version=WIN%209,0,124,0 + http://www.wat.tv/get/d09e0cdbdd405685df9b2bcefdcc4932/488ecfe3/2/FLV-320x240/34/69/1353469.flv?getURL=1&c=1353469&d=1&member=1868631551&end=0&fs=0&cnt=0&version=WIN%209,0,124,0 http://www.wat.tv/get/2ff6c3c7fa09416a3c1573671c0da083/488ed038/2/FLV-320x240/15/71/1291571.flv?getURL=1&c=1291571&d=1&member=1868631551&end=0&fs=0&cnt=0&version=WIN%209,0,124,0 */ $cookie = explode(';', $http->httpHeaders['Set-Cookie'][0]); + //echo $http->htmlContents; //echo $cookie[0]; -$h = $http->request($http->htmlContents, 'GET', '', $cookie[0], true); + +$h = $http->request(($http->htmlContents?$http->htmlContents:$http->httpHeaders['Location']), 'GET', '', $cookie[0], true); //file_put_contents('out.mp4', $http->htmlContents); ?> Modified: trunk/http/module/_menu/menu.php =================================================================== --- trunk/http/module/_menu/menu.php 2008-08-23 16:44:30 UTC (rev 238) +++ trunk/http/module/_menu/menu.php 2008-08-23 17:11:35 UTC (rev 239) @@ -15,9 +15,9 @@ foreach($res as $k => $r){ if($r['dependance']=='Alone'){ - $image = RES_ICO.str_replace(array('>',' !',' ','\xE9','\xEE','\xF4','\xE0','\xE8'),array('','','','e','i','o','a','e'),$r['nom']).'.gif'; + $image = RES_ICO.strtolower(str_replace(array('>',' !',' ','\xE9','\xEE','\xF4','\xE0','\xE8'),array('','','','e','i','o','a','e'),$r['nom'])).'.gif'; }else{ - $image = ICONE_REP.str_replace(array('>',' !',' ','\xE9','\xEE','\xF4','\xE0','\xE8'),array('','','','e','i','o','a','e'),$r['nom']).'.gif'; + $image = ICONE_REP.strtolower(str_replace(array('>',' !',' ','\xE9','\xEE','\xF4','\xE0','\xE8'),array('','','','e','i','o','a','e'),$r['nom'])).'.gif'; } $resultats[] = new ItemMenu($r['nom'], MODULE.$r['repertoire'].$r['lien'], $image, ''); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |