Completed
Push — master ( dc199a...eefcac )
by Michael
01:34
created

visit.php (2 issues)

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: visit.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
include dirname(dirname(__DIR__)) . '/mainfile.php';
28
include_once __DIR__ . '/class/utility.php';
29
//xoops_load('utility', $xoopsModule->getVar('dirname'));
30
$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...
31
32
if (empty($lid)) {
33
    header('Location: ' . XOOPS_URL . '/');
34
    exit();
35
}
36
37
$cid = MylinksUtility::mylinks_cleanVars($_GET, 'cid', 0, 'int', array('min' => 0));
0 ignored issues
show
'cid' 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...
38
39
if (!$xoopsUser || (!$xoopsUser->isAdmin($xoopsModule->mid()))
40
    || ($xoopsUser->isAdmin($xoopsModule->mid())
41
        && $xoopsModuleConfig['incadmin'])
42
) {
43
    $sql = sprintf('UPDATE %s SET hits = hits+1 WHERE lid = %u AND status > 0', $xoopsDB->prefix('mylinks_links'), $lid);
44
    $xoopsDB->queryF($sql);
45
}
46
$result = $xoopsDB->query('SELECT url FROM ' . $xoopsDB->prefix('mylinks_links') . " WHERE lid={$lid} AND status>0");
47
list($url) = $xoopsDB->fetchRow($result);
48
if (empty($url)) {
49
    header('Location: ' . XOOPS_URL . '/');
50
    exit();
51
}
52
$url = htmlspecialchars(preg_replace('/javascript:/si', 'java script:', $url), ENT_QUOTES);
53
if ('' != $xoopsModuleConfig['frame']) {
54
    header('Content-Type:text/html; charset=' . _CHARSET);
55
    header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
56
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
57
    header('Cache-Control: no-store, no-cache, must-revalidate');
58
    header('Cache-Control: post-check=0, pre-check=0', false);
59
    header('Pragma: no-cache');
60
    echo "<html><head>\n" . '<title>' . htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES) . "</title>\n" . "</head>\n" . "<iframe rows='70px,100%' cols='*' border='0' frameborder='0' framespacing='0' >\n"
61
         . "<iframe src='myheader.php?url={$url}&amp;cid={$cid}&amp;lid={$lid}' frame name='xoopshead' scrolling='no' target='main' Noresize>\n" . "<iframe src='{$url}' frame name='main' scrolling='auto' target='Main'>\n" . "</iframe></html>\n";
62
} else {
63
    echo "<html><head><meta http-equiv=\"Refresh\" content=\"0; URL={$url}\"></meta></head><body></body></html>";
64
}
65
exit();
66