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 = WfLinksUtility::cleanRequestVars($_REQUEST, 'agree', 0); |
||
17 | $cid = WfLinksUtility::cleanRequestVars($_REQUEST, 'cid', 0); |
||
18 | $lid = WfLinksUtility::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 (0 == $count && false === WfLinksUtility::checkGroups($cid)) { |
|
0 ignored issues
–
show
|
|||
42 | redirect_header('index.php', 1, _MD_WFL_MUSTREGFIRST); |
||
43 | } |
||
44 | |||
45 | if (0 == $agreed && $xoopsModuleConfig['showlinkdisclaimer']) { |
||
46 | $GLOBALS['xoopsOption']['template_main'] = 'wflinks_disclaimer.tpl'; |
||
47 | include XOOPS_ROOT_PATH . '/header.php'; |
||
48 | |||
49 | $xoopsTpl->assign('image_header', WfLinksUtility::getImageHeader()); |
||
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&lid=' . $lid . '&cid=' . $cid); |
||
53 | $xoopsTpl->assign('link_disclaimer', true); |
||
54 | |||
55 | include XOOPS_ROOT_PATH . '/footer.php'; |
||
56 | exit(); |
||
57 | } |
||
58 | |||
59 | $url = ''; |
||
60 | $sql = 'UPDATE ' . $xoopsDB->prefix('wflinks_links') . ' SET hits=hits+1 WHERE lid=' . $lid; |
||
61 | $result = $xoopsDB->queryF($sql); |
||
62 | |||
63 | $sql = 'SELECT url FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE lid=' . $lid; |
||
64 | if (!$result = $xoopsDB->queryF($sql)) { |
||
65 | echo "<br><div style='text-align: center;'>" . WfLinksUtility::getImageHeader() . '</div>'; |
||
66 | reportBroken($lid); |
||
67 | } else { |
||
68 | list($url) = $xoopsDB->fetchRow($result); |
||
69 | $url = htmlspecialchars(preg_replace('/javascript:/si', 'java script:', $url), ENT_QUOTES); |
||
70 | } |
||
71 | |||
72 | if (!empty($url)) { |
||
73 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
||
74 | header('Cache-Control: post-check=0, pre-check=0', false); |
||
75 | // HTTP/1.0 |
||
76 | header('Pragma: no-cache'); |
||
77 | // Date in the past |
||
78 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
||
79 | // always modified |
||
80 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
||
81 | echo '<html><head><meta http-equiv="Refresh" content="0; URL=' . $url . '"></meta></head><body></body></html>'; |
||
82 | } |
||
83 |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.