get_rss_feed.php 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <?php
  2. /**
  3. * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
  4. * CC-BY License - http://creativecommons.org/licenses/by/3.0/
  5. *
  6. * @defgroup DolphinCore Dolphin Core
  7. * @{
  8. */
  9. require_once('./inc/header.inc.php');
  10. $mixedBlockId = bx_process_input(bx_get('ID'));
  11. $aPredefinedRssFeeds = array (
  12. 'boonex_news' => 'http://www.boonex.com/unity/blog/featured_posts/?rss=1',
  13. 'boonex_version' => 'http://rss.boonex.com/',
  14. 'boonex_unity_market' => 'http://www.boonex.com/unity/extensions/latest/?rss=1',
  15. 'boonex_unity_lang_files' => 'http://www.boonex.com/unity/extensions/tag/translations&rss=1',
  16. 'boonex_unity_market_templates' => 'http://www.boonex.com/unity/extensions/tag/templates&rss=1',
  17. 'boonex_unity_market_featured' => 'http://www.boonex.com/unity/extensions/featured_posts?rss=1',
  18. );
  19. $sCont = "";
  20. $aMatches = array();
  21. $sPattern = "/((https?|ftp|news):\/\/)?([a-z]([a-z0-9\-]*\.)+(aero|arpa|biz|com|coop|edu|gov|info|int|jobs|mil|museum|name|nato|net|org|pro|travel|[a-z]{2})|(([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))(\/[a-z0-9_\-\.~]+)*(\/([a-z0-9_\-\.]*)(\?[a-z0-9+_\-\.%=&amp;]*)?)?(#[a-z][a-z0-9_]*)?/";
  22. if(preg_match($sPattern, $mixedBlockId, $aMatches))
  23. $sCont = $aMatches[0];
  24. else if(isset($aPredefinedRssFeeds[$mixedBlockId]))
  25. $sCont = $aPredefinedRssFeeds[$mixedBlockId];
  26. else {
  27. bx_import('BxDolPageQuery');
  28. $oPageQuery = new BxDolPageQuery(array());
  29. $sCont = $oPageQuery->getPageBlockContent($mixedBlockId);
  30. if (!$sCont)
  31. exit;
  32. }
  33. list($sUrl) = explode( '#', $sCont );
  34. $sUrl = str_replace('{SiteUrl}', BX_DOL_URL_ROOT, $sUrl);
  35. $iMemID = bx_process_input(bx_get('member'), BX_DATA_INT);
  36. if ($iMemID) {
  37. $aMember = getProfileInfo( $iMemID );
  38. $sUrl = str_replace( '{NickName}', $aMember['NickName'], $sUrl );
  39. }
  40. header('Content-Type: text/xml; charset=utf-8');
  41. echo bx_file_get_contents($sUrl . (defined('BX_PROFILER') && BX_PROFILER && 0 == strncmp(BX_DOL_URL_ROOT, $sUrl, strlen(BX_DOL_URL_ROOT)) ? '&bx_profiler_disable=1' : ''));
  42. /** @} */