forked from XoopsModules26x/publisher
-
Notifications
You must be signed in to change notification settings - Fork 0
/
visit.php
56 lines (44 loc) · 1.95 KB
/
visit.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?php
/*
You may not change or alter any portion of this comment or credits
of supporting developers from this source code or any supporting source code
which is considered copyrighted (c) material of the original comment or credit authors.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
*/
use Xoops\Core\Request;
/**
* @copyright The XUUPS Project http://sourceforge.net/projects/xuups/
* @license GNU GPL V2 or later (http://www.gnu.org/licenses/gpl-2.0.html)
* @package Publisher
* @subpackage Action
* @since 1.0
* @author trabis <lusopoemas@gmail.com>
* @author The SmartFactory <www.smartfactory.ca>
*/
include_once __DIR__ . '/header.php';
$xoops = Xoops::getInstance();
$publisher = Publisher::getInstance();
$fileid = Request::getInt('fileid');
// Creating the item object for the selected item
/* @var $fileObj PublisherFile */
$fileObj = $publisher->getFileHandler()->get($fileid);
if ($fileObj->getVar('status' != _PUBLISHER_STATUS_FILE_ACTIVE)) {
$xoops->redirect("javascript:history.go(-1)", 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
/* @var $itemObj PublisherItem */
$itemObj = $publisher->getItemHandler()->get($fileObj->getVar('itemid'));
// Check user permissions to access this file
if (!$itemObj->accessGranted()) {
$xoops->redirect("javascript:history.go(-1)", 1, XoopsLocale::E_NO_ACCESS_PERMISSION);
}
// Creating the category object that holds the selected ITEM
$categoryObj = $itemObj->category();
$fileObj->updateCounter();
if (!preg_match("/^ed2k*:\/\//i", $fileObj->getFileUrl())) {
header("Location: " . $fileObj->getFileUrl());
}
$myts = MyTextSanitizer::getInstance();
echo "<html><head><meta http-equiv=\"Refresh\" content=\"0; URL=" . $myts->htmlSpecialChars($fileObj->getFileUrl()) . "\"></meta></head><body></body></html>";
exit();