XoopsModules25x /
mylinks
| 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 | * |
||
| 7 | * This program is distributed in the hope that it will be useful, |
||
| 8 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
| 9 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
||
| 10 | */ |
||
| 11 | |||
| 12 | /** |
||
| 13 | * @copyright {@link https://xoops.org/ XOOPS Project} |
||
| 14 | * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} |
||
| 15 | * @package |
||
| 16 | * @since |
||
| 17 | * @author XOOPS Development Team |
||
| 18 | */ |
||
| 19 | |||
| 20 | use XoopsModules\Mylinks; |
||
| 21 | |||
| 22 | require_once dirname(dirname(__DIR__)) . '/mainfile.php'; |
||
| 23 | //xoops_load('utility', $xoopsModule->getVar('dirname')); |
||
| 24 | |||
| 25 | /** @var Mylinks\Helper $helper */ |
||
| 26 | $helper = Mylinks\Helper::getInstance(); |
||
| 27 | |||
| 28 | $lid = Mylinks\Utility::cleanVars($_GET, 'lid', 0, 'int', ['min' => 0]); |
||
|
0 ignored issues
–
show
Bug
introduced
by
Loading history...
|
|||
| 29 | |||
| 30 | if (empty($lid)) { |
||
| 31 | header('Location: ' . XOOPS_URL . '/'); |
||
| 32 | exit(); |
||
| 33 | } |
||
| 34 | |||
| 35 | $cid = Mylinks\Utility::cleanVars($_GET, 'cid', 0, 'int', ['min' => 0]); |
||
| 36 | |||
| 37 | if (!$xoopsUser || (!$xoopsUser->isAdmin($xoopsModule->mid())) |
||
| 38 | || ($xoopsUser->isAdmin($xoopsModule->mid()) |
||
| 39 | && $helper->getConfig('incadmin'))) { |
||
| 40 | $sql = sprintf('UPDATE `%s` SET hits = hits+1 WHERE lid = %u AND STATUS > 0', $xoopsDB->prefix('mylinks_links'), $lid); |
||
| 41 | $xoopsDB->queryF($sql); |
||
| 42 | } |
||
| 43 | $result = $xoopsDB->query('SELECT url FROM ' . $xoopsDB->prefix('mylinks_links') . " WHERE lid={$lid} AND status>0"); |
||
| 44 | list($url) = $xoopsDB->fetchRow($result); |
||
| 45 | if (empty($url)) { |
||
| 46 | header('Location: ' . XOOPS_URL . '/'); |
||
| 47 | exit(); |
||
| 48 | } |
||
| 49 | $url = htmlspecialchars(preg_replace('/javascript:/si', 'java script:', $url), ENT_QUOTES); |
||
| 50 | if ('' != $helper->getConfig('frame')) { |
||
| 51 | header('Content-Type:text/html; charset=' . _CHARSET); |
||
| 52 | header('Expires: Mon, 26 Jul 1997 05:00:00 GMT'); |
||
| 53 | header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT'); |
||
| 54 | header('Cache-Control: no-store, no-cache, must-revalidate'); |
||
| 55 | header('Cache-Control: post-check=0, pre-check=0', false); |
||
| 56 | header('Pragma: no-cache'); |
||
| 57 | echo "<html><head>\n" |
||
| 58 | . '<title>' |
||
| 59 | . htmlspecialchars($xoopsConfig['sitename'], ENT_QUOTES) |
||
| 60 | . "</title>\n" |
||
| 61 | . "</head>\n" |
||
| 62 | . "<frameset rows='70px,100%' cols='*' border='0' frameborder='0' framespacing='0' >\n" |
||
| 63 | . "<frame src='myheader.php?url={$url}&cid={$cid}&lid={$lid}' frame name='xoopshead' scrolling='no' target='main' Noresize>\n" |
||
| 64 | . "<frame src='{$url}' frame name='main' scrolling='auto' target='Main'>\n" |
||
| 65 | . "</frameset></html>\n"; |
||
| 66 | } else { |
||
| 67 | echo "<html><head><meta http-equiv=\"Refresh\" content=\"0; URL={$url}\"></meta></head><body></body></html>"; |
||
| 68 | } |
||
| 69 | exit(); |
||
| 70 |