Passed
Pull Request — master (#9)
by Michael
03:24
created
Labels
Severity
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 https://xoops.org/ XOOPS Project}
14
 * @license      {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later}
15
 * @package
16
 * @since
17
 * @author       XOOPS Development Team
18
 */
19
20
use XoopsModules\Mylinks;
21
22
require_once __DIR__ . '/header.php';
23
//xoops_load('utility', $xoopsModule->getVar('dirname'));
24
25
$lid = Mylinks\Utility::cleanVars($_GET, 'lid', 0, 'int', ['min' => 0]);
0 ignored issues
show
'lid' of type string is incompatible with the type XoopsModules\Mylinks\unknown_type expected by parameter $key of XoopsModules\Mylinks\Utility::cleanVars(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

25
$lid = Mylinks\Utility::cleanVars($_GET, /** @scrutinizer ignore-type */ 'lid', 0, 'int', ['min' => 0]);
Loading history...
26
//$cid   = Mylinks\Utility::cleanVars($_GET, 'cid', 0, 'int', array('min'=>0));
27
28
if (empty($lid)) {
29
    redirect_header('index.php', 3, _MD_MYLINKS_IDERROR);
30
}
31
32
$result = $xoopsDB->query('SELECT l.lid, l.cid, l.title, l.url, l.logourl, l.status, l.date, l.hits, l.rating, l.votes, l.comments, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . " t WHERE l.lid={$lid} AND l.lid=t.lid AND status>0");
33
if (!$result) {
34
    redirect_header('index.php', 3, _MD_MYLINKS_NORECORDFOUND);
35
}
36
37
list($lid, $cid, $ltitle, $url, $logourl, $status, $time, $hits, $rating, $votes, $comments, $description) = $xoopsDB->fetchRow($result);
38
39
switch ($mylinks_can_print) {
40
    case _MD_MYLINKS_MEMBERONLY:
41
        $can_print = $xoopsUser ? _MD_MYLINKS_ALLOW : _MD_MYLINKS_DISALLOW;
42
    // no break
43
    case _MD_MYLINKS_ALLOW:
44
        $can_print = _MD_MYLINKS_ALLOW;
45
        break;
46
    case _MD_MYLINKS_DISALLOW:
47
    default:
48
        $can_print = _MD_MYLINKS_DISALLOW;
49
        break;
50
}
51
52
if (_MD_MYLINKS_DISALLOW == $can_print) {
53
    redirect_header('index.php', 3, _MD_MYLINKS_PRINTINGDISALLOWED);
54
}
55
56
$myts = \MyTextSanitizer::getInstance();
57
58
$link_data = [
59
    'text'  => $myts->displayTarea($myts->stripSlashesGPC($description), 0),
60
    'title' => $myts->stripSlashesGPC($ltitle),
61
    'url'   => $myts->htmlSpecialChars($url),
62
    'date'  => $time,
63
];
64
65
echo "<!DOCTYPE HTML>\n"
66
     . "<html>\n<head>\n"
67
     . '<title>'
68
     . $xoopsConfig['sitename']
69
     . "</title>\n"
70
     . "<meta http-equiv='Content-Type' content='text/html; charset="
71
     . _CHARSET
72
     . "'>\n"
73
     . "<meta name='AUTHOR' content='"
74
     . $xoopsConfig['sitename']
75
     . "'>\n"
76
     . "<meta name='COPYRIGHT' content='"
77
     . sprintf(_MD_MYLINKS_COPYNOTICE, date('Y'), $xoopsConfig['sitename'])
78
     . "'>\n"
79
     . "<meta name='DESCRIPTION' content='"
80
     . $xoopsConfig['slogan']
81
     . "'>\n"
82
     . "<meta name='GENERATOR' content='"
83
     . XOOPS_VERSION
84
     . "'>\n"
85
     . "<body style='background-color: #ffffff; color: black;' onload='window.print()'>\n"
86
     . "<div style='width: 750px; border: 1px solid #000; padding: 20px;'>\n"
87
     . "<div style='text-align: center; display: block; margin: 0 0 6px 0;'>\n"
88
     . "  <img src='"
89
     . XOOPSMYLINKURL
90
     . "/assets/images/mylinks_slogo.png' border='0' alt=''>\n"
91
     . "  <h2 style='margin: 0;'>"
92
     . _MD_MYLINKS_SITETITLE
93
     . '&nbsp;'
94
     . $link_data['title']
95
     . "</h2>\n"
96
     . "</div>\n"
97
     . "<div class='center;'>"
98
     . _ON
99
     . '&nbsp;'
100
     . formatTimestamp($link_data['date'])
101
     . "</div>\n"
102
     . "<div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div>\n"
103
     . "<div style='text-align: left'>"
104
     . _MD_MYLINKS_SITEURL
105
     . '&nbsp;:&nbsp;'
106
     . $link_data['url']
107
     . "</div>\n"
108
     . "<div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div>\n"
109
     . "<div style='text-align: left'>"
110
     . _MD_MYLINKS_DESCRIPTIONC
111
     . '<br>'
112
     . $link_data['text']
113
     . "</div>\n"
114
     . "<div style='padding-top: 12px; border-top: 2px solid #ccc;'></div>\n"
115
     . '<p>'
116
     . _MD_MYLINKS_FROM
117
     . ': &nbsp;'
118
     . XOOPSMYLINKURL
119
     . "/singlelink.php?cid={$cid}&amp;lid={$lid}</p>\n"
120
     . "</div>\n"
121
     . "<br><br>\n"
122
     . "</body></html>\n";
123