diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 77cb4951..e5ab1262 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ -![alt XOOPS CMS](https://xoops.org/images/logoXoops4GithubRepository.png) +![alt XOOPS CMS](https://xoops.org/images/logoXoopsPhp8.png) # Contributing to [XOOPS CMS](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) diff --git a/admin/about.php b/admin/about.php index 285e731a..2047d6df 100644 --- a/admin/about.php +++ b/admin/about.php @@ -24,7 +24,7 @@ /** @var Admin $adminObject */ -require __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); diff --git a/admin/admin_footer.php b/admin/admin_footer.php index b060a982..acd28a70 100644 --- a/admin/admin_footer.php +++ b/admin/admin_footer.php @@ -20,7 +20,7 @@ use Xmf\Module\Admin; -$pathIcon32 = Admin::iconUrl('', 32); +$pathIcon32 = 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 7354b5cd..7ab6b6b0 100644 --- a/admin/admin_header.php +++ b/admin/admin_header.php @@ -23,23 +23,24 @@ use XoopsModules\Publisher\Helper; use XoopsModules\Publisher\Common\Configurator; -require dirname(__DIR__) . '/preloads/autoloader.php'; +require \dirname(__DIR__) . '/preloads/autoloader.php'; -require_once dirname(__DIR__, 3) . '/include/cp_header.php'; +require \dirname(__DIR__, 3) . '/include/cp_header.php'; //require_once $GLOBALS['xoops']->path('www/class/xoopsformloader.php'); -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; -$moduleDirName = basename(dirname(__DIR__)); +$moduleDirName = \basename(\dirname(__DIR__)); $helper = Helper::getInstance(); /** @var Admin $adminObject */ $adminObject = Admin::getInstance(); -$pathIcon16 = Admin::iconUrl('', 16); -$pathIcon32 = Admin::iconUrl('', 32); -if (is_object($helper->getModule())) { - $pathModIcon32 = $helper->getModule()->getInfo('modicons32'); +$pathIcon16 = Admin::iconUrl('', '16'); +$pathIcon32 = Admin::iconUrl('', '32'); +$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')); } // Load language files diff --git a/admin/blockform.php b/admin/blockform.php index 647e216f..2f3fdfc9 100644 --- a/admin/blockform.php +++ b/admin/blockform.php @@ -7,7 +7,6 @@ * 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. * - * PHP version 5 * * @category Module * @author XOOPS Development Team @@ -15,10 +14,21 @@ * @link https://xoops.org * @license GNU GPL 2 or later (https://www.gnu.org/licenses/gpl-2.0.html) */ + +use Xmf\Module\Admin; +use XoopsModules\Publisher\{ + Helper +}; + +/** @var Admin $adminObject */ +/** @var Helper $helper */ + require_once XOOPS_ROOT_PATH . '/class/xoopsformloader.php'; -$moduleDirName = basename(dirname(__DIR__)); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName +$moduleDirName = \basename(\dirname(__DIR__)); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); + +$helper->loadLanguage('blocksadmin'); $form = new \XoopsThemeForm($block['form_title'], 'blockform', 'blocksadmin.php', 'post', true); if (isset($block['name'])) { @@ -51,7 +61,7 @@ ksort($moduleList); $moduleSelect->addOptionArray($moduleList); $form->addElement($moduleSelect); -$form->addElement(new \XoopsFormText(constant('CO_' . $moduleDirNameUpper . '_' . 'TITLE'), 'btitle', 50, 255, $block['title']), false); +$form->addElement(new \XoopsFormText(_AM_SYSTEM_BLOCKS_TITLE, 'btitle', 50, 255, $block['title']), false); if ($block['is_custom']) { $textarea = new \XoopsFormDhtmlTextArea(_AM_SYSTEM_BLOCKS_CONTENT, 'bcontent', $block['content'], 15, 70); $textarea->setDescription('' . _AM_SYSTEM_BLOCKS_USEFULTAGS . '
' . sprintf(_AM_BLOCKTAG1, '{X_SITEURL}', XOOPS_URL . '/') . ''); @@ -87,17 +97,17 @@ $cacheSelect = new \XoopsFormSelect(_AM_SYSTEM_BLOCKS_BCACHETIME, 'bcachetime', $block['bcachetime']); $cacheSelect->addOptionArray( [ - '0' => _NOCACHE, - '30' => sprintf(_SECONDS, 30), - '60' => _MINUTE, - '300' => sprintf(_MINUTES, 5), - '1800' => sprintf(_MINUTES, 30), - '3600' => _HOUR, - '18000' => sprintf(_HOURS, 5), - '86400' => _DAY, - '259200' => sprintf(_DAYS, 3), - '604800' => _WEEK, - '2592000' => _MONTH, + 0 => _NOCACHE, + 30 => sprintf(_SECONDS, 30), + 60 => _MINUTE, + 300 => sprintf(_MINUTES, 5), + 1800 => sprintf(_MINUTES, 30), + 3600 => _HOUR, + 18000 => sprintf(_HOURS, 5), + 86400 => _DAY, + 259200 => sprintf(_DAYS, 3), + 604800 => _WEEK, + 2592000 => _MONTH, ] ); $form->addElement($cacheSelect); diff --git a/admin/blocksadmin.php b/admin/blocksadmin.php index e4c64eac..a0b25266 100644 --- a/admin/blocksadmin.php +++ b/admin/blocksadmin.php @@ -7,7 +7,6 @@ * 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. * - * PHP version 5 * * @category Module * @author XOOPS Development Team @@ -25,9 +24,8 @@ require __DIR__ . '/admin_header.php'; include_once $GLOBALS['xoops']->path('class/xoopsblock.php'); - -$moduleDirName = basename(dirname(__DIR__)); -$moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName +$moduleDirName = \basename(\dirname(__DIR__)); +$moduleDirNameUpper = \mb_strtoupper($moduleDirName); if (!is_object($xoopsModule) || !is_object($GLOBALS['xoopsUser']) || !$GLOBALS['xoopsUser']->isAdmin($xoopsModule->mid())) { @@ -42,18 +40,16 @@ } } /* - if (Request::hasVar('op')) { - if ($_GET['op'] === "edit" || $_GET['op'] === "delete" || $_GET['op'] === "delete_ok" || $_GET['op'] === "clone" - || $_GET['op'] === "edit" - ) { + if (Request::hasVar('op', 'GET')) { + if ('edit' === $_GET['op'] || 'delete' === $_GET['op'] || 'delete_ok' === $_GET['op'] || 'clone' === $_GET['op'] + || 'edit' === $_GET['op']) { $op = $_GET['op']; - $bid = Request::getInt('bid',0 ,'GET'); //isset($_GET['bid']) ? (int) $_GET['bid'] : 0; - } + $bid = Request::getInt('bid', 0, 'GET'); } */ $op = Request::getString('op', $op); - if (in_array($op, ['edit', 'delete', 'delete_ok', 'clone'], true)) { + if (in_array($op, ['edit', 'delete', 'delete_ok', 'clone'])) { $bid = Request::getInt('bid', 0, 'GET'); } @@ -62,17 +58,21 @@ function listBlocks() global $xoopsModule, $pathIcon16; // require_once XOOPS_ROOT_PATH . '/class/xoopslists.php'; xoops_load('xoopslist'); - require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName + //require_once XOOPS_ROOT_PATH . '/class/xoopsblock.php'; + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); /** @var \XoopsMySQLDatabase $db */ $db = \XoopsDatabaseFactory::getDatabaseConnection(); + + $adminObject = Admin::getInstance(); + $adminObject->displayNavigation(basename(__FILE__)); + xoops_loadLanguage('admin', 'system'); xoops_loadLanguage('admin/blocksadmin', 'system'); xoops_loadLanguage('admin/groups', 'system'); $configurator = new Configurator(); - $icons = $configurator->icons; + $icons = $configurator->icons; /** @var \XoopsModuleHandler $moduleHandler */ $moduleHandler = xoops_getHandler('module'); @@ -93,7 +93,7 @@ function listBlocks() echo $GLOBALS['xoopsSecurity']->getTokenHTML(); echo "'; echo "'; @@ -264,10 +262,10 @@ function listBlocks() // Actions - echo "'; echo "'; echo ''; - $categoryId = '0'; + $categoryid = '0'; } echo "
" - . constant('CO_' . $moduleDirNameUpper . '_' . 'TITLE') + . _AM_SYSTEM_BLOCKS_TITLE . "" . constant('CO_' . $moduleDirNameUpper . '_' . 'SIDE') . '
' @@ -103,9 +103,7 @@ function listBlocks() . '-' . _RIGHT . "
" - . constant( - 'CO_' . $moduleDirNameUpper . '_' . 'WEIGHT' - ) + . constant('CO_' . $moduleDirNameUpper . '_' . 'WEIGHT') . "" . constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLE') . "" @@ -122,17 +120,17 @@ function listBlocks() $blockCount = count($blockArray); $class = 'even'; $cachetimes = [ - '0' => _NOCACHE, - '30' => sprintf(_SECONDS, 30), - '60' => _MINUTE, - '300' => sprintf(_MINUTES, 5), - '1800' => sprintf(_MINUTES, 30), - '3600' => _HOUR, - '18000' => sprintf(_HOURS, 5), - '86400' => _DAY, - '259200' => sprintf(_DAYS, 3), - '604800' => _WEEK, - '2592000' => _MONTH, + 0 => _NOCACHE, + 30 => sprintf(_SECONDS, 30), + 60 => _MINUTE, + 300 => sprintf(_MINUTES, 5), + 1800 => sprintf(_MINUTES, 30), + 3600 => _HOUR, + 18000 => sprintf(_HOURS, 5), + 86400 => _DAY, + 259200 => sprintf(_DAYS, 3), + 604800 => _WEEK, + 2592000 => _MONTH, ]; foreach ($blockArray as $i) { $groupsPerms = $grouppermHandler->getGroupIds('block_read', $i->getVar('bid')); @@ -248,13 +246,13 @@ function listBlocks() echo "" . $icons->edit . " " . _CLONE . " + echo "" . $icons['edit'] . " " . _CLONE . " "; if (!in_array($i->getVar('block_type'), ['S', 'M'])) { - echo " getVar('bid') . "'>" . $icons->delete . ''; + echo " getVar('bid') . "'>" . $icons['delete'] . ''; } echo " @@ -295,21 +293,17 @@ function listBlocks() */ function cloneBlock($bid) { - require_once __DIR__ . '/admin_header.php'; - xoops_cp_header(); - /** @var \Xmf\Module\Admin $adminObject */ $adminObject = Admin::getInstance(); $adminObject->displayNavigation(basename(__FILE__)); - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); xoops_loadLanguage('admin', 'system'); xoops_loadLanguage('admin/blocksadmin', 'system'); xoops_loadLanguage('admin/groups', 'system'); - // mpu_adm_menu(); $myblock = new \XoopsBlock($bid); $db = \XoopsDatabaseFactory::getDatabaseConnection(); $sql = 'SELECT module_id FROM ' . $db->prefix('block_module_link') . ' WHERE block_id=' . (int)$bid; @@ -318,7 +312,7 @@ function cloneBlock($bid) while (false !== ($row = $db->fetchArray($result))) { $modules[] = (int)$row['module_id']; } - $isCustom = (in_array($myblock->getVar('block_type'), ['C', 'E'])); + $isCustom = (in_array($myblock->getVar('block_type'), ['C', 'E'])); $block = [ 'title' => $myblock->getVar('title') . ' Clone', 'form_title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_CLONEBLOCK'), @@ -361,11 +355,13 @@ function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, xoops_loadLanguage('admin/blocksadmin', 'system'); xoops_loadLanguage('admin/groups', 'system'); - $block = new \XoopsBlock($bid); - $clone = $block->xoopsClone(); + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = mb_strtoupper($moduleDirName); + $block = new \XoopsBlock($bid); + $clone = $block->xoopsClone(); if (empty($bmodule)) { xoops_cp_header(); - xoops_error(sprintf(_AM_NOTSELNG, _AM_VISIBLEIN)); + xoops_error(sprintf(constant('CO_' . $moduleDirNameUpper . '_' . 'NOTSELNG'), constant('CO_' . $moduleDirNameUpper . '_' . 'VISIBLEIN'))); xoops_cp_footer(); exit(); } @@ -413,7 +409,7 @@ function isBlockCloned($bid, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $sql = 'INSERT INTO ' . $db->prefix('group_permission') . ' (gperm_groupid, gperm_itemid, gperm_modid, gperm_name) VALUES (' . $iValue . ', ' . $newid . ", 1, 'block_read')"; $db->query($sql); } - redirect_header('blocksadmin.php?op=listar', 1, _AM_DBUPDATED); + redirect_header('blocksadmin.php?op=listar', 1, _AM_SYSTEM_BLOCKS_DBUPDATED); } /** @@ -434,6 +430,9 @@ function setOrder($bid, $title, $weight, $visible, $side, $bcachetime, $bmodule $myblock->setVar('side', $side); $myblock->setVar('bcachetime', $bcachetime); $myblock->store(); + // /** @var \XoopsBlockHandler $blockHandler */ + // $blockHandler = xoops_getHandler('block'); + // return $blockHandler->insert($myblock); } /** @@ -441,13 +440,12 @@ function setOrder($bid, $title, $weight, $visible, $side, $bcachetime, $bmodule */ function editBlock($bid) { - require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); /** @var \Xmf\Module\Admin $adminObject */ $adminObject = Admin::getInstance(); $adminObject->displayNavigation(basename(__FILE__)); - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); //$capsDirName + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); xoops_loadLanguage('admin', 'system'); xoops_loadLanguage('admin/blocksadmin', 'system'); @@ -461,7 +459,7 @@ function editBlock($bid) while (false !== ($row = $db->fetchArray($result))) { $modules[] = (int)$row['module_id']; } - $isCustom = (in_array($myblock->getVar('block_type'), ['C', 'E'])); + $isCustom = (in_array($myblock->getVar('block_type'), ['C', 'E'])); $block = [ 'title' => $myblock->getVar('title'), 'form_title' => constant('CO_' . $moduleDirNameUpper . '_' . 'BLOCKS_EDITBLOCK'), @@ -503,31 +501,36 @@ function editBlock($bid) function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $bmodule, $options, $groups) { - $myblock = new XoopsBlock($bid); + $myblock = new \XoopsBlock($bid); $myblock->setVar('title', $btitle); $myblock->setVar('weight', $bweight); $myblock->setVar('visible', $bvisible); $myblock->setVar('side', $bside); $myblock->setVar('bcachetime', $bcachetime); + $myblock->setVar('module', $bmodule); + $myblock->setVar('groups', $groups); $helper = Helper::getInstance(); $helper->loadLanguage('common'); //update block options - if (isset($options)) { - $optionsCount = count($options); - if ($optionsCount > 0) { - //Convert array values to comma-separated - foreach ($options as $i => $iValue) { - if (is_array($iValue)) { - $options[$i] = implode(',', $iValue); - } + if (is_array($options) && count($options) > 0) { + //Convert array values to comma-separated + foreach ($options as $i => $iValue) { + if (is_array($iValue)) { + $options[$i] = implode(',', $iValue); } - $options = implode('|', $options); - $myblock->setVar('options', $options); } + $options = implode('|', $options); + $myblock->setVar('options', $options); } $myblock->store(); - $moduleDirName = basename(dirname(__DIR__)); - $moduleDirNameUpper = mb_strtoupper($moduleDirName); + // /** @var \XoopsBlockHandler $blockHandler */ + // $blockHandler = xoops_getHandler('block'); + // $blockHandler->insert($myblock); + + global $xoopsDB; + + $moduleDirName = \basename(\dirname(__DIR__)); + $moduleDirNameUpper = \mb_strtoupper($moduleDirName); if (!empty($bmodule) && count($bmodule) > 0) { $sql = sprintf('DELETE FROM `%s` WHERE block_id = %u', $GLOBALS['xoopsDB']->prefix('block_module_link'), $bid); @@ -555,7 +558,7 @@ function updateBlock($bid, $btitle, $bside, $bweight, $bvisible, $bcachetime, $b if ('list' === $op) { xoops_cp_header(); - $adminObject->displayNavigation(basename(__FILE__)); + //$adminObject->displayNavigation(basename(__FILE__)); listBlocks(); require_once __DIR__ . '/admin_footer.php'; exit(); diff --git a/admin/category.php b/admin/category.php index fcb4e24b..2a4229b3 100644 --- a/admin/category.php +++ b/admin/category.php @@ -35,11 +35,11 @@ // Where do we start ? $startcategory = Request::getInt('startcategory', 0, 'GET'); -$categoryId = Request::getInt('categoryid', null); +$categoryid = Request::getInt('categoryid', null); switch ($op) { case 'del': - $categoryObj = $helper->getHandler('Category')->get($categoryId); + $categoryObj = $helper->getHandler('Category')->get($categoryid); $confirm = Request::getString('confirm', '', 'POST'); $name = Request::getString('name', '', 'POST'); if ($confirm) { @@ -60,14 +60,14 @@ //end of fx2024 code Utility::cpHeader(); - Utility::editCategory(true, $categoryId, $numberSubcats); + Utility::editCategory(true, $categoryid, $numberSubcats); break; case 'addcategory': global $modify; $parentid = Request::getInt('parentid'); - if (0 != $categoryId) { - $categoryObj = $helper->getHandler('Category')->get($categoryId); + if (0 != $categoryid) { + $categoryObj = $helper->getHandler('Category')->get($categoryid); } else { $categoryObj = $helper->getHandler('Category')->create(); } @@ -164,7 +164,7 @@ //Added by fx2024 case 'addsubcats': - $categoryId = 0; + $categoryid = 0; $numberSubcats = Request::getInt('nb_subcats', 0, 'POST') + Request::getInt('nb_sub_yet', 0, 'POST'); $categoryObj = $helper->getHandler('Category')->create(); @@ -176,7 +176,7 @@ } Utility::cpHeader(); - Utility::editCategory(true, $categoryId, $numberSubcats, $categoryObj); + Utility::editCategory(true, $categoryid, $numberSubcats, $categoryObj); exit(); //end of fx2024 code @@ -216,7 +216,7 @@ echo '
" . _AM_PUBLISHER_NOCAT . '
\n"; require_once $GLOBALS['xoops']->path('class/pagenav.php'); diff --git a/admin/feedback.php b/admin/feedback.php index 66acda58..45fada48 100644 --- a/admin/feedback.php +++ b/admin/feedback.php @@ -25,7 +25,7 @@ use Xmf\Request; use \XoopsModules\Publisher\Common\ModuleFeedback; -require __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; $adminObject = Admin::getInstance(); @@ -98,4 +98,4 @@ break; } -require __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/import/ams.php b/admin/import/ams.php index 6a90822b..baae8929 100644 --- a/admin/import/ams.php +++ b/admin/import/ams.php @@ -21,17 +21,19 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Category, +use XoopsModules\Publisher\{ + Category, Constants, Helper, File, Utility }; + /** @var Helper $helper */ const DIRNAME = 'ams'; -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'AMS ' . Request::getString('ams_version', '', 'POST'); @@ -169,9 +171,9 @@ if ('go' === $op) { Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - // require_once dirname(dirname(__DIR__)) . '/include/common.php'; + // require_once \dirname(__DIR__, 2) . '/include/common.php'; Utility::openCollapsableBar('amsimportgo', 'amsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $moduleId = $helper->getModule()->getVar('mid'); + $moduleId = $helper->getModule()->getVar('mid'); /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); diff --git a/admin/import/cjaycontent.php b/admin/import/cjaycontent.php index 281601a2..e73cf897 100644 --- a/admin/import/cjaycontent.php +++ b/admin/import/cjaycontent.php @@ -21,15 +21,17 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Constants, +use XoopsModules\Publisher\{ + Constants, Item, Utility }; + /** @var Helper $helper */ const DIRNAME = 'cjaycontent'; -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'cjaycontent ' . Request::getString('cjaycontent_version', '', 'POST'); @@ -93,9 +95,9 @@ if ('go' === $op) { Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - // require_once dirname(dirname(__DIR__)) . '/include/common.php'; + // require_once \dirname(__DIR__, 2) . '/include/common.php'; Utility::openCollapsableBar('cjaycontentimportgo', 'cjaycontentimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $moduleId = $helper->getModule()->getVar('mid'); + $moduleId = $helper->getModule()->getVar('mid'); /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); diff --git a/admin/import/fmcontent.php b/admin/import/fmcontent.php index 1ab6fb7b..f0b43330 100644 --- a/admin/import/fmcontent.php +++ b/admin/import/fmcontent.php @@ -22,20 +22,22 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Category, +use XoopsModules\Publisher\{ + Category, Constants, Helper, Item, Utility }; + /** @var Helper $helper */ const DIRNAME = 'fmcontent'; -/** @var \XoopsPersistableObjectHandler $fmContentHdlr */ -/** @var \XoopsPersistableObjectHandler $fmTopicHdlr */ +/** @var \XoopsPersistableObjectHandler $fmContentHandler */ +/** @var \XoopsPersistableObjectHandler $fmTopicHandler */ -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'FmContent ' . Request::getString('fmcontent_version', '', 'POST'); @@ -50,17 +52,17 @@ Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); Utility::openCollapsableBar('fmimport', 'fmimporticon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_INFO); - $moduleId = $helper->getModule()->getVar('mid'); + $moduleId = $helper->getModule()->getVar('mid'); - $fmTopicHdlr = xoops_getModuleHandler('topic', 'fmcontent'); - $fmTopicCount = $fmTopicHdlr->getCount(new \Criteria('topic_modid', $moduleId)); + $fmTopicHandler = xoops_getModuleHandler('topic', 'fmcontent'); + $fmTopicCount = $fmTopicHandler->getCount(new \Criteria('topic_modid', $moduleId)); if (empty($fmTopicCount)) { echo "" . _AM_PUBLISHER_IMPORT_NO_CATEGORY . ''; } else { require_once $GLOBALS['xoops']->path('www/class/xoopstree.php'); - $fmContentHdlr = xoops_getModuleHandler('page', 'fmcontent'); - $fmContentCount = $fmContentHdlr->getCount(new \Criteria('content_modid', $moduleId)); + $fmContentHandler = xoops_getModuleHandler('page', 'fmcontent'); + $fmContentCount = $fmContentHandler->getCount(new \Criteria('content_modid', $moduleId)); if (empty($fmContentCount)) { echo "" . sprintf(_AM_PUBLISHER_IMPORT_MODULE_FOUND_NO_ITEMS, $importFromModuleName, $fmContentCount) . ''; @@ -87,7 +89,7 @@ $criteria = new \CriteriaCompo(); $criteria->add(new \Criteria('content_modid', $moduleId)); $criteria->add(new \Criteria('content_topic', 0)); - $cnt_tla_contents = $fmContentHdlr->getCount($criteria); + $cnt_tla_contents = $fmContentHandler->getCount($criteria); if ($cnt_tla_contents) { $catCboxOptions[0] = _AM_PUBLISHER_IMPORT_FMCONTENT_NAME . " ({$cnt_tla_contents})"; } @@ -102,12 +104,12 @@ // Publisher parent category xoops_load('tree'); - $categoryHdlr = $helper->getHandler('Category'); - $catObjs = $categoryHdlr->getAll(); - $myObjTree = new \XoopsObjectTree($catObjs, 'categoryid', 'parentid'); - $moduleDirName = basename(dirname(__DIR__)); - $module = \XoopsModule::getByDirname($moduleDirName); - $catSelBox = $myObjTree->makeSelectElement('parent_category', 'name', '-', 0, true, 0, '', '')->render(); + $categoryHandler = $helper->getHandler('Category'); + $catObjs = $categoryHandler->getAll(); + $myObjTree = new \XoopsObjectTree($catObjs, 'categoryid', 'parentid'); + $moduleDirName = \basename(\dirname(__DIR__)); + $module = \XoopsModule::getByDirname($moduleDirName); + $catSelBox = $myObjTree->makeSelectElement('parent_category', 'name', '-', 0, true, 0, '', '')->render(); //$form->addElement($catSelBox); $parent_cat_sel = new \XoopsFormLabel(_AM_PUBLISHER_IMPORT_PARENT_CATEGORY, $catSelBox); @@ -140,7 +142,7 @@ Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); Utility::openCollapsableBar('fmimportgo', 'fmimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $moduleId = $helper->getModule()->getVar('mid'); + $moduleId = $helper->getModule()->getVar('mid'); /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); @@ -150,12 +152,12 @@ $parentId = Request::getInt('parent_category', 0, 'POST'); // get all FmContent Content items without a category (content_topic=0) - $fmContentHdlr = xoops_getModuleHandler('page', 'fmcontent'); + $fmContentHandler = xoops_getModuleHandler('page', 'fmcontent'); $criteria = new \CriteriaCompo(); $criteria->add(new \Criteria('content_modid', $moduleId)); $criteria->add(new \Criteria('content_topic', 0)); - $fmContentObjs = $fmContentHdlr->getAll($criteria); + $fmContentObjs = $fmContentHandler->getAll($criteria); if ($fmContentObjs && is_array($fmContentObjs)) { ++$cnt_imported_cat; //count category if there was content to import @@ -163,57 +165,51 @@ // create Publsher category to hold FmContent Content items with no Topic (content_topic=0) /** @var Category $categoryObj */ $categoryObj = $helper->getHandler('Category')->create(); - $categoryObj->setVars( - [ - 'parentid' => $parentId, - 'name' => _AM_PUBLISHER_IMPORT_FMCONTENT_NAME, - 'description' => _AM_PUBLISHER_IMPORT_FMCONTENT_TLT, - 'image' => '', - 'total' => 0, - 'weight' => 1, - 'created' => time(), - 'moderator', - $GLOBALS['xoopsUser']->getVar('uid'), - ] - ); + $categoryObj->setVars([ + 'parentid' => $parentId, + 'name' => _AM_PUBLISHER_IMPORT_FMCONTENT_NAME, + 'description' => _AM_PUBLISHER_IMPORT_FMCONTENT_TLT, + 'image' => '', + 'total' => 0, + 'weight' => 1, + 'created' => time(), + 'moderator', + $GLOBALS['xoopsUser']->getVar('uid'), + ]); $categoryObj->store(); - $fmTopicHdlr = xoops_getModuleHandler('topic', 'fmcontent'); + $fmTopicHandler = xoops_getModuleHandler('topic', 'fmcontent'); // insert articles for this category foreach ($fmContentObjs as $thisFmContentObj) { $itemObj = $helper->getHandler('Item')->create(); - $itemObj->setVars( - [ - 'categoryid' => $categoryObj->categoryid(), - 'title' => $thisFmContentObj->getVar('content_title'), - 'uid' => $thisFmContentObj->getVar('content_uid'), - 'summary' => $thisFmContentObj->getVar('content_short'), - 'body' => $thisFmContentObj->getVar('content_text'), - 'datesub' => $thisFmContentObj->getVar('content_create'), - 'dohtml' => $thisFmContentObj->getVar('dohtml'), - 'dosmiley' => $thisFmContentObj->getVar('dosmiley'), - 'doxcode' => $thisFmContentObj->getVar('doxcode'), - 'doimage' => $thisFmContentObj->getVar('doimage'), - 'dobr' => $thisFmContentObj->getVar('dobr'), - 'weight' => $thisFmContentObj->getVar('content_order'), - 'status' => $thisFmContentObj->getVar('content_status') ? Constants::PUBLISHER_STATUS_PUBLISHED : Constants::PUBLISHER_STATUS_OFFLINE, - 'counter' => $thisFmContentObj->getVar('content_hits'), - 'rating' => 0, - 'votes' => 0, - 'comments' => $thisFmContentObj->getVar('content_comments'), - 'meta_keywords' => $thisFmContentObj->getVar('content_words'), - 'meta_description' => $thisFmContentObj->getVar('content_desc'), - ] - ); + $itemObj->setVars([ + 'categoryid' => $categoryObj->categoryid(), + 'title' => $thisFmContentObj->getVar('content_title'), + 'uid' => $thisFmContentObj->getVar('content_uid'), + 'summary' => $thisFmContentObj->getVar('content_short'), + 'body' => $thisFmContentObj->getVar('content_text'), + 'datesub' => $thisFmContentObj->getVar('content_create'), + 'dohtml' => $thisFmContentObj->getVar('dohtml'), + 'dosmiley' => $thisFmContentObj->getVar('dosmiley'), + 'doxcode' => $thisFmContentObj->getVar('doxcode'), + 'doimage' => $thisFmContentObj->getVar('doimage'), + 'dobr' => $thisFmContentObj->getVar('dobr'), + 'weight' => $thisFmContentObj->getVar('content_order'), + 'status' => $thisFmContentObj->getVar('content_status') ? Constants::PUBLISHER_STATUS_PUBLISHED : Constants::PUBLISHER_STATUS_OFFLINE, + 'counter' => $thisFmContentObj->getVar('content_hits'), + 'rating' => 0, + 'votes' => 0, + 'comments' => $thisFmContentObj->getVar('content_comments'), + 'meta_keywords' => $thisFmContentObj->getVar('content_words'), + 'meta_description' => $thisFmContentObj->getVar('content_desc'), + ]); $contentImg = $thisFmContentObj->getVar('content_img'); if (!empty($contentImg)) { - $itemObj->setVars( - [ - 'images' => 1, - 'image' => $thisFmContentObj->getVar('content_img'), - ] - ); + $itemObj->setVars([ + 'images' => 1, + 'image' => $thisFmContentObj->getVar('content_img'), + ]); } if (!$itemObj->store()) { @@ -240,7 +236,7 @@ $newArticleArray = []; $oldToNew = []; - $fmTopicObjs = $fmTopicHdlr->getAll(new \Criteria('topic_modid', $moduleId)); + $fmTopicObjs = $fmTopicHandler->getAll(new \Criteria('topic_modid', $moduleId)); // first create FmContent Topics as Publisher Categories foreach ($fmTopicObjs as $thisFmTopicObj) { @@ -251,14 +247,12 @@ $categoryObj = $helper->getHandler('Category')->create(); - $categoryObj->setVars( - [ - 'parentid' => $thisFmTopicObj->getVar('topic_pid'), - 'weight' => $thisFmTopicObj->getVar('topic_weight'), - 'name' => $thisFmTopicObj->getVar('topic_title'), - 'description' => $thisFmTopicObj->getVar('topic_desc'), - ] - ); + $categoryObj->setVars([ + 'parentid' => $thisFmTopicObj->getVar('topic_pid'), + 'weight' => $thisFmTopicObj->getVar('topic_weight'), + 'name' => $thisFmTopicObj->getVar('topic_title'), + 'description' => $thisFmTopicObj->getVar('topic_desc'), + ]); // Category image if (!in_array($thisFmTopicObj->getVar('topic_img'), ['blank.gif', ''])) { @@ -280,35 +274,33 @@ $criteria = new \CriteriaCompo(); $criteria->add(new \Criteria('content_modid', $moduleId)); //only for this instance of fmcontent $criteria->add(new \Criteria('content_topic', $thisFmTopicObj->getVar('topic_id'))); //for this category - $fmContentObjs = $fmContentHdlr->getAll($criteria); + $fmContentObjs = $fmContentHandler->getAll($criteria); // insert articles for this category /** @var Item $itemObj */ foreach ($fmContentObjs as $thisFmContentObj) { $itemObj = $helper->getHandler('Item')->create(); - $itemObj->setVars( - [ - 'categoryid' => $catIds['newid'], - 'title' => $thisFmContentObj->getVar('content_title'), - 'uid' => $thisFmContentObj->getVar('content_uid'), - 'summary' => $thisFmContentObj->getVar('content_short'), - 'body' => $thisFmContentObj->getVar('content_text'), - 'counter' => $thisFmContentObj->getVar('content_hits'), - 'datesub' => $thisFmContentObj->getVar('content_create'), - 'dohtml' => $thisFmContentObj->getVar('dohtml'), - 'dosmiley' => $thisFmContentObj->getVar('dosmiley'), - 'doxcode' => $thisFmContentObj->getVar('doxcode'), - 'doimage' => $thisFmContentObj->getVar('doimage'), - 'dobr' => $thisFmContentObj->getVar('dobr'), - 'weight' => $thisFmContentObj->getVar('content_order'), - 'status' => $thisFmContentObj->getVar('content_status') ? Constants::PUBLISHER_STATUS_PUBLISHED : Constants::PUBLISHER_STATUS_OFFLINE, - 'rating' => 0, - 'votes' => 0, - 'comments' => $thisFmContentObj->getVar('content_comments'), - 'meta_keywords' => $thisFmContentObj->getVar('content_words'), - 'meta_description' => $thisFmContentObj->getVar('content_desc'), - ] - ); + $itemObj->setVars([ + 'categoryid' => $catIds['newid'], + 'title' => $thisFmContentObj->getVar('content_title'), + 'uid' => $thisFmContentObj->getVar('content_uid'), + 'summary' => $thisFmContentObj->getVar('content_short'), + 'body' => $thisFmContentObj->getVar('content_text'), + 'counter' => $thisFmContentObj->getVar('content_hits'), + 'datesub' => $thisFmContentObj->getVar('content_create'), + 'dohtml' => $thisFmContentObj->getVar('dohtml'), + 'dosmiley' => $thisFmContentObj->getVar('dosmiley'), + 'doxcode' => $thisFmContentObj->getVar('doxcode'), + 'doimage' => $thisFmContentObj->getVar('doimage'), + 'dobr' => $thisFmContentObj->getVar('dobr'), + 'weight' => $thisFmContentObj->getVar('content_order'), + 'status' => $thisFmContentObj->getVar('content_status') ? Constants::PUBLISHER_STATUS_PUBLISHED : Constants::PUBLISHER_STATUS_OFFLINE, + 'rating' => 0, + 'votes' => 0, + 'comments' => $thisFmContentObj->getVar('content_comments'), + 'meta_keywords' => $thisFmContentObj->getVar('content_words'), + 'meta_description' => $thisFmContentObj->getVar('content_desc'), + ]); $contentImg = $thisFmContentObj->getVar('content_img'); if (!empty($contentImg)) { $itemObj->setVar('images', 1); diff --git a/admin/import/index.html b/admin/import/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/admin/import/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/admin/import/index.php b/admin/import/index.php new file mode 100644 index 00000000..2ea9b7d9 --- /dev/null +++ b/admin/import/index.php @@ -0,0 +1,3 @@ +getModule()->getVar('mid'); + $moduleId = $helper->getModule()->getVar('mid'); /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); diff --git a/admin/import/smartsection.php b/admin/import/smartsection.php index 935fd155..eb14be43 100644 --- a/admin/import/smartsection.php +++ b/admin/import/smartsection.php @@ -21,19 +21,21 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Category, +use XoopsModules\Publisher\{ + Category, File, Item, Helper, Utility }; + /** @var Helper $helper */ const CATEGORY = 'smartsection_categories'; -const ITEMID = 'itemid'; -const DIRNAME = 'smartsection'; +const ITEMID = 'itemid'; +const DIRNAME = 'smartsection'; -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'Smartsection ' . Request::getString('smartsection_version', '', 'POST'); @@ -109,8 +111,8 @@ Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); Utility::openCollapsableBar('newsimportgo', 'newsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $moduleId = $helper->getModule()->getVar('mid'); - + $moduleId = $helper->getModule()->getVar('mid'); + /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); diff --git a/admin/import/wfsection.php b/admin/import/wfsection.php index edc559e1..6dff2e27 100644 --- a/admin/import/wfsection.php +++ b/admin/import/wfsection.php @@ -21,21 +21,23 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Constants, +use XoopsModules\Publisher\{ + Constants, Category, File, Helper, Item, Utility }; + /** @var Helper $helper */ -const CATEGORY = 'wfs_category'; -const ITEMID = 'itemid'; +const CATEGORY = 'wfs_category'; +const ITEMID = 'itemid'; const ARTICLEID = 'articleid'; -const DIRNAME = 'wfsection'; +const DIRNAME = 'wfsection'; -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'WF-Section ' . Request::getString('wfs_version', '', 'POST'); @@ -254,8 +256,8 @@ // Looping through the comments to link them to the new articles and module echo _AM_PUBLISHER_IMPORT_COMMENTS . '
'; - $moduleId = $helper->getModule()->getVar('mid'); - + $moduleId = $helper->getModule()->getVar('mid'); + $publisher_module_id = $helper->getModule()->mid(); /** @var \XoopsCommentHandler $commentHandler */ $commentHandler = xoops_getHandler('comment'); diff --git a/admin/import/xfsection.php b/admin/import/xfsection.php index c63a7fdd..d0da2a30 100644 --- a/admin/import/xfsection.php +++ b/admin/import/xfsection.php @@ -21,20 +21,22 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Constants, +use XoopsModules\Publisher\{ + Constants, Category, File, Helper, Item, Utility }; + /** @var Helper $helper */ const CATEGORY = 'xfs_category'; -const ITEMID = 'articleid'; -const DIRNAME = 'xfsection'; +const ITEMID = 'articleid'; +const DIRNAME = 'xfsection'; -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'XF-Section ' . Request::getString('xfs_version', '', 'POST'); @@ -252,8 +254,8 @@ // Looping through the comments to link them to the new articles and module echo _AM_PUBLISHER_IMPORT_COMMENTS . '
'; - $moduleId = $helper->getModule()->getVar('mid'); - + $moduleId = $helper->getModule()->getVar('mid'); + $publisher_module_id = $helper->getModule()->mid(); /** @var \XoopsCommentHandler $commentHandler */ $commentHandler = xoops_getHandler('comment'); diff --git a/admin/import/xnews.php b/admin/import/xnews.php index 2348d3fb..f15eb1fd 100644 --- a/admin/import/xnews.php +++ b/admin/import/xnews.php @@ -21,18 +21,20 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Constants, +use XoopsModules\Publisher\{ + Constants, Category, File, Helper, Item, Utility }; + /** @var Helper $helper */ const DIRNAME = 'xnews'; -require_once dirname(__DIR__) . '/admin_header.php'; +require_once \dirname(__DIR__) . '/admin_header.php'; $myts = \MyTextSanitizer::getInstance(); $importFromModuleName = 'xNews ' . Request::getString('xnews_version', '', 'POST'); @@ -171,10 +173,10 @@ if ('go' === $op) { Utility::cpHeader(); //publisher_adminMenu(-1, _AM_PUBLISHER_IMPORT); - // require_once dirname(dirname(__DIR__)) . '/include/common.php'; + // require_once \dirname(__DIR__, 2) . '/include/common.php'; Utility::openCollapsableBar('xnewsimportgo', 'xnewsimportgoicon', sprintf(_AM_PUBLISHER_IMPORT_FROM, $importFromModuleName), _AM_PUBLISHER_IMPORT_RESULT); - $moduleId = $helper->getModule()->getVar('mid'); - + $moduleId = $helper->getModule()->getVar('mid'); + /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = xoops_getHandler('groupperm'); diff --git a/admin/index.php b/admin/index.php index 6a4e9176..02ad087b 100644 --- a/admin/index.php +++ b/admin/index.php @@ -21,13 +21,14 @@ */ use Xmf\Module\Admin; +use Xmf\Request; +use Xmf\Yaml; use XoopsModules\Publisher\{Common, Common\Configurator, Common\TestdataButtons, Helper, Utility }; -use Xmf\Request; require_once __DIR__ . '/admin_header.php'; @@ -60,10 +61,11 @@ $adminObject->addConfigBoxLine('!' . _MD_PUBLISHER_ERROR_NO_PDF . '', 'default'); } -$moduleStats = $utility::getModuleStats(); +$modStats = []; +$moduleStats = $utility::getModuleStats($configurator); $adminObject->addInfoBox(constant('CO_' . $moduleDirNameUpper . '_' . 'STATS_SUMMARY')); -if ($moduleStats && is_array($moduleStats)) { +if (is_array($moduleStats) && count($moduleStats) > 0) { foreach ($moduleStats as $key => $value) { switch ($key) { case 'totalcategories': @@ -97,10 +99,10 @@ $adminObject->displayNavigation(basename(__FILE__)); //check for latest release -//$newRelease = $utility::checkVerModule($helper); -//if (!empty($newRelease)) { -// $adminObject->addItemButton($newRelease[0], $newRelease[1], 'download', 'style="color : Red"'); -//} +$newRelease = $utility::checkVerModule($helper); +if (!empty($newRelease)) { + $adminObject->addItemButton($newRelease[0], $newRelease[1], 'download', 'style="color : Red"'); +} //------------- Test Data Buttons ---------------------------- if ($helper->getConfig('displaySampleButton')) { @@ -122,4 +124,4 @@ echo $utility::getServerStats(); //codeDump(__FILE__); -require __DIR__ . '/admin_footer.php'; +require_once __DIR__ . '/admin_footer.php'; diff --git a/admin/item.php b/admin/item.php index 88be24f9..89207e0f 100644 --- a/admin/item.php +++ b/admin/item.php @@ -193,9 +193,9 @@ for ($i = 0; $i < $totalItemsOnPage; ++$i) { $categoryObj = $itemsObj[$i]->getCategory(); - $approve = "" . $icons->moderate . ' '; + $approve = "" . $icons['moderate'] . ' '; $clone = ''; - $delete = "" . $icons->delete . ''; + $delete = "" . $icons['delete'] . ''; $modify = ''; echo ''; @@ -247,9 +247,9 @@ for ($i = 0; $i < $totalItemsOnPage; ++$i) { $categoryObj = $itemsObj[$i]->getCategory(); - $modify = "" . $icons->edit . ''; - $delete = "" . $icons->delete . ''; - $clone = "" . $icons->clone . ''; + $modify = "" . $icons['edit'] . ''; + $delete = "" . $icons['delete'] . ''; + $clone = "" . $icons['clone'] . ''; echo ''; echo "" . $itemsObj[$i]->itemid() . ''; @@ -301,9 +301,9 @@ for ($i = 0; $i < $totalItemsOnPage; ++$i) { $categoryObj = $itemsObj[$i]->getCategory(); - $modify = "" . $icons->edit . ''; - $delete = "" . $icons->delete . ''; - $clone = "" . $icons->clone . ''; + $modify = "" . $icons['edit'] . ''; + $delete = "" . $icons['delete'] . ''; + $clone = "" . $icons['clone'] . ''; echo ''; echo "" . $itemsObj[$i]->itemid() . ''; @@ -354,9 +354,9 @@ for ($i = 0; $i < $totalItemsOnPage; ++$i) { $categoryObj = $itemsObj[$i]->getCategory(); - $modify = "" . $icons->edit . ''; - $delete = "" . $icons->delete . ''; - $clone = "" . $icons->clone . ''; + $modify = "" . $icons['edit'] . ''; + $delete = "" . $icons['delete'] . ''; + $clone = "" . $icons['clone'] . ''; echo ''; echo "" . $itemsObj[$i]->itemid() . ''; diff --git a/admin/main.php b/admin/main.php index dc5ea2fa..2b8bb5c0 100644 --- a/admin/main.php +++ b/admin/main.php @@ -27,8 +27,8 @@ require_once __DIR__ . '/admin_header.php'; require_once $GLOBALS['xoops']->path('class/xoopslists.php'); require_once $GLOBALS['xoops']->path('class/pagenav.php'); -// require_once dirname(__DIR__) . '/class/Utility.php'; -require_once dirname(__DIR__) . '/include/common.php'; +// require_once \dirname(__DIR__) . '/class/Utility.php'; +require_once \dirname(__DIR__) . '/include/common.php'; $itemId = Request::getInt('itemid', 0, 'POST'); @@ -245,40 +245,40 @@ switch ($itemsObj[$i]->status()) { case Constants::PUBLISHER_STATUS_SUBMITTED: $statustxt = _CO_PUBLISHER_SUBMITTED; - $approve = "" . $icons->moderate . ' '; + $approve = "" . $icons['moderate'] . ' '; $clone = ''; - $delete = "" . $icons->delete . ''; + $delete = "" . $icons['delete'] . ''; $modify = ''; break; case Constants::PUBLISHER_STATUS_PUBLISHED: $statustxt = _CO_PUBLISHER_PUBLISHED; $approve = ''; - $modify = "" . $icons->edit . ' '; - $delete = "" . $icons->delete . ' '; - $clone = "" . $icons->clone . ' '; + $modify = "" . $icons['edit'] . ' '; + $delete = "" . $icons['delete'] . ' '; + $clone = "" . $icons['clone'] . ' '; break; case Constants::PUBLISHER_STATUS_OFFLINE: $statustxt = _CO_PUBLISHER_OFFLINE; $approve = ''; - $modify = "" . $icons->edit . ' '; - $delete = "" . $icons->delete . ' '; + $modify = "" . $icons['edit'] . ' '; + $delete = "" . $icons['delete'] . ' '; $clone = /** @lang text */ - "" . $icons->clone . ' '; + "" . $icons['clone'] . ' '; break; case Constants::PUBLISHER_STATUS_REJECTED: $statustxt = _CO_PUBLISHER_REJECTED; $approve = ''; - $modify = "" . $icons->rejectededit . ' '; - $delete = "" . $icons->delete . ' '; - $clone = "" . $icons->clone . ' '; + $modify = "" . $icons['rejectededit'] . ' '; + $delete = "" . $icons['delete'] . ' '; + $clone = "" . $icons['clone'] . ' '; break; case 'default': default: $statustxt = _AM_PUBLISHER_STATUS0; $approve = ''; $clone = ''; - $modify = "" . $icons->rejectededit . ' '; - $delete = "" . $icons->delete . ''; + $modify = "" . $icons['rejectededit'] . ' '; + $delete = "" . $icons['delete'] . ''; break; } diff --git a/admin/menu.php b/admin/menu.php index 09957ea6..78b0de39 100644 --- a/admin/menu.php +++ b/admin/menu.php @@ -22,9 +22,9 @@ use Xmf\Module\Admin; use XoopsModules\Publisher\Helper; -require_once dirname(__DIR__) . '/preloads/autoloader.php'; +require_once \dirname(__DIR__) . '/preloads/autoloader.php'; -$moduleDirName = basename(dirname(__DIR__)); +$moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); diff --git a/admin/migrate.php b/admin/migrate.php index 12adf61f..14a76543 100644 --- a/admin/migrate.php +++ b/admin/migrate.php @@ -32,6 +32,7 @@ // ------------------------------------------------------------------------- // use Xmf\Request; + use Xmf\Module\Admin; use XoopsModules\Publisher\{ Common\Configurator, @@ -43,7 +44,7 @@ /** @var Configurator $configurator */ /** @var Migrate $migrator */ -require __DIR__ . '/admin_header.php'; +require_once __DIR__ . '/admin_header.php'; xoops_cp_header(); $adminObject->displayNavigation(basename(__FILE__)); @@ -66,15 +67,15 @@ $configurator = new Configurator(); -$migrator = new Migrate($configurator); +$migrator = new Migrate(); -$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/permissions.php b/admin/permissions.php index 26d41174..aa574a40 100644 --- a/admin/permissions.php +++ b/admin/permissions.php @@ -25,7 +25,7 @@ }; require_once __DIR__ . '/admin_header.php'; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; require_once $GLOBALS['xoops']->path('class/xoopsform/grouppermform.php'); $myts = \MyTextSanitizer::getInstance(); diff --git a/archive.php b/archive.php index d5d05bcb..f051ad2e 100644 --- a/archive.php +++ b/archive.php @@ -171,7 +171,7 @@ // must adjust the selected time to server timestamp $timeoffset = $useroffset - $GLOBALS['xoopsConfig']['server_TZ']; $timeoffsethours = (int)$timeoffset; - $timeoffsetminutes = (($timeoffset - $timeoffsethours) * 60); + $timeoffsetminutes = (int)(($timeoffset - $timeoffsethours) * 60); $monthstart = mktime(0 - $timeoffsethours, 0 - $timeoffsetminutes, 0, $frommonth, 1, $fromyear); $monthend = mktime(23 - $timeoffsethours, 59 - $timeoffsetminutes, 59, $frommonth + 1, 0, $fromyear); diff --git a/assets/css/images/index.html b/assets/css/images/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/assets/css/images/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/assets/css/images/index.php b/assets/css/images/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/css/images/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/css/index.php b/assets/css/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/css/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/gfx/index.php b/assets/images/gfx/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/images/gfx/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/icon/index.php b/assets/images/icon/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/images/icon/index.php @@ -0,0 +1,2 @@ +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..2ea9b7d9 --- /dev/null +++ b/assets/images/icons/16/index.php @@ -0,0 +1,3 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/icons/32/index.php b/assets/images/icons/32/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/images/icons/32/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/icons/index.php b/assets/images/icons/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/images/icons/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/index.php b/assets/images/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/images/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/links/index.php b/assets/images/links/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/images/links/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/assets/images/popeye/index.php b/assets/images/popeye/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/assets/images/popeye/index.php @@ -0,0 +1,2 @@ +history.go(-1); 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 @@ + -1) { fldObj.checked = isInverse; } @@ -20,8 +20,8 @@ function selectAll(formObj, fieldname, isInverse) { function publisherPageWrap(id, page) { - let revisedMessage; - const textareaDom = xoopsGetElementById(id); + var revisedMessage; + var textareaDom = xoopsGetElementById(id); xoopsInsertText(textareaDom, page); textareaDom.focus(); } @@ -33,12 +33,12 @@ function addSelectedItemsToParent() { // Fill the selcted item list with the items already present in parent. function fillInitialDestList() { - const destList = window.document.forms[0].destList; - const srcList = self.opener.window.document.forms[0].elements['moderators[]']; - for (let count = destList.options.length - 1; count >= 0; count--) { + var destList = window.document.forms[0].destList; + var srcList = self.opener.window.document.forms[0].elements['moderators[]']; + for (var count = destList.options.length - 1; count >= 0; count--) { destList.options[count] = null; } - for (let i = 0; i < srcList.options.length; i++) { + for (var i = 0; i < srcList.options.length; i++) { if (srcList.options[i] != null) destList.options[i] = new Option(srcList.options[i].text); } @@ -46,15 +46,15 @@ function fillInitialDestList() { // Add the selected items from the source to destination list function addSrcToDestList() { - const destList = window.document.forms[0].destList; - const srcList = window.document.forms[0].srcList; - let len = destList.length; - for (let i = 0; i < srcList.length; i++) { + destList = window.document.forms[0].destList; + srcList = window.document.forms[0].srcList; + var len = destList.length; + for (var i = 0; i < srcList.length; i++) { if ((srcList.options[i] != null) && (srcList.options[i].selected)) { //Check if this value already exist in the destList or not //if not then add it otherwise do not add it. - let found = false; - for (let count = 0; count < len; count++) { + var found = false; + for (var count = 0; count < len; count++) { if (destList.options[count] != null) { if (srcList.options[i].text == destList.options[count].text) { found = true; @@ -62,7 +62,7 @@ function addSrcToDestList() { } } } - if (found !== true) { + if (found != true) { destList.options[len] = new Option(srcList.options[i].text); len++; } @@ -72,10 +72,10 @@ function addSrcToDestList() { // Deletes from the destination list. function deleteFromDestList() { - const destList = window.document.forms[0].destList; - const len = destList.options.length; - for (let i = (len - 1); i >= 0; i--) { - if ((destList.options[i] != null) && (destList.options[i].selected === true)) { + var destList = window.document.forms[0].destList; + var len = destList.options.length; + for (var i = (len - 1); i >= 0; i--) { + if ((destList.options[i] != null) && (destList.options[i].selected == true)) { destList.options[i] = null; } } @@ -84,20 +84,20 @@ function deleteFromDestList() { function small_window(myurl, w, h) { // La ventana se llama "Add_from_Src_to_Dest" - let newWindow; - const LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0; - const TopPosition = (screen.height) ? (screen.height - h) / 2 : 0; + var newWindow; + LeftPosition = (screen.width) ? (screen.width - w) / 2 : 0; + TopPosition = (screen.height) ? (screen.height - h) / 2 : 0; newWindow = window.open(myurl, "Add_from_Src_to_Dest", 'left=' + LeftPosition + ',top=' + TopPosition + ',width=' + w + ', height=' + h + ',scrollBars=yes,resizable=yes,toolbar=no,menubar=no,location=no,directories=no'); } // Adds the list of selected items selected in the child // window to its list. It is called by child window to do so. function addToParentList(sourceList) { - const destinationList = window.document.forms[0].elements['moderators[]']; - for (let count = destinationList.options.length - 1; count >= 0; count--) { + destinationList = window.document.forms[0].elements['moderators[]']; + for (var count = destinationList.options.length - 1; count >= 0; count--) { destinationList.options[count] = null; } - for (let i = 0; i < sourceList.options.length; i++) { + for (var i = 0; i < sourceList.options.length; i++) { if (sourceList.options[i] != null) destinationList.options[i] = new Option(sourceList.options[i].text, sourceList.options[i].value); } @@ -106,18 +106,18 @@ function addToParentList(sourceList) { // Marks all the items as selected for the submit button. function selectList(sourceList) { sourceList = window.document.forms[0].elements['moderators[]']; - for (let arrayElement of sourceList.options) { - if (arrayElement != null) - arrayElement.selected = true; + for (var i = 0; i < sourceList.options.length; i++) { + if (sourceList.options[i] != null) + sourceList.options[i].selected = true; } return true; } // Deletes the selected items of supplied list. function deleteSelectedItemsFromList(sourceList) { - const maxCnt = sourceList.options.length; - for (let i = maxCnt - 1; i >= 0; i--) { - if ((sourceList.options[i] != null) && (sourceList.options[i].selected === true)) { + var maxCnt = sourceList.options.length; + for (var i = maxCnt - 1; i >= 0; i--) { + if ((sourceList.options[i] != null) && (sourceList.options[i].selected == true)) { sourceList.options[i] = null; } } @@ -129,24 +129,24 @@ function goto_URL(object) { function toggle(id) { if (document.getElementById) { - var obj = document.getElementById(id); + obj = document.getElementById(id); } if (document.all) { - var obj = document.all[id]; + obj = document.all[id]; } if (document.layers) { - var obj = document.layers[id]; + obj = document.layers[id]; } if (obj) { - if (obj.style.display === "none") { + if (obj.style.display == "none") { obj.style.display = ""; } else { obj.style.display = "none"; } } - const expDays = 365; - const exp = new Date(); + var expDays = 365; + var exp = new Date(); exp.setTime(exp.getTime() + (expDays * 24 * 60 * 60 * 1000)); setCookie(window.location.pathname + "_publisher_collaps_" + obj.id, obj.style.display, exp); @@ -155,9 +155,9 @@ function toggle(id) { } var iconClose = new Image(); -iconClose.src = '../assets/images/links/close12.gif'; +iconClose.src = './assets/images/links/close12.gif'; var iconOpen = new Image(); -iconOpen.src = '../assets/images/links/open12.gif'; +iconOpen.src = './assets/images/links/open12.gif'; function toggleIcon(iconName) { if (document.images[iconName].src == window.iconOpen.src) { diff --git a/assets/js/index.html b/assets/js/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/assets/js/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/assets/js/index.php b/assets/js/index.php new file mode 100644 index 00000000..2ea9b7d9 --- /dev/null +++ b/assets/js/index.php @@ -0,0 +1,3 @@ +getHandler('Category')->get($categoryId); +if (-1 != $categoryid) { + $categoryObj = $helper->getHandler('Category')->get($categoryid); } header('Content-Type:text/xml; charset=' . _CHARSET); @@ -63,7 +63,7 @@ $tpl->assign('channel_webmaster', $GLOBALS['xoopsConfig']['adminmail'] . '( ' . htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES | ENT_HTML5) . ' )'); $tpl->assign('channel_editor', $GLOBALS['xoopsConfig']['adminmail'] . '( ' . htmlspecialchars($GLOBALS['xoopsConfig']['sitename'], ENT_QUOTES | ENT_HTML5) . ' )'); - if (-1 != $categoryId) { + if (-1 != $categoryid) { $channelCategory .= ' > ' . $categoryObj->name(); } @@ -83,7 +83,7 @@ $height = round($height, 0, PHP_ROUND_HALF_UP); $tpl->assign('image_width', $width); $tpl->assign('image_height', $height); - $sarray = $helper->getHandler('Item')->getAllPublished(10, 0, $categoryId); + $sarray = $helper->getHandler('Item')->getAllPublished(10, 0, $categoryid); if (!empty($sarray) && is_array($sarray)) { $count = $sarray; foreach ($sarray as $item) { diff --git a/blocks/category_items_sel.php b/blocks/category_items_sel.php index 3d8867a7..c1b235d8 100644 --- a/blocks/category_items_sel.php +++ b/blocks/category_items_sel.php @@ -26,7 +26,7 @@ Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/blocks/date_to_date.php b/blocks/date_to_date.php index 402e86e4..ae8b773d 100644 --- a/blocks/date_to_date.php +++ b/blocks/date_to_date.php @@ -24,7 +24,7 @@ ItemHandler }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/blocks/index.html b/blocks/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/blocks/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/blocks/index.php b/blocks/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/blocks/index.php @@ -0,0 +1,2 @@ + $mainItemCatObj) { - $categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryId); + foreach ($selCategoriesObj as $categoryid => $mainItemCatObj) { + $categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryid); $scount = count($categoryItemsObj); if ($scount > 0 && is_array($categoryItemsObj)) { reset($categoryItemsObj); @@ -140,7 +140,7 @@ function publisher_items_columns_show($options) } } } - unset($categoryId); + unset($categoryid); $block['template'] = $options[4]; $block['columns'] = $columns; diff --git a/blocks/items_menu.php b/blocks/items_menu.php index 2c95fbeb..1fe8815e 100644 --- a/blocks/items_menu.php +++ b/blocks/items_menu.php @@ -27,7 +27,7 @@ Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options @@ -54,13 +54,13 @@ function publisher_items_menu_show($options) $catLinkClass = 'menuMain'; - $categoryId = 0; + $categoryid = 0; if ($block['inModule']) { // Are we in a category and if yes, in which one ? - $categoryId = Request::getInt('categoryid', 0, 'GET'); + $categoryid = Request::getInt('categoryid', 0, 'GET'); - if (0 != $categoryId) { + if (0 != $categoryid) { // if we are in a category, then the $categoryObj is already defined in publisher/category.php global $categoryObj; $block['currentcat'] = $categoryObj->getCategoryLink('menuTop'); @@ -69,7 +69,7 @@ function publisher_items_menu_show($options) } foreach ($blockCategoriesObj as $catId => $blockCategoryObj) { - if ($catId != $categoryId) { + if ($catId != $categoryid) { $block['categories'][$catId]['categoryLink'] = $blockCategoryObj->getCategoryLink($catLinkClass); } } diff --git a/blocks/items_new.php b/blocks/items_new.php index 29638649..8de54b64 100644 --- a/blocks/items_new.php +++ b/blocks/items_new.php @@ -26,7 +26,7 @@ Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options @@ -71,8 +71,8 @@ function publisher_items_new_show($options) } // $optCatItems = (int)$options[2]; - // $categoryId = -1; - // $categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryId); + // $categoryid = -1; + // $categoryItemsObj = $itemHandler->getAllPublished($optCatItems, 0, $categoryid); $itemsObj = $itemHandler->getItems($limit, $start, [Constants::PUBLISHER_STATUS_PUBLISHED], -1, $sort, $order, '', true, $criteria, 'none'); diff --git a/blocks/items_random_item.php b/blocks/items_random_item.php index f4a40edb..0628d7f1 100644 --- a/blocks/items_random_item.php +++ b/blocks/items_random_item.php @@ -26,14 +26,13 @@ ItemHandler }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options * * @return array * @throws \Exception - * @throws \Exception */ function publisher_items_random_item_show($options) { diff --git a/blocks/items_recent.php b/blocks/items_recent.php index 0f3fa8f6..454bf57a 100644 --- a/blocks/items_recent.php +++ b/blocks/items_recent.php @@ -26,7 +26,7 @@ Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/blocks/items_spot.php b/blocks/items_spot.php index d01a02d8..cd3d1c6c 100644 --- a/blocks/items_spot.php +++ b/blocks/items_spot.php @@ -28,7 +28,7 @@ Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/blocks/latest_files.php b/blocks/latest_files.php index f611996a..50f2f628 100644 --- a/blocks/latest_files.php +++ b/blocks/latest_files.php @@ -26,7 +26,7 @@ Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/blocks/latest_news.php b/blocks/latest_news.php index 939a1125..e3d09057 100644 --- a/blocks/latest_news.php +++ b/blocks/latest_news.php @@ -20,14 +20,16 @@ * @author Mowaffak */ -use XoopsModules\Publisher\{Constants, +use XoopsModules\Publisher\{ + Common\Configurator, + Constants, Helper, ItemHandler, Seo, Utility }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options @@ -38,6 +40,9 @@ function publisher_latest_news_show($options) { $block = []; + $configurator = new Configurator(); + $icons = $configurator->icons; + $helper = Helper::getInstance(); $helper->loadLanguage('main'); /** @var ItemHandler $itemHandler */ @@ -158,8 +163,8 @@ function publisher_latest_news_show($options) } if (is_object($GLOBALS['xoopsUser']) && $GLOBALS['xoopsUser']->isAdmin(-1)) { - $item['admin'] = "edit . ' '; - $item['admin'] .= "itemid() . "'>" . $icons->delete . ''; + $item['admin'] = " '; + $item['admin'] .= "itemid() . "'>" . $icons['delete'] . ''; } else { $item['admin'] = ''; } @@ -223,19 +228,19 @@ function publisher_latest_news_show($options) $item['print'] = ''; if (1 == $options[24]) { - $item['print'] = '" . $icons->print . " '; + $item['print'] = '' . $icons['print'] . ' '; } $item['pdf'] = ''; if (1 == $options[25]) { - $item['pdf'] = "" . $icons->pdf . ' '; + $item['pdf'] = "" . $icons['pdf'] . ' '; } $item['email'] = ''; if (1 == $options[26]) { $maillink = 'mailto:?subject=' . sprintf(_CO_PUBLISHER_INTITEM, $GLOBALS['xoopsConfig']['sitename']) . '&body=' . sprintf(_CO_PUBLISHER_INTITEMFOUND, $GLOBALS['xoopsConfig']['sitename']) . ': ' . $itemObj->getItemUrl(); - $item['email'] = '' . $icons->mail . ' '; + $item['email'] = '' . $icons['mail'] . ' '; } $block['morelink'] = ''; @@ -244,7 +249,7 @@ function publisher_latest_news_show($options) } $item['more'] = ''; - if (1 == $options[28] && '' != $itemObj->body() || $itemObj->comments() > 0) { + if ((1 == $options[28] && '' != $itemObj->body()) || $itemObj->comments() > 0) { $item['more'] = '' . _MB_PUBLISHER_READMORE . ''; } diff --git a/blocks/search.php b/blocks/search.php index 2bbc667a..36440f7f 100644 --- a/blocks/search.php +++ b/blocks/search.php @@ -24,7 +24,7 @@ Helper }; -require_once dirname(__DIR__) . '/include/common.php'; +require_once \dirname(__DIR__) . '/include/common.php'; /** * @param $options diff --git a/category.php b/category.php index eddeab74..62d4ae19 100644 --- a/category.php +++ b/category.php @@ -31,11 +31,11 @@ require_once __DIR__ . '/header.php'; -$categoryId = Request::getInt('categoryid', 0, 'GET'); +$categoryid = Request::getInt('categoryid', 0, 'GET'); // Creating the category object for the selected category /** @var Helper $helper */ -$categoryObj = $helper->getHandler('Category')->get($categoryId); +$categoryObj = $helper->getHandler('Category')->get($categoryid); // if the selected category was not found, exit if (!is_object($categoryObj) || $categoryObj->notLoaded()) { @@ -56,7 +56,7 @@ // if there is no Item under this categories or the sub-categories, exit // why? -if (!isset($totalItems[$categoryId]) || 0 == $totalItems[$categoryId]) { +if (!isset($totalItems[$categoryid]) || 0 == $totalItems[$categoryid]) { //redirect_header("index.php", 1, _MD_PUBLISHER_MAINNOFAQS); } @@ -104,7 +104,7 @@ break; } -$itemsObj = $helper->getHandler('Item')->getAllPublished($helper->getConfig('idxcat_index_perpage'), $start, $categoryId, $sort, $order); +$itemsObj = $helper->getHandler('Item')->getAllPublished($helper->getConfig('idxcat_index_perpage'), $start, $categoryid, $sort, $order); $totalItemOnPage = 0; if ($itemsObj) { @@ -128,7 +128,7 @@ $lastitemsize = (int)$helper->getConfig('idxcat_last_item_size'); // Creating the sub-categories objects that belong to the selected category -$subcatsObj = $helper->getHandler('Category')->getCategories(0, 0, $categoryId); +$subcatsObj = $helper->getHandler('Category')->getCategories(0, 0, $categoryid); $totalSubcats = count($subcatsObj); $total_items = 0; @@ -180,7 +180,7 @@ $category['subcats'] = $subcategories; $category['subcatscount'] = count($subcategories); -$thiscategory_itemcount = $totalItems[$categoryId] ?? 0; +$thiscategory_itemcount = $totalItems[$categoryid] ?? 0; $category['total'] = $thiscategory_itemcount; if (count($itemsObj) > 0) { @@ -226,7 +226,7 @@ $xoopsTpl->assign('lang_items_title', sprintf(_MD_PUBLISHER_ITEMS_TITLE, $categoryObj->name())); $xoopsTpl->assign('module_home', Utility::moduleHome($helper->getConfig('format_linked_path'))); $xoopsTpl->assign('categoryPath', '
  • ' . $category['categoryPath'] . '
  • '); -$xoopsTpl->assign('selected_category', $categoryId); +$xoopsTpl->assign('selected_category', $categoryid); // The Navigation Bar require_once $GLOBALS['xoops']->path('class/pagenav.php'); @@ -246,7 +246,7 @@ // RSS Link if (1 == $helper->getConfig('idxcat_show_rss_link')) { - $link = sprintf("%s", PUBLISHER_URL . '/backend.php?categoryid=' . $categoryId, _MD_PUBLISHER_RSSFEED, PUBLISHER_URL . '/assets/images/rss.gif', _MD_PUBLISHER_RSSFEED); + $link = sprintf("%s", PUBLISHER_URL . '/backend.php?categoryid=' . $categoryid, _MD_PUBLISHER_RSSFEED, PUBLISHER_URL . '/assets/images/rss.gif', _MD_PUBLISHER_RSSFEED); $xoopsTpl->assign('rssfeed_link', $link); } diff --git a/class/Category.php b/class/Category.php index 87b617fe..8cb1422f 100644 --- a/class/Category.php +++ b/class/Category.php @@ -22,7 +22,8 @@ * @author The SmartFactory */ -use XoopsModules\Publisher\{Form +use XoopsModules\Publisher\{ + Form }; /** @var Helper $this->helper */ @@ -154,7 +155,7 @@ public function getTemplate($format = 'n') /** * @param bool $withAllLink * - * @return bool|string + * @return array|bool|string */ public function getCategoryPath($withAllLink = true) { diff --git a/class/Common/Configurator.php b/class/Common/Configurator.php index 6771ad4a..db6c073c 100644 --- a/class/Common/Configurator.php +++ b/class/Common/Configurator.php @@ -32,6 +32,7 @@ class Configurator { public $name; public $paths = []; + public $icons = []; public $uploadFolders = []; public $copyBlankFiles = []; public $copyTestFolders = []; @@ -39,8 +40,9 @@ class Configurator public $oldFiles = []; public $oldFolders = []; public $renameTables = []; + public $renameColumns = []; + public $moduleStats = []; public $modCopyright; - public $icons; /** * Configurator constructor. @@ -49,6 +51,7 @@ public function __construct() { $config = require \dirname(__DIR__, 2) . '/config/config.php'; + $this->name = $config->name; $this->uploadFolders = $config->uploadFolders; $this->copyBlankFiles = $config->copyBlankFiles; $this->copyTestFolders = $config->copyTestFolders; @@ -56,6 +59,8 @@ public function __construct() $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->paths = require \dirname(__DIR__, 2) . '/config/paths.php'; diff --git a/class/Common/Migrate.php b/class/Common/Migrate.php index 3e7be619..7ce29d97 100644 --- a/class/Common/Migrate.php +++ b/class/Common/Migrate.php @@ -29,16 +29,20 @@ class Migrate extends \Xmf\Database\Migrate /** * Migrate constructor. - * @param Configurator|null $configurator + * @throws \RuntimeException + * @throws \InvalidArgumentException */ - public function __construct(Configurator $configurator = null) + public function __construct() { - if (null !== $configurator) { - $this->renameTables = $configurator->renameTables; - - $moduleDirName = \basename(\dirname(__DIR__, 2)); - parent::__construct($moduleDirName); + $class = __NAMESPACE__ . '\\' . 'Configurator'; + if (!\class_exists($class)) { + throw new \RuntimeException("Class '$class' not found"); } + $configurator = new $class(); + $this->renameTables = $configurator->renameTables; + + $moduleDirName = \basename(\dirname(__DIR__, 2)); + parent::__construct($moduleDirName); } /** diff --git a/class/Common/ModuleStats.php b/class/Common/ModuleStats.php index 3b979822..1d5b438a 100644 --- a/class/Common/ModuleStats.php +++ b/class/Common/ModuleStats.php @@ -4,8 +4,6 @@ namespace XoopsModules\Publisher\Common; -use XoopsModules\Publisher\Helper; -use XoopsModules\Publisher\Constants; /** * Created by PhpStorm. * User: mamba @@ -14,6 +12,20 @@ */ trait ModuleStats { + /** + * @param \XoopsModules\Publisher\Common\Configurator $configurator + * @return array + */ + public static function getModuleStats($configurator) + { + $moduleStats = []; + if (\count($configurator->moduleStats) > 0) { + foreach (\array_keys($configurator->moduleStats) as $i) { + $moduleStats[$i] = $configurator->moduleStats[$i]; + } + } + return $moduleStats; + } } diff --git a/class/Common/ServerStats.php b/class/Common/ServerStats.php index 27069e2d..2b79cc26 100644 --- a/class/Common/ServerStats.php +++ b/class/Common/ServerStats.php @@ -54,7 +54,7 @@ public static function getServerStats() $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())) { + if (true == ($gdlib = gd_info())) { $html .= '
  • ' . \constant('CO_' . $moduleDirNameUpper . '_GDLIBVERSION') . '' . $gdlib['GD Version'] . ''; } } diff --git a/class/Common/SysUtility.php b/class/Common/SysUtility.php index 0d2ddda3..3bb5c676 100644 --- a/class/Common/SysUtility.php +++ b/class/Common/SysUtility.php @@ -35,15 +35,10 @@ */ class SysUtility { - use VersionChecks; - - //checkVerXoops, checkVerPhp Traits - + use VersionChecks; //checkVerXoops, checkVerPhp Traits use ServerStats; // getServerStats Trait - use FilesManagement; // Files Management Trait - -// use ModuleStats; // ModuleStats Trait + use ModuleStats; // ModuleStats Trait /** * truncateHtml can truncate a string up to a number of characters while preserving whole words and HTML tags @@ -194,7 +189,7 @@ public static function getEditor($helper = null, $options = null) * * @return bool */ - public function fieldExists($fieldname, $table) + public static function fieldExists($fieldname, $table) { global $xoopsDB; $result = $xoopsDB->queryF("SHOW COLUMNS FROM $table LIKE '$fieldname'"); @@ -211,19 +206,55 @@ public function fieldExists($fieldname, $table) */ public static function cloneRecord($tableName, $id_field, $id) { - $new_id = false; +// $new_id = false; $table = $GLOBALS['xoopsDB']->prefix($tableName); // copy content of the record you wish to clone - $tempTable = $GLOBALS['xoopsDB']->fetchArray($GLOBALS['xoopsDB']->query("SELECT * FROM $table WHERE $id_field='$id' "), MYSQLI_ASSOC) or exit('Could not select record'); + $sql = "SELECT * FROM $table WHERE $id_field='$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[$id_field]); // insert cloned copy of the original record - $result = $GLOBALS['xoopsDB']->queryF("INSERT INTO $table (" . implode(', ', array_keys($tempTable)) . ") VALUES ('" . implode("', '", $tempTable) . "')") or exit ($GLOBALS['xoopsDB']->error()); - - if ($result) { - // Return the new id - $new_id = $GLOBALS['xoopsDB']->getInsertId(); + $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 + $new_id = $GLOBALS['xoopsDB']->getInsertId(); + return $new_id; } + + /** + * 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($folder) + { + 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", '
    '; + } + } + + + /** + * @param string $tablename + * + * @return bool + */ + public static function tableExists($tablename) + { + $result = $GLOBALS['xoopsDB']->queryF("SHOW TABLES LIKE '$tablename'"); + + return $GLOBALS['xoopsDB']->getRowsNum($result) > 0; + } } diff --git a/class/Common/TestdataButtons.php b/class/Common/TestdataButtons.php index 21d7f625..79f66e52 100644 --- a/class/Common/TestdataButtons.php +++ b/class/Common/TestdataButtons.php @@ -25,54 +25,53 @@ use Xmf\Request; use Xmf\Yaml; use XoopsModules\Publisher\Helper; - /** @var Helper $helper */ /** - * Class SysUtility + * Class TestdataButtons */ class TestdataButtons { + //functions for import buttons - /** - * @param $adminObject - */ 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 + $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'); - $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'ADD_SAMPLEDATA'), $helper->url('testdata/index.php?op=load'), 'add'); - $adminObject->addItemButton(constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA'), $helper->url('testdata/index.php?op=save'), 'add'); + \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'); + $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'); + $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'; + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; $app = []; $app['displaySampleButton'] = 0; Yaml::save($app, $yamlFile); - redirect_header('index.php', 0, ''); + \redirect_header('index.php', 0, ''); } public static function showButtons() { - $yamlFile = dirname(__DIR__, 2) . '/config/admin.yml'; + $yamlFile = \dirname(__DIR__, 2) . '/config/admin.yml'; $app = []; $app['displaySampleButton'] = 1; Yaml::save($app, $yamlFile); - redirect_header('index.php', 0, ''); + \redirect_header('index.php', 0, ''); } } + diff --git a/class/Common/VersionChecks.php b/class/Common/VersionChecks.php index 12b7fb2a..cdc31c65 100644 --- a/class/Common/VersionChecks.php +++ b/class/Common/VersionChecks.php @@ -98,18 +98,36 @@ public static function checkVerPhp(\XoopsModule $module = null) */ public static function checkVerModule($helper, $source = 'github', $default = 'master') { + + +/* + // Generated by curl-to-PHP: http://incarnate.github.io/curl-to-php/ + $ch = curl_init(); + + curl_setopt($ch, CURLOPT_URL, 'https://api.github.com/repos/XoopsModules25x/publisher/releases/latest'); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + + $result = curl_exec($ch); + if (curl_errno($ch)) { + echo 'Error:' . curl_error($ch); + } + curl_close($ch); + +*/ + $moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = \mb_strtoupper($moduleDirName); $update = ''; - $repository = 'XoopsModules25x/' . $moduleDirName; - // $repository = 'XoopsModules25x/publisher'; //for testing only +// $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, true); //TODO: how to avoid an error when 'Peer's Certificate issuer is not recognized' + \curl_setopt($curlHandle, \CURLOPT_FOLLOWLOCATION, 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) { @@ -132,8 +150,8 @@ public static function checkVerModule($helper, $source = 'github', $default = 'm } $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 + // $moduleVersion = \str_replace(' ', '', \mb_strtolower($moduleVersion)); +// $moduleVersion = '1.0'; //for testing only // $moduleDirName = 'aktuelles'; //for testing only if (!$prerelease && \version_compare($moduleVersion, $latestVersion, '<')) { $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..5d076016 --- /dev/null +++ b/class/Common/index.php @@ -0,0 +1,3 @@ + path('class/tree.php'); @@ -72,7 +72,7 @@ public function __construct(&$target, $subCatsCount = 4) public function createElements() { - // require_once dirname(dirname(__DIR__)) . '/include/common.php'; + // require_once \dirname(__DIR__, 2) . '/include/common.php'; // Category $criteria = new \Criteria(null); $criteria->setSort('weight'); diff --git a/class/Form/FileForm.php b/class/Form/FileForm.php index f90aecb2..640563a0 100644 --- a/class/Form/FileForm.php +++ b/class/Form/FileForm.php @@ -27,7 +27,7 @@ Helper }; -// require_once dirname(dirname(__DIR__)) . '/include/common.php'; +// require_once \dirname(__DIR__, 2) . '/include/common.php'; \xoops_load('XoopsFormLoader'); //todo: move to admin? diff --git a/class/Form/ItemForm.php b/class/Form/ItemForm.php index 83df8ab6..2ac0bf3e 100644 --- a/class/Form/ItemForm.php +++ b/class/Form/ItemForm.php @@ -25,6 +25,7 @@ use Xmf\Request; use XoopsModules\Publisher\{Constants, + Common\Configurator, Form, FormDateTime, Helper, @@ -140,6 +141,8 @@ public function createElements($obj) { $helper = Helper::getInstance(); $timeoffset = null; + $configurator = new Configurator(); + $icons = $configurator->icons; $allowedEditors = Utility::getEditors($helper->getHandler('Permission')->getGrantedItems('editors')); @@ -278,14 +281,14 @@ public function createElements($obj) /** @var GroupPermHandler $grouppermHandler */ $grouppermHandler = $helper->getHandler('GroupPerm'); $moduleId = $helper->getModule()->getVar('mid'); - if ($helper->getConfig('perm_rating') && $grouppermHandler->checkRight('global', _PUBLISHER_RATE, $groups, $moduleId)) { + if ($helper->getConfig('perm_rating') && $grouppermHandler->checkRight('global', \_PUBLISHER_RATE, $groups, $moduleId)) { $options = [ - Constants::RATING_NONE => _MI_PUBLISHER_RATING_NONE, - Constants::RATING_5STARS => _MI_PUBLISHER_RATING_5STARS, - Constants::RATING_10STARS => _MI_PUBLISHER_RATING_10STARS, - Constants::RATING_LIKES => _MI_PUBLISHER_RATING_LIKES, - Constants::RATING_10NUM => _MI_PUBLISHER_RATING_10NUM, - Constants::RATING_REACTION => _MI_PUBLISHER_RATING_REACTION, + Constants::RATING_NONE => \_MI_PUBLISHER_RATING_NONE, + Constants::RATING_5STARS => \_MI_PUBLISHER_RATING_5STARS, + Constants::RATING_10STARS => \_MI_PUBLISHER_RATING_10STARS, + Constants::RATING_LIKES => \_MI_PUBLISHER_RATING_LIKES, + Constants::RATING_10NUM => \_MI_PUBLISHER_RATING_10NUM, + Constants::RATING_REACTION => \_MI_PUBLISHER_RATING_REACTION, ]; $votetypeSelect = new \XoopsFormSelect(\_MI_PUBLISHER_RATINGBARS, 'votetype', $obj->getVar('votetype')); @@ -615,8 +618,8 @@ public function createElements($obj) $table .= ''; foreach ($filesObj as $fileObj) { - $modify = "" . $icons->edit . ''; - $delete = "" . $icons->delete . ''; + $modify = "" . $icons['edit'] . ''; + $delete = "" . $icons['delete'] . ''; $not_visible = ''; if (0 == $fileObj->status()) { $not_visible = ""; diff --git a/class/Form/index.html b/class/Form/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/class/Form/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/class/Form/index.php b/class/Form/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/class/Form/index.php @@ -0,0 +1,2 @@ +helper->getConfig('perm_edit') || Utility::userIsModerator($this) || Utility::userIsAdmin()) { // Edit button - $adminLinks .= "" . $icons->edit . ''; + $adminLinks .= "" . $icons['edit'] . ''; $adminLinks .= ' '; } if ($this->helper->getConfig('perm_delete') || Utility::userIsModerator($this) || Utility::userIsAdmin()) { // Delete button - $adminLinks .= "itemid() . "'>" . $icons->delete . ''; + $adminLinks .= "itemid() . "'>" . $icons['delete'] . ''; $adminLinks .= ' '; } } if ($this->helper->getConfig('perm_clone') || Utility::userIsModerator($this) || Utility::userIsAdmin()) { // Duplicate button - $adminLinks .= "itemid() . "'>" . $icons->clone . ''; + $adminLinks .= "itemid() . "'>" . $icons['clone'] . ''; $adminLinks .= ' '; } } @@ -501,7 +501,7 @@ public function getPdfButton($icons) $pdfButton = ''; // PDF button if (\is_file(XOOPS_ROOT_PATH . '/class/libraries/vendor/tecnickcom/tcpdf/tcpdf.php')) { - $pdfButton .= "" . $icons->pdf . ' '; + $pdfButton .= "" . $icons['pdf'] . ' '; $pdfButton .= ' '; } else { // if (is_object($GLOBALS['xoopsUser']) && Utility::userIsAdmin()) { @@ -527,7 +527,7 @@ public function getPrintLinks($icons) { $printLinks = ''; // Print button - $printLinks .= "itemid(), $this->short_url()) . "' rel='nofollow' target='_blank'>" . $icons->print . ' '; + $printLinks .= "itemid(), $this->short_url()) . "' rel='nofollow' target='_blank'>" . $icons['print'] . ' '; $printLinks .= ' '; return $printLinks; @@ -838,7 +838,7 @@ public function toArraySimple($display = 'default', $maxCharTitle = 0, $maxCharS // Highlighting searched words $highlight = true; if ($highlight && Request::getString('keywords', '', 'GET')) { - $keywords = \htmlspecialchars(\trim(\urldecode(Request::getString('keywords', '', 'GET'))), ENT_QUOTES | ENT_HTML5); + $keywords = \htmlspecialchars(\trim(\urldecode(Request::getString('keywords', '', 'GET'))), \ENT_QUOTES | \ENT_HTML5); $fields = ['title', 'maintext', 'summary']; foreach ($fields as $field) { if (isset($item[$field])) { @@ -1061,8 +1061,8 @@ public function accessGranted() public function setVarsFromRequest() { //Required fields - // if (!empty($categoryId = Request::getInt('categoryid', 0, 'POST'))) { - // $this->setVar('categoryid', $categoryId);} + // if (!empty($categoryid = Request::getInt('categoryid', 0, 'POST'))) { + // $this->setVar('categoryid', $categoryid);} if (\is_object($GLOBALS['xoopsUser'])) { $userTimeoffset = $GLOBALS['xoopsUser']->getVar('timezone_offset'); } else { @@ -1176,7 +1176,7 @@ public function assignOtherProperties() $module = $this->helper->getModule(); $module_id = $module->getVar('mid'); /** @var \XoopsGroupPermHandler $grouppermHandler */ - $grouppermHandler = xoops_getHandler('groupperm'); + $grouppermHandler = \xoops_getHandler('groupperm'); $this->category = $this->helper->getHandler('Category')->get($this->getVar('categoryid')); $this->groups_read = $grouppermHandler->getGroupIds('item_read', $this->itemid(), $module_id); diff --git a/class/ItemHandler.php b/class/ItemHandler.php index 1ce511ec..dfb75bfd 100644 --- a/class/ItemHandler.php +++ b/class/ItemHandler.php @@ -256,13 +256,13 @@ public function getCount(\CriteriaElement $criteria = null, $notNullFields = nul } /** - * @param int $categoryId + * @param int $categoryid * @param string|array $status * @param string|null $notNullFields * @param null|\CriteriaCompo $criteriaPermissions * @return \CriteriaCompo */ - private function getItemsCriteria($categoryId = -1, $status = '', $notNullFields = null, $criteriaPermissions = null) + private function getItemsCriteria($categoryid = -1, $status = '', $notNullFields = null, $criteriaPermissions = null) { // $notNullFields = (null !== $notNullFields) ?: ''; // global $publisherIsAdmin; @@ -280,8 +280,8 @@ private function getItemsCriteria($categoryId = -1, $status = '', $notNullFields // } $criteriaCategory = null; - if (isset($categoryId) && -1 !== $categoryId) { - $criteriaCategory = new \Criteria('categoryid', $categoryId); + if (isset($categoryid) && -1 !== $categoryid) { + $criteriaCategory = new \Criteria('categoryid', $categoryid); } $criteriaStatus = new \CriteriaCompo(); @@ -310,13 +310,13 @@ private function getItemsCriteria($categoryId = -1, $status = '', $notNullFields } /** - * @param $categoryId + * @param $categoryid * @param string $status * @param string|null $notNullFields * * @return int */ - public function getItemsCount($categoryId = -1, $status = '', $notNullFields = null) + public function getItemsCount($categoryid = -1, $status = '', $notNullFields = null) { // $notNullFields = $notNullFields ?? null; $criteriaPermissions = null; @@ -332,7 +332,7 @@ public function getItemsCount($categoryId = -1, $status = '', $notNullFields = n } } // $ret = []; - $criteria = $this->getItemsCriteria($categoryId, $status, $notNullFields, $criteriaPermissions); + $criteria = $this->getItemsCriteria($categoryid, $status, $notNullFields, $criteriaPermissions); $ret = $this->getCount($criteria, $notNullFields); @@ -342,7 +342,7 @@ public function getItemsCount($categoryId = -1, $status = '', $notNullFields = n /** * @param int $limit * @param int $start - * @param int $categoryId + * @param int $categoryid * @param string $sort * @param string $order * @param string|null $notNullFields @@ -352,7 +352,7 @@ public function getItemsCount($categoryId = -1, $status = '', $notNullFields = n * * @return array */ - public function getAllPublished($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none', $excludeExpired = true) + public function getAllPublished($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none', $excludeExpired = true) { $notNullFields = (null !== $notNullFields) ?: ''; $otherCriteria = new \CriteriaCompo(); @@ -368,13 +368,13 @@ public function getAllPublished($limit = 0, $start = 0, $categoryId = -1, $sort $otherCriteria->add($criteriaExpire); } - return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_PUBLISHED], $categoryId, $sort, $order, $notNullFields, $asObject, $otherCriteria, $idKey); + return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_PUBLISHED], $categoryid, $sort, $order, $notNullFields, $asObject, $otherCriteria, $idKey); } /** * @param int $limit * @param int $start - * @param int $categoryId + * @param int $categoryid * @param string $sort * @param string $order * @param string|null $notNullFields @@ -383,14 +383,14 @@ public function getAllPublished($limit = 0, $start = 0, $categoryId = -1, $sort * * @return array */ - public function getAllExpired($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none') + public function getAllExpired($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none') { $notNullFields = (null !== $notNullFields) ?: ''; $otherCriteria = new \CriteriaCompo(); $otherCriteria->add(new \Criteria('dateexpire', \time(), '<=')); $otherCriteria->add(new \Criteria('dateexpire', 0, '>')); - return $this->getItems($limit, $start, -1, $categoryId, $sort, $order, $notNullFields, $asObject, $otherCriteria, $idKey); + return $this->getItems($limit, $start, -1, $categoryid, $sort, $order, $notNullFields, $asObject, $otherCriteria, $idKey); } /** @@ -433,7 +433,7 @@ public function getNextPublished($obj) /** * @param int $limit * @param int $start - * @param int $categoryId + * @param int $categoryid * @param string $sort * @param string $order * @param string|null $notNullFields @@ -442,16 +442,16 @@ public function getNextPublished($obj) * * @return array */ - public function getAllSubmitted($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none') + public function getAllSubmitted($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $idKey = 'none') { $notNullFields = (null !== $notNullFields) ?: ''; - return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_SUBMITTED], $categoryId, $sort, $order, $notNullFields, $asObject, null, $idKey); + return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_SUBMITTED], $categoryid, $sort, $order, $notNullFields, $asObject, null, $idKey); } /** * @param int $limit * @param int $start - * @param int $categoryId + * @param int $categoryid * @param string $sort * @param string $order * @param string $notNullFields @@ -460,15 +460,15 @@ public function getAllSubmitted($limit = 0, $start = 0, $categoryId = -1, $sort * * @return array */ - public function getAllOffline($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none') + public function getAllOffline($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none') { - return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_OFFLINE], $categoryId, $sort, $order, $notNullFields, $asObject, null, $idKey); + return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_OFFLINE], $categoryid, $sort, $order, $notNullFields, $asObject, null, $idKey); } /** * @param int $limit * @param int $start - * @param int $categoryId + * @param int $categoryid * @param string $sort * @param string $order * @param string $notNullFields @@ -477,16 +477,16 @@ public function getAllOffline($limit = 0, $start = 0, $categoryId = -1, $sort = * * @return array */ - public function getAllRejected($limit = 0, $start = 0, $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none') + public function getAllRejected($limit = 0, $start = 0, $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = '', $asObject = true, $idKey = 'none') { - return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_REJECTED], $categoryId, $sort, $order, $notNullFields, $asObject, null, $idKey); + return $this->getItems($limit, $start, [Constants::PUBLISHER_STATUS_REJECTED], $categoryid, $sort, $order, $notNullFields, $asObject, null, $idKey); } /** * @param int $limit * @param int $start * @param array|string $status - * @param int $categoryId + * @param int $categoryid * @param string $sort * @param string $order * @param string|null $notNullFields @@ -496,7 +496,7 @@ public function getAllRejected($limit = 0, $start = 0, $categoryId = -1, $sort = * @return array * @internal param bool $asObject */ - public function getItems($limit = 0, $start = 0, $status = '', $categoryId = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $otherCriteria = null, $idKey = 'none') + public function getItems($limit = 0, $start = 0, $status = '', $categoryid = -1, $sort = 'datesub', $order = 'DESC', $notNullFields = null, $asObject = true, $otherCriteria = null, $idKey = 'none') { $notNullFields = (null !== $notNullFields) ?: ''; $criteriaPermissions = null; @@ -512,10 +512,10 @@ public function getItems($limit = 0, $start = 0, $status = '', $categoryId = -1, } } - $criteria = $this->getItemsCriteria($categoryId, $status, $notNullFields, $criteriaPermissions); + $criteria = $this->getItemsCriteria($categoryid, $status, $notNullFields, $criteriaPermissions); /* - if (isset($categoryId) && $categoryId != -1) { - $criteriaCategory = new \Criteria('categoryid', $categoryId); + if (isset($categoryid) && $categoryid != -1) { + $criteriaCategory = new \Criteria('categoryid', $categoryid); } $criteriaStatus = new \CriteriaCompo(); if (!empty($status) && is_array($status)) { @@ -553,23 +553,23 @@ public function getItems($limit = 0, $start = 0, $status = '', $categoryId = -1, /** * @param string $field * @param string $status - * @param int $categoryId + * @param int $categoryid * * @return bool * @throws \Exception */ - public function getRandomItem($field = '', $status = '', $categoryId = -1) + public function getRandomItem($field = '', $status = '', $categoryid = -1) { $ret = false; $notNullFields = $field; // Getting the number of published Items - $totalItems = $this->getItemsCount($categoryId, $status, $notNullFields); + $totalItems = $this->getItemsCount($categoryid, $status, $notNullFields); if ($totalItems > 0) { --$totalItems; $entryNumber = \random_int(0, $totalItems); // $entryNumber2 = random_int(0, $totalItems); - $item = $this->getItems(1, $entryNumber, $status, $categoryId, $sort = 'datesub', $order = 'DESC', $notNullFields); + $item = $this->getItems(1, $entryNumber, $status, $categoryid, $sort = 'datesub', $order = 'DESC', $notNullFields); if ($item) { $ret = $item[0]; } diff --git a/class/MimetypesUtility.php b/class/MimetypesUtility.php index 03bcf5dc..5eb8733a 100644 --- a/class/MimetypesUtility.php +++ b/class/MimetypesUtility.php @@ -459,15 +459,15 @@ public static function manage($icons) " . $mime->getVar('mime_ext') . " getVar('mime_id') . '&mime_admin=' . $mime->getVar('mime_admin') . '&limit=' . $limit . '&start=' . $start . "'> - " . ($mime->getVar('mime_admin') ? $icons->online : $icons->offline) . " + " . ($mime->getVar('mime_admin') ? $icons['online'] : $icons['offline']) . " getVar('mime_id') . '&mime_user=' . $mime->getVar('mime_user') . '&limit=' . $limit . '&start=' . $start . "'> - " . ($mime->getVar('mime_user') ? $icons->online : $icons->offline) . " + " . ($mime->getVar('mime_user') ? $icons['online'] : $icons['offline']) . " - getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons->edit . " - getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons->delete . ' + getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons['edit'] . " + getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons['delete'] . ' '; } @@ -613,15 +613,15 @@ public static function search($icons) " . $mime->getVar('mime_ext') . " getVar('mime_id') . '&mime_admin=' . $mime->getVar('mime_admin') . '&limit=' . $limit . '&start=' . $start . "'> - " . ($mime->getVar('mime_admin') ? $icons->online : $icons->offline) . " + " . ($mime->getVar('mime_admin') ? $icons['online'] : $icons['offline']) . " getVar('mime_id') . '&mime_user=' . $mime->getVar('mime_user') . '&limit=' . $limit . '&start=' . $start . "'> - " . ($mime->getVar('mime_user') ? $icons->online : $icons->offline) . " + " . ($mime->getVar('mime_user') ? $icons['online'] : $icons['offline']) . " - getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons->edit . " - getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons->delete . ' + getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons['edit'] . " + getVar('mime_id') . '&limit=' . $limit . '&start=' . $start . "'>" . $icons['delete'] . ' '; } @@ -670,7 +670,7 @@ public static function search($icons) echo ''; } Utility::closeCollapsableBar('mimesearchtable', 'mimesearchicon'); - // require_once dirname(__DIR__) . '/admin/admin_footer.php'; + // require_once \dirname(__DIR__) . '/admin/admin_footer.php'; \xoops_cp_footer(); } diff --git a/class/PermissionHandler.php b/class/PermissionHandler.php index 59b2fbcc..97abe001 100644 --- a/class/PermissionHandler.php +++ b/class/PermissionHandler.php @@ -67,7 +67,7 @@ public function getGrantedGroupsById($gpermName, $id) $db = \XoopsDatabaseFactory::getDatabaseConnection(); $limit = $start = 0; $sql = 'SELECT gperm_groupid FROM ' . $db->prefix('group_permission'); - if (null !== $criteria && $criteria instanceof \CriteriaCompo) { + if (\is_object($criteria) && \is_subclass_of($criteria, \CriteriaElement::class)) { $sql .= ' ' . $criteria->renderWhere(); $limit = $criteria->getLimit(); $start = $criteria->getStart(); diff --git a/class/Ratings.php b/class/Ratings.php index aa8b6085..8aea7911 100644 --- a/class/Ratings.php +++ b/class/Ratings.php @@ -86,6 +86,7 @@ public function getValuesRatings($keys = null, $format = null, $maxDepth = null) $ret['uid'] = \XoopsUser::getUnameFromId($this->getVar('rate_uid')); $ret['ip'] = $this->getVar('rate_ip'); $ret['date'] = \formatTimestamp($this->getVar('rate_date'), 's'); + $ret['votetype'] = $this->getVar('votetype'); return $ret; } diff --git a/class/RatingsHandler.php b/class/RatingsHandler.php index 0b149926..ecb39983 100644 --- a/class/RatingsHandler.php +++ b/class/RatingsHandler.php @@ -111,7 +111,7 @@ public function getItemRating($itemId = 0, $source = 0) $criteria->add(new \Criteria('rate_source', $source)); $ratingObjs = $helper->getHandler('ratings')->getObjects($criteria); - $count = count($ratingObjs); + $count = \count($ratingObjs); $itemRating['nb_ratings'] = $count; foreach ($ratingObjs as $ratingObj) { @@ -148,7 +148,7 @@ public function getItemRating($itemId = 0, $source = 0) $criteria->add(new \Criteria('rate_value', 0, '<')); $ratingObjs = $helper->getHandler('Ratings')->getObjects($criteria); - $count = count($ratingObjs); + $count = \count($ratingObjs); foreach ($ratingObjs as $ratingObj) { $currentRating += $ratingObj->getVar('rate_value'); @@ -166,7 +166,7 @@ public function getItemRating($itemId = 0, $source = 0) $criteria->add(new \Criteria('rate_value', 0, '>')); $ratingObjs = $helper->getHandler('ratings')->getObjects($criteria); - $count = count($ratingObjs); + $count = \count($ratingObjs); $currentRating = 0; foreach ($ratingObjs as $ratingObj) { $currentRating += $ratingObj->getVar('rate_value'); @@ -188,7 +188,7 @@ public function getItemRating($itemId = 0, $source = 0) $criteria->add(new \Criteria('rate_value', 0, '<')); $ratingObjs = $helper->getHandler('ratings')->getObjects($criteria); - $count = count($ratingObjs); + $count = \count($ratingObjs); $itemRating['nb_ratings'] = $count; foreach ($ratingObjs as $ratingObj) { @@ -207,7 +207,7 @@ public function getItemRating($itemId = 0, $source = 0) $criteria->add(new \Criteria('rate_value', 0, '>')); $ratingObjs = $helper->getHandler('ratings')->getObjects($criteria); - $count = count($ratingObjs); + $count = \count($ratingObjs); $currentRating = 0; foreach ($ratingObjs as $ratingObj) { $currentRating += $ratingObj->getVar('rate_value'); diff --git a/class/ThemeTabForm.php b/class/ThemeTabForm.php index ad9a2e2c..af3c78e1 100644 --- a/class/ThemeTabForm.php +++ b/class/ThemeTabForm.php @@ -144,7 +144,7 @@ public function assign(\XoopsTpl $tpl) $elements[$n]['name'] = $eleName; $elements[$n]['caption'] = $ele->getCaption(); $elements[$n]['body'] = $ele->render(); - $elements[$n]['hidden'] = $ele->isHidden() ? true : false; + $elements[$n]['hidden'] = (bool)$ele->isHidden(); $elements[$n]['required'] = $ele->isRequired(); if ('' != $eleDescription) { $elements[$n]['description'] = $eleDescription; diff --git a/class/Utility.php b/class/Utility.php index 6dbeb61a..f65d7ead 100644 --- a/class/Utility.php +++ b/class/Utility.php @@ -182,8 +182,8 @@ public static function displayCategory(Category $categoryObj, $level = 0) $description = \mb_substr($description, 0, 100 - 1) . '...'; } } - $modify = "" . $icons->edit . ''; - $delete = "" . $icons->delete . ''; + $modify = "" . $icons['edit'] . ''; + $delete = "" . $icons['delete'] . ''; $spaces = \str_repeat(' ', ($level * 3)); /* $spaces = ''; @@ -240,20 +240,20 @@ public static function editFile($showmenu = false, $fileid = 0, $itemId = 0) $fileObj = $helper->getHandler('File')->get($fileid); if ($fileObj->notLoaded()) { - redirect_header('', 1, _AM_PUBLISHER_NOFILESELECTED); + \redirect_header('', 1, \_AM_PUBLISHER_NOFILESELECTED); } echo "
    \n"; - echo "" . _AM_PUBLISHER_FILE_EDITING . ''; - echo '' . _AM_PUBLISHER_FILE_EDITING_DSC . ''; - static::openCollapsableBar('editfile', 'editfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + echo "" . \_AM_PUBLISHER_FILE_EDITING . ''; + echo '' . \_AM_PUBLISHER_FILE_EDITING_DSC . ''; + static::openCollapsableBar('editfile', 'editfileicon', \_AM_PUBLISHER_FILE_INFORMATIONS); } else { // there's no parameter, so we're adding an item $fileObj = $helper->getHandler('File')->create(); $fileObj->setVar('itemid', $itemId); - echo "" . _AM_PUBLISHER_FILE_ADDING . ''; - echo '' . _AM_PUBLISHER_FILE_ADDING_DSC . ''; - static::openCollapsableBar('addfile', 'addfileicon', _AM_PUBLISHER_FILE_INFORMATIONS); + echo "" . \_AM_PUBLISHER_FILE_ADDING . ''; + echo '' . \_AM_PUBLISHER_FILE_ADDING_DSC . ''; + static::openCollapsableBar('addfile', 'addfileicon', \_AM_PUBLISHER_FILE_INFORMATIONS); } // FILES UPLOAD FORM @@ -270,19 +270,19 @@ public static function editFile($showmenu = false, $fileid = 0, $itemId = 0) /** * @param bool $showmenu - * @param int $categoryId + * @param int $categoryid * @param int $nbSubCats * @param Category|null $categoryObj */ - public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCats = 4, $categoryObj = null) + public static function editCategory($showmenu = false, $categoryid = 0, $nbSubCats = 4, $categoryObj = null) { $helper = Helper::getInstance(); // if there is a parameter, and the id exists, retrieve data: we're editing a category /** @var Category $categoryObj */ - if (0 != $categoryId) { + if (0 != $categoryid) { // Creating the category object for the selected category - $categoryObj = $helper->getHandler('Category')->get($categoryId); + $categoryObj = $helper->getHandler('Category')->get($categoryid); if ($categoryObj->notLoaded()) { \redirect_header('category.php', 1, \_AM_PUBLISHER_NOCOLTOEDIT); } @@ -290,7 +290,7 @@ public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCa $categoryObj = $helper->getHandler('Category')->create(); } - if (0 != $categoryId) { + if (0 != $categoryid) { echo "
    \n"; static::openCollapsableBar('edittable', 'edittableicon', \_AM_PUBLISHER_EDITCOL, \_AM_PUBLISHER_CATEGORY_EDIT_INFO); } else { @@ -300,15 +300,15 @@ public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCa $sform = $categoryObj->getForm($nbSubCats); $sform->display(); - if ($categoryId) { + if ($categoryid) { static::closeCollapsableBar('edittable', 'edittableicon'); } else { static::closeCollapsableBar('createtable', 'createtableicon'); } //Added by fx2024 - if ($categoryId) { - $selCat = $categoryId; + if ($categoryid) { + $selCat = $categoryid; static::openCollapsableBar('subcatstable', 'subcatsicon', \_AM_PUBLISHER_SUBCAT_CAT, \_AM_PUBLISHER_SUBCAT_CAT_DSC); // Get the total number of sub-categories @@ -326,8 +326,8 @@ public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCa echo ''; if ($totalsubs > 0) { foreach ($subcatsObj as $subcat) { - $modify = "" . $icons->edit . ''; - $delete = "" . $icons->delete . ''; + $modify = "" . $icons['edit'] . ''; + $delete = "" . $icons['delete'] . ''; echo ''; echo "" . $subcat->categoryid() . ''; echo "getModule()->dirname() . '/category.php?categoryid=' . $subcat->categoryid() . '&parentid=' . $subcat->parentid() . "'>" . $subcat->name() . ''; @@ -363,8 +363,8 @@ public static function editCategory($showmenu = false, $categoryId = 0, $nbSubCa if ($totalitems > 0) { foreach ($itemsObj as $iValue) { $categoryObj = $allcats[$iValue->categoryid()]; - $modify = "" . $icons->edit . ''; - $delete = "" . $icons->delete . ''; + $modify = "" . $icons['edit'] . ''; + $delete = "" . $icons['delete'] . ''; echo ''; echo "" . $iValue->itemid() . ''; echo "" . $categoryObj->name() . ''; @@ -784,11 +784,11 @@ public static function userIsModerator($itemObj) * Saves permissions for the selected category * * @param null|array $groups : group with granted permission - * @param int $categoryId : categoryid on which we are setting permissions + * @param int $categoryid : categoryid on which we are setting permissions * @param string $permName : name of the permission * @return bool : TRUE if the no errors occured */ - public static function saveCategoryPermissions($groups, $categoryId, $permName) + public static function saveCategoryPermissions($groups, $categoryid, $permName) { $helper = Helper::getInstance(); @@ -798,12 +798,12 @@ public static function saveCategoryPermissions($groups, $categoryId, $permName) /** @var \XoopsGroupPermHandler $grouppermHandler */ $grouppermHandler = \xoops_getHandler('groupperm'); // First, if the permissions are already there, delete them - $grouppermHandler->deleteByModule($moduleId, $permName, $categoryId); + $grouppermHandler->deleteByModule($moduleId, $permName, $categoryid); // Save the new permissions if (\count($groups) > 0) { foreach ($groups as $groupId) { - $grouppermHandler->addRight($permName, $categoryId, $groupId, $moduleId); + $grouppermHandler->addRight($permName, $categoryid, $groupId, $moduleId); } } @@ -872,7 +872,7 @@ public static function setCookieVar($name, $value, $time = 0) $time = \time() + 3600 * 24 * 365; } // setcookie($name, $value, $time, '/'); - setcookie($name, $value, $time, '/', ini_get('session.cookie_domain'), (bool)ini_get('session.cookie_secure'), (bool)ini_get('session.cookie_httponly')); + setcookie($name, $value, $time, '/', \ini_get('session.cookie_domain'), (bool)\ini_get('session.cookie_secure'), (bool)\ini_get('session.cookie_httponly')); } /** @@ -1423,27 +1423,27 @@ public static function convertCharset($item) /** * @return array */ - public static function getModuleStats() - { - $helper = Helper::getInstance(); - // $moduleStats = []; - // if (\count($configurator->moduleStats) > 0) { - // foreach (\array_keys($configurator->moduleStats) as $i) { - // $moduleStats[$i] = $configurator->moduleStats[$i]; - // } - // } - - $moduleStats = [ - 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), - 'totalitems' => $helper->getHandler('Item')->getItemsCount(), - 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_SUBMITTED), - 'totalpublished' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_PUBLISHED), - 'totaloffline' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_OFFLINE), - 'totalrejected' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_REJECTED), - ]; - - return $moduleStats; - } +// public static function getModuleStats() +// { +// $helper = Helper::getInstance(); +// // $moduleStats = []; +// // if (\count($configurator->moduleStats) > 0) { +// // foreach (\array_keys($configurator->moduleStats) as $i) { +// // $moduleStats[$i] = $configurator->moduleStats[$i]; +// // } +// // } +// +// $moduleStats = [ +// 'totalcategories' => $helper->getHandler('Category')->getCategoriesCount(-1), +// 'totalitems' => $helper->getHandler('Item')->getItemsCount(), +// 'totalsubmitted' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_SUBMITTED), +// 'totalpublished' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_PUBLISHED), +// 'totaloffline' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_OFFLINE), +// 'totalrejected' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_REJECTED), +// ]; +// +// return $moduleStats; +// } /** * @param $path diff --git a/class/Vote.php b/class/Vote.php index 51f52725..f4aee822 100644 --- a/class/Vote.php +++ b/class/Vote.php @@ -43,6 +43,7 @@ public function __construct() $this->initVar('uid', \XOBJ_DTYPE_INT); $this->initVar('ip', \XOBJ_DTYPE_TXTBOX); $this->initVar('date', \XOBJ_DTYPE_INT); + $this->initVar('votetype', \XOBJ_DTYPE_INT); } /** diff --git a/class/VoteHandler.php b/class/VoteHandler.php index 56260361..5a99cc7f 100644 --- a/class/VoteHandler.php +++ b/class/VoteHandler.php @@ -89,7 +89,7 @@ public function getItemRating($itemId = null, $source = null): array $ratingbarsValue = (int)$this->helper->getConfig('ratingbars'); $ratingArray = [Constants::RATING_5STARS, Constants::RATING_10STARS, Constants::RATING_10NUM]; - if (in_array($ratingbarsValue, $ratingArray)) { + if (\in_array($ratingbarsValue, $ratingArray)) { $rating_unitwidth = 25; if (Constants::RATING_5STARS === (int)$this->helper->getConfig('ratingbars')) { $max_units = 5; @@ -254,7 +254,7 @@ public function getItemRating5($itemObj = null, $source = null): array $ratingbarsValue = $itemObj->votetype(); $ratingArray = [Constants::RATING_5STARS, Constants::RATING_10STARS, Constants::RATING_10NUM]; - if (in_array($ratingbarsValue, $ratingArray)) { + if (\in_array($ratingbarsValue, $ratingArray)) { $rating_unitwidth = 25; if (Constants::RATING_5STARS === $ratingbarsValue) { $max_units = 5; @@ -408,10 +408,6 @@ public function getItemRating5($itemObj = null, $source = null): array } - - - - /** * delete vote of given item * @param mixed $itemId @@ -426,4 +422,113 @@ public function deleteAllVote($itemId, $source): bool return $this->deleteAll($criteria); } + +//TODO + // delete all votes for an item + // delete all votes + // updates Vote counts for an item after new vote + // convert vote type to another + // TopRated + // getAggregate + + // Average, Sum, Count + // getVotingElement (FiveStarts, Reaction) + // buildForm, getStyle + // + //tableName + //behaviors + //rules + //attributeLabels + //afterSave + //getModelIdByName + //getModelNameById + //getIsAllowGuests + //getIsAllowChangeVote + //updateRating + + //getId + //getVoterId + //getVoterName + //getVoteableId + //getVotableName + //getValue + //getRange + //getMinValue + //getMaxValue + //getTime + + //VoteRepositoryInterface: + //find + //findByVoter + //findByVotable + //getCountByVotable + //getAvgByVotable + //create + //delete + + + //VotesRepositoryTest + //repo + //vote + //__construct + //testRepo + //_testCreate + //_testFindByVoter + //_testFindByVotable + //_testAvg + //_testCount + //_testDelete + //_votable + //_voter + + + //FieldVoteResultBase: + //calculateResult + //getVotesForField + // + // + //VotingApiField: + //defaultFieldSettings + //defaultStorageSettings + //fieldSettingsForm + //generateSampleValue + //isEmpty + //mainPropertyName + //postSave + //propertyDefinitions + //schema + //storageSettingsForm + // + // + //VotingApiWidgetBase: + //canVote + //getEntityForVoting + //getForm + //getInitialVotingElement + //getLabel + //getResults + //getValues + //getVoteSummary + //getWindow + + //Rating + //afterSave + //attributeLabels + //behaviors + //compressIp + //expandIp + //getIsAllowChangeVote + //getIsAllowGuests + //getModelIdByName + //getModelNameById + //rules + //tableName + //updateRating + + + + + + + } diff --git a/class/index.html b/class/index.html deleted file mode 100644 index 74b6f45c..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..4ae18fd0 --- /dev/null +++ b/class/index.php @@ -0,0 +1,2 @@ + */ -require dirname(__DIR__, 2) . '/mainfile.php'; +require_once \dirname(__DIR__, 2) . '/mainfile.php'; require_once $GLOBALS['xoops']->path('include/comment_delete.php'); diff --git a/comment_edit.php b/comment_edit.php index cf345dae..2125227f 100644 --- a/comment_edit.php +++ b/comment_edit.php @@ -17,5 +17,5 @@ * @since 1.0 * @author trabis */ -require dirname(__DIR__, 2) . '/mainfile.php'; +require_once \dirname(__DIR__, 2) . '/mainfile.php'; require_once $GLOBALS['xoops']->path('include/comment_edit.php'); diff --git a/comment_new.php b/comment_new.php index 3d0318b0..25b774eb 100644 --- a/comment_new.php +++ b/comment_new.php @@ -26,7 +26,7 @@ /** @var Helper $helper */ /** @var Item $itemObj */ -require_once dirname(__DIR__, 2) . '/mainfile.php'; +require_once \dirname(__DIR__, 2) . '/mainfile.php'; require_once __DIR__ . '/include/common.php'; $helper = Helper::getInstance(); diff --git a/comment_post.php b/comment_post.php index f2f90f6f..bbad8f06 100644 --- a/comment_post.php +++ b/comment_post.php @@ -17,5 +17,5 @@ * @since 1.0 * @author trabis */ -require dirname(__DIR__, 2) . '/mainfile.php'; +require_once \dirname(__DIR__, 2) . '/mainfile.php'; require_once $GLOBALS['xoops']->path('include/comment_post.php'); diff --git a/comment_reply.php b/comment_reply.php index 4698867f..756e0c76 100644 --- a/comment_reply.php +++ b/comment_reply.php @@ -17,5 +17,5 @@ * @since 1.0 * @author trabis */ -require dirname(__DIR__, 2) . '/mainfile.php'; +require_once \dirname(__DIR__, 2) . '/mainfile.php'; require_once $GLOBALS['xoops']->path('include/comment_reply.php'); diff --git a/config/config.php b/config/config.php index 67ee2f1b..54af2270 100644 --- a/config/config.php +++ b/config/config.php @@ -12,7 +12,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) * @since * @author XOOPS Development Team @@ -23,11 +23,13 @@ Helper }; -require_once dirname(__DIR__) . '/include/common.php'; -$moduleDirName = basename(dirname(__DIR__)); +require_once \dirname(__DIR__) . '/include/common.php'; +$moduleDirName = \basename(\dirname(__DIR__)); +$moduleDirNameUpper = mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); return (object)[ + 'name' => $moduleDirNameUpper . ' Module Configurator', 'paths' => [ 'dirname' => $moduleDirName, 'admin' => XOOPS_ROOT_PATH . '/modules/' . $moduleDirName . '/admin', @@ -84,6 +86,17 @@ '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), + 'totalpublished' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_PUBLISHED), + 'totaloffline' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_OFFLINE), + 'totalrejected' => $helper->getHandler('Item')->getItemsCount(-1, Constants::PUBLISHER_STATUS_REJECTED), + ], 'modCopyright' => " XOOPS Project", ]; + diff --git a/config/icons.php b/config/icons.php index f0135a2e..d45b6122 100644 --- a/config/icons.php +++ b/config/icons.php @@ -10,8 +10,8 @@ Utility }; -$pathIcon16 = Admin::iconUrl('', 16); -$moduleDirName = basename(dirname(__DIR__)); +$pathIcon16 = Admin::iconUrl('', '16'); +$moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); $helper->loadLanguage('admin'); @@ -21,7 +21,7 @@ $print = constant('_CO_' . $moduleDirNameUpper . '_' . 'PRINT'); $pdf = constant('_CO_' . $moduleDirNameUpper . '_' . 'PDF'); -return (object)[ +return [ 'edit' => Utility::iconSourceTag($pathIcon16, 'edit.png', _EDIT), 'delete' => Utility::iconSourceTag($pathIcon16, 'delete.png', _DELETE), 'clone' => Utility::iconSourceTag($pathIcon16, 'editcopy.png', _CLONE), 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 @@ +1.08 Alpha 4 [2021-01-12] Dev: XOOPS 2.5.11, PHP 7.4.14, PHP 8.0.1 +
    1.08 Alpha 5 [2021-08-28]
    Dev: XOOPS 2.5.11, PHP 7.4.22, PHP 8.0.9
    -- added votetype column in update (goffy) -- added rating selection in item form (mamba) +- updated articles testdata with voting (mamba) +- set $icons in ItemForm (mamba) +- added votetype to Vote/Ratings classes (mamba) +- fix for integer in archive #162 (liomj/mamba) - added smarty defaults (goffy) - fixed bug with cloning (goffy) -- replace _MI_BLOG_ by _MI_PUBLISHER_ (goffy) -- replace _MA_BLOG_ by _MA_PUBLISHER_ (goffy) +- replace index.html with index.php (mamba) +- add renameColumns, moduleStats to Configurator (mamba) +- logoXoopsPhp8 (mamba) +- Yoda, cosmetics, Unqualified function/constant reference, type hints (mamba) +- PHP8 Smarty defaults +- revert for blocks in 2.5.10 (ihackcode/mamba) +- various fixes from Scrutinizer (mamba) + + +
    1.08 Alpha 4 [2021-01-12]
    Dev: XOOPS 2.5.11, PHP 7.4.14, PHP 8.0.1 +
    +- added votetype column in update (goffy) +- added rating selection in item form (mamba) +
    1.08 Alpha 3 [2021-01-01]
    Dev: XOOPS 2.5.11, PHP 7.4.13, PHP 8.0
    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..2ea9b7d9 --- /dev/null +++ b/docs/index.php @@ -0,0 +1,3 @@ +history.go(-1); \ No newline at end of file diff --git a/extra/index.php b/extra/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/extra/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/extra/seo/index.php b/extra/seo/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/extra/seo/index.php @@ -0,0 +1,2 @@ +activated = false; diff --git a/include/common.php b/include/common.php index f7d93d0a..0ce08d53 100644 --- a/include/common.php +++ b/include/common.php @@ -30,10 +30,10 @@ /** @var Helper $helper */ /** @var Utility $utility */ -$moduleDirName = basename(dirname(__DIR__)); +$moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); -require dirname(__DIR__) . '/preloads/autoloader.php'; +require \dirname(__DIR__) . '/preloads/autoloader.php'; /** @var \XoopsMySQLDatabase $db */ $db = \XoopsDatabaseFactory::getDatabaseConnection(); @@ -108,8 +108,8 @@ $publisherCurrentPage = Utility::getCurrentPage(); } -$pathIcon16 = Admin::iconUrl('', 16); -$pathIcon32 = Admin::iconUrl('', 32); +$pathIcon16 = Admin::iconUrl('', '16'); +$pathIcon32 = Admin::iconUrl('', '32'); //$pathModIcon16 = $helper->getModule()->getInfo('modicons16'); //$pathModIcon32 = $helper->getModule()->getInfo('modicons32'); diff --git a/include/config.php b/include/config.php index 59fcb3a2..1dfa130b 100644 --- a/include/config.php +++ b/include/config.php @@ -30,7 +30,7 @@ require __DIR__ . '/common.php'; /** @return object */ -$moduleDirName = basename(dirname(__DIR__)); +$moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); diff --git a/include/index.html b/include/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/include/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/include/index.php b/include/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/include/index.php @@ -0,0 +1,2 @@ + */ -use XoopsModules\Publisher\{Common\Configurator, +use XoopsModules\Publisher\{ + Common\Configurator, Helper, Utility }; @@ -32,7 +33,7 @@ */ function xoops_module_pre_install_publisher(\XoopsModule $module) { - require dirname(__DIR__) . '/preloads/autoloader.php'; + require \dirname(__DIR__) . '/preloads/autoloader.php'; $utility = new Utility(); //check for minimum XOOPS version @@ -57,7 +58,7 @@ function xoops_module_pre_install_publisher(\XoopsModule $module) */ function xoops_module_install_publisher(\XoopsModule $module) { - require dirname(__DIR__) . '/preloads/autoloader.php'; + require \dirname(__DIR__) . '/preloads/autoloader.php'; $helper = Helper::getInstance(); $utility = new Utility(); @@ -77,7 +78,7 @@ function xoops_module_install_publisher(\XoopsModule $module) // --- COPY blank.png FILES --------------- if ($configurator->copyBlankFiles && is_array($configurator->copyBlankFiles)) { - $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); @@ -86,7 +87,7 @@ function xoops_module_install_publisher(\XoopsModule $module) // --- COPY test folder files --------------- if ($configurator->copyTestFolders && is_array($configurator->copyTestFolders)) { - // $file = dirname(__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/include/onupdate.php b/include/onupdate.php index 603f2b4b..97df8cba 100644 --- a/include/onupdate.php +++ b/include/onupdate.php @@ -53,7 +53,7 @@ function xoops_module_pre_update_publisher(\XoopsModule $module) function xoops_module_update_publisher(\XoopsModule $module, $previousVersion = null) { global $xoopsDB; - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); // $moduleDirNameUpper = mb_strtoupper($moduleDirName); /** @var Helper $helper */ @@ -132,7 +132,7 @@ function xoops_module_update_publisher(\XoopsModule $module, $previousVersion = // --- 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/plugin.tag.php b/include/plugin.tag.php index 8ae0e634..241ead8c 100644 --- a/include/plugin.tag.php +++ b/include/plugin.tag.php @@ -115,5 +115,5 @@ function publisher_tag_synchronization($mid) . ' )'; $result = $linkHandler->db->queryF($sql); - return $result ? true : false; + return (bool)$result; } diff --git a/include/search.inc.php b/include/search.inc.php index ace503fb..9f442727 100644 --- a/include/search.inc.php +++ b/include/search.inc.php @@ -44,12 +44,18 @@ function publisher_search($queryArray, $andor, $limit, $offset, $userid, $catego { $helper = Helper::getInstance(); $ret = $item = []; - if (is_array($queryArray) && 0 === count($queryArray)) { - $hightlightKey = ''; - } else { - $keywords = implode('+', $queryArray); - $hightlightKey = '&keywords=' . $keywords; + $hightlightKey = ''; + + if (is_array($queryArray)) { + if (0 === count($queryArray)) { + $hightlightKey = ''; + } else { + $keywords = implode('+', $queryArray); + $hightlightKey = '&keywords=' . $keywords; + } } + + $itemHandler = $helper->getHandler('Item'); $itemsObjs = $itemHandler->getItemsFromSearch($queryArray, $andor, $limit, $offset, $userid, $categories, $sortby, $searchin, $extra); $withCategoryPath = $helper->getConfig('search_cat_path'); diff --git a/item.php b/item.php index b66d3a05..2e5e1259 100644 --- a/item.php +++ b/item.php @@ -20,7 +20,8 @@ */ use Xmf\Request; -use XoopsModules\Publisher\{Category, +use XoopsModules\Publisher\{ + Category, Constants, Helper, Item, diff --git a/language/english/blocksadmin.php b/language/english/blocksadmin.php index 309cb87a..5e9d0090 100644 --- a/language/english/blocksadmin.php +++ b/language/english/blocksadmin.php @@ -10,7 +10,7 @@ */ /** - * @copyright XOOPS Project https://xoops.org/ + * @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/language/english/common.php b/language/english/common.php index 26402a3f..d9e97f0f 100644 --- a/language/english/common.php +++ b/language/english/common.php @@ -116,7 +116,7 @@ //2017-11-22 -$moduleDirName = basename(dirname(__DIR__, 2)); +$moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); define('CO_' . $moduleDirNameUpper . '_GDLIBSTATUS', 'GD library support: '); @@ -135,8 +135,8 @@ 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 . '_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"); @@ -167,20 +167,23 @@ 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 . '_' . 'SAVE_SAMPLEDATA_SUCCESS', 'Export Tables to YAML successfully'); -define('CO_' . $moduleDirNameUpper . '_' . 'SAVE_SAMPLEDATA_ERROR', 'ERROR: Export of Tables 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 . '_' . '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"); diff --git a/language/english/feedback.php b/language/english/feedback.php index db3e23bf..4fb55548 100644 --- a/language/english/feedback.php +++ b/language/english/feedback.php @@ -20,7 +20,7 @@ * @min_xoops 2.5.9 * @author XOOPS - Website: */ -$moduleDirName = basename(dirname(__DIR__, 2)); +$moduleDirName = \basename(\dirname(__DIR__, 2)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); define('CO_' . $moduleDirNameUpper . '_' . 'FB_FORM_TITLE', 'Send a feedback'); 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..2ea9b7d9 --- /dev/null +++ b/language/english/help/index.php @@ -0,0 +1,3 @@ +history.go(-1); diff --git a/language/english/index.php b/language/english/index.php new file mode 100644 index 00000000..2ea9b7d9 --- /dev/null +++ b/language/english/index.php @@ -0,0 +1,3 @@ +history.go(-1); \ No newline at end of file diff --git a/language/english/mail_template/index.php b/language/english/mail_template/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/language/english/mail_template/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/language/index.php b/language/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/language/index.php @@ -0,0 +1,2 @@ + */ -require_once dirname(__DIR__, 2) . '/mainfile.php'; +require_once \dirname(__DIR__, 2) . '/mainfile.php'; require_once $GLOBALS['xoops']->path('include/notification_update.php'); diff --git a/preloads/autoloader.php b/preloads/autoloader.php index 57165284..819b8052 100644 --- a/preloads/autoloader.php +++ b/preloads/autoloader.php @@ -11,7 +11,7 @@ static function ($class) { $prefix = 'XoopsModules\\' . ucfirst(basename(dirname(__DIR__))); // base directory for the namespace prefix - $baseDir = dirname(__DIR__) . '/class/'; + $baseDir = \dirname(__DIR__) . '/class/'; // does the class use the namespace prefix? $len = mb_strlen($prefix); diff --git a/preloads/index.html b/preloads/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/preloads/index.html +++ /dev/null @@ -1 +0,0 @@ - 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 @@ +history.go(-1); \ No newline at end of file diff --git a/sql/index.php b/sql/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/sql/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates/admin/index.php b/templates/admin/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates/admin/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates/blocks/index.php b/templates/blocks/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates/blocks/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates/index.php b/templates/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates/index.php @@ -0,0 +1,2 @@ + <{/if}> -<{if $rssfeed_link|default:false != ""}> +<{if $rssfeed_link|default:'' != ''}>
    <{$rssfeed_link|default:false}>
    <{/if}> diff --git a/templates/publisher_header.tpl b/templates/publisher_header.tpl index b97d02c5..caeeb3e0 100644 --- a/templates/publisher_header.tpl +++ b/templates/publisher_header.tpl @@ -53,6 +53,6 @@ <{/if}> <{/if}> -<{if $title_and_welcome|default:false && $lang_mainintro != ""}> +<{if $title_and_welcome|default:false && $lang_mainintro|default:'' != ''}> <{$lang_mainintro}> <{/if}> diff --git a/templates/publisher_rss.tpl b/templates/publisher_rss.tpl index 8a0f4aa0..0b168908 100644 --- a/templates/publisher_rss.tpl +++ b/templates/publisher_rss.tpl @@ -11,7 +11,7 @@ <{$channel_editor}> <{$channel_webmaster}> <{$channel_language}> - <{if $image_url != ""}> + <{if $image_url|default:'' != ''}> <{$channel_title}> <{$image_url}> diff --git a/templates/publisher_submit.tpl b/templates/publisher_submit.tpl index 90f48dea..2d104eb9 100644 --- a/templates/publisher_submit.tpl +++ b/templates/publisher_submit.tpl @@ -25,7 +25,7 @@ <{if !$element.hidden|default:false}> - <{if $element.caption|default:false != ''}> + <{if $element.caption|default:false|default:'' != ''}>
    <{$element.caption}> <{if $element.required}> diff --git a/templates_bootstrap/bootstrap3/index.html b/templates_bootstrap/bootstrap3/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/templates_bootstrap/bootstrap3/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates_bootstrap/bootstrap3/index.php b/templates_bootstrap/bootstrap3/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates_bootstrap/bootstrap3/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates_bootstrap/bootstrap3/publisher/blocks/index.php b/templates_bootstrap/bootstrap3/publisher/blocks/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates_bootstrap/bootstrap3/publisher/blocks/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates_bootstrap/bootstrap3/publisher/index.php b/templates_bootstrap/bootstrap3/publisher/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates_bootstrap/bootstrap3/publisher/index.php @@ -0,0 +1,2 @@ + <{/if}> -<{if $title_and_welcome && $lang_mainintro != ""}> +<{if $title_and_welcome && $lang_mainintro|default:'' != ''}>
    <{$lang_mainintro}>
    diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl b/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl index 3be3e511..d5626e94 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_item(title_bottom).tpl @@ -82,7 +82,11 @@
    <{$item.subtitle}>
    <{/if}> + + + <{$item.maintext}> +
    @@ -146,7 +150,7 @@ alt="<{$smarty.const._CO_PUBLISHER_DELETEFILE}>"> <{/if}> - <{$smarty.const._MD_PUBLISHER_DOWNLOAD_FILE}> <{$file.name}> diff --git a/templates_bootstrap/bootstrap3/publisher/publisher_item.tpl b/templates_bootstrap/bootstrap3/publisher/publisher_item.tpl index f03c7e70..5ee5e778 100644 --- a/templates_bootstrap/bootstrap3/publisher/publisher_item.tpl +++ b/templates_bootstrap/bootstrap3/publisher/publisher_item.tpl @@ -147,7 +147,7 @@ alt="<{$smarty.const._CO_PUBLISHER_DELETEFILE}>"> <{/if}> - <{$smarty.const._MD_PUBLISHER_DOWNLOAD_FILE}> <{$file.name}> diff --git a/templates_bootstrap/bootstrap4/index.html b/templates_bootstrap/bootstrap4/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/templates_bootstrap/bootstrap4/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates_bootstrap/bootstrap4/index.php b/templates_bootstrap/bootstrap4/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates_bootstrap/bootstrap4/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates_bootstrap/bootstrap4/publisher/blocks/index.php b/templates_bootstrap/bootstrap4/publisher/blocks/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates_bootstrap/bootstrap4/publisher/blocks/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/templates_bootstrap/bootstrap4/publisher/index.php b/templates_bootstrap/bootstrap4/publisher/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates_bootstrap/bootstrap4/publisher/index.php @@ -0,0 +1,2 @@ +
    <{$commentsnav}> <{$lang_notice}>
    - <{if $comment_mode == "flat"}> <{include file="db:system_comments_flat.tpl"}> <{elseif $comment_mode == "thread"}> <{include file="db:system_comments_thread.tpl"}> <{elseif $comment_mode == "nest"}> <{include file="db:system_comments_nest.tpl"}> <{/if}> + <{if $comment_mode|default:'' == "flat"}> + <{include file="db:system_comments_flat.tpl"}> + <{elseif $comment_mode|default:'' == "thread"}> + <{include file="db:system_comments_thread.tpl"}> + <{elseif $comment_mode|default:'' == "nest"}><{include file="db:system_comments_nest.tpl"}> <{/if}>
    <{/if}> -<{if $rssfeed_link|default:false != ""}> -
    <{$rssfeed_link|default:false}>
    <{/if}> +<{if $rssfeed_link|default:'' != ''}> +
    <{$rssfeed_link|default:''}>
    <{/if}> <{include file='db:system_notification_select.tpl'}> diff --git a/templates_bootstrap/bootstrap4/publisher/publisher_header.tpl b/templates_bootstrap/bootstrap4/publisher/publisher_header.tpl index 848e3b9b..7601d1ee 100644 --- a/templates_bootstrap/bootstrap4/publisher/publisher_header.tpl +++ b/templates_bootstrap/bootstrap4/publisher/publisher_header.tpl @@ -15,7 +15,7 @@ <{/if}> <{/if}> -<{if $title_and_welcome|default:false && $lang_mainintro != ""}> +<{if $title_and_welcome|default:false && $lang_mainintro|default:'' != ''}>
    <{$lang_mainintro}>
    diff --git a/templates_bootstrap/bootstrap4/publisher/publisher_item.tpl b/templates_bootstrap/bootstrap4/publisher/publisher_item.tpl index 5b2a68c1..d1f8d0b1 100644 --- a/templates_bootstrap/bootstrap4/publisher/publisher_item.tpl +++ b/templates_bootstrap/bootstrap4/publisher/publisher_item.tpl @@ -139,7 +139,7 @@ alt="<{$smarty.const._CO_PUBLISHER_DELETEFILE}>"> <{/if}> - <{$smarty.const._MD_PUBLISHER_DOWNLOAD_FILE}> <{$file.name}> diff --git a/templates_bootstrap/index.html b/templates_bootstrap/index.html deleted file mode 100644 index 74b6f45c..00000000 --- a/templates_bootstrap/index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/templates_bootstrap/index.php b/templates_bootstrap/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/templates_bootstrap/index.php @@ -0,0 +1,2 @@ +history.go(-1); \ No newline at end of file diff --git a/testdata/english/index.php b/testdata/english/index.php new file mode 100644 index 00000000..4ae18fd0 --- /dev/null +++ b/testdata/english/index.php @@ -0,0 +1,2 @@ +Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

    ' body: '

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    ' @@ -10,9 +10,9 @@ datesub: '1486997400' dateexpire: '0' status: '2' - image: '1' - images: '1' - counter: '133' + image: '0' + images: '' + counter: '134' rating: '0.0000' votes: '1' weight: '1' @@ -27,12 +27,13 @@ meta_keywords: 'XOOPS,Publisher' meta_description: 'This is a Meta Description' short_url: example_category_1 - item_tag: ItemTag1 + item_tag: '' votetype: '1' + votevalue: '' - itemid: '2' categoryid: '2' - title: 'Article 2' + title: 'Article 2 (Like/Dislike rating)' subtitle: 'Subtitle Teaser 2' summary: '

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

    ' body: '

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    ' @@ -41,8 +42,8 @@ datesub: '1486997400' dateexpire: '0' status: '2' - image: '2' - images: '2' + image: '0' + images: '' counter: '240' rating: '0.0000' votes: '1' @@ -58,12 +59,13 @@ meta_keywords: 'XOOPS,Publisher' meta_description: 'This is a Meta Description' short_url: example_category_1 - item_tag: ItemTag2 + item_tag: '' votetype: '3' + votevalue: '' - itemid: '3' categoryid: '3' - title: 'Article 3' + title: 'Article 3 (Like/Dislike rating)' subtitle: 'Subtitle Teaser 3' summary: '

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

    ' body: '

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    ' @@ -72,8 +74,8 @@ datesub: '1486997400' dateexpire: '0' status: '2' - image: '3' - images: '3' + image: '0' + images: '' counter: '93' rating: '0.0000' votes: '1' @@ -89,22 +91,23 @@ meta_keywords: 'XOOPS,Publisher' meta_description: 'This is a Meta Description' short_url: example_category_1 - item_tag: ItemTag3 + item_tag: '' votetype: '3' + votevalue: '' - itemid: '4' categoryid: '1' - title: 'Article 4' + title: 'Article 4 (5 Star rating)' subtitle: 'Subtitle Teaser 4' - summary: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.' - body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' + summary: '

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

    ' + body: '

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    ' uid: '1' author_alias: '' datesub: '1486990200' dateexpire: '0' status: '2' - image: '1' - images: '1' + image: '0' + images: '' counter: '532' rating: '0.0000' votes: '1' @@ -120,14 +123,15 @@ meta_keywords: 'XOOPS,Publisher' meta_description: 'This is a Meta Description' short_url: example_category_1 - item_tag: ItemTag4 - votetype: '4' + item_tag: '' + votetype: '1' + votevalue: '' - itemid: '5' categoryid: '2' - title: 'Article 5' + title: 'Article 5 (Reactions rating)' subtitle: 'Subtitle Teaser 5' - summary: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. ' + summary: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.' body: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.' uid: '1' author_alias: '' @@ -151,12 +155,13 @@ meta_keywords: 'XOOPS,Publisher' meta_description: 'This is a Meta Description' short_url: example_category_5 - item_tag: ItemTag5 + item_tag: '' votetype: '5' + votevalue: '' - itemid: '6' categoryid: '1' - title: 'Heart of Darkness, by Joseph Conrad' + title: 'Heart of Darkness, by Joseph Conrad (Like/Dislike rating)' subtitle: '' summary: '

    Heart of Darkness, by Joseph Conrad

    ' body: '

    The Nellie, a cruising yawl, swung to her anchor without a flutter of the sails, and was at rest. The flood had made, the wind was nearly calm, and being bound down the river, the only thing for it was to come to and wait for the turn of the tide.

    The sea-reach of the Thames stretched before us like the beginning of an interminable waterway. In the offing the sea and the sky were welded together without a joint, and in the luminous space the tanned sails of the barges drifting up with the tide seemed to stand still in red clusters of canvas sharply peaked, with gleams of varnished sprits. A haze rested on the low shores that ran out to sea in vanishing flatness. The air was dark above Gravesend, and farther back still seemed condensed into a mournful gloom, brooding motionless over the biggest, and the greatest, town on earth.

    The Director of Companies was our captain and our host. We four affectionately watched his back as he stood in the bows looking to seaward. On the whole river there was nothing that looked half so nautical. He resembled a pilot, which to a seaman is trustworthiness personified. It was difficult to realize his work was not out there in the luminous estuary, but behind him, within the brooding gloom.

    Between us there was, as I have already said somewhere, the bond of the sea. Besides holding our hearts together through long periods of separation, it had the effect of making us tolerant of each other’s yarns—and even convictions. The Lawyer—the best of old fellows—had, because of his many years and many virtues, the only cushion on deck, and was lying on the only rug. The Accountant had brought out already a box of dominoes, and was toying architecturally with the bones. Marlow sat cross-legged right aft, leaning against the mizzen-mast. He had sunken cheeks, a yellow complexion, a straight back, an ascetic aspect, and, with his arms dropped, the palms of hands outwards, resembled an idol. The director, satisfied the anchor had good hold, made his way aft and sat down amongst us. We exchanged a few words lazily. Afterwards there was silence on board the yacht. For some reason or other we did not begin that game of dominoes. We felt meditative, and fit for nothing but placid staring. The day was ending in a serenity of still and exquisite brilliance. The water shone pacifically; the sky, without a speck, was a benign immensity of unstained light; the very mist on the Essex marsh was like a gauzy and radiant fabric, hung from the wooded rises inland, and draping the low shores in diaphanous folds. Only the gloom to the west, brooding over the upper reaches, became more sombre every minute, as if angered by the approach of the sun.

    And at last, in its curved and imperceptible fall, the sun sank low, and from glowing white changed to a dull red without rays and without heat, as if about to go out suddenly, stricken to death by the touch of that gloom brooding over a crowd of men.

    Forthwith a change came over the waters, and the serenity became less brilliant but more profound. The old river in its broad reach rested unruffled at the decline of day, after ages of good service done to the race that peopled its banks, spread out in the tranquil dignity of a waterway leading to the uttermost ends of the earth. We looked at the venerable stream not in the vivid flush of a short day that comes and departs for ever, but in the august light of abiding memories. And indeed nothing is easier for a man who has, as the phrase goes, “followed the sea” with reverence and affection, than to evoke the great spirit of the past upon the lower reaches of the Thames. The tidal current runs to and fro in its unceasing service, crowded with memories of men and ships it had borne to the rest of home or to the battles of the sea. It had known and served all the men of whom the nation is proud, from Sir Francis Drake to Sir John Franklin, knights all, titled and untitled—the great knights-errant of the sea. It had borne all the ships whose names are like jewels flashing in the night of time, from the Golden Hind returning with her rotund flanks full of treasure, to be visited by the Queen’s Highness and thus pass out of the gigantic tale, to the Erebus and Terror, bound on other conquests—and that never returned. It had known the ships and the men. They had sailed from Deptford, from Greenwich, from Erith—the adventurers and the settlers; kings’ ships and the ships of men on ‘Change; captains, admirals, the dark “interlopers” of the Eastern trade, and the commissioned “generals” of East India fleets. Hunters for gold or pursuers of fame, they all had gone out on that stream, bearing the sword, and often the torch, messengers of the might within the land, bearers of a spark from the sacred fire. What greatness had not floated on the ebb of that river into the mystery of an unknown earth!… The dreams of men, the seed of commonwealths, the germs of empires.

    The sun set; the dusk fell on the stream, and lights began to appear along the shore. The Chapman light-house, a three-legged thing erect on a mud-flat, shone strongly. Lights of ships moved in the fairway—a great stir of lights going up and going down. And farther west on the upper reaches the place of the monstrous town was still marked ominously on the sky, a brooding gloom in sunshine, a lurid glare under the stars.

    “And this also,” said Marlow suddenly, “has been one of the dark places of the earth.”

    He was the only man of us who still “followed the sea.” The worst that could be said of him was that he did not represent his class. He was a seaman, but he was a wanderer, too, while most seamen lead, if one may so express it, a sedentary life. Their minds are of the stay-at-home order, and their home is always with them—the ship; and so is their country—the sea. One ship is very much like another, and the sea is always the same. In the immutability of their surroundings the foreign shores, the foreign faces, the changing immensity of life, glide past, veiled not by a sense of mystery but by a slightly disdainful ignorance; for there is nothing mysterious to a seaman unless it be the sea itself, which is the mistress of his existence and as inscrutable as Destiny. For the rest, after his hours of work, a casual stroll or a casual spree on shore suffices to unfold for him the secret of a whole continent, and generally he finds the secret not worth knowing. The yarns of seamen have a direct simplicity, the whole meaning of which lies within the shell of a cracked nut. But Marlow was not typical (if his propensity to spin yarns be excepted), and to him the meaning of an episode was not inside like a kernel but outside, enveloping the tale which brought it out only as a glow brings out a haze, in the likeness of one of these misty halos that sometimes are made visible by the spectral illumination of moonshine.

    His remark did not seem at all surprising. It was just like Marlow. It was accepted in silence. No one took the trouble to grunt even; and presently he said, very slow—“I was thinking of very old times, when the Romans first came here, nineteen hundred years ago—the other day …. Light came out of this river since—you say Knights? Yes; but it is like a running blaze on a plain, like a flash of lightning in the clouds. We live in the flicker—may it last as long as the old earth keeps rolling! But darkness was here yesterday. Imagine the feelings of a commander of a fine—what d’ye call ‘em?—trireme in the Mediterranean, ordered suddenly to the north; run overland across the Gauls in a hurry; put in charge of one of these craft the legionaries—a wonderful lot of handy men they must have been, too—used to build, apparently by the hundred, in a month or two, if we may believe what we read. Imagine him here—the very end of the world, a sea the colour of lead, a sky the colour of smoke, a kind of ship about as rigid as a concertina—and going up this river with stores, or orders, or what you like. Sand-banks, marshes, forests, savages,—precious little to eat fit for a civilized man, nothing but Thames water to drink. No Falernian wine here, no going ashore. Here and there a military camp lost in a wilderness, like a needle in a bundle of hay—cold, fog, tempests, disease, exile, and death—death skulking in the air, in the water, in the bush. They must have been dying like flies here. Oh, yes—he did it. Did it very well, too, no doubt, and without thinking much about it either, except afterwards to brag of what he had gone through in his time, perhaps. They were men enough to face the darkness. And perhaps he was cheered by keeping his eye on a chance of promotion to the fleet at Ravenna by and by, if he had good friends in Rome and survived the awful climate. Or think of a decent young citizen in a toga—perhaps too much dice, you know—coming out here in the train of some prefect, or tax-gatherer, or trader even, to mend his fortunes. Land in a swamp, march through the woods, and in some inland post feel the savagery, the utter savagery, had closed round him—all that mysterious life of the wilderness that stirs in the forest, in the jungles, in the hearts of wild men. There’s no initiation either into such mysteries. He has to live in the midst of the incomprehensible, which is also detestable. And it has a fascination, too, that goes to work upon him. The fascination of the abomination—you know, imagine the growing regrets, the longing to escape, the powerless disgust, the surrender, the hate.”

    ' @@ -181,13 +186,14 @@ notifypub: '0' meta_keywords: 'nthnthnth,dnthd,nhtd,ntdthd,nthd,nthdnthd,ntgdhnd,ntdnthdngtd' meta_description: 'tnh dnthd nhtd nhtd ntdthd nthd nthdnthd ntgdhnd ntdnthdngtd' - short_url: '' - item_tag: 'Theme, Bootstrap, jQuery, bootnewage' + short_url: heart-of-darkness-by-joseph-conrad-like-dislike-rating + item_tag: '' votetype: '3' + votevalue: '' - itemid: '7' categoryid: '5' - title: 'Test Expiration Date' + title: 'Test Expiration Date (Like/Dislike rating)' subtitle: '' summary: '

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

    ' body: '

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    ' @@ -215,10 +221,11 @@ short_url: test-di item_tag: '' votetype: '3' + votevalue: '' - itemid: '8' categoryid: '5' - title: 'Test DI FUTURE' + title: 'Test DI FUTURE (10 Star rating)' subtitle: '' summary: '

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

    ' body: '

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    ' @@ -227,8 +234,8 @@ datesub: '1553701200' dateexpire: '0' status: '2' - image: '4' - images: '4' + image: '0' + images: '' counter: '361' rating: '0.0000' votes: '1' @@ -246,10 +253,11 @@ short_url: test-di-future item_tag: '' votetype: '2' + votevalue: '' - itemid: '9' categoryid: '5' - title: 'Test DI' + title: 'Test DI (Like/Dislike rating)' subtitle: '' summary: '

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.

    ' body: '

    Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

    ' @@ -258,9 +266,9 @@ datesub: '1551368400' dateexpire: '0' status: '2' - image: '4' - images: '4' - counter: '224' + image: '0' + images: '' + counter: '233' rating: '0.0000' votes: '1' weight: '0' @@ -277,10 +285,11 @@ short_url: test-di item_tag: '' votetype: '3' + votevalue: '' - itemid: '10' categoryid: '5' - title: 'Test OFFLINE' + title: 'Test OFFLINE (5 Star rating)' subtitle: '' summary: '

    This is on OFFLINE article

    ' body: '

    This is on OFFLINE article

    Est primus bursa, cesaris.A falsis, luna albus abactus.A falsis, absolutio lotus barcas.Nomen de azureus nixus, promissio detrius!Onuss trabem in mare!

    Messors trabem in tectum!Indexs sunt caniss de bi-color lactea.

    Racanas unda!
    ' @@ -308,10 +317,11 @@ short_url: test-offline item_tag: '' votetype: '1' + votevalue: '' - itemid: '11' categoryid: '5' - title: 'Test Approval' + title: 'Test Approval (Reactions)' subtitle: '' summary: '

    sth st hsth

    ' body: '

    tnhsnth sthstnh th

    ' @@ -339,10 +349,11 @@ short_url: test-approval item_tag: '' votetype: '5' + votevalue: '' - itemid: '12' categoryid: '1' - title: 'Submitted New Article' + title: 'Submitted New Article (5 Star rating)' subtitle: 'Waiting for Approval' summary: '
    Est primus bursa, cesaris.A falsis, luna albus abactus.A falsis, absolutio lotus barcas.Nomen de azureus nixus, promissio detrius!Onuss trabem in mare!
    ' body: '
    Est primus bursa, cesaris.A falsis, luna albus abactus.A falsis, absolutio lotus barcas.Nomen de azureus nixus, promissio detrius!Onuss trabem in mare!Messors trabem in tectum!Indexs sunt caniss de bi-color lactea.Racanas unda!
    ' @@ -370,10 +381,11 @@ short_url: submitted_new item_tag: '' votetype: '1' + votevalue: '' - itemid: '13' categoryid: '5' - title: 'Rejected Article' + title: 'Rejected Article (5 Star rating)' subtitle: '' summary: '

    This is a rejected article

    ' body: '
    This is a rejected article
    Est primus bursa, cesaris.A falsis, luna albus abactus.A falsis, absolutio lotus barcas.Nomen de azureus nixus, promissio detrius!Onuss trabem in mare!Messors trabem in tectum!Indexs sunt caniss de bi-color lactea.Racanas unda!
    ' @@ -401,3 +413,36 @@ short_url: rejected item_tag: '' votetype: '1' + votevalue: '' +- + itemid: '14' + categoryid: '1' + title: '10 Numbers rating' + subtitle: '' + summary: '

    xxx htdnthdnthd nthd

    ' + body: '

    tnhd nthdnthdtnhd

    ' + uid: '1' + author_alias: '' + datesub: '1610439000' + dateexpire: '0' + status: '2' + image: '0' + images: '' + counter: '0' + rating: '0.0000' + votes: '0' + weight: '0' + dohtml: '1' + dosmiley: '1' + doxcode: '1' + doimage: '1' + dobr: '1' + cancomment: '1' + comments: '0' + notifypub: '0' + meta_keywords: 'xxxx,htdnthdnthd,nthd' + meta_description: 'xxx htdnthdnthd nthd' + short_url: xxxx + item_tag: '' + votetype: '4' + votevalue: '' diff --git a/testdata/english/publisher_rating.yml b/testdata/english/publisher_rating.yml index 5fb31370..9998e8d8 100644 --- a/testdata/english/publisher_rating.yml +++ b/testdata/english/publisher_rating.yml @@ -1,6 +1,6 @@ - ratingid: '1' - itemid: '1' + itemid: '3' uid: '1' rate: '1' date: '1600080372' @@ -9,7 +9,7 @@ votetype: '3' - ratingid: '2' - itemid: '2' + itemid: '9' uid: '1' rate: '-1' date: '1600081774' @@ -18,7 +18,7 @@ votetype: '3' - ratingid: '3' - itemid: '1' + itemid: '9' uid: '2' rate: '1' date: '1600082767' @@ -27,7 +27,7 @@ votetype: '3' - ratingid: '4' - itemid: '2' + itemid: '6' uid: '1' rate: '1' date: '1600166527' @@ -77,11 +77,11 @@ rate: '1' date: '1600170106' ip: 78.83.87.210 - source: '3' + source: '1' votetype: '3' - ratingid: '10' - itemid: '2' + itemid: '6' uid: '6' rate: '-1' date: '1600170151' @@ -90,7 +90,7 @@ votetype: '3' - ratingid: '11' - itemid: '2' + itemid: '9' uid: '7' rate: '-1' date: '1603038378' @@ -135,7 +135,7 @@ votetype: '3' - ratingid: '16' - itemid: '2' + itemid: '1' uid: '5' rate: '1' date: '1603083350' @@ -144,7 +144,7 @@ votetype: '1' - ratingid: '17' - itemid: '2' + itemid: '10' uid: '5' rate: '1' date: '1603083452' @@ -153,7 +153,7 @@ votetype: '1' - ratingid: '18' - itemid: '7' + itemid: '13' uid: '5' rate: '1' date: '1603083468' @@ -198,16 +198,16 @@ votetype: '3' - ratingid: '23' - itemid: '7' + itemid: '6' uid: '5' - rate: '4' + rate: '1' date: '1603084835' ip: '' source: '1' votetype: '3' - ratingid: '24' - itemid: '1' + itemid: '6' uid: '5' rate: '-1' date: '1603086728' @@ -225,7 +225,7 @@ votetype: '1' - ratingid: '26' - itemid: '0' + itemid: '1' uid: '0' rate: '5' date: '1603087380' @@ -249,55 +249,55 @@ date: '1603413237' ip: '' source: '1' - votetype: '1' + votetype: '2' - ratingid: '29' itemid: '8' uid: '0' - rate: '-1' + rate: '3' date: '1603413247' ip: '' source: '1' - votetype: '1' + votetype: '2' - ratingid: '30' itemid: '8' uid: '0' - rate: '-1' + rate: '8' date: '1603413248' ip: '' source: '1' - votetype: '1' + votetype: '2' - ratingid: '31' - itemid: '8' + itemid: '4' uid: '0' - rate: '-1' + rate: '4' date: '1603413249' ip: '' source: '1' votetype: '1' - ratingid: '32' - itemid: '5' + itemid: '10' uid: '0' - rate: '1' + rate: '2' date: '1603424515' ip: '' source: '1' votetype: '1' - ratingid: '33' - itemid: '5' + itemid: '9' uid: '0' rate: '-1' date: '1603424520' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '34' - itemid: '5' + itemid: '13' uid: '0' rate: '1' date: '1603424828' @@ -306,16 +306,16 @@ votetype: '1' - ratingid: '35' - itemid: '5' + itemid: '3' uid: '0' rate: '-1' date: '1603424834' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '36' - itemid: '6' + itemid: '1' uid: '0' rate: '1' date: '1603425156' @@ -324,7 +324,7 @@ votetype: '1' - ratingid: '37' - itemid: '6' + itemid: '10' uid: '0' rate: '1' date: '1603425167' @@ -339,7 +339,7 @@ date: '1603425175' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '39' itemid: '6' @@ -348,10 +348,10 @@ date: '1603425201' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '40' - itemid: '6' + itemid: '4' uid: '0' rate: '1' date: '1603425246' @@ -360,7 +360,7 @@ votetype: '1' - ratingid: '41' - itemid: '6' + itemid: '4' uid: '0' rate: '1' date: '1603426430' @@ -369,16 +369,16 @@ votetype: '1' - ratingid: '42' - itemid: '6' + itemid: '11' uid: '0' rate: '1' date: '1603426491' ip: '' source: '1' - votetype: '1' + votetype: '5' - ratingid: '43' - itemid: '6' + itemid: '13' uid: '0' rate: '1' date: '1603426589' @@ -387,7 +387,7 @@ votetype: '1' - ratingid: '44' - itemid: '6' + itemid: '1' uid: '5' rate: '1' date: '1603426722' @@ -396,7 +396,7 @@ votetype: '1' - ratingid: '45' - itemid: '6' + itemid: '4' uid: '2' rate: '1' date: '1603426746' @@ -405,7 +405,7 @@ votetype: '1' - ratingid: '46' - itemid: '6' + itemid: '4' uid: '1' rate: '1' date: '1603426945' @@ -414,16 +414,16 @@ votetype: '1' - ratingid: '47' - itemid: '5' + itemid: '12' uid: '1' - rate: '7' + rate: '5' date: '1603430099' ip: '' source: '1' votetype: '1' - ratingid: '48' - itemid: '7' + itemid: '1' uid: '1' rate: '1' date: '1608463542' @@ -432,7 +432,7 @@ votetype: '1' - ratingid: '49' - itemid: '7' + itemid: '12' uid: '0' rate: '2' date: '1608464480' @@ -441,7 +441,7 @@ votetype: '1' - ratingid: '50' - itemid: '7' + itemid: '13' uid: '0' rate: '3' date: '1608464495' @@ -450,7 +450,7 @@ votetype: '1' - ratingid: '51' - itemid: '7' + itemid: '4' uid: '0' rate: '2' date: '1608465043' @@ -459,25 +459,25 @@ votetype: '1' - ratingid: '52' - itemid: '0' + itemid: '3' uid: '0' rate: '-1' date: '1608535960' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '53' - itemid: '0' + itemid: '10' uid: '0' - rate: '1' + rate: '3' date: '1608535984' ip: '' source: '1' votetype: '1' - ratingid: '54' - itemid: '0' + itemid: '1' uid: '0' rate: '1' date: '1608536072' @@ -486,16 +486,16 @@ votetype: '1' - ratingid: '55' - itemid: '0' + itemid: '4' uid: '0' - rate: '1' + rate: '5' date: '1608536080' ip: '' source: '1' votetype: '1' - ratingid: '56' - itemid: '0' + itemid: '1' uid: '0' rate: '1' date: '1608536311' @@ -504,7 +504,7 @@ votetype: '1' - ratingid: '57' - itemid: '0' + itemid: '12' uid: '0' rate: '1' date: '1608536378' @@ -513,16 +513,16 @@ votetype: '1' - ratingid: '58' - itemid: '0' + itemid: '14' uid: '0' - rate: '1' + rate: '7' date: '1608536854' ip: '' source: '1' - votetype: '1' + votetype: '4' - ratingid: '59' - itemid: '0' + itemid: '1' uid: '0' rate: '1' date: '1608536926' @@ -531,13 +531,13 @@ votetype: '1' - ratingid: '60' - itemid: '9' + itemid: '14' uid: '0' - rate: '1' + rate: '9' date: '1608537199' ip: '' source: '1' - votetype: '1' + votetype: '4' - ratingid: '61' itemid: '9' @@ -546,7 +546,7 @@ date: '1608537299' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '62' itemid: '9' @@ -555,7 +555,7 @@ date: '1608537304' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '63' itemid: '9' @@ -564,97 +564,97 @@ date: '1608537309' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '64' - itemid: '7' + itemid: '9' uid: '0' rate: '-1' date: '1608565406' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '65' - itemid: '0' - uid: '0' + itemid: '9' + uid: '2' rate: '-1' date: '1608870150' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '66' itemid: '6' - uid: '0' + uid: '1' rate: '-1' date: '1608870194' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '67' - itemid: '6' - uid: '0' + itemid: '9' + uid: '1' rate: '-1' date: '1608870207' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '68' itemid: '7' - uid: '0' + uid: '2' rate: '-1' date: '1608883620' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '69' itemid: '7' - uid: '0' - rate: '-1' + uid: '1' + rate: '1' date: '1608884456' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '70' - itemid: '7' - uid: '0' + itemid: '2' + uid: '2' rate: '-1' date: '1608884803' ip: '' source: '1' - votetype: '1' + votetype: '3' - ratingid: '71' itemid: '7' - uid: '0' + uid: '1' rate: '-1' date: '1608885197' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '72' itemid: '7' - uid: '0' + uid: '2' rate: '-1' date: '1608885231' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '73' itemid: '7' - uid: '0' + uid: '1' rate: '-1' date: '1608885237' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '74' itemid: '7' @@ -663,7 +663,7 @@ date: '1608885306' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '75' itemid: '7' @@ -672,10 +672,10 @@ date: '1608885318' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '76' - itemid: '7' + itemid: '1' uid: '1' rate: '1' date: '1608886477' @@ -684,27 +684,27 @@ votetype: '1' - ratingid: '77' - itemid: '7' + itemid: '13' uid: '1' - rate: '1' + rate: '4' date: '1608886483' ip: '::1' source: '1' votetype: '1' - ratingid: '78' - itemid: '7' + itemid: '12' uid: '1' - rate: '1' + rate: '3' date: '1608886571' ip: '::1' source: '1' votetype: '1' - ratingid: '79' - itemid: '7' + itemid: '4' uid: '1' - rate: '1' + rate: '2' date: '1608886586' ip: '::1' source: '1' @@ -717,12 +717,12 @@ date: '1608886592' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '81' - itemid: '7' + itemid: '1' uid: '1' - rate: '1' + rate: '5' date: '1608887202' ip: '::1' source: '1' @@ -735,12 +735,12 @@ date: '1609066427' ip: '::1' source: '1' - votetype: '3' + votetype: '5' - ratingid: '83' - itemid: '7' + itemid: '4' uid: '3' - rate: '9' + rate: '4' date: '1608888776' ip: '::1' source: '1' @@ -749,20 +749,20 @@ ratingid: '85' itemid: '11' uid: '2' - rate: '2' + rate: '3' date: '1609070268' ip: '::1' source: '1' - votetype: '1' + votetype: '5' - ratingid: '86' itemid: '11' uid: '3' - rate: '2' + rate: '6' date: '1609070323' ip: '::1' source: '1' - votetype: '1' + votetype: '5' - ratingid: '87' itemid: '9' @@ -771,7 +771,7 @@ date: '1609070360' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '88' itemid: '9' @@ -780,12 +780,12 @@ date: '1609070367' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '89' itemid: '4' uid: '1' - rate: '8' + rate: '5' date: '1609072806' ip: '::1' source: '1' @@ -812,7 +812,7 @@ ratingid: '92' itemid: '4' uid: '2' - rate: '10' + rate: '3' date: '1609073097' ip: '::1' source: '1' @@ -873,9 +873,9 @@ votetype: '1' - ratingid: '861' - itemid: '3' + itemid: '10' uid: '1' - rate: '1' + rate: '5' date: '1609520318' ip: '::1' source: '1' @@ -888,7 +888,7 @@ date: '1609521721' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '863' itemid: '6' @@ -897,28 +897,28 @@ date: '1609536526' ip: '::1' source: '1' - votetype: '1' + votetype: '3' - ratingid: '864' - itemid: '6' + itemid: '1' uid: '1' - rate: '-1' + rate: '4' date: '1609536980' ip: '::1' source: '1' votetype: '1' - ratingid: '865' - itemid: '6' + itemid: '10' uid: '1' - rate: '-1' + rate: '1' date: '1609537043' ip: '::1' source: '1' votetype: '1' - ratingid: '866' - itemid: '6' + itemid: '12' uid: '1' rate: '1' date: '1609537049' @@ -933,22 +933,85 @@ date: '1609537199' ip: '::1' source: '1' - votetype: '1' + votetype: '2' - ratingid: '868' itemid: '8' uid: '1' - rate: '10' + rate: '9' date: '1609537205' ip: '::1' source: '1' - votetype: '1' + votetype: '2' - ratingid: '869' - itemid: '8' + itemid: '14' uid: '1' - rate: '10' + rate: '2' date: '1609537211' ip: '::1' source: '1' + votetype: '4' +- + ratingid: '871' + itemid: '14' + uid: '1' + rate: '8' + date: '1610504760' + ip: '::1' + source: '1' + votetype: '4' +- + ratingid: '872' + itemid: '10' + uid: '1' + rate: '2' + date: '1613037798' + ip: '::1' + source: '1' + votetype: '1' +- + ratingid: '873' + itemid: '11' + uid: '1' + rate: '5' + date: '1613046112' + ip: '::1' + source: '1' votetype: '1' +- + ratingid: '874' + itemid: '5' + uid: '1' + rate: '2' + date: '1613046453' + ip: '::1' + source: '1' + votetype: '5' +- + ratingid: '875' + itemid: '5' + uid: '1' + rate: '4' + date: '1613046883' + ip: '::1' + source: '1' + votetype: '5' +- + ratingid: '876' + itemid: '5' + uid: '1' + rate: '6' + date: '1613047333' + ip: '::1' + source: '1' + votetype: '5' +- + ratingid: '877' + itemid: '5' + uid: '1' + rate: '6' + date: '1613047510' + ip: '::1' + source: '1' + votetype: '5' diff --git a/testdata/index.html b/testdata/index.html deleted file mode 100644 index 2c5cdd3f..00000000 --- a/testdata/index.html +++ /dev/null @@ -1 +0,0 @@ - diff --git a/testdata/index.php b/testdata/index.php index bcacb54a..4ec2fdb9 100644 --- a/testdata/index.php +++ b/testdata/index.php @@ -17,21 +17,22 @@ */ use Xmf\Database\TableLoad; -use \Xmf\Request; +use Xmf\Request; +use Xmf\Yaml; use XoopsModules\Publisher\{Helper, - Common, + Common\Configurator, Utility }; -use Xmf\Yaml; - /** @var Helper $helper */ +/** @var Utility $utility */ +/** @var Configurator $configurator */ -require_once dirname(__DIR__, 3) . '/include/cp_header.php'; -require dirname(__DIR__) . '/preloads/autoloader.php'; +require \dirname(__DIR__, 3) . '/include/cp_header.php'; +require \dirname(__DIR__) . '/preloads/autoloader.php'; $op = Request::getCmd('op', ''); -$moduleDirName = basename(dirname(__DIR__)); +$moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $helper = Helper::getInstance(); @@ -47,13 +48,16 @@ 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 @@ -61,12 +65,11 @@ function loadSampleData() { global $xoopsConfig; - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); $utility = new Utility(); - $configurator = new Common\Configurator(); - $helper = Helper::getInstance(); + $configurator = new Configurator(); $tables = \Xmf\Module\Helper::getHelper($moduleDirName)->getModule()->getInfo('tables'); @@ -85,30 +88,28 @@ function loadSampleData() // load permissions $table = 'group_permission'; $tabledata = Yaml::readWrapped($language . $table . '.yml'); - $moduleId = $helper->getModule()->getVar('mid'); - loadTableFromArrayWithReplace($table, $tabledata, 'gperm_modid', $moduleId); + $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]; $dest = $configurator->copyTestFolders[$i][1]; $utility::rcopy($src, $dest); } } - \redirect_header('../admin/index.php', 1, \constant('CO_' . $moduleDirNameUpper . '_' . 'SAVE_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); $helper = Helper::getInstance(); - $moduleId = $helper->getModule()->getVar('mid'); - - $tables = $helper->getModule()->getInfo('tables'); + $tables = $helper->getModule()->getInfo('tables'); $languageFolder = __DIR__ . '/' . $xoopsConfig['language']; if (!file_exists($languageFolder . '/')) { @@ -124,7 +125,7 @@ function saveSampleData() // save permissions $criteria = new \CriteriaCompo(); - $criteria->add(new \Criteria('gperm_modid', $moduleId)); + $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); @@ -134,7 +135,7 @@ function saveSampleData() function exportSchema() { - $moduleDirName = basename(dirname(__DIR__)); + $moduleDirName = \basename(\dirname(__DIR__)); $moduleDirNameUpper = mb_strtoupper($moduleDirName); try { @@ -202,3 +203,17 @@ function loadTableFromArrayWithReplace($table, $data, $search, $replace) 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..4ae18fd0 --- /dev/null +++ b/tests/index.php @@ -0,0 +1,2 @@ +setVar('uid', $itemRating['uid']); $voteObj->setVar('ip', $itemRating['ip']); $voteObj->setVar('date', \time()); + $voteObj->setVar('votetype', $votingType); // Insert Data if ($voteHandler->insert($voteObj)) { unset($voteObj); diff --git a/xoops_version.php b/xoops_version.php index 0c7bc534..c0f22915 100644 --- a/xoops_version.php +++ b/xoops_version.php @@ -36,8 +36,8 @@ $modversion = [ 'version' => '1.08', - 'module_status' => 'Alpha 4', - 'release_date' => '2021/01/12', + 'module_status' => 'Alpha 5', + 'release_date' => '2021/08/08', 'name' => _MI_PUBLISHER_MD_NAME, 'description' => _MI_PUBLISHER_MD_DESC, 'author' => 'Trabis (www.Xuups.com)', @@ -62,7 +62,7 @@ 'onInstall' => 'include/oninstall.php', 'onUpdate' => 'include/onupdate.php', // ------------------- Min Requirements ------------------- - 'min_php' => '7.2', + 'min_php' => '7.3', 'min_xoops' => '2.5.10', 'min_admin' => '1.2', 'min_db' => ['mysql' => '5.5'],