Completed
Push — master ( 484dcf...d1b073 )
by Michael
14s
created

vpartner.php (2 issues)

Labels
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
/*
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
 Author: Raul Recio (AKA UNFOR)
28
 Project: The XOOPS Project
29
 -------------------------------------------------------------------------
30
 */
31
/**
32
 * XoopsPartners - a partner affiliation links module
33
 *
34
 * @category     Module
35
 * @package      xoopspartners
36
 * @subpackage   front
37
 * @author       Raul Recio (aka UNFOR)
38
 * @author       XOOPS Module Development Team
39
 * @copyright    {@link http://xoops.org 2001-2016 XOOPS Project}
40
 * @license      {@link http://www.gnu.org/licenses/gpl-2.0.html GNU Public License}
41
 * @link         http://xoops.org XOOPS
42
 */
43
44
include __DIR__ . '/header.php';
45
$xpPartnerHandler = xoops_getModuleHandler('partners', $moduleDirname);
46
47
$id = XoopsRequest::getInt('id', XoopspartnersConstants::DEFAULT_PID, 'GET');
48
if (XoopspartnersConstants::DEFAULT_PID == $id) {
49
    redirect_header('index.php', XoopspartnersConstants::REDIRECT_DELAY_MEDIUM, _MD_XPARTNERS_NOPART);
50
}
51
52
$partnerObj = $xpPartnerHandler->get($id);
53
if (($partnerObj instanceof XoopspartnersPartners) && $partnerObj->getVar('url') && (XoopspartnersConstants::STATUS_ACTIVE == $partnerObj->getVar('status'))) {
54
    $modMid = ($GLOBALS['xoopsModule'] instanceof XoopsModule) ? $GLOBALS['xoopsModule']->getVar('mid') : XoopspartnersConstants::DEFAULT_MID;
0 ignored issues
show
The class XoopsModule does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
55
    if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin($modMid) || !$GLOBALS['xoopsModule']->getInfo('incadmin')) {
0 ignored issues
show
The class XoopsUser does not exist. Did you forget a USE statement, or did you not list all dependencies?

This error could be the result of:

1. Missing dependencies

PHP Analyzer uses your composer.json file (if available) to determine the dependencies of your project and to determine all the available classes and functions. It expects the composer.json to be in the root folder of your repository.

Are you sure this class is defined by one of your dependencies, or did you maybe not list a dependency in either the require or require-dev section?

2. Missing use statement

PHP does not complain about undefined classes in ìnstanceof checks. For example, the following PHP code will work perfectly fine:

if ($x instanceof DoesNotExist) {
    // Do something.
}

If you have not tested against this specific condition, such errors might go unnoticed.

Loading history...
56
        if (!isset($_COOKIE['partners'][$id])) {
57
            setcookie("partners[{$id}]", $id, $GLOBALS['xoopsModuleConfig']['cookietime']);
58
            $hitCount = $partnerObj->getVar('hits');
59
            ++$hitCount;
60
            $partnerObj->setVar('hits', $hitCount);
61
            $xpPartnerHandler->insert($partnerObj);
62
        }
63
    }
64
    echo "<html>\n" . "  <head>\n" . "    <meta http-equiv='Refresh' content='0; URL=" . htmlentities($partnerObj->getVar('url')) . "'>\n" . "  </head>\n" . "  <body></body>\n" . "</html>\n";
65
} else {
66
    unset($xpPartnerHandler);
67
    redirect_header('index.php', XoopspartnersConstants::REDIRECT_DELAY_MEDIUM, _MD_XPARTNERS_NOPART);
68
}
69