Completed
Push — master ( 786b6e...dc199a )
by Michael
01:38
created
Severity

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
// $Id: print.php 11158 2013-03-05 14:10:36Z zyspec $
3
//  ------------------------------------------------------------------------ //
4
//                XOOPS - PHP Content Management System                      //
5
//                    Copyright (c) 2000 XOOPS.org                           //
6
//                       <http://www.xoops.org/>                             //
7
// ------------------------------------------------------------------------- //
8
//  This program is free software; you can redistribute it and/or modify     //
9
//  it under the terms of the GNU General Public License as published by     //
10
//  the Free Software Foundation; either version 2 of the License, or        //
11
//  (at your option) any later version.                                      //
12
//                                                                           //
13
//  You may not change or alter any portion of this comment or credits       //
14
//  of supporting developers from this source code or any supporting         //
15
//  source code which is considered copyrighted (c) material of the          //
16
//  original comment or credit authors.                                      //
17
//                                                                           //
18
//  This program is distributed in the hope that it will be useful,          //
19
//  but WITHOUT ANY WARRANTY; without even the implied warranty of           //
20
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            //
21
//  GNU General Public License for more details.                             //
22
//                                                                           //
23
//  You should have received a copy of the GNU General Public License        //
24
//  along with this program; if not, write to the Free Software              //
25
//  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA //
26
//  ------------------------------------------------------------------------ //
27
28
include __DIR__ . '/header.php';
29
include_once __DIR__ . '/class/utility.php';
30
//xoops_load('utility', $xoopsModule->getVar('dirname'));
31
32
$lid = MylinksUtility::mylinks_cleanVars($_GET, 'lid', 0, 'int', array('min' => 0));
0 ignored issues
show
'lid' is of type string, but the function expects a object<unknown_type>.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
33
//$cid   = MylinksUtility::mylinks_cleanVars($_GET, 'cid', 0, 'int', array('min'=>0));
34
35
//
36
if (empty($lid)) {
37
    redirect_header('index.php', 3, _MD_MYLINKS_IDERROR);
38
}
39
40
$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");
41
if (!$result) {
42
    redirect_header('index.php', 3, _MD_MYLINKS_NORECORDFOUND);
43
}
44
45
list($lid, $cid, $ltitle, $url, $logourl, $status, $time, $hits, $rating, $votes, $comments, $description) = $xoopsDB->fetchRow($result);
46
47
switch ($mylinks_can_print) {
48
    case _MD_MYLINKS_MEMBERONLY:
49
        $can_print = $xoopsUser ? _MD_MYLINKS_ALLOW : _MD_MYLINKS_DISALLOW;
50
    case _MD_MYLINKS_ALLOW:
51
        $can_print = _MD_MYLINKS_ALLOW;
52
        break;
53
    case _MD_MYLINKS_DISALLOW:
54
    default:
55
        $can_print = _MD_MYLINKS_DISALLOW;
56
        break;
57
}
58
59
if (_MD_MYLINKS_DISALLOW == $can_print) {
60
    redirect_header('index.php', 3, _MD_MYLINKS_PRINTINGDISALLOWED);
61
}
62
63
$myts = MyTextSanitizer::getInstance();
64
65
$link_data = array(
66
    'text'  => $myts->displayTarea($myts->stripSlashesGPC($description), 0),
67
    'title' => $myts->stripSlashesGPC($ltitle),
68
    'url'   => $myts->htmlSpecialChars($url),
69
    'date'  => $time
70
);
71
72
echo "<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>\n" . "<html>\n<head>\n" . '<title>' . $xoopsConfig['sitename'] . "</title>\n" . "<meta http-equiv='Content-Type' content='text/html; charset=" . _CHARSET . "'>\n" . "<meta name='AUTHOR' content='" . $xoopsConfig['sitename']
73
     . "'>\n" . "<meta name='COPYRIGHT' content='" . sprintf(_MD_MYLINKS_COPYNOTICE, date('Y'), $xoopsConfig['sitename']) . "'>\n" . "<meta name='DESCRIPTION' content='" . $xoopsConfig['slogan'] . "'>\n" . "<meta name='GENERATOR' content='" . XOOPS_VERSION . "'>\n"
74
     . "<body style='background-color: #ffffff; color: black;' onload='window.print()'>\n" . "<div style='width: 750px; border: 1px solid #000; padding: 20px;'>\n" . "<div style='text-align: center; display: block; margin: 0 0 6px 0;'>\n" . "  <img src='" . XOOPSMYLINKURL
75
     . "/images/mylinks_slogo.png' border='0' alt=''>\n" . "  <h2 style='margin: 0;'>" . _MD_MYLINKS_SITETITLE . '&nbsp;' . $link_data['title'] . "</h2>\n" . "</div>\n" . "<div style='text-align: center;'>" . _ON . '&nbsp;' . formatTimestamp($link_data['date']) . "</div>\n"
76
     . "<div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div>\n" . "<div style='text-align: left'>" . _MD_MYLINKS_SITEURL . '&nbsp;:&nbsp;' . $link_data['url'] . "</div>\n"
77
     . "<div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div>\n" . "<div style='text-align: left'>" . _MD_MYLINKS_DESCRIPTIONC . '<br>' . $link_data['text'] . "</div>\n"
78
     . "<div style='padding-top: 12px; border-top: 2px solid #ccc;'></div>\n" . '<p>' . _MD_MYLINKS_FROM . ': &nbsp;' . XOOPSMYLINKURL . "/singlelink.php?cid={$cid}&amp;lid={$lid}</p>\n" . "</div>\n" . "<br><br>\n" . "</body></html>\n";
79