rss.php 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. header('Content-type: application/xml');
  3. session_start();
  4. $http_host = $_SERVER["HTTP_HOST"];
  5. $doc_root = $_SERVER["DOCUMENT_ROOT"] . "/";
  6. include $doc_root . "functions.php";
  7. $proto = get_protocol();
  8. $con = start_db();
  9. $server = $proto . $http_host;
  10. $lang = select_language($con);
  11. $lserver = $server . "/" . $lang;
  12. $cur_section = "";
  13. $cur_entry = "";
  14. ob_clean();
  15. echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n";
  16. ?>
  17. <rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  18. <channel>
  19. <title>Iñigo Valentin</title>
  20. <link><?=$lserver?></link>
  21. <atom:link href="<?=$lserver?>/rss.xml" rel="self" type="application/rss+xml" />
  22. <description>TODO 3D art</description>
  23. <category>TODO cgi</category>
  24. <image>
  25. <url><?=$lserver?>/img/logo/cover.png</url>
  26. <title>Iñigo Valentin</title>
  27. <link><?=$lserver?></link>
  28. <width>140</width>
  29. <height>140</height>
  30. </image>
  31. <language><?=$lang?></language>
  32. <?php
  33. $res_date = mysqli_query($con, "(SELECT DATE_FORMAT(dtime, '%a, %d %b %Y %H:%i:%s +0100') AS cdate FROM project_version) UNION (SELECT DATE_FORMAT(dtime, '%a, %d %b %Y %H:%i:%s +0100') AS cdate FROM post) ORDER BY cdate DESC LIMIT 1;");
  34. $row_date = mysqli_fetch_array($res_date);
  35. ?>
  36. <pubDate><?=$row_date["cdate"]?></pubDate>
  37. <?php
  38. $res = mysqli_query($con, "SELECT id, permalink, dtime, DATE_FORMAT(dtime, '%a, %d %b %Y %H:%i:%s +0100') AS cdate, title, text, logo AS image FROM project, project_version WHERE project = project.id ORDER BY dtime DESC;");
  39. while ($row = mysqli_fetch_array($res)){
  40. ?>
  41. <item>
  42. <title><?=text($con, $row["title"], $lang)?></title>
  43. <category><?=text($con, $row["type"], $lang)?></category>
  44. <?php
  45. $text = html_entity_decode(text($con, $row["text"], $lang));
  46. ?>
  47. <description>
  48. <![CDATA[
  49. <img src='<?=$lserver?>/img/project/x5/<?=$row["image"]?>' height='160' width='160' />
  50. <?=$text?>
  51. ]]>
  52. </description>
  53. <link><?=$lserver?>/project/<?=$row["permalink"]?></link>
  54. <guid><?=$lserver?>/project/<?=$row["permalink"]?></guid>
  55. <pubDate><?=$row["cdate"]?></pubDate>
  56. </item>
  57. <?php
  58. }
  59. mysqli_close($con);
  60. ?>
  61. </channel>
  62. </rss>