Minahito
minah****@users*****
2006年 5月 26日 (金) 13:22:54 JST
Index: xoops2jp/html/modules/base/actions/BackendAction.class.php diff -u /dev/null xoops2jp/html/modules/base/actions/BackendAction.class.php:1.1.2.1 --- /dev/null Fri May 26 13:22:54 2006 +++ xoops2jp/html/modules/base/actions/BackendAction.class.php Fri May 26 13:22:54 2006 @@ -0,0 +1,109 @@ +<?php + +if (!defined('XOOPS_ROOT_PATH')) exit(); + +class Legacy_BackendAction extends Legacy_Action +{ + var $mItems = array(); + + function getDefaultView(&$controll, &$xoopsUser) + { + $items= $this->_getRSSInformation(); + + $sortArr = array(); + foreach ($items as $item) { + $i = intval($item['pubdate']); + for (; isset($sortArr[$i]) ; $i++); + + $sortArr[$i] = $item; + } + + $this->mItems = krsort($sortArr); + + return LEGACY_FRAME_VIEW_INDEX; + } + + /** + * The spec of getRSS(): + * append your RSS item to $eventArgs array. You don't need to sanitize your values. Use raw value. + * + * $item['title'] + * $item['link'] ... permanent link + * $item['guid'] ... permanent link + * $item['pubdate'] ... unixtime + * $item['description'] ... not required. + */ + function _getRSSInformation() + { + $root =& XCube_Root::getSingleton(); + $eventArgs = array(); + $root->mEventManager->raiseEvent("Module.Legacy.Backend.getRSS", $this, $eventArgs); + + return $eventArgs; + } + + function executeViewIndex(&$controller, &$xoopsUser, &$render) + { + global $xoopsConfig; + + // + // Set up the render buffer. + // + $renderTarget =& new XCube_RenderTarget(); + $renderTarget->setType(XCUBE_RENDER_TARGET_TYPE_MAIN); + + $renderTarget->setTemplateName("legacy_rss.html"); + + $renderTarget->setAttribute('channel_title', $xoopsConfig['sitename']); + $renderTarget->setAttribute('channel_link', XOOPS_URL . '/'); + $renderTarget->setAttribute('channel_desc', $xoopsConfig['slogan']); + $renderTarget->setAttribute('channel_lastbuild', formatTimestamp(time(), 'rss')); + $renderTarget->setAttribute('channel_webmaster', $xoopsConfig['adminmail']); + $renderTarget->setAttribute('channel_editor', $xoopsConfig['adminmail']); + $renderTarget->setAttribute('channel_category', 'News'); + $renderTarget->setAttribute('channel_generator', 'XOOPS Cube'); + $renderTarget->setAttribute('image_url', XOOPS_URL . '/images/logo.gif'); + + $dimention = getimagesize(XOOPS_ROOT_PATH . '/images/logo.gif'); + + $width = 0; + if (empty($dimention[0])) { + $width = 88; + } + else { + $width = ($dimention[0] > 144) ? 144 : $dimention[0]; + } + + $height = 0; + if (empty($dimention[1])) { + $height = 31; + } else { + $height = ($dimention[1] > 400) ? 400 : $dimention[1]; + } + + $renderTarget->setAttribute('image_width', $width); + $renderTarget->setAttribute('image_height', $height); + + $renderTarget->setAttribute('items', $this->mItems); + + // + // Rendering + // + $controller->mRenderSystem->renderWithTarget($renderTarget); + + // $count = $sarray; + // foreach ($sarray as $story) { + // $tpl->append('items', array('title' => xoops_utf8_encode(htmlspecialchars($story->title(), ENT_QUOTES)), 'link' => XOOPS_URL.'/modules/news/article.php?storyid='.$story->storyid(), 'guid' => XOOPS_URL.'/modules/news/article.php?storyid='.$story->storyid(), 'pubdate' => formatTimestamp($story->published(), 'rss'), 'description' => xoops_utf8_encode(htmlspecialchars($story->hometext(), ENT_QUOTES)))); + // } + + if (function_exists('mb_http_output')) { + mb_http_output('pass'); + } + header ('Content-Type:text/xml; charset=utf-8'); + + + print xoops_utf8_encode($renderTarget->getResult()); + + exit(0); + } +}