mambax7 /
wflinks
| 1 | <?php |
||
| 2 | /** |
||
| 3 | * Module: WF-Links |
||
| 4 | * Version: v1.0.3 |
||
| 5 | * Release Date: 21 June 2005 |
||
| 6 | * Developer: John N |
||
| 7 | * Team: WF-Projects |
||
| 8 | * Licence: GNU |
||
| 9 | */ |
||
| 10 | |||
| 11 | use XoopsModules\Wflinks; |
||
| 12 | |||
| 13 | require_once __DIR__ . '/header.php'; |
||
| 14 | |||
| 15 | /** @var Wflinks\Helper $helper */ |
||
| 16 | $helper = Wflinks\Helper::getInstance(); |
||
| 17 | |||
| 18 | $agreed = Wflinks\Utility::cleanRequestVars($_REQUEST, 'agree', 0); |
||
| 19 | $cid = Wflinks\Utility::cleanRequestVars($_REQUEST, 'cid', 0); |
||
| 20 | $lid = Wflinks\Utility::cleanRequestVars($_REQUEST, 'lid', 0); |
||
| 21 | $cid = (int)$cid; |
||
| 22 | $lid = (int)$lid; |
||
| 23 | $agreed = (int)$agreed; |
||
| 24 | |||
| 25 | $sql2 = 'SELECT count(*) FROM ' |
||
| 26 | . $xoopsDB->prefix('wflinks_links') |
||
| 27 | . ' a LEFT JOIN ' |
||
| 28 | . $xoopsDB->prefix('wflinks_altcat') |
||
| 29 | . ' b ' |
||
| 30 | . ' ON b.lid = a.lid' |
||
| 31 | . ' WHERE a.published > 0 AND a.published <= ' |
||
| 32 | . time() |
||
| 33 | . ' AND (a.expired = 0 OR a.expired > ' |
||
| 34 | . time() |
||
| 35 | . ') AND a.offline = 0' |
||
| 36 | . ' AND (b.cid=a.cid OR (a.cid=' |
||
| 37 | . $cid |
||
| 38 | . ' OR b.cid=' |
||
| 39 | . $cid |
||
| 40 | . '))'; |
||
| 41 | list($count) = $xoopsDB->fetchRow($xoopsDB->query($sql2)); |
||
| 42 | |||
| 43 | if (0 == $count && false === Wflinks\Utility::checkGroups($cid)) { |
||
| 44 | redirect_header('index.php', 1, _MD_WFL_MUSTREGFIRST); |
||
| 45 | } |
||
| 46 | |||
| 47 | if (0 == $agreed && $helper->getConfig('showlinkdisclaimer')) { |
||
| 48 | $GLOBALS['xoopsOption']['template_main'] = 'wflinks_disclaimer.tpl'; |
||
| 49 | require XOOPS_ROOT_PATH . '/header.php'; |
||
| 50 | |||
| 51 | $xoopsTpl->assign('image_header', Wflinks\Utility::getImageHeader()); |
||
| 52 | $xoopsTpl->assign('linkdisclaimer', $myts->displayTarea($helper->getConfig('linkdisclaimer'), 1, 1, 1, 1, 1)); |
||
| 53 | $xoopsTpl->assign('cancel_location', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/index.php'); |
||
| 54 | $xoopsTpl->assign('agree_location', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/visit.php?agree=1&lid=' . $lid . '&cid=' . $cid); |
||
| 55 | $xoopsTpl->assign('link_disclaimer', true); |
||
| 56 | |||
| 57 | require XOOPS_ROOT_PATH . '/footer.php'; |
||
| 58 | exit(); |
||
| 59 | } |
||
| 60 | |||
| 61 | $url = ''; |
||
| 62 | $sql = 'UPDATE ' . $xoopsDB->prefix('wflinks_links') . ' SET hits=hits+1 WHERE lid=' . $lid; |
||
| 63 | $result = $xoopsDB->queryF($sql); |
||
| 64 | |||
| 65 | $sql = 'SELECT url FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE lid=' . $lid; |
||
| 66 | if ($result = $xoopsDB->queryF($sql)) { |
||
| 67 | list($url) = $xoopsDB->fetchRow($result); |
||
| 68 | $url = htmlspecialchars(preg_replace('/javascript:/si', 'java script:', $url), ENT_QUOTES); |
||
| 69 | } else { |
||
| 70 | echo "<br><div style='text-align: center;'>" . Wflinks\Utility::getImageHeader() . '</div>'; |
||
| 71 | reportBroken($lid); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 72 | } |
||
| 73 | |||
| 74 | if (!empty($url)) { |
||
| 75 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
||
| 76 | header('Cache-Control: post-check=0, pre-check=0', false); |
||
| 77 | // HTTP/1.0 |
||
| 78 | header('Pragma: no-cache'); |
||
| 79 | // Date in the past |
||
| 80 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
||
| 81 | // always modified |
||
| 82 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
||
| 83 | echo '<html><head><meta http-equiv="Refresh" content="0; URL=' . $url . '"></meta></head><body></body></html>'; |
||
| 84 | } |
||
| 85 |