Je cherche a modifié un petit script que j'avais pour xoops, qui permet a d'autre site d'affiche nos news sur leur site via un code javascript, et pas par le backend.
Voilà le script :
CODE |
// Hacked from backend.php by lykoszine@yahoo.co.uk // Uses the following CSS classes: // rss_title // rss_body // rss_footer $filename = "backendjs.txt"; //File to read/write $timespan = 3600; //1 hours (if the file is more recent than this, it will not be updated) include("mainfile.php"); $fd = fopen($filename,"rb"); if($fd and (time() - filemtime ($filename) < $timespan)) { $contents = fread ($fd, filesize ($filename)); echo $contents; fclose ($fd); } else { fclose ($fd); $sql = "SELECT storyid, title FROM ".$xoopsDB->prefix("stories")." WHERE published>0 AND published<".time()." ORDER BY published DESC"; $result = $xoopsDB->query($sql,10,0); if ( !$result ) { echo "An error occured"; } else { $fd = fopen ($filename, "w+b"); $temp = "document.write('<div class=\"rss_title\">"; $temp .= "<a href=\"".XOOPS_URL."\" target=\"_blank\">".$xoopsConfig['sitename']. "</a><br></div>');\n"; while ( $myrow = $xoopsDB->fetchArray($result)) { $myrow = str_replace("(", "-", $myrow); $myrow = str_replace(")", "-", $myrow); $myrow = str_replace("'", "", $myrow); $temp .= "document.write('<LI><span class=\"rss_body\"><A HREF=\"".XOOPS_URL."/modules/news/article.php?storyid=".$myrow['storyid']."\" target=\"_blank\">"; $temp .= $myrow['title']."</a></span><br>');\n"; } $t = formatTimeStamp(time(),"m","".$xoopsConfig['server_TZ'].""); } echo $temp; fwrite ($fd, $temp, strlen($temp)); fclose ($fd); } ?> |
Ca doit pas être dur a modifié, mais j'ai pas réussi ! Rien ne s'affiche
S'il y a des pro en php-nuke, ils pourront peut-être m'aider.