From: <ara...@us...> - 2007-05-01 10:45:57
|
Revision: 136 http://svn.sourceforge.net/easybox-mod/?rev=136&view=rev Author: aragornis Date: 2007-05-01 03:45:52 -0700 (Tue, 01 May 2007) Log Message: ----------- L?\195?\160 c'est bon ;) Added Paths: ----------- trunk/module/allocine/ trunk/module/allocine/allocine.tpl trunk/module/allocine/cache/ trunk/module/allocine/icone.gif trunk/module/allocine/index1.php trunk/module/allocine/jf_extralib.php trunk/module/allocine/playba_allocine.php trunk/module/allocine/video.gif Added: trunk/module/allocine/allocine.tpl =================================================================== --- trunk/module/allocine/allocine.tpl (rev 0) +++ trunk/module/allocine/allocine.tpl 2007-05-01 10:45:52 UTC (rev 136) @@ -0,0 +1,36 @@ +{section name=films loop=$FILMS max=3 start=$MIN} + + {cycle name=place assign=place print=false values="1,0"} + {if $smarty.section.films.first} + {if $MIN==0} + {$DESCRIPTION} + {/if} + + {if $MIN!=0} + {assign var=temp value=$MIN-3} + {attribbouton touche="green" lien="index1.php?start=$temp"} + <a href="index1.php?&start={$temp}"><img src="{$INTERFACE_REP}btn_vert.gif" border="0"> Pr\xE9c\xE9dent</a> + {/if} + <table border="0" cellpadding="2" cellspacing="0" width="500" height="360" align="center"><tr> + {/if} + <tr><td width="90" valign="top"><img width="90" height="120" border="0" src="{$IMG2FBX}{$FILMS[films].image|urlencode}&new_width=90&new_height=120&cache=1"></td> + <td valign=top align=left width="410"> + {if $FILMS[films].video!= ''} + <a onfocus='front_panel="{$FILMS[films].titre|truncate:12|replace:"'":"`"|replace:"\"":"``"}";' href="playba_allocine.php?url={$FILMS[films].video|urlencode}&from_start={$MIN}">{$FILMS[films].titre|truncate:40} <img src="video.gif" border=0 width=20 height=20></a> + {else} + {$FILMS[films].titre|truncate:40} + {/if} + <br> + <font size="1">{$FILMS[films].desc|truncate:400}</font> + </td> + </tr> +{/section} +</table> + +{if $MIN+$smarty.section.films.total<count($FILMS)} + {assign var=temp value=$MIN+3} + {attribbouton touche="blue" lien="index1.php?start=$temp"} + <a href="index1.php?start={$temp}"><img src="{$INTERFACE_REP}btn_bleu.gif" border="0"> Suivant</a> + +{/if} + Added: trunk/module/allocine/icone.gif =================================================================== (Binary files differ) Property changes on: trunk/module/allocine/icone.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream Added: trunk/module/allocine/index1.php =================================================================== --- trunk/module/allocine/index1.php (rev 0) +++ trunk/module/allocine/index1.php 2007-05-01 10:45:52 UTC (rev 136) @@ -0,0 +1,50 @@ +<?php +$RACINE_REP = "../../"; +require($RACINE_REP.'_framework/framework.php'); + +include_once('jf_extralib.php'); + +$rss = 'http://rss.allocine.fr/bandesannonces/archos'; +$xml = file_get_contentsJF($rss, true); +$xml = simplexml_load_string($xml); + +$title = utf8_decode($xml->channel->title); +$description = utf8_decode($xml->channel->description); + +$films=array(); +$contents = '<table border="0" cellpadding="0" cellspacing="0" width="500" height="360" align="center">'; +foreach($xml->channel->item as $item) +{ + + $attr = $item->enclosure->attributes(); + $fvideo = ''; + foreach($attr as $k=>$v) + { + if ($k == 'url') + { + $fvideo = (string)$v; + break; + } + } + $ftitre = utf8_decode((string)$item->title); + $fdesc = strip_tags( + utf8_decode((string)$item->description) + ,'<b><br><br/><br />'); + + $fimage = (string)$item->image->url; + $films[] = array('titre'=>$ftitre, 'desc'=>$fdesc, 'video'=>$fvideo, 'image'=>$fimage); + +} + +$LINK['red'] = page_retour_menu(); + +$smarty->assign('content', $contents); + +$smarty->assign('FILMS', $films); +$smarty->assign('TITRE',$title); +$smarty->assign('DESCRIPTION', $description); +$smarty->assign('MIN',$_GET['start']); + +$smarty->assign('CONTENT',$smarty->fetch('allocine.tpl')); +$smarty->display('interface.tpl'); +?> \ No newline at end of file Added: trunk/module/allocine/jf_extralib.php =================================================================== --- trunk/module/allocine/jf_extralib.php (rev 0) +++ trunk/module/allocine/jf_extralib.php 2007-05-01 10:45:52 UTC (rev 136) @@ -0,0 +1,84 @@ +<? +define('PROXY_NAME', ''); +//define('PROXY_NAME', '172.18.234.15'); // +//define('PROXY_PORT', 3128); +define('CACHE_DIR', dirname(__FILE__).'/cache/'); + +function __log($str) +{ +return; +/* + $fd = fopen(dirname(__FILE__).'/log.txt', 'a'); + fputs($fd, date('r').'>'); + fputs($fd, $str); + fputs($fd, "\n"); + fclose($fd); + */ +} + +function proxy_urlJF($proxy_url) +{ + $proxy_cont = ''; + + $proxy_fp = fsockopen(PROXY_NAME, PROXY_PORT); + if (!$proxy_fp) {return false;} + fputs($proxy_fp, "GET $proxy_url HTTP/1.0\r\nHost: $proxy_name\r\n\r\n"); + while(!feof($proxy_fp)) + { + $proxy_cont .= fread($proxy_fp,4096); + } + fclose($proxy_fp); + $proxy_cont = substr($proxy_cont, strpos($proxy_cont,"\r\n\r\n")+4); + return $proxy_cont; +} + +/** + * Cette fonction retourne sous forme de string le contenu d'un fichier ($url). + * Si le fichier est distant, on peut utiliser un cache ($usecache = true) qui + * expirera au bout d'un certain temps ($cachetimeout) + **/ +function file_get_contentsJF($url, $usecache = false, $cachetimeout = 3600) +{ + __log("file_get_contents($url, $usecache, $cachetimeout)"); + if(strpos($url, 'http:') === 0 || + strpos($url, 'https:') === 0 || + strpos($url, 'ftp:') === 0) + { + // Distant. + if ($usecache === false) + { + if (PROXY_NAME != '') + $content = proxy_urlJF($url); + else + $content = file_get_contents($url); + return $content; + } + else + { + // On regarde dans le cache d'abord + $md5url = md5($url); + if (@filemtime(CACHE_DIR.$md5url) < time() - $cachetimeout) + { + if (PROXY_NAME != '') + $content = proxy_urlJF($url); + else + $content = file_get_contents($url); + $fd = fopen(CACHE_DIR.$md5url, 'wb'); + fputs($fd, $content); + fclose($fd); + touch(CACHE_DIR.$md5url); + return $content; + } + else + { + return file_get_contents(CACHE_DIR.$md5url); + } + } + } + else + { + // local + return file_get_contents($url); + } +} +?> \ No newline at end of file Added: trunk/module/allocine/playba_allocine.php =================================================================== --- trunk/module/allocine/playba_allocine.php (rev 0) +++ trunk/module/allocine/playba_allocine.php 2007-05-01 10:45:52 UTC (rev 136) @@ -0,0 +1,49 @@ +<?php /// __JF + +$RACINE_REP = "../../"; +require($RACINE_REP.'_framework/framework.php'); +$BACKGROUND='none'; + +$url = $_REQUEST['url']; + +if ($url == '') +{ +} +else +{ + save_variable('start', $_REQUEST['from_start']); + save_variable('backToURL', dirname($_SERVER['SCRIPT_NAME']).'/index1.php?start='.$_REQUEST['from_start']); + play_fichier('type=40', + str_replace(' ','%20',$url), + 0, + 'backToURL', + $_REQUEST['titre']); + //echo $basename; +} + $LINK['stop']=$MODULE.'films/lecture.php?control=stop'; + $LINK['play']=$MODULE.'films/lecture.php?control=play'; + $LINK['pause']=$MODULE.'films/lecture.php?control=pause'; + $LINK['info']=$MODULE.'films/info.php'; + $LINK['options']=$MODULE.'films/info.php'; + $LINK['blue']=$MODULE.'films/lecture.php?savesignet=1'; + $LINK['red']=$MODULE.'films/lecture.php?next_ss=1'; + $LINK['yellow']=$MODULE.'films/info.php?module=infos'; + $LINK['up']=$MODULE.'films/lecture.php?seek_value=plus'; + $LINK['down']=$MODULE.'films/lecture.php?seek_value=moins'; + + // BDE - RequestID 1588902 + $LINK['next']=$MODULE.'films/lecture.php?control=next'; + $LINK['prev']=$MODULE.'films/lecture.php?control=previous'; + $LINK['rev']=$MODULE.'films/lecture.php?seek_value=moins'; + $LINK['fwd']=$MODULE.'films/lecture.php?seek_value=plus'; + +?> +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> +<html> +<head> +<meta name="refresh" content="0;url=../films/lecture.php"> +<script language="javascript" src="/fb2ie.js"> +</script> +</head> +<body></body></html> + Added: trunk/module/allocine/video.gif =================================================================== (Binary files differ) Property changes on: trunk/module/allocine/video.gif ___________________________________________________________________ Name: svn:mime-type + application/octet-stream This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |