XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
BackendAction.class.php
1<?php
11
12if (!defined('XOOPS_ROOT_PATH')) {
13 exit();
14}
15
16/***
17 * @internal
18 */
19class Legacy_BackendAction extends Legacy_Action
20{
21 public $mItems = [];
22
37 public $mGetRSSItems = null;
38
39 public function __construct($flag)
40 {
41 parent::__construct($flag);
42
43 $this->mGetRSSItems =new XCube_Delegate();
44 $this->mGetRSSItems->register('Legacy_BackendAction.GetRSSItems');
45 }
46
47 public function getDefaultView(&$controll, &$xoopsUser)
48 {
49 $items = [];
50 $this->mGetRSSItems->call(new XCube_Ref($items));
51
52 $sortArr = [];
53 foreach ($items as $item) {
54 $i = (int)$item['pubdate'];
55 for (; isset($sortArr[$i]) ; $i++);
56
57 $sortArr[$i] = $item;
58 }
59 krsort($sortArr);
60 $this->mItems = $sortArr;
61 return LEGACY_FRAME_VIEW_INDEX;
62 }
63
64 public function executeViewIndex(&$controller, &$xoopsUser, &$render)
65 {
66 $xoopsConfig = $controller->mRoot->mContext->mXoopsConfig;
67
68 //
69 // Set up the render buffer.
70 //
71 $renderSystem =& $controller->mRoot->getRenderSystem('Legacy_RenderSystem');
72
73 $renderTarget =& $renderSystem->createRenderTarget('main');
74
75 $renderTarget->setTemplateName('legacy_rss.html');
76
77 $renderTarget->setAttribute('channel_title', $xoopsConfig['sitename']);
78 $renderTarget->setAttribute('channel_link', XOOPS_URL . '/');
79 $renderTarget->setAttribute('channel_desc', $xoopsConfig['slogan']);
80 $renderTarget->setAttribute('channel_lastbuild', formatTimestamp(time(), 'rss'));
81 $renderTarget->setAttribute('channel_webmaster', $xoopsConfig['adminmail']);
82 $renderTarget->setAttribute('channel_editor', $xoopsConfig['adminmail']);
83 $renderTarget->setAttribute('channel_category', 'News');
84 $renderTarget->setAttribute('channel_generator', 'XOOPSCube');
85 $renderTarget->setAttribute('image_url', XOOPS_URL . '/images/logo.png'); /* Image must be in the GIF, JPEG or PNG formats.*/
86
87 $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.png');
88
89 $width = 0;
90 if (empty($dimention[0])) {
91 $width = 88;
92 } else {
93 $width = ($dimention[0] > 144) ? 144 : $dimention[0];
94 }
95
96 $height = 0;
97 if (empty($dimention[1])) {
98 $height = 31;
99 } else {
100 $height = ($dimention[1] > 400) ? 400 : $dimention[1];
101 }
102
103 $renderTarget->setAttribute('image_width', $width);
104 $renderTarget->setAttribute('image_height', $height);
105 $renderTarget->setAttribute('items', $this->mItems);
106
107 //
108 // Rendering
109 //
110 $renderSystem->render($renderTarget);
111
112 if (function_exists('mb_http_output')) {
113 mb_http_output('pass');
114 }
115 header('Content-Type:text/xml; charset=utf-8');
116
117
118 print xoops_utf8_encode($renderTarget->getResult());
119
120 exit(0);
121 }
122}
[Final] Used for the simple mechanism for common delegation in XCube.