1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace XoopsModules\Rssfit\Plugins; |
6
|
|
|
|
7
|
|
|
/* |
8
|
|
|
* You may not change or alter any portion of this comment or credits |
9
|
|
|
* of supporting developers from this source code or any supporting source code |
10
|
|
|
* which is considered copyrighted (c) material of the original comment or credit authors. |
11
|
|
|
* |
12
|
|
|
* This program is distributed in the hope that it will be useful, |
13
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
14
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
15
|
|
|
*/ |
16
|
|
|
|
17
|
|
|
/** |
18
|
|
|
* @copyright XOOPS Project (https://xoops.org) |
19
|
|
|
* @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) |
20
|
|
|
* @package RSSFit - Extendable XML news feed generator |
21
|
|
|
* @author NS Tai (aka tuff) <http://www.brandycoke.com> |
22
|
|
|
* @author XOOPS Development Team |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
/* |
26
|
|
|
* About this RSSFit plug-in |
27
|
|
|
* Author: tuff <http://www.brandycoke.com> |
28
|
|
|
* Requirements (Tested with): |
29
|
|
|
* Module: WF-Downloads <http://www.wf-projects.com> |
30
|
|
|
* Version: 2.0.5a |
31
|
|
|
* RSSFit verision: 1.2 / 1.5 |
32
|
|
|
* XOOPS version: 2.0.13.2 / 2.2.3 |
33
|
|
|
*/ |
34
|
|
|
|
35
|
|
|
use XoopsModules\Rssfit\{ |
36
|
|
|
AbstractPlugin |
37
|
|
|
}; |
38
|
|
|
use XoopsModules\Wfdownloads\Helper as PluginHelper; |
39
|
|
|
|
40
|
|
|
if (!\defined('RSSFIT_ROOT_PATH')) { |
41
|
|
|
exit(); |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Class Wfdownloads |
46
|
|
|
* @package XoopsModules\Rssfit\Plugins |
47
|
|
|
*/ |
48
|
|
|
final class Wfdownloads extends AbstractPlugin |
49
|
|
|
{ |
50
|
|
|
public function __construct() { |
51
|
|
|
if (\class_exists(PluginHelper::class)) { |
52
|
|
|
$this->helper = PluginHelper::getInstance(); |
53
|
|
|
$this->dirname = $this->helper->dirname(); |
54
|
|
|
} |
55
|
|
|
} |
56
|
|
|
|
57
|
|
|
public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array |
58
|
|
|
{ |
59
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
60
|
|
|
|
61
|
|
|
/** @var \XoopsGroupPermHandler $grouppermHandler */ |
62
|
|
|
$grouppermHandler = \xoops_getHandler('groupperm'); |
63
|
|
|
$ret = null; |
64
|
|
|
$i = 0; |
65
|
|
|
$sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; |
66
|
|
|
$result = $xoopsDB->query($sql, $this->grab, 0); |
67
|
|
|
if ($result instanceof \mysqli_result) { |
68
|
|
|
$ret = []; |
69
|
|
|
/** @var \XoopsMemberHandler $memberHandler */ |
70
|
|
|
$memberHandler = \xoops_getHandler('member'); |
71
|
|
|
while (false !== ($row = $xoopsDB->fetchArray($result))) { |
72
|
|
|
if ($grouppermHandler->checkRight('WFDownFilePerm', $row['lid'], \is_object($GLOBALS['xoopsUser']) ? $memberHandler->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { |
73
|
|
|
$ret[$i]['title'] = $row['title']; |
74
|
|
|
$link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; |
75
|
|
|
$ret[$i]['link'] = $ret[$i]['guid'] = $link; |
76
|
|
|
$ret[$i]['timestamp'] = $row['date']; |
77
|
|
|
$ret[$i]['description'] = $myts->displayTarea($row['description']); |
78
|
|
|
$ret[$i]['category'] = $this->modname; |
79
|
|
|
$ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; |
80
|
|
|
$i++; |
81
|
|
|
} |
82
|
|
|
} |
83
|
|
|
} |
84
|
|
|
return $ret; |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
|