Completed
Push — master ( 369c90...324e29 )
by Michael
04:57
created

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
/**
3
 * ****************************************************************************
4
 * references - MODULE FOR XOOPS
5
 * Copyright (c) Herv� Thouzard of Instant Zero (http://www.instant-zero.com)
6
 *
7
 * You may not change or alter any portion of this comment or credits
8
 * of supporting developers from this source code or any supporting source code
9
 * which is considered copyrighted (c) material of the original comment or credit authors.
10
 * This program is distributed in the hope that it will be useful,
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
13
 *
14
 * @copyright       Herv� Thouzard of Instant Zero (http://www.instant-zero.com)
15
 * @license         http://www.fsf.org/copyleft/gpl.html GNU public license
16
 * @package         references
17
 * @author 			Herv� Thouzard of Instant Zero (http://www.instant-zero.com)
18
 *
19
 * Version : $Id:
20
 * ****************************************************************************
21
 */
22
23
/**
24
 * Flux RSS
25
 */
26
require 'header.php';
27
require_once XOOPS_ROOT_PATH.'/class/template.php';
28
error_reporting(0);
29
@$xoopsLogger->activated = false;
30
31
if(!references_utils::getModuleOption('use_rss')) {
32
    exit(_ERRORS);
33
}
34
35
if (function_exists('mb_http_output')) {
36
	mb_http_output('pass');
37
}
38
$charset = 'utf-8';
39
header ('Content-Type:text/xml; charset='.$charset);
40
41
$tpl = new XoopsTpl();
42
$tpl->xoops_setCaching(2);					                                    // 1 = Cache global, 2 = Cache individuel (par template)
43
$tpl->xoops_setCacheTime(references_utils::getModuleOption('rss_cache_time'));	// Temps de cache en secondes
44
$uid = references_utils::getCurrentUserID();
45
if (!$tpl->is_cached('db:references_rss.html', $uid)) {
46
	$categoryTitle = '';
47
	global $xoopsConfig;
48
	$sitename = htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES);
49
	$email = $xoopsConfig['adminmail'];
50
	$slogan = htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES);
51
52
	$tpl->assign('charset',$charset);
53
	$tpl->assign('channel_title', xoops_utf8_encode($sitename));
54
	$tpl->assign('channel_link', XOOPS_URL.'/');
55
	$tpl->assign('channel_desc', xoops_utf8_encode($slogan));
56
	$tpl->assign('channel_lastbuild', formatTimestamp(time(), 'rss'));
57
	$tpl->assign('channel_webmaster', xoops_utf8_encode($email));
58
	$tpl->assign('channel_editor', xoops_utf8_encode($email));
59
	$tpl->assign('channel_category', xoops_utf8_encode($categoryTitle));
60
	$tpl->assign('channel_generator', xoops_utf8_encode(references_utils::getModuleName()));
61
	$tpl->assign('channel_language', _LANGCODE);
62
	$tpl->assign('image_url', XOOPS_URL.'/images/logo.gif');
63
	$dimention = getimagesize(XOOPS_ROOT_PATH.'/images/logo.gif');
64 View Code Duplication
	if (empty($dimention[0])) {
65
		$width = 88;
66
	} else {
67
		$width = ($dimention[0] > 144) ? 144 : $dimention[0];
68
	}
69 View Code Duplication
	if (empty($dimention[1])) {
70
		$height = 31;
71
	} else {
72
		$height = ($dimention[1] > 400) ? 400 : $dimention[1];
73
	}
74
	$tpl->assign('image_width', $width);
75
	$tpl->assign('image_height', $height);
76
	$start = 0;
77
	$limit = references_utils::getModuleOption('nb_perpage');
78
    $items = array();
79
80
	$items = $h_references_articles->getRecentArticles($start, $limit);
81
	foreach($items as $item) {
82
		$titre = htmlspecialchars($item->getVar('article_title', 'n'),  ENT_QUOTES);
83
		$description = htmlspecialchars($item->getVar('article_text'), ENT_QUOTES);
84
		$link = REFERENCES_URL;
85
		$tpl->append('items', array('title' => xoops_utf8_encode($titre),
86
         							'link' => $link,
87
          							'guid' => $link,
88
          							'pubdate' => formatTimestamp($item->getVar('article_timestamp'), 'rss'),
89
          							'description' => xoops_utf8_encode($description)));
90
	}
91
}
92
$tpl->display('db:references_rss.html', $uid);
93
?>
0 ignored issues
show
It is not recommended to use PHP's closing tag ?> in files other than templates.

Using a closing tag in PHP files that only contain PHP code is not recommended as you might accidentally add whitespace after the closing tag which would then be output by PHP. This can cause severe problems, for example headers cannot be sent anymore.

A simple precaution is to leave off the closing tag as it is not required, and it also has no negative effects whatsoever.

Loading history...