source: trunk/rss_factory.php

Last change on this file was 2, checked in by george, 14 years ago
  • Přidáno: Trunk revize 13719.
File size: 2.1 KB
Line 
1<?php
2
3require_once( 'inc/header.inc.php' );
4require_once( BX_DIRECTORY_PATH_INC . 'design.inc.php' );
5require_once( BX_DIRECTORY_PATH_CLASSES . 'BxDolRssFactory.php' );
6
7function actionRSS() {
8 $sType = process_db_input($_REQUEST['action'], BX_TAGS_STRIP);
9 $iLength = (int)$_REQUEST['length'];
10
11 if(strncmp($sType, 'sys_', 4) == 0) {
12 $aRssTitle = '';
13 $aRssData = array();
14
15 switch($sType) {
16 case 'sys_stats':
17 $aRssTitle = getParam('site_title');
18
19 $sStatFile = BX_DIRECTORY_PATH_DBCACHE . 'sys_stat_site.inc';
20 if(file_exists($sStatFile)) {
21 $aStats = @eval(@file_get_contents($sStatFile));
22
23 foreach($aStats as $sKey => $aStat) {
24 $iNum = strlen($aStat['query']) > 0 ? db_value($aStat['query']) : 0;
25
26 $aRssData[] = array(
27 'UnitID' => $sKey,
28 'OwnerID' => '',
29 'UnitTitle' => $iNum . ' ' . _t('_' . $aStat['capt']),
30 'UnitLink' => strlen($aStat['link']) > 0 ? BX_DOL_URL_ROOT . $aStat['link'] : '',
31 'UnitDesc' => '',
32 'UnitDateTimeUTS' => 0,
33 'UnitIcon' => ''
34 );
35 }
36 }
37 break;
38
39 case 'sys_members':
40 $aRssTitle = getParam('site_title');
41
42 $iLength = $iLength != 0 ? $iLength : 33;
43 $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);
44 foreach($aMembers as $aMember) {
45 $aRssData[] = array(
46 'UnitID' => '',
47 'OwnerID' => '',
48 'UnitTitle' => $aMember['NickName'],
49 'UnitLink' => getProfileLink($aMember['ID']),
50 'UnitDesc' => $GLOBALS['oFunctions']->getMemberAvatar($aMember['ID']),
51 'UnitDateTimeUTS' => $aMember['DateRegUTS'],
52 'UnitIcon' => ''
53 );
54 }
55 break;
56
57 case 'sys_news':
58 echo BxDolService::call('news', 'news_rss', array($iLength));
59 return;
60 }
61
62 $oRss = new BxDolRssFactory();
63 echo $oRss->GenRssByData($aRssData, $aRssTitle, '');
64 }
65 else
66 BxDolService::call($sType, $sType . '_rss', array());
67}
68
69actionRSS();
70?>
Note: See TracBrowser for help on using the repository browser.