1
|
|
|
<?php declare(strict_types=1); |
2
|
|
|
|
3
|
|
|
############################################################################### |
4
|
|
|
## RSSFit - Extendable XML news feed generator ## |
5
|
|
|
## Copyright (c) 2004 - 2005 NS Tai (aka tuff) ## |
6
|
|
|
## <https://www.brandycoke.com> & ... nbsp; ## |
7
|
|
|
############################################################################### |
8
|
|
|
## XOOPS - PHP Content Management System ## |
9
|
|
|
## Copyright (c) 2000 XOOPS.org ## |
10
|
|
|
## <https://xoops.org> ... nbsp; ## |
11
|
|
|
############################################################################### |
12
|
|
|
## This program is free software; you can redistribute it and/or modify ## |
13
|
|
|
## it under the terms of the GNU General Public License as published by ## |
14
|
|
|
## the Free Software Foundation; either version 2 of the License, or ## |
15
|
|
|
## (at your option) any later version. ## |
16
|
|
|
## ## |
17
|
|
|
## You may not change or alter any portion of this comment or credits ## |
18
|
|
|
## of supporting developers from this source code or any supporting ## |
19
|
|
|
## source code which is considered copyrighted (c) material of the ## |
20
|
|
|
## original comment or credit authors. ## |
21
|
|
|
## ## |
22
|
|
|
## This program is distributed in the hope that it will be useful, ## |
23
|
|
|
## but WITHOUT ANY WARRANTY; without even the implied warranty of ## |
24
|
|
|
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ## |
25
|
|
|
## GNU General Public License for more details. ## |
26
|
|
|
## ## |
27
|
|
|
## You should have received a copy of the GNU General Public License ## |
28
|
|
|
## along with this program; if not, write to the Free Software ## |
29
|
|
|
## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## |
30
|
|
|
############################################################################### |
31
|
|
|
/* |
32
|
|
|
* Adslight RSSFit plugin based on Jobs RSSFit plugin by www.jlmzone.com |
33
|
|
|
* Done by Bjuti (www.bjuti.info) |
34
|
|
|
* Last release date: Jan. 18 2010 |
35
|
|
|
* RSSFit version: 1.2 / 1.5 |
36
|
|
|
* XOOPS version: 2.0.13.2 / 2.2.3 / 2.3.2b / 2.4.3 |
37
|
|
|
*/ |
38
|
|
|
if (!defined('RSSFIT_ROOT_PATH')) { |
39
|
|
|
exit(); |
40
|
|
|
} |
41
|
|
|
|
42
|
|
|
/** |
43
|
|
|
* Class RssfitAdslight |
44
|
|
|
*/ |
45
|
|
|
class RssfitAdslight |
46
|
|
|
{ |
47
|
|
|
public $dirname = 'adslight'; |
48
|
|
|
public $modname; |
49
|
|
|
public $grab; |
50
|
|
|
public $module; // optional, see line 74 |
51
|
|
|
|
52
|
|
|
public function __construct() |
53
|
|
|
{ |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
public function loadModule(): bool |
57
|
|
|
{ |
58
|
|
|
$mod = &$GLOBALS['module_handler']->getByDirname($this->dirname); |
59
|
|
|
if (!$mod || !$mod->getVar('isactive')) { |
60
|
|
|
return false; |
61
|
|
|
} |
62
|
|
|
$this->modname = $mod->getVar('name'); |
63
|
|
|
//$this->module =& $mod; // optional, remove this line if there is nothing |
64
|
|
|
// to do with module info when grabbing entries |
65
|
|
|
return $mod; |
66
|
|
|
} |
67
|
|
|
|
68
|
|
|
/** |
69
|
|
|
* @param $obj |
70
|
|
|
* @return bool|array |
71
|
|
|
*/ |
72
|
|
|
public function &grabEntries($obj) |
|
|
|
|
73
|
|
|
{ |
74
|
|
|
global $xoopsDB; |
75
|
|
|
$myts = \MyTextSanitizer::getInstance(); |
|
|
|
|
76
|
|
|
$ret = false; |
77
|
|
|
$i = 0; |
78
|
|
|
// The following example code grabs the latest entries from the module MyLinks |
79
|
|
|
$sql = 'SELECT lid, title, status, desctext, date_created from ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid = 'Yes' ORDER BY date_created DESC"; |
80
|
|
|
$result = $xoopsDB->query($sql, $this->grab, 0); |
81
|
|
|
if (!$xoopsDB->isResultSet($result)) { |
82
|
|
|
\trigger_error("Query Failed! SQL: $sql- Error: " . $xoopsDB->error(), E_USER_ERROR); |
83
|
|
|
} |
84
|
|
|
while (false !== ($row = $xoopsDB->fetchArray($result))) { |
85
|
|
|
$link = XOOPS_URL . '/modules/' . $this->dirname . '/viewads.php?lid=' . $row['lid']; |
86
|
|
|
/* |
87
|
|
|
* Required elements of an RSS item |
88
|
|
|
*/ |
89
|
|
|
// 1. Title of an item |
90
|
|
|
$ret[$i]['title'] = $row['title']; |
91
|
|
|
// 2. URL of an item |
92
|
|
|
$ret[$i]['link'] = $link; |
93
|
|
|
// 3. Item modification date_created, must be in Unix time format |
94
|
|
|
$ret[$i]['timestamp'] = $row['date_created']; |
95
|
|
|
// 4. The item synopsis, or description, whatever |
96
|
|
|
$ret[$i]['description'] = $row['desctext']; // $myts->displayTarea($row['desctext']); |
97
|
|
|
/* |
98
|
|
|
* Optional elements of an RSS item |
99
|
|
|
*/ // 5. The item synopsis, or description, whatever |
100
|
|
|
// $ret[$i]['guid'] = $link; |
101
|
|
|
// 6. A string + domain that identifies a categorization taxonomy |
102
|
|
|
// $ret[$i]['category'] = $this->modname; |
103
|
|
|
// $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; |
104
|
|
|
// 7. extra tags examples |
105
|
|
|
$ret[$i]['extras'] = []; |
106
|
|
|
$i++; |
107
|
|
|
} |
108
|
|
|
|
109
|
|
|
return $ret; |
110
|
|
|
} |
111
|
|
|
} |
112
|
|
|
|
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.