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
|
|
|
|
12
|
|
|
/** |
13
|
|
|
* @copyright {@link http://xoops.org/ XOOPS Project} |
14
|
|
|
* @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} |
15
|
|
|
* @package |
16
|
|
|
* @since |
17
|
|
|
* @author XOOPS Development Team, |
18
|
|
|
* @author GIJ=CHECKMATE (PEAK Corp. http://www.peak.ne.jp/) |
19
|
|
|
*/ |
20
|
|
|
|
21
|
|
|
include __DIR__ . '/../../mainfile.php'; |
22
|
|
|
if (function_exists('mb_http_output')) { |
23
|
|
|
mb_http_output('pass'); |
24
|
|
|
} |
25
|
|
|
header('Content-Type:text/xml; charset=utf-8'); |
26
|
|
|
|
27
|
|
|
// for "Duplicatable" |
28
|
|
|
$moduleDirName = basename(__DIR__); |
29
|
|
|
if (!preg_match('/^(\D+)(\d*)$/', $moduleDirName, $regs)) { |
30
|
|
|
echo('invalid dirname: ' . htmlspecialchars($moduleDirName)); |
31
|
|
|
} |
32
|
|
|
$mydirnumber = $regs[2] === '' ? '' : (int)$regs[2]; |
33
|
|
|
|
34
|
|
|
// setting physical & virtual paths |
35
|
|
|
$mod_path = XOOPS_ROOT_PATH . "/modules/$moduleDirName"; |
36
|
|
|
$mod_url = XOOPS_URL . "/modules/$moduleDirName"; |
37
|
|
|
|
38
|
|
|
// defining class of APCal |
39
|
|
|
require_once "$mod_path/class/APCal.php"; |
40
|
|
|
require_once "$mod_path/class/APCal_xoops.php"; |
41
|
|
|
|
42
|
|
|
// creating an instance of APCal |
43
|
|
|
$cal = new APCal_xoops(date('Y-n-j'), $xoopsConfig['language'], true); |
44
|
|
|
$cal->use_server_TZ = true; |
45
|
|
|
|
46
|
|
|
// ignoring cid from GET |
47
|
|
|
// $cal->now_cid = 0 ; |
48
|
|
|
|
49
|
|
|
// setting properties of APCal |
50
|
|
|
$cal->conn = $GLOBALS['xoopsDB']->conn; |
51
|
|
|
include "$mod_path/include/read_configs.php"; |
52
|
|
|
$cal->base_url = $mod_url; |
53
|
|
|
$cal->base_path = $mod_path; |
54
|
|
|
$cal->images_url = "$mod_url/assets/images/$skin_folder"; |
55
|
|
|
$cal->images_path = "$mod_path/assets/images/$skin_folder"; |
56
|
|
|
|
57
|
|
|
$block = $cal->get_blockarray_coming_event("$mod_url/index.php", 10, true); |
58
|
|
|
|
59
|
|
|
//mb_http_output( 'UTF-8' ) ; |
60
|
|
|
//ob_start( 'mb_outputHandler' ) ; |
61
|
|
|
ob_start('xoops_utf8_encode'); |
62
|
|
|
|
63
|
|
|
echo '<?xml version="1.0" encoding="UTF-8" ?> |
64
|
|
|
<rss version="2.0"> |
65
|
|
|
<channel> |
66
|
|
|
<title>' . $xoopsModule->getVar('name') . ' - ' . htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES) . "</title> |
67
|
|
|
<link>$mod_url/</link> |
68
|
|
|
<description>" . htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES) . '</description> |
69
|
|
|
<lastBuildDate>' . formatTimestamp(time(), 'r') . '</lastBuildDate> |
70
|
|
|
<webMaster>' . $xoopsConfig['adminmail'] . '</webMaster> |
71
|
|
|
<editor>' . $xoopsConfig['adminmail'] . '</editor> |
72
|
|
|
<category>Calendar</category> |
73
|
|
|
<generator>APCal for XOOPS</generator> |
74
|
|
|
<language>' . _LANGCODE . "</language>\n"; |
75
|
|
|
|
76
|
|
View Code Duplication |
foreach ($block['events'] as $event) { |
|
|
|
|
77
|
|
|
|
78
|
|
|
// start |
79
|
|
|
$start = date('n/j G:i', $event['start']); |
80
|
|
|
|
81
|
|
|
echo " |
82
|
|
|
<item> |
83
|
|
|
<title>$start {$event['summary']}</title> |
84
|
|
|
<link>$mod_url/?event_id={$event['id']}</link> |
85
|
|
|
<description>{$event['description']}</description> |
86
|
|
|
<pubDate>" . formatTimestamp($event['start'], 'r') . "</pubDate> |
87
|
|
|
</item>\n"; |
88
|
|
|
} |
89
|
|
|
|
90
|
|
|
echo " |
91
|
|
|
</channel> |
92
|
|
|
</rss>\n"; |
93
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.