Aide sur un code php

Fermé
hatchum Messages postés 40 Date d'inscription mardi 16 mars 2010 Statut Membre Dernière intervention 20 octobre 2013 - 18 mars 2010 à 00:06
hatchum Messages postés 40 Date d'inscription mardi 16 mars 2010 Statut Membre Dernière intervention 20 octobre 2013 - 21 mars 2010 à 06:49
Bonjour,
voila j'utilise le composant video seyret de joomla et je bloque un peu sur ce code je voudrais ajouter une ligne qui me permetrait d'afficher une image de fond de ce genre http://tinypic.com/images/goodbye.jpg pour la lecture des video sur megavideo mais je sais pas quel partie du code modifier.

voila le code.

<?php
//megavideo.com plugin for Seyret component//
/**
* Content code
* @package SEYRET
* @Copyright (C) 2007 Mustafa DINDAR
* @ All rights reserved
* @ Seyret Component is Free Software
* @ Released under GNU/GPL License : http://www.gnu.org/licenses/gpl-3.0.html

**/

// no direct access
defined( '_VALID_MOS' ) or die( 'Kýsýtlý alan' );

$videodownloadsupport="yes";
$downloadcachingnotimeout="no";
$downloadcachingtimeout="0";

function megavideocomgetvideodetails($vidlink, $existingcode,$categorylist, $reqtype){
global $database, $mosConfig_absolute_path, $mosConfig_live_site,$my;
require($mosConfig_absolute_path.'/administrator/components/com_seyret/seyret_config.php');

if ($reqtype=="new") {

$vidlink=jalemurldecode($vidlink);

$smallvideocode=str_replace("http://www.megavideo.com/?v=","",$vidlink);
$smallvideocode=str_replace("http://megavideo.com/?v=","",$smallvideocode);

//improved security not to call another site...
$vidlink="http://www.megavideo.com/?v=".$smallvideocode;

} else if ($reqtype=="refresh") {

}

$videoservertype="megavideo.com";



$str=jalem_file_get_contents($vidlink);

$pos = strpos($str, "videoname")+12;
$post=strpos($str, "\"vid_name")-$pos;
$videotitle=substr($str,$pos,$post);
$pos = strpos($videotitle, "\"");
$videotitle=substr($videotitle,0,$pos);




$pos = strpos($str, "mvgui/right.gif");
$post = strpos($str, "id=\"ratingMessage\"")-$pos;
$trim1=substr($str,$pos,$post);
$pos = strpos($trim1, "<textarea");
$post = strpos($trim1, "</textarea>")-$pos;
$itemcomment=substr($trim1,$pos,$post);
$itemcomment=strip_tags($itemcomment);
$itemcomment=str_replace("\"","'",$itemcomment);

// $pos = strpos($str, "?v=$smallvideocode\"><");
// $strip1=substr($str,$pos,2000);
// $pos = strpos($strip1, "http");
// $post = strpos($strip1, ".jpg")-$pos+4;
// $picturelink=substr($strip1,$pos,$post);


$pos = strpos($str, "/$smallvideocode");
$trim1=substr($str,$pos,100);
$pos = strpos($trim1, "\"");
$trim2=substr($trim1,1,$pos);

$readurl="http://www.megavideo.com/v/$trim2";
$pstr=fetchURL($readurl, true);
$pos = strpos($pstr, "image=")+6;
$post = strpos($pstr, ".jpg")-$pos;
$picturelink=substr($pstr,$pos,$post+4);
//$picturelink=str_replace("img1","img5",$picturelink);

$trim2=str_replace($smallvideocode,"",$trim2);
$smallvideocode=$smallvideocode."_joomlaholic_".$trim2;




if ($reqtype=="new") {
$renderinputform=renderinputform($vidlink, $picturelink,$videotitle,$itemcomment,$categorylist,$videoservertype,$smallvideocode);
return $renderinputform;
} else if ($reqtype=="refresh") {
return array ($picturelink, $videotitle, $itemcomment);
}

}



function megavideocomembed($vcode, $vthumb, $downloadcachingnotimeout, $downloadcachingtimeout, $pro, $catid, $setwidth=null, $setheight=null){
global $mosConfig_absolute_path,$mosConfig_live_site;
require($mosConfig_absolute_path.'/administrator/components/com_seyret/seyret_config.php');

$adxml="";
$dlink="";
$unexpectederror="";
$fullmd5cachefile="";
$vdlink="";

$vcode = jalemurldecode($vcode );
$vidwindow = mosGetParam($_REQUEST,'vidwindow',null);
if ($vidwindow=="popup"){
$videowidth=$popupvideowidth;
$videoheight=$popupvideoheight;
}

if ($setwidth>0 AND $setheight>0){
$videowidth=$setwidth;
$videoheight=$setheight;
}


if ($pro=="1"){
$generatenewfile="0";
if ($usevideoadsystem=="1"){
$subdir="ad/";
} else {
$subdir="";
}

//$vthumb=str_replace("&","%26",$vthumb);
$cachefile=$mosConfig_live_site."+megavideocom+".$vcode.$usevideoadsystem;
$md5cachefile=md5($cachefile).".xml";
$fullmd5cachefile=$mosConfig_absolute_path."/seyretfiles/cache/pro/megavideocom/".$subdir.$md5cachefile;
$fullmd5cachefilesite=$mosConfig_live_site."/seyretfiles/cache/pro/megavideocom/".$subdir.$md5cachefile;

if (file_exists($fullmd5cachefile)){
if ($downloadcachingnotimeout<>"yes"){
$cache_file = fopen( $fullmd5cachefile, "r" );
while (!feof($cache_file)) {
$buffer = fgets($cache_file, 1024);
$dlink .= $buffer;
}
fclose ($cache_file);

$pos = strpos($dlink, "<vdtime>")+8;
$post=strpos($dlink, "</vdtime>")-$pos;
$timestamp=substr($dlink,$pos,$post);

$now = date( 'Y-m-d H:i:s', time());
$nowdate=strtotime($now);
$dltime=strtotime($timestamp);
$cacheage=$nowdate-$dltime;
$downloadcachingtimeoutseconds=$downloadcachingtimeout*60;

if ($cacheage>=$downloadcachingtimeoutseconds) $generatenewfile="1";

}

//end of checking cache file
} else {
$generatenewfile="1";
}

if ($generatenewfile=="1"){
$now = date( 'Y-m-d H:i:s', time());
$vcode = jalemurlencode($vcode );

$dwnlink=megavideocomgeneratevideodownloadlink($vcode, $pro, "embed");


if ($usevideoadsystem=="1"){
$videoadlink=generatevideoad($catid);

$adxml="<track>
<title>Ad</title>
<creator>admanager</creator>
<location>".$videoadlink."</location>
<image>".$vthumb."</image>
</track>";
}

$pos = strpos($dwnlink, "<prolink>")+9;
$post=strpos($dwnlink, "</prolink>")-$pos;
$vdlink=substr($dwnlink,$pos,$post);


$makedir=$mosConfig_absolute_path."/seyretfiles/cache";
if (!is_dir($makedir))
{
$oldumask=umask(0);
mkdir ($makedir,0755);
umask($oldumask);
}
$makedir=$mosConfig_absolute_path."/seyretfiles/cache/pro";
if (!is_dir($makedir))
{
$oldumask=umask(0);
mkdir ($makedir,0755);
umask($oldumask);
}

$makedir=$mosConfig_absolute_path."/seyretfiles/cache/pro/megavideocom";
if (!is_dir($makedir))
{
$oldumask=umask(0);
mkdir ($makedir,0755);
umask($oldumask);
}

$makedir=$mosConfig_absolute_path."/seyretfiles/cache/pro/megavideocom/ad";
if (!is_dir($makedir))
{
$oldumask=umask(0);
mkdir ($makedir,0755);
umask($oldumask);
}

if ($vdlink<>""){
$fh=fopen($fullmd5cachefile,'w');


$dlcachetext="<playlist version=\"1\" xmlns=\"http://xspf.org/ns/0/\">
<title>Playlist</title>
<vdtime>".$now."</vdtime>
<trackList>

".$adxml."

<track>
<title>Video</title>
<creator>Seyret</creator>
<location>".$vdlink."</location>
<image>".$vthumb."</image>
<meta rel=\"type\">video/flv</meta>
</track>

</trackList>
</playlist>";

fwrite($fh,$dlcachetext);
fclose($fh);
}
}//end of generate new file

if ($usevideoadsystem=="1") {
$repeat="repeat=true";
} else {
$repeat="repeat=false";
}

require($mosConfig_absolute_path.'/administrator/components/com_seyret/longtail_config.php');

if ($d!="") {
$longtail = "&plugins=ltas&channel=".$c;
} else {
$longtail="";
}

$nohtml = mosGetParam($_REQUEST,'no_html',null);
if ($nohtml!="1") $classid=" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" ";

$random=generaterandom(5);

$embedvideo="<object $classid id=\"seyretpl\" name=\"seyretpl\" width=\"".$videowidth."\" height=\"".$videoheight."\" > <param name=\"allowscriptaccess\" value=\"always\" /> <param name=\"wmode\" value=\"transparent\" /> <param name=\"allowfullscreen\" value=\"true\" /> <param name=\"movie\" value=\"".$mosConfig_live_site."/components/com_seyret/localplayer/player.swf\" /> <param name=\"flashvars\" value=\"width=".$videowidth."&height=".$videoheight."&enablejs=true".$longtail."&file=".$fullmd5cachefilesite."?random=".$random."&image=".$vthumb."&autostart=false&logo=".$mosConfig_live_site."/components/com_seyret/localplayer/logo.png&skin=".$mosConfig_live_site."/components/com_seyret/localplayer/skins/".$playerskin.".swf&$repeat&fullscreen=true\" /> <embed id=\"seyretp\" name=\"seyretp\" src=\"".$mosConfig_live_site."/components/com_seyret/localplayer/player.swf\" flashvars=\"width=".$videowidth."&height=".$videoheight."&enablejs=true".$longtail."&file=".$fullmd5cachefilesite."?random=".$random."&image=".$vthumb."&autostart=false&logo=".$mosConfig_live_site."/components/com_seyret/localplayer/logo.png&skin=".$mosConfig_live_site."/components/com_seyret/localplayer/skins/".$playerskin.".swf&$repeat&fullscreen=true\" width=".$videowidth." height=".$videoheight." allowfullscreen=\"true\" allowscriptaccess=\"always\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" /></object>";

//end of pro
}
$unexpectederror=""; if (!file_exists($fullmd5cachefile) AND $vdlink=="") $unexpectederror="1";
if ($pro<>"1" OR $unexpectederror=="1"){


$vcode=str_replace("_joomlaholic_","",$vcode);




$embedvideo="<object width=\"".$videowidth."\" height=\"".$videoheight."\"><param name=\"movie\" value=\"http://www.megavideo.com/v/".$vcode."\"></param><param name=\"wmode\" value=\"transparent\"></param><embed src=\"http://www.megavideo.com/v/".$vcode."\" type=\"application/x-shockwave-flash\" wmode=\"transparent\" width=\"".$videowidth."\" height=\"".$videoheight."\"></embed></object>";
}



return $embedvideo;

}



function megavideocomgeneratevideodownloadlink($vcode, $pro, $dltask){
global $database, $mosConfig_live_site, $mosConfig_absolute_path;

$vtype="megavideocom";

$pos = strpos($vcode,"_joomlaholic_");
$vcode=substr($vcode,0,$pos);




$database->setQuery("SELECT joomlaalemuserid FROM #__seyret_check");
$check = $database->loadObjectList();
foreach ($check as $check)
{
$joomlaalemuserid=$check->joomlaalemuserid;
}
$siteforjoomlaalem=$mosConfig_live_site;
$siteforjoomlaalem = jalemurlencode( $siteforjoomlaalem );

if ($pro=="1") {
$pro_file=$mosConfig_absolute_path."/administrator/components/com_seyret/sql/pro/spphp.php";
require_once($pro_file);
$str=generateprodlink($vtype, $vcode);

$pos = strpos($str, "<prolink>")+9;
$post=strpos($str, "</prolink>")-$pos;
$dlink=substr($str,$pos,$post);

$pos = strpos($str, "<dltype>")+8;
$post=strpos($str, "</dltype>")-$pos;
$dtype=substr($str,$pos,$post);

if ($dltask<>"embed") {
if ($dtype=="script") {
$downlink="<script>self.location = \"".$dlink."\";</script>";
} else if ($dtype=="save") {
$downlink="<a href=\"".$dlink."\">"._RIGHTCLICKANDSAVE."</a>";
}
return $downlink;

} else {
return $str;
}

} else {
$func="generatedownloadlink";
$link="http://www.joomla-alem.com/index2.php?option=com_joomlaalem&no_html=1&task=".$func."&siteinfo=".$siteforjoomlaalem."&jalemuserid=".$joomlaalemuserid."&vtype=".$vtype."&vcode=".$vcode;
$videodownloadlink=jalem_file_get_contents($link);
return $videodownloadlink;
}

}



function fetchURL($url, $body = false) {
$url_parsed = parse_url($url);
$host = $url_parsed["host"];
if (!isset($url_parsed["port"])) {
$port = 80;
}
else {
$port = $url_parsed["port"];
}
$path = $url_parsed["path"];
if (isset($url_parsed["query"])) $path .= "?" . $url_parsed["query"];
$out = "GET $path HTTP/1.1\r\n" .
"Host: $host\r\n" .
"User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; zh-CN; rv:1.8.1.1) Gecko/20061204 Firefox/2.0.0.1\r\n" .
"Connection: close\r\n\r\n";
$fp = fsockopen(gethostbyname($host), $port, $errno, $errstr, 5);
fwrite($fp, $out);
$in = "";
while (!feof($fp)) {
$s = fgets($fp, 1024);
if ($body) $in .= $s;
if ($s == "\r\n") $body = true;
}
fclose($fp);
return $in;
}

?>

Merci d'avance.
A voir également:

1 réponse

hatchum Messages postés 40 Date d'inscription mardi 16 mars 2010 Statut Membre Dernière intervention 20 octobre 2013 2
21 mars 2010 à 06:49
up s'il vous plait.
0