Passed
Pull Request — master (#9)
by Michael
03:24
created
Severity
1
<?php
2
3
require_once dirname(dirname(__DIR__)) . '/mainfile.php';
4
require_once XOOPS_ROOT_PATH . '/class/template.php';
5
error_reporting(0);
6
$modulename = basename(__DIR__);
7
require_once XOOPS_ROOT_PATH . "/modules/{$modulename}/include/feedfunc.new.php";
8
9
// for debug
10
$cache = false;
11
12
$param_array = [
13
    'show'  => 10,
14
    'image' => 1,
15
];
16
17
$new_array = mylinks_get_new($param_array);
18
19
// logo image
20
$logo     = 'images/logo.gif';
21
$template = XOOPS_ROOT_PATH . "/modules/{$modulename}/templates/mylinks_pda.tpl";
22
23
$PDA_DESC_MAX = 1000;
24
25
// rss output
26
if (function_exists('mb_http_output')) {
27
    mb_http_output('pass');
28
}
29
30
header('Content-Type:text/html');
31
$tpl = new \XoopsTpl();
32
33
if ($cache) {
0 ignored issues
show
The condition $cache is always false.
Loading history...
34
    $tpl->caching = 2;
35
    $tpl->xoops_setCacheTime(3600);
36
}
37
38
if (!$tpl->is_cached("file:{$template}") || !$cache) {
0 ignored issues
show
The condition $cache is always false.
Loading history...
39
    if (count($new_array) > 0) {
40
        $tpl->assign('xoops_charset', _CHARSET);
41
        $tpl->assign('site_url', XOOPS_URL . '/');
42
        $tpl->assign('site_name', htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES));
43
        $tpl->assign('site_desc', htmlspecialchars($xoopsConfig['slogan'], ENT_QUOTES));
44
        $tpl->assign('image_url', XOOPS_URL . "/$logo");
45
46
        $i     = 0;
47
        $block = [];
48
49
        foreach ($new_array as $new) {
50
            $line['link']  = $new['link'];
51
            $line['title'] = wani_make_html_title($new['title']);
52
            $description   = '';
53
            if (isset($new['description'])) {
54
                $description = $new['description'];
55
                $description = wani_make_html_summary($description, $PDA_DESC_MAX);
56
            }
57
            $line['desc']   = $description;
58
            $line['date_s'] = formatTimestamp($new['time'], 's');
59
60
            $block[] = $line;
61
            ++$i;
62
        }
63
64
        $tpl->assign('whatsnew', $block);
65
    }
66
}
67
68
$tpl->display("file:{$template}");
69
exit();
70