XOOPS  2.6.0
backend.php
Go to the documentation of this file.
1 <?php
2 /*
3  You may not change or alter any portion of this comment or credits
4  of supporting developers from this source code or any supporting source code
5  which is considered copyrighted (c) material of the original comment or credit authors.
6 
7  This program is distributed in the hope that it will be useful,
8  but WITHOUT ANY WARRANTY; without even the implied warranty of
9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
10 */
11 
23 if (file_exists('mainfile.php')) {
24  include __DIR__ . DIRECTORY_SEPARATOR . 'mainfile.php';
25 } else {
26  include '../../' . DIRECTORY_SEPARATOR . 'mainfile.php';
27 }
28 
30 $xoops->disableErrorReporting();
31 
33 
34 if (function_exists('mb_http_output')) {
35  mb_http_output('pass');
36 }
37 header('Content-Type:text/xml; charset=utf-8');
38 $dirname = $xoops->isModule() ? $xoops->module->getVar('dirname'): 'system';
39 $tpl = new XoopsTpl();
40 $tpl->caching = 2;
41 $tpl->cache_lifetime = 3600;
42 if (!$tpl->isCached('module:' . $dirname . '/system_rss.tpl')) {
43  $tpl->assign('channel_title', XoopsLocale::convert_encoding(htmlspecialchars($xoops->getConfig('sitename'), ENT_QUOTES)));
44  $tpl->assign('channel_link', $xoops_url . '/');
45  $tpl->assign('channel_desc', XoopsLocale::convert_encoding(htmlspecialchars($xoops->getConfig('slogan'), ENT_QUOTES)));
46  $tpl->assign('channel_lastbuild', XoopsLocale::formatTimestamp(time(), 'rss'));
47  $tpl->assign('channel_webmaster', $xoops->checkEmail($xoops->getConfig('adminmail'), true));
48  $tpl->assign('channel_editor', $xoops->checkEmail($xoops->getConfig('adminmail'), true));
49  $tpl->assign('channel_category', 'News');
50  $tpl->assign('channel_generator', 'XOOPS');
51  $tpl->assign('channel_language', XoopsLocale::getLangCode());
52 
53  $xoTheme = $xoops->theme();
54  $imgPath = $xoTheme->resourcePath('/images/logo.png');
55  $tpl->assign('image_url', $xoops->url($imgPath));
56  $dimension = getimagesize($xoops->path($imgPath));
57  $tpl->assign('image_width', $dimension[0]);
58  $tpl->assign('image_height', $dimension[1]);
59 
60  $items = array();
61 
62  if ($xoops->isModule()) {
63  /* @var $plugin SystemPluginInterface */
64  $plugin = Xoops_Module_Plugin::getPlugin($dirname, 'system');
65  $res = $plugin->backend(10);
66  if (is_array($res) && count($res)>0) {
67  foreach ($res as $item) {
68  $date[] = array('date' => $item['date']);
69  $items[] = array('date' => XoopsLocale::formatTimestamp($item['date'], 'rss'),
70  'title' => XoopsLocale::convert_encoding(htmlspecialchars($item['title'])),
71  'content' => XoopsLocale::convert_encoding(htmlspecialchars($item['content'])),
72  'link' => $item['link'],
73  'guid' => $item['link'],
74  );
75  }
76  }
77  } else {
78  $plugins = Xoops_Module_Plugin::getPlugins('system');
79  /* @var $plugin SystemPluginInterface */
80  foreach ($plugins as $plugin) {
81  $res = $plugin->backend(10);
82  if (is_array($res) && count($res)>0) {
83  foreach ($res as $item) {
84  $date[] = array('date' => $item['date']);
85  $items[] = array('date' => XoopsLocale::formatTimestamp($item['date'], 'rss'),
86  'title' => XoopsLocale::convert_encoding(htmlspecialchars($item['title'])),
87  'content' => XoopsLocale::convert_encoding(htmlspecialchars($item['content'])),
88  'link' => $item['link'],
89  'guid' => $item['link'],
90  );
91  }
92  }
93  }
94  }
95  array_multisort($date, SORT_DESC, $items);
96  $tpl->assign('items', $items);
97 
98 }
99 $tpl->display('module:' . $dirname . '/system_rss.tpl');
$tpl
Definition: backend.php:39
$xoTheme
Definition: common.php:262
static formatTimestamp($time, $format= 'l', $timeoffset=null)
Definition: Abstract.php:289
$xoops_url
Definition: backend.php:32
if(!$dbm->isConnectable()) $res
static getInstance()
Definition: Xoops.php:160
$imgPath
Definition: thumbrender.php:27
$xoops
Definition: backend.php:29
defined('DS') or define('DS' DIRECTORY_SEPARATOR
Definition: common.php:41
static convert_encoding($text, $to= 'utf-8', $from= '')
Definition: Abstract.php:235
static get($name)
static getLangCode()
Definition: Abstract.php:68
$dirname
Definition: backend.php:38