<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>PHP Director -Youtube Image Fixer</title>
</head>
<body>
<?php
require("config.php");
$mysql_link = mysql_connect($cfg["db_host"], $cfg["db_user"], $cfg["db_pass"]) or die(mysql_error());
echo "Connected<br />";
mysql_select_db($cfg["db_name"], $mysql_link) or die(mysql_error());
echo "Selected DB<br />";
//$sql = "SELECT * FROM `pp_files` WHERE `picture` LIKE '%static-02%'";
$sql = "SELECT * FROM `pp_files` WHERE `picture` LIKE '%static-%' AND `video_type` = 'dailymotion'";
echo "Found Images<br />";
$result = mysql_query($sql, $mysql_link);
while ($row = mysql_fetch_array($result)) {
$id = $row['id'];
echo '<br /><b>Old Url</b>'.$row['picture'].'<br />';
$motion = explode(".dailymotion.com", $row['picture']);
// echo "http://limelight-450.static.dailymotion.com".$motion[1];
echo '<img src="http://limelight-450.static.dailymotion.com'.$motion[1].'" />';
echo "<br />";
mysql_query('UPDATE `pp_files` SET `picture` = \'http://limelight-450.static.dailymotion.com'.$motion[1].'\' WHERE id = '.$id.' LIMIT 1;');
}
mysql_free_result($result);
?>
---<br /><br />
---<br />
Thanks for using the script
</body>
</html>
non y'a pas plus recent, peut tu poster le lien du patch que t'a essayé?hm19000 a dit:ca n'as pas marché !!! j'utilise la version 0.21 peut etre qu'il y a une version plus récente
<?php
function getdmid($url){
//checks if valid youtube link
$checkdm = explode(".", $url);
if ($checkdm[1] == "dailymotion" ){
//gets vid id
$dm_start = explode("/video/",$url,2);
$dm_end = explode("&",$dm_start[1],2);
$gotid = $dm_end[0];
return $gotid;
}
}
/**
* Gets thumb from dailymotion id
*
* @param dailymotion Id
* @return $dm_pic
*/
function getthumb($file){
$dm_xml_pic_start = explode("/preview/",$file,2);
$dm_xml_pic_end = explode("?",$dm_xml_pic_start[1],2);
$dm_pic = $dm_xml_pic_end[0];
$dm_pic_1 = "http://limelight-450.static.dailymotion.com/dyn/preview/160x120/".$dm_pic;
return $dm_pic_1;
}
/**
* Gets Author from dailymotion id
*
* @param dailymotion Id
* @return $dm_author
*/
function getauthor($file){
$dm_xml_pic_start = explode("<author><name>",$file,2);
$dm_xml_pic_end = explode("</name><uri>",$dm_xml_pic_start[1],2);
$dm_pic = $dm_xml_pic_end[0];
return $dm_pic;
}
/**
* Gets Title from dailymotion id
*
* @param dailymotion Id
* @return $dm_title_noslash
*/
function gettitle($file){
$dm_xml_pic_start = explode("<title>",$file,2);
$dm_xml_pic_end = explode("</title>",$dm_xml_pic_start[1],2);
$dm_pic = $dm_xml_pic_end[0];
return $dm_pic;
}
/**
* Gets description from dailymotion id
*
* @param dailymotion Id
* @return $dm_description
*/
function getdescription($file){
$dm_xml_pic_start = explode("<content type=\"html\">",$file,2);
$dm_xml_pic_end = explode("<",$dm_xml_pic_start[1],2);
$dm_pic = $dm_xml_pic_end[0];
return $dm_pic;
}
/**
* Gets description from dailymotion id
*
* @param dailymotion Id
* @return $dm_description
*/
function getswf($file){
$dm_xml_pic_start = explode("/swf/",$file,2);
$dm_xml_pic_end = explode("\"",$dm_xml_pic_start[1],2);
$dm_pic = $dm_xml_pic_end[0];
return $dm_pic;
}
$did = getdmid($videourl);
$file = @file_get_contents("http://www.dailymotion.com/atom/fr/cluster/extreme/featured/video/".$did);
$videoid = getswf($file);
if($did != null){
$title = safe_sql_insert(gettitle($file));
$author = safe_sql_insert(getauthor($file));
$des = safe_sql_insert(getdescription($file));
$thumb[0] = safe_sql_insert(getthumb($file));
$file = safe_sql_insert(getswf($file));
$ip = safe_sql_insert($_SERVER['REMOTE_ADDR']);
$smarty->assign('file2', $did);
$smarty->assign('title', $title);
$smarty->assign('author', $author);
$smarty->assign('description', $des);
$smarty->assign('image', $thumb);
$smarty->assign('videoid', $file);
$smarty->assign('vidtype', 'dailymotion');
}//check for blank end
$didfile = mysql_query("SELECT * FROM `pp_files` WHERE `file2` = CONVERT(_utf8 '$did' USING latin1) COLLATE latin1_swedish_ci LIMIT 0 , 1")or die(mysql_error());
$rowdid = mysql_fetch_array($didfile);
if ($rowdid['file2'] == $did){
$smarty->assign('error', 'This Video Has Allready Been Submitted');
$smarty->display('error.tpl');
exit;
}
?>