XoopsModules25x /
xoopspartners
| 1 | <?php |
||
| 2 | /* |
||
| 3 | * You may not change or alter any portion of this comment or credits |
||
| 4 | * of supporting developers from this source code or any supporting source code |
||
| 5 | * which is considered copyrighted (c) material of the original comment or credit authors. |
||
| 6 | * This program is distributed in the hope that it will be useful, |
||
| 7 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 8 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 9 | * |
||
| 10 | *-------------------------------------- |
||
| 11 | * Author: Raul Recio (AKA UNFOR) |
||
| 12 | * Project: The XOOPS Project |
||
| 13 | *-------------------------------------- |
||
| 14 | */ |
||
| 15 | |||
| 16 | /** |
||
| 17 | * XoopsPartners - a partner affiliation links module |
||
| 18 | * |
||
| 19 | * @package module\Xoopspartners\frontside |
||
| 20 | * @author Raul Recio (aka UNFOR) |
||
| 21 | * @author XOOPS Module Development Team |
||
| 22 | * @copyright {@link https://xoops.org 2001-2016 XOOPS Project} |
||
| 23 | * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU Public License} |
||
| 24 | * @link https://xoops.org XOOPS |
||
| 25 | */ |
||
| 26 | |||
| 27 | use Xmf\Request; |
||
| 28 | use XoopsModules\Xoopspartners; |
||
| 29 | use XoopsModules\Xoopspartners\Constants; |
||
| 30 | |||
| 31 | require_once __DIR__ . '/header.php'; |
||
| 32 | $partnersHandler = $helper->getHandler('Partners'); |
||
| 33 | |||
| 34 | $id = Request::getInt('id', Constants::DEFAULT_PID, 'GET'); |
||
| 35 | if (Constants::DEFAULT_PID === $id) { |
||
| 36 | $helper->redirect('index.php', Constants::REDIRECT_DELAY_MEDIUM, _MD_XOOPSPARTNERS_NOPART); |
||
| 37 | } |
||
| 38 | |||
| 39 | $partnerObj = $partnersHandler->get($id); |
||
| 40 | if (($partnerObj instanceof Xoopspartners\Partners) |
||
| 41 | && $partnerObj->getVar('url') |
||
| 42 | && (Constants::STATUS_ACTIVE == $partnerObj->getVar('status'))) { |
||
| 43 | if (!isset($GLOBALS['xoopsUser']) // not a registered user |
||
| 44 | || !$helper->isUserAdmin() // registered but not an admin |
||
| 45 | || $helper->getConfig('incadmin')) { // admin but want to include admin hits |
||
| 46 | if (!isset($_COOKIE['partners'][$id])) { |
||
| 47 | setcookie("partners[{$id}]", $id, time() + $helper->getConfig('cookietime')); |
||
| 48 | $hitCount = $partnerObj->getVar('hits'); |
||
| 49 | ++$hitCount; |
||
| 50 | $partnerObj->setVar('hits', $hitCount); |
||
| 51 | $partnersHandler->insert($partnerObj); |
||
| 52 | } |
||
| 53 | } |
||
| 54 | echo "<html>\n" . " <head>\n" . " <meta http-equiv='Refresh' content='0; URL=" . htmlentities($partnerObj->getVar('url'), ENT_QUOTES | ENT_HTML5) . "'>\n" . " </head>\n" . " <body></body>\n" . "</html>\n"; |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 55 | } else { |
||
| 56 | unset($partnersHandler); |
||
| 57 | $helper->redirect('index.php', Constants::REDIRECT_DELAY_MEDIUM, _MD_XOOPSPARTNERS_NOPART); |
||
| 58 | } |
||
| 59 |