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 'header.php'; |
||
29 | include_once './class/utility.php'; |
||
30 | //xoops_load('utility', $xoopsModule->getVar('dirname')); |
||
0 ignored issues
–
show
|
|||
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);
![]() |
|||
33 | //$cid = mylinksUtility::mylinks_cleanVars($_GET, 'cid', 0, 'int', array('min'=>0)); |
||
0 ignored issues
–
show
Unused Code
Comprehensibility
introduced
by
68% of this comment could be valid code. Did you maybe forget this after debugging?
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it. The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production. This check looks for comments that seem to be mostly valid code and reports them. ![]() |
|||
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 | { |
||
49 | case _MD_MYLINKS_MEMBERONLY: |
||
0 ignored issues
–
show
|
|||
50 | $can_print = $xoopsUser ? _MD_MYLINKS_ALLOW : _MD_MYLINKS_DISALLOW; |
||
51 | case _MD_MYLINKS_ALLOW: |
||
52 | $can_print = _MD_MYLINKS_ALLOW; |
||
53 | break; |
||
54 | case _MD_MYLINKS_DISALLOW: |
||
55 | default: |
||
56 | $can_print = _MD_MYLINKS_DISALLOW; |
||
57 | break; |
||
58 | } |
||
59 | |||
60 | if ( _MD_MYLINKS_DISALLOW == $can_print) { |
||
61 | redirect_header('index.php', 3, _MD_MYLINKS_PRINTINGDISALLOWED); |
||
62 | } |
||
63 | |||
64 | $myts =& MyTextSanitizer::getInstance(); |
||
65 | |||
66 | $link_data = array( '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" |
||
73 | ."<html>\n<head>\n" |
||
74 | . '<title>' . $xoopsConfig['sitename'] . "</title>\n" |
||
75 | ."<meta http-equiv='Content-Type' content='text/html; charset=" . _CHARSET . "'>\n" |
||
76 | ."<meta name='AUTHOR' content='" . $xoopsConfig['sitename'] . "'>\n" |
||
77 | ."<meta name='COPYRIGHT' content='" . sprintf(_MD_MYLINKS_COPYNOTICE, date('Y'), $xoopsConfig['sitename']) ."'>\n" |
||
78 | ."<meta name='DESCRIPTION' content='" . $xoopsConfig['slogan'] . "'>\n" |
||
79 | ."<meta name='GENERATOR' content='" . XOOPS_VERSION . "'>\n" |
||
80 | ."<body style='background-color: #ffffff; color: black;' onload='window.print()'>\n" |
||
81 | ."<div style='width: 750px; border: 1px solid #000; padding: 20px;'>\n" |
||
82 | ."<div style='text-align: center; display: block; margin: 0 0 6px 0;'>\n" |
||
83 | ." <img src='".XOOPSMYLINKURL."/images/mylinks_slogo.png' border='0' alt=''>\n" |
||
84 | ." <h2 style='margin: 0;'>"._MD_MYLINKS_SITETITLE . ' ' . $link_data['title'] . "</h2>\n" |
||
85 | ."</div>\n" |
||
86 | ."<div style='text-align: center;'>" . _ON . ' ' . formatTimestamp($link_data['date']) . "</div>\n" |
||
87 | ."<div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div>\n" |
||
88 | ."<div style='text-align: left'>" . _MD_MYLINKS_SITEURL . ' : ' . $link_data['url'] . "</div>\n" |
||
89 | ."<div style='text-align: center; display: block; padding-bottom: 12px; margin: 0 0 6px 0; border-bottom: 2px solid #ccc;'></div>\n" |
||
90 | ."<div style='text-align: left'>" . _MD_MYLINKS_DESCRIPTIONC . '<br>' . $link_data['text'] . "</div>\n" |
||
91 | ."<div style='padding-top: 12px; border-top: 2px solid #ccc;'></div>\n" |
||
92 | . '<p>' . _MD_MYLINKS_FROM . ': ' . XOOPSMYLINKURL . "/singlelink.php?cid={$cid}&lid={$lid}</p>\n" |
||
93 | ."</div>\n" |
||
94 | ."<br><br>\n" |
||
95 | ."</body></html>\n"; |
||
96 |
Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.
The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.
This check looks for comments that seem to be mostly valid code and reports them.