|
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: MyDownloads <https://xoops.org> |
|
30
|
|
|
* Version: 1.1 |
|
31
|
|
|
* RSSFit verision: 1.2 / 1.5 |
|
32
|
|
|
* XOOPS version: 2.0.13.2 / 2.2.3 |
|
33
|
|
|
*/ |
|
34
|
|
|
if (!\defined('RSSFIT_ROOT_PATH')) { |
|
35
|
|
|
exit(); |
|
36
|
|
|
} |
|
37
|
|
|
|
|
38
|
|
|
/** |
|
39
|
|
|
* Class Mydownloads |
|
40
|
|
|
* @package XoopsModules\Rssfit\Plugins |
|
41
|
|
|
*/ |
|
42
|
|
|
class Mydownloads extends \XoopsObject |
|
43
|
|
|
{ |
|
44
|
|
|
public $dirname = 'mydownloads'; |
|
45
|
|
|
public $modname; |
|
46
|
|
|
public $grab; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @return \XoopsModule |
|
50
|
|
|
*/ |
|
51
|
|
|
public function loadModule():?\XoopsModule |
|
52
|
|
|
{ |
|
53
|
|
|
$mod = $GLOBALS['module_handler']->getByDirname($this->dirname); |
|
54
|
|
|
if (!$mod || !$mod->getVar('isactive')) { |
|
55
|
|
|
return null; |
|
56
|
|
|
} |
|
57
|
|
|
$this->modname = $mod->getVar('name'); |
|
58
|
|
|
|
|
59
|
|
|
return $mod; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @return array |
|
64
|
|
|
*/ |
|
65
|
|
|
public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array |
|
66
|
|
|
{ |
|
67
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
|
68
|
|
|
$ret = false; |
|
69
|
|
|
$i = 0; |
|
70
|
|
|
$sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mydownloads_downloads') . ' l, ' . $xoopsDB->prefix('mydownloads_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; |
|
71
|
|
|
$result = $xoopsDB->query($sql, $this->grab, 0); |
|
72
|
|
|
if ($result instanceof \mysqli_result) { |
|
73
|
|
|
$ret = []; |
|
74
|
|
|
while (false !== ($row = $xoopsDB->fetchArray($result))) { |
|
75
|
|
|
$ret[$i]['title'] = $row['title']; |
|
76
|
|
|
$link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; |
|
77
|
|
|
$ret[$i]['link'] = $ret[$i]['guid'] = $link; |
|
78
|
|
|
$ret[$i]['timestamp'] = $row['date']; |
|
79
|
|
|
$ret[$i]['description'] = $myts->displayTarea($row['description']); |
|
80
|
|
|
$ret[$i]['category'] = $this->modname; |
|
81
|
|
|
$ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; |
|
82
|
|
|
$i++; |
|
83
|
|
|
} |
|
84
|
|
|
} |
|
85
|
|
|
|
|
86
|
|
|
return $ret; |
|
|
|
|
|
|
87
|
|
|
} |
|
88
|
|
|
} |
|
89
|
|
|
|