Advertisement
Guest User

wxr.php

a guest
Mar 26th, 2013
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.80 KB | None | 0 0
  1. <?
  2.  
  3. /**
  4.   * Nucleus: PHP/MySQL Weblog CMS (http://nucleuscms.org/)
  5.   * Copyright (C) 2002 The Nucleus Group
  6.   *
  7.   * This program is free software; you can redistribute it and/or
  8.   * modify it under the terms of the GNU General Public License
  9.   * as published by the Free Software Foundation; either version 2
  10.   * of the License, or (at your option) any later version.
  11.   * (see nucleus/documentation/index.html#license for more info)
  12.   *
  13.   * Nucleus RSS syndication channel skin
  14.   */
  15.  
  16. header("Pragma: no-cache");
  17.  
  18. // $CONF['Self'] = $PHP_SELF;
  19. $CONF['Self'] = "wxr.php";
  20.  
  21. include('config.php');
  22.  
  23. if (!$CONF['DisableSite']) {
  24.         // get feed into $feed
  25.         ob_start();
  26.                 selectSkin('wxr');
  27.                 selector();
  28.         $feed = ob_get_contents();
  29.         ob_end_clean();
  30.        
  31.         // create ETAG (hash of feed)
  32.         $eTag = md5($feed);    
  33.         header('Etag: "'.$eTag.'"');
  34.        
  35.         // compare Etag to what we got
  36.         // TODO: serverVar doesn't seem to work :((
  37.         if ($eTag == serverVar('HTTP_IF_NONE_MATCH')) {
  38.                 header("HTTP/1.0 304 Not Modified");
  39.                 header('Content-Length: 0');
  40.         } else {
  41.                 // dump feed
  42.                 echo $feed;
  43.         }
  44.                
  45. } else {
  46.         // output empty RSS file...
  47.         // (because site is disabled)
  48.        
  49.         echo '<' . '?xml version="1.0" encoding="ISO-8859-1"?' . '>';
  50.        
  51.         ?>
  52.         <rss version="2.0">
  53.           <channel>
  54.             <title><?=htmlspecialchars($CONF['SiteName'])?></title>
  55.             <link><?=htmlspecialchars($CONF['IndexURL'])?></link>
  56.             <description></description>
  57.             <docs>http://backend.userland.com/rss</docs>
  58.           </channel>
  59.         </rss>  
  60.         <?
  61. }
  62.  
  63. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement