From 184b53df69ef93309d9b4fa3c821f5c294a28aef Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 23 Oct 2017 23:39:40 -0400 Subject: [PATCH 001/154] php-cs-fixer --- class/misc.php | 2 +- class/plugins.php | 2 +- plugins/rssfit.adslight.php | 2 +- plugins/rssfit.buyersguidenews.php | 67 ++++++++++++++------------ plugins/rssfit.extcal.php | 4 +- plugins/rssfit.lexikon.php | 30 ++++++------ plugins/rssfit.myalbum.php | 28 +++++------ plugins/rssfit.pluginsample.php | 34 ++++++------- plugins/rssfit.queries.php | 2 +- plugins/rssfit.special.php | 2 +- plugins/rssfit.surnames.php | 2 +- plugins/rssfit.wfdownloads_podcast.php | 2 +- plugins/rssfit.wflinks.php | 2 +- 13 files changed, 92 insertions(+), 87 deletions(-) diff --git a/class/misc.php b/class/misc.php index e5bc0f82..e77f773a 100644 --- a/class/misc.php +++ b/class/misc.php @@ -40,7 +40,7 @@ class RssMisc extends XoopsObject public function __construct() { parent::__construct(); - // key, data_type, value, req, max, opt + // key, data_type, value, req, max, opt $this->initVar('misc_id', XOBJ_DTYPE_INT, null, false); $this->initVar('misc_category', XOBJ_DTYPE_TXTBOX, '', true, 15); $this->initVar('misc_title', XOBJ_DTYPE_TXTBOX, '', false, 255); diff --git a/class/plugins.php b/class/plugins.php index 00ad6664..8d0ae39a 100644 --- a/class/plugins.php +++ b/class/plugins.php @@ -40,7 +40,7 @@ class RssPlugins extends XoopsObject public function __construct() { parent::__construct(); - // key, data_type, value, req, max, opt + // key, data_type, value, req, max, opt $this->initVar("rssf_conf_id", XOBJ_DTYPE_INT, null); $this->initVar("rssf_filename", XOBJ_DTYPE_TXTBOX, ''); $this->initVar("rssf_activated", XOBJ_DTYPE_INT, 0); diff --git a/plugins/rssfit.adslight.php b/plugins/rssfit.adslight.php index ef9362cd..43181221 100644 --- a/plugins/rssfit.adslight.php +++ b/plugins/rssfit.adslight.php @@ -58,7 +58,7 @@ public function loadModule() } $this->modname = $mod->getVar('name'); //$this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries + // to do with module info when grabbing entries return $mod; } diff --git a/plugins/rssfit.buyersguidenews.php b/plugins/rssfit.buyersguidenews.php index a1f0cca9..76b2362c 100644 --- a/plugins/rssfit.buyersguidenews.php +++ b/plugins/rssfit.buyersguidenews.php @@ -39,42 +39,47 @@ * XOOPS version: 2.0.18.1 */ -if( !defined('RSSFIT_ROOT_PATH') ){ exit(); } +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} /** * Class RssfitBuyersguidenews */ -class RssfitBuyersguidenews{ - var $dirname = 'buyersguide'; - var $modname; - var $grab; +class RssfitBuyersguidenews +{ + public $dirname = 'buyersguide'; + public $modname; + public $grab; - function loadModule(){ - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if( !$mod || !$mod->getVar('isactive') ){ - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + return $mod; + } - function &grabEntries(&$obj){ - $ret = false; - include XOOPS_ROOT_PATH.'/modules/buyersguide/include/common.php'; - $items = $hBgNews->getRecentNews(0, $this->grab); - $i = 0; + public function &grabEntries(&$obj) + { + $ret = false; + include XOOPS_ROOT_PATH.'/modules/buyersguide/include/common.php'; + $items = $hBgNews->getRecentNews(0, $this->grab); + $i = 0; - if( false != $items && count($items) > 0 ){ - foreach($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('news_title', 'n'); - $ret[$i]['timestamp'] = $item->getVar('news_date'); - $ret[$i]['description'] = $item->getShortenText(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - $i++; - } - } - return $ret; - } + if (false != $items && count($items) > 0) { + foreach ($items as $item) { + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('news_title', 'n'); + $ret[$i]['timestamp'] = $item->getVar('news_date'); + $ret[$i]['description'] = $item->getShortenText(); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $i++; + } + } + return $ret; + } } diff --git a/plugins/rssfit.extcal.php b/plugins/rssfit.extcal.php index bcdda0e6..56151be9 100644 --- a/plugins/rssfit.extcal.php +++ b/plugins/rssfit.extcal.php @@ -72,7 +72,7 @@ public function loadModule() } $this->modname = $mod->getVar('name'); $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries + // to do with module info when grabbing entries return $mod; } @@ -123,7 +123,7 @@ public function &grabEntries(&$obj) $ret[$i]['link'] = $link; $ret[$i]['description'] = $desc; $ret[$i]['timestamp'] = $event->getVar('event_submitdate'); -// $ret[$i]['timestamp'] = time(); + // $ret[$i]['timestamp'] = time(); $ret[$i]['guid'] = $link; $ret[$i]['category'] = $category; } diff --git a/plugins/rssfit.lexikon.php b/plugins/rssfit.lexikon.php index 114ea358..f60b45c0 100644 --- a/plugins/rssfit.lexikon.php +++ b/plugins/rssfit.lexikon.php @@ -74,25 +74,25 @@ public function &grabEntries(&$obj) $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { // required - $ret[$i]['title'] = $row['term']; + $ret[$i]['title'] = $row['term']; $link = XOOPS_URL.'/modules/'.$this->dirname.'/entry.php?entryID='.$row['entryID']; - //$ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['link'] = $link; + //$ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['link'] = $link; $ret[$i]['timestamp'] = $row['datesub']; $ret[$i]['description'] = $myts->displayTarea($row['definition']); - // optional - //5. The item synopsis, or description, whatever - //$ret[$i]['guid'] = $link; - // 6. A string + domain that identifies a categorization taxonomy - $ret[$i]['category'] = $this->modname; + // optional + //5. The item synopsis, or description, whatever + //$ret[$i]['guid'] = $link; + // 6. A string + domain that identifies a categorization taxonomy + $ret[$i]['category'] = $this->modname; $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - /*$ret[$i]['extras'] = array(); - // 7a. without attribute - $ret[$i]['extras']['author'] = array('content' => 'aabbc@c.com'); - // 7b. with attributes - $ret[$i]['extras']['enclosure']['attributes'] = array('url' => 'url-to-any-file', 'length' => 1024000, 'type' => 'audio/mpeg'); - */ - $i++; + /*$ret[$i]['extras'] = array(); + // 7a. without attribute + $ret[$i]['extras']['author'] = array('content' => 'aabbc@c.com'); + // 7b. with attributes + $ret[$i]['extras']['enclosure']['attributes'] = array('url' => 'url-to-any-file', 'length' => 1024000, 'type' => 'audio/mpeg'); + */ + $i++; } return $ret; } diff --git a/plugins/rssfit.myalbum.php b/plugins/rssfit.myalbum.php index 863ce0f7..aa09e8cb 100644 --- a/plugins/rssfit.myalbum.php +++ b/plugins/rssfit.myalbum.php @@ -72,7 +72,7 @@ public function loadModule() } $this->modname = $mod->getVar('name'); $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries + // to do with module info when grabbing entries return $mod; } @@ -105,7 +105,7 @@ public function &grabEntries(&$obj) $myts = MyTextSanitizer::getInstance(); $ret = false; $i = 0; - // For myalbum-p with thumbs enabled + // For myalbum-p with thumbs enabled $sql = "SELECT p.lid, p.title, p.ext, p.date, t.description, c.cid, c.title as cat, p.submitter"; $sql .= " FROM ".$xoopsDB->prefix("myalbum_photos")." p, "; @@ -121,26 +121,26 @@ public function &grabEntries(&$obj) $title = $myts->displayTarea($row['title']); $cat = $myts->displayTarea($row['cat']); $catlink = XOOPS_URL.'/modules/'.$this->dirname.'/viewcat.php?cid='.$row['cid']; - /* - * Required elements of an RSS item - */ - // 1. Title of an item + /* + * Required elements of an RSS item + */ + // 1. Title of an item $ret[$i]['title'] = ($this->modname).': '.$title; - // 2. URL of an item + // 2. URL of an item $ret[$i]['link'] = $link; - // 3. Item modification date, must be in Unix time format + // 3. Item modification date, must be in Unix time format $ret[$i]['timestamp'] = $row['date']; - // 4. The item synopsis, or description, whatever + // 4. The item synopsis, or description, whatever $desc = '

'.$title.' '; $desc .= 'By '.$name.' in '.$cat.'
'; $desc .= $myts->displayTarea($row['description']).'


'; $ret[$i]['description'] = $desc; - /* - * Optional elements of an RSS item - */ - // 5. The item synopsis, or description, whatever + /* + * Optional elements of an RSS item + */ + // 5. The item synopsis, or description, whatever $ret[$i]['guid'] = $link; - // 6. A string + domain that identifies a categorization taxonomy + // 6. A string + domain that identifies a categorization taxonomy $ret[$i]['category'] = $cat; $ret[$i]['domain'] = $catlink; diff --git a/plugins/rssfit.pluginsample.php b/plugins/rssfit.pluginsample.php index 3eb6e6a9..8f8699b7 100644 --- a/plugins/rssfit.pluginsample.php +++ b/plugins/rssfit.pluginsample.php @@ -72,7 +72,7 @@ public function loadModule() } $this->modname = $mod->getVar('name'); $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries + // to do with module info when grabbing entries return $mod; } @@ -82,35 +82,35 @@ public function &grabEntries(&$obj) $myts = MyTextSanitizer::getInstance(); $ret = false; $i = 0; - // The following example code grabs the latest entries from the module MyLinks + // The following example code grabs the latest entries from the module MyLinks $sql = "SELECT l.lid, l.cid, l.title, l.date, t.description FROM ".$xoopsDB->prefix("mylinks_links")." l, ".$xoopsDB->prefix("mylinks_text")." t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC"; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?cid='.$row['cid'].'&lid='.$row['lid']; - /* - * Required elements of an RSS item - */ - // 1. Title of an item + /* + * Required elements of an RSS item + */ + // 1. Title of an item $ret[$i]['title'] = $row['title']; - // 2. URL of an item + // 2. URL of an item $ret[$i]['link'] = $link; - // 3. Item modification date, must be in Unix time format + // 3. Item modification date, must be in Unix time format $ret[$i]['timestamp'] = $row['date']; - // 4. The item synopsis, or description, whatever + // 4. The item synopsis, or description, whatever $ret[$i]['description'] = $myts->displayTarea($row['description']); - /* - * Optional elements of an RSS item - */ - // 5. The item synopsis, or description, whatever + /* + * Optional elements of an RSS item + */ + // 5. The item synopsis, or description, whatever $ret[$i]['guid'] = $link; - // 6. A string + domain that identifies a categorization taxonomy + // 6. A string + domain that identifies a categorization taxonomy $ret[$i]['category'] = $this->modname; $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - // 7. extra tags examples + // 7. extra tags examples $ret[$i]['extras'] = array(); - // 7a. without attribute + // 7a. without attribute $ret[$i]['extras']['author'] = array('content' => 'aabbc@c.com'); - // 7b. with attributes + // 7b. with attributes $ret[$i]['extras']['enclosure']['attributes'] = array('url' => 'url-to-any-file', 'length' => 1024000, 'type' => 'audio/mpeg'); $i++; } diff --git a/plugins/rssfit.queries.php b/plugins/rssfit.queries.php index dd91dc1a..a728234e 100644 --- a/plugins/rssfit.queries.php +++ b/plugins/rssfit.queries.php @@ -57,7 +57,7 @@ public function loadModule() } $this->modname = $mod->getVar('name'); $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries + // to do with module info when grabbing entries return $mod; } diff --git a/plugins/rssfit.special.php b/plugins/rssfit.special.php index f60980ca..d6148be2 100644 --- a/plugins/rssfit.special.php +++ b/plugins/rssfit.special.php @@ -72,7 +72,7 @@ public function loadModule() } $this->modname = $mod->getVar('name'); $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries + // to do with module info when grabbing entries return $mod; } diff --git a/plugins/rssfit.surnames.php b/plugins/rssfit.surnames.php index dc9ad1c1..cbb8f8f1 100644 --- a/plugins/rssfit.surnames.php +++ b/plugins/rssfit.surnames.php @@ -57,7 +57,7 @@ public function loadModule() } $this->modname = $mod->getVar('name'); $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries + // to do with module info when grabbing entries return $mod; } diff --git a/plugins/rssfit.wfdownloads_podcast.php b/plugins/rssfit.wfdownloads_podcast.php index ea892027..a9c1b476 100644 --- a/plugins/rssfit.wfdownloads_podcast.php +++ b/plugins/rssfit.wfdownloads_podcast.php @@ -77,7 +77,7 @@ public function &grabEntries(&$obj) $ret[$i]['description'] = $myts->displayTarea($row['description']); $ret[$i]['category'] = $this->modname; $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - // enclosure tag, a.k.a podcast + // enclosure tag, a.k.a podcast $ret[$i]['extras']['enclosure']['attributes'] = array('url' => XOOPS_URL.'/modules/'.$this->dirname.'/visit.php?cid='.$row['cid'].'&lid='.$row['lid'], 'length' => $row['size'], diff --git a/plugins/rssfit.wflinks.php b/plugins/rssfit.wflinks.php index af0d425f..c32da94e 100644 --- a/plugins/rssfit.wflinks.php +++ b/plugins/rssfit.wflinks.php @@ -58,7 +58,7 @@ public function grabEntries(&$obj) $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?cid='.$row['cid'].'&lid='.$row['lid']; $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $row['description']; - // optional + // optional $ret[$i]['category'] = $this->modname; $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; $i++; From 4ecb467a22c9667f64762a6c4301dc486d8040cc Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 23 Oct 2017 23:41:54 -0400 Subject: [PATCH 002/154] Callable name case mismatched in a call --- class/rssfeed.php | 4 ++-- plugins/rssfit.cbb.php | 4 ++-- plugins/rssfit.comments.php | 2 +- plugins/rssfit.extcal.php | 6 +++--- plugins/rssfit.myalbum.php | 6 +++--- plugins/rssfit.newbb2.php | 10 +++++----- plugins/rssfit.surnames.php | 6 +++--- plugins/rssfit.weblinks.php | 6 +++--- plugins/rssfit.wfdownloads.php | 2 +- plugins/rssfit.wfdownloads_podcast.php | 2 +- plugins/rssfit.wflinks.php | 2 +- 11 files changed, 25 insertions(+), 25 deletions(-) diff --git a/class/rssfeed.php b/class/rssfeed.php index 94804790..8313c950 100644 --- a/class/rssfeed.php +++ b/class/rssfeed.php @@ -73,8 +73,8 @@ public function __construct($modConfig, $xoopsConfig, $xoopsModule) { $this->myts = MyTextSanitizer::getInstance(); $this->rssmod = $xoopsModule; - $this->pHandler = xoops_getmodulehandler('plugins'); - $this->mHandler = xoops_getmodulehandler('misc'); + $this->pHandler = xoops_getModuleHandler('plugins'); + $this->mHandler = xoops_getModuleHandler('misc'); $this->modConfig = $modConfig; $this->xoopsConfig = $xoopsConfig; $this->channelreq = array('title' => $this->xoopsConfig['sitename'], diff --git a/plugins/rssfit.cbb.php b/plugins/rssfit.cbb.php index a36c28ed..1bf1dfb2 100644 --- a/plugins/rssfit.cbb.php +++ b/plugins/rssfit.cbb.php @@ -65,8 +65,8 @@ public function &grabEntries(&$obj) $xoopsModule = $this->module; $myts = MyTextSanitizer::getInstance(); $i = 0; - $forum_handler = xoops_getmodulehandler('forum', 'newbb'); - $topic_handler = xoops_getmodulehandler('topic', 'newbb'); + $forum_handler = xoops_getModuleHandler('forum', 'newbb'); + $topic_handler = xoops_getModuleHandler('topic', 'newbb'); $newbbConfig = $GLOBALS['config_handler']->getConfigsByCat(0, $this->module->getVar('mid')); $access_forums = $forum_handler->getForums(0, 'access'); diff --git a/plugins/rssfit.comments.php b/plugins/rssfit.comments.php index 8ac9c2a4..9fd39bca 100644 --- a/plugins/rssfit.comments.php +++ b/plugins/rssfit.comments.php @@ -60,7 +60,7 @@ public function &grabEntries(&$obj) { $ret = false; include_once XOOPS_ROOT_PATH.'/include/comment_constants.php'; - $comment_handler = xoops_gethandler('comment'); + $comment_handler = xoops_getHandler('comment'); $criteria = new CriteriaCompo(new Criteria('com_status', XOOPS_COMMENT_ACTIVE)); $criteria->setLimit($this->grab); $criteria->setSort('com_created'); diff --git a/plugins/rssfit.extcal.php b/plugins/rssfit.extcal.php index 56151be9..b37b8ff3 100644 --- a/plugins/rssfit.extcal.php +++ b/plugins/rssfit.extcal.php @@ -86,12 +86,12 @@ public function &grabEntries(&$obj) // read confgs to get timestamp format $extcal = $this->module; - $config_handler = &xoops_gethandler('config'); + $config_handler = &xoops_getHandler('config'); $extcalConfig = &$config_handler->getConfigsByCat(0, $extcal->getVar('mid')); $long_form=$extcalConfig['date_long']; - $eventHandler = xoops_getmodulehandler('event', 'extcal'); - $catHandler = xoops_getmodulehandler('cat', 'extcal'); + $eventHandler = xoops_getModuleHandler('event', 'extcal'); + $catHandler = xoops_getModuleHandler('cat', 'extcal'); $events = $eventHandler->getUpcomingEvent(0, $this->grab, 0); if (is_array($events)) { diff --git a/plugins/rssfit.myalbum.php b/plugins/rssfit.myalbum.php index aa09e8cb..0b9f76fa 100644 --- a/plugins/rssfit.myalbum.php +++ b/plugins/rssfit.myalbum.php @@ -87,12 +87,12 @@ public function myGetUnameFromId($uid) } if (!is_object($thisUser)) { - $member_handler = xoops_gethandler('member'); + $member_handler = xoops_getHandler('member'); $thisUser = $member_handler->getUser($uid); } - $name = htmlSpecialChars($thisUser->getVar('name')); + $name = htmlspecialchars($thisUser->getVar('name')); if ($name=='') { - $name = htmlSpecialChars($thisUser->getVar('uname')); + $name = htmlspecialchars($thisUser->getVar('uname')); } $lastUid=$uid; $lastName=$name; diff --git a/plugins/rssfit.newbb2.php b/plugins/rssfit.newbb2.php index 19d4b396..9c4271d8 100644 --- a/plugins/rssfit.newbb2.php +++ b/plugins/rssfit.newbb2.php @@ -73,12 +73,12 @@ public function myGetUnameFromId($uid) } if (!is_object($thisUser)) { - $member_handler = xoops_gethandler('member'); + $member_handler = xoops_getHandler('member'); $thisUser = $member_handler->getUser($uid); } - $name = htmlSpecialChars($thisUser->getVar('name')); + $name = htmlspecialchars($thisUser->getVar('name')); if ($name=='') { - $name = htmlSpecialChars($thisUser->getVar('uname')); + $name = htmlspecialchars($thisUser->getVar('uname')); } $lastUid=$uid; $lastName=$name; @@ -93,8 +93,8 @@ public function &grabEntries(&$obj) $myts = MyTextSanitizer::getInstance(); $ret = false; $i = 0; - $forum_handler = xoops_getmodulehandler('forum', 'newbb'); - $topic_handler = xoops_getmodulehandler('topic', 'newbb'); + $forum_handler = xoops_getModuleHandler('forum', 'newbb'); + $topic_handler = xoops_getModuleHandler('topic', 'newbb'); $newbbConfig = $config_handler->getConfigsByCat(0, $this->module->getVar('mid')); $access_forums = $forum_handler->getForums(0, 'access'); diff --git a/plugins/rssfit.surnames.php b/plugins/rssfit.surnames.php index cbb8f8f1..bdd6d69b 100644 --- a/plugins/rssfit.surnames.php +++ b/plugins/rssfit.surnames.php @@ -72,12 +72,12 @@ public function myGetUnameFromId($uid) } if (!is_object($thisUser)) { - $member_handler = xoops_gethandler('member'); + $member_handler = xoops_getHandler('member'); $thisUser = $member_handler->getUser($uid); } - $name = htmlSpecialChars($thisUser->getVar('name')); + $name = htmlspecialchars($thisUser->getVar('name')); if ($name=='') { - $name = htmlSpecialChars($thisUser->getVar('uname')); + $name = htmlspecialchars($thisUser->getVar('uname')); } $lastUid=$uid; $lastName=$name; diff --git a/plugins/rssfit.weblinks.php b/plugins/rssfit.weblinks.php index f05f8b76..1116ccd4 100644 --- a/plugins/rssfit.weblinks.php +++ b/plugins/rssfit.weblinks.php @@ -67,12 +67,12 @@ public function myGetUnameFromId($uid) } if (!is_object($thisUser)) { - $member_handler = xoops_gethandler('member'); + $member_handler = xoops_getHandler('member'); $thisUser = $member_handler->getUser($uid); } - $name = htmlSpecialChars($thisUser->getVar('name')); + $name = htmlspecialchars($thisUser->getVar('name')); if ($name=='') { - $name = htmlSpecialChars($thisUser->getVar('uname')); + $name = htmlspecialchars($thisUser->getVar('uname')); } $lastUid=$uid; $lastName=$name; diff --git a/plugins/rssfit.wfdownloads.php b/plugins/rssfit.wfdownloads.php index 9fce7a2c..d5a22aa0 100644 --- a/plugins/rssfit.wfdownloads.php +++ b/plugins/rssfit.wfdownloads.php @@ -62,7 +62,7 @@ public function &grabEntries(&$obj) { global $xoopsDB; $myts = MyTextSanitizer::getInstance(); - $perm_handler = xoops_gethandler('groupperm'); + $perm_handler = xoops_getHandler('groupperm'); $ret = false; $i = 0; $sql = "SELECT lid, cid, title, date, description FROM ".$xoopsDB->prefix("wfdownloads_downloads")." WHERE status > 0 AND offline = 0 ORDER BY date DESC"; diff --git a/plugins/rssfit.wfdownloads_podcast.php b/plugins/rssfit.wfdownloads_podcast.php index a9c1b476..cd66221d 100644 --- a/plugins/rssfit.wfdownloads_podcast.php +++ b/plugins/rssfit.wfdownloads_podcast.php @@ -62,7 +62,7 @@ public function &grabEntries(&$obj) { global $xoopsDB; $myts = MyTextSanitizer::getInstance(); - $perm_handler = xoops_gethandler('groupperm'); + $perm_handler = xoops_getHandler('groupperm'); $ret = false; $i = 0; $sql = "SELECT lid, cid, title, date, description, filetype, size FROM ".$xoopsDB->prefix("wfdownloads_downloads")." WHERE status > 0 AND offline = 0 AND (expired > ".time()." OR expired = 0) AND published <= ".time()." ORDER BY date DESC"; diff --git a/plugins/rssfit.wflinks.php b/plugins/rssfit.wflinks.php index c32da94e..5d7ea109 100644 --- a/plugins/rssfit.wflinks.php +++ b/plugins/rssfit.wflinks.php @@ -44,7 +44,7 @@ public function grabEntries(&$obj) global $xoopsDB, $xoopsUser; $groups = is_object($xoopsUser) ? $xoopsUser -> getGroups() : XOOPS_GROUP_ANONYMOUS; - $gperm_handler = &xoops_gethandler('groupperm'); + $gperm_handler = &xoops_getHandler('groupperm'); $myts = MyTextSanitizer::getInstance(); $ret = array(); From d53a6d37a133c6b4e0663c75ad6efd250108e3c9 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 23 Oct 2017 23:43:05 -0400 Subject: [PATCH 003/154] __DIR__ --- admin/about.php | 2 +- admin/admin_header.php | 2 +- admin/index.php | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/admin/about.php b/admin/about.php index ef315938..51c522e6 100644 --- a/admin/about.php +++ b/admin/about.php @@ -19,7 +19,7 @@ * @author XOOPS Development Team */ -include_once dirname(__FILE__) . '/admin_header.php'; +include_once __DIR__ . '/admin_header.php'; $moduleAdmin = Admin::getInstance(); diff --git a/admin/admin_header.php b/admin/admin_header.php index fd2be48c..a3ec27d5 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -36,7 +36,7 @@ class_exists('\Xmf\Module\Admin') or die('XMF is required.'); //if functions.php file exist -require_once dirname(dirname(__FILE__)) . '/include/common.php'; +require_once dirname(__DIR__) . '/include/common.php'; //require '../include/common.php'; global $xoopsModule; diff --git a/admin/index.php b/admin/index.php index d793c263..6f744a06 100644 --- a/admin/index.php +++ b/admin/index.php @@ -21,7 +21,7 @@ */ -include_once dirname(__FILE__) . '/admin_header.php'; +include_once __DIR__ . '/admin_header.php'; $moduleAdmin = Admin::getInstance(); $do = Request::getString('do', ''); From 5f81f2816d7f852c9f4516fcdc75c0cdbbe60f70 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 23 Oct 2017 23:43:47 -0400 Subject: [PATCH 004/154] Type casting --- admin/do_subfeeds.php | 2 +- class/misc.php | 6 +++--- class/plugins.php | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index 403ebe84..6615e3cb 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -103,7 +103,7 @@ } break; case 'edit': - $id = isset($_GET['feed']) ? intval($_GET['feed']) : 0; + $id = isset($_GET['feed']) ? (int)$_GET['feed'] : 0; if (!empty($id)) { $sub =& $plugins_handler->get($id); if (!$handler =& $plugins_handler->checkPlugin($sub)) { diff --git a/class/misc.php b/class/misc.php index e77f773a..796cd079 100644 --- a/class/misc.php +++ b/class/misc.php @@ -90,7 +90,7 @@ public function create() public function get($id, $fields='*') { - $criteria = new Criteria($this->obj_key, intval($id)); + $criteria = new Criteria($this->obj_key, (int)$id); if ($objs =& $this->getObjects($criteria)) { return count($objs) != 1 ? false : $objs[0]; } @@ -163,7 +163,7 @@ public function insert(XoopsObject $obj) //, $force = false) } foreach ($obj->cleanVars as $k => $v) { if ($obj->vars[$k]['data_type'] == XOBJ_DTYPE_INT) { - $cleanvars[$k] = intval($v); + $cleanvars[$k] = (int)$v; } else { $cleanvars[$k] = $this->db->quoteString($v); } @@ -205,7 +205,7 @@ public function modifyObjects($criteria=null, $fields=array(), $force=false) $sql = ''; foreach ($fields as $k => $v) { $sql .= $k.' = '; - $sql .= $obj->vars[$k]['data_type'] == 3 ? intval($v) : $this->db->quoteString($v); + $sql .= $obj->vars[$k]['data_type'] == 3 ? (int)$v : $this->db->quoteString($v); $sql .= ', '; } $sql = substr($sql, 0, -2); diff --git a/class/plugins.php b/class/plugins.php index 8d0ae39a..9eec6dca 100644 --- a/class/plugins.php +++ b/class/plugins.php @@ -89,7 +89,7 @@ public function create() public function get($id, $fields='*') { $ret = false; - $criteria = new Criteria($this->obj_key, intval($id)); + $criteria = new Criteria($this->obj_key, (int)$id); if ($objs =& $this->getObjects($criteria) && count($objs) === 1) { $ret =& $objs[0]; } @@ -110,7 +110,7 @@ public function insert(XoopsObject $obj) //, $force=false) } foreach ($obj->cleanVars as $k=>$v) { if ($obj->vars[$k]['data_type'] == XOBJ_DTYPE_INT) { - $cleanvars[$k] = intval($v); + $cleanvars[$k] = (int)$v; } else { $cleanvars[$k] = $this->db->quoteString($v); } @@ -217,7 +217,7 @@ public function modifyObjects($criteria=null, $fields=array(), $force=false) $sql = ''; foreach ($fields as $k => $v) { $sql .= $k.' = '; - $sql .= $obj->vars[$k]['data_type'] == 3 ? intval($v) : $this->db->quoteString($v); + $sql .= $obj->vars[$k]['data_type'] == 3 ? (int)$v : $this->db->quoteString($v); $sql .= ', '; } $sql = substr($sql, 0, -2); From 04fbfbd8debb09175a1006a16f5bdc2a4735fa93 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 23 Oct 2017 23:46:15 -0400 Subject: [PATCH 005/154] Unnecessary parentheses --- include/install.php | 4 ++-- plugins/rssfit.myalbum.php | 2 +- plugins/rssfit.newbb2.php | 2 +- plugins/rssfit.news.php | 2 +- plugins/rssfit.queries.php | 2 +- plugins/rssfit.smartfaq.php | 2 +- plugins/rssfit.surnames.php | 2 +- plugins/rssfit.weblinks.php | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/install.php b/include/install.php index 36461717..e13cd3db 100644 --- a/include/install.php +++ b/include/install.php @@ -94,9 +94,9 @@ function rssfInstallLangFile(&$xoopsMod, $lang) $file = XOOPS_ROOT_PATH.'/modules/'.$xoopsMod->getVar('dirname') .'/language/%s/install.php'; if (file_exists(sprintf($file, $lang))) { - include(sprintf($file, $lang)); + include sprintf($file, $lang); } else { - include(sprintf($file, 'english')); + include sprintf($file, 'english'); } } diff --git a/plugins/rssfit.myalbum.php b/plugins/rssfit.myalbum.php index 0b9f76fa..77a93814 100644 --- a/plugins/rssfit.myalbum.php +++ b/plugins/rssfit.myalbum.php @@ -125,7 +125,7 @@ public function &grabEntries(&$obj) * Required elements of an RSS item */ // 1. Title of an item - $ret[$i]['title'] = ($this->modname).': '.$title; + $ret[$i]['title'] = $this->modname . ': ' . $title; // 2. URL of an item $ret[$i]['link'] = $link; // 3. Item modification date, must be in Unix time format diff --git a/plugins/rssfit.newbb2.php b/plugins/rssfit.newbb2.php index 9c4271d8..6daaa167 100644 --- a/plugins/rssfit.newbb2.php +++ b/plugins/rssfit.newbb2.php @@ -116,7 +116,7 @@ public function &grabEntries(&$obj) $result = $xoopsDB->query($query, $this->grab); while ($row = $xoopsDB->fetchArray($result)) { $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewtopic.php?topic_id='.$row['topic_id'].'&forum='.$row['forum_id'].'&post_id='.$row['post_id'].'#forumpost'.$row['post_id']; - $ret[$i]['title'] = ($this->modname).': '.$row['subject']; + $ret[$i]['title'] = $this->modname . ': ' . $row['subject']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; $ret[$i]['timestamp'] = $row['post_time']; $ret[$i]['description'] = sprintf("Posted by: %s
%s", $this->myGetUnameFromId($row['uid']), $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr'])); diff --git a/plugins/rssfit.news.php b/plugins/rssfit.news.php index 5417968a..e9b94b85 100644 --- a/plugins/rssfit.news.php +++ b/plugins/rssfit.news.php @@ -70,7 +70,7 @@ public function &grabEntries(&$obj) } if (count($news) > 0) { for ($i=0; $imodname).': '.$myts->undoHtmlSpecialChars($news[$i]->title()); + $ret[$i]['title'] = $this->modname . ': ' . $myts->undoHtmlSpecialChars($news[$i]->title()); $ret[$i]['link'] = XOOPS_URL.'/modules/news/article.php?storyid='.$news[$i]->storyid(); $ret[$i]['guid'] = XOOPS_URL.'/modules/news/article.php?storyid='.$news[$i]->storyid(); $ret[$i]['timestamp'] = $news[$i]->published(); diff --git a/plugins/rssfit.queries.php b/plugins/rssfit.queries.php index a728234e..c4b78ef4 100644 --- a/plugins/rssfit.queries.php +++ b/plugins/rssfit.queries.php @@ -84,7 +84,7 @@ public function &grabEntries(&$obj) $desc=substr($desc, 0, 200).'...'; } $link = XOOPS_URL.'/modules/queries/view.php?id='.$row['id']; - $ret[$i]['title'] = ($this->modname).': '.$row['title']; + $ret[$i]['title'] = $this->modname . ': ' . $row['title']; $ret[$i]['link'] = $link; $ret[$i]['timestamp'] = $row['posted']; $ret[$i]['guid'] = $link; diff --git a/plugins/rssfit.smartfaq.php b/plugins/rssfit.smartfaq.php index 3597c797..dbd2487b 100644 --- a/plugins/rssfit.smartfaq.php +++ b/plugins/rssfit.smartfaq.php @@ -59,7 +59,7 @@ public function loadModule() public function &grabEntries(&$obj) { $ret = false; - @include_once(XOOPS_ROOT_PATH."/modules/smartfaq/include/functions.php"); + @include_once XOOPS_ROOT_PATH . "/modules/smartfaq/include/functions.php"; $faq_handler = sf_gethandler('faq'); $faqs = $faq_handler->getAllPublished($this->grab, 0); if (false != $faqs && count($faqs) > 0) { diff --git a/plugins/rssfit.surnames.php b/plugins/rssfit.surnames.php index bdd6d69b..bc3cd9c2 100644 --- a/plugins/rssfit.surnames.php +++ b/plugins/rssfit.surnames.php @@ -115,7 +115,7 @@ public function &grabEntries(&$obj) if ($i<=$this->grab) { $desc=""; $name = $this->myGetUnameFromId($row['uid']); - $ret[$i]['title'] = ($this->modname).': by '.$name; + $ret[$i]['title'] = $this->modname . ': by ' . $name; $ret[$i]['link'] = XOOPS_URL.'/modules/surnames/list.php?uid='.$row['uid']; $ret[$i]['timestamp'] = $changedate; diff --git a/plugins/rssfit.weblinks.php b/plugins/rssfit.weblinks.php index 1116ccd4..e3dc2f2b 100644 --- a/plugins/rssfit.weblinks.php +++ b/plugins/rssfit.weblinks.php @@ -90,7 +90,7 @@ public function &grabEntries(&$obj) while ($row = $xoopsDB->fetchArray($result)) { $title=$row['title']; $name = $this->myGetUnameFromId($row['uid']); - $ret[$i]['title'] = ($this->modname).': '.$title; + $ret[$i]['title'] = $this->modname . ': ' . $title; $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?lid='.$row['lid'].'&keywords='; $ret[$i]['link'] = $link; $ret[$i]['timestamp'] = $row['time_update']; From e26d8d367038098a0776087c90d019c1a9b341ed Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 23 Oct 2017 23:47:00 -0400 Subject: [PATCH 006/154] Unnecessary double quotes --- admin/admin_footer.php | 4 +- admin/do_plugins.php | 4 +- admin/index.php | 2 +- admin/menu.php | 36 ++++++------- class/plugins.php | 26 ++++----- class/rssfeed.php | 2 +- include/common.php | 12 ++--- include/functions.php | 2 +- include/install.php | 73 +++++++++++++++----------- language/english/admin.php | 30 +++++------ language/english/modinfo.php | 62 +++++++++++----------- plugins/rssfit.adslight.php | 2 +- plugins/rssfit.extcal.php | 4 +- plugins/rssfit.lexikon.php | 3 +- plugins/rssfit.myalbum.php | 12 ++--- plugins/rssfit.mydownloads.php | 4 +- plugins/rssfit.mylinks.php | 4 +- plugins/rssfit.mytube.php | 4 +- plugins/rssfit.newbb2.php | 2 +- plugins/rssfit.pical.php | 3 +- plugins/rssfit.pluginsample.php | 4 +- plugins/rssfit.queries.php | 4 +- plugins/rssfit.rmdp.php | 2 +- plugins/rssfit.smartpartner.php | 2 +- plugins/rssfit.smartsection.php | 2 +- plugins/rssfit.surnames.php | 6 +-- plugins/rssfit.weblinks.php | 2 +- plugins/rssfit.wfdownloads.php | 3 +- plugins/rssfit.wfdownloads_podcast.php | 5 +- plugins/rssfit.wflinks.php | 2 +- plugins/rssfit.wfsection.php | 8 ++- plugins/rssfit.xoopstube.php | 4 +- xoops_version.php | 26 ++++----- 33 files changed, 197 insertions(+), 164 deletions(-) diff --git a/admin/admin_footer.php b/admin/admin_footer.php index ffeab884..458183dd 100644 --- a/admin/admin_footer.php +++ b/admin/admin_footer.php @@ -24,7 +24,7 @@ ."
\n" ." XOOPS\n" ."
\n" - ." " . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" - .""; + . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" + . ''; xoops_cp_footer(); diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 3b056532..1adb868b 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -106,7 +106,7 @@ $ret .= '
' . $e; } } else { - $ret .= '' . _AM_PLUGIN_UNKNOWNERROR . ""; + $ret .= '' . _AM_PLUGIN_UNKNOWNERROR . ''; } } $ret .= "\n"; @@ -153,7 +153,7 @@ $ret .= '
' . $e; } } else { - $ret .= '' . _AM_PLUGIN_UNKNOWNERROR . ""; + $ret .= '' . _AM_PLUGIN_UNKNOWNERROR . ''; } $action->setExtra('disabled="disabled"'); } diff --git a/admin/index.php b/admin/index.php index 6f744a06..4901a355 100644 --- a/admin/index.php +++ b/admin/index.php @@ -26,7 +26,7 @@ $do = Request::getString('do', ''); $op = Request::getString('op', 'list'); -define("RSSFIT_OK", 1); +define('RSSFIT_OK', 1); if (file_exists(RSSFIT_ROOT_PATH.'admin/do_'.$do.'.php')) { include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; diff --git a/admin/menu.php b/admin/menu.php index a8e3f5af..8765b061 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -16,7 +16,7 @@ * @since * @author XOOPS Development Team */ -defined("XOOPS_ROOT_PATH") or die("XOOPS root path not defined"); +defined('XOOPS_ROOT_PATH') or die('XOOPS root path not defined'); // get path to icons $pathIcon32=''; @@ -24,37 +24,37 @@ $pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); } -$adminmenu = array(); -$i=0; -$adminmenu[$i]["title"] = _MI_RSSFIT_INDEX; -$adminmenu[$i]['link'] = "admin/index.php"; -$adminmenu[$i]["icon"] = $pathIcon32 . '/home.png'; +$adminmenu = array(); +$i =0; +$adminmenu[$i]['title'] = _MI_RSSFIT_INDEX; +$adminmenu[$i]['link'] = 'admin/index.php'; +$adminmenu[$i]['icon'] = $pathIcon32 . '/home.png'; ++$i; $adminmenu[$i]['title'] = _MI_RSSFIT_ADMENU1; -$adminmenu[$i]['link'] = "admin/?do=intro"; +$adminmenu[$i]['link'] = 'admin/?do=intro'; //$adminmenu[$i]['link'] = "admin/do_intro.php"; -$adminmenu[$i]["icon"] = $pathIcon32 . '/folder_txt.png'; +$adminmenu[$i]['icon'] = $pathIcon32 . '/folder_txt.png'; ++$i; $adminmenu[$i]['title'] = _MI_RSSFIT_ADMENU2; -$adminmenu[$i]['link'] = "admin/?do=plugins"; +$adminmenu[$i]['link'] = 'admin/?do=plugins'; //$adminmenu[$i]['link'] = "admin/do_plugins.php"; -$adminmenu[$i]["icon"] = 'images/icons/32/plugin.png'; +$adminmenu[$i]['icon'] = 'images/icons/32/plugin.png'; ++$i; $adminmenu[$i]['title'] = _MI_RSSFIT_ADMENU3; -$adminmenu[$i]['link'] = "admin/?do=channel"; +$adminmenu[$i]['link'] = 'admin/?do=channel'; //$adminmenu[$i]['link'] = "admin/do_channel.php"; -$adminmenu[$i]["icon"] = $pathIcon32 . '/compfile.png'; +$adminmenu[$i]['icon'] = $pathIcon32 . '/compfile.png'; ++$i; $adminmenu[$i]['title'] = _MI_RSSFIT_ADMENU4; -$adminmenu[$i]['link'] = "admin/?do=subfeeds"; +$adminmenu[$i]['link'] = 'admin/?do=subfeeds'; //$adminmenu[$i]['link'] = "admin/do_subfeeds.php"; -$adminmenu[$i]["icon"] = $pathIcon32 . '/groupmod.png'; +$adminmenu[$i]['icon'] = $pathIcon32 . '/groupmod.png'; ++$i; $adminmenu[$i]['title'] = _MI_RSSFIT_ADMENU5; -$adminmenu[$i]['link'] = "admin/?do=sticky"; -$adminmenu[$i]["icon"] = $pathIcon32 . '/attach.png'; +$adminmenu[$i]['link'] = 'admin/?do=sticky'; +$adminmenu[$i]['icon'] = $pathIcon32 . '/attach.png'; ++$i; $adminmenu[$i]['title'] = _MI_RSSFIT_ABOUT; -$adminmenu[$i]["link"] = "admin/about.php"; -$adminmenu[$i]["icon"] = $pathIcon32 . '/about.png'; +$adminmenu[$i]['link'] = 'admin/about.php'; +$adminmenu[$i]['icon'] = $pathIcon32 . '/about.png'; diff --git a/class/plugins.php b/class/plugins.php index 9eec6dca..c8ed5d62 100644 --- a/class/plugins.php +++ b/class/plugins.php @@ -41,19 +41,19 @@ public function __construct() { parent::__construct(); // key, data_type, value, req, max, opt - $this->initVar("rssf_conf_id", XOBJ_DTYPE_INT, null); - $this->initVar("rssf_filename", XOBJ_DTYPE_TXTBOX, ''); - $this->initVar("rssf_activated", XOBJ_DTYPE_INT, 0); - $this->initVar("rssf_grab", XOBJ_DTYPE_INT, 0, true); - $this->initVar("rssf_order", XOBJ_DTYPE_INT, 0); - $this->initVar("subfeed", XOBJ_DTYPE_INT, 0); - $this->initVar("sub_entries", XOBJ_DTYPE_INT, 0); - $this->initVar("sub_link", XOBJ_DTYPE_TXTBOX, ''); - $this->initVar("sub_title", XOBJ_DTYPE_TXTBOX, ''); - $this->initVar("sub_desc", XOBJ_DTYPE_TXTBOX, ''); - $this->initVar("img_url", XOBJ_DTYPE_TXTBOX, ''); - $this->initVar("img_link", XOBJ_DTYPE_TXTBOX, ''); - $this->initVar("img_title", XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('rssf_conf_id', XOBJ_DTYPE_INT, null); + $this->initVar('rssf_filename', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('rssf_activated', XOBJ_DTYPE_INT, 0); + $this->initVar('rssf_grab', XOBJ_DTYPE_INT, 0, true); + $this->initVar('rssf_order', XOBJ_DTYPE_INT, 0); + $this->initVar('subfeed', XOBJ_DTYPE_INT, 0); + $this->initVar('sub_entries', XOBJ_DTYPE_INT, 0); + $this->initVar('sub_link', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('sub_title', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('sub_desc', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('img_url', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('img_link', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('img_title', XOBJ_DTYPE_TXTBOX, ''); } } diff --git a/class/rssfeed.php b/class/rssfeed.php index 8313c950..2da46b1a 100644 --- a/class/rssfeed.php +++ b/class/rssfeed.php @@ -250,7 +250,7 @@ public function strrposDetect($text, $find) public function rssTimeStamp($time) { - return date("D, j M Y H:i:s O", $time); + return date('D, j M Y H:i:s O', $time); } public function sortTimestamp($a, $b) diff --git a/include/common.php b/include/common.php index 76cca07a..fb4f0990 100644 --- a/include/common.php +++ b/include/common.php @@ -32,12 +32,12 @@ ## Project: RSSFit ## ############################################################################### -if (!defined("RSSFIT_CONSTANTS_DEFINED")) { - define("RSSFIT_ROOT_PATH", XOOPS_ROOT_PATH.'/modules/'.$xoopsModule->getVar('dirname').'/'); - define("RSSFIT_URL", XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/'); - define("RSSFIT_URL_FEED", RSSFIT_URL.'rss.php'); - define("RSSFIT_ADMIN_URL", XOOPS_URL.'/modules/'.$xoopsModule->getVar('dirname').'/admin/'); - define("RSSFIT_CONSTANTS_DEFINED", 1); +if (!defined('RSSFIT_CONSTANTS_DEFINED')) { + define('RSSFIT_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/'); + define('RSSFIT_URL', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/'); + define('RSSFIT_URL_FEED', RSSFIT_URL . 'rss.php'); + define('RSSFIT_ADMIN_URL', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/'); + define('RSSFIT_CONSTANTS_DEFINED', 1); } require_once RSSFIT_ROOT_PATH.'class/rssfeed.php'; diff --git a/include/functions.php b/include/functions.php index 6c54183a..c4d6685b 100644 --- a/include/functions.php +++ b/include/functions.php @@ -45,7 +45,7 @@ function genSpecMoreInfo($spec=0, &$rss) return rssfGenAnchor($rss->specUrl($spec), _AM_EDIT_CHANNEL_QMARK, 'spec', _AM_EDIT_CHANNEL_MOREINFO); } -function rssfGenAnchor($url='', $text='', $target="", $title='', $class='', $id='') +function rssfGenAnchor($url='', $text='', $target= '', $title='', $class='', $id='') { if (!empty($url)) { $ret = ''; diff --git a/include/install.php b/include/install.php index e13cd3db..789b9890 100644 --- a/include/install.php +++ b/include/install.php @@ -43,9 +43,16 @@ function xoops_module_install_rss(XoopsModule $xoopsMod) $myts = MyTextSanitizer::getInstance(); rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); $intro_setting = array('dohtml'=>1, 'dobr'=>1, 'sub'=>stripslashes(_INSTALL_INTRO_SUB)); - $sql[] = "INSERT INTO `".$xoopsDB->prefix('rssfit_misc')."` VALUES (1, ".$xoopsDB->quoteString('intro').", ".$xoopsDB->quoteString(stripslashes(_INTRO_TITLE)).", ".$xoopsDB->quoteString(stripslashes(_INTRO_CONTENT)).", ".$xoopsDB->quoteString(serialize($intro_setting)).")"; + $sql[] = 'INSERT INTO `' + . $xoopsDB->prefix('rssfit_misc') . '` VALUES (1, ' + . $xoopsDB->quoteString('intro') . ', ' + . $xoopsDB->quoteString(stripslashes(_INTRO_TITLE)) . ', ' + . $xoopsDB->quoteString(stripslashes(_INTRO_CONTENT)) . ', ' + . $xoopsDB->quoteString(serialize($intro_setting)) . ')'; $sql[] = rssfInsertChannel($xoopsMod); - $sql[] = "INSERT INTO ".$xoopsDB->prefix('rssfit_misc')." VALUES "."('', 'sticky', '', '', ".$xoopsDB->quoteString(serialize(array('dohtml'=>0, 'dobr'=>0, 'feeds'=>array(0=>'0'), 'link'=>XOOPS_URL))).")"; + $sql[] = 'INSERT INTO ' + . $xoopsDB->prefix('rssfit_misc') . ' VALUES ' + . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(array('dohtml' =>0, 'dobr' =>0, 'feeds' =>array(0 =>'0'), 'link' =>XOOPS_URL))) . ')'; foreach ($sql as $s) { if (false == $xoopsDB->query($s)) { echo ''.$xoopsDB->error().'
'.$s.'

'; @@ -65,16 +72,21 @@ function xoops_module_update_rss(XoopsModule $xoopsMod, $oldversion) { global $xoopsDB, $xoopsConfig; rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); - list($rows) = $xoopsDB->fetchRow($xoopsDB->query("SELECT COUNT(*) FROM ".$xoopsDB->prefix('rssfit_misc')." WHERE misc_category = 'channel'")); + list($rows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('rssfit_misc') . " WHERE misc_category = 'channel'")); if (!$rows) { $sql[] = 'ALTER TABLE `'.$xoopsDB->prefix('rssfit_misc').'` ADD `misc_setting` TEXT NOT NULL;'; $sql[] = 'ALTER TABLE `'.$xoopsDB->prefix('rssfit_misc').'` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; $intro_setting = array('dohtml'=>1, 'dobr'=>1, 'sub'=>_INSTALL_INTRO_SUB); - $sql[] = "UPDATE `".$xoopsDB->prefix('rssfit_misc')."` SET misc_setting = ".$xoopsDB->quoteString(serialize($intro_setting))." WHERE misc_category = 'intro'"; - $sql[] = "ALTER TABLE `".$xoopsDB->prefix('rssfit_plugins')."` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; - $sql[] = "UPDATE `".$xoopsDB->prefix('rssfit_plugins')."` SET sub_entries = 5"; + $sql[] = 'UPDATE `' + . $xoopsDB->prefix('rssfit_misc') . '` SET misc_setting = ' + . $xoopsDB->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; + $sql[] = 'ALTER TABLE `' + . $xoopsDB->prefix('rssfit_plugins') . "` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; + $sql[] = 'UPDATE `' . $xoopsDB->prefix('rssfit_plugins') . '` SET sub_entries = 5'; $sql[] = rssfInsertChannel($xoopsMod); - $sql[] = "INSERT INTO ".$xoopsDB->prefix('rssfit_misc')." VALUES "."('', 'sticky', '', '', ".$xoopsDB->quoteString(serialize(array('dohtml'=>0, 'dobr'=>0, 'feeds'=>array(0=>'0'), 'link'=>XOOPS_URL))).")"; + $sql[] = 'INSERT INTO ' + . $xoopsDB->prefix('rssfit_misc') . ' VALUES ' + . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(array('dohtml' =>0, 'dobr' =>0, 'feeds' =>array(0 =>'0'), 'link' =>XOOPS_URL))) . ')'; foreach ($sql as $s) { if (false == $xoopsDB->query($s)) { echo ''.$xoopsDB->error().'
'.$s.'

'; @@ -110,29 +122,30 @@ function rssfInsertChannel(&$xoopsMod) global $xoopsDB, $xoopsConfig; $url = $xoopsDB->quoteString(XOOPS_URL); $sitename = $xoopsDB->quoteString($xoopsConfig['sitename']); - list($copyright) = $xoopsDB->fetchRow($xoopsDB->query("SELECT conf_value FROM ".$xoopsDB->prefix('config')." WHERE conf_name = 'meta_copyright' AND conf_modid = 1 AND conf_catid = ".XOOPS_CONF_METAFOOTER)); - return "INSERT INTO ".$xoopsDB->prefix('rssfit_misc') - ." VALUES "."('', 'channel', 'title', ".$sitename.", '')" - .", ('', 'channel', 'link', ".$url.", '')" - .", ('', 'channel', 'description', " - .$xoopsDB->quoteString($xoopsConfig['slogan']) - .", ''), ('', 'channel', 'copyright', " - .$xoopsDB->quoteString($copyright) - .", ''), ('', 'channel', 'managingEditor', " - .$xoopsDB->quoteString($xoopsConfig['adminmail'] + list($copyright) = $xoopsDB->fetchRow($xoopsDB->query('SELECT conf_value FROM ' + . $xoopsDB->prefix('config') . " WHERE conf_name = 'meta_copyright' AND conf_modid = 1 AND conf_catid = " . XOOPS_CONF_METAFOOTER)); + return 'INSERT INTO ' . $xoopsDB->prefix('rssfit_misc') + . ' VALUES ' . "('', 'channel', 'title', " . $sitename . ", '')" + . ", ('', 'channel', 'link', " . $url . ", '')" + . ", ('', 'channel', 'description', " + . $xoopsDB->quoteString($xoopsConfig['slogan']) + . ", ''), ('', 'channel', 'copyright', " + . $xoopsDB->quoteString($copyright) + . ", ''), ('', 'channel', 'managingEditor', " + . $xoopsDB->quoteString($xoopsConfig['adminmail'] .' ('.$xoopsConfig['sitename'].')') - .", ''), ('', 'channel', 'webMaster', " - .$xoopsDB->quoteString($xoopsConfig['adminmail'] - .' ('.$xoopsConfig['sitename'].')').", '')" - .", ('', 'channel', 'category', '', '')" - .", ('', 'channel', 'generator', " - .$xoopsDB->quoteString(XOOPS_VERSION + . ", ''), ('', 'channel', 'webMaster', " + . $xoopsDB->quoteString($xoopsConfig['adminmail'] + .' ('.$xoopsConfig['sitename'].')') . ", '')" + . ", ('', 'channel', 'category', '', '')" + . ", ('', 'channel', 'generator', " + . $xoopsDB->quoteString(XOOPS_VERSION .' / RSSFit '.$xoopsMod->getInfo('version')) - .", ''), ('', 'channel', 'docs', " - .$xoopsDB->quoteString('http://blogs.law.harvard.edu/tech/rss').", '')" - .", ('', 'channelimg', 'url', " - .$xoopsDB->quoteString(XOOPS_URL.'/images/logo.gif').", '')" - .", ('', 'channelimg', 'title', ".$sitename.", '')" - .", ('', 'channelimg', 'link', ".$url.", '')" - .";"; + . ", ''), ('', 'channel', 'docs', " + . $xoopsDB->quoteString('http://blogs.law.harvard.edu/tech/rss') . ", '')" + . ", ('', 'channelimg', 'url', " + . $xoopsDB->quoteString(XOOPS_URL.'/images/logo.gif') . ", '')" + . ", ('', 'channelimg', 'title', " . $sitename . ", '')" + . ", ('', 'channelimg', 'link', " . $url . ", '')" + . ';'; } diff --git a/language/english/admin.php b/language/english/admin.php index 547e7434..4ee69131 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -1,18 +1,18 @@
{SITEURL} will print '.XOOPS_URL.'/'); +define('_AM_EDIT_INTRO', 'Edit introduction'); +define('_AM_EDIT_INTRO_TITLE', 'Introduction title'); +define('_AM_EDIT_INTRO_TITLE_DESC', '{SITENAME} will print ' . $xoopsConfig['sitename']); +define('_AM_EDIT_INTRO_TEXT', 'Introduction text'); +define('_AM_EDIT_INTRO_TEXT_DESC', _AM_EDIT_INTRO_TITLE_DESC . '

{SITEURL} will print ' . XOOPS_URL . '/'); -define("_AM_EDIT_PLUGIN", "Manage Plug-ins"); +define('_AM_EDIT_PLUGIN', 'Manage Plug-ins'); define('_AM_PLUGIN_ACTIVATED', 'Activated Plug-ins'); define('_AM_PLUGIN_INACTIVE', 'Inactive Plug-ins'); define('_AM_PLUGIN_NONINSTALLED', 'Non-installed Plug-ins'); @@ -33,7 +33,7 @@ define('_AM_PLUGIN_FUNCNOTFOUND', 'Plug-in not compatible (Function not exist)'); ################### version 1.1 additions ################### -define("_AM_XOOPS_VERSION_WRONG", "Version of XOOPS does not meet the system requirement. RSSFit may not work properly."); +define('_AM_XOOPS_VERSION_WRONG', 'Version of XOOPS does not meet the system requirement. RSSFit may not work properly.'); define('_AM_DB_RECORD_MISSING', 'Could not found essential database records, please reinstall RSSFit'); define('_AM_MAINFEED', 'Main feed'); define('_AM_DO_HTML', 'Use HTML tags'); @@ -59,6 +59,6 @@ define('_AM_STICKY_CONTENT', 'Sticky text content'); define('_AM_STICKY_LINK', 'Sticky text link'); define('_AM_STICKY_APPLYTO', 'Apply to feeds'); -define("_AM_EDIT_INTRO_TEXT_DESC_SUB", '

{SUB} will print a list of available sub-feeds'); -define("_AM_EDIT_INTRO_SUB", 'HTML tags for listing sub-feeds'); -define("_AM_EDIT_INTRO_SUB_DESC", "Extra tags:
{URL} (sub-feed's URL)
{TITLE} (sub-feed's title)
{DESC} (sub-feed's description)"); +define('_AM_EDIT_INTRO_TEXT_DESC_SUB', '

{SUB} will print a list of available sub-feeds'); +define('_AM_EDIT_INTRO_SUB', 'HTML tags for listing sub-feeds'); +define('_AM_EDIT_INTRO_SUB_DESC', "Extra tags:
{URL} (sub-feed's URL)
{TITLE} (sub-feed's title)
{DESC} (sub-feed's description)"); diff --git a/language/english/modinfo.php b/language/english/modinfo.php index f5702f77..830bce38 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -2,45 +2,45 @@ // Module Info // The name of this module -define("_MI_RSSFIT_NAME", "XML (RSS feed)"); +define('_MI_RSSFIT_NAME', 'XML (RSS feed)'); // A brief description of this module -define("_MI_RSSFIT_DESC", "Extendable XML news feed generator"); +define('_MI_RSSFIT_DESC', 'Extendable XML news feed generator'); // admin/menu.php -define("_MI_RSSFIT_ADMENU1", "Edit intro"); -define("_MI_RSSFIT_ADMENU2", "Plug-ins"); -define("_MI_RSSFIT_ADMENU3", "Feed Info"); -define("_MI_RSSFIT_ADMENU4", "Sub-feeds"); -define("_MI_RSSFIT_ADMENU5", "Sticky text"); -define("_MI_RSSFIT_INDEX", "Home"); -define("_MI_RSSFIT_ABOUT", "About"); +define('_MI_RSSFIT_ADMENU1', 'Edit intro'); +define('_MI_RSSFIT_ADMENU2', 'Plug-ins'); +define('_MI_RSSFIT_ADMENU3', 'Feed Info'); +define('_MI_RSSFIT_ADMENU4', 'Sub-feeds'); +define('_MI_RSSFIT_ADMENU5', 'Sticky text'); +define('_MI_RSSFIT_INDEX', 'Home'); +define('_MI_RSSFIT_ABOUT', 'About'); // Module Configs -define("_MI_OVERALL_ENTRIES", "Total entries to show"); -define("_MI_OVERALL_ENTRIES_DESC", "Number of entries to show in the RSS feed"); -define("_MI_PLUGIN_ENTRIES", "Default entry number for plug-ins"); -define("_MI_PLUGIN_ENTRIES_DESC", "Default number of entries to grab by each plug-in when installed"); -define("_MI_ENTRIES_SORT", "Entries sort by"); -define("_MI_ENTRIES_SORT_DESC", "Entries sort order for the RSS feed output"); -define("_MI_ENTRIES_SORT_DATE", "Date"); -define("_MI_ENTRIES_SORT_CAT", "Category"); -define("_MI_CACHE", "Cache lifetime (minutes)"); -define("_MI_CACHE_DESC", "This option will also be used for the Time-to-Live (TTL) channel element of the RSS output."); -define("_MI_MAXCHAR", "Maximum characters of item descriptions"); -define("_MI_MAXCHAR_DESC", "0 = show entire content"); -define("_MI_STRIPHTML", "Strip html tags"); -define("_MI_STRIPHTML_DESC", "Remove html tags from item description elements, including Xoopscodes and Smileys"); -define("_MI_ENCODE_UTF8", "Encode contents to UTF-8"); -define("_MI_ENCODE_UTF8_DESC", "Note: probably not functional and recommended to turn off."); +define('_MI_OVERALL_ENTRIES', 'Total entries to show'); +define('_MI_OVERALL_ENTRIES_DESC', 'Number of entries to show in the RSS feed'); +define('_MI_PLUGIN_ENTRIES', 'Default entry number for plug-ins'); +define('_MI_PLUGIN_ENTRIES_DESC', 'Default number of entries to grab by each plug-in when installed'); +define('_MI_ENTRIES_SORT', 'Entries sort by'); +define('_MI_ENTRIES_SORT_DESC', 'Entries sort order for the RSS feed output'); +define('_MI_ENTRIES_SORT_DATE', 'Date'); +define('_MI_ENTRIES_SORT_CAT', 'Category'); +define('_MI_CACHE', 'Cache lifetime (minutes)'); +define('_MI_CACHE_DESC', 'This option will also be used for the Time-to-Live (TTL) channel element of the RSS output.'); +define('_MI_MAXCHAR', 'Maximum characters of item descriptions'); +define('_MI_MAXCHAR_DESC', '0 = show entire content'); +define('_MI_STRIPHTML', 'Strip html tags'); +define('_MI_STRIPHTML_DESC', 'Remove html tags from item description elements, including Xoopscodes and Smileys'); +define('_MI_ENCODE_UTF8', 'Encode contents to UTF-8'); +define('_MI_ENCODE_UTF8_DESC', 'Note: probably not functional and recommended to turn off.'); // template explanations -define("_MI_TMPL_INTRO", "Introduction in module home page"); -define("_MI_TMPL_RSS", "RSS feed data"); +define('_MI_TMPL_INTRO', 'Introduction in module home page'); +define('_MI_TMPL_RSS', 'RSS feed data'); ######### version 1.1 additions ######### -define("_MI_OUTOUT_MIME", "MIME type of RSS output"); -define("_MI_OUTOUT_MIME_XML", "XML (text/xml)"); -define("_MI_OUTOUT_MIME_HTML", "HTML (text/html)"); -define("_MI_OUTOUT_MIME_PHP", "HTML with php-debug"); +define('_MI_OUTOUT_MIME', 'MIME type of RSS output'); +define('_MI_OUTOUT_MIME_XML', 'XML (text/xml)'); +define('_MI_OUTOUT_MIME_HTML', 'HTML (text/html)'); +define('_MI_OUTOUT_MIME_PHP', 'HTML with php-debug'); diff --git a/plugins/rssfit.adslight.php b/plugins/rssfit.adslight.php index 43181221..9d8378da 100644 --- a/plugins/rssfit.adslight.php +++ b/plugins/rssfit.adslight.php @@ -68,7 +68,7 @@ public function &grabEntries(&$obj) $myts = MyTextSanitizer::getInstance(); $ret = false; $i = 0; - $sql = "SELECT lid, title, status, desctext, date from ".$xoopsDB->prefix("adslight_listing")." WHERE valid = 'Yes' ORDER BY date DESC"; + $sql = 'SELECT lid, title, status, desctext, date from ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid = 'Yes' ORDER BY date DESC"; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewads.php?lid='.$row['lid']; diff --git a/plugins/rssfit.extcal.php b/plugins/rssfit.extcal.php index b37b8ff3..fc2623bf 100644 --- a/plugins/rssfit.extcal.php +++ b/plugins/rssfit.extcal.php @@ -111,13 +111,13 @@ public function &grabEntries(&$obj) $desc_link=$link; } $desc = "$title
"; - $desc .= ""; + $desc .= '
'; $desc .= ""; if ($address!='') { $desc .= ""; } $desc .= ""; - $desc .= "
When:$event_start
Where:$address
What:$description
"; + $desc .= ''; $ret[$i]['title'] = $category.': '.$title; $ret[$i]['link'] = $link; diff --git a/plugins/rssfit.lexikon.php b/plugins/rssfit.lexikon.php index f60b45c0..1f4f9623 100644 --- a/plugins/rssfit.lexikon.php +++ b/plugins/rssfit.lexikon.php @@ -70,7 +70,8 @@ public function &grabEntries(&$obj) //$perm_handler = xoops_gethandler('groupperm'); $ret = false; $i = 0; - $sql = "SELECT entryID, categoryID, term, definition, datesub FROM ".$xoopsDB->prefix("lxentries")." WHERE submit = 0 AND offline = 0 ORDER BY datesub DESC"; + $sql = 'SELECT entryID, categoryID, term, definition, datesub FROM ' + . $xoopsDB->prefix('lxentries') . ' WHERE submit = 0 AND offline = 0 ORDER BY datesub DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { // required diff --git a/plugins/rssfit.myalbum.php b/plugins/rssfit.myalbum.php index 77a93814..1f0fbf97 100644 --- a/plugins/rssfit.myalbum.php +++ b/plugins/rssfit.myalbum.php @@ -107,12 +107,12 @@ public function &grabEntries(&$obj) $i = 0; // For myalbum-p with thumbs enabled - $sql = "SELECT p.lid, p.title, p.ext, p.date, t.description, c.cid, c.title as cat, p.submitter"; - $sql .= " FROM ".$xoopsDB->prefix("myalbum_photos")." p, "; - $sql .= $xoopsDB->prefix('myalbum_text')." t, "; - $sql .= $xoopsDB->prefix("myalbum_cat")." c "; - $sql .= "WHERE p.status > 0 AND p.cid = c.cid AND p.lid = t.lid "; - $sql .= "ORDER BY date DESC"; + $sql = 'SELECT p.lid, p.title, p.ext, p.date, t.description, c.cid, c.title as cat, p.submitter'; + $sql .= ' FROM ' . $xoopsDB->prefix('myalbum_photos') . ' p, '; + $sql .= $xoopsDB->prefix('myalbum_text') . ' t, '; + $sql .= $xoopsDB->prefix('myalbum_cat') . ' c '; + $sql .= 'WHERE p.status > 0 AND p.cid = c.cid AND p.lid = t.lid '; + $sql .= 'ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { $link = XOOPS_URL.'/modules/'.$this->dirname.'/photo.php?lid='.$row['lid']; diff --git a/plugins/rssfit.mydownloads.php b/plugins/rssfit.mydownloads.php index bd653a69..266f469c 100644 --- a/plugins/rssfit.mydownloads.php +++ b/plugins/rssfit.mydownloads.php @@ -64,7 +64,9 @@ public function &grabEntries(&$obj) $myts = MyTextSanitizer::getInstance(); $ret = false; $i = 0; - $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"; + $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'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { $ret[$i]['title'] = $row['title']; diff --git a/plugins/rssfit.mylinks.php b/plugins/rssfit.mylinks.php index 75c8d84f..9135b2d8 100644 --- a/plugins/rssfit.mylinks.php +++ b/plugins/rssfit.mylinks.php @@ -62,7 +62,9 @@ public function &grabEntries(&$obj) $myts = MyTextSanitizer::getInstance(); $ret = false; $i = 0; - $sql = "SELECT l.lid, l.cid, l.title, l.date, t.description FROM ".$xoopsDB->prefix("mylinks_links")." l, ".$xoopsDB->prefix("mylinks_text")." t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC"; + $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' + . $xoopsDB->prefix('mylinks_links') . ' l, ' + . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { $ret[$i]['title'] = $row['title']; diff --git a/plugins/rssfit.mytube.php b/plugins/rssfit.mytube.php index 7553af28..1743fbe1 100644 --- a/plugins/rssfit.mytube.php +++ b/plugins/rssfit.mytube.php @@ -67,7 +67,9 @@ public function &grabEntries(&$obj) $myts = MyTextSanitizer::getInstance(); $ret = false; $i = 0; - $sql = "SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM " . $xoopsDB -> prefix("xoopstube_videos") . " l, " . $xoopsDB -> prefix('xoopstube_cat') . " c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC"; + $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' + . $xoopsDB-> prefix('xoopstube_videos') . ' l, ' + . $xoopsDB-> prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; $result = $xoopsDB -> query($sql, $this -> grab, 0); while ($row = $xoopsDB -> fetchArray($result)) { diff --git a/plugins/rssfit.newbb2.php b/plugins/rssfit.newbb2.php index 6daaa167..76a235cc 100644 --- a/plugins/rssfit.newbb2.php +++ b/plugins/rssfit.newbb2.php @@ -119,7 +119,7 @@ public function &grabEntries(&$obj) $ret[$i]['title'] = $this->modname . ': ' . $row['subject']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; $ret[$i]['timestamp'] = $row['post_time']; - $ret[$i]['description'] = sprintf("Posted by: %s
%s", $this->myGetUnameFromId($row['uid']), $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr'])); + $ret[$i]['description'] = sprintf('Posted by: %s
%s', $this->myGetUnameFromId($row['uid']), $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr'])); $ret[$i]['category'] = $row['forum_name']; $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/viewforum.php?forum='.$row['forum_id']; $i++; diff --git a/plugins/rssfit.pical.php b/plugins/rssfit.pical.php index a0bebc34..675c72c2 100644 --- a/plugins/rssfit.pical.php +++ b/plugins/rssfit.pical.php @@ -67,7 +67,8 @@ public function &grabEntries(&$obj) $myts = MyTextSanitizer::getInstance(); $ret = false; $i = 0; - $sql = "SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ".$xoopsDB->prefix("pical_event")." WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC"; + $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' + . $xoopsDB->prefix('pical_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { $ret[$i]['title'] = $row['summary']; diff --git a/plugins/rssfit.pluginsample.php b/plugins/rssfit.pluginsample.php index 8f8699b7..00626f1b 100644 --- a/plugins/rssfit.pluginsample.php +++ b/plugins/rssfit.pluginsample.php @@ -83,7 +83,9 @@ public function &grabEntries(&$obj) $ret = false; $i = 0; // The following example code grabs the latest entries from the module MyLinks - $sql = "SELECT l.lid, l.cid, l.title, l.date, t.description FROM ".$xoopsDB->prefix("mylinks_links")." l, ".$xoopsDB->prefix("mylinks_text")." t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC"; + $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' + . $xoopsDB->prefix('mylinks_links') . ' l, ' + . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?cid='.$row['cid'].'&lid='.$row['lid']; diff --git a/plugins/rssfit.queries.php b/plugins/rssfit.queries.php index c4b78ef4..2ccbb38f 100644 --- a/plugins/rssfit.queries.php +++ b/plugins/rssfit.queries.php @@ -72,8 +72,8 @@ public function &grabEntries(&$obj) $lastuser=false; $limit=10*$this->grab; - $sql = "SELECT id, title, posted, querytext FROM ".$xoopsDB->prefix('queries_query'); - $sql.=" WHERE approved=1 ORDER BY posted DESC "; + $sql = 'SELECT id, title, posted, querytext FROM ' . $xoopsDB->prefix('queries_query'); + $sql.= ' WHERE approved=1 ORDER BY posted DESC '; $result = $xoopsDB->query($sql, $limit, 0); while ($row = $xoopsDB->fetchArray($result)) { diff --git a/plugins/rssfit.rmdp.php b/plugins/rssfit.rmdp.php index 2906a353..ce8d816a 100644 --- a/plugins/rssfit.rmdp.php +++ b/plugins/rssfit.rmdp.php @@ -68,7 +68,7 @@ public function grabEntries(&$obj) global $xoopsDB, $moduleperm_handler; $ret = array(); $i = 0; - $sql = "SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ".$xoopsDB->prefix("rmdp_software")." ORDER BY fecha DESC"; + $sql = 'SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ' . $xoopsDB->prefix('rmdp_software') . ' ORDER BY fecha DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { $ret[$i]['title'] = $row['nombre']; diff --git a/plugins/rssfit.smartpartner.php b/plugins/rssfit.smartpartner.php index 1586ccd8..dff21835 100644 --- a/plugins/rssfit.smartpartner.php +++ b/plugins/rssfit.smartpartner.php @@ -60,7 +60,7 @@ public function loadModule() public function &grabEntries(&$obj) { $ret = false; - include XOOPS_ROOT_PATH."/modules/smartpartner/include/common.php"; + include XOOPS_ROOT_PATH . '/modules/smartpartner/include/common.php'; $partners = $partner_handler->getPartners($this->grab, 0, _SPARTNER_STATUS_ACTIVE, 'weight', 'DESC'); if (false != $partners && count($partners) > 0) { for ($i=0; $igetAllPublished($this->grab, 0); if (false != $items && count($items) > 0) { for ($i=0; $igrab; - $sql = "SELECT uid, id, surname, notes, DATE_FORMAT(changed_ts,'%Y-%m-%d') as changedate FROM ".$xoopsDB->prefix("surnames"); - $sql .=" WHERE approved=1 ORDER BY changedate DESC, uid "; + $sql = "SELECT uid, id, surname, notes, DATE_FORMAT(changed_ts,'%Y-%m-%d') as changedate FROM ".$xoopsDB->prefix('surnames'); + $sql .= ' WHERE approved=1 ORDER BY changedate DESC, uid '; $result = $xoopsDB->query($sql, $limit, 0); while ($row = $xoopsDB->fetchArray($result)) { $changedate=strtotime($row['changedate']); @@ -113,7 +113,7 @@ public function &grabEntries(&$obj) $lasttime=$changedate; $lastuser=$uid; if ($i<=$this->grab) { - $desc=""; + $desc= ''; $name = $this->myGetUnameFromId($row['uid']); $ret[$i]['title'] = $this->modname . ': by ' . $name; $ret[$i]['link'] = XOOPS_URL.'/modules/surnames/list.php?uid='.$row['uid']; diff --git a/plugins/rssfit.weblinks.php b/plugins/rssfit.weblinks.php index e3dc2f2b..78107fdf 100644 --- a/plugins/rssfit.weblinks.php +++ b/plugins/rssfit.weblinks.php @@ -85,7 +85,7 @@ public function &grabEntries(&$obj) $myts = MyTextSanitizer::getInstance(); $ret = false; $i = 0; - $sql = "SELECT lid, title, time_update, description, url, uid FROM ".$xoopsDB->prefix("weblinks_link")." ORDER BY time_update DESC"; + $sql = 'SELECT lid, title, time_update, description, url, uid FROM ' . $xoopsDB->prefix('weblinks_link') . ' ORDER BY time_update DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { $title=$row['title']; diff --git a/plugins/rssfit.wfdownloads.php b/plugins/rssfit.wfdownloads.php index d5a22aa0..736e4c88 100644 --- a/plugins/rssfit.wfdownloads.php +++ b/plugins/rssfit.wfdownloads.php @@ -65,7 +65,8 @@ public function &grabEntries(&$obj) $perm_handler = xoops_getHandler('groupperm'); $ret = false; $i = 0; - $sql = "SELECT lid, cid, title, date, description FROM ".$xoopsDB->prefix("wfdownloads_downloads")." WHERE status > 0 AND offline = 0 ORDER BY date DESC"; + $sql = 'SELECT lid, cid, title, date, description FROM ' + . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { if ($perm_handler->checkRight('WFDownFilePerm', $row['lid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { diff --git a/plugins/rssfit.wfdownloads_podcast.php b/plugins/rssfit.wfdownloads_podcast.php index cd66221d..f12819cd 100644 --- a/plugins/rssfit.wfdownloads_podcast.php +++ b/plugins/rssfit.wfdownloads_podcast.php @@ -65,7 +65,10 @@ public function &grabEntries(&$obj) $perm_handler = xoops_getHandler('groupperm'); $ret = false; $i = 0; - $sql = "SELECT lid, cid, title, date, description, filetype, size FROM ".$xoopsDB->prefix("wfdownloads_downloads")." WHERE status > 0 AND offline = 0 AND (expired > ".time()." OR expired = 0) AND published <= ".time()." ORDER BY date DESC"; + $sql = 'SELECT lid, cid, title, date, description, filetype, size FROM ' + . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 AND (expired > ' + . time() . ' OR expired = 0) AND published <= ' + . time() . ' ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { if ((isset($perms[$row['cid']]) && $perms[$row['cid']] == true) || $perm_handler->checkRight('WFDownCatPerm', $row['cid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { diff --git a/plugins/rssfit.wflinks.php b/plugins/rssfit.wflinks.php index 5d7ea109..a4514c42 100644 --- a/plugins/rssfit.wflinks.php +++ b/plugins/rssfit.wflinks.php @@ -49,7 +49,7 @@ public function grabEntries(&$obj) $myts = MyTextSanitizer::getInstance(); $ret = array(); $i = 0; - $sql = "SELECT lid, cid, title, date, description FROM ".$xoopsDB->prefix("wflinks_links")." WHERE status>0 ORDER BY date DESC"; + $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { if ($gperm_handler -> checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { diff --git a/plugins/rssfit.wfsection.php b/plugins/rssfit.wfsection.php index 87cd9e2b..51a8abea 100644 --- a/plugins/rssfit.wfsection.php +++ b/plugins/rssfit.wfsection.php @@ -65,11 +65,15 @@ public function &grabEntries(&$obj) global $xoopsDB; $ret = false; $i = 0; - $sql = "SELECT a.articleid, a.title as atitle, a.published, a.expired, a.counter, a.groupid, a.maintext, a.summary, b.title as btitle FROM ".$xoopsDB->prefix("wfs_article")." a, ".$xoopsDB->prefix("wfs_category")." b WHERE a.published < ".time()." AND a.published > 0 AND (a.expired = 0 OR a.expired > ".time().") AND a.noshowart = 0 AND a.offline = 0 AND a.categoryid = b.id ORDER BY published DESC"; + $sql = 'SELECT a.articleid, a.title as atitle, a.published, a.expired, a.counter, a.groupid, a.maintext, a.summary, b.title as btitle FROM ' + . $xoopsDB->prefix('wfs_article') . ' a, ' + . $xoopsDB->prefix('wfs_category') . ' b WHERE a.published < ' + . time() . ' AND a.published > 0 AND (a.expired = 0 OR a.expired > ' + . time() . ') AND a.noshowart = 0 AND a.offline = 0 AND a.categoryid = b.id ORDER BY published DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - if (checkAccess($row["groupid"])) { + if (checkAccess($row['groupid'])) { $link = XOOPS_URL.'/modules/'.$this->dirname.'/article.php?articleid='.$row['articleid']; $ret[$i]['title'] = $row['atitle']; $ret[$i]['link'] = $link; diff --git a/plugins/rssfit.xoopstube.php b/plugins/rssfit.xoopstube.php index 21b703b6..fb043c90 100644 --- a/plugins/rssfit.xoopstube.php +++ b/plugins/rssfit.xoopstube.php @@ -67,7 +67,9 @@ public function &grabEntries(&$obj) $myts = MyTextSanitizer::getInstance(); $ret = false; $i = 0; - $sql = "SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ".$xoopsDB->prefix("xoopstube_videos")." l, ".$xoopsDB->prefix("xoopstube_cat")." c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC"; + $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' + . $xoopsDB->prefix('xoopstube_videos') . ' l, ' + . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { diff --git a/xoops_version.php b/xoops_version.php index 71fdd6ee..f7e1f2c5 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -29,19 +29,19 @@ ############################################################################### if (!defined('XOOPS_ROOT_PATH')) { - die("XOOPS root path not defined"); + die('XOOPS root path not defined'); } $modversion['name'] = _MI_RSSFIT_NAME; $modversion['version'] = '1.30'; $modversion['description'] = _MI_RSSFIT_DESC; -$modversion['author'] = "NS Tai (aka tuff)"; +$modversion['author'] = 'NS Tai (aka tuff)'; $modversion['credits'] = "Brandycoke Productions"; $modversion['help'] = 'page=help'; $modversion['license'] = 'GNU GPL 2.0 or later'; -$modversion['license_url'] = "https://www.gnu.org/licenses/gpl-2.0.html"; +$modversion['license_url'] = 'https://www.gnu.org/licenses/gpl-2.0.html'; $modversion['official'] = 0; -$modversion['image'] = "images/rssfeed.png"; +$modversion['image'] = 'images/rssfeed.png'; $modversion['dirname'] = basename(__DIR__); $modversion['dirmoduleadmin'] = 'Frameworks/moduleclasses'; @@ -49,11 +49,11 @@ $modversion['icons32'] = 'Frameworks/moduleclasses/icons/32'; //about $modversion['release_date'] = '2014/03/03'; -$modversion["module_website_url"] = "www.xoops.org"; -$modversion["module_website_name"] = "XOOPS"; -$modversion["module_status"] = "Beta 1"; +$modversion['module_website_url'] = 'www.xoops.org'; +$modversion['module_website_name'] = 'XOOPS'; +$modversion['module_status'] = 'Beta 1'; $modversion['min_php'] = '5.5'; -$modversion['min_xoops'] = "2.5.9"; +$modversion['min_xoops'] = '2.5.9'; $modversion['min_db'] = array( 'mysql' => '5.0.7', 'mysqli' => '5.0.7' @@ -61,18 +61,18 @@ // Sql file (must contain sql generated by phpMyAdmin or phpPgAdmin) // All tables should not have any prefix! -$modversion['sqlfile']['mysql'] = "sql/mysql.sql"; +$modversion['sqlfile']['mysql'] = 'sql/mysql.sql'; //$modversion['sqlfile']['postgresql'] = "sql/pgsql.sql"; // Tables created by sql file (without prefix!) -$modversion['tables'][0] = "rssfit_plugins"; -$modversion['tables'][1] = "rssfit_misc"; +$modversion['tables'][0] = 'rssfit_plugins'; +$modversion['tables'][1] = 'rssfit_misc'; // Admin things $modversion['hasAdmin'] = 1; $modversion['system_menu'] = 1; -$modversion['adminindex'] = "admin/index.php"; -$modversion['adminmenu'] = "admin/menu.php"; +$modversion['adminindex'] = 'admin/index.php'; +$modversion['adminmenu'] = 'admin/menu.php'; // Script to run on install/unstall/update $modversion['onInstall'] = 'include/install.php'; From e24eb307dac68df922c7c828c5827d328ebd7203 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 23 Oct 2017 23:49:46 -0400 Subject: [PATCH 007/154] Unnecessary double quotes --- plugins/rssfit.smartfaq.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/rssfit.smartfaq.php b/plugins/rssfit.smartfaq.php index dbd2487b..f01e0c3c 100644 --- a/plugins/rssfit.smartfaq.php +++ b/plugins/rssfit.smartfaq.php @@ -59,7 +59,7 @@ public function loadModule() public function &grabEntries(&$obj) { $ret = false; - @include_once XOOPS_ROOT_PATH . "/modules/smartfaq/include/functions.php"; + @include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; $faq_handler = sf_gethandler('faq'); $faqs = $faq_handler->getAllPublished($this->grab, 0); if (false != $faqs && count($faqs) > 0) { From 1fa8e0ee8ca6b7148cd1036fb79c4c0ae555d612 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 23 Oct 2017 23:53:33 -0400 Subject: [PATCH 008/154] Case mismatch in method call or class usage --- plugins/rssfit.oledrion.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/rssfit.oledrion.php b/plugins/rssfit.oledrion.php index 07bf0736..a92230fa 100644 --- a/plugins/rssfit.oledrion.php +++ b/plugins/rssfit.oledrion.php @@ -46,7 +46,7 @@ public function &grabEntries(&$obj) { $ret = false; include XOOPS_ROOT_PATH.'/modules/oledrion/include/common.php'; - $items = $h_oledrion_products->getRecentProducts(new oledrion_parameters(array('start' => 0, 'limit' => $this->grab))); + $items = $h_oledrion_products->getRecentProducts(new Oledrion_parameters(array('start' => 0, 'limit' => $this->grab))); $i = 0; if (false != $items && count($items) > 0) { From 0d89d308c56450ab3a345f271474bf333fd53f36 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 23 Oct 2017 23:54:08 -0400 Subject: [PATCH 009/154] Array short syntax --- admin/do_channel.php | 4 +- admin/do_intro.php | 9 ++-- admin/do_plugins.php | 8 +-- admin/do_sticky.php | 13 ++--- admin/do_subfeeds.php | 4 +- admin/menu.php | 2 +- class/misc.php | 2 +- class/plugins.php | 4 +- class/rssfeed.php | 67 ++++++++++++++------------ include/install.php | 8 +-- index.php | 2 +- plugins/rssfit.adslight.php | 2 +- plugins/rssfit.cbb.php | 2 +- plugins/rssfit.comments.php | 2 +- plugins/rssfit.newbb2.php | 2 +- plugins/rssfit.oledrion.php | 2 +- plugins/rssfit.pluginsample.php | 6 +-- plugins/rssfit.rmdp.php | 2 +- plugins/rssfit.special.php | 6 +-- plugins/rssfit.wfdownloads_podcast.php | 9 ++-- plugins/rssfit.wflinks.php | 2 +- rss.php | 2 +- xoops_version.php | 18 +++---- 23 files changed, 94 insertions(+), 84 deletions(-) diff --git a/admin/do_channel.php b/admin/do_channel.php index 50038c7a..081195a4 100644 --- a/admin/do_channel.php +++ b/admin/do_channel.php @@ -73,10 +73,10 @@ case 'save': $ele = Request::getArray('ele', null, 'POST'); $ids = array_keys($ele); - $errors = array(); + $errors = []; foreach ($ids as $i) { $criteria = new Criteria('misc_id', $i); - $fields = array('misc_content' => trim($ele[$i])); + $fields = ['misc_content' => trim($ele[$i])]; if ($err = $rss->mHandler->modifyObjects($criteria, $fields)) { $errors[] = $err; } diff --git a/admin/do_intro.php b/admin/do_intro.php index da8cfb86..8d443ed9 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -75,10 +75,11 @@ $intro->setVar('misc_category', 'intro'); $intro->setVar('misc_title', trim($_POST['title'])); $intro->setVar('misc_content', $_POST['content']); - $setting = array('dohtml' => isset($_POST['dohtml']) ? 1 : 0, - 'dobr' => isset($_POST['dobr']) ? 1 : 0, - 'sub' => isset($_POST['sub']) ? trim($_POST['sub']) : '' - ); + $setting = [ + 'dohtml' => isset($_POST['dohtml']) ? 1 : 0, + 'dobr' => isset($_POST['dobr']) ? 1 : 0, + 'sub' => isset($_POST['sub']) ? trim($_POST['sub']) : '' + ]; $intro->setVar('misc_setting', $setting); if (false == $misc_handler->insert($intro)) { echo $intro->getHtmlErrors(); diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 1adb868b..6eb11ab5 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -119,10 +119,10 @@ // Non-installed plugins if (!$filelist =& $plugins_handler->getPluginFileList()) { - $filelist = array(); + $filelist = []; } $list = XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); - $installable = array(); + $installable = []; foreach ($list as $f) { if (preg_match('/rssfit\.+[a-zA-Z0-9_]+\.php/', $f) && !in_array($f, $filelist)) { $installable[] = $f; @@ -174,8 +174,8 @@ } break; case 'save': - $rssf_grab = Request::getArray('rssf_grab', array(), 'POST'); - $rssf_order = Request::getArray('rssf_order', array(), 'POST'); + $rssf_grab = Request::getArray('rssf_grab', [], 'POST'); + $rssf_order = Request::getArray('rssf_order', [], 'POST'); $action = Request::getArray('action', null, 'POST'); $err = ''; if (isset($action)) { diff --git a/admin/do_sticky.php b/admin/do_sticky.php index ecec9d8e..b33dc465 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -79,15 +79,16 @@ $sticky->setVar('misc_title', trim($_POST['title'])); $sticky->setVar('misc_content', $_POST['content']); if (!isset($_POST['feeds']) || count($_POST['feeds']) < 1 || in_array(0, $_POST['feeds'])) { - $feeds = array('0' => 0); + $feeds = ['0' => 0]; } else { $feeds = $_POST['feeds']; } - $setting = array('dohtml' => isset($_POST['dohtml']) ? 1 : 0, - 'dobr' => isset($_POST['dobr']) ? 1 : 0, - 'feeds' => $feeds, - 'link' => isset($_POST['link']) ? trim($_POST['link']) : '' - ); + $setting = [ + 'dohtml' => isset($_POST['dohtml']) ? 1 : 0, + 'dobr' => isset($_POST['dobr']) ? 1 : 0, + 'feeds' => $feeds, + 'link' => isset($_POST['link']) ? trim($_POST['link']) : '' + ]; $sticky->setVar('misc_setting', $setting, true); if (false == $misc_handler->insert($sticky)) { echo $sticky->getHtmlErrors(); diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index 6615e3cb..00b8414d 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -91,11 +91,11 @@ $activate = Request::getArray('activate', null, 'POST'); if ($plugins = $plugins_handler->getObjects(null, 'sublist')) { - $plugins_handler->modifyObjects(null, array('subfeed' => 0)); + $plugins_handler->modifyObjects(null, ['subfeed' => 0]); if (isset($activate) && is_array($activate) && count($activate) > 0) { $keys = array_keys($activate); $criteria = new Criteria('rssf_conf_id', '(' . implode(',', $keys) . ')', 'IN'); - $plugins_handler->modifyObjects($criteria, array('subfeed' => 1)); + $plugins_handler->modifyObjects($criteria, ['subfeed' => 1]); } redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); } else { diff --git a/admin/menu.php b/admin/menu.php index 8765b061..8fa396f0 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -24,7 +24,7 @@ $pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); } -$adminmenu = array(); +$adminmenu = []; $i =0; $adminmenu[$i]['title'] = _MI_RSSFIT_INDEX; $adminmenu[$i]['link'] = 'admin/index.php'; diff --git a/class/misc.php b/class/misc.php index 796cd079..c85c7c1e 100644 --- a/class/misc.php +++ b/class/misc.php @@ -198,7 +198,7 @@ public function insert(XoopsObject $obj) //, $force = false) return $obj->getVar($this->obj_key); } - public function modifyObjects($criteria=null, $fields=array(), $force=false) + public function modifyObjects($criteria=null, $fields= [], $force=false) { if (is_array($fields) && count($fields) > 0) { $obj = new $this->obj_class(); diff --git a/class/plugins.php b/class/plugins.php index c8ed5d62..2612af39 100644 --- a/class/plugins.php +++ b/class/plugins.php @@ -210,7 +210,7 @@ public function &getObjects($criteria=null, $fields='*', $key='') return $ret; } - public function modifyObjects($criteria=null, $fields=array(), $force=false) + public function modifyObjects($criteria=null, $fields= [], $force=false) { if (is_array($fields) && count($fields) > 0) { $obj = new $this->obj_class(); @@ -254,7 +254,7 @@ public function getCount($criteria = null) public function forceDeactivate(&$obj, $type='rssf_activated') { $criteria = new Criteria($this->obj_key, $obj->getVar($this->obj_key)); - $fields = array('rssf_activated' => 0,'subfeed' => 0); + $fields = ['rssf_activated' => 0, 'subfeed' => 0]; $this->modifyObjects($criteria, $fields, true); return true; } diff --git a/class/rssfeed.php b/class/rssfeed.php index 2da46b1a..f27a954d 100644 --- a/class/rssfeed.php +++ b/class/rssfeed.php @@ -50,24 +50,27 @@ class RssfeedHandler public $charset = _CHARSET; public $feedkey = 'feed'; public $plugin_file = 'rssfit.%s.php'; - public $substr_remove = array(',', '/', ';', ':', '(', '{', '[', ' '); - public $substr_add = array('.', '!', '?', '}', ']', ')', '%'); + public $substr_remove = [',', '/', ';', ':', '(', '{', '[', ' ']; + public $substr_add = ['.', '!', '?', '}', ']', ')', '%']; public $substr_endwith = '...'; public $spec_url = 'http://blogs.law.harvard.edu/tech/rss'; - public $specs = array( 'req' => 'requiredChannelElements', - 'opt' => 'optionalChannelElements', - 'cloud' => 'ltcloudgtSubelementOfLtchannelgt', - 'img' => 'ltimagegtSubelementOfLtchannelgt' - ); - public $escaped = array( 128 => '€', 130 => '‚', 131 => 'ƒ', - 132 => '„', 133 => '…', 134 => '†', - 135 => '‡', 136 => 'ˆ', 137 => '‰', - 138 => 'Š', 139 => '‹', 140 => 'Œ', - 142 => 'Ž', 145 => '‘', 146 => '’', - 147 => '“', 148 => '”', 149 => '•', - 150 => '–', 151 => '—', 152 => '˜', - 153 => '™', 154 => 'š', 155 => '›', - 156 => 'œ', 158 => 'ž', 159 => 'Ÿ'); + public $specs = [ + 'req' => 'requiredChannelElements', + 'opt' => 'optionalChannelElements', + 'cloud' => 'ltcloudgtSubelementOfLtchannelgt', + 'img' => 'ltimagegtSubelementOfLtchannelgt' + ]; + public $escaped = [ + 128 => '€', 130 => '‚', 131 => 'ƒ', + 132 => '„', 133 => '…', 134 => '†', + 135 => '‡', 136 => 'ˆ', 137 => '‰', + 138 => 'Š', 139 => '‹', 140 => 'Œ', + 142 => 'Ž', 145 => '‘', 146 => '’', + 147 => '“', 148 => '”', 149 => '•', + 150 => '–', 151 => '—', 152 => '˜', + 153 => '™', 154 => 'š', 155 => '›', + 156 => 'œ', 158 => 'ž', 159 => 'Ÿ' + ]; public function __construct($modConfig, $xoopsConfig, $xoopsModule) { @@ -77,14 +80,16 @@ public function __construct($modConfig, $xoopsConfig, $xoopsModule) $this->mHandler = xoops_getModuleHandler('misc'); $this->modConfig = $modConfig; $this->xoopsConfig = $xoopsConfig; - $this->channelreq = array('title' => $this->xoopsConfig['sitename'], - 'link' => XOOPS_URL, - 'description' => $this->xoopsConfig['slogan']); + $this->channelreq = [ + 'title' => $this->xoopsConfig['sitename'], + 'link' => XOOPS_URL, + 'description' => $this->xoopsConfig['slogan'] + ]; } public function getChannel(&$feed) { - $channel = array(); + $channel = []; if ($elements =& $this->mHandler->getObjects(new Criteria('misc_category', 'channel'))) { foreach ($elements as $e) { if ($e->getVar('misc_content') != '') { @@ -102,17 +107,19 @@ public function getChannel(&$feed) $channel['title'] = $this->plugin_obj->getVar('sub_title', 'n'); $channel['link'] = $this->plugin_obj->getVar('sub_link', 'n'); $channel['description'] = $this->plugin_obj->getVar('sub_desc', 'n'); - $image = array( 'url' => $this->plugin_obj->getVar('img_url', 'n'), - 'title' => $this->plugin_obj->getVar('img_title', 'n'), - 'link' => $this->plugin_obj->getVar('img_link', 'n') - ); + $image = [ + 'url' => $this->plugin_obj->getVar('img_url', 'n'), + 'title' => $this->plugin_obj->getVar('img_title', 'n'), + 'link' => $this->plugin_obj->getVar('img_link', 'n') + ]; } } else { if ($img =& $this->mHandler->getObjects(new Criteria('misc_category', 'channelimg'), '*', 'title')) { - $image = array( 'url' => $img['url']->getVar('misc_content', 'n'), - 'title' => $img['title']->getVar('misc_content', 'n'), - 'link' => $img['link']->getVar('misc_content', 'n') - ); + $image = [ + 'url' => $img['url']->getVar('misc_content', 'n'), + 'title' => $img['title']->getVar('misc_content', 'n'), + 'link' => $img['link']->getVar('misc_content', 'n') + ]; } } if (empty($channel['title']) || empty($channel['link']) || empty($channel['description'])) { @@ -160,7 +167,7 @@ public function getSticky(&$feed) public function getItems(&$feed) { - $entries = array(); + $entries = []; if (!empty($feed['plugin'])) { $this->plugin_obj->setVar('rssf_grab', $this->plugin_obj->getVar('sub_entries')); $this->sub_handler->grab = $this->plugin_obj->getVar('sub_entries'); @@ -280,7 +287,7 @@ public function cleanupChars(&$text, $strip=true, $dospec=true, $dosub=false) public function wrapCdata(&$text) { - $text = ''), array('<![CDATA[', ']]>'), $text).']]>'; + $text = ''], ['<![CDATA[', ']]>'], $text) . ']]>'; } public function &getActivatedSubfeeds($fields='', $type='') diff --git a/include/install.php b/include/install.php index 789b9890..95913230 100644 --- a/include/install.php +++ b/include/install.php @@ -42,7 +42,7 @@ function xoops_module_install_rss(XoopsModule $xoopsMod) global $xoopsDB, $xoopsConfig; $myts = MyTextSanitizer::getInstance(); rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); - $intro_setting = array('dohtml'=>1, 'dobr'=>1, 'sub'=>stripslashes(_INSTALL_INTRO_SUB)); + $intro_setting = ['dohtml' =>1, 'dobr' =>1, 'sub' =>stripslashes(_INSTALL_INTRO_SUB)]; $sql[] = 'INSERT INTO `' . $xoopsDB->prefix('rssfit_misc') . '` VALUES (1, ' . $xoopsDB->quoteString('intro') . ', ' @@ -52,7 +52,7 @@ function xoops_module_install_rss(XoopsModule $xoopsMod) $sql[] = rssfInsertChannel($xoopsMod); $sql[] = 'INSERT INTO ' . $xoopsDB->prefix('rssfit_misc') . ' VALUES ' - . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(array('dohtml' =>0, 'dobr' =>0, 'feeds' =>array(0 =>'0'), 'link' =>XOOPS_URL))) . ')'; + . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' =>0, 'dobr' =>0, 'feeds' => [0 =>'0'], 'link' =>XOOPS_URL])) . ')'; foreach ($sql as $s) { if (false == $xoopsDB->query($s)) { echo ''.$xoopsDB->error().'
'.$s.'

'; @@ -76,7 +76,7 @@ function xoops_module_update_rss(XoopsModule $xoopsMod, $oldversion) if (!$rows) { $sql[] = 'ALTER TABLE `'.$xoopsDB->prefix('rssfit_misc').'` ADD `misc_setting` TEXT NOT NULL;'; $sql[] = 'ALTER TABLE `'.$xoopsDB->prefix('rssfit_misc').'` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; - $intro_setting = array('dohtml'=>1, 'dobr'=>1, 'sub'=>_INSTALL_INTRO_SUB); + $intro_setting = ['dohtml' =>1, 'dobr' =>1, 'sub' =>_INSTALL_INTRO_SUB]; $sql[] = 'UPDATE `' . $xoopsDB->prefix('rssfit_misc') . '` SET misc_setting = ' . $xoopsDB->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; @@ -86,7 +86,7 @@ function xoops_module_update_rss(XoopsModule $xoopsMod, $oldversion) $sql[] = rssfInsertChannel($xoopsMod); $sql[] = 'INSERT INTO ' . $xoopsDB->prefix('rssfit_misc') . ' VALUES ' - . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(array('dohtml' =>0, 'dobr' =>0, 'feeds' =>array(0 =>'0'), 'link' =>XOOPS_URL))) . ')'; + . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' =>0, 'dobr' =>0, 'feeds' => [0 =>'0'], 'link' =>XOOPS_URL])) . ')'; foreach ($sql as $s) { if (false == $xoopsDB->query($s)) { echo ''.$xoopsDB->error().'
'.$s.'

'; diff --git a/index.php b/index.php index 29c25e92..1ce5047b 100644 --- a/index.php +++ b/index.php @@ -56,6 +56,6 @@ } else { $content = str_replace('{SUB}', '', $content); } - $xoopsTpl->assign('intro', array('title' => $title, 'content' => $content)); + $xoopsTpl->assign('intro', ['title' => $title, 'content' => $content]); } require XOOPS_ROOT_PATH.'/footer.php'; diff --git a/plugins/rssfit.adslight.php b/plugins/rssfit.adslight.php index 9d8378da..4b741797 100644 --- a/plugins/rssfit.adslight.php +++ b/plugins/rssfit.adslight.php @@ -76,7 +76,7 @@ public function &grabEntries(&$obj) $ret[$i]['link'] = $link; $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $row['desctext']; // $myts->displayTarea($row['desctext']); - $ret[$i]['extras'] = array(); + $ret[$i]['extras'] = []; $i++; } return $ret; diff --git a/plugins/rssfit.cbb.php b/plugins/rssfit.cbb.php index 1bf1dfb2..d6f3c3e3 100644 --- a/plugins/rssfit.cbb.php +++ b/plugins/rssfit.cbb.php @@ -70,7 +70,7 @@ public function &grabEntries(&$obj) $newbbConfig = $GLOBALS['config_handler']->getConfigsByCat(0, $this->module->getVar('mid')); $access_forums = $forum_handler->getForums(0, 'access'); - $available_forums = array(); + $available_forums = []; foreach ($access_forums as $forum) { if ($topic_handler->getPermission($forum)) { $available_forums[$forum->getVar('forum_id')] = $forum; diff --git a/plugins/rssfit.comments.php b/plugins/rssfit.comments.php index 9fd39bca..3d8ab270 100644 --- a/plugins/rssfit.comments.php +++ b/plugins/rssfit.comments.php @@ -66,7 +66,7 @@ public function &grabEntries(&$obj) $criteria->setSort('com_created'); $criteria->setOrder('DESC'); $comments = $comment_handler->getObjects($criteria, true); - $comment_config = array(); + $comment_config = []; if (count($comments) > 0) { $modules = $GLOBALS['module_handler']->getObjects(new Criteria('hascomments', 1), true); foreach (array_keys($comments) as $i) { diff --git a/plugins/rssfit.newbb2.php b/plugins/rssfit.newbb2.php index 76a235cc..189d4aef 100644 --- a/plugins/rssfit.newbb2.php +++ b/plugins/rssfit.newbb2.php @@ -98,7 +98,7 @@ public function &grabEntries(&$obj) $newbbConfig = $config_handler->getConfigsByCat(0, $this->module->getVar('mid')); $access_forums = $forum_handler->getForums(0, 'access'); - $available_forums = array(); + $available_forums = []; foreach ($access_forums as $forum) { if ($topic_handler->getPermission($forum)) { $available_forums[$forum->getVar('forum_id')] = $forum; diff --git a/plugins/rssfit.oledrion.php b/plugins/rssfit.oledrion.php index a92230fa..971faa24 100644 --- a/plugins/rssfit.oledrion.php +++ b/plugins/rssfit.oledrion.php @@ -46,7 +46,7 @@ public function &grabEntries(&$obj) { $ret = false; include XOOPS_ROOT_PATH.'/modules/oledrion/include/common.php'; - $items = $h_oledrion_products->getRecentProducts(new Oledrion_parameters(array('start' => 0, 'limit' => $this->grab))); + $items = $h_oledrion_products->getRecentProducts(new Oledrion_parameters(['start' => 0, 'limit' => $this->grab])); $i = 0; if (false != $items && count($items) > 0) { diff --git a/plugins/rssfit.pluginsample.php b/plugins/rssfit.pluginsample.php index 00626f1b..8b9f3fb2 100644 --- a/plugins/rssfit.pluginsample.php +++ b/plugins/rssfit.pluginsample.php @@ -109,11 +109,11 @@ public function &grabEntries(&$obj) $ret[$i]['category'] = $this->modname; $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; // 7. extra tags examples - $ret[$i]['extras'] = array(); + $ret[$i]['extras'] = []; // 7a. without attribute - $ret[$i]['extras']['author'] = array('content' => 'aabbc@c.com'); + $ret[$i]['extras']['author'] = ['content' => 'aabbc@c.com']; // 7b. with attributes - $ret[$i]['extras']['enclosure']['attributes'] = array('url' => 'url-to-any-file', 'length' => 1024000, 'type' => 'audio/mpeg'); + $ret[$i]['extras']['enclosure']['attributes'] = ['url' => 'url-to-any-file', 'length' => 1024000, 'type' => 'audio/mpeg']; $i++; } return $ret; diff --git a/plugins/rssfit.rmdp.php b/plugins/rssfit.rmdp.php index ce8d816a..c85e2125 100644 --- a/plugins/rssfit.rmdp.php +++ b/plugins/rssfit.rmdp.php @@ -66,7 +66,7 @@ public function loadModule() public function grabEntries(&$obj) { global $xoopsDB, $moduleperm_handler; - $ret = array(); + $ret = []; $i = 0; $sql = 'SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ' . $xoopsDB->prefix('rmdp_software') . ' ORDER BY fecha DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); diff --git a/plugins/rssfit.special.php b/plugins/rssfit.special.php index d6148be2..f2492bfe 100644 --- a/plugins/rssfit.special.php +++ b/plugins/rssfit.special.php @@ -79,12 +79,12 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $ret = array(); + $ret = []; @include_once XOOPS_ROOT_PATH.'/modules/special/class/stuff.php'; $myts = MyTextSanitizer::getInstance(); $items = SpecialStuff::getAllPublished($this->grab, 0); foreach ($items as $item) { - $ret[] = array( + $ret[] = [ 'title' => $myts->undoHtmlSpecialChars($item->title()), 'link' => XOOPS_URL . '/modules/special/article.php?itemid=' . $item->itemid(), 'guid' => XOOPS_URL . '/modules/special/article.php?itemid=' . $item->itemid(), @@ -92,7 +92,7 @@ public function &grabEntries(&$obj) 'description' => $item->hometext(), 'category' => $this->modname, 'domain' => XOOPS_URL . '/modules/' . $this->dirname . '/', - ); + ]; } return $ret; } diff --git a/plugins/rssfit.wfdownloads_podcast.php b/plugins/rssfit.wfdownloads_podcast.php index f12819cd..bccceb74 100644 --- a/plugins/rssfit.wfdownloads_podcast.php +++ b/plugins/rssfit.wfdownloads_podcast.php @@ -82,10 +82,11 @@ public function &grabEntries(&$obj) $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; // enclosure tag, a.k.a podcast $ret[$i]['extras']['enclosure']['attributes'] - = array('url' => XOOPS_URL.'/modules/'.$this->dirname.'/visit.php?cid='.$row['cid'].'&lid='.$row['lid'], - 'length' => $row['size'], - 'type' => $row['filetype'] - ); + = [ + 'url' => XOOPS_URL . '/modules/' . $this->dirname . '/visit.php?cid=' . $row['cid'] . '&lid=' . $row['lid'], + 'length' => $row['size'], + 'type' => $row['filetype'] + ]; $i++; } else { $perms[$row['cid']] = false; diff --git a/plugins/rssfit.wflinks.php b/plugins/rssfit.wflinks.php index a4514c42..8242961c 100644 --- a/plugins/rssfit.wflinks.php +++ b/plugins/rssfit.wflinks.php @@ -47,7 +47,7 @@ public function grabEntries(&$obj) $gperm_handler = &xoops_getHandler('groupperm'); $myts = MyTextSanitizer::getInstance(); - $ret = array(); + $ret = []; $i = 0; $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); diff --git a/rss.php b/rss.php index 11931f18..86aab39d 100644 --- a/rss.php +++ b/rss.php @@ -56,7 +56,7 @@ $xoopsTpl->xoops_setCacheTime($xoopsModuleConfig['cache']*60); } -$feed = array(); +$feed = []; $feed['plugin'] = isset($_GET[$rss->feedkey]) ? trim($_GET[$rss->feedkey]) : ''; $rss->checkSubFeed($feed); if (!$xoopsTpl->is_cached($template, $rss->cached) || !$docache) { diff --git a/xoops_version.php b/xoops_version.php index f7e1f2c5..60057b21 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -54,10 +54,10 @@ $modversion['module_status'] = 'Beta 1'; $modversion['min_php'] = '5.5'; $modversion['min_xoops'] = '2.5.9'; -$modversion['min_db'] = array( +$modversion['min_db'] = [ 'mysql' => '5.0.7', 'mysqli' => '5.0.7' -); +]; // Sql file (must contain sql generated by phpMyAdmin or phpPgAdmin) // All tables should not have any prefix! @@ -82,15 +82,15 @@ $modversion['hasMain'] = 1; // Templates -$modversion['templates'] = array(); -$modversion['templates'][] = array( +$modversion['templates'] = []; +$modversion['templates'][] = [ 'file' => 'rssfit_index.tpl', 'description' => _MI_TMPL_INTRO, -); -$modversion['templates'][] = array( +]; +$modversion['templates'][] = [ 'file' => 'rssfit_rss.tpl', 'description' => _MI_TMPL_RSS, -); +]; // Module Configs // $xoopsModuleConfig['overall_entries'] @@ -116,7 +116,7 @@ $modversion['config'][3]['formtype'] = 'select'; $modversion['config'][3]['valuetype'] = 'text'; $modversion['config'][3]['default'] = 'd'; -$modversion['config'][3]['options'] = array(_MI_ENTRIES_SORT_DATE=>'d', _MI_ENTRIES_SORT_CAT=>'c'); +$modversion['config'][3]['options'] = [_MI_ENTRIES_SORT_DATE =>'d', _MI_ENTRIES_SORT_CAT =>'c']; // $xoopsModuleConfig['cache'] $modversion['config'][4]['name'] = 'cache'; @@ -157,4 +157,4 @@ $modversion['config'][8]['formtype'] = 'select'; $modversion['config'][8]['valuetype'] = 'int'; $modversion['config'][8]['default'] = 1; -$modversion['config'][8]['options'] = array(_MI_OUTOUT_MIME_XML=>1, _MI_OUTOUT_MIME_HTML=>2, _MI_OUTOUT_MIME_PHP=>3); +$modversion['config'][8]['options'] = [_MI_OUTOUT_MIME_XML =>1, _MI_OUTOUT_MIME_HTML =>2, _MI_OUTOUT_MIME_PHP =>3]; From 0b14d81415e19ae527c2cb01dfeafdd65803c5f0 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 23 Oct 2017 23:54:49 -0400 Subject: [PATCH 010/154] Yoda --- class/misc.php | 8 ++++---- class/plugins.php | 8 ++++---- class/rssfeed.php | 6 +++--- plugins/rssfit.buyersguide.php | 2 +- plugins/rssfit.extcal.php | 4 ++-- plugins/rssfit.myalbum.php | 2 +- plugins/rssfit.newbb2.php | 4 ++-- plugins/rssfit.oledrion.php | 2 +- plugins/rssfit.surnames.php | 2 +- plugins/rssfit.weblinks.php | 2 +- plugins/rssfit.wfdownloads_podcast.php | 2 +- rss.php | 4 ++-- 12 files changed, 23 insertions(+), 23 deletions(-) diff --git a/class/misc.php b/class/misc.php index c85c7c1e..5bb34498 100644 --- a/class/misc.php +++ b/class/misc.php @@ -92,7 +92,7 @@ public function get($id, $fields='*') { $criteria = new Criteria($this->obj_key, (int)$id); if ($objs =& $this->getObjects($criteria)) { - return count($objs) != 1 ? false : $objs[0]; + return 1 != count($objs) ? false : $objs[0]; } return false; } @@ -117,7 +117,7 @@ public function &getObjects($criteria=null, $fields='*', $key='') $sql = 'SELECT '.$fields.' FROM '.$this->db_table; if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { $sql .= ' '.$criteria->renderWhere(); - if ($criteria->getSort() != '') { + if ('' != $criteria->getSort()) { $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); } $limit = $criteria->getLimit(); @@ -162,7 +162,7 @@ public function insert(XoopsObject $obj) //, $force = false) return false; } foreach ($obj->cleanVars as $k => $v) { - if ($obj->vars[$k]['data_type'] == XOBJ_DTYPE_INT) { + if (XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) { $cleanvars[$k] = (int)$v; } else { $cleanvars[$k] = $this->db->quoteString($v); @@ -205,7 +205,7 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) $sql = ''; foreach ($fields as $k => $v) { $sql .= $k.' = '; - $sql .= $obj->vars[$k]['data_type'] == 3 ? (int)$v : $this->db->quoteString($v); + $sql .= 3 == $obj->vars[$k]['data_type'] ? (int)$v : $this->db->quoteString($v); $sql .= ', '; } $sql = substr($sql, 0, -2); diff --git a/class/plugins.php b/class/plugins.php index 2612af39..e5e603f3 100644 --- a/class/plugins.php +++ b/class/plugins.php @@ -90,7 +90,7 @@ public function get($id, $fields='*') { $ret = false; $criteria = new Criteria($this->obj_key, (int)$id); - if ($objs =& $this->getObjects($criteria) && count($objs) === 1) { + if ($objs =& $this->getObjects($criteria) && 1 === count($objs)) { $ret =& $objs[0]; } return $ret; @@ -109,7 +109,7 @@ public function insert(XoopsObject $obj) //, $force=false) return false; } foreach ($obj->cleanVars as $k=>$v) { - if ($obj->vars[$k]['data_type'] == XOBJ_DTYPE_INT) { + if (XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) { $cleanvars[$k] = (int)$v; } else { $cleanvars[$k] = $this->db->quoteString($v); @@ -181,7 +181,7 @@ public function &getObjects($criteria=null, $fields='*', $key='') $sql = 'SELECT '.$fields.' FROM '.$this->db_table; if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { $sql .= ' '.$criteria->renderWhere(); - if ($criteria->getSort() != '') { + if ('' != $criteria->getSort()) { $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); } $limit = $criteria->getLimit(); @@ -217,7 +217,7 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) $sql = ''; foreach ($fields as $k => $v) { $sql .= $k.' = '; - $sql .= $obj->vars[$k]['data_type'] == 3 ? (int)$v : $this->db->quoteString($v); + $sql .= 3 == $obj->vars[$k]['data_type'] ? (int)$v : $this->db->quoteString($v); $sql .= ', '; } $sql = substr($sql, 0, -2); diff --git a/class/rssfeed.php b/class/rssfeed.php index f27a954d..f86a94c5 100644 --- a/class/rssfeed.php +++ b/class/rssfeed.php @@ -92,7 +92,7 @@ public function getChannel(&$feed) $channel = []; if ($elements =& $this->mHandler->getObjects(new Criteria('misc_category', 'channel'))) { foreach ($elements as $e) { - if ($e->getVar('misc_content') != '') { + if ('' != $e->getVar('misc_content')) { $channel[$e->getVar('misc_title')] = $e->getVar('misc_content', 'n'); } } @@ -145,7 +145,7 @@ public function getSticky(&$feed) $sticky =& $intr[0]; unset($intr); $setting = $sticky->getVar('misc_setting'); - if (in_array(0, $setting['feeds']) || $sticky->getVar('misc_title') == '' || $sticky->getVar('misc_content') == '') { + if (in_array(0, $setting['feeds']) || '' == $sticky->getVar('misc_title') || '' == $sticky->getVar('misc_content')) { return false; } if ((in_array(-1, $setting['feeds']) && empty($feed['plugin'])) || @@ -203,7 +203,7 @@ public function getItems(&$feed) } $entries[$i]['pubdate'] = $this->rssTimeStamp($entries[$i]['timestamp']); } - if (empty($feed['plugin']) && $this->modConfig['sort'] == 'd') { + if (empty($feed['plugin']) && 'd' == $this->modConfig['sort']) { uasort($entries, 'sortTimestamp'); } if (count($entries) > $this->modConfig['overall_entries'] && empty($feed['plugin'])) { diff --git a/plugins/rssfit.buyersguide.php b/plugins/rssfit.buyersguide.php index d47730d4..d148af35 100644 --- a/plugins/rssfit.buyersguide.php +++ b/plugins/rssfit.buyersguide.php @@ -74,7 +74,7 @@ public function &grabEntries(&$obj) $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); $ret[$i]['title'] = $item->getVar('prod_title', 'n'); $ret[$i]['timestamp'] = $item->getVar('prod_submited_date'); - if (xoops_trim($item->getVar('prod_summary')) != '') { + if ('' != xoops_trim($item->getVar('prod_summary'))) { $description = $item->getVar('prod_summary'); } else { $description = $item->getVar('prod_description'); diff --git a/plugins/rssfit.extcal.php b/plugins/rssfit.extcal.php index fc2623bf..1324f3dd 100644 --- a/plugins/rssfit.extcal.php +++ b/plugins/rssfit.extcal.php @@ -107,13 +107,13 @@ public function &grabEntries(&$obj) $address=$event->getVar('event_address'); $desc_link=$event->getVar('event_url'); - if ($desc_link=='') { + if ('' == $desc_link) { $desc_link=$link; } $desc = "$title
"; $desc .= ''; $desc .= ""; - if ($address!='') { + if ('' != $address) { $desc .= ""; } $desc .= ""; diff --git a/plugins/rssfit.myalbum.php b/plugins/rssfit.myalbum.php index 1f0fbf97..85f10bb0 100644 --- a/plugins/rssfit.myalbum.php +++ b/plugins/rssfit.myalbum.php @@ -91,7 +91,7 @@ public function myGetUnameFromId($uid) $thisUser = $member_handler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name')); - if ($name=='') { + if ('' == $name) { $name = htmlspecialchars($thisUser->getVar('uname')); } $lastUid=$uid; diff --git a/plugins/rssfit.newbb2.php b/plugins/rssfit.newbb2.php index 189d4aef..514177df 100644 --- a/plugins/rssfit.newbb2.php +++ b/plugins/rssfit.newbb2.php @@ -64,7 +64,7 @@ public function myGetUnameFromId($uid) static $lastUid=false; static $lastName=''; - if ($uid==0) { + if (0 == $uid) { return 'A guest'; } @@ -77,7 +77,7 @@ public function myGetUnameFromId($uid) $thisUser = $member_handler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name')); - if ($name=='') { + if ('' == $name) { $name = htmlspecialchars($thisUser->getVar('uname')); } $lastUid=$uid; diff --git a/plugins/rssfit.oledrion.php b/plugins/rssfit.oledrion.php index 971faa24..ce56424c 100644 --- a/plugins/rssfit.oledrion.php +++ b/plugins/rssfit.oledrion.php @@ -54,7 +54,7 @@ public function &grabEntries(&$obj) $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); $ret[$i]['title'] = $item->getVar('product_title', 'n'); $ret[$i]['timestamp'] = $item->getVar('product_submitted'); - if (xoops_trim($item->getVar('product_summary')) != '') { + if ('' != xoops_trim($item->getVar('product_summary'))) { $description = $item->getVar('product_summary'); } else { $description = $item->getVar('product_description'); diff --git a/plugins/rssfit.surnames.php b/plugins/rssfit.surnames.php index 011ace40..5ef31acf 100644 --- a/plugins/rssfit.surnames.php +++ b/plugins/rssfit.surnames.php @@ -76,7 +76,7 @@ public function myGetUnameFromId($uid) $thisUser = $member_handler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name')); - if ($name=='') { + if ('' == $name) { $name = htmlspecialchars($thisUser->getVar('uname')); } $lastUid=$uid; diff --git a/plugins/rssfit.weblinks.php b/plugins/rssfit.weblinks.php index 78107fdf..32245098 100644 --- a/plugins/rssfit.weblinks.php +++ b/plugins/rssfit.weblinks.php @@ -71,7 +71,7 @@ public function myGetUnameFromId($uid) $thisUser = $member_handler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name')); - if ($name=='') { + if ('' == $name) { $name = htmlspecialchars($thisUser->getVar('uname')); } $lastUid=$uid; diff --git a/plugins/rssfit.wfdownloads_podcast.php b/plugins/rssfit.wfdownloads_podcast.php index bccceb74..d8e4f0e6 100644 --- a/plugins/rssfit.wfdownloads_podcast.php +++ b/plugins/rssfit.wfdownloads_podcast.php @@ -71,7 +71,7 @@ public function &grabEntries(&$obj) . time() . ' ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - if ((isset($perms[$row['cid']]) && $perms[$row['cid']] == true) || $perm_handler->checkRight('WFDownCatPerm', $row['cid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { + if ((isset($perms[$row['cid']]) && true == $perms[$row['cid']]) || $perm_handler->checkRight('WFDownCatPerm', $row['cid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { $perms[$row['cid']] = true; $ret[$i]['title'] = $row['title']; $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlefile.php?cid='.$row['cid'].'&lid='.$row['lid']; diff --git a/rss.php b/rss.php index 86aab39d..b60e0cc5 100644 --- a/rss.php +++ b/rss.php @@ -38,9 +38,9 @@ $charset = $xoopsModuleConfig['utf8'] ? 'UTF-8' : _CHARSET; $docache = $xoopsModuleConfig['cache'] ? true : false; $template = 'db:rssfit_rss.tpl'; -if ($xoopsModuleConfig['mime'] == 3) { +if (3 == $xoopsModuleConfig['mime']) { $xoopsLogger->enableRendering(); - $xoopsLogger->usePopup = ($xoopsConfig['debug_mode'] == 2); + $xoopsLogger->usePopup = (2 == $xoopsConfig['debug_mode']); $docache = false; } else { error_reporting(0); From 4edf9c22f2845abe7177cc179b69416686d4402b Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 23 Oct 2017 23:56:26 -0400 Subject: [PATCH 011/154] UTF-8 --- plugins/rssfit.buyersguidenews.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/rssfit.buyersguidenews.php b/plugins/rssfit.buyersguidenews.php index 76b2362c..b76798ad 100644 --- a/plugins/rssfit.buyersguidenews.php +++ b/plugins/rssfit.buyersguidenews.php @@ -30,7 +30,7 @@ /** * About this RSSFit plug-in - * Author: Hervé Thouzard of Instant Zero (http://www.instant-zero.com) + * Author: Hervé Thouzard of Instant Zero (http://www.instant-zero.com) * Requirements (Tested with): * Module: Buyersguide * Version: 1.33 From 711ea6adc43cc30f58ec62e1726b11eecee82514 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 23 Oct 2017 23:59:27 -0400 Subject: [PATCH 012/154] Callable calls in loops termination condition --- class/rssfeed.php | 2 +- plugins/rssfit.ams.php | 2 +- plugins/rssfit.news.php | 2 +- plugins/rssfit.smartfaq.php | 2 +- plugins/rssfit.smartpartner.php | 2 +- plugins/rssfit.smartsection.php | 2 +- plugins/rssfit.wfsection2.php | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/class/rssfeed.php b/class/rssfeed.php index f86a94c5..8c23bcc9 100644 --- a/class/rssfeed.php +++ b/class/rssfeed.php @@ -191,7 +191,7 @@ public function getItems(&$feed) } } if (count($entries) > 0) { - for ($i=0; $icleanupChars($entries[$i]['title']); $strip = $this->modConfig['strip_html'] ? 1 : 0; $this->cleanupChars($entries[$i]['description'], $strip, 0, 1); diff --git a/plugins/rssfit.ams.php b/plugins/rssfit.ams.php index 6c717642..3a7f67ae 100644 --- a/plugins/rssfit.ams.php +++ b/plugins/rssfit.ams.php @@ -63,7 +63,7 @@ public function &grabEntries(&$obj) $myts = MyTextSanitizer::getInstance(); $ams = AmsStory::getAllPublished($this->grab, 0); if (count($ams) > 0) { - for ($i=0; $iundoHtmlSpecialChars($ams[$i]->title()); $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL.'/modules/AMS/article.php?storyid='.$ams[$i]->storyid(); $ret[$i]['timestamp'] = $ams[$i]->published(); diff --git a/plugins/rssfit.news.php b/plugins/rssfit.news.php index e9b94b85..23d399da 100644 --- a/plugins/rssfit.news.php +++ b/plugins/rssfit.news.php @@ -69,7 +69,7 @@ public function &grabEntries(&$obj) $news = NewsStory::getAllPublished($this->grab, 0); } if (count($news) > 0) { - for ($i=0; $imodname . ': ' . $myts->undoHtmlSpecialChars($news[$i]->title()); $ret[$i]['link'] = XOOPS_URL.'/modules/news/article.php?storyid='.$news[$i]->storyid(); $ret[$i]['guid'] = XOOPS_URL.'/modules/news/article.php?storyid='.$news[$i]->storyid(); diff --git a/plugins/rssfit.smartfaq.php b/plugins/rssfit.smartfaq.php index f01e0c3c..4985bf1b 100644 --- a/plugins/rssfit.smartfaq.php +++ b/plugins/rssfit.smartfaq.php @@ -64,7 +64,7 @@ public function &grabEntries(&$obj) $faqs = $faq_handler->getAllPublished($this->grab, 0); if (false != $faqs && count($faqs) > 0) { $answer_handler = sf_gethandler('answer'); - for ($i=0; $igetOfficialAnswer($faqs[$i]->faqid())) { continue; } diff --git a/plugins/rssfit.smartpartner.php b/plugins/rssfit.smartpartner.php index dff21835..8610fa98 100644 --- a/plugins/rssfit.smartpartner.php +++ b/plugins/rssfit.smartpartner.php @@ -63,7 +63,7 @@ public function &grabEntries(&$obj) include XOOPS_ROOT_PATH . '/modules/smartpartner/include/common.php'; $partners = $partner_handler->getPartners($this->grab, 0, _SPARTNER_STATUS_ACTIVE, 'weight', 'DESC'); if (false != $partners && count($partners) > 0) { - for ($i=0; $igetVar('title', 'n'); $ret[$i]['description'] = $partners[$i]->getVar('summary'); diff --git a/plugins/rssfit.smartsection.php b/plugins/rssfit.smartsection.php index 2a704d59..8ea9a06c 100644 --- a/plugins/rssfit.smartsection.php +++ b/plugins/rssfit.smartsection.php @@ -62,7 +62,7 @@ public function &grabEntries(&$obj) include XOOPS_ROOT_PATH . '/modules/smartsection/include/common.php'; $items = $smartsection_item_handler->getAllPublished($this->grab, 0); if (false != $items && count($items) > 0) { - for ($i=0; $igetItemUrl(); $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); diff --git a/plugins/rssfit.wfsection2.php b/plugins/rssfit.wfsection2.php index 0080530b..0140bbea 100644 --- a/plugins/rssfit.wfsection2.php +++ b/plugins/rssfit.wfsection2.php @@ -65,7 +65,7 @@ public function &grabEntries(&$obj) if (count($articles) > 0) { $xoopsModuleConfig['shortartlen'] = 0; $myts = MyTextSanitizer::getInstance(); - for ($i=0; $iarticleid(); $ret[$i]['title'] = $myts->undoHtmlSpecialChars($articles[$i]->title()); $ret[$i]['link'] = $link; From 430fd4e674b0032b79241e4ba0e1314010d5ed09 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 24 Oct 2017 00:00:50 -0400 Subject: [PATCH 013/154] 'str(i)str(...)' could be replaced with 'str(i)pos(...)' --- index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.php b/index.php index 1ce5047b..d19dec8d 100644 --- a/index.php +++ b/index.php @@ -43,7 +43,7 @@ $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); $content = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_content')); $content = str_replace('{SITEURL}', XOOPS_URL.'/', $content); - if (strstr($content, '{SUB}') && $plugins = $plugins_handler->getObjects(new Criteria('subfeed', 1))) { + if (false !== strpos($content, '{SUB}') && $plugins = $plugins_handler->getObjects(new Criteria('subfeed', 1))) { $sublist = ''; foreach ($plugins as $p) { $sub = $myts->stripSlashesGPC($setting['sub']); From 95c7f98a134f230e909901d58303a3eaee5f4476 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 24 Oct 2017 00:14:25 -0400 Subject: [PATCH 014/154] README.md --- README.md | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index cc857c28..a1b20be5 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,22 @@ -# XOOPS CMS Module ![XOOPS CMS](https://avatars2.githubusercontent.com/u/12771439?v=3&s=200) +![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png) +## RSSFit module for [XOOPS CMS 2.5.9+](https://xoops.org) +[![XOOPS CMS Module](https://img.shields.io/badge/XOOPS%20CMS-Module-blue.svg)](https://xoops.org) +[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](LICENSE) -**RSSFit** is a module for XOOPS generates RSS 2.0 validated XML feed. Web masters can decide what to be displayed in the XML output by activating installed plug-ins. +[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/XoopsModules25x/rss.svg?style=flat)](https://scrutinizer-ci.com/g/XoopsModules25x/rss/?branch=master) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/95b12220e0ac4056b9af52af708379c9)](https://www.codacy.com/app/mambax7/rss_2) +[![Code Climate](https://img.shields.io/codeclimate/github/XoopsModules25x/rss.svg?style=flat)](https://codeclimate.com/github/XoopsModules25x/rss) +[![SensioLabsInsight](https://insight.sensiolabs.com/projects/f4ebd84f-65c1-4947-afb8-319b60824d2e/mini.png)](https://insight.sensiolabs.com/projects/f4ebd84f-65c1-4947-afb8-319b60824d2e) +[![Latest Pre-Release](https://img.shields.io/github/tag/XoopsModules25x/rss.svg?style=flat)](https://github.com/XoopsModules25x/rss/tags/) +[![Latest Version](https://img.shields.io/github/release/XoopsModules25x/rss.svg?style=flat)](https://github.com/XoopsModules25x/rss/releases/) -**XOOPS Module Archive:** Module in this archive are older modules for XOOPS CMS, and therefore some of them might not work with the latest XOOPS and PHP versions. +**RSSFit** module for [XOOPS CMS](https://xoops.org) is a module for XOOPS generates RSS 2.0 validated XML feed. Web masters can decide what to be displayed in the XML output by activating installed plug-ins. -However, please fork them and if you have any improvements and fixes, please share them back with us. +[![Tutorial Available](https://xoops.org/images/tutorial-available-blue.svg)](https://www.gitbook.com/book/xoops/rss-tutorial/) Tutorial: see [GitBook](https://www.gitbook.com/book/xoops/rss-tutorial/). +To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/rss-tutorial) -Visit us on http://xoops.org +[![Translations on Transifex](https://xoops.org/images/translations-transifex-blue.svg)](https://www.transifex.com/xoops) -The upcoming XOOPS CMS version is being crafted at: https://github.com/XOOPS +Please visit us on https://xoops.org + +Current and upcoming "next generation" versions of XOOPS CMS are being crafted on GitHub at: https://github.com/XOOPS From ba00fb0e029817a600b8088033da2c5aedf76557 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 24 Oct 2017 00:32:07 -0400 Subject: [PATCH 015/154] version, changelog.txt --- docs/changelog.txt | 86 ++++++++++++++++++----------- xoops_version.php | 134 ++++++++++++++++++++++----------------------- 2 files changed, 117 insertions(+), 103 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index e534bdc7..2af2975f 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,31 +1,47 @@ ---------------------------------------- -1.30 Beta 2 2017-10-24 ---------------------------------------- +
1.30 Beta 3 [NOT RELEASED]
+
+- move files up +- Unnecessary double quotes (mamba) +- Unnecessary parentheses (mamba) +- 'str(i)str(...)' could be replaced with 'str(i)pos(...)' (mamba) +- Callable calls in loops termination condition (mamba) +- UTF-8 fix (mamba) +- Yoda (mamba) +- Array short syntax (mamba) +- Case mismatch in method call or class usage (mamba) +- Type casting (mamba) +- __DIR__ (mamba) +- Callable name case mismatched in a call (mamba) +- php-cs-fixer (mamba) +- ENGINE fix (mamba) +- update README.md (mamba) +
1.30 Beta 2 [2017-10-24]
+
- Converted to XOOPS 2.5.9/Xmf Admin GUI, PHP 7 compliance (geekwright) ---------------------------------------- -1.30 Beta 1 2014-03-03 ---------------------------------------- - +
1.30 Beta 1 2014-03-03]
+
- Converted to XOOPS 2.5.6 Admin GUI (Mamba) ---------------------------------------- -1.22 2008-07-16 ---------------------------------------- -Changes made by Hervé Thouzard of Instant Zero (http://www.instant-zero.com) -With some configurations of PHP, it was not possible to access the different parts of the module's administration. -This version corrects the problem and you should now be able to access all the parts of the administration. +
1.22 [2008-07-16]
+
+ +- Changes made by Hervé Thouzard of Instant Zero (http://www.instant-zero.com) +- With some configurations of PHP, it was not possible to access the different parts of the module's administration. +- This version corrects the problem and you should now be able to access all the parts of the administration. ----------------------- -Jul 25, 2006: Version 1.21 + +
1.21 [Jul 25, 2006]
+
- Fixed compatibility problem with XOOPS 2.0.14 - Modified WF-Downloads plugin for padcasting (requires WF-Downloads version 3.1) ----------------------- -Dec 23, 2005: Version 1.2 / 1.5 + +
1.2 [Dec 23, 2005]
+
- (Version 1.5) Fixed incompatibility with XOOPS 2.2.3a - New editable feed information: copyright - PHP-debug messages are now completely hidden when prefernece "MIME type of RSS output" is set as "XML", even php-debug is turned on under system admin @@ -37,19 +53,20 @@ Dec 23, 2005: Version 1.2 / 1.5 - Fixed "call by reference" errors appear on PHP 4.4 / 5.1 - German, Bulgarian, French language pack added (Thanks DocuAnt, Stefan Ilivanov, Machenzy) ----------------------- -Mar 23, 2005: Version 1.1 -Individual sub-feeds based on activated plug-ins -Editable channel elements -Sticky text displays as the very first item of a feed -New and updated plug-ins -Various bug fixes -Development sponsored by Stefanos Karagos and IIS-Resources +
1.1 [Mar 23, 2005]
+
+- Individual sub-feeds based on activated plug-ins +- Editable channel elements +- Sticky text displays as the very first item of a feed +- New and updated plug-ins +- Various bug fixes +- Development sponsored by Stefanos Karagos and IIS-Resources Notes for upgrading from version 1.0x: There is no upgrade patch since over 90 percent of the files are modified. You have to replace the entire directory contents with the new version. Don't forget to update the module after uploading new files. If you have the rss feed smarty template customized you should take a look at the file templates/rssfit_rss.html for corresponding changes. ----------------------- -Dec 26, 2004: Version 1.03 + +
1.03 [Dec 26, 2004]
+
Fixed incompatibility with PHP 5 Fixed rss template not validated by rss-validators Fixed a typo in the mylinks plug-in @@ -57,14 +74,17 @@ Dutch language pack added. Italian language pack added. Portuguese language pack added. ----------------------- -Jun 6, 2004: Version 1.02 + +
1.02 [Jun 6, 2004]
+
French language pack added. ----------------------- -MAY 9, 2004: Version 1.01 + +
MAY 9, 2004: Version 1.01]
+
Spanish language pack added. ----------------------- -MAY 5, 2004: Version 1.0 + +
1.0 [MAY 5, 2004]
+
First public release. diff --git a/xoops_version.php b/xoops_version.php index 60057b21..8ddf67b4 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -32,32 +32,26 @@ die('XOOPS root path not defined'); } -$modversion['name'] = _MI_RSSFIT_NAME; -$modversion['version'] = '1.30'; -$modversion['description'] = _MI_RSSFIT_DESC; -$modversion['author'] = 'NS Tai (aka tuff)'; -$modversion['credits'] = "Brandycoke Productions"; -$modversion['help'] = 'page=help'; -$modversion['license'] = 'GNU GPL 2.0 or later'; -$modversion['license_url'] = 'https://www.gnu.org/licenses/gpl-2.0.html'; -$modversion['official'] = 0; -$modversion['image'] = 'images/rssfeed.png'; -$modversion['dirname'] = basename(__DIR__); - -$modversion['dirmoduleadmin'] = 'Frameworks/moduleclasses'; -$modversion['icons16'] = 'Frameworks/moduleclasses/icons/16'; -$modversion['icons32'] = 'Frameworks/moduleclasses/icons/32'; -//about -$modversion['release_date'] = '2014/03/03'; -$modversion['module_website_url'] = 'www.xoops.org'; +$modversion['version'] = '1.30'; +$modversion['module_status'] = 'Beta 3'; +$modversion['release_date'] = '2017/10/24'; +$modversion['name'] = _MI_RSSFIT_NAME; +$modversion['description'] = _MI_RSSFIT_DESC; +$modversion['author'] = 'NS Tai (aka tuff)'; +$modversion['credits'] = "Brandycoke Productions"; +$modversion['help'] = 'page=help'; +$modversion['license'] = 'GNU GPL 2.0 or later'; +$modversion['license_url'] = 'https://www.gnu.org/licenses/gpl-2.0.html'; +$modversion['official'] = 0; +//$modversion['modicons16'] = 'assets/images/icons/16'; +//$modversion['modicons32'] = 'assets/images/icons/32'; +$modversion['image'] = 'images/rssfeed.png'; +$modversion['dirname'] = basename(__DIR__); +$modversion['module_website_url'] = 'https://xoops.org'; $modversion['module_website_name'] = 'XOOPS'; -$modversion['module_status'] = 'Beta 1'; $modversion['min_php'] = '5.5'; $modversion['min_xoops'] = '2.5.9'; -$modversion['min_db'] = [ - 'mysql' => '5.0.7', - 'mysqli' => '5.0.7' -]; +$modversion['min_db'] = ['mysql' => '5.5']; // Sql file (must contain sql generated by phpMyAdmin or phpPgAdmin) // All tables should not have any prefix! @@ -69,20 +63,20 @@ $modversion['tables'][1] = 'rssfit_misc'; // Admin things -$modversion['hasAdmin'] = 1; +$modversion['hasAdmin'] = 1; $modversion['system_menu'] = 1; -$modversion['adminindex'] = 'admin/index.php'; -$modversion['adminmenu'] = 'admin/menu.php'; +$modversion['adminindex'] = 'admin/index.php'; +$modversion['adminmenu'] = 'admin/menu.php'; // Script to run on install/unstall/update $modversion['onInstall'] = 'include/install.php'; -$modversion['onUpdate'] = 'include/install.php'; +$modversion['onUpdate'] = 'include/install.php'; // Menu -- content in main menu block $modversion['hasMain'] = 1; // Templates -$modversion['templates'] = []; +$modversion['templates'] = []; $modversion['templates'][] = [ 'file' => 'rssfit_index.tpl', 'description' => _MI_TMPL_INTRO, @@ -94,67 +88,67 @@ // Module Configs // $xoopsModuleConfig['overall_entries'] -$modversion['config'][1]['name'] = 'overall_entries'; -$modversion['config'][1]['title'] = '_MI_OVERALL_ENTRIES'; +$modversion['config'][1]['name'] = 'overall_entries'; +$modversion['config'][1]['title'] = '_MI_OVERALL_ENTRIES'; $modversion['config'][1]['description'] = '_MI_OVERALL_ENTRIES_DESC'; -$modversion['config'][1]['formtype'] = 'textbox'; -$modversion['config'][1]['valuetype'] = 'int'; -$modversion['config'][1]['default'] = 20; +$modversion['config'][1]['formtype'] = 'textbox'; +$modversion['config'][1]['valuetype'] = 'int'; +$modversion['config'][1]['default'] = 20; // $xoopsModuleConfig['plugin_entries'] -$modversion['config'][2]['name'] = 'plugin_entries'; -$modversion['config'][2]['title'] = '_MI_PLUGIN_ENTRIES'; +$modversion['config'][2]['name'] = 'plugin_entries'; +$modversion['config'][2]['title'] = '_MI_PLUGIN_ENTRIES'; $modversion['config'][2]['description'] = '_MI_PLUGIN_ENTRIES_DESC'; -$modversion['config'][2]['formtype'] = 'textbox'; -$modversion['config'][2]['valuetype'] = 'int'; -$modversion['config'][2]['default'] = 5; +$modversion['config'][2]['formtype'] = 'textbox'; +$modversion['config'][2]['valuetype'] = 'int'; +$modversion['config'][2]['default'] = 5; // $xoopsModuleConfig['sort'] -$modversion['config'][3]['name'] = 'sort'; -$modversion['config'][3]['title'] = '_MI_ENTRIES_SORT'; +$modversion['config'][3]['name'] = 'sort'; +$modversion['config'][3]['title'] = '_MI_ENTRIES_SORT'; $modversion['config'][3]['description'] = '_MI_ENTRIES_SORT_DESC'; -$modversion['config'][3]['formtype'] = 'select'; -$modversion['config'][3]['valuetype'] = 'text'; -$modversion['config'][3]['default'] = 'd'; -$modversion['config'][3]['options'] = [_MI_ENTRIES_SORT_DATE =>'d', _MI_ENTRIES_SORT_CAT =>'c']; +$modversion['config'][3]['formtype'] = 'select'; +$modversion['config'][3]['valuetype'] = 'text'; +$modversion['config'][3]['default'] = 'd'; +$modversion['config'][3]['options'] = [_MI_ENTRIES_SORT_DATE => 'd', _MI_ENTRIES_SORT_CAT => 'c']; // $xoopsModuleConfig['cache'] -$modversion['config'][4]['name'] = 'cache'; -$modversion['config'][4]['title'] = '_MI_CACHE'; +$modversion['config'][4]['name'] = 'cache'; +$modversion['config'][4]['title'] = '_MI_CACHE'; $modversion['config'][4]['description'] = '_MI_CACHE_DESC'; -$modversion['config'][4]['formtype'] = 'textbox'; -$modversion['config'][4]['valuetype'] = 'int'; -$modversion['config'][4]['default'] = 0; +$modversion['config'][4]['formtype'] = 'textbox'; +$modversion['config'][4]['valuetype'] = 'int'; +$modversion['config'][4]['default'] = 0; // $xoopsModuleConfig['max_char'] -$modversion['config'][5]['name'] = 'max_char'; -$modversion['config'][5]['title'] = '_MI_MAXCHAR'; +$modversion['config'][5]['name'] = 'max_char'; +$modversion['config'][5]['title'] = '_MI_MAXCHAR'; $modversion['config'][5]['description'] = '_MI_MAXCHAR_DESC'; -$modversion['config'][5]['formtype'] = 'textbox'; -$modversion['config'][5]['valuetype'] = 'int'; -$modversion['config'][5]['default'] = 0; +$modversion['config'][5]['formtype'] = 'textbox'; +$modversion['config'][5]['valuetype'] = 'int'; +$modversion['config'][5]['default'] = 0; // $xoopsModuleConfig['strip_html'] -$modversion['config'][6]['name'] = 'strip_html'; -$modversion['config'][6]['title'] = '_MI_STRIPHTML'; +$modversion['config'][6]['name'] = 'strip_html'; +$modversion['config'][6]['title'] = '_MI_STRIPHTML'; $modversion['config'][6]['description'] = '_MI_STRIPHTML_DESC'; -$modversion['config'][6]['formtype'] = 'yesno'; -$modversion['config'][6]['valuetype'] = 'int'; -$modversion['config'][6]['default'] = 0; +$modversion['config'][6]['formtype'] = 'yesno'; +$modversion['config'][6]['valuetype'] = 'int'; +$modversion['config'][6]['default'] = 0; // $xoopsModuleConfig['utf8'] -$modversion['config'][7]['name'] = 'utf8'; -$modversion['config'][7]['title'] = '_MI_ENCODE_UTF8'; +$modversion['config'][7]['name'] = 'utf8'; +$modversion['config'][7]['title'] = '_MI_ENCODE_UTF8'; $modversion['config'][7]['description'] = '_MI_ENCODE_UTF8_DESC'; -$modversion['config'][7]['formtype'] = 'yesno'; -$modversion['config'][7]['valuetype'] = 'int'; -$modversion['config'][7]['default'] = 0; +$modversion['config'][7]['formtype'] = 'yesno'; +$modversion['config'][7]['valuetype'] = 'int'; +$modversion['config'][7]['default'] = 0; // $xoopsModuleConfig['mime'] -$modversion['config'][8]['name'] = 'mime'; -$modversion['config'][8]['title'] = '_MI_OUTOUT_MIME'; +$modversion['config'][8]['name'] = 'mime'; +$modversion['config'][8]['title'] = '_MI_OUTOUT_MIME'; $modversion['config'][8]['description'] = ''; -$modversion['config'][8]['formtype'] = 'select'; -$modversion['config'][8]['valuetype'] = 'int'; -$modversion['config'][8]['default'] = 1; -$modversion['config'][8]['options'] = [_MI_OUTOUT_MIME_XML =>1, _MI_OUTOUT_MIME_HTML =>2, _MI_OUTOUT_MIME_PHP =>3]; +$modversion['config'][8]['formtype'] = 'select'; +$modversion['config'][8]['valuetype'] = 'int'; +$modversion['config'][8]['default'] = 1; +$modversion['config'][8]['options'] = [_MI_OUTOUT_MIME_XML => 1, _MI_OUTOUT_MIME_HTML => 2, _MI_OUTOUT_MIME_PHP => 3]; From 101a10332c7ed2274feb11d6ea33e98bb4cd0c99 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 27 Oct 2017 09:09:30 -0400 Subject: [PATCH 016/154] cosmetics --- admin/about.php | 2 +- admin/admin_header.php | 4 +-- admin/do_intro.php | 6 ++-- admin/do_plugins.php | 35 +++++++++++---------- admin/do_sticky.php | 6 ++-- admin/do_subfeeds.php | 26 +++++++-------- admin/index.php | 5 ++- admin/menu.php | 2 +- class/misc.php | 8 ++--- class/plugins.php | 8 ++--- class/rssfeed.php | 20 ++++++------ header.php | 4 +-- include/common.php | 4 +-- include/install.php | 4 +-- index.php | 8 ++--- plugins/rssfit.buyersguide.php | 2 +- plugins/rssfit.buyersguidemanufacturers.php | 2 +- plugins/rssfit.buyersguidenews.php | 2 +- plugins/rssfit.cbb.php | 8 ++--- plugins/rssfit.comments.php | 4 +-- plugins/rssfit.extcal.php | 4 +-- plugins/rssfit.lexikon.php | 2 +- plugins/rssfit.myalbum.php | 4 +-- plugins/rssfit.newbb2.php | 12 +++---- plugins/rssfit.oledrion.php | 2 +- plugins/rssfit.smartfaq.php | 10 +++--- plugins/rssfit.smartpartner.php | 2 +- plugins/rssfit.smartsection.php | 2 +- plugins/rssfit.surnames.php | 4 +-- plugins/rssfit.weblinks.php | 4 +-- plugins/rssfit.wfdownloads.php | 4 +-- plugins/rssfit.wfdownloads_podcast.php | 4 +-- plugins/rssfit.wflinks.php | 4 +-- rss.php | 2 +- 34 files changed, 110 insertions(+), 110 deletions(-) diff --git a/admin/about.php b/admin/about.php index 51c522e6..4415aa87 100644 --- a/admin/about.php +++ b/admin/about.php @@ -27,4 +27,4 @@ Admin::setPaypal('xoopsfoundation@gmail.com'); $moduleAdmin->displayAbout(false); -include_once 'admin_footer.php'; +include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_header.php b/admin/admin_header.php index a3ec27d5..f5c967f8 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -22,7 +22,7 @@ require_once $path . '/include/cp_functions.php'; require_once $path . '/include/cp_header.php'; -class_exists('\Xmf\Module\Admin') or die('XMF is required.'); +class_exists('\Xmf\Module\Admin') || exit('XMF is required.'); global $xoopsModule; @@ -37,7 +37,7 @@ class_exists('\Xmf\Module\Admin') or die('XMF is required.'); //if functions.php file exist require_once dirname(__DIR__) . '/include/common.php'; -//require '../include/common.php'; +//require __DIR__ . '/../include/common.php'; global $xoopsModule; diff --git a/admin/do_intro.php b/admin/do_intro.php index 8d443ed9..5d56ba19 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -36,11 +36,11 @@ header('Location: index.php'); } -if ($intr = $misc_handler->getObjects(new Criteria('misc_category', 'intro'))) { +if ($intr = $miscHandler->getObjects(new Criteria('misc_category', 'intro'))) { $intro = $intr[0]; unset($intr); } else { - $intro = $misc_handler->create(); + $intro = $miscHandler->create(); } switch ($op) { default: @@ -81,7 +81,7 @@ 'sub' => isset($_POST['sub']) ? trim($_POST['sub']) : '' ]; $intro->setVar('misc_setting', $setting); - if (false == $misc_handler->insert($intro)) { + if (false === $miscHandler->insert($intro)) { echo $intro->getHtmlErrors(); } else { redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 6eb11ab5..63752c7a 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -43,7 +43,7 @@ $ret = ''; // activated plugins $criteria = new Criteria('rssf_activated', 1); - if ($plugins = $plugins_handler->getObjects($criteria, 'p_activated')) { + if ($plugins = $pluginsHandler->getObjects($criteria, 'p_activated')) { $ret .= "
When:$event_start
Where:$address
What:$description
\n" . "\n" . "\n\n" @@ -53,7 +53,7 @@ . "\n" . "\n"; foreach ($plugins as $p) { - if ($handler =& $plugins_handler->checkPlugin($p)) { + if ($handler = $pluginsHandler->checkPlugin($p)) { $id = $p->getVar('rssf_conf_id'); $entries = new XoopsFormText('', 'rssf_grab[' . $id . ']', 3, 2, $p->getVar('rssf_grab')); $order = new XoopsFormText('', 'rssf_order[' . $id . ']', 3, 2, $p->getVar('rssf_order')); @@ -74,14 +74,14 @@ . $action->render() . "\n"; $ret .= "\n"; } else { - $plugins_handler->forceDeactivate($p); + $pluginsHandler->forceDeactivate($p); } } $ret .= "
" . _AM_PLUGIN_ACTIVATED . "
" . _AM_PLUGIN_FILENAME . "" . _AM_ACTION . "
\n"; } // inactive plugins - if ($plugins = $plugins_handler->getObjects(new Criteria('rssf_activated', 0), 'p_inactive')) { + if ($plugins = $pluginsHandler->getObjects(new Criteria('rssf_activated', 0), 'p_inactive')) { $ret .= "
\n\n" . "\n" . "\n\n" @@ -96,7 +96,7 @@ . "\n" . "\n" . "
" . _AM_PLUGIN_INACTIVE . "
" . _AM_PLUGIN_FILENAME . "" . $p->getVar('rssf_filename') . ""; - if ($handler =& $plugins_handler->checkPlugin($p)) { + if ($handler = $pluginsHandler->checkPlugin($p)) { $ret .= $handler->modname; $action->addOption('a', _AM_PLUGIN_ACTIVATE); } else { @@ -118,7 +118,7 @@ } // Non-installed plugins - if (!$filelist =& $plugins_handler->getPluginFileList()) { + if (!$filelist =& $pluginsHandler->getPluginFileList()) { $filelist = []; } $list = XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); @@ -142,9 +142,9 @@ . "" . $i . ""; - $p = $plugins_handler->create(); + $p = $pluginsHandler->create(); $p->setVar('rssf_filename', $i); - if ($handler =& $plugins_handler->checkPlugin($p)) { + if ($handler = $pluginsHandler->checkPlugin($p)) { $ret .= $handler->modname; } else { if (count($p->getErrors()) > 0) { @@ -177,32 +177,33 @@ $rssf_grab = Request::getArray('rssf_grab', [], 'POST'); $rssf_order = Request::getArray('rssf_order', [], 'POST'); $action = Request::getArray('action', null, 'POST'); + $install = Request::getArray('install', array(), 'POST'); $err = ''; if (isset($action)) { $keys = array_keys($action); foreach ($keys as $k) { - $plugin = $plugins_handler->get($k); + $plugin = $pluginsHandler->get($k); if (isset($rssf_grab[$k])) { $plugin->setVar('rssf_grab', $rssf_grab[$k]); $plugin->setVar('rssf_order', $rssf_order[$k]); } switch ($action[$k]) { default: - $result = $plugins_handler->insert($plugin); + $result = $pluginsHandler->insert($plugin); break; case 'u': // uninstall - $result = $plugins_handler->delete($plugin); + $result = $pluginsHandler->delete($plugin); break; case 'd': // deactivate $plugin->setVar('rssf_activated', 0); - $result = $plugins_handler->insert($plugin); + $result = $pluginsHandler->insert($plugin); break; case 'a': // activate $plugin->setVar('rssf_activated', 1); - $result = $plugins_handler->insert($plugin); + $result = $pluginsHandler->insert($plugin); break; } if (!$result) { @@ -213,16 +214,16 @@ if (!empty($install)) { $files = array_keys($install); foreach ($files as $f) { - $p =& $plugins_handler->create(); + $p = $pluginsHandler->create(); $p->setVar('rssf_filename', $f); - if ($handler =& $plugins_handler->checkPlugin($p)) { + if ($handler = $pluginsHandler->checkPlugin($p)) { $p->setVar('rssf_activated', 1); $p->setVar('rssf_grab', $xoopsModuleConfig['plugin_entries']); $p->setVar('sub_entries', $xoopsModuleConfig['plugin_entries']); $p->setVar('sub_link', XOOPS_URL . '/modules/' . $handler->dirname); $p->setVar('sub_title', $xoopsConfig['sitename'] . ' - ' . $handler->modname); $p->setVar('sub_desc', $xoopsConfig['slogan']); - if (!$result = $plugins_handler->insert($p)) { + if (!$result = $pluginsHandler->insert($p)) { $err .= $p->getHtmlErrors(); } } @@ -236,4 +237,4 @@ break; } -include_once 'admin_footer.php'; +include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/do_sticky.php b/admin/do_sticky.php index b33dc465..5f1339ac 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -36,11 +36,11 @@ header('Location: index.php'); } -if ($intr = $misc_handler->getObjects(new Criteria('misc_category', 'sticky'))) { +if ($intr = $miscHandler->getObjects(new Criteria('misc_category', 'sticky'))) { $sticky = $intr[0]; unset($intr); } else { - $sticky = $misc_handler->create(); + $sticky = $miscHandler->create(); } switch ($op) { default: @@ -90,7 +90,7 @@ 'link' => isset($_POST['link']) ? trim($_POST['link']) : '' ]; $sticky->setVar('misc_setting', $setting, true); - if (false == $misc_handler->insert($sticky)) { + if (false === $miscHandler->insert($sticky)) { echo $sticky->getHtmlErrors(); } else { redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index 00b8414d..60a7ee4f 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -41,7 +41,7 @@ switch ($op) { default: $ret = ''; - if ($plugins =& $plugins_handler->getObjects(null, 'sublist')) { + if ($plugins =& $pluginsHandler->getObjects(null, 'sublist')) { $ret .= "
\n\n" . "\n" . "\n\n" @@ -51,8 +51,8 @@ . "\n"; foreach ($plugins as $p) { $id = $p->getVar('rssf_conf_id'); - if (!$handler =& $plugins_handler->checkPlugin($p)) { - $plugins_handler->forceDeactivate($p); + if (!$handler =& $pluginsHandler->checkPlugin($p)) { + $pluginsHandler->forceDeactivate($p); $mod = implode('
', $p->getErrors()); $activate = new XoopsFormCheckbox('', 'activate[' . $id . ']', 0); $activate->setExtra('disabled="disabled"'); @@ -90,12 +90,12 @@ case 'save': $activate = Request::getArray('activate', null, 'POST'); - if ($plugins = $plugins_handler->getObjects(null, 'sublist')) { - $plugins_handler->modifyObjects(null, ['subfeed' => 0]); + if ($plugins = $pluginsHandler->getObjects(null, 'sublist')) { + $pluginsHandler->modifyObjects(null, ['subfeed' => 0]); if (isset($activate) && is_array($activate) && count($activate) > 0) { $keys = array_keys($activate); $criteria = new Criteria('rssf_conf_id', '(' . implode(',', $keys) . ')', 'IN'); - $plugins_handler->modifyObjects($criteria, ['subfeed' => 1]); + $pluginsHandler->modifyObjects($criteria, ['subfeed' => 1]); } redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); } else { @@ -105,9 +105,9 @@ case 'edit': $id = isset($_GET['feed']) ? (int)$_GET['feed'] : 0; if (!empty($id)) { - $sub =& $plugins_handler->get($id); - if (!$handler =& $plugins_handler->checkPlugin($sub)) { - $plugins_handler->forceDeactivate($sub); + $sub =& $pluginsHandler->get($id); + if (!$handler =& $pluginsHandler->checkPlugin($sub)) { + $pluginsHandler->forceDeactivate($sub); } } if (empty($id) || !$sub) { @@ -136,9 +136,9 @@ case 'savefeed': $id = Request::getInt('feed', 0, 'POST'); if (!empty($id)) { - $sub = $plugins_handler->get($id); - if (!$handler = $plugins_handler->checkPlugin($sub)) { - $plugins_handler->forceDeactivate($sub); + $sub = $pluginsHandler->get($id); + if (!$handler = $pluginsHandler->checkPlugin($sub)) { + $pluginsHandler->forceDeactivate($sub); } } if (empty($id) || !$sub || !$handler) { @@ -162,7 +162,7 @@ $sub->setVar('img_url', $img_url); $sub->setVar('img_link', $img_link); $sub->setVar('img_title', $img_title); - if (false != $plugins_handler->insert($sub)) { + if (false !== $pluginsHandler->insert($sub)) { redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); } else { echo $sub->getHtmlErrors(); diff --git a/admin/index.php b/admin/index.php index 4901a355..63b9ef9b 100644 --- a/admin/index.php +++ b/admin/index.php @@ -9,7 +9,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -use Xmf\Module\Admin; use Xmf\Request; /** @@ -22,7 +21,7 @@ include_once __DIR__ . '/admin_header.php'; -$moduleAdmin = Admin::getInstance(); +$moduleAdmin = \Xmf\Module\Admin::getInstance(); $do = Request::getString('do', ''); $op = Request::getString('op', 'list'); @@ -45,4 +44,4 @@ $moduleAdmin->displayIndex(); } -include_once 'admin_footer.php'; +include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/menu.php b/admin/menu.php index 8fa396f0..fd576290 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -16,7 +16,7 @@ * @since * @author XOOPS Development Team */ -defined('XOOPS_ROOT_PATH') or die('XOOPS root path not defined'); +defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); // get path to icons $pathIcon32=''; diff --git a/class/misc.php b/class/misc.php index 5bb34498..cb0a9639 100644 --- a/class/misc.php +++ b/class/misc.php @@ -183,7 +183,7 @@ public function insert(XoopsObject $obj) //, $force = false) $sql = substr($sql, 0, -1); $sql .= ' WHERE '.$this->obj_key.' = '.$obj->getVar($this->obj_key); } - if (false != $force) { + if (false !== $force) { $result = $this->db->queryF($sql); } else { $result = $this->db->query($sql); @@ -192,7 +192,7 @@ public function insert(XoopsObject $obj) //, $force = false) $obj->setErrors('Could not store data in the database.
'.$this->db->error().' ('.$this->db->errno().')
'.$sql); return false; } - if (false == $obj->getVar($this->obj_key)) { + if (false === $obj->getVar($this->obj_key)) { $obj->assignVar($this->obj_key, $this->db->getInsertId()); } return $obj->getVar($this->obj_key); @@ -213,7 +213,7 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { $sql .= ' '.$criteria->renderWhere(); } - if (false != $force) { + if (false !== $force) { $result = $this->db->queryF($sql); } else { $result = $this->db->query($sql); @@ -232,7 +232,7 @@ public function delete(XoopsObject $obj) // , $force=false) return false; } $sql = 'DELETE FROM '.$this->db_table.' WHERE '.$this->obj_key.'='.$obj->getVar($this->obj_key); - if (false != $force) { + if (false !== $force) { $result = $this->db->queryF($sql); } else { $result = $this->db->query($sql); diff --git a/class/plugins.php b/class/plugins.php index e5e603f3..a7799907 100644 --- a/class/plugins.php +++ b/class/plugins.php @@ -130,7 +130,7 @@ public function insert(XoopsObject $obj) //, $force=false) $sql = substr($sql, 0, -1); $sql .= ' WHERE '.$this->obj_key.' = '.$obj->getVar($this->obj_key); } - if (false != $force) { + if (false !== $force) { $result = $this->db->queryF($sql); } else { $result = $this->db->query($sql); @@ -139,7 +139,7 @@ public function insert(XoopsObject $obj) //, $force=false) $obj->setErrors('Could not store data in the database.
'.$this->db->error().' ('.$this->db->errno().')
'.$sql); return false; } - if (false == $obj->getVar($this->obj_key)) { + if (false === $obj->getVar($this->obj_key)) { $obj->assignVar($this->obj_key, $this->db->getInsertId()); } return $obj->getVar($this->obj_key); @@ -152,7 +152,7 @@ public function delete(XoopsObject $obj) //, $force = false) return false; } $sql = 'DELETE FROM '.$this->db_table.' WHERE '.$this->obj_key.'='.$obj->getVar($this->obj_key); - if (false != $force) { + if (false !== $force) { $result = $this->db->queryF($sql); } else { $result = $this->db->query($sql); @@ -225,7 +225,7 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { $sql .= ' '.$criteria->renderWhere(); } - if (false != $force) { + if (false !== $force) { $result = $this->db->queryF($sql); } else { $result = $this->db->query($sql); diff --git a/class/rssfeed.php b/class/rssfeed.php index 8c23bcc9..0ce68284 100644 --- a/class/rssfeed.php +++ b/class/rssfeed.php @@ -41,7 +41,7 @@ class RssfeedHandler public $pHandler; public $mHandler; public $channelreq; - public $sub_handler; + public $subHandler; public $plugin_obj; public $myts; public $modConfig; @@ -103,7 +103,7 @@ public function getChannel(&$feed) } } if (!empty($feed['plugin'])) { - if (is_object($this->plugin_obj) && is_object($this->sub_handler)) { + if (is_object($this->plugin_obj) && is_object($this->subHandler)) { $channel['title'] = $this->plugin_obj->getVar('sub_title', 'n'); $channel['link'] = $this->plugin_obj->getVar('sub_link', 'n'); $channel['description'] = $this->plugin_obj->getVar('sub_desc', 'n'); @@ -170,9 +170,9 @@ public function getItems(&$feed) $entries = []; if (!empty($feed['plugin'])) { $this->plugin_obj->setVar('rssf_grab', $this->plugin_obj->getVar('sub_entries')); - $this->sub_handler->grab = $this->plugin_obj->getVar('sub_entries'); - $grab =& $this->sub_handler->grabEntries($this->plugin_obj); - if (false != $grab && count($grab) > 0) { + $this->subHandler->grab = $this->plugin_obj->getVar('sub_entries'); + $grab =& $this->subHandler->grabEntries($this->plugin_obj); + if (false !== $grab && count($grab) > 0) { foreach ($grab as $g) { array_push($entries, $g); } @@ -182,7 +182,7 @@ public function getItems(&$feed) if ($handler =& $this->pHandler->checkPlugin($p)) { $handler->grab = $p->getVar('rssf_grab'); $grab =& $handler->grabEntries($p); - if (false != $grab && count($grab) > 0) { + if (false !== $grab && count($grab) > 0) { foreach ($grab as $g) { array_push($entries, $g); } @@ -219,15 +219,15 @@ public function doSubstr($text) $len = function_exists('mb_strlen') ? mb_strlen($ret, $this->charset) : strlen($ret); if ($len > $this->modConfig['max_char'] && $this->modConfig['max_char'] > 0) { $ret = $this->substrDetect($ret, 0, $this->modConfig['max_char']-1); - if (false == $this->strrposDetect($ret, ' ')) { - if (false != $this->strrposDetect($text, ' ')) { + if (false === $this->strrposDetect($ret, ' ')) { + if (false !== $this->strrposDetect($text, ' ')) { $ret = $this->substrDetect($text, 0, strpos($text, ' ')); } } if (in_array($this->substrDetect($text, $this->modConfig['max_char']-1, 1), $this->substr_add)) { $ret .= $this->substrDetect($text, $this->modConfig['max_char']-1, 1); } else { - if (false != $this->strrposDetect($ret, ' ')) { + if (false !== $this->strrposDetect($ret, ' ')) { $ret = $this->substrDetect($ret, 0, $this->strrposDetect($ret, ' ')); } if (in_array($this->substrDetect($ret, -1, 1), $this->substr_remove)) { @@ -356,7 +356,7 @@ public function checkSubFeed(&$feed) } if ($handler) { $this->plugin_obj = $sub[0]; - $this->sub_handler = $handler; + $this->subHandler = $handler; $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' . md5(str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); } else { diff --git a/header.php b/header.php index da5a1b64..70b19ee8 100644 --- a/header.php +++ b/header.php @@ -28,5 +28,5 @@ ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## ############################################################################### -require '../../mainfile.php'; -require 'include/common.php'; +require __DIR__ . '/../../mainfile.php'; +require __DIR__ . '/include/common.php'; diff --git a/include/common.php b/include/common.php index fb4f0990..9c75306f 100644 --- a/include/common.php +++ b/include/common.php @@ -49,5 +49,5 @@ $rss = new RssfeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); $myts = $rss->myts; -$plugins_handler =& $rss->pHandler; -$misc_handler =& $rss->mHandler; +$pluginsHandler =& $rss->pHandler; +$miscHandler =& $rss->mHandler; diff --git a/include/install.php b/include/install.php index 95913230..08a4b48d 100644 --- a/include/install.php +++ b/include/install.php @@ -54,7 +54,7 @@ function xoops_module_install_rss(XoopsModule $xoopsMod) . $xoopsDB->prefix('rssfit_misc') . ' VALUES ' . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' =>0, 'dobr' =>0, 'feeds' => [0 =>'0'], 'link' =>XOOPS_URL])) . ')'; foreach ($sql as $s) { - if (false == $xoopsDB->query($s)) { + if (false === $xoopsDB->query($s)) { echo ''.$xoopsDB->error().'
'.$s.'

'; return false; } @@ -88,7 +88,7 @@ function xoops_module_update_rss(XoopsModule $xoopsMod, $oldversion) . $xoopsDB->prefix('rssfit_misc') . ' VALUES ' . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' =>0, 'dobr' =>0, 'feeds' => [0 =>'0'], 'link' =>XOOPS_URL])) . ')'; foreach ($sql as $s) { - if (false == $xoopsDB->query($s)) { + if (false === $xoopsDB->query($s)) { echo ''.$xoopsDB->error().'
'.$s.'

'; return false; } diff --git a/index.php b/index.php index d19dec8d..ed21a627 100644 --- a/index.php +++ b/index.php @@ -32,10 +32,10 @@ ## Project: RSSFit ## ############################################################################### -require 'header.php'; -$xoopsOption['template_main'] = 'rssfit_index.tpl'; +require __DIR__ . '/header.php'; +$GLOBALS['xoopsOption']['template_main'] = 'rssfit_index.tpl'; require XOOPS_ROOT_PATH.'/header.php'; -if ($intr = $misc_handler->getObjects(new Criteria('misc_category', 'intro'))) { +if ($intr = $miscHandler->getObjects(new Criteria('misc_category', 'intro'))) { $intro =& $intr[0]; $setting = $intro->getVar('misc_setting'); $intro->setDoHtml($setting['dohtml'] ? 1 : 0); @@ -43,7 +43,7 @@ $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); $content = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_content')); $content = str_replace('{SITEURL}', XOOPS_URL.'/', $content); - if (false !== strpos($content, '{SUB}') && $plugins = $plugins_handler->getObjects(new Criteria('subfeed', 1))) { + if (false !== strpos($content, '{SUB}') && $plugins = $pluginsHandler->getObjects(new Criteria('subfeed', 1))) { $sublist = ''; foreach ($plugins as $p) { $sub = $myts->stripSlashesGPC($setting['sub']); diff --git a/plugins/rssfit.buyersguide.php b/plugins/rssfit.buyersguide.php index d148af35..62ec2a94 100644 --- a/plugins/rssfit.buyersguide.php +++ b/plugins/rssfit.buyersguide.php @@ -69,7 +69,7 @@ public function &grabEntries(&$obj) $items = $hBgProduct->getRecentProducts(0, 0, $this->grab); $i = 0; - if (false != $items && count($items) > 0) { + if (false !== $items && count($items) > 0) { foreach ($items as $item) { $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); $ret[$i]['title'] = $item->getVar('prod_title', 'n'); diff --git a/plugins/rssfit.buyersguidemanufacturers.php b/plugins/rssfit.buyersguidemanufacturers.php index 36848957..beffda77 100644 --- a/plugins/rssfit.buyersguidemanufacturers.php +++ b/plugins/rssfit.buyersguidemanufacturers.php @@ -69,7 +69,7 @@ public function &grabEntries(&$obj) $items = $hBgManufacturer->getListofActivteManufacturers(0, $this->grab, 'manu_date_added', 'DESC'); $i = 0; - if (false != $items && count($items) > 0) { + if (false !== $items && count($items) > 0) { foreach ($items as $item) { $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); $ret[$i]['title'] = $item->getVar('manu_name', 'n'); diff --git a/plugins/rssfit.buyersguidenews.php b/plugins/rssfit.buyersguidenews.php index b76798ad..4c425106 100644 --- a/plugins/rssfit.buyersguidenews.php +++ b/plugins/rssfit.buyersguidenews.php @@ -69,7 +69,7 @@ public function &grabEntries(&$obj) $items = $hBgNews->getRecentNews(0, $this->grab); $i = 0; - if (false != $items && count($items) > 0) { + if (false !== $items && count($items) > 0) { foreach ($items as $item) { $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); $ret[$i]['title'] = $item->getVar('news_title', 'n'); diff --git a/plugins/rssfit.cbb.php b/plugins/rssfit.cbb.php index d6f3c3e3..4e6ffee4 100644 --- a/plugins/rssfit.cbb.php +++ b/plugins/rssfit.cbb.php @@ -65,14 +65,14 @@ public function &grabEntries(&$obj) $xoopsModule = $this->module; $myts = MyTextSanitizer::getInstance(); $i = 0; - $forum_handler = xoops_getModuleHandler('forum', 'newbb'); - $topic_handler = xoops_getModuleHandler('topic', 'newbb'); + $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + $topicHandler = xoops_getModuleHandler('topic', 'newbb'); $newbbConfig = $GLOBALS['config_handler']->getConfigsByCat(0, $this->module->getVar('mid')); - $access_forums = $forum_handler->getForums(0, 'access'); + $access_forums = $forumHandler->getForums(0, 'access'); $available_forums = []; foreach ($access_forums as $forum) { - if ($topic_handler->getPermission($forum)) { + if ($topicHandler->getPermission($forum)) { $available_forums[$forum->getVar('forum_id')] = $forum; } } diff --git a/plugins/rssfit.comments.php b/plugins/rssfit.comments.php index 3d8ab270..557f1b6d 100644 --- a/plugins/rssfit.comments.php +++ b/plugins/rssfit.comments.php @@ -60,12 +60,12 @@ public function &grabEntries(&$obj) { $ret = false; include_once XOOPS_ROOT_PATH.'/include/comment_constants.php'; - $comment_handler = xoops_getHandler('comment'); + $commentHandler = xoops_getHandler('comment'); $criteria = new CriteriaCompo(new Criteria('com_status', XOOPS_COMMENT_ACTIVE)); $criteria->setLimit($this->grab); $criteria->setSort('com_created'); $criteria->setOrder('DESC'); - $comments = $comment_handler->getObjects($criteria, true); + $comments = $commentHandler->getObjects($criteria, true); $comment_config = []; if (count($comments) > 0) { $modules = $GLOBALS['module_handler']->getObjects(new Criteria('hascomments', 1), true); diff --git a/plugins/rssfit.extcal.php b/plugins/rssfit.extcal.php index 1324f3dd..8cbb3f71 100644 --- a/plugins/rssfit.extcal.php +++ b/plugins/rssfit.extcal.php @@ -86,8 +86,8 @@ public function &grabEntries(&$obj) // read confgs to get timestamp format $extcal = $this->module; - $config_handler = &xoops_getHandler('config'); - $extcalConfig = &$config_handler->getConfigsByCat(0, $extcal->getVar('mid')); + $configHandler = xoops_getHandler('config'); + $extcalConfig = &$configHandler->getConfigsByCat(0, $extcal->getVar('mid')); $long_form=$extcalConfig['date_long']; $eventHandler = xoops_getModuleHandler('event', 'extcal'); diff --git a/plugins/rssfit.lexikon.php b/plugins/rssfit.lexikon.php index 1f4f9623..65e4f3ae 100644 --- a/plugins/rssfit.lexikon.php +++ b/plugins/rssfit.lexikon.php @@ -67,7 +67,7 @@ public function &grabEntries(&$obj) { global $xoopsDB; $myts = MyTextSanitizer::getInstance(); - //$perm_handler = xoops_gethandler('groupperm'); + //$perm_handler = xoops_getHandler('groupperm'); $ret = false; $i = 0; $sql = 'SELECT entryID, categoryID, term, definition, datesub FROM ' diff --git a/plugins/rssfit.myalbum.php b/plugins/rssfit.myalbum.php index 85f10bb0..f90c7506 100644 --- a/plugins/rssfit.myalbum.php +++ b/plugins/rssfit.myalbum.php @@ -87,8 +87,8 @@ public function myGetUnameFromId($uid) } if (!is_object($thisUser)) { - $member_handler = xoops_getHandler('member'); - $thisUser = $member_handler->getUser($uid); + $memberHandler = xoops_getHandler('member'); + $thisUser = $memberHandler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name')); if ('' == $name) { diff --git a/plugins/rssfit.newbb2.php b/plugins/rssfit.newbb2.php index 514177df..6c902263 100644 --- a/plugins/rssfit.newbb2.php +++ b/plugins/rssfit.newbb2.php @@ -73,8 +73,8 @@ public function myGetUnameFromId($uid) } if (!is_object($thisUser)) { - $member_handler = xoops_getHandler('member'); - $thisUser = $member_handler->getUser($uid); + $memberHandler = xoops_getHandler('member'); + $thisUser = $memberHandler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name')); if ('' == $name) { @@ -93,14 +93,14 @@ public function &grabEntries(&$obj) $myts = MyTextSanitizer::getInstance(); $ret = false; $i = 0; - $forum_handler = xoops_getModuleHandler('forum', 'newbb'); - $topic_handler = xoops_getModuleHandler('topic', 'newbb'); + $forumHandler = xoops_getModuleHandler('forum', 'newbb'); + $topicHandler = xoops_getModuleHandler('topic', 'newbb'); $newbbConfig = $config_handler->getConfigsByCat(0, $this->module->getVar('mid')); - $access_forums = $forum_handler->getForums(0, 'access'); + $access_forums = $forumHandler->getForums(0, 'access'); $available_forums = []; foreach ($access_forums as $forum) { - if ($topic_handler->getPermission($forum)) { + if ($topicHandler->getPermission($forum)) { $available_forums[$forum->getVar('forum_id')] = $forum; } } diff --git a/plugins/rssfit.oledrion.php b/plugins/rssfit.oledrion.php index ce56424c..8043fc67 100644 --- a/plugins/rssfit.oledrion.php +++ b/plugins/rssfit.oledrion.php @@ -49,7 +49,7 @@ public function &grabEntries(&$obj) $items = $h_oledrion_products->getRecentProducts(new Oledrion_parameters(['start' => 0, 'limit' => $this->grab])); $i = 0; - if (false != $items && count($items) > 0) { + if (false !== $items && count($items) > 0) { foreach ($items as $item) { $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); $ret[$i]['title'] = $item->getVar('product_title', 'n'); diff --git a/plugins/rssfit.smartfaq.php b/plugins/rssfit.smartfaq.php index 4985bf1b..02b408f8 100644 --- a/plugins/rssfit.smartfaq.php +++ b/plugins/rssfit.smartfaq.php @@ -60,12 +60,12 @@ public function &grabEntries(&$obj) { $ret = false; @include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; - $faq_handler = sf_gethandler('faq'); - $faqs = $faq_handler->getAllPublished($this->grab, 0); - if (false != $faqs && count($faqs) > 0) { - $answer_handler = sf_gethandler('answer'); + $faqHandler = sf_gethandler('faq'); + $faqs = $faqHandler->getAllPublished($this->grab, 0); + if (false !== $faqs && count($faqs) > 0) { + $answerHandler = sf_gethandler('answer'); for ($i=0, $iMax = count($faqs); $i < $iMax; $i++) { - if (!$answer = $answer_handler->getOfficialAnswer($faqs[$i]->faqid())) { + if (!$answer = $answerHandler->getOfficialAnswer($faqs[$i]->faqid())) { continue; } $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL.'/modules/smartfaq/faq.php?faqid='.$faqs[$i]->faqid(); diff --git a/plugins/rssfit.smartpartner.php b/plugins/rssfit.smartpartner.php index 8610fa98..1179145f 100644 --- a/plugins/rssfit.smartpartner.php +++ b/plugins/rssfit.smartpartner.php @@ -62,7 +62,7 @@ public function &grabEntries(&$obj) $ret = false; include XOOPS_ROOT_PATH . '/modules/smartpartner/include/common.php'; $partners = $partner_handler->getPartners($this->grab, 0, _SPARTNER_STATUS_ACTIVE, 'weight', 'DESC'); - if (false != $partners && count($partners) > 0) { + if (false !== $partners && count($partners) > 0) { for ($i=0, $iMax = count($partners); $i < $iMax; $i++) { $ret[$i]['link'] = $ret[$i]['guid'] = SMARTPARTNER_URL.'partner.php?id='.$partners[$i]->getVar('id'); $ret[$i]['title'] = $partners[$i]->getVar('title', 'n'); diff --git a/plugins/rssfit.smartsection.php b/plugins/rssfit.smartsection.php index 8ea9a06c..15ea5a7a 100644 --- a/plugins/rssfit.smartsection.php +++ b/plugins/rssfit.smartsection.php @@ -61,7 +61,7 @@ public function &grabEntries(&$obj) $ret = false; include XOOPS_ROOT_PATH . '/modules/smartsection/include/common.php'; $items = $smartsection_item_handler->getAllPublished($this->grab, 0); - if (false != $items && count($items) > 0) { + if (false !== $items && count($items) > 0) { for ($i=0, $iMax = count($items); $i < $iMax; $i++) { $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); diff --git a/plugins/rssfit.surnames.php b/plugins/rssfit.surnames.php index 5ef31acf..a3e1df37 100644 --- a/plugins/rssfit.surnames.php +++ b/plugins/rssfit.surnames.php @@ -72,8 +72,8 @@ public function myGetUnameFromId($uid) } if (!is_object($thisUser)) { - $member_handler = xoops_getHandler('member'); - $thisUser = $member_handler->getUser($uid); + $memberHandler = xoops_getHandler('member'); + $thisUser = $memberHandler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name')); if ('' == $name) { diff --git a/plugins/rssfit.weblinks.php b/plugins/rssfit.weblinks.php index 32245098..dd345f34 100644 --- a/plugins/rssfit.weblinks.php +++ b/plugins/rssfit.weblinks.php @@ -67,8 +67,8 @@ public function myGetUnameFromId($uid) } if (!is_object($thisUser)) { - $member_handler = xoops_getHandler('member'); - $thisUser = $member_handler->getUser($uid); + $memberHandler = xoops_getHandler('member'); + $thisUser = $memberHandler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name')); if ('' == $name) { diff --git a/plugins/rssfit.wfdownloads.php b/plugins/rssfit.wfdownloads.php index 736e4c88..864292f5 100644 --- a/plugins/rssfit.wfdownloads.php +++ b/plugins/rssfit.wfdownloads.php @@ -62,14 +62,14 @@ public function &grabEntries(&$obj) { global $xoopsDB; $myts = MyTextSanitizer::getInstance(); - $perm_handler = xoops_getHandler('groupperm'); + $permHandler = xoops_getHandler('groupperm'); $ret = false; $i = 0; $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - if ($perm_handler->checkRight('WFDownFilePerm', $row['lid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { + if ($permHandler->checkRight('WFDownFilePerm', $row['lid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { $ret[$i]['title'] = $row['title']; $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlefile.php?cid='.$row['cid'].'&lid='.$row['lid']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; diff --git a/plugins/rssfit.wfdownloads_podcast.php b/plugins/rssfit.wfdownloads_podcast.php index d8e4f0e6..f24ed475 100644 --- a/plugins/rssfit.wfdownloads_podcast.php +++ b/plugins/rssfit.wfdownloads_podcast.php @@ -62,7 +62,7 @@ public function &grabEntries(&$obj) { global $xoopsDB; $myts = MyTextSanitizer::getInstance(); - $perm_handler = xoops_getHandler('groupperm'); + $permHandler = xoops_getHandler('groupperm'); $ret = false; $i = 0; $sql = 'SELECT lid, cid, title, date, description, filetype, size FROM ' @@ -71,7 +71,7 @@ public function &grabEntries(&$obj) . time() . ' ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - if ((isset($perms[$row['cid']]) && true == $perms[$row['cid']]) || $perm_handler->checkRight('WFDownCatPerm', $row['cid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { + if ((isset($perms[$row['cid']]) && true === $perms[$row['cid']]) || $permHandler->checkRight('WFDownCatPerm', $row['cid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { $perms[$row['cid']] = true; $ret[$i]['title'] = $row['title']; $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlefile.php?cid='.$row['cid'].'&lid='.$row['lid']; diff --git a/plugins/rssfit.wflinks.php b/plugins/rssfit.wflinks.php index 8242961c..c0648a0f 100644 --- a/plugins/rssfit.wflinks.php +++ b/plugins/rssfit.wflinks.php @@ -44,7 +44,7 @@ public function grabEntries(&$obj) global $xoopsDB, $xoopsUser; $groups = is_object($xoopsUser) ? $xoopsUser -> getGroups() : XOOPS_GROUP_ANONYMOUS; - $gperm_handler = &xoops_getHandler('groupperm'); + $gpermHandler = xoops_getHandler('groupperm'); $myts = MyTextSanitizer::getInstance(); $ret = []; @@ -52,7 +52,7 @@ public function grabEntries(&$obj) $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - if ($gperm_handler -> checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { + if ($gpermHandler -> checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { // required $ret[$i]['title'] = $row['title']; $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?cid='.$row['cid'].'&lid='.$row['lid']; diff --git a/rss.php b/rss.php index b60e0cc5..3fd0fe8d 100644 --- a/rss.php +++ b/rss.php @@ -34,7 +34,7 @@ if (function_exists('mb_http_output')) { mb_http_output('pass'); } -require 'header.php'; +require __DIR__ . '/header.php'; $charset = $xoopsModuleConfig['utf8'] ? 'UTF-8' : _CHARSET; $docache = $xoopsModuleConfig['cache'] ? true : false; $template = 'db:rssfit_rss.tpl'; From 393fb5e86103f8bde186c0eee324e5b8b99fc9e0 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 27 Oct 2017 09:58:10 -0400 Subject: [PATCH 017/154] no message --- admin/do_plugins.php | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 0d61307c..63752c7a 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -53,11 +53,7 @@ . "
\n" . "\n"; foreach ($plugins as $p) { -<<<<<<< HEAD if ($handler = $pluginsHandler->checkPlugin($p)) { -======= - if ($handler = $plugins_handler->checkPlugin($p)) { ->>>>>>> c9e02ecfe26ae2f5fb83a1aabd25b97eae5f246d $id = $p->getVar('rssf_conf_id'); $entries = new XoopsFormText('', 'rssf_grab[' . $id . ']', 3, 2, $p->getVar('rssf_grab')); $order = new XoopsFormText('', 'rssf_order[' . $id . ']', 3, 2, $p->getVar('rssf_order')); @@ -100,11 +96,7 @@ . "\n" . "\n" From 32657b8d7450c1edc04a7a6e445d2fd0d3ad1fc0 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 27 Oct 2017 12:04:13 -0400 Subject: [PATCH 022/154] move /images --- {images => assets/images}/icons/32/plugin.png | Bin assets/images/index.html | 2 +- {images => assets/images}/rss.gif | Bin {images => assets/images}/rssfeed.png | Bin {images => assets/images}/xml.gif | Bin images/icons/16/index.html | 1 - images/icons/32/index.html | 1 - images/icons/index.html | 1 - images/index.html | 1 - 9 files changed, 1 insertion(+), 5 deletions(-) rename {images => assets/images}/icons/32/plugin.png (100%) rename {images => assets/images}/rss.gif (100%) rename {images => assets/images}/rssfeed.png (100%) rename {images => assets/images}/xml.gif (100%) delete mode 100644 images/icons/16/index.html delete mode 100644 images/icons/32/index.html delete mode 100644 images/icons/index.html delete mode 100644 images/index.html diff --git a/images/icons/32/plugin.png b/assets/images/icons/32/plugin.png similarity index 100% rename from images/icons/32/plugin.png rename to assets/images/icons/32/plugin.png diff --git a/assets/images/index.html b/assets/images/index.html index 74b6f45c..990cbd60 100644 --- a/assets/images/index.html +++ b/assets/images/index.html @@ -1 +1 @@ - \ No newline at end of file + \ No newline at end of file diff --git a/images/rss.gif b/assets/images/rss.gif similarity index 100% rename from images/rss.gif rename to assets/images/rss.gif diff --git a/images/rssfeed.png b/assets/images/rssfeed.png similarity index 100% rename from images/rssfeed.png rename to assets/images/rssfeed.png diff --git a/images/xml.gif b/assets/images/xml.gif similarity index 100% rename from images/xml.gif rename to assets/images/xml.gif diff --git a/images/icons/16/index.html b/images/icons/16/index.html deleted file mode 100644 index 990cbd60..00000000 --- a/images/icons/16/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/32/index.html b/images/icons/32/index.html deleted file mode 100644 index 990cbd60..00000000 --- a/images/icons/32/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/icons/index.html b/images/icons/index.html deleted file mode 100644 index 990cbd60..00000000 --- a/images/icons/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/images/index.html b/images/index.html deleted file mode 100644 index 990cbd60..00000000 --- a/images/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From 29133b81f92a4105c72124f399ef22e64e5e1eea Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 27 Oct 2017 12:09:19 -0400 Subject: [PATCH 023/154] xoops_version.php --- assets/images/{rssfeed.png => logoModule.png} | Bin xoops_version.php | 239 +++++++++++------- 2 files changed, 143 insertions(+), 96 deletions(-) rename assets/images/{rssfeed.png => logoModule.png} (100%) diff --git a/assets/images/rssfeed.png b/assets/images/logoModule.png similarity index 100% rename from assets/images/rssfeed.png rename to assets/images/logoModule.png diff --git a/xoops_version.php b/xoops_version.php index 8ddf67b4..123561cc 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -28,52 +28,82 @@ ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## ############################################################################### -if (!defined('XOOPS_ROOT_PATH')) { - die('XOOPS root path not defined'); -} - -$modversion['version'] = '1.30'; -$modversion['module_status'] = 'Beta 3'; -$modversion['release_date'] = '2017/10/24'; -$modversion['name'] = _MI_RSSFIT_NAME; -$modversion['description'] = _MI_RSSFIT_DESC; -$modversion['author'] = 'NS Tai (aka tuff)'; -$modversion['credits'] = "Brandycoke Productions"; -$modversion['help'] = 'page=help'; -$modversion['license'] = 'GNU GPL 2.0 or later'; -$modversion['license_url'] = 'https://www.gnu.org/licenses/gpl-2.0.html'; -$modversion['official'] = 0; -//$modversion['modicons16'] = 'assets/images/icons/16'; -//$modversion['modicons32'] = 'assets/images/icons/32'; -$modversion['image'] = 'images/rssfeed.png'; -$modversion['dirname'] = basename(__DIR__); -$modversion['module_website_url'] = 'https://xoops.org'; -$modversion['module_website_name'] = 'XOOPS'; -$modversion['min_php'] = '5.5'; -$modversion['min_xoops'] = '2.5.9'; -$modversion['min_db'] = ['mysql' => '5.5']; - -// Sql file (must contain sql generated by phpMyAdmin or phpPgAdmin) -// All tables should not have any prefix! -$modversion['sqlfile']['mysql'] = 'sql/mysql.sql'; -//$modversion['sqlfile']['postgresql'] = "sql/pgsql.sql"; - -// Tables created by sql file (without prefix!) -$modversion['tables'][0] = 'rssfit_plugins'; -$modversion['tables'][1] = 'rssfit_misc'; - -// Admin things -$modversion['hasAdmin'] = 1; -$modversion['system_menu'] = 1; -$modversion['adminindex'] = 'admin/index.php'; -$modversion['adminmenu'] = 'admin/menu.php'; - -// Script to run on install/unstall/update -$modversion['onInstall'] = 'include/install.php'; -$modversion['onUpdate'] = 'include/install.php'; - -// Menu -- content in main menu block -$modversion['hasMain'] = 1; +defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); + +$moduleDirName = basename(__DIR__); + +// ------------------- Informations ------------------- // +$modversion = [ + 'version' => 1.30, + 'module_status' => 'Beta 3', + 'release_date' => '2017/10/27', + 'name' => _MI_RSSFIT_NAME, + 'description' => _MI_RSSFIT_DESC, + 'official' => 0, + //1 indicates official XOOPS module supported by XOOPS Dev Team, 0 means 3rd party supported + 'author' => 'NS Tai (aka tuff)', + 'credits' => 'XOOPS Development Team, Brandycoke Productions', + 'author_mail' => 'author-email', + 'author_website_url' => 'https://xoops.org', + 'author_website_name' => 'XOOPS', + 'license' => 'GPL 2.0 or later', + 'license_url' => 'www.gnu.org/licenses/gpl-2.0.html/', + 'help' => 'page=help', + // ------------------- Folders & Files ------------------- + 'release_info' => 'Changelog', + 'release_file' => XOOPS_URL . "/modules/$moduleDirName/docs/changelog.txt", + // + 'manual' => 'link to manual file', + 'manual_file' => XOOPS_URL . "/modules/$moduleDirName/docs/install.txt", + // images + 'image' => 'assets/images/logoModule.png', + 'iconsmall' => 'assets/images/iconsmall.png', + 'iconbig' => 'assets/images/iconbig.png', + 'dirname' => $moduleDirName, + // Local path icons + 'modicons16' => 'assets/images/icons/16', + 'modicons32' => 'assets/images/icons/32', + //About + 'demo_site_url' => 'https://xoops.org', + 'demo_site_name' => 'XOOPS Demo Site', + 'support_url' => 'https://xoops.org/modules/newbb/viewforum.php?forum=28/', + 'support_name' => 'Support Forum', + 'submit_bug' => 'https://github.com/XoopsModules25x/' . $moduleDirName . '/issues', + 'module_website_url' => 'www.xoops.org', + 'module_website_name' => 'XOOPS Project', + // ------------------- Min Requirements ------------------- + 'min_php' => '5.5', + 'min_xoops' => '2.5.9', + 'min_admin' => '1.2', + 'min_db' => ['mysql' => '5.5'], + // ------------------- Admin Menu ------------------- + 'system_menu' => 1, + 'hasAdmin' => 1, + 'adminindex' => 'admin/index.php', + 'adminmenu' => 'admin/menu.php', + // ------------------- Main Menu ------------------- + 'hasMain' => 1, + // ------------------- Install/Update ------------------- + 'onInstall' => 'include/install.php', + 'onUpdate' => 'include/install.php', + // 'onUninstall' => 'include/onuninstall.php', + // ------------------- PayPal --------------------------- + 'paypal' => [ + 'business' => 'foundation@xoops.org', + 'item_name' => 'Donation : ' . _MI_XXXXX_NAME, + 'amount' => 0, + 'currency_code' => 'USD' + ], + // ------------------- Mysql ----------------------------- + 'sqlfile' => ['mysql' => 'sql/mysql.sql'], + // ------------------- Tables ---------------------------- + 'tables' => [ + // $moduleDirName . '_' . 'XXX', + // $moduleDirName . '_' . 'XXX', + 'rssfit_plugins', + 'rssfit_misc', + ], +]; // Templates $modversion['templates'] = []; @@ -88,67 +118,84 @@ // Module Configs // $xoopsModuleConfig['overall_entries'] -$modversion['config'][1]['name'] = 'overall_entries'; -$modversion['config'][1]['title'] = '_MI_OVERALL_ENTRIES'; -$modversion['config'][1]['description'] = '_MI_OVERALL_ENTRIES_DESC'; -$modversion['config'][1]['formtype'] = 'textbox'; -$modversion['config'][1]['valuetype'] = 'int'; -$modversion['config'][1]['default'] = 20; + +$modversion['config'][] = [ + 'name' => 'overall_entries', + 'title' => '_MI_OVERALL_ENTRIES', + 'description' => '_MI_OVERALL_ENTRIES_DESC', + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 20, +]; // $xoopsModuleConfig['plugin_entries'] -$modversion['config'][2]['name'] = 'plugin_entries'; -$modversion['config'][2]['title'] = '_MI_PLUGIN_ENTRIES'; -$modversion['config'][2]['description'] = '_MI_PLUGIN_ENTRIES_DESC'; -$modversion['config'][2]['formtype'] = 'textbox'; -$modversion['config'][2]['valuetype'] = 'int'; -$modversion['config'][2]['default'] = 5; +$modversion['config'][] = [ + 'name' => 'plugin_entries', + 'title' => '_MI_PLUGIN_ENTRIES', + 'description' => '_MI_PLUGIN_ENTRIES_DESC', + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 5, +]; // $xoopsModuleConfig['sort'] -$modversion['config'][3]['name'] = 'sort'; -$modversion['config'][3]['title'] = '_MI_ENTRIES_SORT'; -$modversion['config'][3]['description'] = '_MI_ENTRIES_SORT_DESC'; -$modversion['config'][3]['formtype'] = 'select'; -$modversion['config'][3]['valuetype'] = 'text'; -$modversion['config'][3]['default'] = 'd'; -$modversion['config'][3]['options'] = [_MI_ENTRIES_SORT_DATE => 'd', _MI_ENTRIES_SORT_CAT => 'c']; +$modversion['config'][] = [ + 'name' => 'sort', + 'title' => '_MI_ENTRIES_SORT', + 'description' => '_MI_ENTRIES_SORT_DESC', + 'formtype' => 'select', + 'valuetype' => 'text', + 'default' => 'd', + 'options' => [_MI_ENTRIES_SORT_DATE => 'd', _MI_ENTRIES_SORT_CAT => 'c'], +]; // $xoopsModuleConfig['cache'] -$modversion['config'][4]['name'] = 'cache'; -$modversion['config'][4]['title'] = '_MI_CACHE'; -$modversion['config'][4]['description'] = '_MI_CACHE_DESC'; -$modversion['config'][4]['formtype'] = 'textbox'; -$modversion['config'][4]['valuetype'] = 'int'; -$modversion['config'][4]['default'] = 0; +$modversion['config'][] = [ + 'name' => 'cache', + 'title' => '_MI_CACHE', + 'description' => '_MI_CACHE_DESC', + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 0, +]; // $xoopsModuleConfig['max_char'] -$modversion['config'][5]['name'] = 'max_char'; -$modversion['config'][5]['title'] = '_MI_MAXCHAR'; -$modversion['config'][5]['description'] = '_MI_MAXCHAR_DESC'; -$modversion['config'][5]['formtype'] = 'textbox'; -$modversion['config'][5]['valuetype'] = 'int'; -$modversion['config'][5]['default'] = 0; +$modversion['config'][] = [ + 'name' => 'max_char', + 'title' => '_MI_MAXCHAR', + 'description' => '_MI_MAXCHAR_DESC', + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 0, +]; // $xoopsModuleConfig['strip_html'] -$modversion['config'][6]['name'] = 'strip_html'; -$modversion['config'][6]['title'] = '_MI_STRIPHTML'; -$modversion['config'][6]['description'] = '_MI_STRIPHTML_DESC'; -$modversion['config'][6]['formtype'] = 'yesno'; -$modversion['config'][6]['valuetype'] = 'int'; -$modversion['config'][6]['default'] = 0; +$modversion['config'][] = [ + 'name' => 'strip_html', + 'title' => '_MI_STRIPHTML', + 'description' => '_MI_STRIPHTML_DESC', + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 0, +]; // $xoopsModuleConfig['utf8'] -$modversion['config'][7]['name'] = 'utf8'; -$modversion['config'][7]['title'] = '_MI_ENCODE_UTF8'; -$modversion['config'][7]['description'] = '_MI_ENCODE_UTF8_DESC'; -$modversion['config'][7]['formtype'] = 'yesno'; -$modversion['config'][7]['valuetype'] = 'int'; -$modversion['config'][7]['default'] = 0; +$modversion['config'][] = [ + 'name' => 'utf8', + 'title' => '_MI_ENCODE_UTF8', + 'description' => '_MI_ENCODE_UTF8_DESC', + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 0, +]; // $xoopsModuleConfig['mime'] -$modversion['config'][8]['name'] = 'mime'; -$modversion['config'][8]['title'] = '_MI_OUTOUT_MIME'; -$modversion['config'][8]['description'] = ''; -$modversion['config'][8]['formtype'] = 'select'; -$modversion['config'][8]['valuetype'] = 'int'; -$modversion['config'][8]['default'] = 1; -$modversion['config'][8]['options'] = [_MI_OUTOUT_MIME_XML => 1, _MI_OUTOUT_MIME_HTML => 2, _MI_OUTOUT_MIME_PHP => 3]; +$modversion['config'][] = [ + 'name' => 'mime', + 'title' => '_MI_OUTOUT_MIME', + 'description' => '', + 'formtype' => 'select', + 'valuetype' => 'int', + 'default' => 1, + 'options' => [_MI_OUTOUT_MIME_XML => 1, _MI_OUTOUT_MIME_HTML => 2, _MI_OUTOUT_MIME_PHP => 3], +]; From 0d99cd95ba08883e482b19165fc3419b8c5e3548 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 27 Oct 2017 12:10:25 -0400 Subject: [PATCH 024/154] test folders --- testdata/.gitignore | 5 +++++ testdata/index.html | 1 + testdata/index.php | 41 +++++++++++++++++++++++++++++++++++++++++ tests/index.html | 1 + 4 files changed, 48 insertions(+) create mode 100644 testdata/.gitignore create mode 100644 testdata/index.html create mode 100644 testdata/index.php create mode 100644 tests/index.html diff --git a/testdata/.gitignore b/testdata/.gitignore new file mode 100644 index 00000000..85d2647d --- /dev/null +++ b/testdata/.gitignore @@ -0,0 +1,5 @@ +# no backup files, editor temp +*~ +\#* +*.bak +.idea/ diff --git a/testdata/index.html b/testdata/index.html new file mode 100644 index 00000000..74b6f45c --- /dev/null +++ b/testdata/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/testdata/index.php b/testdata/index.php new file mode 100644 index 00000000..0e4d5972 --- /dev/null +++ b/testdata/index.php @@ -0,0 +1,41 @@ +history.go(-1); \ No newline at end of file From ba3d3d4efe335613952f50a76cd75734ce5437c2 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 27 Oct 2017 22:49:26 -0400 Subject: [PATCH 025/154] help update --- admin/menu.php | 2 +- language/english/admin.php | 15 ++ language/english/help/disclaimer.tpl | 48 +++++ language/english/help/help.html | 46 ----- language/english/help/help.tpl | 73 +++++++ language/english/help/helpheader.tpl | 6 + language/english/help/license.tpl | 288 +++++++++++++++++++++++++++ language/english/help/support.tpl | 9 + language/english/install.php | 2 +- language/english/modinfo.php | 14 ++ xoops_version.php | 10 +- 11 files changed, 464 insertions(+), 49 deletions(-) create mode 100644 language/english/help/disclaimer.tpl delete mode 100644 language/english/help/help.html create mode 100644 language/english/help/help.tpl create mode 100644 language/english/help/helpheader.tpl create mode 100644 language/english/help/license.tpl create mode 100644 language/english/help/support.tpl diff --git a/admin/menu.php b/admin/menu.php index 6145e6b0..c316f1b5 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -43,7 +43,7 @@ 'title' => _MI_RSSFIT_ADMENU2, 'link' => 'admin/?do=plugins', //'link' => "admin/do_plugins.php", - 'icon' => 'images/icons/32/plugin.png', + 'icon' => 'assets/images/icons/32/plugin.png', ]; $adminmenu[] = [ diff --git a/language/english/admin.php b/language/english/admin.php index 4ee69131..61927019 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -62,3 +62,18 @@ define('_AM_EDIT_INTRO_TEXT_DESC_SUB', '

{SUB} will print a list of available sub-feeds'); define('_AM_EDIT_INTRO_SUB', 'HTML tags for listing sub-feeds'); define('_AM_EDIT_INTRO_SUB_DESC', "Extra tags:
{URL} (sub-feed's URL)
{TITLE} (sub-feed's title)
{DESC} (sub-feed's description)"); +//1.30 +define('_AM_RSSFIT_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); +define('_AM_RSSFIT_UPGRADEFAILED1', "Update failed - couldn't add new fields"); +define('_AM_RSSFIT_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); +define('_AM_RSSFIT_ERROR_COLUMN', 'Could not create column in database : %s'); +define('_AM_RSSFIT_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); +define('_AM_RSSFIT_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); +define('_AM_RSSFIT_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); + +define('_AM_RSSFIT_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); + +// Error Msgs +define('_AM_RSSFIT_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); +define('_AM_RSSFIT_ERROR_BAD_REMOVE', 'Could not delete %s'); +define('_AM_RSSFIT_ERROR_NO_PLUGIN', 'Could not load plugin'); diff --git a/language/english/help/disclaimer.tpl b/language/english/help/disclaimer.tpl new file mode 100644 index 00000000..bea59243 --- /dev/null +++ b/language/english/help/disclaimer.tpl @@ -0,0 +1,48 @@ +
+ <{include file=$smarty.const._MI_RSSFIT_HELP_HEADER}> + +

DISCLAIMER

+
+

Software downloaded from the XOOPS web site is provided 'as is' without warranty + of any kind, either express or implied, including, but not limited to, the implied + warranties of fitness for a purpose, or the warranty of non-infringement. Without + limiting the foregoing, XOOPS Projects team makes no warranty that:

+
+
    +
  1. the software will meet your requirements
  2. +
  3. the software will be uninterrupted, timely, secure or error-free
  4. +
  5. the results that may be obtained from the use of the software will be effective, + accurate or reliable +
  6. +
  7. the quality of the software will meet your expectations any errors in the + software obtained from XOOPS web site will be corrected. +
  8. +
+
+ +

Software and its documentation made available on the XOOPS web site:

+
+
    +
  1. could include technical or other mistakes, inaccuracies or typographical + errors. XOOPS may make changes to the software or documentation made available + on its web site. +
  2. +
  3. may be out of date, and XOOPS makes no commitment to update such materials.
  4. +
  5. XOOPS assumes no responsibility for errors or omissions in the software + or documentation available from its web site. +
  6. +
+


In no event shall XOOPS team be liable to you or any third parties for + any special, punitive, incidental, indirect or consequential damages of any kind, + or any damages whatsoever, including, without limitation, those resulting from loss + of use, data or profits, whether or not XOOPS Project has been advised of the possibility + of such damages, and on any theory of liability, arising out of or in connection + with the use of this software.

+
+

The use of the software downloaded through any XOOPS site is done at your own discretion + and risk and with agreement that you will be solely responsible for any damage to + your computer system or loss of data that results from such activities. No advice + or information, whether oral or written, obtained by you from XOOPS or from XOOPS + web site shall create any warranty for the software

+
+
diff --git a/language/english/help/help.html b/language/english/help/help.html deleted file mode 100644 index 31045bf2..00000000 --- a/language/english/help/help.html +++ /dev/null @@ -1,46 +0,0 @@ -
-

Help: - <{$smarty.const._MI_RSSFIT_NAME}> - Back to the Administration of <{$smarty.const._MI_RSSFIT_NAME}> -

- -

Description

- -

RSSFit is a module for XOOPS generates RSS 2.0 validated XML feed.
- Web masters can decide what to be display in the XML output by activating installed plug-ins

-

- -

Install/uninstall

- -

No special measures necessary, follow the standard installation process – - extract the module folder into the ../modules directory. Install the - module through Admin -> System Module -> Modules.

- Detailed instructions on installing modules are available in the - XOOPS Operations Manual

- -

Some modules may come with a plugin that needs to be installed before use. You install a plugin, - a file name rssfit.module.php by copying it to the module/rss/plugins directory. You will - need to activate the new plugin in the Plug-ins administration panel.

- -

Operating instructions

- -

Configure the rss feed in the administration area, activating the plugins - applicable to your system and needs. You can test your feed on the user side by visting - the rss module.

- -

You can access the feed directly your-site-URL/modules/rss/rss.php

- -

Creating Plugins

- -

If you are a module author (or a PHP savy user,) you can create a custom plugin to meet your needs. - The file plugins/rssfit.special.php is an example that you can use as a model. It includes extensive - comments to help guide you along the way. -

- -

Tutorial

- -

There is no tutorial available at the moment.

- -
diff --git a/language/english/help/help.tpl b/language/english/help/help.tpl new file mode 100644 index 00000000..3efe5ca8 --- /dev/null +++ b/language/english/help/help.tpl @@ -0,0 +1,73 @@ +
+ <{include file=$smarty.const._MI_RSSFIT_HELP_HEADER}> + +

DESCRIPTION

+ +

RSSFit is a module for XOOPS generates RSS 2.0 validated XML feed.
+ Web masters can decide what to be display in the XML output by activating installed plug-ins

+

+ +

INSTALL/UNINSTALL

+ +

+ No special measures necessary, follow the standard installation process – + extract the module folder into the ../modules directory. Install the + module through Admin -> System Module -> Modules.

+ Detailed instructions on installing modules are available in the + Chapter 2.12 of our XOOPS Operations Manual

+ +

Some modules may come with a plugin that needs to be installed before use. You install a plugin, + a file name rssfit.module.php by copying it to the module/rss/plugins directory. You will + need to activate the new plugin in the Plug-ins administration panel.

+ +

OPERATING INSTRUCTIONS


+ +

Configure the rss feed in the administration area, activating the plugins + applicable to your system and needs. You can test your feed on the user side by visting + the rss module.

+ +

You can access the feed directly your-site-URL/modules/rss/rss.php

+ +

Creating Plugins

+ +

If you are a module author (or a PHP savy user,) you can create a custom plugin to meet your needs. + The file plugins/rssfit.special.php is an example that you can use as a model. It includes extensive + comments to help guide you along the way. +

+ +

+ This module and its operations are very simple.

+ Detailed instructions on configuring the access rights for user groups are available in the + Chapter 2.8 of our XOOPS Operations Manual

+ +

TUTORIAL


+ +

+ Tutorial has been started, but we might need your help! Please check out the status of the tutorial here . +

To contribute to this Tutorial, please fork it on GitHub. +
This document describes our Documentation Process and it will help you to understand how to contribute. +

+ There are more XOOPS Tutorials, so check them out in our XOOPS Tutorial Repository on GitBook. +

+ + +

TRANSLATIONS


+

+ Translations are on Transifex and in our XOOPS Languages Repository on GitHub.

+ +

SUPPORT


+

+ If you have questions about this module and need help, you can visit our Support Forums on XOOPS Website

+ +

DEVELOPMENT


+

+ This module is Open Source and we would love your help in making it better! You can fork this module on GitHub

+ But there is more happening on GitHub:

+ - XOOPS Core
+ - XOOPS Modules
+ - XOOPS Themes

+ Go check it out, and GET INVOLVED + +

+ +
diff --git a/language/english/help/helpheader.tpl b/language/english/help/helpheader.tpl new file mode 100644 index 00000000..13a46078 --- /dev/null +++ b/language/english/help/helpheader.tpl @@ -0,0 +1,6 @@ +

Help: + <{$smarty.const._MI_RSSFIT_NAME}> + <{$smarty.const._MI_RSSFIT_BACK_2_ADMIN}> <{$smarty.const._MI_RSSFIT_NAME}> +

diff --git a/language/english/help/license.tpl b/language/english/help/license.tpl new file mode 100644 index 00000000..598c77ba --- /dev/null +++ b/language/english/help/license.tpl @@ -0,0 +1,288 @@ +
+ <{include file=$smarty.const._MI_RSSFIT_HELP_HEADER}> + +

LICENSE

+
+            GNU GENERAL PUBLIC LICENSE
+               Version 2, June 1991
+
+ Copyright (C) 1989, 1991 Free Software Foundation, Inc.
+                       59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+                Preamble
+
+  The licenses for most software are designed to take away your
+freedom to share and change it.  By contrast, the GNU General Public
+License is intended to guarantee your freedom to share and change free
+software--to make sure the software is free for all its users.  This
+General Public License applies to most of the Free Software
+Foundation's software and to any other program whose authors commit to
+using it.  (Some other Free Software Foundation software is covered by
+the GNU Library General Public License instead.)  You can apply it to
+your programs, too.
+
+  When we speak of free software, we are referring to freedom, not
+price.  Our General Public Licenses are designed to make sure that you
+have the freedom to distribute copies of free software (and charge for
+this service if you wish), that you receive source code or can get it
+if you want it, that you can change the software or use pieces of it
+in new free programs; and that you know you can do these things.
+
+  To protect your rights, we need to make restrictions that forbid
+anyone to deny you these rights or to ask you to surrender the rights.
+These restrictions translate to certain responsibilities for you if you
+distribute copies of the software, or if you modify it.
+
+  For example, if you distribute copies of such a program, whether
+gratis or for a fee, you must give the recipients all the rights that
+you have.  You must make sure that they, too, receive or can get the
+source code.  And you must show them these terms so they know their
+rights.
+
+  We protect your rights with two steps: (1) copyright the software, and
+(2) offer you this license which gives you legal permission to copy,
+distribute and/or modify the software.
+
+  Also, for each author's protection and ours, we want to make certain
+that everyone understands that there is no warranty for this free
+software.  If the software is modified by someone else and passed on, we
+want its recipients to know that what they have is not the original, so
+that any problems introduced by others will not reflect on the original
+authors' reputations.
+
+  Finally, any free program is threatened constantly by software
+patents.  We wish to avoid the danger that redistributors of a free
+program will individually obtain patent licenses, in effect making the
+program proprietary.  To prevent this, we have made it clear that any
+patent must be licensed for everyone's free use or not licensed at all.
+
+  The precise terms and conditions for copying, distribution and
+modification follow.
+
+            GNU GENERAL PUBLIC LICENSE
+   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+  0. This License applies to any program or other work which contains
+a notice placed by the copyright holder saying it may be distributed
+under the terms of this General Public License.  The "Program", below,
+refers to any such program or work, and a "work based on the Program"
+means either the Program or any derivative work under copyright law:
+that is to say, a work containing the Program or a portion of it,
+either verbatim or with modifications and/or translated into another
+language.  (Hereinafter, translation is included without limitation in
+the term "modification".)  Each licensee is addressed as "you".
+
+Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope.  The act of
+running the Program is not restricted, and the output from the Program
+is covered only if its contents constitute a work based on the
+Program (independent of having been made by running the Program).
+Whether that is true depends on what the Program does.
+
+  1. You may copy and distribute verbatim copies of the Program's
+source code as you receive it, in any medium, provided that you
+conspicuously and appropriately publish on each copy an appropriate
+copyright notice and disclaimer of warranty; keep intact all the
+notices that refer to this License and to the absence of any warranty;
+and give any other recipients of the Program a copy of this License
+along with the Program.
+
+You may charge a fee for the physical act of transferring a copy, and
+you may at your option offer warranty protection in exchange for a fee.
+
+  2. You may modify your copy or copies of the Program or any portion
+of it, thus forming a work based on the Program, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+    a) You must cause the modified files to carry prominent notices
+    stating that you changed the files and the date of any change.
+
+    b) You must cause any work that you distribute or publish, that in
+    whole or in part contains or is derived from the Program or any
+    part thereof, to be licensed as a whole at no charge to all third
+    parties under the terms of this License.
+
+    c) If the modified program normally reads commands interactively
+    when run, you must cause it, when started running for such
+    interactive use in the most ordinary way, to print or display an
+    announcement including an appropriate copyright notice and a
+    notice that there is no warranty (or else, saying that you provide
+    a warranty) and that users may redistribute the program under
+    these conditions, and telling the user how to view a copy of this
+    License.  (Exception: if the Program itself is interactive but
+    does not normally print such an announcement, your work based on
+    the Program is not required to print an announcement.)
+
+These requirements apply to the modified work as a whole.  If
+identifiable sections of that work are not derived from the Program,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works.  But when you
+distribute the same sections as part of a whole which is a work based
+on the Program, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Program.
+
+In addition, mere aggregation of another work not based on the Program
+with the Program (or with a work based on the Program) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+  3. You may copy and distribute the Program (or a work based on it,
+under Section 2) in object code or executable form under the terms of
+Sections 1 and 2 above provided that you also do one of the following:
+
+    a) Accompany it with the complete corresponding machine-readable
+    source code, which must be distributed under the terms of Sections
+    1 and 2 above on a medium customarily used for software interchange; or,
+
+    b) Accompany it with a written offer, valid for at least three
+    years, to give any third party, for a charge no more than your
+    cost of physically performing source distribution, a complete
+    machine-readable copy of the corresponding source code, to be
+    distributed under the terms of Sections 1 and 2 above on a medium
+    customarily used for software interchange; or,
+
+    c) Accompany it with the information you received as to the offer
+    to distribute corresponding source code.  (This alternative is
+    allowed only for noncommercial distribution and only if you
+    received the program in object code or executable form with such
+    an offer, in accord with Subsection b above.)
+
+The source code for a work means the preferred form of the work for
+making modifications to it.  For an executable work, complete source
+code means all the source code for all modules it contains, plus any
+associated interface definition files, plus the scripts used to
+control compilation and installation of the executable.  However, as a
+special exception, the source code distributed need not include
+anything that is normally distributed (in either source or binary
+form) with the major components (compiler, kernel, and so on) of the
+operating system on which the executable runs, unless that component
+itself accompanies the executable.
+
+If distribution of executable or object code is made by offering
+access to copy from a designated place, then offering equivalent
+access to copy the source code from the same place counts as
+distribution of the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+  4. You may not copy, modify, sublicense, or distribute the Program
+except as expressly provided under this License.  Any attempt
+otherwise to copy, modify, sublicense or distribute the Program is
+void, and will automatically terminate your rights under this License.
+However, parties who have received copies, or rights, from you under
+this License will not have their licenses terminated so long as such
+parties remain in full compliance.
+
+  5. You are not required to accept this License, since you have not
+signed it.  However, nothing else grants you permission to modify or
+distribute the Program or its derivative works.  These actions are
+prohibited by law if you do not accept this License.  Therefore, by
+modifying or distributing the Program (or any work based on the
+Program), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Program or works based on it.
+
+  6. Each time you redistribute the Program (or any work based on the
+Program), the recipient automatically receives a license from the
+original licensor to copy, distribute or modify the Program subject to
+these terms and conditions.  You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties to
+this License.
+
+  7. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License.  If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Program at all.  For example, if a patent
+license would not permit royalty-free redistribution of the Program by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Program.
+
+If any portion of this section is held invalid or unenforceable under
+any particular circumstance, the balance of the section is intended to
+apply and the section as a whole is intended to apply in other
+circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system, which is
+implemented by public license practices.  Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+  8. If the distribution and/or use of the Program is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Program under this License
+may add an explicit geographical distribution limitation excluding
+those countries, so that distribution is permitted only in or among
+countries not thus excluded.  In such case, this License incorporates
+the limitation as if written in the body of this License.
+
+  9. The Free Software Foundation may publish revised and/or new versions
+of the General Public License from time to time.  Such new versions will
+be similar in spirit to the present version, but may differ in detail to
+address new problems or concerns.
+
+Each version is given a distinguishing version number.  If the Program
+specifies a version number of this License which applies to it and "any
+later version", you have the option of following the terms and conditions
+either of that version or of any later version published by the Free
+Software Foundation.  If the Program does not specify a version number of
+this License, you may choose any version ever published by the Free Software
+Foundation.
+
+  10. If you wish to incorporate parts of the Program into other free
+programs whose distribution conditions are different, write to the author
+to ask for permission.  For software which is copyrighted by the Free
+Software Foundation, write to the Free Software Foundation; we sometimes
+make exceptions for this.  Our decision will be guided by the two goals
+of preserving the free status of all derivatives of our free software and
+of promoting the sharing and reuse of software generally.
+
+                NO WARRANTY
+
+  11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
+FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW.  EXCEPT WHEN
+OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
+PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
+OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.  THE ENTIRE RISK AS
+TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU.  SHOULD THE
+PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
+REPAIR OR CORRECTION.
+
+  12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
+WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
+REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
+INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
+OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
+TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
+YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
+PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGES.
+
+             END OF TERMS AND CONDITIONS
+
+
+
diff --git a/language/english/help/support.tpl b/language/english/help/support.tpl new file mode 100644 index 00000000..72055a18 --- /dev/null +++ b/language/english/help/support.tpl @@ -0,0 +1,9 @@ +
+ <{include file=$smarty.const._MI_RSSFIT_HELP_HEADER}> + +

SUPPORT


+ For support visit our Support Forums at:

+

https://xoops.org/modules/newbb/
+

+ +
diff --git a/language/english/install.php b/language/english/install.php index 6e2f42e9..d81655a5 100644 --- a/language/english/install.php +++ b/language/english/install.php @@ -1,6 +1,6 @@ RSS feed RSS feed +define('_INTRO_CONTENT', 'RSS feed RSS feed At {SITENAME} we provide our XML RSS feed that you can quickly find the latest updates and short descriptions with an RSS reader. diff --git a/language/english/modinfo.php b/language/english/modinfo.php index 830bce38..3fe326c0 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -44,3 +44,17 @@ define('_MI_OUTOUT_MIME_XML', 'XML (text/xml)'); define('_MI_OUTOUT_MIME_HTML', 'HTML (text/html)'); define('_MI_OUTOUT_MIME_PHP', 'HTML with php-debug'); + +//1.30 +//Help +define('_MI_RSSFIT_DIRNAME', basename(dirname(dirname(__DIR__)))); +define('_MI_RSSFIT_HELP_HEADER', __DIR__.'/help/helpheader.tpl'); +define('_MI_RSSFIT_BACK_2_ADMIN', 'Back to Administration of '); +define('_MI_RSSFIT_OVERVIEW', 'Overview'); + +//define('_MI_RSSFIT_HELP_DIR', __DIR__); + +//help multi-page +define('_MI_RSSFIT_DISCLAIMER', 'Disclaimer'); +define('_MI_RSSFIT_LICENSE', 'License'); +define('_MI_RSSFIT_SUPPORT', 'Support'); diff --git a/xoops_version.php b/xoops_version.php index 123561cc..21d2763b 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -90,7 +90,7 @@ // ------------------- PayPal --------------------------- 'paypal' => [ 'business' => 'foundation@xoops.org', - 'item_name' => 'Donation : ' . _MI_XXXXX_NAME, + 'item_name' => 'Donation : ' . _MI_RSSFIT_NAME, 'amount' => 0, 'currency_code' => 'USD' ], @@ -105,6 +105,14 @@ ], ]; +// ------------------- Help files ------------------- // +$modversion['helpsection'] = [ + ['name' => _MI_RSSFIT_OVERVIEW, 'link' => 'page=help'], + ['name' => _MI_RSSFIT_DISCLAIMER, 'link' => 'page=disclaimer'], + ['name' => _MI_RSSFIT_LICENSE, 'link' => 'page=license'], + ['name' => _MI_RSSFIT_SUPPORT, 'link' => 'page=support'], +]; + // Templates $modversion['templates'] = []; $modversion['templates'][] = [ From 1b245a61a722ff3b44b2f6211e1dc5e8388f2f9d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 27 Oct 2017 22:52:53 -0400 Subject: [PATCH 026/154] version adjustment --- docs/changelog.txt | 4 ++-- docs/credits.txt | 2 +- xoops_version.php | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 2af2975f..5630b521 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,4 +1,4 @@ -
1.30 Beta 3 [NOT RELEASED]
+
1.31 Beta 2 [NOT RELEASED]

- move files up - Unnecessary double quotes (mamba) @@ -16,7 +16,7 @@ - ENGINE fix (mamba) - update README.md (mamba) -
1.30 Beta 2 [2017-10-24]
+
1.31 Beta 1 [2017-10-24]

- Converted to XOOPS 2.5.9/Xmf Admin GUI, PHP 7 compliance (geekwright) diff --git a/docs/credits.txt b/docs/credits.txt index 66597a42..0b180e4d 100644 --- a/docs/credits.txt +++ b/docs/credits.txt @@ -1,7 +1,7 @@ Credits =============== -Originally developed by Programmed by NS Tai +Originally developed by NS Tai Version 1.22 was updated by Hervé Thouzard diff --git a/xoops_version.php b/xoops_version.php index 21d2763b..4c270a39 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -34,8 +34,8 @@ // ------------------- Informations ------------------- // $modversion = [ - 'version' => 1.30, - 'module_status' => 'Beta 3', + 'version' => 1.31, + 'module_status' => 'Beta 2', 'release_date' => '2017/10/27', 'name' => _MI_RSSFIT_NAME, 'description' => _MI_RSSFIT_DESC, From 0bc379ae41425f512e8095bf2f74422ecb4e774e Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 6 Dec 2017 07:27:20 -0500 Subject: [PATCH 027/154] cosmetics --- plugins/rssfit.cbb.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/rssfit.cbb.php b/plugins/rssfit.cbb.php index 4e6ffee4..fea5ce7b 100644 --- a/plugins/rssfit.cbb.php +++ b/plugins/rssfit.cbb.php @@ -31,7 +31,7 @@ * About this RSSFit plug-in * Author: tuff * Requirements (Tested with): -* Module: CBB +* Module: CBB * Version: 1.15 / 2.30 / 2.31 * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 From 5380e851c809838ecb93dcd7cceef6e1bdbde447 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 6 Dec 2017 07:27:33 -0500 Subject: [PATCH 028/154] SQL Formatting --- sql/mysql.sql | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/sql/mysql.sql b/sql/mysql.sql index fcb08b95..581348a1 100644 --- a/sql/mysql.sql +++ b/sql/mysql.sql @@ -1,25 +1,27 @@ CREATE TABLE `rssfit_misc` ( - `misc_id` smallint(5) unsigned NOT NULL auto_increment, - `misc_category` varchar(30) NOT NULL default '', - `misc_title` varchar(255) NOT NULL default '', - `misc_content` text NOT NULL, - `misc_setting` text NOT NULL, - PRIMARY KEY (`misc_id`) -) ENGINE=MyISAM; + `misc_id` SMALLINT(5) UNSIGNED NOT NULL AUTO_INCREMENT, + `misc_category` VARCHAR(30) NOT NULL DEFAULT '', + `misc_title` VARCHAR(255) NOT NULL DEFAULT '', + `misc_content` TEXT NOT NULL, + `misc_setting` TEXT NOT NULL, + PRIMARY KEY (`misc_id`) +) + ENGINE = MyISAM; CREATE TABLE `rssfit_plugins` ( - `rssf_conf_id` int(5) unsigned NOT NULL auto_increment, - `rssf_filename` varchar(50) NOT NULL default '', - `rssf_activated` tinyint(1) NOT NULL default '0', - `rssf_grab` tinyint(2) NOT NULL default '0', - `rssf_order` tinyint(2) NOT NULL default '0', - `subfeed` tinyint(1) NOT NULL default '0', - `sub_entries` char(2) NOT NULL default '', - `sub_link` varchar(255) NOT NULL default '', - `sub_title` varchar(255) NOT NULL default '', - `sub_desc` varchar(255) NOT NULL default '', - `img_url` varchar(255) NOT NULL default '', - `img_link` varchar(255) NOT NULL default '', - `img_title` varchar(255) NOT NULL default '', - PRIMARY KEY (`rssf_conf_id`) -) ENGINE=MyISAM; + `rssf_conf_id` INT(5) UNSIGNED NOT NULL AUTO_INCREMENT, + `rssf_filename` VARCHAR(50) NOT NULL DEFAULT '', + `rssf_activated` TINYINT(1) NOT NULL DEFAULT '0', + `rssf_grab` TINYINT(2) NOT NULL DEFAULT '0', + `rssf_order` TINYINT(2) NOT NULL DEFAULT '0', + `subfeed` TINYINT(1) NOT NULL DEFAULT '0', + `sub_entries` CHAR(2) NOT NULL DEFAULT '', + `sub_link` VARCHAR(255) NOT NULL DEFAULT '', + `sub_title` VARCHAR(255) NOT NULL DEFAULT '', + `sub_desc` VARCHAR(255) NOT NULL DEFAULT '', + `img_url` VARCHAR(255) NOT NULL DEFAULT '', + `img_link` VARCHAR(255) NOT NULL DEFAULT '', + `img_title` VARCHAR(255) NOT NULL DEFAULT '', + PRIMARY KEY (`rssf_conf_id`) +) + ENGINE = MyISAM; From 1e99dcd135db5faea0f7f5bddb947ae62eb13d9d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 6 Dec 2017 07:53:22 -0500 Subject: [PATCH 029/154] references --- include/common.php | 4 ++-- index.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/common.php b/include/common.php index 9c75306f..19a4b39e 100644 --- a/include/common.php +++ b/include/common.php @@ -49,5 +49,5 @@ $rss = new RssfeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); $myts = $rss->myts; -$pluginsHandler =& $rss->pHandler; -$miscHandler =& $rss->mHandler; +$pluginsHandler = $rss->pHandler; +$miscHandler = $rss->mHandler; diff --git a/index.php b/index.php index ed21a627..f7cb3d55 100644 --- a/index.php +++ b/index.php @@ -36,7 +36,7 @@ $GLOBALS['xoopsOption']['template_main'] = 'rssfit_index.tpl'; require XOOPS_ROOT_PATH.'/header.php'; if ($intr = $miscHandler->getObjects(new Criteria('misc_category', 'intro'))) { - $intro =& $intr[0]; + $intro = $intr[0]; $setting = $intro->getVar('misc_setting'); $intro->setDoHtml($setting['dohtml'] ? 1 : 0); $intro->setDoBr($setting['dobr'] ? 1 : 0); From 426f8994f52cf47a61eee47a042a0b7ecae04331 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 6 Dec 2017 07:54:11 -0500 Subject: [PATCH 030/154] references --- admin/do_subfeeds.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index 60a7ee4f..34c00496 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -41,7 +41,7 @@ switch ($op) { default: $ret = ''; - if ($plugins =& $pluginsHandler->getObjects(null, 'sublist')) { + if ($plugins = $pluginsHandler->getObjects(null, 'sublist')) { $ret .= "
\n
" . _AM_SUB_LIST . "
" . _AM_SUB_FILENAME_URL . "
" . _AM_ACTION . "
" . $p->getVar('rssf_filename') . ""; -<<<<<<< HEAD if ($handler = $pluginsHandler->checkPlugin($p)) { -======= - if ($handler = $plugins_handler->checkPlugin($p)) { ->>>>>>> c9e02ecfe26ae2f5fb83a1aabd25b97eae5f246d $ret .= $handler->modname; $action->addOption('a', _AM_PLUGIN_ACTIVATE); } else { @@ -152,11 +144,7 @@ . ""; $p = $pluginsHandler->create(); $p->setVar('rssf_filename', $i); -<<<<<<< HEAD if ($handler = $pluginsHandler->checkPlugin($p)) { -======= - if ($handler = $plugins_handler->checkPlugin($p)) { ->>>>>>> c9e02ecfe26ae2f5fb83a1aabd25b97eae5f246d $ret .= $handler->modname; } else { if (count($p->getErrors()) > 0) { @@ -226,15 +214,9 @@ if (!empty($install)) { $files = array_keys($install); foreach ($files as $f) { -<<<<<<< HEAD $p = $pluginsHandler->create(); $p->setVar('rssf_filename', $f); if ($handler = $pluginsHandler->checkPlugin($p)) { -======= - $p = $plugins_handler->create(); - $p->setVar('rssf_filename', $f); - if ($handler = $plugins_handler->checkPlugin($p)) { ->>>>>>> c9e02ecfe26ae2f5fb83a1aabd25b97eae5f246d $p->setVar('rssf_activated', 1); $p->setVar('rssf_grab', $xoopsModuleConfig['plugin_entries']); $p->setVar('sub_entries', $xoopsModuleConfig['plugin_entries']); From a3f2c9f63431d9280ece7189cda4b371dd3570f5 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 27 Oct 2017 11:15:21 -0400 Subject: [PATCH 018/154] fix case --- class/misc.php | 6 +++--- class/plugins.php | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/class/misc.php b/class/misc.php index cb0a9639..fa4e28a4 100644 --- a/class/misc.php +++ b/class/misc.php @@ -100,7 +100,7 @@ public function get($id, $fields='*') public function getCount($criteria=null) { $sql = 'SELECT COUNT(*) FROM '.$this->db_table; - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { + if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' '.$criteria->renderWhere(); } if (!$result =& $this->db->query($sql)) { @@ -115,7 +115,7 @@ public function &getObjects($criteria=null, $fields='*', $key='') $ret = false; $limit = $start = 0; $sql = 'SELECT '.$fields.' FROM '.$this->db_table; - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { + if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' '.$criteria->renderWhere(); if ('' != $criteria->getSort()) { $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); @@ -210,7 +210,7 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) } $sql = substr($sql, 0, -2); $sql = 'UPDATE '.$this->db_table.' SET '.$sql; - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { + if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' '.$criteria->renderWhere(); } if (false !== $force) { diff --git a/class/plugins.php b/class/plugins.php index a7799907..790a7478 100644 --- a/class/plugins.php +++ b/class/plugins.php @@ -74,7 +74,7 @@ public function __construct(XoopsDatabase $db) public function getInstance(XoopsDatabase $db) { static $instance; - if (!isset($instance)) { + if (null === $instance) { $instance = new RssPluginsHandler($db); } return $instance; @@ -179,7 +179,7 @@ public function &getObjects($criteria=null, $fields='*', $key='') break; } $sql = 'SELECT '.$fields.' FROM '.$this->db_table; - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { + if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' '.$criteria->renderWhere(); if ('' != $criteria->getSort()) { $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); @@ -222,7 +222,7 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) } $sql = substr($sql, 0, -2); $sql = 'UPDATE '.$this->db_table.' SET '.$sql; - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { + if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' '.$criteria->renderWhere(); } if (false !== $force) { @@ -240,7 +240,7 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) public function getCount($criteria = null) { $sql = 'SELECT COUNT(*) FROM '.$this->db_table; - if (isset($criteria) && is_subclass_of($criteria, 'criteriaelement')) { + if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' '.$criteria->renderWhere(); } $result = $this->db->query($sql); From a600818023c50eb1a31e729706f520da8732a32f Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 27 Oct 2017 11:17:46 -0400 Subject: [PATCH 019/154] 'isset(...)' usage --- class/misc.php | 8 ++++---- class/plugins.php | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/class/misc.php b/class/misc.php index fa4e28a4..ca053099 100644 --- a/class/misc.php +++ b/class/misc.php @@ -75,7 +75,7 @@ public function __construct(XoopsDatabase $db) public function getInstance(XoopsDatabase $db) { static $instance; - if (!isset($instance)) { + if (null === $instance) { $instance = new RssMiscHandler($db); } return $instance; @@ -100,7 +100,7 @@ public function get($id, $fields='*') public function getCount($criteria=null) { $sql = 'SELECT COUNT(*) FROM '.$this->db_table; - if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { + if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' '.$criteria->renderWhere(); } if (!$result =& $this->db->query($sql)) { @@ -115,7 +115,7 @@ public function &getObjects($criteria=null, $fields='*', $key='') $ret = false; $limit = $start = 0; $sql = 'SELECT '.$fields.' FROM '.$this->db_table; - if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { + if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' '.$criteria->renderWhere(); if ('' != $criteria->getSort()) { $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); @@ -210,7 +210,7 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) } $sql = substr($sql, 0, -2); $sql = 'UPDATE '.$this->db_table.' SET '.$sql; - if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { + if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' '.$criteria->renderWhere(); } if (false !== $force) { diff --git a/class/plugins.php b/class/plugins.php index 790a7478..1f459cc6 100644 --- a/class/plugins.php +++ b/class/plugins.php @@ -179,7 +179,7 @@ public function &getObjects($criteria=null, $fields='*', $key='') break; } $sql = 'SELECT '.$fields.' FROM '.$this->db_table; - if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { + if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' '.$criteria->renderWhere(); if ('' != $criteria->getSort()) { $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); @@ -222,7 +222,7 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) } $sql = substr($sql, 0, -2); $sql = 'UPDATE '.$this->db_table.' SET '.$sql; - if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { + if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' '.$criteria->renderWhere(); } if (false !== $force) { @@ -240,7 +240,7 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) public function getCount($criteria = null) { $sql = 'SELECT COUNT(*) FROM '.$this->db_table; - if (isset($criteria) && is_subclass_of($criteria, 'CriteriaElement')) { + if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { $sql .= ' '.$criteria->renderWhere(); } $result = $this->db->query($sql); From 27c68483b26432003a54fd0b1d19d0c043b7f82b Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 27 Oct 2017 11:28:20 -0400 Subject: [PATCH 020/154] Menu changes --- admin/menu.php | 88 +++++++++++++++++++++++++++++--------------------- 1 file changed, 51 insertions(+), 37 deletions(-) diff --git a/admin/menu.php b/admin/menu.php index fd576290..6145e6b0 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -12,49 +12,63 @@ /** * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) - * @package RSSFit + * @package RSSFit * @since - * @author XOOPS Development Team + * @author XOOPS Development Team */ defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); // get path to icons -$pathIcon32=''; +$pathIcon32 = ''; if (class_exists('Xmf\Module\Admin', true)) { $pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); } -$adminmenu = []; -$i =0; -$adminmenu[$i]['title'] = _MI_RSSFIT_INDEX; -$adminmenu[$i]['link'] = 'admin/index.php'; -$adminmenu[$i]['icon'] = $pathIcon32 . '/home.png'; - -++$i; -$adminmenu[$i]['title'] = _MI_RSSFIT_ADMENU1; -$adminmenu[$i]['link'] = 'admin/?do=intro'; -//$adminmenu[$i]['link'] = "admin/do_intro.php"; -$adminmenu[$i]['icon'] = $pathIcon32 . '/folder_txt.png'; -++$i; -$adminmenu[$i]['title'] = _MI_RSSFIT_ADMENU2; -$adminmenu[$i]['link'] = 'admin/?do=plugins'; -//$adminmenu[$i]['link'] = "admin/do_plugins.php"; -$adminmenu[$i]['icon'] = 'images/icons/32/plugin.png'; -++$i; -$adminmenu[$i]['title'] = _MI_RSSFIT_ADMENU3; -$adminmenu[$i]['link'] = 'admin/?do=channel'; -//$adminmenu[$i]['link'] = "admin/do_channel.php"; -$adminmenu[$i]['icon'] = $pathIcon32 . '/compfile.png'; -++$i; -$adminmenu[$i]['title'] = _MI_RSSFIT_ADMENU4; -$adminmenu[$i]['link'] = 'admin/?do=subfeeds'; -//$adminmenu[$i]['link'] = "admin/do_subfeeds.php"; -$adminmenu[$i]['icon'] = $pathIcon32 . '/groupmod.png'; -++$i; -$adminmenu[$i]['title'] = _MI_RSSFIT_ADMENU5; -$adminmenu[$i]['link'] = 'admin/?do=sticky'; -$adminmenu[$i]['icon'] = $pathIcon32 . '/attach.png'; -++$i; -$adminmenu[$i]['title'] = _MI_RSSFIT_ABOUT; -$adminmenu[$i]['link'] = 'admin/about.php'; -$adminmenu[$i]['icon'] = $pathIcon32 . '/about.png'; +$adminmenu = []; + +$adminmenu[] = [ + 'title' => _MI_RSSFIT_INDEX, + 'link' => 'admin/index.php', + 'icon' => $pathIcon32 . '/home.png', +]; + +$adminmenu[] = [ + 'title' => _MI_RSSFIT_ADMENU1, + 'link' => 'admin/?do=intro', + //'link' => "admin/do_intro.php", + 'icon' => $pathIcon32 . '/folder_txt.png', +]; + +$adminmenu[] = [ + 'title' => _MI_RSSFIT_ADMENU2, + 'link' => 'admin/?do=plugins', + //'link' => "admin/do_plugins.php", + 'icon' => 'images/icons/32/plugin.png', +]; + +$adminmenu[] = [ + 'title' => _MI_RSSFIT_ADMENU3, + 'link' => 'admin/?do=channel', + //'link' => "admin/do_channel.php", + 'icon' => $pathIcon32 . '/compfile.png', +]; + +$adminmenu[] = [ + 'title' => _MI_RSSFIT_ADMENU4, + 'link' => 'admin/?do=subfeeds', + //'link' => "admin/do_subfeeds.php", + 'icon' => $pathIcon32 . '/groupmod.png', +]; + +$adminmenu[] = [ + 'title' => _MI_RSSFIT_ADMENU5, + 'link' => 'admin/?do=sticky', + 'icon' => $pathIcon32 . '/attach.png', +]; + +$adminmenu[] = [ + 'title' => _MI_RSSFIT_ABOUT, + 'link' => 'admin/about.php', + 'icon' => $pathIcon32 . '/about.png', +]; + From e3120a58061bdef312af7e47e99376fc4f8e2f71 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 27 Oct 2017 11:45:57 -0400 Subject: [PATCH 021/154] add /assets --- assets/css/index.html | 1 + assets/css/style.css | 140 ++++++++++++++++++++++++++++++ assets/images/blank.gif | Bin 0 -> 51 bytes assets/images/blank.png | Bin 0 -> 155 bytes assets/images/icons/16/index.html | 1 + assets/images/icons/32/index.html | 1 + assets/images/icons/index.html | 1 + assets/images/index.html | 1 + assets/index.html | 1 + assets/js/index.html | 2 + 10 files changed, 148 insertions(+) create mode 100644 assets/css/index.html create mode 100644 assets/css/style.css create mode 100644 assets/images/blank.gif create mode 100644 assets/images/blank.png create mode 100644 assets/images/icons/16/index.html create mode 100644 assets/images/icons/32/index.html create mode 100644 assets/images/icons/index.html create mode 100644 assets/images/index.html create mode 100644 assets/index.html create mode 100644 assets/js/index.html diff --git a/assets/css/index.html b/assets/css/index.html new file mode 100644 index 00000000..74b6f45c --- /dev/null +++ b/assets/css/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/css/style.css b/assets/css/style.css new file mode 100644 index 00000000..a4b9a0ea --- /dev/null +++ b/assets/css/style.css @@ -0,0 +1,140 @@ +#extgallery table.outer { + margin-top: 10px; +} + +#extgallery .pageNav { + text-align: right; + margin-top: 5px; +} + +#extgallery .catThumb { + float: left; + margin-right: 5px; +} + +#extgallery #thumbTable td { + padding: 10px; + vertical-align: middle; + text-align: center; +} + +#extgallery #rateTable td { + text-align: center; +} + +#extgallery #photoNavLeft { + width: 33%; +} + +#extgallery #photoNavCenter { + text-align: center; +} + +#extgallery #photoNavRight { + width: 33%; + text-align: right; +} + +#extgallery img.thumb { + padding: 5px; + border: 1px #778899 solid; +} + +#extgallery img.thumb:hover { + padding: 4px; + border: 2px #3388CC solid; +} + +#extgallery #photo { + text-align: center; +} + +#extgallery #photo img { + margin-top: 10px; + padding: 5px; + border: 1px #778899 solid; +} + +#extgallery #photo img:hover { + padding: 4px; + border: 2px #3388CC solid; +} + +#extgallery .photoTitle { + font-weight: bold; + text-align: center; + padding: 5px; +} + +#extgallery .photoDesc { + text-align: center; + padding: 5px; +} + +#extgallery .photoExtra { + text-align: center; + padding: 5px; +} + +#extgallery div.adminLink { + text-align: center; +} + +#extgallery .socialnetwork { + width: 100%; + height: 25px; + margin-bottom: 40px; +} + +#extgallery .socialnetwork ul li { + list-style: none; + float: left; +} + +#extgallery .bookmarkme { + width: 100%; + height: 50px; +} + +#extgallery .bookmarkmetitle { + text-align: center; +} + +#extgallery .bookmarkmeitems { + text-align: center; + margin: 5px; +} + +#extgallery #rss { + text-align: center; + margin: 5px; +} + +#extgallery #viewecard { + border: 1px solid black; + padding: 7px; + margin: 0 auto 0 auto; +} + +#extgallery #viewecardtd { + vertical-align: top; + padding-left: 7px; +} + +#extgallery .txtleft { + text-align: left; +} + +#extgallery .txtright { + text-align: right; +} + +#extgallery .txtcenter { + text-align: center; +} + +#extgallery .comments { + text-align: center; + padding: 3px; + margin: 3px; +} diff --git a/assets/images/blank.gif b/assets/images/blank.gif new file mode 100644 index 0000000000000000000000000000000000000000..c0b332e41a28ea383ca9dffc5c2242aa87fb3d0b GIT binary patch literal 51 tcmZ?wbhEHbWMp7un8?8J|Nnmm7*PDl!U?NMQuI!gN<;1upcxOv22FVwA zL>4nJa0`Jj5jgR3=A9lx&I`x0{LtKJ|V9E|NjRvLl0f915%77L4Lsu p4$p3+0Xf{BE{-7;w~`YM0Bw|JV2qq$`wA$`;OXk;vd$@?2>{=>C42w? literal 0 HcmV?d00001 diff --git a/assets/images/icons/16/index.html b/assets/images/icons/16/index.html new file mode 100644 index 00000000..990cbd60 --- /dev/null +++ b/assets/images/icons/16/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/icons/32/index.html b/assets/images/icons/32/index.html new file mode 100644 index 00000000..990cbd60 --- /dev/null +++ b/assets/images/icons/32/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/icons/index.html b/assets/images/icons/index.html new file mode 100644 index 00000000..990cbd60 --- /dev/null +++ b/assets/images/icons/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/images/index.html b/assets/images/index.html new file mode 100644 index 00000000..74b6f45c --- /dev/null +++ b/assets/images/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/index.html b/assets/index.html new file mode 100644 index 00000000..74b6f45c --- /dev/null +++ b/assets/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/assets/js/index.html b/assets/js/index.html new file mode 100644 index 00000000..cc70736c --- /dev/null +++ b/assets/js/index.html @@ -0,0 +1,2 @@ + +"

" . _AD_DON_TREASURY_F_REGISTER . "

\n" . "\n" . "\n\n" @@ -51,7 +51,7 @@ . "\n"; foreach ($plugins as $p) { $id = $p->getVar('rssf_conf_id'); - if (!$handler =& $pluginsHandler->checkPlugin($p)) { + if (!$handler = $pluginsHandler->checkPlugin($p)) { $pluginsHandler->forceDeactivate($p); $mod = implode('
', $p->getErrors()); $activate = new XoopsFormCheckbox('', 'activate[' . $id . ']', 0); @@ -105,8 +105,8 @@ case 'edit': $id = isset($_GET['feed']) ? (int)$_GET['feed'] : 0; if (!empty($id)) { - $sub =& $pluginsHandler->get($id); - if (!$handler =& $pluginsHandler->checkPlugin($sub)) { + $sub = $pluginsHandler->get($id); + if (!$handler = $pluginsHandler->checkPlugin($sub)) { $pluginsHandler->forceDeactivate($sub); } } From bbfbe032900dfd599cf73707e076536d9898ee29 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 22 Dec 2017 14:08:40 -0500 Subject: [PATCH 031/154] URL Link for active plugins --- admin/do_subfeeds.php | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index 34c00496..a2dd524c 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -42,7 +42,7 @@ default: $ret = ''; if ($plugins = $pluginsHandler->getObjects(null, 'sublist')) { - $ret .= "
\n
" . _AM_SUB_LIST . "
" . _AM_SUB_FILENAME_URL . "
\n" + $ret .= "
\n
\n" . "\n" . "\n\n" . "\n" @@ -53,33 +53,29 @@ $id = $p->getVar('rssf_conf_id'); if (!$handler = $pluginsHandler->checkPlugin($p)) { $pluginsHandler->forceDeactivate($p); - $mod = implode('
', $p->getErrors()); + $mod = implode('
', $p->getErrors()); $activate = new XoopsFormCheckbox('', 'activate[' . $id . ']', 0); $activate->setExtra('disabled="disabled"'); $config = ' '; + $urlLink = $rss->subFeedUrl($p->getVar('rssf_filename')); } else { $mod = $handler->modname; $activate = new XoopsFormCheckbox('', 'activate[' . $id . ']', $p->getVar('subfeed')); $config = rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_SUB_CONFIGURE); + $urlLink = '' . $rss->subFeedUrl($p->getVar('rssf_filename')) .''; } $activate->addOption(1, ' '); $ret .= "
\n" - . "\n" - . "\n" - . "\n" - . "\n"; + . "\n" + . "\n" + . "\n" + . "\n"; $ret .= "\n"; } $ret .= "
" . _AM_SUB_LIST . "
" . _AM_SUB_FILENAME_URL . "" . _AM_PLUGIN_MODNAME . "
" - . $p->getVar('rssf_filename') . '
' - . $rss->subFeedUrl($p->getVar('rssf_filename')) - . "
" - . $mod . "" - . $activate->render() . "" - . $config . "" . $p->getVar('rssf_filename') . '
' . $urlLink . "
" . $mod . "" . $activate->render() . "" . $config . "
\n"; $hidden = new XoopsFormHidden('op', 'save'); $ret = "
\n" . $ret - . "
\n" . "\n"; + /** @var rssfit\RssPlugin $p */ foreach ($plugins as $p) { $id = $p->getVar('rssf_conf_id'); $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); @@ -142,7 +143,7 @@ } // Non-installed plugins - if (!$filelist =& $pluginsHandler->getPluginFileList()) { + if (!$filelist = $pluginsHandler->getPluginFileList()) { $filelist = []; } $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index 3fcd1bd6..2c5acf4e 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -142,14 +142,14 @@ $form->addElement(new \XoopsFormText(_AM_RSSFIT_PLUGIN_SHOWXENTRIES, 'sub_entries', 3, 2, $sub->getVar('sub_entries')), true); $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_REQUIRED . ' ' . rssfit\Utility::genSpecMoreInfo('req', $rss))); - $form->addElement(new \XoopsFormText('title', 'sub_title', 50, 255, $sub->getVar('sub_title', 'e')), true); - $form->addElement(new \XoopsFormText('link', 'sub_link', 50, 255, $sub->getVar('sub_link', 'e')), true); - $form->addElement(new \XoopsFormTextArea('description', 'sub_desc', $sub->getVar('sub_desc', 'e')), true); + $form->addElement(new \XoopsFormText(_AM_RSSFIT_SUB_TITLE, 'sub_title', 50, 255, $sub->getVar('sub_title', 'e')), true); + $form->addElement(new \XoopsFormText(_AM_RSSFIT_SUB_LINK, 'sub_link', 50, 255, $sub->getVar('sub_link', 'e')), true); + $form->addElement(new \XoopsFormTextArea(_AM_RSSFIT_SUB_DESC, 'sub_desc', $sub->getVar('sub_desc', 'e')), true); $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_IMAGE . ' ' . rssfit\Utility::genSpecMoreInfo('img', $rss))); - $form->addElement(new \XoopsFormText('url', 'img_url', 50, 255, $sub->getVar('img_url', 'e'))); - $form->addElement(new \XoopsFormText('link', 'img_link', 50, 255, $sub->getVar('img_link', 'e'))); - $form->addElement(new \XoopsFormText('title', 'img_title', 50, 255, $sub->getVar('img_title', 'e'))); + $form->addElement(new \XoopsFormText(_AM_RSSFIT_SUB_URL, 'img_url', 50, 255, $sub->getVar('img_url', 'e'))); + $form->addElement(new \XoopsFormText(_AM_RSSFIT_SUB_LINK, 'img_link', 50, 255, $sub->getVar('img_link', 'e'))); + $form->addElement(new \XoopsFormText(_AM_RSSFIT_SUB_TITLE, 'img_title', 50, 255, $sub->getVar('img_title', 'e'))); $form->addElement(new \XoopsFormHidden('feed', $id)); $form->addElement(new \XoopsFormHidden('op', 'savefeed')); diff --git a/assets/js/index.html b/assets/js/index.html index cc70736c..2c5cdd3f 100644 --- a/assets/js/index.html +++ b/assets/js/index.html @@ -1,2 +1 @@ -"

" . _AD_DON_TREASURY_F_REGISTER . "

\n" diff --git a/class/RssMisc.php b/class/RssMisc.php index a2782a74..691cadb1 100644 --- a/class/RssMisc.php +++ b/class/RssMisc.php @@ -33,9 +33,7 @@ ## Project: RSSFit ## ############################################################################### -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssMisc diff --git a/class/RssMiscHandler.php b/class/RssMiscHandler.php index f456330c..e2915de3 100644 --- a/class/RssMiscHandler.php +++ b/class/RssMiscHandler.php @@ -35,9 +35,7 @@ use Xoopsmodules\rssfit; -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssMiscHandler @@ -219,7 +217,7 @@ public function insert(\XoopsObject $obj) //, $force = false) * @param bool $force * @return bool|string */ - public function modifyObjects($criteria = null, $fields = [], $force = false) + public function modifyObjects($criteria = null, array $fields = [], $force = false) { if (is_array($fields) && count($fields) > 0) { $obj = new $this->obj_class(); @@ -248,7 +246,7 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) /** * @param \XoopsObject $obj - * @return bool|void + * @return bool */ public function delete(\XoopsObject $obj) // , $force=false) { diff --git a/class/RssPlugins.php b/class/RssPlugin.php similarity index 96% rename from class/RssPlugins.php rename to class/RssPlugin.php index e6c65eb7..a417bca6 100644 --- a/class/RssPlugins.php +++ b/class/RssPlugin.php @@ -35,15 +35,13 @@ //use Xoopsmodules\rssfit; -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** - * Class RssPlugins + * Class RssPlugin * @package Xoopsmodules\rssfit */ -class RssPlugins extends \XoopsObject +class RssPlugin extends \XoopsObject { public function __construct() { diff --git a/class/RssPluginsHandler.php b/class/RssPluginHandler.php similarity index 93% rename from class/RssPluginsHandler.php rename to class/RssPluginHandler.php index 87b94ae8..ecfd3c9e 100644 --- a/class/RssPluginsHandler.php +++ b/class/RssPluginHandler.php @@ -35,25 +35,23 @@ use Xoopsmodules\rssfit; -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** - * Class RssPluginsHandler + * Class RssPluginHandler * @package Xoopsmodules\rssfit */ -class RssPluginsHandler extends \XoopsObjectHandler +class RssPluginHandler extends \XoopsObjectHandler { // public $db; public $db_table; - public $obj_class = RssPlugins::class; + public $obj_class = RssPlugin::class; public $obj_key = 'rssf_conf_id'; public $sortby = 'rssf_order'; public $order = 'ASC'; /** - * RssPluginsHandler constructor. + * RssPluginHandler constructor. * @param \XoopsDatabase $db */ public function __construct(\XoopsDatabase $db) @@ -81,6 +79,7 @@ public function getInstance(\XoopsDatabase $db) */ public function create() { + /** @var \XoopsObject $obj */ $obj = new $this->obj_class(); $obj->setNew(); return $obj; @@ -95,8 +94,8 @@ public function get($id, $fields = '*') { $ret = false; $criteria = new \Criteria($this->obj_key, (int)$id); - if ($objs =& $this->getObjects($criteria) && 1 === count($objs)) { - $ret =& $objs[0]; + if (($objs = $this->getObjects($criteria)) && (1 === count($objs))) { + $ret = $objs[0]; } return $ret; } @@ -156,7 +155,7 @@ public function insert(\XoopsObject $obj) //, $force=false) /** * @param \XoopsObject $obj - * @return bool|void + * @return bool */ public function delete(\XoopsObject $obj) //, $force = false) { @@ -182,7 +181,7 @@ public function delete(\XoopsObject $obj) //, $force = false) * @param string $key * @return array|bool */ - public function &getObjects($criteria = null, $fields = '*', $key = '') + public function getObjects($criteria = null, $fields = '*', $key = '') { $ret = false; $limit = $start = 0; @@ -218,10 +217,10 @@ public function &getObjects($criteria = null, $fields = '*', $key = '') $obj->assignVars($myrow); switch ($key) { default: - $ret[] =& $obj; + $ret[] = $obj; break; case 'id': - $ret[$myrow[$this->obj_key]] =& $obj; + $ret[$myrow[$this->obj_key]] = $obj; break; } unset($obj); @@ -235,7 +234,7 @@ public function &getObjects($criteria = null, $fields = '*', $key = '') * @param bool $force * @return bool|string */ - public function modifyObjects($criteria = null, $fields = [], $force = false) + public function modifyObjects($criteria = null, array $fields = [], $force = false) { if (is_array($fields) && count($fields) > 0) { $obj = new $this->obj_class(); @@ -296,10 +295,10 @@ public function forceDeactivate(&$obj, $type = 'rssf_activated') /** * @return array|bool */ - public function &getPluginFileList() + public function getPluginFileList() { $ret = false; - if ($objs =& $this->getObjects(null, 'rssf_filename')) { + if ($objs = $this->getObjects(null, 'rssf_filename')) { foreach ($objs as $o) { $ret[] = $o->getVar('rssf_filename'); } @@ -308,13 +307,13 @@ public function &getPluginFileList() } /** - * @param $obj + * @param null|\XoopsObject $obj * @return bool */ - public function &checkPlugin($obj) + public function checkPlugin($obj = null) { $ret = false; - global $module_handler; +// global $module_handler; $file = RSSFIT_ROOT_PATH . 'plugins/' . $obj->getVar('rssf_filename'); if (file_exists($file)) { $require = require_once $file; diff --git a/class/RssfeedHandler.php b/class/RssfeedHandler.php index 2f178e0f..82799ef7 100644 --- a/class/RssfeedHandler.php +++ b/class/RssfeedHandler.php @@ -35,9 +35,7 @@ use Xoopsmodules\rssfit; -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfeedHandler @@ -109,7 +107,7 @@ public function __construct($modConfig, $xoopsConfig, $xoopsModule) $this->myts = \MyTextSanitizer::getInstance(); $this->rssmod = $xoopsModule; $db = \XoopsDatabaseFactory::getDatabaseConnection(); - $this->pHandler = new rssfit\RssPluginsHandler($db);// xoops_getModuleHandler('plugins'); + $this->pHandler = new rssfit\RssPluginHandler($db);// xoops_getModuleHandler('plugins'); $this->mHandler = new rssfit\RssMiscHandler($db); //xoops_getModuleHandler('misc'); $this->modConfig = $modConfig; $this->xoopsConfig = $xoopsConfig; @@ -126,7 +124,7 @@ public function __construct($modConfig, $xoopsConfig, $xoopsModule) public function getChannel(&$feed) { $channel = []; - if ($elements =& $this->mHandler->getObjects(new \Criteria('misc_category', 'channel'))) { + if ($elements = $this->mHandler->getObjects(new \Criteria('misc_category', 'channel'))) { foreach ($elements as $e) { if ('' != $e->getVar('misc_content')) { $channel[$e->getVar('misc_title')] = $e->getVar('misc_content', 'n'); @@ -215,6 +213,7 @@ public function getItems(&$feed) $this->subHandler->grab = $this->pluginObj->getVar('sub_entries'); $grab = $this->subHandler->grabEntries($this->pluginObj); if (false !== $grab && count($grab) > 0) { + /** @var rssfit\RssPlugin $g */ foreach ($grab as $g) { array_push($entries, $g); } @@ -371,10 +370,10 @@ public function wrapCdata(&$text) * @param string $type * @return array|bool */ - public function &getActivatedSubfeeds($fields = '', $type = '') + public function getActivatedSubfeeds($fields = '', $type = '') { $ret = false; - if ($subs =& $this->pHandler->getObjects(new \Criteria('subfeed', 1), $fields)) { + if ($subs = $this->pHandler->getObjects(new \Criteria('subfeed', 1), $fields)) { switch ($type) { default: $ret =& $subs; @@ -409,7 +408,7 @@ public function feedSelectBox($caption = '', $selected = '', $size = 1, $multi = if ($main) { $select->addOption('-1', _AM_RSSFIT_MAINFEED); } - if ($subs =& $this->getActivatedSubfeeds('sublist', 'list')) { + if ($subs = $this->getActivatedSubfeeds('sublist', 'list')) { foreach ($subs as $k => $v) { $select->addOption($k, $v); } diff --git a/class/Utility.php b/class/Utility.php index 85940baa..f9d447be 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -64,7 +64,7 @@ public static function sortTimestamp($a, $b) * @param $rss * @return string */ - public static function genSpecMoreInfo($spec = 0, &$rss) + public static function genSpecMoreInfo($spec = 0, $rss) { return static::rssfGenAnchor($rss->specUrl($spec), _AM_RSSFIT_EDIT_CHANNEL_QMARK, 'spec', _AM_RSSFIT_EDIT_CHANNEL_MOREINFO); } diff --git a/language/english/admin.php b/language/english/admin.php index 1434487c..744001fe 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -21,7 +21,7 @@ define('_AM_RSSFIT_PLUGIN_SHOWXENTRIES', 'Entries to show'); define('_AM_RSSFIT_PLUGIN_ORDER', 'Display order'); define('_AM_RSSFIT_PLUGIN_DEACTIVATE', 'Deactivate'); -define('_AM_RSSFIT_PLUGIN_ACTIVATE', 'Activate'); +define('_AM_RSSFIT_PLUGIN_ACTIVATE', 'Activated'); define('_AM_RSSFIT_PLUGIN_INSTALL', 'Install'); define('_AM_RSSFIT_PLUGIN_UNINSTALL', 'Uninstall'); @@ -47,7 +47,7 @@ define('_AM_RSSFIT_PLUGIN_NONE', 'You have no plugin installed'); define('_AM_RSSFIT_SUB_LIST', 'Sub-feeds'); define('_AM_RSSFIT_SUB_FILENAME_URL', 'Plug-in file name / sub-feed URL'); -define('_AM_RSSFIT_SUB_ACTIVATE', 'Activate'); +define('_AM_RSSFIT_SUB_ACTIVATE', 'Activated'); define('_AM_RSSFIT_SUB_CONFIGURE', 'Configure'); define('_AM_RSSFIT_SUB_EDIT', 'Configure sub-feed: %s'); define('_AM_RSSFIT_SUB_PLUGIN_NONE', 'Plugin not installed'); @@ -77,3 +77,5 @@ define('_AM_RSSFIT_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); define('_AM_RSSFIT_ERROR_BAD_REMOVE', 'Could not delete %s'); define('_AM_RSSFIT_ERROR_NO_PLUGIN', 'Could not load plugin'); +//1.31 +define('_AM_RSSFIT_SUB_URL', 'URL'); diff --git a/language/english/install.php b/language/english/install.php index 0022a387..a6a282fa 100644 --- a/language/english/install.php +++ b/language/english/install.php @@ -10,5 +10,5 @@ Here are the URLs for each section\'s feed: {SUB} -By the way, the RSS feed of this site is generated by RSSFit.'); +By the way, the RSS feed of this site is generated by XOOPS RSSFit.'); define('_INSTALL_INTRO_SUB', '{TITLE}: {DESC}
{URL}

'); diff --git a/language/english/modinfo.php b/language/english/modinfo.php index 93c4a95c..37456c14 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -2,7 +2,7 @@ // Module Info // The name of this module -define('_MI_RSSFIT_NAME', 'XML (RSS feed)'); +define('_MI_RSSFIT_NAME', 'RSSFit'); // A brief description of this module define('_MI_RSSFIT_DESC', 'Extendable XML news feed generator'); diff --git a/plugins/rssfit.adslight.php b/plugins/rssfit.adslight.php index 72167768..67b0771d 100644 --- a/plugins/rssfit.adslight.php +++ b/plugins/rssfit.adslight.php @@ -36,9 +36,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 / 2.3.2b / 2.4.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitAdslight @@ -66,10 +64,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/plugins/rssfit.ams.php b/plugins/rssfit.ams.php index 0c21ae63..28101b45 100644 --- a/plugins/rssfit.ams.php +++ b/plugins/rssfit.ams.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitAms @@ -64,10 +62,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { $ret = false; @include_once XOOPS_ROOT_PATH . '/modules/AMS/class/class.newsstory.php'; diff --git a/plugins/rssfit.buyersguide.php b/plugins/rssfit.buyersguide.php index 09ec8c70..78893bbf 100644 --- a/plugins/rssfit.buyersguide.php +++ b/plugins/rssfit.buyersguide.php @@ -39,9 +39,7 @@ * XOOPS version: 2.0.18.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitBuyersguide @@ -66,10 +64,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { $ret = false; include XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; diff --git a/plugins/rssfit.buyersguidemanufacturers.php b/plugins/rssfit.buyersguidemanufacturers.php index cfbfce24..7e357ebe 100644 --- a/plugins/rssfit.buyersguidemanufacturers.php +++ b/plugins/rssfit.buyersguidemanufacturers.php @@ -39,9 +39,7 @@ * XOOPS version: 2.0.18.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitBuyersguidemanufacturers @@ -66,10 +64,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { $ret = false; include XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; diff --git a/plugins/rssfit.buyersguidenews.php b/plugins/rssfit.buyersguidenews.php index 43dd074f..f1fdf4f8 100644 --- a/plugins/rssfit.buyersguidenews.php +++ b/plugins/rssfit.buyersguidenews.php @@ -39,9 +39,7 @@ * XOOPS version: 2.0.18.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitBuyersguidenews @@ -66,10 +64,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { $ret = false; include XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; diff --git a/plugins/rssfit.cbb.php b/plugins/rssfit.cbb.php index 7096ae51..25820efa 100644 --- a/plugins/rssfit.cbb.php +++ b/plugins/rssfit.cbb.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitCbb @@ -66,10 +64,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return mixed */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { @include XOOPS_ROOT_PATH . '/modules/newbb/include/functions.php'; global $xoopsDB; diff --git a/plugins/rssfit.comments.php b/plugins/rssfit.comments.php index 5bddf194..313b348b 100644 --- a/plugins/rssfit.comments.php +++ b/plugins/rssfit.comments.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitComments @@ -64,10 +62,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { $ret = false; include_once XOOPS_ROOT_PATH . '/include/comment_constants.php'; diff --git a/plugins/rssfit.extcal.php b/plugins/rssfit.extcal.php index 5493d6e8..62d1d16f 100644 --- a/plugins/rssfit.extcal.php +++ b/plugins/rssfit.extcal.php @@ -54,9 +54,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitExtcal @@ -84,10 +82,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/plugins/rssfit.lexikon.php b/plugins/rssfit.lexikon.php index aae21346..7c1bb6da 100644 --- a/plugins/rssfit.lexikon.php +++ b/plugins/rssfit.lexikon.php @@ -38,9 +38,7 @@ * XOOPS verson: 2.0.13.2 / 2.2.3 (!) */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class Rssfitlexikon @@ -67,10 +65,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/plugins/rssfit.myalbum.php b/plugins/rssfit.myalbum.php index 6bc3ea84..40141323 100644 --- a/plugins/rssfit.myalbum.php +++ b/plugins/rssfit.myalbum.php @@ -54,9 +54,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitMyalbum @@ -111,10 +109,10 @@ public function myGetUnameFromId($uid) } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); @@ -128,6 +126,7 @@ public function &grabEntries(&$obj) $sql .= $xoopsDB->prefix('myalbum_cat') . ' c '; $sql .= 'WHERE p.status > 0 AND p.cid = c.cid AND p.lid = t.lid '; $sql .= 'ORDER BY date DESC'; + /** @var mysqli_result $result */ $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { $link = XOOPS_URL . '/modules/' . $this->dirname . '/photo.php?lid=' . $row['lid']; diff --git a/plugins/rssfit.mydownloads.php b/plugins/rssfit.mydownloads.php index d28881a0..1d14ba5e 100644 --- a/plugins/rssfit.mydownloads.php +++ b/plugins/rssfit.mydownloads.php @@ -38,9 +38,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitMydownloads @@ -65,10 +63,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/plugins/rssfit.mylinks.php b/plugins/rssfit.mylinks.php index 3b3ee0fa..d1b0b2ec 100644 --- a/plugins/rssfit.mylinks.php +++ b/plugins/rssfit.mylinks.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitMylinks @@ -64,10 +62,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/plugins/rssfit.mytube.php b/plugins/rssfit.mytube.php index 892445ea..a538918b 100644 --- a/plugins/rssfit.mytube.php +++ b/plugins/rssfit.mytube.php @@ -38,9 +38,7 @@ * XOOPS version: 2.0.18.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitMytube @@ -65,10 +63,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/plugins/rssfit.newbb.php b/plugins/rssfit.newbb.php index bd15ae38..30381932 100644 --- a/plugins/rssfit.newbb.php +++ b/plugins/rssfit.newbb.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitNewbb @@ -67,10 +65,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; include_once XOOPS_ROOT_PATH . '/modules/' . $this->dirname . '/class/class.forumposts.php'; diff --git a/plugins/rssfit.newbb2.php b/plugins/rssfit.newbb2.php index 95db2673..2a188025 100644 --- a/plugins/rssfit.newbb2.php +++ b/plugins/rssfit.newbb2.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitNewbb2 @@ -97,10 +95,10 @@ public function myGetUnameFromId($uid) } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { @include XOOPS_ROOT_PATH . '/modules/newbb/include/functions.php'; global $xoopsDB, $config_handler; diff --git a/plugins/rssfit.news.php b/plugins/rssfit.news.php index 3e52cde3..66d3b2f6 100644 --- a/plugins/rssfit.news.php +++ b/plugins/rssfit.news.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitNews @@ -65,10 +63,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { $ret = false; @include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; diff --git a/plugins/rssfit.oledrion.php b/plugins/rssfit.oledrion.php index 7a0da6af..acdb3d72 100644 --- a/plugins/rssfit.oledrion.php +++ b/plugins/rssfit.oledrion.php @@ -19,9 +19,7 @@ * **************************************************************************** */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitOledrion @@ -46,10 +44,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { $ret = false; include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; diff --git a/plugins/rssfit.pical.php b/plugins/rssfit.pical.php index e57c94f0..9c0a532c 100644 --- a/plugins/rssfit.pical.php +++ b/plugins/rssfit.pical.php @@ -38,9 +38,7 @@ * XOOPS version: 2.0.18.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitpiCal @@ -65,10 +63,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/plugins/rssfit.pluginsample.php b/plugins/rssfit.pluginsample.php index aae69135..6475d0da 100644 --- a/plugins/rssfit.pluginsample.php +++ b/plugins/rssfit.pluginsample.php @@ -54,9 +54,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitSample @@ -84,10 +82,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/plugins/rssfit.publisher.php b/plugins/rssfit.publisher.php index 652b736b..10ebfb0d 100644 --- a/plugins/rssfit.publisher.php +++ b/plugins/rssfit.publisher.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitPublisher @@ -64,10 +62,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { $ret = false; include XOOPS_ROOT_PATH . '/modules/publisher/include/common.php'; diff --git a/plugins/rssfit.queries.php b/plugins/rssfit.queries.php index 17991c4e..97fc5ea3 100644 --- a/plugins/rssfit.queries.php +++ b/plugins/rssfit.queries.php @@ -38,9 +38,7 @@ * XOOPS version: 2.5.9 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitQueries @@ -68,10 +66,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/plugins/rssfit.rmdp.php b/plugins/rssfit.rmdp.php index 7ed79a1d..f104eb35 100644 --- a/plugins/rssfit.rmdp.php +++ b/plugins/rssfit.rmdp.php @@ -37,9 +37,7 @@ * RSSFit version: 1.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class Rssfitrmdp @@ -67,10 +65,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return array */ - public function grabEntries(&$obj) + public function grabEntries($obj=null) { global $xoopsDB, $moduleperm_handler; $ret = []; diff --git a/plugins/rssfit.smartfaq.php b/plugins/rssfit.smartfaq.php index 392dbeb5..b624b0a8 100644 --- a/plugins/rssfit.smartfaq.php +++ b/plugins/rssfit.smartfaq.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitSmartfaq @@ -64,10 +62,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { $ret = false; @include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; diff --git a/plugins/rssfit.smartpartner.php b/plugins/rssfit.smartpartner.php index 68179b57..0d5a7e17 100644 --- a/plugins/rssfit.smartpartner.php +++ b/plugins/rssfit.smartpartner.php @@ -38,9 +38,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitSmartpartner @@ -65,10 +63,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { $ret = false; include XOOPS_ROOT_PATH . '/modules/smartpartner/include/common.php'; diff --git a/plugins/rssfit.smartsection.php b/plugins/rssfit.smartsection.php index 3e70f48d..e9b4885c 100644 --- a/plugins/rssfit.smartsection.php +++ b/plugins/rssfit.smartsection.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitSmartsection @@ -64,10 +62,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { $ret = false; include XOOPS_ROOT_PATH . '/modules/smartsection/include/common.php'; diff --git a/plugins/rssfit.special.php b/plugins/rssfit.special.php index a901ec54..aaadde35 100644 --- a/plugins/rssfit.special.php +++ b/plugins/rssfit.special.php @@ -53,9 +53,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitSpecial @@ -83,10 +81,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return array */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $ret = []; diff --git a/plugins/rssfit.surnames.php b/plugins/rssfit.surnames.php index c6c4f9e8..1db49eb1 100644 --- a/plugins/rssfit.surnames.php +++ b/plugins/rssfit.surnames.php @@ -38,9 +38,7 @@ * XOOPS version: 2.5.9 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitSurnames @@ -95,10 +93,10 @@ public function myGetUnameFromId($uid) } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/plugins/rssfit.weblinks.php b/plugins/rssfit.weblinks.php index 0a22117b..ed47ea3a 100644 --- a/plugins/rssfit.weblinks.php +++ b/plugins/rssfit.weblinks.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitWeblinks @@ -91,10 +89,10 @@ public function myGetUnameFromId($uid) } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/plugins/rssfit.wfdownloads.php b/plugins/rssfit.wfdownloads.php index 60765135..8419c01e 100644 --- a/plugins/rssfit.wfdownloads.php +++ b/plugins/rssfit.wfdownloads.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class Rssfitwfdownloads @@ -66,10 +64,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/plugins/rssfit.wfdownloads_podcast.php b/plugins/rssfit.wfdownloads_podcast.php index 09778890..144800cd 100644 --- a/plugins/rssfit.wfdownloads_podcast.php +++ b/plugins/rssfit.wfdownloads_podcast.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.14 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class Rssfitwfdownloads_podcast @@ -66,10 +64,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/plugins/rssfit.wflinks.php b/plugins/rssfit.wflinks.php index 2fe4bab4..8db08ec3 100644 --- a/plugins/rssfit.wflinks.php +++ b/plugins/rssfit.wflinks.php @@ -13,9 +13,7 @@ * Version : 1.03 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitWflinks @@ -43,10 +41,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return array */ - public function grabEntries(&$obj) + public function grabEntries($obj=null) { global $xoopsDB, $xoopsUser; diff --git a/plugins/rssfit.wfsection.php b/plugins/rssfit.wfsection.php index d9b303df..9c06a196 100644 --- a/plugins/rssfit.wfsection.php +++ b/plugins/rssfit.wfsection.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitWfsection @@ -67,10 +65,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { @include_once XOOPS_ROOT_PATH . '/modules/wfsection/include/groupaccess.php'; global $xoopsDB; diff --git a/plugins/rssfit.wfsection2.php b/plugins/rssfit.wfsection2.php index c8cb65a0..036da863 100644 --- a/plugins/rssfit.wfsection2.php +++ b/plugins/rssfit.wfsection2.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); /** * Class RssfitWfsection2 @@ -64,10 +62,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { @include_once XOOPS_ROOT_PATH . '/modules/wfsection/class/common.php'; @include_once XOOPS_ROOT_PATH . '/modules/wfsection/class/wfsarticle.php'; diff --git a/plugins/rssfit.xoopstube.php b/plugins/rssfit.xoopstube.php index 105edd6d..09a0e766 100644 --- a/plugins/rssfit.xoopstube.php +++ b/plugins/rssfit.xoopstube.php @@ -38,9 +38,8 @@ * XOOPS version: 2.0.18.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} +defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); + /** * Class RssfitXoopstube @@ -65,10 +64,10 @@ public function loadModule() } /** - * @param $obj + * @param null $obj * @return bool */ - public function &grabEntries(&$obj) + public function &grabEntries($obj=null) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); From c7492d2302582c6977925992805e05d6f86a7830 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 29 Mar 2018 18:51:00 -0400 Subject: [PATCH 044/154] updates Signed-off-by: mambax7 --- README.md | 2 +- admin/about.php | 6 ++-- admin/admin_footer.php | 2 +- admin/admin_header.php | 2 +- admin/do_channel.php | 41 +++++++++++++------------- admin/do_intro.php | 18 +++++------ admin/do_plugins.php | 27 +++++++++-------- admin/do_sticky.php | 18 +++++------ admin/do_subfeeds.php | 37 ++++++++++++----------- admin/index.php | 18 +++++------ admin/menu.php | 6 ++-- class/misc.php | 14 ++++----- class/plugins.php | 16 +++++----- class/rssfeed.php | 20 ++++++------- include/common.php | 2 +- include/install.php | 24 +++++++-------- index.php | 4 +-- plugins/rssfit.adslight.php | 2 +- plugins/rssfit.ams.php | 2 +- plugins/rssfit.cbb.php | 2 +- plugins/rssfit.comments.php | 6 ++-- plugins/rssfit.lexikon.php | 2 +- plugins/rssfit.myalbum.php | 6 ++-- plugins/rssfit.mydownloads.php | 2 +- plugins/rssfit.mylinks.php | 2 +- plugins/rssfit.mytube.php | 2 +- plugins/rssfit.newbb.php | 4 +-- plugins/rssfit.newbb2.php | 6 ++-- plugins/rssfit.news.php | 4 +-- plugins/rssfit.pical.php | 2 +- plugins/rssfit.pluginsample.php | 2 +- plugins/rssfit.queries.php | 2 +- plugins/rssfit.rmdp.php | 2 +- plugins/rssfit.smartfaq.php | 11 ++++--- plugins/rssfit.special.php | 2 +- plugins/rssfit.surnames.php | 6 ++-- plugins/rssfit.weblinks.php | 6 ++-- plugins/rssfit.wfdownloads.php | 2 +- plugins/rssfit.wfdownloads_podcast.php | 2 +- plugins/rssfit.wflinks.php | 2 +- plugins/rssfit.wfsection.php | 4 +-- plugins/rssfit.wfsection2.php | 10 +++++-- plugins/rssfit.xoopstube.php | 2 +- rss.php | 25 +++++++++------- testdata/index.php | 2 +- xoops_version.php | 28 +++++++++--------- 46 files changed, 212 insertions(+), 195 deletions(-) diff --git a/README.md b/README.md index a1b20be5..d934d3de 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ ![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png) ## RSSFit module for [XOOPS CMS 2.5.9+](https://xoops.org) [![XOOPS CMS Module](https://img.shields.io/badge/XOOPS%20CMS-Module-blue.svg)](https://xoops.org) -[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](LICENSE) +[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html) [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/XoopsModules25x/rss.svg?style=flat)](https://scrutinizer-ci.com/g/XoopsModules25x/rss/?branch=master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/95b12220e0ac4056b9af52af708379c9)](https://www.codacy.com/app/mambax7/rss_2) diff --git a/admin/about.php b/admin/about.php index 4415aa87..f343645d 100644 --- a/admin/about.php +++ b/admin/about.php @@ -12,14 +12,14 @@ use Xmf\Module\Admin; /** - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package * @since * @author XOOPS Development Team */ -include_once __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; $moduleAdmin = Admin::getInstance(); @@ -27,4 +27,4 @@ Admin::setPaypal('xoopsfoundation@gmail.com'); $moduleAdmin->displayAbout(false); -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_footer.php b/admin/admin_footer.php index 8546fcad..f317cca3 100644 --- a/admin/admin_footer.php +++ b/admin/admin_footer.php @@ -10,7 +10,7 @@ */ /** - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package * @since diff --git a/admin/admin_header.php b/admin/admin_header.php index f5c967f8..b7c0201d 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -10,7 +10,7 @@ */ /** - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package * @since diff --git a/admin/do_channel.php b/admin/do_channel.php index b472875b..409964e8 100644 --- a/admin/do_channel.php +++ b/admin/do_channel.php @@ -33,6 +33,7 @@ ############################################################################### use Xmf\Request; +use XoopsModules\rss; if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); @@ -40,31 +41,31 @@ switch ($op) { default: - $elements = $rss->mHandler->getObjects(new Criteria('misc_category', 'channel'), '*', 'title'); - $img = $rss->mHandler->getObjects(new Criteria('misc_category', 'channelimg'), '*', 'title'); + $elements = $rss->mHandler->getObjects(new \Criteria('misc_category', 'channel'), '*', 'title'); + $img = $rss->mHandler->getObjects(new \Criteria('misc_category', 'channelimg'), '*', 'title'); if (!empty($elements) && !empty($img)) { - $form = new XoopsThemeForm(_AM_EDIT_CHANNEL, 'editchannel', RSSFIT_ADMIN_URL); - $form->addElement(new XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_REQUIRED . ' ' . genSpecMoreInfo('req', $rss))); - $form->addElement(new XoopsFormText('title', 'ele[' . $elements['title']->getVar('misc_id') . ']', 50, 255, $elements['title']->getVar('misc_content', 'e')), true); - $form->addElement(new XoopsFormText('link', 'ele[' . $elements['link']->getVar('misc_id') . ']', 50, 255, $elements['link']->getVar('misc_content', 'e')), true); - $form->addElement(new XoopsFormTextArea('description', 'ele[' . $elements['description']->getVar('misc_id') . ']', $elements['description']->getVar('misc_content', 'e')), true); + $form = new \XoopsThemeForm(_AM_EDIT_CHANNEL, 'editchannel', RSSFIT_ADMIN_URL); + $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_REQUIRED . ' ' . rss\Utility::genSpecMoreInfo('req', $rss))); + $form->addElement(new \XoopsFormText('title', 'ele[' . $elements['title']->getVar('misc_id') . ']', 50, 255, $elements['title']->getVar('misc_content', 'e')), true); + $form->addElement(new \XoopsFormText('link', 'ele[' . $elements['link']->getVar('misc_id') . ']', 50, 255, $elements['link']->getVar('misc_content', 'e')), true); + $form->addElement(new \XoopsFormTextArea('description', 'ele[' . $elements['description']->getVar('misc_id') . ']', $elements['description']->getVar('misc_content', 'e')), true); - $form->addElement(new XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_OPTIONAL . ' ' . genSpecMoreInfo('opt', $rss))); - $form->addElement(new XoopsFormText('copyright', 'ele[' . $elements['copyright']->getVar('misc_id') . ']', 50, 255, $elements['copyright']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormText('managingEditor', 'ele[' . $elements['managingEditor']->getVar('misc_id') . ']', 50, 255, $elements['managingEditor']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormText('webMaster', 'ele[' . $elements['webMaster']->getVar('misc_id') . ']', 50, 255, $elements['webMaster']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormText('category', 'ele[' . $elements['category']->getVar('misc_id') . ']', 50, 255, $elements['category']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormText('generator', 'ele[' . $elements['generator']->getVar('misc_id') . ']', 50, 255, $elements['generator']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormText('docs', 'ele[' . $elements['docs']->getVar('misc_id') . ']', 50, 255, $elements['docs']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_OPTIONAL . ' ' . rss\Utility::genSpecMoreInfo('opt', $rss))); + $form->addElement(new \XoopsFormText('copyright', 'ele[' . $elements['copyright']->getVar('misc_id') . ']', 50, 255, $elements['copyright']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormText('managingEditor', 'ele[' . $elements['managingEditor']->getVar('misc_id') . ']', 50, 255, $elements['managingEditor']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormText('webMaster', 'ele[' . $elements['webMaster']->getVar('misc_id') . ']', 50, 255, $elements['webMaster']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormText('category', 'ele[' . $elements['category']->getVar('misc_id') . ']', 50, 255, $elements['category']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormText('generator', 'ele[' . $elements['generator']->getVar('misc_id') . ']', 50, 255, $elements['generator']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormText('docs', 'ele[' . $elements['docs']->getVar('misc_id') . ']', 50, 255, $elements['docs']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_IMAGE . ' ' . genSpecMoreInfo('img', $rss))); - $form->addElement(new XoopsFormText('url', 'ele[' . $img['url']->getVar('misc_id') . ']', 50, 255, $img['url']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormText('link', 'ele[' . $img['link']->getVar('misc_id') . ']', 50, 255, $img['link']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormText('title', 'ele[' . $img['title']->getVar('misc_id') . ']', 50, 255, $img['title']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_IMAGE . ' ' . rss\Utility::genSpecMoreInfo('img', $rss))); + $form->addElement(new \XoopsFormText('url', 'ele[' . $img['url']->getVar('misc_id') . ']', 50, 255, $img['url']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormText('link', 'ele[' . $img['link']->getVar('misc_id') . ']', 50, 255, $img['link']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormText('title', 'ele[' . $img['title']->getVar('misc_id') . ']', 50, 255, $img['title']->getVar('misc_content', 'e'))); $form->addElement($tray_save_cancel); $form->addElement($hidden_do); - $form->addElement(new XoopsFormHidden('op', 'save')); + $form->addElement(new \XoopsFormHidden('op', 'save')); $form->display(); } else { echo '

' . _AM_DB_RECORD_MISSING . '

'; @@ -75,7 +76,7 @@ $ids = array_keys($ele); $errors = []; foreach ($ids as $i) { - $criteria = new Criteria('misc_id', $i); + $criteria = new \Criteria('misc_id', $i); $fields = ['misc_content' => trim($ele[$i])]; if ($err = $rss->mHandler->modifyObjects($criteria, $fields)) { $errors[] = $err; diff --git a/admin/do_intro.php b/admin/do_intro.php index 10e4436a..85ec2dda 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -36,7 +36,7 @@ header('Location: index.php'); } -if ($intr = $miscHandler->getObjects(new Criteria('misc_category', 'intro'))) { +if ($intr = $miscHandler->getObjects(new \Criteria('misc_category', 'intro'))) { $intro = $intr[0]; unset($intr); } else { @@ -44,30 +44,30 @@ } switch ($op) { default: - $title = new XoopsFormText(_AM_EDIT_INTRO_TITLE, 'title', 50, 255, $intro->getVar('misc_title', 'e')); + $title = new \XoopsFormText(_AM_EDIT_INTRO_TITLE, 'title', 50, 255, $intro->getVar('misc_title', 'e')); $title->setDescription(_AM_EDIT_INTRO_TITLE_DESC); $setting = $intro->getVar('misc_setting'); - $tray_content = new XoopsFormElementTray(_AM_EDIT_INTRO_TEXT, '
'); + $tray_content = new \XoopsFormElementTray(_AM_EDIT_INTRO_TEXT, '
'); $tray_content->setDescription(_AM_EDIT_INTRO_TEXT_DESC . _AM_EDIT_INTRO_TEXT_DESC_SUB); - $tray_content->addElement(new XoopsFormDhtmlTextArea('', 'content', $intro->getVar('misc_content', 'e'), 15, 60)); - $dohtml = new XoopsFormCheckbox('', 'dohtml', $setting['dohtml']); + $tray_content->addElement(new \XoopsFormDhtmlTextArea('', 'content', $intro->getVar('misc_content', 'e'), 15, 60)); + $dohtml = new \XoopsFormCheckbox('', 'dohtml', $setting['dohtml']); $dohtml->addOption(1, _AM_DO_HTML); $tray_content->addElement($dohtml); - $dobr = new XoopsFormCheckbox('', 'dobr', $setting['dobr']); + $dobr = new \XoopsFormCheckbox('', 'dobr', $setting['dobr']); $dobr->addOption(1, _AM_DO_BR); $tray_content->addElement($dobr); - $sub = new XoopsFormTextArea(_AM_EDIT_INTRO_SUB, 'sub', $myts->makeTboxData4PreviewInForm($setting['sub'])); + $sub = new \XoopsFormTextArea(_AM_EDIT_INTRO_SUB, 'sub', $myts->htmlSpecialChars($myts->stripSlashesGPC($setting['sub']))); $sub->setDescription(_AM_EDIT_INTRO_SUB_DESC); - $form = new XoopsThemeForm(_AM_EDIT_INTRO, 'editintro', RSSFIT_ADMIN_URL); + $form = new \XoopsThemeForm(_AM_EDIT_INTRO, 'editintro', RSSFIT_ADMIN_URL); $form->addElement($title); $form->addElement($tray_content); $form->addElement($sub); $form->addElement($tray_save_cancel); $form->addElement($hidden_do); - $form->addElement(new XoopsFormHidden('op', 'save')); + $form->addElement(new \XoopsFormHidden('op', 'save')); $form->display(); break; diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 1adb9c99..325219b1 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -33,6 +33,9 @@ ############################################################################### use Xmf\Request; +use XoopsModules\Rss; +/** @var Rss\Helper $helper */ +$helper = Rss\Helper::getInstance(); if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); @@ -42,7 +45,7 @@ default: $ret = ''; // activated plugins - $criteria = new Criteria('rssf_activated', 1); + $criteria = new \Criteria('rssf_activated', 1); if ($plugins = $pluginsHandler->getObjects($criteria, 'p_activated')) { $ret .= "
\n" + . "
\n" . $tray_save_cancel->render() . "\n" . $hidden->render() . "\n" . $hidden_do->render() . "\n
"; echo $ret; From fa963fe5ef80a796feb75db24409063c060963ba Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 22 Dec 2017 14:11:32 -0500 Subject: [PATCH 032/154] added Publisher Plugin --- plugins/rssfit.publisher.php | 78 ++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 plugins/rssfit.publisher.php diff --git a/plugins/rssfit.publisher.php b/plugins/rssfit.publisher.php new file mode 100644 index 00000000..9c6786d1 --- /dev/null +++ b/plugins/rssfit.publisher.php @@ -0,0 +1,78 @@ + ## +############################################################################### +## XOOPS - PHP Content Management System ## +## Copyright (c) 2000 XOOPS.org ## +## ## +############################################################################### +## This program is free software; you can redistribute it and/or modify ## +## it under the terms of the GNU General Public License as published by ## +## the Free Software Foundation; either version 2 of the License, or ## +## (at your option) any later version. ## +## ## +## 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. See the ## +## GNU General Public License for more details. ## +## ## +## You should have received a copy of the GNU General Public License ## +## along with this program; if not, write to the Free Software ## +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## +############################################################################### +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: SmartSection +* Version: 1.0.4 Beta 2 / 1.1 Beta 1 / 1.05 Beta 1 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} +class RssfitPublisher +{ + public $dirname = 'publisher'; + public $modname; + public $grab; + + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + return $mod; + } + + public function &grabEntries(&$obj) + { + $ret = false; + include XOOPS_ROOT_PATH . '/modules/publisher/include/common.php'; + $publisherHelper = Xmf\Module\Helper::getHelper('publisher'); + $publisherItemHandler = $publisherHelper->getHandler('item'); + $items = $publisherItemHandler->getAllPublished($this->grab, 0); + if (false !== $items && count($items) > 0) { + for ($i=0, $iMax = count($items); $i < $iMax; $i++) { + $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); + $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); + $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); + $ret[$i]['description'] = $items[$i]->getVar('summary'); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + } + } + return $ret; + } +} From 09e5c509b712fe63907bbbd445bb90e9f38dd107 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 22 Dec 2017 14:14:19 -0500 Subject: [PATCH 033/154]
cosmetics --- admin/admin_footer.php | 13 ++++++------- admin/do_channel.php | 2 +- admin/do_intro.php | 2 +- admin/do_plugins.php | 10 +++++----- admin/do_sticky.php | 2 +- admin/index.php | 2 +- admin/menu.php | 13 +++++++------ class/misc.php | 4 ++-- class/plugins.php | 4 ++-- class/rssfeed.php | 2 +- docs/changelog.txt | 2 ++ include/install.php | 6 +++--- language/english/admin.php | 6 +++--- language/english/help/help.tpl | 4 ++-- language/english/install.php | 2 +- plugins/rssfit.adslight.php | 2 +- plugins/rssfit.ams.php | 2 +- plugins/rssfit.cbb.php | 2 +- plugins/rssfit.extcal.php | 4 ++-- plugins/rssfit.lexikon.php | 2 +- plugins/rssfit.myalbum.php | 4 ++-- plugins/rssfit.mydownloads.php | 2 +- plugins/rssfit.mylinks.php | 2 +- plugins/rssfit.mytube.php | 2 +- plugins/rssfit.newbb.php | 2 +- plugins/rssfit.newbb2.php | 4 ++-- plugins/rssfit.news.php | 2 +- plugins/rssfit.pical.php | 2 +- plugins/rssfit.pluginsample.php | 2 +- plugins/rssfit.queries.php | 2 +- plugins/rssfit.special.php | 2 +- plugins/rssfit.surnames.php | 6 +++--- plugins/rssfit.weblinks.php | 6 +++--- plugins/rssfit.wfdownloads.php | 2 +- plugins/rssfit.wfdownloads_podcast.php | 2 +- plugins/rssfit.wflinks.php | 2 +- plugins/rssfit.wfsection2.php | 2 +- plugins/rssfit.xoopstube.php | 2 +- rss.php | 2 +- 39 files changed, 69 insertions(+), 67 deletions(-) diff --git a/admin/admin_footer.php b/admin/admin_footer.php index 458183dd..8546fcad 100644 --- a/admin/admin_footer.php +++ b/admin/admin_footer.php @@ -17,14 +17,13 @@ * @author XOOPS Development Team */ -global $xoopsModule; -$pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); +$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); echo "
\n" - ."
\n" - ." XOOPS\n" - ."
\n" - . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" - . '
'; + ."
\n" + ." XOOPS\n" + ."
\n" + .' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" + .''; xoops_cp_footer(); diff --git a/admin/do_channel.php b/admin/do_channel.php index 081195a4..b472875b 100644 --- a/admin/do_channel.php +++ b/admin/do_channel.php @@ -83,7 +83,7 @@ } if (count($errors) > 0) { foreach ($errors as $e) { - echo $e . "

\n"; + echo $e . "

\n"; } } else { redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); diff --git a/admin/do_intro.php b/admin/do_intro.php index 5d56ba19..10e4436a 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -48,7 +48,7 @@ $title->setDescription(_AM_EDIT_INTRO_TITLE_DESC); $setting = $intro->getVar('misc_setting'); - $tray_content = new XoopsFormElementTray(_AM_EDIT_INTRO_TEXT, '
'); + $tray_content = new XoopsFormElementTray(_AM_EDIT_INTRO_TEXT, '
'); $tray_content->setDescription(_AM_EDIT_INTRO_TEXT_DESC . _AM_EDIT_INTRO_TEXT_DESC_SUB); $tray_content->addElement(new XoopsFormDhtmlTextArea('', 'content', $intro->getVar('misc_content', 'e'), 15, 60)); $dohtml = new XoopsFormCheckbox('', 'dohtml', $setting['dohtml']); diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 63752c7a..1adb9c99 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -82,7 +82,7 @@ // inactive plugins if ($plugins = $pluginsHandler->getObjects(new Criteria('rssf_activated', 0), 'p_inactive')) { - $ret .= "
\n\n" + $ret .= "
\n
\n" . "\n" . "\n\n" . "\n" @@ -103,7 +103,7 @@ if (count($p->getErrors()) > 0) { $ret .= '' . _ERRORS . "\n"; foreach ($p->getErrors() as $e) { - $ret .= '
' . $e; + $ret .= '
' . $e; } } else { $ret .= '' . _AM_PLUGIN_UNKNOWNERROR . ''; @@ -129,7 +129,7 @@ } } if (count($installable) > 0) { - $ret .= "
\n
" . _AM_PLUGIN_INACTIVE . "
" . _AM_PLUGIN_FILENAME . "" . _AM_PLUGIN_MODNAME . "
\n" + $ret .= "
\n
\n" . "\n" . "\n\n" . "\n" @@ -150,7 +150,7 @@ if (count($p->getErrors()) > 0) { $ret .= '' . _ERRORS . "\n"; foreach ($p->getErrors() as $e) { - $ret .= '
' . $e; + $ret .= '
' . $e; } } else { $ret .= '' . _AM_PLUGIN_UNKNOWNERROR . ''; @@ -167,7 +167,7 @@ if (!empty($ret)) { $hidden = new XoopsFormHidden('op', 'save'); $ret = "\n" . $ret - . "
" . _AM_PLUGIN_NONINSTALLED . "
" . _AM_PLUGIN_FILENAME . "" . _AM_PLUGIN_MODNAME . "
\n" + . "
\n" . $tray_save_cancel->render() . "\n" . $hidden->render() . "\n" . $hidden_do->render() . "\n
"; echo $ret; diff --git a/admin/do_sticky.php b/admin/do_sticky.php index 5f1339ac..a1d61b6c 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -48,7 +48,7 @@ $title = new XoopsFormText(_AM_STICKY_TITLE, 'title', 50, 255, $sticky->getVar('misc_title', 'e')); $title->setDescription(_AM_EDIT_INTRO_TITLE_DESC); - $tray_content = new XoopsFormElementTray(_AM_STICKY_CONTENT, '
'); + $tray_content = new XoopsFormElementTray(_AM_STICKY_CONTENT, '
'); $tray_content->setDescription(_AM_EDIT_INTRO_TEXT_DESC); $content = new XoopsFormTextArea('', 'content', $sticky->getVar('misc_content', 'e'), 10); $tray_content->addElement($content); diff --git a/admin/index.php b/admin/index.php index 63b9ef9b..597d5c08 100644 --- a/admin/index.php +++ b/admin/index.php @@ -40,7 +40,7 @@ $moduleAdmin->displayNavigation('?do=' . $do); require RSSFIT_ROOT_PATH.'admin/do_'.$do.'.php'; } else { - $moduleAdmin->displayNavigation('index.php'); + $moduleAdmin->displayNavigation(basename(__FILE__)); $moduleAdmin->displayIndex(); } diff --git a/admin/menu.php b/admin/menu.php index c316f1b5..102ff1c2 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -16,13 +16,15 @@ * @since * @author XOOPS Development Team */ -defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); +use Xoopsmodules\rss; + +require_once __DIR__ . '/../class/Helper.php'; +//require_once __DIR__ . '/../include/common.php'; +$helper = rss\Helper::getInstance(); // get path to icons -$pathIcon32 = ''; -if (class_exists('Xmf\Module\Admin', true)) { - $pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); -} +$pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); +$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); $adminmenu = []; @@ -71,4 +73,3 @@ 'link' => 'admin/about.php', 'icon' => $pathIcon32 . '/about.png', ]; - diff --git a/class/misc.php b/class/misc.php index ca053099..990c8bcf 100644 --- a/class/misc.php +++ b/class/misc.php @@ -189,7 +189,7 @@ public function insert(XoopsObject $obj) //, $force = false) $result = $this->db->query($sql); } if (!$result) { - $obj->setErrors('Could not store data in the database.
'.$this->db->error().' ('.$this->db->errno().')
'.$sql); + $obj->setErrors('Could not store data in the database.
'.$this->db->error().' ('.$this->db->errno().')
'.$sql); return false; } if (false === $obj->getVar($this->obj_key)) { @@ -219,7 +219,7 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) $result = $this->db->query($sql); } if (!$result) { - return 'Could not store data in the database.
'.$this->db->error().' ('.$this->db->errno().')
'.$sql; + return 'Could not store data in the database.
'.$this->db->error().' ('.$this->db->errno().')
'.$sql; } } return false; diff --git a/class/plugins.php b/class/plugins.php index 1f459cc6..41d3268e 100644 --- a/class/plugins.php +++ b/class/plugins.php @@ -136,7 +136,7 @@ public function insert(XoopsObject $obj) //, $force=false) $result = $this->db->query($sql); } if (!$result) { - $obj->setErrors('Could not store data in the database.
'.$this->db->error().' ('.$this->db->errno().')
'.$sql); + $obj->setErrors('Could not store data in the database.
'.$this->db->error().' ('.$this->db->errno().')
'.$sql); return false; } if (false === $obj->getVar($this->obj_key)) { @@ -231,7 +231,7 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) $result = $this->db->query($sql); } if (!$result) { - return 'Could not store data in the database.
'.$this->db->error().' ('.$this->db->errno().')
'.$sql; + return 'Could not store data in the database.
'.$this->db->error().' ('.$this->db->errno().')
'.$sql; } } return false; diff --git a/class/rssfeed.php b/class/rssfeed.php index 0ce68284..3bc06a07 100644 --- a/class/rssfeed.php +++ b/class/rssfeed.php @@ -74,7 +74,7 @@ class RssfeedHandler public function __construct($modConfig, $xoopsConfig, $xoopsModule) { - $this->myts = MyTextSanitizer::getInstance(); + $this->myts = \MyTextSanitizer::getInstance(); $this->rssmod = $xoopsModule; $this->pHandler = xoops_getModuleHandler('plugins'); $this->mHandler = xoops_getModuleHandler('misc'); diff --git a/docs/changelog.txt b/docs/changelog.txt index 5630b521..7e37efe7 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -15,6 +15,8 @@ - php-cs-fixer (mamba) - ENGINE fix (mamba) - update README.md (mamba) +- added URL links for active plugins in sub-feeds (mamba) +- added Publisher plugin (mamba)
1.31 Beta 1 [2017-10-24]

diff --git a/include/install.php b/include/install.php index 08a4b48d..7cebb2cc 100644 --- a/include/install.php +++ b/include/install.php @@ -40,7 +40,7 @@ function xoops_module_install_rss(XoopsModule $xoopsMod) { global $xoopsDB, $xoopsConfig; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); $intro_setting = ['dohtml' =>1, 'dobr' =>1, 'sub' =>stripslashes(_INSTALL_INTRO_SUB)]; $sql[] = 'INSERT INTO `' @@ -55,7 +55,7 @@ function xoops_module_install_rss(XoopsModule $xoopsMod) . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' =>0, 'dobr' =>0, 'feeds' => [0 =>'0'], 'link' =>XOOPS_URL])) . ')'; foreach ($sql as $s) { if (false === $xoopsDB->query($s)) { - echo ''.$xoopsDB->error().'
'.$s.'

'; + echo ''.$xoopsDB->error().'
'.$s.'

'; return false; } } @@ -89,7 +89,7 @@ function xoops_module_update_rss(XoopsModule $xoopsMod, $oldversion) . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' =>0, 'dobr' =>0, 'feeds' => [0 =>'0'], 'link' =>XOOPS_URL])) . ')'; foreach ($sql as $s) { if (false === $xoopsDB->query($s)) { - echo ''.$xoopsDB->error().'
'.$s.'

'; + echo ''.$xoopsDB->error().'
'.$s.'

'; return false; } } diff --git a/language/english/admin.php b/language/english/admin.php index 61927019..ed86a140 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -10,7 +10,7 @@ define('_AM_EDIT_INTRO_TITLE', 'Introduction title'); define('_AM_EDIT_INTRO_TITLE_DESC', '{SITENAME} will print ' . $xoopsConfig['sitename']); define('_AM_EDIT_INTRO_TEXT', 'Introduction text'); -define('_AM_EDIT_INTRO_TEXT_DESC', _AM_EDIT_INTRO_TITLE_DESC . '

{SITEURL} will print ' . XOOPS_URL . '/'); +define('_AM_EDIT_INTRO_TEXT_DESC', _AM_EDIT_INTRO_TITLE_DESC . '

{SITEURL} will print ' . XOOPS_URL . '/'); define('_AM_EDIT_PLUGIN', 'Manage Plug-ins'); define('_AM_PLUGIN_ACTIVATED', 'Activated Plug-ins'); @@ -59,9 +59,9 @@ define('_AM_STICKY_CONTENT', 'Sticky text content'); define('_AM_STICKY_LINK', 'Sticky text link'); define('_AM_STICKY_APPLYTO', 'Apply to feeds'); -define('_AM_EDIT_INTRO_TEXT_DESC_SUB', '

{SUB} will print a list of available sub-feeds'); +define('_AM_EDIT_INTRO_TEXT_DESC_SUB', '

{SUB} will print a list of available sub-feeds'); define('_AM_EDIT_INTRO_SUB', 'HTML tags for listing sub-feeds'); -define('_AM_EDIT_INTRO_SUB_DESC', "Extra tags:
{URL} (sub-feed's URL)
{TITLE} (sub-feed's title)
{DESC} (sub-feed's description)"); +define('_AM_EDIT_INTRO_SUB_DESC', "Extra tags:
{URL} (sub-feed's URL)
{TITLE} (sub-feed's title)
{DESC} (sub-feed's description)"); //1.30 define('_AM_RSSFIT_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); define('_AM_RSSFIT_UPGRADEFAILED1', "Update failed - couldn't add new fields"); diff --git a/language/english/help/help.tpl b/language/english/help/help.tpl index 3efe5ca8..a5ce7a17 100644 --- a/language/english/help/help.tpl +++ b/language/english/help/help.tpl @@ -3,8 +3,8 @@

DESCRIPTION

-

RSSFit is a module for XOOPS generates RSS 2.0 validated XML feed.
- Web masters can decide what to be display in the XML output by activating installed plug-ins

+

RSSFit is a module for XOOPS generates RSS 2.0 validated XML feed.
+ Web masters can decide what to be display in the XML output by activating installed plug-ins

INSTALL/UNINSTALL

diff --git a/language/english/install.php b/language/english/install.php index d81655a5..0022a387 100644 --- a/language/english/install.php +++ b/language/english/install.php @@ -11,4 +11,4 @@ Here are the URLs for each section\'s feed: {SUB} By the way, the RSS feed of this site is generated by RSSFit.'); -define('_INSTALL_INTRO_SUB', '{TITLE}: {DESC}
{URL}

'); +define('_INSTALL_INTRO_SUB', '{TITLE}: {DESC}
{URL}

'); diff --git a/plugins/rssfit.adslight.php b/plugins/rssfit.adslight.php index 4b741797..bac5efea 100644 --- a/plugins/rssfit.adslight.php +++ b/plugins/rssfit.adslight.php @@ -65,7 +65,7 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; $sql = 'SELECT lid, title, status, desctext, date from ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid = 'Yes' ORDER BY date DESC"; diff --git a/plugins/rssfit.ams.php b/plugins/rssfit.ams.php index 3a7f67ae..c33259cd 100644 --- a/plugins/rssfit.ams.php +++ b/plugins/rssfit.ams.php @@ -60,7 +60,7 @@ public function &grabEntries(&$obj) { $ret = false; @include_once XOOPS_ROOT_PATH.'/modules/AMS/class/class.newsstory.php'; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ams = AmsStory::getAllPublished($this->grab, 0); if (count($ams) > 0) { for ($i=0, $iMax = count($ams); $i < $iMax; $i++) { diff --git a/plugins/rssfit.cbb.php b/plugins/rssfit.cbb.php index fea5ce7b..91a23311 100644 --- a/plugins/rssfit.cbb.php +++ b/plugins/rssfit.cbb.php @@ -63,7 +63,7 @@ public function &grabEntries(&$obj) @include XOOPS_ROOT_PATH.'/modules/newbb/include/functions.php'; global $xoopsDB; $xoopsModule = $this->module; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $i = 0; $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $topicHandler = xoops_getModuleHandler('topic', 'newbb'); diff --git a/plugins/rssfit.extcal.php b/plugins/rssfit.extcal.php index 8cbb3f71..b1ed19bc 100644 --- a/plugins/rssfit.extcal.php +++ b/plugins/rssfit.extcal.php @@ -79,7 +79,7 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; @@ -110,7 +110,7 @@ public function &grabEntries(&$obj) if ('' == $desc_link) { $desc_link=$link; } - $desc = "$title
"; + $desc = "$title
"; $desc .= ''; $desc .= ""; if ('' != $address) { diff --git a/plugins/rssfit.lexikon.php b/plugins/rssfit.lexikon.php index 65e4f3ae..e2a19437 100644 --- a/plugins/rssfit.lexikon.php +++ b/plugins/rssfit.lexikon.php @@ -66,7 +66,7 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); //$perm_handler = xoops_getHandler('groupperm'); $ret = false; $i = 0; diff --git a/plugins/rssfit.myalbum.php b/plugins/rssfit.myalbum.php index f90c7506..a162b42e 100644 --- a/plugins/rssfit.myalbum.php +++ b/plugins/rssfit.myalbum.php @@ -102,7 +102,7 @@ public function myGetUnameFromId($uid) public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; // For myalbum-p with thumbs enabled @@ -132,7 +132,7 @@ public function &grabEntries(&$obj) $ret[$i]['timestamp'] = $row['date']; // 4. The item synopsis, or description, whatever $desc = '

'.$title.' '; - $desc .= 'By '.$name.' in '.$cat.'
'; + $desc .= 'By '.$name.' in '.$cat.'
'; $desc .= $myts->displayTarea($row['description']).'


'; $ret[$i]['description'] = $desc; /* diff --git a/plugins/rssfit.mydownloads.php b/plugins/rssfit.mydownloads.php index 266f469c..d0ae4e2c 100644 --- a/plugins/rssfit.mydownloads.php +++ b/plugins/rssfit.mydownloads.php @@ -61,7 +61,7 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' diff --git a/plugins/rssfit.mylinks.php b/plugins/rssfit.mylinks.php index 9135b2d8..24a437d7 100644 --- a/plugins/rssfit.mylinks.php +++ b/plugins/rssfit.mylinks.php @@ -59,7 +59,7 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' diff --git a/plugins/rssfit.mytube.php b/plugins/rssfit.mytube.php index 1743fbe1..e420da54 100644 --- a/plugins/rssfit.mytube.php +++ b/plugins/rssfit.mytube.php @@ -64,7 +64,7 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' diff --git a/plugins/rssfit.newbb.php b/plugins/rssfit.newbb.php index 315574d8..774f0149 100644 --- a/plugins/rssfit.newbb.php +++ b/plugins/rssfit.newbb.php @@ -63,7 +63,7 @@ public function &grabEntries(&$obj) { global $xoopsDB; include_once XOOPS_ROOT_PATH.'/modules/'.$this->dirname.'/class/class.forumposts.php'; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; $sql = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.nohtml, p.nosmiley, f.forum_name, t.post_text FROM '.$xoopsDB->prefix('bb_posts').' p, '.$xoopsDB->prefix('bb_forums').' f, '.$xoopsDB->prefix('bb_posts_text').' t WHERE f.forum_id = p.forum_id AND p.post_id = t.post_id AND f.forum_type != 1 ORDER BY p.post_time DESC'; diff --git a/plugins/rssfit.newbb2.php b/plugins/rssfit.newbb2.php index 6c902263..0e5ea598 100644 --- a/plugins/rssfit.newbb2.php +++ b/plugins/rssfit.newbb2.php @@ -90,7 +90,7 @@ public function &grabEntries(&$obj) @include XOOPS_ROOT_PATH.'/modules/newbb/include/functions.php'; global $xoopsDB, $config_handler; $xoopsModule = $this->module; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; $forumHandler = xoops_getModuleHandler('forum', 'newbb'); @@ -119,7 +119,7 @@ public function &grabEntries(&$obj) $ret[$i]['title'] = $this->modname . ': ' . $row['subject']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; $ret[$i]['timestamp'] = $row['post_time']; - $ret[$i]['description'] = sprintf('Posted by: %s
%s', $this->myGetUnameFromId($row['uid']), $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr'])); + $ret[$i]['description'] = sprintf('Posted by: %s
%s', $this->myGetUnameFromId($row['uid']), $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr'])); $ret[$i]['category'] = $row['forum_name']; $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/viewforum.php?forum='.$row['forum_id']; $i++; diff --git a/plugins/rssfit.news.php b/plugins/rssfit.news.php index 23d399da..f612fcc5 100644 --- a/plugins/rssfit.news.php +++ b/plugins/rssfit.news.php @@ -61,7 +61,7 @@ public function &grabEntries(&$obj) { $ret = false; @include_once XOOPS_ROOT_PATH.'/modules/news/class/class.newsstory.php'; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); if ($this->module->getVar('version') >= 130) { @include_once XOOPS_ROOT_PATH.'/modules/news/include/functions.php'; $news = NewsStory::getAllPublished($this->grab, 0, getmoduleoption('restrictindex')); diff --git a/plugins/rssfit.pical.php b/plugins/rssfit.pical.php index 675c72c2..e1de49d1 100644 --- a/plugins/rssfit.pical.php +++ b/plugins/rssfit.pical.php @@ -64,7 +64,7 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' diff --git a/plugins/rssfit.pluginsample.php b/plugins/rssfit.pluginsample.php index 8b9f3fb2..5781d4f6 100644 --- a/plugins/rssfit.pluginsample.php +++ b/plugins/rssfit.pluginsample.php @@ -79,7 +79,7 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; // The following example code grabs the latest entries from the module MyLinks diff --git a/plugins/rssfit.queries.php b/plugins/rssfit.queries.php index 2ccbb38f..8363b707 100644 --- a/plugins/rssfit.queries.php +++ b/plugins/rssfit.queries.php @@ -64,7 +64,7 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = -1; diff --git a/plugins/rssfit.special.php b/plugins/rssfit.special.php index f2492bfe..8e6aa9a2 100644 --- a/plugins/rssfit.special.php +++ b/plugins/rssfit.special.php @@ -81,7 +81,7 @@ public function &grabEntries(&$obj) global $xoopsDB; $ret = []; @include_once XOOPS_ROOT_PATH.'/modules/special/class/stuff.php'; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $items = SpecialStuff::getAllPublished($this->grab, 0); foreach ($items as $item) { $ret[] = [ diff --git a/plugins/rssfit.surnames.php b/plugins/rssfit.surnames.php index a3e1df37..2b325d05 100644 --- a/plugins/rssfit.surnames.php +++ b/plugins/rssfit.surnames.php @@ -87,7 +87,7 @@ public function myGetUnameFromId($uid) public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = -1; @@ -104,7 +104,7 @@ public function &grabEntries(&$obj) if ($lasttime==$changedate && $lastuser==$uid) { $link = XOOPS_URL.'/modules/surnames/view.php?id='.$row['id']; $surname=$row['surname']; - $desc .= "$surname
"; + $desc .= "$surname
"; } else { if ($i>=0) { $ret[$i]['description'] = $desc; @@ -124,7 +124,7 @@ public function &grabEntries(&$obj) $ret[$i]['category'] = $this->modname; $surname=$row['surname']; - $desc .= "$surname
"; + $desc .= "$surname
"; } } if ($i>$this->grab) { diff --git a/plugins/rssfit.weblinks.php b/plugins/rssfit.weblinks.php index dd345f34..ea350a31 100644 --- a/plugins/rssfit.weblinks.php +++ b/plugins/rssfit.weblinks.php @@ -82,7 +82,7 @@ public function myGetUnameFromId($uid) public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; $sql = 'SELECT lid, title, time_update, description, url, uid FROM ' . $xoopsDB->prefix('weblinks_link') . ' ORDER BY time_update DESC'; @@ -94,8 +94,8 @@ public function &grabEntries(&$obj) $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?lid='.$row['lid'].'&keywords='; $ret[$i]['link'] = $link; $ret[$i]['timestamp'] = $row['time_update']; - $desc = '

'.$title.'
'; - $desc .= 'Submitted by: '.$name.'
'; + $desc = '

'.$title.'
'; + $desc .= 'Submitted by: '.$name.'
'; $desc .= $myts->displayTarea($row['description']).'


'; $ret[$i]['description'] = $desc; $ret[$i]['guid'] = $link; diff --git a/plugins/rssfit.wfdownloads.php b/plugins/rssfit.wfdownloads.php index 864292f5..d2ad8ec3 100644 --- a/plugins/rssfit.wfdownloads.php +++ b/plugins/rssfit.wfdownloads.php @@ -61,7 +61,7 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $permHandler = xoops_getHandler('groupperm'); $ret = false; $i = 0; diff --git a/plugins/rssfit.wfdownloads_podcast.php b/plugins/rssfit.wfdownloads_podcast.php index f24ed475..0f1729aa 100644 --- a/plugins/rssfit.wfdownloads_podcast.php +++ b/plugins/rssfit.wfdownloads_podcast.php @@ -61,7 +61,7 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $permHandler = xoops_getHandler('groupperm'); $ret = false; $i = 0; diff --git a/plugins/rssfit.wflinks.php b/plugins/rssfit.wflinks.php index c0648a0f..014904db 100644 --- a/plugins/rssfit.wflinks.php +++ b/plugins/rssfit.wflinks.php @@ -46,7 +46,7 @@ public function grabEntries(&$obj) $groups = is_object($xoopsUser) ? $xoopsUser -> getGroups() : XOOPS_GROUP_ANONYMOUS; $gpermHandler = xoops_getHandler('groupperm'); - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = []; $i = 0; $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; diff --git a/plugins/rssfit.wfsection2.php b/plugins/rssfit.wfsection2.php index 0140bbea..b40a1ef0 100644 --- a/plugins/rssfit.wfsection2.php +++ b/plugins/rssfit.wfsection2.php @@ -64,7 +64,7 @@ public function &grabEntries(&$obj) $articles = WfsArticle::getAllArticle($this->grab, 0, 'online'); if (count($articles) > 0) { $xoopsModuleConfig['shortartlen'] = 0; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); for ($i=0, $iMax = count($articles); $i < $iMax; $i++) { $link = XOOPS_URL.'/modules/wfsection/article.php?articleid='.$articles[$i]->articleid(); $ret[$i]['title'] = $myts->undoHtmlSpecialChars($articles[$i]->title()); diff --git a/plugins/rssfit.xoopstube.php b/plugins/rssfit.xoopstube.php index fb043c90..815e3fdd 100644 --- a/plugins/rssfit.xoopstube.php +++ b/plugins/rssfit.xoopstube.php @@ -64,7 +64,7 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $myts = MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' diff --git a/rss.php b/rss.php index 3fd0fe8d..b4eec396 100644 --- a/rss.php +++ b/rss.php @@ -79,7 +79,7 @@ # $src = $xoopsTpl->fetch($template, $rss->cached, null); # unset($xoopsOption['template_main']); # require XOOPS_ROOT_PATH.'/header.php'; -# echo '
'; +# echo '
'; # require XOOPS_ROOT_PATH.'/footer.php'; # } From 0a3b115089eb3430d3b5c714270c0950950656b4 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 23 Dec 2017 03:40:04 -0500 Subject: [PATCH 034/154] 1.31 Beta 2 --- README.md | 14 +- admin/about.php | 2 +- admin/admin_footer.php | 11 +- admin/admin_header.php | 25 +- admin/do_channel.php | 53 ++-- admin/do_intro.php | 34 +-- admin/do_plugins.php | 166 ++++++++----- admin/do_sticky.php | 32 +-- admin/do_subfeeds.php | 132 ++++++---- admin/index.php | 25 +- admin/menu.php | 6 +- assets/images/icons/16/index.html | 2 +- assets/images/icons/32/index.html | 2 +- assets/images/icons/index.html | 2 +- assets/images/index.html | 2 +- class/Helper.php | 61 +++++ class/RssMisc.php | 73 ++++++ class/{misc.php => RssMiscHandler.php} | 141 ++++++----- class/RssPlugins.php | 67 +++++ class/{plugins.php => RssPluginsHandler.php} | 194 +++++++++------ class/{rssfeed.php => RssfeedHandler.php} | 228 ++++++++++++----- class/Utility.php | 158 ++++++++++++ class/common/Breadcrumb.php | 78 ++++++ class/common/Configurator.php | 59 +++++ class/common/FilesManagement.php | 245 +++++++++++++++++++ class/common/ServerStats.php | 76 ++++++ class/common/VersionChecks.php | 76 ++++++ class/common/index.html | 1 + class/index.html | 2 +- docs/changelog.txt | 4 + docs/index.html | 2 +- docs/lang_diff.txt | 6 +- include/common.php | 74 +++++- include/config.php | 83 +++++++ include/functions.php | 37 ++- include/index.html | 2 +- include/install.php | 151 ------------ include/oninstall.php | 137 +++++++++++ include/onuninstall.php | 81 ++++++ include/onupdate.php | 176 +++++++++++++ index.php | 22 +- language/english/admin.php | 112 ++++----- language/english/common.php | 69 ++++++ language/english/help/disclaimer.tpl | 54 ++-- language/english/help/help.tpl | 4 +- language/english/help/helpheader.tpl | 12 +- language/english/help/index.html | 2 +- language/english/index.html | 2 +- language/english/modinfo.php | 47 ++-- language/index.html | 2 +- plugins/rssfit.adslight.php | 25 +- plugins/rssfit.ams.php | 27 +- plugins/rssfit.buyersguide.php | 19 +- plugins/rssfit.buyersguidemanufacturers.php | 21 +- plugins/rssfit.buyersguidenews.php | 21 +- plugins/rssfit.cbb.php | 55 +++-- plugins/rssfit.comments.php | 47 +++- plugins/rssfit.extcal.php | 57 +++-- plugins/rssfit.lexikon.php | 26 +- plugins/rssfit.myalbum.php | 71 +++--- plugins/rssfit.mydownloads.php | 34 ++- plugins/rssfit.mylinks.php | 33 ++- plugins/rssfit.mytube.php | 37 +-- plugins/rssfit.newbb.php | 37 ++- plugins/rssfit.newbb2.php | 75 ++++-- plugins/rssfit.news.php | 33 ++- plugins/rssfit.oledrion.php | 27 +- plugins/rssfit.pical.php | 28 ++- plugins/rssfit.pluginsample.php | 29 ++- plugins/rssfit.publisher.php | 29 ++- plugins/rssfit.queries.php | 46 ++-- plugins/rssfit.rmdp.php | 29 ++- plugins/rssfit.smartfaq.php | 29 ++- plugins/rssfit.smartpartner.php | 21 +- plugins/rssfit.smartsection.php | 23 +- plugins/rssfit.special.php | 32 ++- plugins/rssfit.surnames.php | 84 ++++--- plugins/rssfit.weblinks.php | 61 +++-- plugins/rssfit.wfdownloads.php | 38 +-- plugins/rssfit.wfdownloads_podcast.php | 48 ++-- plugins/rssfit.wflinks.php | 31 ++- plugins/rssfit.wfsection.php | 43 ++-- plugins/rssfit.wfsection2.php | 35 ++- plugins/rssfit.xoopstube.php | 27 +- preloads/autoloader.php | 32 +++ preloads/core.php | 33 +++ preloads/index.html | 1 + rss.css | 132 +++++----- rss.php | 14 +- sql/index.html | 2 +- templates/index.html | 2 +- templates/rssfit_rss.tpl | 96 ++++---- testdata/index.php | 1 - xoops_version.php | 50 ++-- 94 files changed, 3360 insertions(+), 1327 deletions(-) create mode 100644 class/Helper.php create mode 100644 class/RssMisc.php rename class/{misc.php => RssMiscHandler.php} (69%) create mode 100644 class/RssPlugins.php rename class/{plugins.php => RssPluginsHandler.php} (64%) rename class/{rssfeed.php => RssfeedHandler.php} (68%) create mode 100644 class/Utility.php create mode 100644 class/common/Breadcrumb.php create mode 100644 class/common/Configurator.php create mode 100644 class/common/FilesManagement.php create mode 100644 class/common/ServerStats.php create mode 100644 class/common/VersionChecks.php create mode 100644 class/common/index.html create mode 100644 include/config.php delete mode 100644 include/install.php create mode 100644 include/oninstall.php create mode 100644 include/onuninstall.php create mode 100644 include/onupdate.php create mode 100644 language/english/common.php create mode 100644 preloads/autoloader.php create mode 100644 preloads/core.php create mode 100644 preloads/index.html diff --git a/README.md b/README.md index a1b20be5..f40e3de2 100644 --- a/README.md +++ b/README.md @@ -3,17 +3,17 @@ [![XOOPS CMS Module](https://img.shields.io/badge/XOOPS%20CMS-Module-blue.svg)](https://xoops.org) [![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](LICENSE) -[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/XoopsModules25x/rss.svg?style=flat)](https://scrutinizer-ci.com/g/XoopsModules25x/rss/?branch=master) -[![Codacy Badge](https://api.codacy.com/project/badge/Grade/95b12220e0ac4056b9af52af708379c9)](https://www.codacy.com/app/mambax7/rss_2) -[![Code Climate](https://img.shields.io/codeclimate/github/XoopsModules25x/rss.svg?style=flat)](https://codeclimate.com/github/XoopsModules25x/rss) +[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/XoopsModules25x/rssfit.svg?style=flat)](https://scrutinizer-ci.com/g/XoopsModules25x/rssfit/?branch=master) +[![Codacy Badge](https://api.codacy.com/project/badge/Grade/95b12220e0ac4056b9af52af708379c9)](https://www.codacy.com/app/mambax7/rssfit_2) +[![Code Climate](https://img.shields.io/codeclimate/github/XoopsModules25x/rssfit.svg?style=flat)](https://codeclimate.com/github/XoopsModules25x/rssfit) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/f4ebd84f-65c1-4947-afb8-319b60824d2e/mini.png)](https://insight.sensiolabs.com/projects/f4ebd84f-65c1-4947-afb8-319b60824d2e) -[![Latest Pre-Release](https://img.shields.io/github/tag/XoopsModules25x/rss.svg?style=flat)](https://github.com/XoopsModules25x/rss/tags/) -[![Latest Version](https://img.shields.io/github/release/XoopsModules25x/rss.svg?style=flat)](https://github.com/XoopsModules25x/rss/releases/) +[![Latest Pre-Release](https://img.shields.io/github/tag/XoopsModules25x/rss.svg?style=flat)](https://github.com/XoopsModules25x/rssfit/tags/) +[![Latest Version](https://img.shields.io/github/release/XoopsModules25x/rss.svg?style=flat)](https://github.com/XoopsModules25x/rssfit/releases/) **RSSFit** module for [XOOPS CMS](https://xoops.org) is a module for XOOPS generates RSS 2.0 validated XML feed. Web masters can decide what to be displayed in the XML output by activating installed plug-ins. -[![Tutorial Available](https://xoops.org/images/tutorial-available-blue.svg)](https://www.gitbook.com/book/xoops/rss-tutorial/) Tutorial: see [GitBook](https://www.gitbook.com/book/xoops/rss-tutorial/). -To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/rss-tutorial) +[![Tutorial Available](https://xoops.org/images/tutorial-available-blue.svg)](https://www.gitbook.com/book/xoops/rssfit-tutorial/) Tutorial: see [GitBook](https://www.gitbook.com/book/xoops/rssfit-tutorial/). +To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/rssfit-tutorial) [![Translations on Transifex](https://xoops.org/images/translations-transifex-blue.svg)](https://www.transifex.com/xoops) diff --git a/admin/about.php b/admin/about.php index 4415aa87..52fe4698 100644 --- a/admin/about.php +++ b/admin/about.php @@ -16,7 +16,7 @@ * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package * @since - * @author XOOPS Development Team + * @author XOOPS Development Team */ include_once __DIR__ . '/admin_header.php'; diff --git a/admin/admin_footer.php b/admin/admin_footer.php index 8546fcad..499b66df 100644 --- a/admin/admin_footer.php +++ b/admin/admin_footer.php @@ -14,16 +14,11 @@ * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package * @since - * @author XOOPS Development Team + * @author XOOPS Development Team */ -$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); +$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); -echo "
\n" - ."
\n" - ." XOOPS\n" - ."
\n" - .' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" - .'
'; +echo "
\n" . "
\n" . " XOOPS\n" . "
\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '
'; xoops_cp_footer(); diff --git a/admin/admin_header.php b/admin/admin_header.php index f5c967f8..6eedce72 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -14,31 +14,32 @@ * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package * @since - * @author XOOPS Development Team + * @author XOOPS Development Team */ +use Xoopsmodules\rssfit; + $path = dirname(dirname(dirname(__DIR__))); -require_once $path . '/mainfile.php'; -require_once $path . '/include/cp_functions.php'; require_once $path . '/include/cp_header.php'; -class_exists('\Xmf\Module\Admin') || exit('XMF is required.'); +require_once dirname(__DIR__) . '/include/common.php'; + +$moduleDirName = basename(dirname(__DIR__)); +/** @var rssfit\Helper $helper */ +$helper = rssfit\Helper::getInstance(); -global $xoopsModule; +/** @var Xmf\Module\Admin $adminObject */ +$adminObject = \Xmf\Module\Admin::getInstance(); -$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname'); +$thisModuleDir = $helper->getDirname(); // Load language files -\Xmf\Language::load('main', $thisModuleDir); -//\Xmf\Language::load('modinfo', $thisModuleDir); +$helper->loadLanguage('admin'); xoops_cp_header(); //if functions.php file exist -require_once dirname(__DIR__) . '/include/common.php'; -//require __DIR__ . '/../include/common.php'; -global $xoopsModule; +//require __DIR__ . '/../include/common.php'; -$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname'); diff --git a/admin/do_channel.php b/admin/do_channel.php index b472875b..544194b9 100644 --- a/admin/do_channel.php +++ b/admin/do_channel.php @@ -33,50 +33,51 @@ ############################################################################### use Xmf\Request; +use Xoopsmodules\rssfit; -if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { +if (!preg_match('#/rssfit/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); } switch ($op) { default: - $elements = $rss->mHandler->getObjects(new Criteria('misc_category', 'channel'), '*', 'title'); - $img = $rss->mHandler->getObjects(new Criteria('misc_category', 'channelimg'), '*', 'title'); + $elements = $rss->mHandler->getObjects(new \Criteria('misc_category', 'channel'), '*', 'title'); + $img = $rss->mHandler->getObjects(new \Criteria('misc_category', 'channelimg'), '*', 'title'); if (!empty($elements) && !empty($img)) { - $form = new XoopsThemeForm(_AM_EDIT_CHANNEL, 'editchannel', RSSFIT_ADMIN_URL); - $form->addElement(new XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_REQUIRED . ' ' . genSpecMoreInfo('req', $rss))); - $form->addElement(new XoopsFormText('title', 'ele[' . $elements['title']->getVar('misc_id') . ']', 50, 255, $elements['title']->getVar('misc_content', 'e')), true); - $form->addElement(new XoopsFormText('link', 'ele[' . $elements['link']->getVar('misc_id') . ']', 50, 255, $elements['link']->getVar('misc_content', 'e')), true); - $form->addElement(new XoopsFormTextArea('description', 'ele[' . $elements['description']->getVar('misc_id') . ']', $elements['description']->getVar('misc_content', 'e')), true); + $form = new \XoopsThemeForm(_AM_RSSFIT_EDIT_CHANNEL, 'editchannel', RSSFIT_ADMIN_URL); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_REQUIRED . ' ' . rssfit\Utility::genSpecMoreInfo('req', $rss))); + $form->addElement(new \XoopsFormText('Title', 'ele[' . $elements['title']->getVar('misc_id') . ']', 50, 255, $elements['title']->getVar('misc_content', 'e')), true); + $form->addElement(new \XoopsFormText('Link', 'ele[' . $elements['link']->getVar('misc_id') . ']', 50, 255, $elements['link']->getVar('misc_content', 'e')), true); + $form->addElement(new \XoopsFormTextArea('Description', 'ele[' . $elements['description']->getVar('misc_id') . ']', $elements['description']->getVar('misc_content', 'e')), true); - $form->addElement(new XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_OPTIONAL . ' ' . genSpecMoreInfo('opt', $rss))); - $form->addElement(new XoopsFormText('copyright', 'ele[' . $elements['copyright']->getVar('misc_id') . ']', 50, 255, $elements['copyright']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormText('managingEditor', 'ele[' . $elements['managingEditor']->getVar('misc_id') . ']', 50, 255, $elements['managingEditor']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormText('webMaster', 'ele[' . $elements['webMaster']->getVar('misc_id') . ']', 50, 255, $elements['webMaster']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormText('category', 'ele[' . $elements['category']->getVar('misc_id') . ']', 50, 255, $elements['category']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormText('generator', 'ele[' . $elements['generator']->getVar('misc_id') . ']', 50, 255, $elements['generator']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormText('docs', 'ele[' . $elements['docs']->getVar('misc_id') . ']', 50, 255, $elements['docs']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_OPTIONAL . ' ' . rssfit\Utility::genSpecMoreInfo('opt', $rss))); + $form->addElement(new \XoopsFormText('Copyright', 'ele[' . $elements['copyright']->getVar('misc_id') . ']', 50, 255, $elements['copyright']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormText('ManagingEditor', 'ele[' . $elements['managingEditor']->getVar('misc_id') . ']', 50, 255, $elements['managingEditor']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormText('WebMaster', 'ele[' . $elements['webMaster']->getVar('misc_id') . ']', 50, 255, $elements['webMaster']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormText('Category', 'ele[' . $elements['category']->getVar('misc_id') . ']', 50, 255, $elements['category']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormText('Generator', 'ele[' . $elements['generator']->getVar('misc_id') . ']', 50, 255, $elements['generator']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormText('Docs', 'ele[' . $elements['docs']->getVar('misc_id') . ']', 50, 255, $elements['docs']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_IMAGE . ' ' . genSpecMoreInfo('img', $rss))); - $form->addElement(new XoopsFormText('url', 'ele[' . $img['url']->getVar('misc_id') . ']', 50, 255, $img['url']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormText('link', 'ele[' . $img['link']->getVar('misc_id') . ']', 50, 255, $img['link']->getVar('misc_content', 'e'))); - $form->addElement(new XoopsFormText('title', 'ele[' . $img['title']->getVar('misc_id') . ']', 50, 255, $img['title']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_IMAGE . ' ' . rssfit\Utility::genSpecMoreInfo('img', $rss))); + $form->addElement(new \XoopsFormText('URL', 'ele[' . $img['url']->getVar('misc_id') . ']', 50, 255, $img['url']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormText('Link', 'ele[' . $img['link']->getVar('misc_id') . ']', 50, 255, $img['link']->getVar('misc_content', 'e'))); + $form->addElement(new \XoopsFormText('Title', 'ele[' . $img['title']->getVar('misc_id') . ']', 50, 255, $img['title']->getVar('misc_content', 'e'))); $form->addElement($tray_save_cancel); $form->addElement($hidden_do); - $form->addElement(new XoopsFormHidden('op', 'save')); + $form->addElement(new \XoopsFormHidden('op', 'save')); $form->display(); } else { - echo '

' . _AM_DB_RECORD_MISSING . '

'; + echo '

' . _AM_RSSFIT_DB_RECORD_MISSING . '

'; } break; case 'save': - $ele = Request::getArray('ele', null, 'POST'); - $ids = array_keys($ele); + $ele = Request::getArray('ele', null, 'POST'); + $ids = array_keys($ele); $errors = []; foreach ($ids as $i) { - $criteria = new Criteria('misc_id', $i); - $fields = ['misc_content' => trim($ele[$i])]; + $criteria = new \Criteria('misc_id', $i); + $fields = ['misc_content' => trim($ele[$i])]; if ($err = $rss->mHandler->modifyObjects($criteria, $fields)) { $errors[] = $err; } @@ -86,7 +87,7 @@ echo $e . "

\n"; } } else { - redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); + redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); } break; } diff --git a/admin/do_intro.php b/admin/do_intro.php index 10e4436a..ab37d84d 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -32,11 +32,11 @@ ## Project: RSSFit ## ############################################################################### -if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { +if (!preg_match('#/rssfit/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); } -if ($intr = $miscHandler->getObjects(new Criteria('misc_category', 'intro'))) { +if ($intr = $miscHandler->getObjects(new \Criteria('misc_category', 'intro'))) { $intro = $intr[0]; unset($intr); } else { @@ -44,30 +44,30 @@ } switch ($op) { default: - $title = new XoopsFormText(_AM_EDIT_INTRO_TITLE, 'title', 50, 255, $intro->getVar('misc_title', 'e')); - $title->setDescription(_AM_EDIT_INTRO_TITLE_DESC); + $title = new \XoopsFormText(_AM_RSSFIT_EDIT_INTRO_TITLE, 'title', 50, 255, $intro->getVar('misc_title', 'e')); + $title->setDescription(_AM_RSSFIT_EDIT_INTRO_TITLE_DESC); - $setting = $intro->getVar('misc_setting'); - $tray_content = new XoopsFormElementTray(_AM_EDIT_INTRO_TEXT, '
'); - $tray_content->setDescription(_AM_EDIT_INTRO_TEXT_DESC . _AM_EDIT_INTRO_TEXT_DESC_SUB); - $tray_content->addElement(new XoopsFormDhtmlTextArea('', 'content', $intro->getVar('misc_content', 'e'), 15, 60)); - $dohtml = new XoopsFormCheckbox('', 'dohtml', $setting['dohtml']); - $dohtml->addOption(1, _AM_DO_HTML); + $setting = $intro->getVar('misc_setting'); + $tray_content = new \XoopsFormElementTray(_AM_RSSFIT_EDIT_INTRO_TEXT, '
'); + $tray_content->setDescription(_AM_RSSFIT_EDIT_INTRO_TEXT_DESC . _AM_RSSFIT_EDIT_INTRO_TEXT_DESC_SUB); + $tray_content->addElement(new \XoopsFormDhtmlTextArea('', 'content', $intro->getVar('misc_content', 'e'), 15, 60)); + $dohtml = new \XoopsFormCheckbox('', 'dohtml', isset($setting['dohtml']) ?: ''); + $dohtml->addOption(1, _AM_RSSFIT_DO_HTML); $tray_content->addElement($dohtml); - $dobr = new XoopsFormCheckbox('', 'dobr', $setting['dobr']); - $dobr->addOption(1, _AM_DO_BR); + $dobr = new \XoopsFormCheckbox('', 'dobr', isset($setting['dobr']) ?: ''); + $dobr->addOption(1, _AM_RSSFIT_DO_BR); $tray_content->addElement($dobr); - $sub = new XoopsFormTextArea(_AM_EDIT_INTRO_SUB, 'sub', $myts->makeTboxData4PreviewInForm($setting['sub'])); - $sub->setDescription(_AM_EDIT_INTRO_SUB_DESC); + $sub = new \XoopsFormTextArea(_AM_RSSFIT_EDIT_INTRO_SUB, 'sub', isset($setting['dobr']) ? $myts->makeTboxData4PreviewInForm($setting['sub']) : ''); + $sub->setDescription(_AM_RSSFIT_EDIT_INTRO_SUB_DESC); - $form = new XoopsThemeForm(_AM_EDIT_INTRO, 'editintro', RSSFIT_ADMIN_URL); + $form = new \XoopsThemeForm(_AM_RSSFIT_EDIT_INTRO, 'editintro', RSSFIT_ADMIN_URL); $form->addElement($title); $form->addElement($tray_content); $form->addElement($sub); $form->addElement($tray_save_cancel); $form->addElement($hidden_do); - $form->addElement(new XoopsFormHidden('op', 'save')); + $form->addElement(new \XoopsFormHidden('op', 'save')); $form->display(); break; @@ -84,7 +84,7 @@ if (false === $miscHandler->insert($intro)) { echo $intro->getHtmlErrors(); } else { - redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); + redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); } break; } diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 1adb9c99..33c16c90 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -34,7 +34,7 @@ use Xmf\Request; -if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { +if (!preg_match('#/rssfit/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); } @@ -42,36 +42,53 @@ default: $ret = ''; // activated plugins - $criteria = new Criteria('rssf_activated', 1); + $criteria = new \Criteria('rssf_activated', 1); if ($plugins = $pluginsHandler->getObjects($criteria, 'p_activated')) { $ret .= "
When:$event_start
\n" - . "\n" - . "\n\n" - . "\n" - . "\n" - . "\n" - . "\n" - . "\n"; + . "\n" + . "\n\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n"; foreach ($plugins as $p) { if ($handler = $pluginsHandler->checkPlugin($p)) { - $id = $p->getVar('rssf_conf_id'); - $entries = new XoopsFormText('', 'rssf_grab[' . $id . ']', 3, 2, $p->getVar('rssf_grab')); - $order = new XoopsFormText('', 'rssf_order[' . $id . ']', 3, 2, $p->getVar('rssf_order')); - $action = new XoopsFormSelect('', 'action[' . $id . ']', ''); + $id = $p->getVar('rssf_conf_id'); + $entries = new \XoopsFormText('', 'rssf_grab[' . $id . ']', 3, 2, $p->getVar('rssf_grab')); + $order = new \XoopsFormText('', 'rssf_order[' . $id . ']', 3, 2, $p->getVar('rssf_order')); + $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); $action->addOption('', _SELECT); - $action->addOption('d', _AM_PLUGIN_DEACTIVATE); - $action->addOption('u', _AM_PLUGIN_UNINSTALL); + $action->addOption('d', _AM_RSSFIT_PLUGIN_DEACTIVATE); + $action->addOption('u', _AM_RSSFIT_PLUGIN_UNINSTALL); $ret .= "\n" - . "\n" - . "\n" - . "\n" - . "\n" - . "\n"; + . "\n" + . "\n" + . "\n" + . "\n" + . "\n"; $ret .= "\n"; } else { $pluginsHandler->forceDeactivate($p); @@ -81,24 +98,29 @@ } // inactive plugins - if ($plugins = $pluginsHandler->getObjects(new Criteria('rssf_activated', 0), 'p_inactive')) { + if ($plugins = $pluginsHandler->getObjects(new \Criteria('rssf_activated', 0), 'p_inactive')) { $ret .= "
\n
" . _AM_PLUGIN_ACTIVATED . "
" . _AM_PLUGIN_FILENAME . "" . _AM_PLUGIN_MODNAME . "" . _AM_PLUGIN_SHOWXENTRIES . "" . _AM_PLUGIN_ORDER . "" . _AM_ACTION . "
" + . _AM_RSSFIT_PLUGIN_ACTIVATED + . "
" + . _AM_RSSFIT_PLUGIN_FILENAME + . "" + . _AM_RSSFIT_PLUGIN_MODNAME + . "" + . _AM_RSSFIT_PLUGIN_SHOWXENTRIES + . "" + . _AM_RSSFIT_PLUGIN_ORDER + . "" + . _AM_RSSFIT_ACTION + . "
" - . $p->getVar('rssf_filename') . "" - . $handler->modname . "" - . $entries->render() . "" - . $order->render() . "" - . $action->render() . "" + . $p->getVar('rssf_filename') + . "" + . $handler->modname + . "" + . $entries->render() + . "" + . $order->render() + . "" + . $action->render() + . "
\n" - . "\n" - . "\n\n" - . "\n" - . "\n" - . "\n"; + . "\n" + . "\n\n" + . "\n" + . "\n" + . "\n"; foreach ($plugins as $p) { - $id = $p->getVar('rssf_conf_id'); - $action = new XoopsFormSelect('', 'action[' . $id . ']', ''); + $id = $p->getVar('rssf_conf_id'); + $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); $action->addOption('', _SELECT); - $ret .= "\n" - . "\n" - . "\n" . "\n" . "\n"; - $action->addOption('u', _AM_PLUGIN_UNINSTALL); - $ret .= "\n"; + $action->addOption('u', _AM_RSSFIT_PLUGIN_UNINSTALL); + $ret .= "\n"; } $ret .= "
" . _AM_PLUGIN_INACTIVE . "
" . _AM_PLUGIN_FILENAME . "" . _AM_PLUGIN_MODNAME . "" . _AM_ACTION . "
" + . _AM_RSSFIT_PLUGIN_INACTIVE + . "
" + . _AM_RSSFIT_PLUGIN_FILENAME + . "" + . _AM_RSSFIT_PLUGIN_MODNAME + . "" + . _AM_RSSFIT_ACTION + . "
" - . $p->getVar('rssf_filename') . ""; + $ret .= "
" . $p->getVar('rssf_filename') . ""; if ($handler = $pluginsHandler->checkPlugin($p)) { $ret .= $handler->modname; - $action->addOption('a', _AM_PLUGIN_ACTIVATE); + $action->addOption('a', _AM_RSSFIT_PLUGIN_ACTIVATE); } else { if (count($p->getErrors()) > 0) { $ret .= '' . _ERRORS . "\n"; @@ -106,13 +128,12 @@ $ret .= '
' . $e; } } else { - $ret .= '' . _AM_PLUGIN_UNKNOWNERROR . ''; + $ret .= '' . _AM_RSSFIT_PLUGIN_UNKNOWNERROR . ''; } } $ret .= "
" - . $action->render() . "" . $action->render() . "
\n"; } @@ -121,7 +142,7 @@ if (!$filelist =& $pluginsHandler->getPluginFileList()) { $filelist = []; } - $list = XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); + $list = XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); $installable = []; foreach ($list as $f) { if (preg_match('/rssfit\.+[a-zA-Z0-9_]+\.php/', $f) && !in_array($f, $filelist)) { @@ -130,19 +151,24 @@ } if (count($installable) > 0) { $ret .= "
\n\n" - . "\n" - . "\n\n" - . "\n" - . "\n" - . "\n"; + . "\n" + . "\n\n" + . "\n" + . "\n" + . "\n"; foreach ($installable as $i) { - $action = new XoopsFormCheckbox('', 'install[' . $i . ']'); + $action = new \XoopsFormCheckbox('', 'install[' . $i . ']'); $action->addOption('i', ' '); - $ret .= "\n" - . "\n" - . "\n" . "\n" . "\n"; - $ret .= "\n"; + $ret .= "\n"; } $ret .= "
" . _AM_PLUGIN_NONINSTALLED . "
" . _AM_PLUGIN_FILENAME . "" . _AM_PLUGIN_MODNAME . "" . _AM_PLUGIN_INSTALL . "
" + . _AM_RSSFIT_PLUGIN_NONINSTALLED + . "
" + . _AM_RSSFIT_PLUGIN_FILENAME + . "" + . _AM_RSSFIT_PLUGIN_MODNAME + . "" + . _AM_RSSFIT_PLUGIN_INSTALL + . "
" - . $i . ""; - $p = $pluginsHandler->create(); + $ret .= "
" . $i . ""; + $p = $pluginsHandler->create(); $p->setVar('rssf_filename', $i); if ($handler = $pluginsHandler->checkPlugin($p)) { $ret .= $handler->modname; @@ -153,32 +179,38 @@ $ret .= '
' . $e; } } else { - $ret .= '' . _AM_PLUGIN_UNKNOWNERROR . ''; + $ret .= '' . _AM_RSSFIT_PLUGIN_UNKNOWNERROR . ''; } $action->setExtra('disabled="disabled"'); } $ret .= "
" - . $action->render() . "" . $action->render() . "
\n"; } if (!empty($ret)) { - $hidden = new XoopsFormHidden('op', 'save'); - $ret = "
\n" . $ret - . "
\n" - . $tray_save_cancel->render() . "\n" . $hidden->render() . "\n" - . $hidden_do->render() . "\n
"; + $hidden = new \XoopsFormHidden('op', 'save'); + $ret = "
\n" + . $ret + . "
\n" + . $tray_save_cancel->render() + . "\n" + . $hidden->render() + . "\n" + . $hidden_do->render() + . "\n
"; echo $ret; } break; case 'save': - $rssf_grab = Request::getArray('rssf_grab', [], 'POST'); + $rssf_grab = Request::getArray('rssf_grab', [], 'POST'); $rssf_order = Request::getArray('rssf_order', [], 'POST'); - $action = Request::getArray('action', null, 'POST'); - $install = Request::getArray('install', array(), 'POST'); - $err = ''; + $action = Request::getArray('action', null, 'POST'); + $install = Request::getArray('install', [], 'POST'); + $err = ''; if (isset($action)) { $keys = array_keys($action); foreach ($keys as $k) { @@ -232,7 +264,7 @@ if (!empty($err)) { echo $err; } else { - redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); + redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); } break; } diff --git a/admin/do_sticky.php b/admin/do_sticky.php index a1d61b6c..70a3e98f 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -32,11 +32,11 @@ ## Project: RSSFit ## ############################################################################### -if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { +if (!preg_match('#/rssfit/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); } -if ($intr = $miscHandler->getObjects(new Criteria('misc_category', 'sticky'))) { +if ($intr = $miscHandler->getObjects(new \Criteria('misc_category', 'sticky'))) { $sticky = $intr[0]; unset($intr); } else { @@ -45,32 +45,32 @@ switch ($op) { default: $setting = $sticky->getVar('misc_setting'); - $title = new XoopsFormText(_AM_STICKY_TITLE, 'title', 50, 255, $sticky->getVar('misc_title', 'e')); - $title->setDescription(_AM_EDIT_INTRO_TITLE_DESC); + $title = new \XoopsFormText(_AM_RSSFIT_STICKY_TITLE, 'title', 50, 255, $sticky->getVar('misc_title', 'e')); + $title->setDescription(_AM_RSSFIT_EDIT_INTRO_TITLE_DESC); - $tray_content = new XoopsFormElementTray(_AM_STICKY_CONTENT, '
'); - $tray_content->setDescription(_AM_EDIT_INTRO_TEXT_DESC); - $content = new XoopsFormTextArea('', 'content', $sticky->getVar('misc_content', 'e'), 10); + $tray_content = new \XoopsFormElementTray(_AM_RSSFIT_STICKY_CONTENT, '
'); + $tray_content->setDescription(_AM_RSSFIT_EDIT_INTRO_TEXT_DESC); + $content = new \XoopsFormTextArea('', 'content', $sticky->getVar('misc_content', 'e'), 10); $tray_content->addElement($content); - $dohtml = new XoopsFormCheckbox('', 'dohtml', $setting['dohtml']); - $dohtml->addOption(1, _AM_DO_HTML); + $dohtml = new \XoopsFormCheckbox('', 'dohtml', $setting['dohtml']); + $dohtml->addOption(1, _AM_RSSFIT_DO_HTML); $tray_content->addElement($dohtml); - $dobr = new XoopsFormCheckbox('', 'dobr', $setting['dobr']); - $dobr->addOption(1, _AM_DO_BR); + $dobr = new \XoopsFormCheckbox('', 'dobr', $setting['dobr']); + $dobr->addOption(1, _AM_RSSFIT_DO_BR); $tray_content->addElement($dobr); - $link = new XoopsFormText(_AM_STICKY_LINK, 'link', 50, 255, $myts->makeTboxData4PreviewInForm($setting['link'])); + $link = new \XoopsFormText(_AM_RSSFIT_STICKY_LINK, 'link', 50, 255, $myts->makeTboxData4PreviewInForm($setting['link'])); - $applyto = $rss->feedSelectBox(_AM_STICKY_APPLYTO, $setting['feeds'], 10); + $applyto = $rss->feedSelectBox(_AM_RSSFIT_STICKY_APPLYTO, $setting['feeds'], 10); - $form = new XoopsThemeForm(_AM_STICKY_EDIT, 'editsticky', RSSFIT_ADMIN_URL); + $form = new \XoopsThemeForm(_AM_RSSFIT_STICKY_EDIT, 'editsticky', RSSFIT_ADMIN_URL); $form->addElement($title); $form->addElement($tray_content); $form->addElement($link); $form->addElement($applyto); $form->addElement($tray_save_cancel); $form->addElement($hidden_do); - $form->addElement(new XoopsFormHidden('op', 'save')); + $form->addElement(new \XoopsFormHidden('op', 'save')); $form->display(); break; @@ -93,7 +93,7 @@ if (false === $miscHandler->insert($sticky)) { echo $sticky->getHtmlErrors(); } else { - redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); + redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); } break; } diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index a2dd524c..77ccadaa 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -33,8 +33,9 @@ ############################################################################### use Xmf\Request; +use Xoopsmodules\rssfit; -if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { +if (!preg_match('#/rssfit/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); } @@ -43,44 +44,69 @@ $ret = ''; if ($plugins = $pluginsHandler->getObjects(null, 'sublist')) { $ret .= "
\n\n" - . "\n" - . "\n\n" - . "\n" - . "\n" - . "\n" - . "\n"; + . "\n" + . "\n\n" + . "\n" + . "\n" + . "\n" + . "\n"; foreach ($plugins as $p) { $id = $p->getVar('rssf_conf_id'); if (!$handler = $pluginsHandler->checkPlugin($p)) { $pluginsHandler->forceDeactivate($p); - $mod = implode('
', $p->getErrors()); - $activate = new XoopsFormCheckbox('', 'activate[' . $id . ']', 0); + $mod = implode('
', $p->getErrors()); + $activate = new \XoopsFormCheckbox('', 'activate[' . $id . ']', 0); $activate->setExtra('disabled="disabled"'); - $config = ' '; + $config = ' '; $urlLink = $rss->subFeedUrl($p->getVar('rssf_filename')); } else { - $mod = $handler->modname; - $activate = new XoopsFormCheckbox('', 'activate[' . $id . ']', $p->getVar('subfeed')); - $config = rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_SUB_CONFIGURE); - $urlLink = '' . $rss->subFeedUrl($p->getVar('rssf_filename')) .''; + $mod = $handler->modname; + $activate = new \XoopsFormCheckbox('', 'activate[' . $id . ']', $p->getVar('subfeed')); + $config = rssfit\Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_RSSFIT_SUB_CONFIGURE); + $urlLink = '' . $rss->subFeedUrl($p->getVar('rssf_filename')) . ''; } $activate->addOption(1, ' '); $ret .= "\n" - . "\n" - . "\n" - . "\n" - . "\n"; + . "\n" + . "\n" + . "\n" + . "\n"; $ret .= "\n"; } - $ret .= "
" . _AM_SUB_LIST . "
" . _AM_SUB_FILENAME_URL . "" . _AM_PLUGIN_MODNAME . "" . _AM_SUB_ACTIVATE . " 
" + . _AM_RSSFIT_SUB_LIST + . "
" + . _AM_RSSFIT_SUB_FILENAME_URL + . "" + . _AM_RSSFIT_PLUGIN_MODNAME + . "" + . _AM_RSSFIT_SUB_ACTIVATE + . " 
" . $p->getVar('rssf_filename') . '
' . $urlLink . "
" . $mod . "" . $activate->render() . "" . $config . "" + . $p->getVar('rssf_filename') + . '
' + . $urlLink + . "
" + . $mod + . "" + . $activate->render() + . "" + . $config + . "
\n"; - $hidden = new XoopsFormHidden('op', 'save'); - $ret = "
\n" . $ret - . "
\n" - . $tray_save_cancel->render() . "\n" . $hidden->render() . "\n" - . $hidden_do->render() . "\n
"; + $ret .= "
\n"; + $hidden = new \XoopsFormHidden('op', 'save'); + $ret = "
\n" + . $ret + . "
\n" + . $tray_save_cancel->render() + . "\n" + . $hidden->render() + . "\n" + . $hidden_do->render() + . "\n
"; echo $ret; } else { - echo '

' . _AM_PLUGIN_NONE . '

'; + echo '

' . _AM_RSSFIT_PLUGIN_NONE . '

'; } break; case 'save': @@ -89,13 +115,13 @@ if ($plugins = $pluginsHandler->getObjects(null, 'sublist')) { $pluginsHandler->modifyObjects(null, ['subfeed' => 0]); if (isset($activate) && is_array($activate) && count($activate) > 0) { - $keys = array_keys($activate); - $criteria = new Criteria('rssf_conf_id', '(' . implode(',', $keys) . ')', 'IN'); + $keys = array_keys($activate); + $criteria = new \Criteria('rssf_conf_id', '(' . implode(',', $keys) . ')', 'IN'); $pluginsHandler->modifyObjects($criteria, ['subfeed' => 1]); } - redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); + redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); } else { - redirect_header(RSSFIT_ADMIN_URL, 0, _AM_PLUGIN_NONE); + redirect_header(RSSFIT_ADMIN_URL, 0, _AM_RSSFIT_PLUGIN_NONE); } break; case 'edit': @@ -107,24 +133,24 @@ } } if (empty($id) || !$sub) { - redirect_header(RSSFIT_ADMIN_URL, 0, _AM_SUB_PLUGIN_NONE); + redirect_header(RSSFIT_ADMIN_URL, 0, _AM_RSSFIT_SUB_PLUGIN_NONE); } - $form = new XoopsThemeForm(sprintf(_AM_SUB_EDIT, $handler->modname), 'editsub', RSSFIT_ADMIN_URL); - $form->addElement(new XoopsFormRadioYN(_AM_SUB_ACTIVATE, 'subfeed', $sub->getVar('subfeed'))); - $form->addElement(new XoopsFormText(_AM_PLUGIN_SHOWXENTRIES, 'sub_entries', 3, 2, $sub->getVar('sub_entries')), true); + $form = new \XoopsThemeForm(sprintf(_AM_RSSFIT_SUB_EDIT, $handler->modname), 'editsub', RSSFIT_ADMIN_URL); + $form->addElement(new \XoopsFormRadioYN(_AM_RSSFIT_SUB_ACTIVATE, 'subfeed', $sub->getVar('subfeed'))); + $form->addElement(new \XoopsFormText(_AM_RSSFIT_PLUGIN_SHOWXENTRIES, 'sub_entries', 3, 2, $sub->getVar('sub_entries')), true); - $form->addElement(new XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_REQUIRED . ' ' . genSpecMoreInfo('req', $rss))); - $form->addElement(new XoopsFormText('title', 'sub_title', 50, 255, $sub->getVar('sub_title', 'e')), true); - $form->addElement(new XoopsFormText('link', 'sub_link', 50, 255, $sub->getVar('sub_link', 'e')), true); - $form->addElement(new XoopsFormTextArea('description', 'sub_desc', $sub->getVar('sub_desc', 'e')), true); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_REQUIRED . ' ' . rssfit\Utility::genSpecMoreInfo('req', $rss))); + $form->addElement(new \XoopsFormText('title', 'sub_title', 50, 255, $sub->getVar('sub_title', 'e')), true); + $form->addElement(new \XoopsFormText('link', 'sub_link', 50, 255, $sub->getVar('sub_link', 'e')), true); + $form->addElement(new \XoopsFormTextArea('description', 'sub_desc', $sub->getVar('sub_desc', 'e')), true); - $form->addElement(new XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_IMAGE . ' ' . genSpecMoreInfo('img', $rss))); - $form->addElement(new XoopsFormText('url', 'img_url', 50, 255, $sub->getVar('img_url', 'e'))); - $form->addElement(new XoopsFormText('link', 'img_link', 50, 255, $sub->getVar('img_link', 'e'))); - $form->addElement(new XoopsFormText('title', 'img_title', 50, 255, $sub->getVar('img_title', 'e'))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_IMAGE . ' ' . rssfit\Utility::genSpecMoreInfo('img', $rss))); + $form->addElement(new \XoopsFormText('url', 'img_url', 50, 255, $sub->getVar('img_url', 'e'))); + $form->addElement(new \XoopsFormText('link', 'img_link', 50, 255, $sub->getVar('img_link', 'e'))); + $form->addElement(new \XoopsFormText('title', 'img_title', 50, 255, $sub->getVar('img_title', 'e'))); - $form->addElement(new XoopsFormHidden('feed', $id)); - $form->addElement(new XoopsFormHidden('op', 'savefeed')); + $form->addElement(new \XoopsFormHidden('feed', $id)); + $form->addElement(new \XoopsFormHidden('op', 'savefeed')); $form->addElement($hidden_do); $form->addElement($tray_save_cancel); $form->display(); @@ -138,19 +164,19 @@ } } if (empty($id) || !$sub || !$handler) { - redirect_header(RSSFIT_ADMIN_URL, 0, _AM_SUB_PLUGIN_NONE); + redirect_header(RSSFIT_ADMIN_URL, 0, _AM_RSSFIT_SUB_PLUGIN_NONE); } - $subfeed = Request::getBool('subfeed', false, 'POST'); + $subfeed = Request::getBool('subfeed', false, 'POST'); $sub_entries = Request::getInt('sub_entries', 5, 'POST'); - $sub_title = Request::getString('sub_title', '', 'POST'); - $sub_link = Request::getUrl('sub_link', '', 'POST'); - $sub_desc = Request::getString('sub_desc', '', 'POST'); - $img_url = Request::getUrl('img_url', '', 'POST'); - $img_link = Request::getUrl('img_link', '', 'POST'); - $img_title = Request::getString('img_title', '', 'POST'); + $sub_title = Request::getString('sub_title', '', 'POST'); + $sub_link = Request::getUrl('sub_link', '', 'POST'); + $sub_desc = Request::getString('sub_desc', '', 'POST'); + $img_url = Request::getUrl('img_url', '', 'POST'); + $img_link = Request::getUrl('img_link', '', 'POST'); + $img_title = Request::getString('img_title', '', 'POST'); - $sub->setVar('subfeed', (int) $subfeed); + $sub->setVar('subfeed', (int)$subfeed); $sub->setVar('sub_entries', $sub_entries); $sub->setVar('sub_title', $sub_title); $sub->setVar('sub_link', $sub_link); @@ -159,7 +185,7 @@ $sub->setVar('img_link', $img_link); $sub->setVar('img_title', $img_title); if (false !== $pluginsHandler->insert($sub)) { - redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); + redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); } else { echo $sub->getHtmlErrors(); } diff --git a/admin/index.php b/admin/index.php index 597d5c08..1f092d84 100644 --- a/admin/index.php +++ b/admin/index.php @@ -19,29 +19,28 @@ * @author XOOPS Development Team */ - include_once __DIR__ . '/admin_header.php'; -$moduleAdmin = \Xmf\Module\Admin::getInstance(); +$adminObject = \Xmf\Module\Admin::getInstance(); $do = Request::getString('do', ''); $op = Request::getString('op', 'list'); define('RSSFIT_OK', 1); -if (file_exists(RSSFIT_ROOT_PATH.'admin/do_'.$do.'.php')) { - include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; - $hidden_do = new XoopsFormHidden('do', $do); - $button_save = new XoopsFormButton('', 'submit', _AM_SAVE, 'submit'); - $button_go = new XoopsFormButton('', 'submit', _GO, 'submit'); - $button_cancel = new XoopsFormButton('', 'cancel', _CANCEL); +if (file_exists(RSSFIT_ROOT_PATH . 'admin/do_' . $do . '.php')) { + include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + $hidden_do = new \XoopsFormHidden('do', $do); + $button_save = new \XoopsFormButton('', 'submit', _AM_RSSFIT_SAVE, 'submit'); + $button_go = new \XoopsFormButton('', 'submit', _GO, 'submit'); + $button_cancel = new \XoopsFormButton('', 'cancel', _CANCEL); $button_cancel->setExtra('onclick="javascript:history.go(-1)"'); - $tray_save_cancel = new XoopsFormElementTray('', ''); + $tray_save_cancel = new \XoopsFormElementTray('', ''); $tray_save_cancel->addElement($button_save); $tray_save_cancel->addElement($button_cancel); - $moduleAdmin->displayNavigation('?do=' . $do); - require RSSFIT_ROOT_PATH.'admin/do_'.$do.'.php'; + $adminObject->displayNavigation('?do=' . $do); + require RSSFIT_ROOT_PATH . 'admin/do_' . $do . '.php'; } else { - $moduleAdmin->displayNavigation(basename(__FILE__)); - $moduleAdmin->displayIndex(); + $adminObject->displayNavigation(basename(__FILE__)); + $adminObject->displayIndex(); } include_once __DIR__ . '/admin_footer.php'; diff --git a/admin/menu.php b/admin/menu.php index 102ff1c2..06e8bc9a 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -17,13 +17,13 @@ * @author XOOPS Development Team */ -use Xoopsmodules\rss; +use Xoopsmodules\rssfit; require_once __DIR__ . '/../class/Helper.php'; //require_once __DIR__ . '/../include/common.php'; -$helper = rss\Helper::getInstance(); +$helper = rssfit\Helper::getInstance(); // get path to icons -$pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); +$pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); $adminmenu = []; diff --git a/assets/images/icons/16/index.html b/assets/images/icons/16/index.html index 990cbd60..2c5cdd3f 100644 --- a/assets/images/icons/16/index.html +++ b/assets/images/icons/16/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/assets/images/icons/32/index.html b/assets/images/icons/32/index.html index 990cbd60..2c5cdd3f 100644 --- a/assets/images/icons/32/index.html +++ b/assets/images/icons/32/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/assets/images/icons/index.html b/assets/images/icons/index.html index 990cbd60..2c5cdd3f 100644 --- a/assets/images/icons/index.html +++ b/assets/images/icons/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/assets/images/index.html b/assets/images/index.html index 990cbd60..2c5cdd3f 100644 --- a/assets/images/index.html +++ b/assets/images/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/class/Helper.php b/class/Helper.php new file mode 100644 index 00000000..0ca455aa --- /dev/null +++ b/class/Helper.php @@ -0,0 +1,61 @@ +debug = $debug; + $this->dirname = basename(dirname(__DIR__)); + } + + /** + * @param bool $debug + * + * @return \Xoopsmodules\rssfit\Helper + */ + public static function getInstance($debug = false) + { + static $instance; + if (null === $instance) { + $instance = new static($debug); + } + + return $instance; + } + + /** + * @return string + */ + public function getDirname() + { + return $this->dirname; + } +} diff --git a/class/RssMisc.php b/class/RssMisc.php new file mode 100644 index 00000000..b894c08d --- /dev/null +++ b/class/RssMisc.php @@ -0,0 +1,73 @@ + ## +############################################################################### +## XOOPS - PHP Content Management System ## +## Copyright (c) 2000 XOOPS.org ## +## ## +############################################################################### +## This program is free software; you can redistribute it and/or modify ## +## it under the terms of the GNU General Public License as published by ## +## the Free Software Foundation; either version 2 of the License, or ## +## (at your option) any later version. ## +## ## +## 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. See the ## +## GNU General Public License for more details. ## +## ## +## You should have received a copy of the GNU General Public License ## +## along with this program; if not, write to the Free Software ## +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## +############################################################################### +## Author of this file: NS Tai (aka tuff) ## +## URL: http://www.brandycoke.com/ ## +## Project: RSSFit ## +############################################################################### + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class RssMisc + * @package Xoopsmodules\rssfit + */ +class RssMisc extends \XoopsObject +{ + public function __construct() + { + parent::__construct(); + // key, data_type, value, req, max, opt + $this->initVar('misc_id', XOBJ_DTYPE_INT, null, false); + $this->initVar('misc_category', XOBJ_DTYPE_TXTBOX, '', true, 15); + $this->initVar('misc_title', XOBJ_DTYPE_TXTBOX, '', false, 255); + $this->initVar('misc_content', XOBJ_DTYPE_TXTAREA, '', false); + $this->initVar('misc_setting', XOBJ_DTYPE_ARRAY, ''); + } + + /** + * @param bool $do + */ + public function setDoHtml($do = true) + { + $this->vars['dohtml']['value'] = $do; + } + + /** + * @param bool $do + */ + public function setDoBr($do = true) + { + $this->vars['dobr']['value'] = $do; + } +} + diff --git a/class/misc.php b/class/RssMiscHandler.php similarity index 69% rename from class/misc.php rename to class/RssMiscHandler.php index 990c8bcf..d5cde3ac 100644 --- a/class/misc.php +++ b/class/RssMiscHandler.php @@ -1,4 +1,5 @@ -initVar('misc_id', XOBJ_DTYPE_INT, null, false); - $this->initVar('misc_category', XOBJ_DTYPE_TXTBOX, '', true, 15); - $this->initVar('misc_title', XOBJ_DTYPE_TXTBOX, '', false, 255); - $this->initVar('misc_content', XOBJ_DTYPE_TXTAREA, '', false); - $this->initVar('misc_setting', XOBJ_DTYPE_ARRAY, ''); - } - - public function setDoHtml($do=true) - { - $this->vars['dohtml']['value'] = $do; - } - - public function setDoBr($do=true) - { - $this->vars['dobr']['value'] = $do; - } -} -class RssMiscHandler extends XoopsObjectHandler +/** + * Class RssMiscHandler + * @package Xoopsmodules\rssfit + */ +class RssMiscHandler extends \XoopsObjectHandler { - public $db; + // public $db; public $db_table; - public $obj_class = 'RssMisc'; - public $obj_key = 'misc_id'; + public $obj_class = 'Xoopsmodules\rssfit\RssMisc'; + public $obj_key = 'misc_id'; - public function __construct(XoopsDatabase $db) + /** + * RssMiscHandler constructor. + * @param \XoopsDatabase $db + */ + public function __construct(\XoopsDatabase $db) { - $this->db = $db; - $this->db_table = $this->db->prefix('rssfit_misc'); + $this->db = $db; + $helper = rssfit\Helper::getInstance(); + $this->db_table = $this->db->prefix($helper->getDirname() . '_misc'); } - public function getInstance(XoopsDatabase $db) + /** + * @param \XoopsDatabase $db + * @return static + */ + public function getInstance(\XoopsDatabase $db) { static $instance; if (null === $instance) { - $instance = new RssMiscHandler($db); + $instance = new static($db); } return $instance; } + /** + * @return mixed|\XoopsObject + */ public function create() { $obj = new $this->obj_class(); @@ -88,20 +84,29 @@ public function create() return $obj; } - public function get($id, $fields='*') + /** + * @param int $id + * @param string $fields + * @return bool|mixed|\XoopsObject + */ + public function get($id, $fields = '*') { - $criteria = new Criteria($this->obj_key, (int)$id); + $criteria = new \Criteria($this->obj_key, (int)$id); if ($objs =& $this->getObjects($criteria)) { return 1 != count($objs) ? false : $objs[0]; } return false; } - public function getCount($criteria=null) + /** + * @param null $criteria + * @return bool + */ + public function getCount($criteria = null) { - $sql = 'SELECT COUNT(*) FROM '.$this->db_table; + $sql = 'SELECT COUNT(*) FROM ' . $this->db_table; if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { - $sql .= ' '.$criteria->renderWhere(); + $sql .= ' ' . $criteria->renderWhere(); } if (!$result =& $this->db->query($sql)) { return false; @@ -110,21 +115,27 @@ public function getCount($criteria=null) return $count; } - public function &getObjects($criteria=null, $fields='*', $key='') + /** + * @param null $criteria + * @param string $fields + * @param string $key + * @return array|bool + */ + public function &getObjects($criteria = null, $fields = '*', $key = '') { - $ret = false; + $ret = false; $limit = $start = 0; - $sql = 'SELECT '.$fields.' FROM '.$this->db_table; + $sql = 'SELECT ' . $fields . ' FROM ' . $this->db_table; if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { - $sql .= ' '.$criteria->renderWhere(); + $sql .= ' ' . $criteria->renderWhere(); if ('' != $criteria->getSort()) { - $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); + $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); } $limit = $criteria->getLimit(); $start = $criteria->getStart(); } if (!preg_match('/ORDER\ BY/', $sql)) { - $sql .= ' ORDER BY '.$this->obj_key.' ASC'; + $sql .= ' ORDER BY ' . $this->obj_key . ' ASC'; } $result = $this->db->query($sql, $limit, $start); if (!$result) { @@ -149,7 +160,11 @@ public function &getObjects($criteria=null, $fields='*', $key='') return $ret; } - public function insert(XoopsObject $obj) //, $force = false) + /** + * @param \XoopsObject $obj + * @return bool|mixed|void + */ + public function insert(\XoopsObject $obj) //, $force = false) { $force = false; if (strtolower(get_class($obj)) != strtolower($this->obj_class)) { @@ -172,16 +187,16 @@ public function insert(XoopsObject $obj) //, $force = false) return false; } if ($obj->isNew() || empty($cleanvars[$this->obj_key])) { - $cleanvars[$this->obj_key] = $this->db->genId($this->db_table.'_'.$this->obj_key.'_seq'); - $sql = 'INSERT INTO '.$this->db_table.' ('.implode(',', array_keys($cleanvars)).') VALUES ('.implode(',', array_values($cleanvars)) .')'; + $cleanvars[$this->obj_key] = $this->db->genId($this->db_table . '_' . $this->obj_key . '_seq'); + $sql = 'INSERT INTO ' . $this->db_table . ' (' . implode(',', array_keys($cleanvars)) . ') VALUES (' . implode(',', array_values($cleanvars)) . ')'; } else { unset($cleanvars[$this->obj_key]); - $sql = 'UPDATE '.$this->db_table.' SET'; + $sql = 'UPDATE ' . $this->db_table . ' SET'; foreach ($cleanvars as $k => $v) { - $sql .= ' '.$k.'='.$v.','; + $sql .= ' ' . $k . '=' . $v . ','; } $sql = substr($sql, 0, -1); - $sql .= ' WHERE '.$this->obj_key.' = '.$obj->getVar($this->obj_key); + $sql .= ' WHERE ' . $this->obj_key . ' = ' . $obj->getVar($this->obj_key); } if (false !== $force) { $result = $this->db->queryF($sql); @@ -189,7 +204,7 @@ public function insert(XoopsObject $obj) //, $force = false) $result = $this->db->query($sql); } if (!$result) { - $obj->setErrors('Could not store data in the database.
'.$this->db->error().' ('.$this->db->errno().')
'.$sql); + $obj->setErrors('Could not store data in the database.
' . $this->db->error() . ' (' . $this->db->errno() . ')
' . $sql); return false; } if (false === $obj->getVar($this->obj_key)) { @@ -198,20 +213,26 @@ public function insert(XoopsObject $obj) //, $force = false) return $obj->getVar($this->obj_key); } - public function modifyObjects($criteria=null, $fields= [], $force=false) + /** + * @param null $criteria + * @param array $fields + * @param bool $force + * @return bool|string + */ + public function modifyObjects($criteria = null, $fields = [], $force = false) { if (is_array($fields) && count($fields) > 0) { $obj = new $this->obj_class(); $sql = ''; foreach ($fields as $k => $v) { - $sql .= $k.' = '; + $sql .= $k . ' = '; $sql .= 3 == $obj->vars[$k]['data_type'] ? (int)$v : $this->db->quoteString($v); $sql .= ', '; } $sql = substr($sql, 0, -2); - $sql = 'UPDATE '.$this->db_table.' SET '.$sql; + $sql = 'UPDATE ' . $this->db_table . ' SET ' . $sql; if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { - $sql .= ' '.$criteria->renderWhere(); + $sql .= ' ' . $criteria->renderWhere(); } if (false !== $force) { $result = $this->db->queryF($sql); @@ -219,19 +240,23 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) $result = $this->db->query($sql); } if (!$result) { - return 'Could not store data in the database.
'.$this->db->error().' ('.$this->db->errno().')
'.$sql; + return 'Could not store data in the database.
' . $this->db->error() . ' (' . $this->db->errno() . ')
' . $sql; } } return false; } - public function delete(XoopsObject $obj) // , $force=false) + /** + * @param \XoopsObject $obj + * @return bool|void + */ + public function delete(\XoopsObject $obj) // , $force=false) { $force = false; if (strtolower(get_class($obj)) != strtolower($this->obj_class)) { return false; } - $sql = 'DELETE FROM '.$this->db_table.' WHERE '.$this->obj_key.'='.$obj->getVar($this->obj_key); + $sql = 'DELETE FROM ' . $this->db_table . ' WHERE ' . $this->obj_key . '=' . $obj->getVar($this->obj_key); if (false !== $force) { $result = $this->db->queryF($sql); } else { diff --git a/class/RssPlugins.php b/class/RssPlugins.php new file mode 100644 index 00000000..574c28c0 --- /dev/null +++ b/class/RssPlugins.php @@ -0,0 +1,67 @@ + ## +############################################################################### +## XOOPS - PHP Content Management System ## +## Copyright (c) 2000 XOOPS.org ## +## ## +############################################################################### +## This program is free software; you can redistribute it and/or modify ## +## it under the terms of the GNU General Public License as published by ## +## the Free Software Foundation; either version 2 of the License, or ## +## (at your option) any later version. ## +## ## +## 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. See the ## +## GNU General Public License for more details. ## +## ## +## You should have received a copy of the GNU General Public License ## +## along with this program; if not, write to the Free Software ## +## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## +############################################################################### +## Author of this file: NS Tai (aka tuff) ## +## URL: http://www.brandycoke.com/ ## +## Project: RSSFit ## +############################################################################### + +//use Xoopsmodules\rssfit; + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class RssPlugins + * @package Xoopsmodules\rssfit + */ +class RssPlugins extends \XoopsObject +{ + public function __construct() + { + parent::__construct(); + // key, data_type, value, req, max, opt + $this->initVar('rssf_conf_id', XOBJ_DTYPE_INT, null); + $this->initVar('rssf_filename', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('rssf_activated', XOBJ_DTYPE_INT, 0); + $this->initVar('rssf_grab', XOBJ_DTYPE_INT, 0, true); + $this->initVar('rssf_order', XOBJ_DTYPE_INT, 0); + $this->initVar('subfeed', XOBJ_DTYPE_INT, 0); + $this->initVar('sub_entries', XOBJ_DTYPE_INT, 0); + $this->initVar('sub_link', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('sub_title', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('sub_desc', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('img_url', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('img_link', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('img_title', XOBJ_DTYPE_TXTBOX, ''); + } +} + diff --git a/class/plugins.php b/class/RssPluginsHandler.php similarity index 64% rename from class/plugins.php rename to class/RssPluginsHandler.php index 41d3268e..58ac3575 100644 --- a/class/plugins.php +++ b/class/RssPluginsHandler.php @@ -1,4 +1,5 @@ -initVar('rssf_conf_id', XOBJ_DTYPE_INT, null); - $this->initVar('rssf_filename', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('rssf_activated', XOBJ_DTYPE_INT, 0); - $this->initVar('rssf_grab', XOBJ_DTYPE_INT, 0, true); - $this->initVar('rssf_order', XOBJ_DTYPE_INT, 0); - $this->initVar('subfeed', XOBJ_DTYPE_INT, 0); - $this->initVar('sub_entries', XOBJ_DTYPE_INT, 0); - $this->initVar('sub_link', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('sub_title', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('sub_desc', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('img_url', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('img_link', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('img_title', XOBJ_DTYPE_TXTBOX, ''); - } -} -class RssPluginsHandler extends XoopsObjectHandler +/** + * Class RssPluginsHandler + * @package Xoopsmodules\rssfit + */ +class RssPluginsHandler extends \XoopsObjectHandler { - public $db; + // public $db; public $db_table; - public $obj_class = 'RssPlugins'; - public $obj_key = 'rssf_conf_id'; - public $sortby = 'rssf_order'; - public $order = 'ASC'; + public $obj_class = 'Xoopsmodules\rssfit\RssPlugins'; + public $obj_key = 'rssf_conf_id'; + public $sortby = 'rssf_order'; + public $order = 'ASC'; - public function __construct(XoopsDatabase $db) + /** + * RssPluginsHandler constructor. + * @param \XoopsDatabase $db + */ + public function __construct(\XoopsDatabase $db) { - $this->db = $db; - $this->db_table = $this->db->prefix('rssfit_plugins'); + $this->db = $db; + $helper = rssfit\Helper::getInstance(); + $this->db_table = $this->db->prefix($helper->getDirname() . '_plugins'); } - public function getInstance(XoopsDatabase $db) + + /** + * @param \XoopsDatabase $db + * @return static + */ + public function getInstance(\XoopsDatabase $db) { static $instance; if (null === $instance) { - $instance = new RssPluginsHandler($db); + $instance = new static($db); } return $instance; } + + /** + * @return bool + */ public function create() { $obj = new $this->obj_class(); $obj->setNew(); return $obj; + + // $class = $this->obj_class; + // $bingo = 'rssfit'; + // $bingo2 = 'rssfit\\' . $class; + // $bingo3 = new $bingo2; + // echo $bingo3; + // $bingo3->setNew(); + // return false; + // return $bingo3 ; } - public function get($id, $fields='*') + /** + * @param int $id + * @param string $fields + * @return bool|\XoopsObject + */ + public function get($id, $fields = '*') { - $ret = false; - $criteria = new Criteria($this->obj_key, (int)$id); + $ret = false; + $criteria = new \Criteria($this->obj_key, (int)$id); if ($objs =& $this->getObjects($criteria) && 1 === count($objs)) { $ret =& $objs[0]; } return $ret; } - public function insert(XoopsObject $obj) //, $force=false) + /** + * @param \XoopsObject $obj + * @return bool|mixed|void + */ + public function insert(\XoopsObject $obj) //, $force=false) { - $force=false; + $force = false; if (strtolower(get_class($obj)) != strtolower($this->obj_class)) { return false; } @@ -108,7 +126,7 @@ public function insert(XoopsObject $obj) //, $force=false) if (!$obj->cleanVars()) { return false; } - foreach ($obj->cleanVars as $k=>$v) { + foreach ($obj->cleanVars as $k => $v) { if (XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) { $cleanvars[$k] = (int)$v; } else { @@ -119,16 +137,16 @@ public function insert(XoopsObject $obj) //, $force=false) return false; } if ($obj->isNew() || empty($cleanvars[$this->obj_key])) { - $cleanvars[$this->obj_key] = $this->db->genId($this->db_table.'_'.$this->obj_key.'_seq'); - $sql = 'INSERT INTO '.$this->db_table.' ('.implode(',', array_keys($cleanvars)).') VALUES ('.implode(',', array_values($cleanvars)) .')'; + $cleanvars[$this->obj_key] = $this->db->genId($this->db_table . '_' . $this->obj_key . '_seq'); + $sql = 'INSERT INTO ' . $this->db_table . ' (' . implode(',', array_keys($cleanvars)) . ') VALUES (' . implode(',', array_values($cleanvars)) . ')'; } else { unset($cleanvars[$this->obj_key]); - $sql = 'UPDATE '.$this->db_table.' SET'; + $sql = 'UPDATE ' . $this->db_table . ' SET'; foreach ($cleanvars as $k => $v) { - $sql .= ' '.$k.'='.$v.','; + $sql .= ' ' . $k . '=' . $v . ','; } $sql = substr($sql, 0, -1); - $sql .= ' WHERE '.$this->obj_key.' = '.$obj->getVar($this->obj_key); + $sql .= ' WHERE ' . $this->obj_key . ' = ' . $obj->getVar($this->obj_key); } if (false !== $force) { $result = $this->db->queryF($sql); @@ -136,7 +154,7 @@ public function insert(XoopsObject $obj) //, $force=false) $result = $this->db->query($sql); } if (!$result) { - $obj->setErrors('Could not store data in the database.
'.$this->db->error().' ('.$this->db->errno().')
'.$sql); + $obj->setErrors('Could not store data in the database.
' . $this->db->error() . ' (' . $this->db->errno() . ')
' . $sql); return false; } if (false === $obj->getVar($this->obj_key)) { @@ -145,13 +163,17 @@ public function insert(XoopsObject $obj) //, $force=false) return $obj->getVar($this->obj_key); } - public function delete(XoopsObject $obj) //, $force = false) + /** + * @param \XoopsObject $obj + * @return bool|void + */ + public function delete(\XoopsObject $obj) //, $force = false) { $force = false; if (strtolower(get_class($obj)) != strtolower($this->obj_class)) { return false; } - $sql = 'DELETE FROM '.$this->db_table.' WHERE '.$this->obj_key.'='.$obj->getVar($this->obj_key); + $sql = 'DELETE FROM ' . $this->db_table . ' WHERE ' . $this->obj_key . '=' . $obj->getVar($this->obj_key); if (false !== $force) { $result = $this->db->queryF($sql); } else { @@ -163,9 +185,15 @@ public function delete(XoopsObject $obj) //, $force = false) return true; } - public function &getObjects($criteria=null, $fields='*', $key='') + /** + * @param null $criteria + * @param string $fields + * @param string $key + * @return array|bool + */ + public function &getObjects($criteria = null, $fields = '*', $key = '') { - $ret = false; + $ret = false; $limit = $start = 0; switch ($fields) { case 'p_activated': @@ -178,17 +206,17 @@ public function &getObjects($criteria=null, $fields='*', $key='') $fields = 'rssf_conf_id, rssf_filename, subfeed, sub_title'; break; } - $sql = 'SELECT '.$fields.' FROM '.$this->db_table; + $sql = 'SELECT ' . $fields . ' FROM ' . $this->db_table; if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { - $sql .= ' '.$criteria->renderWhere(); + $sql .= ' ' . $criteria->renderWhere(); if ('' != $criteria->getSort()) { - $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); + $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); } $limit = $criteria->getLimit(); $start = $criteria->getStart(); } if (!preg_match('/ORDER\ BY/', $sql)) { - $sql .= ' ORDER BY '.$this->sortby.' '.$this->order; + $sql .= ' ORDER BY ' . $this->sortby . ' ' . $this->order; } $result = $this->db->query($sql, $limit, $start); if (!$result) { @@ -210,20 +238,26 @@ public function &getObjects($criteria=null, $fields='*', $key='') return $ret; } - public function modifyObjects($criteria=null, $fields= [], $force=false) + /** + * @param null $criteria + * @param array $fields + * @param bool $force + * @return bool|string + */ + public function modifyObjects($criteria = null, $fields = [], $force = false) { if (is_array($fields) && count($fields) > 0) { $obj = new $this->obj_class(); $sql = ''; foreach ($fields as $k => $v) { - $sql .= $k.' = '; + $sql .= $k . ' = '; $sql .= 3 == $obj->vars[$k]['data_type'] ? (int)$v : $this->db->quoteString($v); $sql .= ', '; } $sql = substr($sql, 0, -2); - $sql = 'UPDATE '.$this->db_table.' SET '.$sql; + $sql = 'UPDATE ' . $this->db_table . ' SET ' . $sql; if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { - $sql .= ' '.$criteria->renderWhere(); + $sql .= ' ' . $criteria->renderWhere(); } if (false !== $force) { $result = $this->db->queryF($sql); @@ -231,17 +265,21 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) $result = $this->db->query($sql); } if (!$result) { - return 'Could not store data in the database.
'.$this->db->error().' ('.$this->db->errno().')
'.$sql; + return 'Could not store data in the database.
' . $this->db->error() . ' (' . $this->db->errno() . ')
' . $sql; } } return false; } + /** + * @param null $criteria + * @return bool + */ public function getCount($criteria = null) { - $sql = 'SELECT COUNT(*) FROM '.$this->db_table; + $sql = 'SELECT COUNT(*) FROM ' . $this->db_table; if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { - $sql .= ' '.$criteria->renderWhere(); + $sql .= ' ' . $criteria->renderWhere(); } $result = $this->db->query($sql); if (!$result) { @@ -251,14 +289,22 @@ public function getCount($criteria = null) return $count; } - public function forceDeactivate(&$obj, $type='rssf_activated') + /** + * @param $obj + * @param string $type + * @return bool + */ + public function forceDeactivate(&$obj, $type = 'rssf_activated') { - $criteria = new Criteria($this->obj_key, $obj->getVar($this->obj_key)); - $fields = ['rssf_activated' => 0, 'subfeed' => 0]; + $criteria = new \Criteria($this->obj_key, $obj->getVar($this->obj_key)); + $fields = ['rssf_activated' => 0, 'subfeed' => 0]; $this->modifyObjects($criteria, $fields, true); return true; } + /** + * @return array|bool + */ public function &getPluginFileList() { $ret = false; @@ -270,36 +316,40 @@ public function &getPluginFileList() return $ret; } + /** + * @param $obj + * @return bool + */ public function &checkPlugin($obj) { $ret = false; global $module_handler; - $file = RSSFIT_ROOT_PATH.'plugins/'.$obj->getVar('rssf_filename'); + $file = RSSFIT_ROOT_PATH . 'plugins/' . $obj->getVar('rssf_filename'); if (file_exists($file)) { $require = require_once $file; - $name = explode('.', $obj->getVar('rssf_filename')); - $class = 'Rssfit'.ucfirst($name[1]); + $name = explode('.', $obj->getVar('rssf_filename')); + $class = 'Rssfit' . ucfirst($name[1]); if (class_exists($class)) { $handler = new $class; if (!method_exists($handler, 'loadmodule') || !method_exists($handler, 'grabentries')) { - $obj->setErrors(_AM_PLUGIN_FUNCNOTFOUND); + $obj->setErrors(_AM_RSSFIT_PLUGIN_FUNCNOTFOUND); } else { $dirname = $handler->dirname; - if (!empty($dirname) && is_dir(XOOPS_ROOT_PATH.'/modules/'.$dirname)) { + if (!empty($dirname) && is_dir(XOOPS_ROOT_PATH . '/modules/' . $dirname)) { if (!$handler->loadModule()) { - $obj->setErrors(_AM_PLUGIN_MODNOTFOUND); + $obj->setErrors(_AM_RSSFIT_PLUGIN_MODNOTFOUND); } else { $ret =& $handler; } } else { - $obj->setErrors(_AM_PLUGIN_MODNOTFOUND); + $obj->setErrors(_AM_RSSFIT_PLUGIN_MODNOTFOUND); } } } else { - $obj->setErrors(_AM_PLUGIN_CLASSNOTFOUND.' '.$class); + $obj->setErrors(_AM_RSSFIT_PLUGIN_CLASSNOTFOUND . ' ' . $class); } } else { - $obj->setErrors(_AM_PLUGIN_FILENOTFOUND); + $obj->setErrors(_AM_RSSFIT_PLUGIN_FILENOTFOUND); } return $ret; } diff --git a/class/rssfeed.php b/class/RssfeedHandler.php similarity index 68% rename from class/rssfeed.php rename to class/RssfeedHandler.php index 3bc06a07..11f99659 100644 --- a/class/rssfeed.php +++ b/class/RssfeedHandler.php @@ -1,4 +1,5 @@ - 'requiredChannelElements', 'opt' => 'optionalChannelElements', 'cloud' => 'ltcloudgtSubelementOfLtchannelgt', 'img' => 'ltimagegtSubelementOfLtchannelgt' ]; - public $escaped = [ - 128 => '€', 130 => '‚', 131 => 'ƒ', - 132 => '„', 133 => '…', 134 => '†', - 135 => '‡', 136 => 'ˆ', 137 => '‰', - 138 => 'Š', 139 => '‹', 140 => 'Œ', - 142 => 'Ž', 145 => '‘', 146 => '’', - 147 => '“', 148 => '”', 149 => '•', - 150 => '–', 151 => '—', 152 => '˜', - 153 => '™', 154 => 'š', 155 => '›', - 156 => 'œ', 158 => 'ž', 159 => 'Ÿ' + public $escaped = [ + 128 => '€', + 130 => '‚', + 131 => 'ƒ', + 132 => '„', + 133 => '…', + 134 => '†', + 135 => '‡', + 136 => 'ˆ', + 137 => '‰', + 138 => 'Š', + 139 => '‹', + 140 => 'Œ', + 142 => 'Ž', + 145 => '‘', + 146 => '’', + 147 => '“', + 148 => '”', + 149 => '•', + 150 => '–', + 151 => '—', + 152 => '˜', + 153 => '™', + 154 => 'š', + 155 => '›', + 156 => 'œ', + 158 => 'ž', + 159 => 'Ÿ' ]; + /** + * RssfeedHandler constructor. + * @param $modConfig + * @param $xoopsConfig + * @param $xoopsModule + */ public function __construct($modConfig, $xoopsConfig, $xoopsModule) { - $this->myts = \MyTextSanitizer::getInstance(); - $this->rssmod = $xoopsModule; - $this->pHandler = xoops_getModuleHandler('plugins'); - $this->mHandler = xoops_getModuleHandler('misc'); - $this->modConfig = $modConfig; + $this->myts = \MyTextSanitizer::getInstance(); + $this->rssmod = $xoopsModule; + $db = \XoopsDatabaseFactory::getDatabaseConnection(); + $this->pHandler = new rssfit\RssPluginsHandler($db);// xoops_getModuleHandler('plugins'); + $this->mHandler = new rssfit\RssMiscHandler($db); //xoops_getModuleHandler('misc'); + $this->modConfig = $modConfig; $this->xoopsConfig = $xoopsConfig; - $this->channelreq = [ + $this->channelreq = [ 'title' => $this->xoopsConfig['sitename'], 'link' => XOOPS_URL, 'description' => $this->xoopsConfig['slogan'] ]; } + /** + * @param $feed + */ public function getChannel(&$feed) { $channel = []; - if ($elements =& $this->mHandler->getObjects(new Criteria('misc_category', 'channel'))) { + if ($elements =& $this->mHandler->getObjects(new \Criteria('misc_category', 'channel'))) { foreach ($elements as $e) { if ('' != $e->getVar('misc_content')) { $channel[$e->getVar('misc_title')] = $e->getVar('misc_content', 'n'); } } - $channel['language'] = _LANGCODE; + $channel['language'] = _LANGCODE; $channel['lastBuildDate'] = $this->rssTimeStamp(time()); if ($this->modConfig['cache']) { $channel['ttl'] = $this->modConfig['cache']; @@ -104,17 +140,17 @@ public function getChannel(&$feed) } if (!empty($feed['plugin'])) { if (is_object($this->plugin_obj) && is_object($this->subHandler)) { - $channel['title'] = $this->plugin_obj->getVar('sub_title', 'n'); - $channel['link'] = $this->plugin_obj->getVar('sub_link', 'n'); + $channel['title'] = $this->plugin_obj->getVar('sub_title', 'n'); + $channel['link'] = $this->plugin_obj->getVar('sub_link', 'n'); $channel['description'] = $this->plugin_obj->getVar('sub_desc', 'n'); - $image = [ + $image = [ 'url' => $this->plugin_obj->getVar('img_url', 'n'), 'title' => $this->plugin_obj->getVar('img_title', 'n'), 'link' => $this->plugin_obj->getVar('img_link', 'n') ]; } } else { - if ($img =& $this->mHandler->getObjects(new Criteria('misc_category', 'channelimg'), '*', 'title')) { + if ($img =& $this->mHandler->getObjects(new \Criteria('misc_category', 'channelimg'), '*', 'title')) { $image = [ 'url' => $img['url']->getVar('misc_content', 'n'), 'title' => $img['title']->getVar('misc_content', 'n'), @@ -137,9 +173,13 @@ public function getChannel(&$feed) $feed['channel'] =& $channel; } + /** + * @param $feed + * @return bool + */ public function getSticky(&$feed) { - if (!$intr = $this->mHandler->getObjects(new Criteria('misc_category', 'sticky'))) { + if (!$intr = $this->mHandler->getObjects(new \Criteria('misc_category', 'sticky'))) { return false; } $sticky =& $intr[0]; @@ -148,11 +188,10 @@ public function getSticky(&$feed) if (in_array(0, $setting['feeds']) || '' == $sticky->getVar('misc_title') || '' == $sticky->getVar('misc_content')) { return false; } - if ((in_array(-1, $setting['feeds']) && empty($feed['plugin'])) || - (!empty($feed['plugin']) && in_array($this->plugin_obj->getVar('rssf_conf_id'), $setting['feeds'])) - ) { + if ((in_array(-1, $setting['feeds']) && empty($feed['plugin'])) + || (!empty($feed['plugin']) && in_array($this->plugin_obj->getVar('rssf_conf_id'), $setting['feeds']))) { $feed['sticky']['title'] = $sticky->getVar('misc_title', 'n'); - $feed['sticky']['link'] = $setting['link']; + $feed['sticky']['link'] = $setting['link']; $sticky->setDoHtml($setting['dohtml']); $sticky->setDoBr($setting['dobr']); $feed['sticky']['description'] = $sticky->getVar('misc_content'); @@ -165,23 +204,26 @@ public function getSticky(&$feed) return true; } + /** + * @param $feed + */ public function getItems(&$feed) { $entries = []; if (!empty($feed['plugin'])) { $this->plugin_obj->setVar('rssf_grab', $this->plugin_obj->getVar('sub_entries')); $this->subHandler->grab = $this->plugin_obj->getVar('sub_entries'); - $grab =& $this->subHandler->grabEntries($this->plugin_obj); + $grab =& $this->subHandler->grabEntries($this->plugin_obj); if (false !== $grab && count($grab) > 0) { foreach ($grab as $g) { array_push($entries, $g); } } - } elseif ($plugins =& $this->pHandler->getObjects(new Criteria('rssf_activated', 1))) { + } elseif ($plugins =& $this->pHandler->getObjects(new \Criteria('rssf_activated', 1))) { foreach ($plugins as $p) { - if ($handler =& $this->pHandler->checkPlugin($p)) { + if ($handler == $this->pHandler->checkPlugin($p)) { $handler->grab = $p->getVar('rssf_grab'); - $grab =& $handler->grabEntries($p); + $grab =& $handler->grabEntries($p); if (false !== $grab && count($grab) > 0) { foreach ($grab as $g) { array_push($entries, $g); @@ -191,7 +233,7 @@ public function getItems(&$feed) } } if (count($entries) > 0) { - for ($i=0, $iMax = count($entries); $i < $iMax; $i++) { + for ($i = 0, $iMax = count($entries); $i < $iMax; $i++) { $this->cleanupChars($entries[$i]['title']); $strip = $this->modConfig['strip_html'] ? 1 : 0; $this->cleanupChars($entries[$i]['description'], $strip, 0, 1); @@ -213,19 +255,23 @@ public function getItems(&$feed) $feed['items'] =& $entries; } + /** + * @param $text + * @return bool|string + */ public function doSubstr($text) { $ret = $text; $len = function_exists('mb_strlen') ? mb_strlen($ret, $this->charset) : strlen($ret); if ($len > $this->modConfig['max_char'] && $this->modConfig['max_char'] > 0) { - $ret = $this->substrDetect($ret, 0, $this->modConfig['max_char']-1); + $ret = $this->substrDetect($ret, 0, $this->modConfig['max_char'] - 1); if (false === $this->strrposDetect($ret, ' ')) { if (false !== $this->strrposDetect($text, ' ')) { $ret = $this->substrDetect($text, 0, strpos($text, ' ')); } } - if (in_array($this->substrDetect($text, $this->modConfig['max_char']-1, 1), $this->substr_add)) { - $ret .= $this->substrDetect($text, $this->modConfig['max_char']-1, 1); + if (in_array($this->substrDetect($text, $this->modConfig['max_char'] - 1, 1), $this->substr_add)) { + $ret .= $this->substrDetect($text, $this->modConfig['max_char'] - 1, 1); } else { if (false !== $this->strrposDetect($ret, ' ')) { $ret = $this->substrDetect($ret, 0, $this->strrposDetect($ret, ' ')); @@ -239,6 +285,12 @@ public function doSubstr($text) return $ret; } + /** + * @param $text + * @param $start + * @param $len + * @return bool|string + */ public function substrDetect($text, $start, $len) { if (function_exists('mb_strcut')) { @@ -247,6 +299,11 @@ public function substrDetect($text, $start, $len) return substr($text, $start, $len); } + /** + * @param $text + * @param $find + * @return bool|false|int + */ public function strrposDetect($text, $find) { if (function_exists('mb_strrpos')) { @@ -255,11 +312,20 @@ public function strrposDetect($text, $find) return strrpos($text, $find); } + /** + * @param $time + * @return false|string + */ public function rssTimeStamp($time) { return date('D, j M Y H:i:s O', $time); } + /** + * @param $a + * @param $b + * @return int + */ public function sortTimestamp($a, $b) { if ($a['timestamp'] == $b['timestamp']) { @@ -268,7 +334,13 @@ public function sortTimestamp($a, $b) return ($a['timestamp'] > $b['timestamp']) ? -1 : 1; } - public function cleanupChars(&$text, $strip=true, $dospec=true, $dosub=false) + /** + * @param $text + * @param bool $strip + * @param bool $dospec + * @param bool $dosub + */ + public function cleanupChars(&$text, $strip = true, $dospec = true, $dosub = false) { if ($strip) { $text = strip_tags($text); @@ -285,15 +357,23 @@ public function cleanupChars(&$text, $strip=true, $dospec=true, $dosub=false) } } + /** + * @param $text + */ public function wrapCdata(&$text) { - $text = ''], ['<![CDATA[', ']]>'], $text) . ']]>'; + $text = ''], ['<![CDATA[', ']]>'], $text) . ']]>'; } - public function &getActivatedSubfeeds($fields='', $type='') + /** + * @param string $fields + * @param string $type + * @return array|bool + */ + public function &getActivatedSubfeeds($fields = '', $type = '') { $ret = false; - if ($subs =& $this->pHandler->getObjects(new Criteria('subfeed', 1), $fields)) { + if ($subs =& $this->pHandler->getObjects(new \Criteria('subfeed', 1), $fields)) { switch ($type) { default: $ret =& $subs; @@ -308,48 +388,70 @@ public function &getActivatedSubfeeds($fields='', $type='') return $ret; } - public function feedSelectBox($caption='', $selected='', $size=1, $multi=true, $none=true, $main=true, $name='feeds', $type='id') + /** + * @param string $caption + * @param string $selected + * @param int $size + * @param bool $multi + * @param bool $none + * @param bool $main + * @param string $name + * @param string $type + * @return \XoopsFormSelect + */ + public function feedSelectBox($caption = '', $selected = '', $size = 1, $multi = true, $none = true, $main = true, $name = 'feeds', $type = 'id') { - $select = new XoopsFormSelect($caption, $name, $selected, $size, $multi); + $select = new \XoopsFormSelect($caption, $name, $selected, $size, $multi); if ($none) { $select->addOption(0, '-------'); } if ($main) { - $select->addOption('-1', _AM_MAINFEED); + $select->addOption('-1', _AM_RSSFIT_MAINFEED); } if ($subs =& $this->getActivatedSubfeeds('sublist', 'list')) { - foreach ($subs as $k=>$v) { + foreach ($subs as $k => $v) { $select->addOption($k, $v); } } return $select; } - public function specUrl($key=0) + /** + * @param int $key + * @return bool|string + */ + public function specUrl($key = 0) { if (isset($this->specs[$key])) { - return $this->spec_url.'#'.$this->specs[$key]; + return $this->spec_url . '#' . $this->specs[$key]; } return false; } - public function subFeedUrl($filename='') + /** + * @param string $filename + * @return bool|string + */ + public function subFeedUrl($filename = '') { if (!empty($filename)) { $filename = str_replace('rssfit.', '', $filename); $filename = str_replace('.php', '', $filename); - return RSSFIT_URL_FEED.'?'.$this->feedkey.'='.$filename; + return RSSFIT_URL_FEED . '?' . $this->feedkey . '=' . $filename; } return false; } + /** + * @param $feed + */ public function checkSubFeed(&$feed) { if (!empty($feed['plugin'])) { - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('rssf_filename', sprintf($this->plugin_file, $feed['plugin']))); - $criteria->add(new Criteria('subfeed', 1)); - $sub = $this->pHandler->getObjects($criteria); + $criteria = new \CriteriaCompo(); + $criteria->add(new \Criteria('rssf_filename', sprintf($this->plugin_file, $feed['plugin']))); + $criteria->add(new \Criteria('subfeed', 1)); + $sub = $this->pHandler->getObjects($criteria); $handler = false; if (isset($sub[0])) { $handler = $this->pHandler->checkPlugin($sub[0]); @@ -357,14 +459,16 @@ public function checkSubFeed(&$feed) if ($handler) { $this->plugin_obj = $sub[0]; $this->subHandler = $handler; - $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' - . md5(str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); + $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' . md5(str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); } else { $feed['plugin'] = ''; } } } + /** + * @param $feed + */ public function buildFeed(&$feed) { $this->getChannel($feed); diff --git a/class/Utility.php b/class/Utility.php new file mode 100644 index 00000000..64df31d2 --- /dev/null +++ b/class/Utility.php @@ -0,0 +1,158 @@ + + * @author Mamba + * @since File available since version 1.54 + */ + +use Xmf\Request; +use Xoopsmodules\rssfit; +use Xoopsmodules\rssfit\common; + +require_once __DIR__ . '/common/VersionChecks.php'; +require_once __DIR__ . '/common/ServerStats.php'; +require_once __DIR__ . '/common/FilesManagement.php'; + +//require_once __DIR__ . '/../include/common.php'; + +/** + * Class Utility + */ +class Utility +{ + use common\VersionChecks; //checkVerXoops, checkVerPhp Traits + + use common\ServerStats; // getServerStats Trait + + use common\FilesManagement; // Files Management Trait + + //--------------- Custom module methods ----------------------------- + + /** + * @param $a + * @param $b + * @return int + */ + public static function sortTimestamp($a, $b) + { + if ($a['timestamp'] == $b['timestamp']) { + return 0; + } + return ($a['timestamp'] > $b['timestamp']) ? -1 : 1; + } + + /** + * @param int $spec + * @param $rss + * @return string + */ + public static function genSpecMoreInfo($spec = 0, &$rss) + { + return static::rssfGenAnchor($rss->specUrl($spec), _AM_RSSFIT_EDIT_CHANNEL_QMARK, 'spec', _AM_RSSFIT_EDIT_CHANNEL_MOREINFO); + } + + /** + * @param string $url + * @param string $text + * @param string $target + * @param string $title + * @param string $class + * @param string $id + * @return string + */ + public static function rssfGenAnchor($url = '', $text = '', $target = '', $title = '', $class = '', $id = '') + { + if (!empty($url)) { + $ret = ''; + $ret .= ''; + return $ret; + } + return $text; + } + + /** + * @param \XoopsModule $xoopsMod + * @param $lang + */ + public static function rssfInstallLangFile(\XoopsModule $xoopsMod, $lang) + { + $file = XOOPS_ROOT_PATH . '/modules/' . $xoopsMod->getVar('dirname') . '/language/%s/install.php'; + if (file_exists(sprintf($file, $lang))) { + include sprintf($file, $lang); + } else { + include sprintf($file, 'english'); + } + } + + /** + * @param \XoopsModule $xoopsMod + * + * @return string + */ + public static function rssfInsertChannel(\XoopsModule $xoopsMod) + { + global $xoopsConfig; + $helper = rssfit\Helper::getInstance(); + $url = $GLOBALS['xoopsDB']->quoteString(XOOPS_URL); + $sitename = $GLOBALS['xoopsDB']->quoteString($xoopsConfig['sitename']); + list($copyright) = $GLOBALS['xoopsDB']->fetchRow($GLOBALS['xoopsDB']->query('SELECT conf_value FROM ' . $GLOBALS['xoopsDB']->prefix('config') . " WHERE conf_name = 'meta_copyright' AND conf_modid = 1 AND conf_catid = " . XOOPS_CONF_METAFOOTER)); + return 'INSERT INTO ' + . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_misc') + . ' VALUES ' + . "('', 'channel', 'title', " + . $sitename + . ", '')" + . ", ('', 'channel', 'link', " + . $url + . ", '')" + . ", ('', 'channel', 'description', " + . $GLOBALS['xoopsDB']->quoteString($xoopsConfig['slogan']) + . ", ''), ('', 'channel', 'copyright', " + . $GLOBALS['xoopsDB']->quoteString($copyright) + . ", ''), ('', 'channel', 'managingEditor', " + . $GLOBALS['xoopsDB']->quoteString($xoopsConfig['adminmail'] . ' (' . $xoopsConfig['sitename'] . ')') + . ", ''), ('', 'channel', 'webMaster', " + . $GLOBALS['xoopsDB']->quoteString($xoopsConfig['adminmail'] . ' (' . $xoopsConfig['sitename'] . ')') + . ", '')" + . ", ('', 'channel', 'category', '', '')" + . ", ('', 'channel', 'generator', " + . $GLOBALS['xoopsDB']->quoteString(XOOPS_VERSION . ' / RSSFit ' . $xoopsMod->getInfo('version')) + . ", ''), ('', 'channel', 'docs', " + . $GLOBALS['xoopsDB']->quoteString('http://blogs.law.harvard.edu/tech/rss') + . ", '')" + . ", ('', 'channelimg', 'url', " + . $GLOBALS['xoopsDB']->quoteString(XOOPS_URL . '/images/logo.gif') + . ", '')" + . ", ('', 'channelimg', 'title', " + . $sitename + . ", '')" + . ", ('', 'channelimg', 'link', " + . $url + . ", '')" + . ';'; + } + +} diff --git a/class/common/Breadcrumb.php b/class/common/Breadcrumb.php new file mode 100644 index 00000000..530e772c --- /dev/null +++ b/class/common/Breadcrumb.php @@ -0,0 +1,78 @@ + + * @package rss + * + * Example: + * $breadcrumb = new PedigreeBreadcrumb(); + * $breadcrumb->addLink( 'bread 1', 'index1.php' ); + * $breadcrumb->addLink( 'bread 2', '' ); + * $breadcrumb->addLink( 'bread 3', 'index3.php' ); + * echo $breadcrumb->render(); + */ +defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined'); + +/** + * Class PedigreeBreadcrumb + */ +class Breadcrumb +{ + public $dirname; + private $bread = []; + + /** + * + */ + public function __construct() + { + $this->dirname = basename(dirname(__DIR__)); + } + + /** + * Add link to breadcrumb + * + * @param string $title + * @param string $link + */ + public function addLink($title = '', $link = '') + { + $this->bread[] = [ + 'link' => $link, + 'title' => $title + ]; + } + + /** + * Render Pedigree BreadCrumb + * + */ + public function render() + { + if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { + require_once $GLOBALS['xoops']->path('class/theme.php'); + $GLOBALS['xoTheme'] = new \xos_opal_Theme(); + } + + require_once $GLOBALS['xoops']->path('class/template.php'); + $breadcrumbTpl = new \XoopsTpl(); + $breadcrumbTpl->assign('breadcrumb', $this->bread); + $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); + unset($breadcrumbTpl); + + return $html; + } +} diff --git a/class/common/Configurator.php b/class/common/Configurator.php new file mode 100644 index 00000000..b564779f --- /dev/null +++ b/class/common/Configurator.php @@ -0,0 +1,59 @@ +name = $config->name; + $this->paths = $config->paths; + $this->uploadFolders = $config->uploadFolders; + $this->blankFiles = $config->blankFiles; + $this->templateFolders = $config->templateFolders; + $this->oldFiles = $config->oldFiles; + $this->oldFolders = $config->oldFolders; + $this->modCopyright = $config->modCopyright; + + } +} diff --git a/class/common/FilesManagement.php b/class/common/FilesManagement.php new file mode 100644 index 00000000..d73e58f0 --- /dev/null +++ b/class/common/FilesManagement.php @@ -0,0 +1,245 @@ + + */ +trait FilesManagement +{ + /** + * Function responsible for checking if a directory exists, we can also write in and create an index.html file + * + * @param string $folder The full path of the directory to check + * + * @return void + */ + public static function createFolder($folder) + { + try { + if (!file_exists($folder)) { + if (!mkdir($folder) && !is_dir($folder)) { + throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); + } + + file_put_contents($folder . '/index.html', ''); + } + } + catch (Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n", '
'; + } + } + + /** + * @param $file + * @param $folder + * @return bool + */ + public static function copyFile($file, $folder) + { + return copy($file, $folder); + } + + /** + * @param $src + * @param $dst + */ + public static function recurseCopy($src, $dst) + { + $dir = opendir($src); + // @mkdir($dst); + if (!mkdir($dst) && !is_dir($dst)) { + while (false !== ($file = readdir($dir))) { + if (('.' !== $file) && ('..' !== $file)) { + if (is_dir($src . '/' . $file)) { + self::recurseCopy($src . '/' . $file, $dst . '/' . $file); + } else { + copy($src . '/' . $file, $dst . '/' . $file); + } + } + } + } + closedir($dir); + } + + /** + * + * Remove files and (sub)directories + * + * @param string $src source directory to delete + * + * @uses \Xmf\Module\Helper::getHelper() + * @uses \Xmf\Module\Helper::isUserAdmin() + * + * @return bool true on success + */ + public static function deleteDirectory($src) + { + // Only continue if user is a 'global' Admin + if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + return false; + } + + $success = true; + // remove old files + $dirInfo = new SplFileInfo($src); + // validate is a directory + if ($dirInfo->isDir()) { + $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); + foreach ($fileList as $k => $v) { + $fileInfo = new SplFileInfo("{$src}/{$v}"); + if ($fileInfo->isDir()) { + // recursively handle subdirectories + if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { + break; + } + } else { + // delete the file + if (!($success = unlink($fileInfo->getRealPath()))) { + break; + } + } + } + // now delete this (sub)directory if all the files are gone + if ($success) { + $success = rmdir($dirInfo->getRealPath()); + } + } else { + // input is not a valid directory + $success = false; + } + return $success; + } + + /** + * + * Recursively remove directory + * + * @todo currently won't remove directories with hidden files, should it? + * + * @param string $src directory to remove (delete) + * + * @return bool true on success + */ + public static function rrmdir($src) + { + // Only continue if user is a 'global' Admin + if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + return false; + } + + // If source is not a directory stop processing + if (!is_dir($src)) { + return false; + } + + $success = true; + + // Open the source directory to read in files + $iterator = new DirectoryIterator($src); + foreach ($iterator as $fObj) { + if ($fObj->isFile()) { + $filename = $fObj->getPathname(); + $fObj = null; // clear this iterator object to close the file + if (!unlink($filename)) { + return false; // couldn't delete the file + } + } elseif (!$fObj->isDot() && $fObj->isDir()) { + // Try recursively on directory + self::rrmdir($fObj->getPathname()); + } + } + $iterator = null; // clear iterator Obj to close file/directory + return rmdir($src); // remove the directory & return results + } + + /** + * Recursively move files from one directory to another + * + * @param string $src - Source of files being moved + * @param string $dest - Destination of files being moved + * + * @return bool true on success + */ + public static function rmove($src, $dest) + { + // Only continue if user is a 'global' Admin + if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + return false; + } + + // If source is not a directory stop processing + if (!is_dir($src)) { + return false; + } + + // If the destination directory does not exist and could not be created stop processing + if (!is_dir($dest) && !mkdir($dest, 0755)) { + return false; + } + + // Open the source directory to read in files + $iterator = new DirectoryIterator($src); + foreach ($iterator as $fObj) { + if ($fObj->isFile()) { + rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); + } elseif (!$fObj->isDot() && $fObj->isDir()) { + // Try recursively on directory + self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); + // rmdir($fObj->getPath()); // now delete the directory + } + } + $iterator = null; // clear iterator Obj to close file/directory + return rmdir($src); // remove the directory & return results + } + + /** + * Recursively copy directories and files from one directory to another + * + * @param string $src - Source of files being moved + * @param string $dest - Destination of files being moved + * + * @uses \Xmf\Module\Helper::getHelper() + * @uses \Xmf\Module\Helper::isUserAdmin() + * + * @return bool true on success + */ + public static function rcopy($src, $dest) + { + // Only continue if user is a 'global' Admin + if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + return false; + } + + // If source is not a directory stop processing + if (!is_dir($src)) { + return false; + } + + // If the destination directory does not exist and could not be created stop processing + if (!is_dir($dest) && !mkdir($dest, 0755)) { + return false; + } + + // Open the source directory to read in files + $iterator = new DirectoryIterator($src); + foreach ($iterator as $fObj) { + if ($fObj->isFile()) { + copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); + } elseif (!$fObj->isDot() && $fObj->isDir()) { + self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); + } + } + return true; + } +} diff --git a/class/common/ServerStats.php b/class/common/ServerStats.php new file mode 100644 index 00000000..86b07c5a --- /dev/null +++ b/class/common/ServerStats.php @@ -0,0 +1,76 @@ + + */ +trait ServerStats +{ + /** + * serverStats() + * + * @return string + */ + public static function getServerStats() + { + //mb $wfdownloads = WfdownloadsWfdownloads::getInstance(); + $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirNameUpper = strtoupper($moduleDirName); + xoops_loadLanguage('common', $moduleDirName); + $html = ''; + // $sql = 'SELECT metavalue'; + // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); + // $sql .= " WHERE metakey='version' LIMIT 1"; + // $query = $GLOBALS['xoopsDB']->query($sql); + // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); + $html .= "
" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "\n"; + $html .= "
\n"; + // $html .= '
' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
\n"; + // $html .= "
\n"; + // $html .= "
\n"; + $html .= '
' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "
\n"; + $html .= "
    \n"; + // + $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; + if (function_exists('gd_info')) { + if ($gdlib = true === gd_info()) { + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; + } + } + // + // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); + // $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; + // + // $registerglobals = (!ini_get('register_globals')) ? "" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . constant('CO_' . $moduleDirNameUpper . '_ON') . ''; + // $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; + // + $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; + // + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . "\n"; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . "\n"; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . "\n"; + $html .= "
\n"; + $html .= "
    \n"; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . "\n"; + $html .= "
\n"; + $html .= "
\n"; + $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; + $html .= '
'; + $html .= '

'; + + return $html; + } +} diff --git a/class/common/VersionChecks.php b/class/common/VersionChecks.php new file mode 100644 index 00000000..b374284e --- /dev/null +++ b/class/common/VersionChecks.php @@ -0,0 +1,76 @@ + + */ +trait VersionChecks +{ + /** + * + * Verifies XOOPS version meets minimum requirements for this module + * @static + * @param \XoopsModule $module + * + * @param null|string $requiredVer + * @return bool true if meets requirements, false if not + */ + public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) + { + $moduleDirName = basename(dirname(dirname(__DIR__))); + if (null === $module) { + $module = \XoopsModule::getByDirname($moduleDirName); + } + xoops_loadLanguage('admin', $moduleDirName); + + //check for minimum XOOPS version + $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string + if (null === $requiredVer) { + $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string + } + $success = true; + + if (version_compare($currentVer, $requiredVer, '<')) { + $success = false; + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); + } + + return $success; + } + + /** + * + * Verifies PHP version meets minimum requirements for this module + * @static + * @param \XoopsModule $module + * + * @return bool true if meets requirements, false if not + */ + public static function checkVerPhp(\XoopsModule $module) + { + xoops_loadLanguage('admin', $module->dirname()); + // check for minimum PHP version + $success = true; + $verNum = PHP_VERSION; + $reqVer = $module->getInfo('min_php'); + if (false !== $reqVer && '' !== $reqVer) { + if (version_compare($verNum, $reqVer, '<')) { + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); + $success = false; + } + } + + return $success; + } +} diff --git a/class/common/index.html b/class/common/index.html new file mode 100644 index 00000000..2c5cdd3f --- /dev/null +++ b/class/common/index.html @@ -0,0 +1 @@ + diff --git a/class/index.html b/class/index.html index 990cbd60..2c5cdd3f 100644 --- a/class/index.html +++ b/class/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/docs/changelog.txt b/docs/changelog.txt index 7e37efe7..a7c4d87e 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -17,6 +17,10 @@ - update README.md (mamba) - added URL links for active plugins in sub-feeds (mamba) - added Publisher plugin (mamba) +- PHPDoc updates (mamba) +- standardization of language variables (mamba) +- namespaces (mamba) +-
1.31 Beta 1 [2017-10-24]

diff --git a/docs/index.html b/docs/index.html index 990cbd60..2c5cdd3f 100644 --- a/docs/index.html +++ b/docs/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/docs/lang_diff.txt b/docs/lang_diff.txt index 0be7e56c..9cb5bc69 100644 --- a/docs/lang_diff.txt +++ b/docs/lang_diff.txt @@ -14,9 +14,9 @@ x renamed --------------------------------------- _ _admin.php__ -+ _AM_OLEDRION_ADD_ATTRIBUTE -+ _AM_OLEDRION_EDIT_ATTRIBUTE ++ _AM_RSSFIT_OLEDRION_ADD_ATTRIBUTE ++ _AM_RSSFIT_OLEDRION_EDIT_ATTRIBUTE New file to translate : - /xoops/modules/admin/gateways/paypal/language/mylanguage/main.php \ No newline at end of file + /xoops/modules/admin/gateways/paypal/language/mylanguage/main.php diff --git a/include/common.php b/include/common.php index 19a4b39e..b623beca 100644 --- a/include/common.php +++ b/include/common.php @@ -32,22 +32,76 @@ ## Project: RSSFit ## ############################################################################### +use Xoopsmodules\rssfit; + +$moduleDirName = basename(dirname(__DIR__)); +$capsDirName = strtoupper($moduleDirName); + +include __DIR__ . '/../preloads/autoloader.php'; + +/** @var \XoopsDatabase $db */ +/** @var rssfit\Helper $helper */ +/** @var rssfit\Utility $utility */ +//$db = \XoopsDatabaseFactory::getDatabase(); +$db = \XoopsDatabaseFactory::getDatabaseConnection(); +$helper = rssfit\Helper::getInstance(); +$utility = new rssfit\Utility(); +//$configurator = new rssfit\common\Configurator(); + +$helper->loadLanguage('common'); + if (!defined('RSSFIT_CONSTANTS_DEFINED')) { - define('RSSFIT_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/'); - define('RSSFIT_URL', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/'); + define('RSSFIT_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $helper->getDirname() . '/'); + define('RSSFIT_URL', XOOPS_URL . '/modules/' . $helper->getDirname() . '/'); define('RSSFIT_URL_FEED', RSSFIT_URL . 'rss.php'); - define('RSSFIT_ADMIN_URL', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/'); + define('RSSFIT_ADMIN_URL', XOOPS_URL . '/modules/' . $helper->getDirname() . '/admin/'); define('RSSFIT_CONSTANTS_DEFINED', 1); + define($capsDirName . '_DIRNAME', $GLOBALS['xoopsModule']->dirname()); + define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); + // define($capsDirName . '_URL', XOOPS_URL . '/modules/' . constant($capsDirName . '_DIRNAME')); + define($capsDirName . '_ADMIN', constant($capsDirName . '_URL') . '/admin/index.php'); + // define($capsDirName . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); + define($capsDirName . '_AUTHOR_LOGOIMG', constant($capsDirName . '_URL') . '/assets/images/logoModule.png'); + define($capsDirName . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash + define($capsDirName . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash } -require_once RSSFIT_ROOT_PATH.'class/rssfeed.php'; -require_once RSSFIT_ROOT_PATH.'include/functions.php'; +require_once RSSFIT_ROOT_PATH . 'class/RssfeedHandler.php'; +//require_once RSSFIT_ROOT_PATH.'include/functions.php'; -$version = number_format($xoopsModule->getVar('version')/100, 2); +global $xoopsModule, $xoopsModuleConfig, $xoopsConfig; +$version = number_format($xoopsModule->getVar('version') / 100, 2); $version = !substr($version, -1, 1) ? substr($version, 0, 3) : $version; -define('RSSFIT_VERSION', 'RSSFit '.$version); +//$version1 = $helper->getModule()->getInfo('version'); +define('RSSFIT_VERSION', 'RSSFit ' . $version); -$rss = new RssfeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); -$myts = $rss->myts; +$rss = new rssfit\RssfeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); +$myts = $rss->myts; $pluginsHandler = $rss->pHandler; -$miscHandler = $rss->mHandler; +$miscHandler = $rss->mHandler; + +//handlers +//$categoryHandler = new rssfit\CategoryHandler($db); +//$downloadHandler = new rssfit\DownloadHandler($db); + +$pathIcon16 = Xmf\Module\Admin::iconUrl('', 16); +$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); +//$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); +//$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); + +$icons = [ + 'edit' => " . _EDIT . ", + 'delete' => "" . _DELETE . "", + 'clone' => "" . _CLONE . "", + 'preview' => "" . _PREVIEW . "", + 'print' => "" . _CLONE . "", + 'pdf' => "" . _CLONE . "", + 'add' => "" . _ADD . "", + '0' => "" . _ADD . "", + '1' => "" . _ADD . "", +]; + +// MyTextSanitizer object +$myts = \MyTextSanitizer::getInstance(); + +$debug = false; diff --git a/include/config.php b/include/config.php new file mode 100644 index 00000000..dd8fbdbb --- /dev/null +++ b/include/config.php @@ -0,0 +1,83 @@ +dirname()); +// define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); +// define($capsDirName . '_URL', XOOPS_URL . '/modules/' . constant($capsDirName . '_DIRNAME')); +// define($capsDirName . '_ADMIN', constant($capsDirName . '_URL') . '/admin/index.php'); +// define($capsDirName . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); +// define($capsDirName . '_AUTHOR_LOGOIMG', constant($capsDirName . '_URL') . '/assets/images/logoModule.png'); +// define($capsDirName . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash +// define($capsDirName . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash +//} + +//Configurator +return (object)[ + 'name' => strtoupper($moduleDirName) . ' Module Configurator', + 'paths' => [ + 'dirname' => $moduleDirName, + 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', + 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, + 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, + 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, + ], + 'uploadFolders' => [ + constant($capsDirName . '_UPLOAD_PATH'), + constant($capsDirName . '_UPLOAD_PATH') . '/category', + constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', + //XOOPS_UPLOAD_PATH . '/flags' + ], + 'blankFiles' => [ + constant($capsDirName . '_UPLOAD_PATH'), + constant($capsDirName . '_UPLOAD_PATH') . '/category', + constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', + //XOOPS_UPLOAD_PATH . '/flags' + ], + + 'templateFolders' => [ + '/templates/', + '/templates/blocks/', + '/templates/admin/' + + ], + 'oldFiles' => [ + '/class/request.php', + '/class/registry.php', + '/class/utilities.php', + '/class/util.php', + '/include/constants.php', + '/include/functions.php', + '/ajaxrating.txt', + ], + 'oldFolders' => [ + '/images', + '/css', + '/js', + '/tcpdf', + '/images', + ], + 'modCopyright' => "
+ \'XOOPS', +]; diff --git a/include/functions.php b/include/functions.php index c4d6685b..1b7b3ada 100644 --- a/include/functions.php +++ b/include/functions.php @@ -32,6 +32,11 @@ ## Project: RSSFit ## ############################################################################### +/** + * @param $a + * @param $b + * @return int + */ function sortTimestamp($a, $b) { if ($a['timestamp'] == $b['timestamp']) { @@ -40,21 +45,35 @@ function sortTimestamp($a, $b) return ($a['timestamp'] > $b['timestamp']) ? -1 : 1; } -function genSpecMoreInfo($spec=0, &$rss) +/** + * @param int $spec + * @param $rss + * @return string + */ +function genSpecMoreInfo($spec = 0, &$rss) { - return rssfGenAnchor($rss->specUrl($spec), _AM_EDIT_CHANNEL_QMARK, 'spec', _AM_EDIT_CHANNEL_MOREINFO); + return rssfGenAnchor($rss->specUrl($spec), _AM_RSSFIT_EDIT_CHANNEL_QMARK, 'spec', _AM_RSSFIT_EDIT_CHANNEL_MOREINFO); } -function rssfGenAnchor($url='', $text='', $target= '', $title='', $class='', $id='') +/** + * @param string $url + * @param string $text + * @param string $target + * @param string $title + * @param string $class + * @param string $id + * @return string + */ +function rssfGenAnchor($url = '', $text = '', $target = '', $title = '', $class = '', $id = '') { if (!empty($url)) { $ret = ''; - $ret .= ''; + $ret .= ''; return $ret; } return $text; diff --git a/include/index.html b/include/index.html index 990cbd60..2c5cdd3f 100644 --- a/include/index.html +++ b/include/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/include/install.php b/include/install.php deleted file mode 100644 index 7cebb2cc..00000000 --- a/include/install.php +++ /dev/null @@ -1,151 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### - -/** - * @param XoopsModule $xoopsMod - * - * @return bool - */ -function xoops_module_install_rss(XoopsModule $xoopsMod) -{ - global $xoopsDB, $xoopsConfig; - $myts = \MyTextSanitizer::getInstance(); - rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); - $intro_setting = ['dohtml' =>1, 'dobr' =>1, 'sub' =>stripslashes(_INSTALL_INTRO_SUB)]; - $sql[] = 'INSERT INTO `' - . $xoopsDB->prefix('rssfit_misc') . '` VALUES (1, ' - . $xoopsDB->quoteString('intro') . ', ' - . $xoopsDB->quoteString(stripslashes(_INTRO_TITLE)) . ', ' - . $xoopsDB->quoteString(stripslashes(_INTRO_CONTENT)) . ', ' - . $xoopsDB->quoteString(serialize($intro_setting)) . ')'; - $sql[] = rssfInsertChannel($xoopsMod); - $sql[] = 'INSERT INTO ' - . $xoopsDB->prefix('rssfit_misc') . ' VALUES ' - . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' =>0, 'dobr' =>0, 'feeds' => [0 =>'0'], 'link' =>XOOPS_URL])) . ')'; - foreach ($sql as $s) { - if (false === $xoopsDB->query($s)) { - echo ''.$xoopsDB->error().'
'.$s.'

'; - return false; - } - } - return true; -} - -/** - * @param XoopsModule $xoopsMod - * @param int $oldversion version number of prevviously installed version - * - * @return bool - */ -function xoops_module_update_rss(XoopsModule $xoopsMod, $oldversion) -{ - global $xoopsDB, $xoopsConfig; - rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); - list($rows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('rssfit_misc') . " WHERE misc_category = 'channel'")); - if (!$rows) { - $sql[] = 'ALTER TABLE `'.$xoopsDB->prefix('rssfit_misc').'` ADD `misc_setting` TEXT NOT NULL;'; - $sql[] = 'ALTER TABLE `'.$xoopsDB->prefix('rssfit_misc').'` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; - $intro_setting = ['dohtml' =>1, 'dobr' =>1, 'sub' =>_INSTALL_INTRO_SUB]; - $sql[] = 'UPDATE `' - . $xoopsDB->prefix('rssfit_misc') . '` SET misc_setting = ' - . $xoopsDB->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; - $sql[] = 'ALTER TABLE `' - . $xoopsDB->prefix('rssfit_plugins') . "` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; - $sql[] = 'UPDATE `' . $xoopsDB->prefix('rssfit_plugins') . '` SET sub_entries = 5'; - $sql[] = rssfInsertChannel($xoopsMod); - $sql[] = 'INSERT INTO ' - . $xoopsDB->prefix('rssfit_misc') . ' VALUES ' - . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' =>0, 'dobr' =>0, 'feeds' => [0 =>'0'], 'link' =>XOOPS_URL])) . ')'; - foreach ($sql as $s) { - if (false === $xoopsDB->query($s)) { - echo ''.$xoopsDB->error().'
'.$s.'

'; - return false; - } - } - } - return true; -} - -/** - * @param $xoopsMod - * @param $lang - */ -function rssfInstallLangFile(&$xoopsMod, $lang) -{ - $file = XOOPS_ROOT_PATH.'/modules/'.$xoopsMod->getVar('dirname') - .'/language/%s/install.php'; - if (file_exists(sprintf($file, $lang))) { - include sprintf($file, $lang); - } else { - include sprintf($file, 'english'); - } -} - -/** - * @param $xoopsMod - * - * @return string - */ -function rssfInsertChannel(&$xoopsMod) -{ - global $xoopsDB, $xoopsConfig; - $url = $xoopsDB->quoteString(XOOPS_URL); - $sitename = $xoopsDB->quoteString($xoopsConfig['sitename']); - list($copyright) = $xoopsDB->fetchRow($xoopsDB->query('SELECT conf_value FROM ' - . $xoopsDB->prefix('config') . " WHERE conf_name = 'meta_copyright' AND conf_modid = 1 AND conf_catid = " . XOOPS_CONF_METAFOOTER)); - return 'INSERT INTO ' . $xoopsDB->prefix('rssfit_misc') - . ' VALUES ' . "('', 'channel', 'title', " . $sitename . ", '')" - . ", ('', 'channel', 'link', " . $url . ", '')" - . ", ('', 'channel', 'description', " - . $xoopsDB->quoteString($xoopsConfig['slogan']) - . ", ''), ('', 'channel', 'copyright', " - . $xoopsDB->quoteString($copyright) - . ", ''), ('', 'channel', 'managingEditor', " - . $xoopsDB->quoteString($xoopsConfig['adminmail'] - .' ('.$xoopsConfig['sitename'].')') - . ", ''), ('', 'channel', 'webMaster', " - . $xoopsDB->quoteString($xoopsConfig['adminmail'] - .' ('.$xoopsConfig['sitename'].')') . ", '')" - . ", ('', 'channel', 'category', '', '')" - . ", ('', 'channel', 'generator', " - . $xoopsDB->quoteString(XOOPS_VERSION - .' / RSSFit '.$xoopsMod->getInfo('version')) - . ", ''), ('', 'channel', 'docs', " - . $xoopsDB->quoteString('http://blogs.law.harvard.edu/tech/rss') . ", '')" - . ", ('', 'channelimg', 'url', " - . $xoopsDB->quoteString(XOOPS_URL.'/images/logo.gif') . ", '')" - . ", ('', 'channelimg', 'title', " . $sitename . ", '')" - . ", ('', 'channelimg', 'link', " . $url . ", '')" - . ';'; -} diff --git a/include/oninstall.php b/include/oninstall.php new file mode 100644 index 00000000..11fe9c30 --- /dev/null +++ b/include/oninstall.php @@ -0,0 +1,137 @@ +getInfo('tables'); + foreach ($moduleTables as $table) { + $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); + } + } + + return $xoopsSuccess && $phpSuccess; +} + +/** + * + * Performs tasks required during installation of the module + * @param XoopsModule $module {@link XoopsModule} + * + * @return bool true if installation successful, false if not + */ +function xoops_module_install_rssfit(\XoopsModule $module) +{ + global $xoopsConfig; + include __DIR__ . '/../preloads/autoloader.php'; + require_once __DIR__ . '/../../../mainfile.php'; + require_once __DIR__ . '/../include/config.php'; + + $moduleDirName = basename(dirname(__DIR__)); + + $helper = rssfit\Helper::getInstance(); + $utility = new rssfit\Utility(); + $configurator = new rssfit\common\Configurator(); + // Load language files + $helper->loadLanguage('admin'); + $helper->loadLanguage('modinfo'); + // $helper->loadLanguage('install'); + + rssfit\Utility::rssfInstallLangFile($module, $xoopsConfig['language']); + + $intro_setting = ['dohtml' => 1, 'dobr' => 1, 'sub' => stripslashes(_INSTALL_INTRO_SUB)]; + $sql[] = 'INSERT INTO `' + . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_misc') + . '` VALUES (1, ' + . $GLOBALS['xoopsDB']->quoteString('intro') + . ', ' + . $GLOBALS['xoopsDB']->quoteString(stripslashes(_INTRO_TITLE)) + . ', ' + . $GLOBALS['xoopsDB']->quoteString(stripslashes(_INTRO_CONTENT)) + . ', ' + . $GLOBALS['xoopsDB']->quoteString(serialize($intro_setting)) + . ')'; + $sql[] = rssfit\Utility::rssfInsertChannel($module); + $sql[] = 'INSERT INTO ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "('', 'sticky', '', '', " . $GLOBALS['xoopsDB']->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; + foreach ($sql as $s) { + if (false === $GLOBALS['xoopsDB']->query($s)) { + echo '' . $GLOBALS['xoopsDB']->error() . '
' . $s . '

'; + return false; + } + } + + // + // $configurator = new rssfit\common\Configurator(); + // /** @var rssfit\Utility $utility */ + // $utility = new rssfit\Utility(); + + // default Permission Settings ---------------------- + + $moduleId = $module->getVar('mid'); + $moduleId2 = $helper->getModule()->mid(); + $gpermHandler = xoops_getHandler('groupperm'); + // access rights ------------------------------------------ + $gpermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); + $gpermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); + $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); + $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); + $gpermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); + + // --- CREATE FOLDERS --------------- + if (count($configurator->uploadFolders) > 0) { + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { + foreach (array_keys($configurator->uploadFolders) as $i) { + $utility::createFolder($configurator->uploadFolders[$i]); + } + } + + // --- COPY blank.png FILES --------------- + if (count($configurator->blankFiles) > 0) { + $file = __DIR__ . '/../assets/images/blank.png'; + foreach (array_keys($configurator->blankFiles) as $i) { + $dest = $configurator->blankFiles[$i] . '/blank.png'; + $utility::copyFile($file, $dest); + } + } + //delete .html entries from the tpl table + $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'"; + $GLOBALS['xoopsDB']->queryF($sql); + + return true; + +} + diff --git a/include/onuninstall.php b/include/onuninstall.php new file mode 100644 index 00000000..04421081 --- /dev/null +++ b/include/onuninstall.php @@ -0,0 +1,81 @@ +loadLanguage('admin'); + + //------------------------------------------------------------------ + // Remove uploads folder (and all subfolders) if they exist + //------------------------------------------------------------------ + + $old_directories = [$GLOBALS['xoops']->path("uploads/{$moduleDirName}")]; + foreach ($old_directories as $old_dir) { + $dirInfo = new SplFileInfo($old_dir); + if ($dirInfo->isDir()) { + // The directory exists so delete it + if (false === $utilityClass::rrmdir($old_dir)) { + $module->setErrors(sprintf(_AM_RSSFIT_ERROR_BAD_DEL_PATH, $old_dir)); + $success = false; + } + } + unset($dirInfo); + } + /* + //------------ START ---------------- + //------------------------------------------------------------------ + // Remove xsitemap.xml from XOOPS root folder if it exists + //------------------------------------------------------------------ + $xmlfile = $GLOBALS['xoops']->path('xsitemap.xml'); + if (is_file($xmlfile)) { + if (false === ($delOk = unlink($xmlfile))) { + $module->setErrors(sprintf(_AM_RSSFIT_XXXXX_ERROR_BAD_REMOVE, $xmlfile)); + } + } +// return $success && $delOk; // use this if you're using this routine +*/ + + return $success; + //------------ END ---------------- + +} + diff --git a/include/onupdate.php b/include/onupdate.php new file mode 100644 index 00000000..6a6c416e --- /dev/null +++ b/include/onupdate.php @@ -0,0 +1,176 @@ +IsAdmin()) { + exit('Restricted access' . PHP_EOL); +} + +/** + * @param string $tablename + * + * @return bool + */ +function tableExists($tablename) +{ + $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); + + return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) ? true : false; +} + +/** + * + * Prepares system prior to attempting to install module + * @param \XoopsModule $xoopsModule + * @param null $previousVersion + * @return bool true if ready to install, false if not + */ +function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVersion = null) +{ + $moduleDirName = basename(dirname(__DIR__)); + /** @var rssfit\Helper $helper */ + /** @var rssfit\Utility $utility */ + $helper = rssfit\Helper::getInstance(); + $utility = new rssfit\Utility(); + + $xoopsSuccess = $utility::checkVerXoops($module); + $phpSuccess = $utility::checkVerPhp($module); + return $xoopsSuccess && $phpSuccess; +} + +/** + * + * Performs tasks required during update of the module + * @param \XoopsModule $module {@link XoopsModule} + * @param null $previousVersion + * + * @return bool true if update successful, false if not + */ + +function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = null) +{ + $moduleDirName = basename(dirname(__DIR__)); + $capsDirName = strtoupper($moduleDirName); + + /** @var rssfit\Helper $helper */ + /** @var rssfit\Utility $utility */ + /** @var rssfit\common\Configurator $configurator */ + $helper = rssfit\Helper::getInstance(); + $utility = new rssfit\Utility(); + $configurator = new rssfit\common\Configurator(); + + $helper->loadLanguage('install'); + + global $xoopsDB, $xoopsConfig; + // rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); + list($rows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . " WHERE misc_category = 'channel'")); + if (!$rows) { + $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` ADD `misc_setting` TEXT NOT NULL;'; + $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; + $intro_setting = ['dohtml' => 1, 'dobr' => 1, 'sub' => _INSTALL_INTRO_SUB]; + $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` SET misc_setting = ' . $xoopsDB->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; + $sql[] = 'ALTER TABLE `' + . $xoopsDB->prefix($helper->getDirname() . '_plugins') + . "` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; + $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_plugins') . '` SET sub_entries = 5'; + $sql[] = rssfInsertChannel($xoopsMod); + $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; + foreach ($sql as $s) { + if (false === $xoopsDB->query($s)) { + echo '' . $xoopsDB->error() . '
' . $s . '

'; + return false; + } + } + } + + if ($previousVersion < 132) { + + + //delete old HTML templates + if (count($configurator->templateFolders) > 0) { + foreach ($configurator->templateFolders as $folder) { + $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder); + if (is_dir($templateFolder)) { + $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']); + foreach ($templateList as $k => $v) { + $fileInfo = new SplFileInfo($templateFolder . $v); + if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) { + if (file_exists($templateFolder . $v)) { + unlink($templateFolder . $v); + } + } + } + } + } + } + + // --- DELETE OLD FILES --------------- + if (count($configurator->oldFiles) > 0) { + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { + foreach (array_keys($configurator->oldFiles) as $i) { + $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]); + if (is_file($tempFile)) { + unlink($tempFile); + } + } + } + + // --- DELETE OLD FOLDERS --------------- + xoops_load('XoopsFile'); + if (count($configurator->oldFolders) > 0) { + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { + foreach (array_keys($configurator->oldFolders) as $i) { + $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]); + /* @var $folderHandler XoopsObjectHandler */ + $folderHandler = XoopsFile::getHandler('folder', $tempFolder); + $folderHandler->delete($tempFolder); + } + } + + // --- CREATE FOLDERS --------------- + if (count($configurator->uploadFolders) > 0) { + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { + foreach (array_keys($configurator->uploadFolders) as $i) { + $utilityClass::createFolder($configurator->uploadFolders[$i]); + } + } + + // --- COPY blank.png FILES --------------- + if (count($configurator->blankFiles) > 0) { + $file = __DIR__ . '/../assets/images/blank.png'; + foreach (array_keys($configurator->blankFiles) as $i) { + $dest = $configurator->blankFiles[$i] . '/blank.png'; + $utilityClass::copyFile($file, $dest); + } + } + + //delete .html entries from the tpl table + $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\''; + $GLOBALS['xoopsDB']->queryF($sql); + + /** @var XoopsGroupPermHandler $gpermHandler */ + $gpermHandler = xoops_getHandler('groupperm'); + return $gpermHandler->deleteByModule($module->getVar('mid'), 'item_read'); + + } + return true; +} + diff --git a/index.php b/index.php index f7cb3d55..e1638fe2 100644 --- a/index.php +++ b/index.php @@ -34,22 +34,22 @@ require __DIR__ . '/header.php'; $GLOBALS['xoopsOption']['template_main'] = 'rssfit_index.tpl'; -require XOOPS_ROOT_PATH.'/header.php'; -if ($intr = $miscHandler->getObjects(new Criteria('misc_category', 'intro'))) { - $intro = $intr[0]; +require XOOPS_ROOT_PATH . '/header.php'; +if ($intr = $miscHandler->getObjects(new \Criteria('misc_category', 'intro'))) { + $intro = $intr[0]; $setting = $intro->getVar('misc_setting'); $intro->setDoHtml($setting['dohtml'] ? 1 : 0); $intro->setDoBr($setting['dobr'] ? 1 : 0); - $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); + $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); $content = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_content')); - $content = str_replace('{SITEURL}', XOOPS_URL.'/', $content); - if (false !== strpos($content, '{SUB}') && $plugins = $pluginsHandler->getObjects(new Criteria('subfeed', 1))) { + $content = str_replace('{SITEURL}', XOOPS_URL . '/', $content); + if (false !== strpos($content, '{SUB}') && $plugins = $pluginsHandler->getObjects(new \Criteria('subfeed', 1))) { $sublist = ''; foreach ($plugins as $p) { - $sub = $myts->stripSlashesGPC($setting['sub']); - $sub = str_replace('{URL}', $rss->subFeedUrl($p->getVar('rssf_filename')), $sub); - $sub = str_replace('{TITLE}', $p->getVar('sub_title'), $sub); - $sub = str_replace('{DESC}', $p->getVar('sub_desc'), $sub); + $sub = $myts->stripSlashesGPC($setting['sub']); + $sub = str_replace('{URL}', $rss->subFeedUrl($p->getVar('rssf_filename')), $sub); + $sub = str_replace('{TITLE}', $p->getVar('sub_title'), $sub); + $sub = str_replace('{DESC}', $p->getVar('sub_desc'), $sub); $sublist .= $sub; } $content = str_replace('{SUB}', $sublist, $content); @@ -58,4 +58,4 @@ } $xoopsTpl->assign('intro', ['title' => $title, 'content' => $content]); } -require XOOPS_ROOT_PATH.'/footer.php'; +require XOOPS_ROOT_PATH . '/footer.php'; diff --git a/language/english/admin.php b/language/english/admin.php index ed86a140..1434487c 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -1,67 +1,67 @@
{SITEURL} will print ' . XOOPS_URL . '/'); +define('_AM_RSSFIT_EDIT_INTRO', 'Edit introduction'); +define('_AM_RSSFIT_EDIT_INTRO_TITLE', 'Introduction title'); +define('_AM_RSSFIT_EDIT_INTRO_TITLE_DESC', '{SITENAME} will print ' . $xoopsConfig['sitename']); +define('_AM_RSSFIT_EDIT_INTRO_TEXT', 'Introduction text'); +define('_AM_RSSFIT_EDIT_INTRO_TEXT_DESC', _AM_RSSFIT_EDIT_INTRO_TITLE_DESC . '

{SITEURL} will print ' . XOOPS_URL . '/'); -define('_AM_EDIT_PLUGIN', 'Manage Plug-ins'); -define('_AM_PLUGIN_ACTIVATED', 'Activated Plug-ins'); -define('_AM_PLUGIN_INACTIVE', 'Inactive Plug-ins'); -define('_AM_PLUGIN_NONINSTALLED', 'Non-installed Plug-ins'); -define('_AM_PLUGIN_MODNAME', 'Module'); -define('_AM_PLUGIN_FILENAME', 'File name'); -define('_AM_PLUGIN_SHOWXENTRIES', 'Entries to show'); -define('_AM_PLUGIN_ORDER', 'Display order'); -define('_AM_PLUGIN_DEACTIVATE', 'Deactivate'); -define('_AM_PLUGIN_ACTIVATE', 'Activate'); -define('_AM_PLUGIN_INSTALL', 'Install'); -define('_AM_PLUGIN_UNINSTALL', 'Uninstall'); +define('_AM_RSSFIT_EDIT_PLUGIN', 'Manage Plug-ins'); +define('_AM_RSSFIT_PLUGIN_ACTIVATED', 'Activated Plug-ins'); +define('_AM_RSSFIT_PLUGIN_INACTIVE', 'Inactive Plug-ins'); +define('_AM_RSSFIT_PLUGIN_NONINSTALLED', 'Non-installed Plug-ins'); +define('_AM_RSSFIT_PLUGIN_MODNAME', 'Module'); +define('_AM_RSSFIT_PLUGIN_FILENAME', 'File name'); +define('_AM_RSSFIT_PLUGIN_SHOWXENTRIES', 'Entries to show'); +define('_AM_RSSFIT_PLUGIN_ORDER', 'Display order'); +define('_AM_RSSFIT_PLUGIN_DEACTIVATE', 'Deactivate'); +define('_AM_RSSFIT_PLUGIN_ACTIVATE', 'Activate'); +define('_AM_RSSFIT_PLUGIN_INSTALL', 'Install'); +define('_AM_RSSFIT_PLUGIN_UNINSTALL', 'Uninstall'); // errors -define('_AM_PLUGIN_UNKNOWNERROR', 'Unknown error'); -define('_AM_PLUGIN_FILENOTFOUND', 'Plug-in file not found'); -define('_AM_PLUGIN_MODNOTFOUND', 'Module not found'); -define('_AM_PLUGIN_CLASSNOTFOUND', 'Plug-in not compatible (Class not exist)'); -define('_AM_PLUGIN_FUNCNOTFOUND', 'Plug-in not compatible (Function not exist)'); +define('_AM_RSSFIT_PLUGIN_UNKNOWNERROR', 'Unknown error'); +define('_AM_RSSFIT_PLUGIN_FILENOTFOUND', 'Plug-in file not found'); +define('_AM_RSSFIT_PLUGIN_MODNOTFOUND', 'Module not found'); +define('_AM_RSSFIT_PLUGIN_CLASSNOTFOUND', 'Plug-in not compatible (Class not exist)'); +define('_AM_RSSFIT_PLUGIN_FUNCNOTFOUND', 'Plug-in not compatible (Function not exist)'); ################### version 1.1 additions ################### -define('_AM_XOOPS_VERSION_WRONG', 'Version of XOOPS does not meet the system requirement. RSSFit may not work properly.'); -define('_AM_DB_RECORD_MISSING', 'Could not found essential database records, please reinstall RSSFit'); -define('_AM_MAINFEED', 'Main feed'); -define('_AM_DO_HTML', 'Use HTML tags'); -define('_AM_DO_BR', 'Convert line breaks'); -define('_AM_EDIT_CHANNEL', 'Edit feed info'); -define('_AM_EDIT_CHANNEL_QMARK', ' [?]'); -define('_AM_EDIT_CHANNEL_MOREINFO', 'More Info'); -define('_AM_EDIT_CHANNEL_REQUIRED', 'Required feed information'); -define('_AM_EDIT_CHANNEL_OPTIONAL', 'Optional feed information'); -define('_AM_EDIT_CHANNEL_IMAGE', 'Feed image properties'); -define('_AM_PLUGIN_NONE', 'You have no plugin installed'); -define('_AM_SUB_LIST', 'Sub-feeds'); -define('_AM_SUB_FILENAME_URL', 'Plug-in file name / sub-feed URL'); -define('_AM_SUB_ACTIVATE', 'Activate'); -define('_AM_SUB_CONFIGURE', 'Configure'); -define('_AM_SUB_EDIT', 'Configure sub-feed: %s'); -define('_AM_SUB_PLUGIN_NONE', 'Plugin not installed'); -define('_AM_SUB_TITLE', 'Title'); -define('_AM_SUB_LINK', 'Link'); -define('_AM_SUB_DESC', 'Description'); -define('_AM_STICKY_EDIT', 'Edit sticky text'); -define('_AM_STICKY_TITLE', 'Sticky text title'); -define('_AM_STICKY_CONTENT', 'Sticky text content'); -define('_AM_STICKY_LINK', 'Sticky text link'); -define('_AM_STICKY_APPLYTO', 'Apply to feeds'); -define('_AM_EDIT_INTRO_TEXT_DESC_SUB', '

{SUB} will print a list of available sub-feeds'); -define('_AM_EDIT_INTRO_SUB', 'HTML tags for listing sub-feeds'); -define('_AM_EDIT_INTRO_SUB_DESC', "Extra tags:
{URL} (sub-feed's URL)
{TITLE} (sub-feed's title)
{DESC} (sub-feed's description)"); +define('_AM_RSSFIT_XOOPS_VERSION_WRONG', 'Version of XOOPS does not meet the system requirement. RSSFit may not work properly.'); +define('_AM_RSSFIT_DB_RECORD_MISSING', 'Could not found essential database records, please reinstall RSSFit'); +define('_AM_RSSFIT_MAINFEED', 'Main feed'); +define('_AM_RSSFIT_DO_HTML', 'Use HTML tags'); +define('_AM_RSSFIT_DO_BR', 'Convert line breaks'); +define('_AM_RSSFIT_EDIT_CHANNEL', 'Edit feed info'); +define('_AM_RSSFIT_EDIT_CHANNEL_QMARK', ' [?]'); +define('_AM_RSSFIT_EDIT_CHANNEL_MOREINFO', 'More Info'); +define('_AM_RSSFIT_EDIT_CHANNEL_REQUIRED', 'Required feed information'); +define('_AM_RSSFIT_EDIT_CHANNEL_OPTIONAL', 'Optional feed information'); +define('_AM_RSSFIT_EDIT_CHANNEL_IMAGE', 'Feed image properties'); +define('_AM_RSSFIT_PLUGIN_NONE', 'You have no plugin installed'); +define('_AM_RSSFIT_SUB_LIST', 'Sub-feeds'); +define('_AM_RSSFIT_SUB_FILENAME_URL', 'Plug-in file name / sub-feed URL'); +define('_AM_RSSFIT_SUB_ACTIVATE', 'Activate'); +define('_AM_RSSFIT_SUB_CONFIGURE', 'Configure'); +define('_AM_RSSFIT_SUB_EDIT', 'Configure sub-feed: %s'); +define('_AM_RSSFIT_SUB_PLUGIN_NONE', 'Plugin not installed'); +define('_AM_RSSFIT_SUB_TITLE', 'Title'); +define('_AM_RSSFIT_SUB_LINK', 'Link'); +define('_AM_RSSFIT_SUB_DESC', 'Description'); +define('_AM_RSSFIT_STICKY_EDIT', 'Edit sticky text'); +define('_AM_RSSFIT_STICKY_TITLE', 'Sticky text title'); +define('_AM_RSSFIT_STICKY_CONTENT', 'Sticky text content'); +define('_AM_RSSFIT_STICKY_LINK', 'Sticky text link'); +define('_AM_RSSFIT_STICKY_APPLYTO', 'Apply to feeds'); +define('_AM_RSSFIT_EDIT_INTRO_TEXT_DESC_SUB', '

{SUB} will print a list of available sub-feeds'); +define('_AM_RSSFIT_EDIT_INTRO_SUB', 'HTML tags for listing sub-feeds'); +define('_AM_RSSFIT_EDIT_INTRO_SUB_DESC', "Extra tags:
{URL} (sub-feed's URL)
{TITLE} (sub-feed's title)
{DESC} (sub-feed's description)"); //1.30 define('_AM_RSSFIT_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); define('_AM_RSSFIT_UPGRADEFAILED1', "Update failed - couldn't add new fields"); diff --git a/language/english/common.php b/language/english/common.php new file mode 100644 index 00000000..4879bf9e --- /dev/null +++ b/language/english/common.php @@ -0,0 +1,69 @@ +Disabled (No thumbnails available)"); +define('CO_' . $moduleDirNameUpper . '_GDON', "Enabled (Thumbsnails available)"); +define('CO_' . $moduleDirNameUpper . '_IMAGEINFO', 'Server status'); +define('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): '); +define('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): '); +define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); +define('CO_' . $moduleDirNameUpper . '_METAVERSION', "Downloads meta version: "); +define('CO_' . $moduleDirNameUpper . '_OFF', "OFF"); +define('CO_' . $moduleDirNameUpper . '_ON', "ON"); +define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); +define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); +define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); +define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); + +define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); +define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); + +define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); +define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); +define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); +define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); +define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); +define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); +define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); + +define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); + +// Error Msgs +define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); +define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); +define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); + +//Help +define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__)))); +define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); +define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); +define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); + +//define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); + +//help multi-page +define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); +define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); +define('CO_' . $moduleDirNameUpper . '_SUPPORT', 'Support'); diff --git a/language/english/help/disclaimer.tpl b/language/english/help/disclaimer.tpl index bea59243..fa8e7be8 100644 --- a/language/english/help/disclaimer.tpl +++ b/language/english/help/disclaimer.tpl @@ -3,42 +3,42 @@

DISCLAIMER


-

Software downloaded from the XOOPS web site is provided 'as is' without warranty +

Software downloaded from the XOOPS web site is provided 'as is' without warranty of any kind, either express or implied, including, but not limited to, the implied warranties of fitness for a purpose, or the warranty of non-infringement. Without limiting the foregoing, XOOPS Projects team makes no warranty that:

-
-
    -
  1. the software will meet your requirements
  2. -
  3. the software will be uninterrupted, timely, secure or error-free
  4. -
  5. the results that may be obtained from the use of the software will be effective, - accurate or reliable -
  6. -
  7. the quality of the software will meet your expectations any errors in the - software obtained from XOOPS web site will be corrected. -
  8. -
-
+
+
    +
  1. the software will meet your requirements
  2. +
  3. the software will be uninterrupted, timely, secure or error-free
  4. +
  5. the results that may be obtained from the use of the software will be effective, + accurate or reliable +
  6. +
  7. the quality of the software will meet your expectations any errors in the + software obtained from XOOPS web site will be corrected. +
  8. +
+
-

Software and its documentation made available on the XOOPS web site:

-
-
    -
  1. could include technical or other mistakes, inaccuracies or typographical - errors. XOOPS may make changes to the software or documentation made available - on its web site. -
  2. -
  3. may be out of date, and XOOPS makes no commitment to update such materials.
  4. -
  5. XOOPS assumes no responsibility for errors or omissions in the software - or documentation available from its web site. -
  6. -
-


In no event shall XOOPS team be liable to you or any third parties for +

Software and its documentation made available on the XOOPS web site:

+
+
    +
  1. could include technical or other mistakes, inaccuracies or typographical + errors. XOOPS may make changes to the software or documentation made available + on its web site. +
  2. +
  3. may be out of date, and XOOPS makes no commitment to update such materials.
  4. +
  5. XOOPS assumes no responsibility for errors or omissions in the software + or documentation available from its web site. +
  6. +
+


In no event shall XOOPS team be liable to you or any third parties for any special, punitive, incidental, indirect or consequential damages of any kind, or any damages whatsoever, including, without limitation, those resulting from loss of use, data or profits, whether or not XOOPS Project has been advised of the possibility of such damages, and on any theory of liability, arising out of or in connection with the use of this software.

-
+

The use of the software downloaded through any XOOPS site is done at your own discretion and risk and with agreement that you will be solely responsible for any damage to your computer system or loss of data that results from such activities. No advice diff --git a/language/english/help/help.tpl b/language/english/help/help.tpl index a5ce7a17..5ca55c41 100644 --- a/language/english/help/help.tpl +++ b/language/english/help/help.tpl @@ -17,7 +17,7 @@ Chapter 2.12 of our XOOPS Operations Manual

Some modules may come with a plugin that needs to be installed before use. You install a plugin, - a file name rssfit.module.php by copying it to the module/rss/plugins directory. You will + a file name rssfit.module.php by copying it to the module/rssfit/plugins directory. You will need to activate the new plugin in the Plug-ins administration panel.

OPERATING INSTRUCTIONS


@@ -26,7 +26,7 @@ applicable to your system and needs. You can test your feed on the user side by visting the rss module.

-

You can access the feed directly your-site-URL/modules/rss/rss.php

+

You can access the feed directly your-site-URL/modules/rssfit/rss.php

Creating Plugins

diff --git a/language/english/help/helpheader.tpl b/language/english/help/helpheader.tpl index 13a46078..910c8d6c 100644 --- a/language/english/help/helpheader.tpl +++ b/language/english/help/helpheader.tpl @@ -1,6 +1,6 @@ -

Help: - <{$smarty.const._MI_RSSFIT_NAME}> - <{$smarty.const._MI_RSSFIT_BACK_2_ADMIN}> <{$smarty.const._MI_RSSFIT_NAME}> -

+

Help: + <{$smarty.const._MI_RSSFIT_NAME}> + <{$smarty.const._MI_RSSFIT_BACK_2_ADMIN}> <{$smarty.const._MI_RSSFIT_NAME}> +

diff --git a/language/english/help/index.html b/language/english/help/index.html index 990cbd60..2c5cdd3f 100644 --- a/language/english/help/index.html +++ b/language/english/help/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/language/english/index.html b/language/english/index.html index 990cbd60..2c5cdd3f 100644 --- a/language/english/index.html +++ b/language/english/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/language/english/modinfo.php b/language/english/modinfo.php index 3fe326c0..93c4a95c 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -16,39 +16,38 @@ define('_MI_RSSFIT_INDEX', 'Home'); define('_MI_RSSFIT_ABOUT', 'About'); - // Module Configs -define('_MI_OVERALL_ENTRIES', 'Total entries to show'); -define('_MI_OVERALL_ENTRIES_DESC', 'Number of entries to show in the RSS feed'); -define('_MI_PLUGIN_ENTRIES', 'Default entry number for plug-ins'); -define('_MI_PLUGIN_ENTRIES_DESC', 'Default number of entries to grab by each plug-in when installed'); -define('_MI_ENTRIES_SORT', 'Entries sort by'); -define('_MI_ENTRIES_SORT_DESC', 'Entries sort order for the RSS feed output'); -define('_MI_ENTRIES_SORT_DATE', 'Date'); -define('_MI_ENTRIES_SORT_CAT', 'Category'); -define('_MI_CACHE', 'Cache lifetime (minutes)'); -define('_MI_CACHE_DESC', 'This option will also be used for the Time-to-Live (TTL) channel element of the RSS output.'); -define('_MI_MAXCHAR', 'Maximum characters of item descriptions'); -define('_MI_MAXCHAR_DESC', '0 = show entire content'); -define('_MI_STRIPHTML', 'Strip html tags'); -define('_MI_STRIPHTML_DESC', 'Remove html tags from item description elements, including Xoopscodes and Smileys'); -define('_MI_ENCODE_UTF8', 'Encode contents to UTF-8'); -define('_MI_ENCODE_UTF8_DESC', 'Note: probably not functional and recommended to turn off.'); +define('_MI_RSSFIT_OVERALL_ENTRIES', 'Total entries to show'); +define('_MI_RSSFIT_OVERALL_ENTRIES_DESC', 'Number of entries to show in the RSS feed'); +define('_MI_RSSFIT_PLUGIN_ENTRIES', 'Default entry number for plug-ins'); +define('_MI_RSSFIT_PLUGIN_ENTRIES_DESC', 'Default number of entries to grab by each plug-in when installed'); +define('_MI_RSSFIT_ENTRIES_SORT', 'Entries sort by'); +define('_MI_RSSFIT_ENTRIES_SORT_DESC', 'Entries sort order for the RSS feed output'); +define('_MI_RSSFIT_ENTRIES_SORT_DATE', 'Date'); +define('_MI_RSSFIT_ENTRIES_SORT_CAT', 'Category'); +define('_MI_RSSFIT_CACHE', 'Cache lifetime (minutes)'); +define('_MI_RSSFIT_CACHE_DESC', 'This option will also be used for the Time-to-Live (TTL) channel element of the RSS output.'); +define('_MI_RSSFIT_MAXCHAR', 'Maximum characters of item descriptions'); +define('_MI_RSSFIT_MAXCHAR_DESC', '0 = show entire content'); +define('_MI_RSSFIT_STRIPHTML', 'Strip html tags'); +define('_MI_RSSFIT_STRIPHTML_DESC', 'Remove html tags from item description elements, including Xoopscodes and Smileys'); +define('_MI_RSSFIT_ENCODE_UTF8', 'Encode contents to UTF-8'); +define('_MI_RSSFIT_ENCODE_UTF8_DESC', 'Note: probably not functional and recommended to turn off.'); // template explanations -define('_MI_TMPL_INTRO', 'Introduction in module home page'); -define('_MI_TMPL_RSS', 'RSS feed data'); +define('_MI_RSSFIT_TMPL_INTRO', 'Introduction in module home page'); +define('_MI_RSSFIT_TMPL_RSS', 'RSS feed data'); ######### version 1.1 additions ######### -define('_MI_OUTOUT_MIME', 'MIME type of RSS output'); -define('_MI_OUTOUT_MIME_XML', 'XML (text/xml)'); -define('_MI_OUTOUT_MIME_HTML', 'HTML (text/html)'); -define('_MI_OUTOUT_MIME_PHP', 'HTML with php-debug'); +define('_MI_RSSFIT_OUTOUT_MIME', 'MIME type of RSS output'); +define('_MI_RSSFIT_OUTOUT_MIME_XML', 'XML (text/xml)'); +define('_MI_RSSFIT_OUTOUT_MIME_HTML', 'HTML (text/html)'); +define('_MI_RSSFIT_OUTOUT_MIME_PHP', 'HTML with php-debug'); //1.30 //Help define('_MI_RSSFIT_DIRNAME', basename(dirname(dirname(__DIR__)))); -define('_MI_RSSFIT_HELP_HEADER', __DIR__.'/help/helpheader.tpl'); +define('_MI_RSSFIT_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); define('_MI_RSSFIT_BACK_2_ADMIN', 'Back to Administration of '); define('_MI_RSSFIT_OVERVIEW', 'Overview'); diff --git a/language/index.html b/language/index.html index 990cbd60..2c5cdd3f 100644 --- a/language/index.html +++ b/language/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/plugins/rssfit.adslight.php b/plugins/rssfit.adslight.php index bac5efea..72167768 100644 --- a/plugins/rssfit.adslight.php +++ b/plugins/rssfit.adslight.php @@ -50,6 +50,9 @@ class RssfitAdslight public $grab; public $module; // optional, see line 74 + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -62,21 +65,25 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT lid, title, status, desctext, date from ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid = 'Yes' ORDER BY date DESC"; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT lid, title, status, desctext, date FROM ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid = 'Yes' ORDER BY date DESC"; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewads.php?lid='.$row['lid']; - $ret[$i]['title'] = $row['title']; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewads.php?lid=' . $row['lid']; + $ret[$i]['title'] = $row['title']; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $row['desctext']; // $myts->displayTarea($row['desctext']); - $ret[$i]['extras'] = []; + $ret[$i]['extras'] = []; $i++; } return $ret; diff --git a/plugins/rssfit.ams.php b/plugins/rssfit.ams.php index c33259cd..0c21ae63 100644 --- a/plugins/rssfit.ams.php +++ b/plugins/rssfit.ams.php @@ -40,12 +40,19 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitAms + */ class RssfitAms { public $dirname = 'AMS'; public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -56,20 +63,24 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { $ret = false; - @include_once XOOPS_ROOT_PATH.'/modules/AMS/class/class.newsstory.php'; + @include_once XOOPS_ROOT_PATH . '/modules/AMS/class/class.newsstory.php'; $myts = \MyTextSanitizer::getInstance(); - $ams = AmsStory::getAllPublished($this->grab, 0); + $ams = AmsStory::getAllPublished($this->grab, 0); if (count($ams) > 0) { - for ($i=0, $iMax = count($ams); $i < $iMax; $i++) { - $ret[$i]['title'] = $myts->undoHtmlSpecialChars($ams[$i]->title()); - $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL.'/modules/AMS/article.php?storyid='.$ams[$i]->storyid(); - $ret[$i]['timestamp'] = $ams[$i]->published(); + for ($i = 0, $iMax = count($ams); $i < $iMax; $i++) { + $ret[$i]['title'] = $myts->undoHtmlSpecialChars($ams[$i]->title()); + $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/AMS/article.php?storyid=' . $ams[$i]->storyid(); + $ret[$i]['timestamp'] = $ams[$i]->published(); $ret[$i]['description'] = $ams[$i]->hometext(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } return $ret; diff --git a/plugins/rssfit.buyersguide.php b/plugins/rssfit.buyersguide.php index 62ec2a94..09ec8c70 100644 --- a/plugins/rssfit.buyersguide.php +++ b/plugins/rssfit.buyersguide.php @@ -52,6 +52,9 @@ class RssfitBuyersguide public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -62,17 +65,21 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { $ret = false; - include XOOPS_ROOT_PATH.'/modules/buyersguide/include/common.php'; + include XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; $items = $hBgProduct->getRecentProducts(0, 0, $this->grab); - $i = 0; + $i = 0; if (false !== $items && count($items) > 0) { foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('prod_title', 'n'); + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('prod_title', 'n'); $ret[$i]['timestamp'] = $item->getVar('prod_submited_date'); if ('' != xoops_trim($item->getVar('prod_summary'))) { $description = $item->getVar('prod_summary'); @@ -80,8 +87,8 @@ public function &grabEntries(&$obj) $description = $item->getVar('prod_description'); } $ret[$i]['description'] = $description; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/plugins/rssfit.buyersguidemanufacturers.php b/plugins/rssfit.buyersguidemanufacturers.php index beffda77..cfbfce24 100644 --- a/plugins/rssfit.buyersguidemanufacturers.php +++ b/plugins/rssfit.buyersguidemanufacturers.php @@ -52,6 +52,9 @@ class RssfitBuyersguidemanufacturers public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -62,21 +65,25 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { $ret = false; - include XOOPS_ROOT_PATH.'/modules/buyersguide/include/common.php'; + include XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; $items = $hBgManufacturer->getListofActivteManufacturers(0, $this->grab, 'manu_date_added', 'DESC'); - $i = 0; + $i = 0; if (false !== $items && count($items) > 0) { foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('manu_name', 'n'); - $ret[$i]['timestamp'] = $item->getVar('manu_date_added'); + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('manu_name', 'n'); + $ret[$i]['timestamp'] = $item->getVar('manu_date_added'); $ret[$i]['description'] = $item->getVar('manu_description'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/plugins/rssfit.buyersguidenews.php b/plugins/rssfit.buyersguidenews.php index 4c425106..43dd074f 100644 --- a/plugins/rssfit.buyersguidenews.php +++ b/plugins/rssfit.buyersguidenews.php @@ -52,6 +52,9 @@ class RssfitBuyersguidenews public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -62,21 +65,25 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { $ret = false; - include XOOPS_ROOT_PATH.'/modules/buyersguide/include/common.php'; + include XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; $items = $hBgNews->getRecentNews(0, $this->grab); - $i = 0; + $i = 0; if (false !== $items && count($items) > 0) { foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('news_title', 'n'); - $ret[$i]['timestamp'] = $item->getVar('news_date'); + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('news_title', 'n'); + $ret[$i]['timestamp'] = $item->getVar('news_date'); $ret[$i]['description'] = $item->getShortenText(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/plugins/rssfit.cbb.php b/plugins/rssfit.cbb.php index 91a23311..7096ae51 100644 --- a/plugins/rssfit.cbb.php +++ b/plugins/rssfit.cbb.php @@ -40,6 +40,10 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitCbb + */ class RssfitCbb { public $dirname = 'newbb'; @@ -47,6 +51,9 @@ class RssfitCbb public $module; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -54,22 +61,26 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } + /** + * @param $obj + * @return mixed + */ public function &grabEntries(&$obj) { - @include XOOPS_ROOT_PATH.'/modules/newbb/include/functions.php'; + @include XOOPS_ROOT_PATH . '/modules/newbb/include/functions.php'; global $xoopsDB; - $xoopsModule = $this->module; - $myts = \MyTextSanitizer::getInstance(); - $i = 0; + $xoopsModule = $this->module; + $myts = \MyTextSanitizer::getInstance(); + $i = 0; $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $topicHandler = xoops_getModuleHandler('topic', 'newbb'); - $newbbConfig = $GLOBALS['config_handler']->getConfigsByCat(0, $this->module->getVar('mid')); + $newbbConfig = $GLOBALS['config_handler']->getConfigsByCat(0, $this->module->getVar('mid')); - $access_forums = $forumHandler->getForums(0, 'access'); + $access_forums = $forumHandler->getForums(0, 'access'); $available_forums = []; foreach ($access_forums as $forum) { if ($topicHandler->getPermission($forum)) { @@ -80,20 +91,30 @@ public function &grabEntries(&$obj) if (count($available_forums) > 0) { ksort($available_forums); - $cond = ' AND t.forum_id IN ('.implode(',', array_keys($available_forums)).')'; + $cond = ' AND t.forum_id IN (' . implode(',', array_keys($available_forums)) . ')'; unset($available_forums); - $cond .= $newbbConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; - $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; - $query = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM '.$xoopsDB->prefix('bb_posts').' p, '.$xoopsDB->prefix('bb_forums').' f, '.$xoopsDB->prefix('bb_topics').' t, '.$xoopsDB->prefix('bb_posts_text').' pt WHERE f.forum_id = p.forum_id AND p.post_id = pt.post_id AND p.topic_id = t.topic_id AND t.approved = 1 AND p.approved = 1 AND f.forum_id = t.forum_id '.$cond.' ORDER BY p.post_time DESC'; + $cond .= $newbbConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; + $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; + $query = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM ' + . $xoopsDB->prefix('bb_posts') + . ' p, ' + . $xoopsDB->prefix('bb_forums') + . ' f, ' + . $xoopsDB->prefix('bb_topics') + . ' t, ' + . $xoopsDB->prefix('bb_posts_text') + . ' pt WHERE f.forum_id = p.forum_id AND p.post_id = pt.post_id AND p.topic_id = t.topic_id AND t.approved = 1 AND p.approved = 1 AND f.forum_id = t.forum_id ' + . $cond + . ' ORDER BY p.post_time DESC'; $result = $xoopsDB->query($query, $this->grab); while ($row = $xoopsDB->fetchArray($result)) { - $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewtopic.php?topic_id='.$row['topic_id'].'&forum='.$row['forum_id'].'&post_id='.$row['post_id'].'#forumpost'.$row['post_id']; - $ret[$i]['title'] = $row['subject']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['post_time']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; + $ret[$i]['title'] = $row['subject']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['post_time']; $ret[$i]['description'] = $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr']); - $ret[$i]['category'] = $row['forum_name']; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/viewforum.php?forum='.$row['forum_id']; + $ret[$i]['category'] = $row['forum_name']; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; $i++; } } diff --git a/plugins/rssfit.comments.php b/plugins/rssfit.comments.php index 557f1b6d..5bddf194 100644 --- a/plugins/rssfit.comments.php +++ b/plugins/rssfit.comments.php @@ -40,12 +40,19 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitComments + */ class RssfitComments { public $dirname = 'system'; public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -56,31 +63,51 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { $ret = false; - include_once XOOPS_ROOT_PATH.'/include/comment_constants.php'; + include_once XOOPS_ROOT_PATH . '/include/comment_constants.php'; $commentHandler = xoops_getHandler('comment'); - $criteria = new CriteriaCompo(new Criteria('com_status', XOOPS_COMMENT_ACTIVE)); + $criteria = new \CriteriaCompo(new \Criteria('com_status', XOOPS_COMMENT_ACTIVE)); $criteria->setLimit($this->grab); $criteria->setSort('com_created'); $criteria->setOrder('DESC'); - $comments = $commentHandler->getObjects($criteria, true); + $comments = $commentHandler->getObjects($criteria, true); $comment_config = []; if (count($comments) > 0) { - $modules = $GLOBALS['module_handler']->getObjects(new Criteria('hascomments', 1), true); + $modules = $GLOBALS['module_handler']->getObjects(new \Criteria('hascomments', 1), true); foreach (array_keys($comments) as $i) { $mid = $comments[$i]->getVar('com_modid'); if (!isset($comment_config[$mid])) { $comment_config[$mid] = $modules[$mid]->getInfo('comments'); } - $ret[$i]['title'] = 'Comments: '.$comments[$i]->getVar('com_title', 'n'); - $link = XOOPS_URL.'/modules/'.$modules[$mid]->getVar('dirname').'/'.$comment_config[$mid]['pageName'].'?'.$comment_config[$mid]['itemName'].'='.$comments[$i]->getVar('com_itemid').'&com_id='.$i.'&com_rootid='.$comments[$i]->getVar('com_rootid').'&'.$comments[$i]->getVar('com_exparams').'#comment'.$i; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $comments[$i]->getVar('com_created'); + $ret[$i]['title'] = 'Comments: ' . $comments[$i]->getVar('com_title', 'n'); + $link = XOOPS_URL + . '/modules/' + . $modules[$mid]->getVar('dirname') + . '/' + . $comment_config[$mid]['pageName'] + . '?' + . $comment_config[$mid]['itemName'] + . '=' + . $comments[$i]->getVar('com_itemid') + . '&com_id=' + . $i + . '&com_rootid=' + . $comments[$i]->getVar('com_rootid') + . '&' + . $comments[$i]->getVar('com_exparams') + . '#comment' + . $i; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $comments[$i]->getVar('com_created'); $ret[$i]['description'] = $comments[$i]->getVar('com_text'); - $ret[$i]['category'] = $modules[$mid]->getVar('name', 'n'); - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$modules[$mid]->getVar('dirname').'/'; + $ret[$i]['category'] = $modules[$mid]->getVar('name', 'n'); + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname') . '/'; } } return $ret; diff --git a/plugins/rssfit.extcal.php b/plugins/rssfit.extcal.php index b1ed19bc..5493d6e8 100644 --- a/plugins/rssfit.extcal.php +++ b/plugins/rssfit.extcal.php @@ -37,9 +37,9 @@ * Step 3: Modify the word in line 60 from 'Myalbum' to [mod_dir] * Step 4: Modify the function "grabEntries" to satisfy your needs * Step 5: Move your new plug-in file to the RSSFit plugins folder, -* i.e. your-xoops-root/modules/rss/plugins +* i.e. your-xoops-root/modules/rssfit/plugins * Step 6: Install your plug-in by pointing your browser to -* your-xoops-url/modules/rss/admin/?do=plugins +* your-xoops-url/modules/rssfit/admin/?do=plugins * Step 7: Finally, tell us about yourself and this file by modifying the * "About this RSSFit plug-in" section which is located... somewhere. * @@ -57,6 +57,10 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitExtcal + */ class RssfitExtcal { public $dirname = 'extcal'; @@ -64,6 +68,9 @@ class RssfitExtcal public $grab; public $module; // optional, see line 74 + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -71,46 +78,50 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing + $this->module = $mod; // optional, remove this line if there is nothing // to do with module info when grabbing entries return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = false; $i = 0; // read confgs to get timestamp format - $extcal = $this->module; - $configHandler = xoops_getHandler('config'); - $extcalConfig = &$configHandler->getConfigsByCat(0, $extcal->getVar('mid')); - $long_form=$extcalConfig['date_long']; + $extcal = $this->module; + $configHandler = xoops_getHandler('config'); + $extcalConfig = &$configHandler->getConfigsByCat(0, $extcal->getVar('mid')); + $long_form = $extcalConfig['date_long']; $eventHandler = xoops_getModuleHandler('event', 'extcal'); - $catHandler = xoops_getModuleHandler('cat', 'extcal'); - $events = $eventHandler->getUpcomingEvent(0, $this->grab, 0); + $catHandler = xoops_getModuleHandler('cat', 'extcal'); + $events = $eventHandler->getUpcomingEvent(0, $this->grab, 0); if (is_array($events)) { foreach ($events as $event) { ++$i; - $cat=$catHandler->getCat($event->getVar('cat_id'), 0); - $category=$cat->getVar('cat_name'); - $link=XOOPS_URL.'/modules/extcal/event.php?event='.$event->getVar('event_id'); + $cat = $catHandler->getCat($event->getVar('cat_id'), 0); + $category = $cat->getVar('cat_name'); + $link = XOOPS_URL . '/modules/extcal/event.php?event=' . $event->getVar('event_id'); $event_start = formatTimestamp($event->getVar('event_start'), $long_form); - $title = xoops_utf8_encode(htmlspecialchars($event->getVar('event_title'), ENT_QUOTES)); - $description=xoops_utf8_encode(htmlspecialchars($event->getVar('event_desc'), ENT_QUOTES)); - $address=$event->getVar('event_address'); + $title = xoops_utf8_encode(htmlspecialchars($event->getVar('event_title'), ENT_QUOTES)); + $description = xoops_utf8_encode(htmlspecialchars($event->getVar('event_desc'), ENT_QUOTES)); + $address = $event->getVar('event_address'); - $desc_link=$event->getVar('event_url'); + $desc_link = $event->getVar('event_url'); if ('' == $desc_link) { - $desc_link=$link; + $desc_link = $link; } - $desc = "$title
"; + $desc = "$title
"; $desc .= ''; $desc .= ""; if ('' != $address) { @@ -119,12 +130,12 @@ public function &grabEntries(&$obj) $desc .= ""; $desc .= '
When:$event_start
What:$description
'; - $ret[$i]['title'] = $category.': '.$title; - $ret[$i]['link'] = $link; + $ret[$i]['title'] = $category . ': ' . $title; + $ret[$i]['link'] = $link; $ret[$i]['description'] = $desc; - $ret[$i]['timestamp'] = $event->getVar('event_submitdate'); + $ret[$i]['timestamp'] = $event->getVar('event_submitdate'); // $ret[$i]['timestamp'] = time(); - $ret[$i]['guid'] = $link; + $ret[$i]['guid'] = $link; $ret[$i]['category'] = $category; } } diff --git a/plugins/rssfit.lexikon.php b/plugins/rssfit.lexikon.php index e2a19437..aae21346 100644 --- a/plugins/rssfit.lexikon.php +++ b/plugins/rssfit.lexikon.php @@ -45,13 +45,16 @@ /** * Class Rssfitlexikon */ -class Rssfitlexikon extends XoopsObject +class Rssfitlexikon extends \XoopsObject { public $dirname = 'lexikon'; public $modname; public $module; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -59,34 +62,37 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); //$perm_handler = xoops_getHandler('groupperm'); - $ret = false; - $i = 0; - $sql = 'SELECT entryID, categoryID, term, definition, datesub FROM ' - . $xoopsDB->prefix('lxentries') . ' WHERE submit = 0 AND offline = 0 ORDER BY datesub DESC'; + $ret = false; + $i = 0; + $sql = 'SELECT entryID, categoryID, term, definition, datesub FROM ' . $xoopsDB->prefix('lxentries') . ' WHERE submit = 0 AND offline = 0 ORDER BY datesub DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { // required $ret[$i]['title'] = $row['term']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/entry.php?entryID='.$row['entryID']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/entry.php?entryID=' . $row['entryID']; //$ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['datesub']; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['datesub']; $ret[$i]['description'] = $myts->displayTarea($row['definition']); // optional //5. The item synopsis, or description, whatever //$ret[$i]['guid'] = $link; // 6. A string + domain that identifies a categorization taxonomy $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; /*$ret[$i]['extras'] = array(); // 7a. without attribute $ret[$i]['extras']['author'] = array('content' => 'aabbc@c.com'); diff --git a/plugins/rssfit.myalbum.php b/plugins/rssfit.myalbum.php index a162b42e..6bc3ea84 100644 --- a/plugins/rssfit.myalbum.php +++ b/plugins/rssfit.myalbum.php @@ -37,9 +37,9 @@ * Step 3: Modify the word in line 60 from 'Myalbum' to [mod_dir] * Step 4: Modify the function "grabEntries" to satisfy your needs * Step 5: Move your new plug-in file to the RSSFit plugins folder, -* i.e. your-xoops-root/modules/rss/plugins +* i.e. your-xoops-root/modules/rssfit/plugins * Step 6: Install your plug-in by pointing your browser to -* your-xoops-url/modules/rss/admin/?do=plugins +* your-xoops-url/modules/rssfit/admin/?do=plugins * Step 7: Finally, tell us about yourself and this file by modifying the * "About this RSSFit plug-in" section which is located... somewhere. * @@ -57,6 +57,10 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitMyalbum + */ class RssfitMyalbum { public $dirname = 'myalbum'; @@ -64,6 +68,9 @@ class RssfitMyalbum public $grab; public $module; // optional, see line 74 + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -71,56 +78,64 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing + $this->module = $mod; // optional, remove this line if there is nothing // to do with module info when grabbing entries return $mod; } + /** + * @param $uid + * @return string + */ public function myGetUnameFromId($uid) { - static $thisUser=false; - static $lastUid=false; - static $lastName=''; + static $thisUser = false; + static $lastUid = false; + static $lastName = ''; - if ($lastUid==$uid) { + if ($lastUid == $uid) { return $lastName; } if (!is_object($thisUser)) { $memberHandler = xoops_getHandler('member'); - $thisUser = $memberHandler->getUser($uid); + $thisUser = $memberHandler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name')); if ('' == $name) { $name = htmlspecialchars($thisUser->getVar('uname')); } - $lastUid=$uid; - $lastName=$name; + $lastUid = $uid; + $lastName = $name; return $name; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; + $ret = false; + $i = 0; // For myalbum-p with thumbs enabled - $sql = 'SELECT p.lid, p.title, p.ext, p.date, t.description, c.cid, c.title as cat, p.submitter'; - $sql .= ' FROM ' . $xoopsDB->prefix('myalbum_photos') . ' p, '; - $sql .= $xoopsDB->prefix('myalbum_text') . ' t, '; - $sql .= $xoopsDB->prefix('myalbum_cat') . ' c '; - $sql .= 'WHERE p.status > 0 AND p.cid = c.cid AND p.lid = t.lid '; - $sql .= 'ORDER BY date DESC'; + $sql = 'SELECT p.lid, p.title, p.ext, p.date, t.description, c.cid, c.title as cat, p.submitter'; + $sql .= ' FROM ' . $xoopsDB->prefix('myalbum_photos') . ' p, '; + $sql .= $xoopsDB->prefix('myalbum_text') . ' t, '; + $sql .= $xoopsDB->prefix('myalbum_cat') . ' c '; + $sql .= 'WHERE p.status > 0 AND p.cid = c.cid AND p.lid = t.lid '; + $sql .= 'ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - $link = XOOPS_URL.'/modules/'.$this->dirname.'/photo.php?lid='.$row['lid']; - $thumb = XOOPS_URL.'/uploads/thumbs/'.$row['lid'].'.'.$row['ext']; - $name = $this->myGetUnameFromId($row['submitter']); - $title = $myts->displayTarea($row['title']); - $cat = $myts->displayTarea($row['cat']); - $catlink = XOOPS_URL.'/modules/'.$this->dirname.'/viewcat.php?cid='.$row['cid']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/photo.php?lid=' . $row['lid']; + $thumb = XOOPS_URL . '/uploads/thumbs/' . $row['lid'] . '.' . $row['ext']; + $name = $this->myGetUnameFromId($row['submitter']); + $title = $myts->displayTarea($row['title']); + $cat = $myts->displayTarea($row['cat']); + $catlink = XOOPS_URL . '/modules/' . $this->dirname . '/viewcat.php?cid=' . $row['cid']; /* * Required elements of an RSS item */ @@ -131,9 +146,9 @@ public function &grabEntries(&$obj) // 3. Item modification date, must be in Unix time format $ret[$i]['timestamp'] = $row['date']; // 4. The item synopsis, or description, whatever - $desc = '

'.$title.' '; - $desc .= 'By '.$name.' in '.$cat.'
'; - $desc .= $myts->displayTarea($row['description']).'


'; + $desc = '

' . $title . ' '; + $desc .= 'By ' . $name . ' in ' . $cat . '
'; + $desc .= $myts->displayTarea($row['description']) . '


'; $ret[$i]['description'] = $desc; /* * Optional elements of an RSS item @@ -142,7 +157,7 @@ public function &grabEntries(&$obj) $ret[$i]['guid'] = $link; // 6. A string + domain that identifies a categorization taxonomy $ret[$i]['category'] = $cat; - $ret[$i]['domain'] = $catlink; + $ret[$i]['domain'] = $catlink; $i++; } diff --git a/plugins/rssfit.mydownloads.php b/plugins/rssfit.mydownloads.php index d0ae4e2c..d28881a0 100644 --- a/plugins/rssfit.mydownloads.php +++ b/plugins/rssfit.mydownloads.php @@ -42,12 +42,18 @@ exit(); } -class RssfitMydownloads extends XoopsObject +/** + * Class RssfitMydownloads + */ +class RssfitMydownloads extends \XoopsObject { public $dirname = 'mydownloads'; public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -58,24 +64,26 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $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'; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $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'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlefile.php?cid='.$row['cid'].'&lid='.$row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } return $ret; diff --git a/plugins/rssfit.mylinks.php b/plugins/rssfit.mylinks.php index 24a437d7..3b3ee0fa 100644 --- a/plugins/rssfit.mylinks.php +++ b/plugins/rssfit.mylinks.php @@ -40,12 +40,19 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitMylinks + */ class RssfitMylinks { public $dirname = 'mylinks'; public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -56,24 +63,26 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' - . $xoopsDB->prefix('mylinks_links') . ' l, ' - . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?cid='.$row['cid'].'&lid='.$row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } return $ret; diff --git a/plugins/rssfit.mytube.php b/plugins/rssfit.mytube.php index e420da54..892445ea 100644 --- a/plugins/rssfit.mytube.php +++ b/plugins/rssfit.mytube.php @@ -51,35 +51,40 @@ class RssfitMytube public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { - $mod = $GLOBALS['module_handler'] -> getByDirname($this -> dirname); + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } - $this -> modname = $mod -> getVar('name'); + $this->modname = $mod->getVar('name'); return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' - . $xoopsDB-> prefix('xoopstube_videos') . ' l, ' - . $xoopsDB-> prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; + $ret = false; + $i = 0; + $sql = 'SELECT l.lid, l.title AS ltitle, l.date, l.cid, l.hits, l.description, c.title AS ctitle FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; - $result = $xoopsDB -> query($sql, $this -> grab, 0); - while ($row = $xoopsDB -> fetchArray($result)) { - $ret[$i]['title'] = $row['ltitle']; - $link = XOOPS_URL . '/modules/' . $this -> dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $myts -> displayTarea($row['description']); - $ret[$i]['category'] = $this -> modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this -> dirname . '/'; + $result = $xoopsDB->query($sql, $this->grab, 0); + while ($row = $xoopsDB->fetchArray($result)) { + $ret[$i]['title'] = $row['ltitle']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } return $ret; diff --git a/plugins/rssfit.newbb.php b/plugins/rssfit.newbb.php index 774f0149..bd15ae38 100644 --- a/plugins/rssfit.newbb.php +++ b/plugins/rssfit.newbb.php @@ -40,12 +40,19 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitNewbb + */ class RssfitNewbb { public $dirname = 'newbb'; public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -59,25 +66,35 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; - include_once XOOPS_ROOT_PATH.'/modules/'.$this->dirname.'/class/class.forumposts.php'; + include_once XOOPS_ROOT_PATH . '/modules/' . $this->dirname . '/class/class.forumposts.php'; $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.nohtml, p.nosmiley, f.forum_name, t.post_text FROM '.$xoopsDB->prefix('bb_posts').' p, '.$xoopsDB->prefix('bb_forums').' f, '.$xoopsDB->prefix('bb_posts_text').' t WHERE f.forum_id = p.forum_id AND p.post_id = t.post_id AND f.forum_type != 1 ORDER BY p.post_time DESC'; + $ret = false; + $i = 0; + $sql = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.nohtml, p.nosmiley, f.forum_name, t.post_text FROM ' + . $xoopsDB->prefix('bb_posts') + . ' p, ' + . $xoopsDB->prefix('bb_forums') + . ' f, ' + . $xoopsDB->prefix('bb_posts_text') + . ' t WHERE f.forum_id = p.forum_id AND p.post_id = t.post_id AND f.forum_type != 1 ORDER BY p.post_time DESC'; if (!$result = $xoopsDB->query($sql, $this->grab, 0)) { return $ret; } while ($row = $xoopsDB->fetchArray($result)) { - $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewtopic.php?topic_id='.$row['topic_id'].'&forum='.$row['forum_id'].'&post_id='.$row['post_id'].'#forumpost'.$row['post_id']; - $ret[$i]['title'] = $row['subject']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['post_time']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; + $ret[$i]['title'] = $row['subject']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['post_time']; $ret[$i]['description'] = $myts->displayTarea($row['post_text'], $row['nohtml'] ? 0 : 1, $row['nosmiley'] ? 0 : 1); - $ret[$i]['category'] = $row['forum_name']; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/viewforum.php?forum='.$row['forum_id']; + $ret[$i]['category'] = $row['forum_name']; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; $i++; } return $ret; diff --git a/plugins/rssfit.newbb2.php b/plugins/rssfit.newbb2.php index 0e5ea598..95db2673 100644 --- a/plugins/rssfit.newbb2.php +++ b/plugins/rssfit.newbb2.php @@ -40,6 +40,10 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitNewbb2 + */ class RssfitNewbb2 { public $dirname = 'newbb'; @@ -47,6 +51,9 @@ class RssfitNewbb2 public $module; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -54,50 +61,58 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } + /** + * @param $uid + * @return string + */ public function myGetUnameFromId($uid) { - static $thisUser=false; - static $lastUid=false; - static $lastName=''; + static $thisUser = false; + static $lastUid = false; + static $lastName = ''; if (0 == $uid) { return 'A guest'; } - if ($lastUid==$uid) { + if ($lastUid == $uid) { return $lastName; } if (!is_object($thisUser)) { $memberHandler = xoops_getHandler('member'); - $thisUser = $memberHandler->getUser($uid); + $thisUser = $memberHandler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name')); if ('' == $name) { $name = htmlspecialchars($thisUser->getVar('uname')); } - $lastUid=$uid; - $lastName=$name; + $lastUid = $uid; + $lastName = $name; return $name; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { - @include XOOPS_ROOT_PATH.'/modules/newbb/include/functions.php'; + @include XOOPS_ROOT_PATH . '/modules/newbb/include/functions.php'; global $xoopsDB, $config_handler; - $xoopsModule = $this->module; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; + $xoopsModule = $this->module; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $topicHandler = xoops_getModuleHandler('topic', 'newbb'); - $newbbConfig = $config_handler->getConfigsByCat(0, $this->module->getVar('mid')); + $newbbConfig = $config_handler->getConfigsByCat(0, $this->module->getVar('mid')); - $access_forums = $forumHandler->getForums(0, 'access'); + $access_forums = $forumHandler->getForums(0, 'access'); $available_forums = []; foreach ($access_forums as $forum) { if ($topicHandler->getPermission($forum)) { @@ -108,20 +123,30 @@ public function &grabEntries(&$obj) if (count($available_forums) > 0) { ksort($available_forums); - $cond = ' AND t.forum_id IN ('.implode(',', array_keys($available_forums)).')'; + $cond = ' AND t.forum_id IN (' . implode(',', array_keys($available_forums)) . ')'; unset($available_forums); - $cond .= $newbbConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; - $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; - $query = 'SELECT p.uid, p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM '.$xoopsDB->prefix('bb_posts').' p, '.$xoopsDB->prefix('bb_forums').' f, '.$xoopsDB->prefix('bb_topics').' t, '.$xoopsDB->prefix('bb_posts_text').' pt WHERE f.forum_id = p.forum_id AND p.post_id = pt.post_id AND p.topic_id = t.topic_id AND t.approved = 1 AND p.approved = 1 AND f.forum_id = t.forum_id '.$cond.' ORDER BY p.post_time DESC'; + $cond .= $newbbConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; + $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; + $query = 'SELECT p.uid, p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM ' + . $xoopsDB->prefix('bb_posts') + . ' p, ' + . $xoopsDB->prefix('bb_forums') + . ' f, ' + . $xoopsDB->prefix('bb_topics') + . ' t, ' + . $xoopsDB->prefix('bb_posts_text') + . ' pt WHERE f.forum_id = p.forum_id AND p.post_id = pt.post_id AND p.topic_id = t.topic_id AND t.approved = 1 AND p.approved = 1 AND f.forum_id = t.forum_id ' + . $cond + . ' ORDER BY p.post_time DESC'; $result = $xoopsDB->query($query, $this->grab); while ($row = $xoopsDB->fetchArray($result)) { - $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewtopic.php?topic_id='.$row['topic_id'].'&forum='.$row['forum_id'].'&post_id='.$row['post_id'].'#forumpost'.$row['post_id']; - $ret[$i]['title'] = $this->modname . ': ' . $row['subject']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['post_time']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; + $ret[$i]['title'] = $this->modname . ': ' . $row['subject']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['post_time']; $ret[$i]['description'] = sprintf('Posted by: %s
%s', $this->myGetUnameFromId($row['uid']), $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr'])); - $ret[$i]['category'] = $row['forum_name']; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/viewforum.php?forum='.$row['forum_id']; + $ret[$i]['category'] = $row['forum_name']; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; $i++; } } diff --git a/plugins/rssfit.news.php b/plugins/rssfit.news.php index f612fcc5..3e52cde3 100644 --- a/plugins/rssfit.news.php +++ b/plugins/rssfit.news.php @@ -40,12 +40,19 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitNews + */ class RssfitNews { public $dirname = 'news'; public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -53,31 +60,35 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { $ret = false; - @include_once XOOPS_ROOT_PATH.'/modules/news/class/class.newsstory.php'; + @include_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; $myts = \MyTextSanitizer::getInstance(); if ($this->module->getVar('version') >= 130) { - @include_once XOOPS_ROOT_PATH.'/modules/news/include/functions.php'; + @include_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php'; $news = NewsStory::getAllPublished($this->grab, 0, getmoduleoption('restrictindex')); } else { $news = NewsStory::getAllPublished($this->grab, 0); } if (count($news) > 0) { - for ($i=0, $iMax = count($news); $i < $iMax; $i++) { - $ret[$i]['title'] = $this->modname . ': ' . $myts->undoHtmlSpecialChars($news[$i]->title()); - $ret[$i]['link'] = XOOPS_URL.'/modules/news/article.php?storyid='.$news[$i]->storyid(); - $ret[$i]['guid'] = XOOPS_URL.'/modules/news/article.php?storyid='.$news[$i]->storyid(); - $ret[$i]['timestamp'] = $news[$i]->published(); - $desc = $news[$i]->hometext(); + for ($i = 0, $iMax = count($news); $i < $iMax; $i++) { + $ret[$i]['title'] = $this->modname . ': ' . $myts->undoHtmlSpecialChars($news[$i]->title()); + $ret[$i]['link'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); + $ret[$i]['guid'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); + $ret[$i]['timestamp'] = $news[$i]->published(); + $desc = $news[$i]->hometext(); $ret[$i]['description'] = $news[$i]->hometext(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } return $ret; diff --git a/plugins/rssfit.oledrion.php b/plugins/rssfit.oledrion.php index 8043fc67..7a0da6af 100644 --- a/plugins/rssfit.oledrion.php +++ b/plugins/rssfit.oledrion.php @@ -11,10 +11,10 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright Hervé Thouzard of Instant Zero (http://www.instant-zero.com) - * @license http://www.fsf.org/copyleft/gpl.html GNU public license - * @package oledrion - * @author Hervé Thouzard of Instant Zero (http://www.instant-zero.com) + * @copyright Hervé Thouzard of Instant Zero (http://www.instant-zero.com) + * @license http://www.fsf.org/copyleft/gpl.html GNU public license + * @package oledrion + * @author Hervé Thouzard of Instant Zero (http://www.instant-zero.com) * * **************************************************************************** */ @@ -32,6 +32,9 @@ class RssfitOledrion public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -42,17 +45,21 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { $ret = false; - include XOOPS_ROOT_PATH.'/modules/oledrion/include/common.php'; + include XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; $items = $h_oledrion_products->getRecentProducts(new Oledrion_parameters(['start' => 0, 'limit' => $this->grab])); - $i = 0; + $i = 0; if (false !== $items && count($items) > 0) { foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('product_title', 'n'); + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('product_title', 'n'); $ret[$i]['timestamp'] = $item->getVar('product_submitted'); if ('' != xoops_trim($item->getVar('product_summary'))) { $description = $item->getVar('product_summary'); @@ -60,8 +67,8 @@ public function &grabEntries(&$obj) $description = $item->getVar('product_description'); } $ret[$i]['description'] = $description; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/plugins/rssfit.pical.php b/plugins/rssfit.pical.php index e1de49d1..e57c94f0 100644 --- a/plugins/rssfit.pical.php +++ b/plugins/rssfit.pical.php @@ -51,6 +51,9 @@ class RssfitpiCal public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -61,23 +64,26 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' - . $xoopsDB->prefix('pical_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) AS dtstamp FROM ' . $xoopsDB->prefix('pical_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - $ret[$i]['title'] = $row['summary']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/index.php?event_id='.$row['id']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['dtstamp']; + $ret[$i]['title'] = $row['summary']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/index.php?event_id=' . $row['id']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['dtstamp']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } return $ret; diff --git a/plugins/rssfit.pluginsample.php b/plugins/rssfit.pluginsample.php index 5781d4f6..aae69135 100644 --- a/plugins/rssfit.pluginsample.php +++ b/plugins/rssfit.pluginsample.php @@ -37,9 +37,9 @@ * Step 3: Modify the word in line 60 from 'sample' to [mod_dir] * Step 4: Modify the function "grabEntries" to satisfy your needs * Step 5: Move your new plug-in file to the RSSFit plugins folder, -* i.e. your-xoops-root/modules/rss/plugins +* i.e. your-xoops-root/modules/rssfit/plugins * Step 6: Install your plug-in by pointing your browser to -* your-xoops-url/modules/rss/admin/?do=plugins +* your-xoops-url/modules/rssfit/admin/?do=plugins * Step 7: Finally, tell us about yourself and this file by modifying the * "About this RSSFit plug-in" section which is located... somewhere. * @@ -57,6 +57,10 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitSample + */ class RssfitSample { public $dirname = 'sample'; @@ -64,6 +68,9 @@ class RssfitSample public $grab; public $module; // optional, see line 71 + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -71,24 +78,26 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing + $this->module = $mod; // optional, remove this line if there is nothing // to do with module info when grabbing entries return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; + $ret = false; + $i = 0; // The following example code grabs the latest entries from the module MyLinks - $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' - . $xoopsDB->prefix('mylinks_links') . ' l, ' - . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC'; + $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?cid='.$row['cid'].'&lid='.$row['lid']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; /* * Required elements of an RSS item */ @@ -107,7 +116,7 @@ public function &grabEntries(&$obj) $ret[$i]['guid'] = $link; // 6. A string + domain that identifies a categorization taxonomy $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; // 7. extra tags examples $ret[$i]['extras'] = []; // 7a. without attribute diff --git a/plugins/rssfit.publisher.php b/plugins/rssfit.publisher.php index 9c6786d1..652b736b 100644 --- a/plugins/rssfit.publisher.php +++ b/plugins/rssfit.publisher.php @@ -40,12 +40,19 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitPublisher + */ class RssfitPublisher { public $dirname = 'publisher'; public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -56,21 +63,25 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { $ret = false; include XOOPS_ROOT_PATH . '/modules/publisher/include/common.php'; - $publisherHelper = Xmf\Module\Helper::getHelper('publisher'); - $publisherItemHandler = $publisherHelper->getHandler('item'); - $items = $publisherItemHandler->getAllPublished($this->grab, 0); + $publisherHelper = Xmf\Module\Helper::getHelper('publisher'); + $publisherItemHandler = $publisherHelper->getHandler('item'); + $items = $publisherItemHandler->getAllPublished($this->grab, 0); if (false !== $items && count($items) > 0) { - for ($i=0, $iMax = count($items); $i < $iMax; $i++) { - $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); - $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); - $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); + for ($i = 0, $iMax = count($items); $i < $iMax; $i++) { + $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); + $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); + $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); $ret[$i]['description'] = $items[$i]->getVar('summary'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } return $ret; diff --git a/plugins/rssfit.queries.php b/plugins/rssfit.queries.php index 8363b707..17991c4e 100644 --- a/plugins/rssfit.queries.php +++ b/plugins/rssfit.queries.php @@ -42,6 +42,9 @@ exit(); } +/** + * Class RssfitQueries + */ class RssfitQueries { public $dirname = 'queries'; @@ -49,6 +52,9 @@ class RssfitQueries public $grab; public $module; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -56,42 +62,46 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing + $this->module = $mod; // optional, remove this line if there is nothing // to do with module info when grabbing entries return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = false; - $i = -1; - $lasttime=false; - $lastuser=false; - $limit=10*$this->grab; + $i = -1; + $lasttime = false; + $lastuser = false; + $limit = 10 * $this->grab; $sql = 'SELECT id, title, posted, querytext FROM ' . $xoopsDB->prefix('queries_query'); - $sql.= ' WHERE approved=1 ORDER BY posted DESC '; + $sql .= ' WHERE approved=1 ORDER BY posted DESC '; $result = $xoopsDB->query($sql, $limit, 0); while ($row = $xoopsDB->fetchArray($result)) { ++$i; - if ($i<=$this->grab) { - $desc=$row['querytext']; - if (strlen($desc)>200) { - $desc=substr($desc, 0, 200).'...'; + if ($i <= $this->grab) { + $desc = $row['querytext']; + if (strlen($desc) > 200) { + $desc = substr($desc, 0, 200) . '...'; } - $link = XOOPS_URL.'/modules/queries/view.php?id='.$row['id']; - $ret[$i]['title'] = $this->modname . ': ' . $row['title']; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['posted']; - $ret[$i]['guid'] = $link; - $ret[$i]['category'] = $this->modname; + $link = XOOPS_URL . '/modules/queries/view.php?id=' . $row['id']; + $ret[$i]['title'] = $this->modname . ': ' . $row['title']; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['posted']; + $ret[$i]['guid'] = $link; + $ret[$i]['category'] = $this->modname; $ret[$i]['description'] = $desc; } - if ($i>$this->grab) { + if ($i > $this->grab) { break; } } diff --git a/plugins/rssfit.rmdp.php b/plugins/rssfit.rmdp.php index c85e2125..7ed79a1d 100644 --- a/plugins/rssfit.rmdp.php +++ b/plugins/rssfit.rmdp.php @@ -44,13 +44,16 @@ /** * Class Rssfitrmdp */ -class Rssfitrmdp extends XoopsObject +class Rssfitrmdp extends \XoopsObject { public $dirname = 'rmdp'; public $modname; public $module; public $grab; + /** + * @return bool|FALSE|\XoopsModule + */ public function loadModule() { global $module_handler; @@ -59,25 +62,29 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } + /** + * @param $obj + * @return array + */ public function grabEntries(&$obj) { global $xoopsDB, $moduleperm_handler; - $ret = []; - $i = 0; - $sql = 'SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ' . $xoopsDB->prefix('rmdp_software') . ' ORDER BY fecha DESC'; + $ret = []; + $i = 0; + $sql = 'SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ' . $xoopsDB->prefix('rmdp_software') . ' ORDER BY fecha DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - $ret[$i]['title'] = $row['nombre']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/down.php?id='.$row['id_soft']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['fecha']; + $ret[$i]['title'] = $row['nombre']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/down.php?id=' . $row['id_soft']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['fecha']; $ret[$i]['description'] = $row['longdesc']; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } return $ret; diff --git a/plugins/rssfit.smartfaq.php b/plugins/rssfit.smartfaq.php index 02b408f8..392dbeb5 100644 --- a/plugins/rssfit.smartfaq.php +++ b/plugins/rssfit.smartfaq.php @@ -40,12 +40,19 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitSmartfaq + */ class RssfitSmartfaq { public $dirname = 'smartfaq'; public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -56,26 +63,30 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { $ret = false; @include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; $faqHandler = sf_gethandler('faq'); - $faqs = $faqHandler->getAllPublished($this->grab, 0); + $faqs = $faqHandler->getAllPublished($this->grab, 0); if (false !== $faqs && count($faqs) > 0) { $answerHandler = sf_gethandler('answer'); - for ($i=0, $iMax = count($faqs); $i < $iMax; $i++) { + for ($i = 0, $iMax = count($faqs); $i < $iMax; $i++) { if (!$answer = $answerHandler->getOfficialAnswer($faqs[$i]->faqid())) { continue; } - $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL.'/modules/smartfaq/faq.php?faqid='.$faqs[$i]->faqid(); - $q = $faqs[$i]->getVar('howdoi', 'n'); - $q = empty($q) ? $faqs[$i]->getVar('question', 'n') : $q; - $ret[$i]['title'] = $q; - $ret[$i]['timestamp'] = $faqs[$i]->getVar('datesub'); + $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $faqs[$i]->faqid(); + $q = $faqs[$i]->getVar('howdoi', 'n'); + $q = empty($q) ? $faqs[$i]->getVar('question', 'n') : $q; + $ret[$i]['title'] = $q; + $ret[$i]['timestamp'] = $faqs[$i]->getVar('datesub'); $ret[$i]['description'] = $answer->getVar('answer'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } return $ret; diff --git a/plugins/rssfit.smartpartner.php b/plugins/rssfit.smartpartner.php index 1179145f..68179b57 100644 --- a/plugins/rssfit.smartpartner.php +++ b/plugins/rssfit.smartpartner.php @@ -41,12 +41,19 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitSmartpartner + */ class RssfitSmartpartner { public $dirname = 'smartpartner'; public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -57,18 +64,22 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { $ret = false; include XOOPS_ROOT_PATH . '/modules/smartpartner/include/common.php'; $partners = $partner_handler->getPartners($this->grab, 0, _SPARTNER_STATUS_ACTIVE, 'weight', 'DESC'); if (false !== $partners && count($partners) > 0) { - for ($i=0, $iMax = count($partners); $i < $iMax; $i++) { - $ret[$i]['link'] = $ret[$i]['guid'] = SMARTPARTNER_URL.'partner.php?id='.$partners[$i]->getVar('id'); - $ret[$i]['title'] = $partners[$i]->getVar('title', 'n'); + for ($i = 0, $iMax = count($partners); $i < $iMax; $i++) { + $ret[$i]['link'] = $ret[$i]['guid'] = SMARTPARTNER_URL . 'partner.php?id=' . $partners[$i]->getVar('id'); + $ret[$i]['title'] = $partners[$i]->getVar('title', 'n'); $ret[$i]['description'] = $partners[$i]->getVar('summary'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } return $ret; diff --git a/plugins/rssfit.smartsection.php b/plugins/rssfit.smartsection.php index 15ea5a7a..39ea5b6f 100644 --- a/plugins/rssfit.smartsection.php +++ b/plugins/rssfit.smartsection.php @@ -40,12 +40,19 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitSmartsection + */ class RssfitSmartsection { public $dirname = 'smartsection'; public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -56,19 +63,23 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { $ret = false; include XOOPS_ROOT_PATH . '/modules/smartsection/include/common.php'; $items = $smartsection_item_handler->getAllPublished($this->grab, 0); if (false !== $items && count($items) > 0) { - for ($i=0, $iMax = count($items); $i < $iMax; $i++) { - $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); - $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); - $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); + for ($i = 0, $iMax = count($items); $i < $iMax; $i++) { + $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); + $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); + $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); $ret[$i]['description'] = $items[$i]->getVar('summary'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } return $ret; diff --git a/plugins/rssfit.special.php b/plugins/rssfit.special.php index 8e6aa9a2..a901ec54 100644 --- a/plugins/rssfit.special.php +++ b/plugins/rssfit.special.php @@ -38,9 +38,9 @@ * Step 3: Modify the definition of $dirname in line 62 to your modules dirname, i.e. 'news' * Step 4: Modify the function "grabEntries" method to satisfy your needs * Step 5: Move your new plug-in file to the RSSFit plugins folder, - * i.e. your-xoops-root/modules/rss/plugins + * i.e. your-xoops-root/modules/rssfit/plugins * Step 6: Install your plug-in by pointing your browser to - * your-xoops-url/modules/rss/admin/?do=plugins + * your-xoops-url/modules/rssfit/admin/?do=plugins * Step 7: Finally, tell us about yourself and this file by modifying the * "About this RSSFit plug-in" section located below. * @@ -57,6 +57,9 @@ exit(); } +/** + * Class RssfitSpecial + */ class RssfitSpecial { public $dirname = 'special'; @@ -64,6 +67,9 @@ class RssfitSpecial public $grab; // will be set to the maximum number of items to grab public $module; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -71,27 +77,31 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing + $this->module = $mod; // optional, remove this line if there is nothing // to do with module info when grabbing entries return $mod; } + /** + * @param $obj + * @return array + */ public function &grabEntries(&$obj) { global $xoopsDB; $ret = []; - @include_once XOOPS_ROOT_PATH.'/modules/special/class/stuff.php'; - $myts = \MyTextSanitizer::getInstance(); + @include_once XOOPS_ROOT_PATH . '/modules/special/class/stuff.php'; + $myts = \MyTextSanitizer::getInstance(); $items = SpecialStuff::getAllPublished($this->grab, 0); foreach ($items as $item) { $ret[] = [ - 'title' => $myts->undoHtmlSpecialChars($item->title()), - 'link' => XOOPS_URL . '/modules/special/article.php?itemid=' . $item->itemid(), - 'guid' => XOOPS_URL . '/modules/special/article.php?itemid=' . $item->itemid(), - 'timestamp' => $item->published(), + 'title' => $myts->undoHtmlSpecialChars($item->title()), + 'link' => XOOPS_URL . '/modules/special/article.php?itemid=' . $item->itemid(), + 'guid' => XOOPS_URL . '/modules/special/article.php?itemid=' . $item->itemid(), + 'timestamp' => $item->published(), 'description' => $item->hometext(), - 'category' => $this->modname, - 'domain' => XOOPS_URL . '/modules/' . $this->dirname . '/', + 'category' => $this->modname, + 'domain' => XOOPS_URL . '/modules/' . $this->dirname . '/', ]; } return $ret; diff --git a/plugins/rssfit.surnames.php b/plugins/rssfit.surnames.php index 2b325d05..c6c4f9e8 100644 --- a/plugins/rssfit.surnames.php +++ b/plugins/rssfit.surnames.php @@ -42,6 +42,9 @@ exit(); } +/** + * Class RssfitSurnames + */ class RssfitSurnames { public $dirname = 'surnames'; @@ -49,6 +52,9 @@ class RssfitSurnames public $grab; public $module; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -56,82 +62,90 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing + $this->module = $mod; // optional, remove this line if there is nothing // to do with module info when grabbing entries return $mod; } + /** + * @param $uid + * @return string + */ public function myGetUnameFromId($uid) { - static $thisUser=false; - static $lastUid=false; - static $lastName=''; + static $thisUser = false; + static $lastUid = false; + static $lastName = ''; - if ($lastUid==$uid) { + if ($lastUid == $uid) { return $lastName; } if (!is_object($thisUser)) { $memberHandler = xoops_getHandler('member'); - $thisUser = $memberHandler->getUser($uid); + $thisUser = $memberHandler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name')); if ('' == $name) { $name = htmlspecialchars($thisUser->getVar('uname')); } - $lastUid=$uid; - $lastName=$name; + $lastUid = $uid; + $lastName = $name; return $name; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = false; - $i = -1; - $lasttime=false; - $lastuser=false; - $limit=10*$this->grab; + $i = -1; + $lasttime = false; + $lastuser = false; + $limit = 10 * $this->grab; - $sql = "SELECT uid, id, surname, notes, DATE_FORMAT(changed_ts,'%Y-%m-%d') as changedate FROM ".$xoopsDB->prefix('surnames'); - $sql .= ' WHERE approved=1 ORDER BY changedate DESC, uid '; + $sql = "SELECT uid, id, surname, notes, DATE_FORMAT(changed_ts,'%Y-%m-%d') AS changedate FROM " . $xoopsDB->prefix('surnames'); + $sql .= ' WHERE approved=1 ORDER BY changedate DESC, uid '; $result = $xoopsDB->query($sql, $limit, 0); while ($row = $xoopsDB->fetchArray($result)) { - $changedate=strtotime($row['changedate']); - $uid=$row['uid']; - if ($lasttime==$changedate && $lastuser==$uid) { - $link = XOOPS_URL.'/modules/surnames/view.php?id='.$row['id']; - $surname=$row['surname']; - $desc .= "$surname
"; + $changedate = strtotime($row['changedate']); + $uid = $row['uid']; + if ($lasttime == $changedate && $lastuser == $uid) { + $link = XOOPS_URL . '/modules/surnames/view.php?id=' . $row['id']; + $surname = $row['surname']; + $desc .= "$surname
"; } else { - if ($i>=0) { + if ($i >= 0) { $ret[$i]['description'] = $desc; } ++$i; - $lasttime=$changedate; - $lastuser=$uid; - if ($i<=$this->grab) { - $desc= ''; - $name = $this->myGetUnameFromId($row['uid']); - $ret[$i]['title'] = $this->modname . ': by ' . $name; - $ret[$i]['link'] = XOOPS_URL.'/modules/surnames/list.php?uid='.$row['uid']; + $lasttime = $changedate; + $lastuser = $uid; + if ($i <= $this->grab) { + $desc = ''; + $name = $this->myGetUnameFromId($row['uid']); + $ret[$i]['title'] = $this->modname . ': by ' . $name; + $ret[$i]['link'] = XOOPS_URL . '/modules/surnames/list.php?uid=' . $row['uid']; $ret[$i]['timestamp'] = $changedate; - $link = XOOPS_URL.'/modules/surnames/view.php?id='.$row['id']; - $ret[$i]['guid'] = $link; + $link = XOOPS_URL . '/modules/surnames/view.php?id=' . $row['id']; + $ret[$i]['guid'] = $link; $ret[$i]['category'] = $this->modname; - $surname=$row['surname']; - $desc .= "$surname
"; + $surname = $row['surname']; + $desc .= "$surname
"; } } - if ($i>$this->grab) { + if ($i > $this->grab) { break; } } - if ($i<$this->grab) { + if ($i < $this->grab) { $ret[$i]['description'] = $desc; } return $ret; diff --git a/plugins/rssfit.weblinks.php b/plugins/rssfit.weblinks.php index ea350a31..0a22117b 100644 --- a/plugins/rssfit.weblinks.php +++ b/plugins/rssfit.weblinks.php @@ -40,12 +40,19 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitWeblinks + */ class RssfitWeblinks { public $dirname = 'weblinks'; public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -56,51 +63,59 @@ public function loadModule() return $mod; } + /** + * @param $uid + * @return string + */ public function myGetUnameFromId($uid) { - static $thisUser=false; - static $lastUid=false; - static $lastName=''; + static $thisUser = false; + static $lastUid = false; + static $lastName = ''; - if ($lastUid==$uid) { + if ($lastUid == $uid) { return $lastName; } if (!is_object($thisUser)) { $memberHandler = xoops_getHandler('member'); - $thisUser = $memberHandler->getUser($uid); + $thisUser = $memberHandler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name')); if ('' == $name) { $name = htmlspecialchars($thisUser->getVar('uname')); } - $lastUid=$uid; - $lastName=$name; + $lastUid = $uid; + $lastName = $name; return $name; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT lid, title, time_update, description, url, uid FROM ' . $xoopsDB->prefix('weblinks_link') . ' ORDER BY time_update DESC'; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT lid, title, time_update, description, url, uid FROM ' . $xoopsDB->prefix('weblinks_link') . ' ORDER BY time_update DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - $title=$row['title']; - $name = $this->myGetUnameFromId($row['uid']); - $ret[$i]['title'] = $this->modname . ': ' . $title; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?lid='.$row['lid'].'&keywords='; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['time_update']; - $desc = '

'.$title.'
'; - $desc .= 'Submitted by: '.$name.'
'; - $desc .= $myts->displayTarea($row['description']).'


'; + $title = $row['title']; + $name = $this->myGetUnameFromId($row['uid']); + $ret[$i]['title'] = $this->modname . ': ' . $title; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?lid=' . $row['lid'] . '&keywords='; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['time_update']; + $desc = '

' . $title . '
'; + $desc .= 'Submitted by: ' . $name . '
'; + $desc .= $myts->displayTarea($row['description']) . '


'; $ret[$i]['description'] = $desc; - $ret[$i]['guid'] = $link; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['guid'] = $link; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } return $ret; diff --git a/plugins/rssfit.wfdownloads.php b/plugins/rssfit.wfdownloads.php index d2ad8ec3..60765135 100644 --- a/plugins/rssfit.wfdownloads.php +++ b/plugins/rssfit.wfdownloads.php @@ -40,13 +40,20 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } -class Rssfitwfdownloads extends XoopsObject + +/** + * Class Rssfitwfdownloads + */ +class Rssfitwfdownloads extends \XoopsObject { public $dirname = 'wfdownloads'; public $modname; public $module; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -54,29 +61,32 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $permHandler = xoops_getHandler('groupperm'); - $ret = false; - $i = 0; - $sql = 'SELECT lid, cid, title, date, description FROM ' - . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); + $ret = false; + $i = 0; + $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { if ($permHandler->checkRight('WFDownFilePerm', $row['lid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlefile.php?cid='.$row['cid'].'&lid='.$row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/plugins/rssfit.wfdownloads_podcast.php b/plugins/rssfit.wfdownloads_podcast.php index 0f1729aa..09778890 100644 --- a/plugins/rssfit.wfdownloads_podcast.php +++ b/plugins/rssfit.wfdownloads_podcast.php @@ -40,13 +40,20 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } -class Rssfitwfdownloads_podcast extends XoopsObject + +/** + * Class Rssfitwfdownloads_podcast + */ +class Rssfitwfdownloads_podcast extends \XoopsObject { public $dirname = 'wfdownloads'; public $modname; public $module; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -54,35 +61,36 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $permHandler = xoops_getHandler('groupperm'); - $ret = false; - $i = 0; - $sql = 'SELECT lid, cid, title, date, description, filetype, size FROM ' - . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 AND (expired > ' - . time() . ' OR expired = 0) AND published <= ' - . time() . ' ORDER BY date DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); + $ret = false; + $i = 0; + $sql = 'SELECT lid, cid, title, date, description, filetype, size FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 AND (expired > ' . time() . ' OR expired = 0) AND published <= ' . time() . ' ORDER BY date DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - if ((isset($perms[$row['cid']]) && true === $perms[$row['cid']]) || $permHandler->checkRight('WFDownCatPerm', $row['cid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { - $perms[$row['cid']] = true; - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlefile.php?cid='.$row['cid'].'&lid='.$row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; + if ((isset($perms[$row['cid']]) && true === $perms[$row['cid']]) + || $permHandler->checkRight('WFDownCatPerm', $row['cid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { + $perms[$row['cid']] = true; + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; // enclosure tag, a.k.a podcast - $ret[$i]['extras']['enclosure']['attributes'] - = [ + $ret[$i]['extras']['enclosure']['attributes'] = [ 'url' => XOOPS_URL . '/modules/' . $this->dirname . '/visit.php?cid=' . $row['cid'] . '&lid=' . $row['lid'], 'length' => $row['size'], 'type' => $row['filetype'] diff --git a/plugins/rssfit.wflinks.php b/plugins/rssfit.wflinks.php index 014904db..2fe4bab4 100644 --- a/plugins/rssfit.wflinks.php +++ b/plugins/rssfit.wflinks.php @@ -27,6 +27,9 @@ class RssfitWflinks public $mid; public $grab; + /** + * @return bool|FALSE|\XoopsModule + */ public function loadModule() { global $module_handler; @@ -35,32 +38,36 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->mid = $mod->getVar('mid'); + $this->mid = $mod->getVar('mid'); return $mod; } + /** + * @param $obj + * @return array + */ public function grabEntries(&$obj) { global $xoopsDB, $xoopsUser; - $groups = is_object($xoopsUser) ? $xoopsUser -> getGroups() : XOOPS_GROUP_ANONYMOUS; - $gpermHandler = xoops_getHandler('groupperm'); + $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; + $gpermHandler = xoops_getHandler('groupperm'); - $myts = \MyTextSanitizer::getInstance(); - $ret = []; - $i = 0; - $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; + $myts = \MyTextSanitizer::getInstance(); + $ret = []; + $i = 0; + $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - if ($gpermHandler -> checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { + if ($gpermHandler->checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { // required - $ret[$i]['title'] = $row['title']; - $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?cid='.$row['cid'].'&lid='.$row['lid']; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['title']; + $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $row['description']; // optional $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/plugins/rssfit.wfsection.php b/plugins/rssfit.wfsection.php index 51a8abea..d9b303df 100644 --- a/plugins/rssfit.wfsection.php +++ b/plugins/rssfit.wfsection.php @@ -40,12 +40,19 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitWfsection + */ class RssfitWfsection { public $dirname = 'wfsection'; public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -59,29 +66,37 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { - @include_once XOOPS_ROOT_PATH.'/modules/wfsection/include/groupaccess.php'; + @include_once XOOPS_ROOT_PATH . '/modules/wfsection/include/groupaccess.php'; global $xoopsDB; $ret = false; - $i = 0; - $sql = 'SELECT a.articleid, a.title as atitle, a.published, a.expired, a.counter, a.groupid, a.maintext, a.summary, b.title as btitle FROM ' - . $xoopsDB->prefix('wfs_article') . ' a, ' - . $xoopsDB->prefix('wfs_category') . ' b WHERE a.published < ' - . time() . ' AND a.published > 0 AND (a.expired = 0 OR a.expired > ' - . time() . ') AND a.noshowart = 0 AND a.offline = 0 AND a.categoryid = b.id ORDER BY published DESC'; + $i = 0; + $sql = 'SELECT a.articleid, a.title AS atitle, a.published, a.expired, a.counter, a.groupid, a.maintext, a.summary, b.title AS btitle FROM ' + . $xoopsDB->prefix('wfs_article') + . ' a, ' + . $xoopsDB->prefix('wfs_category') + . ' b WHERE a.published < ' + . time() + . ' AND a.published > 0 AND (a.expired = 0 OR a.expired > ' + . time() + . ') AND a.noshowart = 0 AND a.offline = 0 AND a.categoryid = b.id ORDER BY published DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { if (checkAccess($row['groupid'])) { - $link = XOOPS_URL.'/modules/'.$this->dirname.'/article.php?articleid='.$row['articleid']; - $ret[$i]['title'] = $row['atitle']; - $ret[$i]['link'] = $link; - $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['published']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/article.php?articleid=' . $row['articleid']; + $ret[$i]['title'] = $row['atitle']; + $ret[$i]['link'] = $link; + $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['published']; $ret[$i]['description'] = $myts->displayTarea(!empty($row['summary']) ? $row['summary'] : $row['maintext']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/plugins/rssfit.wfsection2.php b/plugins/rssfit.wfsection2.php index b40a1ef0..c8cb65a0 100644 --- a/plugins/rssfit.wfsection2.php +++ b/plugins/rssfit.wfsection2.php @@ -40,12 +40,19 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } + +/** + * Class RssfitWfsection2 + */ class RssfitWfsection2 { public $dirname = 'wfsection'; public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -56,24 +63,28 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { - @include_once XOOPS_ROOT_PATH.'/modules/wfsection/class/common.php'; - @include_once XOOPS_ROOT_PATH.'/modules/wfsection/class/wfsarticle.php'; - $ret = false; + @include_once XOOPS_ROOT_PATH . '/modules/wfsection/class/common.php'; + @include_once XOOPS_ROOT_PATH . '/modules/wfsection/class/wfsarticle.php'; + $ret = false; $articles = WfsArticle::getAllArticle($this->grab, 0, 'online'); if (count($articles) > 0) { $xoopsModuleConfig['shortartlen'] = 0; - $myts = \MyTextSanitizer::getInstance(); - for ($i=0, $iMax = count($articles); $i < $iMax; $i++) { - $link = XOOPS_URL.'/modules/wfsection/article.php?articleid='.$articles[$i]->articleid(); - $ret[$i]['title'] = $myts->undoHtmlSpecialChars($articles[$i]->title()); - $ret[$i]['link'] = $link; - $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $articles[$i]->published(); + $myts = \MyTextSanitizer::getInstance(); + for ($i = 0, $iMax = count($articles); $i < $iMax; $i++) { + $link = XOOPS_URL . '/modules/wfsection/article.php?articleid=' . $articles[$i]->articleid(); + $ret[$i]['title'] = $myts->undoHtmlSpecialChars($articles[$i]->title()); + $ret[$i]['link'] = $link; + $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $articles[$i]->published(); $ret[$i]['description'] = $articles[$i]->summary(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } return $ret; diff --git a/plugins/rssfit.xoopstube.php b/plugins/rssfit.xoopstube.php index 815e3fdd..105edd6d 100644 --- a/plugins/rssfit.xoopstube.php +++ b/plugins/rssfit.xoopstube.php @@ -51,6 +51,9 @@ class RssfitXoopstube public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -61,25 +64,27 @@ public function loadModule() return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' - . $xoopsDB->prefix('xoopstube_videos') . ' l, ' - . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; + $ret = false; + $i = 0; + $sql = 'SELECT l.lid, l.title AS ltitle, l.date, l.cid, l.hits, l.description, c.title AS ctitle FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while ($row = $xoopsDB->fetchArray($result)) { - $ret[$i]['title'] = $row['ltitle']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlevideo.php?cid='.$row['cid'].'&lid='.$row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['ltitle']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } return $ret; diff --git a/preloads/autoloader.php b/preloads/autoloader.php new file mode 100644 index 00000000..9e0b1caa --- /dev/null +++ b/preloads/autoloader.php @@ -0,0 +1,32 @@ + + */ + +defined('XOOPS_ROOT_PATH') || exit('Restricted access.'); + +/** + * Class UserlogCorePreload + */ +class RssfitCorePreload extends \XoopsPreloadItem +{ + // to add PSR-4 autoloader + /** + * @param $args + */ + public static function eventCoreIncludeCommonEnd($args) + { + include __DIR__ . '/autoloader.php'; + } +} diff --git a/preloads/index.html b/preloads/index.html new file mode 100644 index 00000000..2c5cdd3f --- /dev/null +++ b/preloads/index.html @@ -0,0 +1 @@ + diff --git a/rss.css b/rss.css index 8f442e73..62068783 100644 --- a/rss.css +++ b/rss.css @@ -1,79 +1,79 @@ rss { - display: block; - margin: 10px auto 10px auto; - width: 80%; - background: #FFF; - font-family: Verdana, arial, sans-serif; - font-size: small; - } + display: block; + margin: 10px auto 10px auto; + width: 80%; + background: #FFF; + font-family: Verdana, arial, sans-serif; + font-size: small; +} channel { - display: block; - margin-bottom: 10px; - border: 1px solid #CCC; - padding: 10px; - } + display: block; + margin-bottom: 10px; + border: 1px solid #CCC; + padding: 10px; +} -channel>title { - display: block; - font-size: large; - font-weight: bold; - } +channel > title { + display: block; + font-size: large; + font-weight: bold; +} -channel>description { - display: block; - } +channel > description { + display: block; +} -channel>copyright { - display: block; - font-size: x-small; - color: #666; - } +channel > copyright { + display: block; + font-size: x-small; + color: #666; +} -channel>lastBuildDate { - display: block; - text-align: right; - } +channel > lastBuildDate { + display: block; + text-align: right; +} -channel>language, -channel>image, -channel>managingEditor, -channel>webMaster, -channel>generator, -channel>docs, -channel>ttl { - display: none; - } +channel > language, +channel > image, +channel > managingEditor, +channel > webMaster, +channel > generator, +channel > docs, +channel > ttl { + display: none; +} item { - display: block; - padding: 5px; - margin-top: 10px; - border: 1px solid #CCC; - background: #EEE; - } + display: block; + padding: 5px; + margin-top: 10px; + border: 1px solid #CCC; + background: #EEE; +} -item>title { - display: block; - float: left; - margin-right: 5px; - font-weight: bold; - } +item > title { + display: block; + float: left; + margin-right: 5px; + font-weight: bold; +} -item>pubDate { - margin-right: 5px; - font-size: x-small; - color: #666; - white-space: nowrap; - } +item > pubDate { + margin-right: 5px; + font-size: x-small; + color: #666; + white-space: nowrap; +} -item>guid { - display: block; - margin-right: 5px; - font-size: x-small; - color: #666; - } - -item>category, item>link { - display: none; - } +item > guid { + display: block; + margin-right: 5px; + font-size: x-small; + color: #666; +} + +item > category, item > link { + display: none; +} diff --git a/rss.php b/rss.php index b4eec396..b49b65af 100644 --- a/rss.php +++ b/rss.php @@ -35,28 +35,28 @@ mb_http_output('pass'); } require __DIR__ . '/header.php'; -$charset = $xoopsModuleConfig['utf8'] ? 'UTF-8' : _CHARSET; -$docache = $xoopsModuleConfig['cache'] ? true : false; +$charset = $xoopsModuleConfig['utf8'] ? 'UTF-8' : _CHARSET; +$docache = $xoopsModuleConfig['cache'] ? true : false; $template = 'db:rssfit_rss.tpl'; if (3 == $xoopsModuleConfig['mime']) { $xoopsLogger->enableRendering(); $xoopsLogger->usePopup = (2 == $xoopsConfig['debug_mode']); - $docache = false; + $docache = false; } else { error_reporting(0); $xoopsLogger->activated = false; } -require_once XOOPS_ROOT_PATH.'/class/template.php'; -$xoopsTpl = new XoopsTpl(); +require_once XOOPS_ROOT_PATH . '/class/template.php'; +$xoopsTpl = new \XoopsTpl(); if (!$docache) { $xoopsTpl->xoops_setCaching(0); } else { $xoopsTpl->xoops_setCaching(2); - $xoopsTpl->xoops_setCacheTime($xoopsModuleConfig['cache']*60); + $xoopsTpl->xoops_setCacheTime($xoopsModuleConfig['cache'] * 60); } -$feed = []; +$feed = []; $feed['plugin'] = isset($_GET[$rss->feedkey]) ? trim($_GET[$rss->feedkey]) : ''; $rss->checkSubFeed($feed); if (!$xoopsTpl->is_cached($template, $rss->cached) || !$docache) { diff --git a/sql/index.html b/sql/index.html index 990cbd60..2c5cdd3f 100644 --- a/sql/index.html +++ b/sql/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/templates/index.html b/templates/index.html index 990cbd60..2c5cdd3f 100644 --- a/templates/index.html +++ b/templates/index.html @@ -1 +1 @@ - \ No newline at end of file + diff --git a/templates/rssfit_rss.tpl b/templates/rssfit_rss.tpl index 295c1208..66029ad0 100644 --- a/templates/rssfit_rss.tpl +++ b/templates/rssfit_rss.tpl @@ -1,54 +1,54 @@ "?> - -<{foreach from=$feed.channel key='ch_key' item='ch_var'}> - <<{$ch_key}>><{$ch_var}>> -<{/foreach}> - -<{if $feed.image != ''}> - - <{$feed.image.title}> - <{$feed.image.url}> - <{$feed.image.link}> - -<{/if}> -<{if $feed.sticky != ''}> - - <{$feed.sticky.title}> - <{$feed.sticky.description}> - <{$feed.sticky.pubdate}> - <{$feed.sticky.link}> - -<{/if}> -<{if $feed.items != ''}><{foreach item=item from=$feed.items}> - - <{$item.title}> - <{$item.description}> - <{$item.pubdate}> - <{$item.link}> - <{if $item.category != ""}> - domain="<{$item.domain}>"<{/if}>><{$item.category}> - <{/if}> - <{if $item.guid != ""}> - <{$item.guid}> - <{/if}> - <{if $item.extras != ''}> - <{foreach from=$item.extras key='exk' item='exv'}> - <<{$exk}> - <{if $exv.attributes != ''}> - <{foreach from=$exv.attributes key='atk' item='atv'}> - <{$atk}>="<{$atv}>" - <{/foreach}> - <{/if}> - <{if $exv.content != ''}> - ><{$exv.content}>> - <{else}> - /> - <{/if}> + + <{foreach from=$feed.channel key='ch_key' item='ch_var'}> + <<{$ch_key}>><{$ch_var}>> + <{/foreach}> + + <{if $feed.image != ''}> + + <{$feed.image.title}> + <{$feed.image.url}> + <{$feed.image.link}> + + <{/if}> + <{if $feed.sticky != ''}> + + <{$feed.sticky.title}> + <{$feed.sticky.description}> + <{$feed.sticky.pubdate}> + <{$feed.sticky.link}> + + <{/if}> + <{if $feed.items != ''}><{foreach item=item from=$feed.items}> + + <{$item.title}> + <{$item.description}> + <{$item.pubdate}> + <{$item.link}> + <{if $item.category != ""}> + domain="<{$item.domain}>"<{/if}>><{$item.category}> + <{/if}> + <{if $item.guid != ""}> + <{$item.guid}> + <{/if}> + <{if $item.extras != ''}> + <{foreach from=$item.extras key='exk' item='exv'}> + <<{$exk}> + <{if $exv.attributes != ''}> + <{foreach from=$exv.attributes key='atk' item='atv'}> + <{$atk}>="<{$atv}>" <{/foreach}> <{/if}> - -<{/foreach}><{/if}> - + <{if $exv.content != ''}> + ><{$exv.content}>> + <{else}> + /> + <{/if}> + <{/foreach}> + <{/if}> + + <{/foreach}><{/if}> + diff --git a/testdata/index.php b/testdata/index.php index 0e4d5972..d8a1d1e7 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -17,7 +17,6 @@ require_once __DIR__ . '/../../../mainfile.php'; - $op = \Xmf\Request::getCmd('op', ''); switch ($op) { diff --git a/xoops_version.php b/xoops_version.php index 4c270a39..550c114d 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -36,7 +36,7 @@ $modversion = [ 'version' => 1.31, 'module_status' => 'Beta 2', - 'release_date' => '2017/10/27', + 'release_date' => '2017/12/20', 'name' => _MI_RSSFIT_NAME, 'description' => _MI_RSSFIT_DESC, 'official' => 0, @@ -84,8 +84,8 @@ // ------------------- Main Menu ------------------- 'hasMain' => 1, // ------------------- Install/Update ------------------- - 'onInstall' => 'include/install.php', - 'onUpdate' => 'include/install.php', + 'onInstall' => 'include/oninstall.php', + 'onUpdate' => 'include/onupdate.php', // 'onUninstall' => 'include/onuninstall.php', // ------------------- PayPal --------------------------- 'paypal' => [ @@ -98,10 +98,8 @@ 'sqlfile' => ['mysql' => 'sql/mysql.sql'], // ------------------- Tables ---------------------------- 'tables' => [ - // $moduleDirName . '_' . 'XXX', - // $moduleDirName . '_' . 'XXX', - 'rssfit_plugins', - 'rssfit_misc', + $moduleDirName . '_' . 'plugins', + $moduleDirName . '_' . 'misc', ], ]; @@ -117,11 +115,11 @@ $modversion['templates'] = []; $modversion['templates'][] = [ 'file' => 'rssfit_index.tpl', - 'description' => _MI_TMPL_INTRO, + 'description' => _MI_RSSFIT_TMPL_INTRO, ]; $modversion['templates'][] = [ 'file' => 'rssfit_rss.tpl', - 'description' => _MI_TMPL_RSS, + 'description' => _MI_RSSFIT_TMPL_RSS, ]; // Module Configs @@ -129,8 +127,8 @@ $modversion['config'][] = [ 'name' => 'overall_entries', - 'title' => '_MI_OVERALL_ENTRIES', - 'description' => '_MI_OVERALL_ENTRIES_DESC', + 'title' => '_MI_RSSFIT_OVERALL_ENTRIES', + 'description' => '_MI_RSSFIT_OVERALL_ENTRIES_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 20, @@ -139,8 +137,8 @@ // $xoopsModuleConfig['plugin_entries'] $modversion['config'][] = [ 'name' => 'plugin_entries', - 'title' => '_MI_PLUGIN_ENTRIES', - 'description' => '_MI_PLUGIN_ENTRIES_DESC', + 'title' => '_MI_RSSFIT_PLUGIN_ENTRIES', + 'description' => '_MI_RSSFIT_PLUGIN_ENTRIES_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 5, @@ -149,19 +147,19 @@ // $xoopsModuleConfig['sort'] $modversion['config'][] = [ 'name' => 'sort', - 'title' => '_MI_ENTRIES_SORT', - 'description' => '_MI_ENTRIES_SORT_DESC', + 'title' => '_MI_RSSFIT_ENTRIES_SORT', + 'description' => '_MI_RSSFIT_ENTRIES_SORT_DESC', 'formtype' => 'select', 'valuetype' => 'text', 'default' => 'd', - 'options' => [_MI_ENTRIES_SORT_DATE => 'd', _MI_ENTRIES_SORT_CAT => 'c'], + 'options' => [_MI_RSSFIT_ENTRIES_SORT_DATE => 'd', _MI_RSSFIT_ENTRIES_SORT_CAT => 'c'], ]; // $xoopsModuleConfig['cache'] $modversion['config'][] = [ 'name' => 'cache', - 'title' => '_MI_CACHE', - 'description' => '_MI_CACHE_DESC', + 'title' => '_MI_RSSFIT_CACHE', + 'description' => '_MI_RSSFIT_CACHE_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 0, @@ -170,8 +168,8 @@ // $xoopsModuleConfig['max_char'] $modversion['config'][] = [ 'name' => 'max_char', - 'title' => '_MI_MAXCHAR', - 'description' => '_MI_MAXCHAR_DESC', + 'title' => '_MI_RSSFIT_MAXCHAR', + 'description' => '_MI_RSSFIT_MAXCHAR_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 0, @@ -180,8 +178,8 @@ // $xoopsModuleConfig['strip_html'] $modversion['config'][] = [ 'name' => 'strip_html', - 'title' => '_MI_STRIPHTML', - 'description' => '_MI_STRIPHTML_DESC', + 'title' => '_MI_RSSFIT_STRIPHTML', + 'description' => '_MI_RSSFIT_STRIPHTML_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, @@ -190,8 +188,8 @@ // $xoopsModuleConfig['utf8'] $modversion['config'][] = [ 'name' => 'utf8', - 'title' => '_MI_ENCODE_UTF8', - 'description' => '_MI_ENCODE_UTF8_DESC', + 'title' => '_MI_RSSFIT_ENCODE_UTF8', + 'description' => '_MI_RSSFIT_ENCODE_UTF8_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, @@ -200,10 +198,10 @@ // $xoopsModuleConfig['mime'] $modversion['config'][] = [ 'name' => 'mime', - 'title' => '_MI_OUTOUT_MIME', + 'title' => '_MI_RSSFIT_OUTOUT_MIME', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, - 'options' => [_MI_OUTOUT_MIME_XML => 1, _MI_OUTOUT_MIME_HTML => 2, _MI_OUTOUT_MIME_PHP => 3], + 'options' => [_MI_RSSFIT_OUTOUT_MIME_XML => 1, _MI_RSSFIT_OUTOUT_MIME_HTML => 2, _MI_RSSFIT_OUTOUT_MIME_PHP => 3], ]; From b81e61f2068ef4cb1b274f11b951479239093853 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 23 Dec 2017 17:57:31 -0500 Subject: [PATCH 035/154] deprecated makeTboxData4PreviewInForm() --- admin/do_intro.php | 2 +- admin/do_sticky.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/admin/do_intro.php b/admin/do_intro.php index ab37d84d..d0be56c4 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -58,7 +58,7 @@ $dobr->addOption(1, _AM_RSSFIT_DO_BR); $tray_content->addElement($dobr); - $sub = new \XoopsFormTextArea(_AM_RSSFIT_EDIT_INTRO_SUB, 'sub', isset($setting['dobr']) ? $myts->makeTboxData4PreviewInForm($setting['sub']) : ''); + $sub = new \XoopsFormTextArea(_AM_RSSFIT_EDIT_INTRO_SUB, 'sub', isset($setting['dobr']) ? $myts->htmlSpecialChars($myts->stripSlashesGPC($setting['sub'])) : ''); $sub->setDescription(_AM_RSSFIT_EDIT_INTRO_SUB_DESC); $form = new \XoopsThemeForm(_AM_RSSFIT_EDIT_INTRO, 'editintro', RSSFIT_ADMIN_URL); diff --git a/admin/do_sticky.php b/admin/do_sticky.php index 70a3e98f..2e39dcba 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -59,7 +59,7 @@ $dobr->addOption(1, _AM_RSSFIT_DO_BR); $tray_content->addElement($dobr); - $link = new \XoopsFormText(_AM_RSSFIT_STICKY_LINK, 'link', 50, 255, $myts->makeTboxData4PreviewInForm($setting['link'])); + $link = new \XoopsFormText(_AM_RSSFIT_STICKY_LINK, 'link', 50, 255, $myts->htmlSpecialChars($myts->stripSlashesGPC($setting['link']))); $applyto = $rss->feedSelectBox(_AM_RSSFIT_STICKY_APPLYTO, $setting['feeds'], 10); From c946a831bdd0e1bdfe214f54203dc7a1619abe23 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 23 Dec 2017 23:34:03 -0500 Subject: [PATCH 036/154] cosmetics --- admin/admin_header.php | 8 +-- admin/index.php | 4 +- class/RssPluginsHandler.php | 9 --- class/common/Configurator.php | 6 +- class/common/ServerStats.php | 43 ++++++------ class/common/VersionChecks.php | 3 + docs/credits.txt | 3 + docs/todo.txt | 9 +++ include/common.php | 115 +++++++++++++++++---------------- include/config.php | 47 ++++++-------- include/functions.php | 80 ----------------------- include/oninstall.php | 36 +++++++---- include/onuninstall.php | 43 +++++++----- include/onupdate.php | 46 +++++++------ xoops_version.php | 49 ++++++-------- 15 files changed, 216 insertions(+), 285 deletions(-) create mode 100644 docs/todo.txt delete mode 100644 include/functions.php diff --git a/admin/admin_header.php b/admin/admin_header.php index 6eedce72..f587ade2 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -19,10 +19,9 @@ use Xoopsmodules\rssfit; -$path = dirname(dirname(dirname(__DIR__))); -require_once $path . '/include/cp_header.php'; +require_once __DIR__ . '/../../../include/cp_header.php'; -require_once dirname(__DIR__) . '/include/common.php'; +require_once __DIR__ . '/../include/common.php'; $moduleDirName = basename(dirname(__DIR__)); /** @var rssfit\Helper $helper */ @@ -31,7 +30,6 @@ /** @var Xmf\Module\Admin $adminObject */ $adminObject = \Xmf\Module\Admin::getInstance(); -$thisModuleDir = $helper->getDirname(); // Load language files $helper->loadLanguage('admin'); @@ -39,7 +37,5 @@ xoops_cp_header(); -//if functions.php file exist -//require __DIR__ . '/../include/common.php'; diff --git a/admin/index.php b/admin/index.php index 1f092d84..54de17d5 100644 --- a/admin/index.php +++ b/admin/index.php @@ -19,7 +19,7 @@ * @author XOOPS Development Team */ -include_once __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; $adminObject = \Xmf\Module\Admin::getInstance(); $do = Request::getString('do', ''); @@ -43,4 +43,4 @@ $adminObject->displayIndex(); } -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/class/RssPluginsHandler.php b/class/RssPluginsHandler.php index 58ac3575..77c6790b 100644 --- a/class/RssPluginsHandler.php +++ b/class/RssPluginsHandler.php @@ -84,15 +84,6 @@ public function create() $obj = new $this->obj_class(); $obj->setNew(); return $obj; - - // $class = $this->obj_class; - // $bingo = 'rssfit'; - // $bingo2 = 'rssfit\\' . $class; - // $bingo3 = new $bingo2; - // echo $bingo3; - // $bingo3->setNew(); - // return false; - // return $bingo3 ; } /** diff --git a/class/common/Configurator.php b/class/common/Configurator.php index b564779f..c62a23b0 100644 --- a/class/common/Configurator.php +++ b/class/common/Configurator.php @@ -30,7 +30,8 @@ class Configurator public $name; public $paths = []; public $uploadFolders = []; - public $blankFiles = []; + public $copyBlankFiles = []; + public $copyTestFolders = []; public $templateFolders = []; public $oldFiles = []; public $oldFolders = []; @@ -49,7 +50,8 @@ public function __construct() $this->name = $config->name; $this->paths = $config->paths; $this->uploadFolders = $config->uploadFolders; - $this->blankFiles = $config->blankFiles; + $this->copyBlankFiles = $config->copyBlankFiles; + $this->copyTestFolders = $config->copyTestFolders; $this->templateFolders = $config->templateFolders; $this->oldFiles = $config->oldFiles; $this->oldFolders = $config->oldFolders; diff --git a/class/common/ServerStats.php b/class/common/ServerStats.php index 86b07c5a..897e01c9 100644 --- a/class/common/ServerStats.php +++ b/class/common/ServerStats.php @@ -34,14 +34,15 @@ public static function getServerStats() // $sql .= " WHERE metakey='version' LIMIT 1"; // $query = $GLOBALS['xoopsDB']->query($sql); // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); - $html .= "
" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "\n"; - $html .= "
\n"; - // $html .= '
' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
\n"; - // $html .= "
\n"; - // $html .= "
\n"; - $html .= '
' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "
\n"; - $html .= "
    \n"; - // + $html .= '
    '; + $html .= "" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . ""; + $html .= "
    "; + // $html .= '
    ' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
    "; + // $html .= "
    "; + // $html .= "
    "; + $html .= '
    ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "
    "; + $html .= "
      "; + $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; if (function_exists('gd_info')) { @@ -49,25 +50,25 @@ public static function getServerStats() $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; } } - // + // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); // $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; - // + // $registerglobals = (!ini_get('register_globals')) ? "" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . constant('CO_' . $moduleDirNameUpper . '_ON') . ''; // $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; - // + $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - // - $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . "\n"; - $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . "\n"; - $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . "\n"; - $html .= "
    \n"; - $html .= "
      \n"; - $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . "\n"; - $html .= "
    \n"; - $html .= "
    \n"; - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; + + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . ""; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . ""; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . ""; + $html .= "
"; + $html .= "
    "; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . ""; + $html .= "
"; + $html .= "
"; + $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ""; $html .= '
'; $html .= '

'; diff --git a/class/common/VersionChecks.php b/class/common/VersionChecks.php index b374284e..023fdef4 100644 --- a/class/common/VersionChecks.php +++ b/class/common/VersionChecks.php @@ -29,6 +29,7 @@ trait VersionChecks public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) { $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirNameUpper = strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); } @@ -59,6 +60,8 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = */ public static function checkVerPhp(\XoopsModule $module) { + $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirNameUpper = strtoupper($moduleDirName); xoops_loadLanguage('admin', $module->dirname()); // check for minimum PHP version $success = true; diff --git a/docs/credits.txt b/docs/credits.txt index 0b180e4d..dc28d38f 100644 --- a/docs/credits.txt +++ b/docs/credits.txt @@ -6,3 +6,6 @@ Originally developed by NS Tai Version 1.22 was updated by Hervé Thouzard Version 1.3 was updated to XOOPS 2.5.6 Standard GUI by Michael Beck (Mamba) + +It was improved for XOOPS 2.5.9 and PHP 7 by Richard Griffith (Geekwright) + diff --git a/docs/todo.txt b/docs/todo.txt new file mode 100644 index 00000000..961a7047 --- /dev/null +++ b/docs/todo.txt @@ -0,0 +1,9 @@ +TODO: Planned features in the future +===================================== + + +Features that are being considered/planned/needed for the future releases, or current WIP (Work In Progress) + +- test with MySQL strict mode (STRICT_TRANS_TABLES) +- finalize OnUpdate and OnUninstall files + diff --git a/include/common.php b/include/common.php index b623beca..b82ff70d 100644 --- a/include/common.php +++ b/include/common.php @@ -1,48 +1,34 @@ ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### +/* + * 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. + */ + +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @package + * @since + * @author XOOPS Development Team + * @author NS Tai (aka tuff) http://www.brandycoke.com/ + */ use Xoopsmodules\rssfit; +include __DIR__ . '/../preloads/autoloader.php'; $moduleDirName = basename(dirname(__DIR__)); -$capsDirName = strtoupper($moduleDirName); +$moduleDirNameUpper = strtoupper($moduleDirName); + -include __DIR__ . '/../preloads/autoloader.php'; /** @var \XoopsDatabase $db */ /** @var rssfit\Helper $helper */ /** @var rssfit\Utility $utility */ -//$db = \XoopsDatabaseFactory::getDatabase(); $db = \XoopsDatabaseFactory::getDatabaseConnection(); $helper = rssfit\Helper::getInstance(); $utility = new rssfit\Utility(); @@ -50,30 +36,32 @@ $helper->loadLanguage('common'); -if (!defined('RSSFIT_CONSTANTS_DEFINED')) { - define('RSSFIT_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $helper->getDirname() . '/'); - define('RSSFIT_URL', XOOPS_URL . '/modules/' . $helper->getDirname() . '/'); - define('RSSFIT_URL_FEED', RSSFIT_URL . 'rss.php'); - define('RSSFIT_ADMIN_URL', XOOPS_URL . '/modules/' . $helper->getDirname() . '/admin/'); - define('RSSFIT_CONSTANTS_DEFINED', 1); - define($capsDirName . '_DIRNAME', $GLOBALS['xoopsModule']->dirname()); - define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); - // define($capsDirName . '_URL', XOOPS_URL . '/modules/' . constant($capsDirName . '_DIRNAME')); - define($capsDirName . '_ADMIN', constant($capsDirName . '_URL') . '/admin/index.php'); - // define($capsDirName . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); - define($capsDirName . '_AUTHOR_LOGOIMG', constant($capsDirName . '_URL') . '/assets/images/logoModule.png'); - define($capsDirName . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash - define($capsDirName . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash +//$version = number_format($xoopsModule->getVar('version') / 100, 2); +//$version = !substr($version, -1, 1) ? substr($version, 0, 3) : $version; +//$version1 = $helper->getModule()->getInfo('version'); +// define('RSSFIT_VERSION', 'RSSFit ' . $version); + +if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) { + define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__))); + define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); + define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/'); + define($moduleDirNameUpper . '_URL_FEED', constant($moduleDirNameUpper . '_URL') . 'rss.php'); + define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images'); + define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images'); + define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/'); + define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/'); + define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($moduleDirNameUpper . '_DIRNAME')); + define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php'); + define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); + define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash + define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash + define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1); } require_once RSSFIT_ROOT_PATH . 'class/RssfeedHandler.php'; //require_once RSSFIT_ROOT_PATH.'include/functions.php'; global $xoopsModule, $xoopsModuleConfig, $xoopsConfig; -$version = number_format($xoopsModule->getVar('version') / 100, 2); -$version = !substr($version, -1, 1) ? substr($version, 0, 3) : $version; -//$version1 = $helper->getModule()->getInfo('version'); -define('RSSFIT_VERSION', 'RSSFit ' . $version); $rss = new rssfit\RssfeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); $myts = $rss->myts; @@ -97,11 +85,26 @@ 'print' => "" . _CLONE . "", 'pdf' => "" . _CLONE . "", 'add' => "" . _ADD . "", - '0' => "" . _ADD . "", - '1' => "" . _ADD . "", + '0' => "" . 0 . "", + '1' => "" . 1 . "", ]; +$debug = false; + // MyTextSanitizer object $myts = \MyTextSanitizer::getInstance(); -$debug = false; +if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) { + require_once $GLOBALS['xoops']->path('class/template.php'); + $GLOBALS['xoopsTpl'] = new \XoopsTpl(); +} + +$GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); +// Local icons path +if (is_object($helper->getModule())) { + $pathModIcon16 = $helper->getModule()->getInfo('modicons16'); + $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); + +$GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); +$GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); +} diff --git a/include/config.php b/include/config.php index dd8fbdbb..a3a0f26a 100644 --- a/include/config.php +++ b/include/config.php @@ -20,18 +20,6 @@ $moduleDirName = basename(dirname(__DIR__)); $capsDirName = strtoupper($moduleDirName); -//if (!defined($capsDirName . '_DIRNAME')) { -// //if (!defined(constant($capsDirName . '_DIRNAME'))) { -// define($capsDirName . '_DIRNAME', $GLOBALS['xoopsModule']->dirname()); -// define($capsDirName . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); -// define($capsDirName . '_URL', XOOPS_URL . '/modules/' . constant($capsDirName . '_DIRNAME')); -// define($capsDirName . '_ADMIN', constant($capsDirName . '_URL') . '/admin/index.php'); -// define($capsDirName . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($capsDirName . '_DIRNAME')); -// define($capsDirName . '_AUTHOR_LOGOIMG', constant($capsDirName . '_URL') . '/assets/images/logoModule.png'); -// define($capsDirName . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash -// define($capsDirName . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash -//} - //Configurator return (object)[ 'name' => strtoupper($moduleDirName) . ' Module Configurator', @@ -44,18 +32,26 @@ 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, ], 'uploadFolders' => [ - constant($capsDirName . '_UPLOAD_PATH'), - constant($capsDirName . '_UPLOAD_PATH') . '/category', - constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', +// constant($capsDirName . '_UPLOAD_PATH'), +// constant($capsDirName . '_UPLOAD_PATH') . '/category', +// constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', //XOOPS_UPLOAD_PATH . '/flags' ], - 'blankFiles' => [ - constant($capsDirName . '_UPLOAD_PATH'), - constant($capsDirName . '_UPLOAD_PATH') . '/category', - constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', + 'copyBlankFiles' => [ +// constant($capsDirName . '_UPLOAD_PATH'), +// constant($capsDirName . '_UPLOAD_PATH') . '/category', +// constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', //XOOPS_UPLOAD_PATH . '/flags' ], + 'copyTestFolders' => [ + // constant($capsDirName . '_UPLOAD_PATH'), +// [ +// constant($capsDirName . '_PATH') . '/testdata/images', +// constant($capsDirName . '_UPLOAD_PATH') . '/images', +// ] + ], + 'templateFolders' => [ '/templates/', '/templates/blocks/', @@ -63,20 +59,19 @@ ], 'oldFiles' => [ - '/class/request.php', - '/class/registry.php', - '/class/utilities.php', - '/class/util.php', - '/include/constants.php', +// '/class/request.php', +// '/class/registry.php', +// '/class/utilities.php', +// '/class/util.php', +// '/include/constants.php', '/include/functions.php', - '/ajaxrating.txt', +// '/ajaxrating.txt', ], 'oldFolders' => [ '/images', '/css', '/js', '/tcpdf', - '/images', ], 'modCopyright' => " \'XOOPS', diff --git a/include/functions.php b/include/functions.php deleted file mode 100644 index 1b7b3ada..00000000 --- a/include/functions.php +++ /dev/null @@ -1,80 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### - -/** - * @param $a - * @param $b - * @return int - */ -function sortTimestamp($a, $b) -{ - if ($a['timestamp'] == $b['timestamp']) { - return 0; - } - return ($a['timestamp'] > $b['timestamp']) ? -1 : 1; -} - -/** - * @param int $spec - * @param $rss - * @return string - */ -function genSpecMoreInfo($spec = 0, &$rss) -{ - return rssfGenAnchor($rss->specUrl($spec), _AM_RSSFIT_EDIT_CHANNEL_QMARK, 'spec', _AM_RSSFIT_EDIT_CHANNEL_MOREINFO); -} - -/** - * @param string $url - * @param string $text - * @param string $target - * @param string $title - * @param string $class - * @param string $id - * @return string - */ -function rssfGenAnchor($url = '', $text = '', $target = '', $title = '', $class = '', $id = '') -{ - if (!empty($url)) { - $ret = ''; - $ret .= ''; - return $ret; - } - return $text; -} diff --git a/include/oninstall.php b/include/oninstall.php index 11fe9c30..7e4bac9c 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -31,14 +31,16 @@ function xoops_module_pre_install_rssfit(\XoopsModule $module) { include __DIR__ . '/common.php'; - // include __DIR__ . '/../preloads/autoloader.php'; /** @var rssfit\Utility $utility */ $utility = new \Xoopsmodules\rssfit\Utility(); + //check for minimum XOOPS version $xoopsSuccess = $utility::checkVerXoops($module); + + // check for minimum PHP version $phpSuccess = $utility::checkVerPhp($module); if (false !== $xoopsSuccess && false !== $phpSuccess) { - $moduleTables =& $module->getInfo('tables'); + $moduleTables = $module->getInfo('tables'); foreach ($moduleTables as $table) { $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); } @@ -57,12 +59,16 @@ function xoops_module_pre_install_rssfit(\XoopsModule $module) function xoops_module_install_rssfit(\XoopsModule $module) { global $xoopsConfig; - include __DIR__ . '/../preloads/autoloader.php'; +// include __DIR__ . '/../preloads/autoloader.php'; + include __DIR__ . '/common.php'; require_once __DIR__ . '/../../../mainfile.php'; require_once __DIR__ . '/../include/config.php'; $moduleDirName = basename(dirname(__DIR__)); +/** @var rssfit\Helper $helper */ + /** @var rssfit\Utility $utility */ + /** @var rssfit\Configurator $configurator */ $helper = rssfit\Helper::getInstance(); $utility = new rssfit\Utility(); $configurator = new rssfit\common\Configurator(); @@ -94,10 +100,6 @@ function xoops_module_install_rssfit(\XoopsModule $module) } } - // - // $configurator = new rssfit\common\Configurator(); - // /** @var rssfit\Utility $utility */ - // $utility = new rssfit\Utility(); // default Permission Settings ---------------------- @@ -118,20 +120,28 @@ function xoops_module_install_rssfit(\XoopsModule $module) $utility::createFolder($configurator->uploadFolders[$i]); } } - // --- COPY blank.png FILES --------------- - if (count($configurator->blankFiles) > 0) { + if (count($configurator->copyBlankFiles) > 0) { $file = __DIR__ . '/../assets/images/blank.png'; - foreach (array_keys($configurator->blankFiles) as $i) { - $dest = $configurator->blankFiles[$i] . '/blank.png'; + foreach (array_keys($configurator->copyBlankFiles) as $i) { + $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; $utility::copyFile($file, $dest); } } + + // --- COPY test folder files --------------- + if (count($configurator->copyTestFolders) > 0) { + // $file = __DIR__ . '/../testdata/images/'; + foreach (array_keys($configurator->copyTestFolders) as $i) { + $src = $configurator->copyTestFolders[$i][0]; + $dest = $configurator->copyTestFolders[$i][1]; + $utility::recurseCopy($src, $dest); + } + } + //delete .html entries from the tpl table $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'"; $GLOBALS['xoopsDB']->queryF($sql); return true; - } - diff --git a/include/onuninstall.php b/include/onuninstall.php index 04421081..65f6c7c5 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -1,4 +1,14 @@ loadLanguage('admin'); + $helper->loadLanguage('common'); $success = true; - $xsitemapHelper->loadLanguage('admin'); //------------------------------------------------------------------ // Remove uploads folder (and all subfolders) if they exist @@ -53,8 +63,8 @@ function xoops_module_uninstall_rssfit(XoopsModule $module) $dirInfo = new SplFileInfo($old_dir); if ($dirInfo->isDir()) { // The directory exists so delete it - if (false === $utilityClass::rrmdir($old_dir)) { - $module->setErrors(sprintf(_AM_RSSFIT_ERROR_BAD_DEL_PATH, $old_dir)); + if (false === $utility::rrmdir($old_dir)) { + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir)); $success = false; } } @@ -68,7 +78,7 @@ function xoops_module_uninstall_rssfit(XoopsModule $module) $xmlfile = $GLOBALS['xoops']->path('xsitemap.xml'); if (is_file($xmlfile)) { if (false === ($delOk = unlink($xmlfile))) { - $module->setErrors(sprintf(_AM_RSSFIT_XXXXX_ERROR_BAD_REMOVE, $xmlfile)); + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE'), $xmlfile)); } } // return $success && $delOk; // use this if you're using this routine @@ -78,4 +88,3 @@ function xoops_module_uninstall_rssfit(XoopsModule $module) //------------ END ---------------- } - diff --git a/include/onupdate.php b/include/onupdate.php index 6a6c416e..847c4487 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -33,17 +33,16 @@ function tableExists($tablename) { $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); - return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) ? true : false; + return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0); } /** * * Prepares system prior to attempting to install module - * @param \XoopsModule $xoopsModule - * @param null $previousVersion + * @param \XoopsModule $module {@link XoopsModule} * @return bool true if ready to install, false if not */ -function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVersion = null) +function xoops_module_pre_update_rssfit(\XoopsModule $module, $previousVersion = null) { $moduleDirName = basename(dirname(__DIR__)); /** @var rssfit\Helper $helper */ @@ -68,7 +67,7 @@ function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVers function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = null) { $moduleDirName = basename(dirname(__DIR__)); - $capsDirName = strtoupper($moduleDirName); + $moduleDirNameUpper = strtoupper($moduleDirName); /** @var rssfit\Helper $helper */ /** @var rssfit\Utility $utility */ @@ -77,25 +76,25 @@ function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = nul $utility = new rssfit\Utility(); $configurator = new rssfit\common\Configurator(); + $helper->loadLanguage('common'); $helper->loadLanguage('install'); - global $xoopsDB, $xoopsConfig; // rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); - list($rows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . " WHERE misc_category = 'channel'")); + list($rows) =$GLOBALS['xoopsDB']->fetchRow($GLOBALS['xoopsDB']->query('SELECT COUNT(*) FROM ' .$GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_misc') . " WHERE misc_category = 'channel'")); if (!$rows) { - $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` ADD `misc_setting` TEXT NOT NULL;'; - $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; + $sql[] = 'ALTER TABLE `' .$GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_misc') . '` ADD `misc_setting` TEXT NOT NULL;'; + $sql[] = 'ALTER TABLE `' .$GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_misc') . '` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; $intro_setting = ['dohtml' => 1, 'dobr' => 1, 'sub' => _INSTALL_INTRO_SUB]; - $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` SET misc_setting = ' . $xoopsDB->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; + $sql[] = 'UPDATE `' .$GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_misc') . '` SET misc_setting = ' .$GLOBALS['xoopsDB']->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; $sql[] = 'ALTER TABLE `' - . $xoopsDB->prefix($helper->getDirname() . '_plugins') + .$GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_plugins') . "` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; - $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_plugins') . '` SET sub_entries = 5'; + $sql[] = 'UPDATE `' .$GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_plugins') . '` SET sub_entries = 5'; $sql[] = rssfInsertChannel($xoopsMod); - $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; + $sql[] = 'INSERT INTO ' .$GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "('', 'sticky', '', '', " .$GLOBALS['xoopsDB']->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; foreach ($sql as $s) { - if (false === $xoopsDB->query($s)) { - echo '' . $xoopsDB->error() . '
' . $s . '

'; + if (false ===$GLOBALS['xoopsDB']->query($s)) { + echo '' .$GLOBALS['xoopsDB']->error() . '
' . $s . '

'; return false; } } @@ -139,8 +138,8 @@ function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = nul // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { foreach (array_keys($configurator->oldFolders) as $i) { $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]); - /* @var $folderHandler XoopsObjectHandler */ - $folderHandler = XoopsFile::getHandler('folder', $tempFolder); + /** @var XoopsObjectHandler $folderHandler */ + $folderHandler = \XoopsFile::getHandler('folder', $tempFolder); $folderHandler->delete($tempFolder); } } @@ -149,21 +148,21 @@ function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = nul if (count($configurator->uploadFolders) > 0) { // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { foreach (array_keys($configurator->uploadFolders) as $i) { - $utilityClass::createFolder($configurator->uploadFolders[$i]); + $utility::createFolder($configurator->uploadFolders[$i]); } } // --- COPY blank.png FILES --------------- - if (count($configurator->blankFiles) > 0) { + if (count($configurator->copyBlankFiles) > 0) { $file = __DIR__ . '/../assets/images/blank.png'; - foreach (array_keys($configurator->blankFiles) as $i) { - $dest = $configurator->blankFiles[$i] . '/blank.png'; - $utilityClass::copyFile($file, $dest); + foreach (array_keys($configurator->copyBlankFiles) as $i) { + $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; + $utility::copyFile($file, $dest); } } //delete .html entries from the tpl table - $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\''; + $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'"; $GLOBALS['xoopsDB']->queryF($sql); /** @var XoopsGroupPermHandler $gpermHandler */ @@ -173,4 +172,3 @@ function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = nul } return true; } - diff --git a/xoops_version.php b/xoops_version.php index 550c114d..08cba77f 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -1,32 +1,23 @@ ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### +/* + * 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. + */ + +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @package RSSFit - Extendable XML news feed generator + * @since + * @author XOOPS Development Team + * @author NS Tai (aka tuff) + */ + defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); @@ -86,7 +77,7 @@ // ------------------- Install/Update ------------------- 'onInstall' => 'include/oninstall.php', 'onUpdate' => 'include/onupdate.php', - // 'onUninstall' => 'include/onuninstall.php', + 'onUninstall' => 'include/onuninstall.php', // ------------------- PayPal --------------------------- 'paypal' => [ 'business' => 'foundation@xoops.org', From e114bcd709e8372133c4b78951f612d6fa3a2b77 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 24 Dec 2017 00:17:35 -0500 Subject: [PATCH 037/154] cosmetics --- admin/admin_header.php | 4 ---- admin/do_channel.php | 2 ++ admin/do_intro.php | 6 ++++++ admin/do_plugins.php | 29 +++++++++++++++++------------ admin/do_sticky.php | 4 ++++ admin/do_subfeeds.php | 2 ++ class/RssMisc.php | 1 - class/RssMiscHandler.php | 4 ++-- class/RssPlugins.php | 1 - class/RssPluginsHandler.php | 6 +++--- class/RssfeedHandler.php | 2 +- class/Utility.php | 1 - class/common/Breadcrumb.php | 2 +- class/common/Configurator.php | 1 - class/common/FilesManagement.php | 21 ++++++++++----------- class/common/ServerStats.php | 24 ++++++++++++------------ include/common.php | 5 +++-- include/oninstall.php | 7 +++---- include/onuninstall.php | 2 +- include/onupdate.php | 3 +-- index.php | 2 ++ 21 files changed, 70 insertions(+), 59 deletions(-) diff --git a/admin/admin_header.php b/admin/admin_header.php index f587ade2..fa9464fd 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -35,7 +35,3 @@ $helper->loadLanguage('admin'); xoops_cp_header(); - - - - diff --git a/admin/do_channel.php b/admin/do_channel.php index 544194b9..5ea038cc 100644 --- a/admin/do_channel.php +++ b/admin/do_channel.php @@ -35,6 +35,8 @@ use Xmf\Request; use Xoopsmodules\rssfit; +include_once __DIR__ . '/admin_header.php'; + if (!preg_match('#/rssfit/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); } diff --git a/admin/do_intro.php b/admin/do_intro.php index d0be56c4..a91d0bcc 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -32,6 +32,10 @@ ## Project: RSSFit ## ############################################################################### +use Xoopsmodules\rssfit; + +include_once __DIR__ . '/admin_header.php'; + if (!preg_match('#/rssfit/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); } @@ -65,7 +69,9 @@ $form->addElement($title); $form->addElement($tray_content); $form->addElement($sub); + /** @var \XoopsFormElementTray $tray_save_cancel */ $form->addElement($tray_save_cancel); + /** @var \XoopsFormHidden $hidden_do */ $form->addElement($hidden_do); $form->addElement(new \XoopsFormHidden('op', 'save')); $form->display(); diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 33c16c90..d26627e1 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -33,6 +33,9 @@ ############################################################################### use Xmf\Request; +use Xoopsmodules\rssfit; + +include_once __DIR__ . '/admin_header.php'; if (!preg_match('#/rssfit/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); @@ -142,7 +145,7 @@ if (!$filelist =& $pluginsHandler->getPluginFileList()) { $filelist = []; } - $list = XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); + $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); $installable = []; foreach ($list as $f) { if (preg_match('/rssfit\.+[a-zA-Z0-9_]+\.php/', $f) && !in_array($f, $filelist)) { @@ -191,17 +194,19 @@ if (!empty($ret)) { $hidden = new \XoopsFormHidden('op', 'save'); - $ret = "
\n" - . $ret - . "
\n" - . $tray_save_cancel->render() - . "\n" - . $hidden->render() - . "\n" - . $hidden_do->render() - . "\n
"; + /** @var \XoopsFormElementTray $tray_save_cancel */ + /** @var \XoopsFormHidden $hidden_do */ + $ret = "
\n" + . $ret + . "
\n" + . $tray_save_cancel->render() + . "\n" + . $hidden->render() + . "\n" + . $hidden_do->render() + . "\n
"; echo $ret; } break; diff --git a/admin/do_sticky.php b/admin/do_sticky.php index 2e39dcba..8fa8e83e 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -32,6 +32,10 @@ ## Project: RSSFit ## ############################################################################### +use Xoopsmodules\rssfit; + +include_once __DIR__ . '/admin_header.php'; + if (!preg_match('#/rssfit/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); } diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index 77ccadaa..3fcd1bd6 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -35,6 +35,8 @@ use Xmf\Request; use Xoopsmodules\rssfit; +include_once __DIR__ . '/admin_header.php'; + if (!preg_match('#/rssfit/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); } diff --git a/class/RssMisc.php b/class/RssMisc.php index b894c08d..a2782a74 100644 --- a/class/RssMisc.php +++ b/class/RssMisc.php @@ -70,4 +70,3 @@ public function setDoBr($do = true) $this->vars['dobr']['value'] = $do; } } - diff --git a/class/RssMiscHandler.php b/class/RssMiscHandler.php index d5cde3ac..f456330c 100644 --- a/class/RssMiscHandler.php +++ b/class/RssMiscHandler.php @@ -47,7 +47,7 @@ class RssMiscHandler extends \XoopsObjectHandler { // public $db; public $db_table; - public $obj_class = 'Xoopsmodules\rssfit\RssMisc'; + public $obj_class = RssMisc::class; public $obj_key = 'misc_id'; /** @@ -162,7 +162,7 @@ public function &getObjects($criteria = null, $fields = '*', $key = '') /** * @param \XoopsObject $obj - * @return bool|mixed|void + * @return bool|mixed */ public function insert(\XoopsObject $obj) //, $force = false) { diff --git a/class/RssPlugins.php b/class/RssPlugins.php index 574c28c0..e6c65eb7 100644 --- a/class/RssPlugins.php +++ b/class/RssPlugins.php @@ -64,4 +64,3 @@ public function __construct() $this->initVar('img_title', XOBJ_DTYPE_TXTBOX, ''); } } - diff --git a/class/RssPluginsHandler.php b/class/RssPluginsHandler.php index 77c6790b..87b94ae8 100644 --- a/class/RssPluginsHandler.php +++ b/class/RssPluginsHandler.php @@ -47,7 +47,7 @@ class RssPluginsHandler extends \XoopsObjectHandler { // public $db; public $db_table; - public $obj_class = 'Xoopsmodules\rssfit\RssPlugins'; + public $obj_class = RssPlugins::class; public $obj_key = 'rssf_conf_id'; public $sortby = 'rssf_order'; public $order = 'ASC'; @@ -77,7 +77,7 @@ public function getInstance(\XoopsDatabase $db) } /** - * @return bool + * @return \XoopsObject */ public function create() { @@ -103,7 +103,7 @@ public function get($id, $fields = '*') /** * @param \XoopsObject $obj - * @return bool|mixed|void + * @return bool|mixed */ public function insert(\XoopsObject $obj) //, $force=false) { diff --git a/class/RssfeedHandler.php b/class/RssfeedHandler.php index 11f99659..705f50c8 100644 --- a/class/RssfeedHandler.php +++ b/class/RssfeedHandler.php @@ -245,7 +245,7 @@ public function getItems(&$feed) } $entries[$i]['pubdate'] = $this->rssTimeStamp($entries[$i]['timestamp']); } - if (empty($feed['plugin']) && 'd' == $this->modConfig['sort']) { + if (empty($feed['plugin']) && 'd' === $this->modConfig['sort']) { uasort($entries, 'sortTimestamp'); } if (count($entries) > $this->modConfig['overall_entries'] && empty($feed['plugin'])) { diff --git a/class/Utility.php b/class/Utility.php index 64df31d2..85940baa 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -154,5 +154,4 @@ public static function rssfInsertChannel(\XoopsModule $xoopsMod) . ", '')" . ';'; } - } diff --git a/class/common/Breadcrumb.php b/class/common/Breadcrumb.php index 530e772c..aa90a8f2 100644 --- a/class/common/Breadcrumb.php +++ b/class/common/Breadcrumb.php @@ -31,7 +31,7 @@ */ class Breadcrumb { - public $dirname; + public $dirname; private $bread = []; /** diff --git a/class/common/Configurator.php b/class/common/Configurator.php index c62a23b0..f65d36be 100644 --- a/class/common/Configurator.php +++ b/class/common/Configurator.php @@ -56,6 +56,5 @@ public function __construct() $this->oldFiles = $config->oldFiles; $this->oldFolders = $config->oldFolders; $this->modCopyright = $config->modCopyright; - } } diff --git a/class/common/FilesManagement.php b/class/common/FilesManagement.php index d73e58f0..21a77b6f 100644 --- a/class/common/FilesManagement.php +++ b/class/common/FilesManagement.php @@ -34,8 +34,7 @@ public static function createFolder($folder) file_put_contents($folder . '/index.html', ''); } - } - catch (Exception $e) { + } catch (\Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n", '
'; } } @@ -86,18 +85,18 @@ public static function recurseCopy($src, $dst) public static function deleteDirectory($src) { // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { return false; } $success = true; // remove old files - $dirInfo = new SplFileInfo($src); + $dirInfo = new \SplFileInfo($src); // validate is a directory if ($dirInfo->isDir()) { $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); foreach ($fileList as $k => $v) { - $fileInfo = new SplFileInfo("{$src}/{$v}"); + $fileInfo = new \SplFileInfo("{$src}/{$v}"); if ($fileInfo->isDir()) { // recursively handle subdirectories if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { @@ -134,7 +133,7 @@ public static function deleteDirectory($src) public static function rrmdir($src) { // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { return false; } @@ -146,7 +145,7 @@ public static function rrmdir($src) $success = true; // Open the source directory to read in files - $iterator = new DirectoryIterator($src); + $iterator = new \DirectoryIterator($src); foreach ($iterator as $fObj) { if ($fObj->isFile()) { $filename = $fObj->getPathname(); @@ -174,7 +173,7 @@ public static function rrmdir($src) public static function rmove($src, $dest) { // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { return false; } @@ -189,7 +188,7 @@ public static function rmove($src, $dest) } // Open the source directory to read in files - $iterator = new DirectoryIterator($src); + $iterator = new \DirectoryIterator($src); foreach ($iterator as $fObj) { if ($fObj->isFile()) { rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); @@ -217,7 +216,7 @@ public static function rmove($src, $dest) public static function rcopy($src, $dest) { // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { return false; } @@ -232,7 +231,7 @@ public static function rcopy($src, $dest) } // Open the source directory to read in files - $iterator = new DirectoryIterator($src); + $iterator = new \DirectoryIterator($src); foreach ($iterator as $fObj) { if ($fObj->isFile()) { copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); diff --git a/class/common/ServerStats.php b/class/common/ServerStats.php index 897e01c9..a1c3d8a7 100644 --- a/class/common/ServerStats.php +++ b/class/common/ServerStats.php @@ -35,13 +35,13 @@ public static function getServerStats() // $query = $GLOBALS['xoopsDB']->query($sql); // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); $html .= '
'; - $html .= "" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . ""; + $html .= "" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . ''; $html .= "
"; // $html .= '
' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
"; // $html .= "
"; // $html .= "
"; - $html .= '
' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "
"; - $html .= "
    "; + $html .= '
    ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '
    '; + $html .= '
      '; $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; @@ -60,15 +60,15 @@ public static function getServerStats() $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . ""; - $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . ""; - $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . ""; - $html .= "
    "; - $html .= "
      "; - $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . ""; - $html .= "
    "; - $html .= "
    "; - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ""; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . ''; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . ''; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . ''; + $html .= '
'; + $html .= '
    '; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . ''; + $html .= '
'; + $html .= '
'; + $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ''; $html .= '
'; $html .= '

'; diff --git a/include/common.php b/include/common.php index b82ff70d..de063b01 100644 --- a/include/common.php +++ b/include/common.php @@ -19,6 +19,7 @@ */ use Xoopsmodules\rssfit; + include __DIR__ . '/../preloads/autoloader.php'; $moduleDirName = basename(dirname(__DIR__)); @@ -105,6 +106,6 @@ $pathModIcon16 = $helper->getModule()->getInfo('modicons16'); $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); -$GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); -$GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); + $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); + $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); } diff --git a/include/oninstall.php b/include/oninstall.php index 7e4bac9c..43b272a1 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -29,7 +29,6 @@ */ function xoops_module_pre_install_rssfit(\XoopsModule $module) { - include __DIR__ . '/common.php'; /** @var rssfit\Utility $utility */ $utility = new \Xoopsmodules\rssfit\Utility(); @@ -66,9 +65,9 @@ function xoops_module_install_rssfit(\XoopsModule $module) $moduleDirName = basename(dirname(__DIR__)); -/** @var rssfit\Helper $helper */ + /** @var rssfit\Helper $helper */ /** @var rssfit\Utility $utility */ - /** @var rssfit\Configurator $configurator */ + /** @var rssfit\common\Configurator $configurator */ $helper = rssfit\Helper::getInstance(); $utility = new rssfit\Utility(); $configurator = new rssfit\common\Configurator(); @@ -129,7 +128,7 @@ function xoops_module_install_rssfit(\XoopsModule $module) } } - // --- COPY test folder files --------------- + // --- COPY test folder files --------------- if (count($configurator->copyTestFolders) > 0) { // $file = __DIR__ . '/../testdata/images/'; foreach (array_keys($configurator->copyTestFolders) as $i) { diff --git a/include/onuninstall.php b/include/onuninstall.php index 65f6c7c5..c81d462e 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -19,6 +19,7 @@ */ use Xoopsmodules\rssfit; + /** * Prepares system prior to attempting to uninstall module * @param XoopsModule $module {@link XoopsModule} @@ -86,5 +87,4 @@ function xoops_module_uninstall_rssfit(\XoopsModule $module) return $success; //------------ END ---------------- - } diff --git a/include/onupdate.php b/include/onupdate.php index 847c4487..15fdc47f 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -42,7 +42,7 @@ function tableExists($tablename) * @param \XoopsModule $module {@link XoopsModule} * @return bool true if ready to install, false if not */ -function xoops_module_pre_update_rssfit(\XoopsModule $module, $previousVersion = null) +function xoops_module_pre_update_rssfit(\XoopsModule $module) { $moduleDirName = basename(dirname(__DIR__)); /** @var rssfit\Helper $helper */ @@ -168,7 +168,6 @@ function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = nul /** @var XoopsGroupPermHandler $gpermHandler */ $gpermHandler = xoops_getHandler('groupperm'); return $gpermHandler->deleteByModule($module->getVar('mid'), 'item_read'); - } return true; } diff --git a/index.php b/index.php index e1638fe2..e7f4ac38 100644 --- a/index.php +++ b/index.php @@ -31,11 +31,13 @@ ## URL: http://www.brandycoke.com/ ## ## Project: RSSFit ## ############################################################################### +use Xoopsmodules\rssfit; require __DIR__ . '/header.php'; $GLOBALS['xoopsOption']['template_main'] = 'rssfit_index.tpl'; require XOOPS_ROOT_PATH . '/header.php'; if ($intr = $miscHandler->getObjects(new \Criteria('misc_category', 'intro'))) { + /** @var rssfit\RssMisc $intro */ $intro = $intr[0]; $setting = $intro->getVar('misc_setting'); $intro->setDoHtml($setting['dohtml'] ? 1 : 0); From 8b592d2d089c3da515e69e2ffb540d05a57d0c86 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 24 Dec 2017 01:40:08 -0500 Subject: [PATCH 038/154] fix for feed config --- include/common.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/common.php b/include/common.php index de063b01..c349a0fd 100644 --- a/include/common.php +++ b/include/common.php @@ -49,8 +49,8 @@ define($moduleDirNameUpper . '_URL_FEED', constant($moduleDirNameUpper . '_URL') . 'rss.php'); define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images'); define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images'); - define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/'); - define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/'); + define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . 'admin/index.php'); + define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . 'admin/index.php'); define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . constant($moduleDirNameUpper . '_DIRNAME')); define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php'); define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); From 96fc274774cb1697555516006317155342af31e1 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 24 Dec 2017 01:40:41 -0500 Subject: [PATCH 039/154] deprecated xoops_setCaching --- rss.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/rss.php b/rss.php index b49b65af..ab5e113f 100644 --- a/rss.php +++ b/rss.php @@ -50,9 +50,9 @@ require_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new \XoopsTpl(); if (!$docache) { - $xoopsTpl->xoops_setCaching(0); + $xoopsTpl->caching=0; } else { - $xoopsTpl->xoops_setCaching(2); + $xoopsTpl->caching=2; $xoopsTpl->xoops_setCacheTime($xoopsModuleConfig['cache'] * 60); } From 31702e41dd33a1998eba3115b17e17efbcda7cbf Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 24 Dec 2017 05:17:07 -0500 Subject: [PATCH 040/154] references --- class/RssfeedHandler.php | 6 +++--- plugins/rssfit.smartsection.php | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/class/RssfeedHandler.php b/class/RssfeedHandler.php index 705f50c8..df9e1741 100644 --- a/class/RssfeedHandler.php +++ b/class/RssfeedHandler.php @@ -213,17 +213,17 @@ public function getItems(&$feed) if (!empty($feed['plugin'])) { $this->plugin_obj->setVar('rssf_grab', $this->plugin_obj->getVar('sub_entries')); $this->subHandler->grab = $this->plugin_obj->getVar('sub_entries'); - $grab =& $this->subHandler->grabEntries($this->plugin_obj); + $grab = $this->subHandler->grabEntries($this->plugin_obj); if (false !== $grab && count($grab) > 0) { foreach ($grab as $g) { array_push($entries, $g); } } - } elseif ($plugins =& $this->pHandler->getObjects(new \Criteria('rssf_activated', 1))) { + } elseif ($plugins = $this->pHandler->getObjects(new \Criteria('rssf_activated', 1))) { foreach ($plugins as $p) { if ($handler == $this->pHandler->checkPlugin($p)) { $handler->grab = $p->getVar('rssf_grab'); - $grab =& $handler->grabEntries($p); + $grab = $handler->grabEntries($p); if (false !== $grab && count($grab) > 0) { foreach ($grab as $g) { array_push($entries, $g); diff --git a/plugins/rssfit.smartsection.php b/plugins/rssfit.smartsection.php index 39ea5b6f..3e70f48d 100644 --- a/plugins/rssfit.smartsection.php +++ b/plugins/rssfit.smartsection.php @@ -71,7 +71,11 @@ public function &grabEntries(&$obj) { $ret = false; include XOOPS_ROOT_PATH . '/modules/smartsection/include/common.php'; - $items = $smartsection_item_handler->getAllPublished($this->grab, 0); + + $smartsectionHelper = Xmf\Module\Helper::getHelper('smartsection'); + $smartsectionItemHandler = $smartsectionHelper->getHandler('item'); + $items = $smartsectionItemHandler->getAllPublished($this->grab, 0); +// $items = $smartsection_item_handler->getAllPublished($this->grab, 0); if (false !== $items && count($items) > 0) { for ($i = 0, $iMax = count($items); $i < $iMax; $i++) { $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); From 7ded6eb7d22e0fc3f9ca298a11a599bc0a50166c Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 24 Dec 2017 05:50:19 -0500 Subject: [PATCH 041/154] remove Multibyte check --- class/RssfeedHandler.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/class/RssfeedHandler.php b/class/RssfeedHandler.php index df9e1741..0899ea55 100644 --- a/class/RssfeedHandler.php +++ b/class/RssfeedHandler.php @@ -352,7 +352,8 @@ public function cleanupChars(&$text, $strip = true, $dospec = true, $dosub = fal $text = htmlspecialchars($text, ENT_QUOTES, $this->charset); $text = preg_replace('/&(#[0-9]+);/i', '&$1;', $text); } - if (!preg_match('/utf-8/i', $this->charset) || XOOPS_USE_MULTIBYTES != 1) { +// if (!preg_match('/utf-8/i', $this->charset) || XOOPS_USE_MULTIBYTES != 1) { + if (!preg_match('/utf-8/i', $this->charset)) { $text = str_replace(array_map('chr', array_keys($this->escaped)), $this->escaped, $text); } } From 13cb15a832b8064d86532d90e487f5c588448c2b Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 24 Dec 2017 15:20:38 -0500 Subject: [PATCH 042/154] cosmetics --- class/RssfeedHandler.php | 26 +++++++++++++------------- class/common/Breadcrumb.php | 2 +- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/class/RssfeedHandler.php b/class/RssfeedHandler.php index 0899ea55..2f178e0f 100644 --- a/class/RssfeedHandler.php +++ b/class/RssfeedHandler.php @@ -50,7 +50,7 @@ class RssfeedHandler public $mHandler; public $channelreq; public $subHandler; - public $plugin_obj; + public $pluginObj; public $myts; public $modConfig; public $xoopsConfig; @@ -139,14 +139,14 @@ public function getChannel(&$feed) } } if (!empty($feed['plugin'])) { - if (is_object($this->plugin_obj) && is_object($this->subHandler)) { - $channel['title'] = $this->plugin_obj->getVar('sub_title', 'n'); - $channel['link'] = $this->plugin_obj->getVar('sub_link', 'n'); - $channel['description'] = $this->plugin_obj->getVar('sub_desc', 'n'); + if (is_object($this->pluginObj) && is_object($this->subHandler)) { + $channel['title'] = $this->pluginObj->getVar('sub_title', 'n'); + $channel['link'] = $this->pluginObj->getVar('sub_link', 'n'); + $channel['description'] = $this->pluginObj->getVar('sub_desc', 'n'); $image = [ - 'url' => $this->plugin_obj->getVar('img_url', 'n'), - 'title' => $this->plugin_obj->getVar('img_title', 'n'), - 'link' => $this->plugin_obj->getVar('img_link', 'n') + 'url' => $this->pluginObj->getVar('img_url', 'n'), + 'title' => $this->pluginObj->getVar('img_title', 'n'), + 'link' => $this->pluginObj->getVar('img_link', 'n') ]; } } else { @@ -189,7 +189,7 @@ public function getSticky(&$feed) return false; } if ((in_array(-1, $setting['feeds']) && empty($feed['plugin'])) - || (!empty($feed['plugin']) && in_array($this->plugin_obj->getVar('rssf_conf_id'), $setting['feeds']))) { + || (!empty($feed['plugin']) && in_array($this->pluginObj->getVar('rssf_conf_id'), $setting['feeds']))) { $feed['sticky']['title'] = $sticky->getVar('misc_title', 'n'); $feed['sticky']['link'] = $setting['link']; $sticky->setDoHtml($setting['dohtml']); @@ -211,9 +211,9 @@ public function getItems(&$feed) { $entries = []; if (!empty($feed['plugin'])) { - $this->plugin_obj->setVar('rssf_grab', $this->plugin_obj->getVar('sub_entries')); - $this->subHandler->grab = $this->plugin_obj->getVar('sub_entries'); - $grab = $this->subHandler->grabEntries($this->plugin_obj); + $this->pluginObj->setVar('rssf_grab', $this->pluginObj->getVar('sub_entries')); + $this->subHandler->grab = $this->pluginObj->getVar('sub_entries'); + $grab = $this->subHandler->grabEntries($this->pluginObj); if (false !== $grab && count($grab) > 0) { foreach ($grab as $g) { array_push($entries, $g); @@ -458,7 +458,7 @@ public function checkSubFeed(&$feed) $handler = $this->pHandler->checkPlugin($sub[0]); } if ($handler) { - $this->plugin_obj = $sub[0]; + $this->pluginObj = $sub[0]; $this->subHandler = $handler; $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' . md5(str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); } else { diff --git a/class/common/Breadcrumb.php b/class/common/Breadcrumb.php index aa90a8f2..017b1d43 100644 --- a/class/common/Breadcrumb.php +++ b/class/common/Breadcrumb.php @@ -18,7 +18,7 @@ * @package rss * * Example: - * $breadcrumb = new PedigreeBreadcrumb(); + * $breadcrumb = new Breadcrumb(); * $breadcrumb->addLink( 'bread 1', 'index1.php' ); * $breadcrumb->addLink( 'bread 2', '' ); * $breadcrumb->addLink( 'bread 3', 'index3.php' ); From 90128493854dc0341ec1922dcce6f1a3d289df9d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 24 Dec 2017 18:53:41 -0500 Subject: [PATCH 043/154] cosmetics --- admin/do_plugins.php | 3 +- admin/do_subfeeds.php | 12 +++--- assets/js/index.html | 1 - class/RssMisc.php | 4 +- class/RssMiscHandler.php | 8 ++-- class/{RssPlugins.php => RssPlugin.php} | 8 ++-- ...luginsHandler.php => RssPluginHandler.php} | 37 +++++++++---------- class/RssfeedHandler.php | 15 ++++---- class/Utility.php | 2 +- language/english/admin.php | 6 ++- language/english/install.php | 2 +- language/english/modinfo.php | 2 +- plugins/rssfit.adslight.php | 8 ++-- plugins/rssfit.ams.php | 8 ++-- plugins/rssfit.buyersguide.php | 8 ++-- plugins/rssfit.buyersguidemanufacturers.php | 8 ++-- plugins/rssfit.buyersguidenews.php | 8 ++-- plugins/rssfit.cbb.php | 8 ++-- plugins/rssfit.comments.php | 8 ++-- plugins/rssfit.extcal.php | 8 ++-- plugins/rssfit.lexikon.php | 8 ++-- plugins/rssfit.myalbum.php | 9 ++--- plugins/rssfit.mydownloads.php | 8 ++-- plugins/rssfit.mylinks.php | 8 ++-- plugins/rssfit.mytube.php | 8 ++-- plugins/rssfit.newbb.php | 8 ++-- plugins/rssfit.newbb2.php | 8 ++-- plugins/rssfit.news.php | 8 ++-- plugins/rssfit.oledrion.php | 8 ++-- plugins/rssfit.pical.php | 8 ++-- plugins/rssfit.pluginsample.php | 8 ++-- plugins/rssfit.publisher.php | 8 ++-- plugins/rssfit.queries.php | 8 ++-- plugins/rssfit.rmdp.php | 8 ++-- plugins/rssfit.smartfaq.php | 8 ++-- plugins/rssfit.smartpartner.php | 8 ++-- plugins/rssfit.smartsection.php | 8 ++-- plugins/rssfit.special.php | 8 ++-- plugins/rssfit.surnames.php | 8 ++-- plugins/rssfit.weblinks.php | 8 ++-- plugins/rssfit.wfdownloads.php | 8 ++-- plugins/rssfit.wfdownloads_podcast.php | 8 ++-- plugins/rssfit.wflinks.php | 8 ++-- plugins/rssfit.wfsection.php | 8 ++-- plugins/rssfit.wfsection2.php | 8 ++-- plugins/rssfit.xoopstube.php | 9 ++--- 46 files changed, 151 insertions(+), 223 deletions(-) rename class/{RssPlugins.php => RssPlugin.php} (96%) rename class/{RssPluginsHandler.php => RssPluginHandler.php} (93%) diff --git a/admin/do_plugins.php b/admin/do_plugins.php index d26627e1..914ff77e 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -116,6 +116,7 @@ . _AM_RSSFIT_ACTION . "
\n" . "\n" @@ -55,9 +58,9 @@ foreach ($plugins as $p) { if ($handler = $pluginsHandler->checkPlugin($p)) { $id = $p->getVar('rssf_conf_id'); - $entries = new XoopsFormText('', 'rssf_grab[' . $id . ']', 3, 2, $p->getVar('rssf_grab')); - $order = new XoopsFormText('', 'rssf_order[' . $id . ']', 3, 2, $p->getVar('rssf_order')); - $action = new XoopsFormSelect('', 'action[' . $id . ']', ''); + $entries = new \XoopsFormText('', 'rssf_grab[' . $id . ']', 3, 2, $p->getVar('rssf_grab')); + $order = new \XoopsFormText('', 'rssf_order[' . $id . ']', 3, 2, $p->getVar('rssf_order')); + $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); $action->addOption('', _SELECT); $action->addOption('d', _AM_PLUGIN_DEACTIVATE); $action->addOption('u', _AM_PLUGIN_UNINSTALL); @@ -81,7 +84,7 @@ } // inactive plugins - if ($plugins = $pluginsHandler->getObjects(new Criteria('rssf_activated', 0), 'p_inactive')) { + if ($plugins = $pluginsHandler->getObjects(new \Criteria('rssf_activated', 0), 'p_inactive')) { $ret .= "
\n
" . _AM_PLUGIN_ACTIVATED . "
\n" . "\n" . "\n\n" @@ -90,7 +93,7 @@ . "\n"; foreach ($plugins as $p) { $id = $p->getVar('rssf_conf_id'); - $action = new XoopsFormSelect('', 'action[' . $id . ']', ''); + $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); $action->addOption('', _SELECT); $ret .= "\n" . "\n" . "\n"; foreach ($installable as $i) { - $action = new XoopsFormCheckbox('', 'install[' . $i . ']'); + $action = new \XoopsFormCheckbox('', 'install[' . $i . ']'); $action->addOption('i', ' '); $ret .= "\n" . "'; } - $admin_links .= "
" . _AM_PLUGIN_INACTIVE . "
" . _AM_PLUGIN_FILENAME . "
" @@ -136,7 +139,7 @@ . "" . _AM_PLUGIN_INSTALL . "
" @@ -165,7 +168,7 @@ } if (!empty($ret)) { - $hidden = new XoopsFormHidden('op', 'save'); + $hidden = new \XoopsFormHidden('op', 'save'); $ret = "
\n" . $ret . "
\n"; } $ret .= "
\n" . $tray_save_cancel->render() . "\n" . $hidden->render() . "\n" @@ -177,7 +180,7 @@ $rssf_grab = Request::getArray('rssf_grab', [], 'POST'); $rssf_order = Request::getArray('rssf_order', [], 'POST'); $action = Request::getArray('action', null, 'POST'); - $install = Request::getArray('install', array(), 'POST'); + $install = Request::getArray('install', [], 'POST'); $err = ''; if (isset($action)) { $keys = array_keys($action); @@ -218,8 +221,8 @@ $p->setVar('rssf_filename', $f); if ($handler = $pluginsHandler->checkPlugin($p)) { $p->setVar('rssf_activated', 1); - $p->setVar('rssf_grab', $xoopsModuleConfig['plugin_entries']); - $p->setVar('sub_entries', $xoopsModuleConfig['plugin_entries']); + $p->setVar('rssf_grab', $helper->getConfig('plugin_entries')); + $p->setVar('sub_entries', $helper->getConfig('plugin_entries')); $p->setVar('sub_link', XOOPS_URL . '/modules/' . $handler->dirname); $p->setVar('sub_title', $xoopsConfig['sitename'] . ' - ' . $handler->modname); $p->setVar('sub_desc', $xoopsConfig['slogan']); @@ -237,4 +240,4 @@ break; } -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/do_sticky.php b/admin/do_sticky.php index a1d61b6c..52bd5eb4 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -36,7 +36,7 @@ header('Location: index.php'); } -if ($intr = $miscHandler->getObjects(new Criteria('misc_category', 'sticky'))) { +if ($intr = $miscHandler->getObjects(new \Criteria('misc_category', 'sticky'))) { $sticky = $intr[0]; unset($intr); } else { @@ -45,32 +45,32 @@ switch ($op) { default: $setting = $sticky->getVar('misc_setting'); - $title = new XoopsFormText(_AM_STICKY_TITLE, 'title', 50, 255, $sticky->getVar('misc_title', 'e')); + $title = new \XoopsFormText(_AM_STICKY_TITLE, 'title', 50, 255, $sticky->getVar('misc_title', 'e')); $title->setDescription(_AM_EDIT_INTRO_TITLE_DESC); - $tray_content = new XoopsFormElementTray(_AM_STICKY_CONTENT, '
'); + $tray_content = new \XoopsFormElementTray(_AM_STICKY_CONTENT, '
'); $tray_content->setDescription(_AM_EDIT_INTRO_TEXT_DESC); - $content = new XoopsFormTextArea('', 'content', $sticky->getVar('misc_content', 'e'), 10); + $content = new \XoopsFormTextArea('', 'content', $sticky->getVar('misc_content', 'e'), 10); $tray_content->addElement($content); - $dohtml = new XoopsFormCheckbox('', 'dohtml', $setting['dohtml']); + $dohtml = new \XoopsFormCheckbox('', 'dohtml', $setting['dohtml']); $dohtml->addOption(1, _AM_DO_HTML); $tray_content->addElement($dohtml); - $dobr = new XoopsFormCheckbox('', 'dobr', $setting['dobr']); + $dobr = new \XoopsFormCheckbox('', 'dobr', $setting['dobr']); $dobr->addOption(1, _AM_DO_BR); $tray_content->addElement($dobr); - $link = new XoopsFormText(_AM_STICKY_LINK, 'link', 50, 255, $myts->makeTboxData4PreviewInForm($setting['link'])); + $link = new \XoopsFormText(_AM_STICKY_LINK, 'link', 50, 255, $myts->htmlSpecialChars($myts->stripSlashesGPC($setting['link']))); $applyto = $rss->feedSelectBox(_AM_STICKY_APPLYTO, $setting['feeds'], 10); - $form = new XoopsThemeForm(_AM_STICKY_EDIT, 'editsticky', RSSFIT_ADMIN_URL); + $form = new \XoopsThemeForm(_AM_STICKY_EDIT, 'editsticky', RSSFIT_ADMIN_URL); $form->addElement($title); $form->addElement($tray_content); $form->addElement($link); $form->addElement($applyto); $form->addElement($tray_save_cancel); $form->addElement($hidden_do); - $form->addElement(new XoopsFormHidden('op', 'save')); + $form->addElement(new \XoopsFormHidden('op', 'save')); $form->display(); break; diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index a2dd524c..4ca6c0d1 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -33,6 +33,7 @@ ############################################################################### use Xmf\Request; +use XoopsModules\rss; if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); @@ -54,14 +55,14 @@ if (!$handler = $pluginsHandler->checkPlugin($p)) { $pluginsHandler->forceDeactivate($p); $mod = implode('
', $p->getErrors()); - $activate = new XoopsFormCheckbox('', 'activate[' . $id . ']', 0); + $activate = new \XoopsFormCheckbox('', 'activate[' . $id . ']', 0); $activate->setExtra('disabled="disabled"'); $config = ' '; $urlLink = $rss->subFeedUrl($p->getVar('rssf_filename')); } else { $mod = $handler->modname; - $activate = new XoopsFormCheckbox('', 'activate[' . $id . ']', $p->getVar('subfeed')); - $config = rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_SUB_CONFIGURE); + $activate = new \XoopsFormCheckbox('', 'activate[' . $id . ']', $p->getVar('subfeed')); + $config = rss\Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_SUB_CONFIGURE); $urlLink = '' . $rss->subFeedUrl($p->getVar('rssf_filename')) .''; } $activate->addOption(1, ' '); @@ -73,7 +74,7 @@ $ret .= "
\n"; - $hidden = new XoopsFormHidden('op', 'save'); + $hidden = new \XoopsFormHidden('op', 'save'); $ret = "\n" . $ret . "
\n" . $tray_save_cancel->render() . "\n" . $hidden->render() . "\n" @@ -90,7 +91,7 @@ $pluginsHandler->modifyObjects(null, ['subfeed' => 0]); if (isset($activate) && is_array($activate) && count($activate) > 0) { $keys = array_keys($activate); - $criteria = new Criteria('rssf_conf_id', '(' . implode(',', $keys) . ')', 'IN'); + $criteria = new \Criteria('rssf_conf_id', '(' . implode(',', $keys) . ')', 'IN'); $pluginsHandler->modifyObjects($criteria, ['subfeed' => 1]); } redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); @@ -109,22 +110,22 @@ if (empty($id) || !$sub) { redirect_header(RSSFIT_ADMIN_URL, 0, _AM_SUB_PLUGIN_NONE); } - $form = new XoopsThemeForm(sprintf(_AM_SUB_EDIT, $handler->modname), 'editsub', RSSFIT_ADMIN_URL); - $form->addElement(new XoopsFormRadioYN(_AM_SUB_ACTIVATE, 'subfeed', $sub->getVar('subfeed'))); - $form->addElement(new XoopsFormText(_AM_PLUGIN_SHOWXENTRIES, 'sub_entries', 3, 2, $sub->getVar('sub_entries')), true); + $form = new \XoopsThemeForm(sprintf(_AM_SUB_EDIT, $handler->modname), 'editsub', RSSFIT_ADMIN_URL); + $form->addElement(new \XoopsFormRadioYN(_AM_SUB_ACTIVATE, 'subfeed', $sub->getVar('subfeed'))); + $form->addElement(new \XoopsFormText(_AM_PLUGIN_SHOWXENTRIES, 'sub_entries', 3, 2, $sub->getVar('sub_entries')), true); - $form->addElement(new XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_REQUIRED . ' ' . genSpecMoreInfo('req', $rss))); - $form->addElement(new XoopsFormText('title', 'sub_title', 50, 255, $sub->getVar('sub_title', 'e')), true); - $form->addElement(new XoopsFormText('link', 'sub_link', 50, 255, $sub->getVar('sub_link', 'e')), true); - $form->addElement(new XoopsFormTextArea('description', 'sub_desc', $sub->getVar('sub_desc', 'e')), true); + $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_REQUIRED . ' ' . rss\Utility::genSpecMoreInfo('req', $rss))); + $form->addElement(new \XoopsFormText('title', 'sub_title', 50, 255, $sub->getVar('sub_title', 'e')), true); + $form->addElement(new \XoopsFormText('link', 'sub_link', 50, 255, $sub->getVar('sub_link', 'e')), true); + $form->addElement(new \XoopsFormTextArea('description', 'sub_desc', $sub->getVar('sub_desc', 'e')), true); - $form->addElement(new XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_IMAGE . ' ' . genSpecMoreInfo('img', $rss))); - $form->addElement(new XoopsFormText('url', 'img_url', 50, 255, $sub->getVar('img_url', 'e'))); - $form->addElement(new XoopsFormText('link', 'img_link', 50, 255, $sub->getVar('img_link', 'e'))); - $form->addElement(new XoopsFormText('title', 'img_title', 50, 255, $sub->getVar('img_title', 'e'))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_IMAGE . ' ' . rss\Utility::genSpecMoreInfo('img', $rss))); + $form->addElement(new \XoopsFormText('url', 'img_url', 50, 255, $sub->getVar('img_url', 'e'))); + $form->addElement(new \XoopsFormText('link', 'img_link', 50, 255, $sub->getVar('img_link', 'e'))); + $form->addElement(new \XoopsFormText('title', 'img_title', 50, 255, $sub->getVar('img_title', 'e'))); - $form->addElement(new XoopsFormHidden('feed', $id)); - $form->addElement(new XoopsFormHidden('op', 'savefeed')); + $form->addElement(new \XoopsFormHidden('feed', $id)); + $form->addElement(new \XoopsFormHidden('op', 'savefeed')); $form->addElement($hidden_do); $form->addElement($tray_save_cancel); $form->display(); diff --git a/admin/index.php b/admin/index.php index 597d5c08..8930274b 100644 --- a/admin/index.php +++ b/admin/index.php @@ -12,7 +12,7 @@ use Xmf\Request; /** - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package * @since @@ -20,7 +20,7 @@ */ -include_once __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; $moduleAdmin = \Xmf\Module\Admin::getInstance(); $do = Request::getString('do', ''); @@ -28,13 +28,13 @@ define('RSSFIT_OK', 1); if (file_exists(RSSFIT_ROOT_PATH.'admin/do_'.$do.'.php')) { - include_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; - $hidden_do = new XoopsFormHidden('do', $do); - $button_save = new XoopsFormButton('', 'submit', _AM_SAVE, 'submit'); - $button_go = new XoopsFormButton('', 'submit', _GO, 'submit'); - $button_cancel = new XoopsFormButton('', 'cancel', _CANCEL); + require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; + $hidden_do = new \XoopsFormHidden('do', $do); + $button_save = new \XoopsFormButton('', 'submit', _AM_SAVE, 'submit'); + $button_go = new \XoopsFormButton('', 'submit', _GO, 'submit'); + $button_cancel = new \XoopsFormButton('', 'cancel', _CANCEL); $button_cancel->setExtra('onclick="javascript:history.go(-1)"'); - $tray_save_cancel = new XoopsFormElementTray('', ''); + $tray_save_cancel = new \XoopsFormElementTray('', ''); $tray_save_cancel->addElement($button_save); $tray_save_cancel->addElement($button_cancel); $moduleAdmin->displayNavigation('?do=' . $do); @@ -44,4 +44,4 @@ $moduleAdmin->displayIndex(); } -include_once __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/menu.php b/admin/menu.php index 102ff1c2..1843c63d 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -10,16 +10,16 @@ */ /** - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit * @since * @author XOOPS Development Team */ -use Xoopsmodules\rss; +use XoopsModules\rss; -require_once __DIR__ . '/../class/Helper.php'; +// require_once __DIR__ . '/../class/Helper.php'; //require_once __DIR__ . '/../include/common.php'; $helper = rss\Helper::getInstance(); // get path to icons diff --git a/class/misc.php b/class/misc.php index 990c8bcf..49f5c22b 100644 --- a/class/misc.php +++ b/class/misc.php @@ -66,13 +66,13 @@ class RssMiscHandler extends XoopsObjectHandler public $obj_class = 'RssMisc'; public $obj_key = 'misc_id'; - public function __construct(XoopsDatabase $db) + public function __construct(\XoopsDatabase $db) { $this->db = $db; - $this->db_table = $this->db->prefix('rssfit_misc'); + $this->db_table = $this->db->prefix($helper->getDirname() . '_misc'); } - public function getInstance(XoopsDatabase $db) + public function getInstance(\XoopsDatabase $db) { static $instance; if (null === $instance) { @@ -90,7 +90,7 @@ public function create() public function get($id, $fields='*') { - $criteria = new Criteria($this->obj_key, (int)$id); + $criteria = new \Criteria($this->obj_key, (int)$id); if ($objs =& $this->getObjects($criteria)) { return 1 != count($objs) ? false : $objs[0]; } @@ -130,7 +130,7 @@ public function &getObjects($criteria=null, $fields='*', $key='') if (!$result) { return false; } - while ($myrow = $this->db->fetchArray($result)) { + while (false !== ($myrow = $this->db->fetchArray($result))) { $obj = new $this->obj_class(); $obj->assignVars($myrow); switch ($key) { @@ -149,7 +149,7 @@ public function &getObjects($criteria=null, $fields='*', $key='') return $ret; } - public function insert(XoopsObject $obj) //, $force = false) + public function insert(\XoopsObject $obj) //, $force = false) { $force = false; if (strtolower(get_class($obj)) != strtolower($this->obj_class)) { @@ -225,7 +225,7 @@ public function modifyObjects($criteria=null, $fields= [], $force=false) return false; } - public function delete(XoopsObject $obj) // , $force=false) + public function delete(\XoopsObject $obj) // , $force=false) { $force = false; if (strtolower(get_class($obj)) != strtolower($this->obj_class)) { diff --git a/class/plugins.php b/class/plugins.php index 41d3268e..06b89ad1 100644 --- a/class/plugins.php +++ b/class/plugins.php @@ -66,12 +66,12 @@ class RssPluginsHandler extends XoopsObjectHandler public $sortby = 'rssf_order'; public $order = 'ASC'; - public function __construct(XoopsDatabase $db) + public function __construct(\XoopsDatabase $db) { $this->db = $db; - $this->db_table = $this->db->prefix('rssfit_plugins'); + $this->db_table = $this->db->prefix($helper->getDirname() . '_plugins'); } - public function getInstance(XoopsDatabase $db) + public function getInstance(\XoopsDatabase $db) { static $instance; if (null === $instance) { @@ -89,14 +89,14 @@ public function create() public function get($id, $fields='*') { $ret = false; - $criteria = new Criteria($this->obj_key, (int)$id); + $criteria = new \Criteria($this->obj_key, (int)$id); if ($objs =& $this->getObjects($criteria) && 1 === count($objs)) { $ret =& $objs[0]; } return $ret; } - public function insert(XoopsObject $obj) //, $force=false) + public function insert(\XoopsObject $obj) //, $force=false) { $force=false; if (strtolower(get_class($obj)) != strtolower($this->obj_class)) { @@ -145,7 +145,7 @@ public function insert(XoopsObject $obj) //, $force=false) return $obj->getVar($this->obj_key); } - public function delete(XoopsObject $obj) //, $force = false) + public function delete(\XoopsObject $obj) //, $force = false) { $force = false; if (strtolower(get_class($obj)) != strtolower($this->obj_class)) { @@ -194,7 +194,7 @@ public function &getObjects($criteria=null, $fields='*', $key='') if (!$result) { return false; } - while ($myrow = $this->db->fetchArray($result)) { + while (false !== ($myrow = $this->db->fetchArray($result))) { $obj = new $this->obj_class(); $obj->assignVars($myrow); switch ($key) { @@ -253,7 +253,7 @@ public function getCount($criteria = null) public function forceDeactivate(&$obj, $type='rssf_activated') { - $criteria = new Criteria($this->obj_key, $obj->getVar($this->obj_key)); + $criteria = new \Criteria($this->obj_key, $obj->getVar($this->obj_key)); $fields = ['rssf_activated' => 0, 'subfeed' => 0]; $this->modifyObjects($criteria, $fields, true); return true; diff --git a/class/rssfeed.php b/class/rssfeed.php index 3bc06a07..1ff68adc 100644 --- a/class/rssfeed.php +++ b/class/rssfeed.php @@ -90,7 +90,7 @@ public function __construct($modConfig, $xoopsConfig, $xoopsModule) public function getChannel(&$feed) { $channel = []; - if ($elements =& $this->mHandler->getObjects(new Criteria('misc_category', 'channel'))) { + if ($elements =& $this->mHandler->getObjects(new \Criteria('misc_category', 'channel'))) { foreach ($elements as $e) { if ('' != $e->getVar('misc_content')) { $channel[$e->getVar('misc_title')] = $e->getVar('misc_content', 'n'); @@ -114,7 +114,7 @@ public function getChannel(&$feed) ]; } } else { - if ($img =& $this->mHandler->getObjects(new Criteria('misc_category', 'channelimg'), '*', 'title')) { + if ($img =& $this->mHandler->getObjects(new \Criteria('misc_category', 'channelimg'), '*', 'title')) { $image = [ 'url' => $img['url']->getVar('misc_content', 'n'), 'title' => $img['title']->getVar('misc_content', 'n'), @@ -139,7 +139,7 @@ public function getChannel(&$feed) public function getSticky(&$feed) { - if (!$intr = $this->mHandler->getObjects(new Criteria('misc_category', 'sticky'))) { + if (!$intr = $this->mHandler->getObjects(new \Criteria('misc_category', 'sticky'))) { return false; } $sticky =& $intr[0]; @@ -177,7 +177,7 @@ public function getItems(&$feed) array_push($entries, $g); } } - } elseif ($plugins =& $this->pHandler->getObjects(new Criteria('rssf_activated', 1))) { + } elseif ($plugins =& $this->pHandler->getObjects(new \Criteria('rssf_activated', 1))) { foreach ($plugins as $p) { if ($handler =& $this->pHandler->checkPlugin($p)) { $handler->grab = $p->getVar('rssf_grab'); @@ -203,7 +203,7 @@ public function getItems(&$feed) } $entries[$i]['pubdate'] = $this->rssTimeStamp($entries[$i]['timestamp']); } - if (empty($feed['plugin']) && 'd' == $this->modConfig['sort']) { + if (empty($feed['plugin']) && 'd' === $this->modConfig['sort']) { uasort($entries, 'sortTimestamp'); } if (count($entries) > $this->modConfig['overall_entries'] && empty($feed['plugin'])) { @@ -293,7 +293,7 @@ public function wrapCdata(&$text) public function &getActivatedSubfeeds($fields='', $type='') { $ret = false; - if ($subs =& $this->pHandler->getObjects(new Criteria('subfeed', 1), $fields)) { + if ($subs =& $this->pHandler->getObjects(new \Criteria('subfeed', 1), $fields)) { switch ($type) { default: $ret =& $subs; @@ -310,7 +310,7 @@ public function &getActivatedSubfeeds($fields='', $type='') public function feedSelectBox($caption='', $selected='', $size=1, $multi=true, $none=true, $main=true, $name='feeds', $type='id') { - $select = new XoopsFormSelect($caption, $name, $selected, $size, $multi); + $select = new \XoopsFormSelect($caption, $name, $selected, $size, $multi); if ($none) { $select->addOption(0, '-------'); } @@ -346,9 +346,9 @@ public function subFeedUrl($filename='') public function checkSubFeed(&$feed) { if (!empty($feed['plugin'])) { - $criteria = new CriteriaCompo(); - $criteria->add(new Criteria('rssf_filename', sprintf($this->plugin_file, $feed['plugin']))); - $criteria->add(new Criteria('subfeed', 1)); + $criteria = new \CriteriaCompo(); + $criteria->add(new \Criteria('rssf_filename', sprintf($this->plugin_file, $feed['plugin']))); + $criteria->add(new \Criteria('subfeed', 1)); $sub = $this->pHandler->getObjects($criteria); $handler = false; if (isset($sub[0])) { diff --git a/include/common.php b/include/common.php index 19a4b39e..20ad1d2a 100644 --- a/include/common.php +++ b/include/common.php @@ -41,7 +41,7 @@ } require_once RSSFIT_ROOT_PATH.'class/rssfeed.php'; -require_once RSSFIT_ROOT_PATH.'include/functions.php'; +//require_once RSSFIT_ROOT_PATH.'include/functions.php'; $version = number_format($xoopsModule->getVar('version')/100, 2); $version = !substr($version, -1, 1) ? substr($version, 0, 3) : $version; diff --git a/include/install.php b/include/install.php index 7cebb2cc..8884f380 100644 --- a/include/install.php +++ b/include/install.php @@ -37,21 +37,21 @@ * * @return bool */ -function xoops_module_install_rss(XoopsModule $xoopsMod) +function xoops_module_install_rss(\XoopsModule $xoopsMod) { global $xoopsDB, $xoopsConfig; $myts = \MyTextSanitizer::getInstance(); rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); $intro_setting = ['dohtml' =>1, 'dobr' =>1, 'sub' =>stripslashes(_INSTALL_INTRO_SUB)]; $sql[] = 'INSERT INTO `' - . $xoopsDB->prefix('rssfit_misc') . '` VALUES (1, ' + . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` VALUES (1, ' . $xoopsDB->quoteString('intro') . ', ' . $xoopsDB->quoteString(stripslashes(_INTRO_TITLE)) . ', ' . $xoopsDB->quoteString(stripslashes(_INTRO_CONTENT)) . ', ' . $xoopsDB->quoteString(serialize($intro_setting)) . ')'; $sql[] = rssfInsertChannel($xoopsMod); $sql[] = 'INSERT INTO ' - . $xoopsDB->prefix('rssfit_misc') . ' VALUES ' + . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' =>0, 'dobr' =>0, 'feeds' => [0 =>'0'], 'link' =>XOOPS_URL])) . ')'; foreach ($sql as $s) { if (false === $xoopsDB->query($s)) { @@ -68,24 +68,24 @@ function xoops_module_install_rss(XoopsModule $xoopsMod) * * @return bool */ -function xoops_module_update_rss(XoopsModule $xoopsMod, $oldversion) +function xoops_module_update_rss(\XoopsModule $xoopsMod, $oldversion) { global $xoopsDB, $xoopsConfig; rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); - list($rows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix('rssfit_misc') . " WHERE misc_category = 'channel'")); + list($rows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . " WHERE misc_category = 'channel'")); if (!$rows) { - $sql[] = 'ALTER TABLE `'.$xoopsDB->prefix('rssfit_misc').'` ADD `misc_setting` TEXT NOT NULL;'; - $sql[] = 'ALTER TABLE `'.$xoopsDB->prefix('rssfit_misc').'` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; + $sql[] = 'ALTER TABLE `'.$xoopsDB->prefix($helper->getDirname() . '_misc').'` ADD `misc_setting` TEXT NOT NULL;'; + $sql[] = 'ALTER TABLE `'.$xoopsDB->prefix($helper->getDirname() . '_misc').'` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; $intro_setting = ['dohtml' =>1, 'dobr' =>1, 'sub' =>_INSTALL_INTRO_SUB]; $sql[] = 'UPDATE `' - . $xoopsDB->prefix('rssfit_misc') . '` SET misc_setting = ' + . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` SET misc_setting = ' . $xoopsDB->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; $sql[] = 'ALTER TABLE `' - . $xoopsDB->prefix('rssfit_plugins') . "` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; - $sql[] = 'UPDATE `' . $xoopsDB->prefix('rssfit_plugins') . '` SET sub_entries = 5'; + . $xoopsDB->prefix($helper->getDirname() . '_plugins') . "` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; + $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_plugins') . '` SET sub_entries = 5'; $sql[] = rssfInsertChannel($xoopsMod); $sql[] = 'INSERT INTO ' - . $xoopsDB->prefix('rssfit_misc') . ' VALUES ' + . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' =>0, 'dobr' =>0, 'feeds' => [0 =>'0'], 'link' =>XOOPS_URL])) . ')'; foreach ($sql as $s) { if (false === $xoopsDB->query($s)) { @@ -124,7 +124,7 @@ function rssfInsertChannel(&$xoopsMod) $sitename = $xoopsDB->quoteString($xoopsConfig['sitename']); list($copyright) = $xoopsDB->fetchRow($xoopsDB->query('SELECT conf_value FROM ' . $xoopsDB->prefix('config') . " WHERE conf_name = 'meta_copyright' AND conf_modid = 1 AND conf_catid = " . XOOPS_CONF_METAFOOTER)); - return 'INSERT INTO ' . $xoopsDB->prefix('rssfit_misc') + return 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "('', 'channel', 'title', " . $sitename . ", '')" . ", ('', 'channel', 'link', " . $url . ", '')" . ", ('', 'channel', 'description', " diff --git a/index.php b/index.php index f7cb3d55..6ad5f1c6 100644 --- a/index.php +++ b/index.php @@ -35,7 +35,7 @@ require __DIR__ . '/header.php'; $GLOBALS['xoopsOption']['template_main'] = 'rssfit_index.tpl'; require XOOPS_ROOT_PATH.'/header.php'; -if ($intr = $miscHandler->getObjects(new Criteria('misc_category', 'intro'))) { +if ($intr = $miscHandler->getObjects(new \Criteria('misc_category', 'intro'))) { $intro = $intr[0]; $setting = $intro->getVar('misc_setting'); $intro->setDoHtml($setting['dohtml'] ? 1 : 0); @@ -43,7 +43,7 @@ $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); $content = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_content')); $content = str_replace('{SITEURL}', XOOPS_URL.'/', $content); - if (false !== strpos($content, '{SUB}') && $plugins = $pluginsHandler->getObjects(new Criteria('subfeed', 1))) { + if (false !== strpos($content, '{SUB}') && $plugins = $pluginsHandler->getObjects(new \Criteria('subfeed', 1))) { $sublist = ''; foreach ($plugins as $p) { $sub = $myts->stripSlashesGPC($setting['sub']); diff --git a/plugins/rssfit.adslight.php b/plugins/rssfit.adslight.php index bac5efea..85c1d051 100644 --- a/plugins/rssfit.adslight.php +++ b/plugins/rssfit.adslight.php @@ -70,7 +70,7 @@ public function &grabEntries(&$obj) $i = 0; $sql = 'SELECT lid, title, status, desctext, date from ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid = 'Yes' ORDER BY date DESC"; $result = $xoopsDB->query($sql, $this->grab, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewads.php?lid='.$row['lid']; $ret[$i]['title'] = $row['title']; $ret[$i]['link'] = $link; diff --git a/plugins/rssfit.ams.php b/plugins/rssfit.ams.php index c33259cd..b2635d2c 100644 --- a/plugins/rssfit.ams.php +++ b/plugins/rssfit.ams.php @@ -59,7 +59,7 @@ public function loadModule() public function &grabEntries(&$obj) { $ret = false; - @include_once XOOPS_ROOT_PATH.'/modules/AMS/class/class.newsstory.php'; + @require_once XOOPS_ROOT_PATH.'/modules/AMS/class/class.newsstory.php'; $myts = \MyTextSanitizer::getInstance(); $ams = AmsStory::getAllPublished($this->grab, 0); if (count($ams) > 0) { diff --git a/plugins/rssfit.cbb.php b/plugins/rssfit.cbb.php index 91a23311..79b2943e 100644 --- a/plugins/rssfit.cbb.php +++ b/plugins/rssfit.cbb.php @@ -86,7 +86,7 @@ public function &grabEntries(&$obj) $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; $query = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM '.$xoopsDB->prefix('bb_posts').' p, '.$xoopsDB->prefix('bb_forums').' f, '.$xoopsDB->prefix('bb_topics').' t, '.$xoopsDB->prefix('bb_posts_text').' pt WHERE f.forum_id = p.forum_id AND p.post_id = pt.post_id AND p.topic_id = t.topic_id AND t.approved = 1 AND p.approved = 1 AND f.forum_id = t.forum_id '.$cond.' ORDER BY p.post_time DESC'; $result = $xoopsDB->query($query, $this->grab); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewtopic.php?topic_id='.$row['topic_id'].'&forum='.$row['forum_id'].'&post_id='.$row['post_id'].'#forumpost'.$row['post_id']; $ret[$i]['title'] = $row['subject']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; diff --git a/plugins/rssfit.comments.php b/plugins/rssfit.comments.php index 557f1b6d..fd91d1c1 100644 --- a/plugins/rssfit.comments.php +++ b/plugins/rssfit.comments.php @@ -59,16 +59,16 @@ public function loadModule() public function &grabEntries(&$obj) { $ret = false; - include_once XOOPS_ROOT_PATH.'/include/comment_constants.php'; + require_once XOOPS_ROOT_PATH.'/include/comment_constants.php'; $commentHandler = xoops_getHandler('comment'); - $criteria = new CriteriaCompo(new Criteria('com_status', XOOPS_COMMENT_ACTIVE)); + $criteria = new \CriteriaCompo(new \Criteria('com_status', XOOPS_COMMENT_ACTIVE)); $criteria->setLimit($this->grab); $criteria->setSort('com_created'); $criteria->setOrder('DESC'); $comments = $commentHandler->getObjects($criteria, true); $comment_config = []; if (count($comments) > 0) { - $modules = $GLOBALS['module_handler']->getObjects(new Criteria('hascomments', 1), true); + $modules = $GLOBALS['module_handler']->getObjects(new \Criteria('hascomments', 1), true); foreach (array_keys($comments) as $i) { $mid = $comments[$i]->getVar('com_modid'); if (!isset($comment_config[$mid])) { diff --git a/plugins/rssfit.lexikon.php b/plugins/rssfit.lexikon.php index e2a19437..16b0b679 100644 --- a/plugins/rssfit.lexikon.php +++ b/plugins/rssfit.lexikon.php @@ -73,7 +73,7 @@ public function &grabEntries(&$obj) $sql = 'SELECT entryID, categoryID, term, definition, datesub FROM ' . $xoopsDB->prefix('lxentries') . ' WHERE submit = 0 AND offline = 0 ORDER BY datesub DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { // required $ret[$i]['title'] = $row['term']; $link = XOOPS_URL.'/modules/'.$this->dirname.'/entry.php?entryID='.$row['entryID']; diff --git a/plugins/rssfit.myalbum.php b/plugins/rssfit.myalbum.php index a162b42e..8886a627 100644 --- a/plugins/rssfit.myalbum.php +++ b/plugins/rssfit.myalbum.php @@ -90,9 +90,9 @@ public function myGetUnameFromId($uid) $memberHandler = xoops_getHandler('member'); $thisUser = $memberHandler->getUser($uid); } - $name = htmlspecialchars($thisUser->getVar('name')); + $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); if ('' == $name) { - $name = htmlspecialchars($thisUser->getVar('uname')); + $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); } $lastUid=$uid; $lastName=$name; @@ -114,7 +114,7 @@ public function &grabEntries(&$obj) $sql .= 'WHERE p.status > 0 AND p.cid = c.cid AND p.lid = t.lid '; $sql .= 'ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { $link = XOOPS_URL.'/modules/'.$this->dirname.'/photo.php?lid='.$row['lid']; $thumb = XOOPS_URL.'/uploads/thumbs/'.$row['lid'].'.'.$row['ext']; $name = $this->myGetUnameFromId($row['submitter']); diff --git a/plugins/rssfit.mydownloads.php b/plugins/rssfit.mydownloads.php index d0ae4e2c..fe999467 100644 --- a/plugins/rssfit.mydownloads.php +++ b/plugins/rssfit.mydownloads.php @@ -68,7 +68,7 @@ public function &grabEntries(&$obj) . $xoopsDB->prefix('mydownloads_downloads') . ' l, ' . $xoopsDB->prefix('mydownloads_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { $ret[$i]['title'] = $row['title']; $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlefile.php?cid='.$row['cid'].'&lid='.$row['lid']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; diff --git a/plugins/rssfit.mylinks.php b/plugins/rssfit.mylinks.php index 24a437d7..f7a552b9 100644 --- a/plugins/rssfit.mylinks.php +++ b/plugins/rssfit.mylinks.php @@ -66,7 +66,7 @@ public function &grabEntries(&$obj) . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { $ret[$i]['title'] = $row['title']; $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?cid='.$row['cid'].'&lid='.$row['lid']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; diff --git a/plugins/rssfit.mytube.php b/plugins/rssfit.mytube.php index e420da54..6f20c452 100644 --- a/plugins/rssfit.mytube.php +++ b/plugins/rssfit.mytube.php @@ -72,7 +72,7 @@ public function &grabEntries(&$obj) . $xoopsDB-> prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; $result = $xoopsDB -> query($sql, $this -> grab, 0); - while ($row = $xoopsDB -> fetchArray($result)) { + while (false !== ($row = $xoopsDB -> fetchArray($result))) { $ret[$i]['title'] = $row['ltitle']; $link = XOOPS_URL . '/modules/' . $this -> dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; diff --git a/plugins/rssfit.newbb.php b/plugins/rssfit.newbb.php index 774f0149..2c92ec72 100644 --- a/plugins/rssfit.newbb.php +++ b/plugins/rssfit.newbb.php @@ -62,7 +62,7 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - include_once XOOPS_ROOT_PATH.'/modules/'.$this->dirname.'/class/class.forumposts.php'; + require_once XOOPS_ROOT_PATH.'/modules/'.$this->dirname.'/class/class.forumposts.php'; $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; @@ -70,7 +70,7 @@ public function &grabEntries(&$obj) if (!$result = $xoopsDB->query($sql, $this->grab, 0)) { return $ret; } - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewtopic.php?topic_id='.$row['topic_id'].'&forum='.$row['forum_id'].'&post_id='.$row['post_id'].'#forumpost'.$row['post_id']; $ret[$i]['title'] = $row['subject']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; diff --git a/plugins/rssfit.newbb2.php b/plugins/rssfit.newbb2.php index 0e5ea598..7927b846 100644 --- a/plugins/rssfit.newbb2.php +++ b/plugins/rssfit.newbb2.php @@ -76,9 +76,9 @@ public function myGetUnameFromId($uid) $memberHandler = xoops_getHandler('member'); $thisUser = $memberHandler->getUser($uid); } - $name = htmlspecialchars($thisUser->getVar('name')); + $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); if ('' == $name) { - $name = htmlspecialchars($thisUser->getVar('uname')); + $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); } $lastUid=$uid; $lastName=$name; @@ -114,7 +114,7 @@ public function &grabEntries(&$obj) $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; $query = 'SELECT p.uid, p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM '.$xoopsDB->prefix('bb_posts').' p, '.$xoopsDB->prefix('bb_forums').' f, '.$xoopsDB->prefix('bb_topics').' t, '.$xoopsDB->prefix('bb_posts_text').' pt WHERE f.forum_id = p.forum_id AND p.post_id = pt.post_id AND p.topic_id = t.topic_id AND t.approved = 1 AND p.approved = 1 AND f.forum_id = t.forum_id '.$cond.' ORDER BY p.post_time DESC'; $result = $xoopsDB->query($query, $this->grab); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewtopic.php?topic_id='.$row['topic_id'].'&forum='.$row['forum_id'].'&post_id='.$row['post_id'].'#forumpost'.$row['post_id']; $ret[$i]['title'] = $this->modname . ': ' . $row['subject']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; diff --git a/plugins/rssfit.news.php b/plugins/rssfit.news.php index f612fcc5..1a1d5b41 100644 --- a/plugins/rssfit.news.php +++ b/plugins/rssfit.news.php @@ -60,10 +60,10 @@ public function loadModule() public function &grabEntries(&$obj) { $ret = false; - @include_once XOOPS_ROOT_PATH.'/modules/news/class/class.newsstory.php'; + @require_once XOOPS_ROOT_PATH.'/modules/news/class/class.newsstory.php'; $myts = \MyTextSanitizer::getInstance(); if ($this->module->getVar('version') >= 130) { - @include_once XOOPS_ROOT_PATH.'/modules/news/include/functions.php'; + @require_once XOOPS_ROOT_PATH.'/modules/news/include/functions.php'; $news = NewsStory::getAllPublished($this->grab, 0, getmoduleoption('restrictindex')); } else { $news = NewsStory::getAllPublished($this->grab, 0); diff --git a/plugins/rssfit.pical.php b/plugins/rssfit.pical.php index e1de49d1..66ce944d 100644 --- a/plugins/rssfit.pical.php +++ b/plugins/rssfit.pical.php @@ -70,7 +70,7 @@ public function &grabEntries(&$obj) $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' . $xoopsDB->prefix('pical_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { $ret[$i]['title'] = $row['summary']; $link = XOOPS_URL.'/modules/'.$this->dirname.'/index.php?event_id='.$row['id']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; diff --git a/plugins/rssfit.pluginsample.php b/plugins/rssfit.pluginsample.php index 5781d4f6..414a4396 100644 --- a/plugins/rssfit.pluginsample.php +++ b/plugins/rssfit.pluginsample.php @@ -87,7 +87,7 @@ public function &grabEntries(&$obj) . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?cid='.$row['cid'].'&lid='.$row['lid']; /* * Required elements of an RSS item diff --git a/plugins/rssfit.queries.php b/plugins/rssfit.queries.php index 8363b707..f362cd04 100644 --- a/plugins/rssfit.queries.php +++ b/plugins/rssfit.queries.php @@ -76,7 +76,7 @@ public function &grabEntries(&$obj) $sql.= ' WHERE approved=1 ORDER BY posted DESC '; $result = $xoopsDB->query($sql, $limit, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { ++$i; if ($i<=$this->grab) { $desc=$row['querytext']; diff --git a/plugins/rssfit.rmdp.php b/plugins/rssfit.rmdp.php index c85e2125..f46bccf7 100644 --- a/plugins/rssfit.rmdp.php +++ b/plugins/rssfit.rmdp.php @@ -70,7 +70,7 @@ public function grabEntries(&$obj) $i = 0; $sql = 'SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ' . $xoopsDB->prefix('rmdp_software') . ' ORDER BY fecha DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { $ret[$i]['title'] = $row['nombre']; $link = XOOPS_URL.'/modules/'.$this->dirname.'/down.php?id='.$row['id_soft']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; diff --git a/plugins/rssfit.smartfaq.php b/plugins/rssfit.smartfaq.php index 02b408f8..c50e7633 100644 --- a/plugins/rssfit.smartfaq.php +++ b/plugins/rssfit.smartfaq.php @@ -59,11 +59,14 @@ public function loadModule() public function &grabEntries(&$obj) { $ret = false; - @include_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; - $faqHandler = sf_gethandler('faq'); - $faqs = $faqHandler->getAllPublished($this->grab, 0); + @require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; + + /** @var \XoopsModules\Smartfaq\FaqHandler $faqHandler */ + $faqHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Faq'); + $faqs = $faqHandler->getAllPublished($this->grab, 0); if (false !== $faqs && count($faqs) > 0) { - $answerHandler = sf_gethandler('answer'); + /** @var \XoopsModules\Smartfaq\AnswerHandler $answerHandler */ + $answerHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Answer'); for ($i=0, $iMax = count($faqs); $i < $iMax; $i++) { if (!$answer = $answerHandler->getOfficialAnswer($faqs[$i]->faqid())) { continue; diff --git a/plugins/rssfit.special.php b/plugins/rssfit.special.php index 8e6aa9a2..62f959fa 100644 --- a/plugins/rssfit.special.php +++ b/plugins/rssfit.special.php @@ -80,7 +80,7 @@ public function &grabEntries(&$obj) { global $xoopsDB; $ret = []; - @include_once XOOPS_ROOT_PATH.'/modules/special/class/stuff.php'; + @require_once XOOPS_ROOT_PATH.'/modules/special/class/stuff.php'; $myts = \MyTextSanitizer::getInstance(); $items = SpecialStuff::getAllPublished($this->grab, 0); foreach ($items as $item) { diff --git a/plugins/rssfit.surnames.php b/plugins/rssfit.surnames.php index 2b325d05..9b8fb772 100644 --- a/plugins/rssfit.surnames.php +++ b/plugins/rssfit.surnames.php @@ -75,9 +75,9 @@ public function myGetUnameFromId($uid) $memberHandler = xoops_getHandler('member'); $thisUser = $memberHandler->getUser($uid); } - $name = htmlspecialchars($thisUser->getVar('name')); + $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); if ('' == $name) { - $name = htmlspecialchars($thisUser->getVar('uname')); + $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); } $lastUid=$uid; $lastName=$name; @@ -98,7 +98,7 @@ public function &grabEntries(&$obj) $sql = "SELECT uid, id, surname, notes, DATE_FORMAT(changed_ts,'%Y-%m-%d') as changedate FROM ".$xoopsDB->prefix('surnames'); $sql .= ' WHERE approved=1 ORDER BY changedate DESC, uid '; $result = $xoopsDB->query($sql, $limit, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { $changedate=strtotime($row['changedate']); $uid=$row['uid']; if ($lasttime==$changedate && $lastuser==$uid) { diff --git a/plugins/rssfit.weblinks.php b/plugins/rssfit.weblinks.php index ea350a31..2f70188b 100644 --- a/plugins/rssfit.weblinks.php +++ b/plugins/rssfit.weblinks.php @@ -70,9 +70,9 @@ public function myGetUnameFromId($uid) $memberHandler = xoops_getHandler('member'); $thisUser = $memberHandler->getUser($uid); } - $name = htmlspecialchars($thisUser->getVar('name')); + $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); if ('' == $name) { - $name = htmlspecialchars($thisUser->getVar('uname')); + $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); } $lastUid=$uid; $lastName=$name; @@ -87,7 +87,7 @@ public function &grabEntries(&$obj) $i = 0; $sql = 'SELECT lid, title, time_update, description, url, uid FROM ' . $xoopsDB->prefix('weblinks_link') . ' ORDER BY time_update DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { $title=$row['title']; $name = $this->myGetUnameFromId($row['uid']); $ret[$i]['title'] = $this->modname . ': ' . $title; diff --git a/plugins/rssfit.wfdownloads.php b/plugins/rssfit.wfdownloads.php index d2ad8ec3..14e8c952 100644 --- a/plugins/rssfit.wfdownloads.php +++ b/plugins/rssfit.wfdownloads.php @@ -68,7 +68,7 @@ public function &grabEntries(&$obj) $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { if ($permHandler->checkRight('WFDownFilePerm', $row['lid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { $ret[$i]['title'] = $row['title']; $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlefile.php?cid='.$row['cid'].'&lid='.$row['lid']; diff --git a/plugins/rssfit.wfdownloads_podcast.php b/plugins/rssfit.wfdownloads_podcast.php index 0f1729aa..0b5873c7 100644 --- a/plugins/rssfit.wfdownloads_podcast.php +++ b/plugins/rssfit.wfdownloads_podcast.php @@ -70,7 +70,7 @@ public function &grabEntries(&$obj) . time() . ' OR expired = 0) AND published <= ' . time() . ' ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { if ((isset($perms[$row['cid']]) && true === $perms[$row['cid']]) || $permHandler->checkRight('WFDownCatPerm', $row['cid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { $perms[$row['cid']] = true; $ret[$i]['title'] = $row['title']; diff --git a/plugins/rssfit.wflinks.php b/plugins/rssfit.wflinks.php index 014904db..1688ca53 100644 --- a/plugins/rssfit.wflinks.php +++ b/plugins/rssfit.wflinks.php @@ -51,7 +51,7 @@ public function grabEntries(&$obj) $i = 0; $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { if ($gpermHandler -> checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { // required $ret[$i]['title'] = $row['title']; diff --git a/plugins/rssfit.wfsection.php b/plugins/rssfit.wfsection.php index 51a8abea..2b853182 100644 --- a/plugins/rssfit.wfsection.php +++ b/plugins/rssfit.wfsection.php @@ -61,7 +61,7 @@ public function loadModule() public function &grabEntries(&$obj) { - @include_once XOOPS_ROOT_PATH.'/modules/wfsection/include/groupaccess.php'; + @require_once XOOPS_ROOT_PATH.'/modules/wfsection/include/groupaccess.php'; global $xoopsDB; $ret = false; $i = 0; @@ -72,7 +72,7 @@ public function &grabEntries(&$obj) . time() . ') AND a.noshowart = 0 AND a.offline = 0 AND a.categoryid = b.id ORDER BY published DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { if (checkAccess($row['groupid'])) { $link = XOOPS_URL.'/modules/'.$this->dirname.'/article.php?articleid='.$row['articleid']; $ret[$i]['title'] = $row['atitle']; diff --git a/plugins/rssfit.wfsection2.php b/plugins/rssfit.wfsection2.php index b40a1ef0..50d5e933 100644 --- a/plugins/rssfit.wfsection2.php +++ b/plugins/rssfit.wfsection2.php @@ -37,6 +37,10 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ +use XoopsModules\Rssfit; +/** @var Rssfit\Helper $helper */ +$helper = Rssfit\Helper::getInstance(); + if (!defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -58,12 +62,12 @@ public function loadModule() public function &grabEntries(&$obj) { - @include_once XOOPS_ROOT_PATH.'/modules/wfsection/class/common.php'; - @include_once XOOPS_ROOT_PATH.'/modules/wfsection/class/wfsarticle.php'; + @require_once XOOPS_ROOT_PATH.'/modules/wfsection/class/common.php'; + @require_once XOOPS_ROOT_PATH.'/modules/wfsection/class/wfsarticle.php'; $ret = false; $articles = WfsArticle::getAllArticle($this->grab, 0, 'online'); if (count($articles) > 0) { - $xoopsModuleConfig['shortartlen'] = 0; + $helper->getConfig('shortartlen') = 0; $myts = \MyTextSanitizer::getInstance(); for ($i=0, $iMax = count($articles); $i < $iMax; $i++) { $link = XOOPS_URL.'/modules/wfsection/article.php?articleid='.$articles[$i]->articleid(); diff --git a/plugins/rssfit.xoopstube.php b/plugins/rssfit.xoopstube.php index 815e3fdd..4527230f 100644 --- a/plugins/rssfit.xoopstube.php +++ b/plugins/rssfit.xoopstube.php @@ -72,7 +72,7 @@ public function &grabEntries(&$obj) . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while ($row = $xoopsDB->fetchArray($result)) { + while (false !== ($row = $xoopsDB->fetchArray($result))) { $ret[$i]['title'] = $row['ltitle']; $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlevideo.php?cid='.$row['cid'].'&lid='.$row['lid']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; diff --git a/rss.php b/rss.php index b4eec396..3e64d922 100644 --- a/rss.php +++ b/rss.php @@ -31,14 +31,19 @@ ## URL: http://www.brandycoke.com/ ## ## Project: RSSFit ## ############################################################################### + +use XoopsModules\Rss; +/** @var Rss\Helper $helper */ +$helper = Rss\Helper::getInstance(); + if (function_exists('mb_http_output')) { mb_http_output('pass'); } require __DIR__ . '/header.php'; -$charset = $xoopsModuleConfig['utf8'] ? 'UTF-8' : _CHARSET; -$docache = $xoopsModuleConfig['cache'] ? true : false; +$charset = $helper->getConfig('utf8') ? 'UTF-8' : _CHARSET; +$docache = $helper->getConfig('cache') ? true : false; $template = 'db:rssfit_rss.tpl'; -if (3 == $xoopsModuleConfig['mime']) { +if (3 == $helper->getConfig('mime')) { $xoopsLogger->enableRendering(); $xoopsLogger->usePopup = (2 == $xoopsConfig['debug_mode']); $docache = false; @@ -48,12 +53,12 @@ } require_once XOOPS_ROOT_PATH.'/class/template.php'; -$xoopsTpl = new XoopsTpl(); +$xoopsTpl = new \XoopsTpl(); if (!$docache) { - $xoopsTpl->xoops_setCaching(0); + $xoopsTpl->caching=(0); } else { - $xoopsTpl->xoops_setCaching(2); - $xoopsTpl->xoops_setCacheTime($xoopsModuleConfig['cache']*60); + $xoopsTpl->caching=(2); + $xoopsTpl->xoops_setCacheTime($helper->getConfig('cache')*60); } $feed = []; @@ -65,7 +70,7 @@ $xoopsTpl->assign('feed', $feed); } -switch ($xoopsModuleConfig['mime']) { +switch ($helper->getConfig('mime')) { default: header('Content-Type:text/xml; charset=' . $charset); break; @@ -75,7 +80,7 @@ break; } -# if( $xoopsModuleConfig['mime'] == 3 ){ +# if( $helper->getConfig('mime') == 3 ){ # $src = $xoopsTpl->fetch($template, $rss->cached, null); # unset($xoopsOption['template_main']); # require XOOPS_ROOT_PATH.'/header.php'; @@ -83,7 +88,7 @@ # require XOOPS_ROOT_PATH.'/footer.php'; # } -if (function_exists('mb_convert_encoding') && $xoopsModuleConfig['utf8']) { +if (function_exists('mb_convert_encoding') && $helper->getConfig('utf8')) { echo mb_convert_encoding($xoopsTpl->fetch($template, $rss->cached, null), 'UTF-8', _CHARSET); } else { $xoopsTpl->display($template, $rss->cached); diff --git a/testdata/index.php b/testdata/index.php index 0e4d5972..cef7fcf6 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -8,7 +8,7 @@ * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * - * @copyright The XOOPS Project http://sourceforge.net/projects/xoops/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @package * @since 2.5.9 diff --git a/xoops_version.php b/xoops_version.php index 4c270a39..06e86fdd 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -28,7 +28,9 @@ ## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## ############################################################################### -defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); +defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); + +require_once __DIR__ . '/preloads/autoloader.php'; $moduleDirName = basename(__DIR__); @@ -36,7 +38,7 @@ $modversion = [ 'version' => 1.31, 'module_status' => 'Beta 2', - 'release_date' => '2017/10/27', + 'release_date' => '2017/12/20', 'name' => _MI_RSSFIT_NAME, 'description' => _MI_RSSFIT_DESC, 'official' => 0, @@ -98,10 +100,8 @@ 'sqlfile' => ['mysql' => 'sql/mysql.sql'], // ------------------- Tables ---------------------------- 'tables' => [ - // $moduleDirName . '_' . 'XXX', - // $moduleDirName . '_' . 'XXX', - 'rssfit_plugins', - 'rssfit_misc', + $moduleDirName . '_' . 'plugins', + $moduleDirName . '_' . 'misc', ], ]; @@ -125,7 +125,7 @@ ]; // Module Configs -// $xoopsModuleConfig['overall_entries'] +// $helper->getConfig('overall_entries') $modversion['config'][] = [ 'name' => 'overall_entries', @@ -136,7 +136,7 @@ 'default' => 20, ]; -// $xoopsModuleConfig['plugin_entries'] +// $helper->getConfig('plugin_entries') $modversion['config'][] = [ 'name' => 'plugin_entries', 'title' => '_MI_PLUGIN_ENTRIES', @@ -146,7 +146,7 @@ 'default' => 5, ]; -// $xoopsModuleConfig['sort'] +// $helper->getConfig('sort') $modversion['config'][] = [ 'name' => 'sort', 'title' => '_MI_ENTRIES_SORT', @@ -157,7 +157,7 @@ 'options' => [_MI_ENTRIES_SORT_DATE => 'd', _MI_ENTRIES_SORT_CAT => 'c'], ]; -// $xoopsModuleConfig['cache'] +// $helper->getConfig('cache') $modversion['config'][] = [ 'name' => 'cache', 'title' => '_MI_CACHE', @@ -167,7 +167,7 @@ 'default' => 0, ]; -// $xoopsModuleConfig['max_char'] +// $helper->getConfig('max_char') $modversion['config'][] = [ 'name' => 'max_char', 'title' => '_MI_MAXCHAR', @@ -177,7 +177,7 @@ 'default' => 0, ]; -// $xoopsModuleConfig['strip_html'] +// $helper->getConfig('strip_html') $modversion['config'][] = [ 'name' => 'strip_html', 'title' => '_MI_STRIPHTML', @@ -187,7 +187,7 @@ 'default' => 0, ]; -// $xoopsModuleConfig['utf8'] +// $helper->getConfig('utf8') $modversion['config'][] = [ 'name' => 'utf8', 'title' => '_MI_ENCODE_UTF8', @@ -197,7 +197,7 @@ 'default' => 0, ]; -// $xoopsModuleConfig['mime'] +// $helper->getConfig('mime') $modversion['config'][] = [ 'name' => 'mime', 'title' => '_MI_OUTOUT_MIME', From 9f71edd49d485aa02cf76bff19568e812e6eb3fd Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 31 Mar 2018 04:07:37 -0400 Subject: [PATCH 045/154] Request:: Signed-off-by: mambax7 --- admin/do_subfeeds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index 4ca6c0d1..d73e63fc 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -100,7 +100,7 @@ } break; case 'edit': - $id = isset($_GET['feed']) ? (int)$_GET['feed'] : 0; + $id = \Xmf\Request::getInt('feed', 0, 'GET'); if (!empty($id)) { $sub = $pluginsHandler->get($id); if (!$handler = $pluginsHandler->checkPlugin($sub)) { From 405252171c0869e7bcb5b074f30f25b62ac82fcb Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 4 Apr 2018 08:13:46 -0400 Subject: [PATCH 046/154] updates Signed-off-by: mambax7 --- admin/admin_header.php | 4 +++- plugins/rssfit.wflinks.php | 4 ++-- rss.php | 5 +++-- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/admin/admin_header.php b/admin/admin_header.php index b7c0201d..a62e31fe 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -9,6 +9,8 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +use Xmf\Module\Admin; + /** * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) @@ -22,7 +24,7 @@ require_once $path . '/include/cp_functions.php'; require_once $path . '/include/cp_header.php'; -class_exists('\Xmf\Module\Admin') || exit('XMF is required.'); +class_exists(Admin::class) || exit('XMF is required.'); global $xoopsModule; diff --git a/plugins/rssfit.wflinks.php b/plugins/rssfit.wflinks.php index 1688ca53..24065822 100644 --- a/plugins/rssfit.wflinks.php +++ b/plugins/rssfit.wflinks.php @@ -44,7 +44,7 @@ public function grabEntries(&$obj) global $xoopsDB, $xoopsUser; $groups = is_object($xoopsUser) ? $xoopsUser -> getGroups() : XOOPS_GROUP_ANONYMOUS; - $gpermHandler = xoops_getHandler('groupperm'); + $grouppermHandler = xoops_getHandler('groupperm'); $myts = \MyTextSanitizer::getInstance(); $ret = []; @@ -52,7 +52,7 @@ public function grabEntries(&$obj) $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - if ($gpermHandler -> checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { + if ($grouppermHandler -> checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { // required $ret[$i]['title'] = $row['title']; $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?cid='.$row['cid'].'&lid='.$row['lid']; diff --git a/rss.php b/rss.php index 3e64d922..a4e212ff 100644 --- a/rss.php +++ b/rss.php @@ -33,13 +33,14 @@ ############################################################################### use XoopsModules\Rss; -/** @var Rss\Helper $helper */ -$helper = Rss\Helper::getInstance(); if (function_exists('mb_http_output')) { mb_http_output('pass'); } require __DIR__ . '/header.php'; +/** @var Rss\Helper $helper */ +$helper = Rss\Helper::getInstance(); + $charset = $helper->getConfig('utf8') ? 'UTF-8' : _CHARSET; $docache = $helper->getConfig('cache') ? true : false; $template = 'db:rssfit_rss.tpl'; From a0cd675ae43b2fc30ce8158a99d5594c9bbebb66 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Fri, 6 Apr 2018 12:01:20 -0400 Subject: [PATCH 047/154] Request:: Signed-off-by: mambax7 --- class/misc.php | 2 +- class/plugins.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/class/misc.php b/class/misc.php index 49f5c22b..e0044468 100644 --- a/class/misc.php +++ b/class/misc.php @@ -91,7 +91,7 @@ public function create() public function get($id, $fields='*') { $criteria = new \Criteria($this->obj_key, (int)$id); - if ($objs =& $this->getObjects($criteria)) { + if ($objs = $this->getObjects($criteria)) { return 1 != count($objs) ? false : $objs[0]; } return false; diff --git a/class/plugins.php b/class/plugins.php index 06b89ad1..4f7bb8f6 100644 --- a/class/plugins.php +++ b/class/plugins.php @@ -90,7 +90,7 @@ public function get($id, $fields='*') { $ret = false; $criteria = new \Criteria($this->obj_key, (int)$id); - if ($objs =& $this->getObjects($criteria) && 1 === count($objs)) { + if ($objs = $this->getObjects($criteria) && 1 === count($objs)) { $ret =& $objs[0]; } return $ret; @@ -262,7 +262,7 @@ public function forceDeactivate(&$obj, $type='rssf_activated') public function &getPluginFileList() { $ret = false; - if ($objs =& $this->getObjects(null, 'rssf_filename')) { + if ($objs = $this->getObjects(null, 'rssf_filename')) { foreach ($objs as $o) { $ret[] = $o->getVar('rssf_filename'); } From 8d567b1bb25d08d82eb39a8be39890260a8f5163 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 7 Apr 2018 23:50:59 -0400 Subject: [PATCH 048/154] cosmetics --- class/Common/Breadcrumb.php | 78 +++++++ class/Common/Configurator.php | 61 +++++ class/Common/FilesManagement.php | 244 ++++++++++++++++++++ class/Common/ServerStats.php | 76 ++++++ class/Common/VersionChecks.php | 76 ++++++ class/Common/index.html | 1 + class/Helper.php | 78 +++++++ class/Utility.php | 72 ++++++ class/plugins.php | 2 +- include/config.php | 80 +++++++ include/oninstall.php | 105 +++++++++ include/onuninstall.php | 79 +++++++ include/onupdate.php | 153 ++++++++++++ language/english/common.php | 71 ++++++ plugins/rssfit.adslight.php | 2 +- plugins/rssfit.ams.php | 2 +- plugins/rssfit.buyersguide.php | 2 +- plugins/rssfit.buyersguidemanufacturers.php | 2 +- plugins/rssfit.buyersguidenews.php | 2 +- plugins/rssfit.cbb.php | 4 +- plugins/rssfit.comments.php | 4 +- plugins/rssfit.extcal.php | 2 +- plugins/rssfit.lexikon.php | 4 +- plugins/rssfit.myalbum.php | 2 +- plugins/rssfit.mydownloads.php | 2 +- plugins/rssfit.mylinks.php | 2 +- plugins/rssfit.mytube.php | 2 +- plugins/rssfit.newbb.php | 2 +- plugins/rssfit.newbb2.php | 6 +- plugins/rssfit.news.php | 2 +- plugins/rssfit.oledrion.php | 2 +- plugins/rssfit.pical.php | 2 +- plugins/rssfit.pluginsample.php | 2 +- plugins/rssfit.publisher.php | 2 +- plugins/rssfit.queries.php | 2 +- plugins/rssfit.rmdp.php | 6 +- plugins/rssfit.smartfaq.php | 2 +- plugins/rssfit.smartpartner.php | 4 +- plugins/rssfit.smartsection.php | 4 +- plugins/rssfit.special.php | 2 +- plugins/rssfit.surnames.php | 2 +- plugins/rssfit.weblinks.php | 2 +- plugins/rssfit.wfdownloads.php | 4 +- plugins/rssfit.wfdownloads_podcast.php | 4 +- plugins/rssfit.wflinks.php | 4 +- plugins/rssfit.wfsection.php | 2 +- plugins/rssfit.wfsection2.php | 2 +- plugins/rssfit.xoopstube.php | 2 +- preloads/autoloader.php | 32 +++ preloads/core.php | 33 +++ preloads/index.html | 1 + 51 files changed, 1287 insertions(+), 47 deletions(-) create mode 100644 class/Common/Breadcrumb.php create mode 100644 class/Common/Configurator.php create mode 100644 class/Common/FilesManagement.php create mode 100644 class/Common/ServerStats.php create mode 100644 class/Common/VersionChecks.php create mode 100644 class/Common/index.html create mode 100644 class/Helper.php create mode 100644 class/Utility.php create mode 100644 include/config.php create mode 100644 include/oninstall.php create mode 100644 include/onuninstall.php create mode 100644 include/onupdate.php create mode 100644 language/english/common.php create mode 100644 preloads/autoloader.php create mode 100644 preloads/core.php create mode 100644 preloads/index.html diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php new file mode 100644 index 00000000..afb9e97a --- /dev/null +++ b/class/Common/Breadcrumb.php @@ -0,0 +1,78 @@ + + * @package rss + * + * Example: + * $breadcrumb = new PedigreeBreadcrumb(); + * $breadcrumb->addLink( 'bread 1', 'index1.php' ); + * $breadcrumb->addLink( 'bread 2', '' ); + * $breadcrumb->addLink( 'bread 3', 'index3.php' ); + * echo $breadcrumb->render(); + */ +defined('XOOPS_ROOT_PATH') || die('XOOPS Root Path not defined'); + +/** + * Class Breadcrumb + */ +class Breadcrumb +{ + public $dirname; + private $bread = []; + + /** + * + */ + public function __construct() + { + $this->dirname = basename(dirname(__DIR__)); + } + + /** + * Add link to breadcrumb + * + * @param string $title + * @param string $link + */ + public function addLink($title = '', $link = '') + { + $this->bread[] = [ + 'link' => $link, + 'title' => $title + ]; + } + + /** + * Render Pedigree BreadCrumb + * + */ + public function render() + { + if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { + require_once $GLOBALS['xoops']->path('class/theme.php'); + $GLOBALS['xoTheme'] = new \xos_opal_Theme(); + } + + require_once $GLOBALS['xoops']->path('class/template.php'); + $breadcrumbTpl = new \XoopsTpl(); + $breadcrumbTpl->assign('breadcrumb', $this->bread); + $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); + unset($breadcrumbTpl); + + return $html; + } +} diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php new file mode 100644 index 00000000..0757b577 --- /dev/null +++ b/class/Common/Configurator.php @@ -0,0 +1,61 @@ +name = $config->name; + $this->paths = $config->paths; + $this->uploadFolders = $config->uploadFolders; + $this->copyBlankFiles = $config->copyBlankFiles; + $this->copyTestFolders = $config->copyTestFolders; + $this->templateFolders = $config->templateFolders; + $this->oldFiles = $config->oldFiles; + $this->oldFolders = $config->oldFolders; + $this->modCopyright = $config->modCopyright; + } +} diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php new file mode 100644 index 00000000..1cb0c87e --- /dev/null +++ b/class/Common/FilesManagement.php @@ -0,0 +1,244 @@ + + */ +trait FilesManagement +{ + /** + * Function responsible for checking if a directory exists, we can also write in and create an index.html file + * + * @param string $folder The full path of the directory to check + * + * @return void + */ + public static function createFolder($folder) + { + try { + if (!file_exists($folder)) { + if (!is_dir($folder) && !mkdir($folder) && !is_dir($folder)) { + throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); + } + + file_put_contents($folder . '/index.html', ''); + } + } catch (\Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n", '
'; + } + } + + /** + * @param $file + * @param $folder + * @return bool + */ + public static function copyFile($file, $folder) + { + return copy($file, $folder); + } + + /** + * @param $src + * @param $dst + */ + public static function recurseCopy($src, $dst) + { + $dir = opendir($src); + // @mkdir($dst); + if (!mkdir($dst) && !is_dir($dst)) { + while (false !== ($file = readdir($dir))) { + if (('.' !== $file) && ('..' !== $file)) { + if (is_dir($src . '/' . $file)) { + self::recurseCopy($src . '/' . $file, $dst . '/' . $file); + } else { + copy($src . '/' . $file, $dst . '/' . $file); + } + } + } + } + closedir($dir); + } + + /** + * + * Remove files and (sub)directories + * + * @param string $src source directory to delete + * + * @uses \Xmf\Module\Helper::getHelper() + * @uses \Xmf\Module\Helper::isUserAdmin() + * + * @return bool true on success + */ + public static function deleteDirectory($src) + { + // Only continue if user is a 'global' Admin + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + return false; + } + + $success = true; + // remove old files + $dirInfo = new \SplFileInfo($src); + // validate is a directory + if ($dirInfo->isDir()) { + $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); + foreach ($fileList as $k => $v) { + $fileInfo = new \SplFileInfo("{$src}/{$v}"); + if ($fileInfo->isDir()) { + // recursively handle subdirectories + if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { + break; + } + } else { + // delete the file + if (!($success = unlink($fileInfo->getRealPath()))) { + break; + } + } + } + // now delete this (sub)directory if all the files are gone + if ($success) { + $success = rmdir($dirInfo->getRealPath()); + } + } else { + // input is not a valid directory + $success = false; + } + return $success; + } + + /** + * + * Recursively remove directory + * + * @todo currently won't remove directories with hidden files, should it? + * + * @param string $src directory to remove (delete) + * + * @return bool true on success + */ + public static function rrmdir($src) + { + // Only continue if user is a 'global' Admin + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + return false; + } + + // If source is not a directory stop processing + if (!is_dir($src)) { + return false; + } + + $success = true; + + // Open the source directory to read in files + $iterator = new \DirectoryIterator($src); + foreach ($iterator as $fObj) { + if ($fObj->isFile()) { + $filename = $fObj->getPathname(); + $fObj = null; // clear this iterator object to close the file + if (!unlink($filename)) { + return false; // couldn't delete the file + } + } elseif (!$fObj->isDot() && $fObj->isDir()) { + // Try recursively on directory + self::rrmdir($fObj->getPathname()); + } + } + $iterator = null; // clear iterator Obj to close file/directory + return rmdir($src); // remove the directory & return results + } + + /** + * Recursively move files from one directory to another + * + * @param string $src - Source of files being moved + * @param string $dest - Destination of files being moved + * + * @return bool true on success + */ + public static function rmove($src, $dest) + { + // Only continue if user is a 'global' Admin + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + return false; + } + + // If source is not a directory stop processing + if (!is_dir($src)) { + return false; + } + + // If the destination directory does not exist and could not be created stop processing + if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { + return false; + } + + // Open the source directory to read in files + $iterator = new \DirectoryIterator($src); + foreach ($iterator as $fObj) { + if ($fObj->isFile()) { + rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); + } elseif (!$fObj->isDot() && $fObj->isDir()) { + // Try recursively on directory + self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); + // rmdir($fObj->getPath()); // now delete the directory + } + } + $iterator = null; // clear iterator Obj to close file/directory + return rmdir($src); // remove the directory & return results + } + + /** + * Recursively copy directories and files from one directory to another + * + * @param string $src - Source of files being moved + * @param string $dest - Destination of files being moved + * + * @uses \Xmf\Module\Helper::getHelper() + * @uses \Xmf\Module\Helper::isUserAdmin() + * + * @return bool true on success + */ + public static function rcopy($src, $dest) + { + // Only continue if user is a 'global' Admin + if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { + return false; + } + + // If source is not a directory stop processing + if (!is_dir($src)) { + return false; + } + + // If the destination directory does not exist and could not be created stop processing + if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { + return false; + } + + // Open the source directory to read in files + $iterator = new \DirectoryIterator($src); + foreach ($iterator as $fObj) { + if ($fObj->isFile()) { + copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); + } elseif (!$fObj->isDot() && $fObj->isDir()) { + self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); + } + } + return true; + } +} diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php new file mode 100644 index 00000000..5c61fb19 --- /dev/null +++ b/class/Common/ServerStats.php @@ -0,0 +1,76 @@ + + */ +trait ServerStats +{ + /** + * serverStats() + * + * @return string + */ + public static function getServerStats() + { + //mb $wfdownloads = WfdownloadsWfdownloads::getInstance(); + $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirNameUpper = strtoupper($moduleDirName); + xoops_loadLanguage('common', $moduleDirName); + $html = ''; + // $sql = 'SELECT metavalue'; + // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); + // $sql .= " WHERE metakey='version' LIMIT 1"; + // $query = $GLOBALS['xoopsDB']->query($sql); + // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); + $html .= "
" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "\n"; + $html .= "
\n"; + // $html .= '
' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
\n"; + // $html .= "
\n"; + // $html .= "
\n"; + $html .= '
' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "
\n"; + $html .= "
    \n"; + // + $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; + if (function_exists('gd_info')) { + if (true === ($gdlib = gd_info())) { + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; + } + } + // + // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); + // $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; + // + // $registerglobals = (!ini_get('register_globals')) ? "" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . constant('CO_' . $moduleDirNameUpper . '_ON') . ''; + // $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; + // + $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; + // + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . "\n"; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . "\n"; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . "\n"; + $html .= "
\n"; + $html .= "
    \n"; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . "\n"; + $html .= "
\n"; + $html .= "
\n"; + $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; + $html .= '
'; + $html .= '

'; + + return $html; + } +} diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php new file mode 100644 index 00000000..a7e69c41 --- /dev/null +++ b/class/Common/VersionChecks.php @@ -0,0 +1,76 @@ + + */ +trait VersionChecks +{ + /** + * + * Verifies XOOPS version meets minimum requirements for this module + * @static + * @param \XoopsModule $module + * + * @param null|string $requiredVer + * @return bool true if meets requirements, false if not + */ + public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) + { + $moduleDirName = basename(dirname(dirname(__DIR__))); + if (null === $module) { + $module = \XoopsModule::getByDirname($moduleDirName); + } + xoops_loadLanguage('admin', $moduleDirName); + + //check for minimum XOOPS version + $currentVer = substr(XOOPS_VERSION, 6); // get the numeric part of string + if (null === $requiredVer) { + $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string + } + $success = true; + + if (version_compare($currentVer, $requiredVer, '<')) { + $success = false; + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); + } + + return $success; + } + + /** + * + * Verifies PHP version meets minimum requirements for this module + * @static + * @param \XoopsModule $module + * + * @return bool true if meets requirements, false if not + */ + public static function checkVerPhp(\XoopsModule $module) + { + xoops_loadLanguage('admin', $module->dirname()); + // check for minimum PHP version + $success = true; + $verNum = PHP_VERSION; + $reqVer = $module->getInfo('min_php'); + if (false !== $reqVer && '' !== $reqVer) { + if (version_compare($verNum, $reqVer, '<')) { + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); + $success = false; + } + } + + return $success; + } +} diff --git a/class/Common/index.html b/class/Common/index.html new file mode 100644 index 00000000..990cbd60 --- /dev/null +++ b/class/Common/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/class/Helper.php b/class/Helper.php new file mode 100644 index 00000000..5a0f09d6 --- /dev/null +++ b/class/Helper.php @@ -0,0 +1,78 @@ +debug = $debug; + $moduleDirName = basename(dirname(__DIR__)); + parent::__construct($moduleDirName); + } + + /** + * @param bool $debug + * + * @return \Xmf\Module\Helper + */ + public static function getInstance($debug = false) + { + static $instance; + if (null === $instance) { + $instance = new static($debug); + } + + return $instance; + } + + /** + * @return string + */ + public function getDirname() + { + return $this->dirname; + } + + /** + * Get an Object Handler + * + * @param string $name name of handler to load + * + * @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler + */ + public function getHandler($name) + { + $ret = false; + $db = \XoopsDatabaseFactory::getDatabaseConnection(); + $class = '\\XoopsModules\\' . ucfirst(strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler'; + $ret = new $class($db); + return $ret; + } +} diff --git a/class/Utility.php b/class/Utility.php new file mode 100644 index 00000000..88901adf --- /dev/null +++ b/class/Utility.php @@ -0,0 +1,72 @@ + + * @author Mamba + * @since File available since version 1.54 + */ + +use Xmf\Request; +use XoopsModules\rss; +use XoopsModules\rss\Common; + +//require_once __DIR__ . '/../include/common.php'; + +/** + * Class Utility + */ +class Utility +{ + use Common\VersionChecks; //checkVerXoops, checkVerPhp Traits + + use Common\ServerStats; // getServerStats Trait + + use Common\FilesManagement; // Files Management Trait + + //--------------- Custom module methods ----------------------------- + + public static function sortTimestamp($a, $b) + { + if ($a['timestamp'] == $b['timestamp']) { + return 0; + } + return ($a['timestamp'] > $b['timestamp']) ? -1 : 1; + } + + public static function genSpecMoreInfo($spec=0, &$rss) + { + return static::rssfGenAnchor($rss->specUrl($spec), _AM_EDIT_CHANNEL_QMARK, 'spec', _AM_EDIT_CHANNEL_MOREINFO); + } + + public static function rssfGenAnchor($url='', $text='', $target= '', $title='', $class='', $id='') + { + if (!empty($url)) { + $ret = ''; + $ret .= ''; + return $ret; + } + return $text; + } +} diff --git a/class/plugins.php b/class/plugins.php index 4f7bb8f6..b9cc7138 100644 --- a/class/plugins.php +++ b/class/plugins.php @@ -273,7 +273,7 @@ public function &getPluginFileList() public function &checkPlugin($obj) { $ret = false; - global $module_handler; + global $moduleHandler; $file = RSSFIT_ROOT_PATH.'plugins/'.$obj->getVar('rssf_filename'); if (file_exists($file)) { $require = require_once $file; diff --git a/include/config.php b/include/config.php new file mode 100644 index 00000000..697183c9 --- /dev/null +++ b/include/config.php @@ -0,0 +1,80 @@ + strtoupper($moduleDirName) . ' Module Configurator', + 'paths' => [ + 'dirname' => $moduleDirName, + 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', + 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, + 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, + 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, + ], + 'uploadFolders' => [ + constant($moduleDirNameUpper . '_UPLOAD_PATH'), + constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/category', + constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/screenshots', + //XOOPS_UPLOAD_PATH . '/flags' + ], + 'copyBlankFiles' => [ + constant($moduleDirNameUpper . '_UPLOAD_PATH'), + constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/category', + constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/screenshots', + //XOOPS_UPLOAD_PATH . '/flags' + ], + + 'copyTestFolders' => [ + // constant($moduleDirNameUpper . '_UPLOAD_PATH'), + //[ + // constant($moduleDirNameUpper . '_PATH') . '/testdata/images', + // constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/images', + //] + ], + + 'templateFolders' => [ + '/templates/', + '/templates/blocks/', + '/templates/admin/' + + ], + 'oldFiles' => [ + '/class/request.php', + '/class/registry.php', + '/class/utilities.php', + '/class/util.php', + '/include/constants.php', + '/include/functions.php', + '/ajaxrating.txt', + ], + 'oldFolders' => [ + '/images', + '/css', + '/js', + '/tcpdf', + '/images', + ], + 'modCopyright' => " + \'XOOPS', + ]; +} diff --git a/include/oninstall.php b/include/oninstall.php new file mode 100644 index 00000000..86d79add --- /dev/null +++ b/include/oninstall.php @@ -0,0 +1,105 @@ +getInfo('tables'); + foreach ($moduleTables as $table) { + $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); + } + } + + return $xoopsSuccess && $phpSuccess; +} + +/** + * + * Performs tasks required during installation of the module + * @param XoopsModule $module {@link XoopsModule} + * + * @return bool true if installation successful, false if not + */ +function xoops_module_install_rss(\XoopsModule $module) +{ + include __DIR__ . '/../preloads/autoloader.php'; + require_once __DIR__ . '/../../../mainfile.php'; + require_once __DIR__ . '/../include/config.php'; + + $moduleDirName = basename(dirname(__DIR__)); + + $helper = rss\Helper::getInstance(); + $configurator = new Rss\Common\Configurator(); + /** @var rss\Utility $utility */ + $utility = new Rss\Utility(); + + // Load language files + $helper->loadLanguage('admin'); + $helper->loadLanguage('modinfo'); + + // default Permission Settings ---------------------- + global $xoopsModule; + $moduleId = $xoopsModule->getVar('mid'); + $moduleId2 = $helper->getModule()->mid(); + $grouppermHandler = xoops_getHandler('groupperm'); + // access rights ------------------------------------------ + $grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); + + // --- CREATE FOLDERS --------------- + if (count($configurator->uploadFolders) > 0) { + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { + foreach (array_keys($configurator->uploadFolders) as $i) { + $utility::createFolder($configurator->uploadFolders[$i]); + } + } + + // --- COPY blank.png FILES --------------- + if (count($configurator->copyBlankFiles) > 0) { + $file = __DIR__ . '/../assets/images/blank.png'; + foreach (array_keys($configurator->copyBlankFiles) as $i) { + $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; + $utility::copyFile($file, $dest); + } + } + //delete .html entries from the tpl table + $sql = 'DELETE FROM ' . $xoopsDB->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'"; + $xoopsDB->queryF($sql); + + return true; +} diff --git a/include/onuninstall.php b/include/onuninstall.php new file mode 100644 index 00000000..25739cc9 --- /dev/null +++ b/include/onuninstall.php @@ -0,0 +1,79 @@ +loadLanguage('admin'); + + //------------------------------------------------------------------ + // Remove uploads folder (and all subfolders) if they exist + //------------------------------------------------------------------ + + $old_directories = [$GLOBALS['xoops']->path("uploads/{$moduleDirName}")]; + foreach ($old_directories as $old_dir) { + $dirInfo = new \SplFileInfo($old_dir); + if ($dirInfo->isDir()) { + // The directory exists so delete it + if (false === $utility::rrmdir($old_dir)) { + $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir)); + $success = false; + } + } + unset($dirInfo); + } + /* + //------------ START ---------------- + //------------------------------------------------------------------ + // Remove xsitemap.xml from XOOPS root folder if it exists + //------------------------------------------------------------------ + $xmlfile = $GLOBALS['xoops']->path('xsitemap.xml'); + if (is_file($xmlfile)) { + if (false === ($delOk = unlink($xmlfile))) { + $module->setErrors(sprintf(_AM_XXXXX_ERROR_BAD_REMOVE, $xmlfile)); + } + } +// return $success && $delOk; // use this if you're using this routine +*/ + + return $success; + //------------ END ---------------- +} diff --git a/include/onupdate.php b/include/onupdate.php new file mode 100644 index 00000000..46523baa --- /dev/null +++ b/include/onupdate.php @@ -0,0 +1,153 @@ +IsAdmin() +) { + exit('Restricted access' . PHP_EOL); +} + +/** + * @param string $tablename + * + * @return bool + */ +function tableExists($tablename) +{ + $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); + + return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) ? true : false; +} + +/** + * + * Prepares system prior to attempting to install module + * @param \XoopsModule $xoopsModule + * @param null $previousVersion + * @return bool true if ready to install, false if not + */ +function xoops_module_pre_update_rss(\XoopsModule $xoopsModule, $previousVersion = null) +{ + $moduleDirName = basename(dirname(__DIR__)); + /** @var Rss\Helper $helper */ + /** @var Rss\Utility $utility */ + $helper = Rss\Helper::getInstance(); + $utility = new Rss\Utility(); + + $xoopsSuccess = $utility::checkVerXoops($module); + $phpSuccess = $utility::checkVerPhp($module); + return $xoopsSuccess && $phpSuccess; +} + +/** + * + * Performs tasks required during update of the module + * @param \XoopsModule $module {@link XoopsModule} + * @param null $previousVersion + * + * @return bool true if update successful, false if not + */ + +function xoops_module_update_rss(\XoopsModule $module, $previousVersion = null) +{ + $moduleDirName = basename(dirname(__DIR__)); + $capsDirName = strtoupper($moduleDirName); + + /** @var Rss\Helper $helper */ + /** @var Rss\Utility $utility */ + /** @var Rss\Common\Common\Configurator $configurator */ + $helper = Rss\Helper::getInstance(); + $utility = new Rss\Utility(); + $configurator = new Rss\Common\Common\Configurator(); + + if ($previousVersion < 240) { + + + + + //delete old HTML templates + if (count($configurator->templateFolders) > 0) { + foreach ($configurator->templateFolders as $folder) { + $templateFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $folder); + if (is_dir($templateFolder)) { + $templateList = array_diff(scandir($templateFolder, SCANDIR_SORT_NONE), ['..', '.']); + foreach ($templateList as $k => $v) { + $fileInfo = new \SplFileInfo($templateFolder . $v); + if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) { + if (file_exists($templateFolder . $v)) { + unlink($templateFolder . $v); + } + } + } + } + } + } + + // --- DELETE OLD FILES --------------- + if (count($configurator->oldFiles) > 0) { + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { + foreach (array_keys($configurator->oldFiles) as $i) { + $tempFile = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFiles[$i]); + if (is_file($tempFile)) { + unlink($tempFile); + } + } + } + + // --- DELETE OLD FOLDERS --------------- + xoops_load('XoopsFile'); + if (count($configurator->oldFolders) > 0) { + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { + foreach (array_keys($configurator->oldFolders) as $i) { + $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]); + /* @var $folderHandler XoopsObjectHandler */ + $folderHandler = XoopsFile::getHandler('folder', $tempFolder); + $folderHandler->delete($tempFolder); + } + } + + // --- CREATE FOLDERS --------------- + if (count($configurator->uploadFolders) > 0) { + // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { + foreach (array_keys($configurator->uploadFolders) as $i) { + $utility::createFolder($configurator->uploadFolders[$i]); + } + } + + // --- COPY blank.png FILES --------------- + if (count($configurator->copyBlankFiles) > 0) { + $file = __DIR__ . '/../assets/images/blank.png'; + foreach (array_keys($configurator->copyBlankFiles) as $i) { + $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; + $utility::copyFile($file, $dest); + } + } + + //delete .html entries from the tpl table + $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\''; + $GLOBALS['xoopsDB']->queryF($sql); + + /** @var XoopsGroupPermHandler $grouppermHandler */ + $grouppermHandler = xoops_getHandler('groupperm'); + return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read'); + } + return true; +} diff --git a/language/english/common.php b/language/english/common.php new file mode 100644 index 00000000..72e69533 --- /dev/null +++ b/language/english/common.php @@ -0,0 +1,71 @@ +Disabled (No thumbnails available)"); +define('CO_' . $moduleDirNameUpper . '_GDON', "Enabled (Thumbsnails available)"); +define('CO_' . $moduleDirNameUpper . '_IMAGEINFO', 'Server status'); +define('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): '); +define('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): '); +define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); +define('CO_' . $moduleDirNameUpper . '_METAVERSION', "Downloads meta version: "); +define('CO_' . $moduleDirNameUpper . '_OFF', "OFF"); +define('CO_' . $moduleDirNameUpper . '_ON', "ON"); +define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); +define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); +define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); +define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); + +define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); +define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); + + +define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); +define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); +define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); +define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); +define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); +define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); +define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); + +define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); + +// Error Msgs +define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); +define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); +define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); + + +//Help +define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__)))); +define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__.'/help/helpheader.tpl'); +define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); +define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); + +//define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); + +//help multi-page +define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); +define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); +define('CO_' . $moduleDirNameUpper . '_SUPPORT', 'Support'); diff --git a/plugins/rssfit.adslight.php b/plugins/rssfit.adslight.php index 85c1d051..3a9bf8c3 100644 --- a/plugins/rssfit.adslight.php +++ b/plugins/rssfit.adslight.php @@ -52,7 +52,7 @@ class RssfitAdslight public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.ams.php b/plugins/rssfit.ams.php index b2635d2c..c435ace3 100644 --- a/plugins/rssfit.ams.php +++ b/plugins/rssfit.ams.php @@ -48,7 +48,7 @@ class RssfitAms public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.buyersguide.php b/plugins/rssfit.buyersguide.php index 62ec2a94..e90c0fb2 100644 --- a/plugins/rssfit.buyersguide.php +++ b/plugins/rssfit.buyersguide.php @@ -54,7 +54,7 @@ class RssfitBuyersguide public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.buyersguidemanufacturers.php b/plugins/rssfit.buyersguidemanufacturers.php index beffda77..de3e5f08 100644 --- a/plugins/rssfit.buyersguidemanufacturers.php +++ b/plugins/rssfit.buyersguidemanufacturers.php @@ -54,7 +54,7 @@ class RssfitBuyersguidemanufacturers public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.buyersguidenews.php b/plugins/rssfit.buyersguidenews.php index 4c425106..fdf921ee 100644 --- a/plugins/rssfit.buyersguidenews.php +++ b/plugins/rssfit.buyersguidenews.php @@ -54,7 +54,7 @@ class RssfitBuyersguidenews public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.cbb.php b/plugins/rssfit.cbb.php index 79b2943e..150225d4 100644 --- a/plugins/rssfit.cbb.php +++ b/plugins/rssfit.cbb.php @@ -49,7 +49,7 @@ class RssfitCbb public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } @@ -67,7 +67,7 @@ public function &grabEntries(&$obj) $i = 0; $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $topicHandler = xoops_getModuleHandler('topic', 'newbb'); - $newbbConfig = $GLOBALS['config_handler']->getConfigsByCat(0, $this->module->getVar('mid')); + $newbbConfig = $GLOBALS['configHandler']->getConfigsByCat(0, $this->module->getVar('mid')); $access_forums = $forumHandler->getForums(0, 'access'); $available_forums = []; diff --git a/plugins/rssfit.comments.php b/plugins/rssfit.comments.php index fd91d1c1..8da71c77 100644 --- a/plugins/rssfit.comments.php +++ b/plugins/rssfit.comments.php @@ -48,7 +48,7 @@ class RssfitComments public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } @@ -68,7 +68,7 @@ public function &grabEntries(&$obj) $comments = $commentHandler->getObjects($criteria, true); $comment_config = []; if (count($comments) > 0) { - $modules = $GLOBALS['module_handler']->getObjects(new \Criteria('hascomments', 1), true); + $modules = $GLOBALS['moduleHandler']->getObjects(new \Criteria('hascomments', 1), true); foreach (array_keys($comments) as $i) { $mid = $comments[$i]->getVar('com_modid'); if (!isset($comment_config[$mid])) { diff --git a/plugins/rssfit.extcal.php b/plugins/rssfit.extcal.php index b1ed19bc..7e75216b 100644 --- a/plugins/rssfit.extcal.php +++ b/plugins/rssfit.extcal.php @@ -66,7 +66,7 @@ class RssfitExtcal public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.lexikon.php b/plugins/rssfit.lexikon.php index 16b0b679..4f63ea6f 100644 --- a/plugins/rssfit.lexikon.php +++ b/plugins/rssfit.lexikon.php @@ -54,7 +54,7 @@ class Rssfitlexikon extends XoopsObject public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } @@ -67,7 +67,7 @@ public function &grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - //$perm_handler = xoops_getHandler('groupperm'); + //$permHandler = xoops_getHandler('groupperm'); $ret = false; $i = 0; $sql = 'SELECT entryID, categoryID, term, definition, datesub FROM ' diff --git a/plugins/rssfit.myalbum.php b/plugins/rssfit.myalbum.php index 8886a627..df7cd003 100644 --- a/plugins/rssfit.myalbum.php +++ b/plugins/rssfit.myalbum.php @@ -66,7 +66,7 @@ class RssfitMyalbum public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.mydownloads.php b/plugins/rssfit.mydownloads.php index fe999467..61f18287 100644 --- a/plugins/rssfit.mydownloads.php +++ b/plugins/rssfit.mydownloads.php @@ -50,7 +50,7 @@ class RssfitMydownloads extends XoopsObject public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.mylinks.php b/plugins/rssfit.mylinks.php index f7a552b9..673a91dd 100644 --- a/plugins/rssfit.mylinks.php +++ b/plugins/rssfit.mylinks.php @@ -48,7 +48,7 @@ class RssfitMylinks public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.mytube.php b/plugins/rssfit.mytube.php index 6f20c452..adee8287 100644 --- a/plugins/rssfit.mytube.php +++ b/plugins/rssfit.mytube.php @@ -53,7 +53,7 @@ class RssfitMytube public function loadModule() { - $mod = $GLOBALS['module_handler'] -> getByDirname($this -> dirname); + $mod = $GLOBALS['moduleHandler'] -> getByDirname($this -> dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.newbb.php b/plugins/rssfit.newbb.php index 2c92ec72..0d54ea40 100644 --- a/plugins/rssfit.newbb.php +++ b/plugins/rssfit.newbb.php @@ -48,7 +48,7 @@ class RssfitNewbb public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.newbb2.php b/plugins/rssfit.newbb2.php index 7927b846..f939c14c 100644 --- a/plugins/rssfit.newbb2.php +++ b/plugins/rssfit.newbb2.php @@ -49,7 +49,7 @@ class RssfitNewbb2 public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive') || $mod->getVar('version') < 200) { return false; } @@ -88,14 +88,14 @@ public function myGetUnameFromId($uid) public function &grabEntries(&$obj) { @include XOOPS_ROOT_PATH.'/modules/newbb/include/functions.php'; - global $xoopsDB, $config_handler; + global $xoopsDB, $configHandler; $xoopsModule = $this->module; $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; $forumHandler = xoops_getModuleHandler('forum', 'newbb'); $topicHandler = xoops_getModuleHandler('topic', 'newbb'); - $newbbConfig = $config_handler->getConfigsByCat(0, $this->module->getVar('mid')); + $newbbConfig = $configHandler->getConfigsByCat(0, $this->module->getVar('mid')); $access_forums = $forumHandler->getForums(0, 'access'); $available_forums = []; diff --git a/plugins/rssfit.news.php b/plugins/rssfit.news.php index 1a1d5b41..03d260c2 100644 --- a/plugins/rssfit.news.php +++ b/plugins/rssfit.news.php @@ -48,7 +48,7 @@ class RssfitNews public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.oledrion.php b/plugins/rssfit.oledrion.php index 8043fc67..827c2c16 100644 --- a/plugins/rssfit.oledrion.php +++ b/plugins/rssfit.oledrion.php @@ -34,7 +34,7 @@ class RssfitOledrion public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.pical.php b/plugins/rssfit.pical.php index 66ce944d..fc732670 100644 --- a/plugins/rssfit.pical.php +++ b/plugins/rssfit.pical.php @@ -53,7 +53,7 @@ class RssfitpiCal public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.pluginsample.php b/plugins/rssfit.pluginsample.php index 414a4396..234712cf 100644 --- a/plugins/rssfit.pluginsample.php +++ b/plugins/rssfit.pluginsample.php @@ -66,7 +66,7 @@ class RssfitSample public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.publisher.php b/plugins/rssfit.publisher.php index 9c6786d1..51040c3e 100644 --- a/plugins/rssfit.publisher.php +++ b/plugins/rssfit.publisher.php @@ -48,7 +48,7 @@ class RssfitPublisher public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.queries.php b/plugins/rssfit.queries.php index f362cd04..46985127 100644 --- a/plugins/rssfit.queries.php +++ b/plugins/rssfit.queries.php @@ -51,7 +51,7 @@ class RssfitQueries public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.rmdp.php b/plugins/rssfit.rmdp.php index f46bccf7..36281bb1 100644 --- a/plugins/rssfit.rmdp.php +++ b/plugins/rssfit.rmdp.php @@ -53,8 +53,8 @@ class Rssfitrmdp extends XoopsObject public function loadModule() { - global $module_handler; - $mod = $module_handler->getByDirname($this->dirname); + global $moduleHandler; + $mod = $moduleHandler->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } @@ -65,7 +65,7 @@ public function loadModule() public function grabEntries(&$obj) { - global $xoopsDB, $moduleperm_handler; + global $xoopsDB, $modulepermHandler; $ret = []; $i = 0; $sql = 'SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ' . $xoopsDB->prefix('rmdp_software') . ' ORDER BY fecha DESC'; diff --git a/plugins/rssfit.smartfaq.php b/plugins/rssfit.smartfaq.php index c50e7633..a7505953 100644 --- a/plugins/rssfit.smartfaq.php +++ b/plugins/rssfit.smartfaq.php @@ -48,7 +48,7 @@ class RssfitSmartfaq public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.smartpartner.php b/plugins/rssfit.smartpartner.php index 1179145f..2d93ec4f 100644 --- a/plugins/rssfit.smartpartner.php +++ b/plugins/rssfit.smartpartner.php @@ -49,7 +49,7 @@ class RssfitSmartpartner public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } @@ -61,7 +61,7 @@ public function &grabEntries(&$obj) { $ret = false; include XOOPS_ROOT_PATH . '/modules/smartpartner/include/common.php'; - $partners = $partner_handler->getPartners($this->grab, 0, _SPARTNER_STATUS_ACTIVE, 'weight', 'DESC'); + $partners = $partnerHandler->getPartners($this->grab, 0, _SPARTNER_STATUS_ACTIVE, 'weight', 'DESC'); if (false !== $partners && count($partners) > 0) { for ($i=0, $iMax = count($partners); $i < $iMax; $i++) { $ret[$i]['link'] = $ret[$i]['guid'] = SMARTPARTNER_URL.'partner.php?id='.$partners[$i]->getVar('id'); diff --git a/plugins/rssfit.smartsection.php b/plugins/rssfit.smartsection.php index 15ea5a7a..fc70b9f6 100644 --- a/plugins/rssfit.smartsection.php +++ b/plugins/rssfit.smartsection.php @@ -48,7 +48,7 @@ class RssfitSmartsection public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } @@ -60,7 +60,7 @@ public function &grabEntries(&$obj) { $ret = false; include XOOPS_ROOT_PATH . '/modules/smartsection/include/common.php'; - $items = $smartsection_item_handler->getAllPublished($this->grab, 0); + $items = $smartsection_itemHandler->getAllPublished($this->grab, 0); if (false !== $items && count($items) > 0) { for ($i=0, $iMax = count($items); $i < $iMax; $i++) { $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); diff --git a/plugins/rssfit.special.php b/plugins/rssfit.special.php index 62f959fa..5154c5e5 100644 --- a/plugins/rssfit.special.php +++ b/plugins/rssfit.special.php @@ -66,7 +66,7 @@ class RssfitSpecial public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.surnames.php b/plugins/rssfit.surnames.php index 9b8fb772..0f055fb3 100644 --- a/plugins/rssfit.surnames.php +++ b/plugins/rssfit.surnames.php @@ -51,7 +51,7 @@ class RssfitSurnames public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.weblinks.php b/plugins/rssfit.weblinks.php index 2f70188b..6cb81d33 100644 --- a/plugins/rssfit.weblinks.php +++ b/plugins/rssfit.weblinks.php @@ -48,7 +48,7 @@ class RssfitWeblinks public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.wfdownloads.php b/plugins/rssfit.wfdownloads.php index 14e8c952..b0f11f03 100644 --- a/plugins/rssfit.wfdownloads.php +++ b/plugins/rssfit.wfdownloads.php @@ -49,7 +49,7 @@ class Rssfitwfdownloads extends XoopsObject public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } @@ -69,7 +69,7 @@ public function &grabEntries(&$obj) . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - if ($permHandler->checkRight('WFDownFilePerm', $row['lid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { + if ($permHandler->checkRight('WFDownFilePerm', $row['lid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['memberHandler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { $ret[$i]['title'] = $row['title']; $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlefile.php?cid='.$row['cid'].'&lid='.$row['lid']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; diff --git a/plugins/rssfit.wfdownloads_podcast.php b/plugins/rssfit.wfdownloads_podcast.php index 0b5873c7..d81f8231 100644 --- a/plugins/rssfit.wfdownloads_podcast.php +++ b/plugins/rssfit.wfdownloads_podcast.php @@ -49,7 +49,7 @@ class Rssfitwfdownloads_podcast extends XoopsObject public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive') || $mod->getVar('version') < 310) { return false; } @@ -71,7 +71,7 @@ public function &grabEntries(&$obj) . time() . ' ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - if ((isset($perms[$row['cid']]) && true === $perms[$row['cid']]) || $permHandler->checkRight('WFDownCatPerm', $row['cid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['member_handler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { + if ((isset($perms[$row['cid']]) && true === $perms[$row['cid']]) || $permHandler->checkRight('WFDownCatPerm', $row['cid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['memberHandler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { $perms[$row['cid']] = true; $ret[$i]['title'] = $row['title']; $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlefile.php?cid='.$row['cid'].'&lid='.$row['lid']; diff --git a/plugins/rssfit.wflinks.php b/plugins/rssfit.wflinks.php index 24065822..7ada508e 100644 --- a/plugins/rssfit.wflinks.php +++ b/plugins/rssfit.wflinks.php @@ -29,8 +29,8 @@ class RssfitWflinks public function loadModule() { - global $module_handler; - $mod = $module_handler->getByDirname($this->dirname); + global $moduleHandler; + $mod = $moduleHandler->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.wfsection.php b/plugins/rssfit.wfsection.php index 2b853182..6d5bfc34 100644 --- a/plugins/rssfit.wfsection.php +++ b/plugins/rssfit.wfsection.php @@ -48,7 +48,7 @@ class RssfitWfsection public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/plugins/rssfit.wfsection2.php b/plugins/rssfit.wfsection2.php index 50d5e933..b2b09ca5 100644 --- a/plugins/rssfit.wfsection2.php +++ b/plugins/rssfit.wfsection2.php @@ -52,7 +52,7 @@ class RssfitWfsection2 public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive') || $mod->getVar('version') < 200) { return false; } diff --git a/plugins/rssfit.xoopstube.php b/plugins/rssfit.xoopstube.php index 4527230f..3f21b4af 100644 --- a/plugins/rssfit.xoopstube.php +++ b/plugins/rssfit.xoopstube.php @@ -53,7 +53,7 @@ class RssfitXoopstube public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/preloads/autoloader.php b/preloads/autoloader.php new file mode 100644 index 00000000..ed936f92 --- /dev/null +++ b/preloads/autoloader.php @@ -0,0 +1,32 @@ + + */ + +defined('XOOPS_ROOT_PATH') || die('Restricted access'); + +/** + * Class RssCorePreload + */ +class RssCorePreload extends XoopsPreloadItem +{ + // to add PSR-4 autoloader + /** + * @param $args + */ + public static function eventCoreIncludeCommonEnd($args) + { + include __DIR__ . '/autoloader.php'; + } +} diff --git a/preloads/index.html b/preloads/index.html new file mode 100644 index 00000000..2c5cdd3f --- /dev/null +++ b/preloads/index.html @@ -0,0 +1 @@ + From bbd677b0f4f822b32965862b145c29eb1e0bab0d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 14 Apr 2018 23:06:13 -0400 Subject: [PATCH 049/154] Updates Signed-off-by: mambax7 --- admin/admin_header.php | 2 +- admin/do_channel.php | 2 +- admin/do_plugins.php | 8 +++++--- admin/do_subfeeds.php | 2 +- admin/menu.php | 6 +++--- class/Common/Breadcrumb.php | 2 +- class/Common/Configurator.php | 4 ++-- class/Common/FilesManagement.php | 2 +- class/Common/ServerStats.php | 2 +- class/Common/VersionChecks.php | 2 +- class/Helper.php | 2 +- class/Utility.php | 8 ++++---- class/misc.php | 4 ++-- class/plugins.php | 4 ++-- header.php | 2 +- include/config.php | 4 ++-- include/oninstall.php | 14 +++++++------- include/onupdate.php | 2 +- plugins/rssfit.lexikon.php | 2 +- plugins/rssfit.mydownloads.php | 2 +- plugins/rssfit.rmdp.php | 4 ++-- plugins/rssfit.wfdownloads.php | 2 +- plugins/rssfit.wfdownloads_podcast.php | 2 +- plugins/rssfit.wfsection2.php | 10 +++------- preloads/autoloader.php | 2 +- preloads/core.php | 2 +- testdata/index.php | 2 +- 27 files changed, 49 insertions(+), 51 deletions(-) diff --git a/admin/admin_header.php b/admin/admin_header.php index a62e31fe..be54cc74 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -39,7 +39,7 @@ class_exists(Admin::class) || exit('XMF is required.'); //if functions.php file exist require_once dirname(__DIR__) . '/include/common.php'; -//require __DIR__ . '/../include/common.php'; +//require dirname(__DIR__) . '/include/common.php'; global $xoopsModule; diff --git a/admin/do_channel.php b/admin/do_channel.php index 409964e8..fa322696 100644 --- a/admin/do_channel.php +++ b/admin/do_channel.php @@ -33,7 +33,7 @@ ############################################################################### use Xmf\Request; -use XoopsModules\rss; +use XoopsModules\Rss; if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 325219b1..162bca66 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -34,13 +34,15 @@ use Xmf\Request; use XoopsModules\Rss; -/** @var Rss\Helper $helper */ -$helper = Rss\Helper::getInstance(); + if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); } +/** @var Rss\Helper $helper */ +$helper = Rss\Helper::getInstance(); + switch ($op) { default: $ret = ''; @@ -124,7 +126,7 @@ if (!$filelist =& $pluginsHandler->getPluginFileList()) { $filelist = []; } - $list = XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); + $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); $installable = []; foreach ($list as $f) { if (preg_match('/rssfit\.+[a-zA-Z0-9_]+\.php/', $f) && !in_array($f, $filelist)) { diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index d73e63fc..ea966600 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -33,7 +33,7 @@ ############################################################################### use Xmf\Request; -use XoopsModules\rss; +use XoopsModules\Rss; if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { header('Location: index.php'); diff --git a/admin/menu.php b/admin/menu.php index 1843c63d..00afea4e 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -17,10 +17,10 @@ * @author XOOPS Development Team */ -use XoopsModules\rss; +use XoopsModules\Rss; -// require_once __DIR__ . '/../class/Helper.php'; -//require_once __DIR__ . '/../include/common.php'; +// require_once dirname(__DIR__) . '/class/Helper.php'; +//require_once dirname(__DIR__) . '/include/common.php'; $helper = rss\Helper::getInstance(); // get path to icons $pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index afb9e97a..da0351ec 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -1,4 +1,4 @@ -name = $config->name; diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index 1cb0c87e..8215aa62 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -1,4 +1,4 @@ - [ diff --git a/include/oninstall.php b/include/oninstall.php index 86d79add..4adb0bf2 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -18,7 +18,7 @@ * @author XOOPS Development Team */ -use XoopsModules\rss; +use XoopsModules\Rss; /** * @@ -29,9 +29,9 @@ */ function xoops_module_pre_install_rss(\XoopsModule $module) { - include __DIR__ . '/../preloads/autoloader.php'; + include dirname(__DIR__) . '/preloads/autoloader.php'; /** @var rss\Utility $utility */ - $utility = new \XoopsModules\rss\Utility(); + $utility = new \XoopsModules\Rss\Utility(); $xoopsSuccess = $utility::checkVerXoops($module); $phpSuccess = $utility::checkVerPhp($module); @@ -54,9 +54,9 @@ function xoops_module_pre_install_rss(\XoopsModule $module) */ function xoops_module_install_rss(\XoopsModule $module) { - include __DIR__ . '/../preloads/autoloader.php'; - require_once __DIR__ . '/../../../mainfile.php'; - require_once __DIR__ . '/../include/config.php'; + include dirname(__DIR__) . '/preloads/autoloader.php'; + require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; + require_once dirname(__DIR__) . '/include/config.php'; $moduleDirName = basename(dirname(__DIR__)); @@ -91,7 +91,7 @@ function xoops_module_install_rss(\XoopsModule $module) // --- COPY blank.png FILES --------------- if (count($configurator->copyBlankFiles) > 0) { - $file = __DIR__ . '/../assets/images/blank.png'; + $file = dirname(__DIR__) . '/assets/images/blank.png'; foreach (array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; $utility::copyFile($file, $dest); diff --git a/include/onupdate.php b/include/onupdate.php index 46523baa..cb79f51c 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -134,7 +134,7 @@ function xoops_module_update_rss(\XoopsModule $module, $previousVersion = null) // --- COPY blank.png FILES --------------- if (count($configurator->copyBlankFiles) > 0) { - $file = __DIR__ . '/../assets/images/blank.png'; + $file = dirname(__DIR__) . '/assets/images/blank.png'; foreach (array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; $utility::copyFile($file, $dest); diff --git a/plugins/rssfit.lexikon.php b/plugins/rssfit.lexikon.php index 4f63ea6f..cd9975c6 100644 --- a/plugins/rssfit.lexikon.php +++ b/plugins/rssfit.lexikon.php @@ -45,7 +45,7 @@ /** * Class Rssfitlexikon */ -class Rssfitlexikon extends XoopsObject +class Rssfitlexikon extends \XoopsObject { public $dirname = 'lexikon'; public $modname; diff --git a/plugins/rssfit.mydownloads.php b/plugins/rssfit.mydownloads.php index 61f18287..ae695bd4 100644 --- a/plugins/rssfit.mydownloads.php +++ b/plugins/rssfit.mydownloads.php @@ -42,7 +42,7 @@ exit(); } -class RssfitMydownloads extends XoopsObject +class RssfitMydownloads extends \XoopsObject { public $dirname = 'mydownloads'; public $modname; diff --git a/plugins/rssfit.rmdp.php b/plugins/rssfit.rmdp.php index 36281bb1..71a50d3e 100644 --- a/plugins/rssfit.rmdp.php +++ b/plugins/rssfit.rmdp.php @@ -44,7 +44,7 @@ /** * Class Rssfitrmdp */ -class Rssfitrmdp extends XoopsObject +class Rssfitrmdp extends \XoopsObject { public $dirname = 'rmdp'; public $modname; @@ -65,7 +65,7 @@ public function loadModule() public function grabEntries(&$obj) { - global $xoopsDB, $modulepermHandler; + global $xoopsDB, $grouppermHandler; $ret = []; $i = 0; $sql = 'SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ' . $xoopsDB->prefix('rmdp_software') . ' ORDER BY fecha DESC'; diff --git a/plugins/rssfit.wfdownloads.php b/plugins/rssfit.wfdownloads.php index b0f11f03..76d6229a 100644 --- a/plugins/rssfit.wfdownloads.php +++ b/plugins/rssfit.wfdownloads.php @@ -40,7 +40,7 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } -class Rssfitwfdownloads extends XoopsObject +class Rssfitwfdownloads extends \XoopsObject { public $dirname = 'wfdownloads'; public $modname; diff --git a/plugins/rssfit.wfdownloads_podcast.php b/plugins/rssfit.wfdownloads_podcast.php index d81f8231..c9f2890e 100644 --- a/plugins/rssfit.wfdownloads_podcast.php +++ b/plugins/rssfit.wfdownloads_podcast.php @@ -40,7 +40,7 @@ if (!defined('RSSFIT_ROOT_PATH')) { exit(); } -class Rssfitwfdownloads_podcast extends XoopsObject +class Rssfitwfdownloads_podcast extends \XoopsObject { public $dirname = 'wfdownloads'; public $modname; diff --git a/plugins/rssfit.wfsection2.php b/plugins/rssfit.wfsection2.php index b2b09ca5..48a23ec2 100644 --- a/plugins/rssfit.wfsection2.php +++ b/plugins/rssfit.wfsection2.php @@ -37,9 +37,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -use XoopsModules\Rssfit; -/** @var Rssfit\Helper $helper */ -$helper = Rssfit\Helper::getInstance(); +use XoopsModules\Rss; if (!defined('RSSFIT_ROOT_PATH')) { exit(); @@ -62,12 +60,10 @@ public function loadModule() public function &grabEntries(&$obj) { - @require_once XOOPS_ROOT_PATH.'/modules/wfsection/class/common.php'; - @require_once XOOPS_ROOT_PATH.'/modules/wfsection/class/wfsarticle.php'; $ret = false; - $articles = WfsArticle::getAllArticle($this->grab, 0, 'online'); + $articles = Rss\WfsArticle::getAllArticle($this->grab, 0, 'online'); if (count($articles) > 0) { - $helper->getConfig('shortartlen') = 0; + $xoopsModuleConfig['shortartlen'] = 0; $myts = \MyTextSanitizer::getInstance(); for ($i=0, $iMax = count($articles); $i < $iMax; $i++) { $link = XOOPS_URL.'/modules/wfsection/article.php?articleid='.$articles[$i]->articleid(); diff --git a/preloads/autoloader.php b/preloads/autoloader.php index ed936f92..79759d65 100644 --- a/preloads/autoloader.php +++ b/preloads/autoloader.php @@ -8,7 +8,7 @@ $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__))); // base directory for the namespace prefix - $base_dir = __DIR__ . '/../class/'; + $base_dir = dirname(__DIR__) . '/class/'; // does the class use the namespace prefix? $len = strlen($prefix); diff --git a/preloads/core.php b/preloads/core.php index 19049215..dcbab682 100644 --- a/preloads/core.php +++ b/preloads/core.php @@ -20,7 +20,7 @@ /** * Class RssCorePreload */ -class RssCorePreload extends XoopsPreloadItem +class RssCorePreload extends \XoopsPreloadItem { // to add PSR-4 autoloader /** diff --git a/testdata/index.php b/testdata/index.php index cef7fcf6..5a9086be 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -15,7 +15,7 @@ * @author Michael Beck (aka Mamba) */ -require_once __DIR__ . '/../../../mainfile.php'; +require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; $op = \Xmf\Request::getCmd('op', ''); From 359377712acfa6e7cfae24bd0c099a9db1d8fe4e Mon Sep 17 00:00:00 2001 From: ImgBotApp Date: Sat, 19 Jan 2019 03:57:56 +0000 Subject: [PATCH 050/154] [ImgBot] Optimize images *Total -- 4.22kb -> 3.40kb (19.46%) /assets/images/logoModule.png -- 3.04kb -> 2.24kb (26.3%) /assets/images/blank.gif -- 0.05kb -> 0.05kb (3.92%) /assets/images/rss.gif -- 1.13kb -> 1.11kb (1.73%) --- assets/images/blank.gif | Bin 51 -> 49 bytes assets/images/logoModule.png | Bin 3110 -> 2292 bytes assets/images/rss.gif | Bin 1156 -> 1136 bytes 3 files changed, 0 insertions(+), 0 deletions(-) diff --git a/assets/images/blank.gif b/assets/images/blank.gif index c0b332e41a28ea383ca9dffc5c2242aa87fb3d0b..c69139d27d03979c0e8445ac24edbdeb843c4a2e 100644 GIT binary patch delta 24 fcmXpuEk%fi98UQ`(1HS+O diff --git a/assets/images/logoModule.png b/assets/images/logoModule.png index 0f55a83dd60c08d77608e1655a391fb790d15825..bde29281f4dc0aee9bc8501cf57d526984764746 100644 GIT binary patch delta 2245 zcmV;$2s-zs81xa4B!2{FK}|sb0I`n?{9y$E001CkNK#Dz0D2|>0Dy!50Qvv`0D$NK z0Cg|`0P0`>06Lfe02gqax=}m;00DqdOjJex|Ns8}|NQy(v8|vJpYdN1Z@ zG3&Xh`}Oiuyz|^$IN44w?SM2gsO=@4={v0M3=(<>0Y(%*F+^Gj^8Dd<1CuyM5*fg@#`#=<9@g5JD%n?nd2mh-0q}v zERf$Le%2&}*({6PHj&<3rsXSz*-@I`CV0{`huI}^&Mbe{B5le~iPbWE(s-cVA!o-i zbS zTJrz^00DGTPE!Ct=GbNc0004EOGiWihy@);00007bV*G`2jc+~134*exVgdr00uuv zL_t(o!+*8bjb9Q;7{GCG;nKOhgakb`K;>mwQc!RgmhOa7Q{+5L(^At?v&5Io6vSn@ zfBl|kW)>Di>2qhlPp!7>d}kb%HH+2SA=vDqgf8 z-|PCLMw`))n{-(O(#OLy1B}ND2L}OnJhl!!@ih0u>qFf{4>B4@GaEeez+xL79ya*C z0SI0m85yBCtb5cS2+~5BNDGTn2cotaq`(&FM0;D7Vz49gh2{t8-n4J!{xK{cWz)v%ZjCvkHW z+!HAn3|Qwgvxb|)>(Qm-5ke90C4Uy1VFjWWEWdh{dkrfONeOih_ahHW&cj>lOTxP0 z6C04{U#~837il^Q$MeN5y{Y51IaX+Ez^@`6N~GxBVpUWzorks0sR@c(0q5{CT)n)u z!sVI;`1%`jOG|HQz;isLDqhNa;YLrwzWafOj~2t%cq=Px+}oukgL;R!DSzWUy=-lD zzSl!P^RbkIyjM-9{j%KQ$#Q&y!EcTDXhQ@1ol)Zyo12@fTb&;E988DvUVJmdi4<&% z0*^ApSJ&1yYc;Uz=)DL0J?~w^EZf`bn;TnQ9{Q{j)1s(?Zp|kWiYyNWvJBs#>^5zE z+dx?$0=~mzQ+%L(#I`r+%74RREUDzfVhU~=zm)L64YQk#W&_r(4eoA#ME3VNZdNffgZQ4gPY`?Q;NT;})39W#>=)B` zzbAuHKW;k1w@vT?8wTSI>oeeA>g|20%>W%1wt8{p>JYw{@UcX8Jbw#6fIqswkNDw% z5g$TfU|4{Eu4kGDE<7k4^?LBvLvpUes{$VJjrzy4$x$E0JGTmlX7`h6G}Vp~KRG%1 z+!(v!;P43U7JLk*@-cj#sJpu!xJ}@H1N(r>M}>oCwUGh*7&Xi^rr|I(~ zn$5yJxKE2Jr?BuAYJbf+{>pK4^;ymik4_^ZKEEaUtisPuHp}c?-?zeHO*O5}Bmw@_ zRO2M)XN9e&5ec8M_>isZ+34;N*k|W0&EsQ+eQ&}WCptO5D17VidjdC7M!yvg&E1CA=D0jRKRdf< z>a0%RHM$Ls{$;Im7Tb*P?Xz2m&*duK9lyXuzq;^?%jIe_s&rK@yMF}#PhFL-exzWJEdvO*XhDtdw$D`0Mxajt`UA2pl+TpNVtw<0iT-S8m75tINweBW*rHaQkD=)Q5({;UE zDpg@`iuAy?rC8Akp+5Z4+@+E(v>JWY1}7CduA*096Y#*cMF5sm5hsF1Zo}KHoRo-O zBGsy1p$7vm>uv$x4kA=>zp8CkUb+p3zpy!^L=XHFZhsW+7twXCRK~q)jh7i-`U#;8 zxEtQs`wwk_ScD3Gd+%LeSBPM-xGUH2?R{6N5aO~}WKtC>_ntt=KNjqYxbHn8fc-C# z)5T3TCdbAA001R)MObuXVRU6WV{&C-bY%cCFflnTFflDLIaDw+IyE;sG%+hMFgh?W zRZ)g<05AXmC3HntbYx+4WjbwdWNBu305UK!IV~_TEipM%Ff%$eH##&iD=;uRFfb$x TKFyIKCkg-nNkvXXu0mjfg|$eC literal 3110 zcmc&$c{tShAD_}sQ;80>NijxNYci)XhZ$lHM??+fh-S=uG0PlgMn;HAj!-G3+OQoe zD%Cp5Qm#r!l%pN@v7u%i6T=kcH#&CrkA3!eet-Qw&-49$j_37yz0c40`6jt-w_m<= z{ZbGJwA|5wx>G&xQ9l-74fPv&=C-eT(v#3UB@97;B%CDzK(-u#KLBy$u>yge0E-h5 zS__asAPqmRyQjp{#hJ(!@ZhX@3|z_+s@WhA$wn$OH{Atj}cJF zXNV-24E^Gir;8heA`k%(EF5XhMp_~vmMAz1V}Zlrwm{HG6cT|%BT#5_6pn~N6Ol;B z*8x>q6LA8FJE`=qw$wW^G)N*55)p{-@NjrI1}+cbf+G<;-h5o2 z(PGI?;4e4+5iNF)5CVvufLIVFVyo*BVEm1&&fUKong^=AA-amV>Y}hhr~-Bv58z82 zsbpwa7?(rDV{9#OSQG(C#aU3PD3l!?WkEq%5@_ly(D7K>H-Wzs)sk?InoFC9;VEca zG}aD(7P6bm=Lo{Z^OgA$C>0QK_W>NbNWg=9PA!r957sRRb_5(2hoNCH zR2oJdHJ(PNSYl`tEYi}Bf}=pcaykEVx)5ql5c5s(wWu{ z%X0(99%Z&$w{E^N64$JHS6?KEZ#Z!8?LGLtC=Dr;aL_z%@{jnc0diNNnU=qr!+mhVbXay$~ypxyY%1<+$ zDyNe|@Fu4Q(3jqr_*QH=JuuzhIudJPb#oNrR`NF3aPa(*O-Y^BzfQsKOpaa=8wJ+< zK)Jo;{NRj2eztFxu&c!0uM~DfW_9Haj90fQPPXHGk7Zi7N#+~$^^u0QQFPQxn1A() zv5)9mic{hCsIcdxz-mU>gzvQ-Sp7t}Q2e?%v9IMK#%UtY=G1n^o4Jp-q0L zFTOqf;I)BS)1Vs5d&-y3s~Q^{hlhulOlDVC*T~4o*x1OdqJEm4Jok!S= z)hHClYEPN|9)8C3M16gI53(_6f28@^YZD`>_{_D*IlFayw$=YUyGpkLEbBl44!Py! zb88KRL+#H~rEQ;b<&Eokbcz$FCf)QSNg9x;xPPZ$wXoi&u@5H@KctDT>kn_Iv#|x0 z#x~Ar`T6k7vAqcu9c(sRH{qeqo?SMn8;zS5Ey7MNnOxs3OTxR8BMwy&UqP>iWElAF zwcqfvq*cC0?5k=BDCoJJXI7wb!qXZ2x_jY6WymrBe2Y1`$_^ahB76M!@%i#Nuf4}> z^!Q#@g&!I|B`=F1W?tPFE4zF4t#^TEadEMhgmerY$4=G?%$?Y_E%a&a8QP3yv=88= z9ls{B%I`9JLFEmCd5SfGpjWL7-BkyGd+qJ*_slJuSXf}8GwWFQ%YbrbS)Hj%v-Tws zK5YfwV8xR_jx@6<>Zxk$*Y6%7dcAsMX<_pSqDqo?z@z-m@ySNv!k^TojT!QSMPYg zumm!>yvOrK+eB#Jg;IxRvztQ=e4Fb7MdZOC&DgzLJF~Q#OCKAWt{=Hf!^_i}<2aJ5{yy1n(lWHPcp#_I%*Y75bU2GcG!JgSSX41? zTgPuAbvNx;yJCUiAj>D}T10|u-IdJ6ah`75HRF(-7I5sy5&eKNCft)8c(}7mT0;qr zxLsX6lQ_nXU(V8x3Y2aIKV96;M;pb(dOS1xW99mdukY`8yiV`YbZW#Bmf%+YL$-9G z_f!zv=-_l@lVD$8liovC>~1f;7I|B6g<)I4+?`?#PIGi|LMALhYTg%|^apK$b!-+h&!Z!Cj-R0YzyG%5+|`9HNt5rbX^F zQrgdrtHl>V)4iKhz5L>z_*}ID|Th(rrg|N-k(OltVwW0lV{*tOV`N>2^<#Fm!|D;4qLxT>9A9szT z?qg9-|6$plW)1!NB9~2ZAI9y?Jk0zbdMG{gFZ>pi=~7s^V!YzX$;D?>D@-GjI^*xj zFSsXq8d+xtU0%Eqk(@*F(>^)fR~E%1-tLUA-n&jaw@Jh1$lnW)0R$MBtjVIwaiv+z$A1`yBz5g>5}j(?L)ng22QF-$gP@dp4b C;0n$F delta 73 zcmeys(Zb2=?&)S>nW)0R$MBuOa3e1xv-&>?=c3falFa-(g^ Date: Sat, 14 Mar 2020 06:09:19 -0400 Subject: [PATCH 051/154] updates --- README.md | 12 +- admin/about.php | 12 +- admin/admin_footer.php | 14 +- admin/admin_header.php | 33 +- admin/do_channel.php | 74 ++-- admin/do_intro.php | 62 ++- admin/do_plugins.php | 271 +++++++------ admin/do_sticky.php | 64 ++- admin/do_subfeeds.php | 148 +++---- admin/index.php | 38 +- admin/menu.php | 27 +- admin/migrate.php | 97 +++++ class/Common/Breadcrumb.php | 16 +- class/Common/Configurator.php | 15 +- class/Common/FilesManagement.php | 30 +- class/Common/Migrate.php | 118 ++++++ class/Common/ServerStats.php | 10 +- class/Common/SysUtility.php | 194 +++++++++ class/Common/VersionChecks.php | 100 ++++- class/Constants.php | 54 +++ class/{rssfeed.php => FeedHandler.php} | 321 ++++++++++----- class/Helper.php | 32 +- class/Misc.php | 59 +++ class/MiscHandler.php | 289 ++++++++++++++ class/Plugin.php | 51 +++ class/PluginHandler.php | 370 ++++++++++++++++++ class/Plugins/00/Comments.php | 109 ++++++ class/Plugins/Adslight.php | 82 ++++ class/Plugins/Ams.php | 83 ++++ class/Plugins/Apcal.php | 82 ++++ class/Plugins/Buyersguide.php | 88 +++++ class/Plugins/Buyersguidemanufacturers.php | 84 ++++ class/Plugins/Buyersguidenews.php | 84 ++++ class/Plugins/Cbb.php | 117 ++++++ class/Plugins/Extcal.php | 138 +++++++ class/Plugins/Lexikon.php | 97 +++++ class/Plugins/Myalbum.php | 160 ++++++++ class/Plugins/Mydownloads.php | 83 ++++ class/Plugins/Mylinks.php | 84 ++++ class/Plugins/Mytube.php | 83 ++++ class/Plugins/Newbb.php | 96 +++++ class/Plugins/Newbb2.php | 150 +++++++ class/Plugins/News.php | 92 +++++ .../Plugins/Oledrion.php | 59 +-- class/Plugins/Pical.php | 82 ++++ class/Plugins/Publisher.php | 85 ++++ class/Plugins/Queries.php | 101 +++++ class/Plugins/Rmdp.php | 83 ++++ class/Plugins/Sample.php | 123 ++++++ class/Plugins/Smartfaq.php | 91 +++++ class/Plugins/Smartpartner.php | 81 ++++ class/Plugins/Smartsection.php | 81 ++++ class/Plugins/Special.php | 101 +++++ class/Plugins/Surnames.php | 145 +++++++ class/Plugins/Weblinks.php | 116 ++++++ class/Plugins/Wfdownloads.php | 89 +++++ class/Plugins/Wfdownloads_podcast.php | 99 +++++ class/Plugins/Wflinks.php | 97 +++++ class/Plugins/Wfsection.php | 99 +++++ class/Plugins/Wfsection2.php | 86 ++++ class/Plugins/Xoopstube.php | 83 ++++ class/Utility.php | 82 +++- class/misc.php | 245 ------------ class/plugins.php | 306 --------------- config/admin.yml | 1 + config/config.php | 88 +++++ config/index.html | 1 + config/paths.php | 24 ++ docs/changelog.txt | 11 +- docs/lang_diff.txt | 2 +- docs/license.txt | 14 +- docs/readme.txt | 2 +- header.php | 49 +-- include/common.php | 176 ++++++--- include/common0.php | 41 ++ include/config.php | 80 ---- include/functions.php | 87 ++-- include/install.php | 191 ++++----- include/oninstall.php | 57 ++- include/onuninstall.php | 19 +- include/onupdate.php | 57 ++- index.php | 74 ++-- language/english/common.php | 113 +++++- language/english/help/help.tpl | 14 +- language/english/modinfo.php | 7 +- plugins/rssfit.adslight.php | 84 ---- plugins/rssfit.ams.php | 77 ---- plugins/rssfit.buyersguide.php | 90 ----- plugins/rssfit.buyersguidemanufacturers.php | 85 ---- plugins/rssfit.buyersguidenews.php | 85 ---- plugins/rssfit.cbb.php | 102 ----- plugins/rssfit.comments.php | 88 ----- plugins/rssfit.extcal.php | 133 ------- plugins/rssfit.lexikon.php | 100 ----- plugins/rssfit.myalbum.php | 151 ------- plugins/rssfit.mydownloads.php | 83 ---- plugins/rssfit.mylinks.php | 81 ---- plugins/rssfit.mytube.php | 87 ---- plugins/rssfit.newbb.php | 85 ---- plugins/rssfit.newbb2.php | 130 ------ plugins/rssfit.news.php | 85 ---- plugins/rssfit.pical.php | 85 ---- plugins/rssfit.pluginsample.php | 121 ------ plugins/rssfit.publisher.php | 78 ---- plugins/rssfit.queries.php | 100 ----- plugins/rssfit.rmdp.php | 85 ---- plugins/rssfit.smartfaq.php | 86 ---- plugins/rssfit.smartpartner.php | 76 ---- plugins/rssfit.smartsection.php | 76 ---- plugins/rssfit.special.php | 99 ----- plugins/rssfit.surnames.php | 139 ------- plugins/rssfit.weblinks.php | 108 ----- plugins/rssfit.wfdownloads.php | 85 ---- plugins/rssfit.wfdownloads_podcast.php | 97 ----- plugins/rssfit.wflinks.php | 69 ---- plugins/rssfit.wfsection.php | 90 ----- plugins/rssfit.wfsection2.php | 81 ---- plugins/rssfit.xoopstube.php | 87 ---- preloads/autoloader.php | 12 +- preloads/core.php | 9 +- rss.css | 102 ++--- rss.php | 94 ++--- templates/rssfit_rss.tpl | 40 +- testdata/index.php | 105 ++++- xoops_version.php | 90 +++-- 125 files changed, 6365 insertions(+), 4860 deletions(-) create mode 100644 admin/migrate.php create mode 100644 class/Common/Migrate.php create mode 100644 class/Common/SysUtility.php create mode 100644 class/Constants.php rename class/{rssfeed.php => FeedHandler.php} (57%) create mode 100644 class/Misc.php create mode 100644 class/MiscHandler.php create mode 100644 class/Plugin.php create mode 100644 class/PluginHandler.php create mode 100644 class/Plugins/00/Comments.php create mode 100644 class/Plugins/Adslight.php create mode 100644 class/Plugins/Ams.php create mode 100644 class/Plugins/Apcal.php create mode 100644 class/Plugins/Buyersguide.php create mode 100644 class/Plugins/Buyersguidemanufacturers.php create mode 100644 class/Plugins/Buyersguidenews.php create mode 100644 class/Plugins/Cbb.php create mode 100644 class/Plugins/Extcal.php create mode 100644 class/Plugins/Lexikon.php create mode 100644 class/Plugins/Myalbum.php create mode 100644 class/Plugins/Mydownloads.php create mode 100644 class/Plugins/Mylinks.php create mode 100644 class/Plugins/Mytube.php create mode 100644 class/Plugins/Newbb.php create mode 100644 class/Plugins/Newbb2.php create mode 100644 class/Plugins/News.php rename plugins/rssfit.oledrion.php => class/Plugins/Oledrion.php (52%) create mode 100644 class/Plugins/Pical.php create mode 100644 class/Plugins/Publisher.php create mode 100644 class/Plugins/Queries.php create mode 100644 class/Plugins/Rmdp.php create mode 100644 class/Plugins/Sample.php create mode 100644 class/Plugins/Smartfaq.php create mode 100644 class/Plugins/Smartpartner.php create mode 100644 class/Plugins/Smartsection.php create mode 100644 class/Plugins/Special.php create mode 100644 class/Plugins/Surnames.php create mode 100644 class/Plugins/Weblinks.php create mode 100644 class/Plugins/Wfdownloads.php create mode 100644 class/Plugins/Wfdownloads_podcast.php create mode 100644 class/Plugins/Wflinks.php create mode 100644 class/Plugins/Wfsection.php create mode 100644 class/Plugins/Wfsection2.php create mode 100644 class/Plugins/Xoopstube.php delete mode 100644 class/misc.php delete mode 100644 class/plugins.php create mode 100644 config/admin.yml create mode 100644 config/config.php create mode 100644 config/index.html create mode 100644 config/paths.php create mode 100644 include/common0.php delete mode 100644 include/config.php delete mode 100644 plugins/rssfit.adslight.php delete mode 100644 plugins/rssfit.ams.php delete mode 100644 plugins/rssfit.buyersguide.php delete mode 100644 plugins/rssfit.buyersguidemanufacturers.php delete mode 100644 plugins/rssfit.buyersguidenews.php delete mode 100644 plugins/rssfit.cbb.php delete mode 100644 plugins/rssfit.comments.php delete mode 100644 plugins/rssfit.extcal.php delete mode 100644 plugins/rssfit.lexikon.php delete mode 100644 plugins/rssfit.myalbum.php delete mode 100644 plugins/rssfit.mydownloads.php delete mode 100644 plugins/rssfit.mylinks.php delete mode 100644 plugins/rssfit.mytube.php delete mode 100644 plugins/rssfit.newbb.php delete mode 100644 plugins/rssfit.newbb2.php delete mode 100644 plugins/rssfit.news.php delete mode 100644 plugins/rssfit.pical.php delete mode 100644 plugins/rssfit.pluginsample.php delete mode 100644 plugins/rssfit.publisher.php delete mode 100644 plugins/rssfit.queries.php delete mode 100644 plugins/rssfit.rmdp.php delete mode 100644 plugins/rssfit.smartfaq.php delete mode 100644 plugins/rssfit.smartpartner.php delete mode 100644 plugins/rssfit.smartsection.php delete mode 100644 plugins/rssfit.special.php delete mode 100644 plugins/rssfit.surnames.php delete mode 100644 plugins/rssfit.weblinks.php delete mode 100644 plugins/rssfit.wfdownloads.php delete mode 100644 plugins/rssfit.wfdownloads_podcast.php delete mode 100644 plugins/rssfit.wflinks.php delete mode 100644 plugins/rssfit.wfsection.php delete mode 100644 plugins/rssfit.wfsection2.php delete mode 100644 plugins/rssfit.xoopstube.php diff --git a/README.md b/README.md index d934d3de..8eb1283b 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,19 @@ ![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png) ## RSSFit module for [XOOPS CMS 2.5.9+](https://xoops.org) [![XOOPS CMS Module](https://img.shields.io/badge/XOOPS%20CMS-Module-blue.svg)](https://xoops.org) -[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html) +[![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](https://www.gnu.org/licenses/gpl-2.0.html) -[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/XoopsModules25x/rss.svg?style=flat)](https://scrutinizer-ci.com/g/XoopsModules25x/rss/?branch=master) +[![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/XoopsModules25x/rss.svg?style=flat)](https://scrutinizer-ci.com/g/XoopsModules25x/rssfit/?branch=master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/95b12220e0ac4056b9af52af708379c9)](https://www.codacy.com/app/mambax7/rss_2) [![Code Climate](https://img.shields.io/codeclimate/github/XoopsModules25x/rss.svg?style=flat)](https://codeclimate.com/github/XoopsModules25x/rss) [![SensioLabsInsight](https://insight.sensiolabs.com/projects/f4ebd84f-65c1-4947-afb8-319b60824d2e/mini.png)](https://insight.sensiolabs.com/projects/f4ebd84f-65c1-4947-afb8-319b60824d2e) -[![Latest Pre-Release](https://img.shields.io/github/tag/XoopsModules25x/rss.svg?style=flat)](https://github.com/XoopsModules25x/rss/tags/) -[![Latest Version](https://img.shields.io/github/release/XoopsModules25x/rss.svg?style=flat)](https://github.com/XoopsModules25x/rss/releases/) +[![Latest Pre-Release](https://img.shields.io/github/tag/XoopsModules25x/rss.svg?style=flat)](https://github.com/XoopsModules25x/rssfit/tags/) +[![Latest Version](https://img.shields.io/github/release/XoopsModules25x/rss.svg?style=flat)](https://github.com/XoopsModules25x/rssfit/releases/) **RSSFit** module for [XOOPS CMS](https://xoops.org) is a module for XOOPS generates RSS 2.0 validated XML feed. Web masters can decide what to be displayed in the XML output by activating installed plug-ins. -[![Tutorial Available](https://xoops.org/images/tutorial-available-blue.svg)](https://www.gitbook.com/book/xoops/rss-tutorial/) Tutorial: see [GitBook](https://www.gitbook.com/book/xoops/rss-tutorial/). -To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/rss-tutorial) +[![Tutorial Available](https://xoops.org/images/tutorial-available-blue.svg)](https://xoops.gitbook.io/rssfit-tutorial/) Tutorial: see [GitBook](https://xoops.gitbook.io/rssfit-tutorial/). +To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/rssfit-tutorial) [![Translations on Transifex](https://xoops.org/images/translations-transifex-blue.svg)](https://www.transifex.com/xoops) diff --git a/admin/about.php b/admin/about.php index f343645d..7e8956fe 100644 --- a/admin/about.php +++ b/admin/about.php @@ -13,18 +13,16 @@ /** * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package * @since - * @author XOOPS Development Team + * @author XOOPS Development Team */ require_once __DIR__ . '/admin_header.php'; -$moduleAdmin = Admin::getInstance(); - -$moduleAdmin->displayNavigation(basename(__FILE__)); -Admin::setPaypal('xoopsfoundation@gmail.com'); -$moduleAdmin->displayAbout(false); +$adminObject->displayNavigation(basename(__FILE__)); +$adminObject::setPaypal('xoopsfoundation@gmail.com'); +$adminObject->displayAbout(false); require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_footer.php b/admin/admin_footer.php index f317cca3..9865c38e 100644 --- a/admin/admin_footer.php +++ b/admin/admin_footer.php @@ -11,19 +11,13 @@ /** * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package * @since - * @author XOOPS Development Team + * @author XOOPS Development Team */ +$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); -$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); - -echo "
\n" - ."
\n" - ." XOOPS\n" - ."
\n" - .' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" - .'
'; +echo "
\n" . "
\n" . " XOOPS\n" . "
\n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '
'; xoops_cp_footer(); diff --git a/admin/admin_header.php b/admin/admin_header.php index be54cc74..07e66815 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -13,34 +13,29 @@ /** * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package * @since - * @author XOOPS Development Team + * @author XOOPS Development Team */ +include dirname(__DIR__) . '/preloads/autoloader.php'; -$path = dirname(dirname(dirname(__DIR__))); -require_once $path . '/mainfile.php'; -require_once $path . '/include/cp_functions.php'; -require_once $path . '/include/cp_header.php'; +require dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; +require dirname(__DIR__) . '/include/common.php'; -class_exists(Admin::class) || exit('XMF is required.'); +$moduleDirName = basename(dirname(__DIR__)); -global $xoopsModule; +$helper = \XoopsModules\Rssfit\Helper::getInstance(); -$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname'); +/** @var \Xmf\Module\Admin $adminObject */ +$adminObject = \Xmf\Module\Admin::getInstance(); + +//$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname'); // Load language files -\Xmf\Language::load('main', $thisModuleDir); -//\Xmf\Language::load('modinfo', $thisModuleDir); +$helper->loadLanguage('admin'); +$helper->loadLanguage('modinfo'); +$helper->loadLanguage('common'); xoops_cp_header(); - -//if functions.php file exist -require_once dirname(__DIR__) . '/include/common.php'; -//require dirname(__DIR__) . '/include/common.php'; - -global $xoopsModule; - -$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname'); diff --git a/admin/do_channel.php b/admin/do_channel.php index fa322696..4bc9e4ae 100644 --- a/admin/do_channel.php +++ b/admin/do_channel.php @@ -1,56 +1,43 @@ ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### +/* + * 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. + */ + +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @package RSSFit - Extendable XML news feed generator + * @author NS Tai (aka tuff) + * @author XOOPS Development Team + */ use Xmf\Request; -use XoopsModules\Rss; +use XoopsModules\Rssfit; -if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { +if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { header('Location: index.php'); } + + switch ($op) { default: - $elements = $rss->mHandler->getObjects(new \Criteria('misc_category', 'channel'), '*', 'title'); - $img = $rss->mHandler->getObjects(new \Criteria('misc_category', 'channelimg'), '*', 'title'); + $elements = $feedHandler->miscHandler->getObjects2(new \Criteria('misc_category', 'channel'), '*', 'title'); + $img = $feedHandler->miscHandler->getObjects2(new \Criteria('misc_category', 'channelimg'), '*', 'title'); if (!empty($elements) && !empty($img)) { $form = new \XoopsThemeForm(_AM_EDIT_CHANNEL, 'editchannel', RSSFIT_ADMIN_URL); - $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_REQUIRED . ' ' . rss\Utility::genSpecMoreInfo('req', $rss))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_REQUIRED . ' ' . Rssfit\Utility::genSpecMoreInfo('req', $feedHandler))); $form->addElement(new \XoopsFormText('title', 'ele[' . $elements['title']->getVar('misc_id') . ']', 50, 255, $elements['title']->getVar('misc_content', 'e')), true); $form->addElement(new \XoopsFormText('link', 'ele[' . $elements['link']->getVar('misc_id') . ']', 50, 255, $elements['link']->getVar('misc_content', 'e')), true); $form->addElement(new \XoopsFormTextArea('description', 'ele[' . $elements['description']->getVar('misc_id') . ']', $elements['description']->getVar('misc_content', 'e')), true); - $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_OPTIONAL . ' ' . rss\Utility::genSpecMoreInfo('opt', $rss))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_OPTIONAL . ' ' . Rssfit\Utility::genSpecMoreInfo('opt', $feedHandler))); $form->addElement(new \XoopsFormText('copyright', 'ele[' . $elements['copyright']->getVar('misc_id') . ']', 50, 255, $elements['copyright']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('managingEditor', 'ele[' . $elements['managingEditor']->getVar('misc_id') . ']', 50, 255, $elements['managingEditor']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('webMaster', 'ele[' . $elements['webMaster']->getVar('misc_id') . ']', 50, 255, $elements['webMaster']->getVar('misc_content', 'e'))); @@ -58,7 +45,7 @@ $form->addElement(new \XoopsFormText('generator', 'ele[' . $elements['generator']->getVar('misc_id') . ']', 50, 255, $elements['generator']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('docs', 'ele[' . $elements['docs']->getVar('misc_id') . ']', 50, 255, $elements['docs']->getVar('misc_content', 'e'))); - $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_IMAGE . ' ' . rss\Utility::genSpecMoreInfo('img', $rss))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_IMAGE . ' ' . Rssfit\Utility::genSpecMoreInfo('img', $feedHandler))); $form->addElement(new \XoopsFormText('url', 'ele[' . $img['url']->getVar('misc_id') . ']', 50, 255, $img['url']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('link', 'ele[' . $img['link']->getVar('misc_id') . ']', 50, 255, $img['link']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('title', 'ele[' . $img['title']->getVar('misc_id') . ']', 50, 255, $img['title']->getVar('misc_content', 'e'))); @@ -72,13 +59,14 @@ } break; case 'save': - $ele = Request::getArray('ele', null, 'POST'); - $ids = array_keys($ele); + $ele = Request::getArray('ele', null, 'POST'); + $ids = array_keys($ele); $errors = []; foreach ($ids as $i) { $criteria = new \Criteria('misc_id', $i); - $fields = ['misc_content' => trim($ele[$i])]; - if ($err = $rss->mHandler->modifyObjects($criteria, $fields)) { + $fields = ['misc_content' => trim($ele[$i])]; + $err = $feedHandler->miscHandler->modifyObjects($criteria, $fields); + if ($err) { $errors[] = $err; } } diff --git a/admin/do_intro.php b/admin/do_intro.php index 85ec2dda..e286a3ea 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -1,42 +1,31 @@ ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### +/* + * 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. + */ -if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @package RSSFit - Extendable XML news feed generator + * @author NS Tai (aka tuff) + * @author XOOPS Development Team + */ + +use Xmf\Request; +use XoopsModules\Rssfit; + +if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { header('Location: index.php'); } -if ($intr = $miscHandler->getObjects(new \Criteria('misc_category', 'intro'))) { +$intr = $miscHandler->getObjects2(new \Criteria('misc_category', 'intro')); +if ($intr) { $intro = $intr[0]; unset($intr); } else { @@ -47,7 +36,7 @@ $title = new \XoopsFormText(_AM_EDIT_INTRO_TITLE, 'title', 50, 255, $intro->getVar('misc_title', 'e')); $title->setDescription(_AM_EDIT_INTRO_TITLE_DESC); - $setting = $intro->getVar('misc_setting'); + $setting = $intro->getVar('misc_setting'); $tray_content = new \XoopsFormElementTray(_AM_EDIT_INTRO_TEXT, '
'); $tray_content->setDescription(_AM_EDIT_INTRO_TEXT_DESC . _AM_EDIT_INTRO_TEXT_DESC_SUB); $tray_content->addElement(new \XoopsFormDhtmlTextArea('', 'content', $intro->getVar('misc_content', 'e'), 15, 60)); @@ -70,7 +59,6 @@ $form->addElement(new \XoopsFormHidden('op', 'save')); $form->display(); break; - case 'save': $intro->setVar('misc_category', 'intro'); $intro->setVar('misc_title', trim($_POST['title'])); @@ -78,7 +66,7 @@ $setting = [ 'dohtml' => isset($_POST['dohtml']) ? 1 : 0, 'dobr' => isset($_POST['dobr']) ? 1 : 0, - 'sub' => isset($_POST['sub']) ? trim($_POST['sub']) : '' + 'sub' => isset($_POST['sub']) ? trim($_POST['sub']) : '', ]; $intro->setVar('misc_setting', $setting); if (false === $miscHandler->insert($intro)) { diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 162bca66..4383ab6a 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -1,82 +1,84 @@ ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### +/* + * 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 Xmf\Request; -use XoopsModules\Rss; +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @package RSSFit - Extendable XML news feed generator + * @author NS Tai (aka tuff) + * @author XOOPS Development Team + */ +use Xmf\Request; +use XoopsModules\Rssfit; -if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { +if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { header('Location: index.php'); } -/** @var Rss\Helper $helper */ -$helper = Rss\Helper::getInstance(); +$helper = Rssfit\Helper::getInstance(); switch ($op) { default: $ret = ''; // activated plugins $criteria = new \Criteria('rssf_activated', 1); - if ($plugins = $pluginsHandler->getObjects($criteria, 'p_activated')) { + $plugins = $pluginsHandler->getObjects2($criteria, 'p_activated'); + if ($plugins) { $ret .= "\n" - . "\n" - . "\n\n" - . "\n" - . "\n" - . "\n" - . "\n" - . "\n"; + . "\n" + . "\n\n" + . "\n" + . "\n" + . "\n" + . "\n" + . "\n"; foreach ($plugins as $p) { - if ($handler = $pluginsHandler->checkPlugin($p)) { - $id = $p->getVar('rssf_conf_id'); + $handler = $pluginsHandler->checkPlugin($p); + if ($handler) { + $id = $p->getVar('rssf_conf_id'); $entries = new \XoopsFormText('', 'rssf_grab[' . $id . ']', 3, 2, $p->getVar('rssf_grab')); - $order = new \XoopsFormText('', 'rssf_order[' . $id . ']', 3, 2, $p->getVar('rssf_order')); - $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); + $order = new \XoopsFormText('', 'rssf_order[' . $id . ']', 3, 2, $p->getVar('rssf_order')); + $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); $action->addOption('', _SELECT); $action->addOption('d', _AM_PLUGIN_DEACTIVATE); $action->addOption('u', _AM_PLUGIN_UNINSTALL); $ret .= "\n" - . "\n" - . "\n" - . "\n" - . "\n" - . "\n"; + . "\n" + . "\n" + . "\n" + . "\n" + . "\n"; $ret .= "\n"; } else { $pluginsHandler->forceDeactivate($p); @@ -86,22 +88,29 @@ } // inactive plugins - if ($plugins = $pluginsHandler->getObjects(new \Criteria('rssf_activated', 0), 'p_inactive')) { + $plugins = $pluginsHandler->getObjects2(new \Criteria('rssf_activated', 0), 'p_inactive'); + if ($plugins) { $ret .= "
\n
" . _AM_PLUGIN_ACTIVATED . "
" . _AM_PLUGIN_FILENAME . "" . _AM_PLUGIN_MODNAME . "" . _AM_PLUGIN_SHOWXENTRIES . "" . _AM_PLUGIN_ORDER . "" . _AM_ACTION . "
" + . _AM_PLUGIN_ACTIVATED + . "
" + . _AM_PLUGIN_FILENAME + . "" + . _AM_PLUGIN_MODNAME + . "" + . _AM_PLUGIN_SHOWXENTRIES + . "" + . _AM_PLUGIN_ORDER + . "" + . _AM_ACTION + . "
" - . $p->getVar('rssf_filename') . "" - . $handler->modname . "" - . $entries->render() . "" - . $order->render() . "" - . $action->render() . "" + . $p->getVar('rssf_filename') + . "" + . $handler->modname + . "" + . $entries->render() + . "" + . $order->render() + . "" + . $action->render() + . "
\n" - . "\n" - . "\n\n" - . "\n" - . "\n" - . "\n"; + . "\n" + . "\n\n" + . "\n" + . "\n" + . "\n"; foreach ($plugins as $p) { - $id = $p->getVar('rssf_conf_id'); + $id = $p->getVar('rssf_conf_id'); $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); $action->addOption('', _SELECT); - $ret .= "\n" - . "\n" - . "\n" . "\n" . "\n"; $action->addOption('u', _AM_PLUGIN_UNINSTALL); - $ret .= "\n"; + $ret .= "\n"; } $ret .= "
" . _AM_PLUGIN_INACTIVE . "
" . _AM_PLUGIN_FILENAME . "" . _AM_PLUGIN_MODNAME . "" . _AM_ACTION . "
" + . _AM_PLUGIN_INACTIVE + . "
" + . _AM_PLUGIN_FILENAME + . "" + . _AM_PLUGIN_MODNAME + . "" + . _AM_ACTION + . "
" - . $p->getVar('rssf_filename') . ""; - if ($handler = $pluginsHandler->checkPlugin($p)) { + $ret .= "
" . $p->getVar('rssf_filename') . ""; + $handler = $pluginsHandler->checkPlugin($p); + if ($handler) { $ret .= $handler->modname; $action->addOption('a', _AM_PLUGIN_ACTIVATE); } else { @@ -116,40 +125,52 @@ } $ret .= "" - . $action->render() . "" . $action->render() . "
\n"; } // Non-installed plugins - if (!$filelist =& $pluginsHandler->getPluginFileList()) { + if (!$filelist = &$pluginsHandler->getPluginFileList()) { $filelist = []; } - $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); + $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); + $list2 = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'class\Plugins'); $installable = []; + $installable2 = []; foreach ($list as $f) { - if (preg_match('/rssfit\.+[a-zA-Z0-9_]+\.php/', $f) && !in_array($f, $filelist)) { + if (preg_match('/rssfit\.+[a-zA-Z0-9_]+\.php/$', $f) && !in_array($f, $filelist)) { $installable[] = $f; } } - if (count($installable) > 0) { + foreach ($list2 as $f) { + if (preg_match('/[a-zA-Z0-9_]+\.php/$', ucfirst($f)) && !in_array($f, $filelist)) { + $installable2[] = ucfirst($f); + } + } + if (count($installable2) > 0) { $ret .= "
\n\n" - . "\n" - . "\n\n" - . "\n" - . "\n" - . "\n"; - foreach ($installable as $i) { + . "\n" + . "\n\n" + . "\n" + . "\n" + . "\n"; + foreach ($installable2 as $i) { $action = new \XoopsFormCheckbox('', 'install[' . $i . ']'); $action->addOption('i', ' '); - $ret .= "\n" - . "\n" - . "\n" . "\n" . "\n"; - $ret .= "\n"; + $ret .= "\n"; } $ret .= "
" . _AM_PLUGIN_NONINSTALLED . "
" . _AM_PLUGIN_FILENAME . "" . _AM_PLUGIN_MODNAME . "" . _AM_PLUGIN_INSTALL . "
" + . _AM_PLUGIN_NONINSTALLED + . "
" + . _AM_PLUGIN_FILENAME + . "" + . _AM_PLUGIN_MODNAME + . "" + . _AM_PLUGIN_INSTALL + . "
" - . $i . ""; - $p = $pluginsHandler->create(); + $ret .= "
" . $i . ""; + $p = $pluginsHandler->create(); $p->setVar('rssf_filename', $i); - if ($handler = $pluginsHandler->checkPlugin($p)) { + $handler = $pluginsHandler->checkPlugin($p); + if ($handler) { $ret .= $handler->modname; } else { if (count($p->getErrors()) > 0) { @@ -163,53 +184,58 @@ $action->setExtra('disabled="disabled"'); } $ret .= "" - . $action->render() . "" . $action->render() . "
\n"; } if (!empty($ret)) { $hidden = new \XoopsFormHidden('op', 'save'); - $ret = "\n" . $ret - . "
\n" - . $tray_save_cancel->render() . "\n" . $hidden->render() . "\n" - . $hidden_do->render() . "\n
"; + $ret = "
\n" + . $ret + . "
\n" + . $tray_save_cancel->render() + . "\n" + . $hidden->render() + . "\n" + . $hidden_do->render() + . "\n
"; echo $ret; } break; case 'save': - $rssf_grab = Request::getArray('rssf_grab', [], 'POST'); + $rssf_grab = Request::getArray('rssf_grab', [], 'POST'); $rssf_order = Request::getArray('rssf_order', [], 'POST'); - $action = Request::getArray('action', null, 'POST'); - $install = Request::getArray('install', [], 'POST'); - $err = ''; + $action = Request::getArray('action', null, 'POST'); + $install = Request::getArray('install', [], 'POST'); + $err = ''; if (isset($action)) { $keys = array_keys($action); foreach ($keys as $k) { $plugin = $pluginsHandler->get($k); - if (isset($rssf_grab[$k])) { - $plugin->setVar('rssf_grab', $rssf_grab[$k]); - $plugin->setVar('rssf_order', $rssf_order[$k]); - } - switch ($action[$k]) { - default: - $result = $pluginsHandler->insert($plugin); - break; - - case 'u': // uninstall - $result = $pluginsHandler->delete($plugin); - break; - - case 'd': // deactivate - $plugin->setVar('rssf_activated', 0); - $result = $pluginsHandler->insert($plugin); - break; - - case 'a': // activate - $plugin->setVar('rssf_activated', 1); - $result = $pluginsHandler->insert($plugin); - break; + if ($plugin) { + if (isset($rssf_grab[$k])) { + $plugin->setVar('rssf_grab', $rssf_grab[$k]); + $plugin->setVar('rssf_order', $rssf_order[$k]); + } + switch ($action[$k]) { + default: + $result = $pluginsHandler->insert($plugin); + break; + case 'u': // uninstall + $result = $pluginsHandler->delete($plugin); + break; + case 'd': // deactivate + $plugin->setVar('rssf_activated', 0); + $result = $pluginsHandler->insert($plugin); + break; + case 'a': // activate + $plugin->setVar('rssf_activated', 1); + $result = $pluginsHandler->insert($plugin); + break; + } } if (!$result) { $err .= $plugin->getHtmlErrors(); @@ -221,7 +247,8 @@ foreach ($files as $f) { $p = $pluginsHandler->create(); $p->setVar('rssf_filename', $f); - if ($handler = $pluginsHandler->checkPlugin($p)) { + $handler = $pluginsHandler->checkPlugin($p); + if ($handler) { $p->setVar('rssf_activated', 1); $p->setVar('rssf_grab', $helper->getConfig('plugin_entries')); $p->setVar('sub_entries', $helper->getConfig('plugin_entries')); diff --git a/admin/do_sticky.php b/admin/do_sticky.php index 52bd5eb4..235dc848 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -1,42 +1,31 @@ ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### +/* + * 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. + */ -if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @package RSSFit - Extendable XML news feed generator + * @author NS Tai (aka tuff) + * @author XOOPS Development Team + */ + +use Xmf\Request; +use XoopsModules\Rssfit; + +if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { header('Location: index.php'); } -if ($intr = $miscHandler->getObjects(new \Criteria('misc_category', 'sticky'))) { +$intr = $miscHandler->getObjects2(new \Criteria('misc_category', 'sticky')); +if ($intr) { $sticky = $intr[0]; unset($intr); } else { @@ -45,7 +34,7 @@ switch ($op) { default: $setting = $sticky->getVar('misc_setting'); - $title = new \XoopsFormText(_AM_STICKY_TITLE, 'title', 50, 255, $sticky->getVar('misc_title', 'e')); + $title = new \XoopsFormText(_AM_STICKY_TITLE, 'title', 50, 255, $sticky->getVar('misc_title', 'e')); $title->setDescription(_AM_EDIT_INTRO_TITLE_DESC); $tray_content = new \XoopsFormElementTray(_AM_STICKY_CONTENT, '
'); @@ -61,7 +50,7 @@ $link = new \XoopsFormText(_AM_STICKY_LINK, 'link', 50, 255, $myts->htmlSpecialChars($myts->stripSlashesGPC($setting['link']))); - $applyto = $rss->feedSelectBox(_AM_STICKY_APPLYTO, $setting['feeds'], 10); + $applyto = $feedHandler->feedSelectBox(_AM_STICKY_APPLYTO, $setting['feeds'], 10); $form = new \XoopsThemeForm(_AM_STICKY_EDIT, 'editsticky', RSSFIT_ADMIN_URL); $form->addElement($title); @@ -73,7 +62,6 @@ $form->addElement(new \XoopsFormHidden('op', 'save')); $form->display(); break; - case 'save': $sticky->setVar('misc_category', 'sticky'); $sticky->setVar('misc_title', trim($_POST['title'])); @@ -87,7 +75,7 @@ 'dohtml' => isset($_POST['dohtml']) ? 1 : 0, 'dobr' => isset($_POST['dobr']) ? 1 : 0, 'feeds' => $feeds, - 'link' => isset($_POST['link']) ? trim($_POST['link']) : '' + 'link' => isset($_POST['link']) ? trim($_POST['link']) : '', ]; $sticky->setVar('misc_setting', $setting, true); if (false === $miscHandler->insert($sticky)) { diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index ea966600..d812eb32 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -1,84 +1,95 @@ ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### +/* + * 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. + */ + +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @package RSSFit - Extendable XML news feed generator + * @author NS Tai (aka tuff) + * @author XOOPS Development Team + */ use Xmf\Request; -use XoopsModules\Rss; +use XoopsModules\Rssfit; -if (!preg_match('#/rss/admin/#', $_SERVER['PHP_SELF'])) { +if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { header('Location: index.php'); } switch ($op) { default: $ret = ''; - if ($plugins = $pluginsHandler->getObjects(null, 'sublist')) { + $plugins = $pluginsHandler->getObjects2(null, 'sublist'); + if ($plugins) { $ret .= "
\n\n" - . "\n" - . "\n\n" - . "\n" - . "\n" - . "\n" - . "\n"; + . "\n" + . "\n\n" + . "\n" + . "\n" + . "\n" + . "\n"; foreach ($plugins as $p) { $id = $p->getVar('rssf_conf_id'); if (!$handler = $pluginsHandler->checkPlugin($p)) { $pluginsHandler->forceDeactivate($p); - $mod = implode('
', $p->getErrors()); + $mod = implode('
', $p->getErrors()); $activate = new \XoopsFormCheckbox('', 'activate[' . $id . ']', 0); $activate->setExtra('disabled="disabled"'); - $config = ' '; - $urlLink = $rss->subFeedUrl($p->getVar('rssf_filename')); + $config = ' '; + $urlLink = $feedHandler->subFeedUrl($p->getVar('rssf_filename')); } else { - $mod = $handler->modname; + $mod = $handler->modname; $activate = new \XoopsFormCheckbox('', 'activate[' . $id . ']', $p->getVar('subfeed')); - $config = rss\Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_SUB_CONFIGURE); - $urlLink = '' . $rss->subFeedUrl($p->getVar('rssf_filename')) .''; + $config = Rssfit\Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_SUB_CONFIGURE); + $urlLink = '' . $feedHandler->subFeedUrl($p->getVar('rssf_filename')) . ''; } $activate->addOption(1, ' '); $ret .= "\n" - . "\n" - . "\n" - . "\n" - . "\n"; + . "\n" + . "\n" + . "\n" + . "\n"; $ret .= "\n"; } - $ret .= "
" . _AM_SUB_LIST . "
" . _AM_SUB_FILENAME_URL . "" . _AM_PLUGIN_MODNAME . "" . _AM_SUB_ACTIVATE . " 
" + . _AM_SUB_LIST + . "
" + . _AM_SUB_FILENAME_URL + . "" + . _AM_PLUGIN_MODNAME + . "" + . _AM_SUB_ACTIVATE + . " 
" . $p->getVar('rssf_filename') . '
' . $urlLink . "
" . $mod . "" . $activate->render() . "" . $config . "" + . $p->getVar('rssf_filename') + . '
' + . $urlLink + . "
" + . $mod + . "" + . $activate->render() + . "" + . $config + . "
\n"; + $ret .= "
\n"; $hidden = new \XoopsFormHidden('op', 'save'); - $ret = "
\n" . $ret - . "
\n" - . $tray_save_cancel->render() . "\n" . $hidden->render() . "\n" - . $hidden_do->render() . "\n
"; + $ret = "
\n" + . $ret + . "
\n" + . $tray_save_cancel->render() + . "\n" + . $hidden->render() + . "\n" + . $hidden_do->render() + . "\n
"; echo $ret; } else { echo '

' . _AM_PLUGIN_NONE . '

'; @@ -87,10 +98,11 @@ case 'save': $activate = Request::getArray('activate', null, 'POST'); - if ($plugins = $pluginsHandler->getObjects(null, 'sublist')) { + $plugins = $pluginsHandler->getObjects2(null, 'sublist'); + if ($plugins) { $pluginsHandler->modifyObjects(null, ['subfeed' => 0]); if (isset($activate) && is_array($activate) && count($activate) > 0) { - $keys = array_keys($activate); + $keys = array_keys($activate); $criteria = new \Criteria('rssf_conf_id', '(' . implode(',', $keys) . ')', 'IN'); $pluginsHandler->modifyObjects($criteria, ['subfeed' => 1]); } @@ -114,12 +126,12 @@ $form->addElement(new \XoopsFormRadioYN(_AM_SUB_ACTIVATE, 'subfeed', $sub->getVar('subfeed'))); $form->addElement(new \XoopsFormText(_AM_PLUGIN_SHOWXENTRIES, 'sub_entries', 3, 2, $sub->getVar('sub_entries')), true); - $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_REQUIRED . ' ' . rss\Utility::genSpecMoreInfo('req', $rss))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_REQUIRED . ' ' . Rssfit\Utility::genSpecMoreInfo('req', $feedHandler))); $form->addElement(new \XoopsFormText('title', 'sub_title', 50, 255, $sub->getVar('sub_title', 'e')), true); $form->addElement(new \XoopsFormText('link', 'sub_link', 50, 255, $sub->getVar('sub_link', 'e')), true); $form->addElement(new \XoopsFormTextArea('description', 'sub_desc', $sub->getVar('sub_desc', 'e')), true); - $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_IMAGE . ' ' . rss\Utility::genSpecMoreInfo('img', $rss))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_IMAGE . ' ' . Rssfit\Utility::genSpecMoreInfo('img', $feedHandler))); $form->addElement(new \XoopsFormText('url', 'img_url', 50, 255, $sub->getVar('img_url', 'e'))); $form->addElement(new \XoopsFormText('link', 'img_link', 50, 255, $sub->getVar('img_link', 'e'))); $form->addElement(new \XoopsFormText('title', 'img_title', 50, 255, $sub->getVar('img_title', 'e'))); @@ -142,16 +154,16 @@ redirect_header(RSSFIT_ADMIN_URL, 0, _AM_SUB_PLUGIN_NONE); } - $subfeed = Request::getBool('subfeed', false, 'POST'); + $subfeed = Request::getBool('subfeed', false, 'POST'); $sub_entries = Request::getInt('sub_entries', 5, 'POST'); - $sub_title = Request::getString('sub_title', '', 'POST'); - $sub_link = Request::getUrl('sub_link', '', 'POST'); - $sub_desc = Request::getString('sub_desc', '', 'POST'); - $img_url = Request::getUrl('img_url', '', 'POST'); - $img_link = Request::getUrl('img_link', '', 'POST'); - $img_title = Request::getString('img_title', '', 'POST'); + $sub_title = Request::getString('sub_title', '', 'POST'); + $sub_link = Request::getUrl('sub_link', '', 'POST'); + $sub_desc = Request::getString('sub_desc', '', 'POST'); + $img_url = Request::getUrl('img_url', '', 'POST'); + $img_link = Request::getUrl('img_link', '', 'POST'); + $img_title = Request::getString('img_title', '', 'POST'); - $sub->setVar('subfeed', (int) $subfeed); + $sub->setVar('subfeed', (int)$subfeed); $sub->setVar('sub_entries', $sub_entries); $sub->setVar('sub_title', $sub_title); $sub->setVar('sub_link', $sub_link); diff --git a/admin/index.php b/admin/index.php index 8930274b..36f22a3f 100644 --- a/admin/index.php +++ b/admin/index.php @@ -9,39 +9,45 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -use Xmf\Request; - /** * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package * @since * @author XOOPS Development Team */ +use Xmf\Request; +use XoopsModules\Rssfit\Common; require_once __DIR__ . '/admin_header.php'; -$moduleAdmin = \Xmf\Module\Admin::getInstance(); -$do = Request::getString('do', ''); -$op = Request::getString('op', 'list'); -define('RSSFIT_OK', 1); +$do = isset($_GET['do']) ? trim($_GET['do']) : ''; +$do = isset($_POST['do']) ? trim($_POST['do']) : $do; +$op = isset($_GET['op']) ? trim($_GET['op']) : 'list'; +$op = isset($_POST['op']) ? trim($_POST['op']) : $op; + +//$do = \Xmf\Request::getString('do', ''); +//$op = \Xmf\Request::getString('op', \Xmf\Request::getString('op', 'list', 'GET'), 'POST'); +//define('RSSFIT_OK', 1); + +//$adminObject = \Xmf\Module\Admin::getInstance(); -if (file_exists(RSSFIT_ROOT_PATH.'admin/do_'.$do.'.php')) { - require_once XOOPS_ROOT_PATH.'/class/xoopsformloader.php'; - $hidden_do = new \XoopsFormHidden('do', $do); - $button_save = new \XoopsFormButton('', 'submit', _AM_SAVE, 'submit'); - $button_go = new \XoopsFormButton('', 'submit', _GO, 'submit'); +if (file_exists(RSSFIT_ROOT_PATH . 'admin/do_' . $do . '.php')) { + include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + $hidden_do = new \XoopsFormHidden('do', $do); + $button_save = new \XoopsFormButton('', 'submit', _AM_SAVE, 'submit'); + $button_go = new \XoopsFormButton('', 'submit', _GO, 'submit'); $button_cancel = new \XoopsFormButton('', 'cancel', _CANCEL); $button_cancel->setExtra('onclick="javascript:history.go(-1)"'); $tray_save_cancel = new \XoopsFormElementTray('', ''); $tray_save_cancel->addElement($button_save); $tray_save_cancel->addElement($button_cancel); - $moduleAdmin->displayNavigation('?do=' . $do); - require RSSFIT_ROOT_PATH.'admin/do_'.$do.'.php'; + $adminObject->displayNavigation('?do=' . $do); + require RSSFIT_ROOT_PATH . 'admin/do_' . $do . '.php'; } else { - $moduleAdmin->displayNavigation(basename(__FILE__)); - $moduleAdmin->displayIndex(); + $adminObject->displayNavigation(basename(__FILE__)); + $adminObject->displayIndex(); } require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/menu.php b/admin/menu.php index 00afea4e..e4bdbcf7 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -11,20 +11,29 @@ /** * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit * @since * @author XOOPS Development Team */ -use XoopsModules\Rss; +use XoopsModules\Rssfit; -// require_once dirname(__DIR__) . '/class/Helper.php'; //require_once dirname(__DIR__) . '/include/common.php'; -$helper = rss\Helper::getInstance(); + +$moduleDirName = basename(dirname(__DIR__)); +$moduleDirNameUpper = mb_strtoupper($moduleDirName); + +$helper = \XoopsModules\Rssfit\Helper::getInstance(); +$helper->loadLanguage('common'); +$helper->loadLanguage('feedback'); + + // get path to icons $pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); -$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); +if (is_object($helper->getModule())) { + $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); +} $adminmenu = []; @@ -68,6 +77,14 @@ 'icon' => $pathIcon32 . '/attach.png', ]; +if ($helper->getConfig('displayDeveloperTools')) { + $adminmenu[] = [ + 'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE'), + 'link' => 'admin/migrate.php', + 'icon' => $pathIcon32 . '/database_go.png', + ]; +} + $adminmenu[] = [ 'title' => _MI_RSSFIT_ABOUT, 'link' => 'admin/about.php', diff --git a/admin/migrate.php b/admin/migrate.php new file mode 100644 index 00000000..b472f445 --- /dev/null +++ b/admin/migrate.php @@ -0,0 +1,97 @@ + // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// 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. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // +// Author: Kazumi Ono (AKA onokazu) // +// URL: http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ // +// Project: XOOPS Project // +// ------------------------------------------------------------------------- // + +use Xmf\Request; +use XoopsModules\Rssfit; + +require_once __DIR__ . '/admin_header.php'; + +$adminObject->displayNavigation(basename(__FILE__)); + +echo << +
+ +
+
+ +
+
+ +
+ +EOF; + +//XoopsLoad::load('migrate', 'newbb'); + +$configurator = new Rssfit\Common\Configurator(); + +$migrator = new \XoopsModules\Rssfit\Common\Migrate($configurator); + +$op = Request::getCmd('op', 'default'); +$opShow = Request::getCmd('show', null, 'POST'); +$opMigrate = Request::getCmd('migrate', null, 'POST'); +$opSchema = Request::getCmd('schema', null, 'POST'); +$op = !empty($opShow) ? 'show' : $op; +$op = !empty($opMigrate) ? 'migrate' : $op; +$op = !empty($opSchema) ? 'schema' : $op; + +$message = ''; + +switch ($op) { + case 'show': + $queue = $migrator->getSynchronizeDDL(); + if (!empty($queue)) { + echo "
\n";
+            foreach ($queue as $line) {
+                echo $line . ";\n";
+            }
+            echo "
\n"; + } + break; + case 'migrate': + $migrator->synchronizeSchema(); + $message = 'Database migrated to current schema.'; + break; + case 'schema': + xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', 'Warning! This is intended for developers only. Confirm write schema file from current database.', 'Confirm'); + break; + case 'confirmwrite': + if ($GLOBALS['xoopsSecurity']->check()) { + $migrator->saveCurrentSchema(); + $message = 'Current schema file written'; + } + break; +} + +echo "
$message
"; + +require_once __DIR__ . '/admin_footer.php'; diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index da0351ec..ed4daf18 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -1,4 +1,6 @@ - - * @package rss + * @package rssfit * * Example: * $breadcrumb = new PedigreeBreadcrumb(); @@ -31,15 +33,12 @@ */ class Breadcrumb { - public $dirname; + public $dirname; private $bread = []; - /** - * - */ public function __construct() { - $this->dirname = basename(dirname(__DIR__)); + $this->dirname = basename(dirname(dirname(__DIR__))); } /** @@ -52,13 +51,12 @@ public function addLink($title = '', $link = '') { $this->bread[] = [ 'link' => $link, - 'title' => $title + 'title' => $title, ]; } /** * Render Pedigree BreadCrumb - * */ public function render() { diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index 9cad0e6f..32307dbd 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -1,4 +1,6 @@ -name = $config->name; $this->paths = $config->paths; @@ -56,6 +54,7 @@ public function __construct() $this->templateFolders = $config->templateFolders; $this->oldFiles = $config->oldFiles; $this->oldFolders = $config->oldFolders; + $this->renameTables = $config->renameTables; $this->modCopyright = $config->modCopyright; } } diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index 8215aa62..697816a6 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -1,4 +1,6 @@ -history.go(-1);'); } - } catch (\Exception $e) { + } + catch (\Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n", '
'; } } @@ -57,14 +58,15 @@ public static function recurseCopy($src, $dst) { $dir = opendir($src); // @mkdir($dst); - if (!mkdir($dst) && !is_dir($dst)) { - while (false !== ($file = readdir($dir))) { - if (('.' !== $file) && ('..' !== $file)) { - if (is_dir($src . '/' . $file)) { - self::recurseCopy($src . '/' . $file, $dst . '/' . $file); - } else { - copy($src . '/' . $file, $dst . '/' . $file); - } + if (!@mkdir($dst) && !is_dir($dst)) { + throw new \RuntimeException('The directory ' . $dst . ' could not be created.'); + } + while (false !== ($file = readdir($dir))) { + if (('.' !== $file) && ('..' !== $file)) { + if (is_dir($src . '/' . $file)) { + self::recurseCopy($src . '/' . $file, $dst . '/' . $file); + } else { + copy($src . '/' . $file, $dst . '/' . $file); } } } @@ -72,7 +74,6 @@ public static function recurseCopy($src, $dst) } /** - * * Remove files and (sub)directories * * @param string $src source directory to delete @@ -117,11 +118,11 @@ public static function deleteDirectory($src) // input is not a valid directory $success = false; } + return $success; } /** - * * Recursively remove directory * * @todo currently won't remove directories with hidden files, should it? @@ -239,6 +240,7 @@ public static function rcopy($src, $dest) self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); } } + return true; } } diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php new file mode 100644 index 00000000..0dffff04 --- /dev/null +++ b/class/Common/Migrate.php @@ -0,0 +1,118 @@ + + * @copyright 2016 XOOPS Project (https://xoops.org) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @link https://xoops.org + */ +class Migrate extends \Xmf\Database\Migrate +{ + private $renameTables; + + /** + * Migrate constructor. + * @throws \RuntimeException + * @throws \InvalidArgumentException + */ + public function __construct() + { + $class = __NAMESPACE__ . '\\' . 'Configurator'; + if (!class_exists($class)) { + throw new \RuntimeException("Class '$class' not found"); + } + $configurator = new $class(); + $this->renameTables = $configurator->renameTables; + + $moduleDirName = basename(dirname(dirname(__DIR__))); + parent::__construct($moduleDirName); + } + + /** + * change table prefix if needed + */ + private function changePrefix() + { + foreach ($this->renameTables as $oldName => $newName) { + if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) { + $this->tableHandler->renameTable($oldName, $newName); + } + } + } + + /** + * Change integer IPv4 column to varchar IPv6 capable + * + * @param string $tableName table to convert + * @param string $columnName column with IP address + */ + private function convertIPAddresses($tableName, $columnName) + { + if ($this->tableHandler->useTable($tableName)) { + $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); + if (false !== mb_strpos($attributes, ' int(')) { + if (false === mb_strpos($attributes, 'unsigned')) { + $this->tableHandler->alterColumn($tableName, $columnName, " bigint(16) NOT NULL DEFAULT '0' "); + $this->tableHandler->update($tableName, [$columnName => "4294967296 + $columnName"], "WHERE $columnName < 0", false); + } + $this->tableHandler->alterColumn($tableName, $columnName, " varchar(45) NOT NULL DEFAULT '' "); + $this->tableHandler->update($tableName, [$columnName => "INET_NTOA($columnName)"], '', false); + } + } + } + + /** + * Move do* columns from newbb_posts to newbb_posts_text table + */ + private function moveDoColumns() + { + $tableName = 'newbb_posts_text'; + $srcTableName = 'newbb_posts'; + if ($this->tableHandler->useTable($tableName) + && $this->tableHandler->useTable($srcTableName)) { + $attributes = $this->tableHandler->getColumnAttributes($tableName, 'dohtml'); + if (false === $attributes) { + $this->synchronizeTable($tableName); + $updateTable = $GLOBALS['xoopsDB']->prefix($tableName); + $joinTable = $GLOBALS['xoopsDB']->prefix($srcTableName); + $sql = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n" . "SET t1.dohtml = t2.dohtml, t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n" . ' , t1.doimage = t2.doimage, t1.dobr = t2.dobr'; + $this->tableHandler->addToQueue($sql); + } + } + } + + /** + * Perform any upfront actions before synchronizing the schema + * + * Some typical uses include + * table and column renames + * data conversions + */ + protected function preSyncActions() + { + /* + // change 'bb' table prefix to 'newbb' + $this->changePrefix(); + // columns dohtml, dosmiley, doxcode, doimage and dobr moved between tables as some point + $this->moveDoColumns(); + // Convert IP address columns from int to readable varchar(45) for IPv6 + $this->convertIPAddresses('newbb_posts', 'poster_ip'); + $this->convertIPAddresses('newbb_report', 'reporter_ip'); + */ + } +} diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index 011060db..2f947c27 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -1,4 +1,6 @@ -\n"; $html .= '
' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "
\n"; $html .= "
    \n"; - // + $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; if (function_exists('gd_info')) { @@ -58,7 +60,7 @@ public static function getServerStats() // $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - // + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . "\n"; $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . "\n"; $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . "\n"; diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php new file mode 100644 index 00000000..b510983d --- /dev/null +++ b/class/Common/SysUtility.php @@ -0,0 +1,194 @@ + + * @author Mamba + */ + +use MyTextSanitizer; +use XoopsFormDhtmlTextArea; +use XoopsFormTextArea; +use XoopsModules\Rssfit; + +/** + * Class SysUtility + */ +class SysUtility +{ + use VersionChecks; //checkVerXoops, checkVerPhp Traits + + use ServerStats; // getServerStats Trait + + use FilesManagement; // Files Management Trait + + /** + * truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags + * www.gsdesign.ro/blog/cut-html-string-without-breaking-the-tags + * www.cakephp.org + * + * @param string $text String to truncate. + * @param int $length Length of returned string, including ellipsis. + * @param string $ending Ending to be appended to the trimmed string. + * @param bool $exact If false, $text will not be cut mid-word + * @param bool $considerHtml If true, HTML tags would be handled correctly + * + * @return string Trimmed string. + */ + public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true) + { + if ($considerHtml) { + // if the plain text is shorter than the maximum length, return the whole text + if (mb_strlen(preg_replace('/<.*?' . '>/', '', $text)) <= $length) { + return $text; + } + // splits all html-tags to scanable lines + preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER); + $total_length = mb_strlen($ending); + $open_tags = []; + $truncate = ''; + foreach ($lines as $line_matchings) { + // if there is any html-tag in this line, handle it and add it (uncounted) to the output + if (!empty($line_matchings[1])) { + // if it's an "empty element" with or without xhtml-conform closing slash + if (preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) { + // do nothing + // if tag is a closing tag + } elseif (preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) { + // delete tag from $open_tags list + $pos = array_search($tag_matchings[1], $open_tags, true); + if (false !== $pos) { + unset($open_tags[$pos]); + } + // if tag is an opening tag + } elseif (preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { + // add tag to the beginning of $open_tags list + array_unshift($open_tags, mb_strtolower($tag_matchings[1])); + } + // add html-tag to $truncate'd text + $truncate .= $line_matchings[1]; + } + // calculate the length of the plain text part of the line; handle entities as one character + $content_length = mb_strlen(preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', ' ', $line_matchings[2])); + if ($total_length + $content_length > $length) { + // the number of characters which are left + $left = $length - $total_length; + $entities_length = 0; + // search for html entities + if (preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, PREG_OFFSET_CAPTURE)) { + // calculate the real length of all entities in the legal range + foreach ($entities[0] as $entity) { + if ($left >= $entity[1] + 1 - $entities_length) { + $left--; + $entities_length += mb_strlen($entity[0]); + } else { + // no more characters left + break; + } + } + } + $truncate .= mb_substr($line_matchings[2], 0, $left + $entities_length); + // maximum lenght is reached, so get off the loop + break; + } + $truncate .= $line_matchings[2]; + $total_length += $content_length; + + // if the maximum length is reached, get off the loop + if ($total_length >= $length) { + break; + } + } + } else { + if (mb_strlen($text) <= $length) { + return $text; + } + $truncate = mb_substr($text, 0, $length - mb_strlen($ending)); + } + // if the words shouldn't be cut in the middle... + if (!$exact) { + // ...search the last occurance of a space... + $spacepos = mb_strrpos($truncate, ' '); + if (isset($spacepos)) { + // ...and cut the text in this position + $truncate = mb_substr($truncate, 0, $spacepos); + } + } + // add the defined ending to the text + $truncate .= $ending; + if ($considerHtml) { + // close all unclosed html-tags + foreach ($open_tags as $tag) { + $truncate .= ''; + } + } + + return $truncate; + } + + /** + * @param \Xmf\Module\Helper $helper + * @param array|null $options + * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor + */ + public static function getEditor($helper = null, $options = null) + { + /** @var Helper $helper */ + if (null === $options) { + $options = []; + $options['name'] = 'Editor'; + $options['value'] = 'Editor'; + $options['rows'] = 10; + $options['cols'] = '100%'; + $options['width'] = '100%'; + $options['height'] = '400px'; + } + + $isAdmin = $helper->isUserAdmin(); + + if (class_exists('XoopsFormEditor')) { + if ($isAdmin) { + $descEditor = new \XoopsFormEditor(ucfirst($options['name']), $helper->getConfig('editorAdmin'), $options, $nohtml = false, $onfailure = 'textarea'); + } else { + $descEditor = new \XoopsFormEditor(ucfirst($options['name']), $helper->getConfig('editorUser'), $options, $nohtml = false, $onfailure = 'textarea'); + } + } else { + $descEditor = new \XoopsFormDhtmlTextArea(ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); + } + + // $form->addElement($descEditor); + + return $descEditor; + } + + /** + * @param $fieldname + * @param $table + * + * @return bool + */ + public function fieldExists($fieldname, $table) + { + global $xoopsDB; + $result = $xoopsDB->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); + + return ($xoopsDB->getRowsNum($result) > 0); + } +} diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 17fcbfb0..9f8c3221 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -1,4 +1,6 @@ -getInfo('min_xoops'); //making sure it's a string } - $success = true; + $success = true; if (version_compare($currentVer, $requiredVer, '<')) { - $success = false; + $success = false; $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); } @@ -50,20 +54,28 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = } /** - * * Verifies PHP version meets minimum requirements for this module * @static - * @param \XoopsModule $module + * @param \XoopsModule|null $module * * @return bool true if meets requirements, false if not */ - public static function checkVerPhp(\XoopsModule $module) + public static function checkVerPhp(\XoopsModule $module = null) { - xoops_loadLanguage('admin', $module->dirname()); + $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + if (null === $module) { + $module = \XoopsModule::getByDirname($moduleDirName); + } + xoops_loadLanguage('admin', $moduleDirName); + xoops_loadLanguage('common', $moduleDirName); + // check for minimum PHP version $success = true; - $verNum = PHP_VERSION; - $reqVer = $module->getInfo('min_php'); + + $verNum = PHP_VERSION; + $reqVer = &$module->getInfo('min_php'); + if (false !== $reqVer && '' !== $reqVer) { if (version_compare($verNum, $reqVer, '<')) { $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); @@ -73,4 +85,66 @@ public static function checkVerPhp(\XoopsModule $module) return $success; } + + /** + * + * compares current module version with latest GitHub release + * @static + * @param \Xmf\Module\Helper $helper + * @param string|null $source + * @param string|null $default + * + * @return string|array info about the latest module version, if newer + */ + + public static function checkVerModule($helper, $source = 'github', $default = 'master') + { + $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $update = ''; + $repository = 'XoopsModules25x/' . $moduleDirName; + // $repository = 'XoopsModules25x/publisher'; //for testing only + $ret = ''; + $infoReleasesUrl = "https://api.github.com/repos/$repository/releases"; + if ('github' === $source) { + if (function_exists('curl_init') && false !== ($curlHandle = curl_init())) { + curl_setopt($curlHandle, CURLOPT_URL, $infoReleasesUrl); + curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($curlHandle, CURLOPT_HTTPHEADER, ["User-Agent:Publisher\r\n"]); + $curlReturn = curl_exec($curlHandle); + if (false === $curlReturn) { + trigger_error(curl_error($curlHandle)); + } elseif (false !== strpos($curlReturn, 'Not Found')) { + trigger_error('Repository Not Found: ' . $infoReleasesUrl); + } else { + $file = json_decode($curlReturn, false); + $latestVersionLink = sprintf("https://github.com/$repository/archive/%s.zip", $file ? reset($file)->tag_name : $default); + $latestVersion = $file[0]->tag_name; + $prerelease = $file[0]->prerelease; + if ('master' !== $latestVersionLink) { + $update = constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; + } + //"PHP-standardized" version + $latestVersion = mb_strtolower($latestVersion); + if (false !== mb_strpos($latestVersion, 'final')) { + $latestVersion = str_replace('_', '', mb_strtolower($latestVersion)); + $latestVersion = str_replace('final', '', mb_strtolower($latestVersion)); + } + $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); + //"PHP-standardized" version + $moduleVersion = str_replace(' ', '', mb_strtolower($moduleVersion)); + // $moduleVersion = '1.0'; //for testing only + // $moduleDirName = 'publisher'; //for testing only + if (!$prerelease && version_compare($moduleVersion, $latestVersion, '<')) { + $ret = []; + $ret[] = $update; + $ret[] = $latestVersionLink; + } + } + curl_close($curlHandle); + } + } + return $ret; + } } diff --git a/class/Constants.php b/class/Constants.php new file mode 100644 index 00000000..cec82311 --- /dev/null +++ b/class/Constants.php @@ -0,0 +1,54 @@ + ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### + +namespace XoopsModules\Rssfit; + +/* + * 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. + */ + +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @package RSSFit - Extendable XML news feed generator + * @author NS Tai (aka tuff) + * @author XOOPS Development Team + */ + +use XoopsModules\Rssfit; if (!defined('RSSFIT_ROOT_PATH')) { exit(); } -class RssfeedHandler + +/** + * Class FeedHandler + * @package XoopsModules\Rssfit + */ +class FeedHandler { public $rssmod; - public $pHandler; - public $mHandler; + public $pluginHandler; + public $miscHandler; public $channelreq; public $subHandler; public $plugin_obj; public $myts; public $modConfig; public $xoopsConfig; - public $cached = ''; - public $charset = _CHARSET; - public $feedkey = 'feed'; - public $plugin_file = 'rssfit.%s.php'; - public $substr_remove = [',', '/', ';', ':', '(', '{', '[', ' ']; - public $substr_add = ['.', '!', '?', '}', ']', ')', '%']; + public $cached = ''; + public $charset = _CHARSET; + public $feedkey = 'feed'; + public $plugin_file = 'rssfit.%s.php'; + public $substr_remove = [',', '/', ';', ':', '(', '{', '[', ' ']; + public $substr_add = ['.', '!', '?', '}', ']', ')', '%']; public $substr_endwith = '...'; - public $spec_url = 'http://blogs.law.harvard.edu/tech/rss'; - public $specs = [ + public $spec_url = 'http://blogs.law.harvard.edu/tech/rss'; + public $specs = [ 'req' => 'requiredChannelElements', 'opt' => 'optionalChannelElements', 'cloud' => 'ltcloudgtSubelementOfLtchannelgt', - 'img' => 'ltimagegtSubelementOfLtchannelgt' + 'img' => 'ltimagegtSubelementOfLtchannelgt', ]; - public $escaped = [ - 128 => '€', 130 => '‚', 131 => 'ƒ', - 132 => '„', 133 => '…', 134 => '†', - 135 => '‡', 136 => 'ˆ', 137 => '‰', - 138 => 'Š', 139 => '‹', 140 => 'Œ', - 142 => 'Ž', 145 => '‘', 146 => '’', - 147 => '“', 148 => '”', 149 => '•', - 150 => '–', 151 => '—', 152 => '˜', - 153 => '™', 154 => 'š', 155 => '›', - 156 => 'œ', 158 => 'ž', 159 => 'Ÿ' + public $escaped = [ + 128 => '€', + 130 => '‚', + 131 => 'ƒ', + 132 => '„', + 133 => '…', + 134 => '†', + 135 => '‡', + 136 => 'ˆ', + 137 => '‰', + 138 => 'Š', + 139 => '‹', + 140 => 'Œ', + 142 => 'Ž', + 145 => '‘', + 146 => '’', + 147 => '“', + 148 => '”', + 149 => '•', + 150 => '–', + 151 => '—', + 152 => '˜', + 153 => '™', + 154 => 'š', + 155 => '›', + 156 => 'œ', + 158 => 'ž', + 159 => 'Ÿ', ]; + /** + * FeedHandler constructor. + * @param $modConfig + * @param $xoopsConfig + * @param $xoopsModule + */ public function __construct($modConfig, $xoopsConfig, $xoopsModule) { - $this->myts = \MyTextSanitizer::getInstance(); - $this->rssmod = $xoopsModule; - $this->pHandler = xoops_getModuleHandler('plugins'); - $this->mHandler = xoops_getModuleHandler('misc'); - $this->modConfig = $modConfig; + $this->myts = \MyTextSanitizer::getInstance(); + $this->rssmod = $xoopsModule; + $this->pluginHandler = Rssfit\Helper::getInstance()->getHandler('Plugin'); + $this->miscHandler = Rssfit\Helper::getInstance()->getHandler('Misc'); + $this->modConfig = $modConfig; $this->xoopsConfig = $xoopsConfig; - $this->channelreq = [ + $this->channelreq = [ 'title' => $this->xoopsConfig['sitename'], 'link' => XOOPS_URL, - 'description' => $this->xoopsConfig['slogan'] + 'description' => $this->xoopsConfig['slogan'], ]; } + /** + * @param $feed + */ public function getChannel(&$feed) { - $channel = []; - if ($elements =& $this->mHandler->getObjects(new \Criteria('misc_category', 'channel'))) { + $channel = []; + $elements = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channel')); + if ($elements) { foreach ($elements as $e) { if ('' != $e->getVar('misc_content')) { $channel[$e->getVar('misc_title')] = $e->getVar('misc_content', 'n'); } } - $channel['language'] = _LANGCODE; + $channel['language'] = _LANGCODE; $channel['lastBuildDate'] = $this->rssTimeStamp(time()); if ($this->modConfig['cache']) { $channel['ttl'] = $this->modConfig['cache']; @@ -104,21 +127,22 @@ public function getChannel(&$feed) } if (!empty($feed['plugin'])) { if (is_object($this->plugin_obj) && is_object($this->subHandler)) { - $channel['title'] = $this->plugin_obj->getVar('sub_title', 'n'); - $channel['link'] = $this->plugin_obj->getVar('sub_link', 'n'); + $channel['title'] = $this->plugin_obj->getVar('sub_title', 'n'); + $channel['link'] = $this->plugin_obj->getVar('sub_link', 'n'); $channel['description'] = $this->plugin_obj->getVar('sub_desc', 'n'); - $image = [ + $image = [ 'url' => $this->plugin_obj->getVar('img_url', 'n'), 'title' => $this->plugin_obj->getVar('img_title', 'n'), - 'link' => $this->plugin_obj->getVar('img_link', 'n') + 'link' => $this->plugin_obj->getVar('img_link', 'n'), ]; } } else { - if ($img =& $this->mHandler->getObjects(new \Criteria('misc_category', 'channelimg'), '*', 'title')) { + $img = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channelimg'), '*', 'title'); + if ($img) { $image = [ 'url' => $img['url']->getVar('misc_content', 'n'), 'title' => $img['title']->getVar('misc_content', 'n'), - 'link' => $img['link']->getVar('misc_content', 'n') + 'link' => $img['link']->getVar('misc_content', 'n'), ]; } } @@ -132,27 +156,30 @@ public function getChannel(&$feed) foreach ($image as $k => $v) { $this->cleanupChars($image[$k]); } - $feed['image'] =& $image; + $feed['image'] = &$image; } - $feed['channel'] =& $channel; + $feed['channel'] = &$channel; } + /** + * @param $feed + * @return bool + */ public function getSticky(&$feed) { - if (!$intr = $this->mHandler->getObjects(new \Criteria('misc_category', 'sticky'))) { + if (!$intr = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'sticky'))) { return false; } - $sticky =& $intr[0]; + $sticky = &$intr[0]; unset($intr); $setting = $sticky->getVar('misc_setting'); if (in_array(0, $setting['feeds']) || '' == $sticky->getVar('misc_title') || '' == $sticky->getVar('misc_content')) { return false; } - if ((in_array(-1, $setting['feeds']) && empty($feed['plugin'])) || - (!empty($feed['plugin']) && in_array($this->plugin_obj->getVar('rssf_conf_id'), $setting['feeds'])) - ) { + if ((in_array(-1, $setting['feeds']) && empty($feed['plugin'])) + || (!empty($feed['plugin']) && in_array($this->plugin_obj->getVar('rssf_conf_id'), $setting['feeds']))) { $feed['sticky']['title'] = $sticky->getVar('misc_title', 'n'); - $feed['sticky']['link'] = $setting['link']; + $feed['sticky']['link'] = $setting['link']; $sticky->setDoHtml($setting['dohtml']); $sticky->setDoBr($setting['dobr']); $feed['sticky']['description'] = $sticky->getVar('misc_content'); @@ -162,26 +189,31 @@ public function getSticky(&$feed) $this->wrapCdata($feed['sticky']['description']); $feed['sticky']['pubdate'] = $this->rssTimeStamp(time()); } + return true; } + /** + * @param $feed + */ public function getItems(&$feed) { $entries = []; if (!empty($feed['plugin'])) { $this->plugin_obj->setVar('rssf_grab', $this->plugin_obj->getVar('sub_entries')); $this->subHandler->grab = $this->plugin_obj->getVar('sub_entries'); - $grab =& $this->subHandler->grabEntries($this->plugin_obj); + $grab = &$this->subHandler->grabEntries($this->plugin_obj); if (false !== $grab && count($grab) > 0) { foreach ($grab as $g) { array_push($entries, $g); } } - } elseif ($plugins =& $this->pHandler->getObjects(new \Criteria('rssf_activated', 1))) { + } elseif ($plugins = $this->pluginHandler->getObjects2(new \Criteria('rssf_activated', 1))) { foreach ($plugins as $p) { - if ($handler =& $this->pHandler->checkPlugin($p)) { + $handler = $this->pluginHandler->checkPlugin($p); + if ($handler) { $handler->grab = $p->getVar('rssf_grab'); - $grab =& $handler->grabEntries($p); + $grab = &$handler->grabEntries($p); if (false !== $grab && count($grab) > 0) { foreach ($grab as $g) { array_push($entries, $g); @@ -191,7 +223,7 @@ public function getItems(&$feed) } } if (count($entries) > 0) { - for ($i=0, $iMax = count($entries); $i < $iMax; $i++) { + for ($i = 0, $iMax = count($entries); $i < $iMax; $i++) { $this->cleanupChars($entries[$i]['title']); $strip = $this->modConfig['strip_html'] ? 1 : 0; $this->cleanupChars($entries[$i]['description'], $strip, 0, 1); @@ -210,22 +242,26 @@ public function getItems(&$feed) $entries = array_slice($entries, 0, $this->modConfig['overall_entries']); } } - $feed['items'] =& $entries; + $feed['items'] = &$entries; } + /** + * @param $text + * @return string + */ public function doSubstr($text) { $ret = $text; - $len = function_exists('mb_strlen') ? mb_strlen($ret, $this->charset) : strlen($ret); + $len = function_exists('mb_strlen') ? mb_strlen($ret, $this->charset) : mb_strlen($ret); if ($len > $this->modConfig['max_char'] && $this->modConfig['max_char'] > 0) { - $ret = $this->substrDetect($ret, 0, $this->modConfig['max_char']-1); + $ret = $this->substrDetect($ret, 0, $this->modConfig['max_char'] - 1); if (false === $this->strrposDetect($ret, ' ')) { if (false !== $this->strrposDetect($text, ' ')) { - $ret = $this->substrDetect($text, 0, strpos($text, ' ')); + $ret = $this->substrDetect($text, 0, mb_strpos($text, ' ')); } } - if (in_array($this->substrDetect($text, $this->modConfig['max_char']-1, 1), $this->substr_add)) { - $ret .= $this->substrDetect($text, $this->modConfig['max_char']-1, 1); + if (in_array($this->substrDetect($text, $this->modConfig['max_char'] - 1, 1), $this->substr_add)) { + $ret .= $this->substrDetect($text, $this->modConfig['max_char'] - 1, 1); } else { if (false !== $this->strrposDetect($ret, ' ')) { $ret = $this->substrDetect($ret, 0, $this->strrposDetect($ret, ' ')); @@ -236,39 +272,69 @@ public function doSubstr($text) } $ret .= $this->substr_endwith; } + return $ret; } + /** + * @param $text + * @param $start + * @param $len + * @return string + */ public function substrDetect($text, $start, $len) { if (function_exists('mb_strcut')) { return mb_strcut($text, $start, $len, _CHARSET); } - return substr($text, $start, $len); + + return mb_substr($text, $start, $len); } + /** + * @param $text + * @param $find + * @return bool|false|int + */ public function strrposDetect($text, $find) { if (function_exists('mb_strrpos')) { return mb_strrpos($text, $find, _CHARSET); } - return strrpos($text, $find); + + return mb_strrpos($text, $find); } + /** + * @param $time + * @return false|string + */ public function rssTimeStamp($time) { return date('D, j M Y H:i:s O', $time); } + /** + * @param $a + * @param $b + * @return int + */ public function sortTimestamp($a, $b) { if ($a['timestamp'] == $b['timestamp']) { return 0; } + return ($a['timestamp'] > $b['timestamp']) ? -1 : 1; } - public function cleanupChars(&$text, $strip=true, $dospec=true, $dosub=false) + /** + * @param $text + * @param bool $strip + * @param bool $dospec + * @param bool $dosub + */ + public function cleanupChars(&$text, $strip = true, $dospec = true, $dosub = false) { if ($strip) { $text = strip_tags($text); @@ -285,18 +351,27 @@ public function cleanupChars(&$text, $strip=true, $dospec=true, $dosub=false) } } + /** + * @param $text + */ public function wrapCdata(&$text) { - $text = ''], ['<![CDATA[', ']]>'], $text) . ']]>'; + $text = ''], ['<![CDATA[', ']]>'], $text) . ']]>'; } - public function &getActivatedSubfeeds($fields='', $type='') + /** + * @param string $fields + * @param string $type + * @return bool + */ + public function &getActivatedSubfeeds($fields = '', $type = '') { - $ret = false; - if ($subs =& $this->pHandler->getObjects(new \Criteria('subfeed', 1), $fields)) { + $ret = false; + $subs = $this->pluginHandler->getObjects2(new \Criteria('subfeed', 1), $fields); + if ($subs) { switch ($type) { default: - $ret =& $subs; + $ret = &$subs; break; case 'list': foreach ($subs as $s) { @@ -305,10 +380,22 @@ public function &getActivatedSubfeeds($fields='', $type='') break; } } + return $ret; } - public function feedSelectBox($caption='', $selected='', $size=1, $multi=true, $none=true, $main=true, $name='feeds', $type='id') + /** + * @param string $caption + * @param string $selected + * @param int $size + * @param bool $multi + * @param bool $none + * @param bool $main + * @param string $name + * @param string $type + * @return \XoopsFormSelect + */ + public function feedSelectBox($caption = '', $selected = '', $size = 1, $multi = true, $none = true, $main = true, $name = 'feeds', $type = 'id') { $select = new \XoopsFormSelect($caption, $name, $selected, $size, $multi); if ($none) { @@ -317,54 +404,72 @@ public function feedSelectBox($caption='', $selected='', $size=1, $multi=true, $ if ($main) { $select->addOption('-1', _AM_MAINFEED); } - if ($subs =& $this->getActivatedSubfeeds('sublist', 'list')) { - foreach ($subs as $k=>$v) { + $subs = &$this->getActivatedSubfeeds('sublist', 'list'); + if ($subs) { + foreach ($subs as $k => $v) { $select->addOption($k, $v); } } + return $select; } - public function specUrl($key=0) + /** + * @param int $key + * @return bool|string + */ + public function specUrl($key = 0) { if (isset($this->specs[$key])) { - return $this->spec_url.'#'.$this->specs[$key]; + return $this->spec_url . '#' . $this->specs[$key]; } + return false; } - public function subFeedUrl($filename='') + /** + * @param string $filename + * @return bool|string + */ + public function subFeedUrl($filename = '') { if (!empty($filename)) { $filename = str_replace('rssfit.', '', $filename); $filename = str_replace('.php', '', $filename); - return RSSFIT_URL_FEED.'?'.$this->feedkey.'='.$filename; + + return RSSFIT_URL_FEED . '?' . $this->feedkey . '=' . $filename; } + return false; } + /** + * @param $feed + */ public function checkSubFeed(&$feed) { if (!empty($feed['plugin'])) { $criteria = new \CriteriaCompo(); $criteria->add(new \Criteria('rssf_filename', sprintf($this->plugin_file, $feed['plugin']))); $criteria->add(new \Criteria('subfeed', 1)); - $sub = $this->pHandler->getObjects($criteria); + $sub = $this->pluginHandler->getObjects2($criteria); $handler = false; if (isset($sub[0])) { - $handler = $this->pHandler->checkPlugin($sub[0]); + $handler = $this->pluginHandler->checkPlugin($sub[0]); } if ($handler) { $this->plugin_obj = $sub[0]; $this->subHandler = $handler; - $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' - . md5(str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); + $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' . md5(str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); } else { $feed['plugin'] = ''; } } } + /** + * @param $feed + */ public function buildFeed(&$feed) { $this->getChannel($feed); diff --git a/class/Helper.php b/class/Helper.php index ad777d68..9dc2d3d5 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -1,4 +1,6 @@ -debug = $debug; - $moduleDirName = basename(dirname(__DIR__)); - parent::__construct($moduleDirName); + $this->debug = $debug; + $moduleDirName = basename(dirname(__DIR__)); + parent::__construct($moduleDirName); } /** * @param bool $debug * - * @return \Xmf\Module\Helper + * @return \XoopsModules\Rssfit\Helper */ public static function getInstance($debug = false) { @@ -70,9 +71,16 @@ public function getDirname() public function getHandler($name) { $ret = false; - $db = \XoopsDatabaseFactory::getDatabaseConnection(); - $class = '\\XoopsModules\\' . ucfirst(strtolower(basename(dirname(__DIR__)))) . '\\' . $name . 'Handler'; - $ret = new $class($db); + + $class = __NAMESPACE__ . '\\' . ucfirst($name) . 'Handler'; + if (!class_exists($class)) { + throw new \RuntimeException("Class '$class' not found"); + } + /** @var \XoopsMySQLDatabase $db */ + $db = \XoopsDatabaseFactory::getDatabaseConnection(); + $helper = self::getInstance(); + $ret = new $class($db, $helper); + $this->addLog("Getting handler '{$name}'"); return $ret; } } diff --git a/class/Misc.php b/class/Misc.php new file mode 100644 index 00000000..ece09f67 --- /dev/null +++ b/class/Misc.php @@ -0,0 +1,59 @@ + + * @author XOOPS Development Team + */ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Misc + * @package XoopsModules\Rssfit + */ +class Misc extends \XoopsObject +{ + public function __construct() + { + parent::__construct(); + // key, data_type, value, req, max, opt + $this->initVar('misc_id', XOBJ_DTYPE_INT, null, false); + $this->initVar('misc_category', XOBJ_DTYPE_TXTBOX, '', true, 15); + $this->initVar('misc_title', XOBJ_DTYPE_TXTBOX, '', false, 255); + $this->initVar('misc_content', XOBJ_DTYPE_TXTAREA, '', false); + $this->initVar('misc_setting', XOBJ_DTYPE_ARRAY, ''); + } + + /** + * @param bool $do + */ + public function setDoHtml($do = true) + { + $this->vars['dohtml']['value'] = $do; + } + + /** + * @param bool $do + */ + public function setDoBr($do = true) + { + $this->vars['dobr']['value'] = $do; + } +} diff --git a/class/MiscHandler.php b/class/MiscHandler.php new file mode 100644 index 00000000..32e7fe7b --- /dev/null +++ b/class/MiscHandler.php @@ -0,0 +1,289 @@ + + * @author XOOPS Development Team + */ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class MiscHandler + * @package XoopsModules\Rssfit + */ +class MiscHandler extends \XoopsPersistableObjectHandler +{ + public $db; + public $db_table; + public $obj_class = Misc::class; + public $obj_key = 'misc_id'; + + /** + * @var \XoopsModules\Rssfit\Helper + */ + public $helper; + + /** + * @param \XoopsDatabase $db + * @param null|\XoopsModules\Rssfit\Helper $helper + */ + public function __construct(\XoopsDatabase $db = null, $helper = null) + { + if (null === $helper) { + $helper = \XoopsModules\Rssfit\Helper::getInstance(); + } + $this->helper = $helper; + + if (null === $db) { + $db = \XoopsDatabaseFactory::getDatabaseConnection(); + } + $this->db = $db; + $this->db_table = $db->prefix($helper->getDirname() . '_misc'); + + parent::__construct($db, 'rssfit_misc', Misc::class, 'misc_id', 'misc_title'); + } + + /** + * @param \XoopsDatabase|null $db + * @return \XoopsModules\Rssfit\MiscHandler + */ + public function getInstance(\XoopsDatabase $db = null) + { + static $instance; + if (null === $instance) { + $instance = new self($db); + } + + return $instance; + } + + /** + * @param bool $isNew + * @return \XoopsObject + */ + public function create($isNew = true) + { + $obj = parent::create($isNew); + // if ($isNew) { + // $obj->setDefaultPermissions(); + // } + $obj->helper = $this->helper; + + return $obj; + } + +// public function get($id = null, $fields = '*') + + /** + * @param null $id + * @param null $fields + * @return bool|mixed|\XoopsObject|null + */ + public function get($id = null, $fields = null) + { + $criteria = new \Criteria($this->obj_key, (int)$id); + $objs = $this->getObjects2($criteria); + if ($objs) { + return 1 != count($objs) ? false : $objs[0]; + } + + return false; + } + + /** + * @param null $criteria + * @return bool|int + */ + public function getCount($criteria = null) + { + $sql = 'SELECT COUNT(*) FROM ' . $this->db_table; + if (null !== $criteria && $criteria instanceof \CriteriaElement) { + $sql .= ' ' . $criteria->renderWhere(); + } + if (!$result = $this->db->query($sql)) { + return false; + } + list($count) = $this->db->fetchRow($result); + + return $count; + } + + /** + * @param null $criteria + * @param string $fields + * @param string $key + * @return bool + */ + public function getObjects2($criteria = null, $fields = '*', $key = '') +// public function &getObjects(\CriteriaElement $criteria = null, $id_as_key = false, $as_object = true) + { + $ret = false; + $limit = $start = 0; + $fields = '*'; + $sql = 'SELECT ' . $fields . ' FROM ' . $this->db_table; + if (null !== $criteria && $criteria instanceof \CriteriaElement) { + $sql .= ' ' . $criteria->renderWhere(); + if ('' != $criteria->getSort()) { + $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); + } + $limit = $criteria->getLimit(); + $start = $criteria->getStart(); + } + if (!preg_match('/ORDER\ BY/', $sql)) { + $sql .= ' ORDER BY ' . $this->obj_key . ' ASC'; + } + $result = $this->db->query($sql, $limit, $start); + if (!$result) { + return false; + } + while (false !== ($myrow = $this->db->fetchArray($result))) { + $obj = new $this->obj_class(); + $obj->assignVars($myrow); + switch ($key) { + default: + $ret[] = $obj; + break; + case 'title': + $ret[$myrow['misc_title']] = $obj; + break; + case 'id': + $ret[$myrow[$this->obj_key]] = $obj; + break; + } + unset($obj); + } + + return $ret; + } + + /** + * @param \XoopsObject $obj + * @param bool $force + * @return array|bool|int|mixed|null + */ + public function insert(\XoopsObject $obj, $force = false) + { + $force = false; + if (mb_strtolower(get_class($obj)) != mb_strtolower($this->obj_class)) { + return false; + } + if (!$obj->isDirty()) { + return true; + } + if (!$obj->cleanVars()) { + return false; + } + foreach ($obj->cleanVars as $k => $v) { + if (XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) { + $cleanvars[$k] = (int)$v; + } else { + $cleanvars[$k] = $this->db->quoteString($v); + } + } + if (count($obj->getErrors()) > 0) { + return false; + } + if ($obj->isNew() || empty($cleanvars[$this->obj_key])) { + $cleanvars[$this->obj_key] = $this->db->genId($this->db_table . '_' . $this->obj_key . '_seq'); + $sql = 'INSERT INTO ' . $this->db_table . ' (' . implode(',', array_keys($cleanvars)) . ') VALUES (' . implode(',', array_values($cleanvars)) . ')'; + } else { + unset($cleanvars[$this->obj_key]); + $sql = 'UPDATE ' . $this->db_table . ' SET'; + foreach ($cleanvars as $k => $v) { + $sql .= ' ' . $k . '=' . $v . ','; + } + $sql = mb_substr($sql, 0, -1); + $sql .= ' WHERE ' . $this->obj_key . ' = ' . $obj->getVar($this->obj_key); + } + if (false !== $force) { + $result = $this->db->queryF($sql); + } else { + $result = $this->db->query($sql); + } + if (!$result) { + $obj->setErrors('Could not store data in the database.
    ' . $this->db->error() . ' (' . $this->db->errno() . ')
    ' . $sql); + + return false; + } + if (false === $obj->getVar($this->obj_key)) { + $obj->assignVar($this->obj_key, $this->db->getInsertId()); + } + + return $obj->getVar($this->obj_key); + } + + /** + * @param null $criteria + * @param array $fields + * @param bool $force + * @return bool|string + */ + public function modifyObjects($criteria = null, $fields = [], $force = false) + { + if ($fields && is_array($fields)) { + $obj = new $this->obj_class(); + $sql = ''; + foreach ($fields as $k => $v) { + $sql .= $k . ' = '; + $sql .= 3 == $obj->vars[$k]['data_type'] ? (int)$v : $this->db->quoteString($v); + $sql .= ', '; + } + $sql = mb_substr($sql, 0, -2); + $sql = 'UPDATE ' . $this->db_table . ' SET ' . $sql; + if (null !== $criteria && $criteria instanceof \CriteriaElement) { + $sql .= ' ' . $criteria->renderWhere(); + } + if (false !== $force) { + $result = $this->db->queryF($sql); + } else { + $result = $this->db->query($sql); + } + if (!$result) { + return 'Could not store data in the database.
    ' . $this->db->error() . ' (' . $this->db->errno() . ')
    ' . $sql; + } + } + + return false; + } + + /** + * @param \XoopsObject $category + * @param bool $force + * @return bool + */ + public function delete(\XoopsObject $category, $force = false) + { + $force = false; + if (mb_strtolower(get_class($obj)) != mb_strtolower($this->obj_class)) { + return false; + } + $sql = 'DELETE FROM ' . $this->db_table . ' WHERE ' . $this->obj_key . '=' . $obj->getVar($this->obj_key); + if (false !== $force) { + $result = $this->db->queryF($sql); + } else { + $result = $this->db->query($sql); + } + if (!$result) { + return false; + } + + return true; + } +} diff --git a/class/Plugin.php b/class/Plugin.php new file mode 100644 index 00000000..29178395 --- /dev/null +++ b/class/Plugin.php @@ -0,0 +1,51 @@ + + * @author XOOPS Development Team + */ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Plugin + * @package XoopsModules\Rssfit + */ +class Plugin extends \XoopsObject +{ + public function __construct() + { + parent::__construct(); + // key, data_type, value, req, max, opt + $this->initVar('rssf_conf_id', XOBJ_DTYPE_INT, null); + $this->initVar('rssf_filename', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('rssf_activated', XOBJ_DTYPE_INT, 0); + $this->initVar('rssf_grab', XOBJ_DTYPE_INT, 0, true); + $this->initVar('rssf_order', XOBJ_DTYPE_INT, 0); + $this->initVar('subfeed', XOBJ_DTYPE_INT, 0); + $this->initVar('sub_entries', XOBJ_DTYPE_INT, 0); + $this->initVar('sub_link', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('sub_title', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('sub_desc', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('img_url', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('img_link', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('img_title', XOBJ_DTYPE_TXTBOX, ''); + } +} diff --git a/class/PluginHandler.php b/class/PluginHandler.php new file mode 100644 index 00000000..017890d5 --- /dev/null +++ b/class/PluginHandler.php @@ -0,0 +1,370 @@ + + * @author XOOPS Development Team + */ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class PluginHandler + * @package XoopsModules\Rssfit + */ +class PluginHandler extends \XoopsPersistableObjectHandler +{ + public $db; + public $db_table; + public $obj_class = Plugin::class; + public $obj_key = 'rssf_conf_id'; + public $sortby = 'rssf_order'; + public $order = 'ASC'; + + /** + * @var \XoopsModules\Rssfit\Helper + */ + public $helper; + + /** + * @param \XoopsDatabase $db + * @param null|\XoopsModules\Rssfit\Helper $helper + */ + public function __construct(\XoopsDatabase $db = null, $helper = null) + { + if (null === $helper) { + $helper = \XoopsModules\Rssfit\Helper::getInstance(); + } + $this->helper = $helper; + + if (null === $db) { + $db = \XoopsDatabaseFactory::getDatabaseConnection(); + } + $this->db = $db; + $this->db_table = $db->prefix($helper->getDirname() . '_plugins'); + + parent::__construct($db, 'rssfit_plugins', Plugin::class, 'rssf_conf_id', 'rssf_filename'); + } + + /** + * @param \XoopsDatabase|null $db + * @return \XoopsModules\Rssfit\PluginHandler + */ + public function getInstance(\XoopsDatabase $db = null) + { + static $instance; + if (null === $instance) { + $instance = new self($db); + } + + return $instance; + } + + /** + * @param bool $isNew + * @return \XoopsObject + */ + public function create($isNew = true) + { + $obj = parent::create($isNew); + // if ($isNew) { + // $obj->setDefaultPermissions(); + // } + $obj->helper = $this->helper; + + return $obj; + } + +// public function get($id, $fields = '*') + + /** + * @param null $id + * @param null $fields + * @return bool|mixed|\XoopsObject|null + */ + public function get($id = null, $fields = null) + { + $ret = false; + $criteria = new \Criteria($this->obj_key, (int)$id); + $objs = $this->getObjects2($criteria);// && 1 === count($objs); + if ($objs) { + $ret = &$objs[0]; + } + + return $ret; + } + + /** + * @param \XoopsObject $obj + * @param bool $force + * @return array|bool|int|mixed|null + */ + public function insert(\XoopsObject $obj, $force = false) + { + $force = false; + if (mb_strtolower(get_class($obj)) != mb_strtolower($this->obj_class)) { + return false; + } + if (!$obj->isDirty()) { + return true; + } + if (!$obj->cleanVars()) { + return false; + } + foreach ($obj->cleanVars as $k => $v) { + if (XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) { + $cleanvars[$k] = (int)$v; + } else { + $cleanvars[$k] = $this->db->quoteString($v); + } + } + if (count($obj->getErrors()) > 0) { + return false; + } + if ($obj->isNew() || empty($cleanvars[$this->obj_key])) { + $cleanvars[$this->obj_key] = $this->db->genId($this->db_table . '_' . $this->obj_key . '_seq'); + $sql = 'INSERT INTO ' . $this->db_table . ' (' . implode(',', array_keys($cleanvars)) . ') VALUES (' . implode(',', array_values($cleanvars)) . ')'; + } else { + unset($cleanvars[$this->obj_key]); + $sql = 'UPDATE ' . $this->db_table . ' SET'; + foreach ($cleanvars as $k => $v) { + $sql .= ' ' . $k . '=' . $v . ','; + } + $sql = mb_substr($sql, 0, -1); + $sql .= ' WHERE ' . $this->obj_key . ' = ' . $obj->getVar($this->obj_key); + } + if (false !== $force) { + $result = $this->db->queryF($sql); + } else { + $result = $this->db->query($sql); + } + if (!$result) { + $obj->setErrors('Could not store data in the database.
    ' . $this->db->error() . ' (' . $this->db->errno() . ')
    ' . $sql); + + return false; + } + if (false === $obj->getVar($this->obj_key)) { + $obj->assignVar($this->obj_key, $this->db->getInsertId()); + } + + return $obj->getVar($this->obj_key); + } + + /** + * @param \XoopsObject $category + * @param bool $force + * @return bool + */ + public function delete(\XoopsObject $category, $force = false) + { + $force = false; + if (mb_strtolower(get_class($obj)) != mb_strtolower($this->obj_class)) { + return false; + } + $sql = 'DELETE FROM ' . $this->db_table . ' WHERE ' . $this->obj_key . '=' . $obj->getVar($this->obj_key); + if (false !== $force) { + $result = $this->db->queryF($sql); + } else { + $result = $this->db->query($sql); + } + if (!$result) { + return false; + } + + return true; + } + + /** + * @param null $criteria + * @param string $fields + * @param string $key + * @return bool + */ + public function getObjects2($criteria = null, $fields = '*', $key = '') + { + $ret = false; + $limit = $start = 0; + switch ($fields) { + case 'p_activated': + $fields = 'rssf_conf_id, rssf_filename, rssf_grab, rssf_order'; + break; + case 'p_inactive': + $fields = 'rssf_conf_id, rssf_filename'; + break; + case 'sublist': + $fields = 'rssf_conf_id, rssf_filename, subfeed, sub_title'; + break; + } + $sql = 'SELECT ' . $fields . ' FROM ' . $this->db_table; + if (null !== $criteria && $criteria instanceof \CriteriaElement) { + $sql .= ' ' . $criteria->renderWhere(); + if ('' != $criteria->getSort()) { + $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); + } + $limit = $criteria->getLimit(); + $start = $criteria->getStart(); + } + if (!preg_match('/ORDER\ BY/', $sql)) { + $sql .= ' ORDER BY ' . $this->sortby . ' ' . $this->order; + } + $result = $this->db->query($sql, $limit, $start); + if (!$result) { + return false; + } + while (false !== ($myrow = $this->db->fetchArray($result))) { + $obj = new $this->obj_class(); + $obj->assignVars($myrow); + switch ($key) { + default: + $ret[] = &$obj; + break; + case 'id': + $ret[$myrow[$this->obj_key]] = &$obj; + break; + } + unset($obj); + } + + return $ret; + } + + /** + * @param null $criteria + * @param array $fields + * @param bool $force + * @return bool|string + */ + public function modifyObjects($criteria = null, $fields = [], $force = false) + { + if ($fields && is_array($fields)) { + $obj = new $this->obj_class(); + $sql = ''; + foreach ($fields as $k => $v) { + $sql .= $k . ' = '; + $sql .= 3 == $obj->vars[$k]['data_type'] ? (int)$v : $this->db->quoteString($v); + $sql .= ', '; + } + $sql = mb_substr($sql, 0, -2); + $sql = 'UPDATE ' . $this->db_table . ' SET ' . $sql; + if (null !== $criteria && $criteria instanceof \CriteriaElement) { + $sql .= ' ' . $criteria->renderWhere(); + } + if (false !== $force) { + $result = $this->db->queryF($sql); + } else { + $result = $this->db->query($sql); + } + if (!$result) { + return 'Could not store data in the database.
    ' . $this->db->error() . ' (' . $this->db->errno() . ')
    ' . $sql; + } + } + + return false; + } + + /** + * @param null $criteria + * @return bool|int + */ + public function getCount($criteria = null) + { + $sql = 'SELECT COUNT(*) FROM ' . $this->db_table; + if (null !== $criteria && $criteria instanceof \CriteriaElement) { + $sql .= ' ' . $criteria->renderWhere(); + } + $result = $this->db->query($sql); + if (!$result) { + return false; + } + list($count) = $this->db->fetchRow($result); + + return $count; + } + + /** + * @param $obj + * @param string $type + * @return bool + */ + public function forceDeactivate($obj, $type = 'rssf_activated') + { + $criteria = new \Criteria($this->obj_key, $obj->getVar($this->obj_key)); + $fields = ['rssf_activated' => 0, 'subfeed' => 0]; + $this->modifyObjects($criteria, $fields, true); + + return true; + } + + /** + * @return bool + */ + public function &getPluginFileList() + { + $ret = false; + $objs = $this->getObjects2(null, 'rssf_filename'); + if ($objs) { + foreach ($objs as $o) { + $ret[] = $o->getVar('rssf_filename'); + } + } + + return $ret; + } + + /** + * @param $obj + * @return bool|mixed + */ + public function checkPlugin($obj) + { + $ret = false; + global $moduleHandler; + $file = RSSFIT_ROOT_PATH . 'plugins/' . $obj->getVar('rssf_filename'); + $file2 = RSSFIT_ROOT_PATH . 'class/Plugins/' . $obj->getVar('rssf_filename'); + if (file_exists($file2)) { +//mb $require_once = require $file; + $name = explode('.', $obj->getVar('rssf_filename')); + $class = 'Rssfit' . ucfirst($name[0]); + $class2 = __NAMESPACE__ . '\Plugins\\' . ucfirst($name[0]); + if (class_exists($class2)) { + $handler = new $class2(); + if (!method_exists($handler, 'loadmodule') || !method_exists($handler, 'grabentries')) { + $obj->setErrors(_AM_PLUGIN_FUNCNOTFOUND); + } else { + $dirname = $handler->dirname; + if (!empty($dirname) && is_dir(XOOPS_ROOT_PATH . '/modules/' . $dirname)) { + if (!$handler->loadModule()) { + $obj->setErrors(_AM_PLUGIN_MODNOTFOUND); + } else { + $ret = $handler; + } + } else { + $obj->setErrors(_AM_PLUGIN_MODNOTFOUND); + } + } + } else { + $obj->setErrors(_AM_PLUGIN_CLASSNOTFOUND . ' ' . $class2); + } + } else { + $obj->setErrors(_AM_PLUGIN_FILENOTFOUND); + } + + return $ret; + } +} diff --git a/class/Plugins/00/Comments.php b/class/Plugins/00/Comments.php new file mode 100644 index 00000000..01bcd6aa --- /dev/null +++ b/class/Plugins/00/Comments.php @@ -0,0 +1,109 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: Graham Davies (gravies) +* Modified by: tuff +* Requirements (Tested with): +* Module: any module that support XOOPS system comments +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Comments + * @package XoopsModules\Rssfit\Plugins + */ +class Comments +{ + public $dirname = 'system'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + $ret = false; + require_once XOOPS_ROOT_PATH . '/include/comment_constants.php'; + $commentHandler = xoops_getHandler('comment'); + $criteria = new \CriteriaCompo(new \Criteria('com_status', XOOPS_COMMENT_ACTIVE)); + $criteria->setLimit($this->grab); + $criteria->setSort('com_created'); + $criteria->setOrder('DESC'); + $comments = $commentHandler->getObjects($criteria, true); + $comment_config = []; + if (count($comments) > 0) { + $modules = $GLOBALS['module_handler']->getObjects(new \Criteria('hascomments', 1), true); + foreach (array_keys($comments) as $i) { + $mid = $comments[$i]->getVar('com_modid'); + if (!isset($comment_config[$mid])) { + $comment_config[$mid] = $modules[$mid]->getInfo('comments'); + } + $ret[$i]['title'] = 'Comments: ' . $comments[$i]->getVar('com_title', 'n'); + $link = XOOPS_URL + . '/modules/' + . $modules[$mid]->getVar('dirname') + . '/' + . $comment_config[$mid]['pageName'] + . '?' + . $comment_config[$mid]['itemName'] + . '=' + . $comments[$i]->getVar('com_itemid') + . '&com_id=' + . $i + . '&com_rootid=' + . $comments[$i]->getVar('com_rootid') + . '&' + . $comments[$i]->getVar('com_exparams') + . '#comment' + . $i; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $comments[$i]->getVar('com_created'); + $ret[$i]['description'] = $comments[$i]->getVar('com_text'); + $ret[$i]['category'] = $modules[$mid]->getVar('name', 'n'); + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname') . '/'; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Adslight.php b/class/Plugins/Adslight.php new file mode 100644 index 00000000..72d72f11 --- /dev/null +++ b/class/Plugins/Adslight.php @@ -0,0 +1,82 @@ + + * @author XOOPS Development Team + */ + + +/** + * Adslight RSSFit plugin based on Jobs RSSFit plugin by www.jlmzone.com + * Done by Bjuti (www.bjuti.info) + * Last release date: Jan. 18 2010 + * RSSFit version: 1.2 / 1.5 + * XOOPS version: 2.0.13.2 / 2.2.3 / 2.3.2b / 2.4.3 + */ +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Adslight + */ +class Adslight +{ + public $dirname = 'adslight'; + public $modname; + public $grab; + public $module; // optional, see line 74 + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + //$this->module = $mod; // optional, remove this line if there is nothing + // to do with module info when grabbing entries + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT lid, title, status, desctext, date from ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid = 'Yes' ORDER BY date DESC"; + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewads.php?lid=' . $row['lid']; + $ret[$i]['title'] = $row['title']; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $row['desctext']; // $myts->displayTarea($row['desctext']); + $ret[$i]['extras'] = []; + $i++; + } + + return $ret; + } +} diff --git a/class/Plugins/Ams.php b/class/Plugins/Ams.php new file mode 100644 index 00000000..734f1fb6 --- /dev/null +++ b/class/Plugins/Ams.php @@ -0,0 +1,83 @@ + + * @author XOOPS Development Team + */ + + +/* +* About this RSSFit plug-in +* Author: brash +* Requirements (Tested with): +* Module: AMS +* Version: 2.41 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Ams + * @package XoopsModules\Rssfit\Plugins + */ +class Ams +{ + public $dirname = 'ams'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + $ret = false; +// @require_once XOOPS_ROOT_PATH . '/modules/AMS/class/class.newsstory.php'; + $myts = \MyTextSanitizer::getInstance(); + $ams = \XoopsModules\Ams\Story::getAllPublished($this->grab, 0); + if (count($ams) > 0) { + for ($i = 0, $iMax = count($ams); $i < $iMax; $i++) { + $ret[$i]['title'] = $myts->undoHtmlSpecialChars($ams[$i]->title()); + $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . "/modules/$this->dirname/article.php?storyid=" . $ams[$i]->storyid(); + $ret[$i]['timestamp'] = $ams[$i]->published(); + $ret[$i]['description'] = $ams[$i]->hometext(); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Apcal.php b/class/Plugins/Apcal.php new file mode 100644 index 00000000..e0b0134e --- /dev/null +++ b/class/Plugins/Apcal.php @@ -0,0 +1,82 @@ + + * @author XOOPS Development Team + */ + +/** + * About this RSSFit plug-in + * Author: jayjay + * Requirements (Tested with): + * Module: Apcal + * Version: 1.0 + * RSSFit version: 1.21 + * XOOPS version: 2.0.18.1 + */ +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Apcal + */ +class Apcal +{ + public $dirname = 'apcal'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' . $xoopsDB->prefix('apcal_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $ret[$i]['title'] = $row['summary']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/index.php?event_id=' . $row['id']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['dtstamp']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + + return $ret; + } +} diff --git a/class/Plugins/Buyersguide.php b/class/Plugins/Buyersguide.php new file mode 100644 index 00000000..afbcddad --- /dev/null +++ b/class/Plugins/Buyersguide.php @@ -0,0 +1,88 @@ + + * @author XOOPS Development Team + */ + +/** + * About this RSSFit plug-in + * Author: Hervé Thouzard of Instant Zero (http://www.instant-zero.com) + * Requirements (Tested with): + * Module: Buyersguide + * Version: 1.33 + * Flux RSS : Derniers produits + * RSSFit verision: 1.22 + * XOOPS version: 2.0.18.1 + */ +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Buyersguide + */ +class Buyersguide +{ + public $dirname = 'buyersguide'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + $ret = false; + require_once XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; + $items = $hBgProduct->getRecentProducts(0, 0, $this->grab); + $i = 0; + + if (false !== $items && count($items) > 0) { + foreach ($items as $item) { + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('prod_title', 'n'); + $ret[$i]['timestamp'] = $item->getVar('prod_submited_date'); + if ('' != xoops_trim($item->getVar('prod_summary'))) { + $description = $item->getVar('prod_summary'); + } else { + $description = $item->getVar('prod_description'); + } + $ret[$i]['description'] = $description; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Buyersguidemanufacturers.php b/class/Plugins/Buyersguidemanufacturers.php new file mode 100644 index 00000000..ff9338d2 --- /dev/null +++ b/class/Plugins/Buyersguidemanufacturers.php @@ -0,0 +1,84 @@ + + * @author XOOPS Development Team + */ + + +/** + * About this RSSFit plug-in + * Author: Hervé Thouzard of Instant Zero (http://www.instant-zero.com) + * Requirements (Tested with): + * Module: Buyersguide + * Version: 1.33 + * Flux RSS : Derniers Fabricants + * RSSFit verision: 1.22 + * XOOPS version: 2.0.18.1 + */ +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Buyersguidemanufacturers + */ +class Buyersguidemanufacturers +{ + public $dirname = 'buyersguide'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + $ret = false; + require_once XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; + $items = $hBgManufacturer->getListofActivteManufacturers(0, $this->grab, 'manu_date_added', 'DESC'); + $i = 0; + + if (false !== $items && count($items) > 0) { + foreach ($items as $item) { + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('manu_name', 'n'); + $ret[$i]['timestamp'] = $item->getVar('manu_date_added'); + $ret[$i]['description'] = $item->getVar('manu_description'); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Buyersguidenews.php b/class/Plugins/Buyersguidenews.php new file mode 100644 index 00000000..52c81d8c --- /dev/null +++ b/class/Plugins/Buyersguidenews.php @@ -0,0 +1,84 @@ + + * @author XOOPS Development Team + */ + + +/** + * About this RSSFit plug-in + * Author: Hervé Thouzard of Instant Zero (http://www.instant-zero.com) + * Requirements (Tested with): + * Module: Buyersguide + * Version: 1.33 + * Flux RSS : Derniers Fabricants + * RSSFit verision: 1.22 + * XOOPS version: 2.0.18.1 + */ +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Buyersguidenews + */ +class Buyersguidenews +{ + public $dirname = 'buyersguide'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + $ret = false; + require_once XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; + $items = $hBgNews->getRecentNews(0, $this->grab); + $i = 0; + + if (false !== $items && count($items) > 0) { + foreach ($items as $item) { + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('news_title', 'n'); + $ret[$i]['timestamp'] = $item->getVar('news_date'); + $ret[$i]['description'] = $item->getShortenText(); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Cbb.php b/class/Plugins/Cbb.php new file mode 100644 index 00000000..69c06a70 --- /dev/null +++ b/class/Plugins/Cbb.php @@ -0,0 +1,117 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: CBB +* Version: 1.15 / 2.30 / 2.31 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Cbb + * @package XoopsModules\Rssfit\Plugins + */ +class Cbb +{ + public $dirname = 'newbb'; + public $modname; + public $module; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + $this->module = $mod; + + return $mod; + } + + /** + * @param $obj + * @return mixed + */ + public function &grabEntries(&$obj) + { + @require XOOPS_ROOT_PATH . '/modules/newbb/include/functions.php'; + global $xoopsDB; + $xoopsModule = $this->module; + $myts = \MyTextSanitizer::getInstance(); + $i = 0; + $forumiscHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Forum'); + $topicHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Topic'); + $newbbConfig = $GLOBALS['configHandler']->getConfigsByCat(0, $this->module->getVar('mid')); + + $access_forums = $forumiscHandler->getForums(0, 'access'); + $available_forums = []; + foreach ($access_forums as $forum) { + if ($topicHandler->getPermission($forum)) { + $available_forums[$forum->getVar('forum_id')] = $forum; + } + } + unset($access_forums); + + if (count($available_forums) > 0) { + ksort($available_forums); + $cond = ' AND t.forum_id IN (' . implode(',', array_keys($available_forums)) . ')'; + unset($available_forums); + $cond .= $newbbConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; + $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; + $query = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM ' + . $xoopsDB->prefix('bb_posts') + . ' p, ' + . $xoopsDB->prefix('bb_forums') + . ' f, ' + . $xoopsDB->prefix('bb_topics') + . ' t, ' + . $xoopsDB->prefix('bb_posts_text') + . ' pt WHERE f.forum_id = p.forum_id AND p.post_id = pt.post_id AND p.topic_id = t.topic_id AND t.approved = 1 AND p.approved = 1 AND f.forum_id = t.forum_id ' + . $cond + . ' ORDER BY p.post_time DESC'; + $result = $xoopsDB->query($query, $this->grab); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; + $ret[$i]['title'] = $row['subject']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['post_time']; + $ret[$i]['description'] = $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr']); + $ret[$i]['category'] = $row['forum_name']; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; + $i++; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php new file mode 100644 index 00000000..44650730 --- /dev/null +++ b/class/Plugins/Extcal.php @@ -0,0 +1,138 @@ + + * @author XOOPS Development Team + */ + +/* +* This file is a dummy for making a RSSFit plug-in, follow the following steps +* if you really want to do so. +* Step 0: Stop here if you are not sure what you are doing, it's no fun at all +* Step 1: Clone this file and rename as something like rssfit.[mod_dir].php +* Step 2: Replace the text "RssfitMyalbum" with "Rssfit[mod_dir]" at line 59 and +* line 65, i.e. "RssfitNews" for the module "News" +* Step 3: Modify the word in line 60 from 'Myalbum' to [mod_dir] +* Step 4: Modify the function "grabEntries" to satisfy your needs +* Step 5: Move your new plug-in file to the RSSFit plugins folder, +* i.e. your-xoops-root/modules/rssfit/plugins +* Step 6: Install your plug-in by pointing your browser to +* your-xoops-url/modules/rssfit/admin/?do=plugins +* Step 7: Finally, tell us about yourself and this file by modifying the +* "About this RSSFit plug-in" section which is located... somewhere. +* +* [mod_dir]: Name of the driectory of your module, i.e. 'news' +* +* About this RSSFit plug-in +* Author: John Doe +* Requirements (or Tested with): +* Module: Blah +* Version: 1.0 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Extcal + * @package XoopsModules\Rssfit\Plugins + */ +class Extcal +{ + public $dirname = 'extcal'; + public $classname = 'extcal'; //mb + public $modname; + public $grab; + public $module; // optional, see line 74 + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + $this->module = $mod; // optional, remove this line if there is nothing + // to do with module info when grabbing entries + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + + $i = 0; + + // read confgs to get timestamp format + $extcal = $this->module; + $configHandler = xoops_getHandler('config'); + $extcalConfig = $configHandler->getConfigsByCat(0, $extcal->getVar('mid')); + $long_form = $extcalConfig['date_long']; + + $eventHandler = \XoopsModules\Extcal\Helper::getInstance()->getHandler('Event'); + $catHandler = \XoopsModules\Extcal\Helper::getInstance()->getHandler('Cat'); + $events = $eventHandler->getUpcomingEvent(0, $this->grab, 0); + + if (is_array($events)) { + foreach ($events as $event) { + ++$i; + + $cat = $catHandler->getCat($event->getVar('cat_id'), 0); + $category = $cat->getVar('cat_name'); + $link = XOOPS_URL . '/modules/extcal/event.php?event=' . $event->getVar('event_id'); + $event_start = formatTimestamp($event->getVar('event_start'), $long_form); + $title = xoops_utf8_encode(htmlspecialchars($event->getVar('event_title'), ENT_QUOTES)); + $description = xoops_utf8_encode(htmlspecialchars($event->getVar('event_desc'), ENT_QUOTES)); + $address = $event->getVar('event_address'); + + $desc_link = $event->getVar('event_url'); + if ('' == $desc_link) { + $desc_link = $link; + } + $desc = "$title
    "; + $desc .= ''; + $desc .= ""; + if ('' != $address) { + $desc .= ""; + } + $desc .= ""; + $desc .= '
    When:$event_start
    Where:$address
    What:$description
    '; + + $ret[$i]['title'] = $category . ': ' . $title; + $ret[$i]['link'] = $link; + $ret[$i]['description'] = $desc; + $ret[$i]['timestamp'] = $event->getVar('event_submitdate'); + // $ret[$i]['timestamp'] = time(); + $ret[$i]['guid'] = $link; + $ret[$i]['category'] = $category; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Lexikon.php b/class/Plugins/Lexikon.php new file mode 100644 index 00000000..72cb1c80 --- /dev/null +++ b/class/Plugins/Lexikon.php @@ -0,0 +1,97 @@ + + * @author XOOPS Development Team + */ + + +/** + * About this RSSFit plug-in + * Requirements (Tested with): + * Module: Wordbook + * Version: 1.17 + * RSSFit version: 1.1 / 1.5 + * XOOPS verson: 2.0.13.2 / 2.2.3 (!) + */ +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class lexikon + */ +class Lexikon extends \XoopsObject +{ + public $dirname = 'lexikon'; + public $modname; + public $module; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + $this->module = $mod; + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + //$permiscHandler = xoops_getHandler('groupperm'); + $ret = false; + $i = 0; + $sql = 'SELECT entryID, categoryID, term, definition, datesub FROM ' . $xoopsDB->prefix('lxentries') . ' WHERE submit = 0 AND offline = 0 ORDER BY datesub DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + // required + $ret[$i]['title'] = $row['term']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/entry.php?entryID=' . $row['entryID']; + //$ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['datesub']; + $ret[$i]['description'] = $myts->displayTarea($row['definition']); + // optional + //5. The item synopsis, or description, whatever + //$ret[$i]['guid'] = $link; + // 6. A string + domain that identifies a categorization taxonomy + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + /*$ret[$i]['extras'] = []; + // 7a. without attribute + $ret[$i]['extras']['author'] = array('content' => 'aabbc@c.com'); + // 7b. with attributes + $ret[$i]['extras']['enclosure']['attributes'] = array('url' => 'url-to-any-file', 'length' => 1024000, 'type' => 'audio/mpeg'); + */ + $i++; + } + + return $ret; + } +} diff --git a/class/Plugins/Myalbum.php b/class/Plugins/Myalbum.php new file mode 100644 index 00000000..56a0d925 --- /dev/null +++ b/class/Plugins/Myalbum.php @@ -0,0 +1,160 @@ + + * @author XOOPS Development Team + */ + +/* +* This file is a dummy for making a RSSFit plug-in, follow the following steps +* if you really want to do so. +* Step 0: Stop here if you are not sure what you are doing, it's no fun at all +* Step 1: Clone this file and rename as something like rssfit.[mod_dir].php +* Step 2: Replace the text "RssfitMyalbum" with "Rssfit[mod_dir]" at line 59 and +* line 65, i.e. "RssfitNews" for the module "News" +* Step 3: Modify the word in line 60 from 'Myalbum' to [mod_dir] +* Step 4: Modify the function "grabEntries" to satisfy your needs +* Step 5: Move your new plug-in file to the RSSFit plugins folder, +* i.e. your-xoops-root/modules/rssfit/plugins +* Step 6: Install your plug-in by pointing your browser to +* your-xoops-url/modules/rssfit/admin/?do=plugins +* Step 7: Finally, tell us about yourself and this file by modifying the +* "About this RSSFit plug-in" section which is located... somewhere. +* +* [mod_dir]: Name of the driectory of your module, i.e. 'news' +* +* About this RSSFit plug-in +* Author: John Doe +* Requirements (or Tested with): +* Module: Blah +* Version: 1.0 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Myalbum + * @package XoopsModules\Rssfit\Plugins + */ +class Myalbum +{ + public $dirname = 'myalbum'; + public $modname; + public $grab; + public $module; // optional, see line 74 + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + $this->module = $mod; // optional, remove this line if there is nothing + // to do with module info when grabbing entries + return $mod; + } + + /** + * @param $uid + * @return string + */ + public function myGetUnameFromId($uid) + { + static $thisUser = false; + static $lastUid = false; + static $lastName = ''; + + if ($lastUid == $uid) { + return $lastName; + } + + if (!is_object($thisUser)) { + $memberHandler = xoops_getHandler('member'); + $thisUser = $memberHandler->getUser($uid); + } + $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); + if ('' == $name) { + $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); + } + $lastUid = $uid; + $lastName = $name; + + return $name; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + // For myalbum-p with thumbs enabled + + $sql = 'SELECT p.lid, p.title, p.ext, p.date, t.description, c.cid, c.title as cat, p.submitter'; + $sql .= ' FROM ' . $xoopsDB->prefix('myalbum_photos') . ' p, '; + $sql .= $xoopsDB->prefix('myalbum_text') . ' t, '; + $sql .= $xoopsDB->prefix('myalbum_cat') . ' c '; + $sql .= 'WHERE p.status > 0 AND p.cid = c.cid AND p.lid = t.lid '; + $sql .= 'ORDER BY date DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $link = XOOPS_URL . '/modules/' . $this->dirname . '/photo.php?lid=' . $row['lid']; + $thumb = XOOPS_URL . '/uploads/thumbs/' . $row['lid'] . '.' . $row['ext']; + $name = $this->myGetUnameFromId($row['submitter']); + $title = $myts->displayTarea($row['title']); + $cat = $myts->displayTarea($row['cat']); + $catlink = XOOPS_URL . '/modules/' . $this->dirname . '/viewcat.php?cid=' . $row['cid']; + /* + * Required elements of an RSS item + */ + // 1. Title of an item + $ret[$i]['title'] = $this->modname . ': ' . $title; + // 2. URL of an item + $ret[$i]['link'] = $link; + // 3. Item modification date, must be in Unix time format + $ret[$i]['timestamp'] = $row['date']; + // 4. The item synopsis, or description, whatever + $desc = '

    ' . $title . ' '; + $desc .= 'By ' . $name . ' in ' . $cat . '
    '; + $desc .= $myts->displayTarea($row['description']) . '


    '; + $ret[$i]['description'] = $desc; + /* + * Optional elements of an RSS item + */ + // 5. The item synopsis, or description, whatever + $ret[$i]['guid'] = $link; + // 6. A string + domain that identifies a categorization taxonomy + $ret[$i]['category'] = $cat; + $ret[$i]['domain'] = $catlink; + + $i++; + } + + return $ret; + } +} diff --git a/class/Plugins/Mydownloads.php b/class/Plugins/Mydownloads.php new file mode 100644 index 00000000..49e47118 --- /dev/null +++ b/class/Plugins/Mydownloads.php @@ -0,0 +1,83 @@ + + * @author XOOPS Development Team + */ + +/** + * About this RSSFit plug-in + * Author: tuff + * Requirements (Tested with): + * Module: MyDownloads + * Version: 1.1 + * RSSFit verision: 1.2 / 1.5 + * XOOPS version: 2.0.13.2 / 2.2.3 + */ +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Mydownloads + * @package XoopsModules\Rssfit\Plugins + */ +class Mydownloads extends \XoopsObject +{ + public $dirname = 'mydownloads'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $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'; + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + + return $ret; + } +} diff --git a/class/Plugins/Mylinks.php b/class/Plugins/Mylinks.php new file mode 100644 index 00000000..051cd5d1 --- /dev/null +++ b/class/Plugins/Mylinks.php @@ -0,0 +1,84 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: MyLinks +* Version: 1.1 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Mylinks + * @package XoopsModules\Rssfit\Plugins + */ +class Mylinks +{ + public $dirname = 'mylinks'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + + return $ret; + } +} diff --git a/class/Plugins/Mytube.php b/class/Plugins/Mytube.php new file mode 100644 index 00000000..e64c989d --- /dev/null +++ b/class/Plugins/Mytube.php @@ -0,0 +1,83 @@ + + * @author XOOPS Development Team + */ + +/** + * About this RSSFit plug-in + * Author: jayjay + * Requirements (Tested with): + * Module: MyTube + * Version: 1.0 + * RSSFit version: 1.21 + * XOOPS version: 2.0.18.1 + */ +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Mytube + */ +class Mytube +{ + public $dirname = 'mytube'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; + + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $ret[$i]['title'] = $row['ltitle']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + + return $ret; + } +} diff --git a/class/Plugins/Newbb.php b/class/Plugins/Newbb.php new file mode 100644 index 00000000..b7d174e2 --- /dev/null +++ b/class/Plugins/Newbb.php @@ -0,0 +1,96 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: Newbb +* Version: 1.0 +* RSSFit verision: 1.2 +* XOOPS version: 2.0.13.2 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Newbb + * @package XoopsModules\Rssfit\Plugins + */ +class Newbb +{ + public $dirname = 'newbb'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + if ($mod->getVar('version') >= 200) { + return false; + } + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + require_once XOOPS_ROOT_PATH . '/modules/' . $this->dirname . '/class/class.forumposts.php'; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.nohtml, p.nosmiley, f.forum_name, t.post_text FROM ' + . $xoopsDB->prefix('bb_posts') + . ' p, ' + . $xoopsDB->prefix('bb_forums') + . ' f, ' + . $xoopsDB->prefix('bb_posts_text') + . ' t WHERE f.forum_id = p.forum_id AND p.post_id = t.post_id AND f.forum_type != 1 ORDER BY p.post_time DESC'; + if (!$result = $xoopsDB->query($sql, $this->grab, 0)) { + return $ret; + } + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; + $ret[$i]['title'] = $row['subject']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['post_time']; + $ret[$i]['description'] = $myts->displayTarea($row['post_text'], $row['nohtml'] ? 0 : 1, $row['nosmiley'] ? 0 : 1); + $ret[$i]['category'] = $row['forum_name']; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; + $i++; + } + + return $ret; + } +} diff --git a/class/Plugins/Newbb2.php b/class/Plugins/Newbb2.php new file mode 100644 index 00000000..9ac14ee2 --- /dev/null +++ b/class/Plugins/Newbb2.php @@ -0,0 +1,150 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: Newbb 2 +* Version: 2.0.1 +* RSSFit verision: 1.2 +* XOOPS version: 2.0.13.2 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Newbb2 + * @package XoopsModules\Rssfit\Plugins + */ +class Newbb2 +{ + public $dirname = 'newbb'; + public $modname; + public $module; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive') || $mod->getVar('version') < 200) { + return false; + } + $this->modname = $mod->getVar('name'); + $this->module = $mod; + + return $mod; + } + + /** + * @param $uid + * @return string + */ + public function myGetUnameFromId($uid) + { + static $thisUser = false; + static $lastUid = false; + static $lastName = ''; + + if (0 == $uid) { + return 'A guest'; + } + + if ($lastUid == $uid) { + return $lastName; + } + + if (!is_object($thisUser)) { + $memberHandler = xoops_getHandler('member'); + $thisUser = $memberHandler->getUser($uid); + } + $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); + if ('' == $name) { + $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); + } + $lastUid = $uid; + $lastName = $name; + + return $name; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + @require XOOPS_ROOT_PATH . '/modules/newbb/include/functions.php'; + global $xoopsDB, $configHandler; + $xoopsModule = $this->module; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $forumiscHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Forum'); + $topicHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Topic'); + $newbbConfig = $configHandler->getConfigsByCat(0, $this->module->getVar('mid')); + + $access_forums = $forumiscHandler->getForums(0, 'access'); + $available_forums = []; + foreach ($access_forums as $forum) { + if ($topicHandler->getPermission($forum)) { + $available_forums[$forum->getVar('forum_id')] = $forum; + } + } + unset($access_forums); + + if (count($available_forums) > 0) { + ksort($available_forums); + $cond = ' AND t.forum_id IN (' . implode(',', array_keys($available_forums)) . ')'; + unset($available_forums); + $cond .= $newbbConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; + $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; + $query = 'SELECT p.uid, p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM ' + . $xoopsDB->prefix('bb_posts') + . ' p, ' + . $xoopsDB->prefix('bb_forums') + . ' f, ' + . $xoopsDB->prefix('bb_topics') + . ' t, ' + . $xoopsDB->prefix('bb_posts_text') + . ' pt WHERE f.forum_id = p.forum_id AND p.post_id = pt.post_id AND p.topic_id = t.topic_id AND t.approved = 1 AND p.approved = 1 AND f.forum_id = t.forum_id ' + . $cond + . ' ORDER BY p.post_time DESC'; + $result = $xoopsDB->query($query, $this->grab); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; + $ret[$i]['title'] = $this->modname . ': ' . $row['subject']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['post_time']; + $ret[$i]['description'] = sprintf('Posted by: %s
    %s', $this->myGetUnameFromId($row['uid']), $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr'])); + $ret[$i]['category'] = $row['forum_name']; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; + $i++; + } + } + + return $ret; + } +} diff --git a/class/Plugins/News.php b/class/Plugins/News.php new file mode 100644 index 00000000..0d2407e2 --- /dev/null +++ b/class/Plugins/News.php @@ -0,0 +1,92 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: News +* Version: 1.1 / 1.3 / 1.42 / 1.44 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +//use XoopsModules\News; + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class News + * @package XoopsModules\Rssfit\Plugins + */ +class News +{ + public $dirname = 'news'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + $this->module = $mod; + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + $ret = false; +// @require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; + $myts = \MyTextSanitizer::getInstance(); + if ($this->module->getVar('version') >= 130) { +// @require_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php'; + $news = \XoopsModules\News\NewsStory::getAllPublished($this->grab, 0, \XoopsModules\News\Utility::getmoduleoption('restrictindex')); + } else { + $news = \XoopsModules\News\NewsStory::getAllPublished($this->grab, 0); + } + if (count($news) > 0) { + for ($i = 0, $iMax = count($news); $i < $iMax; $i++) { + $ret[$i]['title'] = $this->modname . ': ' . $myts->undoHtmlSpecialChars($news[$i]->title()); + $ret[$i]['link'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); + $ret[$i]['guid'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); + $ret[$i]['timestamp'] = $news[$i]->published(); + $desc = $news[$i]->hometext(); + $ret[$i]['description'] = $news[$i]->hometext(); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + } + } + + return $ret; + } +} diff --git a/plugins/rssfit.oledrion.php b/class/Plugins/Oledrion.php similarity index 52% rename from plugins/rssfit.oledrion.php rename to class/Plugins/Oledrion.php index 827c2c16..bfba49be 100644 --- a/plugins/rssfit.oledrion.php +++ b/class/Plugins/Oledrion.php @@ -1,58 +1,70 @@ - + * @author XOOPS Development Team + */ + +//use XoopsModules\Oledrion; + if (!defined('RSSFIT_ROOT_PATH')) { exit(); } /** - * Class RssfitOledrion + * Class Oledrion + * @package XoopsModules\Rssfit\Plugins */ -class RssfitOledrion +class Oledrion { public $dirname = 'oledrion'; public $modname; public $grab; + /** + * @return bool + */ public function loadModule() { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } $this->modname = $mod->getVar('name'); + return $mod; } + /** + * @param $obj + * @return bool + */ public function &grabEntries(&$obj) { $ret = false; - include XOOPS_ROOT_PATH.'/modules/oledrion/include/common.php'; - $items = $h_oledrion_products->getRecentProducts(new Oledrion_parameters(['start' => 0, 'limit' => $this->grab])); - $i = 0; + require_once XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; + $helper = \XoopsModules\Oledrion\Helper::getInstance(); + $productsHandler = $helper->getHandler('Products'); + $items = $productsHandler->getRecentProducts(new Oledrion\Parameters(['start' => 0, 'limit' => $this->grab])); + $i = 0; if (false !== $items && count($items) > 0) { foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('product_title', 'n'); + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('product_title', 'n'); $ret[$i]['timestamp'] = $item->getVar('product_submitted'); if ('' != xoops_trim($item->getVar('product_summary'))) { $description = $item->getVar('product_summary'); @@ -60,11 +72,12 @@ public function &grabEntries(&$obj) $description = $item->getVar('product_description'); } $ret[$i]['description'] = $description; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } + return $ret; } } diff --git a/class/Plugins/Pical.php b/class/Plugins/Pical.php new file mode 100644 index 00000000..607951b6 --- /dev/null +++ b/class/Plugins/Pical.php @@ -0,0 +1,82 @@ + + * @author XOOPS Development Team + */ + +/** + * About this RSSFit plug-in + * Author: jayjay + * Requirements (Tested with): + * Module: piCal + * Version: 1.0 + * RSSFit version: 1.21 + * XOOPS version: 2.0.18.1 + */ +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Pical + */ +class Pical +{ + public $dirname = 'piCal'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' . $xoopsDB->prefix('pical_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $ret[$i]['title'] = $row['summary']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/index.php?event_id=' . $row['id']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['dtstamp']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + + return $ret; + } +} diff --git a/class/Plugins/Publisher.php b/class/Plugins/Publisher.php new file mode 100644 index 00000000..c8e468ea --- /dev/null +++ b/class/Plugins/Publisher.php @@ -0,0 +1,85 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: SmartSection +* Version: 1.0.4 Beta 2 / 1.1 Beta 1 / 1.05 Beta 1 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +//use XoopsModules\Publisher; + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Publisher + * @package XoopsModules\Rssfit\Plugins + */ +class Publisher +{ + public $dirname = 'publisher'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return array + */ + public function &grabEntries($obj) + { + $ret = []; + require_once XOOPS_ROOT_PATH . '/modules/publisher/include/common.php'; + $helper = \XoopsModules\Publisher\Helper::getInstance(); + $publisherItemHandler = $helper->getHandler('Item'); + $items = $publisherItemHandler->getAllPublished($this->grab, 0); + if (false !== $items && count($items) > 0) { + for ($i = 0, $iMax = count($items); $i < $iMax; $i++) { + $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); + $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); + $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); + $ret[$i]['description'] = $items[$i]->getVar('summary'); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Queries.php b/class/Plugins/Queries.php new file mode 100644 index 00000000..88f3b547 --- /dev/null +++ b/class/Plugins/Queries.php @@ -0,0 +1,101 @@ + + * @author XOOPS Development Team + */ + +/** + * About this RSSFit plug-in + * Author: Richard Griffith + * Requirements (or Tested with): + * Module: Queries https://github.com/geekwright/queries + * Version: 1.0 + * RSSFit verision: 1.3 + * XOOPS version: 2.5.9 + */ +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Queries + * @package XoopsModules\Rssfit\Plugins + */ +class Queries +{ + public $dirname = 'queries'; + public $modname; + public $grab; + public $module; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + $this->module = $mod; // optional, remove this line if there is nothing + // to do with module info when grabbing entries + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + + $i = -1; + $lasttime = false; + $lastuser = false; + $limit = 10 * $this->grab; + + $sql = 'SELECT id, title, posted, querytext FROM ' . $xoopsDB->prefix('queries_query'); + $sql .= ' WHERE approved=1 ORDER BY posted DESC '; + + $result = $xoopsDB->query($sql, $limit, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + ++$i; + if ($i <= $this->grab) { + $desc = $row['querytext']; + if (mb_strlen($desc) > 200) { + $desc = mb_substr($desc, 0, 200) . '...'; + } + $link = XOOPS_URL . '/modules/queries/view.php?id=' . $row['id']; + $ret[$i]['title'] = $this->modname . ': ' . $row['title']; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['posted']; + $ret[$i]['guid'] = $link; + $ret[$i]['category'] = $this->modname; + $ret[$i]['description'] = $desc; + } + if ($i > $this->grab) { + break; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Rmdp.php b/class/Plugins/Rmdp.php new file mode 100644 index 00000000..4353745a --- /dev/null +++ b/class/Plugins/Rmdp.php @@ -0,0 +1,83 @@ + + * @author XOOPS Development Team + */ + +/** + * About this RSSFit plug-in + * Author: agamen0n + * Requirements: + * Module: RMDP + * Version: 1.0 + * RSSFit version: 1.1 + */ +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Rmdp + */ +class Rmdp extends \XoopsObject +{ + public $dirname = 'rmdp'; + public $modname; + public $module; + public $grab; + + /** + * @return bool|FALSE|\XoopsModule + */ + public function loadModule() + { + global $moduleHandler; + $mod = $moduleHandler->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + $this->module = $mod; + + return $mod; + } + + /** + * @param $obj + * @return array + */ + public function grabEntries(&$obj) + { + global $xoopsDB, $grouppermiscHandler; + $ret = []; + $i = 0; + $sql = 'SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ' . $xoopsDB->prefix('rmdp_software') . ' ORDER BY fecha DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $ret[$i]['title'] = $row['nombre']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/down.php?id=' . $row['id_soft']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['fecha']; + $ret[$i]['description'] = $row['longdesc']; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + + return $ret; + } +} diff --git a/class/Plugins/Sample.php b/class/Plugins/Sample.php new file mode 100644 index 00000000..44e74742 --- /dev/null +++ b/class/Plugins/Sample.php @@ -0,0 +1,123 @@ + + * @author XOOPS Development Team + */ + +/* +* This file is a dummy for making a RSSFit plug-in, follow the following steps +* if you really want to do so. +* Step 0: Stop here if you are not sure what you are doing, it's no fun at all +* Step 1: Clone this file and rename as something like rssfit.[mod_dir].php +* Step 2: Replace the text "RssfitSample" with "Rssfit[mod_dir]" at line 59 and +* line 65, i.e. "RssfitNews" for the module "News" +* Step 3: Modify the word in line 60 from 'sample' to [mod_dir] +* Step 4: Modify the function "grabEntries" to satisfy your needs +* Step 5: Move your new plug-in file to the RSSFit plugins folder, +* i.e. your-xoops-root/modules/rssfit/plugins +* Step 6: Install your plug-in by pointing your browser to +* your-xoops-url/modules/rssfit/admin/?do=plugins +* Step 7: Finally, tell us about yourself and this file by modifying the +* "About this RSSFit plug-in" section which is located... somewhere. +* +* [mod_dir]: Name of the driectory of your module, i.e. 'news' +* +* About this RSSFit plug-in +* Author: John Doe +* Requirements (or Tested with): +* Module: Blah +* Version: 1.0 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Sample + * @package XoopsModules\Rssfit\Plugins + */ +class Sample +{ + public $dirname = 'sample'; + public $modname; + public $grab; + public $module; // optional, see line 71 + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + $this->module = $mod; // optional, remove this line if there is nothing + // to do with module info when grabbing entries + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + // The following example code grabs the latest entries from the module MyLinks + $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + /* + * Required elements of an RSS item + */ + // 1. Title of an item + $ret[$i]['title'] = $row['title']; + // 2. URL of an item + $ret[$i]['link'] = $link; + // 3. Item modification date, must be in Unix time format + $ret[$i]['timestamp'] = $row['date']; + // 4. The item synopsis, or description, whatever + $ret[$i]['description'] = $myts->displayTarea($row['description']); + /* + * Optional elements of an RSS item + */ + // 5. The item synopsis, or description, whatever + $ret[$i]['guid'] = $link; + // 6. A string + domain that identifies a categorization taxonomy + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + // 7. extra tags examples + $ret[$i]['extras'] = []; + // 7a. without attribute + $ret[$i]['extras']['author'] = ['content' => 'aabbc@c.com']; + // 7b. with attributes + $ret[$i]['extras']['enclosure']['attributes'] = ['url' => 'url-to-any-file', 'length' => 1024000, 'type' => 'audio/mpeg']; + $i++; + } + + return $ret; + } +} diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php new file mode 100644 index 00000000..7c497801 --- /dev/null +++ b/class/Plugins/Smartfaq.php @@ -0,0 +1,91 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: SmartFAQ +* Version: 1.04 / 1.1 dev +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Smartfaq + * @package XoopsModules\Rssfit\Plugins + */ +class Smartfaq +{ + public $dirname = 'smartfaq'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + $ret = false; + @require XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; + + /** @var \XoopsModules\Smartfaq\FaqHandler $faqHandler */ + $faqHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Faq'); + $faqs = $faqHandler->getAllPublished($this->grab, 0); + if (false !== $faqs && count($faqs) > 0) { + /** @var \XoopsModules\Smartfaq\AnswerHandler $answerHandler */ + $answerHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Answer'); + for ($i = 0, $iMax = count($faqs); $i < $iMax; $i++) { + if (!$answer = $answerHandler->getOfficialAnswer($faqs[$i]->faqid())) { + continue; + } + $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $faqs[$i]->faqid(); + $q = $faqs[$i]->getVar('howdoi', 'n'); + $q = empty($q) ? $faqs[$i]->getVar('question', 'n') : $q; + $ret[$i]['title'] = $q; + $ret[$i]['timestamp'] = $faqs[$i]->getVar('datesub'); + $ret[$i]['description'] = $answer->getVar('answer'); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php new file mode 100644 index 00000000..7fd4ab81 --- /dev/null +++ b/class/Plugins/Smartpartner.php @@ -0,0 +1,81 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements: +* Requirements (Tested with): +* Module: SmartPartner +* Version: 1.02 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Smartpartner + * @package XoopsModules\Rssfit\Plugins + */ +class Smartpartner +{ + public $dirname = 'smartpartner'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + $ret = false; + require_once XOOPS_ROOT_PATH . '/modules/smartpartner/include/common.php'; + $partners = $partnerHandler->getPartners($this->grab, 0, _SPARTNER_STATUS_ACTIVE, 'weight', 'DESC'); + if (false !== $partners && count($partners) > 0) { + for ($i = 0, $iMax = count($partners); $i < $iMax; $i++) { + $ret[$i]['link'] = $ret[$i]['guid'] = SMARTPARTNER_URL . 'partner.php?id=' . $partners[$i]->getVar('id'); + $ret[$i]['title'] = $partners[$i]->getVar('title', 'n'); + $ret[$i]['description'] = $partners[$i]->getVar('summary'); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Smartsection.php b/class/Plugins/Smartsection.php new file mode 100644 index 00000000..80184857 --- /dev/null +++ b/class/Plugins/Smartsection.php @@ -0,0 +1,81 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: SmartSection +* Version: 1.0.4 Beta 2 / 1.1 Beta 1 / 1.05 Beta 1 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Smartsection + * @package XoopsModules\Rssfit\Plugins + */ +class Smartsection +{ + public $dirname = 'smartsection'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + $ret = false; + require_once XOOPS_ROOT_PATH . '/modules/smartsection/include/common.php'; + $items = $smartsection_itemiscHandler->getAllPublished($this->grab, 0); + if (false !== $items && count($items) > 0) { + for ($i = 0, $iMax = count($items); $i < $iMax; $i++) { + $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); + $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); + $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); + $ret[$i]['description'] = $items[$i]->getVar('summary'); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Special.php b/class/Plugins/Special.php new file mode 100644 index 00000000..4668acda --- /dev/null +++ b/class/Plugins/Special.php @@ -0,0 +1,101 @@ + + * @author XOOPS Development Team + */ + +/** + * This file is a dummy for making a RSSFit plug-in, follow the following steps + * if you really want to do so. + * + * Step 0: Stop here if you are not sure what you are doing, it's no fun at all + * Step 1: Clone this file and rename as something like rssfit.[mod_dir].php + * Step 2: Replace the class name "RssfitSpecial" with "Rssfit[mod_dir]" at line 60, + * i.e. "RssfitNews" for the module "News" + * Step 3: Modify the definition of $dirname in line 62 to your modules dirname, i.e. 'news' + * Step 4: Modify the function "grabEntries" method to satisfy your needs + * Step 5: Move your new plug-in file to the RSSFit plugins folder, + * i.e. your-xoops-root/modules/rssfit/plugins + * Step 6: Install your plug-in by pointing your browser to + * your-xoops-url/modules/rssfit/admin/?do=plugins + * Step 7: Finally, tell us about yourself and this file by modifying the + * "About this RSSFit plug-in" section located below. + * + * About this RSSFit plug-in + * Author: John Doe + * Requirements (or Tested with): + * Module: Blah + * Version: 1.0 + * RSSFit verision: 1.2 / 1.5 + * XOOPS version: 2.0.13.2 / 2.2.3 + */ +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Special + * @package XoopsModules\Rssfit\Plugins + */ +class Special +{ + public $dirname = 'special'; + public $modname; + public $grab; // will be set to the maximum number of items to grab + public $module; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + $this->module = $mod; // optional, remove this line if there is nothing + // to do with module info when grabbing entries + return $mod; + } + + /** + * @param $obj + * @return array + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $ret = []; + @require XOOPS_ROOT_PATH . '/modules/special/class/stuff.php'; + $myts = \MyTextSanitizer::getInstance(); + $items = SpecialStuff::getAllPublished($this->grab, 0); + foreach ($items as $item) { + $ret[] = [ + 'title' => $myts->undoHtmlSpecialChars($item->title()), + 'link' => XOOPS_URL . '/modules/special/article.php?itemid=' . $item->itemid(), + 'guid' => XOOPS_URL . '/modules/special/article.php?itemid=' . $item->itemid(), + 'timestamp' => $item->published(), + 'description' => $item->hometext(), + 'category' => $this->modname, + 'domain' => XOOPS_URL . '/modules/' . $this->dirname . '/', + ]; + } + + return $ret; + } +} diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php new file mode 100644 index 00000000..58f12474 --- /dev/null +++ b/class/Plugins/Surnames.php @@ -0,0 +1,145 @@ + + * @author XOOPS Development Team + */ + +/** + * About this RSSFit plug-in + * Author: Richard Griffith + * Requirements (or Tested with): + * Module: Surnames https://github.com/geekwright/surnames + * Version: 1.0 + * RSSFit verision: 1.3 + * XOOPS version: 2.5.9 + */ +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Surnames + * @package XoopsModules\Rssfit\Plugins + */ +class Surnames +{ + public $dirname = 'surnames'; + public $modname; + public $grab; + public $module; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + $this->module = $mod; // optional, remove this line if there is nothing + // to do with module info when grabbing entries + return $mod; + } + + /** + * @param $uid + * @return string + */ + public function myGetUnameFromId($uid) + { + static $thisUser = false; + static $lastUid = false; + static $lastName = ''; + + if ($lastUid == $uid) { + return $lastName; + } + + if (!is_object($thisUser)) { + $memberHandler = xoops_getHandler('member'); + $thisUser = $memberHandler->getUser($uid); + } + $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); + if ('' == $name) { + $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); + } + $lastUid = $uid; + $lastName = $name; + + return $name; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + + $i = -1; + $lasttime = false; + $lastuser = false; + $limit = 10 * $this->grab; + + $sql = "SELECT uid, id, surname, notes, DATE_FORMAT(changed_ts,'%Y-%m-%d') as changedate FROM " . $xoopsDB->prefix('surnames'); + $sql .= ' WHERE approved=1 ORDER BY changedate DESC, uid '; + $result = $xoopsDB->query($sql, $limit, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $changedate = strtotime($row['changedate']); + $uid = $row['uid']; + if ($lasttime == $changedate && $lastuser == $uid) { + $link = XOOPS_URL . '/modules/surnames/view.php?id=' . $row['id']; + $surname = $row['surname']; + $desc .= "$surname
    "; + } else { + if ($i >= 0) { + $ret[$i]['description'] = $desc; + } + ++$i; + $lasttime = $changedate; + $lastuser = $uid; + if ($i <= $this->grab) { + $desc = ''; + $name = $this->myGetUnameFromId($row['uid']); + $ret[$i]['title'] = $this->modname . ': by ' . $name; + $ret[$i]['link'] = XOOPS_URL . '/modules/surnames/list.php?uid=' . $row['uid']; + $ret[$i]['timestamp'] = $changedate; + + $link = XOOPS_URL . '/modules/surnames/view.php?id=' . $row['id']; + $ret[$i]['guid'] = $link; + $ret[$i]['category'] = $this->modname; + + $surname = $row['surname']; + $desc .= "$surname
    "; + } + } + if ($i > $this->grab) { + break; + } + } + if ($i < $this->grab) { + $ret[$i]['description'] = $desc; + } + + return $ret; + } +} diff --git a/class/Plugins/Weblinks.php b/class/Plugins/Weblinks.php new file mode 100644 index 00000000..20a30e92 --- /dev/null +++ b/class/Plugins/Weblinks.php @@ -0,0 +1,116 @@ + + * @author XOOPS Development Team + */ +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: MyLinks +* Version: 1.1 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Weblinks + * @package XoopsModules\Rssfit\Plugins + */ +class Weblinks +{ + public $dirname = 'weblinks'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $uid + * @return string + */ + public function myGetUnameFromId($uid) + { + static $thisUser = false; + static $lastUid = false; + static $lastName = ''; + + if ($lastUid == $uid) { + return $lastName; + } + + if (!is_object($thisUser)) { + $memberHandler = xoops_getHandler('member'); + $thisUser = $memberHandler->getUser($uid); + } + $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); + if ('' == $name) { + $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); + } + $lastUid = $uid; + $lastName = $name; + + return $name; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT lid, title, time_update, description, url, uid FROM ' . $xoopsDB->prefix('weblinks_link') . ' ORDER BY time_update DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $title = $row['title']; + $name = $this->myGetUnameFromId($row['uid']); + $ret[$i]['title'] = $this->modname . ': ' . $title; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?lid=' . $row['lid'] . '&keywords='; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['time_update']; + $desc = '

    ' . $title . '
    '; + $desc .= 'Submitted by: ' . $name . '
    '; + $desc .= $myts->displayTarea($row['description']) . '


    '; + $ret[$i]['description'] = $desc; + $ret[$i]['guid'] = $link; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + + return $ret; + } +} diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php new file mode 100644 index 00000000..df1a861c --- /dev/null +++ b/class/Plugins/Wfdownloads.php @@ -0,0 +1,89 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: WF-Downloads +* Version: 2.0.5a +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Wfdownloads + * @package XoopsModules\Rssfit\Plugins + */ +class Wfdownloads extends \XoopsObject +{ + public $dirname = 'wfdownloads'; + public $modname; + public $module; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + $this->module = $mod; + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $permiscHandler = xoops_getHandler('groupperm'); + $ret = false; + $i = 0; + $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + if ($permiscHandler->checkRight('WFDownFilePerm', $row['lid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['memberHandler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Wfdownloads_podcast.php b/class/Plugins/Wfdownloads_podcast.php new file mode 100644 index 00000000..2dd43de6 --- /dev/null +++ b/class/Plugins/Wfdownloads_podcast.php @@ -0,0 +1,99 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: WF-Downloads +* Version: 3.1 +* RSSFit verision: 1.21 +* XOOPS version: 2.0.14 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Wfdownloads_podcast + * @package XoopsModules\Rssfit\Plugins + */ +class Wfdownloads_podcast extends \XoopsObject +{ + public $dirname = 'wfdownloads'; + public $modname; + public $module; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive') || $mod->getVar('version') < 310) { + return false; + } + $this->modname = $mod->getVar('name'); + $this->module = $mod; + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $permiscHandler = xoops_getHandler('groupperm'); + $ret = false; + $i = 0; + $sql = 'SELECT lid, cid, title, date, description, filetype, size FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 AND (expired > ' . time() . ' OR expired = 0) AND published <= ' . time() . ' ORDER BY date DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + if ((isset($perms[$row['cid']]) && true === $perms[$row['cid']]) + || $permiscHandler->checkRight('WFDownCatPerm', $row['cid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['memberHandler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { + $perms[$row['cid']] = true; + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + // enclosure tag, a.k.a podcast + $ret[$i]['extras']['enclosure']['attributes'] = [ + 'url' => XOOPS_URL . '/modules/' . $this->dirname . '/visit.php?cid=' . $row['cid'] . '&lid=' . $row['lid'], + 'length' => $row['size'], + 'type' => $row['filetype'], + ]; + $i++; + } else { + $perms[$row['cid']] = false; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Wflinks.php b/class/Plugins/Wflinks.php new file mode 100644 index 00000000..8e2356e7 --- /dev/null +++ b/class/Plugins/Wflinks.php @@ -0,0 +1,97 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* +* Author : +* DuGris - http://www.dugris.info +* +* Requirements: +* Module : RSSFit - http://www.brandycoke.com +* verision : 1.20 +* +* Module : wflinks - http://www.wf-projects.com +* Version : 1.03 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Wflinks + */ +class Wflinks +{ + public $dirname = 'wflinks'; + public $modname; + public $mid; + public $grab; + + /** + * @return bool|FALSE|\XoopsModule + */ + public function loadModule() + { + global $moduleHandler; + $mod = $moduleHandler->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + $this->mid = $mod->getVar('mid'); + + return $mod; + } + + /** + * @param $obj + * @return array + */ + public function grabEntries(&$obj) + { + global $xoopsDB, $xoopsUser; + + $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; + $grouppermiscHandler = xoops_getHandler('groupperm'); + + $myts = \MyTextSanitizer::getInstance(); + $ret = []; + $i = 0; + $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + if ($grouppermiscHandler->checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { + // required + $ret[$i]['title'] = $row['title']; + $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $row['description']; + // optional + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Wfsection.php b/class/Plugins/Wfsection.php new file mode 100644 index 00000000..8bf65dc5 --- /dev/null +++ b/class/Plugins/Wfsection.php @@ -0,0 +1,99 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: WF-section +* Version: 1.x +* RSSFit verision: 1.2 +* XOOPS version: 2.0.13.2 +*/ + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Wfsection + * @package XoopsModules\Rssfit\Plugins + */ +class Wfsection +{ + public $dirname = 'wfsection'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + if ($mod->getVar('version') >= 200) { + return false; + } + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + @require XOOPS_ROOT_PATH . '/modules/wfsection/include/groupaccess.php'; + global $xoopsDB; + $ret = false; + $i = 0; + $sql = 'SELECT a.articleid, a.title as atitle, a.published, a.expired, a.counter, a.groupid, a.maintext, a.summary, b.title as btitle FROM ' + . $xoopsDB->prefix('wfs_article') + . ' a, ' + . $xoopsDB->prefix('wfs_category') + . ' b WHERE a.published < ' + . time() + . ' AND a.published > 0 AND (a.expired = 0 OR a.expired > ' + . time() + . ') AND a.noshowart = 0 AND a.offline = 0 AND a.categoryid = b.id ORDER BY published DESC'; + + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + if (checkAccess($row['groupid'])) { + $link = XOOPS_URL . '/modules/' . $this->dirname . '/article.php?articleid=' . $row['articleid']; + $ret[$i]['title'] = $row['atitle']; + $ret[$i]['link'] = $link; + $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['published']; + $ret[$i]['description'] = $myts->displayTarea(!empty($row['summary']) ? $row['summary'] : $row['maintext']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Wfsection2.php b/class/Plugins/Wfsection2.php new file mode 100644 index 00000000..9fb0b657 --- /dev/null +++ b/class/Plugins/Wfsection2.php @@ -0,0 +1,86 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: WF-section +* Version: 2.07 b3 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +use XoopsModules\Rssfit; + +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Wfsection2 + * @package XoopsModules\Rssfit\Plugins + */ +class Wfsection2 +{ + public $dirname = 'wfsection'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive') || $mod->getVar('version') < 200) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + $ret = false; + $articles = Rssfit\WfsArticle::getAllArticle($this->grab, 0, 'online'); + if (count($articles) > 0) { + $xoopsModuleConfig['shortartlen'] = 0; + $myts = \MyTextSanitizer::getInstance(); + for ($i = 0, $iMax = count($articles); $i < $iMax; $i++) { + $link = XOOPS_URL . '/modules/wfsection/article.php?articleid=' . $articles[$i]->articleid(); + $ret[$i]['title'] = $myts->undoHtmlSpecialChars($articles[$i]->title()); + $ret[$i]['link'] = $link; + $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $articles[$i]->published(); + $ret[$i]['description'] = $articles[$i]->summary(); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Xoopstube.php b/class/Plugins/Xoopstube.php new file mode 100644 index 00000000..dcb3b980 --- /dev/null +++ b/class/Plugins/Xoopstube.php @@ -0,0 +1,83 @@ + + * @author XOOPS Development Team + */ + +/** + * About this RSSFit plug-in + * Author: jayjay + * Requirements (Tested with): + * Module: Xoopstube + * Version: 1.0 + * RSSFit version: 1.21 + * XOOPS version: 2.0.18.1 + */ +if (!defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Xoopstube + */ +class Xoopstube +{ + public $dirname = 'xoopstube'; + public $modname; + public $grab; + + /** + * @return bool + */ + public function loadModule() + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return false; + } + $this->modname = $mod->getVar('name'); + + return $mod; + } + + /** + * @param $obj + * @return bool + */ + public function &grabEntries(&$obj) + { + global $xoopsDB; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; + + $result = $xoopsDB->query($sql, $this->grab, 0); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $ret[$i]['title'] = $row['ltitle']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + + return $ret; + } +} diff --git a/class/Utility.php b/class/Utility.php index 1238b4ec..bfdb5786 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -1,4 +1,6 @@ - RSSFIT_URL . $adminmenu[$i]['link'], 1 => $adminmenu[$i]['title']]; + } + $links[] = [0 => XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $xoopsModule->getVar('mid'), 1 => _PREFERENCES]; + $admin_links = ''; + for($i=0, $iMax = count($links); $i < $iMax; $i++ ){ + $admin_links .= ''; + } + $admin_links .= "
    '.$links[$i][1].'

    \n"; + xoops_cp_header(); + echo $admin_links; + } + + /** + * @param $a + * @param $b + * @return int + */ public static function sortTimestamp($a, $b) { if ($a['timestamp'] == $b['timestamp']) { return 0; } + return ($a['timestamp'] > $b['timestamp']) ? -1 : 1; } - public static function genSpecMoreInfo($spec=0, &$rss) + /** + * @param $spec + * @param $feedHandler + * @return string + */ + public static function genSpecMoreInfo($spec, $feedHandler) { - return static::rssfGenAnchor($rss->specUrl($spec), _AM_EDIT_CHANNEL_QMARK, 'spec', _AM_EDIT_CHANNEL_MOREINFO); + return static::rssfGenAnchor($feedHandler->specUrl($spec), _AM_EDIT_CHANNEL_QMARK, 'spec', _AM_EDIT_CHANNEL_MOREINFO); } - public static function rssfGenAnchor($url='', $text='', $target= '', $title='', $class='', $id='') + /** + * @param string $url + * @param string $text + * @param string $target + * @param string $title + * @param string $class + * @param string $id + * @return string + */ + public static function rssfGenAnchor($url = '', $text = '', $target = '', $title = '', $class = '', $id = '') { if (!empty($url)) { $ret = ''; - $ret .= ''; + $ret .= ''; + return $ret; } + return $text; } } diff --git a/class/misc.php b/class/misc.php deleted file mode 100644 index 8b89d8fd..00000000 --- a/class/misc.php +++ /dev/null @@ -1,245 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssMisc extends \XoopsObject -{ - public function __construct() - { - parent::__construct(); - // key, data_type, value, req, max, opt - $this->initVar('misc_id', XOBJ_DTYPE_INT, null, false); - $this->initVar('misc_category', XOBJ_DTYPE_TXTBOX, '', true, 15); - $this->initVar('misc_title', XOBJ_DTYPE_TXTBOX, '', false, 255); - $this->initVar('misc_content', XOBJ_DTYPE_TXTAREA, '', false); - $this->initVar('misc_setting', XOBJ_DTYPE_ARRAY, ''); - } - - public function setDoHtml($do=true) - { - $this->vars['dohtml']['value'] = $do; - } - - public function setDoBr($do=true) - { - $this->vars['dobr']['value'] = $do; - } -} - -class RssMiscHandler extends \XoopsObjectHandler -{ - public $db; - public $db_table; - public $obj_class = 'RssMisc'; - public $obj_key = 'misc_id'; - - public function __construct(\XoopsDatabase $db) - { - $this->db = $db; - $this->db_table = $this->db->prefix($helper->getDirname() . '_misc'); - } - - public function getInstance(\XoopsDatabase $db) - { - static $instance; - if (null === $instance) { - $instance = new RssMiscHandler($db); - } - return $instance; - } - - public function create() - { - $obj = new $this->obj_class(); - $obj->setNew(); - return $obj; - } - - public function get($id, $fields='*') - { - $criteria = new \Criteria($this->obj_key, (int)$id); - if ($objs = $this->getObjects($criteria)) { - return 1 != count($objs) ? false : $objs[0]; - } - return false; - } - - public function getCount($criteria=null) - { - $sql = 'SELECT COUNT(*) FROM '.$this->db_table; - if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { - $sql .= ' '.$criteria->renderWhere(); - } - if (!$result =& $this->db->query($sql)) { - return false; - } - list($count) = $this->db->fetchRow($result); - return $count; - } - - public function &getObjects($criteria=null, $fields='*', $key='') - { - $ret = false; - $limit = $start = 0; - $sql = 'SELECT '.$fields.' FROM '.$this->db_table; - if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { - $sql .= ' '.$criteria->renderWhere(); - if ('' != $criteria->getSort()) { - $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); - } - $limit = $criteria->getLimit(); - $start = $criteria->getStart(); - } - if (!preg_match('/ORDER\ BY/', $sql)) { - $sql .= ' ORDER BY '.$this->obj_key.' ASC'; - } - $result = $this->db->query($sql, $limit, $start); - if (!$result) { - return false; - } - while (false !== ($myrow = $this->db->fetchArray($result))) { - $obj = new $this->obj_class(); - $obj->assignVars($myrow); - switch ($key) { - default: - $ret[] =& $obj; - break; - case 'title': - $ret[$myrow['misc_title']] =& $obj; - break; - case 'id': - $ret[$myrow[$this->obj_key]] =& $obj; - break; - } - unset($obj); - } - return $ret; - } - - public function insert(\XoopsObject $obj) //, $force = false) - { - $force = false; - if (strtolower(get_class($obj)) != strtolower($this->obj_class)) { - return false; - } - if (!$obj->isDirty()) { - return true; - } - if (!$obj->cleanVars()) { - return false; - } - foreach ($obj->cleanVars as $k => $v) { - if (XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) { - $cleanvars[$k] = (int)$v; - } else { - $cleanvars[$k] = $this->db->quoteString($v); - } - } - if (count($obj->getErrors()) > 0) { - return false; - } - if ($obj->isNew() || empty($cleanvars[$this->obj_key])) { - $cleanvars[$this->obj_key] = $this->db->genId($this->db_table.'_'.$this->obj_key.'_seq'); - $sql = 'INSERT INTO '.$this->db_table.' ('.implode(',', array_keys($cleanvars)).') VALUES ('.implode(',', array_values($cleanvars)) .')'; - } else { - unset($cleanvars[$this->obj_key]); - $sql = 'UPDATE '.$this->db_table.' SET'; - foreach ($cleanvars as $k => $v) { - $sql .= ' '.$k.'='.$v.','; - } - $sql = substr($sql, 0, -1); - $sql .= ' WHERE '.$this->obj_key.' = '.$obj->getVar($this->obj_key); - } - if (false !== $force) { - $result = $this->db->queryF($sql); - } else { - $result = $this->db->query($sql); - } - if (!$result) { - $obj->setErrors('Could not store data in the database.
    '.$this->db->error().' ('.$this->db->errno().')
    '.$sql); - return false; - } - if (false === $obj->getVar($this->obj_key)) { - $obj->assignVar($this->obj_key, $this->db->getInsertId()); - } - return $obj->getVar($this->obj_key); - } - - public function modifyObjects($criteria=null, $fields= [], $force=false) - { - if (is_array($fields) && count($fields) > 0) { - $obj = new $this->obj_class(); - $sql = ''; - foreach ($fields as $k => $v) { - $sql .= $k.' = '; - $sql .= 3 == $obj->vars[$k]['data_type'] ? (int)$v : $this->db->quoteString($v); - $sql .= ', '; - } - $sql = substr($sql, 0, -2); - $sql = 'UPDATE '.$this->db_table.' SET '.$sql; - if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { - $sql .= ' '.$criteria->renderWhere(); - } - if (false !== $force) { - $result = $this->db->queryF($sql); - } else { - $result = $this->db->query($sql); - } - if (!$result) { - return 'Could not store data in the database.
    '.$this->db->error().' ('.$this->db->errno().')
    '.$sql; - } - } - return false; - } - - public function delete(\XoopsObject $obj) // , $force=false) - { - $force = false; - if (strtolower(get_class($obj)) != strtolower($this->obj_class)) { - return false; - } - $sql = 'DELETE FROM '.$this->db_table.' WHERE '.$this->obj_key.'='.$obj->getVar($this->obj_key); - if (false !== $force) { - $result = $this->db->queryF($sql); - } else { - $result = $this->db->query($sql); - } - if (!$result) { - return false; - } - return true; - } -} diff --git a/class/plugins.php b/class/plugins.php deleted file mode 100644 index 216aad5b..00000000 --- a/class/plugins.php +++ /dev/null @@ -1,306 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssPlugins extends \XoopsObject -{ - public function __construct() - { - parent::__construct(); - // key, data_type, value, req, max, opt - $this->initVar('rssf_conf_id', XOBJ_DTYPE_INT, null); - $this->initVar('rssf_filename', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('rssf_activated', XOBJ_DTYPE_INT, 0); - $this->initVar('rssf_grab', XOBJ_DTYPE_INT, 0, true); - $this->initVar('rssf_order', XOBJ_DTYPE_INT, 0); - $this->initVar('subfeed', XOBJ_DTYPE_INT, 0); - $this->initVar('sub_entries', XOBJ_DTYPE_INT, 0); - $this->initVar('sub_link', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('sub_title', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('sub_desc', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('img_url', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('img_link', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('img_title', XOBJ_DTYPE_TXTBOX, ''); - } -} - -class RssPluginsHandler extends \XoopsObjectHandler -{ - public $db; - public $db_table; - public $obj_class = 'RssPlugins'; - public $obj_key = 'rssf_conf_id'; - public $sortby = 'rssf_order'; - public $order = 'ASC'; - - public function __construct(\XoopsDatabase $db) - { - $this->db = $db; - $this->db_table = $this->db->prefix($helper->getDirname() . '_plugins'); - } - public function getInstance(\XoopsDatabase $db) - { - static $instance; - if (null === $instance) { - $instance = new RssPluginsHandler($db); - } - return $instance; - } - public function create() - { - $obj = new $this->obj_class(); - $obj->setNew(); - return $obj; - } - - public function get($id, $fields='*') - { - $ret = false; - $criteria = new \Criteria($this->obj_key, (int)$id); - if ($objs = $this->getObjects($criteria) && 1 === count($objs)) { - $ret =& $objs[0]; - } - return $ret; - } - - public function insert(\XoopsObject $obj) //, $force=false) - { - $force=false; - if (strtolower(get_class($obj)) != strtolower($this->obj_class)) { - return false; - } - if (!$obj->isDirty()) { - return true; - } - if (!$obj->cleanVars()) { - return false; - } - foreach ($obj->cleanVars as $k=>$v) { - if (XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) { - $cleanvars[$k] = (int)$v; - } else { - $cleanvars[$k] = $this->db->quoteString($v); - } - } - if (count($obj->getErrors()) > 0) { - return false; - } - if ($obj->isNew() || empty($cleanvars[$this->obj_key])) { - $cleanvars[$this->obj_key] = $this->db->genId($this->db_table.'_'.$this->obj_key.'_seq'); - $sql = 'INSERT INTO '.$this->db_table.' ('.implode(',', array_keys($cleanvars)).') VALUES ('.implode(',', array_values($cleanvars)) .')'; - } else { - unset($cleanvars[$this->obj_key]); - $sql = 'UPDATE '.$this->db_table.' SET'; - foreach ($cleanvars as $k => $v) { - $sql .= ' '.$k.'='.$v.','; - } - $sql = substr($sql, 0, -1); - $sql .= ' WHERE '.$this->obj_key.' = '.$obj->getVar($this->obj_key); - } - if (false !== $force) { - $result = $this->db->queryF($sql); - } else { - $result = $this->db->query($sql); - } - if (!$result) { - $obj->setErrors('Could not store data in the database.
    '.$this->db->error().' ('.$this->db->errno().')
    '.$sql); - return false; - } - if (false === $obj->getVar($this->obj_key)) { - $obj->assignVar($this->obj_key, $this->db->getInsertId()); - } - return $obj->getVar($this->obj_key); - } - - public function delete(\XoopsObject $obj) //, $force = false) - { - $force = false; - if (strtolower(get_class($obj)) != strtolower($this->obj_class)) { - return false; - } - $sql = 'DELETE FROM '.$this->db_table.' WHERE '.$this->obj_key.'='.$obj->getVar($this->obj_key); - if (false !== $force) { - $result = $this->db->queryF($sql); - } else { - $result = $this->db->query($sql); - } - if (!$result) { - return false; - } - return true; - } - - public function &getObjects($criteria=null, $fields='*', $key='') - { - $ret = false; - $limit = $start = 0; - switch ($fields) { - case 'p_activated': - $fields = 'rssf_conf_id, rssf_filename, rssf_grab, rssf_order'; - break; - case 'p_inactive': - $fields = 'rssf_conf_id, rssf_filename'; - break; - case 'sublist': - $fields = 'rssf_conf_id, rssf_filename, subfeed, sub_title'; - break; - } - $sql = 'SELECT '.$fields.' FROM '.$this->db_table; - if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { - $sql .= ' '.$criteria->renderWhere(); - if ('' != $criteria->getSort()) { - $sql .= ' ORDER BY '.$criteria->getSort().' '.$criteria->getOrder(); - } - $limit = $criteria->getLimit(); - $start = $criteria->getStart(); - } - if (!preg_match('/ORDER\ BY/', $sql)) { - $sql .= ' ORDER BY '.$this->sortby.' '.$this->order; - } - $result = $this->db->query($sql, $limit, $start); - if (!$result) { - return false; - } - while (false !== ($myrow = $this->db->fetchArray($result))) { - $obj = new $this->obj_class(); - $obj->assignVars($myrow); - switch ($key) { - default: - $ret[] =& $obj; - break; - case 'id': - $ret[$myrow[$this->obj_key]] =& $obj; - break; - } - unset($obj); - } - return $ret; - } - - public function modifyObjects($criteria=null, $fields= [], $force=false) - { - if (is_array($fields) && count($fields) > 0) { - $obj = new $this->obj_class(); - $sql = ''; - foreach ($fields as $k => $v) { - $sql .= $k.' = '; - $sql .= 3 == $obj->vars[$k]['data_type'] ? (int)$v : $this->db->quoteString($v); - $sql .= ', '; - } - $sql = substr($sql, 0, -2); - $sql = 'UPDATE '.$this->db_table.' SET '.$sql; - if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { - $sql .= ' '.$criteria->renderWhere(); - } - if (false !== $force) { - $result = $this->db->queryF($sql); - } else { - $result = $this->db->query($sql); - } - if (!$result) { - return 'Could not store data in the database.
    '.$this->db->error().' ('.$this->db->errno().')
    '.$sql; - } - } - return false; - } - - public function getCount($criteria = null) - { - $sql = 'SELECT COUNT(*) FROM '.$this->db_table; - if (null !== $criteria && is_subclass_of($criteria, 'CriteriaElement')) { - $sql .= ' '.$criteria->renderWhere(); - } - $result = $this->db->query($sql); - if (!$result) { - return false; - } - list($count) = $this->db->fetchRow($result); - return $count; - } - - public function forceDeactivate(&$obj, $type='rssf_activated') - { - $criteria = new \Criteria($this->obj_key, $obj->getVar($this->obj_key)); - $fields = ['rssf_activated' => 0, 'subfeed' => 0]; - $this->modifyObjects($criteria, $fields, true); - return true; - } - - public function &getPluginFileList() - { - $ret = false; - if ($objs = $this->getObjects(null, 'rssf_filename')) { - foreach ($objs as $o) { - $ret[] = $o->getVar('rssf_filename'); - } - } - return $ret; - } - - public function &checkPlugin($obj) - { - $ret = false; - global $moduleHandler; - $file = RSSFIT_ROOT_PATH.'plugins/'.$obj->getVar('rssf_filename'); - if (file_exists($file)) { - $require = require_once $file; - $name = explode('.', $obj->getVar('rssf_filename')); - $class = 'Rssfit'.ucfirst($name[1]); - if (class_exists($class)) { - $handler = new $class; - if (!method_exists($handler, 'loadmodule') || !method_exists($handler, 'grabentries')) { - $obj->setErrors(_AM_PLUGIN_FUNCNOTFOUND); - } else { - $dirname = $handler->dirname; - if (!empty($dirname) && is_dir(XOOPS_ROOT_PATH.'/modules/'.$dirname)) { - if (!$handler->loadModule()) { - $obj->setErrors(_AM_PLUGIN_MODNOTFOUND); - } else { - $ret =& $handler; - } - } else { - $obj->setErrors(_AM_PLUGIN_MODNOTFOUND); - } - } - } else { - $obj->setErrors(_AM_PLUGIN_CLASSNOTFOUND.' '.$class); - } - } else { - $obj->setErrors(_AM_PLUGIN_FILENOTFOUND); - } - return $ret; - } -} diff --git a/config/admin.yml b/config/admin.yml new file mode 100644 index 00000000..01b1f3f2 --- /dev/null +++ b/config/admin.yml @@ -0,0 +1 @@ +displaySampleButton: 1 \ No newline at end of file diff --git a/config/config.php b/config/config.php new file mode 100644 index 00000000..d295771c --- /dev/null +++ b/config/config.php @@ -0,0 +1,88 @@ + $moduleDirNameUpper . ' Module Configurator', + 'paths' => [ + 'dirname' => $moduleDirName, + 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', + 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, + 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, + 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, + ], + 'uploadFolders' => [ + XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', + //XOOPS_UPLOAD_PATH . '/flags' + ], + 'copyBlankFiles' => [ + XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', + //XOOPS_UPLOAD_PATH . '/flags' + ], + + 'copyTestFolders' => [ + [ + XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/uploads', + XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + ], + // [ + // XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/thumbs', + // XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/thumbs', + // ], + ], + + 'templateFolders' => [ + '/templates/', + // '/templates/blocks/', + // '/templates/admin/' + ], + 'oldFiles' => [ + '/class/request.php', + '/class/registry.php', + '/class/utilities.php', + '/class/util.php', + // '/include/constants.php', + // '/include/functions.php', + '/ajaxrating.txt', + ], + 'oldFolders' => [ + '/images', + '/css', + '/js', + '/tcpdf', + ], + + 'renameTables' => [// 'XX_archive' => 'ZZZZ_archive', + ], + 'moduleStats' => [ +// 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), +// 'totalitems' => $helper->getHandler('Item')->getItemsCount(), +// 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_SUBMITTED]), + ], + 'modCopyright' => "
    + XOOPS Project", + ]; + diff --git a/config/index.html b/config/index.html new file mode 100644 index 00000000..2c5cdd3f --- /dev/null +++ b/config/index.html @@ -0,0 +1 @@ + diff --git a/config/paths.php b/config/paths.php new file mode 100644 index 00000000..4147a186 --- /dev/null +++ b/config/paths.php @@ -0,0 +1,24 @@ + $moduleDirNameUpper . ' Module Configurator', + 'paths' => [ + 'dirname' => $moduleDirName, + 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', + 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, + 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, + 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, + ], + 'uploadFolders' => [ + XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', + //XOOPS_UPLOAD_PATH . '/flags' + ], + ]; + diff --git a/docs/changelog.txt b/docs/changelog.txt index 7e37efe7..94be32f5 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,4 +1,9 @@ -
    1.31 Beta 2 [NOT RELEASED]
    +
    1.32.0 Beta 1 [NOT RELEASED]
    +
    +- namespaces (mamba) +- autoloading (mamba) + +
    1.31.0 Beta 2 [NOT RELEASED]

    - move files up - Unnecessary double quotes (mamba) @@ -18,10 +23,12 @@ - added URL links for active plugins in sub-feeds (mamba) - added Publisher plugin (mamba) -
    1.31 Beta 1 [2017-10-24]
    + +
    1.31.0 Beta 1 [2017-10-24]

    - Converted to XOOPS 2.5.9/Xmf Admin GUI, PHP 7 compliance (geekwright) +
    1.30 Beta 1 2014-03-03]

    - Converted to XOOPS 2.5.6 Admin GUI (Mamba) diff --git a/docs/lang_diff.txt b/docs/lang_diff.txt index 0be7e56c..92418d82 100644 --- a/docs/lang_diff.txt +++ b/docs/lang_diff.txt @@ -19,4 +19,4 @@ _ _admin.php__ New file to translate : - /xoops/modules/admin/gateways/paypal/language/mylanguage/main.php \ No newline at end of file + /xoops/modules/admin/gateways/paypal/language/mylanguage/main.php \ No newline at end of file diff --git a/docs/license.txt b/docs/license.txt index d511905c..fd94e166 100644 --- a/docs/license.txt +++ b/docs/license.txt @@ -1,12 +1,12 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 Copyright (C) 1989, 1991 Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. - Preamble + Preamble The licenses for most software are designed to take away your freedom to share and change it. By contrast, the GNU General Public @@ -56,7 +56,7 @@ patent must be licensed for everyone's free use or not licensed at all. The precise terms and conditions for copying, distribution and modification follow. - GNU GENERAL PUBLIC LICENSE + GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 0. This License applies to any program or other work which contains @@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals of preserving the free status of all derivatives of our free software and of promoting the sharing and reuse of software generally. - NO WARRANTY + NO WARRANTY 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN @@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. - END OF TERMS AND CONDITIONS + END OF TERMS AND CONDITIONS - How to Apply These Terms to Your New Programs + How to Apply These Terms to Your New Programs If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it diff --git a/docs/readme.txt b/docs/readme.txt index c78ff7f1..7d36e186 100644 --- a/docs/readme.txt +++ b/docs/readme.txt @@ -26,7 +26,7 @@ Using RSSFit ---------------------- To install, go install it just like installing any module of XOOPS. You know you are smart enough to make it right. For more information of installing a module of XOOPS, please refer to: -http://www.xoops.org/modules/smartfaq/faq.php?faqid=90 +https://xoops.org/modules/smartfaq/faq.php?faqid=90 For detailed documentation please the RSSFit home page: http://www.brandycoke.com/products/rssfit/ diff --git a/header.php b/header.php index dafcc559..b6b5b293 100644 --- a/header.php +++ b/header.php @@ -1,32 +1,21 @@ ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### +/* + * 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. + */ -require dirname(dirname(__DIR__)) . '/mainfile.php'; -require __DIR__ . '/include/common.php'; +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @package RSSFit - Extendable XML news feed generator + * @author NS Tai (aka tuff) + * @author XOOPS Development Team + */ + +require_once dirname(dirname(__DIR__)) . '/mainfile.php'; +require_once __DIR__ . '/include/common.php'; diff --git a/include/common.php b/include/common.php index 20ad1d2a..2651d7e2 100644 --- a/include/common.php +++ b/include/common.php @@ -1,53 +1,135 @@ ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### - -if (!defined('RSSFIT_CONSTANTS_DEFINED')) { - define('RSSFIT_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/'); - define('RSSFIT_URL', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/'); - define('RSSFIT_URL_FEED', RSSFIT_URL . 'rss.php'); - define('RSSFIT_ADMIN_URL', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/'); - define('RSSFIT_CONSTANTS_DEFINED', 1); +/* + * 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. + */ + +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @package + * @since + * @author XOOPS Development Team + */ +use XoopsModules\Rssfit; +include dirname(__DIR__) . '/preloads/autoloader.php'; + +$moduleDirName = basename(dirname(__DIR__)); +$moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName + +/** @var \XoopsDatabase $db */ +/** @var \XoopsModules\Rssfit\Helper $helper */ +/** @var \XoopsModules\Rssfit\Utility $utility */ +$db = \XoopsDatabaseFactory::getDatabaseConnection(); +$debug = false; +$helper = \XoopsModules\Rssfit\Helper::getInstance($debug); +$utility = new \XoopsModules\Rssfit\Utility(); +//$configurator = new Rssfit\Common\Configurator(); + +$helper->loadLanguage('common'); + +//handlers +//$categoryHandler = new Rssfit\CategoryHandler($db); +//$downloadHandler = new Rssfit\DownloadHandler($db); + +$pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); +$pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32); +if (is_object($helper->getModule())) { + $pathModIcon16 = $helper->getModule()->getInfo('modicons16'); + $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); +} + +if (!defined($moduleDirNameUpper . '_CONSTANTS_DEFINED')) { + define($moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__))); + define($moduleDirNameUpper . '_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); + define($moduleDirNameUpper . '_PATH', XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/'); + define($moduleDirNameUpper . '_URL', XOOPS_URL . '/modules/' . $moduleDirName . '/'); + define($moduleDirNameUpper . '_URL_FEED', XOOPS_URL . '/modules/' . $moduleDirName . '/rss.php'); + define($moduleDirNameUpper . '_IMAGE_URL', constant($moduleDirNameUpper . '_URL') . '/assets/images/'); + define($moduleDirNameUpper . '_IMAGE_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/assets/images'); + define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/'); + define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/'); + define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php'); +// define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); + define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash + define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash + define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', $pathIcon32 . '/xoopsmicrobutton.gif'); + define($moduleDirNameUpper . '_CONSTANTS_DEFINED', 1); } -require_once RSSFIT_ROOT_PATH.'class/rssfeed.php'; +//if (!defined('RSSFIT_CONSTANTS_DEFINED')) { +// define('RSSFIT_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/'); +// define('RSSFIT_URL', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/'); +// define('RSSFIT_URL_FEED', RSSFIT_URL . 'rss.php'); +// define('RSSFIT_ADMIN_URL', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/'); +// define('RSSFIT_CONSTANTS_DEFINED', 1); +//} + +//require_once RSSFIT_ROOT_PATH . 'class/rssfeed.php'; //require_once RSSFIT_ROOT_PATH.'include/functions.php'; -$version = number_format($xoopsModule->getVar('version')/100, 2); -$version = !substr($version, -1, 1) ? substr($version, 0, 3) : $version; -define('RSSFIT_VERSION', 'RSSFit '.$version); +$version = number_format($xoopsModule->getVar('version') / 100, 2); +$version = !mb_substr($version, -1, 1) ? mb_substr($version, 0, 3) : $version; +define('RSSFIT_VERSION', 'RSSFit ' . $version); + +//global $xoopsModuleConfig, $xoopsConfig, $xoopsModule; + +$feedHandler = new \XoopsModules\Rssfit\FeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); +$myts = $feedHandler->myts; +//$pluginsHandler = $feedHandler->pluginHandler; +//$miscHandler = $feedHandler->miscHandler; + +$pluginsHandler = $helper->getHandler('Plugin'); +$miscHandler = $helper->getHandler('Misc'); + + + + + -$rss = new RssfeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); -$myts = $rss->myts; -$pluginsHandler = $rss->pHandler; -$miscHandler = $rss->mHandler; + + + + + + + + + + +$icons = [ + 'edit' => " . _EDIT . ", + 'delete' => "" . _DELETE . "", + 'clone' => "" . _CLONE . "", + 'preview' => "" . _PREVIEW . "", + 'print' => "" . _CLONE . "", + 'pdf' => "" . _CLONE . "", + 'add' => "" . _ADD . "", + '0' => "" . 0 . "", + '1' => "" . 1 . "", +]; + +$debug = false; + +// MyTextSanitizer object +$myts = \MyTextSanitizer::getInstance(); + +if (!isset($GLOBALS['xoopsTpl']) || !($GLOBALS['xoopsTpl'] instanceof \XoopsTpl)) { + require_once $GLOBALS['xoops']->path('class/template.php'); + $GLOBALS['xoopsTpl'] = new \XoopsTpl(); +} + +$GLOBALS['xoopsTpl']->assign('mod_url', XOOPS_URL . '/modules/' . $moduleDirName); +// Local icons path +if (is_object($helper->getModule())) { + $pathModIcon16 = $helper->getModule()->getInfo('modicons16'); + $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); + + $GLOBALS['xoopsTpl']->assign('pathModIcon16', XOOPS_URL . '/modules/' . $moduleDirName . '/' . $pathModIcon16); + $GLOBALS['xoopsTpl']->assign('pathModIcon32', $pathModIcon32); +} diff --git a/include/common0.php b/include/common0.php new file mode 100644 index 00000000..b0f3e0c0 --- /dev/null +++ b/include/common0.php @@ -0,0 +1,41 @@ + + * @author XOOPS Development Team + */ + +use Xmf\Request; +use XoopsModules\Rssfit; + +if (!defined('RSSFIT_CONSTANTS_DEFINED')) { + define('RSSFIT_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/'); + define('RSSFIT_URL', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/'); + define('RSSFIT_URL_FEED', RSSFIT_URL . 'rss.php'); + define('RSSFIT_ADMIN_URL', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/'); + define('RSSFIT_CONSTANTS_DEFINED', 1); +} + +//require_once RSSFIT_ROOT_PATH . 'class/rssfeed.php'; +//require_once RSSFIT_ROOT_PATH.'include/functions.php'; + +$version = number_format($xoopsModule->getVar('version') / 100, 2); +$version = !mb_substr($version, -1, 1) ? mb_substr($version, 0, 3) : $version; +define('RSSFIT_VERSION', 'RSSFit ' . $version); + +$rss = new Rssfit\FeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); +$myts = $rss->myts; +$pluginsHandler = $rss->pluginHandler; +$miscHandler = $rss->miscHandler; diff --git a/include/config.php b/include/config.php deleted file mode 100644 index 6053ebe3..00000000 --- a/include/config.php +++ /dev/null @@ -1,80 +0,0 @@ - strtoupper($moduleDirName) . ' Module Configurator', - 'paths' => [ - 'dirname' => $moduleDirName, - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, - ], - 'uploadFolders' => [ - constant($moduleDirNameUpper . '_UPLOAD_PATH'), - constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/category', - constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/screenshots', - //XOOPS_UPLOAD_PATH . '/flags' - ], - 'copyBlankFiles' => [ - constant($moduleDirNameUpper . '_UPLOAD_PATH'), - constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/category', - constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/screenshots', - //XOOPS_UPLOAD_PATH . '/flags' - ], - - 'copyTestFolders' => [ - // constant($moduleDirNameUpper . '_UPLOAD_PATH'), - //[ - // constant($moduleDirNameUpper . '_PATH') . '/testdata/images', - // constant($moduleDirNameUpper . '_UPLOAD_PATH') . '/images', - //] - ], - - 'templateFolders' => [ - '/templates/', - '/templates/blocks/', - '/templates/admin/' - - ], - 'oldFiles' => [ - '/class/request.php', - '/class/registry.php', - '/class/utilities.php', - '/class/util.php', - // '/include/constants.php', - // '/include/functions.php', - '/ajaxrating.txt', - ], - 'oldFolders' => [ - '/images', - '/css', - '/js', - '/tcpdf', - '/images', - ], - 'modCopyright' => " - \'XOOPS', - ]; -} diff --git a/include/functions.php b/include/functions.php index c4d6685b..97cc8c60 100644 --- a/include/functions.php +++ b/include/functions.php @@ -1,61 +1,66 @@ ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### +/* + * 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. + */ + +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @package RSSFit - Extendable XML news feed generator + * @author NS Tai (aka tuff) + * @author XOOPS Development Team + * @param $a + * @param $b + * @return int + */ function sortTimestamp($a, $b) { if ($a['timestamp'] == $b['timestamp']) { return 0; } + return ($a['timestamp'] > $b['timestamp']) ? -1 : 1; } -function genSpecMoreInfo($spec=0, &$rss) +/** + * @param $spec + * @param $feedHandler + * @return string + */ +function genSpecMoreInfo($spec, $feedHandler) { - return rssfGenAnchor($rss->specUrl($spec), _AM_EDIT_CHANNEL_QMARK, 'spec', _AM_EDIT_CHANNEL_MOREINFO); + return rssfGenAnchor($feedHandler->specUrl($spec), _AM_EDIT_CHANNEL_QMARK, 'spec', _AM_EDIT_CHANNEL_MOREINFO); } -function rssfGenAnchor($url='', $text='', $target= '', $title='', $class='', $id='') +/** + * @param string $url + * @param string $text + * @param string $target + * @param string $title + * @param string $class + * @param string $id + * @return string + */ +function rssfGenAnchor($url = '', $text = '', $target = '', $title = '', $class = '', $id = '') { if (!empty($url)) { $ret = ''; - $ret .= ''; + $ret .= ''; + return $ret; } + return $text; } diff --git a/include/install.php b/include/install.php index 8884f380..7b24bdd8 100644 --- a/include/install.php +++ b/include/install.php @@ -1,99 +1,100 @@ ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### +/* + * 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. + */ + +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @package RSSFit - Extendable XML news feed generator + * @author NS Tai (aka tuff) + * @author XOOPS Development Team + */ + + +use XoopsModules\Rssfit; + +require_once dirname(__DIR__) . '/preloads/autoloader.php'; +require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; /** - * @param XoopsModule $xoopsMod + * @param \XoopsModule $xoopsMod * * @return bool */ -function xoops_module_install_rss(\XoopsModule $xoopsMod) +function xoops_module_install_rssfit(\XoopsModule $xoopsMod) { global $xoopsDB, $xoopsConfig; + + $moduleDirName = basename(dirname(__DIR__)); + + $helper = Rssfit\Helper::getInstance(); + $myts = \MyTextSanitizer::getInstance(); rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); - $intro_setting = ['dohtml' =>1, 'dobr' =>1, 'sub' =>stripslashes(_INSTALL_INTRO_SUB)]; - $sql[] = 'INSERT INTO `' - . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` VALUES (1, ' - . $xoopsDB->quoteString('intro') . ', ' - . $xoopsDB->quoteString(stripslashes(_INTRO_TITLE)) . ', ' - . $xoopsDB->quoteString(stripslashes(_INTRO_CONTENT)) . ', ' - . $xoopsDB->quoteString(serialize($intro_setting)) . ')'; - $sql[] = rssfInsertChannel($xoopsMod); - $sql[] = 'INSERT INTO ' - . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' - . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' =>0, 'dobr' =>0, 'feeds' => [0 =>'0'], 'link' =>XOOPS_URL])) . ')'; + $intro_setting = ['dohtml' => 1, 'dobr' => 1, 'sub' => stripslashes(_INSTALL_INTRO_SUB)]; + $sql[] = 'INSERT INTO `' + . $xoopsDB->prefix($helper->getDirname() . '_misc') + . '` VALUES (1, ' + . $xoopsDB->quoteString('intro') + . ', ' + . $xoopsDB->quoteString(stripslashes(_INTRO_TITLE)) + . ', ' + . $xoopsDB->quoteString(stripslashes(_INTRO_CONTENT)) + . ', ' + . $xoopsDB->quoteString(serialize($intro_setting)) + . ')'; + $sql[] = rssfInsertChannel($xoopsMod); + $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "(NULL, 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; foreach ($sql as $s) { if (false === $xoopsDB->query($s)) { - echo ''.$xoopsDB->error().'
    '.$s.'

    '; + echo '' . $xoopsDB->error() . '
    ' . $s . '

    '; + return false; } } + return true; } /** - * @param XoopsModule $xoopsMod + * @param \XoopsModule $xoopsMod * @param int $oldversion version number of prevviously installed version * * @return bool */ -function xoops_module_update_rss(\XoopsModule $xoopsMod, $oldversion) +function xoops_module_update_rssfit(\XoopsModule $xoopsMod, $oldversion) { global $xoopsDB, $xoopsConfig; + $helper = Rssfit\Helper::getInstance(); rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); list($rows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . " WHERE misc_category = 'channel'")); if (!$rows) { - $sql[] = 'ALTER TABLE `'.$xoopsDB->prefix($helper->getDirname() . '_misc').'` ADD `misc_setting` TEXT NOT NULL;'; - $sql[] = 'ALTER TABLE `'.$xoopsDB->prefix($helper->getDirname() . '_misc').'` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; - $intro_setting = ['dohtml' =>1, 'dobr' =>1, 'sub' =>_INSTALL_INTRO_SUB]; - $sql[] = 'UPDATE `' - . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` SET misc_setting = ' - . $xoopsDB->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; - $sql[] = 'ALTER TABLE `' - . $xoopsDB->prefix($helper->getDirname() . '_plugins') . "` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; - $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_plugins') . '` SET sub_entries = 5'; - $sql[] = rssfInsertChannel($xoopsMod); - $sql[] = 'INSERT INTO ' - . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' - . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' =>0, 'dobr' =>0, 'feeds' => [0 =>'0'], 'link' =>XOOPS_URL])) . ')'; + $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` ADD `misc_setting` TEXT NOT NULL;'; + $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; + $intro_setting = ['dohtml' => 1, 'dobr' => 1, 'sub' => _INSTALL_INTRO_SUB]; + $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` SET misc_setting = ' . $xoopsDB->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; + $sql[] = 'ALTER TABLE `' + . $xoopsDB->prefix($helper->getDirname() . '_plugins') + . "` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; + $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_plugins') . '` SET sub_entries = 5'; + $sql[] = rssfInsertChannel($xoopsMod); + $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; foreach ($sql as $s) { if (false === $xoopsDB->query($s)) { - echo ''.$xoopsDB->error().'
    '.$s.'

    '; + echo '' . $xoopsDB->error() . '
    ' . $s . '

    '; + return false; } } } + return true; } @@ -101,10 +102,9 @@ function xoops_module_update_rss(\XoopsModule $xoopsMod, $oldversion) * @param $xoopsMod * @param $lang */ -function rssfInstallLangFile(&$xoopsMod, $lang) +function rssfInstallLangFile($xoopsMod, $lang) { - $file = XOOPS_ROOT_PATH.'/modules/'.$xoopsMod->getVar('dirname') - .'/language/%s/install.php'; + $file = XOOPS_ROOT_PATH . '/modules/' . $xoopsMod->getVar('dirname') . '/language/%s/install.php'; if (file_exists(sprintf($file, $lang))) { include sprintf($file, $lang); } else { @@ -117,35 +117,46 @@ function rssfInstallLangFile(&$xoopsMod, $lang) * * @return string */ -function rssfInsertChannel(&$xoopsMod) +function rssfInsertChannel($xoopsMod) { global $xoopsDB, $xoopsConfig; - $url = $xoopsDB->quoteString(XOOPS_URL); + $helper = Rssfit\Helper::getInstance(); + $url = $xoopsDB->quoteString(XOOPS_URL); $sitename = $xoopsDB->quoteString($xoopsConfig['sitename']); - list($copyright) = $xoopsDB->fetchRow($xoopsDB->query('SELECT conf_value FROM ' - . $xoopsDB->prefix('config') . " WHERE conf_name = 'meta_copyright' AND conf_modid = 1 AND conf_catid = " . XOOPS_CONF_METAFOOTER)); - return 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') - . ' VALUES ' . "('', 'channel', 'title', " . $sitename . ", '')" - . ", ('', 'channel', 'link', " . $url . ", '')" - . ", ('', 'channel', 'description', " + list($copyright) = $xoopsDB->fetchRow($xoopsDB->query('SELECT conf_value FROM ' . $xoopsDB->prefix('config') . " WHERE conf_name = 'meta_copyright' AND conf_modid = 1 AND conf_catid = " . XOOPS_CONF_METAFOOTER)); + + return 'INSERT INTO ' + . $xoopsDB->prefix($helper->getDirname() . '_misc') + . ' VALUES ' + . "(0, 'channel', 'title', " + . $sitename + . ", '')" + . ", (0, 'channel', 'link', " + . $url + . ", '')" + . ", (0, 'channel', 'description', " . $xoopsDB->quoteString($xoopsConfig['slogan']) - . ", ''), ('', 'channel', 'copyright', " + . ", ''), (0, 'channel', 'copyright', " . $xoopsDB->quoteString($copyright) - . ", ''), ('', 'channel', 'managingEditor', " - . $xoopsDB->quoteString($xoopsConfig['adminmail'] - .' ('.$xoopsConfig['sitename'].')') - . ", ''), ('', 'channel', 'webMaster', " - . $xoopsDB->quoteString($xoopsConfig['adminmail'] - .' ('.$xoopsConfig['sitename'].')') . ", '')" - . ", ('', 'channel', 'category', '', '')" - . ", ('', 'channel', 'generator', " - . $xoopsDB->quoteString(XOOPS_VERSION - .' / RSSFit '.$xoopsMod->getInfo('version')) - . ", ''), ('', 'channel', 'docs', " - . $xoopsDB->quoteString('http://blogs.law.harvard.edu/tech/rss') . ", '')" - . ", ('', 'channelimg', 'url', " - . $xoopsDB->quoteString(XOOPS_URL.'/images/logo.gif') . ", '')" - . ", ('', 'channelimg', 'title', " . $sitename . ", '')" - . ", ('', 'channelimg', 'link', " . $url . ", '')" + . ", ''), (0, 'channel', 'managingEditor', " + . $xoopsDB->quoteString($xoopsConfig['adminmail'] . ' (' . $xoopsConfig['sitename'] . ')') + . ", ''), (0, 'channel', 'webMaster', " + . $xoopsDB->quoteString($xoopsConfig['adminmail'] . ' (' . $xoopsConfig['sitename'] . ')') + . ", '')" + . ", (0, 'channel', 'category', '', '')" + . ", (0, 'channel', 'generator', " + . $xoopsDB->quoteString(XOOPS_VERSION . ' / RSSFit ' . $xoopsMod->getInfo('version')) + . ", ''), (0, 'channel', 'docs', " + . $xoopsDB->quoteString('http://blogs.law.harvard.edu/tech/rss') + . ", '')" + . ", (0, 'channelimg', 'url', " + . $xoopsDB->quoteString(XOOPS_URL . '/images/logo.gif') + . ", '')" + . ", (0, 'channelimg', 'title', " + . $sitename + . ", '')" + . ", (0, 'channelimg', 'link', " + . $url + . ", '')" . ';'; } diff --git a/include/oninstall.php b/include/oninstall.php index 4adb0bf2..d58ef99b 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -12,31 +12,29 @@ /** * @copyright {@link https://xoops.org/ XOOPS Project} - * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} + * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} * @package * @since - * @author XOOPS Development Team + * @author XOOPS Development Team */ -use XoopsModules\Rss; +use XoopsModules\Rssfit; /** - * * Prepares system prior to attempting to install module * @param \XoopsModule $module {@link XoopsModule} * * @return bool true if ready to install, false if not */ -function xoops_module_pre_install_rss(\XoopsModule $module) +function xoops_module_pre_install_rssfit(\XoopsModule $module) { - include dirname(__DIR__) . '/preloads/autoloader.php'; - /** @var rss\Utility $utility */ - $utility = new \XoopsModules\Rss\Utility(); + require_once dirname(__DIR__) . '/preloads/autoloader.php'; + $utility = new \XoopsModules\Rssfit\Utility(); $xoopsSuccess = $utility::checkVerXoops($module); $phpSuccess = $utility::checkVerPhp($module); - if (false !== $xoopsSuccess && false !== $phpSuccess) { - $moduleTables =& $module->getInfo('tables'); + if (false !== $xoopsSuccess && false !== $phpSuccess) { + $moduleTables = &$module->getInfo('tables'); foreach ($moduleTables as $table) { $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); } @@ -46,24 +44,21 @@ function xoops_module_pre_install_rss(\XoopsModule $module) } /** - * * Performs tasks required during installation of the module - * @param XoopsModule $module {@link XoopsModule} + * @param \XoopsModule $module {@link XoopsModule} * * @return bool true if installation successful, false if not */ -function xoops_module_install_rss(\XoopsModule $module) +function xoops_module_install_rssfit(\XoopsModule $module) { - include dirname(__DIR__) . '/preloads/autoloader.php'; - require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; - require_once dirname(__DIR__) . '/include/config.php'; + require_once dirname(__DIR__) . '/preloads/autoloader.php'; + require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; $moduleDirName = basename(dirname(__DIR__)); - $helper = rss\Helper::getInstance(); - $configurator = new Rss\Common\Configurator(); - /** @var rss\Utility $utility */ - $utility = new Rss\Utility(); + $helper = Rssfit\Helper::getInstance(); + $configurator = new Rssfit\Common\Configurator(); + $utility = new Rssfit\Utility(); // Load language files $helper->loadLanguage('admin'); @@ -71,15 +66,15 @@ function xoops_module_install_rss(\XoopsModule $module) // default Permission Settings ---------------------- global $xoopsModule; - $moduleId = $xoopsModule->getVar('mid'); - $moduleId2 = $helper->getModule()->mid(); - $grouppermHandler = xoops_getHandler('groupperm'); + $moduleId = $xoopsModule->getVar('mid'); + // $moduleId2 = $helper->getModule()->mid(); + $grouppermiscHandler = xoops_getHandler('groupperm'); // access rights ------------------------------------------ - $grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); - $grouppermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); - $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); - $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); - $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); + $grouppermiscHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); + $grouppermiscHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); + $grouppermiscHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); + $grouppermiscHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); + $grouppermiscHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); // --- CREATE FOLDERS --------------- if (count($configurator->uploadFolders) > 0) { @@ -91,15 +86,15 @@ function xoops_module_install_rss(\XoopsModule $module) // --- COPY blank.png FILES --------------- if (count($configurator->copyBlankFiles) > 0) { - $file = dirname(__DIR__) . '/assets/images/blank.png'; + $file = dirname(__DIR__) . '/assets/images/blank.png'; foreach (array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; $utility::copyFile($file, $dest); } } //delete .html entries from the tpl table - $sql = 'DELETE FROM ' . $xoopsDB->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'"; - $xoopsDB->queryF($sql); + $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $xoopsModule->getVar('dirname', 'n') . "' AND `tpl_file` LIKE '%.html%'"; + $GLOBALS['xoopsDB']->queryF($sql); return true; } diff --git a/include/onuninstall.php b/include/onuninstall.php index 25739cc9..ba2b6465 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -8,38 +8,35 @@ * @link https://xoops.org XOOPS */ -use XoopsModules\Rss; +use XoopsModules\Rssfit; /** * Prepares system prior to attempting to uninstall module - * @param XoopsModule $module {@link XoopsModule} + * @param \XoopsModule $module {@link XoopsModule} * * @return bool true if ready to uninstall, false if not */ - -function xoops_module_pre_uninstall_rss(\XoopsModule $module) +function xoops_module_pre_uninstall_rssfit(\XoopsModule $module) { // Do some synchronization return true; } /** - * * Performs tasks required during uninstallation of the module - * @param XoopsModule $module {@link XoopsModule} + * @param \XoopsModule $module {@link XoopsModule} * * @return bool true if uninstallation successful, false if not */ -function xoops_module_uninstall_rss(\XoopsModule $module) +function xoops_module_uninstall_rssfit(\XoopsModule $module) { // return true; $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = strtoupper($moduleDirName); - $helper = Rss\Helper::getInstance(); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $helper = Rssfit\Helper::getInstance(); - /** @var Rss\Utility $utility */ - $utility = new Rss\Utility(); + $utility = new Rssfit\Utility(); $success = true; $helper->loadLanguage('admin'); diff --git a/include/onupdate.php b/include/onupdate.php index cb79f51c..97cf6510 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -11,17 +11,16 @@ /** * @copyright {@link https://xoops.org/ XOOPS Project} - * @license {@link http://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} + * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} * @package * @since * @author XOOPS Development Team */ -use XoopsModules\Rss; +use XoopsModules\Rssfit; if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser) - || !$GLOBALS['xoopsUser']->IsAdmin() -) { + || !$GLOBALS['xoopsUser']->IsAdmin()) { exit('Restricted access' . PHP_EOL); } @@ -38,51 +37,45 @@ function tableExists($tablename) } /** - * * Prepares system prior to attempting to install module * @param \XoopsModule $xoopsModule * @param null $previousVersion * @return bool true if ready to install, false if not */ -function xoops_module_pre_update_rss(\XoopsModule $xoopsModule, $previousVersion = null) +function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVersion = null) { $moduleDirName = basename(dirname(__DIR__)); - /** @var Rss\Helper $helper */ - /** @var Rss\Utility $utility */ - $helper = Rss\Helper::getInstance(); - $utility = new Rss\Utility(); + /** @var Rssfit\Helper $helper */ + /** @var Rssfit\Utility $utility */ + $helper = Rssfit\Helper::getInstance(); + $utility = new Rssfit\Utility(); $xoopsSuccess = $utility::checkVerXoops($module); $phpSuccess = $utility::checkVerPhp($module); + return $xoopsSuccess && $phpSuccess; } /** - * * Performs tasks required during update of the module * @param \XoopsModule $module {@link XoopsModule} - * @param null $previousVersion + * @param null $previousVersion * * @return bool true if update successful, false if not */ - -function xoops_module_update_rss(\XoopsModule $module, $previousVersion = null) +function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = null) { - $moduleDirName = basename(dirname(__DIR__)); - $capsDirName = strtoupper($moduleDirName); + $moduleDirName = basename(dirname(__DIR__)); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); - /** @var Rss\Helper $helper */ - /** @var Rss\Utility $utility */ - /** @var Rss\Common\Common\Configurator $configurator */ - $helper = Rss\Helper::getInstance(); - $utility = new Rss\Utility(); - $configurator = new Rss\Common\Common\Configurator(); + /** @var Rssfit\Helper $helper */ + /** @var Rssfit\Utility $utility */ + /** @var Rssfit\Common\Configurator $configurator */ + $helper = Rssfit\Helper::getInstance(); + $utility = new Rssfit\Utility(); + $configurator = new Rssfit\Common\Configurator(); if ($previousVersion < 240) { - - - - //delete old HTML templates if (count($configurator->templateFolders) > 0) { foreach ($configurator->templateFolders as $folder) { @@ -118,7 +111,7 @@ function xoops_module_update_rss(\XoopsModule $module, $previousVersion = null) // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { foreach (array_keys($configurator->oldFolders) as $i) { $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]); - /* @var $folderHandler XoopsObjectHandler */ + /* @var XoopsObjectHandler $folderHandler */ $folderHandler = XoopsFile::getHandler('folder', $tempFolder); $folderHandler->delete($tempFolder); } @@ -134,7 +127,7 @@ function xoops_module_update_rss(\XoopsModule $module, $previousVersion = null) // --- COPY blank.png FILES --------------- if (count($configurator->copyBlankFiles) > 0) { - $file = dirname(__DIR__) . '/assets/images/blank.png'; + $file = dirname(__DIR__) . '/assets/images/blank.png'; foreach (array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; $utility::copyFile($file, $dest); @@ -145,9 +138,11 @@ function xoops_module_update_rss(\XoopsModule $module, $previousVersion = null) $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\''; $GLOBALS['xoopsDB']->queryF($sql); - /** @var XoopsGroupPermHandler $grouppermHandler */ - $grouppermHandler = xoops_getHandler('groupperm'); - return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read'); + /** @var \XoopsGroupPermiscHandler $grouppermiscHandler */ + $grouppermiscHandler = xoops_getHandler('groupperm'); + + return $grouppermiscHandler->deleteByModule($module->getVar('mid'), 'item_read'); } + return true; } diff --git a/index.php b/index.php index 6ad5f1c6..30568c11 100644 --- a/index.php +++ b/index.php @@ -1,55 +1,41 @@ ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### +/* + * 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. + */ -require __DIR__ . '/header.php'; +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @package RSSFit - Extendable XML news feed generator + * @author NS Tai (aka tuff) + * @author XOOPS Development Team + */ + +require_once __DIR__ . '/header.php'; $GLOBALS['xoopsOption']['template_main'] = 'rssfit_index.tpl'; -require XOOPS_ROOT_PATH.'/header.php'; -if ($intr = $miscHandler->getObjects(new \Criteria('misc_category', 'intro'))) { - $intro = $intr[0]; +require_once XOOPS_ROOT_PATH . '/header.php'; +$intr = $miscHandler->getObjects2(new \Criteria('misc_category', 'intro')); +if ($intr) { + $intro = $intr[0]; $setting = $intro->getVar('misc_setting'); $intro->setDoHtml($setting['dohtml'] ? 1 : 0); $intro->setDoBr($setting['dobr'] ? 1 : 0); - $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); + $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); $content = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_content')); - $content = str_replace('{SITEURL}', XOOPS_URL.'/', $content); - if (false !== strpos($content, '{SUB}') && $plugins = $pluginsHandler->getObjects(new \Criteria('subfeed', 1))) { + $content = str_replace('{SITEURL}', XOOPS_URL . '/', $content); + if (false !== mb_strpos($content, '{SUB}') && $plugins = $pluginsHandler->getObjects2(new \Criteria('subfeed', 1))) { $sublist = ''; foreach ($plugins as $p) { - $sub = $myts->stripSlashesGPC($setting['sub']); - $sub = str_replace('{URL}', $rss->subFeedUrl($p->getVar('rssf_filename')), $sub); - $sub = str_replace('{TITLE}', $p->getVar('sub_title'), $sub); - $sub = str_replace('{DESC}', $p->getVar('sub_desc'), $sub); + $sub = $myts->stripSlashesGPC($setting['sub']); + $sub = str_replace('{URL}', $feedHandler->subFeedUrl($p->getVar('rssf_filename')), $sub); + $sub = str_replace('{TITLE}', $p->getVar('sub_title'), $sub); + $sub = str_replace('{DESC}', $p->getVar('sub_desc'), $sub); $sublist .= $sub; } $content = str_replace('{SUB}', $sublist, $content); @@ -58,4 +44,4 @@ } $xoopsTpl->assign('intro', ['title' => $title, 'content' => $content]); } -require XOOPS_ROOT_PATH.'/footer.php'; +require_once XOOPS_ROOT_PATH . '/footer.php'; diff --git a/language/english/common.php b/language/english/common.php index 72e69533..3a4ebb8b 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -12,14 +12,13 @@ * Wfdownloads module * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 or later (http://www.gnu.org/licenses/gpl-2.0.html) + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package wfdownload * @since 3.23 * @author Xoops Development Team */ - $moduleDirName = basename(dirname(dirname(__DIR__))); -$moduleDirNameUpper = strtoupper($moduleDirName); +$moduleDirNameUpper = mb_strtoupper($moduleDirName); define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: '); define('CO_' . $moduleDirNameUpper . '_GDLIBVERSION', 'GD Library version: '); @@ -40,7 +39,6 @@ define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); - define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); @@ -56,10 +54,9 @@ define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); - //Help define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__)))); -define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__.'/help/helpheader.tpl'); +define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); @@ -69,3 +66,107 @@ define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); define('CO_' . $moduleDirNameUpper . '_SUPPORT', 'Support'); + +//Sample Data +define('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA', 'Import Sample Data (will delete ALL current data)'); +define('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS', 'Sample Date uploaded successfully'); +define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); +define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', 'Show Sample Button?'); +define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', 'If yes, the "Add Sample Data" button will be visible to the Admin. It is Yes as a default for first installation.'); +define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA', 'Export DB Schema to YAML'); +define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS', 'Export DB Schema to YAML was a success'); +define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR', 'ERROR: Export of DB Schema to YAML failed'); +define('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK', 'Are you sure to Import Sample Data? (It will delete ALL current data)'); +define('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS', 'Hide the Import buttons)'); +define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS', 'Show the Import buttons)'); +define('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM', 'Confirm'); + +//letter choice +define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "Browse items alphabetically"); +define('CO_' . $moduleDirNameUpper . '_' . 'OTHER', 'Other'); +define('CO_' . $moduleDirNameUpper . '_' . 'ALL', 'All'); + +// block defines +define('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS', 'Access Rights'); +define('CO_' . $moduleDirNameUpper . '_' . 'ACTION', 'Action'); +define('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS', 'Active Rights'); +define('CO_' . $moduleDirNameUpper . '_' . 'BADMIN', 'Block Administration'); +define('CO_' . $moduleDirNameUpper . '_' . 'BLKDESC', 'Description'); +define('CO_' . $moduleDirNameUpper . '_' . 'CBCENTER', 'Center Middle'); +define('CO_' . $moduleDirNameUpper . '_' . 'CBLEFT', 'Center Left'); +define('CO_' . $moduleDirNameUpper . '_' . 'CBRIGHT', 'Center Right'); +define('CO_' . $moduleDirNameUpper . '_' . 'SBLEFT', 'Left'); +define('CO_' . $moduleDirNameUpper . '_' . 'SBRIGHT', 'Right'); +define('CO_' . $moduleDirNameUpper . '_' . 'SIDE', 'Alignment'); +define('CO_' . $moduleDirNameUpper . '_' . 'TITLE', 'Title'); +define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE', 'Visible'); +define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN', 'Visible In'); +define('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT', 'Weight'); + +define('CO_' . $moduleDirNameUpper . '_' . 'PERMISSIONS', 'Permissions'); +define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS', 'Blocks Admin'); +define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_DESC', 'Blocks/Group Admin'); + +define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_MANAGMENT', 'Manage'); +define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADDBLOCK', 'Add a new block'); +define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK', 'Edit a block'); +define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK', 'Clone a block'); + +//myblocksadmin +define('CO_' . $moduleDirNameUpper . '_' . 'AGDS', 'Admin Groups'); +define('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME', 'Cache Time'); +define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADMIN', 'Blocks Admin'); + +//Template Admin +define('CO_' . $moduleDirNameUpper . '_' . 'TPLSETS', 'Template Management'); +define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE', 'Generate'); +define('CO_' . $moduleDirNameUpper . '_' . 'FILENAME', 'File Name'); + +//Menu +define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); +define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); +define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); +define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); +define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); +define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK', 'Feedback'); + +//Latest Version Check +define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); + +//DirectoryChecker +define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); +define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); +define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); +define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); +define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); +define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); +define('CO_' . $moduleDirNameUpper . '_' . 'DIRNOTCREATED', 'The directory cannot be created'); +define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); +define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); + +//FileChecker +//define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); +//define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); +//define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); +//define('CO_' . $moduleDirNameUpper . '_' . 'COPYTHEFILE', 'Copy it'); +//define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEFILE', 'Create it'); +//define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); + +define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); +define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); + +//define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); +//define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); + +define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); +define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); + +//image config +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); +define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); diff --git a/language/english/help/help.tpl b/language/english/help/help.tpl index a5ce7a17..4c2f945a 100644 --- a/language/english/help/help.tpl +++ b/language/english/help/help.tpl @@ -14,19 +14,19 @@ extract the module folder into the ../modules directory. Install the module through Admin -> System Module -> Modules.

    Detailed instructions on installing modules are available in the -
    Chapter 2.12 of our XOOPS Operations Manual

    + Chapter 2.12 of our XOOPS Operations Manual

    Some modules may come with a plugin that needs to be installed before use. You install a plugin, - a file name rssfit.module.php by copying it to the module/rss/plugins directory. You will + a file name rssfit.module.php by copying it to the module/rssfit/plugins directory. You will need to activate the new plugin in the Plug-ins administration panel.

    OPERATING INSTRUCTIONS


    Configure the rss feed in the administration area, activating the plugins applicable to your system and needs. You can test your feed on the user side by visting - the rss module.

    + the rssfit module.

    -

    You can access the feed directly your-site-URL/modules/rss/rss.php

    +

    You can access the feed directly your-site-URL/modules/rssfit/rss.php

    Creating Plugins

    @@ -38,14 +38,14 @@

    This module and its operations are very simple.

    Detailed instructions on configuring the access rights for user groups are available in the - Chapter 2.8 of our XOOPS Operations Manual

    + Chapter 2.8 of our XOOPS Operations Manual

    TUTORIAL


    - Tutorial has been started, but we might need your help! Please check out the status of the tutorial here . + Tutorial has been started, but we might need your help! Please check out the status of the tutorial here .

    To contribute to this Tutorial, please fork it on GitHub. -
    This document describes our Documentation Process and it will help you to understand how to contribute. +
    This document describes our Documentation Process and it will help you to understand how to contribute.

    There are more XOOPS Tutorials, so check them out in our XOOPS Tutorial Repository on GitBook.

    diff --git a/language/english/modinfo.php b/language/english/modinfo.php index 3fe326c0..ddaf6b65 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -2,7 +2,7 @@ // Module Info // The name of this module -define('_MI_RSSFIT_NAME', 'XML (RSS feed)'); +define('_MI_RSSFIT_NAME', 'RSS feed'); // A brief description of this module define('_MI_RSSFIT_DESC', 'Extendable XML news feed generator'); @@ -16,8 +16,7 @@ define('_MI_RSSFIT_INDEX', 'Home'); define('_MI_RSSFIT_ABOUT', 'About'); - -// Module Configs +// Module Configs define('_MI_OVERALL_ENTRIES', 'Total entries to show'); define('_MI_OVERALL_ENTRIES_DESC', 'Number of entries to show in the RSS feed'); define('_MI_PLUGIN_ENTRIES', 'Default entry number for plug-ins'); @@ -48,7 +47,7 @@ //1.30 //Help define('_MI_RSSFIT_DIRNAME', basename(dirname(dirname(__DIR__)))); -define('_MI_RSSFIT_HELP_HEADER', __DIR__.'/help/helpheader.tpl'); +define('_MI_RSSFIT_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); define('_MI_RSSFIT_BACK_2_ADMIN', 'Back to Administration of '); define('_MI_RSSFIT_OVERVIEW', 'Overview'); diff --git a/plugins/rssfit.adslight.php b/plugins/rssfit.adslight.php deleted file mode 100644 index 3a9bf8c3..00000000 --- a/plugins/rssfit.adslight.php +++ /dev/null @@ -1,84 +0,0 @@ - & ... nbsp; ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ... nbsp; ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### - -/** - * Adslight RSSFit plugin based on Jobs RSSFit plugin by www.jlmzone.com - * Done by Bjuti (www.bjuti.info) - * Last release date: Jan. 18 2010 - * RSSFit version: 1.2 / 1.5 - * XOOPS version: 2.0.13.2 / 2.2.3 / 2.3.2b / 2.4.3 - */ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -/** - * Class RssfitAdslight - */ -class RssfitAdslight -{ - public $dirname = 'adslight'; - public $modname; - public $grab; - public $module; // optional, see line 74 - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - //$this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries - return $mod; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT lid, title, status, desctext, date from ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid = 'Yes' ORDER BY date DESC"; - $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewads.php?lid='.$row['lid']; - $ret[$i]['title'] = $row['title']; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $row['desctext']; // $myts->displayTarea($row['desctext']); - $ret[$i]['extras'] = []; - $i++; - } - return $ret; - } -} diff --git a/plugins/rssfit.ams.php b/plugins/rssfit.ams.php deleted file mode 100644 index c435ace3..00000000 --- a/plugins/rssfit.ams.php +++ /dev/null @@ -1,77 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: brash -* Requirements (Tested with): -* Module: AMS -* Version: 2.41 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitAms -{ - public $dirname = 'AMS'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - $ret = false; - @require_once XOOPS_ROOT_PATH.'/modules/AMS/class/class.newsstory.php'; - $myts = \MyTextSanitizer::getInstance(); - $ams = AmsStory::getAllPublished($this->grab, 0); - if (count($ams) > 0) { - for ($i=0, $iMax = count($ams); $i < $iMax; $i++) { - $ret[$i]['title'] = $myts->undoHtmlSpecialChars($ams[$i]->title()); - $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL.'/modules/AMS/article.php?storyid='.$ams[$i]->storyid(); - $ret[$i]['timestamp'] = $ams[$i]->published(); - $ret[$i]['description'] = $ams[$i]->hometext(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.buyersguide.php b/plugins/rssfit.buyersguide.php deleted file mode 100644 index e90c0fb2..00000000 --- a/plugins/rssfit.buyersguide.php +++ /dev/null @@ -1,90 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### - -/** - * About this RSSFit plug-in - * Author: Hervé Thouzard of Instant Zero (http://www.instant-zero.com) - * Requirements (Tested with): - * Module: Buyersguide - * Version: 1.33 - * Flux RSS : Derniers produits - * RSSFit verision: 1.22 - * XOOPS version: 2.0.18.1 - */ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -/** - * Class RssfitBuyersguide - */ -class RssfitBuyersguide -{ - public $dirname = 'buyersguide'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - $ret = false; - include XOOPS_ROOT_PATH.'/modules/buyersguide/include/common.php'; - $items = $hBgProduct->getRecentProducts(0, 0, $this->grab); - $i = 0; - - if (false !== $items && count($items) > 0) { - foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('prod_title', 'n'); - $ret[$i]['timestamp'] = $item->getVar('prod_submited_date'); - if ('' != xoops_trim($item->getVar('prod_summary'))) { - $description = $item->getVar('prod_summary'); - } else { - $description = $item->getVar('prod_description'); - } - $ret[$i]['description'] = $description; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - $i++; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.buyersguidemanufacturers.php b/plugins/rssfit.buyersguidemanufacturers.php deleted file mode 100644 index de3e5f08..00000000 --- a/plugins/rssfit.buyersguidemanufacturers.php +++ /dev/null @@ -1,85 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### - -/** - * About this RSSFit plug-in - * Author: Hervé Thouzard of Instant Zero (http://www.instant-zero.com) - * Requirements (Tested with): - * Module: Buyersguide - * Version: 1.33 - * Flux RSS : Derniers Fabricants - * RSSFit verision: 1.22 - * XOOPS version: 2.0.18.1 - */ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -/** - * Class RssfitBuyersguidemanufacturers - */ -class RssfitBuyersguidemanufacturers -{ - public $dirname = 'buyersguide'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - $ret = false; - include XOOPS_ROOT_PATH.'/modules/buyersguide/include/common.php'; - $items = $hBgManufacturer->getListofActivteManufacturers(0, $this->grab, 'manu_date_added', 'DESC'); - $i = 0; - - if (false !== $items && count($items) > 0) { - foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('manu_name', 'n'); - $ret[$i]['timestamp'] = $item->getVar('manu_date_added'); - $ret[$i]['description'] = $item->getVar('manu_description'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - $i++; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.buyersguidenews.php b/plugins/rssfit.buyersguidenews.php deleted file mode 100644 index fdf921ee..00000000 --- a/plugins/rssfit.buyersguidenews.php +++ /dev/null @@ -1,85 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### - -/** - * About this RSSFit plug-in - * Author: Hervé Thouzard of Instant Zero (http://www.instant-zero.com) - * Requirements (Tested with): - * Module: Buyersguide - * Version: 1.33 - * Flux RSS : Derniers Fabricants - * RSSFit verision: 1.22 - * XOOPS version: 2.0.18.1 - */ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -/** - * Class RssfitBuyersguidenews - */ -class RssfitBuyersguidenews -{ - public $dirname = 'buyersguide'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - $ret = false; - include XOOPS_ROOT_PATH.'/modules/buyersguide/include/common.php'; - $items = $hBgNews->getRecentNews(0, $this->grab); - $i = 0; - - if (false !== $items && count($items) > 0) { - foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('news_title', 'n'); - $ret[$i]['timestamp'] = $item->getVar('news_date'); - $ret[$i]['description'] = $item->getShortenText(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - $i++; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.cbb.php b/plugins/rssfit.cbb.php deleted file mode 100644 index 150225d4..00000000 --- a/plugins/rssfit.cbb.php +++ /dev/null @@ -1,102 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: CBB -* Version: 1.15 / 2.30 / 2.31 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitCbb -{ - public $dirname = 'newbb'; - public $modname; - public $module; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; - return $mod; - } - - public function &grabEntries(&$obj) - { - @include XOOPS_ROOT_PATH.'/modules/newbb/include/functions.php'; - global $xoopsDB; - $xoopsModule = $this->module; - $myts = \MyTextSanitizer::getInstance(); - $i = 0; - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); - $topicHandler = xoops_getModuleHandler('topic', 'newbb'); - $newbbConfig = $GLOBALS['configHandler']->getConfigsByCat(0, $this->module->getVar('mid')); - - $access_forums = $forumHandler->getForums(0, 'access'); - $available_forums = []; - foreach ($access_forums as $forum) { - if ($topicHandler->getPermission($forum)) { - $available_forums[$forum->getVar('forum_id')] = $forum; - } - } - unset($access_forums); - - if (count($available_forums) > 0) { - ksort($available_forums); - $cond = ' AND t.forum_id IN ('.implode(',', array_keys($available_forums)).')'; - unset($available_forums); - $cond .= $newbbConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; - $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; - $query = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM '.$xoopsDB->prefix('bb_posts').' p, '.$xoopsDB->prefix('bb_forums').' f, '.$xoopsDB->prefix('bb_topics').' t, '.$xoopsDB->prefix('bb_posts_text').' pt WHERE f.forum_id = p.forum_id AND p.post_id = pt.post_id AND p.topic_id = t.topic_id AND t.approved = 1 AND p.approved = 1 AND f.forum_id = t.forum_id '.$cond.' ORDER BY p.post_time DESC'; - $result = $xoopsDB->query($query, $this->grab); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewtopic.php?topic_id='.$row['topic_id'].'&forum='.$row['forum_id'].'&post_id='.$row['post_id'].'#forumpost'.$row['post_id']; - $ret[$i]['title'] = $row['subject']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['post_time']; - $ret[$i]['description'] = $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr']); - $ret[$i]['category'] = $row['forum_name']; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/viewforum.php?forum='.$row['forum_id']; - $i++; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.comments.php b/plugins/rssfit.comments.php deleted file mode 100644 index 8da71c77..00000000 --- a/plugins/rssfit.comments.php +++ /dev/null @@ -1,88 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: Graham Davies (gravies) -* Modified by: tuff -* Requirements (Tested with): -* Module: any module that support XOOPS system comments -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitComments -{ - public $dirname = 'system'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - $ret = false; - require_once XOOPS_ROOT_PATH.'/include/comment_constants.php'; - $commentHandler = xoops_getHandler('comment'); - $criteria = new \CriteriaCompo(new \Criteria('com_status', XOOPS_COMMENT_ACTIVE)); - $criteria->setLimit($this->grab); - $criteria->setSort('com_created'); - $criteria->setOrder('DESC'); - $comments = $commentHandler->getObjects($criteria, true); - $comment_config = []; - if (count($comments) > 0) { - $modules = $GLOBALS['moduleHandler']->getObjects(new \Criteria('hascomments', 1), true); - foreach (array_keys($comments) as $i) { - $mid = $comments[$i]->getVar('com_modid'); - if (!isset($comment_config[$mid])) { - $comment_config[$mid] = $modules[$mid]->getInfo('comments'); - } - $ret[$i]['title'] = 'Comments: '.$comments[$i]->getVar('com_title', 'n'); - $link = XOOPS_URL.'/modules/'.$modules[$mid]->getVar('dirname').'/'.$comment_config[$mid]['pageName'].'?'.$comment_config[$mid]['itemName'].'='.$comments[$i]->getVar('com_itemid').'&com_id='.$i.'&com_rootid='.$comments[$i]->getVar('com_rootid').'&'.$comments[$i]->getVar('com_exparams').'#comment'.$i; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $comments[$i]->getVar('com_created'); - $ret[$i]['description'] = $comments[$i]->getVar('com_text'); - $ret[$i]['category'] = $modules[$mid]->getVar('name', 'n'); - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$modules[$mid]->getVar('dirname').'/'; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.extcal.php b/plugins/rssfit.extcal.php deleted file mode 100644 index 7e75216b..00000000 --- a/plugins/rssfit.extcal.php +++ /dev/null @@ -1,133 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* This file is a dummy for making a RSSFit plug-in, follow the following steps -* if you really want to do so. -* Step 0: Stop here if you are not sure what you are doing, it's no fun at all -* Step 1: Clone this file and rename as something like rssfit.[mod_dir].php -* Step 2: Replace the text "RssfitMyalbum" with "Rssfit[mod_dir]" at line 59 and -* line 65, i.e. "RssfitNews" for the module "News" -* Step 3: Modify the word in line 60 from 'Myalbum' to [mod_dir] -* Step 4: Modify the function "grabEntries" to satisfy your needs -* Step 5: Move your new plug-in file to the RSSFit plugins folder, -* i.e. your-xoops-root/modules/rss/plugins -* Step 6: Install your plug-in by pointing your browser to -* your-xoops-url/modules/rss/admin/?do=plugins -* Step 7: Finally, tell us about yourself and this file by modifying the -* "About this RSSFit plug-in" section which is located... somewhere. -* -* [mod_dir]: Name of the driectory of your module, i.e. 'news' -* -* About this RSSFit plug-in -* Author: John Doe -* Requirements (or Tested with): -* Module: Blah -* Version: 1.0 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitExtcal -{ - public $dirname = 'extcal'; - public $modname; - public $grab; - public $module; // optional, see line 74 - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries - return $mod; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - - $i = 0; - - // read confgs to get timestamp format - $extcal = $this->module; - $configHandler = xoops_getHandler('config'); - $extcalConfig = &$configHandler->getConfigsByCat(0, $extcal->getVar('mid')); - $long_form=$extcalConfig['date_long']; - - $eventHandler = xoops_getModuleHandler('event', 'extcal'); - $catHandler = xoops_getModuleHandler('cat', 'extcal'); - $events = $eventHandler->getUpcomingEvent(0, $this->grab, 0); - - if (is_array($events)) { - foreach ($events as $event) { - ++$i; - - $cat=$catHandler->getCat($event->getVar('cat_id'), 0); - $category=$cat->getVar('cat_name'); - $link=XOOPS_URL.'/modules/extcal/event.php?event='.$event->getVar('event_id'); - $event_start = formatTimestamp($event->getVar('event_start'), $long_form); - $title = xoops_utf8_encode(htmlspecialchars($event->getVar('event_title'), ENT_QUOTES)); - $description=xoops_utf8_encode(htmlspecialchars($event->getVar('event_desc'), ENT_QUOTES)); - $address=$event->getVar('event_address'); - - $desc_link=$event->getVar('event_url'); - if ('' == $desc_link) { - $desc_link=$link; - } - $desc = "$title
    "; - $desc .= ''; - $desc .= ""; - if ('' != $address) { - $desc .= ""; - } - $desc .= ""; - $desc .= '
    When:$event_start
    Where:$address
    What:$description
    '; - - $ret[$i]['title'] = $category.': '.$title; - $ret[$i]['link'] = $link; - $ret[$i]['description'] = $desc; - $ret[$i]['timestamp'] = $event->getVar('event_submitdate'); - // $ret[$i]['timestamp'] = time(); - $ret[$i]['guid'] = $link; - $ret[$i]['category'] = $category; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.lexikon.php b/plugins/rssfit.lexikon.php deleted file mode 100644 index cd9975c6..00000000 --- a/plugins/rssfit.lexikon.php +++ /dev/null @@ -1,100 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### - -/** - * About this RSSFit plug-in - * Requirements (Tested with): - * Module: Wordbook - * Version: 1.17 - * RSSFit version: 1.1 / 1.5 - * XOOPS verson: 2.0.13.2 / 2.2.3 (!) - */ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -/** - * Class Rssfitlexikon - */ -class Rssfitlexikon extends \XoopsObject -{ - public $dirname = 'lexikon'; - public $modname; - public $module; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; - return $mod; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - //$permHandler = xoops_getHandler('groupperm'); - $ret = false; - $i = 0; - $sql = 'SELECT entryID, categoryID, term, definition, datesub FROM ' - . $xoopsDB->prefix('lxentries') . ' WHERE submit = 0 AND offline = 0 ORDER BY datesub DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - // required - $ret[$i]['title'] = $row['term']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/entry.php?entryID='.$row['entryID']; - //$ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['datesub']; - $ret[$i]['description'] = $myts->displayTarea($row['definition']); - // optional - //5. The item synopsis, or description, whatever - //$ret[$i]['guid'] = $link; - // 6. A string + domain that identifies a categorization taxonomy - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - /*$ret[$i]['extras'] = array(); - // 7a. without attribute - $ret[$i]['extras']['author'] = array('content' => 'aabbc@c.com'); - // 7b. with attributes - $ret[$i]['extras']['enclosure']['attributes'] = array('url' => 'url-to-any-file', 'length' => 1024000, 'type' => 'audio/mpeg'); - */ - $i++; - } - return $ret; - } -} diff --git a/plugins/rssfit.myalbum.php b/plugins/rssfit.myalbum.php deleted file mode 100644 index df7cd003..00000000 --- a/plugins/rssfit.myalbum.php +++ /dev/null @@ -1,151 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* This file is a dummy for making a RSSFit plug-in, follow the following steps -* if you really want to do so. -* Step 0: Stop here if you are not sure what you are doing, it's no fun at all -* Step 1: Clone this file and rename as something like rssfit.[mod_dir].php -* Step 2: Replace the text "RssfitMyalbum" with "Rssfit[mod_dir]" at line 59 and -* line 65, i.e. "RssfitNews" for the module "News" -* Step 3: Modify the word in line 60 from 'Myalbum' to [mod_dir] -* Step 4: Modify the function "grabEntries" to satisfy your needs -* Step 5: Move your new plug-in file to the RSSFit plugins folder, -* i.e. your-xoops-root/modules/rss/plugins -* Step 6: Install your plug-in by pointing your browser to -* your-xoops-url/modules/rss/admin/?do=plugins -* Step 7: Finally, tell us about yourself and this file by modifying the -* "About this RSSFit plug-in" section which is located... somewhere. -* -* [mod_dir]: Name of the driectory of your module, i.e. 'news' -* -* About this RSSFit plug-in -* Author: John Doe -* Requirements (or Tested with): -* Module: Blah -* Version: 1.0 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitMyalbum -{ - public $dirname = 'myalbum'; - public $modname; - public $grab; - public $module; // optional, see line 74 - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries - return $mod; - } - - public function myGetUnameFromId($uid) - { - static $thisUser=false; - static $lastUid=false; - static $lastName=''; - - if ($lastUid==$uid) { - return $lastName; - } - - if (!is_object($thisUser)) { - $memberHandler = xoops_getHandler('member'); - $thisUser = $memberHandler->getUser($uid); - } - $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); - if ('' == $name) { - $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); - } - $lastUid=$uid; - $lastName=$name; - return $name; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - // For myalbum-p with thumbs enabled - - $sql = 'SELECT p.lid, p.title, p.ext, p.date, t.description, c.cid, c.title as cat, p.submitter'; - $sql .= ' FROM ' . $xoopsDB->prefix('myalbum_photos') . ' p, '; - $sql .= $xoopsDB->prefix('myalbum_text') . ' t, '; - $sql .= $xoopsDB->prefix('myalbum_cat') . ' c '; - $sql .= 'WHERE p.status > 0 AND p.cid = c.cid AND p.lid = t.lid '; - $sql .= 'ORDER BY date DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL.'/modules/'.$this->dirname.'/photo.php?lid='.$row['lid']; - $thumb = XOOPS_URL.'/uploads/thumbs/'.$row['lid'].'.'.$row['ext']; - $name = $this->myGetUnameFromId($row['submitter']); - $title = $myts->displayTarea($row['title']); - $cat = $myts->displayTarea($row['cat']); - $catlink = XOOPS_URL.'/modules/'.$this->dirname.'/viewcat.php?cid='.$row['cid']; - /* - * Required elements of an RSS item - */ - // 1. Title of an item - $ret[$i]['title'] = $this->modname . ': ' . $title; - // 2. URL of an item - $ret[$i]['link'] = $link; - // 3. Item modification date, must be in Unix time format - $ret[$i]['timestamp'] = $row['date']; - // 4. The item synopsis, or description, whatever - $desc = '

    '.$title.' '; - $desc .= 'By '.$name.' in '.$cat.'
    '; - $desc .= $myts->displayTarea($row['description']).'


    '; - $ret[$i]['description'] = $desc; - /* - * Optional elements of an RSS item - */ - // 5. The item synopsis, or description, whatever - $ret[$i]['guid'] = $link; - // 6. A string + domain that identifies a categorization taxonomy - $ret[$i]['category'] = $cat; - $ret[$i]['domain'] = $catlink; - - $i++; - } - return $ret; - } -} diff --git a/plugins/rssfit.mydownloads.php b/plugins/rssfit.mydownloads.php deleted file mode 100644 index ae695bd4..00000000 --- a/plugins/rssfit.mydownloads.php +++ /dev/null @@ -1,83 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### - -/** - * About this RSSFit plug-in - * Author: tuff - * Requirements (Tested with): - * Module: MyDownloads - * Version: 1.1 - * RSSFit verision: 1.2 / 1.5 - * XOOPS version: 2.0.13.2 / 2.2.3 - */ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -class RssfitMydownloads extends \XoopsObject -{ - public $dirname = 'mydownloads'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $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'; - $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlefile.php?cid='.$row['cid'].'&lid='.$row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - $i++; - } - return $ret; - } -} diff --git a/plugins/rssfit.mylinks.php b/plugins/rssfit.mylinks.php deleted file mode 100644 index 673a91dd..00000000 --- a/plugins/rssfit.mylinks.php +++ /dev/null @@ -1,81 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: MyLinks -* Version: 1.1 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitMylinks -{ - public $dirname = 'mylinks'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' - . $xoopsDB->prefix('mylinks_links') . ' l, ' - . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?cid='.$row['cid'].'&lid='.$row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - $i++; - } - return $ret; - } -} diff --git a/plugins/rssfit.mytube.php b/plugins/rssfit.mytube.php deleted file mode 100644 index adee8287..00000000 --- a/plugins/rssfit.mytube.php +++ /dev/null @@ -1,87 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### - -/** - * About this RSSFit plug-in - * Author: jayjay - * Requirements (Tested with): - * Module: MyTube - * Version: 1.0 - * RSSFit version: 1.21 - * XOOPS version: 2.0.18.1 - */ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -/** - * Class RssfitMytube - */ -class RssfitMytube -{ - public $dirname = 'mytube'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler'] -> getByDirname($this -> dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this -> modname = $mod -> getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' - . $xoopsDB-> prefix('xoopstube_videos') . ' l, ' - . $xoopsDB-> prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; - - $result = $xoopsDB -> query($sql, $this -> grab, 0); - while (false !== ($row = $xoopsDB -> fetchArray($result))) { - $ret[$i]['title'] = $row['ltitle']; - $link = XOOPS_URL . '/modules/' . $this -> dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $myts -> displayTarea($row['description']); - $ret[$i]['category'] = $this -> modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this -> dirname . '/'; - $i++; - } - return $ret; - } -} diff --git a/plugins/rssfit.newbb.php b/plugins/rssfit.newbb.php deleted file mode 100644 index 0d54ea40..00000000 --- a/plugins/rssfit.newbb.php +++ /dev/null @@ -1,85 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: Newbb -* Version: 1.0 -* RSSFit verision: 1.2 -* XOOPS version: 2.0.13.2 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitNewbb -{ - public $dirname = 'newbb'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - if ($mod->getVar('version') >= 200) { - return false; - } - return $mod; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - require_once XOOPS_ROOT_PATH.'/modules/'.$this->dirname.'/class/class.forumposts.php'; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.nohtml, p.nosmiley, f.forum_name, t.post_text FROM '.$xoopsDB->prefix('bb_posts').' p, '.$xoopsDB->prefix('bb_forums').' f, '.$xoopsDB->prefix('bb_posts_text').' t WHERE f.forum_id = p.forum_id AND p.post_id = t.post_id AND f.forum_type != 1 ORDER BY p.post_time DESC'; - if (!$result = $xoopsDB->query($sql, $this->grab, 0)) { - return $ret; - } - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewtopic.php?topic_id='.$row['topic_id'].'&forum='.$row['forum_id'].'&post_id='.$row['post_id'].'#forumpost'.$row['post_id']; - $ret[$i]['title'] = $row['subject']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['post_time']; - $ret[$i]['description'] = $myts->displayTarea($row['post_text'], $row['nohtml'] ? 0 : 1, $row['nosmiley'] ? 0 : 1); - $ret[$i]['category'] = $row['forum_name']; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/viewforum.php?forum='.$row['forum_id']; - $i++; - } - return $ret; - } -} diff --git a/plugins/rssfit.newbb2.php b/plugins/rssfit.newbb2.php deleted file mode 100644 index f939c14c..00000000 --- a/plugins/rssfit.newbb2.php +++ /dev/null @@ -1,130 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: Newbb 2 -* Version: 2.0.1 -* RSSFit verision: 1.2 -* XOOPS version: 2.0.13.2 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitNewbb2 -{ - public $dirname = 'newbb'; - public $modname; - public $module; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive') || $mod->getVar('version') < 200) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; - return $mod; - } - - public function myGetUnameFromId($uid) - { - static $thisUser=false; - static $lastUid=false; - static $lastName=''; - - if (0 == $uid) { - return 'A guest'; - } - - if ($lastUid==$uid) { - return $lastName; - } - - if (!is_object($thisUser)) { - $memberHandler = xoops_getHandler('member'); - $thisUser = $memberHandler->getUser($uid); - } - $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); - if ('' == $name) { - $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); - } - $lastUid=$uid; - $lastName=$name; - return $name; - } - - public function &grabEntries(&$obj) - { - @include XOOPS_ROOT_PATH.'/modules/newbb/include/functions.php'; - global $xoopsDB, $configHandler; - $xoopsModule = $this->module; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $forumHandler = xoops_getModuleHandler('forum', 'newbb'); - $topicHandler = xoops_getModuleHandler('topic', 'newbb'); - $newbbConfig = $configHandler->getConfigsByCat(0, $this->module->getVar('mid')); - - $access_forums = $forumHandler->getForums(0, 'access'); - $available_forums = []; - foreach ($access_forums as $forum) { - if ($topicHandler->getPermission($forum)) { - $available_forums[$forum->getVar('forum_id')] = $forum; - } - } - unset($access_forums); - - if (count($available_forums) > 0) { - ksort($available_forums); - $cond = ' AND t.forum_id IN ('.implode(',', array_keys($available_forums)).')'; - unset($available_forums); - $cond .= $newbbConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; - $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; - $query = 'SELECT p.uid, p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM '.$xoopsDB->prefix('bb_posts').' p, '.$xoopsDB->prefix('bb_forums').' f, '.$xoopsDB->prefix('bb_topics').' t, '.$xoopsDB->prefix('bb_posts_text').' pt WHERE f.forum_id = p.forum_id AND p.post_id = pt.post_id AND p.topic_id = t.topic_id AND t.approved = 1 AND p.approved = 1 AND f.forum_id = t.forum_id '.$cond.' ORDER BY p.post_time DESC'; - $result = $xoopsDB->query($query, $this->grab); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL.'/modules/'.$this->dirname.'/viewtopic.php?topic_id='.$row['topic_id'].'&forum='.$row['forum_id'].'&post_id='.$row['post_id'].'#forumpost'.$row['post_id']; - $ret[$i]['title'] = $this->modname . ': ' . $row['subject']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['post_time']; - $ret[$i]['description'] = sprintf('Posted by: %s
    %s', $this->myGetUnameFromId($row['uid']), $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr'])); - $ret[$i]['category'] = $row['forum_name']; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/viewforum.php?forum='.$row['forum_id']; - $i++; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.news.php b/plugins/rssfit.news.php deleted file mode 100644 index 03d260c2..00000000 --- a/plugins/rssfit.news.php +++ /dev/null @@ -1,85 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: News -* Version: 1.1 / 1.3 / 1.42 / 1.44 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitNews -{ - public $dirname = 'news'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; - return $mod; - } - - public function &grabEntries(&$obj) - { - $ret = false; - @require_once XOOPS_ROOT_PATH.'/modules/news/class/class.newsstory.php'; - $myts = \MyTextSanitizer::getInstance(); - if ($this->module->getVar('version') >= 130) { - @require_once XOOPS_ROOT_PATH.'/modules/news/include/functions.php'; - $news = NewsStory::getAllPublished($this->grab, 0, getmoduleoption('restrictindex')); - } else { - $news = NewsStory::getAllPublished($this->grab, 0); - } - if (count($news) > 0) { - for ($i=0, $iMax = count($news); $i < $iMax; $i++) { - $ret[$i]['title'] = $this->modname . ': ' . $myts->undoHtmlSpecialChars($news[$i]->title()); - $ret[$i]['link'] = XOOPS_URL.'/modules/news/article.php?storyid='.$news[$i]->storyid(); - $ret[$i]['guid'] = XOOPS_URL.'/modules/news/article.php?storyid='.$news[$i]->storyid(); - $ret[$i]['timestamp'] = $news[$i]->published(); - $desc = $news[$i]->hometext(); - $ret[$i]['description'] = $news[$i]->hometext(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.pical.php b/plugins/rssfit.pical.php deleted file mode 100644 index fc732670..00000000 --- a/plugins/rssfit.pical.php +++ /dev/null @@ -1,85 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### - -/** - * About this RSSFit plug-in - * Author: jayjay - * Requirements (Tested with): - * Module: piCal - * Version: 1.0 - * RSSFit version: 1.21 - * XOOPS version: 2.0.18.1 - */ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -/** - * Class RssfitpiCal - */ -class RssfitpiCal -{ - public $dirname = 'piCal'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' - . $xoopsDB->prefix('pical_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['summary']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/index.php?event_id='.$row['id']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['dtstamp']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - $i++; - } - return $ret; - } -} diff --git a/plugins/rssfit.pluginsample.php b/plugins/rssfit.pluginsample.php deleted file mode 100644 index 234712cf..00000000 --- a/plugins/rssfit.pluginsample.php +++ /dev/null @@ -1,121 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* This file is a dummy for making a RSSFit plug-in, follow the following steps -* if you really want to do so. -* Step 0: Stop here if you are not sure what you are doing, it's no fun at all -* Step 1: Clone this file and rename as something like rssfit.[mod_dir].php -* Step 2: Replace the text "RssfitSample" with "Rssfit[mod_dir]" at line 59 and -* line 65, i.e. "RssfitNews" for the module "News" -* Step 3: Modify the word in line 60 from 'sample' to [mod_dir] -* Step 4: Modify the function "grabEntries" to satisfy your needs -* Step 5: Move your new plug-in file to the RSSFit plugins folder, -* i.e. your-xoops-root/modules/rss/plugins -* Step 6: Install your plug-in by pointing your browser to -* your-xoops-url/modules/rss/admin/?do=plugins -* Step 7: Finally, tell us about yourself and this file by modifying the -* "About this RSSFit plug-in" section which is located... somewhere. -* -* [mod_dir]: Name of the driectory of your module, i.e. 'news' -* -* About this RSSFit plug-in -* Author: John Doe -* Requirements (or Tested with): -* Module: Blah -* Version: 1.0 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitSample -{ - public $dirname = 'sample'; - public $modname; - public $grab; - public $module; // optional, see line 71 - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries - return $mod; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - // The following example code grabs the latest entries from the module MyLinks - $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' - . $xoopsDB->prefix('mylinks_links') . ' l, ' - . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?cid='.$row['cid'].'&lid='.$row['lid']; - /* - * Required elements of an RSS item - */ - // 1. Title of an item - $ret[$i]['title'] = $row['title']; - // 2. URL of an item - $ret[$i]['link'] = $link; - // 3. Item modification date, must be in Unix time format - $ret[$i]['timestamp'] = $row['date']; - // 4. The item synopsis, or description, whatever - $ret[$i]['description'] = $myts->displayTarea($row['description']); - /* - * Optional elements of an RSS item - */ - // 5. The item synopsis, or description, whatever - $ret[$i]['guid'] = $link; - // 6. A string + domain that identifies a categorization taxonomy - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - // 7. extra tags examples - $ret[$i]['extras'] = []; - // 7a. without attribute - $ret[$i]['extras']['author'] = ['content' => 'aabbc@c.com']; - // 7b. with attributes - $ret[$i]['extras']['enclosure']['attributes'] = ['url' => 'url-to-any-file', 'length' => 1024000, 'type' => 'audio/mpeg']; - $i++; - } - return $ret; - } -} diff --git a/plugins/rssfit.publisher.php b/plugins/rssfit.publisher.php deleted file mode 100644 index 51040c3e..00000000 --- a/plugins/rssfit.publisher.php +++ /dev/null @@ -1,78 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: SmartSection -* Version: 1.0.4 Beta 2 / 1.1 Beta 1 / 1.05 Beta 1 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitPublisher -{ - public $dirname = 'publisher'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - $ret = false; - include XOOPS_ROOT_PATH . '/modules/publisher/include/common.php'; - $publisherHelper = Xmf\Module\Helper::getHelper('publisher'); - $publisherItemHandler = $publisherHelper->getHandler('item'); - $items = $publisherItemHandler->getAllPublished($this->grab, 0); - if (false !== $items && count($items) > 0) { - for ($i=0, $iMax = count($items); $i < $iMax; $i++) { - $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); - $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); - $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); - $ret[$i]['description'] = $items[$i]->getVar('summary'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.queries.php b/plugins/rssfit.queries.php deleted file mode 100644 index 46985127..00000000 --- a/plugins/rssfit.queries.php +++ /dev/null @@ -1,100 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### - -/** - * About this RSSFit plug-in - * Author: Richard Griffith - * Requirements (or Tested with): - * Module: Queries https://github.com/geekwright/queries - * Version: 1.0 - * RSSFit verision: 1.3 - * XOOPS version: 2.5.9 - */ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -class RssfitQueries -{ - public $dirname = 'queries'; - public $modname; - public $grab; - public $module; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries - return $mod; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - - $i = -1; - $lasttime=false; - $lastuser=false; - $limit=10*$this->grab; - - $sql = 'SELECT id, title, posted, querytext FROM ' . $xoopsDB->prefix('queries_query'); - $sql.= ' WHERE approved=1 ORDER BY posted DESC '; - - $result = $xoopsDB->query($sql, $limit, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - ++$i; - if ($i<=$this->grab) { - $desc=$row['querytext']; - if (strlen($desc)>200) { - $desc=substr($desc, 0, 200).'...'; - } - $link = XOOPS_URL.'/modules/queries/view.php?id='.$row['id']; - $ret[$i]['title'] = $this->modname . ': ' . $row['title']; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['posted']; - $ret[$i]['guid'] = $link; - $ret[$i]['category'] = $this->modname; - $ret[$i]['description'] = $desc; - } - if ($i>$this->grab) { - break; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.rmdp.php b/plugins/rssfit.rmdp.php deleted file mode 100644 index 71a50d3e..00000000 --- a/plugins/rssfit.rmdp.php +++ /dev/null @@ -1,85 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### - -/** - * About this RSSFit plug-in - * Author: agamen0n - * Requirements: - * Module: RMDP - * Version: 1.0 - * RSSFit version: 1.1 - */ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -/** - * Class Rssfitrmdp - */ -class Rssfitrmdp extends \XoopsObject -{ - public $dirname = 'rmdp'; - public $modname; - public $module; - public $grab; - - public function loadModule() - { - global $moduleHandler; - $mod = $moduleHandler->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; - return $mod; - } - - public function grabEntries(&$obj) - { - global $xoopsDB, $grouppermHandler; - $ret = []; - $i = 0; - $sql = 'SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ' . $xoopsDB->prefix('rmdp_software') . ' ORDER BY fecha DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['nombre']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/down.php?id='.$row['id_soft']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['fecha']; - $ret[$i]['description'] = $row['longdesc']; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - $i++; - } - return $ret; - } -} diff --git a/plugins/rssfit.smartfaq.php b/plugins/rssfit.smartfaq.php deleted file mode 100644 index a7505953..00000000 --- a/plugins/rssfit.smartfaq.php +++ /dev/null @@ -1,86 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: SmartFAQ -* Version: 1.04 / 1.1 dev -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitSmartfaq -{ - public $dirname = 'smartfaq'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - $ret = false; - @require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; - - /** @var \XoopsModules\Smartfaq\FaqHandler $faqHandler */ - $faqHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Faq'); - $faqs = $faqHandler->getAllPublished($this->grab, 0); - if (false !== $faqs && count($faqs) > 0) { - /** @var \XoopsModules\Smartfaq\AnswerHandler $answerHandler */ - $answerHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Answer'); - for ($i=0, $iMax = count($faqs); $i < $iMax; $i++) { - if (!$answer = $answerHandler->getOfficialAnswer($faqs[$i]->faqid())) { - continue; - } - $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL.'/modules/smartfaq/faq.php?faqid='.$faqs[$i]->faqid(); - $q = $faqs[$i]->getVar('howdoi', 'n'); - $q = empty($q) ? $faqs[$i]->getVar('question', 'n') : $q; - $ret[$i]['title'] = $q; - $ret[$i]['timestamp'] = $faqs[$i]->getVar('datesub'); - $ret[$i]['description'] = $answer->getVar('answer'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.smartpartner.php b/plugins/rssfit.smartpartner.php deleted file mode 100644 index 2d93ec4f..00000000 --- a/plugins/rssfit.smartpartner.php +++ /dev/null @@ -1,76 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements: -* Requirements (Tested with): -* Module: SmartPartner -* Version: 1.02 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitSmartpartner -{ - public $dirname = 'smartpartner'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - $ret = false; - include XOOPS_ROOT_PATH . '/modules/smartpartner/include/common.php'; - $partners = $partnerHandler->getPartners($this->grab, 0, _SPARTNER_STATUS_ACTIVE, 'weight', 'DESC'); - if (false !== $partners && count($partners) > 0) { - for ($i=0, $iMax = count($partners); $i < $iMax; $i++) { - $ret[$i]['link'] = $ret[$i]['guid'] = SMARTPARTNER_URL.'partner.php?id='.$partners[$i]->getVar('id'); - $ret[$i]['title'] = $partners[$i]->getVar('title', 'n'); - $ret[$i]['description'] = $partners[$i]->getVar('summary'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.smartsection.php b/plugins/rssfit.smartsection.php deleted file mode 100644 index fc70b9f6..00000000 --- a/plugins/rssfit.smartsection.php +++ /dev/null @@ -1,76 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: SmartSection -* Version: 1.0.4 Beta 2 / 1.1 Beta 1 / 1.05 Beta 1 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitSmartsection -{ - public $dirname = 'smartsection'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - $ret = false; - include XOOPS_ROOT_PATH . '/modules/smartsection/include/common.php'; - $items = $smartsection_itemHandler->getAllPublished($this->grab, 0); - if (false !== $items && count($items) > 0) { - for ($i=0, $iMax = count($items); $i < $iMax; $i++) { - $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); - $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); - $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); - $ret[$i]['description'] = $items[$i]->getVar('summary'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.special.php b/plugins/rssfit.special.php deleted file mode 100644 index 5154c5e5..00000000 --- a/plugins/rssfit.special.php +++ /dev/null @@ -1,99 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/** - * This file is a dummy for making a RSSFit plug-in, follow the following steps - * if you really want to do so. - * - * Step 0: Stop here if you are not sure what you are doing, it's no fun at all - * Step 1: Clone this file and rename as something like rssfit.[mod_dir].php - * Step 2: Replace the class name "RssfitSpecial" with "Rssfit[mod_dir]" at line 60, - * i.e. "RssfitNews" for the module "News" - * Step 3: Modify the definition of $dirname in line 62 to your modules dirname, i.e. 'news' - * Step 4: Modify the function "grabEntries" method to satisfy your needs - * Step 5: Move your new plug-in file to the RSSFit plugins folder, - * i.e. your-xoops-root/modules/rss/plugins - * Step 6: Install your plug-in by pointing your browser to - * your-xoops-url/modules/rss/admin/?do=plugins - * Step 7: Finally, tell us about yourself and this file by modifying the - * "About this RSSFit plug-in" section located below. - * - * About this RSSFit plug-in - * Author: John Doe - * Requirements (or Tested with): - * Module: Blah - * Version: 1.0 - * RSSFit verision: 1.2 / 1.5 - * XOOPS version: 2.0.13.2 / 2.2.3 - */ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -class RssfitSpecial -{ - public $dirname = 'special'; - public $modname; - public $grab; // will be set to the maximum number of items to grab - public $module; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries - return $mod; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $ret = []; - @require_once XOOPS_ROOT_PATH.'/modules/special/class/stuff.php'; - $myts = \MyTextSanitizer::getInstance(); - $items = SpecialStuff::getAllPublished($this->grab, 0); - foreach ($items as $item) { - $ret[] = [ - 'title' => $myts->undoHtmlSpecialChars($item->title()), - 'link' => XOOPS_URL . '/modules/special/article.php?itemid=' . $item->itemid(), - 'guid' => XOOPS_URL . '/modules/special/article.php?itemid=' . $item->itemid(), - 'timestamp' => $item->published(), - 'description' => $item->hometext(), - 'category' => $this->modname, - 'domain' => XOOPS_URL . '/modules/' . $this->dirname . '/', - ]; - } - return $ret; - } -} diff --git a/plugins/rssfit.surnames.php b/plugins/rssfit.surnames.php deleted file mode 100644 index 0f055fb3..00000000 --- a/plugins/rssfit.surnames.php +++ /dev/null @@ -1,139 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### - -/** - * About this RSSFit plug-in - * Author: Richard Griffith - * Requirements (or Tested with): - * Module: Surnames https://github.com/geekwright/surnames - * Version: 1.0 - * RSSFit verision: 1.3 - * XOOPS version: 2.5.9 - */ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -class RssfitSurnames -{ - public $dirname = 'surnames'; - public $modname; - public $grab; - public $module; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries - return $mod; - } - - public function myGetUnameFromId($uid) - { - static $thisUser=false; - static $lastUid=false; - static $lastName=''; - - if ($lastUid==$uid) { - return $lastName; - } - - if (!is_object($thisUser)) { - $memberHandler = xoops_getHandler('member'); - $thisUser = $memberHandler->getUser($uid); - } - $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); - if ('' == $name) { - $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); - } - $lastUid=$uid; - $lastName=$name; - return $name; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - - $i = -1; - $lasttime=false; - $lastuser=false; - $limit=10*$this->grab; - - $sql = "SELECT uid, id, surname, notes, DATE_FORMAT(changed_ts,'%Y-%m-%d') as changedate FROM ".$xoopsDB->prefix('surnames'); - $sql .= ' WHERE approved=1 ORDER BY changedate DESC, uid '; - $result = $xoopsDB->query($sql, $limit, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $changedate=strtotime($row['changedate']); - $uid=$row['uid']; - if ($lasttime==$changedate && $lastuser==$uid) { - $link = XOOPS_URL.'/modules/surnames/view.php?id='.$row['id']; - $surname=$row['surname']; - $desc .= "$surname
    "; - } else { - if ($i>=0) { - $ret[$i]['description'] = $desc; - } - ++$i; - $lasttime=$changedate; - $lastuser=$uid; - if ($i<=$this->grab) { - $desc= ''; - $name = $this->myGetUnameFromId($row['uid']); - $ret[$i]['title'] = $this->modname . ': by ' . $name; - $ret[$i]['link'] = XOOPS_URL.'/modules/surnames/list.php?uid='.$row['uid']; - $ret[$i]['timestamp'] = $changedate; - - $link = XOOPS_URL.'/modules/surnames/view.php?id='.$row['id']; - $ret[$i]['guid'] = $link; - $ret[$i]['category'] = $this->modname; - - $surname=$row['surname']; - $desc .= "$surname
    "; - } - } - if ($i>$this->grab) { - break; - } - } - if ($i<$this->grab) { - $ret[$i]['description'] = $desc; - } - return $ret; - } -} diff --git a/plugins/rssfit.weblinks.php b/plugins/rssfit.weblinks.php deleted file mode 100644 index 6cb81d33..00000000 --- a/plugins/rssfit.weblinks.php +++ /dev/null @@ -1,108 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: MyLinks -* Version: 1.1 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitWeblinks -{ - public $dirname = 'weblinks'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function myGetUnameFromId($uid) - { - static $thisUser=false; - static $lastUid=false; - static $lastName=''; - - if ($lastUid==$uid) { - return $lastName; - } - - if (!is_object($thisUser)) { - $memberHandler = xoops_getHandler('member'); - $thisUser = $memberHandler->getUser($uid); - } - $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); - if ('' == $name) { - $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); - } - $lastUid=$uid; - $lastName=$name; - return $name; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT lid, title, time_update, description, url, uid FROM ' . $xoopsDB->prefix('weblinks_link') . ' ORDER BY time_update DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $title=$row['title']; - $name = $this->myGetUnameFromId($row['uid']); - $ret[$i]['title'] = $this->modname . ': ' . $title; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?lid='.$row['lid'].'&keywords='; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['time_update']; - $desc = '

    '.$title.'
    '; - $desc .= 'Submitted by: '.$name.'
    '; - $desc .= $myts->displayTarea($row['description']).'


    '; - $ret[$i]['description'] = $desc; - $ret[$i]['guid'] = $link; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - $i++; - } - return $ret; - } -} diff --git a/plugins/rssfit.wfdownloads.php b/plugins/rssfit.wfdownloads.php deleted file mode 100644 index 76d6229a..00000000 --- a/plugins/rssfit.wfdownloads.php +++ /dev/null @@ -1,85 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: WF-Downloads -* Version: 2.0.5a -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class Rssfitwfdownloads extends \XoopsObject -{ - public $dirname = 'wfdownloads'; - public $modname; - public $module; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; - return $mod; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $permHandler = xoops_getHandler('groupperm'); - $ret = false; - $i = 0; - $sql = 'SELECT lid, cid, title, date, description FROM ' - . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - if ($permHandler->checkRight('WFDownFilePerm', $row['lid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['memberHandler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlefile.php?cid='.$row['cid'].'&lid='.$row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - $i++; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.wfdownloads_podcast.php b/plugins/rssfit.wfdownloads_podcast.php deleted file mode 100644 index c9f2890e..00000000 --- a/plugins/rssfit.wfdownloads_podcast.php +++ /dev/null @@ -1,97 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: WF-Downloads -* Version: 3.1 -* RSSFit verision: 1.21 -* XOOPS version: 2.0.14 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class Rssfitwfdownloads_podcast extends \XoopsObject -{ - public $dirname = 'wfdownloads'; - public $modname; - public $module; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive') || $mod->getVar('version') < 310) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; - return $mod; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $permHandler = xoops_getHandler('groupperm'); - $ret = false; - $i = 0; - $sql = 'SELECT lid, cid, title, date, description, filetype, size FROM ' - . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 AND (expired > ' - . time() . ' OR expired = 0) AND published <= ' - . time() . ' ORDER BY date DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - if ((isset($perms[$row['cid']]) && true === $perms[$row['cid']]) || $permHandler->checkRight('WFDownCatPerm', $row['cid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['memberHandler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { - $perms[$row['cid']] = true; - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlefile.php?cid='.$row['cid'].'&lid='.$row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - // enclosure tag, a.k.a podcast - $ret[$i]['extras']['enclosure']['attributes'] - = [ - 'url' => XOOPS_URL . '/modules/' . $this->dirname . '/visit.php?cid=' . $row['cid'] . '&lid=' . $row['lid'], - 'length' => $row['size'], - 'type' => $row['filetype'] - ]; - $i++; - } else { - $perms[$row['cid']] = false; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.wflinks.php b/plugins/rssfit.wflinks.php deleted file mode 100644 index 7ada508e..00000000 --- a/plugins/rssfit.wflinks.php +++ /dev/null @@ -1,69 +0,0 @@ -getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->mid = $mod->getVar('mid'); - return $mod; - } - - public function grabEntries(&$obj) - { - global $xoopsDB, $xoopsUser; - - $groups = is_object($xoopsUser) ? $xoopsUser -> getGroups() : XOOPS_GROUP_ANONYMOUS; - $grouppermHandler = xoops_getHandler('groupperm'); - - $myts = \MyTextSanitizer::getInstance(); - $ret = []; - $i = 0; - $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - if ($grouppermHandler -> checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { - // required - $ret[$i]['title'] = $row['title']; - $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL.'/modules/'.$this->dirname.'/singlelink.php?cid='.$row['cid'].'&lid='.$row['lid']; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $row['description']; - // optional - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - $i++; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.wfsection.php b/plugins/rssfit.wfsection.php deleted file mode 100644 index 6d5bfc34..00000000 --- a/plugins/rssfit.wfsection.php +++ /dev/null @@ -1,90 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: WF-section -* Version: 1.x -* RSSFit verision: 1.2 -* XOOPS version: 2.0.13.2 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitWfsection -{ - public $dirname = 'wfsection'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - if ($mod->getVar('version') >= 200) { - return false; - } - return $mod; - } - - public function &grabEntries(&$obj) - { - @require_once XOOPS_ROOT_PATH.'/modules/wfsection/include/groupaccess.php'; - global $xoopsDB; - $ret = false; - $i = 0; - $sql = 'SELECT a.articleid, a.title as atitle, a.published, a.expired, a.counter, a.groupid, a.maintext, a.summary, b.title as btitle FROM ' - . $xoopsDB->prefix('wfs_article') . ' a, ' - . $xoopsDB->prefix('wfs_category') . ' b WHERE a.published < ' - . time() . ' AND a.published > 0 AND (a.expired = 0 OR a.expired > ' - . time() . ') AND a.noshowart = 0 AND a.offline = 0 AND a.categoryid = b.id ORDER BY published DESC'; - - $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - if (checkAccess($row['groupid'])) { - $link = XOOPS_URL.'/modules/'.$this->dirname.'/article.php?articleid='.$row['articleid']; - $ret[$i]['title'] = $row['atitle']; - $ret[$i]['link'] = $link; - $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['published']; - $ret[$i]['description'] = $myts->displayTarea(!empty($row['summary']) ? $row['summary'] : $row['maintext']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - $i++; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.wfsection2.php b/plugins/rssfit.wfsection2.php deleted file mode 100644 index 48a23ec2..00000000 --- a/plugins/rssfit.wfsection2.php +++ /dev/null @@ -1,81 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: WF-section -* Version: 2.07 b3 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -use XoopsModules\Rss; - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} -class RssfitWfsection2 -{ - public $dirname = 'wfsection'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive') || $mod->getVar('version') < 200) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - $ret = false; - $articles = Rss\WfsArticle::getAllArticle($this->grab, 0, 'online'); - if (count($articles) > 0) { - $xoopsModuleConfig['shortartlen'] = 0; - $myts = \MyTextSanitizer::getInstance(); - for ($i=0, $iMax = count($articles); $i < $iMax; $i++) { - $link = XOOPS_URL.'/modules/wfsection/article.php?articleid='.$articles[$i]->articleid(); - $ret[$i]['title'] = $myts->undoHtmlSpecialChars($articles[$i]->title()); - $ret[$i]['link'] = $link; - $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $articles[$i]->published(); - $ret[$i]['description'] = $articles[$i]->summary(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - } - } - return $ret; - } -} diff --git a/plugins/rssfit.xoopstube.php b/plugins/rssfit.xoopstube.php deleted file mode 100644 index 3f21b4af..00000000 --- a/plugins/rssfit.xoopstube.php +++ /dev/null @@ -1,87 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### - -/** - * About this RSSFit plug-in - * Author: jayjay - * Requirements (Tested with): - * Module: Xoopstube - * Version: 1.0 - * RSSFit version: 1.21 - * XOOPS version: 2.0.18.1 - */ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -/** - * Class RssfitXoopstube - */ -class RssfitXoopstube -{ - public $dirname = 'xoopstube'; - public $modname; - public $grab; - - public function loadModule() - { - $mod = $GLOBALS['moduleHandler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - return $mod; - } - - public function &grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' - . $xoopsDB->prefix('xoopstube_videos') . ' l, ' - . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; - - $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['ltitle']; - $link = XOOPS_URL.'/modules/'.$this->dirname.'/singlevideo.php?cid='.$row['cid'].'&lid='.$row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL.'/modules/'.$this->dirname.'/'; - $i++; - } - return $ret; - } -} diff --git a/preloads/autoloader.php b/preloads/autoloader.php index 79759d65..8b8e4bd6 100644 --- a/preloads/autoloader.php +++ b/preloads/autoloader.php @@ -3,30 +3,30 @@ /** * @see http://www.php-fig.org/psr/psr-4/examples/ */ -spl_autoload_register(function ($class) { +spl_autoload_register(static function ($class) { // project-specific namespace prefix $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__))); // base directory for the namespace prefix - $base_dir = dirname(__DIR__) . '/class/'; + $baseDir = dirname(__DIR__) . '/class/'; // does the class use the namespace prefix? - $len = strlen($prefix); + $len = mb_strlen($prefix); if (0 !== strncmp($prefix, $class, $len)) { return; } // get the relative class name - $relative_class = substr($class, $len); + $relativeClass = mb_substr($class, $len); // replace the namespace prefix with the base directory, replace namespace // separators with directory separators in the relative class name, append // with .php - $file = $base_dir . str_replace('\\', '/', $relative_class) . '.php'; + $file = $baseDir . str_replace('\\', '/', $relativeClass) . '.php'; // if the file exists, require it if (file_exists($file)) { - require $file; + require_once $file; } }); diff --git a/preloads/core.php b/preloads/core.php index dcbab682..c47b25f4 100644 --- a/preloads/core.php +++ b/preloads/core.php @@ -9,13 +9,11 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /** - * * @copyright XOOPS Project (https://xoops.org) - * @license GNU GPL 2 (http://www.gnu.org/licenses/old-licenses/gpl-2.0.html) + * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @author XOOPS Project */ - -defined('XOOPS_ROOT_PATH') || die('Restricted access'); +defined('XOOPS_ROOT_PATH') || exit('Restricted access'); /** * Class RssCorePreload @@ -23,11 +21,12 @@ class RssCorePreload extends \XoopsPreloadItem { // to add PSR-4 autoloader + /** * @param $args */ public static function eventCoreIncludeCommonEnd($args) { - include __DIR__ . '/autoloader.php'; + require_once __DIR__ . '/autoloader.php'; } } diff --git a/rss.css b/rss.css index 8f442e73..10688d49 100644 --- a/rss.css +++ b/rss.css @@ -1,39 +1,39 @@ rss { - display: block; - margin: 10px auto 10px auto; - width: 80%; - background: #FFF; - font-family: Verdana, arial, sans-serif; - font-size: small; - } + display: block; + margin: 10px auto 10px auto; + width: 80%; + background: #FFF; + font-family: Verdana, arial, sans-serif; + font-size: small; + } channel { - display: block; - margin-bottom: 10px; - border: 1px solid #CCC; - padding: 10px; - } + display: block; + margin-bottom: 10px; + border: 1px solid #CCC; + padding: 10px; + } channel>title { - display: block; - font-size: large; - font-weight: bold; - } + display: block; + font-size: large; + font-weight: bold; + } channel>description { - display: block; - } + display: block; + } channel>copyright { - display: block; - font-size: x-small; - color: #666; - } + display: block; + font-size: x-small; + color: #666; + } channel>lastBuildDate { - display: block; - text-align: right; - } + display: block; + text-align: right; + } channel>language, channel>image, @@ -42,38 +42,38 @@ channel>webMaster, channel>generator, channel>docs, channel>ttl { - display: none; - } + display: none; + } item { - display: block; - padding: 5px; - margin-top: 10px; - border: 1px solid #CCC; - background: #EEE; - } + display: block; + padding: 5px; + margin-top: 10px; + border: 1px solid #CCC; + background: #EEE; + } item>title { - display: block; - float: left; - margin-right: 5px; - font-weight: bold; - } + display: block; + float: left; + margin-right: 5px; + font-weight: bold; + } item>pubDate { - margin-right: 5px; - font-size: x-small; - color: #666; - white-space: nowrap; - } + margin-right: 5px; + font-size: x-small; + color: #666; + white-space: nowrap; + } item>guid { - display: block; - margin-right: 5px; - font-size: x-small; - color: #666; - } - + display: block; + margin-right: 5px; + font-size: x-small; + color: #666; + } + item>category, item>link { - display: none; - } + display: none; + } diff --git a/rss.php b/rss.php index a4e212ff..932d94af 100644 --- a/rss.php +++ b/rss.php @@ -1,73 +1,57 @@ ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### +/* + * 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 XoopsModules\Rss; +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @package RSSFit - Extendable XML news feed generator + * @author NS Tai (aka tuff) + * @author XOOPS Development Team + */ + +use XoopsModules\Rssfit; if (function_exists('mb_http_output')) { mb_http_output('pass'); } -require __DIR__ . '/header.php'; -/** @var Rss\Helper $helper */ -$helper = Rss\Helper::getInstance(); +require_once __DIR__ . '/header.php'; +$helper = Rssfit\Helper::getInstance(); -$charset = $helper->getConfig('utf8') ? 'UTF-8' : _CHARSET; -$docache = $helper->getConfig('cache') ? true : false; +$charset = $helper->getConfig('utf8') ? 'UTF-8' : _CHARSET; +$docache = $helper->getConfig('cache') ? true : false; $template = 'db:rssfit_rss.tpl'; if (3 == $helper->getConfig('mime')) { $xoopsLogger->enableRendering(); $xoopsLogger->usePopup = (2 == $xoopsConfig['debug_mode']); - $docache = false; + $docache = false; } else { error_reporting(0); $xoopsLogger->activated = false; } -require_once XOOPS_ROOT_PATH.'/class/template.php'; +require_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new \XoopsTpl(); if (!$docache) { - $xoopsTpl->caching=(0); + $xoopsTpl->caching = 0; } else { - $xoopsTpl->caching=(2); - $xoopsTpl->xoops_setCacheTime($helper->getConfig('cache')*60); + $xoopsTpl->caching = 2; + $xoopsTpl->xoops_setCacheTime($helper->getConfig('cache') * 60); } -$feed = []; -$feed['plugin'] = isset($_GET[$rss->feedkey]) ? trim($_GET[$rss->feedkey]) : ''; -$rss->checkSubFeed($feed); -if (!$xoopsTpl->is_cached($template, $rss->cached) || !$docache) { +$feed = []; +$feed['plugin'] = isset($_GET[$feedHandler->feedkey]) ? trim($_GET[$feedHandler->feedkey]) : ''; +$feedHandler->checkSubFeed($feed); +if (!$xoopsTpl->is_cached($template, $feedHandler->cached) || !$docache) { $xoopsTpl->assign('rss_encoding', $charset); - $rss->buildFeed($feed); + $feedHandler->buildFeed($feed); $xoopsTpl->assign('feed', $feed); } @@ -82,15 +66,15 @@ } # if( $helper->getConfig('mime') == 3 ){ -# $src = $xoopsTpl->fetch($template, $rss->cached, null); -# unset($xoopsOption['template_main']); -# require XOOPS_ROOT_PATH.'/header.php'; -# echo '
    '; -# require XOOPS_ROOT_PATH.'/footer.php'; +# $src = $xoopsTpl->fetch($template, $feedHandler->cached, null); +# unset($xoopsOption['template_main']); +# require_once XOOPS_ROOT_PATH.'/header.php'; +# echo '
    '; +# require_once XOOPS_ROOT_PATH.'/footer.php'; # } if (function_exists('mb_convert_encoding') && $helper->getConfig('utf8')) { - echo mb_convert_encoding($xoopsTpl->fetch($template, $rss->cached, null), 'UTF-8', _CHARSET); + echo mb_convert_encoding($xoopsTpl->fetch($template, $feedHandler->cached, null), 'UTF-8', _CHARSET); } else { - $xoopsTpl->display($template, $rss->cached); + $xoopsTpl->display($template, $feedHandler->cached); } diff --git a/templates/rssfit_rss.tpl b/templates/rssfit_rss.tpl index 295c1208..4bc4fa9b 100644 --- a/templates/rssfit_rss.tpl +++ b/templates/rssfit_rss.tpl @@ -1,32 +1,32 @@ "?> - + <{foreach from=$feed.channel key='ch_key' item='ch_var'}> - <<{$ch_key}>><{$ch_var}>> + <<{$ch_key}>><{$ch_var}>> <{/foreach}> <{if $feed.image != ''}> - - <{$feed.image.title}> - <{$feed.image.url}> - <{$feed.image.link}> - + + <{$feed.image.title}> + <{$feed.image.url}> + <{$feed.image.link}> + <{/if}> <{if $feed.sticky != ''}> - - <{$feed.sticky.title}> - <{$feed.sticky.description}> - <{$feed.sticky.pubdate}> - <{$feed.sticky.link}> - + + <{$feed.sticky.title}> + <{$feed.sticky.description}> + <{$feed.sticky.pubdate}> + <{$feed.sticky.link}> + <{/if}> <{if $feed.items != ''}><{foreach item=item from=$feed.items}> - - <{$item.title}> - <{$item.description}> - <{$item.pubdate}> - <{$item.link}> + + <{$item.title}> + <{$item.description}> + <{$item.pubdate}> + <{$item.link}> <{if $item.category != ""}> domain="<{$item.domain}>"<{/if}>><{$item.category}> <{/if}> @@ -48,7 +48,7 @@ <{/if}> <{/foreach}> <{/if}> - + <{/foreach}><{/if}> - + diff --git a/testdata/index.php b/testdata/index.php index 5a9086be..44e4c58d 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -1,6 +1,5 @@ loadLanguage('common'); + switch ($op) { case 'load': - loadSampleData(); + if (\Xmf\Request::hasVar('ok', 'REQUEST') && 1 == $_REQUEST['ok']) { + if (!$GLOBALS['xoopsSecurity']->check()) { + redirect_header('../admin/index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + } + loadSampleData(); + } else { + xoops_cp_header(); + xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK')), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); + xoops_cp_footer(); + } + break; + case 'save': + saveSampleData(); break; } @@ -30,12 +51,74 @@ function loadSampleData() { - // $moduleDirName = basename(dirname(__DIR__)); - xoops_loadLanguage('comment'); - $items = \Xmf\Yaml::readWrapped('quotes_data.yml'); + global $xoopsConfig; + $moduleDirName = basename(dirname(__DIR__)); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + + $utility = new Rssfit\Utility(); + $configurator = new Common\Configurator(); + + $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); + + $language = 'english/'; + if (is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { + $language = $xoopsConfig['language'] . '/'; + } + + foreach ($tables as $table) { + $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); + \Xmf\Database\TableLoad::truncateTable($table); + \Xmf\Database\TableLoad::loadTableFromArray($table, $tabledata); + } + + // --- COPY test folder files --------------- + if (is_array($configurator->copyTestFolders) && count($configurator->copyTestFolders) > 0) { + // $file = __DIR__ . '/../testdata/images/'; + foreach (array_keys($configurator->copyTestFolders) as $i) { + $src = $configurator->copyTestFolders[$i][0]; + $dest = $configurator->copyTestFolders[$i][1]; + $utility::rcopy($src, $dest); + } + } + redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS')); +} + +function saveSampleData() +{ + global $xoopsConfig; + $moduleDirName = basename(dirname(__DIR__)); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + + $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); + + $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; + if (!file_exists($languageFolder . '/')) { + Utility::createFolder($languageFolder . '/'); + } + $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; + Utility::createFolder($exportFolder); + + foreach ($tables as $table) { + \Xmf\Database\TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); + } + + redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS')); +} + +function exportSchema() +{ + $moduleDirName = basename(dirname(__DIR__)); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); - \Xmf\Database\TableLoad::truncateTable('randomquote_quotes'); - \Xmf\Database\TableLoad::loadTableFromArray('randomquote_quotes', $items); + try { + // TODO set exportSchema + // $migrate = new Rssfit\Migrate($moduleDirName); + // $migrate->saveCurrentSchema(); + // + // redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS')); + } + catch (\Exception $e) { + exit(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR')); + } - redirect_header('../admin/index.php', 1, _CM_ACTIVE); } diff --git a/xoops_version.php b/xoops_version.php index 06e86fdd..f1aab58f 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -1,44 +1,34 @@ ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### +/* + * 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. + */ + +/** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @package RSSFit - Extendable XML news feed generator + * @author NS Tai (aka tuff) + * @author XOOPS Development Team + */ defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); require_once __DIR__ . '/preloads/autoloader.php'; $moduleDirName = basename(__DIR__); +$moduleDirNameUpper = mb_strtoupper($moduleDirName); // ------------------- Informations ------------------- // $modversion = [ - 'version' => 1.31, + 'version' => '1.31.0', 'module_status' => 'Beta 2', - 'release_date' => '2017/12/20', + 'release_date' => '2019/07/06', 'name' => _MI_RSSFIT_NAME, 'description' => _MI_RSSFIT_DESC, 'official' => 0, @@ -54,7 +44,7 @@ // ------------------- Folders & Files ------------------- 'release_info' => 'Changelog', 'release_file' => XOOPS_URL . "/modules/$moduleDirName/docs/changelog.txt", - // + 'manual' => 'link to manual file', 'manual_file' => XOOPS_URL . "/modules/$moduleDirName/docs/install.txt", // images @@ -74,8 +64,8 @@ 'module_website_url' => 'www.xoops.org', 'module_website_name' => 'XOOPS Project', // ------------------- Min Requirements ------------------- - 'min_php' => '5.5', - 'min_xoops' => '2.5.9', + 'min_php' => '5.6', + 'min_xoops' => '2.5.10', 'min_admin' => '1.2', 'min_db' => ['mysql' => '5.5'], // ------------------- Admin Menu ------------------- @@ -91,17 +81,19 @@ // 'onUninstall' => 'include/onuninstall.php', // ------------------- PayPal --------------------------- 'paypal' => [ - 'business' => 'foundation@xoops.org', + 'business' => 'xoopsfoundation@gmail.com', 'item_name' => 'Donation : ' . _MI_RSSFIT_NAME, 'amount' => 0, - 'currency_code' => 'USD' + 'currency_code' => 'USD', ], // ------------------- Mysql ----------------------------- 'sqlfile' => ['mysql' => 'sql/mysql.sql'], // ------------------- Tables ---------------------------- - 'tables' => [ + 'tables' => [ $moduleDirName . '_' . 'plugins', $moduleDirName . '_' . 'misc', +// 'rss' . '_' . 'plugins', +// 'rss' . '_' . 'misc', ], ]; @@ -124,7 +116,7 @@ 'description' => _MI_TMPL_RSS, ]; -// Module Configs +// Module Configs // $helper->getConfig('overall_entries') $modversion['config'][] = [ @@ -207,3 +199,27 @@ 'default' => 1, 'options' => [_MI_OUTOUT_MIME_XML => 1, _MI_OUTOUT_MIME_HTML => 2, _MI_OUTOUT_MIME_PHP => 3], ]; + +/** + * Make Sample button visible? + */ +$modversion['config'][] = [ + 'name' => 'displaySampleButton', + 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', + 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 1, +]; + +/** + * Show Developer Tools? + */ +$modversion['config'][] = [ + 'name' => 'displayDeveloperTools', + 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', + 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 0, +]; From 137cc171a44e860c01b8711f18573e52ddfbf488 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 14 Mar 2020 06:09:58 -0400 Subject: [PATCH 052/154] migrate --- sql/rssfit_1.31.0_migrate.yml | 68 +++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sql/rssfit_1.31.0_migrate.yml diff --git a/sql/rssfit_1.31.0_migrate.yml b/sql/rssfit_1.31.0_migrate.yml new file mode 100644 index 00000000..e9ea42da --- /dev/null +++ b/sql/rssfit_1.31.0_migrate.yml @@ -0,0 +1,68 @@ +rssfit_plugins: + options: 'ENGINE=MyISAM DEFAULT CHARSET=utf8' + columns: + - + name: rssf_conf_id + attributes: ' int(5) unsigned NOT NULL auto_increment' + - + name: rssf_filename + attributes: ' varchar(50) NOT NULL DEFAULT '''' ' + - + name: rssf_activated + attributes: ' tinyint(1) NOT NULL DEFAULT ''0'' ' + - + name: rssf_grab + attributes: ' tinyint(2) NOT NULL DEFAULT ''0'' ' + - + name: rssf_order + attributes: ' tinyint(2) NOT NULL DEFAULT ''0'' ' + - + name: subfeed + attributes: ' tinyint(1) NOT NULL DEFAULT ''0'' ' + - + name: sub_entries + attributes: ' char(2) NOT NULL DEFAULT '''' ' + - + name: sub_link + attributes: ' varchar(255) NOT NULL DEFAULT '''' ' + - + name: sub_title + attributes: ' varchar(255) NOT NULL DEFAULT '''' ' + - + name: sub_desc + attributes: ' varchar(255) NOT NULL DEFAULT '''' ' + - + name: img_url + attributes: ' varchar(255) NOT NULL DEFAULT '''' ' + - + name: img_link + attributes: ' varchar(255) NOT NULL DEFAULT '''' ' + - + name: img_title + attributes: ' varchar(255) NOT NULL DEFAULT '''' ' + keys: + PRIMARY: + columns: rssf_conf_id + unique: true +rssfit_misc: + options: 'ENGINE=MyISAM DEFAULT CHARSET=utf8' + columns: + - + name: misc_id + attributes: ' smallint(5) unsigned NOT NULL auto_increment' + - + name: misc_category + attributes: ' varchar(30) NOT NULL DEFAULT '''' ' + - + name: misc_title + attributes: ' varchar(255) NOT NULL DEFAULT '''' ' + - + name: misc_content + attributes: ' text NOT NULL ' + - + name: misc_setting + attributes: ' text NOT NULL ' + keys: + PRIMARY: + columns: misc_id + unique: true From 9a78efe3d8cce8a764531db8fd2c0cdc30fb473b Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 14 Mar 2020 06:14:05 -0400 Subject: [PATCH 053/154] cosmetics --- admin/do_channel.php | 2 +- admin/do_intro.php | 2 +- admin/do_plugins.php | 2 +- admin/do_sticky.php | 2 +- admin/do_subfeeds.php | 2 +- admin/index.php | 2 +- admin/migrate.php | 2 +- class/FeedHandler.php | 2 +- class/Helper.php | 2 +- class/Misc.php | 2 +- class/MiscHandler.php | 2 +- class/Plugin.php | 2 +- class/PluginHandler.php | 2 +- class/Plugins/00/Comments.php | 4 ++-- class/Plugins/Adslight.php | 2 +- class/Plugins/Ams.php | 6 +++--- class/Plugins/Apcal.php | 6 +++--- class/Plugins/Buyersguide.php | 2 +- class/Plugins/Buyersguidemanufacturers.php | 2 +- class/Plugins/Buyersguidenews.php | 2 +- class/Plugins/Cbb.php | 4 ++-- class/Plugins/Extcal.php | 6 +++--- class/Plugins/Lexikon.php | 2 +- class/Plugins/Myalbum.php | 10 +++++----- class/Plugins/Mydownloads.php | 6 +++--- class/Plugins/Mylinks.php | 6 +++--- class/Plugins/Mytube.php | 4 ++-- class/Plugins/Newbb.php | 6 +++--- class/Plugins/Newbb2.php | 6 +++--- class/Plugins/News.php | 6 +++--- class/Plugins/Oledrion.php | 2 +- class/Plugins/Pical.php | 6 +++--- class/Plugins/Publisher.php | 6 +++--- class/Plugins/Queries.php | 2 +- class/Plugins/Rmdp.php | 4 ++-- class/Plugins/Sample.php | 6 +++--- class/Plugins/Smartfaq.php | 6 +++--- class/Plugins/Smartpartner.php | 6 +++--- class/Plugins/Smartsection.php | 6 +++--- class/Plugins/Special.php | 6 +++--- class/Plugins/Surnames.php | 2 +- class/Plugins/Weblinks.php | 8 ++++---- class/Plugins/Wfdownloads.php | 6 +++--- class/Plugins/Wfdownloads_podcast.php | 6 +++--- class/Plugins/Wflinks.php | 2 +- class/Plugins/Wfsection.php | 6 +++--- class/Plugins/Wfsection2.php | 6 +++--- class/Plugins/Xoopstube.php | 6 +++--- class/Utility.php | 4 ++-- header.php | 2 +- include/common0.php | 2 +- include/functions.php | 2 +- include/install.php | 2 +- index.php | 2 +- language/english/help/helpheader.tpl | 2 +- language/english/install.php | 2 +- preloads/core.php | 2 +- rss.php | 2 +- templates/rssfit_rss.tpl | 4 ++-- testdata/index.php | 2 +- xoops_version.php | 2 +- 61 files changed, 114 insertions(+), 114 deletions(-) diff --git a/admin/do_channel.php b/admin/do_channel.php index 4bc9e4ae..d26ac66d 100644 --- a/admin/do_channel.php +++ b/admin/do_channel.php @@ -13,7 +13,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/admin/do_intro.php b/admin/do_intro.php index e286a3ea..3ffac6b2 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -13,7 +13,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 4383ab6a..528b0929 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -13,7 +13,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/admin/do_sticky.php b/admin/do_sticky.php index 235dc848..19d1b1ad 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -13,7 +13,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index d812eb32..b5314a55 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -13,7 +13,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/admin/index.php b/admin/index.php index 36f22a3f..c67f049b 100644 --- a/admin/index.php +++ b/admin/index.php @@ -34,7 +34,7 @@ //$adminObject = \Xmf\Module\Admin::getInstance(); if (file_exists(RSSFIT_ROOT_PATH . 'admin/do_' . $do . '.php')) { - include_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; + require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; $hidden_do = new \XoopsFormHidden('do', $do); $button_save = new \XoopsFormButton('', 'submit', _AM_SAVE, 'submit'); $button_go = new \XoopsFormButton('', 'submit', _GO, 'submit'); diff --git a/admin/migrate.php b/admin/migrate.php index b472f445..14611281 100644 --- a/admin/migrate.php +++ b/admin/migrate.php @@ -3,7 +3,7 @@ // ------------------------------------------------------------------------ // // XOOPS - PHP Content Management System // // Copyright (c) 2000-2020 XOOPS.org // -// // +// // // ------------------------------------------------------------------------ // // This program is free software; you can redistribute it and/or modify // // it under the terms of the GNU General Public License as published by // diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 9733d057..71401720 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -16,7 +16,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/class/Helper.php b/class/Helper.php index 9dc2d3d5..b5c23ea8 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -19,7 +19,7 @@ * @since * @author XOOPS Development Team */ -//defined('XOOPS_ROOT_PATH') || exit('Restricted access'); +//defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** * Class Helper diff --git a/class/Misc.php b/class/Misc.php index ece09f67..d08d8683 100644 --- a/class/Misc.php +++ b/class/Misc.php @@ -16,7 +16,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 32e7fe7b..c00d8e38 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -16,7 +16,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/class/Plugin.php b/class/Plugin.php index 29178395..86a6c38f 100644 --- a/class/Plugin.php +++ b/class/Plugin.php @@ -16,7 +16,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 017890d5..3517519c 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -16,7 +16,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/class/Plugins/00/Comments.php b/class/Plugins/00/Comments.php index 01bcd6aa..efc9e79d 100644 --- a/class/Plugins/00/Comments.php +++ b/class/Plugins/00/Comments.php @@ -14,14 +14,14 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in * Author: Graham Davies (gravies) -* Modified by: tuff +* Modified by: tuff * Requirements (Tested with): * Module: any module that support XOOPS system comments * RSSFit verision: 1.2 / 1.5 diff --git a/class/Plugins/Adslight.php b/class/Plugins/Adslight.php index 72d72f11..a49879b9 100644 --- a/class/Plugins/Adslight.php +++ b/class/Plugins/Adslight.php @@ -14,7 +14,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/class/Plugins/Ams.php b/class/Plugins/Ams.php index 734f1fb6..cd9ba8fe 100644 --- a/class/Plugins/Ams.php +++ b/class/Plugins/Ams.php @@ -14,16 +14,16 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: brash +* Author: brash * Requirements (Tested with): -* Module: AMS +* Module: AMS * Version: 2.41 * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 diff --git a/class/Plugins/Apcal.php b/class/Plugins/Apcal.php index e0b0134e..79dcea55 100644 --- a/class/Plugins/Apcal.php +++ b/class/Plugins/Apcal.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /** * About this RSSFit plug-in - * Author: jayjay + * Author: jayjay * Requirements (Tested with): - * Module: Apcal + * Module: Apcal * Version: 1.0 * RSSFit version: 1.21 * XOOPS version: 2.0.18.1 diff --git a/class/Plugins/Buyersguide.php b/class/Plugins/Buyersguide.php index afbcddad..3648e430 100644 --- a/class/Plugins/Buyersguide.php +++ b/class/Plugins/Buyersguide.php @@ -14,7 +14,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/class/Plugins/Buyersguidemanufacturers.php b/class/Plugins/Buyersguidemanufacturers.php index ff9338d2..dfc3b9bb 100644 --- a/class/Plugins/Buyersguidemanufacturers.php +++ b/class/Plugins/Buyersguidemanufacturers.php @@ -14,7 +14,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/class/Plugins/Buyersguidenews.php b/class/Plugins/Buyersguidenews.php index 52c81d8c..43b8e066 100644 --- a/class/Plugins/Buyersguidenews.php +++ b/class/Plugins/Buyersguidenews.php @@ -14,7 +14,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/class/Plugins/Cbb.php b/class/Plugins/Cbb.php index 69c06a70..d9915cc1 100644 --- a/class/Plugins/Cbb.php +++ b/class/Plugins/Cbb.php @@ -14,13 +14,13 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: tuff +* Author: tuff * Requirements (Tested with): * Module: CBB * Version: 1.15 / 2.30 / 2.31 diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index 44650730..7c4cbc60 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -14,7 +14,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ @@ -37,9 +37,9 @@ * [mod_dir]: Name of the driectory of your module, i.e. 'news' * * About this RSSFit plug-in -* Author: John Doe +* Author: John Doe * Requirements (or Tested with): -* Module: Blah +* Module: Blah * Version: 1.0 * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 diff --git a/class/Plugins/Lexikon.php b/class/Plugins/Lexikon.php index 72cb1c80..7b23a006 100644 --- a/class/Plugins/Lexikon.php +++ b/class/Plugins/Lexikon.php @@ -14,7 +14,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/class/Plugins/Myalbum.php b/class/Plugins/Myalbum.php index 56a0d925..860f6bbb 100644 --- a/class/Plugins/Myalbum.php +++ b/class/Plugins/Myalbum.php @@ -14,7 +14,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ @@ -37,9 +37,9 @@ * [mod_dir]: Name of the driectory of your module, i.e. 'news' * * About this RSSFit plug-in -* Author: John Doe +* Author: John Doe * Requirements (or Tested with): -* Module: Blah +* Module: Blah * Version: 1.0 * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 @@ -139,9 +139,9 @@ public function &grabEntries(&$obj) // 3. Item modification date, must be in Unix time format $ret[$i]['timestamp'] = $row['date']; // 4. The item synopsis, or description, whatever - $desc = '

    ' . $title . ' '; + $desc = '

    ' . $title . ' '; $desc .= 'By ' . $name . ' in ' . $cat . '
    '; - $desc .= $myts->displayTarea($row['description']) . '


    '; + $desc .= $myts->displayTarea($row['description']) . '


    '; $ret[$i]['description'] = $desc; /* * Optional elements of an RSS item diff --git a/class/Plugins/Mydownloads.php b/class/Plugins/Mydownloads.php index 49e47118..ba49ba90 100644 --- a/class/Plugins/Mydownloads.php +++ b/class/Plugins/Mydownloads.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /** * About this RSSFit plug-in - * Author: tuff + * Author: tuff * Requirements (Tested with): - * Module: MyDownloads + * Module: MyDownloads * Version: 1.1 * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 diff --git a/class/Plugins/Mylinks.php b/class/Plugins/Mylinks.php index 051cd5d1..58ad1de0 100644 --- a/class/Plugins/Mylinks.php +++ b/class/Plugins/Mylinks.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: tuff +* Author: tuff * Requirements (Tested with): -* Module: MyLinks +* Module: MyLinks * Version: 1.1 * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 diff --git a/class/Plugins/Mytube.php b/class/Plugins/Mytube.php index e64c989d..b995d2d1 100644 --- a/class/Plugins/Mytube.php +++ b/class/Plugins/Mytube.php @@ -14,13 +14,13 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /** * About this RSSFit plug-in - * Author: jayjay + * Author: jayjay * Requirements (Tested with): * Module: MyTube * Version: 1.0 diff --git a/class/Plugins/Newbb.php b/class/Plugins/Newbb.php index b7d174e2..6307d5a7 100644 --- a/class/Plugins/Newbb.php +++ b/class/Plugins/Newbb.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: tuff +* Author: tuff * Requirements (Tested with): -* Module: Newbb +* Module: Newbb * Version: 1.0 * RSSFit verision: 1.2 * XOOPS version: 2.0.13.2 diff --git a/class/Plugins/Newbb2.php b/class/Plugins/Newbb2.php index 9ac14ee2..2d35c1a6 100644 --- a/class/Plugins/Newbb2.php +++ b/class/Plugins/Newbb2.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: tuff +* Author: tuff * Requirements (Tested with): -* Module: Newbb 2 +* Module: Newbb 2 * Version: 2.0.1 * RSSFit verision: 1.2 * XOOPS version: 2.0.13.2 diff --git a/class/Plugins/News.php b/class/Plugins/News.php index 0d2407e2..5c5882fa 100644 --- a/class/Plugins/News.php +++ b/class/Plugins/News.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: tuff +* Author: tuff * Requirements (Tested with): -* Module: News +* Module: News * Version: 1.1 / 1.3 / 1.42 / 1.44 * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 diff --git a/class/Plugins/Oledrion.php b/class/Plugins/Oledrion.php index bfba49be..4d480180 100644 --- a/class/Plugins/Oledrion.php +++ b/class/Plugins/Oledrion.php @@ -14,7 +14,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/class/Plugins/Pical.php b/class/Plugins/Pical.php index 607951b6..b399e2a7 100644 --- a/class/Plugins/Pical.php +++ b/class/Plugins/Pical.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /** * About this RSSFit plug-in - * Author: jayjay + * Author: jayjay * Requirements (Tested with): - * Module: piCal + * Module: piCal * Version: 1.0 * RSSFit version: 1.21 * XOOPS version: 2.0.18.1 diff --git a/class/Plugins/Publisher.php b/class/Plugins/Publisher.php index c8e468ea..26206b19 100644 --- a/class/Plugins/Publisher.php +++ b/class/Plugins/Publisher.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: tuff +* Author: tuff * Requirements (Tested with): -* Module: SmartSection +* Module: SmartSection * Version: 1.0.4 Beta 2 / 1.1 Beta 1 / 1.05 Beta 1 * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 diff --git a/class/Plugins/Queries.php b/class/Plugins/Queries.php index 88f3b547..63ab9929 100644 --- a/class/Plugins/Queries.php +++ b/class/Plugins/Queries.php @@ -14,7 +14,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/class/Plugins/Rmdp.php b/class/Plugins/Rmdp.php index 4353745a..ce7ec104 100644 --- a/class/Plugins/Rmdp.php +++ b/class/Plugins/Rmdp.php @@ -14,7 +14,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ @@ -22,7 +22,7 @@ * About this RSSFit plug-in * Author: agamen0n * Requirements: - * Module: RMDP + * Module: RMDP * Version: 1.0 * RSSFit version: 1.1 */ diff --git a/class/Plugins/Sample.php b/class/Plugins/Sample.php index 44e74742..48497a16 100644 --- a/class/Plugins/Sample.php +++ b/class/Plugins/Sample.php @@ -14,7 +14,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ @@ -37,9 +37,9 @@ * [mod_dir]: Name of the driectory of your module, i.e. 'news' * * About this RSSFit plug-in -* Author: John Doe +* Author: John Doe * Requirements (or Tested with): -* Module: Blah +* Module: Blah * Version: 1.0 * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php index 7c497801..b60ab95b 100644 --- a/class/Plugins/Smartfaq.php +++ b/class/Plugins/Smartfaq.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: tuff +* Author: tuff * Requirements (Tested with): -* Module: SmartFAQ +* Module: SmartFAQ * Version: 1.04 / 1.1 dev * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php index 7fd4ab81..7f3190a7 100644 --- a/class/Plugins/Smartpartner.php +++ b/class/Plugins/Smartpartner.php @@ -14,16 +14,16 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: tuff +* Author: tuff * Requirements: * Requirements (Tested with): -* Module: SmartPartner +* Module: SmartPartner * Version: 1.02 * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 diff --git a/class/Plugins/Smartsection.php b/class/Plugins/Smartsection.php index 80184857..03f34dff 100644 --- a/class/Plugins/Smartsection.php +++ b/class/Plugins/Smartsection.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: tuff +* Author: tuff * Requirements (Tested with): -* Module: SmartSection +* Module: SmartSection * Version: 1.0.4 Beta 2 / 1.1 Beta 1 / 1.05 Beta 1 * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 diff --git a/class/Plugins/Special.php b/class/Plugins/Special.php index 4668acda..772a0af4 100644 --- a/class/Plugins/Special.php +++ b/class/Plugins/Special.php @@ -14,7 +14,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ @@ -36,9 +36,9 @@ * "About this RSSFit plug-in" section located below. * * About this RSSFit plug-in - * Author: John Doe + * Author: John Doe * Requirements (or Tested with): - * Module: Blah + * Module: Blah * Version: 1.0 * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php index 58f12474..dc999de3 100644 --- a/class/Plugins/Surnames.php +++ b/class/Plugins/Surnames.php @@ -14,7 +14,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/class/Plugins/Weblinks.php b/class/Plugins/Weblinks.php index 20a30e92..116ef03b 100644 --- a/class/Plugins/Weblinks.php +++ b/class/Plugins/Weblinks.php @@ -13,14 +13,14 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: tuff +* Author: tuff * Requirements (Tested with): -* Module: MyLinks +* Module: MyLinks * Version: 1.1 * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 @@ -103,7 +103,7 @@ public function &grabEntries(&$obj) $ret[$i]['timestamp'] = $row['time_update']; $desc = '

    ' . $title . '
    '; $desc .= 'Submitted by: ' . $name . '
    '; - $desc .= $myts->displayTarea($row['description']) . '


    '; + $desc .= $myts->displayTarea($row['description']) . '


    '; $ret[$i]['description'] = $desc; $ret[$i]['guid'] = $link; $ret[$i]['category'] = $this->modname; diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php index df1a861c..80fd93ac 100644 --- a/class/Plugins/Wfdownloads.php +++ b/class/Plugins/Wfdownloads.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: tuff +* Author: tuff * Requirements (Tested with): -* Module: WF-Downloads +* Module: WF-Downloads * Version: 2.0.5a * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 diff --git a/class/Plugins/Wfdownloads_podcast.php b/class/Plugins/Wfdownloads_podcast.php index 2dd43de6..5c25d24b 100644 --- a/class/Plugins/Wfdownloads_podcast.php +++ b/class/Plugins/Wfdownloads_podcast.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: tuff +* Author: tuff * Requirements (Tested with): -* Module: WF-Downloads +* Module: WF-Downloads * Version: 3.1 * RSSFit verision: 1.21 * XOOPS version: 2.0.14 diff --git a/class/Plugins/Wflinks.php b/class/Plugins/Wflinks.php index 8e2356e7..10e8eb4d 100644 --- a/class/Plugins/Wflinks.php +++ b/class/Plugins/Wflinks.php @@ -14,7 +14,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/class/Plugins/Wfsection.php b/class/Plugins/Wfsection.php index 8bf65dc5..0f56c40e 100644 --- a/class/Plugins/Wfsection.php +++ b/class/Plugins/Wfsection.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: tuff +* Author: tuff * Requirements (Tested with): -* Module: WF-section +* Module: WF-section * Version: 1.x * RSSFit verision: 1.2 * XOOPS version: 2.0.13.2 diff --git a/class/Plugins/Wfsection2.php b/class/Plugins/Wfsection2.php index 9fb0b657..051f7a4f 100644 --- a/class/Plugins/Wfsection2.php +++ b/class/Plugins/Wfsection2.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /* * About this RSSFit plug-in -* Author: tuff +* Author: tuff * Requirements (Tested with): -* Module: WF-section +* Module: WF-section * Version: 2.07 b3 * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 diff --git a/class/Plugins/Xoopstube.php b/class/Plugins/Xoopstube.php index dcb3b980..78aea4d7 100644 --- a/class/Plugins/Xoopstube.php +++ b/class/Plugins/Xoopstube.php @@ -14,15 +14,15 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ /** * About this RSSFit plug-in - * Author: jayjay + * Author: jayjay * Requirements (Tested with): - * Module: Xoopstube + * Module: Xoopstube * Version: 1.0 * RSSFit version: 1.21 * XOOPS version: 2.0.18.1 diff --git a/class/Utility.php b/class/Utility.php index bfdb5786..02634568 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -46,7 +46,7 @@ public static function rssfitAdminHeader(){ }else{ include RSSFIT_ROOT_PATH.'language/english/modinfo.php'; } - include 'menu.php'; + require __DIR__ . '/menu.php'; for($i=0, $iMax = count($adminmenu); $i < $iMax; $i++ ){ $links[$i] = [0 => RSSFIT_URL . $adminmenu[$i]['link'], 1 => $adminmenu[$i]['title']]; } @@ -55,7 +55,7 @@ public static function rssfitAdminHeader(){ for($i=0, $iMax = count($links); $i < $iMax; $i++ ){ $admin_links .= '
'.$links[$i][1].'

\n"; + $admin_links .= "

\n"; xoops_cp_header(); echo $admin_links; } diff --git a/header.php b/header.php index b6b5b293..02f4d9ff 100644 --- a/header.php +++ b/header.php @@ -13,7 +13,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/include/common0.php b/include/common0.php index b0f3e0c0..054038e2 100644 --- a/include/common0.php +++ b/include/common0.php @@ -13,7 +13,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/include/functions.php b/include/functions.php index 97cc8c60..8149c99d 100644 --- a/include/functions.php +++ b/include/functions.php @@ -13,7 +13,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team * @param $a * @param $b diff --git a/include/install.php b/include/install.php index 7b24bdd8..17f3beaf 100644 --- a/include/install.php +++ b/include/install.php @@ -13,7 +13,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/index.php b/index.php index 30568c11..cc742e3a 100644 --- a/index.php +++ b/index.php @@ -13,7 +13,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/language/english/help/helpheader.tpl b/language/english/help/helpheader.tpl index 13a46078..403b21f5 100644 --- a/language/english/help/helpheader.tpl +++ b/language/english/help/helpheader.tpl @@ -2,5 +2,5 @@ <{$smarty.const._MI_RSSFIT_NAME}> <{$smarty.const._MI_RSSFIT_BACK_2_ADMIN}> <{$smarty.const._MI_RSSFIT_NAME}> + alt="<{$smarty.const._MI_RSSFIT_BACK_2_ADMIN}> <{$smarty.const._MI_RSSFIT_NAME}>"> diff --git a/language/english/install.php b/language/english/install.php index 0022a387..967d36a1 100644 --- a/language/english/install.php +++ b/language/english/install.php @@ -1,6 +1,6 @@ RSS feed RSS feed +define('_INTRO_CONTENT', 'RSS feed RSS feed At {SITENAME} we provide our XML RSS feed that you can quickly find the latest updates and short descriptions with an RSS reader. diff --git a/preloads/core.php b/preloads/core.php index c47b25f4..168ee11d 100644 --- a/preloads/core.php +++ b/preloads/core.php @@ -13,7 +13,7 @@ * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) * @author XOOPS Project */ -defined('XOOPS_ROOT_PATH') || exit('Restricted access'); +defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** * Class RssCorePreload diff --git a/rss.php b/rss.php index 932d94af..a47ccb80 100644 --- a/rss.php +++ b/rss.php @@ -13,7 +13,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ diff --git a/templates/rssfit_rss.tpl b/templates/rssfit_rss.tpl index 4bc4fa9b..49a6bd3a 100644 --- a/templates/rssfit_rss.tpl +++ b/templates/rssfit_rss.tpl @@ -5,7 +5,7 @@ <{foreach from=$feed.channel key='ch_key' item='ch_var'}> <<{$ch_key}>><{$ch_var}>> <{/foreach}> - + <{if $feed.image != ''}> <{$feed.image.title}> @@ -44,7 +44,7 @@ <{if $exv.content != ''}> ><{$exv.content}>> <{else}> - /> + > <{/if}> <{/foreach}> <{/if}> diff --git a/testdata/index.php b/testdata/index.php index 44e4c58d..de0de170 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -73,7 +73,7 @@ function loadSampleData() // --- COPY test folder files --------------- if (is_array($configurator->copyTestFolders) && count($configurator->copyTestFolders) > 0) { - // $file = __DIR__ . '/../testdata/images/'; + // $file = dirname(__DIR__) . '/testdata/images/'; foreach (array_keys($configurator->copyTestFolders) as $i) { $src = $configurator->copyTestFolders[$i][0]; $dest = $configurator->copyTestFolders[$i][1]; diff --git a/xoops_version.php b/xoops_version.php index f1aab58f..9154fadf 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -13,7 +13,7 @@ * @copyright XOOPS Project https://xoops.org/ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator - * @author NS Tai (aka tuff) + * @author NS Tai (aka tuff) * @author XOOPS Development Team */ From 1ff8698c8894e3a19ab75a031121e224a2cab2bf Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 14 Mar 2020 06:18:12 -0400 Subject: [PATCH 054/154] LMC cosmetics --- admin/about.php | 3 - admin/admin_header.php | 7 +- admin/do_channel.php | 13 +- admin/do_intro.php | 8 +- admin/do_plugins.php | 27 ++- admin/do_sticky.php | 10 +- admin/do_subfeeds.php | 31 ++-- admin/index.php | 10 +- admin/menu.php | 30 ++-- class/Common/Breadcrumb.php | 4 +- class/Common/Configurator.php | 30 ++-- class/Common/FilesManagement.php | 5 +- class/Common/Migrate.php | 2 +- class/Common/ServerStats.php | 6 +- class/Common/SysUtility.php | 30 ++-- class/Common/VersionChecks.php | 27 ++- class/FeedHandler.php | 71 ++++---- class/Helper.php | 7 +- class/Misc.php | 1 - class/MiscHandler.php | 17 +- class/Plugin.php | 1 - class/PluginHandler.php | 30 ++-- class/Plugins/00/Comments.php | 20 ++- class/Plugins/Adslight.php | 23 +-- class/Plugins/Ams.php | 17 +- class/Plugins/Apcal.php | 24 +-- class/Plugins/Buyersguide.php | 14 +- class/Plugins/Buyersguidemanufacturers.php | 17 +- class/Plugins/Buyersguidenews.php | 17 +- class/Plugins/Cbb.php | 34 ++-- class/Plugins/Extcal.php | 36 ++-- class/Plugins/Lexikon.php | 21 +-- class/Plugins/Myalbum.php | 44 ++--- class/Plugins/Mydownloads.php | 24 +-- class/Plugins/Mylinks.php | 24 +-- class/Plugins/Mytube.php | 22 +-- class/Plugins/Newbb.php | 22 +-- class/Plugins/Newbb2.php | 40 +++-- class/Plugins/News.php | 22 +-- class/Plugins/Oledrion.php | 16 +- class/Plugins/Pical.php | 24 +-- class/Plugins/Publisher.php | 18 +- class/Plugins/Queries.php | 24 +-- class/Plugins/Rmdp.php | 24 +-- class/Plugins/Sample.php | 14 +- class/Plugins/Smartfaq.php | 20 ++- class/Plugins/Smartpartner.php | 12 +- class/Plugins/Smartsection.php | 14 +- class/Plugins/Special.php | 20 ++- class/Plugins/Surnames.php | 40 +++-- class/Plugins/Weblinks.php | 41 +++-- class/Plugins/Wfdownloads.php | 28 +-- class/Plugins/Wfdownloads_podcast.php | 34 ++-- class/Plugins/Wflinks.php | 24 +-- class/Plugins/Wfsection.php | 20 ++- class/Plugins/Wfsection2.php | 22 +-- class/Plugins/Xoopstube.php | 22 +-- class/Utility.php | 21 +-- config/config.php | 40 ++--- config/paths.php | 18 +- header.php | 1 - include/common.php | 22 +-- include/common0.php | 8 +- include/functions.php | 1 - include/install.php | 33 ++-- include/oninstall.php | 9 +- include/onuninstall.php | 3 +- include/onupdate.php | 12 +- index.php | 13 +- language/english/common.php | 2 +- rss.php | 9 +- testdata/index.php | 16 +- xoops_version.php | 191 ++++++++++----------- 73 files changed, 794 insertions(+), 813 deletions(-) diff --git a/admin/about.php b/admin/about.php index 7e8956fe..0f63a989 100644 --- a/admin/about.php +++ b/admin/about.php @@ -9,8 +9,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -use Xmf\Module\Admin; - /** * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) @@ -18,7 +16,6 @@ * @since * @author XOOPS Development Team */ - require_once __DIR__ . '/admin_header.php'; $adminObject->displayNavigation(basename(__FILE__)); diff --git a/admin/admin_header.php b/admin/admin_header.php index 07e66815..a9bd407e 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -9,8 +9,6 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -use Xmf\Module\Admin; - /** * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) @@ -20,8 +18,8 @@ */ include dirname(__DIR__) . '/preloads/autoloader.php'; -require dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; -require dirname(__DIR__) . '/include/common.php'; +require dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; +require dirname(__DIR__) . '/include/common.php'; $moduleDirName = basename(dirname(__DIR__)); @@ -38,4 +36,3 @@ $helper->loadLanguage('common'); xoops_cp_header(); - diff --git a/admin/do_channel.php b/admin/do_channel.php index d26ac66d..8fcc838b 100644 --- a/admin/do_channel.php +++ b/admin/do_channel.php @@ -16,7 +16,6 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - use Xmf\Request; use XoopsModules\Rssfit; @@ -24,12 +23,10 @@ header('Location: index.php'); } - - switch ($op) { default: $elements = $feedHandler->miscHandler->getObjects2(new \Criteria('misc_category', 'channel'), '*', 'title'); - $img = $feedHandler->miscHandler->getObjects2(new \Criteria('misc_category', 'channelimg'), '*', 'title'); + $img = $feedHandler->miscHandler->getObjects2(new \Criteria('misc_category', 'channelimg'), '*', 'title'); if (!empty($elements) && !empty($img)) { $form = new \XoopsThemeForm(_AM_EDIT_CHANNEL, 'editchannel', RSSFIT_ADMIN_URL); $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_REQUIRED . ' ' . Rssfit\Utility::genSpecMoreInfo('req', $feedHandler))); @@ -59,13 +56,13 @@ } break; case 'save': - $ele = Request::getArray('ele', null, 'POST'); - $ids = array_keys($ele); + $ele = Request::getArray('ele', null, 'POST'); + $ids = array_keys($ele); $errors = []; foreach ($ids as $i) { $criteria = new \Criteria('misc_id', $i); - $fields = ['misc_content' => trim($ele[$i])]; - $err = $feedHandler->miscHandler->modifyObjects($criteria, $fields); + $fields = ['misc_content' => trim($ele[$i])]; + $err = $feedHandler->miscHandler->modifyObjects($criteria, $fields); if ($err) { $errors[] = $err; } diff --git a/admin/do_intro.php b/admin/do_intro.php index 3ffac6b2..ab622e1a 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -16,8 +16,6 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - -use Xmf\Request; use XoopsModules\Rssfit; if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { @@ -36,7 +34,7 @@ $title = new \XoopsFormText(_AM_EDIT_INTRO_TITLE, 'title', 50, 255, $intro->getVar('misc_title', 'e')); $title->setDescription(_AM_EDIT_INTRO_TITLE_DESC); - $setting = $intro->getVar('misc_setting'); + $setting = $intro->getVar('misc_setting'); $tray_content = new \XoopsFormElementTray(_AM_EDIT_INTRO_TEXT, '
'); $tray_content->setDescription(_AM_EDIT_INTRO_TEXT_DESC . _AM_EDIT_INTRO_TEXT_DESC_SUB); $tray_content->addElement(new \XoopsFormDhtmlTextArea('', 'content', $intro->getVar('misc_content', 'e'), 15, 60)); @@ -65,8 +63,8 @@ $intro->setVar('misc_content', $_POST['content']); $setting = [ 'dohtml' => isset($_POST['dohtml']) ? 1 : 0, - 'dobr' => isset($_POST['dobr']) ? 1 : 0, - 'sub' => isset($_POST['sub']) ? trim($_POST['sub']) : '', + 'dobr' => isset($_POST['dobr']) ? 1 : 0, + 'sub' => isset($_POST['sub']) ? trim($_POST['sub']) : '', ]; $intro->setVar('misc_setting', $setting); if (false === $miscHandler->insert($intro)) { diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 528b0929..22197605 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -16,7 +16,6 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - use Xmf\Request; use XoopsModules\Rssfit; @@ -31,7 +30,7 @@ $ret = ''; // activated plugins $criteria = new \Criteria('rssf_activated', 1); - $plugins = $pluginsHandler->getObjects2($criteria, 'p_activated'); + $plugins = $pluginsHandler->getObjects2($criteria, 'p_activated'); if ($plugins) { $ret .= "\n" . "\n"; foreach ($plugins as $p) { - $id = $p->getVar('rssf_conf_id'); + $id = $p->getVar('rssf_conf_id'); $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); $action->addOption('', _SELECT); $ret .= "\n" . "\n" . "\n" . "\n" . "\n" @@ -77,9 +76,9 @@ . "\n"; $ret .= "\n"; } - $ret .= "
" @@ -56,10 +55,10 @@ foreach ($plugins as $p) { $handler = $pluginsHandler->checkPlugin($p); if ($handler) { - $id = $p->getVar('rssf_conf_id'); + $id = $p->getVar('rssf_conf_id'); $entries = new \XoopsFormText('', 'rssf_grab[' . $id . ']', 3, 2, $p->getVar('rssf_grab')); - $order = new \XoopsFormText('', 'rssf_order[' . $id . ']', 3, 2, $p->getVar('rssf_order')); - $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); + $order = new \XoopsFormText('', 'rssf_order[' . $id . ']', 3, 2, $p->getVar('rssf_order')); + $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); $action->addOption('', _SELECT); $action->addOption('d', _AM_PLUGIN_DEACTIVATE); $action->addOption('u', _AM_PLUGIN_UNINSTALL); @@ -105,7 +104,7 @@ . "\n" . "
" . $p->getVar('rssf_filename') . ""; @@ -134,8 +133,8 @@ if (!$filelist = &$pluginsHandler->getPluginFileList()) { $filelist = []; } - $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); - $list2 = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'class\Plugins'); + $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); + $list2 = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'class\Plugins'); $installable = []; $installable2 = []; foreach ($list as $f) { @@ -167,7 +166,7 @@ $action = new \XoopsFormCheckbox('', 'install[' . $i . ']'); $action->addOption('i', ' '); $ret .= "
" . $i . ""; - $p = $pluginsHandler->create(); + $p = $pluginsHandler->create(); $p->setVar('rssf_filename', $i); $handler = $pluginsHandler->checkPlugin($p); if ($handler) { @@ -191,7 +190,7 @@ if (!empty($ret)) { $hidden = new \XoopsFormHidden('op', 'save'); - $ret = "
\n" . $ret @@ -206,11 +205,11 @@ } break; case 'save': - $rssf_grab = Request::getArray('rssf_grab', [], 'POST'); + $rssf_grab = Request::getArray('rssf_grab', [], 'POST'); $rssf_order = Request::getArray('rssf_order', [], 'POST'); - $action = Request::getArray('action', null, 'POST'); - $install = Request::getArray('install', [], 'POST'); - $err = ''; + $action = Request::getArray('action', null, 'POST'); + $install = Request::getArray('install', [], 'POST'); + $err = ''; if (isset($action)) { $keys = array_keys($action); foreach ($keys as $k) { diff --git a/admin/do_sticky.php b/admin/do_sticky.php index 19d1b1ad..23567c80 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -16,8 +16,6 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - -use Xmf\Request; use XoopsModules\Rssfit; if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { @@ -34,7 +32,7 @@ switch ($op) { default: $setting = $sticky->getVar('misc_setting'); - $title = new \XoopsFormText(_AM_STICKY_TITLE, 'title', 50, 255, $sticky->getVar('misc_title', 'e')); + $title = new \XoopsFormText(_AM_STICKY_TITLE, 'title', 50, 255, $sticky->getVar('misc_title', 'e')); $title->setDescription(_AM_EDIT_INTRO_TITLE_DESC); $tray_content = new \XoopsFormElementTray(_AM_STICKY_CONTENT, '
'); @@ -73,9 +71,9 @@ } $setting = [ 'dohtml' => isset($_POST['dohtml']) ? 1 : 0, - 'dobr' => isset($_POST['dobr']) ? 1 : 0, - 'feeds' => $feeds, - 'link' => isset($_POST['link']) ? trim($_POST['link']) : '', + 'dobr' => isset($_POST['dobr']) ? 1 : 0, + 'feeds' => $feeds, + 'link' => isset($_POST['link']) ? trim($_POST['link']) : '', ]; $sticky->setVar('misc_setting', $setting, true); if (false === $miscHandler->insert($sticky)) { diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index b5314a55..e32f7919 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -16,7 +16,6 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - use Xmf\Request; use XoopsModules\Rssfit; @@ -48,16 +47,16 @@ $id = $p->getVar('rssf_conf_id'); if (!$handler = $pluginsHandler->checkPlugin($p)) { $pluginsHandler->forceDeactivate($p); - $mod = implode('
', $p->getErrors()); + $mod = implode('
', $p->getErrors()); $activate = new \XoopsFormCheckbox('', 'activate[' . $id . ']', 0); $activate->setExtra('disabled="disabled"'); - $config = ' '; + $config = ' '; $urlLink = $feedHandler->subFeedUrl($p->getVar('rssf_filename')); } else { - $mod = $handler->modname; + $mod = $handler->modname; $activate = new \XoopsFormCheckbox('', 'activate[' . $id . ']', $p->getVar('subfeed')); - $config = Rssfit\Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_SUB_CONFIGURE); - $urlLink = '' . $feedHandler->subFeedUrl($p->getVar('rssf_filename')) . ''; + $config = Rssfit\Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_SUB_CONFIGURE); + $urlLink = '' . $feedHandler->subFeedUrl($p->getVar('rssf_filename')) . ''; } $activate->addOption(1, ' '); $ret .= "
\n"; + $ret .= "\n"; $hidden = new \XoopsFormHidden('op', 'save'); - $ret = "\n" . $ret @@ -102,7 +101,7 @@ if ($plugins) { $pluginsHandler->modifyObjects(null, ['subfeed' => 0]); if (isset($activate) && is_array($activate) && count($activate) > 0) { - $keys = array_keys($activate); + $keys = array_keys($activate); $criteria = new \Criteria('rssf_conf_id', '(' . implode(',', $keys) . ')', 'IN'); $pluginsHandler->modifyObjects($criteria, ['subfeed' => 1]); } @@ -154,14 +153,14 @@ redirect_header(RSSFIT_ADMIN_URL, 0, _AM_SUB_PLUGIN_NONE); } - $subfeed = Request::getBool('subfeed', false, 'POST'); + $subfeed = Request::getBool('subfeed', false, 'POST'); $sub_entries = Request::getInt('sub_entries', 5, 'POST'); - $sub_title = Request::getString('sub_title', '', 'POST'); - $sub_link = Request::getUrl('sub_link', '', 'POST'); - $sub_desc = Request::getString('sub_desc', '', 'POST'); - $img_url = Request::getUrl('img_url', '', 'POST'); - $img_link = Request::getUrl('img_link', '', 'POST'); - $img_title = Request::getString('img_title', '', 'POST'); + $sub_title = Request::getString('sub_title', '', 'POST'); + $sub_link = Request::getUrl('sub_link', '', 'POST'); + $sub_desc = Request::getString('sub_desc', '', 'POST'); + $img_url = Request::getUrl('img_url', '', 'POST'); + $img_link = Request::getUrl('img_link', '', 'POST'); + $img_title = Request::getString('img_title', '', 'POST'); $sub->setVar('subfeed', (int)$subfeed); $sub->setVar('sub_entries', $sub_entries); diff --git a/admin/index.php b/admin/index.php index c67f049b..bd292a16 100644 --- a/admin/index.php +++ b/admin/index.php @@ -16,10 +16,6 @@ * @since * @author XOOPS Development Team */ - -use Xmf\Request; -use XoopsModules\Rssfit\Common; - require_once __DIR__ . '/admin_header.php'; $do = isset($_GET['do']) ? trim($_GET['do']) : ''; @@ -35,9 +31,9 @@ if (file_exists(RSSFIT_ROOT_PATH . 'admin/do_' . $do . '.php')) { require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; - $hidden_do = new \XoopsFormHidden('do', $do); - $button_save = new \XoopsFormButton('', 'submit', _AM_SAVE, 'submit'); - $button_go = new \XoopsFormButton('', 'submit', _GO, 'submit'); + $hidden_do = new \XoopsFormHidden('do', $do); + $button_save = new \XoopsFormButton('', 'submit', _AM_SAVE, 'submit'); + $button_go = new \XoopsFormButton('', 'submit', _GO, 'submit'); $button_cancel = new \XoopsFormButton('', 'cancel', _CANCEL); $button_cancel->setExtra('onclick="javascript:history.go(-1)"'); $tray_save_cancel = new \XoopsFormElementTray('', ''); diff --git a/admin/menu.php b/admin/menu.php index e4bdbcf7..42a3932e 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -16,7 +16,6 @@ * @since * @author XOOPS Development Team */ - use XoopsModules\Rssfit; //require_once dirname(__DIR__) . '/include/common.php'; @@ -28,7 +27,6 @@ $helper->loadLanguage('common'); $helper->loadLanguage('feedback'); - // get path to icons $pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); if (is_object($helper->getModule())) { @@ -39,42 +37,42 @@ $adminmenu[] = [ 'title' => _MI_RSSFIT_INDEX, - 'link' => 'admin/index.php', - 'icon' => $pathIcon32 . '/home.png', + 'link' => 'admin/index.php', + 'icon' => $pathIcon32 . '/home.png', ]; $adminmenu[] = [ 'title' => _MI_RSSFIT_ADMENU1, - 'link' => 'admin/?do=intro', + 'link' => 'admin/?do=intro', //'link' => "admin/do_intro.php", - 'icon' => $pathIcon32 . '/folder_txt.png', + 'icon' => $pathIcon32 . '/folder_txt.png', ]; $adminmenu[] = [ 'title' => _MI_RSSFIT_ADMENU2, - 'link' => 'admin/?do=plugins', + 'link' => 'admin/?do=plugins', //'link' => "admin/do_plugins.php", - 'icon' => 'assets/images/icons/32/plugin.png', + 'icon' => 'assets/images/icons/32/plugin.png', ]; $adminmenu[] = [ 'title' => _MI_RSSFIT_ADMENU3, - 'link' => 'admin/?do=channel', + 'link' => 'admin/?do=channel', //'link' => "admin/do_channel.php", - 'icon' => $pathIcon32 . '/compfile.png', + 'icon' => $pathIcon32 . '/compfile.png', ]; $adminmenu[] = [ 'title' => _MI_RSSFIT_ADMENU4, - 'link' => 'admin/?do=subfeeds', + 'link' => 'admin/?do=subfeeds', //'link' => "admin/do_subfeeds.php", - 'icon' => $pathIcon32 . '/groupmod.png', + 'icon' => $pathIcon32 . '/groupmod.png', ]; $adminmenu[] = [ 'title' => _MI_RSSFIT_ADMENU5, - 'link' => 'admin/?do=sticky', - 'icon' => $pathIcon32 . '/attach.png', + 'link' => 'admin/?do=sticky', + 'icon' => $pathIcon32 . '/attach.png', ]; if ($helper->getConfig('displayDeveloperTools')) { @@ -87,6 +85,6 @@ $adminmenu[] = [ 'title' => _MI_RSSFIT_ABOUT, - 'link' => 'admin/about.php', - 'icon' => $pathIcon32 . '/about.png', + 'link' => 'admin/about.php', + 'icon' => $pathIcon32 . '/about.png', ]; diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index ed4daf18..c7621a8d 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -33,7 +33,7 @@ */ class Breadcrumb { - public $dirname; + public $dirname; private $bread = []; public function __construct() @@ -50,7 +50,7 @@ public function __construct() public function addLink($title = '', $link = '') { $this->bread[] = [ - 'link' => $link, + 'link' => $link, 'title' => $title, ]; } diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index 32307dbd..2031f5a4 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -21,22 +21,20 @@ * @since 1.05 */ - - /** * Class Configurator */ class Configurator { public $name; - public $paths = []; - public $uploadFolders = []; - public $copyBlankFiles = []; + public $paths = []; + public $uploadFolders = []; + public $copyBlankFiles = []; public $copyTestFolders = []; public $templateFolders = []; - public $oldFiles = []; - public $oldFolders = []; - public $renameTables = []; + public $oldFiles = []; + public $oldFolders = []; + public $renameTables = []; public $modCopyright; /** @@ -46,15 +44,15 @@ public function __construct() { $config = include dirname(dirname(__DIR__)) . '/config/config.php'; - $this->name = $config->name; - $this->paths = $config->paths; - $this->uploadFolders = $config->uploadFolders; - $this->copyBlankFiles = $config->copyBlankFiles; + $this->name = $config->name; + $this->paths = $config->paths; + $this->uploadFolders = $config->uploadFolders; + $this->copyBlankFiles = $config->copyBlankFiles; $this->copyTestFolders = $config->copyTestFolders; $this->templateFolders = $config->templateFolders; - $this->oldFiles = $config->oldFiles; - $this->oldFolders = $config->oldFolders; - $this->renameTables = $config->renameTables; - $this->modCopyright = $config->modCopyright; + $this->oldFiles = $config->oldFiles; + $this->oldFolders = $config->oldFolders; + $this->renameTables = $config->renameTables; + $this->modCopyright = $config->modCopyright; } } diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index 697816a6..01877c9e 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -34,8 +34,7 @@ public static function createFolder($folder) file_put_contents($folder . '/index.html', ''); } - } - catch (\Exception $e) { + } catch (\Exception $e) { echo 'Caught exception: ', $e->getMessage(), "\n", '
'; } } @@ -150,7 +149,7 @@ public static function rrmdir($src) foreach ($iterator as $fObj) { if ($fObj->isFile()) { $filename = $fObj->getPathname(); - $fObj = null; // clear this iterator object to close the file + $fObj = null; // clear this iterator object to close the file if (!unlink($filename)) { return false; // couldn't delete the file } diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index 0dffff04..ba87801b 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -32,7 +32,7 @@ class Migrate extends \Xmf\Database\Migrate */ public function __construct() { - $class = __NAMESPACE__ . '\\' . 'Configurator'; + $class = __NAMESPACE__ . '\\' . 'Configurator'; if (!class_exists($class)) { throw new \RuntimeException("Class '$class' not found"); } diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index 2f947c27..6368509f 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -27,7 +27,7 @@ trait ServerStats public static function getServerStats() { //mb $wfdownloads = WfdownloadsWfdownloads::getInstance(); - $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirName = basename(dirname(dirname(__DIR__))); $moduleDirNameUpper = mb_strtoupper($moduleDirName); xoops_loadLanguage('common', $moduleDirName); $html = ''; @@ -45,7 +45,7 @@ public static function getServerStats() $html .= "
    \n"; $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; - $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; if (function_exists('gd_info')) { if (true === ($gdlib = gd_info())) { $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; @@ -59,7 +59,7 @@ public static function getServerStats() // $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; // $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; - $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; + $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . "\n"; $html .= '
  • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . "\n"; diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index b510983d..f0fd15c3 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -16,27 +16,19 @@ */ /** - * * @license https://www.fsf.org/copyleft/gpl.html GNU public license * @copyright https://xoops.org 2000-2020 © XOOPS Project * @author ZySpec * @author Mamba */ -use MyTextSanitizer; -use XoopsFormDhtmlTextArea; -use XoopsFormTextArea; -use XoopsModules\Rssfit; - /** * Class SysUtility */ class SysUtility { use VersionChecks; //checkVerXoops, checkVerPhp Traits - use ServerStats; // getServerStats Trait - use FilesManagement; // Files Management Trait /** @@ -62,8 +54,8 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac // splits all html-tags to scanable lines preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER); $total_length = mb_strlen($ending); - $open_tags = []; - $truncate = ''; + $open_tags = []; + $truncate = ''; foreach ($lines as $line_matchings) { // if there is any html-tag in this line, handle it and add it (uncounted) to the output if (!empty($line_matchings[1])) { @@ -89,7 +81,7 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac $content_length = mb_strlen(preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', ' ', $line_matchings[2])); if ($total_length + $content_length > $length) { // the number of characters which are left - $left = $length - $total_length; + $left = $length - $total_length; $entities_length = 0; // search for html entities if (preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, PREG_OFFSET_CAPTURE)) { @@ -108,7 +100,7 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac // maximum lenght is reached, so get off the loop break; } - $truncate .= $line_matchings[2]; + $truncate .= $line_matchings[2]; $total_length += $content_length; // if the maximum length is reached, get off the loop @@ -152,12 +144,12 @@ public static function getEditor($helper = null, $options = null) { /** @var Helper $helper */ if (null === $options) { - $options = []; - $options['name'] = 'Editor'; - $options['value'] = 'Editor'; - $options['rows'] = 10; - $options['cols'] = '100%'; - $options['width'] = '100%'; + $options = []; + $options['name'] = 'Editor'; + $options['value'] = 'Editor'; + $options['rows'] = 10; + $options['cols'] = '100%'; + $options['width'] = '100%'; $options['height'] = '400px'; } @@ -184,7 +176,7 @@ public static function getEditor($helper = null, $options = null) * * @return bool */ - public function fieldExists($fieldname, $table) + public function fieldExists($fieldname, $table) { global $xoopsDB; $result = $xoopsDB->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 9f8c3221..5db5af07 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -29,7 +29,7 @@ trait VersionChecks */ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) { - $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirName = basename(dirname(dirname(__DIR__))); $moduleDirNameUpper = mb_strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); @@ -37,7 +37,6 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = xoops_loadLanguage('admin', $moduleDirName); xoops_loadLanguage('common', $moduleDirName); - //check for minimum XOOPS version $currentVer = mb_substr(XOOPS_VERSION, 6); // get the numeric part of string if (null === $requiredVer) { @@ -56,13 +55,12 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = /** * Verifies PHP version meets minimum requirements for this module * @static - * @param \XoopsModule|null $module * * @return bool true if meets requirements, false if not */ public static function checkVerPhp(\XoopsModule $module = null) { - $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirName = basename(dirname(dirname(__DIR__))); $moduleDirNameUpper = mb_strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); @@ -87,7 +85,6 @@ public static function checkVerPhp(\XoopsModule $module = null) } /** - * * compares current module version with latest GitHub release * @static * @param \Xmf\Module\Helper $helper @@ -96,15 +93,14 @@ public static function checkVerPhp(\XoopsModule $module = null) * * @return string|array info about the latest module version, if newer */ - public static function checkVerModule($helper, $source = 'github', $default = 'master') { - $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirName = basename(dirname(dirname(__DIR__))); $moduleDirNameUpper = mb_strtoupper($moduleDirName); - $update = ''; - $repository = 'XoopsModules25x/' . $moduleDirName; + $update = ''; + $repository = 'XoopsModules25x/' . $moduleDirName; // $repository = 'XoopsModules25x/publisher'; //for testing only - $ret = ''; + $ret = ''; $infoReleasesUrl = "https://api.github.com/repos/$repository/releases"; if ('github' === $source) { if (function_exists('curl_init') && false !== ($curlHandle = curl_init())) { @@ -115,13 +111,13 @@ public static function checkVerModule($helper, $source = 'github', $default = 'm $curlReturn = curl_exec($curlHandle); if (false === $curlReturn) { trigger_error(curl_error($curlHandle)); - } elseif (false !== strpos($curlReturn, 'Not Found')) { + } elseif (false !== mb_strpos($curlReturn, 'Not Found')) { trigger_error('Repository Not Found: ' . $infoReleasesUrl); } else { - $file = json_decode($curlReturn, false); + $file = json_decode($curlReturn, false); $latestVersionLink = sprintf("https://github.com/$repository/archive/%s.zip", $file ? reset($file)->tag_name : $default); - $latestVersion = $file[0]->tag_name; - $prerelease = $file[0]->prerelease; + $latestVersion = $file[0]->tag_name; + $prerelease = $file[0]->prerelease; if ('master' !== $latestVersionLink) { $update = constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; } @@ -137,7 +133,7 @@ public static function checkVerModule($helper, $source = 'github', $default = 'm // $moduleVersion = '1.0'; //for testing only // $moduleDirName = 'publisher'; //for testing only if (!$prerelease && version_compare($moduleVersion, $latestVersion, '<')) { - $ret = []; + $ret = []; $ret[] = $update; $ret[] = $latestVersionLink; } @@ -145,6 +141,7 @@ public static function checkVerModule($helper, $source = 'github', $default = 'm curl_close($curlHandle); } } + return $ret; } } diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 71401720..24e33c05 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -19,7 +19,6 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - use XoopsModules\Rssfit; if (!defined('RSSFIT_ROOT_PATH')) { @@ -41,21 +40,21 @@ class FeedHandler public $myts; public $modConfig; public $xoopsConfig; - public $cached = ''; - public $charset = _CHARSET; - public $feedkey = 'feed'; - public $plugin_file = 'rssfit.%s.php'; - public $substr_remove = [',', '/', ';', ':', '(', '{', '[', ' ']; - public $substr_add = ['.', '!', '?', '}', ']', ')', '%']; + public $cached = ''; + public $charset = _CHARSET; + public $feedkey = 'feed'; + public $plugin_file = 'rssfit.%s.php'; + public $substr_remove = [',', '/', ';', ':', '(', '{', '[', ' ']; + public $substr_add = ['.', '!', '?', '}', ']', ')', '%']; public $substr_endwith = '...'; - public $spec_url = 'http://blogs.law.harvard.edu/tech/rss'; - public $specs = [ - 'req' => 'requiredChannelElements', - 'opt' => 'optionalChannelElements', + public $spec_url = 'http://blogs.law.harvard.edu/tech/rss'; + public $specs = [ + 'req' => 'requiredChannelElements', + 'opt' => 'optionalChannelElements', 'cloud' => 'ltcloudgtSubelementOfLtchannelgt', - 'img' => 'ltimagegtSubelementOfLtchannelgt', + 'img' => 'ltimagegtSubelementOfLtchannelgt', ]; - public $escaped = [ + public $escaped = [ 128 => '€', 130 => '‚', 131 => 'ƒ', @@ -93,15 +92,15 @@ class FeedHandler */ public function __construct($modConfig, $xoopsConfig, $xoopsModule) { - $this->myts = \MyTextSanitizer::getInstance(); - $this->rssmod = $xoopsModule; - $this->pluginHandler = Rssfit\Helper::getInstance()->getHandler('Plugin'); - $this->miscHandler = Rssfit\Helper::getInstance()->getHandler('Misc'); - $this->modConfig = $modConfig; + $this->myts = \MyTextSanitizer::getInstance(); + $this->rssmod = $xoopsModule; + $this->pluginHandler = Rssfit\Helper::getInstance()->getHandler('Plugin'); + $this->miscHandler = Rssfit\Helper::getInstance()->getHandler('Misc'); + $this->modConfig = $modConfig; $this->xoopsConfig = $xoopsConfig; - $this->channelreq = [ - 'title' => $this->xoopsConfig['sitename'], - 'link' => XOOPS_URL, + $this->channelreq = [ + 'title' => $this->xoopsConfig['sitename'], + 'link' => XOOPS_URL, 'description' => $this->xoopsConfig['slogan'], ]; } @@ -111,7 +110,7 @@ public function __construct($modConfig, $xoopsConfig, $xoopsModule) */ public function getChannel(&$feed) { - $channel = []; + $channel = []; $elements = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channel')); if ($elements) { foreach ($elements as $e) { @@ -119,7 +118,7 @@ public function getChannel(&$feed) $channel[$e->getVar('misc_title')] = $e->getVar('misc_content', 'n'); } } - $channel['language'] = _LANGCODE; + $channel['language'] = _LANGCODE; $channel['lastBuildDate'] = $this->rssTimeStamp(time()); if ($this->modConfig['cache']) { $channel['ttl'] = $this->modConfig['cache']; @@ -127,22 +126,22 @@ public function getChannel(&$feed) } if (!empty($feed['plugin'])) { if (is_object($this->plugin_obj) && is_object($this->subHandler)) { - $channel['title'] = $this->plugin_obj->getVar('sub_title', 'n'); - $channel['link'] = $this->plugin_obj->getVar('sub_link', 'n'); + $channel['title'] = $this->plugin_obj->getVar('sub_title', 'n'); + $channel['link'] = $this->plugin_obj->getVar('sub_link', 'n'); $channel['description'] = $this->plugin_obj->getVar('sub_desc', 'n'); - $image = [ - 'url' => $this->plugin_obj->getVar('img_url', 'n'), + $image = [ + 'url' => $this->plugin_obj->getVar('img_url', 'n'), 'title' => $this->plugin_obj->getVar('img_title', 'n'), - 'link' => $this->plugin_obj->getVar('img_link', 'n'), + 'link' => $this->plugin_obj->getVar('img_link', 'n'), ]; } } else { $img = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channelimg'), '*', 'title'); if ($img) { $image = [ - 'url' => $img['url']->getVar('misc_content', 'n'), + 'url' => $img['url']->getVar('misc_content', 'n'), 'title' => $img['title']->getVar('misc_content', 'n'), - 'link' => $img['link']->getVar('misc_content', 'n'), + 'link' => $img['link']->getVar('misc_content', 'n'), ]; } } @@ -179,7 +178,7 @@ public function getSticky(&$feed) if ((in_array(-1, $setting['feeds']) && empty($feed['plugin'])) || (!empty($feed['plugin']) && in_array($this->plugin_obj->getVar('rssf_conf_id'), $setting['feeds']))) { $feed['sticky']['title'] = $sticky->getVar('misc_title', 'n'); - $feed['sticky']['link'] = $setting['link']; + $feed['sticky']['link'] = $setting['link']; $sticky->setDoHtml($setting['dohtml']); $sticky->setDoBr($setting['dobr']); $feed['sticky']['description'] = $sticky->getVar('misc_content'); @@ -202,7 +201,7 @@ public function getItems(&$feed) if (!empty($feed['plugin'])) { $this->plugin_obj->setVar('rssf_grab', $this->plugin_obj->getVar('sub_entries')); $this->subHandler->grab = $this->plugin_obj->getVar('sub_entries'); - $grab = &$this->subHandler->grabEntries($this->plugin_obj); + $grab = &$this->subHandler->grabEntries($this->plugin_obj); if (false !== $grab && count($grab) > 0) { foreach ($grab as $g) { array_push($entries, $g); @@ -213,7 +212,7 @@ public function getItems(&$feed) $handler = $this->pluginHandler->checkPlugin($p); if ($handler) { $handler->grab = $p->getVar('rssf_grab'); - $grab = &$handler->grabEntries($p); + $grab = &$handler->grabEntries($p); if (false !== $grab && count($grab) > 0) { foreach ($grab as $g) { array_push($entries, $g); @@ -366,7 +365,7 @@ public function wrapCdata(&$text) */ public function &getActivatedSubfeeds($fields = '', $type = '') { - $ret = false; + $ret = false; $subs = $this->pluginHandler->getObjects2(new \Criteria('subfeed', 1), $fields); if ($subs) { switch ($type) { @@ -452,7 +451,7 @@ public function checkSubFeed(&$feed) $criteria = new \CriteriaCompo(); $criteria->add(new \Criteria('rssf_filename', sprintf($this->plugin_file, $feed['plugin']))); $criteria->add(new \Criteria('subfeed', 1)); - $sub = $this->pluginHandler->getObjects2($criteria); + $sub = $this->pluginHandler->getObjects2($criteria); $handler = false; if (isset($sub[0])) { $handler = $this->pluginHandler->checkPlugin($sub[0]); @@ -460,7 +459,7 @@ public function checkSubFeed(&$feed) if ($handler) { $this->plugin_obj = $sub[0]; $this->subHandler = $handler; - $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' . md5(str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); + $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' . md5(str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); } else { $feed['plugin'] = ''; } diff --git a/class/Helper.php b/class/Helper.php index b5c23ea8..6f5f219a 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -70,17 +70,18 @@ public function getDirname() */ public function getHandler($name) { - $ret = false; + $ret = false; $class = __NAMESPACE__ . '\\' . ucfirst($name) . 'Handler'; if (!class_exists($class)) { throw new \RuntimeException("Class '$class' not found"); } /** @var \XoopsMySQLDatabase $db */ - $db = \XoopsDatabaseFactory::getDatabaseConnection(); + $db = \XoopsDatabaseFactory::getDatabaseConnection(); $helper = self::getInstance(); - $ret = new $class($db, $helper); + $ret = new $class($db, $helper); $this->addLog("Getting handler '{$name}'"); + return $ret; } } diff --git a/class/Misc.php b/class/Misc.php index d08d8683..7fe10d6e 100644 --- a/class/Misc.php +++ b/class/Misc.php @@ -19,7 +19,6 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - if (!defined('RSSFIT_ROOT_PATH')) { exit(); } diff --git a/class/MiscHandler.php b/class/MiscHandler.php index c00d8e38..c35d5ea6 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -19,7 +19,6 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - if (!defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -33,7 +32,7 @@ class MiscHandler extends \XoopsPersistableObjectHandler public $db; public $db_table; public $obj_class = Misc::class; - public $obj_key = 'misc_id'; + public $obj_key = 'misc_id'; /** * @var \XoopsModules\Rssfit\Helper @@ -54,14 +53,13 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) if (null === $db) { $db = \XoopsDatabaseFactory::getDatabaseConnection(); } - $this->db = $db; + $this->db = $db; $this->db_table = $db->prefix($helper->getDirname() . '_misc'); parent::__construct($db, 'rssfit_misc', Misc::class, 'misc_id', 'misc_title'); } /** - * @param \XoopsDatabase|null $db * @return \XoopsModules\Rssfit\MiscHandler */ public function getInstance(\XoopsDatabase $db = null) @@ -99,7 +97,7 @@ public function create($isNew = true) public function get($id = null, $fields = null) { $criteria = new \Criteria($this->obj_key, (int)$id); - $objs = $this->getObjects2($criteria); + $objs = $this->getObjects2($criteria); if ($objs) { return 1 != count($objs) ? false : $objs[0]; } @@ -132,12 +130,11 @@ public function getCount($criteria = null) * @return bool */ public function getObjects2($criteria = null, $fields = '*', $key = '') -// public function &getObjects(\CriteriaElement $criteria = null, $id_as_key = false, $as_object = true) { - $ret = false; + $ret = false; $limit = $start = 0; $fields = '*'; - $sql = 'SELECT ' . $fields . ' FROM ' . $this->db_table; + $sql = 'SELECT ' . $fields . ' FROM ' . $this->db_table; if (null !== $criteria && $criteria instanceof \CriteriaElement) { $sql .= ' ' . $criteria->renderWhere(); if ('' != $criteria->getSort()) { @@ -174,7 +171,6 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') } /** - * @param \XoopsObject $obj * @param bool $force * @return array|bool|int|mixed|null */ @@ -202,7 +198,7 @@ public function insert(\XoopsObject $obj, $force = false) } if ($obj->isNew() || empty($cleanvars[$this->obj_key])) { $cleanvars[$this->obj_key] = $this->db->genId($this->db_table . '_' . $this->obj_key . '_seq'); - $sql = 'INSERT INTO ' . $this->db_table . ' (' . implode(',', array_keys($cleanvars)) . ') VALUES (' . implode(',', array_values($cleanvars)) . ')'; + $sql = 'INSERT INTO ' . $this->db_table . ' (' . implode(',', array_keys($cleanvars)) . ') VALUES (' . implode(',', array_values($cleanvars)) . ')'; } else { unset($cleanvars[$this->obj_key]); $sql = 'UPDATE ' . $this->db_table . ' SET'; @@ -264,7 +260,6 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) } /** - * @param \XoopsObject $category * @param bool $force * @return bool */ diff --git a/class/Plugin.php b/class/Plugin.php index 86a6c38f..6e022b1d 100644 --- a/class/Plugin.php +++ b/class/Plugin.php @@ -19,7 +19,6 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - if (!defined('RSSFIT_ROOT_PATH')) { exit(); } diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 3517519c..3888a828 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -19,7 +19,6 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - if (!defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -33,9 +32,9 @@ class PluginHandler extends \XoopsPersistableObjectHandler public $db; public $db_table; public $obj_class = Plugin::class; - public $obj_key = 'rssf_conf_id'; - public $sortby = 'rssf_order'; - public $order = 'ASC'; + public $obj_key = 'rssf_conf_id'; + public $sortby = 'rssf_order'; + public $order = 'ASC'; /** * @var \XoopsModules\Rssfit\Helper @@ -51,7 +50,7 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) if (null === $helper) { $helper = \XoopsModules\Rssfit\Helper::getInstance(); } - $this->helper = $helper; + $this->helper = $helper; if (null === $db) { $db = \XoopsDatabaseFactory::getDatabaseConnection(); @@ -63,7 +62,6 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) } /** - * @param \XoopsDatabase|null $db * @return \XoopsModules\Rssfit\PluginHandler */ public function getInstance(\XoopsDatabase $db = null) @@ -100,9 +98,9 @@ public function create($isNew = true) */ public function get($id = null, $fields = null) { - $ret = false; + $ret = false; $criteria = new \Criteria($this->obj_key, (int)$id); - $objs = $this->getObjects2($criteria);// && 1 === count($objs); + $objs = $this->getObjects2($criteria); // && 1 === count($objs); if ($objs) { $ret = &$objs[0]; } @@ -111,7 +109,6 @@ public function get($id = null, $fields = null) } /** - * @param \XoopsObject $obj * @param bool $force * @return array|bool|int|mixed|null */ @@ -139,7 +136,7 @@ public function insert(\XoopsObject $obj, $force = false) } if ($obj->isNew() || empty($cleanvars[$this->obj_key])) { $cleanvars[$this->obj_key] = $this->db->genId($this->db_table . '_' . $this->obj_key . '_seq'); - $sql = 'INSERT INTO ' . $this->db_table . ' (' . implode(',', array_keys($cleanvars)) . ') VALUES (' . implode(',', array_values($cleanvars)) . ')'; + $sql = 'INSERT INTO ' . $this->db_table . ' (' . implode(',', array_keys($cleanvars)) . ') VALUES (' . implode(',', array_values($cleanvars)) . ')'; } else { unset($cleanvars[$this->obj_key]); $sql = 'UPDATE ' . $this->db_table . ' SET'; @@ -167,7 +164,6 @@ public function insert(\XoopsObject $obj, $force = false) } /** - * @param \XoopsObject $category * @param bool $force * @return bool */ @@ -198,7 +194,7 @@ public function delete(\XoopsObject $category, $force = false) */ public function getObjects2($criteria = null, $fields = '*', $key = '') { - $ret = false; + $ret = false; $limit = $start = 0; switch ($fields) { case 'p_activated': @@ -305,7 +301,7 @@ public function getCount($criteria = null) public function forceDeactivate($obj, $type = 'rssf_activated') { $criteria = new \Criteria($this->obj_key, $obj->getVar($this->obj_key)); - $fields = ['rssf_activated' => 0, 'subfeed' => 0]; + $fields = ['rssf_activated' => 0, 'subfeed' => 0]; $this->modifyObjects($criteria, $fields, true); return true; @@ -338,10 +334,10 @@ public function checkPlugin($obj) $file = RSSFIT_ROOT_PATH . 'plugins/' . $obj->getVar('rssf_filename'); $file2 = RSSFIT_ROOT_PATH . 'class/Plugins/' . $obj->getVar('rssf_filename'); if (file_exists($file2)) { -//mb $require_once = require $file; - $name = explode('.', $obj->getVar('rssf_filename')); - $class = 'Rssfit' . ucfirst($name[0]); - $class2 = __NAMESPACE__ . '\Plugins\\' . ucfirst($name[0]); + //mb $require_once = require $file; + $name = explode('.', $obj->getVar('rssf_filename')); + $class = 'Rssfit' . ucfirst($name[0]); + $class2 = __NAMESPACE__ . '\Plugins\\' . ucfirst($name[0]); if (class_exists($class2)) { $handler = new $class2(); if (!method_exists($handler, 'loadmodule') || !method_exists($handler, 'grabentries')) { diff --git a/class/Plugins/00/Comments.php b/class/Plugins/00/Comments.php index efc9e79d..9327535f 100644 --- a/class/Plugins/00/Comments.php +++ b/class/Plugins/00/Comments.php @@ -1,4 +1,6 @@ -setLimit($this->grab); $criteria->setSort('com_created'); $criteria->setOrder('DESC'); - $comments = $commentHandler->getObjects($criteria, true); + $comments = $commentHandler->getObjects($criteria, true); $comment_config = []; if (count($comments) > 0) { $modules = $GLOBALS['module_handler']->getObjects(new \Criteria('hascomments', 1), true); @@ -78,8 +80,8 @@ public function &grabEntries(&$obj) if (!isset($comment_config[$mid])) { $comment_config[$mid] = $modules[$mid]->getInfo('comments'); } - $ret[$i]['title'] = 'Comments: ' . $comments[$i]->getVar('com_title', 'n'); - $link = XOOPS_URL + $ret[$i]['title'] = 'Comments: ' . $comments[$i]->getVar('com_title', 'n'); + $link = XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname') . '/' @@ -96,11 +98,11 @@ public function &grabEntries(&$obj) . $comments[$i]->getVar('com_exparams') . '#comment' . $i; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $comments[$i]->getVar('com_created'); + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $comments[$i]->getVar('com_created'); $ret[$i]['description'] = $comments[$i]->getVar('com_text'); - $ret[$i]['category'] = $modules[$mid]->getVar('name', 'n'); - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname') . '/'; + $ret[$i]['category'] = $modules[$mid]->getVar('name', 'n'); + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname') . '/'; } } diff --git a/class/Plugins/Adslight.php b/class/Plugins/Adslight.php index a49879b9..1ac45c6e 100644 --- a/class/Plugins/Adslight.php +++ b/class/Plugins/Adslight.php @@ -1,4 +1,6 @@ -prefix('adslight_listing') . " WHERE valid = 'Yes' ORDER BY date DESC"; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT lid, title, status, desctext, date from ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid = 'Yes' ORDER BY date DESC"; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewads.php?lid=' . $row['lid']; - $ret[$i]['title'] = $row['title']; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewads.php?lid=' . $row['lid']; + $ret[$i]['title'] = $row['title']; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $row['desctext']; // $myts->displayTarea($row['desctext']); - $ret[$i]['extras'] = []; + $ret[$i]['extras'] = []; $i++; } diff --git a/class/Plugins/Ams.php b/class/Plugins/Ams.php index cd9ba8fe..a3ed2676 100644 --- a/class/Plugins/Ams.php +++ b/class/Plugins/Ams.php @@ -1,4 +1,6 @@ - @@ -66,15 +67,15 @@ public function &grabEntries(&$obj) $ret = false; // @require_once XOOPS_ROOT_PATH . '/modules/AMS/class/class.newsstory.php'; $myts = \MyTextSanitizer::getInstance(); - $ams = \XoopsModules\Ams\Story::getAllPublished($this->grab, 0); + $ams = \XoopsModules\Ams\Story::getAllPublished($this->grab, 0); if (count($ams) > 0) { for ($i = 0, $iMax = count($ams); $i < $iMax; $i++) { - $ret[$i]['title'] = $myts->undoHtmlSpecialChars($ams[$i]->title()); - $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . "/modules/$this->dirname/article.php?storyid=" . $ams[$i]->storyid(); - $ret[$i]['timestamp'] = $ams[$i]->published(); + $ret[$i]['title'] = $myts->undoHtmlSpecialChars($ams[$i]->title()); + $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . "/modules/$this->dirname/article.php?storyid=" . $ams[$i]->storyid(); + $ret[$i]['timestamp'] = $ams[$i]->published(); $ret[$i]['description'] = $ams[$i]->hometext(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } diff --git a/class/Plugins/Apcal.php b/class/Plugins/Apcal.php index 79dcea55..0416eef1 100644 --- a/class/Plugins/Apcal.php +++ b/class/Plugins/Apcal.php @@ -1,4 +1,6 @@ -prefix('apcal_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' . $xoopsDB->prefix('apcal_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['summary']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/index.php?event_id=' . $row['id']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['dtstamp']; + $ret[$i]['title'] = $row['summary']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/index.php?event_id=' . $row['id']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['dtstamp']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } diff --git a/class/Plugins/Buyersguide.php b/class/Plugins/Buyersguide.php index 3648e430..9f1b3de1 100644 --- a/class/Plugins/Buyersguide.php +++ b/class/Plugins/Buyersguide.php @@ -1,4 +1,6 @@ -getRecentProducts(0, 0, $this->grab); - $i = 0; + $i = 0; if (false !== $items && count($items) > 0) { foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('prod_title', 'n'); + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('prod_title', 'n'); $ret[$i]['timestamp'] = $item->getVar('prod_submited_date'); if ('' != xoops_trim($item->getVar('prod_summary'))) { $description = $item->getVar('prod_summary'); @@ -77,8 +79,8 @@ public function &grabEntries(&$obj) $description = $item->getVar('prod_description'); } $ret[$i]['description'] = $description; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/class/Plugins/Buyersguidemanufacturers.php b/class/Plugins/Buyersguidemanufacturers.php index dfc3b9bb..728494b0 100644 --- a/class/Plugins/Buyersguidemanufacturers.php +++ b/class/Plugins/Buyersguidemanufacturers.php @@ -1,4 +1,6 @@ -getListofActivteManufacturers(0, $this->grab, 'manu_date_added', 'DESC'); - $i = 0; + $i = 0; if (false !== $items && count($items) > 0) { foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('manu_name', 'n'); - $ret[$i]['timestamp'] = $item->getVar('manu_date_added'); + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('manu_name', 'n'); + $ret[$i]['timestamp'] = $item->getVar('manu_date_added'); $ret[$i]['description'] = $item->getVar('manu_description'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/class/Plugins/Buyersguidenews.php b/class/Plugins/Buyersguidenews.php index 43b8e066..c7628abf 100644 --- a/class/Plugins/Buyersguidenews.php +++ b/class/Plugins/Buyersguidenews.php @@ -1,4 +1,6 @@ -getRecentNews(0, $this->grab); - $i = 0; + $i = 0; if (false !== $items && count($items) > 0) { foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('news_title', 'n'); - $ret[$i]['timestamp'] = $item->getVar('news_date'); + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('news_title', 'n'); + $ret[$i]['timestamp'] = $item->getVar('news_date'); $ret[$i]['description'] = $item->getShortenText(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/class/Plugins/Cbb.php b/class/Plugins/Cbb.php index d9915cc1..05dcb381 100644 --- a/class/Plugins/Cbb.php +++ b/class/Plugins/Cbb.php @@ -1,4 +1,6 @@ -modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } @@ -66,14 +68,14 @@ public function &grabEntries(&$obj) { @require XOOPS_ROOT_PATH . '/modules/newbb/include/functions.php'; global $xoopsDB; - $xoopsModule = $this->module; - $myts = \MyTextSanitizer::getInstance(); - $i = 0; + $xoopsModule = $this->module; + $myts = \MyTextSanitizer::getInstance(); + $i = 0; $forumiscHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Forum'); $topicHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Topic'); - $newbbConfig = $GLOBALS['configHandler']->getConfigsByCat(0, $this->module->getVar('mid')); + $newbbConfig = $GLOBALS['configHandler']->getConfigsByCat(0, $this->module->getVar('mid')); - $access_forums = $forumiscHandler->getForums(0, 'access'); + $access_forums = $forumiscHandler->getForums(0, 'access'); $available_forums = []; foreach ($access_forums as $forum) { if ($topicHandler->getPermission($forum)) { @@ -86,9 +88,9 @@ public function &grabEntries(&$obj) ksort($available_forums); $cond = ' AND t.forum_id IN (' . implode(',', array_keys($available_forums)) . ')'; unset($available_forums); - $cond .= $newbbConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; - $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; - $query = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM ' + $cond .= $newbbConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; + $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; + $query = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM ' . $xoopsDB->prefix('bb_posts') . ' p, ' . $xoopsDB->prefix('bb_forums') @@ -101,13 +103,13 @@ public function &grabEntries(&$obj) . ' ORDER BY p.post_time DESC'; $result = $xoopsDB->query($query, $this->grab); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; - $ret[$i]['title'] = $row['subject']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['post_time']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; + $ret[$i]['title'] = $row['subject']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['post_time']; $ret[$i]['description'] = $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr']); - $ret[$i]['category'] = $row['forum_name']; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; + $ret[$i]['category'] = $row['forum_name']; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; $i++; } } diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index 7c4cbc60..5898eb2e 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -1,4 +1,6 @@ -modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing + $this->module = $mod; // optional, remove this line if there is nothing // to do with module info when grabbing entries return $mod; } @@ -84,31 +86,31 @@ public function &grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = false; $i = 0; // read confgs to get timestamp format - $extcal = $this->module; + $extcal = $this->module; $configHandler = xoops_getHandler('config'); - $extcalConfig = $configHandler->getConfigsByCat(0, $extcal->getVar('mid')); - $long_form = $extcalConfig['date_long']; + $extcalConfig = $configHandler->getConfigsByCat(0, $extcal->getVar('mid')); + $long_form = $extcalConfig['date_long']; $eventHandler = \XoopsModules\Extcal\Helper::getInstance()->getHandler('Event'); - $catHandler = \XoopsModules\Extcal\Helper::getInstance()->getHandler('Cat'); - $events = $eventHandler->getUpcomingEvent(0, $this->grab, 0); + $catHandler = \XoopsModules\Extcal\Helper::getInstance()->getHandler('Cat'); + $events = $eventHandler->getUpcomingEvent(0, $this->grab, 0); if (is_array($events)) { foreach ($events as $event) { ++$i; - $cat = $catHandler->getCat($event->getVar('cat_id'), 0); - $category = $cat->getVar('cat_name'); - $link = XOOPS_URL . '/modules/extcal/event.php?event=' . $event->getVar('event_id'); + $cat = $catHandler->getCat($event->getVar('cat_id'), 0); + $category = $cat->getVar('cat_name'); + $link = XOOPS_URL . '/modules/extcal/event.php?event=' . $event->getVar('event_id'); $event_start = formatTimestamp($event->getVar('event_start'), $long_form); - $title = xoops_utf8_encode(htmlspecialchars($event->getVar('event_title'), ENT_QUOTES)); + $title = xoops_utf8_encode(htmlspecialchars($event->getVar('event_title'), ENT_QUOTES)); $description = xoops_utf8_encode(htmlspecialchars($event->getVar('event_desc'), ENT_QUOTES)); - $address = $event->getVar('event_address'); + $address = $event->getVar('event_address'); $desc_link = $event->getVar('event_url'); if ('' == $desc_link) { @@ -123,12 +125,12 @@ public function &grabEntries(&$obj) $desc .= "What:$description"; $desc .= ''; - $ret[$i]['title'] = $category . ': ' . $title; - $ret[$i]['link'] = $link; + $ret[$i]['title'] = $category . ': ' . $title; + $ret[$i]['link'] = $link; $ret[$i]['description'] = $desc; - $ret[$i]['timestamp'] = $event->getVar('event_submitdate'); + $ret[$i]['timestamp'] = $event->getVar('event_submitdate'); // $ret[$i]['timestamp'] = time(); - $ret[$i]['guid'] = $link; + $ret[$i]['guid'] = $link; $ret[$i]['category'] = $category; } } diff --git a/class/Plugins/Lexikon.php b/class/Plugins/Lexikon.php index 7b23a006..fdd30455 100644 --- a/class/Plugins/Lexikon.php +++ b/class/Plugins/Lexikon.php @@ -1,4 +1,6 @@ -modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } @@ -65,24 +66,24 @@ public function &grabEntries(&$obj) global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); //$permiscHandler = xoops_getHandler('groupperm'); - $ret = false; - $i = 0; - $sql = 'SELECT entryID, categoryID, term, definition, datesub FROM ' . $xoopsDB->prefix('lxentries') . ' WHERE submit = 0 AND offline = 0 ORDER BY datesub DESC'; + $ret = false; + $i = 0; + $sql = 'SELECT entryID, categoryID, term, definition, datesub FROM ' . $xoopsDB->prefix('lxentries') . ' WHERE submit = 0 AND offline = 0 ORDER BY datesub DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { // required $ret[$i]['title'] = $row['term']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/entry.php?entryID=' . $row['entryID']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/entry.php?entryID=' . $row['entryID']; //$ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['datesub']; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['datesub']; $ret[$i]['description'] = $myts->displayTarea($row['definition']); // optional //5. The item synopsis, or description, whatever //$ret[$i]['guid'] = $link; // 6. A string + domain that identifies a categorization taxonomy $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; /*$ret[$i]['extras'] = []; // 7a. without attribute $ret[$i]['extras']['author'] = array('content' => 'aabbc@c.com'); diff --git a/class/Plugins/Myalbum.php b/class/Plugins/Myalbum.php index 860f6bbb..78be9cd5 100644 --- a/class/Plugins/Myalbum.php +++ b/class/Plugins/Myalbum.php @@ -1,4 +1,6 @@ -modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing + $this->module = $mod; // optional, remove this line if there is nothing // to do with module info when grabbing entries return $mod; } @@ -91,13 +93,13 @@ public function myGetUnameFromId($uid) if (!is_object($thisUser)) { $memberHandler = xoops_getHandler('member'); - $thisUser = $memberHandler->getUser($uid); + $thisUser = $memberHandler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); if ('' == $name) { $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); } - $lastUid = $uid; + $lastUid = $uid; $lastName = $name; return $name; @@ -111,23 +113,23 @@ public function &grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; + $ret = false; + $i = 0; // For myalbum-p with thumbs enabled - $sql = 'SELECT p.lid, p.title, p.ext, p.date, t.description, c.cid, c.title as cat, p.submitter'; - $sql .= ' FROM ' . $xoopsDB->prefix('myalbum_photos') . ' p, '; - $sql .= $xoopsDB->prefix('myalbum_text') . ' t, '; - $sql .= $xoopsDB->prefix('myalbum_cat') . ' c '; - $sql .= 'WHERE p.status > 0 AND p.cid = c.cid AND p.lid = t.lid '; - $sql .= 'ORDER BY date DESC'; + $sql = 'SELECT p.lid, p.title, p.ext, p.date, t.description, c.cid, c.title as cat, p.submitter'; + $sql .= ' FROM ' . $xoopsDB->prefix('myalbum_photos') . ' p, '; + $sql .= $xoopsDB->prefix('myalbum_text') . ' t, '; + $sql .= $xoopsDB->prefix('myalbum_cat') . ' c '; + $sql .= 'WHERE p.status > 0 AND p.cid = c.cid AND p.lid = t.lid '; + $sql .= 'ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/photo.php?lid=' . $row['lid']; - $thumb = XOOPS_URL . '/uploads/thumbs/' . $row['lid'] . '.' . $row['ext']; - $name = $this->myGetUnameFromId($row['submitter']); - $title = $myts->displayTarea($row['title']); - $cat = $myts->displayTarea($row['cat']); + $link = XOOPS_URL . '/modules/' . $this->dirname . '/photo.php?lid=' . $row['lid']; + $thumb = XOOPS_URL . '/uploads/thumbs/' . $row['lid'] . '.' . $row['ext']; + $name = $this->myGetUnameFromId($row['submitter']); + $title = $myts->displayTarea($row['title']); + $cat = $myts->displayTarea($row['cat']); $catlink = XOOPS_URL . '/modules/' . $this->dirname . '/viewcat.php?cid=' . $row['cid']; /* * Required elements of an RSS item @@ -139,9 +141,9 @@ public function &grabEntries(&$obj) // 3. Item modification date, must be in Unix time format $ret[$i]['timestamp'] = $row['date']; // 4. The item synopsis, or description, whatever - $desc = '

    ' . $title . ' '; - $desc .= 'By ' . $name . ' in ' . $cat . '
    '; - $desc .= $myts->displayTarea($row['description']) . '


    '; + $desc = '

    ' . $title . ' '; + $desc .= 'By ' . $name . ' in ' . $cat . '
    '; + $desc .= $myts->displayTarea($row['description']) . '


    '; $ret[$i]['description'] = $desc; /* * Optional elements of an RSS item @@ -150,7 +152,7 @@ public function &grabEntries(&$obj) $ret[$i]['guid'] = $link; // 6. A string + domain that identifies a categorization taxonomy $ret[$i]['category'] = $cat; - $ret[$i]['domain'] = $catlink; + $ret[$i]['domain'] = $catlink; $i++; } diff --git a/class/Plugins/Mydownloads.php b/class/Plugins/Mydownloads.php index ba49ba90..a17ced42 100644 --- a/class/Plugins/Mydownloads.php +++ b/class/Plugins/Mydownloads.php @@ -1,4 +1,6 @@ -prefix('mydownloads_downloads') . ' l, ' . $xoopsDB->prefix('mydownloads_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $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'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } diff --git a/class/Plugins/Mylinks.php b/class/Plugins/Mylinks.php index 58ad1de0..0ea6b9d4 100644 --- a/class/Plugins/Mylinks.php +++ b/class/Plugins/Mylinks.php @@ -1,4 +1,6 @@ -prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } diff --git a/class/Plugins/Mytube.php b/class/Plugins/Mytube.php index b995d2d1..9be6507e 100644 --- a/class/Plugins/Mytube.php +++ b/class/Plugins/Mytube.php @@ -1,4 +1,6 @@ -prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; + $ret = false; + $i = 0; + $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['ltitle']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['ltitle']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } diff --git a/class/Plugins/Newbb.php b/class/Plugins/Newbb.php index 6307d5a7..45f80d77 100644 --- a/class/Plugins/Newbb.php +++ b/class/Plugins/Newbb.php @@ -1,4 +1,6 @@ -dirname . '/class/class.forumposts.php'; $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.nohtml, p.nosmiley, f.forum_name, t.post_text FROM ' + $ret = false; + $i = 0; + $sql = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.nohtml, p.nosmiley, f.forum_name, t.post_text FROM ' . $xoopsDB->prefix('bb_posts') . ' p, ' . $xoopsDB->prefix('bb_forums') @@ -81,13 +83,13 @@ public function &grabEntries(&$obj) return $ret; } while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; - $ret[$i]['title'] = $row['subject']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['post_time']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; + $ret[$i]['title'] = $row['subject']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['post_time']; $ret[$i]['description'] = $myts->displayTarea($row['post_text'], $row['nohtml'] ? 0 : 1, $row['nosmiley'] ? 0 : 1); - $ret[$i]['category'] = $row['forum_name']; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; + $ret[$i]['category'] = $row['forum_name']; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; $i++; } diff --git a/class/Plugins/Newbb2.php b/class/Plugins/Newbb2.php index 2d35c1a6..5890593d 100644 --- a/class/Plugins/Newbb2.php +++ b/class/Plugins/Newbb2.php @@ -1,4 +1,6 @@ -modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } @@ -78,13 +80,13 @@ public function myGetUnameFromId($uid) if (!is_object($thisUser)) { $memberHandler = xoops_getHandler('member'); - $thisUser = $memberHandler->getUser($uid); + $thisUser = $memberHandler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); if ('' == $name) { $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); } - $lastUid = $uid; + $lastUid = $uid; $lastName = $name; return $name; @@ -98,15 +100,15 @@ public function &grabEntries(&$obj) { @require XOOPS_ROOT_PATH . '/modules/newbb/include/functions.php'; global $xoopsDB, $configHandler; - $xoopsModule = $this->module; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; + $xoopsModule = $this->module; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; $forumiscHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Forum'); $topicHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Topic'); - $newbbConfig = $configHandler->getConfigsByCat(0, $this->module->getVar('mid')); + $newbbConfig = $configHandler->getConfigsByCat(0, $this->module->getVar('mid')); - $access_forums = $forumiscHandler->getForums(0, 'access'); + $access_forums = $forumiscHandler->getForums(0, 'access'); $available_forums = []; foreach ($access_forums as $forum) { if ($topicHandler->getPermission($forum)) { @@ -119,9 +121,9 @@ public function &grabEntries(&$obj) ksort($available_forums); $cond = ' AND t.forum_id IN (' . implode(',', array_keys($available_forums)) . ')'; unset($available_forums); - $cond .= $newbbConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; - $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; - $query = 'SELECT p.uid, p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM ' + $cond .= $newbbConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; + $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; + $query = 'SELECT p.uid, p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM ' . $xoopsDB->prefix('bb_posts') . ' p, ' . $xoopsDB->prefix('bb_forums') @@ -134,13 +136,13 @@ public function &grabEntries(&$obj) . ' ORDER BY p.post_time DESC'; $result = $xoopsDB->query($query, $this->grab); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; - $ret[$i]['title'] = $this->modname . ': ' . $row['subject']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['post_time']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; + $ret[$i]['title'] = $this->modname . ': ' . $row['subject']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['post_time']; $ret[$i]['description'] = sprintf('Posted by: %s
    %s', $this->myGetUnameFromId($row['uid']), $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr'])); - $ret[$i]['category'] = $row['forum_name']; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; + $ret[$i]['category'] = $row['forum_name']; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; $i++; } } diff --git a/class/Plugins/News.php b/class/Plugins/News.php index 5c5882fa..4238def0 100644 --- a/class/Plugins/News.php +++ b/class/Plugins/News.php @@ -1,4 +1,6 @@ -modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } @@ -70,20 +72,20 @@ public function &grabEntries(&$obj) $myts = \MyTextSanitizer::getInstance(); if ($this->module->getVar('version') >= 130) { // @require_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php'; - $news = \XoopsModules\News\NewsStory::getAllPublished($this->grab, 0, \XoopsModules\News\Utility::getmoduleoption('restrictindex')); + $news = \XoopsModules\News\NewsStory::getAllPublished($this->grab, 0, \XoopsModules\News\Utility::getmoduleoption('restrictindex')); } else { $news = \XoopsModules\News\NewsStory::getAllPublished($this->grab, 0); } if (count($news) > 0) { for ($i = 0, $iMax = count($news); $i < $iMax; $i++) { - $ret[$i]['title'] = $this->modname . ': ' . $myts->undoHtmlSpecialChars($news[$i]->title()); - $ret[$i]['link'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); - $ret[$i]['guid'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); - $ret[$i]['timestamp'] = $news[$i]->published(); - $desc = $news[$i]->hometext(); + $ret[$i]['title'] = $this->modname . ': ' . $myts->undoHtmlSpecialChars($news[$i]->title()); + $ret[$i]['link'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); + $ret[$i]['guid'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); + $ret[$i]['timestamp'] = $news[$i]->published(); + $desc = $news[$i]->hometext(); $ret[$i]['description'] = $news[$i]->hometext(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } diff --git a/class/Plugins/Oledrion.php b/class/Plugins/Oledrion.php index 4d480180..25bf9610 100644 --- a/class/Plugins/Oledrion.php +++ b/class/Plugins/Oledrion.php @@ -1,4 +1,6 @@ -getHandler('Products'); $items = $productsHandler->getRecentProducts(new Oledrion\Parameters(['start' => 0, 'limit' => $this->grab])); - $i = 0; + $i = 0; if (false !== $items && count($items) > 0) { foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('product_title', 'n'); + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('product_title', 'n'); $ret[$i]['timestamp'] = $item->getVar('product_submitted'); if ('' != xoops_trim($item->getVar('product_summary'))) { $description = $item->getVar('product_summary'); @@ -72,8 +74,8 @@ public function &grabEntries(&$obj) $description = $item->getVar('product_description'); } $ret[$i]['description'] = $description; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/class/Plugins/Pical.php b/class/Plugins/Pical.php index b399e2a7..4aa43047 100644 --- a/class/Plugins/Pical.php +++ b/class/Plugins/Pical.php @@ -1,4 +1,6 @@ -prefix('pical_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' . $xoopsDB->prefix('pical_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['summary']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/index.php?event_id=' . $row['id']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['dtstamp']; + $ret[$i]['title'] = $row['summary']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/index.php?event_id=' . $row['id']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['dtstamp']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } diff --git a/class/Plugins/Publisher.php b/class/Plugins/Publisher.php index 26206b19..14f1ce01 100644 --- a/class/Plugins/Publisher.php +++ b/class/Plugins/Publisher.php @@ -1,4 +1,6 @@ -getHandler('Item'); - $items = $publisherItemHandler->getAllPublished($this->grab, 0); + $items = $publisherItemHandler->getAllPublished($this->grab, 0); if (false !== $items && count($items) > 0) { for ($i = 0, $iMax = count($items); $i < $iMax; $i++) { - $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); - $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); - $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); + $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); + $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); + $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); $ret[$i]['description'] = $items[$i]->getVar('summary'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } diff --git a/class/Plugins/Queries.php b/class/Plugins/Queries.php index 63ab9929..db5c6f54 100644 --- a/class/Plugins/Queries.php +++ b/class/Plugins/Queries.php @@ -1,4 +1,6 @@ -modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing + $this->module = $mod; // optional, remove this line if there is nothing // to do with module info when grabbing entries return $mod; } @@ -65,12 +67,12 @@ public function &grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = false; - $i = -1; + $i = -1; $lasttime = false; $lastuser = false; - $limit = 10 * $this->grab; + $limit = 10 * $this->grab; $sql = 'SELECT id, title, posted, querytext FROM ' . $xoopsDB->prefix('queries_query'); $sql .= ' WHERE approved=1 ORDER BY posted DESC '; @@ -83,12 +85,12 @@ public function &grabEntries(&$obj) if (mb_strlen($desc) > 200) { $desc = mb_substr($desc, 0, 200) . '...'; } - $link = XOOPS_URL . '/modules/queries/view.php?id=' . $row['id']; - $ret[$i]['title'] = $this->modname . ': ' . $row['title']; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['posted']; - $ret[$i]['guid'] = $link; - $ret[$i]['category'] = $this->modname; + $link = XOOPS_URL . '/modules/queries/view.php?id=' . $row['id']; + $ret[$i]['title'] = $this->modname . ': ' . $row['title']; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['posted']; + $ret[$i]['guid'] = $link; + $ret[$i]['category'] = $this->modname; $ret[$i]['description'] = $desc; } if ($i > $this->grab) { diff --git a/class/Plugins/Rmdp.php b/class/Plugins/Rmdp.php index ce7ec104..dded101a 100644 --- a/class/Plugins/Rmdp.php +++ b/class/Plugins/Rmdp.php @@ -1,4 +1,6 @@ -modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } @@ -63,18 +65,18 @@ public function loadModule() public function grabEntries(&$obj) { global $xoopsDB, $grouppermiscHandler; - $ret = []; - $i = 0; - $sql = 'SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ' . $xoopsDB->prefix('rmdp_software') . ' ORDER BY fecha DESC'; + $ret = []; + $i = 0; + $sql = 'SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ' . $xoopsDB->prefix('rmdp_software') . ' ORDER BY fecha DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['nombre']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/down.php?id=' . $row['id_soft']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['fecha']; + $ret[$i]['title'] = $row['nombre']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/down.php?id=' . $row['id_soft']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['fecha']; $ret[$i]['description'] = $row['longdesc']; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } diff --git a/class/Plugins/Sample.php b/class/Plugins/Sample.php index 48497a16..0cd32bbe 100644 --- a/class/Plugins/Sample.php +++ b/class/Plugins/Sample.php @@ -1,4 +1,6 @@ -modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing + $this->module = $mod; // optional, remove this line if there is nothing // to do with module info when grabbing entries return $mod; } @@ -83,10 +85,10 @@ public function &grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; + $ret = false; + $i = 0; // The following example code grabs the latest entries from the module MyLinks - $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC'; + $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; @@ -108,7 +110,7 @@ public function &grabEntries(&$obj) $ret[$i]['guid'] = $link; // 6. A string + domain that identifies a categorization taxonomy $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; // 7. extra tags examples $ret[$i]['extras'] = []; // 7a. without attribute diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php index b60ab95b..14bea28f 100644 --- a/class/Plugins/Smartfaq.php +++ b/class/Plugins/Smartfaq.php @@ -1,4 +1,6 @@ -getHandler('Faq'); - $faqs = $faqHandler->getAllPublished($this->grab, 0); + $faqs = $faqHandler->getAllPublished($this->grab, 0); if (false !== $faqs && count($faqs) > 0) { /** @var \XoopsModules\Smartfaq\AnswerHandler $answerHandler */ $answerHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Answer'); @@ -75,14 +77,14 @@ public function &grabEntries(&$obj) if (!$answer = $answerHandler->getOfficialAnswer($faqs[$i]->faqid())) { continue; } - $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $faqs[$i]->faqid(); - $q = $faqs[$i]->getVar('howdoi', 'n'); - $q = empty($q) ? $faqs[$i]->getVar('question', 'n') : $q; - $ret[$i]['title'] = $q; - $ret[$i]['timestamp'] = $faqs[$i]->getVar('datesub'); + $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $faqs[$i]->faqid(); + $q = $faqs[$i]->getVar('howdoi', 'n'); + $q = empty($q) ? $faqs[$i]->getVar('question', 'n') : $q; + $ret[$i]['title'] = $q; + $ret[$i]['timestamp'] = $faqs[$i]->getVar('datesub'); $ret[$i]['description'] = $answer->getVar('answer'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php index 7f3190a7..ef7d329b 100644 --- a/class/Plugins/Smartpartner.php +++ b/class/Plugins/Smartpartner.php @@ -1,4 +1,6 @@ -getPartners($this->grab, 0, _SPARTNER_STATUS_ACTIVE, 'weight', 'DESC'); if (false !== $partners && count($partners) > 0) { for ($i = 0, $iMax = count($partners); $i < $iMax; $i++) { - $ret[$i]['link'] = $ret[$i]['guid'] = SMARTPARTNER_URL . 'partner.php?id=' . $partners[$i]->getVar('id'); - $ret[$i]['title'] = $partners[$i]->getVar('title', 'n'); + $ret[$i]['link'] = $ret[$i]['guid'] = SMARTPARTNER_URL . 'partner.php?id=' . $partners[$i]->getVar('id'); + $ret[$i]['title'] = $partners[$i]->getVar('title', 'n'); $ret[$i]['description'] = $partners[$i]->getVar('summary'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } diff --git a/class/Plugins/Smartsection.php b/class/Plugins/Smartsection.php index 03f34dff..d9c73082 100644 --- a/class/Plugins/Smartsection.php +++ b/class/Plugins/Smartsection.php @@ -1,4 +1,6 @@ -getAllPublished($this->grab, 0); if (false !== $items && count($items) > 0) { for ($i = 0, $iMax = count($items); $i < $iMax; $i++) { - $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); - $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); - $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); + $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); + $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); + $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); $ret[$i]['description'] = $items[$i]->getVar('summary'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } diff --git a/class/Plugins/Special.php b/class/Plugins/Special.php index 772a0af4..98848b4a 100644 --- a/class/Plugins/Special.php +++ b/class/Plugins/Special.php @@ -1,4 +1,6 @@ -modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing + $this->module = $mod; // optional, remove this line if there is nothing // to do with module info when grabbing entries return $mod; } @@ -82,17 +84,17 @@ public function &grabEntries(&$obj) global $xoopsDB; $ret = []; @require XOOPS_ROOT_PATH . '/modules/special/class/stuff.php'; - $myts = \MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $items = SpecialStuff::getAllPublished($this->grab, 0); foreach ($items as $item) { $ret[] = [ - 'title' => $myts->undoHtmlSpecialChars($item->title()), - 'link' => XOOPS_URL . '/modules/special/article.php?itemid=' . $item->itemid(), - 'guid' => XOOPS_URL . '/modules/special/article.php?itemid=' . $item->itemid(), - 'timestamp' => $item->published(), + 'title' => $myts->undoHtmlSpecialChars($item->title()), + 'link' => XOOPS_URL . '/modules/special/article.php?itemid=' . $item->itemid(), + 'guid' => XOOPS_URL . '/modules/special/article.php?itemid=' . $item->itemid(), + 'timestamp' => $item->published(), 'description' => $item->hometext(), - 'category' => $this->modname, - 'domain' => XOOPS_URL . '/modules/' . $this->dirname . '/', + 'category' => $this->modname, + 'domain' => XOOPS_URL . '/modules/' . $this->dirname . '/', ]; } diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php index dc999de3..67c27400 100644 --- a/class/Plugins/Surnames.php +++ b/class/Plugins/Surnames.php @@ -1,4 +1,6 @@ -modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing + $this->module = $mod; // optional, remove this line if there is nothing // to do with module info when grabbing entries return $mod; } @@ -73,13 +75,13 @@ public function myGetUnameFromId($uid) if (!is_object($thisUser)) { $memberHandler = xoops_getHandler('member'); - $thisUser = $memberHandler->getUser($uid); + $thisUser = $memberHandler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); if ('' == $name) { $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); } - $lastUid = $uid; + $lastUid = $uid; $lastName = $name; return $name; @@ -93,23 +95,23 @@ public function &grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = false; - $i = -1; + $i = -1; $lasttime = false; $lastuser = false; - $limit = 10 * $this->grab; + $limit = 10 * $this->grab; - $sql = "SELECT uid, id, surname, notes, DATE_FORMAT(changed_ts,'%Y-%m-%d') as changedate FROM " . $xoopsDB->prefix('surnames'); - $sql .= ' WHERE approved=1 ORDER BY changedate DESC, uid '; + $sql = "SELECT uid, id, surname, notes, DATE_FORMAT(changed_ts,'%Y-%m-%d') as changedate FROM " . $xoopsDB->prefix('surnames'); + $sql .= ' WHERE approved=1 ORDER BY changedate DESC, uid '; $result = $xoopsDB->query($sql, $limit, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { $changedate = strtotime($row['changedate']); - $uid = $row['uid']; + $uid = $row['uid']; if ($lasttime == $changedate && $lastuser == $uid) { - $link = XOOPS_URL . '/modules/surnames/view.php?id=' . $row['id']; + $link = XOOPS_URL . '/modules/surnames/view.php?id=' . $row['id']; $surname = $row['surname']; - $desc .= "$surname
    "; + $desc .= "$surname
    "; } else { if ($i >= 0) { $ret[$i]['description'] = $desc; @@ -118,18 +120,18 @@ public function &grabEntries(&$obj) $lasttime = $changedate; $lastuser = $uid; if ($i <= $this->grab) { - $desc = ''; - $name = $this->myGetUnameFromId($row['uid']); - $ret[$i]['title'] = $this->modname . ': by ' . $name; - $ret[$i]['link'] = XOOPS_URL . '/modules/surnames/list.php?uid=' . $row['uid']; + $desc = ''; + $name = $this->myGetUnameFromId($row['uid']); + $ret[$i]['title'] = $this->modname . ': by ' . $name; + $ret[$i]['link'] = XOOPS_URL . '/modules/surnames/list.php?uid=' . $row['uid']; $ret[$i]['timestamp'] = $changedate; - $link = XOOPS_URL . '/modules/surnames/view.php?id=' . $row['id']; - $ret[$i]['guid'] = $link; + $link = XOOPS_URL . '/modules/surnames/view.php?id=' . $row['id']; + $ret[$i]['guid'] = $link; $ret[$i]['category'] = $this->modname; $surname = $row['surname']; - $desc .= "$surname
    "; + $desc .= "$surname
    "; } } if ($i > $this->grab) { diff --git a/class/Plugins/Weblinks.php b/class/Plugins/Weblinks.php index 116ef03b..cf0b7cc3 100644 --- a/class/Plugins/Weblinks.php +++ b/class/Plugins/Weblinks.php @@ -1,4 +1,7 @@ -getUser($uid); + $thisUser = $memberHandler->getUser($uid); } $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); if ('' == $name) { $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); } - $lastUid = $uid; + $lastUid = $uid; $lastName = $name; return $name; @@ -89,25 +92,25 @@ public function myGetUnameFromId($uid) public function &grabEntries(&$obj) { global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT lid, title, time_update, description, url, uid FROM ' . $xoopsDB->prefix('weblinks_link') . ' ORDER BY time_update DESC'; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT lid, title, time_update, description, url, uid FROM ' . $xoopsDB->prefix('weblinks_link') . ' ORDER BY time_update DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $title = $row['title']; - $name = $this->myGetUnameFromId($row['uid']); - $ret[$i]['title'] = $this->modname . ': ' . $title; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?lid=' . $row['lid'] . '&keywords='; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['time_update']; - $desc = '

    ' . $title . '
    '; - $desc .= 'Submitted by: ' . $name . '
    '; - $desc .= $myts->displayTarea($row['description']) . '


    '; + $title = $row['title']; + $name = $this->myGetUnameFromId($row['uid']); + $ret[$i]['title'] = $this->modname . ': ' . $title; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?lid=' . $row['lid'] . '&keywords='; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['time_update']; + $desc = '

    ' . $title . '
    '; + $desc .= 'Submitted by: ' . $name . '
    '; + $desc .= $myts->displayTarea($row['description']) . '


    '; $ret[$i]['description'] = $desc; - $ret[$i]['guid'] = $link; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['guid'] = $link; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php index 80fd93ac..102ed358 100644 --- a/class/Plugins/Wfdownloads.php +++ b/class/Plugins/Wfdownloads.php @@ -1,4 +1,6 @@ -modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } @@ -65,21 +67,21 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $permiscHandler = xoops_getHandler('groupperm'); - $ret = false; - $i = 0; - $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); + $ret = false; + $i = 0; + $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { if ($permiscHandler->checkRight('WFDownFilePerm', $row['lid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['memberHandler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/class/Plugins/Wfdownloads_podcast.php b/class/Plugins/Wfdownloads_podcast.php index 5c25d24b..307af00c 100644 --- a/class/Plugins/Wfdownloads_podcast.php +++ b/class/Plugins/Wfdownloads_podcast.php @@ -1,4 +1,6 @@ -modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } @@ -65,28 +67,28 @@ public function loadModule() public function &grabEntries(&$obj) { global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); $permiscHandler = xoops_getHandler('groupperm'); - $ret = false; - $i = 0; - $sql = 'SELECT lid, cid, title, date, description, filetype, size FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 AND (expired > ' . time() . ' OR expired = 0) AND published <= ' . time() . ' ORDER BY date DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); + $ret = false; + $i = 0; + $sql = 'SELECT lid, cid, title, date, description, filetype, size FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 AND (expired > ' . time() . ' OR expired = 0) AND published <= ' . time() . ' ORDER BY date DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { if ((isset($perms[$row['cid']]) && true === $perms[$row['cid']]) || $permiscHandler->checkRight('WFDownCatPerm', $row['cid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['memberHandler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { - $perms[$row['cid']] = true; - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $perms[$row['cid']] = true; + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; // enclosure tag, a.k.a podcast $ret[$i]['extras']['enclosure']['attributes'] = [ - 'url' => XOOPS_URL . '/modules/' . $this->dirname . '/visit.php?cid=' . $row['cid'] . '&lid=' . $row['lid'], + 'url' => XOOPS_URL . '/modules/' . $this->dirname . '/visit.php?cid=' . $row['cid'] . '&lid=' . $row['lid'], 'length' => $row['size'], - 'type' => $row['filetype'], + 'type' => $row['filetype'], ]; $i++; } else { diff --git a/class/Plugins/Wflinks.php b/class/Plugins/Wflinks.php index 10e8eb4d..58d013bb 100644 --- a/class/Plugins/Wflinks.php +++ b/class/Plugins/Wflinks.php @@ -1,4 +1,6 @@ -modname = $mod->getVar('name'); - $this->mid = $mod->getVar('mid'); + $this->mid = $mod->getVar('mid'); return $mod; } @@ -70,24 +72,24 @@ public function grabEntries(&$obj) { global $xoopsDB, $xoopsUser; - $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; + $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; $grouppermiscHandler = xoops_getHandler('groupperm'); - $myts = \MyTextSanitizer::getInstance(); - $ret = []; - $i = 0; - $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; + $myts = \MyTextSanitizer::getInstance(); + $ret = []; + $i = 0; + $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { if ($grouppermiscHandler->checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { // required - $ret[$i]['title'] = $row['title']; - $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['title']; + $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $row['description']; // optional $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/class/Plugins/Wfsection.php b/class/Plugins/Wfsection.php index 0f56c40e..229e5c2c 100644 --- a/class/Plugins/Wfsection.php +++ b/class/Plugins/Wfsection.php @@ -1,4 +1,6 @@ -prefix('wfs_article') . ' a, ' @@ -82,14 +84,14 @@ public function &grabEntries(&$obj) $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { if (checkAccess($row['groupid'])) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/article.php?articleid=' . $row['articleid']; - $ret[$i]['title'] = $row['atitle']; - $ret[$i]['link'] = $link; - $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['published']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/article.php?articleid=' . $row['articleid']; + $ret[$i]['title'] = $row['atitle']; + $ret[$i]['link'] = $link; + $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['published']; $ret[$i]['description'] = $myts->displayTarea(!empty($row['summary']) ? $row['summary'] : $row['maintext']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/class/Plugins/Wfsection2.php b/class/Plugins/Wfsection2.php index 051f7a4f..8a717c34 100644 --- a/class/Plugins/Wfsection2.php +++ b/class/Plugins/Wfsection2.php @@ -1,4 +1,6 @@ -grab, 0, 'online'); if (count($articles) > 0) { $xoopsModuleConfig['shortartlen'] = 0; - $myts = \MyTextSanitizer::getInstance(); + $myts = \MyTextSanitizer::getInstance(); for ($i = 0, $iMax = count($articles); $i < $iMax; $i++) { - $link = XOOPS_URL . '/modules/wfsection/article.php?articleid=' . $articles[$i]->articleid(); - $ret[$i]['title'] = $myts->undoHtmlSpecialChars($articles[$i]->title()); - $ret[$i]['link'] = $link; - $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $articles[$i]->published(); + $link = XOOPS_URL . '/modules/wfsection/article.php?articleid=' . $articles[$i]->articleid(); + $ret[$i]['title'] = $myts->undoHtmlSpecialChars($articles[$i]->title()); + $ret[$i]['link'] = $link; + $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $articles[$i]->published(); $ret[$i]['description'] = $articles[$i]->summary(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } diff --git a/class/Plugins/Xoopstube.php b/class/Plugins/Xoopstube.php index 78aea4d7..566e1fe0 100644 --- a/class/Plugins/Xoopstube.php +++ b/class/Plugins/Xoopstube.php @@ -1,4 +1,6 @@ -prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; + $ret = false; + $i = 0; + $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['ltitle']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['ltitle']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } diff --git a/class/Utility.php b/class/Utility.php index 02634568..8d617957 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -27,10 +27,6 @@ //require_once dirname(__DIR__) . '/include/common.php'; -use XoopsModules\Rssfit; -use XoopsModules\Rssfit\Common; -use XoopsModules\Rssfit\Constants; - /** * Class Utility */ @@ -38,22 +34,23 @@ class Utility extends Common\SysUtility { //--------------- Custom module methods ----------------------------- - public static function rssfitAdminHeader(){ + public static function rssfitAdminHeader() + { global $xoopsModule, $xoopsConfig; - $langf = RSSFIT_ROOT_PATH.'language/'.$xoopsConfig['language'].'/modinfo.php'; - if( file_exists($langf) ){ + $langf = RSSFIT_ROOT_PATH . 'language/' . $xoopsConfig['language'] . '/modinfo.php'; + if (file_exists($langf)) { include $langf; - }else{ - include RSSFIT_ROOT_PATH.'language/english/modinfo.php'; + } else { + include RSSFIT_ROOT_PATH . 'language/english/modinfo.php'; } require __DIR__ . '/menu.php'; - for($i=0, $iMax = count($adminmenu); $i < $iMax; $i++ ){ + for ($i = 0, $iMax = count($adminmenu); $i < $iMax; $i++) { $links[$i] = [0 => RSSFIT_URL . $adminmenu[$i]['link'], 1 => $adminmenu[$i]['title']]; } $links[] = [0 => XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $xoopsModule->getVar('mid'), 1 => _PREFERENCES]; $admin_links = ''; - for($i=0, $iMax = count($links); $i < $iMax; $i++ ){ - $admin_links .= ''; + for ($i = 0, $iMax = count($links); $i < $iMax; $i++) { + $admin_links .= ''; } $admin_links .= "
    '.$links[$i][1].'' . $links[$i][1] . '

    \n"; xoops_cp_header(); diff --git a/config/config.php b/config/config.php index d295771c..43de1392 100644 --- a/config/config.php +++ b/config/config.php @@ -9,28 +9,27 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -/** - * @copyright XOOPS Project https://xoops.org/ - * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @package - * @since - * @author XOOPS Development Team - */ - - $moduleDirName = basename(dirname(__DIR__)); + /** + * @copyright XOOPS Project https://xoops.org/ + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + * @package + * @since + * @author XOOPS Development Team + */ + $moduleDirName = basename(dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); return (object)[ - 'name' => $moduleDirNameUpper . ' Module Configurator', - 'paths' => [ - 'dirname' => $moduleDirName, - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, + 'name' => $moduleDirNameUpper . ' Module Configurator', + 'paths' => [ + 'dirname' => $moduleDirName, + 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', + 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, + 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, + 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, ], - 'uploadFolders' => [ + 'uploadFolders' => [ XOOPS_UPLOAD_PATH . '/' . $moduleDirName, XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', @@ -59,7 +58,7 @@ // '/templates/blocks/', // '/templates/admin/' ], - 'oldFiles' => [ + 'oldFiles' => [ '/class/request.php', '/class/registry.php', '/class/utilities.php', @@ -68,7 +67,7 @@ // '/include/functions.php', '/ajaxrating.txt', ], - 'oldFolders' => [ + 'oldFolders' => [ '/images', '/css', '/js', @@ -77,7 +76,7 @@ 'renameTables' => [// 'XX_archive' => 'ZZZZ_archive', ], - 'moduleStats' => [ + 'moduleStats' => [ // 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), // 'totalitems' => $helper->getHandler('Item')->getItemsCount(), // 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_SUBMITTED]), @@ -85,4 +84,3 @@ 'modCopyright' => " XOOPS Project", ]; - diff --git a/config/paths.php b/config/paths.php index 4147a186..939bf725 100644 --- a/config/paths.php +++ b/config/paths.php @@ -1,18 +1,17 @@ $moduleDirNameUpper . ' Module Configurator', - 'paths' => [ - 'dirname' => $moduleDirName, - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, + 'name' => $moduleDirNameUpper . ' Module Configurator', + 'paths' => [ + 'dirname' => $moduleDirName, + 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', + 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, + 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, + 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, ], 'uploadFolders' => [ XOOPS_UPLOAD_PATH . '/' . $moduleDirName, @@ -21,4 +20,3 @@ //XOOPS_UPLOAD_PATH . '/flags' ], ]; - diff --git a/header.php b/header.php index 02f4d9ff..df3e3823 100644 --- a/header.php +++ b/header.php @@ -16,6 +16,5 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - require_once dirname(dirname(__DIR__)) . '/mainfile.php'; require_once __DIR__ . '/include/common.php'; diff --git a/include/common.php b/include/common.php index 2651d7e2..8f798cfc 100644 --- a/include/common.php +++ b/include/common.php @@ -17,6 +17,7 @@ * @author XOOPS Development Team */ use XoopsModules\Rssfit; + include dirname(__DIR__) . '/preloads/autoloader.php'; $moduleDirName = basename(dirname(__DIR__)); @@ -79,28 +80,13 @@ //global $xoopsModuleConfig, $xoopsConfig, $xoopsModule; -$feedHandler = new \XoopsModules\Rssfit\FeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); -$myts = $feedHandler->myts; +$feedHandler = new \XoopsModules\Rssfit\FeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); +$myts = $feedHandler->myts; //$pluginsHandler = $feedHandler->pluginHandler; //$miscHandler = $feedHandler->miscHandler; $pluginsHandler = $helper->getHandler('Plugin'); -$miscHandler = $helper->getHandler('Misc'); - - - - - - - - - - - - - - - +$miscHandler = $helper->getHandler('Misc'); $icons = [ 'edit' => " . _EDIT . ", diff --git a/include/common0.php b/include/common0.php index 054038e2..d084947d 100644 --- a/include/common0.php +++ b/include/common0.php @@ -16,8 +16,6 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - -use Xmf\Request; use XoopsModules\Rssfit; if (!defined('RSSFIT_CONSTANTS_DEFINED')) { @@ -35,7 +33,7 @@ $version = !mb_substr($version, -1, 1) ? mb_substr($version, 0, 3) : $version; define('RSSFIT_VERSION', 'RSSFit ' . $version); -$rss = new Rssfit\FeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); -$myts = $rss->myts; +$rss = new Rssfit\FeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); +$myts = $rss->myts; $pluginsHandler = $rss->pluginHandler; -$miscHandler = $rss->miscHandler; +$miscHandler = $rss->miscHandler; diff --git a/include/functions.php b/include/functions.php index 8149c99d..e044b3be 100644 --- a/include/functions.php +++ b/include/functions.php @@ -19,7 +19,6 @@ * @param $b * @return int */ - function sortTimestamp($a, $b) { if ($a['timestamp'] == $b['timestamp']) { diff --git a/include/install.php b/include/install.php index 17f3beaf..e9683cc7 100644 --- a/include/install.php +++ b/include/install.php @@ -16,16 +16,12 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - - use XoopsModules\Rssfit; require_once dirname(__DIR__) . '/preloads/autoloader.php'; require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; /** - * @param \XoopsModule $xoopsMod - * * @return bool */ function xoops_module_install_rssfit(\XoopsModule $xoopsMod) @@ -34,12 +30,12 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod) $moduleDirName = basename(dirname(__DIR__)); - $helper = Rssfit\Helper::getInstance(); + $helper = Rssfit\Helper::getInstance(); $myts = \MyTextSanitizer::getInstance(); rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); $intro_setting = ['dohtml' => 1, 'dobr' => 1, 'sub' => stripslashes(_INSTALL_INTRO_SUB)]; - $sql[] = 'INSERT INTO `' + $sql[] = 'INSERT INTO `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` VALUES (1, ' . $xoopsDB->quoteString('intro') @@ -50,8 +46,8 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod) . ', ' . $xoopsDB->quoteString(serialize($intro_setting)) . ')'; - $sql[] = rssfInsertChannel($xoopsMod); - $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "(NULL, 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; + $sql[] = rssfInsertChannel($xoopsMod); + $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "(NULL, 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; foreach ($sql as $s) { if (false === $xoopsDB->query($s)) { echo '' . $xoopsDB->error() . '
    ' . $s . '

    '; @@ -64,7 +60,6 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod) } /** - * @param \XoopsModule $xoopsMod * @param int $oldversion version number of prevviously installed version * * @return bool @@ -72,20 +67,20 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod) function xoops_module_update_rssfit(\XoopsModule $xoopsMod, $oldversion) { global $xoopsDB, $xoopsConfig; - $helper = Rssfit\Helper::getInstance(); + $helper = Rssfit\Helper::getInstance(); rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); list($rows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . " WHERE misc_category = 'channel'")); if (!$rows) { - $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` ADD `misc_setting` TEXT NOT NULL;'; - $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; + $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` ADD `misc_setting` TEXT NOT NULL;'; + $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; $intro_setting = ['dohtml' => 1, 'dobr' => 1, 'sub' => _INSTALL_INTRO_SUB]; - $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` SET misc_setting = ' . $xoopsDB->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; - $sql[] = 'ALTER TABLE `' + $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` SET misc_setting = ' . $xoopsDB->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; + $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_plugins') . "` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; - $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_plugins') . '` SET sub_entries = 5'; - $sql[] = rssfInsertChannel($xoopsMod); - $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; + $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_plugins') . '` SET sub_entries = 5'; + $sql[] = rssfInsertChannel($xoopsMod); + $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; foreach ($sql as $s) { if (false === $xoopsDB->query($s)) { echo '' . $xoopsDB->error() . '
    ' . $s . '

    '; @@ -120,8 +115,8 @@ function rssfInstallLangFile($xoopsMod, $lang) function rssfInsertChannel($xoopsMod) { global $xoopsDB, $xoopsConfig; - $helper = Rssfit\Helper::getInstance(); - $url = $xoopsDB->quoteString(XOOPS_URL); + $helper = Rssfit\Helper::getInstance(); + $url = $xoopsDB->quoteString(XOOPS_URL); $sitename = $xoopsDB->quoteString($xoopsConfig['sitename']); list($copyright) = $xoopsDB->fetchRow($xoopsDB->query('SELECT conf_value FROM ' . $xoopsDB->prefix('config') . " WHERE conf_name = 'meta_copyright' AND conf_modid = 1 AND conf_catid = " . XOOPS_CONF_METAFOOTER)); diff --git a/include/oninstall.php b/include/oninstall.php index d58ef99b..cc69e2fe 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -17,7 +17,6 @@ * @since * @author XOOPS Development Team */ - use XoopsModules\Rssfit; /** @@ -29,9 +28,9 @@ function xoops_module_pre_install_rssfit(\XoopsModule $module) { require_once dirname(__DIR__) . '/preloads/autoloader.php'; - $utility = new \XoopsModules\Rssfit\Utility(); + $utility = new \XoopsModules\Rssfit\Utility(); $xoopsSuccess = $utility::checkVerXoops($module); - $phpSuccess = $utility::checkVerPhp($module); + $phpSuccess = $utility::checkVerPhp($module); if (false !== $xoopsSuccess && false !== $phpSuccess) { $moduleTables = &$module->getInfo('tables'); @@ -56,7 +55,7 @@ function xoops_module_install_rssfit(\XoopsModule $module) $moduleDirName = basename(dirname(__DIR__)); - $helper = Rssfit\Helper::getInstance(); + $helper = Rssfit\Helper::getInstance(); $configurator = new Rssfit\Common\Configurator(); $utility = new Rssfit\Utility(); @@ -66,7 +65,7 @@ function xoops_module_install_rssfit(\XoopsModule $module) // default Permission Settings ---------------------- global $xoopsModule; - $moduleId = $xoopsModule->getVar('mid'); + $moduleId = $xoopsModule->getVar('mid'); // $moduleId2 = $helper->getModule()->mid(); $grouppermiscHandler = xoops_getHandler('groupperm'); // access rights ------------------------------------------ diff --git a/include/onuninstall.php b/include/onuninstall.php index ba2b6465..aa92ceda 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -7,7 +7,6 @@ * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} * @link https://xoops.org XOOPS */ - use XoopsModules\Rssfit; /** @@ -32,7 +31,7 @@ function xoops_module_uninstall_rssfit(\XoopsModule $module) { // return true; - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = basename(dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $helper = Rssfit\Helper::getInstance(); diff --git a/include/onupdate.php b/include/onupdate.php index 97cf6510..ef5ac825 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -16,7 +16,6 @@ * @since * @author XOOPS Development Team */ - use XoopsModules\Rssfit; if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser) @@ -38,7 +37,6 @@ function tableExists($tablename) /** * Prepares system prior to attempting to install module - * @param \XoopsModule $xoopsModule * @param null $previousVersion * @return bool true if ready to install, false if not */ @@ -47,11 +45,11 @@ function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVers $moduleDirName = basename(dirname(__DIR__)); /** @var Rssfit\Helper $helper */ /** @var Rssfit\Utility $utility */ - $helper = Rssfit\Helper::getInstance(); + $helper = Rssfit\Helper::getInstance(); $utility = new Rssfit\Utility(); $xoopsSuccess = $utility::checkVerXoops($module); - $phpSuccess = $utility::checkVerPhp($module); + $phpSuccess = $utility::checkVerPhp($module); return $xoopsSuccess && $phpSuccess; } @@ -65,14 +63,14 @@ function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVers */ function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = null) { - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = basename(dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); /** @var Rssfit\Helper $helper */ /** @var Rssfit\Utility $utility */ /** @var Rssfit\Common\Configurator $configurator */ - $helper = Rssfit\Helper::getInstance(); - $utility = new Rssfit\Utility(); + $helper = Rssfit\Helper::getInstance(); + $utility = new Rssfit\Utility(); $configurator = new Rssfit\Common\Configurator(); if ($previousVersion < 240) { diff --git a/index.php b/index.php index cc742e3a..c1b641fe 100644 --- a/index.php +++ b/index.php @@ -16,26 +16,25 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - require_once __DIR__ . '/header.php'; $GLOBALS['xoopsOption']['template_main'] = 'rssfit_index.tpl'; require_once XOOPS_ROOT_PATH . '/header.php'; $intr = $miscHandler->getObjects2(new \Criteria('misc_category', 'intro')); if ($intr) { - $intro = $intr[0]; + $intro = $intr[0]; $setting = $intro->getVar('misc_setting'); $intro->setDoHtml($setting['dohtml'] ? 1 : 0); $intro->setDoBr($setting['dobr'] ? 1 : 0); - $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); + $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); $content = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_content')); $content = str_replace('{SITEURL}', XOOPS_URL . '/', $content); if (false !== mb_strpos($content, '{SUB}') && $plugins = $pluginsHandler->getObjects2(new \Criteria('subfeed', 1))) { $sublist = ''; foreach ($plugins as $p) { - $sub = $myts->stripSlashesGPC($setting['sub']); - $sub = str_replace('{URL}', $feedHandler->subFeedUrl($p->getVar('rssf_filename')), $sub); - $sub = str_replace('{TITLE}', $p->getVar('sub_title'), $sub); - $sub = str_replace('{DESC}', $p->getVar('sub_desc'), $sub); + $sub = $myts->stripSlashesGPC($setting['sub']); + $sub = str_replace('{URL}', $feedHandler->subFeedUrl($p->getVar('rssf_filename')), $sub); + $sub = str_replace('{TITLE}', $p->getVar('sub_title'), $sub); + $sub = str_replace('{DESC}', $p->getVar('sub_desc'), $sub); $sublist .= $sub; } $content = str_replace('{SUB}', $sublist, $content); diff --git a/language/english/common.php b/language/english/common.php index 3a4ebb8b..70967391 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -17,7 +17,7 @@ * @since 3.23 * @author Xoops Development Team */ -$moduleDirName = basename(dirname(dirname(__DIR__))); +$moduleDirName = basename(dirname(dirname(__DIR__))); $moduleDirNameUpper = mb_strtoupper($moduleDirName); define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: '); diff --git a/rss.php b/rss.php index a47ccb80..5f2e8a16 100644 --- a/rss.php +++ b/rss.php @@ -16,7 +16,6 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - use XoopsModules\Rssfit; if (function_exists('mb_http_output')) { @@ -25,13 +24,13 @@ require_once __DIR__ . '/header.php'; $helper = Rssfit\Helper::getInstance(); -$charset = $helper->getConfig('utf8') ? 'UTF-8' : _CHARSET; -$docache = $helper->getConfig('cache') ? true : false; +$charset = $helper->getConfig('utf8') ? 'UTF-8' : _CHARSET; +$docache = $helper->getConfig('cache') ? true : false; $template = 'db:rssfit_rss.tpl'; if (3 == $helper->getConfig('mime')) { $xoopsLogger->enableRendering(); $xoopsLogger->usePopup = (2 == $xoopsConfig['debug_mode']); - $docache = false; + $docache = false; } else { error_reporting(0); $xoopsLogger->activated = false; @@ -46,7 +45,7 @@ $xoopsTpl->xoops_setCacheTime($helper->getConfig('cache') * 60); } -$feed = []; +$feed = []; $feed['plugin'] = isset($_GET[$feedHandler->feedkey]) ? trim($_GET[$feedHandler->feedkey]) : ''; $feedHandler->checkSubFeed($feed); if (!$xoopsTpl->is_cached($template, $feedHandler->cached) || !$docache) { diff --git a/testdata/index.php b/testdata/index.php index de0de170..7a73c308 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -55,7 +55,7 @@ function loadSampleData() $moduleDirName = basename(dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); - $utility = new Rssfit\Utility(); + $utility = new Rssfit\Utility(); $configurator = new Common\Configurator(); $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); @@ -63,7 +63,7 @@ function loadSampleData() $language = 'english/'; if (is_dir(__DIR__ . '/' . $xoopsConfig['language'])) { $language = $xoopsConfig['language'] . '/'; - } + } foreach ($tables as $table) { $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); @@ -75,7 +75,7 @@ function loadSampleData() if (is_array($configurator->copyTestFolders) && count($configurator->copyTestFolders) > 0) { // $file = dirname(__DIR__) . '/testdata/images/'; foreach (array_keys($configurator->copyTestFolders) as $i) { - $src = $configurator->copyTestFolders[$i][0]; + $src = $configurator->copyTestFolders[$i][0]; $dest = $configurator->copyTestFolders[$i][1]; $utility::rcopy($src, $dest); } @@ -91,9 +91,9 @@ function saveSampleData() $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); - $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; + $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; if (!file_exists($languageFolder . '/')) { - Utility::createFolder($languageFolder . '/'); + Utility::createFolder($languageFolder . '/'); } $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; Utility::createFolder($exportFolder); @@ -107,7 +107,7 @@ function saveSampleData() function exportSchema() { - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = basename(dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); try { @@ -116,9 +116,7 @@ function exportSchema() // $migrate->saveCurrentSchema(); // // redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS')); - } - catch (\Exception $e) { + } catch (\Exception $e) { exit(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR')); } - } diff --git a/xoops_version.php b/xoops_version.php index 9154fadf..833349c7 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -16,7 +16,6 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ - defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); require_once __DIR__ . '/preloads/autoloader.php'; @@ -26,68 +25,68 @@ // ------------------- Informations ------------------- // $modversion = [ - 'version' => '1.31.0', - 'module_status' => 'Beta 2', - 'release_date' => '2019/07/06', - 'name' => _MI_RSSFIT_NAME, - 'description' => _MI_RSSFIT_DESC, - 'official' => 0, + 'version' => '1.31.0', + 'module_status' => 'Beta 2', + 'release_date' => '2019/07/06', + 'name' => _MI_RSSFIT_NAME, + 'description' => _MI_RSSFIT_DESC, + 'official' => 0, //1 indicates official XOOPS module supported by XOOPS Dev Team, 0 means 3rd party supported - 'author' => 'NS Tai (aka tuff)', - 'credits' => 'XOOPS Development Team, Brandycoke Productions', - 'author_mail' => 'author-email', - 'author_website_url' => 'https://xoops.org', + 'author' => 'NS Tai (aka tuff)', + 'credits' => 'XOOPS Development Team, Brandycoke Productions', + 'author_mail' => 'author-email', + 'author_website_url' => 'https://xoops.org', 'author_website_name' => 'XOOPS', - 'license' => 'GPL 2.0 or later', - 'license_url' => 'www.gnu.org/licenses/gpl-2.0.html/', - 'help' => 'page=help', + 'license' => 'GPL 2.0 or later', + 'license_url' => 'www.gnu.org/licenses/gpl-2.0.html/', + 'help' => 'page=help', // ------------------- Folders & Files ------------------- - 'release_info' => 'Changelog', - 'release_file' => XOOPS_URL . "/modules/$moduleDirName/docs/changelog.txt", + 'release_info' => 'Changelog', + 'release_file' => XOOPS_URL . "/modules/$moduleDirName/docs/changelog.txt", - 'manual' => 'link to manual file', - 'manual_file' => XOOPS_URL . "/modules/$moduleDirName/docs/install.txt", + 'manual' => 'link to manual file', + 'manual_file' => XOOPS_URL . "/modules/$moduleDirName/docs/install.txt", // images - 'image' => 'assets/images/logoModule.png', - 'iconsmall' => 'assets/images/iconsmall.png', - 'iconbig' => 'assets/images/iconbig.png', - 'dirname' => $moduleDirName, + 'image' => 'assets/images/logoModule.png', + 'iconsmall' => 'assets/images/iconsmall.png', + 'iconbig' => 'assets/images/iconbig.png', + 'dirname' => $moduleDirName, // Local path icons - 'modicons16' => 'assets/images/icons/16', - 'modicons32' => 'assets/images/icons/32', + 'modicons16' => 'assets/images/icons/16', + 'modicons32' => 'assets/images/icons/32', //About - 'demo_site_url' => 'https://xoops.org', - 'demo_site_name' => 'XOOPS Demo Site', - 'support_url' => 'https://xoops.org/modules/newbb/viewforum.php?forum=28/', - 'support_name' => 'Support Forum', - 'submit_bug' => 'https://github.com/XoopsModules25x/' . $moduleDirName . '/issues', - 'module_website_url' => 'www.xoops.org', + 'demo_site_url' => 'https://xoops.org', + 'demo_site_name' => 'XOOPS Demo Site', + 'support_url' => 'https://xoops.org/modules/newbb/viewforum.php?forum=28/', + 'support_name' => 'Support Forum', + 'submit_bug' => 'https://github.com/XoopsModules25x/' . $moduleDirName . '/issues', + 'module_website_url' => 'www.xoops.org', 'module_website_name' => 'XOOPS Project', // ------------------- Min Requirements ------------------- - 'min_php' => '5.6', - 'min_xoops' => '2.5.10', - 'min_admin' => '1.2', - 'min_db' => ['mysql' => '5.5'], + 'min_php' => '5.6', + 'min_xoops' => '2.5.10', + 'min_admin' => '1.2', + 'min_db' => ['mysql' => '5.5'], // ------------------- Admin Menu ------------------- - 'system_menu' => 1, - 'hasAdmin' => 1, - 'adminindex' => 'admin/index.php', - 'adminmenu' => 'admin/menu.php', + 'system_menu' => 1, + 'hasAdmin' => 1, + 'adminindex' => 'admin/index.php', + 'adminmenu' => 'admin/menu.php', // ------------------- Main Menu ------------------- - 'hasMain' => 1, + 'hasMain' => 1, // ------------------- Install/Update ------------------- - 'onInstall' => 'include/install.php', - 'onUpdate' => 'include/install.php', + 'onInstall' => 'include/install.php', + 'onUpdate' => 'include/install.php', // 'onUninstall' => 'include/onuninstall.php', // ------------------- PayPal --------------------------- - 'paypal' => [ - 'business' => 'xoopsfoundation@gmail.com', - 'item_name' => 'Donation : ' . _MI_RSSFIT_NAME, - 'amount' => 0, + 'paypal' => [ + 'business' => 'xoopsfoundation@gmail.com', + 'item_name' => 'Donation : ' . _MI_RSSFIT_NAME, + 'amount' => 0, 'currency_code' => 'USD', ], // ------------------- Mysql ----------------------------- - 'sqlfile' => ['mysql' => 'sql/mysql.sql'], + 'sqlfile' => ['mysql' => 'sql/mysql.sql'], // ------------------- Tables ---------------------------- 'tables' => [ $moduleDirName . '_' . 'plugins', @@ -106,13 +105,13 @@ ]; // Templates -$modversion['templates'] = []; +$modversion['templates'] = []; $modversion['templates'][] = [ - 'file' => 'rssfit_index.tpl', + 'file' => 'rssfit_index.tpl', 'description' => _MI_TMPL_INTRO, ]; $modversion['templates'][] = [ - 'file' => 'rssfit_rss.tpl', + 'file' => 'rssfit_rss.tpl', 'description' => _MI_TMPL_RSS, ]; @@ -120,96 +119,96 @@ // $helper->getConfig('overall_entries') $modversion['config'][] = [ - 'name' => 'overall_entries', - 'title' => '_MI_OVERALL_ENTRIES', + 'name' => 'overall_entries', + 'title' => '_MI_OVERALL_ENTRIES', 'description' => '_MI_OVERALL_ENTRIES_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 20, + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 20, ]; // $helper->getConfig('plugin_entries') $modversion['config'][] = [ - 'name' => 'plugin_entries', - 'title' => '_MI_PLUGIN_ENTRIES', + 'name' => 'plugin_entries', + 'title' => '_MI_PLUGIN_ENTRIES', 'description' => '_MI_PLUGIN_ENTRIES_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 5, + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 5, ]; // $helper->getConfig('sort') $modversion['config'][] = [ - 'name' => 'sort', - 'title' => '_MI_ENTRIES_SORT', + 'name' => 'sort', + 'title' => '_MI_ENTRIES_SORT', 'description' => '_MI_ENTRIES_SORT_DESC', - 'formtype' => 'select', - 'valuetype' => 'text', - 'default' => 'd', - 'options' => [_MI_ENTRIES_SORT_DATE => 'd', _MI_ENTRIES_SORT_CAT => 'c'], + 'formtype' => 'select', + 'valuetype' => 'text', + 'default' => 'd', + 'options' => [_MI_ENTRIES_SORT_DATE => 'd', _MI_ENTRIES_SORT_CAT => 'c'], ]; // $helper->getConfig('cache') $modversion['config'][] = [ - 'name' => 'cache', - 'title' => '_MI_CACHE', + 'name' => 'cache', + 'title' => '_MI_CACHE', 'description' => '_MI_CACHE_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 0, + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 0, ]; // $helper->getConfig('max_char') $modversion['config'][] = [ - 'name' => 'max_char', - 'title' => '_MI_MAXCHAR', + 'name' => 'max_char', + 'title' => '_MI_MAXCHAR', 'description' => '_MI_MAXCHAR_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 0, + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 0, ]; // $helper->getConfig('strip_html') $modversion['config'][] = [ - 'name' => 'strip_html', - 'title' => '_MI_STRIPHTML', + 'name' => 'strip_html', + 'title' => '_MI_STRIPHTML', 'description' => '_MI_STRIPHTML_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 0, + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 0, ]; // $helper->getConfig('utf8') $modversion['config'][] = [ - 'name' => 'utf8', - 'title' => '_MI_ENCODE_UTF8', + 'name' => 'utf8', + 'title' => '_MI_ENCODE_UTF8', 'description' => '_MI_ENCODE_UTF8_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 0, + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 0, ]; // $helper->getConfig('mime') $modversion['config'][] = [ - 'name' => 'mime', - 'title' => '_MI_OUTOUT_MIME', + 'name' => 'mime', + 'title' => '_MI_OUTOUT_MIME', 'description' => '', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 1, - 'options' => [_MI_OUTOUT_MIME_XML => 1, _MI_OUTOUT_MIME_HTML => 2, _MI_OUTOUT_MIME_PHP => 3], + 'formtype' => 'select', + 'valuetype' => 'int', + 'default' => 1, + 'options' => [_MI_OUTOUT_MIME_XML => 1, _MI_OUTOUT_MIME_HTML => 2, _MI_OUTOUT_MIME_PHP => 3], ]; /** * Make Sample button visible? */ $modversion['config'][] = [ - 'name' => 'displaySampleButton', - 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', + 'name' => 'displaySampleButton', + 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 1, + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 1, ]; /** From c070c5e4d8f7b6ae96eff20d0e27e285da655696 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 14 Mar 2020 06:27:56 -0400 Subject: [PATCH 055/154] RGB color function instead of #HEX representation --- assets/css/style.css | 2 +- class/Common/ServerStats.php | 10 +++++----- language/english/common.php | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/assets/css/style.css b/assets/css/style.css index a4b9a0ea..66937f13 100644 --- a/assets/css/style.css +++ b/assets/css/style.css @@ -111,7 +111,7 @@ } #extgallery #viewecard { - border: 1px solid black; + border: 1px solid #000000; padding: 7px; margin: 0 auto 0 auto; } diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index 6368509f..488ccf31 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -44,7 +44,7 @@ public static function getServerStats() $html .= '
    ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "
    \n"; $html .= "
      \n"; - $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; + $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; if (function_exists('gd_info')) { if (true === ($gdlib = gd_info())) { @@ -58,12 +58,12 @@ public static function getServerStats() // $registerglobals = (!ini_get('register_globals')) ? "" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . constant('CO_' . $moduleDirNameUpper . '_ON') . ''; // $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; // - $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; + $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . "\n"; - $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . "\n"; - $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . "\n"; + $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . "\n"; + $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . "\n"; + $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . "\n"; $html .= "
    \n"; $html .= "
      \n"; $html .= '
    • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . "\n"; diff --git a/language/english/common.php b/language/english/common.php index 70967391..210a4072 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -134,9 +134,9 @@ define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); //DirectoryChecker -define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); +define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); +define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); +define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); From 484af095cd5ea126d7cbbe63d976cde1681df334 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 14 Mar 2020 06:34:27 -0400 Subject: [PATCH 056/154] PSR-12, PhpDocs --- admin/do_plugins.php | 4 +--- class/Common/FilesManagement.php | 6 ++---- class/Common/VersionChecks.php | 1 + class/MiscHandler.php | 3 +++ class/PluginHandler.php | 3 +++ include/install.php | 4 +++- include/onupdate.php | 1 + 7 files changed, 14 insertions(+), 8 deletions(-) diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 22197605..11339c0f 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -112,8 +112,7 @@ if ($handler) { $ret .= $handler->modname; $action->addOption('a', _AM_PLUGIN_ACTIVATE); - } else { - if (count($p->getErrors()) > 0) { + } elseif (count($p->getErrors()) > 0) { $ret .= '' . _ERRORS . "\n"; foreach ($p->getErrors() as $e) { $ret .= '
      ' . $e; @@ -121,7 +120,6 @@ } else { $ret .= '' . _AM_PLUGIN_UNKNOWNERROR . ''; } - } $ret .= "\n"; $action->addOption('u', _AM_PLUGIN_UNINSTALL); $ret .= "" . $action->render() . "\n"; diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index 01877c9e..2d7d84f1 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -102,13 +102,11 @@ public static function deleteDirectory($src) if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { break; } - } else { - // delete the file - if (!($success = unlink($fileInfo->getRealPath()))) { + } elseif (!($success = unlink($fileInfo->getRealPath()))) { break; } } - } + // now delete this (sub)directory if all the files are gone if ($success) { $success = rmdir($dirInfo->getRealPath()); diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 5db5af07..7881e904 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -56,6 +56,7 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = * Verifies PHP version meets minimum requirements for this module * @static * + * @param \XoopsModule|null $module * @return bool true if meets requirements, false if not */ public static function checkVerPhp(\XoopsModule $module = null) diff --git a/class/MiscHandler.php b/class/MiscHandler.php index c35d5ea6..b673f9c2 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -60,6 +60,7 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) } /** + * @param \XoopsDatabase|null $db * @return \XoopsModules\Rssfit\MiscHandler */ public function getInstance(\XoopsDatabase $db = null) @@ -171,6 +172,7 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') } /** + * @param \XoopsObject $obj * @param bool $force * @return array|bool|int|mixed|null */ @@ -260,6 +262,7 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) } /** + * @param \XoopsObject $category * @param bool $force * @return bool */ diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 3888a828..e075f5b0 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -62,6 +62,7 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) } /** + * @param \XoopsDatabase|null $db * @return \XoopsModules\Rssfit\PluginHandler */ public function getInstance(\XoopsDatabase $db = null) @@ -109,6 +110,7 @@ public function get($id = null, $fields = null) } /** + * @param \XoopsObject $obj * @param bool $force * @return array|bool|int|mixed|null */ @@ -164,6 +166,7 @@ public function insert(\XoopsObject $obj, $force = false) } /** + * @param \XoopsObject $category * @param bool $force * @return bool */ diff --git a/include/install.php b/include/install.php index e9683cc7..51a4d74c 100644 --- a/include/install.php +++ b/include/install.php @@ -22,6 +22,7 @@ require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; /** + * @param \XoopsModule $xoopsMod * @return bool */ function xoops_module_install_rssfit(\XoopsModule $xoopsMod) @@ -60,7 +61,8 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod) } /** - * @param int $oldversion version number of prevviously installed version + * @param \XoopsModule $xoopsMod + * @param int $oldversion version number of prevviously installed version * * @return bool */ diff --git a/include/onupdate.php b/include/onupdate.php index ef5ac825..420491e4 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -37,6 +37,7 @@ function tableExists($tablename) /** * Prepares system prior to attempting to install module + * @param \XoopsModule $xoopsModule * @param null $previousVersion * @return bool true if ready to install, false if not */ From a43d9987d003921b7e1cc6b7bb2340ed0a337879 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 14 Mar 2020 07:01:44 -0400 Subject: [PATCH 057/154] cosmetics --- admin/do_plugins.php | 23 +++++++++++------------ class/MiscHandler.php | 6 +++--- class/PluginHandler.php | 20 ++++++++++---------- class/Plugins/Rmdp.php | 2 +- class/Plugins/Wflinks.php | 4 ++-- include/oninstall.php | 12 ++++++------ include/onupdate.php | 6 +++--- 7 files changed, 36 insertions(+), 37 deletions(-) diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 11339c0f..792efae0 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -131,21 +131,20 @@ if (!$filelist = &$pluginsHandler->getPluginFileList()) { $filelist = []; } - $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); - $list2 = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'class\Plugins'); +// $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); + $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'class\Plugins'); $installable = []; - $installable2 = []; +// foreach ($list as $f) { +// if (preg_match('/rssfit\.+[a-zA-Z0-9_]+\.php/$', $f) && !in_array($f, $filelist)) { +// $installable[] = $f; +// } +// } foreach ($list as $f) { - if (preg_match('/rssfit\.+[a-zA-Z0-9_]+\.php/$', $f) && !in_array($f, $filelist)) { - $installable[] = $f; + if (preg_match('/[a-zA-Z0-9_]+\.php/', ucfirst($f)) && !in_array($f, $filelist)) { + $installable[] = ucfirst($f); } } - foreach ($list2 as $f) { - if (preg_match('/[a-zA-Z0-9_]+\.php/$', ucfirst($f)) && !in_array($f, $filelist)) { - $installable2[] = ucfirst($f); - } - } - if (count($installable2) > 0) { + if (count($installable) > 0) { $ret .= "
      \n\n" . "\n"; - foreach ($installable2 as $i) { + foreach ($installable as $i) { $action = new \XoopsFormCheckbox('', 'install[' . $i . ']'); $action->addOption('i', ' '); $ret .= "\n" . "\n" . "
      " . _AM_PLUGIN_NONINSTALLED @@ -160,7 +159,7 @@ . _AM_PLUGIN_INSTALL . "\n" . "
      " . $i . ""; diff --git a/class/MiscHandler.php b/class/MiscHandler.php index b673f9c2..855d859a 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -134,7 +134,7 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') { $ret = false; $limit = $start = 0; - $fields = '*'; +// $fields = '*'; $sql = 'SELECT ' . $fields . ' FROM ' . $this->db_table; if (null !== $criteria && $criteria instanceof \CriteriaElement) { $sql .= ' ' . $criteria->renderWhere(); @@ -178,7 +178,7 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') */ public function insert(\XoopsObject $obj, $force = false) { - $force = false; +// $force = false; if (mb_strtolower(get_class($obj)) != mb_strtolower($this->obj_class)) { return false; } @@ -268,7 +268,7 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) */ public function delete(\XoopsObject $category, $force = false) { - $force = false; +// $force = false; if (mb_strtolower(get_class($obj)) != mb_strtolower($this->obj_class)) { return false; } diff --git a/class/PluginHandler.php b/class/PluginHandler.php index e075f5b0..9907651a 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -116,7 +116,7 @@ public function get($id = null, $fields = null) */ public function insert(\XoopsObject $obj, $force = false) { - $force = false; +// $force = false; if (mb_strtolower(get_class($obj)) != mb_strtolower($this->obj_class)) { return false; } @@ -172,7 +172,7 @@ public function insert(\XoopsObject $obj, $force = false) */ public function delete(\XoopsObject $category, $force = false) { - $force = false; +// $force = false; if (mb_strtolower(get_class($obj)) != mb_strtolower($this->obj_class)) { return false; } @@ -334,15 +334,15 @@ public function checkPlugin($obj) { $ret = false; global $moduleHandler; - $file = RSSFIT_ROOT_PATH . 'plugins/' . $obj->getVar('rssf_filename'); - $file2 = RSSFIT_ROOT_PATH . 'class/Plugins/' . $obj->getVar('rssf_filename'); - if (file_exists($file2)) { +// $file = RSSFIT_ROOT_PATH . 'plugins/' . $obj->getVar('rssf_filename'); + $file = RSSFIT_ROOT_PATH . 'class/Plugins/' . $obj->getVar('rssf_filename'); + if (file_exists($file)) { //mb $require_once = require $file; $name = explode('.', $obj->getVar('rssf_filename')); - $class = 'Rssfit' . ucfirst($name[0]); - $class2 = __NAMESPACE__ . '\Plugins\\' . ucfirst($name[0]); - if (class_exists($class2)) { - $handler = new $class2(); +// $class = 'Rssfit' . ucfirst($name[0]); + $class = __NAMESPACE__ . '\Plugins\\' . ucfirst($name[0]); + if (class_exists($class)) { + $handler = new $class(); if (!method_exists($handler, 'loadmodule') || !method_exists($handler, 'grabentries')) { $obj->setErrors(_AM_PLUGIN_FUNCNOTFOUND); } else { @@ -358,7 +358,7 @@ public function checkPlugin($obj) } } } else { - $obj->setErrors(_AM_PLUGIN_CLASSNOTFOUND . ' ' . $class2); + $obj->setErrors(_AM_PLUGIN_CLASSNOTFOUND . ' ' . $class); } } else { $obj->setErrors(_AM_PLUGIN_FILENOTFOUND); diff --git a/class/Plugins/Rmdp.php b/class/Plugins/Rmdp.php index dded101a..b5cfca13 100644 --- a/class/Plugins/Rmdp.php +++ b/class/Plugins/Rmdp.php @@ -64,7 +64,7 @@ public function loadModule() */ public function grabEntries(&$obj) { - global $xoopsDB, $grouppermiscHandler; + global $xoopsDB, $grouppermHandler; $ret = []; $i = 0; $sql = 'SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ' . $xoopsDB->prefix('rmdp_software') . ' ORDER BY fecha DESC'; diff --git a/class/Plugins/Wflinks.php b/class/Plugins/Wflinks.php index 58d013bb..fc80f8b8 100644 --- a/class/Plugins/Wflinks.php +++ b/class/Plugins/Wflinks.php @@ -73,7 +73,7 @@ public function grabEntries(&$obj) global $xoopsDB, $xoopsUser; $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; - $grouppermiscHandler = xoops_getHandler('groupperm'); + $grouppermHandler = xoops_getHandler('groupperm'); $myts = \MyTextSanitizer::getInstance(); $ret = []; @@ -81,7 +81,7 @@ public function grabEntries(&$obj) $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - if ($grouppermiscHandler->checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { + if ($grouppermHandler->checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { // required $ret[$i]['title'] = $row['title']; $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; diff --git a/include/oninstall.php b/include/oninstall.php index cc69e2fe..46182dca 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -67,13 +67,13 @@ function xoops_module_install_rssfit(\XoopsModule $module) global $xoopsModule; $moduleId = $xoopsModule->getVar('mid'); // $moduleId2 = $helper->getModule()->mid(); - $grouppermiscHandler = xoops_getHandler('groupperm'); + $grouppermHandler = xoops_getHandler('groupperm'); // access rights ------------------------------------------ - $grouppermiscHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); - $grouppermiscHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); - $grouppermiscHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); - $grouppermiscHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); - $grouppermiscHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); // --- CREATE FOLDERS --------------- if (count($configurator->uploadFolders) > 0) { diff --git a/include/onupdate.php b/include/onupdate.php index 420491e4..094ec82a 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -137,10 +137,10 @@ function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = nul $sql = 'DELETE FROM ' . $GLOBALS['xoopsDB']->prefix('tplfile') . " WHERE `tpl_module` = '" . $module->getVar('dirname', 'n') . '\' AND `tpl_file` LIKE \'%.html%\''; $GLOBALS['xoopsDB']->queryF($sql); - /** @var \XoopsGroupPermiscHandler $grouppermiscHandler */ - $grouppermiscHandler = xoops_getHandler('groupperm'); + /** @var \XoopsGroupPermHandler $grouppermHandler */ + $grouppermHandler = xoops_getHandler('groupperm'); - return $grouppermiscHandler->deleteByModule($module->getVar('mid'), 'item_read'); + return $grouppermHandler->deleteByModule($module->getVar('mid'), 'item_read'); } return true; From 26de0f8c0451f0df6727a03338e18d4ffedf5f67 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 14 Mar 2020 07:07:23 -0400 Subject: [PATCH 058/154] scrutinizer --- .scrutinizer.yml | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 .scrutinizer.yml diff --git a/.scrutinizer.yml b/.scrutinizer.yml new file mode 100644 index 00000000..59d0fa84 --- /dev/null +++ b/.scrutinizer.yml @@ -0,0 +1,20 @@ +# language: php +build: + nodes: + tests: true + analysis: + dependencies: + after: + # The following installs the most recent XOOPS CMS version, you might want + # to install a specific release tag or branch instead. + - git clone --depth=1 https://github.com/XOOPS/XoopsCore25 + - git clone --depth=1 https://github.com/mambax7/tag + project_setup: + override: true + tests: + override: + - php-scrutinizer-run --enable-security-analysis +filter: + dependency_paths: + - XoopsCore25/* + - tag/* From 8f666f037ef3f51f63046c2c5866167612b11422 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 14 Mar 2020 07:34:35 -0400 Subject: [PATCH 059/154] cleanup --- admin/do_channel.php | 10 +- admin/do_intro.php | 18 ++-- admin/do_plugins.php | 36 +++---- admin/do_sticky.php | 18 ++-- admin/do_subfeeds.php | 28 ++--- admin/index.php | 2 +- class/Common/Breadcrumb.php | 24 ++--- class/Common/Configurator.php | 38 ++++--- class/Common/FilesManagement.php | 41 ++++--- class/Common/ServerStats.php | 57 +++++----- class/Common/VersionChecks.php | 93 +++++++++++++--- class/Common/index.html | 2 +- class/FeedHandler.php | 177 ++----------------------------- class/PluginHandler.php | 10 +- class/RssMisc.php | 65 ------------ class/RssPlugin.php | 64 ----------- class/Utility.php | 2 +- class/common/Breadcrumb.php | 24 ++--- class/common/Configurator.php | 38 ++++--- class/common/FilesManagement.php | 41 ++++--- class/common/ServerStats.php | 57 +++++----- class/common/VersionChecks.php | 93 +++++++++++++--- class/common/index.html | 2 +- class/index.html | 2 +- include/config.php | 78 -------------- 25 files changed, 394 insertions(+), 626 deletions(-) delete mode 100644 class/RssMisc.php delete mode 100644 class/RssPlugin.php delete mode 100644 include/config.php diff --git a/admin/do_channel.php b/admin/do_channel.php index 8fcc838b..f70a66ae 100644 --- a/admin/do_channel.php +++ b/admin/do_channel.php @@ -28,13 +28,13 @@ $elements = $feedHandler->miscHandler->getObjects2(new \Criteria('misc_category', 'channel'), '*', 'title'); $img = $feedHandler->miscHandler->getObjects2(new \Criteria('misc_category', 'channelimg'), '*', 'title'); if (!empty($elements) && !empty($img)) { - $form = new \XoopsThemeForm(_AM_EDIT_CHANNEL, 'editchannel', RSSFIT_ADMIN_URL); - $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_REQUIRED . ' ' . Rssfit\Utility::genSpecMoreInfo('req', $feedHandler))); + $form = new \XoopsThemeForm(_AM_RSSFIT_EDIT_CHANNEL, 'editchannel', RSSFIT_ADMIN_URL); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_REQUIRED . ' ' . Rssfit\Utility::genSpecMoreInfo('req', $feedHandler))); $form->addElement(new \XoopsFormText('title', 'ele[' . $elements['title']->getVar('misc_id') . ']', 50, 255, $elements['title']->getVar('misc_content', 'e')), true); $form->addElement(new \XoopsFormText('link', 'ele[' . $elements['link']->getVar('misc_id') . ']', 50, 255, $elements['link']->getVar('misc_content', 'e')), true); $form->addElement(new \XoopsFormTextArea('description', 'ele[' . $elements['description']->getVar('misc_id') . ']', $elements['description']->getVar('misc_content', 'e')), true); - $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_OPTIONAL . ' ' . Rssfit\Utility::genSpecMoreInfo('opt', $feedHandler))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_OPTIONAL . ' ' . Rssfit\Utility::genSpecMoreInfo('opt', $feedHandler))); $form->addElement(new \XoopsFormText('copyright', 'ele[' . $elements['copyright']->getVar('misc_id') . ']', 50, 255, $elements['copyright']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('managingEditor', 'ele[' . $elements['managingEditor']->getVar('misc_id') . ']', 50, 255, $elements['managingEditor']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('webMaster', 'ele[' . $elements['webMaster']->getVar('misc_id') . ']', 50, 255, $elements['webMaster']->getVar('misc_content', 'e'))); @@ -42,7 +42,7 @@ $form->addElement(new \XoopsFormText('generator', 'ele[' . $elements['generator']->getVar('misc_id') . ']', 50, 255, $elements['generator']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('docs', 'ele[' . $elements['docs']->getVar('misc_id') . ']', 50, 255, $elements['docs']->getVar('misc_content', 'e'))); - $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_IMAGE . ' ' . Rssfit\Utility::genSpecMoreInfo('img', $feedHandler))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_IMAGE . ' ' . Rssfit\Utility::genSpecMoreInfo('img', $feedHandler))); $form->addElement(new \XoopsFormText('url', 'ele[' . $img['url']->getVar('misc_id') . ']', 50, 255, $img['url']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('link', 'ele[' . $img['link']->getVar('misc_id') . ']', 50, 255, $img['link']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('title', 'ele[' . $img['title']->getVar('misc_id') . ']', 50, 255, $img['title']->getVar('misc_content', 'e'))); @@ -52,7 +52,7 @@ $form->addElement(new \XoopsFormHidden('op', 'save')); $form->display(); } else { - echo '

      ' . _AM_DB_RECORD_MISSING . '

      '; + echo '

      ' . _AM_RSSFIT_DB_RECORD_MISSING . '

      '; } break; case 'save': diff --git a/admin/do_intro.php b/admin/do_intro.php index ab622e1a..1556dfa3 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -31,24 +31,24 @@ } switch ($op) { default: - $title = new \XoopsFormText(_AM_EDIT_INTRO_TITLE, 'title', 50, 255, $intro->getVar('misc_title', 'e')); - $title->setDescription(_AM_EDIT_INTRO_TITLE_DESC); + $title = new \XoopsFormText(_AM_RSSFIT_EDIT_INTRO_TITLE, 'title', 50, 255, $intro->getVar('misc_title', 'e')); + $title->setDescription(_AM_RSSFIT_EDIT_INTRO_TITLE_DESC); $setting = $intro->getVar('misc_setting'); - $tray_content = new \XoopsFormElementTray(_AM_EDIT_INTRO_TEXT, '
      '); - $tray_content->setDescription(_AM_EDIT_INTRO_TEXT_DESC . _AM_EDIT_INTRO_TEXT_DESC_SUB); + $tray_content = new \XoopsFormElementTray(_AM_RSSFIT_EDIT_INTRO_TEXT, '
      '); + $tray_content->setDescription(_AM_RSSFIT_EDIT_INTRO_TEXT_DESC . _AM_RSSFIT_EDIT_INTRO_TEXT_DESC_SUB); $tray_content->addElement(new \XoopsFormDhtmlTextArea('', 'content', $intro->getVar('misc_content', 'e'), 15, 60)); $dohtml = new \XoopsFormCheckbox('', 'dohtml', $setting['dohtml']); - $dohtml->addOption(1, _AM_DO_HTML); + $dohtml->addOption(1, _AM_RSSFIT_DO_HTML); $tray_content->addElement($dohtml); $dobr = new \XoopsFormCheckbox('', 'dobr', $setting['dobr']); - $dobr->addOption(1, _AM_DO_BR); + $dobr->addOption(1, _AM_RSSFIT_DO_BR); $tray_content->addElement($dobr); - $sub = new \XoopsFormTextArea(_AM_EDIT_INTRO_SUB, 'sub', $myts->htmlSpecialChars($myts->stripSlashesGPC($setting['sub']))); - $sub->setDescription(_AM_EDIT_INTRO_SUB_DESC); + $sub = new \XoopsFormTextArea(_AM_RSSFIT_EDIT_INTRO_SUB, 'sub', $myts->htmlSpecialChars($myts->stripSlashesGPC($setting['sub']))); + $sub->setDescription(_AM_RSSFIT_EDIT_INTRO_SUB_DESC); - $form = new \XoopsThemeForm(_AM_EDIT_INTRO, 'editintro', RSSFIT_ADMIN_URL); + $form = new \XoopsThemeForm(_AM_RSSFIT_EDIT_INTRO, 'editintro', RSSFIT_ADMIN_URL); $form->addElement($title); $form->addElement($tray_content); $form->addElement($sub); diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 792efae0..bd745b96 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -34,19 +34,19 @@ if ($plugins) { $ret .= "\n" . "\n" . "\n\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "\n" . "\n"; foreach ($plugins as $p) { @@ -100,7 +100,7 @@ . _AM_RSSFIT_PLUGIN_MODNAME . "\n" . "\n" . "\n"; foreach ($plugins as $p) { diff --git a/header.php b/header.php index df3e3823..9b348628 100644 --- a/header.php +++ b/header.php @@ -16,5 +16,5 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ -require_once dirname(dirname(__DIR__)) . '/mainfile.php'; -require_once __DIR__ . '/include/common.php'; +require dirname(dirname(__DIR__)) . '/mainfile.php'; +require __DIR__ . '/include/common.php'; diff --git a/index.php b/index.php index c1b641fe..4d7ed01e 100644 --- a/index.php +++ b/index.php @@ -16,7 +16,7 @@ * @author NS Tai (aka tuff) * @author XOOPS Development Team */ -require_once __DIR__ . '/header.php'; +require __DIR__ . '/header.php'; $GLOBALS['xoopsOption']['template_main'] = 'rssfit_index.tpl'; require_once XOOPS_ROOT_PATH . '/header.php'; $intr = $miscHandler->getObjects2(new \Criteria('misc_category', 'intro')); @@ -43,4 +43,4 @@ } $xoopsTpl->assign('intro', ['title' => $title, 'content' => $content]); } -require_once XOOPS_ROOT_PATH . '/footer.php'; +require XOOPS_ROOT_PATH . '/footer.php'; diff --git a/language/english/modinfo.php b/language/english/modinfo.php index ddaf6b65..9d9548c5 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -17,32 +17,32 @@ define('_MI_RSSFIT_ABOUT', 'About'); // Module Configs -define('_MI_OVERALL_ENTRIES', 'Total entries to show'); -define('_MI_OVERALL_ENTRIES_DESC', 'Number of entries to show in the RSS feed'); -define('_MI_PLUGIN_ENTRIES', 'Default entry number for plug-ins'); -define('_MI_PLUGIN_ENTRIES_DESC', 'Default number of entries to grab by each plug-in when installed'); -define('_MI_ENTRIES_SORT', 'Entries sort by'); -define('_MI_ENTRIES_SORT_DESC', 'Entries sort order for the RSS feed output'); -define('_MI_ENTRIES_SORT_DATE', 'Date'); -define('_MI_ENTRIES_SORT_CAT', 'Category'); -define('_MI_CACHE', 'Cache lifetime (minutes)'); -define('_MI_CACHE_DESC', 'This option will also be used for the Time-to-Live (TTL) channel element of the RSS output.'); -define('_MI_MAXCHAR', 'Maximum characters of item descriptions'); -define('_MI_MAXCHAR_DESC', '0 = show entire content'); -define('_MI_STRIPHTML', 'Strip html tags'); -define('_MI_STRIPHTML_DESC', 'Remove html tags from item description elements, including Xoopscodes and Smileys'); -define('_MI_ENCODE_UTF8', 'Encode contents to UTF-8'); -define('_MI_ENCODE_UTF8_DESC', 'Note: probably not functional and recommended to turn off.'); +define('_MI_RSSFIT_OVERALL_ENTRIES', 'Total entries to show'); +define('_MI_RSSFIT_OVERALL_ENTRIES_DESC', 'Number of entries to show in the RSS feed'); +define('_MI_RSSFIT_PLUGIN_ENTRIES', 'Default entry number for plug-ins'); +define('_MI_RSSFIT_PLUGIN_ENTRIES_DESC', 'Default number of entries to grab by each plug-in when installed'); +define('_MI_RSSFIT_ENTRIES_SORT', 'Entries sort by'); +define('_MI_RSSFIT_ENTRIES_SORT_DESC', 'Entries sort order for the RSS feed output'); +define('_MI_RSSFIT_ENTRIES_SORT_DATE', 'Date'); +define('_MI_RSSFIT_ENTRIES_SORT_CAT', 'Category'); +define('_MI_RSSFIT_CACHE', 'Cache lifetime (minutes)'); +define('_MI_RSSFIT_CACHE_DESC', 'This option will also be used for the Time-to-Live (TTL) channel element of the RSS output.'); +define('_MI_RSSFIT_MAXCHAR', 'Maximum characters of item descriptions'); +define('_MI_RSSFIT_MAXCHAR_DESC', '0 = show entire content'); +define('_MI_RSSFIT_STRIPHTML', 'Strip html tags'); +define('_MI_RSSFIT_STRIPHTML_DESC', 'Remove html tags from item description elements, including Xoopscodes and Smileys'); +define('_MI_RSSFIT_ENCODE_UTF8', 'Encode contents to UTF-8'); +define('_MI_RSSFIT_ENCODE_UTF8_DESC', 'Note: probably not functional and recommended to turn off.'); // template explanations -define('_MI_TMPL_INTRO', 'Introduction in module home page'); -define('_MI_TMPL_RSS', 'RSS feed data'); +define('_MI_RSSFIT_TMPL_INTRO', 'Introduction in module home page'); +define('_MI_RSSFIT_TMPL_RSS', 'RSS feed data'); ######### version 1.1 additions ######### -define('_MI_OUTOUT_MIME', 'MIME type of RSS output'); -define('_MI_OUTOUT_MIME_XML', 'XML (text/xml)'); -define('_MI_OUTOUT_MIME_HTML', 'HTML (text/html)'); -define('_MI_OUTOUT_MIME_PHP', 'HTML with php-debug'); +define('_MI_RSSFIT_OUTOUT_MIME', 'MIME type of RSS output'); +define('_MI_RSSFIT_OUTOUT_MIME_XML', 'XML (text/xml)'); +define('_MI_RSSFIT_OUTOUT_MIME_HTML', 'HTML (text/html)'); +define('_MI_RSSFIT_OUTOUT_MIME_PHP', 'HTML with php-debug'); //1.30 //Help diff --git a/rss.php b/rss.php index 5f2e8a16..a538f9c5 100644 --- a/rss.php +++ b/rss.php @@ -21,7 +21,7 @@ if (function_exists('mb_http_output')) { mb_http_output('pass'); } -require_once __DIR__ . '/header.php'; +require __DIR__ . '/header.php'; $helper = Rssfit\Helper::getInstance(); $charset = $helper->getConfig('utf8') ? 'UTF-8' : _CHARSET; diff --git a/xoops_version.php b/xoops_version.php index 833349c7..e98bb3d2 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -108,11 +108,11 @@ $modversion['templates'] = []; $modversion['templates'][] = [ 'file' => 'rssfit_index.tpl', - 'description' => _MI_TMPL_INTRO, + 'description' => _MI_RSSFIT_TMPL_INTRO, ]; $modversion['templates'][] = [ 'file' => 'rssfit_rss.tpl', - 'description' => _MI_TMPL_RSS, + 'description' => _MI_RSSFIT_TMPL_RSS, ]; // Module Configs @@ -120,8 +120,8 @@ $modversion['config'][] = [ 'name' => 'overall_entries', - 'title' => '_MI_OVERALL_ENTRIES', - 'description' => '_MI_OVERALL_ENTRIES_DESC', + 'title' => '_MI_RSSFIT_OVERALL_ENTRIES', + 'description' => '_MI_RSSFIT_OVERALL_ENTRIES_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 20, @@ -130,8 +130,8 @@ // $helper->getConfig('plugin_entries') $modversion['config'][] = [ 'name' => 'plugin_entries', - 'title' => '_MI_PLUGIN_ENTRIES', - 'description' => '_MI_PLUGIN_ENTRIES_DESC', + 'title' => '_MI_RSSFIT_PLUGIN_ENTRIES', + 'description' => '_MI_RSSFIT_PLUGIN_ENTRIES_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 5, @@ -140,19 +140,19 @@ // $helper->getConfig('sort') $modversion['config'][] = [ 'name' => 'sort', - 'title' => '_MI_ENTRIES_SORT', - 'description' => '_MI_ENTRIES_SORT_DESC', + 'title' => '_MI_RSSFIT_ENTRIES_SORT', + 'description' => '_MI_RSSFIT_ENTRIES_SORT_DESC', 'formtype' => 'select', 'valuetype' => 'text', 'default' => 'd', - 'options' => [_MI_ENTRIES_SORT_DATE => 'd', _MI_ENTRIES_SORT_CAT => 'c'], + 'options' => [_MI_RSSFIT_ENTRIES_SORT_DATE => 'd', _MI_RSSFIT_ENTRIES_SORT_CAT => 'c'], ]; // $helper->getConfig('cache') $modversion['config'][] = [ 'name' => 'cache', - 'title' => '_MI_CACHE', - 'description' => '_MI_CACHE_DESC', + 'title' => '_MI_RSSFIT_CACHE', + 'description' => '_MI_RSSFIT_CACHE_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 0, @@ -161,8 +161,8 @@ // $helper->getConfig('max_char') $modversion['config'][] = [ 'name' => 'max_char', - 'title' => '_MI_MAXCHAR', - 'description' => '_MI_MAXCHAR_DESC', + 'title' => '_MI_RSSFIT_MAXCHAR', + 'description' => '_MI_RSSFIT_MAXCHAR_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', 'default' => 0, @@ -171,8 +171,8 @@ // $helper->getConfig('strip_html') $modversion['config'][] = [ 'name' => 'strip_html', - 'title' => '_MI_STRIPHTML', - 'description' => '_MI_STRIPHTML_DESC', + 'title' => '_MI_RSSFIT_STRIPHTML', + 'description' => '_MI_RSSFIT_STRIPHTML_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, @@ -181,8 +181,8 @@ // $helper->getConfig('utf8') $modversion['config'][] = [ 'name' => 'utf8', - 'title' => '_MI_ENCODE_UTF8', - 'description' => '_MI_ENCODE_UTF8_DESC', + 'title' => '_MI_RSSFIT_ENCODE_UTF8', + 'description' => '_MI_RSSFIT_ENCODE_UTF8_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', 'default' => 0, @@ -191,12 +191,12 @@ // $helper->getConfig('mime') $modversion['config'][] = [ 'name' => 'mime', - 'title' => '_MI_OUTOUT_MIME', + 'title' => '_MI_RSSFIT_OUTOUT_MIME', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, - 'options' => [_MI_OUTOUT_MIME_XML => 1, _MI_OUTOUT_MIME_HTML => 2, _MI_OUTOUT_MIME_PHP => 3], + 'options' => [_MI_RSSFIT_OUTOUT_MIME_XML => 1, _MI_RSSFIT_OUTOUT_MIME_HTML => 2, _MI_RSSFIT_OUTOUT_MIME_PHP => 3], ]; /** From 282bbccdf098af1ca3f0638f12397cb75f1d60da Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 14 Mar 2020 08:21:24 -0400 Subject: [PATCH 061/154] cosmetics --- class/Common/SysUtility.php | 1 - class/FeedHandler.php | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index f0fd15c3..ddc02cb2 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -142,7 +142,6 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac */ public static function getEditor($helper = null, $options = null) { - /** @var Helper $helper */ if (null === $options) { $options = []; $options['name'] = 'Editor'; diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 53e279c1..ad401edc 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -298,7 +298,7 @@ public function substrDetect($text, $start, $len) public function strrposDetect($text, $find) { if (function_exists('mb_strrpos')) { - return mb_strrpos($text, $find, _CHARSET); + return mb_strrpos($text, $find, 0, _CHARSET); } return mb_strrpos($text, $find); From c0283a9f2deffde3d3149dc8fc43fda47f9d5ce8 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 14 Mar 2020 09:22:04 -0400 Subject: [PATCH 062/154] cosmetics --- admin/do_plugins.php | 36 +++++++++++----------- admin/do_subfeeds.php | 26 ++++++++-------- class/FeedHandler.php | 6 ++-- class/MiscHandler.php | 14 ++++----- class/PluginHandler.php | 16 +++++----- class/Plugins/00/Comments.php | 2 +- class/Plugins/Adslight.php | 2 +- class/Plugins/Ams.php | 5 +-- class/Plugins/Apcal.php | 2 +- class/Plugins/Buyersguide.php | 2 +- class/Plugins/Buyersguidemanufacturers.php | 2 +- class/Plugins/Buyersguidenews.php | 2 +- class/Plugins/Cbb.php | 2 +- class/Plugins/Extcal.php | 2 +- class/Plugins/Lexikon.php | 2 +- class/Plugins/Myalbum.php | 2 +- class/Plugins/Mydownloads.php | 2 +- class/Plugins/Mylinks.php | 2 +- class/Plugins/Mytube.php | 2 +- class/Plugins/Newbb.php | 2 +- class/Plugins/Newbb2.php | 2 +- class/Plugins/News.php | 2 +- class/Plugins/Oledrion.php | 4 +-- class/Plugins/Pical.php | 2 +- class/Plugins/Publisher.php | 2 +- class/Plugins/Queries.php | 2 +- class/Plugins/Rmdp.php | 2 +- class/Plugins/Sample.php | 2 +- class/Plugins/Smartfaq.php | 2 +- class/Plugins/Smartpartner.php | 2 +- class/Plugins/Smartsection.php | 2 +- class/Plugins/Special.php | 2 +- class/Plugins/Surnames.php | 2 +- class/Plugins/Weblinks.php | 2 +- class/Plugins/Wfdownloads.php | 2 +- class/Plugins/Wfdownloads_podcast.php | 2 +- class/Plugins/Wflinks.php | 2 +- class/Plugins/Wfsection.php | 2 +- class/Plugins/Wfsection2.php | 2 +- class/Plugins/Xoopstube.php | 2 +- include/common.php | 4 +-- include/common0.php | 2 +- index.php | 2 +- templates/rssfit_rss.tpl | 6 ++-- 44 files changed, 93 insertions(+), 94 deletions(-) diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 85078511..ed5b0fda 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -30,7 +30,7 @@ $ret = ''; // activated plugins $criteria = new \Criteria('rssf_activated', 1); - $plugins = $pluginsHandler->getObjects2($criteria, 'p_activated'); + $plugins = $pluginHandler->getObjects2($criteria, 'p_activated'); if ($plugins) { $ret .= "
      " - . _AM_PLUGIN_ACTIVATED + . _AM_RSSFIT_PLUGIN_ACTIVATED . "
      " - . _AM_PLUGIN_FILENAME + . _AM_RSSFIT_PLUGIN_FILENAME . "" - . _AM_PLUGIN_MODNAME + . _AM_RSSFIT_PLUGIN_MODNAME . "" - . _AM_PLUGIN_SHOWXENTRIES + . _AM_RSSFIT_PLUGIN_SHOWXENTRIES . "" - . _AM_PLUGIN_ORDER + . _AM_RSSFIT_PLUGIN_ORDER . "" . _AM_ACTION @@ -60,8 +60,8 @@ $order = new \XoopsFormText('', 'rssf_order[' . $id . ']', 3, 2, $p->getVar('rssf_order')); $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); $action->addOption('', _SELECT); - $action->addOption('d', _AM_PLUGIN_DEACTIVATE); - $action->addOption('u', _AM_PLUGIN_UNINSTALL); + $action->addOption('d', _AM_RSSFIT_PLUGIN_DEACTIVATE); + $action->addOption('u', _AM_RSSFIT_PLUGIN_UNINSTALL); $ret .= "
      " . $p->getVar('rssf_filename') @@ -91,13 +91,13 @@ if ($plugins) { $ret .= "
      \n\n" . "\n" . "\n\n" . "\n" . "\n"; - $action->addOption('u', _AM_PLUGIN_UNINSTALL); + $action->addOption('u', _AM_RSSFIT_PLUGIN_UNINSTALL); $ret .= "\n"; } $ret .= "
      " - . _AM_PLUGIN_INACTIVE + . _AM_RSSFIT_PLUGIN_INACTIVE . "
      " - . _AM_PLUGIN_FILENAME + . _AM_RSSFIT_PLUGIN_FILENAME . "" - . _AM_PLUGIN_MODNAME + . _AM_RSSFIT_PLUGIN_MODNAME . "" . _AM_ACTION @@ -111,17 +111,17 @@ $handler = $pluginsHandler->checkPlugin($p); if ($handler) { $ret .= $handler->modname; - $action->addOption('a', _AM_PLUGIN_ACTIVATE); + $action->addOption('a', _AM_RSSFIT_PLUGIN_ACTIVATE); } elseif (count($p->getErrors()) > 0) { $ret .= '' . _ERRORS . "\n"; foreach ($p->getErrors() as $e) { $ret .= '
      ' . $e; } } else { - $ret .= '' . _AM_PLUGIN_UNKNOWNERROR . ''; + $ret .= '' . _AM_RSSFIT_PLUGIN_UNKNOWNERROR . ''; } $ret .= "
      " . $action->render() . "
      \n"; @@ -147,16 +147,16 @@ if (count($installable) > 0) { $ret .= "
      \n\n" . "\n" . "\n\n" . "\n" . "\n" . "\n"; foreach ($installable as $i) { @@ -175,7 +175,7 @@ $ret .= '
      ' . $e; } } else { - $ret .= '' . _AM_PLUGIN_UNKNOWNERROR . ''; + $ret .= '' . _AM_RSSFIT_PLUGIN_UNKNOWNERROR . ''; } $action->setExtra('disabled="disabled"'); } diff --git a/admin/do_sticky.php b/admin/do_sticky.php index 23567c80..9074d39a 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -32,25 +32,25 @@ switch ($op) { default: $setting = $sticky->getVar('misc_setting'); - $title = new \XoopsFormText(_AM_STICKY_TITLE, 'title', 50, 255, $sticky->getVar('misc_title', 'e')); - $title->setDescription(_AM_EDIT_INTRO_TITLE_DESC); + $title = new \XoopsFormText(_AM_RSSFIT_STICKY_TITLE, 'title', 50, 255, $sticky->getVar('misc_title', 'e')); + $title->setDescription(_AM_RSSFIT_EDIT_INTRO_TITLE_DESC); - $tray_content = new \XoopsFormElementTray(_AM_STICKY_CONTENT, '
      '); - $tray_content->setDescription(_AM_EDIT_INTRO_TEXT_DESC); + $tray_content = new \XoopsFormElementTray(_AM_RSSFIT_STICKY_CONTENT, '
      '); + $tray_content->setDescription(_AM_RSSFIT_EDIT_INTRO_TEXT_DESC); $content = new \XoopsFormTextArea('', 'content', $sticky->getVar('misc_content', 'e'), 10); $tray_content->addElement($content); $dohtml = new \XoopsFormCheckbox('', 'dohtml', $setting['dohtml']); - $dohtml->addOption(1, _AM_DO_HTML); + $dohtml->addOption(1, _AM_RSSFIT_DO_HTML); $tray_content->addElement($dohtml); $dobr = new \XoopsFormCheckbox('', 'dobr', $setting['dobr']); - $dobr->addOption(1, _AM_DO_BR); + $dobr->addOption(1, _AM_RSSFIT_DO_BR); $tray_content->addElement($dobr); - $link = new \XoopsFormText(_AM_STICKY_LINK, 'link', 50, 255, $myts->htmlSpecialChars($myts->stripSlashesGPC($setting['link']))); + $link = new \XoopsFormText(_AM_RSSFIT_STICKY_LINK, 'link', 50, 255, $myts->htmlSpecialChars($myts->stripSlashesGPC($setting['link']))); - $applyto = $feedHandler->feedSelectBox(_AM_STICKY_APPLYTO, $setting['feeds'], 10); + $applyto = $feedHandler->feedSelectBox(_AM_RSSFIT_STICKY_APPLYTO, $setting['feeds'], 10); - $form = new \XoopsThemeForm(_AM_STICKY_EDIT, 'editsticky', RSSFIT_ADMIN_URL); + $form = new \XoopsThemeForm(_AM_RSSFIT_STICKY_EDIT, 'editsticky', RSSFIT_ADMIN_URL); $form->addElement($title); $form->addElement($tray_content); $form->addElement($link); diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index e32f7919..b5618b9e 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -30,16 +30,16 @@ if ($plugins) { $ret .= "
      \n
      " - . _AM_PLUGIN_NONINSTALLED + . _AM_RSSFIT_PLUGIN_NONINSTALLED . "
      " - . _AM_PLUGIN_FILENAME + . _AM_RSSFIT_PLUGIN_FILENAME . "" - . _AM_PLUGIN_MODNAME + . _AM_RSSFIT_PLUGIN_MODNAME . "" - . _AM_PLUGIN_INSTALL + . _AM_RSSFIT_PLUGIN_INSTALL . "
      \n" . "\n" . "\n\n" . "\n" . "\n" . "\n" . "\n"; @@ -55,7 +55,7 @@ } else { $mod = $handler->modname; $activate = new \XoopsFormCheckbox('', 'activate[' . $id . ']', $p->getVar('subfeed')); - $config = Rssfit\Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_SUB_CONFIGURE); + $config = Rssfit\Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_RSSFIT_SUB_CONFIGURE); $urlLink = '' . $feedHandler->subFeedUrl($p->getVar('rssf_filename')) . ''; } $activate->addOption(1, ' '); @@ -91,7 +91,7 @@ . "\n
      " - . _AM_SUB_LIST + . _AM_RSSFIT_SUB_LIST . "
      " - . _AM_SUB_FILENAME_URL + . _AM_RSSFIT_SUB_FILENAME_URL . "" - . _AM_PLUGIN_MODNAME + . _AM_RSSFIT_PLUGIN_MODNAME . "" - . _AM_SUB_ACTIVATE + . _AM_RSSFIT_SUB_ACTIVATE . " 
      "; echo $ret; } else { - echo '

      ' . _AM_PLUGIN_NONE . '

      '; + echo '

      ' . _AM_RSSFIT_PLUGIN_NONE . '

      '; } break; case 'save': @@ -107,7 +107,7 @@ } redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); } else { - redirect_header(RSSFIT_ADMIN_URL, 0, _AM_PLUGIN_NONE); + redirect_header(RSSFIT_ADMIN_URL, 0, _AM_RSSFIT_PLUGIN_NONE); } break; case 'edit': @@ -119,18 +119,18 @@ } } if (empty($id) || !$sub) { - redirect_header(RSSFIT_ADMIN_URL, 0, _AM_SUB_PLUGIN_NONE); + redirect_header(RSSFIT_ADMIN_URL, 0, _AM_RSSFIT_SUB_PLUGIN_NONE); } - $form = new \XoopsThemeForm(sprintf(_AM_SUB_EDIT, $handler->modname), 'editsub', RSSFIT_ADMIN_URL); - $form->addElement(new \XoopsFormRadioYN(_AM_SUB_ACTIVATE, 'subfeed', $sub->getVar('subfeed'))); - $form->addElement(new \XoopsFormText(_AM_PLUGIN_SHOWXENTRIES, 'sub_entries', 3, 2, $sub->getVar('sub_entries')), true); + $form = new \XoopsThemeForm(sprintf(_AM_RSSFIT_SUB_EDIT, $handler->modname), 'editsub', RSSFIT_ADMIN_URL); + $form->addElement(new \XoopsFormRadioYN(_AM_RSSFIT_SUB_ACTIVATE, 'subfeed', $sub->getVar('subfeed'))); + $form->addElement(new \XoopsFormText(_AM_RSSFIT_PLUGIN_SHOWXENTRIES, 'sub_entries', 3, 2, $sub->getVar('sub_entries')), true); - $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_REQUIRED . ' ' . Rssfit\Utility::genSpecMoreInfo('req', $feedHandler))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_REQUIRED . ' ' . Rssfit\Utility::genSpecMoreInfo('req', $feedHandler))); $form->addElement(new \XoopsFormText('title', 'sub_title', 50, 255, $sub->getVar('sub_title', 'e')), true); $form->addElement(new \XoopsFormText('link', 'sub_link', 50, 255, $sub->getVar('sub_link', 'e')), true); $form->addElement(new \XoopsFormTextArea('description', 'sub_desc', $sub->getVar('sub_desc', 'e')), true); - $form->addElement(new \XoopsFormLabel('', '' . _AM_EDIT_CHANNEL_IMAGE . ' ' . Rssfit\Utility::genSpecMoreInfo('img', $feedHandler))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_IMAGE . ' ' . Rssfit\Utility::genSpecMoreInfo('img', $feedHandler))); $form->addElement(new \XoopsFormText('url', 'img_url', 50, 255, $sub->getVar('img_url', 'e'))); $form->addElement(new \XoopsFormText('link', 'img_link', 50, 255, $sub->getVar('img_link', 'e'))); $form->addElement(new \XoopsFormText('title', 'img_title', 50, 255, $sub->getVar('img_title', 'e'))); @@ -150,7 +150,7 @@ } } if (empty($id) || !$sub || !$handler) { - redirect_header(RSSFIT_ADMIN_URL, 0, _AM_SUB_PLUGIN_NONE); + redirect_header(RSSFIT_ADMIN_URL, 0, _AM_RSSFIT_SUB_PLUGIN_NONE); } $subfeed = Request::getBool('subfeed', false, 'POST'); diff --git a/admin/index.php b/admin/index.php index bd292a16..77813275 100644 --- a/admin/index.php +++ b/admin/index.php @@ -32,7 +32,7 @@ if (file_exists(RSSFIT_ROOT_PATH . 'admin/do_' . $do . '.php')) { require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; $hidden_do = new \XoopsFormHidden('do', $do); - $button_save = new \XoopsFormButton('', 'submit', _AM_SAVE, 'submit'); + $button_save = new \XoopsFormButton('', 'submit', _AM_RSSFIT_SAVE, 'submit'); $button_go = new \XoopsFormButton('', 'submit', _GO, 'submit'); $button_cancel = new \XoopsFormButton('', 'cancel', _CANCEL); $button_cancel->setExtra('onclick="javascript:history.go(-1)"'); diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index 017b1d43..c7621a8d 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -1,4 +1,6 @@ - - * @package rss + * @package rssfit * * Example: - * $breadcrumb = new Breadcrumb(); + * $breadcrumb = new PedigreeBreadcrumb(); * $breadcrumb->addLink( 'bread 1', 'index1.php' ); * $breadcrumb->addLink( 'bread 2', '' ); * $breadcrumb->addLink( 'bread 3', 'index3.php' ); * echo $breadcrumb->render(); */ -defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined'); +defined('XOOPS_ROOT_PATH') || die('XOOPS Root Path not defined'); /** - * Class PedigreeBreadcrumb + * Class Breadcrumb */ class Breadcrumb { public $dirname; private $bread = []; - /** - * - */ public function __construct() { - $this->dirname = basename(dirname(__DIR__)); + $this->dirname = basename(dirname(dirname(__DIR__))); } /** @@ -51,14 +50,13 @@ public function __construct() public function addLink($title = '', $link = '') { $this->bread[] = [ - 'link' => $link, - 'title' => $title + 'link' => $link, + 'title' => $title, ]; } /** * Render Pedigree BreadCrumb - * */ public function render() { diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index f65d36be..2031f5a4 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -1,4 +1,6 @@ -name = $config->name; - $this->paths = $config->paths; - $this->uploadFolders = $config->uploadFolders; - $this->copyBlankFiles = $config->copyBlankFiles; + $this->name = $config->name; + $this->paths = $config->paths; + $this->uploadFolders = $config->uploadFolders; + $this->copyBlankFiles = $config->copyBlankFiles; $this->copyTestFolders = $config->copyTestFolders; $this->templateFolders = $config->templateFolders; - $this->oldFiles = $config->oldFiles; - $this->oldFolders = $config->oldFolders; - $this->modCopyright = $config->modCopyright; + $this->oldFiles = $config->oldFiles; + $this->oldFolders = $config->oldFolders; + $this->renameTables = $config->renameTables; + $this->modCopyright = $config->modCopyright; } } diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index 21a77b6f..2d7d84f1 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -1,4 +1,6 @@ -getRealPath())) { break; } - } else { - // delete the file - if (!($success = unlink($fileInfo->getRealPath()))) { + } elseif (!($success = unlink($fileInfo->getRealPath()))) { break; } } - } + // now delete this (sub)directory if all the files are gone if ($success) { $success = rmdir($dirInfo->getRealPath()); @@ -117,11 +115,11 @@ public static function deleteDirectory($src) // input is not a valid directory $success = false; } + return $success; } /** - * * Recursively remove directory * * @todo currently won't remove directories with hidden files, should it? @@ -149,7 +147,7 @@ public static function rrmdir($src) foreach ($iterator as $fObj) { if ($fObj->isFile()) { $filename = $fObj->getPathname(); - $fObj = null; // clear this iterator object to close the file + $fObj = null; // clear this iterator object to close the file if (!unlink($filename)) { return false; // couldn't delete the file } @@ -183,7 +181,7 @@ public static function rmove($src, $dest) } // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest, 0755)) { + if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { return false; } @@ -226,7 +224,7 @@ public static function rcopy($src, $dest) } // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest, 0755)) { + if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { return false; } @@ -239,6 +237,7 @@ public static function rcopy($src, $dest) self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); } } + return true; } } diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index a1c3d8a7..488ccf31 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -1,4 +1,6 @@ -query($sql); // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); - $html .= '
      '; - $html .= "" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . ''; - $html .= "
      "; - // $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
      "; - // $html .= "
      "; - // $html .= "
      "; - $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '
      '; - $html .= '
        '; + $html .= "
        " . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "\n"; + $html .= "
        \n"; + // $html .= '
        ' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
        \n"; + // $html .= "
        \n"; + // $html .= "
        \n"; + $html .= '
        ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "
        \n"; + $html .= "
          \n"; - $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; - $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; + $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; + $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; if (function_exists('gd_info')) { - if ($gdlib = true === gd_info()) { + if (true === ($gdlib = gd_info())) { $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; } } - + // // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); // $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; - + // // $registerglobals = (!ini_get('register_globals')) ? "" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . constant('CO_' . $moduleDirNameUpper . '_ON') . ''; // $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; + // + $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; + $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; - $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - - $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . ''; - $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . ''; - $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . ''; - $html .= '
        '; - $html .= '
          '; - $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . ''; - $html .= '
        '; - $html .= '
        '; - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ''; + $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . "\n"; + $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . "\n"; + $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . "\n"; + $html .= "
      \n"; + $html .= "
        \n"; + $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . "\n"; + $html .= "
      \n"; + $html .= "
      \n"; + $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; $html .= '
      '; $html .= '

      '; diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 023fdef4..7881e904 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -1,4 +1,6 @@ -getInfo('min_xoops'); //making sure it's a string } @@ -51,22 +53,28 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = } /** - * * Verifies PHP version meets minimum requirements for this module * @static - * @param \XoopsModule $module * + * @param \XoopsModule|null $module * @return bool true if meets requirements, false if not */ - public static function checkVerPhp(\XoopsModule $module) + public static function checkVerPhp(\XoopsModule $module = null) { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = strtoupper($moduleDirName); - xoops_loadLanguage('admin', $module->dirname()); + $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + if (null === $module) { + $module = \XoopsModule::getByDirname($moduleDirName); + } + xoops_loadLanguage('admin', $moduleDirName); + xoops_loadLanguage('common', $moduleDirName); + // check for minimum PHP version $success = true; - $verNum = PHP_VERSION; - $reqVer = $module->getInfo('min_php'); + + $verNum = PHP_VERSION; + $reqVer = &$module->getInfo('min_php'); + if (false !== $reqVer && '' !== $reqVer) { if (version_compare($verNum, $reqVer, '<')) { $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); @@ -76,4 +84,65 @@ public static function checkVerPhp(\XoopsModule $module) return $success; } + + /** + * compares current module version with latest GitHub release + * @static + * @param \Xmf\Module\Helper $helper + * @param string|null $source + * @param string|null $default + * + * @return string|array info about the latest module version, if newer + */ + public static function checkVerModule($helper, $source = 'github', $default = 'master') + { + $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $update = ''; + $repository = 'XoopsModules25x/' . $moduleDirName; + // $repository = 'XoopsModules25x/publisher'; //for testing only + $ret = ''; + $infoReleasesUrl = "https://api.github.com/repos/$repository/releases"; + if ('github' === $source) { + if (function_exists('curl_init') && false !== ($curlHandle = curl_init())) { + curl_setopt($curlHandle, CURLOPT_URL, $infoReleasesUrl); + curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($curlHandle, CURLOPT_HTTPHEADER, ["User-Agent:Publisher\r\n"]); + $curlReturn = curl_exec($curlHandle); + if (false === $curlReturn) { + trigger_error(curl_error($curlHandle)); + } elseif (false !== mb_strpos($curlReturn, 'Not Found')) { + trigger_error('Repository Not Found: ' . $infoReleasesUrl); + } else { + $file = json_decode($curlReturn, false); + $latestVersionLink = sprintf("https://github.com/$repository/archive/%s.zip", $file ? reset($file)->tag_name : $default); + $latestVersion = $file[0]->tag_name; + $prerelease = $file[0]->prerelease; + if ('master' !== $latestVersionLink) { + $update = constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; + } + //"PHP-standardized" version + $latestVersion = mb_strtolower($latestVersion); + if (false !== mb_strpos($latestVersion, 'final')) { + $latestVersion = str_replace('_', '', mb_strtolower($latestVersion)); + $latestVersion = str_replace('final', '', mb_strtolower($latestVersion)); + } + $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); + //"PHP-standardized" version + $moduleVersion = str_replace(' ', '', mb_strtolower($moduleVersion)); + // $moduleVersion = '1.0'; //for testing only + // $moduleDirName = 'publisher'; //for testing only + if (!$prerelease && version_compare($moduleVersion, $latestVersion, '<')) { + $ret = []; + $ret[] = $update; + $ret[] = $latestVersionLink; + } + } + curl_close($curlHandle); + } + } + + return $ret; + } } diff --git a/class/Common/index.html b/class/Common/index.html index 2c5cdd3f..990cbd60 100644 --- a/class/Common/index.html +++ b/class/Common/index.html @@ -1 +1 @@ - + \ No newline at end of file diff --git a/class/FeedHandler.php b/class/FeedHandler.php index b51a47bd..53e279c1 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -1,4 +1,3 @@ -<<<<<<< HEAD:class/FeedHandler.php ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### - -use Xoopsmodules\rssfit; - -defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); - -/** - * Class RssfeedHandler - * @package Xoopsmodules\rssfit - */ -class RssfeedHandler ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php { public $rssmod; public $pluginHandler; public $miscHandler; public $channelreq; public $subHandler; - public $pluginObj; + public $plugin_obj; public $myts; public $modConfig; public $xoopsConfig; - public $cached = ''; - public $charset = _CHARSET; - public $feedkey = 'feed'; - public $plugin_file = 'rssfit.%s.php'; - public $substr_remove = [',', '/', ';', ':', '(', '{', '[', ' ']; - public $substr_add = ['.', '!', '?', '}', ']', ')', '%']; + public $cached = ''; + public $charset = _CHARSET; + public $feedkey = 'feed'; + public $plugin_file = 'rssfit.%s.php'; + public $substr_remove = [',', '/', ';', ':', '(', '{', '[', ' ']; + public $substr_add = ['.', '!', '?', '}', ']', ')', '%']; public $substr_endwith = '...'; -<<<<<<< HEAD:class/FeedHandler.php public $spec_url = 'http://blogs.law.harvard.edu/tech/rss'; public $specs = [ 'req' => 'requiredChannelElements', 'opt' => 'optionalChannelElements', -======= - public $spec_url = 'http://blogs.law.harvard.edu/tech/rss'; - public $specs = [ - 'req' => 'requiredChannelElements', - 'opt' => 'optionalChannelElements', ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php 'cloud' => 'ltcloudgtSubelementOfLtchannelgt', 'img' => 'ltimagegtSubelementOfLtchannelgt', ]; -<<<<<<< HEAD:class/FeedHandler.php public $escaped = [ -======= - public $escaped = [ ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php 128 => '€', 130 => '‚', 131 => 'ƒ', @@ -139,26 +81,17 @@ class RssfeedHandler 155 => '›', 156 => 'œ', 158 => 'ž', -<<<<<<< HEAD:class/FeedHandler.php 159 => 'Ÿ', ]; /** * FeedHandler constructor. -======= - 159 => 'Ÿ' - ]; - - /** - * RssfeedHandler constructor. ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php * @param $modConfig * @param $xoopsConfig * @param $xoopsModule */ public function __construct($modConfig, $xoopsConfig, $xoopsModule) { -<<<<<<< HEAD:class/FeedHandler.php $this->myts = \MyTextSanitizer::getInstance(); $this->rssmod = $xoopsModule; $this->pluginHandler = Rssfit\Helper::getInstance()->getHandler('Plugin'); @@ -169,19 +102,6 @@ public function __construct($modConfig, $xoopsConfig, $xoopsModule) 'title' => $this->xoopsConfig['sitename'], 'link' => XOOPS_URL, 'description' => $this->xoopsConfig['slogan'], -======= - $this->myts = \MyTextSanitizer::getInstance(); - $this->rssmod = $xoopsModule; - $db = \XoopsDatabaseFactory::getDatabaseConnection(); - $this->pHandler = new rssfit\RssPluginHandler($db);// xoops_getModuleHandler('plugins'); - $this->mHandler = new rssfit\RssMiscHandler($db); //xoops_getModuleHandler('misc'); - $this->modConfig = $modConfig; - $this->xoopsConfig = $xoopsConfig; - $this->channelreq = [ - 'title' => $this->xoopsConfig['sitename'], - 'link' => XOOPS_URL, - 'description' => $this->xoopsConfig['slogan'] ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php ]; } @@ -191,25 +111,20 @@ public function __construct($modConfig, $xoopsConfig, $xoopsModule) public function getChannel(&$feed) { $channel = []; -<<<<<<< HEAD:class/FeedHandler.php $elements = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channel')); if ($elements) { -======= - if ($elements = $this->mHandler->getObjects(new \Criteria('misc_category', 'channel'))) { ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php foreach ($elements as $e) { if ('' != $e->getVar('misc_content')) { $channel[$e->getVar('misc_title')] = $e->getVar('misc_content', 'n'); } } - $channel['language'] = _LANGCODE; + $channel['language'] = _LANGCODE; $channel['lastBuildDate'] = $this->rssTimeStamp(time()); if ($this->modConfig['cache']) { $channel['ttl'] = $this->modConfig['cache']; } } if (!empty($feed['plugin'])) { -<<<<<<< HEAD:class/FeedHandler.php if (is_object($this->plugin_obj) && is_object($this->subHandler)) { $channel['title'] = $this->plugin_obj->getVar('sub_title', 'n'); $channel['link'] = $this->plugin_obj->getVar('sub_link', 'n'); @@ -223,20 +138,6 @@ public function getChannel(&$feed) } else { $img = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channelimg'), '*', 'title'); if ($img) { -======= - if (is_object($this->pluginObj) && is_object($this->subHandler)) { - $channel['title'] = $this->pluginObj->getVar('sub_title', 'n'); - $channel['link'] = $this->pluginObj->getVar('sub_link', 'n'); - $channel['description'] = $this->pluginObj->getVar('sub_desc', 'n'); - $image = [ - 'url' => $this->pluginObj->getVar('img_url', 'n'), - 'title' => $this->pluginObj->getVar('img_title', 'n'), - 'link' => $this->pluginObj->getVar('img_link', 'n') - ]; - } - } else { - if ($img =& $this->mHandler->getObjects(new \Criteria('misc_category', 'channelimg'), '*', 'title')) { ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php $image = [ 'url' => $img['url']->getVar('misc_content', 'n'), 'title' => $img['title']->getVar('misc_content', 'n'), @@ -265,11 +166,7 @@ public function getChannel(&$feed) */ public function getSticky(&$feed) { -<<<<<<< HEAD:class/FeedHandler.php if (!$intr = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'sticky'))) { -======= - if (!$intr = $this->mHandler->getObjects(new \Criteria('misc_category', 'sticky'))) { ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php return false; } $sticky = &$intr[0]; @@ -279,13 +176,9 @@ public function getSticky(&$feed) return false; } if ((in_array(-1, $setting['feeds']) && empty($feed['plugin'])) -<<<<<<< HEAD:class/FeedHandler.php || (!empty($feed['plugin']) && in_array($this->plugin_obj->getVar('rssf_conf_id'), $setting['feeds']))) { -======= - || (!empty($feed['plugin']) && in_array($this->pluginObj->getVar('rssf_conf_id'), $setting['feeds']))) { ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php $feed['sticky']['title'] = $sticky->getVar('misc_title', 'n'); - $feed['sticky']['link'] = $setting['link']; + $feed['sticky']['link'] = $setting['link']; $sticky->setDoHtml($setting['dohtml']); $sticky->setDoBr($setting['dobr']); $feed['sticky']['description'] = $sticky->getVar('misc_content'); @@ -306,35 +199,20 @@ public function getItems(&$feed) { $entries = []; if (!empty($feed['plugin'])) { -<<<<<<< HEAD:class/FeedHandler.php $this->plugin_obj->setVar('rssf_grab', $this->plugin_obj->getVar('sub_entries')); $this->subHandler->grab = $this->plugin_obj->getVar('sub_entries'); $grab = &$this->subHandler->grabEntries($this->plugin_obj); -======= - $this->pluginObj->setVar('rssf_grab', $this->pluginObj->getVar('sub_entries')); - $this->subHandler->grab = $this->pluginObj->getVar('sub_entries'); - $grab = $this->subHandler->grabEntries($this->pluginObj); ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php if (false !== $grab && count($grab) > 0) { - /** @var rssfit\RssPlugin $g */ foreach ($grab as $g) { array_push($entries, $g); } } -<<<<<<< HEAD:class/FeedHandler.php } elseif ($plugins = $this->pluginHandler->getObjects2(new \Criteria('rssf_activated', 1))) { foreach ($plugins as $p) { $handler = $this->pluginHandler->checkPlugin($p); if ($handler) { $handler->grab = $p->getVar('rssf_grab'); $grab = &$handler->grabEntries($p); -======= - } elseif ($plugins = $this->pHandler->getObjects(new \Criteria('rssf_activated', 1))) { - foreach ($plugins as $p) { - if ($handler == $this->pHandler->checkPlugin($p)) { - $handler->grab = $p->getVar('rssf_grab'); - $grab = $handler->grabEntries($p); ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php if (false !== $grab && count($grab) > 0) { foreach ($grab as $g) { array_push($entries, $g); @@ -368,11 +246,7 @@ public function getItems(&$feed) /** * @param $text -<<<<<<< HEAD:class/FeedHandler.php * @return string -======= - * @return bool|string ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php */ public function doSubstr($text) { @@ -405,11 +279,7 @@ public function doSubstr($text) * @param $text * @param $start * @param $len -<<<<<<< HEAD:class/FeedHandler.php * @return string -======= - * @return bool|string ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php */ public function substrDetect($text, $start, $len) { @@ -475,8 +345,7 @@ public function cleanupChars(&$text, $strip = true, $dospec = true, $dosub = fal $text = htmlspecialchars($text, ENT_QUOTES, $this->charset); $text = preg_replace('/&(#[0-9]+);/i', '&$1;', $text); } -// if (!preg_match('/utf-8/i', $this->charset) || XOOPS_USE_MULTIBYTES != 1) { - if (!preg_match('/utf-8/i', $this->charset)) { + if (!preg_match('/utf-8/i', $this->charset) || XOOPS_USE_MULTIBYTES != 1) { $text = str_replace(array_map('chr', array_keys($this->escaped)), $this->escaped, $text); } } @@ -492,7 +361,6 @@ public function wrapCdata(&$text) /** * @param string $fields * @param string $type -<<<<<<< HEAD:class/FeedHandler.php * @return bool */ public function &getActivatedSubfeeds($fields = '', $type = '') @@ -500,14 +368,6 @@ public function &getActivatedSubfeeds($fields = '', $type = '') $ret = false; $subs = $this->pluginHandler->getObjects2(new \Criteria('subfeed', 1), $fields); if ($subs) { -======= - * @return array|bool - */ - public function getActivatedSubfeeds($fields = '', $type = '') - { - $ret = false; - if ($subs = $this->pHandler->getObjects(new \Criteria('subfeed', 1), $fields)) { ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php switch ($type) { default: $ret = &$subs; @@ -543,12 +403,8 @@ public function feedSelectBox($caption = '', $selected = '', $size = 1, $multi = if ($main) { $select->addOption('-1', _AM_RSSFIT_MAINFEED); } -<<<<<<< HEAD:class/FeedHandler.php $subs = &$this->getActivatedSubfeeds('sublist', 'list'); if ($subs) { -======= - if ($subs = $this->getActivatedSubfeeds('sublist', 'list')) { ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php foreach ($subs as $k => $v) { $select->addOption($k, $v); } @@ -579,10 +435,7 @@ public function subFeedUrl($filename = '') if (!empty($filename)) { $filename = str_replace('rssfit.', '', $filename); $filename = str_replace('.php', '', $filename); -<<<<<<< HEAD:class/FeedHandler.php -======= ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php return RSSFIT_URL_FEED . '?' . $this->feedkey . '=' . $filename; } @@ -598,23 +451,15 @@ public function checkSubFeed(&$feed) $criteria = new \CriteriaCompo(); $criteria->add(new \Criteria('rssf_filename', sprintf($this->plugin_file, $feed['plugin']))); $criteria->add(new \Criteria('subfeed', 1)); -<<<<<<< HEAD:class/FeedHandler.php $sub = $this->pluginHandler->getObjects2($criteria); -======= - $sub = $this->pHandler->getObjects($criteria); ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php $handler = false; if (isset($sub[0])) { $handler = $this->pluginHandler->checkPlugin($sub[0]); } if ($handler) { - $this->pluginObj = $sub[0]; + $this->plugin_obj = $sub[0]; $this->subHandler = $handler; -<<<<<<< HEAD:class/FeedHandler.php $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' . md5(str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); -======= - $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' . md5(str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); ->>>>>>> a741ac9d6cad0426f8dd8b89b5faf99b354e3df1:class/RssfeedHandler.php } else { $feed['plugin'] = ''; } diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 9907651a..2677f433 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -344,24 +344,24 @@ public function checkPlugin($obj) if (class_exists($class)) { $handler = new $class(); if (!method_exists($handler, 'loadmodule') || !method_exists($handler, 'grabentries')) { - $obj->setErrors(_AM_PLUGIN_FUNCNOTFOUND); + $obj->setErrors(_AM_RSSFIT_PLUGIN_FUNCNOTFOUND); } else { $dirname = $handler->dirname; if (!empty($dirname) && is_dir(XOOPS_ROOT_PATH . '/modules/' . $dirname)) { if (!$handler->loadModule()) { - $obj->setErrors(_AM_PLUGIN_MODNOTFOUND); + $obj->setErrors(_AM_RSSFIT_PLUGIN_MODNOTFOUND); } else { $ret = $handler; } } else { - $obj->setErrors(_AM_PLUGIN_MODNOTFOUND); + $obj->setErrors(_AM_RSSFIT_PLUGIN_MODNOTFOUND); } } } else { - $obj->setErrors(_AM_PLUGIN_CLASSNOTFOUND . ' ' . $class); + $obj->setErrors(_AM_RSSFIT_PLUGIN_CLASSNOTFOUND . ' ' . $class); } } else { - $obj->setErrors(_AM_PLUGIN_FILENOTFOUND); + $obj->setErrors(_AM_RSSFIT_PLUGIN_FILENOTFOUND); } return $ret; diff --git a/class/RssMisc.php b/class/RssMisc.php deleted file mode 100644 index e044b3be..00000000 --- a/class/RssMisc.php +++ /dev/null @@ -1,65 +0,0 @@ - - * @author XOOPS Development Team - * @param $a - * @param $b - * @return int - */ -function sortTimestamp($a, $b) -{ - if ($a['timestamp'] == $b['timestamp']) { - return 0; - } - - return ($a['timestamp'] > $b['timestamp']) ? -1 : 1; -} - -/** - * @param $spec - * @param $feedHandler - * @return string - */ -function genSpecMoreInfo($spec, $feedHandler) -{ - return rssfGenAnchor($feedHandler->specUrl($spec), _AM_EDIT_CHANNEL_QMARK, 'spec', _AM_EDIT_CHANNEL_MOREINFO); -} - -/** - * @param string $url - * @param string $text - * @param string $target - * @param string $title - * @param string $class - * @param string $id - * @return string - */ -function rssfGenAnchor($url = '', $text = '', $target = '', $title = '', $class = '', $id = '') -{ - if (!empty($url)) { - $ret = ''; - $ret .= ''; - - return $ret; - } - - return $text; -} diff --git a/class/RssPlugin.php b/class/RssPlugin.php deleted file mode 100644 index a417bca6..00000000 --- a/class/RssPlugin.php +++ /dev/null @@ -1,64 +0,0 @@ - ## -############################################################################### -## XOOPS - PHP Content Management System ## -## Copyright (c) 2000 XOOPS.org ## -## ## -############################################################################### -## This program is free software; you can redistribute it and/or modify ## -## it under the terms of the GNU General Public License as published by ## -## the Free Software Foundation; either version 2 of the License, or ## -## (at your option) any later version. ## -## ## -## 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. See the ## -## GNU General Public License for more details. ## -## ## -## You should have received a copy of the GNU General Public License ## -## along with this program; if not, write to the Free Software ## -## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ## -############################################################################### -## Author of this file: NS Tai (aka tuff) ## -## URL: http://www.brandycoke.com/ ## -## Project: RSSFit ## -############################################################################### - -//use Xoopsmodules\rssfit; - -defined('RSSFIT_ROOT_PATH') || exit('RSSFIT root path not defined'); - -/** - * Class RssPlugin - * @package Xoopsmodules\rssfit - */ -class RssPlugin extends \XoopsObject -{ - public function __construct() - { - parent::__construct(); - // key, data_type, value, req, max, opt - $this->initVar('rssf_conf_id', XOBJ_DTYPE_INT, null); - $this->initVar('rssf_filename', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('rssf_activated', XOBJ_DTYPE_INT, 0); - $this->initVar('rssf_grab', XOBJ_DTYPE_INT, 0, true); - $this->initVar('rssf_order', XOBJ_DTYPE_INT, 0); - $this->initVar('subfeed', XOBJ_DTYPE_INT, 0); - $this->initVar('sub_entries', XOBJ_DTYPE_INT, 0); - $this->initVar('sub_link', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('sub_title', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('sub_desc', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('img_url', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('img_link', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('img_title', XOBJ_DTYPE_TXTBOX, ''); - } -} diff --git a/class/Utility.php b/class/Utility.php index 8d617957..fcc1817b 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -78,7 +78,7 @@ public static function sortTimestamp($a, $b) */ public static function genSpecMoreInfo($spec, $feedHandler) { - return static::rssfGenAnchor($feedHandler->specUrl($spec), _AM_EDIT_CHANNEL_QMARK, 'spec', _AM_EDIT_CHANNEL_MOREINFO); + return static::rssfGenAnchor($feedHandler->specUrl($spec), _AM_RSSFIT_EDIT_CHANNEL_QMARK, 'spec', _AM_RSSFIT_EDIT_CHANNEL_MOREINFO); } /** diff --git a/class/common/Breadcrumb.php b/class/common/Breadcrumb.php index 017b1d43..c7621a8d 100644 --- a/class/common/Breadcrumb.php +++ b/class/common/Breadcrumb.php @@ -1,4 +1,6 @@ - - * @package rss + * @package rssfit * * Example: - * $breadcrumb = new Breadcrumb(); + * $breadcrumb = new PedigreeBreadcrumb(); * $breadcrumb->addLink( 'bread 1', 'index1.php' ); * $breadcrumb->addLink( 'bread 2', '' ); * $breadcrumb->addLink( 'bread 3', 'index3.php' ); * echo $breadcrumb->render(); */ -defined('XOOPS_ROOT_PATH') || exit('XOOPS Root Path not defined'); +defined('XOOPS_ROOT_PATH') || die('XOOPS Root Path not defined'); /** - * Class PedigreeBreadcrumb + * Class Breadcrumb */ class Breadcrumb { public $dirname; private $bread = []; - /** - * - */ public function __construct() { - $this->dirname = basename(dirname(__DIR__)); + $this->dirname = basename(dirname(dirname(__DIR__))); } /** @@ -51,14 +50,13 @@ public function __construct() public function addLink($title = '', $link = '') { $this->bread[] = [ - 'link' => $link, - 'title' => $title + 'link' => $link, + 'title' => $title, ]; } /** * Render Pedigree BreadCrumb - * */ public function render() { diff --git a/class/common/Configurator.php b/class/common/Configurator.php index f65d36be..2031f5a4 100644 --- a/class/common/Configurator.php +++ b/class/common/Configurator.php @@ -1,4 +1,6 @@ -name = $config->name; - $this->paths = $config->paths; - $this->uploadFolders = $config->uploadFolders; - $this->copyBlankFiles = $config->copyBlankFiles; + $this->name = $config->name; + $this->paths = $config->paths; + $this->uploadFolders = $config->uploadFolders; + $this->copyBlankFiles = $config->copyBlankFiles; $this->copyTestFolders = $config->copyTestFolders; $this->templateFolders = $config->templateFolders; - $this->oldFiles = $config->oldFiles; - $this->oldFolders = $config->oldFolders; - $this->modCopyright = $config->modCopyright; + $this->oldFiles = $config->oldFiles; + $this->oldFolders = $config->oldFolders; + $this->renameTables = $config->renameTables; + $this->modCopyright = $config->modCopyright; } } diff --git a/class/common/FilesManagement.php b/class/common/FilesManagement.php index 21a77b6f..2d7d84f1 100644 --- a/class/common/FilesManagement.php +++ b/class/common/FilesManagement.php @@ -1,4 +1,6 @@ -getRealPath())) { break; } - } else { - // delete the file - if (!($success = unlink($fileInfo->getRealPath()))) { + } elseif (!($success = unlink($fileInfo->getRealPath()))) { break; } } - } + // now delete this (sub)directory if all the files are gone if ($success) { $success = rmdir($dirInfo->getRealPath()); @@ -117,11 +115,11 @@ public static function deleteDirectory($src) // input is not a valid directory $success = false; } + return $success; } /** - * * Recursively remove directory * * @todo currently won't remove directories with hidden files, should it? @@ -149,7 +147,7 @@ public static function rrmdir($src) foreach ($iterator as $fObj) { if ($fObj->isFile()) { $filename = $fObj->getPathname(); - $fObj = null; // clear this iterator object to close the file + $fObj = null; // clear this iterator object to close the file if (!unlink($filename)) { return false; // couldn't delete the file } @@ -183,7 +181,7 @@ public static function rmove($src, $dest) } // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest, 0755)) { + if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { return false; } @@ -226,7 +224,7 @@ public static function rcopy($src, $dest) } // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest, 0755)) { + if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { return false; } @@ -239,6 +237,7 @@ public static function rcopy($src, $dest) self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); } } + return true; } } diff --git a/class/common/ServerStats.php b/class/common/ServerStats.php index a1c3d8a7..488ccf31 100644 --- a/class/common/ServerStats.php +++ b/class/common/ServerStats.php @@ -1,4 +1,6 @@ -query($sql); // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); - $html .= '
      '; - $html .= "" . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . ''; - $html .= "
      "; - // $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
      "; - // $html .= "
      "; - // $html .= "
      "; - $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . '
      '; - $html .= '
        '; + $html .= "
        " . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "\n"; + $html .= "
        \n"; + // $html .= '
        ' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
        \n"; + // $html .= "
        \n"; + // $html .= "
        \n"; + $html .= '
        ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "
        \n"; + $html .= "
          \n"; - $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; - $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; + $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; + $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; if (function_exists('gd_info')) { - if ($gdlib = true === gd_info()) { + if (true === ($gdlib = gd_info())) { $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; } } - + // // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); // $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; - + // // $registerglobals = (!ini_get('register_globals')) ? "" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . constant('CO_' . $moduleDirNameUpper . '_ON') . ''; // $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; + // + $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; + $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; - $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - - $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . ''; - $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . ''; - $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . ''; - $html .= '
        '; - $html .= '
          '; - $html .= '
        • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . ''; - $html .= '
        '; - $html .= '
        '; - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . ''; + $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . "\n"; + $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . "\n"; + $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . "\n"; + $html .= "
      \n"; + $html .= "
        \n"; + $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . "\n"; + $html .= "
      \n"; + $html .= "
      \n"; + $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; $html .= '
      '; $html .= '

      '; diff --git a/class/common/VersionChecks.php b/class/common/VersionChecks.php index 023fdef4..7881e904 100644 --- a/class/common/VersionChecks.php +++ b/class/common/VersionChecks.php @@ -1,4 +1,6 @@ -getInfo('min_xoops'); //making sure it's a string } @@ -51,22 +53,28 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = } /** - * * Verifies PHP version meets minimum requirements for this module * @static - * @param \XoopsModule $module * + * @param \XoopsModule|null $module * @return bool true if meets requirements, false if not */ - public static function checkVerPhp(\XoopsModule $module) + public static function checkVerPhp(\XoopsModule $module = null) { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = strtoupper($moduleDirName); - xoops_loadLanguage('admin', $module->dirname()); + $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + if (null === $module) { + $module = \XoopsModule::getByDirname($moduleDirName); + } + xoops_loadLanguage('admin', $moduleDirName); + xoops_loadLanguage('common', $moduleDirName); + // check for minimum PHP version $success = true; - $verNum = PHP_VERSION; - $reqVer = $module->getInfo('min_php'); + + $verNum = PHP_VERSION; + $reqVer = &$module->getInfo('min_php'); + if (false !== $reqVer && '' !== $reqVer) { if (version_compare($verNum, $reqVer, '<')) { $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); @@ -76,4 +84,65 @@ public static function checkVerPhp(\XoopsModule $module) return $success; } + + /** + * compares current module version with latest GitHub release + * @static + * @param \Xmf\Module\Helper $helper + * @param string|null $source + * @param string|null $default + * + * @return string|array info about the latest module version, if newer + */ + public static function checkVerModule($helper, $source = 'github', $default = 'master') + { + $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $update = ''; + $repository = 'XoopsModules25x/' . $moduleDirName; + // $repository = 'XoopsModules25x/publisher'; //for testing only + $ret = ''; + $infoReleasesUrl = "https://api.github.com/repos/$repository/releases"; + if ('github' === $source) { + if (function_exists('curl_init') && false !== ($curlHandle = curl_init())) { + curl_setopt($curlHandle, CURLOPT_URL, $infoReleasesUrl); + curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true); + curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false); + curl_setopt($curlHandle, CURLOPT_HTTPHEADER, ["User-Agent:Publisher\r\n"]); + $curlReturn = curl_exec($curlHandle); + if (false === $curlReturn) { + trigger_error(curl_error($curlHandle)); + } elseif (false !== mb_strpos($curlReturn, 'Not Found')) { + trigger_error('Repository Not Found: ' . $infoReleasesUrl); + } else { + $file = json_decode($curlReturn, false); + $latestVersionLink = sprintf("https://github.com/$repository/archive/%s.zip", $file ? reset($file)->tag_name : $default); + $latestVersion = $file[0]->tag_name; + $prerelease = $file[0]->prerelease; + if ('master' !== $latestVersionLink) { + $update = constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; + } + //"PHP-standardized" version + $latestVersion = mb_strtolower($latestVersion); + if (false !== mb_strpos($latestVersion, 'final')) { + $latestVersion = str_replace('_', '', mb_strtolower($latestVersion)); + $latestVersion = str_replace('final', '', mb_strtolower($latestVersion)); + } + $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); + //"PHP-standardized" version + $moduleVersion = str_replace(' ', '', mb_strtolower($moduleVersion)); + // $moduleVersion = '1.0'; //for testing only + // $moduleDirName = 'publisher'; //for testing only + if (!$prerelease && version_compare($moduleVersion, $latestVersion, '<')) { + $ret = []; + $ret[] = $update; + $ret[] = $latestVersionLink; + } + } + curl_close($curlHandle); + } + } + + return $ret; + } } diff --git a/class/common/index.html b/class/common/index.html index 2c5cdd3f..990cbd60 100644 --- a/class/common/index.html +++ b/class/common/index.html @@ -1 +1 @@ - + \ No newline at end of file diff --git a/class/index.html b/class/index.html index 2c5cdd3f..990cbd60 100644 --- a/class/index.html +++ b/class/index.html @@ -1 +1 @@ - + \ No newline at end of file diff --git a/include/config.php b/include/config.php deleted file mode 100644 index a3a0f26a..00000000 --- a/include/config.php +++ /dev/null @@ -1,78 +0,0 @@ - strtoupper($moduleDirName) . ' Module Configurator', - 'paths' => [ - 'dirname' => $moduleDirName, - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, - ], - 'uploadFolders' => [ -// constant($capsDirName . '_UPLOAD_PATH'), -// constant($capsDirName . '_UPLOAD_PATH') . '/category', -// constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', - //XOOPS_UPLOAD_PATH . '/flags' - ], - 'copyBlankFiles' => [ -// constant($capsDirName . '_UPLOAD_PATH'), -// constant($capsDirName . '_UPLOAD_PATH') . '/category', -// constant($capsDirName . '_UPLOAD_PATH') . '/screenshots', - //XOOPS_UPLOAD_PATH . '/flags' - ], - - 'copyTestFolders' => [ - // constant($capsDirName . '_UPLOAD_PATH'), -// [ -// constant($capsDirName . '_PATH') . '/testdata/images', -// constant($capsDirName . '_UPLOAD_PATH') . '/images', -// ] - ], - - 'templateFolders' => [ - '/templates/', - '/templates/blocks/', - '/templates/admin/' - - ], - 'oldFiles' => [ -// '/class/request.php', -// '/class/registry.php', -// '/class/utilities.php', -// '/class/util.php', -// '/include/constants.php', - '/include/functions.php', -// '/ajaxrating.txt', - ], - 'oldFolders' => [ - '/images', - '/css', - '/js', - '/tcpdf', - ], - 'modCopyright' => "
      - \'XOOPS', -]; From 6fd561a8f695564bb49921a3ad9fe5f1ab7886b8 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 14 Mar 2020 07:58:31 -0400 Subject: [PATCH 060/154] language constants --- admin/do_plugins.php | 4 ++-- header.php | 4 ++-- index.php | 4 ++-- language/english/modinfo.php | 44 ++++++++++++++++++------------------ rss.php | 2 +- xoops_version.php | 38 +++++++++++++++---------------- 6 files changed, 48 insertions(+), 48 deletions(-) diff --git a/admin/do_plugins.php b/admin/do_plugins.php index bd745b96..85078511 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -49,7 +49,7 @@ . _AM_RSSFIT_PLUGIN_ORDER . "
      " - . _AM_ACTION + . _AM_RSSFIT_ACTION . "
      " - . _AM_ACTION + . _AM_RSSFIT_ACTION . "
      \n" . "\n"; foreach ($plugins as $p) { - $handler = $pluginsHandler->checkPlugin($p); + $handler = $pluginHandler->checkPlugin($p); if ($handler) { $id = $p->getVar('rssf_conf_id'); $entries = new \XoopsFormText('', 'rssf_grab[' . $id . ']', 3, 2, $p->getVar('rssf_grab')); @@ -80,14 +80,14 @@ . "\n"; $ret .= "\n"; } else { - $pluginsHandler->forceDeactivate($p); + $pluginHandler->forceDeactivate($p); } } $ret .= "
      " @@ -53,7 +53,7 @@ . "\n" . "
      \n"; } // inactive plugins - $plugins = $pluginsHandler->getObjects2(new \Criteria('rssf_activated', 0), 'p_inactive'); + $plugins = $pluginHandler->getObjects2(new \Criteria('rssf_activated', 0), 'p_inactive'); if ($plugins) { $ret .= "
      \n\n" . "\n" . "\n" . "\n" . "\n" . "
      " @@ -108,7 +108,7 @@ $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); $action->addOption('', _SELECT); $ret .= "
      " . $p->getVar('rssf_filename') . ""; - $handler = $pluginsHandler->checkPlugin($p); + $handler = $pluginHandler->checkPlugin($p); if ($handler) { $ret .= $handler->modname; $action->addOption('a', _AM_RSSFIT_PLUGIN_ACTIVATE); @@ -128,19 +128,19 @@ } // Non-installed plugins - if (!$filelist = &$pluginsHandler->getPluginFileList()) { + if (!$filelist = &$pluginHandler->getPluginFileList()) { $filelist = []; } // $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'class\Plugins'); $installable = []; // foreach ($list as $f) { -// if (preg_match('/rssfit\.+[a-zA-Z0-9_]+\.php/$', $f) && !in_array($f, $filelist)) { +// if (preg_match('/rssfit\.+[a-zA-Z0-9_]+\.php$/', $f) && !in_array($f, $filelist)) { // $installable[] = $f; // } // } foreach ($list as $f) { - if (preg_match('/[a-zA-Z0-9_]+\.php/', ucfirst($f)) && !in_array($f, $filelist)) { + if (preg_match('/[a-zA-Z0-9_]+\.php$/', ucfirst($f)) && !in_array($f, $filelist)) { $installable[] = ucfirst($f); } } @@ -163,9 +163,9 @@ $action = new \XoopsFormCheckbox('', 'install[' . $i . ']'); $action->addOption('i', ' '); $ret .= "
      " . $i . ""; - $p = $pluginsHandler->create(); + $p = $pluginHandler->create(); $p->setVar('rssf_filename', $i); - $handler = $pluginsHandler->checkPlugin($p); + $handler = $pluginHandler->checkPlugin($p); if ($handler) { $ret .= $handler->modname; } else { @@ -210,7 +210,7 @@ if (isset($action)) { $keys = array_keys($action); foreach ($keys as $k) { - $plugin = $pluginsHandler->get($k); + $plugin = $pluginHandler->get($k); if ($plugin) { if (isset($rssf_grab[$k])) { $plugin->setVar('rssf_grab', $rssf_grab[$k]); @@ -218,18 +218,18 @@ } switch ($action[$k]) { default: - $result = $pluginsHandler->insert($plugin); + $result = $pluginHandler->insert($plugin); break; case 'u': // uninstall - $result = $pluginsHandler->delete($plugin); + $result = $pluginHandler->delete($plugin); break; case 'd': // deactivate $plugin->setVar('rssf_activated', 0); - $result = $pluginsHandler->insert($plugin); + $result = $pluginHandler->insert($plugin); break; case 'a': // activate $plugin->setVar('rssf_activated', 1); - $result = $pluginsHandler->insert($plugin); + $result = $pluginHandler->insert($plugin); break; } } @@ -241,9 +241,9 @@ if (!empty($install)) { $files = array_keys($install); foreach ($files as $f) { - $p = $pluginsHandler->create(); + $p = $pluginHandler->create(); $p->setVar('rssf_filename', $f); - $handler = $pluginsHandler->checkPlugin($p); + $handler = $pluginHandler->checkPlugin($p); if ($handler) { $p->setVar('rssf_activated', 1); $p->setVar('rssf_grab', $helper->getConfig('plugin_entries')); @@ -251,7 +251,7 @@ $p->setVar('sub_link', XOOPS_URL . '/modules/' . $handler->dirname); $p->setVar('sub_title', $xoopsConfig['sitename'] . ' - ' . $handler->modname); $p->setVar('sub_desc', $xoopsConfig['slogan']); - if (!$result = $pluginsHandler->insert($p)) { + if (!$result = $pluginHandler->insert($p)) { $err .= $p->getHtmlErrors(); } } diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index b5618b9e..f03ba229 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -26,7 +26,7 @@ switch ($op) { default: $ret = ''; - $plugins = $pluginsHandler->getObjects2(null, 'sublist'); + $plugins = $pluginHandler->getObjects2(null, 'sublist'); if ($plugins) { $ret .= "
      \n\n" . "\n"; foreach ($plugins as $p) { $id = $p->getVar('rssf_conf_id'); - if (!$handler = $pluginsHandler->checkPlugin($p)) { - $pluginsHandler->forceDeactivate($p); + if (!$handler = $pluginHandler->checkPlugin($p)) { + $pluginHandler->forceDeactivate($p); $mod = implode('
      ', $p->getErrors()); $activate = new \XoopsFormCheckbox('', 'activate[' . $id . ']', 0); $activate->setExtra('disabled="disabled"'); @@ -97,13 +97,13 @@ case 'save': $activate = Request::getArray('activate', null, 'POST'); - $plugins = $pluginsHandler->getObjects2(null, 'sublist'); + $plugins = $pluginHandler->getObjects2(null, 'sublist'); if ($plugins) { - $pluginsHandler->modifyObjects(null, ['subfeed' => 0]); + $pluginHandler->modifyObjects(null, ['subfeed' => 0]); if (isset($activate) && is_array($activate) && count($activate) > 0) { $keys = array_keys($activate); $criteria = new \Criteria('rssf_conf_id', '(' . implode(',', $keys) . ')', 'IN'); - $pluginsHandler->modifyObjects($criteria, ['subfeed' => 1]); + $pluginHandler->modifyObjects($criteria, ['subfeed' => 1]); } redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); } else { @@ -113,9 +113,9 @@ case 'edit': $id = \Xmf\Request::getInt('feed', 0, 'GET'); if (!empty($id)) { - $sub = $pluginsHandler->get($id); - if (!$handler = $pluginsHandler->checkPlugin($sub)) { - $pluginsHandler->forceDeactivate($sub); + $sub = $pluginHandler->get($id); + if (!$handler = $pluginHandler->checkPlugin($sub)) { + $pluginHandler->forceDeactivate($sub); } } if (empty($id) || !$sub) { @@ -144,9 +144,9 @@ case 'savefeed': $id = Request::getInt('feed', 0, 'POST'); if (!empty($id)) { - $sub = $pluginsHandler->get($id); - if (!$handler = $pluginsHandler->checkPlugin($sub)) { - $pluginsHandler->forceDeactivate($sub); + $sub = $pluginHandler->get($id); + if (!$handler = $pluginHandler->checkPlugin($sub)) { + $pluginHandler->forceDeactivate($sub); } } if (empty($id) || !$sub || !$handler) { @@ -170,7 +170,7 @@ $sub->setVar('img_url', $img_url); $sub->setVar('img_link', $img_link); $sub->setVar('img_title', $img_title); - if (false !== $pluginsHandler->insert($sub)) { + if (false !== $pluginHandler->insert($sub)) { redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); } else { echo $sub->getHtmlErrors(); diff --git a/class/FeedHandler.php b/class/FeedHandler.php index ad401edc..5a77a6cc 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -204,7 +204,7 @@ public function getItems(&$feed) $grab = &$this->subHandler->grabEntries($this->plugin_obj); if (false !== $grab && count($grab) > 0) { foreach ($grab as $g) { - array_push($entries, $g); + $entries[] = $g; } } } elseif ($plugins = $this->pluginHandler->getObjects2(new \Criteria('rssf_activated', 1))) { @@ -215,7 +215,7 @@ public function getItems(&$feed) $grab = &$handler->grabEntries($p); if (false !== $grab && count($grab) > 0) { foreach ($grab as $g) { - array_push($entries, $g); + $entries[] = $g; } } } @@ -345,7 +345,7 @@ public function cleanupChars(&$text, $strip = true, $dospec = true, $dosub = fal $text = htmlspecialchars($text, ENT_QUOTES, $this->charset); $text = preg_replace('/&(#[0-9]+);/i', '&$1;', $text); } - if (!preg_match('/utf-8/i', $this->charset) || XOOPS_USE_MULTIBYTES != 1) { + if (false === stripos($this->charset, "utf-8") || XOOPS_USE_MULTIBYTES != 1) { $text = str_replace(array_map('chr', array_keys($this->escaped)), $this->escaped, $text); } } diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 855d859a..ba99f4ef 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -91,8 +91,8 @@ public function create($isNew = true) // public function get($id = null, $fields = '*') /** - * @param null $id - * @param null $fields + * @param null|int $id + * @param null|array $fields * @return bool|mixed|\XoopsObject|null */ public function get($id = null, $fields = null) @@ -107,7 +107,7 @@ public function get($id = null, $fields = null) } /** - * @param null $criteria + * @param null|\CriteriaElement $criteria * @return bool|int */ public function getCount($criteria = null) @@ -125,7 +125,7 @@ public function getCount($criteria = null) } /** - * @param null $criteria + * @param null|\CriteriaElement $criteria * @param string $fields * @param string $key * @return bool @@ -228,7 +228,7 @@ public function insert(\XoopsObject $obj, $force = false) } /** - * @param null $criteria + * @param null|\CriteriaElement $criteria * @param array $fields * @param bool $force * @return bool|string @@ -262,11 +262,11 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) } /** - * @param \XoopsObject $category + * @param \XoopsObject $obj * @param bool $force * @return bool */ - public function delete(\XoopsObject $category, $force = false) + public function delete(\XoopsObject $obj, $force = false) { // $force = false; if (mb_strtolower(get_class($obj)) != mb_strtolower($this->obj_class)) { diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 2677f433..7fb56307 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -93,8 +93,8 @@ public function create($isNew = true) // public function get($id, $fields = '*') /** - * @param null $id - * @param null $fields + * @param null|int $id + * @param null|array $fields * @return bool|mixed|\XoopsObject|null */ public function get($id = null, $fields = null) @@ -166,11 +166,11 @@ public function insert(\XoopsObject $obj, $force = false) } /** - * @param \XoopsObject $category + * @param \XoopsObject $obj * @param bool $force * @return bool */ - public function delete(\XoopsObject $category, $force = false) + public function delete(\XoopsObject $obj, $force = false) { // $force = false; if (mb_strtolower(get_class($obj)) != mb_strtolower($this->obj_class)) { @@ -190,7 +190,7 @@ public function delete(\XoopsObject $category, $force = false) } /** - * @param null $criteria + * @param null|\CriteriaElement $criteria * @param string $fields * @param string $key * @return bool @@ -244,7 +244,7 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') } /** - * @param null $criteria + * @param null|\CriteriaElement $criteria * @param array $fields * @param bool $force * @return bool|string @@ -278,7 +278,7 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) } /** - * @param null $criteria + * @param null|\CriteriaElement $criteria * @return bool|int */ public function getCount($criteria = null) @@ -327,7 +327,7 @@ public function &getPluginFileList() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool|mixed */ public function checkPlugin($obj) diff --git a/class/Plugins/00/Comments.php b/class/Plugins/00/Comments.php index 9327535f..1906b993 100644 --- a/class/Plugins/00/Comments.php +++ b/class/Plugins/00/Comments.php @@ -59,7 +59,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Adslight.php b/class/Plugins/Adslight.php index 1ac45c6e..8a2e7a49 100644 --- a/class/Plugins/Adslight.php +++ b/class/Plugins/Adslight.php @@ -57,7 +57,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Ams.php b/class/Plugins/Ams.php index a3ed2676..91d2c80e 100644 --- a/class/Plugins/Ams.php +++ b/class/Plugins/Ams.php @@ -59,8 +59,8 @@ public function loadModule() } /** - * @param $obj - * @return bool + * @param \XoopsObject $obj + * @return bool|array */ public function &grabEntries(&$obj) { @@ -69,6 +69,7 @@ public function &grabEntries(&$obj) $myts = \MyTextSanitizer::getInstance(); $ams = \XoopsModules\Ams\Story::getAllPublished($this->grab, 0); if (count($ams) > 0) { + $ret = []; for ($i = 0, $iMax = count($ams); $i < $iMax; $i++) { $ret[$i]['title'] = $myts->undoHtmlSpecialChars($ams[$i]->title()); $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . "/modules/$this->dirname/article.php?storyid=" . $ams[$i]->storyid(); diff --git a/class/Plugins/Apcal.php b/class/Plugins/Apcal.php index 0416eef1..86ca3ea5 100644 --- a/class/Plugins/Apcal.php +++ b/class/Plugins/Apcal.php @@ -57,7 +57,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Buyersguide.php b/class/Plugins/Buyersguide.php index 9f1b3de1..f5f80083 100644 --- a/class/Plugins/Buyersguide.php +++ b/class/Plugins/Buyersguide.php @@ -58,7 +58,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Buyersguidemanufacturers.php b/class/Plugins/Buyersguidemanufacturers.php index 728494b0..495a31b4 100644 --- a/class/Plugins/Buyersguidemanufacturers.php +++ b/class/Plugins/Buyersguidemanufacturers.php @@ -58,7 +58,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Buyersguidenews.php b/class/Plugins/Buyersguidenews.php index c7628abf..d3fb81f3 100644 --- a/class/Plugins/Buyersguidenews.php +++ b/class/Plugins/Buyersguidenews.php @@ -58,7 +58,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Cbb.php b/class/Plugins/Cbb.php index 05dcb381..c8c89a88 100644 --- a/class/Plugins/Cbb.php +++ b/class/Plugins/Cbb.php @@ -61,7 +61,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return mixed */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index 5898eb2e..7520a362 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -79,7 +79,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Lexikon.php b/class/Plugins/Lexikon.php index fdd30455..644ccb35 100644 --- a/class/Plugins/Lexikon.php +++ b/class/Plugins/Lexikon.php @@ -58,7 +58,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Myalbum.php b/class/Plugins/Myalbum.php index 78be9cd5..cf844a40 100644 --- a/class/Plugins/Myalbum.php +++ b/class/Plugins/Myalbum.php @@ -106,7 +106,7 @@ public function myGetUnameFromId($uid) } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Mydownloads.php b/class/Plugins/Mydownloads.php index a17ced42..39455723 100644 --- a/class/Plugins/Mydownloads.php +++ b/class/Plugins/Mydownloads.php @@ -58,7 +58,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Mylinks.php b/class/Plugins/Mylinks.php index 0ea6b9d4..859fd926 100644 --- a/class/Plugins/Mylinks.php +++ b/class/Plugins/Mylinks.php @@ -59,7 +59,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Mytube.php b/class/Plugins/Mytube.php index 9be6507e..a5b5a7bd 100644 --- a/class/Plugins/Mytube.php +++ b/class/Plugins/Mytube.php @@ -57,7 +57,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Newbb.php b/class/Plugins/Newbb.php index 45f80d77..8883c11c 100644 --- a/class/Plugins/Newbb.php +++ b/class/Plugins/Newbb.php @@ -62,7 +62,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Newbb2.php b/class/Plugins/Newbb2.php index 5890593d..1ba21bac 100644 --- a/class/Plugins/Newbb2.php +++ b/class/Plugins/Newbb2.php @@ -93,7 +93,7 @@ public function myGetUnameFromId($uid) } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/News.php b/class/Plugins/News.php index 4238def0..f4f5eaa7 100644 --- a/class/Plugins/News.php +++ b/class/Plugins/News.php @@ -62,7 +62,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Oledrion.php b/class/Plugins/Oledrion.php index 25bf9610..31f30cd7 100644 --- a/class/Plugins/Oledrion.php +++ b/class/Plugins/Oledrion.php @@ -51,7 +51,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) @@ -60,7 +60,7 @@ public function &grabEntries(&$obj) require_once XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; $helper = \XoopsModules\Oledrion\Helper::getInstance(); $productsHandler = $helper->getHandler('Products'); - $items = $productsHandler->getRecentProducts(new Oledrion\Parameters(['start' => 0, 'limit' => $this->grab])); + $items = $productsHandler->getRecentProducts(new \XoopsModules\Oledrion\Parameters(['start' => 0, 'limit' => $this->grab])); $i = 0; if (false !== $items && count($items) > 0) { diff --git a/class/Plugins/Pical.php b/class/Plugins/Pical.php index 4aa43047..52525901 100644 --- a/class/Plugins/Pical.php +++ b/class/Plugins/Pical.php @@ -57,7 +57,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Publisher.php b/class/Plugins/Publisher.php index 14f1ce01..69ffb44e 100644 --- a/class/Plugins/Publisher.php +++ b/class/Plugins/Publisher.php @@ -61,7 +61,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return array */ public function &grabEntries($obj) diff --git a/class/Plugins/Queries.php b/class/Plugins/Queries.php index db5c6f54..910750fb 100644 --- a/class/Plugins/Queries.php +++ b/class/Plugins/Queries.php @@ -60,7 +60,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Rmdp.php b/class/Plugins/Rmdp.php index b5cfca13..edecf3fc 100644 --- a/class/Plugins/Rmdp.php +++ b/class/Plugins/Rmdp.php @@ -59,7 +59,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return array */ public function grabEntries(&$obj) diff --git a/class/Plugins/Sample.php b/class/Plugins/Sample.php index 0cd32bbe..28e089c7 100644 --- a/class/Plugins/Sample.php +++ b/class/Plugins/Sample.php @@ -78,7 +78,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php index 14bea28f..31548b7b 100644 --- a/class/Plugins/Smartfaq.php +++ b/class/Plugins/Smartfaq.php @@ -59,7 +59,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php index ef7d329b..64b23174 100644 --- a/class/Plugins/Smartpartner.php +++ b/class/Plugins/Smartpartner.php @@ -60,7 +60,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Smartsection.php b/class/Plugins/Smartsection.php index d9c73082..9a04052a 100644 --- a/class/Plugins/Smartsection.php +++ b/class/Plugins/Smartsection.php @@ -59,7 +59,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Special.php b/class/Plugins/Special.php index 98848b4a..df54e373 100644 --- a/class/Plugins/Special.php +++ b/class/Plugins/Special.php @@ -76,7 +76,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return array */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php index 67c27400..7bee6c03 100644 --- a/class/Plugins/Surnames.php +++ b/class/Plugins/Surnames.php @@ -88,7 +88,7 @@ public function myGetUnameFromId($uid) } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Weblinks.php b/class/Plugins/Weblinks.php index cf0b7cc3..ab68845f 100644 --- a/class/Plugins/Weblinks.php +++ b/class/Plugins/Weblinks.php @@ -86,7 +86,7 @@ public function myGetUnameFromId($uid) } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php index 102ed358..b9d9466b 100644 --- a/class/Plugins/Wfdownloads.php +++ b/class/Plugins/Wfdownloads.php @@ -61,7 +61,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Wfdownloads_podcast.php b/class/Plugins/Wfdownloads_podcast.php index 307af00c..c63bc665 100644 --- a/class/Plugins/Wfdownloads_podcast.php +++ b/class/Plugins/Wfdownloads_podcast.php @@ -61,7 +61,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Wflinks.php b/class/Plugins/Wflinks.php index fc80f8b8..fc7f19ac 100644 --- a/class/Plugins/Wflinks.php +++ b/class/Plugins/Wflinks.php @@ -65,7 +65,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return array */ public function grabEntries(&$obj) diff --git a/class/Plugins/Wfsection.php b/class/Plugins/Wfsection.php index 229e5c2c..594f9d0c 100644 --- a/class/Plugins/Wfsection.php +++ b/class/Plugins/Wfsection.php @@ -62,7 +62,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Wfsection2.php b/class/Plugins/Wfsection2.php index 8a717c34..d90b8791 100644 --- a/class/Plugins/Wfsection2.php +++ b/class/Plugins/Wfsection2.php @@ -61,7 +61,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/class/Plugins/Xoopstube.php b/class/Plugins/Xoopstube.php index 566e1fe0..5f130f2d 100644 --- a/class/Plugins/Xoopstube.php +++ b/class/Plugins/Xoopstube.php @@ -57,7 +57,7 @@ public function loadModule() } /** - * @param $obj + * @param \XoopsObject $obj * @return bool */ public function &grabEntries(&$obj) diff --git a/include/common.php b/include/common.php index 8f798cfc..c2a95f6f 100644 --- a/include/common.php +++ b/include/common.php @@ -82,10 +82,8 @@ $feedHandler = new \XoopsModules\Rssfit\FeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); $myts = $feedHandler->myts; -//$pluginsHandler = $feedHandler->pluginHandler; -//$miscHandler = $feedHandler->miscHandler; -$pluginsHandler = $helper->getHandler('Plugin'); +$pluginHandler = $helper->getHandler('Plugin'); $miscHandler = $helper->getHandler('Misc'); $icons = [ diff --git a/include/common0.php b/include/common0.php index d084947d..111950b8 100644 --- a/include/common0.php +++ b/include/common0.php @@ -35,5 +35,5 @@ $rss = new Rssfit\FeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); $myts = $rss->myts; -$pluginsHandler = $rss->pluginHandler; +$pluginHandler = $rss->pluginHandler; $miscHandler = $rss->miscHandler; diff --git a/index.php b/index.php index 4d7ed01e..ddb7971d 100644 --- a/index.php +++ b/index.php @@ -28,7 +28,7 @@ $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); $content = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_content')); $content = str_replace('{SITEURL}', XOOPS_URL . '/', $content); - if (false !== mb_strpos($content, '{SUB}') && $plugins = $pluginsHandler->getObjects2(new \Criteria('subfeed', 1))) { + if (false !== mb_strpos($content, '{SUB}') && $plugins = $pluginHandler->getObjects2(new \Criteria('subfeed', 1))) { $sublist = ''; foreach ($plugins as $p) { $sub = $myts->stripSlashesGPC($setting['sub']); diff --git a/templates/rssfit_rss.tpl b/templates/rssfit_rss.tpl index 49a6bd3a..0a2132a8 100644 --- a/templates/rssfit_rss.tpl +++ b/templates/rssfit_rss.tpl @@ -10,7 +10,7 @@ <{$feed.image.title}><{$feed.image.url}> - <{$feed.image.link}> + <{$feed.image.link}> <{/if}> <{if $feed.sticky != ''}> @@ -18,7 +18,7 @@ <{$feed.sticky.title}><{$feed.sticky.description}><{$feed.sticky.pubdate}> - <{$feed.sticky.link}> + <{$feed.sticky.link}> <{/if}> <{if $feed.items != ''}><{foreach item=item from=$feed.items}> @@ -26,7 +26,7 @@ <{$item.title}><{$item.description}><{$item.pubdate}> - <{$item.link}> + <{$item.link}> <{if $item.category != ""}> domain="<{$item.domain}>"<{/if}>><{$item.category}> <{/if}> From d48f7e30b2f56b8e31fa0e66d7a41d99791f3339 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 14 Mar 2020 09:39:40 -0400 Subject: [PATCH 063/154] updates --- class/Common/SysUtility.php | 5 +++++ class/MiscHandler.php | 2 +- class/PluginHandler.php | 4 ++-- 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index ddc02cb2..07b9101d 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -15,6 +15,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +use XoopsModules\Rssfit\Helper; + /** * @license https://www.fsf.org/copyleft/gpl.html GNU public license * @copyright https://xoops.org 2000-2020 © XOOPS Project @@ -152,6 +154,9 @@ public static function getEditor($helper = null, $options = null) $options['height'] = '400px'; } + if (null === $helper) { + $helper = Helper::getInstance(); + } $isAdmin = $helper->isUserAdmin(); if (class_exists('XoopsFormEditor')) { diff --git a/class/MiscHandler.php b/class/MiscHandler.php index ba99f4ef..7936bbe1 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -107,7 +107,7 @@ public function get($id = null, $fields = null) } /** - * @param null|\CriteriaElement $criteria + * @param null|\Criteria|\CriteriaCompo $criteria * @return bool|int */ public function getCount($criteria = null) diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 7fb56307..3a22bc0c 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -190,7 +190,7 @@ public function delete(\XoopsObject $obj, $force = false) } /** - * @param null|\CriteriaElement $criteria + * @param null|\Criteria|\CriteriaCompo $criteria * @param string $fields * @param string $key * @return bool @@ -278,7 +278,7 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) } /** - * @param null|\CriteriaElement $criteria + * @param null|\Criteria|\CriteriaCompo $criteria * @return bool|int */ public function getCount($criteria = null) From d6160a85fe9651600492634d9462c186a1215a64 Mon Sep 17 00:00:00 2001 From: Michael Beck Date: Tue, 12 Oct 2021 02:35:12 -0400 Subject: [PATCH 064/154] Delete class/common directory --- class/common/Breadcrumb.php | 76 ---------- class/common/Configurator.php | 58 -------- class/common/FilesManagement.php | 243 ------------------------------- class/common/ServerStats.php | 78 ---------- class/common/VersionChecks.php | 148 ------------------- class/common/index.html | 1 - 6 files changed, 604 deletions(-) delete mode 100644 class/common/Breadcrumb.php delete mode 100644 class/common/Configurator.php delete mode 100644 class/common/FilesManagement.php delete mode 100644 class/common/ServerStats.php delete mode 100644 class/common/VersionChecks.php delete mode 100644 class/common/index.html diff --git a/class/common/Breadcrumb.php b/class/common/Breadcrumb.php deleted file mode 100644 index c7621a8d..00000000 --- a/class/common/Breadcrumb.php +++ /dev/null @@ -1,76 +0,0 @@ - - * @package rssfit - * - * Example: - * $breadcrumb = new PedigreeBreadcrumb(); - * $breadcrumb->addLink( 'bread 1', 'index1.php' ); - * $breadcrumb->addLink( 'bread 2', '' ); - * $breadcrumb->addLink( 'bread 3', 'index3.php' ); - * echo $breadcrumb->render(); - */ -defined('XOOPS_ROOT_PATH') || die('XOOPS Root Path not defined'); - -/** - * Class Breadcrumb - */ -class Breadcrumb -{ - public $dirname; - private $bread = []; - - public function __construct() - { - $this->dirname = basename(dirname(dirname(__DIR__))); - } - - /** - * Add link to breadcrumb - * - * @param string $title - * @param string $link - */ - public function addLink($title = '', $link = '') - { - $this->bread[] = [ - 'link' => $link, - 'title' => $title, - ]; - } - - /** - * Render Pedigree BreadCrumb - */ - public function render() - { - if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) { - require_once $GLOBALS['xoops']->path('class/theme.php'); - $GLOBALS['xoTheme'] = new \xos_opal_Theme(); - } - - require_once $GLOBALS['xoops']->path('class/template.php'); - $breadcrumbTpl = new \XoopsTpl(); - $breadcrumbTpl->assign('breadcrumb', $this->bread); - $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl'); - unset($breadcrumbTpl); - - return $html; - } -} diff --git a/class/common/Configurator.php b/class/common/Configurator.php deleted file mode 100644 index 2031f5a4..00000000 --- a/class/common/Configurator.php +++ /dev/null @@ -1,58 +0,0 @@ -name = $config->name; - $this->paths = $config->paths; - $this->uploadFolders = $config->uploadFolders; - $this->copyBlankFiles = $config->copyBlankFiles; - $this->copyTestFolders = $config->copyTestFolders; - $this->templateFolders = $config->templateFolders; - $this->oldFiles = $config->oldFiles; - $this->oldFolders = $config->oldFolders; - $this->renameTables = $config->renameTables; - $this->modCopyright = $config->modCopyright; - } -} diff --git a/class/common/FilesManagement.php b/class/common/FilesManagement.php deleted file mode 100644 index 2d7d84f1..00000000 --- a/class/common/FilesManagement.php +++ /dev/null @@ -1,243 +0,0 @@ - - */ -trait FilesManagement -{ - /** - * Function responsible for checking if a directory exists, we can also write in and create an index.html file - * - * @param string $folder The full path of the directory to check - */ - public static function createFolder($folder) - { - try { - if (!file_exists($folder)) { - if (!is_dir($folder) && !mkdir($folder) && !is_dir($folder)) { - throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder)); - } - - file_put_contents($folder . '/index.html', ''); - } - } catch (\Exception $e) { - echo 'Caught exception: ', $e->getMessage(), "\n", '
      '; - } - } - - /** - * @param $file - * @param $folder - * @return bool - */ - public static function copyFile($file, $folder) - { - return copy($file, $folder); - } - - /** - * @param $src - * @param $dst - */ - public static function recurseCopy($src, $dst) - { - $dir = opendir($src); - // @mkdir($dst); - if (!@mkdir($dst) && !is_dir($dst)) { - throw new \RuntimeException('The directory ' . $dst . ' could not be created.'); - } - while (false !== ($file = readdir($dir))) { - if (('.' !== $file) && ('..' !== $file)) { - if (is_dir($src . '/' . $file)) { - self::recurseCopy($src . '/' . $file, $dst . '/' . $file); - } else { - copy($src . '/' . $file, $dst . '/' . $file); - } - } - } - closedir($dir); - } - - /** - * Remove files and (sub)directories - * - * @param string $src source directory to delete - * - * @uses \Xmf\Module\Helper::getHelper() - * @uses \Xmf\Module\Helper::isUserAdmin() - * - * @return bool true on success - */ - public static function deleteDirectory($src) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - $success = true; - // remove old files - $dirInfo = new \SplFileInfo($src); - // validate is a directory - if ($dirInfo->isDir()) { - $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']); - foreach ($fileList as $k => $v) { - $fileInfo = new \SplFileInfo("{$src}/{$v}"); - if ($fileInfo->isDir()) { - // recursively handle subdirectories - if (!$success = self::deleteDirectory($fileInfo->getRealPath())) { - break; - } - } elseif (!($success = unlink($fileInfo->getRealPath()))) { - break; - } - } - - // now delete this (sub)directory if all the files are gone - if ($success) { - $success = rmdir($dirInfo->getRealPath()); - } - } else { - // input is not a valid directory - $success = false; - } - - return $success; - } - - /** - * Recursively remove directory - * - * @todo currently won't remove directories with hidden files, should it? - * - * @param string $src directory to remove (delete) - * - * @return bool true on success - */ - public static function rrmdir($src) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - // If source is not a directory stop processing - if (!is_dir($src)) { - return false; - } - - $success = true; - - // Open the source directory to read in files - $iterator = new \DirectoryIterator($src); - foreach ($iterator as $fObj) { - if ($fObj->isFile()) { - $filename = $fObj->getPathname(); - $fObj = null; // clear this iterator object to close the file - if (!unlink($filename)) { - return false; // couldn't delete the file - } - } elseif (!$fObj->isDot() && $fObj->isDir()) { - // Try recursively on directory - self::rrmdir($fObj->getPathname()); - } - } - $iterator = null; // clear iterator Obj to close file/directory - return rmdir($src); // remove the directory & return results - } - - /** - * Recursively move files from one directory to another - * - * @param string $src - Source of files being moved - * @param string $dest - Destination of files being moved - * - * @return bool true on success - */ - public static function rmove($src, $dest) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - // If source is not a directory stop processing - if (!is_dir($src)) { - return false; - } - - // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { - return false; - } - - // Open the source directory to read in files - $iterator = new \DirectoryIterator($src); - foreach ($iterator as $fObj) { - if ($fObj->isFile()) { - rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - } elseif (!$fObj->isDot() && $fObj->isDir()) { - // Try recursively on directory - self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - // rmdir($fObj->getPath()); // now delete the directory - } - } - $iterator = null; // clear iterator Obj to close file/directory - return rmdir($src); // remove the directory & return results - } - - /** - * Recursively copy directories and files from one directory to another - * - * @param string $src - Source of files being moved - * @param string $dest - Destination of files being moved - * - * @uses \Xmf\Module\Helper::getHelper() - * @uses \Xmf\Module\Helper::isUserAdmin() - * - * @return bool true on success - */ - public static function rcopy($src, $dest) - { - // Only continue if user is a 'global' Admin - if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { - return false; - } - - // If source is not a directory stop processing - if (!is_dir($src)) { - return false; - } - - // If the destination directory does not exist and could not be created stop processing - if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) { - return false; - } - - // Open the source directory to read in files - $iterator = new \DirectoryIterator($src); - foreach ($iterator as $fObj) { - if ($fObj->isFile()) { - copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - } elseif (!$fObj->isDot() && $fObj->isDir()) { - self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename()); - } - } - - return true; - } -} diff --git a/class/common/ServerStats.php b/class/common/ServerStats.php deleted file mode 100644 index 488ccf31..00000000 --- a/class/common/ServerStats.php +++ /dev/null @@ -1,78 +0,0 @@ - - */ -trait ServerStats -{ - /** - * serverStats() - * - * @return string - */ - public static function getServerStats() - { - //mb $wfdownloads = WfdownloadsWfdownloads::getInstance(); - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - xoops_loadLanguage('common', $moduleDirName); - $html = ''; - // $sql = 'SELECT metavalue'; - // $sql .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta'); - // $sql .= " WHERE metakey='version' LIMIT 1"; - // $query = $GLOBALS['xoopsDB']->query($sql); - // list($meta) = $GLOBALS['xoopsDB']->fetchRow($query); - $html .= "
      " . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "\n"; - $html .= "
      \n"; - // $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
      \n"; - // $html .= "
      \n"; - // $html .= "
      \n"; - $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "
      \n"; - $html .= "
        \n"; - - $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; - if (function_exists('gd_info')) { - if (true === ($gdlib = gd_info())) { - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; - } - } - // - // $safemode = ini_get('safe_mode') ? constant('CO_' . $moduleDirNameUpper . '_ON') . constant('CO_' . $moduleDirNameUpper . '_SAFEMODEPROBLEMS : constant('CO_' . $moduleDirNameUpper . '_OFF'); - // $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SAFEMODESTATUS . $safemode; - // - // $registerglobals = (!ini_get('register_globals')) ? "" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . constant('CO_' . $moduleDirNameUpper . '_ON') . ''; - // $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; - // - $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . "\n"; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . "\n"; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . "\n"; - $html .= "
      \n"; - $html .= "
        \n"; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . "\n"; - $html .= "
      \n"; - $html .= "
      \n"; - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; - $html .= '
      '; - $html .= '

      '; - - return $html; - } -} diff --git a/class/common/VersionChecks.php b/class/common/VersionChecks.php deleted file mode 100644 index 7881e904..00000000 --- a/class/common/VersionChecks.php +++ /dev/null @@ -1,148 +0,0 @@ - - */ -trait VersionChecks -{ - /** - * Verifies XOOPS version meets minimum requirements for this module - * @static - * @param \XoopsModule $module - * - * @param null|string $requiredVer - * @return bool true if meets requirements, false if not - */ - public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - if (null === $module) { - $module = \XoopsModule::getByDirname($moduleDirName); - } - xoops_loadLanguage('admin', $moduleDirName); - xoops_loadLanguage('common', $moduleDirName); - - //check for minimum XOOPS version - $currentVer = mb_substr(XOOPS_VERSION, 6); // get the numeric part of string - if (null === $requiredVer) { - $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string - } - $success = true; - - if (version_compare($currentVer, $requiredVer, '<')) { - $success = false; - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); - } - - return $success; - } - - /** - * Verifies PHP version meets minimum requirements for this module - * @static - * - * @param \XoopsModule|null $module - * @return bool true if meets requirements, false if not - */ - public static function checkVerPhp(\XoopsModule $module = null) - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - if (null === $module) { - $module = \XoopsModule::getByDirname($moduleDirName); - } - xoops_loadLanguage('admin', $moduleDirName); - xoops_loadLanguage('common', $moduleDirName); - - // check for minimum PHP version - $success = true; - - $verNum = PHP_VERSION; - $reqVer = &$module->getInfo('min_php'); - - if (false !== $reqVer && '' !== $reqVer) { - if (version_compare($verNum, $reqVer, '<')) { - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); - $success = false; - } - } - - return $success; - } - - /** - * compares current module version with latest GitHub release - * @static - * @param \Xmf\Module\Helper $helper - * @param string|null $source - * @param string|null $default - * - * @return string|array info about the latest module version, if newer - */ - public static function checkVerModule($helper, $source = 'github', $default = 'master') - { - $moduleDirName = basename(dirname(dirname(__DIR__))); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - $update = ''; - $repository = 'XoopsModules25x/' . $moduleDirName; - // $repository = 'XoopsModules25x/publisher'; //for testing only - $ret = ''; - $infoReleasesUrl = "https://api.github.com/repos/$repository/releases"; - if ('github' === $source) { - if (function_exists('curl_init') && false !== ($curlHandle = curl_init())) { - curl_setopt($curlHandle, CURLOPT_URL, $infoReleasesUrl); - curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($curlHandle, CURLOPT_HTTPHEADER, ["User-Agent:Publisher\r\n"]); - $curlReturn = curl_exec($curlHandle); - if (false === $curlReturn) { - trigger_error(curl_error($curlHandle)); - } elseif (false !== mb_strpos($curlReturn, 'Not Found')) { - trigger_error('Repository Not Found: ' . $infoReleasesUrl); - } else { - $file = json_decode($curlReturn, false); - $latestVersionLink = sprintf("https://github.com/$repository/archive/%s.zip", $file ? reset($file)->tag_name : $default); - $latestVersion = $file[0]->tag_name; - $prerelease = $file[0]->prerelease; - if ('master' !== $latestVersionLink) { - $update = constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; - } - //"PHP-standardized" version - $latestVersion = mb_strtolower($latestVersion); - if (false !== mb_strpos($latestVersion, 'final')) { - $latestVersion = str_replace('_', '', mb_strtolower($latestVersion)); - $latestVersion = str_replace('final', '', mb_strtolower($latestVersion)); - } - $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); - //"PHP-standardized" version - $moduleVersion = str_replace(' ', '', mb_strtolower($moduleVersion)); - // $moduleVersion = '1.0'; //for testing only - // $moduleDirName = 'publisher'; //for testing only - if (!$prerelease && version_compare($moduleVersion, $latestVersion, '<')) { - $ret = []; - $ret[] = $update; - $ret[] = $latestVersionLink; - } - } - curl_close($curlHandle); - } - } - - return $ret; - } -} diff --git a/class/common/index.html b/class/common/index.html deleted file mode 100644 index 990cbd60..00000000 --- a/class/common/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file From 2c34dc7fbce048878ace0bb741aa8134e44581ce Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 13 Oct 2021 02:36:26 -0400 Subject: [PATCH 065/154] updates --- README.md | 7 +- admin/about.php | 14 +- admin/admin_footer.php | 6 +- admin/admin_header.php | 24 +- admin/do_about.php | 37 +++ admin/do_channel.php | 31 ++- admin/do_intro.php | 43 +-- admin/do_migrate.php | 111 ++++++++ admin/do_plugins.php | 103 +++---- admin/do_sticky.php | 32 ++- admin/do_subfeeds.php | 55 ++-- admin/index.php | 43 ++- admin/menu.php | 24 +- admin/migrate.php | 24 +- assets/css/index.html | 1 - assets/css/index.php | 3 + assets/images/icons/16/index.html | 1 - assets/images/icons/16/index.php | 2 + assets/images/icons/32/index.html | 1 - assets/images/icons/32/index.php | 2 + assets/images/icons/index.html | 1 - assets/images/icons/index.php | 2 + assets/images/index.html | 1 - assets/images/index.php | 2 + assets/index.html | 1 - assets/index.php | 3 + assets/js/index.html | 1 - assets/js/index.php | 2 + class/Common/Breadcrumb.php | 30 +- class/Common/Configurator.php | 42 +-- class/Common/FilesManagement.php | 61 ++-- class/Common/Migrate.php | 110 +++++--- class/Common/ServerStats.php | 32 +-- class/Common/SysUtility.php | 309 ++++++++++++++++++--- class/Common/TestdataButtons.php | 74 +++++ class/Common/VersionChecks.php | 81 +++--- class/Common/index.html | 1 - class/Common/index.php | 2 + class/Constants.php | 24 +- class/FeedHandler.php | 149 +++++----- class/Helper.php | 33 ++- class/Misc.php | 15 +- class/MiscHandler.php | 99 +++---- class/Plugin.php | 30 +- class/PluginHandler.php | 130 ++++----- class/Plugins/Adslight.php | 12 +- class/Plugins/Ams.php | 29 +- class/Plugins/Apcal.php | 10 +- class/Plugins/Buyersguide.php | 14 +- class/Plugins/Buyersguidemanufacturers.php | 24 +- class/Plugins/Buyersguidenews.php | 24 +- class/Plugins/Cbb.php | 119 -------- class/Plugins/{00 => }/Comments.php | 57 ++-- class/Plugins/Extcal.php | 29 +- class/Plugins/Lexikon.php | 27 +- class/Plugins/Myalbum.php | 58 ++-- class/Plugins/Mydownloads.php | 30 +- class/Plugins/Mylinks.php | 10 +- class/Plugins/Mytube.php | 28 +- class/Plugins/Newbb.php | 10 +- class/Plugins/Newbb2.php | 152 ---------- class/Plugins/News.php | 43 +-- class/Plugins/Oledrion.php | 22 +- class/Plugins/Pical.php | 30 +- class/Plugins/Publisher.php | 31 ++- class/Plugins/Queries.php | 10 +- class/Plugins/Rmdp.php | 9 +- class/Plugins/Sample.php | 20 +- class/Plugins/Smartfaq.php | 23 +- class/Plugins/Smartpartner.php | 24 +- class/Plugins/Smartsection.php | 32 ++- class/Plugins/Special.php | 12 +- class/Plugins/Surnames.php | 20 +- class/Plugins/Weblinks.php | 18 +- class/Plugins/Wfdownloads.php | 16 +- class/Plugins/Wfdownloads_podcast.php | 18 +- class/Plugins/Wflinks.php | 18 +- class/Plugins/Wfsection.php | 16 +- class/Plugins/Wfsection2.php | 14 +- class/Plugins/Xoopstube.php | 28 +- class/Utility.php | 30 +- class/index.html | 1 - class/index.php | 2 + config/config.php | 142 +++++----- config/icons.php | 19 ++ config/imageconfig.php | 42 +++ config/index.html | 1 - config/index.php | 3 + config/paths.php | 39 +-- docs/changelog.txt | 5 +- docs/index.html | 1 - docs/index.php | 2 + header.php | 7 +- include/common.php | 67 +++-- include/common0.php | 2 +- include/index.html | 1 - include/index.php | 2 + include/install.php | 50 ++-- include/oninstall.php | 19 +- include/onuninstall.php | 3 +- include/onupdate.php | 22 +- index.php | 22 +- language/english/common.php | 268 +++++++++--------- language/english/help/index.html | 1 - language/english/help/index.php | 2 + language/english/index.html | 1 - language/english/index.php | 2 + language/english/modinfo.php | 2 +- language/index.html | 1 - language/index.php | 2 + preloads/autoloader.php | 4 +- preloads/index.html | 1 - preloads/index.php | 3 + rss.php | 19 +- sql/index.html | 1 - sql/index.php | 2 + sql/rss_1.31.0_migrate.yml | 68 +++++ sql/rssfit_1.31_migrate.yml | 68 +++++ templates/index.html | 1 - templates/index.php | 2 + templates/rssfit_index.tpl | 4 +- templates/rssfit_rss.tpl | 68 ++--- testdata/index.html | 1 - testdata/index.php | 152 ++++++++-- tests/index.html | 1 - tests/index.php | 3 + xoops_version.php | 204 +++++++------- 127 files changed, 2428 insertions(+), 1771 deletions(-) create mode 100644 admin/do_about.php create mode 100644 admin/do_migrate.php delete mode 100644 assets/css/index.html create mode 100644 assets/css/index.php delete mode 100644 assets/images/icons/16/index.html create mode 100644 assets/images/icons/16/index.php delete mode 100644 assets/images/icons/32/index.html create mode 100644 assets/images/icons/32/index.php delete mode 100644 assets/images/icons/index.html create mode 100644 assets/images/icons/index.php delete mode 100644 assets/images/index.html create mode 100644 assets/images/index.php delete mode 100644 assets/index.html create mode 100644 assets/index.php delete mode 100644 assets/js/index.html create mode 100644 assets/js/index.php create mode 100644 class/Common/TestdataButtons.php delete mode 100644 class/Common/index.html create mode 100644 class/Common/index.php delete mode 100644 class/Plugins/Cbb.php rename class/Plugins/{00 => }/Comments.php (51%) delete mode 100644 class/Plugins/Newbb2.php delete mode 100644 class/index.html create mode 100644 class/index.php create mode 100644 config/icons.php create mode 100644 config/imageconfig.php delete mode 100644 config/index.html create mode 100644 config/index.php delete mode 100644 docs/index.html create mode 100644 docs/index.php delete mode 100644 include/index.html create mode 100644 include/index.php delete mode 100644 language/english/help/index.html create mode 100644 language/english/help/index.php delete mode 100644 language/english/index.html create mode 100644 language/english/index.php delete mode 100644 language/index.html create mode 100644 language/index.php delete mode 100644 preloads/index.html create mode 100644 preloads/index.php delete mode 100644 sql/index.html create mode 100644 sql/index.php create mode 100644 sql/rss_1.31.0_migrate.yml create mode 100644 sql/rssfit_1.31_migrate.yml delete mode 100644 templates/index.html create mode 100644 templates/index.php delete mode 100644 testdata/index.html delete mode 100644 tests/index.html create mode 100644 tests/index.php diff --git a/README.md b/README.md index 8eb1283b..176a2ecf 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,11 @@ -![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png) -## RSSFit module for [XOOPS CMS 2.5.9+](https://xoops.org) +![alt XOOPS CMS](https://xoops.org/images/logoXoopsPhp8.png) +## RSSFit module for [XOOPS CMS 2.5.10+](https://xoops.org) [![XOOPS CMS Module](https://img.shields.io/badge/XOOPS%20CMS-Module-blue.svg)](https://xoops.org) [![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](https://www.gnu.org/licenses/gpl-2.0.html) [![Scrutinizer Code Quality](https://img.shields.io/scrutinizer/g/XoopsModules25x/rss.svg?style=flat)](https://scrutinizer-ci.com/g/XoopsModules25x/rssfit/?branch=master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/95b12220e0ac4056b9af52af708379c9)](https://www.codacy.com/app/mambax7/rss_2) [![Code Climate](https://img.shields.io/codeclimate/github/XoopsModules25x/rss.svg?style=flat)](https://codeclimate.com/github/XoopsModules25x/rss) -[![SensioLabsInsight](https://insight.sensiolabs.com/projects/f4ebd84f-65c1-4947-afb8-319b60824d2e/mini.png)](https://insight.sensiolabs.com/projects/f4ebd84f-65c1-4947-afb8-319b60824d2e) [![Latest Pre-Release](https://img.shields.io/github/tag/XoopsModules25x/rss.svg?style=flat)](https://github.com/XoopsModules25x/rssfit/tags/) [![Latest Version](https://img.shields.io/github/release/XoopsModules25x/rss.svg?style=flat)](https://github.com/XoopsModules25x/rssfit/releases/) @@ -19,4 +18,4 @@ To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/ Please visit us on https://xoops.org -Current and upcoming "next generation" versions of XOOPS CMS are being crafted on GitHub at: https://github.com/XOOPS +Current and upcoming "next generation" versions of XOOPS CMS are crafted on GitHub at: https://github.com/XOOPS diff --git a/admin/about.php b/admin/about.php index 0f63a989..c03b9b06 100644 --- a/admin/about.php +++ b/admin/about.php @@ -12,14 +12,18 @@ /** * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @package - * @since - * @author XOOPS Development Team + * @author XOOPS Development Team */ -require_once __DIR__ . '/admin_header.php'; + +use Xmf\Module\Admin; +/** @var Admin $adminObject */ + +require __DIR__ . '/admin_header.php'; + +//xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); $adminObject::setPaypal('xoopsfoundation@gmail.com'); $adminObject->displayAbout(false); -require_once __DIR__ . '/admin_footer.php'; +require __DIR__ . '/admin_footer.php'; diff --git a/admin/admin_footer.php b/admin/admin_footer.php index 9865c38e..b3014f56 100644 --- a/admin/admin_footer.php +++ b/admin/admin_footer.php @@ -12,11 +12,9 @@ /** * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @package - * @since - * @author XOOPS Development Team + * @author XOOPS Development Team */ -$pathIcon32 = Xmf\Module\Admin::iconUrl('', 32); +$pathIcon32 = Xmf\Module\Admin::iconUrl('', '32'); echo "
      \n" . "
      \n" . " XOOPS\n" . "
      \n" . ' ' . _AM_MODULEADMIN_ADMIN_FOOTER . "\n" . '
      '; diff --git a/admin/admin_header.php b/admin/admin_header.php index a9bd407e..6a066fb7 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -12,23 +12,27 @@ /** * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @package - * @since * @author XOOPS Development Team */ -include dirname(__DIR__) . '/preloads/autoloader.php'; -require dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; -require dirname(__DIR__) . '/include/common.php'; +use Xmf\Module\Admin; +use XoopsModules\Rssfit\{ + Helper +}; -$moduleDirName = basename(dirname(__DIR__)); +/** @var Helper $helper */ +/** @var Admin $adminObject */ -$helper = \XoopsModules\Rssfit\Helper::getInstance(); +require \dirname(__DIR__) . '/preloads/autoloader.php'; -/** @var \Xmf\Module\Admin $adminObject */ -$adminObject = \Xmf\Module\Admin::getInstance(); +require \dirname(__DIR__, 3) . '/include/cp_header.php'; +require \dirname(__DIR__) . '/include/common.php'; -//$thisModuleDir = $GLOBALS['xoopsModule']->getVar('dirname'); +$helper = Helper::getInstance(); +$adminObject = Admin::getInstance(); + +$moduleDirName = $helper->getDirname(); +$moduleDirNameUpper = mb_strtoupper($moduleDirName); // Load language files $helper->loadLanguage('admin'); diff --git a/admin/do_about.php b/admin/do_about.php new file mode 100644 index 00000000..85031517 --- /dev/null +++ b/admin/do_about.php @@ -0,0 +1,37 @@ +displayNavigation(basename(__FILE__)); +Admin::setPaypal('xoopsfoundation@gmail.com'); +$adminObject->displayAbout(false); + +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/do_channel.php b/admin/do_channel.php index f70a66ae..aef4281a 100644 --- a/admin/do_channel.php +++ b/admin/do_channel.php @@ -10,14 +10,19 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) * @author XOOPS Development Team */ + use Xmf\Request; -use XoopsModules\Rssfit; +use XoopsModules\Rssfit\{ + FeedHandler, + Utility +}; +/** @var FeedHandler $feedHandler */ if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { header('Location: index.php'); @@ -26,15 +31,15 @@ switch ($op) { default: $elements = $feedHandler->miscHandler->getObjects2(new \Criteria('misc_category', 'channel'), '*', 'title'); - $img = $feedHandler->miscHandler->getObjects2(new \Criteria('misc_category', 'channelimg'), '*', 'title'); + $img = $feedHandler->miscHandler->getObjects2(new \Criteria('misc_category', 'channelimg'), '*', 'title'); if (!empty($elements) && !empty($img)) { $form = new \XoopsThemeForm(_AM_RSSFIT_EDIT_CHANNEL, 'editchannel', RSSFIT_ADMIN_URL); - $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_REQUIRED . ' ' . Rssfit\Utility::genSpecMoreInfo('req', $feedHandler))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_REQUIRED . ' ' . Utility::genSpecMoreInfo('req', $feedHandler))); $form->addElement(new \XoopsFormText('title', 'ele[' . $elements['title']->getVar('misc_id') . ']', 50, 255, $elements['title']->getVar('misc_content', 'e')), true); $form->addElement(new \XoopsFormText('link', 'ele[' . $elements['link']->getVar('misc_id') . ']', 50, 255, $elements['link']->getVar('misc_content', 'e')), true); $form->addElement(new \XoopsFormTextArea('description', 'ele[' . $elements['description']->getVar('misc_id') . ']', $elements['description']->getVar('misc_content', 'e')), true); - $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_OPTIONAL . ' ' . Rssfit\Utility::genSpecMoreInfo('opt', $feedHandler))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_OPTIONAL . ' ' . Utility::genSpecMoreInfo('opt', $feedHandler))); $form->addElement(new \XoopsFormText('copyright', 'ele[' . $elements['copyright']->getVar('misc_id') . ']', 50, 255, $elements['copyright']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('managingEditor', 'ele[' . $elements['managingEditor']->getVar('misc_id') . ']', 50, 255, $elements['managingEditor']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('webMaster', 'ele[' . $elements['webMaster']->getVar('misc_id') . ']', 50, 255, $elements['webMaster']->getVar('misc_content', 'e'))); @@ -42,13 +47,13 @@ $form->addElement(new \XoopsFormText('generator', 'ele[' . $elements['generator']->getVar('misc_id') . ']', 50, 255, $elements['generator']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('docs', 'ele[' . $elements['docs']->getVar('misc_id') . ']', 50, 255, $elements['docs']->getVar('misc_content', 'e'))); - $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_IMAGE . ' ' . Rssfit\Utility::genSpecMoreInfo('img', $feedHandler))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_IMAGE . ' ' . Utility::genSpecMoreInfo('img', $feedHandler))); $form->addElement(new \XoopsFormText('url', 'ele[' . $img['url']->getVar('misc_id') . ']', 50, 255, $img['url']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('link', 'ele[' . $img['link']->getVar('misc_id') . ']', 50, 255, $img['link']->getVar('misc_content', 'e'))); $form->addElement(new \XoopsFormText('title', 'ele[' . $img['title']->getVar('misc_id') . ']', 50, 255, $img['title']->getVar('misc_content', 'e'))); - $form->addElement($tray_save_cancel); - $form->addElement($hidden_do); + $form->addElement($saveCancelTray); + $form->addElement($hiddenDo); $form->addElement(new \XoopsFormHidden('op', 'save')); $form->display(); } else { @@ -56,13 +61,13 @@ } break; case 'save': - $ele = Request::getArray('ele', null, 'POST'); - $ids = array_keys($ele); + $ele = Request::getArray('ele', null, 'POST'); + $ids = array_keys($ele); $errors = []; foreach ($ids as $i) { $criteria = new \Criteria('misc_id', $i); - $fields = ['misc_content' => trim($ele[$i])]; - $err = $feedHandler->miscHandler->modifyObjects($criteria, $fields); + $fields = ['misc_content' => trim($ele[$i])]; + $err = $feedHandler->miscHandler->modifyObjects($criteria, $fields); if ($err) { $errors[] = $err; } @@ -72,7 +77,7 @@ echo $e . "

      \n"; } } else { - redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); + redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); } break; } diff --git a/admin/do_intro.php b/admin/do_intro.php index 1556dfa3..170c0854 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -10,13 +10,18 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) * @author XOOPS Development Team */ -use XoopsModules\Rssfit; + +use Xmf\Request; +use XoopsModules\Rssfit\{ + MiscHandler +}; +/** @var MiscHandler $miscHandler */ if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { header('Location: index.php'); @@ -31,29 +36,29 @@ } switch ($op) { default: - $title = new \XoopsFormText(_AM_RSSFIT_EDIT_INTRO_TITLE, 'title', 50, 255, $intro->getVar('misc_title', 'e')); - $title->setDescription(_AM_RSSFIT_EDIT_INTRO_TITLE_DESC); + $title = new \XoopsFormText(_AM_EDIT_INTRO_TITLE, 'title', 50, 255, $intro->getVar('misc_title', 'e')); + $title->setDescription(_AM_EDIT_INTRO_TITLE_DESC); - $setting = $intro->getVar('misc_setting'); - $tray_content = new \XoopsFormElementTray(_AM_RSSFIT_EDIT_INTRO_TEXT, '
      '); - $tray_content->setDescription(_AM_RSSFIT_EDIT_INTRO_TEXT_DESC . _AM_RSSFIT_EDIT_INTRO_TEXT_DESC_SUB); - $tray_content->addElement(new \XoopsFormDhtmlTextArea('', 'content', $intro->getVar('misc_content', 'e'), 15, 60)); - $dohtml = new \XoopsFormCheckbox('', 'dohtml', $setting['dohtml']); + $setting = $intro->getVar('misc_setting'); + $contentTray = new \XoopsFormElementTray(_AM_RSSFIT_EDIT_INTRO_TEXT, '
      '); + $contentTray->setDescription(_AM_RSSFIT_EDIT_INTRO_TEXT_DESC . _AM_RSSFIT_EDIT_INTRO_TEXT_DESC_SUB); + $contentTray->addElement(new \XoopsFormDhtmlTextArea('', 'content', $intro->getVar('misc_content', 'e'), 15, 60)); + $dohtml = new \XoopsFormCheckbox('', 'dohtml', $setting['dohtml']??''); $dohtml->addOption(1, _AM_RSSFIT_DO_HTML); - $tray_content->addElement($dohtml); - $dobr = new \XoopsFormCheckbox('', 'dobr', $setting['dobr']); + $contentTray->addElement($dohtml); + $dobr = new \XoopsFormCheckbox('', 'dobr', $setting['dobr']??''); $dobr->addOption(1, _AM_RSSFIT_DO_BR); - $tray_content->addElement($dobr); + $contentTray->addElement($dobr); - $sub = new \XoopsFormTextArea(_AM_RSSFIT_EDIT_INTRO_SUB, 'sub', $myts->htmlSpecialChars($myts->stripSlashesGPC($setting['sub']))); + $sub = new \XoopsFormTextArea(_AM_RSSFIT_EDIT_INTRO_SUB, 'sub', htmlspecialchars($setting['sub']??'', ENT_QUOTES | ENT_HTML5)); $sub->setDescription(_AM_RSSFIT_EDIT_INTRO_SUB_DESC); $form = new \XoopsThemeForm(_AM_RSSFIT_EDIT_INTRO, 'editintro', RSSFIT_ADMIN_URL); $form->addElement($title); - $form->addElement($tray_content); + $form->addElement($contentTray); $form->addElement($sub); - $form->addElement($tray_save_cancel); - $form->addElement($hidden_do); + $form->addElement($saveCancelTray); + $form->addElement($hiddenDo); $form->addElement(new \XoopsFormHidden('op', 'save')); $form->display(); break; @@ -63,14 +68,14 @@ $intro->setVar('misc_content', $_POST['content']); $setting = [ 'dohtml' => isset($_POST['dohtml']) ? 1 : 0, - 'dobr' => isset($_POST['dobr']) ? 1 : 0, - 'sub' => isset($_POST['sub']) ? trim($_POST['sub']) : '', + 'dobr' => isset($_POST['dobr']) ? 1 : 0, + 'sub' => isset($_POST['sub']) ? trim($_POST['sub']) : '', ]; $intro->setVar('misc_setting', $setting); if (false === $miscHandler->insert($intro)) { echo $intro->getHtmlErrors(); } else { - redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); + redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); } break; } diff --git a/admin/do_migrate.php b/admin/do_migrate.php new file mode 100644 index 00000000..3770c8b4 --- /dev/null +++ b/admin/do_migrate.php @@ -0,0 +1,111 @@ + // +// ------------------------------------------------------------------------ // +// This program is free software; you can redistribute it and/or modify // +// it under the terms of the GNU General Public License as published by // +// the Free Software Foundation; either version 2 of the License, or // +// (at your option) any later version. // +// // +// 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. See the // +// GNU General Public License for more details. // +// // +// You should have received a copy of the GNU General Public License // +// along with this program; if not, write to the Free Software // +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // +// ------------------------------------------------------------------------ // +// Author: Kazumi Ono (AKA onokazu) // +// URL: http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ // +// Project: XOOPS Project // +// ------------------------------------------------------------------------- // + +use Xmf\Module\Admin; +use Xmf\Request; +use XoopsModules\Rssfit\{ + Common\Configurator, + Common\Migrate +}; +/** @var Admin $adminObject */ +/** @var Configurator $configurator */ +/** @var Migrate $migrator */ + +if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { + header('Location: index.php'); +} + +require_once __DIR__ . '/admin_header.php'; +//xoops_cp_header(); + +$adminObject->displayNavigation(basename(__FILE__)); + +echo << +
      + +
      +
      + +
      +
      + +
      + +EOF; + +//XoopsLoad::load('migrate', 'newbb'); + +$configurator = new Configurator(); + +$migrator = new Migrate($configurator); + +$op = Request::getCmd('op', 'show'); +$opShow = Request::getCmd('show', null, 'POST'); +$opMigrate = Request::getCmd('migrate', null, 'POST'); +$opSchema = Request::getCmd('schema', null, 'POST'); +$op = !empty($opShow) ? 'show' : $op; +$op = !empty($opMigrate) ? 'migrate' : $op; +$op = !empty($opSchema) ? 'schema' : $op; + +$message = ''; + +switch ($op) { + case 'show': + default: + $queue = $migrator->getSynchronizeDDL(); + if (!empty($queue)) { + echo "
      \n";
      +            foreach ($queue as $line) {
      +                echo $line . ";\n";
      +            }
      +            echo "
      \n"; + } + break; + case 'migrate': + $migrator->synchronizeSchema(); + $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_OK'); + break; + case 'schema': + xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); + break; + case 'confirmwrite': + if ($GLOBALS['xoopsSecurity']->check()) { + $migrator->saveCurrentSchema(); + + $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_SCHEMA_OK'); + } + break; +} + +echo "
      $message
      "; + +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/do_plugins.php b/admin/do_plugins.php index ed5b0fda..7ef06714 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -10,20 +10,26 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) * @author XOOPS Development Team */ + use Xmf\Request; -use XoopsModules\Rssfit; +use XoopsModules\Rssfit\{ + Helper, + PluginHandler +}; +/** @var PluginHandler $pluginHandler */ if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { header('Location: index.php'); } -$helper = Rssfit\Helper::getInstance(); +/** @varHelper $helper */ +$helper = Helper::getInstance(); switch ($op) { default: @@ -55,10 +61,10 @@ foreach ($plugins as $p) { $handler = $pluginHandler->checkPlugin($p); if ($handler) { - $id = $p->getVar('rssf_conf_id'); + $id = $p->getVar('rssf_conf_id'); $entries = new \XoopsFormText('', 'rssf_grab[' . $id . ']', 3, 2, $p->getVar('rssf_grab')); - $order = new \XoopsFormText('', 'rssf_order[' . $id . ']', 3, 2, $p->getVar('rssf_order')); - $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); + $order = new \XoopsFormText('', 'rssf_order[' . $id . ']', 3, 2, $p->getVar('rssf_order')); + $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); $action->addOption('', _SELECT); $action->addOption('d', _AM_RSSFIT_PLUGIN_DEACTIVATE); $action->addOption('u', _AM_RSSFIT_PLUGIN_UNINSTALL); @@ -104,22 +110,23 @@ . "\n" . "\n"; foreach ($plugins as $p) { - $id = $p->getVar('rssf_conf_id'); + $id = $p->getVar('rssf_conf_id'); $action = new \XoopsFormSelect('', 'action[' . $id . ']', ''); $action->addOption('', _SELECT); - $ret .= "
      \n" . "\n" . "\n" . "\n" . "\n"; $action->addOption('u', _AM_RSSFIT_PLUGIN_UNINSTALL); $ret .= "\n"; @@ -131,17 +138,11 @@ if (!$filelist = &$pluginHandler->getPluginFileList()) { $filelist = []; } -// $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'plugins'); - $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'class\Plugins'); + $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'class/Plugins'); $installable = []; -// foreach ($list as $f) { -// if (preg_match('/rssfit\.+[a-zA-Z0-9_]+\.php$/', $f) && !in_array($f, $filelist)) { -// $installable[] = $f; -// } -// } foreach ($list as $f) { - if (preg_match('/[a-zA-Z0-9_]+\.php$/', ucfirst($f)) && !in_array($f, $filelist)) { - $installable[] = ucfirst($f); + if (preg_match('/[a-zA-Z0-9_]+\.php/', $f) && !in_array($f, $filelist)) { + $installable[] = $f; } } if (count($installable) > 0) { @@ -163,7 +164,7 @@ $action = new \XoopsFormCheckbox('', 'install[' . $i . ']'); $action->addOption('i', ' '); $ret .= "\n" . "\n" . "
      " @@ -45,8 +45,8 @@ . "
      " . $p->getVar('rssf_filename') . ""; + $ret .= "
      " . $p->getVar('rssf_filename') . ""; $handler = $pluginHandler->checkPlugin($p); if ($handler) { $ret .= $handler->modname; $action->addOption('a', _AM_RSSFIT_PLUGIN_ACTIVATE); } elseif (count($p->getErrors()) > 0) { - $ret .= '' . _ERRORS . "\n"; - foreach ($p->getErrors() as $e) { - $ret .= '
      ' . $e; - } - } else { - $ret .= '' . _AM_RSSFIT_PLUGIN_UNKNOWNERROR . ''; + $ret .= '' . _ERRORS . "\n"; + foreach ($p->getErrors() as $e) { + $ret .= '
      ' . $e; } + } else { + $ret .= '' . _AM_RSSFIT_PLUGIN_UNKNOWNERROR . ''; + } + $ret .= "
      " . $action->render() . "
      " . $i . ""; - $p = $pluginHandler->create(); + $p = $pluginHandler->create(); $p->setVar('rssf_filename', $i); $handler = $pluginHandler->checkPlugin($p); if ($handler) { @@ -187,50 +188,50 @@ if (!empty($ret)) { $hidden = new \XoopsFormHidden('op', 'save'); - $ret = "
      \n" . $ret . "
      \n" - . $tray_save_cancel->render() + . $saveCancelTray->render() . "\n" . $hidden->render() . "\n" - . $hidden_do->render() + . $hiddenDo->render() . "\n
      "; echo $ret; } break; case 'save': - $rssf_grab = Request::getArray('rssf_grab', [], 'POST'); + $rssf_grab = Request::getArray('rssf_grab', [], 'POST'); $rssf_order = Request::getArray('rssf_order', [], 'POST'); - $action = Request::getArray('action', null, 'POST'); - $install = Request::getArray('install', [], 'POST'); - $err = ''; + $action = Request::getArray('action', null, 'POST'); + $install = Request::getArray('install', [], 'POST'); + $err = ''; if (isset($action)) { $keys = array_keys($action); foreach ($keys as $k) { $plugin = $pluginHandler->get($k); if ($plugin) { - if (isset($rssf_grab[$k])) { - $plugin->setVar('rssf_grab', $rssf_grab[$k]); - $plugin->setVar('rssf_order', $rssf_order[$k]); - } - switch ($action[$k]) { - default: - $result = $pluginHandler->insert($plugin); - break; - case 'u': // uninstall - $result = $pluginHandler->delete($plugin); - break; - case 'd': // deactivate - $plugin->setVar('rssf_activated', 0); - $result = $pluginHandler->insert($plugin); - break; - case 'a': // activate - $plugin->setVar('rssf_activated', 1); - $result = $pluginHandler->insert($plugin); - break; + if (isset($rssf_grab[$k])) { + $plugin->setVar('rssf_grab', $rssf_grab[$k]); + $plugin->setVar('rssf_order', $rssf_order[$k]); + } + switch ($action[$k]) { + default: + $result = $pluginHandler->insert($plugin); + break; + case 'u': // uninstall + $result = $pluginHandler->delete($plugin); + break; + case 'd': // deactivate + $plugin->setVar('rssf_activated', 0); + $result = $pluginHandler->insert($plugin); + break; + case 'a': // activate + $plugin->setVar('rssf_activated', 1); + $result = $pluginHandler->insert($plugin); + break; } } if (!$result) { @@ -260,7 +261,7 @@ if (!empty($err)) { echo $err; } else { - redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); + redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); } break; } diff --git a/admin/do_sticky.php b/admin/do_sticky.php index 9074d39a..29bf7045 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -10,12 +10,14 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) * @author XOOPS Development Team */ + +use Xmf\Request; use XoopsModules\Rssfit; if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { @@ -35,28 +37,28 @@ $title = new \XoopsFormText(_AM_RSSFIT_STICKY_TITLE, 'title', 50, 255, $sticky->getVar('misc_title', 'e')); $title->setDescription(_AM_RSSFIT_EDIT_INTRO_TITLE_DESC); - $tray_content = new \XoopsFormElementTray(_AM_RSSFIT_STICKY_CONTENT, '
      '); - $tray_content->setDescription(_AM_RSSFIT_EDIT_INTRO_TEXT_DESC); + $contentTray = new \XoopsFormElementTray(_AM_RSSFIT_STICKY_CONTENT, '
      '); + $contentTray->setDescription(_AM_RSSFIT_EDIT_INTRO_TEXT_DESC); $content = new \XoopsFormTextArea('', 'content', $sticky->getVar('misc_content', 'e'), 10); - $tray_content->addElement($content); + $contentTray->addElement($content); $dohtml = new \XoopsFormCheckbox('', 'dohtml', $setting['dohtml']); $dohtml->addOption(1, _AM_RSSFIT_DO_HTML); - $tray_content->addElement($dohtml); + $contentTray->addElement($dohtml); $dobr = new \XoopsFormCheckbox('', 'dobr', $setting['dobr']); $dobr->addOption(1, _AM_RSSFIT_DO_BR); - $tray_content->addElement($dobr); + $contentTray->addElement($dobr); - $link = new \XoopsFormText(_AM_RSSFIT_STICKY_LINK, 'link', 50, 255, $myts->htmlSpecialChars($myts->stripSlashesGPC($setting['link']))); + $link = new \XoopsFormText(_AM_RSSFIT_STICKY_LINK, 'link', 50, 255, htmlspecialchars($setting['link']??'', ENT_QUOTES | ENT_HTML5)); - $applyto = $feedHandler->feedSelectBox(_AM_RSSFIT_STICKY_APPLYTO, $setting['feeds'], 10); + $applyto = $feedHandler->feedSelectBox(_AM_RSSFIT_STICKY_APPLYTO, $setting['feeds']??'', 10); $form = new \XoopsThemeForm(_AM_RSSFIT_STICKY_EDIT, 'editsticky', RSSFIT_ADMIN_URL); $form->addElement($title); - $form->addElement($tray_content); + $form->addElement($contentTray); $form->addElement($link); $form->addElement($applyto); - $form->addElement($tray_save_cancel); - $form->addElement($hidden_do); + $form->addElement($saveCancelTray); + $form->addElement($hiddenDo); $form->addElement(new \XoopsFormHidden('op', 'save')); $form->display(); break; @@ -71,15 +73,15 @@ } $setting = [ 'dohtml' => isset($_POST['dohtml']) ? 1 : 0, - 'dobr' => isset($_POST['dobr']) ? 1 : 0, - 'feeds' => $feeds, - 'link' => isset($_POST['link']) ? trim($_POST['link']) : '', + 'dobr' => isset($_POST['dobr']) ? 1 : 0, + 'feeds' => $feeds, + 'link' => isset($_POST['link']) ? trim($_POST['link']) : '', ]; $sticky->setVar('misc_setting', $setting, true); if (false === $miscHandler->insert($sticky)) { echo $sticky->getHtmlErrors(); } else { - redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); + redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); } break; } diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index f03ba229..6b2f8e22 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -10,14 +10,17 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) * @author XOOPS Development Team */ + use Xmf\Request; -use XoopsModules\Rssfit; +use XoopsModules\Rssfit\{ + Utility +}; if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { header('Location: index.php'); @@ -25,7 +28,7 @@ switch ($op) { default: - $ret = ''; + $ret = ''; $plugins = $pluginHandler->getObjects2(null, 'sublist'); if ($plugins) { $ret .= "
      \n\n" @@ -47,16 +50,16 @@ $id = $p->getVar('rssf_conf_id'); if (!$handler = $pluginHandler->checkPlugin($p)) { $pluginHandler->forceDeactivate($p); - $mod = implode('
      ', $p->getErrors()); + $mod = implode('
      ', $p->getErrors()); $activate = new \XoopsFormCheckbox('', 'activate[' . $id . ']', 0); $activate->setExtra('disabled="disabled"'); - $config = ' '; + $config = ' '; $urlLink = $feedHandler->subFeedUrl($p->getVar('rssf_filename')); } else { - $mod = $handler->modname; + $mod = $handler->modname; $activate = new \XoopsFormCheckbox('', 'activate[' . $id . ']', $p->getVar('subfeed')); - $config = Rssfit\Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_RSSFIT_SUB_CONFIGURE); - $urlLink = '' . $feedHandler->subFeedUrl($p->getVar('rssf_filename')) . ''; + $config = Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_RSSFIT_SUB_CONFIGURE); + $urlLink = '' . $feedHandler->subFeedUrl($p->getVar('rssf_filename')) . ''; } $activate->addOption(1, ' '); $ret .= "\n" @@ -76,18 +79,18 @@ . "\n"; $ret .= "\n"; } - $ret .= "
      \n"; + $ret .= "
      \n"; $hidden = new \XoopsFormHidden('op', 'save'); - $ret = "
      \n" . $ret . "
      \n" - . $tray_save_cancel->render() + . $saveCancelTray->render() . "\n" . $hidden->render() . "\n" - . $hidden_do->render() + . $hiddenDo->render() . "\n
      "; echo $ret; } else { @@ -101,11 +104,11 @@ if ($plugins) { $pluginHandler->modifyObjects(null, ['subfeed' => 0]); if (isset($activate) && is_array($activate) && count($activate) > 0) { - $keys = array_keys($activate); + $keys = array_keys($activate); $criteria = new \Criteria('rssf_conf_id', '(' . implode(',', $keys) . ')', 'IN'); $pluginHandler->modifyObjects($criteria, ['subfeed' => 1]); } - redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); + redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); } else { redirect_header(RSSFIT_ADMIN_URL, 0, _AM_RSSFIT_PLUGIN_NONE); } @@ -125,20 +128,20 @@ $form->addElement(new \XoopsFormRadioYN(_AM_RSSFIT_SUB_ACTIVATE, 'subfeed', $sub->getVar('subfeed'))); $form->addElement(new \XoopsFormText(_AM_RSSFIT_PLUGIN_SHOWXENTRIES, 'sub_entries', 3, 2, $sub->getVar('sub_entries')), true); - $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_REQUIRED . ' ' . Rssfit\Utility::genSpecMoreInfo('req', $feedHandler))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_REQUIRED . ' ' . Utility::genSpecMoreInfo('req', $feedHandler))); $form->addElement(new \XoopsFormText('title', 'sub_title', 50, 255, $sub->getVar('sub_title', 'e')), true); $form->addElement(new \XoopsFormText('link', 'sub_link', 50, 255, $sub->getVar('sub_link', 'e')), true); $form->addElement(new \XoopsFormTextArea('description', 'sub_desc', $sub->getVar('sub_desc', 'e')), true); - $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_IMAGE . ' ' . Rssfit\Utility::genSpecMoreInfo('img', $feedHandler))); + $form->addElement(new \XoopsFormLabel('', '' . _AM_RSSFIT_EDIT_CHANNEL_IMAGE . ' ' . Utility::genSpecMoreInfo('img', $feedHandler))); $form->addElement(new \XoopsFormText('url', 'img_url', 50, 255, $sub->getVar('img_url', 'e'))); $form->addElement(new \XoopsFormText('link', 'img_link', 50, 255, $sub->getVar('img_link', 'e'))); $form->addElement(new \XoopsFormText('title', 'img_title', 50, 255, $sub->getVar('img_title', 'e'))); $form->addElement(new \XoopsFormHidden('feed', $id)); $form->addElement(new \XoopsFormHidden('op', 'savefeed')); - $form->addElement($hidden_do); - $form->addElement($tray_save_cancel); + $form->addElement($hiddenDo); + $form->addElement($saveCancelTray); $form->display(); break; case 'savefeed': @@ -153,14 +156,14 @@ redirect_header(RSSFIT_ADMIN_URL, 0, _AM_RSSFIT_SUB_PLUGIN_NONE); } - $subfeed = Request::getBool('subfeed', false, 'POST'); + $subfeed = Request::getBool('subfeed', false, 'POST'); $sub_entries = Request::getInt('sub_entries', 5, 'POST'); - $sub_title = Request::getString('sub_title', '', 'POST'); - $sub_link = Request::getUrl('sub_link', '', 'POST'); - $sub_desc = Request::getString('sub_desc', '', 'POST'); - $img_url = Request::getUrl('img_url', '', 'POST'); - $img_link = Request::getUrl('img_link', '', 'POST'); - $img_title = Request::getString('img_title', '', 'POST'); + $sub_title = Request::getString('sub_title', '', 'POST'); + $sub_link = Request::getUrl('sub_link', '', 'POST'); + $sub_desc = Request::getString('sub_desc', '', 'POST'); + $img_url = Request::getUrl('img_url', '', 'POST'); + $img_link = Request::getUrl('img_link', '', 'POST'); + $img_title = Request::getString('img_title', '', 'POST'); $sub->setVar('subfeed', (int)$subfeed); $sub->setVar('sub_entries', $sub_entries); @@ -171,7 +174,7 @@ $sub->setVar('img_link', $img_link); $sub->setVar('img_title', $img_title); if (false !== $pluginHandler->insert($sub)) { - redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_DBUPDATED); + redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); } else { echo $sub->getHtmlErrors(); } diff --git a/admin/index.php b/admin/index.php index 77813275..6e170619 100644 --- a/admin/index.php +++ b/admin/index.php @@ -12,16 +12,28 @@ /** * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @package - * @since - * @author XOOPS Development Team + * @author XOOPS Development Team */ + +use Xmf\Request; +use XoopsModules\Rssfit\{ + Common, + Helper, + Utility +}; + +/** @var Helper $helper */ +/** @var Utility $utility */ +/** @var \Xmf\Module\Admin $adminObject */ + require_once __DIR__ . '/admin_header.php'; -$do = isset($_GET['do']) ? trim($_GET['do']) : ''; -$do = isset($_POST['do']) ? trim($_POST['do']) : $do; -$op = isset($_GET['op']) ? trim($_GET['op']) : 'list'; -$op = isset($_POST['op']) ? trim($_POST['op']) : $op; +$helper = Helper::getInstance(); +$utility = new Utility(); + +$do = Request::getString('do', ''); +$op = Request::getString('op', 'list'); + //$do = \Xmf\Request::getString('do', ''); //$op = \Xmf\Request::getString('op', \Xmf\Request::getString('op', 'list', 'GET'), 'POST'); @@ -31,19 +43,20 @@ if (file_exists(RSSFIT_ROOT_PATH . 'admin/do_' . $do . '.php')) { require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; - $hidden_do = new \XoopsFormHidden('do', $do); - $button_save = new \XoopsFormButton('', 'submit', _AM_RSSFIT_SAVE, 'submit'); - $button_go = new \XoopsFormButton('', 'submit', _GO, 'submit'); - $button_cancel = new \XoopsFormButton('', 'cancel', _CANCEL); - $button_cancel->setExtra('onclick="javascript:history.go(-1)"'); - $tray_save_cancel = new \XoopsFormElementTray('', ''); - $tray_save_cancel->addElement($button_save); - $tray_save_cancel->addElement($button_cancel); + $hiddenDo = new \XoopsFormHidden('do', $do); + $buttonSave = new \XoopsFormButton('', 'submit', _AM_RSSFIT_SAVE, 'submit'); + $buttonSubmit = new \XoopsFormButton('', 'submit', _GO, 'submit'); + $buttonCancel = new \XoopsFormButton('', 'cancel', _CANCEL); + $buttonCancel->setExtra('onclick="javascript:history.go(-1)"'); + $saveCancelTray = new \XoopsFormElementTray('', ''); + $saveCancelTray->addElement($buttonSave); + $saveCancelTray->addElement($buttonCancel); $adminObject->displayNavigation('?do=' . $do); require RSSFIT_ROOT_PATH . 'admin/do_' . $do . '.php'; } else { $adminObject->displayNavigation(basename(__FILE__)); $adminObject->displayIndex(); + echo $utility::getServerStats(); } require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/menu.php b/admin/menu.php index 42a3932e..05d917a2 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -16,21 +16,27 @@ * @since * @author XOOPS Development Team */ -use XoopsModules\Rssfit; -//require_once dirname(__DIR__) . '/include/common.php'; +use Xmf\Module\Admin; +use XoopsModules\Rssfit\{ + Helper +}; -$moduleDirName = basename(dirname(__DIR__)); +/** @var Admin $adminObject */ +/** @var Helper $helper */ + +$moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); -$helper = \XoopsModules\Rssfit\Helper::getInstance(); +$helper = Helper::getInstance(); $helper->loadLanguage('common'); $helper->loadLanguage('feedback'); // get path to icons -$pathIcon32 = \Xmf\Module\Admin::menuIconPath(''); -if (is_object($helper->getModule())) { - $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); +$pathIcon32 = Admin::menuIconPath(''); +$pathModIcon32 = XOOPS_URL . '/modules/' . $moduleDirName . '/assets/images/icons/32/'; +if (is_object($helper->getModule()) && false !== $helper->getModule()->getInfo('modicons32')) { + $pathModIcon32 = $helper->url($helper->getModule()->getInfo('modicons32')); } $adminmenu = []; @@ -75,7 +81,7 @@ 'icon' => $pathIcon32 . '/attach.png', ]; -if ($helper->getConfig('displayDeveloperTools')) { +if (is_object($helper->getModule()) && $helper->getConfig('displayDeveloperTools')) { $adminmenu[] = [ 'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE'), 'link' => 'admin/migrate.php', @@ -85,6 +91,6 @@ $adminmenu[] = [ 'title' => _MI_RSSFIT_ABOUT, - 'link' => 'admin/about.php', + 'link' => 'admin/?do=about', 'icon' => $pathIcon32 . '/about.png', ]; diff --git a/admin/migrate.php b/admin/migrate.php index 14611281..a4dfb7cf 100644 --- a/admin/migrate.php +++ b/admin/migrate.php @@ -29,10 +29,18 @@ // Project: XOOPS Project // // ------------------------------------------------------------------------- // +use Xmf\Module\Admin; use Xmf\Request; -use XoopsModules\Rssfit; +use XoopsModules\Rssfit\{ + Common\Configurator, + Common\Migrate +}; +/** @var Admin $adminObject */ +/** @var Configurator $configurator */ +/** @var Migrate $migrator */ require_once __DIR__ . '/admin_header.php'; +//xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); @@ -52,11 +60,11 @@ //XoopsLoad::load('migrate', 'newbb'); -$configurator = new Rssfit\Common\Configurator(); +$configurator = new Configurator(); -$migrator = new \XoopsModules\Rssfit\Common\Migrate($configurator); +$migrator = new Migrate($configurator); -$op = Request::getCmd('op', 'default'); +$op = Request::getCmd('op', 'show'); $opShow = Request::getCmd('show', null, 'POST'); $opMigrate = Request::getCmd('migrate', null, 'POST'); $opSchema = Request::getCmd('schema', null, 'POST'); @@ -68,6 +76,7 @@ switch ($op) { case 'show': + default: $queue = $migrator->getSynchronizeDDL(); if (!empty($queue)) { echo "
      \n";
      @@ -79,15 +88,16 @@
               break;
           case 'migrate':
               $migrator->synchronizeSchema();
      -        $message = 'Database migrated to current schema.';
      +        $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_OK');
               break;
           case 'schema':
      -        xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', 'Warning! This is intended for developers only. Confirm write schema file from current database.', 'Confirm');
      +        xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'));
               break;
           case 'confirmwrite':
               if ($GLOBALS['xoopsSecurity']->check()) {
                   $migrator->saveCurrentSchema();
      -            $message = 'Current schema file written';
      +
      +            $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_SCHEMA_OK');
               }
               break;
       }
      diff --git a/assets/css/index.html b/assets/css/index.html
      deleted file mode 100644
      index 74b6f45c..00000000
      --- a/assets/css/index.html
      +++ /dev/null
      @@ -1 +0,0 @@
      -
      \ No newline at end of file
      diff --git a/assets/css/index.php b/assets/css/index.php
      new file mode 100644
      index 00000000..2ea9b7d9
      --- /dev/null
      +++ b/assets/css/index.php
      @@ -0,0 +1,3 @@
      +history.go(-1);
      diff --git a/assets/images/icons/16/index.php b/assets/images/icons/16/index.php
      new file mode 100644
      index 00000000..6a505435
      --- /dev/null
      +++ b/assets/images/icons/16/index.php
      @@ -0,0 +1,2 @@
      +history.go(-1);
      diff --git a/assets/images/icons/32/index.php b/assets/images/icons/32/index.php
      new file mode 100644
      index 00000000..6a505435
      --- /dev/null
      +++ b/assets/images/icons/32/index.php
      @@ -0,0 +1,2 @@
      +history.go(-1);
      diff --git a/assets/images/icons/index.php b/assets/images/icons/index.php
      new file mode 100644
      index 00000000..6a505435
      --- /dev/null
      +++ b/assets/images/icons/index.php
      @@ -0,0 +1,2 @@
      +history.go(-1);
      diff --git a/assets/images/index.php b/assets/images/index.php
      new file mode 100644
      index 00000000..6a505435
      --- /dev/null
      +++ b/assets/images/index.php
      @@ -0,0 +1,2 @@
      +history.go(-1);
      \ No newline at end of file
      diff --git a/assets/index.php b/assets/index.php
      new file mode 100644
      index 00000000..2ea9b7d9
      --- /dev/null
      +++ b/assets/index.php
      @@ -0,0 +1,3 @@
      +history.go(-1);
      diff --git a/assets/js/index.php b/assets/js/index.php
      new file mode 100644
      index 00000000..6a505435
      --- /dev/null
      +++ b/assets/js/index.php
      @@ -0,0 +1,2 @@
      +addLink( 'bread 3', 'index3.php' );
        * echo $breadcrumb->render();
        */
      -defined('XOOPS_ROOT_PATH') || die('XOOPS Root Path not defined');
       
       /**
        * Class Breadcrumb
        */
       class Breadcrumb
       {
      -    public $dirname;
      +    public  $dirname;
           private $bread = [];
       
           public function __construct()
           {
      -        $this->dirname = basename(dirname(dirname(__DIR__)));
      +        $this->dirname = \basename(\dirname(__DIR__, 2));
           }
       
           /**
      @@ -50,27 +52,39 @@ public function __construct()
           public function addLink($title = '', $link = '')
           {
               $this->bread[] = [
      -            'link' => $link,
      +            'link'  => $link,
                   'title' => $title,
               ];
           }
       
           /**
      -     * Render Pedigree BreadCrumb
      +     * Render BreadCrumb
            */
           public function render()
           {
      -        if (!isset($GLOBALS['xoTheme']) || !is_object($GLOBALS['xoTheme'])) {
      -            require_once $GLOBALS['xoops']->path('class/theme.php');
      +        /*
      +        TODO if you want to use the render code below,
      +        1) create ./templates/chess_common_breadcrumb.tpl)
      +        2) add declaration to  xoops_version.php
      +        */
      +        /*
      +        if (!isset($GLOBALS['xoTheme']) || !\is_object($GLOBALS['xoTheme'])) {
      +            require $GLOBALS['xoops']->path('class/theme.php');
      +
                   $GLOBALS['xoTheme'] = new \xos_opal_Theme();
               }
       
      -        require_once $GLOBALS['xoops']->path('class/template.php');
      +        require $GLOBALS['xoops']->path('class/template.php');
      +
               $breadcrumbTpl = new \XoopsTpl();
      +
               $breadcrumbTpl->assign('breadcrumb', $this->bread);
      +
               $html = $breadcrumbTpl->fetch('db:' . $this->dirname . '_common_breadcrumb.tpl');
      +
               unset($breadcrumbTpl);
       
               return $html;
      +        */
           }
       }
      diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php
      index 2031f5a4..fe576bc0 100644
      --- a/class/Common/Configurator.php
      +++ b/class/Common/Configurator.php
      @@ -17,8 +17,6 @@
        * @copyright   XOOPS Project (https://xoops.org)
        * @license     http://www.fsf.org/copyleft/gpl.html GNU public license
        * @author      XOOPS Development Team
      - * @package     Publisher
      - * @since       1.05
        */
       
       /**
      @@ -27,32 +25,42 @@
       class Configurator
       {
           public $name;
      -    public $paths = [];
      -    public $uploadFolders = [];
      -    public $copyBlankFiles = [];
      +    public $paths           = [];
      +    public $uploadFolders   = [];
      +    public $copyBlankFiles  = [];
           public $copyTestFolders = [];
           public $templateFolders = [];
      -    public $oldFiles = [];
      -    public $oldFolders = [];
      -    public $renameTables = [];
      +    public $oldFiles        = [];
      +    public $oldFolders      = [];
      +    public $renameTables    = [];
      +    public $renameColumns   = [];
      +    public $moduleStats     = [];
           public $modCopyright;
      +    public $icons;
       
           /**
            * Configurator constructor.
            */
           public function __construct()
           {
      -        $config = include dirname(dirname(__DIR__)) . '/config/config.php';
       
      -        $this->name = $config->name;
      -        $this->paths = $config->paths;
      -        $this->uploadFolders = $config->uploadFolders;
      -        $this->copyBlankFiles = $config->copyBlankFiles;
      +        $config = require \dirname(__DIR__, 2) . '/config/config.php';
      +
      +        $this->name            = $config->name;
      +        $this->paths           = $config->paths;
      +        $this->uploadFolders   = $config->uploadFolders;
      +        $this->copyBlankFiles  = $config->copyBlankFiles;
               $this->copyTestFolders = $config->copyTestFolders;
               $this->templateFolders = $config->templateFolders;
      -        $this->oldFiles = $config->oldFiles;
      -        $this->oldFolders = $config->oldFolders;
      -        $this->renameTables = $config->renameTables;
      -        $this->modCopyright = $config->modCopyright;
      +        $this->oldFiles        = $config->oldFiles;
      +        $this->oldFolders      = $config->oldFolders;
      +        $this->renameTables    = $config->renameTables;
      +        $this->renameColumns   = $config->renameColumns;
      +        $this->moduleStats     = $config->moduleStats;
      +        $this->modCopyright    = $config->modCopyright;
      +
      +        $this->icons = require \dirname(__DIR__, 2) . '/config/icons.php';
      +        $this->paths = require \dirname(__DIR__, 2) . '/config/paths.php';
      +
           }
       }
      diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php
      index 2d7d84f1..92e8c1be 100644
      --- a/class/Common/FilesManagement.php
      +++ b/class/Common/FilesManagement.php
      @@ -27,9 +27,9 @@ trait FilesManagement
           public static function createFolder($folder)
           {
               try {
      -            if (!file_exists($folder)) {
      -                if (!is_dir($folder) && !mkdir($folder) && !is_dir($folder)) {
      -                    throw new \RuntimeException(sprintf('Unable to create the %s directory', $folder));
      +            if (!\is_dir($folder)) {
      +                if (!\is_dir($folder) && !\mkdir($folder) && !\is_dir($folder)) {
      +                    throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder));
                       }
       
                       file_put_contents($folder . '/index.html', '');
      @@ -46,7 +46,7 @@ public static function createFolder($folder)
            */
           public static function copyFile($file, $folder)
           {
      -        return copy($file, $folder);
      +        return \copy($file, $folder);
           }
       
           /**
      @@ -55,21 +55,21 @@ public static function copyFile($file, $folder)
            */
           public static function recurseCopy($src, $dst)
           {
      -        $dir = opendir($src);
      +        $dir = \opendir($src);
               //        @mkdir($dst);
      -        if (!@mkdir($dst) && !is_dir($dst)) {
      +        if (!@\mkdir($dst) && !\is_dir($dst)) {
                   throw new \RuntimeException('The directory ' . $dst . ' could not be created.');
               }
      -        while (false !== ($file = readdir($dir))) {
      +        while (false !== ($file = \readdir($dir))) {
                   if (('.' !== $file) && ('..' !== $file)) {
      -                if (is_dir($src . '/' . $file)) {
      +                if (\is_dir($src . '/' . $file)) {
                           self::recurseCopy($src . '/' . $file, $dst . '/' . $file);
                       } else {
      -                    copy($src . '/' . $file, $dst . '/' . $file);
      +                    \copy($src . '/' . $file, $dst . '/' . $file);
                       }
                   }
               }
      -        closedir($dir);
      +        \closedir($dir);
           }
       
           /**
      @@ -77,10 +77,10 @@ public static function recurseCopy($src, $dst)
            *
            * @param string $src source directory to delete
            *
      -     * @uses \Xmf\Module\Helper::getHelper()
      +     * @return bool true on success
            * @uses \Xmf\Module\Helper::isUserAdmin()
            *
      -     * @return bool true on success
      +     * @uses \Xmf\Module\Helper::getHelper()
            */
           public static function deleteDirectory($src)
           {
      @@ -94,7 +94,7 @@ public static function deleteDirectory($src)
               $dirInfo = new \SplFileInfo($src);
               // validate is a directory
               if ($dirInfo->isDir()) {
      -            $fileList = array_diff(scandir($src, SCANDIR_SORT_NONE), ['..', '.']);
      +            $fileList = \array_diff(\scandir($src, \SCANDIR_SORT_NONE), ['..', '.']);
                   foreach ($fileList as $k => $v) {
                       $fileInfo = new \SplFileInfo("{$src}/{$v}");
                       if ($fileInfo->isDir()) {
      @@ -102,14 +102,13 @@ public static function deleteDirectory($src)
                           if (!$success = self::deleteDirectory($fileInfo->getRealPath())) {
                               break;
                           }
      -                } elseif (!($success = unlink($fileInfo->getRealPath()))) {
      -                        break;
      -                    }
      +                } elseif (!($success = \unlink($fileInfo->getRealPath()))) {
      +                    break;
                       }
      -
      +            }
                   // now delete this (sub)directory if all the files are gone
                   if ($success) {
      -                $success = rmdir($dirInfo->getRealPath());
      +                $success = \rmdir($dirInfo->getRealPath());
                   }
               } else {
                   // input is not a valid directory
      @@ -136,7 +135,7 @@ public static function rrmdir($src)
               }
       
               // If source is not a directory stop processing
      -        if (!is_dir($src)) {
      +        if (!\is_dir($src)) {
                   return false;
               }
       
      @@ -147,8 +146,8 @@ public static function rrmdir($src)
               foreach ($iterator as $fObj) {
                   if ($fObj->isFile()) {
                       $filename = $fObj->getPathname();
      -                $fObj = null; // clear this iterator object to close the file
      -                if (!unlink($filename)) {
      +                $fObj     = null; // clear this iterator object to close the file
      +                if (!\unlink($filename)) {
                           return false; // couldn't delete the file
                       }
                   } elseif (!$fObj->isDot() && $fObj->isDir()) {
      @@ -157,7 +156,7 @@ public static function rrmdir($src)
                   }
               }
               $iterator = null;   // clear iterator Obj to close file/directory
      -        return rmdir($src); // remove the directory & return results
      +        return \rmdir($src); // remove the directory & return results
           }
       
           /**
      @@ -176,12 +175,12 @@ public static function rmove($src, $dest)
               }
       
               // If source is not a directory stop processing
      -        if (!is_dir($src)) {
      +        if (!\is_dir($src)) {
                   return false;
               }
       
               // If the destination directory does not exist and could not be created stop processing
      -        if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) {
      +        if (!\is_dir($dest) && !\mkdir($dest) && !\is_dir($dest)) {
                   return false;
               }
       
      @@ -189,7 +188,7 @@ public static function rmove($src, $dest)
               $iterator = new \DirectoryIterator($src);
               foreach ($iterator as $fObj) {
                   if ($fObj->isFile()) {
      -                rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
      +                \rename($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
                   } elseif (!$fObj->isDot() && $fObj->isDir()) {
                       // Try recursively on directory
                       self::rmove($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
      @@ -197,7 +196,7 @@ public static function rmove($src, $dest)
                   }
               }
               $iterator = null;   // clear iterator Obj to close file/directory
      -        return rmdir($src); // remove the directory & return results
      +        return \rmdir($src); // remove the directory & return results
           }
       
           /**
      @@ -206,10 +205,10 @@ public static function rmove($src, $dest)
            * @param string $src  - Source of files being moved
            * @param string $dest - Destination of files being moved
            *
      -     * @uses \Xmf\Module\Helper::getHelper()
      +     * @return bool true on success
            * @uses \Xmf\Module\Helper::isUserAdmin()
            *
      -     * @return bool true on success
      +     * @uses \Xmf\Module\Helper::getHelper()
            */
           public static function rcopy($src, $dest)
           {
      @@ -219,12 +218,12 @@ public static function rcopy($src, $dest)
               }
       
               // If source is not a directory stop processing
      -        if (!is_dir($src)) {
      +        if (!\is_dir($src)) {
                   return false;
               }
       
               // If the destination directory does not exist and could not be created stop processing
      -        if (!is_dir($dest) && !mkdir($dest) && !is_dir($dest)) {
      +        if (!\is_dir($dest) && !\mkdir($dest) && !\is_dir($dest)) {
                   return false;
               }
       
      @@ -232,7 +231,7 @@ public static function rcopy($src, $dest)
               $iterator = new \DirectoryIterator($src);
               foreach ($iterator as $fObj) {
                   if ($fObj->isFile()) {
      -                copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
      +                \copy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
                   } elseif (!$fObj->isDot() && $fObj->isDir()) {
                       self::rcopy($fObj->getPathname(), "{$dest}/" . $fObj->getFilename());
                   }
      diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php
      index ba87801b..61252a7e 100644
      --- a/class/Common/Migrate.php
      +++ b/class/Common/Migrate.php
      @@ -12,6 +12,10 @@
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
        */
       
      +use \XoopsModules\Rssfit\{
      +    Common\Configurator
      +};
      +
       /**
        * Class Migrate synchronize existing tables with target schema
        *
      @@ -23,6 +27,8 @@
        */
       class Migrate extends \Xmf\Database\Migrate
       {
      +    private $moduleDirName;
      +    private $renameColumns;
           private $renameTables;
       
           /**
      @@ -33,14 +39,15 @@ class Migrate extends \Xmf\Database\Migrate
           public function __construct()
           {
               $class = __NAMESPACE__ . '\\' . 'Configurator';
      -        if (!class_exists($class)) {
      +        if (!\class_exists($class)) {
                   throw new \RuntimeException("Class '$class' not found");
               }
               $configurator = new $class();
               $this->renameTables = $configurator->renameTables;
      +        $this->renameColumns = $configurator->renameColumns;
       
      -        $moduleDirName = basename(dirname(dirname(__DIR__)));
      -        parent::__construct($moduleDirName);
      +        $this->moduleDirName = \basename(\dirname(__DIR__, 2));
      +        parent::__construct($this->moduleDirName);
           }
       
           /**
      @@ -48,11 +55,11 @@ public function __construct()
            */
           private function changePrefix()
           {
      -        foreach ($this->renameTables as $oldName => $newName) {
      -            if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) {
      -                $this->tableHandler->renameTable($oldName, $newName);
      -            }
      -        }
      +//        foreach ($this->renameTables as $oldName => $newName) {
      +//            if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) {
      +//                $this->tableHandler->renameTable($oldName, $newName);
      +//            }
      +//        }
           }
       
           /**
      @@ -63,35 +70,65 @@ private function changePrefix()
            */
           private function convertIPAddresses($tableName, $columnName)
           {
      -        if ($this->tableHandler->useTable($tableName)) {
      -            $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName);
      -            if (false !== mb_strpos($attributes, ' int(')) {
      -                if (false === mb_strpos($attributes, 'unsigned')) {
      -                    $this->tableHandler->alterColumn($tableName, $columnName, " bigint(16) NOT NULL  DEFAULT '0' ");
      -                    $this->tableHandler->update($tableName, [$columnName => "4294967296 + $columnName"], "WHERE $columnName < 0", false);
      +//        if ($this->tableHandler->useTable($tableName)) {
      +//            $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName);
      +//            if (false !== \mb_strpos($attributes, ' int(')) {
      +//                if (false === \mb_strpos($attributes, 'unsigned')) {
      +//                    $this->tableHandler->alterColumn($tableName, $columnName, " bigint(16) NOT NULL  DEFAULT '0' ");
      +//                    $this->tableHandler->update($tableName, [$columnName => "4294967296 + $columnName"], "WHERE $columnName < 0", false);
      +//                }
      +//                $this->tableHandler->alterColumn($tableName, $columnName, " varchar(45)  NOT NULL  DEFAULT '' ");
      +//                $this->tableHandler->update($tableName, [$columnName => "INET_NTOA($columnName)"], '', false);
      +//            }
      +//        }
      +    }
      +
      +    /**
      +     * @deprecated (just as an example here)
      +     * Move do* columns from newbb_posts to newbb_posts_text table
      +     */
      +    private function moveDoColumns()
      +    {
      +//        $tableName    = 'newbb_posts_text';
      +//        $srcTableName = 'newbb_posts';
      +//        if ($this->tableHandler->useTable($tableName)
      +//            && $this->tableHandler->useTable($srcTableName)) {
      +//            $attributes = $this->tableHandler->getColumnAttributes($tableName, 'dohtml');
      +//            if (false === $attributes) {
      +//                $this->synchronizeTable($tableName);
      +//                $updateTable = $GLOBALS['xoopsDB']->prefix($tableName);
      +//                $joinTable   = $GLOBALS['xoopsDB']->prefix($srcTableName);
      +//                $sql         = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n" . "SET t1.dohtml = t2.dohtml,  t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n" . '  , t1.doimage = t2.doimage, t1.dobr = t2.dobr';
      +//                $this->tableHandler->addToQueue($sql);
      +//            }
      +//        }
                       }
      -                $this->tableHandler->alterColumn($tableName, $columnName, " varchar(45)  NOT NULL  DEFAULT '' ");
      -                $this->tableHandler->update($tableName, [$columnName => "INET_NTOA($columnName)"], '', false);
      +
      +    /**
      +     * rename table if needed
      +     */
      +    private function renameTable()
      +    {
      +        foreach ($this->renameTables as $oldName => $newName) {
      +            if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) {
      +                $this->tableHandler->renameTable($oldName, $newName);
                   }
               }
           }
       
           /**
      -     * Move do* columns from newbb_posts to newbb_posts_text table
      +     * rename columns if needed
            */
      -    private function moveDoColumns()
      +    private function renameColumns()
           {
      -        $tableName = 'newbb_posts_text';
      -        $srcTableName = 'newbb_posts';
      -        if ($this->tableHandler->useTable($tableName)
      -            && $this->tableHandler->useTable($srcTableName)) {
      -            $attributes = $this->tableHandler->getColumnAttributes($tableName, 'dohtml');
      -            if (false === $attributes) {
      -                $this->synchronizeTable($tableName);
      -                $updateTable = $GLOBALS['xoopsDB']->prefix($tableName);
      -                $joinTable = $GLOBALS['xoopsDB']->prefix($srcTableName);
      -                $sql = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n" . "SET t1.dohtml = t2.dohtml,  t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n" . '  , t1.doimage = t2.doimage, t1.dobr = t2.dobr';
      -                $this->tableHandler->addToQueue($sql);
      +        foreach ($this->renameColumns as $tableName) {
      +            if ($this->tableHandler->useTable($tableName)) {
      +                $oldName = $tableName['from'];
      +                $newName = $tableName['to'];
      +                $attributes = $this->tableHandler->getColumnAttributes($tableName, $oldName);
      +                if (false !== \strpos($attributes, ' int(')) {
      +                    $this->tableHandler->alterColumn($tableName, $oldName, $attributes, $newName);
      +                }
                   }
               }
           }
      @@ -105,14 +142,21 @@ private function moveDoColumns()
            */
           protected function preSyncActions()
           {
      -        /*
               // change 'bb' table prefix to 'newbb'
               $this->changePrefix();
               // columns dohtml, dosmiley, doxcode, doimage and dobr moved between tables as some point
               $this->moveDoColumns();
               // Convert IP address columns from int to readable varchar(45) for IPv6
      -        $this->convertIPAddresses('newbb_posts', 'poster_ip');
      -        $this->convertIPAddresses('newbb_report', 'reporter_ip');
      -        */
      +//        $this->convertIPAddresses('newbb_posts', 'poster_ip');
      +//        $this->convertIPAddresses('newbb_report', 'reporter_ip');
      +
      +        // rename table
      +        if ($this->renameTables && \is_array($this->renameTables)) {
      +            $this->renameTable();
      +        }
      +        // rename column
      +        if ($this->renameColumns && \is_array($this->renameColumns)) {
      +            $this->renameColumns();
      +        }
           }
       }
      diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php
      index 488ccf31..c93eb76a 100644
      --- a/class/Common/ServerStats.php
      +++ b/class/Common/ServerStats.php
      @@ -27,28 +27,28 @@ trait ServerStats
           public static function getServerStats()
           {
               //mb    $wfdownloads = WfdownloadsWfdownloads::getInstance();
      -        $moduleDirName = basename(dirname(dirname(__DIR__)));
      +        $moduleDirName      = \basename(\dirname(__DIR__, 2));
               $moduleDirNameUpper = mb_strtoupper($moduleDirName);
      -        xoops_loadLanguage('common', $moduleDirName);
      +        \xoops_loadLanguage('common', $moduleDirName);
               $html = '';
               //        $sql   = 'SELECT metavalue';
               //        $sql   .= ' FROM ' . $GLOBALS['xoopsDB']->prefix('wfdownloads_meta');
               //        $sql   .= " WHERE metakey='version' LIMIT 1";
               //        $query = $GLOBALS['xoopsDB']->query($sql);
               //        list($meta) = $GLOBALS['xoopsDB']->fetchRow($query);
      -        $html .= "
      " . constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "\n"; + $html .= "
      " . \constant('CO_' . $moduleDirNameUpper . '_IMAGEINFO') . "\n"; $html .= "
      \n"; // $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_METAVERSION') . $meta . "
      \n"; // $html .= "
      \n"; // $html .= "
      \n"; - $html .= '
      ' . constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "
      \n"; + $html .= '
      ' . \constant('CO_' . $moduleDirNameUpper . '_SPHPINI') . "
      \n"; $html .= "
        \n"; - $gdlib = function_exists('gd_info') ? '' . constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; - if (function_exists('gd_info')) { - if (true === ($gdlib = gd_info())) { - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; + $gdlib = \function_exists('gd_info') ? '' . \constant('CO_' . $moduleDirNameUpper . '_GDON') . '' : '' . \constant('CO_' . $moduleDirNameUpper . '_GDOFF') . ''; + $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS') . $gdlib; + if (\function_exists('gd_info')) { + if (true == ($gdlib = gd_info())) { + $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; } } // @@ -58,18 +58,18 @@ public static function getServerStats() // $registerglobals = (!ini_get('register_globals')) ? "" . constant('CO_' . $moduleDirNameUpper . '_OFF') . '' : "" . constant('CO_' . $moduleDirNameUpper . '_ON') . ''; // $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_REGISTERGLOBALS . $registerglobals; // - $downloads = ini_get('file_uploads') ? '' . constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; + $downloads = \ini_get('file_uploads') ? '' . \constant('CO_' . $moduleDirNameUpper . '_ON') . '' : '' . \constant('CO_' . $moduleDirNameUpper . '_OFF') . ''; + $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS') . $downloads; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . ini_get('upload_max_filesize') . "\n"; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . ini_get('post_max_size') . "\n"; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . ini_get('memory_limit') . "\n"; + $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE') . ' ' . \ini_get('upload_max_filesize') . "\n"; + $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE') . ' ' . \ini_get('post_max_size') . "\n"; + $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT') . ' ' . \ini_get('memory_limit') . "\n"; $html .= "
      \n"; $html .= "
        \n"; - $html .= '
      • ' . constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . "\n"; + $html .= '
      • ' . \constant('CO_' . $moduleDirNameUpper . '_SERVERPATH') . ' ' . XOOPS_ROOT_PATH . "\n"; $html .= "
      \n"; $html .= "
      \n"; - $html .= constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; + $html .= \constant('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC') . "\n"; $html .= '
      '; $html .= '

      '; diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 07b9101d..59220539 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -15,15 +15,17 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -use XoopsModules\Rssfit\Helper; - /** + * * @license https://www.fsf.org/copyleft/gpl.html GNU public license * @copyright https://xoops.org 2000-2020 © XOOPS Project - * @author ZySpec + * @author ZySpec * @author Mamba */ +use XoopsModules\Rssfit; +use XoopsModules\Rssfit\Helper; + /** * Class SysUtility */ @@ -32,12 +34,178 @@ class SysUtility use VersionChecks; //checkVerXoops, checkVerPhp Traits use ServerStats; // getServerStats Trait use FilesManagement; // Files Management Trait +// use ModuleStats; // ModuleStats Trait + + //--------------- Common module methods ----------------------------- + + /** + * Access the only instance of this class + * + * @return SysUtility + * + */ + public static function getInstance(): SysUtility + { + static $instance; + if (null === $instance) { + $instance = new static(); + } + + return $instance; + } + + /** + * @param $text + * @param $form_sort + * @return string + */ + public static function selectSorting($text, $form_sort): string + { + global $start, $order, $sort; + + $select_view = ''; + $moduleDirName = \basename(\dirname(__DIR__)); + $helper = Helper::getInstance(); + + //$pathModIcon16 = XOOPS_URL . '/modules/' . $moduleDirName . '/' . $helper->getConfig('modicons16'); + $pathModIcon16 = $helper->url($helper->getModule()->getInfo('modicons16')); + + $select_view = '
      ' . $text . ''; + //$sorts = $sort == 'asc' ? 'desc' : 'asc'; + if ($form_sort == $sort) { + $sel1 = 'asc' === $order ? 'selasc.png' : 'asc.png'; + $sel2 = 'desc' === $order ? 'seldesc.png' : 'desc.png'; + } else { + $sel1 = 'asc.png'; + $sel2 = 'desc.png'; + } + $select_view .= ' ASC'; + $select_view .= 'DESC'; + $select_view .= '
      '; + + return $select_view; + } + + /***************Blocks***************/ + /** + * @param array $cats + * @return string + */ + public static function blockAddCatSelect(array $cats): string + { + $cat_sql = ''; + if (\is_array($cats) && !empty($cats)) { + $cat_sql = '(' . \current($cats); + \array_shift($cats); + foreach ($cats as $cat) { + $cat_sql .= ',' . $cat; + } + $cat_sql .= ')'; + } + + return $cat_sql; + } + + /** + * @param $content + */ + public static function metaKeywords($content): void + { + global $xoopsTpl, $xoTheme; + $myts = \MyTextSanitizer::getInstance(); + $content = $myts->undoHtmlSpecialChars($myts->displayTarea($content)); + if (\is_object($xoTheme)) { + $xoTheme->addMeta('meta', 'keywords', \strip_tags($content)); + } else { // Compatibility for old Xoops versions + $xoopsTpl->assign('xoops_metaKeywords', \strip_tags($content)); + } + } + + /** + * @param $content + */ + public static function metaDescription($content): void + { + global $xoopsTpl, $xoTheme; + $myts = \MyTextSanitizer::getInstance(); + $content = $myts->undoHtmlSpecialChars($myts->displayTarea($content)); + if (\is_object($xoTheme)) { + $xoTheme->addMeta('meta', 'description', \strip_tags($content)); + } else { // Compatibility for old Xoops versions + $xoopsTpl->assign('xoops_metaDescription', \strip_tags($content)); + } + } + + /** + * @param string $tableName + * @param string $columnName + * + * @return array|false + */ + public static function enumerate(string $tableName, string $columnName) + { + $table = $GLOBALS['xoopsDB']->prefix($tableName); + + // $result = $GLOBALS['xoopsDB']->query("SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS + // WHERE TABLE_NAME = '" . $table . "' AND COLUMN_NAME = '" . $columnName . "'") + // || exit ($GLOBALS['xoopsDB']->error()); + + $sql = 'SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = "' . $table . '" AND COLUMN_NAME = "' . $columnName . '"'; + $result = $GLOBALS['xoopsDB']->query($sql); + if (!$result) { +// exit($GLOBALS['xoopsDB']->error()); + $logger = \XoopsLogger::getInstance(); + $logger->handleError(\E_USER_WARNING, $sql, __FILE__, __LINE__); + return false; + } + + $row = $GLOBALS['xoopsDB']->fetchBoth($result); + $enumList = \explode(',', \str_replace("'", '', \mb_substr($row['COLUMN_TYPE'], 5, - 6))); + return $enumList; + } + + + /** + * Clone a record in a dB + * + * @TODO need to exit more gracefully on error. Should throw/trigger error and then return false + * + * @param string $tableName name of dB table (without prefix) + * @param string $idField name of field (column) in dB table + * @param int $id item id to clone + * + * @return mixed + */ + public static function cloneRecord(string $tableName, string $idField, int $id) + { + $newId = false; + $table = $GLOBALS['xoopsDB']->prefix($tableName); + // copy content of the record you wish to clone + $sql = "SELECT * FROM $table WHERE $idField='" . (int)$id . "' "; + $tempTable = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql), \MYSQLI_ASSOC); + if (!$tempTable) { + exit($GLOBALS['xoopsDB']->error()); + } + // set the auto-incremented id's value to blank. + unset($tempTable[$idField]); + // insert cloned copy of the original record + $sql = "INSERT INTO $table (" . \implode(', ', \array_keys($tempTable)) . ") VALUES ('" . \implode("', '", \array_values($tempTable)) . "')"; + $result = $GLOBALS['xoopsDB']->queryF($sql); + if (!$result) { + exit($GLOBALS['xoopsDB']->error()); + } + // Return the new id + return $GLOBALS['xoopsDB']->getInsertId(); + } /** * truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags * www.gsdesign.ro/blog/cut-html-string-without-breaking-the-tags * www.cakephp.org * + * @TODO: Refactor to consider HTML5 & void (self-closing) elements + * @TODO: Consider using https://github.com/jlgrall/truncateHTML/blob/master/truncateHTML.php + * * @param string $text String to truncate. * @param int $length Length of returned string, including ellipsis. * @param string $ending Ending to be appended to the trimmed string. @@ -46,60 +214,66 @@ class SysUtility * * @return string Trimmed string. */ - public static function truncateHtml($text, $length = 100, $ending = '...', $exact = false, $considerHtml = true) - { + public static function truncateHtml( + string $text, + ?int $length = 100, + ?string $ending = '...', + ?bool $exact = false, + ?bool $considerHtml = true + ): string { + $openTags = []; if ($considerHtml) { // if the plain text is shorter than the maximum length, return the whole text - if (mb_strlen(preg_replace('/<.*?' . '>/', '', $text)) <= $length) { + if (\mb_strlen(\preg_replace('/<.*?' . '>/', '', $text)) <= $length) { return $text; } // splits all html-tags to scanable lines - preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, PREG_SET_ORDER); - $total_length = mb_strlen($ending); - $open_tags = []; + \preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, \PREG_SET_ORDER); + $total_length = \mb_strlen($ending); + //$openTags = []; $truncate = ''; foreach ($lines as $line_matchings) { // if there is any html-tag in this line, handle it and add it (uncounted) to the output if (!empty($line_matchings[1])) { // if it's an "empty element" with or without xhtml-conform closing slash - if (preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) { + if (\preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) { // do nothing // if tag is a closing tag - } elseif (preg_match('/^<\s*\/([^\s]+?)\s*>$/s', $line_matchings[1], $tag_matchings)) { - // delete tag from $open_tags list - $pos = array_search($tag_matchings[1], $open_tags, true); + } elseif (\preg_match('/^<\s*\/(\S+?)\s*>$/s', $line_matchings[1], $tag_matchings)) { + // delete tag from $openTags list + $pos = \array_search($tag_matchings[1], $openTags, true); if (false !== $pos) { - unset($open_tags[$pos]); + unset($openTags[$pos]); } // if tag is an opening tag - } elseif (preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { - // add tag to the beginning of $open_tags list - array_unshift($open_tags, mb_strtolower($tag_matchings[1])); + } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { + // add tag to the beginning of $openTags list + \array_unshift($openTags, \mb_strtolower($tag_matchings[1])); } // add html-tag to $truncate'd text $truncate .= $line_matchings[1]; } // calculate the length of the plain text part of the line; handle entities as one character - $content_length = mb_strlen(preg_replace('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', ' ', $line_matchings[2])); + $content_length = \mb_strlen(\preg_replace('/&[0-9a-z]{2,8};|&#\d{1,7};|[0-9a-f]{1,6};/i', ' ', $line_matchings[2])); if ($total_length + $content_length > $length) { // the number of characters which are left $left = $length - $total_length; $entities_length = 0; // search for html entities - if (preg_match_all('/&[0-9a-z]{2,8};|&#[0-9]{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, PREG_OFFSET_CAPTURE)) { + if (\preg_match_all('/&[0-9a-z]{2,8};|&#\d{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, \PREG_OFFSET_CAPTURE)) { // calculate the real length of all entities in the legal range foreach ($entities[0] as $entity) { if ($left >= $entity[1] + 1 - $entities_length) { $left--; - $entities_length += mb_strlen($entity[0]); + $entities_length += \mb_strlen($entity[0]); } else { // no more characters left break; } } } - $truncate .= mb_substr($line_matchings[2], 0, $left + $entities_length); - // maximum lenght is reached, so get off the loop + $truncate .= \mb_substr($line_matchings[2], 0, $left + $entities_length); + // maximum length is reached, so get off the loop break; } $truncate .= $line_matchings[2]; @@ -111,25 +285,25 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac } } } else { - if (mb_strlen($text) <= $length) { + if (\mb_strlen($text) <= $length) { return $text; } - $truncate = mb_substr($text, 0, $length - mb_strlen($ending)); + $truncate = \mb_substr($text, 0, $length - \mb_strlen($ending)); } // if the words shouldn't be cut in the middle... if (!$exact) { // ...search the last occurance of a space... - $spacepos = mb_strrpos($truncate, ' '); + $spacepos = \mb_strrpos($truncate, ' '); if (isset($spacepos)) { // ...and cut the text in this position - $truncate = mb_substr($truncate, 0, $spacepos); + $truncate = \mb_substr($truncate, 0, $spacepos); } } // add the defined ending to the text $truncate .= $ending; if ($considerHtml) { // close all unclosed html-tags - foreach ($open_tags as $tag) { + foreach ($openTags as $tag) { $truncate .= ''; } } @@ -138,12 +312,16 @@ public static function truncateHtml($text, $length = 100, $ending = '...', $exac } /** + * Get correct text editor based on user rights + * * @param \Xmf\Module\Helper $helper * @param array|null $options + * * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor */ - public static function getEditor($helper = null, $options = null) + public static function getEditor(?\Xmf\Module\Helper $helper = null, ?array $options = null) { + /** @var Helper $helper */ if (null === $options) { $options = []; $options['name'] = 'Editor'; @@ -159,14 +337,14 @@ public static function getEditor($helper = null, $options = null) } $isAdmin = $helper->isUserAdmin(); - if (class_exists('XoopsFormEditor')) { + if (\class_exists('XoopsFormEditor')) { if ($isAdmin) { - $descEditor = new \XoopsFormEditor(ucfirst($options['name']), $helper->getConfig('editorAdmin'), $options, $nohtml = false, $onfailure = 'textarea'); + $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editorAdmin'), $options, $nohtml = false, $onfailure = 'textarea'); } else { - $descEditor = new \XoopsFormEditor(ucfirst($options['name']), $helper->getConfig('editorUser'), $options, $nohtml = false, $onfailure = 'textarea'); + $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editorUser'), $options, $nohtml = false, $onfailure = 'textarea'); } } else { - $descEditor = new \XoopsFormDhtmlTextArea(ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); + $descEditor = new \XoopsFormDhtmlTextArea(\ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); } // $form->addElement($descEditor); @@ -175,16 +353,69 @@ public static function getEditor($helper = null, $options = null) } /** - * @param $fieldname - * @param $table + * Check if column in dB table exists + * + * @param string $fieldname name of dB table field + * @param string $table name of dB table (including prefix) * - * @return bool + * @return bool true if table exists + * @deprecated */ - public function fieldExists($fieldname, $table) + public static function fieldExists(string $fieldname, string $table): bool { - global $xoopsDB; - $result = $xoopsDB->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); + $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 1); + \trigger_error(__METHOD__ . " is deprecated, use Xmf\Database\Tables instead - instantiated from {$trace[0]['file']} line {$trace[0]['line']},"); - return ($xoopsDB->getRowsNum($result) > 0); + $result = $GLOBALS['xoopsDB']->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); + return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0); + } + + + /** + * Function responsible for checking if a directory exists, we can also write in and create an index.html file + * + * @param string $folder The full path of the directory to check + */ + public static function prepareFolder(string $folder): void + { + try { + if (!@\mkdir($folder) && !\is_dir($folder)) { + throw new \RuntimeException(\sprintf('Unable to create the %s directory', $folder)); + } + file_put_contents($folder . '/index.html', ''); + } catch (\Exception $e) { + echo 'Caught exception: ', $e->getMessage(), "\n", '
      '; + } + } + + /** + * Check if dB table table exists + * + * @param string $tablename dB tablename with prefix + * @return bool true if table exists + */ + public static function tableExists(string $tablename): bool + { + $trace = \debug_backtrace(\DEBUG_BACKTRACE_IGNORE_ARGS, 1); + \trigger_error(__FUNCTION__ . " is deprecated, called from {$trace[0]['file']} line {$trace[0]['line']}"); + $GLOBALS['xoopsLogger']->addDeprecated( + \basename(\dirname(__DIR__, 2)) . ' Module: ' . __FUNCTION__ . ' function is deprecated, please use Xmf\Database\Tables method(s) instead.' . " Called from {$trace[0]['file']}line {$trace[0]['line']}" + ); + $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); + + return $GLOBALS['xoopsDB']->getRowsNum($result) > 0 ; + } + + /** + * Add a field to a mysql table + * + * @param $field + * @param $table + * @return bool|\mysqli_result + */ + public static function addField($field, $table) + { + global $xoopsDB; + return $xoopsDB->queryF('ALTER TABLE ' . $table . " ADD $field;"); } } diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php new file mode 100644 index 00000000..fc4fc296 --- /dev/null +++ b/class/Common/TestdataButtons.php @@ -0,0 +1,74 @@ + + * @copyright {@link https://xoops.org/ XOOPS Project} + * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) + */ + +use Xmf\Request; +use Xmf\Yaml; +use XoopsModules\Rssfit\Helper; +/** @var Helper $helper */ + +/** + * Class SysUtility + */ +class TestdataButtons +{ + + //functions for import buttons + public static function loadButtonConfig($adminObject) + { + $moduleDirName = \basename(\dirname(__DIR__, 2)); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps + $displaySampleButton = $config['displaySampleButton']; + $helper = Helper::getInstance(); + + if (1 == $displaySampleButton) { + \xoops_loadLanguage('admin/modulesadmin', 'system'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA'), $helper->url('testdata/index.php?op=clear'), 'alert'); + // $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA'), $helper->url( 'testdata/index.php?op=exportschema'), 'add'); + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS'), '?op=hide_buttons', 'delete'); + } else { + $adminObject->addItemButton(\constant('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS'), '?op=show_buttons', 'add'); + // $displaySampleButton = $config['displaySampleButton']; + } + } + + public static function hideButtons() + { + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $app = []; + $app['displaySampleButton'] = 0; + Yaml::save($app, $yamlFile); + \redirect_header('index.php', 0, ''); + } + + public static function showButtons() + { + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $app = []; + $app['displaySampleButton'] = 1; + Yaml::save($app, $yamlFile); + \redirect_header('index.php', 0, ''); + } +} diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 7881e904..5b9e4caa 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -22,31 +22,31 @@ trait VersionChecks /** * Verifies XOOPS version meets minimum requirements for this module * @static - * @param \XoopsModule $module + * @param \XoopsModule|null $module * - * @param null|string $requiredVer + * @param null|string $requiredVer * @return bool true if meets requirements, false if not */ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null) { - $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); } - xoops_loadLanguage('admin', $moduleDirName); - xoops_loadLanguage('common', $moduleDirName); + \xoops_loadLanguage('admin', $moduleDirName); + \xoops_loadLanguage('common', $moduleDirName); //check for minimum XOOPS version - $currentVer = mb_substr(XOOPS_VERSION, 6); // get the numeric part of string + $currentVer = mb_substr(\XOOPS_VERSION, 6); // get the numeric part of string if (null === $requiredVer) { $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string } $success = true; - if (version_compare($currentVer, $requiredVer, '<')) { + if (\version_compare($currentVer, $requiredVer, '<')) { $success = false; - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); + $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS'), $requiredVer, $currentVer)); } return $success; @@ -55,29 +55,29 @@ public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = /** * Verifies PHP version meets minimum requirements for this module * @static + * @param \XoopsModule|bool|null $module * - * @param \XoopsModule|null $module * @return bool true if meets requirements, false if not */ public static function checkVerPhp(\XoopsModule $module = null) { - $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); if (null === $module) { $module = \XoopsModule::getByDirname($moduleDirName); } - xoops_loadLanguage('admin', $moduleDirName); - xoops_loadLanguage('common', $moduleDirName); + \xoops_loadLanguage('admin', $moduleDirName); + \xoops_loadLanguage('common', $moduleDirName); // check for minimum PHP version $success = true; - $verNum = PHP_VERSION; + $verNum = \PHP_VERSION; $reqVer = &$module->getInfo('min_php'); if (false !== $reqVer && '' !== $reqVer) { - if (version_compare($verNum, $reqVer, '<')) { - $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); + if (\version_compare($verNum, $reqVer, '<')) { + $module->setErrors(\sprintf(\constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP'), $reqVer, $verNum)); $success = false; } } @@ -86,6 +86,7 @@ public static function checkVerPhp(\XoopsModule $module = null) } /** + * * compares current module version with latest GitHub release * @static * @param \Xmf\Module\Helper $helper @@ -94,55 +95,55 @@ public static function checkVerPhp(\XoopsModule $module = null) * * @return string|array info about the latest module version, if newer */ + public static function checkVerModule($helper, $source = 'github', $default = 'master') { - $moduleDirName = basename(dirname(dirname(__DIR__))); + $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); - $update = ''; - $repository = 'XoopsModules25x/' . $moduleDirName; + $update = ''; + $repository = 'XoopsModules25x/' . $moduleDirName; // $repository = 'XoopsModules25x/publisher'; //for testing only - $ret = ''; + $ret = ''; $infoReleasesUrl = "https://api.github.com/repos/$repository/releases"; if ('github' === $source) { - if (function_exists('curl_init') && false !== ($curlHandle = curl_init())) { - curl_setopt($curlHandle, CURLOPT_URL, $infoReleasesUrl); - curl_setopt($curlHandle, CURLOPT_RETURNTRANSFER, true); - curl_setopt($curlHandle, CURLOPT_SSL_VERIFYPEER, false); - curl_setopt($curlHandle, CURLOPT_HTTPHEADER, ["User-Agent:Publisher\r\n"]); - $curlReturn = curl_exec($curlHandle); + if (\function_exists('curl_init') && false !== ($curlHandle = \curl_init())) { + \curl_setopt($curlHandle, \CURLOPT_URL, $infoReleasesUrl); + \curl_setopt($curlHandle, \CURLOPT_RETURNTRANSFER, true); + \curl_setopt($curlHandle, \CURLOPT_SSL_VERIFYPEER, true); //TODO: how to avoid an error when 'Peer's Certificate issuer is not recognized' + \curl_setopt($curlHandle, \CURLOPT_HTTPHEADER, ["User-Agent:Publisher\r\n"]); + $curlReturn = \curl_exec($curlHandle); if (false === $curlReturn) { - trigger_error(curl_error($curlHandle)); - } elseif (false !== mb_strpos($curlReturn, 'Not Found')) { - trigger_error('Repository Not Found: ' . $infoReleasesUrl); + \trigger_error(\curl_error($curlHandle)); + } elseif (false !== \strpos($curlReturn, 'Not Found')) { + \trigger_error('Repository Not Found: ' . $infoReleasesUrl); } else { - $file = json_decode($curlReturn, false); - $latestVersionLink = sprintf("https://github.com/$repository/archive/%s.zip", $file ? reset($file)->tag_name : $default); - $latestVersion = $file[0]->tag_name; - $prerelease = $file[0]->prerelease; + $file = json_decode($curlReturn, false); + $latestVersionLink = \sprintf("https://github.com/$repository/archive/%s.zip", $file ? \reset($file)->tag_name : $default); + $latestVersion = $file[0]->tag_name; + $prerelease = $file[0]->prerelease; if ('master' !== $latestVersionLink) { - $update = constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; + $update = \constant('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION') . $latestVersion; } //"PHP-standardized" version $latestVersion = mb_strtolower($latestVersion); if (false !== mb_strpos($latestVersion, 'final')) { - $latestVersion = str_replace('_', '', mb_strtolower($latestVersion)); - $latestVersion = str_replace('final', '', mb_strtolower($latestVersion)); + $latestVersion = \str_replace('_', '', mb_strtolower($latestVersion)); + $latestVersion = \str_replace('final', '', mb_strtolower($latestVersion)); } $moduleVersion = ($helper->getModule()->getInfo('version') . '_' . $helper->getModule()->getInfo('module_status')); //"PHP-standardized" version - $moduleVersion = str_replace(' ', '', mb_strtolower($moduleVersion)); + $moduleVersion = \str_replace(' ', '', mb_strtolower($moduleVersion)); // $moduleVersion = '1.0'; //for testing only // $moduleDirName = 'publisher'; //for testing only - if (!$prerelease && version_compare($moduleVersion, $latestVersion, '<')) { - $ret = []; + if (!$prerelease && \version_compare($moduleVersion, $latestVersion, '<')) { + $ret = []; $ret[] = $update; $ret[] = $latestVersionLink; } } - curl_close($curlHandle); + \curl_close($curlHandle); } } - return $ret; } } diff --git a/class/Common/index.html b/class/Common/index.html deleted file mode 100644 index 990cbd60..00000000 --- a/class/Common/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/class/Common/index.php b/class/Common/index.php new file mode 100644 index 00000000..6a505435 --- /dev/null +++ b/class/Common/index.php @@ -0,0 +1,2 @@ + * @author XOOPS Development Team */ + use XoopsModules\Rssfit; -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -40,21 +41,21 @@ class FeedHandler public $myts; public $modConfig; public $xoopsConfig; - public $cached = ''; - public $charset = _CHARSET; - public $feedkey = 'feed'; - public $plugin_file = 'rssfit.%s.php'; - public $substr_remove = [',', '/', ';', ':', '(', '{', '[', ' ']; - public $substr_add = ['.', '!', '?', '}', ']', ')', '%']; + public $cached = ''; + public $charset = _CHARSET; + public $feedkey = 'feed'; + public $plugin_file = 'rssfit.%s.php'; + public $substr_remove = [',', '/', ';', ':', '(', '{', '[', ' ']; + public $substr_add = ['.', '!', '?', '}', ']', ')', '%']; public $substr_endwith = '...'; - public $spec_url = 'http://blogs.law.harvard.edu/tech/rss'; - public $specs = [ - 'req' => 'requiredChannelElements', - 'opt' => 'optionalChannelElements', + public $spec_url = 'http://blogs.law.harvard.edu/tech/rss'; + public $specs = [ + 'req' => 'requiredChannelElements', + 'opt' => 'optionalChannelElements', 'cloud' => 'ltcloudgtSubelementOfLtchannelgt', - 'img' => 'ltimagegtSubelementOfLtchannelgt', + 'img' => 'ltimagegtSubelementOfLtchannelgt', ]; - public $escaped = [ + public $escaped = [ 128 => '€', 130 => '‚', 131 => 'ƒ', @@ -92,15 +93,15 @@ class FeedHandler */ public function __construct($modConfig, $xoopsConfig, $xoopsModule) { - $this->myts = \MyTextSanitizer::getInstance(); - $this->rssmod = $xoopsModule; - $this->pluginHandler = Rssfit\Helper::getInstance()->getHandler('Plugin'); - $this->miscHandler = Rssfit\Helper::getInstance()->getHandler('Misc'); - $this->modConfig = $modConfig; - $this->xoopsConfig = $xoopsConfig; - $this->channelreq = [ - 'title' => $this->xoopsConfig['sitename'], - 'link' => XOOPS_URL, + $this->myts = \MyTextSanitizer::getInstance(); + $this->rssmod = $xoopsModule; + $this->pluginHandler = Helper::getInstance()->getHandler('Plugin'); + $this->miscHandler = Helper::getInstance()->getHandler('Misc'); + $this->modConfig = $modConfig; + $this->xoopsConfig = $xoopsConfig; + $this->channelreq = [ + 'title' => $this->xoopsConfig['sitename'], + 'link' => XOOPS_URL, 'description' => $this->xoopsConfig['slogan'], ]; } @@ -110,7 +111,7 @@ public function __construct($modConfig, $xoopsConfig, $xoopsModule) */ public function getChannel(&$feed) { - $channel = []; + $channel = []; $elements = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channel')); if ($elements) { foreach ($elements as $e) { @@ -118,35 +119,35 @@ public function getChannel(&$feed) $channel[$e->getVar('misc_title')] = $e->getVar('misc_content', 'n'); } } - $channel['language'] = _LANGCODE; - $channel['lastBuildDate'] = $this->rssTimeStamp(time()); + $channel['language'] = _LANGCODE; + $channel['lastBuildDate'] = $this->rssTimeStamp(\time()); if ($this->modConfig['cache']) { $channel['ttl'] = $this->modConfig['cache']; } } if (!empty($feed['plugin'])) { - if (is_object($this->plugin_obj) && is_object($this->subHandler)) { - $channel['title'] = $this->plugin_obj->getVar('sub_title', 'n'); - $channel['link'] = $this->plugin_obj->getVar('sub_link', 'n'); + if (\is_object($this->plugin_obj) && \is_object($this->subHandler)) { + $channel['title'] = $this->plugin_obj->getVar('sub_title', 'n'); + $channel['link'] = $this->plugin_obj->getVar('sub_link', 'n'); $channel['description'] = $this->plugin_obj->getVar('sub_desc', 'n'); - $image = [ - 'url' => $this->plugin_obj->getVar('img_url', 'n'), + $image = [ + 'url' => $this->plugin_obj->getVar('img_url', 'n'), 'title' => $this->plugin_obj->getVar('img_title', 'n'), - 'link' => $this->plugin_obj->getVar('img_link', 'n'), + 'link' => $this->plugin_obj->getVar('img_link', 'n'), ]; } } else { $img = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channelimg'), '*', 'title'); if ($img) { $image = [ - 'url' => $img['url']->getVar('misc_content', 'n'), + 'url' => $img['url']->getVar('misc_content', 'n'), 'title' => $img['title']->getVar('misc_content', 'n'), - 'link' => $img['link']->getVar('misc_content', 'n'), + 'link' => $img['link']->getVar('misc_content', 'n'), ]; } } if (empty($channel['title']) || empty($channel['link']) || empty($channel['description'])) { - $channel = array_merge($channel, $this->channelreq); + $channel = \array_merge($channel, $this->channelreq); } foreach ($channel as $k => $v) { $this->cleanupChars($channel[$k]); @@ -172,13 +173,13 @@ public function getSticky(&$feed) $sticky = &$intr[0]; unset($intr); $setting = $sticky->getVar('misc_setting'); - if (in_array(0, $setting['feeds']) || '' == $sticky->getVar('misc_title') || '' == $sticky->getVar('misc_content')) { + if (\in_array(0, $setting['feeds']) || '' == $sticky->getVar('misc_title') || '' == $sticky->getVar('misc_content')) { return false; } - if ((in_array(-1, $setting['feeds']) && empty($feed['plugin'])) - || (!empty($feed['plugin']) && in_array($this->plugin_obj->getVar('rssf_conf_id'), $setting['feeds']))) { + if ((\in_array(-1, $setting['feeds']) && empty($feed['plugin'])) + || (!empty($feed['plugin']) && \in_array($this->plugin_obj->getVar('rssf_conf_id'), $setting['feeds']))) { $feed['sticky']['title'] = $sticky->getVar('misc_title', 'n'); - $feed['sticky']['link'] = $setting['link']; + $feed['sticky']['link'] = $setting['link']; $sticky->setDoHtml($setting['dohtml']); $sticky->setDoBr($setting['dobr']); $feed['sticky']['description'] = $sticky->getVar('misc_content'); @@ -186,7 +187,7 @@ public function getSticky(&$feed) $this->cleanupChars($feed['sticky']['link']); $this->cleanupChars($feed['sticky']['description'], $setting['dohtml'] ? 0 : 1, false); $this->wrapCdata($feed['sticky']['description']); - $feed['sticky']['pubdate'] = $this->rssTimeStamp(time()); + $feed['sticky']['pubdate'] = $this->rssTimeStamp(\time()); } return true; @@ -201,8 +202,8 @@ public function getItems(&$feed) if (!empty($feed['plugin'])) { $this->plugin_obj->setVar('rssf_grab', $this->plugin_obj->getVar('sub_entries')); $this->subHandler->grab = $this->plugin_obj->getVar('sub_entries'); - $grab = &$this->subHandler->grabEntries($this->plugin_obj); - if (false !== $grab && count($grab) > 0) { + $grab = $this->subHandler->grabEntries($this->plugin_obj); + if (false !== $grab && \count($grab) > 0) { foreach ($grab as $g) { $entries[] = $g; } @@ -212,8 +213,8 @@ public function getItems(&$feed) $handler = $this->pluginHandler->checkPlugin($p); if ($handler) { $handler->grab = $p->getVar('rssf_grab'); - $grab = &$handler->grabEntries($p); - if (false !== $grab && count($grab) > 0) { + $grab = $handler->grabEntries($p); + if (false !== $grab && \count($grab) > 0) { foreach ($grab as $g) { $entries[] = $g; } @@ -241,6 +242,7 @@ public function getItems(&$feed) $entries = array_slice($entries, 0, $this->modConfig['overall_entries']); } } + $feed['items'] = &$entries; } @@ -251,7 +253,7 @@ public function getItems(&$feed) public function doSubstr($text) { $ret = $text; - $len = function_exists('mb_strlen') ? mb_strlen($ret, $this->charset) : mb_strlen($ret); + $len = \function_exists('mb_strlen') ? mb_strlen($ret, $this->charset) : mb_strlen($ret); if ($len > $this->modConfig['max_char'] && $this->modConfig['max_char'] > 0) { $ret = $this->substrDetect($ret, 0, $this->modConfig['max_char'] - 1); if (false === $this->strrposDetect($ret, ' ')) { @@ -259,13 +261,13 @@ public function doSubstr($text) $ret = $this->substrDetect($text, 0, mb_strpos($text, ' ')); } } - if (in_array($this->substrDetect($text, $this->modConfig['max_char'] - 1, 1), $this->substr_add)) { + if (\in_array($this->substrDetect($text, $this->modConfig['max_char'] - 1, 1), $this->substr_add)) { $ret .= $this->substrDetect($text, $this->modConfig['max_char'] - 1, 1); } else { if (false !== $this->strrposDetect($ret, ' ')) { $ret = $this->substrDetect($ret, 0, $this->strrposDetect($ret, ' ')); } - if (in_array($this->substrDetect($ret, -1, 1), $this->substr_remove)) { + if (\in_array($this->substrDetect($ret, -1, 1), $this->substr_remove)) { $ret = $this->substrDetect($ret, 0, -1); } } @@ -279,11 +281,11 @@ public function doSubstr($text) * @param $text * @param $start * @param $len - * @return string + * @return false|mixed|string */ public function substrDetect($text, $start, $len) { - if (function_exists('mb_strcut')) { + if (\function_exists('mb_strcut')) { return mb_strcut($text, $start, $len, _CHARSET); } @@ -293,11 +295,11 @@ public function substrDetect($text, $start, $len) /** * @param $text * @param $find - * @return bool|false|int + * @return false|int */ public function strrposDetect($text, $find) { - if (function_exists('mb_strrpos')) { + if (\function_exists('mb_strrpos')) { return mb_strrpos($text, $find, 0, _CHARSET); } @@ -310,7 +312,7 @@ public function strrposDetect($text, $find) */ public function rssTimeStamp($time) { - return date('D, j M Y H:i:s O', $time); + return \date('D, j M Y H:i:s O', $time); } /** @@ -328,25 +330,25 @@ public function sortTimestamp($a, $b) } /** - * @param $text - * @param bool $strip - * @param bool $dospec - * @param bool $dosub + * @param $text + * @param bool $strip + * @param bool $dospec + * @param false $dosub */ public function cleanupChars(&$text, $strip = true, $dospec = true, $dosub = false) { if ($strip) { - $text = strip_tags($text); + $text = \strip_tags($text); } if ($dosub) { $text = $this->doSubstr($text); } if ($dospec) { - $text = htmlspecialchars($text, ENT_QUOTES, $this->charset); - $text = preg_replace('/&(#[0-9]+);/i', '&$1;', $text); + $text = \htmlspecialchars($text, \ENT_QUOTES, $this->charset); + $text = \preg_replace('/&(#\d+);/i', '&$1;', $text); } - if (false === stripos($this->charset, "utf-8") || XOOPS_USE_MULTIBYTES != 1) { - $text = str_replace(array_map('chr', array_keys($this->escaped)), $this->escaped, $text); + if (!\preg_match('/utf-8/i', $this->charset) || XOOPS_USE_MULTIBYTES != 1) { + $text = \str_replace(\array_map('\chr', \array_keys($this->escaped)), $this->escaped, $text); } } @@ -355,17 +357,17 @@ public function cleanupChars(&$text, $strip = true, $dospec = true, $dosub = fal */ public function wrapCdata(&$text) { - $text = ''], ['<![CDATA[', ']]>'], $text) . ']]>'; + $text = ''], ['<![CDATA[', ']]>'], $text) . ']]>'; } /** * @param string $fields * @param string $type - * @return bool + * @return false */ public function &getActivatedSubfeeds($fields = '', $type = '') { - $ret = false; + $ret = false; $subs = $this->pluginHandler->getObjects2(new \Criteria('subfeed', 1), $fields); if ($subs) { switch ($type) { @@ -401,9 +403,9 @@ public function feedSelectBox($caption = '', $selected = '', $size = 1, $multi = $select->addOption(0, '-------'); } if ($main) { - $select->addOption('-1', _AM_RSSFIT_MAINFEED); + $select->addOption('-1', \_AM_RSSFIT_MAINFEED); } - $subs = &$this->getActivatedSubfeeds('sublist', 'list'); + $subs = $this->getActivatedSubfeeds('sublist', 'list'); if ($subs) { foreach ($subs as $k => $v) { $select->addOption($k, $v); @@ -415,7 +417,7 @@ public function feedSelectBox($caption = '', $selected = '', $size = 1, $multi = /** * @param int $key - * @return bool|string + * @return false|string */ public function specUrl($key = 0) { @@ -428,15 +430,14 @@ public function specUrl($key = 0) /** * @param string $filename - * @return bool|string + * @return false|string */ public function subFeedUrl($filename = '') { if (!empty($filename)) { - $filename = str_replace('rssfit.', '', $filename); - $filename = str_replace('.php', '', $filename); + $filename = \str_replace(['rssfit.', '.php'], '', $filename); - return RSSFIT_URL_FEED . '?' . $this->feedkey . '=' . $filename; + return \RSSFIT_URL_FEED . '?' . $this->feedkey . '=' . $filename; } return false; @@ -449,9 +450,9 @@ public function checkSubFeed(&$feed) { if (!empty($feed['plugin'])) { $criteria = new \CriteriaCompo(); - $criteria->add(new \Criteria('rssf_filename', sprintf($this->plugin_file, $feed['plugin']))); + $criteria->add(new \Criteria('rssf_filename', \sprintf($this->plugin_file, $feed['plugin']))); $criteria->add(new \Criteria('subfeed', 1)); - $sub = $this->pluginHandler->getObjects2($criteria); + $sub = $this->pluginHandler->getObjects2($criteria); $handler = false; if (isset($sub[0])) { $handler = $this->pluginHandler->checkPlugin($sub[0]); @@ -459,7 +460,7 @@ public function checkSubFeed(&$feed) if ($handler) { $this->plugin_obj = $sub[0]; $this->subHandler = $handler; - $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' . md5(str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); + $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' . \md5(\str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); } else { $feed['plugin'] = ''; } diff --git a/class/Helper.php b/class/Helper.php index 6f5f219a..6ff8ef5d 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -13,13 +13,10 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @package - * @since * @author XOOPS Development Team */ -//defined('XOOPS_ROOT_PATH') || die('Restricted access'); /** * Class Helper @@ -33,17 +30,19 @@ class Helper extends \Xmf\Module\Helper */ public function __construct($debug = false) { - $this->debug = $debug; - $moduleDirName = basename(dirname(__DIR__)); - parent::__construct($moduleDirName); + if (null === $this->dirname) { + $dirname = \basename(\dirname(__DIR__)); + $this->dirname = $dirname; + } + parent::__construct($this->dirname); } /** * @param bool $debug * - * @return \XoopsModules\Rssfit\Helper + * @return \XoopsModules\xxxxx\Helper */ - public static function getInstance($debug = false) + public static function getInstance(bool $debug = false): Helper { static $instance; if (null === $instance) { @@ -56,7 +55,7 @@ public static function getInstance($debug = false) /** * @return string */ - public function getDirname() + public function getDirname(): string { return $this->dirname; } @@ -70,18 +69,18 @@ public function getDirname() */ public function getHandler($name) { - $ret = false; + $ret = false; - $class = __NAMESPACE__ . '\\' . ucfirst($name) . 'Handler'; - if (!class_exists($class)) { + $class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler'; + if (!\class_exists($class)) { throw new \RuntimeException("Class '$class' not found"); } /** @var \XoopsMySQLDatabase $db */ - $db = \XoopsDatabaseFactory::getDatabaseConnection(); + $db = \XoopsDatabaseFactory::getDatabaseConnection(); $helper = self::getInstance(); - $ret = new $class($db, $helper); - $this->addLog("Getting handler '{$name}'"); - + $ret = new $class($db, $helper); + $this->addLog("Getting handler '$name'"); return $ret; } } + diff --git a/class/Misc.php b/class/Misc.php index 7fe10d6e..9f7660fd 100644 --- a/class/Misc.php +++ b/class/Misc.php @@ -13,13 +13,14 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) * @author XOOPS Development Team */ -if (!defined('RSSFIT_ROOT_PATH')) { + +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -33,11 +34,11 @@ public function __construct() { parent::__construct(); // key, data_type, value, req, max, opt - $this->initVar('misc_id', XOBJ_DTYPE_INT, null, false); - $this->initVar('misc_category', XOBJ_DTYPE_TXTBOX, '', true, 15); - $this->initVar('misc_title', XOBJ_DTYPE_TXTBOX, '', false, 255); - $this->initVar('misc_content', XOBJ_DTYPE_TXTAREA, '', false); - $this->initVar('misc_setting', XOBJ_DTYPE_ARRAY, ''); + $this->initVar('misc_id', \XOBJ_DTYPE_INT, null, false); + $this->initVar('misc_category', \XOBJ_DTYPE_TXTBOX, '', true, 15); + $this->initVar('misc_title', \XOBJ_DTYPE_TXTBOX, '', false, 255); + $this->initVar('misc_content', \XOBJ_DTYPE_TXTAREA, '', false); + $this->initVar('misc_setting', \XOBJ_DTYPE_ARRAY, ''); } /** diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 7936bbe1..5d88887c 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -13,13 +13,14 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) * @author XOOPS Development Team */ -if (!defined('RSSFIT_ROOT_PATH')) { + +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -32,15 +33,14 @@ class MiscHandler extends \XoopsPersistableObjectHandler public $db; public $db_table; public $obj_class = Misc::class; - public $obj_key = 'misc_id'; - + public $obj_key = 'misc_id'; /** * @var \XoopsModules\Rssfit\Helper */ public $helper; /** - * @param \XoopsDatabase $db + * @param \XoopsDatabase|null $db * @param null|\XoopsModules\Rssfit\Helper $helper */ public function __construct(\XoopsDatabase $db = null, $helper = null) @@ -53,10 +53,11 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) if (null === $db) { $db = \XoopsDatabaseFactory::getDatabaseConnection(); } - $this->db = $db; - $this->db_table = $db->prefix($helper->getDirname() . '_misc'); + $this->db = $db; + $table = $db->prefix($helper->getDirname() . '_misc'); + $this->db_table = $table; - parent::__construct($db, 'rssfit_misc', Misc::class, 'misc_id', 'misc_title'); + parent::__construct($db, $table, Misc::class, 'misc_id', 'misc_title'); } /** @@ -67,7 +68,7 @@ public function getInstance(\XoopsDatabase $db = null) { static $instance; if (null === $instance) { - $instance = new self($db); + $instance = new static($db); } return $instance; @@ -88,7 +89,7 @@ public function create($isNew = true) return $obj; } -// public function get($id = null, $fields = '*') + // public function get($id = null, $fields = '*') /** * @param null|int $id @@ -98,28 +99,29 @@ public function create($isNew = true) public function get($id = null, $fields = null) { $criteria = new \Criteria($this->obj_key, (int)$id); - $objs = $this->getObjects2($criteria); + $objs = $this->getObjects2($criteria); if ($objs) { - return 1 != count($objs) ? false : $objs[0]; + return 1 != \count($objs) ? false : $objs[0]; } return false; } /** + * count objects matching a condition * @param null|\Criteria|\CriteriaCompo $criteria - * @return bool|int + * @return false|mixed count of objects */ public function getCount($criteria = null) { $sql = 'SELECT COUNT(*) FROM ' . $this->db_table; - if (null !== $criteria && $criteria instanceof \CriteriaElement) { + if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); } if (!$result = $this->db->query($sql)) { return false; } - list($count) = $this->db->fetchRow($result); + [$count] = $this->db->fetchRow($result); return $count; } @@ -128,15 +130,15 @@ public function getCount($criteria = null) * @param null|\CriteriaElement $criteria * @param string $fields * @param string $key - * @return bool + * @return false */ public function getObjects2($criteria = null, $fields = '*', $key = '') { - $ret = false; - $limit = $start = 0; + $ret = false; + $limit = $start = 0; // $fields = '*'; - $sql = 'SELECT ' . $fields . ' FROM ' . $this->db_table; - if (null !== $criteria && $criteria instanceof \CriteriaElement) { + $sql = 'SELECT ' . $fields . ' FROM ' . $this->db_table; + if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); if ('' != $criteria->getSort()) { $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); @@ -144,30 +146,29 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') $limit = $criteria->getLimit(); $start = $criteria->getStart(); } - if (!preg_match('/ORDER\ BY/', $sql)) { + if (!\preg_match('/ORDER\ BY/', $sql)) { $sql .= ' ORDER BY ' . $this->obj_key . ' ASC'; } $result = $this->db->query($sql, $limit, $start); - if (!$result) { - return false; - } - while (false !== ($myrow = $this->db->fetchArray($result))) { - $obj = new $this->obj_class(); - $obj->assignVars($myrow); - switch ($key) { - default: - $ret[] = $obj; - break; - case 'title': - $ret[$myrow['misc_title']] = $obj; - break; - case 'id': - $ret[$myrow[$this->obj_key]] = $obj; - break; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($myrow = $this->db->fetchArray($result))) { + $obj = new $this->obj_class(); + $obj->assignVars($myrow); + switch ($key) { + default: + $ret[] = $obj; + break; + case 'title': + $ret[$myrow['misc_title']] = $obj; + break; + case 'id': + $ret[$myrow[$this->obj_key]] = $obj; + break; + } + unset($obj); } - unset($obj); } - return $ret; } @@ -179,7 +180,7 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') public function insert(\XoopsObject $obj, $force = false) { // $force = false; - if (mb_strtolower(get_class($obj)) != mb_strtolower($this->obj_class)) { + if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->obj_class)) { return false; } if (!$obj->isDirty()) { @@ -189,18 +190,18 @@ public function insert(\XoopsObject $obj, $force = false) return false; } foreach ($obj->cleanVars as $k => $v) { - if (XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) { + if (\XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) { $cleanvars[$k] = (int)$v; } else { $cleanvars[$k] = $this->db->quoteString($v); } } - if (count($obj->getErrors()) > 0) { + if (\count($obj->getErrors()) > 0) { return false; } if ($obj->isNew() || empty($cleanvars[$this->obj_key])) { $cleanvars[$this->obj_key] = $this->db->genId($this->db_table . '_' . $this->obj_key . '_seq'); - $sql = 'INSERT INTO ' . $this->db_table . ' (' . implode(',', array_keys($cleanvars)) . ') VALUES (' . implode(',', array_values($cleanvars)) . ')'; + $sql = 'INSERT INTO ' . $this->db_table . ' (' . \implode(',', \array_keys($cleanvars)) . ') VALUES (' . \implode(',', $cleanvars) . ')'; } else { unset($cleanvars[$this->obj_key]); $sql = 'UPDATE ' . $this->db_table . ' SET'; @@ -230,12 +231,12 @@ public function insert(\XoopsObject $obj, $force = false) /** * @param null|\CriteriaElement $criteria * @param array $fields - * @param bool $force - * @return bool|string + * @param bool $force + * @return false|string */ public function modifyObjects($criteria = null, $fields = [], $force = false) { - if ($fields && is_array($fields)) { + if ($fields && \is_array($fields)) { $obj = new $this->obj_class(); $sql = ''; foreach ($fields as $k => $v) { @@ -245,7 +246,7 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) } $sql = mb_substr($sql, 0, -2); $sql = 'UPDATE ' . $this->db_table . ' SET ' . $sql; - if (null !== $criteria && $criteria instanceof \CriteriaElement) { + if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); } if (false !== $force) { @@ -263,13 +264,13 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) /** * @param \XoopsObject $obj - * @param bool $force + * @param bool $force * @return bool */ public function delete(\XoopsObject $obj, $force = false) { // $force = false; - if (mb_strtolower(get_class($obj)) != mb_strtolower($this->obj_class)) { + if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->obj_class)) { return false; } $sql = 'DELETE FROM ' . $this->db_table . ' WHERE ' . $this->obj_key . '=' . $obj->getVar($this->obj_key); diff --git a/class/Plugin.php b/class/Plugin.php index 6e022b1d..05eef873 100644 --- a/class/Plugin.php +++ b/class/Plugin.php @@ -13,13 +13,13 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) * @author XOOPS Development Team */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -33,18 +33,18 @@ public function __construct() { parent::__construct(); // key, data_type, value, req, max, opt - $this->initVar('rssf_conf_id', XOBJ_DTYPE_INT, null); - $this->initVar('rssf_filename', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('rssf_activated', XOBJ_DTYPE_INT, 0); - $this->initVar('rssf_grab', XOBJ_DTYPE_INT, 0, true); - $this->initVar('rssf_order', XOBJ_DTYPE_INT, 0); - $this->initVar('subfeed', XOBJ_DTYPE_INT, 0); - $this->initVar('sub_entries', XOBJ_DTYPE_INT, 0); - $this->initVar('sub_link', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('sub_title', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('sub_desc', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('img_url', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('img_link', XOBJ_DTYPE_TXTBOX, ''); - $this->initVar('img_title', XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('rssf_conf_id', \XOBJ_DTYPE_INT, 0); + $this->initVar('rssf_filename', \XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('rssf_activated', \XOBJ_DTYPE_INT, 0); + $this->initVar('rssf_grab', \XOBJ_DTYPE_INT, 0, true); + $this->initVar('rssf_order', \XOBJ_DTYPE_INT, 0); + $this->initVar('subfeed', \XOBJ_DTYPE_INT, 0); + $this->initVar('sub_entries', \XOBJ_DTYPE_INT, 0); + $this->initVar('sub_link', \XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('sub_title', \XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('sub_desc', \XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('img_url', \XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('img_link', \XOBJ_DTYPE_TXTBOX, ''); + $this->initVar('img_title', \XOBJ_DTYPE_TXTBOX, ''); } } diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 3a22bc0c..58af328f 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -13,13 +13,14 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) * @author XOOPS Development Team */ -if (!defined('RSSFIT_ROOT_PATH')) { + +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -32,17 +33,16 @@ class PluginHandler extends \XoopsPersistableObjectHandler public $db; public $db_table; public $obj_class = Plugin::class; - public $obj_key = 'rssf_conf_id'; - public $sortby = 'rssf_order'; - public $order = 'ASC'; - + public $obj_key = 'rssf_conf_id'; + public $sortby = 'rssf_order'; + public $order = 'ASC'; /** * @var \XoopsModules\Rssfit\Helper */ public $helper; /** - * @param \XoopsDatabase $db + * @param \XoopsDatabase|null $db * @param null|\XoopsModules\Rssfit\Helper $helper */ public function __construct(\XoopsDatabase $db = null, $helper = null) @@ -56,20 +56,23 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) $db = \XoopsDatabaseFactory::getDatabaseConnection(); } $this->db = $db; - $this->db_table = $db->prefix($helper->getDirname() . '_plugins'); + // $this->db_table = $db->prefix($helper->getDirname() . '_plugins'); - parent::__construct($db, 'rssfit_plugins', Plugin::class, 'rssf_conf_id', 'rssf_filename'); + $table = $db->prefix($helper->getDirname() . '_plugins'); + $this->db_table = $table; + + parent::__construct($db, $table, Plugin::class, 'rssf_conf_id', 'rssf_filename'); } /** * @param \XoopsDatabase|null $db * @return \XoopsModules\Rssfit\PluginHandler */ - public function getInstance(\XoopsDatabase $db = null) + public function getInstance(\XoopsDatabase $db = null): PluginHandler { static $instance; if (null === $instance) { - $instance = new self($db); + $instance = new static($db); } return $instance; @@ -90,7 +93,7 @@ public function create($isNew = true) return $obj; } -// public function get($id, $fields = '*') + // public function get($id, $fields = '*') /** * @param null|int $id @@ -99,10 +102,10 @@ public function create($isNew = true) */ public function get($id = null, $fields = null) { - $ret = false; + $ret = false; $criteria = new \Criteria($this->obj_key, (int)$id); - $objs = $this->getObjects2($criteria); // && 1 === count($objs); - if ($objs) { + $objs = $this->getObjects2($criteria); + if ($objs && 1 === \count($objs)) { $ret = &$objs[0]; } @@ -116,8 +119,7 @@ public function get($id = null, $fields = null) */ public function insert(\XoopsObject $obj, $force = false) { -// $force = false; - if (mb_strtolower(get_class($obj)) != mb_strtolower($this->obj_class)) { + if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->obj_class)) { return false; } if (!$obj->isDirty()) { @@ -127,18 +129,18 @@ public function insert(\XoopsObject $obj, $force = false) return false; } foreach ($obj->cleanVars as $k => $v) { - if (XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) { + if (\XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) { $cleanvars[$k] = (int)$v; } else { $cleanvars[$k] = $this->db->quoteString($v); } } - if (count($obj->getErrors()) > 0) { + if (\count($obj->getErrors()) > 0) { return false; } if ($obj->isNew() || empty($cleanvars[$this->obj_key])) { $cleanvars[$this->obj_key] = $this->db->genId($this->db_table . '_' . $this->obj_key . '_seq'); - $sql = 'INSERT INTO ' . $this->db_table . ' (' . implode(',', array_keys($cleanvars)) . ') VALUES (' . implode(',', array_values($cleanvars)) . ')'; + $sql = 'INSERT INTO ' . $this->db_table . ' (' . \implode(',', \array_keys($cleanvars)) . ') VALUES (' . \implode(',', $cleanvars) . ')'; } else { unset($cleanvars[$this->obj_key]); $sql = 'UPDATE ' . $this->db_table . ' SET'; @@ -158,7 +160,8 @@ public function insert(\XoopsObject $obj, $force = false) return false; } - if (false === $obj->getVar($this->obj_key)) { +// if (false === $obj->getVar($this->obj_key)) { + if (null === $obj->getVar($this->obj_key)) { $obj->assignVar($this->obj_key, $this->db->getInsertId()); } @@ -172,8 +175,7 @@ public function insert(\XoopsObject $obj, $force = false) */ public function delete(\XoopsObject $obj, $force = false) { -// $force = false; - if (mb_strtolower(get_class($obj)) != mb_strtolower($this->obj_class)) { + if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->obj_class)) { return false; } $sql = 'DELETE FROM ' . $this->db_table . ' WHERE ' . $this->obj_key . '=' . $obj->getVar($this->obj_key); @@ -197,7 +199,7 @@ public function delete(\XoopsObject $obj, $force = false) */ public function getObjects2($criteria = null, $fields = '*', $key = '') { - $ret = false; + $ret = false; $limit = $start = 0; switch ($fields) { case 'p_activated': @@ -211,7 +213,7 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') break; } $sql = 'SELECT ' . $fields . ' FROM ' . $this->db_table; - if (null !== $criteria && $criteria instanceof \CriteriaElement) { + if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); if ('' != $criteria->getSort()) { $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); @@ -219,27 +221,26 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') $limit = $criteria->getLimit(); $start = $criteria->getStart(); } - if (!preg_match('/ORDER\ BY/', $sql)) { + if (!\preg_match('/ORDER\ BY/', $sql)) { $sql .= ' ORDER BY ' . $this->sortby . ' ' . $this->order; } $result = $this->db->query($sql, $limit, $start); - if (!$result) { - return false; - } - while (false !== ($myrow = $this->db->fetchArray($result))) { - $obj = new $this->obj_class(); - $obj->assignVars($myrow); - switch ($key) { - default: - $ret[] = &$obj; - break; - case 'id': - $ret[$myrow[$this->obj_key]] = &$obj; - break; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($myrow = $this->db->fetchArray($result))) { + $obj = new $this->obj_class(); + $obj->assignVars($myrow); + switch ($key) { + default: + $ret[] = &$obj; + break; + case 'id': + $ret[$myrow[$this->obj_key]] = &$obj; + break; + } + unset($obj); } - unset($obj); } - return $ret; } @@ -251,7 +252,7 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') */ public function modifyObjects($criteria = null, $fields = [], $force = false) { - if ($fields && is_array($fields)) { + if ($fields && \is_array($fields)) { $obj = new $this->obj_class(); $sql = ''; foreach ($fields as $k => $v) { @@ -261,7 +262,7 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) } $sql = mb_substr($sql, 0, -2); $sql = 'UPDATE ' . $this->db_table . ' SET ' . $sql; - if (null !== $criteria && $criteria instanceof \CriteriaElement) { + if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); } if (false !== $force) { @@ -278,20 +279,21 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) } /** + * count objects matching a condition * @param null|\Criteria|\CriteriaCompo $criteria - * @return bool|int + * @return false|int count of objects */ public function getCount($criteria = null) { $sql = 'SELECT COUNT(*) FROM ' . $this->db_table; - if (null !== $criteria && $criteria instanceof \CriteriaElement) { + if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); } $result = $this->db->query($sql); if (!$result) { return false; } - list($count) = $this->db->fetchRow($result); + [$count] = $this->db->fetchRow($result); return $count; } @@ -304,20 +306,21 @@ public function getCount($criteria = null) public function forceDeactivate($obj, $type = 'rssf_activated') { $criteria = new \Criteria($this->obj_key, $obj->getVar($this->obj_key)); - $fields = ['rssf_activated' => 0, 'subfeed' => 0]; + $fields = ['rssf_activated' => 0, 'subfeed' => 0]; $this->modifyObjects($criteria, $fields, true); return true; } /** - * @return bool + * @return false|array */ public function &getPluginFileList() { - $ret = false; + $ret = false; $objs = $this->getObjects2(null, 'rssf_filename'); if ($objs) { + $ret = []; foreach ($objs as $o) { $ret[] = $o->getVar('rssf_filename'); } @@ -328,40 +331,39 @@ public function &getPluginFileList() /** * @param \XoopsObject $obj - * @return bool|mixed + * @return false|mixed */ public function checkPlugin($obj) { $ret = false; global $moduleHandler; -// $file = RSSFIT_ROOT_PATH . 'plugins/' . $obj->getVar('rssf_filename'); - $file = RSSFIT_ROOT_PATH . 'class/Plugins/' . $obj->getVar('rssf_filename'); - if (file_exists($file)) { + $file = \RSSFIT_ROOT_PATH . 'class/Plugins/' . $obj->getVar('rssf_filename'); + if (\is_file($file)) { + $ret = []; //mb $require_once = require $file; - $name = explode('.', $obj->getVar('rssf_filename')); -// $class = 'Rssfit' . ucfirst($name[0]); - $class = __NAMESPACE__ . '\Plugins\\' . ucfirst($name[0]); - if (class_exists($class)) { + $name = \explode('.', $obj->getVar('rssf_filename')); + $class = __NAMESPACE__ . '\Plugins\\' . \ucfirst($name[0]); + if (\class_exists($class)) { $handler = new $class(); - if (!method_exists($handler, 'loadmodule') || !method_exists($handler, 'grabentries')) { - $obj->setErrors(_AM_RSSFIT_PLUGIN_FUNCNOTFOUND); + if (!\method_exists($handler, 'loadmodule') || !\method_exists($handler, 'grabentries')) { + $obj->setErrors(\_AM_RSSFIT_PLUGIN_FUNCNOTFOUND); } else { $dirname = $handler->dirname; - if (!empty($dirname) && is_dir(XOOPS_ROOT_PATH . '/modules/' . $dirname)) { + if (!empty($dirname) && \is_dir(XOOPS_ROOT_PATH . '/modules/' . $dirname)) { if (!$handler->loadModule()) { - $obj->setErrors(_AM_RSSFIT_PLUGIN_MODNOTFOUND); + $obj->setErrors(\_AM_RSSFIT_PLUGIN_MODNOTFOUND); } else { $ret = $handler; } } else { - $obj->setErrors(_AM_RSSFIT_PLUGIN_MODNOTFOUND); + $obj->setErrors(\_AM_RSSFIT_PLUGIN_MODNOTFOUND); } } } else { - $obj->setErrors(_AM_RSSFIT_PLUGIN_CLASSNOTFOUND . ' ' . $class); + $obj->setErrors(\_AM_RSSFIT_PLUGIN_CLASSNOTFOUND . ' ' . $class); } } else { - $obj->setErrors(_AM_RSSFIT_PLUGIN_FILENOTFOUND); + $obj->setErrors(\_AM_RSSFIT_PLUGIN_FILENOTFOUND); } return $ret; diff --git a/class/Plugins/Adslight.php b/class/Plugins/Adslight.php index 8a2e7a49..176362c2 100644 --- a/class/Plugins/Adslight.php +++ b/class/Plugins/Adslight.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -27,7 +27,7 @@ * RSSFit version: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 / 2.3.2b / 2.4.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -42,7 +42,7 @@ class Adslight public $module; // optional, see line 74 /** - * @return bool + * @return false|string */ public function loadModule() { @@ -58,9 +58,9 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); @@ -69,7 +69,7 @@ public function &grabEntries(&$obj) $sql = 'SELECT lid, title, status, desctext, date from ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid = 'Yes' ORDER BY date DESC"; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewads.php?lid=' . $row['lid']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewads.php?lid=' . $row['lid'] ?? ''; $ret[$i]['title'] = $row['title']; $ret[$i]['link'] = $link; $ret[$i]['timestamp'] = $row['date']; diff --git a/class/Plugins/Ams.php b/class/Plugins/Ams.php index 91d2c80e..f8a14411 100644 --- a/class/Plugins/Ams.php +++ b/class/Plugins/Ams.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -30,7 +30,9 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { +use XoopsModules\Ams\Story; + +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -45,7 +47,7 @@ class Ams public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -62,21 +64,20 @@ public function loadModule() * @param \XoopsObject $obj * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { $ret = false; -// @require_once XOOPS_ROOT_PATH . '/modules/AMS/class/class.newsstory.php'; + // @require_once XOOPS_ROOT_PATH . '/modules/AMS/class/class.newsstory.php'; $myts = \MyTextSanitizer::getInstance(); - $ams = \XoopsModules\Ams\Story::getAllPublished($this->grab, 0); - if (count($ams) > 0) { - $ret = []; - for ($i = 0, $iMax = count($ams); $i < $iMax; $i++) { - $ret[$i]['title'] = $myts->undoHtmlSpecialChars($ams[$i]->title()); - $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . "/modules/$this->dirname/article.php?storyid=" . $ams[$i]->storyid(); - $ret[$i]['timestamp'] = $ams[$i]->published(); + $ams = Story::getAllPublished($this->grab, 0); + if (\count($ams) > 0) { + for ($i = 0, $iMax = \count($ams); $i < $iMax; ++$i) { + $ret[$i]['title'] = $myts->undoHtmlSpecialChars($ams[$i]->title()); + $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . "/modules/$this->dirname/article.php?storyid=" . $ams[$i]->storyid(); + $ret[$i]['timestamp'] = $ams[$i]->published(); $ret[$i]['description'] = $ams[$i]->hometext(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } diff --git a/class/Plugins/Apcal.php b/class/Plugins/Apcal.php index 86ca3ea5..e801faa7 100644 --- a/class/Plugins/Apcal.php +++ b/class/Plugins/Apcal.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -29,7 +29,7 @@ * RSSFit version: 1.21 * XOOPS version: 2.0.18.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -43,7 +43,7 @@ class Apcal public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -58,9 +58,9 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/class/Plugins/Buyersguide.php b/class/Plugins/Buyersguide.php index f5f80083..34ad90fd 100644 --- a/class/Plugins/Buyersguide.php +++ b/class/Plugins/Buyersguide.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -30,7 +30,7 @@ * RSSFit verision: 1.22 * XOOPS version: 2.0.18.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -44,7 +44,7 @@ class Buyersguide public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -59,21 +59,21 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { $ret = false; require_once XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; $items = $hBgProduct->getRecentProducts(0, 0, $this->grab); $i = 0; - if (false !== $items && count($items) > 0) { + if (false !== $items && \count($items) > 0) { foreach ($items as $item) { $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); $ret[$i]['title'] = $item->getVar('prod_title', 'n'); $ret[$i]['timestamp'] = $item->getVar('prod_submited_date'); - if ('' != xoops_trim($item->getVar('prod_summary'))) { + if ('' != \xoops_trim($item->getVar('prod_summary'))) { $description = $item->getVar('prod_summary'); } else { $description = $item->getVar('prod_description'); diff --git a/class/Plugins/Buyersguidemanufacturers.php b/class/Plugins/Buyersguidemanufacturers.php index 495a31b4..0d4d5422 100644 --- a/class/Plugins/Buyersguidemanufacturers.php +++ b/class/Plugins/Buyersguidemanufacturers.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -30,7 +30,7 @@ * RSSFit verision: 1.22 * XOOPS version: 2.0.18.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -44,7 +44,7 @@ class Buyersguidemanufacturers public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -59,23 +59,23 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { $ret = false; require_once XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; $items = $hBgManufacturer->getListofActivteManufacturers(0, $this->grab, 'manu_date_added', 'DESC'); - $i = 0; + $i = 0; - if (false !== $items && count($items) > 0) { + if (false !== $items && \count($items) > 0) { foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('manu_name', 'n'); - $ret[$i]['timestamp'] = $item->getVar('manu_date_added'); + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('manu_name', 'n'); + $ret[$i]['timestamp'] = $item->getVar('manu_date_added'); $ret[$i]['description'] = $item->getVar('manu_description'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/class/Plugins/Buyersguidenews.php b/class/Plugins/Buyersguidenews.php index d3fb81f3..eddd3914 100644 --- a/class/Plugins/Buyersguidenews.php +++ b/class/Plugins/Buyersguidenews.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -30,7 +30,7 @@ * RSSFit verision: 1.22 * XOOPS version: 2.0.18.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -44,7 +44,7 @@ class Buyersguidenews public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -59,23 +59,23 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { $ret = false; require_once XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; $items = $hBgNews->getRecentNews(0, $this->grab); - $i = 0; + $i = 0; - if (false !== $items && count($items) > 0) { + if (false !== $items && \count($items) > 0) { foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('news_title', 'n'); - $ret[$i]['timestamp'] = $item->getVar('news_date'); + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('news_title', 'n'); + $ret[$i]['timestamp'] = $item->getVar('news_date'); $ret[$i]['description'] = $item->getShortenText(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/class/Plugins/Cbb.php b/class/Plugins/Cbb.php deleted file mode 100644 index c8c89a88..00000000 --- a/class/Plugins/Cbb.php +++ /dev/null @@ -1,119 +0,0 @@ - - * @author XOOPS Development Team - */ - -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: CBB -* Version: 1.15 / 2.30 / 2.31 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -/** - * Class Cbb - * @package XoopsModules\Rssfit\Plugins - */ -class Cbb -{ - public $dirname = 'newbb'; - public $modname; - public $module; - public $grab; - - /** - * @return bool - */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; - - return $mod; - } - - /** - * @param \XoopsObject $obj - * @return mixed - */ - public function &grabEntries(&$obj) - { - @require XOOPS_ROOT_PATH . '/modules/newbb/include/functions.php'; - global $xoopsDB; - $xoopsModule = $this->module; - $myts = \MyTextSanitizer::getInstance(); - $i = 0; - $forumiscHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Forum'); - $topicHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Topic'); - $newbbConfig = $GLOBALS['configHandler']->getConfigsByCat(0, $this->module->getVar('mid')); - - $access_forums = $forumiscHandler->getForums(0, 'access'); - $available_forums = []; - foreach ($access_forums as $forum) { - if ($topicHandler->getPermission($forum)) { - $available_forums[$forum->getVar('forum_id')] = $forum; - } - } - unset($access_forums); - - if (count($available_forums) > 0) { - ksort($available_forums); - $cond = ' AND t.forum_id IN (' . implode(',', array_keys($available_forums)) . ')'; - unset($available_forums); - $cond .= $newbbConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; - $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; - $query = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM ' - . $xoopsDB->prefix('bb_posts') - . ' p, ' - . $xoopsDB->prefix('bb_forums') - . ' f, ' - . $xoopsDB->prefix('bb_topics') - . ' t, ' - . $xoopsDB->prefix('bb_posts_text') - . ' pt WHERE f.forum_id = p.forum_id AND p.post_id = pt.post_id AND p.topic_id = t.topic_id AND t.approved = 1 AND p.approved = 1 AND f.forum_id = t.forum_id ' - . $cond - . ' ORDER BY p.post_time DESC'; - $result = $xoopsDB->query($query, $this->grab); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; - $ret[$i]['title'] = $row['subject']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['post_time']; - $ret[$i]['description'] = $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr']); - $ret[$i]['category'] = $row['forum_name']; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; - $i++; - } - } - - return $ret; - } -} diff --git a/class/Plugins/00/Comments.php b/class/Plugins/Comments.php similarity index 51% rename from class/Plugins/00/Comments.php rename to class/Plugins/Comments.php index 1906b993..a716ddfb 100644 --- a/class/Plugins/00/Comments.php +++ b/class/Plugins/Comments.php @@ -12,8 +12,11 @@ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +use Criteria; +use CriteriaCompo; + /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -30,7 +33,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -45,7 +48,7 @@ class Comments public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -60,49 +63,35 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { $ret = false; - require_once XOOPS_ROOT_PATH . '/include/comment_constants.php'; - $commentHandler = xoops_getHandler('comment'); - $criteria = new \CriteriaCompo(new \Criteria('com_status', XOOPS_COMMENT_ACTIVE)); + require XOOPS_ROOT_PATH . '/include/comment_constants.php'; + $commentHandler = \xoops_getHandler('comment'); + $criteria = new CriteriaCompo(new Criteria('com_status', \XOOPS_COMMENT_ACTIVE)); $criteria->setLimit($this->grab); $criteria->setSort('com_created'); $criteria->setOrder('DESC'); - $comments = $commentHandler->getObjects($criteria, true); + $comments = $commentHandler->getObjects($criteria, true); $comment_config = []; - if (count($comments) > 0) { - $modules = $GLOBALS['module_handler']->getObjects(new \Criteria('hascomments', 1), true); - foreach (array_keys($comments) as $i) { + if (\count($comments) > 0) { + $modules = $GLOBALS['module_handler']->getObjects(new Criteria('hascomments', 1), true); + foreach (\array_keys($comments) as $i) { $mid = $comments[$i]->getVar('com_modid'); if (!isset($comment_config[$mid])) { $comment_config[$mid] = $modules[$mid]->getInfo('comments'); } - $ret[$i]['title'] = 'Comments: ' . $comments[$i]->getVar('com_title', 'n'); - $link = XOOPS_URL - . '/modules/' - . $modules[$mid]->getVar('dirname') - . '/' - . $comment_config[$mid]['pageName'] - . '?' - . $comment_config[$mid]['itemName'] - . '=' - . $comments[$i]->getVar('com_itemid') - . '&com_id=' - . $i - . '&com_rootid=' - . $comments[$i]->getVar('com_rootid') - . '&' - . $comments[$i]->getVar('com_exparams') - . '#comment' - . $i; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $comments[$i]->getVar('com_created'); + $ret[$i]['title'] = 'Comments: ' . $comments[$i]->getVar('com_title', 'n'); + $link = XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname') . '/' . $comment_config[$mid]['pageName'] . '?' . $comment_config[$mid]['itemName'] . '=' . $comments[$i]->getVar('com_itemid') . '&com_id=' . $i . '&com_rootid=' . $comments[$i]->getVar( + 'com_rootid' + ) . '&' . $comments[$i]->getVar('com_exparams') . '#comment' . $i; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $comments[$i]->getVar('com_created'); $ret[$i]['description'] = $comments[$i]->getVar('com_text'); - $ret[$i]['category'] = $modules[$mid]->getVar('name', 'n'); - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname') . '/'; + $ret[$i]['category'] = $modules[$mid]->getVar('name', 'n'); + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname') . '/'; } } diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index 7520a362..4f572400 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -47,7 +47,9 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { +use XoopsModules\Extcal\Helper as ExtcalHelper; + +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -58,13 +60,12 @@ class Extcal { public $dirname = 'extcal'; - public $classname = 'extcal'; //mb public $modname; public $grab; public $module; // optional, see line 74 /** - * @return bool + * @return false|string */ public function loadModule() { @@ -80,9 +81,9 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); @@ -92,24 +93,26 @@ public function &grabEntries(&$obj) // read confgs to get timestamp format $extcal = $this->module; - $configHandler = xoops_getHandler('config'); + $configHandler = \xoops_getHandler('config'); $extcalConfig = $configHandler->getConfigsByCat(0, $extcal->getVar('mid')); $long_form = $extcalConfig['date_long']; - $eventHandler = \XoopsModules\Extcal\Helper::getInstance()->getHandler('Event'); - $catHandler = \XoopsModules\Extcal\Helper::getInstance()->getHandler('Cat'); + $eventHandler = ExtcalHelper::getInstance()->getHandler('Event'); + $catHandler = ExtcalHelper::getInstance()->getHandler('Category'); $events = $eventHandler->getUpcomingEvent(0, $this->grab, 0); - if (is_array($events)) { + if (\is_array($events)) { foreach ($events as $event) { ++$i; $cat = $catHandler->getCat($event->getVar('cat_id'), 0); $category = $cat->getVar('cat_name'); $link = XOOPS_URL . '/modules/extcal/event.php?event=' . $event->getVar('event_id'); - $event_start = formatTimestamp($event->getVar('event_start'), $long_form); - $title = xoops_utf8_encode(htmlspecialchars($event->getVar('event_title'), ENT_QUOTES)); - $description = xoops_utf8_encode(htmlspecialchars($event->getVar('event_desc'), ENT_QUOTES)); + $event_start = \formatTimestamp($event->getVar('event_start'), $long_form); + $temp = \htmlspecialchars($event->getVar('event_title'), \ENT_QUOTES); + $title = \xoops_utf8_encode($temp); + $temp = \htmlspecialchars($event->getVar('event_desc'), \ENT_QUOTES); + $description = \xoops_utf8_encode($temp); $address = $event->getVar('event_address'); $desc_link = $event->getVar('event_url'); diff --git a/class/Plugins/Lexikon.php b/class/Plugins/Lexikon.php index 644ccb35..3daf8250 100644 --- a/class/Plugins/Lexikon.php +++ b/class/Plugins/Lexikon.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -28,7 +28,8 @@ * RSSFit version: 1.1 / 1.5 * XOOPS verson: 2.0.13.2 / 2.2.3 (!) */ -if (!defined('RSSFIT_ROOT_PATH')) { + +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -43,7 +44,7 @@ class Lexikon extends \XoopsObject public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -52,38 +53,38 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); //$permiscHandler = xoops_getHandler('groupperm'); - $ret = false; - $i = 0; - $sql = 'SELECT entryID, categoryID, term, definition, datesub FROM ' . $xoopsDB->prefix('lxentries') . ' WHERE submit = 0 AND offline = 0 ORDER BY datesub DESC'; + $ret = false; + $i = 0; + $sql = 'SELECT entryID, categoryID, term, definition, datesub FROM ' . $xoopsDB->prefix('lxentries') . ' WHERE submit = 0 AND offline = 0 ORDER BY datesub DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { // required $ret[$i]['title'] = $row['term']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/entry.php?entryID=' . $row['entryID']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/entry.php?entryID=' . $row['entryID']; //$ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['datesub']; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['datesub']; $ret[$i]['description'] = $myts->displayTarea($row['definition']); // optional //5. The item synopsis, or description, whatever //$ret[$i]['guid'] = $link; // 6. A string + domain that identifies a categorization taxonomy $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; /*$ret[$i]['extras'] = []; // 7a. without attribute $ret[$i]['extras']['author'] = array('content' => 'aabbc@c.com'); diff --git a/class/Plugins/Myalbum.php b/class/Plugins/Myalbum.php index cf844a40..c4621958 100644 --- a/class/Plugins/Myalbum.php +++ b/class/Plugins/Myalbum.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -47,7 +47,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -63,7 +63,7 @@ class Myalbum public $module; // optional, see line 74 /** - * @return bool + * @return false|string */ public function loadModule() { @@ -72,7 +72,7 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing + $this->module = $mod; // optional, remove this line if there is nothing // to do with module info when grabbing entries return $mod; } @@ -91,15 +91,15 @@ public function myGetUnameFromId($uid) return $lastName; } - if (!is_object($thisUser)) { - $memberHandler = xoops_getHandler('member'); - $thisUser = $memberHandler->getUser($uid); + if (!\is_object($thisUser)) { + $memberHandler = \xoops_getHandler('member'); + $thisUser = $memberHandler->getUser($uid); } - $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); + $name = \htmlspecialchars($thisUser->getVar('name'), \ENT_QUOTES | \ENT_HTML5); if ('' == $name) { - $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); + $name = \htmlspecialchars($thisUser->getVar('uname'), \ENT_QUOTES | \ENT_HTML5); } - $lastUid = $uid; + $lastUid = $uid; $lastName = $name; return $name; @@ -107,29 +107,29 @@ public function myGetUnameFromId($uid) /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; + $ret = false; + $i = 0; // For myalbum-p with thumbs enabled - $sql = 'SELECT p.lid, p.title, p.ext, p.date, t.description, c.cid, c.title as cat, p.submitter'; - $sql .= ' FROM ' . $xoopsDB->prefix('myalbum_photos') . ' p, '; - $sql .= $xoopsDB->prefix('myalbum_text') . ' t, '; - $sql .= $xoopsDB->prefix('myalbum_cat') . ' c '; - $sql .= 'WHERE p.status > 0 AND p.cid = c.cid AND p.lid = t.lid '; - $sql .= 'ORDER BY date DESC'; + $sql = 'SELECT p.lid, p.title, p.ext, p.date, t.description, c.cid, c.title as cat, p.submitter'; + $sql .= ' FROM ' . $xoopsDB->prefix('myalbum_photos') . ' p, '; + $sql .= $xoopsDB->prefix('myalbum_text') . ' t, '; + $sql .= $xoopsDB->prefix('myalbum_cat') . ' c '; + $sql .= 'WHERE p.status > 0 AND p.cid = c.cid AND p.lid = t.lid '; + $sql .= 'ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/photo.php?lid=' . $row['lid']; - $thumb = XOOPS_URL . '/uploads/thumbs/' . $row['lid'] . '.' . $row['ext']; - $name = $this->myGetUnameFromId($row['submitter']); - $title = $myts->displayTarea($row['title']); - $cat = $myts->displayTarea($row['cat']); + $link = XOOPS_URL . '/modules/' . $this->dirname . '/photo.php?lid=' . $row['lid']; + $thumb = XOOPS_URL . '/uploads/thumbs/' . $row['lid'] . '.' . $row['ext']; + $name = $this->myGetUnameFromId($row['submitter']); + $title = $myts->displayTarea($row['title']); + $cat = $myts->displayTarea($row['cat']); $catlink = XOOPS_URL . '/modules/' . $this->dirname . '/viewcat.php?cid=' . $row['cid']; /* * Required elements of an RSS item @@ -141,9 +141,9 @@ public function &grabEntries(&$obj) // 3. Item modification date, must be in Unix time format $ret[$i]['timestamp'] = $row['date']; // 4. The item synopsis, or description, whatever - $desc = '

      ' . $title . ' '; - $desc .= 'By ' . $name . ' in ' . $cat . '
      '; - $desc .= $myts->displayTarea($row['description']) . '


      '; + $desc = '

      ' . $title . ' '; + $desc .= 'By ' . $name . ' in ' . $cat . '
      '; + $desc .= $myts->displayTarea($row['description']) . '


      '; $ret[$i]['description'] = $desc; /* * Optional elements of an RSS item @@ -152,7 +152,7 @@ public function &grabEntries(&$obj) $ret[$i]['guid'] = $link; // 6. A string + domain that identifies a categorization taxonomy $ret[$i]['category'] = $cat; - $ret[$i]['domain'] = $catlink; + $ret[$i]['domain'] = $catlink; $i++; } diff --git a/class/Plugins/Mydownloads.php b/class/Plugins/Mydownloads.php index 39455723..cf4a4f65 100644 --- a/class/Plugins/Mydownloads.php +++ b/class/Plugins/Mydownloads.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -29,7 +29,7 @@ * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -44,7 +44,7 @@ class Mydownloads extends \XoopsObject public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -59,24 +59,24 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $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'; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $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'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } diff --git a/class/Plugins/Mylinks.php b/class/Plugins/Mylinks.php index 859fd926..01e2c13f 100644 --- a/class/Plugins/Mylinks.php +++ b/class/Plugins/Mylinks.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -30,7 +30,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -45,7 +45,7 @@ class Mylinks public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -60,9 +60,9 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/class/Plugins/Mytube.php b/class/Plugins/Mytube.php index a5b5a7bd..365d3eba 100644 --- a/class/Plugins/Mytube.php +++ b/class/Plugins/Mytube.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -29,7 +29,7 @@ * RSSFit version: 1.21 * XOOPS version: 2.0.18.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -43,7 +43,7 @@ class Mytube public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -58,25 +58,25 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; + $ret = false; + $i = 0; + $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['ltitle']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['ltitle']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } diff --git a/class/Plugins/Newbb.php b/class/Plugins/Newbb.php index 8883c11c..904216c6 100644 --- a/class/Plugins/Newbb.php +++ b/class/Plugins/Newbb.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -30,7 +30,7 @@ * XOOPS version: 2.0.13.2 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -45,7 +45,7 @@ class Newbb public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -63,9 +63,9 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; require_once XOOPS_ROOT_PATH . '/modules/' . $this->dirname . '/class/class.forumposts.php'; diff --git a/class/Plugins/Newbb2.php b/class/Plugins/Newbb2.php deleted file mode 100644 index 1ba21bac..00000000 --- a/class/Plugins/Newbb2.php +++ /dev/null @@ -1,152 +0,0 @@ - - * @author XOOPS Development Team - */ - -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: Newbb 2 -* Version: 2.0.1 -* RSSFit verision: 1.2 -* XOOPS version: 2.0.13.2 -*/ - -if (!defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -/** - * Class Newbb2 - * @package XoopsModules\Rssfit\Plugins - */ -class Newbb2 -{ - public $dirname = 'newbb'; - public $modname; - public $module; - public $grab; - - /** - * @return bool - */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive') || $mod->getVar('version') < 200) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; - - return $mod; - } - - /** - * @param $uid - * @return string - */ - public function myGetUnameFromId($uid) - { - static $thisUser = false; - static $lastUid = false; - static $lastName = ''; - - if (0 == $uid) { - return 'A guest'; - } - - if ($lastUid == $uid) { - return $lastName; - } - - if (!is_object($thisUser)) { - $memberHandler = xoops_getHandler('member'); - $thisUser = $memberHandler->getUser($uid); - } - $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); - if ('' == $name) { - $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); - } - $lastUid = $uid; - $lastName = $name; - - return $name; - } - - /** - * @param \XoopsObject $obj - * @return bool - */ - public function &grabEntries(&$obj) - { - @require XOOPS_ROOT_PATH . '/modules/newbb/include/functions.php'; - global $xoopsDB, $configHandler; - $xoopsModule = $this->module; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $forumiscHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Forum'); - $topicHandler = \XoopsModules\Newbb\Helper::getInstance()->getHandler('Topic'); - $newbbConfig = $configHandler->getConfigsByCat(0, $this->module->getVar('mid')); - - $access_forums = $forumiscHandler->getForums(0, 'access'); - $available_forums = []; - foreach ($access_forums as $forum) { - if ($topicHandler->getPermission($forum)) { - $available_forums[$forum->getVar('forum_id')] = $forum; - } - } - unset($access_forums); - - if (count($available_forums) > 0) { - ksort($available_forums); - $cond = ' AND t.forum_id IN (' . implode(',', array_keys($available_forums)) . ')'; - unset($available_forums); - $cond .= $newbbConfig['enable_karma'] ? ' AND p.post_karma = 0' : ''; - $cond .= $newbbConfig['allow_require_reply'] ? ' AND p.require_reply = 0' : ''; - $query = 'SELECT p.uid, p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.dohtml, p.dosmiley, p.doxcode, p.dobr, f.forum_name, pt.post_text FROM ' - . $xoopsDB->prefix('bb_posts') - . ' p, ' - . $xoopsDB->prefix('bb_forums') - . ' f, ' - . $xoopsDB->prefix('bb_topics') - . ' t, ' - . $xoopsDB->prefix('bb_posts_text') - . ' pt WHERE f.forum_id = p.forum_id AND p.post_id = pt.post_id AND p.topic_id = t.topic_id AND t.approved = 1 AND p.approved = 1 AND f.forum_id = t.forum_id ' - . $cond - . ' ORDER BY p.post_time DESC'; - $result = $xoopsDB->query($query, $this->grab); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; - $ret[$i]['title'] = $this->modname . ': ' . $row['subject']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['post_time']; - $ret[$i]['description'] = sprintf('Posted by: %s
      %s', $this->myGetUnameFromId($row['uid']), $myts->displayTarea($row['post_text'], $row['dohtml'], $row['dosmiley'], $row['doxcode'], 1, $row['dobr'])); - $ret[$i]['category'] = $row['forum_name']; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; - $i++; - } - } - - return $ret; - } -} diff --git a/class/Plugins/News.php b/class/Plugins/News.php index f4f5eaa7..24d577e0 100644 --- a/class/Plugins/News.php +++ b/class/Plugins/News.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -30,9 +30,12 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -//use XoopsModules\News; -if (!defined('RSSFIT_ROOT_PATH')) { +use XoopsModules\News\NewsStory; +use XoopsModules\News\Utility; + + +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -47,7 +50,7 @@ class News public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -56,36 +59,36 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; + $this->module = $mod; return $mod; } /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { $ret = false; -// @require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; + // @require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; $myts = \MyTextSanitizer::getInstance(); if ($this->module->getVar('version') >= 130) { -// @require_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php'; - $news = \XoopsModules\News\NewsStory::getAllPublished($this->grab, 0, \XoopsModules\News\Utility::getmoduleoption('restrictindex')); + // @require_once XOOPS_ROOT_PATH . '/modules/news/include/functions.php'; + $news = NewsStory::getAllPublished($this->grab, 0, Utility::getModuleOption('restrictindex')); } else { - $news = \XoopsModules\News\NewsStory::getAllPublished($this->grab, 0); + $news = NewsStory::getAllPublished($this->grab, 0); } - if (count($news) > 0) { - for ($i = 0, $iMax = count($news); $i < $iMax; $i++) { - $ret[$i]['title'] = $this->modname . ': ' . $myts->undoHtmlSpecialChars($news[$i]->title()); - $ret[$i]['link'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); - $ret[$i]['guid'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); - $ret[$i]['timestamp'] = $news[$i]->published(); - $desc = $news[$i]->hometext(); + if (\count($news) > 0) { + for ($i = 0, $iMax = \count($news); $i < $iMax; ++$i) { + $ret[$i]['title'] = $this->modname . ': ' . $myts->undoHtmlSpecialChars($news[$i]->title()); + $ret[$i]['link'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); + $ret[$i]['guid'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); + $ret[$i]['timestamp'] = $news[$i]->published(); + $desc = $news[$i]->hometext(); $ret[$i]['description'] = $news[$i]->hometext(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } diff --git a/class/Plugins/Oledrion.php b/class/Plugins/Oledrion.php index 31f30cd7..dbb9941b 100644 --- a/class/Plugins/Oledrion.php +++ b/class/Plugins/Oledrion.php @@ -13,16 +13,17 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) * @author XOOPS Development Team */ -//use XoopsModules\Oledrion; +use XoopsModules\Oledrion\Parameters; +use XoopsModules\Oledrion\Helper as OledrionHelper; -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -37,7 +38,7 @@ class Oledrion public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -52,23 +53,24 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { $ret = false; require_once XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; - $helper = \XoopsModules\Oledrion\Helper::getInstance(); + $helper = OledrionHelper::getInstance(); $productsHandler = $helper->getHandler('Products'); - $items = $productsHandler->getRecentProducts(new \XoopsModules\Oledrion\Parameters(['start' => 0, 'limit' => $this->grab])); + $items = $productsHandler->getRecentProducts(new Parameters(['start' => 0, 'limit' => $this->grab])); $i = 0; - if (false !== $items && count($items) > 0) { + if (false !== $items && \count($items) > 0) { + $ret = []; foreach ($items as $item) { $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); $ret[$i]['title'] = $item->getVar('product_title', 'n'); $ret[$i]['timestamp'] = $item->getVar('product_submitted'); - if ('' != xoops_trim($item->getVar('product_summary'))) { + if ('' != \xoops_trim($item->getVar('product_summary'))) { $description = $item->getVar('product_summary'); } else { $description = $item->getVar('product_description'); diff --git a/class/Plugins/Pical.php b/class/Plugins/Pical.php index 52525901..4edfc4d5 100644 --- a/class/Plugins/Pical.php +++ b/class/Plugins/Pical.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -29,7 +29,7 @@ * RSSFit version: 1.21 * XOOPS version: 2.0.18.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -43,7 +43,7 @@ class Pical public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -58,24 +58,24 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' . $xoopsDB->prefix('pical_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' . $xoopsDB->prefix('pical_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['summary']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/index.php?event_id=' . $row['id']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['dtstamp']; + $ret[$i]['title'] = $row['summary']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/index.php?event_id=' . $row['id']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['dtstamp']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } diff --git a/class/Plugins/Publisher.php b/class/Plugins/Publisher.php index 69ffb44e..f8b9bd4c 100644 --- a/class/Plugins/Publisher.php +++ b/class/Plugins/Publisher.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -30,9 +30,9 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -//use XoopsModules\Publisher; +use XoopsModules\Publisher\Helper as PublisherHelper; -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -47,11 +47,15 @@ class Publisher public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + // $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + + $helper = PublisherHelper::getInstance(); + $mod = $helper->getModule(); + if (!$mod || !$mod->getVar('isactive')) { return false; } @@ -62,17 +66,18 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return array + * @return bool|array */ - public function &grabEntries($obj) + public function grabEntries(&$obj) { - $ret = []; + $ret = false; require_once XOOPS_ROOT_PATH . '/modules/publisher/include/common.php'; - $helper = \XoopsModules\Publisher\Helper::getInstance(); - $publisherItemHandler = $helper->getHandler('Item'); - $items = $publisherItemHandler->getAllPublished($this->grab, 0); - if (false !== $items && count($items) > 0) { - for ($i = 0, $iMax = count($items); $i < $iMax; $i++) { + $helper = PublisherHelper::getInstance(); + $publisherItemiscHandler = $helper->getHandler('Item'); + $items = $publisherItemiscHandler->getAllPublished($this->grab, 0); + if (false !== $items && \count($items) > 0) { + $ret = []; + for ($i = 0, $iMax = \count($items); $i < $iMax; ++$i) { $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); diff --git a/class/Plugins/Queries.php b/class/Plugins/Queries.php index 910750fb..4444b7bd 100644 --- a/class/Plugins/Queries.php +++ b/class/Plugins/Queries.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -29,7 +29,7 @@ * RSSFit verision: 1.3 * XOOPS version: 2.5.9 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -45,7 +45,7 @@ class Queries public $module; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -61,9 +61,9 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/class/Plugins/Rmdp.php b/class/Plugins/Rmdp.php index edecf3fc..23cc4fa7 100644 --- a/class/Plugins/Rmdp.php +++ b/class/Plugins/Rmdp.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -28,7 +28,7 @@ * Version: 1.0 * RSSFit version: 1.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -43,12 +43,11 @@ class Rmdp extends \XoopsObject public $grab; /** - * @return bool|FALSE|\XoopsModule + * @return false|\XoopsModule */ public function loadModule() { - global $moduleHandler; - $mod = $moduleHandler->getByDirname($this->dirname); + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } diff --git a/class/Plugins/Sample.php b/class/Plugins/Sample.php index 28e089c7..25ce9191 100644 --- a/class/Plugins/Sample.php +++ b/class/Plugins/Sample.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -47,7 +47,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -63,7 +63,7 @@ class Sample public $module; // optional, see line 71 /** - * @return bool + * @return false|string */ public function loadModule() { @@ -72,23 +72,23 @@ public function loadModule() return false; } $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing + $this->module = $mod; // optional, remove this line if there is nothing // to do with module info when grabbing entries return $mod; } /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; + $ret = false; + $i = 0; // The following example code grabs the latest entries from the module MyLinks - $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC'; + $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; @@ -110,7 +110,7 @@ public function &grabEntries(&$obj) $ret[$i]['guid'] = $link; // 6. A string + domain that identifies a categorization taxonomy $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; // 7. extra tags examples $ret[$i]['extras'] = []; // 7a. without attribute diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php index 31548b7b..bfb53e8d 100644 --- a/class/Plugins/Smartfaq.php +++ b/class/Plugins/Smartfaq.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -30,7 +30,10 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { +use XoopsModules\Smartfaq\Helper as SmartfaqHelper; + + +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -45,7 +48,7 @@ class Smartfaq public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -60,20 +63,20 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { $ret = false; - @require XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; +// @require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; /** @var \XoopsModules\Smartfaq\FaqHandler $faqHandler */ - $faqHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Faq'); + $faqHandler = SmartfaqHelper::getInstance()->getHandler('Faq'); $faqs = $faqHandler->getAllPublished($this->grab, 0); - if (false !== $faqs && count($faqs) > 0) { + if (false !== $faqs && \count($faqs) > 0) { /** @var \XoopsModules\Smartfaq\AnswerHandler $answerHandler */ - $answerHandler = \XoopsModules\Smartfaq\Helper::getInstance()->getHandler('Answer'); - for ($i = 0, $iMax = count($faqs); $i < $iMax; $i++) { + $answerHandler = SmartfaqHelper::getInstance()->getHandler('Answer'); + for ($i = 0, $iMax = \count($faqs); $i < $iMax; ++$i) { if (!$answer = $answerHandler->getOfficialAnswer($faqs[$i]->faqid())) { continue; } diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php index 64b23174..752d8092 100644 --- a/class/Plugins/Smartpartner.php +++ b/class/Plugins/Smartpartner.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -31,7 +31,13 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { +use XoopsModules\Smartpartner\{ + Constants, + Helper as SmartpartnerHelper +}; + + +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -46,7 +52,7 @@ class Smartpartner public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -61,15 +67,17 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { $ret = false; require_once XOOPS_ROOT_PATH . '/modules/smartpartner/include/common.php'; - $partners = $partnerHandler->getPartners($this->grab, 0, _SPARTNER_STATUS_ACTIVE, 'weight', 'DESC'); - if (false !== $partners && count($partners) > 0) { - for ($i = 0, $iMax = count($partners); $i < $iMax; $i++) { + /** @var \XoopsModules\Smartpartner\PartnerHandler $partnerHandler */ + $partnerHandler = SmartpartnerHelper::getInstance()->getHandler('Partner'); + $partners = $partnerHandler->getPartners($this->grab, 0, Constants::SPARTNER_STATUS_ACTIVE, 'weight', 'DESC'); + if (false !== $partners && \count($partners) > 0) { + for ($i = 0, $iMax = \count($partners); $i < $iMax; ++$i) { $ret[$i]['link'] = $ret[$i]['guid'] = SMARTPARTNER_URL . 'partner.php?id=' . $partners[$i]->getVar('id'); $ret[$i]['title'] = $partners[$i]->getVar('title', 'n'); $ret[$i]['description'] = $partners[$i]->getVar('summary'); diff --git a/class/Plugins/Smartsection.php b/class/Plugins/Smartsection.php index 9a04052a..2f529a4a 100644 --- a/class/Plugins/Smartsection.php +++ b/class/Plugins/Smartsection.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -30,7 +30,11 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { +use XoopsModules\Smartsection\{ + Helper as SmartsectionHelper +}; + +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -45,7 +49,7 @@ class Smartsection public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -60,21 +64,23 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { $ret = false; require_once XOOPS_ROOT_PATH . '/modules/smartsection/include/common.php'; - $items = $smartsection_itemiscHandler->getAllPublished($this->grab, 0); - if (false !== $items && count($items) > 0) { - for ($i = 0, $iMax = count($items); $i < $iMax; $i++) { - $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); - $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); - $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); + $helper = SmartsectionHandler::getInstance(); + $itemHandler = $helper->getHandler('Item'); + $items = $itemHandler->getAllPublished($this->grab, 0); + if (false !== $items && \count($items) > 0) { + for ($i = 0, $iMax = \count($items); $i < $iMax; ++$i) { + $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); + $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); + $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); $ret[$i]['description'] = $items[$i]->getVar('summary'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } diff --git a/class/Plugins/Special.php b/class/Plugins/Special.php index df54e373..d831da1e 100644 --- a/class/Plugins/Special.php +++ b/class/Plugins/Special.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -45,7 +45,7 @@ * RSSFit verision: 1.2 / 1.5 * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -61,7 +61,7 @@ class Special public $module; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -77,13 +77,13 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return array + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries($obj) { global $xoopsDB; $ret = []; - @require XOOPS_ROOT_PATH . '/modules/special/class/stuff.php'; + @require_once XOOPS_ROOT_PATH . '/modules/special/class/stuff.php'; $myts = \MyTextSanitizer::getInstance(); $items = SpecialStuff::getAllPublished($this->grab, 0); foreach ($items as $item) { diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php index 7bee6c03..3a3cdaba 100644 --- a/class/Plugins/Surnames.php +++ b/class/Plugins/Surnames.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -29,7 +29,7 @@ * RSSFit verision: 1.3 * XOOPS version: 2.5.9 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -45,7 +45,7 @@ class Surnames public $module; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -73,13 +73,13 @@ public function myGetUnameFromId($uid) return $lastName; } - if (!is_object($thisUser)) { - $memberHandler = xoops_getHandler('member'); + if (!\is_object($thisUser)) { + $memberHandler = \xoops_getHandler('member'); $thisUser = $memberHandler->getUser($uid); } - $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); + $name = \htmlspecialchars($thisUser->getVar('name'), \ENT_QUOTES | ENT_HTML5); if ('' == $name) { - $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); + $name = \htmlspecialchars($thisUser->getVar('uname'), \ENT_QUOTES | ENT_HTML5); } $lastUid = $uid; $lastName = $name; @@ -89,9 +89,9 @@ public function myGetUnameFromId($uid) /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); @@ -106,7 +106,7 @@ public function &grabEntries(&$obj) $sql .= ' WHERE approved=1 ORDER BY changedate DESC, uid '; $result = $xoopsDB->query($sql, $limit, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $changedate = strtotime($row['changedate']); + $changedate = \strtotime($row['changedate']); $uid = $row['uid']; if ($lasttime == $changedate && $lastuser == $uid) { $link = XOOPS_URL . '/modules/surnames/view.php?id=' . $row['id']; diff --git a/class/Plugins/Weblinks.php b/class/Plugins/Weblinks.php index ab68845f..5554c5b0 100644 --- a/class/Plugins/Weblinks.php +++ b/class/Plugins/Weblinks.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -29,7 +29,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -44,7 +44,7 @@ class Weblinks public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -71,13 +71,13 @@ public function myGetUnameFromId($uid) return $lastName; } - if (!is_object($thisUser)) { - $memberHandler = xoops_getHandler('member'); + if (!\is_object($thisUser)) { + $memberHandler = \xoops_getHandler('member'); $thisUser = $memberHandler->getUser($uid); } - $name = htmlspecialchars($thisUser->getVar('name'), ENT_QUOTES | ENT_HTML5); + $name = \htmlspecialchars($thisUser->getVar('name'), \ENT_QUOTES | \ENT_HTML5); if ('' == $name) { - $name = htmlspecialchars($thisUser->getVar('uname'), ENT_QUOTES | ENT_HTML5); + $name = \htmlspecialchars($thisUser->getVar('uname'), \ENT_QUOTES | \ENT_HTML5); } $lastUid = $uid; $lastName = $name; @@ -87,9 +87,9 @@ public function myGetUnameFromId($uid) /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php index b9d9466b..6de6182b 100644 --- a/class/Plugins/Wfdownloads.php +++ b/class/Plugins/Wfdownloads.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -30,7 +30,7 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -46,7 +46,7 @@ class Wfdownloads extends \XoopsObject public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -62,19 +62,21 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $permiscHandler = xoops_getHandler('groupperm'); + $grouppermHandler = xoops_getHandler('groupperm'); $ret = false; $i = 0; $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); + /** @var \XoopsMemberHandler $memberHandler */ + $memberHandler = xoops_getHandler('member'); while (false !== ($row = $xoopsDB->fetchArray($result))) { - if ($permiscHandler->checkRight('WFDownFilePerm', $row['lid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['memberHandler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { + if ($grouppermHandler->checkRight('WFDownFilePerm', $row['lid'], \is_object($GLOBALS['xoopsUser']) ? $memberHandler->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { $ret[$i]['title'] = $row['title']; $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; $ret[$i]['link'] = $ret[$i]['guid'] = $link; diff --git a/class/Plugins/Wfdownloads_podcast.php b/class/Plugins/Wfdownloads_podcast.php index c63bc665..c25c6c17 100644 --- a/class/Plugins/Wfdownloads_podcast.php +++ b/class/Plugins/Wfdownloads_podcast.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -30,7 +30,7 @@ * XOOPS version: 2.0.14 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -46,7 +46,7 @@ class Wfdownloads_podcast extends \XoopsObject public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -62,20 +62,22 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $permiscHandler = xoops_getHandler('groupperm'); + $grouppermHandler = \xoops_getHandler('groupperm'); $ret = false; $i = 0; - $sql = 'SELECT lid, cid, title, date, description, filetype, size FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 AND (expired > ' . time() . ' OR expired = 0) AND published <= ' . time() . ' ORDER BY date DESC'; + $sql = 'SELECT lid, cid, title, date, description, filetype, size FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 AND (expired > ' . \time() . ' OR expired = 0) AND published <= ' . \time() . ' ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); + /** @var \XoopsMemberHandler $memberHandler */ + $memberHandler = xoops_getHandler('member'); while (false !== ($row = $xoopsDB->fetchArray($result))) { if ((isset($perms[$row['cid']]) && true === $perms[$row['cid']]) - || $permiscHandler->checkRight('WFDownCatPerm', $row['cid'], is_object($GLOBALS['xoopsUser']) ? $GLOBALS['memberHandler']->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { + || $grouppermHandler->checkRight('WFDownCatPerm', $row['cid'], \is_object($GLOBALS['xoopsUser']) ? $memberHandler->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { $perms[$row['cid']] = true; $ret[$i]['title'] = $row['title']; $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; diff --git a/class/Plugins/Wflinks.php b/class/Plugins/Wflinks.php index fc7f19ac..fc06cfef 100644 --- a/class/Plugins/Wflinks.php +++ b/class/Plugins/Wflinks.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -34,7 +34,7 @@ * Version : 1.03 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -49,37 +49,36 @@ class Wflinks public $grab; /** - * @return bool|FALSE|\XoopsModule + * @return false|\XoopsModule */ public function loadModule() { - global $moduleHandler; - $mod = $moduleHandler->getByDirname($this->dirname); + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { return false; } $this->modname = $mod->getVar('name'); - $this->mid = $mod->getVar('mid'); return $mod; } /** * @param \XoopsObject $obj - * @return array + * @return bool|array */ public function grabEntries(&$obj) { global $xoopsDB, $xoopsUser; - $groups = is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; - $grouppermHandler = xoops_getHandler('groupperm'); + $groups = \is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; + $grouppermHandler = \xoops_getHandler('groupperm'); $myts = \MyTextSanitizer::getInstance(); $ret = []; $i = 0; $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); + if ($result instanceof \mysqli_result) { while (false !== ($row = $xoopsDB->fetchArray($result))) { if ($grouppermHandler->checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { // required @@ -91,6 +90,7 @@ public function grabEntries(&$obj) $ret[$i]['category'] = $this->modname; $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; + } } } diff --git a/class/Plugins/Wfsection.php b/class/Plugins/Wfsection.php index 594f9d0c..0c7201fc 100644 --- a/class/Plugins/Wfsection.php +++ b/class/Plugins/Wfsection.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -30,7 +30,7 @@ * XOOPS version: 2.0.13.2 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -45,7 +45,7 @@ class Wfsection public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -63,11 +63,11 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { - @require XOOPS_ROOT_PATH . '/modules/wfsection/include/groupaccess.php'; + @require_once XOOPS_ROOT_PATH . '/modules/wfsection/include/groupaccess.php'; global $xoopsDB; $ret = false; $i = 0; @@ -76,9 +76,9 @@ public function &grabEntries(&$obj) . ' a, ' . $xoopsDB->prefix('wfs_category') . ' b WHERE a.published < ' - . time() + . \time() . ' AND a.published > 0 AND (a.expired = 0 OR a.expired > ' - . time() + . \time() . ') AND a.noshowart = 0 AND a.offline = 0 AND a.categoryid = b.id ORDER BY published DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); diff --git a/class/Plugins/Wfsection2.php b/class/Plugins/Wfsection2.php index d90b8791..bd6e1000 100644 --- a/class/Plugins/Wfsection2.php +++ b/class/Plugins/Wfsection2.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -32,7 +32,7 @@ use XoopsModules\Rssfit; -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -47,7 +47,7 @@ class Wfsection2 public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -62,16 +62,16 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { $ret = false; $articles = Rssfit\WfsArticle::getAllArticle($this->grab, 0, 'online'); - if (count($articles) > 0) { + if (\count($articles) > 0) { $xoopsModuleConfig['shortartlen'] = 0; $myts = \MyTextSanitizer::getInstance(); - for ($i = 0, $iMax = count($articles); $i < $iMax; $i++) { + for ($i = 0, $iMax = \count($articles); $i < $iMax; ++$i) { $link = XOOPS_URL . '/modules/wfsection/article.php?articleid=' . $articles[$i]->articleid(); $ret[$i]['title'] = $myts->undoHtmlSpecialChars($articles[$i]->title()); $ret[$i]['link'] = $link; diff --git a/class/Plugins/Xoopstube.php b/class/Plugins/Xoopstube.php index 5f130f2d..9caaac75 100644 --- a/class/Plugins/Xoopstube.php +++ b/class/Plugins/Xoopstube.php @@ -13,7 +13,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) @@ -29,7 +29,7 @@ * RSSFit version: 1.21 * XOOPS version: 2.0.18.1 */ -if (!defined('RSSFIT_ROOT_PATH')) { +if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -43,7 +43,7 @@ class Xoopstube public $grab; /** - * @return bool + * @return false|string */ public function loadModule() { @@ -58,25 +58,25 @@ public function loadModule() /** * @param \XoopsObject $obj - * @return bool + * @return bool|array */ - public function &grabEntries(&$obj) + public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; + $ret = false; + $i = 0; + $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['ltitle']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['ltitle']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } diff --git a/class/Utility.php b/class/Utility.php index fcc1817b..1a819b15 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -20,12 +20,15 @@ * @package \module\xsitemap\class * @license http://www.fsf.org/copyleft/gpl.html GNU public license * @copyright https://xoops.org 2001-2017 © XOOPS Project - * @author ZySpec + * @author ZySpec * @author Mamba * @since File available since version 1.54 */ -//require_once dirname(__DIR__) . '/include/common.php'; +//require_once \dirname(__DIR__) . '/include/common.php'; + +use XoopsModules\Rssfit; +use XoopsModules\Rssfit\Constants; /** * Class Utility @@ -37,23 +40,20 @@ class Utility extends Common\SysUtility public static function rssfitAdminHeader() { global $xoopsModule, $xoopsConfig; - $langf = RSSFIT_ROOT_PATH . 'language/' . $xoopsConfig['language'] . '/modinfo.php'; - if (file_exists($langf)) { - include $langf; - } else { - include RSSFIT_ROOT_PATH . 'language/english/modinfo.php'; - } + + \xoops_loadLanguage('modinfo', 'rssfit'); + require __DIR__ . '/menu.php'; - for ($i = 0, $iMax = count($adminmenu); $i < $iMax; $i++) { - $links[$i] = [0 => RSSFIT_URL . $adminmenu[$i]['link'], 1 => $adminmenu[$i]['title']]; + for ($i = 0, $iMax = \count($adminmenu); $i < $iMax; ++$i) { + $links[$i] = [0 => \RSSFIT_URL . $adminmenu[$i]['link'], 1 => $adminmenu[$i]['title']]; } $links[] = [0 => XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $xoopsModule->getVar('mid'), 1 => _PREFERENCES]; $admin_links = ''; - for ($i = 0, $iMax = count($links); $i < $iMax; $i++) { - $admin_links .= ''; + foreach ($links as $i => $iValue) { + $admin_links .= ''; } $admin_links .= "
      ' . $links[$i][1] . '' . $iValue[1] . '

      \n"; - xoops_cp_header(); + \xoops_cp_header(); echo $admin_links; } @@ -74,11 +74,11 @@ public static function sortTimestamp($a, $b) /** * @param $spec * @param $feedHandler - * @return string + * @return mixed|string */ public static function genSpecMoreInfo($spec, $feedHandler) { - return static::rssfGenAnchor($feedHandler->specUrl($spec), _AM_RSSFIT_EDIT_CHANNEL_QMARK, 'spec', _AM_RSSFIT_EDIT_CHANNEL_MOREINFO); + return static::rssfGenAnchor($feedHandler->specUrl($spec), \_AM_RSSFIT_EDIT_CHANNEL_QMARK, 'spec', \_AM_RSSFIT_EDIT_CHANNEL_MOREINFO); } /** diff --git a/class/index.html b/class/index.html deleted file mode 100644 index 990cbd60..00000000 --- a/class/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/class/index.php b/class/index.php new file mode 100644 index 00000000..6a505435 --- /dev/null +++ b/class/index.php @@ -0,0 +1,2 @@ + $moduleDirNameUpper . ' Module Configurator', - 'paths' => [ - 'dirname' => $moduleDirName, - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, - ], - 'uploadFolders' => [ - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', - //XOOPS_UPLOAD_PATH . '/flags' - ], - 'copyBlankFiles' => [ +use Xmf\Module\Admin; + +$moduleDirName = \basename(\dirname(__DIR__)); +$moduleDirNameUpper = mb_strtoupper($moduleDirName); + +return (object)[ + 'name' => $moduleDirNameUpper . ' Module Configurator', + 'paths' => [ + 'dirname' => $moduleDirName, + 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', + 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, + 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, + 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, + ], + 'uploadFolders' => [ + XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', + //XOOPS_UPLOAD_PATH . '/flags' + ], + 'copyBlankFiles' => [ + XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', + //XOOPS_UPLOAD_PATH . '/flags' + ], + + 'copyTestFolders' => [ + [ + XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/uploads', XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', - //XOOPS_UPLOAD_PATH . '/flags' ], + // [ + // XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/thumbs', + // XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/thumbs', + // ], + ], - 'copyTestFolders' => [ - [ - XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/uploads', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - ], - // [ - // XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/testdata/thumbs', - // XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/thumbs', - // ], - ], + 'templateFolders' => [ + '/templates/', + // '/templates/blocks/', + // '/templates/admin/' + ], + 'oldFiles' => [ + '/class/request.php', + '/class/registry.php', + '/class/utilities.php', + '/class/util.php', + // '/include/constants.php', + // '/include/functions.php', + '/ajaxrating.txt', + ], + 'oldFolders' => [ + '/images', + '/css', + '/js', + '/tcpdf', + ], - 'templateFolders' => [ - '/templates/', - // '/templates/blocks/', - // '/templates/admin/' - ], - 'oldFiles' => [ - '/class/request.php', - '/class/registry.php', - '/class/utilities.php', - '/class/util.php', - // '/include/constants.php', - // '/include/functions.php', - '/ajaxrating.txt', - ], - 'oldFolders' => [ - '/images', - '/css', - '/js', - '/tcpdf', - ], + 'renameTables' => [// 'XX_archive' => 'ZZZZ_archive', + ], + 'renameColumns' => [// 'extcal_event' => ['from' => 'event_etablissement', 'to' => 'event_location'], + ], + 'moduleStats' => [ + // 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), + // 'totalitems' => $helper->getHandler('Item')->getItemsCount(), + // 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_SUBMITTED]), + ], + 'modCopyright' => " + XOOPS Project", +]; - 'renameTables' => [// 'XX_archive' => 'ZZZZ_archive', - ], - 'moduleStats' => [ -// 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), -// 'totalitems' => $helper->getHandler('Item')->getItemsCount(), -// 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_SUBMITTED]), - ], - 'modCopyright' => " - XOOPS Project", - ]; diff --git a/config/icons.php b/config/icons.php new file mode 100644 index 00000000..d5ad3615 --- /dev/null +++ b/config/icons.php @@ -0,0 +1,19 @@ + \mb_strtoupper($moduleDirName) . ' IconConfigurator', + 'edit' => " . _EDIT . ' title=' . _EDIT . ", + 'delete' => " . _DELETE . ' title=' . _DELETE . ", + 'clone' => " . _CLONE . ' title=' . _CLONE . ", + 'preview' => " . _PREVIEW . ' title=' . _PREVIEW . ", + 'print' => " . _PRINT . ' title=' . _PRINT . ", + 'pdf' => " . _PDF . ' title=' . _PDF . ", + 'add' => " . _ADD . ' title=' . _ADD . ", + '0' => " . 0 . ' title=' . _OFF . ", + '1' => " . 1 . ' title=' . _ON . ", +]; diff --git a/config/imageconfig.php b/config/imageconfig.php new file mode 100644 index 00000000..4bc3dbb0 --- /dev/null +++ b/config/imageconfig.php @@ -0,0 +1,42 @@ + 'imageConfigs', + 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', + 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', + 'formtype' => 'line_break', + 'valuetype' => 'textbox', + 'default' => 'head', +]; + +$modversion['config'][] = [ + 'name' => 'imageWidth', + 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', + 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 1200, +]; // =1024/16 + +$modversion['config'][] = [ + 'name' => 'imageHeight', + 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', + 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 800, +]; // =768/16 + +$modversion['config'][] = [ + 'name' => 'imageUploadPath', + 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', + 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', + 'formtype' => 'textbox', + 'valuetype' => 'text', + 'default' => 'uploads/' . $modversion['dirname'] . '/images', +]; + diff --git a/config/index.html b/config/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/config/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/config/index.php b/config/index.php new file mode 100644 index 00000000..2ea9b7d9 --- /dev/null +++ b/config/index.php @@ -0,0 +1,3 @@ + $moduleDirNameUpper . ' Module Configurator', + 'paths' => [ + 'dirname' => $moduleDirName, + 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', + 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, + 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, + 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, + ], + 'uploadFolders' => [ + XOOPS_UPLOAD_PATH . '/' . $moduleDirName, + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', + XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', + //XOOPS_UPLOAD_PATH . '/flags' + ], +]; - return (object)[ - 'name' => $moduleDirNameUpper . ' Module Configurator', - 'paths' => [ - 'dirname' => $moduleDirName, - 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', - 'modPath' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName, - 'modUrl' => XOOPS_URL . '/modules/' . $moduleDirName, - 'uploadPath' => XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - 'uploadUrl' => XOOPS_UPLOAD_URL . '/' . $moduleDirName, - ], - 'uploadFolders' => [ - XOOPS_UPLOAD_PATH . '/' . $moduleDirName, - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/category', - XOOPS_UPLOAD_PATH . '/' . $moduleDirName . '/screenshots', - //XOOPS_UPLOAD_PATH . '/flags' - ], - ]; diff --git a/docs/changelog.txt b/docs/changelog.txt index 8bc18455..210085e9 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -2,6 +2,8 @@
      - namespaces (mamba) - autoloading (mamba) +- updates/cosmetics (mamba) +- index.html to index.php (mamba)
      1.31.0 Beta 2 [NOT RELEASED]

      @@ -24,8 +26,7 @@ - added Publisher plugin (mamba) - PHPDoc updates (mamba) - standardization of language variables (mamba) -- namespaces (mamba) -- +
      1.31.0 Beta 1 [2017-10-24]
      diff --git a/docs/index.html b/docs/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/docs/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/docs/index.php b/docs/index.php new file mode 100644 index 00000000..6a505435 --- /dev/null +++ b/docs/index.php @@ -0,0 +1,2 @@ + * @author XOOPS Development Team */ -require dirname(dirname(__DIR__)) . '/mainfile.php'; -require __DIR__ . '/include/common.php'; + +require_once \dirname(__DIR__, 2) . '/mainfile.php'; +require_once __DIR__ . '/include/common.php'; diff --git a/include/common.php b/include/common.php index c2a95f6f..0fe6a946 100644 --- a/include/common.php +++ b/include/common.php @@ -10,26 +10,33 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @package - * @since - * @author XOOPS Development Team + * @author XOOPS Development Team */ -use XoopsModules\Rssfit; -include dirname(__DIR__) . '/preloads/autoloader.php'; +use Xmf\Module\Admin; +use XoopsModules\Rssfit\{ + FeedHandler, + Helper, + MiscHandler, + PluginHandler, + Utility +}; -$moduleDirName = basename(dirname(__DIR__)); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName +/** @var Helper $helper */ +/** @var Utility $utility */ + +require \dirname(__DIR__) . '/preloads/autoloader.php'; + +$moduleDirName = \basename(\dirname(__DIR__)); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); /** @var \XoopsDatabase $db */ -/** @var \XoopsModules\Rssfit\Helper $helper */ -/** @var \XoopsModules\Rssfit\Utility $utility */ -$db = \XoopsDatabaseFactory::getDatabaseConnection(); -$debug = false; -$helper = \XoopsModules\Rssfit\Helper::getInstance($debug); -$utility = new \XoopsModules\Rssfit\Utility(); +$db = \XoopsDatabaseFactory::getDatabaseConnection(); +$debug = false; +$helper = Helper::getInstance($debug); +$utility = new Utility(); //$configurator = new Rssfit\Common\Configurator(); $helper->loadLanguage('common'); @@ -38,8 +45,8 @@ //$categoryHandler = new Rssfit\CategoryHandler($db); //$downloadHandler = new Rssfit\DownloadHandler($db); -$pathIcon16 = \Xmf\Module\Admin::iconUrl('', 16); -$pathIcon32 = \Xmf\Module\Admin::iconUrl('', 32); +$pathIcon16 = Admin::iconUrl('', '16'); +$pathIcon32 = Admin::iconUrl('', '32'); if (is_object($helper->getModule())) { $pathModIcon16 = $helper->getModule()->getInfo('modicons16'); $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); @@ -56,7 +63,7 @@ define($moduleDirNameUpper . '_ADMIN_URL', constant($moduleDirNameUpper . '_URL') . '/admin/'); define($moduleDirNameUpper . '_ADMIN_PATH', constant($moduleDirNameUpper . '_ROOT_PATH') . '/admin/'); define($moduleDirNameUpper . '_ADMIN', constant($moduleDirNameUpper . '_URL') . '/admin/index.php'); -// define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); + // define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', constant($moduleDirNameUpper . '_URL') . '/assets/images/logoModule.png'); define($moduleDirNameUpper . '_UPLOAD_URL', XOOPS_UPLOAD_URL . '/' . $moduleDirName); // WITHOUT Trailing slash define($moduleDirNameUpper . '_UPLOAD_PATH', XOOPS_UPLOAD_PATH . '/' . $moduleDirName); // WITHOUT Trailing slash define($moduleDirNameUpper . '_AUTHOR_LOGOIMG', $pathIcon32 . '/xoopsmicrobutton.gif'); @@ -78,24 +85,24 @@ $version = !mb_substr($version, -1, 1) ? mb_substr($version, 0, 3) : $version; define('RSSFIT_VERSION', 'RSSFit ' . $version); -//global $xoopsModuleConfig, $xoopsConfig, $xoopsModule; - -$feedHandler = new \XoopsModules\Rssfit\FeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); -$myts = $feedHandler->myts; +global $xoopsModuleConfig, $xoopsConfig, $xoopsModule; +/** @var FeedHandler $feedHandler */ +$feedHandler = new FeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); +$myts = $feedHandler->myts; $pluginHandler = $helper->getHandler('Plugin'); -$miscHandler = $helper->getHandler('Misc'); +$miscHandler = $helper->getHandler('Misc'); $icons = [ - 'edit' => " . _EDIT . ", - 'delete' => "" . _DELETE . "", - 'clone' => "" . _CLONE . "", + 'edit' => " . _EDIT . ", + 'delete' => "" . _DELETE . "", + 'clone' => "" . _CLONE . "", 'preview' => "" . _PREVIEW . "", - 'print' => "" . _CLONE . "", - 'pdf' => "" . _CLONE . "", - 'add' => "" . _ADD . "", - '0' => "" . 0 . "", - '1' => "" . 1 . "", + 'print' => "" . _CLONE . "", + 'pdf' => "" . _CLONE . "", + 'add' => "" . _ADD . "", + '0' => "" . 0 . "", + '1' => "" . 1 . "", ]; $debug = false; diff --git a/include/common0.php b/include/common0.php index 111950b8..d7e14b4a 100644 --- a/include/common0.php +++ b/include/common0.php @@ -10,7 +10,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) diff --git a/include/index.html b/include/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/include/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/include/index.php b/include/index.php new file mode 100644 index 00000000..6a505435 --- /dev/null +++ b/include/index.php @@ -0,0 +1,2 @@ + @@ -18,23 +18,25 @@ */ use XoopsModules\Rssfit; -require_once dirname(__DIR__) . '/preloads/autoloader.php'; -require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; +require_once \dirname(__DIR__) . '/preloads/autoloader.php'; +require_once \dirname(__DIR__, 3) . '/mainfile.php'; /** * @param \XoopsModule $xoopsMod + * * @return bool */ function xoops_module_install_rssfit(\XoopsModule $xoopsMod) { global $xoopsDB, $xoopsConfig; - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); $helper = Rssfit\Helper::getInstance(); $myts = \MyTextSanitizer::getInstance(); - rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); +// rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); + xoops_loadLanguage('install', $moduleDirName); $intro_setting = ['dohtml' => 1, 'dobr' => 1, 'sub' => stripslashes(_INSTALL_INTRO_SUB)]; $sql[] = 'INSERT INTO `' . $xoopsDB->prefix($helper->getDirname() . '_misc') @@ -48,7 +50,7 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod) . $xoopsDB->quoteString(serialize($intro_setting)) . ')'; $sql[] = rssfInsertChannel($xoopsMod); - $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "(NULL, 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; + $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "(null, 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; foreach ($sql as $s) { if (false === $xoopsDB->query($s)) { echo '' . $xoopsDB->error() . '
      ' . $s . '

      '; @@ -70,16 +72,18 @@ function xoops_module_update_rssfit(\XoopsModule $xoopsMod, $oldversion) { global $xoopsDB, $xoopsConfig; $helper = Rssfit\Helper::getInstance(); - rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); - list($rows) = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . " WHERE misc_category = 'channel'")); +// rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); + $moduleDirName = \basename(\dirname(__DIR__)); + xoops_loadLanguage('install', $moduleDirName); + [$rows] = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . " WHERE misc_category = 'channel'")); if (!$rows) { - $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` ADD `misc_setting` TEXT NOT NULL;'; - $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; + // $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` ADD `misc_setting` TEXT NOT NULL;'; + // $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; $intro_setting = ['dohtml' => 1, 'dobr' => 1, 'sub' => _INSTALL_INTRO_SUB]; $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` SET misc_setting = ' . $xoopsDB->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; - $sql[] = 'ALTER TABLE `' - . $xoopsDB->prefix($helper->getDirname() . '_plugins') - . "` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; + // $sql[] = 'ALTER TABLE `' + // . $xoopsDB->prefix($helper->getDirname() . '_plugins') + // . "` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_plugins') . '` SET sub_entries = 5'; $sql[] = rssfInsertChannel($xoopsMod); $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "('', 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; @@ -99,15 +103,15 @@ function xoops_module_update_rssfit(\XoopsModule $xoopsMod, $oldversion) * @param $xoopsMod * @param $lang */ -function rssfInstallLangFile($xoopsMod, $lang) -{ - $file = XOOPS_ROOT_PATH . '/modules/' . $xoopsMod->getVar('dirname') . '/language/%s/install.php'; - if (file_exists(sprintf($file, $lang))) { - include sprintf($file, $lang); - } else { - include sprintf($file, 'english'); - } -} +//function rssfInstallLangFile($xoopsMod, $lang) +//{ +// $file = XOOPS_ROOT_PATH . '/modules/' . $xoopsMod->getVar('dirname') . '/language/%s/install.php'; +// if (is_file(sprintf($file, $lang))) { +// include sprintf($file, $lang); +// } else { +// include sprintf($file, 'english'); +// } +//} /** * @param $xoopsMod @@ -120,7 +124,7 @@ function rssfInsertChannel($xoopsMod) $helper = Rssfit\Helper::getInstance(); $url = $xoopsDB->quoteString(XOOPS_URL); $sitename = $xoopsDB->quoteString($xoopsConfig['sitename']); - list($copyright) = $xoopsDB->fetchRow($xoopsDB->query('SELECT conf_value FROM ' . $xoopsDB->prefix('config') . " WHERE conf_name = 'meta_copyright' AND conf_modid = 1 AND conf_catid = " . XOOPS_CONF_METAFOOTER)); + [$copyright] = $xoopsDB->fetchRow($xoopsDB->query('SELECT conf_value FROM ' . $xoopsDB->prefix('config') . " WHERE conf_name = 'meta_copyright' AND conf_modid = 1 AND conf_catid = " . XOOPS_CONF_METAFOOTER)); return 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') diff --git a/include/oninstall.php b/include/oninstall.php index 46182dca..682eaa39 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -13,11 +13,10 @@ /** * @copyright {@link https://xoops.org/ XOOPS Project} * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} - * @package - * @since * @author XOOPS Development Team */ use XoopsModules\Rssfit; +use XoopsModules\Rssfit\Utility; /** * Prepares system prior to attempting to install module @@ -27,12 +26,12 @@ */ function xoops_module_pre_install_rssfit(\XoopsModule $module) { - require_once dirname(__DIR__) . '/preloads/autoloader.php'; - $utility = new \XoopsModules\Rssfit\Utility(); + require_once \dirname(__DIR__) . '/preloads/autoloader.php'; + $utility = new Utility(); $xoopsSuccess = $utility::checkVerXoops($module); $phpSuccess = $utility::checkVerPhp($module); - if (false !== $xoopsSuccess && false !== $phpSuccess) { + if ($xoopsSuccess && $phpSuccess) { $moduleTables = &$module->getInfo('tables'); foreach ($moduleTables as $table) { $GLOBALS['xoopsDB']->queryF('DROP TABLE IF EXISTS ' . $GLOBALS['xoopsDB']->prefix($table) . ';'); @@ -50,14 +49,14 @@ function xoops_module_pre_install_rssfit(\XoopsModule $module) */ function xoops_module_install_rssfit(\XoopsModule $module) { - require_once dirname(__DIR__) . '/preloads/autoloader.php'; - require_once dirname(dirname(dirname(__DIR__))) . '/mainfile.php'; + require_once \dirname(__DIR__) . '/preloads/autoloader.php'; + require_once \dirname(__DIR__, 3) . '/mainfile.php'; - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); $helper = Rssfit\Helper::getInstance(); $configurator = new Rssfit\Common\Configurator(); - $utility = new Rssfit\Utility(); + $utility = new Utility(); // Load language files $helper->loadLanguage('admin'); @@ -85,7 +84,7 @@ function xoops_module_install_rssfit(\XoopsModule $module) // --- COPY blank.png FILES --------------- if (count($configurator->copyBlankFiles) > 0) { - $file = dirname(__DIR__) . '/assets/images/blank.png'; + $file = \dirname(__DIR__) . '/assets/images/blank.png'; foreach (array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; $utility::copyFile($file, $dest); diff --git a/include/onuninstall.php b/include/onuninstall.php index aa92ceda..cc97ce72 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -7,6 +7,7 @@ * @license {@link http://www.fsf.org/copyleft/gpl.html GNU public license} * @link https://xoops.org XOOPS */ + use XoopsModules\Rssfit; /** @@ -31,7 +32,7 @@ function xoops_module_uninstall_rssfit(\XoopsModule $module) { // return true; - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $helper = Rssfit\Helper::getInstance(); diff --git a/include/onupdate.php b/include/onupdate.php index 094ec82a..fe9d4efb 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -12,28 +12,16 @@ /** * @copyright {@link https://xoops.org/ XOOPS Project} * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} - * @package - * @since * @author XOOPS Development Team */ use XoopsModules\Rssfit; if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser) - || !$GLOBALS['xoopsUser']->IsAdmin()) { + || !$GLOBALS['xoopsUser']->isAdmin()) { exit('Restricted access' . PHP_EOL); } -/** - * @param string $tablename - * - * @return bool - */ -function tableExists($tablename) -{ - $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); - return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0) ? true : false; -} /** * Prepares system prior to attempting to install module @@ -43,7 +31,7 @@ function tableExists($tablename) */ function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVersion = null) { - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); /** @var Rssfit\Helper $helper */ /** @var Rssfit\Utility $utility */ $helper = Rssfit\Helper::getInstance(); @@ -64,7 +52,7 @@ function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVers */ function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = null) { - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); /** @var Rssfit\Helper $helper */ @@ -84,7 +72,7 @@ function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = nul foreach ($templateList as $k => $v) { $fileInfo = new \SplFileInfo($templateFolder . $v); if ('html' === $fileInfo->getExtension() && 'index.html' !== $fileInfo->getFilename()) { - if (file_exists($templateFolder . $v)) { + if (is_file($templateFolder . $v)) { unlink($templateFolder . $v); } } @@ -126,7 +114,7 @@ function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = nul // --- COPY blank.png FILES --------------- if (count($configurator->copyBlankFiles) > 0) { - $file = dirname(__DIR__) . '/assets/images/blank.png'; + $file = \dirname(__DIR__) . '/assets/images/blank.png'; foreach (array_keys($configurator->copyBlankFiles) as $i) { $dest = $configurator->copyBlankFiles[$i] . '/blank.png'; $utility::copyFile($file, $dest); diff --git a/index.php b/index.php index ddb7971d..d5218b04 100644 --- a/index.php +++ b/index.php @@ -10,31 +10,31 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @package RSSFit - Extendable XML news feed generator * @author NS Tai (aka tuff) * @author XOOPS Development Team */ -require __DIR__ . '/header.php'; + $GLOBALS['xoopsOption']['template_main'] = 'rssfit_index.tpl'; +require_once __DIR__ . '/header.php'; require_once XOOPS_ROOT_PATH . '/header.php'; + $intr = $miscHandler->getObjects2(new \Criteria('misc_category', 'intro')); if ($intr) { - $intro = $intr[0]; + $intro = $intr[0]; $setting = $intro->getVar('misc_setting'); $intro->setDoHtml($setting['dohtml'] ? 1 : 0); $intro->setDoBr($setting['dobr'] ? 1 : 0); - $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); - $content = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_content')); - $content = str_replace('{SITEURL}', XOOPS_URL . '/', $content); + $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); + $content = str_replace(['{SITENAME}', '{SITEURL}'], [$xoopsConfig['sitename'], XOOPS_URL . '/'], $intro->getVar('misc_content')); if (false !== mb_strpos($content, '{SUB}') && $plugins = $pluginHandler->getObjects2(new \Criteria('subfeed', 1))) { $sublist = ''; foreach ($plugins as $p) { - $sub = $myts->stripSlashesGPC($setting['sub']); - $sub = str_replace('{URL}', $feedHandler->subFeedUrl($p->getVar('rssf_filename')), $sub); - $sub = str_replace('{TITLE}', $p->getVar('sub_title'), $sub); - $sub = str_replace('{DESC}', $p->getVar('sub_desc'), $sub); + $sub = ($setting['sub']); + $sub = str_replace('{URL}', $feedHandler->subFeedUrl($p->getVar('rssf_filename')), $sub); + $sub = str_replace(['{TITLE}', '{DESC}'], [$p->getVar('sub_title'), $p->getVar('sub_desc')], $sub); $sublist .= $sub; } $content = str_replace('{SUB}', $sublist, $content); @@ -43,4 +43,4 @@ } $xoopsTpl->assign('intro', ['title' => $title, 'content' => $content]); } -require XOOPS_ROOT_PATH . '/footer.php'; +require_once XOOPS_ROOT_PATH . '/footer.php'; diff --git a/language/english/common.php b/language/english/common.php index 210a4072..3df01c5a 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -9,164 +9,182 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ /** - * Wfdownloads module * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @package wfdownload - * @since 3.23 * @author Xoops Development Team */ -$moduleDirName = basename(dirname(dirname(__DIR__))); +$moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); -define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: '); -define('CO_' . $moduleDirNameUpper . '_GDLIBVERSION', 'GD Library version: '); -define('CO_' . $moduleDirNameUpper . '_GDOFF', "Disabled (No thumbnails available)"); -define('CO_' . $moduleDirNameUpper . '_GDON', "Enabled (Thumbsnails available)"); -define('CO_' . $moduleDirNameUpper . '_IMAGEINFO', 'Server status'); -define('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): '); -define('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): '); -define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); -define('CO_' . $moduleDirNameUpper . '_METAVERSION', "Downloads meta version: "); -define('CO_' . $moduleDirNameUpper . '_OFF', "OFF"); -define('CO_' . $moduleDirNameUpper . '_ON', "ON"); -define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); -define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); -define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); -define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); - -define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); -define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); - -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); -define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); -define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); -define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); - -define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); +\define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: '); +\define('CO_' . $moduleDirNameUpper . '_GDLIBVERSION', 'GD Library version: '); +\define('CO_' . $moduleDirNameUpper . '_GDOFF', "Disabled (No thumbnails available)"); +\define('CO_' . $moduleDirNameUpper . '_GDON', "Enabled (Thumbsnails available)"); +\define('CO_' . $moduleDirNameUpper . '_IMAGEINFO', 'Server status'); +\define('CO_' . $moduleDirNameUpper . '_MAXPOSTSIZE', 'Max post size permitted (post_max_size directive in php.ini): '); +\define('CO_' . $moduleDirNameUpper . '_MAXUPLOADSIZE', 'Max upload size permitted (upload_max_filesize directive in php.ini): '); +\define('CO_' . $moduleDirNameUpper . '_MEMORYLIMIT', 'Memory limit (memory_limit directive in php.ini): '); +\define('CO_' . $moduleDirNameUpper . '_METAVERSION', "Downloads meta version: "); +\define('CO_' . $moduleDirNameUpper . '_OFF', "OFF"); +\define('CO_' . $moduleDirNameUpper . '_ON', "ON"); +\define('CO_' . $moduleDirNameUpper . '_SERVERPATH', 'Server path to XOOPS root: '); +\define('CO_' . $moduleDirNameUpper . '_SERVERUPLOADSTATUS', 'Server uploads status: '); +\define('CO_' . $moduleDirNameUpper . '_SPHPINI', "Information taken from PHP ini file:"); +\define('CO_' . $moduleDirNameUpper . '_UPLOADPATHDSC', 'Note. Upload path *MUST* contain the full server path of your upload folder.'); + +\define('CO_' . $moduleDirNameUpper . '_PRINT', "Print"); +\define('CO_' . $moduleDirNameUpper . '_PDF', "Create PDF"); + +\define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED0', "Update failed - couldn't rename field '%s'"); +\define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED1', "Update failed - couldn't add new fields"); +\define('CO_' . $moduleDirNameUpper . '_UPGRADEFAILED2', "Update failed - couldn't rename table '%s'"); +\define('CO_' . $moduleDirNameUpper . '_ERROR_COLUMN', 'Could not create column in database : %s'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_XOOPS', 'This module requires XOOPS %s+ (%s installed)'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_PHP', 'This module requires PHP version %s+ (%s installed)'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_TAG_REMOVAL', 'Could not remove tags from Tag Module'); + +\define('CO_' . $moduleDirNameUpper . '_FOLDERS_DELETED_OK', 'Upload Folders have been deleted'); // Error Msgs -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); -define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); -define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH', 'Could not delete %s directory'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_BAD_REMOVE', 'Could not delete %s'); +\define('CO_' . $moduleDirNameUpper . '_ERROR_NO_PLUGIN', 'Could not load plugin'); //Help -define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(dirname(__DIR__)))); -define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); -define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); -define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); +\define('CO_' . $moduleDirNameUpper . '_DIRNAME', basename(dirname(__DIR__, 2))); +\define('CO_' . $moduleDirNameUpper . '_HELP_HEADER', __DIR__ . '/help/helpheader.tpl'); +\define('CO_' . $moduleDirNameUpper . '_BACK_2_ADMIN', 'Back to Administration of '); +\define('CO_' . $moduleDirNameUpper . '_OVERVIEW', 'Overview'); -//define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); +//\define('CO_' . $moduleDirNameUpper . '_HELP_DIR', __DIR__); //help multi-page -define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); -define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); -define('CO_' . $moduleDirNameUpper . '_SUPPORT', 'Support'); +\define('CO_' . $moduleDirNameUpper . '_DISCLAIMER', 'Disclaimer'); +\define('CO_' . $moduleDirNameUpper . '_LICENSE', 'License'); +\define('CO_' . $moduleDirNameUpper . '_SUPPORT', 'Support'); //Sample Data -define('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA', 'Import Sample Data (will delete ALL current data)'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS', 'Sample Date uploaded successfully'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', 'Show Sample Button?'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', 'If yes, the "Add Sample Data" button will be visible to the Admin. It is Yes as a default for first installation.'); -define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA', 'Export DB Schema to YAML'); -define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS', 'Export DB Schema to YAML was a success'); -define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR', 'ERROR: Export of DB Schema to YAML failed'); -define('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK', 'Are you sure to Import Sample Data? (It will delete ALL current data)'); -define('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS', 'Hide the Import buttons)'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS', 'Show the Import buttons)'); -define('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM', 'Confirm'); +\define('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA', 'Import Sample Data (will delete ALL current data)'); +\define('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM', 'Are you sure to Import Sample Data? (It will delete ALL current data)'); +\define('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_SUCCESS', 'Sample Date imported successfully'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA', 'Export Tables to YAML'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS', 'Export Tables to YAML successfully'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA', 'Clear Sample Data'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA_OK', 'The Sample Data has been cleared'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA_CONFIRM', 'Are you sure to Clear Sample Data? (It will delete ALL current data)'); +\define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA', 'Export DB Schema to YAML'); +\define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS', 'Export DB Schema to YAML was a success'); +\define('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR', 'ERROR: Export of DB Schema to YAML failed'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', 'Show Sample Button?'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', 'If yes, the "Add Sample Data" button will be visible to the Admin. It is Yes as a default for first installation.'); +\define('CO_' . $moduleDirNameUpper . '_' . 'HIDE_SAMPLEDATA_BUTTONS', 'Hide the Import buttons)'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLEDATA_BUTTONS', 'Show the Import buttons)'); + +\define('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM', 'Confirm'); //letter choice -define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "Browse items alphabetically"); -define('CO_' . $moduleDirNameUpper . '_' . 'OTHER', 'Other'); -define('CO_' . $moduleDirNameUpper . '_' . 'ALL', 'All'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BROWSETOTOPIC', "Browse items alphabetically"); +\define('CO_' . $moduleDirNameUpper . '_' . 'OTHER', 'Other'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ALL', 'All'); // block defines -define('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS', 'Access Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTION', 'Action'); -define('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS', 'Active Rights'); -define('CO_' . $moduleDirNameUpper . '_' . 'BADMIN', 'Block Administration'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLKDESC', 'Description'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBCENTER', 'Center Middle'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBLEFT', 'Center Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'CBRIGHT', 'Center Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBLEFT', 'Left'); -define('CO_' . $moduleDirNameUpper . '_' . 'SBRIGHT', 'Right'); -define('CO_' . $moduleDirNameUpper . '_' . 'SIDE', 'Alignment'); -define('CO_' . $moduleDirNameUpper . '_' . 'TITLE', 'Title'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE', 'Visible'); -define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN', 'Visible In'); -define('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT', 'Weight'); - -define('CO_' . $moduleDirNameUpper . '_' . 'PERMISSIONS', 'Permissions'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS', 'Blocks Admin'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_DESC', 'Blocks/Group Admin'); - -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_MANAGMENT', 'Manage'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADDBLOCK', 'Add a new block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK', 'Edit a block'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK', 'Clone a block'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ACCESSRIGHTS', 'Access Rights'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ACTION', 'Action'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ACTIVERIGHTS', 'Active Rights'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BADMIN', 'Block Administration'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLKDESC', 'Description'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CBCENTER', 'Center Middle'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CBLEFT', 'Center Left'); +\define('CO_' . $moduleDirNameUpper . '_' . 'CBRIGHT', 'Center Right'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SBLEFT', 'Left'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SBRIGHT', 'Right'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SIDE', 'Alignment'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TITLE', 'Title'); +\define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE', 'Visible'); +\define('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN', 'Visible In'); +\define('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT', 'Weight'); + +\define('CO_' . $moduleDirNameUpper . '_' . 'PERMISSIONS', 'Permissions'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS', 'Blocks Admin'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_DESC', 'Blocks/Group Admin'); + +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_MANAGMENT', 'Manage'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADDBLOCK', 'Add a new block'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK', 'Edit a block'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK', 'Clone a block'); //myblocksadmin -define('CO_' . $moduleDirNameUpper . '_' . 'AGDS', 'Admin Groups'); -define('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME', 'Cache Time'); -define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADMIN', 'Blocks Admin'); +\define('CO_' . $moduleDirNameUpper . '_' . 'AGDS', 'Admin Groups'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BCACHETIME', 'Cache Time'); +\define('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_ADMIN', 'Blocks Admin'); +\define('CO_' . $moduleDirNameUpper . '_' . 'UPDATE_SUCCESS', 'Update successful'); //Template Admin -define('CO_' . $moduleDirNameUpper . '_' . 'TPLSETS', 'Template Management'); -define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE', 'Generate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENAME', 'File Name'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TPLSETS', 'Template Management'); +\define('CO_' . $moduleDirNameUpper . '_' . 'GENERATE', 'Generate'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FILENAME', 'File Name'); //Menu -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); -define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); -define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); -define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK', 'Feedback'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE', 'Migrate'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_YES', 'Folder "%s" exist'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FOLDER_NO', 'Folder "%s" does not exist. Create the specified folder with CHMOD 777.'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'Show Development Tools Button?'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', 'If yes, the "Migrate" Tab and other Development tools will be visible to the Admin.'); +\define('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_FEEDBACK', 'Feedback'); +\define('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_OK', 'Database migrated to current schema.'); +\define('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING', 'Warning! This is intended for developers only. Confirm write schema file from current database.'); +\define('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_SCHEMA_OK', 'Current schema file written'); //Latest Version Check -define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); +\define('CO_' . $moduleDirNameUpper . '_' . 'NEW_VERSION', 'New Version: '); //DirectoryChecker -define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); -define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); -define('CO_' . $moduleDirNameUpper . '_' . 'DIRNOTCREATED', 'The directory cannot be created'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); +\define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); +\define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); +\define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); +\define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEDIR', 'Create it'); +\define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); +\define('CO_' . $moduleDirNameUpper . '_' . 'DIRCREATED', 'The directory has been created'); +\define('CO_' . $moduleDirNameUpper . '_' . 'DIRNOTCREATED', 'The directory cannot be created'); +\define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); +\define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); //FileChecker -//define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); -//define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); -//define('CO_' . $moduleDirNameUpper . '_' . 'COPYTHEFILE', 'Copy it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEFILE', 'Create it'); -//define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); +//\define('CO_' . $moduleDirNameUpper . '_' . 'AVAILABLE', "Available"); +//\define('CO_' . $moduleDirNameUpper . '_' . 'NOTAVAILABLE', "Not available"); +//\define('CO_' . $moduleDirNameUpper . '_' . 'NOTWRITABLE', "Should have permission ( %d ), but it has ( %d )"); +//\define('CO_' . $moduleDirNameUpper . '_' . 'COPYTHEFILE', 'Copy it'); +//\define('CO_' . $moduleDirNameUpper . '_' . 'CREATETHEFILE', 'Create it'); +//\define('CO_' . $moduleDirNameUpper . '_' . 'SETMPERM', 'Set the permission'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); -define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FILECOPIED', 'The file has been copied'); +\define('CO_' . $moduleDirNameUpper . '_' . 'FILENOTCOPIED', 'The file cannot be copied'); -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMSET', 'The permission has been set'); -//define('CO_' . $moduleDirNameUpper . '_' . 'PERMNOTSET', 'The permission cannot be set'); - -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); -define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH', 'Number of Characters to truncate to the long text field'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TRUNCATE_LENGTH_DESC', 'Set the maximum number of characters to truncate the long text fields'); //image config -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); -define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH', 'Image Display Width'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_WIDTH_DSC', 'Display width for image'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT', 'Image Display Height'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_HEIGHT_DSC', 'Display height for image'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG', '--- EXTERNAL Image configuration --- '); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_CONFIG_DSC', ''); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH', 'Image Upload path'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); + +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_FILE_SIZE', 'Image File Size (in Bytes)'); +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_FILE_SIZE_DSC','The maximum file size of the image file (in Bytes)'); + + +//Module Stats +\define('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY', 'Module Statistics'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_CATEGORIES', 'Categories:'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_ITEMS', 'Items'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_OFFLINE', 'Offline'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_PUBLISHED', 'Published'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_REJECTED', 'Rejected'); +\define('CO_' . $moduleDirNameUpper . '_' . 'TOTAL_SUBMITTED', 'Submitted'); + +\define('CO_' . $moduleDirNameUpper . '_' . 'ERROR403', 'You are not allowed to view this page!'); diff --git a/language/english/help/index.html b/language/english/help/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/language/english/help/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/language/english/help/index.php b/language/english/help/index.php new file mode 100644 index 00000000..6a505435 --- /dev/null +++ b/language/english/help/index.php @@ -0,0 +1,2 @@ +history.go(-1); diff --git a/language/english/index.php b/language/english/index.php new file mode 100644 index 00000000..6a505435 --- /dev/null +++ b/language/english/index.php @@ -0,0 +1,2 @@ +history.go(-1); diff --git a/language/index.php b/language/index.php new file mode 100644 index 00000000..6a505435 --- /dev/null +++ b/language/index.php @@ -0,0 +1,2 @@ +history.go(-1); diff --git a/preloads/index.php b/preloads/index.php new file mode 100644 index 00000000..2ea9b7d9 --- /dev/null +++ b/preloads/index.php @@ -0,0 +1,3 @@ + * @author XOOPS Development Team */ -use XoopsModules\Rssfit; + +use XoopsModules\Rssfit\{ + Helper +}; if (function_exists('mb_http_output')) { mb_http_output('pass'); } -require __DIR__ . '/header.php'; -$helper = Rssfit\Helper::getInstance(); +require_once __DIR__ . '/header.php'; +$helper = Helper::getInstance(); -$charset = $helper->getConfig('utf8') ? 'UTF-8' : _CHARSET; -$docache = $helper->getConfig('cache') ? true : false; +$charset = $helper->getConfig('utf8') ? 'UTF-8' : _CHARSET; +$docache = $helper->getConfig('cache') ? true : false; $template = 'db:rssfit_rss.tpl'; if (3 == $helper->getConfig('mime')) { $xoopsLogger->enableRendering(); $xoopsLogger->usePopup = (2 == $xoopsConfig['debug_mode']); - $docache = false; + $docache = false; } else { error_reporting(0); $xoopsLogger->activated = false; @@ -45,7 +48,7 @@ $xoopsTpl->xoops_setCacheTime($helper->getConfig('cache') * 60); } -$feed = []; +$feed = []; $feed['plugin'] = isset($_GET[$feedHandler->feedkey]) ? trim($_GET[$feedHandler->feedkey]) : ''; $feedHandler->checkSubFeed($feed); if (!$xoopsTpl->is_cached($template, $feedHandler->cached) || !$docache) { diff --git a/sql/index.html b/sql/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/sql/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/sql/index.php b/sql/index.php new file mode 100644 index 00000000..6a505435 --- /dev/null +++ b/sql/index.php @@ -0,0 +1,2 @@ +history.go(-1); diff --git a/templates/index.php b/templates/index.php new file mode 100644 index 00000000..6a505435 --- /dev/null +++ b/templates/index.php @@ -0,0 +1,2 @@ +<{$intro.title}> -<{$intro.content}> +

      <{$intro.title|default:''}>

      +<{$intro.content|default:''}> diff --git a/templates/rssfit_rss.tpl b/templates/rssfit_rss.tpl index 0a2132a8..027d704d 100644 --- a/templates/rssfit_rss.tpl +++ b/templates/rssfit_rss.tpl @@ -2,53 +2,53 @@ -<{foreach from=$feed.channel key='ch_key' item='ch_var'}> + <{foreach from=$feed.channel key='ch_key' item='ch_var'}> <<{$ch_key}>><{$ch_var}>> -<{/foreach}> - -<{if $feed.image != ''}> + <{/foreach}> + + <{if $feed.image|default:'' != ''}> <{$feed.image.title}> <{$feed.image.url}> - <{$feed.image.link}> + <{$feed.image.link}> -<{/if}> -<{if $feed.sticky != ''}> + <{/if}> + <{if $feed.sticky|default:'' != ''}> <{$feed.sticky.title}> <{$feed.sticky.description}> <{$feed.sticky.pubdate}> - <{$feed.sticky.link}> + <{$feed.sticky.link}> -<{/if}> -<{if $feed.items != ''}><{foreach item=item from=$feed.items}> + <{/if}> + <{if $feed.items|default:'' != ''}><{foreach item=item from=$feed.items}> - <{$item.title}> - <{$item.description}> - <{$item.pubdate}> - <{$item.link}> - <{if $item.category != ""}> - domain="<{$item.domain}>"<{/if}>><{$item.category}> - <{/if}> - <{if $item.guid != ""}> - <{$item.guid}> - <{/if}> - <{if $item.extras != ''}> - <{foreach from=$item.extras key='exk' item='exv'}> - <<{$exk}> - <{if $exv.attributes != ''}> - <{foreach from=$exv.attributes key='atk' item='atv'}> - <{$atk}>="<{$atv}>" - <{/foreach}> - <{/if}> - <{if $exv.content != ''}> - ><{$exv.content}>> - <{else}> - > - <{/if}> + <{$item.title}> + <{$item.guid}> + <{$item.description}> + <{$item.pubdate}> + <{if $item.category|default:'' != ''}> + domain="<{$item.domain}>"<{/if}>><{$item.category}> + <{/if}> + <{if $item.guid|default:'' != ''}> + <{$item.guid}> + <{/if}> + <{if $item.extras|default:'' != ''}> + <{foreach from=$item.extras key='exk' item='exv'}> + <<{$exk}> + <{if $exv.attributes|default:'' != ''}> + <{foreach from=$exv.attributes key='atk' item='atv'}> + <{$atk}>="<{$atv}>" <{/foreach}> <{/if}> + <{if $exv.content|default:'' != ''}> + ><{$exv.content}>> + <{else}> + > + <{/if}> + <{/foreach}> + <{/if}> -<{/foreach}><{/if}> + <{/foreach}><{/if}> diff --git a/testdata/index.html b/testdata/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/testdata/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/testdata/index.php b/testdata/index.php index 7a73c308..a7c51b1c 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -9,42 +9,52 @@ * * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 (https://www.gnu.org/licenses/old-licenses/gpl-2.0.html) - * @package * @since 2.5.9 * @author Michael Beck (aka Mamba) */ -use XoopsModules\Rssfit; -use XoopsModules\Rssfit\Common; -use XoopsModules\Rssfit\Utility; -require_once dirname(dirname(dirname(__DIR__))) . '/include/cp_header.php'; -require dirname(__DIR__) . '/preloads/autoloader.php'; +use Xmf\Database\TableLoad; +use Xmf\Request; +use Xmf\Yaml; +use XoopsModules\Rssfit\{Helper, + Common\Configurator, + Utility +}; +/** @var Helper $helper */ +/** @var Utility $utility */ +/** @var Configurator $configurator */ -$op = \Xmf\Request::getCmd('op', ''); +require \dirname(__DIR__, 3) . '/include/cp_header.php'; +require \dirname(__DIR__) . '/preloads/autoloader.php'; -$moduleDirName = basename(dirname(__DIR__)); +$op = Request::getCmd('op', ''); + +$moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); -$helper = Rssfit\Helper::getInstance(); +$helper = Helper::getInstance(); // Load language files $helper->loadLanguage('common'); switch ($op) { case 'load': - if (\Xmf\Request::hasVar('ok', 'REQUEST') && 1 == $_REQUEST['ok']) { + if (Request::hasVar('ok', 'REQUEST') && 1 === Request::getInt('ok', 0)) { if (!$GLOBALS['xoopsSecurity']->check()) { - redirect_header('../admin/index.php', 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); + redirect_header($helper->url('admin/index.php'), 3, implode(',', $GLOBALS['xoopsSecurity']->getErrors())); } loadSampleData(); } else { xoops_cp_header(); - xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA_OK')), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); + xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM')), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); xoops_cp_footer(); } break; case 'save': saveSampleData(); break; + case 'clear': + clearSampleData(); + break; } // XMF TableLoad for SAMPLE data @@ -52,11 +62,11 @@ function loadSampleData() { global $xoopsConfig; - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); - $utility = new Rssfit\Utility(); - $configurator = new Common\Configurator(); + $utility = new Utility(); + $configurator = new Configurator(); $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); @@ -65,31 +75,38 @@ function loadSampleData() $language = $xoopsConfig['language'] . '/'; } + // load module tables foreach ($tables as $table) { - $tabledata = \Xmf\Yaml::readWrapped($language . $table . '.yml'); - \Xmf\Database\TableLoad::truncateTable($table); - \Xmf\Database\TableLoad::loadTableFromArray($table, $tabledata); + $tabledata = Yaml::readWrapped($language . $table . '.yml'); + TableLoad::truncateTable($table); + TableLoad::loadTableFromArray($table, $tabledata); } + // load permissions + $table = 'group_permission'; + $tabledata = Yaml::readWrapped($language . $table . '.yml'); + $mid = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getVar('mid'); + loadTableFromArrayWithReplace($table, $tabledata, 'gperm_modid', $mid); + // --- COPY test folder files --------------- if (is_array($configurator->copyTestFolders) && count($configurator->copyTestFolders) > 0) { - // $file = dirname(__DIR__) . '/testdata/images/'; + // $file = \dirname(__DIR__) . '/testdata/images/'; foreach (array_keys($configurator->copyTestFolders) as $i) { - $src = $configurator->copyTestFolders[$i][0]; + $src = $configurator->copyTestFolders[$i][0]; $dest = $configurator->copyTestFolders[$i][1]; $utility::rcopy($src, $dest); } } - redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS')); + \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_SUCCESS')); } function saveSampleData() { global $xoopsConfig; - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); - - $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); + $helper = Helper::getInstance(); + $tables = $helper->getModule()->getInfo('tables'); $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; if (!file_exists($languageFolder . '/')) { @@ -98,25 +115,102 @@ function saveSampleData() $exportFolder = $languageFolder . '/Exports-' . date('Y-m-d-H-i-s') . '/'; Utility::createFolder($exportFolder); + // save module tables foreach ($tables as $table) { - \Xmf\Database\TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); + TableLoad::saveTableToYamlFile($table, $exportFolder . $table . '.yml'); } - redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'SAMPLEDATA_SUCCESS')); + // save permissions + $criteria = new \CriteriaCompo(); + $criteria->add(new \Criteria('gperm_modid', $helper->getModule()->getVar('mid'))); + $skipColumns[] = 'gperm_id'; + TableLoad::saveTableToYamlFile('group_permission', $exportFolder . 'group_permission.yml', $criteria, $skipColumns); + unset($criteria); + + \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_SUCCESS')); } function exportSchema() { - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); try { // TODO set exportSchema - // $migrate = new Rssfit\Migrate($moduleDirName); + // $migrate = new Migrate($moduleDirName); // $migrate->saveCurrentSchema(); // // redirect_header('../admin/index.php', 1, constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_SUCCESS')); - } catch (\Exception $e) { + } catch (\Throwable $e) { exit(constant('CO_' . $moduleDirNameUpper . '_' . 'EXPORT_SCHEMA_ERROR')); } } + +/** + * loadTableFromArrayWithReplace + * + * @param string $table value with should be used insead of original value of $search + * + * @param array $data array of rows to insert + * Each element of the outer array represents a single table row. + * Each row is an associative array in 'column' => 'value' format. + * @param string $search name of column for which the value should be replaced + * @param $replace + * @return int number of rows inserted + */ +function loadTableFromArrayWithReplace($table, $data, $search, $replace) +{ + /** @var \XoopsMySQLDatabase $db */ + $db = \XoopsDatabaseFactory::getDatabaseConnection(); + + $prefixedTable = $db->prefix($table); + $count = 0; + + $sql = 'DELETE FROM ' . $prefixedTable . ' WHERE `' . $search . '`=' . $db->quote($replace); + + $result = $db->queryF($sql); + + foreach ($data as $row) { + $insertInto = 'INSERT INTO ' . $prefixedTable . ' ('; + $valueClause = ' VALUES ('; + $first = true; + foreach ($row as $column => $value) { + if ($first) { + $first = false; + } else { + $insertInto .= ', '; + $valueClause .= ', '; + } + + $insertInto .= $column; + if ($search === $column) { + $valueClause .= $db->quote($replace); + } else { + $valueClause .= $db->quote($value); + } + } + + $sql = $insertInto . ') ' . $valueClause . ')'; + + $result = $db->queryF($sql); + if (false !== $result) { + ++$count; + } + } + + return $count; +} + +function clearSampleData(){ + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $helper = Helper::getInstance(); + // Load language files + $helper->loadLanguage('common'); + $tables = $helper->getModule()->getInfo('tables'); + // truncate module tables + foreach ($tables as $table) { + \Xmf\Database\TableLoad::truncateTable($table); + } + redirect_header($helper->url('admin/index.php'), 1, constant('CO_' . $moduleDirNameUpper . '_' . 'CLEAR_SAMPLEDATA_OK')); +} diff --git a/tests/index.html b/tests/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/tests/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/tests/index.php b/tests/index.php new file mode 100644 index 00000000..2ea9b7d9 --- /dev/null +++ b/tests/index.php @@ -0,0 +1,3 @@ + * @author XOOPS Development Team */ -defined('XOOPS_ROOT_PATH') || die('XOOPS root path not defined'); + +defined('XOOPS_ROOT_PATH') || exit('XOOPS root path not defined'); require_once __DIR__ . '/preloads/autoloader.php'; -$moduleDirName = basename(__DIR__); +$moduleDirName = basename(__DIR__); $moduleDirNameUpper = mb_strtoupper($moduleDirName); // ------------------- Informations ------------------- // $modversion = [ - 'version' => '1.31.0', - 'module_status' => 'Beta 2', - 'release_date' => '2019/07/06', - 'name' => _MI_RSSFIT_NAME, - 'description' => _MI_RSSFIT_DESC, - 'official' => 0, + 'version' => '1.32', + 'module_status' => 'Beta 1', + 'release_date' => '2021/10/12', + 'name' => _MI_RSSFIT_NAME, + 'description' => _MI_RSSFIT_DESC, + 'official' => 0, //1 indicates official XOOPS module supported by XOOPS Dev Team, 0 means 3rd party supported - 'author' => 'NS Tai (aka tuff)', - 'credits' => 'XOOPS Development Team, Brandycoke Productions', - 'author_mail' => 'author-email', - 'author_website_url' => 'https://xoops.org', + 'author' => 'NS Tai (aka tuff)', + 'credits' => 'XOOPS Development Team, Brandycoke Productions', + 'author_mail' => 'author-email', + 'author_website_url' => 'https://xoops.org', 'author_website_name' => 'XOOPS', - 'license' => 'GPL 2.0 or later', - 'license_url' => 'www.gnu.org/licenses/gpl-2.0.html/', - 'help' => 'page=help', + 'license' => 'GPL 2.0 or later', + 'license_url' => 'www.gnu.org/licenses/gpl-2.0.html/', + 'help' => 'page=help', // ------------------- Folders & Files ------------------- - 'release_info' => 'Changelog', - 'release_file' => XOOPS_URL . "/modules/$moduleDirName/docs/changelog.txt", + 'release_info' => 'Changelog', + 'release_file' => XOOPS_URL . "/modules/$moduleDirName/docs/changelog.txt", - 'manual' => 'link to manual file', - 'manual_file' => XOOPS_URL . "/modules/$moduleDirName/docs/install.txt", + 'manual' => 'link to manual file', + 'manual_file' => XOOPS_URL . "/modules/$moduleDirName/docs/install.txt", // images - 'image' => 'assets/images/logoModule.png', - 'iconsmall' => 'assets/images/iconsmall.png', - 'iconbig' => 'assets/images/iconbig.png', - 'dirname' => $moduleDirName, + 'image' => 'assets/images/logoModule.png', + 'iconsmall' => 'assets/images/iconsmall.png', + 'iconbig' => 'assets/images/iconbig.png', + 'dirname' => $moduleDirName, // Local path icons - 'modicons16' => 'assets/images/icons/16', - 'modicons32' => 'assets/images/icons/32', + 'modicons16' => 'assets/images/icons/16', + 'modicons32' => 'assets/images/icons/32', //About - 'demo_site_url' => 'https://xoops.org', - 'demo_site_name' => 'XOOPS Demo Site', - 'support_url' => 'https://xoops.org/modules/newbb/viewforum.php?forum=28/', - 'support_name' => 'Support Forum', - 'submit_bug' => 'https://github.com/XoopsModules25x/' . $moduleDirName . '/issues', - 'module_website_url' => 'www.xoops.org', + 'demo_site_url' => 'https://xoops.org', + 'demo_site_name' => 'XOOPS Demo Site', + 'support_url' => 'https://xoops.org/modules/newbb/viewforum.php?forum=28/', + 'support_name' => 'Support Forum', + 'submit_bug' => 'https://github.com/XoopsModules25x/' . $moduleDirName . '/issues', + 'module_website_url' => 'www.xoops.org', 'module_website_name' => 'XOOPS Project', // ------------------- Min Requirements ------------------- - 'min_php' => '5.6', - 'min_xoops' => '2.5.10', - 'min_admin' => '1.2', - 'min_db' => ['mysql' => '5.5'], + 'min_php' => '7.3', + 'min_xoops' => '2.5.10', + 'min_admin' => '1.2', + 'min_db' => ['mysql' => '5.5'], // ------------------- Admin Menu ------------------- - 'system_menu' => 1, - 'hasAdmin' => 1, - 'adminindex' => 'admin/index.php', - 'adminmenu' => 'admin/menu.php', + 'system_menu' => 1, + 'hasAdmin' => 1, + 'adminindex' => 'admin/index.php', + 'adminmenu' => 'admin/menu.php', // ------------------- Main Menu ------------------- - 'hasMain' => 1, + 'hasMain' => 1, // ------------------- Install/Update ------------------- - 'onInstall' => 'include/install.php', - 'onUpdate' => 'include/install.php', + 'onInstall' => 'include/install.php', + 'onUpdate' => 'include/install.php', // 'onUninstall' => 'include/onuninstall.php', // ------------------- PayPal --------------------------- - 'paypal' => [ - 'business' => 'xoopsfoundation@gmail.com', - 'item_name' => 'Donation : ' . _MI_RSSFIT_NAME, - 'amount' => 0, + 'paypal' => [ + 'business' => 'xoopsfoundation@gmail.com', + 'item_name' => 'Donation : ' . _MI_RSSFIT_NAME, + 'amount' => 0, 'currency_code' => 'USD', ], // ------------------- Mysql ----------------------------- - 'sqlfile' => ['mysql' => 'sql/mysql.sql'], + 'sqlfile' => ['mysql' => 'sql/mysql.sql'], // ------------------- Tables ---------------------------- - 'tables' => [ - $moduleDirName . '_' . 'plugins', - $moduleDirName . '_' . 'misc', -// 'rss' . '_' . 'plugins', -// 'rss' . '_' . 'misc', + 'tables' => [ + $moduleDirName . '_' . 'plugins', + $moduleDirName . '_' . 'misc', + // 'rss' . '_' . 'plugins', + // 'rss' . '_' . 'misc', ], ]; @@ -104,98 +105,93 @@ ['name' => _MI_RSSFIT_SUPPORT, 'link' => 'page=support'], ]; -// Templates -$modversion['templates'] = []; -$modversion['templates'][] = [ - 'file' => 'rssfit_index.tpl', - 'description' => _MI_RSSFIT_TMPL_INTRO, -]; -$modversion['templates'][] = [ - 'file' => 'rssfit_rss.tpl', - 'description' => _MI_RSSFIT_TMPL_RSS, +// ------------------- Templates ------------------- // +$modversion['templates'] = [ + ['file' => 'rssfit_index.tpl', 'description' => _MI_RSSFIT_TMPL_INTRO,], + ['file' => 'rssfit_rss.tpl', 'description' => _MI_RSSFIT_TMPL_RSS,], ]; // Module Configs // $helper->getConfig('overall_entries') $modversion['config'][] = [ - 'name' => 'overall_entries', + 'name' => 'overall_entries', 'title' => '_MI_RSSFIT_OVERALL_ENTRIES', 'description' => '_MI_RSSFIT_OVERALL_ENTRIES_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 20, + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 20, ]; // $helper->getConfig('plugin_entries') $modversion['config'][] = [ - 'name' => 'plugin_entries', + 'name' => 'plugin_entries', 'title' => '_MI_RSSFIT_PLUGIN_ENTRIES', 'description' => '_MI_RSSFIT_PLUGIN_ENTRIES_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 5, + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 5, ]; // $helper->getConfig('sort') $modversion['config'][] = [ - 'name' => 'sort', + 'name' => 'sort', 'title' => '_MI_RSSFIT_ENTRIES_SORT', 'description' => '_MI_RSSFIT_ENTRIES_SORT_DESC', - 'formtype' => 'select', - 'valuetype' => 'text', - 'default' => 'd', + 'formtype' => 'select', + 'valuetype' => 'text', + 'default' => 'd', 'options' => [_MI_RSSFIT_ENTRIES_SORT_DATE => 'd', _MI_RSSFIT_ENTRIES_SORT_CAT => 'c'], ]; // $helper->getConfig('cache') $modversion['config'][] = [ - 'name' => 'cache', + 'name' => 'cache', 'title' => '_MI_RSSFIT_CACHE', 'description' => '_MI_RSSFIT_CACHE_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 0, + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 0, ]; // $helper->getConfig('max_char') $modversion['config'][] = [ - 'name' => 'max_char', + 'name' => 'max_char', 'title' => '_MI_RSSFIT_MAXCHAR', 'description' => '_MI_RSSFIT_MAXCHAR_DESC', - 'formtype' => 'textbox', - 'valuetype' => 'int', - 'default' => 0, + 'formtype' => 'textbox', + 'valuetype' => 'int', + 'default' => 0, ]; // $helper->getConfig('strip_html') $modversion['config'][] = [ - 'name' => 'strip_html', + 'name' => 'strip_html', 'title' => '_MI_RSSFIT_STRIPHTML', 'description' => '_MI_RSSFIT_STRIPHTML_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 0, + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 0, ]; // $helper->getConfig('utf8') $modversion['config'][] = [ - 'name' => 'utf8', + 'name' => 'utf8', 'title' => '_MI_RSSFIT_ENCODE_UTF8', 'description' => '_MI_RSSFIT_ENCODE_UTF8_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 0, + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 0, ]; // $helper->getConfig('mime') $modversion['config'][] = [ - 'name' => 'mime', + 'name' => 'mime', 'title' => '_MI_RSSFIT_OUTOUT_MIME', 'description' => '', - 'formtype' => 'select', - 'valuetype' => 'int', - 'default' => 1, + 'formtype' => 'select', + 'valuetype' => 'int', + 'default' => 1, 'options' => [_MI_RSSFIT_OUTOUT_MIME_XML => 1, _MI_RSSFIT_OUTOUT_MIME_HTML => 2, _MI_RSSFIT_OUTOUT_MIME_PHP => 3], ]; @@ -203,22 +199,22 @@ * Make Sample button visible? */ $modversion['config'][] = [ - 'name' => 'displaySampleButton', - 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', + 'name' => 'displaySampleButton', + 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON', 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_SAMPLE_BUTTON_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 1, + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 1, ]; /** * Show Developer Tools? */ $modversion['config'][] = [ - 'name' => 'displayDeveloperTools', - 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', + 'name' => 'displayDeveloperTools', + 'title' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS', 'description' => 'CO_' . $moduleDirNameUpper . '_' . 'SHOW_DEV_TOOLS_DESC', - 'formtype' => 'yesno', - 'valuetype' => 'int', - 'default' => 0, + 'formtype' => 'yesno', + 'valuetype' => 'int', + 'default' => 0, ]; From 7fee6d5c236721b0acf1a76221a8c85ed1a5cf51 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 13 Oct 2021 03:01:30 -0400 Subject: [PATCH 066/154] Scrutinizer --- admin/do_intro.php | 4 ++-- class/Common/Migrate.php | 3 --- class/Common/SysUtility.php | 8 ++++++-- class/FeedHandler.php | 3 ++- class/Helper.php | 2 +- class/MiscHandler.php | 2 +- class/PluginHandler.php | 2 +- class/Plugins/Smartpartner.php | 2 +- class/Plugins/Smartsection.php | 2 +- 9 files changed, 15 insertions(+), 13 deletions(-) diff --git a/admin/do_intro.php b/admin/do_intro.php index 170c0854..4ea68496 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -36,8 +36,8 @@ } switch ($op) { default: - $title = new \XoopsFormText(_AM_EDIT_INTRO_TITLE, 'title', 50, 255, $intro->getVar('misc_title', 'e')); - $title->setDescription(_AM_EDIT_INTRO_TITLE_DESC); + $title = new \XoopsFormText(_AM_RSSFIT_EDIT_INTRO_TITLE, 'title', 50, 255, $intro->getVar('misc_title', 'e')); + $title->setDescription(_AM_RSSFIT_EDIT_INTRO_TITLE_DESC); $setting = $intro->getVar('misc_setting'); $contentTray = new \XoopsFormElementTray(_AM_RSSFIT_EDIT_INTRO_TEXT, '
      '); diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index 61252a7e..366bd872 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -12,9 +12,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ -use \XoopsModules\Rssfit\{ - Common\Configurator -}; /** * Class Migrate synchronize existing tables with target schema diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 59220539..0a94a590 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -23,8 +23,12 @@ * @author Mamba */ -use XoopsModules\Rssfit; -use XoopsModules\Rssfit\Helper; +use Xmf\Request; +use XoopsFormEditor; +use XoopsModules\Rssfit\{ + Helper +}; + /** * Class SysUtility diff --git a/class/FeedHandler.php b/class/FeedHandler.php index c9e4f772..0cbc4e8a 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -363,13 +363,14 @@ public function wrapCdata(&$text) /** * @param string $fields * @param string $type - * @return false + * @return bool|array */ public function &getActivatedSubfeeds($fields = '', $type = '') { $ret = false; $subs = $this->pluginHandler->getObjects2(new \Criteria('subfeed', 1), $fields); if ($subs) { + $ret = []; switch ($type) { default: $ret = &$subs; diff --git a/class/Helper.php b/class/Helper.php index 6ff8ef5d..f8297724 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -40,7 +40,7 @@ public function __construct($debug = false) /** * @param bool $debug * - * @return \XoopsModules\xxxxx\Helper + * @return \XoopsModules\Rssfit\Helper */ public static function getInstance(bool $debug = false): Helper { diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 5d88887c..cfadc707 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -130,7 +130,7 @@ public function getCount($criteria = null) * @param null|\CriteriaElement $criteria * @param string $fields * @param string $key - * @return false + * @return false|array */ public function getObjects2($criteria = null, $fields = '*', $key = '') { diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 58af328f..8530bf3e 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -195,7 +195,7 @@ public function delete(\XoopsObject $obj, $force = false) * @param null|\Criteria|\CriteriaCompo $criteria * @param string $fields * @param string $key - * @return bool + * @return bool|array */ public function getObjects2($criteria = null, $fields = '*', $key = '') { diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php index 752d8092..2b3120f5 100644 --- a/class/Plugins/Smartpartner.php +++ b/class/Plugins/Smartpartner.php @@ -32,7 +32,6 @@ */ use XoopsModules\Smartpartner\{ - Constants, Helper as SmartpartnerHelper }; @@ -77,6 +76,7 @@ public function grabEntries(&$obj) $partnerHandler = SmartpartnerHelper::getInstance()->getHandler('Partner'); $partners = $partnerHandler->getPartners($this->grab, 0, Constants::SPARTNER_STATUS_ACTIVE, 'weight', 'DESC'); if (false !== $partners && \count($partners) > 0) { + $ret = []; for ($i = 0, $iMax = \count($partners); $i < $iMax; ++$i) { $ret[$i]['link'] = $ret[$i]['guid'] = SMARTPARTNER_URL . 'partner.php?id=' . $partners[$i]->getVar('id'); $ret[$i]['title'] = $partners[$i]->getVar('title', 'n'); diff --git a/class/Plugins/Smartsection.php b/class/Plugins/Smartsection.php index 2f529a4a..1e8bbfb1 100644 --- a/class/Plugins/Smartsection.php +++ b/class/Plugins/Smartsection.php @@ -70,7 +70,7 @@ public function grabEntries(&$obj) { $ret = false; require_once XOOPS_ROOT_PATH . '/modules/smartsection/include/common.php'; - $helper = SmartsectionHandler::getInstance(); + $helper = SmartsectionHelper::getInstance(); $itemHandler = $helper->getHandler('Item'); $items = $itemHandler->getAllPublished($this->grab, 0); if (false !== $items && \count($items) > 0) { From 8597391e252b4f48559fceb67e629a5217d96736 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 13 Oct 2021 03:12:45 -0400 Subject: [PATCH 067/154] Scrutinizer --- class/FeedHandler.php | 4 ++-- class/MiscHandler.php | 2 +- class/PluginHandler.php | 4 ++-- class/Plugins/Smartpartner.php | 1 + 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 0cbc4e8a..f059d9f5 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -113,7 +113,7 @@ public function getChannel(&$feed) { $channel = []; $elements = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channel')); - if ($elements) { + if (\is_array($elements) && \count($elements) > 0) { foreach ($elements as $e) { if ('' != $e->getVar('misc_content')) { $channel[$e->getVar('misc_title')] = $e->getVar('misc_content', 'n'); @@ -369,7 +369,7 @@ public function &getActivatedSubfeeds($fields = '', $type = '') { $ret = false; $subs = $this->pluginHandler->getObjects2(new \Criteria('subfeed', 1), $fields); - if ($subs) { + if (\is_array($subs) && \count($subs) > 0) { $ret = []; switch ($type) { default: diff --git a/class/MiscHandler.php b/class/MiscHandler.php index cfadc707..96216093 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -100,7 +100,7 @@ public function get($id = null, $fields = null) { $criteria = new \Criteria($this->obj_key, (int)$id); $objs = $this->getObjects2($criteria); - if ($objs) { + if (\is_array($objs) && \count($objs) > 0) { return 1 != \count($objs) ? false : $objs[0]; } diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 8530bf3e..972812c5 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -105,7 +105,7 @@ public function get($id = null, $fields = null) $ret = false; $criteria = new \Criteria($this->obj_key, (int)$id); $objs = $this->getObjects2($criteria); - if ($objs && 1 === \count($objs)) { + if (\is_array($objs) && 1 === \count($objs)) { $ret = &$objs[0]; } @@ -319,7 +319,7 @@ public function &getPluginFileList() { $ret = false; $objs = $this->getObjects2(null, 'rssf_filename'); - if ($objs) { + if (\is_array($objs) && \count($objs) > 0) { $ret = []; foreach ($objs as $o) { $ret[] = $o->getVar('rssf_filename'); diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php index 2b3120f5..33ee3253 100644 --- a/class/Plugins/Smartpartner.php +++ b/class/Plugins/Smartpartner.php @@ -32,6 +32,7 @@ */ use XoopsModules\Smartpartner\{ + Constants, Helper as SmartpartnerHelper }; From daee27b0d7a4da5d68589bff739c9a71cb630e7e Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 13 Oct 2021 03:36:53 -0400 Subject: [PATCH 068/154] Scrutinizer --- .scrutinizer.yml | 4 ++++ class/FeedHandler.php | 4 ++-- class/MiscHandler.php | 8 ++++---- class/PluginHandler.php | 4 ++-- class/Plugins/Comments.php | 1 + class/Plugins/Extcal.php | 5 +++-- class/Plugins/Myalbum.php | 1 + class/Plugins/News.php | 1 + class/Plugins/Wfdownloads.php | 9 +++++---- class/Plugins/Wflinks.php | 1 + include/oninstall.php | 1 + 11 files changed, 25 insertions(+), 14 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 59d0fa84..ef092bea 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -18,3 +18,7 @@ filter: dependency_paths: - XoopsCore25/* - tag/* + - publisher/* + - smartfaq/* + - smartpartner/* + - smartsection/* diff --git a/class/FeedHandler.php b/class/FeedHandler.php index f059d9f5..e53eb050 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -185,7 +185,7 @@ public function getSticky(&$feed) $feed['sticky']['description'] = $sticky->getVar('misc_content'); $this->cleanupChars($feed['sticky']['title']); $this->cleanupChars($feed['sticky']['link']); - $this->cleanupChars($feed['sticky']['description'], $setting['dohtml'] ? 0 : 1, false); + $this->cleanupChars($feed['sticky']['description'], $setting['dohtml'] ? false : true, false); $this->wrapCdata($feed['sticky']['description']); $feed['sticky']['pubdate'] = $this->rssTimeStamp(\time()); } @@ -225,7 +225,7 @@ public function getItems(&$feed) if (count($entries) > 0) { for ($i = 0, $iMax = count($entries); $i < $iMax; $i++) { $this->cleanupChars($entries[$i]['title']); - $strip = $this->modConfig['strip_html'] ? 1 : 0; + $strip = $this->modConfig['strip_html'] ? true : false; $this->cleanupChars($entries[$i]['description'], $strip, 0, 1); $this->wrapCdata($entries[$i]['description']); $entries[$i]['category'] = $this->myts->undoHtmlSpecialChars($entries[$i]['category']); diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 96216093..18ff49f3 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -46,7 +46,7 @@ class MiscHandler extends \XoopsPersistableObjectHandler public function __construct(\XoopsDatabase $db = null, $helper = null) { if (null === $helper) { - $helper = \XoopsModules\Rssfit\Helper::getInstance(); + $helper = Helper::getInstance(); } $this->helper = $helper; @@ -76,7 +76,7 @@ public function getInstance(\XoopsDatabase $db = null) /** * @param bool $isNew - * @return \XoopsObject + * @return \XoopsModules\Rssfit\MiscHandler */ public function create($isNew = true) { @@ -127,7 +127,7 @@ public function getCount($criteria = null) } /** - * @param null|\CriteriaElement $criteria + * @param null|\Criteria|\CriteriaCompo $criteria * @param string $fields * @param string $key * @return false|array @@ -229,7 +229,7 @@ public function insert(\XoopsObject $obj, $force = false) } /** - * @param null|\CriteriaElement $criteria + * @param null|\Criteria|\CriteriaCompo $criteria * @param array $fields * @param bool $force * @return false|string diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 972812c5..04115bcb 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -80,7 +80,7 @@ public function getInstance(\XoopsDatabase $db = null): PluginHandler /** * @param bool $isNew - * @return \XoopsObject + * @return \XoopsModules\Rssfit\PluginHandler */ public function create($isNew = true) { @@ -245,7 +245,7 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') } /** - * @param null|\CriteriaElement $criteria + * @param null|\Criteria|\CriteriaCompo $criteria * @param array $fields * @param bool $force * @return bool|string diff --git a/class/Plugins/Comments.php b/class/Plugins/Comments.php index a716ddfb..59a9b3de 100644 --- a/class/Plugins/Comments.php +++ b/class/Plugins/Comments.php @@ -69,6 +69,7 @@ public function grabEntries(&$obj) { $ret = false; require XOOPS_ROOT_PATH . '/include/comment_constants.php'; + /** @var \XoopsCommentHandler $commentHandler */ $commentHandler = \xoops_getHandler('comment'); $criteria = new CriteriaCompo(new Criteria('com_status', \XOOPS_COMMENT_ACTIVE)); $criteria->setLimit($this->grab); diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index 4f572400..0658a5bd 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -93,9 +93,10 @@ public function grabEntries(&$obj) // read confgs to get timestamp format $extcal = $this->module; + /** @var \XoopsConfigHandler $configHandler */ $configHandler = \xoops_getHandler('config'); - $extcalConfig = $configHandler->getConfigsByCat(0, $extcal->getVar('mid')); - $long_form = $extcalConfig['date_long']; + $extcalConfig = $configHandler->getConfigsByCat(0, $extcal->getVar('mid')); + $long_form = $extcalConfig['date_long']; $eventHandler = ExtcalHelper::getInstance()->getHandler('Event'); $catHandler = ExtcalHelper::getInstance()->getHandler('Category'); diff --git a/class/Plugins/Myalbum.php b/class/Plugins/Myalbum.php index c4621958..9e41850b 100644 --- a/class/Plugins/Myalbum.php +++ b/class/Plugins/Myalbum.php @@ -92,6 +92,7 @@ public function myGetUnameFromId($uid) } if (!\is_object($thisUser)) { + /** @var \XoopsMemberHandler $memberHandler */ $memberHandler = \xoops_getHandler('member'); $thisUser = $memberHandler->getUser($uid); } diff --git a/class/Plugins/News.php b/class/Plugins/News.php index 24d577e0..49420a6a 100644 --- a/class/Plugins/News.php +++ b/class/Plugins/News.php @@ -48,6 +48,7 @@ class News public $dirname = 'news'; public $modname; public $grab; + public $module; /** * @return false|string diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php index 6de6182b..6e1ca930 100644 --- a/class/Plugins/Wfdownloads.php +++ b/class/Plugins/Wfdownloads.php @@ -68,11 +68,12 @@ public function grabEntries(&$obj) { global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); + /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); - $ret = false; - $i = 0; - $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); + $ret = false; + $i = 0; + $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); /** @var \XoopsMemberHandler $memberHandler */ $memberHandler = xoops_getHandler('member'); while (false !== ($row = $xoopsDB->fetchArray($result))) { diff --git a/class/Plugins/Wflinks.php b/class/Plugins/Wflinks.php index fc06cfef..3cea9572 100644 --- a/class/Plugins/Wflinks.php +++ b/class/Plugins/Wflinks.php @@ -71,6 +71,7 @@ public function grabEntries(&$obj) global $xoopsDB, $xoopsUser; $groups = \is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; + /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = \xoops_getHandler('groupperm'); $myts = \MyTextSanitizer::getInstance(); diff --git a/include/oninstall.php b/include/oninstall.php index 682eaa39..1a766da1 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -66,6 +66,7 @@ function xoops_module_install_rssfit(\XoopsModule $module) global $xoopsModule; $moduleId = $xoopsModule->getVar('mid'); // $moduleId2 = $helper->getModule()->mid(); + /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); // access rights ------------------------------------------ $grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); From f2ccd5c0e5e36394ca2326db640e7c3d149fe404 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 13 Oct 2021 03:44:11 -0400 Subject: [PATCH 069/154] Solar --- class/FeedHandler.php | 4 ++-- class/MiscHandler.php | 2 +- class/PluginHandler.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index e53eb050..74557f02 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -113,7 +113,7 @@ public function getChannel(&$feed) { $channel = []; $elements = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channel')); - if (\is_array($elements) && \count($elements) > 0) { + if (\is_array($elements) && !empty($elements)) { foreach ($elements as $e) { if ('' != $e->getVar('misc_content')) { $channel[$e->getVar('misc_title')] = $e->getVar('misc_content', 'n'); @@ -369,7 +369,7 @@ public function &getActivatedSubfeeds($fields = '', $type = '') { $ret = false; $subs = $this->pluginHandler->getObjects2(new \Criteria('subfeed', 1), $fields); - if (\is_array($subs) && \count($subs) > 0) { + if (\is_array($subs) && !empty($subs)) { $ret = []; switch ($type) { default: diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 18ff49f3..10f730b9 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -100,7 +100,7 @@ public function get($id = null, $fields = null) { $criteria = new \Criteria($this->obj_key, (int)$id); $objs = $this->getObjects2($criteria); - if (\is_array($objs) && \count($objs) > 0) { + if (\is_array($objs) && !empty($objs)) { return 1 != \count($objs) ? false : $objs[0]; } diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 04115bcb..ff7b0679 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -319,7 +319,7 @@ public function &getPluginFileList() { $ret = false; $objs = $this->getObjects2(null, 'rssf_filename'); - if (\is_array($objs) && \count($objs) > 0) { + if (\is_array($objs) && !empty($objs)) { $ret = []; foreach ($objs as $o) { $ret[] = $o->getVar('rssf_filename'); From 6433741c74fc00210a43f06707c839909d58b3fb Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 13 Oct 2021 03:48:35 -0400 Subject: [PATCH 070/154] Type cast is unnecessary --- class/Common/SysUtility.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 0a94a590..a1e40e41 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -185,7 +185,7 @@ public static function cloneRecord(string $tableName, string $idField, int $id) $newId = false; $table = $GLOBALS['xoopsDB']->prefix($tableName); // copy content of the record you wish to clone - $sql = "SELECT * FROM $table WHERE $idField='" . (int)$id . "' "; + $sql = "SELECT * FROM $table WHERE $idField='" . $id . "' "; $tempTable = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql), \MYSQLI_ASSOC); if (!$tempTable) { exit($GLOBALS['xoopsDB']->error()); From c7fd521fcae4cf8f98113653d3249df4b2560882 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 13 Oct 2021 04:03:57 -0400 Subject: [PATCH 071/154] mysqli_result --- class/Plugins/Adslight.php | 19 ++++--- class/Plugins/Ams.php | 1 + class/Plugins/Apcal.php | 29 +++++----- class/Plugins/Buyersguide.php | 1 + class/Plugins/Buyersguidemanufacturers.php | 1 + class/Plugins/Buyersguidenews.php | 1 + class/Plugins/Comments.php | 1 + class/Plugins/Extcal.php | 2 +- class/Plugins/Lexikon.php | 45 ++++++++------- class/Plugins/Myalbum.php | 63 +++++++++++---------- class/Plugins/Mydownloads.php | 21 ++++--- class/Plugins/Mylinks.php | 22 ++++---- class/Plugins/Mytube.php | 22 ++++---- class/Plugins/Newbb.php | 46 +++++++-------- class/Plugins/News.php | 3 +- class/Plugins/Pical.php | 22 ++++---- class/Plugins/Queries.php | 36 ++++++------ class/Plugins/Rmdp.php | 22 ++++---- class/Plugins/Sample.php | 60 ++++++++++---------- class/Plugins/Smartfaq.php | 20 +++---- class/Plugins/Smartsection.php | 1 + class/Plugins/Surnames.php | 66 +++++++++++----------- class/Plugins/Weblinks.php | 34 +++++------ class/Plugins/Wfdownloads.php | 28 ++++----- class/Plugins/Wfdownloads_podcast.php | 48 ++++++++-------- class/Plugins/Wflinks.php | 33 +++++------ class/Plugins/Wfsection.php | 26 +++++---- class/Plugins/Wfsection2.php | 1 + class/Plugins/Xoopstube.php | 22 ++++---- 29 files changed, 371 insertions(+), 325 deletions(-) diff --git a/class/Plugins/Adslight.php b/class/Plugins/Adslight.php index 176362c2..2655e5c4 100644 --- a/class/Plugins/Adslight.php +++ b/class/Plugins/Adslight.php @@ -63,20 +63,23 @@ public function loadModule() public function grabEntries(&$obj) { global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT lid, title, status, desctext, date from ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid = 'Yes' ORDER BY date DESC"; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT lid, title, status, desctext, date from ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid = 'Yes' ORDER BY date DESC"; $result = $xoopsDB->query($sql, $this->grab, 0); + if ($result instanceof \mysqli_result) { + $ret = []; while (false !== ($row = $xoopsDB->fetchArray($result))) { $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewads.php?lid=' . $row['lid'] ?? ''; - $ret[$i]['title'] = $row['title']; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['title'] = $row['title']; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['date']; $ret[$i]['description'] = $row['desctext']; // $myts->displayTarea($row['desctext']); - $ret[$i]['extras'] = []; + $ret[$i]['extras'] = []; $i++; } + } return $ret; } diff --git a/class/Plugins/Ams.php b/class/Plugins/Ams.php index f8a14411..9b51fa76 100644 --- a/class/Plugins/Ams.php +++ b/class/Plugins/Ams.php @@ -71,6 +71,7 @@ public function grabEntries(&$obj) $myts = \MyTextSanitizer::getInstance(); $ams = Story::getAllPublished($this->grab, 0); if (\count($ams) > 0) { + $ret = []; for ($i = 0, $iMax = \count($ams); $i < $iMax; ++$i) { $ret[$i]['title'] = $myts->undoHtmlSpecialChars($ams[$i]->title()); $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . "/modules/$this->dirname/article.php?storyid=" . $ams[$i]->storyid(); diff --git a/class/Plugins/Apcal.php b/class/Plugins/Apcal.php index e801faa7..c9e3de54 100644 --- a/class/Plugins/Apcal.php +++ b/class/Plugins/Apcal.php @@ -63,20 +63,23 @@ public function loadModule() public function grabEntries(&$obj) { global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' . $xoopsDB->prefix('apcal_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' . $xoopsDB->prefix('apcal_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['summary']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/index.php?event_id=' . $row['id']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['dtstamp']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - $i++; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $ret[$i]['title'] = $row['summary']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/index.php?event_id=' . $row['id']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['dtstamp']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } } return $ret; diff --git a/class/Plugins/Buyersguide.php b/class/Plugins/Buyersguide.php index 34ad90fd..1753686c 100644 --- a/class/Plugins/Buyersguide.php +++ b/class/Plugins/Buyersguide.php @@ -69,6 +69,7 @@ public function grabEntries(&$obj) $i = 0; if (false !== $items && \count($items) > 0) { + $ret = []; foreach ($items as $item) { $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); $ret[$i]['title'] = $item->getVar('prod_title', 'n'); diff --git a/class/Plugins/Buyersguidemanufacturers.php b/class/Plugins/Buyersguidemanufacturers.php index 0d4d5422..161441e3 100644 --- a/class/Plugins/Buyersguidemanufacturers.php +++ b/class/Plugins/Buyersguidemanufacturers.php @@ -69,6 +69,7 @@ public function grabEntries(&$obj) $i = 0; if (false !== $items && \count($items) > 0) { + $ret = []; foreach ($items as $item) { $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); $ret[$i]['title'] = $item->getVar('manu_name', 'n'); diff --git a/class/Plugins/Buyersguidenews.php b/class/Plugins/Buyersguidenews.php index eddd3914..1a1e5170 100644 --- a/class/Plugins/Buyersguidenews.php +++ b/class/Plugins/Buyersguidenews.php @@ -69,6 +69,7 @@ public function grabEntries(&$obj) $i = 0; if (false !== $items && \count($items) > 0) { + $ret = []; foreach ($items as $item) { $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); $ret[$i]['title'] = $item->getVar('news_title', 'n'); diff --git a/class/Plugins/Comments.php b/class/Plugins/Comments.php index 59a9b3de..e445936c 100644 --- a/class/Plugins/Comments.php +++ b/class/Plugins/Comments.php @@ -79,6 +79,7 @@ public function grabEntries(&$obj) $comment_config = []; if (\count($comments) > 0) { $modules = $GLOBALS['module_handler']->getObjects(new Criteria('hascomments', 1), true); + $ret = []; foreach (\array_keys($comments) as $i) { $mid = $comments[$i]->getVar('com_modid'); if (!isset($comment_config[$mid])) { diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index 0658a5bd..94b07ed0 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -103,9 +103,9 @@ public function grabEntries(&$obj) $events = $eventHandler->getUpcomingEvent(0, $this->grab, 0); if (\is_array($events)) { + $ret = []; foreach ($events as $event) { ++$i; - $cat = $catHandler->getCat($event->getVar('cat_id'), 0); $category = $cat->getVar('cat_name'); $link = XOOPS_URL . '/modules/extcal/event.php?event=' . $event->getVar('event_id'); diff --git a/class/Plugins/Lexikon.php b/class/Plugins/Lexikon.php index 3daf8250..62ae7269 100644 --- a/class/Plugins/Lexikon.php +++ b/class/Plugins/Lexikon.php @@ -71,27 +71,30 @@ public function grabEntries(&$obj) $i = 0; $sql = 'SELECT entryID, categoryID, term, definition, datesub FROM ' . $xoopsDB->prefix('lxentries') . ' WHERE submit = 0 AND offline = 0 ORDER BY datesub DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - // required - $ret[$i]['title'] = $row['term']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/entry.php?entryID=' . $row['entryID']; - //$ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['datesub']; - $ret[$i]['description'] = $myts->displayTarea($row['definition']); - // optional - //5. The item synopsis, or description, whatever - //$ret[$i]['guid'] = $link; - // 6. A string + domain that identifies a categorization taxonomy - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - /*$ret[$i]['extras'] = []; - // 7a. without attribute - $ret[$i]['extras']['author'] = array('content' => 'aabbc@c.com'); - // 7b. with attributes - $ret[$i]['extras']['enclosure']['attributes'] = array('url' => 'url-to-any-file', 'length' => 1024000, 'type' => 'audio/mpeg'); - */ - $i++; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + // required + $ret[$i]['title'] = $row['term']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/entry.php?entryID=' . $row['entryID']; + //$ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['datesub']; + $ret[$i]['description'] = $myts->displayTarea($row['definition']); + // optional + //5. The item synopsis, or description, whatever + //$ret[$i]['guid'] = $link; + // 6. A string + domain that identifies a categorization taxonomy + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + /*$ret[$i]['extras'] = []; + // 7a. without attribute + $ret[$i]['extras']['author'] = array('content' => 'aabbc@c.com'); + // 7b. with attributes + $ret[$i]['extras']['enclosure']['attributes'] = array('url' => 'url-to-any-file', 'length' => 1024000, 'type' => 'audio/mpeg'); + */ + $i++; + } } return $ret; diff --git a/class/Plugins/Myalbum.php b/class/Plugins/Myalbum.php index 9e41850b..c38f2add 100644 --- a/class/Plugins/Myalbum.php +++ b/class/Plugins/Myalbum.php @@ -125,37 +125,40 @@ public function grabEntries(&$obj) $sql .= 'WHERE p.status > 0 AND p.cid = c.cid AND p.lid = t.lid '; $sql .= 'ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/photo.php?lid=' . $row['lid']; - $thumb = XOOPS_URL . '/uploads/thumbs/' . $row['lid'] . '.' . $row['ext']; - $name = $this->myGetUnameFromId($row['submitter']); - $title = $myts->displayTarea($row['title']); - $cat = $myts->displayTarea($row['cat']); - $catlink = XOOPS_URL . '/modules/' . $this->dirname . '/viewcat.php?cid=' . $row['cid']; - /* - * Required elements of an RSS item - */ - // 1. Title of an item - $ret[$i]['title'] = $this->modname . ': ' . $title; - // 2. URL of an item - $ret[$i]['link'] = $link; - // 3. Item modification date, must be in Unix time format - $ret[$i]['timestamp'] = $row['date']; - // 4. The item synopsis, or description, whatever - $desc = '

      ' . $title . ' '; - $desc .= 'By ' . $name . ' in ' . $cat . '
      '; - $desc .= $myts->displayTarea($row['description']) . '


      '; - $ret[$i]['description'] = $desc; - /* - * Optional elements of an RSS item - */ - // 5. The item synopsis, or description, whatever - $ret[$i]['guid'] = $link; - // 6. A string + domain that identifies a categorization taxonomy - $ret[$i]['category'] = $cat; - $ret[$i]['domain'] = $catlink; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $link = XOOPS_URL . '/modules/' . $this->dirname . '/photo.php?lid=' . $row['lid']; + $thumb = XOOPS_URL . '/uploads/thumbs/' . $row['lid'] . '.' . $row['ext']; + $name = $this->myGetUnameFromId($row['submitter']); + $title = $myts->displayTarea($row['title']); + $cat = $myts->displayTarea($row['cat']); + $catlink = XOOPS_URL . '/modules/' . $this->dirname . '/viewcat.php?cid=' . $row['cid']; + /* + * Required elements of an RSS item + */ + // 1. Title of an item + $ret[$i]['title'] = $this->modname . ': ' . $title; + // 2. URL of an item + $ret[$i]['link'] = $link; + // 3. Item modification date, must be in Unix time format + $ret[$i]['timestamp'] = $row['date']; + // 4. The item synopsis, or description, whatever + $desc = '

      ' . $title . ' '; + $desc .= 'By ' . $name . ' in ' . $cat . '
      '; + $desc .= $myts->displayTarea($row['description']) . '


      '; + $ret[$i]['description'] = $desc; + /* + * Optional elements of an RSS item + */ + // 5. The item synopsis, or description, whatever + $ret[$i]['guid'] = $link; + // 6. A string + domain that identifies a categorization taxonomy + $ret[$i]['category'] = $cat; + $ret[$i]['domain'] = $catlink; - $i++; + $i++; + } } return $ret; diff --git a/class/Plugins/Mydownloads.php b/class/Plugins/Mydownloads.php index cf4a4f65..1c1d64bd 100644 --- a/class/Plugins/Mydownloads.php +++ b/class/Plugins/Mydownloads.php @@ -69,15 +69,18 @@ public function grabEntries(&$obj) $i = 0; $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'; $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - $i++; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } } return $ret; diff --git a/class/Plugins/Mylinks.php b/class/Plugins/Mylinks.php index 01e2c13f..dcca8a3c 100644 --- a/class/Plugins/Mylinks.php +++ b/class/Plugins/Mylinks.php @@ -70,17 +70,19 @@ public function grabEntries(&$obj) $i = 0; $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - $i++; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } } - return $ret; } } diff --git a/class/Plugins/Mytube.php b/class/Plugins/Mytube.php index 365d3eba..50e17377 100644 --- a/class/Plugins/Mytube.php +++ b/class/Plugins/Mytube.php @@ -69,17 +69,19 @@ public function grabEntries(&$obj) $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['ltitle']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - $i++; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $ret[$i]['title'] = $row['ltitle']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } } - return $ret; } } diff --git a/class/Plugins/Newbb.php b/class/Plugins/Newbb.php index 904216c6..04efb1f0 100644 --- a/class/Plugins/Newbb.php +++ b/class/Plugins/Newbb.php @@ -69,30 +69,30 @@ public function grabEntries(&$obj) { global $xoopsDB; require_once XOOPS_ROOT_PATH . '/modules/' . $this->dirname . '/class/class.forumposts.php'; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; - $i = 0; - $sql = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.nohtml, p.nosmiley, f.forum_name, t.post_text FROM ' - . $xoopsDB->prefix('bb_posts') - . ' p, ' - . $xoopsDB->prefix('bb_forums') - . ' f, ' - . $xoopsDB->prefix('bb_posts_text') - . ' t WHERE f.forum_id = p.forum_id AND p.post_id = t.post_id AND f.forum_type != 1 ORDER BY p.post_time DESC'; - if (!$result = $xoopsDB->query($sql, $this->grab, 0)) { - return $ret; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.nohtml, p.nosmiley, f.forum_name, t.post_text FROM ' + . $xoopsDB->prefix('bb_posts') + . ' p, ' + . $xoopsDB->prefix('bb_forums') + . ' f, ' + . $xoopsDB->prefix('bb_posts_text') + . ' t WHERE f.forum_id = p.forum_id AND p.post_id = t.post_id AND f.forum_type != 1 ORDER BY p.post_time DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; + $ret[$i]['title'] = $row['subject']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['post_time']; + $ret[$i]['description'] = $myts->displayTarea($row['post_text'], $row['nohtml'] ? 0 : 1, $row['nosmiley'] ? 0 : 1); + $ret[$i]['category'] = $row['forum_name']; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; + $i++; + } } - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewtopic.php?topic_id=' . $row['topic_id'] . '&forum=' . $row['forum_id'] . '&post_id=' . $row['post_id'] . '#forumpost' . $row['post_id']; - $ret[$i]['title'] = $row['subject']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['post_time']; - $ret[$i]['description'] = $myts->displayTarea($row['post_text'], $row['nohtml'] ? 0 : 1, $row['nosmiley'] ? 0 : 1); - $ret[$i]['category'] = $row['forum_name']; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/viewforum.php?forum=' . $row['forum_id']; - $i++; - } - return $ret; } } diff --git a/class/Plugins/News.php b/class/Plugins/News.php index 49420a6a..a348a3c8 100644 --- a/class/Plugins/News.php +++ b/class/Plugins/News.php @@ -30,11 +30,9 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ - use XoopsModules\News\NewsStory; use XoopsModules\News\Utility; - if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -81,6 +79,7 @@ public function grabEntries(&$obj) $news = NewsStory::getAllPublished($this->grab, 0); } if (\count($news) > 0) { + $ret = []; for ($i = 0, $iMax = \count($news); $i < $iMax; ++$i) { $ret[$i]['title'] = $this->modname . ': ' . $myts->undoHtmlSpecialChars($news[$i]->title()); $ret[$i]['link'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); diff --git a/class/Plugins/Pical.php b/class/Plugins/Pical.php index 4edfc4d5..28e066d8 100644 --- a/class/Plugins/Pical.php +++ b/class/Plugins/Pical.php @@ -68,17 +68,19 @@ public function grabEntries(&$obj) $i = 0; $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' . $xoopsDB->prefix('pical_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['summary']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/index.php?event_id=' . $row['id']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['dtstamp']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - $i++; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $ret[$i]['title'] = $row['summary']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/index.php?event_id=' . $row['id']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['dtstamp']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } } - return $ret; } } diff --git a/class/Plugins/Queries.php b/class/Plugins/Queries.php index 4444b7bd..4ccad5e6 100644 --- a/class/Plugins/Queries.php +++ b/class/Plugins/Queries.php @@ -78,26 +78,28 @@ public function grabEntries(&$obj) $sql .= ' WHERE approved=1 ORDER BY posted DESC '; $result = $xoopsDB->query($sql, $limit, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - ++$i; - if ($i <= $this->grab) { - $desc = $row['querytext']; - if (mb_strlen($desc) > 200) { - $desc = mb_substr($desc, 0, 200) . '...'; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + ++$i; + if ($i <= $this->grab) { + $desc = $row['querytext']; + if (mb_strlen($desc) > 200) { + $desc = mb_substr($desc, 0, 200) . '...'; + } + $link = XOOPS_URL . '/modules/queries/view.php?id=' . $row['id']; + $ret[$i]['title'] = $this->modname . ': ' . $row['title']; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['posted']; + $ret[$i]['guid'] = $link; + $ret[$i]['category'] = $this->modname; + $ret[$i]['description'] = $desc; + } + if ($i > $this->grab) { + break; } - $link = XOOPS_URL . '/modules/queries/view.php?id=' . $row['id']; - $ret[$i]['title'] = $this->modname . ': ' . $row['title']; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['posted']; - $ret[$i]['guid'] = $link; - $ret[$i]['category'] = $this->modname; - $ret[$i]['description'] = $desc; - } - if ($i > $this->grab) { - break; } } - return $ret; } } diff --git a/class/Plugins/Rmdp.php b/class/Plugins/Rmdp.php index 23cc4fa7..8a93f472 100644 --- a/class/Plugins/Rmdp.php +++ b/class/Plugins/Rmdp.php @@ -68,17 +68,19 @@ public function grabEntries(&$obj) $i = 0; $sql = 'SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ' . $xoopsDB->prefix('rmdp_software') . ' ORDER BY fecha DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['nombre']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/down.php?id=' . $row['id_soft']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['fecha']; - $ret[$i]['description'] = $row['longdesc']; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - $i++; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $ret[$i]['title'] = $row['nombre']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/down.php?id=' . $row['id_soft']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['fecha']; + $ret[$i]['description'] = $row['longdesc']; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } } - return $ret; } } diff --git a/class/Plugins/Sample.php b/class/Plugins/Sample.php index 25ce9191..b9185040 100644 --- a/class/Plugins/Sample.php +++ b/class/Plugins/Sample.php @@ -90,36 +90,38 @@ public function grabEntries(&$obj) // The following example code grabs the latest entries from the module MyLinks $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - /* - * Required elements of an RSS item - */ - // 1. Title of an item - $ret[$i]['title'] = $row['title']; - // 2. URL of an item - $ret[$i]['link'] = $link; - // 3. Item modification date, must be in Unix time format - $ret[$i]['timestamp'] = $row['date']; - // 4. The item synopsis, or description, whatever - $ret[$i]['description'] = $myts->displayTarea($row['description']); - /* - * Optional elements of an RSS item - */ - // 5. The item synopsis, or description, whatever - $ret[$i]['guid'] = $link; - // 6. A string + domain that identifies a categorization taxonomy - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - // 7. extra tags examples - $ret[$i]['extras'] = []; - // 7a. without attribute - $ret[$i]['extras']['author'] = ['content' => 'aabbc@c.com']; - // 7b. with attributes - $ret[$i]['extras']['enclosure']['attributes'] = ['url' => 'url-to-any-file', 'length' => 1024000, 'type' => 'audio/mpeg']; - $i++; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + /* + * Required elements of an RSS item + */ + // 1. Title of an item + $ret[$i]['title'] = $row['title']; + // 2. URL of an item + $ret[$i]['link'] = $link; + // 3. Item modification date, must be in Unix time format + $ret[$i]['timestamp'] = $row['date']; + // 4. The item synopsis, or description, whatever + $ret[$i]['description'] = $myts->displayTarea($row['description']); + /* + * Optional elements of an RSS item + */ + // 5. The item synopsis, or description, whatever + $ret[$i]['guid'] = $link; + // 6. A string + domain that identifies a categorization taxonomy + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + // 7. extra tags examples + $ret[$i]['extras'] = []; + // 7a. without attribute + $ret[$i]['extras']['author'] = ['content' => 'aabbc@c.com']; + // 7b. with attributes + $ret[$i]['extras']['enclosure']['attributes'] = ['url' => 'url-to-any-file', 'length' => 1024000, 'type' => 'audio/mpeg']; + $i++; + } } - return $ret; } } diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php index bfb53e8d..607c4b32 100644 --- a/class/Plugins/Smartfaq.php +++ b/class/Plugins/Smartfaq.php @@ -32,7 +32,6 @@ use XoopsModules\Smartfaq\Helper as SmartfaqHelper; - if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -68,26 +67,27 @@ public function loadModule() public function grabEntries(&$obj) { $ret = false; -// @require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; + // @require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; /** @var \XoopsModules\Smartfaq\FaqHandler $faqHandler */ $faqHandler = SmartfaqHelper::getInstance()->getHandler('Faq'); - $faqs = $faqHandler->getAllPublished($this->grab, 0); + $faqs = $faqHandler->getAllPublished($this->grab, 0); if (false !== $faqs && \count($faqs) > 0) { + $ret = []; /** @var \XoopsModules\Smartfaq\AnswerHandler $answerHandler */ $answerHandler = SmartfaqHelper::getInstance()->getHandler('Answer'); for ($i = 0, $iMax = \count($faqs); $i < $iMax; ++$i) { if (!$answer = $answerHandler->getOfficialAnswer($faqs[$i]->faqid())) { continue; } - $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $faqs[$i]->faqid(); - $q = $faqs[$i]->getVar('howdoi', 'n'); - $q = empty($q) ? $faqs[$i]->getVar('question', 'n') : $q; - $ret[$i]['title'] = $q; - $ret[$i]['timestamp'] = $faqs[$i]->getVar('datesub'); + $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/smartfaq/faq.php?faqid=' . $faqs[$i]->faqid(); + $q = $faqs[$i]->getVar('howdoi', 'n'); + $q = empty($q) ? $faqs[$i]->getVar('question', 'n') : $q; + $ret[$i]['title'] = $q; + $ret[$i]['timestamp'] = $faqs[$i]->getVar('datesub'); $ret[$i]['description'] = $answer->getVar('answer'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } diff --git a/class/Plugins/Smartsection.php b/class/Plugins/Smartsection.php index 1e8bbfb1..e441a121 100644 --- a/class/Plugins/Smartsection.php +++ b/class/Plugins/Smartsection.php @@ -74,6 +74,7 @@ public function grabEntries(&$obj) $itemHandler = $helper->getHandler('Item'); $items = $itemHandler->getAllPublished($this->grab, 0); if (false !== $items && \count($items) > 0) { + $ret = []; for ($i = 0, $iMax = \count($items); $i < $iMax; ++$i) { $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php index 3a3cdaba..f64e5cf4 100644 --- a/class/Plugins/Surnames.php +++ b/class/Plugins/Surnames.php @@ -105,43 +105,45 @@ public function grabEntries(&$obj) $sql = "SELECT uid, id, surname, notes, DATE_FORMAT(changed_ts,'%Y-%m-%d') as changedate FROM " . $xoopsDB->prefix('surnames'); $sql .= ' WHERE approved=1 ORDER BY changedate DESC, uid '; $result = $xoopsDB->query($sql, $limit, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $changedate = \strtotime($row['changedate']); - $uid = $row['uid']; - if ($lasttime == $changedate && $lastuser == $uid) { - $link = XOOPS_URL . '/modules/surnames/view.php?id=' . $row['id']; - $surname = $row['surname']; - $desc .= "$surname
      "; - } else { - if ($i >= 0) { - $ret[$i]['description'] = $desc; - } - ++$i; - $lasttime = $changedate; - $lastuser = $uid; - if ($i <= $this->grab) { - $desc = ''; - $name = $this->myGetUnameFromId($row['uid']); - $ret[$i]['title'] = $this->modname . ': by ' . $name; - $ret[$i]['link'] = XOOPS_URL . '/modules/surnames/list.php?uid=' . $row['uid']; - $ret[$i]['timestamp'] = $changedate; - - $link = XOOPS_URL . '/modules/surnames/view.php?id=' . $row['id']; - $ret[$i]['guid'] = $link; - $ret[$i]['category'] = $this->modname; - + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $changedate = \strtotime($row['changedate']); + $uid = $row['uid']; + if ($lasttime == $changedate && $lastuser == $uid) { + $link = XOOPS_URL . '/modules/surnames/view.php?id=' . $row['id']; $surname = $row['surname']; - $desc .= "$surname
      "; + $desc .= "$surname
      "; + } else { + if ($i >= 0) { + $ret[$i]['description'] = $desc; + } + ++$i; + $lasttime = $changedate; + $lastuser = $uid; + if ($i <= $this->grab) { + $desc = ''; + $name = $this->myGetUnameFromId($row['uid']); + $ret[$i]['title'] = $this->modname . ': by ' . $name; + $ret[$i]['link'] = XOOPS_URL . '/modules/surnames/list.php?uid=' . $row['uid']; + $ret[$i]['timestamp'] = $changedate; + + $link = XOOPS_URL . '/modules/surnames/view.php?id=' . $row['id']; + $ret[$i]['guid'] = $link; + $ret[$i]['category'] = $this->modname; + + $surname = $row['surname']; + $desc .= "$surname
      "; + } + } + if ($i > $this->grab) { + break; } } - if ($i > $this->grab) { - break; + if ($i < $this->grab) { + $ret[$i]['description'] = $desc; } } - if ($i < $this->grab) { - $ret[$i]['description'] = $desc; - } - return $ret; } } diff --git a/class/Plugins/Weblinks.php b/class/Plugins/Weblinks.php index 5554c5b0..30b86dce 100644 --- a/class/Plugins/Weblinks.php +++ b/class/Plugins/Weblinks.php @@ -97,23 +97,25 @@ public function grabEntries(&$obj) $i = 0; $sql = 'SELECT lid, title, time_update, description, url, uid FROM ' . $xoopsDB->prefix('weblinks_link') . ' ORDER BY time_update DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $title = $row['title']; - $name = $this->myGetUnameFromId($row['uid']); - $ret[$i]['title'] = $this->modname . ': ' . $title; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?lid=' . $row['lid'] . '&keywords='; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['time_update']; - $desc = '

      ' . $title . '
      '; - $desc .= 'Submitted by: ' . $name . '
      '; - $desc .= $myts->displayTarea($row['description']) . '


      '; - $ret[$i]['description'] = $desc; - $ret[$i]['guid'] = $link; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - $i++; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $title = $row['title']; + $name = $this->myGetUnameFromId($row['uid']); + $ret[$i]['title'] = $this->modname . ': ' . $title; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?lid=' . $row['lid'] . '&keywords='; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['time_update']; + $desc = '

      ' . $title . '
      '; + $desc .= 'Submitted by: ' . $name . '
      '; + $desc .= $myts->displayTarea($row['description']) . '


      '; + $ret[$i]['description'] = $desc; + $ret[$i]['guid'] = $link; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } } - return $ret; } } diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php index 6e1ca930..342025fd 100644 --- a/class/Plugins/Wfdownloads.php +++ b/class/Plugins/Wfdownloads.php @@ -74,21 +74,23 @@ public function grabEntries(&$obj) $i = 0; $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - /** @var \XoopsMemberHandler $memberHandler */ - $memberHandler = xoops_getHandler('member'); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - if ($grouppermHandler->checkRight('WFDownFilePerm', $row['lid'], \is_object($GLOBALS['xoopsUser']) ? $memberHandler->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - $i++; + if ($result instanceof \mysqli_result) { + $ret = []; + /** @var \XoopsMemberHandler $memberHandler */ + $memberHandler = xoops_getHandler('member'); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + if ($grouppermHandler->checkRight('WFDownFilePerm', $row['lid'], \is_object($GLOBALS['xoopsUser']) ? $memberHandler->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } } } - return $ret; } } diff --git a/class/Plugins/Wfdownloads_podcast.php b/class/Plugins/Wfdownloads_podcast.php index c25c6c17..af98cbcb 100644 --- a/class/Plugins/Wfdownloads_podcast.php +++ b/class/Plugins/Wfdownloads_podcast.php @@ -73,31 +73,33 @@ public function grabEntries(&$obj) $i = 0; $sql = 'SELECT lid, cid, title, date, description, filetype, size FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 AND (expired > ' . \time() . ' OR expired = 0) AND published <= ' . \time() . ' ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - /** @var \XoopsMemberHandler $memberHandler */ - $memberHandler = xoops_getHandler('member'); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - if ((isset($perms[$row['cid']]) && true === $perms[$row['cid']]) - || $grouppermHandler->checkRight('WFDownCatPerm', $row['cid'], \is_object($GLOBALS['xoopsUser']) ? $memberHandler->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { - $perms[$row['cid']] = true; - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - // enclosure tag, a.k.a podcast - $ret[$i]['extras']['enclosure']['attributes'] = [ - 'url' => XOOPS_URL . '/modules/' . $this->dirname . '/visit.php?cid=' . $row['cid'] . '&lid=' . $row['lid'], - 'length' => $row['size'], - 'type' => $row['filetype'], - ]; - $i++; - } else { - $perms[$row['cid']] = false; + if ($result instanceof \mysqli_result) { + $ret = []; + /** @var \XoopsMemberHandler $memberHandler */ + $memberHandler = xoops_getHandler('member'); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + if ((isset($perms[$row['cid']]) && true === $perms[$row['cid']]) + || $grouppermHandler->checkRight('WFDownCatPerm', $row['cid'], \is_object($GLOBALS['xoopsUser']) ? $memberHandler->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { + $perms[$row['cid']] = true; + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + // enclosure tag, a.k.a podcast + $ret[$i]['extras']['enclosure']['attributes'] = [ + 'url' => XOOPS_URL . '/modules/' . $this->dirname . '/visit.php?cid=' . $row['cid'] . '&lid=' . $row['lid'], + 'length' => $row['size'], + 'type' => $row['filetype'], + ]; + $i++; + } else { + $perms[$row['cid']] = false; + } } } - return $ret; } } diff --git a/class/Plugins/Wflinks.php b/class/Plugins/Wflinks.php index 3cea9572..2e63a3ab 100644 --- a/class/Plugins/Wflinks.php +++ b/class/Plugins/Wflinks.php @@ -70,27 +70,28 @@ public function grabEntries(&$obj) { global $xoopsDB, $xoopsUser; - $groups = \is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; + $groups = \is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = \xoops_getHandler('groupperm'); - $myts = \MyTextSanitizer::getInstance(); - $ret = []; - $i = 0; - $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; + $myts = \MyTextSanitizer::getInstance(); + $ret = false; + $i = 0; + $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); if ($result instanceof \mysqli_result) { - while (false !== ($row = $xoopsDB->fetchArray($result))) { - if ($grouppermHandler->checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { - // required - $ret[$i]['title'] = $row['title']; - $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $row['description']; - // optional - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - $i++; + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + if ($grouppermHandler->checkRight('WFLinkCatPerm', $row['cid'], $groups, $this->mid)) { + // required + $ret[$i]['title'] = $row['title']; + $ret[$i]['link'] = $ret[$i]['guid'] = XOOPS_URL . '/modules/' . $this->dirname . '/singlelink.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $row['description']; + // optional + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; } } } diff --git a/class/Plugins/Wfsection.php b/class/Plugins/Wfsection.php index 0c7201fc..4b58bd99 100644 --- a/class/Plugins/Wfsection.php +++ b/class/Plugins/Wfsection.php @@ -82,20 +82,22 @@ public function grabEntries(&$obj) . ') AND a.noshowart = 0 AND a.offline = 0 AND a.categoryid = b.id ORDER BY published DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - if (checkAccess($row['groupid'])) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/article.php?articleid=' . $row['articleid']; - $ret[$i]['title'] = $row['atitle']; - $ret[$i]['link'] = $link; - $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['published']; - $ret[$i]['description'] = $myts->displayTarea(!empty($row['summary']) ? $row['summary'] : $row['maintext']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - $i++; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + if (checkAccess($row['groupid'])) { + $link = XOOPS_URL . '/modules/' . $this->dirname . '/article.php?articleid=' . $row['articleid']; + $ret[$i]['title'] = $row['atitle']; + $ret[$i]['link'] = $link; + $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['published']; + $ret[$i]['description'] = $myts->displayTarea(!empty($row['summary']) ? $row['summary'] : $row['maintext']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } } } - return $ret; } } diff --git a/class/Plugins/Wfsection2.php b/class/Plugins/Wfsection2.php index bd6e1000..ad3c2935 100644 --- a/class/Plugins/Wfsection2.php +++ b/class/Plugins/Wfsection2.php @@ -69,6 +69,7 @@ public function grabEntries(&$obj) $ret = false; $articles = Rssfit\WfsArticle::getAllArticle($this->grab, 0, 'online'); if (\count($articles) > 0) { + $ret = []; $xoopsModuleConfig['shortartlen'] = 0; $myts = \MyTextSanitizer::getInstance(); for ($i = 0, $iMax = \count($articles); $i < $iMax; ++$i) { diff --git a/class/Plugins/Xoopstube.php b/class/Plugins/Xoopstube.php index 9caaac75..983f7910 100644 --- a/class/Plugins/Xoopstube.php +++ b/class/Plugins/Xoopstube.php @@ -69,17 +69,19 @@ public function grabEntries(&$obj) $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $ret[$i]['title'] = $row['ltitle']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - $i++; + if ($result instanceof \mysqli_result) { + $ret = []; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $ret[$i]['title'] = $row['ltitle']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlevideo.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } } - return $ret; } } From c911a418eca1f4b896e57f649ef88ab973f27652 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 14 Oct 2021 04:16:52 -0400 Subject: [PATCH 072/154] fix callback in FeedHandler --- class/FeedHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 74557f02..3cc9e230 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -236,7 +236,7 @@ public function getItems(&$feed) $entries[$i]['pubdate'] = $this->rssTimeStamp($entries[$i]['timestamp']); } if (empty($feed['plugin']) && 'd' === $this->modConfig['sort']) { - uasort($entries, 'sortTimestamp'); + uasort($entries, [$this, 'sortTimestamp']); } if (count($entries) > $this->modConfig['overall_entries'] && empty($feed['plugin'])) { $entries = array_slice($entries, 0, $this->modConfig['overall_entries']); From 1847e2ee4c3216003c565ef24b3d5effea5f71e1 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 14 Oct 2021 04:17:43 -0400 Subject: [PATCH 073/154] RssfitCorePreload --- preloads/core.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/preloads/core.php b/preloads/core.php index 168ee11d..c0a274ac 100644 --- a/preloads/core.php +++ b/preloads/core.php @@ -18,7 +18,7 @@ /** * Class RssCorePreload */ -class RssCorePreload extends \XoopsPreloadItem +class RssfitCorePreload extends \XoopsPreloadItem { // to add PSR-4 autoloader From 27500e46223c99db5a5d4a80fcd7dca222d70ca1 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 14 Oct 2021 04:20:21 -0400 Subject: [PATCH 074/154] added RSS Reader --- class/Utility.php | 120 +++++++++++++++++++++++++++++------- rssreader.php | 19 ++++++ templates/rssfit_reader.tpl | 3 + xoops_version.php | 3 +- 4 files changed, 121 insertions(+), 24 deletions(-) create mode 100644 rssreader.php create mode 100644 templates/rssfit_reader.tpl diff --git a/class/Utility.php b/class/Utility.php index 1a819b15..89855dcf 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -37,26 +37,6 @@ class Utility extends Common\SysUtility { //--------------- Custom module methods ----------------------------- - public static function rssfitAdminHeader() - { - global $xoopsModule, $xoopsConfig; - - \xoops_loadLanguage('modinfo', 'rssfit'); - - require __DIR__ . '/menu.php'; - for ($i = 0, $iMax = \count($adminmenu); $i < $iMax; ++$i) { - $links[$i] = [0 => \RSSFIT_URL . $adminmenu[$i]['link'], 1 => $adminmenu[$i]['title']]; - } - $links[] = [0 => XOOPS_URL . '/modules/system/admin.php?fct=preferences&op=showmod&mod=' . $xoopsModule->getVar('mid'), 1 => _PREFERENCES]; - $admin_links = ''; - foreach ($links as $i => $iValue) { - $admin_links .= ''; - } - $admin_links .= "
      ' . $iValue[1] . '

      \n"; - \xoops_cp_header(); - echo $admin_links; - } - /** * @param $a * @param $b @@ -74,7 +54,7 @@ public static function sortTimestamp($a, $b) /** * @param $spec * @param $feedHandler - * @return mixed|string + * @return string */ public static function genSpecMoreInfo($spec, $feedHandler) { @@ -93,8 +73,7 @@ public static function genSpecMoreInfo($spec, $feedHandler) public static function rssfGenAnchor($url = '', $text = '', $target = '', $title = '', $class = '', $id = '') { if (!empty($url)) { - $ret = ''; - $ret .= ' 0 display at most $max_words words + */ + public static function get_rss_feed_as_html($feed_url, $max_item_cnt = 10, $show_date = true, $show_description = true, $max_words = 0, $cache_timeout = 7200, $cache_prefix = XOOPS_VAR_PATH . '/caches/xoops_cache/rss2html-') + { + $result = ''; + // get feeds and parse items + $rss = new \DOMDocument(); + $cache_file = $cache_prefix . \md5($feed_url); + // load from file or load content + if ($cache_timeout > 0 + && \is_file($cache_file) + && (\filemtime($cache_file) + $cache_timeout > \time())) { + $rss->load($cache_file); + } else { + $rss->load($feed_url); + if ($cache_timeout > 0) { + $rss->save($cache_file); + } + } + $feed = []; + foreach ($rss->getElementsByTagName('item') as $node) { + $item = [ + 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue, + 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, + 'content' => $node->getElementsByTagName('description')->item(0)->nodeValue, + 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, + 'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue, + ]; + $content = $node->getElementsByTagName('encoded'); // + if ($content->length > 0) { + $item['content'] = $content->item(0)->nodeValue; + } + $feed[] = $item; + } + // real good count + if ($max_item_cnt > \count($feed)) { + $max_item_cnt = \count($feed); + } + $result .= '
        '; + for ($x = 0; $x < $max_item_cnt; $x++) { + $title = \str_replace(' & ', ' & ', $feed[$x]['title']); + $link = $feed[$x]['link']; + $result .= '
      • '; + $result .= ''; + if ($show_date) { + $date = \date('l F d, Y', \strtotime($feed[$x]['date'])); + $result .= 'Posted on ' . $date . ''; + } + if ($show_description) { + $description = $feed[$x]['desc']; + $content = $feed[$x]['content']; + // find the img + $has_image = \preg_match('/.+?)[\'"].*>/i', $content, $image); + // no html tags + $description = \strip_tags(\preg_replace('/(<(script|style)\b[^>]*>).*?(<\/\2>)/s', '$1$3', $description), ''); + // whether cut by number of words + if ($max_words > 0) { + $arr = \explode(' ', $description); + if ($max_words < \count($arr)) { + $description = ''; + $w_cnt = 0; + foreach ($arr as $w) { + $description .= $w . ' '; + ++$w_cnt; + if ($w_cnt == $max_words) { + break; + } + } + $description .= ' ...'; + } + } + // add img if it exists + if (1 == $has_image) { + $description = '' . $description; + } + $result .= '
        ' . $description; + $result .= ' Continue Reading »' . '
        '; + } + $result .= '
      • '; + } + $result .= '
      '; + return $result; + } + + public static function output_rss_feed($feed_url, $max_item_cnt = 10, $show_date = true, $show_description = true, $max_words = 0) + { + echo self::get_rss_feed_as_html($feed_url, $max_item_cnt, $show_date, $show_description, $max_words); + } } diff --git a/rssreader.php b/rssreader.php new file mode 100644 index 00000000..a165e989 --- /dev/null +++ b/rssreader.php @@ -0,0 +1,19 @@ +getConfig('max_char'); +$max_words = 200; + +// output RSS feed to HTML +Utility::output_rss_feed($helper->url('rss.php'), 20, true, true, $max_words); + +require_once XOOPS_ROOT_PATH . '/footer.php'; diff --git a/templates/rssfit_reader.tpl b/templates/rssfit_reader.tpl new file mode 100644 index 00000000..817392be --- /dev/null +++ b/templates/rssfit_reader.tpl @@ -0,0 +1,3 @@ +

      <{$smarty.const._MI_RSSFIT_TMPL_READER}>

      + +<{$smarty.const._MI_RSSFIT_TMPL_READER_INTRO}> diff --git a/xoops_version.php b/xoops_version.php index bb51888f..1edd6aa4 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -33,7 +33,7 @@ 'description' => _MI_RSSFIT_DESC, 'official' => 0, //1 indicates official XOOPS module supported by XOOPS Dev Team, 0 means 3rd party supported - 'author' => 'NS Tai (aka tuff)', + 'author' => 'NS Tai (aka tuff), Geekwright, Mamba, Zyspec', 'credits' => 'XOOPS Development Team, Brandycoke Productions', 'author_mail' => 'author-email', 'author_website_url' => 'https://xoops.org', @@ -108,6 +108,7 @@ // ------------------- Templates ------------------- // $modversion['templates'] = [ ['file' => 'rssfit_index.tpl', 'description' => _MI_RSSFIT_TMPL_INTRO,], + ['file' => 'rssfit_reader.tpl', 'description' => _MI_RSSFIT_TMPL_READER,], ['file' => 'rssfit_rss.tpl', 'description' => _MI_RSSFIT_TMPL_RSS,], ]; From 13ab43984d687d814f46fcfbf942f5f3922c9efb Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 14 Oct 2021 04:23:30 -0400 Subject: [PATCH 075/154] language changes for RSS Reader --- docs/lang_diff.txt | 12 ++++-------- language/english/install.php | 8 +++++--- language/english/modinfo.php | 2 ++ 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/docs/lang_diff.txt b/docs/lang_diff.txt index 92418d82..bbba33e5 100644 --- a/docs/lang_diff.txt +++ b/docs/lang_diff.txt @@ -10,13 +10,9 @@ Legend : x renamed --------------------------------------- -2.33 Beta 1 2012-07-23 +1.32 Beta 1 2021-10-14 --------------------------------------- -_ _admin.php__ -+ _AM_OLEDRION_ADD_ATTRIBUTE -+ _AM_OLEDRION_EDIT_ATTRIBUTE - - -New file to translate : - /xoops/modules/admin/gateways/paypal/language/mylanguage/main.php \ No newline at end of file +modinfo.php ++ _MI_RSSFIT_TMPL_READER ++ _MI_RSSFIT_TMPL_READER_INTRO diff --git a/language/english/install.php b/language/english/install.php index 43c93fa1..87887557 100644 --- a/language/english/install.php +++ b/language/english/install.php @@ -2,13 +2,15 @@ define('_INTRO_TITLE', 'Syndicates this site'); define('_INTRO_CONTENT', 'RSS feed RSS feed -At {SITENAME} we provide our XML RSS feed that you can quickly find the latest updates and short descriptions with an RSS reader. +At {SITENAME} we provide our XML RSS feed that you can quickly find the latest updates and short descriptions with an RSS reader. If you are unfamiliar with RSS, it is a web standard for publishing news headlines. You can read the RSS feed with special software and easily embed them into blogs and other web content. -For the RSS reader software, we recommend NetNewsWire Lite (Mac OS X), Feedreader (Windows) and AmphetaDesk (cross platform), or you may search for an RSS reader in Google. +For the RSS reader software, we recommend NetNewsWire Lite (Mac OS X), Feedreader (Windows) and AmphetaDesk (cross platform), or you may search for an RSS reader in Google.

      -Here are the URLs for each section\'s feed: +

      You can also preview all feeds in our internal RSS Reader



      + +Here are the URLs for each section\'s feed:

      {SUB} By the way, the RSS feed of this site is generated by XOOPS RSSFit.'); define('_INSTALL_INTRO_SUB', '{TITLE}: {DESC}
      {URL}

      '); diff --git a/language/english/modinfo.php b/language/english/modinfo.php index e50053d8..5092de3a 100644 --- a/language/english/modinfo.php +++ b/language/english/modinfo.php @@ -37,6 +37,8 @@ // template explanations define('_MI_RSSFIT_TMPL_INTRO', 'Introduction in module home page'); define('_MI_RSSFIT_TMPL_RSS', 'RSS feed data'); +define('_MI_RSSFIT_TMPL_READER', 'RSS Reader'); +define('_MI_RSSFIT_TMPL_READER_INTRO', 'Here you can see recent additions to our Website for selected modules. If you would like to syndicate this feed to an external RSS Reader, you can read more about how to do it here: RSS Syndication

      '); ######### version 1.1 additions ######### define('_MI_RSSFIT_OUTOUT_MIME', 'MIME type of RSS output'); From beaf9fd911592a055baadc0637257661cc2e8acb Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 14 Oct 2021 04:25:16 -0400 Subject: [PATCH 076/154] $plugin only if exists --- admin/do_plugins.php | 44 ++++++++++++++++++++++---------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 7ef06714..874e00ba 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -213,29 +213,29 @@ foreach ($keys as $k) { $plugin = $pluginHandler->get($k); if ($plugin) { - if (isset($rssf_grab[$k])) { - $plugin->setVar('rssf_grab', $rssf_grab[$k]); - $plugin->setVar('rssf_order', $rssf_order[$k]); - } - switch ($action[$k]) { - default: - $result = $pluginHandler->insert($plugin); - break; - case 'u': // uninstall - $result = $pluginHandler->delete($plugin); - break; - case 'd': // deactivate - $plugin->setVar('rssf_activated', 0); - $result = $pluginHandler->insert($plugin); - break; - case 'a': // activate - $plugin->setVar('rssf_activated', 1); - $result = $pluginHandler->insert($plugin); - break; + if (isset($rssf_grab[$k])) { + $plugin->setVar('rssf_grab', $rssf_grab[$k]); + $plugin->setVar('rssf_order', $rssf_order[$k]); + } + switch ($action[$k]) { + default: + $result = $pluginHandler->insert($plugin); + break; + case 'u': // uninstall + $result = $pluginHandler->delete($plugin); + break; + case 'd': // deactivate + $plugin->setVar('rssf_activated', 0); + $result = $pluginHandler->insert($plugin); + break; + case 'a': // activate + $plugin->setVar('rssf_activated', 1); + $result = $pluginHandler->insert($plugin); + break; + } + if (!$result) { + $err .= $plugin->getHtmlErrors(); } - } - if (!$result) { - $err .= $plugin->getHtmlErrors(); } } } From 6c48bbe0549c5f7d2ca52189156ea39e020d1309 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 14 Oct 2021 04:47:48 -0400 Subject: [PATCH 077/154] fix plugin assignment --- class/FeedHandler.php | 2 +- rss.php | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 3cc9e230..3f772da8 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -44,7 +44,7 @@ class FeedHandler public $cached = ''; public $charset = _CHARSET; public $feedkey = 'feed'; - public $plugin_file = 'rssfit.%s.php'; + public $plugin_file = '%s.php'; public $substr_remove = [',', '/', ';', ':', '(', '{', '[', ' ']; public $substr_add = ['.', '!', '?', '}', ']', ')', '%']; public $substr_endwith = '...'; diff --git a/rss.php b/rss.php index d3983097..0bb4f2b3 100644 --- a/rss.php +++ b/rss.php @@ -18,8 +18,10 @@ */ use XoopsModules\Rssfit\{ + FeedHandler, Helper }; +/** @var FeedHandler $feedHandler */ if (function_exists('mb_http_output')) { mb_http_output('pass'); @@ -49,7 +51,8 @@ } $feed = []; -$feed['plugin'] = isset($_GET[$feedHandler->feedkey]) ? trim($_GET[$feedHandler->feedkey]) : ''; +$feed['plugin'] = isset($_GET['feed']) ? trim($_GET['feed']) : ''; + $feedHandler->checkSubFeed($feed); if (!$xoopsTpl->is_cached($template, $feedHandler->cached) || !$docache) { $xoopsTpl->assign('rss_encoding', $charset); From a0b97e328642dfe03befd1ce7e5fd56883a99d89 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 14 Oct 2021 04:48:31 -0400 Subject: [PATCH 078/154] changelog.txt --- docs/changelog.txt | 5 +++++ xoops_version.php | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 210085e9..c28ccaef 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -4,6 +4,11 @@ - autoloading (mamba) - updates/cosmetics (mamba) - index.html to index.php (mamba) +- added RSS Reader (mamba) +- fix callback in FeedHandler (mamba) +- ranamed to RssfitCorePreload (zyspec) +- fix plugin assignment (zyspec) +
      1.31.0 Beta 2 [NOT RELEASED]

      diff --git a/xoops_version.php b/xoops_version.php index 1edd6aa4..0043df65 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -28,7 +28,7 @@ $modversion = [ 'version' => '1.32', 'module_status' => 'Beta 1', - 'release_date' => '2021/10/12', + 'release_date' => '2021/10/14', 'name' => _MI_RSSFIT_NAME, 'description' => _MI_RSSFIT_DESC, 'official' => 0, From 439f752640c9a7242800cf5e4f4129bebe2677b2 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 14 Oct 2021 06:11:46 -0400 Subject: [PATCH 079/154] cURL option --- class/Utility.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/class/Utility.php b/class/Utility.php index 89855dcf..baf578cb 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -107,6 +107,14 @@ public static function get_rss_feed_as_html($feed_url, $max_item_cnt = 10, $show $rss->load($cache_file); } else { $rss->load($feed_url); + /* + // if load() doesn't work, you might try this + $ch = curl_init($feed_url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); + $content = curl_exec($ch); + curl_close($ch); + $rss->loadXML($content); + */ if ($cache_timeout > 0) { $rss->save($cache_file); } From 446c6224989491d1a6d4e06710948a66962749b9 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 14 Oct 2021 06:24:41 -0400 Subject: [PATCH 080/154] Scrutinizer --- .scrutinizer.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index ef092bea..2577e4e5 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -22,3 +22,8 @@ filter: - smartfaq/* - smartpartner/* - smartsection/* + - extcal/* + - extgallery/* + - adslight/* + - oledrion/* + From 46ffbfd9fa5c28503801124f691b91d7cec8dabb Mon Sep 17 00:00:00 2001 From: mambax7 Date: Thu, 14 Oct 2021 07:27:55 -0400 Subject: [PATCH 081/154] Start 1.32 Beta 2 --- docs/changelog.txt | 6 +++++- xoops_version.php | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index c28ccaef..8c741586 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,4 +1,8 @@ -
      1.32.0 Beta 1 [NOT RELEASED]
      +
      1.32.0 Beta 2 [NOT RELEASED]
      +
      + + +
      1.32.0 Beta 1 [2021-10-14]

      - namespaces (mamba) - autoloading (mamba) diff --git a/xoops_version.php b/xoops_version.php index 0043df65..be388783 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -27,7 +27,7 @@ // ------------------- Informations ------------------- // $modversion = [ 'version' => '1.32', - 'module_status' => 'Beta 1', + 'module_status' => 'Beta 2', 'release_date' => '2021/10/14', 'name' => _MI_RSSFIT_NAME, 'description' => _MI_RSSFIT_DESC, From e1e9c976b1d7c74295061bebe88098a69c14b187 Mon Sep 17 00:00:00 2001 From: ggoffy Date: Thu, 14 Oct 2021 18:53:38 +0200 Subject: [PATCH 082/154] necessary adaptions for transifex.com --- language/english/admin.php | 6 ++++-- language/english/help/help.tpl | 4 ++-- language/english/main.php | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/language/english/admin.php b/language/english/admin.php index 744001fe..52006ec5 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -8,9 +8,11 @@ define('_AM_RSSFIT_EDIT_INTRO', 'Edit introduction'); define('_AM_RSSFIT_EDIT_INTRO_TITLE', 'Introduction title'); -define('_AM_RSSFIT_EDIT_INTRO_TITLE_DESC', '{SITENAME} will print ' . $xoopsConfig['sitename']); +define('_AM_RSSFIT_EDIT_INTRO_TITLE_DESC1', '{SITENAME} will print '); +define('_AM_RSSFIT_EDIT_INTRO_TITLE_DESC', _AM_RSSFIT_EDIT_INTRO_TITLE_DESC1 . $xoopsConfig['sitename']); define('_AM_RSSFIT_EDIT_INTRO_TEXT', 'Introduction text'); -define('_AM_RSSFIT_EDIT_INTRO_TEXT_DESC', _AM_RSSFIT_EDIT_INTRO_TITLE_DESC . '

      {SITEURL} will print ' . XOOPS_URL . '/'); +define('_AM_RSSFIT_EDIT_INTRO_TEXT_DESC1', '

      {SITEURL} will print '); +define('_AM_RSSFIT_EDIT_INTRO_TEXT_DESC', _AM_RSSFIT_EDIT_INTRO_TITLE_DESC . _AM_RSSFIT_EDIT_INTRO_TEXT_DESC1 . XOOPS_URL . '/'); define('_AM_RSSFIT_EDIT_PLUGIN', 'Manage Plug-ins'); define('_AM_RSSFIT_PLUGIN_ACTIVATED', 'Activated Plug-ins'); diff --git a/language/english/help/help.tpl b/language/english/help/help.tpl index 4c2f945a..29c83d72 100644 --- a/language/english/help/help.tpl +++ b/language/english/help/help.tpl @@ -17,7 +17,7 @@ Chapter 2.12 of our XOOPS Operations Manual

      Some modules may come with a plugin that needs to be installed before use. You install a plugin, - a file name rssfit.module.php by copying it to the module/rssfit/plugins directory. You will + a file name rssfit.module.php by copying it to the modules/rssfit/class/Plugins directory. You will need to activate the new plugin in the Plug-ins administration panel.

      OPERATING INSTRUCTIONS


      @@ -31,7 +31,7 @@

      Creating Plugins

      If you are a module author (or a PHP savy user,) you can create a custom plugin to meet your needs. - The file plugins/rssfit.special.php is an example that you can use as a model. It includes extensive + The file plugins/rssfit.sample.php is an example that you can use as a model. It includes extensive comments to help guide you along the way.

      diff --git a/language/english/main.php b/language/english/main.php index 35368b74..5fa58897 100644 --- a/language/english/main.php +++ b/language/english/main.php @@ -1,2 +1,3 @@ Date: Fri, 15 Oct 2021 08:53:35 +0200 Subject: [PATCH 083/154] fix shown error after installing plugin --- class/PluginHandler.php | 2 +- docs/changelog.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/class/PluginHandler.php b/class/PluginHandler.php index ff7b0679..560da9c0 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -161,7 +161,7 @@ public function insert(\XoopsObject $obj, $force = false) return false; } // if (false === $obj->getVar($this->obj_key)) { - if (null === $obj->getVar($this->obj_key)) { + if (0 === (int)$obj->getVar($this->obj_key)) { $obj->assignVar($this->obj_key, $this->db->getInsertId()); } diff --git a/docs/changelog.txt b/docs/changelog.txt index c28ccaef..49216f44 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -8,7 +8,7 @@ - fix callback in FeedHandler (mamba) - ranamed to RssfitCorePreload (zyspec) - fix plugin assignment (zyspec) - +- fix shown error after installing plugin (goffy)
      1.31.0 Beta 2 [NOT RELEASED]

      From df3a37e83047e9ef695084035d91a36995227e65 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sat, 16 Oct 2021 21:40:11 -0400 Subject: [PATCH 084/154] strict types, return types --- admin/about.php | 2 ++ admin/admin_footer.php | 2 ++ admin/admin_header.php | 2 ++ admin/do_about.php | 3 +++ admin/do_channel.php | 2 ++ admin/do_intro.php | 6 +++-- admin/do_migrate.php | 2 ++ admin/do_plugins.php | 6 +++-- admin/do_sticky.php | 2 ++ admin/do_subfeeds.php | 2 ++ admin/index.php | 2 ++ admin/menu.php | 2 ++ admin/migrate.php | 2 ++ assets/css/index.php | 2 ++ assets/index.php | 2 ++ class/Common/Breadcrumb.php | 6 +++-- class/Common/Configurator.php | 2 ++ class/Common/FilesManagement.php | 16 +++++++------ class/Common/Migrate.php | 12 +++++----- class/Common/ServerStats.php | 4 +++- class/Common/SysUtility.php | 2 ++ class/Common/TestdataButtons.php | 8 ++++--- class/Common/VersionChecks.php | 6 +++-- class/Constants.php | 2 ++ class/FeedHandler.php | 26 ++++++++++++---------- class/Helper.php | 2 ++ class/Misc.php | 6 +++-- class/MiscHandler.php | 4 +++- class/Plugin.php | 2 ++ class/PluginHandler.php | 4 +++- class/Plugins/Adslight.php | 2 ++ class/Plugins/Ams.php | 2 ++ class/Plugins/Apcal.php | 2 ++ class/Plugins/Buyersguide.php | 2 ++ class/Plugins/Buyersguidemanufacturers.php | 2 ++ class/Plugins/Buyersguidenews.php | 2 ++ class/Plugins/Comments.php | 2 ++ class/Plugins/Extcal.php | 2 ++ class/Plugins/Lexikon.php | 2 ++ class/Plugins/Myalbum.php | 4 +++- class/Plugins/Mydownloads.php | 2 ++ class/Plugins/Mylinks.php | 2 ++ class/Plugins/Mytube.php | 2 ++ class/Plugins/Newbb.php | 2 ++ class/Plugins/News.php | 2 ++ class/Plugins/Oledrion.php | 2 ++ class/Plugins/Pical.php | 2 ++ class/Plugins/Publisher.php | 2 ++ class/Plugins/Queries.php | 2 ++ class/Plugins/Rmdp.php | 4 +++- class/Plugins/Sample.php | 2 ++ class/Plugins/Smartfaq.php | 2 ++ class/Plugins/Smartpartner.php | 2 ++ class/Plugins/Smartsection.php | 2 ++ class/Plugins/Special.php | 2 ++ class/Plugins/Surnames.php | 4 +++- class/Plugins/Weblinks.php | 4 +++- class/Plugins/Wfdownloads.php | 2 ++ class/Plugins/Wfdownloads_podcast.php | 2 ++ class/Plugins/Wflinks.php | 2 ++ class/Plugins/Wfsection.php | 2 ++ class/Plugins/Wfsection2.php | 2 ++ class/Plugins/Xoopstube.php | 2 ++ class/Utility.php | 12 +++++----- config/config.php | 2 ++ config/icons.php | 2 ++ config/imageconfig.php | 2 ++ config/index.php | 2 ++ config/paths.php | 2 ++ header.php | 2 ++ include/common.php | 2 ++ include/common0.php | 2 ++ include/install.php | 2 ++ include/oninstall.php | 2 ++ include/onuninstall.php | 3 +++ include/onupdate.php | 2 ++ index.php | 4 +++- language/english/admin.php | 2 ++ language/english/common.php | 2 ++ language/english/install.php | 2 ++ language/english/main.php | 2 ++ language/english/modinfo.php | 2 ++ preloads/autoloader.php | 2 ++ preloads/core.php | 4 +++- preloads/index.php | 2 ++ rss.php | 2 ++ rssreader.php | 2 ++ testdata/index.php | 3 +++ tests/index.php | 2 ++ xoops_version.php | 2 ++ 90 files changed, 234 insertions(+), 51 deletions(-) diff --git a/admin/about.php b/admin/about.php index c03b9b06..e50ebb59 100644 --- a/admin/about.php +++ b/admin/about.php @@ -1,4 +1,6 @@ '); $contentTray->setDescription(_AM_RSSFIT_EDIT_INTRO_TEXT_DESC . _AM_RSSFIT_EDIT_INTRO_TEXT_DESC_SUB); $contentTray->addElement(new \XoopsFormDhtmlTextArea('', 'content', $intro->getVar('misc_content', 'e'), 15, 60)); - $dohtml = new \XoopsFormCheckbox('', 'dohtml', $setting['dohtml']??''); + $dohtml = new \XoopsFormCheckBox('', 'dohtml', $setting['dohtml']??''); $dohtml->addOption(1, _AM_RSSFIT_DO_HTML); $contentTray->addElement($dohtml); - $dobr = new \XoopsFormCheckbox('', 'dobr', $setting['dobr']??''); + $dobr = new \XoopsFormCheckBox('', 'dobr', $setting['dobr']??''); $dobr->addOption(1, _AM_RSSFIT_DO_BR); $contentTray->addElement($dobr); diff --git a/admin/do_migrate.php b/admin/do_migrate.php index 3770c8b4..03555ec2 100644 --- a/admin/do_migrate.php +++ b/admin/do_migrate.php @@ -1,4 +1,6 @@ getObjects2($criteria, 'p_activated'); if ($plugins) { $ret .= "\n" @@ -93,7 +95,7 @@ } // inactive plugins - $plugins = $pluginHandler->getObjects2(new \Criteria('rssf_activated', 0), 'p_inactive'); + $plugins = $pluginHandler->getObjects2(new \Criteria('rssf_activated', '0'), 'p_inactive'); if ($plugins) { $ret .= "
      \n
      \n" . "\n"; foreach ($installable as $i) { - $action = new \XoopsFormCheckbox('', 'install[' . $i . ']'); + $action = new \XoopsFormCheckBox('', 'install[' . $i . ']'); $action->addOption('i', ' '); $ret .= "\n" . "\n" . "\n"; foreach ($plugins as $p) { $id = $p->getVar('rssf_conf_id'); - if (!$handler = $pluginHandler->checkPlugin($p)) { + if ($handler = $pluginHandler->checkPlugin($p)) { + $mod = $handler->modname; + $activate = new \XoopsFormCheckBox('', 'activate[' . $id . ']', $p->getVar('subfeed')); + $config = Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_RSSFIT_SUB_CONFIGURE); + $urlLink = '' . $feedHandler->subFeedUrl($p->getVar('rssf_filename')) . ''; + } else { $pluginHandler->forceDeactivate($p); $mod = implode('
      ', $p->getErrors()); $activate = new \XoopsFormCheckBox('', 'activate[' . $id . ']', 0); $activate->setExtra('disabled="disabled"'); $config = ' '; $urlLink = $feedHandler->subFeedUrl($p->getVar('rssf_filename')); - } else { - $mod = $handler->modname; - $activate = new \XoopsFormCheckBox('', 'activate[' . $id . ']', $p->getVar('subfeed')); - $config = Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_RSSFIT_SUB_CONFIGURE); - $urlLink = '' . $feedHandler->subFeedUrl($p->getVar('rssf_filename')) . ''; } $activate->addOption(1, ' '); $ret .= "\n" diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 2678018c..78f0aea8 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -351,10 +351,10 @@ public function checkPlugin(\XoopsObject $object) } else { $dirname = $handler->dirname; if (!empty($dirname) && \is_dir(XOOPS_ROOT_PATH . '/modules/' . $dirname)) { - if (!$handler->loadModule()) { - $object->setErrors(\_AM_RSSFIT_PLUGIN_MODNOTFOUND); - } else { + if ($handler->loadModule()) { $ret = $handler; + } else { + $object->setErrors(\_AM_RSSFIT_PLUGIN_MODNOTFOUND); } } else { $object->setErrors(\_AM_RSSFIT_PLUGIN_MODNOTFOUND); diff --git a/rss.php b/rss.php index 8ac0ce5d..f82d5e71 100644 --- a/rss.php +++ b/rss.php @@ -45,11 +45,11 @@ require_once XOOPS_ROOT_PATH . '/class/template.php'; $xoopsTpl = new \XoopsTpl(); -if (!$docache) { - $xoopsTpl->caching = 0; -} else { +if ($docache) { $xoopsTpl->caching = 2; $xoopsTpl->xoops_setCacheTime($helper->getConfig('cache') * 60); +} else { + $xoopsTpl->caching = 0; } $feed = []; From 1a9e44bad89c78b7451d40d3369562adf8350294 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 05:47:16 -0400 Subject: [PATCH 093/154] Non-optimal if conditions --- class/FeedHandler.php | 4 ++-- rss.php | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 4e1076da..75a1e639 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -241,7 +241,7 @@ public function getItems(&$feed): void if (empty($feed['plugin']) && 'd' === $this->modConfig['sort']) { uasort($entries, [$this, 'sortTimestamp']); } - if (count($entries) > $this->modConfig['overall_entries'] && empty($feed['plugin'])) { + if (empty($feed['plugin']) && count($entries) > $this->modConfig['overall_entries']) { $entries = array_slice($entries, 0, $this->modConfig['overall_entries']); } } @@ -350,7 +350,7 @@ public function cleanupChars(&$text, bool $strip = true, bool $dospec = true, bo $text = \htmlspecialchars($text, \ENT_QUOTES, $this->charset); $text = \preg_replace('/&(#\d+);/i', '&$1;', $text); } - if (!\preg_match('/utf-8/i', $this->charset) || XOOPS_USE_MULTIBYTES != 1) { + if (XOOPS_USE_MULTIBYTES != 1 || !\preg_match('/utf-8/i', $this->charset)) { $text = \str_replace(\array_map('\chr', \array_keys($this->escaped)), $this->escaped, $text); } } diff --git a/rss.php b/rss.php index f82d5e71..ed8aa04d 100644 --- a/rss.php +++ b/rss.php @@ -56,7 +56,7 @@ $feed['plugin'] = isset($_GET['feed']) ? trim($_GET['feed']) : ''; $feedHandler->checkSubFeed($feed); -if (!$xoopsTpl->is_cached($template, $feedHandler->cached) || !$docache) { +if (!$docache || !$xoopsTpl->is_cached($template, $feedHandler->cached)) { $xoopsTpl->assign('rss_encoding', $charset); $feedHandler->buildFeed($feed); $xoopsTpl->assign('feed', $feed); From 26d77187d4c3ec67c2293b2a4f59cd60b25a0f28 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 05:48:24 -0400 Subject: [PATCH 094/154] Unnecessary boolean check --- class/MiscHandler.php | 6 +++--- class/PluginHandler.php | 6 +++--- include/onuninstall.php | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/class/MiscHandler.php b/class/MiscHandler.php index c330cf14..52488f80 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -212,7 +212,7 @@ public function insert(\XoopsObject $object, $force = false) $sql = mb_substr($sql, 0, -1); $sql .= ' WHERE ' . $this->objKey . ' = ' . $object->getVar($this->objKey); } - if (false !== $force) { + if ($force) { $result = $this->db->queryF($sql); } else { $result = $this->db->query($sql); @@ -250,7 +250,7 @@ public function modifyObjects($criteria = null, array $fields = [], bool $force) if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); } - if (false !== $force) { + if ($force) { $result = $this->db->queryF($sql); } else { $result = $this->db->query($sql); @@ -275,7 +275,7 @@ public function delete(\XoopsObject $object, $force = false): bool return false; } $sql = 'DELETE FROM ' . $this->dbTable . ' WHERE ' . $this->objKey . '=' . $object->getVar($this->objKey); - if (false !== $force) { + if ($force) { $result = $this->db->queryF($sql); } else { $result = $this->db->query($sql); diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 78f0aea8..8c3cb7f5 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -151,7 +151,7 @@ public function insert(\XoopsObject $object, $force = false) $sql = mb_substr($sql, 0, -1); $sql .= ' WHERE ' . $this->objKey . ' = ' . $object->getVar($this->objKey); } - if (false !== $force) { + if ($force) { $result = $this->db->queryF($sql); } else { $result = $this->db->query($sql); @@ -180,7 +180,7 @@ public function delete(\XoopsObject $object, $force = false): bool return false; } $sql = 'DELETE FROM ' . $this->dbTable . ' WHERE ' . $this->objKey . '=' . $object->getVar($this->objKey); - if (false !== $force) { + if ($force) { $result = $this->db->queryF($sql); } else { $result = $this->db->query($sql); @@ -266,7 +266,7 @@ public function modifyObjects($criteria = null, array $fields = [], bool $force) if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); } - if (false !== $force) { + if ($force) { $result = $this->db->queryF($sql); } else { $result = $this->db->query($sql); diff --git a/include/onuninstall.php b/include/onuninstall.php index bf9dcb12..642e2b07 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -53,7 +53,7 @@ function xoops_module_uninstall_rssfit(\XoopsModule $module): bool $dirInfo = new \SplFileInfo($old_dir); if ($dirInfo->isDir()) { // The directory exists so delete it - if (false === $utility::rrmdir($old_dir)) { + if (!$utility::rrmdir($old_dir)) { $module->setErrors(sprintf(constant('CO_' . $moduleDirNameUpper . '_ERROR_BAD_DEL_PATH'), $old_dir)); $success = false; } From 5362f202b8a5ff8d6666f1789580e22afb8bd96e Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 05:49:13 -0400 Subject: [PATCH 095/154] 'array_values(...)' misused --- class/Common/SysUtility.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 7c2b0e54..920f1ef3 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -195,7 +195,7 @@ public static function cloneRecord(string $tableName, string $idField, int $id) // set the auto-incremented id's value to blank. unset($tempTable[$idField]); // insert cloned copy of the original record - $sql = "INSERT INTO $table (" . \implode(', ', \array_keys($tempTable)) . ") VALUES ('" . \implode("', '", \array_values($tempTable)) . "')"; + $sql = "INSERT INTO $table (" . \implode(', ', \array_keys($tempTable)) . ") VALUES ('" . \implode("', '", $tempTable) . "')"; $result = $GLOBALS['xoopsDB']->queryF($sql); if (!$result) { exit($GLOBALS['xoopsDB']->error()); From ef15ae7f3ec31e0cf3bc099c905e45e54877c160 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 05:50:03 -0400 Subject: [PATCH 096/154] Unqualified function/constant reference --- class/FeedHandler.php | 6 +++--- class/Plugins/Adslight.php | 2 +- class/Plugins/Apcal.php | 2 +- class/Plugins/Extcal.php | 2 +- class/Plugins/Lexikon.php | 2 +- class/Plugins/Mylinks.php | 2 +- class/Plugins/Newbb.php | 2 +- class/Plugins/Oledrion.php | 2 +- class/Plugins/Publisher.php | 2 +- class/Plugins/Smartfaq.php | 2 +- class/Plugins/Smartpartner.php | 2 +- class/Plugins/Surnames.php | 4 ++-- class/Plugins/Wfdownloads.php | 6 +++--- class/Plugins/legacy/Wfdownloads_podcast.php | 2 +- 14 files changed, 19 insertions(+), 19 deletions(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 75a1e639..1c0f06fd 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -225,7 +225,7 @@ public function getItems(&$feed): void } } } - if (count($entries) > 0) { + if (\count($entries) > 0) { foreach ($entries as $i => $iValue) { $this->cleanupChars($iValue['title']); $strip = $this->modConfig['strip_html'] ? true : false; @@ -239,10 +239,10 @@ public function getItems(&$feed): void $entries[$i]['pubdate'] = $this->rssTimeStamp((int)$iValue['timestamp']); } if (empty($feed['plugin']) && 'd' === $this->modConfig['sort']) { - uasort($entries, [$this, 'sortTimestamp']); + \uasort($entries, [$this, 'sortTimestamp']); } if (empty($feed['plugin']) && count($entries) > $this->modConfig['overall_entries']) { - $entries = array_slice($entries, 0, $this->modConfig['overall_entries']); + $entries = \array_slice($entries, 0, $this->modConfig['overall_entries']); } } diff --git a/class/Plugins/Adslight.php b/class/Plugins/Adslight.php index 3cf978ab..47b4d2e7 100644 --- a/class/Plugins/Adslight.php +++ b/class/Plugins/Adslight.php @@ -52,7 +52,7 @@ final class Adslight extends AbstractPlugin public function loadModule(): ?\XoopsModule{ $mod = null; - if (class_exists(PluginHelper::class)) { + if (\class_exists(PluginHelper::class)) { $this->helper = PluginHelper::getInstance(); $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); diff --git a/class/Plugins/Apcal.php b/class/Plugins/Apcal.php index ae4dac0a..dc9041b0 100644 --- a/class/Plugins/Apcal.php +++ b/class/Plugins/Apcal.php @@ -55,7 +55,7 @@ final class Apcal extends AbstractPlugin public function loadModule(): ?\XoopsModule{ $mod = null; - if (class_exists(PluginHelper::class)) { + if (\class_exists(PluginHelper::class)) { $this->helper = PluginHelper::getInstance(); $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index bd2a010e..c122b6c6 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -72,7 +72,7 @@ final class Extcal extends AbstractPlugin public function loadModule(): ?\XoopsModule{ $mod = null; - if (class_exists(PluginHelper::class)) { + if (\class_exists(PluginHelper::class)) { $this->helper = PluginHelper::getInstance(); $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); diff --git a/class/Plugins/Lexikon.php b/class/Plugins/Lexikon.php index 4cdce8d3..43fb5cad 100644 --- a/class/Plugins/Lexikon.php +++ b/class/Plugins/Lexikon.php @@ -54,7 +54,7 @@ final class Lexikon extends AbstractPlugin public function loadModule(): ?\XoopsModule{ $mod = null; - if (class_exists(PluginHelper::class)) { + if (\class_exists(PluginHelper::class)) { $this->helper = PluginHelper::getInstance(); $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); diff --git a/class/Plugins/Mylinks.php b/class/Plugins/Mylinks.php index 3e02c0c1..8fde0f1e 100644 --- a/class/Plugins/Mylinks.php +++ b/class/Plugins/Mylinks.php @@ -55,7 +55,7 @@ final class Mylinks extends AbstractPlugin public function loadModule(): ?\XoopsModule{ $mod = null; - if (class_exists(PluginHelper::class)) { + if (\class_exists(PluginHelper::class)) { $this->helper = PluginHelper::getInstance(); $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); diff --git a/class/Plugins/Newbb.php b/class/Plugins/Newbb.php index 1628a049..96762b47 100644 --- a/class/Plugins/Newbb.php +++ b/class/Plugins/Newbb.php @@ -55,7 +55,7 @@ final class Newbb extends AbstractPlugin public function loadModule(): ?\XoopsModule{ $mod = null; - if (class_exists(PluginHelper::class)) { + if (\class_exists(PluginHelper::class)) { $this->helper = PluginHelper::getInstance(); $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); diff --git a/class/Plugins/Oledrion.php b/class/Plugins/Oledrion.php index dec7fd71..460c54d3 100644 --- a/class/Plugins/Oledrion.php +++ b/class/Plugins/Oledrion.php @@ -47,7 +47,7 @@ final class Oledrion extends AbstractPlugin public function loadModule(): ?\XoopsModule{ $mod = null; - if (class_exists(PluginHelper::class)) { + if (\class_exists(PluginHelper::class)) { $this->helper = PluginHelper::getInstance(); $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); diff --git a/class/Plugins/Publisher.php b/class/Plugins/Publisher.php index 4c1c25ee..60c2f353 100644 --- a/class/Plugins/Publisher.php +++ b/class/Plugins/Publisher.php @@ -57,7 +57,7 @@ final class Publisher extends AbstractPlugin public function loadModule(): ?\XoopsModule{ $mod = null; - if (class_exists(PluginHelper::class)) { + if (\class_exists(PluginHelper::class)) { $this->helper = PluginHelper::getInstance(); $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php index 3327af80..c3210dc3 100644 --- a/class/Plugins/Smartfaq.php +++ b/class/Plugins/Smartfaq.php @@ -56,7 +56,7 @@ final class Smartfaq extends AbstractPlugin public function loadModule(): ?\XoopsModule{ $mod = null; - if (class_exists(PluginHelper::class)) { + if (\class_exists(PluginHelper::class)) { $this->helper = PluginHelper::getInstance(); $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php index c6ac7f95..baa2fb15 100644 --- a/class/Plugins/Smartpartner.php +++ b/class/Plugins/Smartpartner.php @@ -61,7 +61,7 @@ final class Smartpartner extends AbstractPlugin public function loadModule(): ?\XoopsModule{ $mod = null; - if (class_exists(PluginHelper::class)) { + if (\class_exists(PluginHelper::class)) { $this->helper = PluginHelper::getInstance(); $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php index bfe8b200..052a425b 100644 --- a/class/Plugins/Surnames.php +++ b/class/Plugins/Surnames.php @@ -67,9 +67,9 @@ public function myGetUnameFromId($uid): string $memberHandler = \xoops_getHandler('member'); $thisUser = $memberHandler->getUser($uid); } - $name = \htmlspecialchars($thisUser->getVar('name'), \ENT_QUOTES | ENT_HTML5); + $name = \htmlspecialchars($thisUser->getVar('name'), \ENT_QUOTES | \ENT_HTML5); if ('' == $name) { - $name = \htmlspecialchars($thisUser->getVar('uname'), \ENT_QUOTES | ENT_HTML5); + $name = \htmlspecialchars($thisUser->getVar('uname'), \ENT_QUOTES | \ENT_HTML5); } $lastUid = $uid; $lastName = $name; diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php index 25624877..cd0b7455 100644 --- a/class/Plugins/Wfdownloads.php +++ b/class/Plugins/Wfdownloads.php @@ -56,7 +56,7 @@ final class Wfdownloads extends AbstractPlugin public function loadModule(): ?\XoopsModule{ $mod = null; - if (class_exists(PluginHelper::class)) { + if (\class_exists(PluginHelper::class)) { $this->helper = PluginHelper::getInstance(); $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); @@ -77,7 +77,7 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array $myts = \MyTextSanitizer::getInstance(); /** @var \XoopsGroupPermHandler $grouppermHandler */ - $grouppermHandler = xoops_getHandler('groupperm'); + $grouppermHandler = \xoops_getHandler('groupperm'); $ret = null; $i = 0; $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; @@ -85,7 +85,7 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array if ($result instanceof \mysqli_result) { $ret = []; /** @var \XoopsMemberHandler $memberHandler */ - $memberHandler = xoops_getHandler('member'); + $memberHandler = \xoops_getHandler('member'); while (false !== ($row = $xoopsDB->fetchArray($result))) { if ($grouppermHandler->checkRight('WFDownFilePerm', $row['lid'], \is_object($GLOBALS['xoopsUser']) ? $memberHandler->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { $ret[$i]['title'] = $row['title']; diff --git a/class/Plugins/legacy/Wfdownloads_podcast.php b/class/Plugins/legacy/Wfdownloads_podcast.php index bbeb1a14..70a555d0 100644 --- a/class/Plugins/legacy/Wfdownloads_podcast.php +++ b/class/Plugins/legacy/Wfdownloads_podcast.php @@ -77,7 +77,7 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array if ($result instanceof \mysqli_result) { $ret = []; /** @var \XoopsMemberHandler $memberHandler */ - $memberHandler = xoops_getHandler('member'); + $memberHandler = \xoops_getHandler('member'); while (false !== ($row = $xoopsDB->fetchArray($result))) { if ((isset($perms[$row['cid']]) && true === $perms[$row['cid']]) || $grouppermHandler->checkRight('WFDownCatPerm', $row['cid'], \is_object($GLOBALS['xoopsUser']) ? $memberHandler->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { From 05df8eff67c23b5c6023f3b94d3c5c5152442f45 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 05:59:47 -0400 Subject: [PATCH 097/154] Redundant doc comment tag --- class/AbstractPlugin.php | 1 - class/Common/Breadcrumb.php | 2 -- class/Common/FilesManagement.php | 1 - class/Common/ServerStats.php | 1 - class/Common/SysUtility.php | 10 ------ class/Common/TestdataButtons.php | 1 - class/Common/VersionChecks.php | 3 -- class/FeedHandler.php | 17 --------- class/Helper.php | 8 ----- class/Misc.php | 6 ---- class/MiscHandler.php | 6 ---- class/PluginHandler.php | 8 ----- class/PluginInterface.php | 1 - class/Plugins/Adslight.php | 1 - class/Plugins/Ams.php | 1 - class/Plugins/Apcal.php | 1 - class/Plugins/Comments.php | 1 - class/Plugins/Extcal.php | 1 - class/Plugins/Lexikon.php | 1 - class/Plugins/Myalbum.php | 2 -- class/Plugins/Mylinks.php | 1 - class/Plugins/Newbb.php | 1 - class/Plugins/News.php | 1 - class/Plugins/Oledrion.php | 1 - class/Plugins/Pical.php | 1 - class/Plugins/Sample.php | 1 - class/Plugins/Smartfaq.php | 1 - class/Plugins/Smartpartner.php | 1 - class/Plugins/Surnames.php | 2 -- class/Plugins/Wfdownloads.php | 1 - class/Plugins/Wflinks.php | 1 - class/Plugins/Xoopstube.php | 1 - class/Plugins/legacy/Buyersguide.php | 1 - .../legacy/Buyersguidemanufacturers.php | 1 - class/Plugins/legacy/Buyersguidenews.php | 1 - class/Plugins/legacy/Mydownloads.php | 1 - class/Plugins/legacy/Mytube.php | 1 - class/Plugins/legacy/Queries.php | 1 - class/Plugins/legacy/Rmdp.php | 1 - class/Plugins/legacy/Smartsection.php | 1 - class/Plugins/legacy/Special.php | 1 - class/Plugins/legacy/Weblinks.php | 2 -- class/Plugins/legacy/Wfdownloads_podcast.php | 1 - class/Plugins/legacy/Wfsection.php | 1 - class/Utility.php | 35 ------------------- include/install.php | 12 ------- include/onupdate.php | 1 - testdata/index.php | 1 - 48 files changed, 148 deletions(-) diff --git a/class/AbstractPlugin.php b/class/AbstractPlugin.php index cfabea13..1ba084f0 100644 --- a/class/AbstractPlugin.php +++ b/class/AbstractPlugin.php @@ -66,7 +66,6 @@ public function loadModule(): ?\XoopsModule } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index b054273d..ef0b8a0c 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -48,8 +48,6 @@ public function __construct() /** * Add link to breadcrumb * - * @param string $title - * @param string $link */ public function addLink(string $title = '', string $link = ''): void { diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index 704cca14..9f1c8e0c 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -44,7 +44,6 @@ public static function createFolder(string $folder): void /** * @param $file * @param $folder - * @return bool */ public static function copyFile($file, $folder): bool { diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index 4c43b554..268230e7 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -24,7 +24,6 @@ trait ServerStats /** * serverStats() * - * @return string */ public static function getServerStats(): string { diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 920f1ef3..f4990562 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -47,7 +47,6 @@ class SysUtility /** * Access the only instance of this class * - * @return SysUtility * */ public static function getInstance(): SysUtility @@ -63,7 +62,6 @@ public static function getInstance(): SysUtility /** * @param $text * @param $form_sort - * @return string */ public static function selectSorting($text, $form_sort): string { @@ -93,10 +91,6 @@ public static function selectSorting($text, $form_sort): string } /***************Blocks***************/ - /** - * @param array $cats - * @return string - */ public static function blockAddCatSelect(array $cats): string { $cat_sql = ''; @@ -143,8 +137,6 @@ public static function metaDescription($content): void } /** - * @param string $tableName - * @param string $columnName * * @return array|false */ @@ -320,8 +312,6 @@ public static function truncateHtml( /** * Get correct text editor based on user rights * - * @param \Xmf\Module\Helper|null $helper - * @param array|null $options * * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor */ diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index 66b0d7bf..28c0e578 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -36,7 +36,6 @@ class TestdataButtons //functions for import buttons /** * @param $adminObject - * @return void */ public static function loadButtonConfig($adminObject): void { diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index e1d3054f..71c81c6a 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -91,9 +91,6 @@ public static function checkVerPhp(\XoopsModule $module = null): bool * * compares current module version with latest GitHub release * @static - * @param \Xmf\Module\Helper $helper - * @param string|null $source - * @param string|null $default * * @return string|array info about the latest module version, if newer */ diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 1c0f06fd..825c5c7a 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -165,7 +165,6 @@ public function getChannel(&$feed): void /** * @param $feed - * @return bool */ public function getSticky(&$feed): bool { @@ -251,7 +250,6 @@ public function getItems(&$feed): void /** * @param $text - * @return string */ public function doSubstr($text): string { @@ -321,7 +319,6 @@ public function rssTimeStamp($time): ?string /** * @param $a * @param $b - * @return int */ public function sortTimestamp($a, $b): int { @@ -334,8 +331,6 @@ public function sortTimestamp($a, $b): int /** * @param $text - * @param bool $strip - * @param bool $dospec * @param false $dosub */ public function cleanupChars(&$text, bool $strip = true, bool $dospec = true, bool $dosub = false): void @@ -364,8 +359,6 @@ public function wrapCdata(&$text): void } /** - * @param string $fields - * @param string $type * @return array */ public function &getActivatedSubfeeds(string $fields = '', string $type = ''): ?array @@ -390,15 +383,7 @@ public function &getActivatedSubfeeds(string $fields = '', string $type = ''): ? } /** - * @param string $caption * @param null|string|array $selected - * @param int $size - * @param bool $multi - * @param bool $none - * @param bool $main - * @param string $name - * @param string $type - * @return \XoopsFormSelect */ public function feedSelectBox(string $caption = '', $selected = null, int $size = 1, bool $multi = true, bool $none = true, bool $main = true, string $name = 'feeds', string $type = 'id'): \XoopsFormSelect { @@ -420,7 +405,6 @@ public function feedSelectBox(string $caption = '', $selected = null, int $size } /** - * @param int $key * @return string */ public function specUrl(int $key = 0): ?string @@ -433,7 +417,6 @@ public function specUrl(int $key = 0): ?string } /** - * @param string $filename * @return string */ public function subFeedUrl(string $filename = ''): ?string diff --git a/class/Helper.php b/class/Helper.php index 5cabf406..e5aa0aff 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -39,11 +39,6 @@ public function __construct($debug = false) parent::__construct($this->dirname); } - /** - * @param bool $debug - * - * @return \XoopsModules\Rssfit\Helper - */ public static function getInstance(bool $debug = false): Helper { static $instance; @@ -54,9 +49,6 @@ public static function getInstance(bool $debug = false): Helper return $instance; } - /** - * @return string - */ public function getDirname(): string { return $this->dirname; diff --git a/class/Misc.php b/class/Misc.php index ed5d8644..db7636ca 100644 --- a/class/Misc.php +++ b/class/Misc.php @@ -43,17 +43,11 @@ public function __construct() $this->initVar('misc_setting', \XOBJ_DTYPE_ARRAY, ''); } - /** - * @param bool $do - */ public function setDoHtml(bool $do = true): void { $this->vars['dohtml']['value'] = $do; } - /** - * @param bool $do - */ public function setDoBr(bool $do = true): void { $this->vars['dobr']['value'] = $do; diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 52488f80..675167b9 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -63,7 +63,6 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) /** * @param \XoopsDatabase|null $db - * @return \XoopsModules\Rssfit\MiscHandler */ public function getInstance(\XoopsDatabase $db = null): MiscHandler { @@ -129,8 +128,6 @@ public function getCount($criteria = null) /** * @param null|\Criteria|\CriteriaCompo $criteria - * @param string $fields - * @param string $key * @return false|array */ public function getObjects2($criteria = null, string $fields = '*', string $key = '') @@ -231,8 +228,6 @@ public function insert(\XoopsObject $object, $force = false) /** * @param null|\Criteria|\CriteriaCompo $criteria - * @param array $fields - * @param bool $force * @return false|string */ public function modifyObjects($criteria = null, array $fields = [], bool $force) @@ -266,7 +261,6 @@ public function modifyObjects($criteria = null, array $fields = [], bool $force) /** * @param \XoopsObject $object * @param bool $force - * @return bool */ public function delete(\XoopsObject $object, $force = false): bool { diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 8c3cb7f5..5b2163b4 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -67,7 +67,6 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) /** * @param \XoopsDatabase|null $db - * @return \XoopsPersistableObjectHandler */ public function getInstance(\XoopsDatabase $db = null): \XoopsPersistableObjectHandler { @@ -172,7 +171,6 @@ public function insert(\XoopsObject $object, $force = false) /** * @param \XoopsObject $object * @param bool $force - * @return bool */ public function delete(\XoopsObject $object, $force = false): bool { @@ -194,8 +192,6 @@ public function delete(\XoopsObject $object, $force = false): bool /** * @param null|\Criteria|\CriteriaCompo $criteria - * @param string $fields - * @param string $key * @return bool|array */ public function getObjects2($criteria = null, string $fields = '*', string $key = '') @@ -247,8 +243,6 @@ public function getObjects2($criteria = null, string $fields = '*', string $key /** * @param null|\Criteria|\CriteriaCompo $criteria - * @param array $fields - * @param bool $force * @return bool|string */ public function modifyObjects($criteria = null, array $fields = [], bool $force) @@ -301,8 +295,6 @@ public function getCount($criteria = null) /** * @param $object - * @param string $type - * @return bool */ public function forceDeactivate($object, string $type = 'rssf_activated'): bool { diff --git a/class/PluginInterface.php b/class/PluginInterface.php index d704f593..4843ace5 100644 --- a/class/PluginInterface.php +++ b/class/PluginInterface.php @@ -15,7 +15,6 @@ interface PluginInterface public function loadModule(): ?\XoopsModule; /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array; diff --git a/class/Plugins/Adslight.php b/class/Plugins/Adslight.php index 47b4d2e7..fb07e1b9 100644 --- a/class/Plugins/Adslight.php +++ b/class/Plugins/Adslight.php @@ -64,7 +64,6 @@ public function loadModule(): ?\XoopsModule{ } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Ams.php b/class/Plugins/Ams.php index 773316d7..08a1b704 100644 --- a/class/Plugins/Ams.php +++ b/class/Plugins/Ams.php @@ -51,7 +51,6 @@ final class Ams extends AbstractPlugin public $dirname = 'ams'; /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Apcal.php b/class/Plugins/Apcal.php index dc9041b0..80de5446 100644 --- a/class/Plugins/Apcal.php +++ b/class/Plugins/Apcal.php @@ -67,7 +67,6 @@ public function loadModule(): ?\XoopsModule{ } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Comments.php b/class/Plugins/Comments.php index b7f47c9c..ca3e80f8 100644 --- a/class/Plugins/Comments.php +++ b/class/Plugins/Comments.php @@ -53,7 +53,6 @@ final class Comments extends AbstractPlugin public $dirname = 'system'; /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index c122b6c6..a7ad0428 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -85,7 +85,6 @@ public function loadModule(): ?\XoopsModule{ /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Lexikon.php b/class/Plugins/Lexikon.php index 43fb5cad..948b7797 100644 --- a/class/Plugins/Lexikon.php +++ b/class/Plugins/Lexikon.php @@ -66,7 +66,6 @@ public function loadModule(): ?\XoopsModule{ } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Myalbum.php b/class/Plugins/Myalbum.php index 3d088018..18976ec5 100644 --- a/class/Plugins/Myalbum.php +++ b/class/Plugins/Myalbum.php @@ -68,7 +68,6 @@ final class Myalbum extends AbstractPlugin /** * @param $uid - * @return string */ public function myGetUnameFromId($uid): string { @@ -96,7 +95,6 @@ public function myGetUnameFromId($uid): string } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Mylinks.php b/class/Plugins/Mylinks.php index 8fde0f1e..a5d8ad91 100644 --- a/class/Plugins/Mylinks.php +++ b/class/Plugins/Mylinks.php @@ -67,7 +67,6 @@ public function loadModule(): ?\XoopsModule{ } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Newbb.php b/class/Plugins/Newbb.php index 96762b47..23b0e99f 100644 --- a/class/Plugins/Newbb.php +++ b/class/Plugins/Newbb.php @@ -67,7 +67,6 @@ public function loadModule(): ?\XoopsModule{ } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/News.php b/class/Plugins/News.php index ae279666..7c075f8b 100644 --- a/class/Plugins/News.php +++ b/class/Plugins/News.php @@ -52,7 +52,6 @@ final class News extends AbstractPlugin public $dirname = 'news'; /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Oledrion.php b/class/Plugins/Oledrion.php index 460c54d3..ac516f26 100644 --- a/class/Plugins/Oledrion.php +++ b/class/Plugins/Oledrion.php @@ -59,7 +59,6 @@ public function loadModule(): ?\XoopsModule{ } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Pical.php b/class/Plugins/Pical.php index 80f947bf..17be4621 100644 --- a/class/Plugins/Pical.php +++ b/class/Plugins/Pical.php @@ -49,7 +49,6 @@ final class Pical extends AbstractPlugin public $dirname = 'piCal'; /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Sample.php b/class/Plugins/Sample.php index ae6464ca..871e5859 100644 --- a/class/Plugins/Sample.php +++ b/class/Plugins/Sample.php @@ -68,7 +68,6 @@ final class Sample extends AbstractPlugin public $dirname = 'sample'; /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php index c3210dc3..fce5a649 100644 --- a/class/Plugins/Smartfaq.php +++ b/class/Plugins/Smartfaq.php @@ -69,7 +69,6 @@ public function loadModule(): ?\XoopsModule{ /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php index baa2fb15..8cc1441f 100644 --- a/class/Plugins/Smartpartner.php +++ b/class/Plugins/Smartpartner.php @@ -74,7 +74,6 @@ public function loadModule(): ?\XoopsModule{ /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php index 052a425b..f9b6e887 100644 --- a/class/Plugins/Surnames.php +++ b/class/Plugins/Surnames.php @@ -51,7 +51,6 @@ final class Surnames extends AbstractPlugin /** * @param $uid - * @return string */ public function myGetUnameFromId($uid): string { @@ -78,7 +77,6 @@ public function myGetUnameFromId($uid): string } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php index cd0b7455..51e44927 100644 --- a/class/Plugins/Wfdownloads.php +++ b/class/Plugins/Wfdownloads.php @@ -69,7 +69,6 @@ public function loadModule(): ?\XoopsModule{ /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Wflinks.php b/class/Plugins/Wflinks.php index af00c559..f7569b49 100644 --- a/class/Plugins/Wflinks.php +++ b/class/Plugins/Wflinks.php @@ -53,7 +53,6 @@ final class Wflinks extends AbstractPlugin public $dirname = 'wflinks'; /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/Xoopstube.php b/class/Plugins/Xoopstube.php index 53b64f95..2a2fada0 100644 --- a/class/Plugins/Xoopstube.php +++ b/class/Plugins/Xoopstube.php @@ -69,7 +69,6 @@ public function loadModule(): ?\XoopsModule{ } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/legacy/Buyersguide.php b/class/Plugins/legacy/Buyersguide.php index 051ef6cd..0cd5cb13 100644 --- a/class/Plugins/legacy/Buyersguide.php +++ b/class/Plugins/legacy/Buyersguide.php @@ -60,7 +60,6 @@ public function loadModule():?\XoopsModule } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/legacy/Buyersguidemanufacturers.php b/class/Plugins/legacy/Buyersguidemanufacturers.php index cd931e42..cf5f26d8 100644 --- a/class/Plugins/legacy/Buyersguidemanufacturers.php +++ b/class/Plugins/legacy/Buyersguidemanufacturers.php @@ -60,7 +60,6 @@ public function loadModule():?\XoopsModule } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/legacy/Buyersguidenews.php b/class/Plugins/legacy/Buyersguidenews.php index b2540944..5f4c6b8f 100644 --- a/class/Plugins/legacy/Buyersguidenews.php +++ b/class/Plugins/legacy/Buyersguidenews.php @@ -60,7 +60,6 @@ public function loadModule():?\XoopsModule } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/legacy/Mydownloads.php b/class/Plugins/legacy/Mydownloads.php index 1691d4fd..b948de32 100644 --- a/class/Plugins/legacy/Mydownloads.php +++ b/class/Plugins/legacy/Mydownloads.php @@ -60,7 +60,6 @@ public function loadModule():?\XoopsModule } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/legacy/Mytube.php b/class/Plugins/legacy/Mytube.php index 1389a445..0be1ab06 100644 --- a/class/Plugins/legacy/Mytube.php +++ b/class/Plugins/legacy/Mytube.php @@ -59,7 +59,6 @@ public function loadModule():?\XoopsModule } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/legacy/Queries.php b/class/Plugins/legacy/Queries.php index 3ef93588..5b11618c 100644 --- a/class/Plugins/legacy/Queries.php +++ b/class/Plugins/legacy/Queries.php @@ -62,7 +62,6 @@ public function loadModule():?\XoopsModule } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/legacy/Rmdp.php b/class/Plugins/legacy/Rmdp.php index 0bedacb3..57dede65 100644 --- a/class/Plugins/legacy/Rmdp.php +++ b/class/Plugins/legacy/Rmdp.php @@ -60,7 +60,6 @@ public function loadModule():?\XoopsModule } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/legacy/Smartsection.php b/class/Plugins/legacy/Smartsection.php index d3add8cc..98682674 100644 --- a/class/Plugins/legacy/Smartsection.php +++ b/class/Plugins/legacy/Smartsection.php @@ -65,7 +65,6 @@ public function loadModule():?\XoopsModule } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/legacy/Special.php b/class/Plugins/legacy/Special.php index 42eaf148..81ae9f7b 100644 --- a/class/Plugins/legacy/Special.php +++ b/class/Plugins/legacy/Special.php @@ -78,7 +78,6 @@ public function loadModule():?\XoopsModule } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/legacy/Weblinks.php b/class/Plugins/legacy/Weblinks.php index b89516bd..ac4d4034 100644 --- a/class/Plugins/legacy/Weblinks.php +++ b/class/Plugins/legacy/Weblinks.php @@ -61,7 +61,6 @@ public function loadModule():?\XoopsModule /** * @param $uid - * @return string */ public function myGetUnameFromId($uid): string { @@ -88,7 +87,6 @@ public function myGetUnameFromId($uid): string } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/legacy/Wfdownloads_podcast.php b/class/Plugins/legacy/Wfdownloads_podcast.php index 70a555d0..035490ca 100644 --- a/class/Plugins/legacy/Wfdownloads_podcast.php +++ b/class/Plugins/legacy/Wfdownloads_podcast.php @@ -63,7 +63,6 @@ public function loadModule():?\XoopsModule } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Plugins/legacy/Wfsection.php b/class/Plugins/legacy/Wfsection.php index 26173d4d..e0170a43 100644 --- a/class/Plugins/legacy/Wfsection.php +++ b/class/Plugins/legacy/Wfsection.php @@ -64,7 +64,6 @@ public function loadModule():?\XoopsModule } /** - * @param \XoopsMySQLDatabase $xoopsDB * @return array */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array diff --git a/class/Utility.php b/class/Utility.php index 8982ad1a..64082b27 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -39,11 +39,6 @@ class Utility extends Common\SysUtility { //--------------- Custom module methods ----------------------------- - /** - * @param array $a - * @param array $b - * @return int - */ public static function sortTimestamp(array $a, array $b): int { if ($a['timestamp'] == $b['timestamp']) { @@ -53,11 +48,6 @@ public static function sortTimestamp(array $a, array $b): int return ($a['timestamp'] > $b['timestamp']) ? -1 : 1; } - /** - * @param int $spec - * @param \XoopsModules\Rssfit\FeedHandler $feedHandler - * @return string - */ public static function genSpecMoreInfo(int $spec, FeedHandler $feedHandler): string { return static::rssfGenAnchor($feedHandler->specUrl($spec), \_AM_RSSFIT_EDIT_CHANNEL_QMARK, 'spec', \_AM_RSSFIT_EDIT_CHANNEL_MOREINFO); @@ -65,12 +55,6 @@ public static function genSpecMoreInfo(int $spec, FeedHandler $feedHandler): str /** * @param null|string $url - * @param string $text - * @param string $target - * @param string $title - * @param string $class - * @param string $id - * @return string */ public static function rssfGenAnchor(string $url = null, string $text = '', string $target = '', string $title = '', string $class = '', string $id = ''): string { @@ -96,16 +80,6 @@ public static function rssfGenAnchor(string $url = null, string $text = '', stri $max_words: max number of words (not real words, HTML words) if <= 0: no limitation, if > 0 display at most $max_words words */ - /** - * @param string $feed_url - * @param int $maxItemCount - * @param bool $show_date - * @param bool $show_description - * @param int $max_words - * @param int $cache_timeout - * @param string $cache_prefix - * @return string - */ public static function getRssFeedAsHtml(string $feed_url, int $maxItemCount = 10, bool $show_date = true, bool $show_description = true, int $max_words = 0, int $cache_timeout = 7200, string $cache_prefix = XOOPS_VAR_PATH . '/caches/xoops_cache/rss2html-'): string { $result = ''; @@ -198,15 +172,6 @@ public static function getRssFeedAsHtml(string $feed_url, int $maxItemCount = 10 return $result; } - /** - * @param string $feed_url - * @param int $maxItemCount - * @param bool $show_date - * @param bool $show_description - * @param int $max_words - * - * @return void - */ public static function outputRssFeed(string $feed_url, int $maxItemCount = 10, bool $show_date = true, bool $show_description = true, int $max_words = 0): void { echo self::getRssFeedAsHtml($feed_url, $maxItemCount, $show_date, $show_description, $max_words); diff --git a/include/install.php b/include/install.php index 2d5ba187..6d207c08 100644 --- a/include/install.php +++ b/include/install.php @@ -23,11 +23,6 @@ require_once \dirname(__DIR__) . '/preloads/autoloader.php'; require_once \dirname(__DIR__, 3) . '/mainfile.php'; -/** - * @param \XoopsModule $xoopsMod - * - * @return bool - */ function xoops_module_install_rssfit(\XoopsModule $xoopsMod): bool { global $xoopsDB, $xoopsConfig; @@ -65,10 +60,8 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod): bool } /** - * @param \XoopsModule $xoopsMod * @param int $oldversion version number of prevviously installed version * - * @return bool */ function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $oldversion): bool { @@ -115,11 +108,6 @@ function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $oldversion): bo // } //} -/** - * @param \XoopsModule $xoopsMod - * - * @return string - */ function rssfInsertChannel(\XoopsModule $xoopsMod): string { global $xoopsDB, $xoopsConfig; diff --git a/include/onupdate.php b/include/onupdate.php index 1f186b6b..8e98e921 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -27,7 +27,6 @@ /** * Prepares system prior to attempting to install module - * @param \XoopsModule $xoopsModule * @param null $previousVersion * @return bool true if ready to install, false if not */ diff --git a/testdata/index.php b/testdata/index.php index 2ff6585d..0b837a97 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -158,7 +158,6 @@ function exportSchema() * Each element of the outer array represents a single table row. * Each row is an associative array in 'column' => 'value' format. * @param string $search name of column for which the value should be replaced - * @param string $replace * @return int number of rows inserted */ function loadTableFromArrayWithReplace(string $table, array $data, string $search, string $replace): int From d8350d5411ad5845cb8cf30b780c49a76512f52b Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 06:00:03 -0400 Subject: [PATCH 098/154] Incompatible return type --- class/Plugins/legacy/Wfsection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/Plugins/legacy/Wfsection.php b/class/Plugins/legacy/Wfsection.php index e0170a43..85ccbd83 100644 --- a/class/Plugins/legacy/Wfsection.php +++ b/class/Plugins/legacy/Wfsection.php @@ -57,7 +57,7 @@ public function loadModule():?\XoopsModule } $this->modname = $mod->getVar('name'); if ($mod->getVar('version') >= 200) { - return false; + return null; } return $mod; From f08a66ab07bdc22cc909d6e6d6f06c702ce3f56d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 06:05:27 -0400 Subject: [PATCH 099/154] Strict type checking rules violation --- class/FeedHandler.php | 2 +- class/Utility.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 825c5c7a..a72a4e39 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -407,7 +407,7 @@ public function feedSelectBox(string $caption = '', $selected = null, int $size /** * @return string */ - public function specUrl(int $key = 0): ?string + public function specUrl(string $key = '0'): ?string { if (isset($this->specs[$key])) { return $this->specUrl . '#' . $this->specs[$key]; diff --git a/class/Utility.php b/class/Utility.php index 64082b27..1b0e91df 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -48,7 +48,7 @@ public static function sortTimestamp(array $a, array $b): int return ($a['timestamp'] > $b['timestamp']) ? -1 : 1; } - public static function genSpecMoreInfo(int $spec, FeedHandler $feedHandler): string + public static function genSpecMoreInfo(string $spec, FeedHandler $feedHandler): string { return static::rssfGenAnchor($feedHandler->specUrl($spec), \_AM_RSSFIT_EDIT_CHANNEL_QMARK, 'spec', \_AM_RSSFIT_EDIT_CHANNEL_MOREINFO); } From 11d0628104d02e1f89e0a1a34b2e5c7b9497b84a Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 06:08:38 -0400 Subject: [PATCH 100/154] Undefined class --- class/Plugins/Comments.php | 2 +- class/Plugins/Pical.php | 2 +- class/Plugins/Sample.php | 2 +- class/Plugins/Surnames.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/class/Plugins/Comments.php b/class/Plugins/Comments.php index ca3e80f8..130af816 100644 --- a/class/Plugins/Comments.php +++ b/class/Plugins/Comments.php @@ -38,7 +38,7 @@ use XoopsModules\Rssfit\{ AbstractPlugin }; -use XoopsModules\System\Helper as PluginHelper; +//use XoopsModules\System\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); diff --git a/class/Plugins/Pical.php b/class/Plugins/Pical.php index 17be4621..daa49cb1 100644 --- a/class/Plugins/Pical.php +++ b/class/Plugins/Pical.php @@ -35,7 +35,7 @@ use XoopsModules\Rssfit\{ AbstractPlugin }; -use XoopsModules\Pical\Helper as PluginHelper; +//use XoopsModules\Pical\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); diff --git a/class/Plugins/Sample.php b/class/Plugins/Sample.php index 871e5859..9d3cdf69 100644 --- a/class/Plugins/Sample.php +++ b/class/Plugins/Sample.php @@ -53,7 +53,7 @@ AbstractPlugin }; -use XoopsModules\Sample\Helper as PluginHelper; +//use XoopsModules\Sample\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php index f9b6e887..9278a19a 100644 --- a/class/Plugins/Surnames.php +++ b/class/Plugins/Surnames.php @@ -35,7 +35,7 @@ use XoopsModules\Rssfit\{ AbstractPlugin }; -use XoopsModules\Surnames\Helper as PluginHelper; +//use XoopsModules\Surnames\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); From 5b69ef26f01f7f75a6ad90b2f9dd25e68103aeb4 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 07:00:18 -0400 Subject: [PATCH 101/154] Scrutinizer --- .scrutinizer.yml | 18 ++++++++++++++---- class/AbstractPlugin.php | 1 + class/MiscHandler.php | 8 ++++---- class/Plugins/Ams.php | 2 +- class/Plugins/Apcal.php | 1 - class/Plugins/Lexikon.php | 1 - class/Plugins/Oledrion.php | 1 - class/Plugins/Smartfaq.php | 1 - class/Plugins/Wfdownloads.php | 1 - 9 files changed, 20 insertions(+), 14 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 2577e4e5..e47951ad 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -18,12 +18,22 @@ filter: dependency_paths: - XoopsCore25/* - tag/* + - adslight/* + - adslight/* + - apcal/* + - extcal/* + - extgallery/* + - lexikon/* + - myalbum/* + - mylinks/* + - newbb/* + - news/* + - oledrion/* - publisher/* - smartfaq/* - smartpartner/* - smartsection/* - - extcal/* - - extgallery/* - - adslight/* - - oledrion/* + - wfdownloads/* + - wflinks/* + - xoopstube/* diff --git a/class/AbstractPlugin.php b/class/AbstractPlugin.php index 1ba084f0..3393d249 100644 --- a/class/AbstractPlugin.php +++ b/class/AbstractPlugin.php @@ -45,6 +45,7 @@ abstract class AbstractPlugin implements PluginInterface public $modname; public $grab; public $module; // optional, see line 67 + public $helper; /** * @return \XoopsModule diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 675167b9..c241f4dd 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -41,10 +41,10 @@ class MiscHandler extends \XoopsPersistableObjectHandler public $helper; /** - * @param \XoopsDatabase|null $db + * @param \XoopsMySQLDatabase|null $db * @param null|\XoopsModules\Rssfit\Helper $helper */ - public function __construct(\XoopsDatabase $db = null, $helper = null) + public function __construct(\XoopsMySQLDatabase $db = null, $helper = null) { if (null === $helper) { $helper = Helper::getInstance(); @@ -62,9 +62,9 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) } /** - * @param \XoopsDatabase|null $db + * @param \XoopsMySQLDatabase|null $db */ - public function getInstance(\XoopsDatabase $db = null): MiscHandler + public function getInstance(\XoopsMySQLDatabase $db = null): MiscHandler { static $instance; if (null === $instance) { diff --git a/class/Plugins/Ams.php b/class/Plugins/Ams.php index 08a1b704..0c2b142e 100644 --- a/class/Plugins/Ams.php +++ b/class/Plugins/Ams.php @@ -36,7 +36,7 @@ AbstractPlugin }; use XoopsModules\Ams\Story; -use XoopsModules\Ams\Helper as PluginHelper; +//use XoopsModules\Ams\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); diff --git a/class/Plugins/Apcal.php b/class/Plugins/Apcal.php index 80de5446..f903ba09 100644 --- a/class/Plugins/Apcal.php +++ b/class/Plugins/Apcal.php @@ -48,7 +48,6 @@ final class Apcal extends AbstractPlugin { public $dirname = 'apcal'; - /** * @return \XoopsModule */ diff --git a/class/Plugins/Lexikon.php b/class/Plugins/Lexikon.php index 948b7797..cc9be598 100644 --- a/class/Plugins/Lexikon.php +++ b/class/Plugins/Lexikon.php @@ -47,7 +47,6 @@ final class Lexikon extends AbstractPlugin { public $dirname = 'lexikon'; - /** * @return \XoopsModule */ diff --git a/class/Plugins/Oledrion.php b/class/Plugins/Oledrion.php index ac516f26..6b4ac6e7 100644 --- a/class/Plugins/Oledrion.php +++ b/class/Plugins/Oledrion.php @@ -40,7 +40,6 @@ final class Oledrion extends AbstractPlugin { public $dirname = 'oledrion'; - /** * @return \XoopsModule */ diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php index fce5a649..d7175586 100644 --- a/class/Plugins/Smartfaq.php +++ b/class/Plugins/Smartfaq.php @@ -49,7 +49,6 @@ final class Smartfaq extends AbstractPlugin { public $dirname = 'smartfaq'; - /** * @return \XoopsModule */ diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php index 51e44927..5b8766e9 100644 --- a/class/Plugins/Wfdownloads.php +++ b/class/Plugins/Wfdownloads.php @@ -49,7 +49,6 @@ final class Wfdownloads extends AbstractPlugin { public $dirname = 'wfdownloads'; - /** * @return \XoopsModule */ From 9c174a0b2765b9fb07ad7bae1d34747afc7aad0a Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 11:16:59 -0400 Subject: [PATCH 102/154] cosmetics --- class/FeedHandler.php | 45 ++++++++++++++++++++++++++++++------------- xoops_version.php | 2 +- 2 files changed, 33 insertions(+), 14 deletions(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index a72a4e39..6d536792 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -37,6 +37,7 @@ class FeedHandler public $rssmod; public $pluginHandler; public $miscHandler; + public $helper; public $channelreq; public $subHandler; public $pluginObject; @@ -97,6 +98,7 @@ public function __construct($modConfig, $xoopsConfig, $xoopsModule) { $this->myts = \MyTextSanitizer::getInstance(); $this->rssmod = $xoopsModule; + $this->helper = Helper::getInstance(); $this->pluginHandler = Helper::getInstance()->getHandler('Plugin'); $this->miscHandler = Helper::getInstance()->getHandler('Misc'); $this->modConfig = $modConfig; @@ -225,18 +227,35 @@ public function getItems(&$feed): void } } if (\count($entries) > 0) { - foreach ($entries as $i => $iValue) { - $this->cleanupChars($iValue['title']); + + +// foreach ($entries as $i => $iValue) { +// $this->cleanupChars($iValue['title']); +// $strip = $this->modConfig['strip_html'] ? true : false; +// $this->cleanupChars($iValue['description'], $strip, false, true); +// $this->wrapCdata($iValue['description']); +// $entries[$i]['category'] = $this->myts->undoHtmlSpecialChars($iValue['category']); +// $this->cleanupChars($iValue['category']); +// if (!isset($iValue['timestamp'])) { +// $entries[$i]['timestamp'] = $this->rssmod->getVar('last_update'); +// } +// $entries[$i]['pubdate'] = $this->rssTimeStamp((int)$iValue['timestamp']); +// } + + + for ($i = 0, $iMax = count($entries); $i < $iMax; $i++) { + $this->cleanupChars($entries[$i]['title']); $strip = $this->modConfig['strip_html'] ? true : false; - $this->cleanupChars($iValue['description'], $strip, false, true); - $this->wrapCdata($iValue['description']); - $entries[$i]['category'] = $this->myts->undoHtmlSpecialChars($iValue['category']); - $this->cleanupChars($iValue['category']); - if (!isset($iValue['timestamp'])) { + $this->cleanupChars($entries[$i]['description'], $strip, false, true); + $this->wrapCdata($entries[$i]['description']); + $entries[$i]['category'] = $this->myts->undoHtmlSpecialChars($entries[$i]['category']); + $this->cleanupChars($entries[$i]['category']); + if (!isset($entries[$i]['timestamp'])) { $entries[$i]['timestamp'] = $this->rssmod->getVar('last_update'); } - $entries[$i]['pubdate'] = $this->rssTimeStamp((int)$iValue['timestamp']); + $entries[$i]['pubdate'] = $this->rssTimeStamp((int)$entries[$i]['timestamp']); } + if (empty($feed['plugin']) && 'd' === $this->modConfig['sort']) { \uasort($entries, [$this, 'sortTimestamp']); } @@ -255,15 +274,15 @@ public function doSubstr($text): string { $ret = $text; $len = \function_exists('mb_strlen') ? mb_strlen($ret, $this->charset) : mb_strlen($ret); - if ($len > $this->modConfig['max_char'] && $this->modConfig['max_char'] > 0) { - $ret = $this->substrDetect($ret, 0, $this->modConfig['max_char'] - 1); + if ($len > $this->helper->getConfig('max_char') && $this->helper->getConfig('max_char') > 0) { + $ret = $this->substrDetect($ret, 0, $this->helper->getConfig('max_char') - 1); if (false === $this->strrposDetect($ret, ' ')) { if (false !== $this->strrposDetect($text, ' ')) { $ret = $this->substrDetect($text, 0, mb_strpos($text, ' ')); } } - if (\in_array($this->substrDetect($text, $this->modConfig['max_char'] - 1, 1), $this->substrAdd)) { - $ret .= $this->substrDetect($text, $this->modConfig['max_char'] - 1, 1); + if (\in_array($this->substrDetect($text, $this->helper->getConfig('max_char') - 1, 1), $this->substrAdd)) { + $ret .= $this->substrDetect($text, $this->helper->getConfig('max_char') - 1, 1); } else { if (false !== $this->strrposDetect($ret, ' ')) { $ret = $this->substrDetect($ret, 0, $this->strrposDetect($ret, ' ')); @@ -336,7 +355,7 @@ public function sortTimestamp($a, $b): int public function cleanupChars(&$text, bool $strip = true, bool $dospec = true, bool $dosub = false): void { if ($strip) { - $text = \strip_tags($text); + $text = \strip_tags((string)$text); } if ($dosub) { $text = $this->doSubstr($text); diff --git a/xoops_version.php b/xoops_version.php index 7c9239b6..5d76c419 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -164,7 +164,7 @@ 'description' => '_MI_RSSFIT_MAXCHAR_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', - 'default' => 0, + 'default' => 200, ]; // $helper->getConfig('strip_html') From 883e99e916d9bd069f3a876ace4e82fc6e6eadb4 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 15:10:23 -0400 Subject: [PATCH 103/154] foreach() missed reference --- class/FeedHandler.php | 50 +++++++++++++++---------------------------- 1 file changed, 17 insertions(+), 33 deletions(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 6d536792..6d72a44a 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -44,21 +44,21 @@ class FeedHandler public $myts; public $modConfig; public $xoopsConfig; - public $cached = ''; - public $charset = _CHARSET; - public $feedkey = 'feed'; + public $cached = ''; + public $charset = _CHARSET; + public $feedkey = 'feed'; public $pluginFile = '%s.php'; public $substrRemove = [',', '/', ';', ':', '(', '{', '[', ' ']; public $substrAdd = ['.', '!', '?', '}', ']', ')', '%']; public $substrEndwith = '...'; public $specUrl = 'http://blogs.law.harvard.edu/tech/rss'; - public $specs = [ + public $specs = [ 'req' => 'requiredChannelElements', 'opt' => 'optionalChannelElements', 'cloud' => 'ltcloudgtSubelementOfLtchannelgt', 'img' => 'ltimagegtSubelementOfLtchannelgt', ]; - public $escaped = [ + public $escaped = [ 128 => '€', 130 => '‚', 131 => 'ƒ', @@ -202,7 +202,7 @@ public function getSticky(&$feed): bool public function getItems(&$feed): void { $entries = []; - $db = \XoopsDatabaseFactory::getDatabaseConnection(); + $db = \XoopsDatabaseFactory::getDatabaseConnection(); if (!empty($feed['plugin'])) { $this->pluginObject->setVar('rssf_grab', $this->pluginObject->getVar('sub_entries')); $this->subHandler->grab = $this->pluginObject->getVar('sub_entries'); @@ -227,33 +227,17 @@ public function getItems(&$feed): void } } if (\count($entries) > 0) { - - -// foreach ($entries as $i => $iValue) { -// $this->cleanupChars($iValue['title']); -// $strip = $this->modConfig['strip_html'] ? true : false; -// $this->cleanupChars($iValue['description'], $strip, false, true); -// $this->wrapCdata($iValue['description']); -// $entries[$i]['category'] = $this->myts->undoHtmlSpecialChars($iValue['category']); -// $this->cleanupChars($iValue['category']); -// if (!isset($iValue['timestamp'])) { -// $entries[$i]['timestamp'] = $this->rssmod->getVar('last_update'); -// } -// $entries[$i]['pubdate'] = $this->rssTimeStamp((int)$iValue['timestamp']); -// } - - - for ($i = 0, $iMax = count($entries); $i < $iMax; $i++) { - $this->cleanupChars($entries[$i]['title']); + foreach ($entries as $i => &$iValue) { + $this->cleanupChars($iValue['title']); $strip = $this->modConfig['strip_html'] ? true : false; - $this->cleanupChars($entries[$i]['description'], $strip, false, true); - $this->wrapCdata($entries[$i]['description']); - $entries[$i]['category'] = $this->myts->undoHtmlSpecialChars($entries[$i]['category']); - $this->cleanupChars($entries[$i]['category']); - if (!isset($entries[$i]['timestamp'])) { + $this->cleanupChars($iValue['description'], $strip, false, true); + $this->wrapCdata($iValue['description']); + $entries[$i]['category'] = $this->myts->undoHtmlSpecialChars($iValue['category']); + $this->cleanupChars($iValue['category']); + if (!isset($iValue['timestamp'])) { $entries[$i]['timestamp'] = $this->rssmod->getVar('last_update'); } - $entries[$i]['pubdate'] = $this->rssTimeStamp((int)$entries[$i]['timestamp']); + $entries[$i]['pubdate'] = $this->rssTimeStamp((int)$iValue['timestamp']); } if (empty($feed['plugin']) && 'd' === $this->modConfig['sort']) { @@ -385,7 +369,7 @@ public function &getActivatedSubfeeds(string $fields = '', string $type = ''): ? $ret = null; $subs = $this->pluginHandler->getObjects2(new \Criteria('subfeed', '1'), $fields); if (\is_array($subs) && !empty($subs)) { - $ret = []; + $ret = []; switch ($type) { default: $ret = &$subs; @@ -465,8 +449,8 @@ public function checkSubFeed(&$feed): void } if ($handler) { $this->pluginObject = $sub[0]; - $this->subHandler = $handler; - $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' . \md5(\str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); + $this->subHandler = $handler; + $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' . \md5(\str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); } else { $feed['plugin'] = ''; } From 9826de809b3817c01206d800d2b30596fd9e20ee Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 15:28:00 -0400 Subject: [PATCH 104/154] Optional parameter declared before required paramete --- class/PluginHandler.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 5b2163b4..a0637220 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -242,10 +242,9 @@ public function getObjects2($criteria = null, string $fields = '*', string $key } /** - * @param null|\Criteria|\CriteriaCompo $criteria * @return bool|string */ - public function modifyObjects($criteria = null, array $fields = [], bool $force) + public function modifyObjects(\CriteriaElement $criteria = null, array $fields = [], bool $force = true) { if ($fields && \is_array($fields)) { $object = new $this->objClass(); From 1a70e56aea4fd937ca9338b285ee102522267793 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 19:05:04 -0400 Subject: [PATCH 105/154] PhpDoc, cosmetics --- admin/do_subfeeds.php | 4 ++ class/AbstractPlugin.php | 8 +--- class/Common/FilesManagement.php | 13 ++---- class/Common/Migrate.php | 2 +- class/Common/SysUtility.php | 45 ++++++------------ class/Common/TestdataButtons.php | 6 +-- class/Common/VersionChecks.php | 8 ++-- class/FeedHandler.php | 77 ++++++++----------------------- class/Helper.php | 6 +-- class/MiscHandler.php | 28 ++++------- class/PluginHandler.php | 42 ++++++----------- class/Plugins/Myalbum.php | 5 +- class/Plugins/Smartpartner.php | 2 +- class/Plugins/Surnames.php | 8 ++-- class/Plugins/Xoopstube.php | 2 +- class/Plugins/legacy/Weblinks.php | 5 +- include/install.php | 4 -- 17 files changed, 86 insertions(+), 179 deletions(-) diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index 522d4728..c8059dc2 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -21,8 +21,12 @@ use Xmf\Request; use XoopsModules\Rssfit\{ + FeedHandler, + PluginHandler, Utility }; +/** @var FeedHandler $feedHandler */ +/** @var PluginHandler $pluginHandler */ if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { header('Location: index.php'); diff --git a/class/AbstractPlugin.php b/class/AbstractPlugin.php index 3393d249..e0a36728 100644 --- a/class/AbstractPlugin.php +++ b/class/AbstractPlugin.php @@ -47,9 +47,6 @@ abstract class AbstractPlugin implements PluginInterface public $module; // optional, see line 67 public $helper; - /** - * @return \XoopsModule - */ public function loadModule(): ?\XoopsModule { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); @@ -57,7 +54,7 @@ public function loadModule(): ?\XoopsModule return null; } - if (!$mod || !$mod->getVar('isactive')) { + if (!$mod->getVar('isactive')) { return null; } $this->modname = $mod->getVar('name'); @@ -66,9 +63,6 @@ public function loadModule(): ?\XoopsModule return $mod; } - /** - * @return array - */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { } diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index 9f1c8e0c..7b7a748c 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -41,20 +41,13 @@ public static function createFolder(string $folder): void } } - /** - * @param $file - * @param $folder - */ - public static function copyFile($file, $folder): bool + public static function copyFile(string $file, string $folder): bool { return \copy($file, $folder); } - /** - * @param $src - * @param $dst - */ - public static function recurseCopy($src, $dst): void + + public static function recurseCopy(string $src, string $dst): void { $dir = \opendir($src); // @mkdir($dst); diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index a6da0ffe..34d2c1f0 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -139,7 +139,7 @@ private function renameColumns(): void * table and column renames * data conversions */ - protected function preSyncActions() + protected function preSyncActions(): void { // change 'bb' table prefix to 'newbb' $this->changePrefix(); diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index f4990562..a820a810 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -59,11 +59,7 @@ public static function getInstance(): SysUtility return $instance; } - /** - * @param $text - * @param $form_sort - */ - public static function selectSorting($text, $form_sort): string + public static function selectSorting(string $text, string $form_sort): string { global $start, $order, $sort; @@ -106,10 +102,7 @@ public static function blockAddCatSelect(array $cats): string return $cat_sql; } - /** - * @param $content - */ - public static function metaKeywords($content): void + public static function metaKeywords(string $content): void { global $xoopsTpl, $xoTheme; $myts = \MyTextSanitizer::getInstance(); @@ -121,10 +114,8 @@ public static function metaKeywords($content): void } } - /** - * @param $content - */ - public static function metaDescription($content): void + + public static function metaDescription(string $content): void { global $xoopsTpl, $xoTheme; $myts = \MyTextSanitizer::getInstance(); @@ -136,11 +127,7 @@ public static function metaDescription($content): void } } - /** - * - * @return array|false - */ - public static function enumerate(string $tableName, string $columnName) + public static function enumerate(string $tableName, string $columnName): ?array { $table = $GLOBALS['xoopsDB']->prefix($tableName); @@ -154,7 +141,7 @@ public static function enumerate(string $tableName, string $columnName) // exit($GLOBALS['xoopsDB']->error()); $logger = \XoopsLogger::getInstance(); $logger->handleError(\E_USER_WARNING, $sql, __FILE__, __LINE__); - return false; + return null; } $row = $GLOBALS['xoopsDB']->fetchBoth($result); @@ -171,12 +158,10 @@ public static function enumerate(string $tableName, string $columnName) * @param string $tableName name of dB table (without prefix) * @param string $idField name of field (column) in dB table * @param int $id item id to clone - * - * @return mixed */ - public static function cloneRecord(string $tableName, string $idField, int $id) + public static function cloneRecord(string $tableName, string $idField, int $id): ?int { - $newId = false; + $newId = null; $table = $GLOBALS['xoopsDB']->prefix($tableName); // copy content of the record you wish to clone $sql = "SELECT * FROM $table WHERE $idField='" . $id . "' "; @@ -193,7 +178,8 @@ public static function cloneRecord(string $tableName, string $idField, int $id) exit($GLOBALS['xoopsDB']->error()); } // Return the new id - return $GLOBALS['xoopsDB']->getInsertId(); + $newId = $GLOBALS['xoopsDB']->getInsertId(); + return $newId; } /** @@ -312,11 +298,12 @@ public static function truncateHtml( /** * Get correct text editor based on user rights * - * - * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor + * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor */ - public static function getEditor(?\Xmf\Module\Helper $helper = null, ?array $options = null) + public static function getEditor(?\Xmf\Module\Helper $helper = null, ?array $options = null): ?\XoopsFormTextArea { + $descEditor = null; + /** @var Helper $helper */ if (null === $options) { $options = []; @@ -405,11 +392,9 @@ public static function tableExists(string $tablename): bool /** * Add a field to a mysql table * - * @param $field - * @param $table * @return bool|\mysqli_result */ - public static function addField($field, $table) + public static function addField(string $field, string $table) { global $xoopsDB; return $xoopsDB->queryF('ALTER TABLE ' . $table . " ADD $field;"); diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index 28c0e578..3ff7492b 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -22,6 +22,7 @@ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) */ +use Xmf\Module\Admin; use Xmf\Request; use Xmf\Yaml; use XoopsModules\Rssfit\Helper; @@ -34,10 +35,7 @@ class TestdataButtons { //functions for import buttons - /** - * @param $adminObject - */ - public static function loadButtonConfig($adminObject): void + public static function loadButtonConfig(Admin $adminObject): void { $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 71c81c6a..47fdd4db 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -14,6 +14,8 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ +use Xmf\Module\Helper; + /** * @copyright XOOPS Project (https://xoops.org) * @license http://www.fsf.org/copyleft/gpl.html GNU public license @@ -89,20 +91,20 @@ public static function checkVerPhp(\XoopsModule $module = null): bool /** * - * compares current module version with latest GitHub release + * compares current module version with the latest GitHub release * @static * * @return string|array info about the latest module version, if newer */ - public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $source = 'github', ?string $default = 'master') + public static function checkVerModule(Helper $helper, ?string $source = 'github', ?string $default = 'master'): ?array { $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $update = ''; $repository = 'XoopsModules25x/' . $moduleDirName; // $repository = 'XoopsModules25x/publisher'; //for testing only - $ret = ''; + $ret = null; $infoReleasesUrl = "https://api.github.com/repos/$repository/releases"; if ('github' === $source) { if (\function_exists('curl_init') && false !== ($curlHandle = \curl_init())) { diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 6d72a44a..91615a36 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -90,11 +90,8 @@ class FeedHandler /** * FeedHandler constructor. - * @param $modConfig - * @param $xoopsConfig - * @param $xoopsModule */ - public function __construct($modConfig, $xoopsConfig, $xoopsModule) + public function __construct(array $modConfig, array $xoopsConfig, \XoopsModule $xoopsModule) { $this->myts = \MyTextSanitizer::getInstance(); $this->rssmod = $xoopsModule; @@ -110,10 +107,7 @@ public function __construct($modConfig, $xoopsConfig, $xoopsModule) ]; } - /** - * @param $feed - */ - public function getChannel(&$feed): void + public function getChannel(array &$feed): void { $channel = []; $elements = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channel')); @@ -165,10 +159,7 @@ public function getChannel(&$feed): void $feed['channel'] = &$channel; } - /** - * @param $feed - */ - public function getSticky(&$feed): bool + public function getSticky(array &$feed): bool { if (!$intr = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'sticky'))) { return false; @@ -196,10 +187,8 @@ public function getSticky(&$feed): bool return true; } - /** - * @param $feed - */ - public function getItems(&$feed): void + + public function getItems(array &$feed): void { $entries = []; $db = \XoopsDatabaseFactory::getDatabaseConnection(); @@ -239,11 +228,12 @@ public function getItems(&$feed): void } $entries[$i]['pubdate'] = $this->rssTimeStamp((int)$iValue['timestamp']); } + unset($iValue); if (empty($feed['plugin']) && 'd' === $this->modConfig['sort']) { \uasort($entries, [$this, 'sortTimestamp']); } - if (empty($feed['plugin']) && count($entries) > $this->modConfig['overall_entries']) { + if (empty($feed['plugin']) && \count($entries) > $this->modConfig['overall_entries']) { $entries = \array_slice($entries, 0, $this->modConfig['overall_entries']); } } @@ -251,10 +241,8 @@ public function getItems(&$feed): void $feed['items'] = &$entries; } - /** - * @param $text - */ - public function doSubstr($text): string + + public function doSubstr(string $text): string { $ret = $text; $len = \function_exists('mb_strlen') ? mb_strlen($ret, $this->charset) : mb_strlen($ret); @@ -281,13 +269,7 @@ public function doSubstr($text): string return $ret; } - /** - * @param $text - * @param $start - * @param $len - * @return false|mixed|string - */ - public function substrDetect($text, $start, $len) + public function substrDetect(string $text, int $start, int $len): string { if (\function_exists('mb_strcut')) { return mb_strcut($text, $start, $len, _CHARSET); @@ -297,11 +279,9 @@ public function substrDetect($text, $start, $len) } /** - * @param $text - * @param $find * @return false|int */ - public function strrposDetect($text, $find) + public function strrposDetect(string $text, string $find) { if (\function_exists('mb_strrpos')) { return mb_strrpos($text, $find, 0, _CHARSET); @@ -310,20 +290,13 @@ public function strrposDetect($text, $find) return mb_strrpos($text, $find); } - /** - * @param $time - * @return string - */ - public function rssTimeStamp($time): ?string + + public function rssTimeStamp(int $time): ?string { return \date('D, j M Y H:i:s O', $time); } - /** - * @param $a - * @param $b - */ - public function sortTimestamp($a, $b): int + public function sortTimestamp(array $a, array $b): int { if ($a['timestamp'] == $b['timestamp']) { return 0; @@ -332,10 +305,7 @@ public function sortTimestamp($a, $b): int return ($a['timestamp'] > $b['timestamp']) ? -1 : 1; } - /** - * @param $text - * @param false $dosub - */ + public function cleanupChars(&$text, bool $strip = true, bool $dospec = true, bool $dosub = false): void { if ($strip) { @@ -353,10 +323,7 @@ public function cleanupChars(&$text, bool $strip = true, bool $dospec = true, bo } } - /** - * @param $text - */ - public function wrapCdata(&$text): void + public function wrapCdata(string &$text): void { $text = ''], ['<![CDATA[', ']]>'], $text) . ']]>'; } @@ -433,10 +400,8 @@ public function subFeedUrl(string $filename = ''): ?string return null; } - /** - * @param $feed - */ - public function checkSubFeed(&$feed): void + + public function checkSubFeed(array &$feed): void { if (!empty($feed['plugin'])) { $criteria = new \CriteriaCompo(); @@ -457,10 +422,8 @@ public function checkSubFeed(&$feed): void } } - /** - * @param $feed - */ - public function buildFeed(&$feed): void + + public function buildFeed(array &$feed): void { $this->getChannel($feed); $this->getItems($feed); diff --git a/class/Helper.php b/class/Helper.php index e5aa0aff..6bf8a0af 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -59,11 +59,11 @@ public function getDirname(): string * * @param string $name name of handler to load * - * @return bool|\XoopsObjectHandler|\XoopsPersistableObjectHandler + * @return \XoopsPersistableObjectHandler */ - public function getHandler($name) + public function getHandler($name): ?\XoopsPersistableObjectHandler { - $ret = false; + $ret = null; $class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler'; if (!\class_exists($class)) { diff --git a/class/MiscHandler.php b/class/MiscHandler.php index c241f4dd..a48950b5 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -96,30 +96,30 @@ public function create($isNew = true): ?\XoopsObject * @param null|array $fields * @return bool|mixed|\XoopsObject|null */ - public function get($id = null, $fields = null) + public function get($id = null, $fields = null): ?\XoopsObject { $criteria = new \Criteria($this->objKey, (int)$id); $objs = $this->getObjects2($criteria); if (\is_array($objs) && !empty($objs)) { - return 1 != \count($objs) ? false : $objs[0]; + return 1 != \count($objs) ? null : $objs[0]; } - return false; + return null; } /** * count objects matching a condition * @param null|\Criteria|\CriteriaCompo $criteria - * @return false|mixed count of objects + * @return null|int count of objects */ - public function getCount($criteria = null) + public function getCount($criteria = null): ?int { $sql = 'SELECT COUNT(*) FROM ' . $this->dbTable; if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); } if (!$result = $this->db->query($sql)) { - return false; + return null; } [$count] = $this->db->fetchRow($result); @@ -128,11 +128,10 @@ public function getCount($criteria = null) /** * @param null|\Criteria|\CriteriaCompo $criteria - * @return false|array */ - public function getObjects2($criteria = null, string $fields = '*', string $key = '') + public function getObjects2($criteria = null, string $fields = '*', string $key = ''): ?array { - $ret = false; + $ret = null; $limit = $start = 0; // $fields = '*'; $sql = 'SELECT ' . $fields . ' FROM ' . $this->dbTable; @@ -171,8 +170,6 @@ public function getObjects2($criteria = null, string $fields = '*', string $key } /** - * @param \XoopsObject $object - * @param bool $force * @return array|bool|int|mixed|null */ public function insert(\XoopsObject $object, $force = false) @@ -228,9 +225,8 @@ public function insert(\XoopsObject $object, $force = false) /** * @param null|\Criteria|\CriteriaCompo $criteria - * @return false|string */ - public function modifyObjects($criteria = null, array $fields = [], bool $force) + public function modifyObjects(?\Criteria $criteria = null, array $fields = [], bool $force = false): ?string { if ($fields && \is_array($fields)) { $obj = new $this->objClass(); @@ -255,13 +251,9 @@ public function modifyObjects($criteria = null, array $fields = [], bool $force) } } - return false; + return null; } - /** - * @param \XoopsObject $object - * @param bool $force - */ public function delete(\XoopsObject $object, $force = false): bool { // $force = false; diff --git a/class/PluginHandler.php b/class/PluginHandler.php index a0637220..edb52eb0 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -100,9 +100,9 @@ public function create($isNew = true): ?\XoopsObject * @param null|array $fields * @return bool|mixed|\XoopsObject|null */ - public function get($id = null, $fields = null) + public function get($id = null, $fields = null): ?\XoopsObject { - $ret = false; + $ret = null; $criteria = new \Criteria($this->objKey, (int)$id); $objs = $this->getObjects2($criteria); if (\is_array($objs) && 1 === \count($objs)) { @@ -113,11 +113,10 @@ public function get($id = null, $fields = null) } /** - * @param \XoopsObject $object - * @param bool $force + * @param bool $force flag to force the query execution despite security settings * @return array|bool|int|mixed|null */ - public function insert(\XoopsObject $object, $force = false) + public function insert(\XoopsObject $object, $force = true) { if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) { return false; @@ -169,7 +168,6 @@ public function insert(\XoopsObject $object, $force = false) } /** - * @param \XoopsObject $object * @param bool $force */ public function delete(\XoopsObject $object, $force = false): bool @@ -192,11 +190,10 @@ public function delete(\XoopsObject $object, $force = false): bool /** * @param null|\Criteria|\CriteriaCompo $criteria - * @return bool|array */ - public function getObjects2($criteria = null, string $fields = '*', string $key = '') + public function getObjects2($criteria = null, string $fields = '*', string $key = ''): ?array { - $ret = false; + $ret = null; $limit = $start = 0; switch ($fields) { case 'p_activated': @@ -241,10 +238,7 @@ public function getObjects2($criteria = null, string $fields = '*', string $key return $ret; } - /** - * @return bool|string - */ - public function modifyObjects(\CriteriaElement $criteria = null, array $fields = [], bool $force = true) + public function modifyObjects(\CriteriaElement $criteria = null, array $fields = [], bool $force = false): ?string { if ($fields && \is_array($fields)) { $object = new $this->objClass(); @@ -269,15 +263,15 @@ public function modifyObjects(\CriteriaElement $criteria = null, array $fields = } } - return false; + return null; } /** * count objects matching a condition * @param null|\Criteria|\CriteriaCompo $criteria - * @return false|int count of objects + * @return null|int count of objects */ - public function getCount($criteria = null) + public function getCount($criteria = null): ?int { $sql = 'SELECT COUNT(*) FROM ' . $this->dbTable; if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { @@ -285,17 +279,14 @@ public function getCount($criteria = null) } $result = $this->db->query($sql); if (!$result) { - return false; + return null; } [$count] = $this->db->fetchRow($result); return $count; } - /** - * @param $object - */ - public function forceDeactivate($object, string $type = 'rssf_activated'): bool + public function forceDeactivate(\XoopsObject $object, string $type = 'rssf_activated'): bool { $criteria = new \Criteria($this->objKey, $object->getVar($this->objKey)); $fields = ['rssf_activated' => 0, 'subfeed' => 0]; @@ -304,12 +295,10 @@ public function forceDeactivate($object, string $type = 'rssf_activated'): bool return true; } - /** - * @return false|array - */ - public function &getPluginFileList() + + public function &getPluginFileList(): ?array { - $ret = false; + $ret = null; $objs = $this->getObjects2(null, 'rssf_filename'); if (\is_array($objs) && !empty($objs)) { $ret = []; @@ -322,7 +311,6 @@ public function &getPluginFileList() } /** - * @param \XoopsObject $object * @return false|mixed */ public function checkPlugin(\XoopsObject $object) diff --git a/class/Plugins/Myalbum.php b/class/Plugins/Myalbum.php index 18976ec5..01e7974a 100644 --- a/class/Plugins/Myalbum.php +++ b/class/Plugins/Myalbum.php @@ -66,10 +66,7 @@ final class Myalbum extends AbstractPlugin { public $dirname = 'myalbum'; - /** - * @param $uid - */ - public function myGetUnameFromId($uid): string + public function myGetUnameFromId(int $uid): string { static $thisUser = false; static $lastUid = false; diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php index 8cc1441f..8b4ae5d3 100644 --- a/class/Plugins/Smartpartner.php +++ b/class/Plugins/Smartpartner.php @@ -84,7 +84,7 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array /** @var PartnerHandler $partnerHandler */ $partnerHandler = PluginHelper::getInstance()->getHandler('Partner'); $partners = $partnerHandler->getPartners($this->grab, 0, Constants::SPARTNER_STATUS_ACTIVE, 'weight', 'DESC'); - if (false !== $partners && \count($partners) > 0) { + if (\is_array($partners) && \count($partners) > 0) { $ret = []; for ($i = 0, $iMax = \count($partners); $i < $iMax; ++$i) { $ret[$i]['link'] = $ret[$i]['guid'] = SMARTPARTNER_URL . 'partner.php?id=' . $partners[$i]->getVar('id'); diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php index 9278a19a..d82e9187 100644 --- a/class/Plugins/Surnames.php +++ b/class/Plugins/Surnames.php @@ -49,10 +49,7 @@ final class Surnames extends AbstractPlugin { public $dirname = 'surnames'; - /** - * @param $uid - */ - public function myGetUnameFromId($uid): string + public function myGetUnameFromId(int $uid): string { static $thisUser = false; static $lastUid = false; @@ -63,8 +60,9 @@ public function myGetUnameFromId($uid): string } if (!\is_object($thisUser)) { + /** @var \XoopsMemberHandler $memberHandler */ $memberHandler = \xoops_getHandler('member'); - $thisUser = $memberHandler->getUser($uid); + $thisUser = $memberHandler->getUser($uid); } $name = \htmlspecialchars($thisUser->getVar('name'), \ENT_QUOTES | \ENT_HTML5); if ('' == $name) { diff --git a/class/Plugins/Xoopstube.php b/class/Plugins/Xoopstube.php index 2a2fada0..2becd0e4 100644 --- a/class/Plugins/Xoopstube.php +++ b/class/Plugins/Xoopstube.php @@ -57,7 +57,7 @@ final class Xoopstube extends AbstractPlugin public function loadModule(): ?\XoopsModule{ $mod = null; - if (class_exists(PluginHelper::class)) { + if (\class_exists(PluginHelper::class)) { $this->helper = PluginHelper::getInstance(); $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); diff --git a/class/Plugins/legacy/Weblinks.php b/class/Plugins/legacy/Weblinks.php index ac4d4034..45e406fe 100644 --- a/class/Plugins/legacy/Weblinks.php +++ b/class/Plugins/legacy/Weblinks.php @@ -59,10 +59,7 @@ public function loadModule():?\XoopsModule return $mod; } - /** - * @param $uid - */ - public function myGetUnameFromId($uid): string + public function myGetUnameFromId(int $uid): string { static $thisUser = false; static $lastUid = false; diff --git a/include/install.php b/include/install.php index 6d207c08..48633040 100644 --- a/include/install.php +++ b/include/install.php @@ -94,10 +94,6 @@ function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $oldversion): bo return true; } -/** - * @param $xoopsMod - * @param $lang - */ //function rssfInstallLangFile($xoopsMod, $lang) //{ // $file = XOOPS_ROOT_PATH . '/modules/' . $xoopsMod->getVar('dirname') . '/language/%s/install.php'; From b146e88046ec8f5b1df4e7d606936754e0cadc55 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 22:48:01 -0400 Subject: [PATCH 106/154] Scrutinizer --- class/PluginHandler.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/class/PluginHandler.php b/class/PluginHandler.php index edb52eb0..f546d152 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -238,7 +238,10 @@ public function getObjects2($criteria = null, string $fields = '*', string $key return $ret; } - public function modifyObjects(\CriteriaElement $criteria = null, array $fields = [], bool $force = false): ?string + /** + * @param null|\Criteria|\CriteriaCompo $criteria + */ + public function modifyObjects($criteria = null, array $fields = [], bool $force = false): ?string { if ($fields && \is_array($fields)) { $object = new $this->objClass(); @@ -250,7 +253,7 @@ public function modifyObjects(\CriteriaElement $criteria = null, array $fields = } $sql = mb_substr($sql, 0, -2); $sql = 'UPDATE ' . $this->dbTable . ' SET ' . $sql; - if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { + if ($criteria instanceof \CriteriaCompo::class) { $sql .= ' ' . $criteria->renderWhere(); } if ($force) { From 3087290ecbd6af3164a0d7a30c44261365307af2 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 22:57:43 -0400 Subject: [PATCH 107/154] php8 --- .scrutinizer.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index e47951ad..2defa787 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,5 +1,7 @@ # language: php build: + environment: + php: 8.1.0RC4 nodes: tests: true analysis: From ffd01a0644f92a9e2db355ea5eb30222fd232c0e Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 23:06:30 -0400 Subject: [PATCH 108/154] scrutinizer --- .scrutinizer.yml | 2 +- admin/index.php | 4 ++++ class/FeedHandler.php | 2 -- class/PluginHandler.php | 2 +- class/Utility.php | 1 - 5 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 2defa787..33c15428 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,7 +1,7 @@ # language: php build: environment: - php: 8.1.0RC4 + php: 8.1.0RC2 nodes: tests: true analysis: diff --git a/admin/index.php b/admin/index.php index 945bd8d3..35f2fef1 100644 --- a/admin/index.php +++ b/admin/index.php @@ -19,6 +19,8 @@ use Xmf\Request; use XoopsModules\Rssfit\{ + FeedHandler, + PluginHandler, Common, Helper, Utility @@ -27,6 +29,8 @@ /** @var Helper $helper */ /** @var Utility $utility */ /** @var \Xmf\Module\Admin $adminObject */ +/** @var FeedHandler $feedHandler */ +/** @var PluginHandler $pluginHandler */ require_once __DIR__ . '/admin_header.php'; diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 91615a36..525b6d42 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -22,8 +22,6 @@ * @author XOOPS Development Team */ -use XoopsModules\Rssfit; - if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } diff --git a/class/PluginHandler.php b/class/PluginHandler.php index f546d152..cb1e5393 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -253,7 +253,7 @@ public function modifyObjects($criteria = null, array $fields = [], bool $force } $sql = mb_substr($sql, 0, -2); $sql = 'UPDATE ' . $this->dbTable . ' SET ' . $sql; - if ($criteria instanceof \CriteriaCompo::class) { + if ($criteria instanceof \CriteriaCompo) { $sql .= ' ' . $criteria->renderWhere(); } if ($force) { diff --git a/class/Utility.php b/class/Utility.php index 1b0e91df..fb9a9111 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -29,7 +29,6 @@ //require_once \dirname(__DIR__) . '/include/common.php'; -use XoopsModules\Rssfit; use XoopsModules\Rssfit\Constants; /** From 37c8ce8ba2a156db219b7173f7f0f8515d09e495 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 23:10:09 -0400 Subject: [PATCH 109/154] php --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 33c15428..ee800b06 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,7 +1,7 @@ # language: php build: environment: - php: 8.1.0RC2 + php: 8.1.0 nodes: tests: true analysis: From 0b612316b0c9740f0e17877527392a42a4da8dec Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 23:11:07 -0400 Subject: [PATCH 110/154] php --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index ee800b06..75b5f892 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,7 +1,7 @@ # language: php build: environment: - php: 8.1.0 + php: 8.0.1RC1 nodes: tests: true analysis: From 25dabe5a0c092f6a120bd6de30193db96d413a9a Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 23:12:40 -0400 Subject: [PATCH 111/154] php8 --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 75b5f892..42b40f17 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,7 +1,7 @@ # language: php build: environment: - php: 8.0.1RC1 + php: 8.0.11 nodes: tests: true analysis: From da41462d8648839b23cda7f3853658e1c06795f6 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 23:17:59 -0400 Subject: [PATCH 112/154] php8 --- .scrutinizer.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 42b40f17..d1d302ae 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,7 +1,7 @@ # language: php build: environment: - php: 8.0.11 + php: 8.0 nodes: tests: true analysis: From 0924a55fc230e1251e93225fe95352d2b326c163 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 18 Oct 2021 00:59:37 -0400 Subject: [PATCH 113/154] cosmetics, actions --- .github/workflows/ci.yml | 43 ++++++++++ README.md | 5 +- admin/admin_footer.php | 2 +- admin/do_about.php | 3 +- admin/do_channel.php | 1 + admin/do_intro.php | 7 +- admin/do_migrate.php | 13 +-- admin/do_plugins.php | 5 +- admin/do_sticky.php | 6 +- admin/do_subfeeds.php | 3 +- admin/index.php | 9 +-- admin/menu.php | 34 ++++---- admin/migrate.php | 13 +-- assets/images/icons/16/index.php | 1 + assets/images/icons/32/index.php | 1 + assets/images/icons/index.php | 1 + assets/images/index.php | 1 + assets/js/index.php | 1 + class/AbstractPlugin.php | 2 +- class/Common/Breadcrumb.php | 2 - class/Common/Configurator.php | 2 - class/Common/FilesManagement.php | 1 - class/Common/Migrate.php | 73 +++++++++-------- class/Common/SysUtility.php | 52 ++++++------ class/Common/TestdataButtons.php | 18 ++--- class/Common/VersionChecks.php | 4 +- class/Common/index.php | 1 + class/Constants.php | 2 +- class/FeedHandler.php | 6 -- class/Helper.php | 4 +- class/MiscHandler.php | 26 +++--- class/PluginHandler.php | 33 ++++---- class/PluginInterface.php | 1 - class/Plugins/Adslight.php | 32 ++++---- class/Plugins/Ams.php | 7 +- class/Plugins/Apcal.php | 14 ++-- class/Plugins/Comments.php | 5 +- class/Plugins/Extcal.php | 33 ++++---- class/Plugins/Lexikon.php | 14 ++-- class/Plugins/Myalbum.php | 4 +- class/Plugins/Mylinks.php | 22 +++--- class/Plugins/Newbb.php | 14 ++-- class/Plugins/News.php | 8 +- class/Plugins/Oledrion.php | 26 +++--- class/Plugins/Pical.php | 3 +- class/Plugins/Publisher.php | 18 ++--- class/Plugins/Sample.php | 2 +- class/Plugins/Smartfaq.php | 13 ++- class/Plugins/Smartpartner.php | 26 +++--- class/Plugins/Surnames.php | 13 +-- class/Plugins/Wfdownloads.php | 13 ++- class/Plugins/Wflinks.php | 2 +- class/Plugins/Xoopstube.php | 12 +-- class/Utility.php | 6 +- class/index.php | 1 + config/config.php | 8 +- config/icons.php | 4 +- docs/index.php | 1 + include/common.php | 8 +- include/index.php | 1 + include/install.php | 25 +++--- include/oninstall.php | 7 +- include/onuninstall.php | 2 +- include/onupdate.php | 16 ++-- index.php | 4 +- language/english/common.php | 5 +- language/english/help/helpheader.tpl | 12 +-- language/english/help/index.php | 1 + language/english/index.php | 1 + language/english/install.php | 7 +- language/index.php | 1 + preloads/autoloader.php | 2 +- preloads/core.php | 1 - rss.css | 54 ++++++------- rss.php | 1 + rssreader.php | 4 +- sql/index.php | 1 + sql/mysql.sql | 44 +++++------ sql/rss_1.31.0_migrate.yml | 114 +++++++++++---------------- sql/rssfit_1.31.0_migrate.yml | 114 +++++++++++---------------- sql/rssfit_1.31_migrate.yml | 114 +++++++++++---------------- templates/index.php | 1 + testdata/index.php | 13 +-- xoops_version.php | 20 ++--- 84 files changed, 623 insertions(+), 627 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..df5c155d --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,43 @@ +name: CI + +on: [ push, pull_request ] + +jobs: + phpstan: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + php-versions: [ '7.2', '7.4', '8.0', '8.1' ] + steps: + - uses: actions/checkout@v2 + - uses: php-actions/composer@v5 + - name: PHPStan Static Analysis + uses: php-actions/phpstan@v3 + with: + path: / + php-version: ${{ matrix.php-versions }} + extensions: mbstring, dom, fileinfo, mysql + tools: cs2pr, phpcs, phpstan, psalm, phpunit, composer + run: phpstan analyze src --level=5 --error-format=checkstyle | cs2pr + # 8- Run Psalm scan + - name: Run Psalm scan + run: psalm --threads=8 --shepherd --stats --output-format=github + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # 9- Run SonarCloud scan + - name: Run SonarCloud scan + uses: sonarsource/sonarcloud-github-action@master + with: + args: > + -Dsonar.projectKey=MedUnes_noise-php + -Dsonar.organization=medunes + -Dsonar.sources=src + -Dsonar.tests=tests + -Dsonar.language=php + -Dsonar.sourceEncoding=UTF-8 + -Dsonar.exclusions=vendor/* + -Dsonar.verbose=true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} diff --git a/README.md b/README.md index 176a2ecf..33b80e1e 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ ![alt XOOPS CMS](https://xoops.org/images/logoXoopsPhp8.png) + ## RSSFit module for [XOOPS CMS 2.5.10+](https://xoops.org) + [![XOOPS CMS Module](https://img.shields.io/badge/XOOPS%20CMS-Module-blue.svg)](https://xoops.org) [![Software License](https://img.shields.io/badge/license-GPL-brightgreen.svg?style=flat)](https://www.gnu.org/licenses/gpl-2.0.html) @@ -11,8 +13,7 @@ **RSSFit** module for [XOOPS CMS](https://xoops.org) is a module for XOOPS generates RSS 2.0 validated XML feed. Web masters can decide what to be displayed in the XML output by activating installed plug-ins. -[![Tutorial Available](https://xoops.org/images/tutorial-available-blue.svg)](https://xoops.gitbook.io/rssfit-tutorial/) Tutorial: see [GitBook](https://xoops.gitbook.io/rssfit-tutorial/). -To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/rssfit-tutorial) +[![Tutorial Available](https://xoops.org/images/tutorial-available-blue.svg)](https://xoops.gitbook.io/rssfit-tutorial/) Tutorial: see [GitBook](https://xoops.gitbook.io/rssfit-tutorial/). To contribute to the Tutorial, [fork it on GitHub](https://github.com/XoopsDocs/rssfit-tutorial) [![Translations on Transifex](https://xoops.org/images/translations-transifex-blue.svg)](https://www.transifex.com/xoops) diff --git a/admin/admin_footer.php b/admin/admin_footer.php index ec77d947..f8d7efd6 100644 --- a/admin/admin_footer.php +++ b/admin/admin_footer.php @@ -14,7 +14,7 @@ /** * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author XOOPS Development Team + * @author XOOPS Development Team */ $pathIcon32 = Xmf\Module\Admin::iconUrl('', '32'); diff --git a/admin/do_about.php b/admin/do_about.php index cf14e9a7..0296616f 100644 --- a/admin/do_about.php +++ b/admin/do_about.php @@ -13,12 +13,13 @@ */ use Xmf\Module\Admin; + //use Kint; /** * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author XOOPS Development Team + * @author XOOPS Development Team */ use Xmf\Request; diff --git a/admin/do_channel.php b/admin/do_channel.php index b7ea9bfe..0758df8a 100644 --- a/admin/do_channel.php +++ b/admin/do_channel.php @@ -24,6 +24,7 @@ FeedHandler, Utility }; + /** @var FeedHandler $feedHandler */ if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { diff --git a/admin/do_intro.php b/admin/do_intro.php index 63e430b7..297a5f9e 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -23,6 +23,7 @@ use XoopsModules\Rssfit\{ MiscHandler }; + /** @var MiscHandler $miscHandler */ if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { @@ -45,14 +46,14 @@ $contentTray = new \XoopsFormElementTray(_AM_RSSFIT_EDIT_INTRO_TEXT, '
      '); $contentTray->setDescription(_AM_RSSFIT_EDIT_INTRO_TEXT_DESC . _AM_RSSFIT_EDIT_INTRO_TEXT_DESC_SUB); $contentTray->addElement(new \XoopsFormDhtmlTextArea('', 'content', $intro->getVar('misc_content', 'e'), 15, 60)); - $dohtml = new \XoopsFormCheckBox('', 'dohtml', $setting['dohtml']??''); + $dohtml = new \XoopsFormCheckBox('', 'dohtml', $setting['dohtml'] ?? ''); $dohtml->addOption(1, _AM_RSSFIT_DO_HTML); $contentTray->addElement($dohtml); - $dobr = new \XoopsFormCheckBox('', 'dobr', $setting['dobr']??''); + $dobr = new \XoopsFormCheckBox('', 'dobr', $setting['dobr'] ?? ''); $dobr->addOption(1, _AM_RSSFIT_DO_BR); $contentTray->addElement($dobr); - $sub = new \XoopsFormTextArea(_AM_RSSFIT_EDIT_INTRO_SUB, 'sub', htmlspecialchars($setting['sub']??'', ENT_QUOTES | ENT_HTML5)); + $sub = new \XoopsFormTextArea(_AM_RSSFIT_EDIT_INTRO_SUB, 'sub', htmlspecialchars($setting['sub'] ?? '', ENT_QUOTES | ENT_HTML5)); $sub->setDescription(_AM_RSSFIT_EDIT_INTRO_SUB_DESC); $form = new \XoopsThemeForm(_AM_RSSFIT_EDIT_INTRO, 'editintro', RSSFIT_ADMIN_URL); diff --git a/admin/do_migrate.php b/admin/do_migrate.php index 03555ec2..9e1faeb1 100644 --- a/admin/do_migrate.php +++ b/admin/do_migrate.php @@ -37,6 +37,7 @@ Common\Configurator, Common\Migrate }; + /** @var Admin $adminObject */ /** @var Configurator $configurator */ /** @var Migrate $migrator */ @@ -70,13 +71,13 @@ $migrator = new Migrate($configurator); -$op = Request::getCmd('op', 'show'); -$opShow = Request::getCmd('show', null, 'POST'); +$op = Request::getCmd('op', 'show'); +$opShow = Request::getCmd('show', null, 'POST'); $opMigrate = Request::getCmd('migrate', null, 'POST'); -$opSchema = Request::getCmd('schema', null, 'POST'); -$op = !empty($opShow) ? 'show' : $op; -$op = !empty($opMigrate) ? 'migrate' : $op; -$op = !empty($opSchema) ? 'schema' : $op; +$opSchema = Request::getCmd('schema', null, 'POST'); +$op = !empty($opShow) ? 'show' : $op; +$op = !empty($opMigrate) ? 'migrate' : $op; +$op = !empty($opSchema) ? 'schema' : $op; $message = ''; diff --git a/admin/do_plugins.php b/admin/do_plugins.php index e7a9f943..daeb2728 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -24,6 +24,7 @@ Helper, PluginHandler }; + /** @var PluginHandler $pluginHandler */ if (!preg_match('#/rssfit/admin/#', $_SERVER['SCRIPT_NAME'])) { @@ -38,7 +39,7 @@ $ret = ''; // activated plugins $criteria = new \Criteria('rssf_activated', '1'); - $plugins = $pluginHandler->getObjects2($criteria, 'p_activated'); + $plugins = $pluginHandler->getObjects2($criteria, 'p_activated'); if ($plugins) { $ret .= "
      " diff --git a/admin/do_sticky.php b/admin/do_sticky.php index 29bf7045..b499ed5b 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -1,4 +1,6 @@ bread[] = [ 'link' => $link, @@ -60,7 +62,7 @@ public function addLink($title = '', $link = '') /** * Render BreadCrumb */ - public function render() + public function render(): void { /* TODO if you want to use the render code below, diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index fe576bc0..5362a2ec 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -1,5 +1,7 @@ isAdmin()) { @@ -127,7 +129,7 @@ public static function deleteDirectory($src) * * @return bool true on success */ - public static function rrmdir($src) + public static function rrmdir($src): bool { // Only continue if user is a 'global' Admin if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { @@ -167,7 +169,7 @@ public static function rrmdir($src) * * @return bool true on success */ - public static function rmove($src, $dest) + public static function rmove($src, $dest): bool { // Only continue if user is a 'global' Admin if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { @@ -210,7 +212,7 @@ public static function rmove($src, $dest) * * @uses \Xmf\Module\Helper::getHelper() */ - public static function rcopy($src, $dest) + public static function rcopy($src, $dest): bool { // Only continue if user is a 'global' Admin if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index 366bd872..f76b521d 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -1,5 +1,7 @@ renameTables as $oldName => $newName) { // if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) { @@ -65,7 +67,7 @@ private function changePrefix() * @param string $tableName table to convert * @param string $columnName column with IP address */ - private function convertIPAddresses($tableName, $columnName) + private function convertIPAddresses($tableName, $columnName): void { // if ($this->tableHandler->useTable($tableName)) { // $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); @@ -84,7 +86,7 @@ private function convertIPAddresses($tableName, $columnName) * @deprecated (just as an example here) * Move do* columns from newbb_posts to newbb_posts_text table */ - private function moveDoColumns() + private function moveDoColumns(): void { // $tableName = 'newbb_posts_text'; // $srcTableName = 'newbb_posts'; @@ -104,7 +106,7 @@ private function moveDoColumns() /** * rename table if needed */ - private function renameTable() + private function renameTable(): void { foreach ($this->renameTables as $oldName => $newName) { if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) { @@ -116,7 +118,7 @@ private function renameTable() /** * rename columns if needed */ - private function renameColumns() + private function renameColumns(): void { foreach ($this->renameColumns as $tableName) { if ($this->tableHandler->useTable($tableName)) { diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index c93eb76a..4c43b554 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -1,5 +1,7 @@ miscHandler->getObjects2(new \Criteria('misc_category', 'channel')); @@ -165,7 +167,7 @@ public function getChannel(&$feed) * @param $feed * @return bool */ - public function getSticky(&$feed) + public function getSticky(&$feed): bool { if (!$intr = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'sticky'))) { return false; @@ -196,7 +198,7 @@ public function getSticky(&$feed) /** * @param $feed */ - public function getItems(&$feed) + public function getItems(&$feed): void { $entries = []; if (!empty($feed['plugin'])) { @@ -250,7 +252,7 @@ public function getItems(&$feed) * @param $text * @return string */ - public function doSubstr($text) + public function doSubstr($text): string { $ret = $text; $len = \function_exists('mb_strlen') ? mb_strlen($ret, $this->charset) : mb_strlen($ret); @@ -320,7 +322,7 @@ public function rssTimeStamp($time) * @param $b * @return int */ - public function sortTimestamp($a, $b) + public function sortTimestamp($a, $b): int { if ($a['timestamp'] == $b['timestamp']) { return 0; @@ -335,7 +337,7 @@ public function sortTimestamp($a, $b) * @param bool $dospec * @param false $dosub */ - public function cleanupChars(&$text, $strip = true, $dospec = true, $dosub = false) + public function cleanupChars(&$text, $strip = true, $dospec = true, $dosub = false): void { if ($strip) { $text = \strip_tags($text); @@ -355,7 +357,7 @@ public function cleanupChars(&$text, $strip = true, $dospec = true, $dosub = fal /** * @param $text */ - public function wrapCdata(&$text) + public function wrapCdata(&$text): void { $text = ''], ['<![CDATA[', ']]>'], $text) . ']]>'; } @@ -368,7 +370,7 @@ public function wrapCdata(&$text) public function &getActivatedSubfeeds($fields = '', $type = '') { $ret = false; - $subs = $this->pluginHandler->getObjects2(new \Criteria('subfeed', 1), $fields); + $subs = $this->pluginHandler->getObjects2(new \Criteria('subfeed', '1'), $fields); if (\is_array($subs) && !empty($subs)) { $ret = []; switch ($type) { @@ -397,7 +399,7 @@ public function &getActivatedSubfeeds($fields = '', $type = '') * @param string $type * @return \XoopsFormSelect */ - public function feedSelectBox($caption = '', $selected = '', $size = 1, $multi = true, $none = true, $main = true, $name = 'feeds', $type = 'id') + public function feedSelectBox($caption = '', $selected = '', $size = 1, $multi = true, $none = true, $main = true, $name = 'feeds', $type = 'id'): \XoopsFormSelect { $select = new \XoopsFormSelect($caption, $name, $selected, $size, $multi); if ($none) { @@ -447,12 +449,12 @@ public function subFeedUrl($filename = '') /** * @param $feed */ - public function checkSubFeed(&$feed) + public function checkSubFeed(&$feed): void { if (!empty($feed['plugin'])) { $criteria = new \CriteriaCompo(); $criteria->add(new \Criteria('rssf_filename', \sprintf($this->plugin_file, $feed['plugin']))); - $criteria->add(new \Criteria('subfeed', 1)); + $criteria->add(new \Criteria('subfeed', '1')); $sub = $this->pluginHandler->getObjects2($criteria); $handler = false; if (isset($sub[0])) { @@ -471,7 +473,7 @@ public function checkSubFeed(&$feed) /** * @param $feed */ - public function buildFeed(&$feed) + public function buildFeed(&$feed): void { $this->getChannel($feed); $this->getItems($feed); diff --git a/class/Helper.php b/class/Helper.php index f8297724..5cabf406 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -1,5 +1,7 @@ vars['dohtml']['value'] = $do; } @@ -52,7 +54,7 @@ public function setDoHtml($do = true) /** * @param bool $do */ - public function setDoBr($do = true) + public function setDoBr($do = true): void { $this->vars['dobr']['value'] = $do; } diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 10f730b9..785a576d 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -1,5 +1,7 @@ obj_key, $obj->getVar($this->obj_key)); $fields = ['rssf_activated' => 0, 'subfeed' => 0]; diff --git a/class/Plugins/Adslight.php b/class/Plugins/Adslight.php index 2655e5c4..fd4495e2 100644 --- a/class/Plugins/Adslight.php +++ b/class/Plugins/Adslight.php @@ -1,5 +1,7 @@ specUrl($spec), \_AM_RSSFIT_EDIT_CHANNEL_QMARK, 'spec', \_AM_RSSFIT_EDIT_CHANNEL_MOREINFO); } @@ -70,7 +72,7 @@ public static function genSpecMoreInfo($spec, $feedHandler) * @param string $id * @return string */ - public static function rssfGenAnchor($url = '', $text = '', $target = '', $title = '', $class = '', $id = '') + public static function rssfGenAnchor($url = '', $text = '', $target = '', $title = '', $class = '', $id = ''): string { if (!empty($url)) { $ret = ' 0 display at most $max_words words */ - public static function get_rss_feed_as_html($feed_url, $max_item_cnt = 10, $show_date = true, $show_description = true, $max_words = 0, $cache_timeout = 7200, $cache_prefix = XOOPS_VAR_PATH . '/caches/xoops_cache/rss2html-') + public static function get_rss_feed_as_html($feed_url, $max_item_cnt = 10, $show_date = true, $show_description = true, $max_words = 0, $cache_timeout = 7200, $cache_prefix = XOOPS_VAR_PATH . '/caches/xoops_cache/rss2html-'): string { $result = ''; // get feeds and parse items @@ -184,7 +186,7 @@ public static function get_rss_feed_as_html($feed_url, $max_item_cnt = 10, $show return $result; } - public static function output_rss_feed($feed_url, $max_item_cnt = 10, $show_date = true, $show_description = true, $max_words = 0) + public static function output_rss_feed($feed_url, $max_item_cnt = 10, $show_date = true, $show_description = true, $max_words = 0): void { echo self::get_rss_feed_as_html($feed_url, $max_item_cnt, $show_date, $show_description, $max_words); } diff --git a/config/config.php b/config/config.php index f99f525f..d109a1d1 100644 --- a/config/config.php +++ b/config/config.php @@ -1,4 +1,6 @@ setDoBr($setting['dobr'] ? 1 : 0); $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); $content = str_replace(['{SITENAME}', '{SITEURL}'], [$xoopsConfig['sitename'], XOOPS_URL . '/'], $intro->getVar('misc_content')); - if (false !== mb_strpos($content, '{SUB}') && $plugins = $pluginHandler->getObjects2(new \Criteria('subfeed', 1))) { + if (false !== mb_strpos($content, '{SUB}') && $plugins = $pluginHandler->getObjects2(new \Criteria('subfeed', '1'))) { $sublist = ''; foreach ($plugins as $p) { $sub = ($setting['sub']); diff --git a/language/english/admin.php b/language/english/admin.php index 52006ec5..17e2cda5 100644 --- a/language/english/admin.php +++ b/language/english/admin.php @@ -1,4 +1,6 @@ RSS feed RSS feed diff --git a/language/english/main.php b/language/english/main.php index 5fa58897..6898d4f0 100644 --- a/language/english/main.php +++ b/language/english/main.php @@ -1,3 +1,5 @@ Date: Sun, 17 Oct 2021 05:28:41 -0400 Subject: [PATCH 085/154] refactoring: - AbstractPlugin.php - PluginInterface.php - types: strict, return, parameters - code cosmetics --- admin/do_channel.php | 2 +- admin/do_plugins.php | 4 +- admin/do_sticky.php | 6 +- admin/do_subfeeds.php | 8 +-- admin/index.php | 4 +- class/AbstractPlugin.php | 75 ++++++++++++++++++++++++ class/Common/Breadcrumb.php | 2 +- class/Common/FilesManagement.php | 10 ++-- class/Common/Migrate.php | 2 +- class/Common/SysUtility.php | 16 +++--- class/Common/TestdataButtons.php | 4 ++ class/Common/VersionChecks.php | 6 +- class/FeedHandler.php | 91 ++++++++++++++--------------- class/Misc.php | 4 +- class/MiscHandler.php | 66 ++++++++++----------- class/PluginHandler.php | 78 ++++++++++++------------- class/PluginInterface.php | 22 +++++++ class/Plugins/Adslight.php | 41 ++++++------- class/Plugins/Ams.php | 30 +++------- class/Plugins/Apcal.php | 37 +++++++----- class/Plugins/Comments.php | 30 ++++------ class/Plugins/Extcal.php | 44 +++++++------- class/Plugins/Lexikon.php | 38 +++++++------ class/Plugins/Myalbum.php | 34 ++++------- class/Plugins/Mylinks.php | 35 +++++++----- class/Plugins/Newbb.php | 38 +++++++------ class/Plugins/News.php | 32 +++-------- class/Plugins/Oledrion.php | 38 +++++++------ class/Plugins/Pical.php | 33 ++++------- class/Plugins/Publisher.php | 94 ------------------------------ class/Plugins/Sample.php | 35 ++++-------- class/Plugins/Smartfaq.php | 41 +++++++------ class/Plugins/Smartpartner.php | 43 ++++++++------ class/Plugins/Surnames.php | 35 ++++-------- class/Plugins/Wfdownloads.php | 98 -------------------------------- class/Plugins/Wflinks.php | 35 ++++-------- class/Plugins/Xoopstube.php | 37 ++++++------ class/Utility.php | 97 ++++++++++++++++++------------- docs/changelog.txt | 5 ++ include/common.php | 6 +- include/install.php | 8 +-- include/oninstall.php | 4 +- include/onuninstall.php | 4 +- include/onupdate.php | 4 +- index.php | 8 ++- rssreader.php | 2 +- testdata/index.php | 4 +- 47 files changed, 637 insertions(+), 753 deletions(-) create mode 100644 class/AbstractPlugin.php create mode 100644 class/PluginInterface.php delete mode 100644 class/Plugins/Publisher.php delete mode 100644 class/Plugins/Wfdownloads.php diff --git a/admin/do_channel.php b/admin/do_channel.php index 2f6382be..b7ea9bfe 100644 --- a/admin/do_channel.php +++ b/admin/do_channel.php @@ -69,7 +69,7 @@ foreach ($ids as $i) { $criteria = new \Criteria('misc_id', $i); $fields = ['misc_content' => trim($ele[$i])]; - $err = $feedHandler->miscHandler->modifyObjects($criteria, $fields); + $err = $feedHandler->miscHandler->modifyObjects($criteria, $fields, false); if ($err) { $errors[] = $err; } diff --git a/admin/do_plugins.php b/admin/do_plugins.php index 172bc99b..e7a9f943 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -140,7 +140,7 @@ if (!$filelist = &$pluginHandler->getPluginFileList()) { $filelist = []; } - $list = \XoopsLists::getFileListAsArray(RSSFIT_ROOT_PATH . 'class/Plugins'); + $list = \XoopsLists::getFileListAsArray($helper->path('class/Plugins')); $installable = []; foreach ($list as $f) { if (preg_match('/[a-zA-Z0-9_]+\.php/', $f) && !in_array($f, $filelist)) { @@ -163,7 +163,7 @@ . "\n" . "
      " . $i . ""; $p = $pluginHandler->create(); diff --git a/admin/do_sticky.php b/admin/do_sticky.php index b499ed5b..0f7af4a5 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -43,16 +43,16 @@ $contentTray->setDescription(_AM_RSSFIT_EDIT_INTRO_TEXT_DESC); $content = new \XoopsFormTextArea('', 'content', $sticky->getVar('misc_content', 'e'), 10); $contentTray->addElement($content); - $dohtml = new \XoopsFormCheckbox('', 'dohtml', $setting['dohtml']); + $dohtml = new \XoopsFormCheckBox('', 'dohtml', $setting['dohtml']); $dohtml->addOption(1, _AM_RSSFIT_DO_HTML); $contentTray->addElement($dohtml); - $dobr = new \XoopsFormCheckbox('', 'dobr', $setting['dobr']); + $dobr = new \XoopsFormCheckBox('', 'dobr', $setting['dobr']); $dobr->addOption(1, _AM_RSSFIT_DO_BR); $contentTray->addElement($dobr); $link = new \XoopsFormText(_AM_RSSFIT_STICKY_LINK, 'link', 50, 255, htmlspecialchars($setting['link']??'', ENT_QUOTES | ENT_HTML5)); - $applyto = $feedHandler->feedSelectBox(_AM_RSSFIT_STICKY_APPLYTO, $setting['feeds']??'', 10); + $applyto = $feedHandler->feedSelectBox(_AM_RSSFIT_STICKY_APPLYTO, $setting['feeds']??null, 10); $form = new \XoopsThemeForm(_AM_RSSFIT_STICKY_EDIT, 'editsticky', RSSFIT_ADMIN_URL); $form->addElement($title); diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index f1becb5e..8f66fbab 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -53,13 +53,13 @@ if (!$handler = $pluginHandler->checkPlugin($p)) { $pluginHandler->forceDeactivate($p); $mod = implode('
      ', $p->getErrors()); - $activate = new \XoopsFormCheckbox('', 'activate[' . $id . ']', 0); + $activate = new \XoopsFormCheckBox('', 'activate[' . $id . ']', 0); $activate->setExtra('disabled="disabled"'); $config = ' '; $urlLink = $feedHandler->subFeedUrl($p->getVar('rssf_filename')); } else { $mod = $handler->modname; - $activate = new \XoopsFormCheckbox('', 'activate[' . $id . ']', $p->getVar('subfeed')); + $activate = new \XoopsFormCheckBox('', 'activate[' . $id . ']', $p->getVar('subfeed')); $config = Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_RSSFIT_SUB_CONFIGURE); $urlLink = '' . $feedHandler->subFeedUrl($p->getVar('rssf_filename')) . ''; } @@ -104,11 +104,11 @@ $plugins = $pluginHandler->getObjects2(null, 'sublist'); if ($plugins) { - $pluginHandler->modifyObjects(null, ['subfeed' => 0]); + $pluginHandler->modifyObjects(null, ['subfeed' => 0], false); if (isset($activate) && is_array($activate) && count($activate) > 0) { $keys = array_keys($activate); $criteria = new \Criteria('rssf_conf_id', '(' . implode(',', $keys) . ')', 'IN'); - $pluginHandler->modifyObjects($criteria, ['subfeed' => 1]); + $pluginHandler->modifyObjects($criteria, ['subfeed' => 1], false); } redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); } else { diff --git a/admin/index.php b/admin/index.php index c6dfe94f..945bd8d3 100644 --- a/admin/index.php +++ b/admin/index.php @@ -43,7 +43,7 @@ //$adminObject = \Xmf\Module\Admin::getInstance(); -if (file_exists(RSSFIT_ROOT_PATH . 'admin/do_' . $do . '.php')) { +if (file_exists($helper->path('admin/do_' . $do . '.php'))) { require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; $hiddenDo = new \XoopsFormHidden('do', $do); $buttonSave = new \XoopsFormButton('', 'submit', _AM_RSSFIT_SAVE, 'submit'); @@ -54,7 +54,7 @@ $saveCancelTray->addElement($buttonSave); $saveCancelTray->addElement($buttonCancel); $adminObject->displayNavigation('?do=' . $do); - require RSSFIT_ROOT_PATH . 'admin/do_' . $do . '.php'; + require $helper->path('admin/do_' . $do . '.php'); } else { $adminObject->displayNavigation(basename(__FILE__)); $adminObject->displayIndex(); diff --git a/class/AbstractPlugin.php b/class/AbstractPlugin.php new file mode 100644 index 00000000..cfabea13 --- /dev/null +++ b/class/AbstractPlugin.php @@ -0,0 +1,75 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: SmartSection +* Version: 1.0.4 Beta 2 / 1.1 Beta 1 / 1.05 Beta 1 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +if (!\defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class AbstractPlugin + * @package XoopsModules\Rssfit + */ +abstract class AbstractPlugin implements PluginInterface +{ + public $modname; + public $grab; + public $module; // optional, see line 67 + + /** + * @return \XoopsModule + */ + public function loadModule(): ?\XoopsModule + { + $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); + if (!$mod || !$mod->getVar('isactive')) { + return null; + } + + if (!$mod || !$mod->getVar('isactive')) { + return null; + } + $this->modname = $mod->getVar('name'); + $this->module = $mod; // optional, remove this line if there is nothing to do with module info when grabbing entries + + return $mod; + } + + /** + * @param \XoopsMySQLDatabase $xoopsDB + * @return array + */ + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array + { + } +} diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index a4ebc0e0..b054273d 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -51,7 +51,7 @@ public function __construct() * @param string $title * @param string $link */ - public function addLink($title = '', $link = ''): void + public function addLink(string $title = '', string $link = ''): void { $this->bread[] = [ 'link' => $link, diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index dd8cbc99..704cca14 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -26,7 +26,7 @@ trait FilesManagement * * @param string $folder The full path of the directory to check */ - public static function createFolder($folder): void + public static function createFolder(string $folder): void { try { if (!\is_dir($folder)) { @@ -84,7 +84,7 @@ public static function recurseCopy($src, $dst): void * * @uses \Xmf\Module\Helper::getHelper() */ - public static function deleteDirectory($src): bool + public static function deleteDirectory(string $src): bool { // Only continue if user is a 'global' Admin if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { @@ -129,7 +129,7 @@ public static function deleteDirectory($src): bool * * @return bool true on success */ - public static function rrmdir($src): bool + public static function rrmdir(string $src): bool { // Only continue if user is a 'global' Admin if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { @@ -169,7 +169,7 @@ public static function rrmdir($src): bool * * @return bool true on success */ - public static function rmove($src, $dest): bool + public static function rmove(string $src, string $dest): bool { // Only continue if user is a 'global' Admin if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { @@ -212,7 +212,7 @@ public static function rmove($src, $dest): bool * * @uses \Xmf\Module\Helper::getHelper() */ - public static function rcopy($src, $dest): bool + public static function rcopy(string $src, string $dest): bool { // Only continue if user is a 'global' Admin if (!($GLOBALS['xoopsUser'] instanceof \XoopsUser) || !$GLOBALS['xoopsUser']->isAdmin()) { diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index f76b521d..a6da0ffe 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -67,7 +67,7 @@ private function changePrefix(): void * @param string $tableName table to convert * @param string $columnName column with IP address */ - private function convertIPAddresses($tableName, $columnName): void + private function convertIPAddresses(string $tableName, string $columnName): void { // if ($this->tableHandler->useTable($tableName)) { // $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 40858abd..7c2b0e54 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -100,7 +100,7 @@ public static function selectSorting($text, $form_sort): string public static function blockAddCatSelect(array $cats): string { $cat_sql = ''; - if (\is_array($cats) && !empty($cats)) { + if (!empty($cats)) { $cat_sql = '(' . \current($cats); \array_shift($cats); foreach ($cats as $cat) { @@ -212,11 +212,11 @@ public static function cloneRecord(string $tableName, string $idField, int $id) * @TODO: Refactor to consider HTML5 & void (self-closing) elements * @TODO: Consider using https://github.com/jlgrall/truncateHTML/blob/master/truncateHTML.php * - * @param string $text String to truncate. - * @param int $length Length of returned string, including ellipsis. - * @param string $ending Ending to be appended to the trimmed string. - * @param bool $exact If false, $text will not be cut mid-word - * @param bool $considerHtml If true, HTML tags would be handled correctly + * @param string $text String to truncate. + * @param int|null $length Length of returned string, including ellipsis. + * @param string|null $ending Ending to be appended to the trimmed string. + * @param bool $exact If false, $text will not be cut mid-word + * @param bool $considerHtml If true, HTML tags would be handled correctly * * @return string Trimmed string. */ @@ -320,8 +320,8 @@ public static function truncateHtml( /** * Get correct text editor based on user rights * - * @param \Xmf\Module\Helper $helper - * @param array|null $options + * @param \Xmf\Module\Helper|null $helper + * @param array|null $options * * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor */ diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index e3eb3a36..66b0d7bf 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -34,6 +34,10 @@ class TestdataButtons { //functions for import buttons + /** + * @param $adminObject + * @return void + */ public static function loadButtonConfig($adminObject): void { $moduleDirName = \basename(\dirname(__DIR__, 2)); diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index a393e11b..e1d3054f 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -26,10 +26,10 @@ trait VersionChecks * @static * @param \XoopsModule|null $module * - * @param null|string $requiredVer + * @param string|null $requiredVer * @return bool true if meets requirements, false if not */ - public static function checkVerXoops(\XoopsModule $module = null, $requiredVer = null): bool + public static function checkVerXoops(\XoopsModule $module = null, string $requiredVer = null): bool { $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); @@ -98,7 +98,7 @@ public static function checkVerPhp(\XoopsModule $module = null): bool * @return string|array info about the latest module version, if newer */ - public static function checkVerModule($helper, $source = 'github', $default = 'master') + public static function checkVerModule(\Xmf\Module\Helper $helper, ?string $source = 'github', ?string $default = 'master') { $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 4e18f472..99298975 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -39,18 +39,18 @@ class FeedHandler public $miscHandler; public $channelreq; public $subHandler; - public $plugin_obj; + public $pluginObject; public $myts; public $modConfig; public $xoopsConfig; public $cached = ''; public $charset = _CHARSET; public $feedkey = 'feed'; - public $plugin_file = '%s.php'; - public $substr_remove = [',', '/', ';', ':', '(', '{', '[', ' ']; - public $substr_add = ['.', '!', '?', '}', ']', ')', '%']; - public $substr_endwith = '...'; - public $spec_url = 'http://blogs.law.harvard.edu/tech/rss'; + public $pluginFile = '%s.php'; + public $substrRemove = [',', '/', ';', ':', '(', '{', '[', ' ']; + public $substrAdd = ['.', '!', '?', '}', ']', ')', '%']; + public $substrEndwith = '...'; + public $specUrl = 'http://blogs.law.harvard.edu/tech/rss'; public $specs = [ 'req' => 'requiredChannelElements', 'opt' => 'optionalChannelElements', @@ -128,14 +128,14 @@ public function getChannel(&$feed): void } } if (!empty($feed['plugin'])) { - if (\is_object($this->plugin_obj) && \is_object($this->subHandler)) { - $channel['title'] = $this->plugin_obj->getVar('sub_title', 'n'); - $channel['link'] = $this->plugin_obj->getVar('sub_link', 'n'); - $channel['description'] = $this->plugin_obj->getVar('sub_desc', 'n'); + if (\is_object($this->pluginObject) && \is_object($this->subHandler)) { + $channel['title'] = $this->pluginObject->getVar('sub_title', 'n'); + $channel['link'] = $this->pluginObject->getVar('sub_link', 'n'); + $channel['description'] = $this->pluginObject->getVar('sub_desc', 'n'); $image = [ - 'url' => $this->plugin_obj->getVar('img_url', 'n'), - 'title' => $this->plugin_obj->getVar('img_title', 'n'), - 'link' => $this->plugin_obj->getVar('img_link', 'n'), + 'url' => $this->pluginObject->getVar('img_url', 'n'), + 'title' => $this->pluginObject->getVar('img_title', 'n'), + 'link' => $this->pluginObject->getVar('img_link', 'n'), ]; } } else { @@ -179,11 +179,11 @@ public function getSticky(&$feed): bool return false; } if ((\in_array(-1, $setting['feeds']) && empty($feed['plugin'])) - || (!empty($feed['plugin']) && \in_array($this->plugin_obj->getVar('rssf_conf_id'), $setting['feeds']))) { + || (!empty($feed['plugin']) && \in_array($this->pluginObject->getVar('rssf_conf_id'), $setting['feeds']))) { $feed['sticky']['title'] = $sticky->getVar('misc_title', 'n'); $feed['sticky']['link'] = $setting['link']; - $sticky->setDoHtml($setting['dohtml']); - $sticky->setDoBr($setting['dobr']); + $sticky->setDoHtml((bool)$setting['dohtml']); + $sticky->setDoBr((bool)$setting['dobr']); $feed['sticky']['description'] = $sticky->getVar('misc_content'); $this->cleanupChars($feed['sticky']['title']); $this->cleanupChars($feed['sticky']['link']); @@ -201,22 +201,23 @@ public function getSticky(&$feed): bool public function getItems(&$feed): void { $entries = []; + $db = \XoopsDatabaseFactory::getDatabaseConnection(); if (!empty($feed['plugin'])) { - $this->plugin_obj->setVar('rssf_grab', $this->plugin_obj->getVar('sub_entries')); - $this->subHandler->grab = $this->plugin_obj->getVar('sub_entries'); - $grab = $this->subHandler->grabEntries($this->plugin_obj); - if (false !== $grab && \count($grab) > 0) { + $this->pluginObject->setVar('rssf_grab', $this->pluginObject->getVar('sub_entries')); + $this->subHandler->grab = $this->pluginObject->getVar('sub_entries'); + $grab = $this->subHandler->grabEntries($db); + if (null !== $grab && \count($grab) > 0) { foreach ($grab as $g) { $entries[] = $g; } } - } elseif ($plugins = $this->pluginHandler->getObjects2(new \Criteria('rssf_activated', 1))) { + } elseif ($plugins = $this->pluginHandler->getObjects2(new \Criteria('rssf_activated', '1'))) { foreach ($plugins as $p) { $handler = $this->pluginHandler->checkPlugin($p); if ($handler) { $handler->grab = $p->getVar('rssf_grab'); - $grab = $handler->grabEntries($p); - if (false !== $grab && \count($grab) > 0) { + $grab = $handler->grabEntries($db); + if (null !== $grab && \count($grab) > 0) { foreach ($grab as $g) { $entries[] = $g; } @@ -228,14 +229,14 @@ public function getItems(&$feed): void for ($i = 0, $iMax = count($entries); $i < $iMax; $i++) { $this->cleanupChars($entries[$i]['title']); $strip = $this->modConfig['strip_html'] ? true : false; - $this->cleanupChars($entries[$i]['description'], $strip, 0, 1); + $this->cleanupChars($entries[$i]['description'], $strip, false, true); $this->wrapCdata($entries[$i]['description']); $entries[$i]['category'] = $this->myts->undoHtmlSpecialChars($entries[$i]['category']); $this->cleanupChars($entries[$i]['category']); if (!isset($entries[$i]['timestamp'])) { $entries[$i]['timestamp'] = $this->rssmod->getVar('last_update'); } - $entries[$i]['pubdate'] = $this->rssTimeStamp($entries[$i]['timestamp']); + $entries[$i]['pubdate'] = $this->rssTimeStamp((int)$entries[$i]['timestamp']); } if (empty($feed['plugin']) && 'd' === $this->modConfig['sort']) { uasort($entries, [$this, 'sortTimestamp']); @@ -263,17 +264,17 @@ public function doSubstr($text): string $ret = $this->substrDetect($text, 0, mb_strpos($text, ' ')); } } - if (\in_array($this->substrDetect($text, $this->modConfig['max_char'] - 1, 1), $this->substr_add)) { + if (\in_array($this->substrDetect($text, $this->modConfig['max_char'] - 1, 1), $this->substrAdd)) { $ret .= $this->substrDetect($text, $this->modConfig['max_char'] - 1, 1); } else { if (false !== $this->strrposDetect($ret, ' ')) { $ret = $this->substrDetect($ret, 0, $this->strrposDetect($ret, ' ')); } - if (\in_array($this->substrDetect($ret, -1, 1), $this->substr_remove)) { + if (\in_array($this->substrDetect($ret, -1, 1), $this->substrRemove)) { $ret = $this->substrDetect($ret, 0, -1); } } - $ret .= $this->substr_endwith; + $ret .= $this->substrEndwith; } return $ret; @@ -310,9 +311,9 @@ public function strrposDetect($text, $find) /** * @param $time - * @return false|string + * @return string */ - public function rssTimeStamp($time) + public function rssTimeStamp($time): ?string { return \date('D, j M Y H:i:s O', $time); } @@ -337,7 +338,7 @@ public function sortTimestamp($a, $b): int * @param bool $dospec * @param false $dosub */ - public function cleanupChars(&$text, $strip = true, $dospec = true, $dosub = false): void + public function cleanupChars(&$text, bool $strip = true, bool $dospec = true, bool $dosub = false): void { if ($strip) { $text = \strip_tags($text); @@ -365,11 +366,11 @@ public function wrapCdata(&$text): void /** * @param string $fields * @param string $type - * @return bool|array + * @return array */ - public function &getActivatedSubfeeds($fields = '', $type = '') + public function &getActivatedSubfeeds(string $fields = '', string $type = ''): ?array { - $ret = false; + $ret = null; $subs = $this->pluginHandler->getObjects2(new \Criteria('subfeed', '1'), $fields); if (\is_array($subs) && !empty($subs)) { $ret = []; @@ -390,7 +391,7 @@ public function &getActivatedSubfeeds($fields = '', $type = '') /** * @param string $caption - * @param string $selected + * @param null|string|array $selected * @param int $size * @param bool $multi * @param bool $none @@ -399,7 +400,7 @@ public function &getActivatedSubfeeds($fields = '', $type = '') * @param string $type * @return \XoopsFormSelect */ - public function feedSelectBox($caption = '', $selected = '', $size = 1, $multi = true, $none = true, $main = true, $name = 'feeds', $type = 'id'): \XoopsFormSelect + public function feedSelectBox(string $caption = '', $selected = null, int $size = 1, bool $multi = true, bool $none = true, bool $main = true, string $name = 'feeds', string $type = 'id'): \XoopsFormSelect { $select = new \XoopsFormSelect($caption, $name, $selected, $size, $multi); if ($none) { @@ -420,22 +421,22 @@ public function feedSelectBox($caption = '', $selected = '', $size = 1, $multi = /** * @param int $key - * @return false|string + * @return string */ - public function specUrl($key = 0) + public function specUrl(int $key = 0): ?string { if (isset($this->specs[$key])) { - return $this->spec_url . '#' . $this->specs[$key]; + return $this->specUrl . '#' . $this->specs[$key]; } - return false; + return null; } /** * @param string $filename - * @return false|string + * @return string */ - public function subFeedUrl($filename = '') + public function subFeedUrl(string $filename = ''): ?string { if (!empty($filename)) { $filename = \str_replace(['rssfit.', '.php'], '', $filename); @@ -443,7 +444,7 @@ public function subFeedUrl($filename = '') return \RSSFIT_URL_FEED . '?' . $this->feedkey . '=' . $filename; } - return false; + return null; } /** @@ -453,7 +454,7 @@ public function checkSubFeed(&$feed): void { if (!empty($feed['plugin'])) { $criteria = new \CriteriaCompo(); - $criteria->add(new \Criteria('rssf_filename', \sprintf($this->plugin_file, $feed['plugin']))); + $criteria->add(new \Criteria('rssf_filename', \sprintf($this->pluginFile, $feed['plugin']))); $criteria->add(new \Criteria('subfeed', '1')); $sub = $this->pluginHandler->getObjects2($criteria); $handler = false; @@ -461,7 +462,7 @@ public function checkSubFeed(&$feed): void $handler = $this->pluginHandler->checkPlugin($sub[0]); } if ($handler) { - $this->plugin_obj = $sub[0]; + $this->pluginObject = $sub[0]; $this->subHandler = $handler; $this->cached = 'mod_' . $this->rssmod->getVar('dirname') . '|' . \md5(\str_replace(XOOPS_URL, '', $GLOBALS['xoopsRequestUri'])); } else { diff --git a/class/Misc.php b/class/Misc.php index e2988b24..ed5d8644 100644 --- a/class/Misc.php +++ b/class/Misc.php @@ -46,7 +46,7 @@ public function __construct() /** * @param bool $do */ - public function setDoHtml($do = true): void + public function setDoHtml(bool $do = true): void { $this->vars['dohtml']['value'] = $do; } @@ -54,7 +54,7 @@ public function setDoHtml($do = true): void /** * @param bool $do */ - public function setDoBr($do = true): void + public function setDoBr(bool $do = true): void { $this->vars['dobr']['value'] = $do; } diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 785a576d..a1025c6d 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -33,9 +33,9 @@ class MiscHandler extends \XoopsPersistableObjectHandler { public $db; - public $db_table; - public $obj_class = Misc::class; - public $obj_key = 'misc_id'; + public $dbTable; + public $objClass = Misc::class; + public $objKey = 'misc_id'; /** * @var \XoopsModules\Rssfit\Helper */ @@ -57,7 +57,7 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) } $this->db = $db; $table = $db->prefix($helper->getDirname() . '_misc'); - $this->db_table = $table; + $this->dbTable = $table; parent::__construct($db, $table, Misc::class, 'misc_id', 'misc_title'); } @@ -78,9 +78,9 @@ public function getInstance(\XoopsDatabase $db = null): MiscHandler /** * @param bool $isNew - * @return \XoopsModules\Rssfit\MiscHandler + * @return \XoopsObject */ - public function create($isNew = true) + public function create($isNew = true): ?\XoopsObject { $obj = parent::create($isNew); // if ($isNew) { @@ -100,7 +100,7 @@ public function create($isNew = true) */ public function get($id = null, $fields = null) { - $criteria = new \Criteria($this->obj_key, (int)$id); + $criteria = new \Criteria($this->objKey, (int)$id); $objs = $this->getObjects2($criteria); if (\is_array($objs) && !empty($objs)) { return 1 != \count($objs) ? false : $objs[0]; @@ -116,7 +116,7 @@ public function get($id = null, $fields = null) */ public function getCount($criteria = null) { - $sql = 'SELECT COUNT(*) FROM ' . $this->db_table; + $sql = 'SELECT COUNT(*) FROM ' . $this->dbTable; if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); } @@ -130,16 +130,16 @@ public function getCount($criteria = null) /** * @param null|\Criteria|\CriteriaCompo $criteria - * @param string $fields - * @param string $key + * @param string $fields + * @param string $key * @return false|array */ - public function getObjects2($criteria = null, $fields = '*', $key = '') + public function getObjects2($criteria = null, string $fields = '*', string $key = '') { $ret = false; $limit = $start = 0; // $fields = '*'; - $sql = 'SELECT ' . $fields . ' FROM ' . $this->db_table; + $sql = 'SELECT ' . $fields . ' FROM ' . $this->dbTable; if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); if ('' != $criteria->getSort()) { @@ -149,13 +149,13 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') $start = $criteria->getStart(); } if (!\preg_match('/ORDER\ BY/', $sql)) { - $sql .= ' ORDER BY ' . $this->obj_key . ' ASC'; + $sql .= ' ORDER BY ' . $this->objKey . ' ASC'; } $result = $this->db->query($sql, $limit, $start); if ($result instanceof \mysqli_result) { $ret = []; while (false !== ($myrow = $this->db->fetchArray($result))) { - $obj = new $this->obj_class(); + $obj = new $this->objClass(); $obj->assignVars($myrow); switch ($key) { default: @@ -165,7 +165,7 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') $ret[$myrow['misc_title']] = $obj; break; case 'id': - $ret[$myrow[$this->obj_key]] = $obj; + $ret[$myrow[$this->objKey]] = $obj; break; } unset($obj); @@ -182,7 +182,7 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') public function insert(\XoopsObject $obj, $force = false) { // $force = false; - if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->obj_class)) { + if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->objClass)) { return false; } if (!$obj->isDirty()) { @@ -201,17 +201,17 @@ public function insert(\XoopsObject $obj, $force = false) if (\count($obj->getErrors()) > 0) { return false; } - if ($obj->isNew() || empty($cleanvars[$this->obj_key])) { - $cleanvars[$this->obj_key] = $this->db->genId($this->db_table . '_' . $this->obj_key . '_seq'); - $sql = 'INSERT INTO ' . $this->db_table . ' (' . \implode(',', \array_keys($cleanvars)) . ') VALUES (' . \implode(',', $cleanvars) . ')'; + if ($obj->isNew() || empty($cleanvars[$this->objKey])) { + $cleanvars[$this->objKey] = $this->db->genId($this->dbTable . '_' . $this->objKey . '_seq'); + $sql = 'INSERT INTO ' . $this->dbTable . ' (' . \implode(',', \array_keys($cleanvars)) . ') VALUES (' . \implode(',', $cleanvars) . ')'; } else { - unset($cleanvars[$this->obj_key]); - $sql = 'UPDATE ' . $this->db_table . ' SET'; + unset($cleanvars[$this->objKey]); + $sql = 'UPDATE ' . $this->dbTable . ' SET'; foreach ($cleanvars as $k => $v) { $sql .= ' ' . $k . '=' . $v . ','; } $sql = mb_substr($sql, 0, -1); - $sql .= ' WHERE ' . $this->obj_key . ' = ' . $obj->getVar($this->obj_key); + $sql .= ' WHERE ' . $this->objKey . ' = ' . $obj->getVar($this->objKey); } if (false !== $force) { $result = $this->db->queryF($sql); @@ -223,23 +223,23 @@ public function insert(\XoopsObject $obj, $force = false) return false; } - if (false === $obj->getVar($this->obj_key)) { - $obj->assignVar($this->obj_key, $this->db->getInsertId()); + if (false === $obj->getVar($this->objKey)) { + $obj->assignVar($this->objKey, $this->db->getInsertId()); } - return $obj->getVar($this->obj_key); + return $obj->getVar($this->objKey); } /** * @param null|\Criteria|\CriteriaCompo $criteria - * @param array $fields - * @param bool $force + * @param array $fields + * @param bool $force * @return false|string */ - public function modifyObjects($criteria = null, $fields = [], $force = false) + public function modifyObjects($criteria = null, array $fields = [], bool $force) { if ($fields && \is_array($fields)) { - $obj = new $this->obj_class(); + $obj = new $this->objClass(); $sql = ''; foreach ($fields as $k => $v) { $sql .= $k . ' = '; @@ -247,7 +247,7 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) $sql .= ', '; } $sql = mb_substr($sql, 0, -2); - $sql = 'UPDATE ' . $this->db_table . ' SET ' . $sql; + $sql = 'UPDATE ' . $this->dbTable . ' SET ' . $sql; if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); } @@ -269,13 +269,13 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) * @param bool $force * @return bool */ - public function delete(\XoopsObject $obj, $force = false) + public function delete(\XoopsObject $obj, $force = false): bool { // $force = false; - if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->obj_class)) { + if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->objClass)) { return false; } - $sql = 'DELETE FROM ' . $this->db_table . ' WHERE ' . $this->obj_key . '=' . $obj->getVar($this->obj_key); + $sql = 'DELETE FROM ' . $this->dbTable . ' WHERE ' . $this->objKey . '=' . $obj->getVar($this->objKey); if (false !== $force) { $result = $this->db->queryF($sql); } else { diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 05d86dcc..03435f2b 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -33,9 +33,9 @@ class PluginHandler extends \XoopsPersistableObjectHandler { public $db; - public $db_table; - public $obj_class = Plugin::class; - public $obj_key = 'rssf_conf_id'; + public $dbTable; + public $objClass = Plugin::class; + public $objKey = 'rssf_conf_id'; public $sortby = 'rssf_order'; public $order = 'ASC'; /** @@ -58,19 +58,19 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) $db = \XoopsDatabaseFactory::getDatabaseConnection(); } $this->db = $db; - // $this->db_table = $db->prefix($helper->getDirname() . '_plugins'); + // $this->dbTable = $db->prefix($helper->getDirname() . '_plugins'); $table = $db->prefix($helper->getDirname() . '_plugins'); - $this->db_table = $table; + $this->dbTable = $table; parent::__construct($db, $table, Plugin::class, 'rssf_conf_id', 'rssf_filename'); } /** * @param \XoopsDatabase|null $db - * @return \XoopsModules\Rssfit\PluginHandler + * @return \XoopsPersistableObjectHandler */ - public function getInstance(\XoopsDatabase $db = null): PluginHandler + public function getInstance(\XoopsDatabase $db = null): \XoopsPersistableObjectHandler { static $instance; if (null === $instance) { @@ -82,9 +82,9 @@ public function getInstance(\XoopsDatabase $db = null): PluginHandler /** * @param bool $isNew - * @return \XoopsModules\Rssfit\PluginHandler + * @return \XoopsObject */ - public function create($isNew = true) + public function create($isNew = true): ?\XoopsObject { $obj = parent::create($isNew); // if ($isNew) { @@ -105,7 +105,7 @@ public function create($isNew = true) public function get($id = null, $fields = null) { $ret = false; - $criteria = new \Criteria($this->obj_key, (int)$id); + $criteria = new \Criteria($this->objKey, (int)$id); $objs = $this->getObjects2($criteria); if (\is_array($objs) && 1 === \count($objs)) { $ret = &$objs[0]; @@ -121,7 +121,7 @@ public function get($id = null, $fields = null) */ public function insert(\XoopsObject $obj, $force = false) { - if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->obj_class)) { + if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->objClass)) { return false; } if (!$obj->isDirty()) { @@ -140,17 +140,17 @@ public function insert(\XoopsObject $obj, $force = false) if (\count($obj->getErrors()) > 0) { return false; } - if ($obj->isNew() || empty($cleanvars[$this->obj_key])) { - $cleanvars[$this->obj_key] = $this->db->genId($this->db_table . '_' . $this->obj_key . '_seq'); - $sql = 'INSERT INTO ' . $this->db_table . ' (' . \implode(',', \array_keys($cleanvars)) . ') VALUES (' . \implode(',', $cleanvars) . ')'; + if ($obj->isNew() || empty($cleanvars[$this->objKey])) { + $cleanvars[$this->objKey] = $this->db->genId($this->dbTable . '_' . $this->objKey . '_seq'); + $sql = 'INSERT INTO ' . $this->dbTable . ' (' . \implode(',', \array_keys($cleanvars)) . ') VALUES (' . \implode(',', $cleanvars) . ')'; } else { - unset($cleanvars[$this->obj_key]); - $sql = 'UPDATE ' . $this->db_table . ' SET'; + unset($cleanvars[$this->objKey]); + $sql = 'UPDATE ' . $this->dbTable . ' SET'; foreach ($cleanvars as $k => $v) { $sql .= ' ' . $k . '=' . $v . ','; } $sql = mb_substr($sql, 0, -1); - $sql .= ' WHERE ' . $this->obj_key . ' = ' . $obj->getVar($this->obj_key); + $sql .= ' WHERE ' . $this->objKey . ' = ' . $obj->getVar($this->objKey); } if (false !== $force) { $result = $this->db->queryF($sql); @@ -162,12 +162,12 @@ public function insert(\XoopsObject $obj, $force = false) return false; } -// if (false === $obj->getVar($this->obj_key)) { - if (0 === (int)$obj->getVar($this->obj_key)) { - $obj->assignVar($this->obj_key, $this->db->getInsertId()); +// if (false === $obj->getVar($this->objKey)) { + if (0 === (int)$obj->getVar($this->objKey)) { + $obj->assignVar($this->objKey, $this->db->getInsertId()); } - return $obj->getVar($this->obj_key); + return $obj->getVar($this->objKey); } /** @@ -175,12 +175,12 @@ public function insert(\XoopsObject $obj, $force = false) * @param bool $force * @return bool */ - public function delete(\XoopsObject $obj, $force = false) + public function delete(\XoopsObject $obj, $force = false): bool { - if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->obj_class)) { + if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->objClass)) { return false; } - $sql = 'DELETE FROM ' . $this->db_table . ' WHERE ' . $this->obj_key . '=' . $obj->getVar($this->obj_key); + $sql = 'DELETE FROM ' . $this->dbTable . ' WHERE ' . $this->objKey . '=' . $obj->getVar($this->objKey); if (false !== $force) { $result = $this->db->queryF($sql); } else { @@ -195,11 +195,11 @@ public function delete(\XoopsObject $obj, $force = false) /** * @param null|\Criteria|\CriteriaCompo $criteria - * @param string $fields - * @param string $key + * @param string $fields + * @param string $key * @return bool|array */ - public function getObjects2($criteria = null, $fields = '*', $key = '') + public function getObjects2($criteria = null, string $fields = '*', string $key = '') { $ret = false; $limit = $start = 0; @@ -214,7 +214,7 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') $fields = 'rssf_conf_id, rssf_filename, subfeed, sub_title'; break; } - $sql = 'SELECT ' . $fields . ' FROM ' . $this->db_table; + $sql = 'SELECT ' . $fields . ' FROM ' . $this->dbTable; if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); if ('' != $criteria->getSort()) { @@ -230,14 +230,14 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') if ($result instanceof \mysqli_result) { $ret = []; while (false !== ($myrow = $this->db->fetchArray($result))) { - $obj = new $this->obj_class(); + $obj = new $this->objClass(); $obj->assignVars($myrow); switch ($key) { default: $ret[] = &$obj; break; case 'id': - $ret[$myrow[$this->obj_key]] = &$obj; + $ret[$myrow[$this->objKey]] = &$obj; break; } unset($obj); @@ -248,14 +248,14 @@ public function getObjects2($criteria = null, $fields = '*', $key = '') /** * @param null|\Criteria|\CriteriaCompo $criteria - * @param array $fields - * @param bool $force + * @param array $fields + * @param bool $force * @return bool|string */ - public function modifyObjects($criteria = null, $fields = [], $force = false) + public function modifyObjects($criteria = null, array $fields = [], bool $force) { if ($fields && \is_array($fields)) { - $obj = new $this->obj_class(); + $obj = new $this->objClass(); $sql = ''; foreach ($fields as $k => $v) { $sql .= $k . ' = '; @@ -263,7 +263,7 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) $sql .= ', '; } $sql = mb_substr($sql, 0, -2); - $sql = 'UPDATE ' . $this->db_table . ' SET ' . $sql; + $sql = 'UPDATE ' . $this->dbTable . ' SET ' . $sql; if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); } @@ -287,7 +287,7 @@ public function modifyObjects($criteria = null, $fields = [], $force = false) */ public function getCount($criteria = null) { - $sql = 'SELECT COUNT(*) FROM ' . $this->db_table; + $sql = 'SELECT COUNT(*) FROM ' . $this->dbTable; if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); } @@ -305,9 +305,9 @@ public function getCount($criteria = null) * @param string $type * @return bool */ - public function forceDeactivate($obj, $type = 'rssf_activated'): bool + public function forceDeactivate($obj, string $type = 'rssf_activated'): bool { - $criteria = new \Criteria($this->obj_key, $obj->getVar($this->obj_key)); + $criteria = new \Criteria($this->objKey, $obj->getVar($this->objKey)); $fields = ['rssf_activated' => 0, 'subfeed' => 0]; $this->modifyObjects($criteria, $fields, true); @@ -335,7 +335,7 @@ public function &getPluginFileList() * @param \XoopsObject $obj * @return false|mixed */ - public function checkPlugin($obj) + public function checkPlugin(\XoopsObject $obj) { $ret = false; global $moduleHandler; diff --git a/class/PluginInterface.php b/class/PluginInterface.php new file mode 100644 index 00000000..d704f593 --- /dev/null +++ b/class/PluginInterface.php @@ -0,0 +1,22 @@ +getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; + public function loadModule(): ?\XoopsModule{ + + $mod = null; + if (class_exists(PluginHelper::class)) { + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); + $this->modname = $this->module->getVar('name'); + $mod = $this->module; + // $this->dirname = $this->helper->getDirname(); } - $this->modname = $mod->getVar('name'); - //$this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries + return $mod; } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = null; $i = 0; $sql = 'SELECT lid, title, status, desctext, date from ' . $xoopsDB->prefix('adslight_listing') . " WHERE valid = 'Yes' ORDER BY date DESC"; $result = $xoopsDB->query($sql, $this->grab, 0); diff --git a/class/Plugins/Ams.php b/class/Plugins/Ams.php index a4126adb..603e65d7 100644 --- a/class/Plugins/Ams.php +++ b/class/Plugins/Ams.php @@ -32,7 +32,11 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ +use XoopsModules\Rssfit\{ + AbstractPlugin +}; use XoopsModules\Ams\Story; +use XoopsModules\Ams\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); @@ -42,33 +46,17 @@ * Class Ams * @package XoopsModules\Rssfit\Plugins */ -class Ams +class Ams extends AbstractPlugin { public $dirname = 'ams'; - public $modname; - public $grab; /** - * @return false|string + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function loadModule() + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - - return $mod; - } - - /** - * @param \XoopsObject $obj - * @return bool|array - */ - public function grabEntries(&$obj) - { - $ret = false; + $ret = null; // @require_once XOOPS_ROOT_PATH . '/modules/AMS/class/class.newsstory.php'; $myts = \MyTextSanitizer::getInstance(); $ams = Story::getAllPublished($this->grab, 0); diff --git a/class/Plugins/Apcal.php b/class/Plugins/Apcal.php index 5c3aad34..602cc198 100644 --- a/class/Plugins/Apcal.php +++ b/class/Plugins/Apcal.php @@ -31,6 +31,12 @@ * RSSFit version: 1.21 * XOOPS version: 2.0.18.1 */ + +use XoopsModules\Rssfit\{ + AbstractPlugin +}; +use XoopsModules\Apcal\Helper as PluginHelper; + if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -38,35 +44,36 @@ /** * Class Apcal */ -class Apcal +class Apcal extends AbstractPlugin { public $dirname = 'apcal'; - public $modname; - public $grab; + /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; + public function loadModule(): ?\XoopsModule{ + + $mod = null; + if (class_exists(PluginHelper::class)) { + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); + $this->modname = $this->module->getVar('name'); + $mod = $this->module; + // $this->dirname = $this->helper->getDirname(); } - $this->modname = $mod->getVar('name'); return $mod; } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = null; $i = 0; $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' . $xoopsDB->prefix('apcal_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); diff --git a/class/Plugins/Comments.php b/class/Plugins/Comments.php index aea0650e..02d31cce 100644 --- a/class/Plugins/Comments.php +++ b/class/Plugins/Comments.php @@ -35,6 +35,11 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ +use XoopsModules\Rssfit\{ + AbstractPlugin +}; +use XoopsModules\System\Helper as PluginHelper; + if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -43,33 +48,20 @@ * Class Comments * @package XoopsModules\Rssfit\Plugins */ -class Comments +class Comments extends AbstractPlugin { public $dirname = 'system'; public $modname; public $grab; /** - * @return false|string - */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - - return $mod; - } - - /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - $ret = false; + $myts = \MyTextSanitizer::getInstance(); + $ret = null; require XOOPS_ROOT_PATH . '/include/comment_constants.php'; /** @var \XoopsCommentHandler $commentHandler */ $commentHandler = \xoops_getHandler('comment'); diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index 4eff851a..3b8f5b74 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -49,7 +49,10 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -use XoopsModules\Extcal\Helper as ExtcalHelper; +use XoopsModules\Rssfit\{ + AbstractPlugin +}; +use XoopsModules\Extcal\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); @@ -59,37 +62,36 @@ * Class Extcal * @package XoopsModules\Rssfit\Plugins */ -class Extcal +class Extcal extends AbstractPlugin { public $dirname = 'extcal'; - public $modname; - public $grab; - public $module; // optional, see line 74 /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; + public function loadModule(): ?\XoopsModule{ + + $mod = null; + if (class_exists(PluginHelper::class)) { + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); + $this->modname = $this->module->getVar('name'); + $mod = $this->module; + // $this->dirname = $this->helper->getDirname(); } - $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries + return $mod; } + /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = null; $i = 0; @@ -100,8 +102,8 @@ public function grabEntries(&$obj) $extcalConfig = $configHandler->getConfigsByCat(0, $extcal->getVar('mid')); $long_form = $extcalConfig['date_long']; - $eventHandler = ExtcalHelper::getInstance()->getHandler('Event'); - $catHandler = ExtcalHelper::getInstance()->getHandler('Category'); + $eventHandler = PluginHelper::getInstance()->getHandler('Event'); + $catHandler = PluginHelper::getInstance()->getHandler('Category'); $events = $eventHandler->getUpcomingEvent(0, $this->grab, 0); if (\is_array($events)) { diff --git a/class/Plugins/Lexikon.php b/class/Plugins/Lexikon.php index 7dd58911..2b439817 100644 --- a/class/Plugins/Lexikon.php +++ b/class/Plugins/Lexikon.php @@ -31,6 +31,11 @@ * XOOPS verson: 2.0.13.2 / 2.2.3 (!) */ +use XoopsModules\Rssfit\{ + AbstractPlugin +}; +use XoopsModules\Lexikon\Helper as PluginHelper; + if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -38,38 +43,37 @@ /** * Class lexikon */ -class Lexikon extends \XoopsObject +class Lexikon extends AbstractPlugin { public $dirname = 'lexikon'; - public $modname; - public $module; - public $grab; + /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; + public function loadModule(): ?\XoopsModule{ + + $mod = null; + if (class_exists(PluginHelper::class)) { + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); + $this->modname = $this->module->getVar('name'); + $mod = $this->module; + // $this->dirname = $this->helper->getDirname(); } - $this->modname = $mod->getVar('name'); - $this->module = $mod; return $mod; } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); //$permiscHandler = xoops_getHandler('groupperm'); - $ret = false; + $ret = null; $i = 0; $sql = 'SELECT entryID, categoryID, term, definition, datesub FROM ' . $xoopsDB->prefix('lxentries') . ' WHERE submit = 0 AND offline = 0 ORDER BY datesub DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); diff --git a/class/Plugins/Myalbum.php b/class/Plugins/Myalbum.php index e47068d0..a180c86e 100644 --- a/class/Plugins/Myalbum.php +++ b/class/Plugins/Myalbum.php @@ -49,6 +49,11 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ +use XoopsModules\Rssfit\{ + AbstractPlugin +}; +use XoopsModules\Myalbum\Helper as PluginHelper; + if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -57,27 +62,9 @@ * Class Myalbum * @package XoopsModules\Rssfit\Plugins */ -class Myalbum +class Myalbum extends AbstractPlugin { public $dirname = 'myalbum'; - public $modname; - public $grab; - public $module; // optional, see line 74 - - /** - * @return false|string - */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries - return $mod; - } /** * @param $uid @@ -109,14 +96,13 @@ public function myGetUnameFromId($uid): string } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = null; $i = 0; // For myalbum-p with thumbs enabled diff --git a/class/Plugins/Mylinks.php b/class/Plugins/Mylinks.php index 493903ce..f3ffebc3 100644 --- a/class/Plugins/Mylinks.php +++ b/class/Plugins/Mylinks.php @@ -32,6 +32,11 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ +use XoopsModules\Rssfit\{ + AbstractPlugin +}; +use XoopsModules\Mylinks\Helper as PluginHelper; + if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -40,35 +45,35 @@ * Class Mylinks * @package XoopsModules\Rssfit\Plugins */ -class Mylinks +class Mylinks extends AbstractPlugin { public $dirname = 'mylinks'; - public $modname; - public $grab; /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; + public function loadModule(): ?\XoopsModule{ + + $mod = null; + if (class_exists(PluginHelper::class)) { + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); + $this->modname = $this->module->getVar('name'); + $mod = $this->module; + // $this->dirname = $this->helper->getDirname(); } - $this->modname = $mod->getVar('name'); return $mod; } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = null; $i = 0; $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); diff --git a/class/Plugins/Newbb.php b/class/Plugins/Newbb.php index c34063fb..452942d9 100644 --- a/class/Plugins/Newbb.php +++ b/class/Plugins/Newbb.php @@ -32,6 +32,11 @@ * XOOPS version: 2.0.13.2 */ +use XoopsModules\Rssfit\{ + AbstractPlugin +}; +use XoopsModules\Newbb\Helper as PluginHelper; + if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -40,39 +45,36 @@ * Class Newbb * @package XoopsModules\Rssfit\Plugins */ -class Newbb +class Newbb extends AbstractPlugin { public $dirname = 'newbb'; - public $modname; - public $grab; /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - if ($mod->getVar('version') >= 200) { - return false; + public function loadModule(): ?\XoopsModule{ + + $mod = null; + if (class_exists(PluginHelper::class)) { + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); + $this->modname = $this->module->getVar('name'); + $mod = $this->module; + // $this->dirname = $this->helper->getDirname(); } return $mod; } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; require_once XOOPS_ROOT_PATH . '/modules/' . $this->dirname . '/class/class.forumposts.php'; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = null; $i = 0; $sql = 'SELECT p.post_id, p.subject, p.post_time, p.forum_id, p.topic_id, p.nohtml, p.nosmiley, f.forum_name, t.post_text FROM ' . $xoopsDB->prefix('bb_posts') diff --git a/class/Plugins/News.php b/class/Plugins/News.php index 1d456d71..dd367dbf 100644 --- a/class/Plugins/News.php +++ b/class/Plugins/News.php @@ -32,8 +32,12 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ +use XoopsModules\Rssfit\{ + AbstractPlugin +}; use XoopsModules\News\NewsStory; use XoopsModules\News\Utility; +use XoopsModules\News\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); @@ -43,35 +47,17 @@ * Class News * @package XoopsModules\Rssfit\Plugins */ -class News +class News extends AbstractPlugin { public $dirname = 'news'; - public $modname; - public $grab; - public $module; /** - * @return false|string + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function loadModule() + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; - - return $mod; - } - - /** - * @param \XoopsObject $obj - * @return bool|array - */ - public function grabEntries(&$obj) - { - $ret = false; + $ret = null; // @require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; $myts = \MyTextSanitizer::getInstance(); if ($this->module->getVar('version') >= 130) { diff --git a/class/Plugins/Oledrion.php b/class/Plugins/Oledrion.php index f8416e00..eeb4bf21 100644 --- a/class/Plugins/Oledrion.php +++ b/class/Plugins/Oledrion.php @@ -22,8 +22,11 @@ * @author XOOPS Development Team */ +use XoopsModules\Rssfit\{ + AbstractPlugin +}; use XoopsModules\Oledrion\Parameters; -use XoopsModules\Oledrion\Helper as OledrionHelper; +use XoopsModules\Oledrion\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); @@ -33,35 +36,38 @@ * Class Oledrion * @package XoopsModules\Rssfit\Plugins */ -class Oledrion +class Oledrion extends AbstractPlugin { public $dirname = 'oledrion'; - public $modname; - public $grab; + /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; + public function loadModule(): ?\XoopsModule{ + + $mod = null; + if (class_exists(PluginHelper::class)) { + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); + $this->modname = $this->module->getVar('name'); + $mod = $this->module; + // $this->dirname = $this->helper->getDirname(); } - $this->modname = $mod->getVar('name'); return $mod; } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - $ret = false; + $myts = \MyTextSanitizer::getInstance(); + $ret = null; require_once XOOPS_ROOT_PATH . '/modules/oledrion/include/common.php'; - $helper = OledrionHelper::getInstance(); + $helper = PluginHelper::getInstance(); $productsHandler = $helper->getHandler('Products'); $items = $productsHandler->getRecentProducts(new Parameters(['start' => 0, 'limit' => $this->grab])); $i = 0; diff --git a/class/Plugins/Pical.php b/class/Plugins/Pical.php index 063938e4..a8f27610 100644 --- a/class/Plugins/Pical.php +++ b/class/Plugins/Pical.php @@ -31,6 +31,12 @@ * RSSFit version: 1.21 * XOOPS version: 2.0.18.1 */ + +use XoopsModules\Rssfit\{ + AbstractPlugin +}; +use XoopsModules\Pical\Helper as PluginHelper; + if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -38,35 +44,18 @@ /** * Class Pical */ -class Pical +class Pical extends AbstractPlugin { public $dirname = 'piCal'; - public $modname; - public $grab; - - /** - * @return false|string - */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - - return $mod; - } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = null; $i = 0; $sql = 'SELECT id, uid, summary, location, description, categories, start, end, UNIX_TIMESTAMP(dtstamp) as dtstamp FROM ' . $xoopsDB->prefix('pical_event') . ' WHERE admission>0 AND (rrule_pid=0 OR rrule_pid=id) ORDER BY dtstamp DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); diff --git a/class/Plugins/Publisher.php b/class/Plugins/Publisher.php deleted file mode 100644 index e06edcc7..00000000 --- a/class/Plugins/Publisher.php +++ /dev/null @@ -1,94 +0,0 @@ - - * @author XOOPS Development Team - */ - -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: SmartSection -* Version: 1.0.4 Beta 2 / 1.1 Beta 1 / 1.05 Beta 1 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -use XoopsModules\Publisher\Helper as PublisherHelper; - -if (!\defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -/** - * Class Publisher - * @package XoopsModules\Rssfit\Plugins - */ -class Publisher -{ - public $dirname = 'publisher'; - public $modname; - public $grab; - - /** - * @return false|string - */ - public function loadModule() - { - // $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - - $helper = PublisherHelper::getInstance(); - $mod = $helper->getModule(); - - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - - return $mod; - } - - /** - * @param \XoopsObject $obj - * @return bool|array - */ - public function grabEntries(&$obj) - { - $ret = false; - require_once XOOPS_ROOT_PATH . '/modules/publisher/include/common.php'; - $helper = PublisherHelper::getInstance(); - $publisherItemiscHandler = $helper->getHandler('Item'); - $items = $publisherItemiscHandler->getAllPublished($this->grab, 0); - if (false !== $items && \count($items) > 0) { - $ret = []; - for ($i = 0, $iMax = \count($items); $i < $iMax; ++$i) { - $ret[$i]['link'] = $ret[$i]['guid'] = $items[$i]->getItemUrl(); - $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); - $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); - $ret[$i]['description'] = $items[$i]->getVar('summary'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - } - } - - return $ret; - } -} diff --git a/class/Plugins/Sample.php b/class/Plugins/Sample.php index 2fefbd9b..bd29ee98 100644 --- a/class/Plugins/Sample.php +++ b/class/Plugins/Sample.php @@ -49,6 +49,12 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ +use XoopsModules\Rssfit\{ + AbstractPlugin +}; + +use XoopsModules\Sample\Helper as PluginHelper; + if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -57,37 +63,18 @@ * Class Sample * @package XoopsModules\Rssfit\Plugins */ -class Sample +class Sample extends AbstractPlugin { public $dirname = 'sample'; - public $modname; - public $grab; - public $module; // optional, see line 71 - - /** - * @return false|string - */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries - return $mod; - } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = null; $i = 0; // The following example code grabs the latest entries from the module MyLinks $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status > 0 AND l.lid = t.lid ORDER BY date DESC'; diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php index d7966dfc..7c036ba6 100644 --- a/class/Plugins/Smartfaq.php +++ b/class/Plugins/Smartfaq.php @@ -32,7 +32,10 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -use XoopsModules\Smartfaq\Helper as SmartfaqHelper; +use XoopsModules\Rssfit\{ + AbstractPlugin +}; +use XoopsModules\Smartfaq\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); @@ -42,42 +45,46 @@ * Class Smartfaq * @package XoopsModules\Rssfit\Plugins */ -class Smartfaq +class Smartfaq extends AbstractPlugin { public $dirname = 'smartfaq'; - public $modname; - public $grab; + /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; + public function loadModule(): ?\XoopsModule{ + + $mod = null; + if (class_exists(PluginHelper::class)) { + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); + $this->modname = $this->module->getVar('name'); + $mod = $this->module; + // $this->dirname = $this->helper->getDirname(); } - $this->modname = $mod->getVar('name'); return $mod; } + /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - $ret = false; + $myts = \MyTextSanitizer::getInstance(); + $ret = null; // @require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; /** @var \XoopsModules\Smartfaq\FaqHandler $faqHandler */ - $faqHandler = SmartfaqHelper::getInstance()->getHandler('Faq'); + $faqHandler = PluginHelper::getInstance()->getHandler('Faq'); $faqs = $faqHandler->getAllPublished($this->grab, 0); if (false !== $faqs && \count($faqs) > 0) { $ret = []; /** @var \XoopsModules\Smartfaq\AnswerHandler $answerHandler */ - $answerHandler = SmartfaqHelper::getInstance()->getHandler('Answer'); + $answerHandler = PluginHelper::getInstance()->getHandler('Answer'); for ($i = 0, $iMax = \count($faqs); $i < $iMax; ++$i) { if (!$answer = $answerHandler->getOfficialAnswer($faqs[$i]->faqid())) { continue; diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php index e74c0a49..a9ea817d 100644 --- a/class/Plugins/Smartpartner.php +++ b/class/Plugins/Smartpartner.php @@ -33,12 +33,15 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ +use XoopsModules\Rssfit\{ + AbstractPlugin +}; use XoopsModules\Smartpartner\{ + PartnerHandler, Constants, - Helper as SmartpartnerHelper + Helper as PluginHelper }; - if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -47,36 +50,40 @@ * Class Smartpartner * @package XoopsModules\Rssfit\Plugins */ -class Smartpartner +class Smartpartner extends AbstractPlugin { public $dirname = 'smartpartner'; - public $modname; - public $grab; + /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; + public function loadModule(): ?\XoopsModule{ + + $mod = null; + if (class_exists(PluginHelper::class)) { + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); + $this->modname = $this->module->getVar('name'); + $mod = $this->module; + // $this->dirname = $this->helper->getDirname(); } - $this->modname = $mod->getVar('name'); return $mod; } + /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - $ret = false; + $myts = \MyTextSanitizer::getInstance(); + $ret = null; require_once XOOPS_ROOT_PATH . '/modules/smartpartner/include/common.php'; - /** @var \XoopsModules\Smartpartner\PartnerHandler $partnerHandler */ - $partnerHandler = SmartpartnerHelper::getInstance()->getHandler('Partner'); + /** @var PartnerHandler $partnerHandler */ + $partnerHandler = PluginHelper::getInstance()->getHandler('Partner'); $partners = $partnerHandler->getPartners($this->grab, 0, Constants::SPARTNER_STATUS_ACTIVE, 'weight', 'DESC'); if (false !== $partners && \count($partners) > 0) { $ret = []; diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php index 49661bba..80e26052 100644 --- a/class/Plugins/Surnames.php +++ b/class/Plugins/Surnames.php @@ -31,6 +31,12 @@ * RSSFit verision: 1.3 * XOOPS version: 2.5.9 */ + +use XoopsModules\Rssfit\{ + AbstractPlugin +}; +use XoopsModules\Surnames\Helper as PluginHelper; + if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -39,27 +45,9 @@ * Class Surnames * @package XoopsModules\Rssfit\Plugins */ -class Surnames +class Surnames extends AbstractPlugin { public $dirname = 'surnames'; - public $modname; - public $grab; - public $module; - - /** - * @return false|string - */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing - // to do with module info when grabbing entries - return $mod; - } /** * @param $uid @@ -90,14 +78,13 @@ public function myGetUnameFromId($uid): string } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = null; $i = -1; $lasttime = false; diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php deleted file mode 100644 index b9b9934f..00000000 --- a/class/Plugins/Wfdownloads.php +++ /dev/null @@ -1,98 +0,0 @@ - - * @author XOOPS Development Team - */ - -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: WF-Downloads -* Version: 2.0.5a -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -if (!\defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -/** - * Class Wfdownloads - * @package XoopsModules\Rssfit\Plugins - */ -class Wfdownloads extends \XoopsObject -{ - public $dirname = 'wfdownloads'; - public $modname; - public $module; - public $grab; - - /** - * @return false|string - */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - $this->module = $mod; - - return $mod; - } - - /** - * @param \XoopsObject $obj - * @return bool|array - */ - public function grabEntries(&$obj) - { - global $xoopsDB; - $myts = \MyTextSanitizer::getInstance(); - /** @var \XoopsGroupPermHandler $grouppermHandler */ - $grouppermHandler = xoops_getHandler('groupperm'); - $ret = false; - $i = 0; - $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; - $result = $xoopsDB->query($sql, $this->grab, 0); - if ($result instanceof \mysqli_result) { - $ret = []; - /** @var \XoopsMemberHandler $memberHandler */ - $memberHandler = xoops_getHandler('member'); - while (false !== ($row = $xoopsDB->fetchArray($result))) { - if ($grouppermHandler->checkRight('WFDownFilePerm', $row['lid'], \is_object($GLOBALS['xoopsUser']) ? $memberHandler->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { - $ret[$i]['title'] = $row['title']; - $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; - $ret[$i]['link'] = $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $myts->displayTarea($row['description']); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - $i++; - } - } - } - return $ret; - } -} diff --git a/class/Plugins/Wflinks.php b/class/Plugins/Wflinks.php index de2a1d6b..c2d0bc42 100644 --- a/class/Plugins/Wflinks.php +++ b/class/Plugins/Wflinks.php @@ -36,6 +36,11 @@ * Version : 1.03 */ +use XoopsModules\Rssfit\{ + AbstractPlugin +}; +use XoopsModules\Wflinks\Helper as PluginHelper; + if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -43,41 +48,23 @@ /** * Class Wflinks */ -class Wflinks +class Wflinks extends AbstractPlugin { public $dirname = 'wflinks'; - public $modname; - public $mid; - public $grab; - - /** - * @return false|\XoopsModule - */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; - } - $this->modname = $mod->getVar('name'); - - return $mod; - } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB, $xoopsUser; + global $xoopsUser; $groups = \is_object($xoopsUser) ? $xoopsUser->getGroups() : XOOPS_GROUP_ANONYMOUS; /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = \xoops_getHandler('groupperm'); - $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = null; $i = 0; $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wflinks_links') . ' WHERE status>0 ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); diff --git a/class/Plugins/Xoopstube.php b/class/Plugins/Xoopstube.php index 1c17b5dd..36da5dc2 100644 --- a/class/Plugins/Xoopstube.php +++ b/class/Plugins/Xoopstube.php @@ -31,6 +31,12 @@ * RSSFit version: 1.21 * XOOPS version: 2.0.18.1 */ + +use XoopsModules\Rssfit\{ + AbstractPlugin +}; +use XoopsModules\Xoopstube\Helper as PluginHelper; + if (!\defined('RSSFIT_ROOT_PATH')) { exit(); } @@ -38,35 +44,30 @@ /** * Class Xoopstube */ -class Xoopstube +class Xoopstube extends AbstractPlugin { - public $dirname = 'xoopstube'; - public $modname; - public $grab; - /** - * @return false|string + * @var string */ - public function loadModule() + public $dirname = 'xoopstube'; + + public function initialize(): void { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive')) { - return false; + if (class_exists(PluginHelper::class)) { + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); + // $this->dirname = $this->helper->getDirname(); } - $this->modname = $mod->getVar('name'); - - return $mod; } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = null; $i = 0; $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; diff --git a/class/Utility.php b/class/Utility.php index cfdc1977..8982ad1a 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -40,11 +40,11 @@ class Utility extends Common\SysUtility //--------------- Custom module methods ----------------------------- /** - * @param $a - * @param $b + * @param array $a + * @param array $b * @return int */ - public static function sortTimestamp($a, $b): int + public static function sortTimestamp(array $a, array $b): int { if ($a['timestamp'] == $b['timestamp']) { return 0; @@ -54,17 +54,17 @@ public static function sortTimestamp($a, $b): int } /** - * @param $spec - * @param $feedHandler + * @param int $spec + * @param \XoopsModules\Rssfit\FeedHandler $feedHandler * @return string */ - public static function genSpecMoreInfo($spec, $feedHandler): string + public static function genSpecMoreInfo(int $spec, FeedHandler $feedHandler): string { return static::rssfGenAnchor($feedHandler->specUrl($spec), \_AM_RSSFIT_EDIT_CHANNEL_QMARK, 'spec', \_AM_RSSFIT_EDIT_CHANNEL_MOREINFO); } /** - * @param string $url + * @param null|string $url * @param string $text * @param string $target * @param string $title @@ -72,9 +72,9 @@ public static function genSpecMoreInfo($spec, $feedHandler): string * @param string $id * @return string */ - public static function rssfGenAnchor($url = '', $text = '', $target = '', $title = '', $class = '', $id = ''): string + public static function rssfGenAnchor(string $url = null, string $text = '', string $target = '', string $title = '', string $class = '', string $id = ''): string { - if (!empty($url)) { + if (null !== $url) { $ret = ' 0 display at most $max_words words */ - public static function get_rss_feed_as_html($feed_url, $max_item_cnt = 10, $show_date = true, $show_description = true, $max_words = 0, $cache_timeout = 7200, $cache_prefix = XOOPS_VAR_PATH . '/caches/xoops_cache/rss2html-'): string + /** + * @param string $feed_url + * @param int $maxItemCount + * @param bool $show_date + * @param bool $show_description + * @param int $max_words + * @param int $cache_timeout + * @param string $cache_prefix + * @return string + */ + public static function getRssFeedAsHtml(string $feed_url, int $maxItemCount = 10, bool $show_date = true, bool $show_description = true, int $max_words = 0, int $cache_timeout = 7200, string $cache_prefix = XOOPS_VAR_PATH . '/caches/xoops_cache/rss2html-'): string { $result = ''; // get feeds and parse items $rss = new \DOMDocument(); - $cache_file = $cache_prefix . \md5($feed_url); + $cacheFile = $cache_prefix . \md5($feed_url); // load from file or load content if ($cache_timeout > 0 - && \is_file($cache_file) - && (\filemtime($cache_file) + $cache_timeout > \time())) { - $rss->load($cache_file); + && \is_file($cacheFile) + && (\filemtime($cacheFile) + $cache_timeout > \time())) { + $rss->load($cacheFile); } else { $rss->load($feed_url); /* @@ -118,55 +128,57 @@ public static function get_rss_feed_as_html($feed_url, $max_item_cnt = 10, $show $rss->loadXML($content); */ if ($cache_timeout > 0) { - $rss->save($cache_file); + $rss->save($cacheFile); } } $feed = []; foreach ($rss->getElementsByTagName('item') as $node) { - $item = [ - 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue, - 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, - 'content' => $node->getElementsByTagName('description')->item(0)->nodeValue, - 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, - 'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue, - ]; - $content = $node->getElementsByTagName('encoded'); // - if ($content->length > 0) { - $item['content'] = $content->item(0)->nodeValue; + if (null !== $node) { + $item = [ + 'title' => $node->getElementsByTagName('title')->item(0)->nodeValue, + 'desc' => $node->getElementsByTagName('description')->item(0)->nodeValue, + 'content' => $node->getElementsByTagName('description')->item(0)->nodeValue, + 'link' => $node->getElementsByTagName('link')->item(0)->nodeValue, + 'date' => $node->getElementsByTagName('pubDate')->item(0)->nodeValue, + ]; + $content = $node->getElementsByTagName('encoded'); // + if ($content->length > 0) { + $item['content'] = $content->item(0)->nodeValue; + } + $feed[] = $item; } - $feed[] = $item; } // real good count - if ($max_item_cnt > \count($feed)) { - $max_item_cnt = \count($feed); + if ($maxItemCount > \count($feed)) { + $maxItemCount = \count($feed); } $result .= '
        '; - for ($x = 0; $x < $max_item_cnt; $x++) { + for ($x = 0; $x < $maxItemCount; $x++) { $title = \str_replace(' & ', ' & ', $feed[$x]['title']); $link = $feed[$x]['link']; $result .= '
      • '; $result .= ''; if ($show_date) { - $date = \date('l F d, Y', \strtotime($feed[$x]['date'])); + $date = \date('l F d, Y', (int)\strtotime($feed[$x]['date'])); $result .= 'Posted on ' . $date . ''; } if ($show_description) { $description = $feed[$x]['desc']; $content = $feed[$x]['content']; // find the img - $has_image = \preg_match('/.+?)[\'"].*>/i', $content, $image); + $hasImage = \preg_match('/.+?)[\'"].*>/i', $content, $image); // no html tags - $description = \strip_tags(\preg_replace('/(<(script|style)\b[^>]*>).*?(<\/\2>)/s', '$1$3', $description), ''); + $description = \strip_tags((string)\preg_replace('/(<(script|style)\b[^>]*>).*?(<\/\2>)/s', '$1$3', $description), ''); // whether cut by number of words if ($max_words > 0) { $arr = \explode(' ', $description); if ($max_words < \count($arr)) { $description = ''; - $w_cnt = 0; + $wordsCount = 0; foreach ($arr as $w) { $description .= $w . ' '; - ++$w_cnt; - if ($w_cnt == $max_words) { + ++$wordsCount; + if ($wordsCount == $max_words) { break; } } @@ -174,7 +186,7 @@ public static function get_rss_feed_as_html($feed_url, $max_item_cnt = 10, $show } } // add img if it exists - if (1 == $has_image) { + if (1 == $hasImage) { $description = '' . $description; } $result .= '
        ' . $description; @@ -186,8 +198,17 @@ public static function get_rss_feed_as_html($feed_url, $max_item_cnt = 10, $show return $result; } - public static function output_rss_feed($feed_url, $max_item_cnt = 10, $show_date = true, $show_description = true, $max_words = 0): void + /** + * @param string $feed_url + * @param int $maxItemCount + * @param bool $show_date + * @param bool $show_description + * @param int $max_words + * + * @return void + */ + public static function outputRssFeed(string $feed_url, int $maxItemCount = 10, bool $show_date = true, bool $show_description = true, int $max_words = 0): void { - echo self::get_rss_feed_as_html($feed_url, $max_item_cnt, $show_date, $show_description, $max_words); + echo self::getRssFeedAsHtml($feed_url, $maxItemCount, $show_date, $show_description, $max_words); } } diff --git a/docs/changelog.txt b/docs/changelog.txt index d08e732a..b77f49d1 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,5 +1,10 @@
        1.32.0 Beta 2 [NOT RELEASED]

        +- add strict types (mamba) +- add return type declaration (mamba) +- add parameter types (mamba) +- refactoring: added AbstractPlugin & PluginInterface (mamba) +- code cosmetics (mamba)
        1.32.0 Beta 1 [2021-10-14]
        diff --git a/include/common.php b/include/common.php index b30eb12a..92068b97 100644 --- a/include/common.php +++ b/include/common.php @@ -31,10 +31,11 @@ require \dirname(__DIR__) . '/preloads/autoloader.php'; +global $xoopsModuleConfig, $xoopsConfig, $xoopsModule; + $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); -/** @var \XoopsDatabase $db */ $db = \XoopsDatabaseFactory::getDatabaseConnection(); $debug = false; $helper = Helper::getInstance($debug); @@ -87,9 +88,6 @@ $version = !mb_substr($version, -1, 1) ? mb_substr($version, 0, 3) : $version; define('RSSFIT_VERSION', 'RSSFit ' . $version); -global $xoopsModuleConfig, $xoopsConfig, $xoopsModule; - -/** @var FeedHandler $feedHandler */ $feedHandler = new FeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); $myts = $feedHandler->myts; $pluginHandler = $helper->getHandler('Plugin'); diff --git a/include/install.php b/include/install.php index d53199e3..2d5ba187 100644 --- a/include/install.php +++ b/include/install.php @@ -28,7 +28,7 @@ * * @return bool */ -function xoops_module_install_rssfit(\XoopsModule $xoopsMod) +function xoops_module_install_rssfit(\XoopsModule $xoopsMod): bool { global $xoopsDB, $xoopsConfig; @@ -70,7 +70,7 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod) * * @return bool */ -function xoops_module_update_rssfit(\XoopsModule $xoopsMod, $oldversion) +function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $oldversion): bool { global $xoopsDB, $xoopsConfig; $helper = Rssfit\Helper::getInstance(); @@ -116,11 +116,11 @@ function xoops_module_update_rssfit(\XoopsModule $xoopsMod, $oldversion) //} /** - * @param $xoopsMod + * @param \XoopsModule $xoopsMod * * @return string */ -function rssfInsertChannel($xoopsMod) +function rssfInsertChannel(\XoopsModule $xoopsMod): string { global $xoopsDB, $xoopsConfig; $helper = Rssfit\Helper::getInstance(); diff --git a/include/oninstall.php b/include/oninstall.php index f46ecef4..c1eba1f3 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -26,7 +26,7 @@ * * @return bool true if ready to install, false if not */ -function xoops_module_pre_install_rssfit(\XoopsModule $module) +function xoops_module_pre_install_rssfit(\XoopsModule $module): bool { require_once \dirname(__DIR__) . '/preloads/autoloader.php'; $utility = new Utility(); @@ -49,7 +49,7 @@ function xoops_module_pre_install_rssfit(\XoopsModule $module) * * @return bool true if installation successful, false if not */ -function xoops_module_install_rssfit(\XoopsModule $module) +function xoops_module_install_rssfit(\XoopsModule $module): bool { require_once \dirname(__DIR__) . '/preloads/autoloader.php'; require_once \dirname(__DIR__, 3) . '/mainfile.php'; diff --git a/include/onuninstall.php b/include/onuninstall.php index 707df684..bf9dcb12 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -19,7 +19,7 @@ * * @return bool true if ready to uninstall, false if not */ -function xoops_module_pre_uninstall_rssfit(\XoopsModule $module) +function xoops_module_pre_uninstall_rssfit(\XoopsModule $module): bool { // Do some synchronization return true; @@ -31,7 +31,7 @@ function xoops_module_pre_uninstall_rssfit(\XoopsModule $module) * * @return bool true if uninstallation successful, false if not */ -function xoops_module_uninstall_rssfit(\XoopsModule $module) +function xoops_module_uninstall_rssfit(\XoopsModule $module): bool { // return true; diff --git a/include/onupdate.php b/include/onupdate.php index 9bf5a616..1f186b6b 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -31,7 +31,7 @@ * @param null $previousVersion * @return bool true if ready to install, false if not */ -function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVersion = null) +function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVersion = null): bool { $moduleDirName = \basename(\dirname(__DIR__)); /** @var Rssfit\Helper $helper */ @@ -52,7 +52,7 @@ function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVers * * @return bool true if update successful, false if not */ -function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = null) +function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = null): bool { $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); diff --git a/index.php b/index.php index 5873e08c..e2a432e6 100644 --- a/index.php +++ b/index.php @@ -20,17 +20,21 @@ */ $GLOBALS['xoopsOption']['template_main'] = 'rssfit_index.tpl'; +global $xoopsConfig, $xoopsTpl; + require_once __DIR__ . '/header.php'; require_once XOOPS_ROOT_PATH . '/header.php'; +/** @var \XoopsModules\Rssfit\MiscHandler $miscHandler */ $intr = $miscHandler->getObjects2(new \Criteria('misc_category', 'intro')); if ($intr) { $intro = $intr[0]; $setting = $intro->getVar('misc_setting'); - $intro->setDoHtml($setting['dohtml'] ? 1 : 0); - $intro->setDoBr($setting['dobr'] ? 1 : 0); + $intro->setDoHtml($setting['dohtml'] ? true : false); + $intro->setDoBr($setting['dobr'] ? true : false); $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); $content = str_replace(['{SITENAME}', '{SITEURL}'], [$xoopsConfig['sitename'], XOOPS_URL . '/'], $intro->getVar('misc_content')); + /** @var \XoopsModules\Rssfit\PluginHandler $pluginHandler */ if (false !== mb_strpos($content, '{SUB}') && $plugins = $pluginHandler->getObjects2(new \Criteria('subfeed', '1'))) { $sublist = ''; foreach ($plugins as $p) { diff --git a/rssreader.php b/rssreader.php index 697cef86..15d2f117 100644 --- a/rssreader.php +++ b/rssreader.php @@ -16,6 +16,6 @@ $max_words = 200; // output RSS feed to HTML -Utility::output_rss_feed($helper->url('rss.php'), 20, true, true, $max_words); +Utility::outputRssFeed($helper->url('rss.php'), 20, true, true, $max_words); require_once XOOPS_ROOT_PATH . '/footer.php'; diff --git a/testdata/index.php b/testdata/index.php index ec9d5fa7..2ff6585d 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -158,10 +158,10 @@ function exportSchema() * Each element of the outer array represents a single table row. * Each row is an associative array in 'column' => 'value' format. * @param string $search name of column for which the value should be replaced - * @param $replace + * @param string $replace * @return int number of rows inserted */ -function loadTableFromArrayWithReplace($table, $data, $search, $replace) +function loadTableFromArrayWithReplace(string $table, array $data, string $search, string $replace): int { /** @var \XoopsMySQLDatabase $db */ $db = \XoopsDatabaseFactory::getDatabaseConnection(); From 4310e55e90a20b80591dec80c08768ac612c314e Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 05:30:35 -0400 Subject: [PATCH 086/154] rearrange plugins --- admin/about.php | 31 ------ class/Plugins/Publisher.php | 95 ++++++++++++++++ class/Plugins/Wfdownloads.php | 104 ++++++++++++++++++ class/Plugins/Wfsection2.php | 91 --------------- class/Plugins/{ => legacy}/Buyersguide.php | 15 +-- .../{ => legacy}/Buyersguidemanufacturers.php | 15 +-- .../Plugins/{ => legacy}/Buyersguidenews.php | 15 +-- class/Plugins/{ => legacy}/Mydownloads.php | 13 +-- class/Plugins/{ => legacy}/Mytube.php | 15 ++- class/Plugins/{ => legacy}/Queries.php | 15 ++- class/Plugins/{ => legacy}/Rmdp.php | 13 +-- class/Plugins/{ => legacy}/Smartsection.php | 15 +-- class/Plugins/{ => legacy}/Special.php | 15 ++- class/Plugins/{ => legacy}/Weblinks.php | 15 ++- .../{ => legacy}/Wfdownloads_podcast.php | 15 ++- class/Plugins/{ => legacy}/Wfsection.php | 15 ++- include/common0.php | 41 ------- 17 files changed, 285 insertions(+), 253 deletions(-) delete mode 100644 admin/about.php create mode 100644 class/Plugins/Publisher.php create mode 100644 class/Plugins/Wfdownloads.php delete mode 100644 class/Plugins/Wfsection2.php rename class/Plugins/{ => legacy}/Buyersguide.php (89%) rename class/Plugins/{ => legacy}/Buyersguidemanufacturers.php (88%) rename class/Plugins/{ => legacy}/Buyersguidenews.php (88%) rename class/Plugins/{ => legacy}/Mydownloads.php (92%) rename class/Plugins/{ => legacy}/Mytube.php (91%) rename class/Plugins/{ => legacy}/Queries.php (92%) rename class/Plugins/{ => legacy}/Rmdp.php (91%) rename class/Plugins/{ => legacy}/Smartsection.php (89%) rename class/Plugins/{ => legacy}/Special.php (93%) rename class/Plugins/{ => legacy}/Weblinks.php (93%) rename class/Plugins/{ => legacy}/Wfdownloads_podcast.php (93%) rename class/Plugins/{ => legacy}/Wfsection.php (92%) delete mode 100644 include/common0.php diff --git a/admin/about.php b/admin/about.php deleted file mode 100644 index e50ebb59..00000000 --- a/admin/about.php +++ /dev/null @@ -1,31 +0,0 @@ -displayNavigation(basename(__FILE__)); -$adminObject::setPaypal('xoopsfoundation@gmail.com'); -$adminObject->displayAbout(false); - -require __DIR__ . '/admin_footer.php'; diff --git a/class/Plugins/Publisher.php b/class/Plugins/Publisher.php new file mode 100644 index 00000000..4c1c25ee --- /dev/null +++ b/class/Plugins/Publisher.php @@ -0,0 +1,95 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: SmartSection +* Version: 1.0.4 Beta 2 / 1.1 Beta 1 / 1.05 Beta 1 +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +use XoopsModules\Rssfit\{ + AbstractPlugin +}; +use XoopsModules\Publisher\{ + ItemHandler, + Helper as PluginHelper, +}; + +if (!\defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Publisher + */ +final class Publisher extends AbstractPlugin +{ + public $dirname = 'publisher'; + + /** + * @return \XoopsModule + */ + public function loadModule(): ?\XoopsModule{ + + $mod = null; + if (class_exists(PluginHelper::class)) { + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); + $this->modname = $this->module->getVar('name'); + $mod = $this->module; + // $this->dirname = $this->helper->getDirname(); + } + + return $mod; + } + + /** + * @return array + */ + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array + { + $ret = null; + /** @var ItemHandler $itemHandler */ + $itemHandler = $this->helper->getHandler('Item'); + $items = $itemHandler->getAllPublished($this->grab, 0); + if (\count($items) > 0) { + $ret = []; + for ($i = 0, $iMax = \count($items); $i < $iMax; ++$i) { + $ret[$i]['guid'] = $items[$i]->getItemUrl(); + $ret[$i]['link'] = $ret[$i]['guid']; + $ret[$i]['title'] = $items[$i]->getVar('title', 'n'); + $ret[$i]['timestamp'] = $items[$i]->getVar('datesub'); + $ret[$i]['description'] = $items[$i]->getVar('summary'); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + } + } + + return $ret; + } +} diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php new file mode 100644 index 00000000..19215b07 --- /dev/null +++ b/class/Plugins/Wfdownloads.php @@ -0,0 +1,104 @@ + + * @author XOOPS Development Team + */ + +/* +* About this RSSFit plug-in +* Author: tuff +* Requirements (Tested with): +* Module: WF-Downloads +* Version: 2.0.5a +* RSSFit verision: 1.2 / 1.5 +* XOOPS version: 2.0.13.2 / 2.2.3 +*/ + +use XoopsModules\Rssfit\{ + AbstractPlugin +}; +use XoopsModules\Wfdownloads\Helper as PluginHelper; + +if (!\defined('RSSFIT_ROOT_PATH')) { + exit(); +} + +/** + * Class Wfdownloads + * @package XoopsModules\Rssfit\Plugins + */ +class Wfdownloads extends AbstractPlugin +{ + public $dirname = 'wfdownloads'; + + + /** + * @return \XoopsModule + */ + public function loadModule(): ?\XoopsModule{ + + $mod = null; + if (class_exists(PluginHelper::class)) { + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); + $this->modname = $this->module->getVar('name'); + $mod = $this->module; + // $this->dirname = $this->helper->getDirname(); + } + + return $mod; + } + + + /** + * @param \XoopsMySQLDatabase $xoopsDB + * @return array + */ + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + { + $myts = \MyTextSanitizer::getInstance(); + + /** @var \XoopsGroupPermHandler $grouppermHandler */ + $grouppermHandler = xoops_getHandler('groupperm'); + $ret = null; + $i = 0; + $sql = 'SELECT lid, cid, title, date, description FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 ORDER BY date DESC'; + $result = $xoopsDB->query($sql, $this->grab, 0); + if ($result instanceof \mysqli_result) { + $ret = []; + /** @var \XoopsMemberHandler $memberHandler */ + $memberHandler = xoops_getHandler('member'); + while (false !== ($row = $xoopsDB->fetchArray($result))) { + if ($grouppermHandler->checkRight('WFDownFilePerm', $row['lid'], \is_object($GLOBALS['xoopsUser']) ? $memberHandler->getGroupsByUser($GLOBALS['xoopsUser']->getVar('uid')) : XOOPS_GROUP_ANONYMOUS, $this->module->getVar('mid'))) { + $ret[$i]['title'] = $row['title']; + $link = XOOPS_URL . '/modules/' . $this->dirname . '/singlefile.php?cid=' . $row['cid'] . '&lid=' . $row['lid']; + $ret[$i]['link'] = $ret[$i]['guid'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $myts->displayTarea($row['description']); + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $i++; + } + } + } + return $ret; + } +} diff --git a/class/Plugins/Wfsection2.php b/class/Plugins/Wfsection2.php deleted file mode 100644 index 96a378da..00000000 --- a/class/Plugins/Wfsection2.php +++ /dev/null @@ -1,91 +0,0 @@ - - * @author XOOPS Development Team - */ - -/* -* About this RSSFit plug-in -* Author: tuff -* Requirements (Tested with): -* Module: WF-section -* Version: 2.07 b3 -* RSSFit verision: 1.2 / 1.5 -* XOOPS version: 2.0.13.2 / 2.2.3 -*/ - -use XoopsModules\Rssfit; - -if (!\defined('RSSFIT_ROOT_PATH')) { - exit(); -} - -/** - * Class Wfsection2 - * @package XoopsModules\Rssfit\Plugins - */ -class Wfsection2 -{ - public $dirname = 'wfsection'; - public $modname; - public $grab; - - /** - * @return false|string - */ - public function loadModule() - { - $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); - if (!$mod || !$mod->getVar('isactive') || $mod->getVar('version') < 200) { - return false; - } - $this->modname = $mod->getVar('name'); - - return $mod; - } - - /** - * @param \XoopsObject $obj - * @return bool|array - */ - public function grabEntries(&$obj) - { - $ret = false; - $articles = Rssfit\WfsArticle::getAllArticle($this->grab, 0, 'online'); - if (\count($articles) > 0) { - $ret = []; - $xoopsModuleConfig['shortartlen'] = 0; - $myts = \MyTextSanitizer::getInstance(); - for ($i = 0, $iMax = \count($articles); $i < $iMax; ++$i) { - $link = XOOPS_URL . '/modules/wfsection/article.php?articleid=' . $articles[$i]->articleid(); - $ret[$i]['title'] = $myts->undoHtmlSpecialChars($articles[$i]->title()); - $ret[$i]['link'] = $link; - $ret[$i]['guid'] = $link; - $ret[$i]['timestamp'] = $articles[$i]->published(); - $ret[$i]['description'] = $articles[$i]->summary(); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; - } - } - - return $ret; - } -} diff --git a/class/Plugins/Buyersguide.php b/class/Plugins/legacy/Buyersguide.php similarity index 89% rename from class/Plugins/Buyersguide.php rename to class/Plugins/legacy/Buyersguide.php index 2ed94489..051ef6cd 100644 --- a/class/Plugins/Buyersguide.php +++ b/class/Plugins/legacy/Buyersguide.php @@ -46,13 +46,13 @@ class Buyersguide public $grab; /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() + public function loadModule():?\XoopsModule { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { - return false; + return null; } $this->modname = $mod->getVar('name'); @@ -60,12 +60,13 @@ public function loadModule() } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - $ret = false; + $myts = \MyTextSanitizer::getInstance(); + $ret = null; require_once XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; $items = $hBgProduct->getRecentProducts(0, 0, $this->grab); $i = 0; diff --git a/class/Plugins/Buyersguidemanufacturers.php b/class/Plugins/legacy/Buyersguidemanufacturers.php similarity index 88% rename from class/Plugins/Buyersguidemanufacturers.php rename to class/Plugins/legacy/Buyersguidemanufacturers.php index b3c20cfb..cd931e42 100644 --- a/class/Plugins/Buyersguidemanufacturers.php +++ b/class/Plugins/legacy/Buyersguidemanufacturers.php @@ -46,13 +46,13 @@ class Buyersguidemanufacturers public $grab; /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() + public function loadModule():?\XoopsModule { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { - return false; + return null; } $this->modname = $mod->getVar('name'); @@ -60,12 +60,13 @@ public function loadModule() } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - $ret = false; + $myts = \MyTextSanitizer::getInstance(); + $ret = null; require_once XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; $items = $hBgManufacturer->getListofActivteManufacturers(0, $this->grab, 'manu_date_added', 'DESC'); $i = 0; diff --git a/class/Plugins/Buyersguidenews.php b/class/Plugins/legacy/Buyersguidenews.php similarity index 88% rename from class/Plugins/Buyersguidenews.php rename to class/Plugins/legacy/Buyersguidenews.php index c5fa0be4..b2540944 100644 --- a/class/Plugins/Buyersguidenews.php +++ b/class/Plugins/legacy/Buyersguidenews.php @@ -46,13 +46,13 @@ class Buyersguidenews public $grab; /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() + public function loadModule():?\XoopsModule { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { - return false; + return null; } $this->modname = $mod->getVar('name'); @@ -60,12 +60,13 @@ public function loadModule() } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - $ret = false; + $myts = \MyTextSanitizer::getInstance(); + $ret = null; require_once XOOPS_ROOT_PATH . '/modules/buyersguide/include/common.php'; $items = $hBgNews->getRecentNews(0, $this->grab); $i = 0; diff --git a/class/Plugins/Mydownloads.php b/class/Plugins/legacy/Mydownloads.php similarity index 92% rename from class/Plugins/Mydownloads.php rename to class/Plugins/legacy/Mydownloads.php index 0f583286..1691d4fd 100644 --- a/class/Plugins/Mydownloads.php +++ b/class/Plugins/legacy/Mydownloads.php @@ -46,13 +46,13 @@ class Mydownloads extends \XoopsObject public $grab; /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() + public function loadModule():?\XoopsModule { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { - return false; + return null; } $this->modname = $mod->getVar('name'); @@ -60,12 +60,11 @@ public function loadModule() } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); $ret = false; $i = 0; diff --git a/class/Plugins/Mytube.php b/class/Plugins/legacy/Mytube.php similarity index 91% rename from class/Plugins/Mytube.php rename to class/Plugins/legacy/Mytube.php index 1e5184eb..1389a445 100644 --- a/class/Plugins/Mytube.php +++ b/class/Plugins/legacy/Mytube.php @@ -45,13 +45,13 @@ class Mytube public $grab; /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() + public function loadModule():?\XoopsModule { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { - return false; + return null; } $this->modname = $mod->getVar('name'); @@ -59,14 +59,13 @@ public function loadModule() } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = null; $i = 0; $sql = 'SELECT l.lid, l.title as ltitle, l.date, l.cid, l.hits, l.description, c.title as ctitle FROM ' . $xoopsDB->prefix('xoopstube_videos') . ' l, ' . $xoopsDB->prefix('xoopstube_cat') . ' c WHERE l.cid=c.cid AND l.status>0 ORDER BY l.date DESC'; diff --git a/class/Plugins/Queries.php b/class/Plugins/legacy/Queries.php similarity index 92% rename from class/Plugins/Queries.php rename to class/Plugins/legacy/Queries.php index b286fbaa..3ef93588 100644 --- a/class/Plugins/Queries.php +++ b/class/Plugins/legacy/Queries.php @@ -47,13 +47,13 @@ class Queries public $module; /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() + public function loadModule():?\XoopsModule { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { - return false; + return null; } $this->modname = $mod->getVar('name'); $this->module = $mod; // optional, remove this line if there is nothing @@ -62,14 +62,13 @@ public function loadModule() } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = null; $i = -1; $lasttime = false; diff --git a/class/Plugins/Rmdp.php b/class/Plugins/legacy/Rmdp.php similarity index 91% rename from class/Plugins/Rmdp.php rename to class/Plugins/legacy/Rmdp.php index 2c2abad2..0bedacb3 100644 --- a/class/Plugins/Rmdp.php +++ b/class/Plugins/legacy/Rmdp.php @@ -45,13 +45,13 @@ class Rmdp extends \XoopsObject public $grab; /** - * @return false|\XoopsModule + * @return \XoopsModule */ - public function loadModule() + public function loadModule():?\XoopsModule { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { - return false; + return null; } $this->modname = $mod->getVar('name'); $this->module = $mod; @@ -60,13 +60,12 @@ public function loadModule() } /** - * @param \XoopsObject $obj + * @param \XoopsMySQLDatabase $xoopsDB * @return array */ - public function grabEntries(&$obj): array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB, $grouppermHandler; - $ret = []; + $ret = null; $i = 0; $sql = 'SELECT id_soft, id_cat, nombre, fecha, longdesc FROM ' . $xoopsDB->prefix('rmdp_software') . ' ORDER BY fecha DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); diff --git a/class/Plugins/Smartsection.php b/class/Plugins/legacy/Smartsection.php similarity index 89% rename from class/Plugins/Smartsection.php rename to class/Plugins/legacy/Smartsection.php index f9551e4d..d3add8cc 100644 --- a/class/Plugins/Smartsection.php +++ b/class/Plugins/legacy/Smartsection.php @@ -51,13 +51,13 @@ class Smartsection public $grab; /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() + public function loadModule():?\XoopsModule { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { - return false; + return null; } $this->modname = $mod->getVar('name'); @@ -65,12 +65,13 @@ public function loadModule() } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - $ret = false; + $myts = \MyTextSanitizer::getInstance(); + $ret = null; require_once XOOPS_ROOT_PATH . '/modules/smartsection/include/common.php'; $helper = SmartsectionHelper::getInstance(); $itemHandler = $helper->getHandler('Item'); diff --git a/class/Plugins/Special.php b/class/Plugins/legacy/Special.php similarity index 93% rename from class/Plugins/Special.php rename to class/Plugins/legacy/Special.php index d099fce1..42eaf148 100644 --- a/class/Plugins/Special.php +++ b/class/Plugins/legacy/Special.php @@ -63,13 +63,13 @@ class Special public $module; /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() + public function loadModule():?\XoopsModule { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { - return false; + return null; } $this->modname = $mod->getVar('name'); $this->module = $mod; // optional, remove this line if there is nothing @@ -78,13 +78,12 @@ public function loadModule() } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries($obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; - $ret = []; + $ret = null; @require_once XOOPS_ROOT_PATH . '/modules/special/class/stuff.php'; $myts = \MyTextSanitizer::getInstance(); $items = SpecialStuff::getAllPublished($this->grab, 0); diff --git a/class/Plugins/Weblinks.php b/class/Plugins/legacy/Weblinks.php similarity index 93% rename from class/Plugins/Weblinks.php rename to class/Plugins/legacy/Weblinks.php index 12ae18cd..b89516bd 100644 --- a/class/Plugins/Weblinks.php +++ b/class/Plugins/legacy/Weblinks.php @@ -46,13 +46,13 @@ class Weblinks public $grab; /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() + public function loadModule():?\XoopsModule { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { - return false; + return null; } $this->modname = $mod->getVar('name'); @@ -88,14 +88,13 @@ public function myGetUnameFromId($uid): string } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); - $ret = false; + $ret = null; $i = 0; $sql = 'SELECT lid, title, time_update, description, url, uid FROM ' . $xoopsDB->prefix('weblinks_link') . ' ORDER BY time_update DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); diff --git a/class/Plugins/Wfdownloads_podcast.php b/class/Plugins/legacy/Wfdownloads_podcast.php similarity index 93% rename from class/Plugins/Wfdownloads_podcast.php rename to class/Plugins/legacy/Wfdownloads_podcast.php index 1ba8fb82..bbeb1a14 100644 --- a/class/Plugins/Wfdownloads_podcast.php +++ b/class/Plugins/legacy/Wfdownloads_podcast.php @@ -48,13 +48,13 @@ class Wfdownloads_podcast extends \XoopsObject public $grab; /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() + public function loadModule():?\XoopsModule { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive') || $mod->getVar('version') < 310) { - return false; + return null; } $this->modname = $mod->getVar('name'); $this->module = $mod; @@ -63,15 +63,14 @@ public function loadModule() } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { - global $xoopsDB; $myts = \MyTextSanitizer::getInstance(); $grouppermHandler = \xoops_getHandler('groupperm'); - $ret = false; + $ret = null; $i = 0; $sql = 'SELECT lid, cid, title, date, description, filetype, size FROM ' . $xoopsDB->prefix('wfdownloads_downloads') . ' WHERE status > 0 AND offline = 0 AND (expired > ' . \time() . ' OR expired = 0) AND published <= ' . \time() . ' ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); diff --git a/class/Plugins/Wfsection.php b/class/Plugins/legacy/Wfsection.php similarity index 92% rename from class/Plugins/Wfsection.php rename to class/Plugins/legacy/Wfsection.php index df0efac6..26173d4d 100644 --- a/class/Plugins/Wfsection.php +++ b/class/Plugins/legacy/Wfsection.php @@ -47,13 +47,13 @@ class Wfsection public $grab; /** - * @return false|string + * @return \XoopsModule */ - public function loadModule() + public function loadModule():?\XoopsModule { $mod = $GLOBALS['module_handler']->getByDirname($this->dirname); if (!$mod || !$mod->getVar('isactive')) { - return false; + return null; } $this->modname = $mod->getVar('name'); if ($mod->getVar('version') >= 200) { @@ -64,14 +64,13 @@ public function loadModule() } /** - * @param \XoopsObject $obj - * @return bool|array + * @param \XoopsMySQLDatabase $xoopsDB + * @return array */ - public function grabEntries(&$obj) + public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array { @require_once XOOPS_ROOT_PATH . '/modules/wfsection/include/groupaccess.php'; - global $xoopsDB; - $ret = false; + $ret = null; $i = 0; $sql = 'SELECT a.articleid, a.title as atitle, a.published, a.expired, a.counter, a.groupid, a.maintext, a.summary, b.title as btitle FROM ' . $xoopsDB->prefix('wfs_article') diff --git a/include/common0.php b/include/common0.php deleted file mode 100644 index 90c9fc86..00000000 --- a/include/common0.php +++ /dev/null @@ -1,41 +0,0 @@ - - * @author XOOPS Development Team - */ -use XoopsModules\Rssfit; - -if (!defined('RSSFIT_CONSTANTS_DEFINED')) { - define('RSSFIT_ROOT_PATH', XOOPS_ROOT_PATH . '/modules/' . $xoopsModule->getVar('dirname') . '/'); - define('RSSFIT_URL', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/'); - define('RSSFIT_URL_FEED', RSSFIT_URL . 'rss.php'); - define('RSSFIT_ADMIN_URL', XOOPS_URL . '/modules/' . $xoopsModule->getVar('dirname') . '/admin/'); - define('RSSFIT_CONSTANTS_DEFINED', 1); -} - -//require_once RSSFIT_ROOT_PATH . 'class/rssfeed.php'; -//require_once RSSFIT_ROOT_PATH.'include/functions.php'; - -$version = number_format($xoopsModule->getVar('version') / 100, 2); -$version = !mb_substr($version, -1, 1) ? mb_substr($version, 0, 3) : $version; -define('RSSFIT_VERSION', 'RSSFit ' . $version); - -$rss = new Rssfit\FeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); -$myts = $rss->myts; -$pluginHandler = $rss->pluginHandler; -$miscHandler = $rss->miscHandler; From d3590ebff02f70af70023e03e83286880a5d6d5d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 05:35:46 -0400 Subject: [PATCH 087/154] Parameter's name changed during inheritance --- class/MiscHandler.php | 36 +++++++++--------- class/PluginHandler.php | 84 ++++++++++++++++++++--------------------- 2 files changed, 60 insertions(+), 60 deletions(-) diff --git a/class/MiscHandler.php b/class/MiscHandler.php index a1025c6d..d5c79585 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -175,33 +175,33 @@ public function getObjects2($criteria = null, string $fields = '*', string $key } /** - * @param \XoopsObject $obj + * @param \XoopsObject $object * @param bool $force * @return array|bool|int|mixed|null */ - public function insert(\XoopsObject $obj, $force = false) + public function insert(\XoopsObject $object, $force = false) { // $force = false; - if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->objClass)) { + if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) { return false; } - if (!$obj->isDirty()) { + if (!$object->isDirty()) { return true; } - if (!$obj->cleanVars()) { + if (!$object->cleanVars()) { return false; } - foreach ($obj->cleanVars as $k => $v) { - if (\XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) { + foreach ($object->cleanVars as $k => $v) { + if (\XOBJ_DTYPE_INT == $object->vars[$k]['data_type']) { $cleanvars[$k] = (int)$v; } else { $cleanvars[$k] = $this->db->quoteString($v); } } - if (\count($obj->getErrors()) > 0) { + if (\count($object->getErrors()) > 0) { return false; } - if ($obj->isNew() || empty($cleanvars[$this->objKey])) { + if ($object->isNew() || empty($cleanvars[$this->objKey])) { $cleanvars[$this->objKey] = $this->db->genId($this->dbTable . '_' . $this->objKey . '_seq'); $sql = 'INSERT INTO ' . $this->dbTable . ' (' . \implode(',', \array_keys($cleanvars)) . ') VALUES (' . \implode(',', $cleanvars) . ')'; } else { @@ -211,7 +211,7 @@ public function insert(\XoopsObject $obj, $force = false) $sql .= ' ' . $k . '=' . $v . ','; } $sql = mb_substr($sql, 0, -1); - $sql .= ' WHERE ' . $this->objKey . ' = ' . $obj->getVar($this->objKey); + $sql .= ' WHERE ' . $this->objKey . ' = ' . $object->getVar($this->objKey); } if (false !== $force) { $result = $this->db->queryF($sql); @@ -219,15 +219,15 @@ public function insert(\XoopsObject $obj, $force = false) $result = $this->db->query($sql); } if (!$result) { - $obj->setErrors('Could not store data in the database.
        ' . $this->db->error() . ' (' . $this->db->errno() . ')
        ' . $sql); + $object->setErrors('Could not store data in the database.
        ' . $this->db->error() . ' (' . $this->db->errno() . ')
        ' . $sql); return false; } - if (false === $obj->getVar($this->objKey)) { - $obj->assignVar($this->objKey, $this->db->getInsertId()); + if (false === $object->getVar($this->objKey)) { + $object->assignVar($this->objKey, $this->db->getInsertId()); } - return $obj->getVar($this->objKey); + return $object->getVar($this->objKey); } /** @@ -265,17 +265,17 @@ public function modifyObjects($criteria = null, array $fields = [], bool $force) } /** - * @param \XoopsObject $obj + * @param \XoopsObject $object * @param bool $force * @return bool */ - public function delete(\XoopsObject $obj, $force = false): bool + public function delete(\XoopsObject $object, $force = false): bool { // $force = false; - if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->objClass)) { + if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) { return false; } - $sql = 'DELETE FROM ' . $this->dbTable . ' WHERE ' . $this->objKey . '=' . $obj->getVar($this->objKey); + $sql = 'DELETE FROM ' . $this->dbTable . ' WHERE ' . $this->objKey . '=' . $object->getVar($this->objKey); if (false !== $force) { $result = $this->db->queryF($sql); } else { diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 03435f2b..89f8d205 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -86,13 +86,13 @@ public function getInstance(\XoopsDatabase $db = null): \XoopsPersistableObjectH */ public function create($isNew = true): ?\XoopsObject { - $obj = parent::create($isNew); + $object = parent::create($isNew); // if ($isNew) { - // $obj->setDefaultPermissions(); + // $object->setDefaultPermissions(); // } - $obj->helper = $this->helper; + $object->helper = $this->helper; - return $obj; + return $object; } // public function get($id, $fields = '*') @@ -115,32 +115,32 @@ public function get($id = null, $fields = null) } /** - * @param \XoopsObject $obj + * @param \XoopsObject $object * @param bool $force * @return array|bool|int|mixed|null */ - public function insert(\XoopsObject $obj, $force = false) + public function insert(\XoopsObject $object, $force = false) { - if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->objClass)) { + if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) { return false; } - if (!$obj->isDirty()) { + if (!$object->isDirty()) { return true; } - if (!$obj->cleanVars()) { + if (!$object->cleanVars()) { return false; } - foreach ($obj->cleanVars as $k => $v) { - if (\XOBJ_DTYPE_INT == $obj->vars[$k]['data_type']) { + foreach ($object->cleanVars as $k => $v) { + if (\XOBJ_DTYPE_INT == $object->vars[$k]['data_type']) { $cleanvars[$k] = (int)$v; } else { $cleanvars[$k] = $this->db->quoteString($v); } } - if (\count($obj->getErrors()) > 0) { + if (\count($object->getErrors()) > 0) { return false; } - if ($obj->isNew() || empty($cleanvars[$this->objKey])) { + if ($object->isNew() || empty($cleanvars[$this->objKey])) { $cleanvars[$this->objKey] = $this->db->genId($this->dbTable . '_' . $this->objKey . '_seq'); $sql = 'INSERT INTO ' . $this->dbTable . ' (' . \implode(',', \array_keys($cleanvars)) . ') VALUES (' . \implode(',', $cleanvars) . ')'; } else { @@ -150,7 +150,7 @@ public function insert(\XoopsObject $obj, $force = false) $sql .= ' ' . $k . '=' . $v . ','; } $sql = mb_substr($sql, 0, -1); - $sql .= ' WHERE ' . $this->objKey . ' = ' . $obj->getVar($this->objKey); + $sql .= ' WHERE ' . $this->objKey . ' = ' . $object->getVar($this->objKey); } if (false !== $force) { $result = $this->db->queryF($sql); @@ -158,29 +158,29 @@ public function insert(\XoopsObject $obj, $force = false) $result = $this->db->query($sql); } if (!$result) { - $obj->setErrors('Could not store data in the database.
        ' . $this->db->error() . ' (' . $this->db->errno() . ')
        ' . $sql); + $object->setErrors('Could not store data in the database.
        ' . $this->db->error() . ' (' . $this->db->errno() . ')
        ' . $sql); return false; } -// if (false === $obj->getVar($this->objKey)) { - if (0 === (int)$obj->getVar($this->objKey)) { - $obj->assignVar($this->objKey, $this->db->getInsertId()); +// if (false === $object->getVar($this->objKey)) { + if (0 === (int)$object->getVar($this->objKey)) { + $object->assignVar($this->objKey, $this->db->getInsertId()); } - return $obj->getVar($this->objKey); + return $object->getVar($this->objKey); } /** - * @param \XoopsObject $obj + * @param \XoopsObject $object * @param bool $force * @return bool */ - public function delete(\XoopsObject $obj, $force = false): bool + public function delete(\XoopsObject $object, $force = false): bool { - if (mb_strtolower(\get_class($obj)) != mb_strtolower($this->objClass)) { + if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) { return false; } - $sql = 'DELETE FROM ' . $this->dbTable . ' WHERE ' . $this->objKey . '=' . $obj->getVar($this->objKey); + $sql = 'DELETE FROM ' . $this->dbTable . ' WHERE ' . $this->objKey . '=' . $object->getVar($this->objKey); if (false !== $force) { $result = $this->db->queryF($sql); } else { @@ -230,17 +230,17 @@ public function getObjects2($criteria = null, string $fields = '*', string $key if ($result instanceof \mysqli_result) { $ret = []; while (false !== ($myrow = $this->db->fetchArray($result))) { - $obj = new $this->objClass(); - $obj->assignVars($myrow); + $object = new $this->objClass(); + $object->assignVars($myrow); switch ($key) { default: - $ret[] = &$obj; + $ret[] = &$object; break; case 'id': - $ret[$myrow[$this->objKey]] = &$obj; + $ret[$myrow[$this->objKey]] = &$object; break; } - unset($obj); + unset($object); } } return $ret; @@ -255,11 +255,11 @@ public function getObjects2($criteria = null, string $fields = '*', string $key public function modifyObjects($criteria = null, array $fields = [], bool $force) { if ($fields && \is_array($fields)) { - $obj = new $this->objClass(); + $object = new $this->objClass(); $sql = ''; foreach ($fields as $k => $v) { $sql .= $k . ' = '; - $sql .= 3 == $obj->vars[$k]['data_type'] ? (int)$v : $this->db->quoteString($v); + $sql .= 3 == $object->vars[$k]['data_type'] ? (int)$v : $this->db->quoteString($v); $sql .= ', '; } $sql = mb_substr($sql, 0, -2); @@ -301,13 +301,13 @@ public function getCount($criteria = null) } /** - * @param $obj + * @param $object * @param string $type * @return bool */ - public function forceDeactivate($obj, string $type = 'rssf_activated'): bool + public function forceDeactivate($object, string $type = 'rssf_activated'): bool { - $criteria = new \Criteria($this->objKey, $obj->getVar($this->objKey)); + $criteria = new \Criteria($this->objKey, $object->getVar($this->objKey)); $fields = ['rssf_activated' => 0, 'subfeed' => 0]; $this->modifyObjects($criteria, $fields, true); @@ -332,40 +332,40 @@ public function &getPluginFileList() } /** - * @param \XoopsObject $obj + * @param \XoopsObject $object * @return false|mixed */ - public function checkPlugin(\XoopsObject $obj) + public function checkPlugin(\XoopsObject $object) { $ret = false; global $moduleHandler; - $file = \RSSFIT_ROOT_PATH . 'class/Plugins/' . $obj->getVar('rssf_filename'); + $file = \RSSFIT_ROOT_PATH . 'class/Plugins/' . $object->getVar('rssf_filename'); if (\is_file($file)) { $ret = []; //mb $require_once = require $file; - $name = \explode('.', $obj->getVar('rssf_filename')); + $name = \explode('.', $object->getVar('rssf_filename')); $class = __NAMESPACE__ . '\Plugins\\' . \ucfirst($name[0]); if (\class_exists($class)) { $handler = new $class(); if (!\method_exists($handler, 'loadmodule') || !\method_exists($handler, 'grabentries')) { - $obj->setErrors(\_AM_RSSFIT_PLUGIN_FUNCNOTFOUND); + $object->setErrors(\_AM_RSSFIT_PLUGIN_FUNCNOTFOUND); } else { $dirname = $handler->dirname; if (!empty($dirname) && \is_dir(XOOPS_ROOT_PATH . '/modules/' . $dirname)) { if (!$handler->loadModule()) { - $obj->setErrors(\_AM_RSSFIT_PLUGIN_MODNOTFOUND); + $object->setErrors(\_AM_RSSFIT_PLUGIN_MODNOTFOUND); } else { $ret = $handler; } } else { - $obj->setErrors(\_AM_RSSFIT_PLUGIN_MODNOTFOUND); + $object->setErrors(\_AM_RSSFIT_PLUGIN_MODNOTFOUND); } } } else { - $obj->setErrors(\_AM_RSSFIT_PLUGIN_CLASSNOTFOUND . ' ' . $class); + $object->setErrors(\_AM_RSSFIT_PLUGIN_CLASSNOTFOUND . ' ' . $class); } } else { - $obj->setErrors(\_AM_RSSFIT_PLUGIN_FILENOTFOUND); + $object->setErrors(\_AM_RSSFIT_PLUGIN_FILENOTFOUND); } return $ret; From 837b8c5e30e5462b7ed4f958cf78ab3df0eef90f Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 05:38:20 -0400 Subject: [PATCH 088/154] Class overrides a field of a parent class --- class/MiscHandler.php | 1 - class/PluginHandler.php | 1 - class/Plugins/Comments.php | 2 -- 3 files changed, 4 deletions(-) diff --git a/class/MiscHandler.php b/class/MiscHandler.php index d5c79585..c330cf14 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -32,7 +32,6 @@ */ class MiscHandler extends \XoopsPersistableObjectHandler { - public $db; public $dbTable; public $objClass = Misc::class; public $objKey = 'misc_id'; diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 89f8d205..2678018c 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -32,7 +32,6 @@ */ class PluginHandler extends \XoopsPersistableObjectHandler { - public $db; public $dbTable; public $objClass = Plugin::class; public $objKey = 'rssf_conf_id'; diff --git a/class/Plugins/Comments.php b/class/Plugins/Comments.php index 02d31cce..eed9d470 100644 --- a/class/Plugins/Comments.php +++ b/class/Plugins/Comments.php @@ -51,8 +51,6 @@ class Comments extends AbstractPlugin { public $dirname = 'system'; - public $modname; - public $grab; /** * @param \XoopsMySQLDatabase $xoopsDB From 8d92bc9b2ce41464353bb0c653b6686583d2c11b Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 05:40:50 -0400 Subject: [PATCH 089/154] Final classes --- class/Plugins/Adslight.php | 2 +- class/Plugins/Ams.php | 2 +- class/Plugins/Apcal.php | 2 +- class/Plugins/Comments.php | 2 +- class/Plugins/Extcal.php | 2 +- class/Plugins/Lexikon.php | 2 +- class/Plugins/Myalbum.php | 2 +- class/Plugins/Mylinks.php | 2 +- class/Plugins/Newbb.php | 2 +- class/Plugins/News.php | 2 +- class/Plugins/Oledrion.php | 2 +- class/Plugins/Pical.php | 2 +- class/Plugins/Sample.php | 2 +- class/Plugins/Smartfaq.php | 2 +- class/Plugins/Smartpartner.php | 2 +- class/Plugins/Surnames.php | 2 +- class/Plugins/Wfdownloads.php | 2 +- class/Plugins/Wflinks.php | 2 +- class/Plugins/Xoopstube.php | 2 +- 19 files changed, 19 insertions(+), 19 deletions(-) diff --git a/class/Plugins/Adslight.php b/class/Plugins/Adslight.php index cbae91d4..3cf978ab 100644 --- a/class/Plugins/Adslight.php +++ b/class/Plugins/Adslight.php @@ -42,7 +42,7 @@ /** * Class Adslight */ -class Adslight extends AbstractPlugin +final class Adslight extends AbstractPlugin { public $dirname = 'adslight'; diff --git a/class/Plugins/Ams.php b/class/Plugins/Ams.php index 603e65d7..773316d7 100644 --- a/class/Plugins/Ams.php +++ b/class/Plugins/Ams.php @@ -46,7 +46,7 @@ * Class Ams * @package XoopsModules\Rssfit\Plugins */ -class Ams extends AbstractPlugin +final class Ams extends AbstractPlugin { public $dirname = 'ams'; diff --git a/class/Plugins/Apcal.php b/class/Plugins/Apcal.php index 602cc198..ae4dac0a 100644 --- a/class/Plugins/Apcal.php +++ b/class/Plugins/Apcal.php @@ -44,7 +44,7 @@ /** * Class Apcal */ -class Apcal extends AbstractPlugin +final class Apcal extends AbstractPlugin { public $dirname = 'apcal'; diff --git a/class/Plugins/Comments.php b/class/Plugins/Comments.php index eed9d470..b7f47c9c 100644 --- a/class/Plugins/Comments.php +++ b/class/Plugins/Comments.php @@ -48,7 +48,7 @@ * Class Comments * @package XoopsModules\Rssfit\Plugins */ -class Comments extends AbstractPlugin +final class Comments extends AbstractPlugin { public $dirname = 'system'; diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index 3b8f5b74..bd2a010e 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -62,7 +62,7 @@ * Class Extcal * @package XoopsModules\Rssfit\Plugins */ -class Extcal extends AbstractPlugin +final class Extcal extends AbstractPlugin { public $dirname = 'extcal'; diff --git a/class/Plugins/Lexikon.php b/class/Plugins/Lexikon.php index 2b439817..4cdce8d3 100644 --- a/class/Plugins/Lexikon.php +++ b/class/Plugins/Lexikon.php @@ -43,7 +43,7 @@ /** * Class lexikon */ -class Lexikon extends AbstractPlugin +final class Lexikon extends AbstractPlugin { public $dirname = 'lexikon'; diff --git a/class/Plugins/Myalbum.php b/class/Plugins/Myalbum.php index a180c86e..3d088018 100644 --- a/class/Plugins/Myalbum.php +++ b/class/Plugins/Myalbum.php @@ -62,7 +62,7 @@ * Class Myalbum * @package XoopsModules\Rssfit\Plugins */ -class Myalbum extends AbstractPlugin +final class Myalbum extends AbstractPlugin { public $dirname = 'myalbum'; diff --git a/class/Plugins/Mylinks.php b/class/Plugins/Mylinks.php index f3ffebc3..3e02c0c1 100644 --- a/class/Plugins/Mylinks.php +++ b/class/Plugins/Mylinks.php @@ -45,7 +45,7 @@ * Class Mylinks * @package XoopsModules\Rssfit\Plugins */ -class Mylinks extends AbstractPlugin +final class Mylinks extends AbstractPlugin { public $dirname = 'mylinks'; diff --git a/class/Plugins/Newbb.php b/class/Plugins/Newbb.php index 452942d9..1628a049 100644 --- a/class/Plugins/Newbb.php +++ b/class/Plugins/Newbb.php @@ -45,7 +45,7 @@ * Class Newbb * @package XoopsModules\Rssfit\Plugins */ -class Newbb extends AbstractPlugin +final class Newbb extends AbstractPlugin { public $dirname = 'newbb'; diff --git a/class/Plugins/News.php b/class/Plugins/News.php index dd367dbf..ae279666 100644 --- a/class/Plugins/News.php +++ b/class/Plugins/News.php @@ -47,7 +47,7 @@ * Class News * @package XoopsModules\Rssfit\Plugins */ -class News extends AbstractPlugin +final class News extends AbstractPlugin { public $dirname = 'news'; diff --git a/class/Plugins/Oledrion.php b/class/Plugins/Oledrion.php index eeb4bf21..dec7fd71 100644 --- a/class/Plugins/Oledrion.php +++ b/class/Plugins/Oledrion.php @@ -36,7 +36,7 @@ * Class Oledrion * @package XoopsModules\Rssfit\Plugins */ -class Oledrion extends AbstractPlugin +final class Oledrion extends AbstractPlugin { public $dirname = 'oledrion'; diff --git a/class/Plugins/Pical.php b/class/Plugins/Pical.php index a8f27610..80f947bf 100644 --- a/class/Plugins/Pical.php +++ b/class/Plugins/Pical.php @@ -44,7 +44,7 @@ /** * Class Pical */ -class Pical extends AbstractPlugin +final class Pical extends AbstractPlugin { public $dirname = 'piCal'; diff --git a/class/Plugins/Sample.php b/class/Plugins/Sample.php index bd29ee98..ae6464ca 100644 --- a/class/Plugins/Sample.php +++ b/class/Plugins/Sample.php @@ -63,7 +63,7 @@ * Class Sample * @package XoopsModules\Rssfit\Plugins */ -class Sample extends AbstractPlugin +final class Sample extends AbstractPlugin { public $dirname = 'sample'; diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php index 7c036ba6..3327af80 100644 --- a/class/Plugins/Smartfaq.php +++ b/class/Plugins/Smartfaq.php @@ -45,7 +45,7 @@ * Class Smartfaq * @package XoopsModules\Rssfit\Plugins */ -class Smartfaq extends AbstractPlugin +final class Smartfaq extends AbstractPlugin { public $dirname = 'smartfaq'; diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php index a9ea817d..c6ac7f95 100644 --- a/class/Plugins/Smartpartner.php +++ b/class/Plugins/Smartpartner.php @@ -50,7 +50,7 @@ * Class Smartpartner * @package XoopsModules\Rssfit\Plugins */ -class Smartpartner extends AbstractPlugin +final class Smartpartner extends AbstractPlugin { public $dirname = 'smartpartner'; diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php index 80e26052..bfe8b200 100644 --- a/class/Plugins/Surnames.php +++ b/class/Plugins/Surnames.php @@ -45,7 +45,7 @@ * Class Surnames * @package XoopsModules\Rssfit\Plugins */ -class Surnames extends AbstractPlugin +final class Surnames extends AbstractPlugin { public $dirname = 'surnames'; diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php index 19215b07..25624877 100644 --- a/class/Plugins/Wfdownloads.php +++ b/class/Plugins/Wfdownloads.php @@ -45,7 +45,7 @@ * Class Wfdownloads * @package XoopsModules\Rssfit\Plugins */ -class Wfdownloads extends AbstractPlugin +final class Wfdownloads extends AbstractPlugin { public $dirname = 'wfdownloads'; diff --git a/class/Plugins/Wflinks.php b/class/Plugins/Wflinks.php index c2d0bc42..af00c559 100644 --- a/class/Plugins/Wflinks.php +++ b/class/Plugins/Wflinks.php @@ -48,7 +48,7 @@ /** * Class Wflinks */ -class Wflinks extends AbstractPlugin +final class Wflinks extends AbstractPlugin { public $dirname = 'wflinks'; diff --git a/class/Plugins/Xoopstube.php b/class/Plugins/Xoopstube.php index 36da5dc2..dfbe3a06 100644 --- a/class/Plugins/Xoopstube.php +++ b/class/Plugins/Xoopstube.php @@ -44,7 +44,7 @@ /** * Class Xoopstube */ -class Xoopstube extends AbstractPlugin +final class Xoopstube extends AbstractPlugin { /** * @var string From ac317340d3775816735e060dd439e946f194faf9 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 05:42:38 -0400 Subject: [PATCH 090/154] override loadModule() in Xoopstube --- class/Plugins/Xoopstube.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/class/Plugins/Xoopstube.php b/class/Plugins/Xoopstube.php index dfbe3a06..53b64f95 100644 --- a/class/Plugins/Xoopstube.php +++ b/class/Plugins/Xoopstube.php @@ -51,13 +51,21 @@ final class Xoopstube extends AbstractPlugin */ public $dirname = 'xoopstube'; - public function initialize(): void - { + /** + * @return \XoopsModule + */ + public function loadModule(): ?\XoopsModule{ + + $mod = null; if (class_exists(PluginHelper::class)) { $this->helper = PluginHelper::getInstance(); $this->module = $this->helper->getModule(); + $this->modname = $this->module->getVar('name'); + $mod = $this->module; // $this->dirname = $this->helper->getDirname(); } + + return $mod; } /** From 8cc93bbd05aace2a5eed41b5dedea11c7d3cf713 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 05:43:29 -0400 Subject: [PATCH 091/154] Foreach usage --- class/FeedHandler.php | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 99298975..4e1076da 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -226,17 +226,17 @@ public function getItems(&$feed): void } } if (count($entries) > 0) { - for ($i = 0, $iMax = count($entries); $i < $iMax; $i++) { - $this->cleanupChars($entries[$i]['title']); + foreach ($entries as $i => $iValue) { + $this->cleanupChars($iValue['title']); $strip = $this->modConfig['strip_html'] ? true : false; - $this->cleanupChars($entries[$i]['description'], $strip, false, true); - $this->wrapCdata($entries[$i]['description']); - $entries[$i]['category'] = $this->myts->undoHtmlSpecialChars($entries[$i]['category']); - $this->cleanupChars($entries[$i]['category']); - if (!isset($entries[$i]['timestamp'])) { + $this->cleanupChars($iValue['description'], $strip, false, true); + $this->wrapCdata($iValue['description']); + $entries[$i]['category'] = $this->myts->undoHtmlSpecialChars($iValue['category']); + $this->cleanupChars($iValue['category']); + if (!isset($iValue['timestamp'])) { $entries[$i]['timestamp'] = $this->rssmod->getVar('last_update'); } - $entries[$i]['pubdate'] = $this->rssTimeStamp((int)$entries[$i]['timestamp']); + $entries[$i]['pubdate'] = $this->rssTimeStamp((int)$iValue['timestamp']); } if (empty($feed['plugin']) && 'd' === $this->modConfig['sort']) { uasort($entries, [$this, 'sortTimestamp']); From 527b1a65b6bb097d01c8734d77364a685e7b9951 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Sun, 17 Oct 2021 05:44:58 -0400 Subject: [PATCH 092/154] Inverted 'if-else' constructs --- admin/do_intro.php | 6 +++--- admin/do_sticky.php | 6 +++--- admin/do_subfeeds.php | 12 ++++++------ class/PluginHandler.php | 6 +++--- rss.php | 6 +++--- 5 files changed, 18 insertions(+), 18 deletions(-) diff --git a/admin/do_intro.php b/admin/do_intro.php index f1326778..63e430b7 100644 --- a/admin/do_intro.php +++ b/admin/do_intro.php @@ -74,10 +74,10 @@ 'sub' => isset($_POST['sub']) ? trim($_POST['sub']) : '', ]; $intro->setVar('misc_setting', $setting); - if (false === $miscHandler->insert($intro)) { - echo $intro->getHtmlErrors(); - } else { + if (false !== $miscHandler->insert($intro)) { redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); + } else { + echo $intro->getHtmlErrors(); } break; } diff --git a/admin/do_sticky.php b/admin/do_sticky.php index 0f7af4a5..0a0e5b41 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -80,10 +80,10 @@ 'link' => isset($_POST['link']) ? trim($_POST['link']) : '', ]; $sticky->setVar('misc_setting', $setting, true); - if (false === $miscHandler->insert($sticky)) { - echo $sticky->getHtmlErrors(); - } else { + if (false !== $miscHandler->insert($sticky)) { redirect_header(RSSFIT_ADMIN_URL . '?do=' . $do, 0, _AM_RSSFIT_DBUPDATED); + } else { + echo $sticky->getHtmlErrors(); } break; } diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index 8f66fbab..522d4728 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -50,18 +50,18 @@ . "
      \n" . ""; $desc .= '
      " @@ -126,7 +127,7 @@ $ret .= '
      ' . $e; } } else { - $ret .= '' . _AM_RSSFIT_PLUGIN_UNKNOWNERROR . ''; + $ret .= '' . _AM_RSSFIT_PLUGIN_UNKNOWNERROR . ''; } $ret .= "\n"; diff --git a/admin/do_sticky.php b/admin/do_sticky.php index 0a0e5b41..58ee4971 100644 --- a/admin/do_sticky.php +++ b/admin/do_sticky.php @@ -36,7 +36,7 @@ switch ($op) { default: $setting = $sticky->getVar('misc_setting'); - $title = new \XoopsFormText(_AM_RSSFIT_STICKY_TITLE, 'title', 50, 255, $sticky->getVar('misc_title', 'e')); + $title = new \XoopsFormText(_AM_RSSFIT_STICKY_TITLE, 'title', 50, 255, $sticky->getVar('misc_title', 'e')); $title->setDescription(_AM_RSSFIT_EDIT_INTRO_TITLE_DESC); $contentTray = new \XoopsFormElementTray(_AM_RSSFIT_STICKY_CONTENT, '
      '); @@ -50,9 +50,9 @@ $dobr->addOption(1, _AM_RSSFIT_DO_BR); $contentTray->addElement($dobr); - $link = new \XoopsFormText(_AM_RSSFIT_STICKY_LINK, 'link', 50, 255, htmlspecialchars($setting['link']??'', ENT_QUOTES | ENT_HTML5)); + $link = new \XoopsFormText(_AM_RSSFIT_STICKY_LINK, 'link', 50, 255, htmlspecialchars($setting['link'] ?? '', ENT_QUOTES | ENT_HTML5)); - $applyto = $feedHandler->feedSelectBox(_AM_RSSFIT_STICKY_APPLYTO, $setting['feeds']??null, 10); + $applyto = $feedHandler->feedSelectBox(_AM_RSSFIT_STICKY_APPLYTO, $setting['feeds'] ?? null, 10); $form = new \XoopsThemeForm(_AM_RSSFIT_STICKY_EDIT, 'editsticky', RSSFIT_ADMIN_URL); $form->addElement($title); diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index c8059dc2..e8ab35c4 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -25,6 +25,7 @@ PluginHandler, Utility }; + /** @var FeedHandler $feedHandler */ /** @var PluginHandler $pluginHandler */ @@ -57,7 +58,7 @@ if ($handler = $pluginHandler->checkPlugin($p)) { $mod = $handler->modname; $activate = new \XoopsFormCheckBox('', 'activate[' . $id . ']', $p->getVar('subfeed')); - $config = Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_RSSFIT_SUB_CONFIGURE); + $config = Utility::rssfGenAnchor(RSSFIT_ADMIN_URL . '?do=' . $do . '&op=edit&feed=' . $id, _AM_RSSFIT_SUB_CONFIGURE); $urlLink = '' . $feedHandler->subFeedUrl($p->getVar('rssf_filename')) . ''; } else { $pluginHandler->forceDeactivate($p); diff --git a/admin/index.php b/admin/index.php index 35f2fef1..85fe2b9c 100644 --- a/admin/index.php +++ b/admin/index.php @@ -14,15 +14,15 @@ /** * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) - * @author XOOPS Development Team + * @author XOOPS Development Team */ use Xmf\Request; use XoopsModules\Rssfit\{ - FeedHandler, - PluginHandler, Common, + FeedHandler, Helper, + PluginHandler, Utility }; @@ -34,13 +34,12 @@ require_once __DIR__ . '/admin_header.php'; -$helper = Helper::getInstance(); +$helper = Helper::getInstance(); $utility = new Utility(); $do = Request::getString('do', ''); $op = Request::getString('op', 'list'); - //$do = \Xmf\Request::getString('do', ''); //$op = \Xmf\Request::getString('op', \Xmf\Request::getString('op', 'list', 'GET'), 'POST'); //define('RSSFIT_OK', 1); diff --git a/admin/menu.php b/admin/menu.php index 4f0dfbb4..ac083e41 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -35,8 +35,8 @@ $helper->loadLanguage('feedback'); // get path to icons -$pathIcon32 = Admin::menuIconPath(''); -$pathModIcon32 = XOOPS_URL . '/modules/' . $moduleDirName . '/assets/images/icons/32/'; +$pathIcon32 = Admin::menuIconPath(''); +$pathModIcon32 = XOOPS_URL . '/modules/' . $moduleDirName . '/assets/images/icons/32/'; if (is_object($helper->getModule()) && false !== $helper->getModule()->getInfo('modicons32')) { $pathModIcon32 = $helper->url($helper->getModule()->getInfo('modicons32')); } @@ -45,54 +45,54 @@ $adminmenu[] = [ 'title' => _MI_RSSFIT_INDEX, - 'link' => 'admin/index.php', - 'icon' => $pathIcon32 . '/home.png', + 'link' => 'admin/index.php', + 'icon' => $pathIcon32 . '/home.png', ]; $adminmenu[] = [ 'title' => _MI_RSSFIT_ADMENU1, - 'link' => 'admin/?do=intro', + 'link' => 'admin/?do=intro', //'link' => "admin/do_intro.php", - 'icon' => $pathIcon32 . '/folder_txt.png', + 'icon' => $pathIcon32 . '/folder_txt.png', ]; $adminmenu[] = [ 'title' => _MI_RSSFIT_ADMENU2, - 'link' => 'admin/?do=plugins', + 'link' => 'admin/?do=plugins', //'link' => "admin/do_plugins.php", - 'icon' => 'assets/images/icons/32/plugin.png', + 'icon' => 'assets/images/icons/32/plugin.png', ]; $adminmenu[] = [ 'title' => _MI_RSSFIT_ADMENU3, - 'link' => 'admin/?do=channel', + 'link' => 'admin/?do=channel', //'link' => "admin/do_channel.php", - 'icon' => $pathIcon32 . '/compfile.png', + 'icon' => $pathIcon32 . '/compfile.png', ]; $adminmenu[] = [ 'title' => _MI_RSSFIT_ADMENU4, - 'link' => 'admin/?do=subfeeds', + 'link' => 'admin/?do=subfeeds', //'link' => "admin/do_subfeeds.php", - 'icon' => $pathIcon32 . '/groupmod.png', + 'icon' => $pathIcon32 . '/groupmod.png', ]; $adminmenu[] = [ 'title' => _MI_RSSFIT_ADMENU5, - 'link' => 'admin/?do=sticky', - 'icon' => $pathIcon32 . '/attach.png', + 'link' => 'admin/?do=sticky', + 'icon' => $pathIcon32 . '/attach.png', ]; if (is_object($helper->getModule()) && $helper->getConfig('displayDeveloperTools')) { $adminmenu[] = [ 'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE'), - 'link' => 'admin/migrate.php', - 'icon' => $pathIcon32 . '/database_go.png', + 'link' => 'admin/migrate.php', + 'icon' => $pathIcon32 . '/database_go.png', ]; } $adminmenu[] = [ 'title' => _MI_RSSFIT_ABOUT, 'link' => 'admin/?do=about', - 'icon' => $pathIcon32 . '/about.png', + 'icon' => $pathIcon32 . '/about.png', ]; diff --git a/admin/migrate.php b/admin/migrate.php index ceb07451..76f22853 100644 --- a/admin/migrate.php +++ b/admin/migrate.php @@ -37,6 +37,7 @@ Common\Configurator, Common\Migrate }; + /** @var Admin $adminObject */ /** @var Configurator $configurator */ /** @var Migrate $migrator */ @@ -66,13 +67,13 @@ $migrator = new Migrate($configurator); -$op = Request::getCmd('op', 'show'); -$opShow = Request::getCmd('show', null, 'POST'); +$op = Request::getCmd('op', 'show'); +$opShow = Request::getCmd('show', null, 'POST'); $opMigrate = Request::getCmd('migrate', null, 'POST'); -$opSchema = Request::getCmd('schema', null, 'POST'); -$op = !empty($opShow) ? 'show' : $op; -$op = !empty($opMigrate) ? 'migrate' : $op; -$op = !empty($opSchema) ? 'schema' : $op; +$opSchema = Request::getCmd('schema', null, 'POST'); +$op = !empty($opShow) ? 'show' : $op; +$op = !empty($opMigrate) ? 'migrate' : $op; +$op = !empty($opSchema) ? 'schema' : $op; $message = ''; diff --git a/assets/images/icons/16/index.php b/assets/images/icons/16/index.php index 6a505435..2ea9b7d9 100644 --- a/assets/images/icons/16/index.php +++ b/assets/images/icons/16/index.php @@ -1,2 +1,3 @@ modname = $mod->getVar('name'); - $this->module = $mod; // optional, remove this line if there is nothing to do with module info when grabbing entries + $this->module = $mod; // optional, remove this line if there is nothing to do with module info when grabbing entries return $mod; } diff --git a/class/Common/Breadcrumb.php b/class/Common/Breadcrumb.php index ef0b8a0c..de74d255 100644 --- a/class/Common/Breadcrumb.php +++ b/class/Common/Breadcrumb.php @@ -14,8 +14,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ - - /** * Breadcrumb Class * diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index 5362a2ec..56ad5145 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -45,7 +45,6 @@ class Configurator */ public function __construct() { - $config = require \dirname(__DIR__, 2) . '/config/config.php'; $this->name = $config->name; @@ -63,6 +62,5 @@ public function __construct() $this->icons = require \dirname(__DIR__, 2) . '/config/icons.php'; $this->paths = require \dirname(__DIR__, 2) . '/config/paths.php'; - } } diff --git a/class/Common/FilesManagement.php b/class/Common/FilesManagement.php index 7b7a748c..0f7308ae 100644 --- a/class/Common/FilesManagement.php +++ b/class/Common/FilesManagement.php @@ -46,7 +46,6 @@ public static function copyFile(string $file, string $folder): bool return \copy($file, $folder); } - public static function recurseCopy(string $src, string $dst): void { $dir = \opendir($src); diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index 34d2c1f0..d15f95df 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -14,7 +14,6 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. */ - /** * Class Migrate synchronize existing tables with target schema * @@ -41,8 +40,8 @@ public function __construct() if (!\class_exists($class)) { throw new \RuntimeException("Class '$class' not found"); } - $configurator = new $class(); - $this->renameTables = $configurator->renameTables; + $configurator = new $class(); + $this->renameTables = $configurator->renameTables; $this->renameColumns = $configurator->renameColumns; $this->moduleDirName = \basename(\dirname(__DIR__, 2)); @@ -54,11 +53,11 @@ public function __construct() */ private function changePrefix(): void { -// foreach ($this->renameTables as $oldName => $newName) { -// if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) { -// $this->tableHandler->renameTable($oldName, $newName); -// } -// } + // foreach ($this->renameTables as $oldName => $newName) { + // if ($this->tableHandler->useTable($oldName) && !$this->tableHandler->useTable($newName)) { + // $this->tableHandler->renameTable($oldName, $newName); + // } + // } } /** @@ -69,17 +68,17 @@ private function changePrefix(): void */ private function convertIPAddresses(string $tableName, string $columnName): void { -// if ($this->tableHandler->useTable($tableName)) { -// $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); -// if (false !== \mb_strpos($attributes, ' int(')) { -// if (false === \mb_strpos($attributes, 'unsigned')) { -// $this->tableHandler->alterColumn($tableName, $columnName, " bigint(16) NOT NULL DEFAULT '0' "); -// $this->tableHandler->update($tableName, [$columnName => "4294967296 + $columnName"], "WHERE $columnName < 0", false); -// } -// $this->tableHandler->alterColumn($tableName, $columnName, " varchar(45) NOT NULL DEFAULT '' "); -// $this->tableHandler->update($tableName, [$columnName => "INET_NTOA($columnName)"], '', false); -// } -// } + // if ($this->tableHandler->useTable($tableName)) { + // $attributes = $this->tableHandler->getColumnAttributes($tableName, $columnName); + // if (false !== \mb_strpos($attributes, ' int(')) { + // if (false === \mb_strpos($attributes, 'unsigned')) { + // $this->tableHandler->alterColumn($tableName, $columnName, " bigint(16) NOT NULL DEFAULT '0' "); + // $this->tableHandler->update($tableName, [$columnName => "4294967296 + $columnName"], "WHERE $columnName < 0", false); + // } + // $this->tableHandler->alterColumn($tableName, $columnName, " varchar(45) NOT NULL DEFAULT '' "); + // $this->tableHandler->update($tableName, [$columnName => "INET_NTOA($columnName)"], '', false); + // } + // } } /** @@ -88,20 +87,20 @@ private function convertIPAddresses(string $tableName, string $columnName): void */ private function moveDoColumns(): void { -// $tableName = 'newbb_posts_text'; -// $srcTableName = 'newbb_posts'; -// if ($this->tableHandler->useTable($tableName) -// && $this->tableHandler->useTable($srcTableName)) { -// $attributes = $this->tableHandler->getColumnAttributes($tableName, 'dohtml'); -// if (false === $attributes) { -// $this->synchronizeTable($tableName); -// $updateTable = $GLOBALS['xoopsDB']->prefix($tableName); -// $joinTable = $GLOBALS['xoopsDB']->prefix($srcTableName); -// $sql = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n" . "SET t1.dohtml = t2.dohtml, t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n" . ' , t1.doimage = t2.doimage, t1.dobr = t2.dobr'; -// $this->tableHandler->addToQueue($sql); -// } -// } - } + // $tableName = 'newbb_posts_text'; + // $srcTableName = 'newbb_posts'; + // if ($this->tableHandler->useTable($tableName) + // && $this->tableHandler->useTable($srcTableName)) { + // $attributes = $this->tableHandler->getColumnAttributes($tableName, 'dohtml'); + // if (false === $attributes) { + // $this->synchronizeTable($tableName); + // $updateTable = $GLOBALS['xoopsDB']->prefix($tableName); + // $joinTable = $GLOBALS['xoopsDB']->prefix($srcTableName); + // $sql = "UPDATE `$updateTable` t1 INNER JOIN `$joinTable` t2 ON t1.post_id = t2.post_id \n" . "SET t1.dohtml = t2.dohtml, t1.dosmiley = t2.dosmiley, t1.doxcode = t2.doxcode\n" . ' , t1.doimage = t2.doimage, t1.dobr = t2.dobr'; + // $this->tableHandler->addToQueue($sql); + // } + // } + } /** * rename table if needed @@ -122,8 +121,8 @@ private function renameColumns(): void { foreach ($this->renameColumns as $tableName) { if ($this->tableHandler->useTable($tableName)) { - $oldName = $tableName['from']; - $newName = $tableName['to']; + $oldName = $tableName['from']; + $newName = $tableName['to']; $attributes = $this->tableHandler->getColumnAttributes($tableName, $oldName); if (false !== \strpos($attributes, ' int(')) { $this->tableHandler->alterColumn($tableName, $oldName, $attributes, $newName); @@ -146,8 +145,8 @@ protected function preSyncActions(): void // columns dohtml, dosmiley, doxcode, doimage and dobr moved between tables as some point $this->moveDoColumns(); // Convert IP address columns from int to readable varchar(45) for IPv6 -// $this->convertIPAddresses('newbb_posts', 'poster_ip'); -// $this->convertIPAddresses('newbb_report', 'reporter_ip'); + // $this->convertIPAddresses('newbb_posts', 'poster_ip'); + // $this->convertIPAddresses('newbb_report', 'reporter_ip'); // rename table if ($this->renameTables && \is_array($this->renameTables)) { diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index a820a810..42604b1a 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -31,16 +31,23 @@ Helper }; - /** * Class SysUtility */ class SysUtility { - use VersionChecks; //checkVerXoops, checkVerPhp Traits - use ServerStats; // getServerStats Trait - use FilesManagement; // Files Management Trait -// use ModuleStats; // ModuleStats Trait + use VersionChecks; + + //checkVerXoops, checkVerPhp Traits + + use ServerStats; + + // getServerStats Trait + + use FilesManagement; + + // Files Management Trait + // use ModuleStats; // ModuleStats Trait //--------------- Common module methods ----------------------------- @@ -65,7 +72,7 @@ public static function selectSorting(string $text, string $form_sort): string $select_view = ''; $moduleDirName = \basename(\dirname(__DIR__)); - $helper = Helper::getInstance(); + $helper = Helper::getInstance(); //$pathModIcon16 = XOOPS_URL . '/modules/' . $moduleDirName . '/' . $helper->getConfig('modicons16'); $pathModIcon16 = $helper->url($helper->getModule()->getInfo('modicons16')); @@ -114,7 +121,6 @@ public static function metaKeywords(string $content): void } } - public static function metaDescription(string $content): void { global $xoopsTpl, $xoTheme; @@ -138,18 +144,17 @@ public static function enumerate(string $tableName, string $columnName): ?array $sql = 'SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = "' . $table . '" AND COLUMN_NAME = "' . $columnName . '"'; $result = $GLOBALS['xoopsDB']->query($sql); if (!$result) { -// exit($GLOBALS['xoopsDB']->error()); - $logger = \XoopsLogger::getInstance(); + // exit($GLOBALS['xoopsDB']->error()); + $logger = \XoopsLogger::getInstance(); $logger->handleError(\E_USER_WARNING, $sql, __FILE__, __LINE__); return null; } $row = $GLOBALS['xoopsDB']->fetchBoth($result); - $enumList = \explode(',', \str_replace("'", '', \mb_substr($row['COLUMN_TYPE'], 5, - 6))); + $enumList = \explode(',', \str_replace("'", '', \mb_substr($row['COLUMN_TYPE'], 5, -6))); return $enumList; } - /** * Clone a record in a dB * @@ -162,7 +167,7 @@ public static function enumerate(string $tableName, string $columnName): ?array public static function cloneRecord(string $tableName, string $idField, int $id): ?int { $newId = null; - $table = $GLOBALS['xoopsDB']->prefix($tableName); + $table = $GLOBALS['xoopsDB']->prefix($tableName); // copy content of the record you wish to clone $sql = "SELECT * FROM $table WHERE $idField='" . $id . "' "; $tempTable = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql), \MYSQLI_ASSOC); @@ -241,7 +246,7 @@ public static function truncateHtml( $content_length = \mb_strlen(\preg_replace('/&[0-9a-z]{2,8};|&#\d{1,7};|[0-9a-f]{1,6};/i', ' ', $line_matchings[2])); if ($total_length + $content_length > $length) { // the number of characters which are left - $left = $length - $total_length; + $left = $length - $total_length; $entities_length = 0; // search for html entities if (\preg_match_all('/&[0-9a-z]{2,8};|&#\d{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, \PREG_OFFSET_CAPTURE)) { @@ -260,7 +265,7 @@ public static function truncateHtml( // maximum length is reached, so get off the loop break; } - $truncate .= $line_matchings[2]; + $truncate .= $line_matchings[2]; $total_length += $content_length; // if the maximum length is reached, get off the loop @@ -298,7 +303,7 @@ public static function truncateHtml( /** * Get correct text editor based on user rights * - * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor + * @return \XoopsFormDhtmlTextArea|\XoopsFormEditor */ public static function getEditor(?\Xmf\Module\Helper $helper = null, ?array $options = null): ?\XoopsFormTextArea { @@ -306,17 +311,17 @@ public static function getEditor(?\Xmf\Module\Helper $helper = null, ?array $opt /** @var Helper $helper */ if (null === $options) { - $options = []; - $options['name'] = 'Editor'; - $options['value'] = 'Editor'; - $options['rows'] = 10; - $options['cols'] = '100%'; - $options['width'] = '100%'; + $options = []; + $options['name'] = 'Editor'; + $options['value'] = 'Editor'; + $options['rows'] = 10; + $options['cols'] = '100%'; + $options['width'] = '100%'; $options['height'] = '400px'; } if (null === $helper) { - $helper = Helper::getInstance(); + $helper = Helper::getInstance(); } $isAdmin = $helper->isUserAdmin(); @@ -353,7 +358,6 @@ public static function fieldExists(string $fieldname, string $table): bool return ($GLOBALS['xoopsDB']->getRowsNum($result) > 0); } - /** * Function responsible for checking if a directory exists, we can also write in and create an index.html file * @@ -386,7 +390,7 @@ public static function tableExists(string $tablename): bool ); $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); - return $GLOBALS['xoopsDB']->getRowsNum($result) > 0 ; + return $GLOBALS['xoopsDB']->getRowsNum($result) > 0; } /** diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index 3ff7492b..be973a90 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -8,7 +8,7 @@ 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. @@ -26,6 +26,7 @@ use Xmf\Request; use Xmf\Yaml; use XoopsModules\Rssfit\Helper; + /** @var Helper $helper */ /** @@ -33,16 +34,15 @@ */ class TestdataButtons { - //functions for import buttons public static function loadButtonConfig(Admin $adminObject): void { - $moduleDirName = \basename(\dirname(__DIR__, 2)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); - $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; - $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps + $moduleDirName = \basename(\dirname(__DIR__, 2)); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $config = Yaml::readWrapped($yamlFile); // work with phpmyadmin YAML dumps $displaySampleButton = $config['displaySampleButton']; - $helper = Helper::getInstance(); + $helper = Helper::getInstance(); if (1 == $displaySampleButton) { \xoops_loadLanguage('admin/modulesadmin', 'system'); @@ -59,7 +59,7 @@ public static function loadButtonConfig(Admin $adminObject): void public static function hideButtons(): void { - $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; $app = []; $app['displaySampleButton'] = 0; Yaml::save($app, $yamlFile); @@ -68,7 +68,7 @@ public static function hideButtons(): void public static function showButtons(): void { - $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; $app = []; $app['displaySampleButton'] = 1; Yaml::save($app, $yamlFile); diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 47fdd4db..b96b8eec 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -31,7 +31,7 @@ trait VersionChecks * @param string|null $requiredVer * @return bool true if meets requirements, false if not */ - public static function checkVerXoops(\XoopsModule $module = null, string $requiredVer = null): bool + public static function checkVerXoops(?\XoopsModule $module = null, ?string $requiredVer = null): bool { $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); @@ -63,7 +63,7 @@ public static function checkVerXoops(\XoopsModule $module = null, string $requir * * @return bool true if meets requirements, false if not */ - public static function checkVerPhp(\XoopsModule $module = null): bool + public static function checkVerPhp(?\XoopsModule $module = null): bool { $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); diff --git a/class/Common/index.php b/class/Common/index.php index 6a505435..2ea9b7d9 100644 --- a/class/Common/index.php +++ b/class/Common/index.php @@ -1,2 +1,3 @@ $b['timestamp']) ? -1 : 1; } - public function cleanupChars(&$text, bool $strip = true, bool $dospec = true, bool $dosub = false): void { if ($strip) { @@ -398,7 +394,6 @@ public function subFeedUrl(string $filename = ''): ?string return null; } - public function checkSubFeed(array &$feed): void { if (!empty($feed['plugin'])) { @@ -420,7 +415,6 @@ public function checkSubFeed(array &$feed): void } } - public function buildFeed(array &$feed): void { $this->getChannel($feed); diff --git a/class/Helper.php b/class/Helper.php index 6bf8a0af..7c775eb1 100644 --- a/class/Helper.php +++ b/class/Helper.php @@ -63,9 +63,9 @@ public function getDirname(): string */ public function getHandler($name): ?\XoopsPersistableObjectHandler { - $ret = null; + $ret = null; - $class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler'; + $class = __NAMESPACE__ . '\\' . \ucfirst($name) . 'Handler'; if (!\class_exists($class)) { throw new \RuntimeException("Class '$class' not found"); } diff --git a/class/MiscHandler.php b/class/MiscHandler.php index a48950b5..cbb7c9ac 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -41,10 +41,10 @@ class MiscHandler extends \XoopsPersistableObjectHandler public $helper; /** - * @param \XoopsMySQLDatabase|null $db + * @param \XoopsMySQLDatabase|null $db * @param null|\XoopsModules\Rssfit\Helper $helper */ - public function __construct(\XoopsMySQLDatabase $db = null, $helper = null) + public function __construct(?\XoopsMySQLDatabase $db = null, $helper = null) { if (null === $helper) { $helper = Helper::getInstance(); @@ -54,8 +54,8 @@ public function __construct(\XoopsMySQLDatabase $db = null, $helper = null) if (null === $db) { $db = \XoopsDatabaseFactory::getDatabaseConnection(); } - $this->db = $db; - $table = $db->prefix($helper->getDirname() . '_misc'); + $this->db = $db; + $table = $db->prefix($helper->getDirname() . '_misc'); $this->dbTable = $table; parent::__construct($db, $table, Misc::class, 'misc_id', 'misc_title'); @@ -64,7 +64,7 @@ public function __construct(\XoopsMySQLDatabase $db = null, $helper = null) /** * @param \XoopsMySQLDatabase|null $db */ - public function getInstance(\XoopsMySQLDatabase $db = null): MiscHandler + public function getInstance(?\XoopsMySQLDatabase $db = null): MiscHandler { static $instance; if (null === $instance) { @@ -92,7 +92,7 @@ public function create($isNew = true): ?\XoopsObject // public function get($id = null, $fields = '*') /** - * @param null|int $id + * @param null|int $id * @param null|array $fields * @return bool|mixed|\XoopsObject|null */ @@ -131,10 +131,10 @@ public function getCount($criteria = null): ?int */ public function getObjects2($criteria = null, string $fields = '*', string $key = ''): ?array { - $ret = null; - $limit = $start = 0; -// $fields = '*'; - $sql = 'SELECT ' . $fields . ' FROM ' . $this->dbTable; + $ret = null; + $limit = $start = 0; + // $fields = '*'; + $sql = 'SELECT ' . $fields . ' FROM ' . $this->dbTable; if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); if ('' != $criteria->getSort()) { @@ -174,7 +174,7 @@ public function getObjects2($criteria = null, string $fields = '*', string $key */ public function insert(\XoopsObject $object, $force = false) { -// $force = false; + // $force = false; if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) { return false; } @@ -196,7 +196,7 @@ public function insert(\XoopsObject $object, $force = false) } if ($object->isNew() || empty($cleanvars[$this->objKey])) { $cleanvars[$this->objKey] = $this->db->genId($this->dbTable . '_' . $this->objKey . '_seq'); - $sql = 'INSERT INTO ' . $this->dbTable . ' (' . \implode(',', \array_keys($cleanvars)) . ') VALUES (' . \implode(',', $cleanvars) . ')'; + $sql = 'INSERT INTO ' . $this->dbTable . ' (' . \implode(',', \array_keys($cleanvars)) . ') VALUES (' . \implode(',', $cleanvars) . ')'; } else { unset($cleanvars[$this->objKey]); $sql = 'UPDATE ' . $this->dbTable . ' SET'; @@ -256,7 +256,7 @@ public function modifyObjects(?\Criteria $criteria = null, array $fields = [], b public function delete(\XoopsObject $object, $force = false): bool { -// $force = false; + // $force = false; if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) { return false; } diff --git a/class/PluginHandler.php b/class/PluginHandler.php index cb1e5393..3dcdea0f 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -35,8 +35,8 @@ class PluginHandler extends \XoopsPersistableObjectHandler public $dbTable; public $objClass = Plugin::class; public $objKey = 'rssf_conf_id'; - public $sortby = 'rssf_order'; - public $order = 'ASC'; + public $sortby = 'rssf_order'; + public $order = 'ASC'; /** * @var \XoopsModules\Rssfit\Helper */ @@ -46,7 +46,7 @@ class PluginHandler extends \XoopsPersistableObjectHandler * @param \XoopsDatabase|null $db * @param null|\XoopsModules\Rssfit\Helper $helper */ - public function __construct(\XoopsDatabase $db = null, $helper = null) + public function __construct(?\XoopsDatabase $db = null, $helper = null) { if (null === $helper) { $helper = \XoopsModules\Rssfit\Helper::getInstance(); @@ -59,7 +59,7 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) $this->db = $db; // $this->dbTable = $db->prefix($helper->getDirname() . '_plugins'); - $table = $db->prefix($helper->getDirname() . '_plugins'); + $table = $db->prefix($helper->getDirname() . '_plugins'); $this->dbTable = $table; parent::__construct($db, $table, Plugin::class, 'rssf_conf_id', 'rssf_filename'); @@ -68,7 +68,7 @@ public function __construct(\XoopsDatabase $db = null, $helper = null) /** * @param \XoopsDatabase|null $db */ - public function getInstance(\XoopsDatabase $db = null): \XoopsPersistableObjectHandler + public function getInstance(?\XoopsDatabase $db = null): \XoopsPersistableObjectHandler { static $instance; if (null === $instance) { @@ -96,7 +96,7 @@ public function create($isNew = true): ?\XoopsObject // public function get($id, $fields = '*') /** - * @param null|int $id + * @param null|int $id * @param null|array $fields * @return bool|mixed|\XoopsObject|null */ @@ -113,7 +113,7 @@ public function get($id = null, $fields = null): ?\XoopsObject } /** - * @param bool $force flag to force the query execution despite security settings + * @param bool $force flag to force the query execution despite security settings * @return array|bool|int|mixed|null */ public function insert(\XoopsObject $object, $force = true) @@ -139,7 +139,7 @@ public function insert(\XoopsObject $object, $force = true) } if ($object->isNew() || empty($cleanvars[$this->objKey])) { $cleanvars[$this->objKey] = $this->db->genId($this->dbTable . '_' . $this->objKey . '_seq'); - $sql = 'INSERT INTO ' . $this->dbTable . ' (' . \implode(',', \array_keys($cleanvars)) . ') VALUES (' . \implode(',', $cleanvars) . ')'; + $sql = 'INSERT INTO ' . $this->dbTable . ' (' . \implode(',', \array_keys($cleanvars)) . ') VALUES (' . \implode(',', $cleanvars) . ')'; } else { unset($cleanvars[$this->objKey]); $sql = 'UPDATE ' . $this->dbTable . ' SET'; @@ -159,7 +159,7 @@ public function insert(\XoopsObject $object, $force = true) return false; } -// if (false === $object->getVar($this->objKey)) { + // if (false === $object->getVar($this->objKey)) { if (0 === (int)$object->getVar($this->objKey)) { $object->assignVar($this->objKey, $this->db->getInsertId()); } @@ -168,7 +168,7 @@ public function insert(\XoopsObject $object, $force = true) } /** - * @param bool $force + * @param bool $force */ public function delete(\XoopsObject $object, $force = false): bool { @@ -220,7 +220,7 @@ public function getObjects2($criteria = null, string $fields = '*', string $key } $result = $this->db->query($sql, $limit, $start); if ($result instanceof \mysqli_result) { - $ret = []; + $ret = []; while (false !== ($myrow = $this->db->fetchArray($result))) { $object = new $this->objClass(); $object->assignVars($myrow); @@ -245,7 +245,7 @@ public function modifyObjects($criteria = null, array $fields = [], bool $force { if ($fields && \is_array($fields)) { $object = new $this->objClass(); - $sql = ''; + $sql = ''; foreach ($fields as $k => $v) { $sql .= $k . ' = '; $sql .= 3 == $object->vars[$k]['data_type'] ? (int)$v : $this->db->quoteString($v); @@ -298,13 +298,12 @@ public function forceDeactivate(\XoopsObject $object, string $type = 'rssf_activ return true; } - public function &getPluginFileList(): ?array { $ret = null; $objs = $this->getObjects2(null, 'rssf_filename'); if (\is_array($objs) && !empty($objs)) { - $ret = []; + $ret = []; foreach ($objs as $o) { $ret[] = $o->getVar('rssf_filename'); } @@ -322,10 +321,10 @@ public function checkPlugin(\XoopsObject $object) global $moduleHandler; $file = \RSSFIT_ROOT_PATH . 'class/Plugins/' . $object->getVar('rssf_filename'); if (\is_file($file)) { - $ret = []; + $ret = []; //mb $require_once = require $file; - $name = \explode('.', $object->getVar('rssf_filename')); - $class = __NAMESPACE__ . '\Plugins\\' . \ucfirst($name[0]); + $name = \explode('.', $object->getVar('rssf_filename')); + $class = __NAMESPACE__ . '\Plugins\\' . \ucfirst($name[0]); if (\class_exists($class)) { $handler = new $class(); if (!\method_exists($handler, 'loadmodule') || !\method_exists($handler, 'grabentries')) { diff --git a/class/PluginInterface.php b/class/PluginInterface.php index 4843ace5..780050cc 100644 --- a/class/PluginInterface.php +++ b/class/PluginInterface.php @@ -8,7 +8,6 @@ */ interface PluginInterface { - /** * @return \XoopsModule */ diff --git a/class/Plugins/Adslight.php b/class/Plugins/Adslight.php index fb07e1b9..4a8487c0 100644 --- a/class/Plugins/Adslight.php +++ b/class/Plugins/Adslight.php @@ -30,10 +30,10 @@ * XOOPS version: 2.0.13.2 / 2.2.3 / 2.3.2b / 2.4.3 */ +use XoopsModules\Adslight\Helper as PluginHelper; use XoopsModules\Rssfit\{ AbstractPlugin }; -use XoopsModules\Adslight\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); @@ -49,14 +49,14 @@ final class Adslight extends AbstractPlugin /** * @return \XoopsModule */ - public function loadModule(): ?\XoopsModule{ - + public function loadModule(): ?\XoopsModule + { $mod = null; if (\class_exists(PluginHelper::class)) { - $this->helper = PluginHelper::getInstance(); - $this->module = $this->helper->getModule(); + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); - $mod = $this->module; + $mod = $this->module; // $this->dirname = $this->helper->getDirname(); } @@ -66,7 +66,7 @@ public function loadModule(): ?\XoopsModule{ /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $ret = null; $i = 0; @@ -74,16 +74,16 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array $result = $xoopsDB->query($sql, $this->grab, 0); if ($result instanceof \mysqli_result) { $ret = []; - while (false !== ($row = $xoopsDB->fetchArray($result))) { - $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewads.php?lid=' . $row['lid'] ?? ''; - $ret[$i]['title'] = $row['title']; - $ret[$i]['link'] = $link; - $ret[$i]['timestamp'] = $row['date']; - $ret[$i]['description'] = $row['desctext']; // $myts->displayTarea($row['desctext']); - $ret[$i]['extras'] = []; - $i++; + while (false !== ($row = $xoopsDB->fetchArray($result))) { + $link = XOOPS_URL . '/modules/' . $this->dirname . '/viewads.php?lid=' . $row['lid'] ?? ''; + $ret[$i]['title'] = $row['title']; + $ret[$i]['link'] = $link; + $ret[$i]['timestamp'] = $row['date']; + $ret[$i]['description'] = $row['desctext']; // $myts->displayTarea($row['desctext']); + $ret[$i]['extras'] = []; + $i++; + } } - } return $ret; } diff --git a/class/Plugins/Ams.php b/class/Plugins/Ams.php index 0c2b142e..e672c87e 100644 --- a/class/Plugins/Ams.php +++ b/class/Plugins/Ams.php @@ -32,10 +32,11 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ +use XoopsModules\Ams\Story; use XoopsModules\Rssfit\{ AbstractPlugin }; -use XoopsModules\Ams\Story; + //use XoopsModules\Ams\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { @@ -53,9 +54,9 @@ final class Ams extends AbstractPlugin /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { - $ret = null; + $ret = null; // @require_once XOOPS_ROOT_PATH . '/modules/AMS/class/class.newsstory.php'; $myts = \MyTextSanitizer::getInstance(); $ams = Story::getAllPublished($this->grab, 0); diff --git a/class/Plugins/Apcal.php b/class/Plugins/Apcal.php index f903ba09..dc34217c 100644 --- a/class/Plugins/Apcal.php +++ b/class/Plugins/Apcal.php @@ -32,10 +32,10 @@ * XOOPS version: 2.0.18.1 */ +use XoopsModules\Apcal\Helper as PluginHelper; use XoopsModules\Rssfit\{ AbstractPlugin }; -use XoopsModules\Apcal\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); @@ -51,14 +51,14 @@ final class Apcal extends AbstractPlugin /** * @return \XoopsModule */ - public function loadModule(): ?\XoopsModule{ - + public function loadModule(): ?\XoopsModule + { $mod = null; if (\class_exists(PluginHelper::class)) { - $this->helper = PluginHelper::getInstance(); - $this->module = $this->helper->getModule(); + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); - $mod = $this->module; + $mod = $this->module; // $this->dirname = $this->helper->getDirname(); } @@ -68,7 +68,7 @@ public function loadModule(): ?\XoopsModule{ /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $myts = \MyTextSanitizer::getInstance(); $ret = null; diff --git a/class/Plugins/Comments.php b/class/Plugins/Comments.php index 130af816..02e66929 100644 --- a/class/Plugins/Comments.php +++ b/class/Plugins/Comments.php @@ -38,6 +38,7 @@ use XoopsModules\Rssfit\{ AbstractPlugin }; + //use XoopsModules\System\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { @@ -55,7 +56,7 @@ final class Comments extends AbstractPlugin /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $myts = \MyTextSanitizer::getInstance(); $ret = null; @@ -70,7 +71,7 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array $comment_config = []; if (\count($comments) > 0) { $modules = $GLOBALS['module_handler']->getObjects(new Criteria('hascomments', 1), true); - $ret = []; + $ret = []; foreach (\array_keys($comments) as $i) { $mid = $comments[$i]->getVar('com_modid'); if (!isset($comment_config[$mid])) { diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index a7ad0428..1b61010d 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -49,10 +49,10 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ +use XoopsModules\Extcal\Helper as PluginHelper; use XoopsModules\Rssfit\{ AbstractPlugin }; -use XoopsModules\Extcal\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); @@ -69,25 +69,24 @@ final class Extcal extends AbstractPlugin /** * @return \XoopsModule */ - public function loadModule(): ?\XoopsModule{ - + public function loadModule(): ?\XoopsModule + { $mod = null; if (\class_exists(PluginHelper::class)) { - $this->helper = PluginHelper::getInstance(); - $this->module = $this->helper->getModule(); + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); - $mod = $this->module; + $mod = $this->module; // $this->dirname = $this->helper->getDirname(); } return $mod; } - /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $myts = \MyTextSanitizer::getInstance(); $ret = null; @@ -103,21 +102,21 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array $eventHandler = PluginHelper::getInstance()->getHandler('Event'); $catHandler = PluginHelper::getInstance()->getHandler('Category'); - $events = $eventHandler->getUpcomingEvent(0, $this->grab, 0); + $events = $eventHandler->getUpcomingEvent(0, $this->grab, 0); if (\is_array($events)) { $ret = []; foreach ($events as $event) { ++$i; - $cat = $catHandler->getCat($event->getVar('cat_id'), 0); - $category = $cat->getVar('cat_name'); - $link = XOOPS_URL . '/modules/extcal/event.php?event=' . $event->getVar('event_id'); + $cat = $catHandler->getCat($event->getVar('cat_id'), 0); + $category = $cat->getVar('cat_name'); + $link = XOOPS_URL . '/modules/extcal/event.php?event=' . $event->getVar('event_id'); $event_start = \formatTimestamp($event->getVar('event_start'), $long_form); $temp = \htmlspecialchars($event->getVar('event_title'), \ENT_QUOTES); $title = \xoops_utf8_encode($temp); $temp = \htmlspecialchars($event->getVar('event_desc'), \ENT_QUOTES); $description = \xoops_utf8_encode($temp); - $address = $event->getVar('event_address'); + $address = $event->getVar('event_address'); $desc_link = $event->getVar('event_url'); if ('' == $desc_link) { @@ -132,12 +131,12 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array $desc .= "
      What:$description
      '; - $ret[$i]['title'] = $category . ': ' . $title; - $ret[$i]['link'] = $link; + $ret[$i]['title'] = $category . ': ' . $title; + $ret[$i]['link'] = $link; $ret[$i]['description'] = $desc; - $ret[$i]['timestamp'] = $event->getVar('event_submitdate'); + $ret[$i]['timestamp'] = $event->getVar('event_submitdate'); // $ret[$i]['timestamp'] = time(); - $ret[$i]['guid'] = $link; + $ret[$i]['guid'] = $link; $ret[$i]['category'] = $category; } } diff --git a/class/Plugins/Lexikon.php b/class/Plugins/Lexikon.php index cc9be598..2c264dbd 100644 --- a/class/Plugins/Lexikon.php +++ b/class/Plugins/Lexikon.php @@ -31,10 +31,10 @@ * XOOPS verson: 2.0.13.2 / 2.2.3 (!) */ +use XoopsModules\Lexikon\Helper as PluginHelper; use XoopsModules\Rssfit\{ AbstractPlugin }; -use XoopsModules\Lexikon\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); @@ -50,14 +50,14 @@ final class Lexikon extends AbstractPlugin /** * @return \XoopsModule */ - public function loadModule(): ?\XoopsModule{ - + public function loadModule(): ?\XoopsModule + { $mod = null; if (\class_exists(PluginHelper::class)) { - $this->helper = PluginHelper::getInstance(); - $this->module = $this->helper->getModule(); + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); - $mod = $this->module; + $mod = $this->module; // $this->dirname = $this->helper->getDirname(); } @@ -67,7 +67,7 @@ public function loadModule(): ?\XoopsModule{ /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $myts = \MyTextSanitizer::getInstance(); //$permiscHandler = xoops_getHandler('groupperm'); diff --git a/class/Plugins/Myalbum.php b/class/Plugins/Myalbum.php index 01e7974a..8a669848 100644 --- a/class/Plugins/Myalbum.php +++ b/class/Plugins/Myalbum.php @@ -49,10 +49,10 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ +use XoopsModules\Myalbum\Helper as PluginHelper; use XoopsModules\Rssfit\{ AbstractPlugin }; -use XoopsModules\Myalbum\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); @@ -94,7 +94,7 @@ public function myGetUnameFromId(int $uid): string /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $myts = \MyTextSanitizer::getInstance(); $ret = null; diff --git a/class/Plugins/Mylinks.php b/class/Plugins/Mylinks.php index a5d8ad91..ab8f1128 100644 --- a/class/Plugins/Mylinks.php +++ b/class/Plugins/Mylinks.php @@ -32,10 +32,10 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ +use XoopsModules\Mylinks\Helper as PluginHelper; use XoopsModules\Rssfit\{ AbstractPlugin }; -use XoopsModules\Mylinks\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); @@ -52,14 +52,14 @@ final class Mylinks extends AbstractPlugin /** * @return \XoopsModule */ - public function loadModule(): ?\XoopsModule{ - + public function loadModule(): ?\XoopsModule + { $mod = null; if (\class_exists(PluginHelper::class)) { - $this->helper = PluginHelper::getInstance(); - $this->module = $this->helper->getModule(); + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); - $mod = $this->module; + $mod = $this->module; // $this->dirname = $this->helper->getDirname(); } @@ -69,12 +69,12 @@ public function loadModule(): ?\XoopsModule{ /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { - $myts = \MyTextSanitizer::getInstance(); - $ret = null; - $i = 0; - $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; + $myts = \MyTextSanitizer::getInstance(); + $ret = null; + $i = 0; + $sql = 'SELECT l.lid, l.cid, l.title, l.date, t.description FROM ' . $xoopsDB->prefix('mylinks_links') . ' l, ' . $xoopsDB->prefix('mylinks_text') . ' t WHERE l.status>0 AND l.lid=t.lid ORDER BY date DESC'; $result = $xoopsDB->query($sql, $this->grab, 0); if ($result instanceof \mysqli_result) { $ret = []; diff --git a/class/Plugins/Newbb.php b/class/Plugins/Newbb.php index 23b0e99f..981826aa 100644 --- a/class/Plugins/Newbb.php +++ b/class/Plugins/Newbb.php @@ -32,10 +32,10 @@ * XOOPS version: 2.0.13.2 */ +use XoopsModules\Newbb\Helper as PluginHelper; use XoopsModules\Rssfit\{ AbstractPlugin }; -use XoopsModules\Newbb\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); @@ -52,14 +52,14 @@ final class Newbb extends AbstractPlugin /** * @return \XoopsModule */ - public function loadModule(): ?\XoopsModule{ - + public function loadModule(): ?\XoopsModule + { $mod = null; if (\class_exists(PluginHelper::class)) { - $this->helper = PluginHelper::getInstance(); - $this->module = $this->helper->getModule(); + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); - $mod = $this->module; + $mod = $this->module; // $this->dirname = $this->helper->getDirname(); } @@ -69,7 +69,7 @@ public function loadModule(): ?\XoopsModule{ /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { require_once XOOPS_ROOT_PATH . '/modules/' . $this->dirname . '/class/class.forumposts.php'; $myts = \MyTextSanitizer::getInstance(); diff --git a/class/Plugins/News.php b/class/Plugins/News.php index 7c075f8b..7138a093 100644 --- a/class/Plugins/News.php +++ b/class/Plugins/News.php @@ -32,12 +32,12 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ +use XoopsModules\News\Helper as PluginHelper; +use XoopsModules\News\NewsStory; +use XoopsModules\News\Utility; use XoopsModules\Rssfit\{ AbstractPlugin }; -use XoopsModules\News\NewsStory; -use XoopsModules\News\Utility; -use XoopsModules\News\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); @@ -54,7 +54,7 @@ final class News extends AbstractPlugin /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $ret = null; // @require_once XOOPS_ROOT_PATH . '/modules/news/class/class.newsstory.php'; diff --git a/class/Plugins/Oledrion.php b/class/Plugins/Oledrion.php index 6b4ac6e7..e14c05cd 100644 --- a/class/Plugins/Oledrion.php +++ b/class/Plugins/Oledrion.php @@ -22,11 +22,11 @@ * @author XOOPS Development Team */ +use XoopsModules\Oledrion\Helper as PluginHelper; +use XoopsModules\Oledrion\Parameters; use XoopsModules\Rssfit\{ AbstractPlugin }; -use XoopsModules\Oledrion\Parameters; -use XoopsModules\Oledrion\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { exit(); @@ -43,14 +43,14 @@ final class Oledrion extends AbstractPlugin /** * @return \XoopsModule */ - public function loadModule(): ?\XoopsModule{ - + public function loadModule(): ?\XoopsModule + { $mod = null; if (\class_exists(PluginHelper::class)) { - $this->helper = PluginHelper::getInstance(); - $this->module = $this->helper->getModule(); + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); - $mod = $this->module; + $mod = $this->module; // $this->dirname = $this->helper->getDirname(); } @@ -60,7 +60,7 @@ public function loadModule(): ?\XoopsModule{ /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $myts = \MyTextSanitizer::getInstance(); $ret = null; @@ -68,13 +68,13 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array $helper = PluginHelper::getInstance(); $productsHandler = $helper->getHandler('Products'); $items = $productsHandler->getRecentProducts(new Parameters(['start' => 0, 'limit' => $this->grab])); - $i = 0; + $i = 0; if (false !== $items && \count($items) > 0) { $ret = []; foreach ($items as $item) { - $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); - $ret[$i]['title'] = $item->getVar('product_title', 'n'); + $ret[$i]['link'] = $ret[$i]['guid'] = $item->getLink(); + $ret[$i]['title'] = $item->getVar('product_title', 'n'); $ret[$i]['timestamp'] = $item->getVar('product_submitted'); if ('' != \xoops_trim($item->getVar('product_summary'))) { $description = $item->getVar('product_summary'); @@ -82,8 +82,8 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array $description = $item->getVar('product_description'); } $ret[$i]['description'] = $description; - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; $i++; } } diff --git a/class/Plugins/Pical.php b/class/Plugins/Pical.php index daa49cb1..e6d0905e 100644 --- a/class/Plugins/Pical.php +++ b/class/Plugins/Pical.php @@ -35,6 +35,7 @@ use XoopsModules\Rssfit\{ AbstractPlugin }; + //use XoopsModules\Pical\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { @@ -51,7 +52,7 @@ final class Pical extends AbstractPlugin /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $myts = \MyTextSanitizer::getInstance(); $ret = null; diff --git a/class/Plugins/Publisher.php b/class/Plugins/Publisher.php index 60c2f353..3243cae0 100644 --- a/class/Plugins/Publisher.php +++ b/class/Plugins/Publisher.php @@ -32,12 +32,12 @@ * XOOPS version: 2.0.13.2 / 2.2.3 */ -use XoopsModules\Rssfit\{ - AbstractPlugin -}; use XoopsModules\Publisher\{ - ItemHandler, Helper as PluginHelper, + ItemHandler, +}; +use XoopsModules\Rssfit\{ + AbstractPlugin }; if (!\defined('RSSFIT_ROOT_PATH')) { @@ -54,14 +54,14 @@ final class Publisher extends AbstractPlugin /** * @return \XoopsModule */ - public function loadModule(): ?\XoopsModule{ - + public function loadModule(): ?\XoopsModule + { $mod = null; if (\class_exists(PluginHelper::class)) { - $this->helper = PluginHelper::getInstance(); - $this->module = $this->helper->getModule(); + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); - $mod = $this->module; + $mod = $this->module; // $this->dirname = $this->helper->getDirname(); } diff --git a/class/Plugins/Sample.php b/class/Plugins/Sample.php index 9d3cdf69..6bfd17d5 100644 --- a/class/Plugins/Sample.php +++ b/class/Plugins/Sample.php @@ -70,7 +70,7 @@ final class Sample extends AbstractPlugin /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $myts = \MyTextSanitizer::getInstance(); $ret = null; diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php index d7175586..9cbefdd1 100644 --- a/class/Plugins/Smartfaq.php +++ b/class/Plugins/Smartfaq.php @@ -52,25 +52,24 @@ final class Smartfaq extends AbstractPlugin /** * @return \XoopsModule */ - public function loadModule(): ?\XoopsModule{ - + public function loadModule(): ?\XoopsModule + { $mod = null; if (\class_exists(PluginHelper::class)) { - $this->helper = PluginHelper::getInstance(); - $this->module = $this->helper->getModule(); + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); - $mod = $this->module; + $mod = $this->module; // $this->dirname = $this->helper->getDirname(); } return $mod; } - /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $myts = \MyTextSanitizer::getInstance(); $ret = null; diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php index 8b4ae5d3..6f3eb57f 100644 --- a/class/Plugins/Smartpartner.php +++ b/class/Plugins/Smartpartner.php @@ -37,9 +37,9 @@ AbstractPlugin }; use XoopsModules\Smartpartner\{ - PartnerHandler, Constants, - Helper as PluginHelper + Helper as PluginHelper, + PartnerHandler }; if (!\defined('RSSFIT_ROOT_PATH')) { @@ -54,29 +54,27 @@ final class Smartpartner extends AbstractPlugin { public $dirname = 'smartpartner'; - /** * @return \XoopsModule */ - public function loadModule(): ?\XoopsModule{ - + public function loadModule(): ?\XoopsModule + { $mod = null; if (\class_exists(PluginHelper::class)) { - $this->helper = PluginHelper::getInstance(); - $this->module = $this->helper->getModule(); + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); - $mod = $this->module; + $mod = $this->module; // $this->dirname = $this->helper->getDirname(); } return $mod; } - /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $myts = \MyTextSanitizer::getInstance(); $ret = null; @@ -87,11 +85,11 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array if (\is_array($partners) && \count($partners) > 0) { $ret = []; for ($i = 0, $iMax = \count($partners); $i < $iMax; ++$i) { - $ret[$i]['link'] = $ret[$i]['guid'] = SMARTPARTNER_URL . 'partner.php?id=' . $partners[$i]->getVar('id'); - $ret[$i]['title'] = $partners[$i]->getVar('title', 'n'); + $ret[$i]['link'] = $ret[$i]['guid'] = SMARTPARTNER_URL . 'partner.php?id=' . $partners[$i]->getVar('id'); + $ret[$i]['title'] = $partners[$i]->getVar('title', 'n'); $ret[$i]['description'] = $partners[$i]->getVar('summary'); - $ret[$i]['category'] = $this->modname; - $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; + $ret[$i]['category'] = $this->modname; + $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; } } diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php index d82e9187..68016b9b 100644 --- a/class/Plugins/Surnames.php +++ b/class/Plugins/Surnames.php @@ -35,6 +35,7 @@ use XoopsModules\Rssfit\{ AbstractPlugin }; + //use XoopsModules\Surnames\Helper as PluginHelper; if (!\defined('RSSFIT_ROOT_PATH')) { @@ -68,7 +69,7 @@ public function myGetUnameFromId(int $uid): string if ('' == $name) { $name = \htmlspecialchars($thisUser->getVar('uname'), \ENT_QUOTES | \ENT_HTML5); } - $lastUid = $uid; + $lastUid = $uid; $lastName = $name; return $name; @@ -77,18 +78,18 @@ public function myGetUnameFromId(int $uid): string /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $myts = \MyTextSanitizer::getInstance(); $ret = null; - $i = -1; + $i = -1; $lasttime = false; $lastuser = false; - $limit = 10 * $this->grab; + $limit = 10 * $this->grab; - $sql = "SELECT uid, id, surname, notes, DATE_FORMAT(changed_ts,'%Y-%m-%d') as changedate FROM " . $xoopsDB->prefix('surnames'); - $sql .= ' WHERE approved=1 ORDER BY changedate DESC, uid '; + $sql = "SELECT uid, id, surname, notes, DATE_FORMAT(changed_ts,'%Y-%m-%d') as changedate FROM " . $xoopsDB->prefix('surnames'); + $sql .= ' WHERE approved=1 ORDER BY changedate DESC, uid '; $result = $xoopsDB->query($sql, $limit, 0); if ($result instanceof \mysqli_result) { $ret = []; diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php index 5b8766e9..775242cc 100644 --- a/class/Plugins/Wfdownloads.php +++ b/class/Plugins/Wfdownloads.php @@ -52,25 +52,24 @@ final class Wfdownloads extends AbstractPlugin /** * @return \XoopsModule */ - public function loadModule(): ?\XoopsModule{ - + public function loadModule(): ?\XoopsModule + { $mod = null; if (\class_exists(PluginHelper::class)) { - $this->helper = PluginHelper::getInstance(); - $this->module = $this->helper->getModule(); + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); - $mod = $this->module; + $mod = $this->module; // $this->dirname = $this->helper->getDirname(); } return $mod; } - /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $myts = \MyTextSanitizer::getInstance(); diff --git a/class/Plugins/Wflinks.php b/class/Plugins/Wflinks.php index f7569b49..4df9c885 100644 --- a/class/Plugins/Wflinks.php +++ b/class/Plugins/Wflinks.php @@ -55,7 +55,7 @@ final class Wflinks extends AbstractPlugin /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { global $xoopsUser; diff --git a/class/Plugins/Xoopstube.php b/class/Plugins/Xoopstube.php index 2becd0e4..f4512785 100644 --- a/class/Plugins/Xoopstube.php +++ b/class/Plugins/Xoopstube.php @@ -54,14 +54,14 @@ final class Xoopstube extends AbstractPlugin /** * @return \XoopsModule */ - public function loadModule(): ?\XoopsModule{ - + public function loadModule(): ?\XoopsModule + { $mod = null; if (\class_exists(PluginHelper::class)) { - $this->helper = PluginHelper::getInstance(); - $this->module = $this->helper->getModule(); + $this->helper = PluginHelper::getInstance(); + $this->module = $this->helper->getModule(); $this->modname = $this->module->getVar('name'); - $mod = $this->module; + $mod = $this->module; // $this->dirname = $this->helper->getDirname(); } @@ -71,7 +71,7 @@ public function loadModule(): ?\XoopsModule{ /** * @return array */ - public function grabEntries(\XoopsMySQLDatabase $xoopsDB):?array + public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $myts = \MyTextSanitizer::getInstance(); $ret = null; diff --git a/class/Utility.php b/class/Utility.php index fb9a9111..f53faf45 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -55,7 +55,7 @@ public static function genSpecMoreInfo(string $spec, FeedHandler $feedHandler): /** * @param null|string $url */ - public static function rssfGenAnchor(string $url = null, string $text = '', string $target = '', string $title = '', string $class = '', string $id = ''): string + public static function rssfGenAnchor(?string $url = null, string $text = '', string $target = '', string $title = '', string $class = '', string $id = ''): string { if (null !== $url) { $ret = ' 0 @@ -147,7 +147,7 @@ public static function getRssFeedAsHtml(string $feed_url, int $maxItemCount = 10 $arr = \explode(' ', $description); if ($max_words < \count($arr)) { $description = ''; - $wordsCount = 0; + $wordsCount = 0; foreach ($arr as $w) { $description .= $w . ' '; ++$wordsCount; diff --git a/class/index.php b/class/index.php index 6a505435..2ea9b7d9 100644 --- a/class/index.php +++ b/class/index.php @@ -1,2 +1,3 @@ [// 'XX_archive' => 'ZZZZ_archive', + 'renameTables' => [// 'XX_archive' => 'ZZZZ_archive', ], 'renameColumns' => [// 'extcal_event' => ['from' => 'event_etablissement', 'to' => 'event_location'], ], - 'moduleStats' => [ + 'moduleStats' => [ // 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), // 'totalitems' => $helper->getHandler('Item')->getItemsCount(), // 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, [Constants::PUBLISHER_STATUS_SUBMITTED]), ], - 'modCopyright' => " + 'modCopyright' => " XOOPS Project", ]; diff --git a/config/icons.php b/config/icons.php index 92d718d1..42c63a11 100644 --- a/config/icons.php +++ b/config/icons.php @@ -7,8 +7,8 @@ $pathIcon16 = Admin::iconUrl('', '16'); $moduleDirName = \basename(\dirname(__DIR__)); -return[ - 'name' => \mb_strtoupper($moduleDirName) . ' IconConfigurator', +return [ + 'name' => \mb_strtoupper($moduleDirName) . ' IconConfigurator', 'edit' => " . _EDIT . ' title=' . _EDIT . ", 'delete' => " . _DELETE . ' title=' . _DELETE . ", 'clone' => " . _CLONE . ' title=' . _CLONE . ", diff --git a/docs/index.php b/docs/index.php index 6a505435..2ea9b7d9 100644 --- a/docs/index.php +++ b/docs/index.php @@ -1,2 +1,3 @@ myts; +$feedHandler = new FeedHandler($xoopsModuleConfig, $xoopsConfig, $xoopsModule); +$myts = $feedHandler->myts; $pluginHandler = $helper->getHandler('Plugin'); -$miscHandler = $helper->getHandler('Misc'); +$miscHandler = $helper->getHandler('Misc'); $icons = [ 'edit' => " . _EDIT . ", diff --git a/include/index.php b/include/index.php index 6a505435..2ea9b7d9 100644 --- a/include/index.php +++ b/include/index.php @@ -1,2 +1,3 @@ * @author XOOPS Development Team */ + use XoopsModules\Rssfit; require_once \dirname(__DIR__) . '/preloads/autoloader.php'; @@ -32,21 +33,13 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod): bool $helper = Rssfit\Helper::getInstance(); $myts = \MyTextSanitizer::getInstance(); -// rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); + // rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); xoops_loadLanguage('install', $moduleDirName); $intro_setting = ['dohtml' => 1, 'dobr' => 1, 'sub' => stripslashes(_INSTALL_INTRO_SUB)]; - $sql[] = 'INSERT INTO `' - . $xoopsDB->prefix($helper->getDirname() . '_misc') - . '` VALUES (1, ' - . $xoopsDB->quoteString('intro') - . ', ' - . $xoopsDB->quoteString(stripslashes(_INTRO_TITLE)) - . ', ' - . $xoopsDB->quoteString(stripslashes(_INTRO_CONTENT)) - . ', ' - . $xoopsDB->quoteString(serialize($intro_setting)) - . ')'; - $sql[] = rssfInsertChannel($xoopsMod); + $sql[] = 'INSERT INTO `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` VALUES (1, ' . $xoopsDB->quoteString('intro') . ', ' . $xoopsDB->quoteString(stripslashes(_INTRO_TITLE)) . ', ' . $xoopsDB->quoteString(stripslashes(_INTRO_CONTENT)) . ', ' . $xoopsDB->quoteString( + serialize($intro_setting) + ) . ')'; + $sql[] = rssfInsertChannel($xoopsMod); $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "(null, 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; foreach ($sql as $s) { if (false === $xoopsDB->query($s)) { @@ -60,14 +53,14 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod): bool } /** - * @param int $oldversion version number of prevviously installed version + * @param int $oldversion version number of prevviously installed version * */ function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $oldversion): bool { global $xoopsDB, $xoopsConfig; $helper = Rssfit\Helper::getInstance(); -// rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); + // rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); $moduleDirName = \basename(\dirname(__DIR__)); xoops_loadLanguage('install', $moduleDirName); [$rows] = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . " WHERE misc_category = 'channel'")); @@ -75,7 +68,7 @@ function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $oldversion): bo // $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` ADD `misc_setting` TEXT NOT NULL;'; // $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; $intro_setting = ['dohtml' => 1, 'dobr' => 1, 'sub' => _INSTALL_INTRO_SUB]; - $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` SET misc_setting = ' . $xoopsDB->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; + $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` SET misc_setting = ' . $xoopsDB->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; // $sql[] = 'ALTER TABLE `' // . $xoopsDB->prefix($helper->getDirname() . '_plugins') // . "` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; diff --git a/include/oninstall.php b/include/oninstall.php index c1eba1f3..0bae883c 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -17,6 +17,7 @@ * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} * @author XOOPS Development Team */ + use XoopsModules\Rssfit; use XoopsModules\Rssfit\Utility; @@ -31,7 +32,7 @@ function xoops_module_pre_install_rssfit(\XoopsModule $module): bool require_once \dirname(__DIR__) . '/preloads/autoloader.php'; $utility = new Utility(); $xoopsSuccess = $utility::checkVerXoops($module); - $phpSuccess = $utility::checkVerPhp($module); + $phpSuccess = $utility::checkVerPhp($module); if ($xoopsSuccess && $phpSuccess) { $moduleTables = &$module->getInfo('tables'); @@ -56,9 +57,9 @@ function xoops_module_install_rssfit(\XoopsModule $module): bool $moduleDirName = \basename(\dirname(__DIR__)); - $helper = Rssfit\Helper::getInstance(); + $helper = Rssfit\Helper::getInstance(); $configurator = new Rssfit\Common\Configurator(); - $utility = new Utility(); + $utility = new Utility(); // Load language files $helper->loadLanguage('admin'); diff --git a/include/onuninstall.php b/include/onuninstall.php index 642e2b07..4bb9a73b 100644 --- a/include/onuninstall.php +++ b/include/onuninstall.php @@ -37,7 +37,7 @@ function xoops_module_uninstall_rssfit(\XoopsModule $module): bool $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); - $helper = Rssfit\Helper::getInstance(); + $helper = Rssfit\Helper::getInstance(); $utility = new Rssfit\Utility(); diff --git a/include/onupdate.php b/include/onupdate.php index 8e98e921..b4a4e816 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -16,6 +16,7 @@ * @license {@link https://www.gnu.org/licenses/gpl-2.0.html GNU GPL 2 or later} * @author XOOPS Development Team */ + use XoopsModules\Rssfit; if ((!defined('XOOPS_ROOT_PATH')) || !($GLOBALS['xoopsUser'] instanceof \XoopsUser) @@ -23,11 +24,9 @@ exit('Restricted access' . PHP_EOL); } - - /** * Prepares system prior to attempting to install module - * @param null $previousVersion + * @param null $previousVersion * @return bool true if ready to install, false if not */ function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVersion = null): bool @@ -35,11 +34,11 @@ function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVers $moduleDirName = \basename(\dirname(__DIR__)); /** @var Rssfit\Helper $helper */ /** @var Rssfit\Utility $utility */ - $helper = Rssfit\Helper::getInstance(); + $helper = Rssfit\Helper::getInstance(); $utility = new Rssfit\Utility(); $xoopsSuccess = $utility::checkVerXoops($module); - $phpSuccess = $utility::checkVerPhp($module); + $phpSuccess = $utility::checkVerPhp($module); return $xoopsSuccess && $phpSuccess; } @@ -56,11 +55,10 @@ function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = nul $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); - /** @var Rssfit\Helper $helper */ - /** @var Rssfit\Utility $utility */ + /** @var Rssfit\Helper $helper */ /** @var Rssfit\Utility $utility */ /** @var Rssfit\Common\Configurator $configurator */ - $helper = Rssfit\Helper::getInstance(); - $utility = new Rssfit\Utility(); + $helper = Rssfit\Helper::getInstance(); + $utility = new Rssfit\Utility(); $configurator = new Rssfit\Common\Configurator(); if ($previousVersion < 240) { diff --git a/index.php b/index.php index e2a432e6..7098a0ed 100644 --- a/index.php +++ b/index.php @@ -32,8 +32,8 @@ $setting = $intro->getVar('misc_setting'); $intro->setDoHtml($setting['dohtml'] ? true : false); $intro->setDoBr($setting['dobr'] ? true : false); - $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); - $content = str_replace(['{SITENAME}', '{SITEURL}'], [$xoopsConfig['sitename'], XOOPS_URL . '/'], $intro->getVar('misc_content')); + $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); + $content = str_replace(['{SITENAME}', '{SITEURL}'], [$xoopsConfig['sitename'], XOOPS_URL . '/'], $intro->getVar('misc_content')); /** @var \XoopsModules\Rssfit\PluginHandler $pluginHandler */ if (false !== mb_strpos($content, '{SUB}') && $plugins = $pluginHandler->getObjects2(new \Criteria('subfeed', '1'))) { $sublist = ''; diff --git a/language/english/common.php b/language/english/common.php index 578942e7..19be3192 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -16,7 +16,7 @@ * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) * @author Xoops Development Team */ -$moduleDirName = \basename(\dirname(__DIR__, 2)); +$moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); \define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: '); @@ -177,8 +177,7 @@ \define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_UPLOAD_PATH_DSC', 'Path for uploading images'); \define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_FILE_SIZE', 'Image File Size (in Bytes)'); -\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_FILE_SIZE_DSC','The maximum file size of the image file (in Bytes)'); - +\define('CO_' . $moduleDirNameUpper . '_' . 'IMAGE_FILE_SIZE_DSC', 'The maximum file size of the image file (in Bytes)'); //Module Stats \define('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY', 'Module Statistics'); diff --git a/language/english/help/helpheader.tpl b/language/english/help/helpheader.tpl index 403b21f5..8c3c433c 100644 --- a/language/english/help/helpheader.tpl +++ b/language/english/help/helpheader.tpl @@ -1,6 +1,6 @@ -

      Help: - <{$smarty.const._MI_RSSFIT_NAME}> - <{$smarty.const._MI_RSSFIT_BACK_2_ADMIN}> <{$smarty.const._MI_RSSFIT_NAME}> -

      +

      Help: + <{$smarty.const._MI_RSSFIT_NAME}> + <{$smarty.const._MI_RSSFIT_BACK_2_ADMIN}> <{$smarty.const._MI_RSSFIT_NAME}> +

      diff --git a/language/english/help/index.php b/language/english/help/index.php index 6a505435..2ea9b7d9 100644 --- a/language/english/help/index.php +++ b/language/english/help/index.php @@ -1,2 +1,3 @@ RSS feed RSS feed +define( + '_INTRO_CONTENT', + 'RSS feed RSS feed At {SITENAME} we provide our XML RSS feed that you can quickly find the latest updates and short descriptions with an RSS reader. @@ -14,5 +16,6 @@ Here are the URLs for each section\'s feed:

      {SUB} -By the way, the RSS feed of this site is generated by XOOPS RSSFit.'); +By the way, the RSS feed of this site is generated by XOOPS RSSFit.' +); define('_INSTALL_INTRO_SUB', '{TITLE}: {DESC}
      {URL}

      '); diff --git a/language/index.php b/language/index.php index 6a505435..2ea9b7d9 100644 --- a/language/index.php +++ b/language/index.php @@ -1,2 +1,3 @@ title { +channel > title { display: block; font-size: large; font-weight: bold; - } +} -channel>description { +channel > description { display: block; - } +} -channel>copyright { +channel > copyright { display: block; font-size: x-small; color: #666; - } +} -channel>lastBuildDate { +channel > lastBuildDate { display: block; text-align: right; - } +} -channel>language, -channel>image, -channel>managingEditor, -channel>webMaster, -channel>generator, -channel>docs, -channel>ttl { +channel > language, +channel > image, +channel > managingEditor, +channel > webMaster, +channel > generator, +channel > docs, +channel > ttl { display: none; - } +} item { display: block; @@ -51,29 +51,29 @@ item { margin-top: 10px; border: 1px solid #CCC; background: #EEE; - } +} -item>title { +item > title { display: block; float: left; margin-right: 5px; font-weight: bold; - } +} -item>pubDate { +item > pubDate { margin-right: 5px; font-size: x-small; color: #666; white-space: nowrap; - } +} -item>guid { +item > guid { display: block; margin-right: 5px; font-size: x-small; color: #666; - } +} -item>category, item>link { +item > category, item > link { display: none; - } +} diff --git a/rss.php b/rss.php index ed8aa04d..d1822b27 100644 --- a/rss.php +++ b/rss.php @@ -23,6 +23,7 @@ FeedHandler, Helper }; + /** @var FeedHandler $feedHandler */ if (function_exists('mb_http_output')) { diff --git a/rssreader.php b/rssreader.php index 15d2f117..178c0640 100644 --- a/rssreader.php +++ b/rssreader.php @@ -11,8 +11,8 @@ require_once __DIR__ . '/header.php'; require_once XOOPS_ROOT_PATH . '/header.php'; -$helper = Helper::getInstance(); -$maxChar = $helper->getConfig('max_char'); +$helper = Helper::getInstance(); +$maxChar = $helper->getConfig('max_char'); $max_words = 200; // output RSS feed to HTML diff --git a/sql/index.php b/sql/index.php index 6a505435..2ea9b7d9 100644 --- a/sql/index.php +++ b/sql/index.php @@ -1,2 +1,3 @@ 'overall_entries', - 'title' => '_MI_RSSFIT_OVERALL_ENTRIES', + 'title' => '_MI_RSSFIT_OVERALL_ENTRIES', 'description' => '_MI_RSSFIT_OVERALL_ENTRIES_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', @@ -129,7 +129,7 @@ // $helper->getConfig('plugin_entries') $modversion['config'][] = [ 'name' => 'plugin_entries', - 'title' => '_MI_RSSFIT_PLUGIN_ENTRIES', + 'title' => '_MI_RSSFIT_PLUGIN_ENTRIES', 'description' => '_MI_RSSFIT_PLUGIN_ENTRIES_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', @@ -139,18 +139,18 @@ // $helper->getConfig('sort') $modversion['config'][] = [ 'name' => 'sort', - 'title' => '_MI_RSSFIT_ENTRIES_SORT', + 'title' => '_MI_RSSFIT_ENTRIES_SORT', 'description' => '_MI_RSSFIT_ENTRIES_SORT_DESC', 'formtype' => 'select', 'valuetype' => 'text', 'default' => 'd', - 'options' => [_MI_RSSFIT_ENTRIES_SORT_DATE => 'd', _MI_RSSFIT_ENTRIES_SORT_CAT => 'c'], + 'options' => [_MI_RSSFIT_ENTRIES_SORT_DATE => 'd', _MI_RSSFIT_ENTRIES_SORT_CAT => 'c'], ]; // $helper->getConfig('cache') $modversion['config'][] = [ 'name' => 'cache', - 'title' => '_MI_RSSFIT_CACHE', + 'title' => '_MI_RSSFIT_CACHE', 'description' => '_MI_RSSFIT_CACHE_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', @@ -160,7 +160,7 @@ // $helper->getConfig('max_char') $modversion['config'][] = [ 'name' => 'max_char', - 'title' => '_MI_RSSFIT_MAXCHAR', + 'title' => '_MI_RSSFIT_MAXCHAR', 'description' => '_MI_RSSFIT_MAXCHAR_DESC', 'formtype' => 'textbox', 'valuetype' => 'int', @@ -170,7 +170,7 @@ // $helper->getConfig('strip_html') $modversion['config'][] = [ 'name' => 'strip_html', - 'title' => '_MI_RSSFIT_STRIPHTML', + 'title' => '_MI_RSSFIT_STRIPHTML', 'description' => '_MI_RSSFIT_STRIPHTML_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', @@ -180,7 +180,7 @@ // $helper->getConfig('utf8') $modversion['config'][] = [ 'name' => 'utf8', - 'title' => '_MI_RSSFIT_ENCODE_UTF8', + 'title' => '_MI_RSSFIT_ENCODE_UTF8', 'description' => '_MI_RSSFIT_ENCODE_UTF8_DESC', 'formtype' => 'yesno', 'valuetype' => 'int', @@ -190,12 +190,12 @@ // $helper->getConfig('mime') $modversion['config'][] = [ 'name' => 'mime', - 'title' => '_MI_RSSFIT_OUTOUT_MIME', + 'title' => '_MI_RSSFIT_OUTOUT_MIME', 'description' => '', 'formtype' => 'select', 'valuetype' => 'int', 'default' => 1, - 'options' => [_MI_RSSFIT_OUTOUT_MIME_XML => 1, _MI_RSSFIT_OUTOUT_MIME_HTML => 2, _MI_RSSFIT_OUTOUT_MIME_PHP => 3], + 'options' => [_MI_RSSFIT_OUTOUT_MIME_XML => 1, _MI_RSSFIT_OUTOUT_MIME_HTML => 2, _MI_RSSFIT_OUTOUT_MIME_PHP => 3], ]; /** From 730923e253336bfd8daef9e3462226bd0a067ed6 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 18 Oct 2021 01:05:00 -0400 Subject: [PATCH 114/154] ci --- .github/workflows/ci.yml | 2 +- .scrutinizer.yml | 52 ++++++++++++++++++++-------------------- 2 files changed, 27 insertions(+), 27 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index df5c155d..a5389084 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,7 +19,7 @@ jobs: php-version: ${{ matrix.php-versions }} extensions: mbstring, dom, fileinfo, mysql tools: cs2pr, phpcs, phpstan, psalm, phpunit, composer - run: phpstan analyze src --level=5 --error-format=checkstyle | cs2pr + # run: phpstan analyze src --level=5 --error-format=checkstyle | cs2pr # 8- Run Psalm scan - name: Run Psalm scan run: psalm --threads=8 --shepherd --stats --output-format=github diff --git a/.scrutinizer.yml b/.scrutinizer.yml index d1d302ae..45966c13 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -1,41 +1,41 @@ # language: php build: environment: - php: 8.0 + php: 8.0.11 nodes: tests: true analysis: dependencies: after: - # The following installs the most recent XOOPS CMS version, you might want - # to install a specific release tag or branch instead. - - git clone --depth=1 https://github.com/XOOPS/XoopsCore25 - - git clone --depth=1 https://github.com/mambax7/tag + # The following installs the most recent XOOPS CMS version, you might want + # to install a specific release tag or branch instead. + - git clone --depth=1 https://github.com/XOOPS/XoopsCore25 + - git clone --depth=1 https://github.com/mambax7/tag project_setup: override: true tests: override: - - php-scrutinizer-run --enable-security-analysis + - php-scrutinizer-run --enable-security-analysis filter: dependency_paths: - - XoopsCore25/* - - tag/* - - adslight/* - - adslight/* - - apcal/* - - extcal/* - - extgallery/* - - lexikon/* - - myalbum/* - - mylinks/* - - newbb/* - - news/* - - oledrion/* - - publisher/* - - smartfaq/* - - smartpartner/* - - smartsection/* - - wfdownloads/* - - wflinks/* - - xoopstube/* + - XoopsCore25/* + - tag/* + - adslight/* + - adslight/* + - apcal/* + - extcal/* + - extgallery/* + - lexikon/* + - myalbum/* + - mylinks/* + - newbb/* + - news/* + - oledrion/* + - publisher/* + - smartfaq/* + - smartpartner/* + - smartsection/* + - wfdownloads/* + - wflinks/* + - xoopstube/* From d0f274a360e8d682871926d6b15640bb1a49eeaf Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 18 Oct 2021 01:08:12 -0400 Subject: [PATCH 115/154] ci --- .github/workflows/ci.yml | 18 +----------------- 1 file changed, 1 insertion(+), 17 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5389084..3bab5e84 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,26 +18,10 @@ jobs: path: / php-version: ${{ matrix.php-versions }} extensions: mbstring, dom, fileinfo, mysql - tools: cs2pr, phpcs, phpstan, psalm, phpunit, composer + tools: cs2pr, phpcs, phpstan, psalm # run: phpstan analyze src --level=5 --error-format=checkstyle | cs2pr # 8- Run Psalm scan - name: Run Psalm scan run: psalm --threads=8 --shepherd --stats --output-format=github env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - # 9- Run SonarCloud scan - - name: Run SonarCloud scan - uses: sonarsource/sonarcloud-github-action@master - with: - args: > - -Dsonar.projectKey=MedUnes_noise-php - -Dsonar.organization=medunes - -Dsonar.sources=src - -Dsonar.tests=tests - -Dsonar.language=php - -Dsonar.sourceEncoding=UTF-8 - -Dsonar.exclusions=vendor/* - -Dsonar.verbose=true - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} From 4eef0047dd5d90082d63c86abab911270e45c52f Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 18 Oct 2021 01:10:42 -0400 Subject: [PATCH 116/154] ci --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3bab5e84..15468313 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: path: / php-version: ${{ matrix.php-versions }} extensions: mbstring, dom, fileinfo, mysql - tools: cs2pr, phpcs, phpstan, psalm + tools: phpstan, psalm # run: phpstan analyze src --level=5 --error-format=checkstyle | cs2pr # 8- Run Psalm scan - name: Run Psalm scan From 1923b367351e51bb7565a98b748d08edbd7ceeea Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 18 Oct 2021 02:44:45 -0400 Subject: [PATCH 117/154] $maxChars --- class/FeedHandler.php | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 7ddb6779..2d390e2b 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -240,17 +240,18 @@ public function getItems(array &$feed): void public function doSubstr(string $text): string { - $ret = $text; - $len = \function_exists('mb_strlen') ? mb_strlen($ret, $this->charset) : mb_strlen($ret); - if ($len > $this->helper->getConfig('max_char') && $this->helper->getConfig('max_char') > 0) { - $ret = $this->substrDetect($ret, 0, $this->helper->getConfig('max_char') - 1); + $ret = $text; + $len = \function_exists('mb_strlen') ? mb_strlen($ret, $this->charset) : mb_strlen($ret); + $maxChars = $this->helper->getConfig('max_char'); + if ($len > $maxChars && $maxChars > 0) { + $ret = $this->substrDetect($ret, 0, $maxChars - 1); if (false === $this->strrposDetect($ret, ' ')) { if (false !== $this->strrposDetect($text, ' ')) { $ret = $this->substrDetect($text, 0, mb_strpos($text, ' ')); } } - if (\in_array($this->substrDetect($text, $this->helper->getConfig('max_char') - 1, 1), $this->substrAdd)) { - $ret .= $this->substrDetect($text, $this->helper->getConfig('max_char') - 1, 1); + if (\in_array($this->substrDetect($text, $maxChars - 1, 1), $this->substrAdd)) { + $ret .= $this->substrDetect($text, $maxChars - 1, 1); } else { if (false !== $this->strrposDetect($ret, ' ')) { $ret = $this->substrDetect($ret, 0, $this->strrposDetect($ret, ' ')); From adf4a1381d9404c58248109ccfdcacb67fe03bc0 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 18 Oct 2021 02:55:35 -0400 Subject: [PATCH 118/154] PhpDoc --- class/FeedHandler.php | 3 --- class/MiscHandler.php | 30 +++++++--------------------- class/PluginHandler.php | 41 +++++++++++---------------------------- class/PluginInterface.php | 6 ------ 4 files changed, 18 insertions(+), 62 deletions(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 2d390e2b..643c3052 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -323,9 +323,6 @@ public function wrapCdata(string &$text): void $text = ''], ['<![CDATA[', ']]>'], $text) . ']]>'; } - /** - * @return array - */ public function &getActivatedSubfeeds(string $fields = '', string $type = ''): ?array { $ret = null; diff --git a/class/MiscHandler.php b/class/MiscHandler.php index cbb7c9ac..3383c0de 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -40,11 +40,7 @@ class MiscHandler extends \XoopsPersistableObjectHandler */ public $helper; - /** - * @param \XoopsMySQLDatabase|null $db - * @param null|\XoopsModules\Rssfit\Helper $helper - */ - public function __construct(?\XoopsMySQLDatabase $db = null, $helper = null) + public function __construct(?\XoopsMySQLDatabase $db = null, ?Helper $helper = null) { if (null === $helper) { $helper = Helper::getInstance(); @@ -61,9 +57,6 @@ public function __construct(?\XoopsMySQLDatabase $db = null, $helper = null) parent::__construct($db, $table, Misc::class, 'misc_id', 'misc_title'); } - /** - * @param \XoopsMySQLDatabase|null $db - */ public function getInstance(?\XoopsMySQLDatabase $db = null): MiscHandler { static $instance; @@ -74,11 +67,8 @@ public function getInstance(?\XoopsMySQLDatabase $db = null): MiscHandler return $instance; } - /** - * @param bool $isNew - * @return \XoopsObject - */ - public function create($isNew = true): ?\XoopsObject + + public function create(bool $isNew = true): ?\XoopsObject { $obj = parent::create($isNew); // if ($isNew) { @@ -91,12 +81,7 @@ public function create($isNew = true): ?\XoopsObject // public function get($id = null, $fields = '*') - /** - * @param null|int $id - * @param null|array $fields - * @return bool|mixed|\XoopsObject|null - */ - public function get($id = null, $fields = null): ?\XoopsObject + public function get(?int $id = null, ?array $fields = null): ?\XoopsObject { $criteria = new \Criteria($this->objKey, (int)$id); $objs = $this->getObjects2($criteria); @@ -110,12 +95,11 @@ public function get($id = null, $fields = null): ?\XoopsObject /** * count objects matching a condition * @param null|\Criteria|\CriteriaCompo $criteria - * @return null|int count of objects */ public function getCount($criteria = null): ?int { $sql = 'SELECT COUNT(*) FROM ' . $this->dbTable; - if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { + if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { $sql .= ' ' . $criteria->renderWhere(); } if (!$result = $this->db->query($sql)) { @@ -135,7 +119,7 @@ public function getObjects2($criteria = null, string $fields = '*', string $key $limit = $start = 0; // $fields = '*'; $sql = 'SELECT ' . $fields . ' FROM ' . $this->dbTable; - if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { + if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { $sql .= ' ' . $criteria->renderWhere(); if ('' != $criteria->getSort()) { $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); @@ -238,7 +222,7 @@ public function modifyObjects(?\Criteria $criteria = null, array $fields = [], b } $sql = mb_substr($sql, 0, -2); $sql = 'UPDATE ' . $this->dbTable . ' SET ' . $sql; - if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { + if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { $sql .= ' ' . $criteria->renderWhere(); } if ($force) { diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 3dcdea0f..9dbeba69 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -42,11 +42,7 @@ class PluginHandler extends \XoopsPersistableObjectHandler */ public $helper; - /** - * @param \XoopsDatabase|null $db - * @param null|\XoopsModules\Rssfit\Helper $helper - */ - public function __construct(?\XoopsDatabase $db = null, $helper = null) + public function __construct(?\XoopsDatabase $db = null, ?Helper $helper = null) { if (null === $helper) { $helper = \XoopsModules\Rssfit\Helper::getInstance(); @@ -65,9 +61,6 @@ public function __construct(?\XoopsDatabase $db = null, $helper = null) parent::__construct($db, $table, Plugin::class, 'rssf_conf_id', 'rssf_filename'); } - /** - * @param \XoopsDatabase|null $db - */ public function getInstance(?\XoopsDatabase $db = null): \XoopsPersistableObjectHandler { static $instance; @@ -78,11 +71,7 @@ public function getInstance(?\XoopsDatabase $db = null): \XoopsPersistableObject return $instance; } - /** - * @param bool $isNew - * @return \XoopsObject - */ - public function create($isNew = true): ?\XoopsObject + public function create(bool $isNew = true): ?\XoopsObject { $object = parent::create($isNew); // if ($isNew) { @@ -95,12 +84,7 @@ public function create($isNew = true): ?\XoopsObject // public function get($id, $fields = '*') - /** - * @param null|int $id - * @param null|array $fields - * @return bool|mixed|\XoopsObject|null - */ - public function get($id = null, $fields = null): ?\XoopsObject + public function get(?int $id = null, ?array $fields = null): ?\XoopsObject { $ret = null; $criteria = new \Criteria($this->objKey, (int)$id); @@ -116,7 +100,7 @@ public function get($id = null, $fields = null): ?\XoopsObject * @param bool $force flag to force the query execution despite security settings * @return array|bool|int|mixed|null */ - public function insert(\XoopsObject $object, $force = true) + public function insert(\XoopsObject $object, bool $force = true) { if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) { return false; @@ -167,10 +151,8 @@ public function insert(\XoopsObject $object, $force = true) return $object->getVar($this->objKey); } - /** - * @param bool $force - */ - public function delete(\XoopsObject $object, $force = false): bool + + public function delete(\XoopsObject $object, bool $force = false): bool { if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) { return false; @@ -207,7 +189,7 @@ public function getObjects2($criteria = null, string $fields = '*', string $key break; } $sql = 'SELECT ' . $fields . ' FROM ' . $this->dbTable; - if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { + if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { $sql .= ' ' . $criteria->renderWhere(); if ('' != $criteria->getSort()) { $sql .= ' ORDER BY ' . $criteria->getSort() . ' ' . $criteria->getOrder(); @@ -253,7 +235,7 @@ public function modifyObjects($criteria = null, array $fields = [], bool $force } $sql = mb_substr($sql, 0, -2); $sql = 'UPDATE ' . $this->dbTable . ' SET ' . $sql; - if ($criteria instanceof \CriteriaCompo) { + if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { $sql .= ' ' . $criteria->renderWhere(); } if ($force) { @@ -272,12 +254,11 @@ public function modifyObjects($criteria = null, array $fields = [], bool $force /** * count objects matching a condition * @param null|\Criteria|\CriteriaCompo $criteria - * @return null|int count of objects */ public function getCount($criteria = null): ?int { $sql = 'SELECT COUNT(*) FROM ' . $this->dbTable; - if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { + if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { $sql .= ' ' . $criteria->renderWhere(); } $result = $this->db->query($sql); @@ -313,11 +294,11 @@ public function &getPluginFileList(): ?array } /** - * @return false|mixed + * @return null|mixed */ public function checkPlugin(\XoopsObject $object) { - $ret = false; + $ret = null; global $moduleHandler; $file = \RSSFIT_ROOT_PATH . 'class/Plugins/' . $object->getVar('rssf_filename'); if (\is_file($file)) { diff --git a/class/PluginInterface.php b/class/PluginInterface.php index 780050cc..0cb1c39c 100644 --- a/class/PluginInterface.php +++ b/class/PluginInterface.php @@ -8,13 +8,7 @@ */ interface PluginInterface { - /** - * @return \XoopsModule - */ public function loadModule(): ?\XoopsModule; - /** - * @return array - */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array; } From c4376b55d473fe13fc3863bcdbc35f65f1d10a9b Mon Sep 17 00:00:00 2001 From: mambax7 Date: Mon, 18 Oct 2021 03:09:27 -0400 Subject: [PATCH 119/154] PhpDoc --- class/MiscHandler.php | 13 ++++++++++--- class/PluginHandler.php | 19 ++++++++++++++----- class/Plugins/Xoopstube.php | 3 --- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 3383c0de..5b325fcd 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -67,8 +67,11 @@ public function getInstance(?\XoopsMySQLDatabase $db = null): MiscHandler return $instance; } - - public function create(bool $isNew = true): ?\XoopsObject + /** + * @param bool $isNew + * @return \XoopsObject + */ + public function create($isNew = true): ?\XoopsObject { $obj = parent::create($isNew); // if ($isNew) { @@ -81,7 +84,11 @@ public function create(bool $isNew = true): ?\XoopsObject // public function get($id = null, $fields = '*') - public function get(?int $id = null, ?array $fields = null): ?\XoopsObject + /** + * @param null|int $id + * @param null|array $fields + */ + public function get($id = null, $fields = null): ?\XoopsObject { $criteria = new \Criteria($this->objKey, (int)$id); $objs = $this->getObjects2($criteria); diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 9dbeba69..d1e2b576 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -71,7 +71,10 @@ public function getInstance(?\XoopsDatabase $db = null): \XoopsPersistableObject return $instance; } - public function create(bool $isNew = true): ?\XoopsObject + /** + * @param bool $isNew + */ + public function create($isNew = true): ?\XoopsObject { $object = parent::create($isNew); // if ($isNew) { @@ -84,7 +87,11 @@ public function create(bool $isNew = true): ?\XoopsObject // public function get($id, $fields = '*') - public function get(?int $id = null, ?array $fields = null): ?\XoopsObject + /** + * @param null|int $id + * @param null|array $fields + */ + public function get($id = null, $fields = null): ?\XoopsObject { $ret = null; $criteria = new \Criteria($this->objKey, (int)$id); @@ -100,7 +107,7 @@ public function get(?int $id = null, ?array $fields = null): ?\XoopsObject * @param bool $force flag to force the query execution despite security settings * @return array|bool|int|mixed|null */ - public function insert(\XoopsObject $object, bool $force = true) + public function insert(\XoopsObject $object, $force = true) { if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) { return false; @@ -151,8 +158,10 @@ public function insert(\XoopsObject $object, bool $force = true) return $object->getVar($this->objKey); } - - public function delete(\XoopsObject $object, bool $force = false): bool + /** + * @param bool $force + */ + public function delete(\XoopsObject $object, $force = false): bool { if (mb_strtolower(\get_class($object)) != mb_strtolower($this->objClass)) { return false; diff --git a/class/Plugins/Xoopstube.php b/class/Plugins/Xoopstube.php index f4512785..9294a7c6 100644 --- a/class/Plugins/Xoopstube.php +++ b/class/Plugins/Xoopstube.php @@ -51,9 +51,6 @@ final class Xoopstube extends AbstractPlugin */ public $dirname = 'xoopstube'; - /** - * @return \XoopsModule - */ public function loadModule(): ?\XoopsModule { $mod = null; From c501d2cca29c543944346cd26075119ad3b66362 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:02:50 -0400 Subject: [PATCH 120/154] rename $handler to $plugin --- class/PluginHandler.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/class/PluginHandler.php b/class/PluginHandler.php index d1e2b576..5c847442 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -271,7 +271,7 @@ public function getCount($criteria = null): ?int $sql .= ' ' . $criteria->renderWhere(); } $result = $this->db->query($sql); - if (!$result) { + if (!$result instanceof \mysqli_result) { return null; } [$count] = $this->db->fetchRow($result); @@ -316,14 +316,14 @@ public function checkPlugin(\XoopsObject $object) $name = \explode('.', $object->getVar('rssf_filename')); $class = __NAMESPACE__ . '\Plugins\\' . \ucfirst($name[0]); if (\class_exists($class)) { - $handler = new $class(); - if (!\method_exists($handler, 'loadmodule') || !\method_exists($handler, 'grabentries')) { + $plugin = new $class(); + if (!\method_exists($plugin, 'loadmodule') || !\method_exists($plugin, 'grabentries')) { $object->setErrors(\_AM_RSSFIT_PLUGIN_FUNCNOTFOUND); } else { - $dirname = $handler->dirname; + $dirname = $plugin->dirname; if (!empty($dirname) && \is_dir(XOOPS_ROOT_PATH . '/modules/' . $dirname)) { - if ($handler->loadModule()) { - $ret = $handler; + if ($plugin->loadModule()) { + $ret = $plugin; } else { $object->setErrors(\_AM_RSSFIT_PLUGIN_MODNOTFOUND); } From 1b7d43ffb0a918c56ac3e1f357187801c5b8e505 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:03:34 -0400 Subject: [PATCH 121/154] url safety in preg_match --- admin/do_plugins.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/do_plugins.php b/admin/do_plugins.php index daeb2728..bc5a7c6c 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -144,7 +144,7 @@ $list = \XoopsLists::getFileListAsArray($helper->path('class/Plugins')); $installable = []; foreach ($list as $f) { - if (preg_match('/[a-zA-Z0-9_]+\.php/', $f) && !in_array($f, $filelist)) { + if (preg_match('/[a-zA-Z0-9_]+\.php$/', $f) && !in_array($f, $filelist)) { $installable[] = $f; } } From 3f6ab22e714b6c1e55ad930257687b1277d577ce Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:05:11 -0400 Subject: [PATCH 122/154] check for mysqli_result --- class/Common/SysUtility.php | 11 ++++++++--- include/install.php | 14 ++++++++++++-- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 42604b1a..2565960e 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -143,7 +143,7 @@ public static function enumerate(string $tableName, string $columnName): ?array $sql = 'SELECT COLUMN_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = "' . $table . '" AND COLUMN_NAME = "' . $columnName . '"'; $result = $GLOBALS['xoopsDB']->query($sql); - if (!$result) { + if (!$result instanceof \mysqli_result) { // exit($GLOBALS['xoopsDB']->error()); $logger = \XoopsLogger::getInstance(); $logger->handleError(\E_USER_WARNING, $sql, __FILE__, __LINE__); @@ -170,8 +170,13 @@ public static function cloneRecord(string $tableName, string $idField, int $id): $table = $GLOBALS['xoopsDB']->prefix($tableName); // copy content of the record you wish to clone $sql = "SELECT * FROM $table WHERE $idField='" . $id . "' "; - $tempTable = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query($sql), \MYSQLI_ASSOC); - if (!$tempTable) { + $result = $GLOBALS['xoopsDB']->query($sql); + + if ($result instanceof \mysqli_result) { + $tempTable = $GLOBALS['xoopsDB']->fetchArray($result, \MYSQLI_ASSOC); + } + + if (!$tempTable) { exit($GLOBALS['xoopsDB']->error()); } // set the auto-incremented id's value to blank. diff --git a/include/install.php b/include/install.php index 2c0a292f..c4aadf8c 100644 --- a/include/install.php +++ b/include/install.php @@ -63,7 +63,12 @@ function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $oldversion): bo // rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); $moduleDirName = \basename(\dirname(__DIR__)); xoops_loadLanguage('install', $moduleDirName); - [$rows] = $xoopsDB->fetchRow($xoopsDB->query('SELECT COUNT(*) FROM ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . " WHERE misc_category = 'channel'")); + + $sql = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . " WHERE misc_category = 'channel'"; + $result = $xoopsDB->query($sql); + if ($result instanceof \mysqli_result) { + [$rows] = $xoopsDB->fetchRow($result); + } if (!$rows) { // $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` ADD `misc_setting` TEXT NOT NULL;'; // $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; @@ -103,7 +108,12 @@ function rssfInsertChannel(\XoopsModule $xoopsMod): string $helper = Rssfit\Helper::getInstance(); $url = $xoopsDB->quoteString(XOOPS_URL); $sitename = $xoopsDB->quoteString($xoopsConfig['sitename']); - [$copyright] = $xoopsDB->fetchRow($xoopsDB->query('SELECT conf_value FROM ' . $xoopsDB->prefix('config') . " WHERE conf_name = 'meta_copyright' AND conf_modid = 1 AND conf_catid = " . XOOPS_CONF_METAFOOTER)); + + $sql = 'SELECT conf_value FROM ' . $xoopsDB->prefix('config') . " WHERE conf_name = 'meta_copyright' AND conf_modid = 1 AND conf_catid = " . XOOPS_CONF_METAFOOTER; + $result = $xoopsDB->query($sql); + if ($result instanceof \mysqli_result) { + [$copyright] = $xoopsDB->fetchRow($result); + } return 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') From dec057584fc05dcb9b515c43fe71f19fd41d4a1e Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:05:27 -0400 Subject: [PATCH 123/154] change $handler to null --- class/FeedHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 643c3052..0d11fbe0 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -399,7 +399,7 @@ public function checkSubFeed(array &$feed): void $criteria->add(new \Criteria('rssf_filename', \sprintf($this->pluginFile, $feed['plugin']))); $criteria->add(new \Criteria('subfeed', '1')); $sub = $this->pluginHandler->getObjects2($criteria); - $handler = false; + $handler = null; if (isset($sub[0])) { $handler = $this->pluginHandler->checkPlugin($sub[0]); } From 71a0360783e6c9273f624246188c4e911a83bb7b Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:06:06 -0400 Subject: [PATCH 124/154] Xmf\ not needed --- admin/do_subfeeds.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/do_subfeeds.php b/admin/do_subfeeds.php index e8ab35c4..d0abadc7 100644 --- a/admin/do_subfeeds.php +++ b/admin/do_subfeeds.php @@ -121,7 +121,7 @@ } break; case 'edit': - $id = \Xmf\Request::getInt('feed', 0, 'GET'); + $id = Request::getInt('feed', 0, 'GET'); if (!empty($id)) { $sub = $pluginHandler->get($id); if (!$handler = $pluginHandler->checkPlugin($sub)) { From 2b610e916bc4b80173a6025088b0ba6ad328ecec Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:06:32 -0400 Subject: [PATCH 125/154] PhpDoc --- class/Plugins/Adslight.php | 3 --- class/Plugins/Apcal.php | 3 --- class/Plugins/Extcal.php | 7 +------ class/Plugins/Lexikon.php | 3 --- class/Plugins/Mylinks.php | 3 --- class/Plugins/Newbb.php | 3 --- class/Plugins/Oledrion.php | 3 --- class/Plugins/Publisher.php | 3 --- class/Plugins/Smartfaq.php | 3 --- class/Plugins/Smartpartner.php | 3 --- 10 files changed, 1 insertion(+), 33 deletions(-) diff --git a/class/Plugins/Adslight.php b/class/Plugins/Adslight.php index 4a8487c0..2d54e9bf 100644 --- a/class/Plugins/Adslight.php +++ b/class/Plugins/Adslight.php @@ -46,9 +46,6 @@ final class Adslight extends AbstractPlugin { public $dirname = 'adslight'; - /** - * @return \XoopsModule - */ public function loadModule(): ?\XoopsModule { $mod = null; diff --git a/class/Plugins/Apcal.php b/class/Plugins/Apcal.php index dc34217c..3a8f91f1 100644 --- a/class/Plugins/Apcal.php +++ b/class/Plugins/Apcal.php @@ -48,9 +48,6 @@ final class Apcal extends AbstractPlugin { public $dirname = 'apcal'; - /** - * @return \XoopsModule - */ public function loadModule(): ?\XoopsModule { $mod = null; diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index 1b61010d..8beb8922 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -66,9 +66,6 @@ final class Extcal extends AbstractPlugin { public $dirname = 'extcal'; - /** - * @return \XoopsModule - */ public function loadModule(): ?\XoopsModule { $mod = null; @@ -88,9 +85,7 @@ public function loadModule(): ?\XoopsModule */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { - $myts = \MyTextSanitizer::getInstance(); $ret = null; - $i = 0; // read confgs to get timestamp format @@ -102,7 +97,7 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array $eventHandler = PluginHelper::getInstance()->getHandler('Event'); $catHandler = PluginHelper::getInstance()->getHandler('Category'); - $events = $eventHandler->getUpcomingEvent(0, $this->grab, 0); + $events = $eventHandler->getUpcomingEvent($this->grab,0, 0); if (\is_array($events)) { $ret = []; diff --git a/class/Plugins/Lexikon.php b/class/Plugins/Lexikon.php index 2c264dbd..c19f8280 100644 --- a/class/Plugins/Lexikon.php +++ b/class/Plugins/Lexikon.php @@ -47,9 +47,6 @@ final class Lexikon extends AbstractPlugin { public $dirname = 'lexikon'; - /** - * @return \XoopsModule - */ public function loadModule(): ?\XoopsModule { $mod = null; diff --git a/class/Plugins/Mylinks.php b/class/Plugins/Mylinks.php index ab8f1128..dd2b0234 100644 --- a/class/Plugins/Mylinks.php +++ b/class/Plugins/Mylinks.php @@ -49,9 +49,6 @@ final class Mylinks extends AbstractPlugin { public $dirname = 'mylinks'; - /** - * @return \XoopsModule - */ public function loadModule(): ?\XoopsModule { $mod = null; diff --git a/class/Plugins/Newbb.php b/class/Plugins/Newbb.php index 981826aa..72e01aba 100644 --- a/class/Plugins/Newbb.php +++ b/class/Plugins/Newbb.php @@ -49,9 +49,6 @@ final class Newbb extends AbstractPlugin { public $dirname = 'newbb'; - /** - * @return \XoopsModule - */ public function loadModule(): ?\XoopsModule { $mod = null; diff --git a/class/Plugins/Oledrion.php b/class/Plugins/Oledrion.php index e14c05cd..dae050e4 100644 --- a/class/Plugins/Oledrion.php +++ b/class/Plugins/Oledrion.php @@ -40,9 +40,6 @@ final class Oledrion extends AbstractPlugin { public $dirname = 'oledrion'; - /** - * @return \XoopsModule - */ public function loadModule(): ?\XoopsModule { $mod = null; diff --git a/class/Plugins/Publisher.php b/class/Plugins/Publisher.php index 3243cae0..0581b575 100644 --- a/class/Plugins/Publisher.php +++ b/class/Plugins/Publisher.php @@ -51,9 +51,6 @@ final class Publisher extends AbstractPlugin { public $dirname = 'publisher'; - /** - * @return \XoopsModule - */ public function loadModule(): ?\XoopsModule { $mod = null; diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php index 9cbefdd1..937efb53 100644 --- a/class/Plugins/Smartfaq.php +++ b/class/Plugins/Smartfaq.php @@ -49,9 +49,6 @@ final class Smartfaq extends AbstractPlugin { public $dirname = 'smartfaq'; - /** - * @return \XoopsModule - */ public function loadModule(): ?\XoopsModule { $mod = null; diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php index 6f3eb57f..f85340c1 100644 --- a/class/Plugins/Smartpartner.php +++ b/class/Plugins/Smartpartner.php @@ -54,9 +54,6 @@ final class Smartpartner extends AbstractPlugin { public $dirname = 'smartpartner'; - /** - * @return \XoopsModule - */ public function loadModule(): ?\XoopsModule { $mod = null; From 5a84d71bf58519190d8f5a5a13cfd7d24ed1090b Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:07:08 -0400 Subject: [PATCH 126/154] PhpDoc --- class/MiscHandler.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 5b325fcd..c54c88fe 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -161,6 +161,7 @@ public function getObjects2($criteria = null, string $fields = '*', string $key } /** + * @param bool $force flag to force the query execution despite security settings * @return array|bool|int|mixed|null */ public function insert(\XoopsObject $object, $force = false) @@ -215,6 +216,7 @@ public function insert(\XoopsObject $object, $force = false) } /** + * @param bool $force flag to force the query execution despite security settings * @param null|\Criteria|\CriteriaCompo $criteria */ public function modifyObjects(?\Criteria $criteria = null, array $fields = [], bool $force = false): ?string @@ -245,6 +247,14 @@ public function modifyObjects(?\Criteria $criteria = null, array $fields = [], b return null; } + //TODO this should be deleted? + /** + * delete an object from the database + * + * @param \XoopsObject $object reference to the object to delete + * @param bool $force + * @return bool FALSE if failed. + */ public function delete(\XoopsObject $object, $force = false): bool { // $force = false; From 39660a703d4b7815d9d3827b3628a6dc1e3fb83f Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:20:00 -0400 Subject: [PATCH 127/154] cosmetics English --- class/Common/SysUtility.php | 2 +- language/english/help/disclaimer.tpl | 12 ++++++------ xoops_version.php | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 2565960e..192b57d6 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -381,7 +381,7 @@ public static function prepareFolder(string $folder): void } /** - * Check if dB table table exists + * Check if dB table exists * * @param string $tablename dB tablename with prefix * @return bool true if table exists diff --git a/language/english/help/disclaimer.tpl b/language/english/help/disclaimer.tpl index fa8e7be8..48f6b492 100644 --- a/language/english/help/disclaimer.tpl +++ b/language/english/help/disclaimer.tpl @@ -3,7 +3,7 @@

      DISCLAIMER


      -

      Software downloaded from the XOOPS web site is provided 'as is' without warranty +

      Software downloaded from the XOOPS website is provided 'as is' without warranty of any kind, either express or implied, including, but not limited to, the implied warranties of fitness for a purpose, or the warranty of non-infringement. Without limiting the foregoing, XOOPS Projects team makes no warranty that:

      @@ -15,21 +15,21 @@ accurate or reliable
    • the quality of the software will meet your expectations any errors in the - software obtained from XOOPS web site will be corrected. + software obtained from XOOPS website will be corrected.

    • -

      Software and its documentation made available on the XOOPS web site:

      +

      Software and its documentation made available on the XOOPS website:


      1. could include technical or other mistakes, inaccuracies or typographical errors. XOOPS may make changes to the software or documentation made available - on its web site. + on its website.
      2. may be out of date, and XOOPS makes no commitment to update such materials.
      3. XOOPS assumes no responsibility for errors or omissions in the software - or documentation available from its web site. + or documentation available from its website.


      In no event shall XOOPS team be liable to you or any third parties for @@ -43,6 +43,6 @@ and risk and with agreement that you will be solely responsible for any damage to your computer system or loss of data that results from such activities. No advice or information, whether oral or written, obtained by you from XOOPS or from XOOPS - web site shall create any warranty for the software

      + website shall create any warranty for the software

      diff --git a/xoops_version.php b/xoops_version.php index 2137b47a..246a42cf 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -26,7 +26,7 @@ $moduleDirName = basename(__DIR__); $moduleDirNameUpper = mb_strtoupper($moduleDirName); -// ------------------- Informations ------------------- // +// ------------------- Information ------------------- / $modversion = [ 'version' => '1.32', 'module_status' => 'Beta 2', From 533c9869477bb3733cc0efc721486914b75a2201 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:20:24 -0400 Subject: [PATCH 128/154] not needed \ --- class/MiscHandler.php | 2 +- class/PluginHandler.php | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/class/MiscHandler.php b/class/MiscHandler.php index c54c88fe..85500a37 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -134,7 +134,7 @@ public function getObjects2($criteria = null, string $fields = '*', string $key $limit = $criteria->getLimit(); $start = $criteria->getStart(); } - if (!\preg_match('/ORDER\ BY/', $sql)) { + if (!\preg_match('/ORDER BY/', $sql)) { $sql .= ' ORDER BY ' . $this->objKey . ' ASC'; } $result = $this->db->query($sql, $limit, $start); diff --git a/class/PluginHandler.php b/class/PluginHandler.php index 5c847442..f634818d 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -206,7 +206,7 @@ public function getObjects2($criteria = null, string $fields = '*', string $key $limit = $criteria->getLimit(); $start = $criteria->getStart(); } - if (!\preg_match('/ORDER\ BY/', $sql)) { + if (!\preg_match('/ORDER BY/', $sql)) { $sql .= ' ORDER BY ' . $this->sortby . ' ' . $this->order; } $result = $this->db->query($sql, $limit, $start); From d2f2b99bca5d2c13d1458f5c60e6f428084d89aa Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:26:06 -0400 Subject: [PATCH 129/154] English, SQL --- include/install.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/include/install.php b/include/install.php index c4aadf8c..d22e5365 100644 --- a/include/install.php +++ b/include/install.php @@ -53,7 +53,7 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod): bool } /** - * @param int $oldversion version number of prevviously installed version + * @param int $oldversion version number of previously installed version * */ function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $oldversion): bool @@ -64,7 +64,7 @@ function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $oldversion): bo $moduleDirName = \basename(\dirname(__DIR__)); xoops_loadLanguage('install', $moduleDirName); - $sql = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . " WHERE misc_category = 'channel'"; + $sql = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . " WHERE 'misc_category' = 'channel'"; $result = $xoopsDB->query($sql); if ($result instanceof \mysqli_result) { [$rows] = $xoopsDB->fetchRow($result); @@ -109,7 +109,7 @@ function rssfInsertChannel(\XoopsModule $xoopsMod): string $url = $xoopsDB->quoteString(XOOPS_URL); $sitename = $xoopsDB->quoteString($xoopsConfig['sitename']); - $sql = 'SELECT conf_value FROM ' . $xoopsDB->prefix('config') . " WHERE conf_name = 'meta_copyright' AND conf_modid = 1 AND conf_catid = " . XOOPS_CONF_METAFOOTER; + $sql = "SELECT 'conf_value' FROM " . $xoopsDB->prefix('config') . " WHERE 'conf_name' = 'meta_copyright' AND 'conf_modid' = 1 AND 'conf_catid' = " . XOOPS_CONF_METAFOOTER; $result = $xoopsDB->query($sql); if ($result instanceof \mysqli_result) { [$copyright] = $xoopsDB->fetchRow($result); @@ -137,7 +137,7 @@ function rssfInsertChannel(\XoopsModule $xoopsMod): string . ", (0, 'channel', 'generator', " . $xoopsDB->quoteString(XOOPS_VERSION . ' / RSSFit ' . $xoopsMod->getInfo('version')) . ", ''), (0, 'channel', 'docs', " - . $xoopsDB->quoteString('http://blogs.law.harvard.edu/tech/rss') + . $xoopsDB->quoteString('https://blogs.law.harvard.edu/tech/rss') . ", '')" . ", (0, 'channelimg', 'url', " . $xoopsDB->quoteString(XOOPS_URL . '/images/logo.gif') From 2c7eada72f54d51710a641c0a0b31d654f62d5b8 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:47:11 -0400 Subject: [PATCH 130/154] 'sprintf' with single string argument --- testdata/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testdata/index.php b/testdata/index.php index 93aa444f..b7cb832b 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -50,7 +50,7 @@ loadSampleData(); } else { xoops_cp_header(); - xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM')), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); + xoops_confirm(['ok' => 1, 'op' => 'load'], 'index.php', constant('CO_' . $moduleDirNameUpper . '_' . 'LOAD_SAMPLEDATA_CONFIRM'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM'), true); xoops_cp_footer(); } break; From 2fdc32dd7158d225bc4118204e0b6e861a42259d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:48:20 -0400 Subject: [PATCH 131/154] Parameters number mismatch declaration --- class/Plugins/Extcal.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index 8beb8922..334f4684 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -97,7 +97,7 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array $eventHandler = PluginHelper::getInstance()->getHandler('Event'); $catHandler = PluginHelper::getInstance()->getHandler('Category'); - $events = $eventHandler->getUpcomingEvent($this->grab,0, 0); + $events = $eventHandler->getUpcomingEvent($this->grab,0); if (\is_array($events)) { $ret = []; From 76fb0de8c52a4c80bdc4b0dc5b12c86aec08993b Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:51:47 -0400 Subject: [PATCH 132/154] Ternary expression replaced with condition --- class/FeedHandler.php | 4 ++-- index.php | 4 ++-- rss.php | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 0d11fbe0..eff61cd8 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -177,7 +177,7 @@ public function getSticky(array &$feed): bool $feed['sticky']['description'] = $sticky->getVar('misc_content'); $this->cleanupChars($feed['sticky']['title']); $this->cleanupChars($feed['sticky']['link']); - $this->cleanupChars($feed['sticky']['description'], $setting['dohtml'] ? false : true, false); + $this->cleanupChars($feed['sticky']['description'], !$setting['dohtml'], false); $this->wrapCdata($feed['sticky']['description']); $feed['sticky']['pubdate'] = $this->rssTimeStamp(\time()); } @@ -215,7 +215,7 @@ public function getItems(array &$feed): void if (\count($entries) > 0) { foreach ($entries as $i => &$iValue) { $this->cleanupChars($iValue['title']); - $strip = $this->modConfig['strip_html'] ? true : false; + $strip = (bool)$this->modConfig['strip_html']; $this->cleanupChars($iValue['description'], $strip, false, true); $this->wrapCdata($iValue['description']); $entries[$i]['category'] = $this->myts->undoHtmlSpecialChars($iValue['category']); diff --git a/index.php b/index.php index 7098a0ed..fbd9b8e5 100644 --- a/index.php +++ b/index.php @@ -30,8 +30,8 @@ if ($intr) { $intro = $intr[0]; $setting = $intro->getVar('misc_setting'); - $intro->setDoHtml($setting['dohtml'] ? true : false); - $intro->setDoBr($setting['dobr'] ? true : false); + $intro->setDoHtml((bool)$setting['dohtml']); + $intro->setDoBr((bool)$setting['dobr']); $title = str_replace('{SITENAME}', $xoopsConfig['sitename'], $intro->getVar('misc_title')); $content = str_replace(['{SITENAME}', '{SITEURL}'], [$xoopsConfig['sitename'], XOOPS_URL . '/'], $intro->getVar('misc_content')); /** @var \XoopsModules\Rssfit\PluginHandler $pluginHandler */ diff --git a/rss.php b/rss.php index d1822b27..e8b23ae1 100644 --- a/rss.php +++ b/rss.php @@ -33,7 +33,7 @@ $helper = Helper::getInstance(); $charset = $helper->getConfig('utf8') ? 'UTF-8' : _CHARSET; -$docache = $helper->getConfig('cache') ? true : false; +$docache = (bool)$helper->getConfig('cache'); $template = 'db:rssfit_rss.tpl'; if (3 == $helper->getConfig('mime')) { $xoopsLogger->enableRendering(); From 20744855bacdbbab0fc68bb91f1395ccdd95791d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:57:20 -0400 Subject: [PATCH 133/154] PhpDoc --- class/FeedHandler.php | 2 +- class/Utility.php | 3 --- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index eff61cd8..fb591efb 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -301,7 +301,7 @@ public function sortTimestamp(array $a, array $b): int return ($a['timestamp'] > $b['timestamp']) ? -1 : 1; } - public function cleanupChars(&$text, bool $strip = true, bool $dospec = true, bool $dosub = false): void + public function cleanupChars(string &$text, bool $strip = true, bool $dospec = true, bool $dosub = false): void { if ($strip) { $text = \strip_tags((string)$text); diff --git a/class/Utility.php b/class/Utility.php index f53faf45..5a316bb0 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -52,9 +52,6 @@ public static function genSpecMoreInfo(string $spec, FeedHandler $feedHandler): return static::rssfGenAnchor($feedHandler->specUrl($spec), \_AM_RSSFIT_EDIT_CHANNEL_QMARK, 'spec', \_AM_RSSFIT_EDIT_CHANNEL_MOREINFO); } - /** - * @param null|string $url - */ public static function rssfGenAnchor(?string $url = null, string $text = '', string $target = '', string $title = '', string $class = '', string $id = ''): string { if (null !== $url) { From c62d86ca3aec102d077585379dc4165df26e89e1 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:59:02 -0400 Subject: [PATCH 134/154] Type unsafe comparison --- class/FeedHandler.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index fb591efb..83d56064 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -111,7 +111,7 @@ public function getChannel(array &$feed): void $elements = $this->miscHandler->getObjects2(new \Criteria('misc_category', 'channel')); if (\is_array($elements) && !empty($elements)) { foreach ($elements as $e) { - if ('' != $e->getVar('misc_content')) { + if ('' !== $e->getVar('misc_content')) { $channel[$e->getVar('misc_title')] = $e->getVar('misc_content', 'n'); } } @@ -165,7 +165,7 @@ public function getSticky(array &$feed): bool $sticky = &$intr[0]; unset($intr); $setting = $sticky->getVar('misc_setting'); - if (\in_array(0, $setting['feeds']) || '' == $sticky->getVar('misc_title') || '' == $sticky->getVar('misc_content')) { + if (\in_array(0, $setting['feeds']) || '' === $sticky->getVar('misc_title') || '' === $sticky->getVar('misc_content')) { return false; } if ((\in_array(-1, $setting['feeds']) && empty($feed['plugin'])) @@ -294,7 +294,7 @@ public function rssTimeStamp(int $time): ?string public function sortTimestamp(array $a, array $b): int { - if ($a['timestamp'] == $b['timestamp']) { + if ($a['timestamp'] === $b['timestamp']) { return 0; } @@ -313,7 +313,7 @@ public function cleanupChars(string &$text, bool $strip = true, bool $dospec = t $text = \htmlspecialchars($text, \ENT_QUOTES, $this->charset); $text = \preg_replace('/&(#\d+);/i', '&$1;', $text); } - if (XOOPS_USE_MULTIBYTES != 1 || !\preg_match('/utf-8/i', $this->charset)) { + if (XOOPS_USE_MULTIBYTES !== 1 || !\preg_match('/utf-8/i', $this->charset)) { $text = \str_replace(\array_map('\chr', \array_keys($this->escaped)), $this->escaped, $text); } } From 9aa97aecc9f128c918beab298b9e7ff8d37eda39 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 20:59:23 -0400 Subject: [PATCH 135/154] Unnecessary type casting --- class/FeedHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 83d56064..80041aec 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -304,7 +304,7 @@ public function sortTimestamp(array $a, array $b): int public function cleanupChars(string &$text, bool $strip = true, bool $dospec = true, bool $dosub = false): void { if ($strip) { - $text = \strip_tags((string)$text); + $text = \strip_tags($text); } if ($dosub) { $text = $this->doSubstr($text); From 108f9c556b17cbe19d1ee5ed69a6979deba0708d Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 21:16:12 -0400 Subject: [PATCH 136/154] do_migrate.php --- admin/do_migrate.php | 2 +- admin/menu.php | 2 +- admin/migrate.php | 110 ------------------------------------------- 3 files changed, 2 insertions(+), 112 deletions(-) delete mode 100644 admin/migrate.php diff --git a/admin/do_migrate.php b/admin/do_migrate.php index 9e1faeb1..16b5516a 100644 --- a/admin/do_migrate.php +++ b/admin/do_migrate.php @@ -98,7 +98,7 @@ $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_OK'); break; case 'schema': - xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); + xoops_confirm(['op' => 'confirmwrite'], '?do=migrate', constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); break; case 'confirmwrite': if ($GLOBALS['xoopsSecurity']->check()) { diff --git a/admin/menu.php b/admin/menu.php index ac083e41..d4af4a2d 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -86,7 +86,7 @@ if (is_object($helper->getModule()) && $helper->getConfig('displayDeveloperTools')) { $adminmenu[] = [ 'title' => constant('CO_' . $moduleDirNameUpper . '_' . 'ADMENU_MIGRATE'), - 'link' => 'admin/migrate.php', + 'link' => 'admin/?do=migrate', 'icon' => $pathIcon32 . '/database_go.png', ]; } diff --git a/admin/migrate.php b/admin/migrate.php deleted file mode 100644 index 76f22853..00000000 --- a/admin/migrate.php +++ /dev/null @@ -1,110 +0,0 @@ - // -// ------------------------------------------------------------------------ // -// This program is free software; you can redistribute it and/or modify // -// it under the terms of the GNU General Public License as published by // -// the Free Software Foundation; either version 2 of the License, or // -// (at your option) any later version. // -// // -// 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. See the // -// GNU General Public License for more details. // -// // -// You should have received a copy of the GNU General Public License // -// along with this program; if not, write to the Free Software // -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// ------------------------------------------------------------------------ // -// Author: Kazumi Ono (AKA onokazu) // -// URL: http://www.myweb.ne.jp/, https://xoops.org/, http://jp.xoops.org/ // -// Project: XOOPS Project // -// ------------------------------------------------------------------------- // - -use Xmf\Module\Admin; -use Xmf\Request; -use XoopsModules\Rssfit\{ - Common\Configurator, - Common\Migrate -}; - -/** @var Admin $adminObject */ -/** @var Configurator $configurator */ -/** @var Migrate $migrator */ - -require_once __DIR__ . '/admin_header.php'; -//xoops_cp_header(); - -$adminObject->displayNavigation(basename(__FILE__)); - -echo << -
      - -
      -
      - -
      -
      - -
      - -EOF; - -//XoopsLoad::load('migrate', 'newbb'); - -$configurator = new Configurator(); - -$migrator = new Migrate($configurator); - -$op = Request::getCmd('op', 'show'); -$opShow = Request::getCmd('show', null, 'POST'); -$opMigrate = Request::getCmd('migrate', null, 'POST'); -$opSchema = Request::getCmd('schema', null, 'POST'); -$op = !empty($opShow) ? 'show' : $op; -$op = !empty($opMigrate) ? 'migrate' : $op; -$op = !empty($opSchema) ? 'schema' : $op; - -$message = ''; - -switch ($op) { - case 'show': - default: - $queue = $migrator->getSynchronizeDDL(); - if (!empty($queue)) { - echo "
      \n";
      -            foreach ($queue as $line) {
      -                echo $line . ";\n";
      -            }
      -            echo "
      \n"; - } - break; - case 'migrate': - $migrator->synchronizeSchema(); - $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_OK'); - break; - case 'schema': - xoops_confirm(['op' => 'confirmwrite'], 'migrate.php', constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_WARNING'), constant('CO_' . $moduleDirNameUpper . '_' . 'CONFIRM')); - break; - case 'confirmwrite': - if ($GLOBALS['xoopsSecurity']->check()) { - $migrator->saveCurrentSchema(); - - $message = constant('CO_' . $moduleDirNameUpper . '_' . 'MIGRATE_SCHEMA_OK'); - } - break; -} - -echo "
      $message
      "; - -require_once __DIR__ . '/admin_footer.php'; From 912798483f414d5ca77224fd799a08c3570e7022 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 21:17:17 -0400 Subject: [PATCH 137/154] rssfit_1.32_migrate.yml --- sql/rssfit_1.32_migrate.yml | 68 +++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 sql/rssfit_1.32_migrate.yml diff --git a/sql/rssfit_1.32_migrate.yml b/sql/rssfit_1.32_migrate.yml new file mode 100644 index 00000000..e9ea42da --- /dev/null +++ b/sql/rssfit_1.32_migrate.yml @@ -0,0 +1,68 @@ +rssfit_plugins: + options: 'ENGINE=MyISAM DEFAULT CHARSET=utf8' + columns: + - + name: rssf_conf_id + attributes: ' int(5) unsigned NOT NULL auto_increment' + - + name: rssf_filename + attributes: ' varchar(50) NOT NULL DEFAULT '''' ' + - + name: rssf_activated + attributes: ' tinyint(1) NOT NULL DEFAULT ''0'' ' + - + name: rssf_grab + attributes: ' tinyint(2) NOT NULL DEFAULT ''0'' ' + - + name: rssf_order + attributes: ' tinyint(2) NOT NULL DEFAULT ''0'' ' + - + name: subfeed + attributes: ' tinyint(1) NOT NULL DEFAULT ''0'' ' + - + name: sub_entries + attributes: ' char(2) NOT NULL DEFAULT '''' ' + - + name: sub_link + attributes: ' varchar(255) NOT NULL DEFAULT '''' ' + - + name: sub_title + attributes: ' varchar(255) NOT NULL DEFAULT '''' ' + - + name: sub_desc + attributes: ' varchar(255) NOT NULL DEFAULT '''' ' + - + name: img_url + attributes: ' varchar(255) NOT NULL DEFAULT '''' ' + - + name: img_link + attributes: ' varchar(255) NOT NULL DEFAULT '''' ' + - + name: img_title + attributes: ' varchar(255) NOT NULL DEFAULT '''' ' + keys: + PRIMARY: + columns: rssf_conf_id + unique: true +rssfit_misc: + options: 'ENGINE=MyISAM DEFAULT CHARSET=utf8' + columns: + - + name: misc_id + attributes: ' smallint(5) unsigned NOT NULL auto_increment' + - + name: misc_category + attributes: ' varchar(30) NOT NULL DEFAULT '''' ' + - + name: misc_title + attributes: ' varchar(255) NOT NULL DEFAULT '''' ' + - + name: misc_content + attributes: ' text NOT NULL ' + - + name: misc_setting + attributes: ' text NOT NULL ' + keys: + PRIMARY: + columns: misc_id + unique: true From 77278ae064bf2185a725840ac0fb3b4e5a8491d6 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 21:18:24 -0400 Subject: [PATCH 138/154] Parameters number mismatch declaration --- admin/do_migrate.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/do_migrate.php b/admin/do_migrate.php index 16b5516a..e8e72551 100644 --- a/admin/do_migrate.php +++ b/admin/do_migrate.php @@ -69,7 +69,7 @@ $configurator = new Configurator(); -$migrator = new Migrate($configurator); +$migrator = new Migrate(); $op = Request::getCmd('op', 'show'); $opShow = Request::getCmd('show', null, 'POST'); From 40c78e51b6522c763178df676b4fbf5b2ea04507 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 21:28:50 -0400 Subject: [PATCH 139/154] Variable name is not following coding convention --- class/Common/SysUtility.php | 62 ++++++++++++++++++------------------- class/Plugins/Comments.php | 8 ++--- 2 files changed, 35 insertions(+), 35 deletions(-) diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 192b57d6..ca137be6 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -70,14 +70,14 @@ public static function selectSorting(string $text, string $form_sort): string { global $start, $order, $sort; - $select_view = ''; + $selectView = ''; $moduleDirName = \basename(\dirname(__DIR__)); $helper = Helper::getInstance(); //$pathModIcon16 = XOOPS_URL . '/modules/' . $moduleDirName . '/' . $helper->getConfig('modicons16'); $pathModIcon16 = $helper->url($helper->getModule()->getInfo('modicons16')); - $select_view = '
      ' . $text . ''; + $selectView = '' . $text . ''; //$sorts = $sort == 'asc' ? 'desc' : 'asc'; if ($form_sort == $sort) { $sel1 = 'asc' === $order ? 'selasc.png' : 'asc.png'; @@ -86,27 +86,27 @@ public static function selectSorting(string $text, string $form_sort): string $sel1 = 'asc.png'; $sel2 = 'desc.png'; } - $select_view .= ' ASC'; - $select_view .= 'DESC'; - $select_view .= '
      '; + $selectView .= ' ASC'; + $selectView .= 'DESC'; + $selectView .= ''; - return $select_view; + return $selectView; } /***************Blocks***************/ public static function blockAddCatSelect(array $cats): string { - $cat_sql = ''; + $catSql = ''; if (!empty($cats)) { - $cat_sql = '(' . \current($cats); + $catSql = '(' . \current($cats); \array_shift($cats); foreach ($cats as $cat) { - $cat_sql .= ',' . $cat; + $catSql .= ',' . $cat; } - $cat_sql .= ')'; + $catSql .= ')'; } - return $cat_sql; + return $catSql; } public static function metaKeywords(string $content): void @@ -223,58 +223,58 @@ public static function truncateHtml( } // splits all html-tags to scanable lines \preg_match_all('/(<.+?' . '>)?([^<>]*)/s', $text, $lines, \PREG_SET_ORDER); - $total_length = \mb_strlen($ending); + $totalLength = \mb_strlen($ending); //$openTags = []; $truncate = ''; - foreach ($lines as $line_matchings) { + foreach ($lines as $lineMatchings) { // if there is any html-tag in this line, handle it and add it (uncounted) to the output - if (!empty($line_matchings[1])) { + if (!empty($lineMatchings[1])) { // if it's an "empty element" with or without xhtml-conform closing slash - if (\preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $line_matchings[1])) { + if (\preg_match('/^<(\s*.+?\/\s*|\s*(img|br|input|hr|area|base|basefont|col|frame|isindex|link|meta|param)(\s.+?)?)>$/is', $lineMatchings[1])) { // do nothing // if tag is a closing tag - } elseif (\preg_match('/^<\s*\/(\S+?)\s*>$/s', $line_matchings[1], $tag_matchings)) { + } elseif (\preg_match('/^<\s*\/(\S+?)\s*>$/s', $lineMatchings[1], $tagMatchings)) { // delete tag from $openTags list - $pos = \array_search($tag_matchings[1], $openTags, true); + $pos = \array_search($tagMatchings[1], $openTags, true); if (false !== $pos) { unset($openTags[$pos]); } // if tag is an opening tag - } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $line_matchings[1], $tag_matchings)) { + } elseif (\preg_match('/^<\s*([^\s>!]+).*?' . '>$/s', $lineMatchings[1], $tagMatchings)) { // add tag to the beginning of $openTags list - \array_unshift($openTags, \mb_strtolower($tag_matchings[1])); + \array_unshift($openTags, \mb_strtolower($tagMatchings[1])); } // add html-tag to $truncate'd text - $truncate .= $line_matchings[1]; + $truncate .= $lineMatchings[1]; } // calculate the length of the plain text part of the line; handle entities as one character - $content_length = \mb_strlen(\preg_replace('/&[0-9a-z]{2,8};|&#\d{1,7};|[0-9a-f]{1,6};/i', ' ', $line_matchings[2])); - if ($total_length + $content_length > $length) { + $contentLength = \mb_strlen(\preg_replace('/&[0-9a-z]{2,8};|&#\d{1,7};|[0-9a-f]{1,6};/i', ' ', $lineMatchings[2])); + if ($totalLength + $contentLength > $length) { // the number of characters which are left - $left = $length - $total_length; - $entities_length = 0; + $left = $length - $totalLength; + $entitiesLength = 0; // search for html entities - if (\preg_match_all('/&[0-9a-z]{2,8};|&#\d{1,7};|[0-9a-f]{1,6};/i', $line_matchings[2], $entities, \PREG_OFFSET_CAPTURE)) { + if (\preg_match_all('/&[0-9a-z]{2,8};|&#\d{1,7};|[0-9a-f]{1,6};/i', $lineMatchings[2], $entities, \PREG_OFFSET_CAPTURE)) { // calculate the real length of all entities in the legal range foreach ($entities[0] as $entity) { - if ($left >= $entity[1] + 1 - $entities_length) { + if ($left >= $entity[1] + 1 - $entitiesLength) { $left--; - $entities_length += \mb_strlen($entity[0]); + $entitiesLength += \mb_strlen($entity[0]); } else { // no more characters left break; } } } - $truncate .= \mb_substr($line_matchings[2], 0, $left + $entities_length); + $truncate .= \mb_substr($lineMatchings[2], 0, $left + $entitiesLength); // maximum length is reached, so get off the loop break; } - $truncate .= $line_matchings[2]; - $total_length += $content_length; + $truncate .= $lineMatchings[2]; + $totalLength += $contentLength; // if the maximum length is reached, get off the loop - if ($total_length >= $length) { + if ($totalLength >= $length) { break; } } diff --git a/class/Plugins/Comments.php b/class/Plugins/Comments.php index 02e66929..48ab6605 100644 --- a/class/Plugins/Comments.php +++ b/class/Plugins/Comments.php @@ -68,17 +68,17 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array $criteria->setSort('com_created'); $criteria->setOrder('DESC'); $comments = $commentHandler->getObjects($criteria, true); - $comment_config = []; + $commentConfig = []; if (\count($comments) > 0) { $modules = $GLOBALS['module_handler']->getObjects(new Criteria('hascomments', 1), true); $ret = []; foreach (\array_keys($comments) as $i) { $mid = $comments[$i]->getVar('com_modid'); - if (!isset($comment_config[$mid])) { - $comment_config[$mid] = $modules[$mid]->getInfo('comments'); + if (!isset($commentConfig[$mid])) { + $commentConfig[$mid] = $modules[$mid]->getInfo('comments'); } $ret[$i]['title'] = 'Comments: ' . $comments[$i]->getVar('com_title', 'n'); - $link = XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname') . '/' . $comment_config[$mid]['pageName'] . '?' . $comment_config[$mid]['itemName'] . '=' . $comments[$i]->getVar('com_itemid') . '&com_id=' . $i . '&com_rootid=' . $comments[$i]->getVar( + $link = XOOPS_URL . '/modules/' . $modules[$mid]->getVar('dirname') . '/' . $commentConfig[$mid]['pageName'] . '?' . $commentConfig[$mid]['itemName'] . '=' . $comments[$i]->getVar('com_itemid') . '&com_id=' . $i . '&com_rootid=' . $comments[$i]->getVar( 'com_rootid' ) . '&' . $comments[$i]->getVar('com_exparams') . '#comment' . $i; $ret[$i]['link'] = $ret[$i]['guid'] = $link; From 562c1f090d0b747d9d51f6b9e9580bf9fe94bcaa Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 21:29:10 -0400 Subject: [PATCH 140/154] define $sql as array --- include/install.php | 1 + 1 file changed, 1 insertion(+) diff --git a/include/install.php b/include/install.php index d22e5365..795c9ae1 100644 --- a/include/install.php +++ b/include/install.php @@ -70,6 +70,7 @@ function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $oldversion): bo [$rows] = $xoopsDB->fetchRow($result); } if (!$rows) { + $sql = []; // $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` ADD `misc_setting` TEXT NOT NULL;'; // $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; $intro_setting = ['dohtml' => 1, 'dobr' => 1, 'sub' => _INSTALL_INTRO_SUB]; From a8e3b8112499e833714ae420161cce5132381d2f Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 21:47:46 -0400 Subject: [PATCH 141/154] naming conventions --- admin/do_plugins.php | 6 +++--- class/Plugins/Extcal.php | 14 +++++++------- include/install.php | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/admin/do_plugins.php b/admin/do_plugins.php index bc5a7c6c..356a3290 100644 --- a/admin/do_plugins.php +++ b/admin/do_plugins.php @@ -206,7 +206,7 @@ } break; case 'save': - $rssf_grab = Request::getArray('rssf_grab', [], 'POST'); + $rssfGrab = Request::getArray('rssf_grab', [], 'POST'); $rssf_order = Request::getArray('rssf_order', [], 'POST'); $action = Request::getArray('action', null, 'POST'); $install = Request::getArray('install', [], 'POST'); @@ -216,8 +216,8 @@ foreach ($keys as $k) { $plugin = $pluginHandler->get($k); if ($plugin) { - if (isset($rssf_grab[$k])) { - $plugin->setVar('rssf_grab', $rssf_grab[$k]); + if (isset($rssfGrab[$k])) { + $plugin->setVar('rssf_grab', $rssfGrab[$k]); $plugin->setVar('rssf_order', $rssf_order[$k]); } switch ($action[$k]) { diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index 334f4684..596cc1b5 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -93,7 +93,7 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array /** @var \XoopsConfigHandler $configHandler */ $configHandler = \xoops_getHandler('config'); $extcalConfig = $configHandler->getConfigsByCat(0, $extcal->getVar('mid')); - $long_form = $extcalConfig['date_long']; + $dateLongForm = $extcalConfig['date_long']; $eventHandler = PluginHelper::getInstance()->getHandler('Event'); $catHandler = PluginHelper::getInstance()->getHandler('Category'); @@ -106,20 +106,20 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array $cat = $catHandler->getCat($event->getVar('cat_id'), 0); $category = $cat->getVar('cat_name'); $link = XOOPS_URL . '/modules/extcal/event.php?event=' . $event->getVar('event_id'); - $event_start = \formatTimestamp($event->getVar('event_start'), $long_form); + $eventStart = \formatTimestamp($event->getVar('event_start'), $dateLongForm); $temp = \htmlspecialchars($event->getVar('event_title'), \ENT_QUOTES); $title = \xoops_utf8_encode($temp); $temp = \htmlspecialchars($event->getVar('event_desc'), \ENT_QUOTES); $description = \xoops_utf8_encode($temp); $address = $event->getVar('event_address'); - $desc_link = $event->getVar('event_url'); - if ('' == $desc_link) { - $desc_link = $link; + $eventUrl = $event->getVar('event_url'); + if ('' == $eventUrl) { + $eventUrl = $link; } - $desc = "$title
      "; + $desc = "$title
      "; $desc .= ''; - $desc .= ""; + $desc .= ""; if ('' != $address) { $desc .= ""; } diff --git a/include/install.php b/include/install.php index 795c9ae1..9d65e01a 100644 --- a/include/install.php +++ b/include/install.php @@ -35,9 +35,9 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod): bool $myts = \MyTextSanitizer::getInstance(); // rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); xoops_loadLanguage('install', $moduleDirName); - $intro_setting = ['dohtml' => 1, 'dobr' => 1, 'sub' => stripslashes(_INSTALL_INTRO_SUB)]; + $introSetting = ['dohtml' => 1, 'dobr' => 1, 'sub' => stripslashes(_INSTALL_INTRO_SUB)]; $sql[] = 'INSERT INTO `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` VALUES (1, ' . $xoopsDB->quoteString('intro') . ', ' . $xoopsDB->quoteString(stripslashes(_INTRO_TITLE)) . ', ' . $xoopsDB->quoteString(stripslashes(_INTRO_CONTENT)) . ', ' . $xoopsDB->quoteString( - serialize($intro_setting) + serialize($introSetting) ) . ')'; $sql[] = rssfInsertChannel($xoopsMod); $sql[] = 'INSERT INTO ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . ' VALUES ' . "(null, 'sticky', '', '', " . $xoopsDB->quoteString(serialize(['dohtml' => 0, 'dobr' => 0, 'feeds' => [0 => '0'], 'link' => XOOPS_URL])) . ')'; @@ -73,8 +73,8 @@ function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $oldversion): bo $sql = []; // $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` ADD `misc_setting` TEXT NOT NULL;'; // $sql[] = 'ALTER TABLE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` CHANGE `misc_category` `misc_category` VARCHAR( 30 ) NOT NULL;'; - $intro_setting = ['dohtml' => 1, 'dobr' => 1, 'sub' => _INSTALL_INTRO_SUB]; - $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` SET misc_setting = ' . $xoopsDB->quoteString(serialize($intro_setting)) . " WHERE misc_category = 'intro'"; + $introSetting = ['dohtml' => 1, 'dobr' => 1, 'sub' => _INSTALL_INTRO_SUB]; + $sql[] = 'UPDATE `' . $xoopsDB->prefix($helper->getDirname() . '_misc') . '` SET misc_setting = ' . $xoopsDB->quoteString(serialize($introSetting)) . " WHERE misc_category = 'intro'"; // $sql[] = 'ALTER TABLE `' // . $xoopsDB->prefix($helper->getDirname() . '_plugins') // . "` ADD `subfeed` TINYINT( 1 ) DEFAULT '0' NOT NULL, ADD `sub_entries` VARCHAR( 2 ) NOT NULL, ADD `sub_link` VARCHAR( 255 ) NOT NULL, ADD `sub_title` VARCHAR( 255 ) NOT NULL, ADD `sub_desc` VARCHAR( 255 ) NOT NULL, ADD `img_url` VARCHAR( 255 ) NOT NULL, ADD `img_link` VARCHAR( 255 ) NOT NULL, ADD `img_title` VARCHAR( 255 ) NOT NULL;"; From 3b7e9f8fcd8f03eac706d0124cd8844248029972 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 21:51:02 -0400 Subject: [PATCH 142/154] $fields already declared as array --- class/MiscHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 85500a37..3a031f78 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -221,7 +221,7 @@ public function insert(\XoopsObject $object, $force = false) */ public function modifyObjects(?\Criteria $criteria = null, array $fields = [], bool $force = false): ?string { - if ($fields && \is_array($fields)) { + if (count($fields) > 0) { $obj = new $this->objClass(); $sql = ''; foreach ($fields as $k => $v) { From 9525ca4e846c296776e8d0f9e2b391944e8109f0 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 21:53:25 -0400 Subject: [PATCH 143/154] PhpDoc --- class/MiscHandler.php | 3 --- 1 file changed, 3 deletions(-) diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 3a031f78..492cd86b 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -35,9 +35,6 @@ class MiscHandler extends \XoopsPersistableObjectHandler public $dbTable; public $objClass = Misc::class; public $objKey = 'misc_id'; - /** - * @var \XoopsModules\Rssfit\Helper - */ public $helper; public function __construct(?\XoopsMySQLDatabase $db = null, ?Helper $helper = null) From 3c50216be1c9d5d9eb574a21090d0770321f38b1 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 21:53:39 -0400 Subject: [PATCH 144/154] Nested assignments usage --- class/MiscHandler.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 492cd86b..0c4350b7 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -120,7 +120,8 @@ public function getCount($criteria = null): ?int public function getObjects2($criteria = null, string $fields = '*', string $key = ''): ?array { $ret = null; - $limit = $start = 0; + $start = 0; + $limit = $start; // $fields = '*'; $sql = 'SELECT ' . $fields . ' FROM ' . $this->dbTable; if (($criteria instanceof \CriteriaCompo) || ($criteria instanceof \Criteria)) { From dddc98ce85c8ef904cc9ca2e1d30dd9e043fd7ac Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 21:55:11 -0400 Subject: [PATCH 145/154] This condition execution costs less than the previous one. --- class/MiscHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/MiscHandler.php b/class/MiscHandler.php index 0c4350b7..1fdc44f6 100644 --- a/class/MiscHandler.php +++ b/class/MiscHandler.php @@ -184,7 +184,7 @@ public function insert(\XoopsObject $object, $force = false) if (\count($object->getErrors()) > 0) { return false; } - if ($object->isNew() || empty($cleanvars[$this->objKey])) { + if (empty($cleanvars[$this->objKey]) || $object->isNew()) { $cleanvars[$this->objKey] = $this->db->genId($this->dbTable . '_' . $this->objKey . '_seq'); $sql = 'INSERT INTO ' . $this->dbTable . ' (' . \implode(',', \array_keys($cleanvars)) . ') VALUES (' . \implode(',', $cleanvars) . ')'; } else { From f82bdf6bee7a98223b4ab76dc49fa673ed3bb73f Mon Sep 17 00:00:00 2001 From: mambax7 Date: Tue, 19 Oct 2021 21:59:48 -0400 Subject: [PATCH 146/154] $fields already defined as array --- class/PluginHandler.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/class/PluginHandler.php b/class/PluginHandler.php index f634818d..cc751e17 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -234,7 +234,7 @@ public function getObjects2($criteria = null, string $fields = '*', string $key */ public function modifyObjects($criteria = null, array $fields = [], bool $force = false): ?string { - if ($fields && \is_array($fields)) { + if (count($fields) > 0) { $object = new $this->objClass(); $sql = ''; foreach ($fields as $k => $v) { From 2be8d87dfc8f9208def90e3855708778f7ef4c26 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 20 Oct 2021 00:09:18 -0400 Subject: [PATCH 147/154] cleanupChars() requires a string --- class/FeedHandler.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/class/FeedHandler.php b/class/FeedHandler.php index 80041aec..5cd8e81a 100644 --- a/class/FeedHandler.php +++ b/class/FeedHandler.php @@ -118,7 +118,7 @@ public function getChannel(array &$feed): void $channel['language'] = _LANGCODE; $channel['lastBuildDate'] = $this->rssTimeStamp(\time()); if ($this->modConfig['cache']) { - $channel['ttl'] = $this->modConfig['cache']; + $channel['ttl'] = (string)$this->modConfig['cache']; } } if (!empty($feed['plugin'])) { @@ -146,6 +146,7 @@ public function getChannel(array &$feed): void $channel = \array_merge($channel, $this->channelreq); } foreach ($channel as $k => $v) { + $this->cleanupChars($channel[$k]); } if (!empty($image)) { From 480d671f9f87ae2050d95b99c20a7df2090db3fd Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 20 Oct 2021 00:11:59 -0400 Subject: [PATCH 148/154] move $dirname to AbstractPlugin --- class/AbstractPlugin.php | 1 + class/Plugins/Adslight.php | 4 +++- class/Plugins/Ams.php | 4 +++- class/Plugins/Apcal.php | 4 +++- class/Plugins/Comments.php | 7 +++---- class/Plugins/Extcal.php | 4 +++- class/Plugins/Lexikon.php | 4 +++- class/Plugins/Myalbum.php | 4 +++- class/Plugins/Mylinks.php | 4 +++- class/Plugins/Newbb.php | 4 +++- class/Plugins/News.php | 4 +++- class/Plugins/Oledrion.php | 4 +++- class/Plugins/Pical.php | 4 +++- class/Plugins/Publisher.php | 4 +++- class/Plugins/Sample.php | 4 +++- class/Plugins/Smartfaq.php | 4 +++- class/Plugins/Smartpartner.php | 4 +++- class/Plugins/Surnames.php | 4 +++- class/Plugins/Wfdownloads.php | 7 +++---- class/Plugins/Wflinks.php | 4 +++- class/Plugins/Xoopstube.php | 4 +++- 21 files changed, 61 insertions(+), 26 deletions(-) diff --git a/class/AbstractPlugin.php b/class/AbstractPlugin.php index bb976b44..fe0aaaf8 100644 --- a/class/AbstractPlugin.php +++ b/class/AbstractPlugin.php @@ -46,6 +46,7 @@ abstract class AbstractPlugin implements PluginInterface public $grab; public $module; // optional, see line 67 public $helper; + public $dirname = ''; public function loadModule(): ?\XoopsModule { diff --git a/class/Plugins/Adslight.php b/class/Plugins/Adslight.php index 2d54e9bf..1b6fab33 100644 --- a/class/Plugins/Adslight.php +++ b/class/Plugins/Adslight.php @@ -44,7 +44,9 @@ */ final class Adslight extends AbstractPlugin { - public $dirname = 'adslight'; + public function __construct() { + $this->dirname = 'adslight'; + } public function loadModule(): ?\XoopsModule { diff --git a/class/Plugins/Ams.php b/class/Plugins/Ams.php index e672c87e..fb3eeb67 100644 --- a/class/Plugins/Ams.php +++ b/class/Plugins/Ams.php @@ -49,7 +49,9 @@ */ final class Ams extends AbstractPlugin { - public $dirname = 'ams'; + public function __construct() { + $this->dirname = 'ams'; + } /** * @return array diff --git a/class/Plugins/Apcal.php b/class/Plugins/Apcal.php index 3a8f91f1..3ff8068d 100644 --- a/class/Plugins/Apcal.php +++ b/class/Plugins/Apcal.php @@ -46,7 +46,9 @@ */ final class Apcal extends AbstractPlugin { - public $dirname = 'apcal'; + public function __construct() { + $this->dirname = 'apcal'; + } public function loadModule(): ?\XoopsModule { diff --git a/class/Plugins/Comments.php b/class/Plugins/Comments.php index 48ab6605..50a2860e 100644 --- a/class/Plugins/Comments.php +++ b/class/Plugins/Comments.php @@ -51,11 +51,10 @@ */ final class Comments extends AbstractPlugin { - public $dirname = 'system'; + public function __construct() { + $this->dirname = 'system'; + } - /** - * @return array - */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { $myts = \MyTextSanitizer::getInstance(); diff --git a/class/Plugins/Extcal.php b/class/Plugins/Extcal.php index 596cc1b5..6fae18a7 100644 --- a/class/Plugins/Extcal.php +++ b/class/Plugins/Extcal.php @@ -64,7 +64,9 @@ */ final class Extcal extends AbstractPlugin { - public $dirname = 'extcal'; + public function __construct() { + $this->dirname = 'extcal'; + } public function loadModule(): ?\XoopsModule { diff --git a/class/Plugins/Lexikon.php b/class/Plugins/Lexikon.php index c19f8280..26463059 100644 --- a/class/Plugins/Lexikon.php +++ b/class/Plugins/Lexikon.php @@ -45,7 +45,9 @@ */ final class Lexikon extends AbstractPlugin { - public $dirname = 'lexikon'; + public function __construct() { + $this->dirname = 'lexikon'; + } public function loadModule(): ?\XoopsModule { diff --git a/class/Plugins/Myalbum.php b/class/Plugins/Myalbum.php index 8a669848..9d2c2fe8 100644 --- a/class/Plugins/Myalbum.php +++ b/class/Plugins/Myalbum.php @@ -64,7 +64,9 @@ */ final class Myalbum extends AbstractPlugin { - public $dirname = 'myalbum'; + public function __construct() { + $this->dirname = 'myalbum'; + } public function myGetUnameFromId(int $uid): string { diff --git a/class/Plugins/Mylinks.php b/class/Plugins/Mylinks.php index dd2b0234..218e4b4d 100644 --- a/class/Plugins/Mylinks.php +++ b/class/Plugins/Mylinks.php @@ -47,7 +47,9 @@ */ final class Mylinks extends AbstractPlugin { - public $dirname = 'mylinks'; + public function __construct() { + $this->dirname = 'mylinks'; + } public function loadModule(): ?\XoopsModule { diff --git a/class/Plugins/Newbb.php b/class/Plugins/Newbb.php index 72e01aba..bd355a94 100644 --- a/class/Plugins/Newbb.php +++ b/class/Plugins/Newbb.php @@ -47,7 +47,9 @@ */ final class Newbb extends AbstractPlugin { - public $dirname = 'newbb'; + public function __construct() { + $this->dirname = 'newbb'; + } public function loadModule(): ?\XoopsModule { diff --git a/class/Plugins/News.php b/class/Plugins/News.php index 7138a093..8c4d195d 100644 --- a/class/Plugins/News.php +++ b/class/Plugins/News.php @@ -49,7 +49,9 @@ */ final class News extends AbstractPlugin { - public $dirname = 'news'; + public function __construct() { + $this->dirname = 'news'; + } /** * @return array diff --git a/class/Plugins/Oledrion.php b/class/Plugins/Oledrion.php index dae050e4..b5d9268e 100644 --- a/class/Plugins/Oledrion.php +++ b/class/Plugins/Oledrion.php @@ -38,7 +38,9 @@ */ final class Oledrion extends AbstractPlugin { - public $dirname = 'oledrion'; + public function __construct() { + $this->dirname = 'oledrion'; + } public function loadModule(): ?\XoopsModule { diff --git a/class/Plugins/Pical.php b/class/Plugins/Pical.php index e6d0905e..19eb7fc4 100644 --- a/class/Plugins/Pical.php +++ b/class/Plugins/Pical.php @@ -47,7 +47,9 @@ */ final class Pical extends AbstractPlugin { - public $dirname = 'piCal'; + public function __construct() { + $this->dirname = 'pical'; + } /** * @return array diff --git a/class/Plugins/Publisher.php b/class/Plugins/Publisher.php index 0581b575..ea4cd1f9 100644 --- a/class/Plugins/Publisher.php +++ b/class/Plugins/Publisher.php @@ -49,7 +49,9 @@ */ final class Publisher extends AbstractPlugin { - public $dirname = 'publisher'; + public function __construct() { + $this->dirname = 'publisher'; + } public function loadModule(): ?\XoopsModule { diff --git a/class/Plugins/Sample.php b/class/Plugins/Sample.php index 6bfd17d5..2b639545 100644 --- a/class/Plugins/Sample.php +++ b/class/Plugins/Sample.php @@ -65,7 +65,9 @@ */ final class Sample extends AbstractPlugin { - public $dirname = 'sample'; + public function __construct() { + $this->dirname = 'sample'; + } /** * @return array diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php index 937efb53..ff0b4cf5 100644 --- a/class/Plugins/Smartfaq.php +++ b/class/Plugins/Smartfaq.php @@ -47,7 +47,9 @@ */ final class Smartfaq extends AbstractPlugin { - public $dirname = 'smartfaq'; + public function __construct() { + $this->dirname = 'smartfaq'; + } public function loadModule(): ?\XoopsModule { diff --git a/class/Plugins/Smartpartner.php b/class/Plugins/Smartpartner.php index f85340c1..ff3bb07b 100644 --- a/class/Plugins/Smartpartner.php +++ b/class/Plugins/Smartpartner.php @@ -52,7 +52,9 @@ */ final class Smartpartner extends AbstractPlugin { - public $dirname = 'smartpartner'; + public function __construct() { + $this->dirname = 'smartpartner'; + } public function loadModule(): ?\XoopsModule { diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php index 68016b9b..2cf7112f 100644 --- a/class/Plugins/Surnames.php +++ b/class/Plugins/Surnames.php @@ -48,7 +48,9 @@ */ final class Surnames extends AbstractPlugin { - public $dirname = 'surnames'; + public function __construct() { + $this->dirname = 'surnames'; + } public function myGetUnameFromId(int $uid): string { diff --git a/class/Plugins/Wfdownloads.php b/class/Plugins/Wfdownloads.php index 775242cc..e6cde6ab 100644 --- a/class/Plugins/Wfdownloads.php +++ b/class/Plugins/Wfdownloads.php @@ -47,11 +47,10 @@ */ final class Wfdownloads extends AbstractPlugin { - public $dirname = 'wfdownloads'; + public function __construct() { + $this->dirname = 'wfdownloads'; + } - /** - * @return \XoopsModule - */ public function loadModule(): ?\XoopsModule { $mod = null; diff --git a/class/Plugins/Wflinks.php b/class/Plugins/Wflinks.php index 4df9c885..df3b7962 100644 --- a/class/Plugins/Wflinks.php +++ b/class/Plugins/Wflinks.php @@ -50,7 +50,9 @@ */ final class Wflinks extends AbstractPlugin { - public $dirname = 'wflinks'; + public function __construct() { + $this->dirname = 'wflinks'; + } /** * @return array diff --git a/class/Plugins/Xoopstube.php b/class/Plugins/Xoopstube.php index 9294a7c6..41aa6024 100644 --- a/class/Plugins/Xoopstube.php +++ b/class/Plugins/Xoopstube.php @@ -49,7 +49,9 @@ final class Xoopstube extends AbstractPlugin /** * @var string */ - public $dirname = 'xoopstube'; + public function __construct() { + $this->dirname = 'xoopstube'; + } public function loadModule(): ?\XoopsModule { From 3dbbc899a12963dadd03e1fe1da74694daf25d86 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 20 Oct 2021 00:41:32 -0400 Subject: [PATCH 149/154] Unused local variable --- class/Common/SysUtility.php | 6 +++--- class/Common/VersionChecks.php | 3 --- class/PluginHandler.php | 1 - class/Plugins/News.php | 1 - class/Plugins/Smartfaq.php | 1 - class/Plugins/Surnames.php | 1 - include/install.php | 6 +++--- include/oninstall.php | 2 -- include/onupdate.php | 6 ++---- 9 files changed, 8 insertions(+), 19 deletions(-) diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index ca137be6..9a5a0aba 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -71,7 +71,6 @@ public static function selectSorting(string $text, string $form_sort): string global $start, $order, $sort; $selectView = ''; - $moduleDirName = \basename(\dirname(__DIR__)); $helper = Helper::getInstance(); //$pathModIcon16 = XOOPS_URL . '/modules/' . $moduleDirName . '/' . $helper->getConfig('modicons16'); @@ -167,6 +166,7 @@ public static function enumerate(string $tableName, string $columnName): ?array public static function cloneRecord(string $tableName, string $idField, int $id): ?int { $newId = null; + $tempTable = ''; $table = $GLOBALS['xoopsDB']->prefix($tableName); // copy content of the record you wish to clone $sql = "SELECT * FROM $table WHERE $idField='" . $id . "' "; @@ -332,9 +332,9 @@ public static function getEditor(?\Xmf\Module\Helper $helper = null, ?array $opt if (\class_exists('XoopsFormEditor')) { if ($isAdmin) { - $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editorAdmin'), $options, $nohtml = false, $onfailure = 'textarea'); + $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editorAdmin'), $options, false, 'textarea'); } else { - $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editorUser'), $options, $nohtml = false, $onfailure = 'textarea'); + $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editorUser'), $options, false, 'textarea'); } } else { $descEditor = new \XoopsFormDhtmlTextArea(\ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index b96b8eec..79c29644 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -26,10 +26,7 @@ trait VersionChecks /** * Verifies XOOPS version meets minimum requirements for this module * @static - * @param \XoopsModule|null $module * - * @param string|null $requiredVer - * @return bool true if meets requirements, false if not */ public static function checkVerXoops(?\XoopsModule $module = null, ?string $requiredVer = null): bool { diff --git a/class/PluginHandler.php b/class/PluginHandler.php index cc751e17..ee4f08e5 100644 --- a/class/PluginHandler.php +++ b/class/PluginHandler.php @@ -308,7 +308,6 @@ public function &getPluginFileList(): ?array public function checkPlugin(\XoopsObject $object) { $ret = null; - global $moduleHandler; $file = \RSSFIT_ROOT_PATH . 'class/Plugins/' . $object->getVar('rssf_filename'); if (\is_file($file)) { $ret = []; diff --git a/class/Plugins/News.php b/class/Plugins/News.php index 8c4d195d..ff776bbf 100644 --- a/class/Plugins/News.php +++ b/class/Plugins/News.php @@ -74,7 +74,6 @@ public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array $ret[$i]['link'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); $ret[$i]['guid'] = XOOPS_URL . '/modules/news/article.php?storyid=' . $news[$i]->storyid(); $ret[$i]['timestamp'] = $news[$i]->published(); - $desc = $news[$i]->hometext(); $ret[$i]['description'] = $news[$i]->hometext(); $ret[$i]['category'] = $this->modname; $ret[$i]['domain'] = XOOPS_URL . '/modules/' . $this->dirname . '/'; diff --git a/class/Plugins/Smartfaq.php b/class/Plugins/Smartfaq.php index ff0b4cf5..36a2c878 100644 --- a/class/Plugins/Smartfaq.php +++ b/class/Plugins/Smartfaq.php @@ -70,7 +70,6 @@ public function loadModule(): ?\XoopsModule */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { - $myts = \MyTextSanitizer::getInstance(); $ret = null; // @require_once XOOPS_ROOT_PATH . '/modules/smartfaq/include/functions.php'; diff --git a/class/Plugins/Surnames.php b/class/Plugins/Surnames.php index 2cf7112f..ca012b3f 100644 --- a/class/Plugins/Surnames.php +++ b/class/Plugins/Surnames.php @@ -82,7 +82,6 @@ public function myGetUnameFromId(int $uid): string */ public function grabEntries(\XoopsMySQLDatabase $xoopsDB): ?array { - $myts = \MyTextSanitizer::getInstance(); $ret = null; $i = -1; diff --git a/include/install.php b/include/install.php index 9d65e01a..e7f750ee 100644 --- a/include/install.php +++ b/include/install.php @@ -26,13 +26,12 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod): bool { - global $xoopsDB, $xoopsConfig; + global $xoopsDB; $moduleDirName = \basename(\dirname(__DIR__)); $helper = Rssfit\Helper::getInstance(); - $myts = \MyTextSanitizer::getInstance(); // rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); xoops_loadLanguage('install', $moduleDirName); $introSetting = ['dohtml' => 1, 'dobr' => 1, 'sub' => stripslashes(_INSTALL_INTRO_SUB)]; @@ -58,12 +57,13 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod): bool */ function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $oldversion): bool { - global $xoopsDB, $xoopsConfig; + global $xoopsDB; $helper = Rssfit\Helper::getInstance(); // rssfInstallLangFile($xoopsMod, $xoopsConfig['language']); $moduleDirName = \basename(\dirname(__DIR__)); xoops_loadLanguage('install', $moduleDirName); + $rows = []; $sql = 'SELECT COUNT(*) FROM ' . $xoopsDB->prefix($helper->getDirname() . '_misc') . " WHERE 'misc_category' = 'channel'"; $result = $xoopsDB->query($sql); if ($result instanceof \mysqli_result) { diff --git a/include/oninstall.php b/include/oninstall.php index 0bae883c..fb6310e2 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -23,7 +23,6 @@ /** * Prepares system prior to attempting to install module - * @param \XoopsModule $module {@link XoopsModule} * * @return bool true if ready to install, false if not */ @@ -46,7 +45,6 @@ function xoops_module_pre_install_rssfit(\XoopsModule $module): bool /** * Performs tasks required during installation of the module - * @param \XoopsModule $module {@link XoopsModule} * * @return bool true if installation successful, false if not */ diff --git a/include/onupdate.php b/include/onupdate.php index b4a4e816..f3b2126d 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -31,14 +31,13 @@ */ function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVersion = null): bool { - $moduleDirName = \basename(\dirname(__DIR__)); /** @var Rssfit\Helper $helper */ /** @var Rssfit\Utility $utility */ $helper = Rssfit\Helper::getInstance(); $utility = new Rssfit\Utility(); - $xoopsSuccess = $utility::checkVerXoops($module); - $phpSuccess = $utility::checkVerPhp($module); + $xoopsSuccess = $utility::checkVerXoops($xoopsModule); + $phpSuccess = $utility::checkVerPhp($xoopsModule); return $xoopsSuccess && $phpSuccess; } @@ -53,7 +52,6 @@ function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVers function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = null): bool { $moduleDirName = \basename(\dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); /** @var Rssfit\Helper $helper */ /** @var Rssfit\Utility $utility */ /** @var Rssfit\Common\Configurator $configurator */ From 3baeea0de950bc6c415daf36cfd90fddd0ed80c6 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 20 Oct 2021 00:55:38 -0400 Subject: [PATCH 150/154] not needed \ --- admin/index.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/admin/index.php b/admin/index.php index 85fe2b9c..28ffc90e 100644 --- a/admin/index.php +++ b/admin/index.php @@ -28,7 +28,7 @@ /** @var Helper $helper */ /** @var Utility $utility */ -/** @var \Xmf\Module\Admin $adminObject */ +/** @var Xmf\Module\Admin $adminObject */ /** @var FeedHandler $feedHandler */ /** @var PluginHandler $pluginHandler */ From 28384bbb4f598edc1a2993a6d727fe350aca19e8 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 20 Oct 2021 02:08:02 -0400 Subject: [PATCH 151/154] Scrutinizer --- .scrutinizer.yml | 20 +++++++++++++++++++- class/Common/Migrate.php | 2 +- class/Common/SysUtility.php | 18 +++++++++--------- class/Common/VersionChecks.php | 2 +- include/install.php | 4 ++-- include/oninstall.php | 10 +++++----- include/onupdate.php | 12 +++++------- rss.php | 5 +++-- 8 files changed, 45 insertions(+), 28 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index 45966c13..d6528685 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -11,6 +11,24 @@ build: # to install a specific release tag or branch instead. - git clone --depth=1 https://github.com/XOOPS/XoopsCore25 - git clone --depth=1 https://github.com/mambax7/tag + - git clone --depth=1 https://github.com/mambax7/adslight + - git clone --depth=1 https://github.com/mambax7/ams + - git clone --depth=1 https://github.com/mambax7/apcal + - git clone --depth=1 https://github.com/mambax7/extcal + - git clone --depth=1 https://github.com/mambax7/extgallery + - git clone --depth=1 https://github.com/mambax7/lexikon + - git clone --depth=1 https://github.com/mambax7/myalbum + - git clone --depth=1 https://github.com/mambax7/mylinks + - git clone --depth=1 https://github.com/mambax7/newbb + - git clone --depth=1 https://github.com/mambax7/news + - git clone --depth=1 https://github.com/mambax7/oledrion + - git clone --depth=1 https://github.com/mambax7/publisher + - git clone --depth=1 https://github.com/mambax7/smartfaq + - git clone --depth=1 https://github.com/mambax7/smartpartner + - git clone --depth=1 https://github.com/mambax7/smartsection + - git clone --depth=1 https://github.com/mambax7/wfdownloads + - git clone --depth=1 https://github.com/mambax7/wflinks + - git clone --depth=1 https://github.com/mambax7/xoopstube project_setup: override: true tests: @@ -21,7 +39,7 @@ filter: - XoopsCore25/* - tag/* - adslight/* - - adslight/* + - ams/* - apcal/* - extcal/* - extgallery/* diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index d15f95df..7d6b5b9c 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -124,7 +124,7 @@ private function renameColumns(): void $oldName = $tableName['from']; $newName = $tableName['to']; $attributes = $this->tableHandler->getColumnAttributes($tableName, $oldName); - if (false !== \strpos($attributes, ' int(')) { + if (false !== $attributes && false !== \strpos($attributes, ' int(')) { $this->tableHandler->alterColumn($tableName, $oldName, $attributes, $newName); } } diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 9a5a0aba..f6361228 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -200,20 +200,20 @@ public static function cloneRecord(string $tableName, string $idField, int $id): * @TODO: Refactor to consider HTML5 & void (self-closing) elements * @TODO: Consider using https://github.com/jlgrall/truncateHTML/blob/master/truncateHTML.php * - * @param string $text String to truncate. - * @param int|null $length Length of returned string, including ellipsis. - * @param string|null $ending Ending to be appended to the trimmed string. - * @param bool $exact If false, $text will not be cut mid-word - * @param bool $considerHtml If true, HTML tags would be handled correctly + * @param string $text String to truncate. + * @param int|null $length Length of returned string, including ellipsis. + * @param string $ending Ending to be appended to the trimmed string. + * @param bool $exact If false, $text will not be cut mid-word + * @param bool $considerHtml If true, HTML tags would be handled correctly * * @return string Trimmed string. */ public static function truncateHtml( string $text, ?int $length = 100, - ?string $ending = '...', - ?bool $exact = false, - ?bool $considerHtml = true + string $ending = '...', + bool $exact = false, + bool $considerHtml = true ): string { $openTags = []; if ($considerHtml) { @@ -337,7 +337,7 @@ public static function getEditor(?\Xmf\Module\Helper $helper = null, ?array $opt $descEditor = new \XoopsFormEditor(\ucfirst($options['name']), $helper->getConfig('editorUser'), $options, false, 'textarea'); } } else { - $descEditor = new \XoopsFormDhtmlTextArea(\ucfirst($options['name']), $options['name'], $options['value'], '100%', '100%'); + $descEditor = new \XoopsFormDhtmlTextArea(\ucfirst($options['name']), $options['name'], $options['value']); } // $form->addElement($descEditor); diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 79c29644..c96e5d34 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -41,7 +41,7 @@ public static function checkVerXoops(?\XoopsModule $module = null, ?string $requ //check for minimum XOOPS version $currentVer = mb_substr(\XOOPS_VERSION, 6); // get the numeric part of string if (null === $requiredVer) { - $requiredVer = '' . $module->getInfo('min_xoops'); //making sure it's a string + $requiredVer = (string)$module->getInfo('min_xoops'); //making sure it's a string } $success = true; diff --git a/include/install.php b/include/install.php index e7f750ee..051b6427 100644 --- a/include/install.php +++ b/include/install.php @@ -52,10 +52,10 @@ function xoops_module_install_rssfit(\XoopsModule $xoopsMod): bool } /** - * @param int $oldversion version number of previously installed version + * @param int $previousVersion version number of previously installed version * */ -function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $oldversion): bool +function xoops_module_update_rssfit(\XoopsModule $xoopsMod, int $previousVersion): bool { global $xoopsDB; $helper = Rssfit\Helper::getInstance(); diff --git a/include/oninstall.php b/include/oninstall.php index fb6310e2..4359cf26 100644 --- a/include/oninstall.php +++ b/include/oninstall.php @@ -70,11 +70,11 @@ function xoops_module_install_rssfit(\XoopsModule $module): bool /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); // access rights ------------------------------------------ - $grouppermHandler->addRight($moduleDirName . '_approve', 1, XOOPS_GROUP_ADMIN, $moduleId); - $grouppermHandler->addRight($moduleDirName . '_submit', 1, XOOPS_GROUP_ADMIN, $moduleId); - $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ADMIN, $moduleId); - $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_USERS, $moduleId); - $grouppermHandler->addRight($moduleDirName . '_view', 1, XOOPS_GROUP_ANONYMOUS, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_approve', 1, (int)XOOPS_GROUP_ADMIN, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_submit', 1, (int)XOOPS_GROUP_ADMIN, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_view', 1, (int)XOOPS_GROUP_ADMIN, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_view', 1, (int)XOOPS_GROUP_USERS, $moduleId); + $grouppermHandler->addRight($moduleDirName . '_view', 1, (int)XOOPS_GROUP_ANONYMOUS, $moduleId); // --- CREATE FOLDERS --------------- if (count($configurator->uploadFolders) > 0) { diff --git a/include/onupdate.php b/include/onupdate.php index f3b2126d..e067f52d 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -26,10 +26,9 @@ /** * Prepares system prior to attempting to install module - * @param null $previousVersion * @return bool true if ready to install, false if not */ -function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVersion = null): bool +function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule): bool { /** @var Rssfit\Helper $helper */ /** @var Rssfit\Utility $utility */ @@ -44,16 +43,15 @@ function xoops_module_pre_update_rssfit(\XoopsModule $xoopsModule, $previousVers /** * Performs tasks required during update of the module - * @param \XoopsModule $module {@link XoopsModule} - * @param null $previousVersion * * @return bool true if update successful, false if not */ -function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = null): bool +function xoops_module_update_rssfit(\XoopsModule $module, int $previousVersion): bool { $moduleDirName = \basename(\dirname(__DIR__)); - /** @var Rssfit\Helper $helper */ /** @var Rssfit\Utility $utility */ + /** @var Rssfit\Helper $helper */ + /** @var Rssfit\Utility $utility */ /** @var Rssfit\Common\Configurator $configurator */ $helper = Rssfit\Helper::getInstance(); $utility = new Rssfit\Utility(); @@ -95,7 +93,7 @@ function xoops_module_update_rssfit(\XoopsModule $module, $previousVersion = nul // foreach (array_keys($GLOBALS['uploadFolders']) as $i) { foreach (array_keys($configurator->oldFolders) as $i) { $tempFolder = $GLOBALS['xoops']->path('modules/' . $moduleDirName . $configurator->oldFolders[$i]); - /* @var XoopsObjectHandler $folderHandler */ + /* @var \XoopsObjectHandler $folderHandler */ $folderHandler = XoopsFile::getHandler('folder', $tempFolder); $folderHandler->delete($tempFolder); } diff --git a/rss.php b/rss.php index e8b23ae1..c93a7ff7 100644 --- a/rss.php +++ b/rss.php @@ -81,8 +81,9 @@ # require_once XOOPS_ROOT_PATH.'/footer.php'; # } -if (function_exists('mb_convert_encoding') && $helper->getConfig('utf8')) { - echo mb_convert_encoding($xoopsTpl->fetch($template, $feedHandler->cached, null), 'UTF-8', _CHARSET); +$tempString = $xoopsTpl->fetch($template, $feedHandler->cached, null); +if (function_exists('mb_convert_encoding') && $helper->getConfig('utf8') && null !== $tempString) { + echo mb_convert_encoding($tempString, 'UTF-8', _CHARSET); } else { $xoopsTpl->display($template, $feedHandler->cached); } From 9d5e1594919c2bdbc1f73e279dbfb583248c5e51 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 20 Oct 2021 02:12:26 -0400 Subject: [PATCH 152/154] scrutinizer --- .scrutinizer.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.scrutinizer.yml b/.scrutinizer.yml index d6528685..4ae4c29b 100644 --- a/.scrutinizer.yml +++ b/.scrutinizer.yml @@ -25,7 +25,6 @@ build: - git clone --depth=1 https://github.com/mambax7/publisher - git clone --depth=1 https://github.com/mambax7/smartfaq - git clone --depth=1 https://github.com/mambax7/smartpartner - - git clone --depth=1 https://github.com/mambax7/smartsection - git clone --depth=1 https://github.com/mambax7/wfdownloads - git clone --depth=1 https://github.com/mambax7/wflinks - git clone --depth=1 https://github.com/mambax7/xoopstube @@ -52,7 +51,6 @@ filter: - publisher/* - smartfaq/* - smartpartner/* - - smartsection/* - wfdownloads/* - wflinks/* - xoopstube/* From 36551798e3c11c4da4c3778782494521c54e97af Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 20 Oct 2021 02:31:46 -0400 Subject: [PATCH 153/154] 1.32 Beta 2 --- admin/do_about.php | 2 -- class/Common/Migrate.php | 2 +- docs/changelog.txt | 2 +- xoops_version.php | 2 +- 4 files changed, 3 insertions(+), 5 deletions(-) diff --git a/admin/do_about.php b/admin/do_about.php index 0296616f..737a6d13 100644 --- a/admin/do_about.php +++ b/admin/do_about.php @@ -14,8 +14,6 @@ use Xmf\Module\Admin; -//use Kint; - /** * @copyright XOOPS Project (https://xoops.org) * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index 7d6b5b9c..3bce98db 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -124,7 +124,7 @@ private function renameColumns(): void $oldName = $tableName['from']; $newName = $tableName['to']; $attributes = $this->tableHandler->getColumnAttributes($tableName, $oldName); - if (false !== $attributes && false !== \strpos($attributes, ' int(')) { + if (is_string($attributes) && false !== \strpos($attributes, ' int(')) { $this->tableHandler->alterColumn($tableName, $oldName, $attributes, $newName); } } diff --git a/docs/changelog.txt b/docs/changelog.txt index b77f49d1..57a15029 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,4 +1,4 @@ -
      1.32.0 Beta 2 [NOT RELEASED]
      +
      1.32.0 Beta 2 [2021-10-20]

      - add strict types (mamba) - add return type declaration (mamba) diff --git a/xoops_version.php b/xoops_version.php index 246a42cf..e3d4a3cc 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -30,7 +30,7 @@ $modversion = [ 'version' => '1.32', 'module_status' => 'Beta 2', - 'release_date' => '2021/10/14', + 'release_date' => '2021/10/20', 'name' => _MI_RSSFIT_NAME, 'description' => _MI_RSSFIT_DESC, 'official' => 0, From 570fc7fdad89ce813217f498f44b3ebebb29e469 Mon Sep 17 00:00:00 2001 From: mambax7 Date: Wed, 20 Oct 2021 02:36:00 -0400 Subject: [PATCH 154/154] Starting 1.32 Beta 3 --- docs/changelog.txt | 3 +++ xoops_version.php | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/changelog.txt b/docs/changelog.txt index 57a15029..f1fbd860 100644 --- a/docs/changelog.txt +++ b/docs/changelog.txt @@ -1,3 +1,6 @@ +
      1.32.0 Beta 3 [NOT RELEASED]
      Dev: XOOPS 2.5.11, PHP 7.4.24, PHP 8.0.11, PHP 8.1.0 Beta 4 +
      +
      1.32.0 Beta 2 [2021-10-20]

      - add strict types (mamba) diff --git a/xoops_version.php b/xoops_version.php index e3d4a3cc..f1545ab5 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -29,7 +29,7 @@ // ------------------- Information ------------------- / $modversion = [ 'version' => '1.32', - 'module_status' => 'Beta 2', + 'module_status' => 'Beta 3 Not Released', 'release_date' => '2021/10/20', 'name' => _MI_RSSFIT_NAME, 'description' => _MI_RSSFIT_DESC,
      When:$event_start
      When:$eventStart
      Where:$address