HomeHelpTrac

source: trunk/rss_factory.php @ 15211

Revision 15211, 3.2 KB checked in by Alexander Trofimov, 12 months ago (diff)

Code cleaning:

  • converting new lines to \n
  • deleting spaces at the end of every line
  • converting all tabs to 4 spaces
  • automated script for future cleaning was added
Line 
1<?php
2/**
3 * @package     Dolphin Core
4 * @copyright   Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
5 * @license     CC-BY - http://creativecommons.org/licenses/by/3.0/
6 */
7
8require_once('./inc/header.inc.php');
9require_once(BX_DIRECTORY_PATH_INC . "languages.inc.php");
10require_once(BX_DIRECTORY_PATH_INC . "params.inc.php");
11
12function actionRSS() {
13
14    $sType = isset($_REQUEST['action']) ? bx_process_input($_REQUEST['action']) : '';
15    $iLength = isset($_REQUEST['length']) ? bx_process_input($_REQUEST['length'], BX_DATA_INT) : 0;
16    $oDb = BxDolDb::getInstance();
17
18    if(strncmp($sType, 'sys_', 4) == 0) {
19        $aRssTitle = '';
20        $aRssData = array();
21
22        switch($sType) {
23            case 'sys_stats':
24                $aRssTitle = getParam('site_title');
25
26                $oCache = $oDb->getDbCacheObject();
27                $aStats = $oCache->getData($oDb->genDbCacheKey('sys_stat_site'));
28                if (null === $aStats) {
29                    genSiteStatCache();
30                    $aStats = $oCache->getData($oDb->genDbCacheKey('sys_stat_site'));
31                }
32
33                if ($aStats && is_array($aStats)) {
34                    foreach ($aStats as $sKey => $aStat) {
35                        $iNum = $aStat['query'] ? $oDb->getOne($aStat['query']) : 0;
36
37                        $aRssData[] = array(
38                           'UnitID' => $sKey,
39                           'OwnerID' => '',
40                           'UnitTitle' => $iNum . ' ' . _t('_' . $aStat['capt']),
41                           'UnitLink' => $aStat['link'] ? BX_DOL_URL_ROOT . $aStat['link'] : '',
42                           'UnitDesc' => '',
43                           'UnitDateTimeUTS' => 0,
44                           'UnitIcon' => ''
45                        );
46                    }
47                }
48                break;
49
50            case 'sys_members':
51                bx_import('BxTemplFunctions');
52                $oFunctions = BxTemplFunctions::getInstance();
53
54                $aRssTitle = getParam('site_title');
55                $iLength = $iLength != 0 ? $iLength : 33;
56                $aMembers = $oDb->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 " . (int)$iLength);
57                foreach($aMembers as $aMember) {
58                    $aRssData[] = array(
59                       'UnitID' => '',
60                       'OwnerID' => '',
61                       'UnitTitle' => $aMember['NickName'],
62                       'UnitLink' => getProfileLink($aMember['ID']),
63                       'UnitDesc' => $oFunctions->getMemberAvatar($aMember['ID']),
64                       'UnitDateTimeUTS' => $aMember['DateRegUTS'],
65                       'UnitIcon' => ''
66                    );
67                }
68                break;
69
70            case 'sys_news':
71                echo BxDolService::call('news', 'news_rss', array($iLength));
72                return;
73        }
74
75        bx_import('BxDolRssFactory');
76        $oRss = new BxDolRssFactory();
77        echo $oRss->GenRssByData($aRssData, $aRssTitle, '');
78
79    } else {
80        BxDolService::call($sType, $sType . '_rss', array());
81    }
82}
83
84actionRSS();
85
Note: See TracBrowser for help on using the repository browser.