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
|
|
|
* |
28
|
|
|
* Author : |
29
|
|
|
* DuGris - http://www.dugris.info |
30
|
|
|
* |
31
|
|
|
* Requirements: |
32
|
|
|
* Module : RSSFit - http://www.brandycoke.com |
33
|
|
|
* verision : 1.20 |
34
|
|
|
* |
35
|
|
|
* Module : wflinks - http://www.wf-projects.com |
36
|
|
|
* Version : 1.03 |
37
|
|
|
*/ |
38
|
|
|
|
39
|
|
|
use XoopsModules\Rssfit\{ |
40
|
|
|
AbstractPlugin |
41
|
|
|
}; |
42
|
|
|
use XoopsModules\Wflinks\Helper as PluginHelper; |
43
|
|
|
|
44
|
|
|
if (!\defined('RSSFIT_ROOT_PATH')) { |
45
|
|
|
exit(); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* Class Wflinks |
50
|
|
|
*/ |
51
|
|
|
final class Wflinks extends AbstractPlugin |
52
|
|
|
{ |
53
|
|
|
public function __construct() { |
54
|
|
|
if (\class_exists(PluginHelper::class)) { |
55
|
|
|
$this->helper = PluginHelper::getInstance(); |
56
|
|
|
$this->dirname = $this->helper->dirname(); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|
60
|
|
|
public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array |
61
|
|
|
{ |
62
|
|
|
global $xoopsUser; |
63
|
|
|
|
64
|
|
|
$groups = \is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; |
65
|
|
|
/** @var \XoopsGroupPermHandler $grouppermHandler */ |
66
|
|
|
$grouppermHandler = \xoops_getHandler('groupperm'); |
67
|
|
|
|
68
|
|
|
$ret = null; |
69
|
|
|
$i = 0; |
70
|
|
|
$sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 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
|
|
|
if ($grouppermHandler->checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { |
|
|
|
|
76
|
|
|
// required |
77
|
|
|
$ret[$i]['title'] = $row['title']; |
78
|
|
|
$ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; |
79
|
|
|
$ret[$i]['timestamp'] = $row['date']; |
80
|
|
|
$ret[$i]['description'] = $row['description']; |
81
|
|
|
// optional |
82
|
|
|
$ret[$i]['category'] = $this->modname; |
83
|
|
|
$ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; |
84
|
|
|
$i++; |
85
|
|
|
} |
86
|
|
|
} |
87
|
|
|
} |
88
|
|
|
|
89
|
|
|
return $ret; |
90
|
|
|
} |
91
|
|
|
} |
92
|
|
|
|