예제 #1
0
function actionRSS()
{
    $sType = process_db_input($_REQUEST['action'], BX_TAGS_STRIP);
    $iLength = (int) $_REQUEST['length'];
    if (strncmp($sType, 'sys_', 4) === 0) {
        $aRssTitle = '';
        $aRssData = array();
        switch ($sType) {
            case 'sys_stats':
                $aRssTitle = getParam('site_title');
                $oCache = $GLOBALS['MySQL']->getDbCacheObject();
                $aStats = $oCache->getData($GLOBALS['MySQL']->genDbCacheKey('sys_stat_site'));
                if (null === $aStats) {
                    genSiteStatCache();
                    $aStats = $oCache->getData($GLOBALS['MySQL']->genDbCacheKey('sys_stat_site'));
                }
                if ($aStats && is_array($aStats)) {
                    foreach ($aStats as $sKey => $aStat) {
                        $iNum = strlen($aStat['query']) > 0 ? db_value($aStat['query']) : 0;
                        $aRssData[] = array('UnitID' => $sKey, 'OwnerID' => '', 'UnitTitle' => $iNum . ' ' . _t('_' . $aStat['capt']), 'UnitLink' => strlen($aStat['link']) > 0 ? BX_DOL_URL_ROOT . $aStat['link'] : '', 'UnitDesc' => '', 'UnitDateTimeUTS' => 0, 'UnitIcon' => '');
                    }
                }
                break;
            case 'sys_members':
                $aRssTitle = getParam('site_title');
                $iLength = $iLength != 0 ? $iLength : 33;
                $aMembers = $GLOBALS['MySQL']->getAll("SELECT *, UNIX_TIMESTAMP(`DateReg`) AS `DateRegUTS` FROM `Profiles` WHERE 1 AND (`Couple`='0' OR `Couple`>`ID`) AND `Status`='Active' ORDER BY `DateReg` DESC LIMIT " . $iLength);
                foreach ($aMembers as $aMember) {
                    $aRssData[] = array('UnitID' => '', 'OwnerID' => '', 'UnitTitle' => $aMember['NickName'], 'UnitLink' => getProfileLink($aMember['ID']), 'UnitDesc' => $GLOBALS['oFunctions']->getMemberAvatar($aMember['ID']), 'UnitDateTimeUTS' => $aMember['DateRegUTS'], 'UnitIcon' => '');
                }
                break;
            case 'sys_news':
                echo BxDolService::call('news', 'news_rss', array($iLength));
                return;
        }
        $oRss = new BxDolRssFactory();
        echo $oRss->GenRssByData($aRssData, $aRssTitle, '');
    } else {
        BxDolService::call($sType, $sType . '_rss', array());
    }
}
예제 #2
0
 /**
  * Printing of member`s blog post rss feeds
  *
  * @param bx_get('pid') - member id
  *
  * @return html of blog posts of member
  */
 function serviceBlogsRss()
 {
     $iPID = (int) bx_get('pid');
     $aRssUnits = $this->_oDb->getMemberPostsRSS($iPID);
     if (is_array($aRssUnits) && count($aRssUnits) > 0) {
         foreach ($aRssUnits as $iUnitID => $aUnitInfo) {
             $sPostLink = '';
             $iPostID = (int) $aUnitInfo['UnitID'];
             $aPost = array('Permalink' => $aUnitInfo['UnitUri'], 'Link' => $iPostID);
             $sPostLink = $this->genBlogLink('show_member_post', $aUser, '', $aPost);
             $aRssUnits[$iUnitID]['UnitLink'] = $sPostLink;
             $sFileName = $this->_oDb->getPostPhotoByID($iPostID);
             $sPostPhoto = $sFileName != '' ? BX_BLOGS_IMAGES_URL . 'big_' . $sFileName : '';
             $aRssUnits[$iUnitID]['UnitIcon'] = $sPostPhoto;
         }
         $sUnitTitleC = _t('_bx_blog_Blogs');
         $sMainLink = 'rss_factory.php?action=blogs&pid=' . $iPID;
         bx_import('BxDolRssFactory');
         $oRssFactory = new BxDolRssFactory();
         header('Content-Type: text/xml; charset=utf-8');
         echo $oRssFactory->GenRssByData($aRssUnits, $sUnitTitleC, $sMainLink);
         exit;
     }
 }
예제 #3
0
 /**
  * Printing of member`s ads rss feeds
  *
  * @param bx_get('pid') - member id
  *
  * @return html of ads units of member
  */
 function serviceAdsRss()
 {
     $iPID = (int) bx_get('pid');
     $aRssUnits = $this->_oDb->getMemberAdsRSS($iPID);
     if (is_array($aRssUnits) && count($aRssUnits) > 0) {
         foreach ($aRssUnits as $iUnitID => $aUnitInfo) {
             $sPostLink = '';
             $iPostID = (int) $aUnitInfo['UnitID'];
             $sGenUrl = $this->genUrl($iPostID, $aUnitInfo['UnitUri']);
             $aRssUnits[$iUnitID]['UnitLink'] = $sPostLink;
         }
         $sUnitTitleC = _t('_bx_ads_Ads');
         $sMainLink = 'modules/boonex/ads/classifieds.php';
         bx_import('BxDolRssFactory');
         $oRssFactory = new BxDolRssFactory();
         echo $oRssFactory->GenRssByData($aRssUnits, $sUnitTitleC, $sMainLink);
     }
 }
예제 #4
0
 /**
  * Get RSS for specified owner.
  *
  * @param  string $sUsername wall owner username
  * @return string with RSS.
  */
 function actionRss($sUsername)
 {
     $aOwner = $this->_oDb->getUser($sUsername, 'username');
     $aEvents = $this->_oDb->getEvents(array('type' => 'owner', 'owner_id' => $aOwner['id'], 'order' => 'desc', 'start' => 0, 'count' => $this->_oConfig->getRssLength(), 'filter' => ''));
     $sRssBaseUrl = $this->_oConfig->getBaseUri() . 'index/' . $aOwner['username'] . '/';
     $aRssData = array();
     foreach ($aEvents as $aEvent) {
         if (empty($aEvent['title'])) {
             continue;
         }
         $aRssData[$aEvent['id']] = array('UnitID' => $aEvent['id'], 'OwnerID' => $aOwner['id'], 'UnitTitle' => $aEvent['title'], 'UnitLink' => BX_DOL_URL_ROOT . $sRssBaseUrl . '#wall-event-' . $aEvent['id'], 'UnitDesc' => $aEvent['description'], 'UnitDateTimeUTS' => $aEvent['date'], 'UnitIcon' => '');
     }
     $oRss = new BxDolRssFactory();
     header('Content-Type: text/html; charset=utf-8');
     return $oRss->GenRssByData($aRssData, $aOwner['username'] . ' ' . _t('_wall_rss_caption'), $sRssBaseUrl);
 }
예제 #5
0
 /**
  * Action methods
  */
 function actionRss($iLength = 0)
 {
     $iLength = $iLength != 0 ? $iLength : (int) $this->_oConfig->getRssLength();
     $aEntries = $this->_oDb->getEntries(array('sample_type' => 'archive', 'viewer_type' => $this->_oTextData->getViewerType(), 'start' => 0, 'count' => $iLength));
     $aRssData = array();
     $sRssViewUrl = BX_DOL_URL_ROOT . $this->_oConfig->getBaseUri() . 'view/';
     foreach ($aEntries as $aEntry) {
         if (empty($aEntry['caption'])) {
             continue;
         }
         $aRssData[$aEntry['id']] = array('UnitID' => $aEntry['id'], 'OwnerID' => $aEntry['id'], 'UnitTitle' => $aEntry['caption'], 'UnitLink' => $sRssViewUrl . $aEntry['uri'], 'UnitDesc' => $aEntry['content'], 'UnitDateTimeUTS' => $aEntry['when_uts'], 'UnitIcon' => '');
     }
     $oRss = new BxDolRssFactory();
     return $oRss->GenRssByData($aRssData, _t('_news_rss_caption'), $this->_oConfig->getBaseUri() . 'act_rss/');
 }
예제 #6
0
 /**
  * Get XML string for rss output
  */
 function rss()
 {
     if (!isset($this->aCurrent['rss']['fields']) || !isset($this->aCurrent['rss']['link'])) {
         return '';
     }
     $aData = $this->getSearchData();
     $f =& $this->aCurrent['rss']['fields'];
     if ($aData) {
         foreach ($aData as $k => $a) {
             $aData[$k][$f['Link']] = $this->getRssUnitLink($a);
         }
     }
     bx_import('BxDolRssFactory');
     $oRss = new BxDolRssFactory();
     return $oRss->GenRssByCustomData($aData, isset($this->aCurrent['rss']['title']) && $this->aCurrent['rss']['title'] ? $this->aCurrent['rss']['title'] : $this->aCurrent['title'], $this->aCurrent['rss']['link'], $this->aCurrent['rss']['fields'], isset($this->aCurrent['rss']['image']) ? $this->aCurrent['rss']['image'] : '', isset($this->aCurrent['rss']['profile']) ? $this->aCurrent['rss']['profile'] : 0);
 }
예제 #7
0
 function actionRss($iOwnerId)
 {
     list($sUserName) = $this->getUserInfo($iOwnerId);
     $sRssCaption = _t('_bx_timeline_txt_rss_caption', $sUserName);
     $sRssLink = $this->_oConfig->getViewUrl($iOwnerId);
     $aParams = $this->_prepareParams('owner', $iOwnerId, 0, $this->_oConfig->getRssLength(), '', array(), 0);
     $aEvents = $this->_oDb->getEvents($aParams);
     $aRssData = array();
     foreach ($aEvents as $aEvent) {
         if (empty($aEvent['title'])) {
             continue;
         }
         $aRssData[$aEvent['id']] = array('UnitID' => $aEvent['id'], 'UnitTitle' => $aEvent['title'], 'UnitLink' => $this->_oConfig->getItemViewUrl($aEvent), 'UnitDesc' => $aEvent['description'], 'UnitDateTimeUTS' => $aEvent['date']);
     }
     bx_import('BxDolRssFactory');
     $oRss = new BxDolRssFactory();
     header('Content-Type: application/xml; charset=utf-8');
     echo $oRss->GenRssByData($aRssData, $sRssCaption, $sRssLink);
 }
예제 #8
0
 function rss()
 {
     if (!isset($this->aCurrent['rss']['fields']) || !isset($this->aCurrent['rss']['link'])) {
         return '';
     }
     $aData = $this->getSearchData();
     $f =& $this->aCurrent['rss']['fields'];
     if ($aData) {
         foreach ($aData as $k => $a) {
             $aData[$k][$f['Link']] = $this->getRssUnitLink($a);
         }
     }
     require_once BX_DIRECTORY_PATH_CLASSES . 'BxDolRssFactory.php';
     $oRss = new BxDolRssFactory();
     return $oRss->GenRssByCustomData($aData, $this->aCurrent['rss']['title'] ? $this->aCurrent['rss']['title'] : $this->aCurrent['title'], $this->aCurrent['rss']['link'], $this->aCurrent['rss']['fields'], isset($this->aCurrent['rss']['image']) ? $this->aCurrent['rss']['image'] : '', isset($this->aCurrent['rss']['profile']) ? $this->aCurrent['rss']['profile'] : 0);
 }