Completed
Push — master ( 91b0ad...7b8e46 )
by Michael
01:46
created

visit.php (1 issue)

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
 * Module: WF-Links
5
 * Version: v1.0.3
6
 * Release Date: 21 June 2005
7
 * Developer: John N
8
 * Team: WF-Projects
9
 * Licence: GNU
10
 */
11
12
require_once __DIR__ . '/header.php';
13
14
global $xoopsModuleConfig;
15
16
$agreed = wfl_cleanRequestVars($_REQUEST, 'agree', 0);
17
$cid    = wfl_cleanRequestVars($_REQUEST, 'cid', 0);
18
$lid    = wfl_cleanRequestVars($_REQUEST, 'lid', 0);
19
$cid    = (int)$cid;
20
$lid    = (int)$lid;
21
$agreed = (int)$agreed;
22
23
$sql2 = 'SELECT count(*) FROM '
24
        . $xoopsDB->prefix('wflinks_links')
25
        . ' a LEFT JOIN '
26
        . $xoopsDB->prefix('wflinks_altcat')
27
        . ' b '
28
        . ' ON b.lid = a.lid'
29
        . ' WHERE a.published > 0 AND a.published <= '
30
        . time()
31
        . ' AND (a.expired = 0 OR a.expired > '
32
        . time()
33
        . ') AND a.offline = 0'
34
        . ' AND (b.cid=a.cid OR (a.cid='
35
        . $cid
36
        . ' OR b.cid='
37
        . $cid
38
        . '))';
39
list($count) = $xoopsDB->fetchRow($xoopsDB->query($sql2));
40
41 View Code Duplication
if (false == wfl_checkgroups($cid) && $count == 0) {
0 ignored issues
show
Coding Style Best Practice introduced by
It seems like you are loosely comparing two booleans. Considering using the strict comparison === instead.

When comparing two booleans, it is generally considered safer to use the strict comparison operator.

Loading history...
42
    redirect_header('index.php', 1, _MD_WFL_MUSTREGFIRST);
43
}
44
45
if ($xoopsModuleConfig['showlinkdisclaimer'] && $agreed == 0) {
46
    $GLOBALS['xoopsOption']['template_main'] = 'wflinks_disclaimer.tpl';
47
    include XOOPS_ROOT_PATH . '/header.php';
48
49
    $xoopsTpl->assign('image_header', wfl_imageheader());
50
    $xoopsTpl->assign('linkdisclaimer', $wfmyts->displayTarea($xoopsModuleConfig['linkdisclaimer'], 1, 1, 1, 1, 1));
51
    $xoopsTpl->assign('cancel_location', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php');
52
    $xoopsTpl->assign('agree_location', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/visit.php?agree=1&amp;lid=' . $lid . '&amp;cid=' . $cid);
53
    $xoopsTpl->assign('link_disclaimer', true);
54
55
    include XOOPS_ROOT_PATH . '/footer.php';
56
    exit();
57
} else {
58
    $url    = '';
59
    $sql    = 'UPDATE ' . $xoopsDB->prefix('wflinks_links') . ' SET hits=hits+1 WHERE lid=' . $lid;
60
    $result = $xoopsDB->queryF($sql);
61
62
    $sql = 'SELECT url FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE lid=' . $lid;
63
    if (!$result = $xoopsDB->queryF($sql)) {
64
        echo "<br><div style='text-align: center;'>" . wfl_imageheader() . '</div>';
65
        reportBroken($lid);
66
    } else {
67
        list($url) = $xoopsDB->fetchRow($result);
68
        $url = htmlspecialchars(preg_replace('/javascript:/si', 'java script:', $url), ENT_QUOTES);
69
    }
70
71
    if (!empty($url)) {
72
        header('Cache-Control: no-store, no-cache, must-revalidate');
73
        header('Cache-Control: post-check=0, pre-check=0', false);
74
        // HTTP/1.0
75
        header('Pragma: no-cache');
76
        // Date in the past
77
        header('Expires: Mon, 26 Jul 1997 05:00:00 GMT');
78
        // always modified
79
        header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
80
        echo '<html><head><meta http-equiv="Refresh" content="0; URL=' . $url . '"></meta></head><body></body></html>';
81
    }
82
}
83