|
From: <ara...@us...> - 2007-05-23 15:01:51
|
Revision: 159
http://svn.sourceforge.net/easybox-mod/?rev=159&view=rev
Author: aragornis
Date: 2007-05-23 08:01:43 -0700 (Wed, 23 May 2007)
Log Message:
-----------
- mise en place d'un cache pour les pages t?\195?\169l?\195?\169charg?\195?\169es sur internet
Modified Paths:
--------------
trunk/_framework/fonctions_partagees.inc.php
trunk/configuration/bases.xml
trunk/module/cinefil/index1.php
trunk/module/clips/index1.php
trunk/module/dailymotion/index1.php
trunk/module/ephemeride/index1.php
trunk/module/guidetv/tvprogram.php
trunk/module/mp3/paroles.php
trunk/module/mp3/podcast.php
trunk/module/recettes/index1.php
trunk/module/recettes/recettes.php
trunk/module/seances/programme_cine.tpl
trunk/module/seances/voirsalle.php
trunk/module/stage6/index1.php
trunk/module/youtube/index1.php
Removed Paths:
-------------
trunk/_framework/img2fbx.php
trunk/_framework/lib/img_cr.php
trunk/module/films/playba.php
Modified: trunk/_framework/fonctions_partagees.inc.php
===================================================================
--- trunk/_framework/fonctions_partagees.inc.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/_framework/fonctions_partagees.inc.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -854,4 +854,41 @@
$smarty->assign('VLC',$VLC);
}
+
+// T\xE9l\xE9charge une page internet et la met en cache ou r\xE9cup\xE8re directement son contenu mis en cache
+function file_get_contents_cache($adresse, $heures=1){
+global $USER, $CACHE_IMAGE;
+ $db = sqlite_open($USER.'cache.db', 0666);
+ $fichier = md5($adresse);
+ clean_cache();
+ $res = sqlite_query($db,'SELECT * FROM cache WHERE fichier="'.$fichier.'"');
+ if(sqlite_num_rows($res)>0 AND file_exists($CACHE_IMAGE.$fichier)){
+ $retour = file_get_contents($CACHE_IMAGE.$fichier);
+ }else{
+ $retour = file_get_contents($adresse);
+ file_put_contents($CACHE_IMAGE.$fichier, $retour);
+ sqlite_query($db,'INSERT INTO cache VALUES(NULL,\''.sqlite_escape_string($fichier).'\', \''.(time()+($heures*3600)).'\')');
+ }
+ sqlite_close($db);
+ return $retour;
+}
+
+// Ouvre un fichier xml en le mettant en cache
+function simplexml_load_file_cache($adresse, $heures){
+ return simplexml_load_string(file_get_contents_cache($adresse, $heures));
+}
+
+// Nettoie les fichiers p\xE9rim\xE9s du cache
+function clean_cache(){
+global $USER, $CACHE_IMAGE;
+ $db = sqlite_open($USER.'cache.db', 0666);
+ $temps = time();
+ $res = sqlite_query($db,'SELECT * FROM cache WHERE expire<"'.$temps.'"');
+ $retour = sqlite_fetch_all($res);
+ foreach($retour as $r){
+ unlink($CACHE_IMAGE.$r['fichier']);
+ }
+ sqlite_query($db,'DELETE FROM cache WHERE expire<"'.$temps.'"');
+ sqlite_close($db);
+}
?>
Deleted: trunk/_framework/img2fbx.php
===================================================================
--- trunk/_framework/img2fbx.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/_framework/img2fbx.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -1,79 +0,0 @@
-<?php
-$RACINE_REP = realpath("../");
-$CACHE_IMAGE = $RACINE_REP."/_utilisateur/cache/";
-
-$sURL=urldecode($_REQUEST['sURL']);
-
-list($width, $height, $type) = getimagesize($sURL);
-
-if (isset($_REQUEST['nbcouleurs'])) {
- $nbcouleurs = $_REQUEST['nbcouleurs'];
-} else {
- $nbcouleurs = 128;
-}
-
-function is_cached($url){
-global $CACHE_IMAGE;
- if(file_exists($CACHE_IMAGE.md5($url).'.gif')){
- RETURN True;
- }else{
- RETURN False;
- }
-}
-
-//R\xE9cup\xE8re l'image dans le cache si il faut
-if(is_cached($sURL.$_REQUEST['new_width'].$_REQUEST['new_height']) && $_REQUEST['cache']==1){
- $oIm = imagecreatefromgif($CACHE_IMAGE.md5($sURL.$_REQUEST['new_width'].$_REQUEST['new_height']).'.gif');
- if(!headers_sent()){
- header('Content-Type: image/gif');
- imagegif($oIm);
- imagedestroy($oIm);
- die();
- }
-}else{
-
-switch($type){
- case 1 : //GIF
- $oIm = imagecreatefromgif($sURL);
- break;
- case 2 : //JPG
- $oIm = imagecreatefromjpeg($sURL);
- break;
- case 3 : // PNG
- $oIm = imagecreatefrompng($sURL);
- break;
-}
-
- if(isset($_REQUEST['new_width']) && isset($_REQUEST['new_height'])){
-
- $colors_handle = ImageCreatetruecolor($_REQUEST['new_width'],$_REQUEST['new_height']);
- imagecopyresampled( $colors_handle, $oIm, 0, 0, 0, 0, $_REQUEST['new_width'], $_REQUEST['new_height'],$width, $height );
- ImageTrueColorToPalette( $colors_handle, false, $nbcouleurs );
-
- if($_REQUEST['cache']==1){
- imagegif($colors_handle,$CACHE_IMAGE.md5($sURL.$_REQUEST['new_width'].$_REQUEST['new_height']).'.gif');
- }
-
- if(!headers_sent()){
- header('Content-Type: image/gif');
- imagegif($colors_handle);
- imagedestroy($oIm);
- ImageDestroy( $colors_handle );
- die();
- }
- }else{
- imagetruecolortopalette($oIm, false, $nbcouleurs);
-
- if($_REQUEST['cache']==1){
- imagegif($oIm,$CACHE_IMAGE.md5($sURL).'.gif');
- }
-
- if(!headers_sent()) {
- header('Content-Type: image/gif');
- imagegif($oIm);
- imagedestroy($oIm);
- die();
- }
- }
-}
-?>
Deleted: trunk/_framework/lib/img_cr.php
===================================================================
--- trunk/_framework/lib/img_cr.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/_framework/lib/img_cr.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -1,186 +0,0 @@
-<?php
-
-$RACINE_REP = realpath("../../");
-$CACHE_IMAGE = $RACINE_REP."/_utilisateur/cache/";
-
-if (isset($_GET['img'])){
- if ($_GET['local']){
- $img = urldecode($_GET['img']);
- }else{
- $img ='../'.urldecode($_GET['img']);
- }
-}else exit;
-if (isset($_GET['h']))
- $h = $_GET['h'];
-else
-$h="70";
-
-$format=$_GET['format'];
-
-if (isset($_GET['w']))
-$w = $_GET['w'];
-else
-$w="93";
-
-
-/*$img = str_replace("\\", "/",$img);
-$img = ereg_replace("//", "/",$img);
-$img = str_replace("[", "*",$img);
-$img = str_replace("]", "*",$img);*/
-define("IMAGE_FLIP_HORIZONTAL", 1);
-define("IMAGE_FLIP_VERTICAL", 2);
-define("IMAGE_FLIP_BOTH", 3);
-
-function imageajuste(&$image1,$image2,$largeur,$hauteur,$position,$quality){
-global $format;
- $pourcent=min (min(($largeur/imagesx($image2)),1),min(($hauteur/imagesy($image2)),1));
- $redimx=floor(imagesx($image2)*$pourcent);
- $redimy=floor(imagesy($image2)*$pourcent);
- $image1 = imagecreatetruecolor($redimx, $redimy);
-
-if($quality=="max"){
-ImageCopyresampled($image1,$image2,$px,$py,0,0,round($redimx),round($redimy),imagesx($image2),imagesy($image2));
-}else{
-imagecopyresized($image1,$image2,$px,$py, 0, 0, round($redimx),round($redimy), imagesx($image2),imagesy($image2));
-}
-}
-
-function ImageFlip($imgsrc, $type)
-{
- $width = imagesx($imgsrc);
- $height = imagesy($imgsrc);
-
- $imgdest = imagecreatetruecolor($width, $height);
- ImageAlphaBlending($imgdest, false);
-
- switch( $type )
- {
- // mirror wzgl. osi
- case IMAGE_FLIP_HORIZONTAL:
- for( $y=0 ; $y<$height ; $y++ )
- imagecopy($imgdest, $imgsrc, 0, $height-$y-1, 0, $y, $width, 1);
- break;
-
- case IMAGE_FLIP_VERTICAL:
- for( $x=0 ; $x<$width ; $x++ )
- imagecopy($imgdest, $imgsrc, $width-$x-1, 0, $x, 0, 1, $height);
- break;
-
- case IMAGE_FLIP_BOTH:
- for( $x=0 ; $x<$width ; $x++ )
- imagecopy($imgdest, $imgsrc, $width-$x-1, 0, $x, 0, 1, $height);
-
- $rowBuffer = imagecreatetruecolor($width, 1);
- for( $y=0 ; $y<($height/2) ; $y++ )
- {
- imagecopy($rowBuffer, $imgdest , 0, 0, 0, $height-$y-1, $width, 1);
- imagecopy($imgdest , $imgdest , 0, $height-$y-1, 0, $y, $width, 1);
- imagecopy($imgdest , $rowBuffer, 0, $y, 0, 0, $width, 1);
- }
-
- imagedestroy( $rowBuffer );
- break;
- }
-
- return( $imgdest );
-}
-
-function ImageRotateRightAngle( $imgSrc, $angle )
-{
- // ensuring we got really RightAngle (if not we choose the closest one)
- $angle = min( ( (int)(($angle+45) / 90) * 90), 270 );
-
- // no need to fight
- if( $angle == 0 )
- return( $imgSrc );
-
- // dimenstion of source image
- $srcX = imagesx( $imgSrc );
- $srcY = imagesy( $imgSrc );
-
- switch( $angle )
- {
- case 90:
- $imgDest = imagecreatetruecolor( $srcY, $srcX );
- for( $x=0; $x<$srcX; $x++ )
- for( $y=0; $y<$srcY; $y++ )
- imagecopy($imgDest, $imgSrc, $srcY-$y-1, $x, $x, $y, 1, 1);
- break;
-
- case 180:
- $imgDest = ImageFlip( $imgSrc, IMAGE_FLIP_BOTH );
- break;
-
- case 270:
- $imgDest = imagecreatetruecolor( $srcY, $srcX );
- for( $x=0; $x<$srcX; $x++ )
- for( $y=0; $y<$srcY; $y++ )
- imagecopy($imgDest, $imgSrc, $y, $srcX-$x-1, $x, $y, 1, 1);
- break;
- }
-
- return( $imgDest );
-}
-
-function is_cached($url){
-global $CACHE_IMAGE;
- if(file_exists($CACHE_IMAGE.md5($url).'.gif')){
- RETURN True;
- }else{
- RETURN False;
- }
-}
-
-if(isset($_GET['formatw']) && isset($_GET['formath'])){
-$h = $_GET['formath'];
-$w = $_GET['formatw'];
-}elseif ($format == "1") {
- $h = "68";$w="88";
-}elseif($format == "2"){
- $h = "460";$w="620";
-}elseif($format == "0"){
- $h = "515";$w="660";
-}
-
-if(is_cached($img.$h.$w.$_GET['tourne'])){
-
-$img_cr = imagecreatefromgif($CACHE_IMAGE.md5($img.$h.$w.$_GET['tourne']).'.gif');
-
-}else{
-
-$ext = strtolower(substr($img,strrpos($img,'.')));
-switch($ext){
- case ".jpg":
- $origin = imagecreatefromjpeg($img);
- break;
- case ".gif":
- $origin = imagecreatefromgif($img);
- break;
- case ".png":
- $origin = imagecreatefrompng($img);
- break;
- }
-
-if ($_GET['tourne']) {
- // Rotation
- $ang=$_GET['tourne'];
- if (abs($ang)>=360)
- $ang=fmod($ang,360);
- if ($ang<0)
- $ang=360+$ang;
- $origin = ImageRotateRightAngle($origin,$ang);
-}
-
-imageajuste($img_cr, $origin, $w, $h, 5, $_GET['quality']);
-imagegif($img_cr,$CACHE_IMAGE.md5($img.$h.$w.$_GET['tourne']).'.gif');
-}
-
-// on retourne l'image
-header("Content-Type: image/gif");
-imagegif($img_cr);
-
-// destruction des images de la memoire
-imagedestroy($img_cr);
-imagedestroy($origin);
-
-?>
Modified: trunk/configuration/bases.xml
===================================================================
--- trunk/configuration/bases.xml 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/configuration/bases.xml 2007-05-23 15:01:43 UTC (rev 159)
@@ -94,6 +94,10 @@
<name>film</name>
<syntax>CREATE TABLE film ( id INTEGER NOT NULL PRIMARY KEY DEFAULT "0" , file TEXT, name TEXT , Synopsis TEXT , img TEXT , sortie INT , realisateur TEXT , avec TEXT , film TEXT , genre TEXT , Duree TEXT , production TEXT , critique_visiteurs TEXT , critique_presse TEXT , ba TEXT )</syntax>
</table>
+ <table>
+ <name>cache</name>
+ <syntax>CREATE TABLE cache ( id INTEGER NOT NULL PRIMARY KEY DEFAULT "0" , fichier TEXT, expire TEXT )</syntax>
+ </table>
</base>
<base>
Modified: trunk/module/cinefil/index1.php
===================================================================
--- trunk/module/cinefil/index1.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/module/cinefil/index1.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -18,13 +18,8 @@
$titre = 'Sorties cin\xE9ma de la semaine du mercredi '.$semaine;
$serverDefaultPage='http://www.allocine.fr/film/cettesemaine_gen_page='.$week.'.html';
-$page = @fopen ($serverDefaultPage, 'r') ;
+$contenu_html = file_get_contents_cache($serverDefaultPage,2);
-$contenu_html = '';
-while (!feof ($page)) {
- $contenu_html .= trim(fgets($page, 4096));
-}
-
$ereg = 'width="120" valign="top"><a class="link1" href="fichefilm_gen_cfilm=(.{1,15}).html"><img src="(.{1,200})" border="0" (.{1,350})<table cellpadding="0" cellspacing="0" border="0"><tr><td style="padding: 0 0 0 0"><h2><a class="link1" href="\/film\/fichefilm_gen_cfilm=(.{1,15}).html">(.{1,100})<\/a><\/h2>(.{1,200})<td style="padding: 5 0 0 0;"><h5>(.{0,70})<\/h5><\/td><\/tr>';
preg_match_all("/$ereg/s", $contenu_html, $valeur);
Modified: trunk/module/clips/index1.php
===================================================================
--- trunk/module/clips/index1.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/module/clips/index1.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -15,7 +15,7 @@
$smarty->assign('TITRE','Clips - '.$title[$show]);
function get_videos_id($page){
- $contenu = str_replace("\r\n",'',@file_get_contents($page));
+ $contenu = str_replace("\r\n",'',@file_get_contents_cache($page,5));
$ereg = '<table cellpadding="0"><tr><td class="listitem"><a href="http:\/\/fr.music.yahoo.com\/ar-(.{1,50})" title="(.{1,50})">(.{1,50})<\/a><\/td><\/tr><\/table><\/td><td bgcolor="(.{1,90})<td><table cellpadding="0" width="100%"><tr><td class="listheader"><a href="javascript:playLAUNCHVideo\((.{1,10})\)" class="listheader" title="(.{1,70})">(.{1,70})<\/a><\/td>(.{1,1500})photo=(.{1,150})&url';
preg_match_all("/$ereg/s", $contenu, $valeur);
foreach($valeur[2] as $key=>$val){
@@ -27,7 +27,7 @@
}
function get_recherche($rec){
- $contenu = str_replace("\r\n",'',@file_get_contents('http://search.fr.music.yahoo.com/search/?p='.urlencode($rec).'&m=video'));
+ $contenu = str_replace("\r\n",'',@file_get_contents_cache('http://search.fr.music.yahoo.com/search/?p='.urlencode($rec).'&m=video',5));
$ereg = '<td bgcolor=......><a href=javascript:playVideos\((.{1,10})\); title="(.{1,50})"><b>(.{1,50})<\/b><\/a><\/td><td bgcolor=......><a href=http:\/\/fr.music.yahoo.com\/ar-(.{1,50})><font title="(.{1,50})">(.{1,50})<\/font><\/a><\/td><td bgcolor=...... align=center class="yss_right';
preg_match_all("/$ereg/s", $contenu, $valeur);
foreach($valeur[2] as $key=>$val){
Modified: trunk/module/dailymotion/index1.php
===================================================================
--- trunk/module/dailymotion/index1.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/module/dailymotion/index1.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -15,7 +15,7 @@
$smarty->assign('TITRE','Vid\xE9os Dailymotion - '.$title[$show]);
function get_videos_id($page){
- $xml = simplexml_load_file($page);
+ $xml = simplexml_load_file_cache($page,2);
if(count($xml->channel->item)!=0){
foreach($xml->channel->item as $item){
$img = '';
Modified: trunk/module/ephemeride/index1.php
===================================================================
--- trunk/module/ephemeride/index1.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/module/ephemeride/index1.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -5,23 +5,23 @@
$monthes = array('','Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet','Aout', 'Septembre', 'Octobre', 'Novembre', 'Décembre');
$day = array('Dimanche','Lundi','Mardi','Mercredi','Jeudi','Vendredi','Samedi');
-$contenu = file_get_contents("http://www.ephemeride.com/free/fete.jsp", "r");
+$contenu = file_get_contents_cache("http://www.ephemeride.com/free/fete.jsp", 12);
$ereg = '<font class="FeteHomme">(.{1,30})<\/font>';
preg_match("/$ereg/s", $contenu, $valeur);
$fetes=stripslashes(html_entity_decode($valeur[1]));
-$contenu = file_get_contents("http://www.ephemeride.com/free/dicton.jsp", "r");
+$contenu = file_get_contents_cache("http://www.ephemeride.com/free/dicton.jsp", 12);
$ereg = '<tr><td class="fmb" style="padding:2px" height="60">(.{1,300})<br><center>';
preg_match("/$ereg/s", $contenu, $valeur);
$dicton = stripslashes(html_entity_decode($valeur[1]));
-$contenu = file_get_contents("http://www.ephemeride.com/free/citation.jsp", "r");
+$contenu = file_get_contents_cache("http://www.ephemeride.com/free/citation.jsp", 12);
$ereg = '<tr><td class="fmb" style="padding:2px" height="60">(.{1,300})<div align="right"><span class="cita"><b>(.{1,30})<\/b><\/span><\/div>';
preg_match("/$ereg/s", $contenu, $valeur);
$citation = stripslashes(html_entity_decode($valeur[1]));
$auteur = stripslashes(html_entity_decode($valeur[2]));
-$contenu = file_get_contents("http://www.ephemeride.com/free/proverbe.jsp", "r");
+$contenu = file_get_contents_cache("http://www.ephemeride.com/free/proverbe.jsp", 12);
$ereg = '<td class="fmb" style="padding:2px" height="60">(.{1,300})<br><center>';
preg_match("/$ereg/s", $contenu, $valeur);
$proverbe = stripslashes(html_entity_decode($valeur[1]));
Deleted: trunk/module/films/playba.php
===================================================================
--- trunk/module/films/playba.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/module/films/playba.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -1,47 +0,0 @@
-<?php
-$RACINE_REP = "../../";
-require($RACINE_REP.'_framework/framework.php');
-$BACKGROUND='none';
-
-if($pagerecherche = @file_get_contents('http://www.cinemovies.fr/players/video.php?IDBA='.$_REQUEST['toplay'])){
-
-$ereg = '<embed src="(.{1,150})" width';
-preg_match("/$ereg/s", $pagerecherche, $valeur);
- if(isset($valeur[1])){
- $basename=$valeur[1];
- }else{
- $ereg = '<param name="filename" value="(.{1,120})wmv">';
- preg_match("/$ereg/s", $pagerecherche, $valeur);
- $basename=$valeur[1].'wmv';
- }
-}
-
-play_fichier('type=40',str_replace(' ','%20',$basename),0,'ba',$_REQUEST['titre']);
-
- $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=lecture.php">
-<script language="javascript" src="/fb2ie.js">
-</script>
-</head>
-<body></body></html>
-
Modified: trunk/module/guidetv/tvprogram.php
===================================================================
--- trunk/module/guidetv/tvprogram.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/module/guidetv/tvprogram.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -40,7 +40,7 @@
function infos_emissions($id,$debut,$fin){
if($id!=''){
$infos = true;
- $contenu_html = file_get_contents ('http://telepoche.guidetele.com/fiche/emi_'.$id);
+ $contenu_html = file_get_contents_cache ('http://telepoche.guidetele.com/fiche/emi_'.$id,24);
$ereg = "<span class=\"noir11\">(.{1,1000})<\/span><br \/>";
preg_match("/$ereg/s",$contenu_html, $content);
@@ -93,7 +93,7 @@
function programme_chaine($chaine, $jour){
- $contenu_html = file_get_contents('http://telepoche.guidetele.com/gtvnew/journee?openagent&c='.$chaine['id'].'&d='.$jour.'&h=0');
+ $contenu_html = file_get_contents_cache('http://telepoche.guidetele.com/gtvnew/journee?openagent&c='.$chaine['id'].'&d='.$jour.'&h=0',48);
$ereg = "showmenu\('(.{1,3})h(.{1,3})-(.{1,3})h(.{1,3})<br> (.{1,40})<br> Showview : (.{1,8})','(.{1,100})'\)\" onMouseout=\"hidemenu\(\)\" onclick=\"(.{1,80})\"";
preg_match_all("/$ereg/s", utf8_encode($contenu_html), $valeurs);
Modified: trunk/module/mp3/paroles.php
===================================================================
--- trunk/module/mp3/paroles.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/module/mp3/paroles.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -16,7 +16,7 @@
if (isset($_REQUEST['hid'])) {
$hid = urldecode($_REQUEST['hid']);
- $xml2 = simplexml_load_file('http://api.leoslyrics.com/api_lyrics.php?auth=leolyrics5&hid='.urlencode($hid));
+ $xml2 = simplexml_load_file_cache('http://api.leoslyrics.com/api_lyrics.php?auth=leolyrics5&hid='.urlencode($hid),1);
$CONTENT .= utf8_decode($xml2->lyric->artist->name).' - '.utf8_decode($xml2->lyric->album->name).' - '.utf8_decode($xml2->lyric->title).'<br> <br>';
$CONTENT .= nl2br(utf8_decode($xml2->lyric->text));
@@ -35,14 +35,8 @@
$artist = $id3->artists;
$name = $id3->name;
}
- $file='http://api.leoslyrics.com/api_search.php?auth=leolyrics5&artist='.urlencode($artist).'&songtitle='.urlencode($name);
- if($handle = fopen ($file, "r")){
- while (!feof ($handle)) {
- $fichierxml.= trim(fgets($handle, 4096));
- }
- }
- fclose($handle);
- $xml = simplexml_load_string($fichierxml);
+
+ $xml = simplexml_load_file_cache($file,1);
for ($i=0;$i<=20;$i++){
if($xml->searchResults->result[$i]->title!=""){
$c=1;
@@ -52,7 +46,7 @@
$c++;
}
if ($xmlb[$i][3]=="true"){
- $xml2 = simplexml_load_file('http://api.leoslyrics.com/api_lyrics.php?auth=leolyrics5&hid='.urlencode($xmlb[$i][2]));
+ $xml2 = simplexml_load_file_cache('http://api.leoslyrics.com/api_lyrics.php?auth=leolyrics5&hid='.urlencode($xmlb[$i][2]),1);
$CONTENT .= utf8_decode($xml2->lyric->artist->name).' - '.utf8_decode($xml2->lyric->album->name).' - '.utf8_decode($xml2->lyric->title).'<br> <br>';
$CONTENT .= nl2br(utf8_decode($xml2->lyric->text));
break;
Modified: trunk/module/mp3/podcast.php
===================================================================
--- trunk/module/mp3/podcast.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/module/mp3/podcast.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -31,7 +31,7 @@
$smarty->assign('ROW',sqlite_fetch_all($result2));
sqlite_close($db);
}else{
- $content=file_get_contents($url);
+ $content=file_get_contents_cache($url,1);
$xml = simplexml_load_string(str_replace("itunes:","itunes",$content));
$podcast = array('titre'=>utf8_decode($xml->channel->title),'sommaire'=>utf8_decode($xml->channel->itunessummary));
Modified: trunk/module/recettes/index1.php
===================================================================
--- trunk/module/recettes/index1.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/module/recettes/index1.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -30,10 +30,7 @@
else
$numliens = 1; // Sinon alller \xE0 la page 1
- $fp = fopen($categ, "r"); //lecture du fichier
- while (!feof($fp)) { //on parcoure toutes les lignes
- $contenu .= fgets($fp, 4096); // lecture du contenu de la ligne
- }
+ $contenu = file_get_contents_cache($categ,2);
if (isset ($_REQUEST['type'])) { // Si un type pr\xE9cis de liste est donn\xE9
$type = $_REQUEST['type'];
Modified: trunk/module/recettes/recettes.php
===================================================================
--- trunk/module/recettes/recettes.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/module/recettes/recettes.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -25,12 +25,8 @@
// Creation de l'URL de l'image associ\xE9e a la recette
$urlimg = urlencode('http://' . str_replace("recettes/recette.cfm?num_recette=", "recipephotos/normal/", $url) . '.jpg');
-
-$fp = fopen('http://' . urldecode($url), "r"); //lecture du fichier
-while (!feof($fp)) { //on parcoure toutes les lignes
- $contenu .= fgets($fp, 4096); // lecture du contenu de la ligne
-}
-
+ $contenu = file_get_contents_cache('http://' . urldecode($url),2);
+
// Si le le visiteur demande les informations sur la recette
if ($etape == 'info') {
Modified: trunk/module/seances/programme_cine.tpl
===================================================================
--- trunk/module/seances/programme_cine.tpl 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/module/seances/programme_cine.tpl 2007-05-23 15:01:43 UTC (rev 159)
@@ -1,4 +1,4 @@
-<font size="4">{$TITRE2}</font>
+<font size="4">{$TITRE2}</font><br>
{if $MIN!=0}
{assign var=temp value=$MIN-3|max:0}
{attribbouton touche="green" lien="voirsalle.php?salle=$s&min=$temp"}
Modified: trunk/module/seances/voirsalle.php
===================================================================
--- trunk/module/seances/voirsalle.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/module/seances/voirsalle.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -21,15 +21,8 @@
$serverDefaultPage="http://www.allocine.fr/seance/salle_gen_csalle=$s";
-$page = @fopen ($serverDefaultPage, 'r')
- or die('Impossible d\'ouvrir la page '.$serverDefaultPage);
+$contenu_html = file_get_contents_cache($serverDefaultPage, 2);
-$contenu_html = '';
-while (!feof ($page)) {
- $contenu_html .= trim(fgets($page, 4096));
- }
-
-
$ereg = '<h1 style="color: #D20000"><b>(.{1,30})<\/b>';
preg_match("/$ereg/s", $contenu_html, $valeur);
$cine = $valeur[1];
Modified: trunk/module/stage6/index1.php
===================================================================
--- trunk/module/stage6/index1.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/module/stage6/index1.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -14,7 +14,7 @@
$smarty->assign('TITRE','Vid\xE9os Stage6 - '.$title[$show]);
function get_videos_id($page){
- $xml = simplexml_load_file($page);
+ $xml = simplexml_load_file_cache($page,2);
if(count($xml->channel->item)!=0){
foreach($xml->channel->item as $item){
$img = '';
@@ -35,7 +35,7 @@
if($show=='rec'){
}else{
- $contenu = str_replace("\n",'',@file_get_contents($url2));
+ $contenu = str_replace("\n",'',@file_get_contents_cache($url2,1));
$ereg = '\?page=(.{1,6})\'>(.{1,6})<\/a> <a class=\'pagination-number pagination-right';
preg_match("/$ereg/s", $contenu, $valeur);
return $valeur[2]*18;
Modified: trunk/module/youtube/index1.php
===================================================================
--- trunk/module/youtube/index1.php 2007-05-22 21:38:57 UTC (rev 158)
+++ trunk/module/youtube/index1.php 2007-05-23 15:01:43 UTC (rev 159)
@@ -15,7 +15,7 @@
$smarty->assign('TITRE','Vid\xE9os Youtube - '.$title[$show]);
function get_videos_id($page){
- $contenu = str_replace("\n",'',@file_get_contents($page));
+ $contenu = str_replace("\n",'',@file_get_contents_cache($page,2));
$ereg = '<a href="\/watch\?v=(.{1,12})"><img src="(.{1,200})" class=" vimg " alt="video" \/><\/a><\/div> <\/div> <div class="vtitle"> <a href="\/watch\?v=(.{1,12})" onclick="_hbLink\(\'(.{0,100})\',\'(.{1,50})\'\);">(.{1,100})<\/a><br\/> <span class="runtime">(.{1,10})<\/span>';
preg_match_all("/$ereg/s", $contenu, $valeur);
foreach($valeur[1] as $key=>$val){
@@ -25,7 +25,7 @@
}
function get_recherche($rec,$page){
- $contenu = str_replace("\n",'',@file_get_contents('http://www.youtube.com/results?search_query='.urlencode($rec).'&search=Search&page='.$page));
+ $contenu = str_replace("\n",'',@file_get_contents_cache('http://www.youtube.com/results?search_query='.urlencode($rec).'&search=Search&page='.$page,2));
$ereg = '<img src="(.{1,200})" border="0" class="vimg120" \/><\/a><\/div> <\/div> <\/td> <td class="vinfo"> <div class="vSnippetTitle"> <a href="\/watch\?v=(.{1,12})" rel="nofollow" onclick="_hbLink\(\'(.{1,100})\',\'(.{1,50})\'\);">(.{1,100})<\/a><br\/> <span class="runtime">(.{1,10})<\/span>';
preg_match_all("/$ereg/s", $contenu, $valeur);
foreach($valeur[1] as $key=>$val){
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|