-
Notifications
You must be signed in to change notification settings - Fork 138
/
rss_factory.php
77 lines (65 loc) · 2.96 KB
/
rss_factory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
<?php
/**
* Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
* CC-BY License - http://creativecommons.org/licenses/by/3.0/
*/
require_once( 'inc/header.inc.php' );
require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolRssFactory.php' );
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());
}
actionRSS();